diff mbox series

[1/1] drm/bridge: lvds-codec: Implement atomic_get_input_bus_fmts for LVDS encoder

Message ID 20230810063229.597533-1-alexander.stein@ew.tq-group.com (mailing list archive)
State Accepted
Headers show
Series [1/1] drm/bridge: lvds-codec: Implement atomic_get_input_bus_fmts for LVDS encoder | expand

Commit Message

Alexander Stein Aug. 10, 2023, 6:32 a.m. UTC
atomic_get_input_bus_fmts is only implemented for LVDS decoders, resulting
that LVDS encoders only support bus format MEDIA_BUS_FMT_FIXED. This
results in warnings like:
mxsfb 21c8000.lcdif: Bridge does not provide bus format, assuming
 MEDIA_BUS_FMT_RGB888_1X24.
Please fix bridge driver by handling atomic_get_input_bus_fmts.

Fix this by reusing lvds_codec_atomic_get_input_bus_fmts currently used
for LVDS decoders. Use RGB888_1X24 for LVDS encoders. This also allows
removing the dedicated struct drm_bridge_funcs for decoders.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---

Notes:
    Currently all supported LVDS encoders (ti,ds90c185, ti,ds90c187 and
    ti,sn75lvds83) only support RGB888_1X24.

 drivers/gpu/drm/bridge/lvds-codec.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

Comments

Robert Foss Aug. 11, 2023, 1:09 p.m. UTC | #1
On Thu, Aug 10, 2023 at 8:32 AM Alexander Stein
<alexander.stein@ew.tq-group.com> wrote:
>
> atomic_get_input_bus_fmts is only implemented for LVDS decoders, resulting
> that LVDS encoders only support bus format MEDIA_BUS_FMT_FIXED. This
> results in warnings like:
> mxsfb 21c8000.lcdif: Bridge does not provide bus format, assuming
>  MEDIA_BUS_FMT_RGB888_1X24.
> Please fix bridge driver by handling atomic_get_input_bus_fmts.
>
> Fix this by reusing lvds_codec_atomic_get_input_bus_fmts currently used
> for LVDS decoders. Use RGB888_1X24 for LVDS encoders. This also allows
> removing the dedicated struct drm_bridge_funcs for decoders.
>
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
>
> Notes:
>     Currently all supported LVDS encoders (ti,ds90c185, ti,ds90c187 and
>     ti,sn75lvds83) only support RGB888_1X24.
>
>  drivers/gpu/drm/bridge/lvds-codec.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/lvds-codec.c b/drivers/gpu/drm/bridge/lvds-codec.c
> index 8c5668dca0c4b..991732c4b6298 100644
> --- a/drivers/gpu/drm/bridge/lvds-codec.c
> +++ b/drivers/gpu/drm/bridge/lvds-codec.c
> @@ -5,6 +5,7 @@
>   */
>
>  #include <linux/gpio/consumer.h>
> +#include <linux/media-bus-format.h>
>  #include <linux/module.h>
>  #include <linux/of.h>
>  #include <linux/of_graph.h>
> @@ -71,12 +72,6 @@ static void lvds_codec_disable(struct drm_bridge *bridge)
>                         "Failed to disable regulator \"vcc\": %d\n", ret);
>  }
>
> -static const struct drm_bridge_funcs funcs = {
> -       .attach = lvds_codec_attach,
> -       .enable = lvds_codec_enable,
> -       .disable = lvds_codec_disable,
> -};
> -
>  #define MAX_INPUT_SEL_FORMATS 1
>  static u32 *
>  lvds_codec_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
> @@ -102,7 +97,7 @@ lvds_codec_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
>         return input_fmts;
>  }
>
> -static const struct drm_bridge_funcs funcs_decoder = {
> +static const struct drm_bridge_funcs funcs = {
>         .attach = lvds_codec_attach,
>         .enable = lvds_codec_enable,
>         .disable = lvds_codec_disable,
> @@ -184,8 +179,9 @@ static int lvds_codec_probe(struct platform_device *pdev)
>                         return ret;
>                 } else {
>                         lvds_codec->bus_format = ret;
> -                       lvds_codec->bridge.funcs = &funcs_decoder;
>                 }
> +       } else {
> +               lvds_codec->bus_format = MEDIA_BUS_FMT_RGB888_1X24;
>         }
>
>         /*

Reviewed-by: Robert Foss <rfoss@kernel.org>
Robert Foss Aug. 11, 2023, 1:11 p.m. UTC | #2
On Thu, 10 Aug 2023 08:32:29 +0200, Alexander Stein wrote:
> atomic_get_input_bus_fmts is only implemented for LVDS decoders, resulting
> that LVDS encoders only support bus format MEDIA_BUS_FMT_FIXED. This
> results in warnings like:
> mxsfb 21c8000.lcdif: Bridge does not provide bus format, assuming
>  MEDIA_BUS_FMT_RGB888_1X24.
> Please fix bridge driver by handling atomic_get_input_bus_fmts.
> 
> [...]

Applied, thanks!

[1/1] drm/bridge: lvds-codec: Implement atomic_get_input_bus_fmts for LVDS encoder
      https://cgit.freedesktop.org/drm/drm-misc/commit/?id=b31f784ffff9



Rob
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/lvds-codec.c b/drivers/gpu/drm/bridge/lvds-codec.c
index 8c5668dca0c4b..991732c4b6298 100644
--- a/drivers/gpu/drm/bridge/lvds-codec.c
+++ b/drivers/gpu/drm/bridge/lvds-codec.c
@@ -5,6 +5,7 @@ 
  */
 
 #include <linux/gpio/consumer.h>
+#include <linux/media-bus-format.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_graph.h>
@@ -71,12 +72,6 @@  static void lvds_codec_disable(struct drm_bridge *bridge)
 			"Failed to disable regulator \"vcc\": %d\n", ret);
 }
 
-static const struct drm_bridge_funcs funcs = {
-	.attach = lvds_codec_attach,
-	.enable = lvds_codec_enable,
-	.disable = lvds_codec_disable,
-};
-
 #define MAX_INPUT_SEL_FORMATS 1
 static u32 *
 lvds_codec_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
@@ -102,7 +97,7 @@  lvds_codec_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
 	return input_fmts;
 }
 
-static const struct drm_bridge_funcs funcs_decoder = {
+static const struct drm_bridge_funcs funcs = {
 	.attach = lvds_codec_attach,
 	.enable = lvds_codec_enable,
 	.disable = lvds_codec_disable,
@@ -184,8 +179,9 @@  static int lvds_codec_probe(struct platform_device *pdev)
 			return ret;
 		} else {
 			lvds_codec->bus_format = ret;
-			lvds_codec->bridge.funcs = &funcs_decoder;
 		}
+	} else {
+		lvds_codec->bus_format = MEDIA_BUS_FMT_RGB888_1X24;
 	}
 
 	/*