@@ -1482,6 +1482,18 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
}
/**
+ * regmap_can_raw_read - Test if regmap_raw_read() is supported
+ *
+ * @map: Map to check.
+ */
+bool regmap_can_raw_read(struct regmap *map)
+{
+ return map->bus && map->bus->read && map->format.format_val &&
+ map->format.format_reg;
+}
+EXPORT_SYMBOL_GPL(regmap_can_raw_read);
+
+/**
* regmap_can_raw_write - Test if regmap_raw_write() is supported
*
* @map: Map to check.
@@ -2492,7 +2504,6 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val,
* them we have a series of single read operations.
*/
size_t total_size = val_bytes * val_count;
-
if (!map->use_single_read &&
(!map->max_raw_read || map->max_raw_read > total_size)) {
ret = regmap_raw_read(map, reg, val,
@@ -728,6 +728,7 @@ int regmap_get_val_bytes(struct regmap *map);
int regmap_get_max_register(struct regmap *map);
int regmap_get_reg_stride(struct regmap *map);
int regmap_async_complete(struct regmap *map);
+bool regmap_can_raw_read(struct regmap *map);
bool regmap_can_raw_write(struct regmap *map);
size_t regmap_get_raw_read_max(struct regmap *map);
size_t regmap_get_raw_write_max(struct regmap *map);
@@ -1045,6 +1046,12 @@ static inline void regmap_async_complete(struct regmap *map)
WARN_ONCE(1, "regmap API is disabled");
}
+static inline bool regmap_can_raw_read(struct regmap *map)
+{
+ WARN_ONCE(1, "regmap API is disabled");
+ return false;
+}
+
static inline int regmap_register_patch(struct regmap *map,
const struct reg_sequence *regs,
int num_regs)
This patch adds regmap_can_raw_read() api so that users like nvmem can check if the regmap is capable of doing a raw accessors. This can also be used by other infrastructures like nvmem which are based on regmap. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> --- drivers/base/regmap/regmap.c | 13 ++++++++++++- include/linux/regmap.h | 7 +++++++ 2 files changed, 19 insertions(+), 1 deletion(-) -- 2.5.0