Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torvalds/linux.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mmc/host/pxamci.c')
-rw-r--r--drivers/mmc/host/pxamci.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c
index a8b6c14f2687..8779bbaa6b69 100644
--- a/drivers/mmc/host/pxamci.c
+++ b/drivers/mmc/host/pxamci.c
@@ -30,7 +30,7 @@
#include <linux/mmc/slot-gpio.h>
#include <linux/io.h>
#include <linux/regulator/consumer.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/gfp.h>
#include <linux/of.h>
#include <linux/of_device.h>
@@ -63,6 +63,7 @@ struct pxamci_host {
unsigned int power_mode;
unsigned long detect_delay_ms;
bool use_ro_gpio;
+ struct gpio_desc *power;
struct pxamci_platform_data *pdata;
struct mmc_request *mrq;
@@ -101,16 +102,13 @@ static inline int pxamci_set_power(struct pxamci_host *host,
{
struct mmc_host *mmc = host->mmc;
struct regulator *supply = mmc->supply.vmmc;
- int on;
if (!IS_ERR(supply))
return mmc_regulator_set_ocr(mmc, supply, vdd);
- if (host->pdata &&
- gpio_is_valid(host->pdata->gpio_power)) {
- on = ((1 << vdd) & host->pdata->ocr_mask);
- gpio_set_value(host->pdata->gpio_power,
- !!on ^ host->pdata->gpio_power_invert);
+ if (host->power) {
+ bool on = !!((1 << vdd) & host->pdata->ocr_mask);
+ gpiod_set_value(host->power, on);
}
if (host->pdata && host->pdata->setpower)
@@ -730,21 +728,12 @@ static int pxamci_probe(struct platform_device *pdev)
}
if (host->pdata) {
- int gpio_power = host->pdata->gpio_power;
-
host->detect_delay_ms = host->pdata->detect_delay_ms;
- if (gpio_is_valid(gpio_power)) {
- ret = devm_gpio_request(dev, gpio_power,
- "mmc card power");
- if (ret) {
- dev_err(dev,
- "Failed requesting gpio_power %d\n",
- gpio_power);
- goto out;
- }
- gpio_direction_output(gpio_power,
- host->pdata->gpio_power_invert);
+ host->power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW);
+ if (IS_ERR(host->power)) {
+ dev_err(dev, "Failed requesting gpio_power\n");
+ goto out;
}
/* FIXME: should we pass detection delay to debounce? */
@@ -768,7 +757,7 @@ static int pxamci_probe(struct platform_device *pdev)
if (host->pdata->init)
host->pdata->init(dev, pxamci_detect_irq, mmc);
- if (gpio_is_valid(gpio_power) && host->pdata->setpower)
+ if (host->power && host->pdata->setpower)
dev_warn(dev, "gpio_power and setpower() both defined\n");
if (host->use_ro_gpio && host->pdata->get_ro)
dev_warn(dev, "gpio_ro and get_ro() both defined\n");