linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Johan Jonker <jbx6244@gmail.com>,
	Thierry Reding <thierry.reding@gmail.com>
Cc: Rob Herring <robh@kernel.org>,
	u.kleine-koenig@pengutronix.de,
	linux-rockchip@lists.infradead.org, philipp.tomsich@vrull.eu,
	linux-arm-kernel@lists.infradead.org,
	krzysztof.kozlowski+dt@linaro.org, devicetree@vger.kernel.org,
	linux-pwm@vger.kernel.org, kever.yang@rock-chips.com,
	zhangqing@rock-chips.com, linux-kernel@vger.kernel.org,
	heiko@sntech.de
Subject: Re: [PATCH v1 03/11] dt-bindings: pwm: rockchip: add rockchip,rk3128-pwm
Date: Thu, 29 Sep 2022 16:41:22 +0100	[thread overview]
Message-ID: <946d8ac2-6ff2-093a-ad3c-aa755e00d1dd@arm.com> (raw)
In-Reply-To: <94d829a6-d8c2-2106-2d7d-91a8cd3875ae@gmail.com>

On 2022-09-29 11:26, Johan Jonker wrote:
> 
> 
> On 9/28/22 13:59, Thierry Reding wrote:
>> On Tue, Sep 13, 2022 at 04:38:32PM +0200, Johan Jonker wrote:
>>>
>>>
>>> On 9/12/22 18:21, Rob Herring wrote:
>>>> On Sat, Sep 10, 2022 at 09:48:04PM +0200, Johan Jonker wrote:
>>>>> Reduced CC.
>>>>>
>>>>> Hi Rob,
>>>>>
>>>>
>>>> Seemed like a simple enough warning to fix...
>>>
>>> Some examples for comment.
>>> Let us know what would be the better solution?
>>>
>>> ===========================================================================
>>>
>>> option1:
>>>
>>> 	combpwm0: combpwm0 {
>>> 		compatible = "rockchip,rv1108-combpwm";
>>> 		interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
>>> 		#address-cells = <2>;
>>> 		#size-cells = <2>;
>>>
>>> 		pwm0: pwm@20040000 {
>>> 			compatible = "rockchip,rv1108-pwm";
>>> 			reg = <0x20040000 0x10>;
>>> 		};
>>>
>>> 		pwm1: pwm@20040010 {
>>> 			compatible = "rockchip,rv1108-pwm";
>>> 			reg = <0x20040010 0x10>;
>>> 		};
>>>
>>> 		pwm2: pwm@20040020 {
>>> 			compatible = "rockchip,rv1108-pwm";
>>> 			reg = <0x20040020 0x10>;
>>> 		};
>>>
>>> 		pwm3: pwm@20040030 {
>>> 			compatible = "rockchip,rv1108-pwm";
>>> 			reg = <0x20040030 0x10>;
>>> 		};
>>> 	};
>>>
>>> PRO:
>>> - Existing driver might still work.
>>> CON:
>>> - New compatible needed to service the combined interrupts.
>>> - Driver change needed.
>>>
>>> ===========================================================================
>>> option 2:
>>>
>>> 	combpwm0: pwm@10280000 {
>>> 		compatible = "rockchip,rv1108-pwm";
>>> 		reg = <0x10280000 0x40>;
>>> 		interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>;
>>> 		#address-cells = <1>;
>>> 		#size-cells = <0>;
>>>
>>> 		pwm4: pwm-4@0 {
>>> 			reg = <0x0>;
>>> 		};
>>>
>>> 		pwm5: pwm-5@10 {
>>> 			reg = <0x10>;
>>> 		};
>>>
>>> 		pwm6: pwm-6@20 {
>>> 			reg = <0x20>;
>>> 		};
>>>
>>> 		pwm7: pwm-7@30 {
>>> 			reg = <0x30>;
>>> 		};
>>> 	};
>>>
>>> CON:
>>> - Driver change needed.
>>> - Not compatible with current drivers.
>>>
>>> ===========================================================================
>>>
>>> Current situation:
>>>
>>> 	pwm0: pwm@20040000 {
>>> 		compatible = "rockchip,rv1108-pwm", "rockchip,rk3288-pwm";
>>> 		reg = <0x20040000 0x10>;
>>> 		interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
>>> 	};
>>>
>>> 	pwm1: pwm@20040010 {
>>> 		compatible = "rockchip,rv1108-pwm", "rockchip,rk3288-pwm";
>>> 		reg = <0x20040010 0x10>;
>>> 		interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
>>> 	};
>>>
>>> 	pwm2: pwm@20040020 {
>>> 		compatible = "rockchip,rv1108-pwm", "rockchip,rk3288-pwm";
>>> 		reg = <0x20040020 0x10>;
>>> 		interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
>>> 	};
>>>
>>> 	pwm3: pwm@20040030 {
>>> 		compatible = "rockchip,rv1108-pwm", "rockchip,rk3288-pwm";
>>> 		reg = <0x20040030 0x10>;
>>> 		interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
>>> 	};
>>>
>>> CON:
>>> - The property "interrupts 39" can only be claimed ones by one probe function at the time.
>>> - Has a fall-back string for rk3288, but unknown identical behavior for interrupts ???
>>
> 
>> To be honest, all three descriptions look wrong to me. From the above it
>> looks like this is simply one PWM controller with four channels, so it
>> should really be described as such, i.e.:
>>
>> 	pwm@20040030 {
>> 		compatible = "rockchip,rv1108-pwm";
>> 		reg = <0x20040030 0x40>;
>> 		interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_HIGH>;
>> 	};
>>
> 
> Each PWM channel has it's own pinctrl.
> Not all channel pins are always in use for PWM exclusively.
> Your proposal would not allow pins to be used for other functions.

Why would you think that? It would just mean moving the pinctrl 
selection down to the board level like for GPIOs - we manage just fine 
with a single DT node per GPIO bank, and semantically PWMs have no 
reason do be different. In fact on newer SoCs some PWM channels can be 
muxed to multiple pins, so pinctrl really has to be at the board level 
already in those casesa.

The TRMs seem pretty clear that the "new" PWM block from RK3288 onwards 
is a single module with 4 channels, not 4 independent controllers, so it 
seems to have been an unfortunate mistake not to create a new binding 
for it at that point. It would be a little fiddly, but far from 
impossible, to make the driver support both the existing binding and a 
new one (and I don't see how we could use the interrupt on newer SoCs 
*without* a binding change, given that the interrupt status register is 
outside any channel's current "reg"), but an old kernel with a new DT 
would be more problematic. If we kept the existing compatibles then an 
old driver would always use channel 0 regardless of what the consumer 
requested; using new compatibles as well means the old kernel loses PWM 
functionality entirely, which is arguably "safe", but I'm not sure if 
it's really better or worse :/

Robin.

> More ideas with this interrupt? Please advise.
> 
> ===
> 
> The SoCs PWM are configurable to operate in continuous mode (default mainline) or one-shot mode or capture mode.
> Is there any good example for one-shot mode interrupt use?
> 
> 
>> Looking through existing Rockchip SoC DTSI files, though, it looks like
>> this has been done the wrong way since the beginning, so not sure if you
>> still want to fix it up.
>>
>> This whole problem of dealing with a shared interrupt wouldn't be a
>> problem if this was described properly.
>>
>> Thierry
> 
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2022-09-29 15:42 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220909212543.17428-1-jbx6244@gmail.com>
2022-09-09 22:01 ` [PATCH v1 11/11] dt-bindings: mtd: rockchip: add rockchip,rk3128-nfc Johan Jonker
2022-09-10  7:46   ` Krzysztof Kozlowski
2022-09-09 22:01 ` [PATCH v1 01/11] dt-bindings: serial: rockchip: add rockchip,rk3128-uart Johan Jonker
2022-09-10 15:42   ` (subset) " Mark Brown
2022-09-13 14:05   ` Rob Herring
2022-09-13 14:37   ` Jamie Iles
2022-09-14  8:52   ` (subset) " Heiko Stuebner
2022-09-09 22:01 ` [PATCH v1 10/11] dt-bindings: soc: rockchip: grf: add rockchip,rk3128-grf Johan Jonker
2022-09-13 14:06   ` Rob Herring
2022-09-09 22:01 ` [PATCH v1 09/11] dt-bindings: phy: phy-rockchip-inno-usb2: add rockchip,rk3128-usb2phy Johan Jonker
2022-09-13 14:06   ` Rob Herring
2022-09-13 16:42   ` Vinod Koul
2022-09-09 22:01 ` [PATCH v1 08/11] dt-bindings: arm: rockchip: pmu: add rockchip,rk3128-pmu Johan Jonker
2022-09-13 14:06   ` Rob Herring
2022-09-09 22:01 ` [PATCH v1 07/11] dt-bindings: watchdog: rockchip: add rockchip,rk3128-wdt Johan Jonker
2022-09-10 14:30   ` Guenter Roeck
2022-09-13 14:06   ` Rob Herring
2022-09-09 22:02 ` [PATCH v1 06/11] dt-bindings: usb: dwc2: rockchip: add rockchip,rk3128-usb Johan Jonker
2022-09-13 14:06   ` Rob Herring
2022-09-09 22:02 ` [PATCH v1 05/11] dt-bindings: spi: rockchip: add rockchip,rk3128-spi Johan Jonker
2022-09-10 14:53   ` Rob Herring
2022-09-09 22:02 ` [PATCH v1 04/11] dt-bindings: mmc: rockchip: add rockchip,rk3128-dw-mshc Johan Jonker
2022-09-13 14:15   ` Rob Herring
2022-09-14 14:00   ` Ulf Hansson
2022-09-09 22:02 ` [PATCH v1 03/11] dt-bindings: pwm: rockchip: add rockchip,rk3128-pwm Johan Jonker
2022-09-10 14:53   ` Rob Herring
2022-09-10 19:48     ` Johan Jonker
2022-09-12 16:21       ` Rob Herring
2022-09-13 14:38         ` Johan Jonker
2022-09-28 11:59           ` Thierry Reding
2022-09-29 10:26             ` Johan Jonker
2022-09-29 15:41               ` Robin Murphy [this message]
2022-09-30  6:13             ` Biju Das
2022-09-12  8:35   ` Uwe Kleine-König
2022-09-13 14:26   ` Rob Herring
2022-09-20  6:21   ` Uwe Kleine-König
2022-09-23 10:22     ` Heiko Stuebner
2022-09-09 22:02 ` [PATCH v1 02/11] dt-bindings: i2c: rockchip: add rockchip,rk3128-i2c Johan Jonker
2022-09-13 14:26   ` Rob Herring
2022-09-16 19:57   ` Wolfram Sang

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=946d8ac2-6ff2-093a-ad3c-aa755e00d1dd@arm.com \
    --to=robin.murphy@arm.com \
    --cc=devicetree@vger.kernel.org \
    --cc=heiko@sntech.de \
    --cc=jbx6244@gmail.com \
    --cc=kever.yang@rock-chips.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=philipp.tomsich@vrull.eu \
    --cc=robh@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=zhangqing@rock-chips.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;
as well as URLs for NNTP newsgroup(s).