icnss: Add dev to all export APIs in ICNSS

Add device pointer in all export symbol to
add support for numerous WLAN module.

CRs-Fixed: 2138446
Change-Id: I981155c165e4e5c2794b778afe647f8a588dd860
Signed-off-by: Sarada Prasanna Garnayak <sgarna@codeaurora.org>
This commit is contained in:
Sarada Prasanna Garnayak 2017-10-16 15:41:25 +05:30 committed by Gerrit - the friendly Code Review server
parent 5ae2acd95c
commit f89e708410
2 changed files with 58 additions and 35 deletions

View file

@ -2818,7 +2818,8 @@ enable_pdr:
return 0;
}
int icnss_register_driver(struct icnss_driver_ops *ops)
int __icnss_register_driver(struct icnss_driver_ops *ops,
struct module *owner, const char *mod_name)
{
int ret = 0;
@ -2849,7 +2850,7 @@ int icnss_register_driver(struct icnss_driver_ops *ops)
out:
return ret;
}
EXPORT_SYMBOL(icnss_register_driver);
EXPORT_SYMBOL(__icnss_register_driver);
int icnss_unregister_driver(struct icnss_driver_ops *ops)
{
@ -2875,7 +2876,7 @@ out:
}
EXPORT_SYMBOL(icnss_unregister_driver);
int icnss_ce_request_irq(unsigned int ce_id,
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)
{
@ -2883,7 +2884,7 @@ int icnss_ce_request_irq(unsigned int ce_id,
unsigned int irq;
struct ce_irq_list *irq_entry;
if (!penv || !penv->pdev) {
if (!penv || !penv->pdev || !dev) {
ret = -ENODEV;
goto out;
}
@ -2922,13 +2923,13 @@ out:
}
EXPORT_SYMBOL(icnss_ce_request_irq);
int icnss_ce_free_irq(unsigned int ce_id, void *ctx)
int icnss_ce_free_irq(struct device *dev, unsigned int ce_id, void *ctx)
{
int ret = 0;
unsigned int irq;
struct ce_irq_list *irq_entry;
if (!penv || !penv->pdev) {
if (!penv || !penv->pdev || !dev) {
ret = -ENODEV;
goto out;
}
@ -2958,11 +2959,11 @@ out:
}
EXPORT_SYMBOL(icnss_ce_free_irq);
void icnss_enable_irq(unsigned int ce_id)
void icnss_enable_irq(struct device *dev, unsigned int ce_id)
{
unsigned int irq;
if (!penv || !penv->pdev) {
if (!penv || !penv->pdev || !dev) {
icnss_pr_err("Platform driver not initialized\n");
return;
}
@ -2982,11 +2983,11 @@ void icnss_enable_irq(unsigned int ce_id)
}
EXPORT_SYMBOL(icnss_enable_irq);
void icnss_disable_irq(unsigned int ce_id)
void icnss_disable_irq(struct device *dev, unsigned int ce_id)
{
unsigned int irq;
if (!penv || !penv->pdev) {
if (!penv || !penv->pdev || !dev) {
icnss_pr_err("Platform driver not initialized\n");
return;
}
@ -3007,9 +3008,9 @@ void icnss_disable_irq(unsigned int ce_id)
}
EXPORT_SYMBOL(icnss_disable_irq);
int icnss_get_soc_info(struct icnss_soc_info *info)
int icnss_get_soc_info(struct device *dev, struct icnss_soc_info *info)
{
if (!penv) {
if (!penv || !dev) {
icnss_pr_err("Platform driver not initialized\n");
return -EINVAL;
}
@ -3029,10 +3030,13 @@ int icnss_get_soc_info(struct icnss_soc_info *info)
}
EXPORT_SYMBOL(icnss_get_soc_info);
int icnss_set_fw_log_mode(uint8_t fw_log_mode)
int icnss_set_fw_log_mode(struct device *dev, uint8_t fw_log_mode)
{
int ret;
if (!dev)
return -ENODEV;
icnss_pr_dbg("FW log mode: %u\n", fw_log_mode);
ret = wlfw_ini_send_sync_msg(fw_log_mode);
@ -3115,7 +3119,7 @@ out:
}
EXPORT_SYMBOL(icnss_athdiag_write);
int icnss_wlan_enable(struct icnss_wlan_enable_cfg *config,
int icnss_wlan_enable(struct device *dev, struct icnss_wlan_enable_cfg *config,
enum icnss_driver_mode mode,
const char *host_version)
{
@ -3123,6 +3127,9 @@ int icnss_wlan_enable(struct icnss_wlan_enable_cfg *config,
u32 i;
int ret;
if (!dev)
return -ENODEV;
icnss_pr_dbg("Mode: %d, config: %p, host_version: %s\n",
mode, config, host_version);
@ -3189,23 +3196,26 @@ out:
}
EXPORT_SYMBOL(icnss_wlan_enable);
int icnss_wlan_disable(enum icnss_driver_mode mode)
int icnss_wlan_disable(struct device *dev, enum icnss_driver_mode mode)
{
if (!dev)
return -ENODEV;
return wlfw_wlan_mode_send_sync_msg(QMI_WLFW_OFF_V01);
}
EXPORT_SYMBOL(icnss_wlan_disable);
bool icnss_is_qmi_disable(void)
bool icnss_is_qmi_disable(struct device *dev)
{
return test_bit(SKIP_QMI, &quirks) ? true : false;
}
EXPORT_SYMBOL(icnss_is_qmi_disable);
int icnss_get_ce_id(int irq)
int icnss_get_ce_id(struct device *dev, int irq)
{
int i;
if (!penv || !penv->pdev)
if (!penv || !penv->pdev || !dev)
return -ENODEV;
for (i = 0; i < ICNSS_MAX_IRQ_REGISTRATIONS; i++) {
@ -3219,11 +3229,11 @@ int icnss_get_ce_id(int irq)
}
EXPORT_SYMBOL(icnss_get_ce_id);
int icnss_get_irq(int ce_id)
int icnss_get_irq(struct device *dev, int ce_id)
{
int irq;
if (!penv || !penv->pdev)
if (!penv || !penv->pdev || !dev)
return -ENODEV;
if (ce_id >= ICNSS_MAX_IRQ_REGISTRATIONS)
@ -3657,7 +3667,7 @@ static int icnss_test_mode_fw_test_off(struct icnss_priv *priv)
goto out;
}
icnss_wlan_disable(ICNSS_OFF);
icnss_wlan_disable(&priv->pdev->dev, ICNSS_OFF);
ret = icnss_hw_power_off(priv);
@ -3698,7 +3708,7 @@ static int icnss_test_mode_fw_test(struct icnss_priv *priv,
set_bit(ICNSS_FW_TEST_MODE, &priv->state);
ret = icnss_wlan_enable(NULL, mode, NULL);
ret = icnss_wlan_enable(&priv->pdev->dev, NULL, mode, NULL);
if (ret)
goto power_off;

View file

@ -13,10 +13,15 @@
#define _ICNSS_WLAN_H_
#include <linux/interrupt.h>
#include <linux/device.h>
#define ICNSS_MAX_IRQ_REGISTRATIONS 12
#define ICNSS_MAX_TIMESTAMP_LEN 32
#ifndef ICNSS_API_WITH_DEV
#define ICNSS_API_WITH_DEV
#endif
enum icnss_uevent {
ICNSS_UEVENT_FW_READY,
ICNSS_UEVENT_FW_CRASHED,
@ -40,6 +45,8 @@ struct icnss_uevent_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);
@ -105,28 +112,34 @@ struct icnss_soc_info {
char fw_build_timestamp[ICNSS_MAX_TIMESTAMP_LEN + 1];
};
extern int icnss_register_driver(struct icnss_driver_ops *driver);
extern int icnss_unregister_driver(struct icnss_driver_ops *driver);
extern int icnss_wlan_enable(struct icnss_wlan_enable_cfg *config,
#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(enum icnss_driver_mode mode);
extern void icnss_enable_irq(unsigned int ce_id);
extern void icnss_disable_irq(unsigned int ce_id);
extern int icnss_get_soc_info(struct icnss_soc_info *info);
extern int icnss_ce_free_irq(unsigned int ce_id, void *ctx);
extern int icnss_ce_request_irq(unsigned int ce_id,
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(int irq);
extern int icnss_set_fw_log_mode(uint8_t fw_log_mode);
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(int ce_id);
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);
@ -138,7 +151,7 @@ extern int icnss_get_wlan_unsafe_channel(u16 *unsafe_ch_list, u16 *ch_count,
u16 buf_len);
extern int icnss_wlan_set_dfs_nol(const void *info, u16 info_len);
extern int icnss_wlan_get_dfs_nol(void *info, u16 info_len);
extern bool icnss_is_qmi_disable(void);
extern bool icnss_is_qmi_disable(struct device *dev);
extern bool icnss_is_fw_ready(void);
extern int icnss_set_wlan_mac_address(const u8 *in, const uint32_t len);
extern u8 *icnss_get_wlan_mac_address(struct device *dev, uint32_t *num);