]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ASoC: ak4613: add single-end optional property for IN/OUT pins
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 16 Nov 2015 04:51:21 +0000 (04:51 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 16 Nov 2015 13:18:28 +0000 (13:18 +0000)
ak4613 IN/OUT pin can be selected as differential/single-end.
Default is differential, because it is register default settings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Documentation/devicetree/bindings/sound/ak4613.txt
sound/soc/codecs/ak4613.c

index 15a919522b4286e5bf8171cf86ace340f9e27faf..3cf63e7f8e7765c3778fdd0d657cbe65a270d38a 100644 (file)
@@ -7,6 +7,16 @@ Required properties:
 - compatible : "asahi-kasei,ak4613"
 - reg : The chip select number on the I2C bus
 
+Optional properties:
+- ak4613,in1-single-end        : Boolean. Indicate input / output pins are single-ended.
+- ak4613,in2-single-end          rather than differential.
+- ak4613,out1-single-end
+- ak4613,out2-single-end
+- ak4613,out3-single-end
+- ak4613,out4-single-end
+- ak4613,out5-single-end
+- ak4613,out6-single-end
+
 Example:
 
 &i2c {
index 07a266460ec39cb3941dde8d4fe96eeb1bb8d414..394c10ff049ef1e0fe9c09e6b0cb1a6403cb5e24 100644 (file)
@@ -79,6 +79,8 @@ struct ak4613_priv {
 
        unsigned int fmt;
        u8 fmt_ctrl;
+       u8 oc;
+       u8 ic;
        int cnt;
 };
 
@@ -343,6 +345,9 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream *substream,
        snd_soc_update_bits(codec, CTRL1, FMT_MASK, fmt_ctrl);
        snd_soc_write(codec, CTRL2, ctrl2);
 
+       snd_soc_write(codec, ICTRL, priv->ic);
+       snd_soc_write(codec, OCTRL, priv->oc);
+
 hw_params_end:
        if (ret < 0)
                dev_warn(dev, "unsupported data width/format combination\n");
@@ -431,6 +436,28 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4613 = {
        .num_dapm_routes        = ARRAY_SIZE(ak4613_intercon),
 };
 
+static void ak4613_parse_of(struct ak4613_priv *priv,
+                           struct device *dev)
+{
+       struct device_node *np = dev->of_node;
+       char prop[32];
+       int i;
+
+       /* Input 1 - 2 */
+       for (i = 0; i < 2; i++) {
+               snprintf(prop, sizeof(prop), "ak4613,in%d-single-end", i + 1);
+               if (!of_get_property(np, prop, NULL))
+                       priv->ic |= 1 << i;
+       }
+
+       /* Output 1 - 6 */
+       for (i = 0; i < 6; i++) {
+               snprintf(prop, sizeof(prop), "ak4613,out%d-single-end", i + 1);
+               if (!of_get_property(np, prop, NULL))
+                       priv->oc |= 1 << i;
+       }
+}
+
 static int ak4613_i2c_probe(struct i2c_client *i2c,
                            const struct i2c_device_id *id)
 {
@@ -458,6 +485,8 @@ static int ak4613_i2c_probe(struct i2c_client *i2c,
        if (!priv)
                return -ENOMEM;
 
+       ak4613_parse_of(priv, dev);
+
        priv->fmt_ctrl          = NO_FMT;
        priv->cnt               = 0;