[alsa-devel] WM5102 - Help to make baytrail machine driver work

Paulo Sergio pstglia at gmail.com
Sat May 13 07:11:31 CEST 2017


Hi everybody

>>>> Note: Based on Lenovo code, I concluded this device uses ssp0, so I'm
>>>> using a fw file "fw_sst_0f28_ssp0.bin" posted another thread.
>>>> Could use the hacks used on kernel 4.11, but as I'm still testing with
>>>> kernel 4.4, using this fw would make things easier
>>>
>>>
>>>
>>> nope. I don't know how many issues we've fixed since 4.4 but it's not a
>>> matter of just swapping out one firmware with another. You'll have better
>>> luck with plain vanilla 4.11 + regular firmware and restarting modifying
>>> one
>>> of the latest machine drivers.
>>
>>
>> Ok, I'll use 4.11 and post the results later
>>
>> Should I have any special care about I2S other than setting the format
>> um backend DAI?
>> Some module should be loaded?
>
>
> Things to look for
> - SSP routing: has to be SSP0 on baytrail-CR
> - number of slots: 2 or 4. if 4 then use DSP mode
> - DAI format
> - MCLK

Hi, I'd like to share a feedback:

I switched to kernel 4.11, applied some previous changes (made with
kernel 4.4) and started a new machine driver using bytcr_rt5640 as
base.

After some adjustments and a temp fix (see remarks bellow) I was able
to route sound using headphones
Routing to speaker doesn't give any audio (Lenovo code seems to uses
GPIO to power/enable speakers on probe before setting routes...)

Remarks:

* setting pll/fll using snd_soc_dai_set_pll didn't work. I had to map
the codec member from snd_soc_dai struct and use
   snd_soc_codec_set_pll instead (used the same constants used on
Lenovo source code)

 - Had also to set sysclk to  codecs, not only to dai's using
snd_soc_codec_set_sysclk

* This device (Lenovo Yoga 2 1051F) is a bytcr device. However bios
status returned by iosf_mbi_read is
    1000000001000000000000101000000 (bits 26:27 disabled).
   Had to force  bytcr flag to be true  in order to apply correct MCLK
frequency (25Mhz) and use SSP0

* Used commands from rt5640 UCM file, removing 5640 specifics and
using Wolfson ones (thanks to Charles for point this out previously):
cset name='HPOUT1L Input 1' AIF1RX1
cset name='HPOUT1R Input 1' AIF1RX2
cset name='HPOUT1 Digital Switch' on


cset name='Headphone Switch'  on

* Used some patches to enable wm5102 ACPI detection (credits to
Christian Hartmann)

* Added a voltage supplier needed to wm5102 (added to arizona-ldo
directly - Lenovo and rpi register a platform with these)
* hardcoded ldoena, reset and irq_gpio on arizona-core (tried to get
those from gpio, but they didn't give me the correct values. Lack of
knowledge... )

* The codec chip uses SPI, not IC2 like 5640 (don't know if this is
relevant for machine driver code)

I've pushed these to github  in case you want to check it [A]

Also, this is the Android-x86 testing image generated with these changes [B]

Many thanks for the support!

Regards,
Pstglia

[A] - https://github.com/pstglia/linux/tree/lenovo_yoga2_returns-4.11
[B] - https://drive.google.com/file/d/0BxO6THtB865fQ3VhRUZoc1BMNkE/view?usp=sharing


More information about the Alsa-devel mailing list