summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@quicinc.com>2017-11-29 15:24:41 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2017-11-29 15:24:41 -0800
commitde7627fc2a9615328822653c71e71268cf1a31b8 (patch)
treeaff98449330d07794a768403ed134e4877b23834
parent27cf3c894be26836c4f4f74b838268e1fb3d8a3a (diff)
parentf89e708410fef0219603072ad606b42b7632b73a (diff)
Merge "icnss: Add dev to all export APIs in ICNSS"
-rw-r--r--drivers/soc/qcom/icnss.c54
-rw-r--r--include/soc/qcom/icnss.h39
2 files changed, 58 insertions, 35 deletions
diff --git a/drivers/soc/qcom/icnss.c b/drivers/soc/qcom/icnss.c
index 29cc84676442..73d6bea83b95 100644
--- a/drivers/soc/qcom/icnss.c
+++ b/drivers/soc/qcom/icnss.c
@@ -2819,7 +2819,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;
@@ -2850,7 +2851,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)
{
@@ -2876,7 +2877,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)
{
@@ -2884,7 +2885,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;
}
@@ -2923,13 +2924,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;
}
@@ -2959,11 +2960,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;
}
@@ -2983,11 +2984,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;
}
@@ -3008,9 +3009,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;
}
@@ -3030,10 +3031,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);
@@ -3116,7 +3120,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)
{
@@ -3124,6 +3128,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);
@@ -3190,23 +3197,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++) {
@@ -3220,11 +3230,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)
@@ -3658,7 +3668,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);
@@ -3699,7 +3709,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;
diff --git a/include/soc/qcom/icnss.h b/include/soc/qcom/icnss.h
index 78ca0f4bbd08..7915841b17ea 100644
--- a/include/soc/qcom/icnss.h
+++ b/include/soc/qcom/icnss.h
@@ -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);