Mark Brown | 93de912 | 2011-07-20 22:35:37 +0100 | [diff] [blame^] | 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 | |
| 18 | struct regmap; |
| 19 | |
| 20 | struct 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 | |
| 31 | struct 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 |