i.MX 6q - Nougat - audio codec issue

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

i.MX 6q - Nougat - audio codec issue

809 Views
ravikiranjj
Contributor II

Hi All,

I am working on the imx6q based customized board  with sgtl5000 audio codec , Nougat porting.

Is it possible to set the codec sampling rate by default to 16K.

As of now if i make some  modification in the HAL  :

For less than 32k -- Codec is setting to 32k sampling rate.

For 32K-44k -- Codec is setting to 44100 HZ sampling rate.

For 44K-48 -- Codec is setting to 48000 HZ sampling rate.

I want to set the default sampling rate as 16K..

Any suggestion please ??

Regards,

Ravikiran

Labels (4)
0 Kudos
Reply
2 Replies

704 Views
igorpadykov
NXP Employee
NXP Employee

Hi RAVIKIRAN 

one can try to adjust it in function sgtl5000_set_clock() in sgtl5000 driver in linux/sound/soc/codecs/sgtl5000.c

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

0 Kudos
Reply

704 Views
ravikiranjj
Contributor II

Hi Igor,

Thank you for your reply.

Above task (Setting default sampling rate to 16K Hz in android) achieved by alsa  HAL changes ( tinyalsa_hal.c ).

Modified the Out rate, In rate and adev->mm_rate ( re-sampling rate ) sampling rate to 16 KHz.

tinyalsa_hal.c :

@@ -3277,7 +3280,7 @@ static int scan_available_device(struct imx_audio_device *adev, bool queryInput,
}

if(queryOutput) {
- rate = 44100;
+ rate = 16000;
if( pcm_get_near_param_wrap(i, 0, PCM_OUT, PCM_HW_PARAM_RATE, &rate) == 0)
adev->card_list[n]->out_rate = rate;
ALOGW("out rate %d",adev->card_list[n]->out_rate);
@@ -3291,7 +3294,7 @@ static int scan_available_device(struct imx_audio_device *adev, bool queryInput,
}

if(queryInput) {
- rate = 44100;
+ rate = 16000;
if( pcm_get_near_param_wrap(i, 0, PCM_IN, PCM_HW_PARAM_RATE, &rate) == 0)
adev->card_list[n]->in_rate = rate;

@@ -3313,6 +3316,7 @@ static int scan_available_device(struct imx_audio_device *adev, bool queryInput,
}
#endif

+
ALOGW("in rate %d, channels %d format %d",adev->card_list[n]->in_rate, adev->card_list[n]->in_channels, adev->card_list[n]->in_format);
}

@@ -3381,7 +3385,7 @@ static int adev_open(const hw_module_t* module, const char* name,
adev->hw_device.open_input_stream = adev_open_input_stream;
adev->hw_device.close_input_stream = adev_close_input_stream;
adev->hw_device.dump = adev_dump;
- adev->mm_rate = 44100;
+ adev->mm_rate = 16000;

ret = scan_available_device(adev, true, true);
if (ret != 0) {

Above changes is going to set the default re-sampling rate to 16KHz and setting codec Out and In rate to 16KHz.

Tested this result with Oscilloscope by probing word clock of codec.

Regards,

Ravikiran

0 Kudos
Reply