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.7 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=ham 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 C97EFC433DF for ; Wed, 26 Aug 2020 14:34:35 +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 9796C221E2 for ; Wed, 26 Aug 2020 14:34:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Iz53/s0P"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oZlJx/1H" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9796C221E2 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=rUDBJoyr9p/8u4RCkxmKObjDwYsJP0Ll4xFkC5IWD1Q=; b=Iz53/s0PktqI6GqB7YAzxXXUI4 sUYC9RT+zSWgVhWb+QHeLReG6bCwTVF5SAkPXoDS4njyB8sxf8QR4NkypJsSjj3CxGYRWyE/5Oxrz K0ieYZf8RkaD39gp5Gfy2D/P8Trp2wjGQbKLF9xkX3PCaG91RCTeYyyHWWMmJgsM3N4IbReuPlKHg ev0L0dkcwyJdWMk0zD9h2tpYeiyocNCQOV42x9Jq470UpD2d8WpUB5NjsfIOADoWLoZnBnbjojOUQ Jta/5hkgaAQNffingsKuJzi9+1ovEWvU/udDBv2CfzYstUR+JXrK216tPTt0AoM4YGFMsiFbVZGHd LXqv+B5A==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kAwU2-00068M-DZ; Wed, 26 Aug 2020 14:33:02 +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 1kAwTz-00067m-GR for linux-arm-kernel@lists.infradead.org; Wed, 26 Aug 2020 14:33:00 +0000 Received: by mail-lj1-x242.google.com with SMTP id w14so2632636ljj.4 for ; Wed, 26 Aug 2020 07:32:58 -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=azFUCRCo03L//DQUXteCoV7GDKHHXZryK8m7Qj03z+U=; b=oZlJx/1H3OircmxE18N9ic3XEfJ2mDgl7H3vcbHK1SXYfkxH2mpmR11SbcgKPRoDRw w5/TBk0h88VkYXwJstm9pxHP3QhiAsEFtNFmQOyyqtidng0CTIzePkg9xJ9bXBkVr4mq oKhVFz9saWLOFtpRB4u9cSNI+Hy13x+hDlQmlxSmhTfE1YPxkkPezkjUNkDGgcYnL9UD yM8YRiYbpc1R9b6SNub7tRpQuaIplNe27Tn7A6phC8uekiFhLpWIzP4+fZrVKx2bbEp/ 0ONHYDOrfaWD0RubjbuGOCJdiHSRW1npap9odM0lOcJCVsUtUuisHWoaJWXObmSZOrYm WhgA== 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=azFUCRCo03L//DQUXteCoV7GDKHHXZryK8m7Qj03z+U=; b=NIRi1SaReAtOGisD1z23F/ucpAuGfiROxdtMHQ12XwdqnBhFusO0dBi2IcBMyBdXym vkaDO/tbWPEd5TMLkbhHPMlUnJm+qFn8kgEtEmIr5HaSmdhGT2T60IX+eSSWagCywlPY cM9YLd1A757gZhSbDqI4a79G+LKwaOFtVdR8TQgTFAlf/STcTMI9ELogYOmNNNmvi2aT sBxS6iHMtTfk0aqoi4jYvQGDXTycDfIUzYa/tIOmvfPxkPmqhXeMnCYTFiaMutSQhZYq lvWz+GFPy/FFecrDBCmbjkRH8Tj/qz4S0RodlLlHfHDTdfl5gA0yJSKIDQGiZGO4E4+k Hsug== X-Gm-Message-State: AOAM531erI75mVWZbDWG86MnL0MbVkHK5Fwqwb+ajW31T2oOhqbAY2ZV dbWbltvDgHbtYMyPeSXLMXS7ZM+8iDKpWA== X-Google-Smtp-Source: ABdhPJwHpkshNdXT3E9M6bQwohcXbM4klFkxQZn79+C19GdbMoFxRf/tO+cgIiwq2jHUPjCOiPph8Q== X-Received: by 2002:a2e:9d85:: with SMTP id c5mr6890813ljj.343.1598452377358; Wed, 26 Aug 2020 07:32:57 -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 r13sm547507ljp.12.2020.08.26.07.32.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Aug 2020 07:32:56 -0700 (PDT) From: Linus Walleij To: Sekhar Nori , Bartosz Golaszewski Subject: [PATCH] ARM: davinci: dm644x: Convert LEDs to GPIO descriptor table Date: Wed, 26 Aug 2020 16:30:53 +0200 Message-Id: <20200826143053.123729-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-20200826_103259_650539_DC39A7E0 X-CRM114-Status: GOOD ( 17.29 ) 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 DM644x LEDs to use GPIO descriptor look-ups. Cc: Sekhar Nori Cc: Bartosz Golaszewski Reviewed-by: Bartosz Golaszewski Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Collect Bartosz' review tag - Rebase on v5.9-rc1 - Resend --- arch/arm/mach-davinci/board-dm644x-evm.c | 46 +++++++++++++++--------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index a5d3708fedf6..69f799e8036a 100644 --- a/arch/arm/mach-davinci/board-dm644x-evm.c +++ b/arch/arm/mach-davinci/board-dm644x-evm.c @@ -319,17 +319,14 @@ static struct platform_device rtc_dev = { /* U2 -- LEDs */ static struct gpio_led evm_leds[] = { - { .name = "DS8", .active_low = 1, - .default_trigger = "heartbeat", }, - { .name = "DS7", .active_low = 1, }, - { .name = "DS6", .active_low = 1, }, - { .name = "DS5", .active_low = 1, }, - { .name = "DS4", .active_low = 1, }, - { .name = "DS3", .active_low = 1, }, - { .name = "DS2", .active_low = 1, - .default_trigger = "mmc0", }, - { .name = "DS1", .active_low = 1, - .default_trigger = "disk-activity", }, + { .name = "DS8", .default_trigger = "heartbeat", }, + { .name = "DS7", }, + { .name = "DS6", }, + { .name = "DS5", }, + { .name = "DS4", }, + { .name = "DS3", }, + { .name = "DS2", .default_trigger = "mmc0", }, + { .name = "DS1", .default_trigger = "disk-activity", }, }; static const struct gpio_led_platform_data evm_led_data = { @@ -337,18 +334,35 @@ 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 PCF8574 GPIO expander, which + * is in turn named after the I2C device name. This is + * device "u2" on I2C bus 1 with address 0x38. + */ + GPIO_LOOKUP_IDX("1-0038", 0, NULL, 0, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("1-0038", 1, NULL, 1, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("1-0038", 2, NULL, 2, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("1-0038", 3, NULL, 3, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("1-0038", 4, NULL, 4, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("1-0038", 5, NULL, 5, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("1-0038", 6, NULL, 6, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("1-0038", 7, NULL, 7, GPIO_ACTIVE_LOW), + { }, + }, +}; + static struct platform_device *evm_led_dev; static int evm_led_setup(struct i2c_client *client, int gpio, unsigned 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); /* what an extremely annoying way to be forced to handle * device unregistration ... -- 2.26.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel