mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
iio: hid-sensors: use asynchronous resume
Some platforms power off sensor hubs during S3 suspend, which will require longer time to resume. This hurts system resume time, so resume asynchronously. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
ace4cdfe67
commit
7f6cf74145
@ -122,6 +122,14 @@ int hid_sensor_power_state(struct hid_sensor_common *st, bool state)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void hid_sensor_set_power_work(struct work_struct *work)
|
||||||
|
{
|
||||||
|
struct hid_sensor_common *attrb = container_of(work,
|
||||||
|
struct hid_sensor_common,
|
||||||
|
work);
|
||||||
|
_hid_sensor_power_state(attrb, true);
|
||||||
|
}
|
||||||
|
|
||||||
static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig,
|
static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig,
|
||||||
bool state)
|
bool state)
|
||||||
{
|
{
|
||||||
@ -130,6 +138,7 @@ static int hid_sensor_data_rdy_trigger_set_state(struct iio_trigger *trig,
|
|||||||
|
|
||||||
void hid_sensor_remove_trigger(struct hid_sensor_common *attrb)
|
void hid_sensor_remove_trigger(struct hid_sensor_common *attrb)
|
||||||
{
|
{
|
||||||
|
cancel_work_sync(&attrb->work);
|
||||||
iio_trigger_unregister(attrb->trigger);
|
iio_trigger_unregister(attrb->trigger);
|
||||||
iio_trigger_free(attrb->trigger);
|
iio_trigger_free(attrb->trigger);
|
||||||
}
|
}
|
||||||
@ -170,6 +179,9 @@ int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name,
|
|||||||
goto error_unreg_trigger;
|
goto error_unreg_trigger;
|
||||||
|
|
||||||
iio_device_set_drvdata(indio_dev, attrb);
|
iio_device_set_drvdata(indio_dev, attrb);
|
||||||
|
|
||||||
|
INIT_WORK(&attrb->work, hid_sensor_set_power_work);
|
||||||
|
|
||||||
pm_suspend_ignore_children(&attrb->pdev->dev, true);
|
pm_suspend_ignore_children(&attrb->pdev->dev, true);
|
||||||
pm_runtime_enable(&attrb->pdev->dev);
|
pm_runtime_enable(&attrb->pdev->dev);
|
||||||
/* Default to 3 seconds, but can be changed from sysfs */
|
/* Default to 3 seconds, but can be changed from sysfs */
|
||||||
@ -202,7 +214,15 @@ static int hid_sensor_resume(struct device *dev)
|
|||||||
struct platform_device *pdev = to_platform_device(dev);
|
struct platform_device *pdev = to_platform_device(dev);
|
||||||
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
|
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
|
||||||
struct hid_sensor_common *attrb = iio_device_get_drvdata(indio_dev);
|
struct hid_sensor_common *attrb = iio_device_get_drvdata(indio_dev);
|
||||||
|
schedule_work(&attrb->work);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int hid_sensor_runtime_resume(struct device *dev)
|
||||||
|
{
|
||||||
|
struct platform_device *pdev = to_platform_device(dev);
|
||||||
|
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
|
||||||
|
struct hid_sensor_common *attrb = iio_device_get_drvdata(indio_dev);
|
||||||
return _hid_sensor_power_state(attrb, true);
|
return _hid_sensor_power_state(attrb, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +231,7 @@ static int hid_sensor_resume(struct device *dev)
|
|||||||
const struct dev_pm_ops hid_sensor_pm_ops = {
|
const struct dev_pm_ops hid_sensor_pm_ops = {
|
||||||
SET_SYSTEM_SLEEP_PM_OPS(hid_sensor_suspend, hid_sensor_resume)
|
SET_SYSTEM_SLEEP_PM_OPS(hid_sensor_suspend, hid_sensor_resume)
|
||||||
SET_RUNTIME_PM_OPS(hid_sensor_suspend,
|
SET_RUNTIME_PM_OPS(hid_sensor_suspend,
|
||||||
hid_sensor_resume, NULL)
|
hid_sensor_runtime_resume, NULL)
|
||||||
};
|
};
|
||||||
EXPORT_SYMBOL(hid_sensor_pm_ops);
|
EXPORT_SYMBOL(hid_sensor_pm_ops);
|
||||||
|
|
||||||
|
@ -236,6 +236,7 @@ struct hid_sensor_common {
|
|||||||
struct hid_sensor_hub_attribute_info report_state;
|
struct hid_sensor_hub_attribute_info report_state;
|
||||||
struct hid_sensor_hub_attribute_info power_state;
|
struct hid_sensor_hub_attribute_info power_state;
|
||||||
struct hid_sensor_hub_attribute_info sensitivity;
|
struct hid_sensor_hub_attribute_info sensitivity;
|
||||||
|
struct work_struct work;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Convert from hid unit expo to regular exponent */
|
/* Convert from hid unit expo to regular exponent */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user