int lge_get_bootreason_with_lcd_dimming(void) { int ret = 0; if (lge_get_bootreason() == 0x77665560) ret = 1; else if (lge_get_bootreason() == 0x77665561) ret = 2; else if (lge_get_bootreason() == 0x77665562) ret = 3; return ret; }
static ssize_t lge_qsdl_apps_info_show(struct device *dev, struct device_attribute *attr, char *buffer) { struct platform_device *pdev = to_platform_device(dev); struct qsdl *data = platform_get_drvdata(pdev); struct qsdl_sysfs_table info[] = { {0x0301, "Q002"}, {0x0302, "Q002"}, {0x0303, "Q002"}, {0x0304, "Q002"}, {0x0308, "Q002"}, {0x0400, "Q002"}, {0x0100, "Q003"}, {0x3001, "Q005"}, {0x3002, "Q005"}, }; int i, reboot_reason = 0; static bool already_read; if (data->oneshot_read) { if (already_read) { pr_info("%s: Already read infomation, not permitted\n", __func__); goto nothing; } already_read = true; } reboot_reason = lge_get_bootreason(); if ((reboot_reason == -1) || !is_crash(reboot_reason)) goto nothing; for (i = 0; i < ARRAY_SIZE(info); i++) { if (which_reason(reboot_reason) == info[i].reason) break; } /* etc case */ if (i >= ARRAY_SIZE(info)) goto nothing; /* found it */ return snprintf(buffer, PAGE_SIZE, "%s", info[i].uevent_key); nothing: return snprintf(buffer, PAGE_SIZE, "Q000"); }
static int lge_qsdl_trigger_notify(struct platform_device *pdev) { struct qsdl_uevent_table info[] = { {0x0301, {"QSDL=Q002", NULL}, }, {0x0302, {"QSDL=Q002", NULL}, }, {0x0303, {"QSDL=Q002", NULL}, }, {0x0304, {"QSDL=Q002", NULL}, }, {0x0308, {"QSDL=Q002", NULL}, }, {0x0400, {"QSDL=Q002", NULL}, }, {0x0100, {"QSDL=Q003", NULL}, }, {0x3001, {"QSDL=Q005", NULL}, }, {0x3002, {"QSDL=Q005", NULL}, }, }; int i, reboot_reason = 0; char **uevent_envp = NULL; struct device *dev = &pdev->dev; reboot_reason = lge_get_bootreason(); pr_debug("%s: reboot reason - 0x%x\n", __func__, reboot_reason); if ((reboot_reason == -1) || !is_crash(reboot_reason)) return -EINVAL; for (i = 0; i < ARRAY_SIZE(info); i++) { pr_debug("%s: searching reason - (0x%x - 0x%x)\n", __func__, which_reason(reboot_reason), info[i].reason); if (which_reason(reboot_reason) == info[i].reason) { /* send notify to userspace via uevent */ if (dev) { uevent_envp = info[i].uevent_key; kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, uevent_envp); pr_debug("%s: sent QSDL notify uevent to userspace - %d\n", __func__, i); } break; } } return 0; }
static int lm3630_probe(struct i2c_client *i2c_dev, const struct i2c_device_id *id) { struct backlight_platform_data *pdata; struct lm3630_device *dev; struct backlight_device *bl_dev; struct backlight_properties props; int err; pr_info(" %s: i2c probe start\n", __func__); #ifdef CONFIG_OF if (&i2c_dev->dev.of_node) { pdata = devm_kzalloc(&i2c_dev->dev, sizeof(struct backlight_platform_data), GFP_KERNEL); if (!pdata) { pr_err("%s: Failed to allocate memory\n", __func__); return -ENOMEM; } err = lm3630_parse_dt(&i2c_dev->dev, pdata); if (err != 0) return err; } else { pdata = i2c_dev->dev.platform_data; } #else pdata = i2c_dev->dev.platform_data; #endif pr_info("%s: gpio = %d\n", __func__, pdata->gpio); if (pdata->gpio && gpio_request(pdata->gpio, "lm3630 reset") != 0) { return -ENODEV; } lm3630_i2c_client = i2c_dev; dev = kzalloc(sizeof(struct lm3630_device), GFP_KERNEL); if (dev == NULL) { dev_err(&i2c_dev->dev, "fail alloc for lm3630_device\n"); return 0; } main_lm3630_dev = dev; memset(&props, 0, sizeof(struct backlight_properties)); props.type = BACKLIGHT_RAW; props.max_brightness = MAX_BRIGHTNESS_LM3630; bl_dev = backlight_device_register(I2C_BL_NAME, &i2c_dev->dev, NULL, &lm3630_bl_ops, &props); bl_dev->props.max_brightness = MAX_BRIGHTNESS_LM3630; #if defined(CONFIG_B1_LGD_PANEL) if(lge_get_boot_mode() == LGE_BOOT_MODE_CHARGERLOGO) bl_dev->props.brightness = 0x99; // same to LK else if(lge_get_boot_mode() == LGE_BOOT_MODE_FACTORY || lge_get_boot_mode() == LGE_BOOT_MODE_FACTORY2 || lge_get_boot_mode() == LGE_BOOT_MODE_FACTORY3 || lge_get_boot_mode() == LGE_BOOT_MODE_PIFBOOT || lge_get_boot_mode() == LGE_BOOT_MODE_PIFBOOT2 || lge_get_boot_mode() == LGE_BOOT_MODE_PIFBOOT3) factory_boot = 1; else bl_dev->props.brightness = DEFAULT_BRIGHTNESS; #else bl_dev->props.brightness = pdata->default_brightness; #endif bl_dev->props.power = FB_BLANK_UNBLANK; dev->bl_dev = bl_dev; dev->client = i2c_dev; dev->gpio = pdata->gpio; dev->max_current = pdata->max_current; dev->min_brightness = pdata->min_brightness; dev->max_brightness = pdata->max_brightness; dev->blmap_size = pdata->blmap_size; if (dev->blmap_size) { dev->blmap = kzalloc(sizeof(char) * dev->blmap_size, GFP_KERNEL); if (!dev->blmap) { pr_err("%s: Failed to allocate memory\n", __func__); return -ENOMEM; } memcpy(dev->blmap, pdata->blmap, dev->blmap_size); } else { dev->blmap = NULL; } #ifdef CONFIG_LGE_LCD_OFF_DIMMING if ((lge_get_bootreason() == 0x77665560) || (lge_get_bootreason() == 0x77665561)) { dev->bl_dev->props.brightness = 50; pr_info("%s : fota reboot - backlight set 50\n", __func__); } #endif if (gpio_get_value(dev->gpio)) backlight_status = BL_ON; else backlight_status = BL_OFF; i2c_set_clientdata(i2c_dev, dev); mutex_init(&dev->bl_mutex); err = device_create_file(&i2c_dev->dev, &dev_attr_lm3630_level); err = device_create_file(&i2c_dev->dev, &dev_attr_lm3630_backlight_on_off); err = device_create_file(&i2c_dev->dev, &dev_attr_lm3630_exp_min_value); #if defined(CONFIG_BACKLIGHT_CABC_DEBUG_ENABLE) err = device_create_file(&i2c_dev->dev, &dev_attr_lm3630_pwm); #endif pr_info("%s: i2c probe done\n", __func__); return 0; }