diff mbox

[1/2] input: qt1070: add pinctrl consumer

Message ID 1350998942-713-1-git-send-email-plagnioj@jcrosoft.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jean-Christophe PLAGNIOL-VILLARD Oct. 23, 2012, 1:29 p.m. UTC
If no pinctrl available just report a warning as some architecture may not
need to do anything.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-input@vger.kernel.org
---
 drivers/input/keyboard/qt1070.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Bo Shen Oct. 26, 2012, 3:51 a.m. UTC | #1
On 10/23/2012 21:29, Jean-Christophe PLAGNIOL-VILLARD wrote:
> If no pinctrl available just report a warning as some architecture may not
> need to do anything.
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: linux-input@vger.kernel.org
> ---
>   drivers/input/keyboard/qt1070.c |   11 +++++++++++
>   1 file changed, 11 insertions(+)

Test it on sam9x5ek board with qt1070. It works well.

Tested-by: Bo Shen <voice.shen@atmel.com>

> diff --git a/drivers/input/keyboard/qt1070.c b/drivers/input/keyboard/qt1070.c
> index ca68f29..967734e 100644
> --- a/drivers/input/keyboard/qt1070.c
> +++ b/drivers/input/keyboard/qt1070.c
> @@ -33,6 +33,7 @@
>   #include <linux/interrupt.h>
>   #include <linux/jiffies.h>
>   #include <linux/delay.h>
> +#include <linux/pinctrl/consumer.h>
>
>   /* Address for each register */
>   #define CHIP_ID            0x00
> @@ -147,6 +148,7 @@ static int __devinit qt1070_probe(struct i2c_client *client,
>   	struct input_dev *input;
>   	int i;
>   	int err;
> +	struct pinctrl *pinctrl;
>
>   	err = i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE);
>   	if (!err) {
> @@ -155,6 +157,15 @@ static int __devinit qt1070_probe(struct i2c_client *client,
>   		return -ENODEV;
>   	}
>
> +	pinctrl = devm_pinctrl_get_select_default(&client->dev);
> +	if (IS_ERR(pinctrl)) {
> +		err = PTR_ERR(pinctrl);
> +		if (err == -EPROBE_DEFER)
> +			return err;
> +
> +		dev_warn(&client->dev, "No pinctrl provided\n");
> +	}
> +
>   	if (!client->irq) {
>   		dev_err(&client->dev, "please assign the irq to this device\n");
>   		return -EINVAL;
>

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij Oct. 30, 2012, 9:37 p.m. UTC | #2
On Tue, Oct 23, 2012 at 3:29 PM, Jean-Christophe PLAGNIOL-VILLARD
<plagnioj@jcrosoft.com> wrote:

> If no pinctrl available just report a warning as some architecture may not
> need to do anything.
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: linux-input@vger.kernel.org

We're having a discussion on the level of where to impose pinctrl.

Jean-Christophe, could you please check the thread
"Input: omap4-keypad: Add pinctrl support"
and tell us what you think is the best approach?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jean-Christophe PLAGNIOL-VILLARD Oct. 31, 2012, 1:02 p.m. UTC | #3
On 22:37 Tue 30 Oct     , Linus Walleij wrote:
> 
> On Tue, Oct 23, 2012 at 3:29 PM, Jean-Christophe PLAGNIOL-VILLARD
> <plagnioj@jcrosoft.com> wrote:
> 
> > If no pinctrl available just report a warning as some architecture may not
> > need to do anything.
> >
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: linux-input@vger.kernel.org
> 
> We're having a discussion on the level of where to impose pinctrl.
> 
> Jean-Christophe, could you please check the thread
> "Input: omap4-keypad: Add pinctrl support"
> and tell us what you think is the best approach?
ok I check it 

Best Regards,
J.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/input/keyboard/qt1070.c b/drivers/input/keyboard/qt1070.c
index ca68f29..967734e 100644
--- a/drivers/input/keyboard/qt1070.c
+++ b/drivers/input/keyboard/qt1070.c
@@ -33,6 +33,7 @@ 
 #include <linux/interrupt.h>
 #include <linux/jiffies.h>
 #include <linux/delay.h>
+#include <linux/pinctrl/consumer.h>
 
 /* Address for each register */
 #define CHIP_ID            0x00
@@ -147,6 +148,7 @@  static int __devinit qt1070_probe(struct i2c_client *client,
 	struct input_dev *input;
 	int i;
 	int err;
+	struct pinctrl *pinctrl;
 
 	err = i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE);
 	if (!err) {
@@ -155,6 +157,15 @@  static int __devinit qt1070_probe(struct i2c_client *client,
 		return -ENODEV;
 	}
 
+	pinctrl = devm_pinctrl_get_select_default(&client->dev);
+	if (IS_ERR(pinctrl)) {
+		err = PTR_ERR(pinctrl);
+		if (err == -EPROBE_DEFER)
+			return err;
+
+		dev_warn(&client->dev, "No pinctrl provided\n");
+	}
+
 	if (!client->irq) {
 		dev_err(&client->dev, "please assign the irq to this device\n");
 		return -EINVAL;