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