Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4060dfb authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "icnss: Add dev to all export APIs in ICNSS"

parents e2bbb232 09e3207b
Loading
Loading
Loading
Loading
+32 −22
Original line number Diff line number Diff line
@@ -2801,7 +2801,8 @@ static int icnss_enable_recovery(struct icnss_priv *priv)
	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;

@@ -2832,7 +2833,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)
{
@@ -2858,7 +2859,7 @@ int icnss_unregister_driver(struct icnss_driver_ops *ops)
}
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)
{
@@ -2866,7 +2867,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;
	}
@@ -2905,13 +2906,13 @@ int icnss_ce_request_irq(unsigned int ce_id,
}
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;
	}
@@ -2941,11 +2942,11 @@ int icnss_ce_free_irq(unsigned int ce_id, void *ctx)
}
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;
	}
@@ -2965,11 +2966,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;
	}
@@ -2990,9 +2991,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;
	}
@@ -3012,10 +3013,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);
@@ -3098,7 +3102,7 @@ int icnss_athdiag_write(struct device *dev, uint32_t offset,
}
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)
{
@@ -3106,6 +3110,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);

@@ -3172,23 +3179,26 @@ int icnss_wlan_enable(struct icnss_wlan_enable_cfg *config,
}
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++) {
@@ -3202,11 +3212,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)
@@ -3582,7 +3592,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);

@@ -3623,7 +3633,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;

+26 −13
Original line number Diff line number Diff line
@@ -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,
@@ -34,6 +39,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);
@@ -99,35 +106,41 @@ 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);
extern int icnss_smmu_map(struct device *dev, phys_addr_t paddr,
			  uint32_t *iova_addr, size_t size);
extern unsigned int icnss_socinfo_get_serial_number(struct device *dev);
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_trigger_recovery(struct device *dev);
#endif /* _ICNSS_WLAN_H_ */