From patchwork Wed Oct 19 08:23:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 4672 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp212812wrs; Wed, 19 Oct 2022 02:08:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5r0wY00czVZUUt8xtFxU6k6VYh+ySqwn6Bn/EDAxVnF0PqO4LFktQntCrsPWXXl0yr0rRV X-Received: by 2002:aa7:df04:0:b0:45b:cb0d:856a with SMTP id c4-20020aa7df04000000b0045bcb0d856amr6653694edy.180.1666170500642; Wed, 19 Oct 2022 02:08:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666170500; cv=none; d=google.com; s=arc-20160816; b=yAccgQ0GJnIUFokHJPVry+2jFBM8reqGffq3uZBjtgeYFBn30HXjk6tueLcxaOI+Ne VdCaWlm96t09YGMU33XMgQeM3D2XsqWU9uasS8aybH98t3ASCKhZVi/3ibxwApXOWbKK fYNzd594VevN4hJZ4txDripNrVxyMH9QlTjG9LedffD54JZe7FvlOgq2SHUoPahy4zOb 4hBi8iNuBAtTTic5PwLlXa6j/tTmjkEL8L1T5NzsNlQ4X9jBiW5a91g4ORQdgXUVjGGM +mP5N2jd/1NMTNYqxlwhOvSEouEBMqz/MeKlsGVirPko3vUenG9MmnNYIB+erBUE5WQ1 s34g== 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=AYpNnn5YpX1UIzOCZqEs9GJm9ikB424iPFX09FNomL8=; b=RMnepCZk5jMob9WhaKE10rlSAhqYAQCRvqKr7X9VDlIuHzHOdUnsWaaHVZw25jnWmV fZ/CB6NMMZGVWsCi14YeLaL629GU8sKL0X2/BzY3BBJaP2sSvRyjvoyGx7X6tSNw+FGA TqNQjkr0djVgVZOkTuo/UA7kfXue+Jo1TRLQ3GzkZBI+THyj7VqobK+4U9811HmzrYdq NXBo74plHoT35s85MiqCAmEwUbrIfVVGlsdEjxepVWt1BTaNhmd4ELJz/9U4u6Nr0NDx QzbSFgl/LAmgw4+j1MfIKpc8WELcIfSSp34U+zn3CDa+qNgG0+MCWa95CkEpG4BIDacH 8XLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qVxwYKkW; 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 dn17-20020a17090794d100b00781d793f524si13229812ejc.132.2022.10.19.02.07.46; Wed, 19 Oct 2022 02:08:20 -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=qVxwYKkW; 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 S232185AbiJSJAr (ORCPT + 99 others); Wed, 19 Oct 2022 05:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232078AbiJSI6w (ORCPT ); Wed, 19 Oct 2022 04:58:52 -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 09EFE33848; Wed, 19 Oct 2022 01:54:03 -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 5304C617F4; Wed, 19 Oct 2022 08:42:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45C97C433C1; Wed, 19 Oct 2022 08:42:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666168958; bh=zKppyKIbE0qX7a5aCXROzEzRZ7q0XdFQU/ezCKPeOqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qVxwYKkWAmdhbX581XWxi7LN1YKfn4bKksuNeeT0fU0C0Z8wVA9F4wdvrTdOS6Ibq eocDDFXyU3lS/flUDPLEOkt9RkFap4HrOv5uUfyCajleU/hniYjmHU7V4XRd1z3QkI /M3xzQHtkFpyoSXbZDDQSGWMmqDpfiCTOrphjbjQ= 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 108/862] gpio: rockchip: request GPIO mux to pinctrl when setting direction Date: Wed, 19 Oct 2022 10:23:15 +0200 Message-Id: <20221019083254.691102670@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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747106399378026687?= X-GMAIL-MSGID: =?utf-8?q?1747106399378026687?= From: Quentin Schulz commit 8ea8af6c8469156ac2042d83d73f6b74eb4b4b45 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 call pinctrl_gpio_direction_input/output when setting the direction of a GPIO so that the pinctrl core requests from the rockchip pinctrl driver to put the pin in its GPIO function. Fixes: 9ce9a02039de ("pinctrl/rockchip: drop the gpio related codes") Fixes: 936ee2675eee ("gpio/rockchip: add driver for rockchip gpio") Cc: stable@vger.kernel.org Reviewed-by: Heiko Stuebner Signed-off-by: Quentin Schulz Link: https://lore.kernel.org/r/20220930132033.4003377-3-foss+kernel@0leil.net Signed-off-by: Linus Walleij Signed-off-by: Greg Kroah-Hartman --- drivers/gpio/gpio-rockchip.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/gpio/gpio-rockchip.c +++ b/drivers/gpio/gpio-rockchip.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -156,6 +157,12 @@ static int rockchip_gpio_set_direction(s unsigned long flags; u32 data = input ? 0 : 1; + + if (input) + pinctrl_gpio_direction_input(bank->pin_base + offset); + else + pinctrl_gpio_direction_output(bank->pin_base + offset); + raw_spin_lock_irqsave(&bank->slock, flags); rockchip_gpio_writel_bit(bank, offset, data, bank->gpio_regs->port_ddr); raw_spin_unlock_irqrestore(&bank->slock, flags);