From 528e70238d6c72dbdd1d889ed0849e5f891bfa52 Mon Sep 17 00:00:00 2001 From: Paul Reioux Date: Thu, 31 Jul 2014 18:58:55 -0500 Subject: [PATCH] Sound Control: separate locking mechanism for recording and playback with newer hardware revisions coming from Qualcomm, single register lock control isn't sufficient to cover both playback and recording usage scenarios bump to version 3.5 Signed-off-by: Paul Reioux Signed-off-by: flar2 --- sound/soc/codecs/sound_control_3_gpl.c | 32 +++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/sound_control_3_gpl.c b/sound/soc/codecs/sound_control_3_gpl.c index 8a6d8fa640b5..6dd363235706 100644 --- a/sound/soc/codecs/sound_control_3_gpl.c +++ b/sound/soc/codecs/sound_control_3_gpl.c @@ -23,7 +23,7 @@ #include #define SOUND_CONTROL_MAJOR_VERSION 3 -#define SOUND_CONTROL_MINOR_VERSION 4 +#define SOUND_CONTROL_MINOR_VERSION 5 #define REG_SZ 21 @@ -31,6 +31,7 @@ extern struct snd_soc_codec *fauxsound_codec_ptr; extern int wcd9xxx_hw_revision; static int snd_ctrl_locked = 0; +static int snd_rec_ctrl_locked = 0; unsigned int tabla_read(struct snd_soc_codec *codec, unsigned int reg); int tabla_write(struct snd_soc_codec *codec, unsigned int reg, @@ -134,7 +135,7 @@ 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 (snd_ctrl_locked > 1) + if (snd_rec_ctrl_locked > 1) ret = 0; break; case TABLA_A_CDC_RX1_VOL_CTL_B2_CTL: @@ -375,11 +376,29 @@ static ssize_t sound_control_locked_store(struct kobject *kobj, return count; } -static ssize_t sound_control_locked_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) +static ssize_t sound_control_locked_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) { return sprintf(buf, "%d\n", snd_ctrl_locked); } +static ssize_t sound_control_rec_locked_store(struct kobject *kobj, + struct kobj_attribute *attr, const char *buf, size_t count) +{ + int inp; + + sscanf(buf, "%d", &inp); + + snd_rec_ctrl_locked = inp; + + return count; +} + +static ssize_t sound_control_rec_locked_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) +{ + return sprintf(buf, "%d\n", snd_ctrl_locked); +} + static struct kobj_attribute sound_reg_sel_attribute = __ATTR(sound_reg_sel, 0222, @@ -434,6 +453,12 @@ static struct kobj_attribute sound_control_locked_attribute = sound_control_locked_show, sound_control_locked_store); +static struct kobj_attribute sound_control_rec_locked_attribute = + __ATTR(gpl_sound_control_rec_locked, + 0666, + sound_control_rec_locked_show, + sound_control_rec_locked_store); + static struct kobj_attribute sound_control_version_attribute = __ATTR(gpl_sound_control_version, 0444, @@ -452,6 +477,7 @@ static struct attribute *sound_control_attrs[] = &headphone_gain_attribute.attr, &headphone_pa_gain_attribute.attr, &sound_control_locked_attribute.attr, + &sound_control_rec_locked_attribute.attr, &sound_reg_sel_attribute.attr, &sound_reg_read_attribute.attr, &sound_reg_write_attribute.attr,