Commit Graph

7 Commits

Author SHA1 Message Date
Uwe Kleine-König
6126f7bb60 hwmon: Switch back to struct platform_driver::remove()
After commit 0edb555a65 ("platform: Make platform_driver::remove()
return void") .remove() is (again) the right callback to implement for
platform drivers.

Convert all platform drivers below drivers/hwmonto use .remove(), with
the eventual goal to drop struct platform_driver::remove_new(). As
.remove() and .remove_new() have the same prototypes, conversion is done
by just changing the structure member name in the driver initializer.

While touching these files, make indention of the struct initializer
consistent in several files.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Message-ID: <20241017155900.137357-2-u.kleine-koenig@baylibre.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-11-10 14:48:07 -08:00
Jinjie Ruan
24b070d7d8 hwmon: (aspeed-g6-pwm-tacho): Simplify with scoped for each OF child loop
Use scoped for_each_child_of_node_scoped() when iterating over device
nodes to make code a bit simpler.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Message-ID: <20240822062956.3490387-2-ruanjinjie@huawei.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-08-27 08:11:15 -07:00
Linus Torvalds
9d81e2d5a9 pwm: Changes for v6.10-rc1
Apart for the normal updates for dt bindings, cleanups and support for
 new device variants to existing drivers this completes the conversion to
 pwmchip_alloc() which was started in the v6.9 development cycle.
 
 Using pwmchip_alloc() is a precondition to the character device support
 which allows easier and faster access to PWM devices. However there are
 some issues I want to clean up before including it in mainline, so this
 isn't contained here despite it was in next for some time.
 
 Thanks to Alexandre Mergnat, Binbin Zhou, Dmitry Rokosov, George Stark,
 Jerome Brunet and Varshini Rajendran for their contributions. Further
 thanks go to AngeloGioacchino Del Regno, Conor Dooley, David Lechner,
 Fabrice Gasnier, Florian Fainelli, Guenter Roeck, Gustavo A. R. Silva,
 Krzysztof Kozlowski and Rob Herring for valuable patch review.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmZBz1cACgkQj4D7WH0S
 /k4lXQf9HTSvbCz4x6PAxXPEe5trXlnUxGUsPa73mj2bVV8jpnJIy3vIrzZ0C2BG
 dV6Pfo4rLZYdjFQJW3CalfQShmDXwBWhAbQ7jupt3CdJsZC8Uoqt3R9hJA6A2sp+
 g8JkHZ3YateggLIUWWyOosanSGdzLKayOXtmjhHeywD+VTMAjHNglYlB8XjqzbnC
 ti4F4Q4pJjjvap9oT6sKPGH05J43Z8LDJ3zo/0oQfo1NV5pPfxcBs6GqzuWROaW9
 DHWovz/KV06oYfiHHmtgxQxC6HO1J4lUQTMoF2kjcRmVwqeZXPWn8l1mmpQynJ/P
 94bixYQUUT+V2B0snhgnzEJNN6vEvw==
 =JaHr
 -----END PGP SIGNATURE-----

Merge tag 'pwm/for-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux

Pull pwm updates from Uwe Kleine-König:
 "Apart for the normal updates for dt bindings, cleanups and support for
  new device variants to existing drivers this completes the conversion
  to pwmchip_alloc() which was started in the v6.9 development cycle.

  Using pwmchip_alloc() is a precondition to the character device
  support which allows easier and faster access to PWM devices. However
  there are some issues I want to clean up before including it in
  mainline, so this isn't contained here despite it was in next for some
  time.

  Thanks to Alexandre Mergnat, Binbin Zhou, Dmitry Rokosov, George
  Stark, Jerome Brunet and Varshini Rajendran for their contributions.
  Further thanks go to AngeloGioacchino Del Regno, Conor Dooley, David
  Lechner, Fabrice Gasnier, Florian Fainelli, Guenter Roeck, Gustavo A.
  R. Silva, Krzysztof Kozlowski and Rob Herring for valuable patch
  review"

* tag 'pwm/for-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux: (34 commits)
  pwm: pca9685: Drop explicit initialization of struct i2c_device_id::driver_data to 0
  dt-bindings: pwm: snps,dw-apb-timers: Do not require pwm-cells twice
  dt-bindings: pwm: mediatek,pwm-disp: Do not require pwm-cells twice
  dt-bindings: pwm: mediatek,mt2712: Do not require pwm-cells twice
  dt-bindings: pwm: marvell,pxa: Do not require pwm-cells twice
  dt-bindings: pwm: google,cros-ec: Do not require pwm-cells twice
  dt-bindings: pwm: bcm2835: Do not require pwm-cells twice
  pwm: meson: Use mul_u64_u64_div_u64() for frequency calculating
  pwm: meson: Add check for error from clk_round_rate()
  pwm: meson: Drop unneeded check in .get_state()
  dt-bindings: pwm: mediatek,pwm-disp: add compatible for mt8365 SoC
  pwm: meson: Add generic compatible for meson8 to sm1
  pwm: bcm2835: Drop open coded variant of devm_clk_rate_exclusive_get()
  pwm: bcm2835: Introduce a local variable for &pdev->dev
  pwm: stm32: Calculate prescaler with a division instead of a loop
  pwm: stm32: Fix for settings using period > UINT32_MAX
  pwm: stm32: Improve precision of calculation in .apply()
  pwm: stm32: Add error messages in .probe()'s error paths
  pwm: Make pwmchip_[sg]et_drvdata() a wrapper around dev_set_drvdata()
  pwm: Don't check pointer for being non-NULL after use
  ...
2024-05-14 15:03:19 -07:00
Uwe Kleine-König
e27cbb607f hwmon: (aspeed-g6-pwm-tach) Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Link: https://lore.kernel.org/r/20240409085552.19868-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-04-28 10:08:33 -07:00
Uwe Kleine-König
79dedfadb7 hwmon: (aspeed-g6-pwm-tacho): Make use of devm_pwmchip_alloc() function
This prepares the aspeed-g6-pwm-tacho driver to further changes of the
pwm core outlined in the commit introducing devm_pwmchip_alloc(). There
is no intended semantical change and the driver should behave as before.

Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/e95e41eea5a138ae206c9116ba3cb1d9e0178284.1710777536.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2024-04-26 21:29:16 +02:00
Uwe Kleine-König
940052bcbc hwmon: (aspeed-g6-pwm-tacho): Make use of pwmchip_parent() accessor
struct pwm_chip::dev is about to change. To not have to touch this
driver in the same commit as struct pwm_chip::dev, use the accessor
function provided for exactly this purpose.

Acked-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/5c6a11dd10cd29e0f7bfaa1fdef145523347cb58.1710777536.git.u.kleine-koenig@pengutronix.de
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2024-04-26 21:29:16 +02:00
Billy Tsai
7e1449cd15 hwmon: (aspeed-g6-pwm-tacho): Support for ASPEED g6 PWM/Fan tach
The driver support two functions: PWM and Tachometer. The PWM feature can
handle up to 16 output ports, while the Tachometer can monitor to up to 16
input ports as well. This driver implements them by exposing two kernel
subsystems: PWM and HWMON. The PWM subsystem can be utilized alongside
existing drivers for controlling elements such as fans (pwm-fan.c),
beepers (pwm-beeper.c) and so on. Through the HWMON subsystem, the driver
provides sysfs interfaces for fan.

Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20240221104025.1306227-4-billy_tsai@aspeedtech.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2024-03-07 10:50:16 -08:00