* [PATCH 1/2] input: adp5589: Add default platform data
@ 2019-10-29 11:28 Alexandru Ardelean
2019-10-29 11:28 ` [PATCH 2/2] input: adp5589: Add basic devicetree support Alexandru Ardelean
2019-10-29 13:57 ` [PATCH 1/2] input: adp5589: Add default platform data Ardelean, Alexandru
0 siblings, 2 replies; 4+ messages in thread
From: Alexandru Ardelean @ 2019-10-29 11:28 UTC (permalink / raw)
To: linux-input, linux-kernel
Cc: dmitry.torokhov, Lars-Peter Clausen, Alexandru Ardelean
From: Lars-Peter Clausen <lars@metafoo.de>
If no platform data is supplied use a dummy platform data that configures
the device in GPIO only mode.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
drivers/input/keyboard/adp5589-keys.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
index e7d58e7f0257..ed2c13bef1b7 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -987,6 +987,14 @@ static void adp5589_keypad_remove(struct adp5589_kpad *kpad)
}
}
+static const struct adp5589_gpio_platform_data adp5589_default_gpio_pdata = {
+ .gpio_start = -1,
+};
+
+static const struct adp5589_kpad_platform_data adp5589_default_pdata = {
+ .gpio_data = &adp5589_default_gpio_pdata,
+};
+
static int adp5589_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
@@ -1002,10 +1010,8 @@ static int adp5589_probe(struct i2c_client *client,
return -EIO;
}
- if (!pdata) {
- dev_err(&client->dev, "no platform data?\n");
- return -EINVAL;
- }
+ if (!pdata)
+ pdata = &adp5589_default_pdata;
kpad = kzalloc(sizeof(*kpad), GFP_KERNEL);
if (!kpad)
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] input: adp5589: Add basic devicetree support
2019-10-29 11:28 [PATCH 1/2] input: adp5589: Add default platform data Alexandru Ardelean
@ 2019-10-29 11:28 ` Alexandru Ardelean
2019-10-31 3:06 ` kbuild test robot
2019-10-29 13:57 ` [PATCH 1/2] input: adp5589: Add default platform data Ardelean, Alexandru
1 sibling, 1 reply; 4+ messages in thread
From: Alexandru Ardelean @ 2019-10-29 11:28 UTC (permalink / raw)
To: linux-input, linux-kernel
Cc: dmitry.torokhov, Lars-Peter Clausen, Alexandru Ardelean
From: Lars-Peter Clausen <lars@metafoo.de>
Add very basic devicetree suppport to the adp5589 allowing the device to be
registered from devicetree.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
drivers/input/keyboard/adp5589-keys.c | 33 ++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
index ed2c13bef1b7..61d1e2f748f3 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -987,6 +987,25 @@ static void adp5589_keypad_remove(struct adp5589_kpad *kpad)
}
}
+static int adp5589_i2c_get_driver_data(struct i2c_client *i2c,
+ const struct i2c_device_id *id)
+{
+ const struct of_device_id *match;
+
+ if (id)
+ return id->driver_data;
+
+ if (!IS_ENABLED(CONFIG_OF) || !i2c->dev.of_node)
+ return -ENODEV;
+
+ match = of_match_node(i2c->dev.driver->of_match_table,
+ i2c->dev.of_node);
+ if (match)
+ return (int)match->data;
+
+ return -ENODEV;
+}
+
static const struct adp5589_gpio_platform_data adp5589_default_gpio_pdata = {
.gpio_start = -1,
};
@@ -1019,7 +1038,11 @@ static int adp5589_probe(struct i2c_client *client,
kpad->client = client;
- switch (id->driver_data) {
+ ret = adp5589_i2c_get_driver_data(client, id);
+ if (ret < 0)
+ return ret;
+
+ switch (ret) {
case ADP5585_02:
kpad->support_row5 = true;
/* fall through */
@@ -1119,6 +1142,13 @@ static int adp5589_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(adp5589_dev_pm_ops, adp5589_suspend, adp5589_resume);
+static const struct of_device_id adp5589_of_match[] = {
+ { .compatible = "adi,adp5585", .data = (void *)ADP5585_01 },
+ { .compatible = "adi,adp5585-02", .data = (void *)ADP5585_02 },
+ { .compatible = "adi,adp5589", .data = (void *)ADP5589 },
+ {}
+};
+
static const struct i2c_device_id adp5589_id[] = {
{"adp5589-keys", ADP5589},
{"adp5585-keys", ADP5585_01},
@@ -1132,6 +1162,7 @@ static struct i2c_driver adp5589_driver = {
.driver = {
.name = KBUILD_MODNAME,
.pm = &adp5589_dev_pm_ops,
+ .of_match_table = adp5589_of_match,
},
.probe = adp5589_probe,
.remove = adp5589_remove,
--
2.20.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] input: adp5589: Add default platform data
2019-10-29 11:28 [PATCH 1/2] input: adp5589: Add default platform data Alexandru Ardelean
2019-10-29 11:28 ` [PATCH 2/2] input: adp5589: Add basic devicetree support Alexandru Ardelean
@ 2019-10-29 13:57 ` Ardelean, Alexandru
1 sibling, 0 replies; 4+ messages in thread
From: Ardelean, Alexandru @ 2019-10-29 13:57 UTC (permalink / raw)
To: linux-input, linux-kernel; +Cc: dmitry.torokhov, lars
On Tue, 2019-10-29 at 13:28 +0200, Alexandru Ardelean wrote:
> From: Lars-Peter Clausen <lars@metafoo.de>
>
Disregard this series.
I just noticed that it needs to be re-visited.
Some things have changed, and I didn't notice.
Apologies for the noise.
Alex
> If no platform data is supplied use a dummy platform data that configures
> the device in GPIO only mode.
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> ---
> drivers/input/keyboard/adp5589-keys.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/input/keyboard/adp5589-keys.c
> b/drivers/input/keyboard/adp5589-keys.c
> index e7d58e7f0257..ed2c13bef1b7 100644
> --- a/drivers/input/keyboard/adp5589-keys.c
> +++ b/drivers/input/keyboard/adp5589-keys.c
> @@ -987,6 +987,14 @@ static void adp5589_keypad_remove(struct
> adp5589_kpad *kpad)
> }
> }
>
> +static const struct adp5589_gpio_platform_data
> adp5589_default_gpio_pdata = {
> + .gpio_start = -1,
> +};
> +
> +static const struct adp5589_kpad_platform_data adp5589_default_pdata = {
> + .gpio_data = &adp5589_default_gpio_pdata,
> +};
> +
> static int adp5589_probe(struct i2c_client *client,
> const struct i2c_device_id *id)
> {
> @@ -1002,10 +1010,8 @@ static int adp5589_probe(struct i2c_client
> *client,
> return -EIO;
> }
>
> - if (!pdata) {
> - dev_err(&client->dev, "no platform data?\n");
> - return -EINVAL;
> - }
> + if (!pdata)
> + pdata = &adp5589_default_pdata;
>
> kpad = kzalloc(sizeof(*kpad), GFP_KERNEL);
> if (!kpad)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] input: adp5589: Add basic devicetree support
2019-10-29 11:28 ` [PATCH 2/2] input: adp5589: Add basic devicetree support Alexandru Ardelean
@ 2019-10-31 3:06 ` kbuild test robot
0 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2019-10-31 3:06 UTC (permalink / raw)
To: Alexandru Ardelean
Cc: kbuild-all, linux-input, linux-kernel, dmitry.torokhov,
Lars-Peter Clausen, Alexandru Ardelean
[-- Attachment #1: Type: text/plain, Size: 1933 bytes --]
Hi Alexandru,
I love your patch! Perhaps something to improve:
[auto build test WARNING on input/next]
[also build test WARNING on next-20191030]
[cannot apply to v5.4-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/input-adp5589-Add-default-platform-data/20191031-073612
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: x86_64-kexec (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
drivers/input/keyboard/adp5589-keys.c: In function 'adp5589_i2c_get_driver_data':
>> drivers/input/keyboard/adp5589-keys.c:1004:10: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
return (int)match->data;
^
vim +1004 drivers/input/keyboard/adp5589-keys.c
989
990 static int adp5589_i2c_get_driver_data(struct i2c_client *i2c,
991 const struct i2c_device_id *id)
992 {
993 const struct of_device_id *match;
994
995 if (id)
996 return id->driver_data;
997
998 if (!IS_ENABLED(CONFIG_OF) || !i2c->dev.of_node)
999 return -ENODEV;
1000
1001 match = of_match_node(i2c->dev.driver->of_match_table,
1002 i2c->dev.of_node);
1003 if (match)
> 1004 return (int)match->data;
1005
1006 return -ENODEV;
1007 }
1008
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 27534 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-31 3:07 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29 11:28 [PATCH 1/2] input: adp5589: Add default platform data Alexandru Ardelean
2019-10-29 11:28 ` [PATCH 2/2] input: adp5589: Add basic devicetree support Alexandru Ardelean
2019-10-31 3:06 ` kbuild test robot
2019-10-29 13:57 ` [PATCH 1/2] input: adp5589: Add default platform data Ardelean, Alexandru
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).