static int sonywvga_panel_unblank(struct msm_lcdc_panel_ops *panel_data) { LCMDBG("%s\n", __func__); wake_lock(&panel_idle_lock); mutex_lock(&panel_lock); hr_msleep(100); qspi_send_9bit(&unblank_msg); hr_msleep(20); //init gamma setting if(!is_sony_with_gamma()) lcm_write_tb(SONY_TFT_INIT_TABLE, ARRAY_SIZE(SONY_TFT_INIT_TABLE)); sonywvga_set_gamma_val(last_val_pwm); g_unblank_stage = 1; mutex_unlock(&panel_lock); wake_unlock(&panel_idle_lock); return 0; }
static int sony_tft_panel_unblank(struct msm_lcdc_panel_ops *ops) { pr_info("%s: +()\n", __func__); mutex_lock(&panel_lock); if (tft_panel_on) { pr_info("%s: -() already unblanked\n", __func__); goto done; } sony_tft_panel_power(1); msleep(45); clk_enable(spi_clk); qspi_send_9bit(0x0, 0x11); msleep(5); qspi_send_9bit(0x0, 0x3a); if (is_sony_RGB666()) qspi_send_9bit(0x1, 0x06); else qspi_send_9bit(0x1, 0x05); msleep(100); qspi_send_9bit(0x0, 0x29); msleep(20); //init gamma setting if(!is_sony_with_gamma()) sony_tft_panel_without_gamma_init(); /* unlock register page for pwm setting */ if (is_sony_spi()) { qspi_send_9bit(0x0, 0xf0); qspi_send_9bit(0x1, 0x5a); qspi_send_9bit(0x1, 0x5a); qspi_send_9bit(0x0, 0xf1); qspi_send_9bit(0x1, 0x5a); qspi_send_9bit(0x1, 0x5a); qspi_send_9bit(0x0, 0xd0); qspi_send_9bit(0x1, 0x5a); qspi_send_9bit(0x1, 0x5a); qspi_send_9bit(0x0, 0xc2); qspi_send_9bit(0x1, 0x53); qspi_send_9bit(0x1, 0x12); } clk_disable(spi_clk); msleep(100); tft_panel_on = 1; sony_tft_set_pwm_val(last_val); pr_info("%s: -()\n", __func__); done: mutex_unlock(&panel_lock); return 0; }
static void sony_tft_panel_without_gamma_init(void) { pr_info("%s: init gamma setting", __func__); qspi_send_9bit(0x0, 0xF1); qspi_send_9bit(0x1, 0x5A); qspi_send_9bit(0x1, 0x5A); // FAh RGB qspi_send_9bit(0x0, 0xFA); // Red qspi_send_9bit(0x1, 0x32); qspi_send_9bit(0x1, 0x3F); qspi_send_9bit(0x1, 0x3F); qspi_send_9bit(0x1, 0x29); qspi_send_9bit(0x1, 0x3E); qspi_send_9bit(0x1, 0x3C); qspi_send_9bit(0x1, 0x3D); qspi_send_9bit(0x1, 0x2C); qspi_send_9bit(0x1, 0x27); qspi_send_9bit(0x1, 0x3D); qspi_send_9bit(0x1, 0x2E); qspi_send_9bit(0x1, 0x31); qspi_send_9bit(0x1, 0x3A); qspi_send_9bit(0x1, 0x34); qspi_send_9bit(0x1, 0x36); // Green qspi_send_9bit(0x1, 0x1A); qspi_send_9bit(0x1, 0x3F); qspi_send_9bit(0x1, 0x3F); qspi_send_9bit(0x1, 0x2E); qspi_send_9bit(0x1, 0x40); qspi_send_9bit(0x1, 0x3C); qspi_send_9bit(0x1, 0x3C); qspi_send_9bit(0x1, 0x2B); qspi_send_9bit(0x1, 0x25); qspi_send_9bit(0x1, 0x39); qspi_send_9bit(0x1, 0x25); qspi_send_9bit(0x1, 0x23); qspi_send_9bit(0x1, 0x2A); qspi_send_9bit(0x1, 0x20); qspi_send_9bit(0x1, 0x22); // Blue qspi_send_9bit(0x1, 0x00); qspi_send_9bit(0x1, 0x3F); qspi_send_9bit(0x1, 0x3F); qspi_send_9bit(0x1, 0x2F); qspi_send_9bit(0x1, 0x3E); qspi_send_9bit(0x1, 0x3C); qspi_send_9bit(0x1, 0x3C); qspi_send_9bit(0x1, 0x2A); qspi_send_9bit(0x1, 0x23); qspi_send_9bit(0x1, 0x35); qspi_send_9bit(0x1, 0x1E); qspi_send_9bit(0x1, 0x18); qspi_send_9bit(0x1, 0x1C); qspi_send_9bit(0x1, 0x0C); qspi_send_9bit(0x1, 0x0E); // FBh RGB qspi_send_9bit(0x0, 0xFB); // Red qspi_send_9bit(0x1, 0x00); qspi_send_9bit(0x1, 0x0D); qspi_send_9bit(0x1, 0x09); qspi_send_9bit(0x1, 0x0C); qspi_send_9bit(0x1, 0x26); qspi_send_9bit(0x1, 0x2E); qspi_send_9bit(0x1, 0x31); qspi_send_9bit(0x1, 0x22); qspi_send_9bit(0x1, 0x19); qspi_send_9bit(0x1, 0x33); qspi_send_9bit(0x1, 0x22); qspi_send_9bit(0x1, 0x23); qspi_send_9bit(0x1, 0x21); qspi_send_9bit(0x1, 0x17); qspi_send_9bit(0x1, 0x00); // Green qspi_send_9bit(0x1, 0x00); qspi_send_9bit(0x1, 0x25); qspi_send_9bit(0x1, 0x1D); qspi_send_9bit(0x1, 0x1F); qspi_send_9bit(0x1, 0x35); qspi_send_9bit(0x1, 0x3C); qspi_send_9bit(0x1, 0x3A); qspi_send_9bit(0x1, 0x26); qspi_send_9bit(0x1, 0x1B); qspi_send_9bit(0x1, 0x34); qspi_send_9bit(0x1, 0x23); qspi_send_9bit(0x1, 0x23); qspi_send_9bit(0x1, 0x1F); qspi_send_9bit(0x1, 0x12); qspi_send_9bit(0x1, 0x00); // Blue qspi_send_9bit(0x1, 0x00); qspi_send_9bit(0x1, 0x3F); qspi_send_9bit(0x1, 0x31); qspi_send_9bit(0x1, 0x33); qspi_send_9bit(0x1, 0x43); qspi_send_9bit(0x1, 0x48); qspi_send_9bit(0x1, 0x41); qspi_send_9bit(0x1, 0x2A); qspi_send_9bit(0x1, 0x1D); qspi_send_9bit(0x1, 0x35); qspi_send_9bit(0x1, 0x23); qspi_send_9bit(0x1, 0x23); qspi_send_9bit(0x1, 0x21); qspi_send_9bit(0x1, 0x10); qspi_send_9bit(0x1, 0x00); // F3h Power control qspi_send_9bit(0x0, 0xF3); qspi_send_9bit(0x1, 0x00); qspi_send_9bit(0x1, 0x10); qspi_send_9bit(0x1, 0x25); qspi_send_9bit(0x1, 0x01); qspi_send_9bit(0x1, 0x2D); qspi_send_9bit(0x1, 0x2D); qspi_send_9bit(0x1, 0x24); qspi_send_9bit(0x1, 0x2D); qspi_send_9bit(0x1, 0x10); qspi_send_9bit(0x1, 0x10); qspi_send_9bit(0x1, 0x0A); qspi_send_9bit(0x1, 0x37); // F4h VCOM Control qspi_send_9bit(0x0, 0xF4); qspi_send_9bit(0x1, 0x88); qspi_send_9bit(0x1, 0x20); qspi_send_9bit(0x1, 0x00); qspi_send_9bit(0x1, 0xAF); qspi_send_9bit(0x1, 0x64); qspi_send_9bit(0x1, 0x00); qspi_send_9bit(0x1, 0xAA); qspi_send_9bit(0x1, 0x64); qspi_send_9bit(0x1, 0x00); qspi_send_9bit(0x1, 0x00); //Change to level 1 qspi_send_9bit(0x0, 0xF0); qspi_send_9bit(0x1, 0x5A); qspi_send_9bit(0x1, 0x5A); }
static int lcm_write_cmd(struct spi_msg cmd) { int ret = -1; ret = qspi_send_9bit(&cmd); return 0; }
static int sony_tft_panel_unblank(struct msm_lcdc_panel_ops *ops) { pr_info("%s: +()\n", __func__); mutex_lock(&panel_lock); if (tft_panel_on) { pr_info("%s: -() already unblanked\n", __func__); goto done; } sony_tft_panel_power(1); msleep(45); clk_enable(spi_clk); qspi_send_9bit(0x0, 0x11); msleep(5); qspi_send_9bit(0x0, 0x3a); qspi_send_9bit(0x1, 0x05); msleep(100); qspi_send_9bit(0x0, 0x29); /* unlock register page for pwm setting */ qspi_send_9bit(0x0, 0xf0); qspi_send_9bit(0x1, 0x5a); qspi_send_9bit(0x1, 0x5a); qspi_send_9bit(0x0, 0xf1); qspi_send_9bit(0x1, 0x5a); qspi_send_9bit(0x1, 0x5a); qspi_send_9bit(0x0, 0xd0); qspi_send_9bit(0x1, 0x5a); qspi_send_9bit(0x1, 0x5a); qspi_send_9bit(0x0, 0xc2); qspi_send_9bit(0x1, 0x53); qspi_send_9bit(0x1, 0x12); clk_disable(spi_clk); msleep(100); tft_panel_on = 1; sony_tft_set_pwm_val(last_val); pr_info("%s: -()\n", __func__); done: mutex_unlock(&panel_lock); return 0; }
static void mecha_brightness_set(struct led_classdev *led_cdev, enum led_brightness val) { struct spi_msg set_brightness = { .cmd = 0x51, .len = 1, .data = (unsigned char *)&val, }; uint8_t shrink_br; mutex_lock(&panel_lock); if (val < 30) shrink_br = 8; else if ((val >= 30) && (val <= 143)) shrink_br = 151 * (val - 30) / 113 + 8; else shrink_br = 96 * (val - 143) / 112 + 159; if (panel_type == PANEL_AUO) { qspi_send_16bit(0x1, 0x51); qspi_send_16bit(0x0, 0x00); qspi_send_16bit(0x2, shrink_br); } else { set_brightness.data = (unsigned char *)&shrink_br; qspi_send_9bit(&set_brightness); } last_val = shrink_br; mutex_unlock(&panel_lock); } static int mecha_cabc_switch(int on) { if (test_bit(CABC_STATE, &status) == on) return 1; if (on) { printk(KERN_DEBUG "turn on CABC\n"); set_bit(CABC_STATE, &status); mutex_lock(&panel_lock); if (panel_type == PANEL_AUO) lcm_auo_write_seq(auo_enable_cabc, ARRAY_SIZE(auo_enable_cabc)); else lcm_sharp_write_seq(sharp_enable_cabc, ARRAY_SIZE(sharp_enable_cabc)); mutex_unlock(&panel_lock); } else { printk(KERN_DEBUG "turn off CABC\n"); clear_bit(CABC_STATE, &status); mutex_lock(&panel_lock); if (panel_type == PANEL_AUO) lcm_auo_write_seq(auo_disable_cabc, ARRAY_SIZE(auo_disable_cabc)); else lcm_sharp_write_seq(sharp_disable_cabc, ARRAY_SIZE(sharp_disable_cabc)); mutex_unlock(&panel_lock); } return 1; } static ssize_t auto_backlight_show(struct device *dev, struct device_attribute *attr, char *buf); static ssize_t auto_backlight_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count); #define CABC_ATTR(name) __ATTR(name, 0644, auto_backlight_show, auto_backlight_store) static struct device_attribute auto_attr = CABC_ATTR(auto); static ssize_t auto_backlight_show(struct device *dev, struct device_attribute *attr, char *buf) { int i = 0; i += scnprintf(buf + i, PAGE_SIZE - 1, "%d\n", test_bit(CABC_STATE, &status)); return i; }