aboutsummaryrefslogtreecommitdiff
path: root/include/linux/vib-timed.h
blob: 17ff3354d522723eba27493ba38b31571c98995e (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
/*
 * include/linux/vib-timed.h
 *
 * Copyright (C) 2011 Motorola Mobility Inc.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published
 * by the Free Software Foundation.
 */

#ifndef __VIB_TIMED_H
#define __VIB_TIMED_H

#include <linux/types.h>
#include <linux/sched.h>

#define VIB_TIMED_NAME "vib-timed"

struct vib_timed {
	int (*init) (void *);
	void (*exit) (void *);
	int (*power_on) (int, void *);
	int (*power_off) (void *);
	void (*dump) (void *);
	const char *name;
	unsigned int min_timeout;
	unsigned int max_timeout;
	void *dev_data;
	void *drv_data;
};

struct vib_timed_platform_data {
	struct vib_timed *vibs;
	size_t count;
};

extern int vib_timed_debug;
extern int vib_print(const char *fmt, ...);

#define zprintk(fmt, args...)  \
	do { \
		printk(KERN_INFO fmt, ##args); \
	} while (0)

#define zfprintk(fmt, args...)  \
	do { \
		printk(KERN_INFO "%s "fmt, __func__, ##args); \
	} while (0)

#define dprintk(fmt, args...)  \
	do { \
		if (vib_timed_debug) \
			printk(KERN_INFO "%s "fmt, __func__, ##args); \
	} while (0)

#define vib_tprint(fmt, args...) \
	do { \
		vib_print("%lld %d\t" fmt, ktime_to_us(ktime_get()), \
			current->tgid, ##args); \
	} while (0)

#define zvib_print(fmt, args...)  \
	do { \
		vib_print(fmt, ##args); \
	} while (0)


#define dvib_print(fmt, args...)  \
	do { \
		if (vib_timed_debug) \
			vib_print(fmt, ##args); \
	} while (0)

#define dvib_tprint(fmt, args...)  \
	do { \
		if (vib_timed_debug) \
			vib_tprint(fmt, ##args); \
	} while (0)

#endif /* __VIB_TIMED_H */