Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2535305ybh; Mon, 5 Aug 2019 02:40:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqziwdEG1/fmdA/VMqJLB601yc6KHuo5XkOarQqLBIqhuPDRxxbAhk56UeADjw0gHa/MMbmm X-Received: by 2002:a17:902:e20c:: with SMTP id ce12mr17575895plb.130.1564998008377; Mon, 05 Aug 2019 02:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564998008; cv=none; d=google.com; s=arc-20160816; b=GvbuyByyLCERgE0t5pntNNZWLLnoz/kfb/aEKX/wfqfqmuiUx9zx4TGPvRlU7oiDc0 sUjpnUr/0E0lx6IeRFa6sMsv+jm6p6iS4rA4PpSRHl6JEc3jw5HsLOnf6SucmdbXv6mG cVqS7rZtDXwiMCYM2x2+njsJr9OiM+POL8XspXdjlbEzY4dP0oPZHpO34HCDIEHPf3Z4 zAw/bZYeK1gK6SBZRRcOJ4afjOgVj/8woZXgStXYyYAPv+Mz9IIvjbdAFBOSO+UrGEqB OEJ3TNi0yiohbRAF4IpfeJk8UKzFeBfJc5YFa2IfjMOtPaaykmZQ6EYUszAIX+x256mU HLnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=B+GoUKWgTHpAHS4xGiSk4pGR0/jaKmOOuxUkg1r3jDE=; b=I5u5l8Jp6VeMzXYd86HzUrNQnt3JD1RaAAKG12ZF1FrVzfMXKIBBGpf6JweZWnN1FN H4+c7WH5A5Xa3Ce+ztcVj4Ryoda22kzQrGzXah+ZEt88mquZcBaDQC4sLWTpq6utAK26 vqmHBLUnkhpAYM++xStS9e/glgI5D2eG1wzDyta81PL7dIdHdB6/SLZ7egpmCkBOQ4DK V9kdVXtbdD1ABwCEHiqDMgTQzXP7dIJa9aYXxL6l+1UTGcEIiiUnDmbuG2D2KHJajaO0 hCAt6Hvf11rU4NcdrfZu2ktwtRyl6q+DxeM5qRN3/139ZjVAmB6bHPa0bjTpEwM8irTF bqHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l191si43812452pge.94.2019.08.05.02.39.52; Mon, 05 Aug 2019 02:40:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727809AbfHEJiA (ORCPT + 99 others); Mon, 5 Aug 2019 05:38:00 -0400 Received: from mga03.intel.com ([134.134.136.65]:32372 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726880AbfHEJiA (ORCPT ); Mon, 5 Aug 2019 05:38:00 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Aug 2019 02:37:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,349,1559545200"; d="scan'208";a="167921292" Received: from buildpc-hp-z230.iind.intel.com (HELO buildpc-HP-Z230) ([10.223.89.34]) by orsmga008.jf.intel.com with ESMTP; 05 Aug 2019 02:37:31 -0700 Date: Mon, 5 Aug 2019 15:09:23 +0530 From: Sanyog Kale To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, vkoul@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, slawomir.blauciak@intel.com Subject: Re: [RFC PATCH 21/40] soundwire: export helpers to find row and column values Message-ID: <20190805093923.GC22437@buildpc-HP-Z230> References: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> <20190725234032.21152-22-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190725234032.21152-22-pierre-louis.bossart@linux.intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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]; > + > +int sdw_find_row_index(int row); > +int sdw_find_col_index(int col); We use index values only in bank switch operations to program registers. Do we really need to export sdw_find_row_index & sdw_find_col_index?? If i understand correctly the allocation algorithm only needs to know about cols and rows values and not index. > > /** > * 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 > --