linux/drivers/net/wireless/ath/wil6210/wil_platform.h
<<
>>
Prefs
   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
  30/**
  31 * struct wil_platform_ops - wil platform module calls from this
  32 * driver to platform driver
  33 */
  34struct wil_platform_ops {
  35        int (*bus_request)(void *handle, uint32_t kbps /* KBytes/Sec */);
  36        int (*suspend)(void *handle, bool keep_device_power);
  37        int (*resume)(void *handle, bool device_powered_on);
  38        void (*uninit)(void *handle);
  39        int (*notify)(void *handle, enum wil_platform_event evt);
  40        bool (*keep_radio_on_during_sleep)(void *handle);
  41};
  42
  43/**
  44 * struct wil_platform_rops - wil platform module callbacks from
  45 * platform driver to this driver
  46 * @ramdump: store a ramdump from the wil firmware. The platform
  47 *      driver may add additional data to the ramdump to
  48 *      generate the final crash dump.
  49 * @fw_recovery: start a firmware recovery process. Called as
  50 *      part of a crash recovery process which may include other
  51 *      related platform subsystems.
  52 */
  53struct wil_platform_rops {
  54        int (*ramdump)(void *wil_handle, void *buf, uint32_t size);
  55        int (*fw_recovery)(void *wil_handle);
  56};
  57
  58/**
  59 * wil_platform_init - initialize the platform driver
  60 *
  61 * @dev - pointer to the wil6210 device
  62 * @ops - structure with platform driver operations. Platform
  63 *      driver will fill this structure with function pointers.
  64 * @rops - structure with callbacks from platform driver to
  65 *      this driver. The platform driver copies the structure to
  66 *      its own storage. Can be NULL if this driver does not
  67 *      support crash recovery.
  68 * @wil_handle - context for this driver that will be passed
  69 *      when platform driver invokes one of the callbacks in
  70 *      rops. May be NULL if rops is NULL.
  71 */
  72void *wil_platform_init(struct device *dev, struct wil_platform_ops *ops,
  73                        const struct wil_platform_rops *rops, void *wil_handle);
  74
  75int __init wil_platform_modinit(void);
  76void wil_platform_modexit(void);
  77
  78#endif /* __WIL_PLATFORM_H__ */
  79