From nobody Wed Oct 8 15:53:33 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1821D21CA0E for ; Thu, 26 Jun 2025 10:05:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750932312; cv=none; b=kRw4ZAMv/eJDtXUf0r6toDkvX6HTL/7n2w4/pokRH+QlQcqnG0LdS+9urCoVc2SuNr1RdjD3GRNGAmv+pxDUeMMqkAEIY9KFQ387HIqgS/VD8kOpfWZJ9PLis6gblGLjz3hnJ43604g9kGF+/ER6Jf/vNR0lSLYBW9/N+/75ysQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750932312; c=relaxed/simple; bh=3k4h3hHEk7NoxoOrxbmYWfStsX8RNDzQCxVAQ8vhmp4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DSsIGJb44Pbf/+hc55v4nciZH72Kf7aNPa6a8OzrqpmM/Pd98n1qTFF+PCFvAy26jMCid+fvP/ggDZJTxO16rWYeFnLvTT/2N1qbuhzgC77XsrmUBlPg+7/nfZLnqO2kN64E8nQ4QVq5fi/POb54OV3yxNHogRlfpId0vpkcEwA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=l2GmHgjn; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="l2GmHgjn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93A81C4CEEF; Thu, 26 Jun 2025 10:05:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750932311; bh=3k4h3hHEk7NoxoOrxbmYWfStsX8RNDzQCxVAQ8vhmp4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=l2GmHgjnAsJeXxSAfGAU6kLeVg9VNE7t4zaaxjBpQh7L4YbnwXYPSCXXCtuhCPba6 i7ys+XBB/zN4hpe+Q/4O47xHVsC0viNL2iPaVMOM4H76x5vFaKQnWUWKgxEaVWTEye dP0CdnIzCs4GJBROUdYqJAJkQPWJFZRfkdfTEcP2Lzc5KyJbKPigYqzys+wrhOcGog qAFDN0bSR+ryZ51U11qMrSoPdcqgNyLGhHswT8LO+vHq0E4DpyaCudc6nx9oTtJJnA xa68nMlIaJPZN0GUFPNdM3OLb4hP7KTQRpMBwW4gMs08SvPKG5jgdKjzJUyIOw7eS0 xxHn3pX+U5AzQ== From: Maxime Ripard Date: Thu, 26 Jun 2025 12:04:59 +0200 Subject: [PATCH v2 1/5] drm/mipi-dsi: Add dev_is_mipi_dsi function Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250626-drm-panel-simple-fixes-v2-1-5afcaa608bdc@kernel.org> References: <20250626-drm-panel-simple-fixes-v2-0-5afcaa608bdc@kernel.org> In-Reply-To: <20250626-drm-panel-simple-fixes-v2-0-5afcaa608bdc@kernel.org> To: Neil Armstrong , Jessica Zhang , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Luca Ceresoli , Anusha Srivatsa , Francesco Dolcini Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2020; i=mripard@kernel.org; h=from:subject:message-id; bh=3k4h3hHEk7NoxoOrxbmYWfStsX8RNDzQCxVAQ8vhmp4=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDBmx0gHZ6o8/Je6+fHa2yrtogwvnrhzKfL07aUf7iY9/z s5e+/vhj46pLAzCnAyyYoosT2TCTi9vX1zlYL/yB8wcViaQIQxcnAIwkfIQxvqMTReXn9SQ8LAW 3MhdWLXFVvT+WgbP5Adqlz/v/9tZ+vFSeIsLT+T3lCaHSmXLx0VruBgbOnb4f/KvznzL//gVz97 2yRkvfh0LuiwqL8K57UKNg1azSVK4klSNurbwlycNUtz334QDAA== X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D This will be especially useful for generic panels (like panel-simple) which can take different code path depending on if they are MIPI-DSI devices or platform devices. Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas Tested-by: Francesco Dolcini # Toradex Coli= bri iMX6 --- drivers/gpu/drm/drm_mipi_dsi.c | 3 ++- include/drm/drm_mipi_dsi.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c index e5184a0c24651756ee0b1eb27d94083d63eb35a7..21fd647f8ce1a6a862e2f8fb532= 0e701f26f614f 100644 --- a/drivers/gpu/drm/drm_mipi_dsi.c +++ b/drivers/gpu/drm/drm_mipi_dsi.c @@ -89,16 +89,17 @@ static const struct dev_pm_ops mipi_dsi_device_pm_ops = =3D { .thaw =3D pm_generic_thaw, .poweroff =3D pm_generic_poweroff, .restore =3D pm_generic_restore, }; =20 -static const struct bus_type mipi_dsi_bus_type =3D { +const struct bus_type mipi_dsi_bus_type =3D { .name =3D "mipi-dsi", .match =3D mipi_dsi_device_match, .uevent =3D mipi_dsi_uevent, .pm =3D &mipi_dsi_device_pm_ops, }; +EXPORT_SYMBOL_GPL(mipi_dsi_bus_type); =20 /** * of_find_mipi_dsi_device_by_node() - find the MIPI DSI device matching a * device tree node * @np: device tree node diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index b37860f4a895c25ef8ba1c5b3f44827ef53aa100..6d2c08e8110151a97620389197f= 1ef79c058329d 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -221,10 +221,13 @@ struct mipi_dsi_multi_context { =20 #define MIPI_DSI_MODULE_PREFIX "mipi-dsi:" =20 #define to_mipi_dsi_device(__dev) container_of_const(__dev, struct mipi_ds= i_device, dev) =20 +extern const struct bus_type mipi_dsi_bus_type; +#define dev_is_mipi_dsi(dev) ((dev)->bus =3D=3D &mipi_dsi_bus_type) + /** * mipi_dsi_pixel_format_to_bpp - obtain the number of bits per pixel for = any * given pixel format defined by the MIPI D= SI * specification * @fmt: MIPI DSI pixel format --=20 2.49.0 From nobody Wed Oct 8 15:53:33 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E263D221FB2 for ; Thu, 26 Jun 2025 10:05:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750932315; cv=none; b=upBVTUucVYRG/LjNySHFHv1E9qZ/v2Iunhi95mOXZnwNFrmZipQWfqDHDJGWMDiPaBvVO1EI1QvqVthDtMJbmH73u4+1eR2Nc9+DAcybojG3o134ePPo+f3ur+IXJZKt821s/BYROxNY+Z7Gx7espA9lJbvVunz01LqkzA9nGt4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750932315; c=relaxed/simple; bh=I0Wn0v0oJ34lZSaquWxq7quZ9zp2CkhUtsLyYrYJvuQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZdDuviGoqRGtFHX9c2BqsHOickOzhiRTDhUkjvvuzGb7YOxX7OP0qPGEAA/as2LJpEohTVH8aaA6YVRO21iyTXCwuVTJ0Pr+UelufSjJF67OynJfn6/79nnqkxZ2S2sH0PL+lPsecqdxbKNJdJViSDGDluG1+AiaJnfFcNlAz2g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rCZcRh8p; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rCZcRh8p" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FE79C4CEEE; Thu, 26 Jun 2025 10:05:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750932314; bh=I0Wn0v0oJ34lZSaquWxq7quZ9zp2CkhUtsLyYrYJvuQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=rCZcRh8pdYPUUj21mdLOejy1OaEe2xTSf8FD5SYN3cNtxJe30EkeEGzyZrV2YJjjV UkA7kdUulfbFocNm6PYg0inAowfWM7238iDceto7Y4e6jWaX4RA7UzS9w3yW8/oU+x BUUHHAmbutv6Q9zm2+fiMYkviRICI/VA9jFeKi7zls+U7q7+nQplht7Byficl8W3y3 E5hEdDYCsr6GXef+vxPogBilVh1Li4EqE9EZCPkIUmrVoHMVUyhG3kPWd1BcKXo4rd Unoiq7Fpb845YoGYZmWybNtoJPXN14HCPsH+VEKmaut8SDXGNO/xAkhrOv6qhe8JiN ufdlSMxLbX38A== From: Maxime Ripard Date: Thu, 26 Jun 2025 12:05:00 +0200 Subject: [PATCH v2 2/5] drm/panel: panel-simple: make panel_dpi_probe return a panel_desc Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250626-drm-panel-simple-fixes-v2-2-5afcaa608bdc@kernel.org> References: <20250626-drm-panel-simple-fixes-v2-0-5afcaa608bdc@kernel.org> In-Reply-To: <20250626-drm-panel-simple-fixes-v2-0-5afcaa608bdc@kernel.org> To: Neil Armstrong , Jessica Zhang , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Luca Ceresoli , Anusha Srivatsa , Francesco Dolcini Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3848; i=mripard@kernel.org; h=from:subject:message-id; bh=I0Wn0v0oJ34lZSaquWxq7quZ9zp2CkhUtsLyYrYJvuQ=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDBmx0gHxty7bMOUVOtoyrzh4L4lf7AfX8dfTmYwL5uUah T+dlOjSMZWFQZiTQVZMkeWJTNjp5e2LqxzsV/6AmcPKBDKEgYtTACZSbMVYH557eK9F68KJzR+r VZMe/PC3WL+s8lKzwY/pChqstllLOh/qJMxTEpvA/L0j2MahXjCNsT7iwPMVwS1fdY9wfrjwkz3 kzT6LnB1qk6Pvfa5+f3TRO8l1bS+En0+4foLpy9IbPp5+q7sB X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D If the panel-simple driver is probed from a panel-dpi compatible, the driver will use an empty panel_desc structure as a descriminant. It will then allocate and fill another panel_desc as part of its probe. However, that allocation needs to happen after the panel_simple structure has been allocated, since panel_dpi_probe(), the function doing the panel_desc allocation and initialization, takes a panel_simple pointer as an argument. This pointer is used to fill the panel_simple->desc pointer that is still initialized with the empty panel_desc when panel_dpi_probe() is called. Since commit de04bb0089a9 ("drm/panel/panel-simple: Use the new allocation in place of devm_kzalloc()"), we will need the panel connector type found in panel_desc to allocate panel_simple. This creates a circular dependency where we need panel_desc to create panel_simple, and need panel_simple to create panel_desc. Let's break that dependency by making panel_dpi_probe simply return the panel_desc it initialized and move the panel_simple->desc assignment to the caller. This will not fix the breaking commit entirely, but will move us towards the right direction. Fixes: de04bb0089a9 ("drm/panel/panel-simple: Use the new allocation in pla= ce of devm_kzalloc()") Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas Tested-by: Francesco Dolcini # Toradex Coli= bri iMX6 --- drivers/gpu/drm/panel/panel-simple.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/p= anel-simple.c index 0a3b26bb4d731c54614e24e38018c308acd5367a..89188e683822f9202ec580c9a29= 4e42083b9704a 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -430,12 +430,11 @@ static const struct drm_panel_funcs panel_simple_func= s =3D { .get_timings =3D panel_simple_get_timings, }; =20 static struct panel_desc panel_dpi; =20 -static int panel_dpi_probe(struct device *dev, - struct panel_simple *panel) +static struct panel_desc *panel_dpi_probe(struct device *dev) { struct display_timing *timing; const struct device_node *np; struct panel_desc *desc; unsigned int bus_flags; @@ -443,21 +442,21 @@ static int panel_dpi_probe(struct device *dev, int ret; =20 np =3D dev->of_node; desc =3D devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL); if (!desc) - return -ENOMEM; + return ERR_PTR(-ENOMEM); =20 timing =3D devm_kzalloc(dev, sizeof(*timing), GFP_KERNEL); if (!timing) - return -ENOMEM; + return ERR_PTR(-ENOMEM); =20 ret =3D of_get_display_timing(np, "panel-timing", timing); if (ret < 0) { dev_err(dev, "%pOF: no panel-timing node found for \"panel-dpi\" binding= \n", np); - return ret; + return ERR_PTR(ret); } =20 desc->timings =3D timing; desc->num_timings =3D 1; =20 @@ -471,13 +470,11 @@ static int panel_dpi_probe(struct device *dev, desc->bus_flags =3D bus_flags; =20 /* We do not know the connector for the DT node, so guess it */ desc->connector_type =3D DRM_MODE_CONNECTOR_DPI; =20 - panel->desc =3D desc; - - return 0; + return desc; } =20 #define PANEL_SIMPLE_BOUNDS_CHECK(to_check, bounds, field) \ (to_check->field.typ >=3D bounds->field.min && \ to_check->field.typ <=3D bounds->field.max) @@ -611,14 +608,17 @@ static int panel_simple_probe(struct device *dev, con= st struct panel_desc *desc) return -EPROBE_DEFER; } =20 if (desc =3D=3D &panel_dpi) { /* Handle the generic panel-dpi binding */ - err =3D panel_dpi_probe(dev, panel); - if (err) + desc =3D panel_dpi_probe(dev); + if (IS_ERR(desc)) { + err =3D PTR_ERR(desc); goto free_ddc; - desc =3D panel->desc; + } + + panel->desc =3D desc; } else { if (!of_get_display_timing(dev->of_node, "panel-timing", &dt)) panel_simple_parse_panel_timing_node(dev, panel, &dt); } =20 --=20 2.49.0 From nobody Wed Oct 8 15:53:33 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3A300222599 for ; Thu, 26 Jun 2025 10:05:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750932317; cv=none; b=tnZok6PZoQ6IyCNOVb+ftV7eDT2HU6IE1Fx3WUXfMAkFycVLpMXXvAsADrDvf7XKLKG8XOETevYi3jevqLdaQdMguidSn/q11lEH68RMxeYUZ1EwMNCkVVDtxZTSzqasdJmoqSx13lsSskcohdVD+i6okjknrImCr6DHI7svv6U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750932317; c=relaxed/simple; bh=D9tNmt4CZw29EZUUZcqPTZ6E8NGJet4lpsy9/3O0OYE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pJ0Tz5CLSRB0OXg2FbXKj9rn+78gp/dwlpkkZMStGiZWUwSnjKjUVEo64T0uUF3pYnQav+iurP55j8ciTsbn+LeQm93LRTHDBbtRQYBkR3zEesD+uh53EFrIBfZi9PEUk6+unmLJ4vTK0rp+MA6E3slf7VTgqACWTjoaIXVaCh4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PH/kIZVQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PH/kIZVQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4E9BC4CEF2; Thu, 26 Jun 2025 10:05:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750932317; bh=D9tNmt4CZw29EZUUZcqPTZ6E8NGJet4lpsy9/3O0OYE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PH/kIZVQEI+sTG1XjJlstsFNgJr4gXAD/OjpXdYCBPfFBh5nNhYMYMHkjPx88cgE4 Jp486I8lnH2wzrkxEhLODI0n1lFsScsj/D2es8ePP2OU6Ga79bbCFpKgit70W/fXwx of89vftQZFAgUgIINYc29IsvPnBvURs6szDXY/GunbteFaX6Dn2lQ7NVagooN2dA7o YDHE3R+VNX5L/VKdbywYNC/gqs6LQ2Dp1S0OinxOn+Wtogv9dlUu0DYECv2Mu+EnBo CA/7838XF9TEajU2Aq1/Cwch28sENosLZgY6c8qwc+SHdIs5ieSgM+VWrVLVgM3ITY 5u1YYLa/I5AJQ== From: Maxime Ripard Date: Thu, 26 Jun 2025 12:05:01 +0200 Subject: [PATCH v2 3/5] drm/panel: panel-simple: Make panel_simple_probe return its panel Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250626-drm-panel-simple-fixes-v2-3-5afcaa608bdc@kernel.org> References: <20250626-drm-panel-simple-fixes-v2-0-5afcaa608bdc@kernel.org> In-Reply-To: <20250626-drm-panel-simple-fixes-v2-0-5afcaa608bdc@kernel.org> To: Neil Armstrong , Jessica Zhang , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Luca Ceresoli , Anusha Srivatsa , Francesco Dolcini Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5194; i=mripard@kernel.org; h=from:subject:message-id; bh=D9tNmt4CZw29EZUUZcqPTZ6E8NGJet4lpsy9/3O0OYE=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDBmx0oGsqsbGr73Of4putfj86cI/gaNZp4+kWEzzKNbRd YqLcm3rmMrCIMzJICumyPJEJuz08vbFVQ72K3/AzGFlAhnCwMUpABMRv8RYZ7Iyav2KuqrUS3vW u19vz7glp/pYs918Rpu0o9RH1Ub9vLsujR94bGL29S1+Xf6rISiJsb7+n0F34J8by7w45gox6qt uijnw6YF9regKicnnxE4czBW/0i5yNN/4peb52RJd4pXHFwAA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D In order to fix the regession introduced by commit de04bb0089a9 ("drm/panel/panel-simple: Use the new allocation in place of devm_kzalloc()"), we need to move the panel_desc lookup into the common panel_simple_probe() function. There's two callers for that function, the probe implementations of the platform and MIPI-DSI drivers panel-simple implements. The MIPI-DSI driver's probe will need to access the current panel_desc to initialize properly, which won't be possible anymore if we make that lookup in panel_simple_probe(). However, we can make panel_simple_probe() return the initialized panel_simple structure it allocated, which will contain a pointer to the associated panel_desc in its desc field. This doesn't fix de04bb0089a9 ("drm/panel/panel-simple: Use the new allocation in place of devm_kzalloc()") still, but makes progress towards that goal. Fixes: de04bb0089a9 ("drm/panel/panel-simple: Use the new allocation in pla= ce of devm_kzalloc()") Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas Tested-by: Francesco Dolcini # Toradex Coli= bri iMX6 --- drivers/gpu/drm/panel/panel-simple.c | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/p= anel-simple.c index 89188e683822f9202ec580c9a294e42083b9704a..e70ee2d4a538caaae673507b93e= 02b444a2e1640 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -565,11 +565,11 @@ static int panel_simple_override_nondefault_lvds_data= mapping(struct device *dev, } =20 return 0; } =20 -static int panel_simple_probe(struct device *dev, const struct panel_desc = *desc) +static struct panel_simple *panel_simple_probe(struct device *dev, const s= truct panel_desc *desc) { struct panel_simple *panel; struct display_timing dt; struct device_node *ddc; int connector_type; @@ -577,37 +577,37 @@ static int panel_simple_probe(struct device *dev, con= st struct panel_desc *desc) int err; =20 panel =3D devm_drm_panel_alloc(dev, struct panel_simple, base, &panel_simple_funcs, desc->connector_type); if (IS_ERR(panel)) - return PTR_ERR(panel); + return ERR_CAST(panel); =20 panel->desc =3D desc; =20 panel->supply =3D devm_regulator_get(dev, "power"); if (IS_ERR(panel->supply)) - return PTR_ERR(panel->supply); + return ERR_CAST(panel->supply); =20 panel->enable_gpio =3D devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW); if (IS_ERR(panel->enable_gpio)) - return dev_err_probe(dev, PTR_ERR(panel->enable_gpio), - "failed to request GPIO\n"); + return dev_err_cast_probe(dev, panel->enable_gpio, + "failed to request GPIO\n"); =20 err =3D of_drm_get_panel_orientation(dev->of_node, &panel->orientation); if (err) { dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err); - return err; + return ERR_PTR(err); } =20 ddc =3D of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0); if (ddc) { panel->ddc =3D of_find_i2c_adapter_by_node(ddc); of_node_put(ddc); =20 if (!panel->ddc) - return -EPROBE_DEFER; + return ERR_PTR(-EPROBE_DEFER); } =20 if (desc =3D=3D &panel_dpi) { /* Handle the generic panel-dpi binding */ desc =3D panel_dpi_probe(dev); @@ -701,20 +701,20 @@ static int panel_simple_probe(struct device *dev, con= st struct panel_desc *desc) goto disable_pm_runtime; } =20 drm_panel_add(&panel->base); =20 - return 0; + return panel; =20 disable_pm_runtime: pm_runtime_dont_use_autosuspend(dev); pm_runtime_disable(dev); free_ddc: if (panel->ddc) put_device(&panel->ddc->dev); =20 - return err; + return ERR_PTR(err); } =20 static void panel_simple_shutdown(struct device *dev) { struct panel_simple *panel =3D dev_get_drvdata(dev); @@ -5375,16 +5375,21 @@ static const struct of_device_id platform_of_match[= ] =3D { MODULE_DEVICE_TABLE(of, platform_of_match); =20 static int panel_simple_platform_probe(struct platform_device *pdev) { const struct panel_desc *desc; + struct panel_simple *panel; =20 desc =3D of_device_get_match_data(&pdev->dev); if (!desc) return -ENODEV; =20 - return panel_simple_probe(&pdev->dev, desc); + panel =3D panel_simple_probe(&pdev->dev, desc); + if (IS_ERR(panel)) + return PTR_ERR(panel); + + return 0; } =20 static void panel_simple_platform_remove(struct platform_device *pdev) { panel_simple_remove(&pdev->dev); @@ -5651,20 +5656,22 @@ static const struct of_device_id dsi_of_match[] =3D= { MODULE_DEVICE_TABLE(of, dsi_of_match); =20 static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi) { const struct panel_desc_dsi *desc; + struct panel_simple *panel; int err; =20 desc =3D of_device_get_match_data(&dsi->dev); if (!desc) return -ENODEV; =20 - err =3D panel_simple_probe(&dsi->dev, &desc->desc); - if (err < 0) - return err; + panel =3D panel_simple_probe(&dsi->dev, &desc->desc); + if (IS_ERR(panel)) + return PTR_ERR(panel); =20 + desc =3D container_of(panel->desc, struct panel_desc_dsi, desc); dsi->mode_flags =3D desc->flags; dsi->format =3D desc->format; dsi->lanes =3D desc->lanes; =20 err =3D mipi_dsi_attach(dsi); --=20 2.49.0 From nobody Wed Oct 8 15:53:33 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7751121B185 for ; Thu, 26 Jun 2025 10:05:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750932321; cv=none; b=X5yyt1xMzPk0fMEeaXyeUDIVFGPFPfhTf1cjnmcrovR/pEhoaBPqHzOn8Q+BfjHciUah+Oi1jVjR5ZNYAhc+I5fImD7SXVsxY9n+G4V+w2Hv+GX19up7jDQ6HagDmHMePJvXDiIh31aMpVLG03rqlM+M1IMRjX9ddZVQv28+8Ds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750932321; c=relaxed/simple; bh=jbRXkk0hjIDPPWjYuxAm63dXMqfFIrrPdpEYXFXsa9M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uPI7AtllCscQFtKXWCLfDlmncUujw26MNN1ybMSxKSonN/1R+np7rCMFtyn2hTsBb6hvN1FqNVux92YW3Vj7tmKeARrffAbeJMKMO0S8axFBDN11xyTbq4i8ZUXSIiuAKeATExJSEjiec6CLwzn0uSgDahExRXj7PGmFhxqRTQE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ohmjphWj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ohmjphWj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD2EBC4CEEB; Thu, 26 Jun 2025 10:05:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750932320; bh=jbRXkk0hjIDPPWjYuxAm63dXMqfFIrrPdpEYXFXsa9M=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=ohmjphWj3P1xuIYPxYPqL2IeLt3i+DXuplSSTbggaXEOo6ePZSfAjyik2cjBI+wxy TlSkYkSE2ArTDXSI7S1F7aUx1Rsig/BpliW0h1Bm8PVczxt4/GNh8YaGxJS8EFRlFT 6l4tqmgLfNBCifHA9O9FAiL7IXJynhZm7LJBWsIg+hD8AxOPKq3idjvkRNY/vUpUwW NhOUsZ1Ke+DAP/C+17S+DnFtAot0aKWH+xC87HJTMl8S0ZnNHoKlS5E9+SbmSOQYlC FlEgnZ7LZkJpsJOSLLINHdGhjMI01oewwPx3a6ZVHc6GDJKzYnnqop+4C5iAoSbvYe 67dY96OU64qbw== From: Maxime Ripard Date: Thu, 26 Jun 2025 12:05:02 +0200 Subject: [PATCH v2 4/5] drm/panel: panel-simple: Add function to look panel data up Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250626-drm-panel-simple-fixes-v2-4-5afcaa608bdc@kernel.org> References: <20250626-drm-panel-simple-fixes-v2-0-5afcaa608bdc@kernel.org> In-Reply-To: <20250626-drm-panel-simple-fixes-v2-0-5afcaa608bdc@kernel.org> To: Neil Armstrong , Jessica Zhang , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Luca Ceresoli , Anusha Srivatsa , Francesco Dolcini Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6328; i=mripard@kernel.org; h=from:subject:message-id; bh=jbRXkk0hjIDPPWjYuxAm63dXMqfFIrrPdpEYXFXsa9M=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDBmx0oHMz1tLHVMLJ/nJlb0NZfNTVwhdIcdwJE2ywH0n9 4Zm31sdU1kYhDkZZMUUWZ7IhJ1e3r64ysF+5Q+YOaxMIEMYuDgFYCLz2Rnro28u9r5ZKX8za5f9 lUNZ743fd614b6t6J2jvQf/I8zZnk+/siHE97qXo9kb3fFkRx7R4xjp7zdoXvde2PAp+PScu0sX I+tWasijHH4frtmqzaa16fOLuJ1c+nurQzw+3SCYo3X7zQRkA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Commit de04bb0089a9 ("drm/panel/panel-simple: Use the new allocation in place of devm_kzalloc()") moved the call to drm_panel_init into the devm_drm_panel_alloc(), which needs a connector type to initialize properly. In the panel-dpi compatible case, the passed panel_desc structure is an empty one used as a discriminant, and the connector type it contains isn't actually initialized. It is initialized through a call to panel_dpi_probe() later in the function, which used to be before the call to drm_panel_init() that got merged into devm_drm_panel_alloc(). So, we do need a proper panel_desc pointer before the call to devm_drm_panel_alloc() now. All cases associate their panel_desc with the panel compatible and use of_device_get_match_data, except for the panel-dpi compatible. In that case, we're expected to call panel_dpi_probe, which will allocate and initialize the panel_desc for us. Let's create such a helper function that would be called first in the driver and will lookup the desc by compatible, or allocate one if relevant. Reported-by: Francesco Dolcini Closes: https://lore.kernel.org/all/20250612081834.GA248237@francesco-nb/ Fixes: de04bb0089a9 ("drm/panel/panel-simple: Use the new allocation in pla= ce of devm_kzalloc()") Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas Tested-by: Francesco Dolcini # Toradex Coli= bri iMX6 --- drivers/gpu/drm/panel/panel-simple.c | 82 +++++++++++++++++++++-----------= ---- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/p= anel-simple.c index e70ee2d4a538caaae673507b93e02b444a2e1640..4c831af86414aba6a6b44dbc602= 0c0268dbd78b7 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -24,10 +24,11 @@ #include #include #include #include #include +#include #include #include #include #include =20 @@ -134,10 +135,18 @@ struct panel_desc { =20 /** @connector_type: LVDS, eDP, DSI, DPI, etc. */ int connector_type; }; =20 +struct panel_desc_dsi { + struct panel_desc desc; + + unsigned long flags; + enum mipi_dsi_pixel_format format; + unsigned int lanes; +}; + struct panel_simple { struct drm_panel base; =20 ktime_t unprepared_time; =20 @@ -565,19 +574,53 @@ static int panel_simple_override_nondefault_lvds_data= mapping(struct device *dev, } =20 return 0; } =20 -static struct panel_simple *panel_simple_probe(struct device *dev, const s= truct panel_desc *desc) +static const struct panel_desc *panel_simple_get_desc(struct device *dev) { + if (IS_ENABLED(CONFIG_DRM_MIPI_DSI) && + dev_is_mipi_dsi(dev)) { + const struct panel_desc_dsi *dsi_desc; + + dsi_desc =3D of_device_get_match_data(dev); + if (!dsi_desc) + return ERR_PTR(-ENODEV); + + return &dsi_desc->desc; + } + + if (dev_is_platform(dev)) { + const struct panel_desc *desc; + + desc =3D of_device_get_match_data(dev); + if (!desc) + return ERR_PTR(-ENODEV); + + if (desc =3D=3D &panel_dpi) + return panel_dpi_probe(dev); + + return desc; + } + + return ERR_PTR(-ENODEV); +} + +static struct panel_simple *panel_simple_probe(struct device *dev) +{ + const struct panel_desc *desc; struct panel_simple *panel; struct display_timing dt; struct device_node *ddc; int connector_type; u32 bus_flags; int err; =20 + desc =3D panel_simple_get_desc(dev); + if (IS_ERR(desc)) + return ERR_CAST(desc); + panel =3D devm_drm_panel_alloc(dev, struct panel_simple, base, &panel_simple_funcs, desc->connector_type); if (IS_ERR(panel)) return ERR_CAST(panel); =20 @@ -606,23 +649,13 @@ static struct panel_simple *panel_simple_probe(struct= device *dev, const struct =20 if (!panel->ddc) return ERR_PTR(-EPROBE_DEFER); } =20 - if (desc =3D=3D &panel_dpi) { - /* Handle the generic panel-dpi binding */ - desc =3D panel_dpi_probe(dev); - if (IS_ERR(desc)) { - err =3D PTR_ERR(desc); - goto free_ddc; - } - - panel->desc =3D desc; - } else { - if (!of_get_display_timing(dev->of_node, "panel-timing", &dt)) - panel_simple_parse_panel_timing_node(dev, panel, &dt); - } + if ((desc !=3D &panel_dpi) && + !of_get_display_timing(dev->of_node, "panel-timing", &dt)) + panel_simple_parse_panel_timing_node(dev, panel, &dt); =20 if (desc->connector_type =3D=3D DRM_MODE_CONNECTOR_LVDS) { /* Optional data-mapping property for overriding bus format */ err =3D panel_simple_override_nondefault_lvds_datamapping(dev, panel); if (err) @@ -5374,18 +5407,13 @@ static const struct of_device_id platform_of_match[= ] =3D { }; MODULE_DEVICE_TABLE(of, platform_of_match); =20 static int panel_simple_platform_probe(struct platform_device *pdev) { - const struct panel_desc *desc; struct panel_simple *panel; =20 - desc =3D of_device_get_match_data(&pdev->dev); - if (!desc) - return -ENODEV; - - panel =3D panel_simple_probe(&pdev->dev, desc); + panel =3D panel_simple_probe(&pdev->dev); if (IS_ERR(panel)) return PTR_ERR(panel); =20 return 0; } @@ -5415,18 +5443,10 @@ static struct platform_driver panel_simple_platform= _driver =3D { .probe =3D panel_simple_platform_probe, .remove =3D panel_simple_platform_remove, .shutdown =3D panel_simple_platform_shutdown, }; =20 -struct panel_desc_dsi { - struct panel_desc desc; - - unsigned long flags; - enum mipi_dsi_pixel_format format; - unsigned int lanes; -}; - static const struct drm_display_mode auo_b080uan01_mode =3D { .clock =3D 154500, .hdisplay =3D 1200, .hsync_start =3D 1200 + 62, .hsync_end =3D 1200 + 62 + 4, @@ -5659,15 +5679,11 @@ static int panel_simple_dsi_probe(struct mipi_dsi_d= evice *dsi) { const struct panel_desc_dsi *desc; struct panel_simple *panel; int err; =20 - desc =3D of_device_get_match_data(&dsi->dev); - if (!desc) - return -ENODEV; - - panel =3D panel_simple_probe(&dsi->dev, &desc->desc); + panel =3D panel_simple_probe(&dsi->dev); if (IS_ERR(panel)) return PTR_ERR(panel); =20 desc =3D container_of(panel->desc, struct panel_desc_dsi, desc); dsi->mode_flags =3D desc->flags; --=20 2.49.0 From nobody Wed Oct 8 15:53:33 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D505D21ADC5 for ; Thu, 26 Jun 2025 10:05:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750932322; cv=none; b=C8UefxVevo3ikCluI9B/FP81kXMJKcppSsa14X6v9C3i+wKV2CYCPup8EtqfXj1tvzOgKi3kQ8iyPGHf7voI9sR1kM9aPd4LAcTDEbMNONz4yjCh4sIiLi/2YezC0dkKvZipTG6FZ+juS/l6l3ZljRCG1CrOsvHG91tPGbZfXPo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750932322; c=relaxed/simple; bh=YK2pvdDJ6IkwTqiQaUwdS4JOldNd1Bm6lfp6cF1eOl0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=X0kyU1sZ4xh0Z3P3f7YRcvGCuctqIV48MLJ+beATIhRG4WKmK34qyOf2WEKqtW0+Irb++asQOn7Gi7SoMnc6+ApwhwcknUeSnkQbhtePKjT1eDkbz1gvXLjgO3KtHybBB8e90CY4aD1Uwvmal1kgO0lBhOdOQbZ/uN+s4fDJ5EU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KtoCejcZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KtoCejcZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64617C4CEF1; Thu, 26 Jun 2025 10:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750932322; bh=YK2pvdDJ6IkwTqiQaUwdS4JOldNd1Bm6lfp6cF1eOl0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KtoCejcZvwrXKBc19UBfUuJRvuQXkjK0YvAF8pjmw982/e0/xMCJlb/Mzmt1yLMn1 dLq3n4JorGh16+y9Unac9ONGEnMzXBgGsxl2hZmfLvaR/dt0YEje0gdInXqm2MjQ3O 5jrnjDfBZxblG7UYqf6cy/zraw/e4CcuIujambZX6MeS2PqKlZU9mYlmQ4XuH4ry/r lwxvS9VNjCb4J02EiBcPaPtKADLFWSBZA7M5XeKy5p3JpP67vpHfjr7k9DTIOb4wJP fdHsEV99VXCpO+p4l63oM5TxhRRt7f+dTlqQliya6cIPHQvQnkDcp72sGjEa3PTb2e dmTyC80zgg/gg== From: Maxime Ripard Date: Thu, 26 Jun 2025 12:05:03 +0200 Subject: [PATCH v2 5/5] drm/panel: panel-simple: get rid of panel_dpi hack Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250626-drm-panel-simple-fixes-v2-5-5afcaa608bdc@kernel.org> References: <20250626-drm-panel-simple-fixes-v2-0-5afcaa608bdc@kernel.org> In-Reply-To: <20250626-drm-panel-simple-fixes-v2-0-5afcaa608bdc@kernel.org> To: Neil Armstrong , Jessica Zhang , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Luca Ceresoli , Anusha Srivatsa , Francesco Dolcini Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Maxime Ripard X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2757; i=mripard@kernel.org; h=from:subject:message-id; bh=YK2pvdDJ6IkwTqiQaUwdS4JOldNd1Bm6lfp6cF1eOl0=; b=owGbwMvMwCmsHn9OcpHtvjLG02pJDBmx0kHmN7mnHHA+b5e5eHpo7Jt938VnnDkjUFnl4ed0s qGlz+Bjx1QWBmFOBlkxRZYnMmGnl7cvrnKwX/kDZg4rE8gQBi5OAZiI80HGhqbQpCUtsz4q1wqd nCu3K7rjq/7LDaXntU97K2xiCWJNnjbLJe1iReS+pZmnuKRNVm4VZqz32HTJdI9W+SVZxtnTeQu 39wnKcqslC5ieC0/a2lYfbdljuGPSLJusGqGDLRn7Xp5RXAEA X-Developer-Key: i=mripard@kernel.org; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D The empty panel_dpi struct was only ever used as a discriminant, but it's kind of a hack, and with the reworks done in the previous patches, we shouldn't need it anymore. Let's get rid of it. Signed-off-by: Maxime Ripard Reviewed-by: Javier Martinez Canillas Tested-by: Francesco Dolcini # Toradex Coli= bri iMX6 --- drivers/gpu/drm/panel/panel-simple.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/p= anel-simple.c index 4c831af86414aba6a6b44dbc6020c0268dbd78b7..9f81fa960b460290759f5f9eba9= 7045ab55fe5b8 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -437,12 +437,10 @@ static const struct drm_panel_funcs panel_simple_func= s =3D { .get_modes =3D panel_simple_get_modes, .get_orientation =3D panel_simple_get_orientation, .get_timings =3D panel_simple_get_timings, }; =20 -static struct panel_desc panel_dpi; - static struct panel_desc *panel_dpi_probe(struct device *dev) { struct display_timing *timing; const struct device_node *np; struct panel_desc *desc; @@ -591,15 +589,21 @@ static const struct panel_desc *panel_simple_get_desc= (struct device *dev) =20 if (dev_is_platform(dev)) { const struct panel_desc *desc; =20 desc =3D of_device_get_match_data(dev); - if (!desc) - return ERR_PTR(-ENODEV); - - if (desc =3D=3D &panel_dpi) - return panel_dpi_probe(dev); + if (!desc) { + /* + * panel-dpi probes without a descriptor and + * panel_dpi_probe() will initialize one for us + * based on the device tree. + */ + if (of_device_is_compatible(dev->of_node, "panel-dpi")) + return panel_dpi_probe(dev); + else + return ERR_PTR(-ENODEV); + } =20 return desc; } =20 return ERR_PTR(-ENODEV); @@ -649,11 +653,11 @@ static struct panel_simple *panel_simple_probe(struct= device *dev) =20 if (!panel->ddc) return ERR_PTR(-EPROBE_DEFER); } =20 - if ((desc !=3D &panel_dpi) && + if (!of_device_is_compatible(dev->of_node, "panel-dpi") && !of_get_display_timing(dev->of_node, "panel-timing", &dt)) panel_simple_parse_panel_timing_node(dev, panel, &dt); =20 if (desc->connector_type =3D=3D DRM_MODE_CONNECTOR_LVDS) { /* Optional data-mapping property for overriding bus format */ @@ -5398,11 +5402,16 @@ static const struct of_device_id platform_of_match[= ] =3D { .compatible =3D "microchip,ac69t88a", .data =3D &mchp_ac69t88a, }, { /* Must be the last entry */ .compatible =3D "panel-dpi", - .data =3D &panel_dpi, + + /* + * Explicitly NULL, the panel_desc structure will be + * allocated by panel_dpi_probe(). + */ + .data =3D NULL, }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, platform_of_match); --=20 2.49.0