summaryrefslogtreecommitdiff
path: root/drivers/power/supply/ucs1002_power.c
AgeCommit message (Collapse)AuthorFilesLines
2023-09-14power: supply: ucs1002: fix error code in ucs1002_get_property()Dan Carpenter1-1/+2
This function is supposed to return 0 for success instead of returning the val->intval. This makes it the same as the other case statements in this function. Fixes: 81196e2e57fc ("power: supply: ucs1002: fix some health status issues") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Link: https://lore.kernel.org/r/687f64a4-4c6e-4536-8204-98ad1df934e5@moroto.mountain Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2023-06-04power: supply: Switch i2c drivers back to use .probe()Uwe Kleine-König1-1/+1
After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type"), all drivers being converted to .probe_new() and then 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert back to (the new) .probe() to be able to eventually drop .probe_new() from struct i2c_driver. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-11-20power: supply: ucs1002: Convert to i2c's .probe_new()Uwe Kleine-König1-3/+2
The probe function doesn't make use of the i2c_device_id * parameter so it can be trivially converted. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-10-01power: supply: ucs1002: fix some health status issuesLucas Stach1-32/+43
Some fault events like the over-current condition will get resolved by the hardware, by e.g. disabling the port. As the status in the interrupt status register is cleared on read when the fault is resolved, the sysfs health property will only contain the correct health status for the first time it is read after such an event, even if the actual fault condition (like a VBUS short) still persists. To reflect this properly in the property we cache the last health status and only update the cache when a actual change happens, i.e. the ERR bit in the status register flips, as this one properly reflects a continued fault condition. The ALERT pin however, is not driven by the ERR status, but by the actual fault status, so the pin will change back to it's default state when the hardware has automatically resolved the fault by cutting the power. Thus we never get an IRQ when the actual fault condition has been resolved and the ERR status bit has been cleared in auto-recovery mode. To get this information we need to poll the interrupt status register after some time to see if the fault is gone and update our cache in that case. To avoid any additional locking, we handle both paths (IRQ firing and delayed polling) through the same single-threaded delayed work. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-01-15power: suppy: ucs1002: Make the symbol 'ucs1002_regulator_enable' staticChen Wandun1-1/+1
Fix the following sparse warning: drivers/power/supply/ucs1002_power.c:492:5: warning: symbol 'ucs1002_regulator_enable' was not declared. Should it be static? Fixes: a3d70dacc727 ("power: suppy: ucs1002: disable power when max current is 0") Signed-off-by: Chen Wandun <chenwandun@huawei.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2019-12-19power: suppy: ucs1002: disable power when max current is 0Lucas Stach1-4/+38
For some devices userspace needs the ability to completely cut the power to the USB devices connected to the charge controller. An easy way to achieve this is by allowing 0 as a valid max current and forcibly disable the output in that case, as well as enable it again if the regulator is in use and a non-0 max current is set. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Tested-by: Chris Healy <cphealy@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2019-06-26power: supply: fix semicolon.cocci warningskbuild test robot1-1/+1
drivers/power/supply/ucs1002_power.c:339:2-3: Unneeded semicolon Remove unneeded semicolon. Generated by: scripts/coccinelle/misc/semicolon.cocci Fixes: 9a2688e42638 ("power: supply: Add driver for Microchip UCS1002") CC: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: kbuild test robot <lkp@intel.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2019-05-09power: supply: ucs1002: Fix wrong return value checkingAxel Lin1-2/+2
Fix wrong return value checking for devm_regulator_register and devm_regmap_init_i2c. This looks like a copy-n-paste mistake. Fixes: 9a2688e42638 ("power: supply: Add driver for Microchip UCS1002") Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2019-05-03power: supply: Add driver for Microchip UCS1002Andrey Smirnov1-0/+646
Add driver for Microchip UCS1002 Programmable USB Port Power Controller with Charger Emulation. The driver exposed a power supply device to control/monitor various parameter of the device as well as a regulator to allow controlling VBUS line. Signed-off-by: Enric Balletbo Serra <enric.balletbo@collabora.com> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Cc: Chris Healy <cphealy@gmail.com> Cc: Lucas Stach <l.stach@pengutronix.de> Cc: Fabio Estevam <festevam@gmail.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>