All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soundwire: stream: use sdw_write instead of update
@ 2020-03-12 10:01 ` Srinivas Kandagatla
  0 siblings, 0 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2020-03-12 10:01 UTC (permalink / raw)
  To: vkoul; +Cc: pierre-louis.bossart, linux-kernel, alsa-devel, Srinivas Kandagatla

There is no point in using update for registers with write mask
as 0xFF, this adds unecessary traffic on the bus.
Just use sdw_write directly.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/stream.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
index 00348d1fc606..1b43d03c79ea 100644
--- a/drivers/soundwire/stream.c
+++ b/drivers/soundwire/stream.c
@@ -313,9 +313,9 @@ static int sdw_enable_disable_slave_ports(struct sdw_bus *bus,
 	 * it is safe to reset this register
 	 */
 	if (en)
-		ret = sdw_update(s_rt->slave, addr, 0xFF, p_rt->ch_mask);
+		ret = sdw_write(s_rt->slave, addr, p_rt->ch_mask);
 	else
-		ret = sdw_update(s_rt->slave, addr, 0xFF, 0x0);
+		ret = sdw_write(s_rt->slave, addr, 0x0);
 
 	if (ret < 0)
 		dev_err(&s_rt->slave->dev,
@@ -464,10 +464,9 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus,
 		addr = SDW_DPN_PREPARECTRL(p_rt->num);
 
 		if (prep)
-			ret = sdw_update(s_rt->slave, addr,
-					 0xFF, p_rt->ch_mask);
+			ret = sdw_write(s_rt->slave, addr, p_rt->ch_mask);
 		else
-			ret = sdw_update(s_rt->slave, addr, 0xFF, 0x0);
+			ret = sdw_write(s_rt->slave, addr, 0x0);
 
 		if (ret < 0) {
 			dev_err(&s_rt->slave->dev,
-- 
2.21.0


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

* [PATCH] soundwire: stream: use sdw_write instead of update
@ 2020-03-12 10:01 ` Srinivas Kandagatla
  0 siblings, 0 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2020-03-12 10:01 UTC (permalink / raw)
  To: vkoul; +Cc: alsa-devel, Srinivas Kandagatla, pierre-louis.bossart, linux-kernel

There is no point in using update for registers with write mask
as 0xFF, this adds unecessary traffic on the bus.
Just use sdw_write directly.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/stream.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
index 00348d1fc606..1b43d03c79ea 100644
--- a/drivers/soundwire/stream.c
+++ b/drivers/soundwire/stream.c
@@ -313,9 +313,9 @@ static int sdw_enable_disable_slave_ports(struct sdw_bus *bus,
 	 * it is safe to reset this register
 	 */
 	if (en)
-		ret = sdw_update(s_rt->slave, addr, 0xFF, p_rt->ch_mask);
+		ret = sdw_write(s_rt->slave, addr, p_rt->ch_mask);
 	else
-		ret = sdw_update(s_rt->slave, addr, 0xFF, 0x0);
+		ret = sdw_write(s_rt->slave, addr, 0x0);
 
 	if (ret < 0)
 		dev_err(&s_rt->slave->dev,
@@ -464,10 +464,9 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus,
 		addr = SDW_DPN_PREPARECTRL(p_rt->num);
 
 		if (prep)
-			ret = sdw_update(s_rt->slave, addr,
-					 0xFF, p_rt->ch_mask);
+			ret = sdw_write(s_rt->slave, addr, p_rt->ch_mask);
 		else
-			ret = sdw_update(s_rt->slave, addr, 0xFF, 0x0);
+			ret = sdw_write(s_rt->slave, addr, 0x0);
 
 		if (ret < 0) {
 			dev_err(&s_rt->slave->dev,
-- 
2.21.0


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

* Re: [PATCH] soundwire: stream: use sdw_write instead of update
  2020-03-12 10:01 ` Srinivas Kandagatla
@ 2020-03-12 10:45   ` Pierre-Louis Bossart
  -1 siblings, 0 replies; 6+ messages in thread
From: Pierre-Louis Bossart @ 2020-03-12 10:45 UTC (permalink / raw)
  To: Srinivas Kandagatla, vkoul; +Cc: linux-kernel, alsa-devel



On 3/12/20 5:01 AM, Srinivas Kandagatla wrote:
> There is no point in using update for registers with write mask
> as 0xFF, this adds unecessary traffic on the bus.
> Just use sdw_write directly.

well in theory you could have two streams share the same port, that's 
allowed by the specification.

But since it clearly documented as not supported

	/*
	 * Since bus doesn't support sharing a port across two streams,
	 * it is safe to reset this register
	 */

this mask handing is indeed completely overkill.

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>   drivers/soundwire/stream.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
> index 00348d1fc606..1b43d03c79ea 100644
> --- a/drivers/soundwire/stream.c
> +++ b/drivers/soundwire/stream.c
> @@ -313,9 +313,9 @@ static int sdw_enable_disable_slave_ports(struct sdw_bus *bus,
>   	 * it is safe to reset this register
>   	 */
>   	if (en)
> -		ret = sdw_update(s_rt->slave, addr, 0xFF, p_rt->ch_mask);
> +		ret = sdw_write(s_rt->slave, addr, p_rt->ch_mask);
>   	else
> -		ret = sdw_update(s_rt->slave, addr, 0xFF, 0x0);
> +		ret = sdw_write(s_rt->slave, addr, 0x0);
>   
>   	if (ret < 0)
>   		dev_err(&s_rt->slave->dev,
> @@ -464,10 +464,9 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus,
>   		addr = SDW_DPN_PREPARECTRL(p_rt->num);
>   
>   		if (prep)
> -			ret = sdw_update(s_rt->slave, addr,
> -					 0xFF, p_rt->ch_mask);
> +			ret = sdw_write(s_rt->slave, addr, p_rt->ch_mask);
>   		else
> -			ret = sdw_update(s_rt->slave, addr, 0xFF, 0x0);
> +			ret = sdw_write(s_rt->slave, addr, 0x0);
>   
>   		if (ret < 0) {
>   			dev_err(&s_rt->slave->dev,
> 

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

* Re: [PATCH] soundwire: stream: use sdw_write instead of update
@ 2020-03-12 10:45   ` Pierre-Louis Bossart
  0 siblings, 0 replies; 6+ messages in thread
From: Pierre-Louis Bossart @ 2020-03-12 10:45 UTC (permalink / raw)
  To: Srinivas Kandagatla, vkoul; +Cc: alsa-devel, linux-kernel



On 3/12/20 5:01 AM, Srinivas Kandagatla wrote:
> There is no point in using update for registers with write mask
> as 0xFF, this adds unecessary traffic on the bus.
> Just use sdw_write directly.

well in theory you could have two streams share the same port, that's 
allowed by the specification.

But since it clearly documented as not supported

	/*
	 * Since bus doesn't support sharing a port across two streams,
	 * it is safe to reset this register
	 */

this mask handing is indeed completely overkill.

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>   drivers/soundwire/stream.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c
> index 00348d1fc606..1b43d03c79ea 100644
> --- a/drivers/soundwire/stream.c
> +++ b/drivers/soundwire/stream.c
> @@ -313,9 +313,9 @@ static int sdw_enable_disable_slave_ports(struct sdw_bus *bus,
>   	 * it is safe to reset this register
>   	 */
>   	if (en)
> -		ret = sdw_update(s_rt->slave, addr, 0xFF, p_rt->ch_mask);
> +		ret = sdw_write(s_rt->slave, addr, p_rt->ch_mask);
>   	else
> -		ret = sdw_update(s_rt->slave, addr, 0xFF, 0x0);
> +		ret = sdw_write(s_rt->slave, addr, 0x0);
>   
>   	if (ret < 0)
>   		dev_err(&s_rt->slave->dev,
> @@ -464,10 +464,9 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus,
>   		addr = SDW_DPN_PREPARECTRL(p_rt->num);
>   
>   		if (prep)
> -			ret = sdw_update(s_rt->slave, addr,
> -					 0xFF, p_rt->ch_mask);
> +			ret = sdw_write(s_rt->slave, addr, p_rt->ch_mask);
>   		else
> -			ret = sdw_update(s_rt->slave, addr, 0xFF, 0x0);
> +			ret = sdw_write(s_rt->slave, addr, 0x0);
>   
>   		if (ret < 0) {
>   			dev_err(&s_rt->slave->dev,
> 

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

* Re: [PATCH] soundwire: stream: use sdw_write instead of update
  2020-03-12 10:01 ` Srinivas Kandagatla
@ 2020-03-13 12:37   ` Vinod Koul
  -1 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2020-03-13 12:37 UTC (permalink / raw)
  To: Srinivas Kandagatla; +Cc: pierre-louis.bossart, linux-kernel, alsa-devel

On 12-03-20, 10:01, Srinivas Kandagatla wrote:
> There is no point in using update for registers with write mask
> as 0xFF, this adds unecessary traffic on the bus.
s/unecessary/unnecessary

> Just use sdw_write directly.

Applied with typo fixed, thanks
-- 
~Vinod

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

* Re: [PATCH] soundwire: stream: use sdw_write instead of update
@ 2020-03-13 12:37   ` Vinod Koul
  0 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2020-03-13 12:37 UTC (permalink / raw)
  To: Srinivas Kandagatla; +Cc: alsa-devel, pierre-louis.bossart, linux-kernel

On 12-03-20, 10:01, Srinivas Kandagatla wrote:
> There is no point in using update for registers with write mask
> as 0xFF, this adds unecessary traffic on the bus.
s/unecessary/unnecessary

> Just use sdw_write directly.

Applied with typo fixed, thanks
-- 
~Vinod

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

end of thread, other threads:[~2020-03-13 12:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-12 10:01 [PATCH] soundwire: stream: use sdw_write instead of update Srinivas Kandagatla
2020-03-12 10:01 ` Srinivas Kandagatla
2020-03-12 10:45 ` Pierre-Louis Bossart
2020-03-12 10:45   ` Pierre-Louis Bossart
2020-03-13 12:37 ` Vinod Koul
2020-03-13 12:37   ` Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.