diff --git a/drivers/input/misc/qti-haptics.c b/drivers/input/misc/qti-haptics.c index 00be2b0983f18..752f6ccd57f49 100644 --- a/drivers/input/misc/qti-haptics.c +++ b/drivers/input/misc/qti-haptics.c @@ -225,7 +225,7 @@ struct qti_hap_chip { bool vdd_enabled; }; -extern bool miuirom; +extern bool hapticsqti; static int wf_repeat[8] = {1, 2, 4, 8, 16, 32, 64, 128}; static int wf_s_repeat[4] = {1, 2, 4, 8}; const static char * const wf_src_str[] = {"vmax", "buffer", "audio", "pwm"}; @@ -1935,7 +1935,7 @@ static int qti_haptics_probe(struct platform_device *pdev) struct ff_device *ff; int rc = 0, effect_count_max; - if (miuirom) + if (!hapticsqti) return -1; chip = devm_kzalloc(&pdev->dev, sizeof(*chip), GFP_KERNEL); diff --git a/drivers/soc/qcom/qpnp-haptic.c b/drivers/soc/qcom/qpnp-haptic.c index 7e7d9354abb0a..bdbc0cde6f8db 100644 --- a/drivers/soc/qcom/qpnp-haptic.c +++ b/drivers/soc/qcom/qpnp-haptic.c @@ -175,6 +175,7 @@ u32 adjusted_lra_play_rate_code[ADJUSTED_LRA_PLAY_RATE_CODE_ARRSIZE]; +extern bool hapticsqti; /* haptic debug register set */ static u8 qpnp_hap_dbg_regs[] = { 0x0a, 0x0b, 0x0c, 0x46, 0x48, 0x4c, 0x4d, 0x4e, 0x4f, 0x51, 0x52, 0x53, @@ -3214,13 +3215,19 @@ static struct platform_driver qpnp_haptic_driver = { static int __init qpnp_haptic_init(void) { - return platform_driver_register(&qpnp_haptic_driver); + if (hapticsqti) + return 0; + else + return platform_driver_register(&qpnp_haptic_driver); } module_init(qpnp_haptic_init); static void __exit qpnp_haptic_exit(void) { - return platform_driver_unregister(&qpnp_haptic_driver); + if (hapticsqti) + return; + else + platform_driver_unregister(&qpnp_haptic_driver); } module_exit(qpnp_haptic_exit); diff --git a/init/main.c b/init/main.c index baad6f6b40de2..48813ea62020e 100644 --- a/init/main.c +++ b/init/main.c @@ -308,6 +308,28 @@ static int __init set_selenforce_fake(char *val) return 0; } __setup("selfake=", set_selenforce_fake); +bool hapticsqti = false; +static int __init set_qtihaptics_rom(char *val) +{ + unsigned int temp; + + get_option(&val, &temp); + + if (miuirom) { + hapticsqti = false; + } else { + if (temp) { + hapticsqti = true; + } else { + hapticsqti = false; + } + } + + return 0; +} +__setup("qtihaptics=", set_qtihaptics_rom); +EXPORT_SYMBOL_GPL(hapticsqti); + /* * Used to generate warnings if static_key manipulation functions are used * before jump_label_init is called.