Lines Matching defs:state
115 struct tc358743_state *state = to_state(sd);
116 struct i2c_client *client = state->i2c_client;
143 struct tc358743_state *state = to_state(sd);
144 struct i2c_client *client = state->i2c_client;
359 struct tc358743_state *state = container_of(dwork,
361 struct v4l2_subdev *sd = &state->sd;
392 struct tc358743_state *state = to_state(sd);
396 cancel_delayed_work_sync(&state->delayed_work_enable_hotplug);
405 struct tc358743_state *state = to_state(sd);
407 if (state->edid_blocks_written == 0) {
417 schedule_delayed_work(&state->delayed_work_enable_hotplug, HZ / 10);
459 struct tc358743_state *state = to_state(sd);
461 return v4l2_ctrl_s_ctrl(state->detect_tx_5v_ctrl,
467 struct tc358743_state *state = to_state(sd);
469 return v4l2_ctrl_s_ctrl(state->audio_sampling_rate_ctrl,
475 struct tc358743_state *state = to_state(sd);
477 return v4l2_ctrl_s_ctrl(state->audio_present_ctrl,
518 struct tc358743_state *state = to_state(sd);
526 * LP11 state. */
533 /* Mute video so that all data lanes go to LSP11 state.
538 mutex_lock(&state->confctl_mutex);
541 mutex_unlock(&state->confctl_mutex);
546 struct tc358743_state *state = to_state(sd);
547 struct tc358743_platform_data *pdata = &state->pdata;
585 struct tc358743_state *state = to_state(sd);
586 struct tc358743_platform_data *pdata = &state->pdata;
634 struct tc358743_state *state = to_state(sd);
636 switch (state->mbus_fmt_code) {
644 mutex_lock(&state->confctl_mutex);
647 mutex_unlock(&state->confctl_mutex);
656 mutex_lock(&state->confctl_mutex);
658 mutex_unlock(&state->confctl_mutex);
662 __func__, state->mbus_fmt_code);
668 struct tc358743_state *state = to_state(sd);
669 struct v4l2_bt_timings *bt = &state->timings.bt;
670 struct tc358743_platform_data *pdata = &state->pdata;
672 (state->mbus_fmt_code == MEDIA_BUS_FMT_UYVY8_1X16) ? 16 : 24;
681 struct tc358743_state *state = to_state(sd);
682 struct tc358743_platform_data *pdata = &state->pdata;
687 state->csi_lanes_in_use = lanes;
719 i2c_wr32(sd, TXOPTIONCNTRL, (state->bus.flags &
745 struct tc358743_state *state = to_state(sd);
746 struct tc358743_platform_data *pdata = &state->pdata;
775 struct tc358743_state *state = to_state(sd);
793 mutex_lock(&state->confctl_mutex);
796 mutex_unlock(&state->confctl_mutex);
815 struct tc358743_state *state = to_state(sd);
816 struct tc358743_platform_data *pdata = &state->pdata;
857 struct tc358743_state *state = adap->priv;
858 struct v4l2_subdev *sd = &state->sd;
871 struct tc358743_state *state = adap->priv;
872 struct v4l2_subdev *sd = &state->sd;
886 struct tc358743_state *state = adap->priv;
887 struct v4l2_subdev *sd = &state->sd;
901 struct tc358743_state *state = adap->priv;
902 struct v4l2_subdev *sd = &state->sd;
925 struct tc358743_state *state = to_state(sd);
940 cec_transmit_attempt_done(state->cec_adap,
943 cec_transmit_attempt_done(state->cec_adap,
946 cec_transmit_attempt_done(state->cec_adap,
953 cec_transmit_attempt_done(state->cec_adap,
973 cec_received_msg(state->cec_adap, &msg);
987 struct tc358743_state *state = to_state(sd);
1000 if (!v4l2_match_dv_timings(&state->timings, &timings, 0, false))
1175 struct tc358743_state *state = to_state(sd);
1194 memset(&state->timings, 0, sizeof(state->timings));
1243 struct tc358743_state *state = to_state(sd);
1291 v4l2_print_dv_timings(sd->name, "Configured format: ", &state->timings,
1298 state->csi_lanes_in_use);
1312 state->mbus_fmt_code == MEDIA_BUS_FMT_UYVY8_1X16 ?
1314 state->mbus_fmt_code == MEDIA_BUS_FMT_RGB888_1X24 ?
1467 struct tc358743_state *state = dev_id;
1470 tc358743_isr(&state->sd, 0, &handled);
1477 struct tc358743_state *state = from_timer(state, t, timer);
1480 schedule_work(&state->work_i2c_poll);
1485 msecs = state->cec_adap ? POLL_INTERVAL_CEC_MS : POLL_INTERVAL_MS;
1486 mod_timer(&state->timer, jiffies + msecs_to_jiffies(msecs));
1491 struct tc358743_state *state = container_of(work,
1495 tc358743_isr(&state->sd, 0, &handled);
1527 struct tc358743_state *state = to_state(sd);
1536 if (v4l2_match_dv_timings(&state->timings, timings, 0, false)) {
1547 state->timings = *timings;
1559 struct tc358743_state *state = to_state(sd);
1561 *timings = state->timings;
1613 struct tc358743_state *state = to_state(sd);
1619 cfg->bus.mipi_csi2.num_data_lanes = state->csi_lanes_in_use;
1628 /* Put all lanes in LP-11 state (STOPSTATE) */
1658 struct tc358743_state *state = to_state(sd);
1664 format->format.code = state->mbus_fmt_code;
1665 format->format.width = state->timings.bt.width;
1666 format->format.height = state->timings.bt.height;
1694 struct tc358743_state *state = to_state(sd);
1715 state->mbus_fmt_code = format->format.code;
1728 struct tc358743_state *state = to_state(sd);
1736 edid->blocks = state->edid_blocks_written;
1740 if (state->edid_blocks_written == 0)
1743 if (edid->start_block >= state->edid_blocks_written ||
1747 if (edid->start_block + edid->blocks > state->edid_blocks_written)
1748 edid->blocks = state->edid_blocks_written - edid->start_block;
1759 struct tc358743_state *state = to_state(sd);
1785 cec_phys_addr_invalidate(state->cec_adap);
1793 state->edid_blocks_written = 0;
1800 state->edid_blocks_written = edid->blocks;
1802 cec_s_phys_addr(state->cec_adap, pa, false);
1875 static void tc358743_gpio_reset(struct tc358743_state *state)
1878 gpiod_set_value(state->reset_gpio, 1);
1880 gpiod_set_value(state->reset_gpio, 0);
1884 static int tc358743_probe_of(struct tc358743_state *state)
1886 struct device *dev = &state->i2c_client->dev;
1924 state->bus = endpoint.bus.mipi_csi2;
1932 state->pdata.refclk_hz = clk_get_rate(refclk);
1933 state->pdata.ddc5v_delay = DDC5V_DELAY_100_MS;
1934 state->pdata.enable_hdcp = false;
1936 state->pdata.fifo_level = 16;
1941 switch (state->pdata.refclk_hz) {
1945 state->pdata.pll_prd = state->pdata.refclk_hz / 6000000;
1949 state->pdata.refclk_hz);
1965 state->pdata.pll_fbd = bps_pr_lane /
1966 state->pdata.refclk_hz * state->pdata.pll_prd;
1975 state->pdata.lineinitcnt = 0xe80;
1976 state->pdata.lptxtimecnt = 0x003;
1978 state->pdata.tclk_headercnt = 0x1403;
1979 state->pdata.tclk_trailcnt = 0x00;
1981 state->pdata.ths_headercnt = 0x0103;
1982 state->pdata.twakeup = 0x4882;
1983 state->pdata.tclk_postcnt = 0x008;
1984 state->pdata.ths_trailcnt = 0x2;
1985 state->pdata.hstxvregcnt = 0;
1987 state->reset_gpio = devm_gpiod_get_optional(dev, "reset",
1989 if (IS_ERR(state->reset_gpio)) {
1991 ret = PTR_ERR(state->reset_gpio);
1995 if (state->reset_gpio)
1996 tc358743_gpio_reset(state);
2010 static inline int tc358743_probe_of(struct tc358743_state *state)
2020 struct tc358743_state *state;
2031 state = devm_kzalloc(&client->dev, sizeof(struct tc358743_state),
2033 if (!state)
2036 state->i2c_client = client;
2040 state->pdata = *pdata;
2041 state->bus.flags = 0;
2043 err = tc358743_probe_of(state);
2050 sd = &state->sd;
2062 v4l2_ctrl_handler_init(&state->hdl, 3);
2064 state->detect_tx_5v_ctrl = v4l2_ctrl_new_std(&state->hdl, NULL,
2068 state->audio_sampling_rate_ctrl = v4l2_ctrl_new_custom(&state->hdl,
2071 state->audio_present_ctrl = v4l2_ctrl_new_custom(&state->hdl,
2074 sd->ctrl_handler = &state->hdl;
2075 if (state->hdl.error) {
2076 err = state->hdl.error;
2085 state->pad.flags = MEDIA_PAD_FL_SOURCE;
2087 err = media_entity_pads_init(&sd->entity, 1, &state->pad);
2091 state->mbus_fmt_code = MEDIA_BUS_FMT_RGB888_1X24;
2095 mutex_init(&state->confctl_mutex);
2097 INIT_DELAYED_WORK(&state->delayed_work_enable_hotplug,
2101 state->cec_adap = cec_allocate_adapter(&tc358743_cec_adap_ops,
2102 state, dev_name(&client->dev),
2104 if (IS_ERR(state->cec_adap)) {
2105 err = PTR_ERR(state->cec_adap);
2119 if (state->i2c_client->irq) {
2121 state->i2c_client->irq,
2124 "tc358743", state);
2128 INIT_WORK(&state->work_i2c_poll,
2130 timer_setup(&state->timer, tc358743_irq_poll_timer, 0);
2131 state->timer.expires = jiffies +
2133 add_timer(&state->timer);
2136 err = cec_register_adapter(state->cec_adap, &client->dev);
2139 cec_delete_adapter(state->cec_adap);
2140 state->cec_adap = NULL;
2161 cec_unregister_adapter(state->cec_adap);
2162 if (!state->i2c_client->irq)
2163 flush_work(&state->work_i2c_poll);
2164 cancel_delayed_work(&state->delayed_work_enable_hotplug);
2165 mutex_destroy(&state->confctl_mutex);
2168 v4l2_ctrl_handler_free(&state->hdl);
2175 struct tc358743_state *state = to_state(sd);
2177 if (!state->i2c_client->irq) {
2178 del_timer_sync(&state->timer);
2179 flush_work(&state->work_i2c_poll);
2181 cancel_delayed_work_sync(&state->delayed_work_enable_hotplug);
2182 cec_unregister_adapter(state->cec_adap);
2185 mutex_destroy(&state->confctl_mutex);
2187 v4l2_ctrl_handler_free(&state->hdl);