forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gpio: tegra: Fix offset of pinctrl calls
This patch hunk is a lightly modified version of a diff found in a Tegra code dump from a product tree. It makes a lot of sense because this is what most drivers do. Cc: Thierry Reding <[email protected]> Cc: Stefan Agner <[email protected]> Cc: Dmitry Osipenko <[email protected]> Cc: Jon Hunter <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
- Loading branch information
Showing
1 changed file
with
21 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
* arch/arm/mach-tegra/gpio.c | ||
* | ||
* Copyright (c) 2010 Google, Inc | ||
* Copyright (c) 2011-2016, NVIDIA CORPORATION. All rights reserved. | ||
* | ||
* Author: | ||
* Erik Gilling <[email protected]> | ||
|
@@ -141,14 +142,14 @@ static void tegra_gpio_disable(struct tegra_gpio_info *tgi, unsigned int gpio) | |
|
||
static int tegra_gpio_request(struct gpio_chip *chip, unsigned int offset) | ||
{ | ||
return pinctrl_gpio_request(offset); | ||
return pinctrl_gpio_request(chip->base + offset); | ||
} | ||
|
||
static void tegra_gpio_free(struct gpio_chip *chip, unsigned int offset) | ||
{ | ||
struct tegra_gpio_info *tgi = gpiochip_get_data(chip); | ||
|
||
pinctrl_gpio_free(offset); | ||
pinctrl_gpio_free(chip->base + offset); | ||
tegra_gpio_disable(tgi, offset); | ||
} | ||
|
||
|
@@ -176,22 +177,38 @@ static int tegra_gpio_direction_input(struct gpio_chip *chip, | |
unsigned int offset) | ||
{ | ||
struct tegra_gpio_info *tgi = gpiochip_get_data(chip); | ||
int ret; | ||
|
||
tegra_gpio_mask_write(tgi, GPIO_MSK_OE(tgi, offset), offset, 0); | ||
tegra_gpio_enable(tgi, offset); | ||
return 0; | ||
|
||
ret = pinctrl_gpio_direction_input(chip->base + offset); | ||
if (ret < 0) | ||
dev_err(tgi->dev, | ||
"Failed to set pinctrl input direction of GPIO %d: %d", | ||
chip->base + offset, ret); | ||
|
||
return ret; | ||
} | ||
|
||
static int tegra_gpio_direction_output(struct gpio_chip *chip, | ||
unsigned int offset, | ||
int value) | ||
{ | ||
struct tegra_gpio_info *tgi = gpiochip_get_data(chip); | ||
int ret; | ||
|
||
tegra_gpio_set(chip, offset, value); | ||
tegra_gpio_mask_write(tgi, GPIO_MSK_OE(tgi, offset), offset, 1); | ||
tegra_gpio_enable(tgi, offset); | ||
return 0; | ||
|
||
ret = pinctrl_gpio_direction_output(chip->base + offset); | ||
if (ret < 0) | ||
dev_err(tgi->dev, | ||
"Failed to set pinctrl output direction of GPIO %d: %d", | ||
chip->base + offset, ret); | ||
|
||
return ret; | ||
} | ||
|
||
static int tegra_gpio_get_direction(struct gpio_chip *chip, | ||
|