Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3682149rwb; Fri, 30 Sep 2022 07:02:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7n6eBhCT6SKcVRHH8mXFRcrvLPR1D8J0RT7OQm6nFTyY+2oqqmsuwUgq6ghKnc6cmgRkO/ X-Received: by 2002:a17:907:847:b0:77f:f489:cc25 with SMTP id ww7-20020a170907084700b0077ff489cc25mr6556458ejb.80.1664546554968; Fri, 30 Sep 2022 07:02:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664546554; cv=none; d=google.com; s=arc-20160816; b=OQE+lbDOrODCMyvUV5smcjY1bjr9HO1x75kJPvYgbxxQ+QgJYDpS2hdHWvFwBZ9TWt EcRIFAtUWaA9AgfY+SfABKdm3K9lFtr5axt46rv2b5xLa8sEoFhIqR3/F4vA9R75O76c EZO8aIsOI/98K5L+TgRzFNs3MNGjymNTtYed26IGpG9sieHh5rhaVfd50HbfCYtxrFlG IBFxSRA1zoCntdgieF4089tkRHZBdW0kNGN9kzklkIeZDLakrKhiJTcGGreO9fevV0e0 vXgix/utXZgnCoNK6KPp9jLNHDIcwTxoi5PPUck+V5DuestDtPgte140WIU5HBr6cDO/ rM3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from; bh=7AaWnX3YrT53RlKM8CpTo3ZX753J5QU/yE6fN+KvCfM=; b=st0pAeXriSG3IE66ddwAGI8d7cI+wA0/sNdNY0KDVrnPm7BD4ylAtI53JHWy9gyzUE hxMf7skg/9DSVjG88sL146CD6pZLamilBbfWnXso9z+2GkPrzEt8fDghZKoEizv5FKdT ji+/v6T5YK+6Co1UVuOY82/ik1CpthMeTK6ekXny5oH1Ta4iYPoEehBCLEpCfam7Qh6C c7LSl7lxFDaaqveUxlv2P5MDZAQi7k+I6ogrpJG6uCbIOu1qN8SraO0xW5z37+pJ9GJg 5GTfOEKK02/H3kCFh4RXbKR4hGNQ+pQzxO7QkW5V2BUpEXrUxq0dTTZcnLfSxvhl7Wq+ NoJA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k1-20020a170906128100b00780d18701f2si1710686ejb.176.2022.09.30.07.02.05; Fri, 30 Sep 2022 07:02:34 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231261AbiI3NVC (ORCPT + 99 others); Fri, 30 Sep 2022 09:21:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230382AbiI3NUz (ORCPT ); Fri, 30 Sep 2022 09:20:55 -0400 Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68ABE107599; Fri, 30 Sep 2022 06:20:53 -0700 (PDT) Received: (Authenticated sender: foss@0leil.net) by mail.gandi.net (Postfix) with ESMTPSA id 44FCC2000C; Fri, 30 Sep 2022 13:20:49 +0000 (UTC) From: Quentin Schulz Cc: linus.walleij@linaro.org, brgl@bgdev.pl, heiko@sntech.de, jay.xu@rock-chips.com, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, foss+kernel@0leil.net, Quentin Schulz , stable@vger.kernel.org Subject: [PATCH v2 1/2] pinctrl: rockchip: add pinmux_ops.gpio_set_direction callback Date: Fri, 30 Sep 2022 15:20:32 +0200 Message-Id: <20220930132033.4003377-2-foss+kernel@0leil.net> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220930132033.4003377-1-foss+kernel@0leil.net> References: <20220930132033.4003377-1-foss+kernel@0leil.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Quentin Schulz 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 --- v2: - added Reviewed-by, drivers/pinctrl/pinctrl-rockchip.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 32e41395fc768..c84bd0e1ce5a6 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -2393,11 +2393,24 @@ static int rockchip_pmx_set(struct pinctrl_dev *pctldev, unsigned selector, 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, }; /* -- 2.37.3