]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ath10k: implement wmi echo event
authorMichal Kazior <michal.kazior@tieto.com>
Fri, 19 Aug 2016 10:37:42 +0000 (13:37 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Wed, 31 Aug 2016 07:27:30 +0000 (10:27 +0300)
Will be useful for implementing command barriers.

Signed-off-by: Michal Kazior <michal.kazior@tieto.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
drivers/net/wireless/ath/ath10k/wmi.h

index b1d88fa60d112cc0bfa54c193d4bf2fbe9d39a29..c67eda78b69e68e16c7a558986d8f5f57e4bed76 100644 (file)
@@ -51,6 +51,8 @@ struct wmi_ops {
                            struct wmi_roam_ev_arg *arg);
        int (*pull_wow_event)(struct ath10k *ar, struct sk_buff *skb,
                              struct wmi_wow_ev_arg *arg);
+       int (*pull_echo_ev)(struct ath10k *ar, struct sk_buff *skb,
+                           struct wmi_echo_ev_arg *arg);
        enum wmi_txbf_conf (*get_txbf_conf_scheme)(struct ath10k *ar);
 
        struct sk_buff *(*gen_pdev_suspend)(struct ath10k *ar, u32 suspend_opt);
@@ -350,6 +352,16 @@ ath10k_wmi_pull_wow_event(struct ath10k *ar, struct sk_buff *skb,
        return ar->wmi.ops->pull_wow_event(ar, skb, arg);
 }
 
+static inline int
+ath10k_wmi_pull_echo_ev(struct ath10k *ar, struct sk_buff *skb,
+                       struct wmi_echo_ev_arg *arg)
+{
+       if (!ar->wmi.ops->pull_echo_ev)
+               return -EOPNOTSUPP;
+
+       return ar->wmi.ops->pull_echo_ev(ar, skb, arg);
+}
+
 static inline enum wmi_txbf_conf
 ath10k_wmi_get_txbf_conf_scheme(struct ath10k *ar)
 {
index cd595855af36692b50ea4c6d82ac1bda20d223d8..a42f52dd9a3605d6eccd8e63061ba417b1d015c6 100644 (file)
@@ -1223,6 +1223,33 @@ ath10k_wmi_tlv_op_pull_wow_ev(struct ath10k *ar, struct sk_buff *skb,
        return 0;
 }
 
+static int ath10k_wmi_tlv_op_pull_echo_ev(struct ath10k *ar,
+                                         struct sk_buff *skb,
+                                         struct wmi_echo_ev_arg *arg)
+{
+       const void **tb;
+       const struct wmi_echo_event *ev;
+       int ret;
+
+       tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC);
+       if (IS_ERR(tb)) {
+               ret = PTR_ERR(tb);
+               ath10k_warn(ar, "failed to parse tlv: %d\n", ret);
+               return ret;
+       }
+
+       ev = tb[WMI_TLV_TAG_STRUCT_ECHO_EVENT];
+       if (!ev) {
+               kfree(tb);
+               return -EPROTO;
+       }
+
+       arg->value = ev->value;
+
+       kfree(tb);
+       return 0;
+}
+
 static struct sk_buff *
 ath10k_wmi_tlv_op_gen_pdev_suspend(struct ath10k *ar, u32 opt)
 {
@@ -3457,6 +3484,7 @@ static const struct wmi_ops wmi_tlv_ops = {
        .pull_fw_stats = ath10k_wmi_tlv_op_pull_fw_stats,
        .pull_roam_ev = ath10k_wmi_tlv_op_pull_roam_ev,
        .pull_wow_event = ath10k_wmi_tlv_op_pull_wow_ev,
+       .pull_echo_ev = ath10k_wmi_tlv_op_pull_echo_ev,
        .get_txbf_conf_scheme = ath10k_wmi_tlv_txbf_conf_scheme,
 
        .gen_pdev_suspend = ath10k_wmi_tlv_op_gen_pdev_suspend,
index 014c310208de4e3eb2d694f38446db92b83b2bb6..b802ca9c0edf59864842820c791b0fbd18629373 100644 (file)
@@ -2495,7 +2495,18 @@ exit:
 
 void ath10k_wmi_event_echo(struct ath10k *ar, struct sk_buff *skb)
 {
-       ath10k_dbg(ar, ATH10K_DBG_WMI, "WMI_ECHO_EVENTID\n");
+       struct wmi_echo_ev_arg arg = {};
+       int ret;
+
+       ret = ath10k_wmi_pull_echo_ev(ar, skb, &arg);
+       if (ret) {
+               ath10k_warn(ar, "failed to parse echo: %d\n", ret);
+               return;
+       }
+
+       ath10k_dbg(ar, ATH10K_DBG_WMI,
+                  "wmi event echo value 0x%08x\n",
+                  le32_to_cpu(arg.value));
 }
 
 int ath10k_wmi_event_debug_mesg(struct ath10k *ar, struct sk_buff *skb)
@@ -4792,6 +4803,17 @@ static int ath10k_wmi_op_pull_roam_ev(struct ath10k *ar, struct sk_buff *skb,
        return 0;
 }
 
+static int ath10k_wmi_op_pull_echo_ev(struct ath10k *ar,
+                                     struct sk_buff *skb,
+                                     struct wmi_echo_ev_arg *arg)
+{
+       struct wmi_echo_event *ev = (void *)skb->data;
+
+       arg->value = ev->value;
+
+       return 0;
+}
+
 int ath10k_wmi_event_ready(struct ath10k *ar, struct sk_buff *skb)
 {
        struct wmi_rdy_ev_arg arg = {};
@@ -7709,6 +7731,7 @@ static const struct wmi_ops wmi_ops = {
        .pull_rdy = ath10k_wmi_op_pull_rdy_ev,
        .pull_fw_stats = ath10k_wmi_main_op_pull_fw_stats,
        .pull_roam_ev = ath10k_wmi_op_pull_roam_ev,
+       .pull_echo_ev = ath10k_wmi_op_pull_echo_ev,
 
        .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
        .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
@@ -7783,6 +7806,7 @@ static const struct wmi_ops wmi_10_1_ops = {
        .pull_phyerr = ath10k_wmi_op_pull_phyerr_ev,
        .pull_rdy = ath10k_wmi_op_pull_rdy_ev,
        .pull_roam_ev = ath10k_wmi_op_pull_roam_ev,
+       .pull_echo_ev = ath10k_wmi_op_pull_echo_ev,
 
        .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
        .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
@@ -7854,6 +7878,7 @@ static const struct wmi_ops wmi_10_2_ops = {
        .pull_phyerr = ath10k_wmi_op_pull_phyerr_ev,
        .pull_rdy = ath10k_wmi_op_pull_rdy_ev,
        .pull_roam_ev = ath10k_wmi_op_pull_roam_ev,
+       .pull_echo_ev = ath10k_wmi_op_pull_echo_ev,
 
        .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
        .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
@@ -7921,6 +7946,7 @@ static const struct wmi_ops wmi_10_2_4_ops = {
        .pull_phyerr = ath10k_wmi_op_pull_phyerr_ev,
        .pull_rdy = ath10k_wmi_op_pull_rdy_ev,
        .pull_roam_ev = ath10k_wmi_op_pull_roam_ev,
+       .pull_echo_ev = ath10k_wmi_op_pull_echo_ev,
 
        .gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
        .gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
@@ -8028,6 +8054,7 @@ static const struct wmi_ops wmi_10_4_ops = {
        .ext_resource_config = ath10k_wmi_10_4_ext_resource_config,
 
        /* shared with 10.2 */
+       .pull_echo_ev = ath10k_wmi_op_pull_echo_ev,
        .gen_request_stats = ath10k_wmi_op_gen_request_stats,
        .gen_pdev_get_temperature = ath10k_wmi_10_2_op_gen_pdev_get_temperature,
        .get_vdev_subtype = ath10k_wmi_10_4_op_get_vdev_subtype,
index 3ef468893b3fe34548719c40b8a5ae009069331e..086d78807d2f953067ee616b9b2b93ff8f9caaff 100644 (file)
@@ -6296,6 +6296,10 @@ struct wmi_roam_ev_arg {
        __le32 rssi;
 };
 
+struct wmi_echo_ev_arg {
+       __le32 value;
+};
+
 struct wmi_pdev_temperature_event {
        /* temperature value in Celcius degree */
        __le32 temperature;