Linux-Hwmon Archive mirror
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Chris Packham <Chris.Packham@alliedtelesis.co.nz>
Cc: Conor Dooley <conor@kernel.org>,
	"antoniu.miclaus@analog.com" <antoniu.miclaus@analog.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"krzysztof.kozlowski+dt@linaro.org"
	<krzysztof.kozlowski+dt@linaro.org>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"jdelvare@suse.com" <jdelvare@suse.com>,
	"linux@roeck-us.net" <linux@roeck-us.net>,
	"linux-rtc@vger.kernel.org" <linux-rtc@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
	Zeynep Arslanbenzer <Zeynep.Arslanbenzer@analog.com>
Subject: Re: [PATCH v8 2/2] dt-bindings: rtc: add max313xx RTCs
Date: Thu, 29 Feb 2024 21:29:28 +0100	[thread overview]
Message-ID: <2024022920292837621a4f@mail.local> (raw)
In-Reply-To: <b2ebc2a7-0347-40a0-8302-c84ba898fd16@alliedtelesis.co.nz>

On 29/02/2024 20:11:16+0000, Chris Packham wrote:
> 
> On 1/03/24 07:07, Conor Dooley wrote:
> > On Wed, Feb 28, 2024 at 08:21:35PM +0000, Chris Packham wrote:
> >> On 29/02/24 00:58, Conor Dooley wrote:
> >>> On Tue, Feb 27, 2024 at 02:03:10PM +1300, Chris Packham wrote:
> >>>
> >>>>      interrupts:
> >>>> +    description:
> >>>> +      Alarm1 interrupt line of the RTC. Some of the RTCs have two interrupt
> >>>> +      lines and alarm1 interrupt muxing depends on the clockin/clockout
> >>>> +      configuration.
> >>>>        maxItems: 1
> >>> The maxItems: 1 looks odd here when you state "some of the RTCs have two
> >>> interrupt lines", which makes it sound as if there are actually two
> >>> interrupts that should be exposed here. If those two interrupts get
> >>> muxed to the same pin for output I'd suggest that you clarify that here.
> >> This may end up changing if I can come up with something that Alexandre
> >> is happy with. Basically (some of) the chips have a configurable pin
> >> that can either be dedicated to the ALARM1 output (annoyingly labelled
> >> as INTB) or to a clock output. There is an INTA line that has other
> >> interrupts and if the clock output option is used then it also has
> >> ALARM1. The driver doesn't currently do anything with the other
> >> interrupt sources so as written this needs to correspond to whichever
> >> interrupt output is asserted for ALARM1.
> > So you're saying that depending on whether or not the clock output is
> > used, there could be two interrupts?
> Correct.
> > Without looking further, it sounds like you should be setting maxItems
> > to 1 if #clock-cells is present and to 2 if it is not.
> My idea was an explicit property about the function of the INTB/CLKOUT 
> pin. The current code does use #clock-cells as a proxy for this (and 
> Alexandre has some concerns with how this is handled).

#clock-cells must not be used for pinmuxing, I can't see how anyone
would allow this.

> >   Then if there are
> > two interrupts provided, the driver is free to configure whatever way it
> > wants. If there aren't, send everything to INTA.
> >
> > Am I missing something?
> 
> Right now the only interrupt that the RTC cares about is for ALARM1 
> (which moves between INTA and INTB depending on the clock config). There 
> are other hardware events and an ALARM2 that can generate an interrupt 
> but these are ignored. I don't think the rtc framework supports more 
> than one alarm.
> 
> Binding wise I think this should take 1 or 2 interrupts. For simplicity 
> the first interrupt should always correspond to ALARM1 (which could be 
> INTB or INTA depending on the hardware design). The 2nd interrupt (if 
> supplied) would be for the other events (which we don't currently do 
> anything with).

Not using an interrupt simply means the CPU doesn't care about it but
there are other components that may care for example a PMIC. If you
reason about what linux and the CPU it is running on can do, you will
cripple functionality and we will have to break the devicetree binding
later on to restore it.
We need to be able to express all the possible pin configurations with
the binding. I'm not sure why everyone is so resistant to use pinmuxing
to mux pins....


-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

      reply	other threads:[~2024-02-29 20:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-27  1:03 [PATCH v8 0/2] drivers: rtc: add max313xx series rtc driver Chris Packham
2024-02-27  1:03 ` [PATCH v8 1/2] rtc: max31335: Add support for additional chips Chris Packham
2024-02-27  2:29   ` Alexandre Belloni
2024-02-27  4:22     ` Chris Packham
2024-02-27  1:03 ` [PATCH v8 2/2] dt-bindings: rtc: add max313xx RTCs Chris Packham
2024-02-28 11:58   ` Conor Dooley
2024-02-28 20:21     ` Chris Packham
2024-02-29 18:07       ` Conor Dooley
2024-02-29 20:11         ` Chris Packham
2024-02-29 20:29           ` Alexandre Belloni [this message]

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=2024022920292837621a4f@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=Chris.Packham@alliedtelesis.co.nz \
    --cc=Zeynep.Arslanbenzer@analog.com \
    --cc=antoniu.miclaus@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=conor@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jdelvare@suse.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=robh+dt@kernel.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).