mbox series

[v4,00/12] ASoC: Add support to WCD9340/WCD9341 codec

Message ID 20191121170509.10579-1-srinivas.kandagatla@linaro.org
Headers show
Series ASoC: Add support to WCD9340/WCD9341 codec | expand

Message

Srinivas Kandagatla Nov. 21, 2019, 5:04 p.m. UTC
This patchset adds support to Qualcomm WCD9340/WCD9341 Codec which
is a standalone Hi-Fi audio codec IC.
This codec supports both I2S/I2C and SLIMbus audio interfaces.
On slimbus interface it supports two data lanes; 16 Tx ports
and 8 Rx ports. It has Five DACs and seven dedicated interpolators,
Multibutton headset control (MBHC), Active noise cancellation,
Sidetone paths, MAD (mic activity detection) and codec processing engine.
It supports Class-H differential earpiece out and stereo single
ended headphones out.

This codec also has integrated SoundWire controller.
Patchset for this is already sent for review at
https://patchwork.kernel.org/cover/11185769/
    
This patchset has been tested on SDM845 based DragonBoard DB845c and
Lenovo Yoga C630 laptop with WSA881x smart speaker amplifiers via
soundwire and 4 DMICs.

gpio controller patch does not have any link dependency, it can go by its own.

Most of the code in this driver is rework of Qualcomm downstream drivers
used in Andriod. Credits to Banajit Goswami and Patrick Lai's Team.

Thanks,
srini


Changes since v3:
 - Added new SLIMBus common bindings suggested by Rob.
 - renamed microvolts to microvolt in bindings as suggested by Rob
 - dumped pinctrl driver and added new simple gpio driver
 - few cosmetic cleanups in mfd driver.

Srinivas Kandagatla (12):
  dt-bindings: SLIMBus: add slim devices optional properties
  ASoC: dt-bindings: add dt bindings for WCD9340/WCD9341 audio codec
  mfd: wcd934x: add support to wcd9340/wcd9341 codec
  ASoC: wcd934x: add support to wcd9340/wcd9341 codec
  ASoC: wcd934x: add basic controls
  ASoC: wcd934x: add playback dapm widgets
  ASoC: wcd934x: add capture dapm widgets
  ASoC: wcd934x: add audio routings
  dt-bindings: gpio: wcd934x: Add bindings for gpio
  gpio: wcd934x: Add support to wcd934x gpio controller
  ASoC: qcom: dt-bindings: Add compatible for DB845c and Lenovo Yoga
  ASoC: qcom: sdm845: add support to DB845c and Lenovo Yoga

 .../bindings/gpio/qcom,wcd934x-gpio.yaml      |   47 +
 .../devicetree/bindings/slimbus/bus.txt       |   10 +
 .../devicetree/bindings/sound/qcom,sdm845.txt |    5 +-
 .../bindings/sound/qcom,wcd934x.yaml          |  163 +
 drivers/gpio/Kconfig                          |    8 +
 drivers/gpio/Makefile                         |    1 +
 drivers/gpio/gpio-wcd934x.c                   |  104 +
 drivers/mfd/Kconfig                           |   12 +
 drivers/mfd/Makefile                          |    1 +
 drivers/mfd/wcd934x.c                         |  306 +
 include/linux/mfd/wcd934x/registers.h         |  531 ++
 include/linux/mfd/wcd934x/wcd934x.h           |   31 +
 sound/soc/codecs/Kconfig                      |   10 +
 sound/soc/codecs/Makefile                     |    2 +
 sound/soc/codecs/wcd934x.c                    | 5084 +++++++++++++++++
 sound/soc/qcom/sdm845.c                       |   86 +-
 16 files changed, 6399 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/qcom,wcd934x-gpio.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/qcom,wcd934x.yaml
 create mode 100644 drivers/gpio/gpio-wcd934x.c
 create mode 100644 drivers/mfd/wcd934x.c
 create mode 100644 include/linux/mfd/wcd934x/registers.h
 create mode 100644 include/linux/mfd/wcd934x/wcd934x.h
 create mode 100644 sound/soc/codecs/wcd934x.c

-- 
2.21.0

Comments

Rob Herring (Arm) Nov. 23, 2019, 12:09 a.m. UTC | #1
On Thu, Nov 21, 2019 at 05:04:59PM +0000, Srinivas Kandagatla wrote:
> This patch adds bindings for wcd9340/wcd9341 audio codec which can

> support both SLIMbus and I2S/I2C interface.

> 

> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

> ---

>  .../bindings/sound/qcom,wcd934x.yaml          | 163 ++++++++++++++++++

>  1 file changed, 163 insertions(+)

>  create mode 100644 Documentation/devicetree/bindings/sound/qcom,wcd934x.yaml

> 

> diff --git a/Documentation/devicetree/bindings/sound/qcom,wcd934x.yaml b/Documentation/devicetree/bindings/sound/qcom,wcd934x.yaml

> new file mode 100644

> index 000000000000..197a53bfa6cb

> --- /dev/null

> +++ b/Documentation/devicetree/bindings/sound/qcom,wcd934x.yaml

> @@ -0,0 +1,163 @@

> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)

> +%YAML 1.2

> +---

> +$id: http://devicetree.org/schemas/sound/qcom,wcd934x.yaml#

> +$schema: http://devicetree.org/meta-schemas/core.yaml#

> +

> +title: Bindings for Qualcomm WCD9340/WCD9341 Audio Codec

> +

> +maintainers:

> +  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

> +

> +description: |

> +  Qualcomm WCD9340/WCD9341 Codec is a standalone Hi-Fi audio codec IC.

> +  It has in-built Soundwire controller, pin controller, interrupt mux and

> +  supports both I2S/I2C and SLIMbus audio interfaces.

> +

> +properties:

> +  compatible:

> +    const: slim217,250

> +

> +  reg:

> +    maxItems: 1

> +

> +  interrupts:

> +    maxItems: 1

> +

> +  reset-gpios:

> +    description: GPIO spec for reset line to use

> +    maxItems: 1

> +

> +  slim-ifc-dev: true

> +

> +  clocks:

> +    maxItems: 1

> +

> +  clock-names:

> +    const: extclk

> +

> +  vdd-buck-supply:

> +    description: A reference to the 1.8V buck supply

> +

> +  vdd-buck-sido-supply:

> +    description: A reference to the 1.8V SIDO buck supply

> +

> +  vdd-rx-supply:

> +    description: A reference to the 1.8V rx supply

> +

> +  vdd-tx-supply:

> +    description: A reference to the 1.8V tx supply

> +

> +  vdd-vbat-supply:

> +    description: A reference to the vbat supply

> +

> +  vdd-io-supply:

> +    description: A reference to the 1.8V I/O supply

> +

> +  vdd-micbias-supply:

> +    description: A reference to the micbias supply

> +

> +  qcom,micbias1-microvolt:

> +    $ref: '/schemas/types.yaml#/definitions/uint32'


Don't need a type here, standard units already have a type.

> +    description: micbias1 voltage between 1800000 - 2850000 microvolt


Sounds like constraints:

minimum: 1800000
maximum: 2850000


> +

> +  qcom,micbias2-microvolt:

> +    $ref: '/schemas/types.yaml#/definitions/uint32'

> +    description: micbias2 voltage between 1800000 - 2850000 microvolt

> +

> +  qcom,micbias3-microvolt:

> +    $ref: '/schemas/types.yaml#/definitions/uint32'

> +    description: micbias3 voltage between 1800000 - 2850000 microvolt

> +

> +  qcom,micbias4-microvolt:

> +    $ref: '/schemas/types.yaml#/definitions/uint32'

> +    description: micbias4 voltage between 1800000 - 2850000 microvolt

> +

> +  clock-output-names:

> +    const: mclk

> +

> +  clock-frequency:

> +    description: Clock frequency of output clk in Hz

> +

> +  interrupt-controller: true

> +

> +  '#interrupt-cells':

> +    const: 1

> +

> +  '#clock-cells':

> +    const: 0

> +

> +  '#sound-dai-cells':

> +    const: 1

> +

> +  "#address-cells":

> +    const: 1

> +

> +  "#size-cells":

> +    const: 1

> +

> +patternProperties:

> +  "^.*@[0-9a-f]+$":

> +    type: object

> +    description: |

> +      WCD934x subnode for each slave devices. Bindings of each subnodes

> +      depends on the specific driver providing the functionality and

> +      documented in their respective bindings.

> +

> +    properties:

> +      reg:

> +        maxItems: 1

> +

> +    required:

> +      - reg

> +

> +required:

> +  - compatible

> +  - reg

> +  - reset-gpios

> +  - slim-ifc-dev

> +  - interrupts

> +  - interrupt-controller

> +  - clock-frequency

> +  - clock-output-names

> +  - qcom,micbias1-microvolt

> +  - qcom,micbias2-microvolt

> +  - qcom,micbias3-microvolt

> +  - qcom,micbias4-microvolt

> +  - "#interrupt-cells"

> +  - "#clock-cells"

> +  - "#sound-dai-cells"

> +  - "#address-cells"

> +  - "#size-cells"

> +

> +examples:

> +  - |

> +    codec@1,0{

> +        compatible = "slim217,250";

> +        reg  = <1 0>;

> +        reset-gpios = <&tlmm 64 0>;

> +        slim-ifc-dev  = <&wcd9340_ifd>;

> +        #sound-dai-cells = <1>;

> +        interrupt-parent = <&tlmm>;

> +        interrupts = <54 4>;

> +        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>;

> +        clock-names = "extclk";

> +        clocks = <&rpmhcc 2>;

> +

> +        #address-cells = <1>;

> +        #size-cells = <1>;

> +

> +        gpioctrl@42 {

> +            reg = <0x42 0x2>;

> +        };

> +    };

> +

> +...

> -- 

> 2.21.0

>
Rob Herring (Arm) Nov. 23, 2019, 12:15 a.m. UTC | #2
On Thu, Nov 21, 2019 at 05:05:06PM +0000, Srinivas Kandagatla wrote:
> Qualcomm Technologies Inc WCD9340/WCD9341 Audio Codec has integrated

> gpio controller to control 5 gpios on the chip. This patch adds

> required device tree bindings for it.

> 

> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

> ---

>  .../bindings/gpio/qcom,wcd934x-gpio.yaml      | 47 +++++++++++++++++++

>  1 file changed, 47 insertions(+)

>  create mode 100644 Documentation/devicetree/bindings/gpio/qcom,wcd934x-gpio.yaml


Reviewed-by: Rob Herring <robh@kernel.org>


However, this should be referenced from the main file:

gpio@42:
  type: object
  allOf:
    - $ref: ../gpio/qcom,wcd934x-gpio.yaml#

And better to move the example there to be complete.

Rob
Mark Brown May 8, 2020, 5:13 p.m. UTC | #3
On Thu, 21 Nov 2019 17:04:57 +0000, Srinivas Kandagatla wrote:
> This patchset adds support to Qualcomm WCD9340/WCD9341 Codec which
> is a standalone Hi-Fi audio codec IC.
> This codec supports both I2S/I2C and SLIMbus audio interfaces.
> On slimbus interface it supports two data lanes; 16 Tx ports
> and 8 Rx ports. It has Five DACs and seven dedicated interpolators,
> Multibutton headset control (MBHC), Active noise cancellation,
> Sidetone paths, MAD (mic activity detection) and codec processing engine.
> It supports Class-H differential earpiece out and stereo single
> ended headphones out.
> 
> [...]

Applied to

   local tree regulator/for-5.7

Thanks!

[01/12] dt-bindings: SLIMBus: add slim devices optional properties
        (no commit info)
[02/12] ASoC: dt-bindings: add dt bindings for WCD9340/WCD9341 audio codec
        (no commit info)
[03/12] mfd: wcd934x: add support to wcd9340/wcd9341 codec
        (no commit info)
[04/12] ASoC: wcd934x: add support to wcd9340/wcd9341 codec
        (no commit info)
[05/12] ASoC: wcd934x: add basic controls
        (no commit info)
[06/12] ASoC: wcd934x: add playback dapm widgets
        (no commit info)
[07/12] ASoC: wcd934x: add capture dapm widgets
        (no commit info)
[08/12] ASoC: wcd934x: add audio routings
        (no commit info)
[09/12] dt-bindings: gpio: wcd934x: Add bindings for gpio
        (no commit info)
[10/12] gpio: wcd934x: Add support to wcd934x gpio controller
        (no commit info)
[11/12] ASoC: qcom: dt-bindings: Add compatible for DB845c and Lenovo Yoga
        (no commit info)
[12/12] ASoC: qcom: sdm845: add support to DB845c and Lenovo Yoga
        (no commit info)

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