summaryrefslogtreecommitdiff
path: root/drivers/mfd/da9063-i2c.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-08-21 01:38:44 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-21 01:38:44 +0300
commit532c2b926dda11174700333a5dda5e3c0ee383f2 (patch)
tree518e583bd74e90c18f7dfd014e82ce011d0c732e /drivers/mfd/da9063-i2c.c
parent8786583db54197b3859311870912f51cb3fca434 (diff)
parentd2c9281c184bf2b768ac141a7a10586e0643695d (diff)
downloadlinux-532c2b926dda11174700333a5dda5e3c0ee383f2.tar.xz
Merge tag 'mfd-next-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD updates from Lee Jones: "New Drivers: - Add Cirrus Logic Madera Codec (CS47L35, CS47L85 and CS47L90/91) driver - Add ChromeOS EC CEC driver - Add ROHM BD71837 PMIC driver New Device Support: - Add support for Dialog Semi DA9063L PMIC variant to DA9063 - Add support for Intel Ice Lake to Intel-PLSS-PCI - Add support for X-Powers AXP806 to AXP20x New Functionality: - Add support for USB Charging to the ChromeOS Embedded Controller - Add support for HDMI CEC to the ChromeOS Embedded Controller - Add support for HDMI CEC to Intel HDMI - Add support for accessory detection to Madera devices - Allow individual pins to be configured via DT' wlf,csnaddr-pd - Provide legacy platform specific EEPROM/Watchdog commands; rave-sp Fix-upsL - Trivial renaming/spelling fixes; cros_ec, da9063-* - Convert to Managed Resources (devm_*); da9063-*, ti_am335x_tscadc - Transition to helper macros/functions; da9063-* - Constify; kempld-core - Improve error path/messages; wm8994-core - Disable IRQs locally instead of relying on USB subsystem; dln2 - Remove unused code; rave-sp - New exports; sec-core Bug Fixes: - Fix possible false I2C transaction error; arizona-core - Fix declared memory area size; hi655x-pmic - Fix checksum type; rave-sp - Fix incorrect default serial port configuration: rave-sp - Fix incorrect coherent DMA mask for sub-devices; sm501" * tag 'mfd-next-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (60 commits) mfd: madera: Add register definitions for accessory detect mfd: sm501: Set coherent_dma_mask when creating subdevices mfd: bd71837: Devicetree bindings for ROHM BD71837 PMIC mfd: bd71837: Core driver for ROHM BD71837 PMIC media: platform: cros-ec-cec: Fix dependency on MFD_CROS_EC mfd: sec-core: Export OF module alias table mfd: as3722: Disable auto-power-on when AC OK mfd: axp20x: Support AXP806 in I2C mode mfd: axp20x: Add self-working mode support for AXP806 dt-bindings: mfd: axp20x: Add "self-working" mode for AXP806 mfd: wm8994: Allow to configure CS/ADDR Pulldown from dts mfd: wm8994: Allow to configure Speaker Mode Pullup from dts mfd: rave-sp: Emulate CMD_GET_STATUS on device that don't support it mfd: rave-sp: Add legacy watchdog ping command translation mfd: rave-sp: Add legacy EEPROM access command translation mfd: rave-sp: Initialize flow control and parity of the port mfd: rave-sp: Fix incorrectly specified checksum type mfd: rave-sp: Remove unused defines mfd: hi655x: Fix regmap area declared size for hi655x mfd: ti_am335x_tscadc: Fix struct clk memory leak ...
Diffstat (limited to 'drivers/mfd/da9063-i2c.c')
-rw-r--r--drivers/mfd/da9063-i2c.c239
1 files changed, 95 insertions, 144 deletions
diff --git a/drivers/mfd/da9063-i2c.c b/drivers/mfd/da9063-i2c.c
index 981805a2c521..50a24b1921d0 100644
--- a/drivers/mfd/da9063-i2c.c
+++ b/drivers/mfd/da9063-i2c.c
@@ -29,78 +29,33 @@
#include <linux/regulator/of_regulator.h>
static const struct regmap_range da9063_ad_readable_ranges[] = {
- {
- .range_min = DA9063_REG_PAGE_CON,
- .range_max = DA9063_AD_REG_SECOND_D,
- }, {
- .range_min = DA9063_REG_SEQ,
- .range_max = DA9063_REG_ID_32_31,
- }, {
- .range_min = DA9063_REG_SEQ_A,
- .range_max = DA9063_REG_AUTO3_LOW,
- }, {
- .range_min = DA9063_REG_T_OFFSET,
- .range_max = DA9063_AD_REG_GP_ID_19,
- }, {
- .range_min = DA9063_REG_CHIP_ID,
- .range_max = DA9063_REG_CHIP_VARIANT,
- },
+ regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_AD_REG_SECOND_D),
+ regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_ID_32_31),
+ regmap_reg_range(DA9063_REG_SEQ_A, DA9063_REG_AUTO3_LOW),
+ regmap_reg_range(DA9063_REG_T_OFFSET, DA9063_AD_REG_GP_ID_19),
+ regmap_reg_range(DA9063_REG_CHIP_ID, DA9063_REG_CHIP_VARIANT),
};
static const struct regmap_range da9063_ad_writeable_ranges[] = {
- {
- .range_min = DA9063_REG_PAGE_CON,
- .range_max = DA9063_REG_PAGE_CON,
- }, {
- .range_min = DA9063_REG_FAULT_LOG,
- .range_max = DA9063_REG_VSYS_MON,
- }, {
- .range_min = DA9063_REG_COUNT_S,
- .range_max = DA9063_AD_REG_ALARM_Y,
- }, {
- .range_min = DA9063_REG_SEQ,
- .range_max = DA9063_REG_ID_32_31,
- }, {
- .range_min = DA9063_REG_SEQ_A,
- .range_max = DA9063_REG_AUTO3_LOW,
- }, {
- .range_min = DA9063_REG_CONFIG_I,
- .range_max = DA9063_AD_REG_MON_REG_4,
- }, {
- .range_min = DA9063_AD_REG_GP_ID_0,
- .range_max = DA9063_AD_REG_GP_ID_19,
- },
+ regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_REG_PAGE_CON),
+ regmap_reg_range(DA9063_REG_FAULT_LOG, DA9063_REG_VSYS_MON),
+ regmap_reg_range(DA9063_REG_COUNT_S, DA9063_AD_REG_ALARM_Y),
+ regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_ID_32_31),
+ regmap_reg_range(DA9063_REG_SEQ_A, DA9063_REG_AUTO3_LOW),
+ regmap_reg_range(DA9063_REG_CONFIG_I, DA9063_AD_REG_MON_REG_4),
+ regmap_reg_range(DA9063_AD_REG_GP_ID_0, DA9063_AD_REG_GP_ID_19),
};
static const struct regmap_range da9063_ad_volatile_ranges[] = {
- {
- .range_min = DA9063_REG_PAGE_CON,
- .range_max = DA9063_REG_EVENT_D,
- }, {
- .range_min = DA9063_REG_CONTROL_A,
- .range_max = DA9063_REG_CONTROL_B,
- }, {
- .range_min = DA9063_REG_CONTROL_E,
- .range_max = DA9063_REG_CONTROL_F,
- }, {
- .range_min = DA9063_REG_BCORE2_CONT,
- .range_max = DA9063_REG_LDO11_CONT,
- }, {
- .range_min = DA9063_REG_DVC_1,
- .range_max = DA9063_REG_ADC_MAN,
- }, {
- .range_min = DA9063_REG_ADC_RES_L,
- .range_max = DA9063_AD_REG_SECOND_D,
- }, {
- .range_min = DA9063_REG_SEQ,
- .range_max = DA9063_REG_SEQ,
- }, {
- .range_min = DA9063_REG_EN_32K,
- .range_max = DA9063_REG_EN_32K,
- }, {
- .range_min = DA9063_AD_REG_MON_REG_5,
- .range_max = DA9063_AD_REG_MON_REG_6,
- },
+ regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_REG_EVENT_D),
+ regmap_reg_range(DA9063_REG_CONTROL_A, DA9063_REG_CONTROL_B),
+ regmap_reg_range(DA9063_REG_CONTROL_E, DA9063_REG_CONTROL_F),
+ regmap_reg_range(DA9063_REG_BCORE2_CONT, DA9063_REG_LDO11_CONT),
+ regmap_reg_range(DA9063_REG_DVC_1, DA9063_REG_ADC_MAN),
+ regmap_reg_range(DA9063_REG_ADC_RES_L, DA9063_AD_REG_SECOND_D),
+ regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_SEQ),
+ regmap_reg_range(DA9063_REG_EN_32K, DA9063_REG_EN_32K),
+ regmap_reg_range(DA9063_AD_REG_MON_REG_5, DA9063_AD_REG_MON_REG_6),
};
static const struct regmap_access_table da9063_ad_readable_table = {
@@ -119,78 +74,33 @@ static const struct regmap_access_table da9063_ad_volatile_table = {
};
static const struct regmap_range da9063_bb_readable_ranges[] = {
- {
- .range_min = DA9063_REG_PAGE_CON,
- .range_max = DA9063_BB_REG_SECOND_D,
- }, {
- .range_min = DA9063_REG_SEQ,
- .range_max = DA9063_REG_ID_32_31,
- }, {
- .range_min = DA9063_REG_SEQ_A,
- .range_max = DA9063_REG_AUTO3_LOW,
- }, {
- .range_min = DA9063_REG_T_OFFSET,
- .range_max = DA9063_BB_REG_GP_ID_19,
- }, {
- .range_min = DA9063_REG_CHIP_ID,
- .range_max = DA9063_REG_CHIP_VARIANT,
- },
+ regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_BB_REG_SECOND_D),
+ regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_ID_32_31),
+ regmap_reg_range(DA9063_REG_SEQ_A, DA9063_REG_AUTO3_LOW),
+ regmap_reg_range(DA9063_REG_T_OFFSET, DA9063_BB_REG_GP_ID_19),
+ regmap_reg_range(DA9063_REG_CHIP_ID, DA9063_REG_CHIP_VARIANT),
};
static const struct regmap_range da9063_bb_writeable_ranges[] = {
- {
- .range_min = DA9063_REG_PAGE_CON,
- .range_max = DA9063_REG_PAGE_CON,
- }, {
- .range_min = DA9063_REG_FAULT_LOG,
- .range_max = DA9063_REG_VSYS_MON,
- }, {
- .range_min = DA9063_REG_COUNT_S,
- .range_max = DA9063_BB_REG_ALARM_Y,
- }, {
- .range_min = DA9063_REG_SEQ,
- .range_max = DA9063_REG_ID_32_31,
- }, {
- .range_min = DA9063_REG_SEQ_A,
- .range_max = DA9063_REG_AUTO3_LOW,
- }, {
- .range_min = DA9063_REG_CONFIG_I,
- .range_max = DA9063_BB_REG_MON_REG_4,
- }, {
- .range_min = DA9063_BB_REG_GP_ID_0,
- .range_max = DA9063_BB_REG_GP_ID_19,
- },
+ regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_REG_PAGE_CON),
+ regmap_reg_range(DA9063_REG_FAULT_LOG, DA9063_REG_VSYS_MON),
+ regmap_reg_range(DA9063_REG_COUNT_S, DA9063_BB_REG_ALARM_Y),
+ regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_ID_32_31),
+ regmap_reg_range(DA9063_REG_SEQ_A, DA9063_REG_AUTO3_LOW),
+ regmap_reg_range(DA9063_REG_CONFIG_I, DA9063_BB_REG_MON_REG_4),
+ regmap_reg_range(DA9063_BB_REG_GP_ID_0, DA9063_BB_REG_GP_ID_19),
};
static const struct regmap_range da9063_bb_volatile_ranges[] = {
- {
- .range_min = DA9063_REG_PAGE_CON,
- .range_max = DA9063_REG_EVENT_D,
- }, {
- .range_min = DA9063_REG_CONTROL_A,
- .range_max = DA9063_REG_CONTROL_B,
- }, {
- .range_min = DA9063_REG_CONTROL_E,
- .range_max = DA9063_REG_CONTROL_F,
- }, {
- .range_min = DA9063_REG_BCORE2_CONT,
- .range_max = DA9063_REG_LDO11_CONT,
- }, {
- .range_min = DA9063_REG_DVC_1,
- .range_max = DA9063_REG_ADC_MAN,
- }, {
- .range_min = DA9063_REG_ADC_RES_L,
- .range_max = DA9063_BB_REG_SECOND_D,
- }, {
- .range_min = DA9063_REG_SEQ,
- .range_max = DA9063_REG_SEQ,
- }, {
- .range_min = DA9063_REG_EN_32K,
- .range_max = DA9063_REG_EN_32K,
- }, {
- .range_min = DA9063_BB_REG_MON_REG_5,
- .range_max = DA9063_BB_REG_MON_REG_6,
- },
+ regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_REG_EVENT_D),
+ regmap_reg_range(DA9063_REG_CONTROL_A, DA9063_REG_CONTROL_B),
+ regmap_reg_range(DA9063_REG_CONTROL_E, DA9063_REG_CONTROL_F),
+ regmap_reg_range(DA9063_REG_BCORE2_CONT, DA9063_REG_LDO11_CONT),
+ regmap_reg_range(DA9063_REG_DVC_1, DA9063_REG_ADC_MAN),
+ regmap_reg_range(DA9063_REG_ADC_RES_L, DA9063_BB_REG_SECOND_D),
+ regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_SEQ),
+ regmap_reg_range(DA9063_REG_EN_32K, DA9063_REG_EN_32K),
+ regmap_reg_range(DA9063_BB_REG_MON_REG_5, DA9063_BB_REG_MON_REG_6),
};
static const struct regmap_access_table da9063_bb_readable_table = {
@@ -208,6 +118,50 @@ static const struct regmap_access_table da9063_bb_volatile_table = {
.n_yes_ranges = ARRAY_SIZE(da9063_bb_volatile_ranges),
};
+static const struct regmap_range da9063l_bb_readable_ranges[] = {
+ regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_REG_MON_A10_RES),
+ regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_ID_32_31),
+ regmap_reg_range(DA9063_REG_SEQ_A, DA9063_REG_AUTO3_LOW),
+ regmap_reg_range(DA9063_REG_T_OFFSET, DA9063_BB_REG_GP_ID_19),
+ regmap_reg_range(DA9063_REG_CHIP_ID, DA9063_REG_CHIP_VARIANT),
+};
+
+static const struct regmap_range da9063l_bb_writeable_ranges[] = {
+ regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_REG_PAGE_CON),
+ regmap_reg_range(DA9063_REG_FAULT_LOG, DA9063_REG_VSYS_MON),
+ regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_ID_32_31),
+ regmap_reg_range(DA9063_REG_SEQ_A, DA9063_REG_AUTO3_LOW),
+ regmap_reg_range(DA9063_REG_CONFIG_I, DA9063_BB_REG_MON_REG_4),
+ regmap_reg_range(DA9063_BB_REG_GP_ID_0, DA9063_BB_REG_GP_ID_19),
+};
+
+static const struct regmap_range da9063l_bb_volatile_ranges[] = {
+ regmap_reg_range(DA9063_REG_PAGE_CON, DA9063_REG_EVENT_D),
+ regmap_reg_range(DA9063_REG_CONTROL_A, DA9063_REG_CONTROL_B),
+ regmap_reg_range(DA9063_REG_CONTROL_E, DA9063_REG_CONTROL_F),
+ regmap_reg_range(DA9063_REG_BCORE2_CONT, DA9063_REG_LDO11_CONT),
+ regmap_reg_range(DA9063_REG_DVC_1, DA9063_REG_ADC_MAN),
+ regmap_reg_range(DA9063_REG_ADC_RES_L, DA9063_REG_MON_A10_RES),
+ regmap_reg_range(DA9063_REG_SEQ, DA9063_REG_SEQ),
+ regmap_reg_range(DA9063_REG_EN_32K, DA9063_REG_EN_32K),
+ regmap_reg_range(DA9063_BB_REG_MON_REG_5, DA9063_BB_REG_MON_REG_6),
+};
+
+static const struct regmap_access_table da9063l_bb_readable_table = {
+ .yes_ranges = da9063l_bb_readable_ranges,
+ .n_yes_ranges = ARRAY_SIZE(da9063l_bb_readable_ranges),
+};
+
+static const struct regmap_access_table da9063l_bb_writeable_table = {
+ .yes_ranges = da9063l_bb_writeable_ranges,
+ .n_yes_ranges = ARRAY_SIZE(da9063l_bb_writeable_ranges),
+};
+
+static const struct regmap_access_table da9063l_bb_volatile_table = {
+ .yes_ranges = da9063l_bb_volatile_ranges,
+ .n_yes_ranges = ARRAY_SIZE(da9063l_bb_volatile_ranges),
+};
+
static const struct regmap_range_cfg da9063_range_cfg[] = {
{
.range_min = DA9063_REG_PAGE_CON,
@@ -232,11 +186,12 @@ static struct regmap_config da9063_regmap_config = {
static const struct of_device_id da9063_dt_ids[] = {
{ .compatible = "dlg,da9063", },
+ { .compatible = "dlg,da9063l", },
{ }
};
MODULE_DEVICE_TABLE(of, da9063_dt_ids);
static int da9063_i2c_probe(struct i2c_client *i2c,
- const struct i2c_device_id *id)
+ const struct i2c_device_id *id)
{
struct da9063 *da9063;
int ret;
@@ -248,11 +203,16 @@ static int da9063_i2c_probe(struct i2c_client *i2c,
i2c_set_clientdata(i2c, da9063);
da9063->dev = &i2c->dev;
da9063->chip_irq = i2c->irq;
+ da9063->type = id->driver_data;
if (da9063->variant_code == PMIC_DA9063_AD) {
da9063_regmap_config.rd_table = &da9063_ad_readable_table;
da9063_regmap_config.wr_table = &da9063_ad_writeable_table;
da9063_regmap_config.volatile_table = &da9063_ad_volatile_table;
+ } else if (da9063->type == PMIC_TYPE_DA9063L) {
+ da9063_regmap_config.rd_table = &da9063l_bb_readable_table;
+ da9063_regmap_config.wr_table = &da9063l_bb_writeable_table;
+ da9063_regmap_config.volatile_table = &da9063l_bb_volatile_table;
} else {
da9063_regmap_config.rd_table = &da9063_bb_readable_table;
da9063_regmap_config.wr_table = &da9063_bb_writeable_table;
@@ -270,17 +230,9 @@ static int da9063_i2c_probe(struct i2c_client *i2c,
return da9063_device_init(da9063, i2c->irq);
}
-static int da9063_i2c_remove(struct i2c_client *i2c)
-{
- struct da9063 *da9063 = i2c_get_clientdata(i2c);
-
- da9063_device_exit(da9063);
-
- return 0;
-}
-
static const struct i2c_device_id da9063_i2c_id[] = {
- {"da9063", PMIC_DA9063},
+ { "da9063", PMIC_TYPE_DA9063 },
+ { "da9063l", PMIC_TYPE_DA9063L },
{},
};
MODULE_DEVICE_TABLE(i2c, da9063_i2c_id);
@@ -291,7 +243,6 @@ static struct i2c_driver da9063_i2c_driver = {
.of_match_table = of_match_ptr(da9063_dt_ids),
},
.probe = da9063_i2c_probe,
- .remove = da9063_i2c_remove,
.id_table = da9063_i2c_id,
};