HOW TO SET MIC_BIAS_VOLT (SGTL5000) 3V?

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

HOW TO SET MIC_BIAS_VOLT (SGTL5000) 3V?

2,089 Views
kevintai
Contributor I

I'm using I.MX28evk.

The default value for MIC_BIAS_VOLT  is 1.25V.

I want to set mic_bias_volt(sgtl5000) 3V.

When i try to change BIAS_VOLT=0x7,The actual voltage for MIC_BIAS   is still  1.25V.

Labels (1)
Tags (2)
0 Kudos
16 Replies

1,464 Views
YixingKong
Senior Contributor IV

Kevin Tai, could you closely work with Arthur and reply his question/suggestion? If your issue has gone please notify us here. Thanks,Yixing

0 Kudos

1,464 Views
kevintai
Contributor I

不好意思,最近忙其它工作耽误过来看了。

SGTL5000驱动本身没什么问题,录音和放音我都测试过了,只是想配置MIC_BIAS的输出电压为3V,可是我设置BIAS_VOLT=0x7不起作用,但是修改其它配置还是起作用的。

如果方便,您这边测试一下看看能不能改变它的输出电压。(注:MIC_BIAS只有在录音或者放音的时候才有输出电压)

0 Kudos

1,464 Views
YixingKong
Senior Contributor IV

Kevin, Arthur had provided answer to yor question. If it is correct one, please click Correct Answer to close the discussion.

Regards,

Yixing

0 Kudos

1,464 Views
arthur_lai
Senior Contributor II


Hi Kevin,

We have verified on EVK that the mic bias voltage can be set to 3V by changing BIAS_VOLT to 0x7.

It is probably a software problem? Are you using our BSP? If so, what is the version?

In addition, our BSP does not have an API to set these bits. Can you let know how do you set the bits now?

Thanks,

Arthur

0 Kudos

1,464 Views
kevintai
Contributor I

I have changed two files. sgtl5000.h  and  sgtl5000.c

sgtl5000.h

#define SGTL5000_BIAS_VOLT_MASK   0x0070

#define SGTL5000_BIAS_VOLT_SHIFT  4

#define SGTL5000_BIAS_VOLT_WIDTH  3

sgtl5000.c

sgtl5000_write(
   codec,
   SGTL5000_CHIP_MIC_CTRL,
   sgtl5000_read(codec,SGTL5000_CHIP_MIC_CTRL) | SGTL5000_BIAS_VOLT_MASK );

sgtl5000_set_bias_level(codec, SND_SOC_BIAS_STANDBY);

return 0;
}

0 Kudos

1,464 Views
arthur_lai
Senior Contributor II

Hi Kevin,

In your codes, you have set bit 4 to 6 on the CHIP_MIC_CTRL register. Have you set Bit 8 and 9 too? The default value of these bits is 0 and the mic bias is powered off. You have to set them too to enable the mic bias.

In addition, what is the VDDA supply voltage on SGTL5000? If you want to set the mic bias voltage to 3V, you need to provide a 3.3V supply on VDDA of SGTL5000 as on our EVK.

Thanks,

Arthur

0 Kudos

1,464 Views
kevintai
Contributor I

My DESINGN:

VDDA  = 3.3V

mic_bias=1.25V( CHIP_MIC_CTRL register  have set Bit 8 and 9  to  0X2

Can you upload your files(sgtl5000.c  and sgtl5000.h)?

0 Kudos

1,464 Views
GraceH
Senior Contributor II

The only change is in function sgtl5000_probe of sgtl5000.c

static int sgtl5000_probe(struct platform_device *pdev)

{

//sgtl5000_write(codec, SGTL5000_CHIP_MIC_CTRL, 0);

sgtl5000_write(codec, SGTL5000_CHIP_MIC_CTRL, 0x70);

}

You can print the value of CHIP_MIC_CTRL in sgtl5000_mic_bias. When bias is enabled, it shows

"sgtl5000_mic_bias enable =1  SGTL5000_CHIP_MIC_CTRL =0x270", the voltage is 3V.

If you want to enable bias after boot, you can enable it in  function sgtl5000_probe.

static void sgtl5000_mic_bias(struct snd_soc_codec *codec, int enable)

{

...

..

printk(KERN_NOTICE "sgtl5000_mic_bias enable =%d  SGTL5000_CHIP_MIC_CTRL =0x%x\n",enable,sgtl5000_read(codec, SGTL5000_CHIP_MIC_CTRL));

}

Grace

0 Kudos

1,464 Views
kevintai
Contributor I

按上面做的修改

sound/soc/codecs/sgtl5000.c

static int sgtl5000_probe(struct platform_device *pdev)

{

printk("test123456\n");

sgtl5000_write(codec, SGTL5000_CHIP_MIC_CTRL, 0x70);

}

static void sgtl5000_mic_bias(struct snd_soc_codec *codec, int enable)

{

...

..

printk(KERN_NOTICE "sgtl5000_mic_bias enable =%d  SGTL5000_CHIP_MIC_CTRL =0x%x\n",enable,sgtl5000_read(codec, SGTL5000_CHIP_MIC_CTRL));

}

运行结果:MICBIAS输出电压依然是1.25V,上面添加的这两个打印信息一条也没打印出来,就好像程序完全没有进行一样。

我的编译过程:

1 ./ltib --configure

2   选择 always rebuild the kernel

保存配置,编译

3 ./ltib -p boot_stream.spec -f

4 通过MFGTOOLS 烧写新编译出来的imx28_ivt_linux.sb


总结:感觉不是配置参数有问题,是我修改的内容完全没有执行一样。


0 Kudos

1,464 Views
GraceH
Senior Contributor II

If you config "always rebuild the kernel", you need run "./ltib"

With command "./ltib -p boot_stream.spec -f", because you specify package, it will only build specified package.

In another way, you can check the time of .o file to make sure your changed files are compiled.

You can also use "./ltib -p kernel -f" to force kernel rebuild.

Grace

0 Kudos

1,464 Views
kevintai
Contributor I

用你的方法已经测试过了,还是没有效果,我也特意看了SGTL5000.O  SND-SOC-SGTL5000.O 修改时间,就是我最新编译的时间。

加的那两条PRINTK也没有任何打印信息。我把我的SGTL5000.C文件上传上来,麻烦帮我看一下,谢谢。

0 Kudos

1,464 Views
GraceH
Senior Contributor II

Now it is not the problem of sgtl5000.c, it is your programming problem.

1. there is no printk("test123456\n") in your sgtl5000.c

2. mic bias will only be enable when there is playback or recording.

3. check the boot log to make sure your kernel is built correctly.

Freescale MAD -- Linaro 2011.07 -- Built at 2011/08/10 09:20) ) #33 PREEMPT Tue Dec 10 16:50:28 HKT 2013

Grace

0 Kudos

1,464 Views
kevintai
Contributor I

问题解决了。

出现问题原因:我的硬件有SD卡和NANDFLASH,我的硬件设置是默认从NANDFLASH启动,而我只把新内核和文件系统烧与到SD卡里。

让我一直没发现这个问题的原因是 BSP包中软件默认是SD卡启动的,就算我硬件上默认是NANDFLASH启动,在不按KEY1键的情况下,它还是会转到SD卡上,让我没有想到的是在我的硬件上竟然内核是用的NANDFLASH上的,文件系统默认是用的SD卡里的。  说的可能有点绕。

感谢各位的支持。

0 Kudos

1,464 Views
arthur_lai
Senior Contributor II

Have you verified that the audio codec driver is setup properly and the communication between i.MX28 and SGTL5000 is ok?

Can you try changing other setting on SGTL5000?

Arthur

0 Kudos

1,464 Views
YixingKong
Senior Contributor IV

Arthur, the customer reply your question here. Please keep working with the customer.

Thanks,

Yixing

0 Kudos

1,464 Views
kevintai
Contributor I

Playback and recording is OK. Can you setup MIC_BIAS_VOLT for 3V?

0 Kudos