summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/odm_kit/platform
diff options
context:
space:
mode:
authorSuresh Mangipudi <smangipudi@nvidia.com>2010-07-24 01:13:56 -0700
committerGary King <gking@nvidia.com>2010-07-26 15:24:17 -0700
commit76073198f9846a5510c48b72c13bc74a848edc10 (patch)
tree478431bf0562c8916c5108c79f29b2c5afddba2e /arch/arm/mach-tegra/odm_kit/platform
parent86ec9122a2a50dd4652c05f1090c0f01a4110a6c (diff)
[accelerometer]:Support on Ventana
removed the BoardID based identification, now use only Peripheral GUID for determining if the board supports accelerometer or not Change-Id: I95938ff4836cbb0bb8547e2d9684dfb534816bfc Reviewed-on: http://git-master/r/4031 Tested-by: Suresh Mangipudi <smangipudi@nvidia.com> Reviewed-by: Gary King <gking@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/odm_kit/platform')
-rwxr-xr-xarch/arm/mach-tegra/odm_kit/platform/accelerometer/nvodm_accelerometer_kxtf9.c61
1 files changed, 27 insertions, 34 deletions
diff --git a/arch/arm/mach-tegra/odm_kit/platform/accelerometer/nvodm_accelerometer_kxtf9.c b/arch/arm/mach-tegra/odm_kit/platform/accelerometer/nvodm_accelerometer_kxtf9.c
index 8cfd05bff32d..a1775b4f3e38 100755
--- a/arch/arm/mach-tegra/odm_kit/platform/accelerometer/nvodm_accelerometer_kxtf9.c
+++ b/arch/arm/mach-tegra/odm_kit/platform/accelerometer/nvodm_accelerometer_kxtf9.c
@@ -96,19 +96,29 @@
// I2C clock speed.
#define I2C_CLK_SPEED 400
-#define ACCEL_TANGO_GUID NV_ODM_GUID('k','x','t','f','9','t','n','g')
-#define ACCEL_VENTANA_GUID NV_ODM_GUID('k','x','t','f','9','v','n','t')
-#define EEPROM_ID_E1206 0x0C06
+#define ACCEL_VER0_GUID NV_ODM_GUID('k','x','t','9','-','0','0','0')
+#define ACCEL_VER1_GUID NV_ODM_GUID('k','x','t','9','-','0','9','0')
+
#define NV_DEBOUNCE_TIME_MS 0
#define ENABLE_XYZ_POLLING 0
-#define kxtf9_GUID NV_ODM_GUID('k','x','t','f','9','-','4','0')
-
static NvU8 s_ReadBuffer[I2C_ACCELRATOR_PACKET_SIZE];
static NvU8 s_WriteBuffer[I2C_ACCELRATOR_PACKET_SIZE];
static NvU8 s_IntSrcReg1;
static NvU8 s_IntSrcReg2;
+typedef struct discovery_entry_rec
+{
+ NvU64 guid;
+ NvU32 axesmapping;
+} discovery_entry;
+
+static discovery_entry disc_entry[] = {
+ {ACCEL_VER0_GUID, 1},
+ {ACCEL_VER1_GUID, 2},
+};
+
+
static void
ConfigPowerRail(
NvOdmServicesPmuHandle hPMUDevice,
@@ -776,13 +786,7 @@ NvBool kxtf9_init(NvOdmAccelHandle* hDevice)
NvOdmIoModule IoModule = NvOdmIoModule_I2c;
const NvOdmPeripheralConnectivity *pConnectivity;
NvBool FoundGpio = NV_FALSE, FoundI2cModule = NV_FALSE;
- NvOdmBoardInfo BoardInfo;
- // Accelerometer is supported only on E1206.
- if (!NvOdmPeripheralGetBoardInfo(EEPROM_ID_E1206, &BoardInfo))
- {
- NVODMACCELEROMETER_PRINTF(("\nkxtf9: Accelerometer not supported"));
- return NV_FALSE;
- }
+ NvU32 AxesMapping = 0;
hAccel = NvOdmOsAlloc(sizeof(NvOdmAccel));
if (hAccel == NULL)
{
@@ -805,15 +809,20 @@ NvBool kxtf9_init(NvOdmAccelHandle* hDevice)
NVODMACCELEROMETER_PRINTF(("kxtf9 NvOdmServicesPmuOpen Error \n"));
goto error;
}
-
- pConnectivity = NvOdmPeripheralGetGuid(ACCEL_TANGO_GUID);
- if (!pConnectivity)
+ for ( i = 0 ; i < NV_ARRAY_SIZE(disc_entry); ++i )
{
- NVODMACCELEROMETER_PRINTF(("\nkxtf9: GetGuid Failed for Tango"));
+ pConnectivity = NvOdmPeripheralGetGuid(disc_entry[i].guid);
+ if (pConnectivity)
+ {
+ AxesMapping = disc_entry[i].axesmapping;
+ break;
+ }
}
- else
+ if (!pConnectivity)
+ goto error;
+
+ if (AxesMapping == 1)
{
- #if AXES_MAPPING_FOR_PROPER_DISPLAY_ALIGNMENT
// Axes mapping for display orientation aligning correctly in 3 orientations
// (0, 90 & 270 degrees) on Tango with (froyo + K32).
hAccel->AxisXMapping = NvOdmAccelAxis_Y;
@@ -822,22 +831,6 @@ NvBool kxtf9_init(NvOdmAccelHandle* hDevice)
hAccel->AxisYDirection = -1;
hAccel->AxisZMapping = NvOdmAccelAxis_Z;
hAccel->AxisZDirection = -1;
- #else
- // Axes mapping for matching acceleration on all axes with android mobile phones
- hAccel->AxisXMapping = NvOdmAccelAxis_X;
- hAccel->AxisXDirection = -1;
- hAccel->AxisYMapping = NvOdmAccelAxis_Y;
- hAccel->AxisYDirection = -1;
- hAccel->AxisZMapping = NvOdmAccelAxis_Z;
- hAccel->AxisZDirection = -1;
- #endif
- }
-
- pConnectivity = NvOdmPeripheralGetGuid(ACCEL_VENTANA_GUID);
- if (!pConnectivity)
- {
- NVODMACCELEROMETER_PRINTF(("\nkxtf9: GetGuid Failed for Ventana"));
- goto error;
}
else
{