Linux Audio

Check our new training course

Linux BSP upgrade and security maintenance

Need help to get security updates for your Linux BSP?
Loading...
v3.15
 
  1/*
  2 * Hardware definitions for Palm Tungsten|E2
  3 *
  4 * Author:
  5 *	Carlos Eduardo Medaglia Dyonisio <cadu@nerdfeliz.com>
  6 *
  7 * Rewrite for mainline:
  8 *	Marek Vasut <marek.vasut@gmail.com>
  9 *
 10 * This program is free software; you can redistribute it and/or modify
 11 * it under the terms of the GNU General Public License version 2 as
 12 * published by the Free Software Foundation.
 13 *
 14 * (find more info at www.hackndev.com)
 15 *
 16 */
 17
 18#include <linux/platform_device.h>
 19#include <linux/delay.h>
 20#include <linux/irq.h>
 21#include <linux/gpio_keys.h>
 
 22#include <linux/input.h>
 23#include <linux/pda_power.h>
 
 24#include <linux/pwm_backlight.h>
 25#include <linux/gpio.h>
 26#include <linux/wm97xx.h>
 27#include <linux/power_supply.h>
 28#include <linux/usb/gpio_vbus.h>
 29
 30#include <asm/mach-types.h>
 31#include <asm/mach/arch.h>
 32#include <asm/mach/map.h>
 33
 34#include <mach/pxa25x.h>
 35#include <mach/audio.h>
 36#include <mach/palmte2.h>
 37#include <linux/platform_data/mmc-pxamci.h>
 38#include <linux/platform_data/video-pxafb.h>
 39#include <linux/platform_data/irda-pxaficp.h>
 40#include <mach/udc.h>
 41#include <linux/platform_data/asoc-palm27x.h>
 42
 43#include "generic.h"
 44#include "devices.h"
 45
 46/******************************************************************************
 47 * Pin configuration
 48 ******************************************************************************/
 49static unsigned long palmte2_pin_config[] __initdata = {
 50	/* MMC */
 51	GPIO6_MMC_CLK,
 52	GPIO8_MMC_CS0,
 53	GPIO10_GPIO,	/* SD detect */
 54	GPIO55_GPIO,	/* SD power */
 55	GPIO51_GPIO,	/* SD r/o switch */
 56
 57	/* AC97 */
 58	GPIO28_AC97_BITCLK,
 59	GPIO29_AC97_SDATA_IN_0,
 60	GPIO30_AC97_SDATA_OUT,
 61	GPIO31_AC97_SYNC,
 62
 63	/* PWM */
 64	GPIO16_PWM0_OUT,
 65
 66	/* USB */
 67	GPIO15_GPIO,	/* usb detect */
 68	GPIO53_GPIO,	/* usb power */
 69
 70	/* IrDA */
 71	GPIO48_GPIO,	/* ir disable */
 72	GPIO46_FICP_RXD,
 73	GPIO47_FICP_TXD,
 74
 75	/* LCD */
 76	GPIOxx_LCD_TFT_16BPP,
 77
 78	/* GPIO KEYS */
 79	GPIO5_GPIO,	/* notes */
 80	GPIO7_GPIO,	/* tasks */
 81	GPIO11_GPIO,	/* calendar */
 82	GPIO13_GPIO,	/* contacts */
 83	GPIO14_GPIO,	/* center */
 84	GPIO19_GPIO,	/* left */
 85	GPIO20_GPIO,	/* right */
 86	GPIO21_GPIO,	/* down */
 87	GPIO22_GPIO,	/* up */
 88
 89	/* MISC */
 90	GPIO1_RST,	/* reset */
 91	GPIO4_GPIO,	/* Hotsync button */
 92	GPIO9_GPIO,	/* power detect */
 93	GPIO15_GPIO,	/* earphone detect */
 94	GPIO37_GPIO,	/* LCD power */
 95	GPIO56_GPIO,	/* Backlight power */
 96};
 97
 98/******************************************************************************
 99 * SD/MMC card controller
100 ******************************************************************************/
101static struct pxamci_platform_data palmte2_mci_platform_data = {
102	.ocr_mask		= MMC_VDD_32_33 | MMC_VDD_33_34,
103	.gpio_card_detect	= GPIO_NR_PALMTE2_SD_DETECT_N,
104	.gpio_card_ro		= GPIO_NR_PALMTE2_SD_READONLY,
105	.gpio_power		= GPIO_NR_PALMTE2_SD_POWER,
 
 
 
 
 
 
 
 
 
 
106};
107
108#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
109/******************************************************************************
110 * GPIO keys
111 ******************************************************************************/
112static struct gpio_keys_button palmte2_pxa_buttons[] = {
113	{KEY_F1,	GPIO_NR_PALMTE2_KEY_CONTACTS,	1, "Contacts" },
114	{KEY_F2,	GPIO_NR_PALMTE2_KEY_CALENDAR,	1, "Calendar" },
115	{KEY_F3,	GPIO_NR_PALMTE2_KEY_TASKS,	1, "Tasks" },
116	{KEY_F4,	GPIO_NR_PALMTE2_KEY_NOTES,	1, "Notes" },
117	{KEY_ENTER,	GPIO_NR_PALMTE2_KEY_CENTER,	1, "Center" },
118	{KEY_LEFT,	GPIO_NR_PALMTE2_KEY_LEFT,	1, "Left" },
119	{KEY_RIGHT,	GPIO_NR_PALMTE2_KEY_RIGHT,	1, "Right" },
120	{KEY_DOWN,	GPIO_NR_PALMTE2_KEY_DOWN,	1, "Down" },
121	{KEY_UP,	GPIO_NR_PALMTE2_KEY_UP,		1, "Up" },
122};
123
124static struct gpio_keys_platform_data palmte2_pxa_keys_data = {
125	.buttons	= palmte2_pxa_buttons,
126	.nbuttons	= ARRAY_SIZE(palmte2_pxa_buttons),
127};
128
129static struct platform_device palmte2_pxa_keys = {
130	.name	= "gpio-keys",
131	.id	= -1,
132	.dev	= {
133		.platform_data = &palmte2_pxa_keys_data,
134	},
135};
136#endif
137
138/******************************************************************************
139 * Backlight
140 ******************************************************************************/
 
 
 
 
 
141static struct gpio palmte_bl_gpios[] = {
142	{ GPIO_NR_PALMTE2_BL_POWER, GPIOF_INIT_LOW, "Backlight power" },
143	{ GPIO_NR_PALMTE2_LCD_POWER, GPIOF_INIT_LOW, "LCD power" },
144};
145
146static int palmte2_backlight_init(struct device *dev)
147{
148	return gpio_request_array(ARRAY_AND_SIZE(palmte_bl_gpios));
149}
150
151static int palmte2_backlight_notify(struct device *dev, int brightness)
152{
153	gpio_set_value(GPIO_NR_PALMTE2_BL_POWER, brightness);
154	gpio_set_value(GPIO_NR_PALMTE2_LCD_POWER, brightness);
155	return brightness;
156}
157
158static void palmte2_backlight_exit(struct device *dev)
159{
160	gpio_free_array(ARRAY_AND_SIZE(palmte_bl_gpios));
161}
162
163static struct platform_pwm_backlight_data palmte2_backlight_data = {
164	.pwm_id		= 0,
165	.max_brightness	= PALMTE2_MAX_INTENSITY,
166	.dft_brightness	= PALMTE2_MAX_INTENSITY,
167	.pwm_period_ns	= PALMTE2_PERIOD_NS,
168	.enable_gpio	= -1,
169	.init		= palmte2_backlight_init,
170	.notify		= palmte2_backlight_notify,
171	.exit		= palmte2_backlight_exit,
172};
173
174static struct platform_device palmte2_backlight = {
175	.name	= "pwm-backlight",
176	.dev	= {
177		.parent		= &pxa25x_device_pwm0.dev,
178		.platform_data	= &palmte2_backlight_data,
179	},
180};
181
182/******************************************************************************
183 * IrDA
184 ******************************************************************************/
185static struct pxaficp_platform_data palmte2_ficp_platform_data = {
186	.gpio_pwdown		= GPIO_NR_PALMTE2_IR_DISABLE,
187	.transceiver_cap	= IR_SIRMODE | IR_OFF,
188};
189
190/******************************************************************************
191 * UDC
192 ******************************************************************************/
193static struct gpio_vbus_mach_info palmte2_udc_info = {
194	.gpio_vbus		= GPIO_NR_PALMTE2_USB_DETECT_N,
195	.gpio_vbus_inverted	= 1,
196	.gpio_pullup		= GPIO_NR_PALMTE2_USB_PULLUP,
 
 
 
 
 
197};
198
199static struct platform_device palmte2_gpio_vbus = {
200	.name	= "gpio-vbus",
201	.id	= -1,
202	.dev	= {
203		.platform_data	= &palmte2_udc_info,
204	},
205};
206
207/******************************************************************************
208 * Power supply
209 ******************************************************************************/
210static int power_supply_init(struct device *dev)
211{
212	int ret;
213
214	ret = gpio_request(GPIO_NR_PALMTE2_POWER_DETECT, "CABLE_STATE_AC");
215	if (ret)
216		goto err1;
217	ret = gpio_direction_input(GPIO_NR_PALMTE2_POWER_DETECT);
218	if (ret)
219		goto err2;
220
221	return 0;
222
223err2:
224	gpio_free(GPIO_NR_PALMTE2_POWER_DETECT);
225err1:
226	return ret;
227}
228
229static int palmte2_is_ac_online(void)
230{
231	return gpio_get_value(GPIO_NR_PALMTE2_POWER_DETECT);
232}
233
234static void power_supply_exit(struct device *dev)
235{
236	gpio_free(GPIO_NR_PALMTE2_POWER_DETECT);
237}
238
239static char *palmte2_supplicants[] = {
240	"main-battery",
241};
242
243static struct pda_power_pdata power_supply_info = {
244	.init            = power_supply_init,
245	.is_ac_online    = palmte2_is_ac_online,
246	.exit            = power_supply_exit,
247	.supplied_to     = palmte2_supplicants,
248	.num_supplicants = ARRAY_SIZE(palmte2_supplicants),
249};
250
251static struct platform_device power_supply = {
252	.name = "pda-power",
253	.id   = -1,
254	.dev  = {
255		.platform_data = &power_supply_info,
256	},
257};
258
259/******************************************************************************
260 * WM97xx audio, battery
261 ******************************************************************************/
262static struct wm97xx_batt_pdata palmte2_batt_pdata = {
263	.batt_aux	= WM97XX_AUX_ID3,
264	.temp_aux	= WM97XX_AUX_ID2,
265	.charge_gpio	= -1,
266	.max_voltage	= PALMTE2_BAT_MAX_VOLTAGE,
267	.min_voltage	= PALMTE2_BAT_MIN_VOLTAGE,
268	.batt_mult	= 1000,
269	.batt_div	= 414,
270	.temp_mult	= 1,
271	.temp_div	= 1,
272	.batt_tech	= POWER_SUPPLY_TECHNOLOGY_LIPO,
273	.batt_name	= "main-batt",
274};
275
276static struct wm97xx_pdata palmte2_wm97xx_pdata = {
277	.batt_pdata	= &palmte2_batt_pdata,
278};
279
280static pxa2xx_audio_ops_t palmte2_ac97_pdata = {
281	.codec_pdata	= { &palmte2_wm97xx_pdata, },
282};
283
284static struct palm27x_asoc_info palmte2_asoc_pdata = {
285	.jack_gpio	= GPIO_NR_PALMTE2_EARPHONE_DETECT,
286};
287
288static struct platform_device palmte2_asoc = {
289	.name = "palm27x-asoc",
290	.id   = -1,
291	.dev  = {
292		.platform_data = &palmte2_asoc_pdata,
293	},
294};
295
296/******************************************************************************
297 * Framebuffer
298 ******************************************************************************/
299static struct pxafb_mode_info palmte2_lcd_modes[] = {
300{
301	.pixclock	= 77757,
302	.xres		= 320,
303	.yres		= 320,
304	.bpp		= 16,
305
306	.left_margin	= 28,
307	.right_margin	= 7,
308	.upper_margin	= 7,
309	.lower_margin	= 5,
310
311	.hsync_len	= 4,
312	.vsync_len	= 1,
313},
314};
315
316static struct pxafb_mach_info palmte2_lcd_screen = {
317	.modes		= palmte2_lcd_modes,
318	.num_modes	= ARRAY_SIZE(palmte2_lcd_modes),
319	.lcd_conn	= LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
320};
321
322/******************************************************************************
323 * Machine init
324 ******************************************************************************/
325static struct platform_device *devices[] __initdata = {
326#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
327	&palmte2_pxa_keys,
328#endif
329	&palmte2_backlight,
330	&power_supply,
331	&palmte2_asoc,
332	&palmte2_gpio_vbus,
333};
334
335/* setup udc GPIOs initial state */
336static void __init palmte2_udc_init(void)
337{
338	if (!gpio_request(GPIO_NR_PALMTE2_USB_PULLUP, "UDC Vbus")) {
339		gpio_direction_output(GPIO_NR_PALMTE2_USB_PULLUP, 1);
340		gpio_free(GPIO_NR_PALMTE2_USB_PULLUP);
341	}
342}
343
344static void __init palmte2_init(void)
345{
346	pxa2xx_mfp_config(ARRAY_AND_SIZE(palmte2_pin_config));
347
348	pxa_set_ffuart_info(NULL);
349	pxa_set_btuart_info(NULL);
350	pxa_set_stuart_info(NULL);
351
352	pxa_set_fb_info(NULL, &palmte2_lcd_screen);
 
353	pxa_set_mci_info(&palmte2_mci_platform_data);
354	palmte2_udc_init();
355	pxa_set_ac97_info(&palmte2_ac97_pdata);
356	pxa_set_ficp_info(&palmte2_ficp_platform_data);
357
 
 
358	platform_add_devices(devices, ARRAY_SIZE(devices));
359}
360
361MACHINE_START(PALMTE2, "Palm Tungsten|E2")
362	.atag_offset	= 0x100,
363	.map_io		= pxa25x_map_io,
364	.nr_irqs	= PXA_NR_IRQS,
365	.init_irq	= pxa25x_init_irq,
366	.handle_irq	= pxa25x_handle_irq,
367	.init_time	= pxa_timer_init,
368	.init_machine	= palmte2_init,
369	.restart	= pxa_restart,
370MACHINE_END
v5.14.15
  1// SPDX-License-Identifier: GPL-2.0-only
  2/*
  3 * Hardware definitions for Palm Tungsten|E2
  4 *
  5 * Author:
  6 *	Carlos Eduardo Medaglia Dyonisio <cadu@nerdfeliz.com>
  7 *
  8 * Rewrite for mainline:
  9 *	Marek Vasut <marek.vasut@gmail.com>
 10 *
 
 
 
 
 11 * (find more info at www.hackndev.com)
 
 12 */
 13
 14#include <linux/platform_device.h>
 15#include <linux/delay.h>
 16#include <linux/irq.h>
 17#include <linux/gpio_keys.h>
 18#include <linux/gpio/machine.h>
 19#include <linux/input.h>
 20#include <linux/pda_power.h>
 21#include <linux/pwm.h>
 22#include <linux/pwm_backlight.h>
 23#include <linux/gpio.h>
 24#include <linux/wm97xx.h>
 25#include <linux/power_supply.h>
 
 26
 27#include <asm/mach-types.h>
 28#include <asm/mach/arch.h>
 29#include <asm/mach/map.h>
 30
 31#include "pxa25x.h"
 32#include <mach/audio.h>
 33#include "palmte2.h"
 34#include <linux/platform_data/mmc-pxamci.h>
 35#include <linux/platform_data/video-pxafb.h>
 36#include <linux/platform_data/irda-pxaficp.h>
 37#include "udc.h"
 38#include <linux/platform_data/asoc-palm27x.h>
 39
 40#include "generic.h"
 41#include "devices.h"
 42
 43/******************************************************************************
 44 * Pin configuration
 45 ******************************************************************************/
 46static unsigned long palmte2_pin_config[] __initdata = {
 47	/* MMC */
 48	GPIO6_MMC_CLK,
 49	GPIO8_MMC_CS0,
 50	GPIO10_GPIO,	/* SD detect */
 51	GPIO55_GPIO,	/* SD power */
 52	GPIO51_GPIO,	/* SD r/o switch */
 53
 54	/* AC97 */
 55	GPIO28_AC97_BITCLK,
 56	GPIO29_AC97_SDATA_IN_0,
 57	GPIO30_AC97_SDATA_OUT,
 58	GPIO31_AC97_SYNC,
 59
 60	/* PWM */
 61	GPIO16_PWM0_OUT,
 62
 63	/* USB */
 64	GPIO15_GPIO,	/* usb detect */
 65	GPIO53_GPIO,	/* usb power */
 66
 67	/* IrDA */
 68	GPIO48_GPIO,	/* ir disable */
 69	GPIO46_FICP_RXD,
 70	GPIO47_FICP_TXD,
 71
 72	/* LCD */
 73	GPIOxx_LCD_TFT_16BPP,
 74
 75	/* GPIO KEYS */
 76	GPIO5_GPIO,	/* notes */
 77	GPIO7_GPIO,	/* tasks */
 78	GPIO11_GPIO,	/* calendar */
 79	GPIO13_GPIO,	/* contacts */
 80	GPIO14_GPIO,	/* center */
 81	GPIO19_GPIO,	/* left */
 82	GPIO20_GPIO,	/* right */
 83	GPIO21_GPIO,	/* down */
 84	GPIO22_GPIO,	/* up */
 85
 86	/* MISC */
 87	GPIO1_RST,	/* reset */
 88	GPIO4_GPIO,	/* Hotsync button */
 89	GPIO9_GPIO,	/* power detect */
 90	GPIO15_GPIO,	/* earphone detect */
 91	GPIO37_GPIO,	/* LCD power */
 92	GPIO56_GPIO,	/* Backlight power */
 93};
 94
 95/******************************************************************************
 96 * SD/MMC card controller
 97 ******************************************************************************/
 98static struct pxamci_platform_data palmte2_mci_platform_data = {
 99	.ocr_mask		= MMC_VDD_32_33 | MMC_VDD_33_34,
100};
101
102static struct gpiod_lookup_table palmte2_mci_gpio_table = {
103	.dev_id = "pxa2xx-mci.0",
104	.table = {
105		GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_SD_DETECT_N,
106			    "cd", GPIO_ACTIVE_LOW),
107		GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_SD_READONLY,
108			    "wp", GPIO_ACTIVE_LOW),
109		GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_SD_POWER,
110			    "power", GPIO_ACTIVE_HIGH),
111		{ },
112	},
113};
114
115#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
116/******************************************************************************
117 * GPIO keys
118 ******************************************************************************/
119static struct gpio_keys_button palmte2_pxa_buttons[] = {
120	{KEY_F1,	GPIO_NR_PALMTE2_KEY_CONTACTS,	1, "Contacts" },
121	{KEY_F2,	GPIO_NR_PALMTE2_KEY_CALENDAR,	1, "Calendar" },
122	{KEY_F3,	GPIO_NR_PALMTE2_KEY_TASKS,	1, "Tasks" },
123	{KEY_F4,	GPIO_NR_PALMTE2_KEY_NOTES,	1, "Notes" },
124	{KEY_ENTER,	GPIO_NR_PALMTE2_KEY_CENTER,	1, "Center" },
125	{KEY_LEFT,	GPIO_NR_PALMTE2_KEY_LEFT,	1, "Left" },
126	{KEY_RIGHT,	GPIO_NR_PALMTE2_KEY_RIGHT,	1, "Right" },
127	{KEY_DOWN,	GPIO_NR_PALMTE2_KEY_DOWN,	1, "Down" },
128	{KEY_UP,	GPIO_NR_PALMTE2_KEY_UP,		1, "Up" },
129};
130
131static struct gpio_keys_platform_data palmte2_pxa_keys_data = {
132	.buttons	= palmte2_pxa_buttons,
133	.nbuttons	= ARRAY_SIZE(palmte2_pxa_buttons),
134};
135
136static struct platform_device palmte2_pxa_keys = {
137	.name	= "gpio-keys",
138	.id	= -1,
139	.dev	= {
140		.platform_data = &palmte2_pxa_keys_data,
141	},
142};
143#endif
144
145/******************************************************************************
146 * Backlight
147 ******************************************************************************/
148static struct pwm_lookup palmte2_pwm_lookup[] = {
149	PWM_LOOKUP("pxa25x-pwm.0", 0, "pwm-backlight.0", NULL,
150		   PALMTE2_PERIOD_NS, PWM_POLARITY_NORMAL),
151};
152
153static struct gpio palmte_bl_gpios[] = {
154	{ GPIO_NR_PALMTE2_BL_POWER, GPIOF_INIT_LOW, "Backlight power" },
155	{ GPIO_NR_PALMTE2_LCD_POWER, GPIOF_INIT_LOW, "LCD power" },
156};
157
158static int palmte2_backlight_init(struct device *dev)
159{
160	return gpio_request_array(ARRAY_AND_SIZE(palmte_bl_gpios));
161}
162
163static int palmte2_backlight_notify(struct device *dev, int brightness)
164{
165	gpio_set_value(GPIO_NR_PALMTE2_BL_POWER, brightness);
166	gpio_set_value(GPIO_NR_PALMTE2_LCD_POWER, brightness);
167	return brightness;
168}
169
170static void palmte2_backlight_exit(struct device *dev)
171{
172	gpio_free_array(ARRAY_AND_SIZE(palmte_bl_gpios));
173}
174
175static struct platform_pwm_backlight_data palmte2_backlight_data = {
 
176	.max_brightness	= PALMTE2_MAX_INTENSITY,
177	.dft_brightness	= PALMTE2_MAX_INTENSITY,
 
 
178	.init		= palmte2_backlight_init,
179	.notify		= palmte2_backlight_notify,
180	.exit		= palmte2_backlight_exit,
181};
182
183static struct platform_device palmte2_backlight = {
184	.name	= "pwm-backlight",
185	.dev	= {
186		.parent		= &pxa25x_device_pwm0.dev,
187		.platform_data	= &palmte2_backlight_data,
188	},
189};
190
191/******************************************************************************
192 * IrDA
193 ******************************************************************************/
194static struct pxaficp_platform_data palmte2_ficp_platform_data = {
195	.gpio_pwdown		= GPIO_NR_PALMTE2_IR_DISABLE,
196	.transceiver_cap	= IR_SIRMODE | IR_OFF,
197};
198
199/******************************************************************************
200 * UDC
201 ******************************************************************************/
202static struct gpiod_lookup_table palmte2_udc_gpiod_table = {
203	.dev_id = "gpio-vbus",
204	.table = {
205		GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_USB_DETECT_N,
206			    "vbus", GPIO_ACTIVE_LOW),
207		GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTE2_USB_PULLUP,
208			    "pullup", GPIO_ACTIVE_HIGH),
209		{ },
210	},
211};
212
213static struct platform_device palmte2_gpio_vbus = {
214	.name	= "gpio-vbus",
215	.id	= -1,
 
 
 
216};
217
218/******************************************************************************
219 * Power supply
220 ******************************************************************************/
221static int power_supply_init(struct device *dev)
222{
223	int ret;
224
225	ret = gpio_request(GPIO_NR_PALMTE2_POWER_DETECT, "CABLE_STATE_AC");
226	if (ret)
227		goto err1;
228	ret = gpio_direction_input(GPIO_NR_PALMTE2_POWER_DETECT);
229	if (ret)
230		goto err2;
231
232	return 0;
233
234err2:
235	gpio_free(GPIO_NR_PALMTE2_POWER_DETECT);
236err1:
237	return ret;
238}
239
240static int palmte2_is_ac_online(void)
241{
242	return gpio_get_value(GPIO_NR_PALMTE2_POWER_DETECT);
243}
244
245static void power_supply_exit(struct device *dev)
246{
247	gpio_free(GPIO_NR_PALMTE2_POWER_DETECT);
248}
249
250static char *palmte2_supplicants[] = {
251	"main-battery",
252};
253
254static struct pda_power_pdata power_supply_info = {
255	.init            = power_supply_init,
256	.is_ac_online    = palmte2_is_ac_online,
257	.exit            = power_supply_exit,
258	.supplied_to     = palmte2_supplicants,
259	.num_supplicants = ARRAY_SIZE(palmte2_supplicants),
260};
261
262static struct platform_device power_supply = {
263	.name = "pda-power",
264	.id   = -1,
265	.dev  = {
266		.platform_data = &power_supply_info,
267	},
268};
269
270/******************************************************************************
271 * WM97xx audio, battery
272 ******************************************************************************/
273static struct wm97xx_batt_pdata palmte2_batt_pdata = {
274	.batt_aux	= WM97XX_AUX_ID3,
275	.temp_aux	= WM97XX_AUX_ID2,
 
276	.max_voltage	= PALMTE2_BAT_MAX_VOLTAGE,
277	.min_voltage	= PALMTE2_BAT_MIN_VOLTAGE,
278	.batt_mult	= 1000,
279	.batt_div	= 414,
280	.temp_mult	= 1,
281	.temp_div	= 1,
282	.batt_tech	= POWER_SUPPLY_TECHNOLOGY_LIPO,
283	.batt_name	= "main-batt",
284};
285
286static struct wm97xx_pdata palmte2_wm97xx_pdata = {
287	.batt_pdata	= &palmte2_batt_pdata,
288};
289
290static pxa2xx_audio_ops_t palmte2_ac97_pdata = {
291	.codec_pdata	= { &palmte2_wm97xx_pdata, },
292};
293
294static struct palm27x_asoc_info palmte2_asoc_pdata = {
295	.jack_gpio	= GPIO_NR_PALMTE2_EARPHONE_DETECT,
296};
297
298static struct platform_device palmte2_asoc = {
299	.name = "palm27x-asoc",
300	.id   = -1,
301	.dev  = {
302		.platform_data = &palmte2_asoc_pdata,
303	},
304};
305
306/******************************************************************************
307 * Framebuffer
308 ******************************************************************************/
309static struct pxafb_mode_info palmte2_lcd_modes[] = {
310{
311	.pixclock	= 77757,
312	.xres		= 320,
313	.yres		= 320,
314	.bpp		= 16,
315
316	.left_margin	= 28,
317	.right_margin	= 7,
318	.upper_margin	= 7,
319	.lower_margin	= 5,
320
321	.hsync_len	= 4,
322	.vsync_len	= 1,
323},
324};
325
326static struct pxafb_mach_info palmte2_lcd_screen = {
327	.modes		= palmte2_lcd_modes,
328	.num_modes	= ARRAY_SIZE(palmte2_lcd_modes),
329	.lcd_conn	= LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
330};
331
332/******************************************************************************
333 * Machine init
334 ******************************************************************************/
335static struct platform_device *devices[] __initdata = {
336#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
337	&palmte2_pxa_keys,
338#endif
339	&palmte2_backlight,
340	&power_supply,
341	&palmte2_asoc,
342	&palmte2_gpio_vbus,
343};
344
345/* setup udc GPIOs initial state */
346static void __init palmte2_udc_init(void)
347{
348	if (!gpio_request(GPIO_NR_PALMTE2_USB_PULLUP, "UDC Vbus")) {
349		gpio_direction_output(GPIO_NR_PALMTE2_USB_PULLUP, 1);
350		gpio_free(GPIO_NR_PALMTE2_USB_PULLUP);
351	}
352}
353
354static void __init palmte2_init(void)
355{
356	pxa2xx_mfp_config(ARRAY_AND_SIZE(palmte2_pin_config));
357
358	pxa_set_ffuart_info(NULL);
359	pxa_set_btuart_info(NULL);
360	pxa_set_stuart_info(NULL);
361
362	pxa_set_fb_info(NULL, &palmte2_lcd_screen);
363	gpiod_add_lookup_table(&palmte2_mci_gpio_table);
364	pxa_set_mci_info(&palmte2_mci_platform_data);
365	palmte2_udc_init();
366	pxa_set_ac97_info(&palmte2_ac97_pdata);
367	pxa_set_ficp_info(&palmte2_ficp_platform_data);
368
369	pwm_add_table(palmte2_pwm_lookup, ARRAY_SIZE(palmte2_pwm_lookup));
370	gpiod_add_lookup_table(&palmte2_udc_gpiod_table);
371	platform_add_devices(devices, ARRAY_SIZE(devices));
372}
373
374MACHINE_START(PALMTE2, "Palm Tungsten|E2")
375	.atag_offset	= 0x100,
376	.map_io		= pxa25x_map_io,
377	.nr_irqs	= PXA_NR_IRQS,
378	.init_irq	= pxa25x_init_irq,
379	.handle_irq	= pxa25x_handle_irq,
380	.init_time	= pxa_timer_init,
381	.init_machine	= palmte2_init,
382	.restart	= pxa_restart,
383MACHINE_END