Merge tag 'hwmon-for-v6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon updates from Guenter Roeck:
 "New drivers:

   - PMBus client driver for Intel CRPS185 power supply

   - PMBus client driver for Texas Instruments TPS25990

  Chip support added to existing drivers:

   - pmbus/max15301: Add support for MAX15303

   - pmbus/adm1275: Add adm1273 support

   - lm75: Add NXP P3T1755 support; with it, add I3C support to the
     driver

   - asus-ec-sensors: Add TUF GAMING X670E PLUS

  Other notable changes:

   - nct6683: Add customer IDs for several MSI and ASRock boards

   - tmp108: Add regulator support

   - Improve write protect support in PMBus core

   - pmbus/dps920ab: Add ability to instantiate through i2c

   - The hwmon core now accepts NULL as device name parameter to
     [devm_]hwmon_device_register_with_info ans uses the parent device
     name as fallback in that case

   - The PMBus core now provides the PMBUs revision in a debugfs file

   - asus-ec-sensors: Support for optional CPU fan on AMD 600
     motherboards

   - raspberrypi: Add PM suspend/resume support

   - dell-smm: Enable manual fan control support on Dell XPS 9370

   - pwm-fan: Default to maximum cooling level if provided

  And various other minor fixes and improvements"

* tag 'hwmon-for-v6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (44 commits)
  hwmon: pmbus: dps920ab: Add ability to instantiate through i2c
  hwmon: (pwm-fan) Default to the Maximum cooling level if provided
  hwmon: (asus_atk0110) Use str_enabled_disabled() and str_enable_disable() helpers
  hwmon: Fix help text for aspeed-g6-pwm-tach
  hwmon: (dell-smm) Add Dell XPS 9370 to fan control whitelist
  hwmon: (acpi_power_meter) Fix update the power trip points on failure
  hwmon: (acpi_power_meter) Fix uninitialized variables
  hwmon: (core) Use device name as a fallback in devm_hwmon_device_register_with_info
  hwmon: (pmbus/max15301) Add support for MAX15303
  hwmon: (pmbus/adm1275) add adm1273 support
  dt-bindings: hwmon: adm1275: add adm1273
  hwmon: (nct6683) Add another customer ID for MSI
  hwmon: (pwm-fan): Make use of device properties everywhere
  hwmon: (lm75) add I3C support for P3T1755
  hwmon: (lm75) separate probe into common and I2C parts
  hwmon: (lm75) Remove superfluous 'client' member from private struct
  hwmon: (lm75) simplify regulator handling
  hwmon: (lm75) simplify lm75_write_config()
  hwmon: (lm75) Hide register size differences in regmap access functions
  hwmon: (pmbus/crps) Add Intel CRPS185 power supply
  ...
This commit is contained in:
Linus Torvalds
2025-01-22 10:16:48 -08:00
41 changed files with 1378 additions and 268 deletions

View File

@@ -24,6 +24,7 @@ properties:
enum:
- adi,adm1075
- adi,adm1272
- adi,adm1273
- adi,adm1275
- adi,adm1276
- adi,adm1278
@@ -79,6 +80,7 @@ allOf:
contains:
enum:
- adi,adm1272
- adi,adm1273
then:
properties:
adi,volt-curr-sample-average:

View File

@@ -28,6 +28,7 @@ properties:
- maxim,max31725
- maxim,max31726
- maxim,mcp980x
- nxp,p3t1755
- nxp,pct2075
- st,stds75
- st,stlm75

View File

@@ -149,6 +149,8 @@ properties:
- injoinic,ip5209
# Inspur Power System power supply unit version 1
- inspur,ipsps1
# Intel common redudant power supply crps185
- intel,crps185
# Intersil ISL29028 Ambient Light and Proximity Sensor
- isil,isl29028
# Intersil ISL29030 Ambient Light and Proximity Sensor

View File

@@ -19,6 +19,14 @@ Supported chips:
Datasheet: www.analog.com/static/imported-files/data_sheets/ADM1272.pdf
* Analog Devices ADM1273
Prefix: 'adm1273'
Addresses scanned: -
Datasheet: Not yet publicly available
* Analog Devices ADM1275
Prefix: 'adm1275'
@@ -66,14 +74,14 @@ Description
-----------
This driver supports hardware monitoring for Analog Devices ADM1075, ADM1272,
ADM1275, ADM1276, ADM1278, ADM1281, ADM1293, and ADM1294 Hot-Swap Controller and
Digital Power Monitors.
ADM1273, ADM1275, ADM1276, ADM1278, ADM1281, ADM1293, and ADM1294 Hot-Swap
Controller and Digital Power Monitors.
ADM1075, ADM1272, ADM1275, ADM1276, ADM1278, ADM1281, ADM1293, and ADM1294 are hot-swap
controllers that allow a circuit board to be removed from or inserted into
a live backplane. They also feature current and voltage readback via an
integrated 12 bit analog-to-digital converter (ADC), accessed using a
PMBus interface.
ADM1075, ADM1272, ADM1273, ADM1275, ADM1276, ADM1278, ADM1281, ADM1293, and
ADM1294 are hot-swap controllers that allow a circuit board to be removed from
or inserted into a live backplane. They also feature current and voltage
readback via an integrated 12 bit analog-to-digital converter (ADC), accessed
using a PMBus interface.
The driver is a client driver to the core PMBus driver. Please see
Documentation/hwmon/pmbus.rst for details on PMBus client drivers.
@@ -141,7 +149,7 @@ power1_input_highest Highest observed input power.
power1_reset_history Write any value to reset history.
Power attributes are supported on ADM1075, ADM1272,
ADM1276, ADM1293, and ADM1294.
ADM1273, ADM1276, ADM1293, and ADM1294.
temp1_input Chip temperature.
temp1_max Maximum chip temperature.
@@ -151,6 +159,6 @@ temp1_crit_alarm Critical temperature high alarm.
temp1_highest Highest observed temperature.
temp1_reset_history Write any value to reset history.
Temperature attributes are supported on ADM1272 and
ADM1278, and ADM1281.
Temperature attributes are supported on ADM1272,
ADM1273, ADM1278, and ADM1281.
======================= =======================================================

View File

@@ -29,6 +29,7 @@ Supported boards:
* ROG STRIX Z690-A GAMING WIFI D4
* ROG ZENITH II EXTREME
* ROG ZENITH II EXTREME ALPHA
* TUF GAMING X670E PLUS
Authors:
- Eugene Shalygin <eugene.shalygin@gmail.com>

View File

@@ -0,0 +1,97 @@
.. SPDX-License-Identifier: GPL-2.0-or-later
Kernel driver crps
==================
Supported chips:
* Intel CRPS185
Prefix: 'crps185'
Addresses scanned: -
Datasheet: Only available under NDA.
Authors:
Ninad Palsule <ninad@linux.ibm.com>
Description
-----------
This driver implements support for Intel Common Redundant Power supply with
PMBus support.
The driver is a client driver to the core PMBus driver.
Please see Documentation/hwmon/pmbus.rst for details on PMBus client drivers.
Usage Notes
-----------
This driver does not auto-detect devices. You will have to instantiate the
devices explicitly. Please see Documentation/i2c/instantiating-devices.rst for
details.
Sysfs entries
-------------
======================= ======================================================
curr1_label "iin"
curr1_input Measured input current
curr1_max Maximum input current
curr1_max_alarm Input maximum current high alarm
curr1_crit Critial high input current
curr1_crit_alarm Input critical current high alarm
curr1_rated_max Maximum rated input current
curr2_label "iout1"
curr2_input Measured output current
curr2_max Maximum output current
curr2_max_alarm Output maximum current high alarm
curr2_crit Critial high output current
curr2_crit_alarm Output critical current high alarm
curr2_rated_max Maximum rated output current
in1_label "vin"
in1_input Measured input voltage
in1_crit Critical input over voltage
in1_crit_alarm Critical input over voltage alarm
in1_max Maximum input over voltage
in1_max_alarm Maximum input over voltage alarm
in1_rated_min Minimum rated input voltage
in1_rated_max Maximum rated input voltage
in2_label "vout1"
in2_input Measured input voltage
in2_crit Critical input over voltage
in2_crit_alarm Critical input over voltage alarm
in2_lcrit Critical input under voltage fault
in2_lcrit_alarm Critical input under voltage fault alarm
in2_max Maximum input over voltage
in2_max_alarm Maximum input over voltage alarm
in2_min Minimum input under voltage warning
in2_min_alarm Minimum input under voltage warning alarm
in2_rated_min Minimum rated input voltage
in2_rated_max Maximum rated input voltage
power1_label "pin"
power1_input Measured input power
power1_alarm Input power high alarm
power1_max Maximum input power
power1_rated_max Maximum rated input power
temp[1-2]_input Measured temperature
temp[1-2]_crit Critical temperature
temp[1-2]_crit_alarm Critical temperature alarm
temp[1-2]_max Maximum temperature
temp[1-2]_max_alarm Maximum temperature alarm
temp[1-2]_rated_max Maximum rated temperature
fan1_alarm Fan 1 warning.
fan1_fault Fan 1 fault.
fan1_input Fan 1 speed in RPM.
fan1_target Fan 1 target.
======================= ======================================================

View File

@@ -64,7 +64,8 @@ hwmon_device_register_with_info.
All supported hwmon device registration functions only accept valid device
names. Device names including invalid characters (whitespace, '*', or '-')
will be rejected. The 'name' parameter is mandatory.
will be rejected. If NULL is passed as name parameter, the hardware monitoring
device name will be derived from the parent device name.
If the driver doesn't use a static device name (for example it uses
dev_name()), and therefore cannot make sure the name only contains valid

View File

@@ -58,6 +58,7 @@ Hardware Monitoring Kernel Drivers
corsair-cpro
corsair-psu
cros_ec_hwmon
crps
da9052
da9055
dell-smm-hwmon
@@ -237,6 +238,7 @@ Hardware Monitoring Kernel Drivers
tmp464
tmp513
tps23861
tps25990
tps40422
tps53679
tps546d24

View File

@@ -33,7 +33,7 @@ details.
The shunt value in micro-ohms, shunt voltage range and averaging can be set
with device properties.
Please refer to the Documentation/devicetree/bindings/hwmon/isl,isl28022.yaml
Please refer to the Documentation/devicetree/bindings/hwmon/renesas,isl28022.yaml
for bindings if the device tree is used.
The driver supports only shunt and bus continuous ADC mode at 15bit resolution.
@@ -48,6 +48,7 @@ The following attributes are supported. All attributes are read-only.
======================= =======================================================
in0_input bus voltage (milli Volt)
in1_input shunt voltage (milli Volt)
curr1_input current (milli Ampere)
power1_input power (micro Watt)

View File

@@ -121,15 +121,17 @@ Supported chips:
https://www.ti.com/product/TMP1075
* NXP LM75B, PCT2075
* NXP LM75B, P3T1755, PCT2075
Prefix: 'lm75b', 'pct2075'
Prefix: 'lm75b', 'p3t1755', 'pct2075'
Addresses scanned: none
Datasheet: Publicly available at the NXP website
https://www.nxp.com/documents/data_sheet/LM75B.pdf
https://www.nxp.com/docs/en/data-sheet/LM75B.pdf
https://www.nxp.com/docs/en/data-sheet/P3T1755.pdf
https://www.nxp.com/docs/en/data-sheet/PCT2075.pdf

View File

@@ -13,6 +13,14 @@ Supported chips:
Datasheet: https://datasheets.maximintegrated.com/en/ds/MAX15301.pdf
* Maxim MAX15303
Prefix: 'max15303'
Addresses scanned: -
Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/max15303.pdf
Author: Erik Rosen <erik.rosen@metormote.com>

View File

@@ -55,14 +55,16 @@ Tested Boards and Firmware Versions
The driver has been reported to work with the following boards and
firmware versions.
=============== ===============================================
Board Firmware version
=============== ===============================================
Intel DH87RL NCT6683D EC firmware version 1.0 build 04/03/13
Intel DH87MC NCT6683D EC firmware version 1.0 build 04/03/13
Intel DB85FL NCT6683D EC firmware version 1.0 build 04/03/13
ASRock X570 NCT6683D EC firmware version 1.0 build 06/28/19
ASRock X670E NCT6686D EC firmware version 1.0 build 05/19/22
MSI B550 NCT6687D EC firmware version 1.0 build 05/07/20
MSI X670-P NCT6687D EC firmware version 0.0 build 09/27/22
=============== ===============================================
=============================== ===============================================
Board Firmware version
=============================== ===============================================
Intel DH87RL NCT6683D EC firmware version 1.0 build 04/03/13
Intel DH87MC NCT6683D EC firmware version 1.0 build 04/03/13
Intel DB85FL NCT6683D EC firmware version 1.0 build 04/03/13
ASRock X570 NCT6683D EC firmware version 1.0 build 06/28/19
ASRock X670E NCT6686D EC firmware version 1.0 build 05/19/22
ASRock B650 Steel Legend WiFi NCT6686D EC firmware version 1.0 build 11/09/23
MSI B550 NCT6687D EC firmware version 1.0 build 05/07/20
MSI X670-P NCT6687D EC firmware version 0.0 build 09/27/22
MSI X870E NCT6687D EC firmware version 0.0 build 11/13/24
=============================== ===============================================

View File

@@ -312,6 +312,10 @@ currently provides a flags field with four bits used::
#define PMBUS_USE_COEFFICIENTS_CMD BIT(5)
#define PMBUS_OP_PROTECTED BIT(6)
#define PMBUS_VOUT_PROTECTED BIT(7)
struct pmbus_platform_data {
u32 flags; /* Device specific flags */
@@ -373,3 +377,34 @@ PMBUS_USE_COEFFICIENTS_CMD
When this flag is set the PMBus core driver will use the COEFFICIENTS
register to initialize the coefficients for the direct mode format.
PMBUS_OP_PROTECTED
Set if the chip OPERATION command is protected and protection is not
determined by the standard WRITE_PROTECT command.
PMBUS_VOUT_PROTECTED
Set if the chip VOUT_COMMAND command is protected and protection is not
determined by the standard WRITE_PROTECT command.
Module parameter
----------------
pmbus_core.wp: PMBus write protect forced mode
PMBus may come up with a variety of write protection configuration.
'pmbus_core.wp' may be used if a particular write protection is necessary.
The ability to actually alter the protection may also depend on the chip
so the actual runtime write protection configuration may differ from
the requested one. pmbus_core currently support the following value:
* 0: write protection removed.
* 1: Disable all writes except to the WRITE_PROTECT, OPERATION,
PAGE, ON_OFF_CONFIG and VOUT_COMMAND commands.
* 2: Disable all writes except to the WRITE_PROTECT, OPERATION and
PAGE commands.
* 3: Disable all writes except to the WRITE_PROTECT command. Note that
protection should include the PAGE register. This may be problematic
for multi-page chips, if the chips strictly follows the PMBus
specification, preventing the chip from changing the active page.

View File

@@ -0,0 +1,147 @@
.. SPDX-License-Identifier: GPL-2.0
Kernel driver tps25990
======================
Supported chips:
* TI TPS25990
Prefix: 'tps25990'
* Datasheet
Publicly available at Texas Instruments website: https://www.ti.com/lit/gpn/tps25990
Author:
Jerome Brunet <jbrunet@baylibre.com>
Description
-----------
This driver implements support for TI TPS25990 eFuse.
This is an integrated, high-current circuit protection and power
management device with PMBUS interface
Device compliant with:
- PMBus rev 1.3 interface.
Device supports direct format for reading input voltages,
output voltage, input current, input power and temperature.
Due to the specificities of the chip, all history reset attributes
are tied together. Resetting the history of a sensor, resets the
history of all the sensors.
The driver exports the following attributes via the 'sysfs' files
for input current:
**curr1_average**
**curr1_crit**
**curr1_crit_alarm**
**curr1_highest**
**curr1_input**
**curr1_label**
**curr1_max**
**curr1_max_alarm**
**curr1_reset_history**
The driver provides the following attributes for main input voltage:
**in1_average**
**in1_crit**
**in1_crit_alarm**
**in1_highest**
**in1_input**
**in1_label**
**in1_lcrit**
**in1_lcrit_alarm**
**in1_lowest**
**in1_max**
**in1_max_alarm**
**in1_min**
**in1_min_alarm**
**in1_reset_history**
The driver provides the following attributes for auxiliary input voltage:
**in2_input**
**in2_label**
The driver provides the following attributes for output voltage:
**in3_average**
**in3_input**
**in3_label**
**in3_lowest**
**in3_min**
**in3_min_alarm**
**in3_reset_history**
The driver provides the following attributes for input power:
**power1_alarm**
**power1_average**
**power1_input**
**power1_input_highest**
**power1_label**
**power1_max**
**power1_reset_history**
The driver provides the following attributes for temperature:
**temp1_average**
**temp1_crit**
**temp1_crit_alarm**
**temp1_highest**
**temp1_input**
**temp1_max**
**temp1_max_alarm**
**temp1_reset_history**
The driver provides the following attributes for sampling:
**samples**

View File

@@ -1252,7 +1252,7 @@ S: Maintained
F: Documentation/devicetree/bindings/rtc/amlogic,a4-rtc.yaml
F: drivers/rtc/rtc-amlogic-a4.c
AMPHENOL CHIPCAP 2 HUMIDITY-TEMPERATURE IIO DRIVER
AMPHENOL CHIPCAP 2 DRIVER
M: Javier Carrasco <javier.carrasco.cruz@gmail.com>
L: linux-hwmon@vger.kernel.org
S: Maintained
@@ -6098,6 +6098,13 @@ L: linux-input@vger.kernel.org
S: Maintained
F: drivers/hid/hid-creative-sb0540.c
INTEL CRPS COMMON REDUNDANT PSU DRIVER
M: Ninad Palsule <ninad@linux.ibm.com>
L: linux-hwmon@vger.kernel.org
S: Maintained
F: Documentation/hwmon/crps.rst
F: drivers/hwmon/pmbus/crps.c
CRYPTO API
M: Herbert Xu <herbert@gondor.apana.org.au>
M: "David S. Miller" <davem@davemloft.net>
@@ -23284,6 +23291,8 @@ M: Jerome Brunet <jbrunet@baylibre.com>
L: linux-hwmon@vger.kernel.org
S: Maintained
F: Documentation/devicetree/bindings/hwmon/pmbus/ti,tps25990.yaml
F: Documentation/hwmon/tps25990.rst
F: drivers/hwmon/pmbus/tps25990.c
TEXAS INSTRUMENTS TPS23861 PoE PSE DRIVER
M: Robert Marko <robert.marko@sartura.hr>

View File

@@ -413,7 +413,7 @@ config SENSORS_ASPEED
will be called aspeed_pwm_tacho.
config SENSORS_ASPEED_G6
tristate "ASPEED g6 PWM and Fan tach driver"
tristate "ASPEED G6 PWM and Fan tach driver"
depends on ARCH_ASPEED || COMPILE_TEST
depends on PWM
help
@@ -421,7 +421,7 @@ config SENSORS_ASPEED_G6
controllers.
This driver can also be built as a module. If so, the module
will be called aspeed_pwm_tacho.
will be called aspeed_g6_pwm_tach.
config SENSORS_ATXP1
tristate "Attansic ATXP1 VID controller"
@@ -1412,7 +1412,9 @@ config SENSORS_LM73
config SENSORS_LM75
tristate "National Semiconductor LM75 and compatibles"
depends on I2C
depends on I3C || !I3C
select REGMAP_I2C
select REGMAP_I3C if I3C
help
If you say yes here you get support for one common type of
temperature sensor chip, with models including:

View File

@@ -84,6 +84,7 @@ struct acpi_power_meter_resource {
u64 power;
u64 cap;
u64 avg_interval;
bool power_alarm;
int sensors_valid;
unsigned long sensors_last_updated;
struct sensor_device_attribute sensors[NUM_SENSORS];
@@ -292,8 +293,8 @@ static ssize_t set_trip(struct device *dev, struct device_attribute *devattr,
struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
struct acpi_device *acpi_dev = to_acpi_device(dev);
struct acpi_power_meter_resource *resource = acpi_dev->driver_data;
unsigned long temp, trip_bk;
int res;
unsigned long temp;
res = kstrtoul(buf, 10, &temp);
if (res)
@@ -301,13 +302,15 @@ static ssize_t set_trip(struct device *dev, struct device_attribute *devattr,
temp = DIV_ROUND_CLOSEST(temp, 1000);
mutex_lock(&resource->lock);
guard(mutex)(&resource->lock);
trip_bk = resource->trip[attr->index - 7];
resource->trip[attr->index - 7] = temp;
res = set_acpi_trip(resource);
mutex_unlock(&resource->lock);
if (res)
if (res) {
resource->trip[attr->index - 7] = trip_bk;
return res;
}
return count;
}
@@ -396,6 +399,9 @@ static ssize_t show_val(struct device *dev,
struct acpi_device *acpi_dev = to_acpi_device(dev);
struct acpi_power_meter_resource *resource = acpi_dev->driver_data;
u64 val = 0;
int ret;
guard(mutex)(&resource->lock);
switch (attr->index) {
case 0:
@@ -423,10 +429,17 @@ static ssize_t show_val(struct device *dev,
val = 0;
break;
case 6:
if (resource->power > resource->cap)
val = 1;
else
val = 0;
ret = update_meter(resource);
if (ret)
return ret;
/* need to update cap if not to support the notification. */
if (!(resource->caps.flags & POWER_METER_CAN_NOTIFY)) {
ret = update_cap(resource);
if (ret)
return ret;
}
val = resource->power_alarm || resource->power > resource->cap;
resource->power_alarm = resource->power > resource->cap;
break;
case 7:
case 8:
@@ -847,12 +860,20 @@ static void acpi_power_meter_notify(struct acpi_device *device, u32 event)
sysfs_notify(&device->dev.kobj, NULL, POWER_AVERAGE_NAME);
break;
case METER_NOTIFY_CAP:
mutex_lock(&resource->lock);
res = update_cap(resource);
if (res)
dev_err_once(&device->dev, "update cap failed when capping value is changed.\n");
mutex_unlock(&resource->lock);
sysfs_notify(&device->dev.kobj, NULL, POWER_CAP_NAME);
break;
case METER_NOTIFY_INTERVAL:
sysfs_notify(&device->dev.kobj, NULL, POWER_AVG_INTERVAL_NAME);
break;
case METER_NOTIFY_CAPPING:
mutex_lock(&resource->lock);
resource->power_alarm = true;
mutex_unlock(&resource->lock);
sysfs_notify(&device->dev.kobj, NULL, POWER_ALARM_NAME);
dev_info(&device->dev, "Capping in progress.\n");
break;

View File

@@ -250,6 +250,8 @@ static const struct ec_sensor_info sensors_family_amd_600[] = {
EC_SENSOR("Water_In", hwmon_temp, 1, 0x01, 0x00),
[ec_sensor_temp_water_out] =
EC_SENSOR("Water_Out", hwmon_temp, 1, 0x01, 0x01),
[ec_sensor_fan_cpu_opt] =
EC_SENSOR("CPU_Opt", hwmon_fan, 2, 0x00, 0xb0),
};
static const struct ec_sensor_info sensors_family_intel_300[] = {
@@ -477,6 +479,15 @@ static const struct ec_board_info board_info_zenith_ii_extreme = {
.family = family_amd_500_series,
};
static const struct ec_board_info board_info_tuf_gaming_x670e_plus = {
.sensors = SENSOR_TEMP_CPU | SENSOR_TEMP_CPU_PACKAGE |
SENSOR_TEMP_MB | SENSOR_TEMP_VRM |
SENSOR_TEMP_WATER_IN | SENSOR_TEMP_WATER_OUT |
SENSOR_FAN_CPU_OPT,
.mutex_path = ACPI_GLOBAL_LOCK_PSEUDO_PATH,
.family = family_amd_600_series,
};
#define DMI_EXACT_MATCH_ASUS_BOARD_NAME(name, board_info) \
{ \
.matches = { \
@@ -538,6 +549,8 @@ static const struct dmi_system_id dmi_table[] = {
&board_info_zenith_ii_extreme),
DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG ZENITH II EXTREME ALPHA",
&board_info_zenith_ii_extreme),
DMI_EXACT_MATCH_ASUS_BOARD_NAME("TUF GAMING X670E-PLUS",
&board_info_tuf_gaming_x670e_plus),
{},
};

View File

@@ -17,6 +17,7 @@
#include <linux/jiffies.h>
#include <linux/err.h>
#include <linux/acpi.h>
#include <linux/string_choices.h>
#define ATK_HID "ATK0110"
@@ -441,7 +442,7 @@ static void atk_print_sensor(struct atk_data *data, union acpi_object *obj)
flags->integer.value,
name->string.pointer,
limit1->integer.value, limit2->integer.value,
enable->integer.value ? "enabled" : "disabled");
str_enabled_disabled(enable->integer.value));
#endif
}
@@ -1074,8 +1075,7 @@ static int atk_ec_enabled(struct atk_data *data)
err = -EIO;
} else {
err = (buf->value != 0);
dev_dbg(dev, "EC is %sabled\n",
err ? "en" : "dis");
dev_dbg(dev, "EC is %s\n", str_enabled_disabled(err));
}
ACPI_FREE(obj);
@@ -1096,18 +1096,15 @@ static int atk_ec_ctl(struct atk_data *data, int enable)
obj = atk_sitm(data, &sitm);
if (IS_ERR(obj)) {
dev_err(dev, "Failed to %sable the EC\n",
enable ? "en" : "dis");
dev_err(dev, "Failed to %s the EC\n", str_enable_disable(enable));
return PTR_ERR(obj);
}
ec_ret = (struct atk_acpi_ret_buffer *)obj->buffer.pointer;
if (ec_ret->flags == 0) {
dev_err(dev, "Failed to %sable the EC\n",
enable ? "en" : "dis");
dev_err(dev, "Failed to %s the EC\n", str_enable_disable(enable));
err = -EIO;
} else {
dev_info(dev, "EC %sabled\n",
enable ? "en" : "dis");
dev_info(dev, "EC %s\n", str_enabled_disabled(enable));
}
ACPI_FREE(obj);

View File

@@ -13,6 +13,7 @@
#include <linux/bitfield.h>
#include <linux/bits.h>
#include <linux/cleanup.h>
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/hwmon.h>
@@ -556,55 +557,40 @@ static int cc2_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
int channel, long *val)
{
struct cc2_data *data = dev_get_drvdata(dev);
int ret = 0;
mutex_lock(&data->dev_access_lock);
guard(mutex)(&data->dev_access_lock);
switch (type) {
case hwmon_temp:
ret = cc2_measurement(data, type, val);
break;
return cc2_measurement(data, type, val);
case hwmon_humidity:
switch (attr) {
case hwmon_humidity_input:
ret = cc2_measurement(data, type, val);
break;
return cc2_measurement(data, type, val);
case hwmon_humidity_min:
ret = cc2_get_reg_val(data, CC2_R_ALARM_L_ON, val);
break;
return cc2_get_reg_val(data, CC2_R_ALARM_L_ON, val);
case hwmon_humidity_min_hyst:
ret = cc2_get_reg_val(data, CC2_R_ALARM_L_OFF, val);
break;
return cc2_get_reg_val(data, CC2_R_ALARM_L_OFF, val);
case hwmon_humidity_max:
ret = cc2_get_reg_val(data, CC2_R_ALARM_H_ON, val);
break;
return cc2_get_reg_val(data, CC2_R_ALARM_H_ON, val);
case hwmon_humidity_max_hyst:
ret = cc2_get_reg_val(data, CC2_R_ALARM_H_OFF, val);
break;
return cc2_get_reg_val(data, CC2_R_ALARM_H_OFF, val);
case hwmon_humidity_min_alarm:
ret = cc2_humidity_min_alarm_status(data, val);
break;
return cc2_humidity_min_alarm_status(data, val);
case hwmon_humidity_max_alarm:
ret = cc2_humidity_max_alarm_status(data, val);
break;
return cc2_humidity_max_alarm_status(data, val);
default:
ret = -EOPNOTSUPP;
return -EOPNOTSUPP;
}
break;
default:
ret = -EOPNOTSUPP;
return -EOPNOTSUPP;
}
mutex_unlock(&data->dev_access_lock);
return ret;
}
static int cc2_write(struct device *dev, enum hwmon_sensor_types type, u32 attr,
int channel, long val)
{
struct cc2_data *data = dev_get_drvdata(dev);
int ret;
u16 arg;
u8 cmd;
@@ -614,41 +600,28 @@ static int cc2_write(struct device *dev, enum hwmon_sensor_types type, u32 attr,
if (val < 0 || val > CC2_RH_MAX)
return -EINVAL;
mutex_lock(&data->dev_access_lock);
guard(mutex)(&data->dev_access_lock);
switch (attr) {
case hwmon_humidity_min:
cmd = CC2_W_ALARM_L_ON;
arg = cc2_rh_to_reg(val);
ret = cc2_write_reg(data, cmd, arg);
break;
return cc2_write_reg(data, cmd, arg);
case hwmon_humidity_min_hyst:
cmd = CC2_W_ALARM_L_OFF;
arg = cc2_rh_to_reg(val);
ret = cc2_write_reg(data, cmd, arg);
break;
return cc2_write_reg(data, cmd, arg);
case hwmon_humidity_max:
cmd = CC2_W_ALARM_H_ON;
arg = cc2_rh_to_reg(val);
ret = cc2_write_reg(data, cmd, arg);
break;
return cc2_write_reg(data, cmd, arg);
case hwmon_humidity_max_hyst:
cmd = CC2_W_ALARM_H_OFF;
arg = cc2_rh_to_reg(val);
ret = cc2_write_reg(data, cmd, arg);
break;
return cc2_write_reg(data, cmd, arg);
default:
ret = -EOPNOTSUPP;
break;
return -EOPNOTSUPP;
}
mutex_unlock(&data->dev_access_lock);
return ret;
}
static int cc2_request_ready_irq(struct cc2_data *data, struct device *dev)

Some files were not shown because too many files have changed in this diff Show More