From 9010eda8301230cdea085598cd1660993c2fde99 Mon Sep 17 00:00:00 2001 From: Jianwei Fan Date: Tue, 5 Jul 2022 07:47:27 +0000 Subject: [PATCH] media: i2c: lt6911uxc: fix hotplug event report Signed-off-by: Jianwei Fan Change-Id: Iff105f294deaf39e3bb24c0a2376ac11b3cc9bfd --- drivers/media/i2c/lt6911uxc.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/drivers/media/i2c/lt6911uxc.c b/drivers/media/i2c/lt6911uxc.c index 60d507ec2746..30538f6de9b9 100644 --- a/drivers/media/i2c/lt6911uxc.c +++ b/drivers/media/i2c/lt6911uxc.c @@ -522,6 +522,8 @@ static void lt6911uxc_delayed_work_enable_hotplug(struct work_struct *work) struct v4l2_subdev *sd = <6911uxc->sd; v4l2_dbg(2, debug, sd, "%s:\n", __func__); + + v4l2_ctrl_s_ctrl(lt6911uxc->detect_tx_5v_ctrl, tx_5v_power_present(sd)); lt6911uxc_config_hpd(sd); } @@ -606,21 +608,6 @@ static void lt6911uxc_format_change(struct v4l2_subdev *sd) v4l2_subdev_notify_event(sd, <6911uxc_ev_fmt); } -static int lt6911uxc_get_ctrl(struct v4l2_ctrl *ctrl) -{ - int ret = -1; - struct lt6911uxc *lt6911uxc = container_of(ctrl->handler, - struct lt6911uxc, hdl); - struct v4l2_subdev *sd = &(lt6911uxc->sd); - - if (ctrl->id == V4L2_CID_DV_RX_POWER_PRESENT) { - ret = tx_5v_power_present(sd); - *ctrl->p_new.p_s32 = ret; - } - - return ret; -} - static int lt6911uxc_isr(struct v4l2_subdev *sd, u32 status, bool *handled) { struct lt6911uxc *lt6911uxc = to_state(sd); @@ -1011,10 +998,6 @@ static long lt6911uxc_compat_ioctl32(struct v4l2_subdev *sd, } #endif -static const struct v4l2_ctrl_ops lt6911uxc_ctrl_ops = { - .g_volatile_ctrl = lt6911uxc_get_ctrl, -}; - static const struct v4l2_subdev_core_ops lt6911uxc_core_ops = { .interrupt_service_routine = lt6911uxc_isr, .subscribe_event = lt6911uxc_subscribe_event, @@ -1101,10 +1084,8 @@ static int lt6911uxc_init_v4l2_ctrls(struct lt6911uxc *lt6911uxc) 0, LT6911UXC_PIXEL_RATE, 1, LT6911UXC_PIXEL_RATE); lt6911uxc->detect_tx_5v_ctrl = v4l2_ctrl_new_std(<6911uxc->hdl, - <6911uxc_ctrl_ops, V4L2_CID_DV_RX_POWER_PRESENT, + NULL, V4L2_CID_DV_RX_POWER_PRESENT, 0, 1, 0, 0); - if (lt6911uxc->detect_tx_5v_ctrl) - lt6911uxc->detect_tx_5v_ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE; lt6911uxc->audio_sampling_rate_ctrl = v4l2_ctrl_new_custom(<6911uxc->hdl,