Lines Matching refs:dev

24 #define to_ishtp_cl_device(d) container_of(d, struct ishtp_cl_device, dev)
36 void ishtp_recv(struct ishtp_device *dev) in ishtp_recv() argument
42 msg_hdr = dev->ops->ishtp_read_hdr(dev); in ishtp_recv()
46 dev->ops->sync_fw_clock(dev); in ishtp_recv()
49 dev->ishtp_msg_hdr = msg_hdr; in ishtp_recv()
52 if (ishtp_hdr->length > dev->mtu) { in ishtp_recv()
53 dev_err(dev->devc, in ishtp_recv()
61 recv_hbm(dev, ishtp_hdr); in ishtp_recv()
64 recv_fixed_cl_msg(dev, ishtp_hdr); in ishtp_recv()
67 recv_ishtp_cl_msg(dev, ishtp_hdr); in ishtp_recv()
84 int ishtp_send_msg(struct ishtp_device *dev, struct ishtp_msg_hdr *hdr, in ishtp_send_msg() argument
91 drbl_val = dev->ops->ipc_get_header(dev, hdr->length + in ishtp_send_msg()
98 return dev->ops->write(dev, ipc_send_compl, ipc_send_compl_prm, in ishtp_send_msg()
113 int ishtp_write_message(struct ishtp_device *dev, struct ishtp_msg_hdr *hdr, in ishtp_write_message() argument
116 return ishtp_send_msg(dev, hdr, buf, NULL, NULL); in ishtp_write_message()
128 int ishtp_fw_cl_by_uuid(struct ishtp_device *dev, const guid_t *uuid) in ishtp_fw_cl_by_uuid() argument
132 for (i = 0; i < dev->fw_clients_num; ++i) { in ishtp_fw_cl_by_uuid()
133 if (guid_equal(uuid, &dev->fw_clients[i].props.protocol_name)) in ishtp_fw_cl_by_uuid()
149 struct ishtp_fw_client *ishtp_fw_cl_get_client(struct ishtp_device *dev, in ishtp_fw_cl_get_client() argument
155 spin_lock_irqsave(&dev->fw_clients_lock, flags); in ishtp_fw_cl_get_client()
156 i = ishtp_fw_cl_by_uuid(dev, uuid); in ishtp_fw_cl_get_client()
157 spin_unlock_irqrestore(&dev->fw_clients_lock, flags); in ishtp_fw_cl_get_client()
158 if (i < 0 || dev->fw_clients[i].props.fixed_address) in ishtp_fw_cl_get_client()
161 return &dev->fw_clients[i]; in ishtp_fw_cl_get_client()
188 int ishtp_fw_cl_by_id(struct ishtp_device *dev, uint8_t client_id) in ishtp_fw_cl_by_id() argument
193 spin_lock_irqsave(&dev->fw_clients_lock, flags); in ishtp_fw_cl_by_id()
194 for (i = 0; i < dev->fw_clients_num; i++) { in ishtp_fw_cl_by_id()
195 if (dev->fw_clients[i].client_id == client_id) { in ishtp_fw_cl_by_id()
200 spin_unlock_irqrestore(&dev->fw_clients_lock, flags); in ishtp_fw_cl_by_id()
213 static int ishtp_cl_device_probe(struct device *dev) in ishtp_cl_device_probe() argument
215 struct ishtp_cl_device *device = to_ishtp_cl_device(dev); in ishtp_cl_device_probe()
221 driver = to_ishtp_cl_driver(dev->driver); in ishtp_cl_device_probe()
239 static int ishtp_cl_bus_match(struct device *dev, struct device_driver *drv) in ishtp_cl_bus_match() argument
241 struct ishtp_cl_device *device = to_ishtp_cl_device(dev); in ishtp_cl_bus_match()
258 static void ishtp_cl_device_remove(struct device *dev) in ishtp_cl_device_remove() argument
260 struct ishtp_cl_device *device = to_ishtp_cl_device(dev); in ishtp_cl_device_remove()
261 struct ishtp_cl_driver *driver = to_ishtp_cl_driver(dev->driver); in ishtp_cl_device_remove()
280 static int ishtp_cl_device_suspend(struct device *dev) in ishtp_cl_device_suspend() argument
282 struct ishtp_cl_device *device = to_ishtp_cl_device(dev); in ishtp_cl_device_suspend()
289 driver = to_ishtp_cl_driver(dev->driver); in ishtp_cl_device_suspend()
292 ret = driver->driver.pm->suspend(dev); in ishtp_cl_device_suspend()
306 static int ishtp_cl_device_resume(struct device *dev) in ishtp_cl_device_resume() argument
308 struct ishtp_cl_device *device = to_ishtp_cl_device(dev); in ishtp_cl_device_resume()
315 driver = to_ishtp_cl_driver(dev->driver); in ishtp_cl_device_resume()
318 ret = driver->driver.pm->resume(dev); in ishtp_cl_device_resume()
341 driver = to_ishtp_cl_driver(device->dev.driver); in ishtp_cl_device_reset()
348 static ssize_t modalias_show(struct device *dev, struct device_attribute *a, in modalias_show() argument
353 len = snprintf(buf, PAGE_SIZE, ISHTP_MODULE_PREFIX "%s\n", dev_name(dev)); in modalias_show()
364 static int ishtp_cl_uevent(const struct device *dev, struct kobj_uevent_env *env) in ishtp_cl_uevent() argument
366 if (add_uevent_var(env, "MODALIAS=" ISHTP_MODULE_PREFIX "%s", dev_name(dev))) in ishtp_cl_uevent()
391 static void ishtp_cl_dev_release(struct device *dev) in ishtp_cl_dev_release() argument
393 kfree(to_ishtp_cl_device(dev)); in ishtp_cl_dev_release()
411 static struct ishtp_cl_device *ishtp_bus_add_device(struct ishtp_device *dev, in ishtp_bus_add_device() argument
418 spin_lock_irqsave(&dev->device_list_lock, flags); in ishtp_bus_add_device()
419 list_for_each_entry(device, &dev->device_list, device_link) { in ishtp_bus_add_device()
420 if (!strcmp(name, dev_name(&device->dev))) { in ishtp_bus_add_device()
421 device->fw_client = &dev->fw_clients[ in ishtp_bus_add_device()
422 dev->fw_client_presentation_num - 1]; in ishtp_bus_add_device()
423 spin_unlock_irqrestore(&dev->device_list_lock, flags); in ishtp_bus_add_device()
428 spin_unlock_irqrestore(&dev->device_list_lock, flags); in ishtp_bus_add_device()
434 device->dev.parent = dev->devc; in ishtp_bus_add_device()
435 device->dev.bus = &ishtp_cl_bus_type; in ishtp_bus_add_device()
436 device->dev.type = &ishtp_cl_device_type; in ishtp_bus_add_device()
437 device->ishtp_dev = dev; in ishtp_bus_add_device()
440 &dev->fw_clients[dev->fw_client_presentation_num - 1]; in ishtp_bus_add_device()
442 dev_set_name(&device->dev, "%s", name); in ishtp_bus_add_device()
444 spin_lock_irqsave(&dev->device_list_lock, flags); in ishtp_bus_add_device()
445 list_add_tail(&device->device_link, &dev->device_list); in ishtp_bus_add_device()
446 spin_unlock_irqrestore(&dev->device_list_lock, flags); in ishtp_bus_add_device()
448 status = device_register(&device->dev); in ishtp_bus_add_device()
450 spin_lock_irqsave(&dev->device_list_lock, flags); in ishtp_bus_add_device()
452 spin_unlock_irqrestore(&dev->device_list_lock, flags); in ishtp_bus_add_device()
453 dev_err(dev->devc, "Failed to register ISHTP client device\n"); in ishtp_bus_add_device()
454 put_device(&device->dev); in ishtp_bus_add_device()
474 device_unregister(&device->dev); in ishtp_bus_remove_device()
643 int ishtp_bus_new_client(struct ishtp_device *dev) in ishtp_bus_new_client() argument
656 i = dev->fw_client_presentation_num - 1; in ishtp_bus_new_client()
657 device_uuid = dev->fw_clients[i].props.protocol_name; in ishtp_bus_new_client()
662 cl_device = ishtp_bus_add_device(dev, device_uuid, dev_name); in ishtp_bus_new_client()
691 spin_lock_irqsave(&cl->dev->device_list_lock, flags); in ishtp_cl_device_bind()
692 list_for_each_entry(cl_device, &cl->dev->device_list, in ishtp_cl_device_bind()
701 spin_unlock_irqrestore(&cl->dev->device_list_lock, flags); in ishtp_cl_device_bind()
784 void ishtp_reset_handler(struct ishtp_device *dev) in ishtp_reset_handler() argument
789 dev->dev_state = ISHTP_DEV_RESETTING; in ishtp_reset_handler()
792 spin_lock_irqsave(&dev->rd_msg_spinlock, flags); in ishtp_reset_handler()
793 dev->rd_msg_fifo_head = dev->rd_msg_fifo_tail = 0; in ishtp_reset_handler()
794 spin_unlock_irqrestore(&dev->rd_msg_spinlock, flags); in ishtp_reset_handler()
797 ishtp_bus_remove_all_clients(dev, true); in ishtp_reset_handler()
808 void ishtp_reset_compl_handler(struct ishtp_device *dev) in ishtp_reset_compl_handler() argument
810 dev->dev_state = ISHTP_DEV_INIT_CLIENTS; in ishtp_reset_compl_handler()
811 dev->hbm_state = ISHTP_HBM_START; in ishtp_reset_compl_handler()
812 ishtp_hbm_start_req(dev); in ishtp_reset_compl_handler()
839 return &device->dev; in ishtp_device()
850 bool ishtp_wait_resume(struct ishtp_device *dev) in ishtp_wait_resume() argument
856 if (dev->resume_flag) in ishtp_wait_resume()
857 wait_event_interruptible_timeout(dev->resume_wait, in ishtp_wait_resume()
858 !dev->resume_flag, in ishtp_wait_resume()
861 return (!dev->resume_flag); in ishtp_wait_resume()
901 int ish_hw_reset(struct ishtp_device *dev) in ish_hw_reset() argument
903 return dev->ops->hw_reset(dev); in ish_hw_reset()