Skip to content

Commit

Permalink
pcmcia: soc_common: add support for voltage sense GPIOs
Browse files Browse the repository at this point in the history
Add support for the voltage sense GPIOs which are wired up on some
platforms.

Signed-off-by: Russell King <[email protected]>
  • Loading branch information
Russell King committed Sep 22, 2016
1 parent c8f9ce5 commit 5805271
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion drivers/pcmcia/soc_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ static int soc_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
skt->stat[i].desc = gpio_to_desc(skt->stat[i].gpio);
}

if (skt->stat[i].desc) {
if (i < SOC_STAT_VS1 && skt->stat[i].desc) {
int irq = gpiod_to_irq(skt->stat[i].desc);

if (irq > 0) {
Expand Down Expand Up @@ -295,6 +295,10 @@ static unsigned int soc_common_pcmcia_skt_state(struct soc_pcmcia_socket *skt)
state.bvd1 = !!gpiod_get_value(skt->stat[SOC_STAT_BVD1].desc);
if (skt->stat[SOC_STAT_BVD2].desc)
state.bvd2 = !!gpiod_get_value(skt->stat[SOC_STAT_BVD2].desc);
if (skt->stat[SOC_STAT_VS1].desc)
state.vs_3v = !!gpiod_get_value(skt->stat[SOC_STAT_VS1].desc);
if (skt->stat[SOC_STAT_VS2].desc)
state.vs_Xv = !!gpiod_get_value(skt->stat[SOC_STAT_VS2].desc);

skt->ops->socket_state(skt, &state);

Expand Down
4 changes: 3 additions & 1 deletion drivers/pcmcia/soc_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ struct soc_pcmcia_socket {
struct gpio_desc *desc;
unsigned int irq;
const char *name;
} stat[4];
} stat[6];
#define SOC_STAT_CD 0 /* Card detect */
#define SOC_STAT_BVD1 1 /* BATDEAD / IOSTSCHG */
#define SOC_STAT_BVD2 2 /* BATWARN / IOSPKR */
#define SOC_STAT_RDY 3 /* Ready / Interrupt */
#define SOC_STAT_VS1 4 /* Voltage sense 1 */
#define SOC_STAT_VS2 5 /* Voltage sense 2 */

struct gpio_desc *gpio_reset;
struct gpio_desc *gpio_bus_enable;
Expand Down

0 comments on commit 5805271

Please sign in to comment.