aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/cmd.c
diff options
context:
space:
mode:
authorAnna Neal <anna@cozybit.com>2008-09-11 14:17:25 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-09-11 15:53:40 -0400
commit0112c9e9e8d47f1d1e6ce1323675cb43ca6aae86 (patch)
tree73a2d11fe479e735b30348eed9e0ac32f130e947 /drivers/net/wireless/libertas/cmd.c
parentaee14ceb5230afb5c17a4e28222ab9734ffd5002 (diff)
libertas: Improvements on automatic tx power control via SIOCSIWTXPOW.
iwconfig txpower can now be used to set tx power to fixed or auto. If set to auto the default firmware settings are used. The command CMD_802_11_PA_CFG is only sent to older firmware, as Dan Williams noted the command was no longer supported in firmware V9+. Signed-off-by: Anna Neal <anna@cozybit.com> Signed-off-by: Javier Cardona <javier@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/cmd.c')
-rw-r--r--drivers/net/wireless/libertas/cmd.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 802547e79671..5fef05f3cd00 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -1971,6 +1971,70 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv)
1971} 1971}
1972 1972
1973 1973
1974/**
1975 * @brief Configures the transmission power control functionality.
1976 *
1977 * @param priv A pointer to struct lbs_private structure
1978 * @param enable Transmission power control enable
1979 * @param p0 Power level when link quality is good (dBm).
1980 * @param p1 Power level when link quality is fair (dBm).
1981 * @param p2 Power level when link quality is poor (dBm).
1982 * @param usesnr Use Signal to Noise Ratio in TPC
1983 *
1984 * @return 0 on success
1985 */
1986int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
1987 int8_t p2, int usesnr)
1988{
1989 struct cmd_ds_802_11_tpc_cfg cmd;
1990 int ret;
1991
1992 memset(&cmd, 0, sizeof(cmd));
1993 cmd.hdr.size = cpu_to_le16(sizeof(cmd));
1994 cmd.action = cpu_to_le16(CMD_ACT_SET);
1995 cmd.enable = !!enable;
1996 cmd.usesnr = !!enable;
1997 cmd.P0 = p0;
1998 cmd.P1 = p1;
1999 cmd.P2 = p2;
2000
2001 ret = lbs_cmd_with_response(priv, CMD_802_11_TPC_CFG, &cmd);
2002
2003 return ret;
2004}
2005
2006/**
2007 * @brief Configures the power adaptation settings.
2008 *
2009 * @param priv A pointer to struct lbs_private structure
2010 * @param enable Power adaptation enable
2011 * @param p0 Power level for 1, 2, 5.5 and 11 Mbps (dBm).
2012 * @param p1 Power level for 6, 9, 12, 18, 22, 24 and 36 Mbps (dBm).
2013 * @param p2 Power level for 48 and 54 Mbps (dBm).
2014 *
2015 * @return 0 on Success
2016 */
2017
2018int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
2019 int8_t p1, int8_t p2)
2020{
2021 struct cmd_ds_802_11_pa_cfg cmd;
2022 int ret;
2023
2024 memset(&cmd, 0, sizeof(cmd));
2025 cmd.hdr.size = cpu_to_le16(sizeof(cmd));
2026 cmd.action = cpu_to_le16(CMD_ACT_SET);
2027 cmd.enable = !!enable;
2028 cmd.P0 = p0;
2029 cmd.P1 = p1;
2030 cmd.P2 = p2;
2031
2032 ret = lbs_cmd_with_response(priv, CMD_802_11_PA_CFG , &cmd);
2033
2034 return ret;
2035}
2036
2037
1974static struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, 2038static struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv,
1975 uint16_t command, struct cmd_header *in_cmd, int in_cmd_size, 2039 uint16_t command, struct cmd_header *in_cmd, int in_cmd_size,
1976 int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *), 2040 int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),