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()
108 return cl; in hsi_new_client()
110 kfree(cl->tx_cfg.channels); in hsi_new_client()
112 kfree(cl); in hsi_new_client()
200 struct hsi_client *cl; in hsi_add_client_from_dt() local
206 cl = kzalloc(sizeof(*cl), GFP_KERNEL); in hsi_add_client_from_dt()
207 if (!cl) in hsi_add_client_from_dt()
217 &cl->rx_cfg.mode); in hsi_add_client_from_dt()
222 &cl->tx_cfg.mode); in hsi_add_client_from_dt()
226 cl->rx_cfg.mode = mode; in hsi_add_client_from_dt()
227 cl->tx_cfg.mode = mode; in hsi_add_client_from_dt()
231 &cl->tx_cfg.speed); in hsi_add_client_from_dt()
234 cl->rx_cfg.speed = cl->tx_cfg.speed; in hsi_add_client_from_dt()
237 &cl->rx_cfg.flow); in hsi_add_client_from_dt()
242 &cl->rx_cfg.arb_mode); in hsi_add_client_from_dt()
254 cl->rx_cfg.num_channels = cells; in hsi_add_client_from_dt()
255 cl->tx_cfg.num_channels = cells; in hsi_add_client_from_dt()
256 cl->rx_cfg.channels = kcalloc(cells, sizeof(channel), GFP_KERNEL); in hsi_add_client_from_dt()
257 if (!cl->rx_cfg.channels) { in hsi_add_client_from_dt()
262 cl->tx_cfg.channels = kcalloc(cells, sizeof(channel), GFP_KERNEL); in hsi_add_client_from_dt()
263 if (!cl->tx_cfg.channels) { in hsi_add_client_from_dt()
283 cl->rx_cfg.channels[i] = channel; in hsi_add_client_from_dt()
284 cl->tx_cfg.channels[i] = channel; in hsi_add_client_from_dt()
287 cl->rx_cfg.num_hw_channels = max_chan + 1; in hsi_add_client_from_dt()
288 cl->tx_cfg.num_hw_channels = max_chan + 1; in hsi_add_client_from_dt()
290 cl->device.bus = &hsi_bus_type; in hsi_add_client_from_dt()
291 cl->device.parent = &port->device; in hsi_add_client_from_dt()
292 cl->device.release = hsi_client_release; in hsi_add_client_from_dt()
293 cl->device.of_node = client; in hsi_add_client_from_dt()
295 dev_set_name(&cl->device, "%s", name); in hsi_add_client_from_dt()
296 if (device_register(&cl->device) < 0) { in hsi_add_client_from_dt()
298 put_device(&cl->device); in hsi_add_client_from_dt()
304 kfree(cl->tx_cfg.channels); in hsi_add_client_from_dt()
306 kfree(cl->rx_cfg.channels); in hsi_add_client_from_dt()
308 kfree(cl); in hsi_add_client_from_dt()
427 static inline int hsi_dummy_cl(struct hsi_client *cl __maybe_unused) in hsi_dummy_cl()
577 int hsi_async(struct hsi_client *cl, struct hsi_msg *msg) in hsi_async() argument
579 struct hsi_port *port = hsi_get_port(cl); in hsi_async()
581 if (!hsi_port_claimed(cl)) in hsi_async()
585 msg->cl = cl; in hsi_async()
598 int hsi_claim_port(struct hsi_client *cl, unsigned int share) in hsi_claim_port() argument
600 struct hsi_port *port = hsi_get_port(cl); in hsi_claim_port()
614 cl->pclaimed = 1; in hsi_claim_port()
626 void hsi_release_port(struct hsi_client *cl) in hsi_release_port() argument
628 struct hsi_port *port = hsi_get_port(cl); in hsi_release_port()
632 port->release(cl); in hsi_release_port()
633 if (cl->pclaimed) in hsi_release_port()
636 cl->pclaimed = 0; in hsi_release_port()
647 struct hsi_client *cl = container_of(nb, struct hsi_client, nb); in hsi_event_notifier_call() local
649 (*cl->ehandler)(cl, event); in hsi_event_notifier_call()
666 int hsi_register_port_event(struct hsi_client *cl, in hsi_register_port_event() argument
669 struct hsi_port *port = hsi_get_port(cl); in hsi_register_port_event()
671 if (!handler || cl->ehandler) in hsi_register_port_event()
673 if (!hsi_port_claimed(cl)) in hsi_register_port_event()
675 cl->ehandler = handler; in hsi_register_port_event()
676 cl->nb.notifier_call = hsi_event_notifier_call; in hsi_register_port_event()
678 return blocking_notifier_chain_register(&port->n_head, &cl->nb); in hsi_register_port_event()
691 int hsi_unregister_port_event(struct hsi_client *cl) in hsi_unregister_port_event() argument
693 struct hsi_port *port = hsi_get_port(cl); in hsi_unregister_port_event()
696 WARN_ON(!hsi_port_claimed(cl)); in hsi_unregister_port_event()
698 err = blocking_notifier_chain_unregister(&port->n_head, &cl->nb); in hsi_unregister_port_event()
700 cl->ehandler = NULL; in hsi_unregister_port_event()
738 int hsi_get_channel_id_by_name(struct hsi_client *cl, char *name) in hsi_get_channel_id_by_name() argument
742 if (!cl->rx_cfg.channels) in hsi_get_channel_id_by_name()
745 for (i = 0; i < cl->rx_cfg.num_channels; i++) in hsi_get_channel_id_by_name()
746 if (!strcmp(cl->rx_cfg.channels[i].name, name)) in hsi_get_channel_id_by_name()
747 return cl->rx_cfg.channels[i].id; in hsi_get_channel_id_by_name()