From: <mar...@us...> - 2007-06-14 16:04:47
|
Revision: 1036 http://svn.sourceforge.net/hackndev/?rev=1036&view=rev Author: marex_z71 Date: 2007-06-14 09:03:49 -0700 (Thu, 14 Jun 2007) Log Message: ----------- PalmTC: corrected GPIO functions Modified Paths: -------------- linux4palm/linux/trunk/drivers/input/touchscreen/palmtc_ts.c linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmtc-gpio.h Modified: linux4palm/linux/trunk/drivers/input/touchscreen/palmtc_ts.c =================================================================== --- linux4palm/linux/trunk/drivers/input/touchscreen/palmtc_ts.c 2007-06-14 15:47:55 UTC (rev 1035) +++ linux4palm/linux/trunk/drivers/input/touchscreen/palmtc_ts.c 2007-06-14 16:03:49 UTC (rev 1036) @@ -459,8 +459,8 @@ int ucb1400_battery_get_status(struct battery *b) { - int ac_connected = gpio_get_value(GPIO_NR_PALMTC_POWER_DETECT); - int usb_connected = !gpio_get_value(GPIO_NR_PALMTC_USB_DETECT); + int ac_connected = !(gpio_get_value(GPIO_NR_PALMTC_CRADLE_DETECT_N)); + int usb_connected = gpio_get_value(GPIO_NR_PALMTC_USB_DETECT); ucb1400_adc_enable(bat.ucb); if (ucb1400_adc_read(bat.ucb, UCB_ADC_INP_AD0) <= 0) Modified: linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmtc-gpio.h =================================================================== --- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmtc-gpio.h 2007-06-14 15:47:55 UTC (rev 1035) +++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmtc-gpio.h 2007-06-14 16:03:49 UTC (rev 1036) @@ -12,15 +12,55 @@ /* Palm Tungsten C GPIOs */ #define GPIO_NR_PALMTC_EARPHONE_DETECT 2 -#define GPIO_NR_PALMTC_USB_DETECT 4 -#define GPIO_NR_PALMTC_POWER_DETECT 5 +#define GPIO_NR_PALMTC_CRADLE_DETECT_N 4 +#define GPIO_NR_PALMTC_USB_DETECT 5 #define GPIO_NR_PALMTC_HOTSYNC_BUTTON 7 #define GPIO_NR_PALMTC_SD_DETECT 12 // low->high when out, high->low when inserted #define GPIO_NR_PALMTC_BL_POWER 16 +#define GPIO_NR_PALMTC_USB_POWER 36 //#define GPIO_NR_PALMLD_STD_RXD 46 /* IRDA */ //#define GPIO_NR_PALMLD_STD_TXD 47 #define IRQ_GPIO_PALMTC_SD_DETECT IRQ_GPIO(GPIO_NR_PALMTC_SD_DETECT) +/* Utility macros */ + +#define GET_PALMTC_GPIO(gpio) \ + (GPLR(GPIO_NR_PALMTC_ ## gpio) & GPIO_bit(GPIO_NR_PALMTC_ ## gpio)) + +#define SET_PALMTC_GPIO(gpio, setp) \ + do { \ + if (setp) \ + GPSR(GPIO_NR_PALMTC_ ## gpio) = GPIO_bit(GPIO_NR_PALMTC_ ## gpio); \ + else \ + GPCR(GPIO_NR_PALMTC_ ## gpio) = GPIO_bit(GPIO_NR_PALMTC_ ## gpio); \ + } while (0) + +#define SET_PALMTC_GPIO_N(gpio, setp) \ + do { \ + if (setp) \ + GPCR(GPIO_NR_PALMTC_ ## gpio) = GPIO_bit(GPIO_NR_PALMTC_ ## gpio); \ + else \ + GPSR(GPIO_NR_PALMTC_ ## gpio) = GPIO_bit(GPIO_NR_PALMTC_ ## gpio); \ + } while (0) + +#define GET_GPIO(gpio) (GPLR(gpio) & GPIO_bit(gpio)) + +#define SET_GPIO(gpio, setp) \ + do { \ + if (setp) \ + GPSR(gpio) = GPIO_bit(gpio); \ + else \ + GPCR(gpio) = GPIO_bit(gpio); \ + } while (0) + +#define SET_GPIO_N(gpio, setp) \ + do { \ + if (setp) \ + GPCR(gpio) = GPIO_bit(gpio); \ + else \ + GPSR(gpio) = GPIO_bit(gpio); \ + } while (0) + #endif /* _PALMTC_GPIO_H_ */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |