aboutsummaryrefslogtreecommitdiffstats
path: root/packages/linux/linux-ezx-2.6.21/patches/a780-vibrator.patch
blob: aa903feea7d2d00b5d0096024143217338e06778 (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
Index: linux-2.6.21/drivers/leds/leds-a780.c
===================================================================
--- linux-2.6.21.orig/drivers/leds/leds-a780.c	2007-09-01 00:15:03.000000000 -0300
+++ linux-2.6.21/drivers/leds/leds-a780.c	2007-09-01 00:23:39.000000000 -0300
@@ -40,6 +40,17 @@
 	ezx_pcap_bit_set(PCAP_BIT_PERIPH_BL2_CTRL4, value & 0x10);
 }
 
+static void a780vibrator_set(struct led_classdev *led_cdev, enum led_brightness value)
+{
+	if (value > 4) value = 4;
+	printk( KERN_DEBUG "a780vibrator_set: %d\n", value );
+	ezx_pcap_vibrator_level(value-1);
+	if (value == 0)
+		ezx_pcap_bit_set(PCAP_BIT_AUXVREG_V_VIB_EN, 0);
+	else
+		ezx_pcap_bit_set(PCAP_BIT_AUXVREG_V_VIB_EN, 1);
+}
+
 static struct led_classdev a780_main_led = {
 	.name			= "a780:main",
 	.default_trigger	= "none",
@@ -52,11 +63,18 @@
 	.brightness_set		= a780led_aux_set,
 };
 
+static struct led_classdev a780_vibrator = {
+	.name			= "a780:vibrator",
+	.default_trigger	= "none",
+	.brightness_set		= a780vibrator_set,
+};
+
 #ifdef CONFIG_PM
 static int a780led_suspend(struct platform_device *dev, pm_message_t state)
 {
 	led_classdev_suspend(&a780_main_led);
 	led_classdev_suspend(&a780_aux_led);
+	led_classdev_suspend(&a780_vibrator);
 	return 0;
 }
 
@@ -64,6 +82,7 @@
 {
 	led_classdev_resume(&a780_main_led);
 	led_classdev_resume(&a780_aux_led);
+	led_classdev_resume(&a780_vibrator);
 	return 0;
 }
 #endif
@@ -77,8 +96,16 @@
 		return ret;
 
 	ret = led_classdev_register(&pdev->dev, &a780_aux_led);
-	if (ret < 0)
+	if (ret < 0) {
+		led_classdev_unregister(&a780_main_led);
+		return ret;
+	}
+
+	ret = led_classdev_register(&pdev->dev, &a780_vibrator);
+	if (ret < 0) {
 		led_classdev_unregister(&a780_main_led);
+		led_classdev_unregister(&a780_aux_led);
+	}
 
 	return ret;
 }
@@ -87,6 +114,7 @@
 {
 	led_classdev_unregister(&a780_main_led);
 	led_classdev_unregister(&a780_aux_led);
+	led_classdev_unregister(&a780_vibrator);
 	return 0;
 }
 
@@ -111,6 +139,7 @@
 {
 	a780led_main_set( &a780_main_led, 0 );
 	a780led_aux_set( &a780_aux_led, 0 );
+	a780vibrator_set( &a780_vibrator, 0 );
 	platform_driver_unregister(&a780led_driver);
 }
 
Index: linux-2.6.21/drivers/leds/Kconfig
===================================================================
--- linux-2.6.21.orig/drivers/leds/Kconfig	2007-09-01 00:15:03.000000000 -0300
+++ linux-2.6.21/drivers/leds/Kconfig	2007-09-01 00:15:08.000000000 -0300
@@ -105,11 +105,11 @@
 	  be configured via sysfs. If unsure, say Y.
 
 config LEDS_A780
-	tristate "LED Support for the Motorola A780 GSM Phone"
+	tristate "LED/Vibrator Support for the Motorola A780 GSM Phone"
 	depends LEDS_CLASS && PXA_EZX_A780
 	help
-	  This option enables support for the LEDs on the
-	  Motorola A780 GSM Phone.
+	  This option enables support for the LEDs and the
+	  vibrator on the Motorola A780 GSM Phone.
 
 config LEDS_E680
 	tristate "LED Support for the Motorola E680(i) GSM Phone"