2 * Copyright (c) 2016, The Linux Foundation. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #ifndef __WCD_DSP_MGR_H__
15 #define __WCD_DSP_MGR_H__
17 #include <linux/types.h>
20 * These enums correspond to the component types
21 * that wcd-dsp-manager driver will use. The order
22 * of the enums specifies the order in which the
23 * manager driver will perform the sequencing.
24 * Changing this will cause the sequencing order
25 * to be changed as well.
27 enum wdsp_cmpnt_type {
28 /* Component to control the DSP */
29 WDSP_CMPNT_CONTROL = 0,
30 /* Component to perform data transfer to/from DSP */
32 /* Component that performs high level IPC */
38 enum wdsp_event_type {
39 /* Initialization related */
42 /* Image download related */
43 WDSP_EVENT_PRE_DLOAD_CODE,
44 WDSP_EVENT_DLOAD_SECTION,
45 WDSP_EVENT_POST_DLOAD_CODE,
46 WDSP_EVENT_PRE_DLOAD_DATA,
47 WDSP_EVENT_POST_DLOAD_DATA,
48 WDSP_EVENT_DLOAD_FAILED,
50 WDSP_EVENT_READ_SECTION,
52 /* DSP boot related */
53 WDSP_EVENT_PRE_BOOTUP,
55 WDSP_EVENT_POST_BOOTUP,
56 WDSP_EVENT_PRE_SHUTDOWN,
57 WDSP_EVENT_DO_SHUTDOWN,
58 WDSP_EVENT_POST_SHUTDOWN,
60 /* IRQ handling related */
63 /* Suspend/Resume related */
69 /* Hardware generated interrupts signalled to manager */
79 * wdsp_cmpnt_ops: ops/function callbacks for components
80 * @init: called by manager driver, component is expected
81 * to initialize itself in this callback
82 * @deinit: called by manager driver, component should
83 * de-initialize itself in this callback
84 * @event_handler: Event handler for each component, called
85 * by the manager as per sequence
87 struct wdsp_cmpnt_ops {
88 int (*init)(struct device *, void *priv_data);
89 int (*deinit)(struct device *, void *priv_data);
90 int (*event_handler)(struct device *, void *priv_data,
91 enum wdsp_event_type, void *data);
94 struct wdsp_img_section {
100 struct wdsp_err_signal_arg {
101 bool mem_dumps_enabled;
102 u32 remote_start_addr;
107 * wdsp_ops: ops/function callbacks for manager driver
108 * @register_cmpnt_ops: components will use this to register
109 * their own ops to manager driver
110 * @get_dev_for_cmpnt: components can use this to get handle
111 * to struct device * of any other component
112 * @signal_handler: callback to notify manager driver that signal
113 * has occurred. Cannot be called from interrupt
114 * context as this can sleep
115 * @vote_for_dsp: notifies manager that dsp should be booted up
116 * @suspend: notifies manager that one component wants to suspend.
117 * Manager will make sure to suspend all components in order
118 * @resume: notifies manager that one component wants to resume.
119 * Manager will make sure to resume all components in order
122 struct wdsp_mgr_ops {
123 int (*register_cmpnt_ops)(struct device *wdsp_dev,
126 struct wdsp_cmpnt_ops *ops);
127 struct device *(*get_dev_for_cmpnt)(struct device *wdsp_dev,
128 enum wdsp_cmpnt_type type);
129 int (*signal_handler)(struct device *wdsp_dev,
130 enum wdsp_signal signal, void *arg);
131 int (*vote_for_dsp)(struct device *wdsp_dev, bool vote);
132 int (*suspend)(struct device *wdsp_dev);
133 int (*resume)(struct device *wdsp_dev);
136 #endif /* end of __WCD_DSP_MGR_H__ */