From patchwork Sat Oct 22 07:19:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7239 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1090942wrr; Sat, 22 Oct 2022 00:49:04 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6YnNuTARfltN/oiEFSDJ6acWoY86Z6boItMkLPZXtWpAEYomIQg+SyuBJkYFT9AOjE0ef4 X-Received: by 2002:a17:90a:4588:b0:205:d605:8bcc with SMTP id v8-20020a17090a458800b00205d6058bccmr26924996pjg.205.1666424944219; Sat, 22 Oct 2022 00:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666424944; cv=none; d=google.com; s=arc-20160816; b=0endhiHMvoD1yxrnuiLzuMYDNDCDv1kP3yl3UFJPcVc32ap2uroh/sGJzrNH0qsbUU hZD+JDT8lmoV9KfhYAXz0D7J6NP48gSgKCOCu72c40PzeWSuDBKoamA2VlqkKw6lBOLt l0QutZ1wU++6xwRdpSe97lTRV43sMAcoNjibf/cGniT6JIzyNmZuMOMGkNCkPQuZj4O0 YykCiC6voIITR9kSwU83n54EG4pufP1ojzA6i8EL9H0d81VKLYKJZ6Qf4NDhr0STqL1T Dgz7cKIZ1I1PKkfx1twhl16kOsXUwZ9NOIhwBnOhgQiEkESZZpXo+xbiQAVcUavpK/V7 4XOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8h+KKfeYENO2/kWguJvSk42DXK3gyeApSnH0SCTLTCY=; b=NbDj0hGh5VVHiyu1Uv8YBfGdcADMDvoFAomA18q/IjdAETdRpLzNkJHbPk/WcGPDpo 8TJ3WfhnIaIZrzl6vyeV1Rt0SwtNcRnluhQUEe9pIKeM981Lhzk9Ga/ZS6jLdQEWB7Qo ZWz6KsVjxlmeLQZhZkqz3su5lWUj3kIiGTUIkO0dDlCuKWIY/+SIjJ40sSOi0LPkOodo icQQzMwGshAbd43WoDSwaM2063PD+IQLL1EAlK/p/IYSpQiHM7oMOezoAUzB4OVG7ljj S1yGvFp3Sb+o5nFQgS568osLpqioNzx6RCh9SETZWZMj7qR3fD5x3lnu3mUkaxzcBU0P 0y6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yxb3AyAC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 206-20020a6306d7000000b00460dd0eed0csi29285469pgg.176.2022.10.22.00.48.51; Sat, 22 Oct 2022 00:49:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yxb3AyAC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231611AbiJVHsY (ORCPT + 99 others); Sat, 22 Oct 2022 03:48:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231564AbiJVHsC (ORCPT ); Sat, 22 Oct 2022 03:48:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE63D474C5; Sat, 22 Oct 2022 00:44:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E812860B28; Sat, 22 Oct 2022 07:39:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0741AC433C1; Sat, 22 Oct 2022 07:39:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666424383; bh=2W+EnrEqw1ZdduKBQk6+8YZEHNmfS8U/NiyiLPhgklc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yxb3AyAC1T+EzRM/Wm9+juEjfu6Ed+Z2dVaDOH2KplrmVz4XT3nsTVEhJ/Av6ny8c LzzcZkiMuVMKITsLQEGMOJ9/qXL/aMbY7Wi6OUjowKxnsclaIcEHa1Mu2CTdpkoTGn LJdsqC3I+1RaYaYR5VXWpAebTu42oqPCXXPACyrA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Stuebner , Quentin Schulz , Linus Walleij Subject: [PATCH 5.19 098/717] pinctrl: rockchip: add pinmux_ops.gpio_set_direction callback Date: Sat, 22 Oct 2022 09:19:37 +0200 Message-Id: <20221022072432.717806457@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747373202393386204?= X-GMAIL-MSGID: =?utf-8?q?1747373202393386204?= From: Quentin Schulz commit 4635c0e2a7f7f3568cbfccae70121f9835efa62c upstream. Before the split of gpio and pinctrl sections in their own driver, rockchip_set_mux was called in pinmux_ops.gpio_set_direction for configuring a pin in its GPIO function. This is essential for cases where pinctrl is "bypassed" by gpio consumers otherwise the GPIO function is not configured for the pin and it does not work. Such was the case for the sysfs/libgpiod userspace GPIO handling. Let's re-implement the pinmux_ops.gpio_set_direction callback so that the gpio subsystem can request from the pinctrl driver to put the pin in its GPIO function. Fixes: 9ce9a02039de ("pinctrl/rockchip: drop the gpio related codes") Cc: stable@vger.kernel.org Reviewed-by: Heiko Stuebner Signed-off-by: Quentin Schulz Link: https://lore.kernel.org/r/20220930132033.4003377-2-foss+kernel@0leil.net Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/pinctrl/pinctrl-rockchip.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -2393,11 +2393,24 @@ static int rockchip_pmx_set(struct pinct return 0; } +static int rockchip_pmx_gpio_set_direction(struct pinctrl_dev *pctldev, + struct pinctrl_gpio_range *range, + unsigned offset, + bool input) +{ + struct rockchip_pinctrl *info = pinctrl_dev_get_drvdata(pctldev); + struct rockchip_pin_bank *bank; + + bank = pin_to_bank(info, offset); + return rockchip_set_mux(bank, offset - bank->pin_base, RK_FUNC_GPIO); +} + static const struct pinmux_ops rockchip_pmx_ops = { .get_functions_count = rockchip_pmx_get_funcs_count, .get_function_name = rockchip_pmx_get_func_name, .get_function_groups = rockchip_pmx_get_groups, .set_mux = rockchip_pmx_set, + .gpio_set_direction = rockchip_pmx_gpio_set_direction, }; /*