summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-rp-2.6.24/tosa/tosa-bl-fixup.diff
blob: c4a23d1f49e2399d339a3963dd02e14192b2e3a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
Index: linux-2.6.24/drivers/video/backlight/tosa_bl.c
===================================================================
--- linux-2.6.24.orig/drivers/video/backlight/tosa_bl.c	2008-11-15 22:59:51.592985003 +0300
+++ linux-2.6.24/drivers/video/backlight/tosa_bl.c	2008-11-18 04:08:13.021416618 +0300
@@ -76,6 +76,8 @@ static void pxa_nssp_output(struct tosa_

 static void tosa_set_backlight(struct tosa_bl_data *data, int brightness)
 {
+	pr_debug("tosa_set_backlight\n");
+
	/* SetBacklightDuty */
	i2c_smbus_write_byte_data(&data->client, DAC_CH2, (unsigned char)brightness);

@@ -91,7 +93,7 @@ static void tosa_set_backlight(struct to

 static void tosa_lcd_tg_init(struct tosa_bl_data *data)
 {
-	dev_dbg(&data->bl_dev->dev, "tosa_lcd_init\n");
+	pr_debug("tosa_lcd_init\n");

	/* L3V On */
	set_scoop_gpio( &tosascoop_jc_device.dev,TOSA_SCOOP_JC_TC6393XB_L3V_ON);
@@ -116,7 +118,7 @@ static void tosa_lcd_tg_on(struct tosa_b

	tosa_lcd_tg_init(data);

-	dev_dbg(&data->bl_dev->dev, "tosa_lcd_on: %04x (%d)\n", value, mode->yres);
+	pr_debug("tosa_lcd_on: %04x (%d)\n", value, mode->yres);
	pxa_nssp_output(data, TG_PNLCTL, value);

	/* TG LCD pannel power up */
@@ -129,12 +131,15 @@ static void tosa_lcd_tg_on(struct tosa_b

	/* set common voltage */
	i2c_smbus_write_byte_data(&data->client, DAC_CH1, data->comadj);
+
+	tosa_set_backlight(data, data->bl_dev->props.brightness);
+
 }

 static void tosa_lcd_tg_off(struct tosa_bl_data *data)
 {
	tosa_set_backlight(data, 0);
-	dev_dbg(&data->bl_dev->dev, "tosa_lcd_off\n");
+	pr_debug("tosa_lcd_off\n");
	/* TG LCD VHSA off */
	pxa_nssp_output(data, TG_PINICTL,0x4);
	mdelay(50);
@@ -158,8 +163,6 @@ static int tosa_bl_update_status(struct
	struct tosa_bl_data *data = dev_get_drvdata(&dev->dev);
	int new_power = max(props->power, props->fb_blank);

-	tosa_set_backlight(data, props->brightness);
-
	if (new_power)
		tosa_lcd_tg_off(data);
	else
@@ -223,22 +226,26 @@ static int tosa_bl_detect_client(struct

	err = gpio_request(TOSA_TC6393XB_BL_C20MA, "backlight");
	if (err) {
-		dev_dbg(&data->bl_dev->dev, "Unable to request gpio!\n");
+		printk(KERN_ERR "tosa-bl; Unable to request gpio!\n");
		goto err_gpio_bl;
	}

	err = gpio_request(TOSA_TC6393XB_TG_ON, "tg");
	if (err) {
-		dev_dbg(&data->bl_dev->dev, "Unable to request gpio!\n");
+		printk(KERN_ERR "tosa-bl: Unable to request gpio!\n");
		goto err_gpio_tg;
	}

	err = ssp_init(&data->nssp_dev,2,0);
	if (err) {
-		dev_err(&data->bl_dev->dev, "Unable to register NSSP handler!\n");
+		printk(KERN_ERR "tosa-bl: Unable to register NSSP handler!\n");
		goto err_ssp_init;
	}

+	pxa_gpio_mode(GPIO83_NSSP_TX);
+	pxa_gpio_mode(GPIO81_NSSP_CLK_OUT);
+	pxa_gpio_mode(GPIO82_NSSP_FRM_OUT);
+
	/* Tell the i2c layer a new client has arrived */
	err = i2c_attach_client(client);
	if (err)
@@ -269,7 +276,6 @@ static int tosa_bl_detect_client(struct
 err_fb_register:
	backlight_device_unregister(data->bl_dev);
 err_bl_register:
-	tosa_set_backlight(data, 0);
	tosa_lcd_tg_off(data);

	err = i2c_detach_client(client);
@@ -296,7 +302,6 @@ static int tosa_bl_detach_client(struct

	backlight_device_unregister(data->bl_dev);

-	tosa_set_backlight(data, 0);
	tosa_lcd_tg_off(data);

	/* Try to detach the client from i2c space */