Blame view
arch/arm/mach-sa1100/h3600.c
3.34 KB
1da177e4c Linux-2.6.12-rc2 |
1 |
/* |
6e23fcb3b ARM: 5821/1: SA11... |
2 |
* Support for Compaq iPAQ H3600 handheld computer |
1da177e4c Linux-2.6.12-rc2 |
3 |
* |
6e23fcb3b ARM: 5821/1: SA11... |
4 5 |
* Copyright (c) 2000,1 Compaq Computer Corporation. (Author: Jamey Hicks) * Copyright (c) 2009 Dmitry Artamonow <mad_soft@inbox.ru> |
1da177e4c Linux-2.6.12-rc2 |
6 |
* |
6e23fcb3b ARM: 5821/1: SA11... |
7 8 9 |
* This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. |
1da177e4c Linux-2.6.12-rc2 |
10 11 |
* */ |
6e23fcb3b ARM: 5821/1: SA11... |
12 |
|
1da177e4c Linux-2.6.12-rc2 |
13 14 |
#include <linux/init.h> #include <linux/kernel.h> |
0831e3e4c ARM: iPAQ: provid... |
15 |
#include <linux/gpio.h> |
1da177e4c Linux-2.6.12-rc2 |
16 |
|
1da177e4c Linux-2.6.12-rc2 |
17 |
#include <asm/mach-types.h> |
1da177e4c Linux-2.6.12-rc2 |
18 |
#include <asm/mach/arch.h> |
1da177e4c Linux-2.6.12-rc2 |
19 |
#include <asm/mach/irda.h> |
1da177e4c Linux-2.6.12-rc2 |
20 |
|
8715b29db ARM: 5819/1: SA11... |
21 |
#include <mach/h3xxx.h> |
1da177e4c Linux-2.6.12-rc2 |
22 23 |
#include "generic.h" |
cf5a87d80 ARM: 5812/1: SA11... |
24 25 26 27 28 |
/* * helper for sa1100fb */ static void h3600_lcd_power(int enable) { |
729fae44d ARM: 5827/1: SA11... |
29 30 31 |
if (gpio_request(H3XXX_EGPIO_LCD_ON, "LCD power")) { pr_err("%s: can't request H3XXX_EGPIO_LCD_ON ", __func__); |
22f974055 ARM: 5814/1: SA11... |
32 |
goto err1; |
729fae44d ARM: 5827/1: SA11... |
33 34 35 36 |
} if (gpio_request(H3600_EGPIO_LCD_PCI, "LCD control")) { pr_err("%s: can't request H3XXX_EGPIO_LCD_PCI ", __func__); |
22f974055 ARM: 5814/1: SA11... |
37 |
goto err2; |
729fae44d ARM: 5827/1: SA11... |
38 39 40 41 |
} if (gpio_request(H3600_EGPIO_LCD_5V_ON, "LCD 5v")) { pr_err("%s: can't request H3XXX_EGPIO_LCD_5V_ON ", __func__); |
22f974055 ARM: 5814/1: SA11... |
42 |
goto err3; |
729fae44d ARM: 5827/1: SA11... |
43 44 45 46 |
} if (gpio_request(H3600_EGPIO_LVDD_ON, "LCD 9v/-6.5v")) { pr_err("%s: can't request H3600_EGPIO_LVDD_ON ", __func__); |
22f974055 ARM: 5814/1: SA11... |
47 |
goto err4; |
729fae44d ARM: 5827/1: SA11... |
48 |
} |
22f974055 ARM: 5814/1: SA11... |
49 50 51 52 53 54 55 56 57 58 59 |
gpio_direction_output(H3XXX_EGPIO_LCD_ON, enable); gpio_direction_output(H3600_EGPIO_LCD_PCI, enable); gpio_direction_output(H3600_EGPIO_LCD_5V_ON, enable); gpio_direction_output(H3600_EGPIO_LVDD_ON, enable); gpio_free(H3600_EGPIO_LVDD_ON); err4: gpio_free(H3600_EGPIO_LCD_5V_ON); err3: gpio_free(H3600_EGPIO_LCD_PCI); err2: gpio_free(H3XXX_EGPIO_LCD_ON); err1: return; |
cf5a87d80 ARM: 5812/1: SA11... |
60 |
} |
1da177e4c Linux-2.6.12-rc2 |
61 62 63 |
static void __init h3600_map_io(void) { h3xxx_map_io(); |
cf5a87d80 ARM: 5812/1: SA11... |
64 |
sa1100fb_lcd_power = h3600_lcd_power; |
1da177e4c Linux-2.6.12-rc2 |
65 |
} |
a5d176a19 ARM: iPAQ: separa... |
66 67 68 69 70 |
/* * This turns the IRDA power on or off on the Compaq H3600 */ static int h3600_irda_set_power(struct device *dev, unsigned int state) { |
22f974055 ARM: 5814/1: SA11... |
71 |
gpio_set_value(H3600_EGPIO_IR_ON, state); |
a5d176a19 ARM: iPAQ: separa... |
72 73 74 75 76 |
return 0; } static void h3600_irda_set_speed(struct device *dev, unsigned int speed) { |
22f974055 ARM: 5814/1: SA11... |
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 104 |
gpio_set_value(H3600_EGPIO_IR_FSEL, !(speed < 4000000)); } static int h3600_irda_startup(struct device *dev) { int err = gpio_request(H3600_EGPIO_IR_ON, "IrDA power"); if (err) goto err1; err = gpio_direction_output(H3600_EGPIO_IR_ON, 0); if (err) goto err2; err = gpio_request(H3600_EGPIO_IR_FSEL, "IrDA fsel"); if (err) goto err2; err = gpio_direction_output(H3600_EGPIO_IR_FSEL, 0); if (err) goto err3; return 0; err3: gpio_free(H3600_EGPIO_IR_FSEL); err2: gpio_free(H3600_EGPIO_IR_ON); err1: return err; } static void h3600_irda_shutdown(struct device *dev) { gpio_free(H3600_EGPIO_IR_ON); gpio_free(H3600_EGPIO_IR_FSEL); |
a5d176a19 ARM: iPAQ: separa... |
105 106 107 108 109 |
} static struct irda_platform_data h3600_irda_data = { .set_power = h3600_irda_set_power, .set_speed = h3600_irda_set_speed, |
22f974055 ARM: 5814/1: SA11... |
110 111 |
.startup = h3600_irda_startup, .shutdown = h3600_irda_shutdown, |
a5d176a19 ARM: iPAQ: separa... |
112 |
}; |
6e21ee6aa ARM: iPAQ: move s... |
113 114 115 116 117 |
static struct gpio_default_state h3600_default_gpio[] = { { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" }, { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" }, { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" }, }; |
e55b20e81 ARM: 5795/1: SA11... |
118 |
static void __init h3600_mach_init(void) |
898e810ea ARM: h3600: provi... |
119 |
{ |
6e21ee6aa ARM: iPAQ: move s... |
120 |
h3xxx_init_gpio(h3600_default_gpio, ARRAY_SIZE(h3600_default_gpio)); |
898e810ea ARM: h3600: provi... |
121 |
h3xxx_mach_init(); |
a5d176a19 ARM: iPAQ: separa... |
122 |
sa11x0_register_irda(&h3600_irda_data); |
898e810ea ARM: h3600: provi... |
123 |
} |
1da177e4c Linux-2.6.12-rc2 |
124 |
MACHINE_START(H3600, "Compaq iPAQ H3600") |
17f4425d5 ARM: mach-sa1100:... |
125 |
.atag_offset = 0x100, |
e9dea0c65 [PATCH] ARM: Remo... |
126 127 |
.map_io = h3600_map_io, .init_irq = sa1100_init_irq, |
1da177e4c Linux-2.6.12-rc2 |
128 |
.timer = &sa1100_timer, |
898e810ea ARM: h3600: provi... |
129 |
.init_machine = h3600_mach_init, |
d9ca5839f ARM: restart: sa1... |
130 |
.restart = sa11x0_restart, |
1da177e4c Linux-2.6.12-rc2 |
131 |
MACHINE_END |