mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
vout: add poll support for ioctl [1/4]
PD#SWPL-8450 Problem: need poll method for vout ioctl Solution: add poll support for vout ioctl Verify: x301 Change-Id: I9312e8ce9708d700f26d79ac5eadf762fac9bf62 Signed-off-by: Evoke Zhang <evoke.zhang@amlogic.com>
This commit is contained in:
@@ -35,6 +35,8 @@
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/cdev.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/clk-provider.h>
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/cdev.h>
|
||||
#include <linux/poll.h>
|
||||
#include <linux/workqueue.h>
|
||||
|
||||
/* Amlogic Headers */
|
||||
#include <linux/amlogic/media/vout/vout_notify.h>
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user