Lines Matching refs:dsidev

121 #define REG_GET(dsidev, idx, start, end) \  argument
122 FLD_GET(dsi_read_reg(dsidev, idx), start, end)
124 #define REG_FLD_MOD(dsidev, idx, val, start, end) \ argument
125 dsi_write_reg(dsidev, idx, FLD_MOD(dsi_read_reg(dsidev, idx), val, start, end))
216 static int dsi_display_init_dispc(struct platform_device *dsidev,
218 static void dsi_display_uninit_dispc(struct platform_device *dsidev,
278 struct platform_device *dsidev; member
395 struct platform_device *dsidev; member
411 static inline struct dsi_data *dsi_get_dsidrv_data(struct platform_device *dsidev) in dsi_get_dsidrv_data() argument
413 return dev_get_drvdata(&dsidev->dev); in dsi_get_dsidrv_data()
442 static inline void dsi_write_reg(struct platform_device *dsidev, in dsi_write_reg() argument
445 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_write_reg()
458 static inline u32 dsi_read_reg(struct platform_device *dsidev, in dsi_read_reg() argument
461 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_read_reg()
476 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_bus_lock() local
477 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_bus_lock()
484 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_bus_unlock() local
485 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_bus_unlock()
490 static bool dsi_bus_is_locked(struct platform_device *dsidev) in dsi_bus_is_locked() argument
492 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_bus_is_locked()
502 static inline int wait_for_bit_change(struct platform_device *dsidev, in wait_for_bit_change() argument
512 if (REG_GET(dsidev, idx, bitnum, bitnum) == value) in wait_for_bit_change()
519 if (REG_GET(dsidev, idx, bitnum, bitnum) == value) in wait_for_bit_change()
547 static void dsi_perf_mark_setup(struct platform_device *dsidev) in dsi_perf_mark_setup() argument
549 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_perf_mark_setup()
553 static void dsi_perf_mark_start(struct platform_device *dsidev) in dsi_perf_mark_start() argument
555 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_perf_mark_start()
559 static void dsi_perf_show(struct platform_device *dsidev, const char *name) in dsi_perf_show() argument
561 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_perf_show()
596 static inline void dsi_perf_mark_setup(struct platform_device *dsidev) in dsi_perf_mark_setup() argument
600 static inline void dsi_perf_mark_start(struct platform_device *dsidev) in dsi_perf_mark_start() argument
604 static inline void dsi_perf_show(struct platform_device *dsidev, in dsi_perf_show() argument
702 static void dsi_collect_irq_stats(struct platform_device *dsidev, u32 irqstatus, in dsi_collect_irq_stats() argument
705 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_collect_irq_stats()
721 #define dsi_collect_irq_stats(dsidev, irqstatus, vcstatus, ciostatus) argument
726 static void dsi_handle_irq_errors(struct platform_device *dsidev, u32 irqstatus, in dsi_handle_irq_errors() argument
729 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_handle_irq_errors()
798 struct platform_device *dsidev; in omap_dsi_irq_handler() local
803 dsidev = (struct platform_device *) arg; in omap_dsi_irq_handler()
804 dsi = dsi_get_dsidrv_data(dsidev); in omap_dsi_irq_handler()
811 irqstatus = dsi_read_reg(dsidev, DSI_IRQSTATUS); in omap_dsi_irq_handler()
819 dsi_write_reg(dsidev, DSI_IRQSTATUS, irqstatus & ~DSI_IRQ_CHANNEL_MASK); in omap_dsi_irq_handler()
821 dsi_read_reg(dsidev, DSI_IRQSTATUS); in omap_dsi_irq_handler()
829 vcstatus[i] = dsi_read_reg(dsidev, DSI_VC_IRQSTATUS(i)); in omap_dsi_irq_handler()
831 dsi_write_reg(dsidev, DSI_VC_IRQSTATUS(i), vcstatus[i]); in omap_dsi_irq_handler()
833 dsi_read_reg(dsidev, DSI_VC_IRQSTATUS(i)); in omap_dsi_irq_handler()
837 ciostatus = dsi_read_reg(dsidev, DSI_COMPLEXIO_IRQ_STATUS); in omap_dsi_irq_handler()
839 dsi_write_reg(dsidev, DSI_COMPLEXIO_IRQ_STATUS, ciostatus); in omap_dsi_irq_handler()
841 dsi_read_reg(dsidev, DSI_COMPLEXIO_IRQ_STATUS); in omap_dsi_irq_handler()
860 dsi_handle_irq_errors(dsidev, irqstatus, vcstatus, ciostatus); in omap_dsi_irq_handler()
862 dsi_collect_irq_stats(dsidev, irqstatus, vcstatus, ciostatus); in omap_dsi_irq_handler()
868 static void _omap_dsi_configure_irqs(struct platform_device *dsidev, in _omap_dsi_configure_irqs() argument
890 old_mask = dsi_read_reg(dsidev, enable_reg); in _omap_dsi_configure_irqs()
892 dsi_write_reg(dsidev, status_reg, (mask ^ old_mask) & mask); in _omap_dsi_configure_irqs()
893 dsi_write_reg(dsidev, enable_reg, mask); in _omap_dsi_configure_irqs()
896 dsi_read_reg(dsidev, enable_reg); in _omap_dsi_configure_irqs()
897 dsi_read_reg(dsidev, status_reg); in _omap_dsi_configure_irqs()
901 static void _omap_dsi_set_irqs(struct platform_device *dsidev) in _omap_dsi_set_irqs() argument
903 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in _omap_dsi_set_irqs()
908 _omap_dsi_configure_irqs(dsidev, dsi->isr_tables.isr_table, in _omap_dsi_set_irqs()
914 static void _omap_dsi_set_irqs_vc(struct platform_device *dsidev, int vc) in _omap_dsi_set_irqs_vc() argument
916 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in _omap_dsi_set_irqs_vc()
918 _omap_dsi_configure_irqs(dsidev, dsi->isr_tables.isr_table_vc[vc], in _omap_dsi_set_irqs_vc()
925 static void _omap_dsi_set_irqs_cio(struct platform_device *dsidev) in _omap_dsi_set_irqs_cio() argument
927 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in _omap_dsi_set_irqs_cio()
929 _omap_dsi_configure_irqs(dsidev, dsi->isr_tables.isr_table_cio, in _omap_dsi_set_irqs_cio()
935 static void _dsi_initialize_irq(struct platform_device *dsidev) in _dsi_initialize_irq() argument
937 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in _dsi_initialize_irq()
945 _omap_dsi_set_irqs(dsidev); in _dsi_initialize_irq()
947 _omap_dsi_set_irqs_vc(dsidev, vc); in _dsi_initialize_irq()
948 _omap_dsi_set_irqs_cio(dsidev); in _dsi_initialize_irq()
1009 static int dsi_register_isr(struct platform_device *dsidev, omap_dsi_isr_t isr, in dsi_register_isr() argument
1012 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_register_isr()
1022 _omap_dsi_set_irqs(dsidev); in dsi_register_isr()
1029 static int dsi_unregister_isr(struct platform_device *dsidev, in dsi_unregister_isr() argument
1032 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_unregister_isr()
1042 _omap_dsi_set_irqs(dsidev); in dsi_unregister_isr()
1049 static int dsi_register_isr_vc(struct platform_device *dsidev, int channel, in dsi_register_isr_vc() argument
1052 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_register_isr_vc()
1063 _omap_dsi_set_irqs_vc(dsidev, channel); in dsi_register_isr_vc()
1070 static int dsi_unregister_isr_vc(struct platform_device *dsidev, int channel, in dsi_unregister_isr_vc() argument
1073 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_unregister_isr_vc()
1084 _omap_dsi_set_irqs_vc(dsidev, channel); in dsi_unregister_isr_vc()
1091 static int dsi_register_isr_cio(struct platform_device *dsidev, in dsi_register_isr_cio() argument
1094 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_register_isr_cio()
1104 _omap_dsi_set_irqs_cio(dsidev); in dsi_register_isr_cio()
1111 static int dsi_unregister_isr_cio(struct platform_device *dsidev, in dsi_unregister_isr_cio() argument
1114 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_unregister_isr_cio()
1124 _omap_dsi_set_irqs_cio(dsidev); in dsi_unregister_isr_cio()
1131 static u32 dsi_get_errors(struct platform_device *dsidev) in dsi_get_errors() argument
1133 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_get_errors()
1143 static int dsi_runtime_get(struct platform_device *dsidev) in dsi_runtime_get() argument
1146 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_runtime_get()
1155 static void dsi_runtime_put(struct platform_device *dsidev) in dsi_runtime_put() argument
1157 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_runtime_put()
1166 static int dsi_regulator_init(struct platform_device *dsidev) in dsi_regulator_init() argument
1168 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_regulator_init()
1187 static void _dsi_print_reset_status(struct platform_device *dsidev) in _dsi_print_reset_status() argument
1195 l = dsi_read_reg(dsidev, DSI_DSIPHY_CFG5); in _dsi_print_reset_status()
1208 FLD_GET(dsi_read_reg(dsidev, DSI_##fld), start, end) in _dsi_print_reset_status()
1223 static inline int dsi_if_enable(struct platform_device *dsidev, bool enable) in dsi_if_enable() argument
1228 REG_FLD_MOD(dsidev, DSI_CTRL, enable, 0, 0); /* IF_EN */ in dsi_if_enable()
1230 if (wait_for_bit_change(dsidev, DSI_CTRL, 0, enable) != enable) { in dsi_if_enable()
1238 static unsigned long dsi_get_pll_hsdiv_dispc_rate(struct platform_device *dsidev) in dsi_get_pll_hsdiv_dispc_rate() argument
1240 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_get_pll_hsdiv_dispc_rate()
1245 static unsigned long dsi_get_pll_hsdiv_dsi_rate(struct platform_device *dsidev) in dsi_get_pll_hsdiv_dsi_rate() argument
1247 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_get_pll_hsdiv_dsi_rate()
1252 static unsigned long dsi_get_txbyteclkhs(struct platform_device *dsidev) in dsi_get_txbyteclkhs() argument
1254 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_get_txbyteclkhs()
1259 static unsigned long dsi_fclk_rate(struct platform_device *dsidev) in dsi_fclk_rate() argument
1262 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_fclk_rate()
1269 r = dsi_get_pll_hsdiv_dsi_rate(dsidev); in dsi_fclk_rate()
1294 static int dsi_set_lp_clk_divisor(struct platform_device *dsidev) in dsi_set_lp_clk_divisor() argument
1296 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_set_lp_clk_divisor()
1308 dsi_fclk = dsi_fclk_rate(dsidev); in dsi_set_lp_clk_divisor()
1317 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, lp_clk_div, 12, 0); in dsi_set_lp_clk_divisor()
1320 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, dsi_fclk > 30000000 ? 1 : 0, 21, 21); in dsi_set_lp_clk_divisor()
1325 static void dsi_enable_scp_clk(struct platform_device *dsidev) in dsi_enable_scp_clk() argument
1327 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_enable_scp_clk()
1330 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 1, 14, 14); /* CIO_CLK_ICG */ in dsi_enable_scp_clk()
1333 static void dsi_disable_scp_clk(struct platform_device *dsidev) in dsi_disable_scp_clk() argument
1335 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_disable_scp_clk()
1339 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 0, 14, 14); /* CIO_CLK_ICG */ in dsi_disable_scp_clk()
1349 static int dsi_pll_power(struct platform_device *dsidev, in dsi_pll_power() argument
1360 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, state, 31, 30); in dsi_pll_power()
1363 while (FLD_GET(dsi_read_reg(dsidev, DSI_CLK_CTRL), 29, 28) != state) { in dsi_pll_power()
1389 struct platform_device *dsidev = dsi->pdev; in dsi_pll_enable() local
1394 r = dsi_regulator_init(dsidev); in dsi_pll_enable()
1398 r = dsi_runtime_get(dsidev); in dsi_pll_enable()
1405 dsi_enable_scp_clk(dsidev); in dsi_pll_enable()
1417 if (wait_for_bit_change(dsidev, DSI_PLL_STATUS, 0, 1) != 1) { in dsi_pll_enable()
1428 r = dsi_pll_power(dsidev, DSI_PLL_POWER_ON_ALL); in dsi_pll_enable()
1442 dsi_disable_scp_clk(dsidev); in dsi_pll_enable()
1443 dsi_runtime_put(dsidev); in dsi_pll_enable()
1447 static void dsi_pll_uninit(struct platform_device *dsidev, bool disconnect_lanes) in dsi_pll_uninit() argument
1449 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_pll_uninit()
1451 dsi_pll_power(dsidev, DSI_PLL_POWER_OFF); in dsi_pll_uninit()
1458 dsi_disable_scp_clk(dsidev); in dsi_pll_uninit()
1459 dsi_runtime_put(dsidev); in dsi_pll_uninit()
1467 struct platform_device *dsidev = dsi->pdev; in dsi_pll_disable() local
1469 dsi_pll_uninit(dsidev, true); in dsi_pll_disable()
1472 static void dsi_dump_dsidev_clocks(struct platform_device *dsidev, in dsi_dump_dsidev_clocks() argument
1475 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_dump_dsidev_clocks()
1484 if (dsi_runtime_get(dsidev)) in dsi_dump_dsidev_clocks()
1520 seq_printf(s, "DSI_FCLK\t%lu\n", dsi_fclk_rate(dsidev)); in dsi_dump_dsidev_clocks()
1525 seq_printf(s, "TxByteClkHS\t%lu\n", dsi_get_txbyteclkhs(dsidev)); in dsi_dump_dsidev_clocks()
1529 dsi_runtime_put(dsidev); in dsi_dump_dsidev_clocks()
1534 struct platform_device *dsidev; in dsi_dump_clocks() local
1538 dsidev = dsi_get_dsidev_from_id(i); in dsi_dump_clocks()
1539 if (dsidev) in dsi_dump_clocks()
1540 dsi_dump_dsidev_clocks(dsidev, s); in dsi_dump_clocks()
1545 static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, in dsi_dump_dsidev_irqs() argument
1548 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_dump_dsidev_irqs()
1636 struct platform_device *dsidev = dsi_get_dsidev_from_id(0); in dsi1_dump_irqs() local
1638 dsi_dump_dsidev_irqs(dsidev, s); in dsi1_dump_irqs()
1643 struct platform_device *dsidev = dsi_get_dsidev_from_id(1); in dsi2_dump_irqs() local
1645 dsi_dump_dsidev_irqs(dsidev, s); in dsi2_dump_irqs()
1649 static void dsi_dump_dsidev_regs(struct platform_device *dsidev, in dsi_dump_dsidev_regs() argument
1652 #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dsi_read_reg(dsidev, r)) in dsi_dump_dsidev_regs()
1654 if (dsi_runtime_get(dsidev)) in dsi_dump_dsidev_regs()
1656 dsi_enable_scp_clk(dsidev); in dsi_dump_dsidev_regs()
1728 dsi_disable_scp_clk(dsidev); in dsi_dump_dsidev_regs()
1729 dsi_runtime_put(dsidev); in dsi_dump_dsidev_regs()
1735 struct platform_device *dsidev = dsi_get_dsidev_from_id(0); in dsi1_dump_regs() local
1737 dsi_dump_dsidev_regs(dsidev, s); in dsi1_dump_regs()
1742 struct platform_device *dsidev = dsi_get_dsidev_from_id(1); in dsi2_dump_regs() local
1744 dsi_dump_dsidev_regs(dsidev, s); in dsi2_dump_regs()
1753 static int dsi_cio_power(struct platform_device *dsidev, in dsi_cio_power() argument
1759 REG_FLD_MOD(dsidev, DSI_COMPLEXIO_CFG1, state, 28, 27); in dsi_cio_power()
1762 while (FLD_GET(dsi_read_reg(dsidev, DSI_COMPLEXIO_CFG1), in dsi_cio_power()
1775 static unsigned dsi_get_line_buf_size(struct platform_device *dsidev) in dsi_get_line_buf_size() argument
1786 val = REG_GET(dsidev, DSI_GNQ, 14, 12); /* VP1_LINE_BUFFER_SIZE */ in dsi_get_line_buf_size()
1809 static int dsi_set_lane_config(struct platform_device *dsidev) in dsi_set_lane_config() argument
1811 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_set_lane_config()
1823 r = dsi_read_reg(dsidev, DSI_COMPLEXIO_CFG1); in dsi_set_lane_config()
1852 dsi_write_reg(dsidev, DSI_COMPLEXIO_CFG1, r); in dsi_set_lane_config()
1857 static inline unsigned ns2ddr(struct platform_device *dsidev, unsigned ns) in ns2ddr() argument
1859 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in ns2ddr()
1866 static inline unsigned ddr2ns(struct platform_device *dsidev, unsigned ddr) in ddr2ns() argument
1868 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in ddr2ns()
1874 static void dsi_cio_timings(struct platform_device *dsidev) in dsi_cio_timings() argument
1886 ths_prepare = ns2ddr(dsidev, 70) + 2; in dsi_cio_timings()
1889 ths_prepare_ths_zero = ns2ddr(dsidev, 175) + 2; in dsi_cio_timings()
1892 ths_trail = ns2ddr(dsidev, 60) + 5; in dsi_cio_timings()
1895 ths_exit = ns2ddr(dsidev, 145); in dsi_cio_timings()
1898 tlpx_half = ns2ddr(dsidev, 25); in dsi_cio_timings()
1901 tclk_trail = ns2ddr(dsidev, 60) + 2; in dsi_cio_timings()
1904 tclk_prepare = ns2ddr(dsidev, 65); in dsi_cio_timings()
1907 tclk_zero = ns2ddr(dsidev, 260); in dsi_cio_timings()
1910 ths_prepare, ddr2ns(dsidev, ths_prepare), in dsi_cio_timings()
1911 ths_prepare_ths_zero, ddr2ns(dsidev, ths_prepare_ths_zero)); in dsi_cio_timings()
1913 ths_trail, ddr2ns(dsidev, ths_trail), in dsi_cio_timings()
1914 ths_exit, ddr2ns(dsidev, ths_exit)); in dsi_cio_timings()
1918 tlpx_half, ddr2ns(dsidev, tlpx_half), in dsi_cio_timings()
1919 tclk_trail, ddr2ns(dsidev, tclk_trail), in dsi_cio_timings()
1920 tclk_zero, ddr2ns(dsidev, tclk_zero)); in dsi_cio_timings()
1922 tclk_prepare, ddr2ns(dsidev, tclk_prepare)); in dsi_cio_timings()
1926 r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG0); in dsi_cio_timings()
1931 dsi_write_reg(dsidev, DSI_DSIPHY_CFG0, r); in dsi_cio_timings()
1933 r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG1); in dsi_cio_timings()
1944 dsi_write_reg(dsidev, DSI_DSIPHY_CFG1, r); in dsi_cio_timings()
1946 r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG2); in dsi_cio_timings()
1948 dsi_write_reg(dsidev, DSI_DSIPHY_CFG2, r); in dsi_cio_timings()
1952 static void dsi_cio_enable_lane_override(struct platform_device *dsidev, in dsi_cio_enable_lane_override() argument
1955 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_cio_enable_lane_override()
1984 REG_FLD_MOD(dsidev, DSI_DSIPHY_CFG10, l, lptxscp_start, 17); in dsi_cio_enable_lane_override()
1989 REG_FLD_MOD(dsidev, DSI_DSIPHY_CFG10, 1, 27, 27); in dsi_cio_enable_lane_override()
1992 static void dsi_cio_disable_lane_override(struct platform_device *dsidev) in dsi_cio_disable_lane_override() argument
1995 REG_FLD_MOD(dsidev, DSI_DSIPHY_CFG10, 0, 27, 27); /* ENLPTXSCPDAT */ in dsi_cio_disable_lane_override()
1998 REG_FLD_MOD(dsidev, DSI_DSIPHY_CFG10, 0, 22, 17); in dsi_cio_disable_lane_override()
2001 static int dsi_cio_wait_tx_clk_esc_reset(struct platform_device *dsidev) in dsi_cio_wait_tx_clk_esc_reset() argument
2003 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_cio_wait_tx_clk_esc_reset()
2023 l = dsi_read_reg(dsidev, DSI_DSIPHY_CFG5); in dsi_cio_wait_tx_clk_esc_reset()
2050 static unsigned dsi_get_lane_mask(struct platform_device *dsidev) in dsi_get_lane_mask() argument
2052 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_get_lane_mask()
2064 static int dsi_cio_init(struct platform_device *dsidev) in dsi_cio_init() argument
2066 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_cio_init()
2072 r = dss_dsi_enable_pads(dsi->module_id, dsi_get_lane_mask(dsidev)); in dsi_cio_init()
2076 dsi_enable_scp_clk(dsidev); in dsi_cio_init()
2081 dsi_read_reg(dsidev, DSI_DSIPHY_CFG5); in dsi_cio_init()
2083 if (wait_for_bit_change(dsidev, DSI_DSIPHY_CFG5, 30, 1) != 1) { in dsi_cio_init()
2089 r = dsi_set_lane_config(dsidev); in dsi_cio_init()
2094 l = dsi_read_reg(dsidev, DSI_TIMING1); in dsi_cio_init()
2099 dsi_write_reg(dsidev, DSI_TIMING1, l); in dsi_cio_init()
2124 dsi_cio_enable_lane_override(dsidev, mask_p, 0); in dsi_cio_init()
2127 r = dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_ON); in dsi_cio_init()
2131 if (wait_for_bit_change(dsidev, DSI_COMPLEXIO_CFG1, 29, 1) != 1) { in dsi_cio_init()
2137 dsi_if_enable(dsidev, true); in dsi_cio_init()
2138 dsi_if_enable(dsidev, false); in dsi_cio_init()
2139 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 1, 20, 20); /* LP_CLK_ENABLE */ in dsi_cio_init()
2141 r = dsi_cio_wait_tx_clk_esc_reset(dsidev); in dsi_cio_init()
2153 dsi_cio_disable_lane_override(dsidev); in dsi_cio_init()
2157 REG_FLD_MOD(dsidev, DSI_TIMING1, 0, 15, 15); in dsi_cio_init()
2159 dsi_cio_timings(dsidev); in dsi_cio_init()
2163 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, in dsi_cio_init()
2174 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 0, 20, 20); /* LP_CLK_ENABLE */ in dsi_cio_init()
2176 dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF); in dsi_cio_init()
2179 dsi_cio_disable_lane_override(dsidev); in dsi_cio_init()
2181 dsi_disable_scp_clk(dsidev); in dsi_cio_init()
2182 dss_dsi_disable_pads(dsi->module_id, dsi_get_lane_mask(dsidev)); in dsi_cio_init()
2186 static void dsi_cio_uninit(struct platform_device *dsidev) in dsi_cio_uninit() argument
2188 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_cio_uninit()
2191 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 0, 13, 13); in dsi_cio_uninit()
2193 dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_OFF); in dsi_cio_uninit()
2194 dsi_disable_scp_clk(dsidev); in dsi_cio_uninit()
2195 dss_dsi_disable_pads(dsi->module_id, dsi_get_lane_mask(dsidev)); in dsi_cio_uninit()
2198 static void dsi_config_tx_fifo(struct platform_device *dsidev, in dsi_config_tx_fifo() argument
2202 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_config_tx_fifo()
2228 dsi_write_reg(dsidev, DSI_TX_FIFO_VC_SIZE, r); in dsi_config_tx_fifo()
2231 static void dsi_config_rx_fifo(struct platform_device *dsidev, in dsi_config_rx_fifo() argument
2235 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_config_rx_fifo()
2261 dsi_write_reg(dsidev, DSI_RX_FIFO_VC_SIZE, r); in dsi_config_rx_fifo()
2264 static int dsi_force_tx_stop_mode_io(struct platform_device *dsidev) in dsi_force_tx_stop_mode_io() argument
2268 r = dsi_read_reg(dsidev, DSI_TIMING1); in dsi_force_tx_stop_mode_io()
2270 dsi_write_reg(dsidev, DSI_TIMING1, r); in dsi_force_tx_stop_mode_io()
2272 if (wait_for_bit_change(dsidev, DSI_TIMING1, 15, 0) != 0) { in dsi_force_tx_stop_mode_io()
2280 static bool dsi_vc_is_enabled(struct platform_device *dsidev, int channel) in dsi_vc_is_enabled() argument
2282 return REG_GET(dsidev, DSI_VC_CTRL(channel), 0, 0); in dsi_vc_is_enabled()
2289 struct dsi_data *dsi = dsi_get_dsidrv_data(vp_data->dsidev); in dsi_packet_sent_handler_vp()
2293 if (REG_GET(vp_data->dsidev, DSI_VC_TE(channel), bit, bit) == 0) in dsi_packet_sent_handler_vp()
2297 static int dsi_sync_vc_vp(struct platform_device *dsidev, int channel) in dsi_sync_vc_vp() argument
2299 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_sync_vc_vp()
2302 .dsidev = dsidev, in dsi_sync_vc_vp()
2310 r = dsi_register_isr_vc(dsidev, channel, dsi_packet_sent_handler_vp, in dsi_sync_vc_vp()
2316 if (REG_GET(dsidev, DSI_VC_TE(channel), bit, bit)) { in dsi_sync_vc_vp()
2325 dsi_unregister_isr_vc(dsidev, channel, dsi_packet_sent_handler_vp, in dsi_sync_vc_vp()
2330 dsi_unregister_isr_vc(dsidev, channel, dsi_packet_sent_handler_vp, in dsi_sync_vc_vp()
2340 struct dsi_data *dsi = dsi_get_dsidrv_data(l4_data->dsidev); in dsi_packet_sent_handler_l4()
2343 if (REG_GET(l4_data->dsidev, DSI_VC_CTRL(channel), 5, 5) == 0) in dsi_packet_sent_handler_l4()
2347 static int dsi_sync_vc_l4(struct platform_device *dsidev, int channel) in dsi_sync_vc_l4() argument
2351 .dsidev = dsidev, in dsi_sync_vc_l4()
2356 r = dsi_register_isr_vc(dsidev, channel, dsi_packet_sent_handler_l4, in dsi_sync_vc_l4()
2362 if (REG_GET(dsidev, DSI_VC_CTRL(channel), 5, 5)) { in dsi_sync_vc_l4()
2371 dsi_unregister_isr_vc(dsidev, channel, dsi_packet_sent_handler_l4, in dsi_sync_vc_l4()
2376 dsi_unregister_isr_vc(dsidev, channel, dsi_packet_sent_handler_l4, in dsi_sync_vc_l4()
2382 static int dsi_sync_vc(struct platform_device *dsidev, int channel) in dsi_sync_vc() argument
2384 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_sync_vc()
2386 WARN_ON(!dsi_bus_is_locked(dsidev)); in dsi_sync_vc()
2390 if (!dsi_vc_is_enabled(dsidev, channel)) in dsi_sync_vc()
2395 return dsi_sync_vc_vp(dsidev, channel); in dsi_sync_vc()
2397 return dsi_sync_vc_l4(dsidev, channel); in dsi_sync_vc()
2404 static int dsi_vc_enable(struct platform_device *dsidev, int channel, in dsi_vc_enable() argument
2412 REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), enable, 0, 0); in dsi_vc_enable()
2414 if (wait_for_bit_change(dsidev, DSI_VC_CTRL(channel), in dsi_vc_enable()
2423 static void dsi_vc_initial_config(struct platform_device *dsidev, int channel) in dsi_vc_initial_config() argument
2425 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_initial_config()
2430 r = dsi_read_reg(dsidev, DSI_VC_CTRL(channel)); in dsi_vc_initial_config()
2449 dsi_write_reg(dsidev, DSI_VC_CTRL(channel), r); in dsi_vc_initial_config()
2454 static int dsi_vc_config_source(struct platform_device *dsidev, int channel, in dsi_vc_config_source() argument
2457 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_config_source()
2464 dsi_sync_vc(dsidev, channel); in dsi_vc_config_source()
2466 dsi_vc_enable(dsidev, channel, 0); in dsi_vc_config_source()
2469 if (wait_for_bit_change(dsidev, DSI_VC_CTRL(channel), 15, 0) != 0) { in dsi_vc_config_source()
2475 REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), source, 1, 1); in dsi_vc_config_source()
2480 REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), enable, 30, 30); in dsi_vc_config_source()
2483 dsi_vc_enable(dsidev, channel, 1); in dsi_vc_config_source()
2493 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_enable_hs() local
2494 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_enable_hs()
2498 WARN_ON(!dsi_bus_is_locked(dsidev)); in dsi_vc_enable_hs()
2500 dsi_vc_enable(dsidev, channel, 0); in dsi_vc_enable_hs()
2501 dsi_if_enable(dsidev, 0); in dsi_vc_enable_hs()
2503 REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), enable, 9, 9); in dsi_vc_enable_hs()
2505 dsi_vc_enable(dsidev, channel, 1); in dsi_vc_enable_hs()
2506 dsi_if_enable(dsidev, 1); in dsi_vc_enable_hs()
2508 dsi_force_tx_stop_mode_io(dsidev); in dsi_vc_enable_hs()
2515 static void dsi_vc_flush_long_data(struct platform_device *dsidev, int channel) in dsi_vc_flush_long_data() argument
2517 while (REG_GET(dsidev, DSI_VC_CTRL(channel), 20, 20)) { in dsi_vc_flush_long_data()
2519 val = dsi_read_reg(dsidev, DSI_VC_SHORT_PACKET_HEADER(channel)); in dsi_vc_flush_long_data()
2565 static u16 dsi_vc_flush_receive_data(struct platform_device *dsidev, in dsi_vc_flush_receive_data() argument
2569 while (REG_GET(dsidev, DSI_VC_CTRL(channel), 20, 20)) { in dsi_vc_flush_receive_data()
2572 val = dsi_read_reg(dsidev, DSI_VC_SHORT_PACKET_HEADER(channel)); in dsi_vc_flush_receive_data()
2587 dsi_vc_flush_long_data(dsidev, channel); in dsi_vc_flush_receive_data()
2595 static int dsi_vc_send_bta(struct platform_device *dsidev, int channel) in dsi_vc_send_bta() argument
2597 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_send_bta()
2602 WARN_ON(!dsi_bus_is_locked(dsidev)); in dsi_vc_send_bta()
2605 if (REG_GET(dsidev, DSI_VC_CTRL(channel), 20, 20)) { in dsi_vc_send_bta()
2607 dsi_vc_flush_receive_data(dsidev, channel); in dsi_vc_send_bta()
2610 REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), 1, 6, 6); /* BTA_EN */ in dsi_vc_send_bta()
2613 dsi_read_reg(dsidev, DSI_VC_CTRL(channel)); in dsi_vc_send_bta()
2620 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_send_bta_sync() local
2625 r = dsi_register_isr_vc(dsidev, channel, dsi_completion_handler, in dsi_vc_send_bta_sync()
2630 r = dsi_register_isr(dsidev, dsi_completion_handler, &completion, in dsi_vc_send_bta_sync()
2635 r = dsi_vc_send_bta(dsidev, channel); in dsi_vc_send_bta_sync()
2646 err = dsi_get_errors(dsidev); in dsi_vc_send_bta_sync()
2653 dsi_unregister_isr(dsidev, dsi_completion_handler, &completion, in dsi_vc_send_bta_sync()
2656 dsi_unregister_isr_vc(dsidev, channel, dsi_completion_handler, in dsi_vc_send_bta_sync()
2662 static inline void dsi_vc_write_long_header(struct platform_device *dsidev, in dsi_vc_write_long_header() argument
2665 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_write_long_header()
2669 WARN_ON(!dsi_bus_is_locked(dsidev)); in dsi_vc_write_long_header()
2676 dsi_write_reg(dsidev, DSI_VC_LONG_PACKET_HEADER(channel), val); in dsi_vc_write_long_header()
2679 static inline void dsi_vc_write_long_payload(struct platform_device *dsidev, in dsi_vc_write_long_payload() argument
2689 dsi_write_reg(dsidev, DSI_VC_LONG_PACKET_PAYLOAD(channel), val); in dsi_vc_write_long_payload()
2692 static int dsi_vc_send_long(struct platform_device *dsidev, int channel, in dsi_vc_send_long() argument
2696 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_send_long()
2711 dsi_vc_config_source(dsidev, channel, DSI_VC_SOURCE_L4); in dsi_vc_send_long()
2713 dsi_vc_write_long_header(dsidev, channel, data_type, len, ecc); in dsi_vc_send_long()
2725 dsi_vc_write_long_payload(dsidev, channel, b1, b2, b3, b4); in dsi_vc_send_long()
2750 dsi_vc_write_long_payload(dsidev, channel, b1, b2, b3, 0); in dsi_vc_send_long()
2756 static int dsi_vc_send_short(struct platform_device *dsidev, int channel, in dsi_vc_send_short() argument
2759 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_send_short()
2763 WARN_ON(!dsi_bus_is_locked(dsidev)); in dsi_vc_send_short()
2770 dsi_vc_config_source(dsidev, channel, DSI_VC_SOURCE_L4); in dsi_vc_send_short()
2772 if (FLD_GET(dsi_read_reg(dsidev, DSI_VC_CTRL(channel)), 16, 16)) { in dsi_vc_send_short()
2781 dsi_write_reg(dsidev, DSI_VC_SHORT_PACKET_HEADER(channel), r); in dsi_vc_send_short()
2788 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_send_null() local
2790 return dsi_vc_send_long(dsidev, channel, MIPI_DSI_NULL_PACKET, NULL, in dsi_vc_send_null()
2794 static int dsi_vc_write_nosync_common(struct platform_device *dsidev, in dsi_vc_write_nosync_common() argument
2801 r = dsi_vc_send_short(dsidev, channel, in dsi_vc_write_nosync_common()
2804 r = dsi_vc_send_short(dsidev, channel, in dsi_vc_write_nosync_common()
2809 r = dsi_vc_send_short(dsidev, channel, in dsi_vc_write_nosync_common()
2815 r = dsi_vc_send_long(dsidev, channel, in dsi_vc_write_nosync_common()
2827 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_dcs_write_nosync() local
2829 return dsi_vc_write_nosync_common(dsidev, channel, data, len, in dsi_vc_dcs_write_nosync()
2836 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_generic_write_nosync() local
2838 return dsi_vc_write_nosync_common(dsidev, channel, data, len, in dsi_vc_generic_write_nosync()
2845 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_write_common() local
2848 r = dsi_vc_write_nosync_common(dsidev, channel, data, len, type); in dsi_vc_write_common()
2857 if (REG_GET(dsidev, DSI_VC_CTRL(channel), 20, 20)) { in dsi_vc_write_common()
2859 dsi_vc_flush_receive_data(dsidev, channel); in dsi_vc_write_common()
2885 static int dsi_vc_dcs_send_read_request(struct platform_device *dsidev, in dsi_vc_dcs_send_read_request() argument
2888 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_dcs_send_read_request()
2895 r = dsi_vc_send_short(dsidev, channel, MIPI_DSI_DCS_READ, dcs_cmd, 0); in dsi_vc_dcs_send_read_request()
2905 static int dsi_vc_generic_send_read_request(struct platform_device *dsidev, in dsi_vc_generic_send_read_request() argument
2908 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_generic_send_read_request()
2931 r = dsi_vc_send_short(dsidev, channel, data_type, data, 0); in dsi_vc_generic_send_read_request()
2941 static int dsi_vc_read_rx_fifo(struct platform_device *dsidev, int channel, in dsi_vc_read_rx_fifo() argument
2944 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_vc_read_rx_fifo()
2950 if (REG_GET(dsidev, DSI_VC_CTRL(channel), 20, 20) == 0) { in dsi_vc_read_rx_fifo()
2956 val = dsi_read_reg(dsidev, DSI_VC_SHORT_PACKET_HEADER(channel)); in dsi_vc_read_rx_fifo()
3019 val = dsi_read_reg(dsidev, in dsi_vc_read_rx_fifo()
3053 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_dcs_read() local
3056 r = dsi_vc_dcs_send_read_request(dsidev, channel, dcs_cmd); in dsi_vc_dcs_read()
3064 r = dsi_vc_read_rx_fifo(dsidev, channel, buf, buflen, in dsi_vc_dcs_read()
3083 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_generic_read() local
3086 r = dsi_vc_generic_send_read_request(dsidev, channel, reqdata, reqlen); in dsi_vc_generic_read()
3094 r = dsi_vc_read_rx_fifo(dsidev, channel, buf, buflen, in dsi_vc_generic_read()
3110 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_vc_set_max_rx_packet_size() local
3112 return dsi_vc_send_short(dsidev, channel, in dsi_vc_set_max_rx_packet_size()
3116 static int dsi_enter_ulps(struct platform_device *dsidev) in dsi_enter_ulps() argument
3118 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_enter_ulps()
3125 WARN_ON(!dsi_bus_is_locked(dsidev)); in dsi_enter_ulps()
3133 if (REG_GET(dsidev, DSI_CLK_CTRL, 13, 13)) { in dsi_enter_ulps()
3134 dsi_if_enable(dsidev, 0); in dsi_enter_ulps()
3135 REG_FLD_MOD(dsidev, DSI_CLK_CTRL, 0, 13, 13); in dsi_enter_ulps()
3136 dsi_if_enable(dsidev, 1); in dsi_enter_ulps()
3139 dsi_sync_vc(dsidev, 0); in dsi_enter_ulps()
3140 dsi_sync_vc(dsidev, 1); in dsi_enter_ulps()
3141 dsi_sync_vc(dsidev, 2); in dsi_enter_ulps()
3142 dsi_sync_vc(dsidev, 3); in dsi_enter_ulps()
3144 dsi_force_tx_stop_mode_io(dsidev); in dsi_enter_ulps()
3146 dsi_vc_enable(dsidev, 0, false); in dsi_enter_ulps()
3147 dsi_vc_enable(dsidev, 1, false); in dsi_enter_ulps()
3148 dsi_vc_enable(dsidev, 2, false); in dsi_enter_ulps()
3149 dsi_vc_enable(dsidev, 3, false); in dsi_enter_ulps()
3151 if (REG_GET(dsidev, DSI_COMPLEXIO_CFG2, 16, 16)) { /* HS_BUSY */ in dsi_enter_ulps()
3156 if (REG_GET(dsidev, DSI_COMPLEXIO_CFG2, 17, 17)) { /* LP_BUSY */ in dsi_enter_ulps()
3161 r = dsi_register_isr_cio(dsidev, dsi_completion_handler, &completion, in dsi_enter_ulps()
3175 REG_FLD_MOD(dsidev, DSI_COMPLEXIO_CFG2, mask, 9, 5); in dsi_enter_ulps()
3178 dsi_read_reg(dsidev, DSI_COMPLEXIO_CFG2); in dsi_enter_ulps()
3187 dsi_unregister_isr_cio(dsidev, dsi_completion_handler, &completion, in dsi_enter_ulps()
3191 REG_FLD_MOD(dsidev, DSI_COMPLEXIO_CFG2, 0, 9, 5); in dsi_enter_ulps()
3194 dsi_read_reg(dsidev, DSI_COMPLEXIO_CFG2); in dsi_enter_ulps()
3196 dsi_cio_power(dsidev, DSI_COMPLEXIO_POWER_ULPS); in dsi_enter_ulps()
3198 dsi_if_enable(dsidev, false); in dsi_enter_ulps()
3205 dsi_unregister_isr_cio(dsidev, dsi_completion_handler, &completion, in dsi_enter_ulps()
3210 static void dsi_set_lp_rx_timeout(struct platform_device *dsidev, in dsi_set_lp_rx_timeout() argument
3220 fck = dsi_fclk_rate(dsidev); in dsi_set_lp_rx_timeout()
3222 r = dsi_read_reg(dsidev, DSI_TIMING2); in dsi_set_lp_rx_timeout()
3227 dsi_write_reg(dsidev, DSI_TIMING2, r); in dsi_set_lp_rx_timeout()
3237 static void dsi_set_ta_timeout(struct platform_device *dsidev, unsigned ticks, in dsi_set_ta_timeout() argument
3247 fck = dsi_fclk_rate(dsidev); in dsi_set_ta_timeout()
3249 r = dsi_read_reg(dsidev, DSI_TIMING1); in dsi_set_ta_timeout()
3254 dsi_write_reg(dsidev, DSI_TIMING1, r); in dsi_set_ta_timeout()
3264 static void dsi_set_stop_state_counter(struct platform_device *dsidev, in dsi_set_stop_state_counter() argument
3274 fck = dsi_fclk_rate(dsidev); in dsi_set_stop_state_counter()
3276 r = dsi_read_reg(dsidev, DSI_TIMING1); in dsi_set_stop_state_counter()
3281 dsi_write_reg(dsidev, DSI_TIMING1, r); in dsi_set_stop_state_counter()
3291 static void dsi_set_hs_tx_timeout(struct platform_device *dsidev, in dsi_set_hs_tx_timeout() argument
3301 fck = dsi_get_txbyteclkhs(dsidev); in dsi_set_hs_tx_timeout()
3303 r = dsi_read_reg(dsidev, DSI_TIMING2); in dsi_set_hs_tx_timeout()
3308 dsi_write_reg(dsidev, DSI_TIMING2, r); in dsi_set_hs_tx_timeout()
3318 static void dsi_config_vp_num_line_buffers(struct platform_device *dsidev) in dsi_config_vp_num_line_buffers() argument
3320 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_config_vp_num_line_buffers()
3340 REG_FLD_MOD(dsidev, DSI_CTRL, num_line_buffers, 13, 12); in dsi_config_vp_num_line_buffers()
3343 static void dsi_config_vp_sync_events(struct platform_device *dsidev) in dsi_config_vp_sync_events() argument
3345 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_config_vp_sync_events()
3354 r = dsi_read_reg(dsidev, DSI_CTRL); in dsi_config_vp_sync_events()
3362 dsi_write_reg(dsidev, DSI_CTRL, r); in dsi_config_vp_sync_events()
3365 static void dsi_config_blanking_modes(struct platform_device *dsidev) in dsi_config_blanking_modes() argument
3367 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_config_blanking_modes()
3378 r = dsi_read_reg(dsidev, DSI_CTRL); in dsi_config_blanking_modes()
3383 dsi_write_reg(dsidev, DSI_CTRL, r); in dsi_config_blanking_modes()
3448 static void dsi_config_cmd_mode_interleaving(struct platform_device *dsidev) in dsi_config_cmd_mode_interleaving() argument
3450 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_config_cmd_mode_interleaving()
3467 r = dsi_read_reg(dsidev, DSI_CTRL); in dsi_config_cmd_mode_interleaving()
3473 r = dsi_read_reg(dsidev, DSI_VM_TIMING1); in dsi_config_cmd_mode_interleaving()
3478 r = dsi_read_reg(dsidev, DSI_CLK_TIMING); in dsi_config_cmd_mode_interleaving()
3482 r = dsi_read_reg(dsidev, DSI_VM_TIMING7); in dsi_config_cmd_mode_interleaving()
3486 r = dsi_read_reg(dsidev, DSI_CLK_CTRL); in dsi_config_cmd_mode_interleaving()
3490 r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG0); in dsi_config_cmd_mode_interleaving()
3493 r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG1); in dsi_config_cmd_mode_interleaving()
3547 r = dsi_read_reg(dsidev, DSI_VM_TIMING4); in dsi_config_cmd_mode_interleaving()
3551 dsi_write_reg(dsidev, DSI_VM_TIMING4, r); in dsi_config_cmd_mode_interleaving()
3553 r = dsi_read_reg(dsidev, DSI_VM_TIMING5); in dsi_config_cmd_mode_interleaving()
3557 dsi_write_reg(dsidev, DSI_VM_TIMING5, r); in dsi_config_cmd_mode_interleaving()
3559 r = dsi_read_reg(dsidev, DSI_VM_TIMING6); in dsi_config_cmd_mode_interleaving()
3562 dsi_write_reg(dsidev, DSI_VM_TIMING6, r); in dsi_config_cmd_mode_interleaving()
3565 static int dsi_proto_config(struct platform_device *dsidev) in dsi_proto_config() argument
3567 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_proto_config()
3571 dsi_config_tx_fifo(dsidev, DSI_FIFO_SIZE_32, in dsi_proto_config()
3576 dsi_config_rx_fifo(dsidev, DSI_FIFO_SIZE_32, in dsi_proto_config()
3582 dsi_set_stop_state_counter(dsidev, 0x1000, false, false); in dsi_proto_config()
3583 dsi_set_ta_timeout(dsidev, 0x1fff, true, true); in dsi_proto_config()
3584 dsi_set_lp_rx_timeout(dsidev, 0x1fff, true, true); in dsi_proto_config()
3585 dsi_set_hs_tx_timeout(dsidev, 0x1fff, true, true); in dsi_proto_config()
3602 r = dsi_read_reg(dsidev, DSI_CTRL); in dsi_proto_config()
3617 dsi_write_reg(dsidev, DSI_CTRL, r); in dsi_proto_config()
3619 dsi_config_vp_num_line_buffers(dsidev); in dsi_proto_config()
3622 dsi_config_vp_sync_events(dsidev); in dsi_proto_config()
3623 dsi_config_blanking_modes(dsidev); in dsi_proto_config()
3624 dsi_config_cmd_mode_interleaving(dsidev); in dsi_proto_config()
3627 dsi_vc_initial_config(dsidev, 0); in dsi_proto_config()
3628 dsi_vc_initial_config(dsidev, 1); in dsi_proto_config()
3629 dsi_vc_initial_config(dsidev, 2); in dsi_proto_config()
3630 dsi_vc_initial_config(dsidev, 3); in dsi_proto_config()
3635 static void dsi_proto_timings(struct platform_device *dsidev) in dsi_proto_timings() argument
3637 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_proto_timings()
3648 r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG0); in dsi_proto_timings()
3655 r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG1); in dsi_proto_timings()
3660 r = dsi_read_reg(dsidev, DSI_DSIPHY_CFG2); in dsi_proto_timings()
3666 tclk_post = ns2ddr(dsidev, 60) + 26; in dsi_proto_timings()
3677 r = dsi_read_reg(dsidev, DSI_CLK_TIMING); in dsi_proto_timings()
3680 dsi_write_reg(dsidev, DSI_CLK_TIMING, r); in dsi_proto_timings()
3694 dsi_write_reg(dsidev, DSI_VM_TIMING7, r); in dsi_proto_timings()
3728 r = dsi_read_reg(dsidev, DSI_VM_TIMING1); in dsi_proto_timings()
3732 dsi_write_reg(dsidev, DSI_VM_TIMING1, r); in dsi_proto_timings()
3734 r = dsi_read_reg(dsidev, DSI_VM_TIMING2); in dsi_proto_timings()
3739 dsi_write_reg(dsidev, DSI_VM_TIMING2, r); in dsi_proto_timings()
3741 r = dsi_read_reg(dsidev, DSI_VM_TIMING3); in dsi_proto_timings()
3744 dsi_write_reg(dsidev, DSI_VM_TIMING3, r); in dsi_proto_timings()
3751 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_configure_pins() local
3752 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_configure_pins()
3817 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_enable_video_output() local
3818 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_enable_video_output()
3831 r = dsi_display_init_dispc(dsidev, mgr); in dsi_enable_video_output()
3854 dsi_if_enable(dsidev, false); in dsi_enable_video_output()
3855 dsi_vc_enable(dsidev, channel, false); in dsi_enable_video_output()
3858 REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), 1, 4, 4); in dsi_enable_video_output()
3862 dsi_vc_write_long_header(dsidev, channel, data_type, in dsi_enable_video_output()
3865 dsi_vc_enable(dsidev, channel, true); in dsi_enable_video_output()
3866 dsi_if_enable(dsidev, true); in dsi_enable_video_output()
3877 dsi_if_enable(dsidev, false); in dsi_enable_video_output()
3878 dsi_vc_enable(dsidev, channel, false); in dsi_enable_video_output()
3881 dsi_display_uninit_dispc(dsidev, mgr); in dsi_enable_video_output()
3888 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_disable_video_output() local
3889 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_disable_video_output()
3893 dsi_if_enable(dsidev, false); in dsi_disable_video_output()
3894 dsi_vc_enable(dsidev, channel, false); in dsi_disable_video_output()
3897 REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), 0, 4, 4); in dsi_disable_video_output()
3899 dsi_vc_enable(dsidev, channel, true); in dsi_disable_video_output()
3900 dsi_if_enable(dsidev, true); in dsi_disable_video_output()
3905 dsi_display_uninit_dispc(dsidev, mgr); in dsi_disable_video_output()
3908 static void dsi_update_screen_dispc(struct platform_device *dsidev) in dsi_update_screen_dispc() argument
3910 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_update_screen_dispc()
3927 dsi_vc_config_source(dsidev, channel, DSI_VC_SOURCE_VP); in dsi_update_screen_dispc()
3948 dsi_write_reg(dsidev, DSI_VC_TE(channel), l); in dsi_update_screen_dispc()
3950 dsi_vc_write_long_header(dsidev, channel, MIPI_DSI_DCS_LONG_WRITE, in dsi_update_screen_dispc()
3957 dsi_write_reg(dsidev, DSI_VC_TE(channel), l); in dsi_update_screen_dispc()
3967 dsi_perf_mark_start(dsidev); in dsi_update_screen_dispc()
3980 REG_FLD_MOD(dsidev, DSI_TIMING2, 0, 15, 15); /* LP_RX_TO */ in dsi_update_screen_dispc()
3982 dsi_vc_send_bta(dsidev, channel); in dsi_update_screen_dispc()
3997 static void dsi_handle_framedone(struct platform_device *dsidev, int error) in dsi_handle_framedone() argument
3999 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_handle_framedone()
4006 REG_FLD_MOD(dsidev, DSI_TIMING2, 1, 15, 15); /* LP_RX_TO */ in dsi_handle_framedone()
4012 dsi_perf_show(dsidev, "DISPC"); in dsi_handle_framedone()
4033 struct platform_device *dsidev = (struct platform_device *) data; in dsi_framedone_irq_callback() local
4034 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_framedone_irq_callback()
4043 dsi_handle_framedone(dsidev, 0); in dsi_framedone_irq_callback()
4049 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_update() local
4050 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_update()
4053 dsi_perf_mark_setup(dsidev); in dsi_update()
4067 dsi_update_screen_dispc(dsidev); in dsi_update()
4074 static int dsi_configure_dispc_clocks(struct platform_device *dsidev) in dsi_configure_dispc_clocks() argument
4076 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_configure_dispc_clocks()
4081 fck = dsi_get_pll_hsdiv_dispc_rate(dsidev); in dsi_configure_dispc_clocks()
4097 static int dsi_display_init_dispc(struct platform_device *dsidev, in dsi_display_init_dispc() argument
4100 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_display_init_dispc()
4109 dsi_framedone_irq_callback, dsidev); in dsi_display_init_dispc()
4135 r = dsi_configure_dispc_clocks(dsidev); in dsi_display_init_dispc()
4150 dsi_framedone_irq_callback, dsidev); in dsi_display_init_dispc()
4156 static void dsi_display_uninit_dispc(struct platform_device *dsidev, in dsi_display_uninit_dispc() argument
4159 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_display_uninit_dispc()
4163 dsi_framedone_irq_callback, dsidev); in dsi_display_uninit_dispc()
4168 static int dsi_configure_dsi_clocks(struct platform_device *dsidev) in dsi_configure_dsi_clocks() argument
4170 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_configure_dsi_clocks()
4185 static int dsi_display_init_dsi(struct platform_device *dsidev) in dsi_display_init_dsi() argument
4187 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_display_init_dsi()
4194 r = dsi_configure_dsi_clocks(dsidev); in dsi_display_init_dsi()
4204 r = dsi_cio_init(dsidev); in dsi_display_init_dsi()
4208 _dsi_print_reset_status(dsidev); in dsi_display_init_dsi()
4210 dsi_proto_timings(dsidev); in dsi_display_init_dsi()
4211 dsi_set_lp_clk_divisor(dsidev); in dsi_display_init_dsi()
4214 _dsi_print_reset_status(dsidev); in dsi_display_init_dsi()
4216 r = dsi_proto_config(dsidev); in dsi_display_init_dsi()
4221 dsi_vc_enable(dsidev, 0, 1); in dsi_display_init_dsi()
4222 dsi_vc_enable(dsidev, 1, 1); in dsi_display_init_dsi()
4223 dsi_vc_enable(dsidev, 2, 1); in dsi_display_init_dsi()
4224 dsi_vc_enable(dsidev, 3, 1); in dsi_display_init_dsi()
4225 dsi_if_enable(dsidev, 1); in dsi_display_init_dsi()
4226 dsi_force_tx_stop_mode_io(dsidev); in dsi_display_init_dsi()
4230 dsi_cio_uninit(dsidev); in dsi_display_init_dsi()
4239 static void dsi_display_uninit_dsi(struct platform_device *dsidev, in dsi_display_uninit_dsi() argument
4242 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_display_uninit_dsi()
4245 dsi_enter_ulps(dsidev); in dsi_display_uninit_dsi()
4248 dsi_if_enable(dsidev, 0); in dsi_display_uninit_dsi()
4249 dsi_vc_enable(dsidev, 0, 0); in dsi_display_uninit_dsi()
4250 dsi_vc_enable(dsidev, 1, 0); in dsi_display_uninit_dsi()
4251 dsi_vc_enable(dsidev, 2, 0); in dsi_display_uninit_dsi()
4252 dsi_vc_enable(dsidev, 3, 0); in dsi_display_uninit_dsi()
4255 dsi_cio_uninit(dsidev); in dsi_display_uninit_dsi()
4256 dsi_pll_uninit(dsidev, disconnect_lanes); in dsi_display_uninit_dsi()
4261 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_display_enable() local
4262 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_display_enable()
4267 WARN_ON(!dsi_bus_is_locked(dsidev)); in dsi_display_enable()
4271 r = dsi_runtime_get(dsidev); in dsi_display_enable()
4275 _dsi_initialize_irq(dsidev); in dsi_display_enable()
4277 r = dsi_display_init_dsi(dsidev); in dsi_display_enable()
4286 dsi_runtime_put(dsidev); in dsi_display_enable()
4296 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_display_disable() local
4297 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_display_disable()
4301 WARN_ON(!dsi_bus_is_locked(dsidev)); in dsi_display_disable()
4305 dsi_sync_vc(dsidev, 0); in dsi_display_disable()
4306 dsi_sync_vc(dsidev, 1); in dsi_display_disable()
4307 dsi_sync_vc(dsidev, 2); in dsi_display_disable()
4308 dsi_sync_vc(dsidev, 3); in dsi_display_disable()
4310 dsi_display_uninit_dsi(dsidev, disconnect_lanes, enter_ulps); in dsi_display_disable()
4312 dsi_runtime_put(dsidev); in dsi_display_disable()
4319 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_enable_te() local
4320 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_enable_te()
4484 ctx->dsidev = dsi->pdev; in dsi_cm_calc()
4501 struct dsi_data *dsi = dsi_get_dsidrv_data(ctx->dsidev); in dsi_vm_calc_blanking()
4773 ctx->dsidev = dsi->pdev; in dsi_vm_calc()
4803 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_set_config() local
4804 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_set_config()
4901 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_request_vc() local
4902 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_request_vc()
4919 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_set_vc_id() local
4920 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_set_vc_id()
4945 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_release_vc() local
4946 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_release_vc()
4956 static int dsi_get_clocks(struct platform_device *dsidev) in dsi_get_clocks() argument
4958 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_get_clocks()
4961 clk = devm_clk_get(&dsidev->dev, "fck"); in dsi_get_clocks()
4975 struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev); in dsi_connect() local
4979 r = dsi_regulator_init(dsidev); in dsi_connect()
5055 static void dsi_init_output(struct platform_device *dsidev) in dsi_init_output() argument
5057 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_init_output()
5060 out->dev = &dsidev->dev; in dsi_init_output()
5073 static void dsi_uninit_output(struct platform_device *dsidev) in dsi_uninit_output() argument
5075 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_uninit_output()
5218 static int dsi_init_pll_data(struct platform_device *dsidev) in dsi_init_pll_data() argument
5220 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_init_pll_data()
5225 clk = devm_clk_get(&dsidev->dev, "sys_clk"); in dsi_init_pll_data()
5270 struct platform_device *dsidev = to_platform_device(dev); in dsi_bind() local
5278 dsi = devm_kzalloc(&dsidev->dev, sizeof(*dsi), GFP_KERNEL); in dsi_bind()
5282 dsi->pdev = dsidev; in dsi_bind()
5283 dev_set_drvdata(&dsidev->dev, dsi); in dsi_bind()
5304 res = platform_get_resource_byname(dsidev, IORESOURCE_MEM, "proto"); in dsi_bind()
5306 res = platform_get_resource(dsidev, IORESOURCE_MEM, 0); in dsi_bind()
5319 dsi->proto_base = devm_ioremap(&dsidev->dev, res->start, in dsi_bind()
5326 res = platform_get_resource_byname(dsidev, IORESOURCE_MEM, "phy"); in dsi_bind()
5328 res = platform_get_resource(dsidev, IORESOURCE_MEM, 0); in dsi_bind()
5339 dsi->phy_base = devm_ioremap(&dsidev->dev, res->start, in dsi_bind()
5346 res = platform_get_resource_byname(dsidev, IORESOURCE_MEM, "pll"); in dsi_bind()
5348 res = platform_get_resource(dsidev, IORESOURCE_MEM, 0); in dsi_bind()
5359 dsi->pll_base = devm_ioremap(&dsidev->dev, res->start, in dsi_bind()
5372 r = devm_request_irq(&dsidev->dev, dsi->irq, omap_dsi_irq_handler, in dsi_bind()
5373 IRQF_SHARED, dev_name(&dsidev->dev), dsi->pdev); in dsi_bind()
5379 if (dsidev->dev.of_node) { in dsi_bind()
5383 match = of_match_node(dsi_of_match, dsidev->dev.of_node); in dsi_bind()
5401 dsi->module_id = dsidev->id; in dsi_bind()
5411 r = dsi_get_clocks(dsidev); in dsi_bind()
5415 dsi_init_pll_data(dsidev); in dsi_bind()
5417 pm_runtime_enable(&dsidev->dev); in dsi_bind()
5419 r = dsi_runtime_get(dsidev); in dsi_bind()
5423 rev = dsi_read_reg(dsidev, DSI_REVISION); in dsi_bind()
5424 dev_dbg(&dsidev->dev, "OMAP DSI rev %d.%d\n", in dsi_bind()
5431 dsi->num_lanes_supported = 1 + REG_GET(dsidev, DSI_GNQ, 11, 9); in dsi_bind()
5435 dsi->line_buffer_size = dsi_get_line_buf_size(dsidev); in dsi_bind()
5437 dsi_init_output(dsidev); in dsi_bind()
5439 if (dsidev->dev.of_node) { in dsi_bind()
5440 r = dsi_probe_of(dsidev); in dsi_bind()
5446 r = of_platform_populate(dsidev->dev.of_node, NULL, NULL, in dsi_bind()
5447 &dsidev->dev); in dsi_bind()
5452 dsi_runtime_put(dsidev); in dsi_bind()
5469 dsi_uninit_output(dsidev); in dsi_bind()
5470 dsi_runtime_put(dsidev); in dsi_bind()
5473 pm_runtime_disable(&dsidev->dev); in dsi_bind()
5479 struct platform_device *dsidev = to_platform_device(dev); in dsi_unbind() local
5480 struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); in dsi_unbind()
5482 of_platform_depopulate(&dsidev->dev); in dsi_unbind()
5488 dsi_uninit_output(dsidev); in dsi_unbind()
5490 pm_runtime_disable(&dsidev->dev); in dsi_unbind()