hal: Configure correct COPP sample rate for USB and HDMI devices.
-In case of playback over HDMI/USB, the device might not support
the same sample rate as of the stream, though it is preferred that
resampling happens after post processing, but if device sample rate
is not even a multiple of stream sample rate, ensure that resampling
happens in the COPP.
Change-Id: Ia8cdff5294433ec099b703001d11da905bf82c9b
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index a42f984..45ef1fa 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -5016,6 +5016,29 @@
return ret;
}
+void platform_check_and_update_copp_sample_rate(void* platform, snd_device_t snd_device,
+ unsigned int stream_sr, int* sample_rate)
+{
+ struct platform_data* my_data = (struct platform_data *)platform;
+ int backend_idx = platform_get_backend_index(snd_device);
+ int device_sr = my_data->current_backend_cfg[backend_idx].sample_rate;
+ /*Check if device SR is multiple of 8K or 11.025 Khz
+ *check if the stream SR is multiple of same base, if not set
+ *copp sample rate equal to device sample rate.
+ */
+ if (!(((sample_rate_multiple(device_sr, SAMPLE_RATE_8000)) &&
+ (sample_rate_multiple(stream_sr, SAMPLE_RATE_8000))) ||
+ ((sample_rate_multiple(device_sr, SAMPLE_RATE_11025)) &&
+ (sample_rate_multiple(stream_sr, SAMPLE_RATE_11025))))) {
+ *sample_rate = device_sr;
+ } else
+ *sample_rate = stream_sr;
+
+ ALOGI("sn_device %d device sr %d stream sr %d copp sr %d", snd_device, device_sr, stream_sr
+, *sample_rate);
+
+}
+
int platform_get_edid_info(void *platform)
{
struct platform_data *my_data = (struct platform_data *)platform;