From patchwork Thu Jul 5 11:37:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 141117 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1831454ljj; Thu, 5 Jul 2018 04:39:08 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeQ0xtw5TcSv92amNap+YAuSsRqfa3snJ1mO/HCwoupeOCUC4PfqFUZkR8jiwbftQsRuw42 X-Received: by 2002:a65:6398:: with SMTP id h24-v6mr5290426pgv.245.1530790748538; Thu, 05 Jul 2018 04:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530790748; cv=none; d=google.com; s=arc-20160816; b=LUyj+jTt+TUzSf/kQb+t244pAHVm9EDUEIRKs2UnQ4igoZ/oeoL5dIUb4ePPqrmakV 2CFTykFcU2fiz7PkA51OfpmjirVJu4c2nZyKathf1I2KWlxlJaAHeycFmIT+njGd5Mj+ MjHXqzDCzzhb1CmuAjfzC2yVexFLXq8DhluRvFLu+i+KKfLA6auZ8MRhvLCBwEoZuvq3 o3Ex9I68NtwVrRFNeG18p4Oz3AktT7QYVIqZs6Rle/BgQ7YFInO1AZtWBT7oo0l6Gngb Vj0zjis8G7Q1sGlCa17b9xuHUS3LTqIAnRSJ9FCGs8NyqswR7f2SqSYvwTqi9OzPpkMw ym3Q== 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=O9kG0fGGqvYa7x2/m/4KfdxoY9HZuUZWGw5LDIJGZII=; b=DMRjR0/eS407pk7cib6HO/mZ1M8WZGHKxlKm19taKl1B/39mZEg+jwXuUOtE7/5ShV tQKX2M/4fCm0XgHbghCDQeJ97o4s2X2MnHA4m5kZ7tP6cpjfk7iPbiLCFtC3wDwR/qRT Dihqb1ThdbPg4opEPkBeJ8WYruY31cydVIK44c/A0ibgk9+DHuZC808SHvrKVNk0/DcL vJvMjTLyJoBeJwdI2gvjNMFXxdKf/DMs0+pe+B2FDdRTkMzgXlBGAIlSSqxl8Grty/1N +TDI2TqzlA6CyBfV1lzf42yCT2Yfg9NzKKDROl75ShIuqu3b+qsdzd1wOXlxmRdyYGo1 26+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Zj/KeAMP"; 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 o73-v6si78125pfk.356.2018.07.05.04.39.08; Thu, 05 Jul 2018 04:39:08 -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="Zj/KeAMP"; 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 S1754034AbeGELjG (ORCPT + 30 others); Thu, 5 Jul 2018 07:39:06 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:38071 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753737AbeGELjE (ORCPT ); Thu, 5 Jul 2018 07:39:04 -0400 Received: by mail-wm0-f68.google.com with SMTP id 69-v6so10259425wmf.3 for ; Thu, 05 Jul 2018 04:39:04 -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=O9kG0fGGqvYa7x2/m/4KfdxoY9HZuUZWGw5LDIJGZII=; b=Zj/KeAMPui2iL6JhlCsFEOa1o/LitmD8pFQ9slrhw4dLrj9BWROA65iZbohxgQymjj x4fC6+bUQ16bwZu2jVxkZh6sUUxwXbJkMUsTCAM1CMoqq+HZBa94qlIt7UVbet1DD6jt xmy5iJIM14h87sTa0mOcax5i+k2FMteS4PjY4= 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=O9kG0fGGqvYa7x2/m/4KfdxoY9HZuUZWGw5LDIJGZII=; b=BFN6wVbCRKR6by+NPoDoFaN7yt+rmm8N9VkHH//rl6Gl42DUeqgXhjtBjxJt7PiFDy o43TPoCUewo4q6NeUkCvWW2l0iUv7b6emAwo38UUZAjuhOqxo1O7pCtWG12YVXOlZcsj F/ggLf57fR8ClgZCZXHKKrHziak3FOoKMPk+DhP3xJlB6T97ramkOGVHO8nEkQHJb147 FeYncvuOZ9vUEv3Z7yd8qPGOmY2Bcv9k2ExJguC2/UzL2j+Y1QnqXuotDysdPIaS0QI4 QZ7537XiydghrLSO1LWitBOnNOCC8I0GnNfOyqWkF80Rw4GR7YtJRTiIt+1Erd+/QG7D N2Jg== X-Gm-Message-State: APt69E2ORWstenQta/gNMp3yLhnseYAq+4mA1eHg+I6JByyBlrS16UEf VwGhv1QB7KUuhMfdH5g3iU2qhA== X-Received: by 2002:a1c:cc08:: with SMTP id h8-v6mr3656758wmb.82.1530790743615; Thu, 05 Jul 2018 04:39:03 -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 x11-v6sm5731677wrm.78.2018.07.05.04.39.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 05 Jul 2018 04:39:03 -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] regmap: slimbus: add support to raw read/writes Date: Thu, 5 Jul 2018 12:37:00 +0100 Message-Id: <20180705113700.32465-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 raw read/writes upto 16 bytes. 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, 21 insertions(+), 2 deletions(-) -- 2.16.2 diff --git a/drivers/base/regmap/regmap-slimbus.c b/drivers/base/regmap/regmap-slimbus.c index 91d501eda8a9..fc07518666b2 100644 --- a/drivers/base/regmap/regmap-slimbus.c +++ b/drivers/base/regmap/regmap-slimbus.c @@ -31,11 +31,30 @@ static int regmap_slimbus_byte_reg_write(void *context, unsigned int reg, return slim_writeb(sdev, reg, val); } +static int regmap_slimbus_write(void *context, const void *data, size_t count) +{ + struct slim_device *sdev = context; + + return slim_write(sdev, *(u16 *)data, count - 2, (u8 *)data + 2); +} + +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_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, - .reg_format_endian_default = REGMAP_ENDIAN_LITTLE, - .val_format_endian_default = REGMAP_ENDIAN_LITTLE, + .max_raw_write = 16, + .max_raw_read = 16, + .write = regmap_slimbus_write, + .read = regmap_slimbus_read, + .reg_format_endian_default = REGMAP_ENDIAN_NATIVE, + .val_format_endian_default = REGMAP_ENDIAN_NATIVE, }; static const struct regmap_bus *regmap_get_slimbus(struct slim_device *slim,