summaryrefstree
path: root/kernel/drivers/misc/modem_if/modem_variation.h
blob: bf034e565eb99d3d9e92ba41f8446a5b2fc48094 (plain)
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
/*
 * 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__

#include "include/modem_v1.h"

#define DECLARE_LINK_INIT(type)	\
		struct link_device *type ## _create_link_device(	\
		struct platform_device *pdev)

#define DECLARE_LINK_INIT_DUMMY(type)	\
	static DECLARE_LINK_INIT(type) { return NULL; }

#define LINK_INIT_CALL(type)	type ## _create_link_device

/* add declaration of modem link type */
/* link device support */
DECLARE_LINK_INIT_DUMMY(undefined)

#ifdef CONFIG_LINK_DEVICE_MIPI
DECLARE_LINK_INIT(mipi);
#else
DECLARE_LINK_INIT_DUMMY(mipi)
#endif

#ifdef CONFIG_LINK_DEVICE_HSIC
DECLARE_LINK_INIT(hsic);
#else
DECLARE_LINK_INIT_DUMMY(hsic)
#endif

#ifdef CONFIG_LINK_DEVICE_DPRAM
DECLARE_LINK_INIT(dpram);
#else
DECLARE_LINK_INIT_DUMMY(dpram)
#endif

#ifdef CONFIG_LINK_DEVICE_SHMEM
DECLARE_LINK_INIT(shmem);
#else
DECLARE_LINK_INIT_DUMMY(shmem)
#endif

#ifdef CONFIG_LINK_DEVICE_SPI
DECLARE_LINK_INIT(spi);
#else
DECLARE_LINK_INIT_DUMMY(spi)
#endif

typedef struct link_device *(*link_init_call)(struct platform_device *);
static link_init_call link_init_func[LINKDEV_MAX] = {
	[LINKDEV_UNDEFINED] = LINK_INIT_CALL(undefined),
	[LINKDEV_MIPI] = LINK_INIT_CALL(mipi),
	[LINKDEV_HSIC] = LINK_INIT_CALL(hsic),
	[LINKDEV_DPRAM] = LINK_INIT_CALL(dpram),
	[LINKDEV_SHMEM] = LINK_INIT_CALL(shmem),
	[LINKDEV_SPI] = LINK_INIT_CALL(spi),
};

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;
}

int init_modemctl_device(struct modem_ctl *mc, struct modem_data *pdata);
#endif