From: Francesco Dolcini <francesco@dolcini.it>
To: Quentin Schulz <quentin.schulz@cherry.de>
Cc: Francesco Dolcini <francesco@dolcini.it>,
Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Farouk Bouabid <farouk.bouabid@cherry.de>,
Francesco Dolcini <francesco.dolcini@toradex.com>,
linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 2/2] hwmon: (amc6821) Add PWM polarity configuration with OF
Date: Wed, 19 Feb 2025 17:20:16 +0100 [thread overview]
Message-ID: <20250219162016.GC22470@francesco-nb> (raw)
In-Reply-To: <24e8abf9-0bb9-4cbd-857b-0842fc914486@cherry.de>
Hi Quentin,
On Wed, Feb 19, 2025 at 12:12:24PM +0100, Quentin Schulz wrote:
> On 2/19/25 11:33 AM, Francesco Dolcini wrote:
> > On Wed, Feb 19, 2025 at 11:08:43AM +0100, Quentin Schulz wrote:
> > > On 2/18/25 5:56 PM, Francesco Dolcini wrote:
> > > > From: Francesco Dolcini <francesco.dolcini@toradex.com>
> > > >
> > > > Add support to configure the PWM-Out pin polarity based on a device
> > > > tree property.
> > > >
> > > > Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
> > > > ---
> > > > drivers/hwmon/amc6821.c | 7 +++++--
> > > > 1 file changed, 5 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c
> > > > index 1e3c6acd8974..1ea2d97eebca 100644
> > > > --- a/drivers/hwmon/amc6821.c
> > > > +++ b/drivers/hwmon/amc6821.c
> > > > @@ -845,7 +845,7 @@ static int amc6821_detect(struct i2c_client *client, struct i2c_board_info *info
> > > > return 0;
> > > > }
> > > > -static int amc6821_init_client(struct amc6821_data *data)
> > > > +static int amc6821_init_client(struct i2c_client *client, struct amc6821_data *data)
> > > > {
> > > > struct regmap *regmap = data->regmap;
> > > > int err;
> > > > @@ -864,6 +864,9 @@ static int amc6821_init_client(struct amc6821_data *data)
> > > > if (err)
> > > > return err;
> > > > + if (of_property_read_bool(client->dev.of_node, "ti,pwm-inverted"))
> > >
> > > I know that the AMC6821 is doing a lot of smart things, but this really
> > > tickled me. PWM controllers actually do support that already via
> > > PWM_POLARITY_INVERTED flag for example. See
> > > Documentation/devicetree/bindings/hwmon/adt7475.yaml which seems to be
> > > another HWMON driver which acts as a PWM controller. I'm not sure this is
> > > relevant, applicable or desired but I wanted to highlight this.
> >
> > From the DT binding point of view, it seems to implement the same I am
> > proposing here with adi,pwm-active-state property.
> >
>
> Ah! It seems like I read only the part that agreed with the idea I had in
> mind :)
>
> > Do you have anything more specific in mind?
> >
>
> Yes, #pwm-cells just below in the binding. You can then see that the third
> cell in a PWM specifier is for the polarity. If I didn't misread once more,
> I believe that what's in adi,pwm-active-state is ignored based on the
> content of the PWM flags in a PWM cell specifier, c.f.
> adt7475_set_pwm_polarity followed by adt7475_fan_pwm_config in
> adt7475_probe. I would have assumed that having the polarity inverted in
> adi,pwm-active-state would mean that the meaning of the flag in the PWM cell
> specifier would be inverted as well, meaning 0 -> inverted,
> PWM_POLARITY_INVERTED -> doubly inverted so "normal" polarity.
>
> adt7475_fan_pwm_config was added a few years after adt7475_set_pwm_polarity.
I think this is out of scope for this patch. The amc6821 can control the
fan PWM stand-alone, this change has nothing to do with the generic pwm
framework, this is required to have the PWM out pin correctly driven by
the fan controller chip.
> Module params over DT is fine with me, I just want consistency here, so if
> it's always the case, fine :)
Ok, I'll implement it this way.
Francesco
next prev parent reply other threads:[~2025-02-19 16:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-18 16:56 [PATCH v1 0/2] hwmon: (amc6821) Add PWM polarity configuration with OF Francesco Dolcini
2025-02-18 16:56 ` [PATCH v1 1/2] dt-bindings: hwmon: amc6821: add PWM polarity Francesco Dolcini
2025-02-18 16:56 ` [PATCH v1 2/2] hwmon: (amc6821) Add PWM polarity configuration with OF Francesco Dolcini
2025-02-19 10:08 ` Quentin Schulz
2025-02-19 10:33 ` Francesco Dolcini
2025-02-19 11:12 ` Quentin Schulz
2025-02-19 16:20 ` Francesco Dolcini [this message]
2025-02-19 13:46 ` Guenter Roeck
2025-02-19 16:16 ` Francesco Dolcini
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=20250219162016.GC22470@francesco-nb \
--to=francesco@dolcini.it \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=farouk.bouabid@cherry.de \
--cc=francesco.dolcini@toradex.com \
--cc=jdelvare@suse.com \
--cc=krzk+dt@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=quentin.schulz@cherry.de \
--cc=robh@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