Lines Matching +full:hsic +full:- +full:state
1 // SPDX-License-Identifier: GPL-2.0-only
32 #include <media/rc-core.h>
34 #include "sil-sii8620.h"
122 0x3d, /* TDM and HSIC */
124 0x4d, /* eMSC, HDCP, HSIC */
128 0x61, /* eCBUS-S, eCBUS-D */
139 int ret = ctx->error; in sii8620_clear_error()
141 ctx->error = 0; in sii8620_clear_error()
147 struct device *dev = ctx->dev; in sii8620_read_buf()
153 .flags = client->flags, in sii8620_read_buf()
159 .flags = client->flags | I2C_M_RD, in sii8620_read_buf()
166 if (ctx->error) in sii8620_read_buf()
169 ret = i2c_transfer(client->adapter, msg, 2); in sii8620_read_buf()
175 ctx->error = ret < 0 ? ret : -EIO; in sii8620_read_buf()
190 struct device *dev = ctx->dev; in sii8620_write_buf()
195 .flags = client->flags, in sii8620_write_buf()
200 if (ctx->error) in sii8620_write_buf()
206 ctx->error = -ENOMEM; in sii8620_write_buf()
217 ret = i2c_transfer(client->adapter, &msg, 1); in sii8620_write_buf()
223 ctx->error = ret ?: -EIO; in sii8620_write_buf()
264 return ctx->mode >= CM_MHL3; in sii8620_is_mhl3()
271 list_for_each_entry_safe(msg, n, &ctx->mt_queue, node) { in sii8620_mt_cleanup()
272 list_del(&msg->node); in sii8620_mt_cleanup()
275 ctx->mt_state = MT_STATE_READY; in sii8620_mt_cleanup()
282 if (ctx->error) in sii8620_mt_work()
284 if (ctx->mt_state == MT_STATE_BUSY || list_empty(&ctx->mt_queue)) in sii8620_mt_work()
287 if (ctx->mt_state == MT_STATE_DONE) { in sii8620_mt_work()
288 ctx->mt_state = MT_STATE_READY; in sii8620_mt_work()
289 msg = list_first_entry(&ctx->mt_queue, struct sii8620_mt_msg, in sii8620_mt_work()
291 list_del(&msg->node); in sii8620_mt_work()
292 if (msg->recv) in sii8620_mt_work()
293 msg->recv(ctx, msg); in sii8620_mt_work()
294 if (msg->continuation) in sii8620_mt_work()
295 msg->continuation(ctx, msg->ret); in sii8620_mt_work()
299 if (ctx->mt_state != MT_STATE_READY || list_empty(&ctx->mt_queue)) in sii8620_mt_work()
302 ctx->mt_state = MT_STATE_BUSY; in sii8620_mt_work()
303 msg = list_first_entry(&ctx->mt_queue, struct sii8620_mt_msg, node); in sii8620_mt_work()
304 if (msg->send) in sii8620_mt_work()
305 msg->send(ctx, msg); in sii8620_mt_work()
312 if (ctx->gen2_write_burst) in sii8620_enable_gen2_write_burst()
315 if (ctx->mode >= CM_MHL1) in sii8620_enable_gen2_write_burst()
322 ctx->gen2_write_burst = 1; in sii8620_enable_gen2_write_burst()
327 if (!ctx->gen2_write_burst) in sii8620_disable_gen2_write_burst()
334 ctx->gen2_write_burst = 0; in sii8620_disable_gen2_write_burst()
354 if (msg->reg[0] == MHL_SET_INT && in sii8620_mt_msc_cmd_send()
355 msg->reg[1] == MHL_INT_REG(RCHANGE) && in sii8620_mt_msc_cmd_send()
356 msg->reg[2] == MHL_INT_RC_FEAT_REQ) in sii8620_mt_msc_cmd_send()
361 switch (msg->reg[0]) { in sii8620_mt_msc_cmd_send()
364 sii8620_write_buf(ctx, REG_MSC_CMD_OR_OFFSET, msg->reg + 1, 2); in sii8620_mt_msc_cmd_send()
369 sii8620_write_buf(ctx, REG_MSC_CMD_OR_OFFSET, msg->reg, 3); in sii8620_mt_msc_cmd_send()
375 sii8620_write(ctx, REG_MSC_CMD_OR_OFFSET, msg->reg[1]); in sii8620_mt_msc_cmd_send()
380 dev_err(ctx->dev, "%s: command %#x not supported\n", __func__, in sii8620_mt_msc_cmd_send()
381 msg->reg[0]); in sii8620_mt_msc_cmd_send()
390 ctx->error = -ENOMEM; in sii8620_mt_msg_new()
392 list_add_tail(&msg->node, &ctx->mt_queue); in sii8620_mt_msg_new()
401 if (ctx->error) in sii8620_mt_set_cont()
404 if (list_empty(&ctx->mt_queue)) { in sii8620_mt_set_cont()
405 ctx->error = -EINVAL; in sii8620_mt_set_cont()
408 msg = list_last_entry(&ctx->mt_queue, struct sii8620_mt_msg, node); in sii8620_mt_set_cont()
409 msg->continuation = cont; in sii8620_mt_set_cont()
419 msg->reg[0] = cmd; in sii8620_mt_msc_cmd()
420 msg->reg[1] = arg1; in sii8620_mt_msc_cmd()
421 msg->reg[2] = arg2; in sii8620_mt_msc_cmd()
422 msg->send = sii8620_mt_msc_cmd_send; in sii8620_mt_msc_cmd()
462 if (msg->reg[0] == MHL_READ_XDEVCAP) in sii8620_mt_read_devcap_send()
475 while (--count >= 0) { in sii8620_update_array()
490 struct device *dev = ctx->dev; in sii8620_identify_sink()
492 if (!ctx->sink_detected || !ctx->devcap_read) in sii8620_identify_sink()
496 if (!ctx->edid) { in sii8620_identify_sink()
497 dev_err(ctx->dev, "Cannot fetch EDID\n"); in sii8620_identify_sink()
503 if (drm_detect_hdmi_monitor(ctx->edid)) in sii8620_identify_sink()
504 ctx->sink_type = SINK_HDMI; in sii8620_identify_sink()
506 ctx->sink_type = SINK_DVI; in sii8620_identify_sink()
508 drm_edid_get_monitor_name(ctx->edid, sink_name, ARRAY_SIZE(sink_name)); in sii8620_identify_sink()
511 sink_str[ctx->sink_type], sink_name); in sii8620_identify_sink()
517 struct device *dev = ctx->dev; in sii8620_mr_devcap()
520 if (ctx->error < 0) in sii8620_mr_devcap()
528 sii8620_update_array(ctx->devcap, dcap, MHL_DCAP_SIZE); in sii8620_mr_devcap()
529 ctx->devcap_read = true; in sii8620_mr_devcap()
535 sii8620_read_buf(ctx, REG_EDID_FIFO_RD_DATA, ctx->xdevcap, in sii8620_mr_xdevcap()
546 if (msg->reg[0] == MHL_READ_XDEVCAP) in sii8620_mt_read_devcap_recv()
556 if (msg->reg[0] == MHL_READ_XDEVCAP) in sii8620_mt_read_devcap_recv()
569 msg->reg[0] = xdevcap ? MHL_READ_XDEVCAP : MHL_READ_DEVCAP; in sii8620_mt_read_devcap()
570 msg->send = sii8620_mt_read_devcap_send; in sii8620_mt_read_devcap()
571 msg->recv = sii8620_mt_read_devcap_recv; in sii8620_mt_read_devcap()
577 u8 reg = msg->reg[1] & 0x7f; in sii8620_mt_read_devcap_reg_recv()
579 if (msg->reg[1] & 0x80) in sii8620_mt_read_devcap_reg_recv()
580 ctx->xdevcap[reg] = msg->ret; in sii8620_mt_read_devcap_reg_recv()
582 ctx->devcap[reg] = msg->ret; in sii8620_mt_read_devcap_reg_recv()
592 msg->reg[0] = (reg & 0x80) ? MHL_READ_XDEVCAP_REG : MHL_READ_DEVCAP_REG; in sii8620_mt_read_devcap_reg()
593 msg->reg[1] = reg; in sii8620_mt_read_devcap_reg()
594 msg->send = sii8620_mt_msc_cmd_send; in sii8620_mt_read_devcap_reg()
595 msg->recv = sii8620_mt_read_devcap_reg_recv; in sii8620_mt_read_devcap_reg()
605 u8 *buf = &ctx->burst.tx_buf[ctx->burst.tx_count]; in sii8620_burst_get_tx_buf()
608 if (ctx->burst.tx_count + size >= ARRAY_SIZE(ctx->burst.tx_buf)) { in sii8620_burst_get_tx_buf()
609 dev_err(ctx->dev, "TX-BLK buffer exhausted\n"); in sii8620_burst_get_tx_buf()
610 ctx->error = -EINVAL; in sii8620_burst_get_tx_buf()
614 ctx->burst.tx_count += size; in sii8620_burst_get_tx_buf()
622 u8 *buf = &ctx->burst.rx_buf[ctx->burst.rx_count]; in sii8620_burst_get_rx_buf()
625 if (ctx->burst.rx_count + size >= ARRAY_SIZE(ctx->burst.rx_buf)) { in sii8620_burst_get_rx_buf()
626 dev_err(ctx->dev, "RX-BLK buffer exhausted\n"); in sii8620_burst_get_rx_buf()
627 ctx->error = -EINVAL; in sii8620_burst_get_rx_buf()
631 ctx->burst.rx_count += size; in sii8620_burst_get_rx_buf()
639 int tx_left = ctx->burst.tx_count; in sii8620_burst_send()
640 u8 *d = ctx->burst.tx_buf; in sii8620_burst_send()
645 if (ctx->burst.r_count + len > ctx->burst.r_size) in sii8620_burst_send()
647 d[0] = min(ctx->burst.rx_ack, 255); in sii8620_burst_send()
648 ctx->burst.rx_ack -= d[0]; in sii8620_burst_send()
650 ctx->burst.r_count += len; in sii8620_burst_send()
651 tx_left -= len; in sii8620_burst_send()
655 ctx->burst.tx_count = tx_left; in sii8620_burst_send()
657 while (ctx->burst.rx_ack > 0) { in sii8620_burst_send()
658 u8 b[2] = { min(ctx->burst.rx_ack, 255), 0 }; in sii8620_burst_send()
660 if (ctx->burst.r_count + 2 > ctx->burst.r_size) in sii8620_burst_send()
662 ctx->burst.rx_ack -= b[0]; in sii8620_burst_send()
664 ctx->burst.r_count += 2; in sii8620_burst_send()
679 count -= len; in sii8620_burst_receive()
680 ctx->burst.rx_ack += len - 1; in sii8620_burst_receive()
681 ctx->burst.r_count -= buf[1]; in sii8620_burst_receive()
682 if (ctx->burst.r_count < 0) in sii8620_burst_receive()
683 ctx->burst.r_count = 0; in sii8620_burst_receive()
693 count -= len; in sii8620_burst_receive()
694 ctx->burst.rx_ack += len; in sii8620_burst_receive()
705 d->id = cpu_to_be16(MHL_BURST_ID_BLK_RCV_BUFFER_INFO); in sii8620_burst_tx_rbuf_info()
706 d->size = cpu_to_le16(size); in sii8620_burst_tx_rbuf_info()
713 while (size--) in sii8620_checksum()
722 h->id = cpu_to_be16(id); in sii8620_mhl_burst_hdr_set()
723 h->total_entries = 1; in sii8620_mhl_burst_hdr_set()
724 h->sequence_index = 1; in sii8620_mhl_burst_hdr_set()
730 const int size = sizeof(*d) + sizeof(d->desc[0]); in sii8620_burst_tx_bits_per_pixel_fmt()
736 sii8620_mhl_burst_hdr_set(&d->hdr, MHL_BURST_ID_BITS_PER_PIXEL_FMT); in sii8620_burst_tx_bits_per_pixel_fmt()
737 d->num_entries = 1; in sii8620_burst_tx_bits_per_pixel_fmt()
738 d->desc[0].stream_id = 0; in sii8620_burst_tx_bits_per_pixel_fmt()
739 d->desc[0].pixel_format = fmt; in sii8620_burst_tx_bits_per_pixel_fmt()
740 d->hdr.checksum -= sii8620_checksum(d, size); in sii8620_burst_tx_bits_per_pixel_fmt()
745 u8 *d = ctx->burst.rx_buf; in sii8620_burst_rx_all()
746 int count = ctx->burst.rx_count; in sii8620_burst_rx_all()
748 while (count-- > 0) { in sii8620_burst_rx_all()
754 ctx->burst.r_size = get_unaligned_le16(&d[2]); in sii8620_burst_rx_all()
759 count -= len; in sii8620_burst_rx_all()
762 ctx->burst.rx_count = 0; in sii8620_burst_rx_all()
798 ctx->error = -ENOMEM; in sii8620_fetch_edid()
835 ctx->error = -ETIMEDOUT; in sii8620_fetch_edid()
836 dev_err(ctx->dev, "timeout during EDID read\n"); in sii8620_fetch_edid()
846 u8 ext = ((struct edid *)edid)->extensions; in sii8620_fetch_edid()
855 ctx->error = -ENOMEM; in sii8620_fetch_edid()
869 kfree(ctx->edid); in sii8620_fetch_edid()
870 ctx->edid = (struct edid *)edid; in sii8620_fetch_edid()
894 sii8620_write_buf(ctx, REG_EDID_FIFO_WR_DATA, (u8 *)ctx->edid, in sii8620_set_upstream_edid()
895 (ctx->edid->extensions + 1) * EDID_LENGTH); in sii8620_set_upstream_edid()
919 unsigned long rate = clk_get_rate(ctx->clk_xtal) / 1000; in sii8620_xtal_set_rate()
922 for (i = 0; i < ARRAY_SIZE(rates) - 1; ++i) in sii8620_xtal_set_rate()
927 dev_err(ctx->dev, "xtal clock rate(%lukHz) not supported, setting MHL for %ukHz.\n", in sii8620_xtal_set_rate()
938 ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in sii8620_hw_on()
943 ret = clk_prepare_enable(ctx->clk_xtal); in sii8620_hw_on()
948 gpiod_set_value(ctx->gpio_reset, 0); in sii8620_hw_on()
956 clk_disable_unprepare(ctx->clk_xtal); in sii8620_hw_off()
957 gpiod_set_value(ctx->gpio_reset, 1); in sii8620_hw_off()
958 return regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); in sii8620_hw_off()
971 if (ctx->mode != CM_MHL1) { in sii8620_set_auto_zone()
998 switch (ctx->sink_type) { in sii8620_stop_video()
1021 ctx->use_packed_pixel ? ~0 : 0); in sii8620_set_format()
1023 if (ctx->use_packed_pixel) { in sii8620_set_format()
1038 if (ctx->use_packed_pixel) in sii8620_set_format()
1053 frame->version = 3; in mhl3_infoframe_init()
1054 frame->hev_format = -1; in mhl3_infoframe_init()
1065 return -ENOSPC; in mhl3_infoframe_pack()
1069 ptr[1] = frame->version; in mhl3_infoframe_pack()
1074 ptr[7] = frame->video_format & 0x3; in mhl3_infoframe_pack()
1075 ptr[7] |= (frame->format_type & 0x7) << 2; in mhl3_infoframe_pack()
1076 ptr[7] |= frame->sep_audio ? BIT(5) : 0; in mhl3_infoframe_pack()
1077 if (frame->hev_format >= 0) { in mhl3_infoframe_pack()
1079 ptr[10] = (frame->hev_format >> 8) & 0xff; in mhl3_infoframe_pack()
1080 ptr[11] = frame->hev_format & 0xff; in mhl3_infoframe_pack()
1082 if (frame->av_delay) { in mhl3_infoframe_pack()
1083 bool sign = frame->av_delay < 0; in mhl3_infoframe_pack()
1084 int delay = sign ? -frame->av_delay : frame->av_delay; in mhl3_infoframe_pack()
1092 ptr[3] -= sii8620_checksum(buffer, frm_len); in mhl3_infoframe_pack()
1106 if (ctx->use_packed_pixel) in sii8620_set_infoframes()
1112 sii8620_write_buf(ctx, REG_TPI_AVI_CHSUM, buf + 3, ret - 3); in sii8620_set_infoframes()
1114 if (!sii8620_is_mhl3(ctx) || !ctx->use_packed_pixel) { in sii8620_set_infoframes()
1145 &ctx->bridge.encoder->crtc->state->adjusted_mode; in sii8620_start_video()
1150 if (ctx->sink_type == SINK_DVI && !sii8620_is_mhl3(ctx)) { in sii8620_start_video()
1167 if (ctx->use_packed_pixel) in sii8620_start_video()
1189 int clk = mode->clock * (ctx->use_packed_pixel ? 2 : 3); in sii8620_start_video()
1192 for (i = 0; i < ARRAY_SIZE(clk_spec) - 1; ++i) in sii8620_start_video()
1199 sii8620_burst_tx_bits_per_pixel_fmt(ctx, ctx->use_packed_pixel); in sii8620_start_video()
1416 static int sii8620_wait_for_fsm_state(struct sii8620 *ctx, u8 state) in sii8620_wait_for_fsm_state() argument
1423 if ((s & MSK_COC_STAT_0_FSM_STATE) == state) in sii8620_wait_for_fsm_state()
1426 return -EBUSY; in sii8620_wait_for_fsm_state()
1429 return -ETIMEDOUT; in sii8620_wait_for_fsm_state()
1436 if (ctx->mode == mode) in sii8620_set_mode()
1448 ctx->mode = mode; in sii8620_set_mode()
1452 ctx->mode = mode; in sii8620_set_mode()
1487 ctx->mode = mode; in sii8620_set_mode()
1490 dev_err(ctx->dev, "%s mode %d not supported\n", __func__, mode); in sii8620_set_mode()
1513 ctx->sink_type = SINK_NONE; in sii8620_hpd_unplugged()
1514 ctx->sink_detected = false; in sii8620_hpd_unplugged()
1515 ctx->feature_complete = false; in sii8620_hpd_unplugged()
1516 kfree(ctx->edid); in sii8620_hpd_unplugged()
1517 ctx->edid = NULL; in sii8620_hpd_unplugged()
1591 memset(ctx->stat, 0, sizeof(ctx->stat)); in sii8620_disconnect()
1592 memset(ctx->xstat, 0, sizeof(ctx->xstat)); in sii8620_disconnect()
1593 memset(ctx->devcap, 0, sizeof(ctx->devcap)); in sii8620_disconnect()
1594 memset(ctx->xdevcap, 0, sizeof(ctx->xdevcap)); in sii8620_disconnect()
1595 ctx->devcap_read = false; in sii8620_disconnect()
1596 ctx->cbus_status = 0; in sii8620_disconnect()
1673 mode = ctx->stat[MHL_DST_VERSION] >= 0x30 ? CM_MHL3 : CM_MHL1; in sii8620_status_dcap_ready()
1674 if (mode > ctx->mode) in sii8620_status_dcap_ready()
1685 if (ctx->use_packed_pixel) in sii8620_status_changed_path()
1690 if (ctx->stat[MHL_DST_LINK_MODE] & MHL_DST_LM_PATH_ENABLED) in sii8620_status_changed_path()
1704 sii8620_update_array(ctx->stat, st, MHL_DST_SIZE); in sii8620_msc_mr_write_stat()
1705 sii8620_update_array(ctx->xstat, xst, MHL_XDS_SIZE); in sii8620_msc_mr_write_stat()
1707 if (ctx->stat[MHL_DST_CONNECTED_RDY] & st[MHL_DST_CONNECTED_RDY] & in sii8620_msc_mr_write_stat()
1741 sii8620_mhl_burst_hdr_set(&d->hdr, MHL_BURST_ID_EMSC_SUPPORT); in sii8620_mhl_burst_emsc_support_set()
1742 d->num_entries = 1; in sii8620_mhl_burst_emsc_support_set()
1743 d->burst_id[0] = cpu_to_be16(id); in sii8620_mhl_burst_emsc_support_set()
1763 if (!IS_ENABLED(CONFIG_RC_CORE) || !ctx->rc_dev) in sii8620_rcp_consume()
1767 rc_keydown(ctx->rc_dev, RC_PROTO_CEC, scancode, 0); in sii8620_rcp_consume()
1769 rc_keyup(ctx->rc_dev); in sii8620_rcp_consume()
1782 switch (ctx->mode) { in sii8620_msc_mr_set_int()
1797 ctx->feature_complete = true; in sii8620_msc_mr_set_int()
1798 if (ctx->edid) in sii8620_msc_mr_set_int()
1805 struct device *dev = ctx->dev; in sii8620_msc_msg_first()
1807 if (list_empty(&ctx->mt_queue)) { in sii8620_msc_msg_first()
1812 return list_first_entry(&ctx->mt_queue, struct sii8620_mt_msg, node); in sii8620_msc_msg_first()
1822 msg->ret = sii8620_readb(ctx, REG_MSC_MT_RCVD_DATA0); in sii8620_msc_mt_done()
1823 ctx->mt_state = MT_STATE_DONE; in sii8620_msc_mt_done()
1838 msg->ret = buf[1]; in sii8620_msc_mr_msc_msg()
1839 ctx->mt_state = MT_STATE_DONE; in sii8620_msc_mr_msc_msg()
1848 dev_err(ctx->dev, "%s message type %d,%d not supported", in sii8620_msc_mr_msc_msg()
1863 if ((cbus_stat ^ ctx->cbus_status) & BIT_CBUS_STATUS_CBUS_HPD) { in sii8620_irq_msc()
1869 ctx->cbus_status = cbus_stat; in sii8620_irq_msc()
1876 if (ctx->cbus_status & BIT_CBUS_STATUS_CBUS_HPD) { in sii8620_irq_msc()
1877 ctx->sink_detected = true; in sii8620_irq_msc()
1928 ctx->mt_state = MT_STATE_DONE; in sii8620_irq_edid()
1959 ctx->mode = CM_ECBUS_S; in sii8620_irq_tdm()
1960 ctx->burst.rx_ack = 0; in sii8620_irq_tdm()
1961 ctx->burst.r_size = SII8620_BURST_BUF_LEN; in sii8620_irq_tdm()
1995 if (sii8620_is_mhl3(ctx) && !ctx->feature_complete) in sii8620_irq_ddc()
2004 /* endian agnostic, non-volatile version of test_bit */
2031 mutex_lock(&ctx->lock); in sii8620_irq_thread()
2044 dev_err(ctx->dev, "Error during IRQ handling, %d.\n", ret); in sii8620_irq_thread()
2047 mutex_unlock(&ctx->lock); in sii8620_irq_thread()
2054 struct device *dev = ctx->dev; in sii8620_cable_in()
2093 enable_irq(to_i2c_client(ctx->dev)->irq); in sii8620_cable_in()
2106 dev_err(ctx->dev, "Failed to allocate RC device\n"); in sii8620_init_rcp_input_dev()
2107 ctx->error = -ENOMEM; in sii8620_init_rcp_input_dev()
2111 rc_dev->input_phys = "sii8620/input0"; in sii8620_init_rcp_input_dev()
2112 rc_dev->input_id.bustype = BUS_VIRTUAL; in sii8620_init_rcp_input_dev()
2113 rc_dev->map_name = RC_MAP_CEC; in sii8620_init_rcp_input_dev()
2114 rc_dev->allowed_protocols = RC_PROTO_BIT_CEC; in sii8620_init_rcp_input_dev()
2115 rc_dev->driver_name = "sii8620"; in sii8620_init_rcp_input_dev()
2116 rc_dev->device_name = "sii8620"; in sii8620_init_rcp_input_dev()
2121 dev_err(ctx->dev, "Failed to register RC device\n"); in sii8620_init_rcp_input_dev()
2122 ctx->error = ret; in sii8620_init_rcp_input_dev()
2126 ctx->rc_dev = rc_dev; in sii8620_init_rcp_input_dev()
2131 disable_irq(to_i2c_client(ctx->dev)->irq); in sii8620_cable_out()
2139 int state = extcon_get_state(ctx->extcon, EXTCON_DISP_MHL); in sii8620_extcon_work() local
2141 if (state == ctx->cable_state) in sii8620_extcon_work()
2144 ctx->cable_state = state; in sii8620_extcon_work()
2146 if (state > 0) in sii8620_extcon_work()
2158 schedule_work(&ctx->extcon_wq); in sii8620_extcon_notifier()
2169 /* get micro-USB connector node */ in sii8620_extcon_init()
2170 musb = of_graph_get_remote_node(ctx->dev->of_node, 1, -1); in sii8620_extcon_init()
2171 /* next get micro-USB Interface Controller node */ in sii8620_extcon_init()
2175 dev_info(ctx->dev, "no extcon found, switching to 'always on' mode\n"); in sii8620_extcon_init()
2182 if (PTR_ERR(edev) == -EPROBE_DEFER) in sii8620_extcon_init()
2183 return -EPROBE_DEFER; in sii8620_extcon_init()
2184 dev_err(ctx->dev, "Invalid or missing extcon\n"); in sii8620_extcon_init()
2188 ctx->extcon = edev; in sii8620_extcon_init()
2189 ctx->extcon_nb.notifier_call = sii8620_extcon_notifier; in sii8620_extcon_init()
2190 INIT_WORK(&ctx->extcon_wq, sii8620_extcon_work); in sii8620_extcon_init()
2191 ret = extcon_register_notifier(edev, EXTCON_DISP_MHL, &ctx->extcon_nb); in sii8620_extcon_init()
2193 dev_err(ctx->dev, "failed to register notifier for MHL\n"); in sii8620_extcon_init()
2222 rc_unregister_device(ctx->rc_dev); in sii8620_detach()
2238 if (mode->clock < max_pclk) in sii8620_is_packing_required()
2240 else if (mode->clock < max_pclk_pp_mode) in sii8620_is_packing_required()
2243 return -1; in sii8620_is_packing_required()
2252 bool can_pack = ctx->devcap[MHL_DCAP_VID_LINK_MODE] & in sii8620_mode_valid()
2271 mutex_lock(&ctx->lock); in sii8620_mode_fixup()
2273 ctx->use_packed_pixel = sii8620_is_packing_required(ctx, adjusted_mode); in sii8620_mode_fixup()
2275 mutex_unlock(&ctx->lock); in sii8620_mode_fixup()
2289 struct device *dev = &client->dev; in sii8620_probe()
2295 return -ENOMEM; in sii8620_probe()
2297 ctx->dev = dev; in sii8620_probe()
2298 mutex_init(&ctx->lock); in sii8620_probe()
2299 INIT_LIST_HEAD(&ctx->mt_queue); in sii8620_probe()
2301 ctx->clk_xtal = devm_clk_get(dev, "xtal"); in sii8620_probe()
2302 if (IS_ERR(ctx->clk_xtal)) in sii8620_probe()
2303 return dev_err_probe(dev, PTR_ERR(ctx->clk_xtal), in sii8620_probe()
2306 if (!client->irq) { in sii8620_probe()
2308 return -EINVAL; in sii8620_probe()
2310 irq_set_status_flags(client->irq, IRQ_NOAUTOEN); in sii8620_probe()
2311 ret = devm_request_threaded_irq(dev, client->irq, NULL, in sii8620_probe()
2319 ctx->gpio_reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in sii8620_probe()
2320 if (IS_ERR(ctx->gpio_reset)) in sii8620_probe()
2321 return dev_err_probe(dev, PTR_ERR(ctx->gpio_reset), in sii8620_probe()
2324 ctx->supplies[0].supply = "cvcc10"; in sii8620_probe()
2325 ctx->supplies[1].supply = "iovcc18"; in sii8620_probe()
2326 ret = devm_regulator_bulk_get(dev, 2, ctx->supplies); in sii8620_probe()
2332 dev_err(ctx->dev, "failed to initialize EXTCON\n"); in sii8620_probe()
2338 ctx->bridge.funcs = &sii8620_bridge_funcs; in sii8620_probe()
2339 ctx->bridge.of_node = dev->of_node; in sii8620_probe()
2340 drm_bridge_add(&ctx->bridge); in sii8620_probe()
2342 if (!ctx->extcon) in sii8620_probe()
2352 if (ctx->extcon) { in sii8620_remove()
2353 extcon_unregister_notifier(ctx->extcon, EXTCON_DISP_MHL, in sii8620_remove()
2354 &ctx->extcon_nb); in sii8620_remove()
2355 flush_work(&ctx->extcon_wq); in sii8620_remove()
2356 if (ctx->cable_state > 0) in sii8620_remove()
2361 drm_bridge_remove(&ctx->bridge); in sii8620_remove()