Hi Fabrizio,

On Wed, Nov 13, 2019 at 03:51:25PM +0000, Fabrizio Castro wrote:
> Add support for transparent LVDS decoders by adding a new
> compatible string ("lvds-decoder") to the driver.
> This patch also adds member connector_type to struct lvds_codec,
> and that's because LVDS decoders have a different connector type
> from LVDS encoders. We fill this new member up with the data
> matching the compatible string.
> 
> Signed-off-by: Fabrizio Castro <fabrizio.cas...@bp.renesas.com>
> 
> ---
> v3->v4:
> * New patch
> ---
>  drivers/gpu/drm/bridge/lvds-codec.c | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/lvds-codec.c 
> b/drivers/gpu/drm/bridge/lvds-codec.c
> index b5801a2..c32e125 100644
> --- a/drivers/gpu/drm/bridge/lvds-codec.c
> +++ b/drivers/gpu/drm/bridge/lvds-codec.c
> @@ -7,6 +7,7 @@
>  #include <linux/gpio/consumer.h>
>  #include <linux/module.h>
>  #include <linux/of.h>
> +#include <linux/of_device.h>
>  #include <linux/of_graph.h>
>  #include <linux/platform_device.h>
>  
> @@ -17,6 +18,7 @@ struct lvds_codec {
>       struct drm_bridge bridge;
>       struct drm_bridge *panel_bridge;
>       struct gpio_desc *powerdown_gpio;
> +     u32 connector_type;
>  };
>  
>  static int lvds_codec_attach(struct drm_bridge *bridge)
> @@ -65,6 +67,7 @@ static int lvds_codec_probe(struct platform_device *pdev)
>       if (!lvds_codec)
>               return -ENOMEM;
>  
> +     lvds_codec->connector_type = (u32)of_device_get_match_data(&pdev->dev);

I'm now getting a compilation failure here:

drivers/gpu/drm/bridge/lvds-codec.c: In function ‘lvds_codec_probe’:
drivers/gpu/drm/bridge/lvds-codec.c:68:31: error: cast from pointer to integer 
of different size [-Werror=pointer-to-int-cast]
  lvds_codec->connector_type = (u32)of_device_get_match_data(&pdev->dev);
                               ^

The fix should be simple:

        lvds_codec->connector_type = (uintptr_t)of_device_get_match_data(dev);

I'm bothered by the fact that I've compiled this before without any
issue, so this really puzzles me. Do you get the same warning ?

>       lvds_codec->powerdown_gpio = devm_gpiod_get_optional(dev, "powerdown",
>                                                            GPIOD_OUT_HIGH);
>       if (IS_ERR(lvds_codec->powerdown_gpio)) {
> @@ -105,7 +108,7 @@ static int lvds_codec_probe(struct platform_device *pdev)
>  
>       lvds_codec->panel_bridge =
>               devm_drm_panel_bridge_add_typed(dev, panel,
> -                                             DRM_MODE_CONNECTOR_LVDS);
> +                                             lvds_codec->connector_type);
>       if (IS_ERR(lvds_codec->panel_bridge))
>               return PTR_ERR(lvds_codec->panel_bridge);
>  
> @@ -133,8 +136,18 @@ static int lvds_codec_remove(struct platform_device 
> *pdev)
>  }
>  
>  static const struct of_device_id lvds_codec_match[] = {
> -     { .compatible = "lvds-encoder" },
> -     { .compatible = "thine,thc63lvdm83d" },
> +     {
> +             .compatible = "lvds-decoder",
> +             .data = (void *)DRM_MODE_CONNECTOR_DPI,
> +     },
> +     {
> +             .compatible = "lvds-encoder",
> +             .data = (void *)DRM_MODE_CONNECTOR_LVDS,
> +     },
> +     {
> +             .compatible = "thine,thc63lvdm83d",
> +             .data = (void *)DRM_MODE_CONNECTOR_LVDS,
> +     },
>       {},
>  };
>  MODULE_DEVICE_TABLE(of, lvds_codec_match);

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to