mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
Sound Control: Misc clean up for newer WCD9xxx SOCs
Bump driver version to 3.4 Signed-off-by: Paul Reioux <reioux@gmail.com> Signed-off-by: flar2 <asegaert@gmail.com>
This commit is contained in:
parent
e03b62f35d
commit
1129d314ff
2 changed files with 35 additions and 2 deletions
|
@ -19,14 +19,16 @@
|
|||
#include <linux/kobject.h>
|
||||
#include <linux/sysfs.h>
|
||||
#include <linux/kallsyms.h>
|
||||
#include <linux/mfd/wcd9xxx/core.h>
|
||||
#include <linux/mfd/wcd9xxx/wcd9310_registers.h>
|
||||
|
||||
#define SOUND_CONTROL_MAJOR_VERSION 3
|
||||
#define SOUND_CONTROL_MINOR_VERSION 3
|
||||
#define SOUND_CONTROL_MINOR_VERSION 4
|
||||
|
||||
#define REG_SZ 21
|
||||
|
||||
extern struct snd_soc_codec *fauxsound_codec_ptr;
|
||||
extern int wcd9xxx_hw_revision;
|
||||
|
||||
static int snd_ctrl_locked = 0;
|
||||
|
||||
|
@ -35,7 +37,7 @@ int tabla_write(struct snd_soc_codec *codec, unsigned int reg,
|
|||
unsigned int value);
|
||||
|
||||
|
||||
static unsigned int cached_regs[] = {6, 6, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
static unsigned int cached_regs[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0 };
|
||||
|
||||
|
@ -132,6 +134,10 @@ 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;
|
||||
break;
|
||||
case TABLA_A_CDC_RX1_VOL_CTL_B2_CTL:
|
||||
case TABLA_A_CDC_RX2_VOL_CTL_B2_CTL:
|
||||
case TABLA_A_CDC_RX3_VOL_CTL_B2_CTL:
|
||||
|
@ -139,6 +145,9 @@ 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)
|
||||
ret = 0;
|
||||
break;
|
||||
case TABLA_A_CDC_TX1_VOL_CTL_GAIN:
|
||||
case TABLA_A_CDC_TX2_VOL_CTL_GAIN:
|
||||
case TABLA_A_CDC_TX3_VOL_CTL_GAIN:
|
||||
|
@ -291,18 +300,22 @@ 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;
|
||||
|
@ -341,6 +354,12 @@ static ssize_t sound_reg_write_store(struct kobject *kobj,
|
|||
return count;
|
||||
}
|
||||
|
||||
static ssize_t sound_control_hw_revision_show (struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *buf)
|
||||
{
|
||||
return sprintf(buf, "hw_revision: %i\n", wcd9xxx_hw_revision);
|
||||
}
|
||||
|
||||
static ssize_t sound_control_version_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *buf)
|
||||
{
|
||||
|
@ -428,6 +447,11 @@ static struct kobj_attribute sound_control_version_attribute =
|
|||
0444,
|
||||
sound_control_version_show, NULL);
|
||||
|
||||
static struct kobj_attribute sound_hw_revision_attribute =
|
||||
__ATTR(gpl_sound_control_hw_revision,
|
||||
0444,
|
||||
sound_control_hw_revision_show, NULL);
|
||||
|
||||
static struct attribute *sound_control_attrs[] =
|
||||
{
|
||||
&cam_mic_gain_attribute.attr,
|
||||
|
@ -439,6 +463,7 @@ static struct attribute *sound_control_attrs[] =
|
|||
&sound_reg_sel_attribute.attr,
|
||||
&sound_reg_read_attribute.attr,
|
||||
&sound_reg_write_attribute.attr,
|
||||
&sound_hw_revision_attribute.attr,
|
||||
&sound_control_version_attribute.attr,
|
||||
NULL,
|
||||
};
|
||||
|
|
|
@ -8448,6 +8448,8 @@ struct snd_kcontrol_new *gpl_faux_snd_controls_ptr =
|
|||
(struct snd_kcontrol_new *)tabla_snd_controls;
|
||||
struct snd_soc_codec *fauxsound_codec_ptr;
|
||||
EXPORT_SYMBOL(fauxsound_codec_ptr);
|
||||
int wcd9xxx_hw_revision;
|
||||
EXPORT_SYMBOL(wcd9xxx_hw_revision);
|
||||
#endif
|
||||
|
||||
static int tabla_codec_probe(struct snd_soc_codec *codec)
|
||||
|
@ -8467,6 +8469,12 @@ static int tabla_codec_probe(struct snd_soc_codec *codec)
|
|||
codec->control_data = dev_get_drvdata(codec->dev->parent);
|
||||
control = codec->control_data;
|
||||
|
||||
#ifdef CONFIG_SOUND_CONTROL_HAX_3_GPL
|
||||
if (TABLA_IS_2_0(control->version))
|
||||
wcd9xxx_hw_revision = 1;
|
||||
else
|
||||
wcd9xxx_hw_revision = 2;
|
||||
#endif
|
||||
tabla = kzalloc(sizeof(struct tabla_priv), GFP_KERNEL);
|
||||
|
||||
if (!tabla) {
|
||||
|
|
Loading…
Reference in a new issue