Skip to content

Commit f737020

Browse files
mszyprowdtor
authored andcommitted
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>
1 parent 5958274 commit f737020

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

drivers/input/misc/max77693-haptic.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ static int max77693_haptic_probe(struct platform_device *pdev)
307307
haptic->suspend_state = false;
308308

309309
/* Variant-specific init */
310-
haptic->dev_type = platform_get_device_id(pdev)->driver_data;
310+
haptic->dev_type = max77693->type;
311311
switch (haptic->dev_type) {
312312
case TYPE_MAX77693:
313313
haptic->regmap_haptic = max77693->regmap_haptic;
@@ -406,16 +406,24 @@ static DEFINE_SIMPLE_DEV_PM_OPS(max77693_haptic_pm_ops,
406406
max77693_haptic_resume);
407407

408408
static const struct platform_device_id max77693_haptic_id[] = {
409-
{ "max77693-haptic", TYPE_MAX77693 },
410-
{ "max77843-haptic", TYPE_MAX77843 },
409+
{ "max77693-haptic", },
410+
{ "max77843-haptic", },
411411
{},
412412
};
413413
MODULE_DEVICE_TABLE(platform, max77693_haptic_id);
414414

415+
static const struct of_device_id of_max77693_haptic_dt_match[] = {
416+
{ .compatible = "maxim,max77693-haptic", },
417+
{ .compatible = "maxim,max77843-haptic", },
418+
{ /* sentinel */ },
419+
};
420+
MODULE_DEVICE_TABLE(of, of_max77693_haptic_dt_match);
421+
415422
static struct platform_driver max77693_haptic_driver = {
416423
.driver = {
417424
.name = "max77693-haptic",
418425
.pm = pm_sleep_ptr(&max77693_haptic_pm_ops),
426+
.of_match_table = of_max77693_haptic_dt_match,
419427
},
420428
.probe = max77693_haptic_probe,
421429
.id_table = max77693_haptic_id,

0 commit comments

Comments
 (0)