aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/Makefile2
-rw-r--r--drivers/staging/mrst-touchscreen/Kconfig2
-rw-r--r--drivers/staging/mrst-touchscreen/Makefile2
-rw-r--r--drivers/staging/mrst-touchscreen/TODO2
-rw-r--r--drivers/staging/mrst-touchscreen/intel-mid-touch.c98
5 files changed, 25 insertions, 81 deletions
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 9fa25133874a..d071bac73acc 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -52,5 +52,5 @@ obj-$(CONFIG_CXT1E1) += cxt1e1/
52obj-$(CONFIG_TI_ST) += ti-st/ 52obj-$(CONFIG_TI_ST) += ti-st/
53obj-$(CONFIG_ADIS16255) += adis16255/ 53obj-$(CONFIG_ADIS16255) += adis16255/
54obj-$(CONFIG_FB_XGI) += xgifb/ 54obj-$(CONFIG_FB_XGI) += xgifb/
55obj-$(CONFIG_TOUCHSCREEN_MRSTOUCH) += mrst-touchscreen/ 55obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += mrst-touchscreen/
56obj-$(CONFIG_MSM_STAGING) += msm/ 56obj-$(CONFIG_MSM_STAGING) += msm/
diff --git a/drivers/staging/mrst-touchscreen/Kconfig b/drivers/staging/mrst-touchscreen/Kconfig
index c2af49217084..775d740bb61f 100644
--- a/drivers/staging/mrst-touchscreen/Kconfig
+++ b/drivers/staging/mrst-touchscreen/Kconfig
@@ -1,6 +1,6 @@
1config TOUCHSCREEN_INTEL_MID 1config TOUCHSCREEN_INTEL_MID
2 tristate "Intel MID platform resistive touchscreen" 2 tristate "Intel MID platform resistive touchscreen"
3 depends on INTEL_SCU_IPC 3 depends on INTEL_SCU_IPC && INPUT_TOUCHSCREEN
4 default y 4 default y
5 help 5 help
6 Say Y here if you have a Intel MID based touchscreen 6 Say Y here if you have a Intel MID based touchscreen
diff --git a/drivers/staging/mrst-touchscreen/Makefile b/drivers/staging/mrst-touchscreen/Makefile
index 2d638b0d70bf..155f58b57dbe 100644
--- a/drivers/staging/mrst-touchscreen/Makefile
+++ b/drivers/staging/mrst-touchscreen/Makefile
@@ -1,3 +1,3 @@
1obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) := intel_mid_touch.o 1obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) := intel-mid-touch.o
2 2
3 3
diff --git a/drivers/staging/mrst-touchscreen/TODO b/drivers/staging/mrst-touchscreen/TODO
index 7157028d634a..84aa6958d0aa 100644
--- a/drivers/staging/mrst-touchscreen/TODO
+++ b/drivers/staging/mrst-touchscreen/TODO
@@ -1,2 +1,4 @@
1- Move the driver to not think it is SPI (requires fixing some of the SFI 1- Move the driver to not think it is SPI (requires fixing some of the SFI
2 and firmware side) 2 and firmware side)
3- Fix mutex in IRQ stuff - threaded IRQ ?
4
diff --git a/drivers/staging/mrst-touchscreen/intel-mid-touch.c b/drivers/staging/mrst-touchscreen/intel-mid-touch.c
index abba22f921be..6fed01ee82da 100644
--- a/drivers/staging/mrst-touchscreen/intel-mid-touch.c
+++ b/drivers/staging/mrst-touchscreen/intel-mid-touch.c
@@ -23,7 +23,6 @@
23 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 23 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 * 24 *
25 * TODO: 25 * TODO:
26 * kill off mrstouch_debug eventually
27 * review conversion of r/m/w sequences 26 * review conversion of r/m/w sequences
28 * Replace interrupt mutex abuse 27 * Replace interrupt mutex abuse
29 * Kill of mrstouchdevp pointer 28 * Kill of mrstouchdevp pointer
@@ -43,16 +42,6 @@
43#include <asm/intel_scu_ipc.h> 42#include <asm/intel_scu_ipc.h>
44 43
45 44
46#if defined(MRSTOUCH_DEBUG)
47#define mrstouch_debug(fmt, args...)\
48 do { \
49 printk(KERN_DEBUG "\n[MRSTOUCH(%d)] - ", __LINE__); \
50 printk(KERN_DEBUG fmt, ##args); \
51 } while (0);
52#else
53#define mrstouch_debug(fmt, args...)
54#endif
55
56/* PMIC Interrupt registers */ 45/* PMIC Interrupt registers */
57#define PMIC_REG_ID1 0x00 /*PMIC ID1 register */ 46#define PMIC_REG_ID1 0x00 /*PMIC ID1 register */
58 47
@@ -100,6 +89,9 @@
100#define MAX_X 1024 89#define MAX_X 1024
101#define MIN_Y 10 90#define MIN_Y 10
102#define MAX_Y 1024 91#define MAX_Y 1024
92#define MIN_P 0
93#define MAX_P TOUCH_PRESSURE_FS
94
103#define WAIT_ADC_COMPLETION 10 95#define WAIT_ADC_COMPLETION 10
104 96
105/* PMIC ADC round robin delays */ 97/* PMIC ADC round robin delays */
@@ -124,8 +116,6 @@ struct mrstouch_dev {
124 int irq; /* Touch screen IRQ # */ 116 int irq; /* Touch screen IRQ # */
125 uint vendor; /* PMIC vendor */ 117 uint vendor; /* PMIC vendor */
126 uint rev; /* PMIC revision */ 118 uint rev; /* PMIC revision */
127 bool suspended; /* Device suspended status */
128 bool disabled; /* Device disabled status */
129 u16 x; /* X coordinate */ 119 u16 x; /* X coordinate */
130 u16 y; /* Y coordinate */ 120 u16 y; /* Y coordinate */
131 bool pendown; /* PEN position */ 121 bool pendown; /* PEN position */
@@ -320,8 +310,6 @@ static int mrstouch_adc_init(struct mrstouch_dev *tsdev)
320 310
321 tsdev->asr = start; 311 tsdev->asr = start;
322 312
323 mrstouch_debug("Channel offset(%d): 0x%X\n", tsdev->asr, tsdev->vendor);
324
325 /* ADC power on, start, enable PENDET and set loop delay 313 /* ADC power on, start, enable PENDET and set loop delay
326 * ADC loop delay is set to 4.5 ms approximately 314 * ADC loop delay is set to 4.5 ms approximately
327 * Loop delay more than this results in jitter in adc readings 315 * Loop delay more than this results in jitter in adc readings
@@ -355,7 +343,6 @@ static void mrstouch_report_xy(struct mrstouch_dev *tsdev, u16 x, u16 y, u16 z)
355 343
356 if (tsdev->pendown && z <= TOUCH_PRESSURE) { 344 if (tsdev->pendown && z <= TOUCH_PRESSURE) {
357 /* Pen removed, report button release */ 345 /* Pen removed, report button release */
358 mrstouch_debug("BTN REL(%d)", z);
359 input_report_key(tsdev->input, BTN_TOUCH, 0); 346 input_report_key(tsdev->input, BTN_TOUCH, 0);
360 tsdev->pendown = false; 347 tsdev->pendown = false;
361 } 348 }
@@ -371,7 +358,6 @@ static void mrstouch_report_xy(struct mrstouch_dev *tsdev, u16 x, u16 y, u16 z)
371 if (x < MIN_X || x > MAX_X || y < MIN_Y || y > MAX_Y) { 358 if (x < MIN_X || x > MAX_X || y < MIN_Y || y > MAX_Y) {
372 /* Spurious values, release button if touched and return */ 359 /* Spurious values, release button if touched and return */
373 if (tsdev->pendown) { 360 if (tsdev->pendown) {
374 mrstouch_debug("BTN REL(%d)", z);
375 input_report_key(tsdev->input, BTN_TOUCH, 0); 361 input_report_key(tsdev->input, BTN_TOUCH, 0);
376 tsdev->pendown = false; 362 tsdev->pendown = false;
377 } 363 }
@@ -382,13 +368,13 @@ static void mrstouch_report_xy(struct mrstouch_dev *tsdev, u16 x, u16 y, u16 z)
382 368
383 input_report_abs(tsdev->input, ABS_X, x); 369 input_report_abs(tsdev->input, ABS_X, x);
384 input_report_abs(tsdev->input, ABS_Y, y); 370 input_report_abs(tsdev->input, ABS_Y, y);
371 input_report_abs(tsdev->input, ABS_PRESSURE, z);
385 input_sync(tsdev->input); 372 input_sync(tsdev->input);
386 } 373 }
387 374
388 375
389 if (!tsdev->pendown && z > TOUCH_PRESSURE) { 376 if (!tsdev->pendown && z > TOUCH_PRESSURE) {
390 /* Pen touched, report button touch */ 377 /* Pen touched, report button touch */
391 mrstouch_debug("BTN TCH(%d, %d, %d)", x, y, z);
392 input_report_key(tsdev->input, BTN_TOUCH, 1); 378 input_report_key(tsdev->input, BTN_TOUCH, 1);
393 tsdev->pendown = true; 379 tsdev->pendown = true;
394 } 380 }
@@ -446,18 +432,7 @@ static int mrstouch_pmic_fs_adc_read(struct mrstouch_dev *tsdev)
446 z |= data[1] & 0x7; /* Lower 3 bits */ 432 z |= data[1] & 0x7; /* Lower 3 bits */
447 z &= 0x3FF; 433 z &= 0x3FF;
448 434
449#if defined(MRSTOUCH_PRINT_XYZP) 435 mrstouch_report_xy(tsdev, x, y, z);
450 mrstouch_debug("X: %d, Y: %d, Z: %d", x, y, z);
451#endif
452
453 if (z >= TOUCH_PRESSURE_FS) {
454 mrstouch_report_xy(tsdev, x, y, TOUCH_PRESSURE - 1); /* Pen Removed */
455 return TOUCH_PRESSURE - 1;
456 } else {
457 mrstouch_report_xy(tsdev, x, y, TOUCH_PRESSURE + 1); /* Pen Touched */
458 return TOUCH_PRESSURE + 1;
459 }
460
461 return 0; 436 return 0;
462 437
463ipc_error: 438ipc_error:
@@ -615,14 +590,6 @@ static int mrstouch_adc_read(struct mrstouch_dev *tsdev)
615 if (err) 590 if (err)
616 goto ipc_error; 591 goto ipc_error;
617 592
618#if defined(MRSTOUCH_PRINT_XYZP)
619 printk(KERN_INFO "X+: %d, Y+: %d, Z+: %d\n", xp, yp, zp);
620#endif
621
622#if defined(MRSTOUCH_PRINT_XYZM)
623 printk(KERN_INFO "X-: %d, Y-: %d, Z-: %d\n", xm, ym, zm);
624#endif
625
626 mrstouch_report_xy(tsdev, xp, yp, zp); /* report x and y to eventX */ 593 mrstouch_report_xy(tsdev, xp, yp, zp); /* report x and y to eventX */
627 594
628 return zp; 595 return zp;
@@ -694,12 +661,10 @@ static int ts_input_dev_init(struct mrstouch_dev *tsdev, struct spi_device *spi)
694{ 661{
695 int err = 0; 662 int err = 0;
696 663
697 mrstouch_debug("%s", __func__);
698
699 tsdev->input = input_allocate_device(); 664 tsdev->input = input_allocate_device();
700 if (!tsdev->input) { 665 if (!tsdev->input) {
701 dev_err(&tsdev->spi->dev, "Unable to allocate input device.\n"); 666 dev_err(&tsdev->spi->dev, "Unable to allocate input device.\n");
702 return -EINVAL; 667 return -ENOMEM;
703 } 668 }
704 669
705 tsdev->input->name = "mrst_touchscreen"; 670 tsdev->input->name = "mrst_touchscreen";
@@ -714,8 +679,9 @@ static int ts_input_dev_init(struct mrstouch_dev *tsdev, struct spi_device *spi)
714 tsdev->input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); 679 tsdev->input->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS);
715 tsdev->input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH); 680 tsdev->input->keybit[BIT_WORD(BTN_TOUCH)] = BIT_MASK(BTN_TOUCH);
716 681
717 input_set_abs_params(tsdev->input, ABS_X, MIN_X, MIN_Y, 0, 0); 682 input_set_abs_params(tsdev->input, ABS_X, MIN_X, MAX_X, 0, 0);
718 input_set_abs_params(tsdev->input, ABS_Y, MIN_X, MIN_Y, 0, 0); 683 input_set_abs_params(tsdev->input, ABS_Y, MIN_Y, MAX_Y, 0, 0);
684 input_set_abs_params(tsdev->input, ABS_PRESSURE, MIN_P, MAX_P, 0, 0);
719 685
720 err = input_register_device(tsdev->input); 686 err = input_register_device(tsdev->input);
721 if (err) { 687 if (err) {
@@ -723,9 +689,6 @@ static int ts_input_dev_init(struct mrstouch_dev *tsdev, struct spi_device *spi)
723 input_free_device(tsdev->input); 689 input_free_device(tsdev->input);
724 return err; 690 return err;
725 } 691 }
726
727 mrstouch_debug("%s", "mrstouch initialized");
728
729 return 0; 692 return 0;
730 693
731} 694}
@@ -737,8 +700,6 @@ static int __devinit mrstouch_probe(struct spi_device *mrstouch_spi)
737 unsigned int myirq; 700 unsigned int myirq;
738 struct mrstouch_dev *tsdev; 701 struct mrstouch_dev *tsdev;
739 702
740 mrstouch_debug("%s(%p)", __func__, mrstouch_spi);
741
742 mrstouchdevp = NULL; 703 mrstouchdevp = NULL;
743 myirq = mrstouch_spi->irq; 704 myirq = mrstouch_spi->irq;
744 705
@@ -768,18 +729,17 @@ static int __devinit mrstouch_probe(struct spi_device *mrstouch_spi)
768 err = ts_input_dev_init(tsdev, mrstouch_spi); 729 err = ts_input_dev_init(tsdev, mrstouch_spi);
769 if (err) { 730 if (err) {
770 dev_err(&tsdev->spi->dev, "ts_input_dev_init failed"); 731 dev_err(&tsdev->spi->dev, "ts_input_dev_init failed");
771 goto mrstouch_err_free_mem; 732 goto mrstouch_err_free_dev;
772 } 733 }
773 734
774 mutex_init(&tsdev->lock); 735 mutex_init(&tsdev->lock);
775 mutex_lock(&tsdev->lock) 736 mutex_lock(&tsdev->lock);
776 737
777 mrstouch_debug("Requesting IRQ-%d", myirq);
778 err = request_irq(myirq, pendet_intr_handler, 738 err = request_irq(myirq, pendet_intr_handler,
779 0, "mrstouch", tsdev); 739 0, "mrstouch", tsdev);
780 if (err) { 740 if (err) {
781 dev_err(&tsdev->spi->dev, "unable to allocate irq\n"); 741 dev_err(&tsdev->spi->dev, "unable to allocate irq\n");
782 goto mrstouch_err_free_mem; 742 goto mrstouch_err_free_dev;
783 } 743 }
784 744
785 tsdev->pendet_thrd = kthread_run(mrstouch_pendet, 745 tsdev->pendet_thrd = kthread_run(mrstouch_pendet,
@@ -787,38 +747,24 @@ static int __devinit mrstouch_probe(struct spi_device *mrstouch_spi)
787 if (IS_ERR(tsdev->pendet_thrd)) { 747 if (IS_ERR(tsdev->pendet_thrd)) {
788 dev_err(&tsdev->spi->dev, "kthread_run failed\n"); 748 dev_err(&tsdev->spi->dev, "kthread_run failed\n");
789 err = PTR_ERR(tsdev->pendet_thrd); 749 err = PTR_ERR(tsdev->pendet_thrd);
790 goto mrstouch_err_free_mem; 750 goto mrstouch_err_free_irq;
791 } 751 }
792 mrstouch_debug("%s", "Driver initialized");
793 return 0; 752 return 0;
794 753mrstouch_err_free_irq:
754 free_irq(myirq, tsdev);
755mrstouch_err_free_dev:
756 input_unregister_device(tsdev->input);
795mrstouch_err_free_mem: 757mrstouch_err_free_mem:
796 kfree(tsdev); 758 kfree(tsdev);
797 return err; 759 return err;
798} 760}
799 761
800static int mrstouch_suspend(struct spi_device *spi, pm_message_t msg)
801{
802 mrstouch_debug("%s", __func__);
803 mrstouchdevp->suspended = 1;
804 return 0;
805}
806
807static int mrstouch_resume(struct spi_device *spi)
808{
809 mrstouch_debug("%s", __func__);
810 mrstouchdevp->suspended = 0;
811 return 0;
812}
813
814static int mrstouch_remove(struct spi_device *spi) 762static int mrstouch_remove(struct spi_device *spi)
815{ 763{
816 mrstouch_debug("%s", __func__);
817 free_irq(mrstouchdevp->irq, mrstouchdevp); 764 free_irq(mrstouchdevp->irq, mrstouchdevp);
818 input_unregister_device(mrstouchdevp->input);
819 input_free_device(mrstouchdevp->input);
820 if (mrstouchdevp->pendet_thrd) 765 if (mrstouchdevp->pendet_thrd)
821 kthread_stop(mrstouchdevp->pendet_thrd); 766 kthread_stop(mrstouchdevp->pendet_thrd);
767 input_unregister_device(mrstouchdevp->input);
822 kfree(mrstouchdevp); 768 kfree(mrstouchdevp);
823 return 0; 769 return 0;
824} 770}
@@ -830,8 +776,6 @@ static struct spi_driver mrstouch_driver = {
830 .owner = THIS_MODULE, 776 .owner = THIS_MODULE,
831 }, 777 },
832 .probe = mrstouch_probe, 778 .probe = mrstouch_probe,
833 .suspend = mrstouch_suspend,
834 .resume = mrstouch_resume,
835 .remove = mrstouch_remove, 779 .remove = mrstouch_remove,
836}; 780};
837 781
@@ -839,11 +783,10 @@ static int __init mrstouch_module_init(void)
839{ 783{
840 int err; 784 int err;
841 785
842 mrstouch_debug("%s", __func__);
843 err = spi_register_driver(&mrstouch_driver); 786 err = spi_register_driver(&mrstouch_driver);
844 if (err) { 787 if (err) {
845 mrstouch_debug("%s(%d)", "SPI PENDET failed", err); 788 printk(KERN_ERR "%s(%d)", "SPI PENDET failed", err);
846 return -1; 789 return err;;
847 } 790 }
848 791
849 return 0; 792 return 0;
@@ -851,7 +794,6 @@ static int __init mrstouch_module_init(void)
851 794
852static void __exit mrstouch_module_exit(void) 795static void __exit mrstouch_module_exit(void)
853{ 796{
854 mrstouch_debug("%s", __func__);
855 spi_unregister_driver(&mrstouch_driver); 797 spi_unregister_driver(&mrstouch_driver);
856 return; 798 return;
857} 799}