Commit Graph

336463 Commits

Author SHA1 Message Date
Simon Beginn
dd09367e7a Input: goodix - add upside-down quirk for Teclast X98 Pro tablet
[ Upstream commit cffdd6d904 ]

The touchscreen on the Teclast x98 Pro is also mounted upside-down in
relation to the display orientation.

Signed-off-by: Simon Beginn <linux@simonmicro.de>
Signed-off-by: Bastien Nocera <hadess@hadess.net>
Link: https://lore.kernel.org/r/20201117004253.27A5A27EFD@localhost
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Change-Id: Id643f6a3314b4808d3ec98e92107ab719a17dd7c
2022-10-27 15:09:42 +09:00
Hans de Goede
c5557f488f Input: goodix - add upside-down quirk for Teclast X89 tablet
commit df5b5e555b upstream.

The touchscreen on the Teclast X89 is mounted upside down in relation to
the display orientation (the touchscreen itself is mounted upright, but the
display is mounted upside-down). Add a quirk for this so that we send
coordinates which match the display orientation.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bastien Nocera <hadess@hadess.net>
Link: https://lore.kernel.org/r/20191202085636.6650-1-hdegoede@redhat.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Change-Id: Idab48cdbdf6791021543aa4b33d87d341c9ab0e8
2022-10-27 15:09:18 +09:00
Marcin Niestroj
f467f6e1a0 Input: goodix - use generic touchscreen_properties
Use touchscreen_properties structure instead of implementing all
properties by our own. It allows us to reuse generic code for parsing
device-tree properties (which was implemented manually in the driver for
now). Additionally, it allows us to report events using generic
touchscreen_report_pos(), which automatically handles inverted and
swapped axes.

This fixes the issue with the custom code incorrectly handling case where
ts->inverted_x and ts->swapped_x_y were true, but ts->inverted_y was
false. Assuming we have 720x1280 touch panel, ts->abs_x_max == 1279 and
ts->abs_y_max == 719 (because we inverted that in goodix_read_config()).
Now let's assume that we received event from (0:0) position (in touch
panel original coordinates). In function goodix_ts_report_touch() we
calculate input_x as 1279, but after swapping input_y takes that value
(which is more that maximum 719 value reported during initialization).

Note that since touchscreen coordinates are 0-indexed, we now report
touchscreen range as (0:size-1).

Developed and tested on custom DT-based device with gt1151 touch
panel.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
[dtor: fix endianness annotation reported by sparse, handle errors when
 initializing MT slots]
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Change-Id: I3fdd49b7357ca94111fde041c295a4a548ba109b
2022-10-27 15:08:57 +09:00
Marcin Niestroj
9875ffd457 Input: goodix - support gt1151 touchpanel
Support was added based on Goodix GitHub repo [1]. There are two major
differences between gt1151 and currently supported devices (gt9x):
 * CONFIG_DATA register has 0x8050 address instead of 0x8047,
 * config data checksum has 16-bit width instead of 8-bit.

Also update goodix_i2c_test() function, so it reads ID register (which
has the same address for all devices) instead of CONFIG_DATA (because
its address is known only after reading ID of the device).

[1] https://github.com/goodix/gt1x_driver_generic

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Change-Id: I12f2f9e745c2f14ff45b3f967fbf91e629230989
2022-10-27 15:08:32 +09:00
Paul Cercueil
9a8c3734c3 Input: goodix - poll the 'buffer status' bit before reading data
The Goodix panel triggers an interrupt on touch events. However, its
registers will contain the valid values a short time after the
interrupt, and not when it's raised. At that moment, the 'buffer status'
bit is set.

Previously, if the 'buffer status' bit was not set when the registers
were read, the data was discarded and no input event was emitted,
causing "finger down" or "finger up" events to be missed sometimes.

This went unnoticed until v4.9, as the DesignWare I2C driver commonly
used with this driver had enough latency for that bug to never trigger
until commit 2702ea7dbe ("i2c: designware: wait for disable/enable only
if necessary").

Now, in the IRQ handler we will poll (with a timeout) the 'buffer status'
bit and process the data of the panel as soon as this bit gets set.

Note that the Goodix panel will send a few spurious interrupts after the
'finger up' event, in which the 'buffer status' bit will never be set.

Cc: Bastien Nocera <hadess@hadess.net>
Cc: russianneuromancer@ya.ru
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
[hdegoede@redhat.com: Change poll loop to use jiffies,
                      add comment about typical poll time]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
[dtor: rearranged control flow a bit to avoid explicit goto and double
check]
Reviewed-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Change-Id: I3fa771b0b07cf811b157cb76e1c1deba6bf4e4ea
2022-10-27 15:08:12 +09:00
Sergei A. Trusov
b8c1122b2c Input: goodix - add support for capacitive home button
On some x86 tablets with a Goodix touchscreen, the Windows logo on the
front is a capacitive home button. Touching this button results in a touch
with bit 4 of the first byte set, while only the lower 4 bits (0-3) are
used to indicate the number of touches.

Report a KEY_LEFTMETA press when this happens.

Note that the hardware might support more than one button, in which
case the "id" byte of coor_data would identify the button in question.
This is not implemented as we don't have access to hardware with
multiple buttons.

Signed-off-by: Sergei A. Trusov <sergei.a.trusov@ya.ru>
Acked-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Change-Id: I30f0248bca9de921d25b19bf823698ab6dc3eb3f
2022-10-27 15:07:51 +09:00
Chris
6179a9c421 ODROID-N2/N2L: Fill uuid if not exists.
If uuid is empty, it will be replaced by CPU id.

Change-Id: Iae971a089bb317817574eb26119c931dbbc7856c
2022-10-12 12:42:20 +09:00
Luke Go
7cfa86f4fd ODROID: arm64/configs: Add KEYBOARD_MATRIX to C4 and N2. matrix keypad
support polling feature.

Change-Id: Ibef25334c09987e09916b951297c10c2b8e3051c
Signed-off-by: Luke Go <sangch.go@gmail.com>
2022-08-31 14:38:42 +09:00
Chris
d07dda58d2 ODROID-COMMON: Fix not to display recovery screen.
Change-Id: I3e7a341f182b793784d8870956eae1d30d46921e
2022-07-20 12:32:35 +09:00
ckkim
fa571b1da5 ODROID-COMMON:UART minimum baud rate modify(110).
Signed-off-by: ckkim <changkon12@gmail.com>
Change-Id: Iad06bdf188ac4c7c1184ffb93dccbb5bc7c334bf
2022-07-19 16:51:32 +09:00
Chris
62633eabb8 ODROID-COMMON:VU7C EDID modify. Display Product name : HK_VU7C
Change-Id: I7528b1a655ce385cc5f0fc3a55f4e4d1a08fd830
2022-03-15 09:22:36 +09:00
ckkim
4238ff4393 ODROID-COMMON:touchscreen gpio interrupt for amlogic INTC
Signed-off-by: ckkim <changkon12@gmail.com>
Change-Id: I013b0640fd9d32f641170562829d05bb9336772b
2022-03-15 09:21:20 +09:00
Chris
382003407b ODROID-COMMON:Add LT8619C HDMI to LVDS converter driver
Change-Id: I387b9ca86b0f3ec34f3da6d82ab9d57dadf8e84b
2022-03-15 09:21:07 +09:00
Chris
c92d7f2b90 ODROID-G12: Make hid-multitouch and dwav-usb-mt driver as mouldes.
Change-Id: I9b3a8973c7d0d89bcf52e22b6e690cdc14a24e6c
2022-03-15 09:20:56 +09:00
Chris
18fa0b1d2e ODROID-G12: Fix ignorecec args.
If ignorecec args is true, then skip check_confilct().

Change-Id: Ia88e4981c55b6298682d4f459db16a243363e36c
2022-03-15 09:20:25 +09:00
Chris
3ed9c6db47 ODROID-G12: Support 3840x1080 UI for C4.
Change-Id: If7f2e1482b79d05c4ba723197bc32c4ee390d67b
2021-12-27 14:49:06 +09:00
Chris
78b8383a33 ODROID-G12: Fix scale bug for special aspect ratio.
The 3840 x 1080 resolution has a problem scaling up for OSD layer.

Change-Id: I7baadd1aa34a2332952fc42260f8f3ec766a6ca6
2021-12-27 14:48:54 +09:00
Chris
72d371dcd0 Revert "ODROID-COMMON: hdmitx: Add new hdmi resolution."
This reverts commit 44a7c003fa.

Change-Id: I01d01cc0090005fdea4d4097320ee720e5347210
2021-12-27 14:48:32 +09:00
Chris
217c36a9c3 ODROID-G12: Add ignorecec bootargs.
Some monitors with CEC takes too long time to check conflict.
If igonrecec is added in bootargs, we will skip to check confilct.

Change-Id: If6c77421d77e2beffe5c3c9bec62ab239f8b8995
(cherry picked from commit 971287c681)
2021-12-01 10:51:59 +09:00
Chris
44a7c003fa ODROID-COMMON: hdmitx: Add new hdmi resolution.
3840x1080p50hz

Change-Id: I1f1deb6d2e6a45000284f7d5b150deeeb74d11fb
2021-09-29 12:27:00 +09:00
Chris
21e4b47954 ODROID: Add multitouch v/pid.
/* NEXTWINDOW HDMI capacitive Screen */
 #define USB_VENDOR_ID_NEXTWINDOW   0x1926
 #define USB_DEVICE_ID_NEXTWINDOW_TOUCHSCREEN_0006   0x0006

Change-Id: I8ca1eafb4cddaa80d622816409a9e5208ce89903
2021-09-24 15:26:15 +09:00
Chris
fae99d2f59 ODROID: Add multitouch v/pid.
/* UPERFECT HDMI capacitive Screen */
 #define USB_VENDOR_ID_UPERFECT^I^I0x27c0
 #define USB_DEVICE_ID_UPERFECT^I^I0x0818

Change-Id: I9f0d004c2d88fb02e04e9d3f1a50ae7e94190319
2021-09-24 15:23:59 +09:00
Chris KIM
143d91bc4b ODROID: Add multitouch v/pid.
/* DELL HDMI capacitive Screen */
 #define USB_VENDOR_ID_DELL_P2418HT 0x1fd2
 #define USB_DEVICE_ID_DELL_P2418HT 0x6103

Change-Id: If441a2046dd7d6e452c28a8ddf05c95530e2f6bd
2021-09-24 15:23:49 +09:00
Chris
ac8a064ec1 ODROID-G12: Fix otg_host_mode overlay.
The current kernel does not suppport for delete-property
in overlay dts.

Change-Id: I027dd5d0eca17c9084f1a0326290944fe82ab982
2021-06-30 14:03:45 +09:00
Chris
ecd0d93467 Revert "ODROID-G12: Fix gpio-vbus-power bug."
This reverts commit 1b9dab97c0.

Change-Id: I2b325897b9ba93a49cb3ba73798cb9ef48f6052d
2021-06-25 17:28:07 +09:00
Chris
1b9dab97c0 ODROID-G12: Fix gpio-vbus-power bug.
Change-Id: I234cb5c31a9be9a79f3513b3b50deb2c11698e11
2021-06-25 14:16:14 +09:00
Chris
f9093b6f93 Revert "osd/fb: set default color format for Linux"
This reverts commit b8cff4bf53.

Change-Id: I941554d28f332b45ebf4a093f1712b634e354845
2021-03-29 11:31:46 +09:00
Deokgyu Yang
fd8bd7cd8c ODROID-COMMON: drivers/spi: Revert force64b flag back
To avoid unnecessary 64 bit calculation, which is for DMA, data
swapping is needed to be an option.

Signed-off-by: Deokgyu Yang <secugyu@gmail.com>
Change-Id: Ie186a332984246bfb83b128b5771197457f4dd21
2021-02-18 17:47:15 +09:00
Luke go
8b52571540 Revert "Revert "ODROID-COMMON: drivers/spi: Set the 64 bits per word by default""
This reverts commit 4389a90ae4.

Change-Id: I7f750bd403e75bb7bf871bca01b4bcfcd0389757
2021-02-18 17:47:15 +09:00
Chris
caafaa6c92 ODROID: Make sure to use CRS B/T module than RealTek combo.
If system have a Realtek combo(8821CU) and a CSR BT module at time,
system make sure to use a CSR B/T module.

Bus 001 Device 003: ID 0a12:0001 <- CSR B/T
Bus 001 Device 006: ID 0bda:c820 <- RealTek combo B/T

Change-Id: I082d3966a88cef6dec03cbe07458c07e6ff77cf3
2021-01-28 10:50:29 +09:00
Joy Cho
c796bc6aef ODROID-COMMON: osd: Adjust vertical osd scaler setting
Change-Id: I4d04daf48321b28a30a561ef30a87cdba2fbc7cc
2021-01-21 12:57:51 +09:00
Luke go
9ac7382ab2 Revert "ODROID-COMMON: drivers/spi: Set the 64 bits per word by default"
This reverts commit 1cff1ec2e4.

Change-Id: I59f92b783a89be3d9fca5663a929b30ccfa33972
2021-01-21 12:57:22 +09:00
Luke go
6a011a09ab ODROID-COMMON: Support MPT partition from block device.
- Before this patch, Only mmc device (eMMC/SD) can use MPT (Multimedia
  Partition Table). So th other devices like ssd, hdd and usb storage
  can't be main storage of the android. To solve this problem, Applied
  new partition support method - mpt partitions.

- It works subset of the msdos partition.

Change-Id: I2a192bf27e75dc040ccc3ea93a79d35c93db8543
2020-12-18 12:49:38 +09:00
Max Chou
2ada78da24 Bluetooth: btrtl: Fix an issue that failing to download the FW which size is over 32K bytes
Fix the issue that when the FW size is 32K+, it will fail for the download
process because of the incorrect index.

When firmware patch length is over 32K, "dl_cmd->index" may >= 0x80. It
will be thought as "data end" that download process will not complete.
However, driver should recount the index from 1.

Signed-off-by: Max Chou <max.chou@realtek.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: Ic2ea247c2df828df28f535efb61ddf1c5d379367
2020-12-18 12:47:54 +09:00
Alex Lu
6492c1552a Bluetooth: btrtl: Remove trailing newline from calls to rtl_dev macros
These printing macros already add a trailing newline, so drop these
unnecessary additional newlines.

Signed-off-by: Alex Lu <alex_lu@realsil.com.cn>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: I54df8f119c1927971e4382eaa381981264b68f6a
2020-12-18 12:47:49 +09:00
Alex Lu
eb921e52b3 Bluetooth: btrtl: Remove redundant prefix from calls to rtl_dev macros
the rtl: or RTL: prefix in the string is pointless. The rtl_dev_* macros
already does that.

Signed-off-by: Alex Lu <alex_lu@realsil.com.cn>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: I4d9b975b0f914f08bf556282a3a0140b71225283
2020-12-18 12:47:44 +09:00
Alex Lu
6d2b77d36d Bluetooth: btrtl: Add firmware version print
This patch is used to print fw version for debug convenience

Signed-off-by: Alex Lu <alex_lu@realsil.com.cn>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: I47c36597134eb6e1cea3f984951de2e76b52a267
2020-12-18 12:47:21 +09:00
Alex Lu
3f83b98e59 Bluetooth: btrtl: Set HCI_QUIRK_SIMULTANEOUS_DISCOVERY
Realtek Bluetooth controllers can do both LE scan and BR/EDR inquiry
at once, need to set HCI_QUIRK_SIMULTANEOUS_DISCOVERY quirk.

Signed-off-by: Alex Lu <alex_lu@realsil.com.cn>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: If809ec66e8aebe7ba8e675606f5d6202b981f54e
2020-12-18 12:47:17 +09:00
Larry Finger
62c228751e Bluetooth:: btrtl: Add support for RTL8723DU
This device is functionally equivalent to the BT part of the RTL8723DE,
uses the same firmware, but the LMP subversion and HCI revision are unique.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Change-Id: I2c4d3cedb5216064d8edc05eb77f240256da3228
2020-12-18 12:47:11 +09:00
Jian-Hong Pan
e35ceef8eb 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-12-18 12:47:06 +09:00
Kai-Heng Feng
6269494db7 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-12-18 12:47:01 +09:00
Alex Lu
dec993200c 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-12-18 12:46:56 +09:00
Colin Ian King
663e9c89ae 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-12-18 12:46:51 +09:00
Hans de Goede
ed031fa7e9 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-12-18 12:46:46 +09:00
Martin Blumenstingl
4652422b70 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-12-18 12:46:41 +09:00
Martin Blumenstingl
1a638d39b1 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-12-18 12:46:35 +09:00
Hans de Goede
45067b67e4 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-12-18 12:46:30 +09:00
Martin Blumenstingl
6db7853ee0 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-12-18 12:46:25 +09:00
Martin Blumenstingl
ec9262d7e2 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-12-18 12:46:20 +09:00
Alex Lu
afdd670f69 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-12-18 12:46:13 +09:00