1 /* arch/arm/mach-msm/smd.c
3 * Copyright (C) 2007 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
17 #include <linux/platform_device.h>
18 #include <linux/module.h>
20 #include <linux/cdev.h>
21 #include <linux/device.h>
22 #include <linux/wait.h>
23 #include <linux/interrupt.h>
24 #include <linux/irq.h>
25 #include <linux/list.h>
26 #include <linux/slab.h>
27 #include <linux/debugfs.h>
28 #include <linux/delay.h>
31 #include <mach/msm_smd.h>
32 #include <mach/msm_iomap.h>
33 #include <mach/system.h>
35 #include "smd_private.h"
36 #include "proc_comm.h"
38 #if defined(CONFIG_ARCH_QSD8X50)
39 #define CONFIG_QDSP6 1
42 void (*msm_hw_reset_hook)(void);
44 #define MODULE_NAME "msm_smd"
47 MSM_SMD_DEBUG = 1U << 0,
48 MSM_SMSM_DEBUG = 1U << 0,
51 static int msm_smd_debug_mask;
58 static unsigned dummy_state[SMSM_STATE_COUNT];
60 static struct shared_info smd_info = {
61 .state = (unsigned) &dummy_state,
64 module_param_named(debug_mask, msm_smd_debug_mask,
65 int, S_IRUGO | S_IWUSR | S_IWGRP);
67 void *smem_item(unsigned id, unsigned *size);
68 static void smd_diag(void);
70 static unsigned last_heap_free = 0xffffffff;
72 static inline void msm_a2m_int(uint32_t irq)
74 #if defined(CONFIG_ARCH_MSM7X30)
75 writel(1 << irq, MSM_GCC_BASE + 0x8);
77 writel(1, MSM_CSR_BASE + 0x400 + (irq * 4));
82 static inline void notify_other_smsm(void)
90 static inline void notify_modem_smd(void)
95 static inline void notify_dsp_smd(void)
100 static void smd_diag(void)
104 x = smem_find(ID_DIAG_ERR_MSG, SZ_DIAG_ERR_MSG);
106 x[SZ_DIAG_ERR_MSG - 1] = 0;
107 pr_info("smem: DIAG '%s'\n", x);
111 /* call when SMSM_RESET flag is set in the A9's smsm_state */
112 static void handle_modem_crash(void)
114 pr_err("ARM9 has CRASHED\n");
117 /* hard reboot if possible */
118 if (msm_hw_reset_hook)
121 /* in this case the modem or watchdog should reboot us */
126 uint32_t raw_smsm_get_state(enum smsm_state_item item)
128 return readl(smd_info.state + item * 4);
131 static int check_for_modem_crash(void)
133 if (raw_smsm_get_state(SMSM_STATE_MODEM) & SMSM_RESET) {
134 handle_modem_crash();
140 /* the spinlock is used to synchronize between the
141 * irq handler and code that mutates the channel
142 * list or fiddles with channel state
144 DEFINE_SPINLOCK(smd_lock);
145 DEFINE_SPINLOCK(smem_lock);
147 /* the mutex is used during open() and close()
148 * operations to avoid races while creating or
149 * destroying smd_channel structures
151 static DEFINE_MUTEX(smd_creation_mutex);
153 static int smd_initialized;
155 LIST_HEAD(smd_ch_closed_list);
156 LIST_HEAD(smd_ch_list_modem);
157 LIST_HEAD(smd_ch_list_dsp);
159 static unsigned char smd_ch_allocated[64];
160 static struct work_struct probe_work;
162 static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type);
164 static void smd_channel_probe_worker(struct work_struct *work)
166 struct smd_alloc_elm *shared;
171 shared = smem_find(ID_CH_ALLOC_TBL, sizeof(*shared) * 64);
173 pr_err("smd: cannot find allocation table\n");
176 for (n = 0; n < 64; n++) {
177 if (smd_ch_allocated[n])
179 if (!shared[n].ref_count)
181 if (!shared[n].name[0])
183 ctype = shared[n].ctype;
184 type = ctype & SMD_TYPE_MASK;
186 /* DAL channels are stream but neither the modem,
187 * nor the DSP correctly indicate this. Fixup manually.
189 if (!memcmp(shared[n].name, "DAL", 3))
190 ctype = (ctype & (~SMD_KIND_MASK)) | SMD_KIND_STREAM;
192 type = shared[n].ctype & SMD_TYPE_MASK;
193 if ((type == SMD_TYPE_APPS_MODEM) ||
194 (type == SMD_TYPE_APPS_DSP))
195 if (!smd_alloc_channel(shared[n].name, shared[n].cid, ctype))
196 smd_ch_allocated[n] = 1;
200 /* how many bytes are available for reading */
201 static int smd_stream_read_avail(struct smd_channel *ch)
203 return (ch->recv->head - ch->recv->tail) & ch->fifo_mask;
206 /* how many bytes we are free to write */
207 static int smd_stream_write_avail(struct smd_channel *ch)
209 return ch->fifo_mask -
210 ((ch->send->head - ch->send->tail) & ch->fifo_mask);
213 static int smd_packet_read_avail(struct smd_channel *ch)
215 if (ch->current_packet) {
216 int n = smd_stream_read_avail(ch);
217 if (n > ch->current_packet)
218 n = ch->current_packet;
225 static int smd_packet_write_avail(struct smd_channel *ch)
227 int n = smd_stream_write_avail(ch);
228 return n > SMD_HEADER_SIZE ? n - SMD_HEADER_SIZE : 0;
231 static int ch_is_open(struct smd_channel *ch)
233 return (ch->recv->state == SMD_SS_OPENED) &&
234 (ch->send->state == SMD_SS_OPENED);
237 /* provide a pointer and length to readable data in the fifo */
238 static unsigned ch_read_buffer(struct smd_channel *ch, void **ptr)
240 unsigned head = ch->recv->head;
241 unsigned tail = ch->recv->tail;
242 *ptr = (void *) (ch->recv_data + tail);
247 return ch->fifo_size - tail;
250 /* advance the fifo read pointer after data from ch_read_buffer is consumed */
251 static void ch_read_done(struct smd_channel *ch, unsigned count)
253 BUG_ON(count > smd_stream_read_avail(ch));
254 ch->recv->tail = (ch->recv->tail + count) & ch->fifo_mask;
258 /* basic read interface to ch_read_{buffer,done} used
259 * by smd_*_read() and update_packet_state()
260 * will read-and-discard if the _data pointer is null
262 static int ch_read(struct smd_channel *ch, void *_data, int len)
266 unsigned char *data = _data;
270 n = ch_read_buffer(ch, &ptr);
277 memcpy(data, ptr, n);
284 return orig_len - len;
287 static void update_stream_state(struct smd_channel *ch)
289 /* streams have no special state requiring updating */
292 static void update_packet_state(struct smd_channel *ch)
297 /* can't do anything if we're in the middle of a packet */
298 if (ch->current_packet != 0)
301 /* don't bother unless we can get the full header */
302 if (smd_stream_read_avail(ch) < SMD_HEADER_SIZE)
305 r = ch_read(ch, hdr, SMD_HEADER_SIZE);
306 BUG_ON(r != SMD_HEADER_SIZE);
308 ch->current_packet = hdr[0];
311 /* provide a pointer and length to next free space in the fifo */
312 static unsigned ch_write_buffer(struct smd_channel *ch, void **ptr)
314 unsigned head = ch->send->head;
315 unsigned tail = ch->send->tail;
316 *ptr = (void *) (ch->send_data + head);
319 return tail - head - 1;
322 return ch->fifo_size - head - 1;
324 return ch->fifo_size - head;
328 /* advace the fifo write pointer after freespace
329 * from ch_write_buffer is filled
331 static void ch_write_done(struct smd_channel *ch, unsigned count)
333 BUG_ON(count > smd_stream_write_avail(ch));
334 ch->send->head = (ch->send->head + count) & ch->fifo_mask;
338 static void ch_set_state(struct smd_channel *ch, unsigned n)
340 if (n == SMD_SS_OPENED) {
350 ch->send->fSTATE = 1;
351 ch->notify_other_cpu();
354 static void do_smd_probe(void)
356 struct smem_shared *shared = (void *) MSM_SHARED_RAM_BASE;
357 if (shared->heap_info.free_offset != last_heap_free) {
358 last_heap_free = shared->heap_info.free_offset;
359 schedule_work(&probe_work);
363 static void smd_state_change(struct smd_channel *ch,
364 unsigned last, unsigned next)
366 ch->last_state = next;
368 pr_info("SMD: ch %d %d -> %d\n", ch->n, last, next);
374 if (ch->send->state != SMD_SS_OPENED)
375 ch_set_state(ch, SMD_SS_OPENED);
376 ch->notify(ch->priv, SMD_EVENT_OPEN);
378 case SMD_SS_FLUSHING:
380 /* we should force them to close? */
382 ch->notify(ch->priv, SMD_EVENT_CLOSE);
386 static void handle_smd_irq(struct list_head *list, void (*notify)(void))
389 struct smd_channel *ch;
394 spin_lock_irqsave(&smd_lock, flags);
395 list_for_each_entry(ch, list, ch_list) {
397 if (ch_is_open(ch)) {
398 if (ch->recv->fHEAD) {
403 if (ch->recv->fTAIL) {
408 if (ch->recv->fSTATE) {
409 ch->recv->fSTATE = 0;
414 tmp = ch->recv->state;
415 if (tmp != ch->last_state)
416 smd_state_change(ch, ch->last_state, tmp);
418 ch->update_state(ch);
419 ch->notify(ch->priv, SMD_EVENT_DATA);
424 spin_unlock_irqrestore(&smd_lock, flags);
428 static irqreturn_t smd_modem_irq_handler(int irq, void *data)
430 handle_smd_irq(&smd_ch_list_modem, notify_modem_smd);
434 static irqreturn_t smd_dsp_irq_handler(int irq, void *data)
436 handle_smd_irq(&smd_ch_list_dsp, notify_dsp_smd);
440 static void smd_fake_irq_handler(unsigned long arg)
442 handle_smd_irq(&smd_ch_list_modem, notify_modem_smd);
443 handle_smd_irq(&smd_ch_list_dsp, notify_dsp_smd);
446 static DECLARE_TASKLET(smd_fake_irq_tasklet, smd_fake_irq_handler, 0);
448 static inline int smd_need_int(struct smd_channel *ch)
450 if (ch_is_open(ch)) {
451 if (ch->recv->fHEAD || ch->recv->fTAIL || ch->recv->fSTATE)
453 if (ch->recv->state != ch->last_state)
459 void smd_sleep_exit(void)
462 struct smd_channel *ch;
465 spin_lock_irqsave(&smd_lock, flags);
466 list_for_each_entry(ch, &smd_ch_list_modem, ch_list) {
467 if (smd_need_int(ch)) {
472 list_for_each_entry(ch, &smd_ch_list_dsp, ch_list) {
473 if (smd_need_int(ch)) {
478 spin_unlock_irqrestore(&smd_lock, flags);
482 if (msm_smd_debug_mask & MSM_SMD_DEBUG)
483 pr_info("smd_sleep_exit need interrupt\n");
484 tasklet_schedule(&smd_fake_irq_tasklet);
489 void smd_kick(smd_channel_t *ch)
494 spin_lock_irqsave(&smd_lock, flags);
495 ch->update_state(ch);
496 tmp = ch->recv->state;
497 if (tmp != ch->last_state) {
498 ch->last_state = tmp;
499 if (tmp == SMD_SS_OPENED)
500 ch->notify(ch->priv, SMD_EVENT_OPEN);
502 ch->notify(ch->priv, SMD_EVENT_CLOSE);
504 ch->notify(ch->priv, SMD_EVENT_DATA);
505 ch->notify_other_cpu();
506 spin_unlock_irqrestore(&smd_lock, flags);
509 static int smd_is_packet(int chn, unsigned type)
511 type &= SMD_KIND_MASK;
512 if (type == SMD_KIND_PACKET)
514 if (type == SMD_KIND_STREAM)
517 /* older AMSS reports SMD_KIND_UNKNOWN always */
518 if ((chn > 4) || (chn == 1))
524 static int smd_stream_write(smd_channel_t *ch, const void *_data, int len)
527 const unsigned char *buf = _data;
534 while ((xfer = ch_write_buffer(ch, &ptr)) != 0) {
539 memcpy(ptr, buf, xfer);
540 ch_write_done(ch, xfer);
547 ch->notify_other_cpu();
549 return orig_len - len;
552 static int smd_packet_write(smd_channel_t *ch, const void *_data, int len)
559 if (smd_stream_write_avail(ch) < (len + SMD_HEADER_SIZE))
563 hdr[1] = hdr[2] = hdr[3] = hdr[4] = 0;
565 smd_stream_write(ch, hdr, sizeof(hdr));
566 smd_stream_write(ch, _data, len);
571 static int smd_stream_read(smd_channel_t *ch, void *data, int len)
578 r = ch_read(ch, data, len);
580 ch->notify_other_cpu();
585 static int smd_packet_read(smd_channel_t *ch, void *data, int len)
593 if (len > ch->current_packet)
594 len = ch->current_packet;
596 r = ch_read(ch, data, len);
598 ch->notify_other_cpu();
600 spin_lock_irqsave(&smd_lock, flags);
601 ch->current_packet -= r;
602 update_packet_state(ch);
603 spin_unlock_irqrestore(&smd_lock, flags);
608 static int smd_alloc_v2(struct smd_channel *ch)
610 struct smd_shared_v2 *shared2;
614 shared2 = smem_alloc(SMEM_SMD_BASE_ID + ch->n, sizeof(*shared2));
615 buffer = smem_item(SMEM_SMD_FIFO_BASE_ID + ch->n, &buffer_sz);
620 /* buffer must be a power-of-two size */
621 if (buffer_sz & (buffer_sz - 1))
625 ch->send = &shared2->ch0;
626 ch->recv = &shared2->ch1;
627 ch->send_data = buffer;
628 ch->recv_data = buffer + buffer_sz;
629 ch->fifo_size = buffer_sz;
633 static int smd_alloc_v1(struct smd_channel *ch)
635 struct smd_shared_v1 *shared1;
636 shared1 = smem_alloc(ID_SMD_CHANNELS + ch->n, sizeof(*shared1));
638 pr_err("smd_alloc_channel() cid %d does not exist\n", ch->n);
641 ch->send = &shared1->ch0;
642 ch->recv = &shared1->ch1;
643 ch->send_data = shared1->data0;
644 ch->recv_data = shared1->data1;
645 ch->fifo_size = SMD_BUF_SIZE;
650 static int smd_alloc_channel(const char *name, uint32_t cid, uint32_t type)
652 struct smd_channel *ch;
654 ch = kzalloc(sizeof(struct smd_channel), GFP_KERNEL);
656 pr_err("smd_alloc_channel() out of memory\n");
661 if (smd_alloc_v2(ch) && smd_alloc_v1(ch)) {
666 ch->fifo_mask = ch->fifo_size - 1;
669 if ((type & SMD_TYPE_MASK) == SMD_TYPE_APPS_MODEM)
670 ch->notify_other_cpu = notify_modem_smd;
672 ch->notify_other_cpu = notify_dsp_smd;
674 if (smd_is_packet(cid, type)) {
675 ch->read = smd_packet_read;
676 ch->write = smd_packet_write;
677 ch->read_avail = smd_packet_read_avail;
678 ch->write_avail = smd_packet_write_avail;
679 ch->update_state = update_packet_state;
681 ch->read = smd_stream_read;
682 ch->write = smd_stream_write;
683 ch->read_avail = smd_stream_read_avail;
684 ch->write_avail = smd_stream_write_avail;
685 ch->update_state = update_stream_state;
688 if ((type & 0xff) == 0)
689 memcpy(ch->name, "SMD_", 4);
691 memcpy(ch->name, "DSP_", 4);
692 memcpy(ch->name + 4, name, 20);
694 ch->pdev.name = ch->name;
697 pr_info("smd_alloc_channel() cid=%02d size=%05d '%s'\n",
698 ch->n, ch->fifo_size, ch->name);
700 mutex_lock(&smd_creation_mutex);
701 list_add(&ch->ch_list, &smd_ch_closed_list);
702 mutex_unlock(&smd_creation_mutex);
704 platform_device_register(&ch->pdev);
708 static void do_nothing_notify(void *priv, unsigned flags)
712 struct smd_channel *smd_get_channel(const char *name)
714 struct smd_channel *ch;
716 mutex_lock(&smd_creation_mutex);
717 list_for_each_entry(ch, &smd_ch_closed_list, ch_list) {
718 if (!strcmp(name, ch->name)) {
719 list_del(&ch->ch_list);
720 mutex_unlock(&smd_creation_mutex);
724 mutex_unlock(&smd_creation_mutex);
729 int smd_open(const char *name, smd_channel_t **_ch,
730 void *priv, void (*notify)(void *, unsigned))
732 struct smd_channel *ch;
735 if (smd_initialized == 0) {
736 pr_info("smd_open() before smd_init()\n");
740 ch = smd_get_channel(name);
745 notify = do_nothing_notify;
748 ch->current_packet = 0;
749 ch->last_state = SMD_SS_CLOSED;
754 spin_lock_irqsave(&smd_lock, flags);
756 if ((ch->type & SMD_TYPE_MASK) == SMD_TYPE_APPS_MODEM)
757 list_add(&ch->ch_list, &smd_ch_list_modem);
759 list_add(&ch->ch_list, &smd_ch_list_dsp);
761 /* If the remote side is CLOSING, we need to get it to
762 * move to OPENING (which we'll do by moving from CLOSED to
763 * OPENING) and then get it to move from OPENING to
764 * OPENED (by doing the same state change ourselves).
766 * Otherwise, it should be OPENING and we can move directly
767 * to OPENED so that it will follow.
769 if (ch->recv->state == SMD_SS_CLOSING) {
771 ch_set_state(ch, SMD_SS_OPENING);
773 ch_set_state(ch, SMD_SS_OPENED);
775 spin_unlock_irqrestore(&smd_lock, flags);
781 int smd_close(smd_channel_t *ch)
785 pr_info("smd_close(%p)\n", ch);
790 spin_lock_irqsave(&smd_lock, flags);
791 ch->notify = do_nothing_notify;
792 list_del(&ch->ch_list);
793 ch_set_state(ch, SMD_SS_CLOSED);
794 spin_unlock_irqrestore(&smd_lock, flags);
796 mutex_lock(&smd_creation_mutex);
797 list_add(&ch->ch_list, &smd_ch_closed_list);
798 mutex_unlock(&smd_creation_mutex);
803 int smd_read(smd_channel_t *ch, void *data, int len)
805 return ch->read(ch, data, len);
808 int smd_write(smd_channel_t *ch, const void *data, int len)
810 return ch->write(ch, data, len);
813 int smd_write_atomic(smd_channel_t *ch, const void *data, int len)
817 spin_lock_irqsave(&smd_lock, flags);
818 res = ch->write(ch, data, len);
819 spin_unlock_irqrestore(&smd_lock, flags);
823 int smd_read_avail(smd_channel_t *ch)
825 return ch->read_avail(ch);
828 int smd_write_avail(smd_channel_t *ch)
830 return ch->write_avail(ch);
833 int smd_wait_until_readable(smd_channel_t *ch, int bytes)
838 int smd_wait_until_writable(smd_channel_t *ch, int bytes)
843 int smd_cur_packet_size(smd_channel_t *ch)
845 return ch->current_packet;
849 /* ------------------------------------------------------------------------- */
851 void *smem_alloc(unsigned id, unsigned size)
853 return smem_find(id, size);
856 void *smem_item(unsigned id, unsigned *size)
858 struct smem_shared *shared = (void *) MSM_SHARED_RAM_BASE;
859 struct smem_heap_entry *toc = shared->heap_toc;
861 if (id >= SMEM_NUM_ITEMS)
864 if (toc[id].allocated) {
865 *size = toc[id].size;
866 return (void *) (MSM_SHARED_RAM_BASE + toc[id].offset);
874 void *smem_find(unsigned id, unsigned size_in)
879 ptr = smem_item(id, &size);
883 size_in = ALIGN(size_in, 8);
884 if (size_in != size) {
885 pr_err("smem_find(%d, %d): wrong size %d\n",
893 static irqreturn_t smsm_irq_handler(int irq, void *data)
898 spin_lock_irqsave(&smem_lock, flags);
900 apps = raw_smsm_get_state(SMSM_STATE_APPS);
901 modm = raw_smsm_get_state(SMSM_STATE_MODEM);
903 if (msm_smd_debug_mask & MSM_SMSM_DEBUG)
904 pr_info("<SM %08x %08x>\n", apps, modm);
905 if (modm & SMSM_RESET)
906 handle_modem_crash();
910 spin_unlock_irqrestore(&smem_lock, flags);
914 int smsm_change_state(enum smsm_state_item item,
915 uint32_t clear_mask, uint32_t set_mask)
919 unsigned addr = smd_info.state + item * 4;
924 spin_lock_irqsave(&smem_lock, flags);
926 if (raw_smsm_get_state(SMSM_STATE_MODEM) & SMSM_RESET)
927 handle_modem_crash();
929 state = (readl(addr) & ~clear_mask) | set_mask;
932 if (msm_smd_debug_mask & MSM_SMSM_DEBUG)
933 pr_info("smsm_change_state %d %x\n", item, state);
936 spin_unlock_irqrestore(&smem_lock, flags);
941 uint32_t smsm_get_state(enum smsm_state_item item)
946 spin_lock_irqsave(&smem_lock, flags);
948 rv = readl(smd_info.state + item * 4);
950 if (item == SMSM_STATE_MODEM && (rv & SMSM_RESET))
951 handle_modem_crash();
953 spin_unlock_irqrestore(&smem_lock, flags);
958 #ifdef CONFIG_ARCH_MSM_SCORPION
960 int smsm_set_sleep_duration(uint32_t delay)
962 struct msm_dem_slave_data *ptr;
964 ptr = smem_find(SMEM_APPS_DEM_SLAVE_DATA, sizeof(*ptr));
966 pr_err("smsm_set_sleep_duration <SM NO APPS_DEM_SLAVE_DATA>\n");
969 if (msm_smd_debug_mask & MSM_SMSM_DEBUG)
970 pr_info("smsm_set_sleep_duration %d -> %d\n",
971 ptr->sleep_time, delay);
972 ptr->sleep_time = delay;
978 int smsm_set_sleep_duration(uint32_t delay)
982 ptr = smem_find(SMEM_SMSM_SLEEP_DELAY, sizeof(*ptr));
984 pr_err("smsm_set_sleep_duration <SM NO SLEEP_DELAY>\n");
987 if (msm_smd_debug_mask & MSM_SMSM_DEBUG)
988 pr_info("smsm_set_sleep_duration %d -> %d\n",
996 int smd_core_init(void)
999 pr_info("smd_core_init()\n");
1001 /* wait for essential items to be initialized */
1005 state = smem_item(SMEM_SMSM_SHARED_STATE, &size);
1006 if (size == SMSM_V1_SIZE || size == SMSM_V2_SIZE) {
1007 smd_info.state = (unsigned)state;
1014 r = request_irq(INT_A9_M2A_0, smd_modem_irq_handler,
1015 IRQF_TRIGGER_RISING, "smd_dev", 0);
1018 r = enable_irq_wake(INT_A9_M2A_0);
1020 pr_err("smd_core_init: enable_irq_wake failed for A9_M2A_0\n");
1022 r = request_irq(INT_A9_M2A_5, smsm_irq_handler,
1023 IRQF_TRIGGER_RISING, "smsm_dev", 0);
1025 free_irq(INT_A9_M2A_0, 0);
1028 r = enable_irq_wake(INT_A9_M2A_5);
1030 pr_err("smd_core_init: enable_irq_wake failed for A9_M2A_5\n");
1032 #if defined(CONFIG_QDSP6)
1033 r = request_irq(INT_ADSP_A11, smd_dsp_irq_handler,
1034 IRQF_TRIGGER_RISING, "smd_dsp", 0);
1036 free_irq(INT_A9_M2A_0, 0);
1037 free_irq(INT_A9_M2A_5, 0);
1042 /* check for any SMD channels that may already exist */
1045 /* indicate that we're up and running */
1046 smsm_change_state(SMSM_STATE_APPS,
1047 ~0, SMSM_INIT | SMSM_SMDINIT | SMSM_RPCINIT | SMSM_RUN);
1048 #ifdef CONFIG_ARCH_MSM_SCORPION
1049 smsm_change_state(SMSM_STATE_APPS_DEM, ~0, 0);
1052 pr_info("smd_core_init() done\n");
1057 static int __init msm_smd_probe(struct platform_device *pdev)
1059 pr_info("smd_init()\n");
1061 INIT_WORK(&probe_work, smd_channel_probe_worker);
1063 if (smd_core_init()) {
1064 pr_err("smd_core_init() failed\n");
1070 msm_check_for_modem_crash = check_for_modem_crash;
1072 msm_init_last_radio_log(THIS_MODULE);
1074 smd_initialized = 1;
1079 static struct platform_driver msm_smd_driver = {
1080 .probe = msm_smd_probe,
1082 .name = MODULE_NAME,
1083 .owner = THIS_MODULE,
1087 static int __init msm_smd_init(void)
1089 return platform_driver_register(&msm_smd_driver);
1092 module_init(msm_smd_init);
1094 MODULE_DESCRIPTION("MSM Shared Memory Core");
1095 MODULE_AUTHOR("Brian Swetland <swetland@google.com>");
1096 MODULE_LICENSE("GPL");