Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 373839
b: refs/heads/master
c: dc3465a
h: refs/heads/master
i:
  373837: 01e73a5
  373835: 0e8920b
  373831: 38ff549
  373823: 3d74d7a
v: v3
  • Loading branch information
Laurent Pinchart authored and Simon Horman committed Apr 3, 2013
1 parent cea0723 commit 98751b6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 119f5e448d32c11faf22fe81f6f2d78467a47149
refs/heads/master: dc3465a943ed2dd5de37d3d60df5c4e11c49efcb
23 changes: 23 additions & 0 deletions trunk/drivers/gpio/gpio-rcar.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/module.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_data/gpio-rcar.h>
#include <linux/platform_device.h>
#include <linux/spinlock.h>
Expand Down Expand Up @@ -190,6 +191,21 @@ static void gpio_rcar_config_general_input_output_mode(struct gpio_chip *chip,
spin_unlock_irqrestore(&p->lock, flags);
}

static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset)
{
return pinctrl_request_gpio(chip->base + offset);
}

static void gpio_rcar_free(struct gpio_chip *chip, unsigned offset)
{
pinctrl_free_gpio(chip->base + offset);

/* Set the GPIO as an input to ensure that the next GPIO request won't
* drive the GPIO pin as an output.
*/
gpio_rcar_config_general_input_output_mode(chip, offset, false);
}

static int gpio_rcar_direction_input(struct gpio_chip *chip, unsigned offset)
{
gpio_rcar_config_general_input_output_mode(chip, offset, false);
Expand Down Expand Up @@ -285,6 +301,8 @@ static int gpio_rcar_probe(struct platform_device *pdev)
}

gpio_chip = &p->gpio_chip;
gpio_chip->request = gpio_rcar_request;
gpio_chip->free = gpio_rcar_free;
gpio_chip->direction_input = gpio_rcar_direction_input;
gpio_chip->get = gpio_rcar_get;
gpio_chip->direction_output = gpio_rcar_direction_output;
Expand Down Expand Up @@ -337,6 +355,11 @@ static int gpio_rcar_probe(struct platform_device *pdev)
p->config.irq_base, ret);
}

ret = gpiochip_add_pin_range(gpio_chip, p->config.pctl_name, 0,
gpio_chip->base, gpio_chip->ngpio);
if (ret < 0)
dev_warn(&pdev->dev, "failed to add pin range\n");

return 0;

err1:
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/platform_data/gpio-rcar.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct gpio_rcar_config {
unsigned int gpio_base;
unsigned int irq_base;
unsigned int number_of_pins;
const char *pctl_name;
};

#endif /* __GPIO_RCAR_H__ */

0 comments on commit 98751b6

Please sign in to comment.