From patchwork Fri Jun 28 18:08:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13716494 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9CA50C30658 for ; Fri, 28 Jun 2024 18:10:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ay9TI8HWK+oR18tT8EQNVS4HczzSY9JpQeS8IURTtMg=; b=VSBA34ttHsrlBe4bJk/t9ufxpv OrbvYulFQNGA5nP8BkbryxLji2/X/Ss+Hpmqy9YQHaMRNu5qpieQzgyVTB4/ziL6xchBHjhEb4fTd irZNz2nhXPmzmzDDnEwiW/oxHeL2WHCBXuxWJBX9TwTtU00yZyNn8mxwb0SyfPDmHfPTfQZ5nsIab 857Ey2q1nacxTKPXchQnRGuAKaT4ZRlA8+BRnvQlXsF5d7jdBqm//tXPrveAUww2pH8Yzx3l/V5Md 3RsyAZDtEulOO0rOLg3n9xkQvvMT3/fWNRiwGQ2i8GDumL7P/1sc/P5ibSSWDfgRUy2rm7SY0LADy 9BloegDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG2m-0000000Eacw-28Xl; Fri, 28 Jun 2024 18:09:56 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG21-0000000EaFG-1TSE for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 18:09:10 +0000 Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-70a078edb8aso204225b3a.1 for ; Fri, 28 Jun 2024 11:09:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719598149; x=1720202949; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ay9TI8HWK+oR18tT8EQNVS4HczzSY9JpQeS8IURTtMg=; b=Gh29ToiPrlcf40uuYtzlw08ML81dfOfgvFBibsEftgBg4N2m0jMlPbdXYpfRIeFsPs 1pVAYo42Z7UI4pj9AkjFvF58ecpqMH53FFRhPNAjZfIGp95wDeICcpDnudirIs84NsmY C9b3nI5pSPvSWCluHQUr+Jwy+nGnSvuFF3XtHX9lnaZKTG/0+cKzUYpg+G8IIKFeQeH0 oXWbgVQBbCz8uaqRnqTMzKCHHugwIxRjE68EuyFdx7haAY9bEiHklwFYbKPyIJASR2Yn t8gq9k9jx15ZUT7wFxIcxRVOs/vwQQ84MFumND5ipDgeFXNH9DEJwWLEYgBvKVNdcqTP ZNyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719598149; x=1720202949; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ay9TI8HWK+oR18tT8EQNVS4HczzSY9JpQeS8IURTtMg=; b=m4u3E0n5Mu43GWnfSXD+GtMjddZxB7pnNc4BylAHgWY2y7TFSaxkSODRpmUM9HZGvV tqRNTT/CfkHd2PxMkT5IRSq1/pc08N+ugHKldjwdauXMUCp+DBRlLSWR1kthk9CN4x5A N+QJFRJbhc6Tb7v8qdPvd6ECfnuXU2ikoqK/5OlKolTpFJDqA/O1QnjlYIMbp8FpQc0H JJO6TCG6fUR1Nl5fyC+uDA4x8nXeYd6X7W8SJA4MfYNO/RAf9YiuU8gCUohcufS62Y1e h1oI3H7YaiDJ2U8v1r7Wn+s53xb506BqPabOZ3MDuernKbXXxH4uxQDaZTzlgQBYpSow iIgQ== X-Gm-Message-State: AOJu0YxwEAH+f51HWlwTsXS2UQZX7OG6Jz8j31nwgMcumSVljzeOorRY d28QxpO9ygq73T0A2vSHwWwzTJD8vkqLyE7NRsfavjb0MsWnkO5Z X-Google-Smtp-Source: AGHT+IFUdHHXsh+kQq1MNIc7SmoyKk0Wy8cjfjvnFWozynmhMcEHlK3wZYCzHdSPBhIp8OVcAk/pbA== X-Received: by 2002:a05:6a20:3947:b0:1bd:208a:3b20 with SMTP id adf61e73a8af0-1bee4926d26mr3662610637.14.1719598148636; Fri, 28 Jun 2024 11:09:08 -0700 (PDT) Received: from dtor-ws.sjc.corp.google.com ([2620:15c:9d:2:c929:2998:720d:a104]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7080295d1f4sm1982911b3a.91.2024.06.28.11.09.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 11:09:08 -0700 (PDT) From: Dmitry Torokhov To: Haojian Zhuang , Daniel Mack , Robert Jarzmik , Arnd Bergmann , Linus Walleij , soc@kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/10] ARM: spitz: Use software nodes to describe audio GPIOs Date: Fri, 28 Jun 2024 11:08:46 -0700 Message-ID: <20240628180852.1738922-7-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.45.2.803.g4e1b14247a-goog In-Reply-To: <20240628180852.1738922-1-dmitry.torokhov@gmail.com> References: <20240628180852.1738922-1-dmitry.torokhov@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240628_110909_412969_D57218F3 X-CRM114-Status: GOOD ( 17.58 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Convert Spitz to use software nodes for specifying GPIOs for the audio chip. Signed-off-by: Dmitry Torokhov --- arch/arm/mach-pxa/spitz.c | 66 ++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 22 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 504d04bb2df7..278d49ed7a9c 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -130,6 +130,20 @@ static unsigned long spitz_pin_config[] __initdata = { GPIO1_GPIO | WAKEUP_ON_EDGE_FALL, /* SPITZ_GPIO_RESET */ }; +static const struct software_node spitz_scoop_1_gpiochip_node = { + .name = "sharp-scoop.0", +}; + +/* Only on Spitz */ +static const struct software_node spitz_scoop_2_gpiochip_node = { + .name = "sharp-scoop.1", +}; + +/* Only on Akita */ +static const struct software_node akita_max7310_gpiochip_node = { + .name = "i2c-max7310", +}; + /****************************************************************************** * Scoop GPIO expander ******************************************************************************/ @@ -950,24 +964,24 @@ static void __init spitz_i2c_init(void) static inline void spitz_i2c_init(void) {} #endif -static struct gpiod_lookup_table spitz_audio_gpio_table = { - .dev_id = "spitz-audio", - .table = { - GPIO_LOOKUP("sharp-scoop.0", 3, "mute-l", GPIO_ACTIVE_HIGH), - GPIO_LOOKUP("sharp-scoop.0", 4, "mute-r", GPIO_ACTIVE_HIGH), - GPIO_LOOKUP("sharp-scoop.1", 8, "mic", GPIO_ACTIVE_HIGH), - { }, - }, +static const struct property_entry spitz_audio_props[] = { + PROPERTY_ENTRY_GPIO("mute-l-gpios", &spitz_scoop_1_gpiochip_node, 3, + GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_GPIO("mute-r-gpios", &spitz_scoop_1_gpiochip_node, 4, + GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_GPIO("mic-gpios", &spitz_scoop_2_gpiochip_node, 8, + GPIO_ACTIVE_HIGH), + { } }; -static struct gpiod_lookup_table akita_audio_gpio_table = { - .dev_id = "spitz-audio", - .table = { - GPIO_LOOKUP("sharp-scoop.0", 3, "mute-l", GPIO_ACTIVE_HIGH), - GPIO_LOOKUP("sharp-scoop.0", 4, "mute-r", GPIO_ACTIVE_HIGH), - GPIO_LOOKUP("i2c-max7310", 2, "mic", GPIO_ACTIVE_HIGH), - { }, - }, +static const struct property_entry akita_audio_props[] = { + PROPERTY_ENTRY_GPIO("mute-l-gpios", &spitz_scoop_1_gpiochip_node, 3, + GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_GPIO("mute-r-gpios", &spitz_scoop_1_gpiochip_node, 4, + GPIO_ACTIVE_HIGH), + PROPERTY_ENTRY_GPIO("mic-gpios", &akita_max7310_gpiochip_node, 2, + GPIO_ACTIVE_HIGH), + { } }; /****************************************************************************** @@ -975,12 +989,14 @@ static struct gpiod_lookup_table akita_audio_gpio_table = { ******************************************************************************/ static inline void spitz_audio_init(void) { - if (machine_is_akita()) - gpiod_add_lookup_table(&akita_audio_gpio_table); - else - gpiod_add_lookup_table(&spitz_audio_gpio_table); - - platform_device_register_simple("spitz-audio", -1, NULL, 0); + struct platform_device_info audio_info = { + .name = "spitz-audio", + .id = PLATFORM_DEVID_NONE, + .properties = machine_is_akita() ? + akita_audio_props : spitz_audio_props, + }; + + platform_device_register_full(&audio_info); } /****************************************************************************** @@ -1003,6 +1019,12 @@ static void spitz_restart(enum reboot_mode mode, const char *cmd) static void __init spitz_init(void) { + software_node_register(&spitz_scoop_1_gpiochip_node); + if (machine_is_akita()) + software_node_register(&akita_max7310_gpiochip_node); + else + software_node_register(&spitz_scoop_2_gpiochip_node); + init_gpio_reset(SPITZ_GPIO_ON_RESET, 1, 0); pm_power_off = spitz_poweroff;