From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 816F4C433E3 for ; Mon, 27 Jul 2020 07:17:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4DF3220672 for ; Mon, 27 Jul 2020 07:17:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="f7fcU7p7"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="C/rC9ba1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4DF3220672 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=CT2QC0xFSKNAcSrxpptD03iUH+nZBrkpiKwAp5YRGI8=; b=f7fcU7p7a4fy5qsb8h4tvy8t1z b31xp02HIzNrrUGpAgnlpl2QOHyWo9zVX4Y20/NXGf/G96z9bRWJiEHYxlQ0qeKsk4tgIYxp3fT+P oAAdR+Pc7bz05qeWu5yAsxnoYxGkiDhHuriUhSYzkum83LFU7k777DCl18HqvbVAON6heCSKmZlbk sflvRSuQI+iDaukd3MvccxeJEm6MmPbM81LCcSgco1hx16VbYatHuZafW6IhGvuct0P/CuHff/5a6 3LNtuh2XsVrjdvSc/hHcua+4thU7/aHT7utQaCx/4tJEf3JlQZBGnKvHEFylTTU5+o2nsfdgqSbml UUbqst9w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxMY-0006hs-N4; Mon, 27 Jul 2020 07:15:54 +0000 Received: from mail-lj1-x242.google.com ([2a00:1450:4864:20::242]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzxMW-0006hY-98 for linux-arm-kernel@lists.infradead.org; Mon, 27 Jul 2020 07:15:53 +0000 Received: by mail-lj1-x242.google.com with SMTP id g6so3425537ljn.11 for ; Mon, 27 Jul 2020 00:15:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XJIrh9EiJGeRtz/1m+tZDIG3TBZ/UTGkmOL6pjVAyds=; b=C/rC9ba1a/sRmZTeLyoKFXzGuoQnvCOKgJkjGsTJVGN9kw9k7lmJA6HjXlM8ZCUCxt 4qP9xf9IQKJmmO9a6frztKh7WC7A8qWrXJuvk9pjVN1w0UDy0jHrwPW8zolIg5n2JUCH Z1Lgu8pAIxbsi4zE95U8yjFIbYiayHVokMtopnov3IqmbzdfUM5dgD6LQTUSwetmEezC Rbr0tG2O3pGN72hZ4h0A65ghoui4o+DBUonyuOyCj96RRNBwQoEJUA4SPfWMoulinTuU x+nqMk6HVe6SVfpS31f0invjhubsyV4nW307FJ2lbqstBuVMJu5inEjJ/WshHUAp9OdH sLvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=XJIrh9EiJGeRtz/1m+tZDIG3TBZ/UTGkmOL6pjVAyds=; b=kpre6rP2F32xTcJnOXy+xgk60F0hmrfJ7FnQK1SJv90RRuFzD5B3LjsHj0Y7rbkm+1 IAQzXIx3l0Tr3odRHzg6GTJVOI9wkCuakx3f4Z7WIATUFamSTDHhtTnxSo7GVnFn9ZjC uDE5Q1EFP9pmvfIOi5vcWTk2XICIXuWrhXLVW6Jz5EKKGDtOgGC/lcWUIzIqyeLUsaFB KnY28LDUrpw8jffU3PWf3i7CymrfjduqxQjCzEqhipZ1jPt3rYvb0NhrHkyN4PbHp3lK Ozx8oMnkgk5K3gV1eVvpaMqAv2j5WF5lJQafSqX2pFRspdZOsZCpWlpwApCFGJNcYMjd ifag== X-Gm-Message-State: AOAM530p0qGWV/bglYlrMx1oVq7omU10g6NqB4TKFGY7GBYYLget1dco d4kYvWs3SzGGD2V+JJw1KanqxA== X-Google-Smtp-Source: ABdhPJzb1UWX4tEbhAsxHerYb87cTomzy7vHENlhiksU6kho8lgZZRbcExhT/hSMP56iO/8BFvWfFQ== X-Received: by 2002:a2e:d1a:: with SMTP id 26mr2790806ljn.412.1595834149144; Mon, 27 Jul 2020 00:15:49 -0700 (PDT) Received: from localhost.localdomain (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id w29sm2827673lfq.65.2020.07.27.00.15.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 00:15:48 -0700 (PDT) From: Linus Walleij To: Sekhar Nori , Bartosz Golaszewski Subject: [PATCH] ARM: davinci: dm646x: Convert LEDs to GPIO descriptor table Date: Mon, 27 Jul 2020 09:13:46 +0200 Message-Id: <20200727071346.191668-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200727_031552_627390_A0A1FF62 X-CRM114-Status: GOOD ( 16.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linus Walleij , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This converts the DaVinci DM646x LEDs to use GPIO descriptor look-ups. Cc: Sekhar Nori Cc: Bartosz Golaszewski Signed-off-by: Linus Walleij --- arch/arm/mach-davinci/board-dm646x-evm.c | 33 +++++++++++++++++------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c index 4600b617f9b4..c303828140ac 100644 --- a/arch/arm/mach-davinci/board-dm646x-evm.c +++ b/arch/arm/mach-davinci/board-dm646x-evm.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -203,10 +204,10 @@ static struct i2c_driver dm6467evm_cpld_driver = { /* LEDS */ static struct gpio_led evm_leds[] = { - { .name = "DS1", .active_low = 1, }, - { .name = "DS2", .active_low = 1, }, - { .name = "DS3", .active_low = 1, }, - { .name = "DS4", .active_low = 1, }, + { .name = "DS1" }, + { .name = "DS2" }, + { .name = "DS3" }, + { .name = "DS4" }, }; static const struct gpio_led_platform_data evm_led_data = { @@ -214,18 +215,32 @@ static const struct gpio_led_platform_data evm_led_data = { .leds = evm_leds, }; +static struct gpiod_lookup_table evm_leds_gpio_table = { + .dev_id = "leds-gpio.0", + .table = { + /* + * These GPIOs are on a PCF8574a GPIO expander, which + * is in turn named after the I2C device name. This is + * device "u2" on I2C bus 1 with address 0x38. These + * leds are at offset 4, 5, 6, 7. + */ + GPIO_LOOKUP_IDX("1-0038", 4, NULL, 0, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("1-0038", 5, NULL, 1, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("1-0038", 6, NULL, 2, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("1-0038", 7, NULL, 3, GPIO_ACTIVE_LOW), + { }, + }, +}; + static struct platform_device *evm_led_dev; static int evm_led_setup(struct i2c_client *client, int gpio, unsigned int ngpio, void *c) { - struct gpio_led *leds = evm_leds; int status; - while (ngpio--) { - leds->gpio = gpio++; - leds++; - } + /* Add the lookup table */ + gpiod_add_lookup_table(&evm_leds_gpio_table); evm_led_dev = platform_device_alloc("leds-gpio", 0); platform_device_add_data(evm_led_dev, &evm_led_data, -- 2.26.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel