From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Johannes Zink <j.zink@pengutronix.de>
Cc: David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Thierry Reding <thierry.reding@gmail.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Sam Ravnborg <sam@ravnborg.org>,
kernel test robot <lkp@intel.com>,
Dan Carpenter <error27@gmail.com>,
patchwork-jzi@pengutronix.de, kernel@pengutronix.de,
dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] drm/panel-simple: allow LVDS format override
Date: Fri, 2 Jun 2023 18:39:38 +0300 [thread overview]
Message-ID: <20230602153938.GC3343@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20230523-simplepanel_support_nondefault_datamapping-v2-3-87196f0d0b64@pengutronix.de>
Hi Johannes,
Thank you for the patch.
On Tue, May 23, 2023 at 10:19:43AM +0200, Johannes Zink wrote:
> Some panels support multiple LVDS data mapping formats, which can be
> used e.g. run displays on jeida-18 format when only 3 LVDS lanes are
> available.
>
> Add parsing of an optional data-mapping devicetree property, which also
> touches up the bits per color to match the bus format.
Of course one could argue that the innolux,g101ice-l01 panel should have
used the panel-lvds bindings... :-)
> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>
> ---
>
> Changes:
>
> v1 -> v2: - fix missing unwind goto found by test robot
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <error27@gmail.com>
> Link: https://lore.kernel.org/r/202304160359.4LHmFOlU-lkp@intel.com/
> ---
> drivers/gpu/drm/panel/panel-simple.c | 39 +++++++++++++++++++++++++++++++++++-
> 1 file changed, 38 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index 2a9c1a785a5c..0a35fdb49ccb 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -40,6 +40,7 @@
> #include <drm/drm_edid.h>
> #include <drm/drm_mipi_dsi.h>
> #include <drm/drm_panel.h>
> +#include <drm/drm_of.h>
>
> /**
> * struct panel_desc - Describes a simple panel.
> @@ -559,7 +560,7 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
> struct device_node *ddc;
> int connector_type;
> u32 bus_flags;
> - int err;
> + int err, ret;
>
> panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL);
> if (!panel)
> @@ -605,6 +606,42 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
> panel_simple_parse_panel_timing_node(dev, panel, &dt);
> }
>
> +
Double blank line.
> + /* optional data-mapping property for overriding bus format */
s/optional/Optional/
> + ret = drm_of_lvds_get_data_mapping(dev->of_node);
> + if (ret == -EINVAL) {
> + dev_warn(dev, "Ignore invalid data-mapping property");
> + } else if (ret != -ENODEV) {
If someone incorrectly sets the property in DT for a non-LVDS panel,
the result won't be nice. That's of course a DT issue, but I wonder if
we could/should protect against it. You could move this code to a
separate function (which would have the added benefit of lowering the
indentation level as you can return early in error cases), and call it
from panel_simple_probe() only if the panel is an LVDS panel (as
reported by its desc->bus_format value).
> + int bpc;
> +
> + switch (ret) {
> + default:
> + WARN_ON(1);
> + fallthrough;
> + case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG:
> + fallthrough;
> + case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA:
> + bpc = 8;
> + break;
> + case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG:
> + bpc = 6;
> + }
> +
> + if (desc->bpc != bpc || desc->bus_format != ret) {
> + struct panel_desc *override_desc;
> +
> + override_desc = devm_kmemdup(dev, desc, sizeof(*desc), GFP_KERNEL);
> + if (!override_desc) {
> + err = -ENOMEM;
> + goto free_ddc;
> + }
> +
> + override_desc->bus_format = ret;
> + override_desc->bpc = bpc;
> + panel->desc = override_desc;
> + }
> + }
> +
> connector_type = desc->connector_type;
> /* Catch common mistakes for panels. */
> switch (connector_type) {
--
Regards,
Laurent Pinchart
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Johannes Zink <j.zink@pengutronix.de>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Dan Carpenter <error27@gmail.com>,
devicetree@vger.kernel.org, Sam Ravnborg <sam@ravnborg.org>,
linux-kernel@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
Thierry Reding <thierry.reding@gmail.com>,
dri-devel@lists.freedesktop.org,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
patchwork-jzi@pengutronix.de, kernel@pengutronix.de,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v2 3/3] drm/panel-simple: allow LVDS format override
Date: Fri, 2 Jun 2023 18:39:38 +0300 [thread overview]
Message-ID: <20230602153938.GC3343@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20230523-simplepanel_support_nondefault_datamapping-v2-3-87196f0d0b64@pengutronix.de>
Hi Johannes,
Thank you for the patch.
On Tue, May 23, 2023 at 10:19:43AM +0200, Johannes Zink wrote:
> Some panels support multiple LVDS data mapping formats, which can be
> used e.g. run displays on jeida-18 format when only 3 LVDS lanes are
> available.
>
> Add parsing of an optional data-mapping devicetree property, which also
> touches up the bits per color to match the bus format.
Of course one could argue that the innolux,g101ice-l01 panel should have
used the panel-lvds bindings... :-)
> Signed-off-by: Johannes Zink <j.zink@pengutronix.de>
>
> ---
>
> Changes:
>
> v1 -> v2: - fix missing unwind goto found by test robot
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <error27@gmail.com>
> Link: https://lore.kernel.org/r/202304160359.4LHmFOlU-lkp@intel.com/
> ---
> drivers/gpu/drm/panel/panel-simple.c | 39 +++++++++++++++++++++++++++++++++++-
> 1 file changed, 38 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index 2a9c1a785a5c..0a35fdb49ccb 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -40,6 +40,7 @@
> #include <drm/drm_edid.h>
> #include <drm/drm_mipi_dsi.h>
> #include <drm/drm_panel.h>
> +#include <drm/drm_of.h>
>
> /**
> * struct panel_desc - Describes a simple panel.
> @@ -559,7 +560,7 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
> struct device_node *ddc;
> int connector_type;
> u32 bus_flags;
> - int err;
> + int err, ret;
>
> panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL);
> if (!panel)
> @@ -605,6 +606,42 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
> panel_simple_parse_panel_timing_node(dev, panel, &dt);
> }
>
> +
Double blank line.
> + /* optional data-mapping property for overriding bus format */
s/optional/Optional/
> + ret = drm_of_lvds_get_data_mapping(dev->of_node);
> + if (ret == -EINVAL) {
> + dev_warn(dev, "Ignore invalid data-mapping property");
> + } else if (ret != -ENODEV) {
If someone incorrectly sets the property in DT for a non-LVDS panel,
the result won't be nice. That's of course a DT issue, but I wonder if
we could/should protect against it. You could move this code to a
separate function (which would have the added benefit of lowering the
indentation level as you can return early in error cases), and call it
from panel_simple_probe() only if the panel is an LVDS panel (as
reported by its desc->bus_format value).
> + int bpc;
> +
> + switch (ret) {
> + default:
> + WARN_ON(1);
> + fallthrough;
> + case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG:
> + fallthrough;
> + case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA:
> + bpc = 8;
> + break;
> + case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG:
> + bpc = 6;
> + }
> +
> + if (desc->bpc != bpc || desc->bus_format != ret) {
> + struct panel_desc *override_desc;
> +
> + override_desc = devm_kmemdup(dev, desc, sizeof(*desc), GFP_KERNEL);
> + if (!override_desc) {
> + err = -ENOMEM;
> + goto free_ddc;
> + }
> +
> + override_desc->bus_format = ret;
> + override_desc->bpc = bpc;
> + panel->desc = override_desc;
> + }
> + }
> +
> connector_type = desc->connector_type;
> /* Catch common mistakes for panels. */
> switch (connector_type) {
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2023-06-02 15:40 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-23 8:19 [PATCH v2 0/3] Support non-default LVDS data mapping for simple panel Johannes Zink
2023-05-23 8:19 ` Johannes Zink
2023-05-23 8:19 ` [PATCH v2 1/3] dt-bindings: display: move LVDS data-mapping definition to separate file Johannes Zink
2023-05-23 8:19 ` Johannes Zink
2023-05-23 17:16 ` Conor Dooley
2023-05-23 17:16 ` Conor Dooley
2023-06-02 15:32 ` Laurent Pinchart
2023-06-02 15:32 ` Laurent Pinchart
2023-07-28 8:33 ` Johannes Zink
2023-07-28 8:33 ` Johannes Zink
2023-05-23 8:19 ` [PATCH v2 2/3] dt-bindings: display: simple: support non-default data-mapping Johannes Zink
2023-05-23 8:19 ` Johannes Zink
2023-05-23 17:21 ` Conor Dooley
2023-05-23 17:21 ` Conor Dooley
2023-06-02 15:35 ` Laurent Pinchart
2023-06-02 15:35 ` Laurent Pinchart
2023-07-28 8:36 ` Johannes Zink
2023-07-28 8:36 ` Johannes Zink
2023-05-23 8:19 ` [PATCH v2 3/3] drm/panel-simple: allow LVDS format override Johannes Zink
2023-05-23 8:19 ` Johannes Zink
2023-06-02 14:34 ` Johannes Zink
2023-06-02 14:34 ` Johannes Zink
2023-06-02 15:39 ` Laurent Pinchart [this message]
2023-06-02 15:39 ` Laurent Pinchart
2023-06-05 6:20 ` Johannes Zink
2023-06-05 6:20 ` Johannes Zink
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230602153938.GC3343@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=airlied@gmail.com \
--cc=conor+dt@kernel.org \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=error27@gmail.com \
--cc=j.zink@pengutronix.de \
--cc=kernel@pengutronix.de \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=neil.armstrong@linaro.org \
--cc=patchwork-jzi@pengutronix.de \
--cc=robh+dt@kernel.org \
--cc=sam@ravnborg.org \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.