]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Input: max77693 - add max77705 haptic support
authorDzmitry Sankouski <dsankouski@gmail.com>
Thu, 23 Jan 2025 15:04:31 +0000 (18:04 +0300)
committerLee Jones <lee@kernel.org>
Thu, 20 Feb 2025 16:37:47 +0000 (16:37 +0000)
Add support for haptic controller on MAX77705 Multifunction
device.

This driver supports external pwm and LRA (Linear Resonant Actuator) motor.
User can control the haptic device via force feedback framework.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20250123-starqltechn_integration_upstream-v17-6-8b06685b6612@gmail.com
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/input/misc/Kconfig
drivers/input/misc/max77693-haptic.c

index 13d135257e0601ed9b07777f0290a19f23abc7ca..f5496ca0c0d2bfcb7968503ccd1844ff43bbc1c0 100644 (file)
@@ -240,12 +240,12 @@ config INPUT_MAX77650_ONKEY
          will be called max77650-onkey.
 
 config INPUT_MAX77693_HAPTIC
-       tristate "MAXIM MAX77693/MAX77843 haptic controller support"
-       depends on (MFD_MAX77693 || MFD_MAX77843) && PWM
+       tristate "MAXIM MAX77693/MAX77705/MAX77843 haptic controller support"
+       depends on (MFD_MAX77693 || MFD_MAX77705 || MFD_MAX77843) && PWM
        select INPUT_FF_MEMLESS
        help
          This option enables support for the haptic controller on
-         MAXIM MAX77693 and MAX77843 chips.
+         MAXIM MAX77693, MAX77705 and MAX77843 chips.
 
          To compile this driver as module, choose M here: the
          module will be called max77693-haptic.
index cdb9be737e48122f4609f50dd15935efaa6bcd96..1dfd7b95a4ce6699ed66513359f1dfe13ee90d91 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/mfd/max77693.h>
 #include <linux/mfd/max77693-common.h>
 #include <linux/mfd/max77693-private.h>
+#include <linux/mfd/max77705-private.h>
 #include <linux/mfd/max77843-private.h>
 
 #define MAX_MAGNITUDE_SHIFT    16
@@ -116,6 +117,13 @@ static int max77693_haptic_configure(struct max77693_haptic *haptic,
                        MAX77693_HAPTIC_PWM_DIVISOR_128);
                config_reg = MAX77693_HAPTIC_REG_CONFIG2;
                break;
+       case TYPE_MAX77705:
+               value = ((haptic->type << MAX77693_CONFIG2_MODE) |
+                       (enable << MAX77693_CONFIG2_MEN) |
+                       (haptic->mode << MAX77693_CONFIG2_HTYP) |
+                       MAX77693_HAPTIC_PWM_DIVISOR_128);
+               config_reg = MAX77705_PMIC_REG_MCONFIG;
+               break;
        case TYPE_MAX77843:
                value = (haptic->type << MCONFIG_MODE_SHIFT) |
                        (enable << MCONFIG_MEN_SHIFT) |
@@ -313,6 +321,7 @@ static int max77693_haptic_probe(struct platform_device *pdev)
        case TYPE_MAX77693:
                haptic->regmap_haptic = max77693->regmap_haptic;
                break;
+       case TYPE_MAX77705:
        case TYPE_MAX77843:
                haptic->regmap_haptic = max77693->regmap;
                break;
@@ -408,6 +417,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(max77693_haptic_pm_ops,
 
 static const struct platform_device_id max77693_haptic_id[] = {
        { "max77693-haptic", },
+       { "max77705-haptic", },
        { "max77843-haptic", },
        {},
 };
@@ -415,6 +425,7 @@ MODULE_DEVICE_TABLE(platform, max77693_haptic_id);
 
 static const struct of_device_id of_max77693_haptic_dt_match[] = {
        { .compatible = "maxim,max77693-haptic", },
+       { .compatible = "maxim,max77705-haptic", },
        { .compatible = "maxim,max77843-haptic", },
        { /* sentinel */ },
 };
@@ -433,5 +444,5 @@ module_platform_driver(max77693_haptic_driver);
 
 MODULE_AUTHOR("Jaewon Kim <jaewon02.kim@samsung.com>");
 MODULE_AUTHOR("Krzysztof Kozlowski <krzk@kernel.org>");
-MODULE_DESCRIPTION("MAXIM 77693/77843 Haptic driver");
+MODULE_DESCRIPTION("MAXIM 77693/77705/77843 Haptic driver");
 MODULE_LICENSE("GPL");