summaryrefslogtreecommitdiffstats
path: root/drivers
Commit message (Collapse)AuthorAgeFilesLines
* hwmon: add driver for NZXT RGB&Fan Controller/Smart Device v2.Aleksandr Mezin2021-12-263-0/+840
| | | | | | | | | | | | | | | | | | | | | | | This driver implements monitoring and control of fans plugged into the device. Besides typical speed monitoring and PWM duty cycle control, voltage and current are reported for every fan. The device also has 2 connectors for RGB LEDs, support for them isn't implemented (mainly because there is no standardized sysfs interface). Also, the device has a noise sensor, but the sensor seems to be completely useless (and very imprecise), so support for it isn't implemented too. The driver coexists with userspace tools that access the device through hidraw interface with no known issues. The driver has been tested on x86_64, built in and as a module. Some changes/improvements were suggested by Jonas Malaco. Signed-off-by: Aleksandr Mezin <mezin.alexander@gmail.com> Link: https://lore.kernel.org/r/20211031033058.151014-1-mezin.alexander@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct6775) add ROG STRIX B550-A/X570-I GAMINGDenis Pauk2021-12-261-0/+2
| | | | | | | | | | | | | | | | | ASUS ROG STRIX B550-A/X570-I GAMING boards have got an nct6775 chip, but by default there's no use of it because of resource conflict with WMI method. This commit adds "ROG STRIX B550-A GAMING" and "ROG STRIX X570-I GAMING" to the list of boards that can be monitored using ASUS WMI. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204807 Signed-off-by: Denis Pauk <pauk.denis@gmail.com> Tested-by: Daniel Gibson <metalcaedes@gmail.com> Tested-by: Michael Altizer <michael@theoddone.net> Tested-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com> Link: https://lore.kernel.org/r/20211211180037.367062-1-pauk.denis@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Add support for MPS Multi-phase mp5023Howard.Chiu@quantatw.com2021-12-263-0/+77
| | | | | | | | | | Add support for mp5023 device from Monolithic Power Systems, Inc. (MPS) vendor. This is a Hot-Swap Controller. Signed-off-by: Howard Chiu <howard.chiu@quantatw.com> Link: https://lore.kernel.org/r/HKAPR04MB400349AA406694FB976D78D096709@HKAPR04MB4003.apcprd04.prod.outlook.com [groeck: Added MODULE_IMPORT_NS, entry in index.rst] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Add Delta AHE-50DC fan control module driverZev Weiss2021-12-263-0/+125
| | | | | | | | | | | | This device is an integrated module of the Delta AHE-50DC Open19 power shelf. I haven't been able to procure any proper documentation for it, but it seems to be a (somewhat minimally) PMBus-compliant device. It provides four fan speeds, four temperatures (three standard and one manufacturer-specific via a virtual second page), and a vin reading. Signed-off-by: Zev Weiss <zev@bewilderbeest.net> Link: https://lore.kernel.org/r/20211208213703.2577-2-zev@bewilderbeest.net Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (ntc_thermistor) Add Samsung 1404-001221 NTCLinus Walleij2021-12-261-0/+4
| | | | | | | | | | | | | | | | This adds the Samsung 1404-001221 NTC thermistor to the NTC thermistor driver. As far as I can tell it is electrically compatible with the Murata 47K NTC thermistor. This thermistor is mounted in a variety of Samsung products. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Cc: devicetree@vger.kernel.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20211215174241.1496169-1-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (ntc_thermistor) Drop OF dependencyLinus Walleij2021-12-261-1/+0
| | | | | | | | | | | The driver has been augmented to just use device properties so the OF dependency can be dropped. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20211215142933.1409324-1-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (dell-smm) Unify i8k_ioctl() and i8k_ioctl_unlocked()Armin Wolf2021-12-261-19/+9
| | | | | | | | | | | | | | | | The only purpose of i8k_ioctl() is to call i8k_ioctl_unlocked() with i8k_mutex held. Judging from the hwmon code, this mutex only needs to be held when setting the fan speed/mode, so the operation of I8K_SET_FAN is guaranteed to be atomic. Unify both functions and reduce the locking of i8k_mutex to I8K_SET_FAN. Tested on a Dell Inspiron 3505. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Reviewed-by: Pali Rohár <pali@kernel.org> Link: https://lore.kernel.org/r/20211211155422.16830-3-W_Armin@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (dell-smm) Simplify ioctl handlerArmin Wolf2021-12-261-21/+9
| | | | | | | | | | | | | | | | | | | | | The second switch-case has no real purpose: - for I8K_BIOS_VERSION, val does not represent a return value, making the check for error values unnecessary. - for I8K_MACHINE_ID, val remains zero, so the error check is unnecessary too. Remove the switch-case and move the calls to copy_to_user() into the first switch-case for I8K_BIOS_VERSION/_MACHINE_ID. Omit buff[] since data->bios_machineid already contains the string with the necessary zero padding through devm_kzalloc(). Tested on a Dell Inspiron 3505. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Reviewed-by: Pali Rohár <pali@kernel.org> Link: https://lore.kernel.org/r/20211211155422.16830-2-W_Armin@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (raspberrypi) Exit immediately in case of error in initArmin Wolf2021-12-261-3/+4
| | | | | | | | | | Exit immediately if devm_hwmon_device_register_with_info() fails since registering a delayed work whould be useless in such a case anyway. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://lore.kernel.org/r/20211211184449.18211-1-W_Armin@gmx.de Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (nct6775) delete some extension linesDan Carpenter2021-12-261-4/+2
| | | | | | | | This code can fit on one line. No need to break it up. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20211215114050.GB14967@kili Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (ntc_thermistor) Move DT matches to the driver blockLinus Walleij2021-12-261-35/+35
| | | | | | | | | | | | This moves the device tree match data toward the end of the driver which is the convention, here we can also add ACPI and similar match data in a conforming manner. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20211205235948.4167075-3-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (ntc_thermistor) Switch to generic firmware propsLinus Walleij2021-12-261-17/+19
| | | | | | | | | | | | | | | | | | | | This switches to retrieveing the configuration of the NTC from generic firmware properties so that we get neutral from device tree: now ACPI or, more importantly, software nodes can be used to spawn NTC devices provided they have the required properties. This was inspired by the similar changes made to the IIO drivers. This was tested on the Ux500 HREF with the NTC devices probing from device tree just as fine after this as before. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20211206020423.62402-2-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (ntc_thermistor) Move and refactor DT parsingLinus Walleij2021-12-261-50/+43
| | | | | | | | | | | | | | | | | Move the parsing of the DT config right above probe(). Allocate the state container for the driver in probe() instead of inside the DT config parsing function: as a result return an int instead of a pointer. Drop the check for !np: we can only probe from DT right now so no risk of ending up here. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20211206020423.62402-1-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (adm1031) Remove redundant assignment to variable rangeColin Ian King2021-12-261-2/+1
| | | | | | | | | | | Variable range is being initialized with a value that is never read, it is being re-assigned in the next statement. The assignment is redundant, remove it and initialize range using the second assigned value. Clean up the formatting too by adding missing spaces. Signed-off-by: Colin Ian King <colin.i.king@gmail.com> Link: https://lore.kernel.org/r/20211204233155.55454-1-colin.i.king@gmail.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (asus_wmi_sensors) fix an array overflowDan Carpenter2021-12-261-1/+1
| | | | | | | | | | | | | | | Smatch detects this array overflow: drivers/hwmon/asus_wmi_sensors.c:569 asus_wmi_configure_sensor_setup() error: buffer overflow 'hwmon_attributes' 8 <= 9 The hwmon_attributes[] array should have "hwmon_max" so that it gets larger when more attributes are added. Fixes: 9d07e54a25b8 ("hwmon: (asus_wmi_sensors) Support X370 Asus WMI.") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20211130105117.GH5827@kili Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (asus_wmi_ec_sensors) fix array overflowDan Carpenter2021-12-261-1/+1
| | | | | | | | | | | | | | | Smatch detected an array out of bounds error: drivers/hwmon/asus_wmi_ec_sensors.c:562 asus_wmi_ec_configure_sensor_setup() error: buffer overflow 'hwmon_attributes' 8 <= 9 The hwmon_attributes[] array needs to be declared with "hwmon_max" elements. Fixes: c04c7f7bfcbe ("hwmon: (asus_wmi_ec_sensors) Support B550 Asus WMI.") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20211130105034.GG5827@kili Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (sht4x) Add device tree match tableDavid Mosberger-Tang2021-12-261-0/+7
| | | | | | | | | This patch enables automatic loading of the sht4x module via a device tree table entry. Signed-off-by: David Mosberger-Tang <davidm@egauge.net> Link: https://lore.kernel.org/r/20211121160637.2312106-1-davidm@egauge.net Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (ntc_thermistor) Merge platform dataLinus Walleij2021-12-261-61/+48
| | | | | | | | | | | | Allocate one state container for the device: struct ntc_data. Move all items from struct ntc_thermistor_platform_data into this struct and simplify. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20211125020841.3616359-5-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (ntc_thermistor) Drop read_uv() depend on OF and IIOLinus Walleij2021-12-262-38/+16
| | | | | | | | | | | | | | | | | | | The only possible assignment of a function to get a voltage to convert to a resistance is to use the internal function ntc_adc_iio_read() which is only available when using IIO and OF. Bite the bullet and mandate OF and IIO, drop the read_uv() callback abstraction and some ifdefs. As no board is using the platform data, all users are using OF and IIO anyway. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20211125020841.3616359-4-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (ntc_thermistor) Drop get_ohm()Linus Walleij2021-12-261-19/+2
| | | | | | | | | | | | Nothing in the kernel (this driver) is using the callback to read ohms directly. We always read a voltage and convert it to a resistance. Drop this callback. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20211125020841.3616359-3-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (ntc_thermistor) Merge platform data into driverLinus Walleij2021-12-261-5/+36
| | | | | | | | | | | | | | | | | | Platform data is supposed to be used with "board files", device descriptions in C. Since the introduction of the NTC driver in 2011, no such platforms have been submitted to the Linux kernel, and their use is strongly discouraged in favor of Device Tree, ACPI or as last resort software firmware nodes. Drop the external header and copy the platform data into the driver file. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20211125020841.3616359-2-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (jc42) Add support for ONSEMI N34TS04Guenter Roeck2021-12-261-0/+4
| | | | | | N34TS04 is a JC42.4 compatible temperature sensor from ONSEMI. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (k10temp) Support up to 12 CCDs on AMD Family of processorsBabu Moger2021-12-261-3/+14
| | | | | | | | | | | | The current driver can read the temperatures from upto 8 CCDs (Core-Complex Die). The newer AMD Family 19h Models 10h-1Fh and A0h-AFh can support up to 12 CCDs. Update the driver to read up to 12 CCDs. Signed-off-by: Babu Moger <babu.moger@amd.com> Link: https://lore.kernel.org/r/163776976762.904164.5618896687524494215.stgit@bmoger-ubuntu Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (asus_wmi_sensors) Support X370 Asus WMI.Denis Pauk2021-12-263-0/+677
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provides a Linux kernel module "asus_wmi_sensors" that provides sensor readouts via ASUS' WMI interface present in the UEFI of X370/X470/B450/X399 Ryzen motherboards. Supported motherboards: * ROG CROSSHAIR VI HERO, * PRIME X399-A, * PRIME X470-PRO, * ROG CROSSHAIR VI EXTREME, * ROG CROSSHAIR VI HERO (WI-FI AC), * ROG CROSSHAIR VII HERO, * ROG CROSSHAIR VII HERO (WI-FI), * ROG STRIX B450-E GAMING, * ROG STRIX B450-F GAMING, * ROG STRIX B450-I GAMING, * ROG STRIX X399-E GAMING, * ROG STRIX X470-F GAMING, * ROG STRIX X470-I GAMING, * ROG ZENITH EXTREME, * ROG ZENITH EXTREME ALPHA. Co-developed-by: Ed Brindley <kernel@maidavale.org> Signed-off-by: Ed Brindley <kernel@maidavale.org> Signed-off-by: Denis Pauk <pauk.denis@gmail.com> [groeck: Squashed: "hwmon: Fix warnings in asus_wmi_sensors.rst documetation."] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (asus_wmi_ec_sensors) Support B550 Asus WMI.Denis Pauk2021-12-263-0/+634
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux HWMON sensors driver for ASUS motherboards to read sensors from the embedded controller. Many ASUS motherboards do not publish all the available sensors via the Super I/O chip but the missing ones are available through the embedded controller (EC) registers. This driver implements reading those sensor data via the WMI method BREC, which is known to be present in all ASUS motherboards based on the AMD 500 series chipsets (and probably is available in other models too). The driver needs to know exact register addresses for the sensors and thus support for each motherboard has to be added explicitly. The EC registers do not provide critical values for the sensors and as such they are not published to the HWMON. Supported motherboards: * PRIME X570-PRO * Pro WS X570-ACE * ROG CROSSHAIR VIII HERO * ROG CROSSHAIR VIII DARK HERO * ROG CROSSHAIR VIII FORMULA * ROG STRIX X570-E GAMING * ROG STRIX B550-I GAMING * ROG STRIX B550-E GAMING Co-developed-by: Eugene Shalygin <eugene.shalygin@gmail.com> Signed-off-by: Eugene Shalygin <eugene.shalygin@gmail.com> Co-developed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Denis Pauk <pauk.denis@gmail.com> Tested-by: Tor Vic <torvic9@mailbox.org> Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (f71882fg) Add F81966 supportMenghui Wu2021-12-261-0/+2
| | | | | | | | | | This adds hardware monitor support the Fintek F81966 Super I/O chip. Testing was done on the Aaeon SSE-IPTI Signed-off-by: Menghui Wu <Menghui_Wu@aaeon.com.tw> Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com> Link: https://lore.kernel.org/r/20211117024320.2428144-1-acelan.kao@canonical.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (adm1021) Improve detection of LM84, MAX1617, and MAX1617AGuenter Roeck2021-12-261-4/+19
| | | | | | | | The adm1021 driver is quite generous with its automatic chip detection and easily misdetects several chips. Strengthen detection of MAX1617, MAX1617A, and LM84 to make the driver less vulnerable to false matches. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (tmp401) Hide register write address differences in regmap codeGuenter Roeck2021-12-261-44/+25
| | | | | | | | | | Since we are using regmap access functions to write into chip registers, we can hide the difference in register write addresses within regmap code. By doing this we do not need to clear the regmap cache on register writes, and the high level code does not need to bother about different read/write register addresses. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (tmp401) Use regmapGuenter Roeck2021-12-262-76/+150
| | | | | | | | Use regmap for register accesses to be able to utilize its caching functionality. This also lets us hide register access differences in regmap code. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (tmp401) Convert to _info APIGuenter Roeck2021-12-261-386/+348
| | | | | | | | | The new API is cleaner and reduces code size significantly. All chip accesses are 'hidden' in chip access to prepare for using regmap. Local caching code is removed, to be replaced by regmap based caching in a follow-up patch. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (tmp401) Simplify temperature register arraysGuenter Roeck2021-12-261-28/+11
| | | | | | | | | | The difference between TMP431 and other chips of this series is that the TMP431 has an additional sensor. The register addresses for other sensors are the same for all chips. It is therefore unnecessary to maintain two different arrays for TMP431 and the other chips. Just use the same array for all chips and add the TMP431 register addresses as third column. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: Driver for Texas Instruments INA238Nathan Rossi2021-12-263-0/+657
| | | | | | | | | | The INA238 is a I2C power monitor similar to other INA2xx devices, providing shunt voltage, bus voltage, current, power and temperature measurements. Signed-off-by: Nathan Rossi <nathan.rossi@digi.com> Link: https://lore.kernel.org/r/20211102052754.817220-3-nathan@nathanrossi.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (k10temp) Add support for AMD Family 19h Models 10h-1Fh and A0h-AFhBabu Moger2021-12-261-0/+3
| | | | | | | | | Add thermal info support for AMD Family 19h Models 10h-1Fh and A0h-AFh. Thermal info is supported via a new PCI device ID at offset 0x300h. Signed-off-by: Babu Moger <babu.moger@amd.com> Link: https://lore.kernel.org/r/163640829419.955062.12539219969781039915.stgit@bmoger-ubuntu Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (k10temp) Remove unused definitionsBabu Moger2021-12-261-20/+0
| | | | | | | | | | Usage of these definitions were removed after the commit 0a4e668b5d52 ("hwmon: (k10temp) Remove support for displaying voltage and current on Zen CPUs"). So, cleanup them up. Signed-off-by: Babu Moger <babu.moger@amd.com> Link: https://lore.kernel.org/r/163640828776.955062.15863375803675701204.stgit@bmoger-ubuntu Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* Merge tag 'pinctrl-v5.16-3' of ↵Linus Torvalds2021-12-253-19/+26
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl Pull pin control fixes from Linus Walleij: "Some hopefully final pin control fixes for the v5.16 kernel: - Fix an out-of-bounds bug in the Mediatek driver - Fix an init order bug in the Broadcom BCM2835 driver - Fix a GPIO offset bug in the STM32 driver" * tag 'pinctrl-v5.16-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: pinctrl: stm32: consider the GPIO offset to expose all the GPIO lines pinctrl: bcm2835: Change init order for gpio hogs pinctrl: mediatek: fix global-out-of-bounds issue
| * pinctrl: stm32: consider the GPIO offset to expose all the GPIO linesFabien Dessenne2021-12-161-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Consider the GPIO controller offset (from "gpio-ranges") to compute the maximum GPIO line number. This fixes an issue where gpio-ranges uses a non-null offset. e.g.: gpio-ranges = <&pinctrl 6 86 10> In that case the last valid GPIO line is not 9 but 15 (6 + 10 - 1) Cc: stable@vger.kernel.org Fixes: 67e2996f72c7 ("pinctrl: stm32: fix the reported number of GPIO lines per bank") Reported-by: Christoph Fritz <chf.fritz@googlemail.com> Signed-off-by: Fabien Dessenne <fabien.dessenne@foss.st.com> Link: https://lore.kernel.org/r/20211215095808.621716-1-fabien.dessenne@foss.st.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| * pinctrl: bcm2835: Change init order for gpio hogsPhil Elwell2021-12-101-13/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...and gpio-ranges pinctrl-bcm2835 is a combined pinctrl/gpio driver. Currently the gpio side is registered first, but this breaks gpio hogs (which are configured during gpiochip_add_data). Part of the hog initialisation is a call to pinctrl_gpio_request, and since the pinctrl driver hasn't yet been registered this results in an -EPROBE_DEFER from which it can never recover. Change the initialisation sequence to register the pinctrl driver first. This also solves a similar problem with the gpio-ranges property, which is required in order for released pins to be returned to inputs. Fixes: 73345a18d464b ("pinctrl: bcm2835: Pass irqchip when adding gpiochip") Signed-off-by: Phil Elwell <phil@raspberrypi.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20211206092237.4105895-2-phil@raspberrypi.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| * pinctrl: mediatek: fix global-out-of-bounds issueGuodong Liu2021-11-241-2/+6
| | | | | | | | | | | | | | | | | | | | | | When eint virtual eint number is greater than gpio number, it maybe produce 'desc[eint_n]' size globle-out-of-bounds issue. Signed-off-by: Guodong Liu <guodong.liu@mediatek.corp-partner.google.com> Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com> Reviewed-by: Chen-Yu Tsai <wenst@chromium.org> Link: https://lore.kernel.org/r/20211110071900.4490-2-zhiyong.tao@mediatek.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | Merge tag 'hwmon-for-v5.16-rc7' of ↵Linus Torvalds2021-12-251-44/+62
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Pull hwmon fixes from Guenter Roeck: "A couple of lm90 driver fixes. None of them are critical, but they should nevertheless be fixed" * tag 'hwmon-for-v5.16-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (lm90) Do not report 'busy' status bit as alarm hwmom: (lm90) Fix citical alarm status for MAX6680/MAX6681 hwmon: (lm90) Drop critical attribute support for MAX6654 hwmon: (lm90) Prevent integer overflow/underflow in hysteresis calculations hwmon: (lm90) Fix usage of CONFIG2 register in detect function
| * | hwmon: (lm90) Do not report 'busy' status bit as alarmGuenter Roeck2021-12-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | Bit 7 of the status register indicates that the chip is busy doing a conversion. It does not indicate an alarm status. Stop reporting it as alarm status bit. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * | hwmom: (lm90) Fix citical alarm status for MAX6680/MAX6681Guenter Roeck2021-12-121-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | Tests with a real chip and a closer look into the datasheet reveals that the local and remote critical alarm status bits are swapped for MAX6680/MAX6681. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * | hwmon: (lm90) Drop critical attribute support for MAX6654Guenter Roeck2021-12-121-37/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tests with a real chip and a closer look into the datasheet show that MAX6654 does not support CRIT/THERM/OVERTEMP limits, so drop support of the respective attributes for this chip. Introduce LM90_HAVE_CRIT flag and use it to instantiate critical limit attributes to solve the problem. Cc: Josh Lehan <krellan@google.com> Fixes: 229d495d8189 ("hwmon: (lm90) Add max6654 support to lm90 driver") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * | hwmon: (lm90) Prevent integer overflow/underflow in hysteresis calculationsGuenter Roeck2021-12-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit b50aa49638c7 ("hwmon: (lm90) Prevent integer underflows of temperature calculations") addressed a number of underflow situations when writing temperature limits. However, it missed one situation, seen when an attempt is made to set the hysteresis value to MAX_LONG and the critical temperature limit is negative. Use clamp_val() when setting the hysteresis temperature to ensure that the provided value can never overflow or underflow. Fixes: b50aa49638c7 ("hwmon: (lm90) Prevent integer underflows of temperature calculations") Cc: Dmitry Osipenko <digetx@gmail.com> Reviewed-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| * | hwmon: (lm90) Fix usage of CONFIG2 register in detect functionGuenter Roeck2021-12-121-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The detect function had a comment "Make compiler happy" when id did not read the second configuration register. As it turns out, the code was checking the contents of this register for manufacturer ID 0xA1 (NXP Semiconductor/Philips), but never actually read the register. So it wasn't surprising that the compiler complained, and it indeed had a point. Fix the code to read the register contents for manufacturer ID 0xa1. At the same time, the code was reading the register for manufacturer ID 0x41 (Analog Devices), but it was not using the results. In effect it was just checking if reading the register returned an error. That doesn't really add much if any value, so stop doing that. Fixes: f90be42fb383 ("hwmon: (lm90) Refactor reading of config2 register") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* | | Merge branch 'for-linus' of ↵Linus Torvalds2021-12-259-37/+149
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input Pull input fixes from Dmitry Torokhov: "A few small updates to drivers. Of note we are now deferring probes of i8042 on some Asus devices as the controller is not ready to respond to queries first time around when the driver is compiled into the kernel" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: Input: elants_i2c - do not check Remark ID on eKTH3900/eKTH5312 Input: atmel_mxt_ts - fix double free in mxt_read_info_block Input: goodix - fix memory leak in goodix_firmware_upload Input: goodix - add id->model mapping for the "9111" model Input: goodix - try not to touch the reset-pin on x86/ACPI devices Input: i8042 - enable deferred probe quirk for ASUS UM325UA Input: elantech - fix stack out of bound access in elantech_change_report_id() Input: iqs626a - prohibit inlining of channel parsing functions Input: i8042 - add deferred probe support
| * | | Input: elants_i2c - do not check Remark ID on eKTH3900/eKTH5312Johnny Chuang2021-12-201-1/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The eKTH3900/eKTH5312 series do not support the firmware update rules of Remark ID. Exclude these two series from checking it when updating the firmware in touch controllers. Signed-off-by: Johnny Chuang <johnny.chuang.emc@gmail.com> Link: https://lore.kernel.org/r/1639619603-20616-1-git-send-email-johnny.chuang.emc@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
| * | | Input: atmel_mxt_ts - fix double free in mxt_read_info_blockJosé Expósito2021-12-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "id_buf" buffer is stored in "data->raw_info_block" and freed by "mxt_free_object_table" in case of error. Return instead of jumping to avoid a double free. Addresses-Coverity-ID: 1474582 ("Double free") Fixes: 068bdb67ef74 ("Input: atmel_mxt_ts - fix the firmware update") Signed-off-by: José Expósito <jose.exposito89@gmail.com> Link: https://lore.kernel.org/r/20211212194257.68879-1-jose.exposito89@gmail.com Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
| * | | Input: goodix - fix memory leak in goodix_firmware_uploadJosé Expósito2021-12-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Addresses-Coverity-ID: 1493934 ("Resource leak") Signed-off-by: José Expósito <jose.exposito89@gmail.com> Link: https://lore.kernel.org/r/20211208173321.26659-1-jose.exposito89@gmail.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
| * | | Input: goodix - add id->model mapping for the "9111" modelHans de Goede2021-12-061-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add d->model mapping for the "9111" model, this fixes uses using a wrong config_len of 240 bytes while the "9111" model uses only 186 bytes of config. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20211206164747.197309-2-hdegoede@redhat.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
| * | | Input: goodix - try not to touch the reset-pin on x86/ACPI devicesHans de Goede2021-12-062-5/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unless the controller is not responding at boot or after suspend/resume, the driver never resets the controller on x86/ACPI platforms. The driver still requesting the reset pin at probe() though in case it needs it. Until now the driver has always requested the reset pin with GPIOD_IN as type. The idea being to put the pin in high-impedance mode to save power until the driver actually wants to issue a reset. But this means that just requesting the pin can cause issues, since requesting it in another mode then GPIOD_ASIS may cause the pinctrl driver to touch the pin settings. We have already had issues before due to a bug in the pinctrl-cherryview.c driver which has been fixed in commit 921daeeca91b ("pinctrl: cherryview: Preserve CHV_PADCTRL1_INVRXTX_TXDATA flag on GPIOs"). And now it turns out that requesting the reset-pin as GPIOD_IN also stops the touchscreen from working on the GPD P2 max mini-laptop. The behavior of putting the pin in high-impedance mode relies on there being some external pull-up to keep it high and there seems to be no pull-up on the GPD P2 max, causing things to break. This commit fixes this by requesting the reset pin as is when using the x86/ACPI code paths to lookup the GPIOs; and by not dropping it back into input-mode in case the driver does end up issuing a reset for error-recovery. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=209061 Fixes: a7d4b171660c ("Input: goodix - add support for getting IRQ + reset GPIOs on Cherry Trail devices") Cc: stable@vger.kernel.org Signed-off-by: Hans de Goede <hdegoede@redhat.com> Link: https://lore.kernel.org/r/20211206091116.44466-2-hdegoede@redhat.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>