Skip to contentSkip to conversation

Fix the PowerQUICC audio support using the QMC

PATCH In review Herve Codina 3 participants 8 messages Mar 7, 2023 – Mar 9, 2023

Subsystems (5)
lore
Share & tools
lore

Herve Codina

author maintainer
#0 lore raw

cover Fix the PowerQUICC audio support using the QMC

A previous series added the PowerQUICC audio support using the QMC. The v6 version of this previous series was applied but some feedbacks lead to a v7 version.

The v6 can be found here:
https://lore.kernel.org/linux-kernel/[email protected]/
and the v7, here:
https://lore.kernel.org/linux-kernel/[email protected]/

This 'fix' series is the incremental version of v6 -> v7 and can only be applied on the Marc Brown's tree as the v6 patches it fixes are only present on this tree.

Regards,
Herve Codina

Herve Codina (3):
dt-bindings: soc: fsl: cpm_qe: cpm1-scc-qmc: Remove unneeded property
dt-bindings: soc: fsl: cpm_qe: cpm1-tsa: Remove unneeded property
soc: fsl: cpm1: qmc: Fix assigned timeslot masks

 .../bindings/soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yaml      | 10 ----------
 .../bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml          | 10 ----------
 drivers/soc/fsl/qe/qmc.c                               | 10 +++++++---
 3 files changed, 7 insertions(+), 23 deletions(-)
Signature · 1 line
2.39.2
#1 lore raw

PATCH 1/3 dt-bindings: soc: fsl: cpm_qe: cpm1-scc-qmc: Remove unneeded property

Remove the unneeded and unused #fsl,chan-cells property.

---
 .../bindings/soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yaml      | 10 ----------
 1 file changed, 10 deletions(-)
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yaml +0 -10
index 4ebbc7d52981..ec888f48cac8 100644
@@ -59,14 +59,6 @@ properties:
   '#size-cells':
     const: 0
 
-  '#fsl,chan-cells':
-    $ref: /schemas/types.yaml#/definitions/uint32
-    const: 1
-    description:
-      QMC consumers that use a phandle to QMC need to pass the channel number
-      with this phandle.
-      For instance "fsl,qmc-chan = <&qmc 16>;".
-
 patternProperties:
   '^channel@([0-9]|[1-5][0-9]|6[0-3])$':
     description:
@@ -121,7 +113,6 @@ required:
   - fsl,tsa-serial
   - '#address-cells'
   - '#size-cells'
-  - '#fsl,chan-cells'
 
 additionalProperties: false
 
@@ -140,7 +131,6 @@ examples:
 
         #address-cells = <1>;
         #size-cells = <0>;
-        #fsl,chan-cells = <1>;
 
         fsl,tsa-serial = <&tsa FSL_CPM_TSA_SCC4>;
 
Signature · 1 line
2.39.2
author maintainer
#2 lore raw

PATCH 1/3 dt-bindings: soc: fsl: cpm_qe: cpm1-scc-qmc: Remove unneeded property

In reply to Herve Codina

Remove the unneeded and unused #fsl,chan-cells property.

---
 .../bindings/soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yaml      | 10 ----------
 1 file changed, 10 deletions(-)
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-scc-qmc.yaml +0 -10
index 4ebbc7d52981..ec888f48cac8 100644
@@ -59,14 +59,6 @@ properties:
   '#size-cells':
     const: 0
 
-  '#fsl,chan-cells':
-    $ref: /schemas/types.yaml#/definitions/uint32
-    const: 1
-    description:
-      QMC consumers that use a phandle to QMC need to pass the channel number
-      with this phandle.
-      For instance "fsl,qmc-chan = <&qmc 16>;".
-
 patternProperties:
   '^channel@([0-9]|[1-5][0-9]|6[0-3])$':
     description:
@@ -121,7 +113,6 @@ required:
   - fsl,tsa-serial
   - '#address-cells'
   - '#size-cells'
-  - '#fsl,chan-cells'
 
 additionalProperties: false
 
@@ -140,7 +131,6 @@ examples:
 
         #address-cells = <1>;
         #size-cells = <0>;
-        #fsl,chan-cells = <1>;
 
         fsl,tsa-serial = <&tsa FSL_CPM_TSA_SCC4>;
 
Signature · 1 line
2.39.2
#3 lore raw

PATCH 2/3 dt-bindings: soc: fsl: cpm_qe: cpm1-tsa: Remove unneeded property

In reply to Herve Codina

Remove the unneeded and unused #fsl,serial-cells property.

---
 .../bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml          | 10 ----------
 1 file changed, 10 deletions(-)
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml +0 -10
index 332e902bcc21..7e51c639a79a 100644
@@ -38,14 +38,6 @@ properties:
   '#size-cells':
     const: 0
 
-  '#fsl,serial-cells':
-    $ref: /schemas/types.yaml#/definitions/uint32
-    const: 1
-    description:
-      TSA consumers that use a phandle to TSA need to pass the serial identifier
-      with this phandle (defined in dt-bindings/soc/fsl,tsa.h).
-      For instance "fsl,tsa-serial = <&tsa FSL_CPM_TSA_SCC4>;".
-
 patternProperties:
   '^tdm@[0-1]$':
     description:
@@ -174,7 +166,6 @@ required:
   - reg-names
   - '#address-cells'
   - '#size-cells'
-  - '#fsl,serial-cells'
 
 additionalProperties: false
 
@@ -190,7 +181,6 @@ examples:
 
         #address-cells = <1>;
         #size-cells = <0>;
-        #fsl,serial-cells = <1>;
 
         tdm@0 {
             /* TDMa */
Signature · 1 line
2.39.2
#4 lore raw

PATCH 3/3 soc: fsl: cpm1: qmc: Fix assigned timeslot masks

In reply to Herve Codina

The assigned timeslot masks are 64bit values.
In case of 64 timeslots the code uses (1 << 64) which is undefined on a 64bit value. On the PowerPC architecture, this lead to an incorrect result as (1 << 64) produces the same result as (1 << 0).

Fix the masks values taking care of the 64 timeslots case.

---
 drivers/soc/fsl/qe/qmc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/soc/fsl/qe/qmc.c +7 -3
index cfa7207353e0..b3c292c9a14e 100644
@@ -754,6 +754,11 @@ static int qmc_check_chans(struct qmc *qmc)
 	if (ret)
 		return ret;
 
+	if ((info.nb_tx_ts > 64) || (info.nb_rx_ts > 64)) {
+		dev_err(qmc->dev, "Number of TSA Tx/Rx TS assigned not supported\n");
+		return -EINVAL;
+	}
+
 	/*
 	 * If more than 32 TS are assigned to this serial, one common table is
 	 * used for Tx and Rx and so masks must be equal for all channels.
@@ -766,9 +771,8 @@ static int qmc_check_chans(struct qmc *qmc)
 		is_one_table = true;
 	}
 
-
-	tx_ts_assigned_mask = (((u64)1) << info.nb_tx_ts) - 1;
-	rx_ts_assigned_mask = (((u64)1) << info.nb_rx_ts) - 1;
+	tx_ts_assigned_mask = info.nb_tx_ts == 64 ? U64_MAX : (((u64)1) << info.nb_tx_ts) - 1;
+	rx_ts_assigned_mask = info.nb_rx_ts == 64 ? U64_MAX : (((u64)1) << info.nb_rx_ts) - 1;
 
 	list_for_each_entry(chan, &qmc->chan_head, list) {
 		if (chan->tx_ts_mask > tx_ts_assigned_mask) {
Signature · 1 line
2.39.2
author maintainer
#5 lore raw

PATCH 2/3 dt-bindings: soc: fsl: cpm_qe: cpm1-tsa: Remove unneeded property

In reply to Herve Codina

Remove the unneeded and unused #fsl,serial-cells property.

---
 .../bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml          | 10 ----------
 1 file changed, 10 deletions(-)
Documentation/devicetree/bindings/soc/fsl/cpm_qe/fsl,cpm1-tsa.yaml +0 -10
index 332e902bcc21..7e51c639a79a 100644
@@ -38,14 +38,6 @@ properties:
   '#size-cells':
     const: 0
 
-  '#fsl,serial-cells':
-    $ref: /schemas/types.yaml#/definitions/uint32
-    const: 1
-    description:
-      TSA consumers that use a phandle to TSA need to pass the serial identifier
-      with this phandle (defined in dt-bindings/soc/fsl,tsa.h).
-      For instance "fsl,tsa-serial = <&tsa FSL_CPM_TSA_SCC4>;".
-
 patternProperties:
   '^tdm@[0-1]$':
     description:
@@ -174,7 +166,6 @@ required:
   - reg-names
   - '#address-cells'
   - '#size-cells'
-  - '#fsl,serial-cells'
 
 additionalProperties: false
 
@@ -190,7 +181,6 @@ examples:
 
         #address-cells = <1>;
         #size-cells = <0>;
-        #fsl,serial-cells = <1>;
 
         tdm@0 {
             /* TDMa */
Signature · 1 line
2.39.2
author maintainer
#6 lore raw

PATCH 3/3 soc: fsl: cpm1: qmc: Fix assigned timeslot masks

In reply to Herve Codina

The assigned timeslot masks are 64bit values.
In case of 64 timeslots the code uses (1 << 64) which is undefined on a 64bit value. On the PowerPC architecture, this lead to an incorrect result as (1 << 64) produces the same result as (1 << 0).

Fix the masks values taking care of the 64 timeslots case.

---
 drivers/soc/fsl/qe/qmc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/soc/fsl/qe/qmc.c +7 -3
index cfa7207353e0..b3c292c9a14e 100644
@@ -754,6 +754,11 @@ static int qmc_check_chans(struct qmc *qmc)
 	if (ret)
 		return ret;
 
+	if ((info.nb_tx_ts > 64) || (info.nb_rx_ts > 64)) {
+		dev_err(qmc->dev, "Number of TSA Tx/Rx TS assigned not supported\n");
+		return -EINVAL;
+	}
+
 	/*
 	 * If more than 32 TS are assigned to this serial, one common table is
 	 * used for Tx and Rx and so masks must be equal for all channels.
@@ -766,9 +771,8 @@ static int qmc_check_chans(struct qmc *qmc)
 		is_one_table = true;
 	}
 
-
-	tx_ts_assigned_mask = (((u64)1) << info.nb_tx_ts) - 1;
-	rx_ts_assigned_mask = (((u64)1) << info.nb_rx_ts) - 1;
+	tx_ts_assigned_mask = info.nb_tx_ts == 64 ? U64_MAX : (((u64)1) << info.nb_tx_ts) - 1;
+	rx_ts_assigned_mask = info.nb_rx_ts == 64 ? U64_MAX : (((u64)1) << info.nb_rx_ts) - 1;
 
 	list_for_each_entry(chan, &qmc->chan_head, list) {
 		if (chan->tx_ts_mask > tx_ts_assigned_mask) {
Signature · 1 line
2.39.2
#7 lore raw
In reply to Herve Codina
Quoted 10 lines · Herve Codina

A previous series added the PowerQUICC audio support using the QMC. The v6 version of this previous series was applied but some feedbacks lead to a v7 version.

The v6 can be found here:
https://lore.kernel.org/linux-kernel/[email protected]/
and the v7, here:
https://lore.kernel.org/linux-kernel/[email protected]/

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/3] dt-bindings: soc: fsl: cpm_qe: cpm1-scc-qmc: Remove unneeded property

      commit: 33a33005b2db0966c00d4f58dd2a36e5a44217db
[2/3] dt-bindings: soc: fsl: cpm_qe: cpm1-tsa: Remove unneeded property
      commit: 0fb6f518cb46cf8bac7c30c29171050e355cd738
[3/3] soc: fsl: cpm1: qmc: Fix assigned timeslot masks
      commit: f37acbde076d8dbf5e4c694f29760e608fdffe11

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark