From patchwork Wed Apr 13 17:39:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 65748 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp145991qge; Wed, 13 Apr 2016 10:48:10 -0700 (PDT) X-Received: by 10.66.166.78 with SMTP id ze14mr14570612pab.149.1460569213611; Wed, 13 Apr 2016 10:40:13 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gm2si4256499pac.213.2016.04.13.10.40.12; Wed, 13 Apr 2016 10:40:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754214AbcDMRkG (ORCPT + 29 others); 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 Received: by mail-wm0-f46.google.com with SMTP id u206so90645242wme.1 for ; Wed, 13 Apr 2016 10:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=82+k9ftzrGlQ0qFLkHhcngrN+MF1gB/akH0BiD/GZKA=; b=EjJGb3QWb0Qp/RI6g296CWLFhbaVVMzJrszZa860brGGL2b63S2q0/gqE6lr+p2uNu d7GWCIJYmDIxdLKtMU732BWXXuPpQFg31xx2PpK6DdfdZX+IlL2jz4bygxPl4bHQsLJo AwnwiZj34fBaYlJ6Q1MOOLotzn5lJw1iukW74= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=82+k9ftzrGlQ0qFLkHhcngrN+MF1gB/akH0BiD/GZKA=; b=ZRYKOHidJkbPBmfw23Ve5cp/82FJiHf0Zk0HRn7c50+lucsBCULeENp1ut9/AdhUqp 87CiieBvHU6opwPSBdw284ev25kzUe2QWnt8QTXzqLAGJYcbZI9DAJLuHdvUvZycUSUz 2Qb84uzGT7UkroGKDil2fSzqm0sAI//kRCbMYMF6Goy3jyQ+689ItMWkZvOssCLuhxMM opXrn0KQZH/tOHvhnug8uQSvmiWzzg5spjpUwTkrTFYxmY+1v1E1oLIpBRqe37BaO2TY IdUQmQt/dxE6ymo1rPdvxlxqgMhCXVIAaNOKsf/ZY/ghhGBPcilKeunmI89JYvupcbbJ J86g== X-Gm-Message-State: AOPr4FWeZSqpwS0cjDMWLUqEYcOEpJCkEwLRgygpbDKkrzgjQQyAEMU36F8TxTDQD6WwiVg8 X-Received: by 10.28.6.140 with SMTP id 134mr12069883wmg.23.1460569172355; Wed, 13 Apr 2016 10:39:32 -0700 (PDT) Received: from localhost.localdomain (host-92-17-247-99.as13285.net. [92.17.247.99]) by smtp.gmail.com with ESMTPSA id d131sm2317962wmd.12.2016.04.13.10.39.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 Apr 2016 10:39:31 -0700 (PDT) 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 Precedence: bulk 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(-) -- 2.5.0 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)