コード例 #1
0
ファイル: hub_aat2862.c プロジェクト: kapoloclubs/diana
static int __init aat2862_probe(struct i2c_client *i2c_dev, const struct i2c_device_id *id)
{
	struct aat2862_device *dev;
	struct backlight_device *bl_dev;
	int err;

	printk(KERN_INFO"%s: i2c probe start\n", __func__);

	aat2862_i2c_client = i2c_dev;

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

	main_aat2862_dev = dev;

	bl_dev = backlight_device_register(HUB_I2C_BL_NAME, &i2c_dev->dev, NULL, &hub_bl_ops);
	bl_dev->props.max_brightness = MAX_BRIGHTNESS;
	bl_dev->props.brightness = DEFAULT_BRIGHTNESS;
	bl_dev->props.power = FB_BLANK_UNBLANK;
	
	dev->bl_dev = bl_dev;
	dev->client = i2c_dev;
	i2c_set_clientdata(i2c_dev, dev);

/* LGE_CHANGE_S [[email protected]] 2010-03-16, for prevent display flicker*/
	//aat2862_init(i2c_dev);
/* LGE_CHANGE_S [[email protected]] 2010-03-16, for prevent display flicker*/

// 20100717 [email protected] power sequence for touch [START_LGE]
	aat2862_touch_ldo_enable(i2c_dev, 1);
// 20100717 [email protected] power sequence for touch [END_LGE]

	led_classdev_register(&i2c_dev->dev, &lcd_backlight);

	aat2862_set_main_current_level(i2c_dev, DEFAULT_BRIGHTNESS); 
	err = device_create_file(&i2c_dev->dev, &dev_attr_level);
	err = device_create_file(&i2c_dev->dev, &dev_attr_backlight_on_off);//20100825 [email protected] for test_mode
	err = device_create_file(&i2c_dev->dev, &dev_attr_gpio_test);//20100907 [email protected] for gpio_test

//20100709 [email protected] early_suspend [START_LGE]
#ifdef CONFIG_HAS_EARLYSUSPEND
    dev->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN;
    dev->early_suspend.suspend = aat2862_early_suspend;
    dev->early_suspend.resume = aat2862_late_resume;
    register_early_suspend(&dev->early_suspend);
#endif
//20100709 [email protected] early_suspend [END_LGE]
	gpio_request(LCD_CP_EN, "LCD_CP_EN");
/*LGE_START_S [email protected] for touch key led*/
	TOUCH_KEY_BL_INIT();
	TOUCH_KEY_BL_ON();
/*LGE_START_E [email protected] for touch key led*/

	return 0;
}
コード例 #2
0
ファイル: hub_aat2862.c プロジェクト: kapoloclubs/diana
static int aat2862_suspend(struct i2c_client *client, pm_message_t state)
{
	printk(KERN_INFO"%s: new state: %d\n",__func__, state.event);

	client->dev.power.power_state = state;
	
// 20100717 [email protected] power sequence for touch [START_LGE]
	aat2862_touch_ldo_enable(client, 0);
	mdelay(5);
// 20100717 [email protected] power sequence for touch [END_LGE]

	aat2862_write_reg(client, LDO_ABCD_EN_REG, 0x00);

	gpio_direction_output(LCD_CP_EN, 0);

	return 0;
}
コード例 #3
0
static int aat2862_suspend(struct i2c_client *client, pm_message_t state)
{
	//printk(KERN_INFO"%s: new state: %d\n",__func__, state.event);

	// 20100630 [email protected] Hub touchscreen power sequence [START_LGE]
	aat2862_touch_ldo_enable(client, 0);
	// 20100630 [email protected] Hub touchscreen power sequence [END_LGE]

	// 20101016 [email protected] Turn off unnecessary modules upon BL off [START_LGE]
#if 0	// Followings reduces around 20uA.
	gpio_direction_output(MY_HDMI_REG_EN, 0);
	gpio_set_value(MY_HDMI_REG_EN, 0);
	gpio_direction_output(MY_CAM_SUBPM_EN, 0);
	gpio_set_value(MY_CAM_SUBPM_EN, 0);
	gpio_direction_output(MY_CAM_VCM_EN, 0);
	gpio_set_value(MY_CAM_VCM_EN, 0);
	gpio_direction_output(MY_DMB_EN, 0);
	gpio_set_value(MY_DMB_EN, 0);
	gpio_direction_output(MY_MOTION_INT, 0);
	gpio_direction_output(MY_COM_INT, 0);
#endif
#if 0	// Followings reduces around 60uA.
	i2c3_scl = omap_readw(0x480021C2);	// sookyoung.kim	
	i2c3_sda = omap_readw(0x480021C4);	// sookyoung.kim	
	omap_writew(0x0000, 0x480021C2);	// sookyoung.kim	
	omap_writew(0x0000, 0x480021C4);	// sookyoung.kim	
#endif
#if 0	// Followings, coupled with memory refresh rate control, reduces around 600uA.
	i2c4_scl = omap_readw(0x48002A00);	// sookyoung.kim	
	i2c4_sda = omap_readw(0x48002A02);	// sookyoung.kim	
	omap_writew(0x0000, 0x48002A00);	// sookyoung.kim	
	omap_writew(0x0000, 0x48002A02);	// sookyoung.kim	
#endif
	// 20101016 [email protected] Turn off unnecessary modules upon BL off [END_LGE]


	client->dev.power.power_state = state;

	aat2862_write_reg(client, 0x02, 0x00);

	gpio_direction_output(MY_LCD_CP_EN, 0);
	gpio_set_value(MY_LCD_CP_EN, 0);

	return 0;
}
コード例 #4
0
static int aat2862_resume(struct i2c_client *client)
{
	aat2862_init(client);
	//printk(KERN_INFO"%s: old state: %d\n",__func__, client->dev.power.power_state.event);
	client->dev.power.power_state = PMSG_ON;
	// 20100525 [email protected] Patch for touch/panel resumption failure [START_LGE]
	aat2862_write_reg(client, 0x00, 0x4C);
	aat2862_write_reg(client, 0x01, 0x49);
	// 20100525 [email protected] Patch for touch/panel resumption failure [END_LGE]
	aat2862_write_reg(client, 0x02, 0x03);
	mdelay(10);

	// 20101016 [email protected] Turn off unnecessary modules upon BL off [START_LGE]
#if 0	// Following reduces around 20uA.
	gpio_direction_output(MY_HDMI_REG_EN, 1);
	gpio_set_value(MY_HDMI_REG_EN, 1);
	gpio_direction_output(MY_CAM_SUBPM_EN, 1);
	gpio_set_value(MY_CAM_SUBPM_EN, 1);
	gpio_direction_output(MY_CAM_VCM_EN, 1);
	gpio_set_value(MY_CAM_VCM_EN, 1);
	gpio_direction_output(MY_DMB_EN, 1);
	gpio_set_value(MY_DMB_EN, 1);
	gpio_direction_input(MY_MOTION_INT);
	gpio_direction_input(MY_COM_INT);
#endif
#if 0	// Followings reduces around 60uA.
	omap_writew(i2c3_scl, 0x480021C2);	// sookyoung.kim	
	omap_writew(i2c3_sda, 0x480021C4);	// sookyoung.kim	
#endif
#if 0	// Followings, coupled with memory refresh rate control, reduces around 600uA.
	omap_writew(i2c4_scl, 0x48002A00);	// sookyoung.kim	
	omap_writew(i2c4_sda, 0x48002A02);	// sookyoung.kim	
#endif
	// 20101016 [email protected] Turn off unnecessary modules upon BL off [END_LGE]

	// 20100630 [email protected] Hub touchscreen power sequence [START_LGE]
	aat2862_touch_ldo_enable(client, 1);
	// 20100630 [email protected] Hub touchscreen power sequence [END_LGE]	

	//aat2862_backlight_on();

	return 0;
}
コード例 #5
0
ファイル: hub_aat2862.c プロジェクト: kapoloclubs/diana
static int aat2862_resume(struct i2c_client *client)
{
	aat2862_init(client);
	printk(KERN_INFO"%s: old state: %d\n",__func__, client->dev.power.power_state.event);
	client->dev.power.power_state = PMSG_ON;
	// 20100525 [email protected] Patch for touch/panel resumption failure [START_LGE]
	aat2862_write_reg(client, LDO_AB_LEVEL_REG, 0x4C);
	aat2862_write_reg(client, LDO_CD_LEVEL_REG, 0x4C);
	// 20100525 [email protected] Patch for touch/panel resumption failure [END_LGE]
	
// 20100717 [email protected] power sequence for touch [START_LGE]
	aat2862_write_reg(client, LDO_ABCD_EN_REG, 0x03);
	mdelay(5);
	aat2862_touch_ldo_enable(client, 1);
// 20100717 [email protected] power sequence for touch [END_LGE]	
//	aat2862_write_reg(client, LDO_ABCD_EN_REG, 0x0F);
//	mdelay(10);
	//aat2862_backlight_on();

	return 0;
}
コード例 #6
0
static int __init aat2862_probe(struct i2c_client *i2c_dev, const struct i2c_device_id *id)
{
	struct aat2862_device *dev;
	struct backlight_device *bl_dev;
	struct backlight_properties props;   // hjpark 20110427	
	int err;

	printk(KERN_INFO"%s: i2c probe start\n", __func__);

// 20100810 [email protected] GPIO Initialization [START_LGE]
	omap_mux_init_gpio(MY_LCD_CP_EN, OMAP_PIN_OUTPUT);
	err = gpio_request(MY_LCD_CP_EN, "lcd_cp_en");
	if(err < 0) {	
		printk("can't get hub lcd cp enable GPIO\n");
		kzfree(dev);
		return -ENOSYS;
	}
	err = gpio_direction_output(MY_LCD_CP_EN, 1);	
	gpio_set_value(MY_LCD_CP_EN, 1);
	

	omap_mux_init_gpio(MY_TOUCH_I2C2_SW, OMAP_PIN_OUTPUT);
	err = gpio_request(MY_TOUCH_I2C2_SW, "touch_i2c2_sw");
	if(err < 0) {	
		printk("can't get hub touch i2c2 sw enable GPIO\n");
		kzfree(dev);
		return -ENOSYS;
	}
	err = gpio_direction_output(MY_TOUCH_I2C2_SW, 0);	
	gpio_set_value(MY_TOUCH_I2C2_SW, 0);

	aat2862_touch_ldo_enable(i2c_dev, 1);
// 20100810 [email protected] GPIO Initialization [END_LGE]	

	aat2862_i2c_client = i2c_dev;

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

	main_aat2862_dev = dev;

#if 0 // froyo k32 origin
	bl_dev = backlight_device_register(HUB_I2C_BL_NAME, &i2c_dev->dev, NULL, &hub_bl_ops);
#else
	bl_dev = backlight_device_register(HUB_I2C_BL_NAME, &i2c_dev->dev, NULL, &hub_bl_ops, &props);
#endif 
	bl_dev->props.max_brightness = MAX_BRIGHTNESS;
	bl_dev->props.brightness = DEFAULT_BRIGHTNESS;
	bl_dev->props.power = FB_BLANK_UNBLANK;
	
	dev->bl_dev = bl_dev;
	dev->client = i2c_dev;
	i2c_set_clientdata(i2c_dev, dev);

/* LGE_CHANGE_S [[email protected]] 2010-03-16, for prevent display flicker*/
	//aat2862_init(i2c_dev);
/* LGE_CHANGE_S [[email protected]] 2010-03-16, for prevent display flicker*/

	led_classdev_register(&i2c_dev->dev, &lcd_backlight);

	aat2862_set_main_current_level(i2c_dev, DEFAULT_BRIGHTNESS); 
	err = device_create_file(&i2c_dev->dev, &dev_attr_level);
	err = device_create_file(&i2c_dev->dev, &dev_attr_backlight_on_off);//20100825 [email protected] for test_mode

//20100709 [email protected] early_suspend [START_LGE]
#ifdef CONFIG_HAS_EARLYSUSPEND
    dev->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN;
    dev->early_suspend.suspend = aat2862_early_suspend;
    dev->early_suspend.resume = aat2862_late_resume;
    register_early_suspend(&dev->early_suspend);
#endif
//20100709 [email protected] early_suspend [END_LGE]

	return 0;
}