audio: fix earc tx uevent missing [1/1]

PD#SWPL-165521

Problem:
there may be no rx_cap_chng interrupt, and
so missing earc status uevent.

Solution:
setup a delay task which send earc tx status
200ms later when earc discovery success.

Verify:
t3x

Change-Id: I15b95946f9d0813cd0a6bfc3b9229fa297c35cd9
Signed-off-by: jian zhou <jian.zhou@amlogic.com>
This commit is contained in:
jian zhou
2024-04-16 19:12:29 +08:00
committed by Luan Yuan
parent e177229bec
commit 3ed29ba2f2
+9 -7
View File
@@ -199,7 +199,7 @@ struct earc {
int tx_heartbeat_state;
int tx_stream_state;
u8 tx_latency;
struct work_struct send_uevent;
struct delayed_work send_uevent;
bool tx_mute;
int same_src_on;
/* ui earc/arc switch */
@@ -395,7 +395,7 @@ static void earctx_init(int earc_port, bool st)
earc_clock_enable();
st = st && p_earc->tx_ui_flag;
if (!st) {
schedule_work(&p_earc->send_uevent);
schedule_delayed_work(&p_earc->send_uevent, 0);
/* set disconnect when cable plugout */
p_earc->earctx_connected_device_type = ATNDTYP_DISCNCT;
/* release earctx same source when cable plug out */
@@ -423,7 +423,7 @@ static void earctx_init(int earc_port, bool st)
schedule_work(&p_earc->work);
}
if (st && !p_earc->tx_earc_mode)
schedule_work(&p_earc->send_uevent);
schedule_delayed_work(&p_earc->send_uevent, msecs_to_jiffies(700));
}
static void earcrx_init(bool st)
@@ -759,6 +759,7 @@ static irqreturn_t earc_tx_isr(int irq, void *data)
}
if (status0 & INT_EARCTX_CMDC_EARC) {
schedule_delayed_work(&p_earc->send_uevent, msecs_to_jiffies(200));
p_earc->tx_reset_hpd = false;
dev_info(p_earc->dev, "EARCTX_CMDC_EARC\n");
}
@@ -2165,7 +2166,7 @@ int earctx_earc_mode_put(struct snd_kcontrol *kcontrol,
p_earc->tx_earc_mode = earc_mode;
earctx_set_earc_mode(p_earc, earc_mode);
if (!earc_mode && earctx_cmdc_get_attended_type(p_earc->tx_cmdc_map) == ATNDTYP_ARC)
schedule_work(&p_earc->send_uevent);
schedule_delayed_work(&p_earc->send_uevent, msecs_to_jiffies(700));
return 0;
}
@@ -2903,18 +2904,19 @@ static int earcrx_cmdc_setup(struct earc *p_earc)
static void send_uevent_work_func(struct work_struct *p_work)
{
struct earc *p_earc = container_of(p_work, struct earc, send_uevent);
struct earc *p_earc = container_of(p_work, struct earc, send_uevent.work);
enum attend_type type = earctx_cmdc_get_attended_type(p_earc->tx_cmdc_map);
mutex_lock(&earc_mutex);
if (!p_earc->resumed)
earc_clock_enable();
if (type == ATNDTYP_ARC) {
msleep(700);
earctx_enable_d2a(p_earc->tx_top_map, true);
earctx_update_attend_event(p_earc, false, true);
} else if (type == ATNDTYP_DISCNCT) {
earctx_update_attend_event(p_earc, false, false);
} else {
earctx_update_attend_event(p_earc, true, true);
}
mutex_unlock(&earc_mutex);
}
@@ -3188,7 +3190,7 @@ static int earc_platform_probe(struct platform_device *pdev)
earctx_ss_ops.private = p_earc;
register_samesrc_ops(SHAREBUFFER_EARCTX, &earctx_ss_ops);
INIT_DELAYED_WORK(&p_earc->tx_resume_work, tx_resume_work_func);
INIT_WORK(&p_earc->send_uevent, send_uevent_work_func);
INIT_DELAYED_WORK(&p_earc->send_uevent, send_uevent_work_func);
INIT_WORK(&p_earc->tx_hold_bus_work, tx_hold_bus_work_func);
INIT_DELAYED_WORK(&p_earc->gain_disable, gain_disable_work_func);
}