[PATCH v4] hwmon: max6650: add thermal cooling device capability

2019-04-18 Thread Jean-Francois Dagenais
This allows max6650 devices to be referenced in dts as a cooling device. The pwm value seems duplicated in cooling_dev_state but since pwm goes through rounding logic into data->dac, it is modified and messes with the thermal zone state algorithms. It's also better to serve a cache value, thus

Re: [PATCH v2] hwmon: max6650: add thermal cooling device capability

2019-04-18 Thread Guenter Roeck
On Thu, Apr 18, 2019 at 05:33:13PM -0400, Jean-Francois Dagenais wrote: > > > On Apr 18, 2019, at 16:50, Guenter Roeck wrote: > > > >> normally without any errors, yet the thermal-zone I defined, which is > >> there to > >> prevent my system from burning out, would remain incomplete (without

Re: [PATCH v2] hwmon: max6650: add thermal cooling device capability

2019-04-18 Thread Jean-Francois Dagenais
> On Apr 18, 2019, at 16:50, Guenter Roeck wrote: > >> normally without any errors, yet the thermal-zone I defined, which is there >> to >> prevent my system from burning out, would remain incomplete (without required >> cooling device) and yet no errors came out of the kernel. >> >> I just

Re: [PATCH v3] hwmon: max6650: add thermal cooling device capability

2019-04-18 Thread Guenter Roeck
On Thu, Apr 18, 2019 at 04:45:00PM -0400, Jean-Francois Dagenais wrote: > > > On Apr 18, 2019, at 16:13, Guenter Roeck wrote: > > > >> + if (IS_ERR(data->cooling_dev)) { > >> + err = PTR_ERR(data->cooling_dev); > >> + dev_err(>dev, > >> + "Failed to register

Re: [PATCH v2] hwmon: max6650: add thermal cooling device capability

2019-04-18 Thread Guenter Roeck
On Thu, Apr 18, 2019 at 04:39:35PM -0400, Jean-Francois Dagenais wrote: > > > > On Apr 18, 2019, at 16:12, Guenter Roeck wrote: > > > > That explains why the other drivers don't generate an error message. > > You might want to reconsider the dev_err() above; it appears it adds zero > > value.

Re: [PATCH v3] hwmon: max6650: add thermal cooling device capability

2019-04-18 Thread Jean-Francois Dagenais
> On Apr 18, 2019, at 16:13, Guenter Roeck wrote: > >> +if (IS_ERR(data->cooling_dev)) { >> +err = PTR_ERR(data->cooling_dev); >> +dev_err(>dev, >> +"Failed to register as cooling device (%d)\n", err); > > As mentioned in my other mail, this

Re: [PATCH v2] hwmon: max6650: add thermal cooling device capability

2019-04-18 Thread Jean-Francois Dagenais
> On Apr 18, 2019, at 16:12, Guenter Roeck wrote: > > That explains why the other drivers don't generate an error message. > You might want to reconsider the dev_err() above; it appears it adds zero > value. > >> If I am wrong, then pwm-fan.c should also be visited since my max6650_probe >>

Re: [PATCH v3] hwmon: max6650: add thermal cooling device capability

2019-04-18 Thread Guenter Roeck
On Thu, Apr 18, 2019 at 04:04:52PM -0400, Jean-Francois Dagenais wrote: > This allows max6650 devices to be referenced in dts as a cooling device. > > The pwm value seems duplicated in cooling_dev_state but since pwm goes > through rounding logic into data->dac, it is modified and messes with >

Re: [PATCH v2] hwmon: max6650: add thermal cooling device capability

2019-04-18 Thread Guenter Roeck
On Thu, Apr 18, 2019 at 03:54:32PM -0400, Jean-Francois Dagenais wrote: > > > > On Apr 18, 2019, at 14:06, Guenter Roeck wrote: > > > > On Thu, Apr 18, 2019 at 02:02:48PM -0400, Jean-Francois Dagenais wrote: > >> > >>> On Apr 18, 2019, at 13:38, Guenter Roeck wrote: > >>> > +#if

[PATCH v3] hwmon: max6650: add thermal cooling device capability

2019-04-18 Thread Jean-Francois Dagenais
This allows max6650 devices to be referenced in dts as a cooling device. The pwm value seems duplicated in cooling_dev_state but since pwm goes through rounding logic into data->dac, it is modified and messes with the thermal zone state algorithms. It's also better to serve a cache value, thus

[PATCH 4/6] hwmon: (mlxreg-fan) Use devm_thermal_of_cooling_device_register

2019-04-18 Thread Guenter Roeck
Call devm_thermal_of_cooling_device_register() to register the cooling device. Also introduce struct device *dev = >dev; to make the code easier to read. Signed-off-by: Guenter Roeck --- drivers/hwmon/mlxreg-fan.c | 31 ++- 1 file changed, 10 insertions(+), 21

[PATCH 5/6] hwmon: (npcm750-pwm-fan) Use devm_thermal_of_cooling_device_register

2019-04-18 Thread Guenter Roeck
Use devm_thermal_of_cooling_device_register() to register the cooling device. As a side effect, this fixes a driver bug: thermal_cooling_device_unregister() was not called on device removal. Fixes: f1fd4a4db777 ("hwmon: Add NPCM7xx PWM and Fan driver") Cc: Tomer Maimon Signed-off-by: Guenter

[PATCH 1/6] thermal: Introduce devm_thermal_of_cooling_device_register

2019-04-18 Thread Guenter Roeck
thermal_of_cooling_device_register() and thermal_cooling_device_register() are typically called from driver probe functions, and thermal_cooling_device_unregister() is called from remove functions. This makes both a perfect candidate for device managed functions. Introduce

[PATCH 2/6] hwmon: (aspeed-pwm-tacho) Use devm_thermal_of_cooling_device_register

2019-04-18 Thread Guenter Roeck
Use devm_thermal_of_cooling_device_register() to register the cooling device. As a side effect, this fixes a driver bug: thermal_cooling_device_unregister() was not called on removal. Fixes: f198907d2ff6d ("hwmon: (aspeed-pwm-tacho) cooling device support.") Cc: Mykola Kostenok Cc: Joel Stanley

[PATCH 6/6] hwmon: (pwm-fan) Use devm_thermal_of_cooling_device_register

2019-04-18 Thread Guenter Roeck
Use devm_thermal_of_cooling_device_register() to register the cooling device. Also use devm_add_action_or_reset() to stop the fan on device removal, and to disable the pwm. Introduce a local 'dev' variable in the probe function to make the code easier to read. As a side effect, this fixes a bug

[PATCH 0/6] thermal: Introduce devm_thermal_of_cooling_device_register

2019-04-18 Thread Guenter Roeck
thermal_of_cooling_device_register() and thermal_cooling_device_register() are typically called from driver probe functions, and thermal_cooling_device_unregister() is called from remove functions. This makes both a perfect candidate for device managed functions. Introduce

Re: [PATCH v2] hwmon: max6650: add thermal cooling device capability

2019-04-18 Thread Jean-Francois Dagenais
> On Apr 18, 2019, at 14:06, Guenter Roeck wrote: > > On Thu, Apr 18, 2019 at 02:02:48PM -0400, Jean-Francois Dagenais wrote: >> >>> On Apr 18, 2019, at 13:38, Guenter Roeck wrote: >>> +#if IS_ENABLED(CONFIG_THERMAL) >>> >>> This will result in missing symbols if THERMAL is built as

Re: [PATCH v2] hwmon: max6650: add thermal cooling device capability

2019-04-18 Thread Jean-Francois Dagenais
> On Apr 18, 2019, at 13:38, Guenter Roeck wrote: > >> +#if IS_ENABLED(CONFIG_THERMAL) > > This will result in missing symbols if THERMAL is built as module > and this driver is built into the kernel. You'll have to adjust > Kconfig dependencies accordingly. See other drivers for examples.

Re: [PATCH v2] hwmon: max6650: add thermal cooling device capability

2019-04-18 Thread Guenter Roeck
On Thu, Apr 18, 2019 at 02:02:48PM -0400, Jean-Francois Dagenais wrote: > > > On Apr 18, 2019, at 13:38, Guenter Roeck wrote: > > > >> +#if IS_ENABLED(CONFIG_THERMAL) > > > > This will result in missing symbols if THERMAL is built as module > > and this driver is built into the kernel. You'll

Re: [PATCH v2] hwmon: max6650: add thermal cooling device capability

2019-04-18 Thread Guenter Roeck
On Thu, Apr 18, 2019 at 12:48:13PM -0400, Jean-Francois Dagenais wrote: > This allows max6650 devices to be referenced in dts as a cooling device. > > The pwm value seems duplicated in cooling_dev_state but since pwm goes > through rounding logic into data->dac, it is modified and messes with >

[PATCH v2] hwmon: max6650: add thermal cooling device capability

2019-04-18 Thread Jean-Francois Dagenais
This allows max6650 devices to be referenced in dts as a cooling device. The pwm value seems duplicated in cooling_dev_state but since pwm goes through rounding logic into data->dac, it is modified and messes with the thermal zone state algorithms. It's also better to serve a cache value, thus

[PATCH] hwmon: max6650: add thermal cooling device capability

2019-04-18 Thread Jean-Francois Dagenais
This allows max6650 devices to be referenced in dts as a cooling device. The pwm value seems duplicated in cooling_dev_state but since pwm goes through rounding logic into data->dac, it is modified and messes with the thermal zone state algorithms. It's also better to serve a cache value, thus

Re: [PATCH v2 2/2] hwmon: (ina3221) Add voltage conversion time settings

2019-04-18 Thread Guenter Roeck
On Wed, Apr 17, 2019 at 04:12:10PM -0700, Nicolin Chen wrote: > The CONFIG register has two 3-bit fields for conversion time > settings of Bus-voltage and Shunt-voltage, respectively. The > conversion settings, along with averaging mode, allow users > to optimize available timing requirement. > >

Re: [PATCH v2 1/2] hwmon: (ina3221) Do not read-back to cache reg_config

2019-04-18 Thread Guenter Roeck
On Wed, Apr 17, 2019 at 04:12:09PM -0700, Nicolin Chen wrote: > Reading back the CONFIG register increases an extra I2C > transaction. This's not necessary and could be replaced > with a local variable caching the register settings. > > So this patch replaces two readback regmap_read() calls >

Re: [PATCH v3 21/21] docs: hwmon: Add an index file and rename docs to *.rst

2019-04-18 Thread Guenter Roeck
On 4/18/19 2:44 AM, Mauro Carvalho Chehab wrote: Em Wed, 17 Apr 2019 10:47:28 -0700 Guenter Roeck escreveu: On Wed, Apr 17, 2019 at 10:43:37AM -0700, Guenter Roeck wrote: On Wed, Apr 17, 2019 at 02:22:15PM -0300, Mauro Carvalho Chehab wrote: Em Wed, 17 Apr 2019 14:13:52 -0300 Mauro Carvalho

Re: [PATCH v3 21/21] docs: hwmon: Add an index file and rename docs to *.rst

2019-04-18 Thread Mauro Carvalho Chehab
Em Wed, 17 Apr 2019 10:47:28 -0700 Guenter Roeck escreveu: > On Wed, Apr 17, 2019 at 10:43:37AM -0700, Guenter Roeck wrote: > > On Wed, Apr 17, 2019 at 02:22:15PM -0300, Mauro Carvalho Chehab wrote: > > > Em Wed, 17 Apr 2019 14:13:52 -0300 > > > Mauro Carvalho Chehab escreveu: > > > > > >