mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-15 01:01:56 -04:00
fsa4480: optimize switch config flow
- When headset is present and not plug-out, if USB PD mis-trigger recognize typec_accessory_device, this action will make fsa4480 change registers value, headset hardware signals will switch, then headset function becomes abnormal. Optimize fsa4480 workflow, if headset present state is not change, drop the update operation. - Enable debug log for analysis headset case. Change-Id: I40d3abc137db22ecdaf0cb74df081acbd4d2108d Signed-off-by: zhouwl <zhouwl@lenovo.com> Reviewed-on: https://gerrit.mot.com/2310806 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Hujun Liao <liaohj@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
4868706096
commit
d9d23eca0e
1 changed files with 12 additions and 4 deletions
|
|
@ -67,6 +67,8 @@ static const struct fsa4480_reg_val fsa_reg_i2c_defaults[] = {
|
|||
{FSA4480_SWITCH_SETTINGS, 0x98},
|
||||
};
|
||||
|
||||
static bool fsa_reg_notifier;
|
||||
|
||||
static void fsa4480_usbc_update_settings(struct fsa4480_priv *fsa_priv,
|
||||
u32 switch_control, u32 switch_enable)
|
||||
{
|
||||
|
|
@ -103,7 +105,7 @@ static int fsa4480_usbc_event_changed_psupply(struct fsa4480_priv *fsa_priv,
|
|||
dev = fsa_priv->dev;
|
||||
if (!dev)
|
||||
return -EINVAL;
|
||||
dev_dbg(dev, "%s: queueing usbc_analog_work\n",
|
||||
dev_info(dev, "%s: queueing usbc_analog_work\n",
|
||||
__func__);
|
||||
pm_stay_awake(fsa_priv->dev);
|
||||
queue_work(system_freezable_wq, &fsa_priv->usbc_analog_work);
|
||||
|
|
@ -190,9 +192,14 @@ static int fsa4480_usbc_analog_setup_switches_psupply(
|
|||
goto done;
|
||||
}
|
||||
|
||||
dev_dbg(dev, "%s: setting GPIOs active = %d rcvd intval 0x%X\n",
|
||||
dev_info(dev, "%s: setting GPIOs active = %d rcvd intval 0x%X\n",
|
||||
__func__, mode.intval != TYPEC_ACCESSORY_NONE, mode.intval);
|
||||
atomic_set(&(fsa_priv->usbc_mode), mode.intval);
|
||||
if ((atomic_read(&(fsa_priv->usbc_mode)) != mode.intval) || fsa_reg_notifier) {
|
||||
atomic_set(&(fsa_priv->usbc_mode), mode.intval);
|
||||
fsa_reg_notifier = false;
|
||||
} else {
|
||||
goto done;
|
||||
}
|
||||
|
||||
switch (mode.intval) {
|
||||
/* add all modes FSA should notify for in here */
|
||||
|
|
@ -308,8 +315,9 @@ int fsa4480_reg_notifier(struct notifier_block *nb,
|
|||
* as part of the init sequence check if there is a connected
|
||||
* USB C analog adapter
|
||||
*/
|
||||
dev_dbg(fsa_priv->dev, "%s: verify if USB adapter is already inserted\n",
|
||||
dev_info(fsa_priv->dev, "%s: verify if USB adapter is already inserted\n",
|
||||
__func__);
|
||||
fsa_reg_notifier = true;
|
||||
rc = fsa4480_usbc_analog_setup_switches(fsa_priv);
|
||||
regmap_update_bits(fsa_priv->regmap, FSA4480_SWITCH_CONTROL, 0x07,
|
||||
fsa_priv->switch_control);
|
||||
|
|
|
|||
Loading…
Reference in a new issue