Lines Matching refs:lt7911d

180 	struct lt7911d_state *lt7911d = to_state(sd);  in i2c_rd()  local
181 struct i2c_client *client = lt7911d->i2c_client; in i2c_rd()
232 struct lt7911d_state *lt7911d = to_state(sd); in i2c_wr() local
233 struct i2c_client *client = lt7911d->i2c_client; in i2c_wr()
315 struct lt7911d_state *lt7911d = to_state(sd); in tx_5v_power_present() local
318 if (!lt7911d->plugin_det_gpio) in tx_5v_power_present()
323 val = gpiod_get_value(lt7911d->plugin_det_gpio); in tx_5v_power_present()
337 struct lt7911d_state *lt7911d = to_state(sd); in no_signal() local
340 lt7911d->nosignal); in no_signal()
342 return lt7911d->nosignal; in no_signal()
347 struct lt7911d_state *lt7911d = to_state(sd); in audio_present() local
349 return lt7911d->is_audio_present; in audio_present()
398 struct lt7911d_state *lt7911d = to_state(sd); in lt7911d_get_detected_timings() local
450 lt7911d->nosignal = true; in lt7911d_get_detected_timings()
455 lt7911d->nosignal = false; in lt7911d_get_detected_timings()
456 lt7911d->is_audio_present = true; in lt7911d_get_detected_timings()
483 struct lt7911d_state *lt7911d = container_of(dwork, in lt7911d_delayed_work_enable_hotplug() local
485 struct v4l2_subdev *sd = &lt7911d->sd; in lt7911d_delayed_work_enable_hotplug()
487 v4l2_ctrl_s_ctrl(lt7911d->detect_tx_5v_ctrl, tx_5v_power_present(sd)); in lt7911d_delayed_work_enable_hotplug()
493 struct lt7911d_state *lt7911d = container_of(dwork, in lt7911d_delayed_work_res_change() local
495 struct v4l2_subdev *sd = &lt7911d->sd; in lt7911d_delayed_work_res_change()
502 struct lt7911d_state *lt7911d = to_state(sd); in lt7911d_s_ctrl_detect_tx_5v() local
504 return v4l2_ctrl_s_ctrl(lt7911d->detect_tx_5v_ctrl, in lt7911d_s_ctrl_detect_tx_5v()
510 struct lt7911d_state *lt7911d = to_state(sd); in lt7911d_s_ctrl_audio_sampling_rate() local
512 return v4l2_ctrl_s_ctrl(lt7911d->audio_sampling_rate_ctrl, in lt7911d_s_ctrl_audio_sampling_rate()
518 struct lt7911d_state *lt7911d = to_state(sd); in lt7911d_s_ctrl_audio_present() local
520 return v4l2_ctrl_s_ctrl(lt7911d->audio_present_ctrl, in lt7911d_s_ctrl_audio_present()
543 struct lt7911d_state *lt7911d = to_state(sd); in lt7911d_format_change() local
555 if (!v4l2_match_dv_timings(&lt7911d->timings, &timings, 0, false)) { in lt7911d_format_change()
571 struct lt7911d_state *lt7911d = to_state(sd); in lt7911d_isr() local
573 schedule_delayed_work(&lt7911d->delayed_work_res_change, HZ / 20); in lt7911d_isr()
581 struct lt7911d_state *lt7911d = dev_id; in lt7911d_res_change_irq_handler() local
584 lt7911d_isr(&lt7911d->sd, 0, &handled); in lt7911d_res_change_irq_handler()
591 struct lt7911d_state *lt7911d = dev_id; in plugin_detect_irq_handler() local
594 schedule_delayed_work(&lt7911d->delayed_work_enable_hotplug, in plugin_detect_irq_handler()
602 struct lt7911d_state *lt7911d = from_timer(lt7911d, t, timer); in lt7911d_irq_poll_timer() local
604 schedule_work(&lt7911d->work_i2c_poll); in lt7911d_irq_poll_timer()
605 mod_timer(&lt7911d->timer, jiffies + msecs_to_jiffies(POLL_INTERVAL_MS)); in lt7911d_irq_poll_timer()
610 struct lt7911d_state *lt7911d = container_of(work, in lt7911d_work_i2c_poll() local
612 struct v4l2_subdev *sd = &lt7911d->sd; in lt7911d_work_i2c_poll()
643 struct lt7911d_state *lt7911d = to_state(sd); in lt7911d_s_dv_timings() local
652 if (v4l2_match_dv_timings(&lt7911d->timings, timings, 0, false)) { in lt7911d_s_dv_timings()
663 lt7911d->timings = *timings; in lt7911d_s_dv_timings()
673 struct lt7911d_state *lt7911d = to_state(sd); in lt7911d_g_dv_timings() local
675 *timings = lt7911d->timings; in lt7911d_g_dv_timings()
693 struct lt7911d_state *lt7911d = to_state(sd); in lt7911d_query_dv_timings() local
695 *timings = lt7911d->timings; in lt7911d_query_dv_timings()
725 struct lt7911d_state *lt7911d = to_state(sd); in lt7911d_g_mbus_config() local
731 switch (lt7911d->csi_lanes_in_use) { in lt7911d_g_mbus_config()
797 struct lt7911d_state *lt7911d = to_state(sd); in lt7911d_get_fmt() local
799 mutex_lock(&lt7911d->confctl_mutex); in lt7911d_get_fmt()
800 format->format.code = lt7911d->mbus_fmt_code; in lt7911d_get_fmt()
801 format->format.width = lt7911d->timings.bt.width; in lt7911d_get_fmt()
802 format->format.height = lt7911d->timings.bt.height; in lt7911d_get_fmt()
804 lt7911d->timings.bt.interlaced ? in lt7911d_get_fmt()
807 mutex_unlock(&lt7911d->confctl_mutex); in lt7911d_get_fmt()
863 struct lt7911d_state *lt7911d = to_state(sd); in lt7911d_set_fmt() local
886 lt7911d->mbus_fmt_code = format->format.code; in lt7911d_set_fmt()
888 lt7911d->cur_mode = mode; in lt7911d_set_fmt()
897 struct lt7911d_state *lt7911d = to_state(sd); in lt7911d_g_frame_interval() local
898 const struct lt7911d_mode *mode = lt7911d->cur_mode; in lt7911d_g_frame_interval()
900 mutex_lock(&lt7911d->confctl_mutex); in lt7911d_g_frame_interval()
902 mutex_unlock(&lt7911d->confctl_mutex); in lt7911d_g_frame_interval()
907 static void lt7911d_get_module_inf(struct lt7911d_state *lt7911d, in lt7911d_get_module_inf() argument
912 strscpy(inf->base.module, lt7911d->module_name, sizeof(inf->base.module)); in lt7911d_get_module_inf()
913 strscpy(inf->base.lens, lt7911d->len_name, sizeof(inf->base.lens)); in lt7911d_get_module_inf()
918 struct lt7911d_state *lt7911d = to_state(sd); in lt7911d_ioctl() local
923 lt7911d_get_module_inf(lt7911d, (struct rkmodule_inf *)arg); in lt7911d_ioctl()
1043 static int lt7911d_init_v4l2_ctrls(struct lt7911d_state *lt7911d) in lt7911d_init_v4l2_ctrls() argument
1048 sd = &lt7911d->sd; in lt7911d_init_v4l2_ctrls()
1049 ret = v4l2_ctrl_handler_init(&lt7911d->hdl, 5); in lt7911d_init_v4l2_ctrls()
1053 lt7911d->link_freq = v4l2_ctrl_new_int_menu(&lt7911d->hdl, NULL, in lt7911d_init_v4l2_ctrls()
1057 lt7911d->pixel_rate = v4l2_ctrl_new_std(&lt7911d->hdl, NULL, in lt7911d_init_v4l2_ctrls()
1061 lt7911d->detect_tx_5v_ctrl = v4l2_ctrl_new_std(&lt7911d->hdl, in lt7911d_init_v4l2_ctrls()
1065 lt7911d->audio_sampling_rate_ctrl = in lt7911d_init_v4l2_ctrls()
1066 v4l2_ctrl_new_custom(&lt7911d->hdl, in lt7911d_init_v4l2_ctrls()
1068 lt7911d->audio_present_ctrl = v4l2_ctrl_new_custom(&lt7911d->hdl, in lt7911d_init_v4l2_ctrls()
1071 sd->ctrl_handler = &lt7911d->hdl; in lt7911d_init_v4l2_ctrls()
1072 if (lt7911d->hdl.error) { in lt7911d_init_v4l2_ctrls()
1073 ret = lt7911d->hdl.error; in lt7911d_init_v4l2_ctrls()
1078 __v4l2_ctrl_s_ctrl(lt7911d->link_freq, link_freq_menu_items[0]); in lt7911d_init_v4l2_ctrls()
1079 __v4l2_ctrl_s_ctrl_int64(lt7911d->pixel_rate, LT7911D_PIXEL_RATE); in lt7911d_init_v4l2_ctrls()
1091 static int lt7911d_probe_of(struct lt7911d_state *lt7911d) in lt7911d_probe_of() argument
1093 struct device *dev = &lt7911d->i2c_client->dev; in lt7911d_probe_of()
1100 &lt7911d->module_index); in lt7911d_probe_of()
1102 &lt7911d->module_facing); in lt7911d_probe_of()
1104 &lt7911d->module_name); in lt7911d_probe_of()
1106 &lt7911d->len_name); in lt7911d_probe_of()
1112 lt7911d->power_gpio = devm_gpiod_get_optional(dev, "power", in lt7911d_probe_of()
1114 if (IS_ERR(lt7911d->power_gpio)) { in lt7911d_probe_of()
1116 ret = PTR_ERR(lt7911d->power_gpio); in lt7911d_probe_of()
1120 lt7911d->reset_gpio = devm_gpiod_get_optional(dev, "reset", in lt7911d_probe_of()
1122 if (IS_ERR(lt7911d->reset_gpio)) { in lt7911d_probe_of()
1124 ret = PTR_ERR(lt7911d->reset_gpio); in lt7911d_probe_of()
1128 lt7911d->plugin_det_gpio = devm_gpiod_get_optional(dev, "plugin-det", in lt7911d_probe_of()
1130 if (IS_ERR(lt7911d->plugin_det_gpio)) { in lt7911d_probe_of()
1132 ret = PTR_ERR(lt7911d->plugin_det_gpio); in lt7911d_probe_of()
1155 lt7911d->xvclk = devm_clk_get(dev, "xvclk"); in lt7911d_probe_of()
1156 if (IS_ERR(lt7911d->xvclk)) { in lt7911d_probe_of()
1162 ret = clk_prepare_enable(lt7911d->xvclk); in lt7911d_probe_of()
1168 lt7911d->csi_lanes_in_use = endpoint.bus.mipi_csi2.num_data_lanes; in lt7911d_probe_of()
1169 lt7911d->bus = endpoint.bus.mipi_csi2; in lt7911d_probe_of()
1170 lt7911d->enable_hdcp = false; in lt7911d_probe_of()
1172 gpiod_set_value(lt7911d->power_gpio, 1); in lt7911d_probe_of()
1174 gpiod_set_value(lt7911d->reset_gpio, 0); in lt7911d_probe_of()
1190 static int lt7911d_check_chip_id(struct lt7911d_state *lt7911d) in lt7911d_check_chip_id() argument
1192 struct device *dev = &lt7911d->i2c_client->dev; in lt7911d_check_chip_id()
1193 struct v4l2_subdev *sd = &lt7911d->sd; in lt7911d_check_chip_id()
1217 struct lt7911d_state *lt7911d; in lt7911d_probe() local
1228 lt7911d = devm_kzalloc(dev, sizeof(struct lt7911d_state), GFP_KERNEL); in lt7911d_probe()
1229 if (!lt7911d) in lt7911d_probe()
1232 sd = &lt7911d->sd; in lt7911d_probe()
1233 lt7911d->i2c_client = client; in lt7911d_probe()
1234 lt7911d->cur_mode = &supported_modes[0]; in lt7911d_probe()
1235 lt7911d->mbus_fmt_code = LT7911D_MEDIA_BUS_FMT; in lt7911d_probe()
1237 err = lt7911d_probe_of(lt7911d); in lt7911d_probe()
1243 err = lt7911d_check_chip_id(lt7911d); in lt7911d_probe()
1247 mutex_init(&lt7911d->confctl_mutex); in lt7911d_probe()
1248 err = lt7911d_init_v4l2_ctrls(lt7911d); in lt7911d_probe()
1259 lt7911d->pad.flags = MEDIA_PAD_FL_SOURCE; in lt7911d_probe()
1261 err = media_entity_pads_init(&sd->entity, 1, &lt7911d->pad); in lt7911d_probe()
1268 if (strcmp(lt7911d->module_facing, "back") == 0) in lt7911d_probe()
1274 lt7911d->module_index, facing, in lt7911d_probe()
1282 INIT_DELAYED_WORK(&lt7911d->delayed_work_enable_hotplug, in lt7911d_probe()
1284 INIT_DELAYED_WORK(&lt7911d->delayed_work_res_change, in lt7911d_probe()
1287 if (lt7911d->i2c_client->irq) { in lt7911d_probe()
1290 lt7911d->i2c_client->irq, in lt7911d_probe()
1293 "lt7911d", lt7911d); in lt7911d_probe()
1300 INIT_WORK(&lt7911d->work_i2c_poll, lt7911d_work_i2c_poll); in lt7911d_probe()
1301 timer_setup(&lt7911d->timer, lt7911d_irq_poll_timer, 0); in lt7911d_probe()
1302 lt7911d->timer.expires = jiffies + in lt7911d_probe()
1304 add_timer(&lt7911d->timer); in lt7911d_probe()
1307 lt7911d->plugin_irq = gpiod_to_irq(lt7911d->plugin_det_gpio); in lt7911d_probe()
1308 if (lt7911d->plugin_irq < 0) in lt7911d_probe()
1311 err = devm_request_threaded_irq(dev, lt7911d->plugin_irq, NULL, in lt7911d_probe()
1314 lt7911d); in lt7911d_probe()
1330 if (!lt7911d->i2c_client->irq) in lt7911d_probe()
1331 flush_work(&lt7911d->work_i2c_poll); in lt7911d_probe()
1332 cancel_delayed_work(&lt7911d->delayed_work_enable_hotplug); in lt7911d_probe()
1333 cancel_delayed_work(&lt7911d->delayed_work_res_change); in lt7911d_probe()
1339 v4l2_ctrl_handler_free(&lt7911d->hdl); in lt7911d_probe()
1340 mutex_destroy(&lt7911d->confctl_mutex); in lt7911d_probe()
1347 struct lt7911d_state *lt7911d = to_state(sd); in lt7911d_remove() local
1349 if (!lt7911d->i2c_client->irq) { in lt7911d_remove()
1350 del_timer_sync(&lt7911d->timer); in lt7911d_remove()
1351 flush_work(&lt7911d->work_i2c_poll); in lt7911d_remove()
1353 cancel_delayed_work_sync(&lt7911d->delayed_work_enable_hotplug); in lt7911d_remove()
1354 cancel_delayed_work_sync(&lt7911d->delayed_work_res_change); in lt7911d_remove()
1360 v4l2_ctrl_handler_free(&lt7911d->hdl); in lt7911d_remove()
1361 mutex_destroy(&lt7911d->confctl_mutex); in lt7911d_remove()
1362 clk_disable_unprepare(lt7911d->xvclk); in lt7911d_remove()