mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-25 05:34:00 +08:00
Immutable branch between arm and power-supply for gpio-charger for 5.10
This immutable branch drops legacy gpio API from gpio-charger and updates the remaining users to the new gpiod API instead. Signed-off-by: Sebastian Reichel <sre@kernel.org> -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAl9H0T8ACgkQ2O7X88g7 +poL9A//X+8A8rX4wsZt1SQCwWVjRnikaluhJpbo24lq4GGolsiTJtV+efk5u3wT SoNOZboUBF7Fr9EoNCh203eGr3Z1vG8q+a7DFa41wSb8N5SQSjDECzbwFwMudXMo uPwQ21ETQHIyOk6J/fuoQnjpZ9h2ytPgX7gAh6DyDNiz0cdFlLezkewQEmHPq7Ni GBPzHuFE3+jGu28Od3FevhP5WnRnAq5sbP6I0KGq1Bbt7FB5N9MKa9j+ZBVcAvHj VIH1SVeNjYY7fw3Zr6Qtn0FwDh+p0bzMGCmwtnFvsDzh2mWaMF4imKoGctSIkopl 5559885mwCDEtTeGO3s38cBNyMKBxNEX+hUN3O82UWf0VcVP97IaFsv0s2TyVg/z N3punW6fEBfyQFs+otefQ/AONL6PfxK2bqfu+zJigVXuWaOTS8k3svYGbo5e4oKV 1Eaj6yH5LWqWdbTg6FZG7zSJJUjEDHXIb+wMaQJHoZXErrqRvdJz89rp0gw7pX3/ oL0Qj1LKMDYya5YSYF+1k5ykQ9SZYy1aDCex7PYY8Nz5X3phwVqTXcG9SRgduG+U m+1DDzw0pn7zG3LRAhXKRxj+9Yy+0DgTMRZ3AbYToS/7+r6o77FrFgud7JUBgHcW ZXah7mWdb3uadv6Rb98aNtDmsWtZnwrcY+T2Q86b8Nw3ApLFnT8= =RhVS -----END PGP SIGNATURE----- Merge tag 'psy-arm-gpio-charger-immutable-for-5.10-signed' into psy-next Immutable branch between arm and power-supply for gpio-charger for 5.10 This immutable branch drops legacy gpio API from gpio-charger and updates the remaining users to the new gpiod API instead. Signed-off-by: Sebastian Reichel <sre@kernel.org>
This commit is contained in:
commit
39e95bbbac
@ -369,6 +369,15 @@ static struct pxaficp_platform_data tosa_ficp_platform_data = {
|
||||
/*
|
||||
* Tosa AC IN
|
||||
*/
|
||||
static struct gpiod_lookup_table tosa_power_gpiod_table = {
|
||||
.dev_id = "gpio-charger",
|
||||
.table = {
|
||||
GPIO_LOOKUP("gpio-pxa", TOSA_GPIO_AC_IN,
|
||||
NULL, GPIO_ACTIVE_LOW),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static char *tosa_ac_supplied_to[] = {
|
||||
"main-battery",
|
||||
"backup-battery",
|
||||
@ -378,8 +387,6 @@ static char *tosa_ac_supplied_to[] = {
|
||||
static struct gpio_charger_platform_data tosa_power_data = {
|
||||
.name = "charger",
|
||||
.type = POWER_SUPPLY_TYPE_MAINS,
|
||||
.gpio = TOSA_GPIO_AC_IN,
|
||||
.gpio_active_low = 1,
|
||||
.supplied_to = tosa_ac_supplied_to,
|
||||
.num_supplicants = ARRAY_SIZE(tosa_ac_supplied_to),
|
||||
};
|
||||
@ -951,6 +958,7 @@ static void __init tosa_init(void)
|
||||
clk_add_alias("CLK_CK3P6MI", tc6393xb_device.name, "GPIO11_CLK", NULL);
|
||||
|
||||
gpiod_add_lookup_table(&tosa_udc_gpiod_table);
|
||||
gpiod_add_lookup_table(&tosa_power_gpiod_table);
|
||||
platform_add_devices(devices, ARRAY_SIZE(devices));
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include <linux/gpio_keys.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/gpio/machine.h>
|
||||
#include <linux/power/gpio-charger.h>
|
||||
|
||||
#include <video/sa1100fb.h>
|
||||
@ -131,16 +132,23 @@ static struct irda_platform_data collie_ir_data = {
|
||||
/*
|
||||
* Collie AC IN
|
||||
*/
|
||||
static struct gpiod_lookup_table collie_power_gpiod_table = {
|
||||
.dev_id = "gpio-charger",
|
||||
.table = {
|
||||
GPIO_LOOKUP("gpio", COLLIE_GPIO_AC_IN,
|
||||
NULL, GPIO_ACTIVE_HIGH),
|
||||
{ },
|
||||
},
|
||||
};
|
||||
|
||||
static char *collie_ac_supplied_to[] = {
|
||||
"main-battery",
|
||||
"backup-battery",
|
||||
};
|
||||
|
||||
|
||||
static struct gpio_charger_platform_data collie_power_data = {
|
||||
.name = "charger",
|
||||
.type = POWER_SUPPLY_TYPE_MAINS,
|
||||
.gpio = COLLIE_GPIO_AC_IN,
|
||||
.supplied_to = collie_ac_supplied_to,
|
||||
.num_supplicants = ARRAY_SIZE(collie_ac_supplied_to),
|
||||
};
|
||||
@ -386,6 +394,8 @@ static void __init collie_init(void)
|
||||
|
||||
platform_scoop_config = &collie_pcmcia_config;
|
||||
|
||||
gpiod_add_lookup_table(&collie_power_gpiod_table);
|
||||
|
||||
ret = platform_add_devices(devices, ARRAY_SIZE(devices));
|
||||
if (ret) {
|
||||
printk(KERN_WARNING "collie: Unable to register LoCoMo device\n");
|
||||
|
@ -5,7 +5,6 @@
|
||||
*/
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/gpio.h> /* For legacy platform data */
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/kernel.h>
|
||||
@ -131,7 +130,6 @@ static int gpio_charger_probe(struct platform_device *pdev)
|
||||
struct power_supply_desc *charger_desc;
|
||||
struct gpio_desc *charge_status;
|
||||
int charge_status_irq;
|
||||
unsigned long flags;
|
||||
int ret;
|
||||
int num_props = 0;
|
||||
|
||||
@ -149,29 +147,7 @@ static int gpio_charger_probe(struct platform_device *pdev)
|
||||
* boardfile descriptor tables. It's good to try this first.
|
||||
*/
|
||||
gpio_charger->gpiod = devm_gpiod_get_optional(dev, NULL, GPIOD_IN);
|
||||
|
||||
/*
|
||||
* Fallback to legacy platform data method, if no GPIO is specified
|
||||
* using boardfile descriptor tables.
|
||||
*/
|
||||
if (!gpio_charger->gpiod && pdata) {
|
||||
/* Non-DT: use legacy GPIO numbers */
|
||||
if (!gpio_is_valid(pdata->gpio)) {
|
||||
dev_err(dev, "Invalid gpio pin in pdata\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
flags = GPIOF_IN;
|
||||
if (pdata->gpio_active_low)
|
||||
flags |= GPIOF_ACTIVE_LOW;
|
||||
ret = devm_gpio_request_one(dev, pdata->gpio, flags,
|
||||
dev_name(dev));
|
||||
if (ret) {
|
||||
dev_err(dev, "Failed to request gpio pin: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
/* Then convert this to gpiod for now */
|
||||
gpio_charger->gpiod = gpio_to_desc(pdata->gpio);
|
||||
} else if (IS_ERR(gpio_charger->gpiod)) {
|
||||
if (IS_ERR(gpio_charger->gpiod)) {
|
||||
/* Just try again if this happens */
|
||||
return dev_err_probe(dev, PTR_ERR(gpio_charger->gpiod),
|
||||
"error getting GPIO descriptor\n");
|
||||
|
@ -13,18 +13,12 @@
|
||||
* struct gpio_charger_platform_data - platform_data for gpio_charger devices
|
||||
* @name: Name for the chargers power_supply device
|
||||
* @type: Type of the charger
|
||||
* @gpio: GPIO which is used to indicate the chargers status
|
||||
* @gpio_active_low: Should be set to 1 if the GPIO is active low otherwise 0
|
||||
* @supplied_to: Array of battery names to which this chargers supplies power
|
||||
* @num_supplicants: Number of entries in the supplied_to array
|
||||
*/
|
||||
struct gpio_charger_platform_data {
|
||||
const char *name;
|
||||
enum power_supply_type type;
|
||||
|
||||
int gpio;
|
||||
int gpio_active_low;
|
||||
|
||||
char **supplied_to;
|
||||
size_t num_supplicants;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user