From patchwork Fri Jun 28 18:08:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 13716497 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 349E4C2BD09 for ; Fri, 28 Jun 2024 18:10:33 +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=TG3sk+VOjiapEEqjoqAeer5DFsWVZ6qfMsFkHqGpV/g=; b=KYN/zmDd75LtOyrAh+TrIJjsMU uoGhrlSDLAB10wT4VoMlR3aJOC8i64GLQ61T7inHcsEvGuwhvLFl9/v7ZUg+CYZqpa442etSk321p OQazzWxaewfQ5mbKDqTFeR6jFJcQ3l8vTzZty/n3fQyxpsF/vyVzrd8TSy6gwW42YAYEnVF8GZ2n1 CaCz/A50AE1st43jMpGEOg/PicDsX2kD71rh+V2cevkuF/KB18aLMIXQ5XEa2B70ucjDqBe5JnzSa RzTPquufp+EtiYGeiLIKWr/HpsQd0Sia7M3GDMSC13cao5yfIxijAut2rW2+CwoR08iKExShVjm/D mMVke+Hw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG3B-0000000EasV-1xs0; Fri, 28 Jun 2024 18:10:21 +0000 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNG24-0000000EaGj-2kkt for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 18:09:14 +0000 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-7082dd9bbf8so826066b3a.1 for ; Fri, 28 Jun 2024 11:09:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719598152; x=1720202952; 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=TG3sk+VOjiapEEqjoqAeer5DFsWVZ6qfMsFkHqGpV/g=; b=Ln7z5M+ILWwaGtQfZCElzzHHSD7Z5ZRo7B3cuCfFXlyh2XPlWX/4bbvosskjFwYLUT +m/MVJI8ReZmF+vgUe9agOHZkniWKrHfjWZMzqJwFZ24mcXrFQg+iJ7xsLwTMODWYuNr duOszHgV09LfRN8dSGk4iAuhCpib/BeZOuUWlP9Lp5PcY8MO3wXPrG1bL+8Y02T1E3fR +IP7DdcSewPyiO7raJ6bxF6GFCPv5W75lqTs6nIlP3CyR2U8XUTx29tS9i6Qn300WepW C7lMpPuRPxnRUjVdw9k4ftFGhPN62N2/lKLavl56JVwvTsPJXNLdt2g9QCZdh6X6bes4 VrLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719598152; x=1720202952; 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=TG3sk+VOjiapEEqjoqAeer5DFsWVZ6qfMsFkHqGpV/g=; b=jM/Lp185dtq586W/6JRyQFEyztBcLq7gZNVMZrBYjTTmUW08Wk1gVRCcYFF2xMSH+l 376oSMtR0TuAeGDeu2rfUwbgdv6DmC+jWM/AaPA9ARhywaLc8bglEX6gSUdkTNS28n1d RP9vWpF9gQ8g9klwAIQwSYqzsfr2cqTE5zzWZLPBnt708JRN/72jMwI+T38d+CjQCTZP bhRBMG6zXWWqAUjIRFgTiltr64U31+7iP+XrGjfck0TVxVZIwWhRFoavWSEqSvD2/M3D rdmP9Kz39FOHKdabzpLuJGhtftuqX4wlvC2G6R2yRxYZG65esHzqVxted5IQ9V8diQs4 i0iw== X-Gm-Message-State: AOJu0Yy+ktv1cC3bT3xUwxqmupt0xVbceIlBjBAj+/ybwqMjvVm0FCc4 /h6hTpA6bOh9ZhKMLG17CXVpaaMy9lUuCCsxDc1JW1qfGoxBcIWz4yXktw== X-Google-Smtp-Source: AGHT+IE/uVGbMaIUFaLkhNGkXfqS8xVGatcfBWhmOGBmX0fUaCsObE8LAGJWprKosEFqJ28F7EkCSg== X-Received: by 2002:a05:6a20:3c86:b0:1be:da68:1f26 with SMTP id adf61e73a8af0-1beda6820b8mr6390563637.59.1719598151928; Fri, 28 Jun 2024 11:09:11 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jun 2024 11:09:11 -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 09/10] ARM: spitz: Use software nodes to describe LED GPIOs Date: Fri, 28 Jun 2024 11:08:49 -0700 Message-ID: <20240628180852.1738922-10-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_110912_786870_D2731810 X-CRM114-Status: GOOD ( 15.34 ) 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 LEDs. Signed-off-by: Dmitry Torokhov --- arch/arm/mach-pxa/spitz.c | 71 +++++++++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 21 deletions(-) diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 4720a40587f1..b19d4ed35192 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c @@ -467,35 +467,64 @@ static inline void spitz_keys_init(void) {} * LEDs ******************************************************************************/ #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) -static struct gpio_led spitz_gpio_leds[] = { - { - .name = "spitz:amber:charge", - .default_trigger = "sharpsl-charge", - .gpio = SPITZ_GPIO_LED_ORANGE, - }, - { - .name = "spitz:green:hddactivity", - .default_trigger = "disk-activity", - .gpio = SPITZ_GPIO_LED_GREEN, - }, +static const struct software_node spitz_gpio_leds_node = { + .name = "spitz-leds", }; -static struct gpio_led_platform_data spitz_gpio_leds_info = { - .leds = spitz_gpio_leds, - .num_leds = ARRAY_SIZE(spitz_gpio_leds), +static const struct property_entry spitz_orange_led_props[] = { + PROPERTY_ENTRY_STRING("linux,default-trigger", "sharpsl-charge"), + PROPERTY_ENTRY_GPIO("gpios", + &spitz_scoop_1_gpiochip_node, 6, GPIO_ACTIVE_HIGH), + { } }; -static struct platform_device spitz_led_device = { - .name = "leds-gpio", - .id = -1, - .dev = { - .platform_data = &spitz_gpio_leds_info, - }, +static const struct software_node spitz_orange_led_node = { + .name = "spitz:amber:charge", + .parent = &spitz_gpio_leds_node, + .properties = spitz_orange_led_props, +}; + +static const struct property_entry spitz_green_led_props[] = { + PROPERTY_ENTRY_STRING("linux,default-trigger", "disk-activity"), + PROPERTY_ENTRY_GPIO("gpios", + &spitz_scoop_1_gpiochip_node, 0, GPIO_ACTIVE_HIGH), + { } +}; + +static const struct software_node spitz_green_led_node = { + .name = "spitz:green:hddactivity", + .parent = &spitz_gpio_leds_node, + .properties = spitz_green_led_props, +}; + +static const struct software_node *spitz_gpio_leds_swnodes[] = { + &spitz_gpio_leds_node, + &spitz_orange_led_node, + &spitz_green_led_node, + NULL }; static void __init spitz_leds_init(void) { - platform_device_register(&spitz_led_device); + struct platform_device_info led_info = { + .name = "leds-gpio", + .id = PLATFORM_DEVID_NONE, + }; + struct platform_device *led_dev; + int err; + + err = software_node_register_node_group(spitz_gpio_leds_swnodes); + if (err) { + pr_err("failed to register LED software nodes: %d\n", err); + return; + } + + led_info.fwnode = software_node_fwnode(&spitz_gpio_leds_node); + + led_dev = platform_device_register_full(&led_info); + err = PTR_ERR_OR_ZERO(led_dev); + if (err) + pr_err("failed to create LED device: %d\n", err); } #else static inline void spitz_leds_init(void) {}