gpio: stmpe: Add DT support for stmpe gpio
This patch allows the STMPE GPIO driver to be successfully probed and initialised when Device Tree support is enabled. Bindings are mentioned in Documentation too. Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Vipul Kumar Samar <vipulkumar.samar@st.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Родитель
8618b3b47c
Коммит
86605cfe8c
|
@ -0,0 +1,18 @@
|
||||||
|
STMPE gpio
|
||||||
|
----------
|
||||||
|
|
||||||
|
Required properties:
|
||||||
|
- compatible: "st,stmpe-gpio"
|
||||||
|
|
||||||
|
Optional properties:
|
||||||
|
- st,norequest-mask: bitmask specifying which GPIOs should _not_ be requestable
|
||||||
|
due to different usage (e.g. touch, keypad)
|
||||||
|
|
||||||
|
Node name must be stmpe_gpio and should be child node of stmpe node to which it
|
||||||
|
belongs.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
stmpe_gpio {
|
||||||
|
compatible = "st,stmpe-gpio";
|
||||||
|
st,norequest-mask = <0x20>; //gpio 5 can't be used
|
||||||
|
};
|
|
@ -12,6 +12,7 @@
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio.h>
|
||||||
#include <linux/irq.h>
|
#include <linux/irq.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
|
#include <linux/of.h>
|
||||||
#include <linux/mfd/stmpe.h>
|
#include <linux/mfd/stmpe.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -304,6 +305,7 @@ static void stmpe_gpio_irq_remove(struct stmpe_gpio *stmpe_gpio)
|
||||||
static int __devinit stmpe_gpio_probe(struct platform_device *pdev)
|
static int __devinit stmpe_gpio_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent);
|
struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent);
|
||||||
|
struct device_node *np = pdev->dev.of_node;
|
||||||
struct stmpe_gpio_platform_data *pdata;
|
struct stmpe_gpio_platform_data *pdata;
|
||||||
struct stmpe_gpio *stmpe_gpio;
|
struct stmpe_gpio *stmpe_gpio;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -321,13 +323,17 @@ static int __devinit stmpe_gpio_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
stmpe_gpio->dev = &pdev->dev;
|
stmpe_gpio->dev = &pdev->dev;
|
||||||
stmpe_gpio->stmpe = stmpe;
|
stmpe_gpio->stmpe = stmpe;
|
||||||
stmpe_gpio->norequest_mask = pdata ? pdata->norequest_mask : 0;
|
|
||||||
|
|
||||||
stmpe_gpio->chip = template_chip;
|
stmpe_gpio->chip = template_chip;
|
||||||
stmpe_gpio->chip.ngpio = stmpe->num_gpios;
|
stmpe_gpio->chip.ngpio = stmpe->num_gpios;
|
||||||
stmpe_gpio->chip.dev = &pdev->dev;
|
stmpe_gpio->chip.dev = &pdev->dev;
|
||||||
stmpe_gpio->chip.base = pdata ? pdata->gpio_base : -1;
|
stmpe_gpio->chip.base = pdata ? pdata->gpio_base : -1;
|
||||||
|
|
||||||
|
if (pdata)
|
||||||
|
stmpe_gpio->norequest_mask = pdata->norequest_mask;
|
||||||
|
else if (np)
|
||||||
|
of_property_read_u32(np, "st,norequest-mask",
|
||||||
|
&stmpe_gpio->norequest_mask);
|
||||||
|
|
||||||
if (irq >= 0)
|
if (irq >= 0)
|
||||||
stmpe_gpio->irq_base = stmpe->irq_base + STMPE_INT_GPIO(0);
|
stmpe_gpio->irq_base = stmpe->irq_base + STMPE_INT_GPIO(0);
|
||||||
else
|
else
|
||||||
|
|
|
@ -294,12 +294,14 @@ static struct resource stmpe_gpio_resources[] = {
|
||||||
|
|
||||||
static struct mfd_cell stmpe_gpio_cell = {
|
static struct mfd_cell stmpe_gpio_cell = {
|
||||||
.name = "stmpe-gpio",
|
.name = "stmpe-gpio",
|
||||||
|
.of_compatible = "st,stmpe-gpio",
|
||||||
.resources = stmpe_gpio_resources,
|
.resources = stmpe_gpio_resources,
|
||||||
.num_resources = ARRAY_SIZE(stmpe_gpio_resources),
|
.num_resources = ARRAY_SIZE(stmpe_gpio_resources),
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct mfd_cell stmpe_gpio_cell_noirq = {
|
static struct mfd_cell stmpe_gpio_cell_noirq = {
|
||||||
.name = "stmpe-gpio",
|
.name = "stmpe-gpio",
|
||||||
|
.of_compatible = "st,stmpe-gpio",
|
||||||
/* gpio cell resources consist of an irq only so no resources here */
|
/* gpio cell resources consist of an irq only so no resources here */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче