mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 21:59:12 -04:00
Merge "soc: wsa883x: Update the PDM_WD at startup/teardown"
This commit is contained in:
commit
1d2d2a7f9b
7 changed files with 42 additions and 14 deletions
|
|
@ -755,7 +755,7 @@ void bolero_unregister_macro(struct device *dev, u16 macro_id)
|
|||
}
|
||||
EXPORT_SYMBOL(bolero_unregister_macro);
|
||||
|
||||
void bolero_wsa_pa_on(struct device *dev)
|
||||
void bolero_wsa_pa_on(struct device *dev, bool adie_lb)
|
||||
{
|
||||
struct bolero_priv *priv;
|
||||
|
||||
|
|
@ -773,8 +773,12 @@ void bolero_wsa_pa_on(struct device *dev)
|
|||
dev_err(dev, "%s: priv is null\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
bolero_cdc_notifier_call(priv, BOLERO_WCD_EVT_PA_ON_POST_FSCLK);
|
||||
if (adie_lb)
|
||||
bolero_cdc_notifier_call(priv,
|
||||
BOLERO_WCD_EVT_PA_ON_POST_FSCLK_ADIE_LB);
|
||||
else
|
||||
bolero_cdc_notifier_call(priv,
|
||||
BOLERO_WCD_EVT_PA_ON_POST_FSCLK);
|
||||
}
|
||||
EXPORT_SYMBOL(bolero_wsa_pa_on);
|
||||
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ int bolero_runtime_suspend(struct device *dev);
|
|||
int bolero_set_port_map(struct snd_soc_component *component, u32 size, void *data);
|
||||
int bolero_register_event_listener(struct snd_soc_component *component,
|
||||
bool enable);
|
||||
void bolero_wsa_pa_on(struct device *dev);
|
||||
void bolero_wsa_pa_on(struct device *dev, bool adie_lb);
|
||||
bool bolero_check_core_votes(struct device *dev);
|
||||
int bolero_tx_mclk_enable(struct snd_soc_component *c, bool enable);
|
||||
int bolero_get_version(struct device *dev);
|
||||
|
|
@ -176,7 +176,7 @@ static inline int bolero_register_event_listener(
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void bolero_wsa_pa_on(struct device *dev)
|
||||
static void bolero_wsa_pa_on(struct device *dev, bool adie_lb)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ enum {
|
|||
BOLERO_WCD_EVT_SSR_DOWN,
|
||||
BOLERO_WCD_EVT_SSR_UP,
|
||||
BOLERO_WCD_EVT_PA_ON_POST_FSCLK,
|
||||
BOLERO_WCD_EVT_PA_ON_POST_FSCLK_ADIE_LB,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
|
|||
|
|
@ -845,6 +845,7 @@ static int wsa_macro_digital_mute(struct snd_soc_dai *dai, int mute)
|
|||
uint16_t j = 0, reg = 0, mix_reg = 0, dsm_reg = 0;
|
||||
u16 int_mux_cfg0 = 0, int_mux_cfg1 = 0;
|
||||
u8 int_mux_cfg0_val = 0, int_mux_cfg1_val = 0;
|
||||
bool adie_lb = false;
|
||||
|
||||
if (mute)
|
||||
return 0;
|
||||
|
|
@ -881,7 +882,7 @@ static int wsa_macro_digital_mute(struct snd_soc_dai *dai, int mute)
|
|||
}
|
||||
}
|
||||
}
|
||||
bolero_wsa_pa_on(wsa_dev);
|
||||
bolero_wsa_pa_on(wsa_dev, adie_lb);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -1472,6 +1473,7 @@ static int wsa_macro_enable_main_path(struct snd_soc_dapm_widget *w,
|
|||
u16 reg = 0;
|
||||
struct device *wsa_dev = NULL;
|
||||
struct wsa_macro_priv *wsa_priv = NULL;
|
||||
bool adie_lb = false;
|
||||
|
||||
if (!wsa_macro_get_data(component, &wsa_dev, &wsa_priv, __func__))
|
||||
return -EINVAL;
|
||||
|
|
@ -1482,9 +1484,10 @@ static int wsa_macro_enable_main_path(struct snd_soc_dapm_widget *w,
|
|||
switch (event) {
|
||||
case SND_SOC_DAPM_PRE_PMU:
|
||||
if (wsa_macro_adie_lb(component, w->shift)) {
|
||||
adie_lb = true;
|
||||
snd_soc_component_update_bits(component,
|
||||
reg, 0x20, 0x20);
|
||||
bolero_wsa_pa_on(wsa_dev);
|
||||
bolero_wsa_pa_on(wsa_dev, adie_lb);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
@ -2571,10 +2574,10 @@ static const struct snd_soc_dapm_widget wsa_macro_dapm_widgets[] = {
|
|||
SND_SOC_DAPM_MUX_E("WSA_RX1 MIX INP", SND_SOC_NOPM,
|
||||
0, 0, &rx1_mix_mux, wsa_macro_enable_mix_path,
|
||||
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
|
||||
SND_SOC_DAPM_MIXER_E("WSA_RX INT0 MIX", SND_SOC_NOPM,
|
||||
SND_SOC_DAPM_PGA_E("WSA_RX INT0 MIX", SND_SOC_NOPM,
|
||||
0, 0, NULL, 0, wsa_macro_enable_main_path,
|
||||
SND_SOC_DAPM_PRE_PMU),
|
||||
SND_SOC_DAPM_MIXER_E("WSA_RX INT1 MIX", SND_SOC_NOPM,
|
||||
SND_SOC_DAPM_PGA_E("WSA_RX INT1 MIX", SND_SOC_NOPM,
|
||||
1, 0, NULL, 0, wsa_macro_enable_main_path,
|
||||
SND_SOC_DAPM_PRE_PMU),
|
||||
SND_SOC_DAPM_MIXER("WSA_RX INT0 SEC MIX", SND_SOC_NOPM, 0, 0, NULL, 0),
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ enum {
|
|||
BOLERO_WSA_EVT_SSR_DOWN,
|
||||
BOLERO_WSA_EVT_SSR_UP,
|
||||
BOLERO_WSA_EVT_PA_ON_POST_FSCLK,
|
||||
BOLERO_WSA_EVT_PA_ON_POST_FSCLK_ADIE_LB,
|
||||
};
|
||||
|
||||
struct wsa_ctrl_platform_data {
|
||||
|
|
@ -1403,6 +1404,7 @@ static int wsa881x_event_notify(struct notifier_block *nb,
|
|||
0x80, 0x00);
|
||||
break;
|
||||
case BOLERO_WSA_EVT_PA_ON_POST_FSCLK:
|
||||
case BOLERO_WSA_EVT_PA_ON_POST_FSCLK_ADIE_LB:
|
||||
if ((snd_soc_component_read32(wsa881x->component,
|
||||
WSA881X_SPKR_DAC_CTL) & 0x80) == 0x80)
|
||||
snd_soc_component_update_bits(wsa881x->component,
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ enum {
|
|||
BOLERO_WSA_EVT_SSR_DOWN,
|
||||
BOLERO_WSA_EVT_SSR_UP,
|
||||
BOLERO_WSA_EVT_PA_ON_POST_FSCLK,
|
||||
BOLERO_WSA_EVT_PA_ON_POST_FSCLK_ADIE_LB,
|
||||
};
|
||||
|
||||
struct wsa_ctrl_platform_data {
|
||||
|
|
|
|||
|
|
@ -99,7 +99,6 @@ static const struct wsa_reg_mask_val reg_init[] = {
|
|||
{WSA883X_CDC_SPK_DSM_R7, 0xFF, 0x3F},
|
||||
{WSA883X_DRE_CTL_0, 0xF0, 0x90},
|
||||
{WSA883X_DRE_IDLE_DET_CTL, 0x10, 0x00},
|
||||
{WSA883X_PDM_WD_CTL, 0x01, 0x01},
|
||||
{WSA883X_CURRENT_LIMIT, 0x78, 0x20},
|
||||
{WSA883X_DRE_CTL_0, 0x07, 0x02},
|
||||
{WSA883X_VAGC_TIME, 0x0F, 0x0F},
|
||||
|
|
@ -134,6 +133,7 @@ enum {
|
|||
enum {
|
||||
SPKR_STATUS = 0,
|
||||
WSA_SUPPLIES_LPM_MODE,
|
||||
SPKR_ADIE_LB,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
@ -962,6 +962,7 @@ static int wsa883x_enable_swr_dac_port(struct snd_soc_dapm_widget *w,
|
|||
&port_type[0]);
|
||||
break;
|
||||
case SND_SOC_DAPM_POST_PMU:
|
||||
set_bit(SPKR_STATUS, &wsa883x->status_mask);
|
||||
break;
|
||||
case SND_SOC_DAPM_PRE_PMD:
|
||||
wsa883x_set_port(component, SWR_DAC_PORT,
|
||||
|
|
@ -1015,19 +1016,25 @@ static int wsa883x_spkr_event(struct snd_soc_dapm_widget *w,
|
|||
swr_slvdev_datapath_control(wsa883x->swr_slave,
|
||||
wsa883x->swr_slave->dev_num,
|
||||
true);
|
||||
wcd_enable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_PDM_WD);
|
||||
wcd_enable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_UVLO);
|
||||
/* Force remove group */
|
||||
swr_remove_from_group(wsa883x->swr_slave,
|
||||
wsa883x->swr_slave->dev_num);
|
||||
set_bit(SPKR_STATUS, &wsa883x->status_mask);
|
||||
if (test_bit(SPKR_ADIE_LB, &wsa883x->status_mask))
|
||||
snd_soc_component_update_bits(component,
|
||||
WSA883X_PA_FSM_CTL, 0x01, 0x01);
|
||||
break;
|
||||
case SND_SOC_DAPM_PRE_PMD:
|
||||
if (!test_bit(SPKR_ADIE_LB, &wsa883x->status_mask))
|
||||
wcd_disable_irq(&wsa883x->irq_info,
|
||||
WSA883X_IRQ_INT_PDM_WD);
|
||||
snd_soc_component_update_bits(component, WSA883X_PA_FSM_CTL,
|
||||
0x01, 0x00);
|
||||
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_PDM_WD);
|
||||
snd_soc_component_update_bits(component, WSA883X_PDM_WD_CTL,
|
||||
0x01, 0x00);
|
||||
wcd_disable_irq(&wsa883x->irq_info, WSA883X_IRQ_INT_UVLO);
|
||||
clear_bit(SPKR_STATUS, &wsa883x->status_mask);
|
||||
clear_bit(SPKR_ADIE_LB, &wsa883x->status_mask);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -1375,10 +1382,20 @@ static int wsa883x_event_notify(struct notifier_block *nb,
|
|||
break;
|
||||
|
||||
case BOLERO_WSA_EVT_PA_ON_POST_FSCLK:
|
||||
if (test_bit(SPKR_STATUS, &wsa883x->status_mask))
|
||||
if (test_bit(SPKR_STATUS, &wsa883x->status_mask)) {
|
||||
snd_soc_component_update_bits(wsa883x->component,
|
||||
WSA883X_PDM_WD_CTL,
|
||||
0x01, 0x01);
|
||||
snd_soc_component_update_bits(wsa883x->component,
|
||||
WSA883X_PA_FSM_CTL,
|
||||
0x01, 0x01);
|
||||
wcd_enable_irq(&wsa883x->irq_info,
|
||||
WSA883X_IRQ_INT_PDM_WD);
|
||||
}
|
||||
break;
|
||||
case BOLERO_WSA_EVT_PA_ON_POST_FSCLK_ADIE_LB:
|
||||
if (test_bit(SPKR_STATUS, &wsa883x->status_mask))
|
||||
set_bit(SPKR_ADIE_LB, &wsa883x->status_mask);
|
||||
break;
|
||||
default:
|
||||
dev_dbg(wsa883x->dev, "%s: unknown event %d\n",
|
||||
|
|
|
|||
Loading…
Reference in a new issue