[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190726144325.GH16003@ubuntu>
Date: Fri, 26 Jul 2019 16:43:25 +0200
From: Guennadi Liakhovetski <guennadi.liakhovetski@...ux.intel.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
Cc: alsa-devel@...a-project.org, tiwai@...e.de,
gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org,
vkoul@...nel.org, broonie@...nel.org,
srinivas.kandagatla@...aro.org, jank@...ence.com,
slawomir.blauciak@...el.com, Sanyog Kale <sanyog.r.kale@...el.com>
Subject: Re: [alsa-devel] [RFC PATCH 21/40] soundwire: export helpers to find
row and column values
On Thu, Jul 25, 2019 at 06:40:13PM -0500, Pierre-Louis Bossart wrote:
> Add a prefix for common tables and export 2 helpers to set the frame
> shapes based on row/col values.
>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
> ---
> drivers/soundwire/bus.h | 7 +++++--
> drivers/soundwire/stream.c | 14 ++++++++------
> 2 files changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/soundwire/bus.h b/drivers/soundwire/bus.h
> index 06ac4adb0074..c57c9c23f6ca 100644
> --- a/drivers/soundwire/bus.h
> +++ b/drivers/soundwire/bus.h
> @@ -73,8 +73,11 @@ struct sdw_msg {
>
> #define SDW_DOUBLE_RATE_FACTOR 2
>
> -extern int rows[SDW_FRAME_ROWS];
> -extern int cols[SDW_FRAME_COLS];
> +extern int sdw_rows[SDW_FRAME_ROWS];
> +extern int sdw_cols[SDW_FRAME_COLS];
So these arrays actually have to be exported? In the current (5.2) sources they
seem to only be used in stream.c, maybe make them static there?
> +
> +int sdw_find_row_index(int row);
> +int sdw_find_col_index(int col);
>
> /**
> * sdw_port_runtime: Runtime port parameters for Master or Slave
> diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
> index a0476755a459..53f5e790fcd7 100644
> --- a/drivers/soundwire/stream.c
> +++ b/drivers/soundwire/stream.c
> @@ -21,37 +21,39 @@
> * The rows are arranged as per the array index value programmed
> * in register. The index 15 has dummy value 0 in order to fill hole.
> */
> -int rows[SDW_FRAME_ROWS] = {48, 50, 60, 64, 75, 80, 125, 147,
> +int sdw_rows[SDW_FRAME_ROWS] = {48, 50, 60, 64, 75, 80, 125, 147,
> 96, 100, 120, 128, 150, 160, 250, 0,
> 192, 200, 240, 256, 72, 144, 90, 180};
>
> -int cols[SDW_FRAME_COLS] = {2, 4, 6, 8, 10, 12, 14, 16};
> +int sdw_cols[SDW_FRAME_COLS] = {2, 4, 6, 8, 10, 12, 14, 16};
>
> -static int sdw_find_col_index(int col)
> +int sdw_find_col_index(int col)
> {
> int i;
>
> for (i = 0; i < SDW_FRAME_COLS; i++) {
> - if (cols[i] == col)
> + if (sdw_cols[i] == col)
> return i;
> }
>
> pr_warn("Requested column not found, selecting lowest column no: 2\n");
> return 0;
> }
> +EXPORT_SYMBOL(sdw_find_col_index);
>
> -static int sdw_find_row_index(int row)
> +int sdw_find_row_index(int row)
> {
> int i;
>
> for (i = 0; i < SDW_FRAME_ROWS; i++) {
> - if (rows[i] == row)
> + if (sdw_rows[i] == row)
> return i;
> }
>
> pr_warn("Requested row not found, selecting lowest row no: 48\n");
> return 0;
> }
> +EXPORT_SYMBOL(sdw_find_row_index);
>
> static int _sdw_program_slave_port_params(struct sdw_bus *bus,
> struct sdw_slave *slave,
> --
> 2.20.1
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@...a-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Powered by blists - more mailing lists