1 /* linux/arch/arm/mach-msm/pwrtest.c
3 * * Copyright (C) 2009 HTC Corporation.
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #include <linux/gpio.h>
18 #include "proc_comm.h"
32 typedef struct _tagSUSPEND_PIN_CONFIG
{
33 unsigned char arGpio
[200]; /* the maximum should be 1024 bytes */
34 } SUSPEND_PIN_CONFIG
, *PSUSPEND_PIN_CONFIG
;
36 void gpio_set_diag_gpio_table(unsigned long * dwMFG_gpio_table
)
40 PSUSPEND_PIN_CONFIG pSuspendPinConfig
= 0;
42 pSuspendPinConfig
= (PSUSPEND_PIN_CONFIG
)(dwMFG_gpio_table
);
43 #if defined(CONFIG_ARCH_MSM7X00A)
44 for (i
= 0; i
<= 121; i
++)
45 #elif defined(CONFIG_ARCH_MSM7225)
46 for (i
= 0; i
< 132; i
++)
47 #elif defined(CONFIG_ARCH_MSM7227)
48 for (i
= 0; i
< 132; i
++)
49 #elif defined(CONFIG_ARCH_QSD8X50)
50 for (i
= 0; i
<= 164; i
++)
51 #elif defined(CONFIG_ARCH_MSM7X30)
52 for (i
= 0; i
<= 181; i
++)
55 unsigned char tempGpio
= pSuspendPinConfig
->arGpio
[i
];
58 /* configure by the settings from DIAG */
59 unsigned long dwGpioKind
, dwGpioConfig
, dwOutputLevel
;
60 if(tempGpio
& 0x2) { /* GPIO INPUT PIN */
61 dwGpioKind
= GPIO_INPUT
;
63 } else { /* GPIO_OUTPUT_PIN */
64 dwGpioKind
= GPIO_OUTPUT
;
71 // config GpioPullStatus
72 if ((tempGpio
& 0x10) && (tempGpio
& 0x08))
73 dwGpioConfig
= GPIO_PULL_UP
;
74 else if (tempGpio
& 0x08)
75 dwGpioConfig
= GPIO_PULL_DOWN
;
76 else if (tempGpio
& 0x10)
77 dwGpioConfig
= GPIO_KEEPER
;
79 dwGpioConfig
= GPIO_NO_PULL
;
81 cfg
= PCOM_GPIO_CFG(i
, 0, dwGpioKind
, dwGpioConfig
, GPIO_2MA
);
83 msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX
, &cfg
, 0);
85 if (dwGpioKind
== GPIO_OUTPUT
)
86 gpio_direction_output(i
, dwOutputLevel
);
88 /* DIAG does not want to config this GPIO */
93 EXPORT_SYMBOL(gpio_set_diag_gpio_table
);