653-0047-rtl8xxxu-Implement-rtl8188eu_active_to_emu.patch 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. From b3edeceb7c8c3b0eb70b26e3237afa5086afe8ed Mon Sep 17 00:00:00 2001
  2. From: Jes Sorensen <Jes.Sorensen@redhat.com>
  3. Date: Fri, 26 Aug 2016 15:16:32 -0400
  4. Subject: [PATCH] rtl8xxxu: Implement rtl8188eu_active_to_emu()
  5. Per the vendor driver's sequence table, this seems to be the correct
  6. way to disable RF on the 8188eu, even if the driver doesn't actually
  7. call the sequence by itself.
  8. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
  9. ---
  10. .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c | 38 ++++++++++++++++++++++
  11. 1 file changed, 38 insertions(+)
  12. --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c
  13. +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188e.c
  14. @@ -1155,6 +1155,42 @@ exit:
  15. return ret;
  16. }
  17. +static int rtl8188eu_active_to_emu(struct rtl8xxxu_priv *priv)
  18. +{
  19. + u8 val8;
  20. + int count, ret = 0;
  21. +
  22. + /* Turn off RF */
  23. + rtl8xxxu_write8(priv, REG_RF_CTRL, 0);
  24. +
  25. + /* LDO Sleep mode */
  26. + val8 = rtl8xxxu_read8(priv, REG_LPLDO_CTRL);
  27. + val8 |= BIT(4);
  28. + rtl8xxxu_write8(priv, REG_LPLDO_CTRL, val8);
  29. +
  30. + /* 0x0005[1] = 1 turn off MAC by HW state machine*/
  31. + val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1);
  32. + val8 |= BIT(1);
  33. + rtl8xxxu_write8(priv, REG_APS_FSMCO + 1, val8);
  34. +
  35. + for (count = RTL8XXXU_MAX_REG_POLL; count; count--) {
  36. + val8 = rtl8xxxu_read8(priv, REG_APS_FSMCO + 1);
  37. + if ((val8 & BIT(1)) == 0)
  38. + break;
  39. + udelay(10);
  40. + }
  41. +
  42. + if (!count) {
  43. + dev_warn(&priv->udev->dev, "%s: Disabling MAC timed out\n",
  44. + __func__);
  45. + ret = -EBUSY;
  46. + goto exit;
  47. + }
  48. +
  49. +exit:
  50. + return ret;
  51. +}
  52. +
  53. static int rtl8188eu_power_on(struct rtl8xxxu_priv *priv)
  54. {
  55. u16 val16;
  56. @@ -1202,6 +1238,8 @@ static void rtl8188e_disable_rf(struct r
  57. rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_AC, 0);
  58. if (priv->rf_paths == 2)
  59. rtl8xxxu_write_rfreg(priv, RF_B, RF6052_REG_AC, 0);
  60. +
  61. + rtl8188eu_active_to_emu(priv);
  62. }
  63. static void rtl8188e_usb_quirks(struct rtl8xxxu_priv *priv)