Lines Matching full:dsi
220 static void mtk_dsi_mask(struct mtk_dsi *dsi, u32 offset, u32 mask, u32 data) in mtk_dsi_mask() argument
222 u32 temp = readl(dsi->regs + offset); in mtk_dsi_mask()
224 writel((temp & ~mask) | (data & mask), dsi->regs + offset); in mtk_dsi_mask()
227 static void mtk_dsi_phy_timconfig(struct mtk_dsi *dsi) in mtk_dsi_phy_timconfig() argument
230 u32 data_rate_mhz = DIV_ROUND_UP(dsi->data_rate, 1000000); in mtk_dsi_phy_timconfig()
231 struct mtk_phy_timing *timing = &dsi->phy_timing; in mtk_dsi_phy_timconfig()
259 writel(timcon0, dsi->regs + DSI_PHY_TIMECON0); in mtk_dsi_phy_timconfig()
260 writel(timcon1, dsi->regs + DSI_PHY_TIMECON1); in mtk_dsi_phy_timconfig()
261 writel(timcon2, dsi->regs + DSI_PHY_TIMECON2); in mtk_dsi_phy_timconfig()
262 writel(timcon3, dsi->regs + DSI_PHY_TIMECON3); in mtk_dsi_phy_timconfig()
265 static void mtk_dsi_enable(struct mtk_dsi *dsi) in mtk_dsi_enable() argument
267 mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_EN, DSI_EN); in mtk_dsi_enable()
270 static void mtk_dsi_disable(struct mtk_dsi *dsi) in mtk_dsi_disable() argument
272 mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_EN, 0); in mtk_dsi_disable()
275 static void mtk_dsi_reset_engine(struct mtk_dsi *dsi) in mtk_dsi_reset_engine() argument
277 mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_RESET, DSI_RESET); in mtk_dsi_reset_engine()
278 mtk_dsi_mask(dsi, DSI_CON_CTRL, DSI_RESET, 0); in mtk_dsi_reset_engine()
281 static void mtk_dsi_reset_dphy(struct mtk_dsi *dsi) in mtk_dsi_reset_dphy() argument
283 mtk_dsi_mask(dsi, DSI_CON_CTRL, DPHY_RESET, DPHY_RESET); in mtk_dsi_reset_dphy()
284 mtk_dsi_mask(dsi, DSI_CON_CTRL, DPHY_RESET, 0); in mtk_dsi_reset_dphy()
287 static void mtk_dsi_clk_ulp_mode_enter(struct mtk_dsi *dsi) in mtk_dsi_clk_ulp_mode_enter() argument
289 mtk_dsi_mask(dsi, DSI_PHY_LCCON, LC_HS_TX_EN, 0); in mtk_dsi_clk_ulp_mode_enter()
290 mtk_dsi_mask(dsi, DSI_PHY_LCCON, LC_ULPM_EN, 0); in mtk_dsi_clk_ulp_mode_enter()
293 static void mtk_dsi_clk_ulp_mode_leave(struct mtk_dsi *dsi) in mtk_dsi_clk_ulp_mode_leave() argument
295 mtk_dsi_mask(dsi, DSI_PHY_LCCON, LC_ULPM_EN, 0); in mtk_dsi_clk_ulp_mode_leave()
296 mtk_dsi_mask(dsi, DSI_PHY_LCCON, LC_WAKEUP_EN, LC_WAKEUP_EN); in mtk_dsi_clk_ulp_mode_leave()
297 mtk_dsi_mask(dsi, DSI_PHY_LCCON, LC_WAKEUP_EN, 0); in mtk_dsi_clk_ulp_mode_leave()
300 static void mtk_dsi_lane0_ulp_mode_enter(struct mtk_dsi *dsi) in mtk_dsi_lane0_ulp_mode_enter() argument
302 mtk_dsi_mask(dsi, DSI_PHY_LD0CON, LD0_HS_TX_EN, 0); in mtk_dsi_lane0_ulp_mode_enter()
303 mtk_dsi_mask(dsi, DSI_PHY_LD0CON, LD0_ULPM_EN, 0); in mtk_dsi_lane0_ulp_mode_enter()
306 static void mtk_dsi_lane0_ulp_mode_leave(struct mtk_dsi *dsi) in mtk_dsi_lane0_ulp_mode_leave() argument
308 mtk_dsi_mask(dsi, DSI_PHY_LD0CON, LD0_ULPM_EN, 0); in mtk_dsi_lane0_ulp_mode_leave()
309 mtk_dsi_mask(dsi, DSI_PHY_LD0CON, LD0_WAKEUP_EN, LD0_WAKEUP_EN); in mtk_dsi_lane0_ulp_mode_leave()
310 mtk_dsi_mask(dsi, DSI_PHY_LD0CON, LD0_WAKEUP_EN, 0); in mtk_dsi_lane0_ulp_mode_leave()
313 static bool mtk_dsi_clk_hs_state(struct mtk_dsi *dsi) in mtk_dsi_clk_hs_state() argument
315 return readl(dsi->regs + DSI_PHY_LCCON) & LC_HS_TX_EN; in mtk_dsi_clk_hs_state()
318 static void mtk_dsi_clk_hs_mode(struct mtk_dsi *dsi, bool enter) in mtk_dsi_clk_hs_mode() argument
320 if (enter && !mtk_dsi_clk_hs_state(dsi)) in mtk_dsi_clk_hs_mode()
321 mtk_dsi_mask(dsi, DSI_PHY_LCCON, LC_HS_TX_EN, LC_HS_TX_EN); in mtk_dsi_clk_hs_mode()
322 else if (!enter && mtk_dsi_clk_hs_state(dsi)) in mtk_dsi_clk_hs_mode()
323 mtk_dsi_mask(dsi, DSI_PHY_LCCON, LC_HS_TX_EN, 0); in mtk_dsi_clk_hs_mode()
326 static void mtk_dsi_set_mode(struct mtk_dsi *dsi) in mtk_dsi_set_mode() argument
330 if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO) { in mtk_dsi_set_mode()
331 if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) in mtk_dsi_set_mode()
333 else if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) in mtk_dsi_set_mode()
339 writel(vid_mode, dsi->regs + DSI_MODE_CTRL); in mtk_dsi_set_mode()
342 static void mtk_dsi_set_vm_cmd(struct mtk_dsi *dsi) in mtk_dsi_set_vm_cmd() argument
344 mtk_dsi_mask(dsi, DSI_VM_CMD_CON, VM_CMD_EN, VM_CMD_EN); in mtk_dsi_set_vm_cmd()
345 mtk_dsi_mask(dsi, DSI_VM_CMD_CON, TS_VFP_EN, TS_VFP_EN); in mtk_dsi_set_vm_cmd()
348 static void mtk_dsi_ps_control_vact(struct mtk_dsi *dsi) in mtk_dsi_ps_control_vact() argument
350 struct videomode *vm = &dsi->vm; in mtk_dsi_ps_control_vact()
354 if (dsi->format == MIPI_DSI_FMT_RGB565) in mtk_dsi_ps_control_vact()
362 switch (dsi->format) { in mtk_dsi_ps_control_vact()
377 writel(vm->vactive, dsi->regs + DSI_VACT_NL); in mtk_dsi_ps_control_vact()
378 writel(ps_bpp_mode, dsi->regs + DSI_PSCTRL); in mtk_dsi_ps_control_vact()
379 writel(ps_wc, dsi->regs + DSI_HSTX_CKL_WC); in mtk_dsi_ps_control_vact()
382 static void mtk_dsi_rxtx_control(struct mtk_dsi *dsi) in mtk_dsi_rxtx_control() argument
386 switch (dsi->lanes) { in mtk_dsi_rxtx_control()
404 tmp_reg |= (dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) << 6; in mtk_dsi_rxtx_control()
405 tmp_reg |= (dsi->mode_flags & MIPI_DSI_MODE_EOT_PACKET) >> 3; in mtk_dsi_rxtx_control()
407 writel(tmp_reg, dsi->regs + DSI_TXRX_CTRL); in mtk_dsi_rxtx_control()
410 static void mtk_dsi_ps_control(struct mtk_dsi *dsi) in mtk_dsi_ps_control() argument
415 switch (dsi->format) { in mtk_dsi_ps_control()
438 tmp_reg += dsi->vm.hactive * dsi_tmp_buf_bpp & DSI_PS_WC; in mtk_dsi_ps_control()
439 writel(tmp_reg, dsi->regs + DSI_PSCTRL); in mtk_dsi_ps_control()
442 static void mtk_dsi_config_vdo_timing(struct mtk_dsi *dsi) in mtk_dsi_config_vdo_timing() argument
451 struct mtk_phy_timing *timing = &dsi->phy_timing; in mtk_dsi_config_vdo_timing()
453 struct videomode *vm = &dsi->vm; in mtk_dsi_config_vdo_timing()
455 if (dsi->format == MIPI_DSI_FMT_RGB565) in mtk_dsi_config_vdo_timing()
460 writel(vm->vsync_len, dsi->regs + DSI_VSA_NL); in mtk_dsi_config_vdo_timing()
461 writel(vm->vback_porch, dsi->regs + DSI_VBP_NL); in mtk_dsi_config_vdo_timing()
462 writel(vm->vfront_porch, dsi->regs + DSI_VFP_NL); in mtk_dsi_config_vdo_timing()
463 writel(vm->vactive, dsi->regs + DSI_VACT_NL); in mtk_dsi_config_vdo_timing()
465 if (dsi->driver_data->has_size_ctl) in mtk_dsi_config_vdo_timing()
467 dsi->regs + DSI_SIZE_CON); in mtk_dsi_config_vdo_timing()
471 if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) in mtk_dsi_config_vdo_timing()
480 delta = dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST ? 18 : 12; in mtk_dsi_config_vdo_timing()
484 data_phy_cycles_byte = data_phy_cycles * dsi->lanes + delta; in mtk_dsi_config_vdo_timing()
498 writel(horizontal_sync_active_byte, dsi->regs + DSI_HSA_WC); in mtk_dsi_config_vdo_timing()
499 writel(horizontal_backporch_byte, dsi->regs + DSI_HBP_WC); in mtk_dsi_config_vdo_timing()
500 writel(horizontal_frontporch_byte, dsi->regs + DSI_HFP_WC); in mtk_dsi_config_vdo_timing()
502 mtk_dsi_ps_control(dsi); in mtk_dsi_config_vdo_timing()
505 static void mtk_dsi_start(struct mtk_dsi *dsi) in mtk_dsi_start() argument
507 writel(0, dsi->regs + DSI_START); in mtk_dsi_start()
508 writel(1, dsi->regs + DSI_START); in mtk_dsi_start()
511 static void mtk_dsi_stop(struct mtk_dsi *dsi) in mtk_dsi_stop() argument
513 writel(0, dsi->regs + DSI_START); in mtk_dsi_stop()
516 static void mtk_dsi_set_cmd_mode(struct mtk_dsi *dsi) in mtk_dsi_set_cmd_mode() argument
518 writel(CMD_MODE, dsi->regs + DSI_MODE_CTRL); in mtk_dsi_set_cmd_mode()
521 static void mtk_dsi_set_interrupt_enable(struct mtk_dsi *dsi) in mtk_dsi_set_interrupt_enable() argument
525 writel(inten, dsi->regs + DSI_INTEN); in mtk_dsi_set_interrupt_enable()
528 static void mtk_dsi_irq_data_set(struct mtk_dsi *dsi, u32 irq_bit) in mtk_dsi_irq_data_set() argument
530 dsi->irq_data |= irq_bit; in mtk_dsi_irq_data_set()
533 static void mtk_dsi_irq_data_clear(struct mtk_dsi *dsi, u32 irq_bit) in mtk_dsi_irq_data_clear() argument
535 dsi->irq_data &= ~irq_bit; in mtk_dsi_irq_data_clear()
538 static s32 mtk_dsi_wait_for_irq_done(struct mtk_dsi *dsi, u32 irq_flag, in mtk_dsi_wait_for_irq_done() argument
544 ret = wait_event_interruptible_timeout(dsi->irq_wait_queue, in mtk_dsi_wait_for_irq_done()
545 dsi->irq_data & irq_flag, in mtk_dsi_wait_for_irq_done()
548 DRM_WARN("Wait DSI IRQ(0x%08x) Timeout\n", irq_flag); in mtk_dsi_wait_for_irq_done()
550 mtk_dsi_enable(dsi); in mtk_dsi_wait_for_irq_done()
551 mtk_dsi_reset_engine(dsi); in mtk_dsi_wait_for_irq_done()
559 struct mtk_dsi *dsi = dev_id; in mtk_dsi_irq() local
563 status = readl(dsi->regs + DSI_INTSTA) & flag; in mtk_dsi_irq()
567 mtk_dsi_mask(dsi, DSI_RACK, RACK, RACK); in mtk_dsi_irq()
568 tmp = readl(dsi->regs + DSI_INTSTA); in mtk_dsi_irq()
571 mtk_dsi_mask(dsi, DSI_INTSTA, status, 0); in mtk_dsi_irq()
572 mtk_dsi_irq_data_set(dsi, status); in mtk_dsi_irq()
573 wake_up_interruptible(&dsi->irq_wait_queue); in mtk_dsi_irq()
579 static s32 mtk_dsi_switch_to_cmd_mode(struct mtk_dsi *dsi, u8 irq_flag, u32 t) in mtk_dsi_switch_to_cmd_mode() argument
581 mtk_dsi_irq_data_clear(dsi, irq_flag); in mtk_dsi_switch_to_cmd_mode()
582 mtk_dsi_set_cmd_mode(dsi); in mtk_dsi_switch_to_cmd_mode()
584 if (!mtk_dsi_wait_for_irq_done(dsi, irq_flag, t)) { in mtk_dsi_switch_to_cmd_mode()
592 static int mtk_dsi_poweron(struct mtk_dsi *dsi) in mtk_dsi_poweron() argument
594 struct device *dev = dsi->host.dev; in mtk_dsi_poweron()
598 if (++dsi->refcount != 1) in mtk_dsi_poweron()
601 switch (dsi->format) { in mtk_dsi_poweron()
615 dsi->data_rate = DIV_ROUND_UP_ULL(dsi->vm.pixelclock * bit_per_pixel, in mtk_dsi_poweron()
616 dsi->lanes); in mtk_dsi_poweron()
618 ret = clk_set_rate(dsi->hs_clk, dsi->data_rate); in mtk_dsi_poweron()
624 phy_power_on(dsi->phy); in mtk_dsi_poweron()
626 ret = clk_prepare_enable(dsi->engine_clk); in mtk_dsi_poweron()
632 ret = clk_prepare_enable(dsi->digital_clk); in mtk_dsi_poweron()
638 mtk_dsi_enable(dsi); in mtk_dsi_poweron()
640 if (dsi->driver_data->has_shadow_ctl) in mtk_dsi_poweron()
642 dsi->regs + DSI_SHADOW_DEBUG); in mtk_dsi_poweron()
644 mtk_dsi_reset_engine(dsi); in mtk_dsi_poweron()
645 mtk_dsi_phy_timconfig(dsi); in mtk_dsi_poweron()
647 mtk_dsi_rxtx_control(dsi); in mtk_dsi_poweron()
649 mtk_dsi_reset_dphy(dsi); in mtk_dsi_poweron()
650 mtk_dsi_ps_control_vact(dsi); in mtk_dsi_poweron()
651 mtk_dsi_set_vm_cmd(dsi); in mtk_dsi_poweron()
652 mtk_dsi_config_vdo_timing(dsi); in mtk_dsi_poweron()
653 mtk_dsi_set_interrupt_enable(dsi); in mtk_dsi_poweron()
655 mtk_dsi_clk_ulp_mode_leave(dsi); in mtk_dsi_poweron()
656 mtk_dsi_lane0_ulp_mode_leave(dsi); in mtk_dsi_poweron()
657 mtk_dsi_clk_hs_mode(dsi, 0); in mtk_dsi_poweron()
661 clk_disable_unprepare(dsi->engine_clk); in mtk_dsi_poweron()
663 phy_power_off(dsi->phy); in mtk_dsi_poweron()
665 dsi->refcount--; in mtk_dsi_poweron()
669 static void mtk_dsi_poweroff(struct mtk_dsi *dsi) in mtk_dsi_poweroff() argument
671 if (WARN_ON(dsi->refcount == 0)) in mtk_dsi_poweroff()
674 if (--dsi->refcount != 0) in mtk_dsi_poweroff()
682 * after dsi is fully set. in mtk_dsi_poweroff()
684 mtk_dsi_stop(dsi); in mtk_dsi_poweroff()
686 mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500); in mtk_dsi_poweroff()
687 mtk_dsi_reset_engine(dsi); in mtk_dsi_poweroff()
688 mtk_dsi_lane0_ulp_mode_enter(dsi); in mtk_dsi_poweroff()
689 mtk_dsi_clk_ulp_mode_enter(dsi); in mtk_dsi_poweroff()
691 mtk_dsi_disable(dsi); in mtk_dsi_poweroff()
693 clk_disable_unprepare(dsi->engine_clk); in mtk_dsi_poweroff()
694 clk_disable_unprepare(dsi->digital_clk); in mtk_dsi_poweroff()
696 phy_power_off(dsi->phy); in mtk_dsi_poweroff()
699 static void mtk_output_dsi_enable(struct mtk_dsi *dsi) in mtk_output_dsi_enable() argument
703 if (dsi->enabled) in mtk_output_dsi_enable()
706 ret = mtk_dsi_poweron(dsi); in mtk_output_dsi_enable()
708 DRM_ERROR("failed to power on dsi\n"); in mtk_output_dsi_enable()
712 mtk_dsi_set_mode(dsi); in mtk_output_dsi_enable()
713 mtk_dsi_clk_hs_mode(dsi, 1); in mtk_output_dsi_enable()
715 mtk_dsi_start(dsi); in mtk_output_dsi_enable()
717 dsi->enabled = true; in mtk_output_dsi_enable()
720 static void mtk_output_dsi_disable(struct mtk_dsi *dsi) in mtk_output_dsi_disable() argument
722 if (!dsi->enabled) in mtk_output_dsi_disable()
725 mtk_dsi_poweroff(dsi); in mtk_output_dsi_disable()
727 dsi->enabled = false; in mtk_output_dsi_disable()
733 struct mtk_dsi *dsi = bridge_to_dsi(bridge); in mtk_dsi_bridge_attach() local
735 /* Attach the panel or bridge to the dsi bridge */ in mtk_dsi_bridge_attach()
736 return drm_bridge_attach(bridge->encoder, dsi->next_bridge, in mtk_dsi_bridge_attach()
737 &dsi->bridge, flags); in mtk_dsi_bridge_attach()
744 struct mtk_dsi *dsi = bridge_to_dsi(bridge); in mtk_dsi_bridge_mode_set() local
746 drm_display_mode_to_videomode(adjusted, &dsi->vm); in mtk_dsi_bridge_mode_set()
751 struct mtk_dsi *dsi = bridge_to_dsi(bridge); in mtk_dsi_bridge_disable() local
753 mtk_output_dsi_disable(dsi); in mtk_dsi_bridge_disable()
758 struct mtk_dsi *dsi = bridge_to_dsi(bridge); in mtk_dsi_bridge_enable() local
760 mtk_output_dsi_enable(dsi); in mtk_dsi_bridge_enable()
772 struct mtk_dsi *dsi = container_of(comp, struct mtk_dsi, ddp_comp); in mtk_dsi_ddp_start() local
774 mtk_dsi_poweron(dsi); in mtk_dsi_ddp_start()
779 struct mtk_dsi *dsi = container_of(comp, struct mtk_dsi, ddp_comp); in mtk_dsi_ddp_stop() local
781 mtk_dsi_poweroff(dsi); in mtk_dsi_ddp_stop()
792 struct mtk_dsi *dsi = host_to_dsi(host); in mtk_dsi_host_attach() local
794 dsi->lanes = device->lanes; in mtk_dsi_host_attach()
795 dsi->format = device->format; in mtk_dsi_host_attach()
796 dsi->mode_flags = device->mode_flags; in mtk_dsi_host_attach()
801 static void mtk_dsi_wait_for_idle(struct mtk_dsi *dsi) in mtk_dsi_wait_for_idle() argument
806 ret = readl_poll_timeout(dsi->regs + DSI_INTSTA, val, !(val & DSI_BUSY), in mtk_dsi_wait_for_idle()
809 DRM_WARN("polling dsi wait not busy timeout!\n"); in mtk_dsi_wait_for_idle()
811 mtk_dsi_enable(dsi); in mtk_dsi_wait_for_idle()
812 mtk_dsi_reset_engine(dsi); in mtk_dsi_wait_for_idle()
839 static void mtk_dsi_cmdq(struct mtk_dsi *dsi, const struct mipi_dsi_msg *msg) in mtk_dsi_cmdq() argument
844 u32 reg_cmdq_off = dsi->driver_data->reg_cmdq_off; in mtk_dsi_cmdq()
864 mtk_dsi_mask(dsi, (reg_cmdq_off + cmdq_off + i) & (~0x3U), in mtk_dsi_cmdq()
868 mtk_dsi_mask(dsi, reg_cmdq_off, cmdq_mask, reg_val); in mtk_dsi_cmdq()
869 mtk_dsi_mask(dsi, DSI_CMDQ_SIZE, CMDQ_SIZE, cmdq_size); in mtk_dsi_cmdq()
872 static ssize_t mtk_dsi_host_send_cmd(struct mtk_dsi *dsi, in mtk_dsi_host_send_cmd() argument
875 mtk_dsi_wait_for_idle(dsi); in mtk_dsi_host_send_cmd()
876 mtk_dsi_irq_data_clear(dsi, flag); in mtk_dsi_host_send_cmd()
877 mtk_dsi_cmdq(dsi, msg); in mtk_dsi_host_send_cmd()
878 mtk_dsi_start(dsi); in mtk_dsi_host_send_cmd()
880 if (!mtk_dsi_wait_for_irq_done(dsi, flag, 2000)) in mtk_dsi_host_send_cmd()
889 struct mtk_dsi *dsi = host_to_dsi(host); in mtk_dsi_host_transfer() local
895 if (readl(dsi->regs + DSI_MODE_CTRL) & MODE) { in mtk_dsi_host_transfer()
896 DRM_ERROR("dsi engine is not command mode\n"); in mtk_dsi_host_transfer()
903 if (mtk_dsi_host_send_cmd(dsi, msg, irq_flag) < 0) in mtk_dsi_host_transfer()
910 DRM_ERROR("dsi receive buffer size may be NULL\n"); in mtk_dsi_host_transfer()
915 *(read_data + i) = readb(dsi->regs + DSI_RX_DATA0 + i); in mtk_dsi_host_transfer()
933 DRM_INFO("dsi get %d byte data from the panel address(0x%x)\n", in mtk_dsi_host_transfer()
944 static int mtk_dsi_encoder_init(struct drm_device *drm, struct mtk_dsi *dsi) in mtk_dsi_encoder_init() argument
948 ret = drm_simple_encoder_init(drm, &dsi->encoder, in mtk_dsi_encoder_init()
955 dsi->encoder.possible_crtcs = mtk_drm_find_possible_crtc_by_comp(drm, dsi->ddp_comp); in mtk_dsi_encoder_init()
957 ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, in mtk_dsi_encoder_init()
962 dsi->connector = drm_bridge_connector_init(drm, &dsi->encoder); in mtk_dsi_encoder_init()
963 if (IS_ERR(dsi->connector)) { in mtk_dsi_encoder_init()
965 ret = PTR_ERR(dsi->connector); in mtk_dsi_encoder_init()
968 drm_connector_attach_encoder(dsi->connector, &dsi->encoder); in mtk_dsi_encoder_init()
973 drm_encoder_cleanup(&dsi->encoder); in mtk_dsi_encoder_init()
981 struct mtk_dsi *dsi = dev_get_drvdata(dev); in mtk_dsi_bind() local
983 ret = mtk_ddp_comp_register(drm, &dsi->ddp_comp); in mtk_dsi_bind()
990 ret = mtk_dsi_encoder_init(drm, dsi); in mtk_dsi_bind()
997 mtk_ddp_comp_unregister(drm, &dsi->ddp_comp); in mtk_dsi_bind()
1005 struct mtk_dsi *dsi = dev_get_drvdata(dev); in mtk_dsi_unbind() local
1007 drm_encoder_cleanup(&dsi->encoder); in mtk_dsi_unbind()
1008 mtk_ddp_comp_unregister(drm, &dsi->ddp_comp); in mtk_dsi_unbind()
1018 struct mtk_dsi *dsi; in mtk_dsi_probe() local
1026 dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL); in mtk_dsi_probe()
1027 if (!dsi) in mtk_dsi_probe()
1030 dsi->host.ops = &mtk_dsi_ops; in mtk_dsi_probe()
1031 dsi->host.dev = dev; in mtk_dsi_probe()
1032 ret = mipi_dsi_host_register(&dsi->host); in mtk_dsi_probe()
1034 dev_err(dev, "failed to register DSI host: %d\n", ret); in mtk_dsi_probe()
1039 &panel, &dsi->next_bridge); in mtk_dsi_probe()
1044 dsi->next_bridge = devm_drm_panel_bridge_add(dev, panel); in mtk_dsi_probe()
1045 if (IS_ERR(dsi->next_bridge)) { in mtk_dsi_probe()
1046 ret = PTR_ERR(dsi->next_bridge); in mtk_dsi_probe()
1051 dsi->driver_data = of_device_get_match_data(dev); in mtk_dsi_probe()
1053 dsi->engine_clk = devm_clk_get(dev, "engine"); in mtk_dsi_probe()
1054 if (IS_ERR(dsi->engine_clk)) { in mtk_dsi_probe()
1055 ret = PTR_ERR(dsi->engine_clk); in mtk_dsi_probe()
1062 dsi->digital_clk = devm_clk_get(dev, "digital"); in mtk_dsi_probe()
1063 if (IS_ERR(dsi->digital_clk)) { in mtk_dsi_probe()
1064 ret = PTR_ERR(dsi->digital_clk); in mtk_dsi_probe()
1071 dsi->hs_clk = devm_clk_get(dev, "hs"); in mtk_dsi_probe()
1072 if (IS_ERR(dsi->hs_clk)) { in mtk_dsi_probe()
1073 ret = PTR_ERR(dsi->hs_clk); in mtk_dsi_probe()
1079 dsi->regs = devm_ioremap_resource(dev, regs); in mtk_dsi_probe()
1080 if (IS_ERR(dsi->regs)) { in mtk_dsi_probe()
1081 ret = PTR_ERR(dsi->regs); in mtk_dsi_probe()
1086 dsi->phy = devm_phy_get(dev, "dphy"); in mtk_dsi_probe()
1087 if (IS_ERR(dsi->phy)) { in mtk_dsi_probe()
1088 ret = PTR_ERR(dsi->phy); in mtk_dsi_probe()
1100 ret = mtk_ddp_comp_init(dev, dev->of_node, &dsi->ddp_comp, comp_id, in mtk_dsi_probe()
1109 dev_err(&pdev->dev, "failed to get dsi irq_num: %d\n", irq_num); in mtk_dsi_probe()
1116 IRQF_TRIGGER_LOW, dev_name(&pdev->dev), dsi); in mtk_dsi_probe()
1118 dev_err(&pdev->dev, "failed to request mediatek dsi irq\n"); in mtk_dsi_probe()
1122 init_waitqueue_head(&dsi->irq_wait_queue); in mtk_dsi_probe()
1124 platform_set_drvdata(pdev, dsi); in mtk_dsi_probe()
1126 dsi->bridge.funcs = &mtk_dsi_bridge_funcs; in mtk_dsi_probe()
1127 dsi->bridge.of_node = dev->of_node; in mtk_dsi_probe()
1128 dsi->bridge.type = DRM_MODE_CONNECTOR_DSI; in mtk_dsi_probe()
1130 drm_bridge_add(&dsi->bridge); in mtk_dsi_probe()
1141 mipi_dsi_host_unregister(&dsi->host); in mtk_dsi_probe()
1147 struct mtk_dsi *dsi = platform_get_drvdata(pdev); in mtk_dsi_remove() local
1149 mtk_output_dsi_disable(dsi); in mtk_dsi_remove()
1150 drm_bridge_remove(&dsi->bridge); in mtk_dsi_remove()
1152 mipi_dsi_host_unregister(&dsi->host); in mtk_dsi_remove()
1172 { .compatible = "mediatek,mt2701-dsi",
1174 { .compatible = "mediatek,mt8173-dsi",
1176 { .compatible = "mediatek,mt8183-dsi",
1185 .name = "mtk-dsi",