* [PATCH 1/3] dt-bindings: vendor-prefixes: Document Argon40 @ 2025-06-10 22:07 Marek Vasut 2025-06-10 22:07 ` [PATCH 2/3] dt-bindings: trivial-devices: Document Argon40 Fan HAT Marek Vasut ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Marek Vasut @ 2025-06-10 22:07 UTC (permalink / raw) To: linux-pwm Cc: Marek Vasut, Uwe Kleine-König, Conor Dooley, Krzysztof Kozlowski, Rob Herring, devicetree, linux-renesas-soc Argon 40 Technologies Limited is a SBC expansion board vendor. Document the prefix. For details see https://argon40.com . Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> --- Cc: "Uwe Kleine-König" <ukleinek@kernel.org> Cc: Conor Dooley <conor+dt@kernel.org> Cc: Krzysztof Kozlowski <krzk+dt@kernel.org> Cc: Rob Herring <robh@kernel.org> Cc: devicetree@vger.kernel.org Cc: linux-pwm@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org --- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml index 5d2a7a8d3ac6..e5e5bd34136a 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -149,6 +149,8 @@ patternProperties: description: Arctic Sand "^arcx,.*": description: arcx Inc. / Archronix Inc. + "^argon40,.*": + description: Argon 40 Technologies Limited "^ariaboard,.*": description: Shanghai Novotech Co., Ltd. (Ariaboard) "^aries,.*": -- 2.47.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] dt-bindings: trivial-devices: Document Argon40 Fan HAT 2025-06-10 22:07 [PATCH 1/3] dt-bindings: vendor-prefixes: Document Argon40 Marek Vasut @ 2025-06-10 22:07 ` Marek Vasut 2025-06-12 16:32 ` Conor Dooley 2025-06-10 22:07 ` [PATCH 3/3] pwm: argon-fan-hat: Add Argon40 Fan HAT support Marek Vasut 2025-06-12 16:29 ` [PATCH 1/3] dt-bindings: vendor-prefixes: Document Argon40 Conor Dooley 2 siblings, 1 reply; 8+ messages in thread From: Marek Vasut @ 2025-06-10 22:07 UTC (permalink / raw) To: linux-pwm Cc: Marek Vasut, Uwe Kleine-König, Conor Dooley, Krzysztof Kozlowski, Rob Herring, devicetree, linux-renesas-soc Document trivial PWM on Argon40 Fan HAT, which is a RaspberryPi blower fan hat which can be controlled over I2C. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> --- Cc: "Uwe Kleine-König" <ukleinek@kernel.org> Cc: Conor Dooley <conor+dt@kernel.org> Cc: Krzysztof Kozlowski <krzk+dt@kernel.org> Cc: Rob Herring <robh@kernel.org> Cc: devicetree@vger.kernel.org Cc: linux-pwm@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org --- Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml index 27930708ccd5..b8f1ee6e63dd 100644 --- a/Documentation/devicetree/bindings/trivial-devices.yaml +++ b/Documentation/devicetree/bindings/trivial-devices.yaml @@ -45,6 +45,8 @@ properties: - adi,lt7182s # AMS iAQ-Core VOC Sensor - ams,iaq-core + # Argon40 Fan HAT PWM controller + - argon40,fan-hat # Temperature monitoring of Astera Labs PT5161L PCIe retimer - asteralabs,pt5161l # i2c h/w elliptic curve crypto module -- 2.47.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] dt-bindings: trivial-devices: Document Argon40 Fan HAT 2025-06-10 22:07 ` [PATCH 2/3] dt-bindings: trivial-devices: Document Argon40 Fan HAT Marek Vasut @ 2025-06-12 16:32 ` Conor Dooley 2025-06-17 0:30 ` Marek Vasut 0 siblings, 1 reply; 8+ messages in thread From: Conor Dooley @ 2025-06-12 16:32 UTC (permalink / raw) To: Marek Vasut Cc: linux-pwm, Uwe Kleine-König, Conor Dooley, Krzysztof Kozlowski, Rob Herring, devicetree, linux-renesas-soc [-- Attachment #1: Type: text/plain, Size: 1533 bytes --] On Wed, Jun 11, 2025 at 12:07:26AM +0200, Marek Vasut wrote: > Document trivial PWM on Argon40 Fan HAT, which is a RaspberryPi > blower fan hat which can be controlled over I2C. > > Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> I don't see how a pwm controller, with a fan connected to it, is a trivial device, sorry. PWM fans have their own pwm consumer binding too, so it feels wrong on two levels. > --- > Cc: "Uwe Kleine-König" <ukleinek@kernel.org> > Cc: Conor Dooley <conor+dt@kernel.org> > Cc: Krzysztof Kozlowski <krzk+dt@kernel.org> > Cc: Rob Herring <robh@kernel.org> > Cc: devicetree@vger.kernel.org > Cc: linux-pwm@vger.kernel.org > Cc: linux-renesas-soc@vger.kernel.org > --- > Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml > index 27930708ccd5..b8f1ee6e63dd 100644 > --- a/Documentation/devicetree/bindings/trivial-devices.yaml > +++ b/Documentation/devicetree/bindings/trivial-devices.yaml > @@ -45,6 +45,8 @@ properties: > - adi,lt7182s > # AMS iAQ-Core VOC Sensor > - ams,iaq-core > + # Argon40 Fan HAT PWM controller > + - argon40,fan-hat > # Temperature monitoring of Astera Labs PT5161L PCIe retimer > - asteralabs,pt5161l > # i2c h/w elliptic curve crypto module > -- > 2.47.2 > [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] dt-bindings: trivial-devices: Document Argon40 Fan HAT 2025-06-12 16:32 ` Conor Dooley @ 2025-06-17 0:30 ` Marek Vasut 0 siblings, 0 replies; 8+ messages in thread From: Marek Vasut @ 2025-06-17 0:30 UTC (permalink / raw) To: Conor Dooley Cc: linux-pwm, Uwe Kleine-König, Conor Dooley, Krzysztof Kozlowski, Rob Herring, devicetree, linux-renesas-soc On 6/12/25 6:32 PM, Conor Dooley wrote: > On Wed, Jun 11, 2025 at 12:07:26AM +0200, Marek Vasut wrote: >> Document trivial PWM on Argon40 Fan HAT, which is a RaspberryPi >> blower fan hat which can be controlled over I2C. >> >> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> > > I don't see how a pwm controller, with a fan connected to it, is a > trivial device, sorry. > PWM fans have their own pwm consumer binding too, so it feels wrong on > two levels. Hopefully fixed in V2 series with dedicated bindings, thanks. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] pwm: argon-fan-hat: Add Argon40 Fan HAT support 2025-06-10 22:07 [PATCH 1/3] dt-bindings: vendor-prefixes: Document Argon40 Marek Vasut 2025-06-10 22:07 ` [PATCH 2/3] dt-bindings: trivial-devices: Document Argon40 Fan HAT Marek Vasut @ 2025-06-10 22:07 ` Marek Vasut 2025-06-11 5:55 ` Uwe Kleine-König 2025-06-12 16:29 ` [PATCH 1/3] dt-bindings: vendor-prefixes: Document Argon40 Conor Dooley 2 siblings, 1 reply; 8+ messages in thread From: Marek Vasut @ 2025-06-10 22:07 UTC (permalink / raw) To: linux-pwm Cc: Marek Vasut, Uwe Kleine-König, Conor Dooley, Krzysztof Kozlowski, Rob Herring, devicetree, linux-renesas-soc Add trivial PWM driver for Argon40 Fan HAT, which is a RaspberryPi blower fan hat which can be controlled over I2C. Model this device as a PWM, so the pwm-fan can be attached to it and handle thermal zones and RPM management in a generic manner. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> --- Cc: "Uwe Kleine-König" <ukleinek@kernel.org> Cc: Conor Dooley <conor+dt@kernel.org> Cc: Krzysztof Kozlowski <krzk+dt@kernel.org> Cc: Rob Herring <robh@kernel.org> Cc: devicetree@vger.kernel.org Cc: linux-pwm@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org --- drivers/pwm/Kconfig | 9 +++++ drivers/pwm/Makefile | 1 + drivers/pwm/pwm-argon-fan-hat.c | 64 +++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 drivers/pwm/pwm-argon-fan-hat.c diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index d9bcd1e8413e..02f1a52ea29e 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig @@ -66,6 +66,15 @@ config PWM_APPLE To compile this driver as a module, choose M here: the module will be called pwm-apple. +config PWM_ARGON_FAN_HAT + tristate "Argon40 Fan HAT support" + depends on I2C && OF + help + Generic PWM framework driver for Argon40 Fan HAT. + + To compile this driver as a module, choose M here: the module + will be called pwm-argon-fan-hat. + config PWM_ATMEL tristate "Atmel PWM support" depends on ARCH_AT91 || COMPILE_TEST diff --git a/drivers/pwm/Makefile b/drivers/pwm/Makefile index 96160f4257fc..ff4f47e5fb7a 100644 --- a/drivers/pwm/Makefile +++ b/drivers/pwm/Makefile @@ -3,6 +3,7 @@ obj-$(CONFIG_PWM) += core.o obj-$(CONFIG_PWM_AB8500) += pwm-ab8500.o obj-$(CONFIG_PWM_ADP5585) += pwm-adp5585.o obj-$(CONFIG_PWM_APPLE) += pwm-apple.o +obj-$(CONFIG_PWM_ARGON_FAN_HAT) += pwm-argon-fan-hat.o obj-$(CONFIG_PWM_ATMEL) += pwm-atmel.o obj-$(CONFIG_PWM_ATMEL_HLCDC_PWM) += pwm-atmel-hlcdc.o obj-$(CONFIG_PWM_ATMEL_TCB) += pwm-atmel-tcb.o diff --git a/drivers/pwm/pwm-argon-fan-hat.c b/drivers/pwm/pwm-argon-fan-hat.c new file mode 100644 index 000000000000..3d04abdbd349 --- /dev/null +++ b/drivers/pwm/pwm-argon-fan-hat.c @@ -0,0 +1,64 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2025 Marek Vasut + */ + +#include <linux/err.h> +#include <linux/i2c.h> +#include <linux/module.h> +#include <linux/pwm.h> + +static int argon_fan_hat_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, + const struct pwm_state *state) +{ + struct i2c_client *i2c = pwmchip_get_drvdata(chip); + u8 tx[2] = { 0x80, state->enabled ? pwm_get_relative_duty_cycle(state, 100) : 0 }; + struct i2c_msg msg = { + .addr = i2c->addr, + .len = 2, + .buf = tx, + }; + + if (state->polarity != PWM_POLARITY_NORMAL) + return -EINVAL; + + return (i2c_transfer(i2c->adapter, &msg, 1) == 1) ? 0 : -EINVAL; +} + +static const struct pwm_ops argon_fan_hat_pwm_ops = { + .apply = argon_fan_hat_pwm_apply, +}; + +static int argon_fan_hat_i2c_probe(struct i2c_client *i2c) +{ + struct pwm_chip *pc = devm_pwmchip_alloc(&i2c->dev, 1, 0); + + if (IS_ERR(pc)) + return PTR_ERR(pc); + + pc->ops = &argon_fan_hat_pwm_ops; + pwmchip_set_drvdata(pc, i2c); + + return devm_pwmchip_add(&i2c->dev, pc); +} + +static const struct of_device_id argon_fan_hat_dt_ids[] = { + { .compatible = "argon40,fan-hat" }, + { }, +}; +MODULE_DEVICE_TABLE(of, argon_fan_hat_dt_ids); + +static struct i2c_driver argon_fan_hat_driver = { + .driver = { + .name = "argon-fan-hat", + .probe_type = PROBE_PREFER_ASYNCHRONOUS, + .of_match_table = argon_fan_hat_dt_ids, + }, + .probe = argon_fan_hat_i2c_probe, +}; + +module_i2c_driver(argon_fan_hat_driver); + +MODULE_AUTHOR("Marek Vasut <marek.vasut+renesas@mailbox.org>"); +MODULE_DESCRIPTION("Argon40 Fan HAT"); +MODULE_LICENSE("GPL"); -- 2.47.2 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] pwm: argon-fan-hat: Add Argon40 Fan HAT support 2025-06-10 22:07 ` [PATCH 3/3] pwm: argon-fan-hat: Add Argon40 Fan HAT support Marek Vasut @ 2025-06-11 5:55 ` Uwe Kleine-König 2025-06-17 0:07 ` Marek Vasut 0 siblings, 1 reply; 8+ messages in thread From: Uwe Kleine-König @ 2025-06-11 5:55 UTC (permalink / raw) To: Marek Vasut Cc: linux-pwm, Conor Dooley, Krzysztof Kozlowski, Rob Herring, devicetree, linux-renesas-soc [-- Attachment #1: Type: text/plain, Size: 3088 bytes --] Hello Marek, I wonder how this device works in rpios, I didn't find a matching driver (but I also didn't try more than two minutes). On Wed, Jun 11, 2025 at 12:07:27AM +0200, Marek Vasut wrote: > diff --git a/drivers/pwm/pwm-argon-fan-hat.c b/drivers/pwm/pwm-argon-fan-hat.c > new file mode 100644 > index 000000000000..3d04abdbd349 > --- /dev/null > +++ b/drivers/pwm/pwm-argon-fan-hat.c > @@ -0,0 +1,64 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (C) 2025 Marek Vasut > + */ * Limitations: * - fixed period (which?) * - no support for offset/polarity If you can find out if it completes a period when reconfigured that would also be nice to document. This device is really trivial, but for completeness' sake: If there is a data sheet publicly available, please add a link here. > +#include <linux/err.h> > +#include <linux/i2c.h> > +#include <linux/module.h> > +#include <linux/pwm.h> > + > +static int argon_fan_hat_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, > + const struct pwm_state *state) Can you please implement the new-style callbacks? > +{ > + struct i2c_client *i2c = pwmchip_get_drvdata(chip); > + u8 tx[2] = { 0x80, state->enabled ? pwm_get_relative_duty_cycle(state, 100) : 0 }; This is too simple. I won't go into details about the right algorithm for .apply() as I want you to implement .round_waveform_tohw() + .round_waveform_fromhw() + .read_waveform() + .write_waveform() anyhow. For .round_waveform_tohw() you have to know the actual period length and then use something like: duty = wf->duty_length_ns; if (duty > ARGON_FAN_HAT_PERIOD) duty = ARGON_FAN_HAT_PERIOD; duty_percent = 100 * duty / ARGON_FAN_HAT_PERIOD; > + struct i2c_msg msg = { > + .addr = i2c->addr, > + .len = 2, > + .buf = tx, > + }; > + > + if (state->polarity != PWM_POLARITY_NORMAL) > + return -EINVAL; > + > + return (i2c_transfer(i2c->adapter, &msg, 1) == 1) ? 0 : -EINVAL; > +} > + > +static const struct pwm_ops argon_fan_hat_pwm_ops = { > + .apply = argon_fan_hat_pwm_apply, Can you read back the configuration? If yes then please implement .read_waveform(). > +}; > + > +static int argon_fan_hat_i2c_probe(struct i2c_client *i2c) > +{ > + struct pwm_chip *pc = devm_pwmchip_alloc(&i2c->dev, 1, 0); > + > + if (IS_ERR(pc)) > + return PTR_ERR(pc); > + > + pc->ops = &argon_fan_hat_pwm_ops; > + pwmchip_set_drvdata(pc, i2c); > + > + return devm_pwmchip_add(&i2c->dev, pc); Error message on failure please. (-> dev_err_probe()) > +} > + > +static const struct of_device_id argon_fan_hat_dt_ids[] = { > + { .compatible = "argon40,fan-hat" }, > + { }, > +}; > +MODULE_DEVICE_TABLE(of, argon_fan_hat_dt_ids); > + > +static struct i2c_driver argon_fan_hat_driver = { > + .driver = { > + .name = "argon-fan-hat", > + .probe_type = PROBE_PREFER_ASYNCHRONOUS, > + .of_match_table = argon_fan_hat_dt_ids, > + }, > + .probe = argon_fan_hat_i2c_probe, > +}; TIL about PROBE_PREFER_ASYNCHRONOUS. Best regards Uwe [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] pwm: argon-fan-hat: Add Argon40 Fan HAT support 2025-06-11 5:55 ` Uwe Kleine-König @ 2025-06-17 0:07 ` Marek Vasut 0 siblings, 0 replies; 8+ messages in thread From: Marek Vasut @ 2025-06-17 0:07 UTC (permalink / raw) To: Uwe Kleine-König, Marek Vasut Cc: linux-pwm, Conor Dooley, Krzysztof Kozlowski, Rob Herring, devicetree, linux-renesas-soc On 6/11/25 7:55 AM, Uwe Kleine-König wrote: > Hello Marek, Hi, > I wonder how this device works in rpios, I didn't find a matching driver > (but I also didn't try more than two minutes). The installation guide is here, download the PDF: https://argon40.com/blogs/argon-resources/argon-fan-hat-installation-guide Which leads to this script, which you download on the RPI and (better not without reading it first and understanding it) run: https://download.argon40.com/argonfanhat.sh Which downloads more scripts, installs systemd services which run other scripts, but ultimately this convoluted scripting leads to a single register write for this fan. > On Wed, Jun 11, 2025 at 12:07:27AM +0200, Marek Vasut wrote: >> diff --git a/drivers/pwm/pwm-argon-fan-hat.c b/drivers/pwm/pwm-argon-fan-hat.c >> new file mode 100644 >> index 000000000000..3d04abdbd349 >> --- /dev/null >> +++ b/drivers/pwm/pwm-argon-fan-hat.c >> @@ -0,0 +1,64 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* >> + * Copyright (C) 2025 Marek Vasut >> + */ > > * Limitations: > * - fixed period (which?) > * - no support for offset/polarity > > If you can find out if it completes a period when reconfigured that > would also be nice to document. > > This device is really trivial, but for completeness' sake: If there is a > data sheet publicly available, please add a link here. There is nuvoton MS51FB9AE microcontroller on the underside of the board, which I think does the I2C communication and PWM generation. The firmware source does not seem available. I can see some signal on the FAN itself, it is horribly noisy, but with sufficient filtering I can see they change the PWM period, from some 0 Hz to 120 kHz , with duty cycle being some 10% (but I might be wrong, the signal is not great). > >> +#include <linux/err.h> >> +#include <linux/i2c.h> >> +#include <linux/module.h> >> +#include <linux/pwm.h> >> + >> +static int argon_fan_hat_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, >> + const struct pwm_state *state) > > Can you please implement the new-style callbacks? Sure [...] >> +static const struct pwm_ops argon_fan_hat_pwm_ops = { >> + .apply = argon_fan_hat_pwm_apply, > > Can you read back the configuration? If yes then please implement > .read_waveform(). Nope, reading from the I2C device stops the fan. Rest is fixed in V2, thanks. -- Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] dt-bindings: vendor-prefixes: Document Argon40 2025-06-10 22:07 [PATCH 1/3] dt-bindings: vendor-prefixes: Document Argon40 Marek Vasut 2025-06-10 22:07 ` [PATCH 2/3] dt-bindings: trivial-devices: Document Argon40 Fan HAT Marek Vasut 2025-06-10 22:07 ` [PATCH 3/3] pwm: argon-fan-hat: Add Argon40 Fan HAT support Marek Vasut @ 2025-06-12 16:29 ` Conor Dooley 2 siblings, 0 replies; 8+ messages in thread From: Conor Dooley @ 2025-06-12 16:29 UTC (permalink / raw) To: Marek Vasut Cc: linux-pwm, Uwe Kleine-König, Conor Dooley, Krzysztof Kozlowski, Rob Herring, devicetree, linux-renesas-soc [-- Attachment #1: Type: text/plain, Size: 313 bytes --] On Wed, Jun 11, 2025 at 12:07:25AM +0200, Marek Vasut wrote: > Argon 40 Technologies Limited is a SBC expansion board vendor. > Document the prefix. For details see https://argon40.com . > > Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org> Acked-by: Conor Dooley <conor.dooley@microchip.com> [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-06-17 0:30 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-06-10 22:07 [PATCH 1/3] dt-bindings: vendor-prefixes: Document Argon40 Marek Vasut 2025-06-10 22:07 ` [PATCH 2/3] dt-bindings: trivial-devices: Document Argon40 Fan HAT Marek Vasut 2025-06-12 16:32 ` Conor Dooley 2025-06-17 0:30 ` Marek Vasut 2025-06-10 22:07 ` [PATCH 3/3] pwm: argon-fan-hat: Add Argon40 Fan HAT support Marek Vasut 2025-06-11 5:55 ` Uwe Kleine-König 2025-06-17 0:07 ` Marek Vasut 2025-06-12 16:29 ` [PATCH 1/3] dt-bindings: vendor-prefixes: Document Argon40 Conor Dooley
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).