summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvdumpa <vdumpa@nvidia.com>2010-04-16 15:01:52 -0700
committerGary King <gking@nvidia.com>2010-04-23 13:29:42 -0700
commitf0a12f3a7b3aac3890a1161de9e1cb5f5d263919 (patch)
treedf24e782845f461dcbc65500a8c18e954cd5f0b9
parent526ae33f0d5fddda812f0444dd91ece1cedf8dde (diff)
panjit touch: Adding the odm panjit touch screen driver.
Checking in odm panjit touch screen driver. This is required for new harmony tablet board. This is disabled by default as of now. Also checking updated tegra-gpio.c to have the correct gpio lies info for harmony tablet. This is also disabled by default. Added the acceleremeter properties in the odm kit. The driver for accelerometer will be checked in later. updated copyright headers for panjit. Change-Id: I7089ddb11670670dc0aa683dce190bc619fb07e2 Reviewed-on: http://git-master/r/1139 Reviewed-by: Gary King <gking@nvidia.com> Reviewed-by: Krishna Reddy <vdumpa@nvidia.com> Tested-by: Krishna Reddy <vdumpa@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/odm_kit/platform/touch/Makefile8
-rw-r--r--arch/arm/mach-tegra/odm_kit/platform/touch/nvodm_touch.c7
-rw-r--r--arch/arm/mach-tegra/odm_kit/platform/touch/nvodm_touch_panjit.c603
-rw-r--r--arch/arm/mach-tegra/odm_kit/platform/touch/nvodm_touch_panjit.h188
-rwxr-xr-xarch/arm/mach-tegra/odm_kit/query/harmony/subboards/nvodm_query_discovery_e1162_addresses.h11
-rw-r--r--arch/arm/mach-tegra/odm_kit/query/harmony/subboards/nvodm_query_discovery_e1162_peripherals.h11
-rw-r--r--drivers/input/keyboard/tegra-gpio.c6
7 files changed, 826 insertions, 8 deletions
diff --git a/arch/arm/mach-tegra/odm_kit/platform/touch/Makefile b/arch/arm/mach-tegra/odm_kit/platform/touch/Makefile
index 0890a3124a0d..457bacd20c8c 100644
--- a/arch/arm/mach-tegra/odm_kit/platform/touch/Makefile
+++ b/arch/arm/mach-tegra/odm_kit/platform/touch/Makefile
@@ -15,7 +15,13 @@ ifeq ($(CONFIG_TEGRA_ODM_WHISTLER),y)
is_tpk_touch := y
endif
+ifeq ($(CONFIG_TEGRA_ODM_HARMONY),y)
+ is_panjit_touch := y
+endif
+
ccflags-$(is_tpk_touch) += -DNV_TOUCH_TPK
+ccflags-$(is_panjit_touch) += -DNV_TOUCH_PANJIT
obj-y += nvodm_touch.o
-obj-$(is_tpk_touch) += nvodm_touch_tpk.o \ No newline at end of file
+obj-$(is_tpk_touch) += nvodm_touch_tpk.o
+obj-$(is_panjit_touch) += nvodm_touch_panjit.o
diff --git a/arch/arm/mach-tegra/odm_kit/platform/touch/nvodm_touch.c b/arch/arm/mach-tegra/odm_kit/platform/touch/nvodm_touch.c
index 709f1eab7371..bf7d3eaa3049 100644
--- a/arch/arm/mach-tegra/odm_kit/platform/touch/nvodm_touch.c
+++ b/arch/arm/mach-tegra/odm_kit/platform/touch/nvodm_touch.c
@@ -36,7 +36,9 @@
#if defined(NV_TOUCH_TPK)
#include "nvodm_touch_tpk.h"
#endif
-
+#if defined(NV_TOUCH_PANJIT)
+#include "nvodm_touch_panjit.h"
+#endif
/** Implementation for the NvOdm TouchPad */
@@ -48,6 +50,9 @@ NvOdmTouchDeviceOpen( NvOdmTouchDeviceHandle *hDevice )
#if defined(NV_TOUCH_TPK)
ret = TPK_Open(hDevice);
#endif
+#if defined(NV_TOUCH_PANJIT)
+ ret = PANJIT_Open(hDevice);
+#endif
return ret;
}
diff --git a/arch/arm/mach-tegra/odm_kit/platform/touch/nvodm_touch_panjit.c b/arch/arm/mach-tegra/odm_kit/platform/touch/nvodm_touch_panjit.c
new file mode 100644
index 000000000000..6516ccbce839
--- /dev/null
+++ b/arch/arm/mach-tegra/odm_kit/platform/touch/nvodm_touch_panjit.c
@@ -0,0 +1,603 @@
+/*
+ * Copyright (c) 2010 NVIDIA Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the NVIDIA Corporation nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "nvodm_touch_panjit.h"
+#include "nvodm_query_discovery.h"
+#include "nvos.h"
+
+#define PANJIT_BENCHMARK_SAMPLE 0
+#define PANJIT_TOUCH_DEVICE_GUID NV_ODM_GUID('p','a','n','j','i','t','_','0')
+#define PANJIT_READ(dev, reg, buffer, len) \
+ PANJIT_ReadRegister(dev, reg, buffer, len)
+#define PANJIT_I2C_SPEED_KHZ 400
+#define SAMPLES_PER_SECOND 80
+
+#define SLEEP_MODE_NORMAL 0x00
+#define SLEEP_MODE_SENSOR_SLEEP 0x01
+
+#define X_MIN 0x00
+#define Y_MIN 0x00
+#define X_MAX 4095
+#define Y_MAX 4095
+#define PANJIT_I2C_TIMEOUT 1000
+#define PANJIT_DEBOUNCE_TIME_MS 1
+#define TP_DATA_LENGTH 12
+#define TP_TOUCH_STATE_BYTE 0
+#define TP_FINGER_ONE_MASK 0x01
+#define TP_FINGER_TWO_MASK 0x02
+#define TP_SPECIAL_FUNCTION_BYTE 9
+
+static const
+NvOdmTouchCapabilities PANJIT_Capabilities =
+{
+ 1, // IsMultiTouchSupported
+ 2, // MaxNumberOfFingerCoordReported;
+ 0, // IsRelativeDataSupported
+ 0, // MaxNumberOfRelativeCoordReported
+ 0, // MaxNumberOfWidthReported
+ 0, // MaxNumberOfPressureReported
+ (NvU32)NvOdmTouchGesture_Not_Supported, // Gesture
+ 0, // IsWidthSupported
+ 0, // IsPressureSupported
+ 1, // IsFingersSupported
+ X_MIN, // XMinPosition
+ Y_MIN, // YMinPosition
+ X_MAX, // XMaxPosition
+ Y_MAX, // YMaxPosition
+ 0
+};
+
+#define INT_PIN_ACTIVE_STATE 0
+
+static NvBool
+PANJIT_ReadRegister(
+ PANJIT_TouchDevice* hTouch,
+ NvU8 reg,
+ NvU8* buffer,
+ NvU32 len)
+{
+ NvOdmI2cStatus Error;
+ NvOdmI2cTransactionInfo TransactionInfo;
+
+ TransactionInfo.Address = (hTouch->DeviceAddr | 0x1);
+ TransactionInfo.Buf = buffer;
+ TransactionInfo.Flags = 0;
+ TransactionInfo.NumBytes = len;
+
+ Error = NvOdmI2cTransaction(hTouch->hOdmI2c,
+ &TransactionInfo,
+ 1,
+ hTouch->I2cClockSpeedKHz,
+ PANJIT_I2C_TIMEOUT);
+
+ if (Error != NvOdmI2cStatus_Success)
+ {
+ NVODMTOUCH_PRINTF(("I2C Read Failure = %d (addr=0x%x, reg=0x%x)\r\n", Error,
+ hTouch->DeviceAddr, reg));
+ return NV_FALSE;
+ }
+
+ return NV_TRUE;
+}
+
+static NvBool
+PANJIT_WriteRegister(
+ PANJIT_TouchDevice* hTouch,
+ NvU8 reg,
+ NvU8* buffer,
+ NvU32 len)
+{
+ NvOdmI2cStatus Error;
+ NvOdmI2cTransactionInfo TransactionInfo;
+
+ TransactionInfo.Address = hTouch->DeviceAddr;
+ TransactionInfo.Buf = buffer;
+ TransactionInfo.Flags = NVODM_I2C_IS_WRITE;
+ TransactionInfo.NumBytes = len;
+
+ Error = NvOdmI2cTransaction(hTouch->hOdmI2c,
+ &TransactionInfo,
+ 1,
+ hTouch->I2cClockSpeedKHz,
+ PANJIT_I2C_TIMEOUT);
+
+ if (Error != NvOdmI2cStatus_Success)
+ {
+ NVODMTOUCH_PRINTF(("I2C Write Failure = %d (addr=0x%x, reg=0x%x)\r\n",
+ Error, hTouch->DeviceAddr, reg));
+ return NV_FALSE;
+ }
+ return NV_TRUE;
+}
+
+static void PANJIT_EnableScanMode(PANJIT_TouchDevice* hTouch)
+{
+ NvU8 buff[4];
+
+ // Enable Scan Mode.
+ buff[0] = 0;
+ buff[1] = 8;
+ PANJIT_WriteRegister(hTouch, 0, buff, 2);
+}
+
+static void PANJIT_ClearInterrupt(PANJIT_TouchDevice* hTouch)
+{
+ NvU8 buff[4];
+
+ // Clear Interrupt.
+ buff[0] = 1;
+ buff[1] = 0;
+ PANJIT_WriteRegister(hTouch, 0, buff, 2);
+}
+
+static NvBool PANJIT_Configure(PANJIT_TouchDevice* hTouch)
+{
+
+ NVODMTOUCH_PRINTF(("PANJIT_Configure\r\n"));
+
+ hTouch->SleepMode = SLEEP_MODE_NORMAL;
+ hTouch->SampleRate = SAMPLES_PER_SECOND;
+
+ // Enable Scan Mode.
+ PANJIT_EnableScanMode(hTouch);
+ // Clear Interrupt.
+ PANJIT_ClearInterrupt(hTouch);
+ return NV_TRUE;
+}
+
+static NvBool
+PANJIT_GetSample(
+ PANJIT_TouchDevice* hTouch,
+ NvOdmTouchCoordinateInfo* coord)
+{
+ NvU8 TouchData[TP_DATA_LENGTH] = {0};
+
+ NVODMTOUCH_PRINTF(("PANJIT_GetSample+\r\n"));
+
+ if (!hTouch || !coord)
+ return NV_FALSE;
+
+ if (!PANJIT_READ(hTouch, 0, &TouchData[0], TP_DATA_LENGTH))
+ return NV_FALSE;
+
+ NVODMTOUCH_PRINTF(("TouchData=0x%x %x %x %x %x %x %x %x %x %x %x %x\r\n",
+ TouchData[0], TouchData[1], TouchData[2], TouchData[3], TouchData[4],
+ TouchData[5], TouchData[6], TouchData[7],TouchData[8], TouchData[9],
+ TouchData[10], TouchData[11]));
+
+ /* Ignore No finger */
+ coord->fingerstate = (TouchData[10] & (TP_FINGER_ONE_MASK | TP_FINGER_TWO_MASK)) ?
+ NvOdmTouchSampleValidFlag : NvOdmTouchSampleIgnore;
+
+ if (coord->fingerstate == NvOdmTouchSampleIgnore)
+ {
+ if (hTouch->PrevFingers == 0)
+ {
+ NVODMTOUCH_PRINTF(("NvOdmTouchSampleIgnore\r\n"));
+ return NV_TRUE;
+ }
+ coord->fingerstate = NvOdmTouchSampleValidFlag;
+ }
+
+ // get the finger count
+ coord->additionalInfo.Fingers = TouchData[10];
+ if (coord->additionalInfo.Fingers > hTouch->Caps.MaxNumberOfFingerCoordReported)
+ coord->additionalInfo.Fingers = hTouch->Caps.MaxNumberOfFingerCoordReported;
+
+ NVODMTOUCH_PRINTF(("coord->additionalInfo.Fingers = %d\r\n",
+ coord->additionalInfo.Fingers));
+
+ if (coord->additionalInfo.Fingers)
+ {
+ coord->fingerstate |= NvOdmTouchSampleDownFlag;
+ coord->xcoord = TouchData[2];
+ coord->xcoord = ((coord->xcoord<<8)|(TouchData[3]));
+ coord->ycoord = TouchData[4];
+ coord->ycoord = ((coord->ycoord<<8)|(TouchData[5]));
+ coord->additionalInfo.multi_XYCoords[0][0] = coord->xcoord;
+ coord->additionalInfo.multi_XYCoords[0][1] = coord->ycoord;
+ coord->additionalInfo.multi_XYCoords[1][0] = (TouchData[6]<<8) | (TouchData[7]);
+ coord->additionalInfo.multi_XYCoords[1][1] = (TouchData[8]<<8) | (TouchData[9]);
+ }
+ hTouch->PrevFingers = coord->additionalInfo.Fingers;
+ NVODMTOUCH_PRINTF(("(%d,%d)\r\n", coord->xcoord, coord->ycoord));
+ return NV_TRUE;
+}
+
+static void PANJIT_GpioIsr(void *arg)
+{
+ PANJIT_TouchDevice *hTouch = (PANJIT_TouchDevice *)arg;
+
+ /* Signal the touch thread to read the sample. After it is done reading the
+ * sample it should re-enable the interrupt. */
+ NvOdmOsSemaphoreSignal(hTouch->hIntSema);
+}
+
+NvBool
+PANJIT_ReadCoordinate(
+ NvOdmTouchDeviceHandle hDevice,
+ NvOdmTouchCoordinateInfo* coord)
+{
+ PANJIT_TouchDevice *hTouch = (PANJIT_TouchDevice *)hDevice;
+ NvBool status = NV_FALSE;
+ static NvU32 prevSamleTime;
+ NvU32 CurrentSampleTime;
+#if PANJIT_BENCHMARK_SAMPLE
+ NvU32 time;
+#endif
+ NvU32 pinValue;
+
+ NvOdmGpioGetState(hTouch->hGpio, hTouch->hPin, &pinValue);
+ if (pinValue != INT_PIN_ACTIVE_STATE)
+ return NV_FALSE;
+
+ CurrentSampleTime = NvOdmOsGetTimeMS();
+ if (prevSamleTime)
+ {
+ if ((1000/hTouch->SampleRate) > (CurrentSampleTime - prevSamleTime))
+ {
+ NvOsSleepMS((1000/hTouch->SampleRate) - (CurrentSampleTime - prevSamleTime));
+ }
+ }
+ prevSamleTime = CurrentSampleTime;
+
+#if PANJIT_BENCHMARK_SAMPLE
+ time = CurrentSampleTime;
+#endif
+
+ status = PANJIT_GetSample(hTouch, coord);
+
+#if PANJIT_BENCHMARK_SAMPLE
+ NvOdmOsDebugPrintf("Touch sample time %d\r\n", NvOdmOsGetTimeMS() - time);
+#endif
+ return status;
+}
+
+void
+PANJIT_GetCapabilities(
+ NvOdmTouchDeviceHandle hDevice,
+ NvOdmTouchCapabilities* pCapabilities)
+{
+ PANJIT_TouchDevice *hTouch = (PANJIT_TouchDevice *)hDevice;
+
+ if (hTouch && pCapabilities)
+ *pCapabilities = hTouch->Caps;
+}
+
+void PANJIT_Close (NvOdmTouchDeviceHandle hDevice)
+{
+ PANJIT_TouchDevice *hTouch = (PANJIT_TouchDevice *)hDevice;
+
+ if (hTouch)
+ {
+ if (hTouch->hGpio)
+ {
+ if (hTouch->hGpioIntr)
+ {
+ NvOdmGpioInterruptUnregister(hTouch->hGpio,
+ hTouch->hPin, hTouch->hGpioIntr);
+ hTouch->hGpioIntr = NULL;
+ }
+
+ if (hTouch->hPin)
+ {
+ NvOdmGpioReleasePinHandle(hTouch->hGpio, hTouch->hPin);
+ hTouch->hPin = NULL;
+ }
+
+ NvOdmGpioClose(hTouch->hGpio);
+ hTouch->hGpio = NULL;
+ }
+
+ if (hTouch->hOdmI2c)
+ {
+ NvOdmI2cClose(hTouch->hOdmI2c);
+ hTouch->hOdmI2c = NULL;
+ }
+
+ NvOdmOsFree(hTouch);
+ hTouch = NULL;
+ }
+}
+
+static void InitOdmTouch (NvOdmTouchDevice *pDev)
+{
+ if (pDev)
+ {
+ pDev->Close = PANJIT_Close;
+ pDev->GetCapabilities = PANJIT_GetCapabilities;
+ pDev->ReadCoordinate = PANJIT_ReadCoordinate;
+ pDev->EnableInterrupt = PANJIT_EnableInterrupt;
+ pDev->HandleInterrupt = PANJIT_HandleInterrupt;
+ pDev->GetSampleRate = PANJIT_GetSampleRate;
+ pDev->SetSampleRate = PANJIT_SetSampleRate;
+ pDev->PowerControl = PANJIT_PowerControl;
+ pDev->PowerOnOff = PANJIT_PowerOnOff;
+ pDev->GetCalibrationData = PANJIT_GetCalibrationData;
+ pDev->OutputDebugMessage = NV_TRUE;
+ }
+}
+
+NvBool PANJIT_Open(NvOdmTouchDeviceHandle *hDevice)
+{
+ PANJIT_TouchDevice *hTouch = NULL;
+ NvU32 i = 0;
+ NvU32 found = 0;
+ NvU32 GpioPort = 0;
+ NvU32 GpioPin = 0;
+ NvU32 I2cInstance = 0;
+ NvOdmIoModule IoModule = NvOdmIoModule_I2c;
+ const NvOdmPeripheralConnectivity *pConnectivity = NULL;
+
+ NVODMTOUCH_PRINTF(("NvOdm Touch : PANJIT_Open() \r\n"));
+
+ // allocate memory to be used for the handle
+ hTouch = NvOdmOsAlloc(sizeof(PANJIT_TouchDevice));
+ if (!hTouch)
+ return NV_FALSE;
+
+ NvOdmOsMemset(hTouch, 0, sizeof(PANJIT_TouchDevice));
+
+ /* set function pointers */
+ InitOdmTouch(&hTouch->OdmTouch);
+
+ // read the query database
+ pConnectivity = NvOdmPeripheralGetGuid(PANJIT_TOUCH_DEVICE_GUID);
+ if (!pConnectivity)
+ {
+ NVODMTOUCH_PRINTF(("NvOdm Touch : pConnectivity is NULL Error \r\n"));
+ goto fail;
+ }
+
+ if (pConnectivity->Class != NvOdmPeripheralClass_HCI)
+ {
+ NVODMTOUCH_PRINTF(("NvOdm Touch : didn't find any periperal\
+ in discovery query for touch device Error \r\n"));
+ goto fail;
+ }
+
+ for (i = 0; i < pConnectivity->NumAddress; i++)
+ {
+ switch (pConnectivity->AddressList[i].Interface)
+ {
+ case NvOdmIoModule_I2c:
+ case NvOdmIoModule_I2c_Pmu:
+ hTouch->DeviceAddr = pConnectivity->AddressList[i].Address;
+ I2cInstance = pConnectivity->AddressList[i].Instance;
+ found |= 1;
+ IoModule = pConnectivity->AddressList[i].Interface;
+ break;
+
+ case NvOdmIoModule_Gpio:
+ GpioPort = pConnectivity->AddressList[i].Instance;
+ GpioPin = pConnectivity->AddressList[i].Address;
+ found |= 2;
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ // see if we found the bus and GPIO used by the hardware
+ if ((found & 3) != 3)
+ {
+ NVODMTOUCH_PRINTF(("NvOdm Touch:peripheral connectivity problem \r\n"));
+ goto fail;
+ }
+
+ // allocate I2C instance
+ hTouch->hOdmI2c = NvOdmI2cOpen(IoModule, I2cInstance);
+ if (!hTouch->hOdmI2c)
+ {
+ NVODMTOUCH_PRINTF(("NvOdm Touch : NvOdmI2cOpen Error \r\n"));
+ goto fail;
+ }
+
+ // get the handle to the pin used as pen down interrupt
+ hTouch->hGpio = (NvOdmServicesGpioHandle)NvOdmGpioOpen();
+ if (!hTouch->hGpio)
+ {
+ NVODMTOUCH_PRINTF(("NvOdm Touch : NvOdmGpioOpen Error \r\n"));
+ goto fail;
+ }
+
+ hTouch->hPin = NvOdmGpioAcquirePinHandle(hTouch->hGpio, GpioPort, GpioPin);
+ if (!hTouch->hPin)
+ {
+ NVODMTOUCH_PRINTF(("NvOdm Touch : Couldn't get GPIO pin \r\n"));
+ goto fail;
+ }
+
+ NvOdmGpioConfig(hTouch->hGpio, hTouch->hPin, NvOdmGpioPinMode_InputData);
+
+ /* set default capabilities */
+ NvOdmOsMemcpy(&hTouch->Caps, &PANJIT_Capabilities,
+ sizeof(NvOdmTouchCapabilities));
+
+ /* set default I2C speed */
+ hTouch->I2cClockSpeedKHz = PANJIT_I2C_SPEED_KHZ;
+
+ /* set max positions */
+ hTouch->Caps.XMaxPosition = X_MAX;
+ hTouch->Caps.YMaxPosition = Y_MAX;
+
+ PANJIT_Configure(hTouch);
+
+ *hDevice = (NvOdmTouchDeviceHandle)hTouch;
+ return NV_TRUE;
+
+ fail:
+ PANJIT_Close((NvOdmTouchDeviceHandle)hTouch);
+ hTouch = NULL;
+ return NV_FALSE;
+}
+
+NvBool
+PANJIT_EnableInterrupt(
+ NvOdmTouchDeviceHandle hDevice,
+ NvOdmOsSemaphoreHandle hIntSema)
+{
+ PANJIT_TouchDevice *hTouch = (PANJIT_TouchDevice *)hDevice;
+
+ NV_ASSERT(hIntSema);
+
+ /* can only be initialized once */
+ if (hTouch->hGpioIntr || hTouch->hIntSema)
+ return NV_FALSE;
+
+ hTouch->hIntSema = hIntSema;
+
+ if (NvOdmGpioInterruptRegister(
+ hTouch->hGpio,
+ &hTouch->hGpioIntr,
+ hTouch->hPin,
+ NvOdmGpioPinMode_InputInterruptLow,
+ PANJIT_GpioIsr,
+ (void*)hTouch,
+ PANJIT_DEBOUNCE_TIME_MS) == NV_FALSE)
+ {
+ return NV_FALSE;
+ }
+
+ if (!hTouch->hGpioIntr)
+ return NV_FALSE;
+ return NV_TRUE;
+}
+
+NvBool PANJIT_HandleInterrupt(NvOdmTouchDeviceHandle hDevice)
+{
+ PANJIT_TouchDevice *hTouch = (PANJIT_TouchDevice *)hDevice;
+ NvU32 pinValue;
+
+ if (hTouch)
+ {
+ NvOdmGpioGetState(hTouch->hGpio, hTouch->hPin, &pinValue);
+ if (pinValue == INT_PIN_ACTIVE_STATE)
+ {
+ // Clear Interrupt.
+ PANJIT_ClearInterrupt(hTouch);
+ NvOdmGpioInterruptDone(hTouch->hGpioIntr);
+ return NV_TRUE;
+ }
+ }
+ return NV_FALSE;
+}
+
+NvBool
+PANJIT_GetSampleRate(
+ NvOdmTouchDeviceHandle hDevice,
+ NvOdmTouchSampleRate* pTouchSampleRate)
+{
+ if (pTouchSampleRate)
+ {
+ pTouchSampleRate->NvOdmTouchSampleRateHigh = SAMPLES_PER_SECOND;
+ pTouchSampleRate->NvOdmTouchSampleRateLow = SAMPLES_PER_SECOND;
+ pTouchSampleRate->NvOdmTouchCurrentSampleRate = 0; // 0 = low , 1 = high
+ }
+ return NV_TRUE;
+}
+
+NvBool PANJIT_SetSampleRate(NvOdmTouchDeviceHandle hDevice, NvU32 rate)
+{
+ PANJIT_TouchDevice *hTouch = (PANJIT_TouchDevice *)hDevice;
+
+ if (hTouch)
+ {
+ if (rate > SAMPLES_PER_SECOND)
+ hTouch->SampleRate = SAMPLES_PER_SECOND;
+ else
+ hTouch->SampleRate = rate;
+ }
+ return NV_TRUE;
+}
+
+NvBool
+PANJIT_PowerControl(
+ NvOdmTouchDeviceHandle hDevice,
+ NvOdmTouchPowerModeType mode)
+{
+ PANJIT_TouchDevice *hTouch = (PANJIT_TouchDevice *)hDevice;
+ NvU8 SleepMode;
+
+ switch(mode)
+ {
+ case NvOdmTouch_PowerMode_0:
+ SleepMode = SLEEP_MODE_NORMAL;
+ break;
+ case NvOdmTouch_PowerMode_1:
+ case NvOdmTouch_PowerMode_2:
+ case NvOdmTouch_PowerMode_3:
+ SleepMode = SLEEP_MODE_SENSOR_SLEEP;
+ break;
+ default:
+ return NV_FALSE;
+ }
+
+ if (hTouch->SleepMode == SleepMode)
+ return NV_TRUE;
+ hTouch->SleepMode = SleepMode;
+ return NV_TRUE;
+}
+
+NvBool
+PANJIT_GetCalibrationData(
+ NvOdmTouchDeviceHandle hDevice,
+ NvU32 NumOfCalibrationData,
+ NvS32* pRawCoordBuffer)
+{
+ static NvS32 RawCoordBuffer[] = {2048,2048,840,840,840,3330,3280,3330,3280,840};
+
+ if (!pRawCoordBuffer)
+ return NV_FALSE;
+
+ if (NumOfCalibrationData * 2 != (sizeof(RawCoordBuffer) / sizeof(NvS32)))
+ {
+ NVODMTOUCH_PRINTF(("WARNING: number of calibration data isn't matched\r\n"));
+ return NV_FALSE;
+ }
+
+ NvOdmOsMemcpy(pRawCoordBuffer, RawCoordBuffer, sizeof(RawCoordBuffer));
+ return NV_TRUE;
+}
+
+NvBool PANJIT_PowerOnOff(NvOdmTouchDeviceHandle hDevice, NvBool OnOff)
+{
+ if (!hDevice)
+ return NV_FALSE;
+
+ if (OnOff)
+ return PANJIT_PowerControl(hDevice, NvOdmTouch_PowerMode_0); // power ON
+ else
+ return PANJIT_PowerControl(hDevice, NvOdmTouch_PowerMode_3); // power OFF
+}
+
diff --git a/arch/arm/mach-tegra/odm_kit/platform/touch/nvodm_touch_panjit.h b/arch/arm/mach-tegra/odm_kit/platform/touch/nvodm_touch_panjit.h
new file mode 100644
index 000000000000..bfff86fe21ce
--- /dev/null
+++ b/arch/arm/mach-tegra/odm_kit/platform/touch/nvodm_touch_panjit.h
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2010 NVIDIA Corporation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * Neither the name of the NVIDIA Corporation nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef INCLUDED_NVODM_TOUCH_PANJIT_H
+#define INCLUDED_NVODM_TOUCH_PANJIT_H
+
+#include "nvodm_touch_int.h"
+#include "nvodm_services.h"
+
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
+typedef struct PANJIT_TouchDevice_Rec
+{
+ NvOdmTouchDevice OdmTouch;
+ NvOdmTouchCapabilities Caps;
+ NvOdmServicesI2cHandle hOdmI2c;
+ NvOdmServicesGpioHandle hGpio;
+ NvOdmServicesPmuHandle hPmu;
+ NvOdmGpioPinHandle hPin;
+ NvOdmServicesGpioIntrHandle hGpioIntr;
+ NvOdmOsSemaphoreHandle hIntSema;
+ NvU32 PrevFingers;
+ NvU32 DeviceAddr;
+ NvU32 SampleRate;
+ NvU32 SleepMode;
+ NvBool PowerOn;
+ NvU32 I2cClockSpeedKHz;
+} PANJIT_TouchDevice;
+
+/**
+ * Gets a handle to the touch pad in the system.
+ *
+ * @param hDevice A pointer to the handle of the touch pad.
+ * @return NV_TRUE if successful, or NV_FALSE otherwise.
+ */
+NvBool PANJIT_Open(NvOdmTouchDeviceHandle *hDevice);
+
+/**
+ * Releases the touch pad handle.
+ *
+ * @param hDevice The touch pad handle to be released. If
+ * NULL, this API has no effect.
+ */
+void PANJIT_Close(NvOdmTouchDeviceHandle hDevice);
+
+/**
+ * Gets capabilities for the specified touch device.
+ *
+ * @param hDevice The handle of the touch pad.
+ * @param pCapabilities A pointer to the targeted
+ * capabilities returned by the ODM.
+ */
+void
+PANJIT_GetCapabilities(
+ NvOdmTouchDeviceHandle hDevice,
+ NvOdmTouchCapabilities* pCapabilities);
+
+/**
+ * Gets coordinate info from the touch device.
+ *
+ * @param hDevice The handle to the touch pad.
+ * @param coord A pointer to the structure holding coordinate info.
+ * @return NV_TRUE if successful, or NV_FALSE otherwise.
+ */
+NvBool
+PANJIT_ReadCoordinate(
+ NvOdmTouchDeviceHandle hDevice,
+ NvOdmTouchCoordinateInfo *pCoord);
+
+/**
+ * Hooks up the interrupt handle to the GPIO interrupt and enables the interrupt.
+ *
+ * @param hDevice The handle to the touch pad.
+ * @param hInterruptSemaphore A handle to hook up the interrupt.
+ * @return NV_TRUE if successful, or NV_FALSE otherwise.
+ */
+NvBool
+PANJIT_EnableInterrupt(
+ NvOdmTouchDeviceHandle hDevice,
+ NvOdmOsSemaphoreHandle hInterruptSemaphore);
+
+/**
+ * Prepares the next interrupt to get notified from the touch device.
+ *
+ * @param hDevice A handle to the touch pad.
+ * @return NV_TRUE if successful, or NV_FALSE otherwise.
+ */
+NvBool PANJIT_HandleInterrupt(NvOdmTouchDeviceHandle hDevice);
+
+/**
+ * Gets the touch ADC sample rate.
+ *
+ * @param hDevice A handle to the touch ADC.
+ * @param pTouchSampleRate A pointer to the NvOdmTouchSampleRate stucture.
+ *
+ * @return NV_TRUE if successful, or NV_FALSE otherwise.
+*/
+NvBool
+PANJIT_GetSampleRate(
+ NvOdmTouchDeviceHandle hDevice,
+ NvOdmTouchSampleRate* pTouchSampleRate);
+
+/**
+ * Sets the touch ADC sample rate.
+ *
+ * @param hDevice A handle to the touch ADC.
+ * @param SampleRate 1 indicates high frequency, 0 indicates low frequency.
+ *
+ * @return NV_TRUE if successful, or NV_FALSE otherwise.
+*/
+NvBool PANJIT_SetSampleRate(NvOdmTouchDeviceHandle hDevice, NvU32 rate);
+
+/**
+ * Sets the touch panel power mode.
+ *
+ * @param hDevice A handle to the touch ADC.
+ * @param mode The mode, ranging from full power to power off.
+ *
+ * @return NV_TRUE if successful, or NV_FALSE otherwise.
+*/
+NvBool
+PANJIT_PowerControl(
+ NvOdmTouchDeviceHandle hDevice,
+ NvOdmTouchPowerModeType mode);
+
+/**
+ * Gets the touch panel calibration data.
+ * This is optional as calibration may perform after the OS is up.
+ * This is not required to bring up the touch panel.
+ *
+ * @param hDevice A handle to the touch panel.
+ * @param NumOfCalibrationData Indicates the number of calibration points.
+ * @param pRawCoordBuffer The collection of X/Y coordinate data.
+ *
+ * @return NV_TRUE if preset calibration data is required, or NV_FALSE otherwise.
+ */
+NvBool
+PANJIT_GetCalibrationData(
+ NvOdmTouchDeviceHandle hDevice,
+ NvU32 NumOfCalibrationData,
+ NvS32* pRawCoordBuffer);
+
+/**
+ * Powers the touch device on or off.
+ *
+ * @param hDevice A handle to the touch ADC.
+ * @param OnOff Specify 1 to power ON, 0 to power OFF.
+*/
+NvBool PANJIT_PowerOnOff(NvOdmTouchDeviceHandle hDevice, NvBool OnOff);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif // INCLUDED_NVODM_TOUCH_PANJIT_H
+
diff --git a/arch/arm/mach-tegra/odm_kit/query/harmony/subboards/nvodm_query_discovery_e1162_addresses.h b/arch/arm/mach-tegra/odm_kit/query/harmony/subboards/nvodm_query_discovery_e1162_addresses.h
index 337dc84ff048..000fd861577e 100755
--- a/arch/arm/mach-tegra/odm_kit/query/harmony/subboards/nvodm_query_discovery_e1162_addresses.h
+++ b/arch/arm/mach-tegra/odm_kit/query/harmony/subboards/nvodm_query_discovery_e1162_addresses.h
@@ -415,7 +415,14 @@ static const NvOdmIoAddress s_AudioCodecAddressesI2C_1[] =
// TouchPanel
static const NvOdmIoAddress s_TouchPanelAddresses[] =
{
- { NvOdmIoModule_I2c, 0x00, 0x28 }, /* I2C device address is 0x28 */
- { NvOdmIoModule_Gpio, (NvU32)'a'-'a', 0x00 }, /* GPIO Port A and Pin 0 */
+ { NvOdmIoModule_I2c_Pmu, 0x00, 0x06 }, /* I2C address (7-bit) 0x03<<1=0x06(8-bit) */
+ { NvOdmIoModule_Gpio, (NvU32)'d'-'a', 0x02 }, /* GPIO Port D and Pin 2 */
};
+static const NvOdmIoAddress s_AcceleroAddresses[] =
+{
+ { NvOdmIoModule_I2c_Pmu, 0x00, 0x70 }, /* I2C address (7-bit) 0x38<<1 = 0x70(8-bit) */
+ { NvOdmIoModule_Gpio, (NvU32)'c'-'a', 0x03 }, /* Gpio port C and Pin 3 */
+};
+
+
diff --git a/arch/arm/mach-tegra/odm_kit/query/harmony/subboards/nvodm_query_discovery_e1162_peripherals.h b/arch/arm/mach-tegra/odm_kit/query/harmony/subboards/nvodm_query_discovery_e1162_peripherals.h
index 1454ac7a96b3..df91cc1e6d22 100644
--- a/arch/arm/mach-tegra/odm_kit/query/harmony/subboards/nvodm_query_discovery_e1162_peripherals.h
+++ b/arch/arm/mach-tegra/odm_kit/query/harmony/subboards/nvodm_query_discovery_e1162_peripherals.h
@@ -436,9 +436,18 @@
// Touch panel
{
- NV_ODM_GUID('s','y','n','t','o','u','c','h'),
+ NV_ODM_GUID('p','a','n','j','i','t','_','0'),
s_TouchPanelAddresses,
NV_ARRAY_SIZE(s_TouchPanelAddresses),
NvOdmPeripheralClass_HCI
},
+
+// Accelerometer Module
+{
+ NV_ODM_GUID('b','m','a','1','5','0','a','c'),
+ s_AcceleroAddresses,
+ NV_ARRAY_SIZE(s_AcceleroAddresses),
+ NvOdmPeripheralClass_Other,
+},
+
// NOTE: This list *must* end with a trailing comma.
diff --git a/drivers/input/keyboard/tegra-gpio.c b/drivers/input/keyboard/tegra-gpio.c
index 7d44288216c4..ed4cd7219f28 100644
--- a/drivers/input/keyboard/tegra-gpio.c
+++ b/drivers/input/keyboard/tegra-gpio.c
@@ -53,9 +53,9 @@ struct nvgpio_key_info {
static struct nvgpio_key_info s_nvgpio_key_info[] = {
//port, pin, type, bounce, pin, intr, code
- {'c'-'a', 3, 0, 10, NULL, NULL, KEY_MENU},
- {'d'-'a', 3, 0, 10, NULL, NULL, KEY_HOME},
- {'d'-'a', 4, 0, 10, NULL, NULL, KEY_BACK}
+ {'q'-'a', 0, 0, 10, NULL, NULL, KEY_MENU},
+ {'q'-'a', 1, 0, 10, NULL, NULL, KEY_HOME},
+ {'q'-'a', 2, 0, 10, NULL, NULL, KEY_BACK}
};
static int s_num_pins = sizeof(s_nvgpio_key_info)/sizeof(s_nvgpio_key_info[0]);