mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 16:46:15 -04:00
touchscreen_mmi: Add default pinctrl methord
If ts_mmi_on_state or ts_mmi_off_state pinctrl states is defined, and vendor method not defined it's pinctrl callback function. Add default pinctrl function for this situation. Change-Id: I5873980ee6425b22af1af416228481af1abe360d Signed-off-by: haojl2 <haojl2@motorola.com> Reviewed-on: https://gerrit.mot.com/1553615 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: <litong20@motorola.com> Reviewed-by: Jianqi Yang <yangj@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
82c12d6329
commit
843da210a8
2 changed files with 39 additions and 0 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#include <linux/string.h>
|
||||
#include <linux/major.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
|
||||
#define FMT_STRING "%s"
|
||||
#define FMT_INTEGER "%d"
|
||||
|
|
@ -493,6 +494,28 @@ static int get_class_fname_handler(struct device *parent, const char **pfname)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ts_mmi_default_pinctrl(struct device *parent, int on)
|
||||
{
|
||||
struct ts_mmi_dev *touch_cdev = ts_mmi_dev_to_cdev(parent);
|
||||
|
||||
if (!touch_cdev)
|
||||
return -ENODEV;
|
||||
|
||||
dev_info(DEV_TS, "%s: %s\n", __func__, on ? "ACTIVE" : "SUSPEND");
|
||||
|
||||
if (on) {
|
||||
if (!IS_ERR_OR_NULL(touch_cdev->pinctrl_on_state))
|
||||
pinctrl_select_state(touch_cdev->pinctrl_node,
|
||||
touch_cdev->pinctrl_on_state);
|
||||
} else {
|
||||
if (!IS_ERR_OR_NULL(touch_cdev->pinctrl_off_state))
|
||||
pinctrl_select_state(touch_cdev->pinctrl_node,
|
||||
touch_cdev->pinctrl_off_state);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* ts_mmi_dev_register - register a new object of ts_mmi_dev class.
|
||||
* @parent: The device to register.
|
||||
|
|
@ -525,6 +548,19 @@ int ts_mmi_dev_register(struct device *parent,
|
|||
goto PANEL_PARSE_DT_FAILED;
|
||||
}
|
||||
|
||||
touch_cdev->pinctrl_node = devm_pinctrl_get(DEV_TS);
|
||||
if (IS_ERR_OR_NULL(touch_cdev->pinctrl_node)) {
|
||||
dev_info(DEV_TS, "%s: No pinctrl defined\n", __func__);
|
||||
} else if (!touch_cdev->mdata->pinctrl) {
|
||||
touch_cdev->pinctrl_on_state = pinctrl_lookup_state(touch_cdev->pinctrl_node, "ts_mmi_on_state");
|
||||
touch_cdev->pinctrl_off_state = pinctrl_lookup_state(touch_cdev->pinctrl_node, "ts_mmi_off_state");
|
||||
if (!IS_ERR_OR_NULL(touch_cdev->pinctrl_on_state) ||
|
||||
!IS_ERR_OR_NULL(touch_cdev->pinctrl_off_state)) {
|
||||
dev_info(DEV_TS, "%s: No pinctrl method add default\n", __func__);
|
||||
touch_cdev->mdata->pinctrl = ts_mmi_default_pinctrl;
|
||||
}
|
||||
}
|
||||
|
||||
ts_mmi_get_vendor_info(touch_cdev);
|
||||
|
||||
ret = input_get_new_minor(-1, 1, true);
|
||||
|
|
|
|||
|
|
@ -266,6 +266,9 @@ struct ts_mmi_dev {
|
|||
struct notifier_block panel_nb;
|
||||
struct mutex extif_mutex;
|
||||
struct mutex method_mutex;
|
||||
struct pinctrl *pinctrl_node;
|
||||
struct pinctrl_state *pinctrl_on_state;
|
||||
struct pinctrl_state *pinctrl_off_state;
|
||||
|
||||
atomic_t touch_stopped;
|
||||
enum ts_mmi_pm_mode pm_mode;
|
||||
|
|
|
|||
Loading…
Reference in a new issue