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>
18 #include <mach/h3xxx.h>
19 #include <mach/irqs.h>
23 static bool h3600_lcd_request(void)
25 static bool h3600_lcd_ok
;
31 rc
= gpio_request(H3XXX_EGPIO_LCD_ON
, "LCD power");
34 rc
= gpio_direction_output(H3XXX_EGPIO_LCD_ON
, 0);
37 rc
= gpio_request(H3600_EGPIO_LCD_PCI
, "LCD control");
40 rc
= gpio_direction_output(H3600_EGPIO_LCD_PCI
, 0);
43 rc
= gpio_request(H3600_EGPIO_LCD_5V_ON
, "LCD 5v");
46 rc
= gpio_direction_output(H3600_EGPIO_LCD_5V_ON
, 0);
49 rc
= gpio_request(H3600_EGPIO_LVDD_ON
, "LCD 9v/-6.5v");
52 rc
= gpio_direction_output(H3600_EGPIO_LVDD_ON
, 0);
54 goto out_free_lvdd_on
;
59 gpio_free(H3600_EGPIO_LVDD_ON
);
61 gpio_free(H3600_EGPIO_LCD_5V_ON
);
63 gpio_free(H3600_EGPIO_LCD_PCI
);
65 gpio_free(H3XXX_EGPIO_LCD_ON
);
68 pr_err("%s: can't request GPIOs\n", __func__
);
75 static void h3600_lcd_power(int enable
)
77 if (!h3600_lcd_request())
80 gpio_direction_output(H3XXX_EGPIO_LCD_ON
, enable
);
81 gpio_direction_output(H3600_EGPIO_LCD_PCI
, enable
);
82 gpio_direction_output(H3600_EGPIO_LCD_5V_ON
, enable
);
83 gpio_direction_output(H3600_EGPIO_LVDD_ON
, enable
);
86 static const struct sa1100fb_rgb h3600_rgb_16
= {
87 .red
= { .offset
= 12, .length
= 4, },
88 .green
= { .offset
= 7, .length
= 4, },
89 .blue
= { .offset
= 1, .length
= 4, },
90 .transp
= { .offset
= 0, .length
= 0, },
93 static struct sa1100fb_mach_info h3600_lcd_info
= {
94 .pixclock
= 174757, .bpp
= 16,
95 .xres
= 320, .yres
= 240,
97 .hsync_len
= 3, .vsync_len
= 3,
98 .left_margin
= 12, .upper_margin
= 10,
99 .right_margin
= 17, .lower_margin
= 1,
103 .lccr0
= LCCR0_Color
| LCCR0_Sngl
| LCCR0_Act
,
104 .lccr3
= LCCR3_OutEnH
| LCCR3_PixRsEdg
| LCCR3_ACBsDiv(2),
106 .rgb
[RGB_16
] = &h3600_rgb_16
,
108 .lcd_power
= h3600_lcd_power
,
112 static void __init
h3600_map_io(void)
117 static void __init
h3600_mach_init(void)
121 sa11x0_register_lcd(&h3600_lcd_info
);
124 MACHINE_START(H3600
, "Compaq iPAQ H3600")
125 .atag_offset
= 0x100,
126 .map_io
= h3600_map_io
,
127 .nr_irqs
= SA1100_NR_IRQS
,
128 .init_irq
= sa1100_init_irq
,
129 .init_time
= sa1100_timer_init
,
130 .init_machine
= h3600_mach_init
,
131 .init_late
= sa11x0_init_late
,
132 .restart
= sa11x0_restart
,