123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249 |
- #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
- #define ICNSS_WLFW_MAX_BUILD_ID_LEN 128
- #define ICNSS_MAX_DEV_MEM_NUM 4
- #define DEVICE_NAME_MAX 10
- enum icnss_uevent {
- ICNSS_UEVENT_FW_CRASHED,
- ICNSS_UEVENT_FW_DOWN,
- ICNSS_UEVENT_HANG_DATA,
- ICNSS_UEVENT_SMMU_FAULT,
- };
- enum icnss_device_config {
- ICNSS_IPA_DISABLED,
- };
- 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_dev_mem_info {
- u64 start;
- u64 size;
- };
- struct device_info {
- char name[DEVICE_NAME_MAX];
- uint16_t device_id;
- };
- struct icnss_driver_ops {
- char *name;
- struct device_info *dev_info;
- 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_shadow_reg_v3_cfg {
- u32 addr;
- };
- struct icnss_rri_over_ddr_cfg {
- u32 base_addr_low;
- u32 base_addr_high;
- };
- 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;
- u32 num_shadow_reg_v3_cfg;
- struct icnss_shadow_reg_v3_cfg *shadow_reg_v3_cfg;
- bool rri_over_ddr_cfg_valid;
- struct icnss_rri_over_ddr_cfg rri_over_ddr_cfg;
- };
- enum icnss_driver_mode {
- ICNSS_MISSION,
- ICNSS_FTM,
- ICNSS_EPPING,
- ICNSS_WALTEST,
- ICNSS_OFF,
- ICNSS_CCPM,
- ICNSS_QVIT,
- ICNSS_CALIBRATION,
- };
- enum icnss_rd_card_chain_cap {
- ICNSS_RD_CARD_CHAIN_CAP_UNSPECIFIED,
- ICNSS_RD_CARD_CHAIN_CAP_1x1,
- ICNSS_RD_CARD_CHAIN_CAP_2x2,
- ICNSS_RD_CARD_CHAIN_CAP_MAX_VAL,
- };
- enum icnss_phy_he_channel_width_cap {
- ICNSS_PHY_HE_CHANNEL_WIDTH_CAP_UNSPECIFIED,
- ICNSS_PHY_HE_CHANNEL_WIDTH_CAP_80MHZ,
- ICNSS_PHY_HE_CHANNEL_WIDTH_CAP_160MHZ,
- ICNSS_PHY_HE_CHANNEL_WIDTH_CAP_MAX_VAL,
- };
- enum icnss_phy_qam_cap {
- ICNSS_PHY_QAM_CAP_UNSPECIFIED,
- ICNSS_PHY_QAM_CAP_1K,
- ICNSS_PHY_QAM_CAP_4K,
- ICNSS_PHY_QAM_CAP_MAX_VAL,
- };
- 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];
- char fw_build_id[ICNSS_WLFW_MAX_BUILD_ID_LEN + 1];
- enum icnss_rd_card_chain_cap rd_card_chain_cap;
- enum icnss_phy_he_channel_width_cap phy_he_channel_width_cap;
- enum icnss_phy_qam_cap phy_qam_cap;
- struct icnss_dev_mem_info dev_mem_info[ICNSS_MAX_DEV_MEM_NUM];
- };
- #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_low_power(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);
- extern int icnss_prevent_l1(struct device *dev);
- extern void icnss_allow_l1(struct device *dev);
- extern int icnss_get_mhi_state(struct device *dev);
- extern int icnss_is_pci_ep_awake(struct device *dev);
- extern unsigned long icnss_get_device_config(void);
- #endif
|