diff options
author | Marek Szyprowski <m.szyprowski@samsung.com> | 2023-10-06 12:03:20 +0200 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2023-12-13 06:42:36 +0100 |
commit | f737020d24e47d6e8b893a2fee2b43268a6af629 (patch) | |
tree | 80e89378e37163b22a58bceb9490031eaa0de15d /drivers/input/misc | |
parent | Input: qt1050 - convert to use maple tree register cache (diff) | |
download | linux-f737020d24e47d6e8b893a2fee2b43268a6af629.tar.xz linux-f737020d24e47d6e8b893a2fee2b43268a6af629.zip |
Input: max77693-haptic - add device-tree compatible strings
Add the needed device-tree compatible strings to the MAX77693 haptic
driver, so it can be automatically loaded when compiled as a kernel
module and given device-tree contains separate (i.e. 'motor-driver') node
under the main PMIC node. When device is instantiated from device-tree,
the driver data cannot be read via platform_get_device_id(), so get
device type from the parent MFD device instead, what works for both
cases.
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20231006100320.2908210-1-m.szyprowski@samsung.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/misc')
-rw-r--r-- | drivers/input/misc/max77693-haptic.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/input/misc/max77693-haptic.c b/drivers/input/misc/max77693-haptic.c index 80f4416ffe2f..0e646f1b257b 100644 --- a/drivers/input/misc/max77693-haptic.c +++ b/drivers/input/misc/max77693-haptic.c @@ -307,7 +307,7 @@ static int max77693_haptic_probe(struct platform_device *pdev) haptic->suspend_state = false; /* Variant-specific init */ - haptic->dev_type = platform_get_device_id(pdev)->driver_data; + haptic->dev_type = max77693->type; switch (haptic->dev_type) { case TYPE_MAX77693: haptic->regmap_haptic = max77693->regmap_haptic; @@ -406,16 +406,24 @@ static DEFINE_SIMPLE_DEV_PM_OPS(max77693_haptic_pm_ops, max77693_haptic_resume); static const struct platform_device_id max77693_haptic_id[] = { - { "max77693-haptic", TYPE_MAX77693 }, - { "max77843-haptic", TYPE_MAX77843 }, + { "max77693-haptic", }, + { "max77843-haptic", }, {}, }; MODULE_DEVICE_TABLE(platform, max77693_haptic_id); +static const struct of_device_id of_max77693_haptic_dt_match[] = { + { .compatible = "maxim,max77693-haptic", }, + { .compatible = "maxim,max77843-haptic", }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, of_max77693_haptic_dt_match); + static struct platform_driver max77693_haptic_driver = { .driver = { .name = "max77693-haptic", .pm = pm_sleep_ptr(&max77693_haptic_pm_ops), + .of_match_table = of_max77693_haptic_dt_match, }, .probe = max77693_haptic_probe, .id_table = max77693_haptic_id, |