// SPDX-License-Identifier: GPL-2.0
//
// Copyright (c) 2006-2009 Victor Chukhantsev, Denis Grigoriev,
// Copyright (c) 2007-2010 Vasily Khoruzhick
//
// based on smdk2440 written by Ben Dooks
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/memblock.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/gpio.h>
#include <linux/gpio/machine.h>
#include <linux/platform_device.h>
#include <linux/serial_core.h>
#include <linux/serial_s3c.h>
#include <linux/input.h>
#include <linux/gpio_keys.h>
#include <linux/device.h>
#include <linux/pda_power.h>
#include <linux/pwm_backlight.h>
#include <linux/pwm.h>
#include <linux/s3c_adc_battery.h>
#include <linux/leds.h>
#include <linux/i2c.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/mmc/host.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <linux/platform_data/i2c-s3c2410.h>
#include <linux/platform_data/mmc-s3cmci.h>
#include <linux/platform_data/mtd-nand-s3c2410.h>
#include <linux/platform_data/touchscreen-s3c2410.h>
#include <linux/platform_data/usb-s3c2410_udc.h>
#include <sound/uda1380.h>
#include <mach/fb.h>
#include <mach/regs-gpio.h>
#include <mach/regs-lcd.h>
#include <mach/gpio-samsung.h>
#include <plat/cpu.h>
#include <plat/devs.h>
#include <plat/pm.h>
#include <plat/samsung-time.h>
#include <plat/gpio-cfg.h>
#include "common.h"
#include "h1940.h"
#define LCD_PWM_PERIOD 192960
#define LCD_PWM_DUTY 127353
static struct map_desc rx1950_iodesc[] __initdata = {
};
static struct s3c2410_uartcfg rx1950_uartcfgs[] __initdata = {
[0] = {
.hwport = 0,
.flags = 0,
.ucon = 0x3c5,
.ulcon = 0x03,
.ufcon = 0x51,
.clk_sel = S3C2410_UCON_CLKSEL3,
},
[1] = {
.hwport = 1,
.flags = 0,
.ucon = 0x3c5,
.ulcon = 0x03,
.ufcon = 0x51,
.clk_sel = S3C2410_UCON_CLKSEL3,
},
/* IR port */
[2] = {
.hwport = 2,
.flags = 0,
.ucon = 0x3c5,
.ulcon = 0x43,
.ufcon = 0xf1,
.clk_sel = S3C2410_UCON_CLKSEL3,
},
};
static struct s3c2410fb_display rx1950_display = {
.type = S3C2410_LCDCON1_TFT,
.width = 240,
.height = 320,
.xres = 240,
.yres = 320,
.bpp = 16,
.pixclock = 260000,
.left_margin = 10,
.right_margin = 20,
.hsync_len = 10,
.upper_margin = 2,
.lower_margin = 2,
.vsync_len = 2,
.lcdcon5 = S3C2410_LCDCON5_FRM565 |
S3C2410_LCDCON5_INVVCLK |
S3C2410_LCDCON5_INVVLINE |
S3C2410_LCDCON5_INVVFRAME |
S3C2410_LCDCON5_HWSWP |
(0x02 << 13) |
(0x02 << 15),
};
static int power_supply_init(struct device *dev)
{
return gpio_request(S3C2410_GPF(2), "cable plugged");
}
static int rx1950_is_ac_online(void)
{
return !gpio_get_value(S3C2410_GPF(2));
}
static void power_supply_exit(struct device *dev)
{
gpio_free(S3C2410_GPF(2));
}
static char *rx1950_supplicants[] = {
"main-battery"
};
static struct pda_power_pdata power_supply_info = {
.init = power_supply_init,
.is_ac_online = rx1950_is_ac_online,
.exit = power_supply_exit,
.supplied_to = rx1950_supplicants,
.num_supplicants = ARRAY_SIZE(rx1950_supplicants),
};
static struct resource power_supply_resources[] = {
[0] = DEFINE_RES_NAMED(IRQ_EINT2, 1, "ac", IORESOURCE_IRQ \
| IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE),
};
static struct platform_device power_supply = {
.name = "pda-power",
.id = -1,
.dev = {
.platform_data =
&power_supply_info,
},
.resource = power_supply_resources,
.num_resources = ARRAY_SIZE(power_supply_resources),
};
static const struct s3c_adc_bat_thresh bat_lut_noac[] = {
{ .volt = 4100, .cur = 156, .level = 100},
{ .volt = 4050, .cur = 156, .level = 95},
{ .volt = 4025, .cur = 141, .level = 90},
{ .volt = 3995, .cur = 144, .level = 85},
{ .volt = 3957, .cur = 162, .level = 80},
{ .volt = 3931, .cur = 147, .level = 75},
{ .volt = 3902, .cur = 147, .level = 70},
{ .volt = 3863, .cur = 153, .level = 65},
{ .volt = 3838, .cur = 150, .level = 60},
{ .volt = 3800, .cur = 153, .level = 55},
{ .volt =