Lines Matching refs: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,
971 cec_received_msg(state->cec_adap, &msg);
985 struct tc358743_state *state = to_state(sd);
998 if (!v4l2_match_dv_timings(&state->timings, &timings, 0, false))
1173 struct tc358743_state *state = to_state(sd);
1192 memset(&state->timings, 0, sizeof(state->timings));
1241 struct tc358743_state *state = to_state(sd);
1289 v4l2_print_dv_timings(sd->name, "Configured format: ", &state->timings,
1296 state->csi_lanes_in_use);
1310 state->mbus_fmt_code == MEDIA_BUS_FMT_UYVY8_1X16 ?
1312 state->mbus_fmt_code == MEDIA_BUS_FMT_RGB888_1X24 ?
1465 struct tc358743_state *state = dev_id;
1468 tc358743_isr(&state->sd, 0, &handled);
1475 struct tc358743_state *state = from_timer(state, t, timer);
1478 schedule_work(&state->work_i2c_poll);
1483 msecs = state->cec_adap ? POLL_INTERVAL_CEC_MS : POLL_INTERVAL_MS;
1484 mod_timer(&state->timer, jiffies + msecs_to_jiffies(msecs));
1489 struct tc358743_state *state = container_of(work,
1493 tc358743_isr(&state->sd, 0, &handled);
1525 struct tc358743_state *state = to_state(sd);
1534 if (v4l2_match_dv_timings(&state->timings, timings, 0, false)) {
1545 state->timings = *timings;
1557 struct tc358743_state *state = to_state(sd);
1559 *timings = state->timings;
1611 struct tc358743_state *state = to_state(sd);
1618 switch (state->csi_lanes_in_use) {
1642 /* Put all lanes in LP-11 state (STOPSTATE) */
1672 struct tc358743_state *state = to_state(sd);
1678 format->format.code = state->mbus_fmt_code;
1679 format->format.width = state->timings.bt.width;
1680 format->format.height = state->timings.bt.height;
1708 struct tc358743_state *state = to_state(sd);
1729 state->mbus_fmt_code = format->format.code;
1742 struct tc358743_state *state = to_state(sd);
1750 edid->blocks = state->edid_blocks_written;
1754 if (state->edid_blocks_written == 0)
1757 if (edid->start_block >= state->edid_blocks_written ||
1761 if (edid->start_block + edid->blocks > state->edid_blocks_written)
1762 edid->blocks = state->edid_blocks_written - edid->start_block;
1773 struct tc358743_state *state = to_state(sd);
1799 cec_phys_addr_invalidate(state->cec_adap);
1807 state->edid_blocks_written = 0;
1814 state->edid_blocks_written = edid->blocks;
1816 cec_s_phys_addr(state->cec_adap, pa, false);
1889 static void tc358743_gpio_reset(struct tc358743_state *state)
1892 gpiod_set_value(state->reset_gpio, 1);
1894 gpiod_set_value(state->reset_gpio, 0);
1898 static int tc358743_probe_of(struct tc358743_state *state)
1900 struct device *dev = &state->i2c_client->dev;
1941 state->bus = endpoint.bus.mipi_csi2;
1949 state->pdata.refclk_hz = clk_get_rate(refclk);
1950 state->pdata.ddc5v_delay = DDC5V_DELAY_100_MS;
1951 state->pdata.enable_hdcp = false;
1953 state->pdata.fifo_level = 16;
1958 switch (state->pdata.refclk_hz) {
1962 state->pdata.pll_prd = state->pdata.refclk_hz / 6000000;
1966 state->pdata.refclk_hz);
1982 state->pdata.pll_fbd = bps_pr_lane /
1983 state->pdata.refclk_hz * state->pdata.pll_prd;
1992 state->pdata.lineinitcnt = 0xe80;
1993 state->pdata.lptxtimecnt = 0x003;
1995 state->pdata.tclk_headercnt = 0x1403;
1996 state->pdata.tclk_trailcnt = 0x00;
1998 state->pdata.ths_headercnt = 0x0103;
1999 state->pdata.twakeup = 0x4882;
2000 state->pdata.tclk_postcnt = 0x008;
2001 state->pdata.ths_trailcnt = 0x2;
2002 state->pdata.hstxvregcnt = 0;
2004 state->reset_gpio = devm_gpiod_get_optional(dev, "reset",
2006 if (IS_ERR(state->reset_gpio)) {
2008 ret = PTR_ERR(state->reset_gpio);
2012 if (state->reset_gpio)
2013 tc358743_gpio_reset(state);
2027 static inline int tc358743_probe_of(struct tc358743_state *state)
2037 struct tc358743_state *state;
2048 state = devm_kzalloc(&client->dev, sizeof(struct tc358743_state),
2050 if (!state)
2053 state->i2c_client = client;
2057 state->pdata = *pdata;
2058 state->bus.flags = V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
2060 err = tc358743_probe_of(state);
2067 sd = &state->sd;
2079 v4l2_ctrl_handler_init(&state->hdl, 3);
2081 state->detect_tx_5v_ctrl = v4l2_ctrl_new_std(&state->hdl, NULL,
2085 state->audio_sampling_rate_ctrl = v4l2_ctrl_new_custom(&state->hdl,
2088 state->audio_present_ctrl = v4l2_ctrl_new_custom(&state->hdl,
2091 sd->ctrl_handler = &state->hdl;
2092 if (state->hdl.error) {
2093 err = state->hdl.error;
2102 state->pad.flags = MEDIA_PAD_FL_SOURCE;
2104 err = media_entity_pads_init(&sd->entity, 1, &state->pad);
2108 state->mbus_fmt_code = MEDIA_BUS_FMT_RGB888_1X24;
2115 mutex_init(&state->confctl_mutex);
2117 INIT_DELAYED_WORK(&state->delayed_work_enable_hotplug,
2121 state->cec_adap = cec_allocate_adapter(&tc358743_cec_adap_ops,
2122 state, dev_name(&client->dev),
2124 if (IS_ERR(state->cec_adap)) {
2125 err = PTR_ERR(state->cec_adap);
2139 if (state->i2c_client->irq) {
2141 state->i2c_client->irq,
2144 "tc358743", state);
2148 INIT_WORK(&state->work_i2c_poll,
2150 timer_setup(&state->timer, tc358743_irq_poll_timer, 0);
2151 state->timer.expires = jiffies +
2153 add_timer(&state->timer);
2156 err = cec_register_adapter(state->cec_adap, &client->dev);
2159 cec_delete_adapter(state->cec_adap);
2160 state->cec_adap = NULL;
2177 cec_unregister_adapter(state->cec_adap);
2178 if (!state->i2c_client->irq)
2179 flush_work(&state->work_i2c_poll);
2180 cancel_delayed_work(&state->delayed_work_enable_hotplug);
2181 mutex_destroy(&state->confctl_mutex);
2184 v4l2_ctrl_handler_free(&state->hdl);
2191 struct tc358743_state *state = to_state(sd);
2193 if (!state->i2c_client->irq) {
2194 del_timer_sync(&state->timer);
2195 flush_work(&state->work_i2c_poll);
2197 cancel_delayed_work_sync(&state->delayed_work_enable_hotplug);
2198 cec_unregister_adapter(state->cec_adap);
2201 mutex_destroy(&state->confctl_mutex);
2203 v4l2_ctrl_handler_free(&state->hdl);