Lines Matching defs:kim_gdata
96 void validate_firmware_response(struct kim_data_s *kim_gdata)
98 struct sk_buff *skb = kim_gdata->rx_skb;
105 complete_all(&kim_gdata->kim_rcvd);
112 static inline int kim_check_data_len(struct kim_data_s *kim_gdata, int len)
114 register int room = skb_tailroom(kim_gdata->rx_skb);
119 validate_firmware_response(kim_gdata);
126 kfree_skb(kim_gdata->rx_skb);
131 kim_gdata->rx_state = ST_BT_W4_DATA;
132 kim_gdata->rx_count = len;
138 kim_gdata->rx_state = ST_W4_PACKET_TYPE;
139 kim_gdata->rx_skb = NULL;
140 kim_gdata->rx_count = 0;
151 void kim_int_recv(struct kim_data_s *kim_gdata,
166 if (kim_gdata->rx_count) {
167 len = min_t(unsigned int, kim_gdata->rx_count, count);
168 memcpy(skb_put(kim_gdata->rx_skb, len), ptr, len);
169 kim_gdata->rx_count -= len;
173 if (kim_gdata->rx_count)
177 switch (kim_gdata->rx_state) {
181 validate_firmware_response(kim_gdata);
182 kim_gdata->rx_state = ST_W4_PACKET_TYPE;
183 kim_gdata->rx_skb = NULL;
187 eh = (struct hci_event_hdr *)kim_gdata->
191 kim_check_data_len(kim_gdata, eh->plen);
199 kim_gdata->rx_state = ST_BT_W4_EVENT_HDR;
200 kim_gdata->rx_count = HCI_EVENT_HDR_SIZE;
211 kim_gdata->rx_skb =
213 if (!kim_gdata->rx_skb) {
215 kim_gdata->rx_state = ST_W4_PACKET_TYPE;
216 kim_gdata->rx_count = 0;
219 bt_cb(kim_gdata->rx_skb)->pkt_type = type;
225 static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name)
232 INIT_COMPLETION(kim_gdata->kim_rcvd);
233 if (4 != st_int_write(kim_gdata->core_data, read_ver_cmd, 4)) {
239 (&kim_gdata->kim_rcvd, msecs_to_jiffies(CMD_RESP_TIME))) {
245 MAKEWORD(kim_gdata->resp_buffer[13],
246 kim_gdata->resp_buffer[14]);
257 kim_gdata->version.full = version;
258 kim_gdata->version.chip = chip;
259 kim_gdata->version.maj_ver = maj_ver;
260 kim_gdata->version.min_ver = min_ver;
271 static long download_firmware(struct kim_data_s *kim_gdata)
279 err = read_local_version(kim_gdata, bts_scr_name);
285 request_firmware(&kim_gdata->fw_entry, bts_scr_name,
286 &kim_gdata->kim_pdev->dev);
287 if (unlikely((err != 0) || (kim_gdata->fw_entry->data == NULL) ||
288 (kim_gdata->fw_entry->size == 0))) {
293 ptr = (void *)kim_gdata->fw_entry->data;
294 len = kim_gdata->fw_entry->size;
320 INIT_COMPLETION(kim_gdata->kim_rcvd);
321 err = st_int_write(kim_gdata->core_data,
325 release_firmware(kim_gdata->fw_entry);
329 (&kim_gdata->kim_rcvd,
334 release_firmware(kim_gdata->fw_entry);
352 release_firmware(kim_gdata->fw_entry);
364 struct kim_data_s *kim_gdata;
368 kim_gdata = dev_get_drvdata(&kim_pdev->dev);
370 if (kim_gdata->gpios[type] == -1) {
382 gpio_set_value(kim_gdata->gpios[ST_FM], GPIO_LOW);
384 gpio_set_value(kim_gdata->gpios[ST_FM], GPIO_HIGH);
389 gpio_set_value(kim_gdata->gpios[ST_GPS], GPIO_HIGH);
391 gpio_set_value(kim_gdata->gpios[ST_GPS], GPIO_LOW);
410 struct kim_data_s *kim_gdata = st_gdata->kim_data;
416 memcpy(kim_gdata->resp_buffer, data, count);
417 complete_all(&kim_gdata->kim_rcvd);
420 kim_int_recv(kim_gdata, data, count);
431 struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data;
432 complete(&kim_gdata->ldisc_installed);
446 struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data;
455 rfkill_set_hw_state(kim_gdata->rfkill[ST_BT], 1);
457 gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_LOW);
459 gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_HIGH);
462 INIT_COMPLETION(kim_gdata->ldisc_installed);
464 rfkill_set_hw_state(kim_gdata->rfkill[ST_BT], 0);
466 err = wait_for_completion_timeout(&kim_gdata->ldisc_installed,
475 err = download_firmware(kim_gdata);
494 struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data;
496 INIT_COMPLETION(kim_gdata->ldisc_installed);
498 err = rfkill_set_hw_state(kim_gdata->rfkill[ST_BT], 1);
501 err = wait_for_completion_timeout(&kim_gdata->ldisc_installed,
509 gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_LOW);
511 gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_HIGH);
513 gpio_set_value(kim_gdata->gpios[ST_BT], GPIO_LOW);
523 struct kim_data_s *kim_gdata = (struct kim_data_s *)s->private;
524 seq_printf(s, "%04X %d.%d.%d\n", kim_gdata->version.full,
525 kim_gdata->version.chip, kim_gdata->version.maj_ver,
526 kim_gdata->version.min_ver);
532 struct kim_data_s *kim_gdata = (struct kim_data_s *)s->private;
533 kim_st_list_protocols(kim_gdata->core_data, s);
574 struct kim_data_s *kim_gdata;
575 /* get kim_gdata reference from platform device */
577 kim_gdata = dev_get_drvdata(&pdev->dev);
578 *core_data = kim_gdata->core_data;
618 struct kim_data_s *kim_gdata;
621 kim_gdata = kzalloc(sizeof(struct kim_data_s), GFP_ATOMIC);
622 if (!kim_gdata) {
626 dev_set_drvdata(&pdev->dev, kim_gdata);
628 status = st_core_init(&kim_gdata->core_data);
634 kim_gdata->core_data->kim_data = kim_gdata;
637 kim_gdata->gpios[proto] = gpios[proto];
672 kim_gdata->kim_pdev = pdev;
673 init_completion(&kim_gdata->kim_rcvd);
674 init_completion(&kim_gdata->ldisc_installed);
678 kim_gdata->rf_protos[proto] = proto;
679 kim_gdata->rfkill[proto] = rfkill_alloc(protocol_names[proto],
681 &kim_rfkill_ops, &kim_gdata->rf_protos[proto]);
682 if (kim_gdata->rfkill[proto] == NULL) {
688 rfkill_init_sw_state(kim_gdata->rfkill[proto], 1);
689 status = rfkill_register(kim_gdata->rfkill[proto]);
693 rfkill_unregister(kim_gdata->rfkill[proto]);
707 kim_gdata, &version_debugfs_fops);
709 kim_gdata, &list_debugfs_fops);
720 struct kim_data_s *kim_gdata;
722 kim_gdata = dev_get_drvdata(&pdev->dev);
729 rfkill_unregister(kim_gdata->rfkill[proto]);
730 rfkill_destroy(kim_gdata->rfkill[proto]);
731 kim_gdata->rfkill[proto] = NULL;
735 kim_gdata->kim_pdev = NULL;
736 st_core_exit(kim_gdata->core_data);
738 kfree(kim_gdata);
739 kim_gdata = NULL;