Lines Matching refs:lt6911uxc
60 struct lt6911uxc { struct
191 static inline struct lt6911uxc *to_state(struct v4l2_subdev *sd) in to_state()
193 return container_of(sd, struct lt6911uxc, sd); in to_state()
198 struct lt6911uxc *lt6911uxc = to_state(sd); in i2c_rd() local
199 struct i2c_client *client = lt6911uxc->i2c_client; in i2c_rd()
236 struct lt6911uxc *lt6911uxc = to_state(sd); in i2c_wr() local
237 struct i2c_client *client = lt6911uxc->i2c_client; in i2c_wr()
301 struct lt6911uxc *lt6911uxc = to_state(sd); in tx_5v_power_present() local
304 if (!lt6911uxc->plugin_det_gpio) in tx_5v_power_present()
309 val = gpiod_get_value(lt6911uxc->plugin_det_gpio); in tx_5v_power_present()
324 struct lt6911uxc *lt6911uxc = to_state(sd); in no_signal() local
327 lt6911uxc->nosignal); in no_signal()
329 return lt6911uxc->nosignal; in no_signal()
334 struct lt6911uxc *lt6911uxc = to_state(sd); in audio_present() local
336 return lt6911uxc->is_audio_present; in audio_present()
341 struct lt6911uxc *lt6911uxc = to_state(sd); in get_audio_sampling_rate() local
346 return lt6911uxc->audio_sampling_rate; in get_audio_sampling_rate()
382 struct lt6911uxc *lt6911uxc = to_state(sd); in lt6911uxc_get_detected_timings() local
421 lt6911uxc->csi_lanes_in_use = lanes; in lt6911uxc_get_detected_timings()
461 lt6911uxc->nosignal = true; in lt6911uxc_get_detected_timings()
466 lt6911uxc->nosignal = false; in lt6911uxc_get_detected_timings()
468 lt6911uxc->is_audio_present = (value & BIT(5)) ? true : false; in lt6911uxc_get_detected_timings()
471 lt6911uxc->audio_sampling_rate = ((val_h << 8) | val_l) + 2; in lt6911uxc_get_detected_timings()
473 lt6911uxc->is_audio_present, in lt6911uxc_get_detected_timings()
474 lt6911uxc->audio_sampling_rate); in lt6911uxc_get_detected_timings()
509 struct lt6911uxc *lt6911uxc = to_state(sd); in lt6911uxc_config_hpd() local
516 gpiod_set_value(lt6911uxc->hpd_ctl_gpio, 1); in lt6911uxc_config_hpd()
518 lt6911uxc->nosignal = true; in lt6911uxc_config_hpd()
519 gpiod_set_value(lt6911uxc->hpd_ctl_gpio, 0); in lt6911uxc_config_hpd()
526 struct lt6911uxc *lt6911uxc = container_of(dwork, in lt6911uxc_delayed_work_enable_hotplug() local
527 struct lt6911uxc, delayed_work_enable_hotplug); in lt6911uxc_delayed_work_enable_hotplug()
528 struct v4l2_subdev *sd = <6911uxc->sd; in lt6911uxc_delayed_work_enable_hotplug()
532 v4l2_ctrl_s_ctrl(lt6911uxc->detect_tx_5v_ctrl, tx_5v_power_present(sd)); in lt6911uxc_delayed_work_enable_hotplug()
539 struct lt6911uxc *lt6911uxc = container_of(dwork, in lt6911uxc_delayed_work_res_change() local
540 struct lt6911uxc, delayed_work_res_change); in lt6911uxc_delayed_work_res_change()
541 struct v4l2_subdev *sd = <6911uxc->sd; in lt6911uxc_delayed_work_res_change()
549 struct lt6911uxc *lt6911uxc = to_state(sd); in lt6911uxc_s_ctrl_detect_tx_5v() local
551 return v4l2_ctrl_s_ctrl(lt6911uxc->detect_tx_5v_ctrl, in lt6911uxc_s_ctrl_detect_tx_5v()
557 struct lt6911uxc *lt6911uxc = to_state(sd); in lt6911uxc_s_ctrl_audio_sampling_rate() local
559 return v4l2_ctrl_s_ctrl(lt6911uxc->audio_sampling_rate_ctrl, in lt6911uxc_s_ctrl_audio_sampling_rate()
565 struct lt6911uxc *lt6911uxc = to_state(sd); in lt6911uxc_s_ctrl_audio_present() local
567 return v4l2_ctrl_s_ctrl(lt6911uxc->audio_present_ctrl, in lt6911uxc_s_ctrl_audio_present()
590 struct lt6911uxc *lt6911uxc = to_state(sd); in lt6911uxc_format_change() local
602 if (!v4l2_match_dv_timings(<6911uxc->timings, &timings, 0, in lt6911uxc_format_change()
619 struct lt6911uxc *lt6911uxc = to_state(sd); in lt6911uxc_isr() local
621 schedule_delayed_work(<6911uxc->delayed_work_res_change, HZ / 20); in lt6911uxc_isr()
629 struct lt6911uxc *lt6911uxc = dev_id; in lt6911uxc_res_change_irq_handler() local
632 lt6911uxc_isr(<6911uxc->sd, 0, &handled); in lt6911uxc_res_change_irq_handler()
639 struct lt6911uxc *lt6911uxc = dev_id; in plugin_detect_irq_handler() local
640 struct v4l2_subdev *sd = <6911uxc->sd; in plugin_detect_irq_handler()
643 schedule_delayed_work(<6911uxc->delayed_work_enable_hotplug, in plugin_detect_irq_handler()
675 struct lt6911uxc *lt6911uxc = to_state(sd); in lt6911uxc_s_dv_timings() local
683 if (v4l2_match_dv_timings(<6911uxc->timings, timings, 0, false)) { in lt6911uxc_s_dv_timings()
694 lt6911uxc->timings = *timings; in lt6911uxc_s_dv_timings()
704 struct lt6911uxc *lt6911uxc = to_state(sd); in lt6911uxc_g_dv_timings() local
706 *timings = lt6911uxc->timings; in lt6911uxc_g_dv_timings()
724 struct lt6911uxc *lt6911uxc = to_state(sd); in lt6911uxc_query_dv_timings() local
726 *timings = lt6911uxc->timings; in lt6911uxc_query_dv_timings()
754 struct lt6911uxc *lt6911uxc = to_state(sd); in lt6911uxc_g_mbus_config() local
759 switch (lt6911uxc->csi_lanes_in_use) { in lt6911uxc_g_mbus_config()
841 struct lt6911uxc *lt6911uxc = to_state(sd); in lt6911uxc_get_fmt() local
843 mutex_lock(<6911uxc->confctl_mutex); in lt6911uxc_get_fmt()
844 format->format.code = lt6911uxc->mbus_fmt_code; in lt6911uxc_get_fmt()
845 format->format.width = lt6911uxc->timings.bt.width; in lt6911uxc_get_fmt()
846 format->format.height = lt6911uxc->timings.bt.height; in lt6911uxc_get_fmt()
848 lt6911uxc->timings.bt.interlaced ? in lt6911uxc_get_fmt()
851 mutex_unlock(<6911uxc->confctl_mutex); in lt6911uxc_get_fmt()
891 struct lt6911uxc *lt6911uxc = to_state(sd); in lt6911uxc_set_fmt() local
915 lt6911uxc->mbus_fmt_code = format->format.code; in lt6911uxc_set_fmt()
917 lt6911uxc->cur_mode = mode; in lt6911uxc_set_fmt()
926 __v4l2_ctrl_s_ctrl(lt6911uxc->link_freq, index); in lt6911uxc_set_fmt()
936 struct lt6911uxc *lt6911uxc = to_state(sd); in lt6911uxc_g_frame_interval() local
937 const struct lt6911uxc_mode *mode = lt6911uxc->cur_mode; in lt6911uxc_g_frame_interval()
939 mutex_lock(<6911uxc->confctl_mutex); in lt6911uxc_g_frame_interval()
941 mutex_unlock(<6911uxc->confctl_mutex); in lt6911uxc_g_frame_interval()
946 static void lt6911uxc_get_module_inf(struct lt6911uxc *lt6911uxc, in lt6911uxc_get_module_inf() argument
951 strscpy(inf->base.module, lt6911uxc->module_name, sizeof(inf->base.module)); in lt6911uxc_get_module_inf()
952 strscpy(inf->base.lens, lt6911uxc->len_name, sizeof(inf->base.lens)); in lt6911uxc_get_module_inf()
957 struct lt6911uxc *lt6911uxc = to_state(sd); in lt6911uxc_ioctl() local
962 lt6911uxc_get_module_inf(lt6911uxc, (struct rkmodule_inf *)arg); in lt6911uxc_ioctl()
1082 static void lt6911uxc_reset(struct lt6911uxc *lt6911uxc) in lt6911uxc_reset() argument
1084 gpiod_set_value(lt6911uxc->reset_gpio, 0); in lt6911uxc_reset()
1086 gpiod_set_value(lt6911uxc->reset_gpio, 1); in lt6911uxc_reset()
1088 gpiod_set_value(lt6911uxc->reset_gpio, 0); in lt6911uxc_reset()
1092 static int lt6911uxc_init_v4l2_ctrls(struct lt6911uxc *lt6911uxc) in lt6911uxc_init_v4l2_ctrls() argument
1097 sd = <6911uxc->sd; in lt6911uxc_init_v4l2_ctrls()
1098 ret = v4l2_ctrl_handler_init(<6911uxc->hdl, 5); in lt6911uxc_init_v4l2_ctrls()
1102 lt6911uxc->link_freq = v4l2_ctrl_new_int_menu(<6911uxc->hdl, NULL, in lt6911uxc_init_v4l2_ctrls()
1106 v4l2_ctrl_new_std(<6911uxc->hdl, NULL, V4L2_CID_PIXEL_RATE, in lt6911uxc_init_v4l2_ctrls()
1109 lt6911uxc->detect_tx_5v_ctrl = v4l2_ctrl_new_std(<6911uxc->hdl, in lt6911uxc_init_v4l2_ctrls()
1113 lt6911uxc->audio_sampling_rate_ctrl = in lt6911uxc_init_v4l2_ctrls()
1114 v4l2_ctrl_new_custom(<6911uxc->hdl, in lt6911uxc_init_v4l2_ctrls()
1116 lt6911uxc->audio_present_ctrl = v4l2_ctrl_new_custom(<6911uxc->hdl, in lt6911uxc_init_v4l2_ctrls()
1119 sd->ctrl_handler = <6911uxc->hdl; in lt6911uxc_init_v4l2_ctrls()
1120 if (lt6911uxc->hdl.error) { in lt6911uxc_init_v4l2_ctrls()
1121 ret = lt6911uxc->hdl.error; in lt6911uxc_init_v4l2_ctrls()
1135 static int lt6911uxc_check_chip_id(struct lt6911uxc *lt6911uxc) in lt6911uxc_check_chip_id() argument
1137 struct device *dev = <6911uxc->i2c_client->dev; in lt6911uxc_check_chip_id()
1138 struct v4l2_subdev *sd = <6911uxc->sd; in lt6911uxc_check_chip_id()
1173 static int lt6911uxc_parse_of(struct lt6911uxc *lt6911uxc) in lt6911uxc_parse_of() argument
1175 struct device *dev = <6911uxc->i2c_client->dev; in lt6911uxc_parse_of()
1182 <6911uxc->module_index); in lt6911uxc_parse_of()
1184 <6911uxc->module_facing); in lt6911uxc_parse_of()
1186 <6911uxc->module_name); in lt6911uxc_parse_of()
1188 <6911uxc->len_name); in lt6911uxc_parse_of()
1194 lt6911uxc->power_gpio = devm_gpiod_get_optional(dev, "power", in lt6911uxc_parse_of()
1196 if (IS_ERR(lt6911uxc->power_gpio)) { in lt6911uxc_parse_of()
1198 ret = PTR_ERR(lt6911uxc->power_gpio); in lt6911uxc_parse_of()
1202 lt6911uxc->reset_gpio = devm_gpiod_get_optional(dev, "reset", in lt6911uxc_parse_of()
1204 if (IS_ERR(lt6911uxc->reset_gpio)) { in lt6911uxc_parse_of()
1206 ret = PTR_ERR(lt6911uxc->reset_gpio); in lt6911uxc_parse_of()
1210 lt6911uxc->plugin_det_gpio = devm_gpiod_get_optional(dev, "plugin-det", in lt6911uxc_parse_of()
1212 if (IS_ERR(lt6911uxc->plugin_det_gpio)) { in lt6911uxc_parse_of()
1214 ret = PTR_ERR(lt6911uxc->plugin_det_gpio); in lt6911uxc_parse_of()
1218 lt6911uxc->hpd_ctl_gpio = devm_gpiod_get_optional(dev, "hpd-ctl", in lt6911uxc_parse_of()
1220 if (IS_ERR(lt6911uxc->hpd_ctl_gpio)) { in lt6911uxc_parse_of()
1222 ret = PTR_ERR(lt6911uxc->hpd_ctl_gpio); in lt6911uxc_parse_of()
1246 lt6911uxc->xvclk = devm_clk_get(dev, "xvclk"); in lt6911uxc_parse_of()
1247 if (IS_ERR(lt6911uxc->xvclk)) { in lt6911uxc_parse_of()
1253 ret = clk_prepare_enable(lt6911uxc->xvclk); in lt6911uxc_parse_of()
1259 lt6911uxc->csi_lanes_in_use = endpoint.bus.mipi_csi2.num_data_lanes; in lt6911uxc_parse_of()
1260 lt6911uxc->bus = endpoint.bus.mipi_csi2; in lt6911uxc_parse_of()
1261 lt6911uxc->enable_hdcp = false; in lt6911uxc_parse_of()
1263 gpiod_set_value(lt6911uxc->hpd_ctl_gpio, 0); in lt6911uxc_parse_of()
1264 gpiod_set_value(lt6911uxc->power_gpio, 1); in lt6911uxc_parse_of()
1265 lt6911uxc_reset(lt6911uxc); in lt6911uxc_parse_of()
1276 static inline int lt6911uxc_parse_of(struct lt6911uxc *lt6911uxc) in lt6911uxc_parse_of() argument
1287 struct lt6911uxc *lt6911uxc; in lt6911uxc_probe() local
1298 lt6911uxc = devm_kzalloc(dev, sizeof(struct lt6911uxc), GFP_KERNEL); in lt6911uxc_probe()
1299 if (!lt6911uxc) in lt6911uxc_probe()
1302 sd = <6911uxc->sd; in lt6911uxc_probe()
1303 lt6911uxc->i2c_client = client; in lt6911uxc_probe()
1304 lt6911uxc->timings = default_timing; in lt6911uxc_probe()
1305 lt6911uxc->cur_mode = &supported_modes[0]; in lt6911uxc_probe()
1306 lt6911uxc->mbus_fmt_code = LT6911UXC_MEDIA_BUS_FMT; in lt6911uxc_probe()
1308 err = lt6911uxc_parse_of(lt6911uxc); in lt6911uxc_probe()
1314 err = lt6911uxc_check_chip_id(lt6911uxc); in lt6911uxc_probe()
1321 lt6911uxc_reset(lt6911uxc); in lt6911uxc_probe()
1323 mutex_init(<6911uxc->confctl_mutex); in lt6911uxc_probe()
1324 err = lt6911uxc_init_v4l2_ctrls(lt6911uxc); in lt6911uxc_probe()
1335 lt6911uxc->pad.flags = MEDIA_PAD_FL_SOURCE; in lt6911uxc_probe()
1337 err = media_entity_pads_init(&sd->entity, 1, <6911uxc->pad); in lt6911uxc_probe()
1344 if (strcmp(lt6911uxc->module_facing, "back") == 0) in lt6911uxc_probe()
1350 lt6911uxc->module_index, facing, in lt6911uxc_probe()
1358 INIT_DELAYED_WORK(<6911uxc->delayed_work_enable_hotplug, in lt6911uxc_probe()
1360 INIT_DELAYED_WORK(<6911uxc->delayed_work_res_change, in lt6911uxc_probe()
1363 if (lt6911uxc->i2c_client->irq) { in lt6911uxc_probe()
1366 lt6911uxc->i2c_client->irq, in lt6911uxc_probe()
1369 "lt6911uxc", lt6911uxc); in lt6911uxc_probe()
1380 lt6911uxc->plugin_irq = gpiod_to_irq(lt6911uxc->plugin_det_gpio); in lt6911uxc_probe()
1381 if (lt6911uxc->plugin_irq < 0) in lt6911uxc_probe()
1384 err = devm_request_threaded_irq(dev, lt6911uxc->plugin_irq, NULL, in lt6911uxc_probe()
1387 lt6911uxc); in lt6911uxc_probe()
1404 cancel_delayed_work(<6911uxc->delayed_work_enable_hotplug); in lt6911uxc_probe()
1405 cancel_delayed_work(<6911uxc->delayed_work_res_change); in lt6911uxc_probe()
1411 v4l2_ctrl_handler_free(<6911uxc->hdl); in lt6911uxc_probe()
1412 mutex_destroy(<6911uxc->confctl_mutex); in lt6911uxc_probe()
1419 struct lt6911uxc *lt6911uxc = to_state(sd); in lt6911uxc_remove() local
1421 cancel_delayed_work_sync(<6911uxc->delayed_work_enable_hotplug); in lt6911uxc_remove()
1422 cancel_delayed_work_sync(<6911uxc->delayed_work_res_change); in lt6911uxc_remove()
1428 v4l2_ctrl_handler_free(<6911uxc->hdl); in lt6911uxc_remove()
1429 mutex_destroy(<6911uxc->confctl_mutex); in lt6911uxc_remove()
1430 clk_disable_unprepare(lt6911uxc->xvclk); in lt6911uxc_remove()