Skip to contentSkip to conversation

davinci-evm: extend it to support DM81xx and derivatives

PATCH In review Vitaly Wool 3 participants 7 messages Jul 12, 2017 – Jul 31, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 davinci-evm: extend it to support DM81xx and derivatives

Having worked closely with TI DM8148/DM8168 EVMs I came across many derivatives of these boards which didn't use the standard codec but had something like wm897x instead. They all would fit davinci-evm driver nicely if it had support for audio CPU clock divisor and slightly more generic naming. So this patch adds support for reading CPU divisor from a DT and slightly changes names of helper/init functions to be more generic.

It also adds support for DaVinci boards that use wm8978 codec.

---
 .../bindings/sound/davinci-evm-audio.txt           |  6 +-
 sound/soc/davinci/davinci-evm.c                    | 66 ++++++++++++++++++++--
 2 files changed, 65 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/sound/davinci-evm-audio.txt +5 -1
index 963e100514c2..e76966a06f22 100644
@@ -1,7 +1,9 @@
-* Texas Instruments SoC audio setups with TLV320AIC3X Codec
+* Texas Instruments SoC audio setups with TLV320AIC3X/WM89XX codecs
 
 Required properties:
 - compatible : "ti,da830-evm-audio" : forDM365/DA8xx/OMAPL1x/AM33xx
+	       "ti,dm8168-evm-audio" : for DM81xx with TLV320AIC3x
+	       "ti,dm8168-evm-audio-wm8978" : for DM81xx with WM897x
 - ti,model : The user-visible name of this sound complex.
 - ti,audio-codec : The phandle of the TLV320AIC3x audio codec
 - ti,mcasp-controller : The phandle of the McASP controller
@@ -14,6 +16,8 @@ Optional properties:
 - ti,codec-clock-rate : The Codec Clock rate (in Hz) applied to the Codec.
 - clocks : Reference to the master clock
 - clock-names : The clock should be named "mclk"
+- ti,cpu-clkdiv : CPU clock divisor (if codec and cpu are clocked at
+  different rates)
 - Either codec-clock-rate or the codec-clock reference has to be defined. If
   the both are defined the driver attempts to set referenced clock to the
   defined rate and takes the rate from the clock reference.
sound/soc/davinci/davinci-evm.c +60 -6

119 lines not on this page · raw message

Signature · 1 line
2.11.0
#1 lore raw

+ Peter & Jyri

Hi Vitaly,

Quoted 11 lines · Vitaly Wool

Having worked closely with TI DM8148/DM8168 EVMs I came across many derivatives of these boards which didn't use the standard codec but had something like wm897x instead. They all would fit davinci-evm driver nicely if it had support for audio CPU clock divisor and slightly more generic naming. So this patch adds support for reading CPU divisor from a DT and slightly changes names of helper/init functions to be more generic.

It also adds support for DaVinci boards that use wm8978 codec.

While there are some users of davinci-evm.c, I think a majority are using simple-audio-card instead. Curious on why you chose not to use that. It sounds like codec is not the bitclock and frame-sync master in your case. Did that end up creating issues ?

Thanks,
Sekhar

maintainer
#2 lore raw
Quoted 4 lines · Sekhar Nori

While there are some users of davinci-evm.c, I think a majority are using simple-audio-card instead. Curious on why you chose not to use that. It sounds like codec is not the bitclock and frame-sync master in your case. Did that end up creating issues ?

New systems should start using of-graph - that's a more flexible and extensible replacement for simple-card. But yes, if you can use one of the generic cards that's better.

#3 lore raw

Hi Mark,

2017-07-13 12:33 GMT+02:00 Mark Brown <[email protected]>:

Quoted 10 lines · Sekhar Nori
Quoted 5 lines

While there are some users of davinci-evm.c, I think a majority are using simple-audio-card instead. Curious on why you chose not to use that. It sounds like codec is not the bitclock and frame-sync master in your case. Did that end up creating issues ?

New systems should start using of-graph - that's a more flexible and extensible replacement for simple-card. But yes, if you can use one of the generic cards that's better.

Unfortunately I can't. In fact we have a few DM81xx devices which boot nicely using the existing kernel code and have most of the peripherals working fine, but sound is not working even though all the relevant drivers are in place. I believe that unless davinci-evm is deprecated, it is beneficial for everyone to have it supporting DM81xx (and I can take over its maintenance since the current maintainer has invalid e-mail specified in the header). I'll be working on of-graph version, too, but Rome wasn't built in a day, you know :)

Best regards,
Vitaly

#4 lore raw
In reply to Sekhar Nori

2017-07-13 10:01 GMT+02:00 Sekhar Nori <[email protected]>:

Quoted 2 lines

+ Peter & Jyri

<snip>

Quoted 4 lines

While there are some users of davinci-evm.c, I think a majority are using simple-audio-card instead. Curious on why you chose not to use that. It sounds like codec is not the bitclock and frame-sync master in your case. Did that end up creating issues ?

Well, one of the problems with simple-audio-card is that you can't snd_soc_dai_set_clkdiv() from it, neither you can set SND_SOC_CLK_OUT for a codec, so for some codecs this just doesn't fit.

Best regards,
Vitaly

maintainer
#5 lore raw
Quoted 10 lines · Vitaly Wool

2017-07-13 10:01 GMT+02:00 Sekhar Nori <[email protected]>:

Quoted 4 lines

While there are some users of davinci-evm.c, I think a majority are using simple-audio-card instead. Curious on why you chose not to use that. It sounds like codec is not the bitclock and frame-sync master in your case. Did that end up creating issues ?

Well, one of the problems with simple-audio-card is that you can't snd_soc_dai_set_clkdiv() from it, neither you can set SND_SOC_CLK_OUT for a codec, so for some codecs this just doesn't fit.

That's no excuse, the CODEC drivers *really* shouldn't use _set_clkdiv()
- fix the drivers to work normally.

#6 lore raw

Hi Mark,

2017-07-17 16:51 GMT+02:00 Mark Brown <[email protected]>:

Quoted 8 lines · Vitaly Wool
Quoted 6 lines

2017-07-13 10:01 GMT+02:00 Sekhar Nori <[email protected]>:

Quoted 4 lines

While there are some users of davinci-evm.c, I think a majority are using simple-audio-card instead. Curious on why you chose not to use that. It sounds like codec is not the bitclock and frame-sync master in your case. Did that end up creating issues ?

Quoted 7 lines
Quoted 3 lines

Well, one of the problems with simple-audio-card is that you can't snd_soc_dai_set_clkdiv() from it, neither you can set SND_SOC_CLK_OUT for a codec, so for some codecs this just doesn't fit.

That's no excuse, the CODEC drivers *really* shouldn't use _set_clkdiv()
- fix the drivers to work normally.

Well that's not the only problem. CPU driver (davinci-mcasp) doesn't work well with simple-audio-card either.

There's no good way to set SND_SOC_CLK_OUT for it if the clock is fixed-rate. asoc_simple_card_init_dai()
initializes clocks to SND_SOCK_CLK_IN, and the only way you can change it later is by calling asoc_simple_card_hw_params(). But that's not a real match either, since it won't work with a fixed-rate clock.

So basically I can see 2 ways out here:
* extend davinci-evm driver to handle DM81xx (which is implemented in the patch I've sent before)
* fix simple-card-utils so that it's possible to set SND_SOC_CLK_OUT in asoc_simple_card_init_dai().

I would personally go the first way but if you prefer the 2nd, I can pursue that track too.

Thanks in advance,

Best regards,
Vitaly