linux/drivers/power
Linus Walleij 50da8d04ee power: supply: max8903: Convert to GPIO descriptors
The MAX8903 uses up to 5 different GPIO lines to control and
monitor charging.

When converting to use GPIO descriptors instead of the old
GPIO numbers the following side-refactorings were done:

- Decomission the platform data container struct as all
  GPIO descriptors are now "live" members of the driver
  state container. The "dc_valid" and "usb_valid" just
  indicate the presence of a DC or USB charger detection
  line, and this can be handled by just checking if
  the optional GPIO descriptor for each is != NULL.

- The gpiolib will now respect the GPIO_ACTIVE_LOW flag
  for each of the lines, meaning gpiod_get_value() for example
  will return 1 (asserted) if a line is flagged as
  active low and is also physically low. The same applies
  to output lines, vice versa mutatis mutandis. The code
  has been augmented to account for this in all sites.

- The terse parenthesis such as this:
    gpio_set_value(pdata->cen, ta_in ? 0 :
                     (data->usb_in ? 0 : 1));
  have been expanded to more readable if / else if / else
  statements that are easier for humans to read.

- Comments were inserted to underscore polarity in each
  case where it could be confusing to users of the old code.

One thing is notable: the device tree bindings does not show
an example of polarity assigned for the line "dcm-gpios"
DC current monitor, is assumed to be flagged GPIO_ACTIVE_HIGH
and driving it high (asserted) will achieve DC charger current
limits and driving it low will achieve USB charger current
limits. Device trees with this (optional) GPIO line defined
should definately be flagged as GPIO_ACTIVE_HIGH.

Cc: Chris Lapa <chris@lapa.com.au>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2021-01-12 23:23:49 +01:00
..
reset power: reset: linkstation-poweroff: add missing put_device() 2020-12-29 15:59:49 +01:00
supply power: supply: max8903: Convert to GPIO descriptors 2021-01-12 23:23:49 +01:00
Kconfig PM: AVS: Drop the avs directory and the corresponding Kconfig 2020-10-22 18:39:32 +02:00
Makefile PM: AVS: Drop the avs directory and the corresponding Kconfig 2020-10-22 18:39:32 +02:00