Skip to content

Commit

Permalink
qti_haptics: rework for co-exitence with qpnp_haptics, allow only for…
Browse files Browse the repository at this point in the history
… AOSP (Part 2)
  • Loading branch information
psndna88 committed Dec 30, 2021
1 parent 92fb844 commit 2200f49
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
4 changes: 2 additions & 2 deletions drivers/input/misc/qti-haptics.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"};
Expand Down Expand Up @@ -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);
Expand Down
11 changes: 9 additions & 2 deletions drivers/soc/qcom/qpnp-haptic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);

Expand Down
22 changes: 22 additions & 0 deletions init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 2200f49

Please sign in to comment.