audio codec driver

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

audio codec driver

9,344 Views
rumcajs666
Contributor II

Hello,

 

I've a i.MX6Quad and wm8960 codec and i'm trying to run this setup.

I've seen wm8962 and sgtl5000 files, but many things are not clear for me.

 

Can someone explain me in an approachable way how to write an audio codec driver or where to gain knowledge about this subject?

 

Regards,

Sebastian B.

Original Attachment has been moved to: imx6qdl.dtsi.zip

Original Attachment has been moved to: imx6qdl-sabresd.dtsi.zip

Original Attachment has been moved to: imx-wm8960.c.zip

Labels (2)
16 Replies

3,618 Views
fabio_estevam
NXP Employee
NXP Employee

You can use the imx_3.14.28_7d_alpha branch. In imx7d-sdb board there is a wm8960 codec:

linux-2.6-imx.git - Freescale i.MX Linux Tree

,so you can use this as a reference and modify your dts accordingly.

Regards,

Fabio Estevam

0 Kudos

3,618 Views
ivannikolaenko
Contributor IV

Hi Fabio Estevam,

I tried to use those driver with mx6q (3.14.28 kernel), but as I understand it is for SAI interface which is not supported on the i.MX6 processors.

Best regards,

Ivan.

0 Kudos

3,618 Views
huangkc
Contributor I

Hi Fabio:

            I prot the driver from imx_3.14.28_7d_alpha branch to andorid4.4.3 imx6q,only modify the dts,as follow:

reg_audio: wm8960_supply {

            compatible = "regulator-fixed";

            regulator-name = "wm8960-supply";

            gpio = <&gpio4 23 0>;

            enable-active-high;

        };

sound {

        compatible = "fsl,imx6q-sabresd-wm8960",

              "fsl,imx-audio-wm8960";

        model = "wm8960-audio";

        cpu-dai = <&ssi2>;

        audio-codec = <&codec>;

        codec-master;

    };

codec: wm8960@1a {

        compatible = "wlf,wm8960";

        reg = <0x1a>;

        clocks = <&clks 201>;

        clock-names = "mclk";

        wlf,shared-lrclk;

    };

The sound’s card has been found.But can't play music.

When i use the tiny tool,it show below

root@sabresd_6dq:/sdcard/Music # tinyplay xiaopinguo.wav

ASoC: HiFi startup failed: -16

cannot open device '/dev/snd/pcmC0D0p'

Unable to open PCM device 0.

can you help me to analyze what the problems.

The dts and log pls reference to the attachment.

Thanks

0 Kudos

3,618 Views
baiaaren
Contributor II

Hi huang,

Do you fix ASoC: HiFi startup failed: -16 problem?

I also meet this problem in android 5.1. Could you share your method?

Thanks

3,618 Views
rumcajs666
Contributor II

Sorry for now answering right away, but i had a few days off.

Thank you both for hints.

I managed to register device and trying to going further.

0 Kudos

3,618 Views
rumcajs666
Contributor II

Finally it's working, with a help from outside.

It seems that, problem was with clock.

Piece of code writing directly to register solved problem.

0 Kudos

3,618 Views
lakshmishetty
Contributor II

Hi Sebastian,

Even we are facing the same issue.

Can you please share, what clock values you have updated.

Thanks in advance.

Best Regards,

Lakshmi Hegde

0 Kudos

3,618 Views
ivannikolaenko
Contributor IV

Hi Lakshmi!
Try this file. It works on my device.

0 Kudos

3,617 Views
lakshmishetty
Contributor II

Hi Nikolaenko,

Thank you so much for your immediate reply.

Actually we are using SGTL5000 codec(with internal clock).

I will check the differences you have done for wm8960 and implement the same changes for SGTL5000.

Best Regards,

Lakshmi Hegde

0 Kudos

3,618 Views
ivannikolaenko
Contributor IV

Hi Sebastian!


Could you share your imx-wm8960 driver and .dts file nodes with the community, please?
I have my own wm8960 driver, but it is not able to capture sound from microphone.

Thank You.

0 Kudos

3,618 Views
huangkc
Contributor I

Hi Sabastian:

       Could you be more detail about how to Piece of code writing directly to register solved problem, I don't really understand.

Thanks

0 Kudos

3,616 Views
igorpadykov
NXP Employee
NXP Employee

Hi Sebastian

some descriptions can be found in attached Porting Guide

sect.Chapter 8 Porting Audio Codecs to a Custom Board,

MX53UG  Chapter 21 Porting Audio Codecs to a Custom Board,

Chapter 29 Advanced Linux Sound Architecture (ALSA) System

on a Chip (ASoC) Sound Driver  Linux Manual

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos

3,616 Views
rumcajs666
Contributor II

I somehow clicked as resolved:( Can admin please revert it?

Thank You Igor for the answer.

I already read porting guide.

Now i'm receiving this error

imx-wm8960 sound.22: ASoC: CODEC DAI wm8960 not registered

imx-wm8960 sound.22: snd_soc_register_card failed (-517)

Can You give me some hints?

Regards,

Sebastian

0 Kudos

3,616 Views
igorpadykov
NXP Employee
NXP Employee

Hi Sebastian

since linux failed to register drivers,

one can check codecs i2c signals by oscilloscope

Best regards

igor

0 Kudos

3,616 Views
rumcajs666
Contributor II

Hi Igor,

I couldn't answer before the weekend.

I2C is working, i have signals on the lines, i checked it with other custom device and it's sending what i want.

I have checked wm8960.c file and found that function "wm8960_i2c_probe" is performed and no function returns error.

Also i2c device is registered.

In this file there is also "wm8960_probe" function but it's not running.

Unfortunately WM8960 is write only device, and i cannot read its registers:/

0 Kudos

3,616 Views
igorpadykov
NXP Employee
NXP Employee

Hi Sebastian

Linux/Documentation/devicetree/bindings/sound/wm8960.txt - Linux Cross Reference - Free Electrons

linuxppc-dev - [alsa-devel][PATCH] ASoC: fsl: add imx-wm8960 machine driver

Advanced Linux Sound System development

if you have Sabre SD board (it supports wm8962 codec)

then one can run both boards in parallel and with debugger run

program step by step. So one can find where custom board fails from

normal flow execution. Recommended to use Freescale BSP from

official product web page

L3.14.28_1.0.0_iMX6QDLS_BUNDLE

AN4553 Using Open Source Debugging Tools for Linux on i.MX Processors

Also Freescale has special service for providing support for customization

of drivers which are not present on its BSP releases:

Professional Engineering Services|Freescale

Best regards

igor

0 Kudos