linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] rt2x00: allow disabling bands through platform_data
@ 2012-12-11 10:04 Daniel Golle
  2012-12-11 21:46 ` Gertjan van Wingerde
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Golle @ 2012-12-11 10:04 UTC (permalink / raw)
  To: linux-wireless; +Cc: users, juhosg, sgruszka, helmut.schaa, gwingerde, john

[-- Attachment #1: Type: text/plain, Size: 1803 bytes --]


Signed-off-by: Daniel Golle <dgolle@allnet.de>

diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 355cff5..c67e769 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -426,6 +426,7 @@ struct hw_mode_spec {
 	unsigned int supported_bands;
 #define SUPPORT_BAND_2GHZ	0x00000001
 #define SUPPORT_BAND_5GHZ	0x00000002
+#define SUPPORT_BAND_BOTH	(SUPPORT_BAND_2GHZ | SUPPORT_BAND_5GHZ)
 
 	unsigned int supported_rates;
 #define SUPPORT_RATE_CCK	0x00000001
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index d454488..b7856bf 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -835,6 +835,22 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,
 	unsigned int num_rates;
 	unsigned int i;
 
+	if (rt2x00dev->dev->platform_data) {
+		struct rt2x00_platform_data *pdata;
+
+		pdata = rt2x00dev->dev->platform_data;
+		if (pdata->disable_2ghz)
+			spec->supported_bands &= ~SUPPORT_BAND_2GHZ;
+		if (pdata->disable_5ghz)
+			spec->supported_bands &= ~SUPPORT_BAND_5GHZ;
+	}
+
+	if ((spec->supported_bands & SUPPORT_BAND_BOTH) == 0) {
+		ERROR(rt2x00dev, "No supported bands\n");
+		return -EINVAL;
+	}
+
+
 	num_rates = 0;
 	if (spec->supported_rates & SUPPORT_RATE_CCK)
 		num_rates += 4;
diff --git a/include/linux/rt2x00_platform.h b/include/linux/rt2x00_platform.h
index 80effa7..b4c7768 100644
--- a/include/linux/rt2x00_platform.h
+++ b/include/linux/rt2x00_platform.h
@@ -14,6 +14,9 @@
 
 struct rt2x00_platform_data {
 	char *eeprom_file_name;
+
+	int disable_2ghz;
+	int disable_5ghz;
 };
 
 #endif /* _RT2X00_PLATFORM_H */
-- 
1.8.0.1


[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/3] rt2x00: allow disabling bands through platform_data
  2012-12-11 10:04 [PATCH 2/3] rt2x00: allow disabling bands through platform_data Daniel Golle
@ 2012-12-11 21:46 ` Gertjan van Wingerde
  2012-12-12 19:24   ` Gabor Juhos
  0 siblings, 1 reply; 3+ messages in thread
From: Gertjan van Wingerde @ 2012-12-11 21:46 UTC (permalink / raw)
  To: Daniel Golle
  Cc: <linux-wireless@vger.kernel.org>,
	<users@rt2x00.serialmonkey.com>, <juhosg@openwrt.org>,
	<sgruszka@redhat.com>, <helmut.schaa@googlemail.com>,
	<john@phrozen.org>

Hi Daniel,

On 11 dec. 2012, at 11:04, Daniel Golle <dgolle@allnet.de> wrote:

> 
> Signed-off-by: Daniel Golle <dgolle@allnet.de>

Again we need a proper patch description here.

Also, can you explain why the enabling / disabling of individual bands needs to be done via platform data, as opposed to letting user space handle this?

> 
> diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
> index 355cff5..c67e769 100644
> --- a/drivers/net/wireless/rt2x00/rt2x00.h
> +++ b/drivers/net/wireless/rt2x00/rt2x00.h
> @@ -426,6 +426,7 @@ struct hw_mode_spec {
>    unsigned int supported_bands;
> #define SUPPORT_BAND_2GHZ    0x00000001
> #define SUPPORT_BAND_5GHZ    0x00000002
> +#define SUPPORT_BAND_BOTH    (SUPPORT_BAND_2GHZ | SUPPORT_BAND_5GHZ)
> 
>    unsigned int supported_rates;
> #define SUPPORT_RATE_CCK    0x00000001
> diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
> index d454488..b7856bf 100644
> --- a/drivers/net/wireless/rt2x00/rt2x00dev.c
> +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
> @@ -835,6 +835,22 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev,
>    unsigned int num_rates;
>    unsigned int i;
> 
> +    if (rt2x00dev->dev->platform_data) {
> +        struct rt2x00_platform_data *pdata;
> +
> +        pdata = rt2x00dev->dev->platform_data;
> +        if (pdata->disable_2ghz)
> +            spec->supported_bands &= ~SUPPORT_BAND_2GHZ;
> +        if (pdata->disable_5ghz)
> +            spec->supported_bands &= ~SUPPORT_BAND_5GHZ;
> +    }
> +
> +    if ((spec->supported_bands & SUPPORT_BAND_BOTH) == 0) {
> +        ERROR(rt2x00dev, "No supported bands\n");
> +        return -EINVAL;
> +    }
> +
> +
>    num_rates = 0;
>    if (spec->supported_rates & SUPPORT_RATE_CCK)
>        num_rates += 4;
> diff --git a/include/linux/rt2x00_platform.h b/include/linux/rt2x00_platform.h
> index 80effa7..b4c7768 100644
> --- a/include/linux/rt2x00_platform.h
> +++ b/include/linux/rt2x00_platform.h
> @@ -14,6 +14,9 @@
> 
> struct rt2x00_platform_data {
>    char *eeprom_file_name;
> +
> +    int disable_2ghz;
> +    int disable_5ghz;
> };
> 
> #endif /* _RT2X00_PLATFORM_H */
> -- 
> 1.8.0.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 2/3] rt2x00: allow disabling bands through platform_data
  2012-12-11 21:46 ` Gertjan van Wingerde
@ 2012-12-12 19:24   ` Gabor Juhos
  0 siblings, 0 replies; 3+ messages in thread
From: Gabor Juhos @ 2012-12-12 19:24 UTC (permalink / raw)
  To: Gertjan van Wingerde
  Cc: Daniel Golle, <linux-wireless@vger.kernel.org>,
	<users@rt2x00.serialmonkey.com>,
	<sgruszka@redhat.com>, <helmut.schaa@googlemail.com>,
	<john@phrozen.org>

2012.12.11. 22:46 keltezéssel, Gertjan van Wingerde írta:
> Hi Daniel,
> 
> On 11 dec. 2012, at 11:04, Daniel Golle <dgolle@allnet.de> wrote:
> 
>>
>> Signed-off-by: Daniel Golle <dgolle@allnet.de>
> 
> Again we need a proper patch description here.
> 
> Also, can you explain why the enabling / disabling of individual bands needs
> to be done via platform data, as opposed to letting user space handle this?

The patch should have been skipped for now. The explanation can be found here:

> http://rt2x00.serialmonkey.com/pipermail/users_rt2x00.serialmonkey.com/2012-November/005468.html

-Gabor

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-12-12 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-11 10:04 [PATCH 2/3] rt2x00: allow disabling bands through platform_data Daniel Golle
2012-12-11 21:46 ` Gertjan van Wingerde
2012-12-12 19:24   ` Gabor Juhos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).