drm: msm+ti-sn65dsi86 support for NO_CONNECTOR
Subsystems (6)
v2 cover drm: msm+ti-sn65dsi86 support for NO_CONNECTOR
From: Rob Clark <[email protected]>
Respin of https://www.spinics.net/lists/linux-arm-msm/msg92182.html with the remaining 3 patches that are not yet merged.
At the end of this series, but drm/msm and ti-sn65dsi86 work in both combinations, so the two bridge patches can be merged indepdendently of the msm/dsi patch.
The last patch has some conficts with https://www.spinics.net/lists/linux-arm-msm/msg93731.html
but I already have a rebased variant of it depending on which order
patches land.
Rob Clark (3):
drm/msm/dsi: Support NO_CONNECTOR bridges drm/bridge: ti-sn65dsi86: Implement bridge->mode_valid() drm/bridge: ti-sn65dsi86: Add NO_CONNECTOR support
drivers/gpu/drm/bridge/ti-sn65dsi86.c | 64 ++++++++++++++++++--------- drivers/gpu/drm/msm/Kconfig | 2 + drivers/gpu/drm/msm/dsi/dsi_manager.c | 50 +++++++++++++++------ 3 files changed, 81 insertions(+), 35 deletions(-)
Signature · 1 line
2.31.1
PATCH v2 1/3 drm/msm/dsi: Support NO_CONNECTOR bridges
From: Rob Clark <[email protected]>
For now, since we have a mix of bridges which support this flag, which which do *not* support this flag, or work both ways, try it once with NO_CONNECTOR and then fall back to the old way if that doesn't work. Eventually we can drop the fallback path.
v2: Add missing drm_connector_attach_encoder() so display actually comes
up when the bridge properly handles the NO_CONNECTOR flag
--- drivers/gpu/drm/msm/Kconfig | 2 ++ drivers/gpu/drm/msm/dsi/dsi_manager.c | 50 ++++++++++++++++++++------- 2 files changed, 39 insertions(+), 13 deletions(-)
drivers/gpu/drm/msm/Kconfig +2 -0
@@ -14,6 +14,8 @@ config DRM_MSM select REGULATOR select DRM_KMS_HELPER select DRM_PANEL + select DRM_BRIDGE + select DRM_PANEL_BRIDGE select DRM_SCHED select SHMEM select TMPFS
drivers/gpu/drm/msm/dsi/dsi_manager.c +37 -13
75 lines not on this page · raw message
Signature · 1 line
2.31.1
PATCH v2 2/3 drm/bridge: ti-sn65dsi86: Implement bridge->mode_valid()
In reply to Rob ClarkFrom: Rob Clark <[email protected]>
For the brave new world of bridges not creating their own connectors, we need to implement the max clock limitation via bridge->mode_valid() instead of connector->mode_valid().
v2: Drop unneeded connector->mode_valid()
--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +13 -12
@@ -615,20 +615,8 @@ static int ti_sn_bridge_connector_get_modes(struct drm_connector *connector)return drm_bridge_get_modes (pdata->next_bridge, connector); } -static enum drm_mode_status -ti_sn_bridge_connector_mode_valid (struct drm_connector *connector, -struct drm_display_mode *mode) -{ -/* maximum supported resolution is 4K at 60 fps */ -if (mode->clock >594000 ) -return MODE_CLOCK_HIGH ; - -return MODE_OK ; -} -static struct drm_connector_helper_funcs ti_sn_bridge_connector_helper_funcs = { .get_modes = ti_sn_bridge_connector_get_modes, - .mode_valid = ti_sn_bridge_connector_mode_valid, };static const struct drm_connector_funcs ti_sn_bridge_connector_funcs = {
@@ -766,6 +754,18 @@ static void ti_sn_bridge_detach(struct drm_bridge *bridge)drm_dp_aux_unregister (&bridge_to_ti_sn65dsi86 (bridge)->aux); } +static enum drm_mode_status +ti_sn_bridge_mode_valid (struct drm_bridge *bridge, +const struct drm_display_info *info, +const struct drm_display_mode *mode) +{ +/* maximum supported resolution is 4K at 60 fps */ +if (mode->clock >594000 ) +return MODE_CLOCK_HIGH ; + +return MODE_OK ; +} +static void ti_sn_bridge_disable (struct drm_bridge *bridge) {struct ti_sn65dsi86 *pdata =bridge_to_ti_sn65dsi86 (bridge);
@@ -1127,6 +1127,7 @@ static void ti_sn_bridge_post_disable(struct drm_bridge *bridge)static const struct drm_bridge_funcs ti_sn_bridge_funcs = { .attach = ti_sn_bridge_attach, .detach = ti_sn_bridge_detach, + .mode_valid = ti_sn_bridge_mode_valid, .pre_enable = ti_sn_bridge_pre_enable, .enable = ti_sn_bridge_enable, .disable = ti_sn_bridge_disable,
Signature · 1 line
2.31.1
PATCH v2 3/3 drm/bridge: ti-sn65dsi86: Add NO_CONNECTOR support
In reply to Rob ClarkFrom: Rob Clark <[email protected]>
Slightly awkward to fish out the display_info when we aren't creating own connector. But I don't see an obvious better way.
v2: Remove error return with NO_CONNECTOR flag
--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 39 ++++++++++++++++++++------- 1 file changed, 29 insertions(+), 10 deletions(-)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +29 -10
@@ -667,11 +667,6 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge, .node = NULL, }; -if (flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ) { -DRM_ERROR ("Fix bridge driver to make connector optional!" ); -return -EINVAL ; - } - pdata->aux.drm_dev = bridge->dev; ret =drm_dp_aux_register (&pdata->aux);if (ret <0 ) {
@@ -679,9 +674,11 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge,return ret; } - ret =ti_sn_bridge_connector_init (pdata); -if (ret <0 ) - goto err_conn_init; +if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR )) { + ret =ti_sn_bridge_connector_init (pdata); +if (ret <0 ) + goto err_conn_init; + }/* * TODO: ideally finding host resource and dsi dev registration needs
@@ -743,7 +740,8 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge, err_dsi_attach:mipi_dsi_device_unregister (dsi); err_dsi_host: -drm_connector_cleanup (&pdata->connector); +if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR )) +drm_connector_cleanup (&pdata->connector); err_conn_init:drm_dp_aux_unregister (&pdata->aux);return ret;
@@ -792,9 +790,30 @@ static void ti_sn_bridge_set_dsi_rate(struct ti_sn65dsi86 *pdata)regmap_write (pdata->regmap,SN_DSIA_CLK_FREQ_REG , val); } +/* +* Find the connector and fish out the bpc from display_info. It would +* be nice if we could get this instead from drm_bridge_state, but that +* doesn't yet appear to be the case. +*/ static unsigned int ti_sn_bridge_get_bpp (struct ti_sn65dsi86 *pdata) { -if (pdata->connector.display_info.bpc <=6 ) +struct drm_bridge *bridge = &pdata->bridge; +struct drm_connector_list_iter conn_iter; +struct drm_connector *connector; +unsigned bpc =0 ; + +drm_connector_list_iter_begin (bridge->dev, &conn_iter); +drm_for_each_connector_iter (connector, &conn_iter) { +if (drm_connector_has_possible_encoder (connector, bridge->encoder)) { + bpc = connector->display_info.bpc; +break ; + } + } +drm_connector_list_iter_end (&conn_iter); + +WARN_ON (bpc ==0 ); + +if (bpc <=6 )return 18 ;else return 24 ;
Signature · 1 line
2.31.1
Re: [PATCH v2 3/3] drm/bridge: ti-sn65dsi86: Add NO_CONNECTOR support
Hi,
Quoted 6 lines · Rob Clark
From: Rob Clark <[email protected]>
Slightly awkward to fish out the
display_infowhen we aren't creating own connector. But I don't see an obvious better way.
Quoted 6 lines
v2: Remove error return with
NO_CONNECTORflagSigned-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 39 ++++++++++++++++++++------- 1 file changed, 29 insertions(+), 10 deletions(-)
This seems fine to me:
...if you would like me to apply patch #2 / #3 to drm-misc-next then please yell.
-Doug
Re: [PATCH v2 3/3] drm/bridge: ti-sn65dsi86: Add NO_CONNECTOR support
Quoted 17 lines · Doug Anderson
Hi,
Quoted 6 lines · Rob Clark
From: Rob Clark <[email protected]>
Slightly awkward to fish out the
display_infowhen we aren't creating own connector. But I don't see an obvious better way.Quoted 6 lines
v2: Remove error return with
NO_CONNECTORflagSigned-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 39 ++++++++++++++++++++------- 1 file changed, 29 insertions(+), 10 deletions(-)
Quoted 6 lines
This seems fine to me:
Reviewed-by Douglas Anderson <[email protected]>...if you would like me to apply patch #2 / #3 to drm-misc-next then please yell.
Thanks.. I think we can give it a few days for Laurent to have a look.
This will conflict some with Maxime's bridge vs dsi-host ordering series.. not sure how close that one is to the finish line, but I can rebase either patch on top of the other depending on which order they are applied
BR,
-R
Re: [PATCH v2 2/3] drm/bridge: ti-sn65dsi86: Implement bridge->mode_valid()
In reply to Rob ClarkHi Rob,
Thank you for the patch.
Quoted 10 lines · Rob Clark
From: Rob Clark <[email protected]>
For the brave new world of bridges not creating their own connectors, we need to implement the max clock limitation via
bridge->mode_valid()instead ofconnector->mode_valid().v2: Drop unneeded
connector->mode_valid()Signed-off-by Rob Clark <[email protected]>Reviewed-by Douglas Anderson <[email protected]>
Quoted 56 lines
--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)drivers/gpu/drm/bridge/ti-sn65dsi86.c +13
-12@@ -615,20 +615,8 @@ static int ti_sn_bridge_connector_get_modes(struct drm_connector *connector)return drm_bridge_get_modes (pdata->next_bridge, connector); } -static enum drm_mode_status -ti_sn_bridge_connector_mode_valid (struct drm_connector *connector, -struct drm_display_mode *mode) -{ -/* maximum supported resolution is 4K at 60 fps */ -if (mode->clock >594000 ) -return MODE_CLOCK_HIGH ; - -return MODE_OK ; -} -static struct drm_connector_helper_funcs ti_sn_bridge_connector_helper_funcs = { .get_modes = ti_sn_bridge_connector_get_modes, - .mode_valid = ti_sn_bridge_connector_mode_valid, };static const struct drm_connector_funcs ti_sn_bridge_connector_funcs = {@@ -766,6 +754,18 @@ static void ti_sn_bridge_detach(struct drm_bridge *bridge)drm_dp_aux_unregister (&bridge_to_ti_sn65dsi86 (bridge)->aux); } +static enum drm_mode_status +ti_sn_bridge_mode_valid (struct drm_bridge *bridge, +const struct drm_display_info *info, +const struct drm_display_mode *mode) +{ +/* maximum supported resolution is 4K at 60 fps */ +if (mode->clock >594000 ) +return MODE_CLOCK_HIGH ; + +return MODE_OK ; +} +static void ti_sn_bridge_disable (struct drm_bridge *bridge) {struct ti_sn65dsi86 *pdata =bridge_to_ti_sn65dsi86 (bridge);@@ -1127,6 +1127,7 @@ static void ti_sn_bridge_post_disable(struct drm_bridge *bridge)static const struct drm_bridge_funcs ti_sn_bridge_funcs = { .attach = ti_sn_bridge_attach, .detach = ti_sn_bridge_detach, + .mode_valid = ti_sn_bridge_mode_valid, .pre_enable = ti_sn_bridge_pre_enable, .enable = ti_sn_bridge_enable, .disable = ti_sn_bridge_disable,
Signature · 3 lines
Regards, Laurent Pinchart
Laurent Pinchart
reviewerRe: [PATCH v2 3/3] drm/bridge: ti-sn65dsi86: Add NO_CONNECTOR support
In reply to Rob ClarkHi Rob,
Thank you for the patch.
Quoted 44 lines · Rob Clark
From: Rob Clark <[email protected]>
Slightly awkward to fish out the
display_infowhen we aren't creating own connector. But I don't see an obvious better way.v2: Remove error return with
NO_CONNECTORflagSigned-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 39 ++++++++++++++++++++------- 1 file changed, 29 insertions(+), 10 deletions(-)drivers/gpu/drm/bridge/ti-sn65dsi86.c +5
-8@@ -667,11 +667,6 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge, .node = NULL, }; -if (flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ) { -DRM_ERROR ("Fix bridge driver to make connector optional!" ); -return -EINVAL ; - } - pdata->aux.drm_dev = bridge->dev; ret =drm_dp_aux_register (&pdata->aux);if (ret <0 ) {@@ -679,9 +674,11 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge,return ret; } - ret =ti_sn_bridge_connector_init (pdata); -if (ret <0 ) - goto err_conn_init; +if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR )) { + ret =ti_sn_bridge_connector_init (pdata); +if (ret <0 ) + goto err_conn_init; + }/* * TODO: ideally finding host resource and dsi dev registration needs
drivers/gpu/drm/bridge/ti-sn65dsi86.c static int ti_sn_bridge_attach(struct drm_bridge *bridge, · line 744
Quoted 6 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +2
-1@@ -743,7 +740,8 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge, err_dsi_attach:mipi_dsi_device_unregister (dsi); err_dsi_host: -drm_connector_cleanup (&pdata->connector); +if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR )) +drm_connector_cleanup (&pdata->connector);
I wonder if we actually need this. The connector gets attached to the encoder, won't it be destroyed by the DRM core in the error path ?
drivers/gpu/drm/bridge/ti-sn65dsi86.c static void ti_sn_bridge_set_dsi_rate(struct ti_sn65dsi86 *pdata) · line 796
Quoted 11 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +4
-0err_conn_init:drm_dp_aux_unregister (&pdata->aux);return ret;@@ -792,9 +790,30 @@ static void ti_sn_bridge_set_dsi_rate(struct ti_sn65dsi86 *pdata)regmap_write (pdata->regmap,SN_DSIA_CLK_FREQ_REG , val); } +/* +* Find the connector and fish out the bpc from display_info. It would +* be nice if we could get this instead from drm_bridge_state, but that +* doesn't yet appear to be the case.
You already have a bus format in the bridge state, from which you can derive the bpp. Could you give it a try ?
Quoted 24 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +18
-1+*/ static unsigned int ti_sn_bridge_get_bpp (struct ti_sn65dsi86 *pdata) { -if (pdata->connector.display_info.bpc <=6 ) +struct drm_bridge *bridge = &pdata->bridge; +struct drm_connector_list_iter conn_iter; +struct drm_connector *connector; +unsigned bpc =0 ; + +drm_connector_list_iter_begin (bridge->dev, &conn_iter); +drm_for_each_connector_iter (connector, &conn_iter) { +if (drm_connector_has_possible_encoder (connector, bridge->encoder)) { + bpc = connector->display_info.bpc; +break ; + } + } +drm_connector_list_iter_end (&conn_iter); + +WARN_ON (bpc ==0 ); + +if (bpc <=6 )return 18 ;else return 24 ;
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 3/3] drm/bridge: ti-sn65dsi86: Add NO_CONNECTOR support
In reply to Rob ClarkHi,
Quoted 25 lines · Rob Clark
Quoted 17 lines · Doug Anderson
Hi,
Quoted 6 lines · Rob Clark
From: Rob Clark <[email protected]>
Slightly awkward to fish out the
display_infowhen we aren't creating own connector. But I don't see an obvious better way.Quoted 6 lines
v2: Remove error return with
NO_CONNECTORflagSigned-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 39 ++++++++++++++++++++------- 1 file changed, 29 insertions(+), 10 deletions(-)Quoted 6 lines
This seems fine to me:
Reviewed-by Douglas Anderson <[email protected]>...if you would like me to apply patch #2 / #3 to drm-misc-next then please yell.
Quoted 6 lines
Thanks.. I think we can give it a few days for Laurent to have a look.
This will conflict some with Maxime's bridge vs dsi-host ordering series.. not sure how close that one is to the finish line, but I can rebase either patch on top of the other depending on which order they are applied
It's probably going to take a bit of time to get merged, so don't worry about this series and just go ahead, I'll rebase it on top of yours if needed.
Maxime
Re: [PATCH v2 3/3] drm/bridge: ti-sn65dsi86: Add NO_CONNECTOR support
In reply to Laurent PinchartQuoted 47 lines · Laurent Pinchart
Hi Rob,
Thank you for the patch.
Quoted 41 lines · Rob Clark
From: Rob Clark <[email protected]>
Slightly awkward to fish out the
display_infowhen we aren't creating own connector. But I don't see an obvious better way.v2: Remove error return with
NO_CONNECTORflagSigned-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 39 ++++++++++++++++++++------- 1 file changed, 29 insertions(+), 10 deletions(-)drivers/gpu/drm/bridge/ti-sn65dsi86.c +5
-8@@ -667,11 +667,6 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge, .node = NULL, }; -if (flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ) { -DRM_ERROR ("Fix bridge driver to make connector optional!" ); -return -EINVAL ; - } - pdata->aux.drm_dev = bridge->dev; ret =drm_dp_aux_register (&pdata->aux);if (ret <0 ) {@@ -679,9 +674,11 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge,return ret; } - ret =ti_sn_bridge_connector_init (pdata); -if (ret <0 ) - goto err_conn_init; +if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR )) { + ret =ti_sn_bridge_connector_init (pdata); +if (ret <0 ) + goto err_conn_init; + }
Quoted 12 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c static int ti_sn_bridge_attach(struct drm_bridge *bridge, · line 744
Quoted 9 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +2
-1/* * TODO: ideally finding host resource and dsi dev registration needs @@ -743,7 +740,8 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge, err_dsi_attach:mipi_dsi_device_unregister (dsi); err_dsi_host: -drm_connector_cleanup (&pdata->connector); +if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR )) +drm_connector_cleanup (&pdata->connector);I wonder if we actually need this. The connector gets attached to the encoder, won't it be destroyed by the DRM core in the error path ?
This does not appear to be the case, we leak the connector if I remove this (and add a hack to trigger the error path)
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +0
-0err_conn_init:drm_dp_aux_unregister (&pdata->aux);return ret;@@ -792,9 +790,30 @@ static void ti_sn_bridge_set_dsi_rate(struct ti_sn65dsi86 *pdata)regmap_write (pdata->regmap,SN_DSIA_CLK_FREQ_REG , val); }
Quoted 7 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c static void ti_sn_bridge_set_dsi_rate(struct ti_sn65dsi86 *pdata) · line 796
Quoted 4 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +4
-0+/* +* Find the connector and fish out the bpc from display_info. It would +* be nice if we could get this instead from drm_bridge_state, but that +* doesn't yet appear to be the case. You already have a bus format in the bridge state, from which you can derive the bpp. Could you give it a try ?
Possibly the bridge should be converted to ->atomic_enable(), etc.. I'll leave that for another time
BR,
-R
Quoted 29 lines
Quoted 14 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +11
-1+*/ static unsigned int ti_sn_bridge_get_bpp (struct ti_sn65dsi86 *pdata) { -if (pdata->connector.display_info.bpc <=6 ) +struct drm_bridge *bridge = &pdata->bridge; +struct drm_connector_list_iter conn_iter; +struct drm_connector *connector; +unsigned bpc =0 ; + +drm_connector_list_iter_begin (bridge->dev, &conn_iter); +drm_for_each_connector_iter (connector, &conn_iter) { +if (drm_connector_has_possible_encoder (connector, bridge->encoder)) { + bpc = connector->display_info.bpc; +break ;drivers/gpu/drm/bridge/ti-sn65dsi86.c static void ti_sn_bridge_set_dsi_rate(struct ti_sn65dsi86 *pdata) · line 819
Quoted 10 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +7
-0+ } + } +drm_connector_list_iter_end (&conn_iter); + +WARN_ON (bpc ==0 ); + +if (bpc <=6 )return 18 ;else return 24 ;--
Regards,Laurent Pinchart
Laurent Pinchart
reviewerRe: [PATCH v2 3/3] drm/bridge: ti-sn65dsi86: Add NO_CONNECTOR support
Hi Rob,
Quoted 56 lines · Rob Clark
Quoted 42 lines · Laurent Pinchart
Quoted 41 lines · Rob Clark
From: Rob Clark <[email protected]>
Slightly awkward to fish out the
display_infowhen we aren't creating own connector. But I don't see an obvious better way.v2: Remove error return with
NO_CONNECTORflagSigned-off-by Rob Clark <[email protected]>--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 39 ++++++++++++++++++++------- 1 file changed, 29 insertions(+), 10 deletions(-)drivers/gpu/drm/bridge/ti-sn65dsi86.c +5
-8@@ -667,11 +667,6 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge, .node = NULL, }; -if (flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ) { -DRM_ERROR ("Fix bridge driver to make connector optional!" ); -return -EINVAL ; - } - pdata->aux.drm_dev = bridge->dev; ret =drm_dp_aux_register (&pdata->aux);if (ret <0 ) {@@ -679,9 +674,11 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge,return ret; } - ret =ti_sn_bridge_connector_init (pdata); -if (ret <0 ) - goto err_conn_init; +if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR )) { + ret =ti_sn_bridge_connector_init (pdata); +if (ret <0 ) + goto err_conn_init; + }Quoted 12 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c static int ti_sn_bridge_attach(struct drm_bridge *bridge, · line 744
Quoted 9 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +2
-1/* * TODO: ideally finding host resource and dsi dev registration needs @@ -743,7 +740,8 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge, err_dsi_attach:mipi_dsi_device_unregister (dsi); err_dsi_host: -drm_connector_cleanup (&pdata->connector); +if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR )) +drm_connector_cleanup (&pdata->connector);I wonder if we actually need this. The connector gets attached to the encoder, won't it be destroyed by the DRM core in the error path ?
Quoted 2 lines
This does not appear to be the case, we leak the connector if I remove this (and add a hack to trigger the error path)
OK.
Quoted 15 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +0
-0err_conn_init:drm_dp_aux_unregister (&pdata->aux);return ret;@@ -792,9 +790,30 @@ static void ti_sn_bridge_set_dsi_rate(struct ti_sn65dsi86 *pdata)regmap_write (pdata->regmap,SN_DSIA_CLK_FREQ_REG , val); }Quoted 7 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c static void ti_sn_bridge_set_dsi_rate(struct ti_sn65dsi86 *pdata) · line 796
Quoted 4 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +4
-0+/* +* Find the connector and fish out the bpc from display_info. It would +* be nice if we could get this instead from drm_bridge_state, but that +* doesn't yet appear to be the case. You already have a bus format in the bridge state, from which you can derive the bpp. Could you give it a try ?
Quoted 2 lines
Possibly the bridge should be converted to ->atomic_enable(), etc.. I'll leave that for another time
It should be fairly straightforward, and would avoid the hack below.
Quoted 24 lines
Quoted 24 lines
Quoted 24 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +18
-1+*/ static unsigned int ti_sn_bridge_get_bpp (struct ti_sn65dsi86 *pdata) { -if (pdata->connector.display_info.bpc <=6 ) +struct drm_bridge *bridge = &pdata->bridge; +struct drm_connector_list_iter conn_iter; +struct drm_connector *connector; +unsigned bpc =0 ; + +drm_connector_list_iter_begin (bridge->dev, &conn_iter); +drm_for_each_connector_iter (connector, &conn_iter) { +if (drm_connector_has_possible_encoder (connector, bridge->encoder)) { + bpc = connector->display_info.bpc; +break ; + } + } +drm_connector_list_iter_end (&conn_iter); + +WARN_ON (bpc ==0 ); + +if (bpc <=6 )return 18 ;else return 24 ;
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v2 1/3] drm/msm/dsi: Support NO_CONNECTOR bridges
In reply to Rob ClarkQuoted 7 lines · Rob Clark
From: Rob Clark <[email protected]>
For now, since we have a mix of bridges which support this flag, which which do *not* support this flag, or work both ways, try it once with
NO_CONNECTORand then fall back to the old way if that doesn't work. Eventually we can drop the fallback path.
Quoted 5 lines
v2: Add missing
drm_connector_attach_encoder()so display actually comes
up when the bridge properly handles theNO_CONNECTORflagSigned-off-by Rob Clark <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>
I think this patch can go through the drm/msm, while two other patches would need to through the drm-misc. Is it correct?
Quoted 101 lines
--- drivers/gpu/drm/msm/Kconfig | 2 ++ drivers/gpu/drm/msm/dsi/dsi_manager.c | 50 ++++++++++++++++++++------- 2 files changed, 39 insertions(+), 13 deletions(-)drivers/gpu/drm/msm/Kconfig +2
-0@@ -14,6 +14,8 @@ config DRM_MSM select REGULATOR select DRM_KMS_HELPER select DRM_PANEL + select DRM_BRIDGE + select DRM_PANEL_BRIDGE select DRM_SCHED select SHMEM select TMPFSdrivers/gpu/drm/msm/dsi/dsi_manager.c +37
-13@@ -3,6 +3,8 @@* Copyright (c) 2015, The Linux Foundation. All rights reserved. */ +#include "drm/drm_bridge_connector.h" +#include "msm_kms.h" #include "dsi.h" @@ -688,10 +690,10 @@ struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id) {struct msm_dsi *msm_dsi =dsi_mgr_get_dsi (id);struct drm_device *dev = msm_dsi->dev; +struct drm_connector *connector;struct drm_encoder *encoder;struct drm_bridge *int_bridge, *ext_bridge; -struct drm_connector *connector; -struct list_head *connector_list; +int ret; int_bridge = msm_dsi->bridge; ext_bridge = msm_dsi->external_bridge =@@ -699,22 +701,44 @@ struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id) encoder = msm_dsi->encoder; -/* link the internal dsi bridge to the external bridge */ -drm_bridge_attach (encoder, ext_bridge, int_bridge,0 ); -/* -* we need the drm_connector created by the external bridge -* driver (or someone else) to feed it to our driver's -* priv->connector[] list, mainly for msm_fbdev_init() +* Try first to create the bridge without it creating its own +* connector.. currently some bridges support this, and others +* do not (and some support both modes) */ - connector_list = &dev->mode_config.connector_list; + ret =drm_bridge_attach (encoder, ext_bridge, int_bridge, +DRM_BRIDGE_ATTACH_NO_CONNECTOR ); +if (ret == -EINVAL ) { +struct drm_connector *connector; +struct list_head *connector_list; + +/* link the internal dsi bridge to the external bridge */ +drm_bridge_attach (encoder, ext_bridge, int_bridge,0 ); + +/* +* we need the drm_connector created by the external bridge +* driver (or someone else) to feed it to our driver's +* priv->connector[] list, mainly for msm_fbdev_init() +*/ + connector_list = &dev->mode_config.connector_list; -list_for_each_entry (connector, connector_list, head) { -if (drm_connector_has_possible_encoder (connector, encoder)) -return connector; +list_for_each_entry (connector, connector_list, head) { +if (drm_connector_has_possible_encoder (connector, encoder)) +return connector; + } + +return ERR_PTR (-ENODEV ); + } + + connector =drm_bridge_connector_init (dev, encoder); +if (IS_ERR (connector)) { +DRM_ERROR ("Unable to create bridge connector\n" ); +return ERR_CAST (connector); } -return ERR_PTR (-ENODEV ); +drm_connector_attach_encoder (connector, encoder); + +return connector; }void msm_dsi_manager_bridge_destroy (struct drm_bridge *bridge)
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v2 1/3] drm/msm/dsi: Support NO_CONNECTOR bridges
Quoted 12 lines · Dmitry Baryshkov
Quoted 10 lines · Rob Clark
From: Rob Clark <[email protected]>
For now, since we have a mix of bridges which support this flag, which which do *not* support this flag, or work both ways, try it once with
NO_CONNECTORand then fall back to the old way if that doesn't work. Eventually we can drop the fallback path.v2: Add missing
drm_connector_attach_encoder()so display actually comes
up when the bridge properly handles theNO_CONNECTORflag
Quoted 7 lines
Quoted 2 lines
Signed-off-by Rob Clark <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>Reviewed-by Dmitry Baryshkov <[email protected]>I think this patch can go through the drm/msm, while two other patches would need to through the drm-misc. Is it correct?
Correct, I made sure things worked in either order (ie. with msm patch but without bridge patches, and visa versa), so they can land through different trees
BR,
-R
Quoted 107 lines
Quoted 92 lines
--- drivers/gpu/drm/msm/Kconfig | 2 ++ drivers/gpu/drm/msm/dsi/dsi_manager.c | 50 ++++++++++++++++++++------- 2 files changed, 39 insertions(+), 13 deletions(-)drivers/gpu/drm/msm/Kconfig +2
-0@@ -14,6 +14,8 @@ config DRM_MSM select REGULATOR select DRM_KMS_HELPER select DRM_PANEL + select DRM_BRIDGE + select DRM_PANEL_BRIDGE select DRM_SCHED select SHMEM select TMPFSdrivers/gpu/drm/msm/dsi/dsi_manager.c +33
-12@@ -3,6 +3,8 @@* Copyright (c) 2015, The Linux Foundation. All rights reserved. */ +#include "drm/drm_bridge_connector.h" +#include "msm_kms.h" #include "dsi.h" @@ -688,10 +690,10 @@ struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id) {struct msm_dsi *msm_dsi =dsi_mgr_get_dsi (id);struct drm_device *dev = msm_dsi->dev; +struct drm_connector *connector;struct drm_encoder *encoder;struct drm_bridge *int_bridge, *ext_bridge; -struct drm_connector *connector; -struct list_head *connector_list; +int ret; int_bridge = msm_dsi->bridge; ext_bridge = msm_dsi->external_bridge =@@ -699,22 +701,44 @@ struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id) encoder = msm_dsi->encoder; -/* link the internal dsi bridge to the external bridge */ -drm_bridge_attach (encoder, ext_bridge, int_bridge,0 ); -/* -* we need the drm_connector created by the external bridge -* driver (or someone else) to feed it to our driver's -* priv->connector[] list, mainly for msm_fbdev_init() +* Try first to create the bridge without it creating its own +* connector.. currently some bridges support this, and others +* do not (and some support both modes) */ - connector_list = &dev->mode_config.connector_list; + ret =drm_bridge_attach (encoder, ext_bridge, int_bridge, +DRM_BRIDGE_ATTACH_NO_CONNECTOR ); +if (ret == -EINVAL ) { +struct drm_connector *connector; +struct list_head *connector_list; + +/* link the internal dsi bridge to the external bridge */ +drm_bridge_attach (encoder, ext_bridge, int_bridge,0 ); + +/* +* we need the drm_connector created by the external bridge +* driver (or someone else) to feed it to our driver's +* priv->connector[] list, mainly for msm_fbdev_init() +*/ + connector_list = &dev->mode_config.connector_list; -list_for_each_entry (connector, connector_list, head) { -if (drm_connector_has_possible_encoder (connector, encoder)) -return connector; +list_for_each_entry (connector, connector_list, head) { +if (drm_connector_has_possible_encoder (connector, encoder)) +return connector; + } + +return ERR_PTR (-ENODEV ); + } + + connector =drm_bridge_connector_init (dev, encoder); +if (IS_ERR (connector)) { +DRM_ERROR ("Unable to create bridge connector\n" );drivers/gpu/drm/msm/dsi/dsi_manager.c struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id) · line 744
Quoted 10 lines
drivers/gpu/drm/msm/dsi/dsi_manager.c +4
-1+return ERR_CAST (connector); } -return ERR_PTR (-ENODEV ); +drm_connector_attach_encoder (connector, encoder); + +return connector; }void msm_dsi_manager_bridge_destroy (struct drm_bridge *bridge)--
With best wishes
Dmitry
Doug Anderson
reviewerRe: [PATCH v2 2/3] drm/bridge: ti-sn65dsi86: Implement bridge->mode_valid()
In reply to Laurent PinchartHi,
Quoted 12 lines · Laurent Pinchart
Hi Rob,
Thank you for the patch.
Quoted 6 lines · Rob Clark
From: Rob Clark <[email protected]>
For the brave new world of bridges not creating their own connectors, we need to implement the max clock limitation via
bridge->mode_valid()instead ofconnector->mode_valid().
Quoted 10 lines
Quoted 4 lines
v2: Drop unneeded
connector->mode_valid()Signed-off-by Rob Clark <[email protected]>Reviewed-by Douglas Anderson <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>Quoted 3 lines
--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
There's no reason to wait on this patch. Landed to drm-misc-next.
77d40e0176a5 drm/bridge: ti-sn65dsi86: Implement bridge->mode_valid()
-Doug
Doug Anderson
reviewerRe: [PATCH v2 3/3] drm/bridge: ti-sn65dsi86: Add NO_CONNECTOR support
In reply to Laurent PinchartHi,
Quoted 16 lines · Laurent Pinchart
Quoted 16 lines
Quoted 15 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c static void ti_sn_bridge_set_dsi_rate(struct ti_sn65dsi86 *pdata) · line 796
Quoted 12 lines
err_conn_init:drm_dp_aux_unregister(&pdata->aux); return ret;drivers/gpu/drm/bridge/ti-sn65dsi86.c +4
-0@@ -792,9 +790,30 @@ static void ti_sn_bridge_set_dsi_rate(struct ti_sn65dsi86 *pdata)regmap_write (pdata->regmap,SN_DSIA_CLK_FREQ_REG , val); } +/* +* Find the connector and fish out the bpc from display_info. It would +* be nice if we could get this instead from drm_bridge_state, but that +* doesn't yet appear to be the case. You already have a bus format in the bridge state, from which you can derive the bpp. Could you give it a try ?
Quoted 4 lines
Quoted 2 lines
Possibly the bridge should be converted to ->atomic_enable(), etc.. I'll leave that for another time
It should be fairly straightforward, and would avoid the hack below.
Given this point of controversy, my inclination is to wait and not apply this patch now. I don't think there's anything urgent here, right? Worst case eventually Laurent might pick it up in his patch series? At least we know it will work with the MSM driver once patch #1 lands. :-)
-Doug
Laurent Pinchart
reviewerRe: [PATCH v2 3/3] drm/bridge: ti-sn65dsi86: Add NO_CONNECTOR support
Hi Doug,
Quoted 20 lines · Doug Anderson
Quoted 19 lines · Laurent Pinchart
Quoted 18 lines
Quoted 8 lines
Quoted 8 lines
err_conn_init:drm_dp_aux_unregister(&pdata->aux); return ret;drivers/gpu/drm/bridge/ti-sn65dsi86.c +0
-0@@ -792,9 +790,30 @@ static void ti_sn_bridge_set_dsi_rate(struct ti_sn65dsi86 *pdata)regmap_write (pdata->regmap,SN_DSIA_CLK_FREQ_REG , val); }Quoted 7 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c static void ti_sn_bridge_set_dsi_rate(struct ti_sn65dsi86 *pdata) · line 796
Quoted 4 lines
drivers/gpu/drm/bridge/ti-sn65dsi86.c +4
-0+/* +* Find the connector and fish out the bpc from display_info. It would +* be nice if we could get this instead from drm_bridge_state, but that +* doesn't yet appear to be the case. You already have a bus format in the bridge state, from which you can derive the bpp. Could you give it a try ?
Possibly the bridge should be converted to ->atomic_enable(), etc.. I'll leave that for another time
Quoted 7 lines
Quoted 1 line
It should be fairly straightforward, and would avoid the hack below.
Given this point of controversy, my inclination is to wait and not apply this patch now. I don't think there's anything urgent here, right? Worst case eventually Laurent might pick it up in his patch series? At least we know it will work with the MSM driver once patch #1 lands. :-)
I've recorded the task for my upcoming work on the ti-sn65dsi86 driver.
Signature · 3 lines
Regards, Laurent Pinchart