From patchwork Tue Apr 23 13:54:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13640132 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 63D16C4345F for ; Tue, 23 Apr 2024 13:54:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qmFwwvuD2YJPHZOzuVAou8qb4bC34iDyEt37e0Un1po=; b=Ck0BSBSmWfVMEq AyVdMHxLW7/vtR62SIHOCCUqFL8JzGKpcV9dYmWByaW9WEAS7l8LagDU3ExW3E4DiZwPJwd9L5/nF VK5brJYAFEU6PxtRu3Y3fUuP4QWOAz/5qb9WK1RNDh1TPoxkZBz8dmdq6oUm6KDACBuxhbKnyudE4 Xr6imS6p/WhPXM5qRoggeRm6JuJ1u/gNNzuhWtCJ7w19ntsJ3tatCJ9PTV40nCNhM2KzIZKEB4vKa oaFfzrCMTNzECskEsz1dxQE0hgqERhE3Q1iBDvGBdctwqdiPOiaQp6brxJxC3Lf00W6EsIl4QZG3s guTs/C1eHWC8xlXE4yjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzGbV-00000000Aoy-11pC; Tue, 23 Apr 2024 13:54:37 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzGb0-00000000Abt-1Xcc for linux-arm-kernel@lists.infradead.org; Tue, 23 Apr 2024 13:54:07 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-5193363d255so7582838e87.3 for ; Tue, 23 Apr 2024 06:54:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713880443; x=1714485243; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gtSA0+kfCH0DzApn0Z0KwQ9Ybzg48e+TinciXUnlIO0=; b=UsbBBRaoB9d8vtJCLakqjmRcnjDpsTPz6I4pv7W0nkVvc496noU7xN4epGrP0OrPXj pKujER4ojXU1Qi+wE/D08IoFWON5CQBft0a4iTpQAiLpBKht8Quri/1tHDehJ81+eEpo 3/pXSf8/CkeRwgezSjEypVr8hyAmgC2PKo2pb8tWxXI0wJT2eKlyapuaH3nZ7sIA3u1A cxtotJWoyBjG62jnnRAMrsHFbfxXEPONF94nHv7PYpGUoJC4kTXfCjRBOE9IOFe+yd+I WxfTeRW5NDeevnvYziDO+hYe+lL7lUbxLaKg/scjzW5F06ZF6706klZ16sMGwkTSeFE7 anew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713880443; x=1714485243; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gtSA0+kfCH0DzApn0Z0KwQ9Ybzg48e+TinciXUnlIO0=; b=UQaSPBJWyDZ3UxVeVY9vRyeYR4qNOhBm1N5r39RW5kYxYkUXu9xu/9PZbysHdVvgtK tznEcwlSEDl+tZWMVTJuh0xotUKjMrbV5DJ8sN9+vQIIXLpq4KFqybqZJI/Gizcoad6J mhKQCKAsg0K7s7YP/qFStq+t4INmnZY9JzY1+q9/D16U51tJ9OpMlWVnBh8ghhLLCpzb 6DTgVamzJOasnFf20mCXou/uhSyzR2piY9bw8+6aO7L+gLR8p9/zu9PF7MPp46grsq8t PFLI0GBlb7hwPEBJhdb2t4b84QeM0IEm1htgAPlTyWfFHxVa87sl/rh5NwKCyriiAZp1 2B0A== X-Gm-Message-State: AOJu0YwyX8JJRqpcifAyaT9rWbagaSimqJmJUbnwqVYUV7aUVCkgFPY8 1+5KEFmHAxhizkGkwB4rfpnaBUhoUQHsaV7vC/ZsRkUakGAZHM+pH07LLF4fDSw= X-Google-Smtp-Source: AGHT+IFlE4pqogUlR+eZ37BQq666pDAg97ATWOgkDpFMSX8lWAbA7K/Gu3ABd18BwtKzqHaH18zFDA== X-Received: by 2002:a19:640e:0:b0:519:6691:4135 with SMTP id y14-20020a19640e000000b0051966914135mr8449450lfb.67.1713880443491; Tue, 23 Apr 2024 06:54:03 -0700 (PDT) Received: from [192.168.1.140] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id b18-20020ac24112000000b0051a61f2d251sm1875997lfi.290.2024.04.23.06.54.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 06:54:02 -0700 (PDT) From: Linus Walleij Date: Tue, 23 Apr 2024 15:54:01 +0200 Subject: [PATCH 5/5] ARM: orion5x: Convert TS409 board to GPIO descriptors for LEDs MIME-Version: 1.0 Message-Id: <20240423-gpio-leds-v1-5-799c2f6bc61c@linaro.org> References: <20240423-gpio-leds-v1-0-799c2f6bc61c@linaro.org> In-Reply-To: <20240423-gpio-leds-v1-0-799c2f6bc61c@linaro.org> To: Andrew Lunn , Sebastian Hesselbarth , Gregory Clement Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Linus Walleij X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240423_065406_463323_C00B0CBF X-CRM114-Status: GOOD ( 14.25 ) 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 This makes the LEDs on the TS409 Orion5x board use GPIO descriptors instead of hardcoded GPIOs from the global numberspace. Signed-off-by: Linus Walleij --- arch/arm/mach-orion5x/ts409-setup.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-orion5x/ts409-setup.c b/arch/arm/mach-orion5x/ts409-setup.c index 6f60dc1dfa22..8131982c10d9 100644 --- a/arch/arm/mach-orion5x/ts409-setup.c +++ b/arch/arm/mach-orion5x/ts409-setup.c @@ -8,6 +8,7 @@ * Copyright (C) 2008 Martin Michlmayr */ #include +#include #include #include #include @@ -168,20 +169,27 @@ static struct i2c_board_info __initdata qnap_ts409_i2c_rtc = { static struct gpio_led ts409_led_pins[] = { { .name = "ts409:red:sata1", - .gpio = 4, - .active_low = 1, }, { .name = "ts409:red:sata2", - .gpio = 5, - .active_low = 1, }, { .name = "ts409:red:sata3", - .gpio = 6, - .active_low = 1, }, { .name = "ts409:red:sata4", - .gpio = 7, - .active_low = 1, + }, +}; + +static struct gpiod_lookup_table ts409_leds_gpio_table = { + .dev_id = "leds-gpio", + .table = { + GPIO_LOOKUP_IDX("orion_gpio0", 4, NULL, + 0, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("orion_gpio0", 5, NULL, + 1, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("orion_gpio0", 6, NULL, + 2, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("orion_gpio0", 7, NULL, + 3, GPIO_ACTIVE_LOW), + { }, }, }; @@ -300,6 +308,7 @@ static void __init qnap_ts409_init(void) if (qnap_ts409_i2c_rtc.irq == 0) pr_warn("qnap_ts409_init: failed to get RTC IRQ\n"); i2c_register_board_info(0, &qnap_ts409_i2c_rtc, 1); + gpiod_add_lookup_table(&ts409_leds_gpio_table); platform_device_register(&ts409_leds); /* register tsx09 specific power-off method */