Lines Matching refs:cl

73 	struct hsi_client *cl = to_hsi_client(dev);  in hsi_client_release()  local
75 kfree(cl->tx_cfg.channels); in hsi_client_release()
76 kfree(cl->rx_cfg.channels); in hsi_client_release()
77 kfree(cl); in hsi_client_release()
83 struct hsi_client *cl; in hsi_new_client() local
86 cl = kzalloc(sizeof(*cl), GFP_KERNEL); in hsi_new_client()
87 if (!cl) in hsi_new_client()
90 cl->tx_cfg = info->tx_cfg; in hsi_new_client()
91 if (cl->tx_cfg.channels) { in hsi_new_client()
92 size = cl->tx_cfg.num_channels * sizeof(*cl->tx_cfg.channels); in hsi_new_client()
93 cl->tx_cfg.channels = kzalloc(size , GFP_KERNEL); in hsi_new_client()
94 memcpy(cl->tx_cfg.channels, info->tx_cfg.channels, size); in hsi_new_client()
97 cl->rx_cfg = info->rx_cfg; in hsi_new_client()
98 if (cl->rx_cfg.channels) { in hsi_new_client()
99 size = cl->rx_cfg.num_channels * sizeof(*cl->rx_cfg.channels); in hsi_new_client()
100 cl->rx_cfg.channels = kzalloc(size , GFP_KERNEL); in hsi_new_client()
101 memcpy(cl->rx_cfg.channels, info->rx_cfg.channels, size); in hsi_new_client()
104 cl->device.bus = &hsi_bus_type; in hsi_new_client()
105 cl->device.parent = &port->device; in hsi_new_client()
106 cl->device.release = hsi_client_release; in hsi_new_client()
107 dev_set_name(&cl->device, "%s", info->name); in hsi_new_client()
108 cl->device.platform_data = info->platform_data; in hsi_new_client()
110 cl->device.archdata = *info->archdata; in hsi_new_client()
111 if (device_register(&cl->device) < 0) { in hsi_new_client()
113 put_device(&cl->device); in hsi_new_client()
116 return cl; in hsi_new_client()
202 struct hsi_client *cl; in hsi_add_client_from_dt() local
208 cl = kzalloc(sizeof(*cl), GFP_KERNEL); in hsi_add_client_from_dt()
209 if (!cl) in hsi_add_client_from_dt()
216 dev_set_name(&cl->device, "%s", name); in hsi_add_client_from_dt()
221 &cl->rx_cfg.mode); in hsi_add_client_from_dt()
226 &cl->tx_cfg.mode); in hsi_add_client_from_dt()
230 cl->rx_cfg.mode = mode; in hsi_add_client_from_dt()
231 cl->tx_cfg.mode = mode; in hsi_add_client_from_dt()
235 &cl->tx_cfg.speed); in hsi_add_client_from_dt()
238 cl->rx_cfg.speed = cl->tx_cfg.speed; in hsi_add_client_from_dt()
241 &cl->rx_cfg.flow); in hsi_add_client_from_dt()
246 &cl->rx_cfg.arb_mode); in hsi_add_client_from_dt()
258 cl->rx_cfg.num_channels = cells; in hsi_add_client_from_dt()
259 cl->tx_cfg.num_channels = cells; in hsi_add_client_from_dt()
261 cl->rx_cfg.channels = kzalloc(cells * sizeof(channel), GFP_KERNEL); in hsi_add_client_from_dt()
262 if (!cl->rx_cfg.channels) { in hsi_add_client_from_dt()
267 cl->tx_cfg.channels = kzalloc(cells * sizeof(channel), GFP_KERNEL); in hsi_add_client_from_dt()
268 if (!cl->tx_cfg.channels) { in hsi_add_client_from_dt()
288 cl->rx_cfg.channels[i] = channel; in hsi_add_client_from_dt()
289 cl->tx_cfg.channels[i] = channel; in hsi_add_client_from_dt()
292 cl->rx_cfg.num_hw_channels = max_chan + 1; in hsi_add_client_from_dt()
293 cl->tx_cfg.num_hw_channels = max_chan + 1; in hsi_add_client_from_dt()
295 cl->device.bus = &hsi_bus_type; in hsi_add_client_from_dt()
296 cl->device.parent = &port->device; in hsi_add_client_from_dt()
297 cl->device.release = hsi_client_release; in hsi_add_client_from_dt()
298 cl->device.of_node = client; in hsi_add_client_from_dt()
300 if (device_register(&cl->device) < 0) { in hsi_add_client_from_dt()
302 put_device(&cl->device); in hsi_add_client_from_dt()
309 kfree(cl->tx_cfg.channels); in hsi_add_client_from_dt()
311 kfree(cl->rx_cfg.channels); in hsi_add_client_from_dt()
313 kfree(cl); in hsi_add_client_from_dt()
432 static inline int hsi_dummy_cl(struct hsi_client *cl __maybe_unused) in hsi_dummy_cl()
582 int hsi_async(struct hsi_client *cl, struct hsi_msg *msg) in hsi_async() argument
584 struct hsi_port *port = hsi_get_port(cl); in hsi_async()
586 if (!hsi_port_claimed(cl)) in hsi_async()
590 msg->cl = cl; in hsi_async()
603 int hsi_claim_port(struct hsi_client *cl, unsigned int share) in hsi_claim_port() argument
605 struct hsi_port *port = hsi_get_port(cl); in hsi_claim_port()
619 cl->pclaimed = 1; in hsi_claim_port()
631 void hsi_release_port(struct hsi_client *cl) in hsi_release_port() argument
633 struct hsi_port *port = hsi_get_port(cl); in hsi_release_port()
637 port->release(cl); in hsi_release_port()
638 if (cl->pclaimed) in hsi_release_port()
641 cl->pclaimed = 0; in hsi_release_port()
652 struct hsi_client *cl = container_of(nb, struct hsi_client, nb); in hsi_event_notifier_call() local
654 (*cl->ehandler)(cl, event); in hsi_event_notifier_call()
671 int hsi_register_port_event(struct hsi_client *cl, in hsi_register_port_event() argument
674 struct hsi_port *port = hsi_get_port(cl); in hsi_register_port_event()
676 if (!handler || cl->ehandler) in hsi_register_port_event()
678 if (!hsi_port_claimed(cl)) in hsi_register_port_event()
680 cl->ehandler = handler; in hsi_register_port_event()
681 cl->nb.notifier_call = hsi_event_notifier_call; in hsi_register_port_event()
683 return atomic_notifier_chain_register(&port->n_head, &cl->nb); in hsi_register_port_event()
696 int hsi_unregister_port_event(struct hsi_client *cl) in hsi_unregister_port_event() argument
698 struct hsi_port *port = hsi_get_port(cl); in hsi_unregister_port_event()
701 WARN_ON(!hsi_port_claimed(cl)); in hsi_unregister_port_event()
703 err = atomic_notifier_chain_unregister(&port->n_head, &cl->nb); in hsi_unregister_port_event()
705 cl->ehandler = NULL; in hsi_unregister_port_event()
743 int hsi_get_channel_id_by_name(struct hsi_client *cl, char *name) in hsi_get_channel_id_by_name() argument
747 if (!cl->rx_cfg.channels) in hsi_get_channel_id_by_name()
750 for (i = 0; i < cl->rx_cfg.num_channels; i++) in hsi_get_channel_id_by_name()
751 if (!strcmp(cl->rx_cfg.channels[i].name, name)) in hsi_get_channel_id_by_name()
752 return cl->rx_cfg.channels[i].id; in hsi_get_channel_id_by_name()