2 * Support for Compaq iPAQ H3100 handheld computer
4 * Copyright (c) 2000,1 Compaq Computer Corporation. (Author: Jamey Hicks)
5 * Copyright (c) 2009 Dmitry Artamonow <mad_soft@inbox.ru>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
13 #include <linux/init.h>
14 #include <linux/kernel.h>
15 #include <linux/gpio.h>
17 #include <video/sa1100fb.h>
19 #include <asm/mach-types.h>
20 #include <asm/mach/arch.h>
21 #include <asm/mach/irda.h>
23 #include <mach/h3xxx.h>
24 #include <mach/irqs.h>
31 static struct gpio h3100_lcd_gpio[] = {
32 { H3100_GPIO_LCD_3V_ON, GPIOF_OUT_INIT_LOW, "LCD 3V" },
33 { H3XXX_EGPIO_LCD_ON, GPIOF_OUT_INIT_LOW, "LCD ON" },
36 static bool h3100_lcd_request(void)
38 static bool h3100_lcd_ok;
44 rc = gpio_request_array(h3100_lcd_gpio, ARRAY_SIZE(h3100_lcd_gpio));
46 pr_err("%s: can't request GPIOs\n", __func__);
53 static void h3100_lcd_power(int enable)
55 if (!h3100_lcd_request())
58 gpio_set_value(H3100_GPIO_LCD_3V_ON, enable);
59 gpio_set_value(H3XXX_EGPIO_LCD_ON, enable);
62 static struct sa1100fb_mach_info h3100_lcd_info = {
63 .pixclock = 406977, .bpp = 4,
64 .xres = 320, .yres = 240,
66 .hsync_len = 26, .vsync_len = 41,
67 .left_margin = 4, .upper_margin = 0,
68 .right_margin = 4, .lower_margin = 0,
70 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
74 .lccr0 = LCCR0_Mono | LCCR0_4PixMono | LCCR0_Sngl | LCCR0_Pas,
75 .lccr3 = LCCR3_OutEnH | LCCR3_PixRsEdg | LCCR3_ACBsDiv(2),
77 .lcd_power = h3100_lcd_power,
80 static void __init h3100_map_io(void)
84 /* Older bootldrs put GPIO2-9 in alternate mode on the
85 assumption that they are used for video */
90 * This turns the IRDA power on or off on the Compaq H3100
92 static int h3100_irda_set_power(struct device *dev, unsigned int state)
94 gpio_set_value(H3100_GPIO_IR_ON, state);
98 static void h3100_irda_set_speed(struct device *dev, unsigned int speed)
100 gpio_set_value(H3100_GPIO_IR_FSEL, !(speed < 4000000));
103 static struct irda_platform_data h3100_irda_data = {
104 .set_power = h3100_irda_set_power,
105 .set_speed = h3100_irda_set_speed,
108 static struct gpio_default_state h3100_default_gpio[] = {
109 { H3100_GPIO_IR_ON, GPIO_MODE_OUT0, "IrDA power" },
110 { H3100_GPIO_IR_FSEL, GPIO_MODE_OUT0, "IrDA fsel" },
111 { H3XXX_GPIO_COM_DCD, GPIO_MODE_IN, "COM DCD" },
112 { H3XXX_GPIO_COM_CTS, GPIO_MODE_IN, "COM CTS" },
113 { H3XXX_GPIO_COM_RTS, GPIO_MODE_OUT0, "COM RTS" },
116 static void __init h3100_mach_init(void)
118 h3xxx_init_gpio(h3100_default_gpio, ARRAY_SIZE(h3100_default_gpio));
121 sa11x0_register_lcd(&h3100_lcd_info);
122 sa11x0_register_irda(&h3100_irda_data);
125 MACHINE_START(H3100, "Compaq iPAQ H3100")
126 .atag_offset = 0x100,
127 .map_io = h3100_map_io,
128 .nr_irqs = SA1100_NR_IRQS,
129 .init_irq = sa1100_init_irq,
130 .init_time = sa1100_timer_init,
131 .init_machine = h3100_mach_init,
132 .init_late = sa11x0_init_late,
133 .restart = sa11x0_restart,