* [PATCH v2] Input: max77693-haptic - add device-tree compatible strings
[not found] <CGME20231006100330eucas1p2c874f582336ed1de4dc1cd759c452ce2@eucas1p2.samsung.com>
@ 2023-10-06 10:03 ` Marek Szyprowski
2023-10-06 10:04 ` Krzysztof Kozlowski
2023-12-13 5:42 ` Dmitry Torokhov
0 siblings, 2 replies; 3+ messages in thread
From: Marek Szyprowski @ 2023-10-06 10:03 UTC (permalink / raw)
To: linux-input, linux-kernel
Cc: Marek Szyprowski, Dmitry Torokhov, Krzysztof Kozlowski
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>
---
drivers/input/misc/max77693-haptic.c | 14 +++++++++++---
1 file 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,
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] Input: max77693-haptic - add device-tree compatible strings
2023-10-06 10:03 ` [PATCH v2] Input: max77693-haptic - add device-tree compatible strings Marek Szyprowski
@ 2023-10-06 10:04 ` Krzysztof Kozlowski
2023-12-13 5:42 ` Dmitry Torokhov
1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2023-10-06 10:04 UTC (permalink / raw)
To: Marek Szyprowski, linux-input, linux-kernel; +Cc: Dmitry Torokhov
On 06/10/2023 12:03, Marek Szyprowski wrote:
> 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>
> ---
> drivers/input/misc/max77693-haptic.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] Input: max77693-haptic - add device-tree compatible strings
2023-10-06 10:03 ` [PATCH v2] Input: max77693-haptic - add device-tree compatible strings Marek Szyprowski
2023-10-06 10:04 ` Krzysztof Kozlowski
@ 2023-12-13 5:42 ` Dmitry Torokhov
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2023-12-13 5:42 UTC (permalink / raw)
To: Marek Szyprowski; +Cc: linux-input, linux-kernel, Krzysztof Kozlowski
On Fri, Oct 06, 2023 at 12:03:20PM +0200, Marek Szyprowski wrote:
> 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>
Applied, thank you.
--
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-12-13 5:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20231006100330eucas1p2c874f582336ed1de4dc1cd759c452ce2@eucas1p2.samsung.com>
2023-10-06 10:03 ` [PATCH v2] Input: max77693-haptic - add device-tree compatible strings Marek Szyprowski
2023-10-06 10:04 ` Krzysztof Kozlowski
2023-12-13 5:42 ` 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).