* [PATCH v3 1/4] Input: adp5589-keys - add default platform data
@ 2020-11-27 11:14 Alexandru Ardelean
2020-11-27 11:14 ` [PATCH v3 2/4] Input: adp5589-keys - wrap device probing into chip info struct Alexandru Ardelean
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: Alexandru Ardelean @ 2020-11-27 11:14 UTC (permalink / raw)
To: linux-input, linux-kernel, devicetree
Cc: lars, dmitry.torokhov, robh+dt, 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. This change adds a adp5589_kpad_pdata_get()
helper that returns the default platform-data. This can be later extended
to load configuration from device-trees or ACPI.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
Changelog v2 - v3:
* https://lore.kernel.org/linux-input/20201124082255.13427-1-alexandru.ardelean@analog.com/
* added patch 'dt-bindings: add ADP5585/ADP5589 entries to trivial-devices'
drivers/input/keyboard/adp5589-keys.c | 33 +++++++++++++++++++--------
1 file changed, 24 insertions(+), 9 deletions(-)
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
index e2cdf14d90cd..742bf4b97dbb 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -369,6 +369,25 @@ static const struct adp_constants const_adp5585 = {
.reg = adp5585_reg,
};
+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 const struct adp5589_kpad_platform_data *adp5589_kpad_pdata_get(
+ struct device *dev)
+{
+ const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev);
+
+ if (!pdata)
+ pdata = &adp5589_default_pdata;
+
+ return pdata;
+}
+
static int adp5589_read(struct i2c_client *client, u8 reg)
{
int ret = i2c_smbus_read_byte_data(client, reg);
@@ -498,7 +517,8 @@ static int adp5589_build_gpiomap(struct adp5589_kpad *kpad,
static int adp5589_gpio_add(struct adp5589_kpad *kpad)
{
struct device *dev = &kpad->client->dev;
- const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev);
+ const struct adp5589_kpad_platform_data *pdata =
+ adp5589_kpad_pdata_get(dev);
const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data;
int i, error;
@@ -619,7 +639,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad)
{
struct i2c_client *client = kpad->client;
const struct adp5589_kpad_platform_data *pdata =
- dev_get_platdata(&client->dev);
+ adp5589_kpad_pdata_get(&client->dev);
u8 (*reg) (u8) = kpad->var->reg;
unsigned char evt_mode1 = 0, evt_mode2 = 0, evt_mode3 = 0;
unsigned char pull_mask = 0;
@@ -824,7 +844,7 @@ static int adp5589_keypad_add(struct adp5589_kpad *kpad, unsigned int revid)
{
struct i2c_client *client = kpad->client;
const struct adp5589_kpad_platform_data *pdata =
- dev_get_platdata(&client->dev);
+ adp5589_kpad_pdata_get(&client->dev);
struct input_dev *input;
unsigned int i;
int error;
@@ -948,7 +968,7 @@ static int adp5589_probe(struct i2c_client *client,
{
struct adp5589_kpad *kpad;
const struct adp5589_kpad_platform_data *pdata =
- dev_get_platdata(&client->dev);
+ adp5589_kpad_pdata_get(&client->dev);
unsigned int revid;
int error, ret;
@@ -958,11 +978,6 @@ static int adp5589_probe(struct i2c_client *client,
return -EIO;
}
- if (!pdata) {
- dev_err(&client->dev, "no platform data?\n");
- return -EINVAL;
- }
-
kpad = devm_kzalloc(&client->dev, sizeof(*kpad), GFP_KERNEL);
if (!kpad)
return -ENOMEM;
--
2.27.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 2/4] Input: adp5589-keys - wrap device probing into chip info struct
2020-11-27 11:14 [PATCH v3 1/4] Input: adp5589-keys - add default platform data Alexandru Ardelean
@ 2020-11-27 11:14 ` Alexandru Ardelean
2020-11-27 11:14 ` [PATCH v3 3/4] Input: adp5589-keys - add basic devicetree support Alexandru Ardelean
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Alexandru Ardelean @ 2020-11-27 11:14 UTC (permalink / raw)
To: linux-input, linux-kernel, devicetree
Cc: lars, dmitry.torokhov, robh+dt, Alexandru Ardelean
This change wraps the devices supported by the adp5589 driver into a chip
info struct. With this, a device table can be created, and the probed
device can be selected based on the enum value provided by the i2c driver
data.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
drivers/input/keyboard/adp5589-keys.c | 60 ++++++++++++++++-----------
1 file changed, 36 insertions(+), 24 deletions(-)
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
index 742bf4b97dbb..6cb93ee3b97c 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -227,16 +227,17 @@ struct adp_constants {
u8 (*reg) (u8 reg);
};
+struct adp5589_chip_info;
+
struct adp5589_kpad {
struct i2c_client *client;
struct input_dev *input;
const struct adp_constants *var;
+ const struct adp5589_chip_info *info;
unsigned short keycode[ADP5589_KEYMAPSIZE];
const struct adp5589_gpi_map *gpimap;
unsigned short gpimapsize;
unsigned extend_cfg;
- bool is_adp5585;
- bool support_row5;
#ifdef CONFIG_GPIOLIB
unsigned char gpiomap[ADP5589_MAXGPIO];
struct gpio_chip gc;
@@ -377,6 +378,28 @@ static const struct adp5589_kpad_platform_data adp5589_default_pdata = {
.gpio_data = &adp5589_default_gpio_pdata,
};
+struct adp5589_chip_info {
+ const struct adp_constants *constants;
+ bool support_row5;
+ bool is_adp5585;
+};
+
+static const struct adp5589_chip_info adp5589_chip_info_tbl[] = {
+ [ADP5589] = {
+ .constants = &const_adp5589,
+ .support_row5 = true,
+ },
+ [ADP5585_01] = {
+ .constants = &const_adp5585,
+ .is_adp5585 = true,
+ },
+ [ADP5585_02] = {
+ .constants = &const_adp5585,
+ .is_adp5585 = true,
+ .support_row5 = true,
+ },
+};
+
static const struct adp5589_kpad_platform_data *adp5589_kpad_pdata_get(
struct device *dev)
{
@@ -504,7 +527,7 @@ static int adp5589_build_gpiomap(struct adp5589_kpad *kpad,
if (kpad->extend_cfg & C4_EXTEND_CFG)
pin_used[kpad->var->c4_extend_cfg] = true;
- if (!kpad->support_row5)
+ if (!kpad->info->support_row5)
pin_used[5] = true;
for (i = 0; i < kpad->var->maxgpio; i++)
@@ -651,11 +674,11 @@ static int adp5589_setup(struct adp5589_kpad *kpad)
(pdata->keypad_en_mask >> kpad->var->col_shift) &
kpad->var->col_mask);
- if (!kpad->is_adp5585)
+ if (!kpad->info->is_adp5585)
ret |= adp5589_write(client, ADP5589_PIN_CONFIG_C,
(pdata->keypad_en_mask >> 16) & 0xFF);
- if (!kpad->is_adp5585 && pdata->en_keylock) {
+ if (!kpad->info->is_adp5585 && pdata->en_keylock) {
ret |= adp5589_write(client, ADP5589_UNLOCK1,
pdata->unlock_key1);
ret |= adp5589_write(client, ADP5589_UNLOCK2,
@@ -676,7 +699,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad)
} else {
evt_mode2 |=
BIT(pin - kpad->var->gpi_pin_col_base) & 0xFF;
- if (!kpad->is_adp5585)
+ if (!kpad->info->is_adp5585)
evt_mode3 |=
BIT(pin - kpad->var->gpi_pin_col_base) >> 8;
}
@@ -687,7 +710,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad)
evt_mode1);
ret |= adp5589_write(client, reg(ADP5589_GPI_EVENT_EN_B),
evt_mode2);
- if (!kpad->is_adp5585)
+ if (!kpad->info->is_adp5585)
ret |= adp5589_write(client,
reg(ADP5589_GPI_EVENT_EN_C),
evt_mode3);
@@ -775,16 +798,16 @@ static int adp5589_setup(struct adp5589_kpad *kpad)
(pdata->debounce_dis_mask >> kpad->var->col_shift)
& kpad->var->col_mask);
- if (!kpad->is_adp5585)
+ if (!kpad->info->is_adp5585)
ret |= adp5589_write(client, reg(ADP5589_DEBOUNCE_DIS_C),
(pdata->debounce_dis_mask >> 16) & 0xFF);
ret |= adp5589_write(client, reg(ADP5589_POLL_PTIME_CFG),
pdata->scan_cycle_time & PTIME_MASK);
ret |= adp5589_write(client, ADP5589_5_INT_STATUS,
- (kpad->is_adp5585 ? 0 : LOGIC2_INT) |
+ (kpad->info->is_adp5585 ? 0 : LOGIC2_INT) |
LOGIC1_INT | OVRFLOW_INT |
- (kpad->is_adp5585 ? 0 : LOCK_INT) |
+ (kpad->info->is_adp5585 ? 0 : LOCK_INT) |
GPI_INT | EVENT_INT); /* Status is W1C */
ret |= adp5589_write(client, reg(ADP5589_GENERAL_CFG),
@@ -808,7 +831,7 @@ static void adp5589_report_switch_state(struct adp5589_kpad *kpad)
kpad->var->reg(ADP5589_GPI_STATUS_A));
int gpi_stat2 = adp5589_read(kpad->client,
kpad->var->reg(ADP5589_GPI_STATUS_B));
- int gpi_stat3 = !kpad->is_adp5585 ?
+ int gpi_stat3 = !kpad->info->is_adp5585 ?
adp5589_read(kpad->client, ADP5589_GPI_STATUS_C) : 0;
for (i = 0; i < kpad->gpimapsize; i++) {
@@ -984,19 +1007,8 @@ static int adp5589_probe(struct i2c_client *client,
kpad->client = client;
- switch (id->driver_data) {
- case ADP5585_02:
- kpad->support_row5 = true;
- fallthrough;
- case ADP5585_01:
- kpad->is_adp5585 = true;
- kpad->var = &const_adp5585;
- break;
- case ADP5589:
- kpad->support_row5 = true;
- kpad->var = &const_adp5589;
- break;
- }
+ kpad->info = &adp5589_chip_info_tbl[id->driver_data];
+ kpad->var = kpad->info->constants;
error = devm_add_action_or_reset(&client->dev, adp5589_clear_config,
client);
--
2.27.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 3/4] Input: adp5589-keys - add basic devicetree support
2020-11-27 11:14 [PATCH v3 1/4] Input: adp5589-keys - add default platform data Alexandru Ardelean
2020-11-27 11:14 ` [PATCH v3 2/4] Input: adp5589-keys - wrap device probing into chip info struct Alexandru Ardelean
@ 2020-11-27 11:14 ` Alexandru Ardelean
2020-11-27 11:14 ` [PATCH v3 4/4] dt-bindings: add ADP5585/ADP5589 entries to trivial-devices Alexandru Ardelean
` (2 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: Alexandru Ardelean @ 2020-11-27 11:14 UTC (permalink / raw)
To: linux-input, linux-kernel, devicetree
Cc: lars, dmitry.torokhov, robh+dt, 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 and ACPI via PRP0001.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
drivers/input/keyboard/adp5589-keys.c | 30 ++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
index 6cb93ee3b97c..8ff18ff18b75 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -986,9 +986,25 @@ static void adp5589_clear_config(void *data)
adp5589_write(client, kpad->var->reg(ADP5589_GENERAL_CFG), 0);
}
+static const struct adp5589_chip_info *adp5589_get_chip_info(struct device *dev,
+ const struct i2c_device_id *id)
+{
+ const struct adp5589_chip_info *info;
+
+ info = device_get_match_data(dev);
+ if (info)
+ return info;
+
+ if (id)
+ return &adp5589_chip_info_tbl[id->driver_data];
+
+ return NULL;
+}
+
static int adp5589_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
+ const struct adp5589_chip_info *info;
struct adp5589_kpad *kpad;
const struct adp5589_kpad_platform_data *pdata =
adp5589_kpad_pdata_get(&client->dev);
@@ -1001,13 +1017,17 @@ static int adp5589_probe(struct i2c_client *client,
return -EIO;
}
+ info = adp5589_get_chip_info(&client->dev, id);
+ if (!info)
+ return -ENODEV;
+
kpad = devm_kzalloc(&client->dev, sizeof(*kpad), GFP_KERNEL);
if (!kpad)
return -ENOMEM;
kpad->client = client;
- kpad->info = &adp5589_chip_info_tbl[id->driver_data];
+ kpad->info = info;
kpad->var = kpad->info->constants;
error = devm_add_action_or_reset(&client->dev, adp5589_clear_config,
@@ -1078,6 +1098,13 @@ static int __maybe_unused 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 = &adp5589_chip_info_tbl[ADP5585_01] },
+ { .compatible = "adi,adp5585-02", .data = &adp5589_chip_info_tbl[ADP5585_02] },
+ { .compatible = "adi,adp5589", .data = &adp5589_chip_info_tbl[ADP5589] },
+ {}
+};
+
static const struct i2c_device_id adp5589_id[] = {
{"adp5589-keys", ADP5589},
{"adp5585-keys", ADP5585_01},
@@ -1091,6 +1118,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,
.id_table = adp5589_id,
--
2.27.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 4/4] dt-bindings: add ADP5585/ADP5589 entries to trivial-devices
2020-11-27 11:14 [PATCH v3 1/4] Input: adp5589-keys - add default platform data Alexandru Ardelean
2020-11-27 11:14 ` [PATCH v3 2/4] Input: adp5589-keys - wrap device probing into chip info struct Alexandru Ardelean
2020-11-27 11:14 ` [PATCH v3 3/4] Input: adp5589-keys - add basic devicetree support Alexandru Ardelean
@ 2020-11-27 11:14 ` Alexandru Ardelean
2020-12-08 18:13 ` Rob Herring
2020-12-09 7:01 ` [PATCH v3 1/4] Input: adp5589-keys - add default platform data Ardelean, Alexandru
2020-12-10 7:20 ` Dmitry Torokhov
4 siblings, 1 reply; 7+ messages in thread
From: Alexandru Ardelean @ 2020-11-27 11:14 UTC (permalink / raw)
To: linux-input, linux-kernel, devicetree
Cc: lars, dmitry.torokhov, robh+dt, Alexandru Ardelean
This change adds the device-tree entries for the Analog Devices ADP5585 and
ADP5589 devices to the trivial devices list.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
Documentation/devicetree/bindings/trivial-devices.yaml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index 4ace8039840a..2ea43f8e6d59 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -30,6 +30,12 @@ properties:
- ad,ad7414
# ADM9240: Complete System Hardware Monitor for uProcessor-Based Systems
- ad,adm9240
+ # Analog Devices ADP5585 Keypad Decoder and I/O Expansion
+ - adi,adp5585
+ # Analog Devices ADP5585 Keypad Decoder and I/O Expansion with support for Row5
+ - adi,adp5585-02
+ # Analog Devices ADP5589 Keypad Decoder and I/O Expansion
+ - adi,adp5589
# +/-1C TDM Extended Temp Range I.C
- adi,adt7461
# +/-1C TDM Extended Temp Range I.C
--
2.27.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3 4/4] dt-bindings: add ADP5585/ADP5589 entries to trivial-devices
2020-11-27 11:14 ` [PATCH v3 4/4] dt-bindings: add ADP5585/ADP5589 entries to trivial-devices Alexandru Ardelean
@ 2020-12-08 18:13 ` Rob Herring
0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2020-12-08 18:13 UTC (permalink / raw)
To: Alexandru Ardelean
Cc: dmitry.torokhov, linux-kernel, robh+dt, linux-input, devicetree, lars
On Fri, 27 Nov 2020 13:14:20 +0200, Alexandru Ardelean wrote:
> This change adds the device-tree entries for the Analog Devices ADP5585 and
> ADP5589 devices to the trivial devices list.
>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> ---
> Documentation/devicetree/bindings/trivial-devices.yaml | 6 ++++++
> 1 file changed, 6 insertions(+)
>
Applied, thanks!
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH v3 1/4] Input: adp5589-keys - add default platform data
2020-11-27 11:14 [PATCH v3 1/4] Input: adp5589-keys - add default platform data Alexandru Ardelean
` (2 preceding siblings ...)
2020-11-27 11:14 ` [PATCH v3 4/4] dt-bindings: add ADP5585/ADP5589 entries to trivial-devices Alexandru Ardelean
@ 2020-12-09 7:01 ` Ardelean, Alexandru
2020-12-10 7:20 ` Dmitry Torokhov
4 siblings, 0 replies; 7+ messages in thread
From: Ardelean, Alexandru @ 2020-12-09 7:01 UTC (permalink / raw)
To: Ardelean, Alexandru, linux-input, linux-kernel, devicetree
Cc: lars, dmitry.torokhov, robh+dt
> -----Original Message-----
> From: Alexandru Ardelean <alexandru.ardelean@analog.com>
> Sent: Friday, November 27, 2020 1:14 PM
> To: linux-input@vger.kernel.org; linux-kernel@vger.kernel.org;
> devicetree@vger.kernel.org
> Cc: lars@metafoo.de; dmitry.torokhov@gmail.com; robh+dt@kernel.org;
> Ardelean, Alexandru <alexandru.Ardelean@analog.com>
> Subject: [PATCH v3 1/4] Input: adp5589-keys - add default platform data
>
> 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. This change adds a adp5589_kpad_pdata_get() helper
> that returns the default platform-data. This can be later extended to load
> configuration from device-trees or ACPI.
>
Ping on this for the input subsystem.
Since patch 4 was applied by Rob, maybe for input, only the first 3 should be applied.
Or, should I re-send just the first 3?
Thanks
Alex
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> ---
>
> Changelog v2 - v3:
> * https://lore.kernel.org/linux-input/20201124082255.13427-1-
> alexandru.ardelean@analog.com/
> * added patch 'dt-bindings: add ADP5585/ADP5589 entries to trivial-devices'
>
> drivers/input/keyboard/adp5589-keys.c | 33 +++++++++++++++++++--------
> 1 file changed, 24 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/input/keyboard/adp5589-keys.c
> b/drivers/input/keyboard/adp5589-keys.c
> index e2cdf14d90cd..742bf4b97dbb 100644
> --- a/drivers/input/keyboard/adp5589-keys.c
> +++ b/drivers/input/keyboard/adp5589-keys.c
> @@ -369,6 +369,25 @@ static const struct adp_constants const_adp5585 = {
> .reg = adp5585_reg,
> };
>
> +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 const struct adp5589_kpad_platform_data *adp5589_kpad_pdata_get(
> + struct device *dev)
> +{
> + const struct adp5589_kpad_platform_data *pdata =
> +dev_get_platdata(dev);
> +
> + if (!pdata)
> + pdata = &adp5589_default_pdata;
> +
> + return pdata;
> +}
> +
> static int adp5589_read(struct i2c_client *client, u8 reg) {
> int ret = i2c_smbus_read_byte_data(client, reg); @@ -498,7 +517,8 @@
> static int adp5589_build_gpiomap(struct adp5589_kpad *kpad, static int
> adp5589_gpio_add(struct adp5589_kpad *kpad) {
> struct device *dev = &kpad->client->dev;
> - const struct adp5589_kpad_platform_data *pdata =
> dev_get_platdata(dev);
> + const struct adp5589_kpad_platform_data *pdata =
> + adp5589_kpad_pdata_get(dev);
> const struct adp5589_gpio_platform_data *gpio_data = pdata-
> >gpio_data;
> int i, error;
>
> @@ -619,7 +639,7 @@ static int adp5589_setup(struct adp5589_kpad *kpad) {
> struct i2c_client *client = kpad->client;
> const struct adp5589_kpad_platform_data *pdata =
> - dev_get_platdata(&client->dev);
> + adp5589_kpad_pdata_get(&client->dev);
> u8 (*reg) (u8) = kpad->var->reg;
> unsigned char evt_mode1 = 0, evt_mode2 = 0, evt_mode3 = 0;
> unsigned char pull_mask = 0;
> @@ -824,7 +844,7 @@ static int adp5589_keypad_add(struct adp5589_kpad
> *kpad, unsigned int revid) {
> struct i2c_client *client = kpad->client;
> const struct adp5589_kpad_platform_data *pdata =
> - dev_get_platdata(&client->dev);
> + adp5589_kpad_pdata_get(&client->dev);
> struct input_dev *input;
> unsigned int i;
> int error;
> @@ -948,7 +968,7 @@ static int adp5589_probe(struct i2c_client *client, {
> struct adp5589_kpad *kpad;
> const struct adp5589_kpad_platform_data *pdata =
> - dev_get_platdata(&client->dev);
> + adp5589_kpad_pdata_get(&client->dev);
> unsigned int revid;
> int error, ret;
>
> @@ -958,11 +978,6 @@ static int adp5589_probe(struct i2c_client *client,
> return -EIO;
> }
>
> - if (!pdata) {
> - dev_err(&client->dev, "no platform data?\n");
> - return -EINVAL;
> - }
> -
> kpad = devm_kzalloc(&client->dev, sizeof(*kpad), GFP_KERNEL);
> if (!kpad)
> return -ENOMEM;
> --
> 2.27.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/4] Input: adp5589-keys - add default platform data
2020-11-27 11:14 [PATCH v3 1/4] Input: adp5589-keys - add default platform data Alexandru Ardelean
` (3 preceding siblings ...)
2020-12-09 7:01 ` [PATCH v3 1/4] Input: adp5589-keys - add default platform data Ardelean, Alexandru
@ 2020-12-10 7:20 ` Dmitry Torokhov
4 siblings, 0 replies; 7+ messages in thread
From: Dmitry Torokhov @ 2020-12-10 7:20 UTC (permalink / raw)
To: Alexandru Ardelean; +Cc: linux-input, linux-kernel, devicetree, lars, robh+dt
Hi Alexandru, Lars-Peter,
On Fri, Nov 27, 2020 at 01:14:17PM +0200, Alexandru Ardelean wrote:
> 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. This change adds a adp5589_kpad_pdata_get()
> helper that returns the default platform-data. This can be later extended
> to load configuration from device-trees or ACPI.
I was looking at this and I do not think it is a good idea, as later we
will need to add negation if someone does nor want use GPIO mode. We
should use the standard "gpio-controller" property from the beginning.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-12-10 7:21 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-27 11:14 [PATCH v3 1/4] Input: adp5589-keys - add default platform data Alexandru Ardelean
2020-11-27 11:14 ` [PATCH v3 2/4] Input: adp5589-keys - wrap device probing into chip info struct Alexandru Ardelean
2020-11-27 11:14 ` [PATCH v3 3/4] Input: adp5589-keys - add basic devicetree support Alexandru Ardelean
2020-11-27 11:14 ` [PATCH v3 4/4] dt-bindings: add ADP5585/ADP5589 entries to trivial-devices Alexandru Ardelean
2020-12-08 18:13 ` Rob Herring
2020-12-09 7:01 ` [PATCH v3 1/4] Input: adp5589-keys - add default platform data Ardelean, Alexandru
2020-12-10 7:20 ` Dmitry Torokhov
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).