mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 23:13:01 +02:00
hwmon fixes for v6.16-rc7
- corsair-cpro: Validate the size of the received input buffer - ina238: Report energy in microjoules as expected by the ABI - pmbus/ucd9000: Fixed GPIO functionality -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiHPvMQj9QTOCiqgVyx8mb86fmYEFAmh6fDIACgkQyx8mb86f mYERhQ//SIRTPBjPlfoiiI3pS47jiuP+lfldD+/Er/KLH/F/Hj047YuuHf4Ep1Xe lhw19FPF8/5q6q94umNebGc31WHdbB8ErijzxC2DHb2IebSpy3LDprdKEOnhV6Ic dwL2vVcf/n2dmeWzKrM0lGcnSlKyZw2YFEGm3mcWXI2emzqIbxZhcq4VWenhU1a2 dNy8E3ZIg9s3zxlrtOsinbzMMvkbq5glnKqEr/cq4HmnAHi82KZdBBjGZHpsksbe 9rQqxsf0Ciiv7ftMiQa2nQrpkXHmafMnpgcQ1deKnW92iwbKJWKo6pLfFD08OHVn lXR3uP4uge58ot88+1ECwffjFbT41BtOnZPx7H16wxl0k+z+Ii0mAqwiU6o9ftuV aaSwEmncMLWuh4K5SGE6zAFMlp5Zv4UyydBvBU1vwvcCvlvxS2xkauI/c/JzuhEZ K4h+ZVfrynHVlLX2tzIcO1L4gnQTbt9TfZil7o8UCekD/Xr9fyheEypAImLCio30 orkmZrplMoLW+0X8ymhC27DCN8FWZX2Oc+GbdfIt/BNh/i/gkwxAUdSEPr1J3OD0 DHwRViKXKAYUohBKxRzjdfcxEy/NMzfB6G60CQp1+tt87RyLFshkrD3QFxpdF5SK NrpXB4twg2/Gf86SjKDFalPh8DyF7Q0jahxvsaLEHVvLUOl3drc= =Ii5g -----END PGP SIGNATURE----- Merge tag 'hwmon-for-v6.16-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon fixes from Guenter Roeck: - corsair-cpro: Validate the size of the received input buffer - ina238: Report energy in microjoules as expected by the ABI - pmbus/ucd9000: Fixed GPIO functionality * tag 'hwmon-for-v6.16-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (pmbus/ucd9000) Fix error in ucd9000_gpio_set hwmon: (ina238) Report energy in microjoules hwmon: (corsair-cpro) Validate the size of the received input buffer
This commit is contained in:
commit
bd4a1567b6
|
@ -65,7 +65,7 @@ Additional sysfs entries for sq52206
|
|||
------------------------------------
|
||||
|
||||
======================= =======================================================
|
||||
energy1_input Energy measurement (mJ)
|
||||
energy1_input Energy measurement (uJ)
|
||||
|
||||
power1_input_highest Peak Power (uW)
|
||||
======================= =======================================================
|
||||
|
|
|
@ -89,6 +89,7 @@ struct ccp_device {
|
|||
struct mutex mutex; /* whenever buffer is used, lock before send_usb_cmd */
|
||||
u8 *cmd_buffer;
|
||||
u8 *buffer;
|
||||
int buffer_recv_size; /* number of received bytes in buffer */
|
||||
int target[6];
|
||||
DECLARE_BITMAP(temp_cnct, NUM_TEMP_SENSORS);
|
||||
DECLARE_BITMAP(fan_cnct, NUM_FANS);
|
||||
|
@ -146,6 +147,9 @@ static int send_usb_cmd(struct ccp_device *ccp, u8 command, u8 byte1, u8 byte2,
|
|||
if (!t)
|
||||
return -ETIMEDOUT;
|
||||
|
||||
if (ccp->buffer_recv_size != IN_BUFFER_SIZE)
|
||||
return -EPROTO;
|
||||
|
||||
return ccp_get_errno(ccp);
|
||||
}
|
||||
|
||||
|
@ -157,6 +161,7 @@ static int ccp_raw_event(struct hid_device *hdev, struct hid_report *report, u8
|
|||
spin_lock(&ccp->wait_input_report_lock);
|
||||
if (!completion_done(&ccp->wait_input_report)) {
|
||||
memcpy(ccp->buffer, data, min(IN_BUFFER_SIZE, size));
|
||||
ccp->buffer_recv_size = size;
|
||||
complete_all(&ccp->wait_input_report);
|
||||
}
|
||||
spin_unlock(&ccp->wait_input_report_lock);
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
* Power (mW) = 0.2 * register value * 20000 / rshunt / 4 * gain
|
||||
* (Specific for SQ52206)
|
||||
* Power (mW) = 0.24 * register value * 20000 / rshunt / 4 * gain
|
||||
* Energy (mJ) = 16 * 0.24 * register value * 20000 / rshunt / 4 * gain
|
||||
* Energy (uJ) = 16 * 0.24 * register value * 20000 / rshunt / 4 * gain * 1000
|
||||
*/
|
||||
#define INA238_CALIBRATION_VALUE 16384
|
||||
#define INA238_FIXED_SHUNT 20000
|
||||
|
@ -500,9 +500,9 @@ static ssize_t energy1_input_show(struct device *dev,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* result in mJ */
|
||||
energy = div_u64(regval * INA238_FIXED_SHUNT * data->gain * 16 *
|
||||
data->config->power_calculate_factor, 4 * 100 * data->rshunt);
|
||||
/* result in uJ */
|
||||
energy = div_u64(regval * INA238_FIXED_SHUNT * data->gain * 16 * 10 *
|
||||
data->config->power_calculate_factor, 4 * data->rshunt);
|
||||
|
||||
return sysfs_emit(buf, "%llu\n", energy);
|
||||
}
|
||||
|
|
|
@ -226,15 +226,15 @@ static int ucd9000_gpio_set(struct gpio_chip *gc, unsigned int offset,
|
|||
}
|
||||
|
||||
if (value) {
|
||||
if (ret & UCD9000_GPIO_CONFIG_STATUS)
|
||||
if (ret & UCD9000_GPIO_CONFIG_OUT_VALUE)
|
||||
return 0;
|
||||
|
||||
ret |= UCD9000_GPIO_CONFIG_STATUS;
|
||||
ret |= UCD9000_GPIO_CONFIG_OUT_VALUE;
|
||||
} else {
|
||||
if (!(ret & UCD9000_GPIO_CONFIG_STATUS))
|
||||
if (!(ret & UCD9000_GPIO_CONFIG_OUT_VALUE))
|
||||
return 0;
|
||||
|
||||
ret &= ~UCD9000_GPIO_CONFIG_STATUS;
|
||||
ret &= ~UCD9000_GPIO_CONFIG_OUT_VALUE;
|
||||
}
|
||||
|
||||
ret |= UCD9000_GPIO_CONFIG_ENABLE;
|
||||
|
|
Loading…
Reference in New Issue
Block a user