From patchwork Thu Jul 15 19:11:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 477459 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp599272jao; Thu, 15 Jul 2021 12:38:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSoFhkJelcDHAvRMdNkOOZBtfawityRmbHAxJleJuQM71f/OwdDVPZtG5gpRq07eevIDc6 X-Received: by 2002:a17:906:109d:: with SMTP id u29mr7271112eju.489.1626377933805; Thu, 15 Jul 2021 12:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626377933; cv=none; d=google.com; s=arc-20160816; b=qnbZ3R1Cck38LFWf9XMH/S7Ck4Qg53n12538ZkN8Q3nq0Ow8LlG2TW9GHT2f9nZADM TctiE4BfSVdPXKSbInvdn+KCyyR8Q8dD51OQ2FubeaSlvVlAieY18JXkcN9Sl1zF1M8P cqla3ZiKZn61IttKV08R/dDyzWL/hFjM3DtxkiP0A5iG3wWeCs+1Vzd0Z5A/raN00DHu PIy+PtaCBjg4qC8Te79oAzFqtbR6E3GVtdb9pXAhtpQsuTe2ZvVJ72V+uYcNAqK17GFC bq/+teX4e0BbeLidOgVDENQdNOHg6Q8nKEqs8+HXUDUsJ4hv3+V4TQ8ZgjlmT607GqXt fTvw== 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=Krd0KdIt7AxYBsgDXQUSitBUbG7LJwp8O8UWWfEtBx0=; b=jhos1Jb5Ws5vV59Zs5XraubCKRwl4YqGWGePVMlcf+AO8HDK6W1ujkLtfkMQK6z5KX SryrsV9lArwv1y5DxTKBKHW7iqf5MEyyZx4PiqnfytI7nLr+QIbUAV/Kf3ZyUwfV+/+/ tCl0m9j8Ufazyx0fGhXrepVOW64xeZ3FidD/vEeAS6z3asUbfz23xNXyOPguh37bjOe/ F+KwAdbvPmVt29Y6rizVT6Jv2pUeWjfuQwj8prTJTu0ItyDrsbckFOmq+C+y4aAOWfO2 FODE6IXtuN5Xx912C1hrsqNkwGS9zqakAVJtx9gnE2AUHPzhcfpyNYzRdqc2dNb/5QSr uiPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tD4hrih3; 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 v21si465920edr.99.2021.07.15.12.38.53; Thu, 15 Jul 2021 12:38:53 -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=tD4hrih3; 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 S240272AbhGOTl0 (ORCPT + 3 others); Thu, 15 Jul 2021 15:41:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344927AbhGOTki (ORCPT ); Thu, 15 Jul 2021 15:40:38 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E422C06B6CA for ; Thu, 15 Jul 2021 12:13:47 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id s18so10456171ljg.7 for ; Thu, 15 Jul 2021 12:13:47 -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=Krd0KdIt7AxYBsgDXQUSitBUbG7LJwp8O8UWWfEtBx0=; b=tD4hrih3gnWsKw1piEfQwvBCltU2wmYRMfPG88sSBovSWgsUPIY+s0ZfqKwp8hCSTo vATl+irXD6XGeQ3vAENfyaoy6+YG/xvkTs4drVjJ+uBmCb08i1vCX3U0YBxB9UK4VW5X xvkWsq9w+hMBWiwELgA3BfhcEsRdxn+P7MPaIEO2YuCIzZQ2VlutohiVu8Sfalw9J6jn zDJpxmJ5T2HwOu/QmFgvx98Hh2fdOb0Wz+7qp1W+swFycCSlR6tNc9DotaIztTgPxdg4 xlbvCAYssierKo48g3eD1kto6LeNpfHldvCnMlhK47I5KhpylaCHjl8UxsJpOcT1Gru+ OrLQ== 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=Krd0KdIt7AxYBsgDXQUSitBUbG7LJwp8O8UWWfEtBx0=; b=X545tcokQ3WyGWBz2P2i6Tl/HbkHTmoRyWH0/eeYKhw5mMiBYSOLmDqtsA9ce6dpe/ vbZr4WyvhyJsYYuqOLgogug4hqg+e251bSX2bBm8s9ZkYfO03Z8Q64pI9bDcpYD4P13a P84cM1z8ayU1RTOYy2F3SOAnudOH+ED3t2iN23qe18yyzoKVQzSTLaz9d/F86h9Ny8Ek 4DTDOb76NTQdKrF9y2LIlinh902eTrBUkXkH/hg2fSPJY2SccU4wfLpEoAVp+5rlMGJn 1MS/HOvCCJe5mSegR3Dup5w26c89G76MB+YPBBnuyYhAqdGHNlR9b56aMcffXJ3fIvtj pFbA== X-Gm-Message-State: AOAM531Q/ywVr8/ahC2IOFe/lhREvfwSVe/94/S/5EHlrVUbJnueXCyG O/dh9dfIpf/LAdUFghLf8ekQLg== X-Received: by 2002:a2e:a583:: with SMTP id m3mr5451211ljp.305.1626376424108; Thu, 15 Jul 2021 12:13:44 -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 y22sm472357lfh.154.2021.07.15.12.13.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jul 2021 12:13:43 -0700 (PDT) From: Linus Walleij To: Sekhar Nori , Bartosz Golaszewski Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Linus Walleij Subject: [PATCH 1/3 v6] gpio: pcf857x: Name instance after dev_name() Date: Thu, 15 Jul 2021 21:11:39 +0200 Message-Id: <20210715191141.430307-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->v6: - Rebase on v5.14-rc1 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 Reviewed-by: Bartosz Golaszewski 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 Thu Jul 15 19:11:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 477460 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp602198jao; Thu, 15 Jul 2021 12:43:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdHi0WR4ZyBHLXEVQb7obAomL4WOPsPeJWhjUGakqsqGB8ArTYgLX5ZTACxO6fKzCebsgl X-Received: by 2002:a17:906:109d:: with SMTP id u29mr7285908eju.489.1626378189056; Thu, 15 Jul 2021 12:43:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626378189; cv=none; d=google.com; s=arc-20160816; b=m2JKeBGlEzuTz3fF65cNiDhU8kCXna3BbxZE+jDIBysxpunyRfwMZ1adl5aaUqnFvu FR4hRIqeNunWzLCt0RCP6VMMBcokw5Dmj5T2/G+RtiCgLraW4/3yo91fChfxOgVQsndz Y7KS1B8evoBMN47lfaC3CjbhK+7x5dtYufzOJgmjaH7AHz1Ysrfz4loeV6mLkhmJYytS MI+qAZCt5sgcBDcQPZ6AqOwPzqFsgpR6iR5kGrVhn3py8F3kdYxIDqtl5WSHnQ7LERjR 8uhOYaXa6Zz1YwB7BcaQtvgkZmWXN9Lf0EmfDcPQoZCQHKVI1HupgaVIVbICyn1es1US pNxg== 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=oWls7mbyJzb1bflii+qQmDILfVW35Xk5AptGyFlKE0Q=; b=Ungfzpjb4eU45V6b0nRe7aq0wbCChMH3vdd/qNH8suXzTDlzGPwHCoKnZOH/L4kXLx 2iK2zwnlTki2uli0V7PurwVN3klDi9clfR7Mi5z6W61cVzOTgRTl0pp1H6p3UdrlbQiY iyRJ/5FNgT2X9aR4/YDbifwi6LfgFvUxRswCZ7Zq19d95tIke4BVDEcOkT+ikwLmPQom L659BVPHGN6gEX1aUEX/SaXd6Y6xe6P3/bD3YAwjxQkcRqjWezhWrjRL9+p50kEISLnU xZBojOYzBrBiKyRk6VTSNjmsa7CZTDssIt4ieFazDcrF+Ob9X6OoTRg1HN2Uf7k9146N potg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=abvR9Ijn; 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 v21si465920edr.99.2021.07.15.12.43.08; Thu, 15 Jul 2021 12:43:09 -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=abvR9Ijn; 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 S244756AbhGOTqA (ORCPT + 3 others); Thu, 15 Jul 2021 15:46:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345807AbhGOTpY (ORCPT ); Thu, 15 Jul 2021 15:45:24 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15697C0770E3 for ; Thu, 15 Jul 2021 12:14:47 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id h9so10479524ljm.5 for ; Thu, 15 Jul 2021 12:14:46 -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=oWls7mbyJzb1bflii+qQmDILfVW35Xk5AptGyFlKE0Q=; b=abvR9Ijn6Ebh1QEnsRROW7RW3rBGzcQj3e5kEl2591ZI14KlSiyZTmpOqwR894YQrb /Y+0/OwqW9eb/F3k+8X2fHSFLsWEmw0VUUdGChxMh1Um8rMd7amzgW27j1h/vrd/C2z1 es48kOsYF5nvwNFl1L8N+nX9uzEARrxtjfWZk+gKPt4+OxrdV6s4I/Ni8qSHiGfuv+Wl qRNY0XZPnNzd3tGQhY4wNz8yf0sL6AkmQRJwT49o3WgmckDEpLH3xO5NSCGUF3DOcoft UN3GG+O3dOkcaSgRvmbm8T5nhCqYY4C5Gh9/A0vAxXNI6OfJSB7Lck53VjvI9v5egmCM uY1g== 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=oWls7mbyJzb1bflii+qQmDILfVW35Xk5AptGyFlKE0Q=; b=j8jlIXrEKNkDKg66AH95pJURh6o8286sFRnJewQ9wQqmNjuhOdPs5dgM7UdB6pmvSL /otXoa9759mx2W2LRVU5glziorF803iNwaJw754Q5qasUmlJc+AFJkrHlBlnRcqr2xGK tzGFA9BMrKkiOtGZC5CMjNPC6MAfmptXmJre4mHLvt0X9zbl7oD/wTWTa9uu9BTSRi+B QuKCbS0v+RmpPYZvjhJ02hmQivnYTGtYg4AkQr36QzYjKk2GuUQy0A30v4gv6KSCbn49 n13vj9gNGXbHPkY4ojalIC9IoQvCAtM7CzTbIqI0oVNjGsOB/4UnHaQ8Ew5Tkq2o1GT7 21aw== X-Gm-Message-State: AOAM5318c4ajCM6Huo/BsJfUIVF+m6PZuoKNaKkjySJ3clxW5KyHl4CS 2bfXN8lNVorU2AGgNL7T04ki+Q== X-Received: by 2002:a05:651c:997:: with SMTP id b23mr3397000ljq.219.1626376485437; Thu, 15 Jul 2021 12:14:45 -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 y22sm472357lfh.154.2021.07.15.12.14.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jul 2021 12:14:45 -0700 (PDT) From: Linus Walleij To: Sekhar Nori , Bartosz Golaszewski Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Linus Walleij Subject: [PATCH 2/3 v6] ARM: davinci: dm644x: Convert LEDs to GPIO descriptor table Date: Thu, 15 Jul 2021 21:11:40 +0200 Message-Id: <20210715191141.430307-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210715191141.430307-1-linus.walleij@linaro.org> References: <20210715191141.430307-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 v5->v6: - Rebase on v5.14-rc1 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 Thu Jul 15 19:11:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 477461 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp602210jao; Thu, 15 Jul 2021 12:43:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwW0CMB7ld4ABB35zOn1aMVWMRg1zJ29AUopYM00jQrQeZr0Arjd8BY/m7l4ALIkm9mmcK+ X-Received: by 2002:aa7:db95:: with SMTP id u21mr9299323edt.152.1626378190046; Thu, 15 Jul 2021 12:43:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626378190; cv=none; d=google.com; s=arc-20160816; b=gE34EJIQZ3ZoDMtT64c+TeWlMnZEtC1mKmydzUMzC5ctcgabIsqcp+rZwHazQjwCQv xC9MNnzON1NQRlA67ZzDXYGotwvp05W5qcIzv9VWb2gGBLKfo1i4NTok1MqWIBu6RE9L jVT+rtwjGgWWG3kkeZCQKR3sJxdVugyB5LkV4gaQkmv1RZ+BqriNa/83aF3PvPb9cKQ8 Pgco/xmJLYyWJ+DxnijmCVHwQPFSz917RtNUx+zAA1Xh7DJy3l5JHQnMPJXl/DEg/BA1 povVsnC71nztuG/IvdmknasvIVo23Gtm9FyvbGDkRm1OxsITmxqBJ1flSQmzx00gcZJg uOmQ== 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=QW0aUbvWdjxupRfZicN/X4Nb3halAcxZpcGi/DnPSvg=; b=MmxOryvukAcoonpMAcfBA9JMzjZHBDFxtTWg+kVajRuCBtrlRjE9U5VajUWuiOGMD+ Ocx/OTk25rezpVCzBWEuKvSmEBClCSd+CVc5VtRljTemdtf0O06m7MJ2VDm4kTTC9dC8 JlGOgiEdboqaJd+R+v42/q7dhGjwEzl5/fCwkwcEHWBqTdeiqETupuOmBF7tRU1HU9SM ALSUQzVQUxpPfTi+mcvL1ZbT8o8UrO+vuFtgpq5zQDRNQHADx8yO5b9tcMPqnOYJS0Fy 43OawuhgBmIrac1f7xddurrI6KZ9lyw1Znk1MQunmh5pHzoQLiDqVU9E425W0DRuUP6+ 0mdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k2pGEOm5; 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 v21si465920edr.99.2021.07.15.12.43.09; Thu, 15 Jul 2021 12:43:10 -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=k2pGEOm5; 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 S245459AbhGOTqB (ORCPT + 3 others); Thu, 15 Jul 2021 15:46:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345823AbhGOTp0 (ORCPT ); Thu, 15 Jul 2021 15:45:26 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3A99C0770E5 for ; Thu, 15 Jul 2021 12:14:48 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id b26so11798089lfo.4 for ; Thu, 15 Jul 2021 12:14:48 -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=QW0aUbvWdjxupRfZicN/X4Nb3halAcxZpcGi/DnPSvg=; b=k2pGEOm5ZFBny6IKQmoQQihuFJAq/F9XJz1d3ckRHotg9l8L7PulMWh8sUsj4tPTa9 BdCkJEO8fCafJ8lssepvfYG/O4vAS9O5XyBdIReDFNR5eamWIgOAy4ynHASs98owCe6E z30v/yzw4dkeJcS/5smFh5MU5liFlQgy1McmLqYZAaZCQ4MZi1V7LtI+ql6hYiOCDb0d +LBfr0Vgv/wiFMihRd/NNHuyOVI5swnduZ98fm2JGbY9W9Noyd/S1/ziCxR2gyUKoK0C mlk/ps1WCUMy6Obn1mGTOu9J2Cb9c16hZhD2vJTKEaIegY355bcf/4bQVSrBPWmRP0bC sIOA== 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=QW0aUbvWdjxupRfZicN/X4Nb3halAcxZpcGi/DnPSvg=; b=gkLMXpHK4oHW0Esg2Jw1lcyuY8sFGiVyphhCAkhAqXj5Xj7CVCLHrP7AAxEsEB5aN6 s+Hb/nGxbqKAvMOrV2iWFY/Sm/Iv18D4RNlieU7QcHWEpcI3sIlMJ5EYo7YG+cM234Yu Tea2pEuyJAstq+VAzZajwvEOW15scCNcjX4XrF0xHhzIjVsnFxylA151fGDCLilMkMIO CdpHWaA/A3c8IeAW7AVPDk2UcJOAjOeUASA7nGu4tobeVN0tiY4zC1WRtzek6lY3xBnX 6YRyDpyk5xKJKOXYsiCq7Z9JBwcJ1zJIeIKEEiviptYFzaHcVmRoy6b0oACxFU/hUSYW Gi9Q== X-Gm-Message-State: AOAM532iYTuE3fpqUN4dZTevP2vPvOW6m4y3YoHZM39kr4C2TZAakv1k QfVPLoMdwkiqbuTR3c0c0xXtOiudnDtePA== X-Received: by 2002:ac2:4824:: with SMTP id 4mr4575512lft.553.1626376487202; Thu, 15 Jul 2021 12:14:47 -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 y22sm472357lfh.154.2021.07.15.12.14.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jul 2021 12:14:47 -0700 (PDT) From: Linus Walleij To: Sekhar Nori , Bartosz Golaszewski Cc: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, Linus Walleij Subject: [PATCH 3/3 v6] ARM: davinci: dm646x: Convert LEDs to GPIO descriptor table Date: Thu, 15 Jul 2021 21:11:41 +0200 Message-Id: <20210715191141.430307-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210715191141.430307-1-linus.walleij@linaro.org> References: <20210715191141.430307-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 v5->v6: - Rebase on v5.14-rc1 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, }, {