Loading...
1/* SPDX-License-Identifier: ISC */
2/*
3 * Copyright (c) 2014-2017 Qualcomm Atheros, Inc.
4 */
5
6#ifndef __WIL_PLATFORM_H__
7#define __WIL_PLATFORM_H__
8
9struct device;
10
11enum wil_platform_event {
12 WIL_PLATFORM_EVT_FW_CRASH = 0,
13 WIL_PLATFORM_EVT_PRE_RESET = 1,
14 WIL_PLATFORM_EVT_FW_RDY = 2,
15 WIL_PLATFORM_EVT_PRE_SUSPEND = 3,
16 WIL_PLATFORM_EVT_POST_SUSPEND = 4,
17};
18
19enum wil_platform_features {
20 WIL_PLATFORM_FEATURE_FW_EXT_CLK_CONTROL = 0,
21 WIL_PLATFORM_FEATURE_TRIPLE_MSI = 1,
22 WIL_PLATFORM_FEATURE_MAX,
23};
24
25enum wil_platform_capa {
26 WIL_PLATFORM_CAPA_RADIO_ON_IN_SUSPEND = 0,
27 WIL_PLATFORM_CAPA_T_PWR_ON_0 = 1,
28 WIL_PLATFORM_CAPA_EXT_CLK = 2,
29 WIL_PLATFORM_CAPA_MAX,
30};
31
32/**
33 * struct wil_platform_ops - wil platform module calls from this
34 * driver to platform driver
35 */
36struct wil_platform_ops {
37 int (*bus_request)(void *handle, uint32_t kbps /* KBytes/Sec */);
38 int (*suspend)(void *handle, bool keep_device_power);
39 int (*resume)(void *handle, bool device_powered_on);
40 void (*uninit)(void *handle);
41 int (*notify)(void *handle, enum wil_platform_event evt);
42 int (*get_capa)(void *handle);
43 void (*set_features)(void *handle, int features);
44};
45
46/**
47 * struct wil_platform_rops - wil platform module callbacks from
48 * platform driver to this driver
49 * @ramdump: store a ramdump from the wil firmware. The platform
50 * driver may add additional data to the ramdump to
51 * generate the final crash dump.
52 * @fw_recovery: start a firmware recovery process. Called as
53 * part of a crash recovery process which may include other
54 * related platform subsystems.
55 */
56struct wil_platform_rops {
57 int (*ramdump)(void *wil_handle, void *buf, uint32_t size);
58 int (*fw_recovery)(void *wil_handle);
59};
60
61/**
62 * wil_platform_init - initialize the platform driver
63 *
64 * @dev - pointer to the wil6210 device
65 * @ops - structure with platform driver operations. Platform
66 * driver will fill this structure with function pointers.
67 * @rops - structure with callbacks from platform driver to
68 * this driver. The platform driver copies the structure to
69 * its own storage. Can be NULL if this driver does not
70 * support crash recovery.
71 * @wil_handle - context for this driver that will be passed
72 * when platform driver invokes one of the callbacks in
73 * rops. May be NULL if rops is NULL.
74 */
75void *wil_platform_init(struct device *dev, struct wil_platform_ops *ops,
76 const struct wil_platform_rops *rops, void *wil_handle);
77
78int __init wil_platform_modinit(void);
79void wil_platform_modexit(void);
80
81#endif /* __WIL_PLATFORM_H__ */
1/*
2 * Copyright (c) 2014-2017 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef __WIL_PLATFORM_H__
18#define __WIL_PLATFORM_H__
19
20struct device;
21
22enum wil_platform_event {
23 WIL_PLATFORM_EVT_FW_CRASH = 0,
24 WIL_PLATFORM_EVT_PRE_RESET = 1,
25 WIL_PLATFORM_EVT_FW_RDY = 2,
26 WIL_PLATFORM_EVT_PRE_SUSPEND = 3,
27 WIL_PLATFORM_EVT_POST_SUSPEND = 4,
28};
29
30enum wil_platform_features {
31 WIL_PLATFORM_FEATURE_FW_EXT_CLK_CONTROL = 0,
32 WIL_PLATFORM_FEATURE_MAX,
33};
34
35enum wil_platform_capa {
36 WIL_PLATFORM_CAPA_RADIO_ON_IN_SUSPEND = 0,
37 WIL_PLATFORM_CAPA_T_PWR_ON_0 = 1,
38 WIL_PLATFORM_CAPA_EXT_CLK = 2,
39 WIL_PLATFORM_CAPA_MAX,
40};
41
42/**
43 * struct wil_platform_ops - wil platform module calls from this
44 * driver to platform driver
45 */
46struct wil_platform_ops {
47 int (*bus_request)(void *handle, uint32_t kbps /* KBytes/Sec */);
48 int (*suspend)(void *handle, bool keep_device_power);
49 int (*resume)(void *handle, bool device_powered_on);
50 void (*uninit)(void *handle);
51 int (*notify)(void *handle, enum wil_platform_event evt);
52 int (*get_capa)(void *handle);
53 void (*set_features)(void *handle, int features);
54};
55
56/**
57 * struct wil_platform_rops - wil platform module callbacks from
58 * platform driver to this driver
59 * @ramdump: store a ramdump from the wil firmware. The platform
60 * driver may add additional data to the ramdump to
61 * generate the final crash dump.
62 * @fw_recovery: start a firmware recovery process. Called as
63 * part of a crash recovery process which may include other
64 * related platform subsystems.
65 */
66struct wil_platform_rops {
67 int (*ramdump)(void *wil_handle, void *buf, uint32_t size);
68 int (*fw_recovery)(void *wil_handle);
69};
70
71/**
72 * wil_platform_init - initialize the platform driver
73 *
74 * @dev - pointer to the wil6210 device
75 * @ops - structure with platform driver operations. Platform
76 * driver will fill this structure with function pointers.
77 * @rops - structure with callbacks from platform driver to
78 * this driver. The platform driver copies the structure to
79 * its own storage. Can be NULL if this driver does not
80 * support crash recovery.
81 * @wil_handle - context for this driver that will be passed
82 * when platform driver invokes one of the callbacks in
83 * rops. May be NULL if rops is NULL.
84 */
85void *wil_platform_init(struct device *dev, struct wil_platform_ops *ops,
86 const struct wil_platform_rops *rops, void *wil_handle);
87
88int __init wil_platform_modinit(void);
89void wil_platform_modexit(void);
90
91#endif /* __WIL_PLATFORM_H__ */