diff --git a/drivers/amlogic/media/vout/vout_serve/vout2_serve.c b/drivers/amlogic/media/vout/vout_serve/vout2_serve.c index df9c2cd1058b..05bc9f2999e4 100644 --- a/drivers/amlogic/media/vout/vout_serve/vout2_serve.c +++ b/drivers/amlogic/media/vout/vout_serve/vout2_serve.c @@ -35,6 +35,8 @@ #include #include #include +#include +#include #include #include @@ -206,6 +208,12 @@ char *get_vout2_mode_internal(void) } EXPORT_SYMBOL(get_vout2_mode_internal); +static inline void vout2_setmode_wakeup_queue(void) +{ + if (vout2_cdev) + wake_up(&vout2_cdev->setmode_queue); +} + static int set_vout2_mode(char *name) { enum vmode_e mode; @@ -240,6 +248,7 @@ static int set_vout2_mode(char *name) vout2_notifier_call_chain(VOUT_EVENT_MODE_CHANGE, &mode); extcon_set_state_sync(vout2_excton_setmode, EXTCON_TYPE_DISP, 0); + vout2_setmode_wakeup_queue(); return ret; } @@ -670,6 +679,17 @@ static long vout2_compat_ioctl(struct file *file, unsigned int cmd, } #endif +static unsigned int vout2_poll(struct file *file, poll_table *wait) +{ + struct vout_cdev_s *vcdev = file->private_data; + unsigned int mask = 0; + + poll_wait(file, &vcdev->setmode_queue, wait); + mask = (POLLIN | POLLRDNORM); + + return mask; +} + static const struct file_operations vout2_fops = { .owner = THIS_MODULE, .open = vout2_io_open, @@ -678,6 +698,7 @@ static const struct file_operations vout2_fops = { #ifdef CONFIG_COMPAT .compat_ioctl = vout2_compat_ioctl, #endif + .poll = vout2_poll, }; static int vout2_fops_create(void) @@ -712,6 +733,8 @@ static int vout2_fops_create(void) goto vout2_fops_err3; } + init_waitqueue_head(&vout2_cdev->setmode_queue); + VOUTPR("vout2: %s OK\n", __func__); return 0; diff --git a/drivers/amlogic/media/vout/vout_serve/vout_func.h b/drivers/amlogic/media/vout/vout_serve/vout_func.h index a7e6d4c07e9b..5997077730ca 100644 --- a/drivers/amlogic/media/vout/vout_serve/vout_func.h +++ b/drivers/amlogic/media/vout/vout_serve/vout_func.h @@ -41,6 +41,7 @@ struct vout_cdev_s { dev_t devno; struct cdev cdev; struct device *dev; + wait_queue_head_t setmode_queue; }; #ifdef CONFIG_AMLOGIC_HDMITX diff --git a/drivers/amlogic/media/vout/vout_serve/vout_serve.c b/drivers/amlogic/media/vout/vout_serve/vout_serve.c index 550dc63949dc..ce346c7ea006 100644 --- a/drivers/amlogic/media/vout/vout_serve/vout_serve.c +++ b/drivers/amlogic/media/vout/vout_serve/vout_serve.c @@ -35,6 +35,8 @@ #include #include #include +#include +#include /* Amlogic Headers */ #include @@ -225,6 +227,15 @@ char *get_vout_mode_uboot(void) } EXPORT_SYMBOL(get_vout_mode_uboot); +static inline void vout_setmode_wakeup_queue(void) +{ + if (tvout_monitor_flag) + return; + + if (vout_cdev) + wake_up(&vout_cdev->setmode_queue); +} + int set_vout_mode(char *name) { enum vmode_e mode; @@ -259,6 +270,7 @@ int set_vout_mode(char *name) vout_notifier_call_chain(VOUT_EVENT_MODE_CHANGE, &mode); extcon_set_state_sync(vout_excton_setmode, EXTCON_TYPE_DISP, 0); + vout_setmode_wakeup_queue(); return ret; } @@ -694,6 +706,17 @@ static long vout_compat_ioctl(struct file *file, unsigned int cmd, } #endif +static unsigned int vout_poll(struct file *file, poll_table *wait) +{ + struct vout_cdev_s *vcdev = file->private_data; + unsigned int mask = 0; + + poll_wait(file, &vcdev->setmode_queue, wait); + mask = (POLLIN | POLLRDNORM); + + return mask; +} + static const struct file_operations vout_fops = { .owner = THIS_MODULE, .open = vout_io_open, @@ -702,6 +725,7 @@ static const struct file_operations vout_fops = { #ifdef CONFIG_COMPAT .compat_ioctl = vout_compat_ioctl, #endif + .poll = vout_poll, }; static int vout_fops_create(void) @@ -736,6 +760,8 @@ static int vout_fops_create(void) goto vout_fops_err3; } + init_waitqueue_head(&vout_cdev->setmode_queue); + VOUTPR("%s OK\n", __func__); return 0;