[PATCH v3 1/6] regmap: add support for 7_25 format

From: Marc Reilly
Date: Wed Mar 14 2012 - 17:40:07 EST


This adds support for devices with 7 address bits and 25 data bits.
The initial intended user for this are the mc13xxx mfds in spi mode.
(The 25th data bit is actually a dummy bit)

Signed-off-by: Marc Reilly <marc@xxxxxxxxxxxxxxx>
---
drivers/base/regmap/regmap.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index be10a4f..62ef0df 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -100,6 +100,14 @@ static void regmap_format_10_14_write(struct regmap *map,
out[0] = reg >> 2;
}

+static void regmap_format_7_25_write(struct regmap *map,
+ unsigned int reg, unsigned int val)
+{
+ __be32 *out = map->work_buf;
+
+ *out = (reg << 25) | val;
+}
+
static void regmap_format_8(void *buf, unsigned int val)
{
u8 *b = buf;
@@ -193,6 +201,9 @@ struct regmap *regmap_init(struct device *dev,
case 9:
map->format.format_write = regmap_format_7_9_write;
break;
+ case 25:
+ map->format.format_write = regmap_format_7_25_write;
+ break;
default:
goto err_map;
}
--
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/