summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>2016-09-15 10:37:10 +0200
committerKlaus Goger <klaus.goger@theobroma-systems.com>2016-09-18 15:53:10 +0200
commit9ef7c38d84fe452ab6806cc326083c03f1bdfe22 (patch)
treedc4632cc41d0f693edf43af6e4d2e8789760fe32
parent345b19bca4b1c336f61f17b9aa6a180d934b299f (diff)
mfd: axp20x: Mark the AXP809's die-temperature ADC reading 'volatile'
The AXP809 provides an internal temperature sensor, measuring the PMIC's die temperature and exporting this reading in an ADC register. This change splits the AXP809 register definition from the AXP22x to allow higher-layer (e.g. hwmon) drivers to read the current temperature of the chip. Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
-rw-r--r--drivers/mfd/axp20x.c24
-rw-r--r--include/linux/mfd/axp20x.h3
2 files changed, 26 insertions, 1 deletions
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index b8324f5dc078..9e2431a86d9b 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -153,6 +153,19 @@ static const struct regmap_access_table axp806_volatile_table = {
.n_yes_ranges = ARRAY_SIZE(axp806_volatile_ranges),
};
+static const struct regmap_range axp809_volatile_ranges[] = {
+ regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP20X_PWR_OP_MODE),
+ regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ5_STATE),
+ regmap_reg_range(AXP809_TEMP_ADC_H, AXP809_TEMP_ADC_L),
+ regmap_reg_range(AXP22X_GPIO_STATE, AXP22X_GPIO_STATE),
+ regmap_reg_range(AXP20X_FG_RES, AXP20X_FG_RES),
+};
+
+static const struct regmap_access_table axp809_volatile_table = {
+ .yes_ranges = axp809_volatile_ranges,
+ .n_yes_ranges = ARRAY_SIZE(axp809_volatile_ranges),
+};
+
static 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"),
@@ -311,6 +324,15 @@ static const struct regmap_config axp806_regmap_config = {
.cache_type = REGCACHE_RBTREE,
};
+static const struct regmap_config axp809_regmap_config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+ .wr_table = &axp22x_writeable_table,
+ .volatile_table = &axp809_volatile_table,
+ .max_register = AXP22X_BATLOW_THRES1,
+ .cache_type = REGCACHE_RBTREE,
+};
+
#define INIT_REGMAP_IRQ(_variant, _irq, _off, _mask) \
[_variant##_IRQ_##_irq] = { .reg_offset = (_off), .mask = BIT(_mask) }
@@ -809,7 +831,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
case AXP809_ID:
axp20x->nr_cells = ARRAY_SIZE(axp809_cells);
axp20x->cells = axp809_cells;
- axp20x->regmap_cfg = &axp22x_regmap_config;
+ axp20x->regmap_cfg = &axp809_regmap_config;
axp20x->regmap_irq_chip = &axp809_regmap_irq_chip;
break;
default:
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index 2ecf8c0b13d1..635fdc79d635 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -167,6 +167,9 @@ enum {
#define AXP20X_IPSOUT_V_HIGH_H 0x7e
#define AXP20X_IPSOUT_V_HIGH_L 0x7f
+#define AXP809_TEMP_ADC_H 0x56
+#define AXP809_TEMP_ADC_L 0x57
+
/* Power supply */
#define AXP20X_DCDC_MODE 0x80
#define AXP20X_ADC_EN1 0x82