These two patches are needed to make tc358767 work in the
DRM_BRIDGE_ATTACH_NO_CONNECTOR case, at least when using a DP connector.
The first patch, "drm/bridge: tc358767: Support input format negotiation
hook" was already sent separately, but I included it here for
completeness, as both are needed to get a working display.
I have tested this with TI AM654 EVM with a tc358767 add-on card.
Signed-off-by: Tomi Valkeinen <[email protected]>
---
Aradhya Bhatia (1):
drm/bridge: tc358767: Support input format negotiation hook
Tomi Valkeinen (1):
drm/bridge: tc358767: Fix link properties discovery
drivers/gpu/drm/bridge/tc358767.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
---
base-commit: 79d94360d50fcd487edcfe118a47a2881534923f
change-id: 20231031-tc358767-58e3ebdf95f0
Best regards,
--
Tomi Valkeinen <[email protected]>
From: Aradhya Bhatia <[email protected]>
With new connector model, tc358767 will not create the connector, when
DRM_BRIDGE_ATTACH_NO_CONNECTOR is set and display-controller driver will
rely on format negotiation to setup the encoder format.
Add the missing input-format negotiation hook in the
drm_bridge_funcs to complete DRM_BRIDGE_ATTACH_NO_CONNECTOR support.
Input format is selected to MEDIA_BUS_FMT_RGB888_1X24 as default, as is
the case with older model.
Reported-by: Jan Kiszka <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]/
Signed-off-by: Aradhya Bhatia <[email protected]>
Signed-off-by: Tomi Valkeinen <[email protected]>
---
drivers/gpu/drm/bridge/tc358767.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
index ef2e373606ba..0affcefdeb1c 100644
--- a/drivers/gpu/drm/bridge/tc358767.c
+++ b/drivers/gpu/drm/bridge/tc358767.c
@@ -1751,6 +1751,30 @@ tc_dpi_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
return input_fmts;
}
+static u32 *
+tc_edp_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
+ struct drm_bridge_state *bridge_state,
+ struct drm_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state,
+ u32 output_fmt,
+ unsigned int *num_input_fmts)
+{
+ u32 *input_fmts;
+
+ *num_input_fmts = 0;
+
+ input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts),
+ GFP_KERNEL);
+ if (!input_fmts)
+ return NULL;
+
+ /* This is the DSI/DPI-end bus format */
+ input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
+ *num_input_fmts = 1;
+
+ return input_fmts;
+}
+
static const struct drm_bridge_funcs tc_dpi_bridge_funcs = {
.attach = tc_dpi_bridge_attach,
.mode_valid = tc_dpi_mode_valid,
@@ -1777,6 +1801,7 @@ static const struct drm_bridge_funcs tc_edp_bridge_funcs = {
.atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
.atomic_reset = drm_atomic_helper_bridge_reset,
+ .atomic_get_input_bus_fmts = tc_edp_atomic_get_input_bus_fmts,
};
static bool tc_readable_reg(struct device *dev, unsigned int reg)
--
2.34.1
When a display controller driver uses DRM_BRIDGE_ATTACH_NO_CONNECTOR,
tc358767 will behave properly and skip the creation of the connector.
However, tc_get_display_props(), which is used to find out about the DP
monitor and link, is only called from two places: .atomic_enable() and
tc_connector_get_modes(). The latter is only used when tc358767 creates
its own connector, i.e. when DRM_BRIDGE_ATTACH_NO_CONNECTOR is _not_
set.
Thus, the driver never finds out the link properties before get_edid()
is called. With num_lanes of 0 and link_rate of 0 there are not many
valid modes...
Fix this by adding tc_connector_get_modes() call at the beginning of
get_edid(), so that we have up to date information before looking at the
modes.
Reported-by: Jan Kiszka <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]/
Signed-off-by: Tomi Valkeinen <[email protected]>
---
drivers/gpu/drm/bridge/tc358767.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
index 0affcefdeb1c..137a9f5e3cad 100644
--- a/drivers/gpu/drm/bridge/tc358767.c
+++ b/drivers/gpu/drm/bridge/tc358767.c
@@ -1579,6 +1579,13 @@ static struct edid *tc_get_edid(struct drm_bridge *bridge,
struct drm_connector *connector)
{
struct tc_data *tc = bridge_to_tc(bridge);
+ int ret;
+
+ ret = tc_get_display_props(tc);
+ if (ret < 0) {
+ dev_err(tc->dev, "failed to read display props: %d\n", ret);
+ return 0;
+ }
return drm_get_edid(connector, &tc->aux.ddc);
}
--
2.34.1
On 31.10.23 14:26, Tomi Valkeinen wrote:
> These two patches are needed to make tc358767 work in the
> DRM_BRIDGE_ATTACH_NO_CONNECTOR case, at least when using a DP connector.
> The first patch, "drm/bridge: tc358767: Support input format negotiation
> hook" was already sent separately, but I included it here for
> completeness, as both are needed to get a working display.
>
> I have tested this with TI AM654 EVM with a tc358767 add-on card.
>
> Signed-off-by: Tomi Valkeinen <[email protected]>
> ---
> Aradhya Bhatia (1):
> drm/bridge: tc358767: Support input format negotiation hook
>
> Tomi Valkeinen (1):
> drm/bridge: tc358767: Fix link properties discovery
>
> drivers/gpu/drm/bridge/tc358767.c | 32 ++++++++++++++++++++++++++++++++
> 1 file changed, 32 insertions(+)
> ---
> base-commit: 79d94360d50fcd487edcfe118a47a2881534923f
> change-id: 20231031-tc358767-58e3ebdf95f0
>
> Best regards,
Tested-by: Jan Kiszka <[email protected]>
Would be good to have that in stable for 6.6 as well then.
Thanks,
Jan
--
Siemens AG, Technology
Linux Expert Center
On 31-Oct-23 18:56, Tomi Valkeinen wrote:
> When a display controller driver uses DRM_BRIDGE_ATTACH_NO_CONNECTOR,
> tc358767 will behave properly and skip the creation of the connector.
>
> However, tc_get_display_props(), which is used to find out about the DP
> monitor and link, is only called from two places: .atomic_enable() and
> tc_connector_get_modes(). The latter is only used when tc358767 creates
> its own connector, i.e. when DRM_BRIDGE_ATTACH_NO_CONNECTOR is _not_
> set.
>
> Thus, the driver never finds out the link properties before get_edid()
> is called. With num_lanes of 0 and link_rate of 0 there are not many
> valid modes...
>
> Fix this by adding tc_connector_get_modes() call at the beginning of
> get_edid(), so that we have up to date information before looking at the
> modes.
>
> Reported-by: Jan Kiszka <[email protected]>
> Closes: https://lore.kernel.org/all/[email protected]/
> Signed-off-by: Tomi Valkeinen <[email protected]>
> ---
Thank you, Tomi, for quickly debugging this!
Reviewed-by: Aradhya Bhatia <[email protected]>
Regards
Aradhya
> drivers/gpu/drm/bridge/tc358767.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c
> index 0affcefdeb1c..137a9f5e3cad 100644
> --- a/drivers/gpu/drm/bridge/tc358767.c
> +++ b/drivers/gpu/drm/bridge/tc358767.c
> @@ -1579,6 +1579,13 @@ static struct edid *tc_get_edid(struct drm_bridge *bridge,
> struct drm_connector *connector)
> {
> struct tc_data *tc = bridge_to_tc(bridge);
> + int ret;
> +
> + ret = tc_get_display_props(tc);
> + if (ret < 0) {
> + dev_err(tc->dev, "failed to read display props: %d\n", ret);
> + return 0;
> + }
>
> return drm_get_edid(connector, &tc->aux.ddc);
> }
>
On 31.10.23 14:26, Tomi Valkeinen wrote:
> These two patches are needed to make tc358767 work in the
> DRM_BRIDGE_ATTACH_NO_CONNECTOR case, at least when using a DP connector.
> The first patch, "drm/bridge: tc358767: Support input format negotiation
> hook" was already sent separately, but I included it here for
> completeness, as both are needed to get a working display.
>
> I have tested this with TI AM654 EVM with a tc358767 add-on card.
>
> Signed-off-by: Tomi Valkeinen <[email protected]>
> ---
> Aradhya Bhatia (1):
> drm/bridge: tc358767: Support input format negotiation hook
>
> Tomi Valkeinen (1):
> drm/bridge: tc358767: Fix link properties discovery
>
> drivers/gpu/drm/bridge/tc358767.c | 32 ++++++++++++++++++++++++++++++++
> 1 file changed, 32 insertions(+)
> ---
> base-commit: 79d94360d50fcd487edcfe118a47a2881534923f
> change-id: 20231031-tc358767-58e3ebdf95f0
>
> Best regards,
What's the plan for these fixes? I'm not yet seeing them in Linus' tree,
thus also not in stable.
Jan
--
Siemens AG, Technology
Linux Expert Center
On 15/12/2023 15:33, Jan Kiszka wrote:
> On 31.10.23 14:26, Tomi Valkeinen wrote:
>> These two patches are needed to make tc358767 work in the
>> DRM_BRIDGE_ATTACH_NO_CONNECTOR case, at least when using a DP connector.
>> The first patch, "drm/bridge: tc358767: Support input format negotiation
>> hook" was already sent separately, but I included it here for
>> completeness, as both are needed to get a working display.
>>
>> I have tested this with TI AM654 EVM with a tc358767 add-on card.
>>
>> Signed-off-by: Tomi Valkeinen <[email protected]>
>> ---
>> Aradhya Bhatia (1):
>> drm/bridge: tc358767: Support input format negotiation hook
>>
>> Tomi Valkeinen (1):
>> drm/bridge: tc358767: Fix link properties discovery
>>
>> drivers/gpu/drm/bridge/tc358767.c | 32 ++++++++++++++++++++++++++++++++
>> 1 file changed, 32 insertions(+)
>> ---
>> base-commit: 79d94360d50fcd487edcfe118a47a2881534923f
>> change-id: 20231031-tc358767-58e3ebdf95f0
>>
>> Best regards,
>
> What's the plan for these fixes? I'm not yet seeing them in Linus' tree,
> thus also not in stable.
>
> Jan
>
The discussion continued in v2 of the series. There are some open
question in the tc358767 behavior.
Tomi