Commit b24412af authored by Antoniu Miclaus's avatar Antoniu Miclaus Committed by Mark Brown

regmap: add support for 7/17 register formating

This patch adds support for 7 bits register, 17 bits value type register
formating. This is used, for example, by the Analog Devices
ADMV1013/ADMV1014.
Signed-off-by: default avatarAntoniu Miclaus <antoniu.miclaus@analog.com>
Signed-off-by: default avatarAndrei Drimbarean <andrei.drimbarean@analog.com>
Message-Id: <20210526085223.14896-1-antoniu.miclaus@analog.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent e56360d6
...@@ -243,6 +243,16 @@ static void regmap_format_7_9_write(struct regmap *map, ...@@ -243,6 +243,16 @@ static void regmap_format_7_9_write(struct regmap *map,
*out = cpu_to_be16((reg << 9) | val); *out = cpu_to_be16((reg << 9) | val);
} }
static void regmap_format_7_17_write(struct regmap *map,
unsigned int reg, unsigned int val)
{
u8 *out = map->work_buf;
out[2] = val;
out[1] = val >> 8;
out[0] = (val >> 16) | (reg << 1);
}
static void regmap_format_10_14_write(struct regmap *map, static void regmap_format_10_14_write(struct regmap *map,
unsigned int reg, unsigned int val) unsigned int reg, unsigned int val)
{ {
...@@ -885,6 +895,9 @@ struct regmap *__regmap_init(struct device *dev, ...@@ -885,6 +895,9 @@ struct regmap *__regmap_init(struct device *dev,
case 9: case 9:
map->format.format_write = regmap_format_7_9_write; map->format.format_write = regmap_format_7_9_write;
break; break;
case 17:
map->format.format_write = regmap_format_7_17_write;
break;
default: default:
goto err_hwlock; goto err_hwlock;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment