From 2809126512fcbd61ce3140af0bc255b441fcdaf9 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 13 Jun 2013 10:48:11 +0100 Subject: [PATCH 1/7] mfd: ab8500-core: Drop references to ab8500-leds The ab8500-leds driver has never been upstreamed and was replaced by a PWM framework based driver, so these references are not needed anymore. Acked-by: Linus Walleij Signed-off-by: Fabio Baltieri Signed-off-by: Lee Jones --- drivers/mfd/ab8500-core.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index 258b367e3989..1863985df615 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -1098,10 +1098,6 @@ static struct mfd_cell ab8500_devs[] = { .of_compatible = "stericsson,ab8500-pwm", .id = 3, }, - { - .name = "ab8500-leds", - .of_compatible = "stericsson,ab8500-leds", - }, { .name = "ab8500-denc", .of_compatible = "stericsson,ab8500-denc", @@ -1170,9 +1166,6 @@ static struct mfd_cell ab9540_devs[] = { .name = "ab8500-pwm", .id = 1, }, - { - .name = "ab8500-leds", - }, { .name = "abx500-temp", .num_resources = ARRAY_SIZE(ab8500_temp_resources), @@ -1241,9 +1234,6 @@ static struct mfd_cell ab8505_devs[] = { .name = "ab8500-pwm", .id = 1, }, - { - .name = "ab8500-leds", - }, { .name = "pinctrl-ab8505", }, @@ -1305,9 +1295,6 @@ static struct mfd_cell ab8540_devs[] = { .name = "ab8500-pwm", .id = 1, }, - { - .name = "ab8500-leds", - }, { .name = "abx500-temp", .num_resources = ARRAY_SIZE(ab8500_temp_resources), From 9c717cf3fa16f8ae8c6ccb8f4f8e784404ac9689 Mon Sep 17 00:00:00 2001 From: Alexandre Torgue Date: Fri, 24 May 2013 11:59:47 +0200 Subject: [PATCH 2/7] mfd: ab8500-core: Add device for new RTC version for AB8540 cut2 AB8540 RTC have changed between AB8540_cut1 and AB8540_cut2.Different ressources to define for those two version. Acked-by: Linus Walleij Signed-off-by: Julien Delacou Signed-off-by: Alexandre Torgue Signed-off-by: Lee Jones --- drivers/mfd/ab8500-core.c | 55 ++++++++++++++++++++++++++----- include/linux/mfd/abx500/ab8500.h | 2 ++ 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index 1863985df615..02698da00b78 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -650,6 +650,21 @@ static struct resource ab8500_rtc_resources[] = { }, }; +static struct resource ab8540_rtc_resources[] = { + { + .name = "1S", + .start = AB8540_INT_RTC_1S, + .end = AB8540_INT_RTC_1S, + .flags = IORESOURCE_IRQ, + }, + { + .name = "ALARM", + .start = AB8500_INT_RTC_ALARM, + .end = AB8500_INT_RTC_ALARM, + .flags = IORESOURCE_IRQ, + }, +}; + static struct resource ab8500_poweronkey_db_resources[] = { { .name = "ONKEY_DBF", @@ -1276,11 +1291,6 @@ static struct mfd_cell ab8540_devs[] = { .num_resources = ARRAY_SIZE(ab8505_gpadc_resources), .resources = ab8505_gpadc_resources, }, - { - .name = "ab8500-rtc", - .num_resources = ARRAY_SIZE(ab8500_rtc_resources), - .resources = ab8500_rtc_resources, - }, { .name = "ab8500-acc-det", .num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources), @@ -1318,6 +1328,24 @@ static struct mfd_cell ab8540_devs[] = { }, }; +static struct mfd_cell ab8540_cut1_devs[] = { + { + .name = "ab8500-rtc", + .of_compatible = "stericsson,ab8500-rtc", + .num_resources = ARRAY_SIZE(ab8500_rtc_resources), + .resources = ab8500_rtc_resources, + }, +}; + +static struct mfd_cell ab8540_cut2_devs[] = { + { + .name = "ab8540-rtc", + .of_compatible = "stericsson,ab8540-rtc", + .num_resources = ARRAY_SIZE(ab8540_rtc_resources), + .resources = ab8540_rtc_resources, + }, +}; + static ssize_t show_chip_id(struct device *dev, struct device_attribute *attr, char *buf) { @@ -1721,11 +1749,22 @@ static int ab8500_probe(struct platform_device *pdev) ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs, ARRAY_SIZE(ab9540_devs), NULL, ab8500->irq_base, ab8500->domain); - else if (is_ab8540(ab8500)) + else if (is_ab8540(ab8500)) { ret = mfd_add_devices(ab8500->dev, 0, ab8540_devs, ARRAY_SIZE(ab8540_devs), NULL, - ab8500->irq_base, ab8500->domain); - else if (is_ab8505(ab8500)) + ab8500->irq_base, NULL); + if (ret) + return ret; + + if (is_ab8540_1p2_or_earlier(ab8500)) + ret = mfd_add_devices(ab8500->dev, 0, ab8540_cut1_devs, + ARRAY_SIZE(ab8540_cut1_devs), NULL, + ab8500->irq_base, NULL); + else /* ab8540 >= cut2 */ + ret = mfd_add_devices(ab8500->dev, 0, ab8540_cut2_devs, + ARRAY_SIZE(ab8540_cut2_devs), NULL, + ab8500->irq_base, NULL); + } else if (is_ab8505(ab8500)) ret = mfd_add_devices(ab8500->dev, 0, ab8505_devs, ARRAY_SIZE(ab8505_devs), NULL, ab8500->irq_base, ab8500->domain); diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h index 0390d5943ed6..f4acd898dac9 100644 --- a/include/linux/mfd/abx500/ab8500.h +++ b/include/linux/mfd/abx500/ab8500.h @@ -291,6 +291,8 @@ enum ab8500_version { #define AB8540_INT_FSYNC2R 213 #define AB8540_INT_BITCLK2F 214 #define AB8540_INT_BITCLK2R 215 +/* ab8540_irq_regoffset[27] -> IT[Source|Latch|Mask]33 */ +#define AB8540_INT_RTC_1S 216 /* * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the From fccf14ad1e4f09a4033908ead9bf3f393979d54b Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Thu, 30 May 2013 15:27:45 +0200 Subject: [PATCH 3/7] mfd: ab8500-core: Add of_compatible property for ab8500-codec Add of_compatible string to the ab8500-codec cell to allow the driver to grab handlers such as regulators from device-tree when available. Signed-off-by: Fabio Baltieri Signed-off-by: Lee Jones --- drivers/mfd/ab8500-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index 02698da00b78..ca6bd1c8bd3f 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -1135,6 +1135,7 @@ static struct mfd_cell ab8500_devs[] = { }, { .name = "ab8500-codec", + .of_compatible = "stericsson,ab8500-codec", }, }; From 8420a24138e4ad7a8351bef136139ecb27cb15c5 Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Tue, 4 Jun 2013 13:11:50 +0900 Subject: [PATCH 4/7] mfd: Replace strict_strtoul() with kstrtoul() in ab* and att* The usage of strict_strtoul() is not preferred, because strict_strtoul() is obsolete. Thus, kstrtoul() should be used. Signed-off-by: Jingoo Han Reviewed-by: Andy Shevchenko Signed-off-by: Lee Jones --- drivers/mfd/aat2870-core.c | 5 +++-- drivers/mfd/ab3100-core.c | 28 ++++++++++------------------ drivers/mfd/ab8500-debugfs.c | 2 +- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c index dfdb0a2b6835..d4f594517521 100644 --- a/drivers/mfd/aat2870-core.c +++ b/drivers/mfd/aat2870-core.c @@ -312,8 +312,9 @@ static ssize_t aat2870_reg_write_file(struct file *file, while (*start == ' ') start++; - if (strict_strtoul(start, 16, &val)) - return -EINVAL; + ret = kstrtoul(start, 16, &val); + if (ret) + return ret; ret = aat2870->write(aat2870, (u8)addr, (u8)val); if (ret) diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c index a9bb140bc86b..ddc669d19530 100644 --- a/drivers/mfd/ab3100-core.c +++ b/drivers/mfd/ab3100-core.c @@ -491,7 +491,7 @@ static ssize_t ab3100_get_set_reg(struct file *file, char buf[32]; ssize_t buf_size; int regp; - unsigned long user_reg; + u8 user_reg; int err; int i = 0; @@ -514,34 +514,29 @@ static ssize_t ab3100_get_set_reg(struct file *file, /* * Advance pointer to end of string then terminate * the register string. This is needed to satisfy - * the strict_strtoul() function. + * the kstrtou8() function. */ while ((i < buf_size) && (buf[i] != ' ')) i++; buf[i] = '\0'; - err = strict_strtoul(&buf[regp], 16, &user_reg); + err = kstrtou8(&buf[regp], 16, &user_reg); if (err) return err; - if (user_reg > 0xff) - return -EINVAL; /* Either we read or we write a register here */ if (!priv->mode) { /* Reading */ - u8 reg = (u8) user_reg; u8 regvalue; - ab3100_get_register_interruptible(ab3100, reg, ®value); + ab3100_get_register_interruptible(ab3100, user_reg, ®value); dev_info(ab3100->dev, "debug read AB3100 reg[0x%02x]: 0x%02x\n", - reg, regvalue); + user_reg, regvalue); } else { int valp; - unsigned long user_value; - u8 reg = (u8) user_reg; - u8 value; + u8 user_value; u8 regvalue; /* @@ -557,20 +552,17 @@ static ssize_t ab3100_get_set_reg(struct file *file, i++; buf[i] = '\0'; - err = strict_strtoul(&buf[valp], 16, &user_value); + err = kstrtou8(&buf[valp], 16, &user_value); if (err) return err; - if (user_reg > 0xff) - return -EINVAL; - value = (u8) user_value; - ab3100_set_register_interruptible(ab3100, reg, value); - ab3100_get_register_interruptible(ab3100, reg, ®value); + ab3100_set_register_interruptible(ab3100, user_reg, user_value); + ab3100_get_register_interruptible(ab3100, user_reg, ®value); dev_info(ab3100->dev, "debug write reg[0x%02x] with 0x%02x, " "after readback: 0x%02x\n", - reg, value, regvalue); + user_reg, user_value, regvalue); } return buf_size; } diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index 37b7ce4c7c3b..11656c2c63cb 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c @@ -2757,7 +2757,7 @@ static ssize_t show_irq(struct device *dev, unsigned int irq_index; int err; - err = strict_strtoul(attr->attr.name, 0, &name); + err = kstrtoul(attr->attr.name, 0, &name); if (err) return err; From 7f8c5e1494544ce86d358fa9dc553db3e20cb4d0 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Thu, 6 Jun 2013 12:21:13 +0100 Subject: [PATCH 5/7] mfd: dbx500-prcmu: Use correct names for clock management registers ... as stipulated by the Hardware Specification document. Acked-by: Linus Walleij Signed-off-by: Lee Jones --- drivers/mfd/dbx500-prcmu-regs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/dbx500-prcmu-regs.h b/drivers/mfd/dbx500-prcmu-regs.h index d14836ed2114..7cc32a8ff01c 100644 --- a/drivers/mfd/dbx500-prcmu-regs.h +++ b/drivers/mfd/dbx500-prcmu-regs.h @@ -16,8 +16,8 @@ #define BITS(_start, _end) ((BIT(_end) - BIT(_start)) + BIT(_end)) #define PRCM_ACLK_MGT (0x004) -#define PRCM_SVACLK_MGT (0x008) -#define PRCM_SIACLK_MGT (0x00C) +#define PRCM_SVAMMCSPCLK_MGT (0x008) +#define PRCM_SIAMMDSPCLK_MGT (0x00C) #define PRCM_SGACLK_MGT (0x014) #define PRCM_UARTCLK_MGT (0x018) #define PRCM_MSP02CLK_MGT (0x01C) From 53f325be2f99fb1e5dbbfc1f7707a9a6c97c83c2 Mon Sep 17 00:00:00 2001 From: Lee Jones Date: Fri, 7 Jun 2013 16:07:47 +0100 Subject: [PATCH 6/7] mfd: ab8500-core: Add AB8500 external regulators as MFD devices The AB8500 external regulator driver is now a device in its own right, so it requires registering and probing in the normal way. This patch will ensure the driver is probed once registered for all devices which support them. Acked-by: Linus Walleij Signed-off-by: Lee Jones --- drivers/mfd/ab8500-core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index ca6bd1c8bd3f..b6c2cdc76091 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -1065,6 +1065,10 @@ static struct mfd_cell ab8500_devs[] = { .name = "ab8500-sysctrl", .of_compatible = "stericsson,ab8500-sysctrl", }, + { + .name = "ab8500-ext-regulator", + .of_compatible = "stericsson,ab8500-ext-regulator", + }, { .name = "ab8500-regulator", .of_compatible = "stericsson,ab8500-regulator", @@ -1150,6 +1154,9 @@ static struct mfd_cell ab9540_devs[] = { { .name = "ab8500-sysctrl", }, + { + .name = "ab8500-ext-regulator", + }, { .name = "ab8500-regulator", }, @@ -1279,6 +1286,9 @@ static struct mfd_cell ab8540_devs[] = { { .name = "ab8500-sysctrl", }, + { + .name = "ab8500-ext-regulator", + }, { .name = "ab8500-regulator", }, From aaaab4223ebad2470d56d5db2e71c5395d9609b3 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Wed, 12 Jun 2013 13:55:43 +0530 Subject: [PATCH 7/7] mfd: 88pm860x: Use devm_regmap_init_i2c() devm_regmap_init_i2c() is device managed and makes cleanup simpler. Signed-off-by: Sachin Kamat Signed-off-by: Lee Jones --- drivers/mfd/88pm860x-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c index 31ca55548ef9..629d6404cab4 100644 --- a/drivers/mfd/88pm860x-core.c +++ b/drivers/mfd/88pm860x-core.c @@ -1155,7 +1155,7 @@ static int pm860x_probe(struct i2c_client *client, return -ENOMEM; chip->id = verify_addr(client); - chip->regmap = regmap_init_i2c(client, &pm860x_regmap_config); + chip->regmap = devm_regmap_init_i2c(client, &pm860x_regmap_config); if (IS_ERR(chip->regmap)) { ret = PTR_ERR(chip->regmap); dev_err(&client->dev, "Failed to allocate register map: %d\n", @@ -1203,7 +1203,6 @@ static int pm860x_remove(struct i2c_client *client) regmap_exit(chip->regmap_companion); i2c_unregister_device(chip->companion); } - regmap_exit(chip->regmap); kfree(chip); return 0; }