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 int 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);
275 * ishtp_cl_device_suspend() - Bus suspend callback
278 * Called during device suspend process.
280 * Return: Return value from driver suspend() call.
282 static int ishtp_cl_device_suspend(struct device *dev)
284 struct ishtp_cl_device *device = to_ishtp_cl_device(dev);
285 struct ishtp_cl_driver *driver;
291 driver = to_ishtp_cl_driver(dev->driver);
292 if (driver && driver->driver.pm) {
293 if (driver->driver.pm->suspend)
294 ret = driver->driver.pm->suspend(dev);
301 * ishtp_cl_device_resume() - Bus resume callback
304 * Called during device resume process.
306 * Return: Return value from driver resume() call.
308 static int ishtp_cl_device_resume(struct device *dev)
310 struct ishtp_cl_device *device = to_ishtp_cl_device(dev);
311 struct ishtp_cl_driver *driver;
318 * When ISH needs hard reset, it is done asynchrnously, hence bus
319 * resume will be called before full ISH resume
321 if (device->ishtp_dev->resume_flag)
324 driver = to_ishtp_cl_driver(dev->driver);
325 if (driver && driver->driver.pm) {
326 if (driver->driver.pm->resume)
327 ret = driver->driver.pm->resume(dev);
334 * ishtp_cl_device_reset() - Reset callback
335 * @device: ishtp client device instance
337 * This is a callback when HW reset is done and the device need
340 * Return: Return value from driver reset() call.
342 static int ishtp_cl_device_reset(struct ishtp_cl_device *device)
344 struct ishtp_cl_driver *driver;
347 device->event_cb = NULL;
348 cancel_work_sync(&device->event_work);
350 driver = to_ishtp_cl_driver(device->dev.driver);
351 if (driver && driver->reset)
352 ret = driver->reset(device);
357 static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
362 len = snprintf(buf, PAGE_SIZE, "ishtp:%s\n", dev_name(dev));
363 return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
365 static DEVICE_ATTR_RO(modalias);
367 static struct attribute *ishtp_cl_dev_attrs[] = {
368 &dev_attr_modalias.attr,
371 ATTRIBUTE_GROUPS(ishtp_cl_dev);
373 static int ishtp_cl_uevent(struct device *dev, struct kobj_uevent_env *env)
375 if (add_uevent_var(env, "MODALIAS=ishtp:%s", dev_name(dev)))
380 static const struct dev_pm_ops ishtp_cl_bus_dev_pm_ops = {
381 /* Suspend callbacks */
382 .suspend = ishtp_cl_device_suspend,
383 .resume = ishtp_cl_device_resume,
384 /* Hibernate callbacks */
385 .freeze = ishtp_cl_device_suspend,
386 .thaw = ishtp_cl_device_resume,
387 .restore = ishtp_cl_device_resume,
390 static struct bus_type ishtp_cl_bus_type = {
392 .dev_groups = ishtp_cl_dev_groups,
393 .probe = ishtp_cl_device_probe,
394 .match = ishtp_cl_bus_match,
395 .remove = ishtp_cl_device_remove,
396 .pm = &ishtp_cl_bus_dev_pm_ops,
397 .uevent = ishtp_cl_uevent,
400 static void ishtp_cl_dev_release(struct device *dev)
402 kfree(to_ishtp_cl_device(dev));
405 static const struct device_type ishtp_cl_device_type = {
406 .release = ishtp_cl_dev_release,
410 * ishtp_bus_add_device() - Function to create device on bus
412 * @uuid: uuid of the client
413 * @name: Name of the client
415 * Allocate ISHTP bus client device, attach it to uuid
416 * and register with ISHTP bus.
418 * Return: ishtp_cl_device pointer or NULL on failure
420 static struct ishtp_cl_device *ishtp_bus_add_device(struct ishtp_device *dev,
421 guid_t uuid, char *name)
423 struct ishtp_cl_device *device;
427 spin_lock_irqsave(&dev->device_list_lock, flags);
428 list_for_each_entry(device, &dev->device_list, device_link) {
429 if (!strcmp(name, dev_name(&device->dev))) {
430 device->fw_client = &dev->fw_clients[
431 dev->fw_client_presentation_num - 1];
432 spin_unlock_irqrestore(&dev->device_list_lock, flags);
433 ishtp_cl_device_reset(device);
437 spin_unlock_irqrestore(&dev->device_list_lock, flags);
439 device = kzalloc(sizeof(struct ishtp_cl_device), GFP_KERNEL);
443 device->dev.parent = dev->devc;
444 device->dev.bus = &ishtp_cl_bus_type;
445 device->dev.type = &ishtp_cl_device_type;
446 device->ishtp_dev = dev;
449 &dev->fw_clients[dev->fw_client_presentation_num - 1];
451 dev_set_name(&device->dev, "%s", name);
453 spin_lock_irqsave(&dev->device_list_lock, flags);
454 list_add_tail(&device->device_link, &dev->device_list);
455 spin_unlock_irqrestore(&dev->device_list_lock, flags);
457 status = device_register(&device->dev);
459 spin_lock_irqsave(&dev->device_list_lock, flags);
460 list_del(&device->device_link);
461 spin_unlock_irqrestore(&dev->device_list_lock, flags);
462 dev_err(dev->devc, "Failed to register ISHTP client device\n");
463 put_device(&device->dev);
467 ishtp_device_ready = true;
473 * ishtp_bus_remove_device() - Function to relase device on bus
474 * @device: client device instance
476 * This is a counterpart of ishtp_bus_add_device.
477 * Device is unregistered.
478 * the device structure is freed in 'ishtp_cl_dev_release' function
479 * Called only during error in pci driver init path.
481 static void ishtp_bus_remove_device(struct ishtp_cl_device *device)
483 device_unregister(&device->dev);
487 * ishtp_cl_driver_register() - Client driver register
488 * @driver: the client driver instance
489 * @owner: Owner of this driver module
491 * Once a client driver is probed, it created a client
492 * instance and registers with the bus.
494 * Return: Return value of driver_register or -ENODEV if not ready
496 int ishtp_cl_driver_register(struct ishtp_cl_driver *driver,
497 struct module *owner)
499 if (!ishtp_device_ready)
502 driver->driver.name = driver->name;
503 driver->driver.owner = owner;
504 driver->driver.bus = &ishtp_cl_bus_type;
506 return driver_register(&driver->driver);
508 EXPORT_SYMBOL(ishtp_cl_driver_register);
511 * ishtp_cl_driver_unregister() - Client driver unregister
512 * @driver: the client driver instance
514 * Unregister client during device removal process.
516 void ishtp_cl_driver_unregister(struct ishtp_cl_driver *driver)
518 driver_unregister(&driver->driver);
520 EXPORT_SYMBOL(ishtp_cl_driver_unregister);
523 * ishtp_bus_event_work() - event work function
524 * @work: work struct pointer
526 * Once an event is received for a client this work
527 * function is called. If the device has registered a
528 * callback then the callback is called.
530 static void ishtp_bus_event_work(struct work_struct *work)
532 struct ishtp_cl_device *device;
534 device = container_of(work, struct ishtp_cl_device, event_work);
536 if (device->event_cb)
537 device->event_cb(device);
541 * ishtp_cl_bus_rx_event() - schedule event work
542 * @device: client device instance
544 * Once an event is received for a client this schedules
545 * a work function to process.
547 void ishtp_cl_bus_rx_event(struct ishtp_cl_device *device)
549 if (!device || !device->event_cb)
552 if (device->event_cb)
553 schedule_work(&device->event_work);
557 * ishtp_register_event_cb() - Register callback
558 * @device: client device instance
559 * @event_cb: Event processor for an client
561 * Register a callback for events, called from client driver
563 * Return: Return 0 or -EALREADY if already registered
565 int ishtp_register_event_cb(struct ishtp_cl_device *device,
566 void (*event_cb)(struct ishtp_cl_device *))
568 if (device->event_cb)
571 device->event_cb = event_cb;
572 INIT_WORK(&device->event_work, ishtp_bus_event_work);
576 EXPORT_SYMBOL(ishtp_register_event_cb);
579 * ishtp_get_device() - update usage count for the device
580 * @cl_device: client device instance
582 * Increment the usage count. The device can't be deleted
584 void ishtp_get_device(struct ishtp_cl_device *cl_device)
586 cl_device->reference_count++;
588 EXPORT_SYMBOL(ishtp_get_device);
591 * ishtp_put_device() - decrement usage count for the device
592 * @cl_device: client device instance
594 * Decrement the usage count. The device can be deleted is count = 0
596 void ishtp_put_device(struct ishtp_cl_device *cl_device)
598 cl_device->reference_count--;
600 EXPORT_SYMBOL(ishtp_put_device);
603 * ishtp_set_drvdata() - set client driver data
604 * @cl_device: client device instance
605 * @data: driver data need to be set
607 * Set client driver data to cl_device->driver_data.
609 void ishtp_set_drvdata(struct ishtp_cl_device *cl_device, void *data)
611 cl_device->driver_data = data;
613 EXPORT_SYMBOL(ishtp_set_drvdata);
616 * ishtp_get_drvdata() - get client driver data
617 * @cl_device: client device instance
619 * Get client driver data from cl_device->driver_data.
621 * Return: pointer of driver data
623 void *ishtp_get_drvdata(struct ishtp_cl_device *cl_device)
625 return cl_device->driver_data;
627 EXPORT_SYMBOL(ishtp_get_drvdata);
630 * ishtp_dev_to_cl_device() - get ishtp_cl_device instance from device instance
631 * @device: device instance
633 * Get ish_cl_device instance which embeds device instance in it.
635 * Return: pointer to ishtp_cl_device instance
637 struct ishtp_cl_device *ishtp_dev_to_cl_device(struct device *device)
639 return to_ishtp_cl_device(device);
641 EXPORT_SYMBOL(ishtp_dev_to_cl_device);
644 * ishtp_bus_new_client() - Create a new client
645 * @dev: ISHTP device instance
647 * Once bus protocol enumerates a client, this is called
648 * to add a device for the client.
650 * Return: 0 on success or error code on failure
652 int ishtp_bus_new_client(struct ishtp_device *dev)
656 struct ishtp_cl_device *cl_device;
660 * For all reported clients, create an unconnected client and add its
661 * device to ISHTP bus.
662 * If appropriate driver has loaded, this will trigger its probe().
663 * Otherwise, probe() will be called when driver is loaded
665 i = dev->fw_client_presentation_num - 1;
666 device_uuid = dev->fw_clients[i].props.protocol_name;
667 dev_name = kasprintf(GFP_KERNEL, "{%pUL}", &device_uuid);
671 cl_device = ishtp_bus_add_device(dev, device_uuid, dev_name);
683 * ishtp_cl_device_bind() - bind a device
684 * @cl: ishtp client device
686 * Binds connected ishtp_cl to ISHTP bus device
688 * Return: 0 on success or fault code
690 int ishtp_cl_device_bind(struct ishtp_cl *cl)
692 struct ishtp_cl_device *cl_device;
696 if (!cl->fw_client_id || cl->state != ISHTP_CL_CONNECTED)
700 spin_lock_irqsave(&cl->dev->device_list_lock, flags);
701 list_for_each_entry(cl_device, &cl->dev->device_list,
703 if (cl_device->fw_client &&
704 cl_device->fw_client->client_id == cl->fw_client_id) {
705 cl->device = cl_device;
710 spin_unlock_irqrestore(&cl->dev->device_list_lock, flags);
715 * ishtp_bus_remove_all_clients() - Remove all clients
716 * @ishtp_dev: ishtp device
717 * @warm_reset: Reset due to FW reset dure to errors or S3 suspend
719 * This is part of reset/remove flow. This function the main processing
720 * only targets error processing, if the FW has forced reset or
721 * error to remove connected clients. When warm reset the client devices are
724 void ishtp_bus_remove_all_clients(struct ishtp_device *ishtp_dev,
727 struct ishtp_cl_device *cl_device, *n;
731 spin_lock_irqsave(&ishtp_dev->cl_list_lock, flags);
732 list_for_each_entry(cl, &ishtp_dev->cl_list, link) {
733 cl->state = ISHTP_CL_DISCONNECTED;
736 * Wake any pending process. The waiter would check dev->state
737 * and determine that it's not enabled already,
738 * and will return error to its caller
740 wake_up_interruptible(&cl->wait_ctrl_res);
742 /* Disband any pending read/write requests and free rb */
743 ishtp_cl_flush_queues(cl);
745 /* Remove all free and in_process rings, both Rx and Tx */
746 ishtp_cl_free_rx_ring(cl);
747 ishtp_cl_free_tx_ring(cl);
750 * Free client and ISHTP bus client device structures
751 * don't free host client because it is part of the OS fd
755 spin_unlock_irqrestore(&ishtp_dev->cl_list_lock, flags);
757 /* Release DMA buffers for client messages */
758 ishtp_cl_free_dma_buf(ishtp_dev);
760 /* remove bus clients */
761 spin_lock_irqsave(&ishtp_dev->device_list_lock, flags);
762 list_for_each_entry_safe(cl_device, n, &ishtp_dev->device_list,
764 cl_device->fw_client = NULL;
765 if (warm_reset && cl_device->reference_count)
768 list_del(&cl_device->device_link);
769 spin_unlock_irqrestore(&ishtp_dev->device_list_lock, flags);
770 ishtp_bus_remove_device(cl_device);
771 spin_lock_irqsave(&ishtp_dev->device_list_lock, flags);
773 spin_unlock_irqrestore(&ishtp_dev->device_list_lock, flags);
775 /* Free all client structures */
776 spin_lock_irqsave(&ishtp_dev->fw_clients_lock, flags);
777 kfree(ishtp_dev->fw_clients);
778 ishtp_dev->fw_clients = NULL;
779 ishtp_dev->fw_clients_num = 0;
780 ishtp_dev->fw_client_presentation_num = 0;
781 ishtp_dev->fw_client_index = 0;
782 bitmap_zero(ishtp_dev->fw_clients_map, ISHTP_CLIENTS_MAX);
783 spin_unlock_irqrestore(&ishtp_dev->fw_clients_lock, flags);
785 EXPORT_SYMBOL(ishtp_bus_remove_all_clients);
788 * ishtp_reset_handler() - IPC reset handler
791 * ISHTP Handler for IPC_RESET notification
793 void ishtp_reset_handler(struct ishtp_device *dev)
797 /* Handle FW-initiated reset */
798 dev->dev_state = ISHTP_DEV_RESETTING;
800 /* Clear BH processing queue - no further HBMs */
801 spin_lock_irqsave(&dev->rd_msg_spinlock, flags);
802 dev->rd_msg_fifo_head = dev->rd_msg_fifo_tail = 0;
803 spin_unlock_irqrestore(&dev->rd_msg_spinlock, flags);
805 /* Handle ISH FW reset against upper layers */
806 ishtp_bus_remove_all_clients(dev, true);
808 EXPORT_SYMBOL(ishtp_reset_handler);
811 * ishtp_reset_compl_handler() - Reset completion handler
814 * ISHTP handler for IPC_RESET sequence completion to start
815 * host message bus start protocol sequence.
817 void ishtp_reset_compl_handler(struct ishtp_device *dev)
819 dev->dev_state = ISHTP_DEV_INIT_CLIENTS;
820 dev->hbm_state = ISHTP_HBM_START;
821 ishtp_hbm_start_req(dev);
823 EXPORT_SYMBOL(ishtp_reset_compl_handler);
826 * ishtp_use_dma_transfer() - Function to use DMA
828 * This interface is used to enable usage of DMA
830 * Return non zero if DMA can be enabled
832 int ishtp_use_dma_transfer(void)
834 return ishtp_use_dma;
838 * ishtp_device() - Return device pointer
839 * @device: ISH-TP client device instance
841 * This interface is used to return device pointer from ishtp_cl_device
846 struct device *ishtp_device(struct ishtp_cl_device *device)
850 EXPORT_SYMBOL(ishtp_device);
853 * ishtp_get_pci_device() - Return PCI device dev pointer
854 * This interface is used to return PCI device pointer
855 * from ishtp_cl_device instance.
856 * @device: ISH-TP client device instance
860 struct device *ishtp_get_pci_device(struct ishtp_cl_device *device)
862 return device->ishtp_dev->devc;
864 EXPORT_SYMBOL(ishtp_get_pci_device);
867 * ishtp_trace_callback() - Return trace callback
868 * @cl_device: ISH-TP client device instance
870 * This interface is used to return trace callback function pointer.
872 * Return: *ishtp_print_log()
874 ishtp_print_log ishtp_trace_callback(struct ishtp_cl_device *cl_device)
876 return cl_device->ishtp_dev->print_log;
878 EXPORT_SYMBOL(ishtp_trace_callback);
881 * ish_hw_reset() - Call HW reset IPC callback
882 * @dev: ISHTP device instance
884 * This interface is used to reset HW in case of error.
886 * Return: value from IPC hw_reset callback
888 int ish_hw_reset(struct ishtp_device *dev)
890 return dev->ops->hw_reset(dev);
892 EXPORT_SYMBOL(ish_hw_reset);
895 * ishtp_bus_register() - Function to register bus
897 * This register ishtp bus
899 * Return: Return output of bus_register
901 static int __init ishtp_bus_register(void)
903 return bus_register(&ishtp_cl_bus_type);
907 * ishtp_bus_unregister() - Function to unregister bus
909 * This unregister ishtp bus
911 static void __exit ishtp_bus_unregister(void)
913 bus_unregister(&ishtp_cl_bus_type);
916 module_init(ishtp_bus_register);
917 module_exit(ishtp_bus_unregister);
919 MODULE_LICENSE("GPL");