Commit Graph

1075788 Commits

Author SHA1 Message Date
Hamish Martin
08195db45c ODROID-C5: HID: mcp2221: Set driver data before I2C adapter add
[ Upstream commit f2d4a5834638bbc967371b9168c0b481519f7c5e ]

The process of adding an I2C adapter can invoke I2C accesses on that new
adapter (see i2c_detect()).

Ensure we have set the adapter's driver data to avoid null pointer
dereferences in the xfer functions during the adapter add.

This has been noted in the past and the same fix proposed but not
completed. See:
https://lore.kernel.org/lkml/ef597e73-ed71-168e-52af-0d19b03734ac@vigem.de/

Signed-off-by: Hamish Martin <hamish.martin@alliedtelesis.co.nz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Change-Id: I5a72d1c59d884748f73a434a02d314963c77568b
2025-11-07 15:23:55 +09:00
Louis Morhet
659d4abcac ODROID-C5: HID: mcp2221: fix get and get_direction for gpio
The mcp2221_raw_event retrieves the value and direction of gpio on the
same command, by setting the value on mcp->status and the direction on
mcp->gpio_dir; and the offset at which they are read is based on
mcp->gp_idx, set by the gpiochip callbacks.

However, the individual gpiochip calls set the index to look for
directly on the field they want to track. This create a "double offset"
in the final read in the response report.

Align the behaviour of mcp2221_raw_event and
mcp_gpio_get/mcp_gpio_get_direction by putting gp_idx on those calls to
the base offset of the gpio status struct.

Signed-off-by: Louis Morhet <lmorhet@kalrayinc.com>
Link: https://lore.kernel.org/r/dd0b23800a79d2a464e1e9ed429b018b69fd5df2.1680602387.git.lmorhet@kalrayinc.com
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Change-Id: I47c3d3d3c0ad7b7072614fefa9e804d417be8bba
2025-11-07 15:23:54 +09:00
Louis Morhet
682759c18b ODROID-C5: HID: mcp2221: fix report layout for gpio get
The documentation of the component (section 3.1.12 GET GPIO VALUES)
describes the hid report structure with two fields per gpio:
its value, followed by its direction.

However, the driver describes it with a wrong order:
direction followed by value.

Fix the structure representing the report answered by the chip to the
GET GPIO VALUES command.

Fixes commit 567b8e9fed ("HID: mcp2221: Fix GPIO output handling")

Signed-off-by: Louis Morhet <lmorhet@kalrayinc.com>
Link: https://lore.kernel.org/r/945967fbab56d53f9630ad3844b64734f8c3107e.1680602387.git.lmorhet@kalrayinc.com
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Change-Id: I21d45bb9d4a4957c37b5e27cf67d3c8045f9b035
2025-11-07 15:23:54 +09:00
Benjamin Tissoires
ecf041d477 ODROID-C5: HID: mcp-2221: prevent UAF in delayed work
If the device is plugged/unplugged without giving time for mcp_init_work()
to complete, we might kick in the devm free code path and thus have
unavailable struct mcp_2221 while in delayed work.

Canceling the delayed_work item is enough to solve the issue, because
cancel_delayed_work_sync will prevent the work item to requeue itself.

Fixes: 960f9df7c6 ("HID: mcp2221: add ADC/DAC support via iio subsystem")
CC: stable@vger.kernel.org
Acked-by: Jiri Kosina <jkosina@suse.cz>
Link: https://lore.kernel.org/r/20230215-wip-mcp2221-v2-1-109f71fd036e@redhat.com
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Change-Id: I35ca79b8a7b96dc72c702af8ea79d4c5ca92935f
2025-11-07 15:23:54 +09:00
Matt Ranostay
123824ab78 ODROID-C5: HID: mcp2221: correct undefined references when CONFIG_GPIOLIB isn't defined
Singular #ifdef IS_REACHABLE(CONFIG_GPIOLIB) weren't covering all the
gpiolib functions that were being referenced.

Update the code regions that are commented out when CONFIG_GPIOLIB isn't
enabled to avoid errors.

Fixes: 960f9df7c6 ("HID: mcp2221: add ADC/DAC support via iio subsystem")
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Change-Id: I0b786ac507f9eff0dd589d4a547ce3f1ff425b78
2025-11-07 15:23:54 +09:00
Matt Ranostay
e5a4077e30 ODROID-C5: HID: mcp2221: fix 'cast to restricted __le16' sparse warnings
Use (__force __le16) cast for adc_values le16_to_cpu conversion to correct following sparse
warnings:

drivers/hid/hid-mcp2221.c:950:32: sparse: sparse: cast to restricted __le16

Reported-by: kernel test robot <lkp@intel.com>
Fixes: 960f9df7c6 ("HID: mcp2221: add ADC/DAC support via iio subsystem")
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Change-Id: If0a7a009669f6458c45089483179238525114e48
2025-11-07 15:23:54 +09:00
Jiri Kosina
ca3e7e7558 ODROID-C5: HID: mcp2221: fix usage of tmp variable in mcp2221_raw_event()
In mcp2221_raw_event(), 'tmp' is used only conditionally. Move
the declaration into the conditional block in order to prevent
unused variable warning.

Reported-by: kernel test robot <lkp@intel.com>
Fixes: 960f9df7c6 ("HID: mcp2221: add ADC/DAC support via iio subsystem")
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Change-Id: Icb349aaa2fdcfc48d975be4124532f53f894768a
2025-11-07 15:23:54 +09:00
Matt Ranostay
6b655bddcb ODROID-C5: HID: mcp2221: add ADC/DAC support via iio subsystem
Add support for 3x 10-bit ADC and 1x DAC channels registered via the iio
subsystem.

To prevent breakage and unexpected dependencies this support only is
only built if CONFIG_IIO is enabled, and is only weakly referenced by
'imply IIO' within the respective Kconfig.

Additionally the iio device only gets registered if at least one channel
is enabled in the power-on configuration read from SRAM.

Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Change-Id: I898368e779dcced15b12d43f88a38f71a31be80f
2025-11-07 15:23:54 +09:00
Matt Ranostay
3e77bf1bb4 ODROID-C5: HID: mcp2221: change 'select GPIOLIB' to imply
To avoid recursive dependencies on GPIOLIB when 'imply IIO' is requested
with other drivers we should switch GPIOLIB to an imply.

This isn't the most ideal solution but avoids modifiying the Kconfig for
other drivers, and only requires a singular IS_REACHABLE(CONFIG_GPIOLIB)
check.

Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Change-Id: Ie379ae18bd2aae09b576238298715055ca616f0d
2025-11-07 15:23:54 +09:00
Matt Ranostay
2c29ab470e ODROID-C5: HID: mcp2221: switch i2c registration to devm functions
Switch from i2c_add_adapter() to resource managed devm_i2c_add_adapter()
for matching rest of driver initialization, and more concise code.

Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Change-Id: I642fcb5af3894a2010b4a8f2f06098abaecf6812
2025-11-07 15:23:54 +09:00
88723f1495 ODROID-C5: config: add default i2c-dev
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: I5bbe12424592dcdffff9092e2c5b7ed6ce796bde
2025-11-07 15:23:54 +09:00
Dongjin Kim
bbb7da1084 ODROID-C5: config: add default LED triggers
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: I33f0ad8b7c9a23b3c4efe0d1d58f48402164dcb7
2025-11-07 15:23:54 +09:00
28b170a078 ODROID-C5: config: enable touch driver for ODROID-Vu5/Vu7Plus
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: Icff420cbcaf2fb993ef716eb0eb606ba418f51ea
2025-11-07 15:23:54 +09:00
b3c8d985ec ODROID-C5: input/touchscreen: Add Vu5/Vu7+ multitouch driver
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: I8f1ea4a68ba4e640b7848144ef419ade552281a4
2025-11-07 15:23:54 +09:00
2c064648cf ODROID-C5: config: add module pcf8563 i2c-rtc support
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: I1a17b51d6b85393e5042e59b433529159d889248
2025-11-07 15:23:54 +09:00
415c550a0b ODROID-C5: config: enable config for mcp2221, USB to I2C
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: I3f3ba500a4e98fdadc83069664b33b60e4933fcf
2025-11-07 15:23:54 +09:00
43417bee1b ODROID-C5: config: enable config USB to TTL driver
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: I693146d95a97a585675a19c1c54a25b47d51b002
2025-11-07 15:23:54 +09:00
Dongjin Kim
51489846fb ODROID-C5: config: select default kernel config
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: Id841b74717e5d65a48daed97b1ec4949d74d0cd3
2025-11-07 15:23:54 +09:00
52dd423f93 ODROID-C5: config: Enable sysfs gpio
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: I4940abe2202b92deee1882ec3a85b0bbfd886378
2025-11-07 15:23:54 +09:00
9ff55ae630 ODROID-C5: config: change config CONFIG_AMLOGIC_INPUT builtin
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: If272e0dd3861b8ca5c8f84704f26df0b70b1e6a9
2025-11-07 15:23:54 +09:00
Dongjin Kim
f719008d69 ODROID-C5: config: fixup on top of BSP 202501
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: I52729ec5f9b7035d900b5a2e076dbb6aceff009b
2025-11-07 15:23:54 +09:00
dffb0514f4 ODROID-C5: touchscreen: Add support ads7846
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: I2215059bd9a9daad3f3218d95b47379db1b7b06f
2025-11-07 15:23:54 +09:00
2b1be17707 ODROID-C5: tft: Add Hardkernel 3.2inch TFT LCD
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: If48bd4bda5b5281717accdb9d65faa9ca472758f
2025-11-07 15:23:54 +09:00
0c6659bf36 ODROID-C5: touchscreen: ads7846: Add spi device ids
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: I9a9488d02003ae82b3457848072829a60d465278
2025-11-07 15:23:53 +09:00
Dongjin Kim
ec7d253f98 ODROID-C5: config: improve to support multimedia features
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: I7f39b300787f99fa13f245485626551ebd29b55e
2025-11-07 15:23:53 +09:00
Dongjin Kim
df868bf550 ODROID-C5: config: convert driver module to static driver
SoC level driver bugs to manage kernel binaries as well as import them
to initramfs to make them load very early, this could cause boot failure
when one fails to update initramfs. So such driver must be in kernel
blob itself, not to miss.

Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: Iea67d3fa3a97146db47cae25b2a7d5eb5b938f5c
2025-11-07 15:23:53 +09:00
Dongjin Kim
e48a2a70ec ODROID-C5: config: remove none ODROID supported configs
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: I86c86a406511b310fbbee4d975177e5a270192ed
2025-11-07 15:23:53 +09:00
dc7dd38fc0 ODROID-C5: defconfig: shtc1: Add config shtc1
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: I2ed4074057ec9d52381568930b6c27388ade48ad
2025-11-07 15:23:53 +09:00
249ca6d54e ODROID-C5: defconfig: dht11: Add config dht11
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: Ia5c4e7d0ac15787513d183ffaef584e16af355e3
2025-11-07 15:23:53 +09:00
95e8ecbf90 ODROID-C5: defconfig: onewire: Add config onewire
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: I5346db6dab7d4c264aca97b23eed076a9e889d4a
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
2025-11-07 15:23:53 +09:00
266a5cdb0b ODROID-C5: defconfig: can: Add module config MCP251X
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: Id6aa4f1e970937f03bfddfa08f437c35d060cfe5
2025-11-07 15:23:53 +09:00
5f937343f4 ODROID-C5: spi: Add compatible name "linux,spidev"
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: I13f0a3d2ff898f0e8e3b504a38ea84666dcbf8d0
2025-11-07 15:23:53 +09:00
cc872881da ODROID-C5: Change flag for dt overlay
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: Ic5f9dea9fa288bb83010a429fc5c58413f539ae0
2025-11-07 15:23:53 +09:00
a7f53b880d ODROID-C5: defconfig: spi: spidev set module
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: I320e6710edb8dbd2134d0638a7b597546610a283
2025-11-07 15:23:53 +09:00
Dongjin Kim
1f4d398356 ODROID-C5: arch/arm64: add 'ARCH_MESON_ODROID{C5|_COMMON}*'
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: Ice6bb36f197bc445d8595b18e45110cfbfafe7b2
2025-11-07 15:23:53 +09:00
76240bbedd ODROID-C5: defconfig: Edit config for blue/red leds
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: I30d7ddfeb64350ac65a8a7256bb558939665c03f
2025-11-07 15:23:53 +09:00
c167e3e97d ODROID-C5: gpiomem: defconfig: Add gpiomem
Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
Change-Id: I977be3880cd8520a8eccffc45d477595af34b284
2025-11-07 15:23:53 +09:00
Dongjin Kim
65604e9e2f ODROID-C5: config: enable ARM Mali GPU drivers
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
Change-Id: I5b34b4c57bd1ec70cd8011667239b36e68c0d6cf
2025-11-07 15:23:53 +09:00
Dongjin Kim
9e586d9ce3 ODROID-C5: config: very first kernel config
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
2025-11-07 15:23:53 +09:00
Dongjin Kim
8cd01cbbd7 ODROID-C5: not adding git commit value to kernel version
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
2025-11-07 15:23:53 +09:00
Dongjin Kim
f5719063b6 ODROID-C5: Add new submodule 'media_modules' to media drivers
Change-Id: I683fd590315157ce77b1672ab1b947b1104641d9
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
2025-11-07 15:23:53 +09:00
Dongjin Kim
d511311275 ODROID-C5: Add new submodule 'media_modules' to media drivers
Change-Id: I683fd590315157ce77b1672ab1b947b1104641d9
Signed-off-by: Dongjin Kim <tobetter@gmail.com>
2025-11-07 15:23:53 +09:00
Dongjin Kim
4548c9eba1 Revert "amlbian: Support making dtb-deb [1/1]"
This reverts commit d22cc183af54b1539b856a387e43d86688941eba.
2025-11-07 15:23:53 +09:00
luke.liu
ef04392c93 std: mem size sign set [1/1]
PD#SWPL-204046

Problem:
std seurmem and memsize handle

Solution:
std flow set

Verify:
s7

Change-Id: I1c700ec916da43ebd3f8326f779fc72a8cc38375
Signed-off-by: luke.liu <luke.liu@amlogic.com>
2025-11-07 15:17:52 +09:00
Wayne Zhang
9857ce4dc1 SPI: add flash ID [1/3]
PD#SWPL-202773

Problem:
need nor flash support.

Solution:
add id support.

Verify:
T5W

Signed-off-by: Wenbing Yu <wenbing.yu@amlogic.com>
Signed-off-by: Feng Chen <feng.chen@amlogic.com>
Change-Id: I0c2c11139a32aa03d46ff3ca70c7c2e0368667f2
Signed-off-by: Wayne Zhang <wayne.zhang@amlogic.com>
2025-11-07 15:16:22 +09:00
tuan zhang
43ff01f1bb Add rumble support to latest xbox controllers
PD#SWPL-185765

Currently, rumble is only supported via bluetooth on a single xbox
controller, called 'model 1708'. On the back of the device, it's named
'wireless controller for xbox one'. However, in 2021, Microsoft released
a firmware update for this controller. As part of this update, the HID
descriptor of the device changed. The product ID was also changed from
0x02fd to 0x0b20. On this controller, rumble was supported via
hid-microsoft, which matched against the old product id (0x02fd). As a
result, the firmware update broke rumble support on this controller.

The hid-microsoft driver actually supports rumble on the new firmware,
as well. So simply adding new product id is sufficient to bring back
this support.

After discussing further with the xbox team, it was pointed out that
another xbox controller, xbox elite series 2, can be supported in a
similar way.

Add rumble support for all of these devices in this patch. Two of the
devices have received firmware updates that caused their product id's to
change. Both old and new firmware versions of these devices were tested.

The tested controllers are:

1. 'wireless controller for xbox one', model 1708
2. 'xbox wireless controller', model 1914. This is also sometimes
   referred to as 'xbox series S|X'.
3. 'elite series 2', model 1797.

The tested configurations are:
1. model 1708, pid 0x02fd (old firmware)
2. model 1708, pid 0x0b20 (new firmware)
3. model 1914, pid 0x0b13
4. model 1797, pid 0x0b05 (old firmware)
5. model 1797, pid 0x0b22 (new firmware)

I verified rumble support on both bluetooth and usb.

Change-Id: Ia84736e95dadc61e442276ae943f370fe0cb6526
Reviewed-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Siarhei Vishniakou <svv@google.com>
2025-11-07 15:15:28 +09:00
Fabio M. De Francesco
e8632bb5e0 UPSTREAM: binder: Use memset_page() in binder_alloc_clear_buf()
The use of kmap() is being deprecated in favor of kmap_local_page()
where it is feasible. With kmap_local_page(), the mapping is per
thread, CPU local and not globally visible.

binder_alloc_clear_buf() is a function where the use of kmap_local_page()
in place of kmap() is correctly suited because the mapping is local to the
thread.

Therefore, use kmap_local_page() / kunmap_local() but, instead of open
coding these two functions and adding a memset() of the virtual address
of the mapping, prefer memset_page().

Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Todd Kjos <tkjos@google.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20220425175754.8180-2-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 368205746
Bug: 365876437
(cherry picked from commit 26eff2d66a)
Change-Id: I7bc041db662ee1e8758c173861b2229d6ad8eb1e
Signed-off-by: yenchia.chen <yenchia.chen@mediatek.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2025-11-07 15:15:28 +09:00
Fabio M. De Francesco
e9caadf83e UPSTREAM: binder: Use kmap_local_page() in binder_alloc_copy_user_to_buffer()
The use of kmap() is being deprecated in favor of kmap_local_page()
where it is feasible. With kmap_local_page(), the mapping is per
thread, CPU local and not globally visible.

binder_alloc_copy_user_to_buffer() is a function where the use of
kmap_local_page() in place of kmap() is correctly suited because
the mapping is local to the thread.

Therefore, use kmap_local_page() / kunmap_local().

Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Todd Kjos <tkjos@google.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Link: https://lore.kernel.org/r/20220425175754.8180-3-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 365876437
Bug: 367895677
(cherry picked from commit 1d625960e4)
Change-Id: I49739365cf5dcf584be1aab0c93848aa9ce886a8
Signed-off-by: Carlos Llamas <cmllamas@google.com>
2025-11-07 15:15:28 +09:00
qinglin.li
ef83971929 ntfs3: ntfs3 fs_umode_to_dtype not in abi list [1/1]
PD#SWPL-169224

Problem:
ntfs3 fs_umode_to_dtype not in abi list

Solution:
ntfs3 fs_umode_to_dtype not in abi list

Verify:
local

Change-Id: Ibf190585f7606539b5df98151e8dd617ad66c9da
Signed-off-by: qinglin.li <qinglin.li@amlogic.com>
2025-11-07 15:15:28 +09:00
Long
69c3fcd030 eMMC: run work queue asynchronous. [1/1]
PD#SWPL-170009

Problem:
Synchronous run queues cause eMMC performance degradation.

Solution:
Asynchronous Run work queue.

Verify:
T3

Change-Id: I214f2d813373b46fd5fc64f050e00a395dd35828
Signed-off-by: Long <long.yu@amlogic.com>
2025-11-07 15:15:28 +09:00