diff mbox series

[v2] drm: add dp helper to initialize remote aux channel.

Message ID 20191206225638.609-1-dingchen.zhang@amd.com (mailing list archive)
State New, archived
Headers show
Series [v2] drm: add dp helper to initialize remote aux channel. | expand

Commit Message

Zhang, Dingchen (David) Dec. 6, 2019, 10:56 p.m. UTC
[why]
We need to minimally initialize the remote aux channel, e.g. the
crc work struct of remote aux to dump the sink's DPRX CRCs in MST
setup.

[how]
Add helper that only initializes the crc work struct of the remote
aux, hooke crc work queue to 'drm_dp_aux_crc_work'. Then call this
helper in DP MST port initialization.
This, plus David Francis' patch [1], fix the issue of MST remote
aux DPCD CRCs read.

[1] https://patchwork.kernel.org/patch/11217941/

Cc: Leo Li <sunpeng.li@amd.com>
Cc: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: David (Dingchen) Zhang <dingchen.zhang@amd.com>
---
 drivers/gpu/drm/drm_dp_helper.c       | 13 +++++++++++++
 drivers/gpu/drm/drm_dp_mst_topology.c |  3 +++
 include/drm/drm_dp_helper.h           |  1 +
 3 files changed, 17 insertions(+)

Comments

Harry Wentland Dec. 10, 2019, 3:16 p.m. UTC | #1
On 2019-12-06 5:56 p.m., David (Dingchen) Zhang wrote:
> [why]
> We need to minimally initialize the remote aux channel, e.g. the
> crc work struct of remote aux to dump the sink's DPRX CRCs in MST
> setup.
> 
> [how]
> Add helper that only initializes the crc work struct of the remote
> aux, hooke crc work queue to 'drm_dp_aux_crc_work'. Then call this
> helper in DP MST port initialization.
> This, plus David Francis' patch [1], fix the issue of MST remote
> aux DPCD CRCs read.
> 
> [1] https://patchwork.kernel.org/patch/11217941/
> 
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Harry Wentland <Harry.Wentland@amd.com>
> Signed-off-by: David (Dingchen) Zhang <dingchen.zhang@amd.com>

Patch is
Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>  drivers/gpu/drm/drm_dp_helper.c       | 13 +++++++++++++
>  drivers/gpu/drm/drm_dp_mst_topology.c |  3 +++
>  include/drm/drm_dp_helper.h           |  1 +
>  3 files changed, 17 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index 2c7870aef469..cc4845d0fcb8 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -968,6 +968,19 @@ static void drm_dp_aux_crc_work(struct work_struct *work)
>  	}
>  }
>  
> +/**
> + * drm_dp_remote_aux_init() - minimally initialise a remote aux channel
> + * @aux: DisplayPort AUX channel
> + *
> + * Used for remote aux channel in general. Merely initialize the crc work
> + * struct.
> + */
> +void drm_dp_remote_aux_init(struct drm_dp_aux *aux)
> +{
> +	INIT_WORK(&aux->crc_work, drm_dp_aux_crc_work);
> +}
> +EXPORT_SYMBOL(drm_dp_remote_aux_init);
> +
>  /**
>   * drm_dp_aux_init() - minimally initialise an aux channel
>   * @aux: DisplayPort AUX channel
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 87fc44895d83..edafa182264a 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -1945,6 +1945,9 @@ drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb,
>  		port->aux.dev = dev->dev;
>  		port->aux.is_remote = true;
>  
> +		/* initialize the MST downstream port's AUX crc work queue */
> +		drm_dp_remote_aux_init(&port->aux);
> +
>  		/*
>  		 * Make sure the memory allocation for our parent branch stays
>  		 * around until our own memory allocation is released
> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
> index 8f8f3632e697..b2e6923d5929 100644
> --- a/include/drm/drm_dp_helper.h
> +++ b/include/drm/drm_dp_helper.h
> @@ -1465,6 +1465,7 @@ int drm_dp_downstream_id(struct drm_dp_aux *aux, char id[6]);
>  void drm_dp_downstream_debug(struct seq_file *m, const u8 dpcd[DP_RECEIVER_CAP_SIZE],
>  			     const u8 port_cap[4], struct drm_dp_aux *aux);
>  
> +void drm_dp_remote_aux_init(struct drm_dp_aux *aux);
>  void drm_dp_aux_init(struct drm_dp_aux *aux);
>  int drm_dp_aux_register(struct drm_dp_aux *aux);
>  void drm_dp_aux_unregister(struct drm_dp_aux *aux);
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 2c7870aef469..cc4845d0fcb8 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -968,6 +968,19 @@  static void drm_dp_aux_crc_work(struct work_struct *work)
 	}
 }
 
+/**
+ * drm_dp_remote_aux_init() - minimally initialise a remote aux channel
+ * @aux: DisplayPort AUX channel
+ *
+ * Used for remote aux channel in general. Merely initialize the crc work
+ * struct.
+ */
+void drm_dp_remote_aux_init(struct drm_dp_aux *aux)
+{
+	INIT_WORK(&aux->crc_work, drm_dp_aux_crc_work);
+}
+EXPORT_SYMBOL(drm_dp_remote_aux_init);
+
 /**
  * drm_dp_aux_init() - minimally initialise an aux channel
  * @aux: DisplayPort AUX channel
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 87fc44895d83..edafa182264a 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1945,6 +1945,9 @@  drm_dp_mst_handle_link_address_port(struct drm_dp_mst_branch *mstb,
 		port->aux.dev = dev->dev;
 		port->aux.is_remote = true;
 
+		/* initialize the MST downstream port's AUX crc work queue */
+		drm_dp_remote_aux_init(&port->aux);
+
 		/*
 		 * Make sure the memory allocation for our parent branch stays
 		 * around until our own memory allocation is released
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 8f8f3632e697..b2e6923d5929 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -1465,6 +1465,7 @@  int drm_dp_downstream_id(struct drm_dp_aux *aux, char id[6]);
 void drm_dp_downstream_debug(struct seq_file *m, const u8 dpcd[DP_RECEIVER_CAP_SIZE],
 			     const u8 port_cap[4], struct drm_dp_aux *aux);
 
+void drm_dp_remote_aux_init(struct drm_dp_aux *aux);
 void drm_dp_aux_init(struct drm_dp_aux *aux);
 int drm_dp_aux_register(struct drm_dp_aux *aux);
 void drm_dp_aux_unregister(struct drm_dp_aux *aux);