aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-07-20 17:35:37 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-08-08 02:56:50 -0400
commit93de91245b66f20dd387c2745744950a11a5c436 (patch)
tree82601d13bfc2b4c678618bf55be0e05671299338 /drivers
parent73304781274200c341996f65220d36b3cda8e217 (diff)
regmap: Use a local header for API internals
Allowing the implementation to be multi-file. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/regmap/internal.h45
-rw-r--r--drivers/base/regmap/regmap.c29
2 files changed, 46 insertions, 28 deletions
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h
new file mode 100644
index 000000000000..7e61504a7ac3
--- /dev/null
+++ b/drivers/base/regmap/internal.h
@@ -0,0 +1,45 @@
1/*
2 * Register map access API internal header
3 *
4 * Copyright 2011 Wolfson Microelectronics plc
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef _REGMAP_INTERNAL_H
14#define _REGMAP_INTERNAL_H
15
16#include <linux/regmap.h>
17
18struct regmap;
19
20struct regmap_format {
21 size_t buf_size;
22 size_t reg_bytes;
23 size_t val_bytes;
24 void (*format_write)(struct regmap *map,
25 unsigned int reg, unsigned int val);
26 void (*format_reg)(void *buf, unsigned int reg);
27 void (*format_val)(void *buf, unsigned int val);
28 unsigned int (*parse_val)(void *buf);
29};
30
31struct regmap {
32 struct mutex lock;
33
34 struct device *dev; /* Device we do I/O on */
35 void *work_buf; /* Scratch buffer used to format I/O */
36 struct regmap_format format; /* Buffer format */
37 const struct regmap_bus *bus;
38
39 unsigned int max_register;
40 bool (*writeable_reg)(struct device *dev, unsigned int reg);
41 bool (*readable_reg)(struct device *dev, unsigned int reg);
42 bool (*volatile_reg)(struct device *dev, unsigned int reg);
43};
44
45#endif
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
index e57f10f485a1..f51efeb091c5 100644
--- a/drivers/base/regmap/regmap.c
+++ b/drivers/base/regmap/regmap.c
@@ -15,37 +15,10 @@
15#include <linux/mutex.h> 15#include <linux/mutex.h>
16#include <linux/err.h> 16#include <linux/err.h>
17 17
18#include <linux/regmap.h>
19
20#define CREATE_TRACE_POINTS 18#define CREATE_TRACE_POINTS
21#include <trace/events/regmap.h> 19#include <trace/events/regmap.h>
22 20
23struct regmap; 21#include "internal.h"
24
25struct regmap_format {
26 size_t buf_size;
27 size_t reg_bytes;
28 size_t val_bytes;
29 void (*format_write)(struct regmap *map,
30 unsigned int reg, unsigned int val);
31 void (*format_reg)(void *buf, unsigned int reg);
32 void (*format_val)(void *buf, unsigned int val);
33 unsigned int (*parse_val)(void *buf);
34};
35
36struct regmap {
37 struct mutex lock;
38
39 struct device *dev; /* Device we do I/O on */
40 void *work_buf; /* Scratch buffer used to format I/O */
41 struct regmap_format format; /* Buffer format */
42 const struct regmap_bus *bus;
43
44 unsigned int max_register;
45 bool (*writeable_reg)(struct device *dev, unsigned int reg);
46 bool (*readable_reg)(struct device *dev, unsigned int reg);
47 bool (*volatile_reg)(struct device *dev, unsigned int reg);
48};
49 22
50static void regmap_format_4_12_write(struct regmap *map, 23static void regmap_format_4_12_write(struct regmap *map,
51 unsigned int reg, unsigned int val) 24 unsigned int reg, unsigned int val)