Re: [PATCH 2/3] ASoC: simple-card: Add support jack detection via codec

From: Xing Zheng
Date: Thu Apr 21 2016 - 21:18:17 EST



On 2016å04æ21æ 22:19, Rob Herring wrote:
On Mon, Apr 18, 2016 at 04:17:31PM +0800, Xing Zheng wrote:
In most cases, many codecs already supports jack detection, previouslly,
we need to create a customized machine driver every time.

Hence, the simple-card need to support use them dynamically via parse dts
file for better flexibility.

Signed-off-by: Xing Zheng <zhengxing@xxxxxxxxxxxxxx>
---

.../devicetree/bindings/sound/simple-card.txt | 17 +++
sound/soc/generic/simple-card.c | 126 +++++++++++++++++++-
2 files changed, 140 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt
index cf3979e..d25c8eb 100644
--- a/Documentation/devicetree/bindings/sound/simple-card.txt
+++ b/Documentation/devicetree/bindings/sound/simple-card.txt
@@ -22,6 +22,23 @@ Optional properties:
headphones are attached.
- simple-audio-card,mic-det-gpio : Reference to GPIO that signals when
a microphone is attached.
+- simple-audio-card,codec-jack : A list of the codec supports jack detection.
+ The jack types which are supported refer to include/sound/jack.h.
+ All of the jack types:
+ "JACK_HEADPHONE",
+ "JACK_MICROPHONE",
+ "JACK_HEADSET",
+ "JACK_LINEOUT",
+ "JACK_MECHANICAL",
+ "JACK_VIDEOOUT",
+ "JACK_AVOUT",
+ "JACK_LINEIN",
+ "JACK_BTN_0",
+ "JACK_BTN_1",
+ "JACK_BTN_2",
+ "JACK_BTN_3",
+ "JACK_BTN_4",
+ "JACK_BTN_5".
simple-card is not so simple...

I think this information be part of the codec node if the codec
provides the functionality. The binding should not be different whether
a codec is part of simple-card or not. Also, I would make all these just
boolean props.
Yes, these things seem like make simple-card becomes more complicated, and the generic jack detection method is still a problem currently.

Hi Mark, the other question here, how do we make sense to use the simple-card to call the "snd_soc_dai_set_pll" if the codec (like da7219) requires do this?

Thanks.

--
- Xing Zheng