Hi Greg,
Here are some slimbus enhacements patches for 6.2
- converting Dt bindings to schema.
- add support to 44.1 Khz.
- handle unsupported presence rate
- few cleanups around unused compatibles and using correct apis.
Can you please queue them up for 6.2.
thanks for you help,
srini
Krzysztof Kozlowski (12):
slimbus: qcom-ngd-ctrl: check for device runtime PM status during ISR
slimbus: qcom-ngd-ctrl: drop PM runtime counter on transfer error
paths
slimbus: stream: handle unsupported bitrates for presence rate
slimbus: qcom-ngd-ctrl: add support for 44.1 Khz frequency
slimbus: stream: add checks for invalid unprepare/disable usage
slimbus: qcom-ctrl: drop unneeded qcom,apq8064-slim compatible
slimbus: qcom-ctrl: use devm_platform_ioremap_resource_byname()
slimbus: qcom-ngd-ctrl: use devm_platform_get_and_ioremap_resource()
slimbus: qcom-ngd-ctrl: reinit the reconf completion flag
dt-bindings: slimbus: convert bus description to DT schema
dt-bindings: slimbus: qcom,slim: convert to DT schema
dt-bindings: slimbus: qcom,slim-ngd: convert to DT schema
.../devicetree/bindings/slimbus/bus.txt | 60 ---------
.../bindings/slimbus/qcom,slim-ngd.yaml | 120 ++++++++++++++++++
.../bindings/slimbus/qcom,slim.yaml | 86 +++++++++++++
.../bindings/slimbus/slim-ngd-qcom-ctrl.txt | 84 ------------
.../bindings/slimbus/slim-qcom-ctrl.txt | 39 ------
.../devicetree/bindings/slimbus/slimbus.yaml | 95 ++++++++++++++
drivers/slimbus/qcom-ctrl.c | 5 +-
drivers/slimbus/qcom-ngd-ctrl.c | 97 ++++++++++++--
drivers/slimbus/stream.c | 17 ++-
9 files changed, 402 insertions(+), 201 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/slimbus/bus.txt
create mode 100644 Documentation/devicetree/bindings/slimbus/qcom,slim-ngd.yaml
create mode 100644 Documentation/devicetree/bindings/slimbus/qcom,slim.yaml
delete mode 100644 Documentation/devicetree/bindings/slimbus/slim-ngd-qcom-ctrl.txt
delete mode 100644 Documentation/devicetree/bindings/slimbus/slim-qcom-ctrl.txt
create mode 100644 Documentation/devicetree/bindings/slimbus/slimbus.yaml
--
2.25.1
From: Krzysztof Kozlowski <[email protected]>
Convert the Qualcomm SoC SLIMBus Non Generic Device (NGD) controller
bindings to DT Schema.
During conversion add iommus already present in DTS and extend the
example based on SDM845.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
.../bindings/slimbus/qcom,slim-ngd.yaml | 120 ++++++++++++++++++
.../bindings/slimbus/slim-ngd-qcom-ctrl.txt | 82 ------------
2 files changed, 120 insertions(+), 82 deletions(-)
create mode 100644 Documentation/devicetree/bindings/slimbus/qcom,slim-ngd.yaml
delete mode 100644 Documentation/devicetree/bindings/slimbus/slim-ngd-qcom-ctrl.txt
diff --git a/Documentation/devicetree/bindings/slimbus/qcom,slim-ngd.yaml b/Documentation/devicetree/bindings/slimbus/qcom,slim-ngd.yaml
new file mode 100644
index 000000000000..abf61c15246e
--- /dev/null
+++ b/Documentation/devicetree/bindings/slimbus/qcom,slim-ngd.yaml
@@ -0,0 +1,120 @@
+# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/slimbus/qcom,slim-ngd.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm SoC SLIMBus Non Generic Device (NGD) Controller
+
+maintainers:
+ - Krzysztof Kozlowski <[email protected]>
+ - Srinivas Kandagatla <[email protected]>
+
+description:
+ SLIMBus NGD controller is a light-weight driver responsible for communicating
+ with SLIMBus slaves directly over the bus using messaging interface and
+ communicating with master component residing on ADSP for bandwidth and
+ data-channel management
+
+properties:
+ compatible:
+ enum:
+ - qcom,slim-ngd-v1.5.0 # for MSM8996
+ - qcom,slim-ngd-v2.1.0 # for SDM845
+
+ reg:
+ maxItems: 1
+
+ "#address-cells":
+ const: 1
+
+ "#size-cells":
+ const: 0
+
+ dmas:
+ maxItems: 2
+
+ dma-names:
+ items:
+ - const: rx
+ - const: tx
+
+ interrupts:
+ maxItems: 1
+
+ iommus:
+ maxItems: 1
+
+patternProperties:
+ "^slim@[0-9a-f]+$":
+ type: object
+ $ref: slimbus.yaml#
+ description:
+ Each subnode represents an instance of NGD
+
+ properties:
+ reg:
+ maxItems: 1
+
+ unevaluatedProperties: false
+
+required:
+ - compatible
+ - reg
+ - "#address-cells"
+ - "#size-cells"
+ - dmas
+ - dma-names
+ - interrupts
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+ slim-ngd@171c0000 {
+ compatible = "qcom,slim-ngd-v2.1.0";
+ reg = <0x171c0000 0x2c000>;
+ interrupts = <GIC_SPI 163 IRQ_TYPE_LEVEL_HIGH>;
+
+ dmas = <&slimbam 3>, <&slimbam 4>;
+ dma-names = "rx", "tx";
+ iommus = <&apps_smmu 0x1806 0x0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ slim@1 {
+ reg = <1>;
+ #address-cells = <2>;
+ #size-cells = <0>;
+
+ codec@1,0 {
+ compatible = "slim217,250";
+ reg = <1 0>;
+ slim-ifc-dev = <&wcd9340_ifd>;
+
+ #sound-dai-cells = <1>;
+
+ interrupts-extended = <&tlmm 54 IRQ_TYPE_LEVEL_HIGH>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+
+ #clock-cells = <0>;
+ clock-frequency = <9600000>;
+ clock-output-names = "mclk";
+ qcom,micbias1-microvolt = <1800000>;
+ qcom,micbias2-microvolt = <1800000>;
+ qcom,micbias3-microvolt = <1800000>;
+ qcom,micbias4-microvolt = <1800000>;
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ reset-gpios = <&tlmm 64 GPIO_ACTIVE_HIGH>;
+
+ /* Rest of the WCD9340 codec */
+ };
+ };
+ };
diff --git a/Documentation/devicetree/bindings/slimbus/slim-ngd-qcom-ctrl.txt b/Documentation/devicetree/bindings/slimbus/slim-ngd-qcom-ctrl.txt
deleted file mode 100644
index 7c3d9eb6af5d..000000000000
--- a/Documentation/devicetree/bindings/slimbus/slim-ngd-qcom-ctrl.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-Qualcomm SLIMBus Non Generic Device (NGD) Controller binding
-
-SLIMBus NGD controller is a light-weight driver responsible for communicating
-with SLIMBus slaves directly over the bus using messaging interface and
-communicating with master component residing on ADSP for bandwidth and
-data-channel management
-
-- compatible:
- Usage: required
- Value type: <stringlist>
- Definition: must be "qcom,slim-ngd-v<MAJOR>.<MINOR>.<STEP>"
- must be one of the following.
- "qcom,slim-ngd-v1.5.0" for MSM8996
- "qcom,slim-ngd-v2.1.0" for SDM845
-
-- reg:
- Usage: required
- Value type: <prop-encoded-array>
- Definition: must specify the base address and size of the controller
- register space.
-- dmas
- Usage: required
- Value type: <array of phandles>
- Definition: List of rx and tx dma channels
-
-- dma-names
- Usage: required
- Value type: <stringlist>
- Definition: must be "rx" and "tx".
-
-- interrupts:
- Usage: required
- Value type: <prop-encoded-array>
- Definition: must list controller IRQ.
-
-#address-cells
- Usage: required
- Value type: <u32>
- Definition: Should be 1, reflecting the instance id of ngd.
-
-#size-cells
- Usage: required
- Value type: <u32>
- Definition: Should be 0
-
-= NGD Devices
-Each subnode represents an instance of NGD, must contain the following
-properties:
-
-- reg:
- Usage: required
- Value type: <u32>
- Definition: Should be instance id of ngd.
-
-#address-cells
- Usage: required
- Refer to slimbus/bus.txt for details of the common SLIMBus bindings.
-
-#size-cells
- Usage: required
- Refer to slimbus/bus.txt for details of the common SLIMBus bindings.
-
-= EXAMPLE
-
-slim@91c0000 {
- compatible = "qcom,slim-ngd-v1.5.0";
- reg = <0x91c0000 0x2c000>;
- interrupts = <0 163 0>;
- dmas = <&slimbam 3>, <&slimbam 4>;
- dma-names = "rx", "tx";
- #address-cells = <1>;
- #size-cells = <0>;
- ngd@1 {
- reg = <1>;
- #address-cells = <1>;
- #size-cells = <1>;
- codec@1 {
- compatible = "slim217,1a0";
- reg = <1 0>;
- };
- };
-};
--
2.25.1
From: Krzysztof Kozlowski <[email protected]>
If transfer in qcom_slim_ngd_xfer_msg_sync() fails, we need to drop the
PM runtime usage counter to have it balanced.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
drivers/slimbus/qcom-ngd-ctrl.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
index 964adf77b51b..d48e58ca5d58 100644
--- a/drivers/slimbus/qcom-ngd-ctrl.c
+++ b/drivers/slimbus/qcom-ngd-ctrl.c
@@ -919,21 +919,29 @@ static int qcom_slim_ngd_xfer_msg_sync(struct slim_controller *ctrl,
DECLARE_COMPLETION_ONSTACK(done);
int ret, timeout;
- pm_runtime_get_sync(ctrl->dev);
+ ret = pm_runtime_get_sync(ctrl->dev);
+ if (ret < 0)
+ goto pm_put;
txn->comp = &done;
ret = qcom_slim_ngd_xfer_msg(ctrl, txn);
if (ret)
- return ret;
+ goto pm_put;
timeout = wait_for_completion_timeout(&done, HZ);
if (!timeout) {
dev_err(ctrl->dev, "TX timed out:MC:0x%x,mt:0x%x", txn->mc,
txn->mt);
- return -ETIMEDOUT;
+ ret = -ETIMEDOUT;
+ goto pm_put;
}
return 0;
+
+pm_put:
+ pm_runtime_put(ctrl->dev);
+
+ return ret;
}
static int qcom_slim_ngd_enable_stream(struct slim_stream_runtime *rt)
--
2.25.1
From: Krzysztof Kozlowski <[email protected]>
Handle errors of getting presence rate for unsupported stream bitrate,
instead of sending -EINVAL in change content message.
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Reviewed-by: Konrad Dybcio <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
drivers/slimbus/stream.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/slimbus/stream.c b/drivers/slimbus/stream.c
index 73a2aa362957..7e9c818e66c1 100644
--- a/drivers/slimbus/stream.c
+++ b/drivers/slimbus/stream.c
@@ -204,7 +204,7 @@ int slim_stream_prepare(struct slim_stream_runtime *rt,
{
struct slim_controller *ctrl = rt->dev->ctrl;
struct slim_port *port;
- int num_ports, i, port_id;
+ int num_ports, i, port_id, prrate;
if (rt->ports) {
dev_err(&rt->dev->dev, "Stream already Prepared\n");
@@ -221,6 +221,13 @@ int slim_stream_prepare(struct slim_stream_runtime *rt,
rt->bps = cfg->bps;
rt->direction = cfg->direction;
+ prrate = slim_get_prate_code(cfg->rate);
+ if (prrate < 0) {
+ dev_err(&rt->dev->dev, "Cannot get presence rate for rate %d Hz\n",
+ cfg->rate);
+ return prrate;
+ }
+
if (cfg->rate % ctrl->a_framer->superfreq) {
/*
* data rate not exactly multiple of super frame,
@@ -241,7 +248,7 @@ int slim_stream_prepare(struct slim_stream_runtime *rt,
port = &rt->ports[i];
port->state = SLIM_PORT_DISCONNECTED;
port->id = port_id;
- port->ch.prrate = slim_get_prate_code(cfg->rate);
+ port->ch.prrate = prrate;
port->ch.id = cfg->chs[i];
port->ch.data_fmt = SLIM_CH_DATA_FMT_NOT_DEFINED;
port->ch.aux_fmt = SLIM_CH_AUX_FMT_NOT_APPLICABLE;
--
2.25.1
From: Krzysztof Kozlowski <[email protected]>
Simplify the code with devm_platform_get_and_ioremap_resource().
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
drivers/slimbus/qcom-ngd-ctrl.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
index 22720ad4c22d..a6f3b6860d8f 100644
--- a/drivers/slimbus/qcom-ngd-ctrl.c
+++ b/drivers/slimbus/qcom-ngd-ctrl.c
@@ -1597,7 +1597,6 @@ static int qcom_slim_ngd_ctrl_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct qcom_slim_ngd_ctrl *ctrl;
- struct resource *res;
int ret;
struct pdr_service *pds;
@@ -1607,8 +1606,7 @@ static int qcom_slim_ngd_ctrl_probe(struct platform_device *pdev)
dev_set_drvdata(dev, ctrl);
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- ctrl->base = devm_ioremap_resource(dev, res);
+ ctrl->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
if (IS_ERR(ctrl->base))
return PTR_ERR(ctrl->base);
--
2.25.1
From: Krzysztof Kozlowski <[email protected]>
Slimbus core interrupt is getting fired after suspend. At this point
ADSP slimbus hardware is off with gated clocks which is leading to an
unclocked access when HLOS slimbus tried to read the interrupt
status register in the ISR.
Co-developed-by: Chandana Kishori Chiluveru <[email protected]>
Signed-off-by: Chandana Kishori Chiluveru <[email protected]>
Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Srinivas Kandagatla <[email protected]>
---
drivers/slimbus/qcom-ngd-ctrl.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/slimbus/qcom-ngd-ctrl.c b/drivers/slimbus/qcom-ngd-ctrl.c
index 76c5e446d243..964adf77b51b 100644
--- a/drivers/slimbus/qcom-ngd-ctrl.c
+++ b/drivers/slimbus/qcom-ngd-ctrl.c
@@ -763,7 +763,14 @@ static irqreturn_t qcom_slim_ngd_interrupt(int irq, void *d)
{
struct qcom_slim_ngd_ctrl *ctrl = d;
void __iomem *base = ctrl->ngd->base;
- u32 stat = readl(base + NGD_INT_STAT);
+ u32 stat;
+
+ if (pm_runtime_suspended(ctrl->ctrl.dev)) {
+ dev_warn_once(ctrl->dev, "Interrupt received while suspended\n");
+ return IRQ_NONE;
+ }
+
+ stat = readl(base + NGD_INT_STAT);
if ((stat & NGD_INT_MSG_BUF_CONTE) ||
(stat & NGD_INT_MSG_TX_INVAL) || (stat & NGD_INT_DEV_ERR) ||
--
2.25.1