static int lg4591_get_status(struct mmp_panel *panel) { struct mmp_path *path = mmp_get_path(panel->plat_path_name); struct mmp_dsi_buf dbuf; u8 read_status = 0; mmp_phy_dsi_rx_cmd_array(path->phy, &dbuf, lg4591_read_status_cmds, ARRAY_SIZE(lg4591_read_status_cmds)); read_status = dbuf.data[0]; if (read_status != MIPI_DCS_NORMAL_STATE_LG4591) { pr_err("[ERROR] panel status is 0x%x\n", read_status); return 1; } else { pr_debug("panel status is 0x%x\n", read_status); return 0; } return 0; }
static void lg4591_onoff(struct mmp_panel *panel, int status) { struct lg4591_plat_data *plat = panel->plat_data; struct mmp_path *path = mmp_get_path(panel->plat_path_name); if (status) { /* power on */ if (plat->plat_onoff) plat->plat_onoff(1); else lg4591_panel_power(panel, 0, 1); lg4591_panel_on(path); } else { /* power off */ if (plat->plat_onoff) plat->plat_onoff(0); else lg4591_panel_power(panel, 0, 0); } }
static void lg4591_set_brightness(struct mmp_panel *panel, int level) { struct mmp_path *path = mmp_get_path(panel->plat_path_name); struct mmp_dsi_cmd_desc brightness_cmds; char cmds[2]; /*Prepare cmds for brightness control*/ cmds[0] = 0x51; /* birghtness 1~4 is too dark, add 5 to correctness */ if (level) level += 5; cmds[1] = level; /*Prepare dsi commands to send*/ brightness_cmds.data_type = MIPI_DSI_DCS_SHORT_WRITE_PARAM; brightness_cmds.lp = 0; brightness_cmds.delay = 0; brightness_cmds.length = sizeof(cmds); brightness_cmds.data = cmds; mmp_phy_dsi_tx_cmd_array(path->phy, &brightness_cmds, 1); }
static int mmpfb_overlay_probe(struct platform_device *pdev) { struct mmp_buffer_driver_mach_info *mi; struct fb_info *info = 0; struct mmpfb_info *fbi = 0; const char *path_name; int overlay_id = 0, ret; /* initialize fb */ info = framebuffer_alloc(sizeof(struct mmpfb_info), &pdev->dev); if (info == NULL) return -ENOMEM; fbi = info->par; if (!fbi) { ret = -EINVAL; goto failed; } if (IS_ENABLED(CONFIG_OF)) { struct device_node *np = pdev->dev.of_node; if (!np) return -EINVAL; if (of_property_read_string(np, "marvell,fb-name", &fbi->name)) return -EINVAL; if (of_property_read_string(np, "marvell,path-name", &path_name)) return -EINVAL; if (of_property_read_u32(np, "marvell,overlay-id", &overlay_id)) return -EINVAL; } else { mi = pdev->dev.platform_data; if (mi == NULL) { dev_err(&pdev->dev, "no platform data defined\n"); return -EINVAL; } fbi->name = mi->name; path_name = mi->path_name; overlay_id = mi->overlay_id; } info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_DISABLED; info->node = -1; strcpy(info->fix.id, fbi->name); info->fix.accel = FB_ACCEL_NONE; info->fbops = &mmpfb_overlay_ops; /* init fb */ fbi->fb_info = info; platform_set_drvdata(pdev, fbi); fbi->dev = &pdev->dev; mutex_init(&fbi->access_ok); mutex_init(&fbi->fence_mutex); /* get display path by name */ fbi->path = mmp_get_path(path_name); if (!fbi->path) { dev_err(&pdev->dev, "can't get the path %s\n", path_name); ret = -EINVAL; goto failed_destroy_mutex; } dev_info(fbi->dev, "path %s get\n", fbi->path->name); /* get overlay */ fbi->overlay = mmp_path_get_overlay(fbi->path, overlay_id); if (!fbi->overlay) { ret = -EINVAL; goto failed_destroy_mutex; } /* If path has master path, need initialize this path*/ if (fbi->path->slave && fbi->path->master && (!strcmp(fbi->path->slave->name, fbi->path->name))) mmpfb_overlay_path_init(fbi); ret = register_framebuffer(info); if (ret < 0) { dev_err(&pdev->dev, "Failed to register fb: %d\n", ret); ret = -ENXIO; goto failed_destroy_mutex; } mmpfb_overlay_vsync_notify_init(fbi); /* Disable Graphic layer after boot up, becaues uboot use graphic for logo */ if (fbi->overlay->id == PN_GRA) mmp_overlay_set_status(fbi->overlay, MMP_OFF_DMA); dev_info(fbi->dev, "loaded to /dev/fb%d <%s>.\n", info->node, info->fix.id); return 0; failed_destroy_mutex: mutex_destroy(&fbi->access_ok); mutex_destroy(&fbi->fence_mutex); failed: if (fbi) dev_err(fbi->dev, "mmp-fb: frame buffer device init failed\n"); platform_set_drvdata(pdev, NULL); framebuffer_release(info); return ret; }
static void lg4591_esd_recover(struct mmp_panel *panel) { struct mmp_path *path = mmp_get_path(panel->plat_path_name); esd_panel_recover(path); }