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

Commit 750cc1c0 authored by David Lin's avatar David Lin
Browse files

hal: cirrus_playback: fix issue with calibration



The latest calibration result struct in the algorithm library does not
contain atemp (ambient temperature), and the current RX feedback path
has 8 channels.

Bug: 71645808
Test: Run cirrus_sp_status

Calibration:
Left Calibration is done, Left R=6.978233 ohms
Cal temp = 23 c degree
Right Calibration is done, Right R=7.764715 ohms
Cal temp = 23 c degree

*******************************************************
Current Left Re.   = 6.981808 ohms
Current Left Temp. = 23.128071 c degree
Current Left Exc. M. = 6001
Current Right Re.   = 7.796174 ohms
Current Right Temp. = 24.012878 c degree
Current Right Exc. M. = 6001
*******************************************************

Change-Id: I1aa34f91eb0e1ba3096f7da2a112a8402c49b863
Signed-off-by: default avatarDavid Lin <dtwlin@google.com>
parent 8d2ab1ec
Loading
Loading
Loading
Loading
+3 −17
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ struct cirrus_cal_result_t {
    int32_t status_r;
    int32_t checksum_r;
    int32_t z_r;
    int32_t atemp;
};

/* Payload struct for setting the RX and TX use cases */
@@ -74,7 +73,6 @@ struct crus_rx_run_case_ctrl_t {
    int32_t status_r;
    int32_t checksum_r;
    int32_t z_r;
    int32_t atemp;
};

#define CRUS_SP_FILE "/dev/msm_cirrus_playback"
@@ -125,11 +123,11 @@ static struct pcm_config pcm_config_cirrus_tx = {
};

static struct pcm_config pcm_config_cirrus_rx = {
    .channels = 2,
    .channels = 8,
    .rate = 48000,
    .period_size = 256,
    .period_size = 320,
    .period_count = 4,
    .format = PCM_FORMAT_S16_LE,
    .format = PCM_FORMAT_S32_LE,
    .start_threshold = 0,
    .stop_threshold = INT_MAX,
    .avail_min = 0,
@@ -226,18 +224,6 @@ static int audio_extn_cirrus_run_calibration() {
            goto exit;
        }

        property_get("vendor.audio.cirrus_spkr.cal.store_calib_data", value, "none");
        if (!strncmp("true", value, 4)) {
            store_calib_data = true;
            property_get("vendor.audio.cirrus_spkr.cal.atemp", value, "0");
            if(atoi(value) > 0)
                result.atemp = atoi(value);
            else
                result.atemp = CRUS_SP_DEFAULT_AMBIENT_TEMP;
        } else {
            result.atemp = CRUS_SP_DEFAULT_AMBIENT_TEMP;
        }

        if(store_calib_data) {
            cal_file = fopen(CRUS_CAL_FILE, "wb");
            if (!cal_file) {