static int sh_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
{
	struct sh_rtc *rtc = dev_get_drvdata(dev);
	unsigned int ret = 0;

	switch (cmd) {
	case RTC_PIE_OFF:
	case RTC_PIE_ON:
		sh_rtc_setpie(dev, cmd == RTC_PIE_ON);
		break;
	case RTC_AIE_OFF:
	case RTC_AIE_ON:
		sh_rtc_setaie(dev, cmd == RTC_AIE_ON);
		break;
	case RTC_UIE_OFF:
		rtc->periodic_freq &= ~PF_OXS;
		break;
	case RTC_UIE_ON:
		rtc->periodic_freq |= PF_OXS;
		break;
	case RTC_IRQP_READ:
		ret = put_user(rtc->rtc_dev->irq_freq,
			       (unsigned long __user *)arg);
		break;
	case RTC_IRQP_SET:
		ret = sh_rtc_setfreq(dev, arg);
		break;
	default:
		ret = -ENOIOCTLCMD;
	}

	return ret;
}
Esempio n. 2
0
static void sh_rtc_release(struct device *dev)
{
	struct sh_rtc *rtc = dev_get_drvdata(dev);

	sh_rtc_setpie(dev, 0);
	sh_rtc_setaie(dev, 0);

	free_irq(rtc->periodic_irq, dev);
	free_irq(rtc->carry_irq, dev);
	free_irq(rtc->alarm_irq, dev);
}
Esempio n. 3
0
static int __devexit sh_rtc_remove(struct platform_device *pdev)
{
	struct sh_rtc *rtc = platform_get_drvdata(pdev);

	if (likely(rtc->rtc_dev))
		rtc_device_unregister(rtc->rtc_dev);

	sh_rtc_setpie(&pdev->dev, 0);
	sh_rtc_setaie(&pdev->dev, 0);

	release_resource(rtc->res);

	platform_set_drvdata(pdev, NULL);

	kfree(rtc);

	return 0;
}
Esempio n. 4
0
static int sh_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
{
	unsigned int ret = -ENOIOCTLCMD;

	switch (cmd) {
	case RTC_PIE_OFF:
	case RTC_PIE_ON:
		sh_rtc_setpie(dev, cmd == RTC_PIE_ON);
		ret = 0;
		break;
	case RTC_AIE_OFF:
	case RTC_AIE_ON:
		sh_rtc_setaie(dev, cmd == RTC_AIE_ON);
		ret = 0;
		break;
	}

	return ret;
}
static void sh_rtc_release(struct device *dev)
{
	sh_rtc_setpie(dev, 0);
	sh_rtc_setaie(dev, 0);
}