int32_t sprdfb_dsi_init(struct sprdfb_device *dev) { dsih_error_t result = OK; dsih_ctrl_t* dsi_instance = &(dsi_ctx.dsi_inst); dsi_ctx.dev = dev; if(!dsi_ctx.is_inited){ if(dev->panel_ready){ printk(KERN_INFO "[DISP] sprdfb:[%s]: dsi has alread initialized\n", __FUNCTION__); dsi_instance->status = INITIALIZED; dsi_module_init(dev); dsi_core_write_function(SPRD_MIPI_DSIC_BASE, R_DSI_HOST_ERROR_MSK0, 0x0); dsi_core_write_function(SPRD_MIPI_DSIC_BASE, R_DSI_HOST_ERROR_MSK1, 0x800); }else{ printk(KERN_INFO "[DISP] sprdfb:[%s]: dsi is not initialized\n", __FUNCTION__); dsi_enable(); dsi_reset(); dsi_module_init(dev); result=sprdfb_dsih_init(dev); } }else{ printk(KERN_INFO "sprdfb:[%s]: resume\n", __FUNCTION__); dsi_enable(); dsi_reset(); result=sprdfb_dsih_init(dev); } return result; }
int32_t sprdfb_dsi_init(struct sprdfb_device *dev) { dsih_error_t result = OK; dsih_ctrl_t* dsi_instance = &(dsi_ctx.dsi_inst); dsi_ctx.dev = dev; #ifdef CONFIG_OF struct resource r; if(0 != of_address_to_resource(dev->of_dev->of_node, 1, &r)){ printk(KERN_ERR "sprdfb: sprdfb_dsi_init fail. (can't get register base address)\n"); return -1; } g_dsi_base_addr = r.start; printk("sprdfb: set g_dsi_base_addr = 0x%x\n", g_dsi_base_addr); #endif if(!dsi_ctx.is_inited){ //init if(dev->panel_ready){ //panel ready printk(KERN_INFO "sprdfb: [%s]: dsi has alread initialized\n", __FUNCTION__); dsi_instance->status = INITIALIZED; dsi_module_init(dev); #ifdef FB_DSIH_VERSION_1P21A dsi_core_write_function(SPRD_MIPI_DSIC_BASE, R_DSI_HOST_INT_MSK0, 0x0); dsi_core_write_function(SPRD_MIPI_DSIC_BASE, R_DSI_HOST_INT_MSK1, 0x800); #else dsi_core_write_function(SPRD_MIPI_DSIC_BASE, R_DSI_HOST_ERROR_MSK0, 0x0); dsi_core_write_function(SPRD_MIPI_DSIC_BASE, R_DSI_HOST_ERROR_MSK1, 0x800); #endif }else{ //panel not ready printk(KERN_INFO "sprdfb: [%s]: dsi is not initialized\n", __FUNCTION__); dsi_enable(); dsi_reset(); dsi_module_init(dev); result=sprdfb_dsih_init(dev); } }else{ //resume printk(KERN_INFO "sprdfb: [%s]: resume\n", __FUNCTION__); dsi_enable(); dsi_reset(); result=sprdfb_dsih_init(dev); } return result; }
int32_t autotst_dsi_init(struct panel_spec *panel) { dsih_error_t result = OK; printk(KERN_INFO "autotst_dsi:[%s]\n", __FUNCTION__); dsi_enable(); dsi_reset(); dsi_module_init(panel); result=dsih_init(panel); dsi_ready(panel); return result; }
int32_t dsi_early_int(void) { FB_PRINT("sprdfb:[%s]\n", __FUNCTION__); if(dsi_ctx.is_inited){ FB_PRINT("sprdfb: dispc early init warning!(has been inited)"); return 0; } //TODO:Enable DSI clock dsi_reset(); memset(&(dsi_ctx.dsi_inst), 0, sizeof(dsi_ctx.dsi_inst)); dsi_ctx.is_inited = 1; return 0; }
int32_t dsi_early_int(void) { int ret = 0; pr_debug(KERN_INFO "sprdfb:[%s]\n", __FUNCTION__); if(dsi_ctx.is_inited){ printk(KERN_WARNING "sprdfb: dispc early init warning!(has been inited)"); return 0; } // dsi_ctx.clk_dsi = clk_get(NULL, "clk_dsi"); // clk_enable(dsi_ctx.clk_dsi); /*enable dphy*/ __raw_writel(__raw_readl(REG_AHB_MIPI_PHY_CTRL) | (1<<MIPI_DPHY_EN), REG_AHB_MIPI_PHY_CTRL); dsi_reset(); // memset(&(dsi_ctx.dsi_inst), 0, sizeof(dsi_ctx.dsi_inst)); ret = request_irq(IRQ_DSI_INT0, dsi_isr0, IRQF_DISABLED, "DSI_INT0", &dsi_ctx); if (ret) { printk(KERN_ERR "sprdfb: dsi failed to request irq int0!\n"); // clk_disable(dsi_ctx.clk_dsi); return -1; } ret = request_irq(IRQ_DSI_INT1, dsi_isr1, IRQF_DISABLED, "DSI_INT1", &dsi_ctx); if (ret) { printk(KERN_ERR "sprdfb: dsi failed to request irq int1!\n"); // clk_disable(dsi_ctx.clk_dsi); return -1; } dsi_ctx.is_inited = true; return 0; }