conf/distro/jlime-donkey.conf : Added parted & Dialog to distro_rdepends
[vuplus_openembedded] / packages / linux / linux-openzaurus-2.6.18+git / tosa-lcdnoise-r1.patch
1 Index: linux-2.6.18/arch/arm/mach-pxa/tosa.c
2 ===================================================================
3 --- linux-2.6.18.orig/arch/arm/mach-pxa/tosa.c  2006-09-20 17:14:14.000000000 +0200
4 +++ linux-2.6.18/arch/arm/mach-pxa/tosa.c       2006-09-20 17:14:43.000000000 +0200
5 @@ -2,6 +2,7 @@
6   *  Support for Sharp SL-C6000x PDAs
7   *  Model: (Tosa)
8   *
9 + *  Copyright (c) 2006 Wolfson Microelectronics PLC.
10   *  Copyright (c) 2005 Dirk Opfer
11   *
12   *     Based on code written by Sharp/Lineo for 2.4 kernels
13 @@ -47,6 +48,8 @@
14  #include <asm/hardware/tmio.h>
15  #include <asm/mach/sharpsl_param.h>
16  
17 +#include <linux/wm97xx.h>
18 +
19  #include "generic.h"
20  
21  /*
22 @@ -429,6 +432,16 @@
23      },
24  };
25  
26 +
27 +/*
28 + * Tosa Touchscreen device
29 + */
30 +
31 +static struct wm97xx_machinfo tosa_ts_machinfo = {
32 +    .get_hsync_time   = tosa_get_hsync_time,
33 +    .wait_hsync       = tosa_wait_hsync,
34 +};
35 +
36  /*
37   * Tosa Blueooth
38   */
39 @@ -458,6 +471,7 @@
40         GPSR(TOSA_GPIO_ON_RESET) = GPIO_bit(TOSA_GPIO_ON_RESET);
41  
42         mdelay(1000);
43 +       wm97xx_unset_machinfo();
44         arm_machine_restart('h');
45  }
46  
47 @@ -503,6 +517,8 @@
48         platform_scoop_config = &tosa_pcmcia_config;
49  
50         platform_add_devices(devices, ARRAY_SIZE(devices));
51 +
52 +    wm97xx_set_machinfo(&tosa_ts_machinfo);
53  }
54  
55  static void __init fixup_tosa(struct machine_desc *desc,
56 Index: linux-2.6.18/arch/arm/mach-pxa/tosa_lcd.c
57 ===================================================================
58 --- linux-2.6.18.orig/arch/arm/mach-pxa/tosa_lcd.c      2006-09-20 17:14:14.000000000 +0200
59 +++ linux-2.6.18/arch/arm/mach-pxa/tosa_lcd.c   2006-09-20 17:14:15.000000000 +0200
60 @@ -1,6 +1,7 @@
61  /*
62   *  LCD / Backlight control code for Sharp SL-6000x (tosa)
63   *
64 + *  Copyright (c) 2006      Wolfson Microelectronics PLC.
65   *  Copyright (c) 2005         Dirk Opfer
66   *
67   *  This program is free software; you can redistribute it and/or modify
68 @@ -59,6 +60,8 @@
69  static struct ssp_dev tosa_nssp_dev;
70  static struct ssp_state tosa_nssp_state;
71  static spinlock_t tosa_nssp_lock;
72 +static int blanked;
73 +static unsigned long hsync_time;
74  
75  static unsigned short normal_i2c[] = {
76         DAC_BASE,
77 @@ -130,6 +133,17 @@
78         pxa_nssp_output(TG_GPOSR,0x02);         /* GPOS0=powercontrol, GPOS1=GPIO, GPOS2=TCTL */
79  }
80  
81 +static unsigned long calc_hsync_time(const struct fb_videomode *mode) {
82 +    /* The 25 and 44 'magic numbers' are from Sharp's 2.4 patches */
83 +    if (mode->yres == 640) {
84 +        return 25;
85 +    }
86 +    if (mode->yres == 320) {
87 +        return 44;
88 +    }
89 +    return 0;
90 +}
91 +
92  static void tosa_lcd_tg_on(struct device *dev, const struct fb_videomode *mode)
93  {
94         const int value = TG_REG0_COLOR | TG_REG0_UD | TG_REG0_LR;
95 @@ -154,6 +168,8 @@
96                 /* set common voltage */
97                 i2c_smbus_write_byte_data(tosa_i2c_dac, DAC_CH1, comadj);
98  
99 +    blanked = 0;
100 +    hsync_time = calc_hsync_time(mode);
101  }
102  
103  static void tosa_lcd_tg_off(struct device *dev)
104 @@ -172,6 +188,8 @@
105         
106         /* L3V Off */
107         reset_scoop_gpio( &tosascoop_jc_device.dev,TOSA_SCOOP_JC_TC3693_L3V_ON); 
108 +
109 +    blanked = 1;
110  }
111  
112  static int tosa_detect_client(struct i2c_adapter* adapter, int address, int kind) {
113 @@ -238,6 +256,23 @@
114         return 0;
115  }
116  
117 +unsigned long tosa_get_hsync_time(void)
118 +{
119 +/* This method should eventually contain the correct algorithm for calculating
120 +   the hsync_time */
121 +    if (blanked)
122 +        return 0;
123 +    else
124 +        return hsync_time;
125 +}
126 +
127 +void tosa_wait_hsync(void)
128 +{
129 +    /* Waits for a rising edge on the VGA line */
130 +    while((GPLR(TOSA_GPIO_VGA_LINE) & GPIO_bit(TOSA_GPIO_VGA_LINE)) == 0);
131 +    while((GPLR(TOSA_GPIO_VGA_LINE) & GPIO_bit(TOSA_GPIO_VGA_LINE)) != 0);
132 +}
133 +
134  static struct i2c_driver tosa_driver={
135         .id             = TOSA_LCD_I2C_DEVICEID,
136         .attach_adapter = tosa_attach_adapter,
137 Index: linux-2.6.18/include/asm-arm/arch-pxa/tosa.h
138 ===================================================================
139 --- linux-2.6.18.orig/include/asm-arm/arch-pxa/tosa.h   2006-09-20 17:14:13.000000000 +0200
140 +++ linux-2.6.18/include/asm-arm/arch-pxa/tosa.h        2006-09-20 17:14:15.000000000 +0200
141 @@ -1,6 +1,7 @@
142  /*
143   * Hardware specific definitions for Sharp SL-C6000x series of PDAs
144   *
145 + * Copyright (c) 2006 Wolfson Microelectronics PLC.
146   * Copyright (c) 2005 Dirk Opfer
147   *
148   * Based on Sharp's 2.4 kernel patches
149 @@ -187,4 +188,8 @@
150  extern struct platform_device tosascoop_jc_device;
151  extern struct platform_device tosascoop_device;
152  extern struct platform_device tc6393_device;
153 +
154 +unsigned long tosa_get_hsync_time(void);
155 +void tosa_wait_hsync(void);
156 +
157  #endif /* _ASM_ARCH_TOSA_H_ */