Commit Graph

649812 Commits

Author SHA1 Message Date
Chris
2a263e59db Merge "Bluetooth: btrtl: HCI reset on close for Realtek BT chip" into odroidg12-4.9.y-android 2020-11-09 16:18:09 +09:00
Chris
9676daf339 Merge "Bluetooth: btrtl: Restore old logic to assume firmware is already loaded" into odroidg12-4.9.y-android 2020-11-09 16:18:00 +09:00
Chris
d1797cb808 Merge "Bluetooth: btrtl: Add support for RTL8822C with USB interface" into odroidg12-4.9.y-android 2020-11-09 16:17:52 +09:00
Chris
bc30475f2b Merge "Bluetooth: btrtl: Make array extension_sig static, shrinks object size" into odroidg12-4.9.y-android 2020-11-09 16:17:45 +09:00
Chris
c9b7d89405 Merge "Bluetooth: btrtl: Add support for a config filename postfix" into odroidg12-4.9.y-android 2020-11-09 16:17:37 +09:00
Chris
4fcd45ebaf Merge "Bluetooth: btrtl: add support for the RTL8723BS and RTL8723DS chips" into odroidg12-4.9.y-android 2020-11-09 16:17:30 +09:00
Chris
5f6b2db435 Merge "Bluetooth: btrtl: add support for retrieving the UART settings" into odroidg12-4.9.y-android 2020-11-09 16:17:23 +09:00
Chris
9ffc94b44b Merge "Bluetooth: btrtl: Use rtl_dev_err and rtl_dev_info" into odroidg12-4.9.y-android 2020-11-09 16:17:03 +09:00
Chris
5ccd5b3715 Merge "Bluetooth: btrtl: split the device initialization into smaller parts" into odroidg12-4.9.y-android 2020-11-09 16:16:55 +09:00
Chris
5cf810c0f2 Merge "Bluetooth: btrtl: add MODULE_FIRMWARE declarations" into odroidg12-4.9.y-android 2020-11-09 16:16:48 +09:00
Chris
545c8ee16d Merge "Bluetooth: btrtl: Add RTL8723D and RTL8821C devices" into odroidg12-4.9.y-android 2020-11-09 16:16:41 +09:00
Chris
f5d2110753 Merge "Bluetooth: Use bt_dev_err and bt_dev_info when possible" into odroidg12-4.9.y-android 2020-11-09 16:16:33 +09:00
Chris
51f2f8037d Merge "Bluetooth: btrtl: Fix a error code in rtl_load_config()" into odroidg12-4.9.y-android 2020-11-09 16:16:25 +09:00
Chris
bbcbe19935 Merge "Bluetooth: btrtl: Change message for missing config file" into odroidg12-4.9.y-android 2020-11-09 16:16:17 +09:00
Jian-Hong Pan
2157072ee3 Bluetooth: btrtl: HCI reset on close for Realtek BT chip
Realtek RTL8822BE BT chip on ASUS X420FA cannot be turned on correctly
after on-off several times. Bluetooth daemon sets BT mode failed when
this issue happens. Scanning must be active while turning off for this
bug to be hit.

bluetoothd[1576]: Failed to set mode: Failed (0x03)

If BT is turned off, then turned on again, it works correctly again.

According to the vendor driver, the HCI_QUIRK_RESET_ON_CLOSE flag is set
during probing. So, this patch makes Realtek's BT reset on close to fix
this issue.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=203429
Signed-off-by: Jian-Hong Pan <jian-hong@endlessm.com>
Reviewed-by: Daniel Drake <drake@endlessm.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: I764d6c28e43fcbc7eb1a8f3586633be7920155b8
2020-11-06 17:17:24 +09:00
Kai-Heng Feng
7125a35762 Bluetooth: btrtl: Restore old logic to assume firmware is already loaded
Realtek bluetooth may not work after reboot:
[   12.446130] Bluetooth: hci0: RTL: rtl: unknown IC info, lmp subver a99e, hci rev 826c, hci ver 0008

This is a regression introduced by commit 26503ad25d ("Bluetooth:
btrtl: split the device initialization into smaller parts"). The new
logic errors out early when no matching IC info can be found, in this
case it means the firmware is already loaded.

So let's assume the firmware is already loaded when we can't find
matching IC info, like the old logic did.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=201921
Fixes: 26503ad25d ("Bluetooth: btrtl: split the device initialization into smaller parts")
Cc: stable@vger.kernel.org # 4.19+
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: Iaecc33c211041dff616fac485ef9af4e80263b38
2020-11-06 17:17:23 +09:00
Alex Lu
4469f0117c Bluetooth: btrtl: Add support for RTL8822C with USB interface
This device is included in the RTL8822CU combination wifi and BT part,
as well as the BT part of the RTL8822CE.
The necessary firmware has been submitted to the linux-firmware
project.

Signed-off-by: Alex Lu <alex_lu@realsil.com.cn>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: Ic42028110646bb55c604d3e6042a43b34ccf5501
2020-11-06 17:17:22 +09:00
Colin Ian King
29a987c1cd Bluetooth: btrtl: Make array extension_sig static, shrinks object size
Don't populate the array extension_sig on the stack but instead make it
static. Makes the object code smaller by 75 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  14325	   4920	      0	  19245	   4b2d	drivers/bluetooth/btrtl.o

After:
   text	   data	    bss	    dec	    hex	filename
  14186	   4984	      0	  19170	   4ae2	drivers/bluetooth/btrtl.o

(gcc version 8.2.0 x86_64)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: I4f8c2f2e1fc242110a322fe9618dce95f7280711
2020-11-06 17:17:21 +09:00
Hans de Goede
5c43fce888 Bluetooth: btrtl: Add support for a config filename postfix
The contents of the rtl_bt/rtlXXXX_config.bin file may be board specific
allow the caller of btrtl_initialize to specify a postfix identifying
the board, which if specified will make btrtl_initialize look for
rtl_bt/rtlXXXX_config-<postfix>.bin instead.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: I841a33115606d66f539266ff8b3be3ab24f3c744
2020-11-06 17:17:20 +09:00
Martin Blumenstingl
bf4c262868 Bluetooth: btrtl: add support for the RTL8723BS and RTL8723DS chips
The Realtek RTL8723BS and RTL8723DS chipsets are SDIO wifi chips. They
also contain a Bluetooth module which is connected via UART to the host.

Realtek's userspace initialization tool (rtk_hciattach) differentiates
these two via the HCI version and revision returned by the
HCI_OP_READ_LOCAL_VERSION command.
Additionally we apply these checks only the for UART devices. Everything
else is assumed to be a "RTL8723B" which was originally supported by the
driver (communicating via USB).

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jeremy Cline <jeremy@jcline.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: I80200b7f62924e91a8e757418f6ccfde81877565
2020-11-06 17:17:19 +09:00
Martin Blumenstingl
e9bca80c94 Bluetooth: btrtl: add support for retrieving the UART settings
The UART settings are embedded in the config blob. This has to be parsed
to successfully initialize the Bluetooth part of the RTL8723BS (which is
an SDIO chip, but the Bluetooth part is connected via UART).

The Realtek "rtl8723bs_bt" and "rtl8723ds_bt" userspace Bluetooth UART
initialization tools (rtk_hciattach) use the following sequence:
- send H5 sync pattern (already supported by hci_h5)
- get LMP version (already supported by btrtl)
- get ROM version (already supported by btrtl)
- load the firmware and config for the current chipset (already
  supported by btrtl)
- read UART settings from the config blob (part of this patch)
- send UART settings via a vendor command to the device (which changes
  the baudrate of the device and enables or disables flow control
  depending on the config)
- change the baudrate and flow control settings on the host
- send the firmware and config blob to the device (already supported by
  btrtl)

Sending the last firmware and config blob download command
(rtl_download_cmd) fails if the UART settings are not updated
beforehand. This is presumably because the device applies the config
right after the firmware and config blob download - which means that at
this point the host is using different UART settings than the device
(which will obviously result in non-working communication).

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jeremy Cline <jeremy@jcline.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: I95b475b88aca0d4aa62a7bf482479236d803890c
2020-11-06 17:17:18 +09:00
Hans de Goede
4ab0e18488 Bluetooth: btrtl: Use rtl_dev_err and rtl_dev_info
Consistently use rtl_dev_err and rtl_dev_info everywhere for messages.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: I4a41cf52f92b11a33b60834324efcdceb74c48b2
2020-11-06 17:17:17 +09:00
Martin Blumenstingl
9dd53ee7a3 Bluetooth: btrtl: split the device initialization into smaller parts
This prepares the btrtl code so it can be used to initialize Bluetooth
modules connected via UART (these are found for example on the RTL8723BS
and RTL8723DS SDIO chips, which come with an embedded UART Bluetooth
module).

The Realtek "rtl8723bs_bt" and "rtl8723ds_bt" userspace Bluetooth UART
initialization tools (rtk_hciattach) use the following sequence:
1) send H5 sync pattern (already supported by hci_h5)
2) get LMP version (already supported by btrtl)
3) get ROM version (already supported by btrtl)
4) load the firmware and config for the current chipset (already
   supported by btrtl)
5) read UART settings from the config blob (currently not supported)
6) send UART settings via a vendor command to the device (which changes
   the baudrate of the device and enables or disables flow control
   depending on the config)
7) change the baudrate and flow control settings on the host
8) send the firmware and config blob to the device (already supported by
   btrtl)

The main reason why the initialization has to be split is step #7. This
requires changes to the underlying "bus", which should be kept outside
of the "generic" btrtl driver.
The idea for this split is borrowed from the btbcm driver but adjusted
where needed (the btrtl driver for example needs two blobs: firmware and
config, while the btbcm only needs one).

This also prepares the code for step #5 (parsing the config blob) by
centralizing the code which loads the firmware and config blobs and
storing the result in the new struct btrtl_device_info.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jeremy Cline <jeremy@jcline.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: Icc40dd820b448be0a4b3933777e02d09b9d38acf
2020-11-06 17:17:16 +09:00
Martin Blumenstingl
32c553803e Bluetooth: btrtl: add MODULE_FIRMWARE declarations
This makes the firmware names show up in modinfo.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Jeremy Cline <jeremy@jcline.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: Ib331d5de3a10f21d30ee21a8b008f78fb574c5af
2020-11-06 17:17:15 +09:00
Alex Lu
96f88fe6fa Bluetooth: btrtl: Add RTL8723D and RTL8821C devices
The Bluetooth parts of RTL8723D and RTL8723B share the same lmp
subversion, thus we need to check both lmp subversion and hci revision
to distinguish the two. The same situation is true for RTL8821A and
RTL8821C. Accordingly, the selection code is revised.

To improve maintainability, a new id_table struct is defined, and an
array of such structs is constructed. Adding a new device can thus be
as simple as adding another value to the table.

Signed-off-by: Alex Lu <alex_lu@realsil.com.cn>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: Ic98eb91ac87a671d7fc3d2a611545e36c3c8cf69
2020-11-06 17:17:13 +09:00
Marcel Holtmann
8d5aae67aa Bluetooth: Use bt_dev_err and bt_dev_info when possible
In case of using BT_ERR and BT_INFO, convert to bt_dev_err and
bt_dev_info when possible. This allows for controller specific
reporting.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Change-Id: I3cd472bf3ce8e797b112c36227884ee2d80b6394
2020-11-06 17:17:12 +09:00
Dan Carpenter
399d79105a Bluetooth: btrtl: Fix a error code in rtl_load_config()
We accidentally return success if the kmemdup() fails.  It results in
a NULL dereference in the caller.

Fixes: 1110a2dbe6 ("Bluetooth: btrtl: Add RTL8822BE Bluetooth device")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Change-Id: Idd4ff62726885f4aafb3aae69c7cddb12c08442b
2020-11-06 17:17:10 +09:00
Larry Finger
f4c3bb35f2 Bluetooth: btrtl: Change message for missing config file
The message concerning missing config files for 8723b, 8821a, and
8761a should have been issued with BT_INFO() rather than BT_ERR() as
this condition is not fatal. After looking at that code, I have
reworked the logic to log such messages only if the device needs such a
config file. At the moment, only the 8822b fits that description.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Acked-by: 陆朱伟 <alex_lu@realsil.com.cn>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: I8449be0c4487c8e7af034753cddcc795205ff503
2020-11-06 17:17:07 +09:00
Deokgyu Yang
1cff1ec2e4 ODROID-COMMON: drivers/spi: Set the 64 bits per word by default
The existing force64b routine might not work properly under specific
conditions. This patch fixes that bug of 64 bits per word and forces
use that option. It will improve SPI performance significantly.

Signed-off-by: Deokgyu Yang <secugyu@gmail.com>
Change-Id: I85a58d425303ea1765b7b83ee5dd5f0a7f4203fc
g12_9.0.0_64_20201105
2020-10-30 16:37:12 +09:00
Luke go
0a4bcb083d ODROID-HC4: arm64/dts: overlay: Add hc4 fan full speed dtbo.
Signed-off-by: Luke go <sangch.go@gmail.com>
Change-Id: Id95c2cb9cc72c315634140a40b78ec3fe9195243
2020-10-22 09:55:08 +09:00
Luke go
5862fdd553 ODROID-HC4: arm64/dts: Set pwm_d pinmux.
Change-Id: Idcea9acdcdec08e37ba11b4bcdd100c3c558ec8f
Signed-off-by: Luke go <sangch.go@gmail.com>
2020-10-22 09:42:25 +09:00
Chris
d1db62bb2c ODROID-C4/HC4: defconfig: Unify defconfig.
using same defconfig about c4 and hc4.

Change-Id: Ied4835ace604cb022c0ff013052989ba2a88ce6b
2020-10-21 13:39:31 +09:00
Chris
fbca2e402a ODROID-HC4: Enable sd_emmc_c.
We need to disable emmc, because hc4 doesn't have emmc.

Change-Id: I99d21f75268e0d55f77a868d599f679be68aa3d9
2020-10-21 09:02:54 +09:00
Chris
52c59739ed ODROID: Move esp8089 driver to hardware directory.
Change-Id: I7f86eeadd23c83461f104a6870513deae5755f65
2020-10-19 14:33:07 +09:00
Dongjin Kim
54de9c6044 ODROID-HC4: arch/arm64: Introduce new board 'ODROID-HC4'
Change-Id: Id020eb76109f1a7a3cabf50489cf1a0d5447b010
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
2020-10-15 16:10:42 +09:00
Luke go
9497a147c8 ODROID-C4: wireless: esp8089: Support esp8089 driver.
- The esp8089 driver supports many esp's wifi modules. So it is imported.

Change-Id: If039882e183e454baff2c222bf7a1282b6705459
g12_9.0.0_64_20201015
2020-10-13 11:48:21 +09:00
Chris
778a68015b ODROID-COMMON: Fix watchdog reset disabled.
Change-Id: I214eb2ada20c7a885f82a3a198ffc65a4a1a9d19
2020-10-06 17:39:26 +09:00
Joy Cho
579650fd7c ODROID-COMMON: hdmitx: Fix unstable HDMI modes
Change-Id: Ibac9840a0a97d195918592059b62f6024b4047be
g12_9.0.0_64_20200924
2020-09-21 14:13:44 +09:00
Joy Cho
62f248084b ODROID-COMMON: hdmitx: Add new hdmi resolutions of 2560x* and 3440x1440
In case of 2560x1600@60hz, unstable display operation may occur
with some specific monitors those pixel clock is under 300MHz.
So, default timing for 2560x1600p60hz is set as following.

Detailed mode: Clock 268.500 MHz, 641 mm x 401 mm
               2560 2608 2640 2720 ( 48  32  80)
               1600 1602 1608 1646 (  2   6  38)
               +hsync -vsync
               VertFreq: 59.972 Hz, HorFreq: 98.713 kHz

Change-Id: Iec9df8713211cf5e0dc7ba09f3dba2948e479b4f
2020-09-21 14:13:39 +09:00
Luke go
fda5d9b946 ODROID-C4: arm64/dts: Bugfix.
Change-Id: I5be14718672c3a3a3a71f019a7cfd7c40d6ef000
g12_9.0.0_64_20200903
2020-09-03 16:47:12 +09:00
Luke go
5db707165b ODROID-COMMON: arm64/dts: overlay: Seperated gpio shortcut.
Change-Id: I3296aa20f364c1f1b3ff8148fc93c99db798bb8d
2020-09-03 16:20:16 +09:00
Luke go
760bf40bf6 ODROID-COMMON: arm64/dts: overlay: Add sdio.
Change-Id: I53d595a0f0a31ef603c9758be83984b13073199c
2020-09-03 16:20:07 +09:00
Luke go
55b00ac401 ODROID-COMMON: arm64/dts: Disabled sdio.
Change-Id: I0ed353e5275bc71a667313e036d0a77c7d1e4875
2020-09-03 16:19:23 +09:00
Chris
eb11395e89 ODROID-G12: Add CONFIG_KEYBOARD_GPIO_POLLED as builtin
Change-Id: Ia3e4ae0df655cfb593b722702434642ac4ca7113
2020-09-03 14:30:22 +09:00
Luke go
ea3b5e6a3c ODROID-COMMON: arm64/dts: Changed the default gpio-key mapping.
- To avoid conflicts with the default gpio-power key pin and the SPI
  pin, default shortcut pin maps are changed.

Change-Id: If857eafc1e9df101357203ad61ea6ea81b11b571
2020-09-03 12:07:33 +09:00
Luke go
bc2627dfa9 ODROID-C4: arm64/dts: overlay: Add wifi/bt combo.
- To support ap6255, we made wifi/bt combo support board. To use it with
  a ODROID-C4, You need chagne R45 to 10k register. Or please change a
  'gpio_reset' to other pins.

Signed-off-by: Luke go <sangch.go@gmail.com>
Change-Id: I208c11251e3b36bdf27d1505e5bb25a1f4a059c4
2020-09-03 08:50:03 +09:00
Chris
16350c181b ODROID-G12: fix not working for gpiopower.
Change-Id: I4870c80ffabc5fb7c018bc192f4ce32fc25c28d6
2020-09-02 09:36:05 +09:00
Luke Go
8c43fbdc1e ODROID-N2: arm64/dts: overlay: Add a gpio-spdifout.
- Add gpio's spdifout overlays. It support GPIOA 13 -PIN7 spdifout.

Change-Id: I95b99af5e531cba53748c0d82ff112d39ca8bbee
g12_9.0.0_64_20200827
2020-08-27 08:35:04 +09:00
Luke go
b9d4636f92 ODROID-COMMON: arm64/dts: overlay: Add pwm examples.
- N2
  - pwm_c(33) - pwm fan.
  - pwm_d(35) - pwm backlight.

- C4
  - pwm_a(33) - pwm fan.
  - pwm_b(35) - pwm backlight.

Change-Id: If5382b0f5fa515d74d547b1cb20107be5ad813bd
2020-08-27 08:33:22 +09:00
Luke go
b352de9657 ODROID-COMMON: arm64/dts: pwm: Adjust pwm pins and apply overlay.
- The PWM pins are not fit to a ODROID_C4 manual list of extension pins. To fit
  the list, a pwm_ab is added. And pwm_cd's pwm_d pin is moved.

- The Device tree Overlay feature is applied to the PWM.

Change-Id: I77b5b5691ab9f71740edfd5fe3d3bdc430fdaca3
2020-08-27 08:33:14 +09:00