ath10k: add wmi support for pdev_set_quiet_mode
authorRajkumar Manoharan <rmanohar@qti.qualcomm.com>
Wed, 17 Dec 2014 10:21:40 +0000 (12:21 +0200)
committerKalle Valo <kvalo@qca.qualcomm.com>
Tue, 23 Dec 2014 15:18:21 +0000 (17:18 +0200)
Add WMI support to send pdev_set_quiet_mode command to target.
This will be used for thermal mitigation purpose.

Signed-off-by: Rajkumar Manoharan <rmanohar@qti.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath10k/wmi-ops.h
drivers/net/wireless/ath/ath10k/wmi-tlv.c
drivers/net/wireless/ath/ath10k/wmi.c

index 1fbc5207b8709fa603bcd78f1082f970ebbb76e7..feed0fe5e117771de41d1009485b240ff9a67494 100644 (file)
@@ -114,6 +114,10 @@ struct wmi_ops {
        struct sk_buff *(*gen_dbglog_cfg)(struct ath10k *ar, u32 module_enable);
        struct sk_buff *(*gen_pktlog_enable)(struct ath10k *ar, u32 filter);
        struct sk_buff *(*gen_pktlog_disable)(struct ath10k *ar);
+       struct sk_buff *(*gen_pdev_set_quiet_mode)(struct ath10k *ar,
+                                                  u32 period, u32 duration,
+                                                  u32 next_offset,
+                                                  u32 enabled);
 };
 
 int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
@@ -818,4 +822,22 @@ ath10k_wmi_pdev_pktlog_disable(struct ath10k *ar)
                                   ar->wmi.cmd->pdev_pktlog_disable_cmdid);
 }
 
+static inline int
+ath10k_wmi_pdev_set_quiet_mode(struct ath10k *ar, u32 period, u32 duration,
+                              u32 next_offset, u32 enabled)
+{
+       struct sk_buff *skb;
+
+       if (!ar->wmi.ops->gen_pdev_set_quiet_mode)
+               return -EOPNOTSUPP;
+
+       skb = ar->wmi.ops->gen_pdev_set_quiet_mode(ar, period, duration,
+                                                  next_offset, enabled);
+       if (IS_ERR(skb))
+               return PTR_ERR(skb);
+
+       return ath10k_wmi_cmd_send(ar, skb,
+                                  ar->wmi.cmd->pdev_set_quiet_mode_cmdid);
+}
+
 #endif
index 1627ec58a22994b662c5ef3daf4e9f9f91c92bac..e203dadf1c0fbbddf3adfa5114d3214098585749 100644 (file)
@@ -2204,6 +2204,7 @@ static const struct wmi_ops wmi_tlv_ops = {
        .gen_dbglog_cfg = ath10k_wmi_tlv_op_gen_dbglog_cfg,
        .gen_pktlog_enable = ath10k_wmi_tlv_op_gen_pktlog_enable,
        .gen_pktlog_disable = ath10k_wmi_tlv_op_gen_pktlog_disable,
+       /* .gen_pdev_set_quiet_mode not implemented */
 };
 
 /************/
index cf9c727dc7d355df8e23c5c2423724a54da9fb41..77bb3313ca470cf9959c62adcb0c23365d808602 100644 (file)
@@ -4821,6 +4821,30 @@ ath10k_wmi_op_gen_pktlog_disable(struct ath10k *ar)
        return skb;
 }
 
+static struct sk_buff *
+ath10k_wmi_op_gen_pdev_set_quiet_mode(struct ath10k *ar, u32 period,
+                                     u32 duration, u32 next_offset,
+                                     u32 enabled)
+{
+       struct wmi_pdev_set_quiet_cmd *cmd;
+       struct sk_buff *skb;
+
+       skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
+       if (!skb)
+               return ERR_PTR(-ENOMEM);
+
+       cmd = (struct wmi_pdev_set_quiet_cmd *)skb->data;
+       cmd->period = __cpu_to_le32(period);
+       cmd->duration = __cpu_to_le32(duration);
+       cmd->next_start = __cpu_to_le32(next_offset);
+       cmd->enabled = __cpu_to_le32(enabled);
+
+       ath10k_dbg(ar, ATH10K_DBG_WMI,
+                  "wmi quiet param: period %u duration %u enabled %d\n",
+                  period, duration, enabled);
+       return skb;
+}
+
 static const struct wmi_ops wmi_ops = {
        .rx = ath10k_wmi_op_rx,
        .map_svc = wmi_main_svc_map,
@@ -4870,6 +4894,7 @@ static const struct wmi_ops wmi_ops = {
        .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg,
        .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable,
        .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable,
+       .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode,
 };
 
 static const struct wmi_ops wmi_10_1_ops = {
@@ -4922,6 +4947,7 @@ static const struct wmi_ops wmi_10_1_ops = {
        .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg,
        .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable,
        .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable,
+       .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode,
 };
 
 static const struct wmi_ops wmi_10_2_ops = {
@@ -4975,6 +5001,7 @@ static const struct wmi_ops wmi_10_2_ops = {
        .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg,
        .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable,
        .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable,
+       .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode,
 };
 
 static const struct wmi_ops wmi_10_2_4_ops = {
@@ -5028,6 +5055,7 @@ static const struct wmi_ops wmi_10_2_4_ops = {
        .gen_dbglog_cfg = ath10k_wmi_op_gen_dbglog_cfg,
        .gen_pktlog_enable = ath10k_wmi_op_gen_pktlog_enable,
        .gen_pktlog_disable = ath10k_wmi_op_gen_pktlog_disable,
+       .gen_pdev_set_quiet_mode = ath10k_wmi_op_gen_pdev_set_quiet_mode,
 };
 
 int ath10k_wmi_attach(struct ath10k *ar)