Lines Matching refs:state

122 	struct tc358743_state *state = to_state(sd);  in i2c_rd()  local
123 struct i2c_client *client = state->i2c_client; in i2c_rd()
150 struct tc358743_state *state = to_state(sd); in i2c_wr() local
151 struct i2c_client *client = state->i2c_client; in i2c_wr()
152 u8 *data = state->wr_data; in i2c_wr()
156 if ((2 + n) > sizeof(state->wr_data)) in i2c_wr()
365 struct tc358743_state *state = container_of(dwork, in tc358743_delayed_work_enable_hotplug() local
367 struct v4l2_subdev *sd = &state->sd; in tc358743_delayed_work_enable_hotplug()
406 struct tc358743_state *state = to_state(sd); in tc358743_disable_edid() local
410 cancel_delayed_work_sync(&state->delayed_work_enable_hotplug); in tc358743_disable_edid()
419 struct tc358743_state *state = to_state(sd); in tc358743_enable_edid() local
421 if (state->edid_blocks_written == 0) { in tc358743_enable_edid()
430 queue_delayed_work(state->work_queues, in tc358743_enable_edid()
431 &state->delayed_work_enable_hotplug, HZ / 10); in tc358743_enable_edid()
473 struct tc358743_state *state = to_state(sd); in tc358743_s_ctrl_detect_tx_5v() local
475 return v4l2_ctrl_s_ctrl(state->detect_tx_5v_ctrl, in tc358743_s_ctrl_detect_tx_5v()
481 struct tc358743_state *state = to_state(sd); in tc358743_s_ctrl_audio_sampling_rate() local
483 return v4l2_ctrl_s_ctrl(state->audio_sampling_rate_ctrl, in tc358743_s_ctrl_audio_sampling_rate()
489 struct tc358743_state *state = to_state(sd); in tc358743_s_ctrl_audio_present() local
491 return v4l2_ctrl_s_ctrl(state->audio_present_ctrl, in tc358743_s_ctrl_audio_present()
532 struct tc358743_state *state = to_state(sd); in enable_stream() local
552 mutex_lock(&state->confctl_mutex); in enable_stream()
555 mutex_unlock(&state->confctl_mutex); in enable_stream()
560 struct tc358743_state *state = to_state(sd); in tc358743_set_pll() local
561 struct tc358743_platform_data *pdata = &state->pdata; in tc358743_set_pll()
599 struct tc358743_state *state = to_state(sd); in tc358743_set_ref_clk() local
600 struct tc358743_platform_data *pdata = &state->pdata; in tc358743_set_ref_clk()
638 struct tc358743_state *state = to_state(sd); in tc358743_set_csi_color_space() local
640 switch (state->mbus_fmt_code) { in tc358743_set_csi_color_space()
648 mutex_lock(&state->confctl_mutex); in tc358743_set_csi_color_space()
651 mutex_unlock(&state->confctl_mutex); in tc358743_set_csi_color_space()
660 mutex_lock(&state->confctl_mutex); in tc358743_set_csi_color_space()
662 mutex_unlock(&state->confctl_mutex); in tc358743_set_csi_color_space()
666 __func__, state->mbus_fmt_code); in tc358743_set_csi_color_space()
672 struct tc358743_state *state = to_state(sd); in tc358743_num_csi_lanes_needed() local
673 struct v4l2_bt_timings *bt = &state->timings.bt; in tc358743_num_csi_lanes_needed()
674 struct tc358743_platform_data *pdata = &state->pdata; in tc358743_num_csi_lanes_needed()
676 (state->mbus_fmt_code == MEDIA_BUS_FMT_UYVY8_1X16) ? 16 : 24; in tc358743_num_csi_lanes_needed()
685 struct tc358743_state *state = to_state(sd); in tc358743_set_csi() local
686 struct tc358743_platform_data *pdata = &state->pdata; in tc358743_set_csi()
721 i2c_wr32(sd, TXOPTIONCNTRL, (state->bus.flags & in tc358743_set_csi()
747 struct tc358743_state *state = to_state(sd); in tc358743_set_hdmi_phy() local
748 struct tc358743_platform_data *pdata = &state->pdata; in tc358743_set_hdmi_phy()
777 struct tc358743_state *state = to_state(sd); in tc358743_set_hdmi_audio() local
795 mutex_lock(&state->confctl_mutex); in tc358743_set_hdmi_audio()
798 mutex_unlock(&state->confctl_mutex); in tc358743_set_hdmi_audio()
817 struct tc358743_state *state = to_state(sd); in tc358743_initial_setup() local
818 struct tc358743_platform_data *pdata = &state->pdata; in tc358743_initial_setup()
852 struct tc358743_state *state = to_state(sd); in tc358743_format_change() local
865 if (!v4l2_match_dv_timings(&state->timings, &timings, 0)) in tc358743_format_change()
1039 struct tc358743_state *state = to_state(sd); in tc358743_hdmi_sys_int_handler() local
1058 memset(&state->timings, 0, sizeof(state->timings)); in tc358743_hdmi_sys_int_handler()
1107 struct tc358743_state *state = to_state(sd); in tc358743_log_status() local
1155 v4l2_print_dv_timings(sd->name, "Configured format: ", &state->timings, in tc358743_log_status()
1176 state->mbus_fmt_code == MEDIA_BUS_FMT_UYVY8_1X16 ? in tc358743_log_status()
1178 state->mbus_fmt_code == MEDIA_BUS_FMT_RGB888_1X24 ? in tc358743_log_status()
1323 struct tc358743_state *state = dev_id; in tc358743_irq_handler() local
1326 tc358743_isr(&state->sd, 0, &handled); in tc358743_irq_handler()
1360 struct tc358743_state *state = to_state(sd); in tc358743_s_dv_timings() local
1369 if (v4l2_match_dv_timings(&state->timings, timings, 0)) { in tc358743_s_dv_timings()
1380 state->timings = *timings; in tc358743_s_dv_timings()
1392 struct tc358743_state *state = to_state(sd); in tc358743_g_dv_timings() local
1394 *timings = state->timings; in tc358743_g_dv_timings()
1483 struct tc358743_state *state = to_state(sd); in tc358743_get_fmt() local
1489 format->format.code = state->mbus_fmt_code; in tc358743_get_fmt()
1490 format->format.width = state->timings.bt.width; in tc358743_get_fmt()
1491 format->format.height = state->timings.bt.height; in tc358743_get_fmt()
1519 struct tc358743_state *state = to_state(sd); in tc358743_set_fmt() local
1540 state->mbus_fmt_code = format->format.code; in tc358743_set_fmt()
1553 struct tc358743_state *state = to_state(sd); in tc358743_g_edid() local
1559 edid->blocks = state->edid_blocks_written; in tc358743_g_edid()
1563 if (state->edid_blocks_written == 0) in tc358743_g_edid()
1566 if (edid->start_block >= state->edid_blocks_written || in tc358743_g_edid()
1570 if (edid->start_block + edid->blocks > state->edid_blocks_written) in tc358743_g_edid()
1571 edid->blocks = state->edid_blocks_written - edid->start_block; in tc358743_g_edid()
1582 struct tc358743_state *state = to_state(sd); in tc358743_s_edid() local
1605 state->edid_blocks_written = 0; in tc358743_s_edid()
1611 state->edid_blocks_written = edid->blocks; in tc358743_s_edid()
1683 static void tc358743_gpio_reset(struct tc358743_state *state) in tc358743_gpio_reset() argument
1686 gpiod_set_value(state->reset_gpio, 1); in tc358743_gpio_reset()
1688 gpiod_set_value(state->reset_gpio, 0); in tc358743_gpio_reset()
1692 static int tc358743_probe_of(struct tc358743_state *state) in tc358743_probe_of() argument
1694 struct device *dev = &state->i2c_client->dev; in tc358743_probe_of()
1728 state->bus = endpoint->bus.mipi_csi2; in tc358743_probe_of()
1732 state->pdata.refclk_hz = clk_get_rate(refclk); in tc358743_probe_of()
1733 state->pdata.ddc5v_delay = DDC5V_DELAY_100_MS; in tc358743_probe_of()
1734 state->pdata.enable_hdcp = false; in tc358743_probe_of()
1736 state->pdata.fifo_level = 16; in tc358743_probe_of()
1741 switch (state->pdata.refclk_hz) { in tc358743_probe_of()
1745 state->pdata.pll_prd = state->pdata.refclk_hz / 6000000; in tc358743_probe_of()
1749 state->pdata.refclk_hz); in tc358743_probe_of()
1764 state->pdata.pll_fbd = bps_pr_lane / in tc358743_probe_of()
1765 state->pdata.refclk_hz * state->pdata.pll_prd; in tc358743_probe_of()
1774 state->pdata.lineinitcnt = 0xe80; in tc358743_probe_of()
1775 state->pdata.lptxtimecnt = 0x003; in tc358743_probe_of()
1777 state->pdata.tclk_headercnt = 0x1403; in tc358743_probe_of()
1778 state->pdata.tclk_trailcnt = 0x00; in tc358743_probe_of()
1780 state->pdata.ths_headercnt = 0x0103; in tc358743_probe_of()
1781 state->pdata.twakeup = 0x4882; in tc358743_probe_of()
1782 state->pdata.tclk_postcnt = 0x008; in tc358743_probe_of()
1783 state->pdata.ths_trailcnt = 0x2; in tc358743_probe_of()
1784 state->pdata.hstxvregcnt = 0; in tc358743_probe_of()
1786 state->reset_gpio = devm_gpiod_get_optional(dev, "reset", in tc358743_probe_of()
1788 if (IS_ERR(state->reset_gpio)) { in tc358743_probe_of()
1790 ret = PTR_ERR(state->reset_gpio); in tc358743_probe_of()
1794 if (state->reset_gpio) in tc358743_probe_of()
1795 tc358743_gpio_reset(state); in tc358743_probe_of()
1807 static inline int tc358743_probe_of(struct tc358743_state *state) in tc358743_probe_of() argument
1818 struct tc358743_state *state; in tc358743_probe() local
1828 state = devm_kzalloc(&client->dev, sizeof(struct tc358743_state), in tc358743_probe()
1830 if (!state) in tc358743_probe()
1833 state->i2c_client = client; in tc358743_probe()
1837 state->pdata = *pdata; in tc358743_probe()
1838 state->bus.flags = V4L2_MBUS_CSI2_CONTINUOUS_CLOCK; in tc358743_probe()
1840 err = tc358743_probe_of(state); in tc358743_probe()
1847 sd = &state->sd; in tc358743_probe()
1859 v4l2_ctrl_handler_init(&state->hdl, 3); in tc358743_probe()
1862 state->detect_tx_5v_ctrl = v4l2_ctrl_new_std(&state->hdl, NULL, in tc358743_probe()
1866 state->audio_sampling_rate_ctrl = v4l2_ctrl_new_custom(&state->hdl, in tc358743_probe()
1869 state->audio_present_ctrl = v4l2_ctrl_new_custom(&state->hdl, in tc358743_probe()
1872 sd->ctrl_handler = &state->hdl; in tc358743_probe()
1873 if (state->hdl.error) { in tc358743_probe()
1874 err = state->hdl.error; in tc358743_probe()
1884 state->work_queues = create_singlethread_workqueue(client->name); in tc358743_probe()
1885 if (!state->work_queues) { in tc358743_probe()
1891 state->pad.flags = MEDIA_PAD_FL_SOURCE; in tc358743_probe()
1892 err = media_entity_init(&sd->entity, 1, &state->pad, 0); in tc358743_probe()
1901 mutex_init(&state->confctl_mutex); in tc358743_probe()
1903 INIT_DELAYED_WORK(&state->delayed_work_enable_hotplug, in tc358743_probe()
1910 state->mbus_fmt_code = MEDIA_BUS_FMT_RGB888_1X24; in tc358743_probe()
1915 if (state->i2c_client->irq) { in tc358743_probe()
1917 state->i2c_client->irq, in tc358743_probe()
1920 "tc358743", state); in tc358743_probe()
1938 cancel_delayed_work(&state->delayed_work_enable_hotplug); in tc358743_probe()
1939 destroy_workqueue(state->work_queues); in tc358743_probe()
1940 mutex_destroy(&state->confctl_mutex); in tc358743_probe()
1943 v4l2_ctrl_handler_free(&state->hdl); in tc358743_probe()
1950 struct tc358743_state *state = to_state(sd); in tc358743_remove() local
1952 cancel_delayed_work(&state->delayed_work_enable_hotplug); in tc358743_remove()
1953 destroy_workqueue(state->work_queues); in tc358743_remove()
1956 mutex_destroy(&state->confctl_mutex); in tc358743_remove()
1958 v4l2_ctrl_handler_free(&state->hdl); in tc358743_remove()