Linux RTC
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: "Tilki, Ibrahim" <Ibrahim.Tilki@analog.com>,
	"a.zummo@towertech.it" <a.zummo@towertech.it>,
	"alexandre.belloni@bootlin.com" <alexandre.belloni@bootlin.com>,
	"jdelvare@suse.com" <jdelvare@suse.com>,
	"linux@roeck-us.net" <linux@roeck-us.net>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"krzysztof.kozlowski+dt@linaro.org" 
	<krzysztof.kozlowski+dt@linaro.org>
Cc: "linux-rtc@vger.kernel.org" <linux-rtc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"Arslanbenzer, Zeynep" <Zeynep.Arslanbenzer@analog.com>
Subject: Re: [PATCH v5 2/2] dt-bindings: rtc: add max313xx RTCs
Date: Wed, 5 Apr 2023 08:16:03 +0200	[thread overview]
Message-ID: <fe580065-9ad3-3d28-522d-3905a9e9e518@linaro.org> (raw)
In-Reply-To: <CY4PR03MB2488D9CED963C26DB7D9709B96939@CY4PR03MB2488.namprd03.prod.outlook.com>

On 04/04/2023 17:40, Tilki, Ibrahim 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
>>> +
>>> +  "#clock-cells":
>>> +    description: |
>>> +      RTC can be used as a clock source through its clock output pin when
>>> +      supplied.
>>
>> This part is correct, but your implementation is not. I don't think you
>> can disable or enable interrupts, based on usage of clock. Either this
>> is clock (gated or not) or interrupt, not both.
>>
> 
> The driver doesn't enable or disable interrupts based on clock usage. It checks
> whether the IRQ is possible or not. Enablement of interrupt depends on the 
> "interrupts" property. The tricky part is that interrupt muxing depends on
> clock configuration.

I think it is not what your driver is doing. It checks if clock-cells...

> 
> Let me briefly explain the behavior of RTCs and the driver[v4]
> 
> MAX31328:
>   - Has a single pin which is either used as IRQ or clock output.
>   - Driver aborts probe with "-EOPNOTSUPP" when user requests irq and clockout
>     at the same time. In other words, when both "interrupts" and "#clock-cells"
>     properties are present. Otherwise, we are fine.

Why? These are fixed properties of the device. It is always a clock
controller and always has interrupt line. The choice between them is
depending on pins, so pin control.

> 
> MAX31331:
> MAX31334:
>   - Has two pins: INTA and INTB/CLOCKOUT. INTA pin is dedicated for interrupt.
>     INTB pin is used as either interrupt or clockout. The Alarm1 interrupt is
>     muxed into INTB by default. If the CLOCKOUT is enabled, Alarm1 irq is muxed
>     into INTA. We don't have further control over interrupt muxing.
>   - Driver checks for "#clock-cells". If it is present, it enables the clockout
>     so that we can get interrupt from INTA.
> 
> The Rest:
>   - Has two pins: INTA/CLKIN and INTB/CLOCKOUT. Alarm1 interrupt is muxed into
>     INTA by default, muxed into INTB if and only if we enable CLKIN.
>   - Driver aborts probe with -EOPNOTSUPP when user requests interrupt, clockin
>     and clockout at the same time. We can't have all three with two pins.
> 	
> 
> Unfortunately we don't have control over the interrupt muxing other than clock
> configuration. How should the driver approach this?

Pinmux with two states - interrupt or clock.

Best regards,
Krzysztof


  reply	other threads:[~2023-04-05  6:16 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03 15:43 [PATCH v5 0/2] drivers: rtc: add max313xx series rtc driver Ibrahim Tilki
2023-04-03 15:43 ` [PATCH v5 1/2] " Ibrahim Tilki
2023-04-04 13:10   ` Krzysztof Kozlowski
2023-04-23 22:52   ` Chris Packham
2023-04-23 23:27     ` Chris Packham
2023-04-03 15:43 ` [PATCH v5 2/2] dt-bindings: rtc: add max313xx RTCs Ibrahim Tilki
2023-04-04  6:17   ` Krzysztof Kozlowski
2023-04-04  7:10     ` Alexandre Belloni
2023-04-04  7:21       ` Krzysztof Kozlowski
2023-04-04  7:44         ` Alexandre Belloni
2023-04-04  8:14           ` Krzysztof Kozlowski
2023-04-04  9:32             ` Tilki, Ibrahim
2023-04-04  9:56             ` Alexandre Belloni
2023-04-04 10:06               ` Krzysztof Kozlowski
2023-04-04 12:18                 ` Alexandre Belloni
2023-04-04  9:26       ` Tilki, Ibrahim
2023-04-04 10:08         ` Krzysztof Kozlowski
2023-04-04 10:35           ` Tilki, Ibrahim
2023-04-04 12:26             ` Alexandre Belloni
2023-04-04 12:29               ` Alexandre Belloni
2023-04-04 13:02                 ` Krzysztof Kozlowski
2023-04-04 14:50               ` Tilki, Ibrahim
2023-04-04 13:10   ` Krzysztof Kozlowski
2023-04-04 15:40     ` Tilki, Ibrahim
2023-04-05  6:16       ` Krzysztof Kozlowski [this message]
2024-01-26  2:22 ` [PATCH v5 0/2] drivers: rtc: add max313xx series rtc driver Chris Packham
2024-01-26  7:51   ` Nuno Sá
2024-01-29  3:28     ` Chris Packham
2024-01-29  7:55       ` Nuno Sá
2024-02-02  0:28         ` Chris Packham
2024-02-02  6:56           ` Nuno Sá

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=fe580065-9ad3-3d28-522d-3905a9e9e518@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=Ibrahim.Tilki@analog.com \
    --cc=Zeynep.Arslanbenzer@analog.com \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --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