Lines Matching defs:mei_dev
24 #include "mei_dev.h"
78 static int mei_vsc_fw_status(struct mei_device *mei_dev,
89 static inline enum mei_pg_state mei_vsc_pg_state(struct mei_device *mei_dev)
94 static void mei_vsc_intr_enable(struct mei_device *mei_dev)
96 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
101 static void mei_vsc_intr_disable(struct mei_device *mei_dev)
103 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
109 static void mei_vsc_intr_clear(struct mei_device *mei_dev)
114 static void mei_vsc_synchronize_irq(struct mei_device *mei_dev)
116 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
121 static int mei_vsc_hw_config(struct mei_device *mei_dev)
126 static bool mei_vsc_host_is_ready(struct mei_device *mei_dev)
128 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
133 static bool mei_vsc_hw_is_ready(struct mei_device *mei_dev)
135 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
140 static int mei_vsc_hw_start(struct mei_device *mei_dev)
142 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
155 dev_err(mei_dev->dev, "wait fw ready failed: %d\n", ret);
164 static bool mei_vsc_hbuf_is_ready(struct mei_device *mei_dev)
166 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
171 static int mei_vsc_hbuf_empty_slots(struct mei_device *mei_dev)
176 static u32 mei_vsc_hbuf_depth(const struct mei_device *mei_dev)
181 static int mei_vsc_write(struct mei_device *mei_dev,
185 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
207 static inline u32 mei_vsc_read(const struct mei_device *mei_dev)
209 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
222 static int mei_vsc_count_full_read_slots(struct mei_device *mei_dev)
227 static int mei_vsc_read_slots(struct mei_device *mei_dev, unsigned char *buf,
230 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
242 static bool mei_vsc_pg_in_transition(struct mei_device *mei_dev)
244 return mei_dev->pg_event >= MEI_PG_EVENT_WAIT &&
245 mei_dev->pg_event <= MEI_PG_EVENT_INTR_WAIT;
248 static bool mei_vsc_pg_is_enabled(struct mei_device *mei_dev)
253 static int mei_vsc_hw_reset(struct mei_device *mei_dev, bool intr_enable)
255 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
262 return vsc_tp_init(hw->tp, mei_dev->dev);
295 struct mei_device *mei_dev = context;
296 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
301 if (mei_dev->dev_state == MEI_DEV_RESETTING ||
302 mei_dev->dev_state == MEI_DEV_INITIALIZING)
307 guard(mutex)(&mei_dev->device_lock);
311 slots = mei_count_full_read_slots(mei_dev);
313 ret = mei_irq_read_handler(mei_dev, &cmpl_list, &slots);
316 if (mei_dev->dev_state != MEI_DEV_RESETTING &&
317 mei_dev->dev_state != MEI_DEV_POWER_DOWN)
318 schedule_work(&mei_dev->reset_work);
325 mei_dev->hbuf_is_ready = mei_hbuf_is_ready(mei_dev);
326 ret = mei_irq_write_handler(mei_dev, &cmpl_list);
328 dev_err(mei_dev->dev, "dispatch write request failed: %d\n", ret);
330 mei_dev->hbuf_is_ready = mei_hbuf_is_ready(mei_dev);
331 mei_irq_compl_handler(mei_dev, &cmpl_list);
337 struct mei_device *mei_dev;
346 mei_dev = devm_kzalloc(dev, size_add(sizeof(*mei_dev), sizeof(*hw)),
348 if (!mei_dev)
351 mei_device_init(mei_dev, dev, false, &mei_vsc_hw_ops);
352 mei_dev->fw_f_fw_ver_supported = 0;
353 mei_dev->kind = "ivsc";
355 hw = mei_dev_to_vsc_hw(mei_dev);
359 platform_set_drvdata(pdev, mei_dev);
361 vsc_tp_register_event_cb(tp, mei_vsc_event_cb, mei_dev);
363 ret = mei_start(mei_dev);
369 ret = mei_register(mei_dev, dev);
373 pm_runtime_enable(mei_dev->dev);
378 mei_stop(mei_dev);
381 mei_cancel_work(mei_dev);
385 mei_disable_interrupts(mei_dev);
392 struct mei_device *mei_dev = platform_get_drvdata(pdev);
393 struct mei_vsc_hw *hw = mei_dev_to_vsc_hw(mei_dev);
395 pm_runtime_disable(mei_dev->dev);
397 mei_stop(mei_dev);
401 mei_disable_interrupts(mei_dev);
403 mei_deregister(mei_dev);
408 struct mei_device *mei_dev;
411 mei_dev = dev_get_drvdata(dev);
412 if (!mei_dev)
415 mutex_lock(&mei_dev->device_lock);
417 if (!mei_write_is_idle(mei_dev))
420 mutex_unlock(&mei_dev->device_lock);
427 struct mei_device *mei_dev;
429 mei_dev = dev_get_drvdata(dev);
430 if (!mei_dev)