aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/supply/axp20x_usb_power.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-05-15power: supply: axp20x_usb_power: Drop unnecessary staticJulia Lawall1-1/+1
Drop static on a local variable, when the variable is either first initialized or never used, on every possible execution path through the function. The static has no benefit, and dropping it reduces the code size. The semantic patch that fixes this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @bad exists@ position p; identifier x; type T; @@ static T x@p; ... x = <+...x...+> @@ identifier x; expression e; type T; position p != bad.p; @@ -static T x@p; ... when != x when strict ?x = e; // </smpl> The change in code size is indicates by the following output from the size command. before: text data bss dec hex filename 2865 252 8 3125 c35 drivers/power/supply/axp20x_usb_power.o after: text data bss dec hex filename 2822 252 0 3074 c02 drivers/power/supply/axp20x_usb_power.o Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-01-29power: supply: axp20x_usb_power: use IIO channels when availableQuentin Schulz1-4/+66
The X-Powers AXP20X PMIC exposes the current current and voltage measures via an internal ADC. This adds the possibility to read IIO channels directly for processed values rather than reading the registers and computing the value. For backward compatibility purpose, if the IIO driver is not compiled, this driver will fall back on previous behaviour which is direct register readings. Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-12power: supply: axp20x_usb_power: fix warning on 64bitMichal Suchanek1-2/+3
Casting of_device_get_match_data return value to int causes warning on 64bit architectures. ../drivers/power/supply/axp20x_usb_power.c: In function 'axp20x_usb_power_probe': ../drivers/power/supply/axp20x_usb_power.c:297:21: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] Fixes: 0dcc70ca8644 ("power: supply: axp20x_usb_power: use of_device_id data field instead of device_is_compatible") Signed-off-by: Michal Suchanek <msuchanek@suse.de> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04power: supply: axp20x_usb_power: add 100mA max current limit for AXP223Quentin Schulz1-5/+8
The X-Powers AXP223 shares most of its behaviour with the AXP221 PMIC but allows the VBUS power supply max current to be set to 100mA (like the AXP209 PMIC). This basically adds a new compatible to the VBUS power supply driver and adds a check on the compatible when setting current max limit. Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04power: supply: axp20x_usb_power: set min voltage and max current from sysfsQuentin Schulz1-0/+81
AXP20X and AXP22X PMICs allow setting the min voltage and max current of VBUS power supply. This adds entries in sysfs to allow to do so. Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04power: supply: axp20x_usb_power: use of_device_id data field instead of device_is_compatibleQuentin Schulz1-11/+15
This replaces calls to of_device_is_compatible to check data field of of_device_id matched when probing the driver. Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-11power: move power supply drivers to power/supplySebastian Reichel1-0/+294
This moves all power supply drivers from drivers/power/ to drivers/power/supply/. The intention is a cleaner source tree, since drivers/power/ also contains frameworks unrelated to power supply, like adaptive voltage scaling. Signed-off-by: Sebastian Reichel <sre@kernel.org>