summaryrefslogtreecommitdiff
path: root/io-module/mts_io.h
blob: 2c4b7b6f55cf26c7bceb0313f8e187c8a9e5cf71 (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
#ifndef __MTS_IO_H
#define __MTS_IO_H

#include "mts_eeprom.h"
#include <linux/gpio.h>

/* Note that this header file is used by the MTAC driver. */

#define __log(level, name, format, args...) \
	printk(level "[" name "] " DRIVER_NAME ":%s:%d: " format "\n" , \
			__func__ , __LINE__ , ## args)

#define log_emerg(format, ...)	__log(KERN_EMERG, "EMERG", format , ## __VA_ARGS__)
#define log_alert(format, ...)	__log(KERN_ALERT, "ALERT", format , ## __VA_ARGS__)
#define log_crit(format, ...)	__log(KERN_CRIT, "CRIT", format , ## __VA_ARGS__)
#define log_error(format, ...)	__log(KERN_ERR, "ERROR", format , ## __VA_ARGS__)
#define log_warning(format, ...)	__log(KERN_WARNING, "WARNING", format , ## __VA_ARGS__)
#define log_notice(format, ...)	__log(KERN_NOTICE, "NOTICE", format , ## __VA_ARGS__)
#define log_info(format, ...)           __log(KERN_INFO, "INFO", format , ## __VA_ARGS__)
#ifdef DEBUG
#  define log_debug(format, ...)	__log(KERN_DEBUG, "DEBUG", format , ## __VA_ARGS__)
#else
#  define log_debug(format, ...) do {} while (0)
#endif

#define MTS_ATTR_MODE_RW		S_IWUSR | S_IRUGO
#define MTS_ATTR_MODE_RO		S_IRUGO

#define DEVICE_ATTR_MTS(mts_dev_name, mts_name, mts_show, mts_store) \
struct device_attribute mts_dev_name = { \
	.attr = { .name = mts_name, .mode = MTS_ATTR_MODE_RW }, \
	.show = mts_show, \
	.store = mts_store, \
}

#define DEVICE_ATTR_RO_MTS(mts_dev_name, mts_name, mts_show) \
struct device_attribute mts_dev_name = { \
	.attr = { .name = mts_name, .mode = MTS_ATTR_MODE_RO }, \
	.show = mts_show, \
}

#define VENDOR_ID_MULTITECH			"Multi-Tech Systems"


struct gpio_pin {
	char name[32];
	struct gpio pin;
	int active_low;
	uint8_t capability;
};

extern int mts_has_radio(const char *product_id, size_t len);

#endif /* __MTS_IO_H */