diff options
author | Todd Doucet <todd.doucet@timesys.com> | 2010-02-18 12:38:44 -0500 |
---|---|---|
committer | Todd Doucet <todd.doucet@timesys.com> | 2010-02-18 12:38:44 -0500 |
commit | 793deae7244b1c3d3dc9ad9437b692655e04d1c1 (patch) | |
tree | b49aa81dd8bdc377dc64aee55c0ebca1e522b34e | |
parent | 7e407c346b8c197f73e88aea4c6ca3de19710aa1 (diff) |
Intermediate alpha release with partially working touchscreen for special customer.2.6.28-ccwmx51js-201002181258
-rw-r--r-- | arch/arm/mach-mx51/devices.c | 14 | ||||
-rw-r--r-- | arch/arm/mach-mx51/dummy_gpio.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-mx51/mx51_ccwmx51js.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-mx51/mx51_ccwmx51js_gpio.c | 202 | ||||
-rw-r--r-- | arch/arm/mach-mx51/mx51_ccwmx51js_pmic_mc13892.c | 1 | ||||
-rw-r--r-- | drivers/input/Makefile | 1 | ||||
-rw-r--r-- | drivers/input/evbug.c | 4 | ||||
-rw-r--r-- | drivers/input/touchscreen/mxc_ts.c | 24 | ||||
-rw-r--r-- | drivers/mxc/pmic/core/Makefile | 3 | ||||
-rw-r--r-- | drivers/mxc/pmic/core/mc13892.c | 1 | ||||
-rw-r--r-- | drivers/mxc/pmic/mc13892/Makefile | 1 | ||||
-rw-r--r-- | drivers/mxc/pmic/mc13892/pmic_adc.c | 87 |
12 files changed, 330 insertions, 30 deletions
diff --git a/arch/arm/mach-mx51/devices.c b/arch/arm/mach-mx51/devices.c index 3496580d807f..d1a6f8f42528 100644 --- a/arch/arm/mach-mx51/devices.c +++ b/arch/arm/mach-mx51/devices.c @@ -596,6 +596,13 @@ extern void mx51_babbage_gpio_spi_chipselect_active(int cspi_mode, int status, int chipselect); extern void mx51_babbage_gpio_spi_chipselect_inactive(int cspi_mode, int status, int chipselect); + +extern void mx51_ccwmx51js_gpio_spi_chipselect_active(int cspi_mode, int status, + int chipselect); +extern void mx51_ccwmx51js_gpio_spi_chipselect_inactive(int cspi_mode, int status, + int chipselect); + + /*! Platform Data for MXC CSPI1 */ static struct mxc_spi_master mxcspi1_data = { .maxchipselect = 4, @@ -695,9 +702,14 @@ void __init mxc_init_spi(void) #ifdef CONFIG_SPI_MXC_SELECT1 if (machine_is_mx51_babbage()) { mxcspi1_data.chipselect_active = - mx51_babbage_gpio_spi_chipselect_active; + mx51_babbage_gpio_spi_chipselect_active; mxcspi1_data.chipselect_inactive = mx51_babbage_gpio_spi_chipselect_inactive; + } else { + mxcspi1_data.chipselect_active = + mx51_ccwmx51js_gpio_spi_chipselect_active; + mxcspi1_data.chipselect_inactive = + mx51_ccwmx51js_gpio_spi_chipselect_inactive; } if (platform_device_register(&mxcspi1_device) < 0) printk(KERN_ERR "Error: Registering the SPI Controller_1\n"); diff --git a/arch/arm/mach-mx51/dummy_gpio.c b/arch/arm/mach-mx51/dummy_gpio.c index bf21862908ac..ad2388c975a9 100644 --- a/arch/arm/mach-mx51/dummy_gpio.c +++ b/arch/arm/mach-mx51/dummy_gpio.c @@ -23,12 +23,6 @@ EXPORT_SYMBOL(gpio_gps_inactive); void config_uartdma_event(int port) {} EXPORT_SYMBOL(config_uartdma_event); -void gpio_spi_active(int cspi_mod) {} -EXPORT_SYMBOL(gpio_spi_active); - -void gpio_spi_inactive(int cspi_mod) {} -EXPORT_SYMBOL(gpio_spi_inactive); - void gpio_owire_active(void) {} EXPORT_SYMBOL(gpio_owire_active); diff --git a/arch/arm/mach-mx51/mx51_ccwmx51js.c b/arch/arm/mach-mx51/mx51_ccwmx51js.c index 84f3c33d73ef..ea724edd2768 100644 --- a/arch/arm/mach-mx51/mx51_ccwmx51js.c +++ b/arch/arm/mach-mx51/mx51_ccwmx51js.c @@ -385,6 +385,7 @@ static struct fb_videomode wvga_video_mode = static struct mxc_fb_platform_data fb_data_vga = { .interface_pix_fmt = IPU_PIX_FMT_RGB24, +// .interface_pix_fmt = IPU_PIX_FMT_RGB565, // ttd: testing... }; @@ -438,7 +439,7 @@ static int __init ccwmx51_init_fb(void) pr_info("VGA interface is primary\n"); fb_data_vga.mode = 0; // Do not use LCD timings. - fb_data_vga.mode_str = "1024x768M-24@60"; /* Default */ + fb_data_vga.mode_str = "1024x768M-16@60"; /* Default */ /* Get the desired configuration provided by the bootloader */ if (options[3] != '@') { @@ -448,15 +449,15 @@ static int __init ccwmx51_init_fb(void) options = &options[4]; if (((p = strsep (&options, "@")) != NULL) && *p) { if (video_matches(p, "640x480") ){ - fb_data_vga.mode_str = "640x480M-24@60"; + fb_data_vga.mode_str = "640x480M-16@60"; } else if (video_matches(p, "800x600")) { - fb_data_vga.mode_str = "800x600M-24@60"; + fb_data_vga.mode_str = "800x600M-16@60"; } else if (video_matches(p, "1024x768")) { - fb_data_vga.mode_str = "1024x768M-24@60"; + fb_data_vga.mode_str = "1024x768M-16@60"; } else if (video_matches(p, "1280x1024")) { - fb_data_vga.mode_str = "1280x1024M-24@60"; + fb_data_vga.mode_str = "1280x1024M-16@60"; } else if (video_matches(p, "1280x1024")) { - fb_data_vga.mode_str = "1280x1024M-24@60"; + fb_data_vga.mode_str = "1280x1024M-16@60"; } else pr_warning("Unsupported video resolution: %s, using default '%s'\n", p, fb_data_vga.mode_str); @@ -467,7 +468,8 @@ static int __init ccwmx51_init_fb(void) } else if (!strncasecmp(options, "LCD", 3)){ gpio_lcd_active(); fb_data_vga.mode = &wvga_video_mode; // Use timings for Digi LCD. - fb_data_vga.mode_str = "800x480-24@60", +// fb_data_vga.mode_str = "800x480-24@60", + fb_data_vga.mode_str = "800x480-16@60", // ttd: testing... pr_info("Using LDC wvga video timings and mode %s\n", fb_data_vga.mode_str); (void)platform_device_register(&mxc_fb_device[0]); /* LCD */ } diff --git a/arch/arm/mach-mx51/mx51_ccwmx51js_gpio.c b/arch/arm/mach-mx51/mx51_ccwmx51js_gpio.c index 01659b3d3507..41a634d978bf 100644 --- a/arch/arm/mach-mx51/mx51_ccwmx51js_gpio.c +++ b/arch/arm/mach-mx51/mx51_ccwmx51js_gpio.c @@ -544,3 +544,205 @@ void gpio_uart_inactive(int port, int no_irda) {} EXPORT_SYMBOL(gpio_uart_active); EXPORT_SYMBOL(gpio_uart_inactive); + + +/*! + * Setup GPIO for a CSPI device to be active + * + * @param cspi_mod an CSPI device + */ + +// ttd: in process: lots of duplication.... + +void gpio_spi_active(int cspi_mod) +{ +return; + printk("ttd: gpio_spi_active(%d) called\n", cspi_mod); +// printk("RETURN EARLY\n"); + +// return; + + switch (cspi_mod) { + case 0: + /* SPI1 */ + mxc_request_iomux(MX51_PIN_CSPI1_MOSI, IOMUX_CONFIG_ALT0); + mxc_request_iomux(MX51_PIN_CSPI1_MISO, IOMUX_CONFIG_ALT0); + mxc_request_iomux(MX51_PIN_CSPI1_SS0, IOMUX_CONFIG_ALT0); + mxc_request_iomux(MX51_PIN_CSPI1_SCLK, IOMUX_CONFIG_ALT0); +// mxc_request_iomux(MX51_PIN_CSPI1_RDY, IOMUX_CONFIG_ALT0); + + + mxc_iomux_set_pad(MX51_PIN_CSPI1_MOSI, + PAD_CTL_HYS_ENABLE | + PAD_CTL_PKE_ENABLE | + PAD_CTL_DRV_HIGH | + PAD_CTL_SRE_FAST + ); + + mxc_iomux_set_pad(MX51_PIN_CSPI1_MISO, + PAD_CTL_HYS_ENABLE | + PAD_CTL_PKE_ENABLE | + PAD_CTL_DRV_HIGH | + PAD_CTL_SRE_FAST + ); + + mxc_iomux_set_pad(MX51_PIN_CSPI1_SCLK, + PAD_CTL_HYS_ENABLE | + PAD_CTL_PKE_ENABLE | + PAD_CTL_DRV_HIGH | + PAD_CTL_SRE_FAST + ); + + + mxc_iomux_set_pad(MX51_PIN_CSPI1_SS0, + PAD_CTL_SRE_FAST + ); + + + +/* + mxc_iomux_set_pad(MX51_PIN_CSPI1_RDY, + PAD_CTL_HYS_ENABLE | + PAD_CTL_PKE_ENABLE | + PAD_CTL_DRV_HIGH | + PAD_CTL_SRE_FAST + ); +*/ + break; + case 1: + /* SPI2 */ + break; + default: + break; + } +} + + +EXPORT_SYMBOL(gpio_spi_active); + +/*! + * Setup GPIO for a CSPI device to be inactive + * + * @param cspi_mod a CSPI device + */ +void gpio_spi_inactive(int cspi_mod) +{ +return; + printk("ttd: gpio_spi_inactive(%d)) called\n", cspi_mod); + switch (cspi_mod) { + case 0: + /* SPI1 */ + gpio_request(IOMUX_TO_GPIO(MX51_PIN_CSPI1_MOSI), NULL); + gpio_request(IOMUX_TO_GPIO(MX51_PIN_CSPI1_MISO), NULL); + gpio_request(IOMUX_TO_GPIO(MX51_PIN_CSPI1_SS0), NULL); + gpio_request(IOMUX_TO_GPIO(MX51_PIN_CSPI1_SCLK), NULL); +// gpio_request(IOMUX_TO_GPIO(MX51_PIN_CSPI1_RDY), NULL); + + mxc_free_iomux(MX51_PIN_CSPI1_MOSI, IOMUX_CONFIG_GPIO); + mxc_free_iomux(MX51_PIN_CSPI1_MISO, IOMUX_CONFIG_GPIO); + mxc_free_iomux(MX51_PIN_CSPI1_SS0, IOMUX_CONFIG_GPIO); + mxc_free_iomux(MX51_PIN_CSPI1_SCLK, IOMUX_CONFIG_GPIO); +// mxc_free_iomux(MX51_PIN_CSPI1_RDY, MUX_CONFIG_GPIO); + + // ttd: todo: assert chip select to lower overhead of + // subsequent spi messaging. + + + + break; + case 1: + /* SPI2 */ + break; + default: + break; + } + +} + + +EXPORT_SYMBOL(gpio_spi_inactive); + +// ttd: trying the babbage hack. Currently, this code is gross. + +/* workaround for cspi chipselect pin may not keep correct level when idle */ +void mx51_ccwmx51js_gpio_spi_chipselect_active(int cspi_mode, int status, + int chipselect) +{ + u32 gpio; + +// testing!!! +// return; +// printk("mx51_ccwmx51js_gpio_spi_chipselect_active(mode=%d, status=%d, chipselect=%d)\n", +// cspi_mode, status, chipselect); + + switch (cspi_mode) { + case 1: + switch (chipselect) { + case 0x1: + mxc_request_iomux(MX51_PIN_CSPI1_SS0, + IOMUX_CONFIG_ALT0); + mxc_iomux_set_pad(MX51_PIN_CSPI1_SS0, + PAD_CTL_HYS_ENABLE | + PAD_CTL_PKE_ENABLE | + PAD_CTL_DRV_HIGH | PAD_CTL_SRE_FAST); + + gpio_direction_output(IOMUX_TO_GPIO(MX51_PIN_CSPI1_SS0), 0); + + break; + case 0x2: + gpio = IOMUX_TO_GPIO(MX51_PIN_CSPI1_SS0); + mxc_request_iomux(MX51_PIN_CSPI1_SS0, + IOMUX_CONFIG_GPIO); + gpio_request(gpio, "cspi1_ss0"); + gpio_direction_output(gpio, 0); + gpio_set_value(gpio, 1 & (~status)); + break; + default: + break; + } + break; + case 2: + break; + case 3: + break; + default: + break; + } +} +EXPORT_SYMBOL(mx51_ccwmx51js_gpio_spi_chipselect_active); + +void mx51_ccwmx51js_gpio_spi_chipselect_inactive(int cspi_mode, int status, + int chipselect) +{ +// printk("mx51_ccwmx51js_gpio_spi_chipselect_inactive(mode=%d, status=%d, chipselect=%d)\n", +// cspi_mode, status, chipselect); + + +// testing!!! +return; + + switch (cspi_mode) { + case 1: + switch (chipselect) { + case 0x1: + mxc_free_iomux(MX51_PIN_CSPI1_SS0, IOMUX_CONFIG_ALT0); + mxc_request_iomux(MX51_PIN_CSPI1_SS0, + IOMUX_CONFIG_GPIO); + mxc_free_iomux(MX51_PIN_CSPI1_SS0, IOMUX_CONFIG_GPIO); + break; + case 0x2: + mxc_free_iomux(MX51_PIN_CSPI1_SS0, IOMUX_CONFIG_GPIO); + break; + default: + break; + } + break; + case 2: + break; + case 3: + break; + default: + break; + } +} +EXPORT_SYMBOL(mx51_ccwmx51js_gpio_spi_chipselect_inactive); diff --git a/arch/arm/mach-mx51/mx51_ccwmx51js_pmic_mc13892.c b/arch/arm/mach-mx51/mx51_ccwmx51js_pmic_mc13892.c index f650724871ea..d51fae4986c4 100644 --- a/arch/arm/mach-mx51/mx51_ccwmx51js_pmic_mc13892.c +++ b/arch/arm/mach-mx51/mx51_ccwmx51js_pmic_mc13892.c @@ -359,3 +359,4 @@ int __init ccwmx51_init_mc13892(void) return spi_register_board_info(&mc13892_spi_device, 1); } + diff --git a/drivers/input/Makefile b/drivers/input/Makefile index 98c4f9a77876..d69ccbd3aea5 100644 --- a/drivers/input/Makefile +++ b/drivers/input/Makefile @@ -1,3 +1,4 @@ +CFLAGS_evbug.o := -DDEBUG # # Makefile for the input core drivers. # diff --git a/drivers/input/evbug.c b/drivers/input/evbug.c index 0353601ac3b5..bcd176eedb47 100644 --- a/drivers/input/evbug.c +++ b/drivers/input/evbug.c @@ -64,11 +64,13 @@ static int evbug_connect(struct input_handler *handler, struct input_dev *dev, if (error) goto err_unregister_handle; +/* +// Messing up debugging by interfering with init scripts , so I'm temporarily removing this. printk(KERN_DEBUG "evbug.c: Connected device: %s (%s at %s)\n", dev->dev.bus_id, dev->name ?: "unknown", dev->phys ?: "unknown"); - +*/ return 0; err_unregister_handle: diff --git a/drivers/input/touchscreen/mxc_ts.c b/drivers/input/touchscreen/mxc_ts.c index b354d81c5465..2b57a26804b6 100644 --- a/drivers/input/touchscreen/mxc_ts.c +++ b/drivers/input/touchscreen/mxc_ts.c @@ -43,6 +43,7 @@ static u32 input_ts_installed; static int ts_thread(void *arg) { + int j1=0, j2=0, j3=0, j4=0; t_touch_screen ts_sample; s32 wait = 0; @@ -50,19 +51,36 @@ static int ts_thread(void *arg) while (input_ts_installed) { try_to_freeze(); memset(&ts_sample, 0, sizeof(t_touch_screen)); - if (0 != pmic_adc_get_touch_sample(&ts_sample, !wait)) - continue; - if (!(ts_sample.contact_resistance || wait)) + j3 = jiffies; + if (0 != pmic_adc_get_touch_sample(&ts_sample, !wait)){ + printk("ttd: pmic_adc_get_touch_sample() RETURNS NONZERO\n"); continue; + } + j4 = jiffies; +// printk("ts_thread: pmic_adc_get_touch_sample() took %d jiffies\n", j4 - j3); + if (!(ts_sample.contact_resistance || wait)){ + printk("ttd: continue: res=%d, wait=%d\n", ts_sample.contact_resistance, wait); + continue; + } + + printk("ttd: ts_thread sending event: abs x=%d, abx y = %d, resistance = %d\n", + ts_sample.x_position, + ts_sample.y_position, + ts_sample.contact_resistance + ); + j1 = jiffies; input_report_abs(mxc_inputdev, ABS_X, ts_sample.x_position); input_report_abs(mxc_inputdev, ABS_Y, ts_sample.y_position); input_report_abs(mxc_inputdev, ABS_PRESSURE, ts_sample.contact_resistance); input_sync(mxc_inputdev); + j2 = jiffies; wait = ts_sample.contact_resistance; + j1 = jiffies; msleep(20); + j2 = jiffies; } return 0; diff --git a/drivers/mxc/pmic/core/Makefile b/drivers/mxc/pmic/core/Makefile index e746702bc569..44eb70e5973a 100644 --- a/drivers/mxc/pmic/core/Makefile +++ b/drivers/mxc/pmic/core/Makefile @@ -1,3 +1,6 @@ +CFLAGS_mc13892.o := -DDEBUG + + # # Makefile for the PMIC core drivers. # diff --git a/drivers/mxc/pmic/core/mc13892.c b/drivers/mxc/pmic/core/mc13892.c index 34ceec59221e..4b900d578b51 100644 --- a/drivers/mxc/pmic/core/mc13892.c +++ b/drivers/mxc/pmic/core/mc13892.c @@ -110,7 +110,6 @@ int pmic_read(int reg_num, unsigned int *reg_val) return PMIC_ERROR; frame |= reg_num << MXC_PMIC_REG_NUM_SHIFT; - ret = spi_rw(pmic_drv_data.spi, (u8 *) &frame, 1); *reg_val = frame & MXC_PMIC_FRAME_MASK; diff --git a/drivers/mxc/pmic/mc13892/Makefile b/drivers/mxc/pmic/mc13892/Makefile index 0ed2b7eb4c11..b23e2087c95e 100644 --- a/drivers/mxc/pmic/mc13892/Makefile +++ b/drivers/mxc/pmic/mc13892/Makefile @@ -2,6 +2,7 @@ # Makefile for the mc13783 pmic drivers. # +CFLAGS_pmic_adc.o := -DDEBUG obj-$(CONFIG_MXC_MC13892_ADC) += pmic_adc.o #obj-$(CONFIG_MXC_MC13892_RTC) += pmic_rtc.o obj-$(CONFIG_MXC_MC13892_LIGHT) += pmic_light.o diff --git a/drivers/mxc/pmic/mc13892/pmic_adc.c b/drivers/mxc/pmic/mc13892/pmic_adc.c index cec4d6045974..e987ef98ddd6 100644 --- a/drivers/mxc/pmic/mc13892/pmic_adc.c +++ b/drivers/mxc/pmic/mc13892/pmic_adc.c @@ -325,8 +325,9 @@ int pmic_adc_init(void) { unsigned int reg_value = 0, i = 0; - if (suspend_flag == 1) + if (suspend_flag == 1){ return -EBUSY; + } for (i = 0; i < ADC_NB_AVAILABLE; i++) adc_dev[i] = ADC_FREE; @@ -399,17 +400,23 @@ int mc13892_adc_init_param(t_adc_param * adc_param) PMIC_STATUS mc13892_adc_convert(t_adc_param * adc_param) { + int j1=0, j2=0, j3=0; + int jj1=0, jj2=0; + bool use_bis = false; unsigned int adc_0_reg = 0, adc_1_reg = 0, reg_1 = 0, result_reg = 0, i = 0; unsigned int result = 0, temp = 0; pmic_version_t mc13892_ver; pr_debug("mc13892 ADC - mc13892_adc_convert ....\n"); - if (suspend_flag == 1) + if (suspend_flag == 1){ + printk("ttd: mc13892_adc_convert returns -EBUSY\n"); return -EBUSY; + } if (adc_param->wait_tsi) { /* configure adc to wait tsi interrupt */ +// printk("ttd: INIT_COMPLETION(adc_tsi)\n"); INIT_COMPLETION(adc_tsi); /*for ts don't use bis */ @@ -425,9 +432,14 @@ PMIC_STATUS mc13892_adc_convert(t_adc_param * adc_param) wait_ts = true; wait_for_completion_interruptible(&adc_tsi); wait_ts = false; + } else { +// printk("ttd: mc13892_adc_convert(): is not in wait mode\n"); } + down(&convert_mutex); + use_bis = mc13892_adc_request(adc_param->read_ts); + if (use_bis < 0) { pr_debug("process has received a signal and got interrupted\n"); return -EINTR; @@ -465,6 +477,8 @@ PMIC_STATUS mc13892_adc_convert(t_adc_param * adc_param) } else { adc_0_reg = 0x002400 | (ADC_BIS * use_bis) | ADC_INC; } +j1 = jiffies; + pr_debug("Write Reg %i = %x\n", REG_ADC0, adc_0_reg); /*Change has been made here */ CHECK_ERROR(pmic_write_reg(REG_ADC0, adc_0_reg, @@ -487,6 +501,9 @@ PMIC_STATUS mc13892_adc_convert(t_adc_param * adc_param) } reg_1 = adc_1_reg; if (use_bis == 0) { + int jj1 = 0, jj2 = 0; + + jj1 = jiffies; data_ready_adc_1 = false; adc_1_reg |= ASC_ADC; data_ready_adc_1 = true; @@ -499,8 +516,11 @@ PMIC_STATUS mc13892_adc_convert(t_adc_param * adc_param) ADC_DELAY_MASK | ASC_ADC | ADC_BIS)); pr_debug("wait adc done \n"); wait_for_completion_interruptible(&adcdone_it); + jj2 = jiffies; +// printk("ttd: use_bis == 0, jiffies=%d\n", jj2-jj1); data_ready_adc_1 = false; } else { +// printk("ttd: USE_BIS != 0\n"); data_ready_adc_2 = false; adc_1_reg |= ASC_ADC; data_ready_adc_2 = true; @@ -512,6 +532,9 @@ PMIC_STATUS mc13892_adc_convert(t_adc_param * adc_param) wait_for_completion_interruptible(&adcbisdone_it); data_ready_adc_2 = false; } + j2 = jiffies; +// printk("ttd: partial adc_convert: %d j\n", j2 - j1); + /* read result and store in adc_param */ result = 0; if (use_bis == 0) @@ -519,17 +542,28 @@ PMIC_STATUS mc13892_adc_convert(t_adc_param * adc_param) else result_reg = REG_ADC4; + j2 = jiffies; CHECK_ERROR(pmic_write_reg(REG_ADC1, 4 << ADC_CH_1_POS, ADC_CH_0_MASK | ADC_CH_1_MASK)); + j3 = jiffies; +// printk(" ttd: then %d jiffies\n", j3-j2); + + jj1 = jiffies; for (i = 0; i <= 3; i++) { + j2 = jiffies; CHECK_ERROR(pmic_read_reg(result_reg, &result, PMIC_ALL_BITS)); + j3 = jiffies; +// printk(" ttd: then again %d jiffies\n", j3-j2); + adc_param->value[i] = ((result & ADD1_RESULT_MASK) >> 2); adc_param->value[i + 4] = ((result & ADD2_RESULT_MASK) >> 14); pr_debug("value[%d] = %d, value[%d] = %d\n", i, adc_param->value[i], i + 4, adc_param->value[i + 4]); } + jj2 = jiffies; +// printk("ttd: double-check: %d jiffies\n", jj2 - jj1); if (adc_param->read_ts) { adc_param->ts_value.x_position = adc_param->value[0]; adc_param->ts_value.x_position1 = adc_param->value[0]; @@ -549,7 +583,6 @@ PMIC_STATUS mc13892_adc_convert(t_adc_param * adc_param) } */ mc13892_adc_release(use_bis); up(&convert_mutex); - return PMIC_SUCCESS; } @@ -636,8 +669,10 @@ PMIC_STATUS pmic_adc_convert_8x(t_channel channel, unsigned short *result) PMIC_STATUS pmic_adc_set_touch_mode(t_touch_mode touch_mode) { - if (suspend_flag == 1) + if (suspend_flag == 1){ + printk("pmic_adc: busy!!\n"); return -EBUSY; + } CHECK_ERROR(pmic_write_reg(REG_ADC0, BITFVAL(MC13892_ADC0_TS_M, touch_mode), @@ -648,42 +683,69 @@ PMIC_STATUS pmic_adc_set_touch_mode(t_touch_mode touch_mode) PMIC_STATUS pmic_adc_get_touch_mode(t_touch_mode * touch_mode) { unsigned int value; - if (suspend_flag == 1) + + if (suspend_flag == 1){ + printk("pmic_adc: busy in get!!\n"); return -EBUSY; + } CHECK_ERROR(pmic_read_reg(REG_ADC0, &value, PMIC_ALL_BITS)); *touch_mode = BITFEXT(value, MC13892_ADC0_TS_M); + printk("pmic_adc_get_touch_mode(): 0x%x\n", *touch_mode); return PMIC_SUCCESS; } PMIC_STATUS pmic_adc_get_touch_sample(t_touch_screen *touch_sample, int wait) { - if (mc13892_adc_read_ts(touch_sample, wait) != 0) + int j1 = 0, j2 = 0, j3 = 0, j4 = 0; + + j1 = jiffies; + if (mc13892_adc_read_ts(touch_sample, wait) != 0){ + printk("ttd: pmic_adc_get_touch_sample PMIC_ERROR 1!!\n"); return PMIC_ERROR; - if (0 == pmic_adc_filter(touch_sample)) + } + j2 = jiffies; + if (0 == pmic_adc_filter(touch_sample)){ + j3 = jiffies; + printk("pmic_adc_get_touch_sample(): read(w=%d): %d jf, filter: %d jf\n", wait, j2 - j1, j3 - j2); return PMIC_SUCCESS; - else + } + else { + printk("ttd: pmic_adc_get_touch_sample PMIC_ERROR 2!!\n"); return PMIC_ERROR; + } } PMIC_STATUS mc13892_adc_read_ts(t_touch_screen *ts_value, int wait_tsi) { + int j1=0, j2=0, j3=0, j4=0; + t_adc_param param; pr_debug("mc13892_adc : mc13892_adc_read_ts\n"); - if (suspend_flag == 1) + if (suspend_flag == 1){ + printk("ttd: mc13892_adc_read_ts() returns -EBUSY\n"); return -EBUSY; + } if (wait_ts) { + printk("ttd: mc13892_adc_read_ts() returns PMIC_ERROR\n"); pr_debug("mc13892_adc : error TS busy \n"); return PMIC_ERROR; } + j1 = jiffies; mc13892_adc_init_param(¶m); + j2 = jiffies; param.wait_tsi = wait_tsi; param.read_ts = true; - if (mc13892_adc_convert(¶m) != 0) + j3 = jiffies; + if (mc13892_adc_convert(¶m) != 0){ + printk("ttd: mc13892_adc_read_ts() returns PMIC_ERROR after adc_convert\n"); return PMIC_ERROR; + } + j4 = jiffies; +// printk(" mc13892_adc_read_ts(): init= %d j, convert = %d j\n", j2-j1, j4-j3); /* check if x-y is ok */ if (param.ts_value.contact_resistance < 1000) { ts_value->x_position = param.ts_value.x_position; @@ -698,6 +760,7 @@ PMIC_STATUS mc13892_adc_read_ts(t_touch_screen *ts_value, int wait_tsi) param.ts_value.contact_resistance + 1; } else { + printk("ttd: bad contact resistance value: %d\n", param.ts_value.contact_resistance); ts_value->x_position = 0; ts_value->y_position = 0; ts_value->contact_resistance = 0; @@ -748,7 +811,8 @@ int mc13892_adc_release(int adc_index) return -1; } -#ifdef DEBUG +//#ifdef DEBUG +#if 1 static t_adc_param adc_param_db; static ssize_t adc_info(struct device *dev, struct device_attribute *attr, @@ -964,6 +1028,7 @@ static struct platform_driver pmic_adc_driver_ldm = { .remove = pmic_adc_module_remove, }; + static int __init pmic_adc_module_init(void) { pr_debug("PMIC ADC driver loading...\n"); |