mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
K97 项目相关修改
This commit is contained in:
2527
arch/arm/configs/rk29_k97_defconfig
Normal file → Executable file
2527
arch/arm/configs/rk29_k97_defconfig
Normal file → Executable file
File diff suppressed because it is too large
Load Diff
@@ -27,6 +27,7 @@
|
||||
#ifdef CONFIG_USB_ANDROID
|
||||
#include <linux/usb/android_composite.h>
|
||||
#endif
|
||||
#include <linux/ion.h>
|
||||
|
||||
#include <mach/hardware.h>
|
||||
#include <asm/setup.h>
|
||||
@@ -58,7 +59,7 @@
|
||||
#include <linux/mtd/nand.h>
|
||||
#include <linux/mtd/partitions.h>
|
||||
#include <linux/i2c-gpio.h>
|
||||
|
||||
#include <linux/mpu.h>
|
||||
#include "devices.h"
|
||||
#include "../../../drivers/input/touchscreen/xpt2046_cbn_ts.h"
|
||||
|
||||
@@ -68,29 +69,62 @@
|
||||
#ifdef CONFIG_VIDEO_RK29
|
||||
/*---------------- Camera Sensor Macro Define Begin ------------------------*/
|
||||
/*---------------- Camera Sensor Configuration Macro Begin ------------------------*/
|
||||
#define CONFIG_SENSOR_0 RK29_CAM_SENSOR_OV5642 /* back camera sensor */
|
||||
#define CONFIG_SENSOR_IIC_ADDR_0 0x78
|
||||
#ifdef CONFIG_SOC_CAMERA_OV2655
|
||||
#define CONFIG_SENSOR_0 RK29_CAM_SENSOR_OV2655 /* back camera sensor *//* back camera sensor */
|
||||
#define CONFIG_SENSOR_IIC_ADDR_0 0x60
|
||||
#define CONFIG_SENSOR_IIC_ADAPTER_ID_0 1
|
||||
#define CONFIG_SENSOR_ORIENTATION_0 90
|
||||
#define CONFIG_SENSOR_POWER_PIN_0 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_RESET_PIN_0 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_POWERDN_PIN_0 RK29_PIN6_PB7
|
||||
#define CONFIG_SENSOR_FALSH_PIN_0 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_RESET_PIN_0 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_POWERDN_PIN_0 RK29_PIN5_PD7//RK29_PIN6_PB7
|
||||
#define CONFIG_SENSOR_FALSH_PIN_0 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_POWERACTIVE_LEVEL_0 RK29_CAM_POWERACTIVE_L
|
||||
#define CONFIG_SENSOR_RESETACTIVE_LEVEL_0 RK29_CAM_RESETACTIVE_L
|
||||
#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_0 RK29_CAM_POWERDNACTIVE_H
|
||||
#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_0 RK29_CAM_FLASHACTIVE_L
|
||||
#endif
|
||||
|
||||
#define CONFIG_SENSOR_1 RK29_CAM_SENSOR_OV2659 /* front camera sensor */
|
||||
#define CONFIG_SENSOR_IIC_ADDR_1 0x60
|
||||
#define CONFIG_SENSOR_QCIF_FPS_FIXED_0 15
|
||||
#define CONFIG_SENSOR_QVGA_FPS_FIXED_0 15
|
||||
#define CONFIG_SENSOR_CIF_FPS_FIXED_0 15
|
||||
#define CONFIG_SENSOR_VGA_FPS_FIXED_0 15
|
||||
#define CONFIG_SENSOR_480P_FPS_FIXED_0 0
|
||||
#define CONFIG_SENSOR_SVGA_FPS_FIXED_0 15
|
||||
#define CONFIG_SENSOR_720P_FPS_FIXED_0 0
|
||||
#ifdef CONFIG_SOC_CAMERA_OV9665
|
||||
#define CONFIG_SENSOR_1 RK29_CAM_SENSOR_OV9665 /* front camera sensor */
|
||||
#define CONFIG_SENSOR_IIC_ADDR_1 0x60
|
||||
#define CONFIG_SENSOR_IIC_ADAPTER_ID_1 1
|
||||
#define CONFIG_SENSOR_ORIENTATION_1 0
|
||||
#define CONFIG_SENSOR_POWER_PIN_1 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_RESET_PIN_1 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_POWERDN_PIN_1 RK29_PIN5_PD7
|
||||
#define CONFIG_SENSOR_POWERDN_PIN_1 RK29_PIN6_PB7//RK29_PIN5_PD7
|
||||
#define CONFIG_SENSOR_FALSH_PIN_1 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L
|
||||
#define CONFIG_SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L
|
||||
#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_1 RK29_CAM_POWERDNACTIVE_H
|
||||
#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
|
||||
#endif
|
||||
#define CONFIG_SENSOR_1 RK29_CAM_SENSOR_OV2655 /* back camera sensor *//* back camera sensor */
|
||||
#define CONFIG_SENSOR_IIC_ADDR_1 0x60
|
||||
#define CONFIG_SENSOR_IIC_ADAPTER_ID_1 1
|
||||
#define CONFIG_SENSOR_ORIENTATION_1 270
|
||||
#define CONFIG_SENSOR_POWER_PIN_1 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_RESET_PIN_1 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_POWERDN_PIN_1 RK29_PIN6_PB7//RK29_PIN6_PB7
|
||||
#define CONFIG_SENSOR_FALSH_PIN_1 INVALID_GPIO
|
||||
#define CONFIG_SENSOR_POWERACTIVE_LEVEL_1 RK29_CAM_POWERACTIVE_L
|
||||
#define CONFIG_SENSOR_RESETACTIVE_LEVEL_1 RK29_CAM_RESETACTIVE_L
|
||||
#define CONFIG_SENSOR_POWERDNACTIVE_LEVEL_1 RK29_CAM_POWERDNACTIVE_H
|
||||
#define CONFIG_SENSOR_FLASHACTIVE_LEVEL_1 RK29_CAM_FLASHACTIVE_L
|
||||
|
||||
#define CONFIG_SENSOR_QCIF_FPS_FIXED_1 15
|
||||
#define CONFIG_SENSOR_QVGA_FPS_FIXED_1 15
|
||||
#define CONFIG_SENSOR_CIF_FPS_FIXED_1 15
|
||||
#define CONFIG_SENSOR_VGA_FPS_FIXED_1 15
|
||||
#define CONFIG_SENSOR_480P_FPS_FIXED_1 0
|
||||
#define CONFIG_SENSOR_SVGA_FPS_FIXED_1 15
|
||||
#define CONFIG_SENSOR_720P_FPS_FIXED_1 0
|
||||
#endif //#ifdef CONFIG_VIDEO_RK29
|
||||
/*---------------- Camera Sensor Configuration Macro End------------------------*/
|
||||
#include "../../../drivers/media/video/rk29_camera.c"
|
||||
@@ -103,7 +137,7 @@
|
||||
#else
|
||||
#define SDRAM_SIZE SZ_512M
|
||||
#endif
|
||||
#define PMEM_GPU_SIZE SZ_16M
|
||||
#define PMEM_GPU_SIZE SZ_128M
|
||||
#define PMEM_UI_SIZE (48 * SZ_1M) /* 1280x800: 64M 1024x768: 48M ... */
|
||||
#define PMEM_VPU_SIZE SZ_64M
|
||||
#define PMEM_SKYPE_SIZE 0
|
||||
@@ -169,7 +203,7 @@ struct rk29_nand_platform_data rk29_nand_data = {
|
||||
.io_init = rk29_nand_io_init,
|
||||
};
|
||||
|
||||
#define TOUCH_SCREEN_STANDBY_PIN RK29_PIN6_PD1
|
||||
#define TOUCH_SCREEN_STANDBY_PIN INVALID_GPIO
|
||||
#define TOUCH_SCREEN_STANDBY_VALUE GPIO_HIGH
|
||||
#define TOUCH_SCREEN_DISPLAY_PIN INVALID_GPIO
|
||||
#define TOUCH_SCREEN_DISPLAY_VALUE GPIO_HIGH
|
||||
@@ -188,7 +222,7 @@ struct rk29_nand_platform_data rk29_nand_data = {
|
||||
* author: zyw@rock-chips.com
|
||||
*****************************************************************************************/
|
||||
#define FB_ID 0
|
||||
#define FB_DISPLAY_ON_PIN INVALID_GPIO// RK29_PIN6_PD0
|
||||
#define FB_DISPLAY_ON_PIN RK29_PIN6_PD1
|
||||
#define FB_LCD_STANDBY_PIN INVALID_GPIO
|
||||
#define FB_LCD_CABC_EN_PIN RK29_PIN6_PD2
|
||||
#define FB_MCU_FMK_PIN INVALID_GPIO
|
||||
@@ -316,7 +350,7 @@ static int rk29_fb_io_init(struct rk29_fb_setting_info *fb_setting)
|
||||
printk(">>>>>> FB_LCD_CABC_EN_PIN gpio_request err \n ");
|
||||
}
|
||||
gpio_direction_output(FB_LCD_CABC_EN_PIN, 0);
|
||||
gpio_set_value(FB_LCD_CABC_EN_PIN, GPIO_LOW);
|
||||
gpio_set_value(FB_LCD_CABC_EN_PIN, GPIO_HIGH);
|
||||
}
|
||||
|
||||
rk29_fb_io_enable(); //enable it
|
||||
@@ -843,6 +877,28 @@ static struct platform_device android_pmem_skype_device = {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ION
|
||||
static struct ion_platform_data rk29_ion_pdata = {
|
||||
.nr = 1,
|
||||
.heaps = {
|
||||
{
|
||||
.type = ION_HEAP_TYPE_CARVEOUT,
|
||||
.id = 0,
|
||||
.name = "ui",
|
||||
.base = PMEM_UI_BASE,
|
||||
.size = PMEM_UI_SIZE,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
static struct platform_device rk29_ion_device = {
|
||||
.name = "ion-rockchip",
|
||||
.id = 0,
|
||||
.dev = {
|
||||
.platform_data = &rk29_ion_pdata,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
#ifdef CONFIG_VIDEO_RK29XX_VOUT
|
||||
static struct platform_device rk29_v4l2_output_devce = {
|
||||
.name = "rk29_vout",
|
||||
@@ -964,60 +1020,38 @@ static int mma8452_init_platform_hw(void)
|
||||
static struct mma8452_platform_data mma8452_info = {
|
||||
.model= 8452,
|
||||
.swap_xyz= 1,
|
||||
.swap_xy=1,
|
||||
.orientation ={-1,0,0,0,1,0,0,0,-1},
|
||||
.init_platform_hw= mma8452_init_platform_hw,
|
||||
|
||||
};
|
||||
#endif
|
||||
#if defined (CONFIG_MPU_SENSORS_MPU3050)
|
||||
/*mpu3050*/
|
||||
static struct mpu3050_platform_data mpu3050_data = {
|
||||
.int_config = 0x10,
|
||||
//.orientation = { 1, 0, 0,0, -1, 0,0, 0, 1 },
|
||||
//.orientation = { 0, 1, 0,-1, 0, 0,0, 0, -1 },
|
||||
//.orientation = { -1, 0, 0,0, -1, 0,0, 0, -1 },
|
||||
.orientation = { 0, 1, 0, -1, 0, 0, 0, 0, 1 },
|
||||
.level_shifter = 0,
|
||||
#if defined (CONFIG_MPU_SENSORS_KXTF9)
|
||||
.accel = {
|
||||
#ifdef CONFIG_MPU_SENSORS_MPU3050_MODULE
|
||||
.get_slave_descr = NULL ,
|
||||
#else
|
||||
.get_slave_descr = get_accel_slave_descr ,
|
||||
#endif
|
||||
.adapt_num = 0, // The i2c bus to which the mpu device is
|
||||
// connected
|
||||
//.irq = RK29_PIN0_PA3,
|
||||
.bus = EXT_SLAVE_BUS_SECONDARY, //The secondary I2C of MPU
|
||||
.address = 0x0f,
|
||||
//.orientation = { 1, 0, 0,0, 1, 0,0, 0, 1 },
|
||||
//.orientation = { 0, -1, 0,-1, 0, 0,0, 0, -1 },
|
||||
//.orientation = { 0, 1, 0,1, 0, 0,0, 0, -1 },
|
||||
.orientation = { 0, 1 ,0, -1 ,0, 0, 0, 0, 1 },
|
||||
},
|
||||
#endif
|
||||
#if defined (CONFIG_MPU_SENSORS_AK8975)
|
||||
.compass = {
|
||||
#ifdef CONFIG_MPU_SENSORS_MPU3050_MODULE
|
||||
.get_slave_descr = NULL,/*ak5883_get_slave_descr,*/
|
||||
#else
|
||||
.get_slave_descr = get_compass_slave_descr,
|
||||
#endif
|
||||
.adapt_num = 0, // The i2c bus to which the compass device is.
|
||||
// It can be difference with mpu
|
||||
// connected
|
||||
//.irq = RK29_PIN0_PA4,
|
||||
.bus = EXT_SLAVE_BUS_PRIMARY,
|
||||
.address = 0x0d,
|
||||
//.orientation = { -1, 0, 0,0, -1, 0,0, 0, 1 },
|
||||
//.orientation = { 0, -1, 0,-1, 0, 0,0, 0, -1 },
|
||||
//.orientation = { 0, 1, 0,1, 0, 0,0, 0, -1 },
|
||||
//.orientation = { 0, -1, 0, 1, 0, 0, 0, 0, 1 },
|
||||
.orientation = { 0, 1, 0, -1, 0, 0, 0, 0, 1 },
|
||||
},
|
||||
#if defined (CONFIG_MPU_SENSORS_MPU3050)
|
||||
static struct mpu_platform_data mpu3050_data = {
|
||||
.int_config = 0x10,
|
||||
.orientation = { 1, 0, 0,0, 1, 0, 0, 0, 1 },
|
||||
};
|
||||
#endif
|
||||
|
||||
/* accel */
|
||||
#if defined (CONFIG_MPU_SENSORS_KXTF9)
|
||||
static struct ext_slave_platform_data inv_mpu_kxtf9_data = {
|
||||
.bus = EXT_SLAVE_BUS_SECONDARY,
|
||||
.adapt_num = 0,
|
||||
.orientation = {1, 0, 0, 0, 1, 0, 0, 0, 1},
|
||||
};
|
||||
#endif
|
||||
|
||||
/* compass */
|
||||
#if defined (CONFIG_MPU_SENSORS_AK8975)
|
||||
static struct ext_slave_platform_data inv_mpu_ak8975_data = {
|
||||
.bus = EXT_SLAVE_BUS_PRIMARY,
|
||||
.adapt_num = 0,
|
||||
.orientation = {0, 1, 0, -1, 0, 0, 0, 0, 1},
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined (CONFIG_BATTERY_BQ27510)
|
||||
#define DC_CHECK_PIN RK29_PIN4_PA1
|
||||
#define LI_LION_BAT_NUM 2
|
||||
@@ -1038,6 +1072,18 @@ struct bq27510_platform_data bq27510_info = {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BATTERY_RK29_ADC
|
||||
struct rk29_adc_battery_platform_data rk29_adc_battery_platdata = {
|
||||
.dc_det_pin = RK29_PIN4_PA1,
|
||||
.batt_low_pin = RK29_PIN4_PA2,
|
||||
.charge_set_pin = INVALID_GPIO,
|
||||
.charge_ok_pin = RK29_PIN4_PA3,
|
||||
|
||||
.dc_det_level = GPIO_LOW,
|
||||
.charge_ok_level = GPIO_HIGH,
|
||||
};
|
||||
#endif
|
||||
|
||||
/*************************************PMU ACT8891****************************************/
|
||||
|
||||
#if defined (CONFIG_REGULATOR_ACT8891)
|
||||
@@ -1470,6 +1516,13 @@ static struct i2c_board_info __initdata board_i2c0_devices[] = {
|
||||
.flags = 0,
|
||||
},
|
||||
#endif
|
||||
#if defined (CONFIG_SND_SOC_WM8988)
|
||||
{
|
||||
.type = "wm8988",
|
||||
.addr = 0x1A,
|
||||
.flags = 0,
|
||||
},
|
||||
#endif
|
||||
#if defined (CONFIG_SND_SOC_WM8900)
|
||||
{
|
||||
.type = "wm8900",
|
||||
@@ -1525,16 +1578,34 @@ static struct i2c_board_info __initdata board_i2c0_devices[] = {
|
||||
.irq = RK29_PIN0_PA4,
|
||||
},
|
||||
#endif
|
||||
/*mpu3050*/
|
||||
#if defined (CONFIG_MPU_SENSORS_MPU3050)
|
||||
{
|
||||
.type = "mpu3050",
|
||||
.addr = 0x68,
|
||||
.flags = 0,
|
||||
.irq = RK29_PIN5_PA3,
|
||||
.irq = RK29_PIN4_PC4,
|
||||
.platform_data = &mpu3050_data,
|
||||
},
|
||||
#endif
|
||||
#if defined (CONFIG_MPU_SENSORS_KXTF9)
|
||||
{
|
||||
.type = "kxtf9",
|
||||
.addr = 0x0f,
|
||||
.flags = 0,
|
||||
//.irq = RK29_PIN6_PC4,
|
||||
.platform_data = &inv_mpu_kxtf9_data,
|
||||
},
|
||||
#endif
|
||||
#if defined (CONFIG_MPU_SENSORS_AK8975)
|
||||
{
|
||||
.type = "ak8975",
|
||||
.addr = 0x0d,
|
||||
.flags = 0,
|
||||
//.irq = RK29_PIN6_PC5,
|
||||
.platform_data = &inv_mpu_ak8975_data,
|
||||
},
|
||||
#endif
|
||||
|
||||
#if defined (CONFIG_SND_SOC_CS42L52)
|
||||
{
|
||||
.type = "cs42l52",
|
||||
@@ -1773,7 +1844,13 @@ static int rk29_backlight_io_deinit(void)
|
||||
gpio_free(BL_EN_PIN);
|
||||
#endif
|
||||
rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE_GPIO);
|
||||
|
||||
gpio_free(PWM_GPIO);
|
||||
if (ret = gpio_request(PWM_GPIO, NULL)) {
|
||||
printk("func %s, line %d: request gpio fail\n", __FUNCTION__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
gpio_direction_output(PWM_GPIO, GPIO_HIGH);
|
||||
gpio_set_value(PWM_GPIO, GPIO_HIGH);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1813,6 +1890,7 @@ struct rk29_bl_info rk29_bl_info = {
|
||||
.io_deinit = rk29_backlight_io_deinit,
|
||||
.pwm_suspend = rk29_backlight_pwm_suspend,
|
||||
.pwm_resume = rk29_backlight_pwm_resume,
|
||||
.min_brightness = 30,
|
||||
};
|
||||
#endif
|
||||
/*****************************************************************************************
|
||||
@@ -2622,6 +2700,9 @@ static struct platform_device *devices[] __initdata = {
|
||||
#ifdef CONFIG_ADC_RK29
|
||||
&rk29_device_adc,
|
||||
#endif
|
||||
#ifdef CONFIG_BATTERY_RK29_ADC
|
||||
&rk29_adc_device_battery,
|
||||
#endif
|
||||
#ifdef CONFIG_I2C0_RK29
|
||||
&rk29_device_i2c0,
|
||||
#endif
|
||||
@@ -2697,6 +2778,9 @@ static struct platform_device *devices[] __initdata = {
|
||||
#endif
|
||||
#if PMEM_SKYPE_SIZE > 0
|
||||
&android_pmem_skype_device,
|
||||
#endif
|
||||
#ifdef CONFIG_ION
|
||||
&rk29_ion_device,
|
||||
#endif
|
||||
&android_pmem_device,
|
||||
&rk29_vpu_mem_device,
|
||||
@@ -2992,8 +3076,8 @@ static void __init machine_rk29_init_irq(void)
|
||||
|
||||
static struct cpufreq_frequency_table freq_table[] = {
|
||||
{ .index = 1200000, .frequency = 408000 },
|
||||
{ .index = 1200000, .frequency = 816000 },
|
||||
{ .index = 1300000, .frequency = 1008000 },
|
||||
{ .index = 1250000, .frequency = 816000 },
|
||||
{ .index = 1350000, .frequency = 1008000 },
|
||||
{ .frequency = CPUFREQ_TABLE_END },
|
||||
};
|
||||
|
||||
|
||||
9
arch/arm/mach-rk29/devices.c
Normal file → Executable file
9
arch/arm/mach-rk29/devices.c
Normal file → Executable file
@@ -53,6 +53,15 @@ struct platform_device rk29_device_adc = {
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BATTERY_RK29_ADC
|
||||
struct platform_device rk29_adc_device_battery = {
|
||||
.name = "rk2918-battery",
|
||||
.id = -1,
|
||||
.dev = {
|
||||
.platform_data = &rk29_adc_battery_platdata,
|
||||
},
|
||||
};
|
||||
#endif
|
||||
#ifdef CONFIG_RK29_VMAC
|
||||
static u64 eth_dmamask = DMA_BIT_MASK(32);
|
||||
static struct resource rk29_vmac_resource[] = {
|
||||
|
||||
2
arch/arm/mach-rk29/devices.h
Normal file → Executable file
2
arch/arm/mach-rk29/devices.h
Normal file → Executable file
@@ -63,6 +63,8 @@ extern struct rk29_sdmmc_platform_data default_sdmmc1_data;
|
||||
extern struct platform_device rk29_device_sdmmc0;
|
||||
extern struct platform_device rk29_device_sdmmc1;
|
||||
extern struct platform_device rk29_device_adc;
|
||||
extern struct platform_device rk29_adc_device_battery;
|
||||
extern struct rk29_adc_battery_platform_data rk29_adc_battery_platdata;
|
||||
extern struct platform_device rk29_device_vmac;
|
||||
extern struct rk29_bl_info rk29_bl_info;
|
||||
extern struct rk29_button_light_info rk29_button_light_info;
|
||||
|
||||
@@ -28,15 +28,12 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <mach/gpio.h>
|
||||
//#include <plat/gpio-cfg.h>
|
||||
//#include <plat/gpio-bank-l.h>
|
||||
//#include <plat/gpio-bank-f.h>
|
||||
|
||||
#include <linux/irq.h>
|
||||
#include <linux/syscalls.h>
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include "rk29_i2c_goodix.h"
|
||||
//#include <linux/goodix_queue.h>
|
||||
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/fs.h>
|
||||
@@ -47,10 +44,14 @@
|
||||
|
||||
#define PEN_DOWN 1
|
||||
#define PEN_RELEASE 0
|
||||
#define MAX_SUPPORT_POINT 2
|
||||
//#define fjp_debug 0
|
||||
#define PEN_DOWN_UP 2 //fjp
|
||||
|
||||
static struct rk_touch_info *info_buf;
|
||||
|
||||
static int dbg_thresd = 0;
|
||||
#define DBG(x...) do { if(unlikely(dbg_thresd)) printk(KERN_INFO x); } while (0)
|
||||
|
||||
|
||||
//#define fjp_debug
|
||||
/*******************************************************
|
||||
Description:
|
||||
Read data from the i2c slave device;
|
||||
@@ -158,23 +159,8 @@ static int goodix_init_panel(struct rk_ts_data *ts)
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
};
|
||||
/* uint8_t config_info[] = {
|
||||
0x65,0x02,0x04,0x00,0x03,0x00,0x0a,0x22,0x1E,0xE7,0x32,0x05,0x08,0x10,0x4C,
|
||||
0x40,0x41,0x20,0x00,0x00,0x8B,0x8B,0x3C,0x64,0x0E,0x0D,0x0C,0x0B,
|
||||
0x0A,0x09,0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00,0x1D,0x1C,
|
||||
0x1B,0x1A,0x19,0x18,0x17,0x16,0x15,0x14,0x13,0x12,0x11,0x10,0x0F,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x2B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00
|
||||
}; */
|
||||
|
||||
#else
|
||||
/*uint8_t config_info[] = {
|
||||
0x65,0x02,0x05,0x00,0x03,0x20,0x05,0x20,0x1E,0xE7,0x32,0x05,0x08,0x10,0x4C,
|
||||
0x40,0x41,0x20,0x00,0x00,0x89,0x89,0x5A,0x96,0x0E,0x0D,0x0C,0x0B,0x0A,0x09,
|
||||
0x08,0x07,0x06,0x05,0x04,0x03,0x02,0x01,0x00,0x1D,0x1C,0x1B,0x1A,0x19,0x18,
|
||||
0x17,0x15,0x15,0x14,0x13,0x12,0x11,0x10,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2B,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0D,0x00
|
||||
};*/
|
||||
uint8_t config_info[] = {
|
||||
0x65,0x02,0x05,0x00,0x03,0x20,0x0A,0x22,0x1E,0xE7,0x32,0x05,0x08,0x10,0x4C,
|
||||
@@ -196,13 +182,13 @@ static int goodix_init_panel(struct rk_ts_data *ts)
|
||||
{
|
||||
dev_info(&ts->client->dev, "Read resolution & max_touch_num failed, use default value!\n");
|
||||
ts->max_touch_num = MAX_FINGER_NUM;
|
||||
ts->int_trigger_type = INT_TRIGGER;
|
||||
//ts->int_trigger_type = INT_TRIGGER;
|
||||
return 0;
|
||||
}
|
||||
ts->abs_x_max = (rd_cfg_buf[1]<<8) + rd_cfg_buf[2];
|
||||
ts->abs_y_max = (rd_cfg_buf[3]<<8) + rd_cfg_buf[4];
|
||||
ts->max_touch_num = rd_cfg_buf[5];
|
||||
ts->int_trigger_type = rd_cfg_buf[6]&0x03;
|
||||
//ts->int_trigger_type = rd_cfg_buf[6]&0x03;
|
||||
if((!ts->abs_x_max)||(!ts->abs_y_max)||(!ts->max_touch_num))
|
||||
{
|
||||
printk(KERN_INFO "Read invalid resolution & max_touch_num, use default value!\n");
|
||||
@@ -210,8 +196,7 @@ static int goodix_init_panel(struct rk_ts_data *ts)
|
||||
}
|
||||
|
||||
printk(KERN_INFO "X_MAX = %d,Y_MAX = %d,MAX_TOUCH_NUM = %d\n",ts->abs_x_max,ts->abs_y_max,ts->max_touch_num);
|
||||
printk(KERN_INFO "int_trigger type is %d\n",rd_cfg_buf[6]);
|
||||
//test
|
||||
|
||||
rd_cfg_buf[0] = 0x6e;
|
||||
rd_cfg_buf[1] = 0x00;
|
||||
goodix_i2c_read_bytes(ts->client, rd_cfg_buf, 2);
|
||||
@@ -220,12 +205,32 @@ static int goodix_init_panel(struct rk_ts_data *ts)
|
||||
dev_info(&ts->client->dev, "Need int wake up from green mode!\n");
|
||||
}
|
||||
|
||||
//msleep(10);
|
||||
printk("max_point:%d\n",ts->max_touch_num);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
//fjp add ===============================
|
||||
static bool goodix_get_status(char *p1,int*p2)
|
||||
{
|
||||
bool status = PEN_DOWN;
|
||||
if((*p2==PEN_DOWN) && (*p1==PEN_RELEASE))
|
||||
{
|
||||
*p2 = PEN_DOWN_UP; //<2F>ոյ<D5B8><D5B5><EFBFBD>
|
||||
status = PEN_RELEASE;
|
||||
}
|
||||
else if((*p2==PEN_RELEASE) && (*p1==PEN_RELEASE))
|
||||
{
|
||||
*p2 = PEN_RELEASE;
|
||||
status = PEN_RELEASE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*p2 = PEN_DOWN;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
//===================================
|
||||
/*******************************************************
|
||||
Description:
|
||||
Read goodix touchscreen version function.
|
||||
@@ -268,7 +273,7 @@ static int goodix_read_version(struct rk_ts_data *ts, char **version)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static last_touch_num = -1;
|
||||
static int last_touch_num = -1;
|
||||
static void goodix_get_touch_info(struct rk_ts_data *ts,char *point_num,struct rk_touch_info* info_buf)
|
||||
{
|
||||
uint8_t point_data[(1-READ_COOR_ADDR)+1+2+5*MAX_FINGER_NUM+1]={ 0 }; //read address(1byte)+key index(1byte)+point mask(2bytes)+5bytes*MAX_FINGER_NUM+coor checksum(1byte)
|
||||
@@ -282,7 +287,7 @@ static void goodix_get_touch_info(struct rk_ts_data *ts,char *point_num,struct r
|
||||
unsigned int position = 0;
|
||||
uint8_t track_id[MAX_FINGER_NUM] = {0};
|
||||
u8 index;
|
||||
|
||||
u8 temp =0;
|
||||
point_data[0] = READ_COOR_ADDR; //read coor address
|
||||
|
||||
|
||||
@@ -290,12 +295,11 @@ static void goodix_get_touch_info(struct rk_ts_data *ts,char *point_num,struct r
|
||||
if(ret != 2)
|
||||
{
|
||||
printk("goodix read error\n");
|
||||
ts->bad_data = 1;
|
||||
}
|
||||
finger_current = (point_data[3 - READ_COOR_ADDR]<<8) + point_data[2 - READ_COOR_ADDR];
|
||||
#ifdef fjp_debug
|
||||
printk("finger_current:%d ==== max_touch_num:%d\n", finger_current,ts->max_touch_num);//add by fjp 2010-9-28
|
||||
#endif
|
||||
|
||||
DBG("finger_current:%d ==== max_touch_num:%d\n", finger_current,ts->max_touch_num);//add by fjp 2010-9-28
|
||||
|
||||
|
||||
if(finger_current)
|
||||
{
|
||||
@@ -305,7 +309,7 @@ static void goodix_get_touch_info(struct rk_ts_data *ts,char *point_num,struct r
|
||||
{
|
||||
if(finger_bit & 0x01)
|
||||
{
|
||||
track_id[point_count] = count;
|
||||
track_id[count] = PEN_DOWN;
|
||||
point_count++;
|
||||
}
|
||||
finger_bit >>= 1;
|
||||
@@ -332,17 +336,21 @@ static void goodix_get_touch_info(struct rk_ts_data *ts,char *point_num,struct r
|
||||
if(touch_num < last_touch_num) //some flinger release
|
||||
{
|
||||
//printk("%d flinger release\n",last_touch_num-touch_num);
|
||||
for(index = touch_num; index < last_touch_num; index++)
|
||||
info_buf[index].status = 0;
|
||||
/*for(index = touch_num; index < last_touch_num; index++)
|
||||
info_buf[index].status = 0;*/
|
||||
*point_num = last_touch_num;
|
||||
touch_num = last_touch_num;
|
||||
}
|
||||
last_touch_num = touch_num;
|
||||
for(index = 0; index < touch_num; index++)
|
||||
{
|
||||
position = 4 - READ_COOR_ADDR + 5*index;
|
||||
if(goodix_get_status(&track_id[index],&info_buf[index].status))
|
||||
{
|
||||
position = 4 - READ_COOR_ADDR + 5*(temp++);
|
||||
info_buf[index].x = (unsigned int) (point_data[position]<<8) + (unsigned int)( point_data[position+1]);
|
||||
info_buf[index].y = (unsigned int)(point_data[position+2]<<8) + (unsigned int) (point_data[position+3]);
|
||||
info_buf[index].status = !gpio_get_value(ts->irq_pin);
|
||||
info_buf[index].press = (unsigned int) (point_data[position+4]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -358,31 +366,23 @@ Parameter:
|
||||
return:
|
||||
Executive outcomes.0---succeed.
|
||||
*******************************************************/
|
||||
static int rk_ts_work_func(struct work_struct *pwork)
|
||||
static void rk_ts_work_func(struct work_struct *pwork)
|
||||
{
|
||||
int i =0;
|
||||
struct rk_touch_info *info_buf;
|
||||
//struct rk_touch_info *info_buf;
|
||||
char point_num;
|
||||
|
||||
if(pwork==NULL)
|
||||
{
|
||||
printk(KERN_INFO "%s>>>>>>>>err:null pwork\n",__func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct rk_ts_data *ts = container_of(pwork, struct rk_ts_data, ts_work);
|
||||
struct rk_ts_data *ts = container_of(to_delayed_work(pwork), struct rk_ts_data, ts_work);
|
||||
if(!ts)
|
||||
{
|
||||
printk("container of rk_ts_data fail\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
info_buf= kzalloc(ts->max_touch_num*sizeof(struct rk_touch_info), GFP_KERNEL);
|
||||
if(!info_buf)
|
||||
{
|
||||
printk(KERN_ALERT "alloc for rk_touch_info fail\n");
|
||||
return -1;
|
||||
}
|
||||
// info_buf= kzalloc(ts->max_touch_num*sizeof(struct rk_touch_info), GFP_KERNEL);
|
||||
// if(!info_buf)
|
||||
//{
|
||||
// printk(KERN_ALERT "alloc for rk_touch_info fail\n");
|
||||
// goto exit;
|
||||
//}
|
||||
|
||||
if(ts->get_touch_info)
|
||||
{
|
||||
@@ -390,54 +390,78 @@ static int rk_ts_work_func(struct work_struct *pwork)
|
||||
}
|
||||
for(i=0; i< point_num; i++)
|
||||
{
|
||||
input_mt_slot(ts->input_dev, i);
|
||||
input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true);
|
||||
input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, info_buf[i].status);
|
||||
input_report_abs(ts->input_dev, ABS_MT_POSITION_X, info_buf[i].x);
|
||||
input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, info_buf[i].y);
|
||||
#ifdef fjp_debug
|
||||
printk("touch point %d %s >>x:%d>>y:%d\n",i,info_buf[i].status? "down":"up",info_buf[i].x,info_buf[i].y);//add by fjp 2010-9-28
|
||||
#endif
|
||||
if(!info_buf[i].status)
|
||||
DBG("info_buf[i].status =====%d\n",info_buf[i].status);
|
||||
if(info_buf[i].status==PEN_DOWN_UP)
|
||||
{
|
||||
info_buf[i].status=PEN_RELEASE;
|
||||
DBG("the key %d is up------\n",i);
|
||||
input_mt_slot(ts->input_dev, i);
|
||||
input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, false);
|
||||
continue;
|
||||
}
|
||||
if(info_buf[i].status==PEN_DOWN)
|
||||
{
|
||||
input_mt_slot(ts->input_dev, i);
|
||||
input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true);
|
||||
input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, info_buf[i].press);
|
||||
input_report_abs(ts->input_dev, ABS_MT_POSITION_X, info_buf[i].x);
|
||||
input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, info_buf[i].y);
|
||||
DBG("touch point %d %d >>x:%d>>y:%d\n",i,info_buf[i].status,info_buf[i].x,info_buf[i].y);//add by fjp 2010-9-28
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
input_sync(ts->input_dev);
|
||||
|
||||
if(gpio_get_value(ts->irq_pin) == GPIO_LOW)
|
||||
{
|
||||
#ifdef fjp_debug
|
||||
printk("touch down .............\n");//add by fjp 2010-9-28
|
||||
#endif
|
||||
queue_delayed_work(ts->ts_wq, &ts->ts_work,msecs_to_jiffies(30));
|
||||
goto exit;
|
||||
|
||||
DBG("touch down .............\n");//add by fjp 2010-9-28
|
||||
queue_delayed_work(ts->ts_wq, &ts->ts_work,msecs_to_jiffies(20));
|
||||
// goto exit;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef fjp_debug
|
||||
printk("touch up>>x:%d>>y:%d\n",info_buf[0].x,info_buf[0].y);//add by fjp 2010-9-28
|
||||
#endif
|
||||
input_mt_slot(ts->input_dev, 0);
|
||||
|
||||
DBG("touch up>>x:%d>>y:%d\n",info_buf[0].x,info_buf[0].y);//add by fjp 2010-9-28
|
||||
/*input_mt_slot(ts->input_dev, 0);
|
||||
input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true);
|
||||
input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0);
|
||||
//input_report_abs(ts->input_dev, ABS_MT_POSITION_X, info_buf[0].x);
|
||||
//input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, info_buf[0].y);
|
||||
|
||||
input_mt_slot(ts->input_dev, 0);
|
||||
input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, false);
|
||||
input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, false);*/
|
||||
|
||||
DBG("point_num+++++++++++ = %d\n", point_num);//add by fjp 2010-9-28
|
||||
for(i=0; i< point_num; i++)
|
||||
{
|
||||
// printk("info_buf[i].status +++++++%d\n",info_buf[i].status);
|
||||
if(info_buf[i].status)
|
||||
{
|
||||
input_mt_slot(ts->input_dev, i);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD>
|
||||
input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, false);
|
||||
//input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0);
|
||||
info_buf[i].status= PEN_RELEASE;
|
||||
|
||||
|
||||
DBG("release+++++++++++ = %d\n", i);//add by fjp 2010-9-28
|
||||
|
||||
}
|
||||
}
|
||||
input_sync(ts->input_dev);
|
||||
ts->pendown =PEN_RELEASE;
|
||||
last_touch_num = 0;
|
||||
|
||||
|
||||
enable_irq(ts->irq);
|
||||
}
|
||||
|
||||
enable_irq(ts->irq);
|
||||
exit:
|
||||
kfree(info_buf);
|
||||
return 0;
|
||||
|
||||
//exit:
|
||||
//kfree(info_buf);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -476,9 +500,6 @@ static irqreturn_t rk_ts_irq_handler(int irq, void *dev_id)
|
||||
{
|
||||
|
||||
struct rk_ts_data *ts = (struct rk_ts_data*)dev_id;
|
||||
#ifdef fjp_debug
|
||||
printk("entry goodix_ts_irq_handler irq:%d\n",ts->irq);//add by fjp 2010-9-28
|
||||
#endif
|
||||
disable_irq_nosync(ts->irq);
|
||||
queue_delayed_work(ts->ts_wq, &ts->ts_work,0);
|
||||
|
||||
@@ -569,7 +590,7 @@ static int goodix_ts_power(struct rk_ts_data * ts, int on)
|
||||
ret = goodix_i2c_write_bytes(ts->client, i2c_control_buf, 2);
|
||||
if(ret == 1)
|
||||
{
|
||||
printk(KERN_INFO"Send suspend cmd\n");
|
||||
printk(KERN_INFO"touch goodix Send suspend cmd successed \n");
|
||||
break;
|
||||
}
|
||||
retry++;
|
||||
@@ -580,10 +601,10 @@ static int goodix_ts_power(struct rk_ts_data * ts, int on)
|
||||
}
|
||||
else if(on == 1) //resume
|
||||
{
|
||||
printk(KERN_INFO"Int resume\n");
|
||||
gpio_set_value(RK29_PIN6_PC3,GPIO_LOW);
|
||||
printk(KERN_INFO"touch goodix int resume\n");
|
||||
gpio_set_value(ts->rst_pin,GPIO_LOW);
|
||||
msleep(20);
|
||||
gpio_set_value(RK29_PIN6_PC3,GPIO_HIGH);
|
||||
gpio_set_value(ts->rst_pin,GPIO_HIGH);
|
||||
ret = 0;
|
||||
}
|
||||
return ret;
|
||||
@@ -604,11 +625,11 @@ static int goodix_input_params_init(struct rk_ts_data *ts)
|
||||
__set_bit(INPUT_PROP_DIRECT, ts->input_dev->propbit);
|
||||
__set_bit(EV_ABS, ts->input_dev->evbit);
|
||||
|
||||
input_mt_init_slots(ts->input_dev, MAX_SUPPORT_POINT);
|
||||
input_mt_init_slots(ts->input_dev, ts->max_touch_num);
|
||||
input_set_abs_params(ts->input_dev, ABS_MT_TOUCH_MAJOR, 0, 255, 0, 0);
|
||||
input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, 0, ts->abs_x_max, 0, 0);
|
||||
input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, 0, ts->abs_y_max, 0, 0);
|
||||
sprintf(ts->phys, "input/ts");
|
||||
sprintf(ts->phys, "input/rkts");
|
||||
ts->input_dev->name = rk_ts_name;
|
||||
ts->input_dev->phys = ts->phys;
|
||||
ts->input_dev->id.bustype = BUS_I2C;
|
||||
@@ -621,7 +642,6 @@ static int goodix_input_params_init(struct rk_ts_data *ts)
|
||||
printk(KERN_ALERT "Probe: Unable to register %s input device\n", ts->input_dev->name);
|
||||
return -1;
|
||||
}
|
||||
ts->bad_data = 0;
|
||||
|
||||
return 0 ;
|
||||
|
||||
@@ -648,8 +668,7 @@ static int goodix_ts_init(struct rk_ts_data *ts)
|
||||
|
||||
ret=goodix_init_panel(ts);
|
||||
if(ret != 0) {
|
||||
printk("goodix panel init fail\n");
|
||||
ts->bad_data=1;
|
||||
printk("goodix panel init fail\n");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
@@ -707,20 +726,19 @@ static int rk_ts_probe(struct i2c_client *client, const struct i2c_device_id *id
|
||||
{
|
||||
dev_err(&client->dev, "Must have I2C_FUNC_I2C.\n");
|
||||
ret = -ENODEV;
|
||||
goto err_check_functionality_failed;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
ts = kzalloc(sizeof(struct rk_ts_data), GFP_KERNEL);
|
||||
if (ts == NULL) {
|
||||
printk(KERN_ALERT "alloc for struct rk_ts_data fail\n");
|
||||
ret = -ENOMEM;
|
||||
goto err_alloc_data_failed;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
pdata = client->dev.platform_data;
|
||||
ts->abs_x_max = TS_MAX_X;
|
||||
ts->abs_y_max = TS_MAX_Y;
|
||||
ts->irq_pin = pdata->irq_pin;
|
||||
ts->rst_pin = pdata->rest_pin;
|
||||
ts->pendown =PEN_RELEASE;
|
||||
ts->client = client;
|
||||
ts->ts_init = goodix_ts_init;
|
||||
@@ -741,7 +759,7 @@ static int rk_ts_probe(struct i2c_client *client, const struct i2c_device_id *id
|
||||
if(ret < 0)
|
||||
{
|
||||
printk(KERN_ALERT "rk ts init fail\n");
|
||||
//return -1;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -768,9 +786,6 @@ static int rk_ts_probe(struct i2c_client *client, const struct i2c_device_id *id
|
||||
ts->early_suspend.resume = rk_ts_late_resume;
|
||||
register_early_suspend(&ts->early_suspend);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
ts->irq=gpio_to_irq(ts->irq_pin) ; //If not defined in client
|
||||
if (ts->irq)
|
||||
@@ -779,7 +794,7 @@ static int rk_ts_probe(struct i2c_client *client, const struct i2c_device_id *id
|
||||
if (ret < 0)
|
||||
{
|
||||
printk(KERN_ALERT "Failed to request for touch irq\n");
|
||||
goto err_gpio_request_failed;
|
||||
goto err_input_register_device_failed;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -790,41 +805,25 @@ static int rk_ts_probe(struct i2c_client *client, const struct i2c_device_id *id
|
||||
if (ret != 0) {
|
||||
printk(KERN_ALERT "Cannot allocate ts INT!ERRNO:%d\n", ret);
|
||||
gpio_free(INT_PORT);
|
||||
goto err_gpio_request_failed;
|
||||
goto err_input_register_device_failed;
|
||||
}
|
||||
else
|
||||
{
|
||||
enable_irq(ts->irq);
|
||||
|
||||
}
|
||||
}
|
||||
printk("Goodix TS probe successfully! max_x:%d>>max_y:%d>>max_support_point:%d\n",
|
||||
ts->abs_x_max,ts->abs_y_max,ts->max_touch_num);
|
||||
return 0;
|
||||
err_init_godix_ts:
|
||||
if(ts->use_irq)
|
||||
{
|
||||
ts->use_irq = 0;
|
||||
free_irq(client->irq,ts);
|
||||
#ifdef INT_PORT
|
||||
gpio_direction_input(INT_PORT);
|
||||
gpio_free(INT_PORT);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
hrtimer_cancel(&ts->timer);
|
||||
|
||||
err_gpio_request_failed:
|
||||
info_buf= kzalloc(ts->max_touch_num*sizeof(struct rk_touch_info), GFP_KERNEL);
|
||||
if(!info_buf)
|
||||
{
|
||||
printk(KERN_ALERT "alloc for rk_touch_info fail\n");
|
||||
goto err_input_register_device_failed;
|
||||
}
|
||||
printk("Goodix TS probe successfully!\n");
|
||||
return 0;
|
||||
|
||||
|
||||
err_input_register_device_failed:
|
||||
input_free_device(ts->input_dev);
|
||||
|
||||
err_input_dev_alloc_failed:
|
||||
i2c_set_clientdata(client, NULL);
|
||||
err_i2c_failed:
|
||||
i2c_set_clientdata(client, NULL);
|
||||
kfree(ts);
|
||||
err_alloc_data_failed:
|
||||
err_check_functionality_failed:
|
||||
err_create_proc_entry:
|
||||
exit:
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -848,18 +847,9 @@ static int rk_ts_remove(struct i2c_client *client)
|
||||
#ifdef CONFIG_TOUCHSCREEN_GOODIX_IAP
|
||||
remove_proc_entry("goodix-update", NULL);
|
||||
#endif
|
||||
//goodix_debug_sysfs_deinit();
|
||||
if (ts && ts->use_irq)
|
||||
{
|
||||
#ifdef INT_PORT
|
||||
gpio_direction_input(INT_PORT);
|
||||
gpio_free(INT_PORT);
|
||||
#endif
|
||||
free_irq(client->irq, ts);
|
||||
}
|
||||
else if(ts)
|
||||
hrtimer_cancel(&ts->timer);
|
||||
|
||||
gpio_free(ts->irq_pin);
|
||||
free_irq(ts->irq, ts);
|
||||
dev_notice(&client->dev,"The driver is removing...\n");
|
||||
i2c_set_clientdata(client, NULL);
|
||||
input_unregister_device(ts->input_dev);
|
||||
@@ -1393,14 +1383,12 @@ rewrite:
|
||||
{
|
||||
printk(KERN_INFO"Disable TS int!\n");
|
||||
g_enter_isp = 1;
|
||||
if(ts->use_irq)
|
||||
disable_irq(TS_INT);
|
||||
}
|
||||
else if(cmd[1] == CMD_ENABLE_TP)
|
||||
{
|
||||
printk(KERN_INFO"Enable TS int!\n");
|
||||
g_enter_isp = 0;
|
||||
if(ts->use_irq)
|
||||
enable_irq(TS_INT);
|
||||
}
|
||||
else if(cmd[1] == CMD_READ_VER)
|
||||
@@ -1619,6 +1607,43 @@ static struct i2c_driver rk_ts_driver = {
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
static struct class *ts_debug_class = NULL;
|
||||
static ssize_t dbg_mode_show(struct class *cls,struct class_attribute *attr, char *_buf)
|
||||
{
|
||||
printk("%s>>>>>>>>\n",__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t dbg_mode_store(struct class *cls,struct class_attribute *attr, const char *buf, size_t _count)
|
||||
{
|
||||
dbg_thresd = simple_strtol(buf,NULL,10);
|
||||
if(dbg_thresd)
|
||||
{
|
||||
printk(KERN_INFO "ts debug open\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printk(KERN_INFO "ts debug close");
|
||||
}
|
||||
|
||||
return _count;
|
||||
}
|
||||
static CLASS_ATTR(debug, 0666, dbg_mode_show, dbg_mode_store);
|
||||
|
||||
static int dbg_sys_init(void)
|
||||
{
|
||||
int ret ;
|
||||
ts_debug_class = class_create(THIS_MODULE, "ts_debug");
|
||||
ret = class_create_file(ts_debug_class, &class_attr_debug);
|
||||
if (ret)
|
||||
{
|
||||
printk("Fail to creat class hkrkfb.\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************
|
||||
Description:
|
||||
Driver Install function.
|
||||
@@ -1629,6 +1654,7 @@ static int __devinit rk_ts_init(void)
|
||||
{
|
||||
int ret ;
|
||||
ret=i2c_add_driver(&rk_ts_driver);
|
||||
dbg_sys_init(); //for debug
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,25 +61,23 @@
|
||||
|
||||
struct rk_touch_info
|
||||
{
|
||||
u32 status; // 1:down,0:up
|
||||
u32 press;
|
||||
u32 x ;
|
||||
u32 y ;
|
||||
int status ; // 0 1
|
||||
} ;
|
||||
struct rk_ts_data{
|
||||
uint16_t addr;
|
||||
uint8_t bad_data;
|
||||
struct i2c_client *client;
|
||||
struct input_dev *input_dev;
|
||||
int use_reset; //use RESET flag
|
||||
int use_irq; //use EINT flag
|
||||
int irq;
|
||||
int irq_pin;
|
||||
int pwr_pin;
|
||||
int rst_pin;
|
||||
int read_mode; //read moudle mode,20110221 by andrew
|
||||
struct hrtimer timer;
|
||||
struct workqueue_struct *ts_wq;
|
||||
struct delayed_work ts_work;
|
||||
char phys[32];
|
||||
int retry;
|
||||
struct early_suspend early_suspend;
|
||||
int (*power)(struct rk_ts_data * ts, int on);
|
||||
int (*ts_init)(struct rk_ts_data*ts);
|
||||
@@ -88,7 +86,6 @@ struct rk_ts_data{
|
||||
uint16_t abs_x_max;
|
||||
uint16_t abs_y_max;
|
||||
uint8_t max_touch_num;
|
||||
uint8_t int_trigger_type;
|
||||
bool pendown;
|
||||
};
|
||||
|
||||
@@ -121,10 +118,6 @@ struct i2c_client * i2c_connect_client = NULL;
|
||||
static struct proc_dir_entry *goodix_proc_entry;
|
||||
//static struct kobject *goodix_debug_kobj;
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
static void goodix_ts_early_suspend(struct early_suspend *h);
|
||||
static void goodix_ts_late_resume(struct early_suspend *h);
|
||||
#endif
|
||||
|
||||
#define READ_COOR_ADDR 0x01
|
||||
|
||||
|
||||
@@ -304,7 +304,7 @@ static struct reginfo sensor_init_data[] =
|
||||
{0x3379, 0x80},
|
||||
|
||||
{0x3069, 0x84},
|
||||
{0x307c, 0x13},//0x10},
|
||||
{0x307c, 0x10},//0x13},
|
||||
{0x3087, 0x02},
|
||||
|
||||
{0x3300, 0xfc},
|
||||
@@ -1686,7 +1686,7 @@ sensor_power_end:
|
||||
}
|
||||
static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
||||
{
|
||||
struct i2c_client *client = sd->priv;
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
struct soc_camera_device *icd = client->dev.platform_data;
|
||||
struct sensor *sensor = to_sensor(client);
|
||||
const struct v4l2_queryctrl *qctrl;
|
||||
@@ -1704,6 +1704,10 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
||||
/* soft reset */
|
||||
if (sensor_task_lock(client,1)<0)
|
||||
goto sensor_INIT_ERR;
|
||||
sensor_write(client, 0x300F, 0xAE);
|
||||
mdelay(5);
|
||||
sensor_write(client, 0x300F, 0xAE);
|
||||
mdelay(5);
|
||||
ret = sensor_write(client, 0x3012, 0x80);
|
||||
if (ret != 0)
|
||||
{
|
||||
@@ -1731,7 +1735,7 @@ static int sensor_init(struct v4l2_subdev *sd, u32 val)
|
||||
}
|
||||
|
||||
pid |= (value & 0xff);
|
||||
SENSOR_DG("\n %s pid = 0x%x\n", SENSOR_NAME_STRING(), pid);
|
||||
printk("\n %s pid = 0x%x\n", SENSOR_NAME_STRING(), pid);
|
||||
if (pid == SENSOR_ID) {
|
||||
sensor->model = SENSOR_V4L2_IDENT;
|
||||
} else {
|
||||
@@ -1823,7 +1827,7 @@ static int sensor_deactivate(struct i2c_client *client)
|
||||
/* ddl@rock-chips.com : all sensor output pin must change to input for other sensor */
|
||||
if (sensor->info_priv.funmodule_state & SENSOR_INIT_IS_OK) {
|
||||
sensor_task_lock(client, 1);
|
||||
sensor_write(client, 0x30b0, 0x00);
|
||||
sensor_write(client, 0x30b0, 0x00);
|
||||
sensor_write(client, 0x30b1, 0x00);
|
||||
sensor_task_lock(client, 0);
|
||||
}
|
||||
@@ -1904,7 +1908,7 @@ static unsigned long sensor_query_bus_param(struct soc_camera_device *icd)
|
||||
|
||||
static int sensor_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
||||
{
|
||||
struct i2c_client *client = sd->priv;
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
struct soc_camera_device *icd = client->dev.platform_data;
|
||||
struct sensor *sensor = to_sensor(client);
|
||||
|
||||
@@ -1953,7 +1957,7 @@ static bool sensor_fmt_videochk(struct v4l2_subdev *sd, struct v4l2_mbus_framefm
|
||||
}
|
||||
static int sensor_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
||||
{
|
||||
struct i2c_client *client = sd->priv;
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
const struct sensor_datafmt *fmt;
|
||||
struct sensor *sensor = to_sensor(client);
|
||||
const struct v4l2_queryctrl *qctrl;
|
||||
@@ -2122,7 +2126,7 @@ sensor_s_fmt_end:
|
||||
|
||||
static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
||||
{
|
||||
struct i2c_client *client = sd->priv;
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
struct sensor *sensor = to_sensor(client);
|
||||
const struct sensor_datafmt *fmt;
|
||||
int ret = 0;
|
||||
@@ -2150,7 +2154,7 @@ static int sensor_try_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf)
|
||||
}
|
||||
static int sensor_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *id)
|
||||
{
|
||||
struct i2c_client *client = sd->priv;
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
|
||||
if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
|
||||
return -EINVAL;
|
||||
@@ -2434,7 +2438,7 @@ static int sensor_set_flash(struct soc_camera_device *icd, const struct v4l2_que
|
||||
|
||||
static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
|
||||
{
|
||||
struct i2c_client *client = sd->priv;
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
struct sensor *sensor = to_sensor(client);
|
||||
const struct v4l2_queryctrl *qctrl;
|
||||
|
||||
@@ -2493,7 +2497,7 @@ static int sensor_g_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
|
||||
|
||||
static int sensor_s_control(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
|
||||
{
|
||||
struct i2c_client *client = sd->priv;
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
struct sensor *sensor = to_sensor(client);
|
||||
struct soc_camera_device *icd = client->dev.platform_data;
|
||||
const struct v4l2_queryctrl *qctrl;
|
||||
@@ -2783,7 +2787,7 @@ static int sensor_s_ext_control(struct soc_camera_device *icd, struct v4l2_ext_c
|
||||
|
||||
static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
|
||||
{
|
||||
struct i2c_client *client = sd->priv;
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
struct soc_camera_device *icd = client->dev.platform_data;
|
||||
int i, error_cnt=0, error_idx=-1;
|
||||
|
||||
@@ -2808,7 +2812,7 @@ static int sensor_g_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_control
|
||||
|
||||
static int sensor_s_ext_controls(struct v4l2_subdev *sd, struct v4l2_ext_controls *ext_ctrl)
|
||||
{
|
||||
struct i2c_client *client = sd->priv;
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
struct soc_camera_device *icd = client->dev.platform_data;
|
||||
int i, error_cnt=0, error_idx=-1;
|
||||
|
||||
@@ -2887,6 +2891,7 @@ static int sensor_video_probe(struct soc_camera_device *icd,
|
||||
ret = -ENODEV;
|
||||
goto sensor_video_probe_err;
|
||||
}
|
||||
sensor->info_priv.funmodule_state |= SENSOR_INIT_IS_OK;
|
||||
return 0;
|
||||
|
||||
sensor_video_probe_err:
|
||||
@@ -2894,7 +2899,7 @@ sensor_video_probe_err:
|
||||
}
|
||||
static long sensor_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
||||
{
|
||||
struct i2c_client *client = sd->priv;
|
||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||
struct soc_camera_device *icd = client->dev.platform_data;
|
||||
struct sensor *sensor = to_sensor(client);
|
||||
int ret = 0,i;
|
||||
|
||||
@@ -12,15 +12,15 @@
|
||||
#define OUT_CLK 100000000
|
||||
#define LCDC_ACLK 500000000
|
||||
/* Timing */
|
||||
#define H_PW 320
|
||||
#define H_BP 480
|
||||
#define H_PW 380
|
||||
#define H_BP 540
|
||||
#define H_VD 1024
|
||||
#define H_FP 260
|
||||
#define H_FP 300
|
||||
|
||||
#define V_PW 10
|
||||
#define V_BP 6
|
||||
#define V_PW 15
|
||||
#define V_BP 10
|
||||
#define V_VD 768
|
||||
#define V_FP 16
|
||||
#define V_FP 30
|
||||
|
||||
#define LCD_WIDTH 196// 142 // 202
|
||||
#define LCD_HEIGHT 147 //106// 152
|
||||
|
||||
Reference in New Issue
Block a user