linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mohammed Shafi <mshajakhan@atheros.com>
To: "linville@tuxdriver.com" <linville@tuxdriver.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	Luis Rodriguez <Luis.Rodriguez@Atheros.com>,
	Senthilkumar Balasubramanian
	<Senthilkumar.Balasubramanian@Atheros.com>,
	Rajkumar Manoharan <Rajkumar.Manoharan@Atheros.com>,
	Vivek Natarajan <Vivek.Natarajan@Atheros.com>,
	Mohammed Shajakhan <Mohammed.Shajakhan@Atheros.com>
Subject: Re: [PATCH] ath9k: Add a debug entry to start/stop ANI
Date: Thu, 26 May 2011 11:00:32 +0530	[thread overview]
Message-ID: <4DDDE578.6020806@atheros.com> (raw)
In-Reply-To: <1306387575-5793-1-git-send-email-mshajakhan@atheros.com>

On Thursday 26 May 2011 10:56 AM, Mohammed Shajakhan wrote:
> From: Mohammed Shafi Shajakhan<mshajakhan@atheros.com>
>
> this helps the user to start/stop ANI dynamically.
>
> Signed-off-by: Mohammed Shafi Shajakhan<mshajakhan@atheros.com>
> ---
>   drivers/net/wireless/ath/ath.h         |    1 +
>   drivers/net/wireless/ath/ath9k/ath9k.h |    1 +
>   drivers/net/wireless/ath/ath9k/debug.c |   52 ++++++++++++++++++++++++++++++++
>   drivers/net/wireless/ath/ath9k/init.c  |    2 +-
>   drivers/net/wireless/ath/ath9k/main.c  |   33 ++++++++++++++-----
>   5 files changed, 79 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath.h b/drivers/net/wireless/ath/ath.h
> index 7cf4317..17c4b56 100644
> --- a/drivers/net/wireless/ath/ath.h
> +++ b/drivers/net/wireless/ath/ath.h
> @@ -161,6 +161,7 @@ struct ath_common {
>   	const struct ath_bus_ops *bus_ops;
>
>   	bool btcoex_enabled;
> +	bool disable_ani;
>   };
>
>   struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
> diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
> index f75068b..e7cbbab 100644
> --- a/drivers/net/wireless/ath/ath9k/ath9k.h
> +++ b/drivers/net/wireless/ath/ath9k/ath9k.h
> @@ -428,6 +428,7 @@ void ath_hw_check(struct work_struct *work);
>   void ath_hw_pll_work(struct work_struct *work);
>   void ath_paprd_calibrate(struct work_struct *work);
>   void ath_ani_calibrate(unsigned long data);
> +void ath_start_ani(struct ath_common *common);
>
>   /**********/
>   /* BTCOEX */
> diff --git a/drivers/net/wireless/ath/ath9k/debug.c b/drivers/net/wireless/ath/ath9k/debug.c
> index d55ffd7..a3c6440 100644
> --- a/drivers/net/wireless/ath/ath9k/debug.c
> +++ b/drivers/net/wireless/ath/ath9k/debug.c
> @@ -176,6 +176,56 @@ static const struct file_operations fops_rx_chainmask = {
>   	.llseek = default_llseek,
>   };
>
> +static ssize_t read_file_disable_ani(struct file *file, char __user *user_buf,
> +			     size_t count, loff_t *ppos)
> +{
> +	struct ath_softc *sc = file->private_data;
> +	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
> +	char buf[32];
> +	unsigned int len;
> +
> +	len = sprintf(buf, "%d\n", common->disable_ani);
> +	return simple_read_from_buffer(user_buf, count, ppos, buf, len);
> +}
> +
> +static ssize_t write_file_disable_ani(struct file *file,
> +				      const char __user *user_buf,
> +				      size_t count, loff_t *ppos)
> +{
> +	struct ath_softc *sc = file->private_data;
> +	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
> +	unsigned long disable_ani;
> +	char buf[32];
> +	ssize_t len;
> +
> +	len = min(count, sizeof(buf) - 1);
> +	if (copy_from_user(buf, user_buf, len))
> +		return -EFAULT;
> +
> +	buf[len] = '\0';
> +	if (strict_strtoul(buf, 0,&disable_ani))
> +		return -EINVAL;
> +
> +	common->disable_ani = !!disable_ani;
> +
> +	if (disable_ani) {
> +		sc->sc_flags&= ~SC_OP_ANI_RUN;
> +		del_timer_sync(&common->ani.timer);
> +	} else {
> +		sc->sc_flags |= SC_OP_ANI_RUN;
> +		ath_start_ani(common);
> +	}
> +
> +	return count;
> +}
> +
> +static const struct file_operations fops_disable_ani = {
> +	.read = read_file_disable_ani,
> +	.write = write_file_disable_ani,
> +	.open = ath9k_debugfs_open,
> +	.owner = THIS_MODULE,
> +	.llseek = default_llseek,
> +};
>
>   static ssize_t read_file_dma(struct file *file, char __user *user_buf,
>   			     size_t count, loff_t *ppos)
> @@ -1160,6 +1210,8 @@ int ath9k_init_debug(struct ath_hw *ah)
>   			    sc->debug.debugfs_phy, sc,&fops_rx_chainmask);
>   	debugfs_create_file("tx_chainmask", S_IRUSR | S_IWUSR,
>   			    sc->debug.debugfs_phy, sc,&fops_tx_chainmask);
> +	debugfs_create_file("disable_ani", S_IRUSR | S_IWUSR,
> +			    sc->debug.debugfs_phy, sc,&fops_disable_ani);
>   	debugfs_create_file("regidx", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
>   			    sc,&fops_regidx);
>   	debugfs_create_file("regval", S_IRUSR | S_IWUSR, sc->debug.debugfs_phy,
> diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
> index 45c585a..d4b166c 100644
> --- a/drivers/net/wireless/ath/ath9k/init.c
> +++ b/drivers/net/wireless/ath/ath9k/init.c
> @@ -519,7 +519,6 @@ static void ath9k_init_misc(struct ath_softc *sc)
>   {
>   	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
>   	int i = 0;
> -
>   	setup_timer(&common->ani.timer, ath_ani_calibrate, (unsigned long)sc);
>
>   	sc->config.txpowlimit = ATH_TXPOWER_MAX;
> @@ -585,6 +584,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
>   	common->priv = sc;
>   	common->debug_mask = ath9k_debug;
>   	common->btcoex_enabled = ath9k_btcoex_enable == 1;
> +	common->disable_ani = false;
>   	spin_lock_init(&common->cc_lock);
>
>   	spin_lock_init(&sc->sc_serial_rw);
> diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
> index 8df1096..d2b67d8 100644
> --- a/drivers/net/wireless/ath/ath9k/main.c
> +++ b/drivers/net/wireless/ath/ath9k/main.c
> @@ -136,7 +136,7 @@ void ath9k_ps_restore(struct ath_softc *sc)
>   	spin_unlock_irqrestore(&sc->sc_pm_lock, flags);
>   }
>
> -static void ath_start_ani(struct ath_common *common)
> +void ath_start_ani(struct ath_common *common)
>   {
>   	struct ath_hw *ah = common->ah;
>   	unsigned long timestamp = jiffies_to_msecs(jiffies);
> @@ -302,7 +302,8 @@ int ath_set_channel(struct ath_softc *sc, struct ieee80211_hw *hw,
>   			ath_set_beacon(sc);
>   		ieee80211_queue_delayed_work(sc->hw,&sc->tx_complete_work, 0);
>   		ieee80211_queue_delayed_work(sc->hw,&sc->hw_pll_work, HZ/2);
> -		ath_start_ani(common);
> +		if (!common->disable_ani)
> +			ath_start_ani(common);
>   	}
>
>    ps_restore:
> @@ -972,6 +973,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
>   	sc->hw_busy_count = 0;
>
>   	/* Stop ANI */
> +
>   	del_timer_sync(&common->ani.timer);
>
>   	ath9k_ps_wakeup(sc);
> @@ -1021,7 +1023,9 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
>   	spin_unlock_bh(&sc->sc_pcu_lock);
>
>   	/* Start ANI */
> -	ath_start_ani(common);
> +	if (!common->disable_ani)
> +		ath_start_ani(common);
> +
>   	ath9k_ps_restore(sc);
>
>   	return r;
> @@ -1412,8 +1416,12 @@ static void ath9k_calculate_summary_state(struct ieee80211_hw *hw,
>   	/* Set up ANI */
>   	if (iter_data.naps>  0) {
>   		sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER;
> -		sc->sc_flags |= SC_OP_ANI_RUN;
> -		ath_start_ani(common);
> +
> +		if (!common->disable_ani) {
> +			sc->sc_flags |= SC_OP_ANI_RUN;
> +			ath_start_ani(common);
> +		}
> +
>   	} else {
>   		sc->sc_flags&= ~SC_OP_ANI_RUN;
>   		del_timer_sync(&common->ani.timer);
> @@ -1977,8 +1985,11 @@ static void ath9k_bss_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
>   		sc->last_rssi = ATH_RSSI_DUMMY_MARKER;
>   		sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER;
>
> -		sc->sc_flags |= SC_OP_ANI_RUN;
> -		ath_start_ani(common);
> +		if (!common->disable_ani) {
> +			sc->sc_flags |= SC_OP_ANI_RUN;
> +			ath_start_ani(common);
> +		}
> +
>   	}
>   }
>
> @@ -2047,8 +2058,12 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
>
>   		if (bss_conf->ibss_joined) {
>   			sc->sc_ah->stats.avgbrssi = ATH_RSSI_DUMMY_MARKER;
> -			sc->sc_flags |= SC_OP_ANI_RUN;
> -			ath_start_ani(common);
> +
> +			if (!common->disable_ani) {
> +				sc->sc_flags |= SC_OP_ANI_RUN;
> +				ath_start_ani(common);
> +			}
> +
>   		} else {
>   			sc->sc_flags&= ~SC_OP_ANI_RUN;
>   			del_timer_sync(&common->ani.timer);


John kindly apply the patch https://patchwork.kernel.org/patch/803192/ 
before applying this patch.
-- 
thanks,
shafi

      reply	other threads:[~2011-05-26  5:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-26  5:26 [PATCH] ath9k: Add a debug entry to start/stop ANI Mohammed Shafi Shajakhan
2011-05-26  5:30 ` Mohammed Shafi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DDDE578.6020806@atheros.com \
    --to=mshajakhan@atheros.com \
    --cc=Luis.Rodriguez@Atheros.com \
    --cc=Mohammed.Shajakhan@Atheros.com \
    --cc=Rajkumar.Manoharan@Atheros.com \
    --cc=Senthilkumar.Balasubramanian@Atheros.com \
    --cc=Vivek.Natarajan@Atheros.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).