From patchwork Tue Jun 15 14:59:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 460518 Delivered-To: patch@linaro.org Received: by 2002:a17:907:7409:0:0:0:0 with SMTP id gj9csp3792039ejc; Tue, 15 Jun 2021 08:01:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIxEXSZdvuuRW5NDv7Tuu+0VbUZ9beafcGhkAJIvwm/ZXZl5apqrn4cjhMsXDedSItAwnY X-Received: by 2002:a05:6602:2001:: with SMTP id y1mr18788077iod.181.1623769273220; Tue, 15 Jun 2021 08:01:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623769273; cv=none; d=google.com; s=arc-20160816; b=yRYYR5abYFnLTOukRrCHNw9lBwXSNnCZ1sSXVyrE3fhmXsYXMB5jWw5XIIySI1jDAj liq8w1eZXKGOddG3eq38SIHp2ergbDfJbrfczXWgL2ijgFxSn2XEfwZ7t1XtCljPHJPP qhihAnjXroiv9IH8vXtjRsCzpPX254IeO2Ft8P/S6BhT5rEwDQqAm5VGALMKDROtxPek NtI033rfCc72xYlIyzbTWTLgcUrstdBvSM7QVxYOUhpt9R6ra28sh5uc+tmQ7txKaryf WQWUTQ5X5Y7gWw1ycNYTjlfbMKEH7upb44bFE43F5y1ObdI1u8bZqtwgEG7flVYlRmvF A7mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=yro0N735BUc6Dtw9i+RlBgWclZDebWseV4SlcJC2l0M=; b=ugZ783010FuHtcpFVc6A+KUTgydCan2yxaQViQgyWTfLz0Ua4pwazEv5stG1E4qxoj aM+SsvudVsZEd3ugxT6ZDIglhOjAYsfROZ27Dg+tafIae4VudMOx/aSDj77gZX794G2p Fvzrb593olrNT9P1nTTo/ifJbAJuChIjkYcqnk6tZIZKlCriu3RZivURpHLryLmNN35v fpxeotll4sFqFAt+yik5ukWCJiTZUhomtPgRksP8jlJyT+fvAVhPb3smoyKBRrhsW/rH G9z0J7znQbaH2cnWUUClwMt4T1CoF74llA5G65lDITezwJKq9IEacNzaKci9vECITeAd 3O9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vTX2AUk5; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h2si20136003ile.35.2021.06.15.08.01.12; Tue, 15 Jun 2021 08:01:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vTX2AUk5; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231363AbhFOPDQ (ORCPT + 3 others); Tue, 15 Jun 2021 11:03:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231274AbhFOPDP (ORCPT ); Tue, 15 Jun 2021 11:03:15 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C081C061574 for ; Tue, 15 Jun 2021 08:01:11 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id e25so4335215ljj.1 for ; Tue, 15 Jun 2021 08:01:11 -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=yro0N735BUc6Dtw9i+RlBgWclZDebWseV4SlcJC2l0M=; b=vTX2AUk5GAH7nfJtbSNIU4AvFKLa3ddt70j0MG+kcNmVcXSi8mfupnrL/bcEctkFr9 em98RSfUViNftXMTBj78s2KFVSIwGd4ACzAp6asE1P3e9EBxqA1wknoORL7elitssppJ g1FyOIO3h+djRlpQYJhw/o41SICUGoQAPmVdTBsco9eKxbg2lyY5RXJbve6xb7p81sy9 2Y5fcSMaaoRNexTJQeu//Ik8IsHxuyiXZ05rCM2gMG+8KviPqwWFrGgoAbOiJTy8osp6 XwJlLYESsoZSR2LEVO0Sm2+A7Fto8YmvHHZ0m30VeVTBaBI4t0kYYXWpDhytDDU63pxp evfA== 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=yro0N735BUc6Dtw9i+RlBgWclZDebWseV4SlcJC2l0M=; b=pD3eEC6mMXzOduAJkhANVmnf5qYt+t3H3ZH/hJ4K1t57fIblR9MyQiaMiodOZ68td1 RjndLFDUKywIZ8/fWq+ym8Dnrn0GwM3qOH8OyTa1+QVXW9oSVh9F4afsteecIfnw3P3p UBJUB5iZ4RnSKyszSdv30QefSnJBXL+NI0Bg/le7c0HrnP32B6eaJ71g23JqCu8ABMgH K+gtgdJ+9QVm8bVJ+hxUiud2YYweejVZ+JM2g/yPQo8IjOwpohOtTka5iqnsppijlBTo l7LyvxUugBp44cBVpLrd9o2bcI+wsLqXdrqO7fx8GNNHc5plRO17I59pkblUy+7VGLBr klWQ== X-Gm-Message-State: AOAM533Vp1le/yks46otmvxMouj7OIvUkhrBSSMO2kgym+Aj3n4tW//8 idD2FNA80hz1+MJd9AQGk9V7gCZQIrrAQA== X-Received: by 2002:a2e:b0e8:: with SMTP id h8mr55369ljl.42.1623769267956; Tue, 15 Jun 2021 08:01:07 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id c18sm788914lfd.51.2021.06.15.08.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 08:01:07 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Bartosz Golaszewski , Linus Walleij , Sekhar Nori Subject: [PATCH 1/3 v5] gpio: pcf857x: Name instance after dev_name() Date: Tue, 15 Jun 2021 16:59:01 +0200 Message-Id: <20210615145903.634565-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Put the label on this gpio_chip from the dev_name() instead of the client name. The client name will be pcf8574 etc for all instances even if there are several chips on a system. This manifests on the DaVinci DM6467 (non-devicetree) which will contain 3 different pcf8574 devices that as a result cannot be told apart because they are all named "pcf8574", affecting the GPIO descriptor tables which need a unique label per chip. By passing in .dev_name in the struct i2c_board_info we can explicitly name each instance and use that to discern the chips when using board files. Cc: Sekhar Nori Cc: Bartosz Golaszewski Signed-off-by: Linus Walleij --- ChangeLog ->v5: - New patch to deal with the chip label --- drivers/gpio/gpio-pcf857x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.31.1 diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c index b7568ee33696..2271ec86e414 100644 --- a/drivers/gpio/gpio-pcf857x.c +++ b/drivers/gpio/gpio-pcf857x.c @@ -311,7 +311,7 @@ static int pcf857x_probe(struct i2c_client *client, if (status < 0) goto fail; - gpio->chip.label = client->name; + gpio->chip.label = dev_name(&client->dev); gpio->client = client; i2c_set_clientdata(client, gpio); From patchwork Tue Jun 15 14:59:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 460520 Delivered-To: patch@linaro.org Received: by 2002:a17:907:7409:0:0:0:0 with SMTP id gj9csp3792096ejc; Tue, 15 Jun 2021 08:01:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzaDdP0uxJY+ouh0vw7Ylbjv6TMdF9kMc+39FQQZGaCmX8S0AoRqDo7lcCg3Gejq6G7ynOx X-Received: by 2002:a6b:3119:: with SMTP id j25mr18185911ioa.64.1623769277137; Tue, 15 Jun 2021 08:01:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623769277; cv=none; d=google.com; s=arc-20160816; b=jF8zJp3TGBl9SuotUWvUCPKOOznlmIAa8zIQH1rCTS4yPCm8aCWXN9K/If7rheSDqc h4UThheDJgtG9R81fGnVLRqAADZ3LSdlRrPkCXPn+OfMmLqkMlXyA94Mcdbhe92BOf4G FZ8W0ohjk6d9ie8BuBQAqhYpB++bw46+AGrknB34CcLPF7nyg3z3AS0q+Zz6xvtyq0fT I2I1fd1lLnDuFVKOtj6YaVfjLGHQQ1vHRxUITk2ckvKHYmIpPncIkWKXF0PUtXYS2ip4 Bz2CJoOO2OnYJuYbGiCpZZPmGaikHbqvz3l6osBNHexsEMiItBpuOk1hblxNcyA3aIhz DUeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KF/2w4HZSLGOH7BsrQUO66ZMjH16Q/Js+us1lOAxipQ=; b=DbbJ/HpIcz67y2zvM/wxWey51mQ/slmJXT42o2hMrX2OPPEewiDLmC9ldIJAq7Rer8 XPbcvuDFhVdo3iBH14PJCjZgHsRIBwHH0RJd3yeaiwKJUGjy7wa6chQt8BGjMf01r+g4 WjAkidg2lGn6ZBA5OiAaI78J8bgXREtVS1r2J99RRTBTzbMqp3puEeoGlkmcIB02OdG/ ODVctQLhb3yZrzLhtKdLayeNsidwZ9TAhtld5QC/fwJ1gO5PgfSIkpVFyW8iPK/tV55m IP30MLWC4nywf9QUSmXhZeqItNt+1BsQtCgR0m4NlgSPzzBD7HTWd6a+JsaV4j916fFx R5Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=utbK8gyU; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h2si20136003ile.35.2021.06.15.08.01.15; Tue, 15 Jun 2021 08:01:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=utbK8gyU; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230314AbhFOPDS (ORCPT + 3 others); Tue, 15 Jun 2021 11:03:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231389AbhFOPDS (ORCPT ); Tue, 15 Jun 2021 11:03:18 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6275C061574 for ; Tue, 15 Jun 2021 08:01:13 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id 131so25538344ljj.3 for ; Tue, 15 Jun 2021 08:01:13 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=KF/2w4HZSLGOH7BsrQUO66ZMjH16Q/Js+us1lOAxipQ=; b=utbK8gyUkFiP3Gj/BH6Qa+u5FsYw16VP3ktK445yFHJ/UCj8YlupB4mTNG8yCEIOpf Km6XILd1HhXGbMz/RfSar1XUDUPaadrtEZB1bvMQKpwcH5h5FPw25gzs9U+09ymJRS8D zt8WWNgP8irWAbtuXmicF7zyS5kRTfDUVWnxHPdCO99QwWoPee/KbsCS1renS6F39s4O HzkA0/4R95gDF03oyJjKcn5qrJ7BfXjOdHwEmLF5642eMYQAfSL+x/10UaP1iLD61SPy ylzp1UJAPO2pVyh8P/SIhhMlB2yOcRBndUJ3N9ZP5vsflZQKGtMO/gIGgC9jfMbLWnDZ U3cQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=KF/2w4HZSLGOH7BsrQUO66ZMjH16Q/Js+us1lOAxipQ=; b=sd22RbM5p4dTMrijNiTQyaXWOQ25STi9Zen33yihfi2UkAcEdab1aN4C0z4yI6eBlT A2LJZbiSKUeEEHvzhfDY2viUU1x5xc1nQ93SQfT+RX/zndi0J8W+XnmzZ+DX65PGUmpi nN3lEy4hX5zGNy4rK5GwYOlSRmsioWsafVKeTV+JjWqBki7cZ9QMTtdXlO56zR2g/m9u du6rBYI/jUo/foC+YGFTAmIh0ZR9uKHefgb1HcHcoA0pbRgO76HTLOYEgiLxh+cC2mg6 1As4nEod3JOfPVVXc81AaT7zg/Q+LyQxOECd5wv5QQTMlrdQXmoq+BSbhhxjmxeD2QBR qpyQ== X-Gm-Message-State: AOAM533Pr/TORxnCI5JSC73jDCvy6W70yI7x8apiX2lK65lT4Sva33xL SQK0qDkAby0Pg9B8ml/Xhf/b2IrSu7lqAQ== X-Received: by 2002:a2e:9901:: with SMTP id v1mr14162lji.205.1623769270590; Tue, 15 Jun 2021 08:01:10 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id c18sm788914lfd.51.2021.06.15.08.01.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 08:01:10 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Bartosz Golaszewski , Linus Walleij , Sekhar Nori Subject: [PATCH 2/3 v5] ARM: davinci: dm644x: Convert LEDs to GPIO descriptor table Date: Tue, 15 Jun 2021 16:59:02 +0200 Message-Id: <20210615145903.634565-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210615145903.634565-1-linus.walleij@linaro.org> References: <20210615145903.634565-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.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 v4->v5: - Name each I2C expander instance explicitly as "u2" etc. - Tie the LEDs to the generated "i2c-u2" device name. ChangeLog v3->v4: - Rebase on v5.13-rc1 - Resend - LED maintainers: please apply this patch, it is ACKed by a DaVinci maintainer ChangeLog v2->v3: - Rebase on v5.10-rc1 - Resend ChangeLog v1->v2: - Collect Bartosz' review tag - Rebase on v5.9-rc1 - Resend --- arch/arm/mach-davinci/board-dm644x-evm.c | 49 ++++++++++++++++-------- 1 file changed, 33 insertions(+), 16 deletions(-) -- 2.31.1 diff --git a/arch/arm/mach-davinci/board-dm644x-evm.c b/arch/arm/mach-davinci/board-dm644x-evm.c index cce3a621eb20..36d8eea7a342 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("i2c-u2", 0, NULL, 0, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("i2c-u2", 1, NULL, 1, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("i2c-u2", 2, NULL, 2, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("i2c-u2", 3, NULL, 3, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("i2c-u2", 4, NULL, 4, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("i2c-u2", 5, NULL, 5, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("i2c-u2", 6, NULL, 6, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("i2c-u2", 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 ... @@ -639,14 +653,17 @@ static struct i2c_board_info __initdata i2c_info[] = { }, { I2C_BOARD_INFO("pcf8574", 0x38), + .dev_name = "u2", .platform_data = &pcf_data_u2, }, { I2C_BOARD_INFO("pcf8574", 0x39), + .dev_name = "u18", .platform_data = &pcf_data_u18, }, { I2C_BOARD_INFO("pcf8574", 0x3a), + .dev_name = "u35", .platform_data = &pcf_data_u35, }, { From patchwork Tue Jun 15 14:59:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 460519 Delivered-To: patch@linaro.org Received: by 2002:a17:907:7409:0:0:0:0 with SMTP id gj9csp3792105ejc; Tue, 15 Jun 2021 08:01:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcsZ1NmGX77QU0NbV6/hCZKA2/NZ/c9Q1is49GkHQ0Lv+EuyHndnfJWj12MXHcrZrjJB5T X-Received: by 2002:a05:6638:1382:: with SMTP id w2mr21947618jad.36.1623769277471; Tue, 15 Jun 2021 08:01:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623769277; cv=none; d=google.com; s=arc-20160816; b=fgTasONhdGg/pAJT8G669nXAAK4yC+LNkaH7iAuvZZyuYgfWJhT4bSqg6tI1kcz9Xl p7nWnQuEjI9H4wnCEgLGzgLYoS8ZEVvhJRMBbuQyYeviOloKYJm4z+W6vncA0aHSgu/P IuTDioiBDKuazUhNPaMCTx8LVf+MhoZOKTYdUOlRW0sA53kBaumMmksTmGgT00upEq9F cZoRZW3W3mzyx7N7qTguK64LEn8ZucUMdyNe6qmL3MOXwOKxycMzE/3txfRViUXCvmv+ 8tSk92qAG3YbWwXj4Wupd+iWfY0m+TSHJCfWBEF/l67qfIdy3jr44ckVlP741UV0K8a6 gX8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=cJ3E6xz1GtHO5ssuzNBSjmKl0fJUbXbXi3ZsWAUHOk0=; b=t/dNHnG0/QVg4DS+JdcAbxJo1YFAjnlsTd8OWDyl/io2GoQJQVCEAFIiN2wlR2QeIx QKlPUlBl/5DdAmKtAx6BhZzqOt4homXnLANqgnkf791bOY4KSzCCBjUuYGnt20HXjAQa m3aRZGHPsZ9i54CAsm6nhZK9e2Bx4i0r8S599nm/RRbTZMf+MTDUtCEfP3LqgBq/CtPs v+tO+coX6cZyOBnJcJkBLQ/9mssgW3gkGj8AXwX/RNUs6jYURKaeynnRDbSGoNiumt5D /SFUnkJSZp0bk91e5FPPTUx+I9SR/79s8RNoCCk7GJiDncZSPEr+rXbTlQNkdJBdDxxP hS1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TFRBCQYr; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h2si20136003ile.35.2021.06.15.08.01.17; Tue, 15 Jun 2021 08:01:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TFRBCQYr; spf=pass (google.com: domain of linux-gpio-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-gpio-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231398AbhFOPDU (ORCPT + 3 others); Tue, 15 Jun 2021 11:03:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231389AbhFOPDU (ORCPT ); Tue, 15 Jun 2021 11:03:20 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23EC1C061574 for ; Tue, 15 Jun 2021 08:01:15 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id r16so25458715ljk.9 for ; Tue, 15 Jun 2021 08:01:15 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=cJ3E6xz1GtHO5ssuzNBSjmKl0fJUbXbXi3ZsWAUHOk0=; b=TFRBCQYrClIJos2Bez2gAp3xfty8ROT++L/cj0GEl8zFVd+2qXYMW7MfEZ/RTbX7X8 ynUk6KnsxaSZw5zfVWP3sUUhIZCZrvW5Xt0COoAYvroRAguETHaqzYTr0EQoThdS3GIG SiUlQUttAOtFnJg/xAvQakrJwfbfne+bnc5/cJlLv3lFMKoKcPfnn4ImvFHcyWEYAkbA 6v9alzB6m3Uh4Alsnch1S/Ko9Ky0kP3xetjSQ1IYVO6LdzntNaVEkDE2NgiMVO5tOd3A dVDRFHQDM4BjaWVfU17GsNejkj/SfPKxvQFgLHL481P+Cez2Xoty6K7uU4Omd+glDS7t hwpw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=cJ3E6xz1GtHO5ssuzNBSjmKl0fJUbXbXi3ZsWAUHOk0=; b=UatUqXlAqJYup+IHp5QuBrtJdsTzTDOnkw1C1ex0ZAGtEwdcng9n9+ATnsbyiwDkWI V/9HeYtFHojFjHRsliRIX6JptbGPVrxxIVEcabAQBZCZpkF3seE54WlTfIh9gy0YziJe 72J/0owMF375D4f/LcWvVbVv0BOUaLKJ+6u5V/Tvt2K6uiySpQpRZo9RiaQ3gBDcwdIv UvP3wtmfGerh6+GihFkXUedSZZyok3VeXSsPbnNFd2uoFIyxUXr6KZU5za6wI8BkLWdb y96y0huVO1KMTMmkWxQaaZrlsJByFounbcPQYmtOByMP+vWEt8lKU21KgIMkMUjMa8vQ BQ4A== X-Gm-Message-State: AOAM5310PW9KLgJ7gB1udYKlHuS23gu1/dsPKoiv1DZg+R1vzUNavMcP n7A75LCrV8gK7bzK0hSXAwRL4qKCppXKZg== X-Received: by 2002:a2e:89d9:: with SMTP id c25mr22628ljk.63.1623769271832; Tue, 15 Jun 2021 08:01:11 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id c18sm788914lfd.51.2021.06.15.08.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jun 2021 08:01:11 -0700 (PDT) From: Linus Walleij To: linux-gpio@vger.kernel.org Cc: Bartosz Golaszewski , Linus Walleij , Sekhar Nori Subject: [PATCH 3/3 v5] ARM: davinci: dm646x: Convert LEDs to GPIO descriptor table Date: Tue, 15 Jun 2021 16:59:03 +0200 Message-Id: <20210615145903.634565-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210615145903.634565-1-linus.walleij@linaro.org> References: <20210615145903.634565-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This converts the DaVinci DM646x LEDs to use GPIO descriptor look-ups. Cc: Sekhar Nori Cc: Bartosz Golaszewski Reviewed-by: Bartosz Golaszewski Signed-off-by: Linus Walleij --- ChangeLog v4->v5: - Name each I2C expander instance explicitly as "u2" etc. - Tie the LEDs to the generated "i2c-u2" device name. ChangeLog v3->v4: - Rebase on v5.13-rc1 - Resend - LED maintainers: please apply this patch, it is ACKed by a DaVinci maintainer ChangeLog v2->v3: - Rebase on v5.10-rc1 - Resend ChangeLog v1->v2: - Collect Bartosz' review tag - Rebase on v5.9-rc1 - Resend --- arch/arm/mach-davinci/board-dm646x-evm.c | 34 +++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) -- 2.31.1 diff --git a/arch/arm/mach-davinci/board-dm646x-evm.c b/arch/arm/mach-davinci/board-dm646x-evm.c index ee91d81ebbfd..00c074fddce6 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 @@ -202,10 +203,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 = { @@ -213,18 +214,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("i2c-u2", 4, NULL, 0, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("i2c-u2", 5, NULL, 1, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("i2c-u2", 6, NULL, 2, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("i2c-u2", 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, @@ -438,6 +453,7 @@ static struct i2c_board_info __initdata i2c_info[] = { }, { I2C_BOARD_INFO("pcf8574a", 0x38), + .dev_name = "u2", .platform_data = &pcf_data, }, {