Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 281047
b: refs/heads/master
c: 7990b0d
h: refs/heads/master
i:
  281045: 3997f31
  281043: e44a0a7
  281039: 3df6b0f
v: v3
  • Loading branch information
Marc Dietrich authored and Greg Kroah-Hartman committed Nov 27, 2011
1 parent 92d1760 commit 549ceb4
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d9f26a6689a3e4ae643fca9c2acda3148b717e63
refs/heads/master: 7990b0d7ec449b10da383bab191eb487185aadce
9 changes: 9 additions & 0 deletions trunk/Documentation/devicetree/bindings/nvec/nvec_nvidia.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
NVIDIA compliant embedded controller

Required properties:
- compatible : should be "nvidia,nvec".
- reg : the iomem of the i2c slave controller
- interrupts : the interrupt line of the i2c slave controller
- clock-frequency : the frequency of the i2c bus
- gpios : the gpio used for ec request
- slave-addr: the i2c address of the slave controller
30 changes: 28 additions & 2 deletions trunk/drivers/staging/nvec/nvec.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/list.h>
#include <linux/mfd/core.h>
#include <linux/mutex.h>
Expand Down Expand Up @@ -727,8 +729,24 @@ static int __devinit tegra_nvec_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, nvec);
nvec->dev = &pdev->dev;
nvec->gpio = pdata->gpio;
nvec->i2c_addr = pdata->i2c_addr;

if (pdata) {
nvec->gpio = pdata->gpio;
nvec->i2c_addr = pdata->i2c_addr;
} else if (nvec->dev->of_node) {
nvec->gpio = of_get_named_gpio(nvec->dev->of_node, "request-gpios", 0);
if (nvec->gpio < 0) {
dev_err(&pdev->dev, "no gpio specified");
goto failed;
}
if (of_property_read_u32(nvec->dev->of_node, "slave-addr", &nvec->i2c_addr)) {
dev_err(&pdev->dev, "no i2c address specified");
goto failed;
}
} else {
dev_err(&pdev->dev, "no platform data\n");
goto failed;
}

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
Expand Down Expand Up @@ -893,6 +911,13 @@ static int tegra_nvec_resume(struct platform_device *pdev)
#define tegra_nvec_resume NULL
#endif

/* Match table for of_platform binding */
static const struct of_device_id nvidia_nvec_of_match[] __devinitconst = {
{ .compatible = "nvidia,nvec", },
{},
};
MODULE_DEVICE_TABLE(of, nvidia_nvec_of_match);

static struct platform_driver nvec_device_driver = {
.probe = tegra_nvec_probe,
.remove = __devexit_p(tegra_nvec_remove),
Expand All @@ -901,6 +926,7 @@ static struct platform_driver nvec_device_driver = {
.driver = {
.name = "nvec",
.owner = THIS_MODULE,
.of_match_table = nvidia_nvec_of_match,
}
};

Expand Down

0 comments on commit 549ceb4

Please sign in to comment.