Message ID | 20250116-starqltechn_integration_upstream-v15-6-cf229de9f758@gmail.com |
---|---|
State | New |
Headers | show |
Series | Add support for Maxim Integrated MAX77705 PMIC | expand |
On Thu, Jan 16, 2025 at 07:26:08PM +0300, Dzmitry Sankouski wrote: > #define MAX_MAGNITUDE_SHIFT 16 > @@ -115,6 +116,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); That's the same as previous one, why duplicating? > + config_reg = MAX77705_PMIC_REG_MCONFIG; > + break; > case TYPE_MAX77843: > value = (haptic->type << MCONFIG_MODE_SHIFT) | > (enable << MCONFIG_MEN_SHIFT) | > @@ -312,6 +320,9 @@ static int max77693_haptic_probe(struct platform_device *pdev) > case TYPE_MAX77693: > haptic->regmap_haptic = max77693->regmap_haptic; > break; > + case TYPE_MAX77705: > + haptic->regmap_haptic = max77693->regmap; > + break; Drop these two above. > case TYPE_MAX77843: > haptic->regmap_haptic = max77693->regmap; > break; > @@ -407,6 +418,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", }, > {}, > }; > @@ -414,6 +426,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", }, So the device looks fully compatible with max77693. Drop this change and express compatibility with fallback. Best regards, Krzysztof
On 17/01/2025 09:01, Krzysztof Kozlowski wrote: > >> case TYPE_MAX77843: >> haptic->regmap_haptic = max77693->regmap; >> break; >> @@ -407,6 +418,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", }, ... and also drop this change, since compatible is going away and we expect matching by OF. >> {}, >> }; >> @@ -414,6 +426,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", }, > > So the device looks fully compatible with max77693. Drop this change and > express compatibility with fallback. Best regards, Krzysztof
пт, 17 янв. 2025 г. в 11:01, Krzysztof Kozlowski <krzk@kernel.org>: > > On Thu, Jan 16, 2025 at 07:26:08PM +0300, Dzmitry Sankouski wrote: > > #define MAX_MAGNITUDE_SHIFT 16 > > @@ -115,6 +116,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); > > That's the same as previous one, why duplicating? > config_reg is different. I don't see any good way to get rid of that duplication > > + config_reg = MAX77705_PMIC_REG_MCONFIG; > > + break; > > case TYPE_MAX77843: > > value = (haptic->type << MCONFIG_MODE_SHIFT) | > > (enable << MCONFIG_MEN_SHIFT) | (...) > > > > static const struct platform_device_id max77693_haptic_id[] = { > > { "max77693-haptic", }, > > + { "max77705-haptic", }, > > { "max77843-haptic", }, > > {}, > > }; > > @@ -414,6 +426,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", }, > > So the device looks fully compatible with max77693. Drop this change and > express compatibility with fallback. > The only difference is config_reg.
пт, 17 янв. 2025 г. в 11:02, Krzysztof Kozlowski <krzk@kernel.org>: > > On 17/01/2025 09:01, Krzysztof Kozlowski wrote: > > > >> case TYPE_MAX77843: > >> haptic->regmap_haptic = max77693->regmap; > >> break; > >> @@ -407,6 +418,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", }, > > > ... and also drop this change, since compatible is going away and we > expect matching by OF. > > >> {}, > >> }; > >> @@ -414,6 +426,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", }, > > > > So the device looks fully compatible with max77693. Drop this change and > > express compatibility with fallback. Cannot be done, because config_reg is different.
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 6a852c76331b..b4515c4e5cf6 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -241,11 +241,11 @@ config INPUT_MAX77650_ONKEY config INPUT_MAX77693_HAPTIC tristate "MAXIM MAX77693/MAX77843 haptic controller support" - depends on (MFD_MAX77693 || MFD_MAX77843) && PWM + 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. diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index 4f7f736831ba..3e3532b27990 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile @@ -53,6 +53,7 @@ obj-$(CONFIG_INPUT_KXTJ9) += kxtj9.o obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o obj-$(CONFIG_INPUT_MAX77650_ONKEY) += max77650-onkey.o obj-$(CONFIG_INPUT_MAX77693_HAPTIC) += max77693-haptic.o +obj-$(CONFIG_INPUT_MAX77705_HAPTIC) += max77705-haptic.o obj-$(CONFIG_INPUT_MAX8925_ONKEY) += max8925_onkey.o obj-$(CONFIG_INPUT_MAX8997_HAPTIC) += max8997_haptic.o obj-$(CONFIG_INPUT_MC13783_PWRBUTTON) += mc13783-pwrbutton.o diff --git a/drivers/input/misc/max77693-haptic.c b/drivers/input/misc/max77693-haptic.c index 0e646f1b257b..c3b9d33608d7 100644 --- a/drivers/input/misc/max77693-haptic.c +++ b/drivers/input/misc/max77693-haptic.c @@ -23,6 +23,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 @@ -115,6 +116,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) | @@ -312,6 +320,9 @@ static int max77693_haptic_probe(struct platform_device *pdev) case TYPE_MAX77693: haptic->regmap_haptic = max77693->regmap_haptic; break; + case TYPE_MAX77705: + haptic->regmap_haptic = max77693->regmap; + break; case TYPE_MAX77843: haptic->regmap_haptic = max77693->regmap; break; @@ -407,6 +418,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", }, {}, }; @@ -414,6 +426,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 */ }, }; @@ -432,5 +445,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");