Message ID | 20190401124143.17179-3-peter.ujfalusi@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/bridge: ti-tfp410: Handle bus-format for 24/12 lines selection | expand |
Hi Peter, Thank you for the patch. On Mon, Apr 01, 2019 at 03:41:43PM +0300, Peter Ujfalusi wrote: > The TFP410 supports 24 bit, single-edge and 12 bit, dual-edge modes. > Depending on how many wires are used (24/12) the driver can set the correct > bus_format. > > If the information is not available in DT then assume 24 bit, single-edge > setup. > > Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> > --- > drivers/gpu/drm/bridge/ti-tfp410.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c > index 6fc831eb3804..8b0e71bd3ca7 100644 > --- a/drivers/gpu/drm/bridge/ti-tfp410.c > +++ b/drivers/gpu/drm/bridge/ti-tfp410.c > @@ -29,6 +29,7 @@ struct tfp410 { > struct drm_connector connector; > unsigned int connector_type; > > + u32 bus_format; > struct i2c_adapter *ddc; > struct gpio_desc *hpd; > int hpd_irq; > @@ -139,6 +140,9 @@ static int tfp410_attach(struct drm_bridge *bridge) > return ret; > } > > + drm_display_info_set_bus_formats(&dvi->connector.display_info, > + &dvi->bus_format, 1); > + > drm_connector_attach_encoder(&dvi->connector, > bridge->encoder); > > @@ -197,6 +201,7 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) > struct drm_bridge_timings *timings = &dvi->timings; > struct device_node *ep; > u32 pclk_sample = 0; > + u32 bus_width = 24; > s32 deskew = 0; > > /* Start with defaults. */ > @@ -221,6 +226,7 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) > > /* Get the sampling edge from the endpoint. */ > of_property_read_u32(ep, "pclk-sample", &pclk_sample); > + of_property_read_u32(ep, "bus-width", &bus_width); > of_node_put(ep); > > timings->input_bus_flags = DRM_BUS_FLAG_DE_HIGH; > @@ -238,6 +244,17 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) > return -EINVAL; > } > > + switch (bus_width) { > + case 12: > + dvi->bus_format = MEDIA_BUS_FMT_RGB888_2X12_LE; > + break; > + case 24: > + dvi->bus_format = MEDIA_BUS_FMT_RGB888_1X24; > + break; > + default: Maybe an error message here (possibly just dev_dbg()) ? Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > + return -EINVAL; > + } > + > /* Get the setup and hold time from vendor-specific properties. */ > of_property_read_u32(dvi->dev->of_node, "ti,deskew", (u32 *)&deskew); > if (deskew < -4 || deskew > 3)
On 01.04.2019 14:41, Peter Ujfalusi wrote: > The TFP410 supports 24 bit, single-edge and 12 bit, dual-edge modes. > Depending on how many wires are used (24/12) the driver can set the correct > bus_format. > > If the information is not available in DT then assume 24 bit, single-edge > setup. > > Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Reviewed-by: Andrzej Hajda <a.hajda@samsung.com> The patch does not apply on drm-misc-next. Could you rebase it. -- Regards Andrzej > --- > drivers/gpu/drm/bridge/ti-tfp410.c | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c > index 6fc831eb3804..8b0e71bd3ca7 100644 > --- a/drivers/gpu/drm/bridge/ti-tfp410.c > +++ b/drivers/gpu/drm/bridge/ti-tfp410.c > @@ -29,6 +29,7 @@ struct tfp410 { > struct drm_connector connector; > unsigned int connector_type; > > + u32 bus_format; > struct i2c_adapter *ddc; > struct gpio_desc *hpd; > int hpd_irq; > @@ -139,6 +140,9 @@ static int tfp410_attach(struct drm_bridge *bridge) > return ret; > } > > + drm_display_info_set_bus_formats(&dvi->connector.display_info, > + &dvi->bus_format, 1); > + > drm_connector_attach_encoder(&dvi->connector, > bridge->encoder); > > @@ -197,6 +201,7 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) > struct drm_bridge_timings *timings = &dvi->timings; > struct device_node *ep; > u32 pclk_sample = 0; > + u32 bus_width = 24; > s32 deskew = 0; > > /* Start with defaults. */ > @@ -221,6 +226,7 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) > > /* Get the sampling edge from the endpoint. */ > of_property_read_u32(ep, "pclk-sample", &pclk_sample); > + of_property_read_u32(ep, "bus-width", &bus_width); > of_node_put(ep); > > timings->input_bus_flags = DRM_BUS_FLAG_DE_HIGH; > @@ -238,6 +244,17 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) > return -EINVAL; > } > > + switch (bus_width) { > + case 12: > + dvi->bus_format = MEDIA_BUS_FMT_RGB888_2X12_LE; > + break; > + case 24: > + dvi->bus_format = MEDIA_BUS_FMT_RGB888_1X24; > + break; > + default: > + return -EINVAL; > + } > + > /* Get the setup and hold time from vendor-specific properties. */ > of_property_read_u32(dvi->dev->of_node, "ti,deskew", (u32 *)&deskew); > if (deskew < -4 || deskew > 3)
On 12.04.2019 09:33, Andrzej Hajda wrote: > On 01.04.2019 14:41, Peter Ujfalusi wrote: >> The TFP410 supports 24 bit, single-edge and 12 bit, dual-edge modes. >> Depending on how many wires are used (24/12) the driver can set the correct >> bus_format. >> >> If the information is not available in DT then assume 24 bit, single-edge >> setup. >> >> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> > Reviewed-by: Andrzej Hajda <a.hajda@samsung.com> > > The patch does not apply on drm-misc-next. Could you rebase it. OK, with HPD patch applied it works, I will queue all three patches to drm-misc-next. Regards Andrzej > > > -- > Regards > Andrzej > >> --- >> drivers/gpu/drm/bridge/ti-tfp410.c | 17 +++++++++++++++++ >> 1 file changed, 17 insertions(+) >> >> diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c >> index 6fc831eb3804..8b0e71bd3ca7 100644 >> --- a/drivers/gpu/drm/bridge/ti-tfp410.c >> +++ b/drivers/gpu/drm/bridge/ti-tfp410.c >> @@ -29,6 +29,7 @@ struct tfp410 { >> struct drm_connector connector; >> unsigned int connector_type; >> >> + u32 bus_format; >> struct i2c_adapter *ddc; >> struct gpio_desc *hpd; >> int hpd_irq; >> @@ -139,6 +140,9 @@ static int tfp410_attach(struct drm_bridge *bridge) >> return ret; >> } >> >> + drm_display_info_set_bus_formats(&dvi->connector.display_info, >> + &dvi->bus_format, 1); >> + >> drm_connector_attach_encoder(&dvi->connector, >> bridge->encoder); >> >> @@ -197,6 +201,7 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) >> struct drm_bridge_timings *timings = &dvi->timings; >> struct device_node *ep; >> u32 pclk_sample = 0; >> + u32 bus_width = 24; >> s32 deskew = 0; >> >> /* Start with defaults. */ >> @@ -221,6 +226,7 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) >> >> /* Get the sampling edge from the endpoint. */ >> of_property_read_u32(ep, "pclk-sample", &pclk_sample); >> + of_property_read_u32(ep, "bus-width", &bus_width); >> of_node_put(ep); >> >> timings->input_bus_flags = DRM_BUS_FLAG_DE_HIGH; >> @@ -238,6 +244,17 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) >> return -EINVAL; >> } >> >> + switch (bus_width) { >> + case 12: >> + dvi->bus_format = MEDIA_BUS_FMT_RGB888_2X12_LE; >> + break; >> + case 24: >> + dvi->bus_format = MEDIA_BUS_FMT_RGB888_1X24; >> + break; >> + default: >> + return -EINVAL; >> + } >> + >> /* Get the setup and hold time from vendor-specific properties. */ >> of_property_read_u32(dvi->dev->of_node, "ti,deskew", (u32 *)&deskew); >> if (deskew < -4 || deskew > 3) > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel
Hi Andrzej, On 12/04/2019 10.40, Andrzej Hajda wrote: > On 12.04.2019 09:33, Andrzej Hajda wrote: >> On 01.04.2019 14:41, Peter Ujfalusi wrote: >>> The TFP410 supports 24 bit, single-edge and 12 bit, dual-edge modes. >>> Depending on how many wires are used (24/12) the driver can set the correct >>> bus_format. >>> >>> If the information is not available in DT then assume 24 bit, single-edge >>> setup. >>> >>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> >> Reviewed-by: Andrzej Hajda <a.hajda@samsung.com> >> >> The patch does not apply on drm-misc-next. Could you rebase it. > > > OK, with HPD patch applied it works, I will queue all three patches to > drm-misc-next. Thank you! - Péter > > > Regards > > Andrzej > > >> >> >> -- >> Regards >> Andrzej >> >>> --- >>> drivers/gpu/drm/bridge/ti-tfp410.c | 17 +++++++++++++++++ >>> 1 file changed, 17 insertions(+) >>> >>> diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c >>> index 6fc831eb3804..8b0e71bd3ca7 100644 >>> --- a/drivers/gpu/drm/bridge/ti-tfp410.c >>> +++ b/drivers/gpu/drm/bridge/ti-tfp410.c >>> @@ -29,6 +29,7 @@ struct tfp410 { >>> struct drm_connector connector; >>> unsigned int connector_type; >>> >>> + u32 bus_format; >>> struct i2c_adapter *ddc; >>> struct gpio_desc *hpd; >>> int hpd_irq; >>> @@ -139,6 +140,9 @@ static int tfp410_attach(struct drm_bridge *bridge) >>> return ret; >>> } >>> >>> + drm_display_info_set_bus_formats(&dvi->connector.display_info, >>> + &dvi->bus_format, 1); >>> + >>> drm_connector_attach_encoder(&dvi->connector, >>> bridge->encoder); >>> >>> @@ -197,6 +201,7 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) >>> struct drm_bridge_timings *timings = &dvi->timings; >>> struct device_node *ep; >>> u32 pclk_sample = 0; >>> + u32 bus_width = 24; >>> s32 deskew = 0; >>> >>> /* Start with defaults. */ >>> @@ -221,6 +226,7 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) >>> >>> /* Get the sampling edge from the endpoint. */ >>> of_property_read_u32(ep, "pclk-sample", &pclk_sample); >>> + of_property_read_u32(ep, "bus-width", &bus_width); >>> of_node_put(ep); >>> >>> timings->input_bus_flags = DRM_BUS_FLAG_DE_HIGH; >>> @@ -238,6 +244,17 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) >>> return -EINVAL; >>> } >>> >>> + switch (bus_width) { >>> + case 12: >>> + dvi->bus_format = MEDIA_BUS_FMT_RGB888_2X12_LE; >>> + break; >>> + case 24: >>> + dvi->bus_format = MEDIA_BUS_FMT_RGB888_1X24; >>> + break; >>> + default: >>> + return -EINVAL; >>> + } >>> + >>> /* Get the setup and hold time from vendor-specific properties. */ >>> of_property_read_u32(dvi->dev->of_node, "ti,deskew", (u32 *)&deskew); >>> if (deskew < -4 || deskew > 3) >> >> _______________________________________________ >> dri-devel mailing list >> dri-devel@lists.freedesktop.org >> https://lists.freedesktop.org/mailman/listinfo/dri-devel > > Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c index 6fc831eb3804..8b0e71bd3ca7 100644 --- a/drivers/gpu/drm/bridge/ti-tfp410.c +++ b/drivers/gpu/drm/bridge/ti-tfp410.c @@ -29,6 +29,7 @@ struct tfp410 { struct drm_connector connector; unsigned int connector_type; + u32 bus_format; struct i2c_adapter *ddc; struct gpio_desc *hpd; int hpd_irq; @@ -139,6 +140,9 @@ static int tfp410_attach(struct drm_bridge *bridge) return ret; } + drm_display_info_set_bus_formats(&dvi->connector.display_info, + &dvi->bus_format, 1); + drm_connector_attach_encoder(&dvi->connector, bridge->encoder); @@ -197,6 +201,7 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) struct drm_bridge_timings *timings = &dvi->timings; struct device_node *ep; u32 pclk_sample = 0; + u32 bus_width = 24; s32 deskew = 0; /* Start with defaults. */ @@ -221,6 +226,7 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) /* Get the sampling edge from the endpoint. */ of_property_read_u32(ep, "pclk-sample", &pclk_sample); + of_property_read_u32(ep, "bus-width", &bus_width); of_node_put(ep); timings->input_bus_flags = DRM_BUS_FLAG_DE_HIGH; @@ -238,6 +244,17 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) return -EINVAL; } + switch (bus_width) { + case 12: + dvi->bus_format = MEDIA_BUS_FMT_RGB888_2X12_LE; + break; + case 24: + dvi->bus_format = MEDIA_BUS_FMT_RGB888_1X24; + break; + default: + return -EINVAL; + } + /* Get the setup and hold time from vendor-specific properties. */ of_property_read_u32(dvi->dev->of_node, "ti,deskew", (u32 *)&deskew); if (deskew < -4 || deskew > 3)
The TFP410 supports 24 bit, single-edge and 12 bit, dual-edge modes. Depending on how many wires are used (24/12) the driver can set the correct bus_format. If the information is not available in DT then assume 24 bit, single-edge setup. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> --- drivers/gpu/drm/bridge/ti-tfp410.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)