Sound Control: let register lock be dependent on different hw revisions

Signed-off-by: Paul Reioux <reioux@gmail.com>
Signed-off-by: flar2 <asegaert@gmail.com>
This commit is contained in:
Paul Reioux 2014-07-31 08:24:48 -05:00 committed by followmsi
parent 1129d314ff
commit 4c89a46f4b

View file

@ -37,7 +37,7 @@ int tabla_write(struct snd_soc_codec *codec, unsigned int reg,
unsigned int value);
static unsigned int cached_regs[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
static unsigned int cached_regs[] = {6, 6, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0 };
@ -134,9 +134,8 @@ int snd_hax_reg_access(unsigned int reg)
case TABLA_A_RX_HPH_R_GAIN:
case TABLA_A_RX_HPH_L_STATUS:
case TABLA_A_RX_HPH_R_STATUS:
if (wcd9xxx_hw_revision == 1)
if (snd_ctrl_locked)
ret = 0;
if (snd_ctrl_locked > 1)
ret = 0;
break;
case TABLA_A_CDC_RX1_VOL_CTL_B2_CTL:
case TABLA_A_CDC_RX2_VOL_CTL_B2_CTL:
@ -145,7 +144,7 @@ int snd_hax_reg_access(unsigned int reg)
case TABLA_A_CDC_RX5_VOL_CTL_B2_CTL:
case TABLA_A_CDC_RX6_VOL_CTL_B2_CTL:
case TABLA_A_CDC_RX7_VOL_CTL_B2_CTL:
if (snd_ctrl_locked)
if (snd_ctrl_locked > 0)
ret = 0;
break;
case TABLA_A_CDC_TX1_VOL_CTL_GAIN:
@ -158,7 +157,7 @@ int snd_hax_reg_access(unsigned int reg)
case TABLA_A_CDC_TX8_VOL_CTL_GAIN:
case TABLA_A_CDC_TX9_VOL_CTL_GAIN:
case TABLA_A_CDC_TX10_VOL_CTL_GAIN:
if (snd_ctrl_locked)
if (snd_ctrl_locked > 0)
ret = 0;
break;
default:
@ -300,22 +299,18 @@ static ssize_t headphone_pa_gain_store(struct kobject *kobj,
if (calc_checksum(lval, rval, chksum)) {
gain = tabla_read(fauxsound_codec_ptr, TABLA_A_RX_HPH_L_GAIN);
out = (gain & 0xf0) | lval;
if (wcd9xxx_hw_revision == 1)
tabla_write(fauxsound_codec_ptr, TABLA_A_RX_HPH_L_GAIN, out);
status = tabla_read(fauxsound_codec_ptr, TABLA_A_RX_HPH_L_STATUS);
out = (status & 0x0f) | (lval << 4);
if (wcd9xxx_hw_revision == 1)
tabla_write(fauxsound_codec_ptr, TABLA_A_RX_HPH_L_STATUS, out);
gain = tabla_read(fauxsound_codec_ptr, TABLA_A_RX_HPH_R_GAIN);
out = (gain & 0xf0) | rval;
if (wcd9xxx_hw_revision == 1)
tabla_write(fauxsound_codec_ptr, TABLA_A_RX_HPH_R_GAIN, out);
status = tabla_read(fauxsound_codec_ptr, TABLA_A_RX_HPH_R_STATUS);
out = (status & 0x0f) | (rval << 4);
if(wcd9xxx_hw_revision == 1)
tabla_write(fauxsound_codec_ptr, TABLA_A_RX_HPH_R_STATUS, out);
}
return count;
@ -375,10 +370,7 @@ static ssize_t sound_control_locked_store(struct kobject *kobj,
sscanf(buf, "%d", &inp);
if (inp == 0)
snd_ctrl_locked = 0;
else
snd_ctrl_locked = 1;
snd_ctrl_locked = inp;
return count;
}