History log of /linux-master/drivers/hwmon/emc2305.c
Revision Date Author Comments
# 7a056444 27-Jan-2024 Heiner Kallweit <hkallweit1@gmail.com>

hwmon: Drop non-functional I2C_CLASS_HWMON support for drivers w/o detect()

Class-based I2C probing requires detect() and address_list both
to be set in the I2C client driver, see checks in i2c_detect().
It's misleading to declare I2C_CLASS_HWMON support if the driver
doesn't implement detect().
Class-based probing is a legacy mechanism, in addition apparently
nobody ever noticed that class-based probing has been non-functional
in both drivers from the very beginning. So drop the fragments of
class-based probing support.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/13ce7c11-a958-4892-ada9-faf5bfdcb89d@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 1975d167 05-May-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

hwmon: Switch i2c drivers back to use .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert
back to (the new) .probe() to be able to eventually drop .probe_new() from
struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230505131718.1210071-1-u.kleine-koenig@pengutronix.de
[groeck: Added missing change in pmbus/acbel-fsg032.c]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# c1686de1 06-Apr-2023 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

hwmon: emc2305: constify pointers to hwmon_channel_info

Statically allocated array of pointed to hwmon_channel_info can be made
const for safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# e11037a5 12-Jan-2023 Randy Dunlap <rdunlap@infradead.org>

hwmon: (emc2305) fix kernel-doc warnings

Fix kernel-doc warnings:
drivers/hwmon/emc2305.c:62: warning: Cannot understand * @cdev: cooling device;
on line 62 - I thought it was a doc line
drivers/hwmon/emc2305.c:89: warning: Cannot understand * @client: i2c client;
on line 89 - I thought it was a doc line

and drop ';' at end of each struct member line.

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Link: https://lore.kernel.org/r/20230113064540.20179-1-rdunlap@infradead.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 364ffd25 05-Dec-2022 Xingjiang Qiao <nanpuyue@gmail.com>

hwmon: (emc2305) fix pwm never being able to set lower

There are fields 'last_hwmon_state' and 'last_thermal_state' in the
structure 'emc2305_cdev_data', which respectively store the cooling state
set by the 'hwmon' and 'thermal' subsystem, and the driver author hopes
that if the state set by 'hwmon' is lower than the value set by 'thermal',
the driver will just save it without actually setting the pwm. Currently,
the 'last_thermal_state' also be updated by 'hwmon', which will cause the
cooling state to never be set to a lower value. This patch fixes that.

Signed-off-by: Xingjiang Qiao <nanpuyue@gmail.com>
Link: https://lore.kernel.org/r/20221206055331.170459-2-nanpuyue@gmail.com
Fixes: 0d8400c5a2ce1 ("hwmon: (emc2305) add support for EMC2301/2/3/5 RPM-based PWM Fan Speed Controller.")
[groeck: renamed emc2305_set_cur_state_shim -> __emc2305_set_cur_state]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 4d50591e 05-Dec-2022 Xingjiang Qiao <nanpuyue@gmail.com>

hwmon: (emc2305) fix unable to probe emc2301/2/3

The definitions of 'EMC2305_REG_PRODUCT_ID' and 'EMC2305_REG_DEVICE' are
both '0xfd', they actually return the same value, but the values returned
by emc2301/2/3/5 are different, so probe emc2301/2/3 will fail, This patch
fixes that.

Signed-off-by: Xingjiang Qiao <nanpuyue@gmail.com>
Link: https://lore.kernel.org/r/20221206055331.170459-1-nanpuyue@gmail.com
Fixes: 0d8400c5a2ce1 ("hwmon: (emc2305) add support for EMC2301/2/3/5 RPM-based PWM Fan Speed Controller.")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# deeab9ea 11-Oct-2022 Stephen Kitt <steve@sk2.org>

hwmon: use simple i2c probe

All these drivers have an i2c probe function which doesn't use the
"struct i2c_device_id *id" parameter, so they can trivially be
converted to the "probe_new" style of probe with a single argument.

This is part of an ongoing transition to single-argument i2c probe
functions. Old-style probe functions involve a call to i2c_match_id:
in drivers/i2c/i2c-core-base.c,

/*
* When there are no more users of probe(),
* rename probe_new to probe.
*/
if (driver->probe_new)
status = driver->probe_new(client);
else if (driver->probe)
status = driver->probe(client,
i2c_match_id(driver->id_table, client));
else
status = -EINVAL;

Drivers which don't need the second parameter can be declared using
probe_new instead, avoiding the call to i2c_match_id. Drivers which do
can still be converted to probe_new-style, calling i2c_match_id
themselves (as is done currently for of_match_id).

This change was done using the following Coccinelle script, and fixed
up for whitespace changes:

@ rule1 @
identifier fn;
identifier client, id;
@@

- static int fn(struct i2c_client *client, const struct i2c_device_id *id)
+ static int fn(struct i2c_client *client)
{
...when != id
}

@ rule2 depends on rule1 @
identifier rule1.fn;
identifier driver;
@@

struct i2c_driver driver = {
- .probe
+ .probe_new
=
(
fn
|
- &fn
+ fn
)
,
};

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20221011143309.3141267-1-steve@sk2.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# a31d5359 14-Sep-2022 Guenter Roeck <linux@roeck-us.net>

hwmon: (emc2305) Remove unnecessary range check

Static analyzers report:

drivers/hwmon/emc2305.c:194 emc2305_set_cur_state()
warn: impossible condition '(val > 255) => (0-255 > 255)'

'val' is u8 and thus can never be larger than 255. In theory
the operation calculating 'val' could result in a value larger
than 255, but this won't happen because its parameter has already
been range checked and it is guaranteed that the result never exceeds
255. Remove the unnecessary value check.

Cc: Michael Shych <michaelsh@nvidia.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 4444a069 31-Aug-2022 Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

hwmon: (emc2305) Remove unused including <linux/version.h>

./drivers/hwmon/emc2305.c: 14 linux/version.h not needed.

Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=2024
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Link: https://lore.kernel.org/r/20220901022332.40248-1-jiapeng.chong@linux.alibaba.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 0d8400c5 10-Aug-2022 Michael Shych <michaelsh@nvidia.com>

hwmon: (emc2305) add support for EMC2301/2/3/5 RPM-based PWM Fan Speed Controller.

Add driver for Microchip EMC2301/2/3/5 RPM-based PWM Fan Speed Controller.
Modify Makefile and Kconfig to support Microchip EMC2305 RPM-based
PWM Fan Speed Controller.

Signed-off-by: Michael Shych <michaelsh@nvidia.com>
Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20220810171552.56417-3-michaelsh@nvidia.com
[groeck: Drop unnecessary () around DIV_ROUND_CLOSEST()]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>