Re: [PATCH v6 22/24] drm/amdgpu: Provide ddc symlink in connector sysfs directory

2019-07-26 Thread Alex Deucher
On Fri, Jul 26, 2019 at 3:42 PM Andrzej Pietrasiewicz
 wrote:
>
> Hi Alex,
>
>
> W dniu 26.07.2019 o 21:28, Alex Deucher pisze:
> > On Fri, Jul 26, 2019 at 1:28 PM Andrzej Pietrasiewicz
> >  wrote:
> >>
> >> Use the ddc pointer provided by the generic connector.
> >>
> >> Signed-off-by: Andrzej Pietrasiewicz 
> >
> > Note that this only covers the legacy display code.  The new DC
> > display code also needs to be converted.  See:
> > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
>
> In amdgpu_dm_connector_init() the ddc is &i2c->base, is it?

Yes.

>
> But it is not clear to me how can I find ddc pointer in
> dm_dp_add_mst_connector()?

+ Harry and Nick.

hmmm, not sure about MST.  Maybe just skip them for now.

Alex

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

Re: [PATCH v6 22/24] drm/amdgpu: Provide ddc symlink in connector sysfs directory

2019-07-26 Thread Andrzej Pietrasiewicz

Hi Alex,


W dniu 26.07.2019 o 21:28, Alex Deucher pisze:

On Fri, Jul 26, 2019 at 1:28 PM Andrzej Pietrasiewicz
 wrote:


Use the ddc pointer provided by the generic connector.

Signed-off-by: Andrzej Pietrasiewicz 


Note that this only covers the legacy display code.  The new DC
display code also needs to be converted.  See:
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c


In amdgpu_dm_connector_init() the ddc is &i2c->base, is it?

But it is not clear to me how can I find ddc pointer in
dm_dp_add_mst_connector()?

Andrzej

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

Re: [PATCH v6 22/24] drm/amdgpu: Provide ddc symlink in connector sysfs directory

2019-07-26 Thread Alex Deucher
On Fri, Jul 26, 2019 at 1:28 PM Andrzej Pietrasiewicz
 wrote:
>
> Use the ddc pointer provided by the generic connector.
>
> Signed-off-by: Andrzej Pietrasiewicz 

Note that this only covers the legacy display code.  The new DC
display code also needs to be converted.  See:
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
With those updated as well:
Acked-by: Alex Deucher 

> ---
>  .../gpu/drm/amd/amdgpu/amdgpu_connectors.c| 96 ++-
>  1 file changed, 70 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c 
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> index 73b2ede773d3..ece55c8fa673 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
> @@ -1505,6 +1505,7 @@ amdgpu_connector_add(struct amdgpu_device *adev,
> struct amdgpu_connector_atom_dig *amdgpu_dig_connector;
> struct drm_encoder *encoder;
> struct amdgpu_encoder *amdgpu_encoder;
> +   struct i2c_adapter *ddc = NULL;
> uint32_t subpixel_order = SubPixelNone;
> bool shared_ddc = false;
> bool is_dp_bridge = false;
> @@ -1574,17 +1575,21 @@ amdgpu_connector_add(struct amdgpu_device *adev,
> amdgpu_connector->con_priv = amdgpu_dig_connector;
> if (i2c_bus->valid) {
> amdgpu_connector->ddc_bus = amdgpu_i2c_lookup(adev, 
> i2c_bus);
> -   if (amdgpu_connector->ddc_bus)
> +   if (amdgpu_connector->ddc_bus) {
> has_aux = true;
> -   else
> +   ddc = &amdgpu_connector->ddc_bus->adapter;
> +   } else {
> DRM_ERROR("DP: Failed to assign ddc bus! 
> Check dmesg for i2c errors.\n");
> +   }
> }
> switch (connector_type) {
> case DRM_MODE_CONNECTOR_VGA:
> case DRM_MODE_CONNECTOR_DVIA:
> default:
> -   drm_connector_init(dev, &amdgpu_connector->base,
> -  &amdgpu_connector_dp_funcs, 
> connector_type);
> +   drm_connector_init_with_ddc(dev, 
> &amdgpu_connector->base,
> +   
> &amdgpu_connector_dp_funcs,
> +   connector_type,
> +   ddc);
> drm_connector_helper_add(&amdgpu_connector->base,
>  
> &amdgpu_connector_dp_helper_funcs);
> connector->interlace_allowed = true;
> @@ -1602,8 +1607,10 @@ amdgpu_connector_add(struct amdgpu_device *adev,
> case DRM_MODE_CONNECTOR_HDMIA:
> case DRM_MODE_CONNECTOR_HDMIB:
> case DRM_MODE_CONNECTOR_DisplayPort:
> -   drm_connector_init(dev, &amdgpu_connector->base,
> -  &amdgpu_connector_dp_funcs, 
> connector_type);
> +   drm_connector_init_with_ddc(dev, 
> &amdgpu_connector->base,
> +   
> &amdgpu_connector_dp_funcs,
> +   connector_type,
> +   ddc);
> drm_connector_helper_add(&amdgpu_connector->base,
>  
> &amdgpu_connector_dp_helper_funcs);
> 
> drm_object_attach_property(&amdgpu_connector->base.base,
> @@ -1644,8 +1651,10 @@ amdgpu_connector_add(struct amdgpu_device *adev,
> break;
> case DRM_MODE_CONNECTOR_LVDS:
> case DRM_MODE_CONNECTOR_eDP:
> -   drm_connector_init(dev, &amdgpu_connector->base,
> -  &amdgpu_connector_edp_funcs, 
> connector_type);
> +   drm_connector_init_with_ddc(dev, 
> &amdgpu_connector->base,
> +   
> &amdgpu_connector_edp_funcs,
> +   connector_type,
> +   ddc);
> drm_connector_helper_add(&amdgpu_connector->base,
>  
> &amdgpu_connector_dp_helper_funcs);
> 
> drm_object_attach_property(&amdgpu_connector->base.base,
> @@ -1659,13 +1668,18 @@ amdgpu_connector_add(struct amdgpu_device *adev,
> } else {
> switch (connector_type) {
> case DRM_MODE_CONNECTOR_VGA:
> -   drm_connector_init(dev, &amdgpu_connector->base, 
> &amdgpu_connector_vga_f

[PATCH v6 22/24] drm/amdgpu: Provide ddc symlink in connector sysfs directory

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

Signed-off-by: Andrzej Pietrasiewicz 
---
 .../gpu/drm/amd/amdgpu/amdgpu_connectors.c| 96 ++-
 1 file changed, 70 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c 
b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
index 73b2ede773d3..ece55c8fa673 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c
@@ -1505,6 +1505,7 @@ amdgpu_connector_add(struct amdgpu_device *adev,
struct amdgpu_connector_atom_dig *amdgpu_dig_connector;
struct drm_encoder *encoder;
struct amdgpu_encoder *amdgpu_encoder;
+   struct i2c_adapter *ddc = NULL;
uint32_t subpixel_order = SubPixelNone;
bool shared_ddc = false;
bool is_dp_bridge = false;
@@ -1574,17 +1575,21 @@ amdgpu_connector_add(struct amdgpu_device *adev,
amdgpu_connector->con_priv = amdgpu_dig_connector;
if (i2c_bus->valid) {
amdgpu_connector->ddc_bus = amdgpu_i2c_lookup(adev, 
i2c_bus);
-   if (amdgpu_connector->ddc_bus)
+   if (amdgpu_connector->ddc_bus) {
has_aux = true;
-   else
+   ddc = &amdgpu_connector->ddc_bus->adapter;
+   } else {
DRM_ERROR("DP: Failed to assign ddc bus! Check 
dmesg for i2c errors.\n");
+   }
}
switch (connector_type) {
case DRM_MODE_CONNECTOR_VGA:
case DRM_MODE_CONNECTOR_DVIA:
default:
-   drm_connector_init(dev, &amdgpu_connector->base,
-  &amdgpu_connector_dp_funcs, 
connector_type);
+   drm_connector_init_with_ddc(dev, 
&amdgpu_connector->base,
+   &amdgpu_connector_dp_funcs,
+   connector_type,
+   ddc);
drm_connector_helper_add(&amdgpu_connector->base,
 
&amdgpu_connector_dp_helper_funcs);
connector->interlace_allowed = true;
@@ -1602,8 +1607,10 @@ amdgpu_connector_add(struct amdgpu_device *adev,
case DRM_MODE_CONNECTOR_HDMIA:
case DRM_MODE_CONNECTOR_HDMIB:
case DRM_MODE_CONNECTOR_DisplayPort:
-   drm_connector_init(dev, &amdgpu_connector->base,
-  &amdgpu_connector_dp_funcs, 
connector_type);
+   drm_connector_init_with_ddc(dev, 
&amdgpu_connector->base,
+   &amdgpu_connector_dp_funcs,
+   connector_type,
+   ddc);
drm_connector_helper_add(&amdgpu_connector->base,
 
&amdgpu_connector_dp_helper_funcs);
drm_object_attach_property(&amdgpu_connector->base.base,
@@ -1644,8 +1651,10 @@ amdgpu_connector_add(struct amdgpu_device *adev,
break;
case DRM_MODE_CONNECTOR_LVDS:
case DRM_MODE_CONNECTOR_eDP:
-   drm_connector_init(dev, &amdgpu_connector->base,
-  &amdgpu_connector_edp_funcs, 
connector_type);
+   drm_connector_init_with_ddc(dev, 
&amdgpu_connector->base,
+   &amdgpu_connector_edp_funcs,
+   connector_type,
+   ddc);
drm_connector_helper_add(&amdgpu_connector->base,
 
&amdgpu_connector_dp_helper_funcs);
drm_object_attach_property(&amdgpu_connector->base.base,
@@ -1659,13 +1668,18 @@ amdgpu_connector_add(struct amdgpu_device *adev,
} else {
switch (connector_type) {
case DRM_MODE_CONNECTOR_VGA:
-   drm_connector_init(dev, &amdgpu_connector->base, 
&amdgpu_connector_vga_funcs, connector_type);
-   drm_connector_helper_add(&amdgpu_connector->base, 
&amdgpu_connector_vga_helper_funcs);
if (i2c_bus->valid) {
amdgpu_connector->ddc_bus = 
amdgpu_i2c_lookup(adev, i2c_bus);
if (!amdgpu_connector->ddc_bus)
DRM_ERROR("VGA: Failed to assign ddc 
bus! Check dmesg for i2c errors.\n");
+   else
+