From patchwork Fri Jul 6 15:05:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 141334 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp3222088ljj; Fri, 6 Jul 2018 08:07:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf6q1A17zuxhnSkZIKhJIf7p7+yvvS9X5oS8HsldGikaGOIJDMnnW1eDm3v0eJYwSo+tnV/ X-Received: by 2002:a63:e318:: with SMTP id f24-v6mr6454506pgh.175.1530889663620; Fri, 06 Jul 2018 08:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530889663; cv=none; d=google.com; s=arc-20160816; b=kAq22A/1/+jREIzyckdQ03mKTaCw38YjN5SQ1w0TQWMltQx0xJNc9T3YTmKIWHxiqs Ph16LfhhLZjYusXW1nv0vX9yS+mQI6OZ2GS+SRv+b6DpRk/28X6CvV5TA4fNAxWhjHv1 iXCRdn97K45r3424vAdxOhqiFzxWxwPzr3Ru7HowXWvP4pWLRADy5P4w88mAQAxB2zMF kBJHrmSFD0To9IcKC8glchWJ/d63CwK80Ea5ww/iWU/Asju/xe+i2KMf2WVkON2QScFk NDimixxTg0Df/SVQyZtP4VmffCEKf2mBUJmlXQY1ytKSGY0y5tv3a46hV5aS5ZX08btO rXRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=MszlGfMwfZkMi1OchCWI4zsvVKuSKrnb//3WWCFbafY=; b=tUa4gmAl75uEj0kiuvVJDvyXuHISpJL65Z1fjlG1lRprlKU/qBVC5me3Adfu0Q3ti3 9yQ3BIGbALVKG/4CYGKE1S7kPUSY68Z1Rv00MGWKVgMk0oWFGHgM6A/bdoIFgnto6NZ7 OVTrOLIZMbVw7Cw03AyZlpm87I0sdy6urT1ju0a9fN3K2Vonkkoo5LjfS8kj5XnsC8jy owFWssNODRt6/1qp6uGOjveYizhr4ZPBM2oouwT0G15ZEXD8PKJUmdXR5EExYvgBizwv kJfKav7B0EwfoThKi6WhmqqkcNsFHnwlpYE19LPSPZFT21cGSBt65PeWocL1rjuJ4piq OGBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eYNYSDsn; 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 sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4-v6si8386028plb.251.2018.07.06.08.07.43; Fri, 06 Jul 2018 08:07:43 -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 header.s=google header.b=eYNYSDsn; 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 sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754086AbeGFPHl (ORCPT + 31 others); Fri, 6 Jul 2018 11:07:41 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:37754 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753732AbeGFPHk (ORCPT ); Fri, 6 Jul 2018 11:07:40 -0400 Received: by mail-wr1-f68.google.com with SMTP id q10-v6so4525958wrd.4 for ; Fri, 06 Jul 2018 08:07:39 -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; bh=MszlGfMwfZkMi1OchCWI4zsvVKuSKrnb//3WWCFbafY=; b=eYNYSDsnm03nX5Pdk72wjXgNSBthVAVLawLSKAmzfjmsPKNGM40vnB5ntexMFZMFfC Wqvfj6I4+KUryOOrjEqUpuhzj5Z+6frnqXUYa9Aev5AFXLDKo+ypk7lpPTE37f5uYyNZ XGyZzi2R/HIM3scaIFOzpMWnzKWe3F2Ty5pKM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MszlGfMwfZkMi1OchCWI4zsvVKuSKrnb//3WWCFbafY=; b=QoLB5m36IfX8qXMm1FwXDwKOoB2XiSjE7dvGDOs2oyJYwLAh7EPPBRmU2vWDHIOBk4 AF5DOLflWaVDcGEVDAjFJbKusQ9/dkbWxA0Ejr2+PaFpMVgZIudpUEZdkl9hNDG8zyo/ MvfTPic3WBWfL+Jb1Ib/lbSzsRnYsLGgCmgBHTk0QtjnnGVNTqTLqDNZ8d/TNN1VBglB ZT+zQ9MEynqQVrNCOUOc4z4K6ECg9YoUjUx0CyQdiGkMJ1zTVYvD6zvJk37Iip7ItTK+ 0UMNCuB5meicAi1Ql0SGHKQittxleQK5/yRQRBBCbEuJ0vhwA7kbYkKmWXpBzQC2OogZ vm4A== X-Gm-Message-State: APt69E1tzshZUX6QgZ8/GsvY/H6xf91KnVS2zJTBZcyIZlZs4g/SDyXH DPUB2XgJJ3Au99nzUPWCKtncsCUMVxo= X-Received: by 2002:adf:8597:: with SMTP id 23-v6mr8475274wrt.31.1530889659166; Fri, 06 Jul 2018 08:07:39 -0700 (PDT) Received: from localhost.localdomain (cpc90716-aztw32-2-0-cust92.18-1.cable.virginm.net. [86.26.100.93]) by smtp.gmail.com with ESMTPSA id a184-v6sm11499651wmf.30.2018.07.06.08.07.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 06 Jul 2018 08:07:38 -0700 (PDT) From: Srinivas Kandagatla To: broonie@kernel.org Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, Srinivas Kandagatla Subject: [PATCH v2] regmap: slimbus: add support to multi read/write Date: Fri, 6 Jul 2018 16:05:27 +0100 Message-Id: <20180706150527.8811-1-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.16.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SLIMbus supports upto 16 bytes in value management messages, so add support to read/writes upto 16 bytes. This also removes redundant single register reg_read/reg_write. Also useful for paged register access on SLIMbus interfaced codecs. Signed-off-by: Srinivas Kandagatla --- drivers/base/regmap/regmap-slimbus.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) -- 2.16.2 diff --git a/drivers/base/regmap/regmap-slimbus.c b/drivers/base/regmap/regmap-slimbus.c index 91d501eda8a9..0968059f1ef5 100644 --- a/drivers/base/regmap/regmap-slimbus.c +++ b/drivers/base/regmap/regmap-slimbus.c @@ -7,33 +7,24 @@ #include "internal.h" -static int regmap_slimbus_byte_reg_read(void *context, unsigned int reg, - unsigned int *val) +static int regmap_slimbus_write(void *context, const void *data, size_t count) { struct slim_device *sdev = context; - int v; - v = slim_readb(sdev, reg); - - if (v < 0) - return v; - - *val = v; - - return 0; + return slim_write(sdev, *(u16 *)data, count - 2, (u8 *)data + 2); } -static int regmap_slimbus_byte_reg_write(void *context, unsigned int reg, - unsigned int val) +static int regmap_slimbus_read(void *context, const void *reg, size_t reg_size, + void *val, size_t val_size) { struct slim_device *sdev = context; - return slim_writeb(sdev, reg, val); + return slim_read(sdev, *(u16 *)reg, val_size, val); } static struct regmap_bus regmap_slimbus_bus = { - .reg_write = regmap_slimbus_byte_reg_write, - .reg_read = regmap_slimbus_byte_reg_read, + .write = regmap_slimbus_write, + .read = regmap_slimbus_read, .reg_format_endian_default = REGMAP_ENDIAN_LITTLE, .val_format_endian_default = REGMAP_ENDIAN_LITTLE, };