Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

regmap: Add support for device with 24 data bits.

Add support for devices with 24 data bits.

Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

authored by

Marc Reilly and committed by
Mark Brown
ea279fc5 dd775ae2

+23
+23
drivers/base/regmap/regmap.c
··· 126 126 b[0] = cpu_to_be16(val); 127 127 } 128 128 129 + static void regmap_format_24(void *buf, unsigned int val) 130 + { 131 + u8 *b = buf; 132 + 133 + b[0] = val >> 16; 134 + b[1] = val >> 8; 135 + b[2] = val; 136 + } 137 + 129 138 static void regmap_format_32(void *buf, unsigned int val) 130 139 { 131 140 __be32 *b = buf; ··· 156 147 b[0] = be16_to_cpu(b[0]); 157 148 158 149 return b[0]; 150 + } 151 + 152 + static unsigned int regmap_parse_24(void *buf) 153 + { 154 + u8 *b = buf; 155 + unsigned int ret = b[2]; 156 + ret |= ((unsigned int)b[1]) << 8; 157 + ret |= ((unsigned int)b[0]) << 16; 158 + 159 + return ret; 159 160 } 160 161 161 162 static unsigned int regmap_parse_32(void *buf) ··· 291 272 case 16: 292 273 map->format.format_val = regmap_format_16; 293 274 map->format.parse_val = regmap_parse_16; 275 + break; 276 + case 24: 277 + map->format.format_val = regmap_format_24; 278 + map->format.parse_val = regmap_parse_24; 294 279 break; 295 280 case 32: 296 281 map->format.format_val = regmap_format_32;