Skip to contentSkip to conversation

regmap: add support for 7/17 register formating

PATCH Applied Antoniu Miclaus 2 participants 2 messages May 26, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/base/regmap/regmap.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/base/regmap/regmap.c +13 -0
index 19f57ccfbe1d..bc1c36b93c15 100644
@@ -230,6 +230,16 @@ static void regmap_format_7_9_write(struct regmap *map,
 	*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,
 				    unsigned int reg, unsigned int val)
 {
@@ -864,6 +874,9 @@ struct regmap *__regmap_init(struct device *dev,
 		case 9:
 			map->format.format_write = regmap_format_7_9_write;
 			break;
+		case 17:
+			map->format.format_write = regmap_format_7_17_write;
+			break;
 		default:
 			goto err_hwlock;
 		}
Signature · 1 line
2.25.1
maintainer Applied
#1 lore raw

From: Mark Brown,,, <[email protected]>

Quoted 3 lines · Antoniu Miclaus

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.

Applied, thanks!

[1/1] regmap: add support for 7/17 register formating

      commit: b24412aff37c58286a0aeafc5678fbdc6a527d54

Best regards,

Signature · 1 line
Mark Brown,,, <[email protected]>