diff options
author | Russell King <rmk+kernel@armlinux.org.uk> | 2016-08-31 08:49:45 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@armlinux.org.uk> | 2016-09-22 09:38:58 +0100 |
commit | 7bfe49785b28931297d9e6e811f88732914f8ff3 (patch) | |
tree | 9afa3a81916653b407cec0ab4380cf396a24f849 /drivers/pcmcia/soc_common.c | |
parent | a4941191235e0fee2dd8bad3b7c61478f229c962 (diff) | |
download | linux-stable-7bfe49785b28931297d9e6e811f88732914f8ff3.tar.gz linux-stable-7bfe49785b28931297d9e6e811f88732914f8ff3.tar.bz2 linux-stable-7bfe49785b28931297d9e6e811f88732914f8ff3.zip |
pcmcia: soc_common: request legacy detect GPIO with active low
Request the legacy card detect signal with the active low property and
remove our own negation of the detection value. This allows us to use
the firmware-defined polarities rather than hard-coding it into the
driver.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Diffstat (limited to 'drivers/pcmcia/soc_common.c')
-rw-r--r-- | drivers/pcmcia/soc_common.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index e499c2b8d7df..4036454b2785 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c @@ -165,8 +165,14 @@ static int soc_pcmcia_hw_init(struct soc_pcmcia_socket *skt) for (i = 0; i < ARRAY_SIZE(skt->stat); i++) { if (gpio_is_valid(skt->stat[i].gpio)) { + unsigned long flags = GPIOF_IN; + + /* CD is active low by default */ + if (i == SOC_STAT_CD) + flags |= GPIOF_ACTIVE_LOW; + ret = devm_gpio_request_one(skt->socket.dev.parent, - skt->stat[i].gpio, GPIOF_IN, + skt->stat[i].gpio, flags, skt->stat[i].name); if (ret) { __soc_pcmcia_hw_shutdown(skt, i); @@ -233,11 +239,8 @@ static unsigned int soc_common_pcmcia_skt_state(struct soc_pcmcia_socket *skt) state.bvd1 = 1; state.bvd2 = 1; - /* CD is active low by default */ if (skt->stat[SOC_STAT_CD].desc) - state.detect = !gpiod_get_raw_value(skt->stat[SOC_STAT_CD].desc); - - /* RDY and BVD are active high by default */ + state.detect = !!gpiod_get_value(skt->stat[SOC_STAT_CD].desc); if (skt->stat[SOC_STAT_RDY].desc) state.ready = !!gpiod_get_value(skt->stat[SOC_STAT_RDY].desc); if (skt->stat[SOC_STAT_BVD1].desc) |