All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soundwire: qcom: fix handling of qcom,ports-block-pack-mode
@ 2021-05-04 12:59 ` Srinivas Kandagatla
  0 siblings, 0 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2021-05-04 12:59 UTC (permalink / raw)
  To: vkoul
  Cc: yung-chuan.liao, pierre-louis.bossart, sanyog.r.kale, alsa-devel,
	linux-kernel, bjorn.andersson, amit.pundir, Srinivas Kandagatla

Support to "qcom,ports-block-pack-mode" was added at later stages
to support a variant of Qualcomm SoundWire controllers available
on Apps processor. However the older versions of the SoundWire
controller which are embedded in WCD Codecs do not need this property.

So returning on error for those cases will break boards like DragonBoard
DB845c and Lenovo Yoga C630.

This patch fixes error handling on this property considering older usecases.

Fixes: 5943e4fb14e3 ("soundwire: qcom: check of_property_read status")
Reported-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 2827085a323b..0ef79d60e88e 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1150,8 +1150,16 @@ static int qcom_swrm_get_port_config(struct qcom_swrm_ctrl *ctrl)
 
 	ret = of_property_read_u8_array(np, "qcom,ports-block-pack-mode",
 					bp_mode, nports);
-	if (ret)
-		return ret;
+	if (ret) {
+		u32 version;
+
+		ctrl->reg_read(ctrl, SWRM_COMP_HW_VERSION, &version);
+
+		if (version <= 0x01030000)
+			memset(bp_mode, SWR_INVALID_PARAM, QCOM_SDW_MAX_PORTS);
+		else
+			return ret;
+	}
 
 	memset(hstart, SWR_INVALID_PARAM, QCOM_SDW_MAX_PORTS);
 	of_property_read_u8_array(np, "qcom,ports-hstart", hstart, nports);
-- 
2.21.0


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

* [PATCH] soundwire: qcom: fix handling of qcom,ports-block-pack-mode
@ 2021-05-04 12:59 ` Srinivas Kandagatla
  0 siblings, 0 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2021-05-04 12:59 UTC (permalink / raw)
  To: vkoul
  Cc: amit.pundir, alsa-devel, linux-kernel, pierre-louis.bossart,
	bjorn.andersson, sanyog.r.kale, yung-chuan.liao

Support to "qcom,ports-block-pack-mode" was added at later stages
to support a variant of Qualcomm SoundWire controllers available
on Apps processor. However the older versions of the SoundWire
controller which are embedded in WCD Codecs do not need this property.

So returning on error for those cases will break boards like DragonBoard
DB845c and Lenovo Yoga C630.

This patch fixes error handling on this property considering older usecases.

Fixes: 5943e4fb14e3 ("soundwire: qcom: check of_property_read status")
Reported-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/soundwire/qcom.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index 2827085a323b..0ef79d60e88e 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1150,8 +1150,16 @@ static int qcom_swrm_get_port_config(struct qcom_swrm_ctrl *ctrl)
 
 	ret = of_property_read_u8_array(np, "qcom,ports-block-pack-mode",
 					bp_mode, nports);
-	if (ret)
-		return ret;
+	if (ret) {
+		u32 version;
+
+		ctrl->reg_read(ctrl, SWRM_COMP_HW_VERSION, &version);
+
+		if (version <= 0x01030000)
+			memset(bp_mode, SWR_INVALID_PARAM, QCOM_SDW_MAX_PORTS);
+		else
+			return ret;
+	}
 
 	memset(hstart, SWR_INVALID_PARAM, QCOM_SDW_MAX_PORTS);
 	of_property_read_u8_array(np, "qcom,ports-hstart", hstart, nports);
-- 
2.21.0


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

* Re: [PATCH] soundwire: qcom: fix handling of qcom,ports-block-pack-mode
  2021-05-04 12:59 ` Srinivas Kandagatla
@ 2021-05-04 13:28   ` Amit Pundir
  -1 siblings, 0 replies; 6+ messages in thread
From: Amit Pundir @ 2021-05-04 13:28 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Vinod Koul, yung-chuan.liao, pierre-louis.bossart, sanyog.r.kale,
	alsa-devel, lkml, Bjorn Andersson, John Stultz

On Tue, 4 May 2021 at 18:29, Srinivas Kandagatla
<srinivas.kandagatla@linaro.org> wrote:
>
> Support to "qcom,ports-block-pack-mode" was added at later stages
> to support a variant of Qualcomm SoundWire controllers available
> on Apps processor. However the older versions of the SoundWire
> controller which are embedded in WCD Codecs do not need this property.
>
> So returning on error for those cases will break boards like DragonBoard
> DB845c and Lenovo Yoga C630.
>
> This patch fixes error handling on this property considering older usecases.

Tested on Xiaomi Pocophone F1 (sdm845).

Tested-by: Amit Pundir <amit.pundir@linaro.org>

>
> Fixes: 5943e4fb14e3 ("soundwire: qcom: check of_property_read status")
> Reported-by: Amit Pundir <amit.pundir@linaro.org>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  drivers/soundwire/qcom.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index 2827085a323b..0ef79d60e88e 100644
> --- a/drivers/soundwire/qcom.c
> +++ b/drivers/soundwire/qcom.c
> @@ -1150,8 +1150,16 @@ static int qcom_swrm_get_port_config(struct qcom_swrm_ctrl *ctrl)
>
>         ret = of_property_read_u8_array(np, "qcom,ports-block-pack-mode",
>                                         bp_mode, nports);
> -       if (ret)
> -               return ret;
> +       if (ret) {
> +               u32 version;
> +
> +               ctrl->reg_read(ctrl, SWRM_COMP_HW_VERSION, &version);
> +
> +               if (version <= 0x01030000)
> +                       memset(bp_mode, SWR_INVALID_PARAM, QCOM_SDW_MAX_PORTS);
> +               else
> +                       return ret;
> +       }
>
>         memset(hstart, SWR_INVALID_PARAM, QCOM_SDW_MAX_PORTS);
>         of_property_read_u8_array(np, "qcom,ports-hstart", hstart, nports);
> --
> 2.21.0
>

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

* Re: [PATCH] soundwire: qcom: fix handling of qcom, ports-block-pack-mode
@ 2021-05-04 13:28   ` Amit Pundir
  0 siblings, 0 replies; 6+ messages in thread
From: Amit Pundir @ 2021-05-04 13:28 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: alsa-devel, pierre-louis.bossart, lkml, Vinod Koul, John Stultz,
	sanyog.r.kale, Bjorn Andersson, yung-chuan.liao

On Tue, 4 May 2021 at 18:29, Srinivas Kandagatla
<srinivas.kandagatla@linaro.org> wrote:
>
> Support to "qcom,ports-block-pack-mode" was added at later stages
> to support a variant of Qualcomm SoundWire controllers available
> on Apps processor. However the older versions of the SoundWire
> controller which are embedded in WCD Codecs do not need this property.
>
> So returning on error for those cases will break boards like DragonBoard
> DB845c and Lenovo Yoga C630.
>
> This patch fixes error handling on this property considering older usecases.

Tested on Xiaomi Pocophone F1 (sdm845).

Tested-by: Amit Pundir <amit.pundir@linaro.org>

>
> Fixes: 5943e4fb14e3 ("soundwire: qcom: check of_property_read status")
> Reported-by: Amit Pundir <amit.pundir@linaro.org>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  drivers/soundwire/qcom.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index 2827085a323b..0ef79d60e88e 100644
> --- a/drivers/soundwire/qcom.c
> +++ b/drivers/soundwire/qcom.c
> @@ -1150,8 +1150,16 @@ static int qcom_swrm_get_port_config(struct qcom_swrm_ctrl *ctrl)
>
>         ret = of_property_read_u8_array(np, "qcom,ports-block-pack-mode",
>                                         bp_mode, nports);
> -       if (ret)
> -               return ret;
> +       if (ret) {
> +               u32 version;
> +
> +               ctrl->reg_read(ctrl, SWRM_COMP_HW_VERSION, &version);
> +
> +               if (version <= 0x01030000)
> +                       memset(bp_mode, SWR_INVALID_PARAM, QCOM_SDW_MAX_PORTS);
> +               else
> +                       return ret;
> +       }
>
>         memset(hstart, SWR_INVALID_PARAM, QCOM_SDW_MAX_PORTS);
>         of_property_read_u8_array(np, "qcom,ports-hstart", hstart, nports);
> --
> 2.21.0
>

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

* Re: [PATCH] soundwire: qcom: fix handling of qcom,ports-block-pack-mode
  2021-05-04 12:59 ` Srinivas Kandagatla
@ 2021-05-11 11:18   ` Vinod Koul
  -1 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2021-05-11 11:18 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: yung-chuan.liao, pierre-louis.bossart, sanyog.r.kale, alsa-devel,
	linux-kernel, bjorn.andersson, amit.pundir

On 04-05-21, 13:59, Srinivas Kandagatla wrote:
> Support to "qcom,ports-block-pack-mode" was added at later stages
> to support a variant of Qualcomm SoundWire controllers available
> on Apps processor. However the older versions of the SoundWire
> controller which are embedded in WCD Codecs do not need this property.
> 
> So returning on error for those cases will break boards like DragonBoard
> DB845c and Lenovo Yoga C630.
> 
> This patch fixes error handling on this property considering older usecases.

Applied, thanks

-- 
~Vinod

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

* Re: [PATCH] soundwire: qcom: fix handling of qcom,ports-block-pack-mode
@ 2021-05-11 11:18   ` Vinod Koul
  0 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2021-05-11 11:18 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: amit.pundir, alsa-devel, linux-kernel, pierre-louis.bossart,
	bjorn.andersson, sanyog.r.kale, yung-chuan.liao

On 04-05-21, 13:59, Srinivas Kandagatla wrote:
> Support to "qcom,ports-block-pack-mode" was added at later stages
> to support a variant of Qualcomm SoundWire controllers available
> on Apps processor. However the older versions of the SoundWire
> controller which are embedded in WCD Codecs do not need this property.
> 
> So returning on error for those cases will break boards like DragonBoard
> DB845c and Lenovo Yoga C630.
> 
> This patch fixes error handling on this property considering older usecases.

Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2021-05-11 11:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 12:59 [PATCH] soundwire: qcom: fix handling of qcom,ports-block-pack-mode Srinivas Kandagatla
2021-05-04 12:59 ` Srinivas Kandagatla
2021-05-04 13:28 ` Amit Pundir
2021-05-04 13:28   ` [PATCH] soundwire: qcom: fix handling of qcom, ports-block-pack-mode Amit Pundir
2021-05-11 11:18 ` [PATCH] soundwire: qcom: fix handling of qcom,ports-block-pack-mode Vinod Koul
2021-05-11 11:18   ` 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.