synaptics_mmi: create power on sysfs entry first

With introduction DRM support, we need to make touch firmware
upgrade script waiting until driver becomes ready to perform
an upgrade. This change creates power on sysfs entry in the
driver's probe to indicate that firmware upgrade has to wait
until touch IC gets ready after it receives DRM framework
notification.

Change-Id: Ib5d8ed5f638890498fc4414c081dfaaa234063d7
Signed-off-by: Konstantin Makariev <hcv867@motorola.com>
Reviewed-on: https://gerrit.mot.com/1257955
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Konstantin Makariev <kmakariev@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Konstantin Makariev 2018-10-18 16:08:56 -05:00 • committed by Konstantin Makariev
commit 123b556efa

View file

@ -2350,9 +2350,6 @@ static struct device_attribute attrs[] = {
__ATTR(ic_ver, S_IRUGO,
synaptics_rmi4_ic_ver_show,
synaptics_rmi4_store_error),
__ATTR(poweron, S_IRUSR | S_IRGRP,
synaptics_rmi4_poweron_show,
synaptics_rmi4_store_error),
__ATTR(mod, (S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP),
synaptics_rmi4_mod_show,
synaptics_rmi4_mod_store),
@ -2378,6 +2375,9 @@ static struct device_attribute attrs[] = {
#endif
};
static DEVICE_ATTR(poweron, S_IRUSR | S_IRGRP,
synaptics_rmi4_poweron_show, synaptics_rmi4_store_error);
struct synaptics_exp_fn_ctrl {
bool inited;
struct mutex list_mutex;
@ -6687,9 +6687,12 @@ static void synaptics_rmi4_detection_work(struct work_struct *work)
synaptics_rmi4_remove(exp_fn_ctrl.i2c_client);
pr_info("driver removed\n");
} else if (all_inserted) {
synaptics_rmi4_resume(&(rmi4_data->i2c_client->dev));
#if 0
/* enable interrupt on handler's removal */
atomic_set(&rmi4_data->touch_stopped, 0);
synaptics_dsx_sensor_ready_state(rmi4_data, false);
#endif
pr_info("drm panel ready\n");
} else {
queue_delayed_work(exp_fn_ctrl.det_workqueue,
@ -7395,6 +7398,8 @@ err_sysfs:
&attrs[attr_count].attr);
}
device_remove_file(&rmi4_data->i2c_client->dev, &dev_attr_poweron);
#if defined(CONFIG_MMI_PANEL_NOTIFICATIONS)
mmi_panel_unregister_notifier(&rmi4_data->panel_nb);
#elif defined(CONFIG_DRM)
@ -7465,6 +7470,7 @@ static void dummy_remove(struct synaptics_rmi4_data *rmi4_data)
static int synaptics_rmi4_probe(struct i2c_client *client,
const struct i2c_device_id *dev_id)
{
int rc;
struct synaptics_rmi4_data *rmi4_data;
struct synaptics_dsx_platform_data *platform_data;
@ -7550,6 +7556,15 @@ static int synaptics_rmi4_probe(struct i2c_client *client,
exp_fn_ctrl.i2c_client = client;
mutex_unlock(&exp_fn_ctrl_mutex);
rc = device_create_file(&client->dev, &dev_attr_poweron);
if (rc < 0) {
dev_err(&client->dev,
"%s: Cannot create poweron\n",
__func__);
kfree(rmi4_data);
return rc;
}
if (!rmi4_data->splash_screen_mode)
return synaptics_rmi4_hw_init(rmi4_data);
@ -7596,6 +7611,8 @@ static int synaptics_rmi4_remove(struct i2c_client *client)
&attrs[attr_count].attr);
}
device_remove_file(&rmi4_data->i2c_client->dev, &dev_attr_poweron);
if (rmi4_data->input_registered)
input_unregister_device(rmi4_data->input_dev);
else