Message ID | 20220331192347.103299-2-marex@denx.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/2] drm/panel: lvds: Simplify mode parsing | expand |
From: Marek Vasut [mailto:marex@denx.de] Sent: Thursday, March 31, 2022 9:24 PM > This driver currently rewrites bus_flags based solely on the value of > DT property 'data-mirror' and ignores bus_flags which might have been > set in DT panel-timing node. Specificaly, the 'de-active' DT property > sets DRM_BUS_FLAG_DE_ bus_flags. > > Since of_get_drm_panel_display_mode() conveniently parses the bus_flags > out of DT panel-timing property, just ORR them with bus_flags inferred > from 'data-mirror' DT property and use the result as panel bus_flags. > > This fixes handling of panels with 'panel-timing { de-active = <1>; };'. > > Signed-off-by: Marek Vasut <marex@denx.de> > Cc: Christoph Niedermaier <cniedermaier@dh-electronics.com> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch> > Cc: Dmitry Osipenko <digetx@gmail.com> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > Cc: Robert Foss <robert.foss@linaro.org> > Cc: Sam Ravnborg <sam@ravnborg.org> > Cc: Thomas Zimmermann <tzimmermann@suse.de> > To: dri-devel@lists.freedesktop.org > --- > drivers/gpu/drm/panel/panel-lvds.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/panel/panel-lvds.c > b/drivers/gpu/drm/panel/panel-lvds.c > index 65c6a6e9e223..f11252fb00fe 100644 > --- a/drivers/gpu/drm/panel/panel-lvds.c > +++ b/drivers/gpu/drm/panel/panel-lvds.c > @@ -33,7 +33,6 @@ struct panel_lvds { > struct drm_display_mode dmode; > u32 bus_flags; > unsigned int bus_format; > - bool data_mirror; > > struct regulator *supply; > > @@ -99,9 +98,7 @@ static int panel_lvds_get_modes(struct drm_panel *panel, > connector->display_info.height_mm = lvds->dmode.height_mm; > drm_display_info_set_bus_formats(&connector->display_info, > &lvds->bus_format, 1); > - connector->display_info.bus_flags = lvds->data_mirror > - ? DRM_BUS_FLAG_DATA_LSB_TO_MSB > - : DRM_BUS_FLAG_DATA_MSB_TO_LSB; > + connector->display_info.bus_flags = lvds->bus_flags; > drm_connector_set_panel_orientation(connector, lvds->orientation); > > return 1; > @@ -142,7 +139,9 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds) > > lvds->bus_format = ret; > > - lvds->data_mirror = of_property_read_bool(np, "data-mirror"); > + lvds->bus_flags |= of_property_read_bool(np, "data-mirror") ? > + DRM_BUS_FLAG_DATA_LSB_TO_MSB : > + DRM_BUS_FLAG_DATA_MSB_TO_LSB; > > return 0; > } Tested-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> Regards Christoph
Hi Marek, Thank you for the patch. On Thu, Mar 31, 2022 at 09:23:47PM +0200, Marek Vasut wrote: > This driver currently rewrites bus_flags based solely on the value of > DT property 'data-mirror' and ignores bus_flags which might have been > set in DT panel-timing node. Specificaly, the 'de-active' DT property > sets DRM_BUS_FLAG_DE_ bus_flags. > > Since of_get_drm_panel_display_mode() conveniently parses the bus_flags > out of DT panel-timing property, just ORR them with bus_flags inferred > from 'data-mirror' DT property and use the result as panel bus_flags. > > This fixes handling of panels with 'panel-timing { de-active = <1>; };'. > > Signed-off-by: Marek Vasut <marex@denx.de> > Cc: Christoph Niedermaier <cniedermaier@dh-electronics.com> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch> > Cc: Dmitry Osipenko <digetx@gmail.com> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > Cc: Robert Foss <robert.foss@linaro.org> > Cc: Sam Ravnborg <sam@ravnborg.org> > Cc: Thomas Zimmermann <tzimmermann@suse.de> > To: dri-devel@lists.freedesktop.org Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > drivers/gpu/drm/panel/panel-lvds.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c > index 65c6a6e9e223..f11252fb00fe 100644 > --- a/drivers/gpu/drm/panel/panel-lvds.c > +++ b/drivers/gpu/drm/panel/panel-lvds.c > @@ -33,7 +33,6 @@ struct panel_lvds { > struct drm_display_mode dmode; > u32 bus_flags; > unsigned int bus_format; > - bool data_mirror; > > struct regulator *supply; > > @@ -99,9 +98,7 @@ static int panel_lvds_get_modes(struct drm_panel *panel, > connector->display_info.height_mm = lvds->dmode.height_mm; > drm_display_info_set_bus_formats(&connector->display_info, > &lvds->bus_format, 1); > - connector->display_info.bus_flags = lvds->data_mirror > - ? DRM_BUS_FLAG_DATA_LSB_TO_MSB > - : DRM_BUS_FLAG_DATA_MSB_TO_LSB; > + connector->display_info.bus_flags = lvds->bus_flags; > drm_connector_set_panel_orientation(connector, lvds->orientation); > > return 1; > @@ -142,7 +139,9 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds) > > lvds->bus_format = ret; > > - lvds->data_mirror = of_property_read_bool(np, "data-mirror"); > + lvds->bus_flags |= of_property_read_bool(np, "data-mirror") ? > + DRM_BUS_FLAG_DATA_LSB_TO_MSB : > + DRM_BUS_FLAG_DATA_MSB_TO_LSB; > > return 0; > }
diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c index 65c6a6e9e223..f11252fb00fe 100644 --- a/drivers/gpu/drm/panel/panel-lvds.c +++ b/drivers/gpu/drm/panel/panel-lvds.c @@ -33,7 +33,6 @@ struct panel_lvds { struct drm_display_mode dmode; u32 bus_flags; unsigned int bus_format; - bool data_mirror; struct regulator *supply; @@ -99,9 +98,7 @@ static int panel_lvds_get_modes(struct drm_panel *panel, connector->display_info.height_mm = lvds->dmode.height_mm; drm_display_info_set_bus_formats(&connector->display_info, &lvds->bus_format, 1); - connector->display_info.bus_flags = lvds->data_mirror - ? DRM_BUS_FLAG_DATA_LSB_TO_MSB - : DRM_BUS_FLAG_DATA_MSB_TO_LSB; + connector->display_info.bus_flags = lvds->bus_flags; drm_connector_set_panel_orientation(connector, lvds->orientation); return 1; @@ -142,7 +139,9 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds) lvds->bus_format = ret; - lvds->data_mirror = of_property_read_bool(np, "data-mirror"); + lvds->bus_flags |= of_property_read_bool(np, "data-mirror") ? + DRM_BUS_FLAG_DATA_LSB_TO_MSB : + DRM_BUS_FLAG_DATA_MSB_TO_LSB; return 0; }
This driver currently rewrites bus_flags based solely on the value of DT property 'data-mirror' and ignores bus_flags which might have been set in DT panel-timing node. Specificaly, the 'de-active' DT property sets DRM_BUS_FLAG_DE_ bus_flags. Since of_get_drm_panel_display_mode() conveniently parses the bus_flags out of DT panel-timing property, just ORR them with bus_flags inferred from 'data-mirror' DT property and use the result as panel bus_flags. This fixes handling of panels with 'panel-timing { de-active = <1>; };'. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Christoph Niedermaier <cniedermaier@dh-electronics.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Dmitry Osipenko <digetx@gmail.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Cc: Robert Foss <robert.foss@linaro.org> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Thomas Zimmermann <tzimmermann@suse.de> To: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/panel/panel-lvds.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)