gsc-me.c (ce97126d6c1825fc7b3dd21a66a83458055bcbd7) | gsc-me.c (ad10a35461a5fc4e4d09a7259ede2508f042c6dd) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright(c) 2019-2022, Intel Corporation. All rights reserved. 4 * 5 * Intel Management Engine Interface (Intel MEI) Linux driver 6 */ 7 8#include <linux/module.h> --- 145 unchanged lines hidden (view full) --- 154 return err; 155 156 /* Start timer if stopped in suspend */ 157 schedule_delayed_work(&dev->timer_work, HZ); 158 159 return 0; 160} 161 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright(c) 2019-2022, Intel Corporation. All rights reserved. 4 * 5 * Intel Management Engine Interface (Intel MEI) Linux driver 6 */ 7 8#include <linux/module.h> --- 145 unchanged lines hidden (view full) --- 154 return err; 155 156 /* Start timer if stopped in suspend */ 157 schedule_delayed_work(&dev->timer_work, HZ); 158 159 return 0; 160} 161 |
162static SIMPLE_DEV_PM_OPS(mei_gsc_pm_ops, mei_gsc_pm_suspend, mei_gsc_pm_resume); | 162static int __maybe_unused mei_gsc_pm_runtime_idle(struct device *device) 163{ 164 struct mei_device *dev = dev_get_drvdata(device); |
163 | 165 |
166 if (!dev) 167 return -ENODEV; 168 if (mei_write_is_idle(dev)) 169 pm_runtime_autosuspend(device); 170 171 return -EBUSY; 172} 173 174static int __maybe_unused mei_gsc_pm_runtime_suspend(struct device *device) 175{ 176 struct mei_device *dev = dev_get_drvdata(device); 177 struct mei_me_hw *hw; 178 int ret; 179 180 if (!dev) 181 return -ENODEV; 182 183 mutex_lock(&dev->device_lock); 184 185 if (mei_write_is_idle(dev)) { 186 hw = to_me_hw(dev); 187 hw->pg_state = MEI_PG_ON; 188 ret = 0; 189 } else { 190 ret = -EAGAIN; 191 } 192 193 mutex_unlock(&dev->device_lock); 194 195 return ret; 196} 197 198static int __maybe_unused mei_gsc_pm_runtime_resume(struct device *device) 199{ 200 struct mei_device *dev = dev_get_drvdata(device); 201 struct mei_me_hw *hw; 202 irqreturn_t irq_ret; 203 204 if (!dev) 205 return -ENODEV; 206 207 mutex_lock(&dev->device_lock); 208 209 hw = to_me_hw(dev); 210 hw->pg_state = MEI_PG_OFF; 211 212 mutex_unlock(&dev->device_lock); 213 214 irq_ret = mei_me_irq_thread_handler(1, dev); 215 if (irq_ret != IRQ_HANDLED) 216 dev_err(dev->dev, "thread handler fail %d\n", irq_ret); 217 218 return 0; 219} 220 221static const struct dev_pm_ops mei_gsc_pm_ops = { 222 SET_SYSTEM_SLEEP_PM_OPS(mei_gsc_pm_suspend, 223 mei_gsc_pm_resume) 224 SET_RUNTIME_PM_OPS(mei_gsc_pm_runtime_suspend, 225 mei_gsc_pm_runtime_resume, 226 mei_gsc_pm_runtime_idle) 227}; 228 |
|
164static const struct auxiliary_device_id mei_gsc_id_table[] = { 165 { 166 .name = "i915.mei-gsc", 167 .driver_data = MEI_ME_GSC_CFG, 168 169 }, 170 { 171 .name = "i915.mei-gscfi", --- 23 unchanged lines hidden --- | 229static const struct auxiliary_device_id mei_gsc_id_table[] = { 230 { 231 .name = "i915.mei-gsc", 232 .driver_data = MEI_ME_GSC_CFG, 233 234 }, 235 { 236 .name = "i915.mei-gscfi", --- 23 unchanged lines hidden --- |