1 // SPDX-License-Identifier: GPL-2.0-only
3 * Support for Compaq iPAQ H3600 handheld computer
5 * Copyright (c) 2000,1 Compaq Computer Corporation. (Author: Jamey Hicks)
6 * Copyright (c) 2009 Dmitry Artamonow <mad_soft@inbox.ru>
9 #include <linux/init.h>
10 #include <linux/kernel.h>
11 #include <linux/gpio.h>
13 #include <video/sa1100fb.h>
15 #include <asm/mach-types.h>
16 #include <asm/mach/arch.h>
17 #include <linux/platform_data/irda-sa11x0.h>
19 #include <mach/h3xxx.h>
20 #include <mach/irqs.h>
27 static struct gpio h3600_lcd_gpio
[] = {
28 { H3XXX_EGPIO_LCD_ON
, GPIOF_OUT_INIT_LOW
, "LCD power" },
29 { H3600_EGPIO_LCD_PCI
, GPIOF_OUT_INIT_LOW
, "LCD control" },
30 { H3600_EGPIO_LCD_5V_ON
, GPIOF_OUT_INIT_LOW
, "LCD 5v" },
31 { H3600_EGPIO_LVDD_ON
, GPIOF_OUT_INIT_LOW
, "LCD 9v/-6.5v" },
34 static bool h3600_lcd_request(void)
36 static bool h3600_lcd_ok
;
42 rc
= gpio_request_array(h3600_lcd_gpio
, ARRAY_SIZE(h3600_lcd_gpio
));
44 pr_err("%s: can't request GPIOs\n", __func__
);
51 static void h3600_lcd_power(int enable
)
53 if (!h3600_lcd_request())
56 gpio_direction_output(H3XXX_EGPIO_LCD_ON
, enable
);
57 gpio_direction_output(H3600_EGPIO_LCD_PCI
, enable
);
58 gpio_direction_output(H3600_EGPIO_LCD_5V_ON
, enable
);
59 gpio_direction_output(H3600_EGPIO_LVDD_ON
, enable
);
62 static const struct sa1100fb_rgb h3600_rgb_16
= {
63 .red
= { .offset
= 12, .length
= 4, },
64 .green
= { .offset
= 7, .length
= 4, },
65 .blue
= { .offset
= 1, .length
= 4, },
66 .transp
= { .offset
= 0, .length
= 0, },
69 static struct sa1100fb_mach_info h3600_lcd_info
= {
70 .pixclock
= 174757, .bpp
= 16,
71 .xres
= 320, .yres
= 240,
73 .hsync_len
= 3, .vsync_len
= 3,
74 .left_margin
= 12, .upper_margin
= 10,
75 .right_margin
= 17, .lower_margin
= 1,
79 .lccr0
= LCCR0_Color
| LCCR0_Sngl
| LCCR0_Act
,
80 .lccr3
= LCCR3_OutEnH
| LCCR3_PixRsEdg
| LCCR3_ACBsDiv(2),
82 .rgb
[RGB_16
] = &h3600_rgb_16
,
84 .lcd_power
= h3600_lcd_power
,
88 static void __init
h3600_map_io(void)
94 * This turns the IRDA power on or off on the Compaq H3600
96 static struct gpio h3600_irda_gpio
[] = {
97 { H3600_EGPIO_IR_ON
, GPIOF_OUT_INIT_LOW
, "IrDA power" },
98 { H3600_EGPIO_IR_FSEL
, GPIOF_OUT_INIT_LOW
, "IrDA fsel" },
101 static int h3600_irda_set_power(struct device
*dev
, unsigned int state
)
103 gpio_set_value(H3600_EGPIO_IR_ON
, state
);
107 static void h3600_irda_set_speed(struct device
*dev
, unsigned int speed
)
109 gpio_set_value(H3600_EGPIO_IR_FSEL
, !(speed
< 4000000));
112 static int h3600_irda_startup(struct device
*dev
)
114 return gpio_request_array(h3600_irda_gpio
, sizeof(h3600_irda_gpio
));
117 static void h3600_irda_shutdown(struct device
*dev
)
119 return gpio_free_array(h3600_irda_gpio
, sizeof(h3600_irda_gpio
));
122 static struct irda_platform_data h3600_irda_data
= {
123 .set_power
= h3600_irda_set_power
,
124 .set_speed
= h3600_irda_set_speed
,
125 .startup
= h3600_irda_startup
,
126 .shutdown
= h3600_irda_shutdown
,
129 static void __init
h3600_mach_init(void)
133 sa11x0_register_lcd(&h3600_lcd_info
);
134 sa11x0_register_irda(&h3600_irda_data
);
137 MACHINE_START(H3600
, "Compaq iPAQ H3600")
138 .atag_offset
= 0x100,
139 .map_io
= h3600_map_io
,
140 .nr_irqs
= SA1100_NR_IRQS
,
141 .init_irq
= sa1100_init_irq
,
142 .init_time
= sa1100_timer_init
,
143 .init_machine
= h3600_mach_init
,
144 .init_late
= sa11x0_init_late
,
145 .restart
= sa11x0_restart
,