public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Bitterblue Smith <rtl8821cerfe2@gmail.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Cc: Larry Finger <Larry.Finger@lwfinger.net>,
	Stefan Lippers-Hollmann <s.l-h@gmx.de>,
	Christian Hewitt <chewitt@libreelec.tv>
Subject: RE: [PATCH v5 10/11] wifi: rtlwifi: Add rtl8192du/sw.{c,h}
Date: Fri, 10 May 2024 05:52:00 +0000	[thread overview]
Message-ID: <8e5d163e7f234f78b23dd21b476cb23d@realtek.com> (raw)
In-Reply-To: <8cb4b235-fec6-4ad4-a5bb-9d9bb1812a9a@gmail.com>

Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote:
> These contain the new module's entry point.
> 
> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> ---
>  .../wireless/realtek/rtlwifi/rtl8192du/sw.c   | 397 ++++++++++++++++++

Subject is "wifi: rtlwifi: Add rtl8192du/sw.{c,h}", but actually you don't
have sw.h.

>  1 file changed, 397 insertions(+)
>  create mode 100644 drivers/net/wireless/realtek/rtlwifi/rtl8192du/sw.c
> 
> diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192du/sw.c
> b/drivers/net/wireless/realtek/rtlwifi/rtl8192du/sw.c
> new file mode 100644
> index 000000000000..18a855b041c3
> --- /dev/null
> +++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192du/sw.c
> @@ -0,0 +1,397 @@

[...]

> +
> +static int rtl92du_init_shared_data(struct ieee80211_hw *hw)
> +{
> +       struct usb_interface *other_intf = rtl92du_get_other_intf(hw);
> +       struct rtl_priv *rtlpriv = rtl_priv(hw);
> +       struct rtl_priv *other_rtlpriv = NULL;
> +       struct ieee80211_hw *other_hw = NULL;
> +
> +       if (other_intf)
> +               other_hw = usb_get_intfdata(other_intf);
> +
> +       if (other_hw) {
> +               /* The other interface was already probed. */
> +               other_rtlpriv = rtl_priv(other_hw);
> +               rtlpriv->curveindex_2g = other_rtlpriv->curveindex_2g;
> +               rtlpriv->curveindex_5g = other_rtlpriv->curveindex_5g;
> +               rtlpriv->mutex_for_power_on_off = other_rtlpriv->mutex_for_power_on_off;
> +               rtlpriv->mutex_for_hw_init = other_rtlpriv->mutex_for_hw_init;
> +
> +               if (!rtlpriv->curveindex_2g || !rtlpriv->curveindex_5g ||
> +                   !rtlpriv->mutex_for_power_on_off || !rtlpriv->mutex_for_hw_init)
> +                       return 1;

return standard errno. 

> +
> +               return 0;
> +       }
> +
> +       /* The other interface doesn't exist or was not probed yet. */
> +       rtlpriv->curveindex_2g = kcalloc(TARGET_CHNL_NUM_2G,
> +                                        sizeof(*rtlpriv->curveindex_2g),
> +                                        GFP_KERNEL);
> +       rtlpriv->curveindex_5g = kcalloc(TARGET_CHNL_NUM_5G,
> +                                        sizeof(*rtlpriv->curveindex_5g),
> +                                        GFP_KERNEL);
> +       rtlpriv->mutex_for_power_on_off =
> +               kzalloc(sizeof(*rtlpriv->mutex_for_power_on_off), GFP_KERNEL);
> +       rtlpriv->mutex_for_hw_init =
> +               kzalloc(sizeof(*rtlpriv->mutex_for_hw_init), GFP_KERNEL);
> +
> +       if (!rtlpriv->curveindex_2g || !rtlpriv->curveindex_5g ||
> +           !rtlpriv->mutex_for_power_on_off || !rtlpriv->mutex_for_hw_init) {
> +               kfree(rtlpriv->curveindex_2g);
> +               kfree(rtlpriv->curveindex_5g);
> +               kfree(rtlpriv->mutex_for_power_on_off);
> +               kfree(rtlpriv->mutex_for_hw_init);
> +               rtlpriv->curveindex_2g = NULL;
> +               rtlpriv->curveindex_5g = NULL;
> +               rtlpriv->mutex_for_power_on_off = NULL;
> +               rtlpriv->mutex_for_hw_init = NULL;
> +               return 1;

ditto.

> +       }
> +
> +       mutex_init(rtlpriv->mutex_for_power_on_off);
> +       mutex_init(rtlpriv->mutex_for_hw_init);
> +
> +       return 0;
> +}
> +
> +static void rtl92du_deinit_shared_data(struct ieee80211_hw *hw)
> +{
> +       struct usb_interface *other_intf = rtl92du_get_other_intf(hw);
> +       struct rtl_priv *rtlpriv = rtl_priv(hw);
> +
> +       if (!other_intf || !usb_get_intfdata(other_intf)) {
> +               /* The other interface doesn't exist or was already disconnected. */
> +               kfree(rtlpriv->curveindex_2g);
> +               kfree(rtlpriv->curveindex_5g);
> +               if (rtlpriv->mutex_for_power_on_off)
> +                       mutex_destroy(rtlpriv->mutex_for_power_on_off);
> +               if (rtlpriv->mutex_for_hw_init)
> +                       mutex_destroy(rtlpriv->mutex_for_hw_init);
> +               kfree(rtlpriv->mutex_for_power_on_off);
> +               kfree(rtlpriv->mutex_for_hw_init);
> +       }
> +}
> +
> +static int rtl92du_init_sw_vars(struct ieee80211_hw *hw)
> +{
> +       const char *fw_name = "rtlwifi/rtl8192dufw.bin";
> +       struct rtl_priv *rtlpriv = rtl_priv(hw);
> +       int err;
> +
> +       if (rtl92du_init_shared_data(hw))
> +               return 1;

return standard errno.

> +
> +       rtlpriv->dm.dm_initialgain_enable = true;
> +       rtlpriv->dm.dm_flag = 0;
> +       rtlpriv->dm.disable_framebursting = false;
> +       rtlpriv->dm.thermalvalue = 0;
> +       rtlpriv->dm.useramask = true;
> +
> +       /* dual mac */
> +       if (rtlpriv->rtlhal.current_bandtype == BAND_ON_5G)
> +               rtlpriv->phy.current_channel = 36;
> +       else
> +               rtlpriv->phy.current_channel = 1;
> +
> +       if (rtlpriv->rtlhal.macphymode != SINGLEMAC_SINGLEPHY)
> +               rtlpriv->rtlhal.disable_amsdu_8k = true;
> +
> +       /* for LPS & IPS */
> +       rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps;
> +       rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps;
> +       rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps;
> +       if (!rtlpriv->psc.inactiveps)
> +               pr_info("Inactive Power Save off (module option)\n");
> +
> +       /* for early mode */
> +       rtlpriv->rtlhal.earlymode_enable = false;
> +
> +       /* for firmware buf */
> +       rtlpriv->rtlhal.pfirmware = kmalloc(0x8000, GFP_KERNEL);
> +       if (!rtlpriv->rtlhal.pfirmware)
> +               return 1;

ditto.

> +
> +       rtlpriv->max_fw_size = 0x8000;
> +       pr_info("Driver for Realtek RTL8192DU WLAN interface\n");
> +       pr_info("Loading firmware file %s\n", fw_name);
> +
> +       /* request fw */
> +       err = request_firmware_nowait(THIS_MODULE, 1, fw_name,
> +                                     rtlpriv->io.dev, GFP_KERNEL, hw,
> +                                     rtl_fw_cb);
> +       if (err) {
> +               pr_err("Failed to request firmware!\n");
> +               kfree(rtlpriv->rtlhal.pfirmware);
> +               rtlpriv->rtlhal.pfirmware = NULL;
> +               return 1;

ditto.

> +       }
> +
> +       return 0;
> +}
> +

[...]


  reply	other threads:[~2024-05-10  5:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-08 10:46 [PATCH v5 00/11] wifi: rtlwifi: Add new rtl8192du driver Bitterblue Smith
2024-05-08 10:47 ` [PATCH v5 01/11] wifi: rtlwifi: Add rtl8192du/table.{c,h} Bitterblue Smith
2024-05-10  1:54   ` Ping-Ke Shih
2024-05-08 10:48 ` [PATCH v5 02/11] wifi: rtlwifi: Add new members to struct rtl_priv for RTL8192DU Bitterblue Smith
2024-05-10  2:14   ` Ping-Ke Shih
2024-05-08 10:48 ` [PATCH v5 03/11] wifi: rtlwifi: Add rtl8192du/hw.{c,h} Bitterblue Smith
2024-05-10  3:04   ` Ping-Ke Shih
2024-05-12 14:34     ` Bitterblue Smith
2024-05-13  6:29       ` Ping-Ke Shih
2024-05-08 10:49 ` [PATCH v5 04/11] wifi: rtlwifi: Add rtl8192du/phy.{c,h} Bitterblue Smith
2024-05-10  3:43   ` Ping-Ke Shih
2024-05-08 10:50 ` [PATCH v5 05/11] wifi: rtlwifi: Add rtl8192du/trx.{c,h} Bitterblue Smith
2024-05-08 10:51 ` [PATCH v5 06/11] wifi: rtlwifi: Add rtl8192du/rf.{c,h} Bitterblue Smith
2024-05-08 10:52 ` [PATCH v5 07/11] wifi: rtlwifi: Add rtl8192du/fw.{c,h} and rtl8192du/led.{c,h} Bitterblue Smith
2024-05-08 10:53 ` [PATCH v5 08/11] wifi: rtlwifi: Add rtl8192du/dm.{c,h} Bitterblue Smith
2024-05-10  3:51   ` Ping-Ke Shih
2024-05-08 10:53 ` [PATCH v5 09/11] wifi: rtlwifi: Constify rtl_hal_cfg.{ops,usb_interface_cfg} and rtl_priv.cfg Bitterblue Smith
2024-05-08 10:54 ` [PATCH v5 10/11] wifi: rtlwifi: Add rtl8192du/sw.{c,h} Bitterblue Smith
2024-05-10  5:52   ` Ping-Ke Shih [this message]
2024-05-08 10:55 ` [PATCH v5 11/11] wifi: rtlwifi: Enable the new rtl8192du driver Bitterblue Smith
2024-05-10  5:46   ` kernel test robot
2024-05-10  5:57   ` Ping-Ke Shih
2024-05-10  4:00 ` [PATCH v5 00/11] wifi: rtlwifi: Add " Stefan Lippers-Hollmann

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=8e5d163e7f234f78b23dd21b476cb23d@realtek.com \
    --to=pkshih@realtek.com \
    --cc=Larry.Finger@lwfinger.net \
    --cc=chewitt@libreelec.tv \
    --cc=linux-wireless@vger.kernel.org \
    --cc=rtl8821cerfe2@gmail.com \
    --cc=s.l-h@gmx.de \
    /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