From 767cf3e403c30730b46e36e31fde391584314fbf Mon Sep 17 00:00:00 2001 From: kfx Date: Tue, 23 Oct 2012 08:34:49 +0800 Subject: [PATCH] rk2928_defconfig: support 'rk2926 sdk(m713)' --- arch/arm/mach-rk2928/board-rk2928-config.c | 10 ++ arch/arm/mach-rk2928/include/mach/config.h | 137 ++++++++++++++++--- drivers/input/touchscreen/eeti_egalax_i2c.c | 2 + drivers/input/touchscreen/rk_tp.c | 2 +- drivers/input/touchscreen/sitronix_ts_a720.c | 99 +++++++++++++- 5 files changed, 224 insertions(+), 26 deletions(-) diff --git a/arch/arm/mach-rk2928/board-rk2928-config.c b/arch/arm/mach-rk2928/board-rk2928-config.c index 0b1d38b90bc9..20f99c0ae623 100644 --- a/arch/arm/mach-rk2928/board-rk2928-config.c +++ b/arch/arm/mach-rk2928/board-rk2928-config.c @@ -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; diff --git a/arch/arm/mach-rk2928/include/mach/config.h b/arch/arm/mach-rk2928/include/mach/config.h index c597f6e6b8c5..df48b08e33b0 100644 --- a/arch/arm/mach-rk2928/include/mach/config.h +++ b/arch/arm/mach-rk2928/include/mach/config.h @@ -3,7 +3,24 @@ #include #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, diff --git a/drivers/input/touchscreen/eeti_egalax_i2c.c b/drivers/input/touchscreen/eeti_egalax_i2c.c index 9373d0b3ffcf..418e380c24c2 100755 --- a/drivers/input/touchscreen/eeti_egalax_i2c.c +++ b/drivers/input/touchscreen/eeti_egalax_i2c.c @@ -41,7 +41,9 @@ #include #include #include +#ifdef CONFIG_RK_CONFIG #include +#endif #ifdef CONFIG_HAS_EARLYSUSPEND #include diff --git a/drivers/input/touchscreen/rk_tp.c b/drivers/input/touchscreen/rk_tp.c index 7dc8359ba2c3..bf4fc7724967 100755 --- a/drivers/input/touchscreen/rk_tp.c +++ b/drivers/input/touchscreen/rk_tp.c @@ -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, }; diff --git a/drivers/input/touchscreen/sitronix_ts_a720.c b/drivers/input/touchscreen/sitronix_ts_a720.c index c34f6773a9dd..0b449a772194 100755 --- a/drivers/input/touchscreen/sitronix_ts_a720.c +++ b/drivers/input/touchscreen/sitronix_ts_a720.c @@ -29,6 +29,9 @@ #include // to be compatible with linux kernel 3.2.15 #include #include +#ifdef CONFIG_RK_CONFIG +#include +#endif #include #ifdef SITRONIX_MONITOR_THREAD @@ -36,6 +39,66 @@ //#include #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); } -- 2.34.1