[1/2] ASoC: codecs: Add PCM186x binding documentation

Message ID 20171110195711.24210-1-afd@ti.com
State Not Applicable
Headers show
Series
  • [1/2] ASoC: codecs: Add PCM186x binding documentation
Related show

Commit Message

Andrew F. Davis Nov. 10, 2017, 7:57 p.m.
Add the dt-binding documentation for the TI PCM186x 2ch and 4ch Audio
ADCs With Universal Front End.

Signed-off-by: Andrew F. Davis <afd@ti.com>
---
 .../devicetree/bindings/sound/pcm186x.txt          | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/pcm186x.txt

Comments

Mark Brown Nov. 10, 2017, 9:21 p.m. | #1
On Fri, Nov 10, 2017 at 01:57:11PM -0600, Andrew F. Davis wrote:

This looks mostly good, a few small issues though:

> +	dev_info(&i2c->dev, "%s() i2c->addr=%d\n", __func__, i2c->addr);

No need for this as standard, we already have I2C level logging
facilities if they're really needed.  It's OK to do things like log chip
revisions read back from hardware but this is pure software.

> +static const struct snd_kcontrol_new pcm1863_snd_controls[] = {
> +	SOC_DOUBLE_R_S_TLV("Analog Gain", PCM186X_PGA_VAL_CH1_L,

Volume controls should end in Volume to tell userspace how to handle
them, see ControlNames.txt.

> +	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(priv->supplies),
> +				      priv->supplies);
> +	if (ret != 0) {
> +		dev_err(dev, "failed to request supplies: %d\n", ret);
> +		return ret;
> +	}
> +
> +	/* Reset device registers for a consistent power-on like state */
> +	ret = regmap_write(regmap, PCM186X_PAGE, PCM186X_RESET);
> +	if (ret != 0) {
> +		dev_err(dev, "failed to write device: %d\n", ret);
> +		return ret;
> +	}

We didn't enable the supplies for the device before we reset it, if the
device was powered off then the write will hopefully not work and we'll
get a spurious error here.  The driver should bounce the supplies on at
least long enough to do the reset, it's not ideal but it's robust.
Rob Herring Nov. 15, 2017, 7:56 p.m. | #2
On Fri, Nov 10, 2017 at 01:57:10PM -0600, Andrew F. Davis wrote:
> Add the dt-binding documentation for the TI PCM186x 2ch and 4ch Audio
> ADCs With Universal Front End.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> ---
>  .../devicetree/bindings/sound/pcm186x.txt          | 42 ++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/sound/pcm186x.txt
> 
> diff --git a/Documentation/devicetree/bindings/sound/pcm186x.txt b/Documentation/devicetree/bindings/sound/pcm186x.txt
> new file mode 100644
> index 000000000000..0bc7d265c7bd
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/pcm186x.txt
> @@ -0,0 +1,42 @@
> +Texas Instruments PCM186x Universal Audio ADC
> +
> +These devices support both I2C and SPI (configured with pin strapping
> +on the board).
> +
> +Required properties:
> +
> + - compatible : "ti,pcm1862",
> +                "ti,pcm1863",
> +                "ti,pcm1864",
> +                "ti,pcm1865"
> +
> + - reg : The I2C address of the device for I2C, the chip select
> +         number for SPI.
> +
> + - avdd-supply: Analog core power supply (3.3v)
> + - dvdd-supply: Digital core power supply
> + - iovdd-supply: Digital IO power supply
> +        See regulator/regulator.txt for more information
> +
> +CODEC input pins:
> + * VINL1
> + * VINR1
> + * VINL2
> + * VINR2
> + * VINL3
> + * VINR3
> + * VINL4
> + * VINR4
> +
> +The pins can be used in referring sound node's audio-routing property.
> +
> +Example:
> +
> +	pcm186x: pcm186x@4a {

audio-codec@4a

With that,

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

> +		compatible = "ti,pcm1865";
> +		reg = <0x4a>;
> +
> +		avdd-supply = <&reg_3v3_analog>;
> +		dvdd-supply = <&reg_3v3>;
> +		iovdd-supply = <&reg_1v8>;
> +	};
> -- 
> 2.15.0
> 
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/Documentation/devicetree/bindings/sound/pcm186x.txt b/Documentation/devicetree/bindings/sound/pcm186x.txt
new file mode 100644
index 000000000000..0bc7d265c7bd
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/pcm186x.txt
@@ -0,0 +1,42 @@ 
+Texas Instruments PCM186x Universal Audio ADC
+
+These devices support both I2C and SPI (configured with pin strapping
+on the board).
+
+Required properties:
+
+ - compatible : "ti,pcm1862",
+                "ti,pcm1863",
+                "ti,pcm1864",
+                "ti,pcm1865"
+
+ - reg : The I2C address of the device for I2C, the chip select
+         number for SPI.
+
+ - avdd-supply: Analog core power supply (3.3v)
+ - dvdd-supply: Digital core power supply
+ - iovdd-supply: Digital IO power supply
+        See regulator/regulator.txt for more information
+
+CODEC input pins:
+ * VINL1
+ * VINR1
+ * VINL2
+ * VINR2
+ * VINL3
+ * VINR3
+ * VINL4
+ * VINR4
+
+The pins can be used in referring sound node's audio-routing property.
+
+Example:
+
+	pcm186x: pcm186x@4a {
+		compatible = "ti,pcm1865";
+		reg = <0x4a>;
+
+		avdd-supply = <&reg_3v3_analog>;
+		dvdd-supply = <&reg_3v3>;
+		iovdd-supply = <&reg_1v8>;
+	};