lkml.org 
[lkml]   [2012]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 1/6] regmap: add support for 7_25 format
Date
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@cpdesign.com.au>
---
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


\
 
 \ /
  Last update: 2012-03-14 22:43    [W:0.053 / U:0.836 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site