Patchwork [2/3] rtc/spear: Fix for RTC_AIE_ON and RTC_AIE_OFF ioctl errors

login
register
mail settings
Submitter Viresh KUMAR
Date Jan. 5, 2012, 9 a.m.
Message ID <ac776acad2caa8dee880f3e7833e72d700a58b8c.1325753573.git.viresh.kumar@st.com>
Download mbox | patch
Permalink /patch/134442/
State New
Headers show

Comments

Viresh KUMAR - Jan. 5, 2012, 9 a.m.
From: Shiraz Hashim <shiraz.hashim@st.com>

Define API for '.alarm_irq_enable' to enable and disable alarm irq. This
is required by the framework else RTC_AIE_ON and RTC_AIE_OFF ioctls
return errors.

Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com>
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
---
 drivers/rtc/rtc-spear.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)
rajeev - Jan. 5, 2012, 9:36 a.m.
On 1/5/2012 2:38 PM, Viresh KUMAR wrote:
> From: Shiraz Hashim<shiraz.hashim@st.com>
>
> Define API for '.alarm_irq_enable' to enable and disable alarm irq. This
> is required by the framework else RTC_AIE_ON and RTC_AIE_OFF ioctls
> return errors.
>
> Signed-off-by: Shiraz Hashim<shiraz.hashim@st.com>
> Signed-off-by: Viresh Kumar<viresh.kumar@st.com>
> ---
>   drivers/rtc/rtc-spear.c |   28 ++++++++++++++++++++++++++++
>   1 files changed, 28 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
> index 7895712..f77f16d 100644
> --- a/drivers/rtc/rtc-spear.c
> +++ b/drivers/rtc/rtc-spear.c
> @@ -327,11 +327,39 @@ static int spear_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
>
>   	return 0;
>   }
> +
> +static int spear_alarm_irq_enable(struct device *dev, unsigned int enabled)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +	struct rtc_device *rtc = platform_get_drvdata(pdev);
> +	struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
> +	int ret = 0;
> +
> +	spear_rtc_clear_interrupt(config);
> +
> +	switch (enabled) {
> +	case 0:
> +		/* alarm off */
> +		spear_rtc_disable_interrupt(config);
> +		break;
> +	case 1:
> +		/* alarm on */
> +		spear_rtc_enable_interrupt(config);
> +		break;
> +	default:
> +		ret = -EINVAL;
> +		break;
> +	}
> +
> +	return ret;
> +}
> +
>   static struct rtc_class_ops spear_rtc_ops = {
>   	.read_time = spear_rtc_read_time,
>   	.set_time = spear_rtc_set_time,
>   	.read_alarm = spear_rtc_read_alarm,
>   	.set_alarm = spear_rtc_set_alarm,
> +	.alarm_irq_enable = spear_alarm_irq_enable,
>   };
>
>   static int __devinit spear_rtc_probe(struct platform_device *pdev)

Acked-by: Rajeev Kumar <rajeev-dlh.kumar@st.com>

Patch

diff --git a/drivers/rtc/rtc-spear.c b/drivers/rtc/rtc-spear.c
index 7895712..f77f16d 100644
--- a/drivers/rtc/rtc-spear.c
+++ b/drivers/rtc/rtc-spear.c
@@ -327,11 +327,39 @@  static int spear_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 
 	return 0;
 }
+
+static int spear_alarm_irq_enable(struct device *dev, unsigned int enabled)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct rtc_device *rtc = platform_get_drvdata(pdev);
+	struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+	int ret = 0;
+
+	spear_rtc_clear_interrupt(config);
+
+	switch (enabled) {
+	case 0:
+		/* alarm off */
+		spear_rtc_disable_interrupt(config);
+		break;
+	case 1:
+		/* alarm on */
+		spear_rtc_enable_interrupt(config);
+		break;
+	default:
+		ret = -EINVAL;
+		break;
+	}
+
+	return ret;
+}
+
 static struct rtc_class_ops spear_rtc_ops = {
 	.read_time = spear_rtc_read_time,
 	.set_time = spear_rtc_set_time,
 	.read_alarm = spear_rtc_read_alarm,
 	.set_alarm = spear_rtc_set_alarm,
+	.alarm_irq_enable = spear_alarm_irq_enable,
 };
 
 static int __devinit spear_rtc_probe(struct platform_device *pdev)