mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-23 05:56:14 -04:00
hwmon: Add PEC attribute support to hardware monitoring core
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. 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 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 and reachable. For this reason, the added code needs to depend on reachability of CONFIG_I2C. Cc: Radu Sabau <radu.sabau@analog.com> Acked-by: Nuno Sa <nuno.sa@analog.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
@@ -45,6 +45,7 @@ enum hwmon_chip_attributes {
|
||||
hwmon_chip_power_samples,
|
||||
hwmon_chip_temp_samples,
|
||||
hwmon_chip_beep_enable,
|
||||
hwmon_chip_pec,
|
||||
};
|
||||
|
||||
#define HWMON_C_TEMP_RESET_HISTORY BIT(hwmon_chip_temp_reset_history)
|
||||
@@ -60,6 +61,7 @@ enum hwmon_chip_attributes {
|
||||
#define HWMON_C_POWER_SAMPLES BIT(hwmon_chip_power_samples)
|
||||
#define HWMON_C_TEMP_SAMPLES BIT(hwmon_chip_temp_samples)
|
||||
#define HWMON_C_BEEP_ENABLE BIT(hwmon_chip_beep_enable)
|
||||
#define HWMON_C_PEC BIT(hwmon_chip_pec)
|
||||
|
||||
enum hwmon_temp_attributes {
|
||||
hwmon_temp_enable,
|
||||
|
||||
Reference in New Issue
Block a user