Blame view
arch/arm/mach-sa1100/h3600.c
3.42 KB
d2912cb15
|
1 |
// SPDX-License-Identifier: GPL-2.0-only |
1da177e4c
|
2 |
/* |
6e23fcb3b
|
3 |
* Support for Compaq iPAQ H3600 handheld computer |
1da177e4c
|
4 |
* |
6e23fcb3b
|
5 6 |
* Copyright (c) 2000,1 Compaq Computer Corporation. (Author: Jamey Hicks) * Copyright (c) 2009 Dmitry Artamonow <mad_soft@inbox.ru> |
1da177e4c
|
7 |
*/ |
6e23fcb3b
|
8 |
|
1da177e4c
|
9 10 |
#include <linux/init.h> #include <linux/kernel.h> |
0831e3e4c
|
11 |
#include <linux/gpio.h> |
1da177e4c
|
12 |
|
e1b7a72ae
|
13 |
#include <video/sa1100fb.h> |
1da177e4c
|
14 |
#include <asm/mach-types.h> |
1da177e4c
|
15 |
#include <asm/mach/arch.h> |
dd4507779
|
16 |
#include <linux/platform_data/irda-sa11x0.h> |
1da177e4c
|
17 |
|
8715b29db
|
18 |
#include <mach/h3xxx.h> |
f314f33be
|
19 |
#include <mach/irqs.h> |
1da177e4c
|
20 21 |
#include "generic.h" |
cf5a87d80
|
22 23 24 |
/* * helper for sa1100fb */ |
8bed576c1
|
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
static struct gpio h3600_lcd_gpio[] = { { H3XXX_EGPIO_LCD_ON, GPIOF_OUT_INIT_LOW, "LCD power" }, { H3600_EGPIO_LCD_PCI, GPIOF_OUT_INIT_LOW, "LCD control" }, { H3600_EGPIO_LCD_5V_ON, GPIOF_OUT_INIT_LOW, "LCD 5v" }, { H3600_EGPIO_LVDD_ON, GPIOF_OUT_INIT_LOW, "LCD 9v/-6.5v" }, }; static bool h3600_lcd_request(void) { static bool h3600_lcd_ok; int rc; if (h3600_lcd_ok) return true; rc = gpio_request_array(h3600_lcd_gpio, ARRAY_SIZE(h3600_lcd_gpio)); if (rc) pr_err("%s: can't request GPIOs ", __func__); else h3600_lcd_ok = true; return h3600_lcd_ok; } |
cf5a87d80
|
49 50 |
static void h3600_lcd_power(int enable) { |
8bed576c1
|
51 52 |
if (!h3600_lcd_request()) return; |
22f974055
|
53 54 55 56 57 |
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); |
cf5a87d80
|
58 |
} |
e1b7a72ae
|
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
static const struct sa1100fb_rgb h3600_rgb_16 = { .red = { .offset = 12, .length = 4, }, .green = { .offset = 7, .length = 4, }, .blue = { .offset = 1, .length = 4, }, .transp = { .offset = 0, .length = 0, }, }; static struct sa1100fb_mach_info h3600_lcd_info = { .pixclock = 174757, .bpp = 16, .xres = 320, .yres = 240, .hsync_len = 3, .vsync_len = 3, .left_margin = 12, .upper_margin = 10, .right_margin = 17, .lower_margin = 1, .cmap_static = 1, .lccr0 = LCCR0_Color | LCCR0_Sngl | LCCR0_Act, .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2), .rgb[RGB_16] = &h3600_rgb_16, |
086ada54a
|
80 81 |
.lcd_power = h3600_lcd_power, |
e1b7a72ae
|
82 |
}; |
1da177e4c
|
83 84 85 |
static void __init h3600_map_io(void) { h3xxx_map_io(); |
1da177e4c
|
86 |
} |
a5d176a19
|
87 88 89 |
/* * This turns the IRDA power on or off on the Compaq H3600 */ |
15cc324ac
|
90 91 92 93 |
static struct gpio h3600_irda_gpio[] = { { H3600_EGPIO_IR_ON, GPIOF_OUT_INIT_LOW, "IrDA power" }, { H3600_EGPIO_IR_FSEL, GPIOF_OUT_INIT_LOW, "IrDA fsel" }, }; |
a5d176a19
|
94 95 |
static int h3600_irda_set_power(struct device *dev, unsigned int state) { |
22f974055
|
96 |
gpio_set_value(H3600_EGPIO_IR_ON, state); |
a5d176a19
|
97 98 99 100 101 |
return 0; } static void h3600_irda_set_speed(struct device *dev, unsigned int speed) { |
22f974055
|
102 103 104 105 106 |
gpio_set_value(H3600_EGPIO_IR_FSEL, !(speed < 4000000)); } static int h3600_irda_startup(struct device *dev) { |
15cc324ac
|
107 |
return gpio_request_array(h3600_irda_gpio, sizeof(h3600_irda_gpio)); |
22f974055
|
108 109 110 111 |
} static void h3600_irda_shutdown(struct device *dev) { |
15cc324ac
|
112 |
return gpio_free_array(h3600_irda_gpio, sizeof(h3600_irda_gpio)); |
a5d176a19
|
113 114 115 116 117 |
} static struct irda_platform_data h3600_irda_data = { .set_power = h3600_irda_set_power, .set_speed = h3600_irda_set_speed, |
22f974055
|
118 119 |
.startup = h3600_irda_startup, .shutdown = h3600_irda_shutdown, |
a5d176a19
|
120 |
}; |
e55b20e81
|
121 |
static void __init h3600_mach_init(void) |
898e810ea
|
122 123 |
{ h3xxx_mach_init(); |
e1b7a72ae
|
124 |
|
e1b7a72ae
|
125 |
sa11x0_register_lcd(&h3600_lcd_info); |
a5d176a19
|
126 |
sa11x0_register_irda(&h3600_irda_data); |
898e810ea
|
127 |
} |
1da177e4c
|
128 |
MACHINE_START(H3600, "Compaq iPAQ H3600") |
17f4425d5
|
129 |
.atag_offset = 0x100, |
e9dea0c65
|
130 |
.map_io = h3600_map_io, |
f314f33be
|
131 |
.nr_irqs = SA1100_NR_IRQS, |
e9dea0c65
|
132 |
.init_irq = sa1100_init_irq, |
6bb27d734
|
133 |
.init_time = sa1100_timer_init, |
898e810ea
|
134 |
.init_machine = h3600_mach_init, |
7fea1ba58
|
135 |
.init_late = sa11x0_init_late, |
d9ca5839f
|
136 |
.restart = sa11x0_restart, |
1da177e4c
|
137 |
MACHINE_END |