* [PATCH] rtc: tps65910: allow using RTC without alarm interrupt @ 2019-11-09 15:46 Andrey Skvortsov 2019-11-11 17:19 ` Alexandre Belloni 0 siblings, 1 reply; 6+ messages in thread From: Andrey Skvortsov @ 2019-11-09 15:46 UTC (permalink / raw) To: Alessandro Zummo, Alexandre Belloni, linux-rtc, linux-kernel Cc: Andrey Skvortsov Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com> --- drivers/rtc/rtc-tps65910.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c index 2c0467a9e717..aa3a001ef413 100644 --- a/drivers/rtc/rtc-tps65910.c +++ b/drivers/rtc/rtc-tps65910.c @@ -361,6 +361,13 @@ static const struct rtc_class_ops tps65910_rtc_ops = { .set_offset = tps65910_set_offset, }; +static const struct rtc_class_ops tps65910_rtc_ops_noirq = { + .read_time = tps65910_rtc_read_time, + .set_time = tps65910_rtc_set_time, + .read_offset = tps65910_read_offset, + .set_offset = tps65910_set_offset, +}; + static int tps65910_rtc_probe(struct platform_device *pdev) { struct tps65910 *tps65910 = NULL; @@ -415,13 +422,17 @@ static int tps65910_rtc_probe(struct platform_device *pdev) tps65910_rtc_interrupt, IRQF_TRIGGER_LOW, dev_name(&pdev->dev), &pdev->dev); if (ret < 0) { - dev_err(&pdev->dev, "IRQ is not free.\n"); - return ret; + dev_err(&pdev->dev, "request IRQ:%d failed, err = %d\n", + irq, ret); + irq = -1; } tps_rtc->irq = irq; - device_set_wakeup_capable(&pdev->dev, 1); + if (irq != -1) { + device_set_wakeup_capable(&pdev->dev, 1); + tps_rtc->rtc->ops = &tps65910_rtc_ops; + } else + tps_rtc->rtc->ops = &tps65910_rtc_ops_noirq; - tps_rtc->rtc->ops = &tps65910_rtc_ops; tps_rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; tps_rtc->rtc->range_max = RTC_TIMESTAMP_END_2099; -- 2.20.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] rtc: tps65910: allow using RTC without alarm interrupt 2019-11-09 15:46 [PATCH] rtc: tps65910: allow using RTC without alarm interrupt Andrey Skvortsov @ 2019-11-11 17:19 ` Alexandre Belloni 2019-11-13 23:08 ` Andrey Skvortsov 0 siblings, 1 reply; 6+ messages in thread From: Alexandre Belloni @ 2019-11-11 17:19 UTC (permalink / raw) To: Andrey Skvortsov; +Cc: Alessandro Zummo, linux-rtc, linux-kernel Hi, This needs a proper commit message. On 09/11/2019 18:46:52+0300, Andrey Skvortsov wrote: > Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com> > --- > drivers/rtc/rtc-tps65910.c | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) > > diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c > index 2c0467a9e717..aa3a001ef413 100644 > --- a/drivers/rtc/rtc-tps65910.c > +++ b/drivers/rtc/rtc-tps65910.c > @@ -361,6 +361,13 @@ static const struct rtc_class_ops tps65910_rtc_ops = { > .set_offset = tps65910_set_offset, > }; > > +static const struct rtc_class_ops tps65910_rtc_ops_noirq = { > + .read_time = tps65910_rtc_read_time, > + .set_time = tps65910_rtc_set_time, > + .read_offset = tps65910_read_offset, > + .set_offset = tps65910_set_offset, > +}; > + > static int tps65910_rtc_probe(struct platform_device *pdev) > { > struct tps65910 *tps65910 = NULL; > @@ -415,13 +422,17 @@ static int tps65910_rtc_probe(struct platform_device *pdev) > tps65910_rtc_interrupt, IRQF_TRIGGER_LOW, > dev_name(&pdev->dev), &pdev->dev); > if (ret < 0) { > - dev_err(&pdev->dev, "IRQ is not free.\n"); > - return ret; > + dev_err(&pdev->dev, "request IRQ:%d failed, err = %d\n", > + irq, ret); Do we actually need an error message here? > + irq = -1; > } > tps_rtc->irq = irq; > - device_set_wakeup_capable(&pdev->dev, 1); > + if (irq != -1) { > + device_set_wakeup_capable(&pdev->dev, 1); > + tps_rtc->rtc->ops = &tps65910_rtc_ops; > + } else > + tps_rtc->rtc->ops = &tps65910_rtc_ops_noirq; > > - tps_rtc->rtc->ops = &tps65910_rtc_ops; > tps_rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; > tps_rtc->rtc->range_max = RTC_TIMESTAMP_END_2099; > > -- > 2.20.1 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rtc: tps65910: allow using RTC without alarm interrupt 2019-11-11 17:19 ` Alexandre Belloni @ 2019-11-13 23:08 ` Andrey Skvortsov 2019-11-14 19:59 ` Alexandre Belloni 0 siblings, 1 reply; 6+ messages in thread From: Andrey Skvortsov @ 2019-11-13 23:08 UTC (permalink / raw) To: Alexandre Belloni; +Cc: Alessandro Zummo, linux-rtc, linux-kernel [-- Attachment #1: Type: text/plain, Size: 3031 bytes --] On 19-11-11 18:19, Alexandre Belloni wrote: > Hi, > > This needs a proper commit message. Add in v2. > On 09/11/2019 18:46:52+0300, Andrey Skvortsov wrote: > > Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com> > > --- > > drivers/rtc/rtc-tps65910.c | 19 +++++++++++++++---- > > 1 file changed, 15 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c > > index 2c0467a9e717..aa3a001ef413 100644 > > --- a/drivers/rtc/rtc-tps65910.c > > +++ b/drivers/rtc/rtc-tps65910.c > > @@ -361,6 +361,13 @@ static const struct rtc_class_ops tps65910_rtc_ops = { > > .set_offset = tps65910_set_offset, > > }; > > > > +static const struct rtc_class_ops tps65910_rtc_ops_noirq = { > > + .read_time = tps65910_rtc_read_time, > > + .set_time = tps65910_rtc_set_time, > > + .read_offset = tps65910_read_offset, > > + .set_offset = tps65910_set_offset, > > +}; > > + > > static int tps65910_rtc_probe(struct platform_device *pdev) > > { > > struct tps65910 *tps65910 = NULL; > > @@ -415,13 +422,17 @@ static int tps65910_rtc_probe(struct platform_device *pdev) > > tps65910_rtc_interrupt, IRQF_TRIGGER_LOW, > > dev_name(&pdev->dev), &pdev->dev); > > if (ret < 0) { > > - dev_err(&pdev->dev, "IRQ is not free.\n"); > > - return ret; > > + dev_err(&pdev->dev, "request IRQ:%d failed, err = %d\n", > > + irq, ret); > > Do we actually need an error message here? You are right. This is definitely not an error anymore. What about dev_warn(&pdev->dev, "unable to request IRQ, alarms disabled\n"); like some other drivers do? grep -RHn 'unable to request IRQ, alarms disabled' rtc-rv8803.c:576: dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n"); rtc-m41t80.c:914: dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n"); rtc-rv3028.c:651: dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n"); rtc-pcf85363.c:416: dev_warn(&client->dev, "unable to request IRQ, alarms disabled\n"); rtc-pcf85063.c:458: "unable to request IRQ, alarms disabled\n"); rtc-rv3029c2.c:828: dev_warn(dev, "unable to request IRQ, alarms disabled\n"); rtc-rx8025.c:540: dev_err(&client->dev, "unable to request IRQ, alarms disabled\n"); rtc-abx80x.c:839: dev_err(&client->dev, "unable to request IRQ, alarms disabled\n"); > > > + irq = -1; > > } > > tps_rtc->irq = irq; > > - device_set_wakeup_capable(&pdev->dev, 1); > > + if (irq != -1) { > > + device_set_wakeup_capable(&pdev->dev, 1); > > + tps_rtc->rtc->ops = &tps65910_rtc_ops; > > + } else > > + tps_rtc->rtc->ops = &tps65910_rtc_ops_noirq; > > > > - tps_rtc->rtc->ops = &tps65910_rtc_ops; > > tps_rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; > > tps_rtc->rtc->range_max = RTC_TIMESTAMP_END_2099; > > > > -- > > 2.20.1 > > > > -- > Alexandre Belloni, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com -- Best regards, Andrey Skvortsov [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rtc: tps65910: allow using RTC without alarm interrupt 2019-11-13 23:08 ` Andrey Skvortsov @ 2019-11-14 19:59 ` Alexandre Belloni 2019-11-16 20:37 ` [PATCHv2] " Andrey Skvortsov 0 siblings, 1 reply; 6+ messages in thread From: Alexandre Belloni @ 2019-11-14 19:59 UTC (permalink / raw) To: Andrey Skvortsov, Alessandro Zummo, linux-rtc, linux-kernel On 14/11/2019 02:08:05+0300, Andrey Skvortsov wrote: > > > static int tps65910_rtc_probe(struct platform_device *pdev) > > > { > > > struct tps65910 *tps65910 = NULL; > > > @@ -415,13 +422,17 @@ static int tps65910_rtc_probe(struct platform_device *pdev) > > > tps65910_rtc_interrupt, IRQF_TRIGGER_LOW, > > > dev_name(&pdev->dev), &pdev->dev); > > > if (ret < 0) { > > > - dev_err(&pdev->dev, "IRQ is not free.\n"); > > > - return ret; > > > + dev_err(&pdev->dev, "request IRQ:%d failed, err = %d\n", > > > + irq, ret); > > > > Do we actually need an error message here? > > You are right. This is definitely not an error anymore. > What about > dev_warn(&pdev->dev, "unable to request IRQ, alarms disabled\n"); > like some other drivers do? > Yes, or that can be left out completely as userspace will be able to know whether alarms are supported without this message. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCHv2] rtc: tps65910: allow using RTC without alarm interrupt 2019-11-14 19:59 ` Alexandre Belloni @ 2019-11-16 20:37 ` Andrey Skvortsov 2019-11-18 14:19 ` Alexandre Belloni 0 siblings, 1 reply; 6+ messages in thread From: Andrey Skvortsov @ 2019-11-16 20:37 UTC (permalink / raw) To: Alessandro Zummo, Alexandre Belloni, linux-rtc, linux-kernel Cc: Andrey Skvortsov If tps65910 INT1 pin (IRQ output) is not wired to any IRQ controller, then it can't be used as system wakeup/alarm source, but it is still possible to read/write time from/to RTC. Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com> --- v1 -> v2: - add detailed commit description - remove error message about failed IRQ request drivers/rtc/rtc-tps65910.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c index 2c0467a9e717..e3840386f430 100644 --- a/drivers/rtc/rtc-tps65910.c +++ b/drivers/rtc/rtc-tps65910.c @@ -361,6 +361,13 @@ static const struct rtc_class_ops tps65910_rtc_ops = { .set_offset = tps65910_set_offset, }; +static const struct rtc_class_ops tps65910_rtc_ops_noirq = { + .read_time = tps65910_rtc_read_time, + .set_time = tps65910_rtc_set_time, + .read_offset = tps65910_read_offset, + .set_offset = tps65910_set_offset, +}; + static int tps65910_rtc_probe(struct platform_device *pdev) { struct tps65910 *tps65910 = NULL; @@ -414,14 +421,16 @@ static int tps65910_rtc_probe(struct platform_device *pdev) ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, tps65910_rtc_interrupt, IRQF_TRIGGER_LOW, dev_name(&pdev->dev), &pdev->dev); - if (ret < 0) { - dev_err(&pdev->dev, "IRQ is not free.\n"); - return ret; - } + if (ret < 0) + irq = -1; + tps_rtc->irq = irq; - device_set_wakeup_capable(&pdev->dev, 1); + if (irq != -1) { + device_set_wakeup_capable(&pdev->dev, 1); + tps_rtc->rtc->ops = &tps65910_rtc_ops; + } else + tps_rtc->rtc->ops = &tps65910_rtc_ops_noirq; - tps_rtc->rtc->ops = &tps65910_rtc_ops; tps_rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; tps_rtc->rtc->range_max = RTC_TIMESTAMP_END_2099; -- 2.20.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCHv2] rtc: tps65910: allow using RTC without alarm interrupt 2019-11-16 20:37 ` [PATCHv2] " Andrey Skvortsov @ 2019-11-18 14:19 ` Alexandre Belloni 0 siblings, 0 replies; 6+ messages in thread From: Alexandre Belloni @ 2019-11-18 14:19 UTC (permalink / raw) To: Andrey Skvortsov; +Cc: Alessandro Zummo, linux-rtc, linux-kernel On 16/11/2019 23:37:48+0300, Andrey Skvortsov wrote: > If tps65910 INT1 pin (IRQ output) is not wired to any IRQ controller, > then it can't be used as system wakeup/alarm source, > but it is still possible to read/write time from/to RTC. > > Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com> > --- > > v1 -> v2: > - add detailed commit description > - remove error message about failed IRQ request > > drivers/rtc/rtc-tps65910.c | 21 +++++++++++++++------ > 1 file changed, 15 insertions(+), 6 deletions(-) > Applied, thanks. -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-11-18 14:19 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-11-09 15:46 [PATCH] rtc: tps65910: allow using RTC without alarm interrupt Andrey Skvortsov 2019-11-11 17:19 ` Alexandre Belloni 2019-11-13 23:08 ` Andrey Skvortsov 2019-11-14 19:59 ` Alexandre Belloni 2019-11-16 20:37 ` [PATCHv2] " Andrey Skvortsov 2019-11-18 14:19 ` Alexandre Belloni
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).