1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
/*
* Copyright (C) 2010 Google, Inc.
* Copyright (C) 2010 Samsung Electronics.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __MODEM_VARIATION_H__
#define __MODEM_VARIATION_H__
#define DECLARE_MODEM_INIT(type) \
int type ## _init_modemctl_device(struct modem_ctl *mc, \
struct modem_data *pdata)
#define DECLARE_MODEM_INIT_DUMMY(type) \
DECLARE_MODEM_INIT(type) { return 0; }
#define DECLARE_LINK_INIT(type) \
struct link_device *type ## _create_link_device( \
struct platform_device *pdev)
#define DECLARE_LINK_INIT_DUMMY(type) \
DECLARE_LINK_INIT(type) { return NULL; }
#define MODEM_INIT_CALL(type) type ## _init_modemctl_device
#define LINK_INIT_CALL(type) type ## _create_link_device
/* add declaration of modem & link type */
/* modem device support */
#ifdef CONFIG_UMTS_MODEM_XMM6260
DECLARE_MODEM_INIT(xmm6260);
#else
DECLARE_MODEM_INIT_DUMMY(xmm6260)
#endif
#ifdef CONFIG_LTE_MODEM_CMC221
DECLARE_MODEM_INIT(cmc221);
#else
DECLARE_MODEM_INIT_DUMMY(cmc221)
#endif
#ifdef CONFIG_CDMA_MODEM_CBP71
DECLARE_MODEM_INIT(cbp71);
#else
DECLARE_MODEM_INIT_DUMMY(cbp71)
#endif
#ifdef CONFIG_LTE_MODEM_CMC220
DECLARE_MODEM_INIT(cmc220);
#else
DECLARE_MODEM_INIT_DUMMY(cmc220)
#endif
/* link device support */
#ifdef CONFIG_UMTS_LINK_MIPI
DECLARE_LINK_INIT(mipi);
#else
DECLARE_LINK_INIT_DUMMY(mipi)
#endif
#ifdef CONFIG_LINK_DEVICE_DPRAM
DECLARE_LINK_INIT(dpram);
#else
DECLARE_LINK_INIT_DUMMY(dpram)
#endif
#ifdef CONFIG_LINK_DEVICE_USB
DECLARE_LINK_INIT(usb);
#else
DECLARE_LINK_INIT_DUMMY(usb)
#endif
#ifdef CONFIG_UMTS_LINK_HSIC
DECLARE_LINK_INIT(hsic);
#else
DECLARE_LINK_INIT_DUMMY(hsic)
#endif
#ifdef CONFIG_UMTS_LINK_SPI
DECLARE_LINK_INIT(spi);
#else
DECLARE_LINK_INIT_DUMMY(spi)
#endif
typedef int (*modem_init_call)(struct modem_ctl *, struct modem_data *);
modem_init_call modem_init_func[] = {
MODEM_INIT_CALL(xmm6260),
MODEM_INIT_CALL(cbp71),
MODEM_INIT_CALL(cmc221),
MODEM_INIT_CALL(cmc220),
};
typedef struct link_device *(*link_init_call)(struct platform_device *);
link_init_call link_init_func[] = {
LINK_INIT_CALL(mipi),
LINK_INIT_CALL(dpram),
LINK_INIT_CALL(spi),
LINK_INIT_CALL(usb),
LINK_INIT_CALL(hsic),
};
static int call_modem_init_func(struct modem_ctl *mc, struct modem_data *pdata)
{
if (modem_init_func[pdata->modem_type])
return modem_init_func[pdata->modem_type](mc, pdata);
else
return -ENOTSUPP;
}
static struct link_device *call_link_init_func(struct platform_device *pdev,
enum modem_link link_type)
{
if (link_init_func[link_type])
return link_init_func[link_type](pdev);
else
return NULL;
}
#endif
|