blob: 6d15f47aec07c347d566f0a58f9311855edde277 [file] [log] [blame]
Stephen Boyd0ebf7212012-04-30 20:42:35 -07001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#ifndef __SUBSYS_RESTART_H
15#define __SUBSYS_RESTART_H
16
17#include <linux/spinlock.h>
18
19#define SUBSYS_NAME_MAX_LENGTH 40
20
Stephen Boyd0ebf7212012-04-30 20:42:35 -070021struct subsys_device;
22
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070023enum {
24 RESET_SOC = 1,
25 RESET_SUBSYS_COUPLED,
26 RESET_SUBSYS_INDEPENDENT,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070027 RESET_LEVEL_MAX
28};
29
Stephen Boyd0ebf7212012-04-30 20:42:35 -070030struct subsys_desc {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070031 const char *name;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070032
Stephen Boyd0ebf7212012-04-30 20:42:35 -070033 int (*shutdown)(const struct subsys_desc *desc);
34 int (*powerup)(const struct subsys_desc *desc);
35 void (*crash_shutdown)(const struct subsys_desc *desc);
36 int (*ramdump)(int, const struct subsys_desc *desc);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037};
38
39#if defined(CONFIG_MSM_SUBSYSTEM_RESTART)
40
Stephen Boyd0ebf7212012-04-30 20:42:35 -070041extern int get_restart_level(void);
42extern int subsystem_restart_dev(struct subsys_device *dev);
43extern int subsystem_restart(const char *name);
44
45extern struct subsys_device *subsys_register(struct subsys_desc *desc);
46extern void subsys_unregister(struct subsys_device *dev);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070047
48#else
49
50static inline int get_restart_level(void)
51{
52 return 0;
53}
54
Stephen Boyd0ebf7212012-04-30 20:42:35 -070055static inline int subsystem_restart_dev(struct subsys_device *dev)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070056{
57 return 0;
58}
59
Stephen Boyd0ebf7212012-04-30 20:42:35 -070060static inline int subsystem_restart(const char *name)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070061{
62 return 0;
63}
64
Stephen Boyd0ebf7212012-04-30 20:42:35 -070065static inline
66struct subsys_device *subsys_register(struct subsys_desc *desc)
67{
68 return NULL;
69}
70
71static inline void subsys_unregister(struct subsys_device *dev) { }
72
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070073#endif /* CONFIG_MSM_SUBSYSTEM_RESTART */
74
75#endif