/*
* linux/arch/arm/mach-omap2/board-rx51-peripherals.c
*
* Copyright (C) 2008-2009 Nokia
*
* 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>
#include <linux/input.h>
#include <linux/input/matrix_keypad.h>
#include <linux/spi/spi.h>
#include <linux/wl12xx.h>
#include <linux/i2c.h>
#include <linux/i2c/twl.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/regulator/machine.h>
#include <linux/gpio.h>
#include <linux/gpio_keys.h>
#include <linux/mmc/host.h>
#include <linux/power/isp1704_charger.h>
#include <plat/mcspi.h>
#include <plat/board.h>
#include <plat/common.h>
#include <plat/dma.h>
#include <plat/gpmc.h>
#include <plat/onenand.h>
#include <plat/gpmc-smc91x.h>
#include <mach/board-rx51.h>
#include <sound/tlv320aic3x.h>
#include <sound/tpa6130a2-plat.h>
#include <media/radio-si4713.h>
#include <media/si4713.h>
#include <../drivers/staging/iio/light/tsl2563.h>
#include "mux.h"
#include "hsmmc.h"
#include "common-board-devices.h"
#define SYSTEM_REV_B_USES_VAUX3 0x1699
#define SYSTEM_REV_S_USES_VAUX3 0x8
#define RX51_WL1251_POWER_GPIO 87
#define RX51_WL1251_IRQ_GPIO 42
#define RX51_FMTX_RESET_GPIO 163
#define RX51_FMTX_IRQ 53
#define RX51_USB_TRANSCEIVER_RST_GPIO 67
/* list all spi devices here */
enum {
RX51_SPI_WL1251,
RX51_SPI_MIPID, /* LCD panel */
RX51_SPI_TSC2005, /* Touch Controller */
};
static struct wl12xx_platform_data wl1251_pdata;
#if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE)
static struct tsl2563_platform_data rx51_tsl2563_platform_data = {
.cover_comp_gain = 16,
};
#endif
static struct omap2_mcspi_device_config wl1251_mcspi_config = {
.turbo_mode = 0,
.single_channel = 1,
};
static struct omap2_mcspi_device_config mipid_mcspi_config = {
.turbo_mode = 0,
.single_channel = 1,
};
static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
.turbo_mode = 0,
.single_channel = 1,
};
static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
[RX51_SPI_WL1251] = {
.modalias = "wl1251",
.bus_num = 4,
.chip_select = 0,
.max_speed_hz = 48000000,
.mode = SPI_MODE_3,
.controller_data = &wl1251_mcspi_config,
.platform_data = &wl1251_pdata,
},
[RX51_SPI_MIPID] = {
.modalias = "acx565akm",
.bus_num = 1,
.chip_select = 2,
.max_speed_hz = 6000000,
.controller_data = &mipid_mcspi_config,
},
[RX51_SPI_TSC2005] = {
.modalias = "tsc2005",
.bus_num = 1,
.chip_select = 0,
/* .irq = OMAP_GPIO_IRQ(RX51_TSC2005_IRQ_GPIO),*/
.max_speed_hz = 6000000,
.controller_data = &tsc2005_mcspi_config,
/* .platform_data = &tsc2005_config,*/
},
};
static void rx51_charger_set_power(bool on)
{
gpio_set_value(RX51_USB_TRANSCEIVER_RST_GPIO, on);
}
static struct isp1704_charger_data rx51_charger_data = {
.set_power = rx51_charger_set_power,
};
static struct platform_device rx51_charger_device = {
.name = "isp1704_charger",
.dev = {
.platform_data = &rx51_charger_data,
},
};
static void __init rx51_charger_init(void)
{
WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO,
GPIOF_OUT_INIT_LOW, "isp1704_reset"));
platform_device_register(&rx51_charger_device);
}
#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
#define RX51_GPIO_CAMERA_LENS_COVER 110
#define RX51_GPIO_CAMERA_FOCUS 68
#define RX51_GPIO_CAMERA_CAPTURE 69
#define RX51_GPIO_KEYPAD_SLIDE 71
#define RX51_GPIO_LOCK_BUTTON 113
#define RX51_GPIO_PROXIMITY 89
#define RX51_GPIO_DEBOUNCE_TIMEOUT 10
static struct gpio_keys_button rx51_gpio_keys[] = {
{
.desc = "Camera Lens Cover",
.type = EV_SW,
.code = SW_CAMERA_LENS_COVER,
.gpio = RX51_GPIO_CAMERA_LENS_COVER,
.active_low = 1,
.debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
}, {
.desc = "Camera Focus",
.type = EV_KEY,
.code = KEY_CAMERA_FOCUS,
.gpio = RX51_GPIO_CAMERA_FOCUS,
.active_low = 1,
.debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
}, {
.desc = "Camera Capture",
.type = EV_KEY,
.code = KEY_CAMERA,
.gpio = RX51_GPIO_CAMERA_CAPTURE,
.active_low = 1,
.debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
}, {
.desc = "Lock Button",
.type = EV_KEY,
.code = KEY_SCREENLOCK,
.gpio = RX51_GPIO_LOCK_BUTTON,
.active_low = 1,
.debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT,
}, {
.desc = "Keypad Slide",
.type