Blame view

arch/arm/mach-sa1100/h3600.c 3.42 KB
d2912cb15   Thomas Gleixner   treewide: Replace...
1
  // SPDX-License-Identifier: GPL-2.0-only
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
  /*
6e23fcb3b   Dmitry Artamonow   ARM: 5821/1: SA11...
3
   * Support for Compaq iPAQ H3600 handheld computer
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
4
   *
6e23fcb3b   Dmitry Artamonow   ARM: 5821/1: SA11...
5
6
   * Copyright (c) 2000,1 Compaq Computer Corporation. (Author: Jamey Hicks)
   * Copyright (c) 2009 Dmitry Artamonow <mad_soft@inbox.ru>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
7
   */
6e23fcb3b   Dmitry Artamonow   ARM: 5821/1: SA11...
8

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
9
10
  #include <linux/init.h>
  #include <linux/kernel.h>
0831e3e4c   Russell King   ARM: iPAQ: provid...
11
  #include <linux/gpio.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
12

e1b7a72ae   Russell King   FB: sa1100: move ...
13
  #include <video/sa1100fb.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
14
  #include <asm/mach-types.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
15
  #include <asm/mach/arch.h>
dd4507779   Dmitry Eremin-Solenikov   arm: sa1100: move...
16
  #include <linux/platform_data/irda-sa11x0.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
17

8715b29db   Dmitry Artamonow   ARM: 5819/1: SA11...
18
  #include <mach/h3xxx.h>
f314f33be   Rob Herring   ARM: 7342/2: sa11...
19
  #include <mach/irqs.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
20
21
  
  #include "generic.h"
cf5a87d80   Dmitry Artamonow   ARM: 5812/1: SA11...
22
23
24
  /*
   * helper for sa1100fb
   */
8bed576c1   Dmitry Eremin-Solenikov   ARM: 7899/1: sa11...
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   Dmitry Artamonow   ARM: 5812/1: SA11...
49
50
  static void h3600_lcd_power(int enable)
  {
8bed576c1   Dmitry Eremin-Solenikov   ARM: 7899/1: sa11...
51
52
  	if (!h3600_lcd_request())
  		return;
22f974055   Dmitry Artamonow   ARM: 5814/1: SA11...
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   Dmitry Artamonow   ARM: 5812/1: SA11...
58
  }
e1b7a72ae   Russell King   FB: sa1100: move ...
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   Russell King   FB: sa1100: remov...
80
81
  
  	.lcd_power = h3600_lcd_power,
e1b7a72ae   Russell King   FB: sa1100: move ...
82
  };
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
83
84
85
  static void __init h3600_map_io(void)
  {
  	h3xxx_map_io();
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
86
  }
a5d176a19   Russell King   ARM: iPAQ: separa...
87
88
89
  /*
   * This turns the IRDA power on or off on the Compaq H3600
   */
15cc324ac   Dmitry Eremin-Solenikov   ARM: 7901/1: sa11...
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   Russell King   ARM: iPAQ: separa...
94
95
  static int h3600_irda_set_power(struct device *dev, unsigned int state)
  {
22f974055   Dmitry Artamonow   ARM: 5814/1: SA11...
96
  	gpio_set_value(H3600_EGPIO_IR_ON, state);
a5d176a19   Russell King   ARM: iPAQ: separa...
97
98
99
100
101
  	return 0;
  }
  
  static void h3600_irda_set_speed(struct device *dev, unsigned int speed)
  {
22f974055   Dmitry Artamonow   ARM: 5814/1: SA11...
102
103
104
105
106
  	gpio_set_value(H3600_EGPIO_IR_FSEL, !(speed < 4000000));
  }
  
  static int h3600_irda_startup(struct device *dev)
  {
15cc324ac   Dmitry Eremin-Solenikov   ARM: 7901/1: sa11...
107
  	return gpio_request_array(h3600_irda_gpio, sizeof(h3600_irda_gpio));
22f974055   Dmitry Artamonow   ARM: 5814/1: SA11...
108
109
110
111
  }
  
  static void h3600_irda_shutdown(struct device *dev)
  {
15cc324ac   Dmitry Eremin-Solenikov   ARM: 7901/1: sa11...
112
  	return gpio_free_array(h3600_irda_gpio, sizeof(h3600_irda_gpio));
a5d176a19   Russell King   ARM: iPAQ: separa...
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   Dmitry Artamonow   ARM: 5814/1: SA11...
118
119
  	.startup	= h3600_irda_startup,
  	.shutdown	= h3600_irda_shutdown,
a5d176a19   Russell King   ARM: iPAQ: separa...
120
  };
e55b20e81   Dmitry Artamonow   ARM: 5795/1: SA11...
121
  static void __init h3600_mach_init(void)
898e810ea   Russell King   ARM: h3600: provi...
122
123
  {
  	h3xxx_mach_init();
e1b7a72ae   Russell King   FB: sa1100: move ...
124

e1b7a72ae   Russell King   FB: sa1100: move ...
125
  	sa11x0_register_lcd(&h3600_lcd_info);
a5d176a19   Russell King   ARM: iPAQ: separa...
126
  	sa11x0_register_irda(&h3600_irda_data);
898e810ea   Russell King   ARM: h3600: provi...
127
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
128
  MACHINE_START(H3600, "Compaq iPAQ H3600")
17f4425d5   Nicolas Pitre   ARM: mach-sa1100:...
129
  	.atag_offset	= 0x100,
e9dea0c65   Russell King   [PATCH] ARM: Remo...
130
  	.map_io		= h3600_map_io,
f314f33be   Rob Herring   ARM: 7342/2: sa11...
131
  	.nr_irqs	= SA1100_NR_IRQS,
e9dea0c65   Russell King   [PATCH] ARM: Remo...
132
  	.init_irq	= sa1100_init_irq,
6bb27d734   Stephen Warren   ARM: delete struc...
133
  	.init_time	= sa1100_timer_init,
898e810ea   Russell King   ARM: h3600: provi...
134
  	.init_machine	= h3600_mach_init,
7fea1ba58   Shawn Guo   ARM: sa1100: use ...
135
  	.init_late	= sa11x0_init_late,
d9ca5839f   Russell King   ARM: restart: sa1...
136
  	.restart	= sa11x0_restart,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
137
  MACHINE_END