2 * Shared Transport Line discipline driver Core
3 * Init Manager module responsible for GPIO control
4 * and firmware download
5 * Copyright (C) 2009-2010 Texas Instruments
6 * Author: Pavan Savoy <pavan_savoy@ti.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #define pr_fmt(fmt) "(stk) :" fmt
24 #include <linux/platform_device.h>
25 #include <linux/jiffies.h>
26 #include <linux/firmware.h>
27 #include <linux/delay.h>
28 #include <linux/wait.h>
29 #include <linux/gpio.h>
30 #include <linux/debugfs.h>
31 #include <linux/seq_file.h>
32 #include <linux/sched.h>
33 #include <linux/sysfs.h>
34 #include <linux/tty.h>
36 #include <linux/skbuff.h>
37 #include <linux/ti_wilink_st.h>
40 #define MAX_ST_DEVICES 3 /* Imagine 1 on each UART for now */
41 static struct platform_device
*st_kim_devices
[MAX_ST_DEVICES
];
43 /**********************************************************************/
44 /* internal functions */
47 * st_get_plat_device -
48 * function which returns the reference to the platform device
49 * requested by id. As of now only 1 such device exists (id=0)
50 * the context requesting for reference can get the id to be
51 * requested by a. The protocol driver which is registering or
52 * b. the tty device which is opened.
54 static struct platform_device
*st_get_plat_device(int id
)
56 return st_kim_devices
[id
];
60 * validate_firmware_response -
61 * function to return whether the firmware response was proper
62 * in case of error don't complete so that waiting for proper
65 void validate_firmware_response(struct kim_data_s
*kim_gdata
)
67 struct sk_buff
*skb
= kim_gdata
->rx_skb
;
68 if (unlikely(skb
->data
[5] != 0)) {
69 pr_err("no proper response during fw download");
70 pr_err("data6 %x", skb
->data
[5]);
71 return; /* keep waiting for the proper response */
73 /* becos of all the script being downloaded */
74 complete_all(&kim_gdata
->kim_rcvd
);
78 /* check for data len received inside kim_int_recv
79 * most often hit the last case to update state to waiting for data
81 static inline int kim_check_data_len(struct kim_data_s
*kim_gdata
, int len
)
83 register int room
= skb_tailroom(kim_gdata
->rx_skb
);
85 pr_debug("len %d room %d", len
, room
);
88 validate_firmware_response(kim_gdata
);
89 } else if (len
> room
) {
90 /* Received packet's payload length is larger.
91 * We can't accommodate it in created skb.
93 pr_err("Data length is too large len %d room %d", len
,
95 kfree_skb(kim_gdata
->rx_skb
);
97 /* Packet header has non-zero payload length and
98 * we have enough space in created skb. Lets read
100 kim_gdata
->rx_state
= ST_W4_DATA
;
101 kim_gdata
->rx_count
= len
;
105 /* Change ST LL state to continue to process next
107 kim_gdata
->rx_state
= ST_W4_PACKET_TYPE
;
108 kim_gdata
->rx_skb
= NULL
;
109 kim_gdata
->rx_count
= 0;
115 * kim_int_recv - receive function called during firmware download
116 * firmware download responses on different UART drivers
117 * have been observed to come in bursts of different
118 * tty_receive and hence the logic
120 void kim_int_recv(struct kim_data_s
*kim_gdata
,
121 const unsigned char *data
, long count
)
123 const unsigned char *ptr
;
124 int len
= 0, type
= 0;
127 pr_debug("%s", __func__
);
128 /* Decode received bytes here */
130 if (unlikely(ptr
== NULL
)) {
131 pr_err(" received null from TTY ");
136 if (kim_gdata
->rx_count
) {
137 len
= min_t(unsigned int, kim_gdata
->rx_count
, count
);
138 memcpy(skb_put(kim_gdata
->rx_skb
, len
), ptr
, len
);
139 kim_gdata
->rx_count
-= len
;
143 if (kim_gdata
->rx_count
)
146 /* Check ST RX state machine , where are we? */
147 switch (kim_gdata
->rx_state
) {
148 /* Waiting for complete packet ? */
150 pr_debug("Complete pkt received");
151 validate_firmware_response(kim_gdata
);
152 kim_gdata
->rx_state
= ST_W4_PACKET_TYPE
;
153 kim_gdata
->rx_skb
= NULL
;
155 /* Waiting for Bluetooth event header ? */
158 (unsigned char *)&kim_gdata
->rx_skb
->data
[1];
159 pr_debug("event hdr: plen 0x%02x\n", *plen
);
160 kim_check_data_len(kim_gdata
, *plen
);
162 } /* end of switch */
163 } /* end of if rx_state */
165 /* Bluetooth event packet? */
167 kim_gdata
->rx_state
= ST_W4_HEADER
;
168 kim_gdata
->rx_count
= 2;
172 pr_info("unknown packet");
180 alloc_skb(1024+8, GFP_ATOMIC
);
181 if (!kim_gdata
->rx_skb
) {
182 pr_err("can't allocate mem for new packet");
183 kim_gdata
->rx_state
= ST_W4_PACKET_TYPE
;
184 kim_gdata
->rx_count
= 0;
187 skb_reserve(kim_gdata
->rx_skb
, 8);
188 kim_gdata
->rx_skb
->cb
[0] = 4;
189 kim_gdata
->rx_skb
->cb
[1] = 0;
195 static long read_local_version(struct kim_data_s
*kim_gdata
, char *bts_scr_name
)
197 unsigned short version
= 0, chip
= 0, min_ver
= 0, maj_ver
= 0;
198 const char read_ver_cmd
[] = { 0x01, 0x01, 0x10, 0x00 };
200 pr_debug("%s", __func__
);
202 INIT_COMPLETION(kim_gdata
->kim_rcvd
);
203 if (4 != st_int_write(kim_gdata
->core_data
, read_ver_cmd
, 4)) {
204 pr_err("kim: couldn't write 4 bytes");
208 if (!wait_for_completion_timeout
209 (&kim_gdata
->kim_rcvd
, msecs_to_jiffies(CMD_RESP_TIME
))) {
210 pr_err(" waiting for ver info- timed out ");
215 MAKEWORD(kim_gdata
->resp_buffer
[13],
216 kim_gdata
->resp_buffer
[14]);
217 chip
= (version
& 0x7C00) >> 10;
218 min_ver
= (version
& 0x007F);
219 maj_ver
= (version
& 0x0380) >> 7;
221 if (version
& 0x8000)
224 sprintf(bts_scr_name
, "TIInit_%d.%d.%d.bts", chip
, maj_ver
, min_ver
);
226 /* to be accessed later via sysfs entry */
227 kim_gdata
->version
.full
= version
;
228 kim_gdata
->version
.chip
= chip
;
229 kim_gdata
->version
.maj_ver
= maj_ver
;
230 kim_gdata
->version
.min_ver
= min_ver
;
232 pr_info("%s", bts_scr_name
);
236 void skip_change_remote_baud(unsigned char **ptr
, long *len
)
238 unsigned char *nxt_action
, *cur_action
;
241 nxt_action
= cur_action
+ sizeof(struct bts_action
) +
242 ((struct bts_action
*) cur_action
)->size
;
244 if (((struct bts_action
*) nxt_action
)->type
!= ACTION_WAIT_EVENT
) {
245 pr_err("invalid action after change remote baud command");
247 *ptr
= *ptr
+ sizeof(struct bts_action
) +
248 ((struct bts_action
*)nxt_action
)->size
;
249 *len
= *len
- (sizeof(struct bts_action
) +
250 ((struct bts_action
*)nxt_action
)->size
);
251 /* warn user on not commenting these in firmware */
252 pr_warn("skipping the wait event of change remote baud");
257 * download_firmware -
258 * internal function which parses through the .bts firmware
259 * script file intreprets SEND, DELAY actions only as of now
261 static long download_firmware(struct kim_data_s
*kim_gdata
)
265 unsigned char *ptr
= NULL
;
266 unsigned char *action_ptr
= NULL
;
267 unsigned char bts_scr_name
[30] = { 0 }; /* 30 char long bts scr name? */
270 unsigned long timeout
;
272 err
= read_local_version(kim_gdata
, bts_scr_name
);
274 pr_err("kim: failed to read local ver");
278 request_firmware(&kim_gdata
->fw_entry
, bts_scr_name
,
279 &kim_gdata
->kim_pdev
->dev
);
280 if (unlikely((err
!= 0) || (kim_gdata
->fw_entry
->data
== NULL
) ||
281 (kim_gdata
->fw_entry
->size
== 0))) {
282 pr_err(" request_firmware failed(errno %ld) for %s", err
,
286 ptr
= (void *)kim_gdata
->fw_entry
->data
;
287 len
= kim_gdata
->fw_entry
->size
;
288 /* bts_header to remove out magic number and
291 ptr
+= sizeof(struct bts_header
);
292 len
-= sizeof(struct bts_header
);
294 while (len
> 0 && ptr
) {
295 pr_debug(" action size %d, type %d ",
296 ((struct bts_action
*)ptr
)->size
,
297 ((struct bts_action
*)ptr
)->type
);
299 switch (((struct bts_action
*)ptr
)->type
) {
300 case ACTION_SEND_COMMAND
: /* action send */
301 action_ptr
= &(((struct bts_action
*)ptr
)->data
[0]);
303 (((struct hci_command
*)action_ptr
)->opcode
==
305 /* ignore remote change
306 * baud rate HCI VS command */
307 pr_warn("change remote baud"
308 " rate command in firmware");
309 skip_change_remote_baud(&ptr
, &len
);
313 * Make sure we have enough free space in uart
314 * tx buffer to write current firmware command
316 cmd_size
= ((struct bts_action
*)ptr
)->size
;
317 timeout
= jiffies
+ msecs_to_jiffies(CMD_WR_TIME
);
320 st_get_uart_wr_room(kim_gdata
->core_data
);
321 if (wr_room_space
< 0) {
322 pr_err("Unable to get free "
323 "space info from uart tx buffer");
324 release_firmware(kim_gdata
->fw_entry
);
325 return wr_room_space
;
327 mdelay(1); /* wait 1ms before checking room */
328 } while ((wr_room_space
< cmd_size
) &&
329 time_before(jiffies
, timeout
));
331 /* Timeout happened ? */
332 if (time_after_eq(jiffies
, timeout
)) {
333 pr_err("Timeout while waiting for free "
334 "free space in uart tx buffer");
335 release_firmware(kim_gdata
->fw_entry
);
340 * Free space found in uart buffer, call st_int_write
341 * to send current firmware command to the uart tx
344 err
= st_int_write(kim_gdata
->core_data
,
345 ((struct bts_action_send
*)action_ptr
)->data
,
346 ((struct bts_action
*)ptr
)->size
);
347 if (unlikely(err
< 0)) {
348 release_firmware(kim_gdata
->fw_entry
);
352 * Check number of bytes written to the uart tx buffer
353 * and requested command write size
355 if (err
!= cmd_size
) {
356 pr_err("Number of bytes written to uart "
357 "tx buffer are not matching with "
358 "requested cmd write size");
359 release_firmware(kim_gdata
->fw_entry
);
363 case ACTION_WAIT_EVENT
: /* wait */
364 if (!wait_for_completion_timeout
365 (&kim_gdata
->kim_rcvd
,
366 msecs_to_jiffies(CMD_RESP_TIME
))) {
367 pr_err("response timeout during fw download ");
369 release_firmware(kim_gdata
->fw_entry
);
372 INIT_COMPLETION(kim_gdata
->kim_rcvd
);
374 case ACTION_DELAY
: /* sleep */
375 pr_info("sleep command in scr");
376 action_ptr
= &(((struct bts_action
*)ptr
)->data
[0]);
377 mdelay(((struct bts_action_delay
*)action_ptr
)->msec
);
381 len
- (sizeof(struct bts_action
) +
382 ((struct bts_action
*)ptr
)->size
);
384 ptr
+ sizeof(struct bts_action
) +
385 ((struct bts_action
*)ptr
)->size
;
387 /* fw download complete */
388 release_firmware(kim_gdata
->fw_entry
);
392 /**********************************************************************/
393 /* functions called from ST core */
394 /* called from ST Core, when REG_IN_PROGRESS (registration in progress)
396 * 1. response to read local version
397 * 2. during send/recv's of firmware download
399 void st_kim_recv(void *disc_data
, const unsigned char *data
, long count
)
401 struct st_data_s
*st_gdata
= (struct st_data_s
*)disc_data
;
402 struct kim_data_s
*kim_gdata
= st_gdata
->kim_data
;
404 /* copy to local buffer */
405 if (unlikely(data
[4] == 0x01 && data
[5] == 0x10 && data
[0] == 0x04)) {
406 /* must be the read_ver_cmd */
407 memcpy(kim_gdata
->resp_buffer
, data
, count
);
408 complete_all(&kim_gdata
->kim_rcvd
);
411 kim_int_recv(kim_gdata
, data
, count
);
412 /* either completes or times out */
417 /* to signal completion of line discipline installation
418 * called from ST Core, upon tty_open
420 void st_kim_complete(void *kim_data
)
422 struct kim_data_s
*kim_gdata
= (struct kim_data_s
*)kim_data
;
423 complete(&kim_gdata
->ldisc_installed
);
427 * st_kim_start - called from ST Core upon 1st registration
428 * This involves toggling the chip enable gpio, reading
429 * the firmware version from chip, forming the fw file name
430 * based on the chip version, requesting the fw, parsing it
431 * and perform download(send/recv).
433 long st_kim_start(void *kim_data
)
436 long retry
= POR_RETRY_COUNT
;
437 struct kim_data_s
*kim_gdata
= (struct kim_data_s
*)kim_data
;
439 pr_info(" %s", __func__
);
442 /* Configure BT nShutdown to HIGH state */
443 gpio_set_value(kim_gdata
->nshutdown
, GPIO_LOW
);
444 mdelay(5); /* FIXME: a proper toggle */
445 gpio_set_value(kim_gdata
->nshutdown
, GPIO_HIGH
);
447 /* re-initialize the completion */
448 INIT_COMPLETION(kim_gdata
->ldisc_installed
);
449 /* send notification to UIM */
450 kim_gdata
->ldisc_install
= 1;
451 pr_info("ldisc_install = 1");
452 sysfs_notify(&kim_gdata
->kim_pdev
->dev
.kobj
,
454 /* wait for ldisc to be installed */
455 err
= wait_for_completion_timeout(&kim_gdata
->ldisc_installed
,
456 msecs_to_jiffies(LDISC_TIME
));
457 if (!err
) { /* timeout */
458 pr_err("line disc installation timed out ");
459 kim_gdata
->ldisc_install
= 0;
460 pr_info("ldisc_install = 0");
461 sysfs_notify(&kim_gdata
->kim_pdev
->dev
.kobj
,
466 /* ldisc installed now */
467 pr_info(" line discipline installed ");
468 err
= download_firmware(kim_gdata
);
470 pr_err("download firmware failed");
471 kim_gdata
->ldisc_install
= 0;
472 pr_info("ldisc_install = 0");
473 sysfs_notify(&kim_gdata
->kim_pdev
->dev
.kobj
,
476 } else { /* on success don't retry */
485 * st_kim_stop - called from ST Core, on the last un-registration
486 * toggle low the chip enable gpio
488 long st_kim_stop(void *kim_data
)
491 struct kim_data_s
*kim_gdata
= (struct kim_data_s
*)kim_data
;
493 INIT_COMPLETION(kim_gdata
->ldisc_installed
);
495 /* Flush any pending characters in the driver and discipline. */
496 tty_ldisc_flush(kim_gdata
->core_data
->tty
);
497 tty_driver_flush_buffer(kim_gdata
->core_data
->tty
);
499 /* send uninstall notification to UIM */
500 pr_info("ldisc_install = 0");
501 kim_gdata
->ldisc_install
= 0;
502 sysfs_notify(&kim_gdata
->kim_pdev
->dev
.kobj
, NULL
, "install");
504 /* wait for ldisc to be un-installed */
505 err
= wait_for_completion_timeout(&kim_gdata
->ldisc_installed
,
506 msecs_to_jiffies(LDISC_TIME
));
507 if (!err
) { /* timeout */
508 pr_err(" timed out waiting for ldisc to be un-installed");
512 /* By default configure BT nShutdown to LOW state */
513 gpio_set_value(kim_gdata
->nshutdown
, GPIO_LOW
);
515 gpio_set_value(kim_gdata
->nshutdown
, GPIO_HIGH
);
517 gpio_set_value(kim_gdata
->nshutdown
, GPIO_LOW
);
521 /**********************************************************************/
522 /* functions called from subsystems */
523 /* called when debugfs entry is read from */
525 static int show_version(struct seq_file
*s
, void *unused
)
527 struct kim_data_s
*kim_gdata
= (struct kim_data_s
*)s
->private;
528 seq_printf(s
, "%04X %d.%d.%d\n", kim_gdata
->version
.full
,
529 kim_gdata
->version
.chip
, kim_gdata
->version
.maj_ver
,
530 kim_gdata
->version
.min_ver
);
534 static int show_list(struct seq_file
*s
, void *unused
)
536 struct kim_data_s
*kim_gdata
= (struct kim_data_s
*)s
->private;
537 kim_st_list_protocols(kim_gdata
->core_data
, s
);
541 static ssize_t
show_install(struct device
*dev
,
542 struct device_attribute
*attr
, char *buf
)
544 struct kim_data_s
*kim_data
= dev_get_drvdata(dev
);
545 return sprintf(buf
, "%d\n", kim_data
->ldisc_install
);
548 static ssize_t
show_dev_name(struct device
*dev
,
549 struct device_attribute
*attr
, char *buf
)
551 struct kim_data_s
*kim_data
= dev_get_drvdata(dev
);
552 return sprintf(buf
, "%s\n", kim_data
->dev_name
);
555 static ssize_t
show_baud_rate(struct device
*dev
,
556 struct device_attribute
*attr
, char *buf
)
558 struct kim_data_s
*kim_data
= dev_get_drvdata(dev
);
559 return sprintf(buf
, "%ld\n", kim_data
->baud_rate
);
562 static ssize_t
show_flow_cntrl(struct device
*dev
,
563 struct device_attribute
*attr
, char *buf
)
565 struct kim_data_s
*kim_data
= dev_get_drvdata(dev
);
566 return sprintf(buf
, "%d\n", kim_data
->flow_cntrl
);
569 /* structures specific for sysfs entries */
570 static struct kobj_attribute ldisc_install
=
571 __ATTR(install
, 0444, (void *)show_install
, NULL
);
573 static struct kobj_attribute uart_dev_name
=
574 __ATTR(dev_name
, 0444, (void *)show_dev_name
, NULL
);
576 static struct kobj_attribute uart_baud_rate
=
577 __ATTR(baud_rate
, 0444, (void *)show_baud_rate
, NULL
);
579 static struct kobj_attribute uart_flow_cntrl
=
580 __ATTR(flow_cntrl
, 0444, (void *)show_flow_cntrl
, NULL
);
582 static struct attribute
*uim_attrs
[] = {
585 &uart_baud_rate
.attr
,
586 &uart_flow_cntrl
.attr
,
590 static struct attribute_group uim_attr_grp
= {
595 * st_kim_ref - reference the core's data
596 * This references the per-ST platform device in the arch/xx/
598 * This would enable multiple such platform devices to exist
599 * on a given platform
601 void st_kim_ref(struct st_data_s
**core_data
, int id
)
603 struct platform_device
*pdev
;
604 struct kim_data_s
*kim_gdata
;
605 /* get kim_gdata reference from platform device */
606 pdev
= st_get_plat_device(id
);
607 kim_gdata
= dev_get_drvdata(&pdev
->dev
);
608 *core_data
= kim_gdata
->core_data
;
611 static int kim_version_open(struct inode
*i
, struct file
*f
)
613 return single_open(f
, show_version
, i
->i_private
);
616 static int kim_list_open(struct inode
*i
, struct file
*f
)
618 return single_open(f
, show_list
, i
->i_private
);
621 static const struct file_operations version_debugfs_fops
= {
623 .open
= kim_version_open
,
626 .release
= single_release
,
628 static const struct file_operations list_debugfs_fops
= {
630 .open
= kim_list_open
,
633 .release
= single_release
,
636 /**********************************************************************/
637 /* functions called from platform device driver subsystem
638 * need to have a relevant platform device entry in the platform's
642 struct dentry
*kim_debugfs_dir
;
643 static int kim_probe(struct platform_device
*pdev
)
646 struct kim_data_s
*kim_gdata
;
647 struct ti_st_plat_data
*pdata
= pdev
->dev
.platform_data
;
649 if ((pdev
->id
!= -1) && (pdev
->id
< MAX_ST_DEVICES
)) {
650 /* multiple devices could exist */
651 st_kim_devices
[pdev
->id
] = pdev
;
653 /* platform's sure about existence of 1 device */
654 st_kim_devices
[0] = pdev
;
657 kim_gdata
= kzalloc(sizeof(struct kim_data_s
), GFP_ATOMIC
);
659 pr_err("no mem to allocate");
662 dev_set_drvdata(&pdev
->dev
, kim_gdata
);
664 status
= st_core_init(&kim_gdata
->core_data
);
666 pr_err(" ST core init failed");
669 /* refer to itself */
670 kim_gdata
->core_data
->kim_data
= kim_gdata
;
672 /* Claim the chip enable nShutdown gpio from the system */
673 kim_gdata
->nshutdown
= pdata
->nshutdown_gpio
;
674 status
= gpio_request(kim_gdata
->nshutdown
, "kim");
675 if (unlikely(status
)) {
676 pr_err(" gpio %ld request failed ", kim_gdata
->nshutdown
);
680 /* Configure nShutdown GPIO as output=0 */
681 status
= gpio_direction_output(kim_gdata
->nshutdown
, 0);
682 if (unlikely(status
)) {
683 pr_err(" unable to configure gpio %ld", kim_gdata
->nshutdown
);
686 /* get reference of pdev for request_firmware
688 kim_gdata
->kim_pdev
= pdev
;
689 init_completion(&kim_gdata
->kim_rcvd
);
690 init_completion(&kim_gdata
->ldisc_installed
);
692 status
= sysfs_create_group(&pdev
->dev
.kobj
, &uim_attr_grp
);
694 pr_err("failed to create sysfs entries");
698 /* copying platform data */
699 strncpy(kim_gdata
->dev_name
, pdata
->dev_name
, UART_DEV_NAME_LEN
);
700 kim_gdata
->flow_cntrl
= pdata
->flow_cntrl
;
701 kim_gdata
->baud_rate
= pdata
->baud_rate
;
702 pr_info("sysfs entries created\n");
704 kim_debugfs_dir
= debugfs_create_dir("ti-st", NULL
);
705 if (IS_ERR(kim_debugfs_dir
)) {
706 pr_err(" debugfs entries creation failed ");
707 kim_debugfs_dir
= NULL
;
711 debugfs_create_file("version", S_IRUGO
, kim_debugfs_dir
,
712 kim_gdata
, &version_debugfs_fops
);
713 debugfs_create_file("protocols", S_IRUGO
, kim_debugfs_dir
,
714 kim_gdata
, &list_debugfs_fops
);
715 pr_info(" debugfs entries created ");
719 static int kim_remove(struct platform_device
*pdev
)
721 /* free the GPIOs requested */
722 struct ti_st_plat_data
*pdata
= pdev
->dev
.platform_data
;
723 struct kim_data_s
*kim_gdata
;
725 kim_gdata
= dev_get_drvdata(&pdev
->dev
);
727 /* Free the Bluetooth/FM/GPIO
728 * nShutdown gpio from the system
730 gpio_free(pdata
->nshutdown_gpio
);
731 pr_info("nshutdown GPIO Freed");
733 debugfs_remove_recursive(kim_debugfs_dir
);
734 sysfs_remove_group(&pdev
->dev
.kobj
, &uim_attr_grp
);
735 pr_info("sysfs entries removed");
737 kim_gdata
->kim_pdev
= NULL
;
738 st_core_exit(kim_gdata
->core_data
);
745 int kim_suspend(struct platform_device
*pdev
, pm_message_t state
)
747 struct ti_st_plat_data
*pdata
= pdev
->dev
.platform_data
;
750 return pdata
->suspend(pdev
, state
);
755 int kim_resume(struct platform_device
*pdev
)
757 struct ti_st_plat_data
*pdata
= pdev
->dev
.platform_data
;
760 return pdata
->resume(pdev
);
765 /**********************************************************************/
766 /* entry point for ST KIM module, called in from ST Core */
767 static struct platform_driver kim_platform_driver
= {
769 .remove
= kim_remove
,
770 .suspend
= kim_suspend
,
771 .resume
= kim_resume
,
774 .owner
= THIS_MODULE
,
778 static int __init
st_kim_init(void)
780 return platform_driver_register(&kim_platform_driver
);
783 static void __exit
st_kim_deinit(void)
785 platform_driver_unregister(&kim_platform_driver
);
789 module_init(st_kim_init
);
790 module_exit(st_kim_deinit
);
791 MODULE_AUTHOR("Pavan Savoy <pavan_savoy@ti.com>");
792 MODULE_DESCRIPTION("Shared Transport Driver for TI BT/FM/GPS combo chips ");
793 MODULE_LICENSE("GPL");