Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 305610
b: refs/heads/master
c: 89a89b5
h: refs/heads/master
v: v3
  • Loading branch information
Marc Reilly authored and Mark Brown committed Apr 13, 2012
1 parent e14bda3 commit d55b0f0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 019ec5059b771cc36fb302a61f0eb08a88beb88b
refs/heads/master: 89a89b5e4fb23aa133e4aa9e0be97b43996d4ad2
23 changes: 23 additions & 0 deletions trunk/drivers/base/regmap/regmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ static void regmap_format_16(void *buf, unsigned int val)
b[0] = cpu_to_be16(val);
}

static void regmap_format_24(void *buf, unsigned int val)
{
u8 *b = buf;

b[0] = val >> 16;
b[1] = val >> 8;
b[2] = val;
}

static void regmap_format_32(void *buf, unsigned int val)
{
__be32 *b = buf;
Expand All @@ -149,6 +158,16 @@ static unsigned int regmap_parse_16(void *buf)
return b[0];
}

static unsigned int regmap_parse_24(void *buf)
{
u8 *b = buf;
unsigned int ret = b[2];
ret |= ((unsigned int)b[1]) << 8;
ret |= ((unsigned int)b[0]) << 16;

return ret;
}

static unsigned int regmap_parse_32(void *buf)
{
__be32 *b = buf;
Expand Down Expand Up @@ -273,6 +292,10 @@ struct regmap *regmap_init(struct device *dev,
map->format.format_val = regmap_format_16;
map->format.parse_val = regmap_parse_16;
break;
case 24:
map->format.format_val = regmap_format_24;
map->format.parse_val = regmap_parse_24;
break;
case 32:
map->format.format_val = regmap_format_32;
map->format.parse_val = regmap_parse_32;
Expand Down

0 comments on commit d55b0f0

Please sign in to comment.