Exemplo n.º 1
0
static int twl4030_rtc_ioctl(struct device *dev, unsigned int cmd,
			     unsigned long arg)
{

	switch (cmd) {
	case RTC_AIE_OFF:
		return twl4030_rtc_alarm_irq_set_state(dev, 0);
	case RTC_AIE_ON:
		return twl4030_rtc_alarm_irq_set_state(dev, 1);
	case RTC_UIE_OFF:
		/* Mask ints from RTC updates.  */
		return twl4030_rtc_irq_set_state(dev, 0);
	case RTC_UIE_ON:
		/* Allow ints for RTC updates.  */
		return twl4030_rtc_irq_set_state(dev, 1);
	case RTC_EPOCH_READ:
		return put_user(epoch, (unsigned long *)arg);
	case RTC_EPOCH_SET:	
		/*
		 * There were no RTC clocks before 1900.
		 */
		if (arg < 1900)
			return -EINVAL;

		if (!capable(CAP_SYS_TIME))
			return -EACCES;

		epoch = arg;
		return 0;
	default:
		return -ENOIOCTLCMD;
	}
}
Exemplo n.º 2
0
static int twl4030_rtc_ioctl(struct device *dev, unsigned int cmd,
			     unsigned long arg)
{
	switch (cmd) {
	case RTC_AIE_OFF:
		return twl4030_rtc_alarm_irq_set_state(0);
	case RTC_AIE_ON:
		return twl4030_rtc_alarm_irq_set_state(1);
	case RTC_UIE_OFF:
		return twl4030_rtc_irq_set_state(0);
	case RTC_UIE_ON:
		return twl4030_rtc_irq_set_state(1);

	default:
		return -ENOIOCTLCMD;
	}
}
Exemplo n.º 3
0
static void twl4030_rtc_shutdown(struct platform_device *pdev)
{
	twl4030_rtc_alarm_irq_set_state(&pdev->dev, 0);
	twl4030_rtc_irq_set_state(&pdev->dev, 0);
}