Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: sdhci-tegra: convert to use GPIO descriptors

Modify the driver to handle GPIOs using the descriptor API.

Signed-off-by: Mylene JOSSERAND <josserand.mylene@gmail.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Tested-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

authored by

Mylene JOSSERAND and committed by
Ulf Hansson
2391b340 e03de745

+8 -24
+8 -24
drivers/mmc/host/sdhci-tegra.c
··· 20 20 #include <linux/io.h> 21 21 #include <linux/of.h> 22 22 #include <linux/of_device.h> 23 - #include <linux/of_gpio.h> 24 - #include <linux/gpio.h> 25 23 #include <linux/mmc/card.h> 26 24 #include <linux/mmc/host.h> 27 25 #include <linux/mmc/slot-gpio.h> 26 + #include <linux/gpio/consumer.h> 28 27 29 28 #include "sdhci-pltfm.h" 30 29 ··· 48 49 49 50 struct sdhci_tegra { 50 51 const struct sdhci_tegra_soc_data *soc_data; 51 - int power_gpio; 52 + struct gpio_desc *power_gpio; 52 53 }; 53 54 54 55 static u16 tegra_sdhci_readw(struct sdhci_host *host, int reg) ··· 245 246 }; 246 247 MODULE_DEVICE_TABLE(of, sdhci_tegra_dt_match); 247 248 248 - static int sdhci_tegra_parse_dt(struct device *dev) 249 - { 250 - struct device_node *np = dev->of_node; 251 - struct sdhci_host *host = dev_get_drvdata(dev); 252 - struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); 253 - struct sdhci_tegra *tegra_host = pltfm_host->priv; 254 - 255 - tegra_host->power_gpio = of_get_named_gpio(np, "power-gpios", 0); 256 - return mmc_of_parse(host->mmc); 257 - } 258 - 259 249 static int sdhci_tegra_probe(struct platform_device *pdev) 260 250 { 261 251 const struct of_device_id *match; ··· 274 286 tegra_host->soc_data = soc_data; 275 287 pltfm_host->priv = tegra_host; 276 288 277 - rc = sdhci_tegra_parse_dt(&pdev->dev); 289 + rc = mmc_of_parse(host->mmc); 278 290 if (rc) 279 291 goto err_parse_dt; 280 292 281 - if (gpio_is_valid(tegra_host->power_gpio)) { 282 - rc = devm_gpio_request(&pdev->dev, tegra_host->power_gpio, 283 - "sdhci_power"); 284 - if (rc) { 285 - dev_err(mmc_dev(host->mmc), 286 - "failed to allocate power gpio\n"); 287 - goto err_power_req; 288 - } 289 - gpio_direction_output(tegra_host->power_gpio, 1); 293 + tegra_host->power_gpio = devm_gpiod_get_optional(&pdev->dev, "power", 294 + GPIOD_OUT_HIGH); 295 + if (IS_ERR(tegra_host->power_gpio)) { 296 + rc = PTR_ERR(tegra_host->power_gpio); 297 + goto err_power_req; 290 298 } 291 299 292 300 clk = devm_clk_get(mmc_dev(host->mmc), NULL);