aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKoen Vandeputte <koen.vandeputte@ncentric.com>2019-07-29 17:54:16 +0200
committerKoen Vandeputte <koen.vandeputte@ncentric.com>2019-07-31 16:51:46 +0200
commitc7634180fc8104e2f770f2efbe77b5235514fd75 (patch)
tree28a18c68ae756496f132658b94d9445393738e4d
parent1d45ed1477571d0dd3d7d39dd9b45d2a05c57a0a (diff)
downloadupstream-c7634180fc8104e2f770f2efbe77b5235514fd75.tar.gz
upstream-c7634180fc8104e2f770f2efbe77b5235514fd75.tar.bz2
upstream-c7634180fc8104e2f770f2efbe77b5235514fd75.zip
kernel: bump 4.19 to 4.19.62
Refreshed all patches. Remove upstreamed: - 023-0013-crypto-crypto4xx-fix-AES-CTR-blocksize-value.patch - 023-0014-crypto-crypto4xx-fix-blocksize-for-cfb-and-ofb.patch - 023-0015-crypto-crypto4xx-block-ciphers-should-only-accept-co.patch - 950-0252-staging-bcm2835_camera-Ensure-all-buffers-are-return.patch - 950-0253-staging-bcm2835-camera-Remove-check-of-the-number-of.patch - 950-0254-staging-bcm2835-camera-Handle-empty-EOS-buffers-whil.patch - 950-0489-staging-mmal-vchiq-Replace-spinlock-protecting-conte.patch - 0021-ARM-dts-gemini-Fix-up-DNS-313-compatible-string.patch - 049-v4.20-mips-remove-superfluous-check-for-linux.patch - 100-MIPS-fix-build-on-non-linux-hosts.patch - 303-MIPS-Fix-bounds-check-virt_addr_valid.patch - 0002-usb-dwc2-use-a-longer-AHB-idle-timeout-in-dwc2_core_.patch Altered patches: - 950-0267-staging-vc04_services-Split-vchiq-mmal-into-a-module.patch - 700-net-add-qualcomm-mdio-and-phy.patch Fixes: - CVE-2019-3846 New symbol: - AX88796B_PHY Compile-tested on: cns3xxx, imx6 Runtime-tested on: cns3xxx, imx6 Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
-rw-r--r--include/kernel-version.mk4
-rw-r--r--target/linux/apm821xx/patches-4.19/023-0003-crypto-drop-mask-CRYPTO_ALG_ASYNC-from-cipher-tfm-al.patch2
-rw-r--r--target/linux/apm821xx/patches-4.19/023-0013-crypto-crypto4xx-fix-AES-CTR-blocksize-value.patch60
-rw-r--r--target/linux/apm821xx/patches-4.19/023-0014-crypto-crypto4xx-fix-blocksize-for-cfb-and-ofb.patch44
-rw-r--r--target/linux/apm821xx/patches-4.19/023-0015-crypto-crypto4xx-block-ciphers-should-only-accept-co.patch172
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0040-Add-dwc_otg-driver.patch2
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0104-mcp2515-Use-DT-supplied-interrupt-flags.patch2
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0129-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch2
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0168-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch2
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0228-staging-bcm2835-camera-Move-module-info-to-the-end.patch2
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0235-staging-bcm2835-camera-Provide-more-specific-probe-e.patch20
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0236-staging-bcm2835-camera-Add-hint-about-possible-fault.patch2
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0237-staging-bcm2835-Don-t-probe-if-no-camera-is-detected.patch4
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0239-staging-bcm2835-camera-Do-not-bulk-receive-from-serv.patch22
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0240-staging-bcm2835-camera-Ensure-H264-header-bytes-get-.patch6
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0241-staging-bcm2835-camera-Correctly-denote-key-frames-i.patch2
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0242-staging-bcm2835-camera-Return-early-on-errors.patch10
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0246-staging-bcm2835-camera-Reduce-length-of-enum-names.patch48
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0247-staging-bcm2835-camera-Fix-multiple-line-dereference.patch16
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0248-staging-bcm2835-camera-Fix-brace-style-issues.patch4
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0250-staging-bcm2835-camera-Fix-logical-continuation-spli.patch6
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0251-staging-bcm2835-camera-Fix-open-parenthesis-alignmen.patch14
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0252-staging-bcm2835_camera-Ensure-all-buffers-are-return.patch95
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0253-staging-bcm2835-camera-Remove-check-of-the-number-of.patch39
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0254-staging-bcm2835-camera-Handle-empty-EOS-buffers-whil.patch84
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0267-staging-vc04_services-Split-vchiq-mmal-into-a-module.patch1916
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0268-staging-mmal-vchiq-Allocate-and-free-components-as-r.patch14
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0269-staging-mmal-vchiq-Avoid-use-of-bool-in-structures.patch12
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0270-staging-mmal-vchiq-Make-timeout-a-defined-parameter.patch2
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0271-staging-mmal-vchiq-Make-a-mmal_buf-struct-for-passin.patch4
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0272-staging-mmal-vchiq-Add-support-for-event-callbacks.patch24
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0273-staging-vc04_services-Support-sending-data-to-MMAL-p.patch2
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0277-staging-vc04_services-Use-vc-sm-cma-to-support-zero-.patch10
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0278-media-videobuf2-Allow-exporting-of-a-struct-dmabuf.patch4
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0285-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch4
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0319-staging-mmal-vchiq-Fix-client_component-for-64-bit-k.patch6
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0346-staging-vc-sm-cma-Use-a-void-pointer-as-the-handle-w.patch2
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0359-staging-mmal-vchiq-Always-return-the-param-size-from.patch2
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0360-staging-mmal-vchiq-If-the-VPU-returns-an-error-don-t.patch2
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0364-staging-bcm2835_codec-Fix-handling-of-VB2_MEMORY_DMA.patch4
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0488-staging-mmal-vchiq-Free-the-event-context-for-contro.patch2
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0489-staging-mmal-vchiq-Replace-spinlock-protecting-conte.patch67
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0548-bcmgenet-Better-coalescing-parameter-defaults.patch2
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0696-Revert-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-bu.patch4
-rw-r--r--target/linux/brcm2708/patches-4.19/950-0699-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch2
-rw-r--r--target/linux/brcm47xx/patches-4.19/159-cpu_fixes.patch10
-rw-r--r--target/linux/gemini/patches-4.19/0021-ARM-dts-gemini-Fix-up-DNS-313-compatible-string.patch21
-rw-r--r--target/linux/generic/backport-4.19/049-v4.20-mips-remove-superfluous-check-for-linux.patch47
-rw-r--r--target/linux/generic/backport-4.19/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch4
-rw-r--r--target/linux/generic/backport-4.19/343-netfilter-nft_flow_offload-handle-netdevice-events-f.patch2
-rw-r--r--target/linux/generic/backport-4.19/366-netfilter-nf_flow_table-clean-up-and-fix-dst-handlin.patch10
-rw-r--r--target/linux/generic/config-4.192
-rw-r--r--target/linux/generic/hack-4.19/259-regmap_dynamic.patch2
-rw-r--r--target/linux/generic/hack-4.19/640-bridge-only-accept-EAP-locally.patch2
-rw-r--r--target/linux/generic/hack-4.19/647-netfilter-flow-acct.patch4
-rw-r--r--target/linux/generic/hack-4.19/661-use_fq_codel_by_default.patch4
-rw-r--r--target/linux/generic/hack-4.19/702-phy_add_aneg_done_function.patch2
-rw-r--r--target/linux/generic/hack-4.19/902-debloat_proc.patch2
-rw-r--r--target/linux/generic/hack-4.19/904-debloat_dma_buf.patch2
-rw-r--r--target/linux/generic/pending-4.19/100-MIPS-fix-build-on-non-linux-hosts.patch55
-rw-r--r--target/linux/generic/pending-4.19/150-bridge_allow_receiption_on_disabled_port.patch4
-rw-r--r--target/linux/generic/pending-4.19/302-mips_no_branch_likely.patch2
-rw-r--r--target/linux/generic/pending-4.19/303-MIPS-Fix-bounds-check-virt_addr_valid.patch33
-rw-r--r--target/linux/generic/pending-4.19/304-mips_disable_fpu.patch2
-rw-r--r--target/linux/generic/pending-4.19/305-mips_module_reloc.patch2
-rw-r--r--target/linux/generic/pending-4.19/308-mips32r2_tune.patch2
-rw-r--r--target/linux/generic/pending-4.19/640-netfilter-nf_flow_table-add-hardware-offload-support.patch2
-rw-r--r--target/linux/generic/pending-4.19/703-phy-add-detach-callback-to-struct-phy_driver.patch2
-rw-r--r--target/linux/ipq40xx/patches-4.19/700-net-add-qualcomm-mdio-and-phy.patch2
-rw-r--r--target/linux/lantiq/patches-4.19/0002-usb-dwc2-use-a-longer-AHB-idle-timeout-in-dwc2_core_.patch35
-rw-r--r--target/linux/mvebu/patches-4.19/406-sfp-add-sfp-compatible.patch2
-rw-r--r--target/linux/mvebu/patches-4.19/407-sfp-display-SFP-module-information.patch6
-rw-r--r--target/linux/mvebu/patches-4.19/408-sfp-more-cotsworks-fixes.patch4
-rw-r--r--target/linux/mvebu/patches-4.19/450-reprobe_sfp_phy.patch10
74 files changed, 187 insertions, 2839 deletions
diff --git a/include/kernel-version.mk b/include/kernel-version.mk
index 5e6356dfa4..93b482fc75 100644
--- a/include/kernel-version.mk
+++ b/include/kernel-version.mk
@@ -8,11 +8,11 @@ endif
LINUX_VERSION-4.9 = .186
LINUX_VERSION-4.14 = .134
-LINUX_VERSION-4.19 = .57
+LINUX_VERSION-4.19 = .62
LINUX_KERNEL_HASH-4.9.186 = 242484430d0729791d8efd92181b7d34b4021050646c6e00cf459866eab94b6a
LINUX_KERNEL_HASH-4.14.134 = 0b21e7b5effd92303a551b5be2380c9703d6fb87cfe5189fe0d795cc73903d2d
-LINUX_KERNEL_HASH-4.19.57 = 327c5759d5888361d6c9d6adb0c8ad7e3c624eb05bb9e5869d9f3078dd0d3f87
+LINUX_KERNEL_HASH-4.19.62 = 07be647189ced7eb8ba5ee769906e67919975772184842cc517f609df50cdadc
remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))
diff --git a/target/linux/apm821xx/patches-4.19/023-0003-crypto-drop-mask-CRYPTO_ALG_ASYNC-from-cipher-tfm-al.patch b/target/linux/apm821xx/patches-4.19/023-0003-crypto-drop-mask-CRYPTO_ALG_ASYNC-from-cipher-tfm-al.patch
index bb1f406476..36aeb33d59 100644
--- a/target/linux/apm821xx/patches-4.19/023-0003-crypto-drop-mask-CRYPTO_ALG_ASYNC-from-cipher-tfm-al.patch
+++ b/target/linux/apm821xx/patches-4.19/023-0003-crypto-drop-mask-CRYPTO_ALG_ASYNC-from-cipher-tfm-al.patch
@@ -22,7 +22,7 @@ Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
--- a/drivers/crypto/amcc/crypto4xx_alg.c
+++ b/drivers/crypto/amcc/crypto4xx_alg.c
-@@ -526,8 +526,7 @@ static int crypto4xx_compute_gcm_hash_ke
+@@ -540,8 +540,7 @@ static int crypto4xx_compute_gcm_hash_ke
uint8_t src[16] = { 0 };
int rc = 0;
diff --git a/target/linux/apm821xx/patches-4.19/023-0013-crypto-crypto4xx-fix-AES-CTR-blocksize-value.patch b/target/linux/apm821xx/patches-4.19/023-0013-crypto-crypto4xx-fix-AES-CTR-blocksize-value.patch
deleted file mode 100644
index a6fa84d962..0000000000
--- a/target/linux/apm821xx/patches-4.19/023-0013-crypto-crypto4xx-fix-AES-CTR-blocksize-value.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From bfa2ba7d9e6b20aca82b99e6842fe18842ae3a0f Mon Sep 17 00:00:00 2001
-From: Christian Lamparter <chunkeey@gmail.com>
-Date: Fri, 17 May 2019 23:15:57 +0200
-Subject: [PATCH 13/15] crypto: crypto4xx - fix AES CTR blocksize value
-
-This patch fixes a issue with crypto4xx's ctr(aes) that was
-discovered by libcapi's kcapi-enc-test.sh test.
-
-The some of the ctr(aes) encryptions test were failing on the
-non-power-of-two test:
-
-kcapi-enc - Error: encryption failed with error 0
-kcapi-enc - Error: decryption failed with error 0
-[FAILED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (128 bits):
-original file (1d100e..cc96184c) and generated file (e3b0c442..1b7852b855)
-[FAILED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (128 bits)
-(openssl generated CT): original file (e3b0..5) and generated file (3..8e)
-[PASSED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (128 bits)
-(openssl generated PT)
-[FAILED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (password):
-original file (1d1..84c) and generated file (e3b..852b855)
-
-But the 16, 32, 512, 65536 tests always worked.
-
-Thankfully, this isn't a hidden hardware problem like previously,
-instead this turned out to be a copy and paste issue.
-
-With this patch, all the tests are passing with and
-kcapi-enc-test.sh gives crypto4xx's a clean bill of health:
- "Number of failures: 0" :).
-
-Cc: stable@vger.kernel.org
-Fixes: 98e87e3d933b ("crypto: crypto4xx - add aes-ctr support")
-Fixes: f2a13e7cba9e ("crypto: crypto4xx - enable AES RFC3686, ECB, CFB and OFB offloads")
-Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
-Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
----
- drivers/crypto/amcc/crypto4xx_core.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
---- a/drivers/crypto/amcc/crypto4xx_core.c
-+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -1257,7 +1257,7 @@ static struct crypto4xx_alg_common crypt
- .cra_flags = CRYPTO_ALG_NEED_FALLBACK |
- CRYPTO_ALG_ASYNC |
- CRYPTO_ALG_KERN_DRIVER_ONLY,
-- .cra_blocksize = AES_BLOCK_SIZE,
-+ .cra_blocksize = 1,
- .cra_ctxsize = sizeof(struct crypto4xx_ctx),
- .cra_module = THIS_MODULE,
- },
-@@ -1277,7 +1277,7 @@ static struct crypto4xx_alg_common crypt
- .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
- .cra_flags = CRYPTO_ALG_ASYNC |
- CRYPTO_ALG_KERN_DRIVER_ONLY,
-- .cra_blocksize = AES_BLOCK_SIZE,
-+ .cra_blocksize = 1,
- .cra_ctxsize = sizeof(struct crypto4xx_ctx),
- .cra_module = THIS_MODULE,
- },
diff --git a/target/linux/apm821xx/patches-4.19/023-0014-crypto-crypto4xx-fix-blocksize-for-cfb-and-ofb.patch b/target/linux/apm821xx/patches-4.19/023-0014-crypto-crypto4xx-fix-blocksize-for-cfb-and-ofb.patch
deleted file mode 100644
index 16f5af2c46..0000000000
--- a/target/linux/apm821xx/patches-4.19/023-0014-crypto-crypto4xx-fix-blocksize-for-cfb-and-ofb.patch
+++ /dev/null
@@ -1,44 +0,0 @@
-From 70c4997f34b6c6888b3ac157adec49e01d0df2d5 Mon Sep 17 00:00:00 2001
-From: Christian Lamparter <chunkeey@gmail.com>
-Date: Sat, 18 May 2019 23:28:11 +0200
-Subject: [PATCH 14/15] crypto: crypto4xx - fix blocksize for cfb and ofb
-
-While the hardware consider them to be blockciphers, the
-reference implementation defines them as streamciphers.
-
-Do the right thing and set the blocksize to 1. This
-was found by CONFIG_CRYPTO_MANAGER_EXTRA_TESTS.
-
-This fixes the following issues:
-skcipher: blocksize for ofb-aes-ppc4xx (16) doesn't match generic impl (1)
-skcipher: blocksize for cfb-aes-ppc4xx (16) doesn't match generic impl (1)
-
-Cc: Eric Biggers <ebiggers@kernel.org>
-Cc: stable@vger.kernel.org
-Fixes: f2a13e7cba9e ("crypto: crypto4xx - enable AES RFC3686, ECB, CFB and OFB offloads")
-Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
-Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
----
- drivers/crypto/amcc/crypto4xx_core.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
---- a/drivers/crypto/amcc/crypto4xx_core.c
-+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -1236,7 +1236,7 @@ static struct crypto4xx_alg_common crypt
- .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
- .cra_flags = CRYPTO_ALG_ASYNC |
- CRYPTO_ALG_KERN_DRIVER_ONLY,
-- .cra_blocksize = AES_BLOCK_SIZE,
-+ .cra_blocksize = 1,
- .cra_ctxsize = sizeof(struct crypto4xx_ctx),
- .cra_module = THIS_MODULE,
- },
-@@ -1316,7 +1316,7 @@ static struct crypto4xx_alg_common crypt
- .cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
- .cra_flags = CRYPTO_ALG_ASYNC |
- CRYPTO_ALG_KERN_DRIVER_ONLY,
-- .cra_blocksize = AES_BLOCK_SIZE,
-+ .cra_blocksize = 1,
- .cra_ctxsize = sizeof(struct crypto4xx_ctx),
- .cra_module = THIS_MODULE,
- },
diff --git a/target/linux/apm821xx/patches-4.19/023-0015-crypto-crypto4xx-block-ciphers-should-only-accept-co.patch b/target/linux/apm821xx/patches-4.19/023-0015-crypto-crypto4xx-block-ciphers-should-only-accept-co.patch
deleted file mode 100644
index 2706042f67..0000000000
--- a/target/linux/apm821xx/patches-4.19/023-0015-crypto-crypto4xx-block-ciphers-should-only-accept-co.patch
+++ /dev/null
@@ -1,172 +0,0 @@
-From 0f7a81374060828280fcfdfbaa162cb559017f9f Mon Sep 17 00:00:00 2001
-From: Christian Lamparter <chunkeey@gmail.com>
-Date: Sat, 18 May 2019 23:28:12 +0200
-Subject: [PATCH 15/15] crypto: crypto4xx - block ciphers should only accept
- complete blocks
-
-The hardware automatically zero pads incomplete block ciphers
-blocks without raising any errors. This is a screw-up. This
-was noticed by CONFIG_CRYPTO_MANAGER_EXTRA_TESTS tests that
-sent a incomplete blocks and expect them to fail.
-
-This fixes:
-cbc-aes-ppc4xx encryption unexpectedly succeeded on test vector
-"random: len=2409 klen=32"; expected_error=-22, cfg="random:
-may_sleep use_digest src_divs=[96.90%@+2295, 2.34%@+4066,
-0.32%@alignmask+12, 0.34%@+4087, 0.9%@alignmask+1787, 0.1%@+3767]
-iv_offset=6"
-
-ecb-aes-ppc4xx encryption unexpectedly succeeded on test vector
-"random: len=1011 klen=32"; expected_error=-22, cfg="random:
-may_sleep use_digest src_divs=[100.0%@alignmask+20]
-dst_divs=[3.12%@+3001, 96.88%@+4070]"
-
-Cc: Eric Biggers <ebiggers@kernel.org>
-Cc: stable@vger.kernel.org [4.19, 5.0 and 5.1]
-Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
-Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
----
- drivers/crypto/amcc/crypto4xx_alg.c | 36 +++++++++++++++++++---------
- drivers/crypto/amcc/crypto4xx_core.c | 16 ++++++-------
- drivers/crypto/amcc/crypto4xx_core.h | 10 ++++----
- 3 files changed, 39 insertions(+), 23 deletions(-)
-
---- a/drivers/crypto/amcc/crypto4xx_alg.c
-+++ b/drivers/crypto/amcc/crypto4xx_alg.c
-@@ -76,12 +76,16 @@ static void set_dynamic_sa_command_1(str
- }
-
- static inline int crypto4xx_crypt(struct skcipher_request *req,
-- const unsigned int ivlen, bool decrypt)
-+ const unsigned int ivlen, bool decrypt,
-+ bool check_blocksize)
- {
- struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(req);
- struct crypto4xx_ctx *ctx = crypto_skcipher_ctx(cipher);
- __le32 iv[AES_IV_SIZE];
-
-+ if (check_blocksize && !IS_ALIGNED(req->cryptlen, AES_BLOCK_SIZE))
-+ return -EINVAL;
-+
- if (ivlen)
- crypto4xx_memcpy_to_le32(iv, req->iv, ivlen);
-
-@@ -90,24 +94,34 @@ static inline int crypto4xx_crypt(struct
- ctx->sa_len, 0, NULL);
- }
-
--int crypto4xx_encrypt_noiv(struct skcipher_request *req)
-+int crypto4xx_encrypt_noiv_block(struct skcipher_request *req)
-+{
-+ return crypto4xx_crypt(req, 0, false, true);
-+}
-+
-+int crypto4xx_encrypt_iv_stream(struct skcipher_request *req)
-+{
-+ return crypto4xx_crypt(req, AES_IV_SIZE, false, false);
-+}
-+
-+int crypto4xx_decrypt_noiv_block(struct skcipher_request *req)
- {
-- return crypto4xx_crypt(req, 0, false);
-+ return crypto4xx_crypt(req, 0, true, true);
- }
-
--int crypto4xx_encrypt_iv(struct skcipher_request *req)
-+int crypto4xx_decrypt_iv_stream(struct skcipher_request *req)
- {
-- return crypto4xx_crypt(req, AES_IV_SIZE, false);
-+ return crypto4xx_crypt(req, AES_IV_SIZE, true, false);
- }
-
--int crypto4xx_decrypt_noiv(struct skcipher_request *req)
-+int crypto4xx_encrypt_iv_block(struct skcipher_request *req)
- {
-- return crypto4xx_crypt(req, 0, true);
-+ return crypto4xx_crypt(req, AES_IV_SIZE, false, true);
- }
-
--int crypto4xx_decrypt_iv(struct skcipher_request *req)
-+int crypto4xx_decrypt_iv_block(struct skcipher_request *req)
- {
-- return crypto4xx_crypt(req, AES_IV_SIZE, true);
-+ return crypto4xx_crypt(req, AES_IV_SIZE, true, true);
- }
-
- /**
-@@ -278,8 +292,8 @@ crypto4xx_ctr_crypt(struct skcipher_requ
- return ret;
- }
-
-- return encrypt ? crypto4xx_encrypt_iv(req)
-- : crypto4xx_decrypt_iv(req);
-+ return encrypt ? crypto4xx_encrypt_iv_stream(req)
-+ : crypto4xx_decrypt_iv_stream(req);
- }
-
- static int crypto4xx_sk_setup_fallback(struct crypto4xx_ctx *ctx,
---- a/drivers/crypto/amcc/crypto4xx_core.c
-+++ b/drivers/crypto/amcc/crypto4xx_core.c
-@@ -1224,8 +1224,8 @@ static struct crypto4xx_alg_common crypt
- .max_keysize = AES_MAX_KEY_SIZE,
- .ivsize = AES_IV_SIZE,
- .setkey = crypto4xx_setkey_aes_cbc,
-- .encrypt = crypto4xx_encrypt_iv,
-- .decrypt = crypto4xx_decrypt_iv,
-+ .encrypt = crypto4xx_encrypt_iv_block,
-+ .decrypt = crypto4xx_decrypt_iv_block,
- .init = crypto4xx_sk_init,
- .exit = crypto4xx_sk_exit,
- } },
-@@ -1244,8 +1244,8 @@ static struct crypto4xx_alg_common crypt
- .max_keysize = AES_MAX_KEY_SIZE,
- .ivsize = AES_IV_SIZE,
- .setkey = crypto4xx_setkey_aes_cfb,
-- .encrypt = crypto4xx_encrypt_iv,
-- .decrypt = crypto4xx_decrypt_iv,
-+ .encrypt = crypto4xx_encrypt_iv_stream,
-+ .decrypt = crypto4xx_decrypt_iv_stream,
- .init = crypto4xx_sk_init,
- .exit = crypto4xx_sk_exit,
- } },
-@@ -1304,8 +1304,8 @@ static struct crypto4xx_alg_common crypt
- .min_keysize = AES_MIN_KEY_SIZE,
- .max_keysize = AES_MAX_KEY_SIZE,
- .setkey = crypto4xx_setkey_aes_ecb,
-- .encrypt = crypto4xx_encrypt_noiv,
-- .decrypt = crypto4xx_decrypt_noiv,
-+ .encrypt = crypto4xx_encrypt_noiv_block,
-+ .decrypt = crypto4xx_decrypt_noiv_block,
- .init = crypto4xx_sk_init,
- .exit = crypto4xx_sk_exit,
- } },
-@@ -1324,8 +1324,8 @@ static struct crypto4xx_alg_common crypt
- .max_keysize = AES_MAX_KEY_SIZE,
- .ivsize = AES_IV_SIZE,
- .setkey = crypto4xx_setkey_aes_ofb,
-- .encrypt = crypto4xx_encrypt_iv,
-- .decrypt = crypto4xx_decrypt_iv,
-+ .encrypt = crypto4xx_encrypt_iv_stream,
-+ .decrypt = crypto4xx_decrypt_iv_stream,
- .init = crypto4xx_sk_init,
- .exit = crypto4xx_sk_exit,
- } },
---- a/drivers/crypto/amcc/crypto4xx_core.h
-+++ b/drivers/crypto/amcc/crypto4xx_core.h
-@@ -182,10 +182,12 @@ int crypto4xx_setkey_rfc3686(struct cryp
- const u8 *key, unsigned int keylen);
- int crypto4xx_encrypt_ctr(struct skcipher_request *req);
- int crypto4xx_decrypt_ctr(struct skcipher_request *req);
--int crypto4xx_encrypt_iv(struct skcipher_request *req);
--int crypto4xx_decrypt_iv(struct skcipher_request *req);
--int crypto4xx_encrypt_noiv(struct skcipher_request *req);
--int crypto4xx_decrypt_noiv(struct skcipher_request *req);
-+int crypto4xx_encrypt_iv_stream(struct skcipher_request *req);
-+int crypto4xx_decrypt_iv_stream(struct skcipher_request *req);
-+int crypto4xx_encrypt_iv_block(struct skcipher_request *req);
-+int crypto4xx_decrypt_iv_block(struct skcipher_request *req);
-+int crypto4xx_encrypt_noiv_block(struct skcipher_request *req);
-+int crypto4xx_decrypt_noiv_block(struct skcipher_request *req);
- int crypto4xx_rfc3686_encrypt(struct skcipher_request *req);
- int crypto4xx_rfc3686_decrypt(struct skcipher_request *req);
- int crypto4xx_sha1_alg_init(struct crypto_tfm *tfm);
diff --git a/target/linux/brcm2708/patches-4.19/950-0040-Add-dwc_otg-driver.patch b/target/linux/brcm2708/patches-4.19/950-0040-Add-dwc_otg-driver.patch
index 8f0fe55966..d32a187b8a 100644
--- a/target/linux/brcm2708/patches-4.19/950-0040-Add-dwc_otg-driver.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0040-Add-dwc_otg-driver.patch
@@ -917,7 +917,7 @@ Fixes https://github.com/raspberrypi/linux/issues/2408
}
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
-@@ -5207,7 +5207,7 @@ static void port_event(struct usb_hub *h
+@@ -5210,7 +5210,7 @@ static void port_event(struct usb_hub *h
u16 status = 0, unused;
port_dev->over_current_count++;
diff --git a/target/linux/brcm2708/patches-4.19/950-0104-mcp2515-Use-DT-supplied-interrupt-flags.patch b/target/linux/brcm2708/patches-4.19/950-0104-mcp2515-Use-DT-supplied-interrupt-flags.patch
index 14fe567977..51add31636 100644
--- a/target/linux/brcm2708/patches-4.19/950-0104-mcp2515-Use-DT-supplied-interrupt-flags.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0104-mcp2515-Use-DT-supplied-interrupt-flags.patch
@@ -24,7 +24,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
--- a/drivers/net/can/spi/mcp251x.c
+++ b/drivers/net/can/spi/mcp251x.c
-@@ -951,6 +951,9 @@ static int mcp251x_open(struct net_devic
+@@ -950,6 +950,9 @@ static int mcp251x_open(struct net_devic
priv->tx_skb = NULL;
priv->tx_len = 0;
diff --git a/target/linux/brcm2708/patches-4.19/950-0129-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch b/target/linux/brcm2708/patches-4.19/950-0129-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch
index 56d83405ad..08c38d7430 100644
--- a/target/linux/brcm2708/patches-4.19/950-0129-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0129-gpiolib-Don-t-prevent-IRQ-usage-of-output-GPIOs.patch
@@ -35,7 +35,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
gpiod_err(desc,
"%s: tried to set a GPIO tied to an IRQ as output\n",
__func__);
-@@ -3311,7 +3313,7 @@ int gpiochip_lock_as_irq(struct gpio_chi
+@@ -3312,7 +3314,7 @@ int gpiochip_lock_as_irq(struct gpio_chi
}
}
diff --git a/target/linux/brcm2708/patches-4.19/950-0168-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch b/target/linux/brcm2708/patches-4.19/950-0168-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch
index f249909704..840969667a 100644
--- a/target/linux/brcm2708/patches-4.19/950-0168-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0168-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch
@@ -472,7 +472,7 @@ Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+MODULE_LICENSE("GPL");
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
-@@ -232,6 +232,9 @@
+@@ -233,6 +233,9 @@
#define USB_VENDOR_ID_BETOP_2185V2PC 0x8380
#define USB_VENDOR_ID_BETOP_2185V2BFM 0x20bc
diff --git a/target/linux/brcm2708/patches-4.19/950-0228-staging-bcm2835-camera-Move-module-info-to-the-end.patch b/target/linux/brcm2708/patches-4.19/950-0228-staging-bcm2835-camera-Move-module-info-to-the-end.patch
index d743c6a99c..d3212a0067 100644
--- a/target/linux/brcm2708/patches-4.19/950-0228-staging-bcm2835-camera-Move-module-info-to-the-end.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0228-staging-bcm2835-camera-Move-module-info-to-the-end.patch
@@ -26,7 +26,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
int bcm2835_v4l2_debug;
module_param_named(debug, bcm2835_v4l2_debug, int, 0644);
MODULE_PARM_DESC(bcm2835_v4l2_debug, "Debug level 0-2");
-@@ -1967,3 +1961,9 @@ static struct platform_driver bcm2835_ca
+@@ -1980,3 +1974,9 @@ static struct platform_driver bcm2835_ca
};
module_platform_driver(bcm2835_camera_driver)
diff --git a/target/linux/brcm2708/patches-4.19/950-0235-staging-bcm2835-camera-Provide-more-specific-probe-e.patch b/target/linux/brcm2708/patches-4.19/950-0235-staging-bcm2835-camera-Provide-more-specific-probe-e.patch
index e8e3c311ef..c346816db5 100644
--- a/target/linux/brcm2708/patches-4.19/950-0235-staging-bcm2835-camera-Provide-more-specific-probe-e.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0235-staging-bcm2835-camera-Provide-more-specific-probe-e.patch
@@ -15,7 +15,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
-@@ -1539,8 +1539,11 @@ static int mmal_init(struct bm2835_mmal_
+@@ -1552,8 +1552,11 @@ static int mmal_init(struct bm2835_mmal_
struct vchiq_mmal_component *camera;
ret = vchiq_mmal_init(&dev->instance);
@@ -28,7 +28,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
/* get the camera component ready */
ret = vchiq_mmal_component_init(dev->instance, "ril.camera",
-@@ -1549,7 +1552,9 @@ static int mmal_init(struct bm2835_mmal_
+@@ -1562,7 +1565,9 @@ static int mmal_init(struct bm2835_mmal_
goto unreg_mmal;
camera = dev->component[MMAL_COMPONENT_CAMERA];
@@ -39,7 +39,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
ret = -EINVAL;
goto unreg_camera;
}
-@@ -1557,8 +1562,11 @@ static int mmal_init(struct bm2835_mmal_
+@@ -1570,8 +1575,11 @@ static int mmal_init(struct bm2835_mmal_
ret = set_camera_parameters(dev->instance,
camera,
dev);
@@ -52,7 +52,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
/* There was an error in the firmware that meant the camera component
* produced BGR instead of RGB.
-@@ -1647,8 +1655,8 @@ static int mmal_init(struct bm2835_mmal_
+@@ -1660,8 +1668,8 @@ static int mmal_init(struct bm2835_mmal_
if (dev->component[MMAL_COMPONENT_PREVIEW]->inputs < 1) {
ret = -EINVAL;
@@ -63,7 +63,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
goto unreg_preview;
}
-@@ -1661,8 +1669,8 @@ static int mmal_init(struct bm2835_mmal_
+@@ -1674,8 +1682,8 @@ static int mmal_init(struct bm2835_mmal_
if (dev->component[MMAL_COMPONENT_IMAGE_ENCODE]->inputs < 1) {
ret = -EINVAL;
@@ -74,7 +74,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
1);
goto unreg_image_encoder;
}
-@@ -1676,8 +1684,8 @@ static int mmal_init(struct bm2835_mmal_
+@@ -1689,8 +1697,8 @@ static int mmal_init(struct bm2835_mmal_
if (dev->component[MMAL_COMPONENT_VIDEO_ENCODE]->inputs < 1) {
ret = -EINVAL;
@@ -85,7 +85,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
1);
goto unreg_vid_encoder;
}
-@@ -1706,8 +1714,11 @@ static int mmal_init(struct bm2835_mmal_
+@@ -1719,8 +1727,11 @@ static int mmal_init(struct bm2835_mmal_
sizeof(enable));
}
ret = bm2835_mmal_set_all_camera_controls(dev);
@@ -98,7 +98,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
return 0;
-@@ -1867,21 +1878,29 @@ static int bcm2835_mmal_probe(struct pla
+@@ -1880,21 +1891,29 @@ static int bcm2835_mmal_probe(struct pla
snprintf(dev->v4l2_dev.name, sizeof(dev->v4l2_dev.name),
"%s", BM2835_MMAL_MODULE_NAME);
ret = v4l2_device_register(NULL, &dev->v4l2_dev);
@@ -132,7 +132,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
/* initialize queue */
q = &dev->capture.vb_vidq;
memset(q, 0, sizeof(*q));
-@@ -1899,16 +1918,19 @@ static int bcm2835_mmal_probe(struct pla
+@@ -1912,16 +1931,19 @@ static int bcm2835_mmal_probe(struct pla
/* initialise video devices */
ret = bm2835_mmal_init_device(dev, &dev->vdev);
@@ -155,7 +155,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
goto unreg_dev;
}
-@@ -1932,8 +1954,6 @@ cleanup_gdev:
+@@ -1945,8 +1967,6 @@ cleanup_gdev:
bcm2835_cleanup_instance(gdev[i]);
gdev[i] = NULL;
}
diff --git a/target/linux/brcm2708/patches-4.19/950-0236-staging-bcm2835-camera-Add-hint-about-possible-fault.patch b/target/linux/brcm2708/patches-4.19/950-0236-staging-bcm2835-camera-Add-hint-about-possible-fault.patch
index 8091ea01dd..4cf38bcf2d 100644
--- a/target/linux/brcm2708/patches-4.19/950-0236-staging-bcm2835-camera-Add-hint-about-possible-fault.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0236-staging-bcm2835-camera-Add-hint-about-possible-fault.patch
@@ -16,7 +16,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
-@@ -1624,8 +1624,11 @@ int vchiq_mmal_component_init(struct vch
+@@ -1620,8 +1620,11 @@ int vchiq_mmal_component_init(struct vch
component = &instance->component[instance->component_idx];
ret = create_component(instance, component, name);
diff --git a/target/linux/brcm2708/patches-4.19/950-0237-staging-bcm2835-Don-t-probe-if-no-camera-is-detected.patch b/target/linux/brcm2708/patches-4.19/950-0237-staging-bcm2835-Don-t-probe-if-no-camera-is-detected.patch
index 0b8f0dcfa7..4e13404f59 100644
--- a/target/linux/brcm2708/patches-4.19/950-0237-staging-bcm2835-Don-t-probe-if-no-camera-is-detected.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0237-staging-bcm2835-Don-t-probe-if-no-camera-is-detected.patch
@@ -16,7 +16,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
-@@ -1847,6 +1847,12 @@ static int bcm2835_mmal_probe(struct pla
+@@ -1860,6 +1860,12 @@ static int bcm2835_mmal_probe(struct pla
num_cameras = get_num_cameras(instance,
resolutions,
MAX_BCM2835_CAMERAS);
@@ -29,7 +29,7 @@ Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
if (num_cameras > MAX_BCM2835_CAMERAS)
num_cameras = MAX_BCM2835_CAMERAS;
-@@ -1955,6 +1961,9 @@ cleanup_gdev:
+@@ -1968,6 +1974,9 @@ cleanup_gdev:
gdev[i] = NULL;
}
diff --git a/target/linux/brcm2708/patches-4.19/950-0239-staging-bcm2835-camera-Do-not-bulk-receive-from-serv.patch b/target/linux/brcm2708/patches-4.19/950-0239-staging-bcm2835-camera-Do-not-bulk-receive-from-serv.patch
index 99a960215c..0df004ca9a 100644
--- a/target/linux/brcm2708/patches-4.19/950-0239-staging-bcm2835-camera-Do-not-bulk-receive-from-serv.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0239-staging-bcm2835-camera-Do-not-bulk-receive-from-serv.patch
@@ -32,7 +32,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
/* mmal instance */
struct vchiq_mmal_instance *instance;
/* mmal port */
-@@ -167,6 +169,9 @@ struct vchiq_mmal_instance {
+@@ -168,6 +170,9 @@ struct vchiq_mmal_instance {
/* component to use next */
int component_idx;
struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS];
@@ -42,7 +42,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
};
static struct mmal_msg_context *
-@@ -248,7 +253,44 @@ static void buffer_work_cb(struct work_s
+@@ -251,7 +256,44 @@ static void buffer_work_cb(struct work_s
msg_context->u.bulk.mmal_flags,
msg_context->u.bulk.dts,
msg_context->u.bulk.pts);
@@ -87,7 +87,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
}
/* enqueue a bulk receive for a given message context */
-@@ -257,7 +299,6 @@ static int bulk_receive(struct vchiq_mma
+@@ -260,7 +302,6 @@ static int bulk_receive(struct vchiq_mma
struct mmal_msg_context *msg_context)
{
unsigned long rd_len;
@@ -95,7 +95,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
rd_len = msg->u.buffer_from_host.buffer_header.length;
-@@ -293,45 +334,10 @@ static int bulk_receive(struct vchiq_mma
+@@ -294,45 +335,10 @@ static int bulk_receive(struct vchiq_mma
msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts;
msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts;
@@ -144,16 +144,16 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
}
/* data in message, memcpy from packet into output buffer */
-@@ -379,6 +385,8 @@ buffer_from_host(struct vchiq_mmal_insta
+@@ -380,6 +386,8 @@ buffer_from_host(struct vchiq_mmal_insta
/* initialise work structure ready to schedule callback */
INIT_WORK(&msg_context->u.bulk.work, buffer_work_cb);
+ INIT_WORK(&msg_context->u.bulk.buffer_to_host_work,
+ buffer_to_host_work_cb);
- /* prep the buffer from host message */
- memset(&m, 0xbc, sizeof(m)); /* just to make debug clearer */
-@@ -459,7 +467,7 @@ static void buffer_to_host_cb(struct vch
+ atomic_inc(&port->buffers_with_vpu);
+
+@@ -465,7 +473,7 @@ static void buffer_to_host_cb(struct vch
if (msg->u.buffer_from_host.buffer_header.flags &
MMAL_BUFFER_HEADER_FLAG_EOS) {
msg_context->u.bulk.status =
@@ -162,7 +162,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
if (msg_context->u.bulk.status == 0)
return; /* successful bulk submission, bulk
* completion will trigger callback
-@@ -1793,6 +1801,9 @@ int vchiq_mmal_finalise(struct vchiq_mma
+@@ -1789,6 +1797,9 @@ int vchiq_mmal_finalise(struct vchiq_mma
mutex_unlock(&instance->vchiq_mutex);
@@ -172,7 +172,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
vfree(instance->bulk_scratch);
idr_destroy(&instance->context_map);
-@@ -1862,6 +1873,11 @@ int vchiq_mmal_init(struct vchiq_mmal_in
+@@ -1858,6 +1869,11 @@ int vchiq_mmal_init(struct vchiq_mmal_in
params.callback_param = instance;
@@ -184,7 +184,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
status = vchi_service_open(vchi_instance, &params, &instance->handle);
if (status) {
pr_err("Failed to open VCHI service connection (status=%d)\n",
-@@ -1876,8 +1892,9 @@ int vchiq_mmal_init(struct vchiq_mmal_in
+@@ -1872,8 +1888,9 @@ int vchiq_mmal_init(struct vchiq_mmal_in
return 0;
err_close_services:
diff --git a/target/linux/brcm2708/patches-4.19/950-0240-staging-bcm2835-camera-Ensure-H264-header-bytes-get-.patch b/target/linux/brcm2708/patches-4.19/950-0240-staging-bcm2835-camera-Ensure-H264-header-bytes-get-.patch
index 1cf56b22d3..3322a7ba52 100644
--- a/target/linux/brcm2708/patches-4.19/950-0240-staging-bcm2835-camera-Ensure-H264-header-bytes-get-.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0240-staging-bcm2835-camera-Ensure-H264-header-bytes-get-.patch
@@ -20,7 +20,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
-@@ -360,8 +360,13 @@ static void buffer_cb(struct vchiq_mmal_
+@@ -363,8 +363,13 @@ static void buffer_cb(struct vchiq_mmal_
}
} else {
if (dev->capture.frame_count) {
@@ -36,7 +36,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
ktime_t timestamp;
s64 runtime_us = pts -
dev->capture.vc_start_timestamp;
-@@ -374,10 +379,28 @@ static void buffer_cb(struct vchiq_mmal_
+@@ -377,10 +382,28 @@ static void buffer_cb(struct vchiq_mmal_
ktime_to_ns(timestamp));
buf->vb.vb2_buf.timestamp = ktime_to_ns(timestamp);
} else {
@@ -66,7 +66,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
if (mmal_flags & MMAL_BUFFER_HEADER_FLAG_EOS &&
-@@ -543,6 +566,7 @@ static int start_streaming(struct vb2_qu
+@@ -546,6 +569,7 @@ static int start_streaming(struct vb2_qu
dev->capture.vc_start_timestamp, parameter_size);
dev->capture.kernel_start_ts = ktime_get();
diff --git a/target/linux/brcm2708/patches-4.19/950-0241-staging-bcm2835-camera-Correctly-denote-key-frames-i.patch b/target/linux/brcm2708/patches-4.19/950-0241-staging-bcm2835-camera-Correctly-denote-key-frames-i.patch
index 4e2269a667..df19dd3f8c 100644
--- a/target/linux/brcm2708/patches-4.19/950-0241-staging-bcm2835-camera-Correctly-denote-key-frames-i.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0241-staging-bcm2835-camera-Correctly-denote-key-frames-i.patch
@@ -13,7 +13,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
-@@ -398,6 +398,9 @@ static void buffer_cb(struct vchiq_mmal_
+@@ -401,6 +401,9 @@ static void buffer_cb(struct vchiq_mmal_
dev->capture.last_timestamp = buf->vb.vb2_buf.timestamp;
vb2_set_plane_payload(&buf->vb.vb2_buf, 0, length);
diff --git a/target/linux/brcm2708/patches-4.19/950-0242-staging-bcm2835-camera-Return-early-on-errors.patch b/target/linux/brcm2708/patches-4.19/950-0242-staging-bcm2835-camera-Return-early-on-errors.patch
index 5dc558a7e3..5ccb2850d5 100644
--- a/target/linux/brcm2708/patches-4.19/950-0242-staging-bcm2835-camera-Return-early-on-errors.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0242-staging-bcm2835-camera-Return-early-on-errors.patch
@@ -24,10 +24,10 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
+
+ if (length == 0) {
/* stream ended */
- if (buf) {
- /* this should only ever happen if the port is
-@@ -358,71 +360,72 @@ static void buffer_cb(struct vchiq_mmal_
- /* signal frame completion */
+ if (dev->capture.frame_count) {
+ /* empty buffer whilst capturing - expected to be an
+@@ -361,71 +363,72 @@ static void buffer_cb(struct vchiq_mmal_
+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
complete(&dev->capture.frame_cmplt);
}
- } else {
@@ -158,7 +158,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
}
static int enable_camera(struct bm2835_mmal_dev *dev)
-@@ -802,27 +805,29 @@ static int vidioc_overlay(struct file *f
+@@ -815,27 +818,29 @@ static int vidioc_overlay(struct file *f
ret = vchiq_mmal_port_set_format(dev->instance, src);
if (ret < 0)
diff --git a/target/linux/brcm2708/patches-4.19/950-0246-staging-bcm2835-camera-Reduce-length-of-enum-names.patch b/target/linux/brcm2708/patches-4.19/950-0246-staging-bcm2835-camera-Reduce-length-of-enum-names.patch
index 033086e566..b480aa442e 100644
--- a/target/linux/brcm2708/patches-4.19/950-0246-staging-bcm2835-camera-Reduce-length-of-enum-names.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0246-staging-bcm2835-camera-Reduce-length-of-enum-names.patch
@@ -152,7 +152,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
}
static void buffer_cb(struct vchiq_mmal_instance *instance,
-@@ -436,7 +436,7 @@ static int enable_camera(struct bm2835_m
+@@ -439,7 +439,7 @@ static int enable_camera(struct bm2835_m
if (!dev->camera_use_count) {
ret = vchiq_mmal_port_parameter_set(
dev->instance,
@@ -161,7 +161,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num,
sizeof(dev->camera_num));
if (ret < 0) {
-@@ -447,7 +447,7 @@ static int enable_camera(struct bm2835_m
+@@ -450,7 +450,7 @@ static int enable_camera(struct bm2835_m
ret = vchiq_mmal_component_enable(
dev->instance,
@@ -170,7 +170,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
if (ret < 0) {
v4l2_err(&dev->v4l2_dev,
"Failed enabling camera, ret %d\n", ret);
-@@ -479,7 +479,7 @@ static int disable_camera(struct bm2835_
+@@ -482,7 +482,7 @@ static int disable_camera(struct bm2835_
ret =
vchiq_mmal_component_disable(
dev->instance,
@@ -179,7 +179,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
if (ret < 0) {
v4l2_err(&dev->v4l2_dev,
"Failed disabling camera, ret %d\n", ret);
-@@ -487,7 +487,7 @@ static int disable_camera(struct bm2835_
+@@ -490,7 +490,7 @@ static int disable_camera(struct bm2835_
}
vchiq_mmal_port_parameter_set(
dev->instance,
@@ -188,7 +188,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
MMAL_PARAMETER_CAMERA_NUM, &i,
sizeof(i));
}
-@@ -539,7 +539,7 @@ static int start_streaming(struct vb2_qu
+@@ -542,7 +542,7 @@ static int start_streaming(struct vb2_qu
/* if the preview is not already running, wait for a few frames for AGC
* to settle down.
*/
@@ -197,7 +197,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
msleep(300);
/* enable the connection from camera to encoder (if applicable) */
-@@ -762,9 +762,9 @@ static int vidioc_s_fmt_vid_overlay(stru
+@@ -775,9 +775,9 @@ static int vidioc_s_fmt_vid_overlay(stru
vidioc_try_fmt_vid_overlay(file, priv, f);
dev->overlay = f->fmt.win;
@@ -209,7 +209,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
}
return 0;
-@@ -777,13 +777,13 @@ static int vidioc_overlay(struct file *f
+@@ -790,13 +790,13 @@ static int vidioc_overlay(struct file *f
struct vchiq_mmal_port *src;
struct vchiq_mmal_port *dst;
@@ -227,7 +227,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
if (!on) {
/* disconnect preview ports and disable component */
-@@ -795,14 +795,14 @@ static int vidioc_overlay(struct file *f
+@@ -808,14 +808,14 @@ static int vidioc_overlay(struct file *f
if (ret >= 0)
ret = vchiq_mmal_component_disable(
dev->instance,
@@ -244,7 +244,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
ret = vchiq_mmal_port_set_format(dev->instance, src);
if (ret < 0)
-@@ -819,7 +819,7 @@ static int vidioc_overlay(struct file *f
+@@ -832,7 +832,7 @@ static int vidioc_overlay(struct file *f
ret = vchiq_mmal_component_enable(
dev->instance,
@@ -253,7 +253,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
if (ret < 0)
return ret;
-@@ -840,8 +840,8 @@ static int vidioc_g_fbuf(struct file *fi
+@@ -853,8 +853,8 @@ static int vidioc_g_fbuf(struct file *fi
*/
struct bm2835_mmal_dev *dev = video_drvdata(file);
struct vchiq_mmal_port *preview_port =
@@ -264,7 +264,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
a->capability = V4L2_FBUF_CAP_EXTERNOVERLAY |
V4L2_FBUF_CAP_GLOBAL_ALPHA;
-@@ -1044,31 +1044,31 @@ static int mmal_setup_components(struct
+@@ -1057,31 +1057,31 @@ static int mmal_setup_components(struct
}
/* format dependent port setup */
switch (mfmt->mmal_component) {
@@ -311,7 +311,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
break;
default:
break;
-@@ -1110,13 +1110,12 @@ static int mmal_setup_components(struct
+@@ -1123,13 +1123,12 @@ static int mmal_setup_components(struct
if (!ret
&& camera_port ==
@@ -329,7 +329,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
/* Preview and encode ports need to match on resolution */
if (overlay_enabled) {
/* Need to disable the overlay before we can update
-@@ -1147,7 +1146,7 @@ static int mmal_setup_components(struct
+@@ -1160,7 +1159,7 @@ static int mmal_setup_components(struct
ret = vchiq_mmal_port_connect_tunnel(
dev->instance,
preview_port,
@@ -338,7 +338,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
if (!ret)
ret = vchiq_mmal_port_enable(dev->instance,
preview_port,
-@@ -1201,11 +1200,11 @@ static int mmal_setup_components(struct
+@@ -1214,11 +1213,11 @@ static int mmal_setup_components(struct
port->format.encoding_variant = 0;
/* Set any encoding specific parameters */
switch (mfmt->mmal_component) {
@@ -352,7 +352,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
/* Could set EXIF parameters here */
break;
default:
-@@ -1580,14 +1579,14 @@ static int mmal_init(struct bm2835_mmal_
+@@ -1593,14 +1592,14 @@ static int mmal_init(struct bm2835_mmal_
/* get the camera component ready */
ret = vchiq_mmal_component_init(dev->instance, "ril.camera",
@@ -371,7 +371,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
ret = -EINVAL;
goto unreg_camera;
}
-@@ -1609,7 +1608,7 @@ static int mmal_init(struct bm2835_mmal_
+@@ -1622,7 +1621,7 @@ static int mmal_init(struct bm2835_mmal_
dev->rgb_bgr_swapped = true;
param_size = sizeof(supported_encodings);
ret = vchiq_mmal_port_parameter_get(dev->instance,
@@ -380,7 +380,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
MMAL_PARAMETER_SUPPORTED_ENCODINGS,
&supported_encodings,
&param_size);
-@@ -1630,7 +1629,7 @@ static int mmal_init(struct bm2835_mmal_
+@@ -1643,7 +1642,7 @@ static int mmal_init(struct bm2835_mmal_
}
}
}
@@ -389,7 +389,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
format->encoding = MMAL_ENCODING_OPAQUE;
format->encoding_variant = MMAL_ENCODING_I420;
-@@ -1644,7 +1643,7 @@ static int mmal_init(struct bm2835_mmal_
+@@ -1657,7 +1656,7 @@ static int mmal_init(struct bm2835_mmal_
format->es->video.frame_rate.num = 0; /* Rely on fps_range */
format->es->video.frame_rate.den = 1;
@@ -398,7 +398,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
format->encoding = MMAL_ENCODING_OPAQUE;
format->encoding_variant = MMAL_ENCODING_I420;
-@@ -1658,7 +1657,7 @@ static int mmal_init(struct bm2835_mmal_
+@@ -1671,7 +1670,7 @@ static int mmal_init(struct bm2835_mmal_
format->es->video.frame_rate.num = 0; /* Rely on fps_range */
format->es->video.frame_rate.den = 1;
@@ -407,7 +407,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
format->encoding = MMAL_ENCODING_OPAQUE;
-@@ -1682,28 +1681,28 @@ static int mmal_init(struct bm2835_mmal_
+@@ -1695,28 +1694,28 @@ static int mmal_init(struct bm2835_mmal_
/* get the preview component ready */
ret = vchiq_mmal_component_init(
dev->instance, "ril.video_render",
@@ -442,7 +442,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
1);
goto unreg_image_encoder;
}
-@@ -1711,21 +1710,21 @@ static int mmal_init(struct bm2835_mmal_
+@@ -1724,21 +1723,21 @@ static int mmal_init(struct bm2835_mmal_
/* get the video encoder component ready */
ret = vchiq_mmal_component_init(dev->instance, "ril.video_encode",
&dev->
@@ -468,7 +468,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
encoder_port->format.encoding = MMAL_ENCODING_H264;
ret = vchiq_mmal_port_set_format(dev->instance,
encoder_port);
-@@ -1736,12 +1735,12 @@ static int mmal_init(struct bm2835_mmal_
+@@ -1749,12 +1748,12 @@ static int mmal_init(struct bm2835_mmal_
vchiq_mmal_port_parameter_set(
dev->instance,
@@ -483,7 +483,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
MMAL_PARAMETER_MINIMISE_FRAGMENTATION,
&enable,
sizeof(enable));
-@@ -1759,23 +1758,23 @@ unreg_vid_encoder:
+@@ -1772,23 +1771,23 @@ unreg_vid_encoder:
pr_err("Cleanup: Destroy video encoder\n");
vchiq_mmal_component_finalise(
dev->instance,
@@ -511,7 +511,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
unreg_mmal:
vchiq_mmal_finalise(dev->instance);
-@@ -1831,21 +1830,21 @@ static void bcm2835_cleanup_instance(str
+@@ -1844,21 +1843,21 @@ static void bcm2835_cleanup_instance(str
dev->capture.encode_component);
}
vchiq_mmal_component_disable(dev->instance,
diff --git a/target/linux/brcm2708/patches-4.19/950-0247-staging-bcm2835-camera-Fix-multiple-line-dereference.patch b/target/linux/brcm2708/patches-4.19/950-0247-staging-bcm2835-camera-Fix-multiple-line-dereference.patch
index 217cce879b..8a34daa0b8 100644
--- a/target/linux/brcm2708/patches-4.19/950-0247-staging-bcm2835-camera-Fix-multiple-line-dereference.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0247-staging-bcm2835-camera-Fix-multiple-line-dereference.patch
@@ -23,7 +23,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
}
static void buffer_cb(struct vchiq_mmal_instance *instance,
-@@ -782,8 +781,7 @@ static int vidioc_overlay(struct file *f
+@@ -795,8 +794,7 @@ static int vidioc_overlay(struct file *f
return 0; /* already in requested state */
src =
@@ -33,7 +33,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
if (!on) {
/* disconnect preview ports and disable component */
-@@ -840,8 +838,7 @@ static int vidioc_g_fbuf(struct file *fi
+@@ -853,8 +851,7 @@ static int vidioc_g_fbuf(struct file *fi
*/
struct bm2835_mmal_dev *dev = video_drvdata(file);
struct vchiq_mmal_port *preview_port =
@@ -43,7 +43,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
a->capability = V4L2_FBUF_CAP_EXTERNOVERLAY |
V4L2_FBUF_CAP_GLOBAL_ALPHA;
-@@ -1033,8 +1030,7 @@ static int mmal_setup_components(struct
+@@ -1046,8 +1043,7 @@ static int mmal_setup_components(struct
dev->capture.camera_port, NULL);
dev->capture.camera_port = NULL;
ret = vchiq_mmal_component_disable(dev->instance,
@@ -53,7 +53,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
if (ret)
v4l2_err(&dev->v4l2_dev,
"Failed to disable encode component %d\n",
-@@ -1049,26 +1045,22 @@ static int mmal_setup_components(struct
+@@ -1062,26 +1058,22 @@ static int mmal_setup_components(struct
if (f->fmt.pix.width <= max_video_width
&& f->fmt.pix.height <= max_video_height)
camera_port = port =
@@ -84,7 +84,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
break;
default:
break;
-@@ -1110,8 +1102,7 @@ static int mmal_setup_components(struct
+@@ -1123,8 +1115,7 @@ static int mmal_setup_components(struct
if (!ret
&& camera_port ==
@@ -94,7 +94,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
bool overlay_enabled =
!!dev->component[COMP_PREVIEW]->enabled;
struct vchiq_mmal_port *preview_port =
-@@ -1248,9 +1239,8 @@ static int mmal_setup_components(struct
+@@ -1261,9 +1252,8 @@ static int mmal_setup_components(struct
port->current_buffer.size);
port->current_buffer.size =
(f->fmt.pix.sizeimage <
@@ -106,7 +106,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
}
v4l2_dbg(1, bcm2835_v4l2_debug,
&dev->v4l2_dev,
-@@ -1709,8 +1699,7 @@ static int mmal_init(struct bm2835_mmal_
+@@ -1722,8 +1712,7 @@ static int mmal_init(struct bm2835_mmal_
/* get the video encoder component ready */
ret = vchiq_mmal_component_init(dev->instance, "ril.video_encode",
@@ -116,7 +116,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
if (ret < 0)
goto unreg_image_encoder;
-@@ -1833,12 +1822,10 @@ static void bcm2835_cleanup_instance(str
+@@ -1846,12 +1835,10 @@ static void bcm2835_cleanup_instance(str
dev->component[COMP_CAMERA]);
vchiq_mmal_component_finalise(dev->instance,
diff --git a/target/linux/brcm2708/patches-4.19/950-0248-staging-bcm2835-camera-Fix-brace-style-issues.patch b/target/linux/brcm2708/patches-4.19/950-0248-staging-bcm2835-camera-Fix-brace-style-issues.patch
index 4b0a499063..748e2a6a67 100644
--- a/target/linux/brcm2708/patches-4.19/950-0248-staging-bcm2835-camera-Fix-brace-style-issues.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0248-staging-bcm2835-camera-Fix-brace-style-issues.patch
@@ -14,7 +14,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
-@@ -566,10 +566,11 @@ static int start_streaming(struct vb2_qu
+@@ -569,10 +569,11 @@ static int start_streaming(struct vb2_qu
/* Flag to indicate just to rely on kernel timestamps */
dev->capture.vc_start_timestamp = -1;
@@ -42,7 +42,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
static int ctrl_set_flicker_avoidance(struct bm2835_mmal_dev *dev,
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
-@@ -1262,9 +1262,10 @@ static int port_parameter_get(struct vch
+@@ -1268,9 +1268,10 @@ static int port_parameter_get(struct vch
memcpy(value, &rmsg->u.port_parameter_get_reply.value,
*value_size);
*value_size = rmsg->u.port_parameter_get_reply.size;
diff --git a/target/linux/brcm2708/patches-4.19/950-0250-staging-bcm2835-camera-Fix-logical-continuation-spli.patch b/target/linux/brcm2708/patches-4.19/950-0250-staging-bcm2835-camera-Fix-logical-continuation-spli.patch
index a04ebef3b8..6d4526d1bb 100644
--- a/target/linux/brcm2708/patches-4.19/950-0250-staging-bcm2835-camera-Fix-logical-continuation-spli.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0250-staging-bcm2835-camera-Fix-logical-continuation-spli.patch
@@ -14,7 +14,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
-@@ -542,8 +542,8 @@ static int start_streaming(struct vb2_qu
+@@ -545,8 +545,8 @@ static int start_streaming(struct vb2_qu
msleep(300);
/* enable the connection from camera to encoder (if applicable) */
@@ -25,7 +25,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
ret = vchiq_mmal_port_enable(dev->instance,
dev->capture.camera_port, NULL);
if (ret) {
-@@ -1043,8 +1043,8 @@ static int mmal_setup_components(struct
+@@ -1056,8 +1056,8 @@ static int mmal_setup_components(struct
switch (mfmt->mmal_component) {
case COMP_CAMERA:
/* Make a further decision on port based on resolution */
@@ -36,7 +36,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
camera_port = port =
&dev->component[COMP_CAMERA]->output[CAM_PORT_VIDEO];
else
-@@ -1101,8 +1101,8 @@ static int mmal_setup_components(struct
+@@ -1114,8 +1114,8 @@ static int mmal_setup_components(struct
ret = vchiq_mmal_port_set_format(dev->instance, camera_port);
diff --git a/target/linux/brcm2708/patches-4.19/950-0251-staging-bcm2835-camera-Fix-open-parenthesis-alignmen.patch b/target/linux/brcm2708/patches-4.19/950-0251-staging-bcm2835-camera-Fix-open-parenthesis-alignmen.patch
index 965261fd0b..1331849457 100644
--- a/target/linux/brcm2708/patches-4.19/950-0251-staging-bcm2835-camera-Fix-open-parenthesis-alignmen.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0251-staging-bcm2835-camera-Fix-open-parenthesis-alignmen.patch
@@ -17,7 +17,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
-@@ -412,8 +412,7 @@ static void buffer_cb(struct vchiq_mmal_
+@@ -415,8 +415,7 @@ static void buffer_cb(struct vchiq_mmal_
buf->vb.flags |= V4L2_BUF_FLAG_KEYFRAME;
v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
@@ -27,7 +27,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
if (mmal_flags & MMAL_BUFFER_HEADER_FLAG_EOS &&
-@@ -581,8 +580,8 @@ static int start_streaming(struct vb2_qu
+@@ -584,8 +583,8 @@ static int start_streaming(struct vb2_qu
vchiq_mmal_port_enable(dev->instance, dev->capture.port, buffer_cb);
if (ret) {
v4l2_err(&dev->v4l2_dev,
@@ -38,7 +38,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
vchiq_mmal_port_disable(dev->instance,
dev->capture.camera_port);
-@@ -978,8 +977,7 @@ static int vidioc_try_fmt_vid_cap(struct
+@@ -991,8 +990,7 @@ static int vidioc_try_fmt_vid_cap(struct
f->fmt.pix.bytesperline =
(f->fmt.pix.bytesperline + align_mask) & ~align_mask;
v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
@@ -48,7 +48,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
f->fmt.pix.bytesperline, align_mask);
}
-@@ -1325,7 +1323,7 @@ static int vidioc_s_fmt_vid_cap(struct f
+@@ -1338,7 +1336,7 @@ static int vidioc_s_fmt_vid_cap(struct f
}
static int vidioc_enum_framesizes(struct file *file, void *fh,
@@ -104,7 +104,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
case MMAL_CONTROL_TYPE_CLUSTER:
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
-@@ -645,7 +645,7 @@ static int send_synchronous_mmal_msg(str
+@@ -651,7 +651,7 @@ static int send_synchronous_mmal_msg(str
if (payload_len >
(MMAL_MSG_MAX_SIZE - sizeof(struct mmal_msg_header))) {
pr_err("payload length %d exceeds max:%d\n", payload_len,
@@ -115,7 +115,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
}
--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h
+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h
-@@ -128,7 +128,7 @@ int vchiq_mmal_port_enable(
+@@ -131,7 +131,7 @@ int vchiq_mmal_port_enable(
* disable a port will dequeue any pending buffers
*/
int vchiq_mmal_port_disable(struct vchiq_mmal_instance *instance,
@@ -124,7 +124,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
int vchiq_mmal_port_parameter_set(struct vchiq_mmal_instance *instance,
struct vchiq_mmal_port *port,
-@@ -146,8 +146,8 @@ int vchiq_mmal_port_set_format(struct vc
+@@ -149,8 +149,8 @@ int vchiq_mmal_port_set_format(struct vc
struct vchiq_mmal_port *port);
int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance,
diff --git a/target/linux/brcm2708/patches-4.19/950-0252-staging-bcm2835_camera-Ensure-all-buffers-are-return.patch b/target/linux/brcm2708/patches-4.19/950-0252-staging-bcm2835_camera-Ensure-all-buffers-are-return.patch
deleted file mode 100644
index b5fbceba24..0000000000
--- a/target/linux/brcm2708/patches-4.19/950-0252-staging-bcm2835_camera-Ensure-all-buffers-are-return.patch
+++ /dev/null
@@ -1,95 +0,0 @@
-From 754a5ed1aa42ce9d5be5f84a5a0888f850b15e00 Mon Sep 17 00:00:00 2001
-From: Dave Stevenson <dave.stevenson@raspberrypi.org>
-Date: Thu, 28 Jun 2018 15:57:25 +0100
-Subject: [PATCH 252/703] staging: bcm2835_camera: Ensure all buffers are
- returned on disable
-
-With the recent change to match MMAL and V4L2 buffers there
-is a need to wait for all MMAL buffers to be returned during
-stop_streaming.
-
-Fixes: 9384167 "staging: bcm2835-camera: Remove V4L2/MMAL buffer remapping"
-Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
----
- .../bcm2835-camera/bcm2835-camera.c | 22 ++++++++++++++-----
- .../vc04_services/bcm2835-camera/mmal-vchiq.c | 4 ++++
- .../vc04_services/bcm2835-camera/mmal-vchiq.h | 3 +++
- 3 files changed, 23 insertions(+), 6 deletions(-)
-
---- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
-+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
-@@ -607,6 +607,7 @@ static void stop_streaming(struct vb2_qu
- int ret;
- unsigned long timeout;
- struct bm2835_mmal_dev *dev = vb2_get_drv_priv(vq);
-+ struct vchiq_mmal_port *port = dev->capture.port;
-
- v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, "%s: dev:%p\n",
- __func__, dev);
-@@ -630,12 +631,6 @@ static void stop_streaming(struct vb2_qu
- &dev->capture.frame_count,
- sizeof(dev->capture.frame_count));
-
-- /* wait for last frame to complete */
-- timeout = wait_for_completion_timeout(&dev->capture.frame_cmplt, HZ);
-- if (timeout == 0)
-- v4l2_err(&dev->v4l2_dev,
-- "timed out waiting for frame completion\n");
--
- v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
- "disabling connection\n");
-
-@@ -650,6 +645,21 @@ static void stop_streaming(struct vb2_qu
- ret);
- }
-
-+ /* wait for all buffers to be returned */
-+ while (atomic_read(&port->buffers_with_vpu)) {
-+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
-+ "%s: Waiting for buffers to be returned - %d outstanding\n",
-+ __func__, atomic_read(&port->buffers_with_vpu));
-+ timeout = wait_for_completion_timeout(&dev->capture.frame_cmplt,
-+ HZ);
-+ if (timeout == 0) {
-+ v4l2_err(&dev->v4l2_dev, "%s: Timeout waiting for buffers to be returned - %d outstanding\n",
-+ __func__,
-+ atomic_read(&port->buffers_with_vpu));
-+ break;
-+ }
-+ }
-+
- if (disable_camera(dev) < 0)
- v4l2_err(&dev->v4l2_dev, "Failed to disable camera\n");
- }
---- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
-+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
-@@ -246,6 +246,8 @@ static void buffer_work_cb(struct work_s
- struct mmal_msg_context *msg_context =
- container_of(work, struct mmal_msg_context, u.bulk.work);
-
-+ atomic_dec(&msg_context->u.bulk.port->buffers_with_vpu);
-+
- msg_context->u.bulk.port->buffer_cb(msg_context->u.bulk.instance,
- msg_context->u.bulk.port,
- msg_context->u.bulk.status,
-@@ -389,6 +391,8 @@ buffer_from_host(struct vchiq_mmal_insta
- INIT_WORK(&msg_context->u.bulk.buffer_to_host_work,
- buffer_to_host_work_cb);
-
-+ atomic_inc(&port->buffers_with_vpu);
-+
- /* prep the buffer from host message */
- memset(&m, 0xbc, sizeof(m)); /* just to make debug clearer */
-
---- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h
-+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.h
-@@ -72,6 +72,9 @@ struct vchiq_mmal_port {
- struct list_head buffers;
- /* lock to serialise adding and removing buffers from list */
- spinlock_t slock;
-+
-+ /* Count of buffers the VPU has yet to return */
-+ atomic_t buffers_with_vpu;
- /* callback on buffer completion */
- vchiq_mmal_buffer_cb buffer_cb;
- /* callback context */
diff --git a/target/linux/brcm2708/patches-4.19/950-0253-staging-bcm2835-camera-Remove-check-of-the-number-of.patch b/target/linux/brcm2708/patches-4.19/950-0253-staging-bcm2835-camera-Remove-check-of-the-number-of.patch
deleted file mode 100644
index f916ae1830..0000000000
--- a/target/linux/brcm2708/patches-4.19/950-0253-staging-bcm2835-camera-Remove-check-of-the-number-of.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-From 98457a5263c83026cf1d451d44d8b028b8423b87 Mon Sep 17 00:00:00 2001
-From: Dave Stevenson <dave.stevenson@raspberrypi.org>
-Date: Wed, 4 Jul 2018 17:01:15 +0100
-Subject: [PATCH 253/703] staging: bcm2835-camera: Remove check of the number
- of buffers supplied
-
-Before 9384167 there was a need to ensure that there were sufficient
-buffers supplied from the user to cover those being sent to the VPU
-(always 1).
-With 9384167 the buffers are linked 1:1 between MMAL and V4L2,
-therefore there is no need for that check, and indeed it is wrong
-as there is no need to submit all the buffers before starting streaming.
-
-Fixes: 9384167 "staging: bcm2835-camera: Remove V4L2/MMAL buffer remapping"
-
-Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
----
- .../staging/vc04_services/bcm2835-camera/mmal-vchiq.c | 10 ----------
- 1 file changed, 10 deletions(-)
-
---- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
-+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
-@@ -1338,16 +1338,6 @@ static int port_enable(struct vchiq_mmal
- if (port->enabled)
- return 0;
-
-- /* ensure there are enough buffers queued to cover the buffer headers */
-- if (port->buffer_cb) {
-- hdr_count = 0;
-- list_for_each(buf_head, &port->buffers) {
-- hdr_count++;
-- }
-- if (hdr_count < port->current_buffer.num)
-- return -ENOSPC;
-- }
--
- ret = port_action_port(instance, port,
- MMAL_MSG_PORT_ACTION_TYPE_ENABLE);
- if (ret)
diff --git a/target/linux/brcm2708/patches-4.19/950-0254-staging-bcm2835-camera-Handle-empty-EOS-buffers-whil.patch b/target/linux/brcm2708/patches-4.19/950-0254-staging-bcm2835-camera-Handle-empty-EOS-buffers-whil.patch
deleted file mode 100644
index 81153c9ff9..0000000000
--- a/target/linux/brcm2708/patches-4.19/950-0254-staging-bcm2835-camera-Handle-empty-EOS-buffers-whil.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-From 1da35962d95cdb8648cb85c4b6f3d3367be88601 Mon Sep 17 00:00:00 2001
-From: Dave Stevenson <dave.stevenson@raspberrypi.org>
-Date: Thu, 5 Jul 2018 16:17:03 +0100
-Subject: [PATCH 254/703] staging: bcm2835-camera: Handle empty EOS buffers
- whilst streaming
-
-The change to mapping V4L2 to MMAL buffers 1:1 didn't handle
-the condition we get with raw pixel buffers (eg YUV and RGB)
-direct from the camera's stills port. That sends the pixel buffer
-and then an empty buffer with the EOS flag set. The EOS buffer
-wasn't handled and returned an error up the stack.
-
-Handle the condition correctly by returning it to the component
-if streaming, or returning with an error if stopping streaming.
-
-Fixes: 9384167 "staging: bcm2835-camera: Remove V4L2/MMAL buffer remapping"
-
-Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
----
- .../bcm2835-camera/bcm2835-camera.c | 21 +++++++++++--------
- .../vc04_services/bcm2835-camera/mmal-vchiq.c | 5 +++--
- 2 files changed, 15 insertions(+), 11 deletions(-)
-
---- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
-+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
-@@ -339,16 +339,13 @@ static void buffer_cb(struct vchiq_mmal_
-
- if (length == 0) {
- /* stream ended */
-- if (buf) {
-- /* this should only ever happen if the port is
-- * disabled and there are buffers still queued
-+ if (dev->capture.frame_count) {
-+ /* empty buffer whilst capturing - expected to be an
-+ * EOS, so grab another frame
- */
-- vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
-- pr_debug("Empty buffer");
-- } else if (dev->capture.frame_count) {
-- /* grab another frame */
- if (is_capturing(dev)) {
-- pr_debug("Grab another frame");
-+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
-+ "Grab another frame");
- vchiq_mmal_port_parameter_set(
- instance,
- dev->capture.camera_port,
-@@ -356,8 +353,14 @@ static void buffer_cb(struct vchiq_mmal_
- &dev->capture.frame_count,
- sizeof(dev->capture.frame_count));
- }
-+ if (vchiq_mmal_submit_buffer(instance, port, buf))
-+ v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev,
-+ "Failed to return EOS buffer");
- } else {
-- /* signal frame completion */
-+ /* stopping streaming.
-+ * return buffer, and signal frame completion
-+ */
-+ vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
- complete(&dev->capture.frame_cmplt);
- }
- return;
---- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
-+++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
-@@ -332,8 +332,6 @@ static int bulk_receive(struct vchiq_mma
-
- /* store length */
- msg_context->u.bulk.buffer_used = rd_len;
-- msg_context->u.bulk.mmal_flags =
-- msg->u.buffer_from_host.buffer_header.flags;
- msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts;
- msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts;
-
-@@ -461,6 +459,9 @@ static void buffer_to_host_cb(struct vch
- return;
- }
-
-+ msg_context->u.bulk.mmal_flags =
-+ msg->u.buffer_from_host.buffer_header.flags;
-+
- if (msg->h.status != MMAL_MSG_STATUS_SUCCESS) {
- /* message reception had an error */
- pr_warn("error %d in reply\n", msg->h.status);
diff --git a/target/linux/brcm2708/patches-4.19/950-0267-staging-vc04_services-Split-vchiq-mmal-into-a-module.patch b/target/linux/brcm2708/patches-4.19/950-0267-staging-vc04_services-Split-vchiq-mmal-into-a-module.patch
index 5ba783d112..13ee7ba190 100644
--- a/target/linux/brcm2708/patches-4.19/950-0267-staging-vc04_services-Split-vchiq-mmal-into-a-module.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0267-staging-vc04_services-Split-vchiq-mmal-into-a-module.patch
@@ -109,1910 +109,9 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
+ccflags-y += \
+ -Idrivers/staging/vc04_services \
+ -D__VCCOREVER__=0x04000000
---- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
-+++ /dev/null
-@@ -1,1898 +0,0 @@
--// SPDX-License-Identifier: GPL-2.0
--/*
-- * Broadcom BM2835 V4L2 driver
-- *
-- * Copyright © 2013 Raspberry Pi (Trading) Ltd.
-- *
-- * Authors: Vincent Sanders @ Collabora
-- * Dave Stevenson @ Broadcom
-- * (now dave.stevenson@raspberrypi.org)
-- * Simon Mellor @ Broadcom
-- * Luke Diamand @ Broadcom
-- *
-- * V4L2 driver MMAL vchiq interface code
-- */
--
--#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
--
--#include <linux/errno.h>
--#include <linux/kernel.h>
--#include <linux/mutex.h>
--#include <linux/mm.h>
--#include <linux/slab.h>
--#include <linux/completion.h>
--#include <linux/vmalloc.h>
--#include <asm/cacheflush.h>
--#include <media/videobuf2-vmalloc.h>
--
--#include "mmal-common.h"
--#include "mmal-vchiq.h"
--#include "mmal-msg.h"
--
--#define USE_VCHIQ_ARM
--#include "interface/vchi/vchi.h"
--
--/* maximum number of components supported */
--#define VCHIQ_MMAL_MAX_COMPONENTS 4
--
--/*#define FULL_MSG_DUMP 1*/
--
--#ifdef DEBUG
--static const char *const msg_type_names[] = {
-- "UNKNOWN",
-- "QUIT",
-- "SERVICE_CLOSED",
-- "GET_VERSION",
-- "COMPONENT_CREATE",
-- "COMPONENT_DESTROY",
-- "COMPONENT_ENABLE",
-- "COMPONENT_DISABLE",
-- "PORT_INFO_GET",
-- "PORT_INFO_SET",
-- "PORT_ACTION",
-- "BUFFER_FROM_HOST",
-- "BUFFER_TO_HOST",
-- "GET_STATS",
-- "PORT_PARAMETER_SET",
-- "PORT_PARAMETER_GET",
-- "EVENT_TO_HOST",
-- "GET_CORE_STATS_FOR_PORT",
-- "OPAQUE_ALLOCATOR",
-- "CONSUME_MEM",
-- "LMK",
-- "OPAQUE_ALLOCATOR_DESC",
-- "DRM_GET_LHS32",
-- "DRM_GET_TIME",
-- "BUFFER_FROM_HOST_ZEROLEN",
-- "PORT_FLUSH",
-- "HOST_LOG",
--};
--#endif
--
--static const char *const port_action_type_names[] = {
-- "UNKNOWN",
-- "ENABLE",
-- "DISABLE",
-- "FLUSH",
-- "CONNECT",
-- "DISCONNECT",
-- "SET_REQUIREMENTS",
--};
--
--#if defined(DEBUG)
--#if defined(FULL_MSG_DUMP)
--#define DBG_DUMP_MSG(MSG, MSG_LEN, TITLE) \
-- do { \
-- pr_debug(TITLE" type:%s(%d) length:%d\n", \
-- msg_type_names[(MSG)->h.type], \
-- (MSG)->h.type, (MSG_LEN)); \
-- print_hex_dump(KERN_DEBUG, "<<h: ", DUMP_PREFIX_OFFSET, \
-- 16, 4, (MSG), \
-- sizeof(struct mmal_msg_header), 1); \
-- print_hex_dump(KERN_DEBUG, "<<p: ", DUMP_PREFIX_OFFSET, \
-- 16, 4, \
-- ((u8 *)(MSG)) + sizeof(struct mmal_msg_header),\
-- (MSG_LEN) - sizeof(struct mmal_msg_header), 1); \
-- } while (0)
--#else
--#define DBG_DUMP_MSG(MSG, MSG_LEN, TITLE) \
-- { \
-- pr_debug(TITLE" type:%s(%d) length:%d\n", \
-- msg_type_names[(MSG)->h.type], \
-- (MSG)->h.type, (MSG_LEN)); \
-- }
--#endif
--#else
--#define DBG_DUMP_MSG(MSG, MSG_LEN, TITLE)
--#endif
--
--struct vchiq_mmal_instance;
--
--/* normal message context */
--struct mmal_msg_context {
-- struct vchiq_mmal_instance *instance;
--
-- /* Index in the context_map idr so that we can find the
-- * mmal_msg_context again when servicing the VCHI reply.
-- */
-- int handle;
--
-- union {
-- struct {
-- /* work struct for buffer_cb callback */
-- struct work_struct work;
-- /* work struct for deferred callback */
-- struct work_struct buffer_to_host_work;
-- /* mmal instance */
-- struct vchiq_mmal_instance *instance;
-- /* mmal port */
-- struct vchiq_mmal_port *port;
-- /* actual buffer used to store bulk reply */
-- struct mmal_buffer *buffer;
-- /* amount of buffer used */
-- unsigned long buffer_used;
-- /* MMAL buffer flags */
-- u32 mmal_flags;
-- /* Presentation and Decode timestamps */
-- s64 pts;
-- s64 dts;
--
-- int status; /* context status */
--
-- } bulk; /* bulk data */
--
-- struct {
-- /* message handle to release */
-- VCHI_HELD_MSG_T msg_handle;
-- /* pointer to received message */
-- struct mmal_msg *msg;
-- /* received message length */
-- u32 msg_len;
-- /* completion upon reply */
-- struct completion cmplt;
-- } sync; /* synchronous response */
-- } u;
--
--};
--
--struct vchiq_mmal_instance {
-- VCHI_SERVICE_HANDLE_T handle;
--
-- /* ensure serialised access to service */
-- struct mutex vchiq_mutex;
--
-- /* vmalloc page to receive scratch bulk xfers into */
-- void *bulk_scratch;
--
-- struct idr context_map;
-- spinlock_t context_map_lock;
--
-- /* component to use next */
-- int component_idx;
-- struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS];
--
-- /* ordered workqueue to process all bulk operations */
-- struct workqueue_struct *bulk_wq;
--};
--
--static struct mmal_msg_context *
--get_msg_context(struct vchiq_mmal_instance *instance)
--{
-- struct mmal_msg_context *msg_context;
-- int handle;
--
-- /* todo: should this be allocated from a pool to avoid kzalloc */
-- msg_context = kzalloc(sizeof(*msg_context), GFP_KERNEL);
--
-- if (!msg_context)
-- return ERR_PTR(-ENOMEM);
--
-- /* Create an ID that will be passed along with our message so
-- * that when we service the VCHI reply, we can look up what
-- * message is being replied to.
-- */
-- spin_lock(&instance->context_map_lock);
-- handle = idr_alloc(&instance->context_map, msg_context,
-- 0, 0, GFP_KERNEL);
-- spin_unlock(&instance->context_map_lock);
--
-- if (handle < 0) {
-- kfree(msg_context);
-- return ERR_PTR(handle);
-- }
--
-- msg_context->instance = instance;
-- msg_context->handle = handle;
--
-- return msg_context;
--}
--
--static struct mmal_msg_context *
--lookup_msg_context(struct vchiq_mmal_instance *instance, int handle)
--{
-- return idr_find(&instance->context_map, handle);
--}
--
--static void
--release_msg_context(struct mmal_msg_context *msg_context)
--{
-- struct vchiq_mmal_instance *instance = msg_context->instance;
--
-- spin_lock(&instance->context_map_lock);
-- idr_remove(&instance->context_map, msg_context->handle);
-- spin_unlock(&instance->context_map_lock);
-- kfree(msg_context);
--}
--
--/* deals with receipt of event to host message */
--static void event_to_host_cb(struct vchiq_mmal_instance *instance,
-- struct mmal_msg *msg, u32 msg_len)
--{
-- pr_debug("unhandled event\n");
-- pr_debug("component:%u port type:%d num:%d cmd:0x%x length:%d\n",
-- msg->u.event_to_host.client_component,
-- msg->u.event_to_host.port_type,
-- msg->u.event_to_host.port_num,
-- msg->u.event_to_host.cmd, msg->u.event_to_host.length);
--}
--
--/* workqueue scheduled callback
-- *
-- * we do this because it is important we do not call any other vchiq
-- * sync calls from witin the message delivery thread
-- */
--static void buffer_work_cb(struct work_struct *work)
--{
-- struct mmal_msg_context *msg_context =
-- container_of(work, struct mmal_msg_context, u.bulk.work);
--
-- atomic_dec(&msg_context->u.bulk.port->buffers_with_vpu);
--
-- msg_context->u.bulk.port->buffer_cb(msg_context->u.bulk.instance,
-- msg_context->u.bulk.port,
-- msg_context->u.bulk.status,
-- msg_context->u.bulk.buffer,
-- msg_context->u.bulk.buffer_used,
-- msg_context->u.bulk.mmal_flags,
-- msg_context->u.bulk.dts,
-- msg_context->u.bulk.pts);
--}
--
--/* workqueue scheduled callback to handle receiving buffers
-- *
-- * VCHI will allow up to 4 bulk receives to be scheduled before blocking.
-- * If we block in the service_callback context then we can't process the
-- * VCHI_CALLBACK_BULK_RECEIVED message that would otherwise allow the blocked
-- * vchi_bulk_queue_receive() call to complete.
-- */
--static void buffer_to_host_work_cb(struct work_struct *work)
--{
-- struct mmal_msg_context *msg_context =
-- container_of(work, struct mmal_msg_context,
-- u.bulk.buffer_to_host_work);
-- struct vchiq_mmal_instance *instance = msg_context->instance;
-- unsigned long len = msg_context->u.bulk.buffer_used;
-- int ret;
--
-- if (!len)
-- /* Dummy receive to ensure the buffers remain in order */
-- len = 8;
-- /* queue the bulk submission */
-- vchi_service_use(instance->handle);
-- ret = vchi_bulk_queue_receive(instance->handle,
-- msg_context->u.bulk.buffer->buffer,
-- /* Actual receive needs to be a multiple
-- * of 4 bytes
-- */
-- (len + 3) & ~3,
-- VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE |
-- VCHI_FLAGS_BLOCK_UNTIL_QUEUED,
-- msg_context);
--
-- vchi_service_release(instance->handle);
--
-- if (ret != 0)
-- pr_err("%s: ctx: %p, vchi_bulk_queue_receive failed %d\n",
-- __func__, msg_context, ret);
--}
--
--/* enqueue a bulk receive for a given message context */
--static int bulk_receive(struct vchiq_mmal_instance *instance,
-- struct mmal_msg *msg,
-- struct mmal_msg_context *msg_context)
--{
-- unsigned long rd_len;
--
-- rd_len = msg->u.buffer_from_host.buffer_header.length;
--
-- if (!msg_context->u.bulk.buffer) {
-- pr_err("bulk.buffer not configured - error in buffer_from_host\n");
--
-- /* todo: this is a serious error, we should never have
-- * committed a buffer_to_host operation to the mmal
-- * port without the buffer to back it up (underflow
-- * handling) and there is no obvious way to deal with
-- * this - how is the mmal servie going to react when
-- * we fail to do the xfer and reschedule a buffer when
-- * it arrives? perhaps a starved flag to indicate a
-- * waiting bulk receive?
-- */
--
-- return -EINVAL;
-- }
--
-- /* ensure we do not overrun the available buffer */
-- if (rd_len > msg_context->u.bulk.buffer->buffer_size) {
-- rd_len = msg_context->u.bulk.buffer->buffer_size;
-- pr_warn("short read as not enough receive buffer space\n");
-- /* todo: is this the correct response, what happens to
-- * the rest of the message data?
-- */
-- }
--
-- /* store length */
-- msg_context->u.bulk.buffer_used = rd_len;
-- msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts;
-- msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts;
--
-- queue_work(msg_context->instance->bulk_wq,
-- &msg_context->u.bulk.buffer_to_host_work);
--
-- return 0;
--}
--
--/* data in message, memcpy from packet into output buffer */
--static int inline_receive(struct vchiq_mmal_instance *instance,
-- struct mmal_msg *msg,
-- struct mmal_msg_context *msg_context)
--{
-- memcpy(msg_context->u.bulk.buffer->buffer,
-- msg->u.buffer_from_host.short_data,
-- msg->u.buffer_from_host.payload_in_message);
--
-- msg_context->u.bulk.buffer_used =
-- msg->u.buffer_from_host.payload_in_message;
--
-- return 0;
--}
--
--/* queue the buffer availability with MMAL_MSG_TYPE_BUFFER_FROM_HOST */
--static int
--buffer_from_host(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_port *port, struct mmal_buffer *buf)
--{
-- struct mmal_msg_context *msg_context;
-- struct mmal_msg m;
-- int ret;
--
-- if (!port->enabled)
-- return -EINVAL;
--
-- pr_debug("instance:%p buffer:%p\n", instance->handle, buf);
--
-- /* get context */
-- if (!buf->msg_context) {
-- pr_err("%s: msg_context not allocated, buf %p\n", __func__,
-- buf);
-- return -EINVAL;
-- }
-- msg_context = buf->msg_context;
--
-- /* store bulk message context for when data arrives */
-- msg_context->u.bulk.instance = instance;
-- msg_context->u.bulk.port = port;
-- msg_context->u.bulk.buffer = buf;
-- msg_context->u.bulk.buffer_used = 0;
--
-- /* initialise work structure ready to schedule callback */
-- INIT_WORK(&msg_context->u.bulk.work, buffer_work_cb);
-- INIT_WORK(&msg_context->u.bulk.buffer_to_host_work,
-- buffer_to_host_work_cb);
--
-- atomic_inc(&port->buffers_with_vpu);
--
-- /* prep the buffer from host message */
-- memset(&m, 0xbc, sizeof(m)); /* just to make debug clearer */
--
-- m.h.type = MMAL_MSG_TYPE_BUFFER_FROM_HOST;
-- m.h.magic = MMAL_MAGIC;
-- m.h.context = msg_context->handle;
-- m.h.status = 0;
--
-- /* drvbuf is our private data passed back */
-- m.u.buffer_from_host.drvbuf.magic = MMAL_MAGIC;
-- m.u.buffer_from_host.drvbuf.component_handle = port->component->handle;
-- m.u.buffer_from_host.drvbuf.port_handle = port->handle;
-- m.u.buffer_from_host.drvbuf.client_context = msg_context->handle;
--
-- /* buffer header */
-- m.u.buffer_from_host.buffer_header.cmd = 0;
-- m.u.buffer_from_host.buffer_header.data =
-- (u32)(unsigned long)buf->buffer;
-- m.u.buffer_from_host.buffer_header.alloc_size = buf->buffer_size;
-- m.u.buffer_from_host.buffer_header.length = 0; /* nothing used yet */
-- m.u.buffer_from_host.buffer_header.offset = 0; /* no offset */
-- m.u.buffer_from_host.buffer_header.flags = 0; /* no flags */
-- m.u.buffer_from_host.buffer_header.pts = MMAL_TIME_UNKNOWN;
-- m.u.buffer_from_host.buffer_header.dts = MMAL_TIME_UNKNOWN;
--
-- /* clear buffer type sepecific data */
-- memset(&m.u.buffer_from_host.buffer_header_type_specific, 0,
-- sizeof(m.u.buffer_from_host.buffer_header_type_specific));
--
-- /* no payload in message */
-- m.u.buffer_from_host.payload_in_message = 0;
--
-- vchi_service_use(instance->handle);
--
-- ret = vchi_queue_kernel_message(instance->handle,
-- &m,
-- sizeof(struct mmal_msg_header) +
-- sizeof(m.u.buffer_from_host));
--
-- vchi_service_release(instance->handle);
--
-- return ret;
--}
--
--/* deals with receipt of buffer to host message */
--static void buffer_to_host_cb(struct vchiq_mmal_instance *instance,
-- struct mmal_msg *msg, u32 msg_len)
--{
-- struct mmal_msg_context *msg_context;
-- u32 handle;
--
-- pr_debug("%s: instance:%p msg:%p msg_len:%d\n",
-- __func__, instance, msg, msg_len);
--
-- if (msg->u.buffer_from_host.drvbuf.magic == MMAL_MAGIC) {
-- handle = msg->u.buffer_from_host.drvbuf.client_context;
-- msg_context = lookup_msg_context(instance, handle);
--
-- if (!msg_context) {
-- pr_err("drvbuf.client_context(%u) is invalid\n",
-- handle);
-- return;
-- }
-- } else {
-- pr_err("MMAL_MSG_TYPE_BUFFER_TO_HOST with bad magic\n");
-- return;
-- }
--
-- msg_context->u.bulk.mmal_flags =
-- msg->u.buffer_from_host.buffer_header.flags;
--
-- if (msg->h.status != MMAL_MSG_STATUS_SUCCESS) {
-- /* message reception had an error */
-- pr_warn("error %d in reply\n", msg->h.status);
--
-- msg_context->u.bulk.status = msg->h.status;
--
-- } else if (msg->u.buffer_from_host.buffer_header.length == 0) {
-- /* empty buffer */
-- if (msg->u.buffer_from_host.buffer_header.flags &
-- MMAL_BUFFER_HEADER_FLAG_EOS) {
-- msg_context->u.bulk.status =
-- bulk_receive(instance, msg, msg_context);
-- if (msg_context->u.bulk.status == 0)
-- return; /* successful bulk submission, bulk
-- * completion will trigger callback
-- */
-- } else {
-- /* do callback with empty buffer - not EOS though */
-- msg_context->u.bulk.status = 0;
-- msg_context->u.bulk.buffer_used = 0;
-- }
-- } else if (msg->u.buffer_from_host.payload_in_message == 0) {
-- /* data is not in message, queue a bulk receive */
-- msg_context->u.bulk.status =
-- bulk_receive(instance, msg, msg_context);
-- if (msg_context->u.bulk.status == 0)
-- return; /* successful bulk submission, bulk
-- * completion will trigger callback
-- */
--
-- /* failed to submit buffer, this will end badly */
-- pr_err("error %d on bulk submission\n",
-- msg_context->u.bulk.status);
--
-- } else if (msg->u.buffer_from_host.payload_in_message <=
-- MMAL_VC_SHORT_DATA) {
-- /* data payload within message */
-- msg_context->u.bulk.status = inline_receive(instance, msg,
-- msg_context);
-- } else {
-- pr_err("message with invalid short payload\n");
--
-- /* signal error */
-- msg_context->u.bulk.status = -EINVAL;
-- msg_context->u.bulk.buffer_used =
-- msg->u.buffer_from_host.payload_in_message;
-- }
--
-- /* schedule the port callback */
-- schedule_work(&msg_context->u.bulk.work);
--}
--
--static void bulk_receive_cb(struct vchiq_mmal_instance *instance,
-- struct mmal_msg_context *msg_context)
--{
-- msg_context->u.bulk.status = 0;
--
-- /* schedule the port callback */
-- schedule_work(&msg_context->u.bulk.work);
--}
--
--static void bulk_abort_cb(struct vchiq_mmal_instance *instance,
-- struct mmal_msg_context *msg_context)
--{
-- pr_err("%s: bulk ABORTED msg_context:%p\n", __func__, msg_context);
--
-- msg_context->u.bulk.status = -EINTR;
--
-- schedule_work(&msg_context->u.bulk.work);
--}
--
--/* incoming event service callback */
--static void service_callback(void *param,
-- const VCHI_CALLBACK_REASON_T reason,
-- void *bulk_ctx)
--{
-- struct vchiq_mmal_instance *instance = param;
-- int status;
-- u32 msg_len;
-- struct mmal_msg *msg;
-- VCHI_HELD_MSG_T msg_handle;
-- struct mmal_msg_context *msg_context;
--
-- if (!instance) {
-- pr_err("Message callback passed NULL instance\n");
-- return;
-- }
--
-- switch (reason) {
-- case VCHI_CALLBACK_MSG_AVAILABLE:
-- status = vchi_msg_hold(instance->handle, (void **)&msg,
-- &msg_len, VCHI_FLAGS_NONE, &msg_handle);
-- if (status) {
-- pr_err("Unable to dequeue a message (%d)\n", status);
-- break;
-- }
--
-- DBG_DUMP_MSG(msg, msg_len, "<<< reply message");
--
-- /* handling is different for buffer messages */
-- switch (msg->h.type) {
-- case MMAL_MSG_TYPE_BUFFER_FROM_HOST:
-- vchi_held_msg_release(&msg_handle);
-- break;
--
-- case MMAL_MSG_TYPE_EVENT_TO_HOST:
-- event_to_host_cb(instance, msg, msg_len);
-- vchi_held_msg_release(&msg_handle);
--
-- break;
--
-- case MMAL_MSG_TYPE_BUFFER_TO_HOST:
-- buffer_to_host_cb(instance, msg, msg_len);
-- vchi_held_msg_release(&msg_handle);
-- break;
--
-- default:
-- /* messages dependent on header context to complete */
-- if (!msg->h.context) {
-- pr_err("received message context was null!\n");
-- vchi_held_msg_release(&msg_handle);
-- break;
-- }
--
-- msg_context = lookup_msg_context(instance,
-- msg->h.context);
-- if (!msg_context) {
-- pr_err("received invalid message context %u!\n",
-- msg->h.context);
-- vchi_held_msg_release(&msg_handle);
-- break;
-- }
--
-- /* fill in context values */
-- msg_context->u.sync.msg_handle = msg_handle;
-- msg_context->u.sync.msg = msg;
-- msg_context->u.sync.msg_len = msg_len;
--
-- /* todo: should this check (completion_done()
-- * == 1) for no one waiting? or do we need a
-- * flag to tell us the completion has been
-- * interrupted so we can free the message and
-- * its context. This probably also solves the
-- * message arriving after interruption todo
-- * below
-- */
--
-- /* complete message so caller knows it happened */
-- complete(&msg_context->u.sync.cmplt);
-- break;
-- }
--
-- break;
--
-- case VCHI_CALLBACK_BULK_RECEIVED:
-- bulk_receive_cb(instance, bulk_ctx);
-- break;
--
-- case VCHI_CALLBACK_BULK_RECEIVE_ABORTED:
-- bulk_abort_cb(instance, bulk_ctx);
-- break;
--
-- case VCHI_CALLBACK_SERVICE_CLOSED:
-- /* TODO: consider if this requires action if received when
-- * driver is not explicitly closing the service
-- */
-- break;
--
-- default:
-- pr_err("Received unhandled message reason %d\n", reason);
-- break;
-- }
--}
--
--static int send_synchronous_mmal_msg(struct vchiq_mmal_instance *instance,
-- struct mmal_msg *msg,
-- unsigned int payload_len,
-- struct mmal_msg **msg_out,
-- VCHI_HELD_MSG_T *msg_handle_out)
--{
-- struct mmal_msg_context *msg_context;
-- int ret;
-- unsigned long timeout;
--
-- /* payload size must not cause message to exceed max size */
-- if (payload_len >
-- (MMAL_MSG_MAX_SIZE - sizeof(struct mmal_msg_header))) {
-- pr_err("payload length %d exceeds max:%d\n", payload_len,
-- (int)(MMAL_MSG_MAX_SIZE -
-- sizeof(struct mmal_msg_header)));
-- return -EINVAL;
-- }
--
-- msg_context = get_msg_context(instance);
-- if (IS_ERR(msg_context))
-- return PTR_ERR(msg_context);
--
-- init_completion(&msg_context->u.sync.cmplt);
--
-- msg->h.magic = MMAL_MAGIC;
-- msg->h.context = msg_context->handle;
-- msg->h.status = 0;
--
-- DBG_DUMP_MSG(msg, (sizeof(struct mmal_msg_header) + payload_len),
-- ">>> sync message");
--
-- vchi_service_use(instance->handle);
--
-- ret = vchi_queue_kernel_message(instance->handle,
-- msg,
-- sizeof(struct mmal_msg_header) +
-- payload_len);
--
-- vchi_service_release(instance->handle);
--
-- if (ret) {
-- pr_err("error %d queuing message\n", ret);
-- release_msg_context(msg_context);
-- return ret;
-- }
--
-- timeout = wait_for_completion_timeout(&msg_context->u.sync.cmplt,
-- 3 * HZ);
-- if (timeout == 0) {
-- pr_err("timed out waiting for sync completion\n");
-- ret = -ETIME;
-- /* todo: what happens if the message arrives after aborting */
-- release_msg_context(msg_context);
-- return ret;
-- }
--
-- *msg_out = msg_context->u.sync.msg;
-- *msg_handle_out = msg_context->u.sync.msg_handle;
-- release_msg_context(msg_context);
--
-- return 0;
--}
--
--static void dump_port_info(struct vchiq_mmal_port *port)
--{
-- pr_debug("port handle:0x%x enabled:%d\n", port->handle, port->enabled);
--
-- pr_debug("buffer minimum num:%d size:%d align:%d\n",
-- port->minimum_buffer.num,
-- port->minimum_buffer.size, port->minimum_buffer.alignment);
--
-- pr_debug("buffer recommended num:%d size:%d align:%d\n",
-- port->recommended_buffer.num,
-- port->recommended_buffer.size,
-- port->recommended_buffer.alignment);
--
-- pr_debug("buffer current values num:%d size:%d align:%d\n",
-- port->current_buffer.num,
-- port->current_buffer.size, port->current_buffer.alignment);
--
-- pr_debug("elementary stream: type:%d encoding:0x%x variant:0x%x\n",
-- port->format.type,
-- port->format.encoding, port->format.encoding_variant);
--
-- pr_debug(" bitrate:%d flags:0x%x\n",
-- port->format.bitrate, port->format.flags);
--
-- if (port->format.type == MMAL_ES_TYPE_VIDEO) {
-- pr_debug
-- ("es video format: width:%d height:%d colourspace:0x%x\n",
-- port->es.video.width, port->es.video.height,
-- port->es.video.color_space);
--
-- pr_debug(" : crop xywh %d,%d,%d,%d\n",
-- port->es.video.crop.x,
-- port->es.video.crop.y,
-- port->es.video.crop.width, port->es.video.crop.height);
-- pr_debug(" : framerate %d/%d aspect %d/%d\n",
-- port->es.video.frame_rate.num,
-- port->es.video.frame_rate.den,
-- port->es.video.par.num, port->es.video.par.den);
-- }
--}
--
--static void port_to_mmal_msg(struct vchiq_mmal_port *port, struct mmal_port *p)
--{
-- /* todo do readonly fields need setting at all? */
-- p->type = port->type;
-- p->index = port->index;
-- p->index_all = 0;
-- p->is_enabled = port->enabled;
-- p->buffer_num_min = port->minimum_buffer.num;
-- p->buffer_size_min = port->minimum_buffer.size;
-- p->buffer_alignment_min = port->minimum_buffer.alignment;
-- p->buffer_num_recommended = port->recommended_buffer.num;
-- p->buffer_size_recommended = port->recommended_buffer.size;
--
-- /* only three writable fields in a port */
-- p->buffer_num = port->current_buffer.num;
-- p->buffer_size = port->current_buffer.size;
-- p->userdata = (u32)(unsigned long)port;
--}
--
--static int port_info_set(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_port *port)
--{
-- int ret;
-- struct mmal_msg m;
-- struct mmal_msg *rmsg;
-- VCHI_HELD_MSG_T rmsg_handle;
--
-- pr_debug("setting port info port %p\n", port);
-- if (!port)
-- return -1;
-- dump_port_info(port);
--
-- m.h.type = MMAL_MSG_TYPE_PORT_INFO_SET;
--
-- m.u.port_info_set.component_handle = port->component->handle;
-- m.u.port_info_set.port_type = port->type;
-- m.u.port_info_set.port_index = port->index;
--
-- port_to_mmal_msg(port, &m.u.port_info_set.port);
--
-- /* elementary stream format setup */
-- m.u.port_info_set.format.type = port->format.type;
-- m.u.port_info_set.format.encoding = port->format.encoding;
-- m.u.port_info_set.format.encoding_variant =
-- port->format.encoding_variant;
-- m.u.port_info_set.format.bitrate = port->format.bitrate;
-- m.u.port_info_set.format.flags = port->format.flags;
--
-- memcpy(&m.u.port_info_set.es, &port->es,
-- sizeof(union mmal_es_specific_format));
--
-- m.u.port_info_set.format.extradata_size = port->format.extradata_size;
-- memcpy(&m.u.port_info_set.extradata, port->format.extradata,
-- port->format.extradata_size);
--
-- ret = send_synchronous_mmal_msg(instance, &m,
-- sizeof(m.u.port_info_set),
-- &rmsg, &rmsg_handle);
-- if (ret)
-- return ret;
--
-- if (rmsg->h.type != MMAL_MSG_TYPE_PORT_INFO_SET) {
-- /* got an unexpected message type in reply */
-- ret = -EINVAL;
-- goto release_msg;
-- }
--
-- /* return operation status */
-- ret = -rmsg->u.port_info_get_reply.status;
--
-- pr_debug("%s:result:%d component:0x%x port:%d\n", __func__, ret,
-- port->component->handle, port->handle);
--
--release_msg:
-- vchi_held_msg_release(&rmsg_handle);
--
-- return ret;
--}
--
--/* use port info get message to retrieve port information */
--static int port_info_get(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_port *port)
--{
-- int ret;
-- struct mmal_msg m;
-- struct mmal_msg *rmsg;
-- VCHI_HELD_MSG_T rmsg_handle;
--
-- /* port info time */
-- m.h.type = MMAL_MSG_TYPE_PORT_INFO_GET;
-- m.u.port_info_get.component_handle = port->component->handle;
-- m.u.port_info_get.port_type = port->type;
-- m.u.port_info_get.index = port->index;
--
-- ret = send_synchronous_mmal_msg(instance, &m,
-- sizeof(m.u.port_info_get),
-- &rmsg, &rmsg_handle);
-- if (ret)
-- return ret;
--
-- if (rmsg->h.type != MMAL_MSG_TYPE_PORT_INFO_GET) {
-- /* got an unexpected message type in reply */
-- ret = -EINVAL;
-- goto release_msg;
-- }
--
-- /* return operation status */
-- ret = -rmsg->u.port_info_get_reply.status;
-- if (ret != MMAL_MSG_STATUS_SUCCESS)
-- goto release_msg;
--
-- if (rmsg->u.port_info_get_reply.port.is_enabled == 0)
-- port->enabled = false;
-- else
-- port->enabled = true;
--
-- /* copy the values out of the message */
-- port->handle = rmsg->u.port_info_get_reply.port_handle;
--
-- /* port type and index cached to use on port info set because
-- * it does not use a port handle
-- */
-- port->type = rmsg->u.port_info_get_reply.port_type;
-- port->index = rmsg->u.port_info_get_reply.port_index;
--
-- port->minimum_buffer.num =
-- rmsg->u.port_info_get_reply.port.buffer_num_min;
-- port->minimum_buffer.size =
-- rmsg->u.port_info_get_reply.port.buffer_size_min;
-- port->minimum_buffer.alignment =
-- rmsg->u.port_info_get_reply.port.buffer_alignment_min;
--
-- port->recommended_buffer.alignment =
-- rmsg->u.port_info_get_reply.port.buffer_alignment_min;
-- port->recommended_buffer.num =
-- rmsg->u.port_info_get_reply.port.buffer_num_recommended;
--
-- port->current_buffer.num = rmsg->u.port_info_get_reply.port.buffer_num;
-- port->current_buffer.size =
-- rmsg->u.port_info_get_reply.port.buffer_size;
--
-- /* stream format */
-- port->format.type = rmsg->u.port_info_get_reply.format.type;
-- port->format.encoding = rmsg->u.port_info_get_reply.format.encoding;
-- port->format.encoding_variant =
-- rmsg->u.port_info_get_reply.format.encoding_variant;
-- port->format.bitrate = rmsg->u.port_info_get_reply.format.bitrate;
-- port->format.flags = rmsg->u.port_info_get_reply.format.flags;
--
-- /* elementary stream format */
-- memcpy(&port->es,
-- &rmsg->u.port_info_get_reply.es,
-- sizeof(union mmal_es_specific_format));
-- port->format.es = &port->es;
--
-- port->format.extradata_size =
-- rmsg->u.port_info_get_reply.format.extradata_size;
-- memcpy(port->format.extradata,
-- rmsg->u.port_info_get_reply.extradata,
-- port->format.extradata_size);
--
-- pr_debug("received port info\n");
-- dump_port_info(port);
--
--release_msg:
--
-- pr_debug("%s:result:%d component:0x%x port:%d\n",
-- __func__, ret, port->component->handle, port->handle);
--
-- vchi_held_msg_release(&rmsg_handle);
--
-- return ret;
--}
--
--/* create comonent on vc */
--static int create_component(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_component *component,
-- const char *name)
--{
-- int ret;
-- struct mmal_msg m;
-- struct mmal_msg *rmsg;
-- VCHI_HELD_MSG_T rmsg_handle;
--
-- /* build component create message */
-- m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE;
-- m.u.component_create.client_component = (u32)(unsigned long)component;
-- strncpy(m.u.component_create.name, name,
-- sizeof(m.u.component_create.name));
--
-- ret = send_synchronous_mmal_msg(instance, &m,
-- sizeof(m.u.component_create),
-- &rmsg, &rmsg_handle);
-- if (ret)
-- return ret;
--
-- if (rmsg->h.type != m.h.type) {
-- /* got an unexpected message type in reply */
-- ret = -EINVAL;
-- goto release_msg;
-- }
--
-- ret = -rmsg->u.component_create_reply.status;
-- if (ret != MMAL_MSG_STATUS_SUCCESS)
-- goto release_msg;
--
-- /* a valid component response received */
-- component->handle = rmsg->u.component_create_reply.component_handle;
-- component->inputs = rmsg->u.component_create_reply.input_num;
-- component->outputs = rmsg->u.component_create_reply.output_num;
-- component->clocks = rmsg->u.component_create_reply.clock_num;
--
-- pr_debug("Component handle:0x%x in:%d out:%d clock:%d\n",
-- component->handle,
-- component->inputs, component->outputs, component->clocks);
--
--release_msg:
-- vchi_held_msg_release(&rmsg_handle);
--
-- return ret;
--}
--
--/* destroys a component on vc */
--static int destroy_component(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_component *component)
--{
-- int ret;
-- struct mmal_msg m;
-- struct mmal_msg *rmsg;
-- VCHI_HELD_MSG_T rmsg_handle;
--
-- m.h.type = MMAL_MSG_TYPE_COMPONENT_DESTROY;
-- m.u.component_destroy.component_handle = component->handle;
--
-- ret = send_synchronous_mmal_msg(instance, &m,
-- sizeof(m.u.component_destroy),
-- &rmsg, &rmsg_handle);
-- if (ret)
-- return ret;
--
-- if (rmsg->h.type != m.h.type) {
-- /* got an unexpected message type in reply */
-- ret = -EINVAL;
-- goto release_msg;
-- }
--
-- ret = -rmsg->u.component_destroy_reply.status;
--
--release_msg:
--
-- vchi_held_msg_release(&rmsg_handle);
--
-- return ret;
--}
--
--/* enable a component on vc */
--static int enable_component(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_component *component)
--{
-- int ret;
-- struct mmal_msg m;
-- struct mmal_msg *rmsg;
-- VCHI_HELD_MSG_T rmsg_handle;
--
-- m.h.type = MMAL_MSG_TYPE_COMPONENT_ENABLE;
-- m.u.component_enable.component_handle = component->handle;
--
-- ret = send_synchronous_mmal_msg(instance, &m,
-- sizeof(m.u.component_enable),
-- &rmsg, &rmsg_handle);
-- if (ret)
-- return ret;
--
-- if (rmsg->h.type != m.h.type) {
-- /* got an unexpected message type in reply */
-- ret = -EINVAL;
-- goto release_msg;
-- }
--
-- ret = -rmsg->u.component_enable_reply.status;
--
--release_msg:
-- vchi_held_msg_release(&rmsg_handle);
--
-- return ret;
--}
--
--/* disable a component on vc */
--static int disable_component(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_component *component)
--{
-- int ret;
-- struct mmal_msg m;
-- struct mmal_msg *rmsg;
-- VCHI_HELD_MSG_T rmsg_handle;
--
-- m.h.type = MMAL_MSG_TYPE_COMPONENT_DISABLE;
-- m.u.component_disable.component_handle = component->handle;
--
-- ret = send_synchronous_mmal_msg(instance, &m,
-- sizeof(m.u.component_disable),
-- &rmsg, &rmsg_handle);
-- if (ret)
-- return ret;
--
-- if (rmsg->h.type != m.h.type) {
-- /* got an unexpected message type in reply */
-- ret = -EINVAL;
-- goto release_msg;
-- }
--
-- ret = -rmsg->u.component_disable_reply.status;
--
--release_msg:
--
-- vchi_held_msg_release(&rmsg_handle);
--
-- return ret;
--}
--
--/* get version of mmal implementation */
--static int get_version(struct vchiq_mmal_instance *instance,
-- u32 *major_out, u32 *minor_out)
--{
-- int ret;
-- struct mmal_msg m;
-- struct mmal_msg *rmsg;
-- VCHI_HELD_MSG_T rmsg_handle;
--
-- m.h.type = MMAL_MSG_TYPE_GET_VERSION;
--
-- ret = send_synchronous_mmal_msg(instance, &m,
-- sizeof(m.u.version),
-- &rmsg, &rmsg_handle);
-- if (ret)
-- return ret;
--
-- if (rmsg->h.type != m.h.type) {
-- /* got an unexpected message type in reply */
-- ret = -EINVAL;
-- goto release_msg;
-- }
--
-- *major_out = rmsg->u.version.major;
-- *minor_out = rmsg->u.version.minor;
--
--release_msg:
-- vchi_held_msg_release(&rmsg_handle);
--
-- return ret;
--}
--
--/* do a port action with a port as a parameter */
--static int port_action_port(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_port *port,
-- enum mmal_msg_port_action_type action_type)
--{
-- int ret;
-- struct mmal_msg m;
-- struct mmal_msg *rmsg;
-- VCHI_HELD_MSG_T rmsg_handle;
--
-- m.h.type = MMAL_MSG_TYPE_PORT_ACTION;
-- m.u.port_action_port.component_handle = port->component->handle;
-- m.u.port_action_port.port_handle = port->handle;
-- m.u.port_action_port.action = action_type;
--
-- port_to_mmal_msg(port, &m.u.port_action_port.port);
--
-- ret = send_synchronous_mmal_msg(instance, &m,
-- sizeof(m.u.port_action_port),
-- &rmsg, &rmsg_handle);
-- if (ret)
-- return ret;
--
-- if (rmsg->h.type != MMAL_MSG_TYPE_PORT_ACTION) {
-- /* got an unexpected message type in reply */
-- ret = -EINVAL;
-- goto release_msg;
-- }
--
-- ret = -rmsg->u.port_action_reply.status;
--
-- pr_debug("%s:result:%d component:0x%x port:%d action:%s(%d)\n",
-- __func__,
-- ret, port->component->handle, port->handle,
-- port_action_type_names[action_type], action_type);
--
--release_msg:
-- vchi_held_msg_release(&rmsg_handle);
--
-- return ret;
--}
--
--/* do a port action with handles as parameters */
--static int port_action_handle(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_port *port,
-- enum mmal_msg_port_action_type action_type,
-- u32 connect_component_handle,
-- u32 connect_port_handle)
--{
-- int ret;
-- struct mmal_msg m;
-- struct mmal_msg *rmsg;
-- VCHI_HELD_MSG_T rmsg_handle;
--
-- m.h.type = MMAL_MSG_TYPE_PORT_ACTION;
--
-- m.u.port_action_handle.component_handle = port->component->handle;
-- m.u.port_action_handle.port_handle = port->handle;
-- m.u.port_action_handle.action = action_type;
--
-- m.u.port_action_handle.connect_component_handle =
-- connect_component_handle;
-- m.u.port_action_handle.connect_port_handle = connect_port_handle;
--
-- ret = send_synchronous_mmal_msg(instance, &m,
-- sizeof(m.u.port_action_handle),
-- &rmsg, &rmsg_handle);
-- if (ret)
-- return ret;
--
-- if (rmsg->h.type != MMAL_MSG_TYPE_PORT_ACTION) {
-- /* got an unexpected message type in reply */
-- ret = -EINVAL;
-- goto release_msg;
-- }
--
-- ret = -rmsg->u.port_action_reply.status;
--
-- pr_debug("%s:result:%d component:0x%x port:%d action:%s(%d) connect component:0x%x connect port:%d\n",
-- __func__,
-- ret, port->component->handle, port->handle,
-- port_action_type_names[action_type],
-- action_type, connect_component_handle, connect_port_handle);
--
--release_msg:
-- vchi_held_msg_release(&rmsg_handle);
--
-- return ret;
--}
--
--static int port_parameter_set(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_port *port,
-- u32 parameter_id, void *value, u32 value_size)
--{
-- int ret;
-- struct mmal_msg m;
-- struct mmal_msg *rmsg;
-- VCHI_HELD_MSG_T rmsg_handle;
--
-- m.h.type = MMAL_MSG_TYPE_PORT_PARAMETER_SET;
--
-- m.u.port_parameter_set.component_handle = port->component->handle;
-- m.u.port_parameter_set.port_handle = port->handle;
-- m.u.port_parameter_set.id = parameter_id;
-- m.u.port_parameter_set.size = (2 * sizeof(u32)) + value_size;
-- memcpy(&m.u.port_parameter_set.value, value, value_size);
--
-- ret = send_synchronous_mmal_msg(instance, &m,
-- (4 * sizeof(u32)) + value_size,
-- &rmsg, &rmsg_handle);
-- if (ret)
-- return ret;
--
-- if (rmsg->h.type != MMAL_MSG_TYPE_PORT_PARAMETER_SET) {
-- /* got an unexpected message type in reply */
-- ret = -EINVAL;
-- goto release_msg;
-- }
--
-- ret = -rmsg->u.port_parameter_set_reply.status;
--
-- pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n",
-- __func__,
-- ret, port->component->handle, port->handle, parameter_id);
--
--release_msg:
-- vchi_held_msg_release(&rmsg_handle);
--
-- return ret;
--}
--
--static int port_parameter_get(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_port *port,
-- u32 parameter_id, void *value, u32 *value_size)
--{
-- int ret;
-- struct mmal_msg m;
-- struct mmal_msg *rmsg;
-- VCHI_HELD_MSG_T rmsg_handle;
--
-- m.h.type = MMAL_MSG_TYPE_PORT_PARAMETER_GET;
--
-- m.u.port_parameter_get.component_handle = port->component->handle;
-- m.u.port_parameter_get.port_handle = port->handle;
-- m.u.port_parameter_get.id = parameter_id;
-- m.u.port_parameter_get.size = (2 * sizeof(u32)) + *value_size;
--
-- ret = send_synchronous_mmal_msg(instance, &m,
-- sizeof(struct
-- mmal_msg_port_parameter_get),
-- &rmsg, &rmsg_handle);
-- if (ret)
-- return ret;
--
-- if (rmsg->h.type != MMAL_MSG_TYPE_PORT_PARAMETER_GET) {
-- /* got an unexpected message type in reply */
-- pr_err("Incorrect reply type %d\n", rmsg->h.type);
-- ret = -EINVAL;
-- goto release_msg;
-- }
--
-- ret = -rmsg->u.port_parameter_get_reply.status;
-- /* port_parameter_get_reply.size includes the header,
-- * whilst *value_size doesn't.
-- */
-- rmsg->u.port_parameter_get_reply.size -= (2 * sizeof(u32));
--
-- if (ret || rmsg->u.port_parameter_get_reply.size > *value_size) {
-- /* Copy only as much as we have space for
-- * but report true size of parameter
-- */
-- memcpy(value, &rmsg->u.port_parameter_get_reply.value,
-- *value_size);
-- *value_size = rmsg->u.port_parameter_get_reply.size;
-- } else {
-- memcpy(value, &rmsg->u.port_parameter_get_reply.value,
-- rmsg->u.port_parameter_get_reply.size);
-- }
--
-- pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n", __func__,
-- ret, port->component->handle, port->handle, parameter_id);
--
--release_msg:
-- vchi_held_msg_release(&rmsg_handle);
--
-- return ret;
--}
--
--/* disables a port and drains buffers from it */
--static int port_disable(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_port *port)
--{
-- int ret;
-- struct list_head *q, *buf_head;
-- unsigned long flags = 0;
--
-- if (!port->enabled)
-- return 0;
--
-- port->enabled = false;
--
-- ret = port_action_port(instance, port,
-- MMAL_MSG_PORT_ACTION_TYPE_DISABLE);
-- if (ret == 0) {
-- /*
-- * Drain all queued buffers on port. This should only
-- * apply to buffers that have been queued before the port
-- * has been enabled. If the port has been enabled and buffers
-- * passed, then the buffers should have been removed from this
-- * list, and we should get the relevant callbacks via VCHIQ
-- * to release the buffers.
-- */
-- spin_lock_irqsave(&port->slock, flags);
--
-- list_for_each_safe(buf_head, q, &port->buffers) {
-- struct mmal_buffer *mmalbuf;
--
-- mmalbuf = list_entry(buf_head, struct mmal_buffer,
-- list);
-- list_del(buf_head);
-- if (port->buffer_cb)
-- port->buffer_cb(instance,
-- port, 0, mmalbuf, 0, 0,
-- MMAL_TIME_UNKNOWN,
-- MMAL_TIME_UNKNOWN);
-- }
--
-- spin_unlock_irqrestore(&port->slock, flags);
--
-- ret = port_info_get(instance, port);
-- }
--
-- return ret;
--}
--
--/* enable a port */
--static int port_enable(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_port *port)
--{
-- unsigned int hdr_count;
-- struct list_head *q, *buf_head;
-- int ret;
--
-- if (port->enabled)
-- return 0;
--
-- ret = port_action_port(instance, port,
-- MMAL_MSG_PORT_ACTION_TYPE_ENABLE);
-- if (ret)
-- goto done;
--
-- port->enabled = true;
--
-- if (port->buffer_cb) {
-- /* send buffer headers to videocore */
-- hdr_count = 1;
-- list_for_each_safe(buf_head, q, &port->buffers) {
-- struct mmal_buffer *mmalbuf;
--
-- mmalbuf = list_entry(buf_head, struct mmal_buffer,
-- list);
-- ret = buffer_from_host(instance, port, mmalbuf);
-- if (ret)
-- goto done;
--
-- list_del(buf_head);
-- hdr_count++;
-- if (hdr_count > port->current_buffer.num)
-- break;
-- }
-- }
--
-- ret = port_info_get(instance, port);
--
--done:
-- return ret;
--}
--
--/* ------------------------------------------------------------------
-- * Exported API
-- *------------------------------------------------------------------
-- */
--
--int vchiq_mmal_port_set_format(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_port *port)
--{
-- int ret;
--
-- if (mutex_lock_interruptible(&instance->vchiq_mutex))
-- return -EINTR;
--
-- ret = port_info_set(instance, port);
-- if (ret)
-- goto release_unlock;
--
-- /* read what has actually been set */
-- ret = port_info_get(instance, port);
--
--release_unlock:
-- mutex_unlock(&instance->vchiq_mutex);
--
-- return ret;
--}
--
--int vchiq_mmal_port_parameter_set(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_port *port,
-- u32 parameter, void *value, u32 value_size)
--{
-- int ret;
--
-- if (mutex_lock_interruptible(&instance->vchiq_mutex))
-- return -EINTR;
--
-- ret = port_parameter_set(instance, port, parameter, value, value_size);
--
-- mutex_unlock(&instance->vchiq_mutex);
--
-- return ret;
--}
--
--int vchiq_mmal_port_parameter_get(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_port *port,
-- u32 parameter, void *value, u32 *value_size)
--{
-- int ret;
--
-- if (mutex_lock_interruptible(&instance->vchiq_mutex))
-- return -EINTR;
--
-- ret = port_parameter_get(instance, port, parameter, value, value_size);
--
-- mutex_unlock(&instance->vchiq_mutex);
--
-- return ret;
--}
--
--/* enable a port
-- *
-- * enables a port and queues buffers for satisfying callbacks if we
-- * provide a callback handler
-- */
--int vchiq_mmal_port_enable(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_port *port,
-- vchiq_mmal_buffer_cb buffer_cb)
--{
-- int ret;
--
-- if (mutex_lock_interruptible(&instance->vchiq_mutex))
-- return -EINTR;
--
-- /* already enabled - noop */
-- if (port->enabled) {
-- ret = 0;
-- goto unlock;
-- }
--
-- port->buffer_cb = buffer_cb;
--
-- ret = port_enable(instance, port);
--
--unlock:
-- mutex_unlock(&instance->vchiq_mutex);
--
-- return ret;
--}
--
--int vchiq_mmal_port_disable(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_port *port)
--{
-- int ret;
--
-- if (mutex_lock_interruptible(&instance->vchiq_mutex))
-- return -EINTR;
--
-- if (!port->enabled) {
-- mutex_unlock(&instance->vchiq_mutex);
-- return 0;
-- }
--
-- ret = port_disable(instance, port);
--
-- mutex_unlock(&instance->vchiq_mutex);
--
-- return ret;
--}
--
--/* ports will be connected in a tunneled manner so data buffers
-- * are not handled by client.
-- */
--int vchiq_mmal_port_connect_tunnel(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_port *src,
-- struct vchiq_mmal_port *dst)
--{
-- int ret;
--
-- if (mutex_lock_interruptible(&instance->vchiq_mutex))
-- return -EINTR;
--
-- /* disconnect ports if connected */
-- if (src->connected) {
-- ret = port_disable(instance, src);
-- if (ret) {
-- pr_err("failed disabling src port(%d)\n", ret);
-- goto release_unlock;
-- }
--
-- /* do not need to disable the destination port as they
-- * are connected and it is done automatically
-- */
--
-- ret = port_action_handle(instance, src,
-- MMAL_MSG_PORT_ACTION_TYPE_DISCONNECT,
-- src->connected->component->handle,
-- src->connected->handle);
-- if (ret < 0) {
-- pr_err("failed disconnecting src port\n");
-- goto release_unlock;
-- }
-- src->connected->enabled = false;
-- src->connected = NULL;
-- }
--
-- if (!dst) {
-- /* do not make new connection */
-- ret = 0;
-- pr_debug("not making new connection\n");
-- goto release_unlock;
-- }
--
-- /* copy src port format to dst */
-- dst->format.encoding = src->format.encoding;
-- dst->es.video.width = src->es.video.width;
-- dst->es.video.height = src->es.video.height;
-- dst->es.video.crop.x = src->es.video.crop.x;
-- dst->es.video.crop.y = src->es.video.crop.y;
-- dst->es.video.crop.width = src->es.video.crop.width;
-- dst->es.video.crop.height = src->es.video.crop.height;
-- dst->es.video.frame_rate.num = src->es.video.frame_rate.num;
-- dst->es.video.frame_rate.den = src->es.video.frame_rate.den;
--
-- /* set new format */
-- ret = port_info_set(instance, dst);
-- if (ret) {
-- pr_debug("setting port info failed\n");
-- goto release_unlock;
-- }
--
-- /* read what has actually been set */
-- ret = port_info_get(instance, dst);
-- if (ret) {
-- pr_debug("read back port info failed\n");
-- goto release_unlock;
-- }
--
-- /* connect two ports together */
-- ret = port_action_handle(instance, src,
-- MMAL_MSG_PORT_ACTION_TYPE_CONNECT,
-- dst->component->handle, dst->handle);
-- if (ret < 0) {
-- pr_debug("connecting port %d:%d to %d:%d failed\n",
-- src->component->handle, src->handle,
-- dst->component->handle, dst->handle);
-- goto release_unlock;
-- }
-- src->connected = dst;
--
--release_unlock:
--
-- mutex_unlock(&instance->vchiq_mutex);
--
-- return ret;
--}
--
--int vchiq_mmal_submit_buffer(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_port *port,
-- struct mmal_buffer *buffer)
--{
-- unsigned long flags = 0;
-- int ret;
--
-- ret = buffer_from_host(instance, port, buffer);
-- if (ret == -EINVAL) {
-- /* Port is disabled. Queue for when it is enabled. */
-- spin_lock_irqsave(&port->slock, flags);
-- list_add_tail(&buffer->list, &port->buffers);
-- spin_unlock_irqrestore(&port->slock, flags);
-- }
--
-- return 0;
--}
--
--int mmal_vchi_buffer_init(struct vchiq_mmal_instance *instance,
-- struct mmal_buffer *buf)
--{
-- struct mmal_msg_context *msg_context = get_msg_context(instance);
--
-- if (IS_ERR(msg_context))
-- return (PTR_ERR(msg_context));
--
-- buf->msg_context = msg_context;
-- return 0;
--}
--
--int mmal_vchi_buffer_cleanup(struct mmal_buffer *buf)
--{
-- struct mmal_msg_context *msg_context = buf->msg_context;
--
-- if (msg_context)
-- release_msg_context(msg_context);
-- buf->msg_context = NULL;
--
-- return 0;
--}
--
--/* Initialise a mmal component and its ports
-- *
-- */
--int vchiq_mmal_component_init(struct vchiq_mmal_instance *instance,
-- const char *name,
-- struct vchiq_mmal_component **component_out)
--{
-- int ret;
-- int idx; /* port index */
-- struct vchiq_mmal_component *component;
--
-- if (mutex_lock_interruptible(&instance->vchiq_mutex))
-- return -EINTR;
--
-- if (instance->component_idx == VCHIQ_MMAL_MAX_COMPONENTS) {
-- ret = -EINVAL; /* todo is this correct error? */
-- goto unlock;
-- }
--
-- component = &instance->component[instance->component_idx];
--
-- ret = create_component(instance, component, name);
-- if (ret < 0) {
-- pr_err("%s: failed to create component %d (Not enough GPU mem?)\n",
-- __func__, ret);
-- goto unlock;
-- }
--
-- /* ports info needs gathering */
-- component->control.type = MMAL_PORT_TYPE_CONTROL;
-- component->control.index = 0;
-- component->control.component = component;
-- spin_lock_init(&component->control.slock);
-- INIT_LIST_HEAD(&component->control.buffers);
-- ret = port_info_get(instance, &component->control);
-- if (ret < 0)
-- goto release_component;
--
-- for (idx = 0; idx < component->inputs; idx++) {
-- component->input[idx].type = MMAL_PORT_TYPE_INPUT;
-- component->input[idx].index = idx;
-- component->input[idx].component = component;
-- spin_lock_init(&component->input[idx].slock);
-- INIT_LIST_HEAD(&component->input[idx].buffers);
-- ret = port_info_get(instance, &component->input[idx]);
-- if (ret < 0)
-- goto release_component;
-- }
--
-- for (idx = 0; idx < component->outputs; idx++) {
-- component->output[idx].type = MMAL_PORT_TYPE_OUTPUT;
-- component->output[idx].index = idx;
-- component->output[idx].component = component;
-- spin_lock_init(&component->output[idx].slock);
-- INIT_LIST_HEAD(&component->output[idx].buffers);
-- ret = port_info_get(instance, &component->output[idx]);
-- if (ret < 0)
-- goto release_component;
-- }
--
-- for (idx = 0; idx < component->clocks; idx++) {
-- component->clock[idx].type = MMAL_PORT_TYPE_CLOCK;
-- component->clock[idx].index = idx;
-- component->clock[idx].component = component;
-- spin_lock_init(&component->clock[idx].slock);
-- INIT_LIST_HEAD(&component->clock[idx].buffers);
-- ret = port_info_get(instance, &component->clock[idx]);
-- if (ret < 0)
-- goto release_component;
-- }
--
-- instance->component_idx++;
--
-- *component_out = component;
--
-- mutex_unlock(&instance->vchiq_mutex);
--
-- return 0;
--
--release_component:
-- destroy_component(instance, component);
--unlock:
-- mutex_unlock(&instance->vchiq_mutex);
--
-- return ret;
--}
--
--/*
-- * cause a mmal component to be destroyed
-- */
--int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_component *component)
--{
-- int ret;
--
-- if (mutex_lock_interruptible(&instance->vchiq_mutex))
-- return -EINTR;
--
-- if (component->enabled)
-- ret = disable_component(instance, component);
--
-- ret = destroy_component(instance, component);
--
-- mutex_unlock(&instance->vchiq_mutex);
--
-- return ret;
--}
--
--/*
-- * cause a mmal component to be enabled
-- */
--int vchiq_mmal_component_enable(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_component *component)
--{
-- int ret;
--
-- if (mutex_lock_interruptible(&instance->vchiq_mutex))
-- return -EINTR;
--
-- if (component->enabled) {
-- mutex_unlock(&instance->vchiq_mutex);
-- return 0;
-- }
--
-- ret = enable_component(instance, component);
-- if (ret == 0)
-- component->enabled = true;
--
-- mutex_unlock(&instance->vchiq_mutex);
--
-- return ret;
--}
--
--/*
-- * cause a mmal component to be enabled
-- */
--int vchiq_mmal_component_disable(struct vchiq_mmal_instance *instance,
-- struct vchiq_mmal_component *component)
--{
-- int ret;
--
-- if (mutex_lock_interruptible(&instance->vchiq_mutex))
-- return -EINTR;
--
-- if (!component->enabled) {
-- mutex_unlock(&instance->vchiq_mutex);
-- return 0;
-- }
--
-- ret = disable_component(instance, component);
-- if (ret == 0)
-- component->enabled = false;
--
-- mutex_unlock(&instance->vchiq_mutex);
--
-- return ret;
--}
--
--int vchiq_mmal_version(struct vchiq_mmal_instance *instance,
-- u32 *major_out, u32 *minor_out)
--{
-- int ret;
--
-- if (mutex_lock_interruptible(&instance->vchiq_mutex))
-- return -EINTR;
--
-- ret = get_version(instance, major_out, minor_out);
--
-- mutex_unlock(&instance->vchiq_mutex);
--
-- return ret;
--}
--
--int vchiq_mmal_finalise(struct vchiq_mmal_instance *instance)
--{
-- int status = 0;
--
-- if (!instance)
-- return -EINVAL;
--
-- if (mutex_lock_interruptible(&instance->vchiq_mutex))
-- return -EINTR;
--
-- vchi_service_use(instance->handle);
--
-- status = vchi_service_close(instance->handle);
-- if (status != 0)
-- pr_err("mmal-vchiq: VCHIQ close failed\n");
--
-- mutex_unlock(&instance->vchiq_mutex);
--
-- flush_workqueue(instance->bulk_wq);
-- destroy_workqueue(instance->bulk_wq);
--
-- vfree(instance->bulk_scratch);
--
-- idr_destroy(&instance->context_map);
--
-- kfree(instance);
--
-- return status;
--}
--
--int vchiq_mmal_init(struct vchiq_mmal_instance **out_instance)
--{
-- int status;
-- struct vchiq_mmal_instance *instance;
-- static VCHI_CONNECTION_T *vchi_connection;
-- static VCHI_INSTANCE_T vchi_instance;
-- SERVICE_CREATION_T params = {
-- .version = VCHI_VERSION_EX(VC_MMAL_VER, VC_MMAL_MIN_VER),
-- .service_id = VC_MMAL_SERVER_NAME,
-- .connection = vchi_connection,
-- .rx_fifo_size = 0,
-- .tx_fifo_size = 0,
-- .callback = service_callback,
-- .callback_param = NULL,
-- .want_unaligned_bulk_rx = 1,
-- .want_unaligned_bulk_tx = 1,
-- .want_crc = 0
-- };
--
-- /* compile time checks to ensure structure size as they are
-- * directly (de)serialised from memory.
-- */
--
-- /* ensure the header structure has packed to the correct size */
-- BUILD_BUG_ON(sizeof(struct mmal_msg_header) != 24);
--
-- /* ensure message structure does not exceed maximum length */
-- BUILD_BUG_ON(sizeof(struct mmal_msg) > MMAL_MSG_MAX_SIZE);
--
-- /* mmal port struct is correct size */
-- BUILD_BUG_ON(sizeof(struct mmal_port) != 64);
--
-- /* create a vchi instance */
-- status = vchi_initialise(&vchi_instance);
-- if (status) {
-- pr_err("Failed to initialise VCHI instance (status=%d)\n",
-- status);
-- return -EIO;
-- }
--
-- status = vchi_connect(NULL, 0, vchi_instance);
-- if (status) {
-- pr_err("Failed to connect VCHI instance (status=%d)\n", status);
-- return -EIO;
-- }
--
-- instance = kzalloc(sizeof(*instance), GFP_KERNEL);
--
-- if (!instance)
-- return -ENOMEM;
--
-- mutex_init(&instance->vchiq_mutex);
--
-- instance->bulk_scratch = vmalloc(PAGE_SIZE);
--
-- spin_lock_init(&instance->context_map_lock);
-- idr_init_base(&instance->context_map, 1);
--
-- params.callback_param = instance;
--
-- instance->bulk_wq = alloc_ordered_workqueue("mmal-vchiq",
-- WQ_MEM_RECLAIM);
-- if (!instance->bulk_wq)
-- goto err_free;
--
-- status = vchi_service_open(vchi_instance, &params, &instance->handle);
-- if (status) {
-- pr_err("Failed to open VCHI service connection (status=%d)\n",
-- status);
-- goto err_close_services;
-- }
--
-- vchi_service_release(instance->handle);
--
-- *out_instance = instance;
--
-- return 0;
--
--err_close_services:
-- vchi_service_close(instance->handle);
-- destroy_workqueue(instance->bulk_wq);
--err_free:
-- vfree(instance->bulk_scratch);
-- kfree(instance);
-- return -ENODEV;
--}
--- /dev/null
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
-@@ -0,0 +1,1920 @@
+@@ -0,0 +1,1921 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Broadcom BM2835 V4L2 driver
@@ -2186,7 +285,8 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
+ void *bulk_scratch;
+
+ struct idr context_map;
-+ spinlock_t context_map_lock;
++ /* protect accesses to context_map */
++ struct mutex context_map_lock;
+
+ /* component to use next */
+ int component_idx;
@@ -2212,10 +312,10 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
+ * that when we service the VCHI reply, we can look up what
+ * message is being replied to.
+ */
-+ spin_lock(&instance->context_map_lock);
++ mutex_lock(&instance->context_map_lock);
+ handle = idr_alloc(&instance->context_map, msg_context,
+ 0, 0, GFP_KERNEL);
-+ spin_unlock(&instance->context_map_lock);
++ mutex_unlock(&instance->context_map_lock);
+
+ if (handle < 0) {
+ kfree(msg_context);
@@ -2239,9 +339,9 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
+{
+ struct vchiq_mmal_instance *instance = msg_context->instance;
+
-+ spin_lock(&instance->context_map_lock);
++ mutex_lock(&instance->context_map_lock);
+ idr_remove(&instance->context_map, msg_context->handle);
-+ spin_unlock(&instance->context_map_lock);
++ mutex_unlock(&instance->context_map_lock);
+ kfree(msg_context);
+}
+
@@ -3901,7 +2001,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
+
+ instance->bulk_scratch = vmalloc(PAGE_SIZE);
+
-+ spin_lock_init(&instance->context_map_lock);
++ mutex_init(&instance->context_map_lock);
+ idr_init_base(&instance->context_map, 1);
+
+ params.callback_param = instance;
diff --git a/target/linux/brcm2708/patches-4.19/950-0268-staging-mmal-vchiq-Allocate-and-free-components-as-r.patch b/target/linux/brcm2708/patches-4.19/950-0268-staging-mmal-vchiq-Allocate-and-free-components-as-r.patch
index fefea5d9bb..4764ae297e 100644
--- a/target/linux/brcm2708/patches-4.19/950-0268-staging-mmal-vchiq-Allocate-and-free-components-as-r.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0268-staging-mmal-vchiq-Allocate-and-free-components-as-r.patch
@@ -30,16 +30,16 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
/*#define FULL_MSG_DUMP 1*/
-@@ -173,8 +176,6 @@ struct vchiq_mmal_instance {
- struct idr context_map;
- spinlock_t context_map_lock;
+@@ -174,8 +177,6 @@ struct vchiq_mmal_instance {
+ /* protect accesses to context_map */
+ struct mutex context_map_lock;
- /* component to use next */
- int component_idx;
struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS];
/* ordered workqueue to process all bulk operations */
-@@ -1631,18 +1632,24 @@ int vchiq_mmal_component_init(struct vch
+@@ -1632,18 +1633,24 @@ int vchiq_mmal_component_init(struct vch
{
int ret;
int idx; /* port index */
@@ -68,7 +68,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
ret = create_component(instance, component, name);
if (ret < 0) {
pr_err("%s: failed to create component %d (Not enough GPU mem?)\n",
-@@ -1693,8 +1700,6 @@ int vchiq_mmal_component_init(struct vch
+@@ -1694,8 +1701,6 @@ int vchiq_mmal_component_init(struct vch
goto release_component;
}
@@ -77,7 +77,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
*component_out = component;
mutex_unlock(&instance->vchiq_mutex);
-@@ -1704,6 +1709,8 @@ int vchiq_mmal_component_init(struct vch
+@@ -1705,6 +1710,8 @@ int vchiq_mmal_component_init(struct vch
release_component:
destroy_component(instance, component);
unlock:
@@ -86,7 +86,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
mutex_unlock(&instance->vchiq_mutex);
return ret;
-@@ -1726,6 +1733,8 @@ int vchiq_mmal_component_finalise(struct
+@@ -1727,6 +1734,8 @@ int vchiq_mmal_component_finalise(struct
ret = destroy_component(instance, component);
diff --git a/target/linux/brcm2708/patches-4.19/950-0269-staging-mmal-vchiq-Avoid-use-of-bool-in-structures.patch b/target/linux/brcm2708/patches-4.19/950-0269-staging-mmal-vchiq-Avoid-use-of-bool-in-structures.patch
index 9a2d443125..48cc89eec9 100644
--- a/target/linux/brcm2708/patches-4.19/950-0269-staging-mmal-vchiq-Avoid-use-of-bool-in-structures.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0269-staging-mmal-vchiq-Avoid-use-of-bool-in-structures.patch
@@ -14,7 +14,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
-@@ -860,9 +860,9 @@ static int port_info_get(struct vchiq_mm
+@@ -861,9 +861,9 @@ static int port_info_get(struct vchiq_mm
goto release_msg;
if (rmsg->u.port_info_get_reply.port.is_enabled == 0)
@@ -26,7 +26,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
/* copy the values out of the message */
port->handle = rmsg->u.port_info_get_reply.port_handle;
-@@ -1299,7 +1299,7 @@ static int port_disable(struct vchiq_mma
+@@ -1300,7 +1300,7 @@ static int port_disable(struct vchiq_mma
if (!port->enabled)
return 0;
@@ -35,7 +35,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
ret = port_action_port(instance, port,
MMAL_MSG_PORT_ACTION_TYPE_DISABLE);
-@@ -1351,7 +1351,7 @@ static int port_enable(struct vchiq_mmal
+@@ -1352,7 +1352,7 @@ static int port_enable(struct vchiq_mmal
if (ret)
goto done;
@@ -44,7 +44,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
if (port->buffer_cb) {
/* send buffer headers to videocore */
-@@ -1523,7 +1523,7 @@ int vchiq_mmal_port_connect_tunnel(struc
+@@ -1524,7 +1524,7 @@ int vchiq_mmal_port_connect_tunnel(struc
pr_err("failed disconnecting src port\n");
goto release_unlock;
}
@@ -53,7 +53,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
src->connected = NULL;
}
-@@ -1759,7 +1759,7 @@ int vchiq_mmal_component_enable(struct v
+@@ -1760,7 +1760,7 @@ int vchiq_mmal_component_enable(struct v
ret = enable_component(instance, component);
if (ret == 0)
@@ -62,7 +62,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
mutex_unlock(&instance->vchiq_mutex);
-@@ -1785,7 +1785,7 @@ int vchiq_mmal_component_disable(struct
+@@ -1786,7 +1786,7 @@ int vchiq_mmal_component_disable(struct
ret = disable_component(instance, component);
if (ret == 0)
diff --git a/target/linux/brcm2708/patches-4.19/950-0270-staging-mmal-vchiq-Make-timeout-a-defined-parameter.patch b/target/linux/brcm2708/patches-4.19/950-0270-staging-mmal-vchiq-Make-timeout-a-defined-parameter.patch
index 6168d078f8..bcccde74de 100644
--- a/target/linux/brcm2708/patches-4.19/950-0270-staging-mmal-vchiq-Make-timeout-a-defined-parameter.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0270-staging-mmal-vchiq-Make-timeout-a-defined-parameter.patch
@@ -27,7 +27,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
/*#define FULL_MSG_DUMP 1*/
#ifdef DEBUG
-@@ -691,7 +697,7 @@ static int send_synchronous_mmal_msg(str
+@@ -692,7 +698,7 @@ static int send_synchronous_mmal_msg(str
}
timeout = wait_for_completion_timeout(&msg_context->u.sync.cmplt,
diff --git a/target/linux/brcm2708/patches-4.19/950-0271-staging-mmal-vchiq-Make-a-mmal_buf-struct-for-passin.patch b/target/linux/brcm2708/patches-4.19/950-0271-staging-mmal-vchiq-Make-a-mmal_buf-struct-for-passin.patch
index daf73061f0..d32aa85445 100644
--- a/target/linux/brcm2708/patches-4.19/950-0271-staging-mmal-vchiq-Make-a-mmal_buf-struct-for-passin.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0271-staging-mmal-vchiq-Make-a-mmal_buf-struct-for-passin.patch
@@ -216,7 +216,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
/* */
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
-@@ -258,17 +258,25 @@ static void buffer_work_cb(struct work_s
+@@ -259,17 +259,25 @@ static void buffer_work_cb(struct work_s
{
struct mmal_msg_context *msg_context =
container_of(work, struct mmal_msg_context, u.bulk.work);
@@ -247,7 +247,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
}
/* workqueue scheduled callback to handle receiving buffers
-@@ -1326,11 +1334,14 @@ static int port_disable(struct vchiq_mma
+@@ -1327,11 +1335,14 @@ static int port_disable(struct vchiq_mma
mmalbuf = list_entry(buf_head, struct mmal_buffer,
list);
list_del(buf_head);
diff --git a/target/linux/brcm2708/patches-4.19/950-0272-staging-mmal-vchiq-Add-support-for-event-callbacks.patch b/target/linux/brcm2708/patches-4.19/950-0272-staging-mmal-vchiq-Add-support-for-event-callbacks.patch
index 4744405a45..34006c5377 100644
--- a/target/linux/brcm2708/patches-4.19/950-0272-staging-mmal-vchiq-Add-support-for-event-callbacks.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0272-staging-mmal-vchiq-Add-support-for-event-callbacks.patch
@@ -83,7 +83,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
int status; /* context status */
-@@ -237,18 +239,6 @@ release_msg_context(struct mmal_msg_cont
+@@ -238,18 +240,6 @@ release_msg_context(struct mmal_msg_cont
kfree(msg_context);
}
@@ -102,7 +102,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
/* workqueue scheduled callback
*
* we do this because it is important we do not call any other vchiq
-@@ -270,13 +260,18 @@ static void buffer_work_cb(struct work_s
+@@ -271,13 +261,18 @@ static void buffer_work_cb(struct work_s
buffer->mmal_flags = msg_context->u.bulk.mmal_flags;
buffer->dts = msg_context->u.bulk.dts;
buffer->pts = msg_context->u.bulk.pts;
@@ -122,7 +122,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
}
/* workqueue scheduled callback to handle receiving buffers
-@@ -355,6 +350,7 @@ static int bulk_receive(struct vchiq_mma
+@@ -356,6 +351,7 @@ static int bulk_receive(struct vchiq_mma
msg_context->u.bulk.buffer_used = rd_len;
msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts;
msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts;
@@ -130,7 +130,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
queue_work(msg_context->instance->bulk_wq,
&msg_context->u.bulk.buffer_to_host_work);
-@@ -456,6 +452,103 @@ buffer_from_host(struct vchiq_mmal_insta
+@@ -457,6 +453,103 @@ buffer_from_host(struct vchiq_mmal_insta
return ret;
}
@@ -234,7 +234,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
/* deals with receipt of buffer to host message */
static void buffer_to_host_cb(struct vchiq_mmal_instance *instance,
struct mmal_msg *msg, u32 msg_len)
-@@ -1339,6 +1432,7 @@ static int port_disable(struct vchiq_mma
+@@ -1340,6 +1433,7 @@ static int port_disable(struct vchiq_mma
mmalbuf->mmal_flags = 0;
mmalbuf->dts = MMAL_TIME_UNKNOWN;
mmalbuf->pts = MMAL_TIME_UNKNOWN;
@@ -242,7 +242,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
port->buffer_cb(instance,
port, 0, mmalbuf);
}
-@@ -1640,6 +1734,43 @@ int mmal_vchi_buffer_cleanup(struct mmal
+@@ -1641,6 +1735,43 @@ int mmal_vchi_buffer_cleanup(struct mmal
}
EXPORT_SYMBOL_GPL(mmal_vchi_buffer_cleanup);
@@ -286,7 +286,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
/* Initialise a mmal component and its ports
*
*/
-@@ -1683,6 +1814,7 @@ int vchiq_mmal_component_init(struct vch
+@@ -1684,6 +1815,7 @@ int vchiq_mmal_component_init(struct vch
ret = port_info_get(instance, &component->control);
if (ret < 0)
goto release_component;
@@ -294,7 +294,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
for (idx = 0; idx < component->inputs; idx++) {
component->input[idx].type = MMAL_PORT_TYPE_INPUT;
-@@ -1693,6 +1825,7 @@ int vchiq_mmal_component_init(struct vch
+@@ -1694,6 +1826,7 @@ int vchiq_mmal_component_init(struct vch
ret = port_info_get(instance, &component->input[idx]);
if (ret < 0)
goto release_component;
@@ -302,7 +302,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
}
for (idx = 0; idx < component->outputs; idx++) {
-@@ -1704,6 +1837,7 @@ int vchiq_mmal_component_init(struct vch
+@@ -1705,6 +1838,7 @@ int vchiq_mmal_component_init(struct vch
ret = port_info_get(instance, &component->output[idx]);
if (ret < 0)
goto release_component;
@@ -310,7 +310,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
}
for (idx = 0; idx < component->clocks; idx++) {
-@@ -1715,6 +1849,7 @@ int vchiq_mmal_component_init(struct vch
+@@ -1716,6 +1850,7 @@ int vchiq_mmal_component_init(struct vch
ret = port_info_get(instance, &component->clock[idx]);
if (ret < 0)
goto release_component;
@@ -318,7 +318,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
}
*component_out = component;
-@@ -1740,7 +1875,7 @@ EXPORT_SYMBOL_GPL(vchiq_mmal_component_i
+@@ -1741,7 +1876,7 @@ EXPORT_SYMBOL_GPL(vchiq_mmal_component_i
int vchiq_mmal_component_finalise(struct vchiq_mmal_instance *instance,
struct vchiq_mmal_component *component)
{
@@ -327,7 +327,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
if (mutex_lock_interruptible(&instance->vchiq_mutex))
return -EINTR;
-@@ -1752,6 +1887,13 @@ int vchiq_mmal_component_finalise(struct
+@@ -1753,6 +1888,13 @@ int vchiq_mmal_component_finalise(struct
component->in_use = 0;
diff --git a/target/linux/brcm2708/patches-4.19/950-0273-staging-vc04_services-Support-sending-data-to-MMAL-p.patch b/target/linux/brcm2708/patches-4.19/950-0273-staging-vc04_services-Support-sending-data-to-MMAL-p.patch
index 735ef4a4f3..4d2a20fa5f 100644
--- a/target/linux/brcm2708/patches-4.19/950-0273-staging-vc04_services-Support-sending-data-to-MMAL-p.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0273-staging-vc04_services-Support-sending-data-to-MMAL-p.patch
@@ -15,7 +15,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
-@@ -427,11 +427,19 @@ buffer_from_host(struct vchiq_mmal_insta
+@@ -428,11 +428,19 @@ buffer_from_host(struct vchiq_mmal_insta
m.u.buffer_from_host.buffer_header.data =
(u32)(unsigned long)buf->buffer;
m.u.buffer_from_host.buffer_header.alloc_size = buf->buffer_size;
diff --git a/target/linux/brcm2708/patches-4.19/950-0277-staging-vc04_services-Use-vc-sm-cma-to-support-zero-.patch b/target/linux/brcm2708/patches-4.19/950-0277-staging-vc04_services-Use-vc-sm-cma-to-support-zero-.patch
index 93dbba1cc0..5d4c7a53c3 100644
--- a/target/linux/brcm2708/patches-4.19/950-0277-staging-vc04_services-Use-vc-sm-cma-to-support-zero-.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0277-staging-vc04_services-Use-vc-sm-cma-to-support-zero-.patch
@@ -53,7 +53,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
#define USE_VCHIQ_ARM
#include "interface/vchi/vchi.h"
-@@ -424,8 +427,13 @@ buffer_from_host(struct vchiq_mmal_insta
+@@ -425,8 +428,13 @@ buffer_from_host(struct vchiq_mmal_insta
/* buffer header */
m.u.buffer_from_host.buffer_header.cmd = 0;
@@ -69,7 +69,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
m.u.buffer_from_host.buffer_header.alloc_size = buf->buffer_size;
if (port->type == MMAL_PORT_TYPE_OUTPUT) {
m.u.buffer_from_host.buffer_header.length = 0;
-@@ -590,6 +598,22 @@ static void buffer_to_host_cb(struct vch
+@@ -591,6 +599,22 @@ static void buffer_to_host_cb(struct vch
msg_context->u.bulk.status = msg->h.status;
@@ -92,7 +92,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
} else if (msg->u.buffer_from_host.buffer_header.length == 0) {
/* empty buffer */
if (msg->u.buffer_from_host.buffer_header.flags &
-@@ -1537,6 +1561,9 @@ int vchiq_mmal_port_parameter_set(struct
+@@ -1538,6 +1562,9 @@ int vchiq_mmal_port_parameter_set(struct
mutex_unlock(&instance->vchiq_mutex);
@@ -102,7 +102,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
return ret;
}
EXPORT_SYMBOL_GPL(vchiq_mmal_port_parameter_set);
-@@ -1705,6 +1732,31 @@ int vchiq_mmal_submit_buffer(struct vchi
+@@ -1706,6 +1733,31 @@ int vchiq_mmal_submit_buffer(struct vchi
unsigned long flags = 0;
int ret;
@@ -134,7 +134,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
ret = buffer_from_host(instance, port, buffer);
if (ret == -EINVAL) {
/* Port is disabled. Queue for when it is enabled. */
-@@ -1738,6 +1790,16 @@ int mmal_vchi_buffer_cleanup(struct mmal
+@@ -1739,6 +1791,16 @@ int mmal_vchi_buffer_cleanup(struct mmal
release_msg_context(msg_context);
buf->msg_context = NULL;
diff --git a/target/linux/brcm2708/patches-4.19/950-0278-media-videobuf2-Allow-exporting-of-a-struct-dmabuf.patch b/target/linux/brcm2708/patches-4.19/950-0278-media-videobuf2-Allow-exporting-of-a-struct-dmabuf.patch
index 3972c0b6ad..743faa2c3f 100644
--- a/target/linux/brcm2708/patches-4.19/950-0278-media-videobuf2-Allow-exporting-of-a-struct-dmabuf.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0278-media-videobuf2-Allow-exporting-of-a-struct-dmabuf.patch
@@ -19,7 +19,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
--- a/drivers/media/common/videobuf2/videobuf2-core.c
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
-@@ -1847,12 +1847,12 @@ static int __find_plane_by_offset(struct
+@@ -1851,12 +1851,12 @@ static int __find_plane_by_offset(struct
return -EINVAL;
}
@@ -35,7 +35,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
struct dma_buf *dbuf;
if (q->memory != VB2_MEMORY_MMAP) {
-@@ -1902,6 +1902,21 @@ int vb2_core_expbuf(struct vb2_queue *q,
+@@ -1906,6 +1906,21 @@ int vb2_core_expbuf(struct vb2_queue *q,
return -EINVAL;
}
diff --git a/target/linux/brcm2708/patches-4.19/950-0285-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch b/target/linux/brcm2708/patches-4.19/950-0285-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch
index df13c3b87c..33c3242c92 100644
--- a/target/linux/brcm2708/patches-4.19/950-0285-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0285-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch
@@ -36,7 +36,7 @@ Signed-off-by: Tomasz Figa <tfiga@chromium.org>
--- a/drivers/media/common/videobuf2/videobuf2-core.c
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
-@@ -550,20 +550,6 @@ bool vb2_buffer_in_use(struct vb2_queue
+@@ -554,20 +554,6 @@ bool vb2_buffer_in_use(struct vb2_queue
}
EXPORT_SYMBOL(vb2_buffer_in_use);
@@ -57,7 +57,7 @@ Signed-off-by: Tomasz Figa <tfiga@chromium.org>
void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb)
{
call_void_bufop(q, fill_user_buffer, q->bufs[index], pb);
-@@ -675,16 +661,7 @@ int vb2_core_reqbufs(struct vb2_queue *q
+@@ -679,16 +665,7 @@ int vb2_core_reqbufs(struct vb2_queue *q
if (*count == 0 || q->num_buffers != 0 ||
(q->memory != VB2_MEMORY_UNKNOWN && q->memory != memory)) {
diff --git a/target/linux/brcm2708/patches-4.19/950-0319-staging-mmal-vchiq-Fix-client_component-for-64-bit-k.patch b/target/linux/brcm2708/patches-4.19/950-0319-staging-mmal-vchiq-Fix-client_component-for-64-bit-k.patch
index 098362baf6..f06f3034e1 100644
--- a/target/linux/brcm2708/patches-4.19/950-0319-staging-mmal-vchiq-Fix-client_component-for-64-bit-k.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0319-staging-mmal-vchiq-Fix-client_component-for-64-bit-k.patch
@@ -22,7 +22,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
-@@ -472,9 +472,9 @@ buffer_from_host(struct vchiq_mmal_insta
+@@ -473,9 +473,9 @@ buffer_from_host(struct vchiq_mmal_insta
static void event_to_host_cb(struct vchiq_mmal_instance *instance,
struct mmal_msg *msg, u32 msg_len)
{
@@ -34,7 +34,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
struct vchiq_mmal_port *port = NULL;
struct mmal_msg_context *msg_context;
u32 port_num = msg->u.event_to_host.port_num;
-@@ -1073,7 +1073,7 @@ static int create_component(struct vchiq
+@@ -1074,7 +1074,7 @@ static int create_component(struct vchiq
/* build component create message */
m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE;
@@ -43,7 +43,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
strncpy(m.u.component_create.name, name,
sizeof(m.u.component_create.name));
-@@ -1868,6 +1868,12 @@ int vchiq_mmal_component_init(struct vch
+@@ -1869,6 +1869,12 @@ int vchiq_mmal_component_init(struct vch
goto unlock;
}
diff --git a/target/linux/brcm2708/patches-4.19/950-0346-staging-vc-sm-cma-Use-a-void-pointer-as-the-handle-w.patch b/target/linux/brcm2708/patches-4.19/950-0346-staging-vc-sm-cma-Use-a-void-pointer-as-the-handle-w.patch
index a9205fbff2..c263663533 100644
--- a/target/linux/brcm2708/patches-4.19/950-0346-staging-vc-sm-cma-Use-a-void-pointer-as-the-handle-w.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0346-staging-vc-sm-cma-Use-a-void-pointer-as-the-handle-w.patch
@@ -100,7 +100,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
u32 cmd; /* MMAL command. 0=data. */
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
-@@ -1793,7 +1793,7 @@ int mmal_vchi_buffer_cleanup(struct mmal
+@@ -1794,7 +1794,7 @@ int mmal_vchi_buffer_cleanup(struct mmal
if (buf->vcsm_handle) {
int ret;
diff --git a/target/linux/brcm2708/patches-4.19/950-0359-staging-mmal-vchiq-Always-return-the-param-size-from.patch b/target/linux/brcm2708/patches-4.19/950-0359-staging-mmal-vchiq-Always-return-the-param-size-from.patch
index 5e8b8e9b55..f43d5c4412 100644
--- a/target/linux/brcm2708/patches-4.19/950-0359-staging-mmal-vchiq-Always-return-the-param-size-from.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0359-staging-mmal-vchiq-Always-return-the-param-size-from.patch
@@ -22,7 +22,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
-@@ -1412,11 +1412,12 @@ static int port_parameter_get(struct vch
+@@ -1413,11 +1413,12 @@ static int port_parameter_get(struct vch
*/
memcpy(value, &rmsg->u.port_parameter_get_reply.value,
*value_size);
diff --git a/target/linux/brcm2708/patches-4.19/950-0360-staging-mmal-vchiq-If-the-VPU-returns-an-error-don-t.patch b/target/linux/brcm2708/patches-4.19/950-0360-staging-mmal-vchiq-If-the-VPU-returns-an-error-don-t.patch
index f79e499930..d9b3d7e77f 100644
--- a/target/linux/brcm2708/patches-4.19/950-0360-staging-mmal-vchiq-If-the-VPU-returns-an-error-don-t.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0360-staging-mmal-vchiq-If-the-VPU-returns-an-error-don-t.patch
@@ -17,7 +17,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
-@@ -1400,7 +1400,8 @@ static int port_parameter_get(struct vch
+@@ -1401,7 +1401,8 @@ static int port_parameter_get(struct vch
goto release_msg;
}
diff --git a/target/linux/brcm2708/patches-4.19/950-0364-staging-bcm2835_codec-Fix-handling-of-VB2_MEMORY_DMA.patch b/target/linux/brcm2708/patches-4.19/950-0364-staging-bcm2835_codec-Fix-handling-of-VB2_MEMORY_DMA.patch
index 8e6e693563..5bd32d1184 100644
--- a/target/linux/brcm2708/patches-4.19/950-0364-staging-bcm2835_codec-Fix-handling-of-VB2_MEMORY_DMA.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0364-staging-bcm2835_codec-Fix-handling-of-VB2_MEMORY_DMA.patch
@@ -137,7 +137,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
/* If both ports disabled, then disable the component */
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
-@@ -1784,13 +1784,9 @@ int mmal_vchi_buffer_init(struct vchiq_m
+@@ -1785,13 +1785,9 @@ int mmal_vchi_buffer_init(struct vchiq_m
}
EXPORT_SYMBOL_GPL(mmal_vchi_buffer_init);
@@ -153,7 +153,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
if (buf->vcsm_handle) {
int ret;
-@@ -1802,6 +1798,19 @@ int mmal_vchi_buffer_cleanup(struct mmal
+@@ -1803,6 +1799,19 @@ int mmal_vchi_buffer_cleanup(struct mmal
pr_err("%s: vcsm_free failed, ret %d\n", __func__, ret);
buf->vcsm_handle = 0;
}
diff --git a/target/linux/brcm2708/patches-4.19/950-0488-staging-mmal-vchiq-Free-the-event-context-for-contro.patch b/target/linux/brcm2708/patches-4.19/950-0488-staging-mmal-vchiq-Free-the-event-context-for-contro.patch
index 046ea7a1dc..e5489018ab 100644
--- a/target/linux/brcm2708/patches-4.19/950-0488-staging-mmal-vchiq-Free-the-event-context-for-contro.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0488-staging-mmal-vchiq-Free-the-event-context-for-contro.patch
@@ -17,7 +17,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
-@@ -1981,6 +1981,8 @@ int vchiq_mmal_component_finalise(struct
+@@ -1982,6 +1982,8 @@ int vchiq_mmal_component_finalise(struct
for (idx = 0; idx < component->clocks; idx++)
free_event_context(&component->clock[idx]);
diff --git a/target/linux/brcm2708/patches-4.19/950-0489-staging-mmal-vchiq-Replace-spinlock-protecting-conte.patch b/target/linux/brcm2708/patches-4.19/950-0489-staging-mmal-vchiq-Replace-spinlock-protecting-conte.patch
deleted file mode 100644
index 7b2744d743..0000000000
--- a/target/linux/brcm2708/patches-4.19/950-0489-staging-mmal-vchiq-Replace-spinlock-protecting-conte.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From 39464cbb618af3ddf6427d77b0c0be0042bcaaf9 Mon Sep 17 00:00:00 2001
-From: Dave Stevenson <dave.stevenson@raspberrypi.org>
-Date: Wed, 1 May 2019 15:17:00 +0100
-Subject: [PATCH 489/703] staging: mmal-vchiq: Replace spinlock protecting
- context_map with mutex
-
-950fd86 staging: bcm2835-camera: Replace open-coded idr with a struct idr.
-replaced an internal implementation of an idr with the standard functions
-and a spinlock.
-idr_alloc(GFP_KERNEL) can sleep whilst calling kmem_cache_alloc to allocate
-the new node, but this is not valid whilst in an atomic context due to the
-spinlock.
-
-There is no need for this to be a spinlock as a standard mutex is
-sufficient.
-
-Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
----
- .../staging/vc04_services/vchiq-mmal/mmal-vchiq.c | 13 +++++++------
- 1 file changed, 7 insertions(+), 6 deletions(-)
-
---- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
-+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
-@@ -185,7 +185,8 @@ struct vchiq_mmal_instance {
- void *bulk_scratch;
-
- struct idr context_map;
-- spinlock_t context_map_lock;
-+ /* protect accesses to context_map */
-+ struct mutex context_map_lock;
-
- struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS];
-
-@@ -209,10 +210,10 @@ get_msg_context(struct vchiq_mmal_instan
- * that when we service the VCHI reply, we can look up what
- * message is being replied to.
- */
-- spin_lock(&instance->context_map_lock);
-+ mutex_lock(&instance->context_map_lock);
- handle = idr_alloc(&instance->context_map, msg_context,
- 0, 0, GFP_KERNEL);
-- spin_unlock(&instance->context_map_lock);
-+ mutex_unlock(&instance->context_map_lock);
-
- if (handle < 0) {
- kfree(msg_context);
-@@ -236,9 +237,9 @@ release_msg_context(struct mmal_msg_cont
- {
- struct vchiq_mmal_instance *instance = msg_context->instance;
-
-- spin_lock(&instance->context_map_lock);
-+ mutex_lock(&instance->context_map_lock);
- idr_remove(&instance->context_map, msg_context->handle);
-- spin_unlock(&instance->context_map_lock);
-+ mutex_unlock(&instance->context_map_lock);
- kfree(msg_context);
- }
-
-@@ -2143,7 +2144,7 @@ int vchiq_mmal_init(struct vchiq_mmal_in
-
- instance->bulk_scratch = vmalloc(PAGE_SIZE);
-
-- spin_lock_init(&instance->context_map_lock);
-+ mutex_init(&instance->context_map_lock);
- idr_init_base(&instance->context_map, 1);
-
- params.callback_param = instance;
diff --git a/target/linux/brcm2708/patches-4.19/950-0548-bcmgenet-Better-coalescing-parameter-defaults.patch b/target/linux/brcm2708/patches-4.19/950-0548-bcmgenet-Better-coalescing-parameter-defaults.patch
index 939c8cde0f..3577fcdb5b 100644
--- a/target/linux/brcm2708/patches-4.19/950-0548-bcmgenet-Better-coalescing-parameter-defaults.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0548-bcmgenet-Better-coalescing-parameter-defaults.patch
@@ -27,7 +27,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
/* Disable rate control for now */
bcmgenet_tdma_ring_writel(priv, index, flow_period_val,
TDMA_FLOW_PERIOD);
-@@ -3576,9 +3576,12 @@ static int bcmgenet_probe(struct platfor
+@@ -3571,9 +3571,12 @@ static int bcmgenet_probe(struct platfor
netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1);
/* Set default coalescing parameters */
diff --git a/target/linux/brcm2708/patches-4.19/950-0696-Revert-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-bu.patch b/target/linux/brcm2708/patches-4.19/950-0696-Revert-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-bu.patch
index 5bc0e98c84..2731d46136 100644
--- a/target/linux/brcm2708/patches-4.19/950-0696-Revert-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-bu.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0696-Revert-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-bu.patch
@@ -15,7 +15,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
--- a/drivers/media/common/videobuf2/videobuf2-core.c
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
-@@ -550,6 +550,20 @@ bool vb2_buffer_in_use(struct vb2_queue
+@@ -554,6 +554,20 @@ bool vb2_buffer_in_use(struct vb2_queue
}
EXPORT_SYMBOL(vb2_buffer_in_use);
@@ -36,7 +36,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb)
{
call_void_bufop(q, fill_user_buffer, q->bufs[index], pb);
-@@ -661,7 +675,16 @@ int vb2_core_reqbufs(struct vb2_queue *q
+@@ -665,7 +679,16 @@ int vb2_core_reqbufs(struct vb2_queue *q
if (*count == 0 || q->num_buffers != 0 ||
(q->memory != VB2_MEMORY_UNKNOWN && q->memory != memory)) {
diff --git a/target/linux/brcm2708/patches-4.19/950-0699-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch b/target/linux/brcm2708/patches-4.19/950-0699-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch
index 0ee04e6c29..145fd71a09 100644
--- a/target/linux/brcm2708/patches-4.19/950-0699-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch
+++ b/target/linux/brcm2708/patches-4.19/950-0699-media-vb2-Allow-reqbufs-0-with-in-use-MMAP-buffers.patch
@@ -92,7 +92,7 @@ Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
============
--- a/drivers/media/common/videobuf2/videobuf2-core.c
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
-@@ -680,11 +680,9 @@ int vb2_core_reqbufs(struct vb2_queue *q
+@@ -684,11 +684,9 @@ int vb2_core_reqbufs(struct vb2_queue *q
* are not in use and can be freed.
*/
mutex_lock(&q->mmap_lock);
diff --git a/target/linux/brcm47xx/patches-4.19/159-cpu_fixes.patch b/target/linux/brcm47xx/patches-4.19/159-cpu_fixes.patch
index 68fdc50664..0207029ddc 100644
--- a/target/linux/brcm47xx/patches-4.19/159-cpu_fixes.patch
+++ b/target/linux/brcm47xx/patches-4.19/159-cpu_fixes.patch
@@ -458,7 +458,7 @@
/*
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
-@@ -967,6 +967,9 @@ void build_get_pgde32(u32 **p, unsigned
+@@ -972,6 +972,9 @@ void build_get_pgde32(u32 **p, unsigned
uasm_i_srl(p, ptr, ptr, SMP_CPUID_PTRSHIFT);
uasm_i_addu(p, ptr, tmp, ptr);
#else
@@ -468,7 +468,7 @@
UASM_i_LA_mostly(p, ptr, pgdc);
#endif
uasm_i_mfc0(p, tmp, C0_BADVADDR); /* get faulting address */
-@@ -1327,6 +1330,9 @@ static void build_r4000_tlb_refill_handl
+@@ -1333,6 +1336,9 @@ static void build_r4000_tlb_refill_handl
#ifdef CONFIG_64BIT
build_get_pmde64(&p, &l, &r, K0, K1); /* get pmd in K1 */
#else
@@ -478,7 +478,7 @@
build_get_pgde32(&p, K0, K1); /* get pgd in K1 */
#endif
-@@ -1338,6 +1344,9 @@ static void build_r4000_tlb_refill_handl
+@@ -1344,6 +1350,9 @@ static void build_r4000_tlb_refill_handl
build_update_entries(&p, K0, K1);
build_tlb_write_entry(&p, &l, &r, tlb_random);
uasm_l_leave(&l, p);
@@ -488,7 +488,7 @@
uasm_i_eret(&p); /* return from trap */
}
#ifdef CONFIG_MIPS_HUGE_TLB_SUPPORT
-@@ -2028,6 +2037,9 @@ build_r4000_tlbchange_handler_head(u32 *
+@@ -2039,6 +2048,9 @@ build_r4000_tlbchange_handler_head(u32 *
#ifdef CONFIG_64BIT
build_get_pmde64(p, l, r, wr.r1, wr.r2); /* get pmd in ptr */
#else
@@ -498,7 +498,7 @@
build_get_pgde32(p, wr.r1, wr.r2); /* get pgd in ptr */
#endif
-@@ -2074,6 +2086,9 @@ build_r4000_tlbchange_handler_tail(u32 *
+@@ -2085,6 +2097,9 @@ build_r4000_tlbchange_handler_tail(u32 *
build_tlb_write_entry(p, l, r, tlb_indexed);
uasm_l_leave(l, *p);
build_restore_work_registers(p);
diff --git a/target/linux/gemini/patches-4.19/0021-ARM-dts-gemini-Fix-up-DNS-313-compatible-string.patch b/target/linux/gemini/patches-4.19/0021-ARM-dts-gemini-Fix-up-DNS-313-compatible-string.patch
deleted file mode 100644
index b4572b20a6..0000000000
--- a/target/linux/gemini/patches-4.19/0021-ARM-dts-gemini-Fix-up-DNS-313-compatible-string.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-From: Linus Walleij <linus.walleij@linaro.org>
-Date: Sun, 16 Jun 2019 23:41:20 +0200
-Subject: [PATCH] ARM: dts: gemini Fix up DNS-313 compatible
-
-It's a simple typo in the DNS file, which was pretty serious.
-No scripts were working properly. Fix it up.
-
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
----
-
---- a/arch/arm/boot/dts/gemini-dlink-dns-313.dts
-+++ b/arch/arm/boot/dts/gemini-dlink-dns-313.dts
-@@ -11,7 +11,7 @@
-
- / {
- model = "D-Link DNS-313 1-Bay Network Storage Enclosure";
-- compatible = "dlink,dir-313", "cortina,gemini";
-+ compatible = "dlink,dns-313", "cortina,gemini";
- #address-cells = <1>;
- #size-cells = <1>;
-
diff --git a/target/linux/generic/backport-4.19/049-v4.20-mips-remove-superfluous-check-for-linux.patch b/target/linux/generic/backport-4.19/049-v4.20-mips-remove-superfluous-check-for-linux.patch
deleted file mode 100644
index 4e9279a9ec..0000000000
--- a/target/linux/generic/backport-4.19/049-v4.20-mips-remove-superfluous-check-for-linux.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-From 1287533d3d95d5ad8b02773733044500b1be06bc Mon Sep 17 00:00:00 2001
-From: Sean Young <sean@mess.org>
-Date: Fri, 16 Nov 2018 16:09:39 +0000
-Subject: MIPS: Remove superfluous check for __linux__
-
-When building BPF code using "clang -target bpf -c", clang does not
-define __linux__.
-
-To build BPF IR decoders the include linux/lirc.h is needed which
-includes linux/types.h. Currently this workaround is needed:
-
-https://git.linuxtv.org/v4l-utils.git/commit/?id=dd3ff81f58c4e1e6f33765dc61ad33c48ae6bb07
-
-This check might otherwise be useful to stop users from using a non-linux
-compiler, but if you're doing that you are going to have a lot more
-trouble anyway.
-
-Signed-off-by: Sean Young <sean@mess.org>
-Signed-off-by: Paul Burton <paul.burton@mips.com>
-Patchwork: https://patchwork.linux-mips.org/patch/21149/
-Cc: Ralf Baechle <ralf@linux-mips.org>
-Cc: James Hogan <jhogan@kernel.org>
-Cc: linux-mips@linux-mips.org
-Cc: linux-kernel@vger.kernel.org
----
- arch/mips/include/uapi/asm/sgidefs.h | 8 --------
- 1 file changed, 8 deletions(-)
-
-(limited to 'arch/mips/include/uapi/asm/sgidefs.h')
-
---- a/arch/mips/include/uapi/asm/sgidefs.h
-+++ b/arch/mips/include/uapi/asm/sgidefs.h
-@@ -12,14 +12,6 @@
- #define __ASM_SGIDEFS_H
-
- /*
-- * Using a Linux compiler for building Linux seems logic but not to
-- * everybody.
-- */
--#ifndef __linux__
--#error Use a Linux compiler or give up.
--#endif
--
--/*
- * Definitions for the ISA levels
- *
- * With the introduction of MIPS32 / MIPS64 instruction sets definitions
diff --git a/target/linux/generic/backport-4.19/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch b/target/linux/generic/backport-4.19/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch
index 5d49a406c4..bf6d9aca34 100644
--- a/target/linux/generic/backport-4.19/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch
+++ b/target/linux/generic/backport-4.19/095-Allow-class-e-address-assignment-via-ifconfig-ioctl.patch
@@ -48,7 +48,7 @@ Reviewed-by: John Gilmore <gnu@toad.com>
#define INADDR_ANY ((unsigned long int) 0x00000000)
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
-@@ -941,7 +941,7 @@ static int inet_abc_len(__be32 addr)
+@@ -949,7 +949,7 @@ static int inet_abc_len(__be32 addr)
{
int rc = -1; /* Something else, probably a multicast. */
@@ -57,7 +57,7 @@ Reviewed-by: John Gilmore <gnu@toad.com>
rc = 0;
else {
__u32 haddr = ntohl(addr);
-@@ -952,6 +952,8 @@ static int inet_abc_len(__be32 addr)
+@@ -960,6 +960,8 @@ static int inet_abc_len(__be32 addr)
rc = 16;
else if (IN_CLASSC(haddr))
rc = 24;
diff --git a/target/linux/generic/backport-4.19/343-netfilter-nft_flow_offload-handle-netdevice-events-f.patch b/target/linux/generic/backport-4.19/343-netfilter-nft_flow_offload-handle-netdevice-events-f.patch
index 17133d552f..0ef2f48804 100644
--- a/target/linux/generic/backport-4.19/343-netfilter-nft_flow_offload-handle-netdevice-events-f.patch
+++ b/target/linux/generic/backport-4.19/343-netfilter-nft_flow_offload-handle-netdevice-events-f.patch
@@ -48,7 +48,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
MODULE_AUTHOR("Pablo Neira Ayuso <pablo@netfilter.org>");
--- a/net/netfilter/nft_flow_offload.c
+++ b/net/netfilter/nft_flow_offload.c
-@@ -197,47 +197,14 @@ static struct nft_expr_type nft_flow_off
+@@ -208,47 +208,14 @@ static struct nft_expr_type nft_flow_off
.owner = THIS_MODULE,
};
diff --git a/target/linux/generic/backport-4.19/366-netfilter-nf_flow_table-clean-up-and-fix-dst-handlin.patch b/target/linux/generic/backport-4.19/366-netfilter-nf_flow_table-clean-up-and-fix-dst-handlin.patch
index 23156b521c..f63e081b68 100644
--- a/target/linux/generic/backport-4.19/366-netfilter-nf_flow_table-clean-up-and-fix-dst-handlin.patch
+++ b/target/linux/generic/backport-4.19/366-netfilter-nf_flow_table-clean-up-and-fix-dst-handlin.patch
@@ -25,9 +25,9 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
- rt = (struct rtable *)flow->tuplehash[dir].tuple.dst_cache;
+ rt = (struct rtable *)flow->tuplehash[!dir].tuple.dst_cache;
- if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu)) &&
- (ip_hdr(skb)->frag_off & htons(IP_DF)) != 0)
-@@ -465,7 +465,7 @@ nf_flow_offload_ipv6_hook(void *priv, st
+ if (unlikely(nf_flow_exceeds_mtu(skb, flow->tuplehash[dir].tuple.mtu)))
+ return NF_ACCEPT;
+@@ -464,7 +464,7 @@ nf_flow_offload_ipv6_hook(void *priv, st
dir = tuplehash->tuple.dir;
flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]);
@@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
return NF_ACCEPT;
--- a/net/netfilter/nft_flow_offload.c
+++ b/net/netfilter/nft_flow_offload.c
-@@ -18,13 +18,11 @@ struct nft_flow_offload {
+@@ -17,13 +17,11 @@ struct nft_flow_offload {
struct nft_flowtable *flowtable;
};
@@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
struct flowi fl;
memset(&fl, 0, sizeof(fl));
-@@ -39,8 +37,21 @@ static int nft_flow_route(const struct n
+@@ -38,8 +36,21 @@ static int nft_flow_route(const struct n
break;
}
diff --git a/target/linux/generic/config-4.19 b/target/linux/generic/config-4.19
index 5b8a6d35d9..0e273dcdfe 100644
--- a/target/linux/generic/config-4.19
+++ b/target/linux/generic/config-4.19
@@ -353,7 +353,6 @@ CONFIG_ARM_GIC_MAX_NR=1
# CONFIG_ARM_UNWIND is not set
# CONFIG_ARM_VIRT_EXT is not set
# CONFIG_AS3935 is not set
-# CONFIG_ASIX_PHY is not set
# CONFIG_ASM9260_TIMER is not set
# CONFIG_ASUS_LAPTOP is not set
# CONFIG_ASUS_WIRELESS is not set
@@ -427,6 +426,7 @@ CONFIG_ATM_CLIP_NO_ICMP=y
# CONFIG_AX25 is not set
# CONFIG_AX25_DAMA_SLAVE is not set
# CONFIG_AX88796 is not set
+# CONFIG_AX88796B is not set
# CONFIG_AXP20X_ADC is not set
# CONFIG_AXP20X_POWER is not set
# CONFIG_AXP288_ADC is not set
diff --git a/target/linux/generic/hack-4.19/259-regmap_dynamic.patch b/target/linux/generic/hack-4.19/259-regmap_dynamic.patch
index 335ec4afc5..ec4636dbee 100644
--- a/target/linux/generic/hack-4.19/259-regmap_dynamic.patch
+++ b/target/linux/generic/hack-4.19/259-regmap_dynamic.patch
@@ -91,7 +91,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
#include <linux/mutex.h>
#include <linux/err.h>
#include <linux/of.h>
-@@ -3037,3 +3038,5 @@ static int __init regmap_initcall(void)
+@@ -3039,3 +3040,5 @@ static int __init regmap_initcall(void)
return 0;
}
postcore_initcall(regmap_initcall);
diff --git a/target/linux/generic/hack-4.19/640-bridge-only-accept-EAP-locally.patch b/target/linux/generic/hack-4.19/640-bridge-only-accept-EAP-locally.patch
index 981d49b9c0..3de4048074 100644
--- a/target/linux/generic/hack-4.19/640-bridge-only-accept-EAP-locally.patch
+++ b/target/linux/generic/hack-4.19/640-bridge-only-accept-EAP-locally.patch
@@ -13,7 +13,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
-@@ -110,10 +110,14 @@ int br_handle_frame_finish(struct net *n
+@@ -108,10 +108,14 @@ int br_handle_frame_finish(struct net *n
}
}
diff --git a/target/linux/generic/hack-4.19/647-netfilter-flow-acct.patch b/target/linux/generic/hack-4.19/647-netfilter-flow-acct.patch
index aa842015fc..fd8a871113 100644
--- a/target/linux/generic/hack-4.19/647-netfilter-flow-acct.patch
+++ b/target/linux/generic/hack-4.19/647-netfilter-flow-acct.patch
@@ -52,7 +52,7 @@
/* For layer 4 checksum field offset. */
#include <linux/tcp.h>
#include <linux/udp.h>
-@@ -268,6 +269,7 @@ nf_flow_offload_ip_hook(void *priv, stru
+@@ -267,6 +268,7 @@ nf_flow_offload_ip_hook(void *priv, stru
skb->dev = outdev;
nexthop = rt_nexthop(rt, flow->tuplehash[!dir].tuple.src_v4.s_addr);
skb_dst_set_noref(skb, &rt->dst);
@@ -60,7 +60,7 @@
neigh_xmit(NEIGH_ARP_TABLE, outdev, &nexthop, skb);
return NF_STOLEN;
-@@ -488,6 +490,7 @@ nf_flow_offload_ipv6_hook(void *priv, st
+@@ -487,6 +489,7 @@ nf_flow_offload_ipv6_hook(void *priv, st
skb->dev = outdev;
nexthop = rt6_nexthop(rt, &flow->tuplehash[!dir].tuple.src_v6);
skb_dst_set_noref(skb, &rt->dst);
diff --git a/target/linux/generic/hack-4.19/661-use_fq_codel_by_default.patch b/target/linux/generic/hack-4.19/661-use_fq_codel_by_default.patch
index 817c41801f..74adfa0c43 100644
--- a/target/linux/generic/hack-4.19/661-use_fq_codel_by_default.patch
+++ b/target/linux/generic/hack-4.19/661-use_fq_codel_by_default.patch
@@ -55,7 +55,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
register_qdisc(&pfifo_head_drop_qdisc_ops);
--- a/net/sched/sch_fq_codel.c
+++ b/net/sched/sch_fq_codel.c
-@@ -716,7 +716,7 @@ static const struct Qdisc_class_ops fq_c
+@@ -714,7 +714,7 @@ static const struct Qdisc_class_ops fq_c
.walk = fq_codel_walk,
};
@@ -64,7 +64,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
.cl_ops = &fq_codel_class_ops,
.id = "fq_codel",
.priv_size = sizeof(struct fq_codel_sched_data),
-@@ -731,6 +731,7 @@ static struct Qdisc_ops fq_codel_qdisc_o
+@@ -729,6 +729,7 @@ static struct Qdisc_ops fq_codel_qdisc_o
.dump_stats = fq_codel_dump_stats,
.owner = THIS_MODULE,
};
diff --git a/target/linux/generic/hack-4.19/702-phy_add_aneg_done_function.patch b/target/linux/generic/hack-4.19/702-phy_add_aneg_done_function.patch
index 6fbcd43d66..9a9097d91f 100644
--- a/target/linux/generic/hack-4.19/702-phy_add_aneg_done_function.patch
+++ b/target/linux/generic/hack-4.19/702-phy_add_aneg_done_function.patch
@@ -15,7 +15,7 @@
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
-@@ -1506,6 +1506,9 @@ int genphy_update_link(struct phy_device
+@@ -1512,6 +1512,9 @@ int genphy_update_link(struct phy_device
{
int status;
diff --git a/target/linux/generic/hack-4.19/902-debloat_proc.patch b/target/linux/generic/hack-4.19/902-debloat_proc.patch
index 77de3c67e9..a396ad0d12 100644
--- a/target/linux/generic/hack-4.19/902-debloat_proc.patch
+++ b/target/linux/generic/hack-4.19/902-debloat_proc.patch
@@ -221,7 +221,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (!root_irq_dir)
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
-@@ -374,6 +374,8 @@ static int __init init_timer_list_procfs
+@@ -375,6 +375,8 @@ static int __init init_timer_list_procfs
{
struct proc_dir_entry *pe;
diff --git a/target/linux/generic/hack-4.19/904-debloat_dma_buf.patch b/target/linux/generic/hack-4.19/904-debloat_dma_buf.patch
index a4b6e36d07..3cbafc701e 100644
--- a/target/linux/generic/hack-4.19/904-debloat_dma_buf.patch
+++ b/target/linux/generic/hack-4.19/904-debloat_dma_buf.patch
@@ -45,7 +45,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
#include <uapi/linux/dma-buf.h>
-@@ -1158,4 +1159,5 @@ static void __exit dma_buf_deinit(void)
+@@ -1159,4 +1160,5 @@ static void __exit dma_buf_deinit(void)
{
dma_buf_uninit_debugfs();
}
diff --git a/target/linux/generic/pending-4.19/100-MIPS-fix-build-on-non-linux-hosts.patch b/target/linux/generic/pending-4.19/100-MIPS-fix-build-on-non-linux-hosts.patch
deleted file mode 100644
index 5d34df4283..0000000000
--- a/target/linux/generic/pending-4.19/100-MIPS-fix-build-on-non-linux-hosts.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From 4ee213d8c2afeab9a68f8530317260298b4b6b82 Mon Sep 17 00:00:00 2001
-From: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
-Date: Wed, 19 Jun 2019 08:16:33 +0100
-Subject: [PATCH] MIPS: fix build on non-linux hosts
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-calc_vmlinuz_load_addr.c requires SZ_64K to be defined for alignment
-purposes. It included "../../../../include/linux/sizes.h" to define
-that size, however "sizes.h" tries to include <linux/const.h> which
-assumes linux system headers. These may not exist eg. the following
-error was encountered when building Linux for OpenWrt under macOS:
-
-In file included from arch/mips/boot/compressed/calc_vmlinuz_load_addr.c:16:
-arch/mips/boot/compressed/../../../../include/linux/sizes.h:11:10: fatal error: 'linux/const.h' file not found
- ^~~~~~~~~~
-
-Change makefile to force building on local linux headers instead of
-system headers. Also change eye-watering relative reference in include
-file spec.
-
-Thanks to Jo-Philip Wich & Petr Štetiar for assistance in tracking this
-down & fixing.
-
-Suggested-by: Jo-Philipp Wich <jo@mein.io>
-Signed-off-by: Petr Štetiar <ynezz@true.cz>
-Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
----
- arch/mips/boot/compressed/Makefile | 2 ++
- arch/mips/boot/compressed/calc_vmlinuz_load_addr.c | 2 +-
- 2 files changed, 3 insertions(+), 1 deletion(-)
-
---- a/arch/mips/boot/compressed/Makefile
-+++ b/arch/mips/boot/compressed/Makefile
-@@ -78,6 +78,8 @@ OBJCOPYFLAGS_piggy.o := --add-section=.i
- $(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE
- $(call if_changed,objcopy)
-
-+HOSTCFLAGS_calc_vmlinuz_load_addr.o += $(LINUXINCLUDE)
-+
- # Calculate the load address of the compressed kernel image
- hostprogs-y := calc_vmlinuz_load_addr
-
---- a/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
-+++ b/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
-@@ -13,7 +13,7 @@
- #include <stdint.h>
- #include <stdio.h>
- #include <stdlib.h>
--#include "../../../../include/linux/sizes.h"
-+#include <linux/sizes.h>
-
- int main(int argc, char *argv[])
- {
diff --git a/target/linux/generic/pending-4.19/150-bridge_allow_receiption_on_disabled_port.patch b/target/linux/generic/pending-4.19/150-bridge_allow_receiption_on_disabled_port.patch
index 2afdeef41a..583c34a448 100644
--- a/target/linux/generic/pending-4.19/150-bridge_allow_receiption_on_disabled_port.patch
+++ b/target/linux/generic/pending-4.19/150-bridge_allow_receiption_on_disabled_port.patch
@@ -15,7 +15,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
-@@ -195,6 +195,9 @@ static void __br_handle_local_finish(str
+@@ -193,6 +193,9 @@ static void __br_handle_local_finish(str
/* note: already called with rcu_read_lock */
static int br_handle_local_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
{
@@ -25,7 +25,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
__br_handle_local_finish(skb);
/* return 1 to signal the okfn() was called so it's ok to use the skb */
-@@ -291,6 +294,17 @@ rx_handler_result_t br_handle_frame(stru
+@@ -289,6 +292,17 @@ rx_handler_result_t br_handle_frame(stru
forward:
switch (p->state) {
diff --git a/target/linux/generic/pending-4.19/302-mips_no_branch_likely.patch b/target/linux/generic/pending-4.19/302-mips_no_branch_likely.patch
index 0e4600237d..6192c417d3 100644
--- a/target/linux/generic/pending-4.19/302-mips_no_branch_likely.patch
+++ b/target/linux/generic/pending-4.19/302-mips_no_branch_likely.patch
@@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
-@@ -90,7 +90,7 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin
+@@ -91,7 +91,7 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin
# machines may also. Since BFD is incredibly buggy with respect to
# crossformat linking we rely on the elf2ecoff tool for format conversion.
#
diff --git a/target/linux/generic/pending-4.19/303-MIPS-Fix-bounds-check-virt_addr_valid.patch b/target/linux/generic/pending-4.19/303-MIPS-Fix-bounds-check-virt_addr_valid.patch
deleted file mode 100644
index d4c3e66105..0000000000
--- a/target/linux/generic/pending-4.19/303-MIPS-Fix-bounds-check-virt_addr_valid.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 415e0feec4f927af0059f72a6831f6c5a104f0fc Mon Sep 17 00:00:00 2001
-From: Hauke Mehrtens <hauke@hauke-m.de>
-Date: Mon, 17 Jun 2019 00:13:08 +0200
-Subject: [PATCH] MIPS: Fix bounds check virt_addr_valid
-
-The bounds check used the uninitialized variable vaddr, it should use
-the given parameter kaddr instead. When using the uninitialized value
-the compiler assumed it to be 0 and optimized this function to just
-return 0 in all cases.
-
-This should make the function check the range of the given address and
-only do the page map check in case it is in the expected range of
-virtual addresses.
-
-Fixes: 074a1e1167af ("MIPS: Bounds check virt_addr_valid")
-Cc: stable@vger.kernel.org # v4.12+
-Cc: Paul Burton <paul.burton@mips.com>
-Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
----
- arch/mips/mm/mmap.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/arch/mips/mm/mmap.c
-+++ b/arch/mips/mm/mmap.c
-@@ -203,7 +203,7 @@ unsigned long arch_randomize_brk(struct
-
- int __virt_addr_valid(const volatile void *kaddr)
- {
-- unsigned long vaddr = (unsigned long)vaddr;
-+ unsigned long vaddr = (unsigned long)kaddr;
-
- if ((vaddr < PAGE_OFFSET) || (vaddr >= MAP_BASE))
- return 0;
diff --git a/target/linux/generic/pending-4.19/304-mips_disable_fpu.patch b/target/linux/generic/pending-4.19/304-mips_disable_fpu.patch
index 6e71c68dc5..2278576d21 100644
--- a/target/linux/generic/pending-4.19/304-mips_disable_fpu.patch
+++ b/target/linux/generic/pending-4.19/304-mips_disable_fpu.patch
@@ -47,7 +47,7 @@ v2: incorporated changes suggested by Jonas Gorski
select OF
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
-@@ -322,7 +322,7 @@ OBJCOPYFLAGS += --remove-section=.regin
+@@ -323,7 +323,7 @@ OBJCOPYFLAGS += --remove-section=.regin
head-y := arch/mips/kernel/head.o
libs-y += arch/mips/lib/
diff --git a/target/linux/generic/pending-4.19/305-mips_module_reloc.patch b/target/linux/generic/pending-4.19/305-mips_module_reloc.patch
index 609a96db49..a8e4e78c91 100644
--- a/target/linux/generic/pending-4.19/305-mips_module_reloc.patch
+++ b/target/linux/generic/pending-4.19/305-mips_module_reloc.patch
@@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
-@@ -93,8 +93,18 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin
+@@ -94,8 +94,18 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlin
cflags-y += -G 0 -mno-abicalls -fno-pic -pipe -mno-branch-likely
cflags-y += -msoft-float
LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
diff --git a/target/linux/generic/pending-4.19/308-mips32r2_tune.patch b/target/linux/generic/pending-4.19/308-mips32r2_tune.patch
index d9a2a92f5c..8636511464 100644
--- a/target/linux/generic/pending-4.19/308-mips32r2_tune.patch
+++ b/target/linux/generic/pending-4.19/308-mips32r2_tune.patch
@@ -11,7 +11,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
-@@ -176,7 +176,7 @@ cflags-$(CONFIG_CPU_VR41XX) += -march=r4
+@@ -177,7 +177,7 @@ cflags-$(CONFIG_CPU_VR41XX) += -march=r4
cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap
cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap
cflags-$(CONFIG_CPU_MIPS32_R1) += -march=mips32 -Wa,--trap
diff --git a/target/linux/generic/pending-4.19/640-netfilter-nf_flow_table-add-hardware-offload-support.patch b/target/linux/generic/pending-4.19/640-netfilter-nf_flow_table-add-hardware-offload-support.patch
index afe5d32b3f..6932214826 100644
--- a/target/linux/generic/pending-4.19/640-netfilter-nf_flow_table-add-hardware-offload-support.patch
+++ b/target/linux/generic/pending-4.19/640-netfilter-nf_flow_table-add-hardware-offload-support.patch
@@ -552,7 +552,7 @@ Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
nest = nla_nest_start(skb, NFTA_FLOWTABLE_HOOK);
--- a/net/netfilter/nft_flow_offload.c
+++ b/net/netfilter/nft_flow_offload.c
-@@ -124,6 +124,9 @@ static void nft_flow_offload_eval(const
+@@ -135,6 +135,9 @@ static void nft_flow_offload_eval(const
if (ret < 0)
goto err_flow_add;
diff --git a/target/linux/generic/pending-4.19/703-phy-add-detach-callback-to-struct-phy_driver.patch b/target/linux/generic/pending-4.19/703-phy-add-detach-callback-to-struct-phy_driver.patch
index 0cf187a491..f863238209 100644
--- a/target/linux/generic/pending-4.19/703-phy-add-detach-callback-to-struct-phy_driver.patch
+++ b/target/linux/generic/pending-4.19/703-phy-add-detach-callback-to-struct-phy_driver.patch
@@ -11,7 +11,7 @@ Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
-@@ -1130,6 +1130,9 @@ void phy_detach(struct phy_device *phyde
+@@ -1136,6 +1136,9 @@ void phy_detach(struct phy_device *phyde
struct module *ndev_owner = dev->dev.parent->driver->owner;
struct mii_bus *bus;
diff --git a/target/linux/ipq40xx/patches-4.19/700-net-add-qualcomm-mdio-and-phy.patch b/target/linux/ipq40xx/patches-4.19/700-net-add-qualcomm-mdio-and-phy.patch
index bad8b797f8..37b88bb8ac 100644
--- a/target/linux/ipq40xx/patches-4.19/700-net-add-qualcomm-mdio-and-phy.patch
+++ b/target/linux/ipq40xx/patches-4.19/700-net-add-qualcomm-mdio-and-phy.patch
@@ -46,7 +46,7 @@ Subject: [PATCH 30/38] NET: add qualcomm mdio and PHY
obj-$(CONFIG_AMD_PHY) += amd.o
obj-$(CONFIG_AQUANTIA_PHY) += aquantia.o
+obj-$(CONFIG_AR40XX_PHY) += ar40xx.o
- obj-$(CONFIG_ASIX_PHY) += asix.o
+ obj-$(CONFIG_AX88796B_PHY) += ax88796b.o
obj-$(CONFIG_AT803X_PHY) += at803x.o
obj-$(CONFIG_BCM63XX_PHY) += bcm63xx.o
--- /dev/null
diff --git a/target/linux/lantiq/patches-4.19/0002-usb-dwc2-use-a-longer-AHB-idle-timeout-in-dwc2_core_.patch b/target/linux/lantiq/patches-4.19/0002-usb-dwc2-use-a-longer-AHB-idle-timeout-in-dwc2_core_.patch
deleted file mode 100644
index c004e44e4a..0000000000
--- a/target/linux/lantiq/patches-4.19/0002-usb-dwc2-use-a-longer-AHB-idle-timeout-in-dwc2_core_.patch
+++ /dev/null
@@ -1,35 +0,0 @@
-From bfe92b01cafebb10f0d7f38dceb37433687b7887 Mon Sep 17 00:00:00 2001
-From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
-Date: Thu, 20 Jun 2019 19:50:22 +0200
-Subject: [PATCH] usb: dwc2: use a longer AHB idle timeout in dwc2_core_reset()
-
-Use a 10000us AHB idle timeout in dwc2_core_reset() and make it
-consistent with the other "wait for AHB master IDLE state" ocurrences.
-
-This fixes a problem for me where dwc2 would not want to initialize when
-updating to 4.19 on a MIPS Lantiq VRX200 SoC. dwc2 worked fine with
-4.14.
-Testing on my board shows that it takes 180us until AHB master IDLE
-state is signalled. The very old vendor driver for this SoC (ifxhcd)
-used a 1 second timeout.
-Use the same timeout that is used everywhere when polling for
-GRSTCTL_AHBIDLE instead of using a timeout that "works for one board"
-(180us in my case) to have consistent behavior across the dwc2 driver.
-
-Cc: linux-stable <stable@vger.kernel.org> # 4.19+
-Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
----
- drivers/usb/dwc2/core.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/drivers/usb/dwc2/core.c
-+++ b/drivers/usb/dwc2/core.c
-@@ -531,7 +531,7 @@ int dwc2_core_reset(struct dwc2_hsotg *h
- }
-
- /* Wait for AHB master IDLE state */
-- if (dwc2_hsotg_wait_bit_set(hsotg, GRSTCTL, GRSTCTL_AHBIDLE, 50)) {
-+ if (dwc2_hsotg_wait_bit_set(hsotg, GRSTCTL, GRSTCTL_AHBIDLE, 10000)) {
- dev_warn(hsotg->dev, "%s: HANG! AHB Idle timeout GRSTCTL GRSTCTL_AHBIDLE\n",
- __func__);
- return -EBUSY;
diff --git a/target/linux/mvebu/patches-4.19/406-sfp-add-sfp-compatible.patch b/target/linux/mvebu/patches-4.19/406-sfp-add-sfp-compatible.patch
index f800e0a49c..0c6cb72cb9 100644
--- a/target/linux/mvebu/patches-4.19/406-sfp-add-sfp-compatible.patch
+++ b/target/linux/mvebu/patches-4.19/406-sfp-add-sfp-compatible.patch
@@ -14,7 +14,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
-@@ -229,6 +229,7 @@ static const struct sff_data sfp_data =
+@@ -230,6 +230,7 @@ static const struct sff_data sfp_data =
static const struct of_device_id sfp_of_match[] = {
{ .compatible = "sff,sff", .data = &sff_data, },
{ .compatible = "sff,sfp", .data = &sfp_data, },
diff --git a/target/linux/mvebu/patches-4.19/407-sfp-display-SFP-module-information.patch b/target/linux/mvebu/patches-4.19/407-sfp-display-SFP-module-information.patch
index b78c6d8e3c..854ac68769 100644
--- a/target/linux/mvebu/patches-4.19/407-sfp-display-SFP-module-information.patch
+++ b/target/linux/mvebu/patches-4.19/407-sfp-display-SFP-module-information.patch
@@ -10,7 +10,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
-@@ -1131,6 +1131,184 @@ static void sfp_hwmon_remove(struct sfp
+@@ -1132,6 +1132,184 @@ static void sfp_hwmon_remove(struct sfp
}
#endif
@@ -195,7 +195,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
/* Helpers */
static void sfp_module_tx_disable(struct sfp *sfp)
{
-@@ -1375,6 +1553,8 @@ static int sfp_sm_mod_probe(struct sfp *
+@@ -1376,6 +1554,8 @@ static int sfp_sm_mod_probe(struct sfp *
{
/* SFP module inserted - read I2C data */
struct sfp_eeprom_id id;
@@ -204,7 +204,7 @@ Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
bool cotsworks;
u8 check;
int ret;
-@@ -1431,12 +1611,87 @@ static int sfp_sm_mod_probe(struct sfp *
+@@ -1432,12 +1612,87 @@ static int sfp_sm_mod_probe(struct sfp *
sfp->id = id;
diff --git a/target/linux/mvebu/patches-4.19/408-sfp-more-cotsworks-fixes.patch b/target/linux/mvebu/patches-4.19/408-sfp-more-cotsworks-fixes.patch
index f9f7aba2bc..69a31cb9f0 100644
--- a/target/linux/mvebu/patches-4.19/408-sfp-more-cotsworks-fixes.patch
+++ b/target/linux/mvebu/patches-4.19/408-sfp-more-cotsworks-fixes.patch
@@ -12,7 +12,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
-@@ -1570,9 +1570,9 @@ static int sfp_sm_mod_probe(struct sfp *
+@@ -1571,9 +1571,9 @@ static int sfp_sm_mod_probe(struct sfp *
return -EAGAIN;
}
@@ -25,7 +25,7 @@ Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
*/
cotsworks = !memcmp(id.base.vendor_name, "COTSWORKS ", 16);
-@@ -1611,11 +1611,12 @@ static int sfp_sm_mod_probe(struct sfp *
+@@ -1612,11 +1612,12 @@ static int sfp_sm_mod_probe(struct sfp *
sfp->id = id;
diff --git a/target/linux/mvebu/patches-4.19/450-reprobe_sfp_phy.patch b/target/linux/mvebu/patches-4.19/450-reprobe_sfp_phy.patch
index bec8b4c1e6..833c515a11 100644
--- a/target/linux/mvebu/patches-4.19/450-reprobe_sfp_phy.patch
+++ b/target/linux/mvebu/patches-4.19/450-reprobe_sfp_phy.patch
@@ -13,7 +13,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
--- a/drivers/net/phy/sfp.c
+++ b/drivers/net/phy/sfp.c
-@@ -1373,7 +1373,7 @@ static void sfp_sm_phy_detach(struct sfp
+@@ -1374,7 +1374,7 @@ static void sfp_sm_phy_detach(struct sfp
sfp->mod_phy = NULL;
}
@@ -22,7 +22,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
{
struct phy_device *phy;
int err;
-@@ -1383,11 +1383,11 @@ static void sfp_sm_probe_phy(struct sfp
+@@ -1384,11 +1384,11 @@ static void sfp_sm_probe_phy(struct sfp
phy = mdiobus_scan(sfp->i2c_mii, SFP_PHY_ADDR);
if (phy == ERR_PTR(-ENODEV)) {
dev_info(sfp->dev, "no PHY detected\n");
@@ -36,7 +36,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
}
err = sfp_add_phy(sfp->sfp_bus, phy);
-@@ -1395,11 +1395,13 @@ static void sfp_sm_probe_phy(struct sfp
+@@ -1396,11 +1396,13 @@ static void sfp_sm_probe_phy(struct sfp
phy_device_remove(phy);
phy_device_free(phy);
dev_err(sfp->dev, "sfp_add_phy failed: %d\n", err);
@@ -51,7 +51,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
}
static void sfp_sm_link_up(struct sfp *sfp)
-@@ -1463,14 +1465,9 @@ static void sfp_sm_fault(struct sfp *sfp
+@@ -1464,14 +1466,9 @@ static void sfp_sm_fault(struct sfp *sfp
static void sfp_sm_mod_init(struct sfp *sfp)
{
@@ -68,7 +68,7 @@ Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
/* Setting the serdes link mode is guesswork: there's no
* field in the EEPROM which indicates what mode should
-@@ -1484,7 +1481,22 @@ static void sfp_sm_mod_init(struct sfp *
+@@ -1485,7 +1482,22 @@ static void sfp_sm_mod_init(struct sfp *
if (sfp->id.base.e1000_base_t ||
sfp->id.base.e100_base_lx ||
sfp->id.base.e100_base_fx)