linux/drivers/rtc/rtc-mxc_v2.c File Reference

Real Time Clock interface. More...

Functions

static void rtc_write_sync_lp (void __iomem *ioaddr)
static int rtc_update_alarm (struct device *dev, struct rtc_time *alrm)
static irqreturn_t mxc_rtc_interrupt (int irq, void *dev_id)
static int mxc_rtc_open (struct device *dev)
static void mxc_rtc_release (struct device *dev)
static int mxc_rtc_ioctl (struct device *dev, unsigned int cmd, unsigned long arg)
static int mxc_rtc_read_time (struct device *dev, struct rtc_time *tm)
static int mxc_rtc_set_time (struct device *dev, struct rtc_time *tm)
static int mxc_rtc_read_alarm (struct device *dev, struct rtc_wkalrm *alrm)
static int mxc_rtc_set_alarm (struct device *dev, struct rtc_wkalrm *alrm)
static int mxc_rtc_proc (struct device *dev, struct seq_file *seq)
static int mxc_rtc_probe (struct platform_device *pdev)
static int mxc_rtc_suspend (struct platform_device *pdev, pm_message_t state)
static int mxc_rtc_resume (struct platform_device *pdev)
static int __init mxc_rtc_init (void)
static void __exit mxc_rtc_exit (void)

Variables

static struct rtc_class_ops mxc_rtc_ops
static struct platform_driver mxc_rtc_driver

Detailed Description

Real Time Clock interface.

This file contains Real Time Clock interface for Linux.


Function Documentation

static void __exit mxc_rtc_exit ( void   )  [static]

This function removes the /proc/driver/rtc file and un-registers the device RTC from the /dev/misc directory.

static int __init mxc_rtc_init ( void   )  [static]

This function creates the /proc/driver/rtc file and registers the device RTC in the /dev/misc directory. It also reads the RTC value from external source and setup the internal RTC properly.

Returns:
-1 if RTC is failed to initialize; 0 is successful.
static irqreturn_t mxc_rtc_interrupt ( int  irq,
void *  dev_id 
) [static]

This function is the RTC interrupt service routine.

Parameters:
irq RTC IRQ number
dev_id device ID which is not used
Returns:
IRQ_HANDLED as defined in the include/linux/interrupt.h file.

References IRQ_HANDLED, and rtc_write_sync_lp().

Referenced by mxc_rtc_probe().

static int mxc_rtc_ioctl ( struct device *  dev,
unsigned int  cmd,
unsigned long  arg 
) [static]

This function is used to support some ioctl calls directly. Other ioctl calls are supported indirectly through the arm/common/rtctime.c file.

Parameters:
cmd ioctl command as defined in include/linux/rtc.h
arg value for the ioctl command
Returns:
0 if successful or negative value otherwise.
static int mxc_rtc_open ( struct device *  dev  )  [static]

This function is used to open the RTC driver.

Returns:
0 if successful; non-zero otherwise.
static int mxc_rtc_probe ( struct platform_device *  pdev  )  [static]

MXC RTC Power management control

References mxc_rtc_interrupt().

static int mxc_rtc_proc ( struct device *  dev,
struct seq_file *  seq 
) [static]

This function is used to provide the content for the /proc/driver/rtc file.

Parameters:
seq buffer to hold the information that the driver wants to write
Returns:
The number of bytes written into the rtc file.
static int mxc_rtc_read_alarm ( struct device *  dev,
struct rtc_wkalrm *  alrm 
) [static]

This function reads the current alarm value into the passed in alrm argument. It updates the alrm's pending field value based on the whether an alarm interrupt occurs or not.

Parameters:
alrm contains the RTC alarm value upon return
Returns:
0 if successful; non-zero otherwise.
static int mxc_rtc_read_time ( struct device *  dev,
struct rtc_time *  tm 
) [static]

This function reads the current RTC time into tm in Gregorian date.

Parameters:
tm contains the RTC time value upon return
Returns:
0 if successful; non-zero otherwise.
static void mxc_rtc_release ( struct device *  dev  )  [static]

clear all interrupts and release the IRQ

static int mxc_rtc_resume ( struct platform_device *  pdev  )  [static]

This function is called to correct the system time based on the current MXC RTC time relative to the time delta saved during suspend.

Parameters:
pdev not used
Returns:
The function always returns 0.
static int mxc_rtc_set_alarm ( struct device *  dev,
struct rtc_wkalrm *  alrm 
) [static]

This function sets the RTC alarm based on passed in alrm.

Parameters:
alrm the alarm value to be set in the RTC
Returns:
0 if successful; non-zero otherwise.

References rtc_update_alarm(), and rtc_write_sync_lp().

static int mxc_rtc_set_time ( struct device *  dev,
struct rtc_time *  tm 
) [static]

This function sets the internal RTC time based on tm in Gregorian date.

Parameters:
tm the time value to be set in the RTC
Returns:
0 if successful; non-zero otherwise.

References rtc_write_sync_lp().

static int mxc_rtc_suspend ( struct platform_device *  pdev,
pm_message_t  state 
) [static]

This function is called to save the system time delta relative to the MXC RTC when enterring a low power state. This time delta is then used on resume to adjust the system time to account for time loss while suspended.

Parameters:
pdev not used
state Power state to enter.
Returns:
The function always returns 0.
static int rtc_update_alarm ( struct device *  dev,
struct rtc_time *  alrm 
) [static]

This function updates the RTC alarm registers and then clears all the interrupt status bits.

Parameters:
alrm the new alarm value to be updated in the RTC
Returns:
0 if successful; non-zero otherwise.

Referenced by mxc_rtc_set_alarm().

static void rtc_write_sync_lp ( void __iomem *  ioaddr  )  [inline, static]

This function does write synchronization for writes to the lp srtc block. To take care of the asynchronous CKIL clock, all writes from the IP domain will be synchronized to the CKIL domain.

Referenced by mxc_rtc_interrupt(), mxc_rtc_set_alarm(), and mxc_rtc_set_time().


Variable Documentation

struct platform_driver mxc_rtc_driver [static]
Initial value:
 {
        .driver = {
                   .name = "mxc_rtc",
                   },
        .probe = mxc_rtc_probe,
        .remove = __exit_p(mxc_rtc_remove),
        .suspend = mxc_rtc_suspend,
        .resume = mxc_rtc_resume,
}

Contains pointers to the power management callback functions.

struct rtc_class_ops mxc_rtc_ops [static]
Initial value:
 {
        .open = mxc_rtc_open,
        .release = mxc_rtc_release,
        .ioctl = mxc_rtc_ioctl,
        .read_time = mxc_rtc_read_time,
        .set_time = mxc_rtc_set_time,
        .read_alarm = mxc_rtc_read_alarm,
        .set_alarm = mxc_rtc_set_alarm,
        .proc = mxc_rtc_proc,
        .alarm_irq_enable = mxc_rtc_alarm_irq_enable,
}

The RTC driver structure

footer
©  Freescale Semiconductor, Inc., 2007.  All rights reserved.
Freescale Confidential Proprietary
NDA Required
doxygen