]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
mfd: axp20x: Add address extension registers for AXP806 regmap
authorChen-Yu Tsai <wens@csie.org>
Fri, 11 Nov 2016 03:29:52 +0000 (11:29 +0800)
committerLee Jones <lee.jones@linaro.org>
Tue, 29 Nov 2016 08:21:35 +0000 (08:21 +0000)
The AXP806 supports either master/standalone or slave mode.
Slave mode allows sharing the serial bus, even with multiple
AXP806 which all have the same hardware address.

This is done with extra "serial interface address extension",
or AXP806_BUS_ADDR_EXT, and "register address extension", or
AXP806_REG_ADDR_EXT, registers. The former is read-only, with
1 bit customizable at the factory, and 1 bit depending on the
state of an external pin. The latter is writable. Only when
the these device addressing bits (in the upper 4 bits of the
registers) match, will the device respond to operations on
its other registers.

Add these 2 registers to the regmap so we can access them.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/axp20x.c
include/linux/mfd/axp20x.h

index 98377d29b783b84c2fd655c0685cf849876980ca..ed918de84238c33d83c9f60f26db069bec14a82d 100644 (file)
@@ -136,6 +136,7 @@ static const struct regmap_range axp806_writeable_ranges[] = {
        regmap_reg_range(AXP806_PWR_OUT_CTRL1, AXP806_CLDO3_V_CTRL),
        regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IRQ2_EN),
        regmap_reg_range(AXP20X_IRQ1_STATE, AXP20X_IRQ2_STATE),
+       regmap_reg_range(AXP806_REG_ADDR_EXT, AXP806_REG_ADDR_EXT),
 };
 
 static const struct regmap_range axp806_volatile_ranges[] = {
@@ -306,7 +307,7 @@ static const struct regmap_config axp806_regmap_config = {
        .val_bits       = 8,
        .wr_table       = &axp806_writeable_table,
        .volatile_table = &axp806_volatile_table,
-       .max_register   = AXP806_VREF_TEMP_WARN_L,
+       .max_register   = AXP806_REG_ADDR_EXT,
        .cache_type     = REGCACHE_RBTREE,
 };
 
index 6349496f09fc2b3d680ba3e1479dc2b5635572b7..a4860bc9b73d4ffe927d087c24b70970084ff330 100644 (file)
@@ -115,6 +115,8 @@ enum {
 #define AXP806_CLDO2_V_CTRL            0x25
 #define AXP806_CLDO3_V_CTRL            0x26
 #define AXP806_VREF_TEMP_WARN_L                0xf3
+#define AXP806_BUS_ADDR_EXT            0xfe
+#define AXP806_REG_ADDR_EXT            0xff
 
 /* Interrupt */
 #define AXP152_IRQ1_EN                 0x40