static int ea8061_probe(struct device *dev) { int ret = 0, i; struct lcd_info *lcd; #ifdef SMART_DIMMING u8 mtp_data[LDI_MTP_LENGTH] = {0,}; #endif lcd = kzalloc(sizeof(struct lcd_info), GFP_KERNEL); if (!lcd) { pr_err("failed to allocate for lcd\n"); ret = -ENOMEM; goto err_alloc; } g_lcd = lcd; lcd->ld = lcd_device_register("panel", dev, lcd, &ea8061_lcd_ops); if (IS_ERR(lcd->ld)) { pr_err("failed to register lcd device\n"); ret = PTR_ERR(lcd->ld); goto out_free_lcd; } lcd->bd = backlight_device_register("panel", dev, lcd, &ea8061_backlight_ops, NULL); if (IS_ERR(lcd->bd)) { pr_err("failed to register backlight device\n"); ret = PTR_ERR(lcd->bd); goto out_free_backlight; } lcd->dev = dev; lcd->dsim = (struct dsim_global *)dev_get_drvdata(dev->parent); lcd->bd->props.max_brightness = MAX_BRIGHTNESS; lcd->bd->props.brightness = DEFAULT_BRIGHTNESS; lcd->bl = DEFAULT_GAMMA_LEVEL; lcd->current_bl = lcd->bl; lcd->acl_enable = 0; lcd->current_acl = 0; lcd->power = FB_BLANK_UNBLANK; lcd->ldi_enable = 1; lcd->connected = 1; lcd->auto_brightness = 0; ret = device_create_file(&lcd->ld->dev, &dev_attr_power_reduce); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_lcd_type); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_window_type); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_gamma_table); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->bd->dev, &dev_attr_auto_brightness); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); dev_set_drvdata(dev, lcd); mutex_init(&lcd->lock); mutex_init(&lcd->bl_lock); ea8061_read_id(lcd, lcd->id); dev_info(&lcd->ld->dev, "ID: %x, %x, %x\n", lcd->id[0], lcd->id[1], lcd->id[2]); dev_info(&lcd->ld->dev, "%s lcd panel driver has been probed.\n", dev_name(dev)); #ifdef SMART_DIMMING for (i = 0; i < LDI_ID_LEN; i++) lcd->smart.panelid[i] = lcd->id[i]; init_table_info_ea8061(&lcd->smart); ret = ea8061_read_mtp(lcd, mtp_data); /* for (i = 0; i < LDI_MTP_LENGTH ; i++) printk(" %dth mtp value is %x\n", i, mtp_data[i]); */ if (!ret) printk(KERN_ERR "[LCD:ERROR] : %s read mtp failed\n", __func__); calc_voltage_table_ea8061(&lcd->smart, mtp_data); ret = init_elvss_table(lcd); ret += init_gamma_table(lcd, mtp_data); ret += init_aid_dimming_table(lcd); if (ret) printk(KERN_ERR "gamma table generation is failed\n"); update_brightness(lcd, 1); #endif #if defined(GPIO_ERR_FG) if (lcd->connected) { INIT_DELAYED_WORK(&lcd->err_fg_detection, err_fg_detection_work); /* lcd->gpio = GPIO_OLED_DET; */ lcd->gpio = GPIO_ERR_FG; lcd->irq = gpio_to_irq(lcd->gpio); s3c_gpio_cfgpin(lcd->gpio, S3C_GPIO_SFN(0xf)); s3c_gpio_setpull(lcd->gpio, S3C_GPIO_PULL_NONE); if (request_irq(lcd->irq, err_fg_detection_int, IRQF_TRIGGER_FALLING, "err_fg_detection", lcd)) pr_err("failed to reqeust irq. %d\n", lcd->irq); } #endif lcd_early_suspend = ea8061_early_suspend; lcd_late_resume = ea8061_late_resume; return 0; out_free_backlight: lcd_device_unregister(lcd->ld); kfree(lcd); return ret; out_free_lcd: kfree(lcd); return ret; err_alloc: return ret; }
static int ana38401_probe(struct mipi_dsim_device *dsim) { int ret; struct lcd_info *lcd; u8 mtp_data[LDI_MTP_LEN] = {0,}; u8 hbm_data[LDI_MTP_LEN] = {0,}; lcd = kzalloc(sizeof(struct lcd_info), GFP_KERNEL); if (!lcd) { pr_err("failed to allocate for lcd\n"); ret = -ENOMEM; goto err_alloc; } lcd->ld = lcd_device_register("panel", dsim->dev, lcd, &ana38401_lcd_ops); if (IS_ERR(lcd->ld)) { pr_err("failed to register lcd device\n"); ret = PTR_ERR(lcd->ld); goto out_free_lcd; } dsim->lcd = lcd->ld; lcd->bd = backlight_device_register("panel", dsim->dev, lcd, &ana38401_backlight_ops, NULL); if (IS_ERR(lcd->bd)) { pr_err("failed to register backlight device\n"); ret = PTR_ERR(lcd->bd); goto out_free_backlight; } lcd->dev = dsim->dev; lcd->dsim = dsim; lcd->bd->props.max_brightness = MAX_BRIGHTNESS; lcd->bd->props.brightness = DEFAULT_BRIGHTNESS; lcd->brightness = lcd->current_brightness = DEFAULT_BRIGHTNESS; lcd->bl = DEFAULT_GAMMA_INDEX; lcd->current_bl = lcd->bl; lcd->acl_enable = 0; lcd->current_acl = 0; #ifdef CONFIG_S5P_LCD_INIT lcd->power = FB_BLANK_POWERDOWN; #else lcd->power = FB_BLANK_UNBLANK; #endif lcd->auto_brightness = 0; lcd->connected = 1; lcd->siop_enable = 0; lcd->temperature = TEMP_ABOVE_MINUS_00_DEGREE; ret = device_create_file(&lcd->ld->dev, &dev_attr_power_reduce); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_lcd_type); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_window_type); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->bd->dev, &dev_attr_brightness_table); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->bd->dev, &dev_attr_auto_brightness); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_siop_enable); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_temperature); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_color_coordinate); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_manufacture_date); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_dump_register); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_write_register); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_panic_enable); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); mutex_init(&lcd->lock); mutex_init(&lcd->bl_lock); ana38401_read_id(lcd, lcd->id); ana38401_read_mtp(lcd, mtp_data); ana38401_read_coordinate(lcd); ana38401_read_date(lcd); ana38401_read_hbm(lcd, hbm_data); dev_info(&lcd->ld->dev, "ID: %x, %x, %x\n", lcd->id[0], lcd->id[1], lcd->id[2]); init_dynamic_aid(lcd); ret = init_gamma_table(lcd, mtp_data, hbm_data); ret += init_aid_dimming_table(lcd); ret += init_elvss_table(lcd); ret += init_hbm_parameter(lcd); if (ret) dev_info(&lcd->ld->dev, "gamma table generation is failed\n"); show_lcd_table(lcd); lcd->ldi_enable = 1; #if defined(CONFIG_DECON_MDNIE_LITE) mdnie_register(&lcd->ld->dev, lcd, (mdnie_w)ana38401_write_set, (mdnie_r)ana38401_read, &tune_info); #endif /* 11-2. Change Gamma_Offset_Index */ ana38401_write(lcd, SEQ_CHANGE_GAMMA_OFFSET_INDEX_1, ARRAY_SIZE(SEQ_CHANGE_GAMMA_OFFSET_INDEX_1)); ana38401_write(lcd, SEQ_CHANGE_GAMMA_OFFSET_INDEX_2, ARRAY_SIZE(SEQ_CHANGE_GAMMA_OFFSET_INDEX_2)); update_brightness(lcd, 1); #if defined(CONFIG_ESD_FG) esd_fg_init(lcd); #endif dev_info(&lcd->ld->dev, "%s lcd panel driver has been probed.\n", __FILE__); return 0; out_free_backlight: lcd_device_unregister(lcd->ld); kfree(lcd); return ret; out_free_lcd: kfree(lcd); return ret; err_alloc: return ret; }
static int s6e8ax0_probe(struct device *dev) { int ret = 0; struct lcd_info *lcd; #ifdef SMART_DIMMING u8 mtp_data[LDI_MTP_LENGTH] = {0,}; #endif lcd = kzalloc(sizeof(struct lcd_info), GFP_KERNEL); if (!lcd) { pr_err("failed to allocate for lcd\n"); ret = -ENOMEM; goto err_alloc; } g_lcd = lcd; lcd->ld = lcd_device_register("panel", dev, lcd, &s6e8ax0_lcd_ops); if (IS_ERR(lcd->ld)) { pr_err("failed to register lcd device\n"); ret = PTR_ERR(lcd->ld); goto out_free_lcd; } lcd->bd = backlight_device_register("panel", dev, lcd, &s6e8ax0_backlight_ops, NULL); if (IS_ERR(lcd->bd)) { pr_err("failed to register backlight device\n"); ret = PTR_ERR(lcd->bd); goto out_free_backlight; } lcd->dev = dev; lcd->dsim = (struct dsim_global *)dev_get_drvdata(dev->parent); lcd->bd->props.max_brightness = MAX_BRIGHTNESS; lcd->bd->props.brightness = DEFAULT_BRIGHTNESS; lcd->bl = DEFAULT_GAMMA_LEVEL; lcd->current_bl = lcd->bl; lcd->acl_enable = 0; lcd->siop_enable = 0; lcd->current_acl = 0; lcd->power = FB_BLANK_UNBLANK; lcd->ldi_enable = 1; lcd->connected = 1; lcd->auto_brightness = 0; ret = device_create_file(&lcd->ld->dev, &dev_attr_power_reduce); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_siop_enable); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_lcd_type); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_gamma_table); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_read_acl); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->bd->dev, &dev_attr_auto_brightness); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); dev_set_drvdata(dev, lcd); mutex_init(&lcd->lock); mutex_init(&lcd->bl_lock); s6e8ax0_read_id(lcd, lcd->id); dev_info(&lcd->ld->dev, "ID: %x, %x, %x\n", lcd->id[0], lcd->id[1], lcd->id[2]); dev_info(&lcd->ld->dev, "s6e8aa0 lcd panel driver has been probed.\n"); #ifdef SMART_DIMMING s6e8aa0_check_id(lcd, lcd->id); init_table_info(&lcd->smart); ret = s6e8ax0_read_mtp(lcd, mtp_data); if (!ret) { printk(KERN_ERR "[LCD:ERROR] : %s read mtp failed\n", __func__); /*return -EPERM;*/ } calc_voltage_table(&lcd->smart, mtp_data); if (lcd->support_elvss) ret = init_elvss_table(lcd); else { lcd->elvss_table = (unsigned char **)ELVSS_TABLE; ret = 0; } ret += init_gamma_table(lcd); #ifdef CONFIG_AID_DIMMING if (lcd->id[1] == 0x20 || lcd->id[1] == 0x40 || lcd->id[1] == 0x60) { printk(KERN_INFO "AID Dimming is started. %d\n", lcd->id[1]); lcd->support_aid = 1; ret += init_aid_dimming_table(lcd); } #endif if (ret) { printk(KERN_ERR "gamma table generation is failed\n"); lcd->gamma_table = (unsigned char **)gamma22_table; lcd->elvss_table = (unsigned char **)ELVSS_TABLE; } update_brightness(lcd, 1); #endif #if defined(GPIO_OLED_DET) if (lcd->connected) { INIT_DELAYED_WORK(&lcd->oled_detection, oled_detection_work); lcd->irq = gpio_to_irq(GPIO_OLED_DET); s3c_gpio_cfgpin(GPIO_OLED_DET, S3C_GPIO_SFN(0xf)); s3c_gpio_setpull(GPIO_OLED_DET, S3C_GPIO_PULL_NONE); if (request_irq(lcd->irq, oled_detection_int, IRQF_TRIGGER_FALLING, "oled_detection", lcd)) pr_err("failed to reqeust irq. %d\n", lcd->irq); } #endif lcd_early_suspend = s6e8ax0_early_suspend; lcd_late_resume = s6e8ax0_late_resume; return 0; out_free_backlight: lcd_device_unregister(lcd->ld); kfree(lcd); return ret; out_free_lcd: kfree(lcd); return ret; err_alloc: return ret; }
static int s6e8fa0_probe(struct mipi_dsim_device *dsim) { int ret = 0, i; struct lcd_info *lcd; #ifdef SMART_DIMMING u8 mtp_data[LDI_MTP_LENGTH] = {0,}; u8 elvss_data[LDI_ELVSS_LENGTH] = {0,}; #endif lcd = kzalloc(sizeof(struct lcd_info), GFP_KERNEL); if (!lcd) { pr_err("failed to allocate for lcd\n"); ret = -ENOMEM; goto err_alloc; } g_lcd = lcd; lcd->ld = lcd_device_register("panel", dsim->dev, lcd, &s6e8fa0_lcd_ops); if (IS_ERR(lcd->ld)) { pr_err("failed to register lcd device\n"); ret = PTR_ERR(lcd->ld); goto out_free_lcd; } lcd->bd = backlight_device_register("panel", dsim->dev, lcd, &s6e8fa0_backlight_ops, NULL); if (IS_ERR(lcd->bd)) { pr_err("failed to register backlight device\n"); ret = PTR_ERR(lcd->bd); goto out_free_backlight; } lcd->dev = dsim->dev; lcd->dsim = dsim; lcd->bd->props.max_brightness = MAX_BRIGHTNESS; lcd->bd->props.brightness = DEFAULT_BRIGHTNESS; lcd->bl = DEFAULT_GAMMA_LEVEL; lcd->current_bl = lcd->bl; lcd->acl_enable = 0; lcd->current_acl = 0; lcd->power = FB_BLANK_UNBLANK; lcd->ldi_enable = 1; lcd->auto_brightness = 0; lcd->connected = 1; lcd->siop_enable = 0; ret = device_create_file(&lcd->ld->dev, &dev_attr_power_reduce); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_lcd_type); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_window_type); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_gamma_table); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->bd->dev, &dev_attr_auto_brightness); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); ret = device_create_file(&lcd->ld->dev, &dev_attr_siop_enable); if (ret < 0) dev_err(&lcd->ld->dev, "failed to add sysfs entries, %d\n", __LINE__); /* dev_set_drvdata(dsim->dev, lcd); */ mutex_init(&lcd->lock); mutex_init(&lcd->bl_lock); s6e8fa0_read_id(lcd, lcd->id); dev_info(&lcd->ld->dev, "ID: %x, %x, %x\n", lcd->id[0], lcd->id[1], lcd->id[2]); dev_info(&lcd->ld->dev, "%s lcd panel driver has been probed.\n", dev_name(dsim->dev)); #ifdef SMART_DIMMING for (i = 0; i < LDI_ID_LEN; i++) lcd->smart.panelid[i] = lcd->id[i]; init_table_info_6P(&lcd->smart); ret = s6e8fa0_read_mtp(lcd, mtp_data); for (i = 0; i < LDI_MTP_LENGTH ; i++) smtd_dbg("%dth mtp value is %d\n", i, mtp_data[i]); if (ret < 1) printk(KERN_ERR "[LCD:ERROR] : %s read mtp failed\n", __func__); /*return -EPERM;*/ calc_voltage_table_6P(&lcd->smart, mtp_data); ret = s6e8fa0_read_elvss(lcd, elvss_data); for (i = 0; i < LDI_ELVSS_LENGTH ; i++) smtd_dbg("%dth ELVSS_volt_level %x\n", i, elvss_data[i]); lcd->elvss_ref = elvss_data[1]; #ifdef PSRE_HBM lcd->elvss_cal_origin = elvss_data[16]; lcd->elvss_cal_hbm = mtp_data[39]; #endif ret = init_elvss_table(lcd); ret += init_gamma_table(lcd, mtp_data); ret += init_aid_dimming_table(lcd, mtp_data); if (ret) printk(KERN_ERR "gamma table generation is failed\n"); update_brightness(lcd, 1); #endif return 0; out_free_backlight: lcd_device_unregister(lcd->ld); kfree(lcd); return ret; out_free_lcd: kfree(lcd); return ret; err_alloc: return ret; }