post_proc: fix offload PBE failure in sending calibration to lpass

PBE values are misinterpreted when transferring from u to k via
mixer ctl interface. Config values have to be copied one by one rather
than copying through continuous memory.

CRs-Fixed: 2456844
Change-Id: Icf19d02ec1717318e80a8a3859c165eae42c000d
diff --git a/post_proc/effect_api.c b/post_proc/effect_api.c
index cff4be3..4101647 100644
--- a/post_proc/effect_api.c
+++ b/post_proc/effect_api.c
@@ -264,7 +264,10 @@
 {
     long  param_values[128] = {0};
     long *p_param_values = param_values;
-    int i, *cfg = NULL;
+    int i;
+    int32_t *p_coeffs = NULL;
+    uint32_t lpf_len = 0, hpf_len = 0, bpf_len = 0;
+    uint32_t bsf_len = 0, tsf_len = 0, total_coeffs_len = 0;
 
     ALOGV("%s: enabled=%d", __func__, pbe->enable_flag);
     *p_param_values++ = PBE_MODULE;
@@ -283,9 +286,42 @@
         *p_param_values++ = CONFIG_SET;
         *p_param_values++ = 0; /* start offset if param size if greater than 128  */
         *p_param_values++ = pbe->cfg_len;
-        cfg = (int *)&pbe->config;
-        for (i = 0; i < (int)pbe->cfg_len ; i+= sizeof(*p_param_values))
-            *p_param_values++ = *cfg++;
+        *p_param_values++ = pbe->config.real_bass_mix;
+        *p_param_values++ = pbe->config.bass_color_control;
+        *p_param_values++ = pbe->config.main_chain_delay;
+        *p_param_values++ = pbe->config.xover_filter_order;
+        *p_param_values++ = pbe->config.bandpass_filter_order;
+        *p_param_values++ = pbe->config.drc_delay;
+        *p_param_values++ = pbe->config.rms_tav;
+        *p_param_values++ = pbe->config.exp_threshold;
+        *p_param_values++ = pbe->config.exp_slope;
+        *p_param_values++ = pbe->config.comp_threshold;
+        *p_param_values++ = pbe->config.comp_slope;
+        *p_param_values++ = pbe->config.makeup_gain;
+        *p_param_values++ = pbe->config.comp_attack;
+        *p_param_values++ = pbe->config.comp_release;
+        *p_param_values++ = pbe->config.exp_attack;
+        *p_param_values++ = pbe->config.exp_release;
+        *p_param_values++ = pbe->config.limiter_bass_threshold;
+        *p_param_values++ = pbe->config.limiter_high_threshold;
+        *p_param_values++ = pbe->config.limiter_bass_makeup_gain;
+        *p_param_values++ = pbe->config.limiter_high_makeup_gain;
+        *p_param_values++ = pbe->config.limiter_bass_gc;
+        *p_param_values++ = pbe->config.limiter_high_gc;
+        *p_param_values++ = pbe->config.limiter_delay;
+        *p_param_values++ = pbe->config.reserved;
+
+        p_coeffs = &pbe->config.p1LowPassCoeffs[0];
+        lpf_len = (pbe->config.xover_filter_order == 3) ? 10 : 5;
+        hpf_len = (pbe->config.xover_filter_order == 3) ? 10 : 5;
+        bpf_len = pbe->config.bandpass_filter_order * 5;
+        bsf_len = 5;
+        tsf_len = 5;
+        total_coeffs_len = lpf_len + hpf_len + bpf_len + bsf_len + tsf_len;
+
+        for (i = 0; i < total_coeffs_len; i++) {
+            *p_param_values++ = *p_coeffs++;
+        }
         param_values[2] += 1;
     }
 
@@ -533,7 +569,7 @@
         for (i=0; i<eq->config.num_bands; i++) {
             *p_param_values++ = eq->per_band_cfg[i].band_idx;
             *p_param_values++ = eq->per_band_cfg[i].filter_type;
-	    *p_param_values++ = eq->per_band_cfg[i].freq_millihertz;
+            *p_param_values++ = eq->per_band_cfg[i].freq_millihertz;
             *p_param_values++ = eq->per_band_cfg[i].gain_millibels;
             *p_param_values++ = eq->per_band_cfg[i].quality_factor;
         }