summaryrefstree
path: root/kernel/include/linux/platform_data/link_pm.h
blob: 6e1c71903db7e1f7a6623b5a612e89e614bbe4e4 (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
/*
 * Copyright (C) 2012 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 __LINK_PM_H__
#define __LINK_PM_H__

struct link_pm_svc {
	void *owner;

	/*
	The spin-lock of the owner (mandatory)
	*/
	spinlock_t *lock;

	/*
	Whether or not PM operations (suspend, resume, etc.) are performed by
	a physical link driver
	*/
	bool dev_pm_ops;

	/* Call-back functions registered by a modem interface driver */
	void (*reset_cb)(void *owner);
	void (*mount_cb)(void *owner);
	void (*unmount_cb)(void *owner);
	void (*suspend_cb)(void *owner);
	void (*resume_cb)(void *owner);
	void (*error_cb)(void *owner);

	/*
	Optional service functions provided by a physical link driver
	- If $lock exists, these methods must be called in the critical region
	  with the $lock
	*/
	void (*lock_link)(void *owner);
	void (*unlock_link)(void *owner);
};

static inline void pm_svc_set_owner(struct link_pm_svc *svc, void *owner)
{
	svc->owner = owner;
}

static inline void pm_svc_import_lock(struct link_pm_svc *svc,
				      spinlock_t *lock)
{
	svc->lock = lock;
}

#endif