* [PATCH 1/3] mfd: intel_soc_pmic: Move PMIC interrupt comment to probe function
@ 2015-02-13 13:01 Jarkko Nikula
2015-02-13 13:01 ` [PATCH 2/3] mfd: intel_soc_pmic: Do not mangle error code from devm_gpiod_get_index() Jarkko Nikula
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jarkko Nikula @ 2015-02-13 13:01 UTC (permalink / raw)
To: linux-kernel; +Cc: Samuel Ortiz, Lee Jones, lejun.zhu, bin.yang, Jarkko Nikula
intel_soc_pmic_find_gpio_irq() tries to find a GPIO interrupt but doesn't
select between it or I2C interrupt so it makes more sense to move this
comment to intel_soc_pmic_i2c_probe() with minor edits.
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
drivers/mfd/intel_soc_pmic_core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c
index df7b0642a5b4..08c8e3dafaf5 100644
--- a/drivers/mfd/intel_soc_pmic_core.c
+++ b/drivers/mfd/intel_soc_pmic_core.c
@@ -26,11 +26,6 @@
#include <linux/mfd/intel_soc_pmic.h>
#include "intel_soc_pmic_core.h"
-/*
- * On some boards the PMIC interrupt may come from a GPIO line.
- * Try to lookup the ACPI table and see if such connection exists. If not,
- * return -ENOENT and use the IRQ provided by I2C.
- */
static int intel_soc_pmic_find_gpio_irq(struct device *dev)
{
struct gpio_desc *desc;
@@ -68,6 +63,11 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c,
pmic->regmap = devm_regmap_init_i2c(i2c, config->regmap_config);
+ /*
+ * On some boards the PMIC interrupt may come from a GPIO line. Try to
+ * lookup the ACPI table for a such connection and setup a GPIO
+ * interrupt if it exists. Otherwise use the IRQ provided by I2C
+ */
irq = intel_soc_pmic_find_gpio_irq(dev);
pmic->irq = (irq < 0) ? i2c->irq : irq;
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] mfd: intel_soc_pmic: Do not mangle error code from devm_gpiod_get_index()
2015-02-13 13:01 [PATCH 1/3] mfd: intel_soc_pmic: Move PMIC interrupt comment to probe function Jarkko Nikula
@ 2015-02-13 13:01 ` Jarkko Nikula
2015-02-16 11:49 ` Lee Jones
2015-02-13 13:01 ` [PATCH 3/3] mfd: intel_soc_pmic: Ensure GPIO irq is set to input pin Jarkko Nikula
2015-02-16 11:49 ` [PATCH 1/3] mfd: intel_soc_pmic: Move PMIC interrupt comment to probe function Lee Jones
2 siblings, 1 reply; 6+ messages in thread
From: Jarkko Nikula @ 2015-02-13 13:01 UTC (permalink / raw)
To: linux-kernel; +Cc: Samuel Ortiz, Lee Jones, lejun.zhu, bin.yang, Jarkko Nikula
It is usually better to pass actual error code from a function call than
mangling it to another.
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
I haven't seen any issue with this. Random observation by looking at the code.
---
drivers/mfd/intel_soc_pmic_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c
index 08c8e3dafaf5..40488e5b52ef 100644
--- a/drivers/mfd/intel_soc_pmic_core.c
+++ b/drivers/mfd/intel_soc_pmic_core.c
@@ -33,7 +33,7 @@ static int intel_soc_pmic_find_gpio_irq(struct device *dev)
desc = devm_gpiod_get_index(dev, "intel_soc_pmic", 0);
if (IS_ERR(desc))
- return -ENOENT;
+ return PTR_ERR(desc);
irq = gpiod_to_irq(desc);
if (irq < 0)
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] mfd: intel_soc_pmic: Ensure GPIO irq is set to input pin
2015-02-13 13:01 [PATCH 1/3] mfd: intel_soc_pmic: Move PMIC interrupt comment to probe function Jarkko Nikula
2015-02-13 13:01 ` [PATCH 2/3] mfd: intel_soc_pmic: Do not mangle error code from devm_gpiod_get_index() Jarkko Nikula
@ 2015-02-13 13:01 ` Jarkko Nikula
2015-02-16 11:49 ` Lee Jones
2015-02-16 11:49 ` [PATCH 1/3] mfd: intel_soc_pmic: Move PMIC interrupt comment to probe function Lee Jones
2 siblings, 1 reply; 6+ messages in thread
From: Jarkko Nikula @ 2015-02-13 13:01 UTC (permalink / raw)
To: linux-kernel; +Cc: Samuel Ortiz, Lee Jones, lejun.zhu, bin.yang, Jarkko Nikula
Surely GPIO irq will be used as an input pin so make sure its direction is
set after requesting.
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
Again, I haven't seen any issue. Just a thought if BIOS haven't configured
the pin correctly.
---
drivers/mfd/intel_soc_pmic_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c
index 40488e5b52ef..857e5cccdb49 100644
--- a/drivers/mfd/intel_soc_pmic_core.c
+++ b/drivers/mfd/intel_soc_pmic_core.c
@@ -31,7 +31,7 @@ static int intel_soc_pmic_find_gpio_irq(struct device *dev)
struct gpio_desc *desc;
int irq;
- desc = devm_gpiod_get_index(dev, "intel_soc_pmic", 0);
+ desc = devm_gpiod_get_index(dev, "intel_soc_pmic", 0, GPIOD_IN);
if (IS_ERR(desc))
return PTR_ERR(desc);
--
2.1.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] mfd: intel_soc_pmic: Move PMIC interrupt comment to probe function
2015-02-13 13:01 [PATCH 1/3] mfd: intel_soc_pmic: Move PMIC interrupt comment to probe function Jarkko Nikula
2015-02-13 13:01 ` [PATCH 2/3] mfd: intel_soc_pmic: Do not mangle error code from devm_gpiod_get_index() Jarkko Nikula
2015-02-13 13:01 ` [PATCH 3/3] mfd: intel_soc_pmic: Ensure GPIO irq is set to input pin Jarkko Nikula
@ 2015-02-16 11:49 ` Lee Jones
2 siblings, 0 replies; 6+ messages in thread
From: Lee Jones @ 2015-02-16 11:49 UTC (permalink / raw)
To: Jarkko Nikula; +Cc: linux-kernel, Samuel Ortiz, lejun.zhu, bin.yang
On Fri, 13 Feb 2015, Jarkko Nikula wrote:
> intel_soc_pmic_find_gpio_irq() tries to find a GPIO interrupt but doesn't
> select between it or I2C interrupt so it makes more sense to move this
> comment to intel_soc_pmic_i2c_probe() with minor edits.
>
> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> ---
> drivers/mfd/intel_soc_pmic_core.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
Applied, thanks.
> diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c
> index df7b0642a5b4..08c8e3dafaf5 100644
> --- a/drivers/mfd/intel_soc_pmic_core.c
> +++ b/drivers/mfd/intel_soc_pmic_core.c
> @@ -26,11 +26,6 @@
> #include <linux/mfd/intel_soc_pmic.h>
> #include "intel_soc_pmic_core.h"
>
> -/*
> - * On some boards the PMIC interrupt may come from a GPIO line.
> - * Try to lookup the ACPI table and see if such connection exists. If not,
> - * return -ENOENT and use the IRQ provided by I2C.
> - */
> static int intel_soc_pmic_find_gpio_irq(struct device *dev)
> {
> struct gpio_desc *desc;
> @@ -68,6 +63,11 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c,
>
> pmic->regmap = devm_regmap_init_i2c(i2c, config->regmap_config);
>
> + /*
> + * On some boards the PMIC interrupt may come from a GPIO line. Try to
> + * lookup the ACPI table for a such connection and setup a GPIO
> + * interrupt if it exists. Otherwise use the IRQ provided by I2C
> + */
> irq = intel_soc_pmic_find_gpio_irq(dev);
> pmic->irq = (irq < 0) ? i2c->irq : irq;
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] mfd: intel_soc_pmic: Do not mangle error code from devm_gpiod_get_index()
2015-02-13 13:01 ` [PATCH 2/3] mfd: intel_soc_pmic: Do not mangle error code from devm_gpiod_get_index() Jarkko Nikula
@ 2015-02-16 11:49 ` Lee Jones
0 siblings, 0 replies; 6+ messages in thread
From: Lee Jones @ 2015-02-16 11:49 UTC (permalink / raw)
To: Jarkko Nikula; +Cc: linux-kernel, Samuel Ortiz, lejun.zhu, bin.yang
On Fri, 13 Feb 2015, Jarkko Nikula wrote:
> It is usually better to pass actual error code from a function call than
> mangling it to another.
>
> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> ---
> I haven't seen any issue with this. Random observation by looking at the code.
> ---
> drivers/mfd/intel_soc_pmic_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
> diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c
> index 08c8e3dafaf5..40488e5b52ef 100644
> --- a/drivers/mfd/intel_soc_pmic_core.c
> +++ b/drivers/mfd/intel_soc_pmic_core.c
> @@ -33,7 +33,7 @@ static int intel_soc_pmic_find_gpio_irq(struct device *dev)
>
> desc = devm_gpiod_get_index(dev, "intel_soc_pmic", 0);
> if (IS_ERR(desc))
> - return -ENOENT;
> + return PTR_ERR(desc);
>
> irq = gpiod_to_irq(desc);
> if (irq < 0)
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] mfd: intel_soc_pmic: Ensure GPIO irq is set to input pin
2015-02-13 13:01 ` [PATCH 3/3] mfd: intel_soc_pmic: Ensure GPIO irq is set to input pin Jarkko Nikula
@ 2015-02-16 11:49 ` Lee Jones
0 siblings, 0 replies; 6+ messages in thread
From: Lee Jones @ 2015-02-16 11:49 UTC (permalink / raw)
To: Jarkko Nikula; +Cc: linux-kernel, Samuel Ortiz, lejun.zhu, bin.yang
On Fri, 13 Feb 2015, Jarkko Nikula wrote:
> Surely GPIO irq will be used as an input pin so make sure its direction is
> set after requesting.
>
> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> ---
> Again, I haven't seen any issue. Just a thought if BIOS haven't configured
> the pin correctly.
> ---
> drivers/mfd/intel_soc_pmic_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks.
> diff --git a/drivers/mfd/intel_soc_pmic_core.c b/drivers/mfd/intel_soc_pmic_core.c
> index 40488e5b52ef..857e5cccdb49 100644
> --- a/drivers/mfd/intel_soc_pmic_core.c
> +++ b/drivers/mfd/intel_soc_pmic_core.c
> @@ -31,7 +31,7 @@ static int intel_soc_pmic_find_gpio_irq(struct device *dev)
> struct gpio_desc *desc;
> int irq;
>
> - desc = devm_gpiod_get_index(dev, "intel_soc_pmic", 0);
> + desc = devm_gpiod_get_index(dev, "intel_soc_pmic", 0, GPIOD_IN);
> if (IS_ERR(desc))
> return PTR_ERR(desc);
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-02-16 11:50 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-13 13:01 [PATCH 1/3] mfd: intel_soc_pmic: Move PMIC interrupt comment to probe function Jarkko Nikula
2015-02-13 13:01 ` [PATCH 2/3] mfd: intel_soc_pmic: Do not mangle error code from devm_gpiod_get_index() Jarkko Nikula
2015-02-16 11:49 ` Lee Jones
2015-02-13 13:01 ` [PATCH 3/3] mfd: intel_soc_pmic: Ensure GPIO irq is set to input pin Jarkko Nikula
2015-02-16 11:49 ` Lee Jones
2015-02-16 11:49 ` [PATCH 1/3] mfd: intel_soc_pmic: Move PMIC interrupt comment to probe function Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).