media: rockchip: hdmirx: add private v4l2 event

add private v4l2 event: RK_HDMIRX_V4L2_EVENT_SIGNAL_LOST

Signed-off-by: Dingxian Wen <shawn.wen@rock-chips.com>
Change-Id: Iad6f519b36ebb7e18305e211f989795c9ebe3fdc
This commit is contained in:
Dingxian Wen
2022-09-15 10:57:17 +08:00
committed by Tao Huang
parent 918a2722e2
commit 9e6cf9710f
2 changed files with 18 additions and 0 deletions

View File

@@ -441,6 +441,8 @@ static int hdmirx_subscribe_event(struct v4l2_fh *fh,
break;
case V4L2_EVENT_CTRL:
return v4l2_ctrl_subscribe_event(fh, sub);
case RK_HDMIRX_V4L2_EVENT_SIGNAL_LOST:
return v4l2_event_subscribe(fh, sub, 0, NULL);
default:
return v4l2_ctrl_subscribe_event(fh, sub);
@@ -2201,6 +2203,11 @@ static int hdmirx_register_stream_vdev(struct hdmirx_stream *stream)
static void process_signal_change(struct rk_hdmirx_dev *hdmirx_dev)
{
struct hdmirx_stream *stream = &hdmirx_dev->stream;
const struct v4l2_event evt_signal_lost = {
.type = RK_HDMIRX_V4L2_EVENT_SIGNAL_LOST,
};
hdmirx_update_bits(hdmirx_dev, DMA_CONFIG6, HDMIRX_DMA_EN, 0);
hdmirx_update_bits(hdmirx_dev, DMA_CONFIG4,
LINE_FLAG_INT_EN |
@@ -2212,6 +2219,7 @@ static void process_signal_change(struct rk_hdmirx_dev *hdmirx_dev)
HDMIRX_AXI_ERROR_INT_EN, 0);
hdmirx_reset_dma(hdmirx_dev);
hdmirx_dev->get_timing = false;
v4l2_event_queue(&stream->vdev, &evt_signal_lost);
if (hdmirx_dev->hdcp && hdmirx_dev->hdcp->hdcp_stop)
hdmirx_dev->hdcp->hdcp_stop(hdmirx_dev->hdcp);
schedule_delayed_work_on(hdmirx_dev->bound_cpu,
@@ -2665,10 +2673,15 @@ static void hdmirx_delayed_work_hotplug(struct work_struct *work)
struct rk_hdmirx_dev *hdmirx_dev = container_of(dwork,
struct rk_hdmirx_dev, delayed_work_hotplug);
struct v4l2_device *v4l2_dev = &hdmirx_dev->v4l2_dev;
struct hdmirx_stream *stream = &hdmirx_dev->stream;
const struct v4l2_event evt_signal_lost = {
.type = RK_HDMIRX_V4L2_EVENT_SIGNAL_LOST,
};
bool plugin;
mutex_lock(&hdmirx_dev->work_lock);
hdmirx_dev->get_timing = false;
v4l2_event_queue(&stream->vdev, &evt_signal_lost);
plugin = tx_5v_power_present(hdmirx_dev);
v4l2_ctrl_s_ctrl(hdmirx_dev->detect_tx_5v_ctrl, plugin);
v4l2_dbg(1, debug, v4l2_dev, "%s: plugin:%d\n", __func__, plugin);

View File

@@ -44,6 +44,7 @@ enum hdmirx_video_standard {
HDMIRX_BT2020_RGB = 6,
};
/* Private v4l2 ioctl */
#define RK_HDMIRX_CMD_GET_FPS \
_IOR('V', BASE_VIDIOC_PRIVATE + 0, int)
@@ -77,4 +78,8 @@ enum hdmirx_video_standard {
#define RK_HDMIRX_CMD_GET_COLOR_SPACE \
_IOR('V', BASE_VIDIOC_PRIVATE + 10, int)
/* Private v4l2 event */
#define RK_HDMIRX_V4L2_EVENT_SIGNAL_LOST \
(V4L2_EVENT_PRIVATE_START + 1)
#endif /* _UAPI_RK_HDMIRX_CONFIG_H */