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

Commit 6f921fab authored by Luciano Coelho's avatar Luciano Coelho Committed by Tony Lindgren
Browse files

wlcore: set irq_trigger in board files instead of hiding behind a quirk



The platform_quirk element in the platform data was used
to change the way the IRQ is triggered.  When set,
the EDGE_IRQ quirk would change the irqflags used
and treat edge trigger differently from the rest.

Instead of hiding this irq flag setting behind the quirk,
have the board files set the irq_trigger explicitly.

This will allow us to use standard irq DT definitions
later on.

Signed-off-by: default avatarLuciano Coelho <luca@coelho.fi>
[Eliad - rebase, add irq_trigger field and pass it,
update board file changes]
Signed-off-by: default avatarEliad Peller <eliad@wizery.com>
Tested-by: default avatarNikita Kiryanov <nikita@compulab.co.il>
Acked-by: default avatarKalle Valo <kvalo@codeaurora.org>
Acked-by: default avatarSekhar Nori <nsekhar@ti.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 06e5801b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1385,8 +1385,8 @@ static const short da850_wl12xx_pins[] __initconst = {

static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
	.irq			= -1,
	.irq_trigger		= IRQ_TYPE_EDGE_RISING,
	.board_ref_clock	= WL12XX_REFCLOCK_38,
	.platform_quirks	= WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
};

static __init int da850_wl12xx_init(void)
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ static void __init __used legacy_init_wl12xx(unsigned ref_clock,
	wl12xx.board_ref_clock = ref_clock;
	wl12xx.board_tcxo_clock = tcxo_clock;
	wl12xx.irq = gpio_to_irq(gpio);
	wl12xx.irq_trigger = IRQ_TYPE_LEVEL_HIGH;

	res = wl12xx_set_platform_data(&wl12xx);
	if (res) {
+1 −1
Original line number Diff line number Diff line
@@ -502,7 +502,7 @@ static ssize_t driver_state_read(struct file *file, char __user *user_buf,
	DRIVER_STATE_PRINT_HEX(irq);
	/* TODO: ref_clock and tcxo_clock were moved to wl12xx priv */
	DRIVER_STATE_PRINT_HEX(hw_pg_ver);
	DRIVER_STATE_PRINT_HEX(platform_quirks);
	DRIVER_STATE_PRINT_HEX(irq_flags);
	DRIVER_STATE_PRINT_HEX(chip.id);
	DRIVER_STATE_PRINT_STR(chip.fw_ver_str);
	DRIVER_STATE_PRINT_STR(chip.phy_fw_ver_str);
+16 −11
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#include <linux/vmalloc.h>
#include <linux/wl12xx.h>
#include <linux/interrupt.h>
#include <linux/irq.h>

#include "wlcore.h"
#include "debug.h"
@@ -538,7 +539,7 @@ static int wlcore_irq_locked(struct wl1271 *wl)
	 * In case edge triggered interrupt must be used, we cannot iterate
	 * more than once without introducing race conditions with the hardirq.
	 */
	if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ)
	if (wl->irq_flags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING))
		loopcount = 1;

	wl1271_debug(DEBUG_IRQ, "IRQ work");
@@ -6249,7 +6250,6 @@ struct ieee80211_hw *wlcore_alloc_hw(size_t priv_size, u32 aggr_buf_size,
	wl->ap_ps_map = 0;
	wl->ap_fw_ps_map = 0;
	wl->quirks = 0;
	wl->platform_quirks = 0;
	wl->system_hlid = WL12XX_SYSTEM_HLID;
	wl->active_sta_count = 0;
	wl->active_link_count = 0;
@@ -6391,7 +6391,8 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
	struct platform_device *pdev = wl->pdev;
	struct wlcore_platdev_data *pdev_data = dev_get_platdata(&pdev->dev);
	struct wl12xx_platform_data *pdata = pdev_data->pdata;
	unsigned long irqflags;
	struct resource *res;

	int ret;
	irq_handler_t hardirq_fn = NULL;

@@ -6418,19 +6419,23 @@ static void wlcore_nvs_cb(const struct firmware *fw, void *context)
	/* adjust some runtime configuration parameters */
	wlcore_adjust_conf(wl);

	wl->irq = platform_get_irq(pdev, 0);
	wl->platform_quirks = pdata->platform_quirks;
	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
	if (!res) {
		wl1271_error("Could not get IRQ resource");
		goto out_free_nvs;
	}

	wl->irq = res->start;
	wl->irq_flags = res->flags & IRQF_TRIGGER_MASK;
	wl->if_ops = pdev_data->if_ops;

	if (wl->platform_quirks & WL12XX_PLATFORM_QUIRK_EDGE_IRQ) {
		irqflags = IRQF_TRIGGER_RISING;
	if (wl->irq_flags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING))
		hardirq_fn = wlcore_hardirq;
	} else {
		irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT;
	}
	else
		wl->irq_flags |= IRQF_ONESHOT;

	ret = request_threaded_irq(wl->irq, hardirq_fn, wlcore_irq,
				   irqflags, pdev->name, wl);
				   wl->irq_flags, pdev->name, wl);
	if (ret < 0) {
		wl1271_error("request_irq() failed: %d", ret);
		goto out_free_nvs;
+1 −1
Original line number Diff line number Diff line
@@ -287,7 +287,7 @@ static int wl1271_probe(struct sdio_func *func,
	memset(res, 0x00, sizeof(res));

	res[0].start = pdev_data.pdata->irq;
	res[0].flags = IORESOURCE_IRQ;
	res[0].flags = IORESOURCE_IRQ | pdev_data.pdata->irq_trigger;
	res[0].name = "irq";

	ret = platform_device_add_resources(glue->core, res, ARRAY_SIZE(res));
Loading