From efa565fc6eb1dd3dd86fe3a2e1532310409dfbea Mon Sep 17 00:00:00 2001 From: Makarand Karvekar Date: Thu, 20 May 2010 17:45:34 -0500 Subject: [PATCH] [ARM] tegra: Olympus: i2c board file updated for touch. Touch platform data updated for newer touch firmware and new object elements. Change-Id: Ib5b6d4d495e0f94c21fbb236ed0526a9819b1683 Signed-off-by: Makarand Karvekar --- arch/arm/mach-tegra/board-olympus-i2c.c | 303 ++++++++++++++++++------ 1 file changed, 228 insertions(+), 75 deletions(-) diff --git a/arch/arm/mach-tegra/board-olympus-i2c.c b/arch/arm/mach-tegra/board-olympus-i2c.c index aadc11a3e952..50939e8ec3da 100644 --- a/arch/arm/mach-tegra/board-olympus-i2c.c +++ b/arch/arm/mach-tegra/board-olympus-i2c.c @@ -30,11 +30,19 @@ #include "board-olympus.h" #include "gpio-names.h" +#define XMEGAT_BL_I2C_ADDR 0x24 #define OLYMPUS_TOUCH_IRQ_GPIO TEGRA_GPIO_PF5 +#define OLYMPUS_TOUCH_RESET_GPIO TEGRA_GPIO_PF4 #define OLYMPUS_COMPASS_IRQ_GPIO TEGRA_GPIO_PE2 -static int sholes_touch_reset(void) + +static int olympus_touch_reset(void) { + gpio_set_value(OLYMPUS_TOUCH_RESET_GPIO, 0); + msleep(10); + gpio_set_value(OLYMPUS_TOUCH_RESET_GPIO, 1); + msleep(100); + return 0; } @@ -82,83 +90,120 @@ static struct qtm_touch_keyarray_cfg sholes_key_array_data[] = { }, }; -static struct qtouch_ts_platform_data sholes_ts_platform_data = { - .irqflags = IRQF_TRIGGER_LOW, +struct qtouch_ts_platform_data olympus_touch_data = { + .flags = (QTOUCH_SWAP_XY | - QTOUCH_FLIP_X | QTOUCH_USE_MULTITOUCH | QTOUCH_CFG_BACKUPNV | QTOUCH_EEPROM_CHECKSUM), - .abs_min_x = 0, - .abs_max_x = 1024, - .abs_min_y = 0, - .abs_max_y = 1024, - .abs_min_p = 0, - .abs_max_p = 255, - .abs_min_w = 0, - .abs_max_w = 15, - .x_delta = 400, - .y_delta = 250, - .nv_checksum = 0xfaf5, - .fuzz_x = 0, - .fuzz_y = 0, - .fuzz_p = 2, - .fuzz_w = 2, - .hw_reset = sholes_touch_reset, + .irqflags = (IRQF_TRIGGER_LOW), + .abs_min_x = 0, + .abs_max_x = 1023, + .abs_min_y = 0, + .abs_max_y = 1023, + .abs_min_p = 0, + .abs_max_p = 255, + .abs_min_w = 0, + .abs_max_w = 15, + .x_delta = 400, + .y_delta = 250, + .nv_checksum = 0xc240, + .fuzz_x = 0, + .fuzz_y = 0, + .fuzz_p = 2, + .fuzz_w = 2, + .boot_i2c_addr = XMEGAT_BL_I2C_ADDR, + .hw_reset = olympus_touch_reset, + .key_array = { + .cfg = NULL, + .keys = NULL, + .num_keys = 0, + }, .power_cfg = { .idle_acq_int = 0xff, .active_acq_int = 0xff, .active_idle_to = 0x01, }, .acquire_cfg = { - .charge_time = 12, - .atouch_drift = 5, - .touch_drift = 20, - .drift_susp = 20, - .touch_autocal = 0x96, + .charge_time = 0x06, + .atouch_drift = 0x00, + .touch_drift = 0x0a, + .drift_susp = 0x05, + .touch_autocal = 0x00, .sync = 0, + .atch_cal_suspend_time = 0, + .atch_cal_suspend_thres = 0, }, .multi_touch_cfg = { .ctrl = 0x0b, .x_origin = 0, .y_origin = 0, - .x_size = 19, - .y_size = 11, + .x_size = 0x13, + .y_size = 0x0b, .aks_cfg = 0, - .burst_len = 0x40, - .tch_det_thr = 0x12, + .burst_len = 0x41, + .tch_det_thr = 0x14, .tch_det_int = 0x2, - .mov_hyst_init = 0xe, - .mov_hyst_next = 0xe, - .mov_filter = 0x9, - .num_touch = 2, - .merge_hyst = 0, - .merge_thresh = 3, - .amp_hyst = 2, - .x_res = 0x0000, - .y_res = 0x0000, - .x_low_clip = 0x00, - .x_high_clip = 0x00, - .y_low_clip = 0x00, - .y_high_clip = 0x00, - }, - .linear_tbl_cfg = { - .ctrl = 0x01, - .x_offset = 0x0000, - .x_segment = { - 0x48, 0x3f, 0x3c, 0x3E, - 0x3f, 0x3e, 0x3e, 0x3e, - 0x3f, 0x42, 0x41, 0x3f, - 0x41, 0x40, 0x41, 0x46 - }, - .y_offset = 0x0000, - .y_segment = { - 0x44, 0x38, 0x37, 0x3e, - 0x3e, 0x41, 0x41, 0x3f, - 0x42, 0x41, 0x42, 0x42, - 0x41, 0x3f, 0x41, 0x45 - }, - }, + .orient = 4, + .mrg_to = 0x19, + .mov_hyst_init = 0x05, + .mov_hyst_next = 0x05, + .mov_filter = 0, + .num_touch = 0x02, + .merge_hyst = 0x05, + .merge_thresh = 0x05, + .amp_hyst = 0, + .x_res = 0x0000, + .y_res = 0x0000, + .x_low_clip = 0x00, + .x_high_clip = 0x00, + .y_low_clip = 0x00, + .y_high_clip = 0x00, + .x_edge_ctrl = 0, + .x_edge_dist = 0, + .y_edge_ctrl = 0, + .y_edge_dist = 0, + .jump_limit = 0, + }, + .linear_tbl_cfg = { + .ctrl = 0x00, + .x_offset = 0x0000, + .x_segment = { + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + }, + .y_offset = 0x0000, + .y_segment = { + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 + }, + }, + .comms_config_cfg = { + .ctrl = 0, + .command = 0, + }, + .gpio_pwm_cfg = { + .ctrl = 0, + .report_mask = 0, + .pin_direction = 0, + .internal_pullup = 0, + .output_value = 0, + .wake_on_change = 0, + .pwm_enable = 0, + .pwm_period = 0, + .duty_cycle_0 = 0, + .duty_cycle_1 = 0, + .duty_cycle_2 = 0, + .duty_cycle_3 = 0, + .trigger_0 = 0, + .trigger_1 = 0, + .trigger_2 = 0, + .trigger_3 = 0, + }, .grip_suppression_cfg = { .ctrl = 0x00, .xlogrip = 0x00, @@ -166,33 +211,136 @@ static struct qtouch_ts_platform_data sholes_ts_platform_data = { .ylogrip = 0x00, .yhigrip = 0x00, .maxtchs = 0x00, - .reserve0 = 0x00, - .szthr1 = 0x00, - .szthr2 = 0x00, + .reserve0 = 0x00, + .szthr1 = 0x00, + .szthr2 = 0x00, .shpthr1 = 0x00, .shpthr2 = 0x00, + .supextto = 0x00, }, - .noise1_suppression_cfg = { - .ctrl = 0x01, - .reserved = 0x01, - .atchthr = 0x64, - .duty_cycle = 0x08, + .noise_suppression_cfg = { + .ctrl = 0, + .outlier_filter_len = 0, + .reserve0 = 0, + .gcaf_upper_limit = 0, + .gcaf_lower_limit = 0, + .gcaf_low_count = 0, + .noise_threshold = 0, + .reserve1 = 0, + .freq_hop_scale = 0, + .burst_freq_0 = 0, + .burst_freq_1 = 0, + .burst_freq_2 = 0, + .burst_freq_3 = 0, + .burst_freq_4 = 0, + .idle_gcaf_valid = 0, + }, + .touch_proximity_cfg = { + .ctrl = 0, + .x_origin = 0, + .y_origin = 0, + .x_size = 0, + .y_size = 0, + .reserve0 = 0, + .blen = 0, + .tch_thresh = 0, + .tch_detect_int = 0, + .average = 0, + .move_null_rate = 0, + .move_det_tresh = 0, + }, + .one_touch_gesture_proc_cfg = { + .ctrl = 0, + .reserve0 = 0, + .gesture_enable = 0, + .pres_proc = 0, + .tap_time_out = 0, + .flick_time_out = 0, + .drag_time_out = 0, + .short_press_time_out = 0, + .long_press_time_out = 0, + .repeat_press_time_out = 0, + .flick_threshold = 0, + .drag_threshold = 0, + .tap_threshold = 0, + .throw_threshold = 0, + }, + .self_test_cfg = { + .ctrl = 0, + .command = 0, + .high_signal_limit_0 = 0, + .low_signal_limit_0 = 0, + .high_signal_limit_1 = 0, + .low_signal_limit_1 = 0, + .high_signal_limit_2 = 0, + .low_signal_limit_2 = 0, + }, + .two_touch_gesture_proc_cfg = { + .ctrl = 0, + .reserved0 = 0, + .reserved1 = 0, + .gesture_enable = 0, + .rotate_threshold = 0, + .zoom_threshold = 0, }, - .key_array = { - .cfg = sholes_key_array_data, - .num_keys = ARRAY_SIZE(sholes_key_array_data), + .cte_config_cfg = { + .ctrl = 1, + .command = 0, + .mode = 3, + .idle_gcaf_depth = 4, + .active_gcaf_depth = 8, + .voltage = 0, + }, + .noise1_suppression_cfg = { + .ctrl = 0x01, + .version = 0x01, + .atch_thr = 0x64, + .duty_cycle = 0x08, + .drift_thr = 0x00, + .clamp_thr = 0x00, + .diff_thr = 0x00, + .adjustment = 0x00, + .average = 0x0000, + .temp = 0x00, + .offset = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }, + .bad_chan = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00 + }, + .x_short = 0x00, }, .vkeys = { - .keys = sholes_touch_vkeys, - .count = ARRAY_SIZE(sholes_touch_vkeys), - .start = 961, + .count = 0, + .keys = NULL, }, }; static struct i2c_board_info __initdata sholes_i2c_bus1_board_info[] = { { I2C_BOARD_INFO(QTOUCH_TS_NAME, 0x4a), - .platform_data = &sholes_ts_platform_data, + .platform_data = &olympus_touch_data, .irq = TEGRA_GPIO_TO_IRQ(OLYMPUS_TOUCH_IRQ_GPIO), }, }; @@ -210,6 +358,11 @@ void __init olympus_i2c_init(void) gpio_request(OLYMPUS_TOUCH_IRQ_GPIO, "touch_irq"); gpio_direction_input(OLYMPUS_TOUCH_IRQ_GPIO); + tegra_gpio_enable(OLYMPUS_TOUCH_RESET_GPIO); + gpio_request(OLYMPUS_TOUCH_RESET_GPIO, "touch_reset"); + gpio_direction_output(OLYMPUS_TOUCH_RESET_GPIO, 1); + + i2c_register_board_info(0, sholes_i2c_bus1_board_info, 1); i2c_register_board_info(3, olympus_i2c_bus4_board_info, 1); -- 2.34.1