Lines Matching refs:mei_dev
78 static int mei_vsc_fw_status(struct mei_device *mei_dev, in mei_vsc_fw_status() argument
89 static inline enum mei_pg_state mei_vsc_pg_state(struct mei_device *mei_dev) in mei_vsc_pg_state() argument
94 static void mei_vsc_intr_enable(struct mei_device *mei_dev) in mei_vsc_intr_enable() argument
96 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev); in mei_vsc_intr_enable()
101 static void mei_vsc_intr_disable(struct mei_device *mei_dev) in mei_vsc_intr_disable() argument
103 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev); in mei_vsc_intr_disable()
109 static void mei_vsc_intr_clear(struct mei_device *mei_dev) in mei_vsc_intr_clear() argument
114 static void mei_vsc_synchronize_irq(struct mei_device *mei_dev) in mei_vsc_synchronize_irq() argument
116 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev); in mei_vsc_synchronize_irq()
121 static int mei_vsc_hw_config(struct mei_device *mei_dev) in mei_vsc_hw_config() argument
126 static bool mei_vsc_host_is_ready(struct mei_device *mei_dev) in mei_vsc_host_is_ready() argument
128 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev); in mei_vsc_host_is_ready()
133 static bool mei_vsc_hw_is_ready(struct mei_device *mei_dev) in mei_vsc_hw_is_ready() argument
135 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev); in mei_vsc_hw_is_ready()
140 static int mei_vsc_hw_start(struct mei_device *mei_dev) in mei_vsc_hw_start() argument
142 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev); in mei_vsc_hw_start()
155 dev_err(mei_dev->dev, "wait fw ready failed: %d\n", ret); in mei_vsc_hw_start()
164 static bool mei_vsc_hbuf_is_ready(struct mei_device *mei_dev) in mei_vsc_hbuf_is_ready() argument
166 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev); in mei_vsc_hbuf_is_ready()
171 static int mei_vsc_hbuf_empty_slots(struct mei_device *mei_dev) in mei_vsc_hbuf_empty_slots() argument
176 static u32 mei_vsc_hbuf_depth(const struct mei_device *mei_dev) in mei_vsc_hbuf_depth() argument
181 static int mei_vsc_write(struct mei_device *mei_dev, in mei_vsc_write() argument
185 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev); in mei_vsc_write()
207 static inline u32 mei_vsc_read(const struct mei_device *mei_dev) in mei_vsc_read() argument
209 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev); in mei_vsc_read()
222 static int mei_vsc_count_full_read_slots(struct mei_device *mei_dev) in mei_vsc_count_full_read_slots() argument
227 static int mei_vsc_read_slots(struct mei_device *mei_dev, unsigned char *buf, in mei_vsc_read_slots() argument
230 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev); in mei_vsc_read_slots()
242 static bool mei_vsc_pg_in_transition(struct mei_device *mei_dev) in mei_vsc_pg_in_transition() argument
244 return mei_dev->pg_event >= MEI_PG_EVENT_WAIT && in mei_vsc_pg_in_transition()
245 mei_dev->pg_event <= MEI_PG_EVENT_INTR_WAIT; in mei_vsc_pg_in_transition()
248 static bool mei_vsc_pg_is_enabled(struct mei_device *mei_dev) in mei_vsc_pg_is_enabled() argument
253 static int mei_vsc_hw_reset(struct mei_device *mei_dev, bool intr_enable) in mei_vsc_hw_reset() argument
255 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev); in mei_vsc_hw_reset()
261 return vsc_tp_init(hw->tp, mei_dev->dev); in mei_vsc_hw_reset()
294 struct mei_device *mei_dev = context; in mei_vsc_event_cb() local
295 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev); in mei_vsc_event_cb()
300 if (mei_dev->dev_state == MEI_DEV_RESETTING || in mei_vsc_event_cb()
301 mei_dev->dev_state == MEI_DEV_INITIALIZING) in mei_vsc_event_cb()
306 guard(mutex)(&mei_dev->device_lock); in mei_vsc_event_cb()
310 slots = mei_count_full_read_slots(mei_dev); in mei_vsc_event_cb()
312 ret = mei_irq_read_handler(mei_dev, &cmpl_list, &slots); in mei_vsc_event_cb()
315 if (mei_dev->dev_state != MEI_DEV_RESETTING && in mei_vsc_event_cb()
316 mei_dev->dev_state != MEI_DEV_POWER_DOWN) in mei_vsc_event_cb()
317 schedule_work(&mei_dev->reset_work); in mei_vsc_event_cb()
324 mei_dev->hbuf_is_ready = mei_hbuf_is_ready(mei_dev); in mei_vsc_event_cb()
325 ret = mei_irq_write_handler(mei_dev, &cmpl_list); in mei_vsc_event_cb()
327 dev_err(mei_dev->dev, "dispatch write request failed: %d\n", ret); in mei_vsc_event_cb()
329 mei_dev->hbuf_is_ready = mei_hbuf_is_ready(mei_dev); in mei_vsc_event_cb()
330 mei_irq_compl_handler(mei_dev, &cmpl_list); in mei_vsc_event_cb()
336 struct mei_device *mei_dev; in mei_vsc_probe() local
345 mei_dev = devm_kzalloc(dev, size_add(sizeof(*mei_dev), sizeof(*hw)), in mei_vsc_probe()
347 if (!mei_dev) in mei_vsc_probe()
350 mei_device_init(mei_dev, dev, false, &mei_vsc_hw_ops); in mei_vsc_probe()
351 mei_dev->fw_f_fw_ver_supported = 0; in mei_vsc_probe()
352 mei_dev->kind = "ivsc"; in mei_vsc_probe()
354 hw = mei_dev_to_vsc_hw(mei_dev); in mei_vsc_probe()
358 platform_set_drvdata(pdev, mei_dev); in mei_vsc_probe()
360 vsc_tp_register_event_cb(tp, mei_vsc_event_cb, mei_dev); in mei_vsc_probe()
362 ret = mei_start(mei_dev); in mei_vsc_probe()
368 ret = mei_register(mei_dev, dev); in mei_vsc_probe()
372 pm_runtime_enable(mei_dev->dev); in mei_vsc_probe()
377 mei_stop(mei_dev); in mei_vsc_probe()
380 mei_cancel_work(mei_dev); in mei_vsc_probe()
382 mei_disable_interrupts(mei_dev); in mei_vsc_probe()
389 struct mei_device *mei_dev = platform_get_drvdata(pdev); in mei_vsc_remove() local
391 pm_runtime_disable(mei_dev->dev); in mei_vsc_remove()
393 mei_stop(mei_dev); in mei_vsc_remove()
395 mei_disable_interrupts(mei_dev); in mei_vsc_remove()
397 mei_deregister(mei_dev); in mei_vsc_remove()
402 struct mei_device *mei_dev; in mei_vsc_suspend() local
405 mei_dev = dev_get_drvdata(dev); in mei_vsc_suspend()
406 if (!mei_dev) in mei_vsc_suspend()
409 mutex_lock(&mei_dev->device_lock); in mei_vsc_suspend()
411 if (!mei_write_is_idle(mei_dev)) in mei_vsc_suspend()
414 mutex_unlock(&mei_dev->device_lock); in mei_vsc_suspend()
421 struct mei_device *mei_dev; in mei_vsc_resume() local
423 mei_dev = dev_get_drvdata(dev); in mei_vsc_resume()
424 if (!mei_dev) in mei_vsc_resume()