rk2928_defconfig: support 'rk2928 sdk'
authorkfx <kfx@rock-chips.com>
Tue, 23 Oct 2012 07:53:13 +0000 (15:53 +0800)
committerkfx <kfx@rock-chips.com>
Tue, 23 Oct 2012 07:53:13 +0000 (15:53 +0800)
arch/arm/mach-rk2928/board-rk2928-sdk-act8931.c
arch/arm/mach-rk2928/board-rk2928-sdk-tps65910.c
arch/arm/mach-rk2928/board-rk2928.c
arch/arm/mach-rk2928/include/mach/config.h
drivers/input/touchscreen/eeti_egalax_i2c.c
drivers/input/touchscreen/sitronix_ts_a720.c

index 727fcf43675421140a01893754d34afbf08b9552..019d677518ca97775ba1009fc095e0a14dfeed1f 100755 (executable)
@@ -9,12 +9,16 @@
 
 #ifdef CONFIG_REGULATOR_ACT8931
 
+#ifndef CONFIG_RK_CONFIG
+
 #if defined(CONFIG_MACH_RK2928_SDK)
 #define ACT8931_CHGSEL_PIN RK2928_PIN0_PD0
 #else
 #define ACT8931_CHGSEL_PIN RK2928_PIN1_PA1
 #endif
 
+#endif
+
 #define ACT8931_CHGSEL_VALUE GPIO_HIGH /* Declined to 20% current */
 
 extern int platform_device_register(struct platform_device *pdev);
@@ -86,11 +90,14 @@ static int act8931_set_init(struct act8931 *act8931)
        printk("%s set dcdc3 vdd_arm=%dmV end\n", __func__, regulator_get_voltage(dcdc));
        regulator_put(dcdc);
        udelay(100);
-       
+#ifdef CONFIG_RK_CONFIG
+        ret = port_output_init(chg_sel, 1, "chg_sel");
+#else
        ret = gpio_request(ACT8931_CHGSEL_PIN, "ACT8931_CHGSEL");
        if (ret != 0)
                gpio_free(ACT8931_CHGSEL_PIN);
        gpio_direction_output(ACT8931_CHGSEL_PIN, ACT8931_CHGSEL_VALUE);
+#endif
 
        printk("%s,line=%d END\n", __func__,__LINE__);
        
@@ -296,12 +303,20 @@ static struct act8931_platform_data act8931_data={
 #ifdef CONFIG_HAS_EARLYSUSPEND
 void act8931_early_suspend(struct early_suspend *h)
 {
+#if CONFIG_RK_CONFIG
+        port_output_off(chg_sel);
+#else
        gpio_direction_output(ACT8931_CHGSEL_PIN, !ACT8931_CHGSEL_VALUE);
+#endif
 }
 
 void act8931_late_resume(struct early_suspend *h)
 {
+#if CONFIG_RK_CONFIG
+        port_output_on(chg_sel);
+#else
        gpio_direction_output(ACT8931_CHGSEL_PIN, ACT8931_CHGSEL_VALUE);
+#endif
 }
 #endif
 
index 2db393e157cd557914a30dfa36bef12ae8ad35eb..7980ac0fa979612913a283ff45a1aaf00339cc9a 100755 (executable)
@@ -9,6 +9,8 @@
 
 #ifdef CONFIG_MFD_TPS65910
 
+#ifndef CONFIG_RK_CONFIG
+
 #if defined(CONFIG_MACH_RK2928_SDK)
 #define PMU_POWER_SLEEP RK2928_PIN0_PD0        
 #elif defined(CONFIG_MACH_RK2928_TB)
@@ -17,6 +19,8 @@
 #define PMU_POWER_SLEEP RK2928_PIN1_PA1
 #endif
 
+#endif
+
 #define GPIO_SWPORTA_DR  0x0000
 #define GPIO_SWPORTA_DDR 0x0004
 struct sram_gpio_data {
@@ -65,15 +69,22 @@ int tps65910_pre_init(struct tps65910 *tps65910){
        printk("%s,line=%d\n", __func__,__LINE__);      
 #ifdef CONFIG_RK_CONFIG
         if(sram_gpio_init(get_port_config(pmic_slp).gpio, &pmic_sleep) < 0){
+                printk(KERN_ERR "sram_gpio_init failed\n");
+                return -EINVAL;
+        }
+        if(port_output_init(pmic_slp, 1, "pmic_slp") < 0){
+                printk(KERN_ERR "port_output_init failed\n");
+                return -EINVAL;
+        }
 #else
         if(sram_gpio_init(PMU_POWER_SLEEP, &pmic_sleep) < 0){
-#endif
-                printk(KERN_ERR "PMU_POWER_SLEEP is invalid gpio\n");
+                printk(KERN_ERR "sram_gpio_init failed\n");
                 return -EINVAL;
         }
 
        gpio_request(PMU_POWER_SLEEP, "NULL");
        gpio_direction_output(PMU_POWER_SLEEP, GPIO_LOW);
+#endif
 
        val = tps65910_reg_read(tps65910, TPS65910_DEVCTRL2);
        if (val<0) {
index 6c5f9c0a02299922bcc51c86165c220ce66adc9d..c1c9facb42fc5e6904c29322849321b52c83b7ea 100755 (executable)
@@ -582,11 +582,13 @@ int rk30_battery_adc_io_init(void){
        return 0;
 }
 
-int rk30_battery_adc_is_dc_charging( ){
-        return  act8931_charge_det  ;  
+int rk30_battery_adc_is_dc_charging(void)
+{
+        return  act8931_charge_det;  
 }
-int rk30_battery_adc_charging_ok( ){
-       return act8931_charge_ok ;
+int rk30_battery_adc_charging_ok(void)
+{
+       return act8931_charge_ok;
 }
 #endif
 
@@ -797,6 +799,7 @@ static void __init rk30_i2c_register_board_info(void)
 
 /**************** gsensor ****************/
 // kxtik
+#if defined (CONFIG_GS_KXTIK)
 static int kxtik_init_platform_hw(void)
 {
        return 0;
@@ -813,6 +816,7 @@ struct i2c_board_info __initdata kxtik_info = {
         .flags = 0,
         .platform_data = &kxtik_data,
 };
+#endif
 #if defined (CONFIG_GS_MMA8452)
 static int mma8452_init_platform_hw(void)
 {
@@ -859,11 +863,15 @@ static int __init gs_board_init(void)
                 return ret;
         port = get_port_config(gs_irq);
         //kxtik
-        kxtik_info.irq = port.gpio;
-        kxtik_info.addr = gs_addr;
-        for(i = 0; i < 9; i++)
-                kxtik_data.orientation[i] = gs_orig[i];
-       i2c_register_board_info(gs_i2c, &kxtik_info, 1);
+#if defined (CONFIG_GS_KXTIK)
+        if(gs_type == GS_TYPE_KXTIK){
+                kxtik_info.irq = port.gpio;
+                kxtik_info.addr = gs_addr;
+                for(i = 0; i < 9; i++)
+                        kxtik_data.orientation[i] = gs_orig[i];
+               i2c_register_board_info(gs_i2c, &kxtik_info, 1);
+        }
+#endif
         //mma7660
 #if defined (CONFIG_GS_MMA7660)
         if(gs_type == GS_TYPE_MMA7660){
index 687a72d0fff0a1440256fda365444aaeead7d8da..4bc3eb244905b5347771af42c8bbc6ce32f51e09 100644 (file)
@@ -2,11 +2,18 @@
 #define __MACH_CONFIG_H
 #include <mach/board.h>
 
-#define RK2926_TB_DEFAULT_CONFIG
+//#define RK2926_TB_DEFAULT_CONFIG
 //#define RK2928_TB_DEFAULT_CONFIG
-//#define RK2926_SDK_DEFAULT_CONFIG
+#define RK2926_SDK_DEFAULT_CONFIG
 //#define RK2928_SDK_DEFAULT_CONFIG
 
+enum { 
+        GS_TYPE_NONE = 0,
+        GS_TYPE_MMA8452,
+        GS_TYPE_MMA7660,
+        GS_TYPE_KXTIK,
+        GS_TYPE_MAX,
+};
 enum {
         WIFI_NONE = 0,
         WIFI_USB_NONE = 1<<4,
@@ -58,12 +65,6 @@ enum {
                         202, 102, \
                         1, 0 }
 /* gsensor */
-enum { 
-        GS_TYPE_NONE = 0,
-        GS_TYPE_MMA8452,
-        GS_TYPE_MMA7660,
-        GS_TYPE_MAX,
-};
 
 enum {
         DEF_GS_TYPE = GS_TYPE_MMA8452,
@@ -158,13 +159,6 @@ enum {
                         202, 102, \
                         1, 0 }
 /* gsensor */
-enum { 
-        GS_TYPE_NONE = 0,
-        GS_TYPE_MMA8452,
-        GS_TYPE_MMA7660,
-        GS_TYPE_MAX,
-};
-
 enum {
         DEF_GS_TYPE = GS_TYPE_MMA8452,
         DEF_GS_I2C = 0,
@@ -243,7 +237,7 @@ enum{
         DEF_BL_PWM = 0,
         DEF_BL_REF = 0,
         DEF_BL_MIN = 80,
-        DEF_BL_EN = 0x000001b0,
+        DEF_BL_EN = -1,
 };
 /* lcd */
 enum {
@@ -259,13 +253,6 @@ enum {
                         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,
@@ -318,13 +305,107 @@ enum {
         DEF_BAT_LOW = -1,
         DEF_CHG_OK = -1,
         DEF_CHG_SET = -1,
-        DEF_CHG_SEL = -1,
+        DEF_CHG_SEL = 0x000001a1,
 };
 
 /* global */
 enum {
         DEF_PWR_ON = 0x000001a2,
 };
+/****************************  rk2928 sdk ******************************/
+#elif defined(RK2928_SDK_DEFAULT_CONFIG)
+/* keyboard */
+enum{
+        DEF_KEY_ADC = 1,
+        DEF_PLAY_KEY = 0x000100d1,
+        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 = 0x000003c5,
+};
+/* lcd */
+enum {
+        DEF_LCD_CABC = -1,
+        DEF_LCD_EN = 0x000103b3,
+        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 {
+        DEF_GS_TYPE = GS_TYPE_MMA7660,
+        DEF_GS_I2C = 1,
+        DEF_GS_ADDR = 0x4c,
+        DEF_GS_IRQ = 0x008003d1,
+        DEF_GS_PWR = -1,
+};
+#define DEF_GS_ORIG {-1, 0, 0, 0, 0, 1, 0, -1, 0}
+/* pwm regulator */
+enum {
+        DEF_REG_PWM = 2,
+};
+/* pmic */
+enum {
+        DEF_PMIC_TYPE = PMIC_TYPE_ACT8931,
+        DEF_PMIC_SLP = 0x000000d0,
+        DEF_PMIC_IRQ = 0x000003c6,
+        DEF_PMIC_I2C = 0,
+        DEF_PMIC_ADDR = 0x5b, 
+};
+/* ion */
+enum {
+        DEF_ION_SIZE = 80 * 1024 * 1024,
+};
+/* codec */
+enum {
+        DEF_SPK_CTL = 0x000003d4,
+        DEF_HP_DET = -1,
+};
+/* sdmmc */
+enum {
+        DEF_SD_DET = 0x000101c1,
+};
+/* wifi */
+enum {
+        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 = 0x008001a5,
+};
+/* charge */
+enum {
+        DEF_CHG_ADC = 0,
+        DEF_DC_DET = 0x000101b4,
+        DEF_BAT_LOW = -1,
+        DEF_CHG_OK = 0x000001a0,
+        DEF_CHG_SET = -1,
+        DEF_CHG_SEL = 0x000000d0,
+};
+
+/* global */
+enum {
+        DEF_PWR_ON = 0x000001a1,
+};
+
 /****************************  other ******************************/
 #else
 /* keyboard */
@@ -359,13 +440,6 @@ enum {
                         0, 0, \
                         0, 0 }
 /* gsensor */
-enum { 
-        GS_TYPE_NONE = 0,
-        GS_TYPE_MMA8452,
-        GS_TYPE_MMA7660,
-        GS_TYPE_MAX,
-};
-
 enum {
         DEF_GS_TYPE = GS_TYPE_NONE,
         DEF_GS_I2C = -1,
index e4258a1880fa080a30c5ff97d4f864b9ea4f19ac..fbbb5560a989677f8875272a728bbde9510ff4f4 100755 (executable)
@@ -64,6 +64,9 @@ enum {
 #elif defined(RK2928_TB_DEFAULT_CONFIG)
         DEF_IRQ = 0x008003c7,
         DEF_RST = 0X000003c3,
+#else
+        DEF_IRQ = -1,
+        DEF_RST = -1,
 #endif
         DEF_I2C = 2, 
         DEF_ADDR = 0x04,
index 0b449a7721941f7d99e1d0a0bb8530c4f73c2e9b..d6b1a32e648a8db09ba742001c75ce8102843d7d 100755 (executable)
@@ -43,7 +43,7 @@
 #ifdef CONFIG_RK_CONFIG
 
 enum {
-#ifdef RK2926_SDK_DEFAULT_CONFIG
+#if defined(RK2926_SDK_DEFAULT_CONFIG)
         DEF_EN = 1,
 #else
         DEF_EN = 0,
@@ -170,6 +170,7 @@ struct sitronix_ts_data {
        uint8_t touch_protocol_type;
        uint8_t pixel_length;
        int suspend_state;
+        int irq;
 };
 
 static unsigned char initkey_code[] =
@@ -303,7 +304,7 @@ long         sitronix_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                        UpgradeMsg("IOCTL_SMT_ENABLE_IRQ\n");
                        if(!sitronix_ts_irq_on){
                                sitronix_ts_irq_on = 1;
-                               enable_irq(sitronix_ts_gpts->client->irq);
+                               enable_irq(sitronix_ts_gpts->irq);
 #ifdef SITRONIX_MONITOR_THREAD
                                atomic_set(&iMonitorThreadPostpone,1);
                                SitronixMonitorThread = kthread_run(sitronix_ts_monitor_thread,"Sitronix","Monitorthread");
@@ -316,7 +317,7 @@ long         sitronix_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                        UpgradeMsg("IOCTL_SMT_DISABLE_IRQ\n");
                        if(sitronix_ts_irq_on){
                                sitronix_ts_irq_on = 0;
-                               disable_irq_nosync(sitronix_ts_gpts->client->irq);
+                               disable_irq_nosync(sitronix_ts_gpts->irq);
 #ifdef SITRONIX_MONITOR_THREAD
                                if(SitronixMonitorThread){
                                        kthread_stop(SitronixMonitorThread);
@@ -862,7 +863,7 @@ static void sitronix_ts_work_func(struct work_struct *work)
 #ifdef SITRONIX_INT_POLLING_MODE
                if (ts->use_irq){
                        sitronix_ts_irq_on = 1;
-                       enable_irq(ts->client->irq);
+                       enable_irq(ts->irq);
                }
 #endif // SITRONIX_INT_POLLING_MODE
        }
@@ -872,7 +873,7 @@ exit_invalid_data:
 #if defined(SITRONIX_LEVEL_TRIGGERED)
        if (ts->use_irq){
                sitronix_ts_irq_on = 1;
-               enable_irq(ts->client->irq);
+               enable_irq(ts->irq);
        }
 #endif // defined(SITRONIX_LEVEL_TRIGGERED)
        if ((2 <= i2cErrorCount)){
@@ -895,7 +896,7 @@ static irqreturn_t sitronix_ts_irq_handler(int irq, void *dev_id)
 //     printk("lr:%s\n", __FUNCTION__);
 #if defined(SITRONIX_LEVEL_TRIGGERED) || defined(SITRONIX_INT_POLLING_MODE)
        sitronix_ts_irq_on = 0;
-       disable_irq_nosync(ts->client->irq);
+       disable_irq_nosync(ts->irq);
 #endif // defined(SITRONIX_LEVEL_TRIGGERED) || defined(SITRONIX_INT_POLLING_MODE)
 #ifdef SITRONIX_MONITOR_THREAD
        atomic_set(&iMonitorThreadPostpone,1);
@@ -945,6 +946,8 @@ static int sitronix_ts_probe(struct i2c_client *client, const struct i2c_device_
        INIT_DELAYED_WORK(&ts->work, sitronix_ts_work_func);
 #endif // SITRONIX_INT_POLLING_MODE
        ts->client = client;
+        if(client->irq != INVALID_GPIO)
+                ts->irq = gpio_to_irq(client->irq);
        i2c_set_clientdata(client, ts);
        pdata = client->dev.platform_data;
 #if 0
@@ -1066,14 +1069,14 @@ static int sitronix_ts_probe(struct i2c_client *client, const struct i2c_device_
        }
 
        ts->suspend_state = 0;
-       if (client->irq){
+       if (ts->irq){
         #ifdef CONFIG_RK_CONFIG
-               ret = request_irq(client->irq, sitronix_ts_irq_handler,  irq_cfg.irq.irq_flags | IRQF_DISABLED, client->name, ts);
+               ret = request_irq(ts->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);
+               ret = request_irq(ts->irq, sitronix_ts_irq_handler, IRQF_TRIGGER_LOW | IRQF_DISABLED, client->name, ts);
                 #else
-               ret = request_irq(client->irq, sitronix_ts_irq_handler, IRQF_TRIGGER_FALLING | IRQF_DISABLED, client->name, ts);
+               ret = request_irq(ts->irq, sitronix_ts_irq_handler, IRQF_TRIGGER_FALLING | IRQF_DISABLED, client->name, ts);
                 #endif // SITRONIX_LEVEL_TRIGGERED
         #endif // CONFIG_RK_CONFIG
                if (ret == 0){
@@ -1128,7 +1131,7 @@ static int sitronix_ts_remove(struct i2c_client *client)
        }
 #endif // SITRONIX_MONITOR_THREAD
        if (ts->use_irq)
-               free_irq(client->irq, ts);
+               free_irq(ts->irq, ts);
        else
                hrtimer_cancel(&ts->timer);
        input_unregister_device(ts->input_dev);
@@ -1154,13 +1157,13 @@ static int sitronix_ts_suspend(struct i2c_client *client, pm_message_t mesg)
 #endif // SITRONIX_MONITOR_THREAD
        if(ts->use_irq){
                sitronix_ts_irq_on = 0;
-               disable_irq_nosync(ts->client->irq);
+               disable_irq_nosync(ts->irq);
        }
        ts->suspend_state = 1;
 
        ret = sitronix_ts_set_powerdown_bit(ts, 1);
 #ifdef SITRONIX_WAKE_UP_TOUCH_BY_INT
-       gpio_direction_output(irq_to_gpio(client->irq), 1);
+       gpio_direction_output(client->irq, 1);
 #endif // SITRONIX_WAKE_UP_TOUCH_BY_INT
        DbgMsg("%s return\n", __FUNCTION__);
 
@@ -1186,7 +1189,7 @@ static int sitronix_ts_resume(struct i2c_client *client)
        DbgMsg("%s\n", __FUNCTION__);
 
 #ifdef SITRONIX_WAKE_UP_TOUCH_BY_INT
-       gpio = irq_to_gpio(client->irq);
+       gpio = client->irq;
        gpio_set_value(gpio, 0);
        gpio_direction_input(gpio);
 #else
@@ -1196,7 +1199,7 @@ static int sitronix_ts_resume(struct i2c_client *client)
        ts->suspend_state = 0;
        if(ts->use_irq){
                sitronix_ts_irq_on = 1;
-               enable_irq(ts->client->irq);
+               enable_irq(ts->irq);
        }
 #ifdef SITRONIX_MONITOR_THREAD
        atomic_set(&iMonitorThreadPostpone,1);