ASoC: wcd9330: Update HPH class-h enables based on mbhc status

Update HPH class-h enables based on mbhc status otherwise
class-H clock for both headphone left and right will not
get enabled, hence audio playback runs with higher current
on headphone path.

Change-Id: I11fef552a649416dc6eacea053bde41a9cce3da3
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
This commit is contained in:
Phani Kumar Uppalapati 2015-04-09 15:45:06 -07:00
parent c31fa29db5
commit 2ef3488c3e
3 changed files with 39 additions and 6 deletions

View file

@ -7803,8 +7803,10 @@ int tomtom_hs_detect(struct snd_soc_codec *codec,
snd_soc_update_bits(codec, TOMTOM_A_MICB_CFILT_2_CTL, 0x01, snd_soc_update_bits(codec, TOMTOM_A_MICB_CFILT_2_CTL, 0x01,
0x00); 0x00);
tomtom->mbhc.mbhc_cfg = NULL; tomtom->mbhc.mbhc_cfg = NULL;
tomtom->mbhc_started = false;
rc = 0; rc = 0;
} }
wcd9xxx_clsh_post_init(&tomtom->clsh_d, tomtom->mbhc_started);
return rc; return rc;
} }
EXPORT_SYMBOL(tomtom_hs_detect); EXPORT_SYMBOL(tomtom_hs_detect);

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and
@ -657,16 +657,29 @@ static void wcd9xxx_clsh_comp_req(struct snd_soc_codec *codec,
return; return;
} }
if (on) if (on) {
wcd9xxx_resmgr_add_cond_update_bits(clsh_d->resmgr, if (clsh_d->mbhc_started)
wcd9xxx_resmgr_add_cond_update_bits(
clsh_d->resmgr,
WCD9XXX_COND_HPH, WCD9XXX_COND_HPH,
WCD9XXX_A_CDC_CLSH_B1_CTL, WCD9XXX_A_CDC_CLSH_B1_CTL,
shift, false); shift, false);
else else
wcd9xxx_resmgr_rm_cond_update_bits(clsh_d->resmgr, snd_soc_update_bits(codec,
WCD9XXX_A_CDC_CLSH_B1_CTL,
1 << shift, 1 << shift);
} else {
if (clsh_d->mbhc_started)
wcd9xxx_resmgr_rm_cond_update_bits(
clsh_d->resmgr,
WCD9XXX_COND_HPH, WCD9XXX_COND_HPH,
WCD9XXX_A_CDC_CLSH_B1_CTL, WCD9XXX_A_CDC_CLSH_B1_CTL,
shift, false); shift, false);
else
snd_soc_update_bits(codec,
WCD9XXX_A_CDC_CLSH_B1_CTL,
1 << shift, 0 << shift);
}
} }
} }
@ -1425,6 +1438,19 @@ void wcd9xxx_clsh_fsm(struct snd_soc_codec *codec,
} }
EXPORT_SYMBOL_GPL(wcd9xxx_clsh_fsm); EXPORT_SYMBOL_GPL(wcd9xxx_clsh_fsm);
void wcd9xxx_clsh_post_init(struct wcd9xxx_clsh_cdc_data *clsh,
bool is_mbhc_started)
{
if (!clsh) {
pr_err("%s: Class-H memory is NULL\n", __func__);
return;
}
clsh->mbhc_started = is_mbhc_started;
}
EXPORT_SYMBOL(wcd9xxx_clsh_post_init);
void wcd9xxx_clsh_init(struct wcd9xxx_clsh_cdc_data *clsh, void wcd9xxx_clsh_init(struct wcd9xxx_clsh_cdc_data *clsh,
struct wcd9xxx_resmgr *resmgr) struct wcd9xxx_resmgr *resmgr)
{ {
@ -1461,6 +1487,7 @@ void wcd9xxx_clsh_init(struct wcd9xxx_clsh_cdc_data *clsh,
clsh_state_fp[WCD9XXX_CLSH_STATE_HPH_ST_EAR_LO] = clsh_state_fp[WCD9XXX_CLSH_STATE_HPH_ST_EAR_LO] =
wcd9xxx_clsh_state_hph_ear_lo; wcd9xxx_clsh_state_hph_ear_lo;
clsh->mbhc_started = true;
} }
EXPORT_SYMBOL_GPL(wcd9xxx_clsh_init); EXPORT_SYMBOL_GPL(wcd9xxx_clsh_init);

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and * it under the terms of the GNU General Public License version 2 and
@ -115,6 +115,7 @@ struct wcd9xxx_clsh_cdc_data {
int buck_users; int buck_users;
int ncp_users[NCP_FCLK_LEVEL_MAX]; int ncp_users[NCP_FCLK_LEVEL_MAX];
struct wcd9xxx_resmgr *resmgr; struct wcd9xxx_resmgr *resmgr;
bool mbhc_started;
}; };
struct wcd9xxx_anc_header { struct wcd9xxx_anc_header {
@ -193,6 +194,9 @@ extern void wcd9xxx_clsh_init(struct wcd9xxx_clsh_cdc_data *clsh,
extern void wcd9xxx_clsh_imped_config(struct snd_soc_codec *codec, extern void wcd9xxx_clsh_imped_config(struct snd_soc_codec *codec,
int imped); int imped);
void wcd9xxx_clsh_post_init(struct wcd9xxx_clsh_cdc_data *clsh,
bool is_mbhc_started);
enum wcd9xxx_codec_event { enum wcd9xxx_codec_event {
WCD9XXX_CODEC_EVENT_CODEC_UP = 0, WCD9XXX_CODEC_EVENT_CODEC_UP = 0,
}; };