Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp754776rdh; Sun, 24 Sep 2023 10:11:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFACsvoXlZ5hCO4pnpwt0YmnFF6IG2zIpuAQbGJY2VZwyFfKSR8gIYjJ+BXJI2JJjVImdr8 X-Received: by 2002:a17:90b:1bc5:b0:277:1bd8:abe1 with SMTP id oa5-20020a17090b1bc500b002771bd8abe1mr2448212pjb.30.1695575518854; Sun, 24 Sep 2023 10:11:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695575518; cv=none; d=google.com; s=arc-20160816; b=tMYvyuBfCJSlj5MLHY+DnH5L5gGKJ8I25M2DF04OzHYi40fk71beyFmzPg2gxa47ub 4VVMpb5GvgBVz5SmR8+5cdVEhXbcxkrppNnTJcr0bikHhtp+aufjENht64zg8n8yJ5IL dIreI26u3Px5lMF23sBWm/eGz392Uz7zMlHUbo/XLXa2BalAcdAzlFla32TpOlPFOxp0 nZ6DwyMwrHyJduNUylELtfiHY6qVmH68L0LJh/IYdZv1ab86kBYOACB5M9rJm5NHADMN DDj9klEdpUnvyf4Kb8/SWhbzendrxZlygYZc1cTNlfWMNr/ZsxWj65MEhgOyZq3CixtU LYYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=imPu2hzF7pTLkk7DLNny1xZEED4fv1nvxCJeS9zVeBk=; fh=UU0GqEaQ9Xnukct86UJbX2/ZB3UfIgAdTfbf6iYszSw=; b=JW3jillbq2eCSU1L38B64+vt2smxOiwb60KM79FXMuz5ry38Cd8FIdtduXCl7qvAmG 2IlBE0kBzK1nl9uS6k9aPA2IcwlP/ru28jA+lai4s6L+/tVcVS7qsvt2fjuMKzMrD+p+ VtzMBG0GDNDTAVK+Fy13fs0oWjvdJ/5hh6Y5SSCXHpAcZRx/hiA+gs8GxzFviNO9x4IQ 0joPiz/GF0RQTAne0JQoZe7KgpCa4ATyEUdeJk+FkZoVa9Mo7hI2LXe1KsfevJgUi8lU 22ddM0uNT0mIU0mYyjhsF9pHn5T05sf7pJ2eDh+y4HNWmiP4/RqUMTyjyaPGsqeCKbm4 zhng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id n32-20020a634d60000000b00573e3b0d3e3si7985586pgl.408.2023.09.24.10.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 10:11:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 5E24E8021DB2; Sun, 24 Sep 2023 10:11:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230107AbjIXRLl (ORCPT + 99 others); Sun, 24 Sep 2023 13:11:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229930AbjIXRLi (ORCPT ); Sun, 24 Sep 2023 13:11:38 -0400 Received: from mx.skole.hr (mx1.hosting.skole.hr [161.53.165.185]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 977CE107 for ; Sun, 24 Sep 2023 10:11:31 -0700 (PDT) Received: from mx1.hosting.skole.hr (localhost.localdomain [127.0.0.1]) by mx.skole.hr (mx.skole.hr) with ESMTP id EB72C82071; Sun, 24 Sep 2023 19:11:29 +0200 (CEST) From: =?utf-8?q?Duje_Mihanovi=C4=87?= Date: Sun, 24 Sep 2023 18:42:56 +0200 Subject: [PATCH RFC 3/6] ARM: pxa: Convert Spitz CF power control to GPIO descriptors MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20230924-pxa-gpio-v1-3-2805b87d8894@skole.hr> References: <20230924-pxa-gpio-v1-0-2805b87d8894@skole.hr> In-Reply-To: <20230924-pxa-gpio-v1-0-2805b87d8894@skole.hr> To: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King , Alan Stern , Greg Kroah-Hartman , Linus Walleij , Bartosz Golaszewski , Andy Shevchenko Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org, =?utf-8?q?Duje_Mihanovi=C4=87?= X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2162; i=duje.mihanovic@skole.hr; h=from:subject:message-id; bh=fHl5iSb/dE+9PwQC8nVVOcMrGaHAC690mEvxtdZMvYU=; b=owEBbQKS/ZANAwAIAZoRnrBCLZbhAcsmYgBlEG27BuK/Gqm8cinGDVx4sQvQLQVqGvoy93Y6k DWmkjG5K4uJAjMEAAEIAB0WIQRT351NnD/hEPs2LXiaEZ6wQi2W4QUCZRBtuwAKCRCaEZ6wQi2W 4dXLEACikszO91VOu+vhakMeMrm/O3tmkrMkN8NPnGXcvL4gNyUYn1yBs4GGIwhNgqKx4BFJThM qu0g4cJNxl2Xo3ZJTV1/DJUkCi77Pgg24369H9qUWfZaxYN1ib4dxG1EZtlVzUKBcs/hqIN7Oop G1BDawuMi1J9vDEuKBaTUaPYHqsEgqd45Q1jGAeyuANqTHxebXGVxpOf6QQpakniCz2NgpvPcFP H5yA/Mg/ZCHzUxZu7Y5dYymHsw9TcAswEsGKKn7tW0dc3nMCqxLVeKyf6k2bI/hq/HbmdRIY73O S0UbqSfPKefBCsGjcwXg8r8bmO6J+aZy5XSwRBO/EhFxHsTnGQCL3vaORXDnDLxi+ZU1Io7ADPP fNGRqmjPwo3UPFWe0sYdK3yHRX8jDizPplYQTaMgqWqE1/aWfS9f6DBeL7rFYhZ/uBFeGTWLGQy G9F42HDvL9v+ri1rOMEZxmzxdEbB5Am73ph9LYg9WjKysUJDqJvHpFYx+p4zIUsxAFWDxuMdBeU +JQOr80ouEKJq0DmW6PW+edrmPzoKPnymkae2whXJdepUikD9hDp/yRrAD52aZK3Tp0p2mQYPjt gyVLQDvKE4nnKDtnSaP9T/qtpSTH9xWcV7xwFOTnhcMp38jMQQny17s2GxvjVsJFOq5eCf+JV1S K44HsSzUeiy5P2g== X-Developer-Key: i=duje.mihanovic@skole.hr; a=openpgp; fpr=53DF9D4D9C3FE110FB362D789A119EB0422D96E1 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 24 Sep 2023 10:11:47 -0700 (PDT) Sharp's Spitz board still uses the legacy GPIO interface for controlling the power supply to its CF and SD card slots. Convert it to use the GPIO descriptor interface. Signed-off-by: Duje Mihanović --- arch/arm/mach-pxa/spitz.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 91c4b208973c..616305978727 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -133,6 +133,10 @@ static unsigned long spitz_pin_config[] __initdata = { * Scoop GPIO expander ******************************************************************************/ #if defined(CONFIG_SHARP_SCOOP) || defined(CONFIG_SHARP_SCOOP_MODULE) +GPIO_LOOKUP_SINGLE(spitz_card_pwr_ctrl_gpio_table, "pxa2xx-mci.0", + "sharp-scoop", SPITZ_GPIO_CF_POWER, "cf_power", + GPIO_ACTIVE_HIGH); + /* SCOOP Device #1 */ static struct resource spitz_scoop_1_resources[] = { [0] = { @@ -190,6 +194,7 @@ struct platform_device spitz_scoop_2_device = { static void __init spitz_scoop_init(void) { platform_device_register(&spitz_scoop_1_device); + gpiod_add_lookup_table(&spitz_card_pwr_ctrl_gpio_table); /* Akita doesn't have the second SCOOP chip */ if (!machine_is_akita()) @@ -201,9 +206,18 @@ static void __maybe_unused spitz_card_pwr_ctrl(uint8_t enable, uint8_t new_cpr) { unsigned short cpr; unsigned long flags; + struct gpio_desc *cf_power; + + cf_power = gpiod_get(&pxa_device_mci.dev, "cf_power", GPIOD_ASIS); + if (IS_ERR(cf_power)) { + dev_err(&pxa_device_mci.dev, + "failed to get power control GPIO with %ld\n", + PTR_ERR(cf_power)); + return; + } if (new_cpr & 0x7) { - gpio_set_value(SPITZ_GPIO_CF_POWER, 1); + gpiod_direction_output(cf_power, 1); mdelay(5); } @@ -222,8 +236,10 @@ static void __maybe_unused spitz_card_pwr_ctrl(uint8_t enable, uint8_t new_cpr) if (!(cpr & 0x7)) { mdelay(1); - gpio_set_value(SPITZ_GPIO_CF_POWER, 0); + gpiod_direction_output(cf_power, 0); } + + gpiod_put(cf_power); } #else -- 2.42.0