Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2075139rdb; Mon, 9 Oct 2023 11:36:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGCC57aBc3uGNiLgh7qW1ydOv7TAf+lRaSGJhrENRxFZcJKkij7jbW63ynLZdKoyG4wkyi3 X-Received: by 2002:a17:903:230a:b0:1c7:7e00:8075 with SMTP id d10-20020a170903230a00b001c77e008075mr20409794plh.66.1696876587336; Mon, 09 Oct 2023 11:36:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696876587; cv=none; d=google.com; s=arc-20160816; b=fHJYTk2T0GcOSe8K4yVuGoZdE63NNdWPZdmaqs0hgXPjWqyseRyprezZflyx6uOiNR 0bYJlR+1NLvGdjrw3AHhJTuzsSNniibmUwejQLBqYxD1CWKNU981PtAP3mc5INB+a9Mc aDYE6fXh6eKxr0s41qfVteqoBaiywWufC8jo0ScMEuAWsXSZM2ce+bFGqgawga1Cwx3k sD8XSfKX6C0pUWONnt00YGQ9qvVatcOPHY7YNeZ/JTaoRNimlHOoNcpefECn8sY8LH7e 9/6aT4ZhaZMgSOKKbNpyW4XVBjjtjGW93A+IMIJhqd46K3qFbfd0VIOEuCvK9VN3BKRh NNSQ== 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=OaQSvzd2cLH5u+iPsGjOUOA/UjDp7S1IQGKQzhNxyis=; fh=1i6b6fQBnaiq0xRa3ncF4yVLO4LQ/VVJhygl9h24PAo=; b=0QHMEKyvJe75mCC6BTZsn7OJpNj9DhiBJKhHkatc+LGW+5NWicqR9mSGT8C+N5hg2r wu9YntBE3KVDmDu6awia4aXJQmXRkWghxcEj22VKrAAriaw/s6oKUKMe0yDAMn9iMZDp 0rmO6UEoy2tsnqEH/SD26DM1fgQbL6HFmBM0g1DjE9SSjze4V09NalUauT7N0ZeY/pFz OsxY+nespAA43Q+CoqY0kUxcpOyZ3XBE4vbJ/NCqpPFFLXg/2fzyM9UYyA4D1tdxxnhC gwgDQZpGgDax3hawt+vM9JXbtcHhlOBzkHS4NQ65FDxV9duutT8nWON1hTTPOVWnh4qL jCcQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id l11-20020a170902f68b00b001b9736814b6si202287plg.309.2023.10.09.11.36.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:36:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 331D3807FD50; Mon, 9 Oct 2023 11:35:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378094AbjJISe1 (ORCPT + 99 others); Mon, 9 Oct 2023 14:34:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377721AbjJISeT (ORCPT ); Mon, 9 Oct 2023 14:34:19 -0400 Received: from mx.skole.hr (mx1.hosting.skole.hr [161.53.165.185]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4438FAF; Mon, 9 Oct 2023 11:34:17 -0700 (PDT) Received: from mx1.hosting.skole.hr (localhost.localdomain [127.0.0.1]) by mx.skole.hr (mx.skole.hr) with ESMTP id D927D84C3E; Mon, 9 Oct 2023 20:34:15 +0200 (CEST) From: =?utf-8?q?Duje_Mihanovi=C4=87?= Date: Mon, 09 Oct 2023 20:34:00 +0200 Subject: [PATCH RFT v7 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: <20231009-pxa-gpio-v7-3-c8f5f403e856@skole.hr> References: <20231009-pxa-gpio-v7-0-c8f5f403e856@skole.hr> In-Reply-To: <20231009-pxa-gpio-v7-0-c8f5f403e856@skole.hr> To: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King , Alan Stern , Greg Kroah-Hartman , Linus Walleij , Bartosz Golaszewski , Andy Shevchenko , Dmitry Torokhov , Mark Brown Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org, linux-input@vger.kernel.org, linux-spi@vger.kernel.org, =?utf-8?q?Duje_Mihanovi=C4=87?= , Bartosz Golaszewski X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2281; i=duje.mihanovic@skole.hr; h=from:subject:message-id; bh=+fxcsarubc2tXSSH1K644VHfXQAJtw0ZRrtO0ziZod4=; b=owEBbQKS/ZANAwAIAZoRnrBCLZbhAcsmYgBlJEebBzCQ8D7a6o2IA9iJM6L4IKQvEJLF/EMXP D8/dTCglt+JAjMEAAEIAB0WIQRT351NnD/hEPs2LXiaEZ6wQi2W4QUCZSRHmwAKCRCaEZ6wQi2W 4W7nD/oDYI8OQRD1Xb/8LN/F2NAL5p3w4cjcV3gKEe69yyhOfsWRfhWuScix3/DvzARzdyQGoN4 7pLtVaz+giD3aR+FRcQzL5Wh2petHAporVzUTsKk3MxGx4wAZui7UnUAgwb0mF/Lie3xpeNkC3j K5nxi2Q5Xw9FDDN7AUuSAdCrEkUDzbRjX3ZBzad35xbYZ9+T83rm3Xo2TJMa07lkPYB06bFo49/ p9IdsgwYjevs8TWQxI4tHkuTQ0dgoVCqynJtR1w28S0TgYMQE9g1puhBjwqgkI9tg9RZtdv5CsQ nKMVlg4juTc7xfawDkPtexGwtU0OA09wXkxYTambLcXVcVnf2Cvzc/mcqYVE9vpXwENTCpFclYt uYjQ8ufCg7TQsmdokaVG01ZbxxcfjESE+Xp5GSrGn8uduC4ZCYIY3OtrUuuodLz1LN+ftYTVJlN gZYl5lrhe8RgOaAYLri+cp+VG7u6z8bPAEbOhMHheG0LKF4/mmbIJOuMnNNcmYn2nLNYH898UMb NwGnwR6g0CgnYSreN6kil9/SZ94KgP975Tya9dNXdapiSljTl2tkPdvzBfa+cffRIyXd7tDfwyw AqHp5gqMz4hr+lgM6RgM3xkI8+pNZ3VLPBkZ42Ly9Xve3RKbFBoB7Du8xpSNsmfDFL8KvXk9M1e Zh+8jJaWR9Q0dRQ== X-Developer-Key: i=duje.mihanovic@skole.hr; a=openpgp; fpr=53DF9D4D9C3FE110FB362D789A119EB0422D96E1 X-Spam-Status: No, score=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Mon, 09 Oct 2023 11:35:38 -0700 (PDT) X-Spam-Level: ** 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. Acked-by: Linus Walleij Reviewed-by: Bartosz Golaszewski 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 29907abc4513..c8fc333c2017 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