Lines Matching refs:cl
60 struct hsi_client *cl = to_hsi_client(dev); in hsi_client_release() local
62 kfree(cl->tx_cfg.channels); in hsi_client_release()
63 kfree(cl->rx_cfg.channels); in hsi_client_release()
64 kfree(cl); in hsi_client_release()
70 struct hsi_client *cl; in hsi_new_client() local
73 cl = kzalloc(sizeof(*cl), GFP_KERNEL); in hsi_new_client()
74 if (!cl) in hsi_new_client()
77 cl->tx_cfg = info->tx_cfg; in hsi_new_client()
78 if (cl->tx_cfg.channels) { in hsi_new_client()
79 size = cl->tx_cfg.num_channels * sizeof(*cl->tx_cfg.channels); in hsi_new_client()
80 cl->tx_cfg.channels = kmemdup(info->tx_cfg.channels, size, in hsi_new_client()
82 if (!cl->tx_cfg.channels) in hsi_new_client()
86 cl->rx_cfg = info->rx_cfg; in hsi_new_client()
87 if (cl->rx_cfg.channels) { in hsi_new_client()
88 size = cl->rx_cfg.num_channels * sizeof(*cl->rx_cfg.channels); in hsi_new_client()
89 cl->rx_cfg.channels = kmemdup(info->rx_cfg.channels, size, in hsi_new_client()
91 if (!cl->rx_cfg.channels) in hsi_new_client()
95 cl->device.bus = &hsi_bus_type; in hsi_new_client()
96 cl->device.parent = &port->device; in hsi_new_client()
97 cl->device.release = hsi_client_release; in hsi_new_client()
98 dev_set_name(&cl->device, "%s", info->name); in hsi_new_client()
99 cl->device.platform_data = info->platform_data; in hsi_new_client()
101 cl->device.archdata = *info->archdata; in hsi_new_client()
102 if (device_register(&cl->device) < 0) { in hsi_new_client()
104 put_device(&cl->device); in hsi_new_client()
107 return cl; in hsi_new_client()
109 kfree(cl->tx_cfg.channels); in hsi_new_client()
111 kfree(cl); in hsi_new_client()
199 struct hsi_client *cl; in hsi_add_client_from_dt() local
205 cl = kzalloc(sizeof(*cl), GFP_KERNEL); in hsi_add_client_from_dt()
206 if (!cl) in hsi_add_client_from_dt()
216 &cl->rx_cfg.mode); in hsi_add_client_from_dt()
221 &cl->tx_cfg.mode); in hsi_add_client_from_dt()
225 cl->rx_cfg.mode = mode; in hsi_add_client_from_dt()
226 cl->tx_cfg.mode = mode; in hsi_add_client_from_dt()
230 &cl->tx_cfg.speed); in hsi_add_client_from_dt()
233 cl->rx_cfg.speed = cl->tx_cfg.speed; in hsi_add_client_from_dt()
236 &cl->rx_cfg.flow); in hsi_add_client_from_dt()
241 &cl->rx_cfg.arb_mode); in hsi_add_client_from_dt()
253 cl->rx_cfg.num_channels = cells; in hsi_add_client_from_dt()
254 cl->tx_cfg.num_channels = cells; in hsi_add_client_from_dt()
255 cl->rx_cfg.channels = kcalloc(cells, sizeof(channel), GFP_KERNEL); in hsi_add_client_from_dt()
256 if (!cl->rx_cfg.channels) { in hsi_add_client_from_dt()
261 cl->tx_cfg.channels = kcalloc(cells, sizeof(channel), GFP_KERNEL); in hsi_add_client_from_dt()
262 if (!cl->tx_cfg.channels) { in hsi_add_client_from_dt()
282 cl->rx_cfg.channels[i] = channel; in hsi_add_client_from_dt()
283 cl->tx_cfg.channels[i] = channel; in hsi_add_client_from_dt()
286 cl->rx_cfg.num_hw_channels = max_chan + 1; in hsi_add_client_from_dt()
287 cl->tx_cfg.num_hw_channels = max_chan + 1; in hsi_add_client_from_dt()
289 cl->device.bus = &hsi_bus_type; in hsi_add_client_from_dt()
290 cl->device.parent = &port->device; in hsi_add_client_from_dt()
291 cl->device.release = hsi_client_release; in hsi_add_client_from_dt()
292 cl->device.of_node = client; in hsi_add_client_from_dt()
294 dev_set_name(&cl->device, "%s", name); in hsi_add_client_from_dt()
295 if (device_register(&cl->device) < 0) { in hsi_add_client_from_dt()
297 put_device(&cl->device); in hsi_add_client_from_dt()
303 kfree(cl->tx_cfg.channels); in hsi_add_client_from_dt()
305 kfree(cl->rx_cfg.channels); in hsi_add_client_from_dt()
307 kfree(cl); in hsi_add_client_from_dt()
426 static inline int hsi_dummy_cl(struct hsi_client *cl __maybe_unused) in hsi_dummy_cl()
576 int hsi_async(struct hsi_client *cl, struct hsi_msg *msg) in hsi_async() argument
578 struct hsi_port *port = hsi_get_port(cl); in hsi_async()
580 if (!hsi_port_claimed(cl)) in hsi_async()
584 msg->cl = cl; in hsi_async()
597 int hsi_claim_port(struct hsi_client *cl, unsigned int share) in hsi_claim_port() argument
599 struct hsi_port *port = hsi_get_port(cl); in hsi_claim_port()
613 cl->pclaimed = 1; in hsi_claim_port()
625 void hsi_release_port(struct hsi_client *cl) in hsi_release_port() argument
627 struct hsi_port *port = hsi_get_port(cl); in hsi_release_port()
631 port->release(cl); in hsi_release_port()
632 if (cl->pclaimed) in hsi_release_port()
635 cl->pclaimed = 0; in hsi_release_port()
646 struct hsi_client *cl = container_of(nb, struct hsi_client, nb); in hsi_event_notifier_call() local
648 (*cl->ehandler)(cl, event); in hsi_event_notifier_call()
665 int hsi_register_port_event(struct hsi_client *cl, in hsi_register_port_event() argument
668 struct hsi_port *port = hsi_get_port(cl); in hsi_register_port_event()
670 if (!handler || cl->ehandler) in hsi_register_port_event()
672 if (!hsi_port_claimed(cl)) in hsi_register_port_event()
674 cl->ehandler = handler; in hsi_register_port_event()
675 cl->nb.notifier_call = hsi_event_notifier_call; in hsi_register_port_event()
677 return blocking_notifier_chain_register(&port->n_head, &cl->nb); in hsi_register_port_event()
690 int hsi_unregister_port_event(struct hsi_client *cl) in hsi_unregister_port_event() argument
692 struct hsi_port *port = hsi_get_port(cl); in hsi_unregister_port_event()
695 WARN_ON(!hsi_port_claimed(cl)); in hsi_unregister_port_event()
697 err = blocking_notifier_chain_unregister(&port->n_head, &cl->nb); in hsi_unregister_port_event()
699 cl->ehandler = NULL; in hsi_unregister_port_event()
737 int hsi_get_channel_id_by_name(struct hsi_client *cl, char *name) in hsi_get_channel_id_by_name() argument
741 if (!cl->rx_cfg.channels) in hsi_get_channel_id_by_name()
744 for (i = 0; i < cl->rx_cfg.num_channels; i++) in hsi_get_channel_id_by_name()
745 if (!strcmp(cl->rx_cfg.channels[i].name, name)) in hsi_get_channel_id_by_name()
746 return cl->rx_cfg.channels[i].id; in hsi_get_channel_id_by_name()