aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/common/locomo.c32
-rw-r--r--arch/arm/mach-sa1100/collie.c23
-rw-r--r--drivers/video/backlight/locomolcd.c30
-rw-r--r--include/asm-arm/hardware/locomo.h9
4 files changed, 52 insertions, 42 deletions
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index 4e0dcaef6eb2..c46dc65ec79a 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -814,12 +814,15 @@ static inline struct locomo *locomo_chip_driver(struct locomo_dev *ldev)
814 return (struct locomo *)dev_get_drvdata(ldev->dev.parent); 814 return (struct locomo *)dev_get_drvdata(ldev->dev.parent);
815} 815}
816 816
817void locomo_gpio_set_dir(struct locomo_dev *ldev, unsigned int bits, unsigned int dir) 817void locomo_gpio_set_dir(struct device *dev, unsigned int bits, unsigned int dir)
818{ 818{
819 struct locomo *lchip = locomo_chip_driver(ldev); 819 struct locomo *lchip = dev_get_drvdata(dev);
820 unsigned long flags; 820 unsigned long flags;
821 unsigned int r; 821 unsigned int r;
822 822
823 if (!lchip)
824 return;
825
823 spin_lock_irqsave(&lchip->lock, flags); 826 spin_lock_irqsave(&lchip->lock, flags);
824 827
825 r = locomo_readl(lchip->base + LOCOMO_GPD); 828 r = locomo_readl(lchip->base + LOCOMO_GPD);
@@ -836,12 +839,15 @@ void locomo_gpio_set_dir(struct locomo_dev *ldev, unsigned int bits, unsigned in
836 spin_unlock_irqrestore(&lchip->lock, flags); 839 spin_unlock_irqrestore(&lchip->lock, flags);
837} 840}
838 841
839unsigned int locomo_gpio_read_level(struct locomo_dev *ldev, unsigned int bits) 842int locomo_gpio_read_level(struct device *dev, unsigned int bits)
840{ 843{
841 struct locomo *lchip = locomo_chip_driver(ldev); 844 struct locomo *lchip = dev_get_drvdata(dev);
842 unsigned long flags; 845 unsigned long flags;
843 unsigned int ret; 846 unsigned int ret;
844 847
848 if (!lchip)
849 return -ENODEV;
850
845 spin_lock_irqsave(&lchip->lock, flags); 851 spin_lock_irqsave(&lchip->lock, flags);
846 ret = locomo_readl(lchip->base + LOCOMO_GPL); 852 ret = locomo_readl(lchip->base + LOCOMO_GPL);
847 spin_unlock_irqrestore(&lchip->lock, flags); 853 spin_unlock_irqrestore(&lchip->lock, flags);
@@ -850,12 +856,15 @@ unsigned int locomo_gpio_read_level(struct locomo_dev *ldev, unsigned int bits)
850 return ret; 856 return ret;
851} 857}
852 858
853unsigned int locomo_gpio_read_output(struct locomo_dev *ldev, unsigned int bits) 859int locomo_gpio_read_output(struct device *dev, unsigned int bits)
854{ 860{
855 struct locomo *lchip = locomo_chip_driver(ldev); 861 struct locomo *lchip = dev_get_drvdata(dev);
856 unsigned long flags; 862 unsigned long flags;
857 unsigned int ret; 863 unsigned int ret;
858 864
865 if (!lchip)
866 return -ENODEV;
867
859 spin_lock_irqsave(&lchip->lock, flags); 868 spin_lock_irqsave(&lchip->lock, flags);
860 ret = locomo_readl(lchip->base + LOCOMO_GPO); 869 ret = locomo_readl(lchip->base + LOCOMO_GPO);
861 spin_unlock_irqrestore(&lchip->lock, flags); 870 spin_unlock_irqrestore(&lchip->lock, flags);
@@ -864,12 +873,15 @@ unsigned int locomo_gpio_read_output(struct locomo_dev *ldev, unsigned int bits)
864 return ret; 873 return ret;
865} 874}
866 875
867void locomo_gpio_write(struct locomo_dev *ldev, unsigned int bits, unsigned int set) 876void locomo_gpio_write(struct device *dev, unsigned int bits, unsigned int set)
868{ 877{
869 struct locomo *lchip = locomo_chip_driver(ldev); 878 struct locomo *lchip = dev_get_drvdata(dev);
870 unsigned long flags; 879 unsigned long flags;
871 unsigned int r; 880 unsigned int r;
872 881
882 if (!lchip)
883 return;
884
873 spin_lock_irqsave(&lchip->lock, flags); 885 spin_lock_irqsave(&lchip->lock, flags);
874 886
875 r = locomo_readl(lchip->base + LOCOMO_GPO); 887 r = locomo_readl(lchip->base + LOCOMO_GPO);
@@ -1058,9 +1070,9 @@ void locomo_frontlight_set(struct locomo_dev *dev, int duty, int vr, int bpwf)
1058 struct locomo *lchip = locomo_chip_driver(dev); 1070 struct locomo *lchip = locomo_chip_driver(dev);
1059 1071
1060 if (vr) 1072 if (vr)
1061 locomo_gpio_write(dev, LOCOMO_GPIO_FL_VR, 1); 1073 locomo_gpio_write(dev->dev.parent, LOCOMO_GPIO_FL_VR, 1);
1062 else 1074 else
1063 locomo_gpio_write(dev, LOCOMO_GPIO_FL_VR, 0); 1075 locomo_gpio_write(dev->dev.parent, LOCOMO_GPIO_FL_VR, 0);
1064 1076
1065 spin_lock_irqsave(&lchip->lock, flags); 1077 spin_lock_irqsave(&lchip->lock, flags);
1066 locomo_writel(bpwf, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS); 1078 locomo_writel(bpwf, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS);
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index a0dfa390e34b..6496eb645cee 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -91,30 +91,29 @@ static struct mcp_plat_data collie_mcp_data = {
91/* 91/*
92 * low-level UART features. 92 * low-level UART features.
93 */ 93 */
94static struct locomo_dev *uart_dev = NULL; 94struct platform_device collie_locomo_device;
95 95
96static void collie_uart_set_mctrl(struct uart_port *port, u_int mctrl) 96static void collie_uart_set_mctrl(struct uart_port *port, u_int mctrl)
97{ 97{
98 if (!uart_dev) return;
99
100 if (mctrl & TIOCM_RTS) 98 if (mctrl & TIOCM_RTS)
101 locomo_gpio_write(uart_dev, LOCOMO_GPIO_RTS, 0); 99 locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_RTS, 0);
102 else 100 else
103 locomo_gpio_write(uart_dev, LOCOMO_GPIO_RTS, 1); 101 locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_RTS, 1);
104 102
105 if (mctrl & TIOCM_DTR) 103 if (mctrl & TIOCM_DTR)
106 locomo_gpio_write(uart_dev, LOCOMO_GPIO_DTR, 0); 104 locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_DTR, 0);
107 else 105 else
108 locomo_gpio_write(uart_dev, LOCOMO_GPIO_DTR, 1); 106 locomo_gpio_write(&collie_locomo_device.dev, LOCOMO_GPIO_DTR, 1);
109} 107}
110 108
111static u_int collie_uart_get_mctrl(struct uart_port *port) 109static u_int collie_uart_get_mctrl(struct uart_port *port)
112{ 110{
113 int ret = TIOCM_CD; 111 int ret = TIOCM_CD;
114 unsigned int r; 112 unsigned int r;
115 if (!uart_dev) return ret;
116 113
117 r = locomo_gpio_read_output(uart_dev, LOCOMO_GPIO_CTS & LOCOMO_GPIO_DSR); 114 r = locomo_gpio_read_output(&collie_locomo_device.dev, LOCOMO_GPIO_CTS & LOCOMO_GPIO_DSR);
115 if (r == -ENODEV)
116 return ret;
118 if (r & LOCOMO_GPIO_CTS) 117 if (r & LOCOMO_GPIO_CTS)
119 ret |= TIOCM_CTS; 118 ret |= TIOCM_CTS;
120 if (r & LOCOMO_GPIO_DSR) 119 if (r & LOCOMO_GPIO_DSR)
@@ -130,13 +129,11 @@ static struct sa1100_port_fns collie_port_fns __initdata = {
130 129
131static int collie_uart_probe(struct locomo_dev *dev) 130static int collie_uart_probe(struct locomo_dev *dev)
132{ 131{
133 uart_dev = dev;
134 return 0; 132 return 0;
135} 133}
136 134
137static int collie_uart_remove(struct locomo_dev *dev) 135static int collie_uart_remove(struct locomo_dev *dev)
138{ 136{
139 uart_dev = NULL;
140 return 0; 137 return 0;
141} 138}
142 139
@@ -170,7 +167,7 @@ static struct resource locomo_resources[] = {
170 }, 167 },
171}; 168};
172 169
173static struct platform_device locomo_device = { 170struct platform_device collie_locomo_device = {
174 .name = "locomo", 171 .name = "locomo",
175 .id = 0, 172 .id = 0,
176 .num_resources = ARRAY_SIZE(locomo_resources), 173 .num_resources = ARRAY_SIZE(locomo_resources),
@@ -178,7 +175,7 @@ static struct platform_device locomo_device = {
178}; 175};
179 176
180static struct platform_device *devices[] __initdata = { 177static struct platform_device *devices[] __initdata = {
181 &locomo_device, 178 &collie_locomo_device,
182 &colliescoop_device, 179 &colliescoop_device,
183}; 180};
184 181
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c
index caf1eca199b0..628571c63bac 100644
--- a/drivers/video/backlight/locomolcd.c
+++ b/drivers/video/backlight/locomolcd.c
@@ -33,19 +33,19 @@ static unsigned long locomolcd_flags;
33 33
34static void locomolcd_on(int comadj) 34static void locomolcd_on(int comadj)
35{ 35{
36 locomo_gpio_set_dir(locomolcd_dev, LOCOMO_GPIO_LCD_VSHA_ON, 0); 36 locomo_gpio_set_dir(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VSHA_ON, 0);
37 locomo_gpio_write(locomolcd_dev, LOCOMO_GPIO_LCD_VSHA_ON, 1); 37 locomo_gpio_write(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VSHA_ON, 1);
38 mdelay(2); 38 mdelay(2);
39 39
40 locomo_gpio_set_dir(locomolcd_dev, LOCOMO_GPIO_LCD_VSHD_ON, 0); 40 locomo_gpio_set_dir(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VSHD_ON, 0);
41 locomo_gpio_write(locomolcd_dev, LOCOMO_GPIO_LCD_VSHD_ON, 1); 41 locomo_gpio_write(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VSHD_ON, 1);
42 mdelay(2); 42 mdelay(2);
43 43
44 locomo_m62332_senddata(locomolcd_dev, comadj, 0); 44 locomo_m62332_senddata(locomolcd_dev, comadj, 0);
45 mdelay(5); 45 mdelay(5);
46 46
47 locomo_gpio_set_dir(locomolcd_dev, LOCOMO_GPIO_LCD_VEE_ON, 0); 47 locomo_gpio_set_dir(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VEE_ON, 0);
48 locomo_gpio_write(locomolcd_dev, LOCOMO_GPIO_LCD_VEE_ON, 1); 48 locomo_gpio_write(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VEE_ON, 1);
49 mdelay(10); 49 mdelay(10);
50 50
51 /* TFTCRST | CPSOUT=0 | CPSEN */ 51 /* TFTCRST | CPSOUT=0 | CPSEN */
@@ -58,8 +58,8 @@ static void locomolcd_on(int comadj)
58 locomo_writel((0x04 | 0x01), locomolcd_dev->mapbase + LOCOMO_TC); 58 locomo_writel((0x04 | 0x01), locomolcd_dev->mapbase + LOCOMO_TC);
59 mdelay(10); 59 mdelay(10);
60 60
61 locomo_gpio_set_dir(locomolcd_dev, LOCOMO_GPIO_LCD_MOD, 0); 61 locomo_gpio_set_dir(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_MOD, 0);
62 locomo_gpio_write(locomolcd_dev, LOCOMO_GPIO_LCD_MOD, 1); 62 locomo_gpio_write(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_MOD, 1);
63} 63}
64 64
65static void locomolcd_off(int comadj) 65static void locomolcd_off(int comadj)
@@ -68,16 +68,16 @@ static void locomolcd_off(int comadj)
68 locomo_writel(0x06, locomolcd_dev->mapbase + LOCOMO_TC); 68 locomo_writel(0x06, locomolcd_dev->mapbase + LOCOMO_TC);
69 mdelay(1); 69 mdelay(1);
70 70
71 locomo_gpio_write(locomolcd_dev, LOCOMO_GPIO_LCD_VSHA_ON, 0); 71 locomo_gpio_write(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VSHA_ON, 0);
72 mdelay(110); 72 mdelay(110);
73 73
74 locomo_gpio_write(locomolcd_dev, LOCOMO_GPIO_LCD_VEE_ON, 0); 74 locomo_gpio_write(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VEE_ON, 0);
75 mdelay(700); 75 mdelay(700);
76 76
77 /* TFTCRST=0 | CPSOUT=0 | CPSEN = 0 */ 77 /* TFTCRST=0 | CPSOUT=0 | CPSEN = 0 */
78 locomo_writel(0, locomolcd_dev->mapbase + LOCOMO_TC); 78 locomo_writel(0, locomolcd_dev->mapbase + LOCOMO_TC);
79 locomo_gpio_write(locomolcd_dev, LOCOMO_GPIO_LCD_MOD, 0); 79 locomo_gpio_write(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_MOD, 0);
80 locomo_gpio_write(locomolcd_dev, LOCOMO_GPIO_LCD_VSHD_ON, 0); 80 locomo_gpio_write(locomolcd_dev->dev.parent, LOCOMO_GPIO_LCD_VSHD_ON, 0);
81} 81}
82 82
83void locomolcd_power(int on) 83void locomolcd_power(int on)
@@ -167,14 +167,14 @@ static int locomolcd_resume(struct locomo_dev *dev)
167#define locomolcd_resume NULL 167#define locomolcd_resume NULL
168#endif 168#endif
169 169
170static int locomolcd_probe(struct locomo_dev *dev) 170static int locomolcd_probe(struct locomo_dev *ldev)
171{ 171{
172 unsigned long flags; 172 unsigned long flags;
173 173
174 local_irq_save(flags); 174 local_irq_save(flags);
175 locomolcd_dev = dev; 175 locomolcd_dev = ldev;
176 176
177 locomo_gpio_set_dir(dev, LOCOMO_GPIO_FL_VR, 0); 177 locomo_gpio_set_dir(ldev->dev.parent, LOCOMO_GPIO_FL_VR, 0);
178 178
179 /* the poodle_lcd_power function is called for the first time 179 /* the poodle_lcd_power function is called for the first time
180 * from fs_initcall, which is before locomo is activated. 180 * from fs_initcall, which is before locomo is activated.
diff --git a/include/asm-arm/hardware/locomo.h b/include/asm-arm/hardware/locomo.h
index 22dfb1737768..2599a6bc70e4 100644
--- a/include/asm-arm/hardware/locomo.h
+++ b/include/asm-arm/hardware/locomo.h
@@ -197,10 +197,11 @@ int locomo_driver_register(struct locomo_driver *);
197void locomo_driver_unregister(struct locomo_driver *); 197void locomo_driver_unregister(struct locomo_driver *);
198 198
199/* GPIO control functions */ 199/* GPIO control functions */
200void locomo_gpio_set_dir(struct locomo_dev *ldev, unsigned int bits, unsigned int dir); 200void locomo_gpio_set_dir(struct device *dev, unsigned int bits, unsigned int dir);
201unsigned int locomo_gpio_read_level(struct locomo_dev *ldev, unsigned int bits); 201int locomo_gpio_read_level(struct device *dev, unsigned int bits);
202unsigned int locomo_gpio_read_output(struct locomo_dev *ldev, unsigned int bits); 202int locomo_gpio_read_output(struct device *dev, unsigned int bits);
203void locomo_gpio_write(struct locomo_dev *ldev, unsigned int bits, unsigned int set); 203void locomo_gpio_write(struct device *dev, unsigned int bits, unsigned int set);
204
204 205
205/* M62332 control function */ 206/* M62332 control function */
206void locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int channel); 207void locomo_m62332_senddata(struct locomo_dev *ldev, unsigned int dac_data, int channel);