drm/tidss: Use new connector model for tidss
v4 cover drm/tidss: Use new connector model for tidss
This series moves the tidss to using new connectoe model, where the SoC driver (tidss) creates the connector and all the bridges are attached with the flag DRM_BRIDGE_ATTACH_NO_CONNECTOR
Since the bridges do not create the connector, the bus_format and bus_flag is set via atomic hooks.
Support format negotiations in the tfp410 and mhdp bridge drivers as a first step before moving the connector model.
Nikhil Devshatwar (7):
drm/bridge: tfp410: Support format negotiation hooks drm/bridge: tfp410: Set input_bus_flags in atomic_check drm/bridge: mhdp8546: Add minimal format negotiation drm/bridge: mhdp8546: Set input_bus_flags from atomic_check drm/tidss: Set bus_format correctly from bridge/connector drm/tidss: Move to newer connector model drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable
.../drm/bridge/cadence/cdns-mhdp8546-core.c | 75 +++++++++++++------ drivers/gpu/drm/bridge/ti-tfp410.c | 49 ++++++++++++ drivers/gpu/drm/tidss/tidss_drv.h | 3 + drivers/gpu/drm/tidss/tidss_encoder.c | 36 ++++----- drivers/gpu/drm/tidss/tidss_kms.c | 19 ++++- 5 files changed, 137 insertions(+), 45 deletions(-)
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 1/7 drm/bridge: tfp410: Support format negotiation hooks
With new connector model, tfp410 will not create the connector and SoC driver will rely on format negotiation to setup the encoder format.
Support format negotiations hooks in the drm_bridge_funcs. Use helper functions for state management.
Output format is expected to be MEDIA_BUS_FMT_FIXED Input format is the one selected by the bridge from DT properties.
---
Notes:
changes from v1:
* Use only MEDIA_BUS_FMT_FIXED for output
drivers/gpu/drm/bridge/ti-tfp410.c | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
drivers/gpu/drm/bridge/ti-tfp410.c +33 -0
@@ -204,12 +204,45 @@ static enum drm_mode_status tfp410_mode_valid(struct drm_bridge *bridge,return MODE_OK ; } +static u32 *tfp410_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) +{ +struct tfp410 *dvi =drm_bridge_to_tfp410 (bridge); +u32 *input_fmts; + + *num_input_fmts =0 ; + +/* +* Output of tfp410 is DVI, which is TMDS. +* There is no media format defined for this. +* Using MEDIA_BUS_FMT_FIXED for now. +*/ +if (output_fmt !=MEDIA_BUS_FMT_FIXED ) +return NULL ; + + input_fmts =kzalloc (sizeof (*input_fmts),GFP_KERNEL ); +if (!input_fmts) +return NULL ; + + *num_input_fmts =1 ; + input_fmts[0 ] = dvi->bus_format; +return input_fmts; +} +static const struct drm_bridge_funcs tfp410_bridge_funcs = { .attach = tfp410_attach, .detach = tfp410_detach, .enable = tfp410_enable, .disable = tfp410_disable, .mode_valid = tfp410_mode_valid, + .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_get_input_bus_fmts = tfp410_get_input_bus_fmts, };static const struct drm_bridge_timings tfp410_default_timings = {
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 2/7 drm/bridge: tfp410: Set input_bus_flags in atomic_check
In reply to Nikhil Devshatwarinput_bus_flags are specified in drm_bridge_timings (legacy) as well as drm_bridge_state->input_bus_cfg.flags
The flags from the timings will be deprecated. Bridges are supposed to validate and set the bridge state flags from atomic_check.
Implement atomic_check hook for the same.
--- drivers/gpu/drm/bridge/ti-tfp410.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/gpu/drm/bridge/ti-tfp410.c +15 -0
@@ -233,6 +233,20 @@ static u32 *tfp410_get_input_bus_fmts(struct drm_bridge *bridge,return input_fmts; } +int tfp410_atomic_check (struct drm_bridge *bridge, +struct drm_bridge_state *bridge_state, +struct drm_crtc_state *crtc_state, +struct drm_connector_state *conn_state) +{ +struct tfp410 *dvi =drm_bridge_to_tfp410 (bridge); + +/* +* There might be flags negotiation supported in future +* Set the bus flags in atomic_check statically for now +*/ + bridge_state->input_bus_cfg.flags = dvi->timings.input_bus_flags; +} +static const struct drm_bridge_funcs tfp410_bridge_funcs = { .attach = tfp410_attach, .detach = tfp410_detach,
@@ -243,6 +257,7 @@ static const struct drm_bridge_funcs tfp410_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_get_input_bus_fmts = tfp410_get_input_bus_fmts, + .atomic_check = tfp410_atomic_check, };static const struct drm_bridge_timings tfp410_default_timings = {
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
kernel test robot
build botRe: [PATCH v4 2/7] drm/bridge: tfp410: Set input_bus_flags in atomic_check
Thank you for the patch! Perhaps something to improve:
Hi Nikhil,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on drm-intel/for-linux-next]
[also build test WARNING on drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next drm-tip/drm-tip linus/master v5.10-rc6 next-20201201] [cannot apply to drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Nikhil-Devshatwar/drm-tidss-Use-new-connector-model-for-tidss/20201201-202125 base: git://anongit.freedesktop.org/drm-intel for-linux-next config: mips-randconfig-r023-20201201 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ac40a2d8f16b8a8c68fc811d67f647740e965cb8)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://github.com/0day-ci/linux/commit/936e9f4e0dd9ad362b11e4cb6a240cdaec2b8b28
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Nikhil-Devshatwar/drm-tidss-Use-new-connector-model-for-tidss/20201201-202125 git checkout 936e9f4e0dd9ad362b11e4cb6a240cdaec2b8b28
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/gpu/drm/bridge/ti-tfp410.c:236:5: warning: no previous prototype for function 'tfp410_atomic_check' [-Wmissing-prototypes]
int tfp410_atomic_check(struct drm_bridge *bridge,
^ drivers/gpu/drm/bridge/ti-tfp410.c:236:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int tfp410_atomic_check(struct drm_bridge *bridge,
^
static
drivers/gpu/drm/bridge/ti-tfp410.c:248:1: error: non-void function does not return a value [-Werror,-Wreturn-type]
}
^
1 warning and 1 error generated.
vim +/tfp410_atomic_check +236 drivers/gpu/drm/bridge/ti-tfp410.c
235
> 236 int tfp410_atomic_check(struct drm_bridge *bridge, 237 struct drm_bridge_state *bridge_state, 238 struct drm_crtc_state *crtc_state, 239 struct drm_connector_state *conn_state)
240 {
241 struct tfp410 *dvi = drm_bridge_to_tfp410(bridge);
242
243 /*
244 * There might be flags negotiation supported in future
245 * Set the bus flags in atomic_check statically for now
246 */
247 bridge_state->input_bus_cfg.flags = dvi->timings.input_bus_flags;
248 }
249
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
PATCH v5 1/1 drm/bridge: tfp410: Set input_bus_flags in atomic_check
In reply to Nikhil Devshatwarinput_bus_flags are specified in drm_bridge_timings (legacy) as well as drm_bridge_state->input_bus_cfg.flags
The flags from the timings will be deprecated. Bridges are supposed to validate and set the bridge state flags from atomic_check.
Implement atomic_check hook for the same.
---
Notes:
changes from v4:
* fix a warning Reported-by: kernel test robot <[email protected]>
drivers/gpu/drm/bridge/ti-tfp410.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/gpu/drm/bridge/ti-tfp410.c +15 -0
@@ -233,6 +233,20 @@ static u32 *tfp410_get_input_bus_fmts(struct drm_bridge *bridge,return input_fmts; } +static int tfp410_atomic_check (struct drm_bridge *bridge, +struct drm_bridge_state *bridge_state, +struct drm_crtc_state *crtc_state, +struct drm_connector_state *conn_state) +{ +struct tfp410 *dvi =drm_bridge_to_tfp410 (bridge); + +/* +* There might be flags negotiation supported in future +* Set the bus flags in atomic_check statically for now +*/ + bridge_state->input_bus_cfg.flags = dvi->timings.input_bus_flags; +} +static const struct drm_bridge_funcs tfp410_bridge_funcs = { .attach = tfp410_attach, .detach = tfp410_detach,
@@ -243,6 +257,7 @@ static const struct drm_bridge_funcs tfp410_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_get_input_bus_fmts = tfp410_get_input_bus_fmts, + .atomic_check = tfp410_atomic_check, };static const struct drm_bridge_timings tfp410_default_timings = {
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v5] drm/bridge: tfp410: Set input_bus_flags in atomic_check
Quoted 28 lines · On Thu, 3 Dec 2020 18:20:48 +0530 Nikhil Devshatwar <[email protected]> wrote:
input_bus_flagsare specified indrm_bridge_timings(legacy) as well asdrm_bridge_state->input_bus_cfg.flagsThe flags from the timings will be deprecated. Bridges are supposed to validate and set the bridge state flags from
atomic_check.Implement
atomic_checkhook for the same.Signed-off-by Nikhil Devshatwar <[email protected]>---
Notes:
changes from v4:
* fix a warning Reported-by: kernel test robot <[email protected]>drivers/gpu/drm/bridge/ti-tfp410.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)drivers/gpu/drm/bridge/ti-tfp410.c +2
-0@@ -233,6 +233,20 @@ static u32 *tfp410_get_input_bus_fmts(struct drm_bridge *bridge,return input_fmts; } +static int tfp410_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state,
drivers/gpu/drm/bridge/ti-tfp410.c static u32 *tfp410_get_input_bus_fmts(struct drm_bridge *bridge, · line 247
Quoted 10 lines
drivers/gpu/drm/bridge/ti-tfp410.c +10
-0+struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + struct tfp410 *dvi = drm_bridge_to_tfp410(bridge); + +/* +* There might be flags negotiation supported in future +* Set the bus flags in atomic_check statically for now +*/ + bridge_state->input_bus_cfg.flags = dvi->timings.input_bus_flags;
The return statement is still missing :-).
drivers/gpu/drm/bridge/ti-tfp410.c static const struct drm_bridge_funcs tfp410_bridge_funcs = { · line 263
Quoted 13 lines
drivers/gpu/drm/bridge/ti-tfp410.c +3
-0+} +static const struct drm_bridge_funcs tfp410_bridge_funcs = { .attach = tfp410_attach, .detach = tfp410_detach,@@ -243,6 +257,7 @@ static const struct drm_bridge_funcs tfp410_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_get_input_bus_fmts = tfp410_get_input_bus_fmts, + .atomic_check = tfp410_atomic_check, };static const struct drm_bridge_timings tfp410_default_timings = {
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 3/7 drm/bridge: mhdp8546: Add minimal format negotiation
In reply to Nikhil DevshatwarWith new connector model, mhdp bridge will not create the connector and SoC driver will rely on format negotiation to setup the encoder format.
Support minimal format negotiations hooks in the drm_bridge_funcs. Complete format negotiation can be added based on EDID data. This patch adds the minimal required support to avoid failure after moving to new connector model.
---
Notes:
changes from v1:
* cosmetic fixes, commit message update
.../drm/bridge/cadence/cdns-mhdp8546-core.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +25 -0
@@ -2078,6 +2078,30 @@ cdns_mhdp_bridge_atomic_reset(struct drm_bridge *bridge)return &cdns_mhdp_state->base; } +static u32 *cdns_mhdp_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; +u32 default_bus_format =MEDIA_BUS_FMT_RGB121212_1X36 ; + + *num_input_fmts =0 ; + +if (output_fmt !=MEDIA_BUS_FMT_FIXED ) +return NULL ; + + input_fmts =kzalloc (sizeof (*input_fmts),GFP_KERNEL ); +if (!input_fmts) +return NULL ; + + *num_input_fmts =1 ; + input_fmts[0 ] = default_bus_format; +return input_fmts; +} + static int cdns_mhdp_atomic_check(struct drm_bridge *bridge, struct drm_bridge_state *bridge_state, struct drm_crtc_state *crtc_state,
@@ -2142,6 +2166,7 @@ static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = { .atomic_duplicate_state = cdns_mhdp_bridge_atomic_duplicate_state, .atomic_destroy_state = cdns_mhdp_bridge_atomic_destroy_state, .atomic_reset = cdns_mhdp_bridge_atomic_reset, + .atomic_get_input_bus_fmts = cdns_mhdp_get_input_bus_fmts, .detect = cdns_mhdp_bridge_detect, .get_edid = cdns_mhdp_bridge_get_edid, .hpd_enable = cdns_mhdp_bridge_hpd_enable,
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 3/7] drm/bridge: mhdp8546: Add minimal format negotiation
Quoted 38 lines · On Tue, 1 Dec 2020 17:48:26 +0530 Nikhil Devshatwar <[email protected]> wrote:
With new connector model, mhdp bridge will not create the connector and SoC driver will rely on format negotiation to setup the encoder format.
Support minimal format negotiations hooks in the
drm_bridge_funcs. Complete format negotiation can be added based on EDID data. This patch adds the minimal required support to avoid failure after moving to new connector model.Signed-off-by Nikhil Devshatwar <[email protected]>Reviewed-by Tomi Valkeinen <[email protected]>---
Notes:
changes from v1:
* cosmetic fixes, commit message update.../drm/bridge/cadence/cdns-mhdp8546-core.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+)drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +11
-0@@ -2078,6 +2078,30 @@ cdns_mhdp_bridge_atomic_reset(struct drm_bridge *bridge)return &cdns_mhdp_state->base; } +static u32 *cdns_mhdp_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; +u32 default_bus_format =MEDIA_BUS_FMT_RGB121212_1X36 ; + + *num_input_fmts =0 ;
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c cdns_mhdp_bridge_atomic_reset(struct drm_bridge *bridge) · line 2101
Quoted 10 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +10
-0+ +if (output_fmt !=MEDIA_BUS_FMT_FIXED ) +return NULL ; + + input_fmts =kzalloc (sizeof (*input_fmts),GFP_KERNEL ); +if (!input_fmts) +return NULL ; + + *num_input_fmts =1 ; + input_fmts[0 ] = default_bus_format;
Why not
input_fmts[0] = MEDIA_BUS_FMT_RGB121212_1X36;
?
This way you could get rid of the default_bus_format variable.
Quoted 7 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +3
-0+return input_fmts; +} + static int cdns_mhdp_atomic_check(struct drm_bridge *bridge, struct drm_bridge_state *bridge_state, struct drm_crtc_state *crtc_state,
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = { · line 2172
Quoted 7 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +1
-0@@ -2142,6 +2166,7 @@ static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = { .atomic_duplicate_state = cdns_mhdp_bridge_atomic_duplicate_state, .atomic_destroy_state = cdns_mhdp_bridge_atomic_destroy_state, .atomic_reset = cdns_mhdp_bridge_atomic_reset, + .atomic_get_input_bus_fmts = cdns_mhdp_get_input_bus_fmts, .detect = cdns_mhdp_bridge_detect, .get_edid = cdns_mhdp_bridge_get_edid, .hpd_enable = cdns_mhdp_bridge_hpd_enable,
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 4/7 drm/bridge: mhdp8546: Set input_bus_flags from atomic_check
In reply to Nikhil Devshatwarinput_bus_flags are specified in drm_bridge_timings (legacy) as well as drm_bridge_state->input_bus_cfg.flags
The flags from the timings will be deprecated. Bridges are supposed to validate and set the bridge state flags from atomic_check.
--- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 6 ++++++ drivers/gpu/drm/bridge/ti-tfp410.c | 1 + 2 files changed, 7 insertions(+)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +6 -0
@@ -2121,6 +2121,12 @@ static int cdns_mhdp_atomic_check(struct drm_bridge *bridge,return -EINVAL ; } +/* +* There might be flags negotiation supported in future +* Set the bus flags in atomic_check statically for now +*/ + bridge_state->input_bus_cfg.flags = bridge->timings->input_bus_flags; +mutex_unlock (&mhdp->link_mutex);return 0 ; }
drivers/gpu/drm/bridge/ti-tfp410.c +1 -0
@@ -245,6 +245,7 @@ int tfp410_atomic_check(struct drm_bridge *bridge,* Set the bus flags in atomic_check statically for now */ bridge_state->input_bus_cfg.flags = dvi->timings.input_bus_flags; +return 0 ; }static const struct drm_bridge_funcs tfp410_bridge_funcs = {
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 4/7] drm/bridge: mhdp8546: Set input_bus_flags from atomic_check
Quoted 34 lines · On Tue, 1 Dec 2020 17:48:27 +0530 Nikhil Devshatwar <[email protected]> wrote:
input_bus_flagsare specified indrm_bridge_timings(legacy) as well asdrm_bridge_state->input_bus_cfg.flagsThe flags from the timings will be deprecated. Bridges are supposed to validate and set the bridge state flags from
atomic_check.Signed-off-by Nikhil Devshatwar <[email protected]>--- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 6 ++++++ drivers/gpu/drm/bridge/ti-tfp410.c | 1 + 2 files changed, 7 insertions(+)drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +6
-0@@ -2121,6 +2121,12 @@ static int cdns_mhdp_atomic_check(struct drm_bridge *bridge,return -EINVAL ; } +/* +* There might be flags negotiation supported in future +* Set the bus flags in atomic_check statically for now +*/ + bridge_state->input_bus_cfg.flags = bridge->timings->input_bus_flags; +mutex_unlock (&mhdp->link_mutex);return 0 ; }drivers/gpu/drm/bridge/ti-tfp410.c +0
-0
drivers/gpu/drm/bridge/ti-tfp410.c int tfp410_atomic_check(struct drm_bridge *bridge, · line 248
Quoted 4 lines
drivers/gpu/drm/bridge/ti-tfp410.c +1
-0@@ -245,6 +245,7 @@ int tfp410_atomic_check(struct drm_bridge *bridge,* Set the bus flags in atomic_check statically for now */ bridge_state->input_bus_cfg.flags = dvi->timings.input_bus_flags; +return 0 ;
And here is the return statement that was missing in patch 2 :-).
drivers/gpu/drm/bridge/ti-tfp410.c int tfp410_atomic_check(struct drm_bridge *bridge, · line 251
Quoted 3 lines
drivers/gpu/drm/bridge/ti-tfp410.c +0
-0}static const struct drm_bridge_funcs tfp410_bridge_funcs = {
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 4/7] drm/bridge: mhdp8546: Set input_bus_flags from atomic_check
Quoted 35 lines · Boris Brezillon
Quoted 32 lines · On Tue, 1 Dec 2020 17:48:27 +0530 Nikhil Devshatwar <[email protected]> wrote:
input_bus_flagsare specified indrm_bridge_timings(legacy) as well asdrm_bridge_state->input_bus_cfg.flagsThe flags from the timings will be deprecated. Bridges are supposed to validate and set the bridge state flags from
atomic_check.Signed-off-by Nikhil Devshatwar <[email protected]>--- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 6 ++++++ drivers/gpu/drm/bridge/ti-tfp410.c | 1 + 2 files changed, 7 insertions(+)drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +6
-0@@ -2121,6 +2121,12 @@ static int cdns_mhdp_atomic_check(struct drm_bridge *bridge,return -EINVAL ; } +/* +* There might be flags negotiation supported in future +* Set the bus flags in atomic_check statically for now +*/ + bridge_state->input_bus_cfg.flags = bridge->timings->input_bus_flags; +mutex_unlock (&mhdp->link_mutex);return 0 ; }drivers/gpu/drm/bridge/ti-tfp410.c +0
-1--- a/drivers/gpu/drm/bridge/ti-tfp410.c
Quoted 8 lines
drivers/gpu/drm/bridge/ti-tfp410.c int tfp410_atomic_check(struct drm_bridge *bridge, · line 248
Quoted 6 lines
+++
b/drivers/gpu/drm/bridge/ti-tfp410.cdrivers/gpu/drm/bridge/ti-tfp410.c +1
-0@@ -245,6 +245,7 @@ int tfp410_atomic_check(struct drm_bridge *bridge,* Set the bus flags in atomic_check statically for now */ bridge_state->input_bus_cfg.flags = dvi->timings.input_bus_flags; +return 0 ;And here is the return statement that was missing in patch 2 :-).
Sorry. I guess I messed up while rebasing. Will fix this
Nikhil D
Quoted 5 lines
drivers/gpu/drm/bridge/ti-tfp410.c int tfp410_atomic_check(struct drm_bridge *bridge, · line 251
Quoted 4 lines
drivers/gpu/drm/bridge/ti-tfp410.c +0
-0}static const struct drm_bridge_funcs tfp410_bridge_funcs = {
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 4/7] drm/bridge: mhdp8546: Set input_bus_flags from atomic_check
In reply to Nikhil DevshatwarQuoted 17 lines · On Tue, 1 Dec 2020 17:48:27 +0530 Nikhil Devshatwar <[email protected]> wrote:
input_bus_flagsare specified indrm_bridge_timings(legacy) as well asdrm_bridge_state->input_bus_cfg.flagsThe flags from the timings will be deprecated. Bridges are supposed to validate and set the bridge state flags from
atomic_check.Signed-off-by Nikhil Devshatwar <[email protected]>--- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 6 ++++++ drivers/gpu/drm/bridge/ti-tfp410.c | 1 + 2 files changed, 7 insertions(+)drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +0
-0
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static int cdns_mhdp_atomic_check(struct drm_bridge *bridge, · line 2128
Quoted 8 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +5
-0@@ -2121,6 +2121,12 @@ static int cdns_mhdp_atomic_check(struct drm_bridge *bridge,return -EINVAL ; } +/* +* There might be flags negotiation supported in future +* Set the bus flags in atomic_check statically for now +*/ + bridge_state->input_bus_cfg.flags = bridge->timings->input_bus_flags;
I'd go even further and replace the timings field in cdns_mhdp_platform_info by an input_bus_flags field, you'll then have the following assignment here.
if (mhdp->info) bridge_state->input_bus_cfg.flags = mhdp->info->input_bus_flags;
This way you no rely on the bridge->timings presence and can get rid of the mhdp->bridge.timings assignment in the probe path.
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static int cdns_mhdp_atomic_check(struct drm_bridge *bridge, · line 2132
Quoted 4 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +1
-0+mutex_unlock (&mhdp->link_mutex);return 0 ; }
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 4/7] drm/bridge: mhdp8546: Set input_bus_flags from atomic_check
Quoted 33 lines · Boris Brezillon
Quoted 17 lines · On Tue, 1 Dec 2020 17:48:27 +0530 Nikhil Devshatwar <[email protected]> wrote:
input_bus_flagsare specified indrm_bridge_timings(legacy) as well asdrm_bridge_state->input_bus_cfg.flagsThe flags from the timings will be deprecated. Bridges are supposed to validate and set the bridge state flags from
atomic_check.Signed-off-by Nikhil Devshatwar <[email protected]>--- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 6 ++++++ drivers/gpu/drm/bridge/ti-tfp410.c | 1 + 2 files changed, 7 insertions(+)drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +0
-0drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static int cdns_mhdp_atomic_check(struct drm_bridge *bridge, · line 2128
Quoted 8 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +5
-0@@ -2121,6 +2121,12 @@ static int cdns_mhdp_atomic_check(struct drm_bridge *bridge,return -EINVAL ; } +/* +* There might be flags negotiation supported in future +* Set the bus flags in atomic_check statically for now +*/ + bridge_state->input_bus_cfg.flags = bridge->timings->input_bus_flags;I'd go even further and replace the timings field in
cdns_mhdp_platform_infoby aninput_bus_flagsfield, you'll then have the following assignment here.
Quoted 6 lines
if (mhdp->info) bridge_state->input_bus_cfg.flags = mhdp->info->input_bus_flags;This way you no rely on the
bridge->timingspresence and can get rid of themhdp->bridge.timingsassignment in the probe path.
Okay, I'll update this patch
Quoted 6 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c static int cdns_mhdp_atomic_check(struct drm_bridge *bridge, · line 2132
Quoted 5 lines
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +1
-0+mutex_unlock (&mhdp->link_mutex);return 0 ; }
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 5/7 drm/tidss: Set bus_format correctly from bridge/connector
In reply to Nikhil DevshatwarRemove the old code to iterate over the bridge chain, as this is already done by the framework.
The bridge state should have the negotiated bus format and flags. Use these from the bridge's state.
If the bridge does not support format negotiation, error out and fail.
---
Notes:
changes from v3:
* cosmetic updates
changes from v2:
* Remove the old code and use the flags from the bridge state
drivers/gpu/drm/tidss/tidss_encoder.c | 36 +++++++++++---------------- 1 file changed, 14 insertions(+), 22 deletions(-)
drivers/gpu/drm/tidss/tidss_encoder.c +14 -22
@@ -21,37 +21,29 @@ static int tidss_encoder_atomic_check(struct drm_encoder *encoder, {struct drm_device *ddev = encoder->dev;struct tidss_crtc_state *tcrtc_state =to_tidss_crtc_state (crtc_state); -struct drm_display_info *di = &conn_state->connector->display_info; +struct drm_bridge_state *bstate;struct drm_bridge *bridge; -bool bus_flags_set = false;dev_dbg (ddev->dev,"%s\n" , __func__); -/* -* Take the bus_flags from the first bridge that defines -* bridge timings, or from the connector's display_info if no -* bridge defines the timings. -*/ -drm_for_each_bridge_in_chain (encoder, bridge) { -if (!bridge->timings) -continue ; - - tcrtc_state->bus_flags = bridge->timings->input_bus_flags; - bus_flags_set = true; -break ; +/* Copy the bus_format and flags from the first bridge's state */ + bridge =drm_bridge_chain_get_first_bridge (encoder); + bstate =drm_atomic_get_new_bridge_state (crtc_state->state, bridge); +if (!bstate) { +dev_err (ddev->dev,"Could not get the bridge state\n" ); +return -EINVAL ; } -if (!di->bus_formats || di->num_bus_formats ==0 ) { -dev_err (ddev->dev,"%s: No bus_formats in connected display\n" , - __func__); + tcrtc_state->bus_format = bstate->input_bus_cfg.format; + tcrtc_state->bus_flags = bstate->input_bus_cfg.flags; + +if (tcrtc_state->bus_format ==0 || + tcrtc_state->bus_format ==MEDIA_BUS_FMT_FIXED ) { + +dev_err (ddev->dev,"Bridge connected to the encoder did not specify media bus format\n" );return -EINVAL ; } -// XXX any cleaner way to set bus format and flags? - tcrtc_state->bus_format = di->bus_formats[0 ]; -if (!bus_flags_set) - tcrtc_state->bus_flags = di->bus_flags; -return 0 ; }
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 5/7] drm/tidss: Set bus_format correctly from bridge/connector
Quoted 6 lines · On Tue, 1 Dec 2020 17:48:28 +0530 Nikhil Devshatwar <[email protected]> wrote:
Remove the old code to iterate over the bridge chain, as this is already done by the framework.
The bridge state should have the negotiated bus format and flags. Use these from the bridge's state.
If the bridge does not support format negotiation, error out and fail.
That'd be even better if you implement the bridge interface instead of the encoder one so we can get rid of the encoder_{helper}_funcs and use drm_simple_encoder_init().
Quoted 60 lines
Signed-off-by Nikhil Devshatwar <[email protected]>Reviewed-by Tomi Valkeinen <[email protected]>---
Notes:
changes from v3:
* cosmetic updates
changes from v2:
* Remove the old code and use the flags from the bridge statedrivers/gpu/drm/tidss/tidss_encoder.c | 36 +++++++++++---------------- 1 file changed, 14 insertions(+), 22 deletions(-)drivers/gpu/drm/tidss/tidss_encoder.c +14
-17@@ -21,37 +21,29 @@ static int tidss_encoder_atomic_check(struct drm_encoder *encoder, {struct drm_device *ddev = encoder->dev;struct tidss_crtc_state *tcrtc_state =to_tidss_crtc_state (crtc_state); -struct drm_display_info *di = &conn_state->connector->display_info; +struct drm_bridge_state *bstate;struct drm_bridge *bridge; -bool bus_flags_set = false;dev_dbg (ddev->dev,"%s\n" , __func__); -/* -* Take the bus_flags from the first bridge that defines -* bridge timings, or from the connector's display_info if no -* bridge defines the timings. -*/ -drm_for_each_bridge_in_chain (encoder, bridge) { -if (!bridge->timings) -continue ; - - tcrtc_state->bus_flags = bridge->timings->input_bus_flags; - bus_flags_set = true; -break ; +/* Copy the bus_format and flags from the first bridge's state */ + bridge =drm_bridge_chain_get_first_bridge (encoder); + bstate =drm_atomic_get_new_bridge_state (crtc_state->state, bridge); +if (!bstate) { +dev_err (ddev->dev,"Could not get the bridge state\n" ); +return -EINVAL ; } -if (!di->bus_formats || di->num_bus_formats ==0 ) { -dev_err (ddev->dev,"%s: No bus_formats in connected display\n" , - __func__); + tcrtc_state->bus_format = bstate->input_bus_cfg.format; + tcrtc_state->bus_flags = bstate->input_bus_cfg.flags; + +if (tcrtc_state->bus_format ==0 || + tcrtc_state->bus_format ==MEDIA_BUS_FMT_FIXED ) { + +dev_err (ddev->dev,"Bridge connected to the encoder did not specify media bus format\n" );return -EINVAL ;
drivers/gpu/drm/tidss/tidss_encoder.c static int tidss_encoder_atomic_check(struct drm_encoder *encoder, · line 49
Quoted 10 lines
drivers/gpu/drm/tidss/tidss_encoder.c +0
-5} -// XXX any cleaner way to set bus format and flags? - tcrtc_state->bus_format = di->bus_formats[0 ]; -if (!bus_flags_set) - tcrtc_state->bus_flags = di->bus_flags; -return 0 ; }
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 5/7] drm/tidss: Set bus_format correctly from bridge/connector
Hi Boris,
Quoted 10 lines · Boris Brezillon
Quoted 6 lines · On Tue, 1 Dec 2020 17:48:28 +0530 Nikhil Devshatwar <[email protected]> wrote:
Remove the old code to iterate over the bridge chain, as this is already done by the framework.
The bridge state should have the negotiated bus format and flags. Use these from the bridge's state.
If the bridge does not support format negotiation, error out and fail.
Quoted 3 lines
That'd be even better if you implement the bridge interface instead of the encoder one so we can get rid of the encoder_{helper}_funcs and use
drm_simple_encoder_init().
I'm a bit confused here. What should be the design here...
These formats need to be handled by the crtc (well, the display controller, which is modeled as the crtc). Should we have a tidss_crtc.c file, which implements a crtc, a simple encoder and a bridge? And just consider those three DRM components as different API parts of the display controller?
Tomi
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 5/7] drm/tidss: Set bus_format correctly from bridge/connector
Quoted 17 lines · On Fri, 4 Dec 2020 12:56:27 +0200 Tomi Valkeinen <[email protected]> wrote:
Hi Boris,
Quoted 10 lines · Boris Brezillon
Quoted 6 lines · On Tue, 1 Dec 2020 17:48:28 +0530 Nikhil Devshatwar <[email protected]> wrote:
Remove the old code to iterate over the bridge chain, as this is already done by the framework.
The bridge state should have the negotiated bus format and flags. Use these from the bridge's state.
If the bridge does not support format negotiation, error out and fail.Quoted 3 lines
That'd be even better if you implement the bridge interface instead of the encoder one so we can get rid of the encoder_{helper}_funcs and use
drm_simple_encoder_init().
Quoted 5 lines
I'm a bit confused here. What should be the design here...
These formats need to be handled by the crtc (well, the display controller, which is modeled as the crtc). Should we have a
tidss_crtc.cfile, which implements a crtc, a simple encoder and a bridge? And just consider those three DRM components as different API parts of the display controller?
The idea is to hide the encoder abstraction from drivers as much as we can. We have to keep the encoder concept because that's what we expose to userspace, but drivers shouldn't have to worry about the distinction between the first bridge in the chain (what we currently call encoders) and other bridges. The bridge interface provides pretty much the same functionality, so all you need to do is turn your encoder driver into a bridge driver (see what we did for drivers/gpu/drm/imx/parallel-display.c), the only particularity here is that the bridge knows it's the first in the chain, and has access to the CRTC it's directly connected to.
IMHO, the less interfaces we keep the clearer it gets for our users. Getting rid of the encoder_{helper_}funcs in favor or bridge_ops would clarify the fact that any kind of encoder, no matter if it's the first in the chain or not, should be represented as a bridge object.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 5/7] drm/tidss: Set bus_format correctly from bridge/connector
Quoted 10 lines · Boris Brezillon
Quoted 9 lines
Quoted 3 lines
That'd be even better if you implement the bridge interface instead of the encoder one so we can get rid of the encoder_{helper}_funcs and use
drm_simple_encoder_init().I'm a bit confused here. What should be the design here...
These formats need to be handled by the crtc (well, the display controller, which is modeled as the crtc). Should we have a
tidss_crtc.cfile, which implements a crtc, a simple encoder and a bridge? And just consider those three DRM components as different API parts of the display controller?
Quoted 10 lines
The idea is to hide the encoder abstraction from drivers as much as we can. We have to keep the encoder concept because that's what we expose to userspace, but drivers shouldn't have to worry about the distinction between the first bridge in the chain (what we currently call encoders) and other bridges. The bridge interface provides pretty much the same functionality, so all you need to do is turn your encoder driver into a bridge driver (see what we did for
drivers/gpu/drm/imx/parallel-display.c), the only particularity here is that the bridge knows it's the first in the chain, and has access to the CRTC it's directly connected to.
With a quick look, the imx parallel-display.c seems to be really part of the crtc. Shouldn't we then take one more step forward, and just combine the crtc, encoder and bridge (somehow)? That's kind of what parallel-display.c is doing, isn't it? It's directly poking the crtc state, but the code just happens to be in a separate file from the crtc.
Thinking about the TI HW, we have a bunch of internal IPs which are clearly bridges: HDMI, DSI, which get the pixel data from the display controller, and they have their own registers, so clearly independent bridges.
Then we have MIPI DPI, which doesn't really have its own registers, as it's just plain parallel RGB, the same as what is sent to e.g. HDMI and DSI bridges. However, there might be some muxes or regulators to set up to get the external signals working. So a bridge would be ok here too to handle that external side.
But in all the above cases, we have the display controller (crtc), which in all the cases needs to do e.g. pixel/bus format configuration. So why add direct crtc poking into the first bridges (HDMI, DSI, DPI), when we could just model the crtc as a bridge, and thus the first bridges wouldn't need to touch the crtc.
Tomi
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 5/7] drm/tidss: Set bus_format correctly from bridge/connector
Quoted 23 lines · On Fri, 4 Dec 2020 13:47:05 +0200 Tomi Valkeinen <[email protected]> wrote:
Quoted 10 lines · Boris Brezillon
Quoted 9 lines
Quoted 3 lines
That'd be even better if you implement the bridge interface instead of the encoder one so we can get rid of the encoder_{helper}_funcs and use
drm_simple_encoder_init().I'm a bit confused here. What should be the design here...
These formats need to be handled by the crtc (well, the display controller, which is modeled as the crtc). Should we have a
tidss_crtc.cfile, which implements a crtc, a simple encoder and a bridge? And just consider those three DRM components as different API parts of the display controller?Quoted 10 lines
The idea is to hide the encoder abstraction from drivers as much as we can. We have to keep the encoder concept because that's what we expose to userspace, but drivers shouldn't have to worry about the distinction between the first bridge in the chain (what we currently call encoders) and other bridges. The bridge interface provides pretty much the same functionality, so all you need to do is turn your encoder driver into a bridge driver (see what we did for
drivers/gpu/drm/imx/parallel-display.c), the only particularity here is that the bridge knows it's the first in the chain, and has access to the CRTC it's directly connected to.
Quoted 4 lines
With a quick look, the imx
parallel-display.cseems to be really part of the crtc. Shouldn't we then take one more step forward, and just combine the crtc, encoder and bridge (somehow)? That's kind of whatparallel-display.cis doing, isn't it? It's directly poking the crtc state, but the code just happens to be in a separate file from the crtc.
Right. If we want to keep the code split, the logic should probably be reversed, with the CRTC driver checking the first bridge state to setup its internal state. Those DPI encoders are always a bit special, since they tend to be directly embedded in the block responsible for timing control (what we call CRTCs), so you're right, maybe we should model that as a CRTC+bridge pair.
Quoted 7 lines
Thinking about the TI HW, we have a bunch of internal IPs which are clearly bridges: HDMI, DSI, which get the pixel data from the display controller, and they have their own registers, so clearly independent bridges.
Then we have MIPI DPI, which doesn't really have its own registers, as it's just plain parallel RGB, the same as what is sent to e.g. HDMI and DSI bridges.
I still consider that one a bridge, even if the translation is almost transparent from a HW PoV.
Quoted 3 lines
However, there might be some muxes or
regulators to set up to get the external signals working. So a bridge would be ok here too to handle that external side.
Exactly.
Quoted 5 lines
But in all the above cases, we have the display controller (crtc), which in all the cases needs to do e.g. pixel/bus format configuration. So why add direct crtc poking into the first bridges (HDMI, DSI, DPI), when we could just model the crtc as a bridge, and thus the first bridges wouldn't need to touch the crtc.
Yes, that's an option. I mean, you can already modify your CRTC logic to implement the bridge and CRTC interface and have your driver-specific CRTC object embed both a drm_crtc and a drm_bridge.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 5/7] drm/tidss: Set bus_format correctly from bridge/connector
Quoted 56 lines · Boris Brezillon
Quoted 23 lines · On Fri, 4 Dec 2020 13:47:05 +0200 Tomi Valkeinen <[email protected]> wrote:
Quoted 10 lines · Boris Brezillon
Quoted 9 lines
Quoted 3 lines
That'd be even better if you implement the bridge interface instead of the encoder one so we can get rid of the encoder_{helper}_funcs and use
drm_simple_encoder_init().I'm a bit confused here. What should be the design here...
These formats need to be handled by the crtc (well, the display controller, which is modeled as the crtc). Should we have a
tidss_crtc.cfile, which implements a crtc, a simple encoder and a bridge? And just consider those three DRM components as different API parts of the display controller?Quoted 10 lines
The idea is to hide the encoder abstraction from drivers as much as we can. We have to keep the encoder concept because that's what we expose to userspace, but drivers shouldn't have to worry about the distinction between the first bridge in the chain (what we currently call encoders) and other bridges. The bridge interface provides pretty much the same functionality, so all you need to do is turn your encoder driver into a bridge driver (see what we did for
drivers/gpu/drm/imx/parallel-display.c), the only particularity here is that the bridge knows it's the first in the chain, and has access to the CRTC it's directly connected to.Quoted 4 lines
With a quick look, the imx
parallel-display.cseems to be really part of the crtc. Shouldn't we then take one more step forward, and just combine the crtc, encoder and bridge (somehow)? That's kind of whatparallel-display.cis doing, isn't it? It's directly poking the crtc state, but the code just happens to be in a separate file from the crtc.Right. If we want to keep the code split, the logic should probably be reversed, with the CRTC driver checking the first bridge state to setup its internal state. Those DPI encoders are always a bit special, since they tend to be directly embedded in the block responsible for timing control (what we call CRTCs), so you're right, maybe we should model that as a CRTC+bridge pair.
Quoted 7 lines
Thinking about the TI HW, we have a bunch of internal IPs which are clearly bridges: HDMI, DSI, which get the pixel data from the display controller, and they have their own registers, so clearly independent bridges.
Then we have MIPI DPI, which doesn't really have its own registers, as it's just plain parallel RGB, the same as what is sent to e.g. HDMI and DSI bridges.
I still consider that one a bridge, even if the translation is almost transparent from a HW PoV.
Quoted 3 lines
However, there might be some muxes or
regulators to set up to get the external signals working. So a bridge would be ok here too to handle that external side.Exactly.
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
But in all the above cases, we have the display controller (crtc), which in all the cases needs to do e.g. pixel/bus format configuration. So why add direct crtc poking into the first bridges (HDMI, DSI, DPI), when we could just model the crtc as a bridge, and thus the first bridges wouldn't need to touch the crtc.
Yes, that's an option. I mean, you can already modify your CRTC logic to implement the bridge and CRTC interface and have your driver-specific CRTC object embed both a
drm_crtcand adrm_bridge.
Alright, thanks for the clarifications!
I think the best first step here is what you proposed, use the bridge interface and drm_simple_encoder_init(), as that should solve the issue at hand quite neatly.
Tomi
Signature · 6 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 5/7] drm/tidss: Set bus_format correctly from bridge/connector
In reply to Boris BrezillonHello,
chiming in in this *old* email thread.
Adding in copy a few more *@ti.com people recently involved in other tidss changes [1]
[1] https://lore.kernel.org/all/[email protected]/
Quoted 10 lines · Boris Brezillon
Quoted 6 lines · On Tue, 1 Dec 2020 17:48:28 +0530 Nikhil Devshatwar <[email protected]> wrote:
Remove the old code to iterate over the bridge chain, as this is already done by the framework.
The bridge state should have the negotiated bus format and flags. Use these from the bridge's state.
If the bridge does not support format negotiation, error out and fail.
Quoted 3 lines
That'd be even better if you implement the bridge interface instead of the encoder one so we can get rid of the encoder_{helper}_funcs and use
drm_simple_encoder_init().
Did anything happened on this old discussion? I was working on a very similar change and after a while I realized about this thread.
Thanks,
Francesco
Re: [PATCH v4 5/7] drm/tidss: Set bus_format correctly from bridge/connector
Hi Francesco,
Quoted 21 lines · Francesco Dolcini
Hello,
chiming in in this *old* email thread.Adding in copy a few more *@ti.com people recently involved in other tidss changes [1]
[1] https://lore.kernel.org/all/[email protected]/
Quoted 10 lines · Boris Brezillon
Quoted 6 lines · On Tue, 1 Dec 2020 17:48:28 +0530 Nikhil Devshatwar <[email protected]> wrote:
Remove the old code to iterate over the bridge chain, as this is already done by the framework.
The bridge state should have the negotiated bus format and flags. Use these from the bridge's state.
If the bridge does not support format negotiation, error out and fail.
Quoted 7 lines
Quoted 3 lines
That'd be even better if you implement the bridge interface instead of the encoder one so we can get rid of the encoder_{helper}_funcs and use
drm_simple_encoder_init().Did anything happened on this old discussion? I was working on a very similar change and after a while I realized about this thread.
Nikhil has moved on from TI.
I will be taking up this patch series and implement the changes requested.
Boris, Tomi
Are the changes discussed on this patch still relevant for the display controller driver to support DRM_BRIDGE_ATTACH_NO_CONNECTOR?
Or are there some new changes in the framework that I should be looking at?
Regards
Aradhya
Re: [PATCH v4 5/7] drm/tidss: Set bus_format correctly from bridge/connector
Hello Aradhya,
Quoted 26 lines · Aradhya Bhatia
Quoted 25 lines · Francesco Dolcini
Hello,
chiming in in this *old* email thread.Adding in copy a few more *@ti.com people recently involved in other tidss changes [1]
[1] https://lore.kernel.org/all/[email protected]/
Quoted 13 lines · Boris Brezillon
Quoted 6 lines · On Tue, 1 Dec 2020 17:48:28 +0530 Nikhil Devshatwar <[email protected]> wrote:
Remove the old code to iterate over the bridge chain, as this is already done by the framework.
The bridge state should have the negotiated bus format and flags. Use these from the bridge's state.
If the bridge does not support format negotiation, error out and fail.That'd be even better if you implement the bridge interface instead of the encoder one so we can get rid of the encoder_{helper}_funcs and use
drm_simple_encoder_init().
Quoted 7 lines
Quoted 3 lines
Did anything happened on this old discussion? I was working on a very similar change and after a while I realized about this thread.
Nikhil has moved on from TI.
I will be taking up this patch series and implement the changes requested.
Great!
What I was working on is really about having the media bus format taken from the closest bridge, this is really required for proper functionality when the display is connected through a bridge.
This [1] is what I was working on before realizing about this specific patch here, in case you want to have a look.
Please keep me in CC, I can test/review patches.
Francesco
[1] https://github.com/dolcini/linux/commit/150b1390bd4122a77c873d87bf506024f9775755
Re: [PATCH v4 5/7] drm/tidss: Set bus_format correctly from bridge/connector
Hi Francesco,
Quoted 34 lines · Francesco Dolcini
Hello Aradhya,
Quoted 31 lines · Aradhya Bhatia
Quoted 21 lines · Francesco Dolcini
Hello,
chiming in in this *old* email thread.Adding in copy a few more *@ti.com people recently involved in other tidss changes [1]
[1] https://lore.kernel.org/all/[email protected]/
Quoted 10 lines · Boris Brezillon
Quoted 6 lines · On Tue, 1 Dec 2020 17:48:28 +0530 Nikhil Devshatwar <[email protected]> wrote:
Remove the old code to iterate over the bridge chain, as this is already done by the framework.
The bridge state should have the negotiated bus format and flags. Use these from the bridge's state.
If the bridge does not support format negotiation, error out and fail.Quoted 7 lines
Quoted 3 lines
That'd be even better if you implement the bridge interface instead of the encoder one so we can get rid of the encoder_{helper}_funcs and use
drm_simple_encoder_init().Did anything happened on this old discussion? I was working on a very similar change and after a while I realized about this thread.
Nikhil has moved on from TI.
Quoted 7 lines
Quoted 2 lines
I will be taking up this patch series and implement the changes requested.
Great!
What I was working on is really about having the media bus format taken from the closest bridge, this is really required for proper functionality when the display is connected through a bridge.
I agree with you there. The current code will not work well when the media bus format required by the final sink is not same as the one tidss needs to output.
Quoted 5 lines
This [1] is what I was working on before realizing about this specific patch here, in case you want to have a look.
Please keep me in CC, I can test/review patches.
Thank you! Will do. =)
Regards
Aradhya
PATCH v4 6/7 drm/tidss: Move to newer connector model
In reply to Nikhil DevshatwarTo be able to support connector operations across multiple bridges, it is recommended that the connector should be created by the SoC driver instead of the bridges.
Modify the tidss modesetting initialization sequence to create the connector and attach bridges with flag DRM_BRIDGE_ATTACH_NO_CONNECTOR
---
Notes:
changes from v1:
* Add error handling
drivers/gpu/drm/tidss/tidss_drv.h | 3 +++ drivers/gpu/drm/tidss/tidss_kms.c | 19 ++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-)
drivers/gpu/drm/tidss/tidss_drv.h +3 -0
@@ -27,6 +27,9 @@ struct tidss_device {unsigned int num_planes;struct drm_plane *planes[TIDSS_MAX_PLANES ]; +unsigned int num_connectors; +struct drm_connector *connectors[TIDSS_MAX_PORTS ]; +spinlock_t wait_lock;/* protects the irq masks */ dispc_irq_t irq_mask;/* enabled irqs in addition to wait_list */ };
drivers/gpu/drm/tidss/tidss_kms.c +18 -1
@@ -7,6 +7,7 @@#include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> #include <drm/drm_bridge.h> +#include <drm/drm_bridge_connector.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_helper.h>
@@ -192,6 +193,7 @@ static int tidss_dispc_modeset_init(struct tidss_device *tidss)for (i =0 ; i < num_pipes; ++i) {struct tidss_plane *tplane;struct tidss_crtc *tcrtc; +struct drm_connector *connector;struct drm_encoder *enc;u32 hw_plane_id = feat->vid_order[tidss->num_planes];int ret;
@@ -222,11 +224,26 @@ static int tidss_dispc_modeset_init(struct tidss_device *tidss)return PTR_ERR (enc); } - ret =drm_bridge_attach (enc, pipes[i].bridge,NULL ,0 ); + ret =drm_bridge_attach (enc, pipes[i].bridge,NULL , +DRM_BRIDGE_ATTACH_NO_CONNECTOR );if (ret) {dev_err (tidss->dev,"bridge attach failed: %d\n" , ret);return ret; } + + connector =drm_bridge_connector_init (&tidss->ddev, enc); +if (IS_ERR (connector)) { +dev_err (tidss->dev,"bridge_connector create failed\n" ); +return PTR_ERR (connector); + } + + tidss->connectors[tidss->num_connectors++] = connector; + + ret =drm_connector_attach_encoder (connector, enc); +if (ret) { +dev_err (tidss->dev,"attaching encoder to connector failed\n" ); +return ret; + } }/* create overlay planes of the leftover planes */
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 7/7 drm/bridge: cdns-mhdp8546: Fix the interrupt enable/disable
In reply to Nikhil DevshatwarWhen removing the tidss driver, there is a warning reported by kernel about an unhandled interrupt for mhdp driver.
[ 43.238895] irq 31: nobody cared (try booting with the "irqpoll" option) ... [snipped backtrace] [ 43.330735] handlers: [ 43.333020] [<000000005367c4f9>] irq_default_primary_handler threaded [<000000007e02b601>] cdns_mhdp_irq_handler [cdns_mhdp8546] [ 43.344607] Disabling IRQ #31
This happens because as part of cdns_mhdp_bridge_hpd_disable, driver tries to disable the interrupts. While disabling the SW_EVENT interrupts, it accidentally enables the MBOX interrupts, which are not handled by the driver.
Fix this with a read-modify-write to update only required bits. Use the enable / disable function as required in other places.
---
Notes:
changes from v2:
* Fix the interrupt enable logic at other places in code
* Reorder functions so that they can be used earlier in the program
.../drm/bridge/cadence/cdns-mhdp8546-core.c | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +22 -22
@@ -52,6 +52,26 @@#include "cdns-mhdp8546-j721e.h" +static void cdns_mhdp_bridge_hpd_enable (struct drm_bridge *bridge) +{ +struct cdns_mhdp_device *mhdp =bridge_to_mhdp (bridge); + +/* Enable SW event interrupts */ +if (mhdp->bridge_attached) +writel (readl (mhdp->regs +CDNS_APB_INT_MASK ) & + ~CDNS_APB_INT_MASK_SW_EVENT_INT , + mhdp->regs +CDNS_APB_INT_MASK ); +} + +static void cdns_mhdp_bridge_hpd_disable (struct drm_bridge *bridge) +{ +struct cdns_mhdp_device *mhdp =bridge_to_mhdp (bridge); + +writel (readl (mhdp->regs +CDNS_APB_INT_MASK ) | +CDNS_APB_INT_MASK_SW_EVENT_INT , + mhdp->regs +CDNS_APB_INT_MASK ); +} +static int cdns_mhdp_mailbox_read (struct cdns_mhdp_device *mhdp) {int ret, empty;
@@ -747,9 +767,7 @@ static int cdns_mhdp_fw_activate(const struct firmware *fw,* MHDP_HW_STOPPED happens only due to driver removal when * bridge should already be detached. */ -if (mhdp->bridge_attached) -writel (~(u32 )CDNS_APB_INT_MASK_SW_EVENT_INT , - mhdp->regs +CDNS_APB_INT_MASK ); +cdns_mhdp_bridge_hpd_enable (&mhdp->bridge);spin_unlock (&mhdp->start_lock);
@@ -1689,8 +1707,7 @@ static int cdns_mhdp_attach(struct drm_bridge *bridge,/* Enable SW event interrupts */ if (hw_ready) -writel (~(u32 )CDNS_APB_INT_MASK_SW_EVENT_INT , - mhdp->regs +CDNS_APB_INT_MASK ); +cdns_mhdp_bridge_hpd_enable (bridge);return 0 ; }
@@ -2146,23 +2163,6 @@ static struct edid *cdns_mhdp_bridge_get_edid(struct drm_bridge *bridge,return cdns_mhdp_get_edid (mhdp, connector); } -static void cdns_mhdp_bridge_hpd_enable (struct drm_bridge *bridge) -{ -struct cdns_mhdp_device *mhdp =bridge_to_mhdp (bridge); - -/* Enable SW event interrupts */ -if (mhdp->bridge_attached) -writel (~(u32 )CDNS_APB_INT_MASK_SW_EVENT_INT , - mhdp->regs +CDNS_APB_INT_MASK ); -} - -static void cdns_mhdp_bridge_hpd_disable (struct drm_bridge *bridge) -{ -struct cdns_mhdp_device *mhdp =bridge_to_mhdp (bridge); - -writel (CDNS_APB_INT_MASK_SW_EVENT_INT , mhdp->regs +CDNS_APB_INT_MASK ); -} -static const struct drm_bridge_funcs cdns_mhdp_bridge_funcs = { .atomic_enable = cdns_mhdp_atomic_enable, .atomic_disable = cdns_mhdp_atomic_disable,
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel