2007-11-22 23:59:11 +07:00
|
|
|
/*
|
|
|
|
* Support for HTC Magician PDA phones:
|
|
|
|
* i-mate JAM, O2 Xda mini, Orange SPV M500, Qtek s100, Qtek s110
|
|
|
|
* and T-Mobile MDA Compact.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2006-2007 Philipp Zabel
|
|
|
|
*
|
|
|
|
* Based on hx4700.c, spitz.c and others.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/platform_device.h>
|
2008-04-10 01:27:10 +07:00
|
|
|
#include <linux/delay.h>
|
2008-06-22 19:00:55 +07:00
|
|
|
#include <linux/gpio.h>
|
2007-11-22 23:59:11 +07:00
|
|
|
#include <linux/gpio_keys.h>
|
|
|
|
#include <linux/input.h>
|
2008-04-10 01:22:57 +07:00
|
|
|
#include <linux/mfd/htc-egpio.h>
|
2008-04-12 19:28:02 +07:00
|
|
|
#include <linux/mfd/htc-pasic3.h>
|
2007-11-22 23:59:11 +07:00
|
|
|
#include <linux/mtd/physmap.h>
|
2008-04-10 01:25:56 +07:00
|
|
|
#include <linux/pda_power.h>
|
2015-10-05 15:49:46 +07:00
|
|
|
#include <linux/pwm.h>
|
2008-05-22 20:20:01 +07:00
|
|
|
#include <linux/pwm_backlight.h>
|
2012-03-02 19:56:38 +07:00
|
|
|
#include <linux/regulator/driver.h>
|
|
|
|
#include <linux/regulator/gpio-regulator.h>
|
2009-01-31 18:13:57 +07:00
|
|
|
#include <linux/regulator/machine.h>
|
2009-02-01 17:20:30 +07:00
|
|
|
#include <linux/usb/gpio_vbus.h>
|
2011-02-23 18:38:16 +07:00
|
|
|
#include <linux/i2c/pxa-i2c.h>
|
2007-11-22 23:59:11 +07:00
|
|
|
|
2008-08-05 22:14:15 +07:00
|
|
|
#include <mach/hardware.h>
|
2007-11-22 23:59:11 +07:00
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/mach/arch.h>
|
2012-03-29 00:30:01 +07:00
|
|
|
#include <asm/system_info.h>
|
2009-01-02 22:17:22 +07:00
|
|
|
|
|
|
|
#include <mach/pxa27x.h>
|
2008-08-05 22:14:15 +07:00
|
|
|
#include <mach/magician.h>
|
2012-08-24 20:16:48 +07:00
|
|
|
#include <linux/platform_data/video-pxafb.h>
|
|
|
|
#include <linux/platform_data/mmc-pxamci.h>
|
|
|
|
#include <linux/platform_data/irda-pxaficp.h>
|
|
|
|
#include <linux/platform_data/usb-ohci-pxa27x.h>
|
2007-11-22 23:59:11 +07:00
|
|
|
|
2008-05-22 20:20:01 +07:00
|
|
|
#include "devices.h"
|
2007-11-22 23:59:11 +07:00
|
|
|
#include "generic.h"
|
|
|
|
|
2008-06-27 03:03:54 +07:00
|
|
|
static unsigned long magician_pin_config[] __initdata = {
|
2008-04-12 19:29:22 +07:00
|
|
|
|
|
|
|
/* SDRAM and Static Memory I/O Signals */
|
|
|
|
GPIO20_nSDCS_2,
|
|
|
|
GPIO21_nSDCS_3,
|
|
|
|
GPIO15_nCS_1,
|
2015-09-29 04:09:52 +07:00
|
|
|
GPIO78_nCS_2, /* PASIC3 */
|
|
|
|
GPIO79_nCS_3, /* EGPIO CPLD */
|
2008-04-12 19:29:22 +07:00
|
|
|
GPIO80_nCS_4,
|
|
|
|
GPIO33_nCS_5,
|
|
|
|
|
|
|
|
/* I2C */
|
|
|
|
GPIO117_I2C_SCL,
|
|
|
|
GPIO118_I2C_SDA,
|
|
|
|
|
|
|
|
/* PWM 0 */
|
|
|
|
GPIO16_PWM0_OUT,
|
|
|
|
|
|
|
|
/* I2S */
|
|
|
|
GPIO28_I2S_BITCLK_OUT,
|
|
|
|
GPIO29_I2S_SDATA_IN,
|
|
|
|
GPIO31_I2S_SYNC,
|
|
|
|
GPIO113_I2S_SYSCLK,
|
|
|
|
|
2009-01-18 00:45:41 +07:00
|
|
|
/* SSP 1 */
|
|
|
|
GPIO23_SSP1_SCLK,
|
|
|
|
GPIO24_SSP1_SFRM,
|
|
|
|
GPIO25_SSP1_TXD,
|
|
|
|
|
2008-04-12 19:29:22 +07:00
|
|
|
/* SSP 2 */
|
|
|
|
GPIO19_SSP2_SCLK,
|
|
|
|
GPIO14_SSP2_SFRM,
|
|
|
|
GPIO89_SSP2_TXD,
|
|
|
|
GPIO88_SSP2_RXD,
|
|
|
|
|
|
|
|
/* MMC */
|
|
|
|
GPIO32_MMC_CLK,
|
|
|
|
GPIO92_MMC_DAT_0,
|
|
|
|
GPIO109_MMC_DAT_1,
|
|
|
|
GPIO110_MMC_DAT_2,
|
|
|
|
GPIO111_MMC_DAT_3,
|
|
|
|
GPIO112_MMC_CMD,
|
|
|
|
|
|
|
|
/* LCD */
|
2010-01-04 10:37:14 +07:00
|
|
|
GPIOxx_LCD_TFT_16BPP,
|
2008-04-12 19:29:22 +07:00
|
|
|
|
|
|
|
/* QCI */
|
|
|
|
GPIO12_CIF_DD_7,
|
|
|
|
GPIO17_CIF_DD_6,
|
|
|
|
GPIO50_CIF_DD_3,
|
|
|
|
GPIO51_CIF_DD_2,
|
|
|
|
GPIO52_CIF_DD_4,
|
|
|
|
GPIO53_CIF_MCLK,
|
|
|
|
GPIO54_CIF_PCLK,
|
|
|
|
GPIO55_CIF_DD_1,
|
|
|
|
GPIO81_CIF_DD_0,
|
|
|
|
GPIO82_CIF_DD_5,
|
|
|
|
GPIO84_CIF_FV,
|
|
|
|
GPIO85_CIF_LV,
|
2008-04-20 23:40:11 +07:00
|
|
|
|
|
|
|
/* Magician specific input GPIOs */
|
|
|
|
GPIO9_GPIO, /* unknown */
|
|
|
|
GPIO10_GPIO, /* GSM_IRQ */
|
|
|
|
GPIO13_GPIO, /* CPLD_IRQ */
|
|
|
|
GPIO107_GPIO, /* DS1WM_IRQ */
|
|
|
|
GPIO108_GPIO, /* GSM_READY */
|
|
|
|
GPIO115_GPIO, /* nPEN_IRQ */
|
2008-11-28 15:00:24 +07:00
|
|
|
|
|
|
|
/* I2C */
|
|
|
|
GPIO117_I2C_SCL,
|
|
|
|
GPIO118_I2C_SDA,
|
2008-04-12 19:29:22 +07:00
|
|
|
};
|
|
|
|
|
2007-11-22 23:59:11 +07:00
|
|
|
/*
|
|
|
|
* IRDA
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct pxaficp_platform_data magician_ficp_info = {
|
2009-07-17 17:50:43 +07:00
|
|
|
.gpio_pwdown = GPIO83_MAGICIAN_nIR_EN,
|
|
|
|
.transceiver_cap = IR_SIRMODE | IR_OFF,
|
2007-11-22 23:59:11 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* GPIO Keys
|
|
|
|
*/
|
|
|
|
|
2009-01-18 00:45:44 +07:00
|
|
|
#define INIT_KEY(_code, _gpio, _desc) \
|
|
|
|
{ \
|
2015-09-29 04:09:52 +07:00
|
|
|
.code = KEY_##_code, \
|
|
|
|
.gpio = _gpio, \
|
|
|
|
.desc = _desc, \
|
|
|
|
.type = EV_KEY, \
|
|
|
|
.wakeup = 1, \
|
2009-01-18 00:45:44 +07:00
|
|
|
}
|
|
|
|
|
2007-11-22 23:59:11 +07:00
|
|
|
static struct gpio_keys_button magician_button_table[] = {
|
2009-01-18 00:45:44 +07:00
|
|
|
INIT_KEY(POWER, GPIO0_MAGICIAN_KEY_POWER, "Power button"),
|
|
|
|
INIT_KEY(ESC, GPIO37_MAGICIAN_KEY_HANGUP, "Hangup button"),
|
|
|
|
INIT_KEY(F10, GPIO38_MAGICIAN_KEY_CONTACTS, "Contacts button"),
|
|
|
|
INIT_KEY(CALENDAR, GPIO90_MAGICIAN_KEY_CALENDAR, "Calendar button"),
|
|
|
|
INIT_KEY(CAMERA, GPIO91_MAGICIAN_KEY_CAMERA, "Camera button"),
|
|
|
|
INIT_KEY(UP, GPIO93_MAGICIAN_KEY_UP, "Up button"),
|
|
|
|
INIT_KEY(DOWN, GPIO94_MAGICIAN_KEY_DOWN, "Down button"),
|
|
|
|
INIT_KEY(LEFT, GPIO95_MAGICIAN_KEY_LEFT, "Left button"),
|
|
|
|
INIT_KEY(RIGHT, GPIO96_MAGICIAN_KEY_RIGHT, "Right button"),
|
|
|
|
INIT_KEY(KPENTER, GPIO97_MAGICIAN_KEY_ENTER, "Action button"),
|
|
|
|
INIT_KEY(RECORD, GPIO98_MAGICIAN_KEY_RECORD, "Record button"),
|
|
|
|
INIT_KEY(VOLUMEUP, GPIO100_MAGICIAN_KEY_VOL_UP, "Volume up"),
|
|
|
|
INIT_KEY(VOLUMEDOWN, GPIO101_MAGICIAN_KEY_VOL_DOWN, "Volume down"),
|
|
|
|
INIT_KEY(PHONE, GPIO102_MAGICIAN_KEY_PHONE, "Phone button"),
|
|
|
|
INIT_KEY(PLAY, GPIO99_MAGICIAN_HEADPHONE_IN, "Headset button"),
|
2007-11-22 23:59:11 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_keys_platform_data gpio_keys_data = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.buttons = magician_button_table,
|
|
|
|
.nbuttons = ARRAY_SIZE(magician_button_table),
|
2007-11-22 23:59:11 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device gpio_keys = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.name = "gpio-keys",
|
|
|
|
.dev = {
|
2007-11-22 23:59:11 +07:00
|
|
|
.platform_data = &gpio_keys_data,
|
|
|
|
},
|
2015-09-29 04:09:52 +07:00
|
|
|
.id = -1,
|
2007-11-22 23:59:11 +07:00
|
|
|
};
|
|
|
|
|
2008-04-10 01:22:57 +07:00
|
|
|
/*
|
|
|
|
* EGPIO (Xilinx CPLD)
|
|
|
|
*
|
|
|
|
* 7 32-bit aligned 8-bit registers: 3x output, 1x irq, 3x input
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct resource egpio_resources[] = {
|
|
|
|
[0] = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.start = PXA_CS3_PHYS,
|
|
|
|
.end = PXA_CS3_PHYS + 0x20 - 1,
|
|
|
|
.flags = IORESOURCE_MEM,
|
2008-04-10 01:22:57 +07:00
|
|
|
},
|
|
|
|
[1] = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.start = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
|
|
|
|
.end = PXA_GPIO_TO_IRQ(GPIO13_MAGICIAN_CPLD_IRQ),
|
|
|
|
.flags = IORESOURCE_IRQ,
|
2008-04-10 01:22:57 +07:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct htc_egpio_chip egpio_chips[] = {
|
|
|
|
[0] = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.reg_start = 0,
|
|
|
|
.gpio_base = MAGICIAN_EGPIO(0, 0),
|
|
|
|
.num_gpios = 24,
|
|
|
|
.direction = HTC_EGPIO_OUTPUT,
|
|
|
|
.initial_values = 0x40, /* EGPIO_MAGICIAN_GSM_RESET */
|
2008-04-10 01:22:57 +07:00
|
|
|
},
|
|
|
|
[1] = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.reg_start = 4,
|
|
|
|
.gpio_base = MAGICIAN_EGPIO(4, 0),
|
|
|
|
.num_gpios = 24,
|
|
|
|
.direction = HTC_EGPIO_INPUT,
|
2008-04-10 01:22:57 +07:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct htc_egpio_platform_data egpio_info = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.reg_width = 8,
|
|
|
|
.bus_width = 32,
|
|
|
|
.irq_base = IRQ_BOARD_START,
|
|
|
|
.num_irqs = 4,
|
|
|
|
.ack_register = 3,
|
|
|
|
.chip = egpio_chips,
|
|
|
|
.num_chips = ARRAY_SIZE(egpio_chips),
|
2008-04-10 01:22:57 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device egpio = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.name = "htc-egpio",
|
|
|
|
.id = -1,
|
|
|
|
.resource = egpio_resources,
|
|
|
|
.num_resources = ARRAY_SIZE(egpio_resources),
|
2008-04-10 01:22:57 +07:00
|
|
|
.dev = {
|
|
|
|
.platform_data = &egpio_info,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2007-11-22 23:59:11 +07:00
|
|
|
/*
|
2008-04-10 01:27:10 +07:00
|
|
|
* LCD - Toppoly TD028STEB1 or Samsung LTP280QV
|
2007-11-22 23:59:11 +07:00
|
|
|
*/
|
|
|
|
|
|
|
|
static struct pxafb_mode_info toppoly_modes[] = {
|
|
|
|
{
|
2015-09-29 04:09:52 +07:00
|
|
|
.pixclock = 96153,
|
|
|
|
.bpp = 16,
|
|
|
|
.xres = 240,
|
|
|
|
.yres = 320,
|
|
|
|
.hsync_len = 11,
|
|
|
|
.vsync_len = 3,
|
|
|
|
.left_margin = 19,
|
|
|
|
.upper_margin = 2,
|
|
|
|
.right_margin = 10,
|
|
|
|
.lower_margin = 2,
|
|
|
|
.sync = 0,
|
2007-11-22 23:59:11 +07:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2008-04-10 01:27:10 +07:00
|
|
|
static struct pxafb_mode_info samsung_modes[] = {
|
|
|
|
{
|
2015-09-29 04:32:12 +07:00
|
|
|
.pixclock = 226469,
|
2015-09-29 04:09:52 +07:00
|
|
|
.bpp = 16,
|
|
|
|
.xres = 240,
|
|
|
|
.yres = 320,
|
|
|
|
.hsync_len = 8,
|
|
|
|
.vsync_len = 4,
|
|
|
|
.left_margin = 9,
|
|
|
|
.upper_margin = 4,
|
|
|
|
.right_margin = 9,
|
|
|
|
.lower_margin = 4,
|
|
|
|
.sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
|
2008-04-10 01:27:10 +07:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static void toppoly_lcd_power(int on, struct fb_var_screeninfo *si)
|
|
|
|
{
|
2015-09-29 04:11:11 +07:00
|
|
|
pr_debug("Toppoly LCD power: %s\n", on ? "on" : "off");
|
2008-04-10 01:27:10 +07:00
|
|
|
|
|
|
|
if (on) {
|
|
|
|
gpio_set_value(EGPIO_MAGICIAN_TOPPOLY_POWER, 1);
|
2015-09-29 04:15:57 +07:00
|
|
|
gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 1);
|
2008-04-10 01:27:10 +07:00
|
|
|
udelay(2000);
|
|
|
|
gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1);
|
|
|
|
udelay(2000);
|
|
|
|
/* FIXME: enable LCDC here */
|
|
|
|
udelay(2000);
|
2015-09-29 04:15:57 +07:00
|
|
|
gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 1);
|
2008-04-10 01:27:10 +07:00
|
|
|
udelay(2000);
|
2015-09-29 04:15:57 +07:00
|
|
|
gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 1);
|
2008-04-10 01:27:10 +07:00
|
|
|
} else {
|
|
|
|
msleep(15);
|
2015-09-29 04:15:57 +07:00
|
|
|
gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 0);
|
2008-04-10 01:27:10 +07:00
|
|
|
udelay(500);
|
2015-09-29 04:15:57 +07:00
|
|
|
gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 0);
|
2008-04-10 01:27:10 +07:00
|
|
|
udelay(1000);
|
2015-09-29 04:15:57 +07:00
|
|
|
gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 0);
|
2008-04-10 01:27:10 +07:00
|
|
|
gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void samsung_lcd_power(int on, struct fb_var_screeninfo *si)
|
|
|
|
{
|
2015-09-29 04:11:11 +07:00
|
|
|
pr_debug("Samsung LCD power: %s\n", on ? "on" : "off");
|
2008-04-10 01:27:10 +07:00
|
|
|
|
|
|
|
if (on) {
|
|
|
|
if (system_rev < 3)
|
|
|
|
gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 1);
|
|
|
|
else
|
|
|
|
gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 1);
|
2015-09-29 04:16:14 +07:00
|
|
|
mdelay(6);
|
2015-09-29 04:15:57 +07:00
|
|
|
gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 1);
|
2015-09-29 04:16:14 +07:00
|
|
|
mdelay(6); /* Avdd -> Voff >5ms */
|
2015-09-29 04:15:57 +07:00
|
|
|
gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 1);
|
2015-09-29 04:16:14 +07:00
|
|
|
mdelay(16); /* Voff -> Von >(5+10)ms */
|
2015-09-29 04:15:57 +07:00
|
|
|
gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 1);
|
2008-04-10 01:27:10 +07:00
|
|
|
} else {
|
2015-09-29 04:15:57 +07:00
|
|
|
gpio_set_value(GPIO105_MAGICIAN_LCD_VON_EN, 0);
|
2015-09-29 04:16:14 +07:00
|
|
|
mdelay(16);
|
2015-09-29 04:15:57 +07:00
|
|
|
gpio_set_value(GPIO104_MAGICIAN_LCD_VOFF_EN, 0);
|
2015-09-29 04:16:14 +07:00
|
|
|
mdelay(6);
|
2015-09-29 04:15:57 +07:00
|
|
|
gpio_set_value(GPIO106_MAGICIAN_LCD_DCDC_NRESET, 0);
|
2015-09-29 04:16:14 +07:00
|
|
|
mdelay(6);
|
2008-04-10 01:27:10 +07:00
|
|
|
if (system_rev < 3)
|
|
|
|
gpio_set_value(GPIO75_MAGICIAN_SAMSUNG_POWER, 0);
|
|
|
|
else
|
|
|
|
gpio_set_value(EGPIO_MAGICIAN_LCD_POWER, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-22 23:59:11 +07:00
|
|
|
static struct pxafb_mach_info toppoly_info = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.modes = toppoly_modes,
|
|
|
|
.num_modes = 1,
|
|
|
|
.fixed_modes = 1,
|
|
|
|
.lcd_conn = LCD_COLOR_TFT_16BPP,
|
|
|
|
.pxafb_lcd_power = toppoly_lcd_power,
|
2008-04-10 01:27:10 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct pxafb_mach_info samsung_info = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.modes = samsung_modes,
|
|
|
|
.num_modes = 1,
|
|
|
|
.fixed_modes = 1,
|
|
|
|
.lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL |
|
|
|
|
LCD_ALTERNATE_MAPPING,
|
|
|
|
.pxafb_lcd_power = samsung_lcd_power,
|
2007-11-22 23:59:11 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Backlight
|
|
|
|
*/
|
|
|
|
|
2015-10-05 15:49:46 +07:00
|
|
|
static struct pwm_lookup magician_pwm_lookup[] = {
|
|
|
|
PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight", NULL, 30923,
|
|
|
|
PWM_POLARITY_NORMAL),
|
|
|
|
};
|
|
|
|
|
2011-04-29 03:21:04 +07:00
|
|
|
static struct gpio magician_bl_gpios[] = {
|
2015-09-29 04:09:52 +07:00
|
|
|
{ EGPIO_MAGICIAN_BL_POWER, GPIOF_DIR_OUT, "Backlight power" },
|
|
|
|
{ EGPIO_MAGICIAN_BL_POWER2, GPIOF_DIR_OUT, "Backlight power 2" },
|
2011-04-29 03:21:04 +07:00
|
|
|
};
|
|
|
|
|
2008-05-22 20:20:01 +07:00
|
|
|
static int magician_backlight_init(struct device *dev)
|
2007-11-22 23:59:11 +07:00
|
|
|
{
|
2011-04-29 03:21:04 +07:00
|
|
|
return gpio_request_array(ARRAY_AND_SIZE(magician_bl_gpios));
|
2008-05-22 20:20:01 +07:00
|
|
|
}
|
|
|
|
|
2010-01-04 10:42:01 +07:00
|
|
|
static int magician_backlight_notify(struct device *dev, int brightness)
|
2008-05-22 20:20:01 +07:00
|
|
|
{
|
|
|
|
gpio_set_value(EGPIO_MAGICIAN_BL_POWER, brightness);
|
|
|
|
if (brightness >= 200) {
|
|
|
|
gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 1);
|
|
|
|
return brightness - 72;
|
2007-11-22 23:59:11 +07:00
|
|
|
} else {
|
2008-05-22 20:20:01 +07:00
|
|
|
gpio_set_value(EGPIO_MAGICIAN_BL_POWER2, 0);
|
|
|
|
return brightness;
|
2007-11-22 23:59:11 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-22 20:20:01 +07:00
|
|
|
static void magician_backlight_exit(struct device *dev)
|
|
|
|
{
|
2011-04-29 03:21:04 +07:00
|
|
|
gpio_free_array(ARRAY_AND_SIZE(magician_bl_gpios));
|
2008-05-22 20:20:01 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct platform_pwm_backlight_data backlight_data = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.max_brightness = 272,
|
|
|
|
.dft_brightness = 100,
|
|
|
|
.enable_gpio = -1,
|
|
|
|
.init = magician_backlight_init,
|
|
|
|
.notify = magician_backlight_notify,
|
|
|
|
.exit = magician_backlight_exit,
|
2007-11-22 23:59:11 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device backlight = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.name = "pwm-backlight",
|
|
|
|
.id = -1,
|
|
|
|
.dev = {
|
|
|
|
.parent = &pxa27x_device_pwm0.dev,
|
|
|
|
.platform_data = &backlight_data,
|
2007-11-22 23:59:11 +07:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2008-04-12 19:28:02 +07:00
|
|
|
/*
|
|
|
|
* LEDs
|
|
|
|
*/
|
|
|
|
|
2008-09-25 20:35:48 +07:00
|
|
|
static struct gpio_led gpio_leds[] = {
|
2008-04-12 19:28:02 +07:00
|
|
|
{
|
|
|
|
.name = "magician::vibra",
|
|
|
|
.default_trigger = "none",
|
|
|
|
.gpio = GPIO22_MAGICIAN_VIBRA_EN,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.name = "magician::phone_bl",
|
2009-02-09 23:34:08 +07:00
|
|
|
.default_trigger = "backlight",
|
2008-04-12 19:28:02 +07:00
|
|
|
.gpio = GPIO103_MAGICIAN_LED_KP,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_led_platform_data gpio_led_info = {
|
|
|
|
.leds = gpio_leds,
|
|
|
|
.num_leds = ARRAY_SIZE(gpio_leds),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device leds_gpio = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.name = "leds-gpio",
|
|
|
|
.id = -1,
|
|
|
|
.dev = {
|
2008-04-12 19:28:02 +07:00
|
|
|
.platform_data = &gpio_led_info,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pasic3_led pasic3_leds[] = {
|
|
|
|
{
|
|
|
|
.led = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.name = "magician:red",
|
2008-04-12 19:28:02 +07:00
|
|
|
.default_trigger = "ds2760-battery.0-charging",
|
|
|
|
},
|
2015-09-29 04:09:52 +07:00
|
|
|
.hw_num = 0,
|
|
|
|
.bit2 = PASIC3_BIT2_LED0,
|
|
|
|
.mask = PASIC3_MASK_LED0,
|
2008-04-12 19:28:02 +07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.led = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.name = "magician:green",
|
2008-04-12 19:28:02 +07:00
|
|
|
.default_trigger = "ds2760-battery.0-charging-or-full",
|
|
|
|
},
|
2015-09-29 04:09:52 +07:00
|
|
|
.hw_num = 1,
|
|
|
|
.bit2 = PASIC3_BIT2_LED1,
|
|
|
|
.mask = PASIC3_MASK_LED1,
|
2008-04-12 19:28:02 +07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.led = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.name = "magician:blue",
|
2008-04-12 19:28:02 +07:00
|
|
|
.default_trigger = "bluetooth",
|
|
|
|
},
|
2015-09-29 04:09:52 +07:00
|
|
|
.hw_num = 2,
|
|
|
|
.bit2 = PASIC3_BIT2_LED2,
|
|
|
|
.mask = PASIC3_MASK_LED2,
|
2008-04-12 19:28:02 +07:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2008-04-25 00:10:46 +07:00
|
|
|
static struct pasic3_leds_machinfo pasic3_leds_info = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.num_leds = ARRAY_SIZE(pasic3_leds),
|
|
|
|
.power_gpio = EGPIO_MAGICIAN_LED_POWER,
|
|
|
|
.leds = pasic3_leds,
|
2008-04-12 19:28:02 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* PASIC3 with DS1WM
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct resource pasic3_resources[] = {
|
|
|
|
[0] = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.start = PXA_CS2_PHYS,
|
2008-04-12 19:28:02 +07:00
|
|
|
.end = PXA_CS2_PHYS + 0x1b,
|
2015-09-29 04:09:52 +07:00
|
|
|
.flags = IORESOURCE_MEM,
|
2008-04-12 19:28:02 +07:00
|
|
|
},
|
|
|
|
/* No IRQ handler in the PASIC3, DS1WM needs an external IRQ */
|
|
|
|
[1] = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.start = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
|
|
|
|
.end = PXA_GPIO_TO_IRQ(GPIO107_MAGICIAN_DS1WM_IRQ),
|
|
|
|
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
|
2008-04-12 19:28:02 +07:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pasic3_platform_data pasic3_platform_data = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.led_pdata = &pasic3_leds_info,
|
|
|
|
.clock_rate = 4000000,
|
2008-04-12 19:28:02 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device pasic3 = {
|
|
|
|
.name = "pasic3",
|
|
|
|
.id = -1,
|
|
|
|
.num_resources = ARRAY_SIZE(pasic3_resources),
|
|
|
|
.resource = pasic3_resources,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &pasic3_platform_data,
|
|
|
|
},
|
|
|
|
};
|
2007-11-22 23:59:11 +07:00
|
|
|
|
2009-02-01 17:20:30 +07:00
|
|
|
/*
|
|
|
|
* USB "Transceiver"
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct resource gpio_vbus_resource = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
.start = IRQ_MAGICIAN_VBUS,
|
|
|
|
.end = IRQ_MAGICIAN_VBUS,
|
2009-02-01 17:20:30 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_vbus_mach_info gpio_vbus_info = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.gpio_pullup = GPIO27_MAGICIAN_USBC_PUEN,
|
2015-09-29 04:32:40 +07:00
|
|
|
.gpio_vbus = EGPIO_MAGICIAN_CABLE_VBUS,
|
2009-02-01 17:20:30 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device gpio_vbus = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.name = "gpio-vbus",
|
|
|
|
.id = -1,
|
|
|
|
.num_resources = 1,
|
|
|
|
.resource = &gpio_vbus_resource,
|
2009-02-01 17:20:30 +07:00
|
|
|
.dev = {
|
|
|
|
.platform_data = &gpio_vbus_info,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2008-04-10 01:25:56 +07:00
|
|
|
/*
|
|
|
|
* External power
|
|
|
|
*/
|
|
|
|
|
2015-09-29 04:33:02 +07:00
|
|
|
static int magician_supply_init(struct device *dev)
|
2008-05-22 16:14:21 +07:00
|
|
|
{
|
2015-09-29 04:33:02 +07:00
|
|
|
int ret = -1;
|
|
|
|
|
|
|
|
ret = gpio_request(EGPIO_MAGICIAN_CABLE_TYPE, "Cable is AC charger");
|
|
|
|
if (ret) {
|
|
|
|
pr_err("Cannot request AC/USB charger GPIO (%i)\n", ret);
|
|
|
|
goto err_ac;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = gpio_request(EGPIO_MAGICIAN_CABLE_INSERTED, "Cable inserted");
|
|
|
|
if (ret) {
|
|
|
|
pr_err("Cannot request cable detection GPIO (%i)\n", ret);
|
|
|
|
goto err_usb;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_usb:
|
|
|
|
gpio_free(EGPIO_MAGICIAN_CABLE_TYPE);
|
|
|
|
err_ac:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void magician_set_charge(int flags)
|
|
|
|
{
|
|
|
|
if (flags & PDA_POWER_CHARGE_AC) {
|
|
|
|
pr_debug("Charging from AC\n");
|
|
|
|
gpio_set_value(EGPIO_MAGICIAN_NICD_CHARGE, 1);
|
|
|
|
} else if (flags & PDA_POWER_CHARGE_USB) {
|
|
|
|
pr_debug("Charging from USB\n");
|
|
|
|
gpio_set_value(EGPIO_MAGICIAN_NICD_CHARGE, 1);
|
|
|
|
} else {
|
|
|
|
pr_debug("Charging disabled\n");
|
|
|
|
gpio_set_value(EGPIO_MAGICIAN_NICD_CHARGE, 0);
|
|
|
|
}
|
2008-05-22 16:14:21 +07:00
|
|
|
}
|
|
|
|
|
2008-04-10 01:25:56 +07:00
|
|
|
static int magician_is_ac_online(void)
|
|
|
|
{
|
2015-09-29 04:33:02 +07:00
|
|
|
return gpio_get_value(EGPIO_MAGICIAN_CABLE_INSERTED) &&
|
|
|
|
gpio_get_value(EGPIO_MAGICIAN_CABLE_TYPE); /* AC=1 */
|
|
|
|
}
|
|
|
|
|
|
|
|
static int magician_is_usb_online(void)
|
|
|
|
{
|
|
|
|
return gpio_get_value(EGPIO_MAGICIAN_CABLE_INSERTED) &&
|
|
|
|
(!gpio_get_value(EGPIO_MAGICIAN_CABLE_TYPE)); /* USB=0 */
|
2008-04-10 01:25:56 +07:00
|
|
|
}
|
|
|
|
|
2015-09-29 04:33:02 +07:00
|
|
|
static void magician_supply_exit(struct device *dev)
|
2008-05-22 16:14:21 +07:00
|
|
|
{
|
2015-09-29 04:33:02 +07:00
|
|
|
gpio_free(EGPIO_MAGICIAN_CABLE_INSERTED);
|
2015-09-29 04:32:40 +07:00
|
|
|
gpio_free(EGPIO_MAGICIAN_CABLE_TYPE);
|
2008-05-22 16:14:21 +07:00
|
|
|
}
|
|
|
|
|
2008-04-12 19:28:02 +07:00
|
|
|
static char *magician_supplicants[] = {
|
|
|
|
"ds2760-battery.0", "backup-battery"
|
|
|
|
};
|
|
|
|
|
2008-04-10 01:25:56 +07:00
|
|
|
static struct pda_power_pdata power_supply_info = {
|
2015-09-29 04:33:02 +07:00
|
|
|
.init = magician_supply_init,
|
|
|
|
.exit = magician_supply_exit,
|
2015-09-29 04:09:52 +07:00
|
|
|
.is_ac_online = magician_is_ac_online,
|
2015-09-29 04:33:02 +07:00
|
|
|
.is_usb_online = magician_is_usb_online,
|
|
|
|
.set_charge = magician_set_charge,
|
2015-09-29 04:09:52 +07:00
|
|
|
.supplied_to = magician_supplicants,
|
|
|
|
.num_supplicants = ARRAY_SIZE(magician_supplicants),
|
2008-04-10 01:25:56 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource power_supply_resources[] = {
|
|
|
|
[0] = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.name = "ac",
|
|
|
|
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
|
|
|
|
IORESOURCE_IRQ_LOWEDGE,
|
|
|
|
.start = IRQ_MAGICIAN_VBUS,
|
|
|
|
.end = IRQ_MAGICIAN_VBUS,
|
2008-04-10 01:25:56 +07:00
|
|
|
},
|
|
|
|
[1] = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.name = "usb",
|
|
|
|
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
|
|
|
|
IORESOURCE_IRQ_LOWEDGE,
|
|
|
|
.start = IRQ_MAGICIAN_VBUS,
|
|
|
|
.end = IRQ_MAGICIAN_VBUS,
|
2008-04-10 01:25:56 +07:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device power_supply = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.name = "pda-power",
|
|
|
|
.id = -1,
|
|
|
|
.dev = {
|
2008-04-10 01:25:56 +07:00
|
|
|
.platform_data = &power_supply_info,
|
|
|
|
},
|
2015-09-29 04:09:52 +07:00
|
|
|
.resource = power_supply_resources,
|
|
|
|
.num_resources = ARRAY_SIZE(power_supply_resources),
|
2008-04-10 01:25:56 +07:00
|
|
|
};
|
|
|
|
|
2009-01-31 18:13:57 +07:00
|
|
|
/*
|
|
|
|
* Battery charger
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct regulator_consumer_supply bq24022_consumers[] = {
|
2012-05-08 15:25:10 +07:00
|
|
|
REGULATOR_SUPPLY("vbus_draw", NULL),
|
|
|
|
REGULATOR_SUPPLY("ac_draw", NULL),
|
2009-01-31 18:13:57 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data bq24022_init_data = {
|
|
|
|
.constraints = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.max_uA = 500000,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_CURRENT |
|
|
|
|
REGULATOR_CHANGE_STATUS,
|
2009-01-31 18:13:57 +07:00
|
|
|
},
|
2015-09-29 04:09:52 +07:00
|
|
|
.num_consumer_supplies = ARRAY_SIZE(bq24022_consumers),
|
|
|
|
.consumer_supplies = bq24022_consumers,
|
2009-01-31 18:13:57 +07:00
|
|
|
};
|
|
|
|
|
2012-03-02 19:56:38 +07:00
|
|
|
static struct gpio bq24022_gpios[] = {
|
|
|
|
{ EGPIO_MAGICIAN_BQ24022_ISET2, GPIOF_OUT_INIT_LOW, "bq24022_iset2" },
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_regulator_state bq24022_states[] = {
|
|
|
|
{ .value = 100000, .gpios = (0 << 0) },
|
|
|
|
{ .value = 500000, .gpios = (1 << 0) },
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct gpio_regulator_config bq24022_info = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.supply_name = "bq24022",
|
2012-03-02 19:56:38 +07:00
|
|
|
|
2015-09-29 04:09:52 +07:00
|
|
|
.enable_gpio = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN,
|
|
|
|
.enable_high = 0,
|
2015-09-29 04:33:02 +07:00
|
|
|
.enabled_at_boot = 1,
|
2012-03-02 19:56:38 +07:00
|
|
|
|
2015-09-29 04:09:52 +07:00
|
|
|
.gpios = bq24022_gpios,
|
|
|
|
.nr_gpios = ARRAY_SIZE(bq24022_gpios),
|
2012-03-02 19:56:38 +07:00
|
|
|
|
2015-09-29 04:09:52 +07:00
|
|
|
.states = bq24022_states,
|
|
|
|
.nr_states = ARRAY_SIZE(bq24022_states),
|
2012-03-02 19:56:38 +07:00
|
|
|
|
2015-09-29 04:09:52 +07:00
|
|
|
.type = REGULATOR_CURRENT,
|
|
|
|
.init_data = &bq24022_init_data,
|
2009-01-31 18:13:57 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device bq24022 = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.name = "gpio-regulator",
|
|
|
|
.id = -1,
|
|
|
|
.dev = {
|
2009-01-31 18:13:57 +07:00
|
|
|
.platform_data = &bq24022_info,
|
|
|
|
},
|
|
|
|
};
|
2008-04-10 01:25:56 +07:00
|
|
|
|
2008-04-10 01:24:55 +07:00
|
|
|
/*
|
|
|
|
* MMC/SD
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int magician_mci_init(struct device *dev,
|
2015-09-29 04:09:52 +07:00
|
|
|
irq_handler_t detect_irq, void *data)
|
2008-04-10 01:24:55 +07:00
|
|
|
{
|
2013-12-09 17:22:22 +07:00
|
|
|
return request_irq(IRQ_MAGICIAN_SD, detect_irq, 0,
|
2015-09-29 04:09:52 +07:00
|
|
|
"mmc card detect", data);
|
2008-04-10 01:24:55 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void magician_mci_exit(struct device *dev, void *data)
|
|
|
|
{
|
|
|
|
free_irq(IRQ_MAGICIAN_SD, data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct pxamci_platform_data magician_mci_info = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
|
|
|
|
.init = magician_mci_init,
|
|
|
|
.exit = magician_mci_exit,
|
2009-07-07 03:16:42 +07:00
|
|
|
.gpio_card_detect = -1,
|
|
|
|
.gpio_card_ro = EGPIO_MAGICIAN_nSD_READONLY,
|
|
|
|
.gpio_card_ro_invert = 1,
|
|
|
|
.gpio_power = EGPIO_MAGICIAN_SD_POWER,
|
2008-04-10 01:24:55 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-11-22 23:59:11 +07:00
|
|
|
/*
|
|
|
|
* USB OHCI
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct pxaohci_platform_data magician_ohci_info = {
|
2008-09-27 14:49:57 +07:00
|
|
|
.port_mode = PMM_PERPORT_MODE,
|
|
|
|
.flags = ENABLE_PORT1 | ENABLE_PORT3 | POWER_CONTROL_LOW,
|
|
|
|
.power_budget = 0,
|
2007-11-22 23:59:11 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* StrataFlash
|
|
|
|
*/
|
|
|
|
|
2011-05-18 16:51:55 +07:00
|
|
|
static void magician_set_vpp(struct platform_device *pdev, int vpp)
|
2008-04-10 01:24:05 +07:00
|
|
|
{
|
|
|
|
gpio_set_value(EGPIO_MAGICIAN_FLASH_VPP, vpp);
|
|
|
|
}
|
|
|
|
|
2007-11-22 23:59:11 +07:00
|
|
|
static struct resource strataflash_resource = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.start = PXA_CS0_PHYS,
|
|
|
|
.end = PXA_CS0_PHYS + SZ_64M - 1,
|
|
|
|
.flags = IORESOURCE_MEM,
|
2007-11-22 23:59:11 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct physmap_flash_data strataflash_data = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.width = 4,
|
|
|
|
.set_vpp = magician_set_vpp,
|
2007-11-22 23:59:11 +07:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device strataflash = {
|
2015-09-29 04:09:52 +07:00
|
|
|
.name = "physmap-flash",
|
|
|
|
.id = -1,
|
|
|
|
.resource = &strataflash_resource,
|
|
|
|
.num_resources = 1,
|
2007-11-22 23:59:11 +07:00
|
|
|
.dev = {
|
|
|
|
.platform_data = &strataflash_data,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2009-04-17 16:38:23 +07:00
|
|
|
/*
|
|
|
|
* I2C
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct i2c_pxa_platform_data i2c_info = {
|
|
|
|
.fast_mode = 1,
|
|
|
|
};
|
|
|
|
|
2007-11-22 23:59:11 +07:00
|
|
|
/*
|
|
|
|
* Platform devices
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct platform_device *devices[] __initdata = {
|
|
|
|
&gpio_keys,
|
2008-04-10 01:22:57 +07:00
|
|
|
&egpio,
|
2007-11-22 23:59:11 +07:00
|
|
|
&backlight,
|
2008-04-12 19:28:02 +07:00
|
|
|
&pasic3,
|
2009-01-31 18:13:57 +07:00
|
|
|
&bq24022,
|
2009-02-01 17:20:30 +07:00
|
|
|
&gpio_vbus,
|
2008-04-10 01:25:56 +07:00
|
|
|
&power_supply,
|
2007-11-22 23:59:11 +07:00
|
|
|
&strataflash,
|
2008-04-12 19:28:02 +07:00
|
|
|
&leds_gpio,
|
2007-11-22 23:59:11 +07:00
|
|
|
};
|
|
|
|
|
2011-04-29 03:21:04 +07:00
|
|
|
static struct gpio magician_global_gpios[] = {
|
2015-09-29 04:09:52 +07:00
|
|
|
{ GPIO13_MAGICIAN_CPLD_IRQ, GPIOF_IN, "CPLD_IRQ" },
|
2011-04-29 03:21:04 +07:00
|
|
|
{ GPIO107_MAGICIAN_DS1WM_IRQ, GPIOF_IN, "DS1WM_IRQ" },
|
2015-09-29 04:15:57 +07:00
|
|
|
|
|
|
|
/* NOTICE valid LCD init sequence */
|
|
|
|
{ GPIO106_MAGICIAN_LCD_DCDC_NRESET, GPIOF_OUT_INIT_LOW, "LCD DCDC nreset" },
|
|
|
|
{ GPIO104_MAGICIAN_LCD_VOFF_EN, GPIOF_OUT_INIT_LOW, "LCD VOFF enable" },
|
|
|
|
{ GPIO105_MAGICIAN_LCD_VON_EN, GPIOF_OUT_INIT_LOW, "LCD VON enable" },
|
2011-04-29 03:21:04 +07:00
|
|
|
{ GPIO83_MAGICIAN_nIR_EN, GPIOF_OUT_INIT_HIGH, "nIR_EN" },
|
|
|
|
};
|
|
|
|
|
2007-11-22 23:59:11 +07:00
|
|
|
static void __init magician_init(void)
|
|
|
|
{
|
2008-04-10 01:27:10 +07:00
|
|
|
void __iomem *cpld;
|
|
|
|
int lcd_select;
|
2008-04-20 23:39:12 +07:00
|
|
|
int err;
|
|
|
|
|
2008-04-12 19:29:22 +07:00
|
|
|
pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config));
|
2011-04-29 03:21:04 +07:00
|
|
|
err = gpio_request_array(ARRAY_AND_SIZE(magician_global_gpios));
|
|
|
|
if (err)
|
2015-09-29 04:10:43 +07:00
|
|
|
pr_err("magician: Failed to request global GPIOs: %d\n", err);
|
2008-04-12 19:29:22 +07:00
|
|
|
|
2009-11-09 12:34:08 +07:00
|
|
|
pxa_set_ffuart_info(NULL);
|
|
|
|
pxa_set_btuart_info(NULL);
|
|
|
|
pxa_set_stuart_info(NULL);
|
|
|
|
|
2015-10-05 15:49:46 +07:00
|
|
|
pwm_add_table(magician_pwm_lookup, ARRAY_SIZE(magician_pwm_lookup));
|
2009-04-28 18:31:08 +07:00
|
|
|
platform_add_devices(ARRAY_AND_SIZE(devices));
|
2008-04-20 23:39:12 +07:00
|
|
|
|
2011-04-29 03:21:04 +07:00
|
|
|
pxa_set_ficp_info(&magician_ficp_info);
|
2009-01-18 00:45:42 +07:00
|
|
|
pxa27x_set_i2c_power_info(NULL);
|
2009-04-17 16:38:23 +07:00
|
|
|
pxa_set_i2c_info(&i2c_info);
|
2008-04-10 01:24:55 +07:00
|
|
|
pxa_set_mci_info(&magician_mci_info);
|
2007-11-22 23:59:11 +07:00
|
|
|
pxa_set_ohci_info(&magician_ohci_info);
|
2008-04-10 01:27:10 +07:00
|
|
|
|
|
|
|
/* Check LCD type we have */
|
|
|
|
cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000);
|
|
|
|
if (cpld) {
|
2015-09-29 04:09:52 +07:00
|
|
|
u8 board_id = __raw_readb(cpld + 0x14);
|
|
|
|
|
2008-04-20 23:39:12 +07:00
|
|
|
iounmap(cpld);
|
2008-04-10 01:27:10 +07:00
|
|
|
system_rev = board_id & 0x7;
|
|
|
|
lcd_select = board_id & 0x8;
|
|
|
|
pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly");
|
2011-04-29 03:21:04 +07:00
|
|
|
if (lcd_select && (system_rev < 3))
|
2015-09-29 04:15:57 +07:00
|
|
|
/* NOTICE valid LCD init sequence */
|
2011-04-29 03:21:04 +07:00
|
|
|
gpio_request_one(GPIO75_MAGICIAN_SAMSUNG_POWER,
|
2015-09-29 04:11:34 +07:00
|
|
|
GPIOF_OUT_INIT_LOW, "Samsung LCD Power");
|
2015-09-29 04:09:52 +07:00
|
|
|
pxa_set_fb_info(NULL,
|
|
|
|
lcd_select ? &samsung_info : &toppoly_info);
|
2008-04-10 01:27:10 +07:00
|
|
|
} else
|
|
|
|
pr_err("LCD detection: CPLD mapping failed\n");
|
2007-11-22 23:59:11 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
MACHINE_START(MAGICIAN, "HTC Magician")
|
2015-09-29 04:09:52 +07:00
|
|
|
.atag_offset = 0x100,
|
|
|
|
.map_io = pxa27x_map_io,
|
|
|
|
.nr_irqs = MAGICIAN_NR_IRQS,
|
|
|
|
.init_irq = pxa27x_init_irq,
|
|
|
|
.handle_irq = pxa27x_handle_irq,
|
|
|
|
.init_machine = magician_init,
|
2012-11-09 02:40:59 +07:00
|
|
|
.init_time = pxa_timer_init,
|
2011-11-04 21:15:53 +07:00
|
|
|
.restart = pxa_restart,
|
2007-11-22 23:59:11 +07:00
|
|
|
MACHINE_END
|