[Letux-kernel] GTA04 voice routing

H. Nikolaus Schaller hns at goldelico.com
Tue Feb 7 08:12:45 CET 2017


> Am 06.02.2017 um 12:26 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
> Hi,
> I am working on fixing the voice routing with DT
> based kernels and it starts to work partially.
> 
> I want to share some log...
> 
> root at letux:~# amixer set 'Voice route' 'Voice to SoC'
> [   82.491699] voice ctl route: 0
> [   82.499938] devm_pinctrl_get ed460040
> [   82.503906] twl4030_voice_set_tristate codec=ed0bea00 1
> [   82.513488] pinctrl_lookup_state default error -19
> Simple mixer control 'Voice route',0
>  Capabilities: enum
>  Items: 'Voice to SoC' 'Voice to twl4030'
>  Item0: 'Voice to SoC'
> root at letux:~# amixer set 'Voice route' 'Voice to SoC'
> [   87.971649] voice ctl route: 0
> Simple mixer control 'Voice route',0
>  Capabilities: enum
>  Items: 'Voice to SoC' 'Voice to twl4030'
>  Item0: 'Voice to SoC'
> root at letux:~# amixer set 'Voice route' 'Voice to twl4030'
> [   90.949249] voice ctl route: 1
> [   90.953491] devm_pinctrl_get ed460040
> [   90.959991] pinctrl_lookup_state tristate error -19
> [   90.967468] twl4030_voice_set_tristate codec=ed0bea00 0
> Simple mixer control 'Voice route',0
>  Capabilities: enum
>  Items: 'Voice to SoC' 'Voice to twl4030'
>  Item0: 'Voice to twl4030'
> root at letux:~#
> 
> What does not yet work is looking up the pinctrl_lookup_state
> "default" and "tristate".

Ok, I have improved code that compiles and appears to do something,
i.e. call pinctrl_select_state for the right pinmux.

What I have not yet tested is if the pinmux is right :)

Also note that I have renamed the mixer states to "active" and "inactive"
so that the feature does not depend on a specific hardware
setup which is something kernel maintainers don't like:

root at letux:~# amixer set 'Voice route' 'inactive'
[   97.231964] voice ctl route: 0
Simple mixer control 'Voice route',0
  Capabilities: enum
  Items: 'inactive' 'active'
  Item0: 'inactive'
root at letux:~# amixer set 'Voice route' 'active'
[  100.096893] voice ctl route: 1
[  100.101379] default vs. inactive
[  100.109313] devm_pinctrl_get ec5837c0
[  100.113250] dev->of_node = ef7e370c
[  100.121032] dev->of_node->name = ef7e38d4
[  100.125579] dev->of_node->name = codec
[  100.129547] default vs. default
[  100.132843] pinctrl_select_state tristate
[  100.137969] twl4030_voice_set_tristate codec=ed0bcc00 0
Simple mixer control 'Voice route',0
  Capabilities: enum
  Items: 'inactive' 'active'
  Item0: 'active'
root at letux:~# amixer set 'Voice route' 'inactive'
[  112.840423] voice ctl route: 0
[  112.844635] devm_pinctrl_get ec5837c0
[  112.851043] dev->of_node = ef7e370c
[  112.854766] dev->of_node->name = ef7e38d4
[  112.861999] dev->of_node->name = codec
[  112.867797] twl4030_voice_set_tristate codec=ed0bcc00 1
[  112.874176] default vs. inactive
[  112.879516] inactive vs. inactive
[  112.883056] pinctrl_select_state default
Simple mixer control 'Voice route',0
  Capabilities: enum
  Items: 'inactive' 'active'
  Item0: 'inactive'
root at letux:~#

> 
> The reason we need this is that we have a shared bus for the
> PCM data.
> 
> For incoming voice the gtm601 module is the master and either
> the twl4030 and the McBSP4-DR of the OMAP are clients (or even both).
> 
> For outgoing voice we have to make either the twl4030 (where
> the microphone is connected to) of the McBSP-DX line the master.
> Both potential masters are connected in parallel to the single
> PCM input of the gtm601 module.
> 
> To avoid data mix and corruption, we have to tri-state either
> one. This is already done by the twl4030-codec driver, but
> tristating the McBSP-DX line is not as easy. The best solution
> appears to be to provide two different pinmux states in the DT
> and make the twl4030-codec choose either one.
> 
> Next I have to dig into the code to find out where to specify
> it in the DT so that it is really found...
> 
> But the code itself seems to compile. I will push it later and
> provide a link so that you can look inside (needs some cleanup
> first).

Here is the cleaned up code and already rebased to linux v4.10-rc7:

http://git.goldelico.com/?p=gta04-kernel.git;a=shortlog;h=refs/heads/work/hns/codec/twl4030
http://git.goldelico.com/?p=gta04-kernel.git;a=shortlog;h=refs/heads/work/hns/dt/gta04

Please test and help to improve/fix...

BR,
Nikolaus


More information about the Letux-kernel mailing list