1 // SPDX-License-Identifier: GPL-2.0-only
5 * Copyright (c) 2012-2016, Intel Corporation.
8 #include <linux/module.h>
9 #include <linux/init.h>
10 #include <linux/kernel.h>
11 #include <linux/device.h>
12 #include <linux/sched.h>
13 #include <linux/slab.h>
15 #include "ishtp-dev.h"
19 static int ishtp_use_dma;
20 module_param_named(ishtp_use_dma, ishtp_use_dma, int, 0600);
21 MODULE_PARM_DESC(ishtp_use_dma, "Use DMA to send messages");
23 #define to_ishtp_cl_driver(d) container_of(d, struct ishtp_cl_driver, driver)
24 #define to_ishtp_cl_device(d) container_of(d, struct ishtp_cl_device, dev)
25 static bool ishtp_device_ready;
28 * ishtp_recv() - process ishtp message
31 * If a message with valid header and size is received, then
32 * this function calls appropriate handler. The host or firmware
33 * address is zero, then they are host bus management message,
34 * otherwise they are message fo clients.
36 void ishtp_recv(struct ishtp_device *dev)
39 struct ishtp_msg_hdr *ishtp_hdr;
41 /* Read ISHTP header dword */
42 msg_hdr = dev->ops->ishtp_read_hdr(dev);
46 dev->ops->sync_fw_clock(dev);
48 ishtp_hdr = (struct ishtp_msg_hdr *)&msg_hdr;
49 dev->ishtp_msg_hdr = msg_hdr;
51 /* Sanity check: ISHTP frag. length in header */
52 if (ishtp_hdr->length > dev->mtu) {
54 "ISHTP hdr - bad length: %u; dropped [%08X]\n",
55 (unsigned int)ishtp_hdr->length, msg_hdr);
59 /* ISHTP bus message */
60 if (!ishtp_hdr->host_addr && !ishtp_hdr->fw_addr)
61 recv_hbm(dev, ishtp_hdr);
62 /* ISHTP fixed-client message */
63 else if (!ishtp_hdr->host_addr)
64 recv_fixed_cl_msg(dev, ishtp_hdr);
66 /* ISHTP client message */
67 recv_ishtp_cl_msg(dev, ishtp_hdr);
69 EXPORT_SYMBOL(ishtp_recv);
72 * ishtp_send_msg() - Send ishtp message
74 * @hdr: Message header
75 * @msg: Message contents
76 * @ipc_send_compl: completion callback
77 * @ipc_send_compl_prm: completion callback parameter
79 * Send a multi fragment message via IPC. After sending the first fragment
80 * the completion callback is called to schedule transmit of next fragment.
82 * Return: This returns IPC send message status.
84 int ishtp_send_msg(struct ishtp_device *dev, struct ishtp_msg_hdr *hdr,
85 void *msg, void(*ipc_send_compl)(void *),
86 void *ipc_send_compl_prm)
88 unsigned char ipc_msg[IPC_FULL_MSG_SIZE];
91 drbl_val = dev->ops->ipc_get_header(dev, hdr->length +
92 sizeof(struct ishtp_msg_hdr),
95 memcpy(ipc_msg, &drbl_val, sizeof(uint32_t));
96 memcpy(ipc_msg + sizeof(uint32_t), hdr, sizeof(uint32_t));
97 memcpy(ipc_msg + 2 * sizeof(uint32_t), msg, hdr->length);
98 return dev->ops->write(dev, ipc_send_compl, ipc_send_compl_prm,
99 ipc_msg, 2 * sizeof(uint32_t) + hdr->length);
103 * ishtp_write_message() - Send ishtp single fragment message
105 * @hdr: Message header
108 * Send a single fragment message via IPC. This returns IPC send message
111 * Return: This returns IPC send message status.
113 int ishtp_write_message(struct ishtp_device *dev, struct ishtp_msg_hdr *hdr,
116 return ishtp_send_msg(dev, hdr, buf, NULL, NULL);
120 * ishtp_fw_cl_by_uuid() - locate index of fw client
122 * @uuid: uuid of the client to search
124 * Search firmware client using UUID.
126 * Return: fw client index or -ENOENT if not found
128 int ishtp_fw_cl_by_uuid(struct ishtp_device *dev, const guid_t *uuid)
132 for (i = 0; i < dev->fw_clients_num; ++i) {
133 if (guid_equal(uuid, &dev->fw_clients[i].props.protocol_name))
138 EXPORT_SYMBOL(ishtp_fw_cl_by_uuid);
141 * ishtp_fw_cl_get_client() - return client information to client
142 * @dev: the ishtp device structure
143 * @uuid: uuid of the client to search
145 * Search firmware client using UUID and reture related client information.
147 * Return: pointer of client information on success, NULL on failure.
149 struct ishtp_fw_client *ishtp_fw_cl_get_client(struct ishtp_device *dev,
155 spin_lock_irqsave(&dev->fw_clients_lock, flags);
156 i = ishtp_fw_cl_by_uuid(dev, uuid);
157 spin_unlock_irqrestore(&dev->fw_clients_lock, flags);
158 if (i < 0 || dev->fw_clients[i].props.fixed_address)
161 return &dev->fw_clients[i];
163 EXPORT_SYMBOL(ishtp_fw_cl_get_client);
166 * ishtp_get_fw_client_id() - Get fw client id
167 * @fw_client: firmware client used to fetch the ID
169 * This interface is used to reset HW get FW client id.
171 * Return: firmware client id.
173 int ishtp_get_fw_client_id(struct ishtp_fw_client *fw_client)
175 return fw_client->client_id;
177 EXPORT_SYMBOL(ishtp_get_fw_client_id);
180 * ishtp_fw_cl_by_id() - return index to fw_clients for client_id
181 * @dev: the ishtp device structure
182 * @client_id: fw client id to search
184 * Search firmware client using client id.
186 * Return: index on success, -ENOENT on failure.
188 int ishtp_fw_cl_by_id(struct ishtp_device *dev, uint8_t client_id)
190 int i, res = -ENOENT;
193 spin_lock_irqsave(&dev->fw_clients_lock, flags);
194 for (i = 0; i < dev->fw_clients_num; i++) {
195 if (dev->fw_clients[i].client_id == client_id) {
200 spin_unlock_irqrestore(&dev->fw_clients_lock, flags);
206 * ishtp_cl_device_probe() - Bus probe() callback
207 * @dev: the device structure
209 * This is a bus probe callback and calls the drive probe function.
211 * Return: Return value from driver probe() call.
213 static int ishtp_cl_device_probe(struct device *dev)
215 struct ishtp_cl_device *device = to_ishtp_cl_device(dev);
216 struct ishtp_cl_driver *driver;
221 driver = to_ishtp_cl_driver(dev->driver);
222 if (!driver || !driver->probe)
225 return driver->probe(device);
229 * ishtp_cl_bus_match() - Bus match() callback
230 * @dev: the device structure
231 * @drv: the driver structure
233 * This is a bus match callback, called when a new ishtp_cl_device is
234 * registered during ishtp bus client enumeration. Use the guid_t in
235 * drv and dev to decide whether they match or not.
237 * Return: 1 if dev & drv matches, 0 otherwise.
239 static int ishtp_cl_bus_match(struct device *dev, struct device_driver *drv)
241 struct ishtp_cl_device *device = to_ishtp_cl_device(dev);
242 struct ishtp_cl_driver *driver = to_ishtp_cl_driver(drv);
244 return guid_equal(driver->guid,
245 &device->fw_client->props.protocol_name);
249 * ishtp_cl_device_remove() - Bus remove() callback
250 * @dev: the device structure
252 * This is a bus remove callback and calls the drive remove function.
253 * Since the ISH driver model supports only built in, this is
254 * primarily can be called during pci driver init failure.
256 * Return: Return value from driver remove() call.
258 static void ishtp_cl_device_remove(struct device *dev)
260 struct ishtp_cl_device *device = to_ishtp_cl_device(dev);
261 struct ishtp_cl_driver *driver = to_ishtp_cl_driver(dev->driver);
263 if (device->event_cb) {
264 device->event_cb = NULL;
265 cancel_work_sync(&device->event_work);
269 driver->remove(device);
273 * ishtp_cl_device_suspend() - Bus suspend callback
276 * Called during device suspend process.
278 * Return: Return value from driver suspend() call.
280 static int ishtp_cl_device_suspend(struct device *dev)
282 struct ishtp_cl_device *device = to_ishtp_cl_device(dev);
283 struct ishtp_cl_driver *driver;
289 driver = to_ishtp_cl_driver(dev->driver);
290 if (driver && driver->driver.pm) {
291 if (driver->driver.pm->suspend)
292 ret = driver->driver.pm->suspend(dev);
299 * ishtp_cl_device_resume() - Bus resume callback
302 * Called during device resume process.
304 * Return: Return value from driver resume() call.
306 static int ishtp_cl_device_resume(struct device *dev)
308 struct ishtp_cl_device *device = to_ishtp_cl_device(dev);
309 struct ishtp_cl_driver *driver;
315 driver = to_ishtp_cl_driver(dev->driver);
316 if (driver && driver->driver.pm) {
317 if (driver->driver.pm->resume)
318 ret = driver->driver.pm->resume(dev);
325 * ishtp_cl_device_reset() - Reset callback
326 * @device: ishtp client device instance
328 * This is a callback when HW reset is done and the device need
331 * Return: Return value from driver reset() call.
333 static int ishtp_cl_device_reset(struct ishtp_cl_device *device)
335 struct ishtp_cl_driver *driver;
338 device->event_cb = NULL;
339 cancel_work_sync(&device->event_work);
341 driver = to_ishtp_cl_driver(device->dev.driver);
342 if (driver && driver->reset)
343 ret = driver->reset(device);
348 static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
353 len = snprintf(buf, PAGE_SIZE, "ishtp:%s\n", dev_name(dev));
354 return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
356 static DEVICE_ATTR_RO(modalias);
358 static struct attribute *ishtp_cl_dev_attrs[] = {
359 &dev_attr_modalias.attr,
362 ATTRIBUTE_GROUPS(ishtp_cl_dev);
364 static int ishtp_cl_uevent(struct device *dev, struct kobj_uevent_env *env)
366 if (add_uevent_var(env, "MODALIAS=ishtp:%s", dev_name(dev)))
371 static const struct dev_pm_ops ishtp_cl_bus_dev_pm_ops = {
372 /* Suspend callbacks */
373 .suspend = ishtp_cl_device_suspend,
374 .resume = ishtp_cl_device_resume,
375 /* Hibernate callbacks */
376 .freeze = ishtp_cl_device_suspend,
377 .thaw = ishtp_cl_device_resume,
378 .restore = ishtp_cl_device_resume,
381 static struct bus_type ishtp_cl_bus_type = {
383 .dev_groups = ishtp_cl_dev_groups,
384 .probe = ishtp_cl_device_probe,
385 .match = ishtp_cl_bus_match,
386 .remove = ishtp_cl_device_remove,
387 .pm = &ishtp_cl_bus_dev_pm_ops,
388 .uevent = ishtp_cl_uevent,
391 static void ishtp_cl_dev_release(struct device *dev)
393 kfree(to_ishtp_cl_device(dev));
396 static const struct device_type ishtp_cl_device_type = {
397 .release = ishtp_cl_dev_release,
401 * ishtp_bus_add_device() - Function to create device on bus
403 * @uuid: uuid of the client
404 * @name: Name of the client
406 * Allocate ISHTP bus client device, attach it to uuid
407 * and register with ISHTP bus.
409 * Return: ishtp_cl_device pointer or NULL on failure
411 static struct ishtp_cl_device *ishtp_bus_add_device(struct ishtp_device *dev,
412 guid_t uuid, char *name)
414 struct ishtp_cl_device *device;
418 spin_lock_irqsave(&dev->device_list_lock, flags);
419 list_for_each_entry(device, &dev->device_list, device_link) {
420 if (!strcmp(name, dev_name(&device->dev))) {
421 device->fw_client = &dev->fw_clients[
422 dev->fw_client_presentation_num - 1];
423 spin_unlock_irqrestore(&dev->device_list_lock, flags);
424 ishtp_cl_device_reset(device);
428 spin_unlock_irqrestore(&dev->device_list_lock, flags);
430 device = kzalloc(sizeof(struct ishtp_cl_device), GFP_KERNEL);
434 device->dev.parent = dev->devc;
435 device->dev.bus = &ishtp_cl_bus_type;
436 device->dev.type = &ishtp_cl_device_type;
437 device->ishtp_dev = dev;
440 &dev->fw_clients[dev->fw_client_presentation_num - 1];
442 dev_set_name(&device->dev, "%s", name);
444 spin_lock_irqsave(&dev->device_list_lock, flags);
445 list_add_tail(&device->device_link, &dev->device_list);
446 spin_unlock_irqrestore(&dev->device_list_lock, flags);
448 status = device_register(&device->dev);
450 spin_lock_irqsave(&dev->device_list_lock, flags);
451 list_del(&device->device_link);
452 spin_unlock_irqrestore(&dev->device_list_lock, flags);
453 dev_err(dev->devc, "Failed to register ISHTP client device\n");
454 put_device(&device->dev);
458 ishtp_device_ready = true;
464 * ishtp_bus_remove_device() - Function to relase device on bus
465 * @device: client device instance
467 * This is a counterpart of ishtp_bus_add_device.
468 * Device is unregistered.
469 * the device structure is freed in 'ishtp_cl_dev_release' function
470 * Called only during error in pci driver init path.
472 static void ishtp_bus_remove_device(struct ishtp_cl_device *device)
474 device_unregister(&device->dev);
478 * ishtp_cl_driver_register() - Client driver register
479 * @driver: the client driver instance
480 * @owner: Owner of this driver module
482 * Once a client driver is probed, it created a client
483 * instance and registers with the bus.
485 * Return: Return value of driver_register or -ENODEV if not ready
487 int ishtp_cl_driver_register(struct ishtp_cl_driver *driver,
488 struct module *owner)
490 if (!ishtp_device_ready)
493 driver->driver.name = driver->name;
494 driver->driver.owner = owner;
495 driver->driver.bus = &ishtp_cl_bus_type;
497 return driver_register(&driver->driver);
499 EXPORT_SYMBOL(ishtp_cl_driver_register);
502 * ishtp_cl_driver_unregister() - Client driver unregister
503 * @driver: the client driver instance
505 * Unregister client during device removal process.
507 void ishtp_cl_driver_unregister(struct ishtp_cl_driver *driver)
509 driver_unregister(&driver->driver);
511 EXPORT_SYMBOL(ishtp_cl_driver_unregister);
514 * ishtp_bus_event_work() - event work function
515 * @work: work struct pointer
517 * Once an event is received for a client this work
518 * function is called. If the device has registered a
519 * callback then the callback is called.
521 static void ishtp_bus_event_work(struct work_struct *work)
523 struct ishtp_cl_device *device;
525 device = container_of(work, struct ishtp_cl_device, event_work);
527 if (device->event_cb)
528 device->event_cb(device);
532 * ishtp_cl_bus_rx_event() - schedule event work
533 * @device: client device instance
535 * Once an event is received for a client this schedules
536 * a work function to process.
538 void ishtp_cl_bus_rx_event(struct ishtp_cl_device *device)
540 if (!device || !device->event_cb)
543 if (device->event_cb)
544 schedule_work(&device->event_work);
548 * ishtp_register_event_cb() - Register callback
549 * @device: client device instance
550 * @event_cb: Event processor for an client
552 * Register a callback for events, called from client driver
554 * Return: Return 0 or -EALREADY if already registered
556 int ishtp_register_event_cb(struct ishtp_cl_device *device,
557 void (*event_cb)(struct ishtp_cl_device *))
559 if (device->event_cb)
562 device->event_cb = event_cb;
563 INIT_WORK(&device->event_work, ishtp_bus_event_work);
567 EXPORT_SYMBOL(ishtp_register_event_cb);
570 * ishtp_get_device() - update usage count for the device
571 * @cl_device: client device instance
573 * Increment the usage count. The device can't be deleted
575 void ishtp_get_device(struct ishtp_cl_device *cl_device)
577 cl_device->reference_count++;
579 EXPORT_SYMBOL(ishtp_get_device);
582 * ishtp_put_device() - decrement usage count for the device
583 * @cl_device: client device instance
585 * Decrement the usage count. The device can be deleted is count = 0
587 void ishtp_put_device(struct ishtp_cl_device *cl_device)
589 cl_device->reference_count--;
591 EXPORT_SYMBOL(ishtp_put_device);
594 * ishtp_set_drvdata() - set client driver data
595 * @cl_device: client device instance
596 * @data: driver data need to be set
598 * Set client driver data to cl_device->driver_data.
600 void ishtp_set_drvdata(struct ishtp_cl_device *cl_device, void *data)
602 cl_device->driver_data = data;
604 EXPORT_SYMBOL(ishtp_set_drvdata);
607 * ishtp_get_drvdata() - get client driver data
608 * @cl_device: client device instance
610 * Get client driver data from cl_device->driver_data.
612 * Return: pointer of driver data
614 void *ishtp_get_drvdata(struct ishtp_cl_device *cl_device)
616 return cl_device->driver_data;
618 EXPORT_SYMBOL(ishtp_get_drvdata);
621 * ishtp_dev_to_cl_device() - get ishtp_cl_device instance from device instance
622 * @device: device instance
624 * Get ish_cl_device instance which embeds device instance in it.
626 * Return: pointer to ishtp_cl_device instance
628 struct ishtp_cl_device *ishtp_dev_to_cl_device(struct device *device)
630 return to_ishtp_cl_device(device);
632 EXPORT_SYMBOL(ishtp_dev_to_cl_device);
635 * ishtp_bus_new_client() - Create a new client
636 * @dev: ISHTP device instance
638 * Once bus protocol enumerates a client, this is called
639 * to add a device for the client.
641 * Return: 0 on success or error code on failure
643 int ishtp_bus_new_client(struct ishtp_device *dev)
647 struct ishtp_cl_device *cl_device;
651 * For all reported clients, create an unconnected client and add its
652 * device to ISHTP bus.
653 * If appropriate driver has loaded, this will trigger its probe().
654 * Otherwise, probe() will be called when driver is loaded
656 i = dev->fw_client_presentation_num - 1;
657 device_uuid = dev->fw_clients[i].props.protocol_name;
658 dev_name = kasprintf(GFP_KERNEL, "{%pUL}", &device_uuid);
662 cl_device = ishtp_bus_add_device(dev, device_uuid, dev_name);
674 * ishtp_cl_device_bind() - bind a device
675 * @cl: ishtp client device
677 * Binds connected ishtp_cl to ISHTP bus device
679 * Return: 0 on success or fault code
681 int ishtp_cl_device_bind(struct ishtp_cl *cl)
683 struct ishtp_cl_device *cl_device;
687 if (!cl->fw_client_id || cl->state != ISHTP_CL_CONNECTED)
691 spin_lock_irqsave(&cl->dev->device_list_lock, flags);
692 list_for_each_entry(cl_device, &cl->dev->device_list,
694 if (cl_device->fw_client &&
695 cl_device->fw_client->client_id == cl->fw_client_id) {
696 cl->device = cl_device;
701 spin_unlock_irqrestore(&cl->dev->device_list_lock, flags);
706 * ishtp_bus_remove_all_clients() - Remove all clients
707 * @ishtp_dev: ishtp device
708 * @warm_reset: Reset due to FW reset dure to errors or S3 suspend
710 * This is part of reset/remove flow. This function the main processing
711 * only targets error processing, if the FW has forced reset or
712 * error to remove connected clients. When warm reset the client devices are
715 void ishtp_bus_remove_all_clients(struct ishtp_device *ishtp_dev,
718 struct ishtp_cl_device *cl_device, *n;
722 spin_lock_irqsave(&ishtp_dev->cl_list_lock, flags);
723 list_for_each_entry(cl, &ishtp_dev->cl_list, link) {
724 cl->state = ISHTP_CL_DISCONNECTED;
727 * Wake any pending process. The waiter would check dev->state
728 * and determine that it's not enabled already,
729 * and will return error to its caller
731 wake_up_interruptible(&cl->wait_ctrl_res);
733 /* Disband any pending read/write requests and free rb */
734 ishtp_cl_flush_queues(cl);
736 /* Remove all free and in_process rings, both Rx and Tx */
737 ishtp_cl_free_rx_ring(cl);
738 ishtp_cl_free_tx_ring(cl);
741 * Free client and ISHTP bus client device structures
742 * don't free host client because it is part of the OS fd
746 spin_unlock_irqrestore(&ishtp_dev->cl_list_lock, flags);
748 /* Release DMA buffers for client messages */
749 ishtp_cl_free_dma_buf(ishtp_dev);
751 /* remove bus clients */
752 spin_lock_irqsave(&ishtp_dev->device_list_lock, flags);
753 list_for_each_entry_safe(cl_device, n, &ishtp_dev->device_list,
755 cl_device->fw_client = NULL;
756 if (warm_reset && cl_device->reference_count)
759 list_del(&cl_device->device_link);
760 spin_unlock_irqrestore(&ishtp_dev->device_list_lock, flags);
761 ishtp_bus_remove_device(cl_device);
762 spin_lock_irqsave(&ishtp_dev->device_list_lock, flags);
764 spin_unlock_irqrestore(&ishtp_dev->device_list_lock, flags);
766 /* Free all client structures */
767 spin_lock_irqsave(&ishtp_dev->fw_clients_lock, flags);
768 kfree(ishtp_dev->fw_clients);
769 ishtp_dev->fw_clients = NULL;
770 ishtp_dev->fw_clients_num = 0;
771 ishtp_dev->fw_client_presentation_num = 0;
772 ishtp_dev->fw_client_index = 0;
773 bitmap_zero(ishtp_dev->fw_clients_map, ISHTP_CLIENTS_MAX);
774 spin_unlock_irqrestore(&ishtp_dev->fw_clients_lock, flags);
776 EXPORT_SYMBOL(ishtp_bus_remove_all_clients);
779 * ishtp_reset_handler() - IPC reset handler
782 * ISHTP Handler for IPC_RESET notification
784 void ishtp_reset_handler(struct ishtp_device *dev)
788 /* Handle FW-initiated reset */
789 dev->dev_state = ISHTP_DEV_RESETTING;
791 /* Clear BH processing queue - no further HBMs */
792 spin_lock_irqsave(&dev->rd_msg_spinlock, flags);
793 dev->rd_msg_fifo_head = dev->rd_msg_fifo_tail = 0;
794 spin_unlock_irqrestore(&dev->rd_msg_spinlock, flags);
796 /* Handle ISH FW reset against upper layers */
797 ishtp_bus_remove_all_clients(dev, true);
799 EXPORT_SYMBOL(ishtp_reset_handler);
802 * ishtp_reset_compl_handler() - Reset completion handler
805 * ISHTP handler for IPC_RESET sequence completion to start
806 * host message bus start protocol sequence.
808 void ishtp_reset_compl_handler(struct ishtp_device *dev)
810 dev->dev_state = ISHTP_DEV_INIT_CLIENTS;
811 dev->hbm_state = ISHTP_HBM_START;
812 ishtp_hbm_start_req(dev);
814 EXPORT_SYMBOL(ishtp_reset_compl_handler);
817 * ishtp_use_dma_transfer() - Function to use DMA
819 * This interface is used to enable usage of DMA
821 * Return non zero if DMA can be enabled
823 int ishtp_use_dma_transfer(void)
825 return ishtp_use_dma;
829 * ishtp_device() - Return device pointer
830 * @device: ISH-TP client device instance
832 * This interface is used to return device pointer from ishtp_cl_device
837 struct device *ishtp_device(struct ishtp_cl_device *device)
841 EXPORT_SYMBOL(ishtp_device);
844 * ishtp_wait_resume() - Wait for IPC resume
846 * Wait for IPC resume
848 * Return: resume complete or not
850 bool ishtp_wait_resume(struct ishtp_device *dev)
852 /* 50ms to get resume response */
853 #define WAIT_FOR_RESUME_ACK_MS 50
855 /* Waiting to get resume response */
856 if (dev->resume_flag)
857 wait_event_interruptible_timeout(dev->resume_wait,
859 msecs_to_jiffies(WAIT_FOR_RESUME_ACK_MS));
861 return (!dev->resume_flag);
863 EXPORT_SYMBOL_GPL(ishtp_wait_resume);
866 * ishtp_get_pci_device() - Return PCI device dev pointer
867 * This interface is used to return PCI device pointer
868 * from ishtp_cl_device instance.
869 * @device: ISH-TP client device instance
873 struct device *ishtp_get_pci_device(struct ishtp_cl_device *device)
875 return device->ishtp_dev->devc;
877 EXPORT_SYMBOL(ishtp_get_pci_device);
880 * ishtp_trace_callback() - Return trace callback
881 * @cl_device: ISH-TP client device instance
883 * This interface is used to return trace callback function pointer.
885 * Return: *ishtp_print_log()
887 ishtp_print_log ishtp_trace_callback(struct ishtp_cl_device *cl_device)
889 return cl_device->ishtp_dev->print_log;
891 EXPORT_SYMBOL(ishtp_trace_callback);
894 * ish_hw_reset() - Call HW reset IPC callback
895 * @dev: ISHTP device instance
897 * This interface is used to reset HW in case of error.
899 * Return: value from IPC hw_reset callback
901 int ish_hw_reset(struct ishtp_device *dev)
903 return dev->ops->hw_reset(dev);
905 EXPORT_SYMBOL(ish_hw_reset);
908 * ishtp_bus_register() - Function to register bus
910 * This register ishtp bus
912 * Return: Return output of bus_register
914 static int __init ishtp_bus_register(void)
916 return bus_register(&ishtp_cl_bus_type);
920 * ishtp_bus_unregister() - Function to unregister bus
922 * This unregister ishtp bus
924 static void __exit ishtp_bus_unregister(void)
926 bus_unregister(&ishtp_cl_bus_type);
929 module_init(ishtp_bus_register);
930 module_exit(ishtp_bus_unregister);
932 MODULE_LICENSE("GPL");