Lines Matching refs:dsidev

111 #define REG_GET(dsidev, idx, start, end) \  argument
112 FLD_GET(dsi_read_reg(dsidev, idx), start, end)
114 #define REG_FLD_MOD(dsidev, idx, val, start, end) \ argument
115 dsi_write_reg(dsidev, idx, FLD_MOD(dsi_read_reg(dsidev, idx), val, start, end))
206 static int dsi_display_init_dispc(struct platform_device *dsidev,
208 static void dsi_display_uninit_dispc(struct platform_device *dsidev,
268 struct platform_device *dsidev; member
385 struct platform_device *dsidev; member
401 static inline struct dsi_data *dsi_get_dsidrv_data(struct platform_device *dsidev) in dsi_get_dsidrv_data() argument
403 return platform_get_drvdata(dsidev); in dsi_get_dsidrv_data()
432 static inline void dsi_write_reg(struct platform_device *dsidev, in dsi_write_reg() argument
435 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_write_reg()
448 static inline u32 dsi_read_reg(struct platform_device *dsidev, in dsi_read_reg() argument
451 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_read_reg()
466 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_bus_lock() local
467 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_bus_lock()
474 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_bus_unlock() local
475 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_bus_unlock()
480 static bool dsi_bus_is_locked(struct platform_device *dsidev) in dsi_bus_is_locked() argument
482 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_bus_is_locked()
492 static inline int wait_for_bit_change(struct platform_device *dsidev, in wait_for_bit_change() argument
502 if (REG_GET(dsidev, idx, bitnum, bitnum) == value) in wait_for_bit_change()
509 if (REG_GET(dsidev, idx, bitnum, bitnum) == value) in wait_for_bit_change()
537 static void dsi_perf_mark_setup(struct platform_device *dsidev) in dsi_perf_mark_setup() argument
539 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_perf_mark_setup()
543 static void dsi_perf_mark_start(struct platform_device *dsidev) in dsi_perf_mark_start() argument
545 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_perf_mark_start()
549 static void dsi_perf_show(struct platform_device *dsidev, const char *name) in dsi_perf_show() argument
551 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_perf_show()
586 static inline void dsi_perf_mark_setup(struct platform_device *dsidev) in dsi_perf_mark_setup() argument
590 static inline void dsi_perf_mark_start(struct platform_device *dsidev) in dsi_perf_mark_start() argument
594 static inline void dsi_perf_show(struct platform_device *dsidev, in dsi_perf_show() argument
692 static void dsi_collect_irq_stats(struct platform_device *dsidev, u32 irqstatus, in dsi_collect_irq_stats() argument
695 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_collect_irq_stats()
711 #define dsi_collect_irq_stats(dsidev, irqstatus, vcstatus, ciostatus) argument
716 static void dsi_handle_irq_errors(struct platform_device *dsidev, u32 irqstatus, in dsi_handle_irq_errors() argument
719 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_handle_irq_errors()
788 struct platform_device *dsidev; in omap_dsi_irq_handler() local
793 dsidev = (struct platform_device *) arg; in omap_dsi_irq_handler()
794 dsi = dsi_get_dsidrv_data(dsidev); in omap_dsi_irq_handler()
801 irqstatus = dsi_read_reg(dsidev, DSI_IRQSTATUS); in omap_dsi_irq_handler()
809 dsi_write_reg(dsidev, DSI_IRQSTATUS, irqstatus & ~DSI_IRQ_CHANNEL_MASK); in omap_dsi_irq_handler()
811 dsi_read_reg(dsidev, DSI_IRQSTATUS); in omap_dsi_irq_handler()
819 vcstatus[i] = dsi_read_reg(dsidev, DSI_VC_IRQSTATUS(i)); in omap_dsi_irq_handler()
821 dsi_write_reg(dsidev, DSI_VC_IRQSTATUS(i), vcstatus[i]); in omap_dsi_irq_handler()
823 dsi_read_reg(dsidev, DSI_VC_IRQSTATUS(i)); in omap_dsi_irq_handler()
827 ciostatus = dsi_read_reg(dsidev, DSI_COMPLEXIO_IRQ_STATUS); in omap_dsi_irq_handler()
829 dsi_write_reg(dsidev, DSI_COMPLEXIO_IRQ_STATUS, ciostatus); in omap_dsi_irq_handler()
831 dsi_read_reg(dsidev, DSI_COMPLEXIO_IRQ_STATUS); in omap_dsi_irq_handler()
850 dsi_handle_irq_errors(dsidev, irqstatus, vcstatus, ciostatus); in omap_dsi_irq_handler()
852 dsi_collect_irq_stats(dsidev, irqstatus, vcstatus, ciostatus); in omap_dsi_irq_handler()
858 static void _omap_dsi_configure_irqs(struct platform_device *dsidev, in _omap_dsi_configure_irqs() argument
880 old_mask = dsi_read_reg(dsidev, enable_reg); in _omap_dsi_configure_irqs()
882 dsi_write_reg(dsidev, status_reg, (mask ^ old_mask) & mask); in _omap_dsi_configure_irqs()
883 dsi_write_reg(dsidev, enable_reg, mask); in _omap_dsi_configure_irqs()
886 dsi_read_reg(dsidev, enable_reg); in _omap_dsi_configure_irqs()
887 dsi_read_reg(dsidev, status_reg); in _omap_dsi_configure_irqs()
891 static void _omap_dsi_set_irqs(struct platform_device *dsidev) in _omap_dsi_set_irqs() argument
893 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in _omap_dsi_set_irqs()
898 _omap_dsi_configure_irqs(dsidev, dsi->isr_tables.isr_table, in _omap_dsi_set_irqs()
904 static void _omap_dsi_set_irqs_vc(struct platform_device *dsidev, int vc) in _omap_dsi_set_irqs_vc() argument
906 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in _omap_dsi_set_irqs_vc()
908 _omap_dsi_configure_irqs(dsidev, dsi->isr_tables.isr_table_vc[vc], in _omap_dsi_set_irqs_vc()
915 static void _omap_dsi_set_irqs_cio(struct platform_device *dsidev) in _omap_dsi_set_irqs_cio() argument
917 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in _omap_dsi_set_irqs_cio()
919 _omap_dsi_configure_irqs(dsidev, dsi->isr_tables.isr_table_cio, in _omap_dsi_set_irqs_cio()
925 static void _dsi_initialize_irq(struct platform_device *dsidev) in _dsi_initialize_irq() argument
927 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in _dsi_initialize_irq()
935 _omap_dsi_set_irqs(dsidev); in _dsi_initialize_irq()
937 _omap_dsi_set_irqs_vc(dsidev, vc); in _dsi_initialize_irq()
938 _omap_dsi_set_irqs_cio(dsidev); in _dsi_initialize_irq()
999 static int dsi_register_isr(struct platform_device *dsidev, omap_dsi_isr_t isr, in dsi_register_isr() argument
1002 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_register_isr()
1012 _omap_dsi_set_irqs(dsidev); in dsi_register_isr()
1019 static int dsi_unregister_isr(struct platform_device *dsidev, in dsi_unregister_isr() argument
1022 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_unregister_isr()
1032 _omap_dsi_set_irqs(dsidev); in dsi_unregister_isr()
1039 static int dsi_register_isr_vc(struct platform_device *dsidev, int channel, in dsi_register_isr_vc() argument
1042 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_register_isr_vc()
1053 _omap_dsi_set_irqs_vc(dsidev, channel); in dsi_register_isr_vc()
1060 static int dsi_unregister_isr_vc(struct platform_device *dsidev, int channel, in dsi_unregister_isr_vc() argument
1063 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_unregister_isr_vc()
1074 _omap_dsi_set_irqs_vc(dsidev, channel); in dsi_unregister_isr_vc()
1081 static int dsi_register_isr_cio(struct platform_device *dsidev, in dsi_register_isr_cio() argument
1084 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_register_isr_cio()
1094 _omap_dsi_set_irqs_cio(dsidev); in dsi_register_isr_cio()
1101 static int dsi_unregister_isr_cio(struct platform_device *dsidev, in dsi_unregister_isr_cio() argument
1104 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_unregister_isr_cio()
1114 _omap_dsi_set_irqs_cio(dsidev); in dsi_unregister_isr_cio()
1121 static u32 dsi_get_errors(struct platform_device *dsidev) in dsi_get_errors() argument
1123 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_get_errors()
1133 static int dsi_runtime_get(struct platform_device *dsidev) in dsi_runtime_get() argument
1136 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_runtime_get()
1146 static void dsi_runtime_put(struct platform_device *dsidev) in dsi_runtime_put() argument
1148 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_runtime_put()
1157 static int dsi_regulator_init(struct platform_device *dsidev) in dsi_regulator_init() argument
1159 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_regulator_init()
1178 static void _dsi_print_reset_status(struct platform_device *dsidev) in _dsi_print_reset_status() argument
1185 dsi_read_reg(dsidev, DSI_DSIPHY_CFG5); in _dsi_print_reset_status()
1198 FLD_GET(dsi_read_reg(dsidev, DSI_##fld), start, end) in _dsi_print_reset_status()
1213 static inline int dsi_if_enable(struct platform_device *dsidev, bool enable) in dsi_if_enable() argument
1218 REG_FLD_MOD(dsidev, DSI_CTRL, enable, 0, 0); /* IF_EN */ in dsi_if_enable()
1220 if (wait_for_bit_change(dsidev, DSI_CTRL, 0, enable) != enable) { in dsi_if_enable()
1228 static unsigned long dsi_get_pll_hsdiv_dispc_rate(struct platform_device *dsidev) in dsi_get_pll_hsdiv_dispc_rate() argument
1230 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_get_pll_hsdiv_dispc_rate()
1235 static unsigned long dsi_get_pll_hsdiv_dsi_rate(struct platform_device *dsidev) in dsi_get_pll_hsdiv_dsi_rate() argument
1237 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_get_pll_hsdiv_dsi_rate()
1242 static unsigned long dsi_get_txbyteclkhs(struct platform_device *dsidev) in dsi_get_txbyteclkhs() argument
1244 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_get_txbyteclkhs()
1249 static unsigned long dsi_fclk_rate(struct platform_device *dsidev) in dsi_fclk_rate() argument
1252 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_fclk_rate()
1259 r = dsi_get_pll_hsdiv_dsi_rate(dsidev); in dsi_fclk_rate()
1284 static int dsi_set_lp_clk_divisor(struct platform_device *dsidev) in dsi_set_lp_clk_divisor() argument
1286 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_set_lp_clk_divisor()
1298 dsi_fclk = dsi_fclk_rate(dsidev); in dsi_set_lp_clk_divisor()
1307 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, lp_clk_div, 12, 0); in dsi_set_lp_clk_divisor()
1310 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, dsi_fclk > 30000000 ? 1 : 0, 21, 21); in dsi_set_lp_clk_divisor()
1315 static void dsi_enable_scp_clk(struct platform_device *dsidev) in dsi_enable_scp_clk() argument
1317 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_enable_scp_clk()
1320 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 1, 14, 14); /* CIO_CLK_ICG */ in dsi_enable_scp_clk()
1323 static void dsi_disable_scp_clk(struct platform_device *dsidev) in dsi_disable_scp_clk() argument
1325 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_disable_scp_clk()
1329 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 0, 14, 14); /* CIO_CLK_ICG */ in dsi_disable_scp_clk()
1339 static int dsi_pll_power(struct platform_device *dsidev, in dsi_pll_power() argument
1350 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, state, 31, 30); in dsi_pll_power()
1353 while (FLD_GET(dsi_read_reg(dsidev, DSI_CLK_CTRL), 29, 28) != state) { in dsi_pll_power()
1379 struct platform_device *dsidev = dsi->pdev; in dsi_pll_enable() local
1384 r = dsi_regulator_init(dsidev); in dsi_pll_enable()
1388 r = dsi_runtime_get(dsidev); in dsi_pll_enable()
1395 dsi_enable_scp_clk(dsidev); in dsi_pll_enable()
1407 if (wait_for_bit_change(dsidev, DSI_PLL_STATUS, 0, 1) != 1) { in dsi_pll_enable()
1418 r = dsi_pll_power(dsidev, DSI_PLL_POWER_ON_ALL); in dsi_pll_enable()
1432 dsi_disable_scp_clk(dsidev); in dsi_pll_enable()
1433 dsi_runtime_put(dsidev); in dsi_pll_enable()
1437 static void dsi_pll_uninit(struct platform_device *dsidev, bool disconnect_lanes) in dsi_pll_uninit() argument
1439 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_pll_uninit()
1441 dsi_pll_power(dsidev, DSI_PLL_POWER_OFF); in dsi_pll_uninit()
1448 dsi_disable_scp_clk(dsidev); in dsi_pll_uninit()
1449 dsi_runtime_put(dsidev); in dsi_pll_uninit()
1457 struct platform_device *dsidev = dsi->pdev; in dsi_pll_disable() local
1459 dsi_pll_uninit(dsidev, true); in dsi_pll_disable()
1462 static void dsi_dump_dsidev_clocks(struct platform_device *dsidev, in dsi_dump_dsidev_clocks() argument
1465 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_dump_dsidev_clocks()
1474 if (dsi_runtime_get(dsidev)) in dsi_dump_dsidev_clocks()
1510 seq_printf(s, "DSI_FCLK\t%lu\n", dsi_fclk_rate(dsidev)); in dsi_dump_dsidev_clocks()
1515 seq_printf(s, "TxByteClkHS\t%lu\n", dsi_get_txbyteclkhs(dsidev)); in dsi_dump_dsidev_clocks()
1519 dsi_runtime_put(dsidev); in dsi_dump_dsidev_clocks()
1524 struct platform_device *dsidev; in dsi_dump_clocks() local
1528 dsidev = dsi_get_dsidev_from_id(i); in dsi_dump_clocks()
1529 if (dsidev) in dsi_dump_clocks()
1530 dsi_dump_dsidev_clocks(dsidev, s); in dsi_dump_clocks()
1535 static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, in dsi_dump_dsidev_irqs() argument
1538 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_dump_dsidev_irqs()
1634 struct platform_device *dsidev = dsi_get_dsidev_from_id(0); in dsi1_dump_irqs() local
1636 dsi_dump_dsidev_irqs(dsidev, s); in dsi1_dump_irqs()
1641 struct platform_device *dsidev = dsi_get_dsidev_from_id(1); in dsi2_dump_irqs() local
1643 dsi_dump_dsidev_irqs(dsidev, s); in dsi2_dump_irqs()
1647 static void dsi_dump_dsidev_regs(struct platform_device *dsidev, in dsi_dump_dsidev_regs() argument
1650 #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dsi_read_reg(dsidev, r)) in dsi_dump_dsidev_regs()
1652 if (dsi_runtime_get(dsidev)) in dsi_dump_dsidev_regs()
1654 dsi_enable_scp_clk(dsidev); in dsi_dump_dsidev_regs()
1726 dsi_disable_scp_clk(dsidev); in dsi_dump_dsidev_regs()
1727 dsi_runtime_put(dsidev); in dsi_dump_dsidev_regs()
1733 struct platform_device *dsidev = dsi_get_dsidev_from_id(0); in dsi1_dump_regs() local
1735 dsi_dump_dsidev_regs(dsidev, s); in dsi1_dump_regs()
1740 struct platform_device *dsidev = dsi_get_dsidev_from_id(1); in dsi2_dump_regs() local
1742 dsi_dump_dsidev_regs(dsidev, s); in dsi2_dump_regs()
1751 static int dsi_cio_power(struct platform_device *dsidev, in dsi_cio_power() argument
1757 REG_FLD_MOD(dsidev, DSI_COMPLEXIO_CFG1, state, 28, 27); in dsi_cio_power()
1760 while (FLD_GET(dsi_read_reg(dsidev, DSI_COMPLEXIO_CFG1), in dsi_cio_power()
1773 static unsigned dsi_get_line_buf_size(struct platform_device *dsidev) in dsi_get_line_buf_size() argument
1784 val = REG_GET(dsidev, DSI_GNQ, 14, 12); /* VP1_LINE_BUFFER_SIZE */ in dsi_get_line_buf_size()
1807 static int dsi_set_lane_config(struct platform_device *dsidev) in dsi_set_lane_config() argument
1809 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_set_lane_config()
1821 r = dsi_read_reg(dsidev, DSI_COMPLEXIO_CFG1); in dsi_set_lane_config()
1850 dsi_write_reg(dsidev, DSI_COMPLEXIO_CFG1, r); in dsi_set_lane_config()
1855 static inline unsigned ns2ddr(struct platform_device *dsidev, unsigned ns) in ns2ddr() argument
1857 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in ns2ddr()
1864 static inline unsigned ddr2ns(struct platform_device *dsidev, unsigned ddr) in ddr2ns() argument
1866 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in ddr2ns()
1872 static void dsi_cio_timings(struct platform_device *dsidev) in dsi_cio_timings() argument
1884 ths_prepare = ns2ddr(dsidev, 70) + 2; in dsi_cio_timings()
1887 ths_prepare_ths_zero = ns2ddr(dsidev, 175) + 2; in dsi_cio_timings()
1890 ths_trail = ns2ddr(dsidev, 60) + 5; in dsi_cio_timings()
1893 ths_exit = ns2ddr(dsidev, 145); in dsi_cio_timings()
1896 tlpx_half = ns2ddr(dsidev, 25); in dsi_cio_timings()
1899 tclk_trail = ns2ddr(dsidev, 60) + 2; in dsi_cio_timings()
1902 tclk_prepare = ns2ddr(dsidev, 65); in dsi_cio_timings()
1905 tclk_zero = ns2ddr(dsidev, 260); in dsi_cio_timings()
1908 ths_prepare, ddr2ns(dsidev, ths_prepare), in dsi_cio_timings()
1909 ths_prepare_ths_zero, ddr2ns(dsidev, ths_prepare_ths_zero)); in dsi_cio_timings()
1911 ths_trail, ddr2ns(dsidev, ths_trail), in dsi_cio_timings()
1912 ths_exit, ddr2ns(dsidev, ths_exit)); in dsi_cio_timings()
1916 tlpx_half, ddr2ns(dsidev, tlpx_half), in dsi_cio_timings()
1917 tclk_trail, ddr2ns(dsidev, tclk_trail), in dsi_cio_timings()
1918 tclk_zero, ddr2ns(dsidev, tclk_zero)); in dsi_cio_timings()
1920 tclk_prepare, ddr2ns(dsidev, tclk_prepare)); in dsi_cio_timings()
1924 r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG0); in dsi_cio_timings()
1929 dsi_write_reg(dsidev, DSI_DSIPHY_CFG0, r); in dsi_cio_timings()
1931 r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG1); in dsi_cio_timings()
1942 dsi_write_reg(dsidev, DSI_DSIPHY_CFG1, r); in dsi_cio_timings()
1944 r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG2); in dsi_cio_timings()
1946 dsi_write_reg(dsidev, DSI_DSIPHY_CFG2, r); in dsi_cio_timings()
1950 static void dsi_cio_enable_lane_override(struct platform_device *dsidev, in dsi_cio_enable_lane_override() argument
1953 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_cio_enable_lane_override()
1982 REG_FLD_MOD(dsidev, DSI_DSIPHY_CFG10, l, lptxscp_start, 17); in dsi_cio_enable_lane_override()
1987 REG_FLD_MOD(dsidev, DSI_DSIPHY_CFG10, 1, 27, 27); in dsi_cio_enable_lane_override()
1990 static void dsi_cio_disable_lane_override(struct platform_device *dsidev) in dsi_cio_disable_lane_override() argument
1993 REG_FLD_MOD(dsidev, DSI_DSIPHY_CFG10, 0, 27, 27); /* ENLPTXSCPDAT */ in dsi_cio_disable_lane_override()
1996 REG_FLD_MOD(dsidev, DSI_DSIPHY_CFG10, 0, 22, 17); in dsi_cio_disable_lane_override()
1999 static int dsi_cio_wait_tx_clk_esc_reset(struct platform_device *dsidev) in dsi_cio_wait_tx_clk_esc_reset() argument
2001 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_cio_wait_tx_clk_esc_reset()
2021 l = dsi_read_reg(dsidev, DSI_DSIPHY_CFG5); in dsi_cio_wait_tx_clk_esc_reset()
2048 static unsigned dsi_get_lane_mask(struct platform_device *dsidev) in dsi_get_lane_mask() argument
2050 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_get_lane_mask()
2062 static int dsi_cio_init(struct platform_device *dsidev) in dsi_cio_init() argument
2064 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_cio_init()
2070 r = dss_dsi_enable_pads(dsi->module_id, dsi_get_lane_mask(dsidev)); in dsi_cio_init()
2074 dsi_enable_scp_clk(dsidev); in dsi_cio_init()
2079 dsi_read_reg(dsidev, DSI_DSIPHY_CFG5); in dsi_cio_init()
2081 if (wait_for_bit_change(dsidev, DSI_DSIPHY_CFG5, 30, 1) != 1) { in dsi_cio_init()
2087 r = dsi_set_lane_config(dsidev); in dsi_cio_init()
2092 l = dsi_read_reg(dsidev, DSI_TIMING1); in dsi_cio_init()
2097 dsi_write_reg(dsidev, DSI_TIMING1, l); in dsi_cio_init()
2122 dsi_cio_enable_lane_override(dsidev, mask_p, 0); in dsi_cio_init()
2125 r = dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_ON); in dsi_cio_init()
2129 if (wait_for_bit_change(dsidev, DSI_COMPLEXIO_CFG1, 29, 1) != 1) { in dsi_cio_init()
2135 dsi_if_enable(dsidev, true); in dsi_cio_init()
2136 dsi_if_enable(dsidev, false); in dsi_cio_init()
2137 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 1, 20, 20); /* LP_CLK_ENABLE */ in dsi_cio_init()
2139 r = dsi_cio_wait_tx_clk_esc_reset(dsidev); in dsi_cio_init()
2151 dsi_cio_disable_lane_override(dsidev); in dsi_cio_init()
2155 REG_FLD_MOD(dsidev, DSI_TIMING1, 0, 15, 15); in dsi_cio_init()
2157 dsi_cio_timings(dsidev); in dsi_cio_init()
2161 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, in dsi_cio_init()
2172 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 0, 20, 20); /* LP_CLK_ENABLE */ in dsi_cio_init()
2174 dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF); in dsi_cio_init()
2177 dsi_cio_disable_lane_override(dsidev); in dsi_cio_init()
2179 dsi_disable_scp_clk(dsidev); in dsi_cio_init()
2180 dss_dsi_disable_pads(dsi->module_id, dsi_get_lane_mask(dsidev)); in dsi_cio_init()
2184 static void dsi_cio_uninit(struct platform_device *dsidev) in dsi_cio_uninit() argument
2186 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_cio_uninit()
2189 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 0, 13, 13); in dsi_cio_uninit()
2191 dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF); in dsi_cio_uninit()
2192 dsi_disable_scp_clk(dsidev); in dsi_cio_uninit()
2193 dss_dsi_disable_pads(dsi->module_id, dsi_get_lane_mask(dsidev)); in dsi_cio_uninit()
2196 static void dsi_config_tx_fifo(struct platform_device *dsidev, in dsi_config_tx_fifo() argument
2200 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_config_tx_fifo()
2226 dsi_write_reg(dsidev, DSI_TX_FIFO_VC_SIZE, r); in dsi_config_tx_fifo()
2229 static void dsi_config_rx_fifo(struct platform_device *dsidev, in dsi_config_rx_fifo() argument
2233 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_config_rx_fifo()
2259 dsi_write_reg(dsidev, DSI_RX_FIFO_VC_SIZE, r); in dsi_config_rx_fifo()
2262 static int dsi_force_tx_stop_mode_io(struct platform_device *dsidev) in dsi_force_tx_stop_mode_io() argument
2266 r = dsi_read_reg(dsidev, DSI_TIMING1); in dsi_force_tx_stop_mode_io()
2268 dsi_write_reg(dsidev, DSI_TIMING1, r); in dsi_force_tx_stop_mode_io()
2270 if (wait_for_bit_change(dsidev, DSI_TIMING1, 15, 0) != 0) { in dsi_force_tx_stop_mode_io()
2278 static bool dsi_vc_is_enabled(struct platform_device *dsidev, int channel) in dsi_vc_is_enabled() argument
2280 return REG_GET(dsidev, DSI_VC_CTRL(channel), 0, 0); in dsi_vc_is_enabled()
2287 struct dsi_data *dsi = dsi_get_dsidrv_data(vp_data->dsidev); in dsi_packet_sent_handler_vp()
2291 if (REG_GET(vp_data->dsidev, DSI_VC_TE(channel), bit, bit) == 0) in dsi_packet_sent_handler_vp()
2295 static int dsi_sync_vc_vp(struct platform_device *dsidev, int channel) in dsi_sync_vc_vp() argument
2297 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_sync_vc_vp()
2300 .dsidev = dsidev, in dsi_sync_vc_vp()
2308 r = dsi_register_isr_vc(dsidev, channel, dsi_packet_sent_handler_vp, in dsi_sync_vc_vp()
2314 if (REG_GET(dsidev, DSI_VC_TE(channel), bit, bit)) { in dsi_sync_vc_vp()
2323 dsi_unregister_isr_vc(dsidev, channel, dsi_packet_sent_handler_vp, in dsi_sync_vc_vp()
2328 dsi_unregister_isr_vc(dsidev, channel, dsi_packet_sent_handler_vp, in dsi_sync_vc_vp()
2338 struct dsi_data *dsi = dsi_get_dsidrv_data(l4_data->dsidev); in dsi_packet_sent_handler_l4()
2341 if (REG_GET(l4_data->dsidev, DSI_VC_CTRL(channel), 5, 5) == 0) in dsi_packet_sent_handler_l4()
2345 static int dsi_sync_vc_l4(struct platform_device *dsidev, int channel) in dsi_sync_vc_l4() argument
2349 .dsidev = dsidev, in dsi_sync_vc_l4()
2354 r = dsi_register_isr_vc(dsidev, channel, dsi_packet_sent_handler_l4, in dsi_sync_vc_l4()
2360 if (REG_GET(dsidev, DSI_VC_CTRL(channel), 5, 5)) { in dsi_sync_vc_l4()
2369 dsi_unregister_isr_vc(dsidev, channel, dsi_packet_sent_handler_l4, in dsi_sync_vc_l4()
2374 dsi_unregister_isr_vc(dsidev, channel, dsi_packet_sent_handler_l4, in dsi_sync_vc_l4()
2380 static int dsi_sync_vc(struct platform_device *dsidev, int channel) in dsi_sync_vc() argument
2382 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_sync_vc()
2384 WARN_ON(!dsi_bus_is_locked(dsidev)); in dsi_sync_vc()
2386 if (!dsi_vc_is_enabled(dsidev, channel)) in dsi_sync_vc()
2391 return dsi_sync_vc_vp(dsidev, channel); in dsi_sync_vc()
2393 return dsi_sync_vc_l4(dsidev, channel); in dsi_sync_vc()
2400 static int dsi_vc_enable(struct platform_device *dsidev, int channel, in dsi_vc_enable() argument
2408 REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), enable, 0, 0); in dsi_vc_enable()
2410 if (wait_for_bit_change(dsidev, DSI_VC_CTRL(channel), in dsi_vc_enable()
2419 static void dsi_vc_initial_config(struct platform_device *dsidev, int channel) in dsi_vc_initial_config() argument
2421 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_initial_config()
2426 r = dsi_read_reg(dsidev, DSI_VC_CTRL(channel)); in dsi_vc_initial_config()
2445 dsi_write_reg(dsidev, DSI_VC_CTRL(channel), r); in dsi_vc_initial_config()
2450 static int dsi_vc_config_source(struct platform_device *dsidev, int channel, in dsi_vc_config_source() argument
2453 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_config_source()
2460 dsi_sync_vc(dsidev, channel); in dsi_vc_config_source()
2462 dsi_vc_enable(dsidev, channel, 0); in dsi_vc_config_source()
2465 if (wait_for_bit_change(dsidev, DSI_VC_CTRL(channel), 15, 0) != 0) { in dsi_vc_config_source()
2471 REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), source, 1, 1); in dsi_vc_config_source()
2476 REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), enable, 30, 30); in dsi_vc_config_source()
2479 dsi_vc_enable(dsidev, channel, 1); in dsi_vc_config_source()
2489 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_enable_hs() local
2490 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_enable_hs()
2494 WARN_ON(!dsi_bus_is_locked(dsidev)); in dsi_vc_enable_hs()
2496 dsi_vc_enable(dsidev, channel, 0); in dsi_vc_enable_hs()
2497 dsi_if_enable(dsidev, 0); in dsi_vc_enable_hs()
2499 REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), enable, 9, 9); in dsi_vc_enable_hs()
2501 dsi_vc_enable(dsidev, channel, 1); in dsi_vc_enable_hs()
2502 dsi_if_enable(dsidev, 1); in dsi_vc_enable_hs()
2504 dsi_force_tx_stop_mode_io(dsidev); in dsi_vc_enable_hs()
2511 static void dsi_vc_flush_long_data(struct platform_device *dsidev, int channel) in dsi_vc_flush_long_data() argument
2513 while (REG_GET(dsidev, DSI_VC_CTRL(channel), 20, 20)) { in dsi_vc_flush_long_data()
2515 val = dsi_read_reg(dsidev, DSI_VC_SHORT_PACKET_HEADER(channel)); in dsi_vc_flush_long_data()
2561 static u16 dsi_vc_flush_receive_data(struct platform_device *dsidev, in dsi_vc_flush_receive_data() argument
2565 while (REG_GET(dsidev, DSI_VC_CTRL(channel), 20, 20)) { in dsi_vc_flush_receive_data()
2568 val = dsi_read_reg(dsidev, DSI_VC_SHORT_PACKET_HEADER(channel)); in dsi_vc_flush_receive_data()
2583 dsi_vc_flush_long_data(dsidev, channel); in dsi_vc_flush_receive_data()
2591 static int dsi_vc_send_bta(struct platform_device *dsidev, int channel) in dsi_vc_send_bta() argument
2593 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_send_bta()
2598 WARN_ON(!dsi_bus_is_locked(dsidev)); in dsi_vc_send_bta()
2601 if (REG_GET(dsidev, DSI_VC_CTRL(channel), 20, 20)) { in dsi_vc_send_bta()
2603 dsi_vc_flush_receive_data(dsidev, channel); in dsi_vc_send_bta()
2606 REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), 1, 6, 6); /* BTA_EN */ in dsi_vc_send_bta()
2609 dsi_read_reg(dsidev, DSI_VC_CTRL(channel)); in dsi_vc_send_bta()
2616 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_send_bta_sync() local
2621 r = dsi_register_isr_vc(dsidev, channel, dsi_completion_handler, in dsi_vc_send_bta_sync()
2626 r = dsi_register_isr(dsidev, dsi_completion_handler, &completion, in dsi_vc_send_bta_sync()
2631 r = dsi_vc_send_bta(dsidev, channel); in dsi_vc_send_bta_sync()
2642 err = dsi_get_errors(dsidev); in dsi_vc_send_bta_sync()
2649 dsi_unregister_isr(dsidev, dsi_completion_handler, &completion, in dsi_vc_send_bta_sync()
2652 dsi_unregister_isr_vc(dsidev, channel, dsi_completion_handler, in dsi_vc_send_bta_sync()
2658 static inline void dsi_vc_write_long_header(struct platform_device *dsidev, in dsi_vc_write_long_header() argument
2661 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_write_long_header()
2665 WARN_ON(!dsi_bus_is_locked(dsidev)); in dsi_vc_write_long_header()
2672 dsi_write_reg(dsidev, DSI_VC_LONG_PACKET_HEADER(channel), val); in dsi_vc_write_long_header()
2675 static inline void dsi_vc_write_long_payload(struct platform_device *dsidev, in dsi_vc_write_long_payload() argument
2685 dsi_write_reg(dsidev, DSI_VC_LONG_PACKET_PAYLOAD(channel), val); in dsi_vc_write_long_payload()
2688 static int dsi_vc_send_long(struct platform_device *dsidev, int channel, in dsi_vc_send_long() argument
2692 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_send_long()
2707 dsi_vc_config_source(dsidev, channel, DSI_VC_SOURCE_L4); in dsi_vc_send_long()
2709 dsi_vc_write_long_header(dsidev, channel, data_type, len, ecc); in dsi_vc_send_long()
2721 dsi_vc_write_long_payload(dsidev, channel, b1, b2, b3, b4); in dsi_vc_send_long()
2746 dsi_vc_write_long_payload(dsidev, channel, b1, b2, b3, 0); in dsi_vc_send_long()
2752 static int dsi_vc_send_short(struct platform_device *dsidev, int channel, in dsi_vc_send_short() argument
2755 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_send_short()
2759 WARN_ON(!dsi_bus_is_locked(dsidev)); in dsi_vc_send_short()
2766 dsi_vc_config_source(dsidev, channel, DSI_VC_SOURCE_L4); in dsi_vc_send_short()
2768 if (FLD_GET(dsi_read_reg(dsidev, DSI_VC_CTRL(channel)), 16, 16)) { in dsi_vc_send_short()
2777 dsi_write_reg(dsidev, DSI_VC_SHORT_PACKET_HEADER(channel), r); in dsi_vc_send_short()
2784 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_send_null() local
2786 return dsi_vc_send_long(dsidev, channel, MIPI_DSI_NULL_PACKET, NULL, in dsi_vc_send_null()
2790 static int dsi_vc_write_nosync_common(struct platform_device *dsidev, in dsi_vc_write_nosync_common() argument
2797 r = dsi_vc_send_short(dsidev, channel, in dsi_vc_write_nosync_common()
2800 r = dsi_vc_send_short(dsidev, channel, in dsi_vc_write_nosync_common()
2805 r = dsi_vc_send_short(dsidev, channel, in dsi_vc_write_nosync_common()
2811 r = dsi_vc_send_long(dsidev, channel, in dsi_vc_write_nosync_common()
2823 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_dcs_write_nosync() local
2825 return dsi_vc_write_nosync_common(dsidev, channel, data, len, in dsi_vc_dcs_write_nosync()
2832 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_generic_write_nosync() local
2834 return dsi_vc_write_nosync_common(dsidev, channel, data, len, in dsi_vc_generic_write_nosync()
2841 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_write_common() local
2844 r = dsi_vc_write_nosync_common(dsidev, channel, data, len, type); in dsi_vc_write_common()
2853 if (REG_GET(dsidev, DSI_VC_CTRL(channel), 20, 20)) { in dsi_vc_write_common()
2855 dsi_vc_flush_receive_data(dsidev, channel); in dsi_vc_write_common()
2881 static int dsi_vc_dcs_send_read_request(struct platform_device *dsidev, in dsi_vc_dcs_send_read_request() argument
2884 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_dcs_send_read_request()
2891 r = dsi_vc_send_short(dsidev, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0); in dsi_vc_dcs_send_read_request()
2901 static int dsi_vc_generic_send_read_request(struct platform_device *dsidev, in dsi_vc_generic_send_read_request() argument
2904 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_generic_send_read_request()
2927 r = dsi_vc_send_short(dsidev, channel, data_type, data, 0); in dsi_vc_generic_send_read_request()
2937 static int dsi_vc_read_rx_fifo(struct platform_device *dsidev, int channel, in dsi_vc_read_rx_fifo() argument
2940 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_read_rx_fifo()
2946 if (REG_GET(dsidev, DSI_VC_CTRL(channel), 20, 20) == 0) { in dsi_vc_read_rx_fifo()
2952 val = dsi_read_reg(dsidev, DSI_VC_SHORT_PACKET_HEADER(channel)); in dsi_vc_read_rx_fifo()
3015 val = dsi_read_reg(dsidev, in dsi_vc_read_rx_fifo()
3049 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_dcs_read() local
3052 r = dsi_vc_dcs_send_read_request(dsidev, channel, dcs_cmd); in dsi_vc_dcs_read()
3060 r = dsi_vc_read_rx_fifo(dsidev, channel, buf, buflen, in dsi_vc_dcs_read()
3079 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_generic_read() local
3082 r = dsi_vc_generic_send_read_request(dsidev, channel, reqdata, reqlen); in dsi_vc_generic_read()
3090 r = dsi_vc_read_rx_fifo(dsidev, channel, buf, buflen, in dsi_vc_generic_read()
3106 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_set_max_rx_packet_size() local
3108 return dsi_vc_send_short(dsidev, channel, in dsi_vc_set_max_rx_packet_size()
3112 static int dsi_enter_ulps(struct platform_device *dsidev) in dsi_enter_ulps() argument
3114 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_enter_ulps()
3121 WARN_ON(!dsi_bus_is_locked(dsidev)); in dsi_enter_ulps()
3129 if (REG_GET(dsidev, DSI_CLK_CTRL, 13, 13)) { in dsi_enter_ulps()
3130 dsi_if_enable(dsidev, 0); in dsi_enter_ulps()
3131 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 0, 13, 13); in dsi_enter_ulps()
3132 dsi_if_enable(dsidev, 1); in dsi_enter_ulps()
3135 dsi_sync_vc(dsidev, 0); in dsi_enter_ulps()
3136 dsi_sync_vc(dsidev, 1); in dsi_enter_ulps()
3137 dsi_sync_vc(dsidev, 2); in dsi_enter_ulps()
3138 dsi_sync_vc(dsidev, 3); in dsi_enter_ulps()
3140 dsi_force_tx_stop_mode_io(dsidev); in dsi_enter_ulps()
3142 dsi_vc_enable(dsidev, 0, false); in dsi_enter_ulps()
3143 dsi_vc_enable(dsidev, 1, false); in dsi_enter_ulps()
3144 dsi_vc_enable(dsidev, 2, false); in dsi_enter_ulps()
3145 dsi_vc_enable(dsidev, 3, false); in dsi_enter_ulps()
3147 if (REG_GET(dsidev, DSI_COMPLEXIO_CFG2, 16, 16)) { /* HS_BUSY */ in dsi_enter_ulps()
3152 if (REG_GET(dsidev, DSI_COMPLEXIO_CFG2, 17, 17)) { /* LP_BUSY */ in dsi_enter_ulps()
3157 r = dsi_register_isr_cio(dsidev, dsi_completion_handler, &completion, in dsi_enter_ulps()
3171 REG_FLD_MOD(dsidev, DSI_COMPLEXIO_CFG2, mask, 9, 5); in dsi_enter_ulps()
3174 dsi_read_reg(dsidev, DSI_COMPLEXIO_CFG2); in dsi_enter_ulps()
3183 dsi_unregister_isr_cio(dsidev, dsi_completion_handler, &completion, in dsi_enter_ulps()
3187 REG_FLD_MOD(dsidev, DSI_COMPLEXIO_CFG2, 0, 9, 5); in dsi_enter_ulps()
3190 dsi_read_reg(dsidev, DSI_COMPLEXIO_CFG2); in dsi_enter_ulps()
3192 dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_ULPS); in dsi_enter_ulps()
3194 dsi_if_enable(dsidev, false); in dsi_enter_ulps()
3201 dsi_unregister_isr_cio(dsidev, dsi_completion_handler, &completion, in dsi_enter_ulps()
3206 static void dsi_set_lp_rx_timeout(struct platform_device *dsidev, in dsi_set_lp_rx_timeout() argument
3216 fck = dsi_fclk_rate(dsidev); in dsi_set_lp_rx_timeout()
3218 r = dsi_read_reg(dsidev, DSI_TIMING2); in dsi_set_lp_rx_timeout()
3223 dsi_write_reg(dsidev, DSI_TIMING2, r); in dsi_set_lp_rx_timeout()
3233 static void dsi_set_ta_timeout(struct platform_device *dsidev, unsigned ticks, in dsi_set_ta_timeout() argument
3243 fck = dsi_fclk_rate(dsidev); in dsi_set_ta_timeout()
3245 r = dsi_read_reg(dsidev, DSI_TIMING1); in dsi_set_ta_timeout()
3250 dsi_write_reg(dsidev, DSI_TIMING1, r); in dsi_set_ta_timeout()
3260 static void dsi_set_stop_state_counter(struct platform_device *dsidev, in dsi_set_stop_state_counter() argument
3270 fck = dsi_fclk_rate(dsidev); in dsi_set_stop_state_counter()
3272 r = dsi_read_reg(dsidev, DSI_TIMING1); in dsi_set_stop_state_counter()
3277 dsi_write_reg(dsidev, DSI_TIMING1, r); in dsi_set_stop_state_counter()
3287 static void dsi_set_hs_tx_timeout(struct platform_device *dsidev, in dsi_set_hs_tx_timeout() argument
3297 fck = dsi_get_txbyteclkhs(dsidev); in dsi_set_hs_tx_timeout()
3299 r = dsi_read_reg(dsidev, DSI_TIMING2); in dsi_set_hs_tx_timeout()
3304 dsi_write_reg(dsidev, DSI_TIMING2, r); in dsi_set_hs_tx_timeout()
3314 static void dsi_config_vp_num_line_buffers(struct platform_device *dsidev) in dsi_config_vp_num_line_buffers() argument
3316 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_config_vp_num_line_buffers()
3336 REG_FLD_MOD(dsidev, DSI_CTRL, num_line_buffers, 13, 12); in dsi_config_vp_num_line_buffers()
3339 static void dsi_config_vp_sync_events(struct platform_device *dsidev) in dsi_config_vp_sync_events() argument
3341 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_config_vp_sync_events()
3350 r = dsi_read_reg(dsidev, DSI_CTRL); in dsi_config_vp_sync_events()
3358 dsi_write_reg(dsidev, DSI_CTRL, r); in dsi_config_vp_sync_events()
3361 static void dsi_config_blanking_modes(struct platform_device *dsidev) in dsi_config_blanking_modes() argument
3363 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_config_blanking_modes()
3374 r = dsi_read_reg(dsidev, DSI_CTRL); in dsi_config_blanking_modes()
3379 dsi_write_reg(dsidev, DSI_CTRL, r); in dsi_config_blanking_modes()
3444 static void dsi_config_cmd_mode_interleaving(struct platform_device *dsidev) in dsi_config_cmd_mode_interleaving() argument
3446 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_config_cmd_mode_interleaving()
3463 r = dsi_read_reg(dsidev, DSI_CTRL); in dsi_config_cmd_mode_interleaving()
3469 r = dsi_read_reg(dsidev, DSI_VM_TIMING1); in dsi_config_cmd_mode_interleaving()
3474 r = dsi_read_reg(dsidev, DSI_CLK_TIMING); in dsi_config_cmd_mode_interleaving()
3478 r = dsi_read_reg(dsidev, DSI_VM_TIMING7); in dsi_config_cmd_mode_interleaving()
3482 r = dsi_read_reg(dsidev, DSI_CLK_CTRL); in dsi_config_cmd_mode_interleaving()
3486 r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG0); in dsi_config_cmd_mode_interleaving()
3489 r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG1); in dsi_config_cmd_mode_interleaving()
3543 r = dsi_read_reg(dsidev, DSI_VM_TIMING4); in dsi_config_cmd_mode_interleaving()
3547 dsi_write_reg(dsidev, DSI_VM_TIMING4, r); in dsi_config_cmd_mode_interleaving()
3549 r = dsi_read_reg(dsidev, DSI_VM_TIMING5); in dsi_config_cmd_mode_interleaving()
3553 dsi_write_reg(dsidev, DSI_VM_TIMING5, r); in dsi_config_cmd_mode_interleaving()
3555 r = dsi_read_reg(dsidev, DSI_VM_TIMING6); in dsi_config_cmd_mode_interleaving()
3558 dsi_write_reg(dsidev, DSI_VM_TIMING6, r); in dsi_config_cmd_mode_interleaving()
3561 static int dsi_proto_config(struct platform_device *dsidev) in dsi_proto_config() argument
3563 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_proto_config()
3567 dsi_config_tx_fifo(dsidev, DSI_FIFO_SIZE_32, in dsi_proto_config()
3572 dsi_config_rx_fifo(dsidev, DSI_FIFO_SIZE_32, in dsi_proto_config()
3578 dsi_set_stop_state_counter(dsidev, 0x1000, false, false); in dsi_proto_config()
3579 dsi_set_ta_timeout(dsidev, 0x1fff, true, true); in dsi_proto_config()
3580 dsi_set_lp_rx_timeout(dsidev, 0x1fff, true, true); in dsi_proto_config()
3581 dsi_set_hs_tx_timeout(dsidev, 0x1fff, true, true); in dsi_proto_config()
3598 r = dsi_read_reg(dsidev, DSI_CTRL); in dsi_proto_config()
3613 dsi_write_reg(dsidev, DSI_CTRL, r); in dsi_proto_config()
3615 dsi_config_vp_num_line_buffers(dsidev); in dsi_proto_config()
3618 dsi_config_vp_sync_events(dsidev); in dsi_proto_config()
3619 dsi_config_blanking_modes(dsidev); in dsi_proto_config()
3620 dsi_config_cmd_mode_interleaving(dsidev); in dsi_proto_config()
3623 dsi_vc_initial_config(dsidev, 0); in dsi_proto_config()
3624 dsi_vc_initial_config(dsidev, 1); in dsi_proto_config()
3625 dsi_vc_initial_config(dsidev, 2); in dsi_proto_config()
3626 dsi_vc_initial_config(dsidev, 3); in dsi_proto_config()
3631 static void dsi_proto_timings(struct platform_device *dsidev) in dsi_proto_timings() argument
3633 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_proto_timings()
3644 r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG0); in dsi_proto_timings()
3651 r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG1); in dsi_proto_timings()
3655 r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG2); in dsi_proto_timings()
3661 tclk_post = ns2ddr(dsidev, 60) + 26; in dsi_proto_timings()
3672 r = dsi_read_reg(dsidev, DSI_CLK_TIMING); in dsi_proto_timings()
3675 dsi_write_reg(dsidev, DSI_CLK_TIMING, r); in dsi_proto_timings()
3689 dsi_write_reg(dsidev, DSI_VM_TIMING7, r); in dsi_proto_timings()
3723 r = dsi_read_reg(dsidev, DSI_VM_TIMING1); in dsi_proto_timings()
3727 dsi_write_reg(dsidev, DSI_VM_TIMING1, r); in dsi_proto_timings()
3729 r = dsi_read_reg(dsidev, DSI_VM_TIMING2); in dsi_proto_timings()
3734 dsi_write_reg(dsidev, DSI_VM_TIMING2, r); in dsi_proto_timings()
3736 r = dsi_read_reg(dsidev, DSI_VM_TIMING3); in dsi_proto_timings()
3739 dsi_write_reg(dsidev, DSI_VM_TIMING3, r); in dsi_proto_timings()
3746 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_configure_pins() local
3747 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_configure_pins()
3812 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_enable_video_output() local
3813 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_enable_video_output()
3826 r = dsi_display_init_dispc(dsidev, mgr); in dsi_enable_video_output()
3849 dsi_if_enable(dsidev, false); in dsi_enable_video_output()
3850 dsi_vc_enable(dsidev, channel, false); in dsi_enable_video_output()
3853 REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), 1, 4, 4); in dsi_enable_video_output()
3857 dsi_vc_write_long_header(dsidev, channel, data_type, in dsi_enable_video_output()
3860 dsi_vc_enable(dsidev, channel, true); in dsi_enable_video_output()
3861 dsi_if_enable(dsidev, true); in dsi_enable_video_output()
3872 dsi_if_enable(dsidev, false); in dsi_enable_video_output()
3873 dsi_vc_enable(dsidev, channel, false); in dsi_enable_video_output()
3876 dsi_display_uninit_dispc(dsidev, mgr); in dsi_enable_video_output()
3883 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_disable_video_output() local
3884 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_disable_video_output()
3888 dsi_if_enable(dsidev, false); in dsi_disable_video_output()
3889 dsi_vc_enable(dsidev, channel, false); in dsi_disable_video_output()
3892 REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), 0, 4, 4); in dsi_disable_video_output()
3894 dsi_vc_enable(dsidev, channel, true); in dsi_disable_video_output()
3895 dsi_if_enable(dsidev, true); in dsi_disable_video_output()
3900 dsi_display_uninit_dispc(dsidev, mgr); in dsi_disable_video_output()
3903 static void dsi_update_screen_dispc(struct platform_device *dsidev) in dsi_update_screen_dispc() argument
3905 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_update_screen_dispc()
3922 dsi_vc_config_source(dsidev, channel, DSI_VC_SOURCE_VP); in dsi_update_screen_dispc()
3943 dsi_write_reg(dsidev, DSI_VC_TE(channel), l); in dsi_update_screen_dispc()
3945 dsi_vc_write_long_header(dsidev, channel, MIPI_DSI_DCS_LONG_WRITE, in dsi_update_screen_dispc()
3952 dsi_write_reg(dsidev, DSI_VC_TE(channel), l); in dsi_update_screen_dispc()
3962 dsi_perf_mark_start(dsidev); in dsi_update_screen_dispc()
3975 REG_FLD_MOD(dsidev, DSI_TIMING2, 0, 15, 15); /* LP_RX_TO */ in dsi_update_screen_dispc()
3977 dsi_vc_send_bta(dsidev, channel); in dsi_update_screen_dispc()
3992 static void dsi_handle_framedone(struct platform_device *dsidev, int error) in dsi_handle_framedone() argument
3994 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_handle_framedone()
4001 REG_FLD_MOD(dsidev, DSI_TIMING2, 1, 15, 15); /* LP_RX_TO */ in dsi_handle_framedone()
4007 dsi_perf_show(dsidev, "DISPC"); in dsi_handle_framedone()
4028 struct platform_device *dsidev = (struct platform_device *) data; in dsi_framedone_irq_callback() local
4029 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_framedone_irq_callback()
4038 dsi_handle_framedone(dsidev, 0); in dsi_framedone_irq_callback()
4044 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_update() local
4045 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_update()
4047 dsi_perf_mark_setup(dsidev); in dsi_update()
4058 dsi_update_screen_dispc(dsidev); in dsi_update()
4065 static int dsi_configure_dispc_clocks(struct platform_device *dsidev) in dsi_configure_dispc_clocks() argument
4067 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_configure_dispc_clocks()
4072 fck = dsi_get_pll_hsdiv_dispc_rate(dsidev); in dsi_configure_dispc_clocks()
4088 static int dsi_display_init_dispc(struct platform_device *dsidev, in dsi_display_init_dispc() argument
4091 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_display_init_dispc()
4100 dsi_framedone_irq_callback, dsidev); in dsi_display_init_dispc()
4126 r = dsi_configure_dispc_clocks(dsidev); in dsi_display_init_dispc()
4141 dsi_framedone_irq_callback, dsidev); in dsi_display_init_dispc()
4147 static void dsi_display_uninit_dispc(struct platform_device *dsidev, in dsi_display_uninit_dispc() argument
4150 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_display_uninit_dispc()
4154 dsi_framedone_irq_callback, dsidev); in dsi_display_uninit_dispc()
4159 static int dsi_configure_dsi_clocks(struct platform_device *dsidev) in dsi_configure_dsi_clocks() argument
4161 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_configure_dsi_clocks()
4176 static int dsi_display_init_dsi(struct platform_device *dsidev) in dsi_display_init_dsi() argument
4178 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_display_init_dsi()
4185 r = dsi_configure_dsi_clocks(dsidev); in dsi_display_init_dsi()
4195 r = dsi_cio_init(dsidev); in dsi_display_init_dsi()
4199 _dsi_print_reset_status(dsidev); in dsi_display_init_dsi()
4201 dsi_proto_timings(dsidev); in dsi_display_init_dsi()
4202 dsi_set_lp_clk_divisor(dsidev); in dsi_display_init_dsi()
4205 _dsi_print_reset_status(dsidev); in dsi_display_init_dsi()
4207 r = dsi_proto_config(dsidev); in dsi_display_init_dsi()
4212 dsi_vc_enable(dsidev, 0, 1); in dsi_display_init_dsi()
4213 dsi_vc_enable(dsidev, 1, 1); in dsi_display_init_dsi()
4214 dsi_vc_enable(dsidev, 2, 1); in dsi_display_init_dsi()
4215 dsi_vc_enable(dsidev, 3, 1); in dsi_display_init_dsi()
4216 dsi_if_enable(dsidev, 1); in dsi_display_init_dsi()
4217 dsi_force_tx_stop_mode_io(dsidev); in dsi_display_init_dsi()
4221 dsi_cio_uninit(dsidev); in dsi_display_init_dsi()
4230 static void dsi_display_uninit_dsi(struct platform_device *dsidev, in dsi_display_uninit_dsi() argument
4233 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_display_uninit_dsi()
4236 dsi_enter_ulps(dsidev); in dsi_display_uninit_dsi()
4239 dsi_if_enable(dsidev, 0); in dsi_display_uninit_dsi()
4240 dsi_vc_enable(dsidev, 0, 0); in dsi_display_uninit_dsi()
4241 dsi_vc_enable(dsidev, 1, 0); in dsi_display_uninit_dsi()
4242 dsi_vc_enable(dsidev, 2, 0); in dsi_display_uninit_dsi()
4243 dsi_vc_enable(dsidev, 3, 0); in dsi_display_uninit_dsi()
4246 dsi_cio_uninit(dsidev); in dsi_display_uninit_dsi()
4247 dsi_pll_uninit(dsidev, disconnect_lanes); in dsi_display_uninit_dsi()
4252 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_display_enable() local
4253 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_display_enable()
4258 WARN_ON(!dsi_bus_is_locked(dsidev)); in dsi_display_enable()
4262 r = dsi_runtime_get(dsidev); in dsi_display_enable()
4266 _dsi_initialize_irq(dsidev); in dsi_display_enable()
4268 r = dsi_display_init_dsi(dsidev); in dsi_display_enable()
4277 dsi_runtime_put(dsidev); in dsi_display_enable()
4287 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_display_disable() local
4288 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_display_disable()
4292 WARN_ON(!dsi_bus_is_locked(dsidev)); in dsi_display_disable()
4296 dsi_sync_vc(dsidev, 0); in dsi_display_disable()
4297 dsi_sync_vc(dsidev, 1); in dsi_display_disable()
4298 dsi_sync_vc(dsidev, 2); in dsi_display_disable()
4299 dsi_sync_vc(dsidev, 3); in dsi_display_disable()
4301 dsi_display_uninit_dsi(dsidev, disconnect_lanes, enter_ulps); in dsi_display_disable()
4303 dsi_runtime_put(dsidev); in dsi_display_disable()
4310 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_enable_te() local
4311 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_enable_te()
4475 ctx->dsidev = dsi->pdev; in dsi_cm_calc()
4492 struct dsi_data *dsi = dsi_get_dsidrv_data(ctx->dsidev); in dsi_vm_calc_blanking()
4764 ctx->dsidev = dsi->pdev; in dsi_vm_calc()
4794 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_set_config() local
4795 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_set_config()
4892 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_request_vc() local
4893 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_request_vc()
4910 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_set_vc_id() local
4911 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_set_vc_id()
4936 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_release_vc() local
4937 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_release_vc()
4947 static int dsi_get_clocks(struct platform_device *dsidev) in dsi_get_clocks() argument
4949 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_get_clocks()
4952 clk = devm_clk_get(&dsidev->dev, "fck"); in dsi_get_clocks()
4966 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_connect() local
4970 r = dsi_regulator_init(dsidev); in dsi_connect()
5046 static void dsi_init_output(struct platform_device *dsidev) in dsi_init_output() argument
5048 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_init_output()
5051 out->dev = &dsidev->dev; in dsi_init_output()
5064 static void dsi_uninit_output(struct platform_device *dsidev) in dsi_uninit_output() argument
5066 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_uninit_output()
5209 static int dsi_init_pll_data(struct platform_device *dsidev) in dsi_init_pll_data() argument
5211 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_init_pll_data()
5216 clk = devm_clk_get(&dsidev->dev, "sys_clk"); in dsi_init_pll_data()
5261 struct platform_device *dsidev = to_platform_device(dev); in dsi_bind() local
5269 dsi = devm_kzalloc(&dsidev->dev, sizeof(*dsi), GFP_KERNEL); in dsi_bind()
5273 dsi->pdev = dsidev; in dsi_bind()
5274 platform_set_drvdata(dsidev, dsi); in dsi_bind()
5295 res = platform_get_resource_byname(dsidev, IORESOURCE_MEM, "proto"); in dsi_bind()
5297 res = platform_get_resource(dsidev, IORESOURCE_MEM, 0); in dsi_bind()
5310 dsi->proto_base = devm_ioremap(&dsidev->dev, res->start, in dsi_bind()
5317 res = platform_get_resource_byname(dsidev, IORESOURCE_MEM, "phy"); in dsi_bind()
5319 res = platform_get_resource(dsidev, IORESOURCE_MEM, 0); in dsi_bind()
5330 dsi->phy_base = devm_ioremap(&dsidev->dev, res->start, in dsi_bind()
5337 res = platform_get_resource_byname(dsidev, IORESOURCE_MEM, "pll"); in dsi_bind()
5339 res = platform_get_resource(dsidev, IORESOURCE_MEM, 0); in dsi_bind()
5350 dsi->pll_base = devm_ioremap(&dsidev->dev, res->start, in dsi_bind()
5363 r = devm_request_irq(&dsidev->dev, dsi->irq, omap_dsi_irq_handler, in dsi_bind()
5364 IRQF_SHARED, dev_name(&dsidev->dev), dsi->pdev); in dsi_bind()
5370 if (dsidev->dev.of_node) { in dsi_bind()
5374 match = of_match_node(dsi_of_match, dsidev->dev.of_node); in dsi_bind()
5392 dsi->module_id = dsidev->id; in dsi_bind()
5402 r = dsi_get_clocks(dsidev); in dsi_bind()
5406 dsi_init_pll_data(dsidev); in dsi_bind()
5408 pm_runtime_enable(&dsidev->dev); in dsi_bind()
5410 r = dsi_runtime_get(dsidev); in dsi_bind()
5414 rev = dsi_read_reg(dsidev, DSI_REVISION); in dsi_bind()
5415 dev_dbg(&dsidev->dev, "OMAP DSI rev %d.%d\n", in dsi_bind()
5422 dsi->num_lanes_supported = 1 + REG_GET(dsidev, DSI_GNQ, 11, 9); in dsi_bind()
5426 dsi->line_buffer_size = dsi_get_line_buf_size(dsidev); in dsi_bind()
5428 dsi_init_output(dsidev); in dsi_bind()
5430 if (dsidev->dev.of_node) { in dsi_bind()
5431 r = dsi_probe_of(dsidev); in dsi_bind()
5437 r = of_platform_populate(dsidev->dev.of_node, NULL, NULL, in dsi_bind()
5438 &dsidev->dev); in dsi_bind()
5443 dsi_runtime_put(dsidev); in dsi_bind()
5460 dsi_uninit_output(dsidev); in dsi_bind()
5461 dsi_runtime_put(dsidev); in dsi_bind()
5464 pm_runtime_disable(&dsidev->dev); in dsi_bind()
5470 struct platform_device *dsidev = to_platform_device(dev); in dsi_unbind() local
5471 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_unbind()
5473 of_platform_depopulate(&dsidev->dev); in dsi_unbind()
5479 dsi_uninit_output(dsidev); in dsi_unbind()
5481 pm_runtime_disable(&dsidev->dev); in dsi_unbind()