rk2928_defconfig: support 'rk2926 sdk(m713)'
authorkfx <kfx@rock-chips.com>
Tue, 23 Oct 2012 00:34:49 +0000 (08:34 +0800)
committerkfx <kfx@rock-chips.com>
Tue, 23 Oct 2012 00:34:49 +0000 (08:34 +0800)
arch/arm/mach-rk2928/board-rk2928-config.c
arch/arm/mach-rk2928/include/mach/config.h
drivers/input/touchscreen/eeti_egalax_i2c.c
drivers/input/touchscreen/rk_tp.c
drivers/input/touchscreen/sitronix_ts_a720.c

index 0b1d38b90bc9676f065b0c10b37649c721a4ec0e..20f99c0ae6235fc5d955bbab480c6fc02cb85bbe 100644 (file)
@@ -38,6 +38,16 @@ static struct pwm_io_config pwm_cfg[] = {
 };
 
 /*************************************** parameter ******************************************/
+/* Android Parameter */
+static int ap_mdm = DEF_AP_MDM;
+module_param(ap_mdm, int, 0644);
+static int ap_has_alsa = DEF_AP_HAS_ALSA;
+module_param(ap_has_alsa, int, 0644);
+static int ap_multi_card = DEF_AP_MULTI_CARD;
+module_param(ap_multi_card, int, 0644);
+static int ap_data_only = DEF_AP_DATA_ONLY;
+module_param(ap_data_only, int, 0644);
+
 /* keyboard */
 uint key_adc = DEF_KEY_ADC;
 uint key_val_size = 7;
index c597f6e6b8c5334fe909498648dd596f73846dad..df48b08e33b039b81c64f5b671464c9c4c5e3f18 100644 (file)
@@ -3,7 +3,24 @@
 #include <mach/board.h>
 
 #define RK2926_TB_DEFAULT_CONFIG
-
+//#define RK2926_SDK_DEFAULT_CONFIG
+enum {
+        WIFI_NONE = 0,
+        WIFI_USB_NONE = 1<<4,
+        //here: add usb wifi type
+        WIFI_USB_MAX,
+        WIFI_SDIO_NONE = 1<<8,
+        //here: add sdio wifi type
+        WIFI_SDIO_MAX,
+};
+/* android paramter */
+enum {
+        DEF_AP_MDM = -1,
+        DEF_AP_HAS_ALSA = -1,
+        DEF_AP_MULTI_CARD = -1,
+        DEF_AP_DATA_ONLY = -1,
+};
+/****************************  rk2926 top board ******************************/
 #if defined(RK2926_TB_DEFAULT_CONFIG)
 /* keyboard */
 enum{
@@ -79,15 +96,106 @@ enum {
 };
 /* wifi */
 enum {
-        WIFI_NONE = 0,
-        WIFI_USB_NONE = 1<<4,
-        //here: add usb wifi type
-        WIFI_USB_MAX,
-        WIFI_SDIO_NONE = 1<<8,
-        //here: add sdio wifi type
-        WIFI_SDIO_MAX,
+        DEF_WIFI_RST = -1,
+        DEF_WIFI_PWR = -1,
+        DEF_WIFI_TYPE = WIFI_NONE, 
+};
+/* rtc */
+enum {
+        DEF_RTC_I2C = 0,
+        DEF_RTC_ADDR = 0x51,
+        DEF_RTC_IRQ = -1,
+};
+/* charge */
+enum {
+        DEF_CHG_ADC = 0,
+        DEF_DC_DET = -1,
+        DEF_BAT_LOW = -1,
+        DEF_CHG_OK = -1,
+        DEF_CHG_SET = -1,
+        DEF_CHG_SEL = -1,
+};
+
+/* global */
+enum {
+        DEF_PWR_ON = 0x000001a2,
+};
+
+/****************************  rk2926 sdk(m713) ******************************/
+#elif defined(RK2926_SDK_DEFAULT_CONFIG)
+/* keyboard */
+enum{
+        DEF_KEY_ADC = 1,
+        DEF_PLAY_KEY = 0x000101a4,
+        DEF_VOLDN_KEY = 512 | (1<<31),
+        DEF_VOLUP_KEY = 1  | (1<<31),
+        DEF_MENU_KEY = 0 | (1<<31),
+        DEF_ESC_KEY = 0  | (1<<31),
+        DEF_HOME_KEY = 0 | (1<<31),
+        DEF_CAM_KEY = 0  | (1<<31),
+};
+/* backlight */
+enum{
+        DEF_BL_PWM = 0,
+        DEF_BL_REF = 0,
+        DEF_BL_MIN = 80,
+        DEF_BL_EN = 0x000001b0,
+};
+/* lcd */
+enum {
+        DEF_LCD_CABC = -1,
+        DEF_LCD_EN = 0x000101b3,
+        DEF_LCD_STD = -1,
+};
+
+#define DEF_LCD_PARAM {SCREEN_RGB, OUT_P666, \
+                        33000000, 15000000, \
+                        30, 10, 800, 210, \
+                        13, 10, 480, 22, \
+                        154, 85, \
+                        1, 0 }
+/* gsensor */
+enum { 
+        GS_TYPE_NONE = 0,
+        GS_TYPE_MMA8452,
+        GS_TYPE_MMA7660,
+        GS_TYPE_MAX,
 };
 
+enum {
+        DEF_GS_TYPE = GS_TYPE_MMA7660,
+        DEF_GS_I2C = 1,
+        DEF_GS_ADDR = 0x4c,
+        DEF_GS_IRQ = 0x008001b2,
+        DEF_GS_PWR = -1,
+};
+#define DEF_GS_ORIG {-1, 0, 0, 0, 0, -1, 0, 1, 0}
+/* pwm regulator */
+enum {
+        DEF_REG_PWM = 1,
+};
+/* pmic */
+enum {
+        DEF_PMIC_TYPE = PMIC_TYPE_ACT8931,
+        DEF_PMIC_SLP = 0x000001a1,
+        DEF_PMIC_IRQ = 0x000001b1,
+        DEF_PMIC_I2C = 0,
+        DEF_PMIC_ADDR = 0x5b, 
+};
+/* ion */
+enum {
+        DEF_ION_SIZE = 80 * 1024 * 1024,
+};
+/* codec */
+enum {
+        DEF_SPK_CTL = 0x000001a0,
+        DEF_HP_DET = -1,
+};
+/* sdmmc */
+enum {
+        DEF_SD_DET = 0x000102a7,
+};
+/* wifi */
 enum {
         DEF_WIFI_RST = -1,
         DEF_WIFI_PWR = -1,
@@ -97,7 +205,7 @@ enum {
 enum {
         DEF_RTC_I2C = 0,
         DEF_RTC_ADDR = 0x51,
-        DEF_RTC_IRQ = -1,
+        DEF_RTC_IRQ = 0x008001a5,
 };
 /* charge */
 enum {
@@ -113,6 +221,7 @@ enum {
 enum {
         DEF_PWR_ON = 0x000001a2,
 };
+/****************************  other ******************************/
 #else
 /* keyboard */
 enum{
@@ -187,16 +296,6 @@ enum {
         DEF_SD_DET = -1,
 };
 /* wifi */
-enum {
-        WIFI_NONE = 0,
-        WIFI_USB_NONE = 1<<4,
-        //here: add usb wifi type
-        WIFI_USB_MAX,
-        WIFI_SDIO_NONE = 1<<8,
-        //here: add sdio wifi type
-        WIFI_SDIO_MAX,
-};
-
 enum {
         DEF_WIFI_RST = -1,
         DEF_WIFI_PWR = -1,
index 9373d0b3ffcf469e8316f79e890d02f907a16068..418e380c24c2b8840891b4941cb26466c613e56e 100755 (executable)
@@ -41,7 +41,9 @@
 #include <linux/irq.h>
 #include <linux/async.h>
 #include <mach/board.h>
+#ifdef CONFIG_RK_CONFIG
 #include <mach/config.h>
+#endif
 
 #ifdef CONFIG_HAS_EARLYSUSPEND
 #include <linux/earlysuspend.h>
index 7dc8359ba2c30ef7006c0d841b489db5b3b3d841..bf4fc7724967b934f4c2e633f02e96d2f4af9531 100755 (executable)
@@ -16,7 +16,7 @@ static int check_tp_param(void)
         }
 }
 
-struct i2c_board_info __initdata tp_info = {
+static struct i2c_board_info __initdata tp_info = {
         .type = TP_MODULE_NAME,
         .flags = 0,
 };
index c34f6773a9dd0f73728437d6fa5be80a033f4ba4..0b449a7721941f7d99e1d0a0bb8530c4f73c2e9b 100755 (executable)
@@ -29,6 +29,9 @@
 #include <linux/slab.h> // to be compatible with linux kernel 3.2.15
 #include <linux/gpio.h>
 #include <mach/board.h>
+#ifdef CONFIG_RK_CONFIG
+#include <mach/config.h>
+#endif
 #include <linux/input/mt.h>
 
 #ifdef SITRONIX_MONITOR_THREAD
 //#include <mach/gpio.h>
 #endif // SITRONIX_MONITOR_THREAD
 
+#define TP_MODULE_NAME  SITRONIX_I2C_TOUCH_DRV_NAME
+#ifdef CONFIG_RK_CONFIG
+
+enum {
+#ifdef RK2926_SDK_DEFAULT_CONFIG
+        DEF_EN = 1,
+#else
+        DEF_EN = 0,
+#endif
+        DEF_IRQ = 0x008001b0,
+        DEF_RST = 0X000001a3,
+        DEF_I2C = 2, 
+        DEF_ADDR = 0x60,
+        DEF_X_MAX = 800,
+        DEF_Y_MAX = 480,
+};
+static int en = DEF_EN;
+module_param(en, int, 0644);
+
+static int irq = DEF_IRQ;
+module_param(irq, int, 0644);
+static int rst =DEF_RST;
+module_param(rst, int, 0644);
+
+static int i2c = DEF_I2C;            // i2c channel
+module_param(i2c, int, 0644);
+static int addr = DEF_ADDR;           // i2c addr
+module_param(addr, int, 0644);
+static int x_max = DEF_X_MAX;
+module_param(x_max, int, 0644);
+static int y_max = DEF_Y_MAX;
+module_param(y_max, int, 0644);
+
+static int tp_hw_init(void)
+{
+        int ret = 0;
+
+        ret = gpio_request(get_port_config(irq).gpio, "tp_irq");
+        if(ret < 0){
+                printk("%s: gpio_request(irq gpio) failed\n", __func__);
+                return ret;
+        }
+
+        ret = port_output_init(rst, 1, "tp_rst");
+        if(ret < 0){
+                printk("%s: port(rst) output init faild\n", __func__);
+                return ret;
+        }
+        mdelay(10);
+        port_output_off(rst);
+        mdelay(10);
+        port_output_on(rst);
+        msleep(300);
+
+         return 0;
+}
+#include "rk_tp.c"
+#endif
+
+
 #define DRIVER_AUTHOR           "Sitronix, Inc."
 #define DRIVER_NAME             "sitronix"
 #define DRIVER_DESC             "Sitronix I2C touch"
@@ -856,6 +919,15 @@ static int sitronix_ts_probe(struct i2c_client *client, const struct i2c_device_
        struct ft5x0x_platform_data *pdata;
        uint8_t dev_status = 0;
 
+#ifdef CONFIG_RK_CONFIG
+        struct port_config irq_cfg = get_port_config(irq);
+
+        client->irq = irq_cfg.gpio;
+        tp_hw_init();
+#else
+       if(pdata->init_platform_hw)
+               pdata->init_platform_hw();
+#endif
        printk("lr------> %s start ------\n", __FUNCTION__);
        if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
                ret = -ENODEV;
@@ -882,8 +954,6 @@ static int sitronix_ts_probe(struct i2c_client *client, const struct i2c_device_
                mdelay(SITRONIX_TS_CHANGE_MODE_DELAY);
        }
 #endif
-       if(pdata->init_platform_hw)
-               pdata->init_platform_hw();
 
        sitronix_ts_gpts = ts;
 
@@ -976,9 +1046,13 @@ static int sitronix_ts_probe(struct i2c_client *client, const struct i2c_device_
        ts->max_touches = 5;
 
        input_mt_init_slots(ts->input_dev, ts->max_touches);
-
+#ifdef CONFIG_RK_COFNIG
+       input_set_abs_params(ts->input_dev,ABS_MT_POSITION_X, 0, x_max, 0, 0);
+       input_set_abs_params(ts->input_dev,ABS_MT_POSITION_Y, 0, y_max, 0, 0);
+#else
        input_set_abs_params(ts->input_dev,ABS_MT_POSITION_X, 0, 800, 0, 0);
        input_set_abs_params(ts->input_dev,ABS_MT_POSITION_Y, 0, 480, 0, 0);
+#endif
        input_set_abs_params(ts->input_dev,ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
 
        for (i = 0; i < ARRAY_SIZE(initkey_code); i++) {
@@ -993,11 +1067,15 @@ static int sitronix_ts_probe(struct i2c_client *client, const struct i2c_device_
 
        ts->suspend_state = 0;
        if (client->irq){
-#ifdef SITRONIX_LEVEL_TRIGGERED
+        #ifdef CONFIG_RK_CONFIG
+               ret = request_irq(client->irq, sitronix_ts_irq_handler,  irq_cfg.irq.irq_flags | IRQF_DISABLED, client->name, ts);
+        #else
+                #ifdef SITRONIX_LEVEL_TRIGGERED
                ret = request_irq(client->irq, sitronix_ts_irq_handler, IRQF_TRIGGER_LOW | IRQF_DISABLED, client->name, ts);
-#else
+                #else
                ret = request_irq(client->irq, sitronix_ts_irq_handler, IRQF_TRIGGER_FALLING | IRQF_DISABLED, client->name, ts);
-#endif // SITRONIX_LEVEL_TRIGGERED
+                #endif // SITRONIX_LEVEL_TRIGGERED
+        #endif // CONFIG_RK_CONFIG
                if (ret == 0){
                        sitronix_ts_irq_on = 1;
                        ts->use_irq = 1;
@@ -1180,6 +1258,13 @@ static int __devinit sitronix_ts_init(void)
        int result;
        int err = 0;
 #endif // SITRONIX_FW_UPGRADE_FEATURE
+
+#ifdef CONFIG_RK_CONFIG
+        int ret = tp_board_init();
+
+        if(ret < 0)
+                return ret;
+#endif
        printk("Sitronix touch driver %d.%d.%d\n", DRIVER_MAJOR, DRIVER_MINOR, DRIVER_PATCHLEVEL);
        printk("Release date: %s\n", DRIVER_DATE);
 #ifdef SITRONIX_FW_UPGRADE_FEATURE
@@ -1208,6 +1293,8 @@ static int __devinit sitronix_ts_init(void)
        }
        device_create(sitronix_class, NULL, MKDEV(sitronix_major, 0), NULL, SITRONIX_I2C_TOUCH_DEV_NAME);
 #endif // SITRONIX_FW_UPGRADE_FEATURE
+
+
        return i2c_add_driver(&sitronix_ts_driver);
 }