diff mbox series

soundwire: add lane field in sdw_port_runtime

Message ID 20240806060930.10433-1-yung-chuan.liao@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series soundwire: add lane field in sdw_port_runtime | expand

Commit Message

Bard Liao Aug. 6, 2024, 6:09 a.m. UTC
Currently, lane_ctrl is always 0. Add a lane field in sdw_port_runtime
to indicate the data lane of the data port.
They are 0 by default.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
---
 drivers/soundwire/amd_manager.c                  | 2 +-
 drivers/soundwire/bus.h                          | 2 ++
 drivers/soundwire/generic_bandwidth_allocation.c | 4 ++--
 3 files changed, 5 insertions(+), 3 deletions(-)

Comments

Vinod Koul Aug. 18, 2024, 7:21 a.m. UTC | #1
On 06-08-24, 14:09, Bard Liao wrote:
> Currently, lane_ctrl is always 0. Add a lane field in sdw_port_runtime
> to indicate the data lane of the data port.
> They are 0 by default.

Use of the lane? also missing setting of lane variable, dont see in this
patch so we are passing garbage? It might work as structure is kzalloced
but I dont think we should be implicit, programming makes sense


> 
> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> ---
>  drivers/soundwire/amd_manager.c                  | 2 +-
>  drivers/soundwire/bus.h                          | 2 ++
>  drivers/soundwire/generic_bandwidth_allocation.c | 4 ++--
>  3 files changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c
> index 0d01849c3586..babb580f3124 100644
> --- a/drivers/soundwire/amd_manager.c
> +++ b/drivers/soundwire/amd_manager.c
> @@ -410,7 +410,7 @@ static int amd_sdw_compute_params(struct sdw_bus *bus)
>  			sdw_fill_xport_params(&p_rt->transport_params, p_rt->num,
>  					      false, SDW_BLK_GRP_CNT_1, sample_int,
>  					      port_bo, port_bo >> 8, hstart, hstop,
> -					      SDW_BLK_PKG_PER_PORT, 0x0);
> +					      SDW_BLK_PKG_PER_PORT, p_rt->lane);
>  
>  			sdw_fill_port_params(&p_rt->port_params,
>  					     p_rt->num, bps,
> diff --git a/drivers/soundwire/bus.h b/drivers/soundwire/bus.h
> index fda6b24ac2da..ff03b97f1d8b 100644
> --- a/drivers/soundwire/bus.h
> +++ b/drivers/soundwire/bus.h
> @@ -90,6 +90,7 @@ int sdw_find_col_index(int col);
>   * @transport_params: Transport parameters
>   * @port_params: Port parameters
>   * @port_node: List node for Master or Slave port_list
> + * @lane: Which lane is used
>   *
>   * SoundWire spec has no mention of ports for Master interface but the
>   * concept is logically extended.
> @@ -100,6 +101,7 @@ struct sdw_port_runtime {
>  	struct sdw_transport_params transport_params;
>  	struct sdw_port_params port_params;
>  	struct list_head port_node;
> +	unsigned int lane;
>  };
>  
>  /**
> diff --git a/drivers/soundwire/generic_bandwidth_allocation.c b/drivers/soundwire/generic_bandwidth_allocation.c
> index b9316207c3ab..abf9b85daa52 100644
> --- a/drivers/soundwire/generic_bandwidth_allocation.c
> +++ b/drivers/soundwire/generic_bandwidth_allocation.c
> @@ -56,7 +56,7 @@ void sdw_compute_slave_ports(struct sdw_master_runtime *m_rt,
>  					      sample_int, port_bo, port_bo >> 8,
>  					      t_data->hstart,
>  					      t_data->hstop,
> -					      SDW_BLK_PKG_PER_PORT, 0x0);
> +					      SDW_BLK_PKG_PER_PORT, p_rt->lane);
>  
>  			sdw_fill_port_params(&p_rt->port_params,
>  					     p_rt->num, bps,
> @@ -109,7 +109,7 @@ static void sdw_compute_master_ports(struct sdw_master_runtime *m_rt,
>  		sdw_fill_xport_params(&p_rt->transport_params, p_rt->num,
>  				      false, SDW_BLK_GRP_CNT_1, sample_int,
>  				      *port_bo, (*port_bo) >> 8, hstart, hstop,
> -				      SDW_BLK_PKG_PER_PORT, 0x0);
> +				      SDW_BLK_PKG_PER_PORT, p_rt->lane);
>  
>  		sdw_fill_port_params(&p_rt->port_params,
>  				     p_rt->num, bps,
> -- 
> 2.43.0
Liao, Bard Aug. 19, 2024, 3:27 a.m. UTC | #2
> -----Original Message-----
> From: Vinod Koul <vkoul@kernel.org>
> Sent: Sunday, August 18, 2024 3:21 PM
> To: Bard Liao <yung-chuan.liao@linux.intel.com>
> Cc: linux-sound@vger.kernel.org; linux-kernel@vger.kernel.org; pierre-
> louis.bossart@linux.intel.com; Liao, Bard <bard.liao@intel.com>
> Subject: Re: [PATCH] soundwire: add lane field in sdw_port_runtime
> 
> On 06-08-24, 14:09, Bard Liao wrote:
> > Currently, lane_ctrl is always 0. Add a lane field in sdw_port_runtime
> > to indicate the data lane of the data port.
> > They are 0 by default.
> 
> Use of the lane? also missing setting of lane variable, dont see in this
> patch so we are passing garbage? It might work as structure is kzalloced
> but I dont think we should be implicit, programming makes sense

Yes, p_rt is allocated by 	kzalloc. This patch is a preparation of
SouldWire multi-lane support. We will set the lane variable in
the follow-up patch later.

> 
> 
> >
> > Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> > ---
> >  drivers/soundwire/amd_manager.c                  | 2 +-
> >  drivers/soundwire/bus.h                          | 2 ++
> >  drivers/soundwire/generic_bandwidth_allocation.c | 4 ++--
> >  3 files changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/soundwire/amd_manager.c
> b/drivers/soundwire/amd_manager.c
> > index 0d01849c3586..babb580f3124 100644
> > --- a/drivers/soundwire/amd_manager.c
> > +++ b/drivers/soundwire/amd_manager.c
> > @@ -410,7 +410,7 @@ static int amd_sdw_compute_params(struct
> sdw_bus *bus)
> >  			sdw_fill_xport_params(&p_rt->transport_params,
> p_rt->num,
> >  					      false, SDW_BLK_GRP_CNT_1,
> sample_int,
> >  					      port_bo, port_bo >> 8, hstart,
> hstop,
> > -					      SDW_BLK_PKG_PER_PORT, 0x0);
> > +					      SDW_BLK_PKG_PER_PORT, p_rt-
> >lane);
> >
> >  			sdw_fill_port_params(&p_rt->port_params,
> >  					     p_rt->num, bps,
> > diff --git a/drivers/soundwire/bus.h b/drivers/soundwire/bus.h
> > index fda6b24ac2da..ff03b97f1d8b 100644
> > --- a/drivers/soundwire/bus.h
> > +++ b/drivers/soundwire/bus.h
> > @@ -90,6 +90,7 @@ int sdw_find_col_index(int col);
> >   * @transport_params: Transport parameters
> >   * @port_params: Port parameters
> >   * @port_node: List node for Master or Slave port_list
> > + * @lane: Which lane is used
> >   *
> >   * SoundWire spec has no mention of ports for Master interface but the
> >   * concept is logically extended.
> > @@ -100,6 +101,7 @@ struct sdw_port_runtime {
> >  	struct sdw_transport_params transport_params;
> >  	struct sdw_port_params port_params;
> >  	struct list_head port_node;
> > +	unsigned int lane;
> >  };
> >
> >  /**
> > diff --git a/drivers/soundwire/generic_bandwidth_allocation.c
> b/drivers/soundwire/generic_bandwidth_allocation.c
> > index b9316207c3ab..abf9b85daa52 100644
> > --- a/drivers/soundwire/generic_bandwidth_allocation.c
> > +++ b/drivers/soundwire/generic_bandwidth_allocation.c
> > @@ -56,7 +56,7 @@ void sdw_compute_slave_ports(struct
> sdw_master_runtime *m_rt,
> >  					      sample_int, port_bo, port_bo >> 8,
> >  					      t_data->hstart,
> >  					      t_data->hstop,
> > -					      SDW_BLK_PKG_PER_PORT, 0x0);
> > +					      SDW_BLK_PKG_PER_PORT, p_rt-
> >lane);
> >
> >  			sdw_fill_port_params(&p_rt->port_params,
> >  					     p_rt->num, bps,
> > @@ -109,7 +109,7 @@ static void sdw_compute_master_ports(struct
> sdw_master_runtime *m_rt,
> >  		sdw_fill_xport_params(&p_rt->transport_params, p_rt->num,
> >  				      false, SDW_BLK_GRP_CNT_1, sample_int,
> >  				      *port_bo, (*port_bo) >> 8, hstart, hstop,
> > -				      SDW_BLK_PKG_PER_PORT, 0x0);
> > +				      SDW_BLK_PKG_PER_PORT, p_rt->lane);
> >
> >  		sdw_fill_port_params(&p_rt->port_params,
> >  				     p_rt->num, bps,
> > --
> > 2.43.0
> 
> --
> ~Vinod
diff mbox series

Patch

diff --git a/drivers/soundwire/amd_manager.c b/drivers/soundwire/amd_manager.c
index 0d01849c3586..babb580f3124 100644
--- a/drivers/soundwire/amd_manager.c
+++ b/drivers/soundwire/amd_manager.c
@@ -410,7 +410,7 @@  static int amd_sdw_compute_params(struct sdw_bus *bus)
 			sdw_fill_xport_params(&p_rt->transport_params, p_rt->num,
 					      false, SDW_BLK_GRP_CNT_1, sample_int,
 					      port_bo, port_bo >> 8, hstart, hstop,
-					      SDW_BLK_PKG_PER_PORT, 0x0);
+					      SDW_BLK_PKG_PER_PORT, p_rt->lane);
 
 			sdw_fill_port_params(&p_rt->port_params,
 					     p_rt->num, bps,
diff --git a/drivers/soundwire/bus.h b/drivers/soundwire/bus.h
index fda6b24ac2da..ff03b97f1d8b 100644
--- a/drivers/soundwire/bus.h
+++ b/drivers/soundwire/bus.h
@@ -90,6 +90,7 @@  int sdw_find_col_index(int col);
  * @transport_params: Transport parameters
  * @port_params: Port parameters
  * @port_node: List node for Master or Slave port_list
+ * @lane: Which lane is used
  *
  * SoundWire spec has no mention of ports for Master interface but the
  * concept is logically extended.
@@ -100,6 +101,7 @@  struct sdw_port_runtime {
 	struct sdw_transport_params transport_params;
 	struct sdw_port_params port_params;
 	struct list_head port_node;
+	unsigned int lane;
 };
 
 /**
diff --git a/drivers/soundwire/generic_bandwidth_allocation.c b/drivers/soundwire/generic_bandwidth_allocation.c
index b9316207c3ab..abf9b85daa52 100644
--- a/drivers/soundwire/generic_bandwidth_allocation.c
+++ b/drivers/soundwire/generic_bandwidth_allocation.c
@@ -56,7 +56,7 @@  void sdw_compute_slave_ports(struct sdw_master_runtime *m_rt,
 					      sample_int, port_bo, port_bo >> 8,
 					      t_data->hstart,
 					      t_data->hstop,
-					      SDW_BLK_PKG_PER_PORT, 0x0);
+					      SDW_BLK_PKG_PER_PORT, p_rt->lane);
 
 			sdw_fill_port_params(&p_rt->port_params,
 					     p_rt->num, bps,
@@ -109,7 +109,7 @@  static void sdw_compute_master_ports(struct sdw_master_runtime *m_rt,
 		sdw_fill_xport_params(&p_rt->transport_params, p_rt->num,
 				      false, SDW_BLK_GRP_CNT_1, sample_int,
 				      *port_bo, (*port_bo) >> 8, hstart, hstop,
-				      SDW_BLK_PKG_PER_PORT, 0x0);
+				      SDW_BLK_PKG_PER_PORT, p_rt->lane);
 
 		sdw_fill_port_params(&p_rt->port_params,
 				     p_rt->num, bps,