diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-11 07:20:17 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-11 07:20:17 -0700 |
commit | 883cad5ba8cc2d9b740b4ad0a8a91063c99c75a3 (patch) | |
tree | f91886f6747bbcf239c42cd1c8d55f86f546e8e7 /drivers/mfd | |
parent | 8d08c0554244f95076cfe2a722e5207d974cd92d (diff) | |
parent | 556c242045f0c1613aac2e64dc5b2ff0e4bc89e1 (diff) | |
download | linux-883cad5ba8cc2d9b740b4ad0a8a91063c99c75a3.tar.gz linux-883cad5ba8cc2d9b740b4ad0a8a91063c99c75a3.tar.bz2 linux-883cad5ba8cc2d9b740b4ad0a8a91063c99c75a3.zip |
Merge tag 'mfd-next-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD updates from Lee Jones:
"New Device Support:
- Add support for AXP813 ADC to AXP20x
- Add support for PM8005, PM8998 and PMI8998
New Functionality:
- Add support for Battery Power Supply to AXP813
- Add support for SYSCON to SPARD SC27XX SPI
- Add support for RTC to ChromeOS Embedded-Controller
Fix-ups:
- Remove unused code; exynos{4,5}-pmu, cros_ec, cros_ec_acpi_gpe
- Remove duplicate error messages (-ENOMEM, etc); htc-i2cpld,
janz-cmodio, max8997, rc5t583, sm501, smsc-ece1099, abx500-core,
si476x-i2c, ti_am335x_tscadc, tps65090, tps6586x, tps65910,
tps80031, twl6030-irq, viperboard
- Succinctly use ptr to struct in sizeof(); rc5t583, abx500-core,
sm501, smsc-ece1099
- Simplify syntax for NULL ptr checking; abx500-core, sm501
- No not unnecessarily initialise variables; tps65910, tps65910
- Reorganise and simplify driver data; omap-usb-tll
- Move to SPDX license statement; tps68470
- Probe ADCs via DT; axp20x
- Use new GPIOD API; arizona-core
- Constify things; axp20x
- Reduce code-size (use MACROS, etc); axp20x, omap-usb-host
- Add DT support/docs; motorola-cpcap
- Remove VLAs; rave-sp
- Use devm_* managed resources; cros_ec
- Interrogate HW for firmware version; rave-sp
- Provide ACPI support for ChromeOS Embedded-Controller
Bug Fixes:
- Reorder ordered (enum) device list; tps65218
- Only accept valid data from the offset; rave-sp
- Refrain from copying junk from failed SPI read; cros_ec_dev
- Fix potential memory leaks; pcf50633-core
- Fix clock initialisation; twl-core
- Fix build-issue; tps65911
- Fix off-by-one error; tps65911
- Fix code ordering issues; intel-lpss
- Fix COMPILE_TEST related issues; pwm-stm32
- Fix broken MMC card detection; asic3
- Fix clocking related issues; intel-lpss-pci"
* tag 'mfd-next-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (84 commits)
mfd: cros_ec: Remove unused __remove function
mfd: wm97xx-core: Platform data can be NULL
mfd: cros_ec_dev: Don't advertise junk features on failure
mfd: cros_ec: Use devm_kzalloc for private data
mfd: intel-lpss: Fix Intel Cannon Lake LPSS I2C input clock
mfd: asic3: Fix broken MMC card detection
mfd: timberdale: Fix spelling mistake "Uknown" -> "Unknown"
mfd: omap-usb-host: Use match_string() helper
mfd: stm32-timers: Fix pwm-stm32 linker issue with COMPILE_TEST
pwm: stm32: Initialize raw local variables
mfd: arizona: Update DT doc to support more standard Reset binding
dt-bindings: mfd: Add bindings for DA9063L
mfd: intel-lpss: Correct names of RESETS register bits
mfd: qcom-spmi-pmic: Add support for pm8005, pm8998 and pmi8998
mfd: intel-lpss: Program REMAP register in PIO mode
mfd: cros_ec_i2c: Moving the system sleep pm ops to late
mfd: cros_ec_i2c: Add ACPI module device table
mfd: cros_ec_dev: Register shutdown function for debugfs
mfd: cros_ec_dev: Register cros-ec-rtc driver as a subdevice
mfd: cros_ec: Don't try to grab log when suspended
...
Diffstat (limited to 'drivers/mfd')
43 files changed, 735 insertions, 894 deletions
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index d9d2cf0d32ef..e9fd20dba18d 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -13,7 +13,6 @@ obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o obj-$(CONFIG_MFD_BD9571MWV) += bd9571mwv.o cros_ec_core-objs := cros_ec.o -cros_ec_core-$(CONFIG_ACPI) += cros_ec_acpi_gpe.o obj-$(CONFIG_MFD_CROS_EC) += cros_ec_core.o obj-$(CONFIG_MFD_CROS_EC_I2C) += cros_ec_i2c.o obj-$(CONFIG_MFD_CROS_EC_SPI) += cros_ec_spi.o diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index 8ba41073dd89..831a1ceb2ed2 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c @@ -2519,11 +2519,10 @@ static ssize_t ab8500_subscribe_write(struct file *file, if (!dev_attr[irq_index]) return -ENOMEM; - event_name[irq_index] = kmalloc(count, GFP_KERNEL); + event_name[irq_index] = kasprintf(GFP_KERNEL, "%lu", user_val); if (!event_name[irq_index]) return -ENOMEM; - sprintf(event_name[irq_index], "%lu", user_val); dev_attr[irq_index]->show = show_irq; dev_attr[irq_index]->store = NULL; dev_attr[irq_index]->attr.name = event_name[irq_index]; diff --git a/drivers/mfd/abx500-core.c b/drivers/mfd/abx500-core.c index 0d3846a4767c..f282d39a5917 100644 --- a/drivers/mfd/abx500-core.c +++ b/drivers/mfd/abx500-core.c @@ -37,15 +37,12 @@ int abx500_register_ops(struct device *dev, struct abx500_ops *ops) { struct abx500_device_entry *dev_entry; - dev_entry = devm_kzalloc(dev, - sizeof(struct abx500_device_entry), - GFP_KERNEL); - if (!dev_entry) { - dev_err(dev, "register_ops kzalloc failed"); + dev_entry = devm_kzalloc(dev, sizeof(*dev_entry), GFP_KERNEL); + if (!dev_entry) return -ENOMEM; - } + dev_entry->dev = dev; - memcpy(&dev_entry->ops, ops, sizeof(struct abx500_ops)); + memcpy(&dev_entry->ops, ops, sizeof(*ops)); list_add_tail(&dev_entry->list, &abx500_list); return 0; @@ -68,7 +65,7 @@ int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg, struct abx500_ops *ops; lookup_ops(dev->parent, &ops); - if ((ops != NULL) && (ops->set_register != NULL)) + if (ops && ops->set_register) return ops->set_register(dev, bank, reg, value); else return -ENOTSUPP; @@ -81,7 +78,7 @@ int abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg, struct abx500_ops *ops; lookup_ops(dev->parent, &ops); - if ((ops != NULL) && (ops->get_register != NULL)) + if (ops && ops->get_register) return ops->get_register(dev, bank, reg, value); else return -ENOTSUPP; @@ -94,7 +91,7 @@ int abx500_get_register_page_interruptible(struct device *dev, u8 bank, struct abx500_ops *ops; lookup_ops(dev->parent, &ops); - if ((ops != NULL) && (ops->get_register_page != NULL)) + if (ops && ops->get_register_page) return ops->get_register_page(dev, bank, first_reg, regvals, numregs); else @@ -108,7 +105,7 @@ int abx500_mask_and_set_register_interruptible(struct device *dev, u8 bank, struct abx500_ops *ops; lookup_ops(dev->parent, &ops); - if ((ops != NULL) && (ops->mask_and_set_register != NULL)) + if (ops && ops->mask_and_set_register) return ops->mask_and_set_register(dev, bank, reg, bitmask, bitvalues); else @@ -121,7 +118,7 @@ int abx500_get_chip_id(struct device *dev) struct abx500_ops *ops; lookup_ops(dev->parent, &ops); - if ((ops != NULL) && (ops->get_chip_id != NULL)) + if (ops && ops->get_chip_id) return ops->get_chip_id(dev); else return -ENOTSUPP; @@ -133,7 +130,7 @@ int abx500_event_registers_startup_state_get(struct device *dev, u8 *event) struct abx500_ops *ops; lookup_ops(dev->parent, &ops); - if ((ops != NULL) && (ops->event_registers_startup_state_get != NULL)) + if (ops && ops->event_registers_startup_state_get) return ops->event_registers_startup_state_get(dev, event); else return -ENOTSUPP; @@ -145,7 +142,7 @@ int abx500_startup_irq_enabled(struct device *dev, unsigned int irq) struct abx500_ops *ops; lookup_ops(dev->parent, &ops); - if ((ops != NULL) && (ops->startup_irq_enabled != NULL)) + if (ops && ops->startup_irq_enabled) return ops->startup_irq_enabled(dev, irq); else return -ENOTSUPP; diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index 77875250abe5..83f1c5a516d9 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c @@ -13,13 +13,12 @@ #include <linux/clk.h> #include <linux/delay.h> #include <linux/err.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/interrupt.h> #include <linux/mfd/core.h> #include <linux/module.h> #include <linux/of.h> #include <linux/of_device.h> -#include <linux/of_gpio.h> #include <linux/pm_runtime.h> #include <linux/regmap.h> #include <linux/regulator/consumer.h> @@ -279,7 +278,7 @@ static int arizona_wait_for_boot(struct arizona *arizona) static inline void arizona_enable_reset(struct arizona *arizona) { if (arizona->pdata.reset) - gpio_set_value_cansleep(arizona->pdata.reset, 0); + gpiod_set_raw_value_cansleep(arizona->pdata.reset, 0); } static void arizona_disable_reset(struct arizona *arizona) @@ -295,7 +294,7 @@ static void arizona_disable_reset(struct arizona *arizona) break; } - gpio_set_value_cansleep(arizona->pdata.reset, 1); + gpiod_set_raw_value_cansleep(arizona->pdata.reset, 1); usleep_range(1000, 5000); } } @@ -799,14 +798,27 @@ static int arizona_of_get_core_pdata(struct arizona *arizona) struct arizona_pdata *pdata = &arizona->pdata; int ret, i; - pdata->reset = of_get_named_gpio(arizona->dev->of_node, "wlf,reset", 0); - if (pdata->reset == -EPROBE_DEFER) { - return pdata->reset; - } else if (pdata->reset < 0) { - dev_err(arizona->dev, "Reset GPIO missing/malformed: %d\n", - pdata->reset); + /* Handle old non-standard DT binding */ + pdata->reset = devm_gpiod_get_from_of_node(arizona->dev, + arizona->dev->of_node, + "wlf,reset", 0, + GPIOD_OUT_LOW, + "arizona /RESET"); + if (IS_ERR(pdata->reset)) { + ret = PTR_ERR(pdata->reset); - pdata->reset = 0; + /* + * Reset missing will be caught when other binding is read + * but all other errors imply this binding is in use but has + * encountered a problem so should be handled. + */ + if (ret == -EPROBE_DEFER) + return ret; + else if (ret != -ENOENT && ret != -ENOSYS) + dev_err(arizona->dev, "Reset GPIO malformed: %d\n", + ret); + + pdata->reset = NULL; } ret = of_property_read_u32_array(arizona->dev->of_node, @@ -1050,14 +1062,19 @@ int arizona_dev_init(struct arizona *arizona) goto err_early; } - if (arizona->pdata.reset) { + if (!arizona->pdata.reset) { /* Start out with /RESET low to put the chip into reset */ - ret = devm_gpio_request_one(arizona->dev, arizona->pdata.reset, - GPIOF_DIR_OUT | GPIOF_INIT_LOW, - "arizona /RESET"); - if (ret != 0) { - dev_err(dev, "Failed to request /RESET: %d\n", ret); - goto err_dcvdd; + arizona->pdata.reset = devm_gpiod_get(arizona->dev, "reset", + GPIOD_OUT_LOW); + if (IS_ERR(arizona->pdata.reset)) { + ret = PTR_ERR(arizona->pdata.reset); + if (ret == -EPROBE_DEFER) + goto err_dcvdd; + + dev_err(arizona->dev, + "Reset GPIO missing/malformed: %d\n", ret); + + arizona->pdata.reset = NULL; } } diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c index cf2e25ab2940..1531302a50ec 100644 --- a/drivers/mfd/asic3.c +++ b/drivers/mfd/asic3.c @@ -31,6 +31,8 @@ #include <linux/mfd/ds1wm.h> #include <linux/mfd/tmio.h> +#include <linux/mmc/host.h> + enum { ASIC3_CLOCK_SPI, ASIC3_CLOCK_OWM, @@ -719,6 +721,7 @@ static void asic3_mmc_clk_div(struct platform_device *pdev, int state) static struct tmio_mmc_data asic3_mmc_data = { .hclk = 24576000, + .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, .set_pwr = asic3_mmc_pwr, .set_clk_div = asic3_mmc_clk_div, }; diff --git a/drivers/mfd/atmel-smc.c b/drivers/mfd/atmel-smc.c index 7d77948567d7..0adbd2e796fe 100644 --- a/drivers/mfd/atmel-smc.c +++ b/drivers/mfd/atmel-smc.c @@ -12,6 +12,7 @@ */ #include <linux/mfd/syscon/atmel-smc.h> +#include <linux/string.h> /** * atmel_smc_cs_conf_init - initialize a SMC CS conf diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c index e94c72c2faa2..9a2ef3d9b8f8 100644 --- a/drivers/mfd/axp20x.c +++ b/drivers/mfd/axp20x.c @@ -169,131 +169,61 @@ static const struct regmap_access_table axp806_volatile_table = { .n_yes_ranges = ARRAY_SIZE(axp806_volatile_ranges), }; -static struct resource axp152_pek_resources[] = { +static const struct resource axp152_pek_resources[] = { DEFINE_RES_IRQ_NAMED(AXP152_IRQ_PEK_RIS_EDGE, "PEK_DBR"), DEFINE_RES_IRQ_NAMED(AXP152_IRQ_PEK_FAL_EDGE, "PEK_DBF"), }; -static struct resource axp20x_ac_power_supply_resources[] = { +static const struct resource axp20x_ac_power_supply_resources[] = { DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_ACIN_PLUGIN, "ACIN_PLUGIN"), DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_ACIN_REMOVAL, "ACIN_REMOVAL"), DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_ACIN_OVER_V, "ACIN_OVER_V"), }; -static struct resource axp20x_pek_resources[] = { - { - .name = "PEK_DBR", - .start = AXP20X_IRQ_PEK_RIS_EDGE, - .end = AXP20X_IRQ_PEK_RIS_EDGE, - .flags = IORESOURCE_IRQ, - }, { - .name = "PEK_DBF", - .start = AXP20X_IRQ_PEK_FAL_EDGE, - .end = AXP20X_IRQ_PEK_FAL_EDGE, - .flags = IORESOURCE_IRQ, - }, +static const struct resource axp20x_pek_resources[] = { + DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_PEK_RIS_EDGE, "PEK_DBR"), + DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_PEK_FAL_EDGE, "PEK_DBF"), }; -static struct resource axp20x_usb_power_supply_resources[] = { +static const struct resource axp20x_usb_power_supply_resources[] = { DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_VBUS_PLUGIN, "VBUS_PLUGIN"), DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_VBUS_REMOVAL, "VBUS_REMOVAL"), DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_VBUS_VALID, "VBUS_VALID"), DEFINE_RES_IRQ_NAMED(AXP20X_IRQ_VBUS_NOT_VALID, "VBUS_NOT_VALID"), }; -static struct resource axp22x_usb_power_supply_resources[] = { +static const struct resource axp22x_usb_power_supply_resources[] = { DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_VBUS_PLUGIN, "VBUS_PLUGIN"), DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_VBUS_REMOVAL, "VBUS_REMOVAL"), }; -static struct resource axp22x_pek_resources[] = { - { - .name = "PEK_DBR", - .start = AXP22X_IRQ_PEK_RIS_EDGE, - .end = AXP22X_IRQ_PEK_RIS_EDGE, - .flags = IORESOURCE_IRQ, - }, { - .name = "PEK_DBF", - .start = AXP22X_IRQ_PEK_FAL_EDGE, - .end = AXP22X_IRQ_PEK_FAL_EDGE, - .flags = IORESOURCE_IRQ, - }, +static const struct resource axp22x_pek_resources[] = { + DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_PEK_RIS_EDGE, "PEK_DBR"), + DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_PEK_FAL_EDGE, "PEK_DBF"), }; -static struct resource axp288_power_button_resources[] = { - { - .name = "PEK_DBR", - .start = AXP288_IRQ_POKP, - .end = AXP288_IRQ_POKP, - .flags = IORESOURCE_IRQ, - }, - { - .name = "PEK_DBF", - .start = AXP288_IRQ_POKN, - .end = AXP288_IRQ_POKN, - .flags = IORESOURCE_IRQ, - }, +static const struct resource axp288_power_button_resources[] = { + DEFINE_RES_IRQ_NAMED(AXP288_IRQ_POKP, "PEK_DBR"), + DEFINE_RES_IRQ_NAMED(AXP288_IRQ_POKN, "PEK_DBF"), }; -static struct resource axp288_fuel_gauge_resources[] = { - { - .start = AXP288_IRQ_QWBTU, - .end = AXP288_IRQ_QWBTU, - .flags = IORESOURCE_IRQ, - }, - { - .start = AXP288_IRQ_WBTU, - .end = AXP288_IRQ_WBTU, - .flags = IORESOURCE_IRQ, - }, - { - .start = AXP288_IRQ_QWBTO, - .end = AXP288_IRQ_QWBTO, - .flags = IORESOURCE_IRQ, - }, - { - .start = AXP288_IRQ_WBTO, - .end = AXP288_IRQ_WBTO, - .flags = IORESOURCE_IRQ, - }, - { - .start = AXP288_IRQ_WL2, - .end = AXP288_IRQ_WL2, - .flags = IORESOURCE_IRQ, - }, - { - .start = AXP288_IRQ_WL1, - .end = AXP288_IRQ_WL1, - .flags = IORESOURCE_IRQ, - }, +static const struct resource axp288_fuel_gauge_resources[] = { + DEFINE_RES_IRQ(AXP288_IRQ_QWBTU), + DEFINE_RES_IRQ(AXP288_IRQ_WBTU), + DEFINE_RES_IRQ(AXP288_IRQ_QWBTO), + DEFINE_RES_IRQ(AXP288_IRQ_WBTO), + DEFINE_RES_IRQ(AXP288_IRQ_WL2), + DEFINE_RES_IRQ(AXP288_IRQ_WL1), }; -static struct resource axp803_pek_resources[] = { - { - .name = "PEK_DBR", - .start = AXP803_IRQ_PEK_RIS_EDGE, - .end = AXP803_IRQ_PEK_RIS_EDGE, - .flags = IORESOURCE_IRQ, - }, { - .name = "PEK_DBF", - .start = AXP803_IRQ_PEK_FAL_EDGE, - .end = AXP803_IRQ_PEK_FAL_EDGE, - .flags = IORESOURCE_IRQ, - }, +static const struct resource axp803_pek_resources[] = { + DEFINE_RES_IRQ_NAMED(AXP803_IRQ_PEK_RIS_EDGE, "PEK_DBR"), + DEFINE_RES_IRQ_NAMED(AXP803_IRQ_PEK_FAL_EDGE, "PEK_DBF"), }; -static struct resource axp809_pek_resources[] = { - { - .name = "PEK_DBR", - .start = AXP809_IRQ_PEK_RIS_EDGE, - .end = AXP809_IRQ_PEK_RIS_EDGE, - .flags = IORESOURCE_IRQ, - }, { - .name = "PEK_DBF", - .start = AXP809_IRQ_PEK_FAL_EDGE, - .end = AXP809_IRQ_PEK_FAL_EDGE, - .flags = IORESOURCE_IRQ, - }, +static const struct resource axp809_pek_resources[] = { + DEFINE_RES_IRQ_NAMED(AXP809_IRQ_PEK_RIS_EDGE, "PEK_DBR"), + DEFINE_RES_IRQ_NAMED(AXP809_IRQ_PEK_FAL_EDGE, "PEK_DBF"), }; static const struct regmap_config axp152_regmap_config = { @@ -520,11 +450,11 @@ static const struct regmap_irq axp806_regmap_irqs[] = { INIT_REGMAP_IRQ(AXP806, DCDCC_V_LOW, 0, 5), INIT_REGMAP_IRQ(AXP806, DCDCD_V_LOW, 0, 6), INIT_REGMAP_IRQ(AXP806, DCDCE_V_LOW, 0, 7), - INIT_REGMAP_IRQ(AXP806, PWROK_LONG, 1, 0), - INIT_REGMAP_IRQ(AXP806, PWROK_SHORT, 1, 1), + INIT_REGMAP_IRQ(AXP806, POK_LONG, 1, 0), + INIT_REGMAP_IRQ(AXP806, POK_SHORT, 1, 1), INIT_REGMAP_IRQ(AXP806, WAKEUP, 1, 4), - INIT_REGMAP_IRQ(AXP806, PWROK_FALL, 1, 5), - INIT_REGMAP_IRQ(AXP806, PWROK_RISE, 1, 6), + INIT_REGMAP_IRQ(AXP806, POK_FALL, 1, 5), + INIT_REGMAP_IRQ(AXP806, POK_RISE, 1, 6), }; static const struct regmap_irq axp809_regmap_irqs[] = { @@ -648,7 +578,7 @@ static const struct regmap_irq_chip axp809_regmap_irq_chip = { .num_regs = 5, }; -static struct mfd_cell axp20x_cells[] = { +static const struct mfd_cell axp20x_cells[] = { { .name = "axp20x-gpio", .of_compatible = "x-powers,axp209-gpio", @@ -660,6 +590,7 @@ static struct mfd_cell axp20x_cells[] = { .name = "axp20x-regulator", }, { .name = "axp20x-adc", + .of_compatible = "x-powers,axp209-adc", }, { .name = "axp20x-battery-power-supply", .of_compatible = "x-powers,axp209-battery-power-supply", @@ -676,7 +607,7 @@ static struct mfd_cell axp20x_cells[] = { }, }; -static struct mfd_cell axp221_cells[] = { +static const struct mfd_cell axp221_cells[] = { { .name = "axp221-pek", .num_resources = ARRAY_SIZE(axp22x_pek_resources), @@ -684,7 +615,8 @@ static struct mfd_cell axp221_cells[] = { }, { .name = "axp20x-regulator", }, { - .name = "axp22x-adc" + .name = "axp22x-adc", + .of_compatible = "x-powers,axp221-adc", }, { .name = "axp20x-ac-power-supply", .of_compatible = "x-powers,axp221-ac-power-supply", @@ -701,13 +633,14 @@ static struct mfd_cell axp221_cells[] = { }, }; -static struct mfd_cell axp223_cells[] = { +static const struct mfd_cell axp223_cells[] = { { .name = "axp221-pek", .num_resources = ARRAY_SIZE(axp22x_pek_resources), .resources = axp22x_pek_resources, }, { .name = "axp22x-adc", + .of_compatible = "x-powers,axp221-adc", }, { .name = "axp20x-battery-power-supply", .of_compatible = "x-powers,axp221-battery-power-supply", @@ -726,7 +659,7 @@ static struct mfd_cell axp223_cells[] = { }, }; -static struct mfd_cell axp152_cells[] = { +static const struct mfd_cell axp152_cells[] = { { .name = "axp20x-pek", .num_resources = ARRAY_SIZE(axp152_pek_resources), @@ -734,87 +667,30 @@ static struct mfd_cell axp152_cells[] = { }, }; -static struct resource axp288_adc_resources[] = { - { - .name = "GPADC", - .start = AXP288_IRQ_GPADC, - .end = AXP288_IRQ_GPADC, - .flags = IORESOURCE_IRQ, - }, +static const struct resource axp288_adc_resources[] = { + DEFINE_RES_IRQ_NAMED(AXP288_IRQ_GPADC, "GPADC"), }; -static struct resource axp288_extcon_resources[] = { - { - .start = AXP288_IRQ_VBUS_FALL, - .end = AXP288_IRQ_VBUS_FALL, - .flags = IORESOURCE_IRQ, - }, - { - .start = AXP288_IRQ_VBUS_RISE, - .end = AXP288_IRQ_VBUS_RISE, - .flags = IORESOURCE_IRQ, - }, - { - .start = AXP288_IRQ_MV_CHNG, - .end = AXP288_IRQ_MV_CHNG, - .flags = IORESOURCE_IRQ, - }, - { - .start = AXP288_IRQ_BC_USB_CHNG, - .end = AXP288_IRQ_BC_USB_CHNG, - .flags = IORESOURCE_IRQ, - }, +static const struct resource axp288_extcon_resources[] = { + DEFINE_RES_IRQ(AXP288_IRQ_VBUS_FALL), + DEFINE_RES_IRQ(AXP288_IRQ_VBUS_RISE), + DEFINE_RES_IRQ(AXP288_IRQ_MV_CHNG), + DEFINE_RES_IRQ(AXP288_IRQ_BC_USB_CHNG), }; -static struct resource axp288_charger_resources[] = { - { - .start = AXP288_IRQ_OV, - .end = AXP288_IRQ_OV, - .flags = IORESOURCE_IRQ, - }, - { - .start = AXP288_IRQ_DONE, - .end = AXP288_IRQ_DONE, - .flags = IORESOURCE_IRQ, - }, - { - .start = AXP288_IRQ_CHARGING, - .end = AXP288_IRQ_CHARGING, - .flags = IORESOURCE_IRQ, - }, - { - .start = AXP288_IRQ_SAFE_QUIT, - .end = AXP288_IRQ_SAFE_QUIT, - .flags = IORESOURCE_IRQ, - }, - { - .start = AXP288_IRQ_SAFE_ENTER, - .end = AXP288_IRQ_SAFE_ENTER, - .flags = IORESOURCE_IRQ, - }, - { - .start = AXP288_IRQ_QCBTU, - .end = AXP288_IRQ_QCBTU, - .flags = IORESOURCE_IRQ, - }, - { - .start = AXP288_IRQ_CBTU, - .end = AXP288_IRQ_CBTU, - .flags = IORESOURCE_IRQ, - }, - { - .start = AXP288_IRQ_QCBTO, - .end = AXP288_IRQ_QCBTO, - .flags = IORESOURCE_IRQ, - }, - { - .start = AXP288_IRQ_CBTO, - .end = AXP288_IRQ_CBTO, - .flags = IORESOURCE_IRQ, - }, +static const struct resource axp288_charger_resources[] = { + DEFINE_RES_IRQ(AXP288_IRQ_OV), + DEFINE_RES_IRQ(AXP288_IRQ_DONE), + DEFINE_RES_IRQ(AXP288_IRQ_CHARGING), + DEFINE_RES_IRQ(AXP288_IRQ_SAFE_QUIT), + DEFINE_RES_IRQ(AXP288_IRQ_SAFE_ENTER), + DEFINE_RES_IRQ(AXP288_IRQ_QCBTU), + DEFINE_RES_IRQ(AXP288_IRQ_CBTU), + DEFINE_RES_IRQ(AXP288_IRQ_QCBTO), + DEFINE_RES_IRQ(AXP288_IRQ_CBTO), }; -static struct mfd_cell axp288_cells[] = { +static const struct mfd_cell axp288_cells[] = { { .name = "axp288_adc", .num_resources = ARRAY_SIZE(axp288_adc_resources), @@ -845,7 +721,7 @@ static struct mfd_cell axp288_cells[] = { }, }; -static struct mfd_cell axp803_cells[] = { +static const struct mfd_cell axp803_cells[] = { { .name = "axp221-pek", .num_resources = ARRAY_SIZE(axp803_pek_resources), @@ -854,14 +730,14 @@ static struct mfd_cell axp803_cells[] = { { .name = "axp20x-regulator" }, }; -static struct mfd_cell axp806_cells[] = { +static const struct mfd_cell axp806_cells[] = { { .id = 2, .name = "axp20x-regulator", }, }; -static struct mfd_cell axp809_cells[] = { +static const struct mfd_cell axp809_cells[] = { { .name = "axp221-pek", .num_resources = ARRAY_SIZE(axp809_pek_resources), @@ -872,7 +748,7 @@ static struct mfd_cell axp809_cells[] = { }, }; -static struct mfd_cell axp813_cells[] = { +static const struct mfd_cell axp813_cells[] = { { .name = "axp221-pek", .num_resources = ARRAY_SIZE(axp803_pek_resources), @@ -882,7 +758,13 @@ static struct mfd_cell axp813_cells[] = { }, { .name = "axp20x-gpio", .of_compatible = "x-powers,axp813-gpio", - } + }, { + .name = "axp813-adc", + .of_compatible = "x-powers,axp813-adc", + }, { + .name = "axp20x-battery-power-supply", + .of_compatible = "x-powers,axp813-battery-power-supply", + }, }; static struct axp20x_dev *axp20x_pm_power_off; diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c index 36156a41499c..65a9757a6d21 100644 --- a/drivers/mfd/cros_ec.c +++ b/drivers/mfd/cros_ec.c @@ -112,12 +112,16 @@ int cros_ec_register(struct cros_ec_device *ec_dev) mutex_init(&ec_dev->lock); - cros_ec_query_all(ec_dev); + err = cros_ec_query_all(ec_dev); + if (err) { + dev_err(dev, "Cannot identify the EC: error %d\n", err); + return err; + } if (ec_dev->irq) { - err = request_threaded_irq(ec_dev->irq, NULL, ec_irq_thread, - IRQF_TRIGGER_LOW | IRQF_ONESHOT, - "chromeos-ec", ec_dev); + err = devm_request_threaded_irq(dev, ec_dev->irq, NULL, + ec_irq_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT, + "chromeos-ec", ec_dev); if (err) { dev_err(dev, "Failed to request IRQ %d: %d", ec_dev->irq, err); @@ -131,7 +135,7 @@ int cros_ec_register(struct cros_ec_device *ec_dev) |