mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 22:40:54 -04:00
DLKM:audio:tfa987x:modify send_calib_values as mono mode.
- sync vendor code. modify send_calib_values as mono mode. Change-Id: Idd94f77967ea4a94a569a6332ffc45242b36b625 Signed-off-by: liaohj <liaohj@lenovo.com> Reviewed-on: https://gerrit.mot.com/1226988 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Wanlong Zhou <zhouwl@motorola.com> Reviewed-by: Huosheng Liao <liaohs@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
c247ac524d
commit
37c9c3d8d7
1 changed files with 10 additions and 25 deletions
|
|
@ -2760,10 +2760,11 @@ static int tfa98xx_hw_params(struct snd_pcm_substream *substream,
|
|||
return 0;
|
||||
}
|
||||
|
||||
extern int send_tfa_cal_in_band(void *buf, int cmd_size);
|
||||
|
||||
#ifdef TFA9874_NONDSP_STEREO
|
||||
extern int send_tfa_cal_in_band(void *buf, int cmd_size);
|
||||
static uint8_t bytes[3*3+1] = {0};
|
||||
#define MONO_I2C_ADDR (0x34)
|
||||
#define IMPEDANCE_VALUE (4000) /*or 20000*/
|
||||
|
||||
enum Tfa98xx_Error tfa98xx_adsp_send_calib_values(struct tfa98xx *tfa98xx)
|
||||
{
|
||||
|
|
@ -2771,8 +2772,7 @@ enum Tfa98xx_Error tfa98xx_adsp_send_calib_values(struct tfa98xx *tfa98xx)
|
|||
struct tfa_device *tfa = tfa98xx->tfa;
|
||||
int value = 0, nr, dsp_cal_value = 0;
|
||||
|
||||
/* If calibration is set to once we load from MTP, else send zero's */
|
||||
if (TFA_GET_BF(tfa, MTPEX) == 1 && tfa98xx->i2c->addr == 0x34)
|
||||
if (TFA_GET_BF(tfa, MTPEX) == 1 && tfa98xx->i2c->addr == MONO_I2C_ADDR)
|
||||
{
|
||||
value = tfa_dev_mtp_get(tfa, TFA_MTP_RE25);
|
||||
dsp_cal_value = (value * 65536) / 1000;
|
||||
|
|
@ -2785,27 +2785,12 @@ enum Tfa98xx_Error tfa98xx_adsp_send_calib_values(struct tfa98xx *tfa98xx)
|
|||
|
||||
dev_err(&tfa98xx->i2c->dev, "%s: cal value 0x%x\n", __func__, dsp_cal_value);
|
||||
|
||||
/* Receiver RDC */
|
||||
if (value > 20000)
|
||||
bytes[0] |= 0x01;
|
||||
}
|
||||
|
||||
if (TFA_GET_BF(tfa, MTPEX) == 1 && tfa98xx->i2c->addr == 0x35)
|
||||
{
|
||||
value = tfa_dev_mtp_get(tfa, TFA_MTP_RE25);
|
||||
dsp_cal_value = (value * 65536) / 1000;
|
||||
|
||||
nr = 7;
|
||||
/* We have to copy it for both channels. Even when mono! */
|
||||
bytes[nr++] = (uint8_t)((dsp_cal_value >> 16) & 0xff);
|
||||
bytes[nr++] = (uint8_t)((dsp_cal_value >> 8) & 0xff);
|
||||
bytes[nr++] = (uint8_t)(dsp_cal_value & 0xff);
|
||||
|
||||
dev_err(&tfa98xx->i2c->dev, "%s: cal value 0x%x\n", __func__, dsp_cal_value);
|
||||
|
||||
/* Speaker RDC */
|
||||
if (value > 4000)
|
||||
bytes[0] |= 0x10;
|
||||
bytes[nr++] = bytes[4];
|
||||
bytes[nr++] = bytes[5];
|
||||
bytes[nr++] = bytes[6];
|
||||
/* RDC */
|
||||
if (value > IMPEDANCE_VALUE)
|
||||
bytes[0] |= 0x11;
|
||||
}
|
||||
|
||||
if (bytes[0] == 0x11)
|
||||
|
|
|
|||
Loading…
Reference in a new issue