diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2012-01-27 16:10:22 +0100 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-01-27 16:26:03 +0000 |
commit | 9aa507505cdcd10b7390398790f013374ee74a26 (patch) | |
tree | 1ed486dd7d9f1a0c54cdc082992150fed1fb635d /drivers/base/regmap/regmap.c | |
parent | a24f64a648376766497fddd8bc24b1ca5b906431 (diff) | |
download | lwn-9aa507505cdcd10b7390398790f013374ee74a26.tar.gz lwn-9aa507505cdcd10b7390398790f013374ee74a26.zip |
regmap: Add support for 2/6 register formating
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base/regmap/regmap.c')
-rw-r--r-- | drivers/base/regmap/regmap.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 2d71aeae3109..b4475d87f4a0 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -76,6 +76,14 @@ static bool regmap_volatile_range(struct regmap *map, unsigned int reg, return true; } +static void regmap_format_2_6_write(struct regmap *map, + unsigned int reg, unsigned int val) +{ + u8 *out = map->work_buf; + + *out = (reg << 6) | val; +} + static void regmap_format_4_12_write(struct regmap *map, unsigned int reg, unsigned int val) { @@ -180,6 +188,16 @@ struct regmap *regmap_init(struct device *dev, } switch (config->reg_bits) { + case 2: + switch (config->val_bits) { + case 6: + map->format.format_write = regmap_format_2_6_write; + break; + default: + goto err_map; + } + break; + case 4: switch (config->val_bits) { case 12: |