android_kernel_xiaomi_sm8450/include/soc/qcom/icnss2.h
Yue Ma 2b1c28ca2a cnss2/icnss2/cnss_utils: Update drivers
This is a update of CNSS2/ICNSS2/CNSS_UTILS drivers and
associated files as of msm-5.4 commit 027d7b5db896 ("cnss2:
Add config to disable time sync feature"). It picks below
commits cleanly in reverse order:

cnss2: Add config to disable time sync feature
cnss2: Only assert for remap window register when link is not down
icnss2: Add code for SSR dump collection feature for moselle
cnss2: Make sure the write to remap window register take effect
cnss2: Fix a print error in time sync
cnss2: Use proper DMA mask based on device ID
cnss2: Avoid trying DRV suspend if PCIe link speed is Gen 3
cnss2: Fix an issue when MSM SSR feature is not enabled
cnss2: Use proper return code for not supported operation
cnss2: Kconfig: Add CONFIG_CNSS_WCN7850 flag
cnss2: Add support for WLAN WCN7850 device
cnss2: Refactor PCI probe callback
cnss2: Add fallback support for device specific path loading
icnss: Update FW_INIT_DONE QMI indication with hang event params
cnss_utils: Compile wlan service file as part of GPL module
cnss2: Increase mhi timeout to 30 sec for perf builds
cnss2: pci: Trigger link down recovery if link fails to enter L0
cnss2: Avoid printing some verbose logs to kmsg
cnss2: Check link status before setting wlaon_pwr_ctrl registers
icnss2: Avoid race between soc wake release threads
icnss2: Add support for host triggered recovery
cnss2: Add new API to get QMI related timeouts
cnss2: Set RDDM done only when dump is collected
cnss2: Group dev_boot debugfs handling by contexts
cnss2: Check device status before suspending PCIe bus
icnss2: Vote for chain1 regulators if RD card is 2x2
icnss2: Avoid sending qdss_trace_mem_info to fw if it is down
icnss2: Avoid sending modem shutdown indication to fw if it is down
cnss2: Avoid suspending PCIe after QMI send get is called
net: cnss2: Add second element to avoid OOB issue
cnss2: Avoid race condition between time sync and system suspend
cnss2: Handle resume request while suspend in progress
cnss2: Overload QDSS trace save indication for generic mem dump
cnss-utils: Compile firmware service file independently
icnss2: Avoid race between SOC WAKE REQ/RESP
icnss2: Send power save enter/exit via SMP2P
cnss2: Donot reserve TCS register space for WLAN
cnss2: Control ADSP power collapse based on WLAN state
cnss2: Fix MAC address setup on late DMS server arrival
cnss2: Wait for RDDM if device is already in bad state
icnss2: Avoid sending fw down uevent to wlan driver twice
icnss2: Avoid calibration during SSR of WCN6750
icnss2: Send enter power save after driver suspend
cnss2: Increase mhi timeout to 60 seconds for firmware download
icnss2: Add open loop CPR support
icnss2: Fix race condition during SOC wake req/release
icnss2: Decrement soc wake ref count
icnss: Assign priority for icnss modem notifier callback
cnss2: Add debug dump for Wlan FW PBL and SBL for HST
cnss2: Check if firmware asserts before power off for CBC
icnss2: Fix null-pointer derefrence while thermal unregister
icnss2: Remove voltage vote for vdd-cx-mx after probe
ICNSS2: Send MSA address range to firmware
icnss2: Export API to host driver to exit power save
cnss2: Add logs for dev_boot debugfs
cnss2: Check for BT Enable GPIO in QCA6490
cnss2: Process TWT Indication message in event workqueue
cnss2: Enable self-recovery only when host driver detects linkdown
cnss2: Assert when power on retry reaches maximum
cnss2: Log a message after assert/de-assert WLAN_EN GPIO
cnss2: Change to add prints on link down callback
cnss2: change to enable self recovery
cnss2: change for fixed link speed
cnss2: Setup DMS QMI client for WLAN MAC address
cnss2: Correct platform driver state for cnss2
cnss2: Notify MHI to use already allocated images
cnss2: Initialize params for error path
cnss2: Collect shadow registers for RDDM scenario
cnss2: Avoid dereferencing pointer before NULL check
cnss2: Release qmi handle after server exit
icnss2: Add vbatt feature code for holi
cnss2: Update bus bandwidth device tree config read
cnss2: Avoid null pointer dereference of cnss_platform_cap
cnss2: Add runtime PM stats suppor
cnss2: Remove 0 MSI data check

Also update copyright year to 2021 for merging purpose.

Change-Id: I59126aaca97a4fc409e697070ac150f379f64d1e
Signed-off-by: Yue Ma <yuem@codeaurora.org>
2021-01-04 11:29:12 -08:00

195 lines
6.0 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
*/
#ifndef _ICNSS_WLAN_H_
#define _ICNSS_WLAN_H_
#include <linux/interrupt.h>
#include <linux/device.h>
#define ICNSS_MAX_IRQ_REGISTRATIONS 12
#define IWCN_MAX_IRQ_REGISTRATIONS 32
#define ICNSS_MAX_TIMESTAMP_LEN 32
#ifndef ICNSS_API_WITH_DEV
#define ICNSS_API_WITH_DEV
#endif
enum icnss_uevent {
ICNSS_UEVENT_FW_CRASHED,
ICNSS_UEVENT_FW_DOWN,
ICNSS_UEVENT_HANG_DATA,
};
struct icnss_uevent_hang_data {
void *hang_event_data;
uint16_t hang_event_data_len;
};
struct icnss_uevent_fw_down_data {
bool crashed;
};
struct icnss_uevent_data {
enum icnss_uevent uevent;
void *data;
};
struct icnss_driver_ops {
char *name;
unsigned long drv_state;
struct device_driver driver;
int (*probe)(struct device *dev);
void (*remove)(struct device *dev);
void (*shutdown)(struct device *dev);
int (*reinit)(struct device *dev);
void (*crash_shutdown)(void *pdev);
int (*pm_suspend)(struct device *dev);
int (*pm_resume)(struct device *dev);
int (*suspend_noirq)(struct device *dev);
int (*resume_noirq)(struct device *dev);
int (*runtime_suspend)(struct device *dev);
int (*runtime_resume)(struct device *dev);
int (*uevent)(struct device *dev, struct icnss_uevent_data *uevent);
int (*idle_shutdown)(struct device *dev);
int (*idle_restart)(struct device *dev);
int (*set_therm_cdev_state)(struct device *dev,
unsigned long thermal_state,
int tcdev_id);
};
struct ce_tgt_pipe_cfg {
u32 pipe_num;
u32 pipe_dir;
u32 nentries;
u32 nbytes_max;
u32 flags;
u32 reserved;
};
struct ce_svc_pipe_cfg {
u32 service_id;
u32 pipe_dir;
u32 pipe_num;
};
struct icnss_shadow_reg_cfg {
u16 ce_id;
u16 reg_offset;
};
struct icnss_shadow_reg_v2_cfg {
u32 addr;
};
struct icnss_rri_over_ddr_cfg {
u32 base_addr_low;
u32 base_addr_high;
};
/* CE configuration to target */
struct icnss_wlan_enable_cfg {
u32 num_ce_tgt_cfg;
struct ce_tgt_pipe_cfg *ce_tgt_cfg;
u32 num_ce_svc_pipe_cfg;
struct ce_svc_pipe_cfg *ce_svc_cfg;
u32 num_shadow_reg_cfg;
struct icnss_shadow_reg_cfg *shadow_reg_cfg;
u32 num_shadow_reg_v2_cfg;
struct icnss_shadow_reg_v2_cfg *shadow_reg_v2_cfg;
bool rri_over_ddr_cfg_valid;
struct icnss_rri_over_ddr_cfg rri_over_ddr_cfg;
};
/* driver modes */
enum icnss_driver_mode {
ICNSS_MISSION,
ICNSS_FTM,
ICNSS_EPPING,
ICNSS_WALTEST,
ICNSS_OFF,
ICNSS_CCPM,
ICNSS_QVIT,
ICNSS_CALIBRATION,
};
struct icnss_soc_info {
void __iomem *v_addr;
phys_addr_t p_addr;
uint32_t chip_id;
uint32_t chip_family;
uint32_t board_id;
uint32_t soc_id;
uint32_t fw_version;
char fw_build_timestamp[ICNSS_MAX_TIMESTAMP_LEN + 1];
};
#define icnss_register_driver(ops) \
__icnss_register_driver(ops, THIS_MODULE, KBUILD_MODNAME)
extern int __icnss_register_driver(struct icnss_driver_ops *ops,
struct module *owner, const char *mod_name);
extern int icnss_unregister_driver(struct icnss_driver_ops *ops);
extern int icnss_wlan_enable(struct device *dev,
struct icnss_wlan_enable_cfg *config,
enum icnss_driver_mode mode,
const char *host_version);
extern int icnss_wlan_disable(struct device *dev, enum icnss_driver_mode mode);
extern void icnss_enable_irq(struct device *dev, unsigned int ce_id);
extern void icnss_disable_irq(struct device *dev, unsigned int ce_id);
extern int icnss_get_soc_info(struct device *dev, struct icnss_soc_info *info);
extern int icnss_ce_free_irq(struct device *dev, unsigned int ce_id, void *ctx);
extern int icnss_ce_request_irq(struct device *dev, unsigned int ce_id,
irqreturn_t (*handler)(int, void *),
unsigned long flags, const char *name, void *ctx);
extern int icnss_get_ce_id(struct device *dev, int irq);
extern int icnss_set_fw_log_mode(struct device *dev, uint8_t fw_log_mode);
extern int icnss_athdiag_read(struct device *dev, uint32_t offset,
uint32_t mem_type, uint32_t data_len,
uint8_t *output);
extern int icnss_athdiag_write(struct device *dev, uint32_t offset,
uint32_t mem_type, uint32_t data_len,
uint8_t *input);
extern int icnss_get_irq(struct device *dev, int ce_id);
extern int icnss_power_on(struct device *dev);
extern int icnss_power_off(struct device *dev);
extern struct dma_iommu_mapping *icnss_smmu_get_mapping(struct device *dev);
extern struct iommu_domain *icnss_smmu_get_domain(struct device *dev);
extern int icnss_smmu_map(struct device *dev, phys_addr_t paddr,
uint32_t *iova_addr, size_t size);
extern int icnss_smmu_unmap(struct device *dev,
uint32_t iova_addr, size_t size);
extern unsigned int icnss_socinfo_get_serial_number(struct device *dev);
extern bool icnss_is_qmi_disable(struct device *dev);
extern bool icnss_is_fw_ready(void);
extern bool icnss_is_fw_down(void);
extern bool icnss_is_rejuvenate(void);
extern int icnss_trigger_recovery(struct device *dev);
extern void icnss_block_shutdown(bool status);
extern bool icnss_is_pdr(void);
extern int icnss_idle_restart(struct device *dev);
extern int icnss_idle_shutdown(struct device *dev);
extern int icnss_get_user_msi_assignment(struct device *dev, char *user_name,
int *num_vectors, u32 *user_base_data,
u32 *base_vector);
extern int icnss_get_msi_irq(struct device *dev, unsigned int vector);
extern void icnss_get_msi_address(struct device *dev, u32 *msi_addr_low,
u32 *msi_addr_high);
extern int icnss_qmi_send(struct device *dev, int type, void *cmd,
int cmd_len, void *cb_ctx,
int (*cb)(void *ctx, void *event, int event_len));
extern int icnss_force_wake_request(struct device *dev);
extern int icnss_force_wake_release(struct device *dev);
extern int icnss_is_device_awake(struct device *dev);
extern int icnss_thermal_cdev_register(struct device *dev,
unsigned long max_state,
int tcdev_id);
extern void icnss_thermal_cdev_unregister(struct device *dev, int tcdev_id);
extern int icnss_get_curr_therm_cdev_state(struct device *dev,
unsigned long *thermal_state,
int tcdev_id);
extern int icnss_exit_power_save(struct device *dev);
#endif /* _ICNSS_WLAN_H_ */