public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: "Mylène Josserand" <mylene.josserand@free-electrons.com>
Cc: rtc-linux@googlegroups.com,
	Alessandro Zummo <a.zummo@towertech.it>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6/6] rtc: rv3029: add alarm IRQ
Date: Sat, 23 Apr 2016 01:48:54 +0200	[thread overview]
Message-ID: <20160422234854.GI17051@piout.net> (raw)
In-Reply-To: <a3a20f7842d11e73e5dd41201a77bca3108e6b75.1461250479.git.mylene.josserand@free-electrons.com>

On 21/04/2016 at 20:24:19 +0200, Mylène Josserand wrote :
> @@ -731,11 +786,9 @@ static void rv3029_hwmon_register(struct device *dev, const char *name)
>  
>  #endif /* CONFIG_RTC_DRV_RV3029_HWMON */
>  
> -static const struct rtc_class_ops rv3029_rtc_ops = {
> +static struct rtc_class_ops rv3029_rtc_ops = {
>  	.read_time	= rv3029_read_time,
>  	.set_time	= rv3029_set_time,
> -	.read_alarm	= rv3029_read_alarm,
> -	.set_alarm	= rv3029_set_alarm,
>  };
>  
>  static struct i2c_device_id rv3029_id[] = {
> @@ -772,8 +825,27 @@ static int rv3029_probe(struct device *dev, struct regmap *regmap, int irq,
>  
>  	rv3029->rtc = devm_rtc_device_register(dev, name, &rv3029_rtc_ops,
>  					       THIS_MODULE);
> +	if (IS_ERR(rv3029->rtc)) {
> +		dev_err(dev, "unable to register the class device\n");
> +		return PTR_ERR(rv3029->rtc);
> +	}
>  
> -	return PTR_ERR_OR_ZERO(rv3029->rtc);
> +	if (rv3029->irq > 0) {
> +		rc = devm_request_threaded_irq(dev, rv3029->irq,
> +					       NULL, rv3029_handle_irq,
> +					       IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> +					       "rv3029", dev);
> +		if (rc) {
> +			dev_warn(dev, "unable to request IRQ, alarms disabled\n");
> +			rv3029->irq = 0;
> +		} else {
> +			rv3029_rtc_ops.read_alarm = rv3029_read_alarm;
> +			rv3029_rtc_ops.set_alarm = rv3029_set_alarm;
> +			rv3029_rtc_ops.alarm_irq_enable = rv3029_alarm_irq_enable;
> +		}
> +	}
> +

While this work, devm_rtc_device_register() needs to know whether the
alarms are enabled and will try to call .read_alarm(). That is not
completely an issue right now and as we discussed, I'm planning to send
a rework of the rtc core to overcome that issue.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

  reply	other threads:[~2016-04-22 23:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-21 18:24 [PATCH 0/6] add support for Microcrystal RV-3049 Mylène Josserand
2016-04-21 18:24 ` [PATCH 1/6] rtc: rv3029: remove 'i2c' in functions names Mylène Josserand
2016-04-21 18:24 ` [PATCH 2/6] rtc: rv3029: convert to use regmap Mylène Josserand
2016-04-21 18:24 ` [PATCH 3/6] rtc: rv3029: Add support of RV3049 Mylène Josserand
2016-04-21 18:24 ` [PATCH 4/6] rtc: rv3029: Removes some checks and warnings Mylène Josserand
2016-04-22 23:29   ` Alexandre Belloni
2016-04-22 23:31     ` Alexandre Belloni
2016-04-21 18:24 ` [PATCH 5/6] rtc: rv3029: enable AE_x bits on set_alarm Mylène Josserand
2016-04-22 23:37   ` Alexandre Belloni
2016-04-21 18:24 ` [PATCH 6/6] rtc: rv3029: add alarm IRQ Mylène Josserand
2016-04-22 23:48   ` Alexandre Belloni [this message]
2016-04-28 22:00 ` [PATCH V2 0/6] add support for Microcrystal RV-3049 Mylène Josserand
2016-04-28 22:00   ` [PATCH V2 1/6] rtc: rv3029: remove 'i2c' in functions names Mylène Josserand
2016-04-28 22:00   ` [PATCH V2 2/6] rtc: rv3029: convert to use regmap Mylène Josserand
2016-04-28 22:00   ` [PATCH V2 3/6] rtc: rv3029: Add support of RV3049 Mylène Josserand
2016-04-28 22:00   ` [PATCH V2 4/6] rtc: rv3029: Removes some checks and warnings Mylène Josserand
2016-04-28 22:00   ` [PATCH V2 5/6] rtc: rv3029: fix alarm support Mylène Josserand
2016-05-03  8:25     ` Alexandre Belloni
2016-04-28 22:00   ` [PATCH V2 6/6] rtc: rv3029: add alarm IRQ Mylène Josserand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160422234854.GI17051@piout.net \
    --to=alexandre.belloni@free-electrons.com \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mylene.josserand@free-electrons.com \
    --cc=rtc-linux@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox