summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/nomadik
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pinctrl/nomadik')
-rw-r--r--drivers/pinctrl/nomadik/pinctrl-abx500.c39
-rw-r--r--drivers/pinctrl/nomadik/pinctrl-nomadik.c33
2 files changed, 30 insertions, 42 deletions
diff --git a/drivers/pinctrl/nomadik/pinctrl-abx500.c b/drivers/pinctrl/nomadik/pinctrl-abx500.c
index b59fbb4b1..1f7469c98 100644
--- a/drivers/pinctrl/nomadik/pinctrl-abx500.c
+++ b/drivers/pinctrl/nomadik/pinctrl-abx500.c
@@ -109,19 +109,10 @@ struct abx500_pinctrl {
int irq_cluster_size;
};
-/**
- * to_abx500_pinctrl() - get the pointer to abx500_pinctrl
- * @chip: Member of the structure abx500_pinctrl
- */
-static inline struct abx500_pinctrl *to_abx500_pinctrl(struct gpio_chip *chip)
-{
- return container_of(chip, struct abx500_pinctrl, chip);
-}
-
static int abx500_gpio_get_bit(struct gpio_chip *chip, u8 reg,
unsigned offset, bool *bit)
{
- struct abx500_pinctrl *pct = to_abx500_pinctrl(chip);
+ struct abx500_pinctrl *pct = gpiochip_get_data(chip);
u8 pos = offset % 8;
u8 val;
int ret;
@@ -143,7 +134,7 @@ static int abx500_gpio_get_bit(struct gpio_chip *chip, u8 reg,
static int abx500_gpio_set_bits(struct gpio_chip *chip, u8 reg,
unsigned offset, int val)
{
- struct abx500_pinctrl *pct = to_abx500_pinctrl(chip);
+ struct abx500_pinctrl *pct = gpiochip_get_data(chip);
u8 pos = offset % 8;
int ret;
@@ -164,7 +155,7 @@ static int abx500_gpio_set_bits(struct gpio_chip *chip, u8 reg,
*/
static int abx500_gpio_get(struct gpio_chip *chip, unsigned offset)
{
- struct abx500_pinctrl *pct = to_abx500_pinctrl(chip);
+ struct abx500_pinctrl *pct = gpiochip_get_data(chip);
bool bit;
bool is_out;
u8 gpio_offset = offset - 1;
@@ -192,7 +183,7 @@ out:
static void abx500_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
{
- struct abx500_pinctrl *pct = to_abx500_pinctrl(chip);
+ struct abx500_pinctrl *pct = gpiochip_get_data(chip);
int ret;
ret = abx500_gpio_set_bits(chip, AB8500_GPIO_OUT1_REG, offset, val);
@@ -200,6 +191,7 @@ static void abx500_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
dev_err(pct->dev, "%s write failed (%d)\n", __func__, ret);
}
+#ifdef CONFIG_DEBUG_FS
static int abx500_get_pull_updown(struct abx500_pinctrl *pct, int offset,
enum abx500_gpio_pull_updown *pull_updown)
{
@@ -235,6 +227,7 @@ out:
return ret;
}
+#endif
static int abx500_set_pull_updown(struct abx500_pinctrl *pct,
int offset, enum abx500_gpio_pull_updown val)
@@ -272,7 +265,7 @@ out:
static bool abx500_pullud_supported(struct gpio_chip *chip, unsigned gpio)
{
- struct abx500_pinctrl *pct = to_abx500_pinctrl(chip);
+ struct abx500_pinctrl *pct = gpiochip_get_data(chip);
struct pullud *pullud = pct->soc->pullud;
return (pullud &&
@@ -284,7 +277,7 @@ static int abx500_gpio_direction_output(struct gpio_chip *chip,
unsigned offset,
int val)
{
- struct abx500_pinctrl *pct = to_abx500_pinctrl(chip);
+ struct abx500_pinctrl *pct = gpiochip_get_data(chip);
unsigned gpio;
int ret;
@@ -332,7 +325,7 @@ static int abx500_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
static int abx500_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
{
- struct abx500_pinctrl *pct = to_abx500_pinctrl(chip);
+ struct abx500_pinctrl *pct = gpiochip_get_data(chip);
/* The AB8500 GPIO numbers are off by one */
int gpio = offset + 1;
int hwirq;
@@ -477,6 +470,7 @@ out:
return ret;
}
+#ifdef CONFIG_DEBUG_FS
static int abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
unsigned gpio)
{
@@ -562,8 +556,6 @@ out:
return ret;
}
-#ifdef CONFIG_DEBUG_FS
-
#include <linux/seq_file.h>
static void abx500_gpio_dbg_show_one(struct seq_file *s,
@@ -634,7 +626,7 @@ static void abx500_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
{
unsigned i;
unsigned gpio = chip->base;
- struct abx500_pinctrl *pct = to_abx500_pinctrl(chip);
+ struct abx500_pinctrl *pct = gpiochip_get_data(chip);
struct pinctrl_dev *pctldev = pct->pctldev;
for (i = 0; i < chip->ngpio; i++, gpio++) {
@@ -986,7 +978,7 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev,
param = pinconf_to_config_param(configs[i]);
argument = pinconf_to_config_argument(configs[i]);
- dev_dbg(chip->dev, "pin %d [%#lx]: %s %s\n",
+ dev_dbg(chip->parent, "pin %d [%#lx]: %s %s\n",
pin, configs[i],
(param == PIN_CONFIG_OUTPUT) ? "output " : "input",
(param == PIN_CONFIG_OUTPUT) ?
@@ -1077,7 +1069,8 @@ static int abx500_pin_config_set(struct pinctrl_dev *pctldev,
break;
default:
- dev_err(chip->dev, "illegal configuration requested\n");
+ dev_err(chip->parent,
+ "illegal configuration requested\n");
}
} /* for each config */
out:
@@ -1172,7 +1165,7 @@ static int abx500_gpio_probe(struct platform_device *pdev)
pct->dev = &pdev->dev;
pct->parent = dev_get_drvdata(pdev->dev.parent);
pct->chip = abx500gpio_chip;
- pct->chip.dev = &pdev->dev;
+ pct->chip.parent = &pdev->dev;
pct->chip.base = -1; /* Dynamic allocation */
match = of_match_device(abx500_gpio_match, &pdev->dev);
@@ -1210,7 +1203,7 @@ static int abx500_gpio_probe(struct platform_device *pdev)
pct->irq_cluster = pct->soc->gpio_irq_cluster;
pct->irq_cluster_size = pct->soc->ngpio_irq_cluster;
- ret = gpiochip_add(&pct->chip);
+ ret = gpiochip_add_data(&pct->chip, pct);
if (ret) {
dev_err(&pdev->dev, "unable to add gpiochip: %d\n", ret);
return ret;
diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c
index eebfae0c9..352406108 100644
--- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c
+++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c
@@ -438,7 +438,7 @@ nmk_gpio_disable_lazy_irq(struct nmk_gpio_chip *nmk_chip, unsigned offset)
nmk_chip->addr + NMK_GPIO_FIMSC);
}
- dev_dbg(nmk_chip->chip.dev, "%d: clearing interrupt mask\n", gpio);
+ dev_dbg(nmk_chip->chip.parent, "%d: clearing interrupt mask\n", gpio);
}
static void nmk_write_masked(void __iomem *reg, u32 mask, u32 value)
@@ -646,7 +646,7 @@ static inline int nmk_gpio_get_bitmask(int gpio)
static void nmk_gpio_irq_ack(struct irq_data *d)
{
struct gpio_chip *chip = irq_data_get_irq_chip_data(d);
- struct nmk_gpio_chip *nmk_chip = container_of(chip, struct nmk_gpio_chip, chip);
+ struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
clk_enable(nmk_chip->clk);
writel(nmk_gpio_get_bitmask(d->hwirq), nmk_chip->addr + NMK_GPIO_IC);
@@ -863,7 +863,7 @@ static void __nmk_gpio_irq_handler(struct irq_desc *desc, u32 status)
static void nmk_gpio_irq_handler(struct irq_desc *desc)
{
struct gpio_chip *chip = irq_desc_get_handler_data(desc);
- struct nmk_gpio_chip *nmk_chip = container_of(chip, struct nmk_gpio_chip, chip);
+ struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
u32 status;
clk_enable(nmk_chip->clk);
@@ -876,7 +876,7 @@ static void nmk_gpio_irq_handler(struct irq_desc *desc)
static void nmk_gpio_latent_irq_handler(struct irq_desc *desc)
{
struct gpio_chip *chip = irq_desc_get_handler_data(desc);
- struct nmk_gpio_chip *nmk_chip = container_of(chip, struct nmk_gpio_chip, chip);
+ struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
u32 status = nmk_chip->get_latent_status(nmk_chip->bank);
__nmk_gpio_irq_handler(desc, status);
@@ -886,8 +886,7 @@ static void nmk_gpio_latent_irq_handler(struct irq_desc *desc)
static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset)
{
- struct nmk_gpio_chip *nmk_chip =
- container_of(chip, struct nmk_gpio_chip, chip);
+ struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
clk_enable(nmk_chip->clk);
@@ -900,8 +899,7 @@ static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset)
static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned offset)
{
- struct nmk_gpio_chip *nmk_chip =
- container_of(chip, struct nmk_gpio_chip, chip);
+ struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
u32 bit = 1 << offset;
int value;
@@ -917,8 +915,7 @@ static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned offset)
static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned offset,
int val)
{
- struct nmk_gpio_chip *nmk_chip =
- container_of(chip, struct nmk_gpio_chip, chip);
+ struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
clk_enable(nmk_chip->clk);
@@ -930,8 +927,7 @@ static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned offset,
static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned offset,
int val)
{
- struct nmk_gpio_chip *nmk_chip =
- container_of(chip, struct nmk_gpio_chip, chip);
+ struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
clk_enable(nmk_chip->clk);
@@ -951,8 +947,7 @@ static void nmk_gpio_dbg_show_one(struct seq_file *s,
unsigned offset, unsigned gpio)
{
const char *label = gpiochip_is_requested(chip, offset);
- struct nmk_gpio_chip *nmk_chip =
- container_of(chip, struct nmk_gpio_chip, chip);
+ struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip);
int mode;
bool is_out;
bool data_out;
@@ -1188,7 +1183,7 @@ static struct nmk_gpio_chip *nmk_gpio_populate_chip(struct device_node *np,
chip->base = id * NMK_GPIO_PER_CHIP;
chip->ngpio = NMK_GPIO_PER_CHIP;
chip->label = dev_name(&gpio_pdev->dev);
- chip->dev = &gpio_pdev->dev;
+ chip->parent = &gpio_pdev->dev;
res = platform_get_resource(gpio_pdev, IORESOURCE_MEM, 0);
base = devm_ioremap_resource(&pdev->dev, res);
@@ -1278,7 +1273,7 @@ static int nmk_gpio_probe(struct platform_device *dev)
clk_disable(nmk_chip->clk);
chip->of_node = np;
- ret = gpiochip_add(chip);
+ ret = gpiochip_add_data(chip, nmk_chip);
if (ret)
return ret;
@@ -1789,7 +1784,7 @@ static int nmk_gpio_request_enable(struct pinctrl_dev *pctldev,
return -EINVAL;
}
chip = range->gc;
- nmk_chip = container_of(chip, struct nmk_gpio_chip, chip);
+ nmk_chip = gpiochip_get_data(chip);
dev_dbg(npct->dev, "enable pin %u as GPIO\n", offset);
@@ -1890,7 +1885,7 @@ static int nmk_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin,
if (slpm_val)
val = slpm_val - 1;
- dev_dbg(nmk_chip->chip.dev,
+ dev_dbg(nmk_chip->chip.parent,
"pin %d: sleep pull %s, dir %s, val %s\n",
pin,
slpm_pull ? pullnames[pull] : "same",
@@ -1899,7 +1894,7 @@ static int nmk_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin,
slpm_val ? (val ? "high" : "low") : "same");
}
- dev_dbg(nmk_chip->chip.dev,
+ dev_dbg(nmk_chip->chip.parent,
"pin %d [%#lx]: pull %s, slpm %s (%s%s), lowemi %s\n",
pin, cfg, pullnames[pull], slpmnames[slpm],
output ? "output " : "input",