--- /dev/null
+/*
+ * wm831x-spi.c -- SPI access for Wolfson WM831x PMICs
+ *
+ * Copyright 2009,2010 Wolfson Microelectronics PLC.
+ *
+ * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/spi/spi.h>
+#include <linux/gpio.h>
+#include <linux/input.h>
+#include <linux/platform_device.h>
+
+#include <linux/mfd/wm831x/core.h>
+#include <linux/mfd/wm831x/pdata.h>
+#include <linux/mfd/wm831x/irq.h>
+#include <linux/mfd/wm831x/auxadc.h>
+#include <linux/mfd/wm831x/otp.h>
+#include <linux/mfd/wm831x/regulator.h>
+#include <linux/mfd/wm831x/pmu.h>
+
+
+
+/* DC-DC*/
+#define WM831X_BUCKV_MAX_SELECTOR 0x68
+#define WM831X_BUCKP_MAX_SELECTOR 0x66
+
+#define WM831X_DCDC_MODE_FAST 0
+#define WM831X_DCDC_MODE_NORMAL 1
+#define WM831X_DCDC_MODE_IDLE 2
+#define WM831X_DCDC_MODE_STANDBY 3
+
+//#define WM831X_DCDC_MAX_NAME 6
+
+/* Register offsets in control block */
+#define WM831X_DCDC_CONTROL_1 0
+#define WM831X_DCDC_CONTROL_2 1
+#define WM831X_DCDC_ON_CONFIG 2
+#define WM831X_DCDC_SLEEP_CONTROL 3
+#define WM831X_DCDC_DVS_CONTROL 4
+
+/* LDO*/
+#define WM831X_LDO_CONTROL 0
+#define WM831X_LDO_ON_CONTROL 1
+#define WM831X_LDO_SLEEP_CONTROL 2
+
+#define WM831X_ALIVE_LDO_ON_CONTROL 0
+#define WM831X_ALIVE_LDO_SLEEP_CONTROL 1
+
+static int wm831x_spi_read_device(struct wm831x *wm831x, unsigned short reg,
+ int bytes, void *dest)
+{
+ u16 tx_val;
+ u16 *d = dest;
+ int r, ret;
+
+ /* Go register at a time */
+ for (r = reg; r < reg + (bytes / 2); r++) {
+ tx_val = cpu_to_be16(r | 0x8000);
+
+ ret = spi_write_then_read(wm831x->control_data,
+ (u8 *)&tx_val, 2, (u8 *)d, 2);
+ if (ret != 0)
+ return ret;
+
+ //*d = be16_to_cpu(*d);
+
+ d++;
+ }
+
+ return 0;
+}
+
+static int wm831x_spi_write_device(struct wm831x *wm831x, unsigned short reg,
+ int bytes, void *src)
+{
+ struct spi_device *spi = wm831x->control_data;
+ u16 *s = src;
+ u16 data[2];
+ int ret, r;
+
+ /* Go register at a time */
+ for (r = reg; r < reg + (bytes / 2); r++) {
+ data[0] = cpu_to_be16(r);
+ data[1] = *s++;
+ //printk("%s:reg=0x%x,data=0x%x\n",__FUNCTION__,be16_to_cpu(data[0]),be16_to_cpu(data[1]));
+ ret = spi_write(spi, (char *)&data, sizeof(data));
+ if (ret != 0)
+ return ret;
+ }
+
+ return 0;
+}
+
+
+int wm831x_isinkv_values[WM831X_ISINK_MAX_ISEL + 1] = {
+ 2,
+ 2,
+ 3,
+ 3,
+ 4,
+ 5,
+ 6,
+ 7,
+ 8,
+ 10,
+ 11,
+ 13,
+ 16,
+ 19,
+ 23,
+ 27,
+ 32,
+ 38,
+ 45,
+ 54,
+ 64,
+ 76,
+ 91,
+ 108,
+ 128,
+ 152,
+ 181,
+ 215,
+ 256,
+ 304,
+ 362,
+ 431,
+ 512,
+ 609,
+ 724,
+ 861,
+ 1024,
+ 1218,
+ 1448,
+ 1722,
+ 2048,
+ 2435,
+ 2896,
+ 3444,
+ 4096,
+ 4871,
+ 5793,
+ 6889,
+ 8192,
+ 9742,
+ 11585,
+ 13777,
+ 16384,
+ 19484,
+ 23170,
+ 27554,
+};
+EXPORT_SYMBOL_GPL(wm831x_isinkv_values);
+
+static int wm831x_reg_locked(struct wm831x *wm831x, unsigned short reg)
+{
+ if (!wm831x->locked)
+ return 0;
+
+ switch (reg) {
+ case WM831X_WATCHDOG:
+ case WM831X_DC4_CONTROL:
+ case WM831X_ON_PIN_CONTROL:
+ case WM831X_BACKUP_CHARGER_CONTROL:
+ case WM831X_CHARGER_CONTROL_1:
+ case WM831X_CHARGER_CONTROL_2:
+ return 1;
+
+ default:
+ return 0;
+ }
+}
+
+/**
+ * wm831x_reg_unlock: Unlock user keyed registers
+ *
+ * The WM831x has a user key preventing writes to particularly
+ * critical registers. This function locks those registers,
+ * allowing writes to them.
+ */
+void wm831x_reg_lock(struct wm831x *wm831x)
+{
+ int ret;
+
+ ret = wm831x_reg_write(wm831x, WM831X_SECURITY_KEY, 0);
+ if (ret == 0) {
+ dev_vdbg(wm831x->dev, "Registers locked\n");
+
+ mutex_lock(&wm831x->io_lock);
+ WARN_ON(wm831x->locked);
+ wm831x->locked = 1;
+ mutex_unlock(&wm831x->io_lock);
+ } else {
+ dev_err(wm831x->dev, "Failed to lock registers: %d\n", ret);
+ }
+
+}
+EXPORT_SYMBOL_GPL(wm831x_reg_lock);
+
+/**
+ * wm831x_reg_unlock: Unlock user keyed registers
+ *
+ * The WM831x has a user key preventing writes to particularly
+ * critical registers. This function locks those registers,
+ * preventing spurious writes.
+ */
+int wm831x_reg_unlock(struct wm831x *wm831x)
+{
+ int ret;
+
+ /* 0x9716 is the value required to unlock the registers */
+ ret = wm831x_reg_write(wm831x, WM831X_SECURITY_KEY, 0x9716);
+ if (ret == 0) {
+ dev_vdbg(wm831x->dev, "Registers unlocked\n");
+
+ mutex_lock(&wm831x->io_lock);
+ WARN_ON(!wm831x->locked);
+ wm831x->locked = 0;
+ mutex_unlock(&wm831x->io_lock);
+ }
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(wm831x_reg_unlock);
+
+static int wm831x_read(struct wm831x *wm831x, unsigned short reg,
+ int bytes, void *dest)
+{
+ int ret, i;
+ u16 *buf = dest;
+
+ BUG_ON(bytes % 2);
+ BUG_ON(bytes <= 0);
+
+ ret = wm831x->read_dev(wm831x, reg, bytes, dest);
+ if (ret < 0)
+ return ret;
+
+ for (i = 0; i < bytes / 2; i++) {
+ buf[i] = be16_to_cpu(buf[i]);
+
+ dev_vdbg(wm831x->dev, "Read %04x from R%d(0x%x)\n",
+ buf[i], reg + i, reg + i);
+ }
+
+ return 0;
+}
+
+/**
+ * wm831x_reg_read: Read a single WM831x register.
+ *
+ * @wm831x: Device to read from.
+ * @reg: Register to read.
+ */
+int wm831x_reg_read(struct wm831x *wm831x, unsigned short reg)
+{
+ unsigned short val;
+ int ret;
+
+ mutex_lock(&wm831x->io_lock);
+
+ ret = wm831x_read(wm831x, reg, 2, &val);
+
+ mutex_unlock(&wm831x->io_lock);
+
+ if (ret < 0)
+ return ret;
+ else
+ return val;
+}
+EXPORT_SYMBOL_GPL(wm831x_reg_read);
+
+/**
+ * wm831x_bulk_read: Read multiple WM831x registers
+ *
+ * @wm831x: Device to read from
+ * @reg: First register
+ * @count: Number of registers
+ * @buf: Buffer to fill.
+ */
+int wm831x_bulk_read(struct wm831x *wm831x, unsigned short reg,
+ int count, u16 *buf)
+{
+ int ret;
+
+ mutex_lock(&wm831x->io_lock);
+
+ ret = wm831x_read(wm831x, reg, count * 2, buf);
+
+ mutex_unlock(&wm831x->io_lock);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(wm831x_bulk_read);
+
+static int wm831x_write(struct wm831x *wm831x, unsigned short reg,
+ int bytes, void *src)
+{
+ u16 *buf = src;
+ int i;
+
+ BUG_ON(bytes % 2);
+ BUG_ON(bytes <= 0);
+
+ for (i = 0; i < bytes / 2; i++) {
+ if (wm831x_reg_locked(wm831x, reg))
+ return -EPERM;
+
+ dev_vdbg(wm831x->dev, "Write %04x to R%d(0x%x)\n",
+ buf[i], reg + i, reg + i);
+
+ buf[i] = cpu_to_be16(buf[i]);
+ }
+
+ return wm831x->write_dev(wm831x, reg, bytes, src);
+}
+
+/**
+ * wm831x_reg_write: Write a single WM831x register.
+ *
+ * @wm831x: Device to write to.
+ * @reg: Register to write to.
+ * @val: Value to write.
+ */
+int wm831x_reg_write(struct wm831x *wm831x, unsigned short reg,
+ unsigned short val)
+{
+ int ret;
+
+ mutex_lock(&wm831x->io_lock);
+
+ ret = wm831x_write(wm831x, reg, 2, &val);
+
+ mutex_unlock(&wm831x->io_lock);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(wm831x_reg_write);
+
+
+static int wm831x_init(struct wm831x *wm831x)
+{
+
+/*wm831x_pre_init*/
+ wm831x_reg_write(wm831x, WM831X_POWER_STATE, 0x8804); //900ma
+
+/*wm831x_irq_init:irq=252,180 mask irq*/
+ wm831x_reg_write(wm831x, 0x4019, 0xffff);
+ wm831x_reg_write(wm831x, 0x401a, 0xffff);
+ wm831x_reg_write(wm831x, 0x401b, 0xffff);
+ wm831x_reg_write(wm831x, 0x401c, 0xffff);
+ wm831x_reg_write(wm831x, 0x401d, 0xffff);
+ wm831x_reg_write(wm831x, 0x4018, 0xffff);//wm831x_reg_write(wm831x, 0x4018, 0x0);
+ wm831x_reg_write(wm831x, 0x4019, 0xffff);
+
+/*regulator: DCDC1: 600 <--> 1800 mV */
+ //wm831x_reg_write(wm831x, 0x401c, 0xfffe);
+ //wm831x_reg_write(wm831x, 0x401c, 0xfefe);
+
+/*regulator: DCDC2: 600 <--> 1800 mV*/
+ //wm831x_reg_write(wm831x, 0x401c, 0xfefc);
+ //wm831x_reg_write(wm831x, 0x401c, 0xfcfc);
+
+/* regulator: DCDC3: 850 <--> 3400 mV */
+ //wm831x_reg_write(wm831x, 0x401c, 0xfcf8);
+
+/*regulator: DCDC4: 0 <--> 30000 mV */
+ //wm831x_reg_write(wm831x, 0x401c, 0xfcf0);
+
+/*wm831x_isink_enable*/
+ wm831x_reg_write(wm831x, 0x404e, 0x8500);
+ wm831x_reg_write(wm831x, 0x404e, 0xc500);
+
+/*wm831x_isink_probe:line=203,irq=220*/
+ //wm831x_reg_write(wm831x, 0x401a, 0xffbf);
+ //wm831x_reg_write(wm831x, 0x401a, 0xff3f);
+
+
+/*regulator: LDO1: 900 <--> 3300 mV */
+ //wm831x_reg_write(wm831x, 0x401b, 0xfffe);
+
+/*regulator: LDO2: 900 <--> 3300 mV*/
+ //wm831x_reg_write(wm831x, 0x401b, 0xfffc);
+
+/*regulator: LDO3: 900 <--> 3300 mV */
+ //wm831x_reg_write(wm831x, 0x401b, 0xfff8);
+
+/*regulator: LDO4: 900 <--> 3300 mV */
+ //wm831x_reg_write(wm831x, 0x401b, 0xfff0);
+
+/* regulator: LDO5: 900 <--> 3300 mV */
+ //wm831x_reg_write(wm831x, 0x401b, 0xffe0);
+
+/*regulator: LDO6: 900 <--> 3300 mV */
+ //wm831x_reg_write(wm831x, 0x401b, 0xffc0);
+
+/*regulator: LDO7: 1000 <--> 3500 mV */
+ //wm831x_reg_write(wm831x, 0x401b, 0xff80);
+
+/*regulator: LDO8: 1000 <--> 3500 mV */
+ //wm831x_reg_write(wm831x, 0x401b, 0xff00);
+
+/*regulator: LDO9: 1000 <--> 3500 mV */
+ //wm831x_reg_write(wm831x, 0x401b, 0xfe00);
+
+/*regulator: LDO10: 1000 <--> 3500 mV */
+ //wm831x_reg_write(wm831x, 0x401b, 0xfc00);
+
+/*regulator: LDO11: 1200 <--> 1550 mV */
+ wm831x_reg_write(wm831x, 0x4008, 0x9716);
+ wm831x_reg_write(wm831x, 0x4006, 0x8463);
+
+/*wm831x_post_init set dcdc3=3000000mV end*/
+ wm831x_reg_write(wm831x, 0x4051, 0xfa49);
+ wm831x_reg_write(wm831x, 0x4062, 0x2156);
+
+
+/*wm831x_post_init set ldo10=3000000mV end*/
+ wm831x_reg_write(wm831x, 0x4084, 0x201a);
+
+/*wm831x_post_init set dcdc2=1300000mV end8*/
+ wm831x_reg_write(wm831x, 0x405d, 0x4140);
+
+/* wm831x_post_init set dcdc1=1800000mV end*/
+ wm831x_reg_write(wm831x, 0x4058, 0x6168);
+
+/*wm831x_post_init set ldo1=1800000mV end*/
+ wm831x_reg_write(wm831x, 0x4069, 0x6010);
+
+/*wm831x_post_init set ldo4=2500000mV end*/
+ wm831x_reg_write(wm831x, 0x4072, 0x8017);
+
+/*wm831x_post_init set ldo7=3300000mV end*/
+ wm831x_reg_write(wm831x, 0x407b, 0xa01d);
+
+/*wm831x_post_init set dcdc4=-22mV end*/
+ wm831x_reg_write(wm831x, 0x4050, 0xf);
+
+/*wm831x_post_init set ldo2=3000000mV end*/
+ wm831x_reg_write(wm831x, 0x406c, 0x1c);
+ wm831x_reg_write(wm831x, 0x4051, 0x24b);
+
+/*wm831x_post_init set ldo3=1800000mV end*/
+ wm831x_reg_write(wm831x, 0x406f, 0x10);
+ wm831x_reg_write(wm831x, 0x4051, 0x24f);
+
+/*wm831x_post_init set ldo5=3000000mV end*/
+ wm831x_reg_write(wm831x, 0x4075, 0x1c);
+ wm831x_reg_write(wm831x, 0x4051, 0x25f);
+
+/*wm831x_post_init set ldo6=2800000mV end*/
+ wm831x_reg_write(wm831x, 0x4078, 0x1a);
+ wm831x_reg_write(wm831x, 0x4051, 0x27f);
+
+/*wm831x_post_init set ldo8=1200000mV end*/
+ wm831x_reg_write(wm831x, 0x407e, 0x4);
+ wm831x_reg_write(wm831x, 0x4051, 0x2ff);
+
+/*wm831x_post_init set ldo9=3000000mV end*/
+ wm831x_reg_write(wm831x, 0x4081, 0x1a);
+ wm831x_reg_write(wm831x, 0x4051, 0x3ff);
+
+ wm831x_reg_write(wm831x, 0x4008, 0x0);
+
+ wm831x_reg_write(wm831x, 0x4008, 0x9716);
+ wm831x_reg_write(wm831x, 0x4064, 0x104);
+ wm831x_reg_write(wm831x, 0x4008, 0x0);
+ wm831x_reg_write(wm831x, 0x4050, 0x7);
+
+/* backlight brightness=255*/
+ wm831x_reg_write(wm831x, 0x404e, 0xc500);
+ wm831x_reg_write(wm831x, 0x4050, 0xf);
+ wm831x_reg_write(wm831x, 0x404e, 0xc535);
+ wm831x_reg_write(wm831x, 0x404e, 0xc535);
+
+
+/*wm831x-rtc wm831x-rtc: rtc core: registered wm831x as rtc0*/
+ //wm831x_reg_write(wm831x, 0x4019, 0xeef7);
+ //wm831x_reg_write(wm831x, 0x4019, 0xeef3);
+
+/*wm831x_power_probe:wm831x_power initialized*/
+ wm831x_reg_write(wm831x, 0x4008, 0x9716);
+ wm831x_reg_write(wm831x, 0x404b, 0x8812);
+
+ wm831x_reg_write(wm831x, 0x4008, 0x0);
+ wm831x_reg_write(wm831x, 0x4008, 0x9716);
+ wm831x_reg_write(wm831x, 0x4048, 0x9c21);
+
+ wm831x_reg_write(wm831x, 0x4048, 0x9c21);
+
+ wm831x_reg_write(wm831x, 0x4049, 0x44ff);
+ wm831x_reg_write(wm831x, 0x4001, 0x57);
+ wm831x_reg_write(wm831x, 0x4008, 0x0);
+ //wm831x_reg_write(wm831x, 0x4019, 0x6ef3);
+ //wm831x_reg_write(wm831x, 0x4019, 0x2ef3);
+
+/*device-mapper: uevent: version 1.0.3*/
+ wm831x_reg_write(wm831x, 0x402e, 0x8000);
+ wm831x_reg_write(wm831x, 0x4014, 0x8);
+ wm831x_reg_write(wm831x, 0x402f, 0x400);
+ wm831x_reg_write(wm831x, 0x402e, 0xc000);
+
+/*gpu: power on... done!*/
+ wm831x_reg_write(wm831x, 0x402e, 0x0);
+ wm831x_reg_write(wm831x, 0x4011, 0x2100);
+ wm831x_reg_write(wm831x, 0x402e, 0x8000);
+ wm831x_reg_write(wm831x, 0x402f, 0x200);
+ wm831x_reg_write(wm831x, 0x402e, 0xc000);
+
+
+/*wm831x_isink_is_enabled:line=85*/
+/*wm831x-rtc wm831x-rtc: setting system clock to 1970-01-02 04:18:35 UTC (101915)*/
+ wm831x_reg_write(wm831x, 0x402e, 0x0);
+ wm831x_reg_write(wm831x, 0x4011, 0x100);
+
+ wm831x_reg_write(wm831x, 0x402e, 0x8000);
+ wm831x_reg_write(wm831x, 0x402f, 0x100);
+ wm831x_reg_write(wm831x, 0x402e, 0xc000);
+ wm831x_reg_write(wm831x, 0x4011, 0x100);
+ wm831x_reg_write(wm831x, 0x402e, 0x0);
+
+ printk("%s\n",__FUNCTION__);
+
+}
+
+
+struct wm831x_on {
+ struct input_dev *dev;
+ struct delayed_work work;
+ struct wm831x *wm831x;
+ struct wake_lock wm831x_on_wake;
+};
+
+static struct wm831x_on *g_wm831x_on;
+
+void rk29_send_wakeup_key(void)
+{
+
+ if(!g_wm831x_on)
+ {
+ printk("%s:addr err!\n",__FUNCTION__);
+ return;
+ }
+ input_report_key(g_wm831x_on->dev, KEY_POWER, 1);
+ input_sync(g_wm831x_on->dev);
+ input_report_key(g_wm831x_on->dev, KEY_POWER, 0);
+ input_sync(g_wm831x_on->dev);
+ //printk("%s\n", __FUNCTION__);
+}
+
+
+static void wm831x_irq_worker(struct work_struct *work)
+{
+ struct wm831x *wm831x = container_of(work, struct wm831x, irq_work);
+
+ wm831x_reg_write(wm831x, WM831X_INTERRUPT_STATUS_1, 0xffff);//clear all intterupt
+ rk29_send_wakeup_key();
+ //enable_irq(wm831x->irq);
+ wake_unlock(&wm831x->irq_wake);
+ printk("%s\n",__FUNCTION__);
+}
+
+static irqreturn_t wm831x_irq_thread(int irq, void *data)
+{
+ struct wm831x *wm831x = data;
+
+ //disable_irq_nosync(irq);
+ wake_lock(&wm831x->irq_wake);
+ queue_work(wm831x->irq_wq, &wm831x->irq_work);
+
+ return IRQ_HANDLED;
+}
+
+static struct platform_driver wm831x_on_driver = {
+ .driver = {
+ .name = "wm831x-on",
+ },
+};
+
+static struct platform_device wm831x_on_device = {
+ .name = "wm831x-on",
+ .id = -1,
+ .dev = {
+ .driver = &wm831x_on_driver.driver,
+ }
+
+};
+
+static inline void wm831x_on_init(void)
+{
+ if (platform_driver_register(&wm831x_on_driver) == 0)
+ (void) platform_device_register(&wm831x_on_device);
+}
+
+
+static int __devinit wm831x_spi_probe(struct spi_device *spi)
+{
+ struct wm831x *wm831x;
+ enum wm831x_parent type;
+ int ret,gpio,irq;
+
+ /* Currently SPI support for ID tables is unmerged, we're faking it */
+ if (strcmp(spi->modalias, "wm8310") == 0)
+ type = WM8310;
+ else if (strcmp(spi->modalias, "wm8311") == 0)
+ type = WM8311;
+ else if (strcmp(spi->modalias, "wm8312") == 0)
+ type = WM8312;
+ else if (strcmp(spi->modalias, "wm8320") == 0)
+ type = WM8320;
+ else if (strcmp(spi->modalias, "wm8321") == 0)
+ type = WM8321;
+ else if (strcmp(spi->modalias, "wm8325") == 0)
+ type = WM8325;
+ else {
+ dev_err(&spi->dev, "Unknown device type\n");
+ return -EINVAL;
+ }
+
+ wm831x = kzalloc(sizeof(struct wm831x), GFP_KERNEL);
+ if (wm831x == NULL)
+ return -ENOMEM;
+
+ spi->bits_per_word = 16;
+ spi->mode = SPI_MODE_0;
+
+ gpio = spi->irq;
+ ret = gpio_request(gpio, "wm831x");
+ if (ret) {
+ printk( "failed to request rk gpio irq for wm831x \n");
+ return ret;
+ }
+ gpio_pull_updown(gpio, GPIOPullUp);
+ if (ret) {
+ printk("failed to pull up gpio irq for wm831x \n");
+ return ret;
+ }
+ irq = gpio_to_irq(gpio);
+
+ dev_set_drvdata(&spi->dev, wm831x);
+ wm831x->dev = &spi->dev;
+ wm831x->control_data = spi;
+ wm831x->read_dev = wm831x_spi_read_device;
+ wm831x->write_dev = wm831x_spi_write_device;
+
+ mutex_init(&wm831x->io_lock);
+
+ wm831x_init(wm831x);
+ //wm831x_device_init(wm831x, type, irq);
+
+ dev_set_drvdata(wm831x->dev, wm831x);
+ wm831x_on_init();
+
+ g_wm831x_on = kzalloc(sizeof(struct wm831x_on), GFP_KERNEL);
+ if (!g_wm831x_on) {
+ printk( "Can't allocate data\n");
+ return -ENOMEM;
+ }
+
+ g_wm831x_on->wm831x = wm831x;
+ g_wm831x_on->dev = input_allocate_device();
+ if (!g_wm831x_on->dev) {
+ //dev_err(&wm831x->dev, "Can't allocate input dev\n");
+ return -ENOMEM;
+ }
+
+ g_wm831x_on->dev->evbit[0] = BIT_MASK(EV_KEY);
+ g_wm831x_on->dev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER);
+ g_wm831x_on->dev->name = "wm831x_on";
+ g_wm831x_on->dev->phys = "wm831x_on/input0";
+#if 0
+ g_wm831x_on->dev->dev.parent = &wm831x_on_device.dev;
+ dev_err(&wm831x_on_device.dev, "%s\n", __FUNCTION__);
+ ret = input_register_device(g_wm831x_on->dev);
+ if (ret) {
+ printk( "Can't register input device: %d\n");
+ return -ENOMEM;
+ }
+
+#endif
+
+ wm831x->irq_wq = create_singlethread_workqueue("wm831x-irq");
+ if (!wm831x->irq_wq) {
+ dev_err(wm831x->dev, "Failed to allocate IRQ worker\n");
+ return -ESRCH;
+ }
+
+ INIT_WORK(&wm831x->irq_work, wm831x_irq_worker);
+ wake_lock_init(&wm831x->irq_wake, WAKE_LOCK_SUSPEND, "wm831x_irq_wake");
+
+ ret = request_threaded_irq(irq, wm831x_irq_thread, NULL,
+ IRQF_TRIGGER_FALLING,
+ "wm831x", wm831x);
+ if (ret != 0) {
+ dev_err(wm831x->dev, "Failed to request IRQ %d: %d\n",
+ wm831x->irq, ret);
+ return ret;
+ }
+
+ enable_irq_wake(irq); // so wm831x irq can wake up system
+ /* only support on intterupt */
+ wm831x_reg_write(wm831x, WM831X_SYSTEM_INTERRUPTS_MASK, 0xefff);
+ wm831x_reg_write(wm831x, WM831X_INTERRUPT_STATUS_1_MASK, 0xefff);
+
+ return 0;
+ //return wm831x_device_init(wm831x, type, irq);
+}
+
+static int __devexit wm831x_spi_remove(struct spi_device *spi)
+{
+ struct wm831x *wm831x = dev_get_drvdata(&spi->dev);
+
+ //wm831x_device_exit(wm831x);
+
+ return 0;
+}
+
+static int wm831x_spi_suspend(struct spi_device *spi, pm_message_t m)
+{
+ struct wm831x *wm831x = dev_get_drvdata(&spi->dev);
+ return 0;
+ //return wm831x_device_suspend(wm831x);
+}
+
+static struct spi_driver wm8310_spi_driver = {
+ .driver = {
+ .name = "wm8310",
+ .bus = &spi_bus_type,
+ .owner = THIS_MODULE,
+ },
+ .probe = wm831x_spi_probe,
+ .remove = __devexit_p(wm831x_spi_remove),
+ .suspend = wm831x_spi_suspend,
+};
+
+static struct spi_driver wm8311_spi_driver = {
+ .driver = {
+ .name = "wm8311",
+ .bus = &spi_bus_type,
+ .owner = THIS_MODULE,
+ },
+ .probe = wm831x_spi_probe,
+ .remove = __devexit_p(wm831x_spi_remove),
+ .suspend = wm831x_spi_suspend,
+};
+
+static struct spi_driver wm8312_spi_driver = {
+ .driver = {
+ .name = "wm8312",
+ .bus = &spi_bus_type,
+ .owner = THIS_MODULE,
+ },
+ .probe = wm831x_spi_probe,
+ .remove = __devexit_p(wm831x_spi_remove),
+ .suspend = wm831x_spi_suspend,
+};
+
+static struct spi_driver wm8320_spi_driver = {
+ .driver = {
+ .name = "wm8320",
+ .bus = &spi_bus_type,
+ .owner = THIS_MODULE,
+ },
+ .probe = wm831x_spi_probe,
+ .remove = __devexit_p(wm831x_spi_remove),
+ .suspend = wm831x_spi_suspend,
+};
+
+static struct spi_driver wm8321_spi_driver = {
+ .driver = {
+ .name = "wm8321",
+ .bus = &spi_bus_type,
+ .owner = THIS_MODULE,
+ },
+ .probe = wm831x_spi_probe,
+ .remove = __devexit_p(wm831x_spi_remove),
+ .suspend = wm831x_spi_suspend,
+};
+
+static struct spi_driver wm8325_spi_driver = {
+ .driver = {
+ .name = "wm8325",
+ .bus = &spi_bus_type,
+ .owner = THIS_MODULE,
+ },
+ .probe = wm831x_spi_probe,
+ .remove = __devexit_p(wm831x_spi_remove),
+ .suspend = wm831x_spi_suspend,
+};
+
+static int __init wm831x_spi_init(void)
+{
+ int ret;
+
+ ret = spi_register_driver(&wm8310_spi_driver);
+ if (ret != 0)
+ pr_err("Failed to register WM8310 SPI driver: %d\n", ret);
+
+ ret = spi_register_driver(&wm8311_spi_driver);
+ if (ret != 0)
+ pr_err("Failed to register WM8311 SPI driver: %d\n", ret);
+
+ ret = spi_register_driver(&wm8312_spi_driver);
+ if (ret != 0)
+ pr_err("Failed to register WM8312 SPI driver: %d\n", ret);
+
+ ret = spi_register_driver(&wm8320_spi_driver);
+ if (ret != 0)
+ pr_err("Failed to register WM8320 SPI driver: %d\n", ret);
+
+ ret = spi_register_driver(&wm8321_spi_driver);
+ if (ret != 0)
+ pr_err("Failed to register WM8321 SPI driver: %d\n", ret);
+
+ ret = spi_register_driver(&wm8325_spi_driver);
+ if (ret != 0)
+ pr_err("Failed to register WM8325 SPI driver: %d\n", ret);
+
+ return 0;
+}
+subsys_initcall(wm831x_spi_init);
+
+static void __exit wm831x_spi_exit(void)
+{
+ spi_unregister_driver(&wm8325_spi_driver);
+ spi_unregister_driver(&wm8321_spi_driver);
+ spi_unregister_driver(&wm8320_spi_driver);
+ spi_unregister_driver(&wm8312_spi_driver);
+ spi_unregister_driver(&wm8311_spi_driver);
+ spi_unregister_driver(&wm8310_spi_driver);
+}
+module_exit(wm831x_spi_exit);
+
+MODULE_DESCRIPTION("SPI support for WM831x/2x AudioPlus PMICs");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Mark Brown");
\r
/* Base */\r
#define OUT_TYPE SCREEN_RGB\r
-#define OUT_FACE OUT_P888\r
-#define OUT_CLK 26 //***27\r
+#define OUT_FACE OUT_P666\r
+#define OUT_CLK 26*1000*1000 //***27\r
+#define LCDC_ACLK 150000000 //29 lcdc axi DMA Ƶ�� //rk29\r
\r
/* Timing */\r
-#define H_PW 16 //8Ç°ÏûÓ°\r
-#define H_BP 24//6\r
+#define H_PW 4 //8Ç°ÏûÓ°\r
+#define H_BP 8//6\r
#define H_VD 480//320 //***800 \r
-#define H_FP 16//60\r
+#define H_FP 8//60\r
\r
-#define V_PW 2//12\r
-#define V_BP 2// 4\r
+#define V_PW 4//12\r
+#define V_BP 8// 4\r
#define V_VD 800//480 //***480\r
-#define V_FP 4//40\r
+#define V_FP 8//40\r
+\r
+#define LCD_WIDTH 800 //need modify //rk29\r
+#define LCD_HEIGHT 480\r
\r
/* Other */\r
#define DCLK_POL 1//0 \r
\r
\r
#define DRVDelayUs(i) udelay(i*4)\r
-\r
+#if 0\r
void spi_screenreg_cmd(u8 Addr)\r
{\r
u32 i;\r
TXD_CLR();\r
DRVDelayUs(10);\r
}\r
+#endif\r
\r
void set_lcd_info(struct rk29fb_screen *screen, struct rk29lcd_info *lcd_info )\r
{\r
//printk("lcd_hx8357 set_lcd_info \n"); \r
- /* screen type & face */\r
- screen->type = OUT_TYPE;\r
- screen->face = OUT_FACE;\r
- \r
- /* Screen size */\r
- screen->x_res = H_VD;\r
- screen->y_res = V_VD;\r
+ /* screen type & face */\r
+ screen->type = OUT_TYPE;\r
+ screen->face = OUT_FACE;\r
\r
- /* Timing */\r
- screen->pixclock = OUT_CLK;\r
+ /* Screen size */\r
+ screen->x_res = H_VD;\r
+ screen->y_res = V_VD;\r
+ screen->width = LCD_WIDTH; //rk29\r
+ screen->height = LCD_HEIGHT; //rk29\r
+\r
+ /* Timing */\r
+ screen->lcdc_aclk = LCDC_ACLK; //rk29\r
+ screen->pixclock = OUT_CLK;\r
screen->left_margin = H_BP; /*>2*/ \r
screen->right_margin = H_FP; /*>2*/ \r
screen->hsync_len = H_PW; /*>2*/ //***all > 326, 4<PW+BP<15, \r
screen->pin_dclk = DCLK_POL;\r
\r
/* Swap rule */\r
- screen->swap_rb = SWAP_RB;\r
- screen->swap_rg = 0;\r
- screen->swap_gb = 0;\r
- screen->swap_delta = 0;\r
- screen->swap_dumy = 0;\r
-\r
- /* Operation function*/\r
- screen->init = init;\r
- screen->standby = standby;\r
- if(lcd_info)\r
- gLcd_info = lcd_info;\r
+ screen->swap_rb = 0;\r
+ screen->swap_rg = 0;\r
+ screen->swap_gb = 0;\r
+ screen->swap_delta = 0;\r
+ screen->swap_dumy = 0;\r
+\r
+ /* Operation function*/\r
+ screen->init = init;\r
+ screen->standby = standby;\r
+ if(lcd_info)\r
+ gLcd_info = lcd_info;\r
+}\r
+\r
+#define PIN_BL_SET RK29_PIN6_PD2\r
+void set_backlight(int brightness)\r
+{\r
+#if 0\r
+ if(gLcd_info)\r
+ gLcd_info->io_init();\r
+\r
+ printk("lcd_ili9803:set_backlight = %d\r\n", brightness);\r
+ if (brightness < 0)\r
+ {\r
+ brightness = 0;\r
+ }\r
+ if (brightness > 4)\r
+ {\r
+ brightness = 4;\r
+ }\r
+ spi_screenreg_cmd(0x51);\r
+ spi_screenreg_param(brightness<<5);\r
+ \r
+ if(gLcd_info)\r
+ gLcd_info->io_deinit();\r
+\r
+#endif\r
+\r
+ gpio_request(PIN_BL_SET, NULL);\r
+ if(brightness > 0)\r
+ gpio_direction_output(PIN_BL_SET,GPIO_HIGH);\r
+ else\r
+ gpio_direction_output(PIN_BL_SET,GPIO_LOW); \r
+\r
+}\r
+\r
+void WriteCommand( int Command)\r
+{\r
+ unsigned char i,count1, count2,count3,count4;\r
+ count1= Command>>8;\r
+ count2= Command;\r
+ count3=0x20;//00100000 //дÃüÁî¸ßλ\r
+ count4=0x00;//00000000 //дÃüÁîµÍλ======¾ßÌåÇë¿´ICµÄDatasheet\r
+ CS_CLR();\r
+ for(i=0;i<8;i++)\r
+ {\r
+ CLK_CLR();\r
+ if (count3 & 0x80) TXD_SET();\r
+ else TXD_CLR();\r
+ CLK_SET();\r
+ count3<<=1;\r
+ }\r
+\r
+ for(i=0;i<8;i++)\r
+ {\r
+ CLK_CLR();\r
+ if (count1 & 0x80) TXD_SET();\r
+ else TXD_CLR();\r
+ CLK_SET();\r
+ count1<<=1;\r
+ }\r
+\r
+ for(i=0;i<8;i++)\r
+ {\r
+ CLK_CLR();\r
+ if (count4 & 0x80) TXD_SET();\r
+ else TXD_CLR();\r
+ CLK_SET();\r
+ count4<<=1;\r
+ }\r
+ \r
+ for(i=0;i<8;i++)\r
+ {\r
+ CLK_CLR();\r
+ if (count2 & 0x80) TXD_SET();\r
+ else TXD_CLR();\r
+ CLK_SET();\r
+ count2<<=1;\r
+ }\r
+\r
+ CS_SET();\r
+\r
+}\r
+\r
+\r
+\r
+void WriteParameter(char DH)\r
+{\r
+ unsigned char i, count1, count2,count3,count4;\r
+ count1=DH>>8;\r
+ count2=DH;\r
+ count3=0x60;//дÊý¾Ý¸ßλ\r
+ count4=0x40;//дÊý¾ÝµÍλ\r
+\r
+ CS_CLR();\r
+ /*\r
+ TXD_CLR(); CLK_CLR(); CLK_SET(); //WRITE\r
+ TXD_SET(); CLK_CLR(); CLK_SET(); //DATA\r
+ TXD_SET(); CLK_CLR(); CLK_SET(); //HIGH BYTE\r
+ TXD_CLR(); CLK_CLR(); CLK_SET();\r
+ TXD_CLR(); CLK_CLR(); CLK_SET();\r
+ TXD_CLR(); CLK_CLR(); CLK_SET();\r
+ TXD_CLR(); CLK_CLR(); CLK_SET();\r
+ TXD_CLR(); CLK_CLR(); CLK_SET();\r
+ */\r
+ /*\r
+ //ÒòΪÊý¾ÝµÄ¸ßλ»ù±¾ÊDz»Óõģ¬¿ÉÒÔ²»´«¸ßλ£¬Ö±½Ó´«µÍλ\r
+ for(i=0;i<8;i++)\r
+ {\r
+ CLK_CLR();\r
+ if (count3 & 0x80) TXD_SET();\r
+ else TXD_CLR();\r
+ CLK_SET();\r
+ count3<<=1;\r
+ }\r
+\r
+ for(i=0;i<8;i++)\r
+ {\r
+ CLK_CLR();\r
+ if (count1 & 0x80) TXD_SET();\r
+ else TXD_CLR();\r
+ CLK_SET();\r
+ count1<<=1;\r
+ }\r
+ */\r
+\r
+\r
+ for(i=0;i<8;i++)\r
+ {\r
+ CLK_CLR();\r
+ if (count4 & 0x80) TXD_SET();\r
+ else TXD_CLR();\r
+ CLK_SET();\r
+ count4<<=1;\r
+ }\r
+\r
+ for(i=0;i<8;i++)\r
+ {\r
+ CLK_CLR();\r
+ if (count2 & 0x80) TXD_SET();\r
+ else TXD_CLR();\r
+ CLK_SET();\r
+ count2<<=1;\r
+ }\r
+\r
+ CS_SET();\r
+\r
}\r
\r
+\r
+void init_nt35510(void)\r
+{\r
+ WriteCommand(0X1100); \r
+ mdelay(120);\r
+\r
+ WriteCommand(0X1300); \r
+\r
+ WriteCommand(0XF000); \r
+ WriteParameter(0x55);\r
+\r
+ WriteCommand(0XF001); \r
+ WriteParameter(0xAA);\r
+\r
+ WriteCommand(0XF002); \r
+ WriteParameter(0x52);\r
+\r
+ WriteCommand(0XF003); \r
+ WriteParameter(0x08);\r
+\r
+ WriteCommand(0XF004); \r
+ WriteParameter(0x01);\r
+\r
+ //Gamma setting Red\r
+ WriteCommand(0XD100);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD101);\r
+ WriteParameter(0x20);\r
+\r
+ WriteCommand(0XD102);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD103);\r
+ WriteParameter(0x2B);\r
+\r
+ WriteCommand(0XD104);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD105);\r
+ WriteParameter(0x3C);\r
+\r
+ WriteCommand(0XD106);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD107);\r
+ WriteParameter(0x56);\r
+\r
+ WriteCommand(0XD108);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD109);\r
+ WriteParameter(0x68);\r
+\r
+ WriteCommand(0XD10a);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD10b);\r
+ WriteParameter(0x87);\r
+\r
+ WriteCommand(0XD10c);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD10d);\r
+ WriteParameter(0x9E);\r
+\r
+ WriteCommand(0XD10e);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD10f);\r
+ WriteParameter(0xC6);\r
+\r
+ WriteCommand(0XD110);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD111);\r
+ WriteParameter(0xE4);\r
+\r
+ WriteCommand(0XD112);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD113);\r
+ WriteParameter(0x12);\r
+\r
+ WriteCommand(0XD114);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD115);\r
+ WriteParameter(0x37);\r
+\r
+ WriteCommand(0XD116);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD117);\r
+ WriteParameter(0x75);\r
+\r
+ WriteCommand(0XD118);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD119);\r
+ WriteParameter(0xA5);\r
+\r
+ WriteCommand(0XD11a);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD11b);\r
+ WriteParameter(0xA6);\r
+\r
+ WriteCommand(0XD11c);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD11d);\r
+ WriteParameter(0xD0);\r
+\r
+ WriteCommand(0XD11e);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD11f);\r
+ WriteParameter(0xF5);\r
+\r
+ WriteCommand(0XD120);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD121);\r
+ WriteParameter(0x0A);\r
+\r
+ WriteCommand(0XD122);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD123);\r
+ WriteParameter(0x26);\r
+\r
+ WriteCommand(0XD124);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD125);\r
+ WriteParameter(0x3B);\r
+\r
+ WriteCommand(0XD126);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD127);\r
+ WriteParameter(0x6B);\r
+\r
+ WriteCommand(0XD128);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD129);\r
+ WriteParameter(0x99);\r
+\r
+ WriteCommand(0XD12a);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD12b);\r
+ WriteParameter(0xDD);\r
+\r
+ WriteCommand(0XD12C);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD12D);\r
+ WriteParameter(0x10);\r
+\r
+ WriteCommand(0XD12E);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD12F);\r
+ WriteParameter(0x26);\r
+\r
+ WriteCommand(0XD130);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD131);\r
+ WriteParameter(0x32);\r
+\r
+ WriteCommand(0XD132);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD133);\r
+ WriteParameter(0x9A);\r
+\r
+ //Gamma setting Green\r
+ WriteCommand(0XD200);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD201);\r
+ WriteParameter(0xa0);\r
+\r
+ WriteCommand(0XD202);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD203);\r
+ WriteParameter(0xa9);\r
+\r
+ WriteCommand(0XD204);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD205);\r
+ WriteParameter(0xb5);\r
+\r
+ WriteCommand(0XD206);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD207);\r
+ WriteParameter(0xbf);\r
+\r
+ WriteCommand(0XD208);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD209);\r
+ WriteParameter(0xc9);\r
+\r
+ WriteCommand(0XD20a);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD20b);\r
+ WriteParameter(0xdc);\r
+\r
+ WriteCommand(0XD20c);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD20d);\r
+ WriteParameter(0xEE);\r
+\r
+ WriteCommand(0XD20e);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD20f);\r
+ WriteParameter(0x0A);\r
+\r
+ WriteCommand(0XD210);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD211);\r
+ WriteParameter(0x21);\r
+\r
+ WriteCommand(0XD212);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD213);\r
+ WriteParameter(0x48);\r
+\r
+ WriteCommand(0XD214);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD215);\r
+ WriteParameter(0x67);\r
+\r
+ WriteCommand(0XD216);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD217);\r
+ WriteParameter(0x97);\r
+\r
+ WriteCommand(0XD218);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD219);\r
+ WriteParameter(0xBE);\r
+\r
+ WriteCommand(0XD21a);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD21b);\r
+ WriteParameter(0xC0);\r
+\r
+ WriteCommand(0XD21c);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD21d);\r
+ WriteParameter(0xE1);\r
+\r
+ WriteCommand(0XD21e);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD21f);\r
+ WriteParameter(0x04);\r
+\r
+ WriteCommand(0XD220);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD221);\r
+ WriteParameter(0x17);\r
+\r
+ WriteCommand(0XD222);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD223);\r
+ WriteParameter(0x36);\r
+\r
+ WriteCommand(0XD224);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD225);\r
+ WriteParameter(0x50);\r
+\r
+ WriteCommand(0XD226);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD227);\r
+ WriteParameter(0x7E);\r
+\r
+ WriteCommand(0XD228);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD229);\r
+ WriteParameter(0xAC);\r
+\r
+ WriteCommand(0XD22a);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD22b);\r
+ WriteParameter(0xF1);\r
+\r
+ WriteCommand(0XD22C);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD22D);\r
+ WriteParameter(0x20);\r
+\r
+ WriteCommand(0XD22E);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD22F);\r
+ WriteParameter(0x38);\r
+\r
+ WriteCommand(0XD230);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD231);\r
+ WriteParameter(0x43);\r
+\r
+ WriteCommand(0XD232);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD233);\r
+ WriteParameter(0x9A);\r
+\r
+\r
+ //Gamma setting Blue\r
+ WriteCommand(0XD300);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD301);\r
+ WriteParameter(0x50);\r
+\r
+ WriteCommand(0XD302);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD303);\r
+ WriteParameter(0x53);\r
+\r
+ WriteCommand(0XD304);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD305);\r
+ WriteParameter(0x73);\r
+\r
+ WriteCommand(0XD306);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD307);\r
+ WriteParameter(0x89);\r
+\r
+ WriteCommand(0XD308);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD309);\r
+ WriteParameter(0x9f);\r
+\r
+ WriteCommand(0XD30a);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD30b);\r
+ WriteParameter(0xc1);\r
+\r
+ WriteCommand(0XD30c);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD30d);\r
+ WriteParameter(0xda);\r
+\r
+ WriteCommand(0XD30e);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD30f);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD310);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD311);\r
+ WriteParameter(0x23);\r
+\r
+ WriteCommand(0XD312);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD313);\r
+ WriteParameter(0x50);\r
+\r
+ WriteCommand(0XD314);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD315);\r
+ WriteParameter(0x6f);\r
+\r
+ WriteCommand(0XD316);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD317);\r
+ WriteParameter(0x9f);\r
+\r
+ WriteCommand(0XD318);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD319);\r
+ WriteParameter(0xc5);\r
+\r
+ WriteCommand(0XD31a);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD31b);\r
+ WriteParameter(0xC6);\r
+\r
+ WriteCommand(0XD31c);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD31d);\r
+ WriteParameter(0xE3);\r
+\r
+ WriteCommand(0XD31e);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD31f);\r
+ WriteParameter(0x08);\r
+\r
+ WriteCommand(0XD320);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD321);\r
+ WriteParameter(0x16);\r
+\r
+ WriteCommand(0XD322);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD323);\r
+ WriteParameter(0x2b);\r
+\r
+ WriteCommand(0XD324);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD325);\r
+ WriteParameter(0x4d);\r
+\r
+ WriteCommand(0XD326);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD327);\r
+ WriteParameter(0x6f);\r
+\r
+ WriteCommand(0XD328);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD329);\r
+ WriteParameter(0x8C);\r
+\r
+ WriteCommand(0XD32a);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD32b);\r
+ WriteParameter(0xd6);\r
+\r
+ WriteCommand(0XD32C);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD32D);\r
+ WriteParameter(0x12);\r
+\r
+ WriteCommand(0XD32E);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD32F);\r
+ WriteParameter(0x28);\r
+\r
+ WriteCommand(0XD330);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD331);\r
+ WriteParameter(0x3e);\r
+\r
+ WriteCommand(0XD332);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD333);\r
+ WriteParameter(0x9A);\r
+\r
+ //Gamma setting Red\r
+ WriteCommand(0XD400);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD401);\r
+ WriteParameter(0x20);\r
+\r
+ WriteCommand(0XD402);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD403);\r
+ WriteParameter(0x2b);\r
+\r
+ WriteCommand(0XD404);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD405);\r
+ WriteParameter(0x3c);\r
+\r
+ WriteCommand(0XD406);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD407);\r
+ WriteParameter(0x56);\r
+\r
+ WriteCommand(0XD408);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD409);\r
+ WriteParameter(0x68);\r
+\r
+ WriteCommand(0XD40a);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD40b);\r
+ WriteParameter(0x87);\r
+\r
+ WriteCommand(0XD40c);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD40d);\r
+ WriteParameter(0x9e);\r
+\r
+ WriteCommand(0XD40e);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD40f);\r
+ WriteParameter(0xc6);\r
+\r
+ WriteCommand(0XD410);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD411);\r
+ WriteParameter(0xe4);\r
+\r
+ WriteCommand(0XD412);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD413);\r
+ WriteParameter(0x12);\r
+\r
+ WriteCommand(0XD414);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD415);\r
+ WriteParameter(0x37);\r
+\r
+ WriteCommand(0XD416);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD417);\r
+ WriteParameter(0x75);\r
+\r
+ WriteCommand(0XD418);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD419);\r
+ WriteParameter(0xa5);\r
+\r
+ WriteCommand(0XD41a);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD41b);\r
+ WriteParameter(0xa6);\r
+\r
+ WriteCommand(0XD41c);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD41d);\r
+ WriteParameter(0xd0);\r
+\r
+ WriteCommand(0XD41e);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD41f);\r
+ WriteParameter(0xf5);\r
+\r
+ WriteCommand(0XD420);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD421);\r
+ WriteParameter(0x0a);\r
+\r
+ WriteCommand(0XD422);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD423);\r
+ WriteParameter(0x26);\r
+\r
+ WriteCommand(0XD424);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD425);\r
+ WriteParameter(0x3b);\r
+\r
+ WriteCommand(0XD426);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD427);\r
+ WriteParameter(0x6b);\r
+\r
+ WriteCommand(0XD428);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD429);\r
+ WriteParameter(0x99);\r
+\r
+ WriteCommand(0XD42a);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD42b);\r
+ WriteParameter(0xdd);\r
+\r
+ WriteCommand(0XD42C);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD42D);\r
+ WriteParameter(0x10);\r
+\r
+ WriteCommand(0XD42E);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD42F);\r
+ WriteParameter(0x26);\r
+\r
+ WriteCommand(0XD430);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD431);\r
+ WriteParameter(0x32);\r
+\r
+ WriteCommand(0XD432);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD433);\r
+ WriteParameter(0x9A);\r
+\r
+ //Gamma setting Green\r
+ WriteCommand(0XD500);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD501);\r
+ WriteParameter(0xa0);\r
+\r
+ WriteCommand(0XD502);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD503);\r
+ WriteParameter(0xa9);\r
+\r
+ WriteCommand(0XD504);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD505);\r
+ WriteParameter(0xb5);\r
+\r
+ WriteCommand(0XD506);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD507);\r
+ WriteParameter(0xbf);\r
+\r
+ WriteCommand(0XD508);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD509);\r
+ WriteParameter(0xc9);\r
+\r
+ WriteCommand(0XD50a);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD50b);\r
+ WriteParameter(0xdc);\r
+\r
+ WriteCommand(0XD50c);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD50d);\r
+ WriteParameter(0xee);\r
+\r
+ WriteCommand(0XD50e);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD50f);\r
+ WriteParameter(0x0a);\r
+\r
+ WriteCommand(0XD510);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD511);\r
+ WriteParameter(0x21);\r
+\r
+ WriteCommand(0XD512);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD513);\r
+ WriteParameter(0x48);\r
+\r
+ WriteCommand(0XD514);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD515);\r
+ WriteParameter(0x67);\r
+\r
+ WriteCommand(0XD516);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD517);\r
+ WriteParameter(0x97);\r
+\r
+ WriteCommand(0XD518);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD519);\r
+ WriteParameter(0xbe);\r
+\r
+ WriteCommand(0XD51a);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD51b);\r
+ WriteParameter(0xc0);\r
+\r
+ WriteCommand(0XD51c);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD51d);\r
+ WriteParameter(0xe1);\r
+\r
+ WriteCommand(0XD51e);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD51f);\r
+ WriteParameter(0x04);\r
+\r
+ WriteCommand(0XD520);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD521);\r
+ WriteParameter(0x17);\r
+\r
+ WriteCommand(0XD522);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD523);\r
+ WriteParameter(0x36);\r
+\r
+ WriteCommand(0XD524);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD525);\r
+ WriteParameter(0x50);\r
+\r
+ WriteCommand(0XD526);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD527);\r
+ WriteParameter(0x7e);\r
+\r
+ WriteCommand(0XD528);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD529);\r
+ WriteParameter(0xac);\r
+\r
+ WriteCommand(0XD52a);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD52b);\r
+ WriteParameter(0xf1);\r
+\r
+ WriteCommand(0XD52C);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD52D);\r
+ WriteParameter(0x20);\r
+\r
+ WriteCommand(0XD52E);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD52F);\r
+ WriteParameter(0x38);\r
+\r
+ WriteCommand(0XD530);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD531);\r
+ WriteParameter(0x43);\r
+\r
+ WriteCommand(0XD532);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD533);\r
+ WriteParameter(0x9A);\r
+\r
+ //Gamma setting Blue\r
+ WriteCommand(0XD600);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD601);\r
+ WriteParameter(0x50);\r
+\r
+ WriteCommand(0XD602);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD603);\r
+ WriteParameter(0x53);\r
+\r
+ WriteCommand(0XD604);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD605);\r
+ WriteParameter(0x73);\r
+\r
+ WriteCommand(0XD606);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD607);\r
+ WriteParameter(0x89);\r
+\r
+ WriteCommand(0XD608);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD609);\r
+ WriteParameter(0x9f);\r
+\r
+ WriteCommand(0XD60a);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD60b);\r
+ WriteParameter(0xc1);\r
+\r
+ WriteCommand(0XD60c);\r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XD60d);\r
+ WriteParameter(0xda);\r
+\r
+ WriteCommand(0XD60e);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD60f);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD610);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD611);\r
+ WriteParameter(0x23);\r
+\r
+ WriteCommand(0XD612);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD613);\r
+ WriteParameter(0x50);\r
+\r
+ WriteCommand(0XD614);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD615);\r
+ WriteParameter(0x6f);\r
+\r
+ WriteCommand(0XD616);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD617);\r
+ WriteParameter(0x9f);\r
+\r
+ WriteCommand(0XD618);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD619);\r
+ WriteParameter(0xc5);\r
+\r
+ WriteCommand(0XD61a);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD61b);\r
+ WriteParameter(0xc6);\r
+\r
+ WriteCommand(0XD61c);\r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XD61d);\r
+ WriteParameter(0xe3);\r
+\r
+ WriteCommand(0XD61e);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD61f);\r
+ WriteParameter(0x08);\r
+\r
+ WriteCommand(0XD620);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD621);\r
+ WriteParameter(0x16);\r
+\r
+ WriteCommand(0XD622);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD623);\r
+ WriteParameter(0x2b);\r
+\r
+ WriteCommand(0XD624);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD625);\r
+ WriteParameter(0x4d);\r
+\r
+ WriteCommand(0XD626);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD627);\r
+ WriteParameter(0x6f);\r
+\r
+ WriteCommand(0XD628);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD629);\r
+ WriteParameter(0x8c);\r
+\r
+ WriteCommand(0XD62a);\r
+ WriteParameter(0x02);\r
+\r
+ WriteCommand(0XD62b);\r
+ WriteParameter(0xd6);\r
+\r
+ WriteCommand(0XD62C);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD62D);\r
+ WriteParameter(0x12);\r
+\r
+ WriteCommand(0XD62E);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD62F);\r
+ WriteParameter(0x28);\r
+\r
+ WriteCommand(0XD630);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD631);\r
+ WriteParameter(0x3e);\r
+\r
+ WriteCommand(0XD632);\r
+ WriteParameter(0x03);\r
+\r
+ WriteCommand(0XD633);\r
+ WriteParameter(0x9A);\r
+\r
+ WriteCommand(0XBA00); \r
+ WriteParameter(0x14);\r
+\r
+ WriteCommand(0XBA01); \r
+ WriteParameter(0x14);\r
+\r
+ WriteCommand(0XBA02); \r
+ WriteParameter(0x14);\r
+\r
+ WriteCommand(0XBF00); \r
+ WriteParameter(0x01);\r
+\r
+ WriteCommand(0XB300); \r
+ WriteParameter(0x07);\r
+\r
+ WriteCommand(0XB301); \r
+ WriteParameter(0x07);\r
+\r
+ WriteCommand(0XB302); \r
+ WriteParameter(0x07);\r
+\r
+ WriteCommand(0XB900); \r
+ WriteParameter(0x25);\r
+\r
+ WriteCommand(0XB901); \r
+ WriteParameter(0x25);\r
+\r
+ WriteCommand(0XB902); \r
+ WriteParameter(0x25);\r
+\r
+\r
+\r
+ WriteCommand(0XBC01); \r
+ WriteParameter(0xA0);\r
+\r
+ WriteCommand(0XBC02); \r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XBD01); \r
+ WriteParameter(0xA0);\r
+\r
+ WriteCommand(0XBD02); \r
+ WriteParameter(0x00);\r
+\r
+\r
+ WriteCommand(0XF000); \r
+ WriteParameter(0x55);\r
+\r
+ WriteCommand(0XF001); \r
+ WriteParameter(0xAA);\r
+\r
+ WriteCommand(0XF002); \r
+ WriteParameter(0x52);\r
+\r
+ WriteCommand(0XF003); \r
+ WriteParameter(0x08);\r
+\r
+ WriteCommand(0XF004); \r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0XB100); \r
+ WriteParameter(0xCC);\r
+\r
+ WriteCommand(0XBC00); \r
+ WriteParameter(0x05);\r
+\r
+ WriteCommand(0XBC01); \r
+ WriteParameter(0x05);\r
+\r
+ WriteCommand(0XBC02); \r
+ WriteParameter(0x05);\r
+\r
+\r
+ WriteCommand(0XBD02); \r
+ WriteParameter(0x07);\r
+ WriteCommand(0XBD03); \r
+ WriteParameter(0x31);\r
+\r
+ WriteCommand(0XBE02); \r
+ WriteParameter(0x07);\r
+ WriteCommand(0XBE03); \r
+ WriteParameter(0x31);\r
+\r
+ WriteCommand(0XBF02); \r
+ WriteParameter(0x07);\r
+ WriteCommand(0XBF03); \r
+ WriteParameter(0x31);\r
+\r
+ WriteCommand(0XFF00); \r
+ WriteParameter(0xAA);\r
+ WriteCommand(0XFF01); \r
+ WriteParameter(0x55);\r
+ WriteCommand(0XFF02); \r
+ WriteParameter(0x25);\r
+ WriteCommand(0XFF03); \r
+ WriteParameter(0x01);\r
+\r
+\r
+ WriteCommand(0X3500); \r
+ WriteParameter(0x00);\r
+\r
+ WriteCommand(0X3a00); \r
+ WriteParameter(0x60);//WriteParameter(0x66);\r
+\r
+ WriteCommand(0X3600); \r
+ WriteParameter(0x00);//R<->B\r
+\r
+ WriteCommand(0X2000); //\r
+\r
+ WriteCommand(0X1100); \r
+ mdelay(120);\r
+\r
+ WriteCommand(0X2900); \r
+\r
+ mdelay(100);\r
+ WriteCommand(0X2C00); \r
+}\r
+\r
+\r
+\r
int init(void)\r
{ \r
volatile u32 data;\r
+ int i;\r
+ printk("lcd init...\n");\r
+ /* reset lcd to start init lcd */\r
+ gpio_request(RK29_PIN6_PC6, NULL);\r
+ gpio_direction_output(RK29_PIN6_PC6, 1);\r
+ gpio_direction_output(RK29_PIN6_PC6, 0);\r
+ mdelay(5);\r
+ gpio_set_value(RK29_PIN6_PC6, 1);\r
+ mdelay(50);\r
+ gpio_free(RK29_PIN6_PC6);\r
\r
if(gLcd_info)\r
gLcd_info->io_init();\r
+ init_nt35510();\r
\r
- printk("lcd init...\n");\r
- spi_screenreg_cmd(0xB1);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_cmd(0xB2);\r
- spi_screenreg_param(0x10);\r
- spi_screenreg_param(0xC7);\r
- spi_screenreg_cmd(0xB3);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_cmd(0xB4);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_cmd(0xB9);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_cmd(0xC3);\r
- spi_screenreg_param(0x07);\r
- spi_screenreg_cmd(0xB2);\r
- spi_screenreg_param(0x04);\r
- spi_screenreg_param(0x0B);\r
- spi_screenreg_param(0x0B);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x07);\r
- spi_screenreg_param(0x04);\r
- spi_screenreg_cmd(0xC5);\r
- spi_screenreg_param(0x6E);\r
- spi_screenreg_cmd(0xC2);\r
- spi_screenreg_param(0x20);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x10);\r
- mdelay(20);//20ms\r
- \r
- spi_screenreg_cmd(0xC8);\r
- spi_screenreg_param(0xA3);\r
- spi_screenreg_cmd(0xC9);\r
- spi_screenreg_param(0x32);\r
- spi_screenreg_param(0x06);\r
- spi_screenreg_cmd(0xD7);\r
- spi_screenreg_param(0x03);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x0F);\r
- spi_screenreg_param(0x0F);\r
- spi_screenreg_cmd(0xCF);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x08);\r
- spi_screenreg_cmd(0xB6);\r
- spi_screenreg_param(0x20);\r
- spi_screenreg_param(0xC2);\r
- spi_screenreg_param(0xFF);\r
- spi_screenreg_param(0x04);\r
- spi_screenreg_cmd(0xEA);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_cmd(0x2A);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x01);\r
- spi_screenreg_param(0xDF);\r
- spi_screenreg_cmd(0x2B);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x03);\r
- spi_screenreg_param(0xEF);\r
- spi_screenreg_cmd(0xB0);\r
- spi_screenreg_param(0x01);\r
- spi_screenreg_cmd(0x0C);\r
- spi_screenreg_param(0x50);\r
- spi_screenreg_cmd(0x36);\r
- spi_screenreg_param(0x48);\r
- spi_screenreg_cmd(0x3A);\r
- spi_screenreg_param(0x66);\r
- spi_screenreg_cmd(0xE0);\r
- spi_screenreg_param(0x05);\r
- spi_screenreg_param(0x07);\r
- spi_screenreg_param(0x0B);\r
- spi_screenreg_param(0x14);\r
- spi_screenreg_param(0x11);\r
- spi_screenreg_param(0x14);\r
- spi_screenreg_param(0x0A);\r
- spi_screenreg_param(0x07);\r
- spi_screenreg_param(0x04);\r
- spi_screenreg_param(0x0B);\r
- spi_screenreg_param(0x02);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x04);\r
- spi_screenreg_param(0x33);\r
- spi_screenreg_param(0x36);\r
- spi_screenreg_param(0x1F);\r
- spi_screenreg_cmd(0xE1);\r
- spi_screenreg_param(0x1F);\r
- spi_screenreg_param(0x36);\r
- spi_screenreg_param(0x33);\r
- spi_screenreg_param(0x04);\r
- spi_screenreg_param(0x00);\r
- spi_screenreg_param(0x02);\r
- spi_screenreg_param(0x0B);\r
- spi_screenreg_param(0x04);\r
- spi_screenreg_param(0x07);\r
- spi_screenreg_param(0x0A);\r
- spi_screenreg_param(0x14);\r
- spi_screenreg_param(0x11);\r
- spi_screenreg_param(0x14);\r
- spi_screenreg_param(0x0B);\r
- spi_screenreg_param(0x07);\r
- spi_screenreg_param(0x05);\r
- spi_screenreg_cmd(0x11);\r
- mdelay(70);\r
- spi_screenreg_cmd(0x29);\r
- mdelay(10);\r
- spi_screenreg_cmd(0x2C);\r
if(gLcd_info)\r
gLcd_info->io_deinit();\r
\r
+ set_backlight(255);\r
+\r
return 0;\r
}\r
\r
int standby(u8 enable) //***enable =1 means suspend, 0 means resume \r
{\r
int i;\r
-#if 1 \r
+ set_backlight(0);\r
+#if 0\r
if(gLcd_info)\r
gLcd_info->io_init();\r
\r
return 0;\r
}\r
\r
-void set_backlight(int brightness)\r
-{\r
-#if 1\r
- if(gLcd_info)\r
- gLcd_info->io_init();\r
-\r
- printk("lcd_ili9803:set_backlight = %d\r\n", brightness);\r
- if (brightness < 0)\r
- {\r
- brightness = 0;\r
- }\r
- if (brightness > 4)\r
- {\r
- brightness = 4;\r
- }\r
- spi_screenreg_cmd(0x51);\r
- spi_screenreg_param(brightness<<5);\r
- \r
- if(gLcd_info)\r
- gLcd_info->io_deinit();\r
\r
-#endif\r
-}\r