Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 760e91dd authored by Anirudh Ghayal's avatar Anirudh Ghayal
Browse files

input: qti-haptics: Add module_param to enable haptics-twm config



Add a module_param to runtime enable the haptics TWM mode
configuration. This provides clients to selectively enable
haptics in TWM.

The sysfs path is sys/module/qti_haptics/parameters/haptics_twm.

Change-Id: Ic5914f90ed9abbe5230b01de682b020c1f928a41
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent 84a4de85
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -254,6 +254,11 @@ static struct hap_addr_val twm_ext_cfg[] = {
static int wf_repeat[8] = {1, 2, 4, 8, 16, 32, 64, 128};
static int wf_s_repeat[4] = {1, 2, 4, 8};

static int twm_sys_enable;
module_param_named(
	haptics_twm, twm_sys_enable, int, 0600
);

static inline bool is_secure(u8 addr)
{
	return ((addr & 0xFF) > 0xD0);
@@ -2028,6 +2033,7 @@ static void qti_haptics_shutdown(struct platform_device *pdev)
{
	struct qti_hap_chip *chip = dev_get_drvdata(&pdev->dev);
	int rc;
	bool enable_haptics_twm;

	dev_dbg(chip->dev, "Shutdown!\n");

@@ -2043,7 +2049,9 @@ static void qti_haptics_shutdown(struct platform_device *pdev)
		chip->vdd_enabled = false;
	}

	if (chip->twm_state == PMIC_TWM_ENABLE && chip->haptics_ext_pin_twm) {
	enable_haptics_twm = chip->haptics_ext_pin_twm && twm_sys_enable;

	if (chip->twm_state == PMIC_TWM_ENABLE && enable_haptics_twm) {
		rc = qti_haptics_twm_config(chip);
		if (rc < 0)
			pr_err("Haptics TWM config failed rc=%d\n", rc);