From 4550eecbf7a0f74e98826f5f3d633e594f4dc056 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Fri, 29 Apr 2022 18:58:20 +0200 Subject: [PATCH] Update v5.17 patches Changes: - Fix cameras not showing up (@djrscally) - PR: https://github.com/linux-surface/kernel/pull/122 - Rebase onto v5.17.5 Links: - kernel: https://github.com/linux-surface/kernel/commit/58e00c7367a39d844b3107f239e02483b4935243 --- configs/surface-5.17.config | 1 + patches/5.17/0001-surface3-oemb.patch | 2 +- patches/5.17/0002-mwifiex.patch | 12 +- patches/5.17/0003-ath10k.patch | 2 +- patches/5.17/0004-ipts.patch | 8 +- patches/5.17/0005-surface-sam.patch | 22 +- patches/5.17/0006-surface-sam-over-hid.patch | 4 +- patches/5.17/0007-surface-gpe.patch | 2 +- patches/5.17/0008-surface-button.patch | 8 +- patches/5.17/0009-surface-typecover.patch | 2 +- patches/5.17/0010-surface-battery.patch | 2 +- patches/5.17/0011-cameras.patch | 510 ++++++++++++++++++- patches/5.17/0012-amd-gpio.patch | 4 +- 13 files changed, 543 insertions(+), 36 deletions(-) diff --git a/configs/surface-5.17.config b/configs/surface-5.17.config index cdf71cce4..435242b2b 100644 --- a/configs/surface-5.17.config +++ b/configs/surface-5.17.config @@ -34,6 +34,7 @@ CONFIG_MISC_IPTS=m # # Cameras: IPU3 # +CONFIG_VIDEO_DW9719=m CONFIG_VIDEO_IPU3_IMGU=m CONFIG_VIDEO_IPU3_CIO2=m CONFIG_CIO2_BRIDGE=y diff --git a/patches/5.17/0001-surface3-oemb.patch b/patches/5.17/0001-surface3-oemb.patch index 59471423a..433e4d978 100644 --- a/patches/5.17/0001-surface3-oemb.patch +++ b/patches/5.17/0001-surface3-oemb.patch @@ -1,4 +1,4 @@ -From ec6fa26f04034a252e606d4cdc8097282c59ab18 Mon Sep 17 00:00:00 2001 +From d000e23ad0a00685750e998b23da24b3a636f613 Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Sun, 18 Oct 2020 16:42:44 +0900 Subject: [PATCH] (surface3-oemb) add DMI matches for Surface 3 with broken DMI diff --git a/patches/5.17/0002-mwifiex.patch b/patches/5.17/0002-mwifiex.patch index f86579005..7a30db597 100644 --- a/patches/5.17/0002-mwifiex.patch +++ b/patches/5.17/0002-mwifiex.patch @@ -1,4 +1,4 @@ -From 1395350fc7351ab5a75541dd444b9321ab51642a Mon Sep 17 00:00:00 2001 +From 8c5963aa3f41e7fdb8aa9cf1abae28e9a36f5258 Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Tue, 29 Sep 2020 17:32:22 +0900 Subject: [PATCH] mwifiex: pcie: add reset_wsid quirk for Surface 3 @@ -183,7 +183,7 @@ index 8ec4176d698f..25370c5a4f59 100644 -- 2.36.0 -From 312dfdce8be446cbe3fc1fb49754057218e2c7bd Mon Sep 17 00:00:00 2001 +From 7be0e5333127b5ebd6f1a0c073592d1a281315bf Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Wed, 30 Sep 2020 18:08:24 +0900 Subject: [PATCH] mwifiex: pcie: (OEMB) add quirk for Surface 3 with broken DMI @@ -245,7 +245,7 @@ index 563dd0d5ac79..32e2f000e57b 100644 -- 2.36.0 -From 91a301f7fd782acf695910c618edcb98c062ed99 Mon Sep 17 00:00:00 2001 +From 228c01fcb37debfe06f7121a9516c5029f30de60 Mon Sep 17 00:00:00 2001 From: Tsuchiya Yuto Date: Sun, 4 Oct 2020 00:11:49 +0900 Subject: [PATCH] mwifiex: pcie: disable bridge_d3 for Surface gen4+ @@ -400,7 +400,7 @@ index 25370c5a4f59..a1de111ad1db 100644 -- 2.36.0 -From 1febd99bd24be85092ba5ddbf04cac8d9deab2c0 Mon Sep 17 00:00:00 2001 +From 267e273d149ed6991a356fc3f1a0b0577cce1073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Tue, 3 Nov 2020 13:28:04 +0100 Subject: [PATCH] mwifiex: Add quirk resetting the PCI bridge on MS Surface @@ -567,7 +567,7 @@ index a1de111ad1db..0e429779bb04 100644 -- 2.36.0 -From 8c6862539a41224f764f06e5f0c7284770edc3f4 Mon Sep 17 00:00:00 2001 +From c5239e4f3e9051b5b620a3b38d0b30554f938cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Thu, 25 Mar 2021 11:33:02 +0100 Subject: [PATCH] Bluetooth: btusb: Lower passive lescan interval on Marvell @@ -645,7 +645,7 @@ index 42234d5f602d..72202a744564 100644 -- 2.36.0 -From 921b3bdd8d6d963f5ea108a699ef6f70a3709acd Mon Sep 17 00:00:00 2001 +From d05d237fa3dd7e1700fe16f0cf66a246558bf963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Tue, 10 Nov 2020 12:49:56 +0100 Subject: [PATCH] mwifiex: Use non-posted PCI register writes diff --git a/patches/5.17/0003-ath10k.patch b/patches/5.17/0003-ath10k.patch index fff27ea64..cb1291c9c 100644 --- a/patches/5.17/0003-ath10k.patch +++ b/patches/5.17/0003-ath10k.patch @@ -1,4 +1,4 @@ -From 1e8468a42b52eb369a70003f99dde7b16846c5e2 Mon Sep 17 00:00:00 2001 +From de0f6735235b12d9fea51afc6b200c418844b4b8 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sat, 27 Feb 2021 00:45:52 +0100 Subject: [PATCH] ath10k: Add module parameters to override board files diff --git a/patches/5.17/0004-ipts.patch b/patches/5.17/0004-ipts.patch index bacee9f17..dde384c86 100644 --- a/patches/5.17/0004-ipts.patch +++ b/patches/5.17/0004-ipts.patch @@ -1,4 +1,4 @@ -From 5f96f9f986f4177c1072baa7f3ab5f134cf20415 Mon Sep 17 00:00:00 2001 +From f2bdca52ada4e85c15bef954b2b1d6fa08b4a03d Mon Sep 17 00:00:00 2001 From: Dorian Stoll Date: Thu, 30 Jul 2020 13:21:53 +0200 Subject: [PATCH] misc: mei: Add missing IPTS device IDs @@ -36,7 +36,7 @@ index a738253dbd05..4e1c3fe09e53 100644 -- 2.36.0 -From fce727fc65f22335a65f82446d045da06cae42c6 Mon Sep 17 00:00:00 2001 +From e4f85a6d94569543f49e169e6be300dcd4ba4b4a Mon Sep 17 00:00:00 2001 From: Dorian Stoll Date: Thu, 6 Aug 2020 11:20:41 +0200 Subject: [PATCH] misc: Add support for Intel Precise Touch & Stylus @@ -1501,7 +1501,7 @@ index 000000000000..53fb86a88f97 -- 2.36.0 -From db68833d47e0d5ee2bc2003b9e410a4f672aa43a Mon Sep 17 00:00:00 2001 +From d79798adb4d71ffda9c991f958ae788db12b7fa8 Mon Sep 17 00:00:00 2001 From: zouxiaoh Date: Fri, 25 Jun 2021 08:52:59 +0800 Subject: [PATCH] iommu: intel-ipu: use IOMMU passthrough mode for Intel IPUs @@ -1610,7 +1610,7 @@ index 5b196cfe9ed2..a5fc95dbb06d 100644 -- 2.36.0 -From b3fbdb5c4552d9d98715e19ca13302615e7aca80 Mon Sep 17 00:00:00 2001 +From f42a783b6ec917558cd33b1dfd65c2de3ecfde65 Mon Sep 17 00:00:00 2001 From: Liban Hannan Date: Tue, 12 Apr 2022 23:31:12 +0100 Subject: [PATCH] iommu: ipts: use IOMMU passthrough mode for IPTS diff --git a/patches/5.17/0005-surface-sam.patch b/patches/5.17/0005-surface-sam.patch index b6a47e017..294b1b1d0 100644 --- a/patches/5.17/0005-surface-sam.patch +++ b/patches/5.17/0005-surface-sam.patch @@ -1,4 +1,4 @@ -From 2bb8c3daadfa4daa1f2d0f35b7753f850d0f0b62 Mon Sep 17 00:00:00 2001 +From bf1eb62319be3db94fbf1551573c77528c246bff Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Tue, 8 Jun 2021 00:24:47 +0200 Subject: [PATCH] platform/surface: aggregator: Allow devices to be marked as @@ -119,7 +119,7 @@ index cc257097eb05..491aa7e9f4bc 100644 -- 2.36.0 -From e1da5a5135346e7091651f7fe2aa8c43b9d03f7d Mon Sep 17 00:00:00 2001 +From 199fd2d3b2df873f050b823804808003de75d930 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Tue, 8 Jun 2021 00:48:22 +0200 Subject: [PATCH] platform/surface: aggregator: Allow notifiers to avoid @@ -406,7 +406,7 @@ index 491aa7e9f4bc..16816c34da3e 100644 -- 2.36.0 -From bf9269161d0e15076508e0ca776a31d860eacb7f Mon Sep 17 00:00:00 2001 +From 09733bcaf64f287574617a7fd785555490fc069c Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Tue, 8 Jun 2021 01:20:49 +0200 Subject: [PATCH] platform/surface: aggregator_registry: Use client device @@ -455,7 +455,7 @@ index ce2bd88feeaa..9f630e890ff7 100644 -- 2.36.0 -From 7dffc0d5aa0b675201815f0db11d4207ed1bcf47 Mon Sep 17 00:00:00 2001 +From 7e093dcab6d846b0dd8bde20ac3cbbf33464385b Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Thu, 28 Oct 2021 03:37:06 +0200 Subject: [PATCH] power/supply: surface_charger: Use client device wrappers for @@ -495,7 +495,7 @@ index a060c36c7766..59182d55742d 100644 -- 2.36.0 -From bf04f91eb86cd24faed47f078d4c7cba0d3afb0a Mon Sep 17 00:00:00 2001 +From 0596f79e4fc188631bdddb9d2e7b91c1203187e2 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Thu, 28 Oct 2021 03:38:09 +0200 Subject: [PATCH] power/supply: surface_battery: Use client device wrappers for @@ -535,7 +535,7 @@ index 5ec2e6bb2465..540707882bb0 100644 -- 2.36.0 -From ec5de9e26ab336abeb4510101843ca9215f306ac Mon Sep 17 00:00:00 2001 +From 7ac8a5db2df06cfdc4af31266c7f57c0972eb096 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Tue, 8 Jun 2021 01:33:02 +0200 Subject: [PATCH] HID: surface-hid: Add support for hot-removal @@ -646,7 +646,7 @@ index e46330b2e561..87637f813de2 100644 -- 2.36.0 -From 4bdf54b718375e303f8fe6745ffa90c4b153e20c Mon Sep 17 00:00:00 2001 +From fe21a8dfcc86dbfe0f5fc9bdf0fa7dee09d45862 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sun, 31 Oct 2021 12:34:08 +0100 Subject: [PATCH] platform/surface: aggregator: Add comment for KIP subsystem @@ -684,7 +684,7 @@ index c3de43edcffa..d1efac85caf1 100644 -- 2.36.0 -From b05a57a23fb0dce8c1be11eda511116493d1e114 Mon Sep 17 00:00:00 2001 +From 489d63cb6d02eecc0a986dac9f056fb488318dfa Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sun, 10 Oct 2021 23:56:23 +0200 Subject: [PATCH] platform/surface: aggregator_registry: Add KIP device hub @@ -998,7 +998,7 @@ index 9f630e890ff7..4838ce6519a6 100644 -- 2.36.0 -From 0e443bc77964f90eed651cb32af45398060ba42e Mon Sep 17 00:00:00 2001 +From 72361a719765b4c3e644f5c1a78560856698b9d9 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Wed, 27 Oct 2021 22:33:03 +0200 Subject: [PATCH] platform/surface: aggregator_registry: Add support for @@ -1096,7 +1096,7 @@ index 4838ce6519a6..c0e29c0514df 100644 -- 2.36.0 -From f3ff67b118c39ab15a3443f953f93fa933c1d957 Mon Sep 17 00:00:00 2001 +From 50deaaa19434c8871712984d4bc2cc348e33c082 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Tue, 8 Jun 2021 03:19:20 +0200 Subject: [PATCH] platform/surface: Add KIP tablet-mode switch @@ -1440,7 +1440,7 @@ index 000000000000..458470067579 -- 2.36.0 -From 228072592809b63575ea69a4d2bb9192beb74b02 Mon Sep 17 00:00:00 2001 +From 6d860892e44db08cec0f0e666582447daf17d488 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Wed, 27 Oct 2021 22:33:03 +0200 Subject: [PATCH] platform/surface: aggregator_registry: Add support for tablet diff --git a/patches/5.17/0006-surface-sam-over-hid.patch b/patches/5.17/0006-surface-sam-over-hid.patch index fe3f13435..b4a9f99da 100644 --- a/patches/5.17/0006-surface-sam-over-hid.patch +++ b/patches/5.17/0006-surface-sam-over-hid.patch @@ -1,4 +1,4 @@ -From 82ae885ad1824b149d18d7ac938988d9a5b279d5 Mon Sep 17 00:00:00 2001 +From 71fee6b52fd56894123da7ec3c8ca610179fdbb6 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sat, 25 Jul 2020 17:19:53 +0200 Subject: [PATCH] i2c: acpi: Implement RawBytes read access @@ -110,7 +110,7 @@ index 85ed4c1d4924..942c1c9a4ea5 100644 -- 2.36.0 -From 704aa16555465b0f83471aa84c3a5be3c7133d67 Mon Sep 17 00:00:00 2001 +From 1a4621385e771975078d4093210b61cf850bd2c7 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Sat, 13 Feb 2021 16:41:18 +0100 Subject: [PATCH] platform/surface: Add driver for Surface Book 1 dGPU switch diff --git a/patches/5.17/0007-surface-gpe.patch b/patches/5.17/0007-surface-gpe.patch index 9fd875cf3..15e872511 100644 --- a/patches/5.17/0007-surface-gpe.patch +++ b/patches/5.17/0007-surface-gpe.patch @@ -1,4 +1,4 @@ -From 5a6d26ae3ff1334f0540aef76b28c596ebb67d81 Mon Sep 17 00:00:00 2001 +From 53107852ef35cc5e267e6c6bedcdeabbe2007947 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Wed, 27 Oct 2021 00:56:11 +0200 Subject: [PATCH] platform/surface: gpe: Add support for Surface Pro 8 diff --git a/patches/5.17/0008-surface-button.patch b/patches/5.17/0008-surface-button.patch index fe7e50541..1162f375a 100644 --- a/patches/5.17/0008-surface-button.patch +++ b/patches/5.17/0008-surface-button.patch @@ -1,4 +1,4 @@ -From 8944aec8973646c474c14bd6763adee38f0430a3 Mon Sep 17 00:00:00 2001 +From 9df4dc6068e780b80ac4bda9fb5513fe2a2462da Mon Sep 17 00:00:00 2001 From: Sachi King Date: Tue, 5 Oct 2021 00:05:09 +1100 Subject: [PATCH] Input: soc_button_array - support AMD variant Surface devices @@ -75,7 +75,7 @@ index cb6ec59a045d..4e8944f59def 100644 -- 2.36.0 -From 421af81b0297af32e058cd79dcf3073eb3cf51fa Mon Sep 17 00:00:00 2001 +From 4f8e65d97078c6cd7eb50fc756afab56926c8e85 Mon Sep 17 00:00:00 2001 From: Sachi King Date: Tue, 5 Oct 2021 00:22:57 +1100 Subject: [PATCH] platform/surface: surfacepro3_button: don't load on amd @@ -147,7 +147,7 @@ index 242fb690dcaf..30eea54dbb47 100644 -- 2.36.0 -From 734da7d8f5beb9be996ba99a80f7e603b72130ab Mon Sep 17 00:00:00 2001 +From d2afad12171aa79978f786b5e98c6e72aa8de491 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 24 Feb 2022 12:02:40 +0100 Subject: [PATCH] Input: soc_button_array - add support for Microsoft Surface 3 @@ -250,7 +250,7 @@ index 4e8944f59def..f044c731c6a9 100644 -- 2.36.0 -From 33b3e3c489a43b4c71d5886e10af33473a939ca9 Mon Sep 17 00:00:00 2001 +From f8cfbc4206d440fcb05129893996e0952e825537 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 24 Feb 2022 12:02:41 +0100 Subject: [PATCH] platform/surface: Remove Surface 3 Button driver diff --git a/patches/5.17/0009-surface-typecover.patch b/patches/5.17/0009-surface-typecover.patch index 4c4a0be36..af52150bd 100644 --- a/patches/5.17/0009-surface-typecover.patch +++ b/patches/5.17/0009-surface-typecover.patch @@ -1,4 +1,4 @@ -From 6854ba2ebc5761be240d5fd1d57555011f307f2c Mon Sep 17 00:00:00 2001 +From 634bb3362ab1a6b87943d750497e2223fdbeb71b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Dre=C3=9Fler?= Date: Thu, 5 Nov 2020 13:09:45 +0100 Subject: [PATCH] hid/multitouch: Turn off Type Cover keyboard backlight when diff --git a/patches/5.17/0010-surface-battery.patch b/patches/5.17/0010-surface-battery.patch index 9daff23ed..42c6f9b74 100644 --- a/patches/5.17/0010-surface-battery.patch +++ b/patches/5.17/0010-surface-battery.patch @@ -1,4 +1,4 @@ -From 48eab1c5e0d9fe67384d6c2e91efdf0ec3ff54b5 Mon Sep 17 00:00:00 2001 +From 1da1dd4313e7bf02c629804916e4219e177d4f5c Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Tue, 8 Feb 2022 01:29:48 +0100 Subject: [PATCH] ACPI: battery: Add "Not Charging" quirk for Microsoft Surface diff --git a/patches/5.17/0011-cameras.patch b/patches/5.17/0011-cameras.patch index e7b2246ed..623a8773c 100644 --- a/patches/5.17/0011-cameras.patch +++ b/patches/5.17/0011-cameras.patch @@ -1,4 +1,4 @@ -From f31a3ad42c2c04a17f8675438a1b5a6500bafea5 Mon Sep 17 00:00:00 2001 +From 60158c7b6219f00a91187c7203df0fc9aeb6a0df Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 10 Oct 2021 20:56:57 +0200 Subject: [PATCH] ACPI: delay enumeration of devices with a _DEP pointing to an @@ -74,7 +74,7 @@ index c82b1bfa1c3d..2227625202aa 100644 -- 2.36.0 -From 3f7aa178a14b5cdaa3ca424743299d0c271fd202 Mon Sep 17 00:00:00 2001 +From 06add1b4d4cfb7e3bbf5a5a7a17040786569694e Mon Sep 17 00:00:00 2001 From: Daniel Scally Date: Sun, 10 Oct 2021 20:57:02 +0200 Subject: [PATCH] platform/x86: int3472: Enable I2c daisy chain @@ -111,3 +111,509 @@ index 22f61b47f9e5..e1de1ff40bba 100644 -- 2.36.0 +From ad82b50db9f9100119925d54804cf0c393f46013 Mon Sep 17 00:00:00 2001 +From: Daniel Scally +Date: Thu, 28 Oct 2021 21:55:16 +0100 +Subject: [PATCH] media: i2c: Add driver for DW9719 VCM + +Add a driver for the DW9719 VCM. The driver creates a v4l2 subdevice +and registers a control to set the desired focus. + +Signed-off-by: Daniel Scally +Patchset: cameras +--- + MAINTAINERS | 7 + + drivers/media/i2c/Kconfig | 11 + + drivers/media/i2c/Makefile | 1 + + drivers/media/i2c/dw9719.c | 427 +++++++++++++++++++++++++++++++++++++ + 4 files changed, 446 insertions(+) + create mode 100644 drivers/media/i2c/dw9719.c + +diff --git a/MAINTAINERS b/MAINTAINERS +index 4d83cd26e299..0e0e1e53e49c 100644 +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -5865,6 +5865,13 @@ T: git git://linuxtv.org/media_tree.git + F: Documentation/devicetree/bindings/media/i2c/dongwoon,dw9714.txt + F: drivers/media/i2c/dw9714.c + ++DONGWOON DW9719 LENS VOICE COIL DRIVER ++M: Daniel Scally ++L: linux-media@vger.kernel.org ++S: Maintained ++T: git git://linuxtv.org/media_tree.git ++F: drivers/media/i2c/dw9719.c ++ + DONGWOON DW9768 LENS VOICE COIL DRIVER + M: Dongchun Zhu + L: linux-media@vger.kernel.org +diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig +index 69c56e24a612..d9fac304f451 100644 +--- a/drivers/media/i2c/Kconfig ++++ b/drivers/media/i2c/Kconfig +@@ -1466,6 +1466,17 @@ config VIDEO_DW9714 + capability. This is designed for linear control of + voice coil motors, controlled via I2C serial interface. + ++config VIDEO_DW9719 ++ tristate "DW9719 lens voice coil support" ++ depends on I2C && VIDEO_V4L2 ++ select MEDIA_CONTROLLER ++ select VIDEO_V4L2_SUBDEV_API ++ select V4L2_ASYNC ++ help ++ This is a driver for the DW9719 camera lens voice coil. ++ This is designed for linear control of voice coil motors, ++ controlled via I2C serial interface. ++ + config VIDEO_DW9768 + tristate "DW9768 lens voice coil support" + depends on I2C && VIDEO_V4L2 +diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile +index b01f6cd05ee8..ba8b31d79222 100644 +--- a/drivers/media/i2c/Makefile ++++ b/drivers/media/i2c/Makefile +@@ -24,6 +24,7 @@ obj-$(CONFIG_VIDEO_SAA6752HS) += saa6752hs.o + obj-$(CONFIG_VIDEO_AD5820) += ad5820.o + obj-$(CONFIG_VIDEO_AK7375) += ak7375.o + obj-$(CONFIG_VIDEO_DW9714) += dw9714.o ++obj-$(CONFIG_VIDEO_DW9719) += dw9719.o + obj-$(CONFIG_VIDEO_DW9768) += dw9768.o + obj-$(CONFIG_VIDEO_DW9807_VCM) += dw9807-vcm.o + obj-$(CONFIG_VIDEO_ADV7170) += adv7170.o +diff --git a/drivers/media/i2c/dw9719.c b/drivers/media/i2c/dw9719.c +new file mode 100644 +index 000000000000..8451c75b696b +--- /dev/null ++++ b/drivers/media/i2c/dw9719.c +@@ -0,0 +1,427 @@ ++// SPDX-License-Identifier: GPL-2.0 ++// Copyright (c) 2012 Intel Corporation ++ ++/* ++ * Based on linux/modules/camera/drivers/media/i2c/imx/dw9719.c in this repo: ++ * https://github.com/ZenfoneArea/android_kernel_asus_zenfone5 ++ */ ++ ++#include ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++#include ++ ++#define DW9719_MAX_FOCUS_POS 1023 ++#define DW9719_CTRL_STEPS 16 ++#define DW9719_CTRL_DELAY_US 1000 ++#define DELAY_MAX_PER_STEP_NS (1000000 * 1023) ++ ++#define DW9719_INFO 0 ++#define DW9719_ID 0xF1 ++#define DW9719_CONTROL 2 ++#define DW9719_VCM_CURRENT 3 ++ ++#define DW9719_MODE 6 ++#define DW9719_VCM_FREQ 7 ++ ++#define DW9719_MODE_SAC3 0x40 ++#define DW9719_DEFAULT_VCM_FREQ 0x60 ++#define DW9719_ENABLE_RINGING 0x02 ++ ++#define NUM_REGULATORS 2 ++ ++#define to_dw9719_device(x) container_of(x, struct dw9719_device, sd) ++ ++struct dw9719_device { ++ struct device *dev; ++ struct i2c_client *client; ++ struct regulator_bulk_data regulators[NUM_REGULATORS]; ++ struct v4l2_subdev sd; ++ ++ struct dw9719_v4l2_ctrls { ++ struct v4l2_ctrl_handler handler; ++ struct v4l2_ctrl *focus; ++ } ctrls; ++}; ++ ++static int dw9719_i2c_rd8(struct i2c_client *client, u8 reg, u8 *val) ++{ ++ struct i2c_msg msg[2]; ++ u8 buf[2] = { reg }; ++ int ret; ++ ++ msg[0].addr = client->addr; ++ msg[0].flags = 0; ++ msg[0].len = 1; ++ msg[0].buf = buf; ++ ++ msg[1].addr = client->addr; ++ msg[1].flags = I2C_M_RD; ++ msg[1].len = 1; ++ msg[1].buf = &buf[1]; ++ *val = 0; ++ ++ ret = i2c_transfer(client->adapter, msg, 2); ++ if (ret < 0) ++ return ret; ++ ++ *val = buf[1]; ++ ++ return 0; ++} ++ ++static int dw9719_i2c_wr8(struct i2c_client *client, u8 reg, u8 val) ++{ ++ struct i2c_msg msg; ++ int ret; ++ ++ u8 buf[2] = { reg, val }; ++ ++ msg.addr = client->addr; ++ msg.flags = 0; ++ msg.len = sizeof(buf); ++ msg.buf = buf; ++ ++ ret = i2c_transfer(client->adapter, &msg, 1); ++ ++ return ret < 0 ? ret : 0; ++} ++ ++static int dw9719_i2c_wr16(struct i2c_client *client, u8 reg, u16 val) ++{ ++ struct i2c_msg msg; ++ u8 buf[3] = { reg }; ++ int ret; ++ ++ put_unaligned_be16(val, buf + 1); ++ ++ msg.addr = client->addr; ++ msg.flags = 0; ++ msg.len = sizeof(buf); ++ msg.buf = buf; ++ ++ ret = i2c_transfer(client->adapter, &msg, 1); ++ ++ return ret < 0 ? ret : 0; ++} ++ ++static int dw9719_detect(struct dw9719_device *dw9719) ++{ ++ int ret; ++ u8 val; ++ ++ ret = dw9719_i2c_rd8(dw9719->client, DW9719_INFO, &val); ++ if (ret < 0) ++ return ret; ++ ++ if (val != DW9719_ID) { ++ dev_err(dw9719->dev, "Failed to detect correct id\n"); ++ ret = -ENXIO; ++ } ++ ++ return 0; ++} ++ ++static int dw9719_power_down(struct dw9719_device *dw9719) ++{ ++ return regulator_bulk_disable(NUM_REGULATORS, dw9719->regulators); ++} ++ ++static int dw9719_power_up(struct dw9719_device *dw9719) ++{ ++ int ret; ++ ++ ret = regulator_bulk_enable(NUM_REGULATORS, dw9719->regulators); ++ if (ret) ++ return ret; ++ ++ /* Jiggle SCL pin to wake up device */ ++ ret = dw9719_i2c_wr8(dw9719->client, DW9719_CONTROL, 1); ++ ++ /* Need 100us to transit from SHUTDOWN to STANDBY*/ ++ usleep_range(100, 1000); ++ ++ ret = dw9719_i2c_wr8(dw9719->client, DW9719_CONTROL, ++ DW9719_ENABLE_RINGING); ++ if (ret < 0) ++ goto fail_powerdown; ++ ++ ret = dw9719_i2c_wr8(dw9719->client, DW9719_MODE, DW9719_MODE_SAC3); ++ if (ret < 0) ++ goto fail_powerdown; ++ ++ ret = dw9719_i2c_wr8(dw9719->client, DW9719_VCM_FREQ, ++ DW9719_DEFAULT_VCM_FREQ); ++ if (ret < 0) ++ goto fail_powerdown; ++ ++ return 0; ++ ++fail_powerdown: ++ dw9719_power_down(dw9719); ++ return ret; ++} ++ ++static int dw9719_t_focus_abs(struct dw9719_device *dw9719, s32 value) ++{ ++ int ret; ++ ++ value = clamp(value, 0, DW9719_MAX_FOCUS_POS); ++ ret = dw9719_i2c_wr16(dw9719->client, DW9719_VCM_CURRENT, value); ++ if (ret < 0) ++ return ret; ++ ++ return 0; ++} ++ ++static int dw9719_set_ctrl(struct v4l2_ctrl *ctrl) ++{ ++ struct dw9719_device *dw9719 = container_of(ctrl->handler, ++ struct dw9719_device, ++ ctrls.handler); ++ int ret; ++ ++ /* Only apply changes to the controls if the device is powered up */ ++ if (!pm_runtime_get_if_in_use(dw9719->dev)) ++ return 0; ++ ++ switch (ctrl->id) { ++ case V4L2_CID_FOCUS_ABSOLUTE: ++ ret = dw9719_t_focus_abs(dw9719, ctrl->val); ++ break; ++ default: ++ ret = -EINVAL; ++ } ++ ++ pm_runtime_put(dw9719->dev); ++ ++ return ret; ++} ++ ++static const struct v4l2_ctrl_ops dw9719_ctrl_ops = { ++ .s_ctrl = dw9719_set_ctrl, ++}; ++ ++static int __maybe_unused dw9719_suspend(struct device *dev) ++{ ++ struct v4l2_subdev *sd = dev_get_drvdata(dev); ++ struct dw9719_device *dw9719 = to_dw9719_device(sd); ++ int ret; ++ int val; ++ ++ for (val = dw9719->ctrls.focus->val; val >= 0; ++ val -= DW9719_CTRL_STEPS) { ++ ret = dw9719_t_focus_abs(dw9719, val); ++ if (ret) ++ return ret; ++ ++ usleep_range(DW9719_CTRL_DELAY_US, DW9719_CTRL_DELAY_US + 10); ++ } ++ ++ return dw9719_power_down(dw9719); ++} ++ ++static int __maybe_unused dw9719_resume(struct device *dev) ++{ ++ struct v4l2_subdev *sd = dev_get_drvdata(dev); ++ struct dw9719_device *dw9719 = to_dw9719_device(sd); ++ int current_focus = dw9719->ctrls.focus->val; ++ int ret; ++ int val; ++ ++ ret = dw9719_power_up(dw9719); ++ if (ret) ++ return ret; ++ ++ for (val = current_focus % DW9719_CTRL_STEPS; val < current_focus; ++ val += DW9719_CTRL_STEPS) { ++ ret = dw9719_t_focus_abs(dw9719, val); ++ if (ret) ++ goto err_power_down; ++ ++ usleep_range(DW9719_CTRL_DELAY_US, DW9719_CTRL_DELAY_US + 10); ++ } ++ ++ return 0; ++ ++err_power_down: ++ dw9719_power_down(dw9719); ++ return ret; ++} ++ ++static int dw9719_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) ++{ ++ return pm_runtime_resume_and_get(sd->dev); ++} ++ ++static int dw9719_close(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) ++{ ++ pm_runtime_put(sd->dev); ++ ++ return 0; ++} ++ ++static const struct v4l2_subdev_internal_ops dw9719_internal_ops = { ++ .open = dw9719_open, ++ .close = dw9719_close, ++}; ++ ++static int dw9719_init_controls(struct dw9719_device *dw9719) ++{ ++ const struct v4l2_ctrl_ops *ops = &dw9719_ctrl_ops; ++ int ret; ++ ++ ret = v4l2_ctrl_handler_init(&dw9719->ctrls.handler, 1); ++ if (ret) ++ return ret; ++ ++ dw9719->ctrls.focus = v4l2_ctrl_new_std(&dw9719->ctrls.handler, ops, ++ V4L2_CID_FOCUS_ABSOLUTE, 0, ++ DW9719_MAX_FOCUS_POS, 1, 0); ++ ++ if (dw9719->ctrls.handler.error) { ++ dev_err(dw9719->dev, "Error initialising v4l2 ctrls\n"); ++ ret = dw9719->ctrls.handler.error; ++ goto err_free_handler; ++ } ++ ++ dw9719->sd.ctrl_handler = &dw9719->ctrls.handler; ++ ++ return ret; ++ ++err_free_handler: ++ v4l2_ctrl_handler_free(&dw9719->ctrls.handler); ++ return ret; ++} ++ ++static const struct v4l2_subdev_ops dw9719_ops = { }; ++ ++static int dw9719_probe(struct i2c_client *client) ++{ ++ struct dw9719_device *dw9719; ++ int ret; ++ ++ dw9719 = devm_kzalloc(&client->dev, sizeof(*dw9719), GFP_KERNEL); ++ if (!dw9719) ++ return -ENOMEM; ++ ++ dw9719->client = client; ++ dw9719->dev = &client->dev; ++ ++ dw9719->regulators[0].supply = "vdd"; ++ /* ++ * The DW9719 has only the 1 VDD voltage input, but some PMICs such as ++ * the TPS68470 PMIC have I2C passthrough capability, to disconnect the ++ * sensor's I2C pins from the I2C bus when the sensors VSIO (Sensor-IO) ++ * is off, because some sensors then short these pins to ground; ++ * and the DW9719 might sit behind this passthrough, this it needs to ++ * enable VSIO as that will also enable the I2C passthrough. ++ */ ++ dw9719->regulators[1].supply = "vsio"; ++ ++ ret = devm_regulator_bulk_get(&client->dev, NUM_REGULATORS, ++ dw9719->regulators); ++ if (ret) ++ return dev_err_probe(&client->dev, ret, "getting regulators\n"); ++ ++ v4l2_i2c_subdev_init(&dw9719->sd, client, &dw9719_ops); ++ dw9719->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; ++ dw9719->sd.internal_ops = &dw9719_internal_ops; ++ ++ ret = dw9719_init_controls(dw9719); ++ if (ret) ++ return ret; ++ ++ ret = media_entity_pads_init(&dw9719->sd.entity, 0, NULL); ++ if (ret < 0) ++ goto err_free_ctrl_handler; ++ ++ dw9719->sd.entity.function = MEDIA_ENT_F_LENS; ++ ++ /* ++ * We need the driver to work in the event that pm runtime is disable in ++ * the kernel, so power up and verify the chip now. In the event that ++ * runtime pm is disabled this will leave the chip on, so that the lens ++ * will work. ++ */ ++ ++ ret = dw9719_power_up(dw9719); ++ if (ret) ++ goto err_cleanup_media; ++ ++ ret = dw9719_detect(dw9719); ++ if (ret) ++ goto err_powerdown; ++ ++ pm_runtime_set_active(&client->dev); ++ pm_runtime_get_noresume(&client->dev); ++ pm_runtime_enable(&client->dev); ++ ++ ret = v4l2_async_register_subdev(&dw9719->sd); ++ if (ret < 0) ++ goto err_pm_runtime; ++ ++ pm_runtime_set_autosuspend_delay(&client->dev, 1000); ++ pm_runtime_use_autosuspend(&client->dev); ++ pm_runtime_put_autosuspend(&client->dev); ++ ++ return ret; ++ ++err_pm_runtime: ++ pm_runtime_disable(&client->dev); ++ pm_runtime_put_noidle(&client->dev); ++err_powerdown: ++ dw9719_power_down(dw9719); ++err_cleanup_media: ++ media_entity_cleanup(&dw9719->sd.entity); ++err_free_ctrl_handler: ++ v4l2_ctrl_handler_free(&dw9719->ctrls.handler); ++ ++ return ret; ++} ++ ++static int dw9719_remove(struct i2c_client *client) ++{ ++ struct v4l2_subdev *sd = i2c_get_clientdata(client); ++ struct dw9719_device *dw9719 = container_of(sd, struct dw9719_device, ++ sd); ++ ++ pm_runtime_disable(&client->dev); ++ v4l2_async_unregister_subdev(sd); ++ v4l2_ctrl_handler_free(&dw9719->ctrls.handler); ++ media_entity_cleanup(&dw9719->sd.entity); ++ ++ return 0; ++} ++ ++static const struct i2c_device_id dw9719_id_table[] = { ++ { "dw9719" }, ++ { } ++}; ++MODULE_DEVICE_TABLE(i2c, dw9719_id_table); ++ ++static const struct dev_pm_ops dw9719_pm_ops = { ++ SET_RUNTIME_PM_OPS(dw9719_suspend, dw9719_resume, NULL) ++}; ++ ++static struct i2c_driver dw9719_i2c_driver = { ++ .driver = { ++ .name = "dw9719", ++ .pm = &dw9719_pm_ops, ++ }, ++ .probe_new = dw9719_probe, ++ .remove = dw9719_remove, ++ .id_table = dw9719_id_table, ++}; ++module_i2c_driver(dw9719_i2c_driver); ++ ++MODULE_AUTHOR("Daniel Scally "); ++MODULE_DESCRIPTION("DW9719 VCM Driver"); ++MODULE_LICENSE("GPL"); +-- +2.36.0 + diff --git a/patches/5.17/0012-amd-gpio.patch b/patches/5.17/0012-amd-gpio.patch index b47d247a3..0bbc937f3 100644 --- a/patches/5.17/0012-amd-gpio.patch +++ b/patches/5.17/0012-amd-gpio.patch @@ -1,4 +1,4 @@ -From 2bd2d24b1a9f413760ef333262833def4c4c7ab2 Mon Sep 17 00:00:00 2001 +From 55d5ac979adfe7c8fdbe95a52f7a723f7891b893 Mon Sep 17 00:00:00 2001 From: Sachi King Date: Sat, 29 May 2021 17:47:38 +1000 Subject: [PATCH] ACPI: Add quirk for Surface Laptop 4 AMD missing irq 7 @@ -65,7 +65,7 @@ index 0d01e7f5078c..2b06cf5f2b1f 100644 -- 2.36.0 -From 4413582ad25091f1ff7c163c97f938550430834a Mon Sep 17 00:00:00 2001 +From f88b7e0091e3407e14337b25cc6263228ace9a57 Mon Sep 17 00:00:00 2001 From: Maximilian Luz Date: Thu, 3 Jun 2021 14:04:26 +0200 Subject: [PATCH] ACPI: Add AMD 13" Surface Laptop 4 model to irq 7 override