Re: [PATCH v4 19/23] drm/bridge: dw-hdmi: Provide ddc symlink in connector sysfs directory

2019-07-31 Thread Neil Armstrong
Hi,

On 30/07/2019 19:30, Sam Ravnborg wrote:
> Hi Neil.
> 
>>> Signed-off-by: Andrzej Pietrasiewicz 
>>> ---
>>>  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 40 +++
>>>  1 file changed, 20 insertions(+), 20 deletions(-)
>>>
> ...
>>
>> Reviewed-by: Neil Armstrong 
> 
> There is now a much simpler v6 of this patch.
> Care to take a look and ack/r-b?

I saw it too late, I reviewed the bridge patches, now
I'll have a look at the whole patchset.

Neil

> 
>   Sam
> 

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v4 19/23] drm/bridge: dw-hdmi: Provide ddc symlink in connector sysfs directory

2019-07-30 Thread Sam Ravnborg
Hi Neil.

> > Signed-off-by: Andrzej Pietrasiewicz 
> > ---
> >  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 40 +++
> >  1 file changed, 20 insertions(+), 20 deletions(-)
> > 
...
> 
> Reviewed-by: Neil Armstrong 

There is now a much simpler v6 of this patch.
Care to take a look and ack/r-b?

Sam
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH v4 19/23] drm/bridge: dw-hdmi: Provide ddc symlink in connector sysfs directory

2019-07-30 Thread Neil Armstrong
On 11/07/2019 13:26, Andrzej Pietrasiewicz wrote:
> Use the ddc pointer provided by the generic connector.
> 
> Signed-off-by: Andrzej Pietrasiewicz 
> ---
>  drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 40 +++
>  1 file changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 
> b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index c6490949d9db..0b9c9f2619da 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -161,7 +161,6 @@ struct dw_hdmi {
>  
>   struct drm_display_mode previous_mode;
>  
> - struct i2c_adapter *ddc;
>   void __iomem *regs;
>   bool sink_is_hdmi;
>   bool sink_has_audio;
> @@ -1118,7 +1117,7 @@ static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi)
>   return false;
>  
>   /* Disable if no DDC bus */
> - if (!hdmi->ddc)
> + if (!hdmi->connector.ddc)
>   return false;
>  
>   /* Disable if SCDC is not supported, or if an HF-VSDB block is absent */
> @@ -1156,10 +1155,11 @@ void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi 
> *hdmi)
>  
>   /* Control for TMDS Bit Period/TMDS Clock-Period Ratio */
>   if (dw_hdmi_support_scdc(hdmi)) {
> + struct i2c_adapter *ddc = hdmi->connector.ddc;
>   if (mtmdsclock > HDMI14_MAX_TMDSCLK)
> - drm_scdc_set_high_tmds_clock_ratio(hdmi->ddc, 1);
> + drm_scdc_set_high_tmds_clock_ratio(ddc, 1);
>   else
> - drm_scdc_set_high_tmds_clock_ratio(hdmi->ddc, 0);
> + drm_scdc_set_high_tmds_clock_ratio(ddc, 0);
>   }
>  }
>  EXPORT_SYMBOL_GPL(dw_hdmi_set_high_tmds_clock_ratio);
> @@ -1750,6 +1750,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
>   if (dw_hdmi_support_scdc(hdmi)) {
>   if (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK ||
>   hdmi_info->scdc.scrambling.low_rates) {
> + struct i2c_adapter *ddc = hdmi->connector.ddc;
>   /*
>* HDMI2.0 Specifies the following procedure:
>* After the Source Device has determined that
> @@ -1759,13 +1760,12 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
>* Source Devices compliant shall set the
>* Source Version = 1.
>*/
> - drm_scdc_readb(hdmi->ddc, SCDC_SINK_VERSION,
> -);
> - drm_scdc_writeb(hdmi->ddc, SCDC_SOURCE_VERSION,
> + drm_scdc_readb(ddc, SCDC_SINK_VERSION, );
> + drm_scdc_writeb(ddc, SCDC_SOURCE_VERSION,
>   min_t(u8, bytes, SCDC_MIN_SOURCE_VERSION));
>  
>   /* Enabled Scrambling in the Sink */
> - drm_scdc_set_scrambling(hdmi->ddc, 1);
> + drm_scdc_set_scrambling(hdmi->connector.ddc, 1);
>  
>   /*
>* To activate the scrambler feature, you must ensure
> @@ -1781,7 +1781,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
>   hdmi_writeb(hdmi, 0, HDMI_FC_SCRAMBLER_CTRL);
>   hdmi_writeb(hdmi, (u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ,
>   HDMI_MC_SWRSTZ);
> - drm_scdc_set_scrambling(hdmi->ddc, 0);
> + drm_scdc_set_scrambling(hdmi->connector.ddc, 0);
>   }
>   }
>  
> @@ -2127,10 +2127,10 @@ static int dw_hdmi_connector_get_modes(struct 
> drm_connector *connector)
>   struct edid *edid;
>   int ret = 0;
>  
> - if (!hdmi->ddc)
> + if (!hdmi->connector.ddc)
>   return 0;
>  
> - edid = drm_get_edid(connector, hdmi->ddc);
> + edid = drm_get_edid(connector, hdmi->connector.ddc);
>   if (edid) {
>   dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n",
>   edid->width_cm, edid->height_cm);
> @@ -2548,9 +2548,9 @@ __dw_hdmi_probe(struct platform_device *pdev,
>  
>   ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
>   if (ddc_node) {
> - hdmi->ddc = of_get_i2c_adapter_by_node(ddc_node);
> + hdmi->connector.ddc = of_get_i2c_adapter_by_node(ddc_node);
>   of_node_put(ddc_node);
> - if (!hdmi->ddc) {
> + if (!hdmi->connector.ddc) {
>   dev_dbg(hdmi->dev, "failed to read ddc node\n");
>   return ERR_PTR(-EPROBE_DEFER);
>   }
> @@ -2689,7 +2689,7 @@ __dw_hdmi_probe(struct platform_device *pdev,
>   hdmi_init_clk_regenerator(hdmi);
>  
>   /* If DDC bus is not specified, try to register HDMI I2C bus */
> - if (!hdmi->ddc) {
> + if (!hdmi->connector.ddc) {
>   /* Look for (optional) stuff related to unwedging */
>  

[PATCH v4 19/23] drm/bridge: dw-hdmi: Provide ddc symlink in connector sysfs directory

2019-07-11 Thread Andrzej Pietrasiewicz
Use the ddc pointer provided by the generic connector.

Signed-off-by: Andrzej Pietrasiewicz 
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 40 +++
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c 
b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index c6490949d9db..0b9c9f2619da 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -161,7 +161,6 @@ struct dw_hdmi {
 
struct drm_display_mode previous_mode;
 
-   struct i2c_adapter *ddc;
void __iomem *regs;
bool sink_is_hdmi;
bool sink_has_audio;
@@ -1118,7 +1117,7 @@ static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi)
return false;
 
/* Disable if no DDC bus */
-   if (!hdmi->ddc)
+   if (!hdmi->connector.ddc)
return false;
 
/* Disable if SCDC is not supported, or if an HF-VSDB block is absent */
@@ -1156,10 +1155,11 @@ void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi 
*hdmi)
 
/* Control for TMDS Bit Period/TMDS Clock-Period Ratio */
if (dw_hdmi_support_scdc(hdmi)) {
+   struct i2c_adapter *ddc = hdmi->connector.ddc;
if (mtmdsclock > HDMI14_MAX_TMDSCLK)
-   drm_scdc_set_high_tmds_clock_ratio(hdmi->ddc, 1);
+   drm_scdc_set_high_tmds_clock_ratio(ddc, 1);
else
-   drm_scdc_set_high_tmds_clock_ratio(hdmi->ddc, 0);
+   drm_scdc_set_high_tmds_clock_ratio(ddc, 0);
}
 }
 EXPORT_SYMBOL_GPL(dw_hdmi_set_high_tmds_clock_ratio);
@@ -1750,6 +1750,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
if (dw_hdmi_support_scdc(hdmi)) {
if (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK ||
hdmi_info->scdc.scrambling.low_rates) {
+   struct i2c_adapter *ddc = hdmi->connector.ddc;
/*
 * HDMI2.0 Specifies the following procedure:
 * After the Source Device has determined that
@@ -1759,13 +1760,12 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
 * Source Devices compliant shall set the
 * Source Version = 1.
 */
-   drm_scdc_readb(hdmi->ddc, SCDC_SINK_VERSION,
-  );
-   drm_scdc_writeb(hdmi->ddc, SCDC_SOURCE_VERSION,
+   drm_scdc_readb(ddc, SCDC_SINK_VERSION, );
+   drm_scdc_writeb(ddc, SCDC_SOURCE_VERSION,
min_t(u8, bytes, SCDC_MIN_SOURCE_VERSION));
 
/* Enabled Scrambling in the Sink */
-   drm_scdc_set_scrambling(hdmi->ddc, 1);
+   drm_scdc_set_scrambling(hdmi->connector.ddc, 1);
 
/*
 * To activate the scrambler feature, you must ensure
@@ -1781,7 +1781,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
hdmi_writeb(hdmi, 0, HDMI_FC_SCRAMBLER_CTRL);
hdmi_writeb(hdmi, (u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ,
HDMI_MC_SWRSTZ);
-   drm_scdc_set_scrambling(hdmi->ddc, 0);
+   drm_scdc_set_scrambling(hdmi->connector.ddc, 0);
}
}
 
@@ -2127,10 +2127,10 @@ static int dw_hdmi_connector_get_modes(struct 
drm_connector *connector)
struct edid *edid;
int ret = 0;
 
-   if (!hdmi->ddc)
+   if (!hdmi->connector.ddc)
return 0;
 
-   edid = drm_get_edid(connector, hdmi->ddc);
+   edid = drm_get_edid(connector, hdmi->connector.ddc);
if (edid) {
dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n",
edid->width_cm, edid->height_cm);
@@ -2548,9 +2548,9 @@ __dw_hdmi_probe(struct platform_device *pdev,
 
ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
if (ddc_node) {
-   hdmi->ddc = of_get_i2c_adapter_by_node(ddc_node);
+   hdmi->connector.ddc = of_get_i2c_adapter_by_node(ddc_node);
of_node_put(ddc_node);
-   if (!hdmi->ddc) {
+   if (!hdmi->connector.ddc) {
dev_dbg(hdmi->dev, "failed to read ddc node\n");
return ERR_PTR(-EPROBE_DEFER);
}
@@ -2689,7 +2689,7 @@ __dw_hdmi_probe(struct platform_device *pdev,
hdmi_init_clk_regenerator(hdmi);
 
/* If DDC bus is not specified, try to register HDMI I2C bus */
-   if (!hdmi->ddc) {
+   if (!hdmi->connector.ddc) {
/* Look for (optional) stuff related to unwedging */
hdmi->pinctrl = devm_pinctrl_get(dev);
if (!IS_ERR(hdmi->pinctrl)) {
@@ -2708,9 +2708,9 @@