Lines Matching full:sender
82 static inline int wait_for_gen_fifo_empty(struct mdfld_dsi_pkg_sender *sender, in wait_for_gen_fifo_empty() argument
85 struct drm_device *dev = sender->dev; in wait_for_gen_fifo_empty()
86 u32 gen_fifo_stat_reg = sender->mipi_gen_fifo_stat_reg; in wait_for_gen_fifo_empty()
98 static int wait_for_all_fifos_empty(struct mdfld_dsi_pkg_sender *sender) in wait_for_all_fifos_empty() argument
100 return wait_for_gen_fifo_empty(sender, (BIT(2) | BIT(10) | BIT(18) | in wait_for_all_fifos_empty()
104 static int wait_for_lp_fifos_empty(struct mdfld_dsi_pkg_sender *sender) in wait_for_lp_fifos_empty() argument
106 return wait_for_gen_fifo_empty(sender, (BIT(10) | BIT(26))); in wait_for_lp_fifos_empty()
109 static int wait_for_hs_fifos_empty(struct mdfld_dsi_pkg_sender *sender) in wait_for_hs_fifos_empty() argument
111 return wait_for_gen_fifo_empty(sender, (BIT(2) | BIT(18))); in wait_for_hs_fifos_empty()
114 static int handle_dsi_error(struct mdfld_dsi_pkg_sender *sender, u32 mask) in handle_dsi_error() argument
116 u32 intr_stat_reg = sender->mipi_intr_stat_reg; in handle_dsi_error()
117 struct drm_device *dev = sender->dev; in handle_dsi_error()
119 dev_dbg(sender->dev->dev, "Handling error 0x%08x\n", mask); in handle_dsi_error()
136 dev_dbg(sender->dev->dev, "No Action required\n"); in handle_dsi_error()
140 /*wait_for_all_fifos_empty(sender)*/ in handle_dsi_error()
143 dev_dbg(sender->dev->dev, "No Action required\n"); in handle_dsi_error()
151 dev_dbg(sender->dev->dev, "High/Low contention detected\n"); in handle_dsi_error()
156 wait_for_all_fifos_empty(sender); in handle_dsi_error()
159 dev_dbg(sender->dev->dev, "No Action required\n"); in handle_dsi_error()
163 /*wait_for_all_fifos_empty(sender);*/ in handle_dsi_error()
172 dev_dbg(sender->dev->dev, "HS Gen fifo full\n"); in handle_dsi_error()
174 wait_for_hs_fifos_empty(sender); in handle_dsi_error()
177 dev_dbg(sender->dev->dev, "LP Gen fifo full\n"); in handle_dsi_error()
179 wait_for_lp_fifos_empty(sender); in handle_dsi_error()
184 dev_dbg(sender->dev->dev, "No Action required\n"); in handle_dsi_error()
189 dev_dbg(sender->dev->dev, in handle_dsi_error()
194 static int dsi_error_handler(struct mdfld_dsi_pkg_sender *sender) in dsi_error_handler() argument
196 struct drm_device *dev = sender->dev; in dsi_error_handler()
197 u32 intr_stat_reg = sender->mipi_intr_stat_reg; in dsi_error_handler()
208 dev_dbg(sender->dev->dev, "[DSI]: %s\n", dsi_errors[i]); in dsi_error_handler()
209 err = handle_dsi_error(sender, mask); in dsi_error_handler()
217 static int send_short_pkg(struct mdfld_dsi_pkg_sender *sender, u8 data_type, in send_short_pkg() argument
220 struct drm_device *dev = sender->dev; in send_short_pkg()
226 ctrl_reg = sender->mipi_hs_gen_ctrl_reg; in send_short_pkg()
228 /* FIXME: wait_for_hs_fifos_empty(sender); */ in send_short_pkg()
230 ctrl_reg = sender->mipi_lp_gen_ctrl_reg; in send_short_pkg()
232 /* FIXME: wait_for_lp_fifos_empty(sender); */ in send_short_pkg()
243 static int send_long_pkg(struct mdfld_dsi_pkg_sender *sender, u8 data_type, in send_long_pkg() argument
246 struct drm_device *dev = sender->dev; in send_long_pkg()
256 ctrl_reg = sender->mipi_hs_gen_ctrl_reg; in send_long_pkg()
257 data_reg = sender->mipi_hs_gen_data_reg; in send_long_pkg()
259 /* FIXME: wait_for_hs_fifos_empty(sender); */ in send_long_pkg()
261 ctrl_reg = sender->mipi_lp_gen_ctrl_reg; in send_long_pkg()
262 data_reg = sender->mipi_lp_gen_data_reg; in send_long_pkg()
264 /* FIXME: wait_for_lp_fifos_empty(sender); */ in send_long_pkg()
307 static int send_pkg_prepare(struct mdfld_dsi_pkg_sender *sender, u8 data_type, in send_pkg_prepare() argument
323 sender->status = MDFLD_DSI_PKG_SENDER_BUSY; in send_pkg_prepare()
338 static int send_pkg_done(struct mdfld_dsi_pkg_sender *sender, u8 data_type, in send_pkg_done() argument
355 sender->panel_mode |= MDFLD_DSI_PANEL_MODE_SLEEP; in send_pkg_done()
359 sender->panel_mode &= ~MDFLD_DSI_PANEL_MODE_SLEEP; in send_pkg_done()
367 sender->status = MDFLD_DSI_PKG_SENDER_FREE; in send_pkg_done()
372 static int send_pkg(struct mdfld_dsi_pkg_sender *sender, u8 data_type, in send_pkg() argument
378 ret = dsi_error_handler(sender); in send_pkg()
385 if (sender->status == MDFLD_DSI_PKG_SENDER_BUSY) { in send_pkg()
386 DRM_ERROR("sender is busy\n"); in send_pkg()
390 ret = send_pkg_prepare(sender, data_type, data, len); in send_pkg()
406 ret = send_short_pkg(sender, data_type, data[0], data[1], hs); in send_pkg()
410 ret = send_long_pkg(sender, data_type, data, len, hs); in send_pkg()
414 send_pkg_done(sender, data_type, data, len); in send_pkg()
421 int mdfld_dsi_send_mcs_long(struct mdfld_dsi_pkg_sender *sender, u8 *data, in mdfld_dsi_send_mcs_long() argument
426 if (!sender || !data || !len) { in mdfld_dsi_send_mcs_long()
431 spin_lock_irqsave(&sender->lock, flags); in mdfld_dsi_send_mcs_long()
432 send_pkg(sender, MIPI_DSI_DCS_LONG_WRITE, data, len, hs); in mdfld_dsi_send_mcs_long()
433 spin_unlock_irqrestore(&sender->lock, flags); in mdfld_dsi_send_mcs_long()
438 int mdfld_dsi_send_mcs_short(struct mdfld_dsi_pkg_sender *sender, u8 cmd, in mdfld_dsi_send_mcs_short() argument
445 if (!sender) { in mdfld_dsi_send_mcs_short()
460 spin_lock_irqsave(&sender->lock, flags); in mdfld_dsi_send_mcs_short()
461 send_pkg(sender, data_type, data, sizeof(data), hs); in mdfld_dsi_send_mcs_short()
462 spin_unlock_irqrestore(&sender->lock, flags); in mdfld_dsi_send_mcs_short()
467 int mdfld_dsi_send_gen_short(struct mdfld_dsi_pkg_sender *sender, u8 param0, in mdfld_dsi_send_gen_short() argument
474 if (!sender || param_num > 2) { in mdfld_dsi_send_gen_short()
497 spin_lock_irqsave(&sender->lock, flags); in mdfld_dsi_send_gen_short()
498 send_pkg(sender, data_type, data, sizeof(data), hs); in mdfld_dsi_send_gen_short()
499 spin_unlock_irqrestore(&sender->lock, flags); in mdfld_dsi_send_gen_short()
504 int mdfld_dsi_send_gen_long(struct mdfld_dsi_pkg_sender *sender, u8 *data, in mdfld_dsi_send_gen_long() argument
509 if (!sender || !data || !len) { in mdfld_dsi_send_gen_long()
514 spin_lock_irqsave(&sender->lock, flags); in mdfld_dsi_send_gen_long()
515 send_pkg(sender, MIPI_DSI_GENERIC_LONG_WRITE, data, len, hs); in mdfld_dsi_send_gen_long()
516 spin_unlock_irqrestore(&sender->lock, flags); in mdfld_dsi_send_gen_long()
521 static int __read_panel_data(struct mdfld_dsi_pkg_sender *sender, u8 data_type, in __read_panel_data() argument
530 if (!sender || !data_out || !len_out) { in __read_panel_data()
535 dev = sender->dev; in __read_panel_data()
543 spin_lock_irqsave(&sender->lock, flags); in __read_panel_data()
545 REG_WRITE(sender->mipi_intr_stat_reg, BIT(29)); in __read_panel_data()
547 if ((REG_READ(sender->mipi_intr_stat_reg) & BIT(29))) in __read_panel_data()
551 send_pkg(sender, data_type, data, len, hs); in __read_panel_data()
554 while (retry && !(REG_READ(sender->mipi_intr_stat_reg) & BIT(29))) { in __read_panel_data()
560 spin_unlock_irqrestore(&sender->lock, flags); in __read_panel_data()
564 REG_WRITE(sender->mipi_intr_stat_reg, BIT(29)); in __read_panel_data()
568 gen_data_reg = sender->mipi_hs_gen_data_reg; in __read_panel_data()
570 gen_data_reg = sender->mipi_lp_gen_data_reg; in __read_panel_data()
575 spin_unlock_irqrestore(&sender->lock, flags); in __read_panel_data()
580 int mdfld_dsi_read_mcs(struct mdfld_dsi_pkg_sender *sender, u8 cmd, in mdfld_dsi_read_mcs() argument
583 if (!sender || !data || !len) { in mdfld_dsi_read_mcs()
588 return __read_panel_data(sender, MIPI_DSI_DCS_READ, &cmd, 1, in mdfld_dsi_read_mcs()
614 DRM_ERROR("Create DSI pkg sender failed\n"); in mdfld_dsi_pkg_sender_init()
670 void mdfld_dsi_pkg_sender_destroy(struct mdfld_dsi_pkg_sender *sender) in mdfld_dsi_pkg_sender_destroy() argument
672 if (!sender || IS_ERR(sender)) in mdfld_dsi_pkg_sender_destroy()
676 kfree(sender); in mdfld_dsi_pkg_sender_destroy()