Lines Matching +full:clk +full:- +full:mgr

1 // SPDX-License-Identifier: GPL-2.0-only
13 #include <linux/clk.h>
206 struct omap_overlay_manager *mgr);
208 struct omap_overlay_manager *mgr);
302 struct clk *dss_clk;
407 return to_platform_device(dssdev->dev); in dsi_get_dsidev_from_dssdev()
428 return out ? to_platform_device(out->dev) : NULL; in dsi_get_dsidev_from_id()
438 case DSI_PROTO: base = dsi->proto_base; break; in dsi_write_reg()
439 case DSI_PHY: base = dsi->phy_base; break; in dsi_write_reg()
440 case DSI_PLL: base = dsi->pll_base; break; in dsi_write_reg()
454 case DSI_PROTO: base = dsi->proto_base; break; in dsi_read_reg()
455 case DSI_PHY: base = dsi->phy_base; break; in dsi_read_reg()
456 case DSI_PLL: base = dsi->pll_base; break; in dsi_read_reg()
468 down(&dsi->bus_lock); in dsi_bus_lock()
476 up(&dsi->bus_lock); in dsi_bus_unlock()
483 return dsi->bus_lock.count == 0; in dsi_bus_is_locked()
500 while (t-- > 0) { in wait_for_bit_change()
539 dsi->perf_setup_time = ktime_get(); in dsi_perf_mark_setup()
545 dsi->perf_start_time = ktime_get(); in dsi_perf_mark_start()
560 setup_time = ktime_sub(dsi->perf_start_time, dsi->perf_setup_time); in dsi_perf_show()
565 trans_time = ktime_sub(t, dsi->perf_start_time); in dsi_perf_show()
572 total_bytes = dsi->update_bytes; in dsi_perf_show()
697 spin_lock(&dsi->irq_stats_lock); in dsi_collect_irq_stats()
699 dsi->irq_stats.irq_count++; in dsi_collect_irq_stats()
700 dss_collect_irq_stats(irqstatus, dsi->irq_stats.dsi_irqs); in dsi_collect_irq_stats()
703 dss_collect_irq_stats(vcstatus[i], dsi->irq_stats.vc_irqs[i]); in dsi_collect_irq_stats()
705 dss_collect_irq_stats(ciostatus, dsi->irq_stats.cio_irqs); in dsi_collect_irq_stats()
707 spin_unlock(&dsi->irq_stats_lock); in dsi_collect_irq_stats()
724 spin_lock(&dsi->errors_lock); in dsi_handle_irq_errors()
725 dsi->errors |= irqstatus & DSI_IRQ_ERROR_MASK; in dsi_handle_irq_errors()
726 spin_unlock(&dsi->errors_lock); in dsi_handle_irq_errors()
757 if (isr_data->isr && isr_data->mask & irqstatus) in dsi_call_isrs()
758 isr_data->isr(isr_data->arg, irqstatus); in dsi_call_isrs()
767 dsi_call_isrs(isr_tables->isr_table, in dsi_handle_isrs()
768 ARRAY_SIZE(isr_tables->isr_table), in dsi_handle_isrs()
774 dsi_call_isrs(isr_tables->isr_table_vc[i], in dsi_handle_isrs()
775 ARRAY_SIZE(isr_tables->isr_table_vc[i]), in dsi_handle_isrs()
780 dsi_call_isrs(isr_tables->isr_table_cio, in dsi_handle_isrs()
781 ARRAY_SIZE(isr_tables->isr_table_cio), in dsi_handle_isrs()
795 if (!dsi->is_enabled) in omap_dsi_irq_handler()
798 spin_lock(&dsi->irq_lock); in omap_dsi_irq_handler()
804 spin_unlock(&dsi->irq_lock); in omap_dsi_irq_handler()
837 del_timer(&dsi->te_timer); in omap_dsi_irq_handler()
842 memcpy(&dsi->isr_tables_copy, &dsi->isr_tables, in omap_dsi_irq_handler()
843 sizeof(dsi->isr_tables)); in omap_dsi_irq_handler()
845 spin_unlock(&dsi->irq_lock); in omap_dsi_irq_handler()
847 dsi_handle_isrs(&dsi->isr_tables_copy, irqstatus, vcstatus, ciostatus); in omap_dsi_irq_handler()
856 /* dsi->irq_lock has to be locked by the caller */
873 if (isr_data->isr == NULL) in _omap_dsi_configure_irqs()
876 mask |= isr_data->mask; in _omap_dsi_configure_irqs()
889 /* dsi->irq_lock has to be locked by the caller */
897 _omap_dsi_configure_irqs(dsidev, dsi->isr_tables.isr_table, in _omap_dsi_set_irqs()
898 ARRAY_SIZE(dsi->isr_tables.isr_table), mask, in _omap_dsi_set_irqs()
902 /* dsi->irq_lock has to be locked by the caller */
907 _omap_dsi_configure_irqs(dsidev, dsi->isr_tables.isr_table_vc[vc], in _omap_dsi_set_irqs_vc()
908 ARRAY_SIZE(dsi->isr_tables.isr_table_vc[vc]), in _omap_dsi_set_irqs_vc()
913 /* dsi->irq_lock has to be locked by the caller */
918 _omap_dsi_configure_irqs(dsidev, dsi->isr_tables.isr_table_cio, in _omap_dsi_set_irqs_cio()
919 ARRAY_SIZE(dsi->isr_tables.isr_table_cio), in _omap_dsi_set_irqs_cio()
930 spin_lock_irqsave(&dsi->irq_lock, flags); in _dsi_initialize_irq()
932 memset(&dsi->isr_tables, 0, sizeof(dsi->isr_tables)); in _dsi_initialize_irq()
939 spin_unlock_irqrestore(&dsi->irq_lock, flags); in _dsi_initialize_irq()
952 free_idx = -1; in _dsi_register_isr()
956 if (isr_data->isr == isr && isr_data->arg == arg && in _dsi_register_isr()
957 isr_data->mask == mask) { in _dsi_register_isr()
958 return -EINVAL; in _dsi_register_isr()
961 if (isr_data->isr == NULL && free_idx == -1) in _dsi_register_isr()
965 if (free_idx == -1) in _dsi_register_isr()
966 return -EBUSY; in _dsi_register_isr()
969 isr_data->isr = isr; in _dsi_register_isr()
970 isr_data->arg = arg; in _dsi_register_isr()
971 isr_data->mask = mask; in _dsi_register_isr()
984 if (isr_data->isr != isr || isr_data->arg != arg || in _dsi_unregister_isr()
985 isr_data->mask != mask) in _dsi_unregister_isr()
988 isr_data->isr = NULL; in _dsi_unregister_isr()
989 isr_data->arg = NULL; in _dsi_unregister_isr()
990 isr_data->mask = 0; in _dsi_unregister_isr()
995 return -EINVAL; in _dsi_unregister_isr()
1005 spin_lock_irqsave(&dsi->irq_lock, flags); in dsi_register_isr()
1007 r = _dsi_register_isr(isr, arg, mask, dsi->isr_tables.isr_table, in dsi_register_isr()
1008 ARRAY_SIZE(dsi->isr_tables.isr_table)); in dsi_register_isr()
1013 spin_unlock_irqrestore(&dsi->irq_lock, flags); in dsi_register_isr()
1025 spin_lock_irqsave(&dsi->irq_lock, flags); in dsi_unregister_isr()
1027 r = _dsi_unregister_isr(isr, arg, mask, dsi->isr_tables.isr_table, in dsi_unregister_isr()
1028 ARRAY_SIZE(dsi->isr_tables.isr_table)); in dsi_unregister_isr()
1033 spin_unlock_irqrestore(&dsi->irq_lock, flags); in dsi_unregister_isr()
1045 spin_lock_irqsave(&dsi->irq_lock, flags); in dsi_register_isr_vc()
1048 dsi->isr_tables.isr_table_vc[channel], in dsi_register_isr_vc()
1049 ARRAY_SIZE(dsi->isr_tables.isr_table_vc[channel])); in dsi_register_isr_vc()
1054 spin_unlock_irqrestore(&dsi->irq_lock, flags); in dsi_register_isr_vc()
1066 spin_lock_irqsave(&dsi->irq_lock, flags); in dsi_unregister_isr_vc()
1069 dsi->isr_tables.isr_table_vc[channel], in dsi_unregister_isr_vc()
1070 ARRAY_SIZE(dsi->isr_tables.isr_table_vc[channel])); in dsi_unregister_isr_vc()
1075 spin_unlock_irqrestore(&dsi->irq_lock, flags); in dsi_unregister_isr_vc()
1087 spin_lock_irqsave(&dsi->irq_lock, flags); in dsi_register_isr_cio()
1089 r = _dsi_register_isr(isr, arg, mask, dsi->isr_tables.isr_table_cio, in dsi_register_isr_cio()
1090 ARRAY_SIZE(dsi->isr_tables.isr_table_cio)); in dsi_register_isr_cio()
1095 spin_unlock_irqrestore(&dsi->irq_lock, flags); in dsi_register_isr_cio()
1107 spin_lock_irqsave(&dsi->irq_lock, flags); in dsi_unregister_isr_cio()
1109 r = _dsi_unregister_isr(isr, arg, mask, dsi->isr_tables.isr_table_cio, in dsi_unregister_isr_cio()
1110 ARRAY_SIZE(dsi->isr_tables.isr_table_cio)); in dsi_unregister_isr_cio()
1115 spin_unlock_irqrestore(&dsi->irq_lock, flags); in dsi_unregister_isr_cio()
1125 spin_lock_irqsave(&dsi->errors_lock, flags); in dsi_get_errors()
1126 e = dsi->errors; in dsi_get_errors()
1127 dsi->errors = 0; in dsi_get_errors()
1128 spin_unlock_irqrestore(&dsi->errors_lock, flags); in dsi_get_errors()
1139 r = pm_runtime_resume_and_get(&dsi->pdev->dev); in dsi_runtime_get()
1152 r = pm_runtime_put_sync(&dsi->pdev->dev); in dsi_runtime_put()
1153 WARN_ON(r < 0 && r != -ENOSYS); in dsi_runtime_put()
1161 if (dsi->vdds_dsi_reg != NULL) in dsi_regulator_init()
1164 vdds_dsi = devm_regulator_get(&dsi->pdev->dev, "vdd"); in dsi_regulator_init()
1167 if (PTR_ERR(vdds_dsi) != -EPROBE_DEFER) in dsi_regulator_init()
1172 dsi->vdds_dsi_reg = vdds_dsi; in dsi_regulator_init()
1221 return -EIO; in dsi_if_enable()
1231 return dsi->pll.cinfo.clkout[HSDIV_DISPC]; in dsi_get_pll_hsdiv_dispc_rate()
1238 return dsi->pll.cinfo.clkout[HSDIV_DSI]; in dsi_get_pll_hsdiv_dsi_rate()
1245 return dsi->pll.cinfo.clkdco / 16; in dsi_get_txbyteclkhs()
1253 if (dss_get_dsi_clk_source(dsi->module_id) == OMAP_DSS_CLK_SRC_FCK) { in dsi_fclk_rate()
1255 r = clk_get_rate(dsi->dss_clk); in dsi_fclk_rate()
1275 return -EINVAL; in dsi_lp_clock_calc()
1277 lp_cinfo->lp_clk_div = lp_clk_div; in dsi_lp_clock_calc()
1278 lp_cinfo->lp_clk = lp_clk; in dsi_lp_clock_calc()
1292 lp_clk_div = dsi->user_lp_cinfo.lp_clk_div; in dsi_set_lp_clk_divisor()
1295 return -EINVAL; in dsi_set_lp_clk_divisor()
1302 dsi->current_lp_cinfo.lp_clk = lp_clk; in dsi_set_lp_clk_divisor()
1303 dsi->current_lp_cinfo.lp_clk_div = lp_clk_div; in dsi_set_lp_clk_divisor()
1318 if (dsi->scp_clk_refcount++ == 0) in dsi_enable_scp_clk()
1326 WARN_ON(dsi->scp_clk_refcount == 0); in dsi_disable_scp_clk()
1327 if (--dsi->scp_clk_refcount == 0) in dsi_disable_scp_clk()
1343 /* DSI-PLL power command 0x3 is not working */ in dsi_pll_power()
1356 return -ENODEV; in dsi_pll_power()
1371 cinfo->mX[HSDIV_DSI] = DIV_ROUND_UP(cinfo->clkdco, max_dsi_fck); in dsi_pll_calc_dsi_fck()
1372 cinfo->clkout[HSDIV_DSI] = cinfo->clkdco / cinfo->mX[HSDIV_DSI]; in dsi_pll_calc_dsi_fck()
1378 struct platform_device *dsidev = dsi->pdev; in dsi_pll_enable()
1392 * Note: SCP CLK is not required on OMAP3, but it is required on OMAP4. in dsi_pll_enable()
1396 if (!dsi->vdds_dsi_enabled) { in dsi_pll_enable()
1397 r = regulator_enable(dsi->vdds_dsi_reg); in dsi_pll_enable()
1400 dsi->vdds_dsi_enabled = true; in dsi_pll_enable()
1408 r = -ENODEV; in dsi_pll_enable()
1426 if (dsi->vdds_dsi_enabled) { in dsi_pll_enable()
1427 regulator_disable(dsi->vdds_dsi_reg); in dsi_pll_enable()
1428 dsi->vdds_dsi_enabled = false; in dsi_pll_enable()
1442 WARN_ON(!dsi->vdds_dsi_enabled); in dsi_pll_uninit()
1443 regulator_disable(dsi->vdds_dsi_reg); in dsi_pll_uninit()
1444 dsi->vdds_dsi_enabled = false; in dsi_pll_uninit()
1456 struct platform_device *dsidev = dsi->pdev; in dsi_pll_disable()
1465 struct dss_pll_clock_info *cinfo = &dsi->pll.cinfo; in dsi_dump_dsidev_clocks()
1467 int dsi_module = dsi->module_id; in dsi_dump_dsidev_clocks()
1468 struct dss_pll *pll = &dsi->pll; in dsi_dump_dsidev_clocks()
1476 seq_printf(s, "- DSI%d PLL -\n", dsi_module + 1); in dsi_dump_dsidev_clocks()
1478 seq_printf(s, "dsi pll clkin\t%lu\n", clk_get_rate(pll->clkin)); in dsi_dump_dsidev_clocks()
1480 seq_printf(s, "Fint\t\t%-16lun %u\n", cinfo->fint, cinfo->n); in dsi_dump_dsidev_clocks()
1482 seq_printf(s, "CLKIN4DDR\t%-16lum %u\n", in dsi_dump_dsidev_clocks()
1483 cinfo->clkdco, cinfo->m); in dsi_dump_dsidev_clocks()
1485 seq_printf(s, "DSI_PLL_HSDIV_DISPC (%s)\t%-16lum_dispc %u\t(%s)\n", in dsi_dump_dsidev_clocks()
1489 cinfo->clkout[HSDIV_DISPC], in dsi_dump_dsidev_clocks()
1490 cinfo->mX[HSDIV_DISPC], in dsi_dump_dsidev_clocks()
1494 seq_printf(s, "DSI_PLL_HSDIV_DSI (%s)\t%-16lum_dsi %u\t(%s)\n", in dsi_dump_dsidev_clocks()
1498 cinfo->clkout[HSDIV_DSI], in dsi_dump_dsidev_clocks()
1499 cinfo->mX[HSDIV_DSI], in dsi_dump_dsidev_clocks()
1503 seq_printf(s, "- DSI%d -\n", dsi_module + 1); in dsi_dump_dsidev_clocks()
1512 cinfo->clkdco / 4); in dsi_dump_dsidev_clocks()
1516 seq_printf(s, "LP_CLK\t\t%lu\n", dsi->current_lp_cinfo.lp_clk); in dsi_dump_dsidev_clocks()
1547 spin_lock_irqsave(&dsi->irq_stats_lock, flags); in dsi_dump_dsidev_irqs()
1549 *stats = dsi->irq_stats; in dsi_dump_dsidev_irqs()
1550 memset(&dsi->irq_stats, 0, sizeof(dsi->irq_stats)); in dsi_dump_dsidev_irqs()
1551 dsi->irq_stats.last_reset = jiffies; in dsi_dump_dsidev_irqs()
1553 spin_unlock_irqrestore(&dsi->irq_stats_lock, flags); in dsi_dump_dsidev_irqs()
1556 jiffies_to_msecs(jiffies - stats->last_reset)); in dsi_dump_dsidev_irqs()
1558 seq_printf(s, "irqs %d\n", stats->irq_count); in dsi_dump_dsidev_irqs()
1560 seq_printf(s, "%-20s %10d\n", #x, stats->dsi_irqs[ffs(DSI_IRQ_##x)-1]) in dsi_dump_dsidev_irqs()
1562 seq_printf(s, "-- DSI%d interrupts --\n", dsi->module_id + 1); in dsi_dump_dsidev_irqs()
1583 seq_printf(s, "%-20s %10d %10d %10d %10d\n", #x, \ in dsi_dump_dsidev_irqs()
1584 stats->vc_irqs[0][ffs(DSI_VC_IRQ_##x)-1], \ in dsi_dump_dsidev_irqs()
1585 stats->vc_irqs[1][ffs(DSI_VC_IRQ_##x)-1], \ in dsi_dump_dsidev_irqs()
1586 stats->vc_irqs[2][ffs(DSI_VC_IRQ_##x)-1], \ in dsi_dump_dsidev_irqs()
1587 stats->vc_irqs[3][ffs(DSI_VC_IRQ_##x)-1]); in dsi_dump_dsidev_irqs()
1589 seq_printf(s, "-- VC interrupts --\n"); in dsi_dump_dsidev_irqs()
1602 seq_printf(s, "%-20s %10d\n", #x, \ in dsi_dump_dsidev_irqs()
1603 stats->cio_irqs[ffs(DSI_CIO_IRQ_##x)-1]); in dsi_dump_dsidev_irqs()
1605 seq_printf(s, "-- CIO interrupts --\n"); in dsi_dump_dsidev_irqs()
1649 #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, dsi_read_reg(dsidev, r)) in dsi_dump_dsidev_regs()
1764 return -ENODEV; in dsi_cio_power()
1822 for (i = 0; i < dsi->num_lanes_used; ++i) { in dsi_set_lane_config()
1827 for (t = 0; t < dsi->num_lanes_supported; ++t) in dsi_set_lane_config()
1828 if (dsi->lanes[t].function == functions[i]) in dsi_set_lane_config()
1831 if (t == dsi->num_lanes_supported) in dsi_set_lane_config()
1832 return -EINVAL; in dsi_set_lane_config()
1835 polarity = dsi->lanes[t].polarity; in dsi_set_lane_config()
1842 for (; i < dsi->num_lanes_supported; ++i) { in dsi_set_lane_config()
1859 unsigned long ddr_clk = dsi->pll.cinfo.clkdco / 4; in ns2ddr()
1867 unsigned long ddr_clk = dsi->pll.cinfo.clkdco / 4; in ddr2ns()
1903 /* min tclk-prepare + tclk-zero = 300ns */ in dsi_cio_timings()
1955 u8 lptxscp_start = dsi->num_lanes_supported == 3 ? 22 : 26; in dsi_cio_enable_lane_override()
1959 for (i = 0; i < dsi->num_lanes_supported; ++i) { in dsi_cio_enable_lane_override()
1960 unsigned p = dsi->lanes[i].polarity; in dsi_cio_enable_lane_override()
2012 for (i = 0; i < dsi->num_lanes_supported; ++i) in dsi_cio_wait_tx_clk_esc_reset()
2013 in_use[i] = dsi->lanes[i].function != DSI_LANE_UNUSED; in dsi_cio_wait_tx_clk_esc_reset()
2023 for (i = 0; i < dsi->num_lanes_supported; ++i) { in dsi_cio_wait_tx_clk_esc_reset()
2028 if (ok == dsi->num_lanes_supported) in dsi_cio_wait_tx_clk_esc_reset()
2031 if (--t == 0) { in dsi_cio_wait_tx_clk_esc_reset()
2032 for (i = 0; i < dsi->num_lanes_supported; ++i) { in dsi_cio_wait_tx_clk_esc_reset()
2039 return -EIO; in dsi_cio_wait_tx_clk_esc_reset()
2053 for (i = 0; i < dsi->num_lanes_supported; ++i) { in dsi_get_lane_mask()
2054 if (dsi->lanes[i].function != DSI_LANE_UNUSED) in dsi_get_lane_mask()
2069 r = dss_dsi_enable_pads(dsi->module_id, dsi_get_lane_mask(dsidev)); in dsi_cio_init()
2082 r = -EIO; in dsi_cio_init()
2098 if (dsi->ulps_enabled) { in dsi_cio_init()
2104 /* ULPS is exited by Mark-1 state for 1ms, followed by in dsi_cio_init()
2115 for (i = 0; i < dsi->num_lanes_supported; ++i) { in dsi_cio_init()
2116 if (dsi->lanes[i].function == DSI_LANE_UNUSED) in dsi_cio_init()
2130 r = -ENODEV; in dsi_cio_init()
2142 if (dsi->ulps_enabled) { in dsi_cio_init()
2143 /* Keep Mark-1 state for 1ms (as per DSI spec) */ in dsi_cio_init()
2148 /* Disable the override. The lanes should be set to Mark-11 in dsi_cio_init()
2158 if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) { in dsi_cio_init()
2161 dsi->vm_timings.ddr_clk_always_on, 13, 13); in dsi_cio_init()
2164 dsi->ulps_enabled = false; in dsi_cio_init()
2175 if (dsi->ulps_enabled) in dsi_cio_init()
2179 dss_dsi_disable_pads(dsi->module_id, dsi_get_lane_mask(dsidev)); in dsi_cio_init()
2192 dss_dsi_disable_pads(dsi->module_id, dsi_get_lane_mask(dsidev)); in dsi_cio_uninit()
2204 dsi->vc[0].tx_fifo_size = size1; in dsi_config_tx_fifo()
2205 dsi->vc[1].tx_fifo_size = size2; in dsi_config_tx_fifo()
2206 dsi->vc[2].tx_fifo_size = size3; in dsi_config_tx_fifo()
2207 dsi->vc[3].tx_fifo_size = size4; in dsi_config_tx_fifo()
2211 int size = dsi->vc[i].tx_fifo_size; in dsi_config_tx_fifo()
2237 dsi->vc[0].rx_fifo_size = size1; in dsi_config_rx_fifo()
2238 dsi->vc[1].rx_fifo_size = size2; in dsi_config_rx_fifo()
2239 dsi->vc[2].rx_fifo_size = size3; in dsi_config_rx_fifo()
2240 dsi->vc[3].rx_fifo_size = size4; in dsi_config_rx_fifo()
2244 int size = dsi->vc[i].rx_fifo_size; in dsi_config_rx_fifo()
2271 return -EIO; in dsi_force_tx_stop_mode_io()
2286 struct dsi_data *dsi = dsi_get_dsidrv_data(vp_data->dsidev); in dsi_packet_sent_handler_vp()
2287 const int channel = dsi->update_channel; in dsi_packet_sent_handler_vp()
2288 u8 bit = dsi->te_enabled ? 30 : 31; in dsi_packet_sent_handler_vp()
2290 if (REG_GET(vp_data->dsidev, DSI_VC_TE(channel), bit, bit) == 0) in dsi_packet_sent_handler_vp()
2291 complete(vp_data->completion); in dsi_packet_sent_handler_vp()
2305 bit = dsi->te_enabled ? 30 : 31; in dsi_sync_vc_vp()
2317 r = -EIO; in dsi_sync_vc_vp()
2337 struct dsi_data *dsi = dsi_get_dsidrv_data(l4_data->dsidev); in dsi_packet_sent_handler_l4()
2338 const int channel = dsi->update_channel; in dsi_packet_sent_handler_l4()
2340 if (REG_GET(l4_data->dsidev, DSI_VC_CTRL(channel), 5, 5) == 0) in dsi_packet_sent_handler_l4()
2341 complete(l4_data->completion); in dsi_packet_sent_handler_l4()
2363 r = -EIO; in dsi_sync_vc_l4()
2388 switch (dsi->vc[channel].source) { in dsi_sync_vc()
2395 return -EINVAL; in dsi_sync_vc()
2412 return -EIO; in dsi_vc_enable()
2446 dsi->vc[channel].source = DSI_VC_SOURCE_L4; in dsi_vc_initial_config()
2454 if (dsi->vc[channel].source == source) in dsi_vc_config_source()
2466 return -EIO; in dsi_vc_config_source()
2480 dsi->vc[channel].source = source; in dsi_vc_config_source()
2506 if (dsi->vm_timings.ddr_clk_always_on && enable) in dsi_vc_enable_hs()
2543 DSSERR("\t\tECC Error, single-bit (corrected)\n"); in dsi_show_rx_ack_with_err()
2545 DSSERR("\t\tECC Error, multi-bit (not corrected)\n"); in dsi_show_rx_ack_with_err()
2594 if (dsi->debug_write || dsi->debug_read) in dsi_vc_send_bta()
2637 r = -EIO; in dsi_vc_send_bta_sync()
2644 r = -EIO; in dsi_vc_send_bta_sync()
2666 data_id = data_type | dsi->vc[channel].vc_id << 6; in dsi_vc_write_long_header()
2697 if (dsi->debug_write) in dsi_vc_send_long()
2701 if (dsi->vc[channel].tx_fifo_size * 32 * 4 < len + 4) { in dsi_vc_send_long()
2703 return -EINVAL; in dsi_vc_send_long()
2712 if (dsi->debug_write) in dsi_vc_send_long()
2727 if (dsi->debug_write) in dsi_vc_send_long()
2760 if (dsi->debug_write) in dsi_vc_send_short()
2769 return -EINVAL; in dsi_vc_send_short()
2772 data_id = data_type | dsi->vc[channel].vc_id << 6; in dsi_vc_send_short()
2855 r = -EIO; in dsi_vc_write_common()
2886 if (dsi->debug_read) in dsi_vc_dcs_send_read_request()
2908 if (dsi->debug_read) in dsi_vc_generic_send_read_request()
2923 return -EINVAL; in dsi_vc_generic_send_read_request()
2947 r = -EIO; in dsi_vc_read_rx_fifo()
2952 if (dsi->debug_read) in dsi_vc_read_rx_fifo()
2958 r = -EIO; in dsi_vc_read_rx_fifo()
2965 if (dsi->debug_read) in dsi_vc_read_rx_fifo()
2971 r = -EIO; in dsi_vc_read_rx_fifo()
2982 if (dsi->debug_read) in dsi_vc_read_rx_fifo()
2988 r = -EIO; in dsi_vc_read_rx_fifo()
3001 if (dsi->debug_read) in dsi_vc_read_rx_fifo()
3007 r = -EIO; in dsi_vc_read_rx_fifo()
3016 if (dsi->debug_read) in dsi_vc_read_rx_fifo()
3034 r = -EIO; in dsi_vc_read_rx_fifo()
3065 r = -EIO; in dsi_vc_dcs_read()
3095 r = -EIO; in dsi_vc_generic_read()
3122 WARN_ON(dsi->ulps_enabled); in dsi_enter_ulps()
3124 if (dsi->ulps_enabled) in dsi_enter_ulps()
3148 return -EIO; in dsi_enter_ulps()
3153 return -EIO; in dsi_enter_ulps()
3163 for (i = 0; i < dsi->num_lanes_supported; ++i) { in dsi_enter_ulps()
3164 if (dsi->lanes[i].function == DSI_LANE_UNUSED) in dsi_enter_ulps()
3168 /* Assert TxRequestEsc for data lanes and TxUlpsClk for clk lane */ in dsi_enter_ulps()
3178 r = -EIO; in dsi_enter_ulps()
3195 dsi->ulps_enabled = true; in dsi_enter_ulps()
3318 if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) { in dsi_config_vp_num_line_buffers()
3319 int bpp = dsi_get_pixel_size(dsi->pix_fmt); in dsi_config_vp_num_line_buffers()
3320 struct omap_video_timings *timings = &dsi->timings; in dsi_config_vp_num_line_buffers()
3325 if (dsi->line_buffer_size <= timings->x_res * bpp / 8) in dsi_config_vp_num_line_buffers()
3344 if (dsi->vm_timings.trans_mode == OMAP_DSS_DSI_PULSE_MODE) in dsi_config_vp_sync_events()
3363 int blanking_mode = dsi->vm_timings.blanking_mode; in dsi_config_blanking_modes()
3364 int hfp_blanking_mode = dsi->vm_timings.hfp_blanking_mode; in dsi_config_blanking_modes()
3365 int hbp_blanking_mode = dsi->vm_timings.hbp_blanking_mode; in dsi_config_blanking_modes()
3366 int hsa_blanking_mode = dsi->vm_timings.hsa_blanking_mode; in dsi_config_blanking_modes()
3410 return blank > transition ? blank - transition : 0; in dsi_compute_interleave_hs()
3433 tlp_avail = thsbyte_clk * (blank - trans_lp); in dsi_compute_interleave_lp()
3437 lp_inter = ((tlp_avail - 8 * thsbyte_clk - 5 * tdsi_fclk) / ttxclkesc - in dsi_compute_interleave_lp()
3452 struct omap_video_timings *timings = &dsi->timings; in dsi_config_cmd_mode_interleaving()
3453 int bpp = dsi_get_pixel_size(dsi->pix_fmt); in dsi_config_cmd_mode_interleaving()
3454 int ndl = dsi->num_lanes_used - 1; in dsi_config_cmd_mode_interleaving()
3455 int dsi_fclk_hsdiv = dsi->user_dsi_cinfo.mX[HSDIV_DSI] + 1; in dsi_config_cmd_mode_interleaving()
3493 width_bytes = DIV_ROUND_UP(timings->x_res * bpp, 8); in dsi_config_cmd_mode_interleaving()
3582 switch (dsi_get_pixel_size(dsi->pix_fmt)) { in dsi_proto_config()
3594 return -EINVAL; in dsi_proto_config()
3616 if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) { in dsi_proto_config()
3640 int ndl = dsi->num_lanes_used - 1; in dsi_proto_timings()
3646 ths_zero = ths_prepare_ths_zero - ths_prepare; in dsi_proto_timings()
3693 if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) { in dsi_proto_timings()
3695 int hsa = dsi->vm_timings.hsa; in dsi_proto_timings()
3696 int hfp = dsi->vm_timings.hfp; in dsi_proto_timings()
3697 int hbp = dsi->vm_timings.hbp; in dsi_proto_timings()
3698 int vsa = dsi->vm_timings.vsa; in dsi_proto_timings()
3699 int vfp = dsi->vm_timings.vfp; in dsi_proto_timings()
3700 int vbp = dsi->vm_timings.vbp; in dsi_proto_timings()
3701 int window_sync = dsi->vm_timings.window_sync; in dsi_proto_timings()
3703 struct omap_video_timings *timings = &dsi->timings; in dsi_proto_timings()
3704 int bpp = dsi_get_pixel_size(dsi->pix_fmt); in dsi_proto_timings()
3707 hsync_end = dsi->vm_timings.trans_mode == OMAP_DSS_DSI_PULSE_MODE; in dsi_proto_timings()
3711 width_bytes = DIV_ROUND_UP(timings->x_res * bpp, 8); in dsi_proto_timings()
3720 vsa, timings->y_res); in dsi_proto_timings()
3736 r = FLD_MOD(r, timings->y_res, 14, 0); /* VACT */ in dsi_proto_timings()
3761 num_pins = pin_cfg->num_pins; in dsi_configure_pins()
3762 pins = pin_cfg->pins; in dsi_configure_pins()
3764 if (num_pins < 4 || num_pins > dsi->num_lanes_supported * 2 in dsi_configure_pins()
3766 return -EINVAL; in dsi_configure_pins()
3780 if (dx < 0 || dx >= dsi->num_lanes_supported * 2) in dsi_configure_pins()
3781 return -EINVAL; in dsi_configure_pins()
3783 if (dy < 0 || dy >= dsi->num_lanes_supported * 2) in dsi_configure_pins()
3784 return -EINVAL; in dsi_configure_pins()
3787 if (dy != dx - 1) in dsi_configure_pins()
3788 return -EINVAL; in dsi_configure_pins()
3792 return -EINVAL; in dsi_configure_pins()
3803 memcpy(dsi->lanes, lanes, sizeof(dsi->lanes)); in dsi_configure_pins()
3804 dsi->num_lanes_used = num_lanes; in dsi_configure_pins()
3813 struct omap_overlay_manager *mgr = dsi->output.manager; in dsi_enable_video_output() local
3814 int bpp = dsi_get_pixel_size(dsi->pix_fmt); in dsi_enable_video_output()
3815 struct omap_dss_device *out = &dsi->output; in dsi_enable_video_output()
3820 if (out->manager == NULL) { in dsi_enable_video_output()
3822 return -ENODEV; in dsi_enable_video_output()
3825 r = dsi_display_init_dispc(dsidev, mgr); in dsi_enable_video_output()
3829 if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) { in dsi_enable_video_output()
3830 switch (dsi->pix_fmt) { in dsi_enable_video_output()
3844 r = -EINVAL; in dsi_enable_video_output()
3854 word_count = DIV_ROUND_UP(dsi->timings.x_res * bpp, 8); in dsi_enable_video_output()
3863 r = dss_mgr_enable(mgr); in dsi_enable_video_output()
3870 if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) { in dsi_enable_video_output()
3875 dsi_display_uninit_dispc(dsidev, mgr); in dsi_enable_video_output()
3884 struct omap_overlay_manager *mgr = dsi->output.manager; in dsi_disable_video_output() local
3886 if (dsi->mode == OMAP_DSS_DSI_VIDEO_MODE) { in dsi_disable_video_output()
3897 dss_mgr_disable(mgr); in dsi_disable_video_output()
3899 dsi_display_uninit_dispc(dsidev, mgr); in dsi_disable_video_output()
3905 struct omap_overlay_manager *mgr = dsi->output.manager; in dsi_update_screen_dispc() local
3914 const unsigned channel = dsi->update_channel; in dsi_update_screen_dispc()
3915 const unsigned line_buf_size = dsi->line_buffer_size; in dsi_update_screen_dispc()
3916 u16 w = dsi->timings.x_res; in dsi_update_screen_dispc()
3917 u16 h = dsi->timings.y_res; in dsi_update_screen_dispc()
3923 bytespp = dsi_get_pixel_size(dsi->pix_fmt) / 8; in dsi_update_screen_dispc()
3947 if (dsi->te_enabled) in dsi_update_screen_dispc()
3953 /* We put SIDLEMODE to no-idle for the duration of the transfer, in dsi_update_screen_dispc()
3963 r = schedule_delayed_work(&dsi->framedone_timeout_work, in dsi_update_screen_dispc()
3967 dss_mgr_set_timings(mgr, &dsi->timings); in dsi_update_screen_dispc()
3969 dss_mgr_start_update(mgr); in dsi_update_screen_dispc()
3971 if (dsi->te_enabled) { in dsi_update_screen_dispc()
3979 mod_timer(&dsi->te_timer, jiffies + msecs_to_jiffies(250)); in dsi_update_screen_dispc()
3995 /* SIDLEMODE back to smart-idle */ in dsi_handle_framedone()
3998 if (dsi->te_enabled) { in dsi_handle_framedone()
4003 dsi->framedone_callback(error, dsi->framedone_data); in dsi_handle_framedone()
4022 dsi_handle_framedone(dsi->pdev, -ETIMEDOUT); in dsi_framedone_timeout_work_callback()
4035 cancel_delayed_work(&dsi->framedone_timeout_work); in dsi_framedone_irq_callback()
4048 dsi->update_channel = channel; in dsi_update()
4050 dsi->framedone_callback = callback; in dsi_update()
4051 dsi->framedone_data = data; in dsi_update()
4054 dsi->update_bytes = dsi->timings.x_res * dsi->timings.y_res * in dsi_update()
4055 dsi_get_pixel_size(dsi->pix_fmt) / 8; in dsi_update()
4073 dispc_cinfo.lck_div = dsi->user_dispc_cinfo.lck_div; in dsi_configure_dispc_clocks()
4074 dispc_cinfo.pck_div = dsi->user_dispc_cinfo.pck_div; in dsi_configure_dispc_clocks()
4082 dsi->mgr_config.clock_info = dispc_cinfo; in dsi_configure_dispc_clocks()
4088 struct omap_overlay_manager *mgr) in dsi_display_init_dispc() argument
4093 dss_select_lcd_clk_source(mgr->id, dsi->module_id == 0 ? in dsi_display_init_dispc()
4097 if (dsi->mode == OMAP_DSS_DSI_CMD_MODE) { in dsi_display_init_dispc()
4098 r = dss_mgr_register_framedone_handler(mgr, in dsi_display_init_dispc()
4105 dsi->mgr_config.stallmode = true; in dsi_display_init_dispc()
4106 dsi->mgr_config.fifohandcheck = true; in dsi_display_init_dispc()
4108 dsi->mgr_config.stallmode = false; in dsi_display_init_dispc()
4109 dsi->mgr_config.fifohandcheck = false; in dsi_display_init_dispc()
4116 dsi->timings.interlace = false; in dsi_display_init_dispc()
4117 dsi->timings.hsync_level = OMAPDSS_SIG_ACTIVE_HIGH; in dsi_display_init_dispc()
4118 dsi->timings.vsync_level = OMAPDSS_SIG_ACTIVE_HIGH; in dsi_display_init_dispc()
4119 dsi->timings.data_pclk_edge = OMAPDSS_DRIVE_SIG_RISING_EDGE; in dsi_display_init_dispc()
4120 dsi->timings.de_level = OMAPDSS_SIG_ACTIVE_HIGH; in dsi_display_init_dispc()
4121 dsi->timings.sync_pclk_edge = OMAPDSS_DRIVE_SIG_FALLING_EDGE; in dsi_display_init_dispc()
4123 dss_mgr_set_timings(mgr, &dsi->timings); in dsi_display_init_dispc()
4129 dsi->mgr_config.io_pad_mode = DSS_IO_PAD_MODE_BYPASS; in dsi_display_init_dispc()
4130 dsi->mgr_config.video_port_width = in dsi_display_init_dispc()
4131 dsi_get_pixel_size(dsi->pix_fmt); in dsi_display_init_dispc()
4132 dsi->mgr_config.lcden_sig_polarity = 0; in dsi_display_init_dispc()
4134 dss_mgr_set_lcd_config(mgr, &dsi->mgr_config); in dsi_display_init_dispc()
4138 if (dsi->mode == OMAP_DSS_DSI_CMD_MODE) in dsi_display_init_dispc()
4139 dss_mgr_unregister_framedone_handler(mgr, in dsi_display_init_dispc()
4142 dss_select_lcd_clk_source(mgr->id, OMAP_DSS_CLK_SRC_FCK); in dsi_display_init_dispc()
4147 struct omap_overlay_manager *mgr) in dsi_display_uninit_dispc() argument
4151 if (dsi->mode == OMAP_DSS_DSI_CMD_MODE) in dsi_display_uninit_dispc()
4152 dss_mgr_unregister_framedone_handler(mgr, in dsi_display_uninit_dispc()
4155 dss_select_lcd_clk_source(mgr->id, OMAP_DSS_CLK_SRC_FCK); in dsi_display_uninit_dispc()
4164 cinfo = dsi->user_dsi_cinfo; in dsi_configure_dsi_clocks()
4166 r = dss_pll_set_config(&dsi->pll, &cinfo); in dsi_configure_dsi_clocks()
4180 r = dss_pll_enable(&dsi->pll); in dsi_display_init_dsi()
4188 dss_select_dsi_clk_source(dsi->module_id, dsi->module_id == 0 ? in dsi_display_init_dsi()
4222 dss_select_dsi_clk_source(dsi->module_id, OMAP_DSS_CLK_SRC_FCK); in dsi_display_init_dsi()
4224 dss_pll_disable(&dsi->pll); in dsi_display_init_dsi()
4234 if (enter_ulps && !dsi->ulps_enabled) in dsi_display_uninit_dsi()
4244 dss_select_dsi_clk_source(dsi->module_id, OMAP_DSS_CLK_SRC_FCK); in dsi_display_uninit_dsi()
4259 mutex_lock(&dsi->lock); in dsi_display_enable()
4271 mutex_unlock(&dsi->lock); in dsi_display_enable()
4278 mutex_unlock(&dsi->lock); in dsi_display_enable()
4293 mutex_lock(&dsi->lock); in dsi_display_disable()
4304 mutex_unlock(&dsi->lock); in dsi_display_disable()
4312 dsi->te_enabled = enable; in dsi_enable_te()
4320 unsigned long byteclk = t->hsclk / 4; in print_dsi_vm()
4323 wc = DIV_ROUND_UP(t->hact * t->bitspp, 8); in print_dsi_vm()
4324 pps = DIV_ROUND_UP(wc + 6, t->ndl); /* pixel packet size */ in print_dsi_vm()
4325 bl = t->hss + t->hsa + t->hse + t->hbp + t->hfp; in print_dsi_vm()
4334 t->hss, t->hsa, t->hse, t->hbp, pps, t->hfp, in print_dsi_vm()
4336 TO_DSI_T(t->hss), in print_dsi_vm()
4337 TO_DSI_T(t->hsa), in print_dsi_vm()
4338 TO_DSI_T(t->hse), in print_dsi_vm()
4339 TO_DSI_T(t->hbp), in print_dsi_vm()
4341 TO_DSI_T(t->hfp), in print_dsi_vm()
4352 unsigned long pck = t->pixelclock; in print_dispc_vm()
4355 hact = t->x_res; in print_dispc_vm()
4356 bl = t->hsw + t->hbp + t->hfp; in print_dispc_vm()
4365 t->hsw, t->hbp, hact, t->hfp, in print_dispc_vm()
4367 TO_DISPC_T(t->hsw), in print_dispc_vm()
4368 TO_DISPC_T(t->hbp), in print_dispc_vm()
4370 TO_DISPC_T(t->hfp), in print_dispc_vm()
4382 unsigned long byteclk = t->hsclk / 4; in print_dsi_dispc_vm()
4387 dsi_tput = (u64)byteclk * t->ndl * 8; in print_dsi_dispc_vm()
4388 pck = (u32)div64_u64(dsi_tput, t->bitspp); in print_dsi_dispc_vm()
4389 dsi_hact = DIV_ROUND_UP(DIV_ROUND_UP(t->hact * t->bitspp, 8) + 6, t->ndl); in print_dsi_dispc_vm()
4390 dsi_htot = t->hss + t->hsa + t->hse + t->hbp + dsi_hact + t->hfp; in print_dsi_dispc_vm()
4393 vm.hsw = div64_u64((u64)(t->hsa + t->hse) * pck, byteclk); in print_dsi_dispc_vm()
4394 vm.hbp = div64_u64((u64)t->hbp * pck, byteclk); in print_dsi_dispc_vm()
4395 vm.hfp = div64_u64((u64)t->hfp * pck, byteclk); in print_dsi_dispc_vm()
4396 vm.x_res = t->hact; in print_dsi_dispc_vm()
4406 struct omap_video_timings *t = &ctx->dispc_vm; in dsi_cm_calc_dispc_cb()
4408 ctx->dispc_cinfo.lck_div = lckd; in dsi_cm_calc_dispc_cb()
4409 ctx->dispc_cinfo.pck_div = pckd; in dsi_cm_calc_dispc_cb()
4410 ctx->dispc_cinfo.lck = lck; in dsi_cm_calc_dispc_cb()
4411 ctx->dispc_cinfo.pck = pck; in dsi_cm_calc_dispc_cb()
4413 *t = *ctx->config->timings; in dsi_cm_calc_dispc_cb()
4414 t->pixelclock = pck; in dsi_cm_calc_dispc_cb()
4415 t->x_res = ctx->config->timings->x_res; in dsi_cm_calc_dispc_cb()
4416 t->y_res = ctx->config->timings->y_res; in dsi_cm_calc_dispc_cb()
4417 t->hsw = t->hfp = t->hbp = t->vsw = 1; in dsi_cm_calc_dispc_cb()
4418 t->vfp = t->vbp = 0; in dsi_cm_calc_dispc_cb()
4428 ctx->dsi_cinfo.mX[HSDIV_DISPC] = m_dispc; in dsi_cm_calc_hsdiv_cb()
4429 ctx->dsi_cinfo.clkout[HSDIV_DISPC] = dispc; in dsi_cm_calc_hsdiv_cb()
4431 return dispc_div_calc(dispc, ctx->req_pck_min, ctx->req_pck_max, in dsi_cm_calc_hsdiv_cb()
4440 ctx->dsi_cinfo.n = n; in dsi_cm_calc_pll_cb()
4441 ctx->dsi_cinfo.m = m; in dsi_cm_calc_pll_cb()
4442 ctx->dsi_cinfo.fint = fint; in dsi_cm_calc_pll_cb()
4443 ctx->dsi_cinfo.clkdco = clkdco; in dsi_cm_calc_pll_cb()
4445 return dss_pll_hsdiv_calc(ctx->pll, clkdco, ctx->req_pck_min, in dsi_cm_calc_pll_cb()
4459 clkin = clk_get_rate(dsi->pll.clkin); in dsi_cm_calc()
4460 bitspp = dsi_get_pixel_size(cfg->pixel_format); in dsi_cm_calc()
4461 ndl = dsi->num_lanes_used - 1; in dsi_cm_calc()
4469 pck = cfg->timings->pixelclock; in dsi_cm_calc()
4474 ctx->dsidev = dsi->pdev; in dsi_cm_calc()
4475 ctx->pll = &dsi->pll; in dsi_cm_calc()
4476 ctx->config = cfg; in dsi_cm_calc()
4477 ctx->req_pck_min = pck; in dsi_cm_calc()
4478 ctx->req_pck_nom = pck; in dsi_cm_calc()
4479 ctx->req_pck_max = pck * 3 / 2; in dsi_cm_calc()
4481 pll_min = max(cfg->hs_clk_min * 4, txbyteclk * 4 * 4); in dsi_cm_calc()
4482 pll_max = cfg->hs_clk_max * 4; in dsi_cm_calc()
4484 return dss_pll_calc(ctx->pll, clkin, in dsi_cm_calc()
4491 struct dsi_data *dsi = dsi_get_dsidrv_data(ctx->dsidev); in dsi_vm_calc_blanking()
4492 const struct omap_dss_dsi_config *cfg = ctx->config; in dsi_vm_calc_blanking()
4493 int bitspp = dsi_get_pixel_size(cfg->pixel_format); in dsi_vm_calc_blanking()
4494 int ndl = dsi->num_lanes_used - 1; in dsi_vm_calc_blanking()
4495 unsigned long hsclk = ctx->dsi_cinfo.clkdco / 4; in dsi_vm_calc_blanking()
4511 req_vm = cfg->timings; in dsi_vm_calc_blanking()
4512 req_pck_min = ctx->req_pck_min; in dsi_vm_calc_blanking()
4513 req_pck_max = ctx->req_pck_max; in dsi_vm_calc_blanking()
4514 req_pck_nom = ctx->req_pck_nom; in dsi_vm_calc_blanking()
4516 dispc_pck = ctx->dispc_cinfo.pck; in dsi_vm_calc_blanking()
4519 xres = req_vm->x_res; in dsi_vm_calc_blanking()
4521 panel_hbl = req_vm->hfp + req_vm->hbp + req_vm->hsw; in dsi_vm_calc_blanking()
4530 if (dsi->line_buffer_size < xres * bitspp / 8) { in dsi_vm_calc_blanking()
4542 /* When non-burst mode, DSI tput must be below max requirement. */ in dsi_vm_calc_blanking()
4543 if (cfg->trans_mode != OMAP_DSS_DSI_BURST_MODE) { in dsi_vm_calc_blanking()
4550 if (cfg->trans_mode == OMAP_DSS_DSI_PULSE_MODE) { in dsi_vm_calc_blanking()
4551 if (ndl == 3 && req_vm->hsw == 0) in dsi_vm_calc_blanking()
4567 dsi_hbl = dsi_htot - dsi_hact; in dsi_vm_calc_blanking()
4576 dispc_hbl = dispc_htot - xres; in dsi_vm_calc_blanking()
4580 dsi_vm = &ctx->dsi_vm; in dsi_vm_calc_blanking()
4583 dsi_vm->hsclk = hsclk; in dsi_vm_calc_blanking()
4585 dsi_vm->ndl = ndl; in dsi_vm_calc_blanking()
4586 dsi_vm->bitspp = bitspp; in dsi_vm_calc_blanking()
4588 if (cfg->trans_mode != OMAP_DSS_DSI_PULSE_MODE) { in dsi_vm_calc_blanking()
4590 } else if (ndl == 3 && req_vm->hsw == 0) { in dsi_vm_calc_blanking()
4593 hsa = div64_u64((u64)req_vm->hsw * byteclk, req_pck_nom); in dsi_vm_calc_blanking()
4594 hsa = max(hsa - hse, 1); in dsi_vm_calc_blanking()
4597 hbp = div64_u64((u64)req_vm->hbp * byteclk, req_pck_nom); in dsi_vm_calc_blanking()
4600 hfp = dsi_hbl - (hss + hsa + hse + hbp); in dsi_vm_calc_blanking()
4605 t = 1 - hfp; in dsi_vm_calc_blanking()
4606 hbp = max(hbp - t, 1); in dsi_vm_calc_blanking()
4607 hfp = dsi_hbl - (hss + hsa + hse + hbp); in dsi_vm_calc_blanking()
4611 t = 1 - hfp; in dsi_vm_calc_blanking()
4612 hsa = max(hsa - t, 1); in dsi_vm_calc_blanking()
4613 hfp = dsi_hbl - (hss + hsa + hse + hbp); in dsi_vm_calc_blanking()
4620 dsi_vm->hss = hss; in dsi_vm_calc_blanking()
4621 dsi_vm->hsa = hsa; in dsi_vm_calc_blanking()
4622 dsi_vm->hse = hse; in dsi_vm_calc_blanking()
4623 dsi_vm->hbp = hbp; in dsi_vm_calc_blanking()
4624 dsi_vm->hact = xres; in dsi_vm_calc_blanking()
4625 dsi_vm->hfp = hfp; in dsi_vm_calc_blanking()
4627 dsi_vm->vsa = req_vm->vsw; in dsi_vm_calc_blanking()
4628 dsi_vm->vbp = req_vm->vbp; in dsi_vm_calc_blanking()
4629 dsi_vm->vact = req_vm->y_res; in dsi_vm_calc_blanking()
4630 dsi_vm->vfp = req_vm->vfp; in dsi_vm_calc_blanking()
4632 dsi_vm->trans_mode = cfg->trans_mode; in dsi_vm_calc_blanking()
4634 dsi_vm->blanking_mode = 0; in dsi_vm_calc_blanking()
4635 dsi_vm->hsa_blanking_mode = 1; in dsi_vm_calc_blanking()
4636 dsi_vm->hfp_blanking_mode = 1; in dsi_vm_calc_blanking()
4637 dsi_vm->hbp_blanking_mode = 1; in dsi_vm_calc_blanking()
4639 dsi_vm->ddr_clk_always_on = cfg->ddr_clk_always_on; in dsi_vm_calc_blanking()
4640 dsi_vm->window_sync = 4; in dsi_vm_calc_blanking()
4644 dispc_vm = &ctx->dispc_vm; in dsi_vm_calc_blanking()
4646 dispc_vm->pixelclock = dispc_pck; in dsi_vm_calc_blanking()
4648 if (cfg->trans_mode == OMAP_DSS_DSI_PULSE_MODE) { in dsi_vm_calc_blanking()
4649 hsa = div64_u64((u64)req_vm->hsw * dispc_pck, in dsi_vm_calc_blanking()
4656 hbp = div64_u64((u64)req_vm->hbp * dispc_pck, req_pck_nom); in dsi_vm_calc_blanking()
4659 hfp = dispc_hbl - hsa - hbp; in dsi_vm_calc_blanking()
4664 t = 1 - hfp; in dsi_vm_calc_blanking()
4665 hbp = max(hbp - t, 1); in dsi_vm_calc_blanking()
4666 hfp = dispc_hbl - hsa - hbp; in dsi_vm_calc_blanking()
4670 t = 1 - hfp; in dsi_vm_calc_blanking()
4671 hsa = max(hsa - t, 1); in dsi_vm_calc_blanking()
4672 hfp = dispc_hbl - hsa - hbp; in dsi_vm_calc_blanking()
4679 dispc_vm->hfp = hfp; in dsi_vm_calc_blanking()
4680 dispc_vm->hsw = hsa; in dsi_vm_calc_blanking()
4681 dispc_vm->hbp = hbp; in dsi_vm_calc_blanking()
4692 ctx->dispc_cinfo.lck_div = lckd; in dsi_vm_calc_dispc_cb()
4693 ctx->dispc_cinfo.pck_div = pckd; in dsi_vm_calc_dispc_cb()
4694 ctx->dispc_cinfo.lck = lck; in dsi_vm_calc_dispc_cb()
4695 ctx->dispc_cinfo.pck = pck; in dsi_vm_calc_dispc_cb()
4701 print_dispc_vm("dispc", &ctx->dispc_vm); in dsi_vm_calc_dispc_cb()
4702 print_dsi_vm("dsi ", &ctx->dsi_vm); in dsi_vm_calc_dispc_cb()
4703 print_dispc_vm("req ", ctx->config->timings); in dsi_vm_calc_dispc_cb()
4704 print_dsi_dispc_vm("act ", &ctx->dsi_vm); in dsi_vm_calc_dispc_cb()
4716 ctx->dsi_cinfo.mX[HSDIV_DISPC] = m_dispc; in dsi_vm_calc_hsdiv_cb()
4717 ctx->dsi_cinfo.clkout[HSDIV_DISPC] = dispc; in dsi_vm_calc_hsdiv_cb()
4724 if (ctx->config->trans_mode == OMAP_DSS_DSI_BURST_MODE) in dsi_vm_calc_hsdiv_cb()
4725 pck_max = ctx->req_pck_max + 10000000; in dsi_vm_calc_hsdiv_cb()
4727 pck_max = ctx->req_pck_max; in dsi_vm_calc_hsdiv_cb()
4729 return dispc_div_calc(dispc, ctx->req_pck_min, pck_max, in dsi_vm_calc_hsdiv_cb()
4738 ctx->dsi_cinfo.n = n; in dsi_vm_calc_pll_cb()
4739 ctx->dsi_cinfo.m = m; in dsi_vm_calc_pll_cb()
4740 ctx->dsi_cinfo.fint = fint; in dsi_vm_calc_pll_cb()
4741 ctx->dsi_cinfo.clkdco = clkdco; in dsi_vm_calc_pll_cb()
4743 return dss_pll_hsdiv_calc(ctx->pll, clkdco, ctx->req_pck_min, in dsi_vm_calc_pll_cb()
4752 const struct omap_video_timings *t = cfg->timings; in dsi_vm_calc()
4756 int ndl = dsi->num_lanes_used - 1; in dsi_vm_calc()
4757 int bitspp = dsi_get_pixel_size(cfg->pixel_format); in dsi_vm_calc()
4760 clkin = clk_get_rate(dsi->pll.clkin); in dsi_vm_calc()
4763 ctx->dsidev = dsi->pdev; in dsi_vm_calc()
4764 ctx->pll = &dsi->pll; in dsi_vm_calc()
4765 ctx->config = cfg; in dsi_vm_calc()
4768 ctx->req_pck_min = t->pixelclock - 1000; in dsi_vm_calc()
4769 ctx->req_pck_nom = t->pixelclock; in dsi_vm_calc()
4770 ctx->req_pck_max = t->pixelclock + 1000; in dsi_vm_calc()
4772 byteclk_min = div64_u64((u64)ctx->req_pck_min * bitspp, ndl * 8); in dsi_vm_calc()
4773 pll_min = max(cfg->hs_clk_min * 4, byteclk_min * 4 * 4); in dsi_vm_calc()
4775 if (cfg->trans_mode == OMAP_DSS_DSI_BURST_MODE) { in dsi_vm_calc()
4776 pll_max = cfg->hs_clk_max * 4; in dsi_vm_calc()
4779 byteclk_max = div64_u64((u64)ctx->req_pck_max * bitspp, in dsi_vm_calc()
4785 return dss_pll_calc(ctx->pll, clkin, in dsi_vm_calc()
4799 mutex_lock(&dsi->lock); in dsi_set_config()
4801 dsi->pix_fmt = config->pixel_format; in dsi_set_config()
4802 dsi->mode = config->mode; in dsi_set_config()
4804 if (config->mode == OMAP_DSS_DSI_VIDEO_MODE) in dsi_set_config()
4811 r = -EINVAL; in dsi_set_config()
4818 config->lp_clk_min, config->lp_clk_max, &dsi->user_lp_cinfo); in dsi_set_config()
4824 dsi->user_dsi_cinfo = ctx.dsi_cinfo; in dsi_set_config()
4825 dsi->user_dispc_cinfo = ctx.dispc_cinfo; in dsi_set_config()
4827 dsi->timings = ctx.dispc_vm; in dsi_set_config()
4828 dsi->vm_timings = ctx.dsi_vm; in dsi_set_config()
4830 mutex_unlock(&dsi->lock); in dsi_set_config()
4834 mutex_unlock(&dsi->lock); in dsi_set_config()
4895 for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) { in dsi_request_vc()
4896 if (!dsi->vc[i].dssdev) { in dsi_request_vc()
4897 dsi->vc[i].dssdev = dssdev; in dsi_request_vc()
4903 DSSERR("cannot get VC for display %s", dssdev->name); in dsi_request_vc()
4904 return -ENOSPC; in dsi_request_vc()
4914 return -EINVAL; in dsi_set_vc_id()
4919 return -EINVAL; in dsi_set_vc_id()
4922 if (dsi->vc[channel].dssdev != dssdev) { in dsi_set_vc_id()
4924 dssdev->name); in dsi_set_vc_id()
4925 return -EINVAL; in dsi_set_vc_id()
4928 dsi->vc[channel].vc_id = vc_id; in dsi_set_vc_id()
4939 dsi->vc[channel].dssdev == dssdev) { in dsi_release_vc()
4940 dsi->vc[channel].dssdev = NULL; in dsi_release_vc()
4941 dsi->vc[channel].vc_id = 0; in dsi_release_vc()
4949 struct clk *clk; in dsi_get_clocks() local
4951 clk = devm_clk_get(&dsidev->dev, "fck"); in dsi_get_clocks()
4952 if (IS_ERR(clk)) { in dsi_get_clocks()
4954 return PTR_ERR(clk); in dsi_get_clocks()
4957 dsi->dss_clk = clk; in dsi_get_clocks()
4966 struct omap_overlay_manager *mgr; in dsi_connect() local
4973 mgr = omap_dss_get_overlay_manager(dssdev->dispc_channel); in dsi_connect()
4974 if (!mgr) in dsi_connect()
4975 return -ENODEV; in dsi_connect()
4977 r = dss_mgr_connect(mgr, dssdev); in dsi_connect()
4984 dssdev->name); in dsi_connect()
4985 dss_mgr_disconnect(mgr, dssdev); in dsi_connect()
4995 WARN_ON(dst != dssdev->dst); in dsi_disconnect()
4997 if (dst != dssdev->dst) in dsi_disconnect()
5002 if (dssdev->manager) in dsi_disconnect()
5003 dss_mgr_disconnect(dssdev->manager, dssdev); in dsi_disconnect()
5048 struct omap_dss_device *out = &dsi->output; in dsi_init_output()
5050 out->dev = &dsidev->dev; in dsi_init_output()
5051 out->id = dsi->module_id == 0 ? in dsi_init_output()
5054 out->output_type = OMAP_DISPLAY_TYPE_DSI; in dsi_init_output()
5055 out->name = dsi->module_id == 0 ? "dsi.0" : "dsi.1"; in dsi_init_output()
5056 out->dispc_channel = dsi_get_channel(dsi->module_id); in dsi_init_output()
5057 out->ops.dsi = &dsi_ops; in dsi_init_output()
5058 out->owner = THIS_MODULE; in dsi_init_output()
5066 struct omap_dss_device *out = &dsi->output; in dsi_uninit_output()
5073 struct device_node *node = pdev->dev.of_node; in dsi_probe_of()
5088 dev_err(&pdev->dev, "failed to find lane data\n"); in dsi_probe_of()
5089 r = -EINVAL; in dsi_probe_of()
5096 num_pins > dsi->num_lanes_supported * 2) { in dsi_probe_of()
5097 dev_err(&pdev->dev, "bad number of lanes\n"); in dsi_probe_of()
5098 r = -EINVAL; in dsi_probe_of()
5104 dev_err(&pdev->dev, "failed to read lane data\n"); in dsi_probe_of()
5112 r = dsi_configure_pins(&dsi->output, &pin_cfg); in dsi_probe_of()
5114 dev_err(&pdev->dev, "failed to configure pins"); in dsi_probe_of()
5134 .n_max = (1 << 7) - 1,
5135 .m_max = (1 << 11) - 1,
5136 .mX_max = (1 << 4) - 1,
5159 .n_max = (1 << 8) - 1,
5160 .m_max = (1 << 12) - 1,
5161 .mX_max = (1 << 5) - 1,
5184 .n_max = (1 << 8) - 1,
5185 .m_max = (1 << 12) - 1,
5186 .mX_max = (1 << 5) - 1,
5211 struct dss_pll *pll = &dsi->pll; in dsi_init_pll_data()
5212 struct clk *clk; in dsi_init_pll_data() local
5215 clk = devm_clk_get(&dsidev->dev, "sys_clk"); in dsi_init_pll_data()
5216 if (IS_ERR(clk)) { in dsi_init_pll_data()
5218 return PTR_ERR(clk); in dsi_init_pll_data()
5221 pll->name = dsi->module_id == 0 ? "dsi0" : "dsi1"; in dsi_init_pll_data()
5222 pll->id = dsi->module_id == 0 ? DSS_PLL_DSI1 : DSS_PLL_DSI2; in dsi_init_pll_data()
5223 pll->clkin = clk; in dsi_init_pll_data()
5224 pll->base = dsi->pll_base; in dsi_init_pll_data()
5231 pll->hw = &dss_omap3_dsi_pll_hw; in dsi_init_pll_data()
5237 pll->hw = &dss_omap4_dsi_pll_hw; in dsi_init_pll_data()
5241 pll->hw = &dss_omap5_dsi_pll_hw; in dsi_init_pll_data()
5245 return -ENODEV; in dsi_init_pll_data()
5248 pll->ops = &dsi_pll_ops; in dsi_init_pll_data()
5268 dsi = devm_kzalloc(&dsidev->dev, sizeof(*dsi), GFP_KERNEL); in dsi_bind()
5270 return -ENOMEM; in dsi_bind()
5272 dsi->pdev = dsidev; in dsi_bind()
5275 spin_lock_init(&dsi->irq_lock); in dsi_bind()
5276 spin_lock_init(&dsi->errors_lock); in dsi_bind()
5277 dsi->errors = 0; in dsi_bind()
5280 spin_lock_init(&dsi->irq_stats_lock); in dsi_bind()
5281 dsi->irq_stats.last_reset = jiffies; in dsi_bind()
5284 mutex_init(&dsi->lock); in dsi_bind()
5285 sema_init(&dsi->bus_lock, 1); in dsi_bind()
5287 INIT_DEFERRABLE_WORK(&dsi->framedone_timeout_work, in dsi_bind()
5291 timer_setup(&dsi->te_timer, dsi_te_timeout, 0); in dsi_bind()
5299 return -EINVAL; in dsi_bind()
5302 temp_res.start = res->start; in dsi_bind()
5303 temp_res.end = temp_res.start + DSI_PROTO_SZ - 1; in dsi_bind()
5309 dsi->proto_base = devm_ioremap(&dsidev->dev, res->start, in dsi_bind()
5311 if (!dsi->proto_base) { in dsi_bind()
5313 return -ENOMEM; in dsi_bind()
5321 return -EINVAL; in dsi_bind()
5324 temp_res.start = res->start + DSI_PHY_OFFSET; in dsi_bind()
5325 temp_res.end = temp_res.start + DSI_PHY_SZ - 1; in dsi_bind()
5329 dsi->phy_base = devm_ioremap(&dsidev->dev, res->start, in dsi_bind()
5331 if (!dsi->phy_base) { in dsi_bind()
5333 return -ENOMEM; in dsi_bind()
5341 return -EINVAL; in dsi_bind()
5344 temp_res.start = res->start + DSI_PLL_OFFSET; in dsi_bind()
5345 temp_res.end = temp_res.start + DSI_PLL_SZ - 1; in dsi_bind()
5349 dsi->pll_base = devm_ioremap(&dsidev->dev, res->start, in dsi_bind()
5351 if (!dsi->pll_base) { in dsi_bind()
5353 return -ENOMEM; in dsi_bind()
5356 dsi->irq = platform_get_irq(dsi->pdev, 0); in dsi_bind()
5357 if (dsi->irq < 0) { in dsi_bind()
5359 return -ENODEV; in dsi_bind()
5362 r = devm_request_irq(&dsidev->dev, dsi->irq, omap_dsi_irq_handler, in dsi_bind()
5363 IRQF_SHARED, dev_name(&dsidev->dev), dsi->pdev); in dsi_bind()
5369 if (dsidev->dev.of_node) { in dsi_bind()
5373 match = of_match_node(dsi_of_match, dsidev->dev.of_node); in dsi_bind()
5376 return -ENODEV; in dsi_bind()
5379 d = match->data; in dsi_bind()
5381 while (d->address != 0 && d->address != dsi_mem->start) in dsi_bind()
5384 if (d->address == 0) { in dsi_bind()
5386 return -ENODEV; in dsi_bind()
5389 dsi->module_id = d->id; in dsi_bind()
5391 dsi->module_id = dsidev->id; in dsi_bind()
5395 for (i = 0; i < ARRAY_SIZE(dsi->vc); i++) { in dsi_bind()
5396 dsi->vc[i].source = DSI_VC_SOURCE_L4; in dsi_bind()
5397 dsi->vc[i].dssdev = NULL; in dsi_bind()
5398 dsi->vc[i].vc_id = 0; in dsi_bind()
5407 pm_runtime_enable(&dsidev->dev); in dsi_bind()
5414 dev_dbg(&dsidev->dev, "OMAP DSI rev %d.%d\n", in dsi_bind()
5421 dsi->num_lanes_supported = 1 + REG_GET(dsidev, DSI_GNQ, 11, 9); in dsi_bind()
5423 dsi->num_lanes_supported = 3; in dsi_bind()
5425 dsi->line_buffer_size = dsi_get_line_buf_size(dsidev); in dsi_bind()
5429 if (dsidev->dev.of_node) { in dsi_bind()
5436 r = of_platform_populate(dsidev->dev.of_node, NULL, NULL, in dsi_bind()
5437 &dsidev->dev); in dsi_bind()
5444 if (dsi->module_id == 0) in dsi_bind()
5446 else if (dsi->module_id == 1) in dsi_bind()
5450 if (dsi->module_id == 0) in dsi_bind()
5452 else if (dsi->module_id == 1) in dsi_bind()
5463 pm_runtime_disable(&dsidev->dev); in dsi_bind()
5472 of_platform_depopulate(&dsidev->dev); in dsi_unbind()
5474 WARN_ON(dsi->scp_clk_refcount > 0); in dsi_unbind()
5476 dss_pll_unregister(&dsi->pll); in dsi_unbind()
5480 pm_runtime_disable(&dsidev->dev); in dsi_unbind()
5482 if (dsi->vdds_dsi_reg != NULL && dsi->vdds_dsi_enabled) { in dsi_unbind()
5483 regulator_disable(dsi->vdds_dsi_reg); in dsi_unbind()
5484 dsi->vdds_dsi_enabled = false; in dsi_unbind()
5495 return component_add(&pdev->dev, &dsi_component_ops); in dsi_probe()
5500 component_del(&pdev->dev, &dsi_component_ops); in dsi_remove()
5508 dsi->is_enabled = false; in dsi_runtime_suspend()
5512 synchronize_irq(dsi->irq); in dsi_runtime_suspend()
5529 dsi->is_enabled = true; in dsi_runtime_resume()
5559 { .compatible = "ti,omap3-dsi", .data = dsi_of_data_omap3, },
5560 { .compatible = "ti,omap4-dsi", .data = dsi_of_data_omap4, },
5561 { .compatible = "ti,omap5-dsi", .data = dsi_of_data_omap5, },