diff options
Diffstat (limited to 'drivers/mfd')
55 files changed, 528 insertions, 332 deletions
diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index a65447d65605..7dca1e640970 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -148,7 +148,7 @@ static struct resource onkey_resources[] = { }, }; -static struct mfd_cell onkey_devs[] = { +static const struct mfd_cell onkey_devs[] = { { .name = "88pm80x-onkey", .num_resources = 1, @@ -157,7 +157,7 @@ static struct mfd_cell onkey_devs[] = { }, }; -static struct mfd_cell regulator_devs[] = { +static const struct mfd_cell regulator_devs[] = { { .name = "88pm80x-regulator", .id = -1, diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index 8a5b6ffb5afb..64751c2a1ace 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -77,7 +77,7 @@ static struct resource codec_resources[] = { }, }; -static struct mfd_cell codec_devs[] = { +static const struct mfd_cell codec_devs[] = { { .name = "88pm80x-codec", .num_resources = ARRAY_SIZE(codec_resources), diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 62a60caa5d1f..e54a6fd2a5bd 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -32,7 +32,7 @@ config MFD_AS3722 select MFD_CORE select REGMAP_I2C select REGMAP_IRQ - depends on I2C && OF + depends on I2C=y && OF help The ams AS3722 is a compact system PMU suitable for mobile phones, tablets etc. It has 4 DC/DC step-down regulators, 3 DC/DC step-down @@ -321,6 +321,19 @@ config MFD_88PM860X select individual components like voltage regulators, RTC and battery-charger under the corresponding menus. +config MFD_MAX14577 + bool "Maxim Semiconductor MAX14577 MUIC + Charger Support" + depends on I2C=y + select MFD_CORE + select REGMAP_I2C + select IRQ_DOMAIN + help + Say yes here to support for Maxim Semiconductor MAX14577. + This is a Micro-USB IC with Charger controls on chip. + This driver provides common support for accessing the device; + additional drivers must be enabled in order to use the functionality + of the device. + config MFD_MAX77686 bool "Maxim Semiconductor MAX77686 PMIC Support" depends on I2C=y diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 8a28dc90fe78..2e18b05017d9 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -110,6 +110,7 @@ obj-$(CONFIG_MFD_DA9055) += da9055.o da9063-objs := da9063-core.o da9063-irq.o da9063-i2c.o obj-$(CONFIG_MFD_DA9063) += da9063.o +obj-$(CONFIG_MFD_MAX14577) += max14577.o obj-$(CONFIG_MFD_MAX77686) += max77686.o max77686-irq.o obj-$(CONFIG_MFD_MAX77693) += max77693.o max77693-irq.o obj-$(CONFIG_MFD_MAX8907) += max8907.o diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index b6c2cdc76091..6788064ed899 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -1017,7 +1017,7 @@ static struct resource ab8500_temp_resources[] = { }, }; -static struct mfd_cell ab8500_bm_devs[] = { +static const struct mfd_cell ab8500_bm_devs[] = { { .name = "ab8500-charger", .of_compatible = "stericsson,ab8500-charger", @@ -1052,7 +1052,7 @@ static struct mfd_cell ab8500_bm_devs[] = { }, }; -static struct mfd_cell ab8500_devs[] = { +static const struct mfd_cell ab8500_devs[] = { #ifdef CONFIG_DEBUG_FS { .name = "ab8500-debug", @@ -1143,7 +1143,7 @@ static struct mfd_cell ab8500_devs[] = { }, }; -static struct mfd_cell ab9540_devs[] = { +static const struct mfd_cell ab9540_devs[] = { #ifdef CONFIG_DEBUG_FS { .name = "ab8500-debug", @@ -1214,7 +1214,7 @@ static struct mfd_cell ab9540_devs[] = { }; /* Device list for ab8505 */ -static struct mfd_cell ab8505_devs[] = { +static const struct mfd_cell ab8505_devs[] = { #ifdef CONFIG_DEBUG_FS { .name = "ab8500-debug", @@ -1275,7 +1275,7 @@ static struct mfd_cell ab8505_devs[] = { }, }; -static struct mfd_cell ab8540_devs[] = { +static const struct mfd_cell ab8540_devs[] = { #ifdef CONFIG_DEBUG_FS { .name = "ab8500-debug", @@ -1339,7 +1339,7 @@ static struct mfd_cell ab8540_devs[] = { }, }; -static struct mfd_cell ab8540_cut1_devs[] = { +static const struct mfd_cell ab8540_cut1_devs[] = { { .name = "ab8500-rtc", .of_compatible = "stericsson,ab8500-rtc", @@ -1348,7 +1348,7 @@ static struct mfd_cell ab8540_cut1_devs[] = { }, }; -static struct mfd_cell ab8540_cut2_devs[] = { +static const struct mfd_cell ab8540_cut2_devs[] = { { .name = "ab8540-rtc", .of_compatible = "stericsson,ab8540-rtc", diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index e33e385af0a2..d1a22aae2df5 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c @@ -1600,7 +1600,6 @@ static int ab8500_interrupts_print(struct seq_file *s, void *p) for (line = 0; line < num_interrupt_lines; line++) { struct irq_desc *desc = irq_to_desc(line + irq_first); - struct irqaction *action = desc->action; seq_printf(s, "%3i: %6i %4i", line, num_interrupts[line], @@ -1608,7 +1607,9 @@ static int ab8500_interrupts_print(struct seq_file *s, void *p) if (desc && desc->name) seq_printf(s, "-%-8s", desc->name); - if (action) { + if (desc && desc->action) { + struct irqaction *action = desc->action; + seq_printf(s, " %s", action->name); while ((action = action->next) != NULL) seq_printf(s, ", %s", action->name); diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index 75e180ceecf3..a45aab9f6bb1 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c @@ -565,7 +565,7 @@ static inline int arizona_of_get_core_pdata(struct arizona *arizona) } #endif -static struct mfd_cell early_devs[] = { +static const struct mfd_cell early_devs[] = { { .name = "arizona-ldo1" }, }; @@ -577,7 +577,7 @@ static const char *wm5102_supplies[] = { "SPKVDDR", }; -static struct mfd_cell wm5102_devs[] = { +static const struct mfd_cell wm5102_devs[] = { { .name = "arizona-micsupp" }, { .name = "arizona-extcon" }, { .name = "arizona-gpio" }, @@ -590,7 +590,7 @@ static struct mfd_cell wm5102_devs[] = { }, }; -static struct mfd_cell wm5110_devs[] = { +static const struct mfd_cell wm5110_devs[] = { { .name = "arizona-micsupp" }, { .name = "arizona-extcon" }, { .name = "arizona-gpio" }, @@ -609,7 +609,7 @@ static const char *wm8997_supplies[] = { "SPKVDD", }; -static struct mfd_cell wm8997_devs[] = { +static const struct mfd_cell wm8997_devs[] = { { .name = "arizona-micsupp" }, { .name = "arizona-extcon" }, { .name = "arizona-gpio" }, diff --git a/drivers/mfd/as3722.c b/drivers/mfd/as3722.c index f161f2e00df7..c71ff0af1547 100644 --- a/drivers/mfd/as3722.c +++ b/drivers/mfd/as3722.c @@ -54,7 +54,7 @@ static const struct resource as3722_adc_resource[] = { }, }; -static struct mfd_cell as3722_devs[] = { +static const struct mfd_cell as3722_devs[] = { { .name = "as3722-pinctrl", }, @@ -74,6 +74,9 @@ static struct mfd_cell as3722_devs[] = { { .name = "as3722-power-off", }, + { + .name = "as3722-wdt", + }, }; static const struct regmap_irq as3722_irqs[] = { diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c index fa22154c84e4..9f6294f2a070 100644 --- a/drivers/mfd/asic3.c +++ b/drivers/mfd/asic3.c @@ -695,7 +695,7 @@ static int ds1wm_disable(struct platform_device *pdev) return 0; } -static struct mfd_cell asic3_cell_ds1wm = { +static const struct mfd_cell asic3_cell_ds1wm = { .name = "ds1wm", .enable = ds1wm_enable, .disable = ds1wm_disable, @@ -797,7 +797,7 @@ static int asic3_mmc_disable(struct platform_device *pdev) return 0; } -static struct mfd_cell asic3_cell_mmc = { +static const struct mfd_cell asic3_cell_mmc = { .name = "tmio-mmc", .enable = asic3_mmc_enable, .disable = asic3_mmc_disable, diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c index 1f36885d674b..783fe2e73e1e 100644 --- a/drivers/mfd/cros_ec.c +++ b/drivers/mfd/cros_ec.c @@ -84,7 +84,7 @@ static irqreturn_t ec_irq_thread(int irq, void *data) return IRQ_HANDLED; } -static struct mfd_cell cros_devs[] = { +static const struct mfd_cell cros_devs[] = { { .name = "cros-ec-keyb", .id = 1, diff --git a/drivers/mfd/cros_ec_i2c.c b/drivers/mfd/cros_ec_i2c.c index 123044608b63..4f71be99a183 100644 --- a/drivers/mfd/cros_ec_i2c.c +++ b/drivers/mfd/cros_ec_i2c.c @@ -120,7 +120,7 @@ static int cros_ec_command_xfer(struct cros_ec_device *ec_dev, return ret; } -static int cros_ec_probe_i2c(struct i2c_client *client, +static int cros_ec_i2c_probe(struct i2c_client *client, const struct i2c_device_id *dev_id) { struct device *dev = &client->dev; @@ -150,7 +150,7 @@ static int cros_ec_probe_i2c(struct i2c_client *client, return 0; } -static int cros_ec_remove_i2c(struct i2c_client *client) +static int cros_ec_i2c_remove(struct i2c_client *client) { struct cros_ec_device *ec_dev = i2c_get_clientdata(client); @@ -190,8 +190,8 @@ static struct i2c_driver cros_ec_driver = { .owner = THIS_MODULE, .pm = &cros_ec_i2c_pm_ops, }, - .probe = cros_ec_probe_i2c, - .remove = cros_ec_remove_i2c, + .probe = cros_ec_i2c_probe, + .remove = cros_ec_i2c_remove, .id_table = cros_ec_i2c_id, }; diff --git a/drivers/mfd/cros_ec_spi.c b/drivers/mfd/cros_ec_spi.c index 367ccb58ecb1..5658ec48838f 100644 --- a/drivers/mfd/cros_ec_spi.c +++ b/drivers/mfd/cros_ec_spi.c @@ -50,10 +50,11 @@ /* * Time between raising the SPI chip select (for the end of a * transaction) and dropping it again (for the next transaction). - * If we go too fast, the EC will miss the transaction. It seems - * that 50us is enough with the 16MHz STM32 EC. + * If we go too fast, the EC will miss the transaction. We know that we + * need at least 70 us with the 16 MHz STM32 EC, so go with 200 us to be + * safe. */ -#define EC_SPI_RECOVERY_TIME_NS (50 * 1000) +#define EC_SPI_RECOVERY_TIME_NS (200 * 1000) /** * struct cros_ec_spi - information about a SPI-connected EC @@ -75,7 +76,9 @@ static void debug_packet(struct device *dev, const char *name, u8 *ptr, dev_dbg(dev, "%s: ", name); for (i = 0; i < len; i++) - dev_cont(dev, " %02x", ptr[i]); + pr_cont(" %02x", ptr[i]); + + pr_cont("\n"); #endif } @@ -281,7 +284,7 @@ static int cros_ec_command_spi_xfer(struct cros_ec_device *ec_dev, return 0; } -static int cros_ec_probe_spi(struct spi_device *spi) +static int cros_ec_spi_probe(struct spi_device *spi) { struct device *dev = &spi->dev; struct cros_ec_device *ec_dev; @@ -323,7 +326,7 @@ static int cros_ec_probe_spi(struct spi_device *spi) return 0; } -static int cros_ec_remove_spi(struct spi_device *spi) +static int cros_ec_spi_remove(struct spi_device *spi) { struct cros_ec_device *ec_dev; @@ -364,8 +367,8 @@ static struct spi_driver cros_ec_driver_spi = { .owner = THIS_MODULE, .pm = &cros_ec_spi_pm_ops, }, - .probe = cros_ec_probe_spi, - .remove = cros_ec_remove_spi, + .probe = cros_ec_spi_probe, + .remove = cros_ec_spi_remove, .id_table = cros_ec_spi_id, }; diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c index ea28a33576e4..25838f10b35b 100644 --- a/drivers/mfd/da9052-core.c +++ b/drivers/mfd/da9052-core.c @@ -427,7 +427,7 @@ int da9052_adc_read_temp(struct da9052 *da9052) } EXPORT_SYMBOL_GPL(da9052_adc_read_temp); -static struct mfd_cell da9052_subdev_info[] = { +static const struct mfd_cell da9052_subdev_info[] = { { .name = "da9052-regulator", .id = 1, diff --git a/drivers/mfd/da9055-core.c b/drivers/mfd/da9055-core.c index d3670cd3c3c6..caf8dcffd0ad 100644 --- a/drivers/mfd/da9055-core.c +++ b/drivers/mfd/da9055-core.c @@ -294,7 +294,7 @@ static struct resource da9055_ld05_6_resource = { .flags = IORESOURCE_IRQ, }; -static struct mfd_cell da9055_devs[] = { +static const struct mfd_cell da9055_devs[] = { { .of_compatible = "dialog,da9055-gpio", .name = "da9055-gpio", diff --git a/drivers/mfd/da9063-core.c b/drivers/mfd/da9063-core.c index c9cf8d988406..26937cd01071 100644 --- a/drivers/mfd/da9063-core.c +++ b/drivers/mfd/da9063-core.c @@ -75,7 +75,7 @@ static struct resource da9063_hwmon_resources[] = { }; -static struct mfd_cell da9063_devs[] = { +static const struct mfd_cell da9063_devs[] = { { .name = DA9063_DRVNAME_REGULATORS, .num_resources = ARRAY_SIZE(da9063_regulators_resources), diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c index b9ce60c301de..e43e6e821117 100644 --- a/drivers/mfd/db8500-prcmu.c +++ b/drivers/mfd/db8500-prcmu.c @@ -3070,7 +3070,7 @@ static struct db8500_thsens_platform_data db8500_thsens_data = { .num_trips = 4, }; -static struct mfd_cell common_prcmu_devs[] = { +static const struct mfd_cell common_prcmu_devs[] = { { .name = "ux500_wdt", .platform_data = &db8500_wdt_pdata, @@ -3079,7 +3079,7 @@ static struct mfd_cell common_prcmu_devs[] = { }, }; -static struct mfd_cell db8500_prcmu_devs[] = { +static const struct mfd_cell db8500_prcmu_devs[] = { { .name = "db8500-prcmu-regulators", .of_compatible = "stericsson,db8500-prcmu-regulator", diff --git a/drivers/mfd/htc-pasic3.c b/drivers/mfd/htc-pasic3.c index 6bf92a507b95..e88d4f6fef4c 100644 --- a/drivers/mfd/htc-pasic3.c +++ b/drivers/mfd/htc-pasic3.c @@ -114,7 +114,7 @@ static struct resource ds1wm_resources[] __initdata = { }, }; -static struct mfd_cell ds1wm_cell __initdata = { +static const struct mfd_cell ds1wm_cell __initconst = { .name = "ds1wm", .enable = ds1wm_enable, .disable = ds1wm_disable, diff --git a/drivers/mfd/intel_msic.c b/drivers/mfd/intel_msic.c index 9203d47cdbb1..049fd23af54a 100644 --- a/drivers/mfd/intel_msic.c +++ b/drivers/mfd/intel_msic.c @@ -178,7 +178,7 @@ static struct mfd_cell msic_devs[] = { * These devices appear only after the MSIC driver itself is initialized so * we can guarantee that the SCU IPC interface is ready. */ -static struct mfd_cell msic_other_devs[] = { +static const struct mfd_cell msic_other_devs[] = { /* Audio codec in the MSIC */ { .id = -1, diff --git a/drivers/mfd/jz4740-adc.c b/drivers/mfd/jz4740-adc.c index 3c0e8cf6916b..7a51c0d0d4f1 100644 --- a/drivers/mfd/jz4740-adc.c +++ b/drivers/mfd/jz4740-adc.c @@ -181,7 +181,7 @@ static struct resource jz4740_battery_resources[] = { }, }; -static struct mfd_cell jz4740_adc_cells[] = { +static const struct mfd_cell jz4740_adc_cells[] = { { .id = 0, .name = "jz4740-hwmon", diff --git a/drivers/mfd/lp8788.c b/drivers/mfd/lp8788.c index 0f1221911018..a30bc15fe5ba 100644 --- a/drivers/mfd/lp8788.c +++ b/drivers/mfd/lp8788.c @@ -71,7 +71,7 @@ static struct resource rtc_irqs[] = { }, }; -static struct mfd_cell lp8788_devs[] = { +static const struct mfd_cell lp8788_devs[] = { /* 4 bucks */ MFD_DEV_WITH_ID(BUCK, 1), MFD_DEV_WITH_ID(BUCK, 2), diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c index da1c6566d93d..37edf9e989b0 100644 --- a/drivers/mfd/lpc_ich.c +++ b/drivers/mfd/lpc_ich.c @@ -506,7 +506,7 @@ static struct lpc_ich_info lpc_chipset_info[] = { .iTCO_version = 2, }, [LPC_WPT_LP] = { - .name = "Lynx Point_LP", + .name = "Wildcat Point_LP", .iTCO_version = 2, }, }; diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c new file mode 100644 index 000000000000..1337c4527028 --- /dev/null +++ b/drivers/mfd/max14577.c @@ -0,0 +1,246 @@ +/* + * max14577.c - mfd core driver for the Maxim 14577 + * + * Copyright (C) 2013 Samsung Electrnoics + * Chanwoo Choi <cw00.choi@samsung.com> + * Krzysztof Kozlowski <k.kozlowski@samsung.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * This driver is based on max8997.c + */ + +#include <linux/module.h> +#include <linux/interrupt.h> +#include <linux/mfd/core.h> +#include <linux/mfd/max14577.h> +#include <linux/mfd/max14577-private.h> + +static struct mfd_cell max14577_devs[] = { + { .name = "max14577-muic", }, + { + .name = "max14577-regulator", + .of_compatible = "maxim,max14577-regulator", + }, + { .name = "max14577-charger", }, +}; + +static bool max14577_volatile_reg(struct device *dev, unsigned int reg) +{ + switch (reg) { + case MAX14577_REG_INT1 ... MAX14577_REG_STATUS3: + return true; + default: + break; + } + return false; +} + +static const struct regmap_config max14577_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .volatile_reg = max14577_volatile_reg, + .max_register = MAX14577_REG_END, +}; + +static const struct regmap_irq max14577_irqs[] = { + /* INT1 interrupts */ + { .reg_offset = 0, .mask = INT1_ADC_MASK, }, + { .reg_offset = 0, .mask = INT1_ADCLOW_MASK, }, + { .reg_offset = 0, .mask = INT1_ADCERR_MASK, }, + /* INT2 interrupts */ + { .reg_offset = 1, .mask = INT2_CHGTYP_MASK, }, + { .reg_offset = 1, .mask = INT2_CHGDETRUN_MASK, }, + { .reg_offset = 1, .mask = INT2_DCDTMR_MASK, }, + { .reg_offset = 1, .mask = INT2_DBCHG_MASK, }, + { .reg_offset = 1, .mask = INT2_VBVOLT_MASK, }, + /* INT3 interrupts */ + { .reg_offset = 2, .mask = INT3_EOC_MASK, }, + { .reg_offset = 2, .mask = INT3_CGMBC_MASK, }, + { .reg_offset = 2, .mask = INT3_OVP_MASK, }, + { .reg_offset = 2, .mask = INT3_MBCCHGERR_MASK, }, +}; + +static const struct regmap_irq_chip max14577_irq_chip = { + .name = "max14577", + .status_base = MAX14577_REG_INT1, + .mask_base = MAX14577_REG_INTMASK1, + .mask_invert = 1, + .num_regs = 3, + .irqs = max14577_irqs, + .num_irqs = ARRAY_SIZE(max14577_irqs), +}; + +static int max14577_i2c_probe(struct i2c_client *i2c, + const struct i2c_device_id *id) +{ + struct max14577 *max14577; + struct max14577_platform_data *pdata = dev_get_platdata(&i2c->dev); + struct device_node *np = i2c->dev.of_node; + u8 reg_data; + int ret = 0; + + if (np) { + pdata = devm_kzalloc(&i2c->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return -ENOMEM; + i2c->dev.platform_data = pdata; + } + + if (!pdata) { + dev_err(&i2c->dev, "No platform data found: %ld\n", + PTR_ERR(pdata)); + return -EINVAL; + } + + max14577 = devm_kzalloc(&i2c->dev, sizeof(*max14577), GFP_KERNEL); + if (!max14577) + return -ENOMEM; + + i2c_set_clientdata(i2c, max14577); + max14577->dev = &i2c->dev; + max14577->i2c = i2c; + max14577->irq = i2c->irq; + + max14577->regmap = devm_regmap_init_i2c(i2c, &max14577_regmap_config); + if (IS_ERR(max14577->regmap)) { + ret = PTR_ERR(max14577->regmap); + dev_err(max14577->dev, "Failed to allocate register map: %d\n", + ret); + return ret; + } + + ret = max14577_read_reg(max14577->regmap, MAX14577_REG_DEVICEID, + ®_data); + if (ret) { + dev_err(max14577->dev, "Device not found on this channel: %d\n", + ret); + return ret; + } + max14577->vendor_id = ((reg_data & DEVID_VENDORID_MASK) >> + DEVID_VENDORID_SHIFT); + max14577->device_id = ((reg_data & DEVID_DEVICEID_MASK) >> + DEVID_DEVICEID_SHIFT); + dev_info(max14577->dev, "Device ID: 0x%x, vendor: 0x%x\n", + max14577->device_id, max14577->vendor_id); + + ret = regmap_add_irq_chip(max14577->regmap, max14577->irq, + IRQF_TRIGGER_FALLING | IRQF_ONESHOT, 0, + &max14577_irq_chip, + &max14577->irq_data); + if (ret != 0) { + dev_err(&i2c->dev, "Failed to request IRQ %d: %d\n", + max14577->irq, ret); + return ret; + } + + ret = mfd_add_devices(max14577->dev, -1, max14577_devs, + ARRAY_SIZE(max14577_devs), NULL, 0, + regmap_irq_get_domain(max14577->irq_data)); + if (ret < 0) + goto err_mfd; + + device_init_wakeup(max14577->dev, 1); + + return 0; + +err_mfd: + regmap_del_irq_chip(max14577->irq, max14577->irq_data); + + return ret; +} + +static int max14577_i2c_remove(struct i2c_client *i2c) +{ + struct max14577 *max14577 = i2c_get_clientdata(i2c); + + mfd_remove_devices(max14577->dev); + regmap_del_irq_chip(max14577->irq, max14577->irq_data); + + return 0; +} + +static const struct i2c_device_id max14577_i2c_id[] = { + { "max14577", 0 }, + { } +}; +MODULE_DEVICE_TABLE(i2c, max14577_i2c_id); + +static int max14577_suspend(struct device *dev) +{ + struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); + struct max14577 *max14577 = i2c_get_clientdata(i2c); + + if (device_may_wakeup(dev)) { + enable_irq_wake(max14577->irq); + /* + * MUIC IRQ must be disabled during suspend if this is + * a wake up source because it will be handled before + * resuming I2C. + * + * When device is woken up from suspend (e.g. by ADC change), + * an interrupt occurs before resuming I2C bus controller. + * Interrupt handler tries to read registers but this read + * will fail because I2C is still suspended. + */ + disable_irq(max14577->irq); + } + + return 0; +} + +static int max14577_resume(struct device *dev) +{ + struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); + struct max14577 *max14577 = i2c_get_clientdata(i2c); + + if (device_may_wakeup(dev)) { + disable_irq_wake(max14577->irq); + enable_irq(max14577->irq); + } + + return 0; +} + +static struct of_device_id max14577_dt_match[] = { + { .compatible = "maxim,max14577", }, + {}, +}; + +static SIMPLE_DEV_PM_OPS(max14577_pm, max14577_suspend, max14577_resume); + +static struct i2c_driver max14577_i2c_driver = { + .driver = { + .name = "max14577", + .owner = THIS_MODULE, + .pm = &max14577_pm, + .of_match_table = of_match_ptr(max14577_dt_match), + }, + .probe = max14577_i2c_probe, + .remove = max14577_i2c_remove, + .id_table = max14577_i2c_id, +}; + +static int __init max14577_i2c_init(void) +{ + return i2c_add_driver(&max14577_i2c_driver); +} +subsys_initcall(max14577_i2c_init); + +static void __exit max14577_i2c_exit(void) +{ + i2c_del_driver(&max14577_i2c_driver); +} +module_exit(max14577_i2c_exit); + +MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>, Krzysztof Kozlowski <k.kozlowski@samsung.com>"); +MODULE_DESCRIPTION("MAXIM 14577 multi-function core driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c index 34520cbe8afb..fb0848544b76 100644 --- a/drivers/mfd/max77686.c +++ b/drivers/mfd/max77686.c @@ -35,7 +35,7 @@ #define I2C_ADDR_RTC (0x0C >> 1) -static struct mfd_cell max77686_devs[] = { +static const struct mfd_cell max77686_devs[] = { { .name = "max77686-pmic", }, { .name = "max77686-rtc", }, { .name = "max77686-clk", }, diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c index 9f92463f4f7e..a0093a839d4b 100644 --- a/drivers/mfd/max77693.c +++ b/drivers/mfd/max77693.c @@ -41,7 +41,7 @@ #define I2C_ADDR_MUIC (0x4A >> 1) #define I2C_ADDR_HAPTIC (0x90 >> 1) -static struct mfd_cell max77693_devs[] = { +static const struct mfd_cell max77693_devs[] = { { .name = "max77693-pmic", }, { .name = "max77693-charger", }, { .name = "max77693-flash", }, diff --git a/drivers/mfd/max8907.c b/drivers/mfd/max8907.c index 3bbfedc07f41..07740314b29d 100644 --- a/drivers/mfd/max8907.c +++ b/drivers/mfd/max8907.c @@ -22,7 +22,7 @@ #include <linux/regmap.h> #include <linux/slab.h> -static struct mfd_cell max8907_cells[] = { +static const struct mfd_cell max8907_cells[] = { { .name = "max8907-regulator", }, { .name = "max8907-rtc", }, }; diff --git a/drivers/mfd/max8925-core.c b/drivers/mfd/max8925-core.c index f0cc40296d8c..f3faf0c45ddd 100644 --- a/drivers/mfd/max8925-core.c +++ b/drivers/mfd/max8925-core.c @@ -45,7 +45,7 @@ static struct resource touch_resources[] = { }, }; -static struct mfd_cell touch_devs[] = { +static const struct mfd_cell touch_devs[] = { { .name = "max8925-touch", .num_resources = 1, @@ -63,7 +63,7 @@ static struct resource power_supply_resources[] = { }, }; -static struct mfd_cell power_devs[] = { +static const struct mfd_cell power_devs[] = { { .name = "max8925-power", .num_resources = 1, @@ -81,7 +81,7 @@ static struct resource rtc_resources[] = { }, }; -static struct mfd_cell rtc_devs[] = { +static const struct mfd_cell rtc_devs[] = { { .name = "max8925-rtc", .num_resources = 1, @@ -104,7 +104,7 @@ static struct resource onkey_resources[] = { }, }; -static struct mfd_cell onkey_devs[] = { +static const struct mfd_cell onkey_devs[] = { { .name = "max8925-onkey", .num_resources = 2, diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c index 791aea3e96ce..1b80e51c2e73 100644 --- a/drivers/mfd/max8997.c +++ b/drivers/mfd/max8997.c @@ -40,7 +40,7 @@ #define I2C_ADDR_RTC (0x0C >> 1) #define I2C_ADDR_HAPTIC (0x90 >> 1) -static struct mfd_cell max8997_devs[] = { +static const struct mfd_cell max8997_devs[] = { { .name = "max8997-pmic", }, { .name = "max8997-rtc", }, { .name = "max8997-battery", }, diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c index fe6332dcabee..f47eaa70eae0 100644 --- a/drivers/mfd/max8998.c +++ b/drivers/mfd/max8998.c @@ -37,7 +37,7 @@ #define RTC_I2C_ADDR (0x0c >> 1) -static struct mfd_cell max8998_devs[] = { +static const struct mfd_cell max8998_devs[] = { { .name = "max8998-pmic", }, { @@ -47,7 +47,7 @@ static struct mfd_cell max8998_devs[] = { }, }; -static struct mfd_cell lp3974_devs[] = { +static const struct mfd_cell lp3974_devs[] = { { .name = "lp3974-pmic", }, { diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c index 5f14ef6693c2..cbcc86d9b6e7 100644 --- a/drivers/mfd/mc13xxx-spi.c +++ b/drivers/mfd/mc13xxx-spi.c @@ -149,7 +149,6 @@ static int mc13xxx_spi_probe(struct spi_device *spi) ret = PTR_ERR(mc13xxx->regmap); dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n", ret); - spi_set_drvdata(spi, NULL); return ret; } diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c index 142650fdc058..90b630ccc8bc 100644 --- a/drivers/mfd/omap-usb-host.c +++ b/drivers/mfd/omap-usb-host.c @@ -121,22 +121,22 @@ static u64 usbhs_dmamask = DMA_BIT_MASK(32); static inline void usbhs_write(void __iomem *base, u32 reg, u32 val) { - __raw_writel(val, base + reg); + writel_relaxed(val, base + reg); } static inline u32 usbhs_read(void __iomem *base, u32 reg) { - return __raw_readl(base + reg); + return readl_relaxed(base + reg); } static inline void usbhs_writeb(void __iomem *base, u8 reg, u8 val) { - __raw_writeb(val, base + reg); + writeb_relaxed(val, base + reg); } static inline u8 usbhs_readb(void __iomem *base, u8 reg) { - return __raw_readb(base + reg); + return readb_relaxed(base + reg); } /*-------------------------------------------------------------------------*/ diff --git a/drivers/mfd/omap-usb-tll.c b/drivers/mfd/omap-usb-tll.c index 0d946ae14453..ee7468c1cb60 100644 --- a/drivers/mfd/omap-usb-tll.c +++ b/drivers/mfd/omap-usb-tll.c @@ -121,22 +121,22 @@ static DEFINE_SPINLOCK(tll_lock); /* serialize access to tll_dev */ static inline void usbtll_write(void __iomem *base, u32 reg, u32 val) { - __raw_writel(val, base + reg); + writel_relaxed(val, base + reg); } static inline u32 usbtll_read(void __iomem *base, u32 reg) { - return __raw_readl(base + reg); + return readl_relaxed(base + reg); } static inline void usbtll_writeb(void __iomem *base, u8 reg, u8 val) { - __raw_writeb(val, base + reg); + writeb_relaxed(val, base + reg); } static inline u8 usbtll_readb(void __iomem *base, u8 reg) { - return __raw_readb(base + reg); + return readb_relaxed(base + reg); } /*-------------------------------------------------------------------------*/ diff --git a/drivers/mfd/rc5t583.c b/drivers/mfd/rc5t583.c index 346330176afc..df276ad9f40b 100644 --- a/drivers/mfd/rc5t583.c +++ b/drivers/mfd/rc5t583.c @@ -74,7 +74,7 @@ static struct deepsleep_control_data deepsleep_data[] = { #define EXT_PWR_REQ \ (RC5T583_EXT_PWRREQ1_CONTROL | RC5T583_EXT_PWRREQ2_CONTROL) -static struct mfd_cell rc5t583_subdevs[] = { +static const struct mfd_cell rc5t583_subdevs[] = { {.name = "rc5t583-gpio",}, {.name = "rc5t583-regulator",}, {.name = "rc5t583-rtc", }, diff --git a/drivers/mfd/rdc321x-southbridge.c b/drivers/mfd/rdc321x-southbridge.c index 21b7bef73507..aab63ee043e3 100644 --- a/drivers/mfd/rdc321x-southbridge.c +++ b/drivers/mfd/rdc321x-southbridge.c @@ -56,7 +56,7 @@ static struct resource rdc321x_gpio_resources[] = { } }; -static struct mfd_cell rdc321x_sb_cells[] = { +static const struct mfd_cell rdc321x_sb_cells[] = { { .name = "rdc321x-wdt", .resources = rdc321x_wdt_resource, diff --git a/drivers/mfd/retu-mfd.c b/drivers/mfd/retu-mfd.c index a1830986eeb7..c8f345f7e9a2 100644 --- a/drivers/mfd/retu-mfd.c +++ b/drivers/mfd/retu-mfd.c @@ -55,7 +55,7 @@ static struct resource retu_pwrbutton_res[] = { }, }; -static struct mfd_cell retu_devs[] = { +static const struct mfd_cell retu_devs[] = { { .name = "retu-wdt" }, @@ -94,7 +94,7 @@ static struct resource tahvo_usb_res[] = { }, }; -static struct mfd_cell tahvo_devs[] = { +static const struct mfd_cell tahvo_devs[] = { { .name = "tahvo-usb", .resources = tahvo_usb_res, @@ -122,7 +122,7 @@ static const struct retu_data { char *chip_name; char *companion_name; struct regmap_irq_chip *irq_chip; - struct mfd_cell *children; + const struct mfd_cell *children; int nchildren; } retu_data[] = { [0] = { diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index 34c18fb8c089..3ad1b2fbee4a 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c @@ -31,7 +31,7 @@ #include <linux/mfd/samsung/s5m8767.h> #include <linux/regmap.h> -static struct mfd_cell s5m8751_devs[] = { +static const struct mfd_cell s5m8751_devs[] = { { .name = "s5m8751-pmic", }, { @@ -41,7 +41,7 @@ static struct mfd_cell s5m8751_devs[] = { }, }; -static struct mfd_cell s5m8763_devs[] = { +static const struct mfd_cell s5m8763_devs[] = { { .name = "s5m8763-pmic", }, { @@ -51,7 +51,7 @@ static struct mfd_cell s5m8763_devs[] = { }, }; -static struct mfd_cell s5m8767_devs[] = { +static const struct mfd_cell s5m8767_devs[] = { { .name = "s5m8767-pmic", }, { @@ -59,7 +59,7 @@ static struct mfd_cell s5m8767_devs[] = { }, }; -static struct mfd_cell s2mps11_devs[] = { +static const struct mfd_cell s2mps11_devs[] = { { .name = "s2mps11-pmic", }, { @@ -81,31 +81,31 @@ static struct of_device_id sec_dt_match[] = { int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest) { - return regmap_read(sec_pmic->regmap, reg, dest); + return regmap_read(sec_pmic->regmap_pmic, reg, dest); } EXPORT_SYMBOL_GPL(sec_reg_read); int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf) { - return regmap_bulk_read(sec_pmic->regmap, reg, buf, count); + return regmap_bulk_read(sec_pmic->regmap_pmic, reg, buf, count); } EXPORT_SYMBOL_GPL(sec_bulk_read); int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value) { - return regmap_write(sec_pmic->regmap, reg, value); + return regmap_write(sec_pmic->regmap_pmic, reg, value); } EXPORT_SYMBOL_GPL(sec_reg_write); int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf) { - return regmap_raw_write(sec_pmic->regmap, reg, buf, count); + return regmap_raw_write(sec_pmic->regmap_pmic, reg, buf, count); } EXPORT_SYMBOL_GPL(sec_bulk_write); int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask) { - return regmap_update_bits(sec_pmic->regmap, reg, mask, val); + return regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, val); } EXPORT_SYMBOL_GPL(sec_reg_update); @@ -134,12 +134,12 @@ static bool s5m8763_volatile(struct device *dev, unsigned int reg) } } -static struct regmap_config sec_regmap_config = { +static const struct regmap_config sec_regmap_config = { .reg_bits = 8, .val_bits = 8, }; -static struct regmap_config s2mps11_regmap_config = { +static const struct regmap_config s2mps11_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -148,7 +148,7 @@ static struct regmap_config s2mps11_regmap_config = { .cache_type = REGCACHE_FLAT, }; -static struct regmap_config s5m8763_regmap_config = { +static const struct regmap_config s5m8763_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -157,7 +157,7 @@ static struct regmap_config s5m8763_regmap_config = { .cache_type = REGCACHE_FLAT, }; -static struct regmap_config s5m8767_regmap_config = { +static const struct regmap_config s5m8767_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -166,6 +166,11 @@ static struct regmap_config s5m8767_regmap_config = { .cache_type = REGCACHE_FLAT, }; +static const struct regmap_config sec_rtc_regmap_config = { + .reg_bits = 8, + .val_bits = 8, +}; + #ifdef CONFIG_OF /* * Only the common platform data elements for s5m8767 are parsed here from the @@ -266,9 +271,9 @@ static int sec_pmic_probe(struct i2c_client *i2c, break; } - sec_pmic->regmap = devm_regmap_init_i2c(i2c, regmap); - if (IS_ERR(sec_pmic->regmap)) { - ret = PTR_ERR(sec_pmic->regmap); + sec_pmic->regmap_pmic = devm_regmap_init_i2c(i2c, regmap); + if (IS_ERR(sec_pmic->regmap_pmic)) { + ret = PTR_ERR(sec_pmic->regmap_pmic); dev_err(&i2c->dev, "Failed to allocate register map: %d\n", ret); return ret; @@ -277,6 +282,15 @@ static int sec_pmic_probe(struct i2c_client *i2c, sec_pmic->rtc = i2c_new_dummy(i2c->adapter, RTC_I2C_ADDR); i2c_set_clientdata(sec_pmic->rtc, sec_pmic); + sec_pmic->regmap_rtc = devm_regmap_init_i2c(sec_pmic->rtc, + &sec_rtc_regmap_config); + if (IS_ERR(sec_pmic->regmap_rtc)) { + ret = PTR_ERR(sec_pmic->regmap_rtc); + dev_err(&i2c->dev, "Failed to allocate RTC register map: %d\n", + ret); + return ret; + } + if (pdata && pdata->cfg_pmic_irq) pdata->cfg_pmic_irq(); @@ -309,6 +323,8 @@ static int sec_pmic_probe(struct i2c_client *i2c, if (ret) goto err; + device_init_wakeup(sec_pmic->dev, sec_pmic->wakeup); + return ret; err: @@ -327,6 +343,43 @@ static int sec_pmic_remove(struct i2c_client *i2c) return 0; } +static int sec_pmic_suspend(struct device *dev) +{ + struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); + struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c); + + if (device_may_wakeup(dev)) { + enable_irq_wake(sec_pmic->irq); + /* + * PMIC IRQ must be disabled during suspend for RTC alarm + * to work properly. + * When device is woken up from suspend by RTC Alarm, an + * interrupt occurs before resuming I2C bus controller. + * The interrupt is handled by regmap_irq_thread which tries + * to read RTC registers. This read fails (I2C is still + * suspended) and RTC Alarm interrupt is disabled. + */ + disable_irq(sec_pmic->irq); + } + + return 0; +} + +static int sec_pmic_resume(struct device *dev) +{ + struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); + struct sec_pmic_dev *sec_pmic = i2c_get_clientdata(i2c); + + if (device_may_wakeup(dev)) { + disable_irq_wake(sec_pmic->irq); + enable_irq(sec_pmic->irq); + } + + return 0; +} + +static SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, sec_pmic_suspend, sec_pmic_resume); + static const struct i2c_device_id sec_pmic_id[] = { { "sec_pmic", 0 }, { } @@ -337,6 +390,7 @@ static struct i2c_driver sec_pmic_driver = { .driver = { .name = "sec_pmic", .owner = THIS_MODULE, + .pm = &sec_pmic_pm_ops, .of_match_table = of_match_ptr(sec_dt_match), }, .probe = sec_pmic_probe, diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c index 0dd84e99081e..4de494f51d40 100644 --- a/drivers/mfd/sec-irq.c +++ b/drivers/mfd/sec-irq.c @@ -22,7 +22,7 @@ #include <linux/mfd/samsung/s5m8763.h> #include <linux/mfd/samsung/s5m8767.h> -static struct regmap_irq s2mps11_irqs[] = { +static const struct regmap_irq s2mps11_irqs[] = { [S2MPS11_IRQ_PWRONF] = { .reg_offset = 0, .mask = S2MPS11_IRQ_PWRONF_MASK, @@ -90,7 +90,7 @@ static struct regmap_irq s2mps11_irqs[] = { }; -static struct regmap_irq s5m8767_irqs[] = { +static const struct regmap_irq s5m8767_irqs[] = { [S5M8767_IRQ_PWRR] = { .reg_offset = 0, .mask = S5M8767_IRQ_PWRR_MASK, @@ -161,7 +161,7 @@ static struct regmap_irq s5m8767_irqs[] = { }, }; -static struct regmap_irq s5m8763_irqs[] = { +static const struct regmap_irq s5m8763_irqs[] = { [S5M8763_IRQ_DCINF] = { .reg_offset = 0, .mask = S5M8763_IRQ_DCINF_MASK, @@ -236,7 +236,7 @@ static struct regmap_irq s5m8763_irqs[] = { }, }; -static struct regmap_irq_chip s2mps11_irq_chip = { +static const struct regmap_irq_chip s2mps11_irq_chip = { .name = "s2mps11", .irqs = s2mps11_irqs, .num_irqs = ARRAY_SIZE(s2mps11_irqs), @@ -246,7 +246,7 @@ static struct regmap_irq_chip s2mps11_irq_chip = { .ack_base = S2MPS11_REG_INT1, }; -static struct regmap_irq_chip s5m8767_irq_chip = { +static const struct regmap_irq_chip s5m8767_irq_chip = { .name = "s5m8767", .irqs = s5m8767_irqs, .num_irqs = ARRAY_SIZE(s5m8767_irqs), @@ -256,7 +256,7 @@ static struct regmap_irq_chip s5m8767_irq_chip = { .ack_base = S5M8767_REG_INT1, }; -static struct regmap_irq_chip s5m8763_irq_chip = { +static const struct regmap_irq_chip s5m8763_irq_chip = { .name = "s5m8763", .irqs = s5m8763_irqs, .num_irqs = ARRAY_SIZE(s5m8763_irqs), @@ -280,19 +280,19 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic) switch (type) { case S5M8763X: - ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, + ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq, IRQF_TRIGGER_FALLING | IRQF_ONESHOT, sec_pmic->irq_base, &s5m8763_irq_chip, &sec_pmic->irq_data); break; case S5M8767X: - ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, + ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq, IRQF_TRIGGER_FALLING | IRQF_ONESHOT, sec_pmic->irq_base, &s5m8767_irq_chip, &sec_pmic->irq_data); break; case S2MPS11X: - ret = regmap_add_irq_chip(sec_pmic->regmap, sec_pmic->irq, + ret = regmap_add_irq_chip(sec_pmic->regmap_pmic, sec_pmic->irq, IRQF_TRIGGER_FALLING | IRQF_ONESHOT, sec_pmic->irq_base, &s2mps11_irq_chip, &sec_pmic->irq_data); diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index fff63a41862c..42ccd0544513 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c @@ -297,14 +297,14 @@ static struct resource stmpe_gpio_resources[] = { }, }; -static struct mfd_cell stmpe_gpio_cell = { +static const struct mfd_cell stmpe_gpio_cell = { .name = "stmpe-gpio", .of_compatible = "st,stmpe-gpio", .resources = stmpe_gpio_resources, .num_resources = ARRAY_SIZE(stmpe_gpio_resources), }; -static struct mfd_cell stmpe_gpio_cell_noirq = { +static const struct mfd_cell stmpe_gpio_cell_noirq = { .name = "stmpe-gpio", .of_compatible = "st,stmpe-gpio", /* gpio cell resources consist of an irq only so no resources here */ @@ -325,7 +325,7 @@ static struct resource stmpe_keypad_resources[] = { }, }; -static struct mfd_cell stmpe_keypad_cell = { +static const struct mfd_cell stmpe_keypad_cell = { .name = "stmpe-keypad", .of_compatible = "st,stmpe-keypad", .resources = stmpe_keypad_resources, @@ -409,7 +409,7 @@ static struct resource stmpe_ts_resources[] = { }, }; -static struct mfd_cell stmpe_ts_cell = { +static const struct mfd_cell stmpe_ts_cell = { .name = "stmpe-ts", .of_compatible = "st,stmpe-ts", .resources = stmpe_ts_resources, @@ -1064,7 +1064,7 @@ static int stmpe_chip_init(struct stmpe *stmpe) return stmpe_reg_write(stmpe, stmpe->regs[STMPE_IDX_ICR_LSB], icr); } -static int stmpe_add_device(struct stmpe *stmpe, struct mfd_cell *cell) +static int stmpe_add_device(struct stmpe *stmpe, const struct mfd_cell *cell) { return mfd_add_devices(stmpe->dev, stmpe->pdata->id, cell, 1, NULL, stmpe->irq_base, stmpe->domain); diff --git a/drivers/mfd/stmpe.h b/drivers/mfd/stmpe.h index ff2b09ba8797..6639f1b0fef5 100644 --- a/drivers/mfd/stmpe.h +++ b/drivers/mfd/stmpe.h @@ -38,7 +38,7 @@ static inline void stmpe_dump_bytes(const char *str, const void *buf, * enable and altfunc callbacks */ struct stmpe_variant_block { - struct mfd_cell *cell; + const struct mfd_cell *cell; int irq; enum stmpe_block block; }; diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c index 87ea51dc6234..2cf636c267d9 100644 --- a/drivers/mfd/tc3589x.c +++ b/drivers/mfd/tc3589x.c @@ -155,7 +155,7 @@ static struct resource keypad_resources[] = { }, }; -static struct mfd_cell tc3589x_dev_gpio[] = { +static const struct mfd_cell tc3589x_dev_gpio[] = { { .name = "tc3589x-gpio", .num_resources = ARRAY_SIZE(gpio_resources), @@ -164,7 +164,7 @@ static struct mfd_cell tc3589x_dev_gpio[] = { }, }; -static struct mfd_cell tc3589x_dev_keypad[] = { +static const struct mfd_cell tc3589x_dev_keypad[] = { { .name = "tc3589x-keypad", .num_resources = ARRAY_SIZE(keypad_resources), diff --git a/drivers/mfd/tc6387xb.c b/drivers/mfd/tc6387xb.c index acd0f3a41044..591a331d8d83 100644 --- a/drivers/mfd/tc6387xb.c +++ b/drivers/mfd/tc6387xb.c @@ -126,7 +126,7 @@ static struct tmio_mmc_data tc6387xb_mmc_data = { /*--------------------------------------------------------------------------*/ -static struct mfd_cell tc6387xb_cells[] = { +static const struct mfd_cell tc6387xb_cells[] = { [TC6387XB_CELL_MMC] = { .name = "tmio-mmc", .enable = tc6387xb_mmc_enable, diff --git a/drivers/mfd/ti-ssp.c b/drivers/mfd/ti-ssp.c index 71e3e0c5bf73..a5424579679c 100644 --- a/drivers/mfd/ti-ssp.c +++ b/drivers/mfd/ti-ssp.c @@ -32,6 +32,7 @@ #include <linux/platform_device.h> #include <linux/delay.h> #include <linux/io.h> +#include <linux/sched.h> #include <linux/mfd/core.h> #include <linux/mfd/ti_ssp.h> @@ -409,7 +410,6 @@ static int ti_ssp_probe(struct platform_device *pdev) cells[id].id = id; cells[id].name = data->dev_name; cells[id].platform_data = data->pdata; - cells[id].data_size = data->pdata_size; } error = mfd_add_devices(dev, 0, cells, 2, NULL, 0, NULL); diff --git a/drivers/mfd/timberdale.c b/drivers/mfd/timberdale.c index dbb34f94e5e3..c6668ac70af3 100644 --- a/drivers/mfd/timberdale.c +++ b/drivers/mfd/timberdale.c @@ -374,7 +374,7 @@ static const struct resource timberdale_dma_resources[] = { }, }; -static struct mfd_cell timberdale_cells_bar0_cfg0[] = { +static const struct mfd_cell timberdale_cells_bar0_cfg0[] = { { .name = "timb-dma", .num_resources = ARRAY_SIZE(timberdale_dma_resources), @@ -431,7 +431,7 @@ static struct mfd_cell timberdale_cells_bar0_cfg0[] = { }, }; -static struct mfd_cell timberdale_cells_bar0_cfg1[] = { +static const struct mfd_cell timberdale_cells_bar0_cfg1[] = { { .name = "timb-dma", .num_resources = ARRAY_SIZE(timberdale_dma_resources), @@ -498,7 +498,7 @@ static struct mfd_cell timberdale_cells_bar0_cfg1[] = { }, }; -static struct mfd_cell timberdale_cells_bar0_cfg2[] = { +static const struct mfd_cell timberdale_cells_bar0_cfg2[] = { { .name = "timb-dma", .num_resources = ARRAY_SIZE(timberdale_dma_resources), @@ -548,7 +548,7 @@ static struct mfd_cell timberdale_cells_bar0_cfg2[] = { }, }; -static struct mfd_cell timberdale_cells_bar0_cfg3[] = { +static const struct mfd_cell timberdale_cells_bar0_cfg3[] = { { .name = "timb-dma", .num_resources = ARRAY_SIZE(timberdale_dma_resources), @@ -619,7 +619,7 @@ static const struct resource timberdale_sdhc_resources[] = { }, }; -static struct mfd_cell timberdale_cells_bar1[] = { +static const struct mfd_cell timberdale_cells_bar1[] = { { .name = "sdhci", .num_resources = ARRAY_SIZE(timberdale_sdhc_resources), @@ -627,7 +627,7 @@ static struct mfd_cell timberdale_cells_bar1[] = { }, }; -static struct mfd_cell timberdale_cells_bar2[] = { +static const struct mfd_cell timberdale_cells_bar2[] = { { .name = "sdhci", .num_resources = ARRAY_SIZE(timberdale_sdhc_resources), diff --git a/drivers/mfd/tps6507x.c b/drivers/mfd/tps6507x.c index a081b925d10b..3b27482a174f 100644 --- a/drivers/mfd/tps6507x.c +++ b/drivers/mfd/tps6507x.c @@ -24,7 +24,7 @@ #include <linux/mfd/core.h> #include <linux/mfd/tps6507x.h> -static struct mfd_cell tps6507x_devs[] = { +static const struct mfd_cell tps6507x_devs[] = { { .name = "tps6507x-pmic", }, diff --git a/drivers/mfd/tps65090.c b/drivers/mfd/tps65090.c index e6f03a733879..ba1a25d758c1 100644 --- a/drivers/mfd/tps65090.c +++ b/drivers/mfd/tps65090.c @@ -64,7 +64,7 @@ static struct resource charger_resources[] = { } }; -static struct mfd_cell tps65090s[] = { +static const struct mfd_cell tps65090s[] = { { .name = "tps65090-pmic", }, diff --git a/drivers/mfd/tps65217.c b/drivers/mfd/tps65217.c index b7be0b295575..6939ae56c2e1 100644 --- a/drivers/mfd/tps65217.c +++ b/drivers/mfd/tps65217.c @@ -30,7 +30,7 @@ #include <linux/mfd/core.h> #include <linux/mfd/tps65217.h> -static struct mfd_cell tps65217s[] = { +static const struct mfd_cell tps65217s[] = { { .name = "tps65217-pmic", }, diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index ee61fd7c198d..d0e57934370f 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c @@ -103,7 +103,7 @@ static struct resource tps6586x_rtc_resources[] = { }, }; -static struct mfd_cell tps6586x_cell[] = { +static const struct mfd_cell tps6586x_cell[] = { { .name = "tps6586x-gpio", }, diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c index c0f608e3ca9e..1f142d76cbbc 100644 --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c @@ -36,7 +36,7 @@ static struct resource rtc_resources[] = { } }; -static struct mfd_cell tps65910s[] = { +static const struct mfd_cell tps65910s[] = { { .name = "tps65910-gpio", }, diff --git a/drivers/mfd/tps65912-core.c b/drivers/mfd/tps65912-core.c index 925a044cbdf6..27a518e0eec6 100644 --- a/drivers/mfd/tps65912-core.c +++ b/drivers/mfd/tps65912-core.c @@ -21,7 +21,7 @@ #include <linux/mfd/core.h> #include <linux/mfd/tps65912.h> -static struct mfd_cell tps65912s[] = { +static const struct mfd_cell tps65912s[] = { { .name = "tps65912-pmic", }, diff --git a/drivers/mfd/tps80031.c b/drivers/mfd/tps80031.c index f15ee6d5cfbf..ed6c5b0956e2 100644 --- a/drivers/mfd/tps80031.c +++ b/drivers/mfd/tps80031.c @@ -44,7 +44,7 @@ static struct resource tps80031_rtc_resources[] = { }; /* TPS80031 sub mfd devices */ -static struct mfd_cell tps80031_cell[] = { +static const struct mfd_cell tps80031_cell[] = { { .name = "tps80031-pmic", }, diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index 6ef7685a4cf8..ed718328eff1 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c @@ -837,62 +837,6 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base, usb3v1[0].dev_name = dev_name(child); } } - if (IS_ENABLED(CONFIG_TWL6030_USB) && pdata->usb && - twl_class_is_6030()) { - - static struct regulator_consumer_supply usb3v3; - int regulator; - - if (IS_ENABLED(CONFIG_REGULATOR_TWL4030)) { - /* this is a template that gets copied */ - struct regulator_init_data usb_fixed = { - .constraints.valid_modes_mask = - REGULATOR_MODE_NORMAL - | REGULATOR_MODE_STANDBY, - .constraints.valid_ops_mask = - REGULATOR_CHANGE_MODE - | REGULATOR_CHANGE_STATUS, - }; - - if (features & TWL6032_SUBCLASS) { - usb3v3.supply = "ldousb"; - regulator = TWL6032_REG_LDOUSB; - } else { - usb3v3.supply = "vusb"; - regulator = TWL6030_REG_VUSB; - } - child = add_regulator_linked(regulator, &usb_fixed, - &usb3v3, 1, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - } - - pdata->usb->features = features; - - child = add_child(TWL_MODULE_USB, "twl6030_usb", - pdata->usb, sizeof(*pdata->usb), true, - /* irq1 = VBUS_PRES, irq0 = USB ID */ - irq_base + USBOTG_INTR_OFFSET, - irq_base + USB_PRES_INTR_OFFSET); - - if (IS_ERR(child)) - return PTR_ERR(child); - /* we need to connect regulators to this transceiver */ - if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && child) - usb3v3.dev_name = dev_name(child); - } else if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && - twl_class_is_6030()) { - if (features & TWL6032_SUBCLASS) - child = add_regulator(TWL6032_REG_LDOUSB, - pdata->ldousb, features); - else - child = add_regulator(TWL6030_REG_VUSB, - pdata->vusb, features); - - if (IS_ERR(child)) - return PTR_ERR(child); - } if (IS_ENABLED(CONFIG_TWL4030_WATCHDOG) && twl_class_is_4030()) { child = add_child(TWL_MODULE_PM_RECEIVER, "twl4030_wdt", NULL, @@ -1006,148 +950,6 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base, return PTR_ERR(child); } - /* twl6030 regulators */ - if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && twl_class_is_6030() && - !(features & TWL6032_SUBCLASS)) { - child = add_regulator(TWL6030_REG_VDD1, pdata->vdd1, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6030_REG_VDD2, pdata->vdd2, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6030_REG_VDD3, pdata->vdd3, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6030_REG_V1V8, pdata->v1v8, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6030_REG_V2V1, pdata->v2v1, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6030_REG_VMMC, pdata->vmmc, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6030_REG_VPP, pdata->vpp, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6030_REG_VUSIM, pdata->vusim, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6030_REG_VCXIO, pdata->vcxio, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6030_REG_VDAC, pdata->vdac, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6030_REG_VAUX1_6030, pdata->vaux1, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6030_REG_VAUX2_6030, pdata->vaux2, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6030_REG_VAUX3_6030, pdata->vaux3, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6030_REG_CLK32KG, pdata->clk32kg, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - } - - /* 6030 and 6025 share this regulator */ - if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && twl_class_is_6030()) { - child = add_regulator(TWL6030_REG_VANA, pdata->vana, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - } - - /* twl6032 regulators */ - if (IS_ENABLED(CONFIG_REGULATOR_TWL4030) && twl_class_is_6030() && - (features & TWL6032_SUBCLASS)) { - child = add_regulator(TWL6032_REG_LDO5, pdata->ldo5, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6032_REG_LDO1, pdata->ldo1, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6032_REG_LDO7, pdata->ldo7, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6032_REG_LDO6, pdata->ldo6, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6032_REG_LDOLN, pdata->ldoln, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6032_REG_LDO2, pdata->ldo2, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6032_REG_LDO4, pdata->ldo4, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6032_REG_LDO3, pdata->ldo3, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6032_REG_SMPS3, pdata->smps3, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6032_REG_SMPS4, pdata->smps4, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - child = add_regulator(TWL6032_REG_VIO, pdata->vio6025, - features); - if (IS_ERR(child)) - return PTR_ERR(child); - - } - if (IS_ENABLED(CONFIG_CHARGER_TWL4030) && pdata->bci && !(features & (TPS_SUBSET | TWL5031))) { child = add_child(TWL_MODULE_MAIN_CHARGE, "twl4030_bci", @@ -1269,6 +1071,11 @@ static int twl_remove(struct i2c_client *client) return 0; } +static struct of_dev_auxdata twl_auxdata_lookup[] = { + OF_DEV_AUXDATA("ti,twl4030-gpio", 0, "twl4030-gpio", NULL), + { /* sentinel */ }, +}; + /* NOTE: This driver only handles a single twl4030/tps659x0 chip */ static int twl_probe(struct i2c_client *client, const struct i2c_device_id *id) @@ -1407,10 +1214,14 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) twl_i2c_write_u8(TWL4030_MODULE_INTBR, temp, REG_GPPUPDCTR1); } - if (node) - status = of_platform_populate(node, NULL, NULL, &client->dev); - else + if (node) { + if (pdata) + twl_auxdata_lookup[0].platform_data = pdata->gpio; + status = of_platform_populate(node, NULL, twl_auxdata_lookup, + &client->dev); + } else { status = add_children(pdata, irq_base, id->driver_data); + } fail: if (status < 0) diff --git a/drivers/mfd/viperboard.c b/drivers/mfd/viperboard.c index af2a6703f34f..e00f5340ed87 100644 --- a/drivers/mfd/viperboard.c +++ b/drivers/mfd/viperboard.c @@ -37,7 +37,7 @@ static const struct usb_device_id vprbrd_table[] = { MODULE_DEVICE_TABLE(usb, vprbrd_table); -static struct mfd_cell vprbrd_devs[] = { +static const struct mfd_cell vprbrd_devs[] = { { .name = "viperboard-gpio", }, diff --git a/drivers/mfd/vx855.c b/drivers/mfd/vx855.c index 757ecc63338c..5cd5661158bc 100644 --- a/drivers/mfd/vx855.c +++ b/drivers/mfd/vx855.c @@ -60,7 +60,7 @@ static struct resource vx855_gpio_resources[] = { }, }; -static struct mfd_cell vx855_cells[] = { +static const struct mfd_cell vx855_cells[] = { { .name = "vx855_gpio", .num_resources = ARRAY_SIZE(vx855_gpio_resources), diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c index bf8b3b5ad1fe..8dc49ec3b246 100644 --- a/drivers/mfd/wm5110-tables.c +++ b/drivers/mfd/wm5110-tables.c @@ -14,6 +14,7 @@ #include <linux/mfd/arizona/core.h> #include <linux/mfd/arizona/registers.h> +#include <linux/device.h> #include "arizona.h" @@ -504,7 +505,7 @@ static const struct reg_default wm5110_reg_default[] = { { 0x000001AA, 0x0004 }, /* R426 - FLL2 GPIO Clock */ { 0x00000200, 0x0006 }, /* R512 - Mic Charge Pump 1 */ { 0x00000210, 0x0184 }, /* R528 - LDO1 Control 1 */ - { 0x00000213, 0x0344 }, /* R531 - LDO2 Control 1 */ + { 0x00000213, 0x03E4 }, /* R531 - LDO2 Control 1 */ { 0x00000218, 0x01A6 }, /* R536 - Mic Bias Ctrl 1 */ { 0x00000219, 0x01A6 }, /* R537 - Mic Bias Ctrl 2 */ { 0x0000021A, 0x01A6 }, /* R538 - Mic Bias Ctrl 3 */ @@ -524,6 +525,7 @@ static const struct reg_default wm5110_reg_default[] = { { 0x00000300, 0x0000 }, /* R768 - Input Enables */ { 0x00000308, 0x0000 }, /* R776 - Input Rate */ { 0x00000309, 0x0022 }, /* R777 - Input Volume Ramp */ + { 0x0000030C, 0x0002 }, /* R780 - HPF Control */ { 0x00000310, 0x2080 }, /* R784 - IN1L Control */ { 0x00000311, 0x0180 }, /* R785 - ADC Digital Volume 1L */ { 0x00000312, 0x0000 }, /* R786 - DMIC1L Control */ @@ -545,6 +547,7 @@ static const struct reg_default wm5110_reg_default[] = { { 0x00000328, 0x2000 }, /* R808 - IN4L Control */ { 0x00000329, 0x0180 }, /* R809 - ADC Digital Volume 4L */ { 0x0000032A, 0x0000 }, /* R810 - DMIC4L Control */ + { 0x0000032C, 0x0000 }, /* R812 - IN4R Control */ { 0x0000032D, 0x0180 }, /* R813 - ADC Digital Volume 4R */ { 0x0000032E, 0x0000 }, /* R814 - DMIC4R Control */ { 0x00000400, 0x0000 }, /* R1024 - Output Enables 1 */ @@ -1342,6 +1345,64 @@ static const struct reg_default wm5110_reg_default[] = { { 0x00001404, 0x0000 }, /* R5124 - DSP4 Status 1 */ }; +static bool wm5110_is_rev_b_adsp_memory(unsigned int reg) +{ + if ((reg >= 0x100000 && reg < 0x103000) || + (reg >= 0x180000 && reg < 0x181000) || + (reg >= 0x190000 && reg < 0x192000) || + (reg >= 0x1a8000 && reg < 0x1a9000) || + (reg >= 0x200000 && reg < 0x209000) || + (reg >= 0x280000 && reg < 0x281000) || + (reg >= 0x290000 && reg < 0x29a000) || + (reg >= 0x2a8000 && reg < 0x2aa000) || + (reg >= 0x300000 && reg < 0x30f000) || + (reg >= 0x380000 && reg < 0x382000) || + (reg >= 0x390000 && reg < 0x39e000) || + (reg >= 0x3a8000 && reg < 0x3b6000) || + (reg >= 0x400000 && reg < 0x403000) || + (reg >= 0x480000 && reg < 0x481000) || + (reg >= 0x490000 && reg < 0x492000) || + (reg >= 0x4a8000 && reg < 0x4a9000)) + return true; + else + return false; +} + +static bool wm5110_is_rev_d_adsp_memory(unsigned int reg) +{ + if ((reg >= 0x100000 && reg < 0x106000) || + (reg >= 0x180000 && reg < 0x182000) || + (reg >= 0x190000 && reg < 0x198000) || + (reg >= 0x1a8000 && reg < 0x1aa000) || + (reg >= 0x200000 && reg < 0x20f000) || + (reg >= 0x280000 && reg < 0x282000) || + (reg >= 0x290000 && reg < 0x29c000) || + (reg >= 0x2a6000 && reg < 0x2b4000) || + (reg >= 0x300000 && reg < 0x30f000) || + (reg >= 0x380000 && reg < 0x382000) || + (reg >= 0x390000 && reg < 0x3a2000) || + (reg >= 0x3a6000 && reg < 0x3b4000) || + (reg >= 0x400000 && reg < 0x406000) || + (reg >= 0x480000 && reg < 0x482000) || + (reg >= 0x490000 && reg < 0x498000) || + (reg >= 0x4a8000 && reg < 0x4aa000)) + return true; + else + return false; +} + +static bool wm5110_is_adsp_memory(struct device *dev, unsigned int reg) +{ + struct arizona *arizona = dev_get_drvdata(dev); + + switch (arizona->rev) { + case 0 ... 2: + return wm5110_is_rev_b_adsp_memory(reg); + default: + return wm5110_is_rev_d_adsp_memory(reg); + } +} + static bool wm5110_readable_register(struct device *dev, unsigned int reg) { switch (reg) { @@ -1460,6 +1521,7 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg) case ARIZONA_INPUT_ENABLES_STATUS: case ARIZONA_INPUT_RATE: case ARIZONA_INPUT_VOLUME_RAMP: + case ARIZONA_HPF_CONTROL: case ARIZONA_IN1L_CONTROL: case ARIZONA_ADC_DIGITAL_VOLUME_1L: case ARIZONA_DMIC1L_CONTROL: @@ -1481,6 +1543,7 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg) case ARIZONA_IN4L_CONTROL: case ARIZONA_ADC_DIGITAL_VOLUME_4L: case ARIZONA_DMIC4L_CONTROL: + case ARIZONA_IN4R_CONTROL: case ARIZONA_ADC_DIGITAL_VOLUME_4R: case ARIZONA_DMIC4R_CONTROL: case ARIZONA_OUTPUT_ENABLES_1: @@ -2331,7 +2394,7 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg) case ARIZONA_DSP4_SCRATCH_3: return true; default: - return false; + return wm5110_is_adsp_memory(dev, reg); } } @@ -2407,16 +2470,18 @@ static bool wm5110_volatile_register(struct device *dev, unsigned int reg) case ARIZONA_DSP4_SCRATCH_3: return true; default: - return false; + return wm5110_is_adsp_memory(dev, reg); } } +#define WM5110_MAX_REGISTER 0x4a9fff + const struct regmap_config wm5110_spi_regmap = { .reg_bits = 32, .pad_bits = 16, .val_bits = 16, - .max_register = ARIZONA_DSP1_STATUS_2, + .max_register = WM5110_MAX_REGISTER, .readable_reg = wm5110_readable_register, .volatile_reg = wm5110_volatile_register, @@ -2430,7 +2495,7 @@ const struct regmap_config wm5110_i2c_regmap = { .reg_bits = 32, .val_bits = 16, - .max_register = ARIZONA_DSP1_STATUS_2, + .max_register = WM5110_MAX_REGISTER, .readable_reg = wm5110_readable_register, .volatile_reg = wm5110_volatile_register, diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c index 5c459f469224..28366a90e1ad 100644 --- a/drivers/mfd/wm831x-core.c +++ b/drivers/mfd/wm831x-core.c @@ -1011,7 +1011,7 @@ static struct resource wm831x_wdt_resources[] = { }, }; -static struct mfd_cell wm8310_devs[] = { +static const struct mfd_cell wm8310_devs[] = { { .name = "wm831x-backup", }, @@ -1165,7 +1165,7 @@ static struct mfd_cell wm8310_devs[] = { }, }; -static struct mfd_cell wm8311_devs[] = { +static const struct mfd_cell wm8311_devs[] = { { .name = "wm831x-backup", }, @@ -1295,7 +1295,7 @@ static struct mfd_cell wm8311_devs[] = { }, }; -static struct mfd_cell wm8312_devs[] = { +static const struct mfd_cell wm8312_devs[] = { { .name = "wm831x-backup", }, @@ -1449,7 +1449,7 @@ static struct mfd_cell wm8312_devs[] = { }, }; -static struct mfd_cell wm8320_devs[] = { +static const struct mfd_cell wm8320_devs[] = { { .name = "wm831x-backup", }, @@ -1578,7 +1578,7 @@ static struct mfd_cell wm8320_devs[] = { }, }; -static struct mfd_cell touch_devs[] = { +static const struct mfd_cell touch_devs[] = { { .name = "wm831x-touch", .num_resources = ARRAY_SIZE(wm831x_touch_resources), @@ -1586,7 +1586,7 @@ static struct mfd_cell touch_devs[] = { }, }; -static struct mfd_cell rtc_devs[] = { +static const struct mfd_cell rtc_devs[] = { { .name = "wm831x-rtc", .num_resources = ARRAY_SIZE(wm831x_rtc_resources), @@ -1594,7 +1594,7 @@ static struct mfd_cell rtc_devs[] = { }, }; -static struct mfd_cell backlight_devs[] = { +static const struct mfd_cell backlight_devs[] = { { .name = "wm831x-backlight", }, diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 030827511667..ba04f1bc70eb 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c @@ -33,7 +33,7 @@ #include "wm8994.h" -static struct mfd_cell wm8994_regulator_devs[] = { +static const struct mfd_cell wm8994_regulator_devs[] = { { .name = "wm8994-ldo", .id = 1, @@ -62,7 +62,7 @@ static struct resource wm8994_gpio_resources[] = { }, }; -static struct mfd_cell wm8994_devs[] = { +static const struct mfd_cell wm8994_devs[] = { { .name = "wm8994-codec", .num_resources = ARRAY_SIZE(wm8994_codec_resources), |