* [PATCHv2] wl1271: Add extended radio parameter initialization
@ 2010-10-05 11:11 juuso.oikarinen
2010-10-05 11:47 ` Luciano Coelho
0 siblings, 1 reply; 4+ messages in thread
From: juuso.oikarinen @ 2010-10-05 11:11 UTC (permalink / raw)
To: luciano.coelho; +Cc: linux-wireless
From: Juuso Oikarinen <juuso.oikarinen@nokia.com>
Currently a command to initialize extended radio parameter tables in the
hardware is missing.
Add the initialization
Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
---
v2: change the name of the length macro for the TX power compensation table
drivers/net/wireless/wl12xx/wl1271_cmd.c | 33 +++++++++++++++++++++++++++++
drivers/net/wireless/wl12xx/wl1271_cmd.h | 24 +++++++++++++++-----
drivers/net/wireless/wl12xx/wl1271_conf.h | 21 ++++++++++++++++++
drivers/net/wireless/wl12xx/wl1271_init.c | 4 +++
drivers/net/wireless/wl12xx/wl1271_main.c | 14 ++++++++++++
5 files changed, 90 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.c b/drivers/net/wireless/wl12xx/wl1271_cmd.c
index 4a56ab0..596e333 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.c
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.c
@@ -171,6 +171,39 @@ int wl1271_cmd_radio_parms(struct wl1271 *wl)
return ret;
}
+int wl1271_cmd_ext_radio_parms(struct wl1271 *wl)
+{
+ struct wl1271_ext_radio_parms_cmd *ext_radio_parms;
+ struct conf_rf_settings *rf = &wl->conf.rf;
+ int ret;
+
+ if (!wl->nvs)
+ return -ENODEV;
+
+ ext_radio_parms = kzalloc(sizeof(*ext_radio_parms), GFP_KERNEL);
+ if (!ext_radio_parms)
+ return -ENOMEM;
+
+ ext_radio_parms->test.id = TEST_CMD_INI_FILE_RF_EXTENDED_PARAM;
+
+ memcpy(ext_radio_parms->tx_per_channel_power_compensation_2,
+ rf->tx_per_channel_power_compensation_2,
+ CONF_TX_PWR_COMPENSATION_LEN_2);
+ memcpy(ext_radio_parms->tx_per_channel_power_compensation_5,
+ rf->tx_per_channel_power_compensation_5,
+ CONF_TX_PWR_COMPENSATION_LEN_5);
+
+ wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_EXT_RADIO_PARAM: ",
+ ext_radio_parms, sizeof(*ext_radio_parms));
+
+ ret = wl1271_cmd_test(wl, ext_radio_parms, sizeof(*ext_radio_parms), 0);
+ if (ret < 0)
+ wl1271_warning("TEST_CMD_INI_FILE_RF_EXTENDED_PARAM failed");
+
+ kfree(ext_radio_parms);
+ return ret;
+}
+
/*
* Poll the mailbox event field until any of the bits in the mask is set or a
* timeout occurs (WL1271_EVENT_TIMEOUT in msecs)
diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h
index 33b946b..4e8b464 100644
--- a/drivers/net/wireless/wl12xx/wl1271_cmd.h
+++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h
@@ -33,6 +33,7 @@ int wl1271_cmd_send(struct wl1271 *wl, u16 id, void *buf, size_t len,
size_t res_len);
int wl1271_cmd_general_parms(struct wl1271 *wl);
int wl1271_cmd_radio_parms(struct wl1271 *wl);
+int wl1271_cmd_ext_radio_parms(struct wl1271 *wl);
int wl1271_cmd_join(struct wl1271 *wl, u8 bss_type);
int wl1271_cmd_test(struct wl1271 *wl, void *buf, size_t buf_len, u8 answer);
int wl1271_cmd_interrogate(struct wl1271 *wl, u16 id, void *buf, size_t len);
@@ -324,13 +325,14 @@ enum wl1271_channel_tune_bands {
WL1271_CHANNEL_TUNE_BAND_4_9
};
-#define WL1271_PD_REFERENCE_POINT_BAND_B_G 0
+#define WL1271_PD_REFERENCE_POINT_BAND_B_G 0
-#define TEST_CMD_P2G_CAL 0x02
-#define TEST_CMD_CHANNEL_TUNE 0x0d
-#define TEST_CMD_UPDATE_PD_REFERENCE_POINT 0x1d
-#define TEST_CMD_INI_FILE_RADIO_PARAM 0x19
-#define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E
+#define TEST_CMD_P2G_CAL 0x02
+#define TEST_CMD_CHANNEL_TUNE 0x0d
+#define TEST_CMD_UPDATE_PD_REFERENCE_POINT 0x1d
+#define TEST_CMD_INI_FILE_RADIO_PARAM 0x19
+#define TEST_CMD_INI_FILE_GENERAL_PARAM 0x1E
+#define TEST_CMD_INI_FILE_RF_EXTENDED_PARAM 0x26
struct wl1271_general_parms_cmd {
struct wl1271_cmd_header header;
@@ -363,6 +365,16 @@ struct wl1271_radio_parms_cmd {
u8 padding3[2];
} __packed;
+struct wl1271_ext_radio_parms_cmd {
+ struct wl1271_cmd_header header;
+
+ struct wl1271_cmd_test_header test;
+
+ u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2];
+ u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5];
+ u8 padding[3];
+} __attribute__ ((packed));
+
struct wl1271_cmd_cal_channel_tune {
struct wl1271_cmd_header header;
diff --git a/drivers/net/wireless/wl12xx/wl1271_conf.h b/drivers/net/wireless/wl12xx/wl1271_conf.h
index 60c50d1..5f78a6c 100644
--- a/drivers/net/wireless/wl12xx/wl1271_conf.h
+++ b/drivers/net/wireless/wl12xx/wl1271_conf.h
@@ -1070,6 +1070,26 @@ struct conf_scan_settings {
};
+/* these are number of channels on the band divided by two, rounded up */
+#define CONF_TX_PWR_COMPENSATION_LEN_2 7
+#define CONF_TX_PWR_COMPENSATION_LEN_5 18
+
+struct conf_rf_settings {
+ /*
+ * Per channel power compensation for 2.4GHz
+ *
+ * Range: s8
+ */
+ u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2];
+
+ /*
+ * Per channel power compensation for 5GHz
+ *
+ * Range: s8
+ */
+ u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5];
+};
+
struct conf_drv_settings {
struct conf_sg_settings sg;
struct conf_rx_settings rx;
@@ -1079,6 +1099,7 @@ struct conf_drv_settings {
struct conf_pm_config_settings pm_config;
struct conf_roam_trigger_settings roam_trigger;
struct conf_scan_settings scan;
+ struct conf_rf_settings rf;
};
#endif
diff --git a/drivers/net/wireless/wl12xx/wl1271_init.c b/drivers/net/wireless/wl12xx/wl1271_init.c
index 349571f..8044bba 100644
--- a/drivers/net/wireless/wl12xx/wl1271_init.c
+++ b/drivers/net/wireless/wl12xx/wl1271_init.c
@@ -222,6 +222,10 @@ int wl1271_hw_init(struct wl1271 *wl)
if (ret < 0)
return ret;
+ ret = wl1271_cmd_ext_radio_parms(wl);
+ if (ret < 0)
+ return ret;
+
/* Template settings */
ret = wl1271_init_templates_config(wl);
if (ret < 0)
diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
index cb18f22..8d33a2b 100644
--- a/drivers/net/wireless/wl12xx/wl1271_main.c
+++ b/drivers/net/wireless/wl12xx/wl1271_main.c
@@ -242,6 +242,16 @@ static struct conf_drv_settings default_conf = {
.max_dwell_time_passive = 60000,
.num_probe_reqs = 2,
},
+ .rf = {
+ .tx_per_channel_power_compensation_2 = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ },
+ .tx_per_channel_power_compensation_5 = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ },
+ },
};
static void __wl1271_op_remove_interface(struct wl1271 *wl);
@@ -357,6 +367,10 @@ static int wl1271_plt_init(struct wl1271 *wl)
if (ret < 0)
return ret;
+ ret = wl1271_cmd_ext_radio_parms(wl);
+ if (ret < 0)
+ return ret;
+
ret = wl1271_init_templates_config(wl);
if (ret < 0)
return ret;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCHv2] wl1271: Add extended radio parameter initialization
2010-10-05 11:11 [PATCHv2] wl1271: Add extended radio parameter initialization juuso.oikarinen
@ 2010-10-05 11:47 ` Luciano Coelho
2010-10-05 11:56 ` Juuso Oikarinen
2010-10-05 12:08 ` Luciano Coelho
0 siblings, 2 replies; 4+ messages in thread
From: Luciano Coelho @ 2010-10-05 11:47 UTC (permalink / raw)
To: juuso.oikarinen@nokia.com; +Cc: linux-wireless@vger.kernel.org
On Tue, 2010-10-05 at 13:11 +0200, juuso.oikarinen@nokia.com wrote:
> From: Juuso Oikarinen <juuso.oikarinen@nokia.com>
>
> Currently a command to initialize extended radio parameter tables in the
> hardware is missing.
>
> Add the initialization
>
> Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
> ---
> v2: change the name of the length macro for the TX power compensation table
Thanks for fixing it, it looks clearer now.
Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
A couple of comments below.
[...]
> diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h
> index 33b946b..4e8b464 100644
> --- a/drivers/net/wireless/wl12xx/wl1271_cmd.h
> +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h
[...]
> @@ -363,6 +365,16 @@ struct wl1271_radio_parms_cmd {
> u8 padding3[2];
> } __packed;
>
> +struct wl1271_ext_radio_parms_cmd {
> + struct wl1271_cmd_header header;
> +
> + struct wl1271_cmd_test_header test;
> +
> + u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2];
> + u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5];
> + u8 padding[3];
> +} __attribute__ ((packed));
> +
This should be __packed nowadays. But I'll change that before applying
the patch, so no need to resend.
[...]
> diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
> index cb18f22..8d33a2b 100644
> --- a/drivers/net/wireless/wl12xx/wl1271_main.c
> +++ b/drivers/net/wireless/wl12xx/wl1271_main.c
> @@ -242,6 +242,16 @@ static struct conf_drv_settings default_conf = {
> .max_dwell_time_passive = 60000,
> .num_probe_reqs = 2,
> },
> + .rf = {
> + .tx_per_channel_power_compensation_2 = {
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + },
> + .tx_per_channel_power_compensation_5 = {
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> + },
> + },
> };
I guess we should not hardcode this in the driver, but add it to the NVS
file. But let's think about that later, because we need to agree on
changing the NVS structure first.
--
Cheers,
Luca.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2] wl1271: Add extended radio parameter initialization
2010-10-05 11:47 ` Luciano Coelho
@ 2010-10-05 11:56 ` Juuso Oikarinen
2010-10-05 12:08 ` Luciano Coelho
1 sibling, 0 replies; 4+ messages in thread
From: Juuso Oikarinen @ 2010-10-05 11:56 UTC (permalink / raw)
To: Luciano Coelho; +Cc: linux-wireless@vger.kernel.org
On Tue, 2010-10-05 at 13:47 +0200, Luciano Coelho wrote:
> On Tue, 2010-10-05 at 13:11 +0200, juuso.oikarinen@nokia.com wrote:
> > From: Juuso Oikarinen <juuso.oikarinen@nokia.com>
> >
> > Currently a command to initialize extended radio parameter tables in the
> > hardware is missing.
> >
> > Add the initialization
> >
> > Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
> > ---
> > v2: change the name of the length macro for the TX power compensation table
>
> Thanks for fixing it, it looks clearer now.
>
> Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
>
> A couple of comments below.
>
> [...]
>
> > diff --git a/drivers/net/wireless/wl12xx/wl1271_cmd.h b/drivers/net/wireless/wl12xx/wl1271_cmd.h
> > index 33b946b..4e8b464 100644
> > --- a/drivers/net/wireless/wl12xx/wl1271_cmd.h
> > +++ b/drivers/net/wireless/wl12xx/wl1271_cmd.h
>
> [...]
>
> > @@ -363,6 +365,16 @@ struct wl1271_radio_parms_cmd {
> > u8 padding3[2];
> > } __packed;
> >
> > +struct wl1271_ext_radio_parms_cmd {
> > + struct wl1271_cmd_header header;
> > +
> > + struct wl1271_cmd_test_header test;
> > +
> > + u8 tx_per_channel_power_compensation_2[CONF_TX_PWR_COMPENSATION_LEN_2];
> > + u8 tx_per_channel_power_compensation_5[CONF_TX_PWR_COMPENSATION_LEN_5];
> > + u8 padding[3];
> > +} __attribute__ ((packed));
> > +
>
> This should be __packed nowadays. But I'll change that before applying
> the patch, so no need to resend.
>
> [...]
>
> > diff --git a/drivers/net/wireless/wl12xx/wl1271_main.c b/drivers/net/wireless/wl12xx/wl1271_main.c
> > index cb18f22..8d33a2b 100644
> > --- a/drivers/net/wireless/wl12xx/wl1271_main.c
> > +++ b/drivers/net/wireless/wl12xx/wl1271_main.c
> > @@ -242,6 +242,16 @@ static struct conf_drv_settings default_conf = {
> > .max_dwell_time_passive = 60000,
> > .num_probe_reqs = 2,
> > },
> > + .rf = {
> > + .tx_per_channel_power_compensation_2 = {
> > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > + },
> > + .tx_per_channel_power_compensation_5 = {
> > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
> > + },
> > + },
> > };
>
> I guess we should not hardcode this in the driver, but add it to the NVS
> file. But let's think about that later, because we need to agree on
> changing the NVS structure first.
>
It should not be hardcoded, thats true. The current NVS does not have a
slot for these yet. When it does, we can change the code accordingly.
For now this functionality mainly acts as initialization to zero, so
that nothing bad happens in the firmware if when these values begin to
be used for some purpose.
-Juuso
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2] wl1271: Add extended radio parameter initialization
2010-10-05 11:47 ` Luciano Coelho
2010-10-05 11:56 ` Juuso Oikarinen
@ 2010-10-05 12:08 ` Luciano Coelho
1 sibling, 0 replies; 4+ messages in thread
From: Luciano Coelho @ 2010-10-05 12:08 UTC (permalink / raw)
To: Oikarinen Juuso (Nokia-MS/Tampere); +Cc: linux-wireless@vger.kernel.org
On Tue, 2010-10-05 at 13:47 +0200, ext Luciano Coelho wrote:
> On Tue, 2010-10-05 at 13:11 +0200, juuso.oikarinen@nokia.com wrote:
> > From: Juuso Oikarinen <juuso.oikarinen@nokia.com>
> >
> > Currently a command to initialize extended radio parameter tables in the
> > hardware is missing.
> >
> > Add the initialization
> >
> > Signed-off-by: Juuso Oikarinen <juuso.oikarinen@nokia.com>
> > ---
> > v2: change the name of the length macro for the TX power compensation table
>
> Thanks for fixing it, it looks clearer now.
>
> Reviewed-by: Luciano Coelho <luciano.coelho@nokia.com>
>
Applied to wl12xx/master.
--
Cheers,
Luca.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-10-05 12:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-05 11:11 [PATCHv2] wl1271: Add extended radio parameter initialization juuso.oikarinen
2010-10-05 11:47 ` Luciano Coelho
2010-10-05 11:56 ` Juuso Oikarinen
2010-10-05 12:08 ` Luciano Coelho
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).