Linux Hardware Monitor development
 help / color / mirror / Atom feed
* [PATCH v2 0/2] hwmon: Add PEC attribute support to hardware monitoring core
@ 2024-05-31 20:33 Guenter Roeck
  2024-05-31 20:33 ` [PATCH v2 1/2] " Guenter Roeck
  2024-05-31 20:33 ` [PATCH v2 2/2] hwmon: (lm90) Convert to use PEC support from hwmon core Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Guenter Roeck @ 2024-05-31 20:33 UTC (permalink / raw)
  To: linux-hwmon; +Cc: linux-kernel, Nuno Sa, Radu Sabau, Guenter Roeck

Several hardware monitoring chips optionally support Packet Error Checking
(PEC). For some chips, PEC support can be enabled simply by setting
I2C_CLIENT_PEC in the i2c client data structure. Others require chip
specific code to enable or disable PEC support.

Introduce hwmon_chip_pec and HWMON_C_PEC to simplify adding configurable
PEC support for hardware monitoring drivers. A driver can set HWMON_C_PEC
in its chip information data to indicate PEC support. If a chip requires
chip specific code to enable or disable PEC support, the driver only needs
to implement support for the hwmon_chip_pec attribute to its write
function.

The code calls i2c_check_functionality() to check if PEC is supported
by the I2C/SMBus controller. This function is only available if CONFIG_I2C
is enabled. For this reason, the added code needs to depend on CONFIG_I2C.

Packet Error Checking is only supported for SMBus devices. HWMON_C_PEC
must therefore only be set by a driver if the parent device is an I2C
device. Attempts to set HWMON_C_PEC on any other device type is not
supported and rejected.

The first patch of the series introduces PEC support to the harwdare
monitoring core. The second patch converts to lm90 driver to use the
new infrastructure.

Tested with ADM7421A using lm90 driver and Devantech USB-ISS.

v2: Use sysfs_emit()
    Return -EINVAL if the parent device is not an i2c client device
    Added code needs to be enclosed in "#ifdef(CONFIG_I2C)"
    Added Nuno's Acked-by: tag.

----------------------------------------------------------------
Guenter Roeck (2):
      hwmon: Add PEC attribute support to hardware monitoring core
      hwmon: (lm90) Convert to use PEC support from hwmon core

 drivers/hwmon/Kconfig |   1 +
 drivers/hwmon/hwmon.c | 147 ++++++++++++++++++++++++++++++++++++++++++++------
 drivers/hwmon/lm90.c  |  56 +------------------
 include/linux/hwmon.h |   2 +
 4 files changed, 136 insertions(+), 70 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-31 20:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-31 20:33 [PATCH v2 0/2] hwmon: Add PEC attribute support to hardware monitoring core Guenter Roeck
2024-05-31 20:33 ` [PATCH v2 1/2] " Guenter Roeck
2024-05-31 20:33 ` [PATCH v2 2/2] hwmon: (lm90) Convert to use PEC support from hwmon core Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox