static int msm_flash_lm3642_i2c_probe(struct i2c_client *client,
		const struct i2c_device_id *id)
{
	CDBG("%s entry \n", __func__);

	return msm_flash_i2c_probe(client, id);
}
Ejemplo n.º 2
0
static int msm_flash_bd7710_i2c_probe(struct i2c_client *client,
		const struct i2c_device_id *id)
{
	if (!id) {
		pr_err("msm_flash_bd7710_i2c_probe: id is NULL");
		id = bd7710_i2c_id;
	}

	return msm_flash_i2c_probe(client, id);
}
Ejemplo n.º 3
0
static int msm_flash_sky81296_i2c_probe(struct i2c_client *client,
                                        const struct i2c_device_id *id)
{
    pr_info("%s entry\n", __func__);
    if (!id) {
        pr_err("msm_flash_sky81296_i2c_probe: id is NULL");
        id = sky81296_i2c_id;
    }

    return msm_flash_i2c_probe(client, id);
}
Ejemplo n.º 4
0
static int msm_flash_lm3646_i2c_probe(struct i2c_client *client,
                                      const struct i2c_device_id *id)
{
    if (!id) {
        pr_err("msm_flash_lm3646_i2c_probe: id is NULL");
        id = lm3646_i2c_id;
    }

    if(get_hw_version_major() == 5)
        return  msm_flash_i2c_probe(client, id);
    else
        return -EFAULT;
}
static int msm_flash_lm3642_i2c_probe(struct i2c_client *client,
		const struct i2c_device_id *id)
{
	struct msm_camera_sensor_board_info *flashdata = NULL;
	struct msm_camera_power_ctrl_t *power_info = NULL;
	int rc = 0 ;
	LM3642_DBG("%s entry\n", __func__);
	if (!id) {
		pr_err("msm_flash_lm3642_i2c_probe: id is NULL");
		id = lm3642_i2c_id;
	}
	rc = msm_flash_i2c_probe(client, id);
	if(rc < 0){
		pr_err("%s: probe failed\n", __func__);
		return rc;
	} else {
		/*when the flashlight open background, hold power key for more than 10s*/
		/*would enter HW reset, without turn off the light. So we need to close*/
		/*light after we reboot*/
		msm_flash_lm3642_led_off(&fctrl);
	}
	/*if the high current defined in dts, use the current value*/
	if(fctrl.flash_high_current){
		fctrl.reg_setting->high_setting->reg_setting[0].reg_data = fctrl.flash_high_current;
	}

	flashdata = fctrl.flashdata;
	power_info = &flashdata->power_info;

	rc = msm_camera_request_gpio_table(
		power_info->gpio_conf->cam_gpio_req_tbl,
		power_info->gpio_conf->cam_gpio_req_tbl_size, 1);
	if (rc < 0) {
		pr_err("%s: request gpio failed\n", __func__);
		return rc;
	}

	if (fctrl.pinctrl_info.use_pinctrl == true) {
		pr_err("%s:%d PC:: flash pins setting to active state",
				__func__, __LINE__);
		rc = pinctrl_select_state(fctrl.pinctrl_info.pinctrl,
				fctrl.pinctrl_info.gpio_state_active);
		if (rc)
			pr_err("%s:%d cannot set pin to active state",
					__func__, __LINE__);
	}

	if (!rc)
		msm_lm3642_torch_create_classdev(&(client->dev),NULL);
	return rc;
}
Ejemplo n.º 6
0
static int msm_flash_lm3642_i2c_probe(struct i2c_client *client,
		const struct i2c_device_id *id)
{
	struct msm_camera_sensor_board_info *flashdata = NULL;
	struct msm_camera_power_ctrl_t *power_info = NULL;
	int rc = 0 ;
	LM3642_DBG("%s entry\n", __func__);
	if (!id) {
		pr_err("msm_flash_lm3642_i2c_probe: id is NULL");
		id = lm3642_i2c_id;
	}
	rc = msm_flash_i2c_probe(client, id);

	flashdata = fctrl.flashdata;
	power_info = &flashdata->power_info;

	rc = msm_camera_request_gpio_table(
		power_info->gpio_conf->cam_gpio_req_tbl,
		power_info->gpio_conf->cam_gpio_req_tbl_size, 1);
	if (rc < 0) {
		pr_err("%s: request gpio failed\n", __func__);
		return rc;
	}

	if (fctrl.pinctrl_info.use_pinctrl == true) {
		pr_err("%s:%d PC:: flash pins setting to active state",
				__func__, __LINE__);
		rc = pinctrl_select_state(fctrl.pinctrl_info.pinctrl,
				fctrl.pinctrl_info.gpio_state_active);
		if (rc)
			pr_err("%s:%d cannot set pin to active state",
					__func__, __LINE__);
	}

	if (!rc)
		msm_lm3642_torch_create_classdev(&(client->dev),NULL);
	return rc;
}
Ejemplo n.º 7
0
static int rt8542_probe(struct i2c_client *i2c_dev,
		const struct i2c_device_id *id)
{
	struct backlight_platform_data *pdata;
	struct rt8542_device *dev;
	struct backlight_device *bl_dev;
	struct backlight_properties props;
	int err;

	printk(">> %s 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__);

			pr_debug("<< %s END (error#1: -ENOMEM)\n", __func__);
			return -ENOMEM;
		}
		err = rt8542_parse_dt(&i2c_dev->dev, pdata);
		if (err != 0) {
			pr_debug("<< %s END (error#2: %d)\n", __func__, err);
			return err;
		}
	} else {
		pdata = i2c_dev->dev.platform_data;
	}
#else
	pdata = i2c_dev->dev.platform_data;
#endif

	pr_err("[CHECK] pdata->gpio:%d", pdata->gpio);
	if (pdata->gpio && gpio_request(pdata->gpio, "rt8542 reset") != 0) {
		pr_err("%s: Faild to request gpio", __func__);
		pr_debug("<< %s END (error#3: -ENODEV)\n", __func__);
		return -ENODEV;
	}

	rt8542_i2c_client = i2c_dev;

	dev = kzalloc(sizeof(struct rt8542_device), GFP_KERNEL);
	if (dev == NULL) {
		dev_err(&i2c_dev->dev, "fail alloc for rt8542_device\n");
		pr_debug("<< %s END (error#4)\n", __func__);
		return 0;
	}
	main_rt8542_dev = dev;

	memset(&props, 0, sizeof(struct backlight_properties));
	props.type = BACKLIGHT_RAW;

	props.max_brightness = MAX_BRIGHTNESS_RT8542;
	bl_dev = backlight_device_register(I2C_BL_NAME, &i2c_dev->dev,
			NULL, &rt8542_bl_ops, &props);

#if defined(CONFIG_MACH_MSM8916_C30_TRF_US) || defined(CONFIG_MACH_MSM8916_C30C_TRF_US)
		if(get_lcd_id())
		{
			pr_err("<< %s TIANMA\n", __func__);
			bl_dev->props.max_brightness = MAX_BRIGHTNESS_RT8542 + 1; /* TIANMA PANEL needs max brightness value to 0x7E */
		}
		else
		{
			pr_err("<< %s BYD\n", __func__);
			bl_dev->props.max_brightness = MAX_BRIGHTNESS_RT8542;
		}
#else
	bl_dev->props.max_brightness = MAX_BRIGHTNESS_RT8542;
#endif

	bl_dev->props.brightness = DEFAULT_BRIGHTNESS;
	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->default_brightness = pdata->default_brightness;
#if defined(CONFIG_MACH_MSM8916_C30_TRF_US) || defined(CONFIG_MACH_MSM8916_C30C_TRF_US)
	if(get_lcd_id())
	{
		pr_err("<< %s TIANMA\n", __func__);
		dev->max_brightness = pdata->max_brightness + 1;  /* TIANMA PANEL needs max brightness value to 0x7E */
	}
	else
	{
		pr_err("<< %s BYD\n", __func__);
		dev->max_brightness = pdata->max_brightness;
	}
#else
	dev->max_brightness = pdata->max_brightness;
#endif
	dev->blmap_size = pdata->blmap_size;
	dev->factory_brightness = pdata->factory_brightness;

	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__);
			pr_debug("<< %s END (error#5: -ENOMEM)\n", __func__);
			return -ENOMEM;
		}
		memcpy(dev->blmap, pdata->blmap, dev->blmap_size);
	} else {
		dev->blmap = NULL;
	}

	if (gpio_get_value(dev->gpio))
		backlight_status = BL_ON;
	else
		backlight_status = POWER_OFF;

	i2c_set_clientdata(i2c_dev, dev);

	mutex_init(&dev->bl_mutex);

	err = device_create_file(&i2c_dev->dev,
			&dev_attr_rt8542_level);
	err = device_create_file(&i2c_dev->dev,
			&dev_attr_rt8542_backlight_on_off);
	err = device_create_file(&i2c_dev->dev,
			&dev_attr_rt8542_exp_min_value);
#if defined(CONFIG_BACKLIGHT_CABC_DEBUG_ENABLE)
	err = device_create_file(&i2c_dev->dev,
			&dev_attr_rt8542_pwm);
#endif

#if defined(CONFIG_BL_CURVE)
	err = device_create_file(&i2c_dev->dev, &dev_attr_i2c_bl_blmap);
#endif
	/* To reduce current consumption during booting,
	  decrease the backlight level to boot well. */
#if defined(RT8542_FLED_EN)

#ifdef FLASH_PORTING_TEMP
	//Porting Temp: build error -> comment out
	//if (lge_get_boot_mode() >= LGE_BOOT_MODE_QEM_56K)
	//	dev->default_brightness = dev->factory_brightness;
#else
	if (lge_get_boot_mode() >= LGE_BOOT_MODE_QEM_56K)
		dev->default_brightness = dev->factory_brightness;
#endif

#endif
	rt8542_backlight_on(dev->default_brightness);

#if defined(RT8542_FLED_EN)
if (!id) {
		pr_err("rt8542_probe: id is NULL");
		id = rt8542_bl_id;
	}
	return msm_flash_i2c_probe(i2c_dev, id);
#endif

	pr_debug("<< %s END (OK)\n", __func__);
	return 0;
}
static int lm3639_probe(struct i2c_client *i2c_dev,
		const struct i2c_device_id *id)
{
	struct backlight_platform_data *pdata;
	struct lm3639_device *dev;
	struct backlight_device *bl_dev;
	struct backlight_properties props;
	int err;

	pr_err("[LCD][DEBUG] %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 = lm3639_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
	if (pdata->bl_gpio && gpio_request(pdata->bl_gpio, "lm3639 en") != 0) {
		return -ENODEV;
	}

	lm3639_i2c_client = i2c_dev;

	dev = kzalloc(sizeof(struct lm3639_device), GFP_KERNEL);
	if (dev == NULL) {
		dev_err(&i2c_dev->dev, "fail alloc for lm3639_device\n");
		return 0;
	}
	main_lm3639_dev = dev;

	memset(&props, 0, sizeof(struct backlight_properties));
	props.type = BACKLIGHT_RAW;

	props.max_brightness = MAX_BRIGHTNESS_LM3639;
	bl_dev = backlight_device_register(I2C_BL_NAME, &i2c_dev->dev,
			NULL, &lm3639_bl_ops, &props);
	bl_dev->props.max_brightness = MAX_BRIGHTNESS_LM3639;
	bl_dev->props.brightness = DEFAULT_BRIGHTNESS;
	bl_dev->props.power = FB_BLANK_UNBLANK;

	dev->bl_dev = bl_dev;
	dev->client = i2c_dev;

	dev->bl_gpio = pdata->bl_gpio;
	dev->max_current = pdata->max_current;
	dev->min_brightness = pdata->min_brightness;
	dev->default_brightness = pdata->default_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;
	}

	if (gpio_get_value(dev->bl_gpio))
		backlight_status = BL_ON;
	else
		backlight_status = POWER_OFF;

	i2c_set_clientdata(i2c_dev, dev);

	mutex_init(&dev->bl_mutex);

	err = device_create_file(&i2c_dev->dev,
			&dev_attr_lm3639_level);
	err = device_create_file(&i2c_dev->dev,
			&dev_attr_lm3639_backlight_on_off);
	err = device_create_file(&i2c_dev->dev,
			&dev_attr_lm3639_exp_min_value);
#if defined(CONFIG_BACKLIGHT_CABC_DEBUG_ENABLE)
	err = device_create_file(&i2c_dev->dev,
			&dev_attr_lm3639_pwm);
#endif
	init_complete = 1;
#if defined(LM3639_FLED_EN)
if (!id) {
		pr_err("lm3639_probe: id is NULL");
		id = lm3639_bl_id;
	}
	return msm_flash_i2c_probe(i2c_dev, id);
#endif
	return 0;
}