Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp804458rwi; Wed, 19 Oct 2022 03:13:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4nckuyS333QCPRtsMH0TkkY6Vdnoog+afjpL0QkM5eatM0hB/nIbDlfB/S5j5l7bxa+8sv X-Received: by 2002:a17:902:f789:b0:17f:8cb6:7da3 with SMTP id q9-20020a170902f78900b0017f8cb67da3mr7532256pln.167.1666174436286; Wed, 19 Oct 2022 03:13:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666174436; cv=none; d=google.com; s=arc-20160816; b=nONxkaJdPcxrtilctpD7BYud0Pg+lEM8IEq2BLMaCXmqyxAV55ZYnssWmr+utnrRe8 WhMkyj6kl6QNn7o5pVc/55T8lL4IaRCSxC8D0V+Afn6Fj0ALsAuifMpMTTocrDUFx0P4 Snp5LMZK0JouS3+UxjwlTRUVQlsXl3g0zjj2bMpNZHr87JMFVb/4U27mZ6ODiUyWQ9// w0IRpr3hDDhdd6SICQMYJE9UicRVU5fL/Kbsvob1mFyDQIFiYc3wVWuXJLbydBtVsNfz 1ln0I2lUexYhn/IquAosQM5NeEZ2mIGPqNTe92oE8l5mmqI3ILJEX+LrnKJRY42vsjh1 fejw== 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=C91jrVu2ruV7PBnvEuzpVsbZ7tv9DppYitMV8uNl4cJ1qeYfGXFMZBRdJmBp44WlL2 bIN+Ll7jUpsjPu/J9+w4WSWszWb/bX1ndcI5B8A4R6kLTid2Y0mPsK/ikQbcbvDtcWf+ /4bxmMmYblZeQxuwnP+TKR5BrY41X9WACTxeTlB5FcEyd70NfjXB5mSlKhn/gOlwSv6Q 9dJ4yA+dt1AgXk9LeVgPGU92UZYP1+fHP96BDtuMhbwQQrCOXXl83CpwMYuNtrPIBE52 aK8YDcy23IeZ1rjD3FnGxl/GKRqgwG3fmRCRgpYtTERgXKuZ7IqBaZOxQrRDcL04NVxn xURg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Str6dWB7; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e23-20020a656897000000b004388f47a0b1si19401882pgt.572.2022.10.19.03.13.43; Wed, 19 Oct 2022 03:13:56 -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=Str6dWB7; 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 S231926AbiJSI4x (ORCPT + 99 others); Wed, 19 Oct 2022 04:56:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231942AbiJSI4U (ORCPT ); Wed, 19 Oct 2022 04:56:20 -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 6540E9C7F7; Wed, 19 Oct 2022 01:52:31 -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 A452F6181B; Wed, 19 Oct 2022 08:44:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9687EC433D6; Wed, 19 Oct 2022 08:44:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666169097; bh=2W+EnrEqw1ZdduKBQk6+8YZEHNmfS8U/NiyiLPhgklc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Str6dWB7KpFM3v9hL6f1POrzr5hpZluShKWFKsxEO7f4YjM8NEc1LBjWd3/JPMAkc SuhuDCf0TKBy1rPPKptcW/khWhwRxvcpbTp5Ihm8cw3HMOti/LYCHNimmYZMPAbJy1 elccVrkV5TcGo0dHztOmFj/+KNfuRbzAb1fAuop8= 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 6.0 109/862] pinctrl: rockchip: add pinmux_ops.gpio_set_direction callback Date: Wed, 19 Oct 2022 10:23:16 +0200 Message-Id: <20221019083254.739632849@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 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 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, }; /*