static int nevada_panel_enable(struct omap_display *display) { int r; struct nevada_device *md = (struct nevada_device *)display->panel->priv; DBG("nevada_panel_enable\n"); mutex_lock(&md->mutex); if (display->hw_config.panel_enable) display->hw_config.panel_enable(display); r = panel_detect(md); if (r) { mutex_unlock(&md->mutex); return r; } md->enabled = panel_enabled(md); if (md->enabled) { DBG("panel already enabled\n"); ; /*nevada_esd_start_check(md);*/ } else { ; /*md->saved_bklight_level = nevada_get_bklight_level(panel);*/ } if (md->enabled) { mutex_unlock(&md->mutex); return 0; } /*nevada_cmd(md, 0x1);*/ /* SW reset */ /*msleep(120);*/ /*send_init_string(md);*/ set_sleep_mode(md, 0); md->enabled = 1; /*panel_test_dump(md);*/ /*for(r = 0; r < 500; r++)*/ /*send_init_string(md);*/ set_display_state(md, 1); /*nevada_set_bklight_level(panel, md->saved_bklight_level);*/ panel_test_dump(md); nevada_cmd(md, 0x13); /* normal mode XXX */ /*msleep(500);*/ panel_test_dump(md); mutex_unlock(&md->mutex); return 0; }
static int acx565akm_probe(struct spi_device *spi) { struct panel_drv_data *ddata; struct omap_dss_device *dssdev; struct backlight_device *bldev; int max_brightness, brightness; struct backlight_properties props; int r; dev_dbg(&spi->dev, "%s\n", __func__); spi->mode = SPI_MODE_3; ddata = devm_kzalloc(&spi->dev, sizeof(*ddata), GFP_KERNEL); if (ddata == NULL) return -ENOMEM; dev_set_drvdata(&spi->dev, ddata); ddata->spi = spi; mutex_init(&ddata->mutex); if (dev_get_platdata(&spi->dev)) { r = acx565akm_probe_pdata(spi); if (r) return r; } else if (spi->dev.of_node) { r = acx565akm_probe_of(spi); if (r) return r; } else { dev_err(&spi->dev, "platform data missing!\n"); return -ENODEV; } if (gpio_is_valid(ddata->reset_gpio)) { r = devm_gpio_request_one(&spi->dev, ddata->reset_gpio, GPIOF_OUT_INIT_LOW, "lcd reset"); if (r) goto err_gpio; } if (gpio_is_valid(ddata->reset_gpio)) gpio_set_value(ddata->reset_gpio, 1); /* * After reset we have to wait 5 msec before the first * command can be sent. */ usleep_range(5000, 10000); ddata->enabled = panel_enabled(ddata); r = panel_detect(ddata); if (!ddata->enabled && gpio_is_valid(ddata->reset_gpio)) gpio_set_value(ddata->reset_gpio, 0); if (r) { dev_err(&spi->dev, "%s panel detect error\n", __func__); goto err_detect; } memset(&props, 0, sizeof(props)); props.fb_blank = FB_BLANK_UNBLANK; props.power = FB_BLANK_UNBLANK; props.type = BACKLIGHT_RAW; bldev = backlight_device_register("acx565akm", &ddata->spi->dev, ddata, &acx565akm_bl_ops, &props); ddata->bl_dev = bldev; if (ddata->has_cabc) { r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group); if (r) { dev_err(&bldev->dev, "%s failed to create sysfs files\n", __func__); goto err_sysfs; } ddata->cabc_mode = get_hw_cabc_mode(ddata); } max_brightness = 255; if (ddata->has_bc) brightness = acx565akm_get_actual_brightness(ddata); else brightness = 0; bldev->props.max_brightness = max_brightness; bldev->props.brightness = brightness; acx565akm_bl_update_status(bldev); ddata->videomode = acx565akm_panel_timings; dssdev = &ddata->dssdev; dssdev->dev = &spi->dev; dssdev->driver = &acx565akm_ops; dssdev->type = OMAP_DISPLAY_TYPE_SDI; dssdev->owner = THIS_MODULE; dssdev->panel.timings = ddata->videomode; r = omapdss_register_display(dssdev); if (r) { dev_err(&spi->dev, "Failed to register panel\n"); goto err_reg; } return 0; err_reg: sysfs_remove_group(&bldev->dev.kobj, &bldev_attr_group); err_sysfs: backlight_device_unregister(bldev); err_detect: err_gpio: omap_dss_put_device(ddata->in); return r; }
static int acx_panel_probe(struct omap_dss_device *dssdev) { int r; struct acx565akm_device *md = &acx_dev; struct backlight_device *bldev; int max_brightness, brightness; struct backlight_properties props; dev_dbg(&dssdev->dev, "%s\n", __func__); dssdev->panel.config = OMAP_DSS_LCD_TFT | OMAP_DSS_LCD_IVS | OMAP_DSS_LCD_IHS; /* FIXME AC bias ? */ dssdev->panel.timings = acx_panel_timings; if (dssdev->platform_enable) dssdev->platform_enable(dssdev); /* * After reset we have to wait 5 msec before the first * command can be sent. */ msleep(5); md->enabled = panel_enabled(md); r = panel_detect(md); if (r) { dev_err(&dssdev->dev, "%s panel detect error\n", __func__); if (!md->enabled && dssdev->platform_disable) dssdev->platform_disable(dssdev); return r; } mutex_lock(&acx_dev.mutex); acx_dev.dssdev = dssdev; mutex_unlock(&acx_dev.mutex); if (!md->enabled) { if (dssdev->platform_disable) dssdev->platform_disable(dssdev); } /*------- Backlight control --------*/ props.fb_blank = FB_BLANK_UNBLANK; props.power = FB_BLANK_UNBLANK; bldev = backlight_device_register("acx565akm", &md->spi->dev, md, &acx565akm_bl_ops, &props); md->bl_dev = bldev; if (md->has_cabc) { r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group); if (r) { dev_err(&bldev->dev, "%s failed to create sysfs files\n", __func__); backlight_device_unregister(bldev); return r; } md->cabc_mode = get_hw_cabc_mode(md); } if (md->has_bc) max_brightness = 255; else max_brightness = dssdev->max_backlight_level; if (md->has_bc) brightness = acx565akm_get_actual_brightness(md); else if (dssdev->get_backlight) brightness = dssdev->get_backlight(dssdev); else brightness = 0; bldev->props.max_brightness = max_brightness; bldev->props.brightness = brightness; acx565akm_bl_update_status(bldev); return 0; }
static int acx565akm_panel_init(struct omap_display *display) { struct omap_panel *panel = display->panel; struct acx565akm_panel_data *panel_data = display->hw_config.panel_data; struct acx565akm_device *md = (struct acx565akm_device*)panel->priv; struct backlight_device *bldev; int brightness; int max_brightness; int r; dev_dbg(&md->spi->dev, "%s\n", __func__); if (!panel_data) { dev_err(&md->spi->dev, "no panel data\n"); return -ENODEV; } mutex_init(&md->mutex); md->display = display; if (display->hw_config.panel_enable != NULL) display->hw_config.panel_enable(display); /* * After reset we have to wait 5 msec before the first * command can be sent. */ msleep(5); md->enabled = panel_enabled(md); //TianMa display not enabled if no code change r = panel_detect(md); if (r) { //TianMa display will come here if no code change if (!md->enabled && display->hw_config.panel_disable != NULL) //panel_disable is a func, means that if it exists display->hw_config.panel_disable(display); //TianMa display will be disable if no code change mutex_unlock(&md->mutex); return r; } if (!panel_data->bc_connected) { md->has_bc = 0; md->has_cabc = 0; } #if 0 acx565akm_set_mode(display, panel->timings.x_res, panel->timings.y_res, panel->bpp); #endif if (!md->enabled) display->hw_config.panel_disable(display); bldev = backlight_device_register("acx565akm", &md->spi->dev, md, &acx565akm_bl_ops); md->bl_dev = bldev; if (md->has_cabc) { r = sysfs_create_group(&bldev->dev.kobj, &bldev_attr_group); if (r) { dev_err(&bldev->dev, "failed to create sysfs files\n"); backlight_device_unregister(bldev); return r; } md->cabc_mode = get_hw_cabc_mode(md); } bldev->props.fb_blank = FB_BLANK_UNBLANK; bldev->props.power = FB_BLANK_UNBLANK; if (md->has_bc) max_brightness = 255; else max_brightness = display->hw_config.max_backlight_level; if (md->has_bc) brightness = acx565akm_get_actual_brightness(md); else if (display->hw_config.get_backlight != NULL) brightness = display->hw_config.get_backlight(display); else brightness = 0; bldev->props.max_brightness = max_brightness; bldev->props.brightness = brightness; acx565akm_bl_update_status(bldev); return 0; }