From patchwork Tue Apr 23 13:53:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 13640131 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 A87E8C4345F for ; Tue, 23 Apr 2024 13:54:44 +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=V/r/zwd3JQ2iNeLira8G9aH1sDCHdLSuzJGC3BSIl9Y=; b=djicAVL1SVJ6j3 2lhQjNgb45l2/0c5TD4GObKBHaepWCRKoKYnWD/Mk5GZEWzSIV+g3S/7WQ3xiEieBS6cW+vr4kDOO VMSC5c4LDSygW2gh55nKE5GIveGnrx74F8Zxb+dBNl0AoY3d4zB/Craq3rsAJrqONpLOncM/yy2s4 /3QkiLZA5dX9C0y4zk+ev6b8KTWNdtjmntZ4wR6iPuIP+hbN/cbJVWhozXmjC7g5BMoGZBN2OitVO NLMoL91h6myJ4X5Djr72XmatQmOx4IsWxBJUjQAxAILPxjNI0hVzIa//6/7u9hZTD0ueC2BEoUaiF Hrl+c8AWL3F43lFWuhEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzGbR-00000000AlE-3IxM; Tue, 23 Apr 2024 13:54:33 +0000 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzGay-00000000Ab3-1f2l for linux-arm-kernel@lists.infradead.org; Tue, 23 Apr 2024 13:54:06 +0000 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-5196c755e82so8005018e87.0 for ; Tue, 23 Apr 2024 06:54:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1713880441; x=1714485241; 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=bED1J92t6L8xqCCoMd53N6tL4C0DTI8s9irWtXqiNYc=; b=ELJjc9DnZ7LjxX7zTHkClaeOF4Hv5DW2hYBloqsuuLrtolGS40WUoGwWU7DIpjCNs1 FCSVBS2BOJVkALXQhHyzy1CS5WK/OW/zwOUImWtg52LC/nLXD4ugODQ/6rIYDcgNIjUD OulaIs77PTHMQjXeXeQpjkHMfH/Lk0mX9ThVx4FJ6/P3pFZNTgAFgx6ymh8KIcHIfZYU bJ0GNLjADMuGYBIOP8uEpLLWDcxv973wxBI9v7AW9P2d/ddwzgNKssAZAo6+M1ittQ+d 1Jj9HCXwPun92/po0dBmh60E7DkG27KUDqZlPJvOHCRN3TmTnNvKproPg/wr+hJU9OnU IXhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713880441; x=1714485241; 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=bED1J92t6L8xqCCoMd53N6tL4C0DTI8s9irWtXqiNYc=; b=nc9ay0Bzy2WhNkpxV8Rkb3FRNFKjZd7KU8bcHlgn/YH0TWh6jjDhuu1unoK1yhDpo1 TEc2zxk0VitSNlXT18r+vHv/cpF9ohvAMgn2F6NEjOtCeTe+lyrk1HlBZDAS2WFJNc45 eROt88skP8W/vtKwZRZ6pLPqpJylQB8zc8PZyZ8vYyf+4cw7BrLLpRr7yI6yy5YEp/Zx WkolRPpCPKbIHAWrz0tTGJVWjjC9XPtRv6vchfJSdbipEoOcvnzd46Oa9aGAe8S5oNAR IgM+FNIi+fZZoJVe/7mRrTy/LJm5dc/lyQjRbVv5vFfOjrLV2pIWbI/G69UnyGkVCw38 BMSQ== X-Gm-Message-State: AOJu0YxtfUCorMlA1Ay9Eoofx/LXM7E3ZUr7Bja4p020nounWUJh5dne K7kR9s8JCZOR5scLeDSLXQWBYrnlRWwuzWcEDxXRTfH2F5mWlNw5oy+Xs2Gik0s= X-Google-Smtp-Source: AGHT+IHyO0PxjAJE6IewIDC+ePQ55Uzrd20ljTDYwFM1JodsG0AkTrhFmiNM3dMdYb8EV3ngM6wXpA== X-Received: by 2002:a05:6512:4d0:b0:516:c7c2:23b6 with SMTP id w16-20020a05651204d000b00516c7c223b6mr7594408lfq.9.1713880441502; Tue, 23 Apr 2024 06:54:01 -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.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 06:54:01 -0700 (PDT) From: Linus Walleij Date: Tue, 23 Apr 2024 15:53:59 +0200 Subject: [PATCH 3/5] ARM: orion5x: Convert MV2120 board to GPIO descriptors for LEDs MIME-Version: 1.0 Message-Id: <20240423-gpio-leds-v1-3-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_065404_608595_738A4968 X-CRM114-Status: GOOD ( 14.03 ) 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 MV2120 Orion5x board use GPIO descriptors instead of hardcoded GPIOs from the global numberspace. Signed-off-by: Linus Walleij --- arch/arm/mach-orion5x/mv2120-setup.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-orion5x/mv2120-setup.c b/arch/arm/mach-orion5x/mv2120-setup.c index 2bf8ec75e908..b7327a612835 100644 --- a/arch/arm/mach-orion5x/mv2120-setup.c +++ b/arch/arm/mach-orion5x/mv2120-setup.c @@ -8,6 +8,7 @@ * License, or (at your option) any later version. */ #include +#include #include #include #include @@ -139,34 +140,45 @@ static struct i2c_board_info __initdata mv2120_i2c_rtc = { static struct gpio_led mv2120_led_pins[] = { { .name = "mv2120:blue:health", - .gpio = 0, }, { .name = "mv2120:red:health", - .gpio = 1, }, { .name = "mv2120:led:bright", - .gpio = 4, .default_trigger = "default-on", }, { .name = "mv2120:led:dimmed", - .gpio = 5, }, { .name = "mv2120:red:sata0", - .gpio = 8, - .active_low = 1, }, { .name = "mv2120:red:sata1", - .gpio = 9, - .active_low = 1, }, }; +static struct gpiod_lookup_table mv2120_leds_gpio_table = { + .dev_id = "leds-gpio", + .table = { + GPIO_LOOKUP_IDX("orion_gpio0", 0, NULL, + 0, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("orion_gpio0", 1, NULL, + 1, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("orion_gpio0", 4, NULL, + 2, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("orion_gpio0", 5, NULL, + 3, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("orion_gpio0", 8, NULL, + 4, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("orion_gpio0", 9, NULL, + 5, GPIO_ACTIVE_LOW), + { }, + }, +}; + static struct gpio_led_platform_data mv2120_led_data = { .leds = mv2120_led_pins, .num_leds = ARRAY_SIZE(mv2120_led_pins), @@ -219,6 +231,7 @@ static void __init mv2120_init(void) gpio_free(MV2120_GPIO_RTC_IRQ); } i2c_register_board_info(0, &mv2120_i2c_rtc, 1); + gpiod_add_lookup_table(&mv2120_leds_gpio_table); platform_device_register(&mv2120_leds); /* register mv2120 specific power-off method */