summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/pmbus/max20730.c
Commit message (Collapse)AuthorAgeFilesLines
* hwmon: (pmbus) Introduce PMBUS symbol namespaceGuenter Roeck2021-04-201-0/+1
| | | | | | | Exported pmbus symbols are only supposed to be used from PMBus code. Introduce PMBUS symbol namespace to prevent misuse from other code. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) shrink code and remove pmbus_do_remove()Bartosz Golaszewski2020-12-021-1/+0
| | | | | | | | | | | The only action currently performed in pmbus_do_remove() is removing the debugfs hierarchy. We can schedule a devm action at probe time and remove pmbus_do_remove() entirely from all pmbus drivers. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Link: https://lore.kernel.org/r/20201026105352.20359-1-brgl@bgdev.pl [groeck: Removed references to pmbus_do_remove from documentation] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus/max20730) delete some dead codeDan Carpenter2020-12-021-2/+0
| | | | | | | | | | | | | | The debugfs_create_dir() function never returns NULL. Normal users are not supposed to check the return value so the correct fix is just to delete this check. In the case where the debugfs_create_dir() fails, the function returns NULL. The other debugfs function check for NULL directory and handle it. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20201022070659.GA2817762@mwanda Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus/max20730) use scnprintf() instead of snprintf()Dan Carpenter2020-10-261-13/+13
| | | | | | | | | | | | | The snprintf() function returns the number of characters which would have been printed if there were enough space, but the scnprintf() returns the number of characters which were actually printed. If the buffer is not large enough, then using snprintf() would result in a read overflow and an information leak. Fixes: 8910c0bd533d ("hwmon: (pmbus/max20730) add device monitoring via debugfs") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20201022070824.GC2817762@mwanda Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus/max20730) adjust the vout reading given voltage dividerChu Lin2020-10-061-0/+18
| | | | | | | | | | | | | | | | | | | | Problem: We use voltage dividers so that the voltage presented at the voltage sense pins is confusing. We might need to convert these readings to more meaningful readings given the voltage divider. Solution: Read the voltage divider resistance from dts and convert the voltage reading to a more meaningful reading. Testing: max20730 with voltage divider Signed-off-by: Chu Lin <linchuyuan@google.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20201004031445.2321090-3-linchuyuan@google.com [groeck: Return -EINVAL instead of -ENODEV on bad deevicetree data] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus/max20730) add device monitoring via debugfsUgur Usug2020-10-051-1/+362
| | | | | | | | | | | | Add debugfs interface support for accessing device specific registers (MFR_VOUT_MIN, MFR_DEVSET1 and MFR_DEVSET2) and others including OPERATION, ON_OFF_CONFIG, SMB_ALERT_MASK, VOUT_MODE, VOUT_COMMAND and VOUT_MAX. Signed-off-by: Ugur Usug <ugur.usug@maximintegrated.com> Link: https://lore.kernel.org/r/MWHPR11MB1965C01083AD013C630646B2FD3B0@MWHPR11MB1965.namprd11.prod.outlook.com [groeck: Resolved conflics seen due to PMBus driver API changes] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon (pmbus) use simple i2c probe functionStephen Kitt2020-09-231-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | pmbus_do_probe doesn't use the id information provided in its second argument, so this can be removed, which then allows using the single-parameter i2c probe function ("probe_new") for probes. This avoids scanning the identifier tables during probes. Drivers which didn't use the id are converted as-is; drivers which did are modified as follows: * if the information in i2c_client is sufficient, that's used instead (client->name); * configured v. probed comparisons are performed by comparing the configured name to the detected name, instead of the ids; this involves strcmp but is still cheaper than comparing all the device names when scanning the tables; * anything else is handled by calling i2c_match_id() with the same level of error-handling (if any) as before. Additionally, the mismatch message in the ltc2978 driver is adjusted so that it no longer assumes that the driver_data is an index into ltc2978_id. Signed-off-by: Stephen Kitt <steve@sk2.org> Acked-by: Wolfram Sang <wsa@kernel.org> Link: https://lore.kernel.org/r/20200808210004.30880-1-steve@sk2.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus/max20730) Add max20710 supportUgur Usug2020-07-241-6/+43
| | | | | | | | | Add support for max20710 into the existing max20730 driver. Signed-off-by: Ugur Usug <ugur.usug@maximintegrated.com> Link: https://lore.kernel.org/r/BYAPR11MB317423C13909AE6F1913BBD7FD9C0@BYAPR11MB3174.namprd11.prod.outlook.com [groeck: Fixed various whitespace errors] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Add 'phase' parameter where needed for multi-phase supportGuenter Roeck2020-03-081-1/+2
| | | | | | | | | In preparation for multi-phase support, add 'phase' parameter to read_word and set_page functions. Actual multi-phase support will be added in a subsequent patch. Cc: Vadim Pasternak <vadimp@mellanox.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
* hwmon: (pmbus) Driver for MAX20730, MAX20734, and MAX20743Guenter Roeck2020-01-231-0/+372
Add support for Maxim MAX20730, MAX20734, MAX20743 Integrated, Step-Down Switching Regulators with PMBus support. Signed-off-by: Guenter Roeck <linux@roeck-us.net>