mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 22:40:54 -04:00
Register mmi_relay notification for FOD
Register the mmi_relay notify to send the FOD state change events to touchscreen class. Change-Id: I532196304deac0788807652a0c636d41397c5802 Reviewed-on: https://gerrit.mot.com/1798309 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Konstantin Makariev <kmakariev@motorola.com> Reviewed-by: Jianqi Yang <yangj@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
a22d4e065e
commit
4e40cec475
3 changed files with 26 additions and 46 deletions
|
|
@ -5,5 +5,7 @@ include $(CLEAR_VARS)
|
|||
LOCAL_MODULE := goodix_fod_mmi.ko
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
|
||||
LOCAL_ADDITIONAL_DEPENDENCIES := $(KERNEL_MODULES_OUT)/mmi_relay.ko
|
||||
KBUILD_OPTIONS_GKI += GKI_OBJ_MODULE_DIR=gki
|
||||
include $(DLKM_DIR)/AndroidKernelModule.mk
|
||||
|
||||
|
|
|
|||
|
|
@ -7,3 +7,4 @@ goodix_fod_mmi-y += gf_spi.o netlink.o platform.o
|
|||
|
||||
obj-m += goodix_fod_mmi.o
|
||||
|
||||
KBUILD_EXTRA_SYMBOLS += $(CURDIR)/$(KBUILD_EXTMOD)/../../../mmi_relay/$(GKI_OBJ_MODULE_DIR)/Module.symvers
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include <linux/fb.h>
|
||||
#include <linux/pm_qos.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/fingerprint_mmi.h>
|
||||
#include <linux/mmi_relay.h>
|
||||
#include "gf_spi.h"
|
||||
|
||||
#if defined(USE_SPI_BUS)
|
||||
|
|
@ -96,7 +96,7 @@ static struct gf_key_map maps[] = {
|
|||
struct FPS_data {
|
||||
unsigned int enabled;
|
||||
unsigned int state;
|
||||
struct blocking_notifier_head nhead;
|
||||
struct notifier_block relay_notif;
|
||||
} *fpsData;
|
||||
|
||||
static void gf_enable_irq(struct gf_dev *gf_dev)
|
||||
|
|
@ -119,62 +119,40 @@ static void gf_disable_irq(struct gf_dev *gf_dev)
|
|||
}
|
||||
}
|
||||
|
||||
struct FPS_data *FPS_init(struct device *dev)
|
||||
static int fps_mmi_relay_cb(struct notifier_block *self,
|
||||
unsigned long event, void *p)
|
||||
{
|
||||
struct FPS_data *mdata = container_of(
|
||||
self, struct FPS_data, relay_notif);
|
||||
|
||||
if (!mdata)
|
||||
return -ENODEV;
|
||||
|
||||
if (event == RELAY_NOTIFY_REGISTER) {
|
||||
int state = mdata->state;
|
||||
mdata->enabled = 1;
|
||||
/* send current FPS state on register request */
|
||||
relay_notifier_fire(BLOCKING, FPS, 0xBEEF, (void *)&state);
|
||||
pr_info("%s: FPS reported state %d\n", __func__, state);
|
||||
|
||||
} else if (event == RELAY_NOTIFY_UNREGISTER)
|
||||
mdata->enabled = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct FPS_data *FPS_init(struct device *dev)
|
||||
{
|
||||
struct FPS_data *mdata = devm_kzalloc(dev,
|
||||
sizeof(struct FPS_data), GFP_KERNEL);
|
||||
if (mdata) {
|
||||
BLOCKING_INIT_NOTIFIER_HEAD(&mdata->nhead);
|
||||
pr_debug("%s: FPS notifier data structure init-ed\n", __func__);
|
||||
}
|
||||
|
||||
mdata->relay_notif.notifier_call = fps_mmi_relay_cb;
|
||||
/* register a blocking notification to receive notify form MMI_RELAY dev*/
|
||||
relay_register_action(BLOCKING, MMI_RELAY, &mdata->relay_notif);
|
||||
|
||||
return mdata;
|
||||
}
|
||||
|
||||
int FPS_register_notifier(struct notifier_block *nb,
|
||||
unsigned long stype, bool report)
|
||||
{
|
||||
int error;
|
||||
struct FPS_data *mdata = fpsData;
|
||||
|
||||
if (!mdata)
|
||||
return -ENODEV;
|
||||
|
||||
mdata->enabled = (unsigned int)stype;
|
||||
pr_info("%s: FPS sensor %lu notifier enabled\n", __func__, stype);
|
||||
|
||||
error = blocking_notifier_chain_register(&mdata->nhead, nb);
|
||||
if (!error && report) {
|
||||
int state = mdata->state;
|
||||
/* send current FPS state on register request */
|
||||
blocking_notifier_call_chain(&mdata->nhead,
|
||||
stype, (void *)&state);
|
||||
pr_debug("%s: FPS reported state %d\n", __func__, state);
|
||||
}
|
||||
return error;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(FPS_register_notifier);
|
||||
|
||||
int FPS_unregister_notifier(struct notifier_block *nb,
|
||||
unsigned long stype)
|
||||
{
|
||||
int error;
|
||||
struct FPS_data *mdata = fpsData;
|
||||
|
||||
if (!mdata)
|
||||
return -ENODEV;
|
||||
|
||||
error = blocking_notifier_chain_unregister(&mdata->nhead, nb);
|
||||
pr_debug("%s: FPS sensor %lu notifier unregister\n", __func__, stype);
|
||||
|
||||
if (!mdata->nhead.head) {
|
||||
mdata->enabled = 0;
|
||||
pr_info("%s: FPS sensor %lu no clients\n", __func__, stype);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(FPS_unregister_notifier);
|
||||
|
||||
void FPS_notify(unsigned long stype, int state)
|
||||
{
|
||||
struct FPS_data *mdata = fpsData;
|
||||
|
|
@ -194,8 +172,7 @@ void FPS_notify(unsigned long stype, int state)
|
|||
|
||||
if (mdata->state != state) {
|
||||
mdata->state = state;
|
||||
blocking_notifier_call_chain(&mdata->nhead,
|
||||
stype, (void *)&state);
|
||||
relay_notifier_fire(BLOCKING, FPS, 0xBEEF, (void *)&state);
|
||||
pr_debug("%s: FPS notification sent\n", __func__);
|
||||
} else
|
||||
pr_warn("%s: mdata->state==state", __func__);
|
||||
|
|
|
|||
Loading…
Reference in a new issue