Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 63c02ea4 authored by Preetam Singh Ranawat's avatar Preetam Singh Ranawat Committed by Gerrit - the friendly Code Review server
Browse files

hal: Add 8K, 11.025K, 16K, 22.05K and 32K SR support for USB.

 -Add support for 8K, 11.025K, 16K, 22.05K and 32K SR's
  in framework for USB playback/capture path as these are
  supported in USB driver.

Change-Id: Ief416123ef1fc7f39691fbf7b2a0ad4739b86dff
parent 21d77253
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@
#define SAMPLE_RATE_11025         11025
// Supported sample rates for USB
static uint32_t supported_sample_rates[] =
    {44100, 48000, 64000, 88200, 96000, 176400, 192000, 352800, 384000};
    {8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 88200, 96000, 176400, 192000, 352800, 384000};

#define  MAX_SAMPLE_RATE_SIZE  sizeof(supported_sample_rates)/sizeof(supported_sample_rates[0])

+59 −40
Original line number Diff line number Diff line
@@ -5380,16 +5380,34 @@ static int platform_set_codec_backend_cfg(struct audio_device* adev,
            char *rate_str = NULL;
            struct  mixer_ctl *ctl = NULL;

            if (backend_idx == USB_AUDIO_RX_BACKEND ||
                    backend_idx == USB_AUDIO_TX_BACKEND) {
                switch (sample_rate) {
                case 32000:
                if (passthrough_enabled) {
                        rate_str = "KHZ_32";
                        break;
                }
                case 8000:
                        rate_str = "KHZ_8";
                        break;
                case 11025:
                        rate_str = "HZ_11P025";
                        break;
                case 16000:
                        rate_str = "KHZ_16";
                        break;
                case 22050:
                        rate_str = "KHZ_22P05";
                        break;
                }
            }

            if (rate_str == NULL) {
                switch (sample_rate) {
                case 32000:
                    if (passthrough_enabled) {
                        rate_str = "KHZ_32";
                        break;
                    }
                case 48000:
                    rate_str = "KHZ_48";
                    break;
@@ -5424,6 +5442,7 @@ static int platform_set_codec_backend_cfg(struct audio_device* adev,
                    rate_str = "KHZ_48";
                    break;
                }
            }

            ctl = mixer_get_ctl_by_name(adev->mixer,
                my_data->current_backend_cfg[backend_idx].samplerate_mixer_ctl);
+59 −40
Original line number Diff line number Diff line
@@ -5251,16 +5251,34 @@ static int platform_set_codec_backend_cfg(struct audio_device* adev,
            char *rate_str = NULL;
            struct  mixer_ctl *ctl = NULL;

            if (backend_idx == USB_AUDIO_RX_BACKEND ||
                    backend_idx == USB_AUDIO_TX_BACKEND) {
                switch (sample_rate) {
                case 32000:
                if (passthrough_enabled) {
                        rate_str = "KHZ_32";
                        break;
                }
                case 8000:
                        rate_str = "KHZ_8";
                        break;
                case 11025:
                        rate_str = "HZ_11P025";
                        break;
                case 16000:
                        rate_str = "KHZ_16";
                        break;
                case 22050:
                        rate_str = "KHZ_22P05";
                        break;
                }
            }

            if (rate_str == NULL) {
                switch (sample_rate) {
                case 32000:
                    if (passthrough_enabled) {
                        rate_str = "KHZ_32";
                        break;
                    }
                case 48000:
                    rate_str = "KHZ_48";
                    break;
@@ -5295,6 +5313,7 @@ static int platform_set_codec_backend_cfg(struct audio_device* adev,
                    rate_str = "KHZ_48";
                    break;
                }
            }

            ctl = mixer_get_ctl_by_name(adev->mixer,
                my_data->current_backend_cfg[backend_idx].samplerate_mixer_ctl);