From patchwork Tue Jan 10 17:29:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jonas Karlman X-Patchwork-Id: 13095399 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED800C46467 for ; Tue, 10 Jan 2023 17:30:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:MIME-Version:Message-Id:Date: Subject:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=TwR0ChxB1obdL3gqPurblWXZ5Ior/F4FJXA6GH1wpLU=; b=yZqkb8d5ux/1mt fphnMPsVOvKouRx67Q3BQgeG7pPT85D2yBZPxKFLu7ayXXOgUmGJwqBmt4XdMEB8o6wte4ErYgTb6 2V9jYm6emZBKgPocc6B8BLdhpK/KotK71PGPGs13tIZWP+gVjS8uyxhnz2nZs3zvGMRKbbKRM6rVd DzMmDYH64xQe7SZiwVadDBWQK5i5XJ+ccrFfELKpP0vqIXMlQ0ZaFufDWOfdxFfhCaH1d/hoUSZ5z Fyz/SP6kIBXl3fCjdSj6qlzJPwCT8DgwZV9q/pQTwU/bJaQcGeyCavMP0V1N3BhilVrHUjOFnrtJf zqZySxTPEkZqOgrumeRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFIRr-007ypm-VM; Tue, 10 Jan 2023 17:30:07 +0000 Received: from xtrwkvxq.outbound-mail.sendgrid.net ([167.89.24.164]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFIRo-007yo5-Fc for linux-rockchip@lists.infradead.org; Tue, 10 Jan 2023 17:30:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=from:subject:mime-version:to:cc:content-transfer-encoding: content-type:cc:content-type:from:subject:to; s=s1; bh=Enqo4zcrTsUPyc2S07hAbw7HI1eT9vQAq0wVBVB7Yd4=; b=aBZxGv/2ep3ucOFExFH5RAstX7MhM3a4tnjQBBwqkhLHaIXPW2XKeX6NL8mLmBk0Ydfv Xi+MO9LnQ+4EEI/svV4PTSjB3iKfIOKOrErPu2ehronm8pJQJJ3qBZi6Dm4wi6OTd71Wpi 7RXqFzTIYeuNNs30TVpErn0qCiy87E/VNc90WATrnmnR514xlH/7Lgs7mYSaFYg/CcLd3+ 1Aqhi4Jx+2M+Yr0huhp42xeME4nRTKH5+xhznO1u24h+rRGECVtO2pSvSaIWJWBwpC5ALj tyaag9D8NDw3NjajUhECLUwGDhASUvJGCX7qkIpiD+KDyv/8bvf1aYzLRtmQl07A== Received: by filterdrecv-69c5db5cf4-v9q2s with SMTP id filterdrecv-69c5db5cf4-v9q2s-1-63BDA095-34 2023-01-10 17:29:58.008202659 +0000 UTC m=+4645307.329602419 Received: from bionic.localdomain (unknown) by geopod-ismtpd-5-2 (SG) with ESMTP id uBQmAU3MRMi3h8v1Qw4eHg Tue, 10 Jan 2023 17:29:57.639 +0000 (UTC) From: Jonas Karlman Subject: [PATCH] pinctrl: rockchip: fix reading pull type on rk3568 Date: Tue, 10 Jan 2023 17:29:58 +0000 (UTC) Message-Id: <20230110172955.1258840-1-jonas@kwiboo.se> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-SG-EID: TdbjyGynYnRZWhH+7lKUQJL+ZxmxpowvO2O9SQF5CwCVrYgcwUXgU5DKUU3QxAfZekEeQsTe+RrMu3cja6a0h2fH6Ac/iJCsTv9mTSoNlCMkYTzJBaSMZUI61OYiMl+cON9WWqgEivQy7cFZLkZUUePEvFYf4d8rr/y2NX9HfLTLjyqZ18emMTw4MOAlQWDghaNWwUvUluVPxa2hxkxr0PB5vkEnyFmM96RmyY0hGdsxXr5rKeQE+LtvOzlKDr7BEcR4kyrUtxjU0KGleMysDA== To: Linus Walleij , Heiko Stuebner Cc: Jianqun Xu , linux-gpio@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Jonas Karlman X-Entity-ID: P7KYpSJvGCELWjBME/J5tg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230110_093005_232555_6A5F62EB X-CRM114-Status: GOOD ( 13.71 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org When reading pinconf-pins from debugfs it fails to get the configured pull type on RK3568, "unsupported pinctrl type" error messages is also reported. Fix this by adding support for RK3568 in rockchip_get_pull, including a reverse of the pull-up value swap applied in rockchip_set_pull so that pull-up is correctly reported in pinconf-pins. Also update the workaround comment to reflect affected pins, GPIO0_D3-D6. Fixes: c0dadc0e47a8 ("pinctrl: rockchip: add support for rk3568") Signed-off-by: Jonas Karlman Reviewed-by: Heiko Stuebner Signed-off-by: Jianqun Xu Reviewed-by: Jianqun Xu --- drivers/pinctrl/pinctrl-rockchip.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 849d5fa2a362..5eeac92f610a 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -2436,10 +2436,19 @@ static int rockchip_get_pull(struct rockchip_pin_bank *bank, int pin_num) case RK3308: case RK3368: case RK3399: + case RK3568: case RK3588: pull_type = bank->pull_type[pin_num / 8]; data >>= bit; data &= (1 << RK3188_PULL_BITS_PER_PIN) - 1; + /* + * In the TRM, pull-up being 1 for everything except the GPIO0_D3-D6, + * where that pull up value becomes 3. + */ + if (ctrl->type == RK3568 && bank->bank_num == 0 && pin_num >= 27 && pin_num <= 30) { + if (data == 3) + data = 1; + } return rockchip_pull_list[pull_type][data]; default: @@ -2497,7 +2506,7 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, } } /* - * In the TRM, pull-up being 1 for everything except the GPIO0_D0-D6, + * In the TRM, pull-up being 1 for everything except the GPIO0_D3-D6, * where that pull up value becomes 3. */ if (ctrl->type == RK3568 && bank->bank_num == 0 && pin_num >= 27 && pin_num <= 30) {