mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
vout: optimize display mode changing flow
PD#161389: vout: optimize display mode changing flow Change-Id: I29fadc879d1915917ffe19e3a4fa08ae36f36fd8 Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
This commit is contained in:
@@ -83,26 +83,29 @@ static int lcd_set_current_vmode(enum vmode_e mode)
|
||||
int ret = 0;
|
||||
struct aml_lcd_drv_s *lcd_drv = aml_lcd_get_driver();
|
||||
|
||||
mutex_lock(&lcd_vout_mutex);
|
||||
mutex_lock(&lcd_drv->power_mutex);
|
||||
|
||||
if (!(mode & VMODE_INIT_BIT_MASK)) {
|
||||
if (VMODE_LCD == (mode & VMODE_MODE_BIT_MASK)) {
|
||||
lcd_drv->driver_init_pre();
|
||||
ret = lcd_drv->driver_init();
|
||||
} else {
|
||||
if (VMODE_LCD == (mode & VMODE_MODE_BIT_MASK))
|
||||
aml_lcd_notifier_call_chain(LCD_EVENT_POWER_ON, NULL);
|
||||
else
|
||||
ret = -EINVAL;
|
||||
}
|
||||
} else
|
||||
lcd_clk_gate_switch(1);
|
||||
|
||||
mutex_unlock(&lcd_vout_mutex);
|
||||
mutex_unlock(&lcd_drv->power_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int lcd_vout_disable(enum vmode_e cur_vmod)
|
||||
{
|
||||
aml_lcd_notifier_call_chain(LCD_EVENT_IF_POWER_OFF, NULL);
|
||||
struct aml_lcd_drv_s *lcd_drv = aml_lcd_get_driver();
|
||||
|
||||
mutex_lock(&lcd_drv->power_mutex);
|
||||
aml_lcd_notifier_call_chain(LCD_EVENT_POWER_OFF, NULL);
|
||||
LCDPR("%s finished\n", __func__);
|
||||
mutex_unlock(&lcd_drv->power_mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -284,7 +284,7 @@ static int lcd_set_current_vmode(enum vmode_e mode)
|
||||
LCDPR("vout_serve bypass\n");
|
||||
return 0;
|
||||
}
|
||||
mutex_lock(&lcd_vout_mutex);
|
||||
mutex_lock(&lcd_drv->power_mutex);
|
||||
|
||||
/* do not change mode value here, for bit mask is useful */
|
||||
lcd_vmode_vinfo_update(mode & VMODE_MODE_BIT_MASK);
|
||||
@@ -292,7 +292,9 @@ static int lcd_set_current_vmode(enum vmode_e mode)
|
||||
if (!(mode & VMODE_INIT_BIT_MASK)) {
|
||||
switch (mode & VMODE_MODE_BIT_MASK) {
|
||||
case VMODE_LCD:
|
||||
mutex_lock(&lcd_vout_mutex);
|
||||
ret = lcd_drv->driver_change();
|
||||
mutex_unlock(&lcd_vout_mutex);
|
||||
break;
|
||||
default:
|
||||
ret = -EINVAL;
|
||||
@@ -300,7 +302,7 @@ static int lcd_set_current_vmode(enum vmode_e mode)
|
||||
} else
|
||||
lcd_clk_gate_switch(1);
|
||||
|
||||
mutex_unlock(&lcd_vout_mutex);
|
||||
mutex_unlock(&lcd_drv->power_mutex);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,8 +121,8 @@ static inline int vout_func_check_state(int index, unsigned int state,
|
||||
static void vout_func_update_viu(int index, struct vout_server_s *p_server)
|
||||
{
|
||||
struct vinfo_s *vinfo = NULL;
|
||||
unsigned int mux_bit = 0, mux_sel = 3;
|
||||
unsigned int clk_bit = 0, clk_sel = 0;
|
||||
unsigned int mux_bit = 0xff, mux_sel = VIU_MUX_MAX;
|
||||
unsigned int clk_bit = 0xff, clk_sel = 0;
|
||||
|
||||
if (p_server->op.get_vinfo)
|
||||
vinfo = p_server->op.get_vinfo();
|
||||
@@ -157,8 +157,12 @@ static void vout_func_update_viu(int index, struct vout_server_s *p_server)
|
||||
break;
|
||||
}
|
||||
|
||||
vout_func_vcbus_setb(VPU_VIU_VENC_MUX_CTRL, mux_sel, mux_bit, 2);
|
||||
vout_func_vcbus_setb(VPU_VENCX_CLK_CTRL, clk_sel, clk_bit, 1);
|
||||
if (mux_bit < 0xff) {
|
||||
vout_func_vcbus_setb(VPU_VIU_VENC_MUX_CTRL,
|
||||
mux_sel, mux_bit, 2);
|
||||
}
|
||||
if (clk_bit < 0xff)
|
||||
vout_func_vcbus_setb(VPU_VENCX_CLK_CTRL, clk_sel, clk_bit, 1);
|
||||
|
||||
#if 0
|
||||
VOUTPR("%s: %d, mux_sel=%d, clk_sel=%d\n",
|
||||
@@ -193,8 +197,6 @@ int vout_func_set_current_vmode(int index, enum vmode_e mode)
|
||||
|
||||
if (p_server->op.vmode_is_supported(mode) == true) {
|
||||
p_module->curr_vout_server = p_server;
|
||||
vout_func_update_viu(index, p_server);
|
||||
ret = p_server->op.set_vmode(mode);
|
||||
if (p_server->op.set_state)
|
||||
p_server->op.set_state(index);
|
||||
} else {
|
||||
@@ -207,6 +209,8 @@ int vout_func_set_current_vmode(int index, enum vmode_e mode)
|
||||
p_server->op.clr_state(index);
|
||||
}
|
||||
}
|
||||
vout_func_update_viu(index, p_module->curr_vout_server);
|
||||
ret = p_module->curr_vout_server->op.set_vmode(mode);
|
||||
|
||||
mutex_unlock(&vout_mutex);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user