From 9e08156d685147b6d60785cd8d2e00da1b4aeb37 Mon Sep 17 00:00:00 2001 From: longc Date: Thu, 13 Jul 2023 20:26:25 +0800 Subject: [PATCH] fogona:vibrator bring up for driver tirgger node will clash with driver node remove tirgger node reference from gerrit id 2451742 Change-Id: I0db35f3bdc5ab4692244ac0dd9fe86e2b3a054cf Reviewed-on: https://gerrit.mot.com/2674951 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Wei Deng Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- drivers/misc/ldo_vibrator_mmi/moto_ldo_vibrator.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/misc/ldo_vibrator_mmi/moto_ldo_vibrator.c b/drivers/misc/ldo_vibrator_mmi/moto_ldo_vibrator.c index d9a9c3e4cf53..62ce6a95e510 100644 --- a/drivers/misc/ldo_vibrator_mmi/moto_ldo_vibrator.c +++ b/drivers/misc/ldo_vibrator_mmi/moto_ldo_vibrator.c @@ -277,7 +277,7 @@ static int moto_vibrator_ldo_probe(struct platform_device *pdev) { //struct device_node *of_node = pdev->dev.of_node; struct vib_ldo_chip *chip; - int i, ret = 0;; + int i, ret = 0; pr_info("Vibrator LDO successfully registered: ret = %d\n",ret); chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); @@ -318,6 +318,19 @@ static int moto_vibrator_ldo_probe(struct platform_device *pdev) goto sysfs_fail; } } +#ifdef CONFIG_LEDS_TRIGGER_TRANSIENT + /* + * Android has a habit of trying to set the vibrator trigger to "transient", + * which destroys our own "activate", "duration", and "state" attributes. + * Remove the "trigger" attribute provided by leds_class so that no one can + * change the trigger of the vibrator LED device. + * + * Luckily, `sysfs_remove_file` only uses the `name` field, so we can use a + * compound literal instead of having to find the proper attribute struct + */ + sysfs_remove_file(&chip->cdev.dev->kobj, + &((struct attribute){.name = "trigger"})); +#endif pr_info("Vibrator LDO successfully registered: gpio = %d\n",chip->en_gpio); return 0;