Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

Pull hwmon updates from Guenter Roeck:
"Updated chip support in existing drivers:

- ina238: Support for INA228

- pmbus/tps53679: Support for TPS53685

- pmbus/adp1050: Support for adp1051, adp1055 and ltp8800

- corsair-psu: Support for HX1200i Series 2025

- pmbus/isl68137: Support for RAA229621

- asus-ec-sensors: Support for ProArt X870E-CREATOR WIFI and

Other notable changes:

- adt7475: Support for #pwm-cells = <3>

- amc6821: Cooling device support

- emc2305: Support for PWM frequency, polarity and output

- Add missing compatible entries to various devicetree bindings

And various other minor fixes and improvements"

* tag 'hwmon-for-v6.17' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (34 commits)
dt-bindings: hwmon: Replace bouncing Alexandru Tachici emails
hwmon: (ina238) Add support for INA228
dt-bindings: Add INA228 to ina2xx devicetree bindings
hwmon: (ina238) Fix inconsistent whitespace
dt-bindings: hwmon: adt7475: Allow and recommend #pwm-cells = <3>
hwmon: (adt7475) Implement support for #pwm-cells = <3>
hwmon: (pmbus/tps53679) Add support for TPS53685
dt-bindings: trivial: Add tps53685 support
hwmon: (pmbus/adp1050) Add regulator support for ltp8800
hwmon: (pmbus/adp1050) Add support for adp1051, adp1055 and ltp8800
dt-bindings: hwmon: pmbus/adp1050: Add adp1051, adp1055 and ltp8800
hwmon: (max31827) use sysfs_emit() in temp1_resolution_show()
hwmon: (ltc4282) convert from round_rate() to determine_rate()
hwmon: (corsair-psu) add support for HX1200i Series 2025
dt-bindings: hwmon: pmbus: ti,ucd90320: Add missing compatibles
dt-bindings: hwmon: maxim,max20730: Add maxim,max20710 compatible
dt-bindings: hwmon: lltc,ltc2978: Add lltc,ltc713 compatible
dt-bindings: hwmon: ti,lm87: Add adi,adm1024 compatible
dt-bindings: hwmon: national,lm90: Add missing Dallas max6654 and onsemi nct72, nct214, and nct218
hwmon: (w83627ehf) make the read-only arrays 'bit' static const
...

+743 -114
+1 -1
Documentation/devicetree/bindings/hwmon/adi,adm1266.yaml
··· 8 8 Control and Fault Recording 9 9 10 10 maintainers: 11 - - Alexandru Tachici <alexandru.tachici@analog.com> 11 + - Cedric Encarnacion <cedricjustine.encarnacion@analog.com> 12 12 13 13 description: | 14 14 Analog Devices ADM1266 Cascadable Super Sequencer with Margin
+1 -1
Documentation/devicetree/bindings/hwmon/adi,ltc2992.yaml
··· 7 7 title: Linear Technology 2992 Power Monitor 8 8 9 9 maintainers: 10 - - Alexandru Tachici <alexandru.tachici@analog.com> 10 + - Cedric Encarnacion <cedricjustine.encarnacion@analog.com> 11 11 12 12 description: | 13 13 Linear Technology 2992 Dual Wide Range Power Monitor
+9 -6
Documentation/devicetree/bindings/hwmon/adt7475.yaml
··· 53 53 default: 1 54 54 55 55 "#pwm-cells": 56 - const: 4 56 + oneOf: 57 + - const: 3 58 + - const: 4 59 + deprecated: true 57 60 description: | 58 61 Number of cells in a PWM specifier. 59 62 - 0: The PWM channel ··· 71 68 - 11363636 (88 Hz) 72 69 - 44444 (22 kHz) 73 70 - 2: PWM flags 0 or PWM_POLARITY_INVERTED 74 - - 3: The default PWM duty cycle in nanoseconds 71 + - 3: The default PWM duty cycle in nanoseconds, defaults to period. 75 72 76 73 patternProperties: 77 74 "^adi,bypass-attenuator-in[0-4]$": ··· 127 124 adi,bypass-attenuator-in1 = <0>; 128 125 adi,pin10-function = "smbalert#"; 129 126 adi,pin14-function = "tach4"; 130 - #pwm-cells = <4>; 127 + #pwm-cells = <3>; 131 128 132 - /* PWMs at 22.5 kHz frequency, 50% duty*/ 129 + /* PWMs at 22.5 kHz frequency */ 133 130 fan-0 { 134 - pwms = <&pwm 0 44444 0 22222>; 131 + pwms = <&pwm 0 44444 0>; 135 132 }; 136 133 137 134 fan-1 { 138 - pwms = <&pwm 2 44444 0 22222>; 135 + pwms = <&pwm 2 44444 0>; 139 136 }; 140 137 }; 141 138 };
+2
Documentation/devicetree/bindings/hwmon/lltc,ltc2978.yaml
··· 28 28 - lltc,ltc3886 29 29 - lltc,ltc3887 30 30 - lltc,ltc3889 31 + - lltc,ltc7132 31 32 - lltc,ltc7841 32 33 - lltc,ltc7880 33 34 - lltc,ltm2987 ··· 56 55 * ltc2977, ltc2979, ltc2980, ltm2987 : vout0 - vout7 57 56 * ltc2978 : vout0 - vout7 58 57 * ltc3880, ltc3882, ltc3884, ltc3886, ltc3887, ltc3889 : vout0 - vout1 58 + * ltc7132 : vout0 - vout1 59 59 * ltc7841 : vout0 60 60 * ltc7880 : vout0 - vout1 61 61 * ltc3883 : vout0
+1
Documentation/devicetree/bindings/hwmon/maxim,max20730.yaml
··· 25 25 properties: 26 26 compatible: 27 27 enum: 28 + - maxim,max20710 28 29 - maxim,max20730 29 30 - maxim,max20734 30 31 - maxim,max20743
+8
Documentation/devicetree/bindings/hwmon/national,lm90.yaml
··· 20 20 - dallas,max6646 21 21 - dallas,max6647 22 22 - dallas,max6649 23 + - dallas,max6654 23 24 - dallas,max6657 24 25 - dallas,max6658 25 26 - dallas,max6659 ··· 37 36 - nuvoton,nct7717 38 37 - nuvoton,nct7718 39 38 - nxp,sa56004 39 + - onnn,nct72 40 + - onnn,nct214 41 + - onnn,nct218 40 42 - onnn,nct1008 41 43 - ti,tmp451 42 44 - ti,tmp461 ··· 122 118 - dallas,max6646 123 119 - dallas,max6647 124 120 - dallas,max6649 121 + - dallas,max6654 125 122 - dallas,max6657 126 123 - dallas,max6658 127 124 - dallas,max6659 ··· 144 139 - adi,adt7461 145 140 - adi,adt7461a 146 141 - adi,adt7481 142 + - onnn,nct72 143 + - onnn,nct214 144 + - onnn,nct218 147 145 - onnn,nct1008 148 146 then: 149 147 patternProperties:
+13 -2
Documentation/devicetree/bindings/hwmon/pmbus/adi,adp1050.yaml
··· 10 10 - Radu Sabau <radu.sabau@analog.com> 11 11 12 12 description: | 13 - The ADP1050 is used to monitor system voltages, currents and temperatures. 13 + The ADP1050 and similar devices are used to monitor system voltages, 14 + currents, power, and temperatures. 15 + 14 16 Through the PMBus interface, the ADP1050 targets isolated power supplies 15 17 and has four individual monitors for input/output voltage, input current 16 18 and temperature. 17 19 Datasheet: 18 20 https://www.analog.com/en/products/adp1050.html 21 + https://www.analog.com/en/products/adp1051.html 22 + https://www.analog.com/en/products/adp1055.html 23 + https://www.analog.com/en/products/ltp8800-1a.html 24 + https://www.analog.com/en/products/ltp8800-2.html 25 + https://www.analog.com/en/products/ltp8800-4a.html 19 26 20 27 properties: 21 28 compatible: 22 - const: adi,adp1050 29 + enum: 30 + - adi,adp1050 31 + - adi,adp1051 32 + - adi,adp1055 33 + - adi,ltp8800 23 34 24 35 reg: 25 36 maxItems: 1
+1
Documentation/devicetree/bindings/hwmon/pmbus/isil,isl68137.yaml
··· 56 56 - renesas,raa228228 57 57 - renesas,raa229001 58 58 - renesas,raa229004 59 + - renesas,raa229621 59 60 60 61 reg: 61 62 maxItems: 1
+6
Documentation/devicetree/bindings/hwmon/pmbus/ti,ucd90320.yaml
··· 23 23 properties: 24 24 compatible: 25 25 enum: 26 + - ti,ucd9000 27 + - ti,ucd9090 28 + - ti,ucd90120 29 + - ti,ucd90124 30 + - ti,ucd90160 26 31 - ti,ucd90320 32 + - ti,ucd90910 27 33 28 34 reg: 29 35 maxItems: 1
+6
Documentation/devicetree/bindings/hwmon/ti,amc6821.yaml
··· 32 32 $ref: fan-common.yaml# 33 33 unevaluatedProperties: false 34 34 35 + properties: 36 + cooling-levels: 37 + description: PWM duty cycle values corresponding to thermal cooling states. 38 + items: 39 + maximum: 255 40 + 35 41 "#pwm-cells": 36 42 const: 2 37 43 description: |
+2
Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml
··· 25 25 - ti,ina219 26 26 - ti,ina220 27 27 - ti,ina226 28 + - ti,ina228 28 29 - ti,ina230 29 30 - ti,ina231 30 31 - ti,ina233 ··· 108 107 - ti,ina219 109 108 - ti,ina220 110 109 - ti,ina226 110 + - ti,ina228 111 111 - ti,ina230 112 112 - ti,ina231 113 113 - ti,ina237
+3 -1
Documentation/devicetree/bindings/hwmon/ti,lm87.yaml
··· 18 18 19 19 properties: 20 20 compatible: 21 - const: ti,lm87 21 + enum: 22 + - adi,adm1024 23 + - ti,lm87 22 24 23 25 reg: 24 26 maxItems: 1
+2
Documentation/devicetree/bindings/trivial-devices.yaml
··· 450 450 - ti,tps53679 451 451 # TI Dual channel DCAP+ multiphase controller TPS53681 452 452 - ti,tps53681 453 + # TI Dual channel DCAP+ multiphase controller TPS53685 with AMD-SVI3 454 + - ti,tps53685 453 455 # TI Dual channel DCAP+ multiphase controller TPS53688 454 456 - ti,tps53688 455 457 # TI DC-DC converters on PMBus
+65 -6
Documentation/hwmon/adp1050.rst
··· 13 13 14 14 Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADP1050.pdf 15 15 16 + * Analog Devices ADP1051 17 + 18 + Prefix: 'adp1051' 19 + 20 + Addresses scanned: I2C 0x70 - 0x77 21 + 22 + Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADP1051.pdf 23 + 24 + * Analog Devices ADP1055 25 + 26 + Prefix: 'adp1055' 27 + 28 + Addresses scanned: I2C 0x4B - 0x77 29 + 30 + Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADP1055.pdf 31 + 32 + * Analog Devices LTP8800-1A/-2/-4A 33 + 34 + Prefix: 'ltp8800' 35 + 36 + Addresses scanned: - 37 + 38 + Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/LTP8800-1A.pdf 39 + https://www.analog.com/media/en/technical-documentation/data-sheets/LTP8800-2.pdf 40 + https://www.analog.com/media/en/technical-documentation/data-sheets/LTP8800-4A.pdf 41 + 16 42 Authors: 17 43 18 44 - Radu Sabau <radu.sabau@analog.com> ··· 47 21 Description 48 22 ----------- 49 23 50 - This driver supprts hardware monitoring for Analog Devices ADP1050 Digital 51 - Controller for Isolated Power Supply with PMBus interface. 24 + This driver supports hardware monitoring for Analog Devices ADP1050, ADP1051, 25 + and ADP1055 Digital Controller for Isolated Power Supply with PMBus interface, 26 + and the LTP8800 step-down μModule regulators. 52 27 53 - The ADP1050 is an advanced digital controller with a PMBus™ 28 + The ADP1050, ADP1051, and ADP1055 are advanced digital controllers with PMBus™ 54 29 interface targeting high density, high efficiency dc-to-dc power 55 - conversion used to monitor system temperatures, voltages and currents. 56 - Through the PMBus interface, the device can monitor input/output voltages, 57 - input current and temperature. 30 + conversion used to monitor system temperatures, voltages and currents. The 31 + LTP8800 is a family of step-down μModule regulators that provides microprocessor 32 + core voltage from 54V power distribution architecture. Through the PMBus 33 + interface, the device can monitor input/output voltages, input current and 34 + temperature. 58 35 59 36 Usage Notes 60 37 ----------- ··· 78 49 in1_label "vin" 79 50 in1_input Measured input voltage 80 51 in1_alarm Input voltage alarm 52 + in1_crit Critical maximum input voltage 53 + in1_crit_alarm Input voltage high alarm 54 + in1_lcrit Critical minimum input voltage 55 + in1_lcrit_alarm Input voltage critical low alarm 81 56 in2_label "vout1" 82 57 in2_input Measured output voltage 83 58 in2_crit Critical maximum output voltage 84 59 in2_crit_alarm Output voltage high alarm 85 60 in2_lcrit Critical minimum output voltage 86 61 in2_lcrit_alarm Output voltage critical low alarm 62 + in2_max Critical maximum output voltage 63 + in2_max_alarm Output voltage critical max alarm 64 + in2_min Critical minimum output voltage 65 + in2_min_alarm Output voltage critical min alarm 87 66 curr1_label "iin" 88 67 curr1_input Measured input current. 89 68 curr1_alarm Input current alarm 69 + curr1_crit Critical maximum input current 70 + curr1_crit_alarm Input current high alarm 71 + curr2_label "iout1" 72 + curr2_input Measured output current 73 + curr2_alarm Output current alarm 74 + curr2_crit Critical maximum output current 75 + curr2_crit_alarm Output current high alarm 76 + curr2_lcrit Critical minimum output current 77 + curr2_lcrit_alarm Output current critical low alarm 78 + curr2_max Critical maximum output current 79 + curr2_max_alarm Output current critical max alarm 80 + power1_label "pout1" 81 + power1_input Measured output power 82 + power1_crit Critical maximum output power 83 + power1_crit_alarm Output power high alarm 90 84 temp1_input Measured temperature 91 85 temp1_crit Critical high temperature 92 86 temp1_crit_alarm Chip temperature critical high alarm 87 + temp1_max Critical maximum temperature 88 + temp1_max_alarm Temperature critical max alarm 89 + temp2_input Measured temperature 90 + temp2_crit Critical high temperature 91 + temp2_crit_alarm Chip temperature critical high alarm 92 + temp2_max Critical maximum temperature 93 + temp2_max_alarm Temperature critical max alarm 93 94 ================= ========================================
+2
Documentation/hwmon/asus_ec_sensors.rst
··· 11 11 * Pro WS X570-ACE 12 12 * ProArt X570-CREATOR WIFI 13 13 * ProArt X670E-CREATOR WIFI 14 + * ProArt X870E-CREATOR WIFI 14 15 * ProArt B550-CREATOR 15 16 * ROG CROSSHAIR VIII DARK HERO 16 17 * ROG CROSSHAIR VIII HERO (WI-FI) ··· 30 29 * ROG STRIX X570-F GAMING 31 30 * ROG STRIX X570-I GAMING 32 31 * ROG STRIX Z390-F GAMING 32 + * ROG STRIX Z490-F GAMING 33 33 * ROG STRIX Z690-A GAMING WIFI D4 34 34 * ROG ZENITH II EXTREME 35 35 * ROG ZENITH II EXTREME ALPHA
+1 -1
Documentation/hwmon/corsair-psu.rst
··· 17 17 18 18 Corsair HX1000i (Legacy and Series 2023) 19 19 20 - Corsair HX1200i (Legacy and Series 2023) 20 + Corsair HX1200i (Legacy, Series 2023 and Series 2025) 21 21 22 22 Corsair HX1500i (Legacy and Series 2023) 23 23
+8
Documentation/hwmon/tps53679.rst
··· 43 43 44 44 Datasheet: https://www.ti.com/lit/gpn/TPS53681 45 45 46 + * Texas Instruments TPS53685 47 + 48 + Prefix: 'tps53685' 49 + 50 + Addresses scanned: - 51 + 52 + Datasheet: https://www.ti.com/lit/gpn/TPS53685 53 + 46 54 * Texas Instruments TPS53688 47 55 48 56 Prefix: 'tps53688'
+17 -3
drivers/hwmon/adt7475.c
··· 1704 1704 if (ret) 1705 1705 return ret; 1706 1706 1707 - if (rargs.nargs != 4) { 1707 + if (rargs.nargs != 3 && rargs.nargs != 4) { 1708 1708 fwnode_handle_put(rargs.fwnode); 1709 1709 return -EINVAL; 1710 1710 } 1711 1711 1712 - for (i = 0; i < 4; i++) 1712 + /* Let duty_cycle default to period */ 1713 + args[3] = rargs.args[1]; 1714 + 1715 + for (i = 0; i < rargs.nargs; i++) 1713 1716 args[i] = rargs.args[i]; 1714 1717 1715 1718 ret = _adt7475_pwm_properties_parse_args(args, cfg); ··· 1727 1724 { 1728 1725 int ret; 1729 1726 u32 args[4] = {}; 1727 + size_t n_vals = fwnode_property_count_u32(fwnode, "pwms"); 1730 1728 1731 - ret = fwnode_property_read_u32_array(fwnode, "pwms", args, ARRAY_SIZE(args)); 1729 + if (n_vals != 3 && n_vals != 4) 1730 + return -EOVERFLOW; 1731 + 1732 + ret = fwnode_property_read_u32_array(fwnode, "pwms", args, n_vals); 1732 1733 if (ret) 1733 1734 return ret; 1735 + 1736 + /* 1737 + * If there are no item to define the duty_cycle, default it to the 1738 + * period. 1739 + */ 1740 + if (n_vals == 3) 1741 + args[3] = args[1]; 1734 1742 1735 1743 return _adt7475_pwm_properties_parse_args(args, cfg); 1736 1744 }
+118 -9
drivers/hwmon/amc6821.c
··· 26 26 #include <linux/pwm.h> 27 27 #include <linux/regmap.h> 28 28 #include <linux/slab.h> 29 + #include <linux/thermal.h> 29 30 30 31 #include <dt-bindings/pwm/pwm.h> 31 32 ··· 127 126 struct amc6821_data { 128 127 struct regmap *regmap; 129 128 struct mutex update_lock; 129 + unsigned long fan_state; 130 + unsigned long fan_max_state; 131 + unsigned int *fan_cooling_levels; 132 + enum pwm_polarity pwm_polarity; 130 133 }; 131 134 132 135 /* ··· 809 804 .info = amc6821_info, 810 805 }; 811 806 807 + static int amc6821_set_sw_dcy(struct amc6821_data *data, u8 duty_cycle) 808 + { 809 + int ret; 810 + 811 + ret = regmap_write(data->regmap, AMC6821_REG_DCY, duty_cycle); 812 + if (ret) 813 + return ret; 814 + 815 + return regmap_update_bits(data->regmap, AMC6821_REG_CONF1, 816 + AMC6821_CONF1_FDRC0 | AMC6821_CONF1_FDRC1, 0); 817 + } 818 + 819 + static int amc6821_get_max_state(struct thermal_cooling_device *cdev, unsigned long *state) 820 + { 821 + struct amc6821_data *data = cdev->devdata; 822 + 823 + if (!data) 824 + return -EINVAL; 825 + 826 + *state = data->fan_max_state; 827 + 828 + return 0; 829 + } 830 + 831 + static int amc6821_get_cur_state(struct thermal_cooling_device *cdev, unsigned long *state) 832 + { 833 + struct amc6821_data *data = cdev->devdata; 834 + 835 + if (!data) 836 + return -EINVAL; 837 + 838 + *state = data->fan_state; 839 + 840 + return 0; 841 + } 842 + 843 + static int amc6821_set_cur_state(struct thermal_cooling_device *cdev, unsigned long state) 844 + { 845 + struct amc6821_data *data = cdev->devdata; 846 + int ret; 847 + 848 + if (!data || state > data->fan_max_state) 849 + return -EINVAL; 850 + 851 + ret = amc6821_set_sw_dcy(data, data->fan_cooling_levels[state]); 852 + if (ret) 853 + return ret; 854 + 855 + data->fan_state = state; 856 + 857 + return 0; 858 + } 859 + 860 + static const struct thermal_cooling_device_ops amc6821_cooling_ops = { 861 + .get_max_state = amc6821_get_max_state, 862 + .get_cur_state = amc6821_get_cur_state, 863 + .set_cur_state = amc6821_set_cur_state, 864 + }; 865 + 812 866 /* Return 0 if detection is successful, -ENODEV otherwise */ 813 867 static int amc6821_detect(struct i2c_client *client, struct i2c_board_info *info) 814 868 { ··· 912 848 return 0; 913 849 } 914 850 915 - static enum pwm_polarity amc6821_pwm_polarity(struct i2c_client *client) 851 + static enum pwm_polarity amc6821_pwm_polarity(struct i2c_client *client, 852 + struct device_node *fan_np) 916 853 { 917 854 enum pwm_polarity polarity = PWM_POLARITY_NORMAL; 918 855 struct of_phandle_args args; 919 - struct device_node *fan_np; 920 856 921 857 /* 922 858 * For backward compatibility, the pwminv module parameter takes ··· 926 862 return PWM_POLARITY_NORMAL; 927 863 if (pwminv > 0) 928 864 return PWM_POLARITY_INVERSED; 929 - 930 - fan_np = of_get_child_by_name(client->dev.of_node, "fan"); 931 - if (!fan_np) 932 - return PWM_POLARITY_NORMAL; 933 865 934 866 if (of_parse_phandle_with_args(fan_np, "pwms", "#pwm-cells", 0, &args)) 935 867 goto out; ··· 937 877 if (args.args[1] & PWM_POLARITY_INVERTED) 938 878 polarity = PWM_POLARITY_INVERSED; 939 879 out: 940 - of_node_put(fan_np); 941 880 return polarity; 881 + } 882 + 883 + static int amc6821_of_fan_read_data(struct i2c_client *client, 884 + struct amc6821_data *data, 885 + struct device_node *fan_np) 886 + { 887 + int num; 888 + 889 + data->pwm_polarity = amc6821_pwm_polarity(client, fan_np); 890 + 891 + num = of_property_count_u32_elems(fan_np, "cooling-levels"); 892 + if (num <= 0) 893 + return 0; 894 + 895 + data->fan_max_state = num - 1; 896 + 897 + data->fan_cooling_levels = devm_kcalloc(&client->dev, num, 898 + sizeof(u32), 899 + GFP_KERNEL); 900 + 901 + if (!data->fan_cooling_levels) 902 + return -ENOMEM; 903 + 904 + return of_property_read_u32_array(fan_np, "cooling-levels", 905 + data->fan_cooling_levels, num); 942 906 } 943 907 944 908 static int amc6821_init_client(struct i2c_client *client, struct amc6821_data *data) ··· 986 902 return err; 987 903 988 904 regval = AMC6821_CONF1_START; 989 - if (amc6821_pwm_polarity(client) == PWM_POLARITY_INVERSED) 905 + if (data->pwm_polarity == PWM_POLARITY_INVERSED) 990 906 regval |= AMC6821_CONF1_PWMINV; 991 907 992 908 err = regmap_update_bits(regmap, AMC6821_REG_CONF1, ··· 995 911 regval); 996 912 if (err) 997 913 return err; 914 + 915 + /* Software DCY-control mode with fan enabled when cooling-levels present */ 916 + if (data->fan_cooling_levels) { 917 + err = amc6821_set_sw_dcy(data, 918 + data->fan_cooling_levels[data->fan_max_state]); 919 + if (err) 920 + return err; 921 + } 998 922 } 999 923 return 0; 1000 924 } ··· 1036 944 struct amc6821_data *data; 1037 945 struct device *hwmon_dev; 1038 946 struct regmap *regmap; 947 + struct device_node *fan_np __free(device_node) = NULL; 1039 948 int err; 1040 949 1041 950 data = devm_kzalloc(dev, sizeof(struct amc6821_data), GFP_KERNEL); ··· 1048 955 return dev_err_probe(dev, PTR_ERR(regmap), 1049 956 "Failed to initialize regmap\n"); 1050 957 data->regmap = regmap; 958 + 959 + fan_np = of_get_child_by_name(dev->of_node, "fan"); 960 + if (fan_np) { 961 + err = amc6821_of_fan_read_data(client, data, fan_np); 962 + if (err) 963 + return dev_err_probe(dev, err, 964 + "Failed to read fan device tree data\n"); 965 + } 1051 966 1052 967 err = amc6821_init_client(client, data); 1053 968 if (err) ··· 1071 970 hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name, 1072 971 data, &amc6821_chip_info, 1073 972 amc6821_groups); 1074 - return PTR_ERR_OR_ZERO(hwmon_dev); 973 + if (IS_ERR(hwmon_dev)) 974 + return dev_err_probe(dev, PTR_ERR(hwmon_dev), 975 + "Failed to initialize hwmon\n"); 976 + 977 + if (IS_ENABLED(CONFIG_THERMAL) && fan_np && data->fan_cooling_levels) 978 + return PTR_ERR_OR_ZERO(devm_thermal_of_cooling_device_register(dev, 979 + fan_np, client->name, data, &amc6821_cooling_ops)); 980 + 981 + return 0; 1075 982 } 1076 983 1077 984 static const struct i2c_device_id amc6821_id[] = {
+60
drivers/hwmon/asus-ec-sensors.c
··· 165 165 family_amd_400_series, 166 166 family_amd_500_series, 167 167 family_amd_600_series, 168 + family_amd_800_series, 168 169 family_intel_300_series, 170 + family_intel_400_series, 169 171 family_intel_600_series 170 172 }; 171 173 ··· 261 259 EC_SENSOR("Water_Out", hwmon_temp, 1, 0x01, 0x01), 262 260 }; 263 261 262 + static const struct ec_sensor_info sensors_family_amd_800[] = { 263 + [ec_sensor_temp_cpu] = EC_SENSOR("CPU", hwmon_temp, 1, 0x00, 0x30), 264 + [ec_sensor_temp_cpu_package] = 265 + EC_SENSOR("CPU Package", hwmon_temp, 1, 0x00, 0x31), 266 + [ec_sensor_temp_mb] = 267 + EC_SENSOR("Motherboard", hwmon_temp, 1, 0x00, 0x32), 268 + [ec_sensor_temp_vrm] = 269 + EC_SENSOR("VRM", hwmon_temp, 1, 0x00, 0x33), 270 + [ec_sensor_temp_t_sensor] = 271 + EC_SENSOR("T_Sensor", hwmon_temp, 1, 0x00, 0x36), 272 + [ec_sensor_fan_cpu_opt] = 273 + EC_SENSOR("CPU_Opt", hwmon_fan, 2, 0x00, 0xb0), 274 + }; 275 + 264 276 static const struct ec_sensor_info sensors_family_intel_300[] = { 265 277 [ec_sensor_temp_chipset] = 266 278 EC_SENSOR("Chipset", hwmon_temp, 1, 0x00, 0x3a), ··· 293 277 EC_SENSOR("Water_In", hwmon_temp, 1, 0x01, 0x00), 294 278 [ec_sensor_temp_water_out] = 295 279 EC_SENSOR("Water_Out", hwmon_temp, 1, 0x01, 0x01), 280 + }; 281 + 282 + static const struct ec_sensor_info sensors_family_intel_400[] = { 283 + [ec_sensor_temp_chipset] = 284 + EC_SENSOR("Chipset", hwmon_temp, 1, 0x00, 0x3a), 285 + [ec_sensor_temp_cpu] = EC_SENSOR("CPU", hwmon_temp, 1, 0x00, 0x3b), 286 + [ec_sensor_temp_mb] = 287 + EC_SENSOR("Motherboard", hwmon_temp, 1, 0x00, 0x3c), 288 + [ec_sensor_temp_t_sensor] = 289 + EC_SENSOR("T_Sensor", hwmon_temp, 1, 0x00, 0x3d), 290 + [ec_sensor_temp_vrm] = EC_SENSOR("VRM", hwmon_temp, 1, 0x00, 0x3e), 291 + [ec_sensor_fan_cpu_opt] = 292 + EC_SENSOR("CPU_Opt", hwmon_fan, 2, 0x00, 0xb0), 293 + [ec_sensor_fan_vrm_hs] = EC_SENSOR("VRM HS", hwmon_fan, 2, 0x00, 0xb2), 296 294 }; 297 295 298 296 static const struct ec_sensor_info sensors_family_intel_600[] = { ··· 390 360 SENSOR_TEMP_T_SENSOR, 391 361 .mutex_path = ACPI_GLOBAL_LOCK_PSEUDO_PATH, 392 362 .family = family_amd_600_series, 363 + }; 364 + 365 + static const struct ec_board_info board_info_pro_art_x870E_creator_wifi = { 366 + .sensors = SENSOR_TEMP_CPU | SENSOR_TEMP_CPU_PACKAGE | 367 + SENSOR_TEMP_MB | SENSOR_TEMP_VRM | 368 + SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CPU_OPT, 369 + .mutex_path = ACPI_GLOBAL_LOCK_PSEUDO_PATH, 370 + .family = family_amd_800_series, 393 371 }; 394 372 395 373 static const struct ec_board_info board_info_pro_art_b550_creator = { ··· 536 498 .family = family_intel_300_series, 537 499 }; 538 500 501 + static const struct ec_board_info board_info_strix_z490_f_gaming = { 502 + .sensors = SENSOR_TEMP_CHIPSET | 503 + SENSOR_TEMP_CPU | 504 + SENSOR_TEMP_MB | 505 + SENSOR_TEMP_T_SENSOR | 506 + SENSOR_TEMP_VRM | 507 + SENSOR_FAN_CPU_OPT | 508 + SENSOR_FAN_VRM_HS, 509 + .mutex_path = ASUS_HW_ACCESS_MUTEX_ASMX, 510 + .family = family_intel_400_series, 511 + }; 512 + 539 513 static const struct ec_board_info board_info_strix_z690_a_gaming_wifi_d4 = { 540 514 .sensors = SENSOR_TEMP_T_SENSOR | SENSOR_TEMP_VRM, 541 515 .mutex_path = ASUS_HW_ACCESS_MUTEX_RMTW_ASMX, ··· 598 548 &board_info_pro_art_x570_creator_wifi), 599 549 DMI_EXACT_MATCH_ASUS_BOARD_NAME("ProArt X670E-CREATOR WIFI", 600 550 &board_info_pro_art_x670E_creator_wifi), 551 + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ProArt X870E-CREATOR WIFI", 552 + &board_info_pro_art_x870E_creator_wifi), 601 553 DMI_EXACT_MATCH_ASUS_BOARD_NAME("ProArt B550-CREATOR", 602 554 &board_info_pro_art_b550_creator), 603 555 DMI_EXACT_MATCH_ASUS_BOARD_NAME("Pro WS X570-ACE", ··· 638 586 &board_info_strix_x570_i_gaming), 639 587 DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX Z390-F GAMING", 640 588 &board_info_strix_z390_f_gaming), 589 + DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX Z490-F GAMING", 590 + &board_info_strix_z490_f_gaming), 641 591 DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG STRIX Z690-A GAMING WIFI D4", 642 592 &board_info_strix_z690_a_gaming_wifi_d4), 643 593 DMI_EXACT_MATCH_ASUS_BOARD_NAME("ROG ZENITH II EXTREME", ··· 1112 1058 case family_amd_600_series: 1113 1059 ec_data->sensors_info = sensors_family_amd_600; 1114 1060 break; 1061 + case family_amd_800_series: 1062 + ec_data->sensors_info = sensors_family_amd_800; 1063 + break; 1115 1064 case family_intel_300_series: 1116 1065 ec_data->sensors_info = sensors_family_intel_300; 1066 + break; 1067 + case family_intel_400_series: 1068 + ec_data->sensors_info = sensors_family_intel_400; 1117 1069 break; 1118 1070 case family_intel_600_series: 1119 1071 ec_data->sensors_info = sensors_family_intel_600;
+1
drivers/hwmon/corsair-psu.c
··· 885 885 { HID_USB_DEVICE(0x1b1c, 0x1c1e) }, /* Corsair HX1000i Series 2023 */ 886 886 { HID_USB_DEVICE(0x1b1c, 0x1c1f) }, /* Corsair HX1500i Legacy and Series 2023 */ 887 887 { HID_USB_DEVICE(0x1b1c, 0x1c23) }, /* Corsair HX1200i Series 2023 */ 888 + { HID_USB_DEVICE(0x1b1c, 0x1c27) }, /* Corsair HX1200i Series 2025 */ 888 889 { }, 889 890 }; 890 891 MODULE_DEVICE_TABLE(hid, corsairpsu_idtable);
+157 -24
drivers/hwmon/emc2305.c
··· 11 11 #include <linux/module.h> 12 12 #include <linux/platform_data/emc2305.h> 13 13 #include <linux/thermal.h> 14 + #include <linux/pwm.h> 15 + #include <linux/of_device.h> 16 + #include <linux/util_macros.h> 14 17 15 18 #define EMC2305_REG_DRIVE_FAIL_STATUS 0x27 16 19 #define EMC2305_REG_VENDOR 0xfe ··· 26 23 #define EMC2305_TACH_REGS_UNUSE_BITS 3 27 24 #define EMC2305_TACH_CNT_MULTIPLIER 0x02 28 25 #define EMC2305_TACH_RANGE_MIN 480 26 + #define EMC2305_DEFAULT_OUTPUT 0x0 27 + #define EMC2305_DEFAULT_POLARITY 0x0 28 + #define EMC2305_REG_POLARITY 0x2a 29 + #define EMC2305_REG_DRIVE_PWM_OUT 0x2b 30 + #define EMC2305_OPEN_DRAIN 0x0 31 + #define EMC2305_PUSH_PULL 0x1 29 32 30 33 #define EMC2305_PWM_DUTY2STATE(duty, max_state, pwm_max) \ 31 34 DIV_ROUND_CLOSEST((duty) * (max_state), (pwm_max)) ··· 47 38 #define EMC2305_REG_FAN_DRIVE(n) (0x30 + 0x10 * (n)) 48 39 #define EMC2305_REG_FAN_MIN_DRIVE(n) (0x38 + 0x10 * (n)) 49 40 #define EMC2305_REG_FAN_TACH(n) (0x3e + 0x10 * (n)) 41 + 42 + /* Supported base PWM frequencies */ 43 + static const unsigned int base_freq_table[] = { 2441, 4882, 19530, 26000 }; 50 44 51 45 enum emc230x_product_id { 52 46 EMC2305 = 0x34, ··· 101 89 * @hwmon_dev: hwmon device 102 90 * @max_state: maximum cooling state of the cooling device 103 91 * @pwm_num: number of PWM channels 92 + * @pwm_output_mask: PWM output mask 93 + * @pwm_polarity_mask: PWM polarity mask 104 94 * @pwm_separate: separate PWM settings for every channel 105 95 * @pwm_min: array of minimum PWM per channel 96 + * @pwm_freq: array of PWM frequency per channel 106 97 * @cdev_data: array of cooling devices data 107 98 */ 108 99 struct emc2305_data { ··· 113 98 struct device *hwmon_dev; 114 99 u8 max_state; 115 100 u8 pwm_num; 101 + u8 pwm_output_mask; 102 + u8 pwm_polarity_mask; 116 103 bool pwm_separate; 117 104 u8 pwm_min[EMC2305_PWM_MAX]; 105 + u16 pwm_freq[EMC2305_PWM_MAX]; 118 106 struct emc2305_cdev_data cdev_data[EMC2305_PWM_MAX]; 119 107 }; 120 108 ··· 299 281 return 0; 300 282 } 301 283 302 - static int emc2305_set_single_tz(struct device *dev, int idx) 284 + static int emc2305_set_single_tz(struct device *dev, struct device_node *fan_node, int idx) 303 285 { 304 286 struct emc2305_data *data = dev_get_drvdata(dev); 305 287 long pwm; ··· 309 291 pwm = data->pwm_min[cdev_idx]; 310 292 311 293 data->cdev_data[cdev_idx].cdev = 312 - devm_thermal_of_cooling_device_register(dev, dev->of_node, 294 + devm_thermal_of_cooling_device_register(dev, fan_node, 313 295 emc2305_fan_name[idx], data, 314 296 &emc2305_cooling_ops); 315 297 ··· 317 299 dev_err(dev, "Failed to register cooling device %s\n", emc2305_fan_name[idx]); 318 300 return PTR_ERR(data->cdev_data[cdev_idx].cdev); 319 301 } 302 + 303 + if (data->cdev_data[cdev_idx].cur_state > 0) 304 + /* Update pwm when temperature is above trips */ 305 + pwm = EMC2305_PWM_STATE2DUTY(data->cdev_data[cdev_idx].cur_state, 306 + data->max_state, EMC2305_FAN_MAX); 307 + 320 308 /* Set minimal PWM speed. */ 321 309 if (data->pwm_separate) { 322 310 ret = emc2305_set_pwm(dev, pwm, cdev_idx); ··· 336 312 } 337 313 } 338 314 data->cdev_data[cdev_idx].cur_state = 339 - EMC2305_PWM_DUTY2STATE(data->pwm_min[cdev_idx], data->max_state, 315 + EMC2305_PWM_DUTY2STATE(pwm, data->max_state, 340 316 EMC2305_FAN_MAX); 341 317 data->cdev_data[cdev_idx].last_hwmon_state = 342 - EMC2305_PWM_DUTY2STATE(data->pwm_min[cdev_idx], data->max_state, 318 + EMC2305_PWM_DUTY2STATE(pwm, data->max_state, 343 319 EMC2305_FAN_MAX); 344 320 return 0; 345 321 } ··· 350 326 int i, ret; 351 327 352 328 if (!data->pwm_separate) 353 - return emc2305_set_single_tz(dev, 0); 329 + return emc2305_set_single_tz(dev, dev->of_node, 0); 354 330 355 331 for (i = 0; i < data->pwm_num; i++) { 356 - ret = emc2305_set_single_tz(dev, i + 1); 332 + ret = emc2305_set_single_tz(dev, dev->of_node, i + 1); 357 333 if (ret) 358 334 return ret; 359 335 } ··· 535 511 return 0; 536 512 } 537 513 514 + static int emc2305_of_parse_pwm_child(struct device *dev, 515 + struct device_node *child, 516 + struct emc2305_data *data) 517 + { u32 ch; 518 + int ret; 519 + struct of_phandle_args args; 520 + 521 + ret = of_property_read_u32(child, "reg", &ch); 522 + if (ret) { 523 + dev_err(dev, "missing reg property of %pOFn\n", child); 524 + return ret; 525 + } 526 + 527 + ret = of_parse_phandle_with_args(child, "pwms", "#pwm-cells", 0, &args); 528 + 529 + if (ret) 530 + return ret; 531 + 532 + if (args.args_count > 0) { 533 + data->pwm_freq[ch] = find_closest(args.args[0], base_freq_table, 534 + ARRAY_SIZE(base_freq_table)); 535 + } else { 536 + data->pwm_freq[ch] = base_freq_table[3]; 537 + } 538 + 539 + if (args.args_count > 1) { 540 + if (args.args[1] == PWM_POLARITY_NORMAL || args.args[1] == PWM_POLARITY_INVERSED) 541 + data->pwm_polarity_mask |= args.args[1] << ch; 542 + else 543 + dev_err(dev, "Wrong PWM polarity config provided: %d\n", args.args[0]); 544 + } else { 545 + data->pwm_polarity_mask |= PWM_POLARITY_NORMAL << ch; 546 + } 547 + 548 + if (args.args_count > 2) { 549 + if (args.args[2] == EMC2305_PUSH_PULL || args.args[2] <= EMC2305_OPEN_DRAIN) 550 + data->pwm_output_mask |= args.args[2] << ch; 551 + else 552 + dev_err(dev, "Wrong PWM output config provided: %d\n", args.args[1]); 553 + } else { 554 + data->pwm_output_mask |= EMC2305_OPEN_DRAIN << ch; 555 + } 556 + 557 + return 0; 558 + } 559 + 560 + static int emc2305_probe_childs_from_dt(struct device *dev) 561 + { 562 + struct emc2305_data *data = dev_get_drvdata(dev); 563 + struct device_node *child; 564 + int ret, count = 0; 565 + 566 + data->pwm_output_mask = 0x0; 567 + data->pwm_polarity_mask = 0x0; 568 + 569 + for_each_child_of_node(dev->of_node, child) { 570 + if (of_property_present(child, "reg")) { 571 + ret = emc2305_of_parse_pwm_child(dev, child, data); 572 + if (ret) { 573 + of_node_put(child); 574 + continue; 575 + } 576 + count++; 577 + } 578 + } 579 + return count; 580 + } 581 + 538 582 static int emc2305_probe(struct i2c_client *client) 539 583 { 540 584 struct i2c_adapter *adapter = client->adapter; 541 585 struct device *dev = &client->dev; 586 + struct device_node *child; 542 587 struct emc2305_data *data; 543 588 struct emc2305_platform_data *pdata; 544 589 int vendor; 545 590 int ret; 546 591 int i; 592 + int pwm_childs; 547 593 548 594 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA)) 549 595 return -ENODEV; ··· 633 539 if (ret) 634 540 return ret; 635 541 542 + pwm_childs = emc2305_probe_childs_from_dt(dev); 543 + 636 544 pdata = dev_get_platdata(&client->dev); 637 - if (pdata) { 638 - if (!pdata->max_state || pdata->max_state > EMC2305_FAN_MAX_STATE) 639 - return -EINVAL; 640 - data->max_state = pdata->max_state; 641 - /* 642 - * Validate a number of active PWM channels. Note that 643 - * configured number can be less than the actual maximum 644 - * supported by the device. 645 - */ 646 - if (!pdata->pwm_num || pdata->pwm_num > EMC2305_PWM_MAX) 647 - return -EINVAL; 648 - data->pwm_num = pdata->pwm_num; 649 - data->pwm_separate = pdata->pwm_separate; 650 - for (i = 0; i < EMC2305_PWM_MAX; i++) 651 - data->pwm_min[i] = pdata->pwm_min[i]; 545 + 546 + if (!pwm_childs) { 547 + if (pdata) { 548 + if (!pdata->max_state || pdata->max_state > EMC2305_FAN_MAX_STATE) 549 + return -EINVAL; 550 + data->max_state = pdata->max_state; 551 + /* 552 + * Validate a number of active PWM channels. Note that 553 + * configured number can be less than the actual maximum 554 + * supported by the device. 555 + */ 556 + if (!pdata->pwm_num || pdata->pwm_num > EMC2305_PWM_MAX) 557 + return -EINVAL; 558 + data->pwm_num = pdata->pwm_num; 559 + data->pwm_output_mask = pdata->pwm_output_mask; 560 + data->pwm_polarity_mask = pdata->pwm_polarity_mask; 561 + data->pwm_separate = pdata->pwm_separate; 562 + for (i = 0; i < EMC2305_PWM_MAX; i++) { 563 + data->pwm_min[i] = pdata->pwm_min[i]; 564 + data->pwm_freq[i] = pdata->pwm_freq[i]; 565 + } 566 + } else { 567 + data->max_state = EMC2305_FAN_MAX_STATE; 568 + data->pwm_separate = false; 569 + data->pwm_output_mask = EMC2305_DEFAULT_OUTPUT; 570 + data->pwm_polarity_mask = EMC2305_DEFAULT_POLARITY; 571 + for (i = 0; i < EMC2305_PWM_MAX; i++) { 572 + data->pwm_min[i] = EMC2305_FAN_MIN; 573 + data->pwm_freq[i] = base_freq_table[3]; 574 + } 575 + } 652 576 } else { 653 577 data->max_state = EMC2305_FAN_MAX_STATE; 654 578 data->pwm_separate = false; ··· 680 568 return PTR_ERR(data->hwmon_dev); 681 569 682 570 if (IS_REACHABLE(CONFIG_THERMAL)) { 683 - ret = emc2305_set_tz(dev); 684 - if (ret != 0) 685 - return ret; 571 + /* Parse and check for the available PWM child nodes */ 572 + if (pwm_childs > 0) { 573 + i = 0; 574 + for_each_child_of_node(dev->of_node, child) { 575 + ret = emc2305_set_single_tz(dev, child, i); 576 + if (ret != 0) 577 + return ret; 578 + i++; 579 + } 580 + } else { 581 + ret = emc2305_set_tz(dev); 582 + if (ret != 0) 583 + return ret; 584 + } 686 585 } 586 + 587 + ret = i2c_smbus_write_byte_data(client, EMC2305_REG_DRIVE_PWM_OUT, 588 + data->pwm_output_mask); 589 + if (ret < 0) 590 + dev_err(dev, "Failed to configure pwm output, using default\n"); 591 + 592 + ret = i2c_smbus_write_byte_data(client, EMC2305_REG_POLARITY, 593 + data->pwm_polarity_mask); 594 + if (ret < 0) 595 + dev_err(dev, "Failed to configure pwm polarity, using default\n"); 687 596 688 597 for (i = 0; i < data->pwm_num; i++) { 689 598 ret = i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_MIN_DRIVE(i),
+2 -2
drivers/hwmon/gsc-hwmon.c
··· 64 64 return ret; 65 65 66 66 ret = regs[0] | regs[1] << 8; 67 - return sprintf(buf, "%d\n", ret * 10); 67 + return sprintf(buf, "%d\n", ret * 100); 68 68 } 69 69 70 70 static ssize_t pwm_auto_point_temp_store(struct device *dev, ··· 99 99 { 100 100 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 101 101 102 - return sprintf(buf, "%d\n", 255 * (50 + (attr->index * 10))); 102 + return sprintf(buf, "%d\n", 255 * (50 + (attr->index * 10)) / 100); 103 103 } 104 104 105 105 static SENSOR_DEVICE_ATTR_RO(pwm1_auto_point1_pwm, pwm_auto_point_pwm, 0);
+8 -19
drivers/hwmon/ibmaem.c
··· 349 349 static int aem_read_sensor(struct aem_data *data, u8 elt, u8 reg, 350 350 void *buf, size_t size) 351 351 { 352 - int rs_size, res; 352 + int rs_size; 353 353 struct aem_read_sensor_req rs_req; 354 354 /* Use preallocated rx buffer */ 355 355 struct aem_read_sensor_resp *rs_resp = data->rs_resp; ··· 383 383 384 384 aem_send_message(ipmi); 385 385 386 - res = wait_for_completion_timeout(&ipmi->read_complete, IPMI_TIMEOUT); 387 - if (!res) { 388 - res = -ETIMEDOUT; 389 - goto out; 390 - } 386 + if (!wait_for_completion_timeout(&ipmi->read_complete, IPMI_TIMEOUT)) 387 + return -ETIMEDOUT; 391 388 392 389 if (ipmi->rx_result || ipmi->rx_msg_len != rs_size || 393 - memcmp(&rs_resp->id, &system_x_id, sizeof(system_x_id))) { 394 - res = -ENOENT; 395 - goto out; 396 - } 390 + memcmp(&rs_resp->id, &system_x_id, sizeof(system_x_id))) 391 + return -ENOENT; 397 392 398 393 switch (size) { 399 394 case 1: { ··· 412 417 break; 413 418 } 414 419 } 415 - res = 0; 416 420 417 - out: 418 - return res; 421 + return 0; 419 422 } 420 423 421 424 /* Update AEM energy registers */ ··· 484 491 /* Retrieve version and module handle for an AEM1 instance */ 485 492 static int aem_find_aem1_count(struct aem_ipmi_data *data) 486 493 { 487 - int res; 488 494 struct aem_find_firmware_req ff_req; 489 495 struct aem_find_firmware_resp ff_resp; 490 496 ··· 500 508 501 509 aem_send_message(data); 502 510 503 - res = wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT); 504 - if (!res) 511 + if (!wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT)) 505 512 return -ETIMEDOUT; 506 513 507 514 if (data->rx_result || data->rx_msg_len != sizeof(ff_resp) || ··· 623 632 struct aem_find_instance_resp *fi_resp, 624 633 int instance_num) 625 634 { 626 - int res; 627 635 struct aem_find_instance_req fi_req; 628 636 629 637 fi_req.id = system_x_id; ··· 638 648 639 649 aem_send_message(data); 640 650 641 - res = wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT); 642 - if (!res) 651 + if (!wait_for_completion_timeout(&data->read_complete, IPMI_TIMEOUT)) 643 652 return -ETIMEDOUT; 644 653 645 654 if (data->rx_result || data->rx_msg_len != sizeof(*fi_resp) ||
+115 -19
drivers/hwmon/ina238.c
··· 6 6 * Copyright (C) 2021 Nathan Rossi <nathan.rossi@digi.com> 7 7 */ 8 8 9 + #include <linux/bitops.h> 9 10 #include <linux/err.h> 10 11 #include <linux/hwmon.h> 11 12 #include <linux/i2c.h> ··· 42 41 43 42 #define INA238_CONFIG_ADCRANGE BIT(4) 44 43 #define SQ52206_CONFIG_ADCRANGE_HIGH BIT(4) 45 - #define SQ52206_CONFIG_ADCRANGE_LOW BIT(3) 44 + #define SQ52206_CONFIG_ADCRANGE_LOW BIT(3) 46 45 47 46 #define INA238_DIAG_ALERT_TMPOL BIT(7) 48 47 #define INA238_DIAG_ALERT_SHNTOL BIT(6) ··· 105 104 106 105 #define INA238_SHUNT_VOLTAGE_LSB 5 /* 5 uV/lsb */ 107 106 #define INA238_BUS_VOLTAGE_LSB 3125 /* 3.125 mV/lsb */ 108 - #define INA238_DIE_TEMP_LSB 1250000 /* 125.0000 mC/lsb */ 107 + #define INA238_DIE_TEMP_LSB 1250000 /* 125.0000 mC/lsb */ 109 108 #define SQ52206_BUS_VOLTAGE_LSB 3750 /* 3.75 mV/lsb */ 110 109 #define SQ52206_DIE_TEMP_LSB 78125 /* 7.8125 mC/lsb */ 110 + #define INA228_DIE_TEMP_LSB 78125 /* 7.8125 mC/lsb */ 111 111 112 112 static const struct regmap_config ina238_regmap_config = { 113 113 .max_register = INA238_REGISTERS, ··· 116 114 .val_bits = 16, 117 115 }; 118 116 119 - enum ina238_ids { ina238, ina237, sq52206 }; 117 + enum ina238_ids { ina238, ina237, sq52206, ina228 }; 120 118 121 119 struct ina238_config { 120 + bool has_20bit_voltage_current; /* vshunt, vbus and current are 20-bit fields */ 122 121 bool has_power_highest; /* chip detection power peak */ 123 - bool has_energy; /* chip detection energy */ 124 - u8 temp_shift; /* fixed parameters for temp calculate */ 122 + bool has_energy; /* chip detection energy */ 123 + u8 temp_shift; /* fixed parameters for temp calculate */ 125 124 u32 power_calculate_factor; /* fixed parameters for power calculate */ 126 - u16 config_default; /* Power-on default state */ 125 + u16 config_default; /* Power-on default state */ 127 126 int bus_voltage_lsb; /* use for temperature calculate, uV/lsb */ 128 - int temp_lsb; /* use for temperature calculate */ 127 + int temp_lsb; /* use for temperature calculate */ 129 128 }; 130 129 131 130 struct ina238_data { ··· 140 137 141 138 static const struct ina238_config ina238_config[] = { 142 139 [ina238] = { 140 + .has_20bit_voltage_current = false, 143 141 .has_energy = false, 144 142 .has_power_highest = false, 145 143 .temp_shift = 4, ··· 150 146 .temp_lsb = INA238_DIE_TEMP_LSB, 151 147 }, 152 148 [ina237] = { 149 + .has_20bit_voltage_current = false, 153 150 .has_energy = false, 154 151 .has_power_highest = false, 155 152 .temp_shift = 4, ··· 160 155 .temp_lsb = INA238_DIE_TEMP_LSB, 161 156 }, 162 157 [sq52206] = { 158 + .has_20bit_voltage_current = false, 163 159 .has_energy = true, 164 160 .has_power_highest = true, 165 161 .temp_shift = 0, ··· 168 162 .config_default = SQ52206_CONFIG_DEFAULT, 169 163 .bus_voltage_lsb = SQ52206_BUS_VOLTAGE_LSB, 170 164 .temp_lsb = SQ52206_DIE_TEMP_LSB, 165 + }, 166 + [ina228] = { 167 + .has_20bit_voltage_current = true, 168 + .has_energy = true, 169 + .has_power_highest = false, 170 + .temp_shift = 0, 171 + .power_calculate_factor = 20, 172 + .config_default = INA238_CONFIG_DEFAULT, 173 + .bus_voltage_lsb = INA238_BUS_VOLTAGE_LSB, 174 + .temp_lsb = INA228_DIE_TEMP_LSB, 171 175 }, 172 176 }; 173 177 ··· 215 199 return 0; 216 200 } 217 201 202 + static int ina238_read_field_s20(const struct i2c_client *client, u8 reg, s32 *val) 203 + { 204 + u32 regval; 205 + int err; 206 + 207 + err = ina238_read_reg24(client, reg, &regval); 208 + if (err) 209 + return err; 210 + 211 + /* bits 3-0 Reserved, always zero */ 212 + regval >>= 4; 213 + 214 + *val = sign_extend32(regval, 19); 215 + 216 + return 0; 217 + } 218 + 219 + static int ina228_read_shunt_voltage(struct device *dev, u32 attr, int channel, 220 + long *val) 221 + { 222 + struct ina238_data *data = dev_get_drvdata(dev); 223 + int regval; 224 + int err; 225 + 226 + err = ina238_read_field_s20(data->client, INA238_SHUNT_VOLTAGE, &regval); 227 + if (err) 228 + return err; 229 + 230 + /* 231 + * gain of 1 -> LSB / 4 232 + * This field has 16 bit on ina238. ina228 adds another 4 bits of 233 + * precision. ina238 conversion factors can still be applied when 234 + * dividing by 16. 235 + */ 236 + *val = (regval * INA238_SHUNT_VOLTAGE_LSB) * data->gain / (1000 * 4) / 16; 237 + return 0; 238 + } 239 + 240 + static int ina228_read_bus_voltage(struct device *dev, u32 attr, int channel, 241 + long *val) 242 + { 243 + struct ina238_data *data = dev_get_drvdata(dev); 244 + int regval; 245 + int err; 246 + 247 + err = ina238_read_field_s20(data->client, INA238_BUS_VOLTAGE, &regval); 248 + if (err) 249 + return err; 250 + 251 + /* 252 + * gain of 1 -> LSB / 4 253 + * This field has 16 bit on ina238. ina228 adds another 4 bits of 254 + * precision. ina238 conversion factors can still be applied when 255 + * dividing by 16. 256 + */ 257 + *val = (regval * data->config->bus_voltage_lsb) / 1000 / 16; 258 + return 0; 259 + } 260 + 218 261 static int ina238_read_in(struct device *dev, u32 attr, int channel, 219 262 long *val) 220 263 { ··· 286 211 case 0: 287 212 switch (attr) { 288 213 case hwmon_in_input: 214 + if (data->config->has_20bit_voltage_current) 215 + return ina228_read_shunt_voltage(dev, attr, channel, val); 289 216 reg = INA238_SHUNT_VOLTAGE; 290 217 break; 291 218 case hwmon_in_max: ··· 311 234 case 1: 312 235 switch (attr) { 313 236 case hwmon_in_input: 237 + if (data->config->has_20bit_voltage_current) 238 + return ina228_read_bus_voltage(dev, attr, channel, val); 314 239 reg = INA238_BUS_VOLTAGE; 315 240 break; 316 241 case hwmon_in_max: ··· 350 271 if (channel == 0) 351 272 /* gain of 1 -> LSB / 4 */ 352 273 *val = (regval * INA238_SHUNT_VOLTAGE_LSB) * 353 - data->gain / (1000 * 4); 274 + data->gain / (1000 * 4); 354 275 else 355 276 *val = (regval * data->config->bus_voltage_lsb) / 1000; 356 277 break; ··· 420 341 421 342 switch (attr) { 422 343 case hwmon_curr_input: 423 - err = regmap_read(data->regmap, INA238_CURRENT, &regval); 424 - if (err < 0) 425 - return err; 344 + if (data->config->has_20bit_voltage_current) { 345 + err = ina238_read_field_s20(data->client, INA238_CURRENT, &regval); 346 + if (err) 347 + return err; 348 + } else { 349 + err = regmap_read(data->regmap, INA238_CURRENT, &regval); 350 + if (err < 0) 351 + return err; 352 + /* sign-extend */ 353 + regval = (s16)regval; 354 + } 426 355 427 356 /* Signed register, fixed 1mA current lsb. result in mA */ 428 - *val = div_s64((s16)regval * INA238_FIXED_SHUNT * data->gain, 357 + *val = div_s64((s64)regval * INA238_FIXED_SHUNT * data->gain, 429 358 data->rshunt * 4); 359 + 360 + /* Account for 4 bit offset */ 361 + if (data->config->has_20bit_voltage_current) 362 + *val /= 16; 430 363 break; 431 364 default: 432 365 return -EOPNOTSUPP; ··· 461 370 return err; 462 371 463 372 /* Fixed 1mA lsb, scaled by 1000000 to have result in uW */ 464 - power = div_u64(regval * 1000ULL * INA238_FIXED_SHUNT * data->gain * 373 + power = div_u64(regval * 1000ULL * INA238_FIXED_SHUNT * data->gain * 465 374 data->config->power_calculate_factor, 4 * 100 * data->rshunt); 466 375 /* Clamp value to maximum value of long */ 467 376 *val = clamp_val(power, 0, LONG_MAX); ··· 472 381 return err; 473 382 474 383 /* Fixed 1mA lsb, scaled by 1000000 to have result in uW */ 475 - power = div_u64(regval * 1000ULL * INA238_FIXED_SHUNT * data->gain * 384 + power = div_u64(regval * 1000ULL * INA238_FIXED_SHUNT * data->gain * 476 385 data->config->power_calculate_factor, 4 * 100 * data->rshunt); 477 386 /* Clamp value to maximum value of long */ 478 387 *val = clamp_val(power, 0, LONG_MAX); ··· 486 395 * Truncated 24-bit compare register, lower 8-bits are 487 396 * truncated. Same conversion to/from uW as POWER register. 488 397 */ 489 - power = div_u64((regval << 8) * 1000ULL * INA238_FIXED_SHUNT * data->gain * 398 + power = div_u64((regval << 8) * 1000ULL * INA238_FIXED_SHUNT * data->gain * 490 399 data->config->power_calculate_factor, 4 * 100 * data->rshunt); 491 400 /* Clamp value to maximum value of long */ 492 401 *val = clamp_val(power, 0, LONG_MAX); ··· 539 448 return err; 540 449 /* Signed, result in mC */ 541 450 *val = div_s64(((s64)((s16)regval) >> data->config->temp_shift) * 542 - (s64)data->config->temp_lsb, 10000); 451 + (s64)data->config->temp_lsb, 10000); 543 452 break; 544 453 case hwmon_temp_max: 545 454 err = regmap_read(data->regmap, INA238_TEMP_LIMIT, &regval); ··· 547 456 return err; 548 457 /* Signed, result in mC */ 549 458 *val = div_s64(((s64)((s16)regval) >> data->config->temp_shift) * 550 - (s64)data->config->temp_lsb, 10000); 459 + (s64)data->config->temp_lsb, 10000); 551 460 break; 552 461 case hwmon_temp_max_alarm: 553 462 err = regmap_read(data->regmap, INA238_DIAG_ALERT, &regval); ··· 592 501 return ret; 593 502 594 503 /* result in uJ */ 595 - energy = div_u64(regval * INA238_FIXED_SHUNT * data->gain * 16 * 10 * 596 - data->config->power_calculate_factor, 4 * data->rshunt); 504 + energy = div_u64(regval * INA238_FIXED_SHUNT * data->gain * 16 * 10 * 505 + data->config->power_calculate_factor, 4 * data->rshunt); 597 506 598 507 return sysfs_emit(buf, "%llu\n", energy); 599 508 } ··· 841 750 } 842 751 843 752 static const struct i2c_device_id ina238_id[] = { 753 + { "ina228", ina228 }, 844 754 { "ina237", ina237 }, 845 755 { "ina238", ina238 }, 846 756 { "sq52206", sq52206 }, ··· 850 758 MODULE_DEVICE_TABLE(i2c, ina238_id); 851 759 852 760 static const struct of_device_id __maybe_unused ina238_of_match[] = { 761 + { 762 + .compatible = "ti,ina228", 763 + .data = (void *)ina228 764 + }, 853 765 { 854 766 .compatible = "ti,ina237", 855 767 .data = (void *)ina237
+9 -7
drivers/hwmon/ltc4282.c
··· 177 177 LTC4282_CLKOUT_CNV, LTC4282_CLKOUT_SYSTEM 178 178 }; 179 179 180 - static long ltc4282_round_rate(struct clk_hw *hw, unsigned long rate, 181 - unsigned long *parent_rate) 180 + static int ltc4282_determine_rate(struct clk_hw *hw, 181 + struct clk_rate_request *req) 182 182 { 183 - int idx = find_closest(rate, ltc4282_out_rates, 183 + int idx = find_closest(req->rate, ltc4282_out_rates, 184 184 ARRAY_SIZE(ltc4282_out_rates)); 185 185 186 - return ltc4282_out_rates[idx]; 186 + req->rate = ltc4282_out_rates[idx]; 187 + 188 + return 0; 187 189 } 188 190 189 191 static unsigned long ltc4282_recalc_rate(struct clk_hw *hw, ··· 1126 1124 1127 1125 static const struct clk_ops ltc4282_ops = { 1128 1126 .recalc_rate = ltc4282_recalc_rate, 1129 - .round_rate = ltc4282_round_rate, 1127 + .determine_rate = ltc4282_determine_rate, 1130 1128 .set_rate = ltc4282_set_rate, 1131 1129 .disable = ltc4282_disable, 1132 1130 }; ··· 1598 1596 .read_string = ltc4282_read_labels, 1599 1597 }; 1600 1598 1601 - static const struct hwmon_chip_info ltc2947_chip_info = { 1599 + static const struct hwmon_chip_info ltc4282_chip_info = { 1602 1600 .ops = &ltc4282_hwmon_ops, 1603 1601 .info = ltc4282_info, 1604 1602 }; ··· 1719 1717 1720 1718 mutex_init(&st->lock); 1721 1719 hwmon = devm_hwmon_device_register_with_info(dev, "ltc4282", st, 1722 - &ltc2947_chip_info, 1720 + &ltc4282_chip_info, 1723 1721 ltc4282_groups); 1724 1722 if (IS_ERR(hwmon)) 1725 1723 return PTR_ERR(hwmon);
+1 -1
drivers/hwmon/max31827.c
··· 445 445 446 446 val = FIELD_GET(MAX31827_CONFIGURATION_RESOLUTION_MASK, val); 447 447 448 - return scnprintf(buf, PAGE_SIZE, "%u\n", max31827_resolutions[val]); 448 + return sysfs_emit(buf, "%u\n", max31827_resolutions[val]); 449 449 } 450 450 451 451 static ssize_t temp1_resolution_store(struct device *dev,
+9
drivers/hwmon/pmbus/Kconfig
··· 67 67 This driver can also be built as a module. If so, the module will 68 68 be called adp1050. 69 69 70 + config SENSORS_ADP1050_REGULATOR 71 + bool "Regulator support for ADP1050 and compatibles" 72 + depends on SENSORS_ADP1050 && REGULATOR 73 + help 74 + If you say yes here you get regulator support for Analog Devices 75 + LTP8800-1A, LTP8800-4A, and LTP8800-2. LTP8800 is a family of DC/DC 76 + µModule regulators that can provide microprocessor power from 54V 77 + power distribution architecture. 78 + 70 79 config SENSORS_BEL_PFE 71 80 tristate "Bel PFE Compatible Power Supplies" 72 81 help
+69 -3
drivers/hwmon/pmbus/adp1050.c
··· 11 11 12 12 #include "pmbus.h" 13 13 14 + #if IS_ENABLED(CONFIG_SENSORS_ADP1050_REGULATOR) 15 + static const struct regulator_desc adp1050_reg_desc[] = { 16 + PMBUS_REGULATOR_ONE("vout"), 17 + }; 18 + #endif /* CONFIG_SENSORS_ADP1050_REGULATOR */ 19 + 14 20 static struct pmbus_driver_info adp1050_info = { 15 21 .pages = 1, 16 22 .format[PSC_VOLTAGE_IN] = linear, ··· 29 23 | PMBUS_HAVE_STATUS_TEMP, 30 24 }; 31 25 26 + static struct pmbus_driver_info adp1051_info = { 27 + .pages = 1, 28 + .format[PSC_VOLTAGE_IN] = linear, 29 + .format[PSC_VOLTAGE_OUT] = linear, 30 + .format[PSC_CURRENT_IN] = linear, 31 + .format[PSC_TEMPERATURE] = linear, 32 + .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN 33 + | PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT 34 + | PMBUS_HAVE_TEMP 35 + | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_IOUT 36 + | PMBUS_HAVE_STATUS_INPUT 37 + | PMBUS_HAVE_STATUS_TEMP, 38 + }; 39 + 40 + static struct pmbus_driver_info adp1055_info = { 41 + .pages = 1, 42 + .format[PSC_VOLTAGE_IN] = linear, 43 + .format[PSC_VOLTAGE_OUT] = linear, 44 + .format[PSC_CURRENT_IN] = linear, 45 + .format[PSC_TEMPERATURE] = linear, 46 + .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN 47 + | PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT 48 + | PMBUS_HAVE_TEMP2 | PMBUS_HAVE_TEMP3 49 + | PMBUS_HAVE_POUT 50 + | PMBUS_HAVE_STATUS_VOUT | PMBUS_HAVE_STATUS_IOUT 51 + | PMBUS_HAVE_STATUS_INPUT 52 + | PMBUS_HAVE_STATUS_TEMP, 53 + }; 54 + 55 + static struct pmbus_driver_info ltp8800_info = { 56 + .pages = 1, 57 + .format[PSC_VOLTAGE_IN] = linear, 58 + .format[PSC_VOLTAGE_OUT] = linear, 59 + .format[PSC_CURRENT_IN] = linear, 60 + .format[PSC_TEMPERATURE] = linear, 61 + .func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_IIN 62 + | PMBUS_HAVE_VOUT | PMBUS_HAVE_IOUT 63 + | PMBUS_HAVE_TEMP 64 + | PMBUS_HAVE_POUT 65 + | PMBUS_HAVE_STATUS_VOUT 66 + | PMBUS_HAVE_STATUS_INPUT 67 + | PMBUS_HAVE_STATUS_TEMP, 68 + #if IS_ENABLED(CONFIG_SENSORS_ADP1050_REGULATOR) 69 + .num_regulators = 1, 70 + .reg_desc = adp1050_reg_desc, 71 + #endif 72 + }; 73 + 32 74 static int adp1050_probe(struct i2c_client *client) 33 75 { 34 - return pmbus_do_probe(client, &adp1050_info); 76 + struct pmbus_driver_info *info; 77 + 78 + info = (struct pmbus_driver_info *)i2c_get_match_data(client); 79 + if (!info) 80 + return -ENODEV; 81 + 82 + return pmbus_do_probe(client, info); 35 83 } 36 84 37 85 static const struct i2c_device_id adp1050_id[] = { 38 - {"adp1050"}, 86 + { .name = "adp1050", .driver_data = (kernel_ulong_t)&adp1050_info }, 87 + { .name = "adp1051", .driver_data = (kernel_ulong_t)&adp1051_info }, 88 + { .name = "adp1055", .driver_data = (kernel_ulong_t)&adp1055_info }, 89 + { .name = "ltp8800", .driver_data = (kernel_ulong_t)&ltp8800_info }, 39 90 {} 40 91 }; 41 92 MODULE_DEVICE_TABLE(i2c, adp1050_id); 42 93 43 94 static const struct of_device_id adp1050_of_match[] = { 44 - { .compatible = "adi,adp1050"}, 95 + { .compatible = "adi,adp1050", .data = &adp1050_info }, 96 + { .compatible = "adi,adp1051", .data = &adp1051_info }, 97 + { .compatible = "adi,adp1055", .data = &adp1055_info }, 98 + { .compatible = "adi,ltp8800", .data = &ltp8800_info }, 45 99 {} 46 100 }; 47 101 MODULE_DEVICE_TABLE(of, adp1050_of_match);
+3
drivers/hwmon/pmbus/isl68137.c
··· 63 63 raa228228, 64 64 raa229001, 65 65 raa229004, 66 + raa229621, 66 67 }; 67 68 68 69 enum variants { ··· 466 465 {"raa228228", raa_dmpvr2_2rail_nontc}, 467 466 {"raa229001", raa_dmpvr2_2rail}, 468 467 {"raa229004", raa_dmpvr2_2rail}, 468 + {"raa229621", raa_dmpvr2_2rail}, 469 469 {} 470 470 }; 471 471 ··· 514 512 { .compatible = "renesas,raa228228", .data = (void *)raa_dmpvr2_2rail_nontc }, 515 513 { .compatible = "renesas,raa229001", .data = (void *)raa_dmpvr2_2rail }, 516 514 { .compatible = "renesas,raa229004", .data = (void *)raa_dmpvr2_2rail }, 515 + { .compatible = "renesas,raa229621", .data = (void *)raa_dmpvr2_2rail }, 517 516 { }, 518 517 }; 519 518
+31 -6
drivers/hwmon/pmbus/tps53679.c
··· 16 16 #include "pmbus.h" 17 17 18 18 enum chips { 19 - tps53647, tps53667, tps53676, tps53679, tps53681, tps53688 19 + tps53647, tps53667, tps53676, tps53679, tps53681, tps53685, tps53688 20 20 }; 21 21 22 22 #define TPS53647_PAGE_NUM 1 ··· 31 31 #define TPS53679_PROT_VR13_5MV 0x07 /* VR13.0 mode, 5-mV DAC */ 32 32 #define TPS53679_PAGE_NUM 2 33 33 34 - #define TPS53681_DEVICE_ID 0x81 34 + #define TPS53681_DEVICE_ID "\x81" 35 + #define TPS53685_DEVICE_ID "TIShP" 35 36 36 37 #define TPS53681_PMBUS_REVISION 0x33 37 38 ··· 87 86 } 88 87 89 88 static int tps53679_identify_chip(struct i2c_client *client, 90 - u8 revision, u16 id) 89 + u8 revision, char *id) 91 90 { 92 91 u8 buf[I2C_SMBUS_BLOCK_MAX]; 93 92 int ret; 93 + int buf_len; 94 + int id_len; 94 95 95 96 ret = pmbus_read_byte_data(client, 0, PMBUS_REVISION); 96 97 if (ret < 0) ··· 105 102 ret = i2c_smbus_read_block_data(client, PMBUS_IC_DEVICE_ID, buf); 106 103 if (ret < 0) 107 104 return ret; 108 - if (ret != 1 || buf[0] != id) { 109 - dev_err(&client->dev, "Unexpected device ID 0x%x\n", buf[0]); 105 + 106 + /* Adjust length if null terminator if present */ 107 + buf_len = (buf[ret - 1] != '\x00' ? ret : ret - 1); 108 + 109 + id_len = strlen(id); 110 + 111 + if (buf_len != id_len || strncmp(id, buf, id_len)) { 112 + dev_err(&client->dev, "Unexpected device ID: %*ph\n", ret, buf); 110 113 return -ENODEV; 111 114 } 112 115 return 0; ··· 126 117 */ 127 118 static int tps53679_identify_multiphase(struct i2c_client *client, 128 119 struct pmbus_driver_info *info, 129 - int pmbus_rev, int device_id) 120 + int pmbus_rev, char *device_id) 130 121 { 131 122 int ret; 132 123 ··· 145 136 struct pmbus_driver_info *info) 146 137 { 147 138 return tps53679_identify_mode(client, info); 139 + } 140 + 141 + static int tps53685_identify(struct i2c_client *client, 142 + struct pmbus_driver_info *info) 143 + { 144 + info->func[1] |= PMBUS_HAVE_VIN | PMBUS_HAVE_IIN | PMBUS_HAVE_PIN | 145 + PMBUS_HAVE_STATUS_INPUT; 146 + info->format[PSC_VOLTAGE_OUT] = linear; 147 + return tps53679_identify_chip(client, TPS53681_PMBUS_REVISION, 148 + TPS53685_DEVICE_ID); 148 149 } 149 150 150 151 static int tps53681_identify(struct i2c_client *client, ··· 282 263 info->identify = tps53681_identify; 283 264 info->read_word_data = tps53681_read_word_data; 284 265 break; 266 + case tps53685: 267 + info->pages = TPS53679_PAGE_NUM; 268 + info->identify = tps53685_identify; 269 + break; 285 270 default: 286 271 return -ENODEV; 287 272 } ··· 300 277 {"tps53676", tps53676}, 301 278 {"tps53679", tps53679}, 302 279 {"tps53681", tps53681}, 280 + {"tps53685", tps53685}, 303 281 {"tps53688", tps53688}, 304 282 {} 305 283 }; ··· 313 289 {.compatible = "ti,tps53676", .data = (void *)tps53676}, 314 290 {.compatible = "ti,tps53679", .data = (void *)tps53679}, 315 291 {.compatible = "ti,tps53681", .data = (void *)tps53681}, 292 + {.compatible = "ti,tps53685", .data = (void *)tps53685}, 316 293 {.compatible = "ti,tps53688", .data = (void *)tps53688}, 317 294 {} 318 295 };
+6 -3
drivers/hwmon/w83627ehf.c
··· 1448 1448 return 0; 1449 1449 case hwmon_temp_alarm: 1450 1450 if (channel < 3) { 1451 - int bit[] = { 4, 5, 13 }; 1451 + static const int bit[] = { 4, 5, 13 }; 1452 + 1452 1453 *val = (data->alarms >> bit[channel]) & 1; 1453 1454 return 0; 1454 1455 } ··· 1480 1479 return 0; 1481 1480 case hwmon_in_alarm: 1482 1481 if (channel < 10) { 1483 - int bit[] = { 0, 1, 2, 3, 8, 21, 20, 16, 17, 19 }; 1482 + static const int bit[] = { 0, 1, 2, 3, 8, 21, 20, 16, 17, 19 }; 1483 + 1484 1484 *val = (data->alarms >> bit[channel]) & 1; 1485 1485 return 0; 1486 1486 } ··· 1509 1507 return 0; 1510 1508 case hwmon_fan_alarm: 1511 1509 if (channel < 5) { 1512 - int bit[] = { 6, 7, 11, 10, 23 }; 1510 + static const int bit[] = { 6, 7, 11, 10, 23 }; 1511 + 1513 1512 *val = (data->alarms >> bit[channel]) & 1; 1514 1513 return 0; 1515 1514 }
+6
include/linux/platform_data/emc2305.h
··· 9 9 * struct emc2305_platform_data - EMC2305 driver platform data 10 10 * @max_state: maximum cooling state of the cooling device; 11 11 * @pwm_num: number of active channels; 12 + * @pwm_output_mask: PWM output mask 13 + * @pwm_polarity_mask: PWM polarity mask 12 14 * @pwm_separate: separate PWM settings for every channel; 13 15 * @pwm_min: array of minimum PWM per channel; 16 + * @pwm_freq: array of PWM frequency per channel 14 17 */ 15 18 struct emc2305_platform_data { 16 19 u8 max_state; 17 20 u8 pwm_num; 21 + u8 pwm_output_mask; 22 + u8 pwm_polarity_mask; 18 23 bool pwm_separate; 19 24 u8 pwm_min[EMC2305_PWM_MAX]; 25 + u16 pwm_freq[EMC2305_PWM_MAX]; 20 26 }; 21 27 22 28 #endif