From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754213AbcDMRkG (ORCPT ); Wed, 13 Apr 2016 13:40:06 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:38515 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754078AbcDMRjd (ORCPT ); Wed, 13 Apr 2016 13:39:33 -0400 From: Srinivas Kandagatla To: Mark Brown , Greg Kroah-Hartman Cc: Srinivas Kandagatla , Maxime Ripard , linux-kernel@vger.kernel.org, rjendra@qti.qualcomm.com Subject: [PATCH v1 1/3] regmap: add regmap_can_raw_read() api Date: Wed, 13 Apr 2016 18:39:12 +0100 Message-Id: <1460569154-25030-2-git-send-email-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1460569154-25030-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1460569154-25030-1-git-send-email-srinivas.kandagatla@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/base/regmap/regmap.c | 13 ++++++++++++- include/linux/regmap.h | 7 +++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index df2d2ef..23f17fd 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c @@ -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, diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 3dc08ce..be3da4c 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -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) -- 2.5.0