ASoC: codecs: rt*: rename to snd_soc_component_read()
We need to use snd_soc_component_read() instead of snd_soc_component_read32() This patch renames _read32() to _read() Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87d05z4mce.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
6d75dfc3e8
commit
467a2553dd
|
@ -508,7 +508,7 @@ static int rt298_adc_event(struct snd_soc_dapm_widget *w,
|
||||||
VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, nid, 0),
|
VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, nid, 0),
|
||||||
0x7080, 0x7000);
|
0x7080, 0x7000);
|
||||||
/* If MCLK doesn't exist, reset AD filter */
|
/* If MCLK doesn't exist, reset AD filter */
|
||||||
if (!(snd_soc_component_read32(component, RT298_VAD_CTRL) & 0x200)) {
|
if (!(snd_soc_component_read(component, RT298_VAD_CTRL) & 0x200)) {
|
||||||
pr_info("NO MCLK\n");
|
pr_info("NO MCLK\n");
|
||||||
switch (nid) {
|
switch (nid) {
|
||||||
case RT298_ADC_IN1:
|
case RT298_ADC_IN1:
|
||||||
|
|
|
@ -348,7 +348,7 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
val = snd_soc_component_read32(snd_soc_dapm_to_component(source->dapm), RT5616_GLB_CLK);
|
val = snd_soc_component_read(snd_soc_dapm_to_component(source->dapm), RT5616_GLB_CLK);
|
||||||
val &= RT5616_SCLK_SRC_MASK;
|
val &= RT5616_SCLK_SRC_MASK;
|
||||||
if (val == RT5616_SCLK_SRC_PLL1)
|
if (val == RT5616_SCLK_SRC_PLL1)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -83,7 +83,7 @@ static unsigned int rt5631_read_index(struct snd_soc_component *component,
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
|
|
||||||
snd_soc_component_write(component, RT5631_INDEX_ADD, reg);
|
snd_soc_component_write(component, RT5631_INDEX_ADD, reg);
|
||||||
value = snd_soc_component_read32(component, RT5631_INDEX_DATA);
|
value = snd_soc_component_read(component, RT5631_INDEX_DATA);
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@ -285,7 +285,7 @@ static int check_sysclk1_source(struct snd_soc_dapm_widget *source,
|
||||||
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
||||||
unsigned int reg;
|
unsigned int reg;
|
||||||
|
|
||||||
reg = snd_soc_component_read32(component, RT5631_GLOBAL_CLK_CTRL);
|
reg = snd_soc_component_read(component, RT5631_GLOBAL_CLK_CTRL);
|
||||||
return reg & RT5631_SYSCLK_SOUR_SEL_PLL;
|
return reg & RT5631_SYSCLK_SOUR_SEL_PLL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ static int check_dacl_to_outmixl(struct snd_soc_dapm_widget *source,
|
||||||
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
||||||
unsigned int reg;
|
unsigned int reg;
|
||||||
|
|
||||||
reg = snd_soc_component_read32(component, RT5631_OUTMIXER_L_CTRL);
|
reg = snd_soc_component_read(component, RT5631_OUTMIXER_L_CTRL);
|
||||||
return !(reg & RT5631_M_DAC_L_TO_OUTMIXER_L);
|
return !(reg & RT5631_M_DAC_L_TO_OUTMIXER_L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,7 +313,7 @@ static int check_dacr_to_outmixr(struct snd_soc_dapm_widget *source,
|
||||||
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
||||||
unsigned int reg;
|
unsigned int reg;
|
||||||
|
|
||||||
reg = snd_soc_component_read32(component, RT5631_OUTMIXER_R_CTRL);
|
reg = snd_soc_component_read(component, RT5631_OUTMIXER_R_CTRL);
|
||||||
return !(reg & RT5631_M_DAC_R_TO_OUTMIXER_R);
|
return !(reg & RT5631_M_DAC_R_TO_OUTMIXER_R);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ static int check_dacl_to_spkmixl(struct snd_soc_dapm_widget *source,
|
||||||
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
||||||
unsigned int reg;
|
unsigned int reg;
|
||||||
|
|
||||||
reg = snd_soc_component_read32(component, RT5631_SPK_MIXER_CTRL);
|
reg = snd_soc_component_read(component, RT5631_SPK_MIXER_CTRL);
|
||||||
return !(reg & RT5631_M_DAC_L_TO_SPKMIXER_L);
|
return !(reg & RT5631_M_DAC_L_TO_SPKMIXER_L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ static int check_dacr_to_spkmixr(struct snd_soc_dapm_widget *source,
|
||||||
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
||||||
unsigned int reg;
|
unsigned int reg;
|
||||||
|
|
||||||
reg = snd_soc_component_read32(component, RT5631_SPK_MIXER_CTRL);
|
reg = snd_soc_component_read(component, RT5631_SPK_MIXER_CTRL);
|
||||||
return !(reg & RT5631_M_DAC_R_TO_SPKMIXER_R);
|
return !(reg & RT5631_M_DAC_R_TO_SPKMIXER_R);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ static int check_adcl_select(struct snd_soc_dapm_widget *source,
|
||||||
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
||||||
unsigned int reg;
|
unsigned int reg;
|
||||||
|
|
||||||
reg = snd_soc_component_read32(component, RT5631_ADC_REC_MIXER);
|
reg = snd_soc_component_read(component, RT5631_ADC_REC_MIXER);
|
||||||
return !(reg & RT5631_M_MIC1_TO_RECMIXER_L);
|
return !(reg & RT5631_M_MIC1_TO_RECMIXER_L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ static int check_adcr_select(struct snd_soc_dapm_widget *source,
|
||||||
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
||||||
unsigned int reg;
|
unsigned int reg;
|
||||||
|
|
||||||
reg = snd_soc_component_read32(component, RT5631_ADC_REC_MIXER);
|
reg = snd_soc_component_read(component, RT5631_ADC_REC_MIXER);
|
||||||
return !(reg & RT5631_M_MIC2_TO_RECMIXER_R);
|
return !(reg & RT5631_M_MIC2_TO_RECMIXER_R);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,9 +372,9 @@ static void onebit_depop_power_stage(struct snd_soc_component *component, int en
|
||||||
RT5631_EN_ONE_BIT_DEPOP, 0);
|
RT5631_EN_ONE_BIT_DEPOP, 0);
|
||||||
|
|
||||||
/* keep soft volume and zero crossing setting */
|
/* keep soft volume and zero crossing setting */
|
||||||
soft_vol = snd_soc_component_read32(component, RT5631_SOFT_VOL_CTRL);
|
soft_vol = snd_soc_component_read(component, RT5631_SOFT_VOL_CTRL);
|
||||||
snd_soc_component_write(component, RT5631_SOFT_VOL_CTRL, 0);
|
snd_soc_component_write(component, RT5631_SOFT_VOL_CTRL, 0);
|
||||||
hp_zc = snd_soc_component_read32(component, RT5631_INT_ST_IRQ_CTRL_2);
|
hp_zc = snd_soc_component_read(component, RT5631_INT_ST_IRQ_CTRL_2);
|
||||||
snd_soc_component_write(component, RT5631_INT_ST_IRQ_CTRL_2, hp_zc & 0xf7ff);
|
snd_soc_component_write(component, RT5631_INT_ST_IRQ_CTRL_2, hp_zc & 0xf7ff);
|
||||||
if (enable) {
|
if (enable) {
|
||||||
/* config one-bit depop parameter */
|
/* config one-bit depop parameter */
|
||||||
|
@ -410,9 +410,9 @@ static void onebit_depop_mute_stage(struct snd_soc_component *component, int ena
|
||||||
RT5631_EN_ONE_BIT_DEPOP, 0);
|
RT5631_EN_ONE_BIT_DEPOP, 0);
|
||||||
|
|
||||||
/* keep soft volume and zero crossing setting */
|
/* keep soft volume and zero crossing setting */
|
||||||
soft_vol = snd_soc_component_read32(component, RT5631_SOFT_VOL_CTRL);
|
soft_vol = snd_soc_component_read(component, RT5631_SOFT_VOL_CTRL);
|
||||||
snd_soc_component_write(component, RT5631_SOFT_VOL_CTRL, 0);
|
snd_soc_component_write(component, RT5631_SOFT_VOL_CTRL, 0);
|
||||||
hp_zc = snd_soc_component_read32(component, RT5631_INT_ST_IRQ_CTRL_2);
|
hp_zc = snd_soc_component_read(component, RT5631_INT_ST_IRQ_CTRL_2);
|
||||||
snd_soc_component_write(component, RT5631_INT_ST_IRQ_CTRL_2, hp_zc & 0xf7ff);
|
snd_soc_component_write(component, RT5631_INT_ST_IRQ_CTRL_2, hp_zc & 0xf7ff);
|
||||||
if (enable) {
|
if (enable) {
|
||||||
schedule_timeout_uninterruptible(msecs_to_jiffies(10));
|
schedule_timeout_uninterruptible(msecs_to_jiffies(10));
|
||||||
|
@ -448,9 +448,9 @@ static void depop_seq_power_stage(struct snd_soc_component *component, int enabl
|
||||||
RT5631_EN_ONE_BIT_DEPOP, RT5631_EN_ONE_BIT_DEPOP);
|
RT5631_EN_ONE_BIT_DEPOP, RT5631_EN_ONE_BIT_DEPOP);
|
||||||
|
|
||||||
/* keep soft volume and zero crossing setting */
|
/* keep soft volume and zero crossing setting */
|
||||||
soft_vol = snd_soc_component_read32(component, RT5631_SOFT_VOL_CTRL);
|
soft_vol = snd_soc_component_read(component, RT5631_SOFT_VOL_CTRL);
|
||||||
snd_soc_component_write(component, RT5631_SOFT_VOL_CTRL, 0);
|
snd_soc_component_write(component, RT5631_SOFT_VOL_CTRL, 0);
|
||||||
hp_zc = snd_soc_component_read32(component, RT5631_INT_ST_IRQ_CTRL_2);
|
hp_zc = snd_soc_component_read(component, RT5631_INT_ST_IRQ_CTRL_2);
|
||||||
snd_soc_component_write(component, RT5631_INT_ST_IRQ_CTRL_2, hp_zc & 0xf7ff);
|
snd_soc_component_write(component, RT5631_INT_ST_IRQ_CTRL_2, hp_zc & 0xf7ff);
|
||||||
if (enable) {
|
if (enable) {
|
||||||
/* config depop sequence parameter */
|
/* config depop sequence parameter */
|
||||||
|
@ -520,9 +520,9 @@ static void depop_seq_mute_stage(struct snd_soc_component *component, int enable
|
||||||
RT5631_EN_ONE_BIT_DEPOP, RT5631_EN_ONE_BIT_DEPOP);
|
RT5631_EN_ONE_BIT_DEPOP, RT5631_EN_ONE_BIT_DEPOP);
|
||||||
|
|
||||||
/* keep soft volume and zero crossing setting */
|
/* keep soft volume and zero crossing setting */
|
||||||
soft_vol = snd_soc_component_read32(component, RT5631_SOFT_VOL_CTRL);
|
soft_vol = snd_soc_component_read(component, RT5631_SOFT_VOL_CTRL);
|
||||||
snd_soc_component_write(component, RT5631_SOFT_VOL_CTRL, 0);
|
snd_soc_component_write(component, RT5631_SOFT_VOL_CTRL, 0);
|
||||||
hp_zc = snd_soc_component_read32(component, RT5631_INT_ST_IRQ_CTRL_2);
|
hp_zc = snd_soc_component_read(component, RT5631_INT_ST_IRQ_CTRL_2);
|
||||||
snd_soc_component_write(component, RT5631_INT_ST_IRQ_CTRL_2, hp_zc & 0xf7ff);
|
snd_soc_component_write(component, RT5631_INT_ST_IRQ_CTRL_2, hp_zc & 0xf7ff);
|
||||||
if (enable) {
|
if (enable) {
|
||||||
schedule_timeout_uninterruptible(msecs_to_jiffies(10));
|
schedule_timeout_uninterruptible(msecs_to_jiffies(10));
|
||||||
|
|
|
@ -1651,7 +1651,7 @@ static int get_sdp_info(struct snd_soc_component *component, int dai_id)
|
||||||
if (component == NULL)
|
if (component == NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5640_I2S1_SDP);
|
val = snd_soc_component_read(component, RT5640_I2S1_SDP);
|
||||||
val = (val & RT5640_I2S_IF_MASK) >> RT5640_I2S_IF_SFT;
|
val = (val & RT5640_I2S_IF_MASK) >> RT5640_I2S_IF_SFT;
|
||||||
switch (dai_id) {
|
switch (dai_id) {
|
||||||
case RT5640_AIF1:
|
case RT5640_AIF1:
|
||||||
|
@ -2081,7 +2081,7 @@ int rt5640_sel_asrc_clk_src(struct snd_soc_component *component,
|
||||||
snd_soc_component_update_bits(component, RT5640_ASRC_2,
|
snd_soc_component_update_bits(component, RT5640_ASRC_2,
|
||||||
asrc2_mask, asrc2_value);
|
asrc2_mask, asrc2_value);
|
||||||
|
|
||||||
if (snd_soc_component_read32(component, RT5640_ASRC_2)) {
|
if (snd_soc_component_read(component, RT5640_ASRC_2)) {
|
||||||
rt5640->asrc_en = true;
|
rt5640->asrc_en = true;
|
||||||
snd_soc_component_update_bits(component, RT5640_JD_CTRL, 0x3, 0x3);
|
snd_soc_component_update_bits(component, RT5640_JD_CTRL, 0x3, 0x3);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2146,7 +2146,7 @@ static bool rt5640_micbias1_ovcd(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5640_IRQ_CTRL2);
|
val = snd_soc_component_read(component, RT5640_IRQ_CTRL2);
|
||||||
dev_dbg(component->dev, "irq ctrl2 %#04x\n", val);
|
dev_dbg(component->dev, "irq ctrl2 %#04x\n", val);
|
||||||
|
|
||||||
return (val & RT5640_MB1_OC_STATUS);
|
return (val & RT5640_MB1_OC_STATUS);
|
||||||
|
@ -2157,7 +2157,7 @@ static bool rt5640_jack_inserted(struct snd_soc_component *component)
|
||||||
struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
|
struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component);
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5640_INT_IRQ_ST);
|
val = snd_soc_component_read(component, RT5640_INT_IRQ_ST);
|
||||||
dev_dbg(component->dev, "irq status %#04x\n", val);
|
dev_dbg(component->dev, "irq status %#04x\n", val);
|
||||||
|
|
||||||
if (rt5640->jd_inverted)
|
if (rt5640->jd_inverted)
|
||||||
|
@ -2484,7 +2484,7 @@ static int rt5640_probe(struct snd_soc_component *component)
|
||||||
snd_soc_component_update_bits(component, RT5640_MICBIAS, 0x0030, 0x0030);
|
snd_soc_component_update_bits(component, RT5640_MICBIAS, 0x0030, 0x0030);
|
||||||
snd_soc_component_update_bits(component, RT5640_DSP_PATH2, 0xfc00, 0x0c00);
|
snd_soc_component_update_bits(component, RT5640_DSP_PATH2, 0xfc00, 0x0c00);
|
||||||
|
|
||||||
switch (snd_soc_component_read32(component, RT5640_RESET) & RT5640_ID_MASK) {
|
switch (snd_soc_component_read(component, RT5640_RESET) & RT5640_ID_MASK) {
|
||||||
case RT5640_ID_5640:
|
case RT5640_ID_5640:
|
||||||
case RT5640_ID_5642:
|
case RT5640_ID_5642:
|
||||||
snd_soc_add_component_controls(component,
|
snd_soc_add_component_controls(component,
|
||||||
|
|
|
@ -866,7 +866,7 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
|
||||||
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5645_GLB_CLK);
|
val = snd_soc_component_read(component, RT5645_GLB_CLK);
|
||||||
val &= RT5645_SCLK_SRC_MASK;
|
val &= RT5645_SCLK_SRC_MASK;
|
||||||
if (val == RT5645_SCLK_SRC_PLL1)
|
if (val == RT5645_SCLK_SRC_PLL1)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -909,7 +909,7 @@ static int is_using_asrc(struct snd_soc_dapm_widget *source,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = (snd_soc_component_read32(component, reg) >> shift) & 0xf;
|
val = (snd_soc_component_read(component, reg) >> shift) & 0xf;
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -3121,9 +3121,9 @@ static void rt5645_enable_push_button_irq(struct snd_soc_component *component,
|
||||||
RT5645_INT_IRQ_ST, 0x8, 0x8);
|
RT5645_INT_IRQ_ST, 0x8, 0x8);
|
||||||
snd_soc_component_update_bits(component,
|
snd_soc_component_update_bits(component,
|
||||||
RT5650_4BTN_IL_CMD2, 0x8000, 0x8000);
|
RT5650_4BTN_IL_CMD2, 0x8000, 0x8000);
|
||||||
snd_soc_component_read32(component, RT5650_4BTN_IL_CMD1);
|
snd_soc_component_read(component, RT5650_4BTN_IL_CMD1);
|
||||||
pr_debug("%s read %x = %x\n", __func__, RT5650_4BTN_IL_CMD1,
|
pr_debug("%s read %x = %x\n", __func__, RT5650_4BTN_IL_CMD1,
|
||||||
snd_soc_component_read32(component, RT5650_4BTN_IL_CMD1));
|
snd_soc_component_read(component, RT5650_4BTN_IL_CMD1));
|
||||||
} else {
|
} else {
|
||||||
snd_soc_component_update_bits(component, RT5650_4BTN_IL_CMD2, 0x8000, 0x0);
|
snd_soc_component_update_bits(component, RT5650_4BTN_IL_CMD2, 0x8000, 0x0);
|
||||||
snd_soc_component_update_bits(component, RT5645_INT_IRQ_ST, 0x8, 0x0);
|
snd_soc_component_update_bits(component, RT5645_INT_IRQ_ST, 0x8, 0x0);
|
||||||
|
@ -3216,7 +3216,7 @@ static int rt5645_button_detect(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
int btn_type, val;
|
int btn_type, val;
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5650_4BTN_IL_CMD1);
|
val = snd_soc_component_read(component, RT5650_4BTN_IL_CMD1);
|
||||||
pr_debug("val=0x%x\n", val);
|
pr_debug("val=0x%x\n", val);
|
||||||
btn_type = val & 0xfff0;
|
btn_type = val & 0xfff0;
|
||||||
snd_soc_component_write(component, RT5650_4BTN_IL_CMD1, val);
|
snd_soc_component_write(component, RT5650_4BTN_IL_CMD1, val);
|
||||||
|
@ -3271,10 +3271,10 @@ static void rt5645_jack_detect_work(struct work_struct *work)
|
||||||
report, SND_JACK_MICROPHONE);
|
report, SND_JACK_MICROPHONE);
|
||||||
return;
|
return;
|
||||||
case 4:
|
case 4:
|
||||||
val = snd_soc_component_read32(rt5645->component, RT5645_A_JD_CTRL1) & 0x0020;
|
val = snd_soc_component_read(rt5645->component, RT5645_A_JD_CTRL1) & 0x0020;
|
||||||
break;
|
break;
|
||||||
default: /* read rt5645 jd1_1 status */
|
default: /* read rt5645 jd1_1 status */
|
||||||
val = snd_soc_component_read32(rt5645->component, RT5645_INT_IRQ_ST) & 0x1000;
|
val = snd_soc_component_read(rt5645->component, RT5645_INT_IRQ_ST) & 0x1000;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3284,7 +3284,7 @@ static void rt5645_jack_detect_work(struct work_struct *work)
|
||||||
} else if (!val && rt5645->jack_type != 0) {
|
} else if (!val && rt5645->jack_type != 0) {
|
||||||
/* for push button and jack out */
|
/* for push button and jack out */
|
||||||
btn_type = 0;
|
btn_type = 0;
|
||||||
if (snd_soc_component_read32(rt5645->component, RT5645_INT_IRQ_ST) & 0x4) {
|
if (snd_soc_component_read(rt5645->component, RT5645_INT_IRQ_ST) & 0x4) {
|
||||||
/* button pressed */
|
/* button pressed */
|
||||||
report = SND_JACK_HEADSET;
|
report = SND_JACK_HEADSET;
|
||||||
btn_type = rt5645_button_detect(rt5645->component);
|
btn_type = rt5645_button_detect(rt5645->component);
|
||||||
|
|
|
@ -1514,7 +1514,7 @@ static int rt5651_set_bias_level(struct snd_soc_component *component,
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case SND_SOC_BIAS_PREPARE:
|
case SND_SOC_BIAS_PREPARE:
|
||||||
if (SND_SOC_BIAS_STANDBY == snd_soc_component_get_bias_level(component)) {
|
if (SND_SOC_BIAS_STANDBY == snd_soc_component_get_bias_level(component)) {
|
||||||
if (snd_soc_component_read32(component, RT5651_PLL_MODE_1) & 0x9200)
|
if (snd_soc_component_read(component, RT5651_PLL_MODE_1) & 0x9200)
|
||||||
snd_soc_component_update_bits(component, RT5651_D_MISC,
|
snd_soc_component_update_bits(component, RT5651_D_MISC,
|
||||||
0xc00, 0xc00);
|
0xc00, 0xc00);
|
||||||
}
|
}
|
||||||
|
@ -1608,7 +1608,7 @@ static bool rt5651_micbias1_ovcd(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5651_IRQ_CTRL2);
|
val = snd_soc_component_read(component, RT5651_IRQ_CTRL2);
|
||||||
dev_dbg(component->dev, "irq ctrl2 %#04x\n", val);
|
dev_dbg(component->dev, "irq ctrl2 %#04x\n", val);
|
||||||
|
|
||||||
return (val & RT5651_MB1_OC_CLR);
|
return (val & RT5651_MB1_OC_CLR);
|
||||||
|
@ -1625,7 +1625,7 @@ static bool rt5651_jack_inserted(struct snd_soc_component *component)
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5651_INT_IRQ_ST);
|
val = snd_soc_component_read(component, RT5651_INT_IRQ_ST);
|
||||||
dev_dbg(component->dev, "irq status %#04x\n", val);
|
dev_dbg(component->dev, "irq status %#04x\n", val);
|
||||||
|
|
||||||
switch (rt5651->jd_src) {
|
switch (rt5651->jd_src) {
|
||||||
|
|
|
@ -1238,7 +1238,7 @@ static int rt5659_hp_vol_put(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||||
int ret = snd_soc_put_volsw(kcontrol, ucontrol);
|
int ret = snd_soc_put_volsw(kcontrol, ucontrol);
|
||||||
|
|
||||||
if (snd_soc_component_read32(component, RT5659_STO_NG2_CTRL_1) & RT5659_NG2_EN) {
|
if (snd_soc_component_read(component, RT5659_STO_NG2_CTRL_1) & RT5659_NG2_EN) {
|
||||||
snd_soc_component_update_bits(component, RT5659_STO_NG2_CTRL_1,
|
snd_soc_component_update_bits(component, RT5659_STO_NG2_CTRL_1,
|
||||||
RT5659_NG2_EN_MASK, RT5659_NG2_DIS);
|
RT5659_NG2_EN_MASK, RT5659_NG2_DIS);
|
||||||
snd_soc_component_update_bits(component, RT5659_STO_NG2_CTRL_1,
|
snd_soc_component_update_bits(component, RT5659_STO_NG2_CTRL_1,
|
||||||
|
@ -1305,7 +1305,7 @@ static int rt5659_headset_detect(struct snd_soc_component *component, int jack_i
|
||||||
snd_soc_dapm_force_enable_pin(dapm,
|
snd_soc_dapm_force_enable_pin(dapm,
|
||||||
"Mic Det Power");
|
"Mic Det Power");
|
||||||
snd_soc_dapm_sync(dapm);
|
snd_soc_dapm_sync(dapm);
|
||||||
reg_63 = snd_soc_component_read32(component, RT5659_PWR_ANLG_1);
|
reg_63 = snd_soc_component_read(component, RT5659_PWR_ANLG_1);
|
||||||
|
|
||||||
snd_soc_component_update_bits(component, RT5659_PWR_ANLG_1,
|
snd_soc_component_update_bits(component, RT5659_PWR_ANLG_1,
|
||||||
RT5659_PWR_VREF2 | RT5659_PWR_MB,
|
RT5659_PWR_VREF2 | RT5659_PWR_MB,
|
||||||
|
@ -1323,7 +1323,7 @@ static int rt5659_headset_detect(struct snd_soc_component *component, int jack_i
|
||||||
|
|
||||||
while (i < 5) {
|
while (i < 5) {
|
||||||
msleep(sleep_time[i]);
|
msleep(sleep_time[i]);
|
||||||
val = snd_soc_component_read32(component, RT5659_EJD_CTRL_2) & 0x0003;
|
val = snd_soc_component_read(component, RT5659_EJD_CTRL_2) & 0x0003;
|
||||||
i++;
|
i++;
|
||||||
if (val == 0x1 || val == 0x2 || val == 0x3)
|
if (val == 0x1 || val == 0x2 || val == 0x3)
|
||||||
break;
|
break;
|
||||||
|
@ -1357,7 +1357,7 @@ static int rt5659_button_detect(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
int btn_type, val;
|
int btn_type, val;
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5659_4BTN_IL_CMD_1);
|
val = snd_soc_component_read(component, RT5659_4BTN_IL_CMD_1);
|
||||||
btn_type = val & 0xfff0;
|
btn_type = val & 0xfff0;
|
||||||
snd_soc_component_write(component, RT5659_4BTN_IL_CMD_1, val);
|
snd_soc_component_write(component, RT5659_4BTN_IL_CMD_1, val);
|
||||||
|
|
||||||
|
@ -1396,7 +1396,7 @@ static void rt5659_jack_detect_work(struct work_struct *work)
|
||||||
if (!rt5659->component)
|
if (!rt5659->component)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
val = snd_soc_component_read32(rt5659->component, RT5659_INT_ST_1) & 0x0080;
|
val = snd_soc_component_read(rt5659->component, RT5659_INT_ST_1) & 0x0080;
|
||||||
if (!val) {
|
if (!val) {
|
||||||
/* jack in */
|
/* jack in */
|
||||||
if (rt5659->jack_type == 0) {
|
if (rt5659->jack_type == 0) {
|
||||||
|
@ -1696,7 +1696,7 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *w,
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5659_GLB_CLK);
|
val = snd_soc_component_read(component, RT5659_GLB_CLK);
|
||||||
val &= RT5659_SCLK_SRC_MASK;
|
val &= RT5659_SCLK_SRC_MASK;
|
||||||
if (val == RT5659_SCLK_SRC_PLL1)
|
if (val == RT5659_SCLK_SRC_PLL1)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1739,7 +1739,7 @@ static int is_using_asrc(struct snd_soc_dapm_widget *w,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = (snd_soc_component_read32(component, reg) >> shift) & 0xf;
|
val = (snd_soc_component_read(component, reg) >> shift) & 0xf;
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
|
|
|
@ -373,7 +373,7 @@ static int rt5660_is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
|
||||||
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5660_GLB_CLK);
|
val = snd_soc_component_read(component, RT5660_GLB_CLK);
|
||||||
val &= RT5660_SCLK_SRC_MASK;
|
val &= RT5660_SCLK_SRC_MASK;
|
||||||
if (val == RT5660_SCLK_SRC_PLL1)
|
if (val == RT5660_SCLK_SRC_PLL1)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -1482,7 +1482,7 @@ static int rt5663_v2_jack_detect(struct snd_soc_component *component, int jack_i
|
||||||
|
|
||||||
while (i < 5) {
|
while (i < 5) {
|
||||||
msleep(sleep_time[i]);
|
msleep(sleep_time[i]);
|
||||||
val = snd_soc_component_read32(component, RT5663_CBJ_TYPE_2) & 0x0003;
|
val = snd_soc_component_read(component, RT5663_CBJ_TYPE_2) & 0x0003;
|
||||||
if (val == 0x1 || val == 0x2 || val == 0x3)
|
if (val == 0x1 || val == 0x2 || val == 0x3)
|
||||||
break;
|
break;
|
||||||
dev_dbg(component->dev, "%s: MX-0011 val=%x sleep %d\n",
|
dev_dbg(component->dev, "%s: MX-0011 val=%x sleep %d\n",
|
||||||
|
@ -1595,7 +1595,7 @@ static int rt5663_jack_detect(struct snd_soc_component *component, int jack_inse
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5663_EM_JACK_TYPE_2) & 0x0003;
|
val = snd_soc_component_read(component, RT5663_EM_JACK_TYPE_2) & 0x0003;
|
||||||
dev_dbg(component->dev, "%s val = %d\n", __func__, val);
|
dev_dbg(component->dev, "%s val = %d\n", __func__, val);
|
||||||
|
|
||||||
snd_soc_component_update_bits(component, RT5663_HP_CHARGE_PUMP_1,
|
snd_soc_component_update_bits(component, RT5663_HP_CHARGE_PUMP_1,
|
||||||
|
@ -1698,12 +1698,12 @@ static int rt5663_impedance_sensing(struct snd_soc_component *component)
|
||||||
rt5663->imp_table[i].dc_offset_r_manual & 0xffff);
|
rt5663->imp_table[i].dc_offset_r_manual & 0xffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
reg84 = snd_soc_component_read32(component, RT5663_ASRC_2);
|
reg84 = snd_soc_component_read(component, RT5663_ASRC_2);
|
||||||
reg26 = snd_soc_component_read32(component, RT5663_STO1_ADC_MIXER);
|
reg26 = snd_soc_component_read(component, RT5663_STO1_ADC_MIXER);
|
||||||
reg2fa = snd_soc_component_read32(component, RT5663_DUMMY_1);
|
reg2fa = snd_soc_component_read(component, RT5663_DUMMY_1);
|
||||||
reg91 = snd_soc_component_read32(component, RT5663_HP_CHARGE_PUMP_1);
|
reg91 = snd_soc_component_read(component, RT5663_HP_CHARGE_PUMP_1);
|
||||||
reg10 = snd_soc_component_read32(component, RT5663_RECMIX);
|
reg10 = snd_soc_component_read(component, RT5663_RECMIX);
|
||||||
reg80 = snd_soc_component_read32(component, RT5663_GLB_CLK);
|
reg80 = snd_soc_component_read(component, RT5663_GLB_CLK);
|
||||||
|
|
||||||
snd_soc_component_update_bits(component, RT5663_STO_DRE_1, 0x8000, 0);
|
snd_soc_component_update_bits(component, RT5663_STO_DRE_1, 0x8000, 0);
|
||||||
snd_soc_component_write(component, RT5663_ASRC_2, 0);
|
snd_soc_component_write(component, RT5663_ASRC_2, 0);
|
||||||
|
@ -1768,11 +1768,11 @@ static int rt5663_impedance_sensing(struct snd_soc_component *component)
|
||||||
|
|
||||||
for (i = 0; i < 100; i++) {
|
for (i = 0; i < 100; i++) {
|
||||||
msleep(20);
|
msleep(20);
|
||||||
if (snd_soc_component_read32(component, RT5663_INT_ST_1) & 0x2)
|
if (snd_soc_component_read(component, RT5663_INT_ST_1) & 0x2)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
value = snd_soc_component_read32(component, RT5663_HP_IMP_SEN_4);
|
value = snd_soc_component_read(component, RT5663_HP_IMP_SEN_4);
|
||||||
|
|
||||||
snd_soc_component_update_bits(component, RT5663_DEPOP_1, 0x3000, 0);
|
snd_soc_component_update_bits(component, RT5663_DEPOP_1, 0x3000, 0);
|
||||||
snd_soc_component_write(component, RT5663_INT_ST_1, 0);
|
snd_soc_component_write(component, RT5663_INT_ST_1, 0);
|
||||||
|
@ -1843,7 +1843,7 @@ static int rt5663_button_detect(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
int btn_type, val;
|
int btn_type, val;
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5663_IL_CMD_5);
|
val = snd_soc_component_read(component, RT5663_IL_CMD_5);
|
||||||
dev_dbg(component->dev, "%s: val=0x%x\n", __func__, val);
|
dev_dbg(component->dev, "%s: val=0x%x\n", __func__, val);
|
||||||
btn_type = val & 0xfff0;
|
btn_type = val & 0xfff0;
|
||||||
snd_soc_component_write(component, RT5663_IL_CMD_5, val);
|
snd_soc_component_write(component, RT5663_IL_CMD_5, val);
|
||||||
|
@ -1879,7 +1879,7 @@ static int rt5663_set_jack_detect(struct snd_soc_component *component,
|
||||||
static bool rt5663_check_jd_status(struct snd_soc_component *component)
|
static bool rt5663_check_jd_status(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
struct rt5663_priv *rt5663 = snd_soc_component_get_drvdata(component);
|
struct rt5663_priv *rt5663 = snd_soc_component_get_drvdata(component);
|
||||||
int val = snd_soc_component_read32(component, RT5663_INT_ST_1);
|
int val = snd_soc_component_read(component, RT5663_INT_ST_1);
|
||||||
|
|
||||||
dev_dbg(component->dev, "%s val=%x\n", __func__, val);
|
dev_dbg(component->dev, "%s val=%x\n", __func__, val);
|
||||||
|
|
||||||
|
@ -2072,7 +2072,7 @@ static int rt5663_is_sys_clk_from_pll(struct snd_soc_dapm_widget *w,
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5663_GLB_CLK);
|
val = snd_soc_component_read(component, RT5663_GLB_CLK);
|
||||||
val &= RT5663_SCLK_SRC_MASK;
|
val &= RT5663_SCLK_SRC_MASK;
|
||||||
if (val == RT5663_SCLK_SRC_PLL1)
|
if (val == RT5663_SCLK_SRC_PLL1)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -2115,7 +2115,7 @@ static int rt5663_is_using_asrc(struct snd_soc_dapm_widget *w,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val = (snd_soc_component_read32(component, reg) >> shift) & 0x7;
|
val = (snd_soc_component_read(component, reg) >> shift) & 0x7;
|
||||||
|
|
||||||
if (val)
|
if (val)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -2130,15 +2130,15 @@ static int rt5663_i2s_use_asrc(struct snd_soc_dapm_widget *source,
|
||||||
struct rt5663_priv *rt5663 = snd_soc_component_get_drvdata(component);
|
struct rt5663_priv *rt5663 = snd_soc_component_get_drvdata(component);
|
||||||
int da_asrc_en, ad_asrc_en;
|
int da_asrc_en, ad_asrc_en;
|
||||||
|
|
||||||
da_asrc_en = (snd_soc_component_read32(component, RT5663_ASRC_2) &
|
da_asrc_en = (snd_soc_component_read(component, RT5663_ASRC_2) &
|
||||||
RT5663_DA_STO1_TRACK_MASK) ? 1 : 0;
|
RT5663_DA_STO1_TRACK_MASK) ? 1 : 0;
|
||||||
switch (rt5663->codec_ver) {
|
switch (rt5663->codec_ver) {
|
||||||
case CODEC_VER_1:
|
case CODEC_VER_1:
|
||||||
ad_asrc_en = (snd_soc_component_read32(component, RT5663_ASRC_3) &
|
ad_asrc_en = (snd_soc_component_read(component, RT5663_ASRC_3) &
|
||||||
RT5663_V2_AD_STO1_TRACK_MASK) ? 1 : 0;
|
RT5663_V2_AD_STO1_TRACK_MASK) ? 1 : 0;
|
||||||
break;
|
break;
|
||||||
case CODEC_VER_0:
|
case CODEC_VER_0:
|
||||||
ad_asrc_en = (snd_soc_component_read32(component, RT5663_ASRC_2) &
|
ad_asrc_en = (snd_soc_component_read(component, RT5663_ASRC_2) &
|
||||||
RT5663_AD_STO1_TRACK_MASK) ? 1 : 0;
|
RT5663_AD_STO1_TRACK_MASK) ? 1 : 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1000,7 +1000,7 @@ static int rt5665_hp_vol_put(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||||
int ret = snd_soc_put_volsw(kcontrol, ucontrol);
|
int ret = snd_soc_put_volsw(kcontrol, ucontrol);
|
||||||
|
|
||||||
if (snd_soc_component_read32(component, RT5665_STO_NG2_CTRL_1) & RT5665_NG2_EN) {
|
if (snd_soc_component_read(component, RT5665_STO_NG2_CTRL_1) & RT5665_NG2_EN) {
|
||||||
snd_soc_component_update_bits(component, RT5665_STO_NG2_CTRL_1,
|
snd_soc_component_update_bits(component, RT5665_STO_NG2_CTRL_1,
|
||||||
RT5665_NG2_EN_MASK, RT5665_NG2_DIS);
|
RT5665_NG2_EN_MASK, RT5665_NG2_DIS);
|
||||||
snd_soc_component_update_bits(component, RT5665_STO_NG2_CTRL_1,
|
snd_soc_component_update_bits(component, RT5665_STO_NG2_CTRL_1,
|
||||||
|
@ -1016,7 +1016,7 @@ static int rt5665_mono_vol_put(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||||
int ret = snd_soc_put_volsw(kcontrol, ucontrol);
|
int ret = snd_soc_put_volsw(kcontrol, ucontrol);
|
||||||
|
|
||||||
if (snd_soc_component_read32(component, RT5665_MONO_NG2_CTRL_1) & RT5665_NG2_EN) {
|
if (snd_soc_component_read(component, RT5665_MONO_NG2_CTRL_1) & RT5665_NG2_EN) {
|
||||||
snd_soc_component_update_bits(component, RT5665_MONO_NG2_CTRL_1,
|
snd_soc_component_update_bits(component, RT5665_MONO_NG2_CTRL_1,
|
||||||
RT5665_NG2_EN_MASK, RT5665_NG2_DIS);
|
RT5665_NG2_EN_MASK, RT5665_NG2_DIS);
|
||||||
snd_soc_component_update_bits(component, RT5665_MONO_NG2_CTRL_1,
|
snd_soc_component_update_bits(component, RT5665_MONO_NG2_CTRL_1,
|
||||||
|
@ -1126,7 +1126,7 @@ static int rt5665_button_detect(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
int btn_type, val;
|
int btn_type, val;
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5665_4BTN_IL_CMD_1);
|
val = snd_soc_component_read(component, RT5665_4BTN_IL_CMD_1);
|
||||||
btn_type = val & 0xfff0;
|
btn_type = val & 0xfff0;
|
||||||
snd_soc_component_write(component, RT5665_4BTN_IL_CMD_1, val);
|
snd_soc_component_write(component, RT5665_4BTN_IL_CMD_1, val);
|
||||||
|
|
||||||
|
@ -1198,7 +1198,7 @@ static int rt5665_headset_detect(struct snd_soc_component *component, int jack_i
|
||||||
|
|
||||||
usleep_range(10000, 15000);
|
usleep_range(10000, 15000);
|
||||||
|
|
||||||
rt5665->sar_adc_value = snd_soc_component_read32(rt5665->component,
|
rt5665->sar_adc_value = snd_soc_component_read(rt5665->component,
|
||||||
RT5665_SAR_IL_CMD_4) & 0x7ff;
|
RT5665_SAR_IL_CMD_4) & 0x7ff;
|
||||||
|
|
||||||
sar_hs_type = rt5665->pdata.sar_hs_type ?
|
sar_hs_type = rt5665->pdata.sar_hs_type ?
|
||||||
|
@ -1245,7 +1245,7 @@ static void rt5665_jd_check_handler(struct work_struct *work)
|
||||||
struct rt5665_priv *rt5665 = container_of(work, struct rt5665_priv,
|
struct rt5665_priv *rt5665 = container_of(work, struct rt5665_priv,
|
||||||
jd_check_work.work);
|
jd_check_work.work);
|
||||||
|
|
||||||
if (snd_soc_component_read32(rt5665->component, RT5665_AJD1_CTRL) & 0x0010) {
|
if (snd_soc_component_read(rt5665->component, RT5665_AJD1_CTRL) & 0x0010) {
|
||||||
/* jack out */
|
/* jack out */
|
||||||
rt5665->jack_type = rt5665_headset_detect(rt5665->component, 0);
|
rt5665->jack_type = rt5665_headset_detect(rt5665->component, 0);
|
||||||
|
|
||||||
|
@ -1310,7 +1310,7 @@ static void rt5665_jack_detect_handler(struct work_struct *work)
|
||||||
|
|
||||||
mutex_lock(&rt5665->calibrate_mutex);
|
mutex_lock(&rt5665->calibrate_mutex);
|
||||||
|
|
||||||
val = snd_soc_component_read32(rt5665->component, RT5665_AJD1_CTRL) & 0x0010;
|
val = snd_soc_component_read(rt5665->component, RT5665_AJD1_CTRL) & 0x0010;
|
||||||
if (!val) {
|
if (!val) {
|
||||||
/* jack in */
|
/* jack in */
|
||||||
if (rt5665->jack_type == 0) {
|
if (rt5665->jack_type == 0) {
|
||||||
|
@ -1522,7 +1522,7 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *w,
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5665_GLB_CLK);
|
val = snd_soc_component_read(component, RT5665_GLB_CLK);
|
||||||
val &= RT5665_SCLK_SRC_MASK;
|
val &= RT5665_SCLK_SRC_MASK;
|
||||||
if (val == RT5665_SCLK_SRC_PLL1)
|
if (val == RT5665_SCLK_SRC_PLL1)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1573,7 +1573,7 @@ static int is_using_asrc(struct snd_soc_dapm_widget *w,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = (snd_soc_component_read32(component, reg) >> shift) & 0xf;
|
val = (snd_soc_component_read(component, reg) >> shift) & 0xf;
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case RT5665_CLK_SEL_I2S1_ASRC:
|
case RT5665_CLK_SEL_I2S1_ASRC:
|
||||||
case RT5665_CLK_SEL_I2S2_ASRC:
|
case RT5665_CLK_SEL_I2S2_ASRC:
|
||||||
|
|
|
@ -847,7 +847,7 @@ static int rt5668_button_detect(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
int btn_type, val;
|
int btn_type, val;
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5668_4BTN_IL_CMD_1);
|
val = snd_soc_component_read(component, RT5668_4BTN_IL_CMD_1);
|
||||||
btn_type = val & 0xfff0;
|
btn_type = val & 0xfff0;
|
||||||
snd_soc_component_write(component, RT5668_4BTN_IL_CMD_1, val);
|
snd_soc_component_write(component, RT5668_4BTN_IL_CMD_1, val);
|
||||||
pr_debug("%s btn_type=%x\n", __func__, btn_type);
|
pr_debug("%s btn_type=%x\n", __func__, btn_type);
|
||||||
|
@ -907,11 +907,11 @@ static int rt5668_headset_detect(struct snd_soc_component *component,
|
||||||
RT5668_TRIG_JD_MASK, RT5668_TRIG_JD_HIGH);
|
RT5668_TRIG_JD_MASK, RT5668_TRIG_JD_HIGH);
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
val = snd_soc_component_read32(component, RT5668_CBJ_CTRL_2)
|
val = snd_soc_component_read(component, RT5668_CBJ_CTRL_2)
|
||||||
& RT5668_JACK_TYPE_MASK;
|
& RT5668_JACK_TYPE_MASK;
|
||||||
while (val == 0 && count < 50) {
|
while (val == 0 && count < 50) {
|
||||||
usleep_range(10000, 15000);
|
usleep_range(10000, 15000);
|
||||||
val = snd_soc_component_read32(component,
|
val = snd_soc_component_read(component,
|
||||||
RT5668_CBJ_CTRL_2) & RT5668_JACK_TYPE_MASK;
|
RT5668_CBJ_CTRL_2) & RT5668_JACK_TYPE_MASK;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -955,7 +955,7 @@ static void rt5668_jd_check_handler(struct work_struct *work)
|
||||||
struct rt5668_priv *rt5668 = container_of(work, struct rt5668_priv,
|
struct rt5668_priv *rt5668 = container_of(work, struct rt5668_priv,
|
||||||
jd_check_work.work);
|
jd_check_work.work);
|
||||||
|
|
||||||
if (snd_soc_component_read32(rt5668->component, RT5668_AJD1_CTRL)
|
if (snd_soc_component_read(rt5668->component, RT5668_AJD1_CTRL)
|
||||||
& RT5668_JDH_RS_MASK) {
|
& RT5668_JDH_RS_MASK) {
|
||||||
/* jack out */
|
/* jack out */
|
||||||
rt5668->jack_type = rt5668_headset_detect(rt5668->component, 0);
|
rt5668->jack_type = rt5668_headset_detect(rt5668->component, 0);
|
||||||
|
@ -1030,7 +1030,7 @@ static void rt5668_jack_detect_handler(struct work_struct *work)
|
||||||
|
|
||||||
mutex_lock(&rt5668->calibrate_mutex);
|
mutex_lock(&rt5668->calibrate_mutex);
|
||||||
|
|
||||||
val = snd_soc_component_read32(rt5668->component, RT5668_AJD1_CTRL)
|
val = snd_soc_component_read(rt5668->component, RT5668_AJD1_CTRL)
|
||||||
& RT5668_JDH_RS_MASK;
|
& RT5668_JDH_RS_MASK;
|
||||||
if (!val) {
|
if (!val) {
|
||||||
/* jack in */
|
/* jack in */
|
||||||
|
@ -1191,7 +1191,7 @@ static int set_filter_clk(struct snd_soc_dapm_widget *w,
|
||||||
int ref, val, reg, idx = -EINVAL;
|
int ref, val, reg, idx = -EINVAL;
|
||||||
static const int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48};
|
static const int div[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48};
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5668_GPIO_CTRL_1) &
|
val = snd_soc_component_read(component, RT5668_GPIO_CTRL_1) &
|
||||||
RT5668_GP4_PIN_MASK;
|
RT5668_GP4_PIN_MASK;
|
||||||
if (w->shift == RT5668_PWR_ADC_S1F_BIT &&
|
if (w->shift == RT5668_PWR_ADC_S1F_BIT &&
|
||||||
val == RT5668_GP4_PIN_ADCDAT2)
|
val == RT5668_GP4_PIN_ADCDAT2)
|
||||||
|
@ -1219,7 +1219,7 @@ static int is_sys_clk_from_pll1(struct snd_soc_dapm_widget *w,
|
||||||
struct snd_soc_component *component =
|
struct snd_soc_component *component =
|
||||||
snd_soc_dapm_to_component(w->dapm);
|
snd_soc_dapm_to_component(w->dapm);
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5668_GLB_CLK);
|
val = snd_soc_component_read(component, RT5668_GLB_CLK);
|
||||||
val &= RT5668_SCLK_SRC_MASK;
|
val &= RT5668_SCLK_SRC_MASK;
|
||||||
if (val == RT5668_SCLK_SRC_PLL1)
|
if (val == RT5668_SCLK_SRC_PLL1)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1247,7 +1247,7 @@ static int is_using_asrc(struct snd_soc_dapm_widget *w,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = (snd_soc_component_read32(component, reg) >> shift) & 0xf;
|
val = (snd_soc_component_read(component, reg) >> shift) & 0xf;
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case RT5668_CLK_SEL_I2S1_ASRC:
|
case RT5668_CLK_SEL_I2S1_ASRC:
|
||||||
case RT5668_CLK_SEL_I2S2_ASRC:
|
case RT5668_CLK_SEL_I2S2_ASRC:
|
||||||
|
|
|
@ -452,13 +452,13 @@ static int rt5670_headset_detect(struct snd_soc_component *component, int jack_i
|
||||||
snd_soc_component_update_bits(component, RT5670_CJ_CTRL2,
|
snd_soc_component_update_bits(component, RT5670_CJ_CTRL2,
|
||||||
RT5670_CBJ_MN_JD, 0);
|
RT5670_CBJ_MN_JD, 0);
|
||||||
msleep(300);
|
msleep(300);
|
||||||
val = snd_soc_component_read32(component, RT5670_CJ_CTRL3) & 0x7;
|
val = snd_soc_component_read(component, RT5670_CJ_CTRL3) & 0x7;
|
||||||
if (val == 0x1 || val == 0x2) {
|
if (val == 0x1 || val == 0x2) {
|
||||||
rt5670->jack_type = SND_JACK_HEADSET;
|
rt5670->jack_type = SND_JACK_HEADSET;
|
||||||
/* for push button */
|
/* for push button */
|
||||||
snd_soc_component_update_bits(component, RT5670_INT_IRQ_ST, 0x8, 0x8);
|
snd_soc_component_update_bits(component, RT5670_INT_IRQ_ST, 0x8, 0x8);
|
||||||
snd_soc_component_update_bits(component, RT5670_IL_CMD, 0x40, 0x40);
|
snd_soc_component_update_bits(component, RT5670_IL_CMD, 0x40, 0x40);
|
||||||
snd_soc_component_read32(component, RT5670_IL_CMD);
|
snd_soc_component_read(component, RT5670_IL_CMD);
|
||||||
} else {
|
} else {
|
||||||
snd_soc_component_update_bits(component, RT5670_GEN_CTRL3, 0x4, 0x4);
|
snd_soc_component_update_bits(component, RT5670_GEN_CTRL3, 0x4, 0x4);
|
||||||
rt5670->jack_type = SND_JACK_HEADPHONE;
|
rt5670->jack_type = SND_JACK_HEADPHONE;
|
||||||
|
@ -498,12 +498,12 @@ static int rt5670_button_detect(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
int btn_type, val;
|
int btn_type, val;
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5670_IL_CMD);
|
val = snd_soc_component_read(component, RT5670_IL_CMD);
|
||||||
btn_type = val & 0xff80;
|
btn_type = val & 0xff80;
|
||||||
snd_soc_component_write(component, RT5670_IL_CMD, val);
|
snd_soc_component_write(component, RT5670_IL_CMD, val);
|
||||||
if (btn_type != 0) {
|
if (btn_type != 0) {
|
||||||
msleep(20);
|
msleep(20);
|
||||||
val = snd_soc_component_read32(component, RT5670_IL_CMD);
|
val = snd_soc_component_read(component, RT5670_IL_CMD);
|
||||||
snd_soc_component_write(component, RT5670_IL_CMD, val);
|
snd_soc_component_write(component, RT5670_IL_CMD, val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,9 +518,9 @@ static int rt5670_irq_detection(void *data)
|
||||||
int val, btn_type, report = jack->status;
|
int val, btn_type, report = jack->status;
|
||||||
|
|
||||||
if (rt5670->pdata.jd_mode == 1) /* 2 port */
|
if (rt5670->pdata.jd_mode == 1) /* 2 port */
|
||||||
val = snd_soc_component_read32(rt5670->component, RT5670_A_JD_CTRL1) & 0x0070;
|
val = snd_soc_component_read(rt5670->component, RT5670_A_JD_CTRL1) & 0x0070;
|
||||||
else
|
else
|
||||||
val = snd_soc_component_read32(rt5670->component, RT5670_A_JD_CTRL1) & 0x0020;
|
val = snd_soc_component_read(rt5670->component, RT5670_A_JD_CTRL1) & 0x0020;
|
||||||
|
|
||||||
switch (val) {
|
switch (val) {
|
||||||
/* jack in */
|
/* jack in */
|
||||||
|
@ -533,7 +533,7 @@ static int rt5670_irq_detection(void *data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
btn_type = 0;
|
btn_type = 0;
|
||||||
if (snd_soc_component_read32(rt5670->component, RT5670_INT_IRQ_ST) & 0x4) {
|
if (snd_soc_component_read(rt5670->component, RT5670_INT_IRQ_ST) & 0x4) {
|
||||||
/* button pressed */
|
/* button pressed */
|
||||||
report = SND_JACK_HEADSET;
|
report = SND_JACK_HEADSET;
|
||||||
btn_type = rt5670_button_detect(rt5670->component);
|
btn_type = rt5670_button_detect(rt5670->component);
|
||||||
|
@ -762,7 +762,7 @@ static int is_using_asrc(struct snd_soc_dapm_widget *source,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = (snd_soc_component_read32(component, reg) >> shift) & 0xf;
|
val = (snd_soc_component_read(component, reg) >> shift) & 0xf;
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -2621,7 +2621,7 @@ static int rt5670_probe(struct snd_soc_component *component)
|
||||||
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
|
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
|
||||||
struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component);
|
struct rt5670_priv *rt5670 = snd_soc_component_get_drvdata(component);
|
||||||
|
|
||||||
switch (snd_soc_component_read32(component, RT5670_RESET) & RT5670_ID_MASK) {
|
switch (snd_soc_component_read(component, RT5670_RESET) & RT5670_ID_MASK) {
|
||||||
case RT5670_ID_5670:
|
case RT5670_ID_5670:
|
||||||
case RT5670_ID_5671:
|
case RT5670_ID_5671:
|
||||||
snd_soc_dapm_new_controls(dapm,
|
snd_soc_dapm_new_controls(dapm,
|
||||||
|
|
|
@ -59,7 +59,7 @@ static void rt5682_jd_check_handler(struct work_struct *work)
|
||||||
struct rt5682_priv *rt5682 = container_of(work, struct rt5682_priv,
|
struct rt5682_priv *rt5682 = container_of(work, struct rt5682_priv,
|
||||||
jd_check_work.work);
|
jd_check_work.work);
|
||||||
|
|
||||||
if (snd_soc_component_read32(rt5682->component, RT5682_AJD1_CTRL)
|
if (snd_soc_component_read(rt5682->component, RT5682_AJD1_CTRL)
|
||||||
& RT5682_JDH_RS_MASK) {
|
& RT5682_JDH_RS_MASK) {
|
||||||
/* jack out */
|
/* jack out */
|
||||||
rt5682->jack_type = rt5682_headset_detect(rt5682->component, 0);
|
rt5682->jack_type = rt5682_headset_detect(rt5682->component, 0);
|
||||||
|
|
|
@ -859,7 +859,7 @@ static int rt5682_button_detect(struct snd_soc_component *component)
|
||||||
{
|
{
|
||||||
int btn_type, val;
|
int btn_type, val;
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5682_4BTN_IL_CMD_1);
|
val = snd_soc_component_read(component, RT5682_4BTN_IL_CMD_1);
|
||||||
btn_type = val & 0xfff0;
|
btn_type = val & 0xfff0;
|
||||||
snd_soc_component_write(component, RT5682_4BTN_IL_CMD_1, val);
|
snd_soc_component_write(component, RT5682_4BTN_IL_CMD_1, val);
|
||||||
dev_dbg(component->dev, "%s btn_type=%x\n", __func__, btn_type);
|
dev_dbg(component->dev, "%s btn_type=%x\n", __func__, btn_type);
|
||||||
|
@ -937,11 +937,11 @@ int rt5682_headset_detect(struct snd_soc_component *component, int jack_insert)
|
||||||
RT5682_TRIG_JD_MASK, RT5682_TRIG_JD_HIGH);
|
RT5682_TRIG_JD_MASK, RT5682_TRIG_JD_HIGH);
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
val = snd_soc_component_read32(component, RT5682_CBJ_CTRL_2)
|
val = snd_soc_component_read(component, RT5682_CBJ_CTRL_2)
|
||||||
& RT5682_JACK_TYPE_MASK;
|
& RT5682_JACK_TYPE_MASK;
|
||||||
while (val == 0 && count < 50) {
|
while (val == 0 && count < 50) {
|
||||||
usleep_range(10000, 15000);
|
usleep_range(10000, 15000);
|
||||||
val = snd_soc_component_read32(component,
|
val = snd_soc_component_read(component,
|
||||||
RT5682_CBJ_CTRL_2) & RT5682_JACK_TYPE_MASK;
|
RT5682_CBJ_CTRL_2) & RT5682_JACK_TYPE_MASK;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -1067,7 +1067,7 @@ void rt5682_jack_detect_handler(struct work_struct *work)
|
||||||
|
|
||||||
mutex_lock(&rt5682->calibrate_mutex);
|
mutex_lock(&rt5682->calibrate_mutex);
|
||||||
|
|
||||||
val = snd_soc_component_read32(rt5682->component, RT5682_AJD1_CTRL)
|
val = snd_soc_component_read(rt5682->component, RT5682_AJD1_CTRL)
|
||||||
& RT5682_JDH_RS_MASK;
|
& RT5682_JDH_RS_MASK;
|
||||||
if (!val) {
|
if (!val) {
|
||||||
/* jack in */
|
/* jack in */
|
||||||
|
@ -1232,7 +1232,7 @@ static int set_filter_clk(struct snd_soc_dapm_widget *w,
|
||||||
if (rt5682->is_sdw)
|
if (rt5682->is_sdw)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5682_GPIO_CTRL_1) &
|
val = snd_soc_component_read(component, RT5682_GPIO_CTRL_1) &
|
||||||
RT5682_GP4_PIN_MASK;
|
RT5682_GP4_PIN_MASK;
|
||||||
if (w->shift == RT5682_PWR_ADC_S1F_BIT &&
|
if (w->shift == RT5682_PWR_ADC_S1F_BIT &&
|
||||||
val == RT5682_GP4_PIN_ADCDAT2)
|
val == RT5682_GP4_PIN_ADCDAT2)
|
||||||
|
@ -1270,7 +1270,7 @@ static int is_sys_clk_from_pll1(struct snd_soc_dapm_widget *w,
|
||||||
struct snd_soc_component *component =
|
struct snd_soc_component *component =
|
||||||
snd_soc_dapm_to_component(w->dapm);
|
snd_soc_dapm_to_component(w->dapm);
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5682_GLB_CLK);
|
val = snd_soc_component_read(component, RT5682_GLB_CLK);
|
||||||
val &= RT5682_SCLK_SRC_MASK;
|
val &= RT5682_SCLK_SRC_MASK;
|
||||||
if (val == RT5682_SCLK_SRC_PLL1)
|
if (val == RT5682_SCLK_SRC_PLL1)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1285,7 +1285,7 @@ static int is_sys_clk_from_pll2(struct snd_soc_dapm_widget *w,
|
||||||
struct snd_soc_component *component =
|
struct snd_soc_component *component =
|
||||||
snd_soc_dapm_to_component(w->dapm);
|
snd_soc_dapm_to_component(w->dapm);
|
||||||
|
|
||||||
val = snd_soc_component_read32(component, RT5682_GLB_CLK);
|
val = snd_soc_component_read(component, RT5682_GLB_CLK);
|
||||||
val &= RT5682_SCLK_SRC_MASK;
|
val &= RT5682_SCLK_SRC_MASK;
|
||||||
if (val == RT5682_SCLK_SRC_PLL2)
|
if (val == RT5682_SCLK_SRC_PLL2)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -1313,7 +1313,7 @@ static int is_using_asrc(struct snd_soc_dapm_widget *w,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = (snd_soc_component_read32(component, reg) >> shift) & 0xf;
|
val = (snd_soc_component_read(component, reg) >> shift) & 0xf;
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case RT5682_CLK_SEL_I2S1_ASRC:
|
case RT5682_CLK_SEL_I2S1_ASRC:
|
||||||
case RT5682_CLK_SEL_I2S2_ASRC:
|
case RT5682_CLK_SEL_I2S2_ASRC:
|
||||||
|
|
Loading…
Reference in New Issue