Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp261838pxa; Fri, 14 Aug 2020 03:35:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMzErWrM2Q36kzmRAkaGEWvMQ1KLpjPsqgj3F6kqFjej+J26jAd61e2KN+aB3ginbIIg9E X-Received: by 2002:a50:fd83:: with SMTP id o3mr1507624edt.170.1597401339654; Fri, 14 Aug 2020 03:35:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597401339; cv=none; d=google.com; s=arc-20160816; b=TmwLeAxRiXRzJDyl1YY/js/y+oRBHvRO7cev9A3uk/bkikCjjlx4RJvRvOH5NW0Kbu WuoMaKAH7ilZQDVS6Ri5SMMgkhxvIC2Np0028VaXspWQiYvr30UX9h1BMzSoe5425cjt Qr1xSxNPybZJG9Dur84Z3tifKLfwPn+iPmZfTuSmVaB8FFJ0hHAonjJL5I641kZsqyDH zmbMFUcUpQenZr0wppyzUlGyVdrsoxYeGQjVSSo7+NlASuuJ3ZqSAtNQemWF9jWBT8Ju NftXq1HqK3RsjAhjDk7NHD57uro4h6wxbHjYLNWSAV1l8K2RxVRvIQF+3rVL+EjrH5We xNcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=0BI7Zarur5AZDfi3tr6YN0CzSCLEklpZ2XOutY0efPQ=; b=qu2JGOJ+2sidsLVxCW0e0Wxkwp4Cb9VFMT2dzYAlVL1s/ugNz2YGKQaDYS8pLNtD7h MMfoNa6L+OtZMLquvQ7EqfcqmnJTbz2ziXLOSskvwR748fb2ET5+SqG3h4949mAEcFHS jjpiOhmHJ0XpqyhPEL6OulZwKofuG5NtQ6JuZ8sckkxUmpGKO/UdTMMOqqoCKBCTxJkK HYEIr96OmsPwTdRLPz1QO8cBDTAYhbOiKyeVWxQ30tRm4Gxr0nUDMDxKQu8hKyaKPunJ bgGLKHx8mWduwAc3vDvBV6hdxn9w1QU/e+mgNW9jZ1dIiQbq4ub9rqv1/yRwN/LcgWrt MMtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b16si4894014eju.452.2020.08.14.03.35.16; Fri, 14 Aug 2020 03:35:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727814AbgHNKcM (ORCPT + 99 others); Fri, 14 Aug 2020 06:32:12 -0400 Received: from imap2.colo.codethink.co.uk ([78.40.148.184]:46766 "EHLO imap2.colo.codethink.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726012AbgHNKcM (ORCPT ); Fri, 14 Aug 2020 06:32:12 -0400 Received: from [188.210.212.0] (helo=localhost.localdomain) by imap2.colo.codethink.co.uk with esmtpsa (Exim 4.92 #3 (Debian)) id 1k6WZD-000572-4N; Fri, 14 Aug 2020 11:04:07 +0100 From: Thomas Preston To: linus.walleij@linaro.org, robh+dt@kernel.org, linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: thomas.preston@codethink.co.uk Subject: [PATCH 1/3] pinctrl: mcp23s08: Fixup mcp23x17 regmap_config Date: Fri, 14 Aug 2020 11:03:55 +0100 Message-Id: <20200814100357.209340-2-thomas.preston@codethink.co.uk> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200814100357.209340-1-thomas.preston@codethink.co.uk> References: <20200814100357.209340-1-thomas.preston@codethink.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org - Fix a typo where mcp23x17 configs are referred to as mcp23x16. - Fix precious range to include INTCAP{A,B}, which clear on read. - Fix precious range to include GPIOB, which clears on read. - Fix volatile range to include GPIOB, to fix debugfs registers reporting different values than `gpioget gpiochip2 {0..15}`. Signed-off-by: Thomas Preston --- drivers/pinctrl/pinctrl-mcp23s08.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/pinctrl/pinctrl-mcp23s08.c b/drivers/pinctrl/pinctrl-mcp23s08.c index 42b12ea14d6b..0138638276e7 100644 --- a/drivers/pinctrl/pinctrl-mcp23s08.c +++ b/drivers/pinctrl/pinctrl-mcp23s08.c @@ -87,7 +87,7 @@ const struct regmap_config mcp23x08_regmap = { }; EXPORT_SYMBOL_GPL(mcp23x08_regmap); -static const struct reg_default mcp23x16_defaults[] = { +static const struct reg_default mcp23x17_defaults[] = { {.reg = MCP_IODIR << 1, .def = 0xffff}, {.reg = MCP_IPOL << 1, .def = 0x0000}, {.reg = MCP_GPINTEN << 1, .def = 0x0000}, @@ -98,23 +98,23 @@ static const struct reg_default mcp23x16_defaults[] = { {.reg = MCP_OLAT << 1, .def = 0x0000}, }; -static const struct regmap_range mcp23x16_volatile_range = { +static const struct regmap_range mcp23x17_volatile_range = { .range_min = MCP_INTF << 1, - .range_max = MCP_GPIO << 1, + .range_max = (MCP_GPIO << 1) + 1, }; -static const struct regmap_access_table mcp23x16_volatile_table = { - .yes_ranges = &mcp23x16_volatile_range, +static const struct regmap_access_table mcp23x17_volatile_table = { + .yes_ranges = &mcp23x17_volatile_range, .n_yes_ranges = 1, }; -static const struct regmap_range mcp23x16_precious_range = { - .range_min = MCP_GPIO << 1, - .range_max = MCP_GPIO << 1, +static const struct regmap_range mcp23x17_precious_range = { + .range_min = MCP_INTCAP << 1, + .range_max = (MCP_GPIO << 1) + 1, }; -static const struct regmap_access_table mcp23x16_precious_table = { - .yes_ranges = &mcp23x16_precious_range, +static const struct regmap_access_table mcp23x17_precious_table = { + .yes_ranges = &mcp23x17_precious_range, .n_yes_ranges = 1, }; @@ -124,10 +124,10 @@ const struct regmap_config mcp23x17_regmap = { .reg_stride = 2, .max_register = MCP_OLAT << 1, - .volatile_table = &mcp23x16_volatile_table, - .precious_table = &mcp23x16_precious_table, - .reg_defaults = mcp23x16_defaults, - .num_reg_defaults = ARRAY_SIZE(mcp23x16_defaults), + .volatile_table = &mcp23x17_volatile_table, + .precious_table = &mcp23x17_precious_table, + .reg_defaults = mcp23x17_defaults, + .num_reg_defaults = ARRAY_SIZE(mcp23x17_defaults), .cache_type = REGCACHE_FLAT, .val_format_endian = REGMAP_ENDIAN_LITTLE, }; -- 2.26.2