/* RFBI HW IP initialisation */ static int omap_rfbihw_probe(struct platform_device *pdev) { u32 rev; struct resource *rfbi_mem; struct clk *clk; int r; rfbi.pdev = pdev; sema_init(&rfbi.bus_lock, 1); rfbi_mem = platform_get_resource(rfbi.pdev, IORESOURCE_MEM, 0); if (!rfbi_mem) { DSSERR("can't get IORESOURCE_MEM RFBI\n"); r = -EINVAL; goto err_ioremap; } rfbi.base = ioremap(rfbi_mem->start, resource_size(rfbi_mem)); if (!rfbi.base) { DSSERR("can't ioremap RFBI\n"); r = -ENOMEM; goto err_ioremap; } pm_runtime_enable(&pdev->dev); r = rfbi_runtime_get(); if (r) goto err_get_rfbi; msleep(10); clk = clk_get(&pdev->dev, "ick"); if (IS_ERR(clk)) { DSSERR("can't get ick\n"); r = PTR_ERR(clk); goto err_get_ick; } rfbi.l4_khz = clk_get_rate(clk) / 1000; clk_put(clk); rev = rfbi_read_reg(RFBI_REVISION); dev_dbg(&pdev->dev, "OMAP RFBI rev %d.%d\n", FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0)); rfbi_runtime_put(); return 0; err_get_ick: rfbi_runtime_put(); err_get_rfbi: pm_runtime_disable(&pdev->dev); iounmap(rfbi.base); err_ioremap: return r; }
static int rfbi_display_enable(struct omap_dss_device *dssdev) { struct omap_dss_device *out = &rfbi.output; int r; if (!out->dispc_channel_connected) { DSSERR("failed to enable display: no output/manager\n"); return -ENODEV; } r = rfbi_runtime_get(); if (r) return r; r = dss_mgr_register_framedone_handler(out->manager, framedone_callback, NULL); if (r) { DSSERR("can't get FRAMEDONE irq\n"); goto err1; } rfbi_config_lcd_manager(dssdev); rfbi_configure_bus(dssdev->phy.rfbi.channel, rfbi.pixel_size, rfbi.data_lines); rfbi_set_timings(dssdev->phy.rfbi.channel, &rfbi.intf_timings); return 0; err1: rfbi_runtime_put(); return r; }
/* RFBI HW IP initialisation */ static int rfbi_bind(struct device *dev, struct device *master, void *data) { struct platform_device *pdev = to_platform_device(dev); u32 rev; struct resource *rfbi_mem; struct clk *clk; int r; rfbi.pdev = pdev; sema_init(&rfbi.bus_lock, 1); rfbi_mem = platform_get_resource(rfbi.pdev, IORESOURCE_MEM, 0); if (!rfbi_mem) { DSSERR("can't get IORESOURCE_MEM RFBI\n"); return -EINVAL; } rfbi.base = devm_ioremap(&pdev->dev, rfbi_mem->start, resource_size(rfbi_mem)); if (!rfbi.base) { DSSERR("can't ioremap RFBI\n"); return -ENOMEM; } clk = clk_get(&pdev->dev, "ick"); if (IS_ERR(clk)) { DSSERR("can't get ick\n"); return PTR_ERR(clk); } rfbi.l4_khz = clk_get_rate(clk) / 1000; clk_put(clk); pm_runtime_enable(&pdev->dev); r = rfbi_runtime_get(); if (r) goto err_runtime_get; msleep(10); rev = rfbi_read_reg(RFBI_REVISION); dev_dbg(&pdev->dev, "OMAP RFBI rev %d.%d\n", FLD_GET(rev, 7, 4), FLD_GET(rev, 3, 0)); rfbi_runtime_put(); dss_debugfs_create_file("rfbi", rfbi_dump_regs); rfbi_init_output(pdev); return 0; err_runtime_get: pm_runtime_disable(&pdev->dev); return r; }
void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev) { omap_dispc_unregister_isr(framedone_callback, NULL, DISPC_IRQ_FRAMEDONE); omap_dss_stop_device(dssdev); rfbi_runtime_put(); }
static void rfbi_display_disable(struct omap_dss_device *dssdev) { struct omap_dss_device *out = &rfbi.output; dss_mgr_unregister_framedone_handler(out->manager, framedone_callback, NULL); rfbi_runtime_put(); }
int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev) { int r; if (dssdev->manager == NULL) { DSSERR("failed to enable display: no manager\n"); return -ENODEV; } r = rfbi_runtime_get(); if (r) return r; r = omap_dss_start_device(dssdev); if (r) { DSSERR("failed to start device\n"); goto err0; } r = omap_dispc_register_isr(framedone_callback, NULL, DISPC_IRQ_FRAMEDONE); if (r) { DSSERR("can't get FRAMEDONE irq\n"); goto err1; } dispc_mgr_set_lcd_display_type(dssdev->manager->id, OMAP_DSS_LCD_DISPLAY_TFT); dispc_mgr_set_io_pad_mode(DSS_IO_PAD_MODE_RFBI); dispc_mgr_enable_stallmode(dssdev->manager->id, true); dispc_mgr_set_tft_data_lines(dssdev->manager->id, dssdev->ctrl.pixel_size); rfbi_configure(dssdev->phy.rfbi.channel, dssdev->ctrl.pixel_size, dssdev->phy.rfbi.data_lines); rfbi_set_timings(dssdev->phy.rfbi.channel, &dssdev->ctrl.rfbi_timings); return 0; err1: omap_dss_stop_device(dssdev); err0: rfbi_runtime_put(); return r; }
static void rfbi_dump_regs(struct seq_file *s) { #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, rfbi_read_reg(r)) if (rfbi_runtime_get()) return; DUMPREG(RFBI_REVISION); DUMPREG(RFBI_SYSCONFIG); DUMPREG(RFBI_SYSSTATUS); DUMPREG(RFBI_CONTROL); DUMPREG(RFBI_PIXEL_CNT); DUMPREG(RFBI_LINE_NUMBER); DUMPREG(RFBI_CMD); DUMPREG(RFBI_PARAM); DUMPREG(RFBI_DATA); DUMPREG(RFBI_READ); DUMPREG(RFBI_STATUS); DUMPREG(RFBI_CONFIG(0)); DUMPREG(RFBI_ONOFF_TIME(0)); DUMPREG(RFBI_CYCLE_TIME(0)); DUMPREG(RFBI_DATA_CYCLE1(0)); DUMPREG(RFBI_DATA_CYCLE2(0)); DUMPREG(RFBI_DATA_CYCLE3(0)); DUMPREG(RFBI_CONFIG(1)); DUMPREG(RFBI_ONOFF_TIME(1)); DUMPREG(RFBI_CYCLE_TIME(1)); DUMPREG(RFBI_DATA_CYCLE1(1)); DUMPREG(RFBI_DATA_CYCLE2(1)); DUMPREG(RFBI_DATA_CYCLE3(1)); DUMPREG(RFBI_VSYNC_WIDTH); DUMPREG(RFBI_HSYNC_WIDTH); rfbi_runtime_put(); #undef DUMPREG }
int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev) { int r; struct dispc_clock_info dispc_cinfo; struct omap_video_timings timings = { .hsw = 1, .hfp = 1, .hbp = 1, .vsw = 1, .vfp = 0, .vbp = 0, }; r = omap_dss_start_device(dssdev); if (r) { DSSERR("RFBI: failed to start device\n"); return r; } r = rfbi_runtime_get(); if (r) { DSSERR("RFBI: failed to get runtime\n"); goto err0; } r = omap_dispc_register_isr(framedone_callback, NULL, DISPC_IRQ_FRAMEDONE); if (r) { DSSERR("RFBI: can't get FRAMEDONE irq\n"); goto err1; } dispc_set_parallel_interface_mode(dssdev->manager->id, OMAP_DSS_PARALLELMODE_RFBI); dispc_enable_fifohandcheck(dssdev->manager->id, 1); dispc_set_lcd_display_type(dssdev->manager->id, OMAP_DSS_LCD_DISPLAY_TFT); dispc_set_tft_data_lines(dssdev->manager->id, dssdev->ctrl.pixel_size); dispc_set_lcd_timings(dssdev->manager->id, &timings); r = dispc_set_clock_div(dssdev->manager->id, &dispc_cinfo); if (r) { DSSERR("RFBI: Failed to set dispc clocks\n"); goto err1; } rfbi_configure(dssdev->phy.rfbi.channel, dssdev->ctrl.pixel_size, dssdev->phy.rfbi.data_lines); rfbi_set_timings(dssdev->phy.rfbi.channel, &dssdev->ctrl.rfbi_timings); return 0; err1: rfbi_runtime_put(); err0: omap_dss_stop_device(dssdev); return r; } EXPORT_SYMBOL(omapdss_rfbi_display_enable); void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev) { omap_dispc_unregister_isr(framedone_callback, NULL, DISPC_IRQ_FRAMEDONE); omap_dss_stop_device(dssdev); rfbi_runtime_put(); }