Linux RTC
 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: [rtc-linux] 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=C4=8Dne Josserand wrote :
> @@ -731,11 +786,9 @@ static void rv3029_hwmon_register(struct device *dev=
, const char *name)
> =20
>  #endif /* CONFIG_RTC_DRV_RV3029_HWMON */
> =20
> -static const struct rtc_class_ops rv3029_rtc_ops =3D {
> +static struct rtc_class_ops rv3029_rtc_ops =3D {
>  	.read_time	=3D rv3029_read_time,
>  	.set_time	=3D rv3029_set_time,
> -	.read_alarm	=3D rv3029_read_alarm,
> -	.set_alarm	=3D rv3029_set_alarm,
>  };
> =20
>  static struct i2c_device_id rv3029_id[] =3D {
> @@ -772,8 +825,27 @@ static int rv3029_probe(struct device *dev, struct r=
egmap *regmap, int irq,
> =20
>  	rv3029->rtc =3D 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);
> +	}
> =20
> -	return PTR_ERR_OR_ZERO(rv3029->rtc);
> +	if (rv3029->irq > 0) {
> +		rc =3D 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 =3D 0;
> +		} else {
> +			rv3029_rtc_ops.read_alarm =3D rv3029_read_alarm;
> +			rv3029_rtc_ops.set_alarm =3D rv3029_set_alarm;
> +			rv3029_rtc_ops.alarm_irq_enable =3D 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.

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

--=20
--=20
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
---=20
You received this message because you are subscribed to the Google Groups "=
rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  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 [rtc-linux] [PATCH 0/6] add support for Microcrystal RV-3049 Mylène Josserand
2016-04-21 18:24 ` [rtc-linux] [PATCH 1/6] rtc: rv3029: remove 'i2c' in functions names Mylène Josserand
2016-04-21 18:24 ` [rtc-linux] [PATCH 2/6] rtc: rv3029: convert to use regmap Mylène Josserand
2016-04-21 18:24 ` [rtc-linux] [PATCH 3/6] rtc: rv3029: Add support of RV3049 Mylène Josserand
2016-04-21 18:24 ` [rtc-linux] [PATCH 4/6] rtc: rv3029: Removes some checks and warnings Mylène Josserand
2016-04-22 23:29   ` [rtc-linux] " Alexandre Belloni
2016-04-22 23:31     ` Alexandre Belloni
2016-04-21 18:24 ` [rtc-linux] [PATCH 5/6] rtc: rv3029: enable AE_x bits on set_alarm Mylène Josserand
2016-04-22 23:37   ` [rtc-linux] " Alexandre Belloni
2016-04-21 18:24 ` [rtc-linux] [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 ` [rtc-linux] [PATCH V2 0/6] add support for Microcrystal RV-3049 Mylène Josserand
2016-04-28 22:00   ` [rtc-linux] [PATCH V2 1/6] rtc: rv3029: remove 'i2c' in functions names Mylène Josserand
2016-04-28 22:00   ` [rtc-linux] [PATCH V2 2/6] rtc: rv3029: convert to use regmap Mylène Josserand
2016-04-28 22:00   ` [rtc-linux] [PATCH V2 3/6] rtc: rv3029: Add support of RV3049 Mylène Josserand
2016-04-28 22:00   ` [rtc-linux] [PATCH V2 4/6] rtc: rv3029: Removes some checks and warnings Mylène Josserand
2016-04-28 22:00   ` [rtc-linux] [PATCH V2 5/6] rtc: rv3029: fix alarm support Mylène Josserand
2016-05-03  8:25     ` [rtc-linux] " Alexandre Belloni
2016-04-28 22:00   ` [rtc-linux] [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