From patchwork Fri Aug 18 16:54:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13358063 X-Patchwork-Delegate: kieran@bingham.xyz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A93DC71159 for ; Fri, 18 Aug 2023 16:56:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378830AbjHRQzh (ORCPT ); Fri, 18 Aug 2023 12:55:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378842AbjHRQzN (ORCPT ); Fri, 18 Aug 2023 12:55:13 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id AD8FA3A8B for ; Fri, 18 Aug 2023 09:55:09 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.01,183,1684767600"; d="scan'208";a="176985264" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 19 Aug 2023 01:55:05 +0900 Received: from localhost.localdomain (unknown [10.226.93.81]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id B938D4021B55; Sat, 19 Aug 2023 01:55:00 +0900 (JST) From: Biju Das To: Phong LE , Neil Armstrong , Andrzej Hajda , Robert Foss , David Airlie , Daniel Vetter Cc: Biju Das , Laurent Pinchart , Andy Shevchenko , Jonas Karlman , Jernej Skrabec , Paul Cercueil , dri-devel@lists.freedesktop.org, Geert Uytterhoeven , Prabhakar Mahadev Lad , linux-renesas-soc@vger.kernel.org Subject: [PATCH v2 1/2] drm: bridge: it66121: Extend match support for OF tables Date: Fri, 18 Aug 2023 17:54:51 +0100 Message-Id: <20230818165452.320984-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230818165452.320984-1-biju.das.jz@bp.renesas.com> References: <20230818165452.320984-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The driver has OF match table, still it uses ID lookup table for retrieving match data. Currently the driver is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID. The correct approach is to have an OF device ID table using of_device_match_data() if the devices are registered via OF. Fixes: 9a9f4a01bdae ("drm: bridge: it66121: Move VID/PID to new it66121_chip_info structure") Signed-off-by: Biju Das --- v2: * New patch. --- drivers/gpu/drm/bridge/ite-it66121.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c index 466641c77fe9..ba95ad46e259 100644 --- a/drivers/gpu/drm/bridge/ite-it66121.c +++ b/drivers/gpu/drm/bridge/ite-it66121.c @@ -1523,7 +1523,10 @@ static int it66121_probe(struct i2c_client *client) ctx->dev = dev; ctx->client = client; - ctx->info = (const struct it66121_chip_info *) id->driver_data; + if (dev_fwnode(&client->dev)) + ctx->info = of_device_get_match_data(&client->dev); + else + ctx->info = (const struct it66121_chip_info *) id->driver_data; of_property_read_u32(ep, "bus-width", &ctx->bus_width); of_node_put(ep); @@ -1609,13 +1612,6 @@ static void it66121_remove(struct i2c_client *client) mutex_destroy(&ctx->lock); } -static const struct of_device_id it66121_dt_match[] = { - { .compatible = "ite,it66121" }, - { .compatible = "ite,it6610" }, - { } -}; -MODULE_DEVICE_TABLE(of, it66121_dt_match); - static const struct it66121_chip_info it66121_chip_info = { .id = ID_IT66121, .vid = 0x4954, @@ -1628,6 +1624,13 @@ static const struct it66121_chip_info it6610_chip_info = { .pid = 0x0611, }; +static const struct of_device_id it66121_dt_match[] = { + { .compatible = "ite,it66121", &it66121_chip_info }, + { .compatible = "ite,it6610", &it6610_chip_info }, + { } +}; +MODULE_DEVICE_TABLE(of, it66121_dt_match); + static const struct i2c_device_id it66121_id[] = { { "it66121", (kernel_ulong_t) &it66121_chip_info }, { "it6610", (kernel_ulong_t) &it6610_chip_info }, From patchwork Fri Aug 18 16:54:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13358065 X-Patchwork-Delegate: kieran@bingham.xyz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 317B6C7EE2C for ; Fri, 18 Aug 2023 16:56:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378803AbjHRQzf (ORCPT ); Fri, 18 Aug 2023 12:55:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378844AbjHRQzO (ORCPT ); Fri, 18 Aug 2023 12:55:14 -0400 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 455C32D64 for ; Fri, 18 Aug 2023 09:55:12 -0700 (PDT) X-IronPort-AV: E=Sophos;i="6.01,183,1684767600"; d="scan'208";a="176985276" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 19 Aug 2023 01:55:10 +0900 Received: from localhost.localdomain (unknown [10.226.93.81]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 1246B4021B55; Sat, 19 Aug 2023 01:55:05 +0900 (JST) From: Biju Das To: Phong LE , Neil Armstrong , Andrzej Hajda , Robert Foss , David Airlie , Daniel Vetter Cc: Biju Das , Laurent Pinchart , Andy Shevchenko , Jonas Karlman , Jernej Skrabec , Paul Cercueil , dri-devel@lists.freedesktop.org, Geert Uytterhoeven , Prabhakar Mahadev Lad , linux-renesas-soc@vger.kernel.org Subject: [PATCH v2 2/2] drm: bridge: it66121: Simplify probe() Date: Fri, 18 Aug 2023 17:54:52 +0100 Message-Id: <20230818165452.320984-3-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230818165452.320984-1-biju.das.jz@bp.renesas.com> References: <20230818165452.320984-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Simplify probe() by replacing of_device_get_match_data() and ID lookup for retrieving match data by i2c_get_match_data(). Signed-off-by: Biju Das --- v1->v2: * Dropped sentence for dropping local variable as it is integral part of the patch. --- drivers/gpu/drm/bridge/ite-it66121.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/ite-it66121.c b/drivers/gpu/drm/bridge/ite-it66121.c index ba95ad46e259..a80246ef4ffe 100644 --- a/drivers/gpu/drm/bridge/ite-it66121.c +++ b/drivers/gpu/drm/bridge/ite-it66121.c @@ -1501,7 +1501,6 @@ static const char * const it66121_supplies[] = { static int it66121_probe(struct i2c_client *client) { - const struct i2c_device_id *id = i2c_client_get_device_id(client); u32 revision_id, vendor_ids[2] = { 0 }, device_ids[2] = { 0 }; struct device_node *ep; int ret; @@ -1523,10 +1522,7 @@ static int it66121_probe(struct i2c_client *client) ctx->dev = dev; ctx->client = client; - if (dev_fwnode(&client->dev)) - ctx->info = of_device_get_match_data(&client->dev); - else - ctx->info = (const struct it66121_chip_info *) id->driver_data; + ctx->info = i2c_get_match_data(client); of_property_read_u32(ep, "bus-width", &ctx->bus_width); of_node_put(ep);