LKML Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] soundwire: intel: fix PDI/stream mapping for Bulk
@ 2019-10-22 23:29 Pierre-Louis Bossart
  2019-10-24 11:23 ` Vinod Koul
  2019-11-09 11:15 ` Vinod Koul
  0 siblings, 2 replies; 4+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-22 23:29 UTC (permalink / raw)
  To: alsa-devel
  Cc: linux-kernel, tiwai, broonie, vkoul, gregkh, jank,
	srinivas.kandagatla, slawomir.blauciak, Bard liao, Rander Wang,
	Ranjani Sridharan, Pierre-Louis Bossart, Sanyog Kale

The previous formula is incorrect for PDI0/1, the mapping is not
linear but has a discontinuity between PDI1 and PDI2.

This change has no effect on PCM PDIs (same mapping).

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 drivers/soundwire/intel.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
index b403ccc832b6..c984261fcc33 100644
--- a/drivers/soundwire/intel.c
+++ b/drivers/soundwire/intel.c
@@ -480,7 +480,10 @@ intel_pdi_shim_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi)
 	unsigned int link_id = sdw->instance;
 	int pdi_conf = 0;
 
-	pdi->intel_alh_id = (link_id * 16) + pdi->num + 5;
+	/* the Bulk and PCM streams are not contiguous */
+	pdi->intel_alh_id = (link_id * 16) + pdi->num + 3;
+	if (pdi->num >= 2)
+		pdi->intel_alh_id += 2;
 
 	/*
 	 * Program stream parameters to stream SHIM register
@@ -509,7 +512,10 @@ intel_pdi_alh_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi)
 	unsigned int link_id = sdw->instance;
 	unsigned int conf;
 
-	pdi->intel_alh_id = (link_id * 16) + pdi->num + 5;
+	/* the Bulk and PCM streams are not contiguous */
+	pdi->intel_alh_id = (link_id * 16) + pdi->num + 3;
+	if (pdi->num >= 2)
+		pdi->intel_alh_id += 2;
 
 	/* Program Stream config ALH register */
 	conf = intel_readl(alh, SDW_ALH_STRMZCFG(pdi->intel_alh_id));
-- 
2.20.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] soundwire: intel: fix PDI/stream mapping for Bulk
  2019-10-22 23:29 [PATCH] soundwire: intel: fix PDI/stream mapping for Bulk Pierre-Louis Bossart
@ 2019-10-24 11:23 ` Vinod Koul
  2019-10-24 12:37   ` [alsa-devel] " Pierre-Louis Bossart
  2019-11-09 11:15 ` Vinod Koul
  1 sibling, 1 reply; 4+ messages in thread
From: Vinod Koul @ 2019-10-24 11:23 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, linux-kernel, tiwai, broonie, gregkh, jank,
	srinivas.kandagatla, slawomir.blauciak, Bard liao, Rander Wang,
	Ranjani Sridharan, Sanyog Kale

On 22-10-19, 18:29, Pierre-Louis Bossart wrote:
> The previous formula is incorrect for PDI0/1, the mapping is not
> linear but has a discontinuity between PDI1 and PDI2.
> 
> This change has no effect on PCM PDIs (same mapping).
> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>  drivers/soundwire/intel.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
> index b403ccc832b6..c984261fcc33 100644
> --- a/drivers/soundwire/intel.c
> +++ b/drivers/soundwire/intel.c
> @@ -480,7 +480,10 @@ intel_pdi_shim_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi)
>  	unsigned int link_id = sdw->instance;
>  	int pdi_conf = 0;
>  
> -	pdi->intel_alh_id = (link_id * 16) + pdi->num + 5;
> +	/* the Bulk and PCM streams are not contiguous */
> +	pdi->intel_alh_id = (link_id * 16) + pdi->num + 3;
> +	if (pdi->num >= 2)
> +		pdi->intel_alh_id += 2;
>  
>  	/*
>  	 * Program stream parameters to stream SHIM register
> @@ -509,7 +512,10 @@ intel_pdi_alh_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi)
>  	unsigned int link_id = sdw->instance;
>  	unsigned int conf;
>  
> -	pdi->intel_alh_id = (link_id * 16) + pdi->num + 5;
> +	/* the Bulk and PCM streams are not contiguous */
> +	pdi->intel_alh_id = (link_id * 16) + pdi->num + 3;
> +	if (pdi->num >= 2)
> +		pdi->intel_alh_id += 2;

The change is repeated so how about:

        intel_pdi_update_alh() or similar which does this rather than
repeat the pattern

>  
>  	/* Program Stream config ALH register */
>  	conf = intel_readl(alh, SDW_ALH_STRMZCFG(pdi->intel_alh_id));
> -- 
> 2.20.1

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [alsa-devel] [PATCH] soundwire: intel: fix PDI/stream mapping for Bulk
  2019-10-24 11:23 ` Vinod Koul
@ 2019-10-24 12:37   ` " Pierre-Louis Bossart
  0 siblings, 0 replies; 4+ messages in thread
From: Pierre-Louis Bossart @ 2019-10-24 12:37 UTC (permalink / raw)
  To: Vinod Koul
  Cc: alsa-devel, tiwai, gregkh, linux-kernel, Ranjani Sridharan,
	broonie, srinivas.kandagatla, jank, slawomir.blauciak,
	Sanyog Kale, Bard liao, Rander Wang

On 10/24/19 6:23 AM, Vinod Koul wrote:
> On 22-10-19, 18:29, Pierre-Louis Bossart wrote:
>> The previous formula is incorrect for PDI0/1, the mapping is not
>> linear but has a discontinuity between PDI1 and PDI2.
>>
>> This change has no effect on PCM PDIs (same mapping).
>>
>> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
>> ---
>>   drivers/soundwire/intel.c | 10 ++++++++--
>>   1 file changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
>> index b403ccc832b6..c984261fcc33 100644
>> --- a/drivers/soundwire/intel.c
>> +++ b/drivers/soundwire/intel.c
>> @@ -480,7 +480,10 @@ intel_pdi_shim_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi)
>>   	unsigned int link_id = sdw->instance;
>>   	int pdi_conf = 0;
>>   
>> -	pdi->intel_alh_id = (link_id * 16) + pdi->num + 5;
>> +	/* the Bulk and PCM streams are not contiguous */
>> +	pdi->intel_alh_id = (link_id * 16) + pdi->num + 3;
>> +	if (pdi->num >= 2)
>> +		pdi->intel_alh_id += 2;
>>   
>>   	/*
>>   	 * Program stream parameters to stream SHIM register
>> @@ -509,7 +512,10 @@ intel_pdi_alh_configure(struct sdw_intel *sdw, struct sdw_cdns_pdi *pdi)
>>   	unsigned int link_id = sdw->instance;
>>   	unsigned int conf;
>>   
>> -	pdi->intel_alh_id = (link_id * 16) + pdi->num + 5;
>> +	/* the Bulk and PCM streams are not contiguous */
>> +	pdi->intel_alh_id = (link_id * 16) + pdi->num + 3;
>> +	if (pdi->num >= 2)
>> +		pdi->intel_alh_id += 2;
> 
> The change is repeated so how about:
> 
>          intel_pdi_update_alh() or similar which does this rather than
> repeat the pattern

The initial code was also repeated by the initial contributors, this 
patch does not refactor the code but corrects an invalid mapping. We 
will do this refactoring at a later point, when we add the clock-stop mode.

> 
>>   
>>   	/* Program Stream config ALH register */
>>   	conf = intel_readl(alh, SDW_ALH_STRMZCFG(pdi->intel_alh_id));
>> -- 
>> 2.20.1
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] soundwire: intel: fix PDI/stream mapping for Bulk
  2019-10-22 23:29 [PATCH] soundwire: intel: fix PDI/stream mapping for Bulk Pierre-Louis Bossart
  2019-10-24 11:23 ` Vinod Koul
@ 2019-11-09 11:15 ` Vinod Koul
  1 sibling, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2019-11-09 11:15 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, linux-kernel, tiwai, broonie, gregkh, jank,
	srinivas.kandagatla, slawomir.blauciak, Bard liao, Rander Wang,
	Ranjani Sridharan, Sanyog Kale

On 22-10-19, 18:29, Pierre-Louis Bossart wrote:
> The previous formula is incorrect for PDI0/1, the mapping is not
> linear but has a discontinuity between PDI1 and PDI2.
> 
> This change has no effect on PCM PDIs (same mapping).

Applied now

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-22 23:29 [PATCH] soundwire: intel: fix PDI/stream mapping for Bulk Pierre-Louis Bossart
2019-10-24 11:23 ` Vinod Koul
2019-10-24 12:37   ` [alsa-devel] " Pierre-Louis Bossart
2019-11-09 11:15 ` Vinod Koul

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git