From 63760a12d1e72b952dcf5fa1ca6c14681480d01d Mon Sep 17 00:00:00 2001 From: MilhouseVH Date: Sun, 29 Oct 2017 16:00:39 +0000 Subject: [PATCH] RPi/RPi2: update linux support patches for linux 4.9.59 --- .../patches/linux/linux-01-RPi_support.patch | 13179 +++++++++++++++- .../patches/linux/linux-01-RPi_support.patch | 13179 +++++++++++++++- 2 files changed, 24888 insertions(+), 1470 deletions(-) diff --git a/projects/RPi/patches/linux/linux-01-RPi_support.patch b/projects/RPi/patches/linux/linux-01-RPi_support.patch index eb672316bb..fce93fdfd8 100644 --- a/projects/RPi/patches/linux/linux-01-RPi_support.patch +++ b/projects/RPi/patches/linux/linux-01-RPi_support.patch @@ -1,7 +1,7 @@ -From cb6c7b02883f12f903d71c3d69a084bf453062bd Mon Sep 17 00:00:00 2001 +From e1d243c06c5596cafb7163b42258d7e8d547f4bc Mon Sep 17 00:00:00 2001 From: Steve Glendinning Date: Thu, 19 Feb 2015 18:47:12 +0000 -Subject: [PATCH 001/333] smsx95xx: fix crimes against truesize +Subject: [PATCH 001/407] smsx95xx: fix crimes against truesize smsc95xx is adjusting truesize when it shouldn't, and following a recent patch from Eric this is now triggering warnings. @@ -48,10 +48,10 @@ index 831aa33d078ae7d2dd57fdded5de71d1eb915f99..b77935bded8c0ff7808b00f170ff10e5 usbnet_skb_return(dev, ax_skb); } -From d09ed23cc9c1f56459c75c61878c58e52019f10c Mon Sep 17 00:00:00 2001 +From fae7f20a43788162ddcfd0f46a1bee2248673899 Mon Sep 17 00:00:00 2001 From: Sam Nazarko Date: Fri, 1 Apr 2016 17:27:21 +0100 -Subject: [PATCH 002/333] smsc95xx: Experimental: Enable turbo_mode and +Subject: [PATCH 002/407] smsc95xx: Experimental: Enable turbo_mode and packetsize=2560 by default See: http://forum.kodi.tv/showthread.php?tid=285288 @@ -94,10 +94,10 @@ index b77935bded8c0ff7808b00f170ff10e594300ad0..693f163684de921404738e33244881e0 netif_dbg(dev, ifup, dev->net, "rx_urb_size=%ld\n", -From 2e231430ec6b73340e4292eb699c6877206ea3e6 Mon Sep 17 00:00:00 2001 +From cf6fb036267f281dba2b46256a1b14151cb8c0c2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 003/333] Allow mac address to be set in smsc95xx +Subject: [PATCH 003/407] Allow mac address to be set in smsc95xx Signed-off-by: popcornmix --- @@ -193,10 +193,10 @@ index 693f163684de921404738e33244881e0aab92ec9..df60c989fc229bf0aab3c27e95ccd453 eth_hw_addr_random(dev->net); netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); -From f3fa5610d502ab0727495d76da9ee9504f335f4c Mon Sep 17 00:00:00 2001 +From 41757cea052deabb7a61bcf7e1b57eacc7764d75 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 13 Mar 2015 12:43:36 +0000 -Subject: [PATCH 004/333] Protect __release_resource against resources without +Subject: [PATCH 004/407] Protect __release_resource against resources without parents Without this patch, removing a device tree overlay can crash here. @@ -224,38 +224,10 @@ index 9b5f04404152c296af3a96132f27cfc80ffa9af9..f8a9af6e6b915812be2ba2c1c2b40106 for (;;) { tmp = *p; -From 4475ce72ed646839792779fbe32a1677382e020e Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Thu, 18 Dec 2014 16:07:15 -0800 -Subject: [PATCH 005/333] mm: Remove the PFN busy warning - -See commit dae803e165a11bc88ca8dbc07a11077caf97bbcb -- the warning is -expected sometimes when using CMA. However, that commit still spams -my kernel log with these warnings. - -Signed-off-by: Eric Anholt ---- - mm/page_alloc.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index 77b797c2d094c04d15e5afc8ca4b7b0527481f0c..96b753469c796c300db17571a52b9f649d626c5d 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -7335,8 +7335,6 @@ int alloc_contig_range(unsigned long start, unsigned long end, - - /* Make sure the range is really isolated. */ - if (test_pages_isolated(outer_start, end, false)) { -- pr_info("%s: [%lx, %lx) PFNs busy\n", -- __func__, outer_start, end); - ret = -EBUSY; - goto done; - } - -From aed8dbf6a6f7433226315d2603223d471ab67065 Mon Sep 17 00:00:00 2001 +From ba3cfb5227397ae7bf9b3903989838e65f10d816 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 4 Dec 2015 17:41:50 +0000 -Subject: [PATCH 006/333] irq-bcm2836: Prevent spurious interrupts, and trap +Subject: [PATCH 005/407] irq-bcm2836: Prevent spurious interrupts, and trap them early The old arch-specific IRQ macros included a dsb to ensure the @@ -282,10 +254,10 @@ index d96b2c947e74e3edab3917551c64fbd1ced0f34c..93e3f7660c4230c9f1dd3b195958cb49 #endif } else if (stat) { -From 356a3b55384324cb45be6ae24b730208dde0fa68 Mon Sep 17 00:00:00 2001 +From c52627cdd4c2be2e690114679179e0a356b881ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 12 Jun 2015 19:01:05 +0200 -Subject: [PATCH 007/333] irqchip: bcm2835: Add FIQ support +Subject: [PATCH 006/407] irqchip: bcm2835: Add FIQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -414,10 +386,10 @@ index 44d7c38dde479d771f3552e914bf8c1c1f5019f7..42ff5e6a8e0d532f5b60a1e7af7cc4d9 } -From 5f294f30378f1529740f71bd6edf9ed2df8c8716 Mon Sep 17 00:00:00 2001 +From f74e182870fc4382a0115644621d4206fb339d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 23 Oct 2015 16:26:55 +0200 -Subject: [PATCH 008/333] irqchip: irq-bcm2835: Add 2836 FIQ support +Subject: [PATCH 007/407] irqchip: irq-bcm2835: Add 2836 FIQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -516,10 +488,10 @@ index 42ff5e6a8e0d532f5b60a1e7af7cc4d941bd5008..eccf6ed025299cb480884f5bcbe77abf for (b = 0; b < NR_BANKS; b++) { for (i = 0; i < bank_irqs[b]; i++) { -From 551fc81889dbc3c8123c7e77964880cbb25926fa Mon Sep 17 00:00:00 2001 +From fbd9629abc450df824ec29cd26a58ff5121f44b6 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 14 Jul 2015 10:26:09 +0100 -Subject: [PATCH 009/333] spidev: Add "spidev" compatible string to silence +Subject: [PATCH 008/407] spidev: Add "spidev" compatible string to silence warning See: https://github.com/raspberrypi/linux/issues/1054 @@ -540,10 +512,10 @@ index 2e05046f866bd01bf87edcdeff0d5b76d4d0aea7..d780491b8013a4e97fa843958964454e }; MODULE_DEVICE_TABLE(of, spidev_dt_ids); -From 74119a353aab6a5b4ff1ae737d53fe957b40ea78 Mon Sep 17 00:00:00 2001 +From ba9574119aa2d5e74b98f3ea1fe68df0d7a01fad Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 14:12:42 +0100 -Subject: [PATCH 010/333] serial: 8250: Don't crash when nr_uarts is 0 +Subject: [PATCH 009/407] serial: 8250: Don't crash when nr_uarts is 0 --- drivers/tty/serial/8250/8250_core.c | 2 ++ @@ -563,10 +535,10 @@ index e8819aa20415603c80547e382838a8fa3ce54792..cf9c7d2e3f95e1a19410247a89c2e49c for (i = 0; i < nr_uarts; i++) { struct uart_8250_port *up = &serial8250_ports[i]; -From 20cbfc41f269111552b8b7fc722e44a3975dbde7 Mon Sep 17 00:00:00 2001 +From 39af1fd4a914b16f388238e373cd56f0c37ea8f6 Mon Sep 17 00:00:00 2001 From: notro Date: Thu, 10 Jul 2014 13:59:47 +0200 -Subject: [PATCH 011/333] pinctrl-bcm2835: Set base to 0 give expected gpio +Subject: [PATCH 010/407] pinctrl-bcm2835: Set base to 0 give expected gpio numbering Signed-off-by: Noralf Tronnes @@ -588,10 +560,10 @@ index fa77165fab2c1348163979da507df17e7168c49b..d11e2e4ea189466e686d762cb6c6fef9 .can_sleep = false, }; -From 20d3210b191d525ed5790b9814b900445b8486c6 Mon Sep 17 00:00:00 2001 +From cffcdc3b45cfd1ad1b64bb22b74ebca294dc16e2 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 24 Feb 2015 13:40:50 +0000 -Subject: [PATCH 012/333] pinctrl-bcm2835: Fix interrupt handling for GPIOs +Subject: [PATCH 011/407] pinctrl-bcm2835: Fix interrupt handling for GPIOs 28-31 and 46-53 Contrary to the documentation, the BCM2835 GPIO controller actually has @@ -737,10 +709,10 @@ index d11e2e4ea189466e686d762cb6c6fef9111ecf8e..107ad7d58de8f8a7f55e09c9cdcf7d66 }, }; -From 3db36cddf0584c7587332f45dd91a6c2c5a94e7f Mon Sep 17 00:00:00 2001 +From 06b777c5678d02834d471cb62feef95e5163027a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 26 Feb 2015 09:58:22 +0000 -Subject: [PATCH 013/333] pinctrl-bcm2835: Only request the interrupts listed +Subject: [PATCH 012/407] pinctrl-bcm2835: Only request the interrupts listed in the DTB Although the GPIO controller can generate three interrupts (four counting @@ -767,10 +739,10 @@ index 107ad7d58de8f8a7f55e09c9cdcf7d66fa7ab66b..644bdecbcfcb79d3b84a33769265fca5 pc->irq_data[i].irqgroup = i; -From d1dc72f13d76949f837b1198c8531c784464e411 Mon Sep 17 00:00:00 2001 +From 1cc6f083c797d2f9816dc3c720a0b50182a8bcec Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 6 May 2016 12:32:47 +0100 -Subject: [PATCH 014/333] pinctrl-bcm2835: Return pins to inputs when freed +Subject: [PATCH 013/407] pinctrl-bcm2835: Return pins to inputs when freed When dynamically unloading overlays, it is important that freed pins are restored to being inputs to prevent functions from being enabled in @@ -811,10 +783,10 @@ index 644bdecbcfcb79d3b84a33769265fca5d3d0c9e5..81a66cba2ab0f7e3ae179de7edd10122 .get_function_name = bcm2835_pmx_get_function_name, .get_function_groups = bcm2835_pmx_get_function_groups, -From 7075e707beab7ec7ee548af64e09b87b9281daf6 Mon Sep 17 00:00:00 2001 +From d951272d426a28ff3127b0e076c8c4b55615e582 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Jun 2015 14:10:44 +0100 -Subject: [PATCH 015/333] spi-bcm2835: Support pin groups other than 7-11 +Subject: [PATCH 014/407] spi-bcm2835: Support pin groups other than 7-11 The spi-bcm2835 driver automatically uses GPIO chip-selects due to some unreliability of the native ones. In doing so it chooses the @@ -895,10 +867,10 @@ index f35cc10772f6670397ea923ad30158270dd68578..5dfe20ffc2866fa6789825016c585175 /* and set up the "mode" and level */ dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", -From a4aa5d7e264bfe688b9c264194f5a08cb5adfb37 Mon Sep 17 00:00:00 2001 +From b50a8360b376fc32b545a6ae49652421a9fee943 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 1 Jul 2016 22:09:24 +0100 -Subject: [PATCH 016/333] spi-bcm2835: Disable forced software CS +Subject: [PATCH 015/407] spi-bcm2835: Disable forced software CS Select software CS in bcm2708_common.dtsi, and disable the automatic conversion in the driver to allow hardware CS to be re-enabled with an @@ -932,10 +904,10 @@ index 5dfe20ffc2866fa6789825016c585175a29705b6..8493474d286f7a1ac6454a22c61c8c2c return 0; } -From 617a0b1f16de4bc8f806799a6e4b4b53ce288f84 Mon Sep 17 00:00:00 2001 +From 7a6a431dbd119629bfaafa6c76f85fe1e38e5ad5 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 8 Nov 2016 21:35:38 +0000 -Subject: [PATCH 017/333] spi-bcm2835: Remove unused code +Subject: [PATCH 016/407] spi-bcm2835: Remove unused code --- drivers/spi/spi-bcm2835.c | 61 ----------------------------------------------- @@ -1023,10 +995,10 @@ index 8493474d286f7a1ac6454a22c61c8c2cef9121bf..33d75ad38a7f77d085321ace9101900a } -From 70013bbcf19a833606d9d85d44d411e7fd18665a Mon Sep 17 00:00:00 2001 +From 07c224924e9f529153b35c6c51cf4839c9677da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 3 Jun 2015 12:26:13 +0200 -Subject: [PATCH 018/333] ARM: bcm2835: Set Serial number and Revision +Subject: [PATCH 017/407] ARM: bcm2835: Set Serial number and Revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1079,10 +1051,10 @@ index 0c1edfc98696da0e0bb7f4a18cdfbcdd27a9795d..8f152266ba9b470df2eaaed9ebcf158e static const char * const bcm2835_compat[] = { -From 237e85a741b9e91cb58f95fa18343f36fee93d28 Mon Sep 17 00:00:00 2001 +From 116c808d1e460052cddef6f2a017dc61ad782e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 3 Oct 2015 22:22:55 +0200 -Subject: [PATCH 019/333] dmaengine: bcm2835: Load driver early and support +Subject: [PATCH 018/407] dmaengine: bcm2835: Load driver early and support legacy API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -1185,10 +1157,10 @@ index 6204cc32d09c5096df8aec304c3c37b3bcb6be44..599c218dc8a73172dd4bd4a058fc8f95 MODULE_ALIAS("platform:bcm2835-dma"); MODULE_DESCRIPTION("BCM2835 DMA engine driver"); -From 4b1f5d3372391e7374e8f6965e795f77f6213b01 Mon Sep 17 00:00:00 2001 +From a13990a09baa3b466ee4ce58c4ac329fd672677f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 25 Jan 2016 17:25:12 +0000 -Subject: [PATCH 020/333] firmware: Updated mailbox header +Subject: [PATCH 019/407] firmware: Updated mailbox header --- include/soc/bcm2835/raspberrypi-firmware.h | 11 +++++++++++ @@ -1251,10 +1223,10 @@ index 3fb357193f09914fe21f8555a4b8613f74f22bc3..227a107214a02deadcca3db202da265e RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001, RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, -From dcf6ae69fce62c435a5ad105b21406f3fd0d08b6 Mon Sep 17 00:00:00 2001 +From 45767fdb8bfde01aa7b907a9b80564b78e07745f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 9 May 2016 17:28:18 -0700 -Subject: [PATCH 021/333] clk: bcm2835: Mark GPIO clocks enabled at boot as +Subject: [PATCH 020/407] clk: bcm2835: Mark GPIO clocks enabled at boot as critical. These divide off of PLLD_PER and are used for the ethernet and wifi @@ -1292,10 +1264,10 @@ index 2acaa77ad482a99f28ea64ea43c891501125304c..d13cbbf5bbe06314bfdf103ff85d5cd7 init.ops = &bcm2835_vpu_clock_clk_ops; } else { -From 8d793d200617c067b9e2e236f25444b9c9d42ede Mon Sep 17 00:00:00 2001 +From d3c6bce1142db56e0b1b1560e99d816ed0c5dab3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 15 Jun 2016 16:48:41 +0100 -Subject: [PATCH 022/333] rtc: Add SPI alias for pcf2123 driver +Subject: [PATCH 021/407] rtc: Add SPI alias for pcf2123 driver Without this alias, Device Tree won't cause the driver to be loaded. @@ -1315,10 +1287,10 @@ index 8895f77726e8da5444afcd602dceff8f25a9b3fd..1833b8853ceb0e6147cceb93a00e558c MODULE_LICENSE("GPL"); +MODULE_ALIAS("spi:rtc-pcf2123"); -From 11847a020d4fd6c199d1f1f34a82247894783e50 Mon Sep 17 00:00:00 2001 +From 03aca200255662f5811b73e4f8078684b66943b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 7 Oct 2016 16:50:59 +0200 -Subject: [PATCH 023/333] watchdog: bcm2835: Support setting reboot partition +Subject: [PATCH 022/407] watchdog: bcm2835: Support setting reboot partition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1442,10 +1414,10 @@ index 4dddd8298a227d64862f2e92954a465f2e44b3f6..1f545e024422f59280932713e6a1b051 register_restart_handler(&wdt->restart_handler); if (pm_power_off == NULL) -From 34b80d321529b8b96d6e4662e5f0f0d1c53dfa3f Mon Sep 17 00:00:00 2001 +From 91d7b97dfa953442a7acf4cecda8ee5711450aef Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 5 Apr 2016 19:40:12 +0100 -Subject: [PATCH 024/333] reboot: Use power off rather than busy spinning when +Subject: [PATCH 023/407] reboot: Use power off rather than busy spinning when halt is requested --- @@ -1468,10 +1440,10 @@ index 3fa867a2aae672755c6ce6448f4148c989dbf964..80dca8dcd6709034b643c6a3f35729e0 /* -From b26785c8e22a01b232480252e98c79119e1b5d10 Mon Sep 17 00:00:00 2001 +From c399ccab90d56f7b628a4ac81622a84bf2b622e9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 9 Nov 2016 13:02:52 +0000 -Subject: [PATCH 025/333] bcm: Make RASPBERRYPI_POWER depend on PM +Subject: [PATCH 024/407] bcm: Make RASPBERRYPI_POWER depend on PM --- drivers/soc/bcm/Kconfig | 1 + @@ -1490,10 +1462,10 @@ index a39b0d58ddd0fdf0ac1cc7295f8aafb12546e226..e037a6dd79d1881a09e3ca9115782709 help This enables support for the RPi power domains which can be enabled -From e64e6dcb6d571ebdf76fe415b3a79d685b639f5c Mon Sep 17 00:00:00 2001 +From 6987b66785f71b3c89243633a96c7f76a02825f7 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Fri, 2 Sep 2016 16:45:27 +0100 -Subject: [PATCH 026/333] Register the clocks early during the boot process, so +Subject: [PATCH 025/407] Register the clocks early during the boot process, so that special/critical clocks can get enabled early on in the boot process avoiding the risk of disabling a clock, pll_divider or pll when a claiming driver fails to install propperly - maybe it needs to defer. @@ -1538,10 +1510,10 @@ index d13cbbf5bbe06314bfdf103ff85d5cd73cbf7f7a..a99ccf9f056d3a3e7c482339e08483f3 MODULE_AUTHOR("Eric Anholt "); MODULE_DESCRIPTION("BCM2835 clock driver"); -From f8756a2d8cbb17cc54bdf9c18bca2ef53fb3b8cf Mon Sep 17 00:00:00 2001 +From 758d8c515025d4c2202a5fee253ab27f3ecd3755 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 6 Dec 2016 17:05:39 +0000 -Subject: [PATCH 027/333] bcm2835-rng: Avoid initialising if already enabled +Subject: [PATCH 026/407] bcm2835-rng: Avoid initialising if already enabled Avoids the 0x40000 cycles of warmup again if firmware has already used it --- @@ -1567,10 +1539,10 @@ index 574211a495491d9d6021dcaefe4274a63ed02055..e66c0fca8c6090e32f72796c0877a1cf err = hwrng_register(&bcm2835_rng_ops); if (err) { -From d93484077b2bad286709187debdb2af0220f31d3 Mon Sep 17 00:00:00 2001 +From a2ca496fd389aebc3b3aeb9f014ac4ede67f1372 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Aug 2016 16:28:44 +0100 -Subject: [PATCH 028/333] kbuild: Ignore dtco targets when filtering symbols +Subject: [PATCH 027/407] kbuild: Ignore dtco targets when filtering symbols --- scripts/Kbuild.include | 2 +- @@ -1590,10 +1562,10 @@ index 179219845dfcdfbeb586d12c5ec1296095d9fbf4..e0743e44f84188667a0c322e8c3d36f1 esac | tr ";" "\n" | sed -rn 's/^.*=== __KSYM_(.*) ===.*$$/KSYM_\1/p' -From ddba72b8985dbf4e0022b69dfe04070ef0b3a3bb Mon Sep 17 00:00:00 2001 +From cea6cd9f01e2028b1c0cf292e585a77b155a7cd9 Mon Sep 17 00:00:00 2001 From: Robert Tiemann Date: Mon, 20 Jul 2015 11:01:25 +0200 -Subject: [PATCH 029/333] BCM2835_DT: Fix I2S register map +Subject: [PATCH 028/407] BCM2835_DT: Fix I2S register map --- Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt | 4 ++-- @@ -1631,10 +1603,10 @@ index 65783de0aedf3da79adc36fd077b7a89954ddb6b..a89fe4220fdc3f26f75ee66daf187554 dmas = <&dma 2>, <&dma 3>; -From 1a7f3062339121dd6191be71d2443190f06cb832 Mon Sep 17 00:00:00 2001 +From 8e6b00a8c14d826727201c518595cfc9a77b3815 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 030/333] Main bcm2708/bcm2709 linux port +Subject: [PATCH 029/407] Main bcm2708/bcm2709 linux port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1841,10 +1813,10 @@ index cfb4b4496dd9f61362dea012176c146120fada07..d9c6c217c4d6a2408abe2665bf7f2700 MODULE_AUTHOR("Lubomir Rintel "); MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); -From 9c39f07e522a786892c1b48d7ce5c24f257738a9 Mon Sep 17 00:00:00 2001 +From d87165b144168a66b80a40ae045298a9607390f7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 031/333] Add dwc_otg driver +Subject: [PATCH 030/407] Add dwc_otg driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -2546,10 +2518,10 @@ index 358ca8dd784fe43700ae070764fa783500a792fe..abaac7c7142d8887c1516957fc52162c return i; } diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index f953d6d647f245be5452f6db70ea503552dff525..e17e9e094e5a85798579b25b34bd2b6f7f18c898 100644 +index 706b3d6a7614063995a39d51210712365f5ef6e5..4f2bbbb8632508f0722c9dc05e2ab3867a63bf90 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -5040,7 +5040,7 @@ static void port_event(struct usb_hub *hub, int port1) +@@ -5045,7 +5045,7 @@ static void port_event(struct usb_hub *hub, int port1) if (portchange & USB_PORT_STAT_C_OVERCURRENT) { u16 status = 0, unused; @@ -2559,7 +2531,7 @@ index f953d6d647f245be5452f6db70ea503552dff525..e17e9e094e5a85798579b25b34bd2b6f USB_PORT_FEAT_C_OVER_CURRENT); msleep(100); /* Cool down */ diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c -index 3a47077461578f2af47af8d551353c2c7cb12f0e..85b7ff6f24b8023e1b589aa1a3557885c48d7a13 100644 +index 4c388451f31f6c74507137815e9038ea677dfa4f..09670e362e5534d69b6ab52c538afc7f1269fa5e 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1908,6 +1908,85 @@ int usb_set_configuration(struct usb_device *dev, int configuration) @@ -6488,7 +6460,7 @@ index 0000000000000000000000000000000000000000..a896d73f7a9336f5a34015c44ea5a6b0 +} +module_exit(fsg_cleanup); diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig -index 0b80cee30da4740e8c28c6ea7a4cc700163a12ee..f17b939c149562527937f49d90e23c7ab8b72328 100644 +index eb121b2a55d4b4de42a42cf6bdb6b8a938d584ab..52fba4f05b8c817e1d58e6078bbb771d541e89a7 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -762,6 +762,19 @@ config USB_HWA_HCD @@ -62901,10 +62873,10 @@ index 0000000000000000000000000000000000000000..cdc9963176e5a4a0d5250613b61e26c5 +test_main(); +0; -From c4fa4342ab77d7d2971fcf6c31d78679d5e43237 Mon Sep 17 00:00:00 2001 +From 654d18688cb53116625975178d5a75cdfccadfa4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 17:06:34 +0100 -Subject: [PATCH 032/333] bcm2708 framebuffer driver +Subject: [PATCH 031/407] bcm2708 framebuffer driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -66363,10 +66335,10 @@ index 3c14e43b82fefe1d32f591d1b2f61d2cd28d0fa8..7626beb6a5bb8df601ddf0f6e6909d1f +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 -From aa098698a51a5ff9f4aa1471a1848702ff78d625 Mon Sep 17 00:00:00 2001 +From 4e92ef91a256ce411440af5481d619f3836e5f0b Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 033/333] dmaengine: Add support for BCM2708 +Subject: [PATCH 032/407] dmaengine: Add support for BCM2708 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -66997,10 +66969,10 @@ index 0000000000000000000000000000000000000000..c5bfff2765be4606077e6c8af73040ec + +#endif /* _PLAT_BCM2708_DMA_H */ -From b4cfa205adf4df7fb8b91ede16aecd8f4b9532ff Mon Sep 17 00:00:00 2001 +From a390b74e66a16cf5e432bdcef9a9871ff622231b Mon Sep 17 00:00:00 2001 From: gellert Date: Fri, 15 Aug 2014 16:35:06 +0100 -Subject: [PATCH 034/333] MMC: added alternative MMC driver +Subject: [PATCH 033/407] MMC: added alternative MMC driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -68750,10 +68722,10 @@ index 0000000000000000000000000000000000000000..4fe8d1fe44578fbefcd48f8c327ba3d0 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gellert Weisz"); -From 56afd77c76dbd2f584443de1c7f9d1868a3fe851 Mon Sep 17 00:00:00 2001 +From 044cdf939034542fa2c34ca75e2186057270a4f8 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 25 Mar 2015 17:49:47 +0000 -Subject: [PATCH 035/333] Adding bcm2835-sdhost driver, and an overlay to +Subject: [PATCH 034/407] Adding bcm2835-sdhost driver, and an overlay to enable it BCM2835 has two SD card interfaces. This driver uses the other one. @@ -71158,10 +71130,10 @@ index 0000000000000000000000000000000000000000..a9bc79bfdbb71807819dfe2d8f165144 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Phil Elwell"); -From 209cdc9f0cedd91a365cc4e93d330daa8aafa8d7 Mon Sep 17 00:00:00 2001 +From 2b7a4b743b851d3dd1c2c3e776146708a0100602 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 11 May 2016 12:50:33 +0100 -Subject: [PATCH 036/333] mmc: Add MMC_QUIRK_ERASE_BROKEN for some cards +Subject: [PATCH 035/407] mmc: Add MMC_QUIRK_ERASE_BROKEN for some cards Some SD cards have been found that corrupt data when small blocks are erased. Add a quirk to indicate that ERASE should not be used, @@ -71297,10 +71269,10 @@ index 73fad83acbcb6a157587180516f9ffe7c61eb7d7..e7c9d3098ac06e3c6554fa3373a311f9 unsigned int erase_shift; /* if erase unit is power 2 */ unsigned int pref_erase; /* in sectors */ -From cd13ba7ca132dceb2efdc2d1082fef6660929c2f Mon Sep 17 00:00:00 2001 +From 1b70f573828a17866cc8df67dab72a4841e3a240 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:31:47 +0100 -Subject: [PATCH 037/333] cma: Add vc_cma driver to enable use of CMA +Subject: [PATCH 036/407] cma: Add vc_cma driver to enable use of CMA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -72636,10 +72608,10 @@ index 0000000000000000000000000000000000000000..be2819d5d41f9d5ed65daf8eedb94c9e + +#endif /* VC_CMA_H */ -From 857b0e5f95c55c79120a76e29dd16b89692561c8 Mon Sep 17 00:00:00 2001 +From bc7f9bee1ad6df49d9c62bd4f652fe54b7e614ca Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 26 Mar 2012 22:15:50 +0100 -Subject: [PATCH 038/333] bcm2708: alsa sound driver +Subject: [PATCH 037/407] bcm2708: alsa sound driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -75374,10 +75346,10 @@ index 0000000000000000000000000000000000000000..af3e6eb690113fc32ce9e06bd2f0f294 + +#endif // _VC_AUDIO_DEFS_H_ -From 4a9238cc8f053e765f1795febf07f9b185ebf0ed Mon Sep 17 00:00:00 2001 +From 5e0b96ee5c98c9bcfbad5f007b54f05063ed5643 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 28 Oct 2016 15:36:43 +0100 -Subject: [PATCH 039/333] vc_mem: Add vc_mem driver for querying firmware +Subject: [PATCH 038/407] vc_mem: Add vc_mem driver for querying firmware memory addresses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -75901,10 +75873,10 @@ index 0000000000000000000000000000000000000000..20a475377eb3078ea1ecaef2b24efc35 + +#endif /* _VC_MEM_H */ -From 9b71b89ce276d4df64283ebc76f8aa4dcd9a654d Mon Sep 17 00:00:00 2001 +From 17ee812c69cd3dc9292997636d17e51135478c01 Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Tue, 22 Jul 2014 15:41:04 +0100 -Subject: [PATCH 040/333] vcsm: VideoCore shared memory service for BCM2835 +Subject: [PATCH 039/407] vcsm: VideoCore shared memory service for BCM2835 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -80311,10 +80283,10 @@ index 0000000000000000000000000000000000000000..334f36d0d697b047df2922b5f2db67f3 + +#endif /* __VMCS_SM_IOCTL_H__INCLUDED__ */ -From a9403662ab1c1bae44d4dd9704e93fee4e0234db Mon Sep 17 00:00:00 2001 +From 43792e2a9889510ade3b6013996f22ba4f2e26d0 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Fri, 21 Aug 2015 23:14:48 +0100 -Subject: [PATCH 041/333] Add /dev/gpiomem device for rootless user GPIO access +Subject: [PATCH 040/407] Add /dev/gpiomem device for rootless user GPIO access Signed-off-by: Luke Wren @@ -80625,10 +80597,10 @@ index 0000000000000000000000000000000000000000..911f5b7393ed48ceed8751f06967ae64 +MODULE_DESCRIPTION("gpiomem driver for accessing GPIO from userspace"); +MODULE_AUTHOR("Luke Wren "); -From fa5106e1d80ae6eed51817ea9a0603129c5e243c Mon Sep 17 00:00:00 2001 +From 30db84ef8d4b4d8363a7e09cfc8cd3828c85e4e1 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Sat, 5 Sep 2015 01:14:45 +0100 -Subject: [PATCH 042/333] Add SMI driver +Subject: [PATCH 041/407] Add SMI driver Signed-off-by: Luke Wren --- @@ -82579,10 +82551,10 @@ index 0000000000000000000000000000000000000000..ee3a75edfc033eeb0d90a687ffb68b10 + +#endif /* BCM2835_SMI_H */ -From 96f3ea8c5be50c76ad14ba5864cd06e7e7f78f19 Mon Sep 17 00:00:00 2001 +From 9b80129cb286efc600bcbb7d73201e8a5570fff0 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Tue, 26 Apr 2016 14:59:21 +0000 -Subject: [PATCH 043/333] MISC: bcm2835: smi: use clock manager and fix reload +Subject: [PATCH 042/407] MISC: bcm2835: smi: use clock manager and fix reload issues Use clock manager instead of self-made clockmanager. @@ -82752,10 +82724,10 @@ index 63a4ea08b9930a3a31a985f0a1d969b488ed49ec..1261540703127d1d63b9f3c87042c6e5 return 0; } -From a760f93b3fd9c575140d21b82159db7b669e5973 Mon Sep 17 00:00:00 2001 +From c17d10e830267006e43f34ab86e0f11a7f01f672 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Sat, 5 Sep 2015 01:16:10 +0100 -Subject: [PATCH 044/333] Add SMI NAND driver +Subject: [PATCH 043/407] Add SMI NAND driver Signed-off-by: Luke Wren --- @@ -83120,10 +83092,10 @@ index 0000000000000000000000000000000000000000..02adda6da18bd0ba9ab19a104975b79d + ("Driver for NAND chips using Broadcom Secondary Memory Interface"); +MODULE_AUTHOR("Luke Wren "); -From c7794dbb7547701d54f61449a7eec794e3cbffdf Mon Sep 17 00:00:00 2001 +From aa72fa6381ee97140e1152ef07c415872f11e1a9 Mon Sep 17 00:00:00 2001 From: Aron Szabo Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 045/333] lirc: added support for RaspberryPi GPIO +Subject: [PATCH 044/407] lirc: added support for RaspberryPi GPIO lirc_rpi: Use read_current_timer to determine transmitter delay. Thanks to jjmz and others See: https://github.com/raspberrypi/linux/issues/525 @@ -83986,10 +83958,10 @@ index 0000000000000000000000000000000000000000..fb69624ccef00ddbdccf8256d6baf1b1 + +#endif -From 5d070f4725428ff20b87dc6589bac00ff6fe55d1 Mon Sep 17 00:00:00 2001 +From d62424e96ae52f0f3dcc9fda78258480a64cdeb1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 046/333] Add cpufreq driver +Subject: [PATCH 045/407] Add cpufreq driver Signed-off-by: popcornmix --- @@ -84000,7 +83972,7 @@ Signed-off-by: popcornmix create mode 100644 drivers/cpufreq/bcm2835-cpufreq.c diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm -index d89b8afe23b6956b6c48e19c87cecc081e7725a1..465c727bb3ba70249409728d8f643a0002c6779c 100644 +index bc3917d6015a34a64da7920f6ebbc90ea3ce55fc..51357ef228798725ba25ae63cd6a3369b619c89c 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm @@ -220,6 +220,15 @@ config ARM_STI_CPUFREQ @@ -84256,10 +84228,10 @@ index 0000000000000000000000000000000000000000..414fbdc10dfbfc6e4bb47870a7af3fd5 +module_init(bcm2835_cpufreq_module_init); +module_exit(bcm2835_cpufreq_module_exit); -From ac11ff5afe45aab6ba2aca0b4c84a6bdb0470de4 Mon Sep 17 00:00:00 2001 +From 43a03f7e26ad66d9c8bab2348d2c5097db3f16ee Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 19:24:24 +0000 -Subject: [PATCH 047/333] Added hwmon/thermal driver for reporting core +Subject: [PATCH 046/407] Added hwmon/thermal driver for reporting core temperature. Thanks Dorian MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -84425,10 +84397,10 @@ index 0000000000000000000000000000000000000000..c63fb9f9d143e19612a18fe530c7b2b3 +MODULE_DESCRIPTION("Thermal driver for bcm2835 chip"); +MODULE_LICENSE("GPL"); -From a1417df3514f4e193a0b5b368569e61015a3e86e Mon Sep 17 00:00:00 2001 +From b5345e62ce9c57f10d0ffd5b0a926bdf41f09cc5 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 15:44:08 +0100 -Subject: [PATCH 048/333] Add Chris Boot's i2c driver +Subject: [PATCH 047/407] Add Chris Boot's i2c driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -85093,10 +85065,10 @@ index 0000000000000000000000000000000000000000..962f2e5c7455d91bf32925d785f5f16b +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -From ebf4ec9ec3cf70555e90a087914ef77ce63aff3d Mon Sep 17 00:00:00 2001 +From 530ef66269864254c848bfe609e2fc1fda40cafe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 26 Jun 2015 14:27:06 +0200 -Subject: [PATCH 049/333] char: broadcom: Add vcio module +Subject: [PATCH 048/407] char: broadcom: Add vcio module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -85322,10 +85294,10 @@ index 0000000000000000000000000000000000000000..c19bc2075c77879563ef5e59038b5a14 +MODULE_DESCRIPTION("Mailbox userspace access"); +MODULE_LICENSE("GPL"); -From e6e0760c6311ad5550c58a8aa52b4dcf3af833d4 Mon Sep 17 00:00:00 2001 +From 36cbbc724cd702ddd54f0da387e3cc2ef637e74c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 26 Jun 2015 14:25:01 +0200 -Subject: [PATCH 050/333] firmware: bcm2835: Support ARCH_BCM270x +Subject: [PATCH 049/407] firmware: bcm2835: Support ARCH_BCM270x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -85408,10 +85380,10 @@ index dd506cd3a5b874f9e1acd07efb8cd151bb6145d1..3f070bd38a91511c986e3fb114b15bd4 MODULE_AUTHOR("Eric Anholt "); MODULE_DESCRIPTION("Raspberry Pi firmware driver"); -From 4e5618f7f1ee67d0cba853b28ced481ff27da470 Mon Sep 17 00:00:00 2001 +From 0e8a82291d32bbd0fb0ddcb12cbd5421e38400d0 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 30 Jan 2013 12:45:18 +0000 -Subject: [PATCH 051/333] bcm2835: add v4l2 camera device +Subject: [PATCH 050/407] bcm2835: add v4l2 camera device - Supports raw YUV capture, preview, JPEG and H264. - Uses videobuf2 for data transfer, using dma_buf. @@ -93153,10 +93125,10 @@ index 0000000000000000000000000000000000000000..9d1d11e4a53e510c04a416d92d195a7d + +#endif /* MMAL_VCHIQ_H */ -From 4f98e3ad49b6451b95b2b73ec1121bb49506ec97 Mon Sep 17 00:00:00 2001 +From 57c80bccbeb65e4a579ee6f7ad82aad5620d640b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 11 May 2015 09:00:42 +0100 -Subject: [PATCH 052/333] scripts: Add mkknlimg and knlinfo scripts from tools +Subject: [PATCH 051/407] scripts: Add mkknlimg and knlinfo scripts from tools repo The Raspberry Pi firmware looks for a trailer on the kernel image to @@ -93676,10 +93648,10 @@ index 0000000000000000000000000000000000000000..60206de7fa9a49bd027c635306674a29 + return $trailer; +} -From 114daaee5a7fdf861320ae856ea3f4570d5cc2e3 Mon Sep 17 00:00:00 2001 +From 92a609134995fe9ae69c2ce4f293d3b12a6f4fa1 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 10 Aug 2015 09:49:15 +0100 -Subject: [PATCH 053/333] scripts/dtc: Update to upstream version 1.4.1 +Subject: [PATCH 052/407] scripts/dtc: Update to upstream version 1.4.1 Includes the new localfixups format. @@ -96530,10 +96502,10 @@ index ad9b05ae698b0495ecbda42ffcf4743555313a27..2595dfda020fd9e03f0beff5006f229d -#define DTC_VERSION "DTC 1.4.1-g53bf130b" +#define DTC_VERSION "DTC 1.4.1-g25efc119" -From 1dba92cec81b0fc66d9dd92549041530e89f4ad8 Mon Sep 17 00:00:00 2001 +From 9abdaacb85a7506c4e4669f0db378bfc4c3ab1b8 Mon Sep 17 00:00:00 2001 From: notro Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 054/333] BCM2708: Add core Device Tree support +Subject: [PATCH 053/407] BCM2708: Add core Device Tree support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -106661,10 +106633,10 @@ index 0a07f9014944ed92a8e2e42983ae43be60b3e471..1967878a843461c3ff1f473b9a030eb0 # Bzip2 -From f5940d59cf8495c0101278d4f33915f9741c5bea Mon Sep 17 00:00:00 2001 +From 47b80548ba1ad1370ff1bedeab29700667a06265 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 6 Feb 2015 13:50:57 +0000 -Subject: [PATCH 055/333] BCM270x_DT: Add pwr_led, and the required "input" +Subject: [PATCH 054/407] BCM270x_DT: Add pwr_led, and the required "input" trigger The "input" trigger makes the associated GPIO an input. This is to support @@ -106840,10 +106812,10 @@ index ddfcb2df3656cf0ab6aebd1fa3d624a6ec2e94e9..271563eb835f9018712e2076a88f341d /* Set LED brightness level * Must not sleep. Use brightness_set_blocking for drivers -From a8b8d89ade70d426ddcbde8bc9a4f8b11c6ae5c3 Mon Sep 17 00:00:00 2001 +From b65a53aa87f4a8ed673ca002a0d160d777e9c243 Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 056/333] fbdev: add FBIOCOPYAREA ioctl +Subject: [PATCH 055/407] fbdev: add FBIOCOPYAREA ioctl Based on the patch authored by Ali Gholami Rudi at https://lkml.org/lkml/2009/7/13/153 @@ -107095,10 +107067,10 @@ index fb795c3b3c178ad3cd7c9e9e4547ffd492bac181..703fa8a70574323abe2fb32599254582 __u32 dx; /* screen-relative */ __u32 dy; -From 2683453d910b4ae1fff63f46ec6834e686be93e4 Mon Sep 17 00:00:00 2001 +From 58f787c938e61a3808ce547cb86b7d50bd981df9 Mon Sep 17 00:00:00 2001 From: Harm Hanemaaijer Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 057/333] Speed up console framebuffer imageblit function +Subject: [PATCH 056/407] Speed up console framebuffer imageblit function Especially on platforms with a slower CPU but a relatively high framebuffer fill bandwidth, like current ARM devices, the existing @@ -107307,10 +107279,10 @@ index a2bb276a8b2463eee98eb237c4647bc00cd93601..436494fba15abecb400ef28688466faf start_index, pitch_index); } else -From 5dffa69c937ef936d02ed9faa687d5c734a07830 Mon Sep 17 00:00:00 2001 +From 5e36d93fc1b0b7d61d592bf7bc4e0104c16e5b38 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 058/333] enabling the realtime clock 1-wire chip DS1307 and +Subject: [PATCH 057/407] enabling the realtime clock 1-wire chip DS1307 and 1-wire on GPIO4 (as a module) 1-wire: Add support for configuring pin for w1-gpio kernel module @@ -107560,10 +107532,10 @@ index d58594a3232492e33f1dd4babd3798b03e0f0203..feae94256256316fd9d850c3d83325af unsigned int ext_pullup_enable_pin; unsigned int pullup_duration; -From 790ccd6dc71732112c1399f8a192d5618e04f215 Mon Sep 17 00:00:00 2001 +From eb40b331ea7c107a559bb40c7f5dab9202c03d4c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Dec 2013 22:16:19 +0000 -Subject: [PATCH 059/333] config: Enable CONFIG_MEMCG, but leave it disabled +Subject: [PATCH 058/407] config: Enable CONFIG_MEMCG, but leave it disabled (due to memory cost). Enable with cgroup_enable=memory. --- @@ -107613,10 +107585,10 @@ index 4c233437ee1ad40d28ad8c32baf5029cdb0d0fdd..d0ecb18e0e3ad06483be2ddea9114c5a * css_tryget_online_from_dir - get corresponding css from a cgroup dentry * @dentry: directory dentry of interest -From c3d0468fe0f872810e0a985bc67748a7b3e9908e Mon Sep 17 00:00:00 2001 +From 13f9ee79b8d257b8b8787d94b911a8bc35d2a32c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 060/333] hid: Reduce default mouse polling interval to 60Hz +Subject: [PATCH 059/407] hid: Reduce default mouse polling interval to 60Hz Reduces overhead when using X --- @@ -107624,7 +107596,7 @@ Reduces overhead when using X 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index ae83af649a607f67239f1a64bf45dd4b5770cc7d..4a7af9d0b910f59d17421ce14138400dfd5834f3 100644 +index 7838343eb37c541d698a7e78ff265e789fda7c98..fb8777ab070b699ba50fd8bc8d9d86971f6f9f93 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -49,7 +49,7 @@ @@ -107636,7 +107608,7 @@ index ae83af649a607f67239f1a64bf45dd4b5770cc7d..4a7af9d0b910f59d17421ce14138400d module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); -@@ -1083,8 +1083,12 @@ static int usbhid_start(struct hid_device *hid) +@@ -1093,8 +1093,12 @@ static int usbhid_start(struct hid_device *hid) } /* Change the polling interval of mice. */ @@ -107652,10 +107624,10 @@ index ae83af649a607f67239f1a64bf45dd4b5770cc7d..4a7af9d0b910f59d17421ce14138400d ret = -ENOMEM; if (usb_endpoint_dir_in(endpoint)) { -From c14750a7a6b164ad7d1f99c7b4a2d6b1fe6aea70 Mon Sep 17 00:00:00 2001 +From d6a4189ad6844b065eb7c5f4dc7230d57f290f6c Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Tue, 12 May 2015 14:47:56 +0100 -Subject: [PATCH 061/333] rpi-ft5406: Add touchscreen driver for pi LCD display +Subject: [PATCH 060/407] rpi-ft5406: Add touchscreen driver for pi LCD display Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected @@ -108013,10 +107985,10 @@ index 227a107214a02deadcca3db202da265eba1fdd21..b0f6e33bd30c35664ceee057f4c3ad32 RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, -From 12f9cdf674fe1d59b88f393bd343b508f0b16a40 Mon Sep 17 00:00:00 2001 +From c784c1980e742f53bfe88c6738ae2e7d46eeb5ba Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 28 Nov 2016 16:50:04 +0000 -Subject: [PATCH 062/333] Improve __copy_to_user and __copy_from_user +Subject: [PATCH 061/407] Improve __copy_to_user and __copy_from_user performance Provide a __copy_from_user that uses memcpy. On BCM2708, use @@ -109591,10 +109563,10 @@ index 333dc3c2e5ffbb2c5ab8fcfb6115b6162643cf20..46b787a6474ffa857da9b663948863ec bool "Broadcom BCM63xx DSL SoC" depends on ARCH_MULTI_V7 -From b12839f77156bf866a566bc8d5dd6743c781cd30 Mon Sep 17 00:00:00 2001 +From d732af0ce17e3c67c92c3955b3b3d39ab911c86e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 25 Jun 2015 12:16:11 +0100 -Subject: [PATCH 063/333] gpio-poweroff: Allow it to work on Raspberry Pi +Subject: [PATCH 062/407] gpio-poweroff: Allow it to work on Raspberry Pi The Raspberry Pi firmware manages the power-down and reboot process. To do this it installs a pm_power_off handler, causing @@ -109629,10 +109601,10 @@ index be3d81ff51cc3f510d85e4eed7a52960e51e7bc1..a030ae9fb1fca325061c093696e82186 "%s: pm_power_off function already registered", __func__); -From c03d21639664c679c8a39f002833e9c5d41f5ffe Mon Sep 17 00:00:00 2001 +From 18ede3b1281876a8ca105b15ccf9896269d96fe4 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 14 Jul 2015 14:32:47 +0100 -Subject: [PATCH 064/333] mfd: Add Raspberry Pi Sense HAT core driver +Subject: [PATCH 063/407] mfd: Add Raspberry Pi Sense HAT core driver --- drivers/input/joystick/Kconfig | 8 + @@ -110497,10 +110469,10 @@ index 0000000000000000000000000000000000000000..56196dc2af10e464a1e3f98b028dca1c + +#endif -From 569201c1c9bedf1ee2f7505b1b818a7985ed2518 Mon Sep 17 00:00:00 2001 +From 225642fb5b6f7502354552a5e549f743125706d6 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 065/333] ASoC: Add support for HifiBerry DAC +Subject: [PATCH 064/407] ASoC: Add support for HifiBerry DAC This adds a machine driver for the HifiBerry DAC. It is a sound card that can @@ -110675,10 +110647,10 @@ index 0000000000000000000000000000000000000000..45f2b770ad9e67728ca599a7445d6ae9 +MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); +MODULE_LICENSE("GPL v2"); -From 94905f5dc960b251bfce274cb05fa4c78de7632f Mon Sep 17 00:00:00 2001 +From b28deafdb970b6e2617ca2d570122e2d9c20f347 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Mon, 25 Jan 2016 15:48:59 +0000 -Subject: [PATCH 066/333] ASoC: Add support for Rpi-DAC +Subject: [PATCH 065/407] ASoC: Add support for Rpi-DAC --- sound/soc/bcm/Kconfig | 7 +++ @@ -110962,10 +110934,10 @@ index 0000000000000000000000000000000000000000..afe1b419582aa40c4b2729d242bb13cd +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); -From 27fcd7440478525edbee743ac8c867ce813e25cf Mon Sep 17 00:00:00 2001 +From 8817aa24cc4aa1ea6eff50792b7fbc19d08db216 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 067/333] ASoC: wm8804: Implement MCLK configuration options, +Subject: [PATCH 066/407] ASoC: wm8804: Implement MCLK configuration options, add 32bit support WM8804 can run with PLL frequencies of 256xfs and 128xfs for most sample rates. At 192kHz only 128xfs is supported. The existing driver selects 128xfs automatically for some lower samples rates. By using an @@ -111014,10 +110986,10 @@ index af95d648265b3e92e345101542b332aee35191d4..513f56ba132929662802d15cdc653af3 .component_driver = { .dapm_widgets = wm8804_dapm_widgets, -From e7e402da0efa855df7ffe7bba3356003285766ab Mon Sep 17 00:00:00 2001 +From 1675b074ff5bb33e9aa3449a5a544597c75a14ab Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 068/333] ASoC: BCM:Add support for HiFiBerry Digi. Driver is +Subject: [PATCH 067/407] ASoC: BCM:Add support for HiFiBerry Digi. Driver is based on the patched WM8804 driver. Signed-off-by: Daniel Matuschek @@ -111361,10 +111333,10 @@ index 0000000000000000000000000000000000000000..19dc953b7227ba86123fc7a2ba654499 +MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); +MODULE_LICENSE("GPL v2"); -From f9103ee9afc75f045e668d5ce3f60d666c6d244d Mon Sep 17 00:00:00 2001 +From d6634358676e0cd3f843bb72b185f0745627d8ad Mon Sep 17 00:00:00 2001 From: Gordon Garrity Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 069/333] Add IQaudIO Sound Card support for Raspberry Pi +Subject: [PATCH 068/407] Add IQaudIO Sound Card support for Raspberry Pi Set a limit of 0dB on Digital Volume Control @@ -111694,10 +111666,10 @@ index 0000000000000000000000000000000000000000..4e8e6dec14bcf4a1ff286c43742d4097 +MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); +MODULE_LICENSE("GPL v2"); -From dd4f716ff7faed7cf3d5387714b3e8f5275787fe Mon Sep 17 00:00:00 2001 +From 72a165ffee894f1c287dded2a891a3327fa8c868 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 25 Jul 2016 17:06:50 +0100 -Subject: [PATCH 070/333] iqaudio-dac: Compile fix - untested +Subject: [PATCH 069/407] iqaudio-dac: Compile fix - untested --- sound/soc/bcm/iqaudio-dac.c | 6 +++++- @@ -111721,10 +111693,10 @@ index 4e8e6dec14bcf4a1ff286c43742d4097249d6777..aa15bc4b49ca95edec905fddd8fd0a6d if (dapm->dev != codec_dai->dev) return 0; -From 3224ca3a5f3a217753c1bc9d6b115e5b82781a88 Mon Sep 17 00:00:00 2001 +From 02eeb3bcf6e1fe34628cc1ba22aa02fca7cc59eb Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 10:06:56 +0200 -Subject: [PATCH 071/333] Added support for HiFiBerry DAC+ +Subject: [PATCH 070/407] Added support for HiFiBerry DAC+ The driver is based on the HiFiBerry DAC driver. However HiFiBerry DAC+ uses a different codec chip (PCM5122), therefore a new driver is necessary. @@ -112354,10 +112326,10 @@ index 72b19e62f6267698aea45d2410d616d91c1825cb..c6839ef6e16754ed9de2698507b8986a dev_err(dev, "No LRCLK?\n"); return -EINVAL; -From 17ca3c4973526587ada18c972cea7568d9597244 Mon Sep 17 00:00:00 2001 +From 49772104061630a0dc576ae375513f22aef20cec Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 11:09:58 +0200 -Subject: [PATCH 072/333] Added driver for HiFiBerry Amp amplifier add-on board +Subject: [PATCH 071/407] Added driver for HiFiBerry Amp amplifier add-on board The driver contains a low-level hardware driver for the TAS5713 and the drivers for the Raspberry Pi I2S subsystem. @@ -113197,10 +113169,10 @@ index 0000000000000000000000000000000000000000..8f019e04898754d2f87e9630137be9e8 + +#endif /* _TAS5713_H */ -From a3213d4717b759ad95d65cba624aa6038dd9811e Mon Sep 17 00:00:00 2001 +From e7404aa8dea411bbaa811b80e63e50fa6518a2f6 Mon Sep 17 00:00:00 2001 From: Ryan Coe Date: Sat, 31 Jan 2015 18:25:49 -0700 -Subject: [PATCH 073/333] Update ds1307 driver for device-tree support +Subject: [PATCH 072/407] Update ds1307 driver for device-tree support Signed-off-by: Ryan Coe --- @@ -113227,10 +113199,10 @@ index 4e31036ee2596dec93accd26f627c5b95591ae9f..b92044cf03e750afa521a93519500e9d .driver = { .name = "rtc-ds1307", -From 7b36e748ad832db3376d92df58ab7bfa44e87010 Mon Sep 17 00:00:00 2001 +From 943d3d84749a1496ba7085d75c55beba28ca4716 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 25 Mar 2015 09:26:17 +0100 -Subject: [PATCH 074/333] Add driver for rpi-proto +Subject: [PATCH 073/407] Add driver for rpi-proto Forward port of 3.10.x driver from https://github.com/koalo We are using a custom board and would like to use rpi 3.18.x @@ -113446,10 +113418,10 @@ index 0000000000000000000000000000000000000000..9db678e885efd63d84d60a098a84ed67 +MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); +MODULE_LICENSE("GPL"); -From 23375d3c9864b7778c2bfc69355cf3c7cb6f44a3 Mon Sep 17 00:00:00 2001 +From 616971b56510e8790af0e399e3edacf5c6aa17ad Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Mon, 24 Aug 2015 16:03:47 +0100 -Subject: [PATCH 075/333] RaspiDAC3 support +Subject: [PATCH 074/407] RaspiDAC3 support Signed-off-by: Jan Grulich @@ -113692,10 +113664,10 @@ index 0000000000000000000000000000000000000000..dd9eeea2af0382307f437e6db09d1546 +MODULE_DESCRIPTION("ASoC Driver for RaspiDAC Rev.3x"); +MODULE_LICENSE("GPL v2"); -From 2cc622de75509e5219903d5bff60bfd1a6a9cde9 Mon Sep 17 00:00:00 2001 +From a10511a482f96587f41987752d02087e7148f583 Mon Sep 17 00:00:00 2001 From: Aaron Shaw Date: Thu, 7 Apr 2016 21:26:21 +0100 -Subject: [PATCH 076/333] Add Support for JustBoom Audio boards +Subject: [PATCH 075/407] Add Support for JustBoom Audio boards justboom-dac: Adjust for ALSA API change @@ -114149,10 +114121,10 @@ index 0000000000000000000000000000000000000000..91acb666380faa3c0deb2230f8a0f8bb +MODULE_DESCRIPTION("ASoC Driver for JustBoom PI Digi HAT Sound Card"); +MODULE_LICENSE("GPL v2"); -From 78b863b38b3c94134f10a8842199ec0295263008 Mon Sep 17 00:00:00 2001 +From 4e30b31bce3599419d371e96e7bd9916d4c69314 Mon Sep 17 00:00:00 2001 From: Andrey Grodzovsky Date: Tue, 3 May 2016 22:10:59 -0400 -Subject: [PATCH 077/333] ARM: adau1977-adc: Add basic machine driver for +Subject: [PATCH 076/407] ARM: adau1977-adc: Add basic machine driver for adau1977 codec driver. This commit adds basic support for the codec usage including: Device tree overlay, @@ -114334,10 +114306,10 @@ index 0000000000000000000000000000000000000000..6e2ee027926ee63c89222f75ceb89e3d +MODULE_DESCRIPTION("ASoC Driver for ADAU1977 ADC"); +MODULE_LICENSE("GPL v2"); -From 2f63dfe083262958b52e818f7eacb243981c86ec Mon Sep 17 00:00:00 2001 +From 300c5e9b4beb1e24857b5603919b20a7358f8d59 Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Mon, 16 May 2016 21:36:31 +1000 -Subject: [PATCH 078/333] New AudioInjector.net Pi soundcard with low jitter +Subject: [PATCH 077/407] New AudioInjector.net Pi soundcard with low jitter audio in and out. Contains the sound/soc/bcm ALSA machine driver and necessary alterations to the Kconfig and Makefile. @@ -114588,10 +114560,10 @@ index 0000000000000000000000000000000000000000..ef54e0f07ea03f59e9957b5d98f3e7fd +MODULE_ALIAS("platform:audioinjector-pi-soundcard"); + -From 0afac6fe3952fc47372f8bc6e80de5b7f8bf1412 Mon Sep 17 00:00:00 2001 +From b740d9d20e67da859e88eab5d3b9010038d432c4 Mon Sep 17 00:00:00 2001 From: DigitalDreamtime Date: Thu, 30 Jun 2016 18:38:42 +0100 -Subject: [PATCH 079/333] Add IQAudIO Digi WM8804 board support +Subject: [PATCH 078/407] Add IQAudIO Digi WM8804 board support Support IQAudIO Digi board with iqaudio_digi machine driver and iqaudio-digi-wm8804-audio overlay. @@ -114891,10 +114863,10 @@ index 0000000000000000000000000000000000000000..9b6e829bcb5b1762a853775e78163196 +MODULE_DESCRIPTION("ASoC Driver for IQAudIO WM8804 Digi"); +MODULE_LICENSE("GPL v2"); -From c493c9e355b9b724481dbf8ff00091a4911420dd Mon Sep 17 00:00:00 2001 +From 0c898a16ef0d017295880023e16bc8117b7251e1 Mon Sep 17 00:00:00 2001 From: escalator2015 Date: Tue, 24 May 2016 16:20:09 +0100 -Subject: [PATCH 080/333] New driver for RRA DigiDAC1 soundcard using WM8741 + +Subject: [PATCH 079/407] New driver for RRA DigiDAC1 soundcard using WM8741 + WM8804 --- @@ -115367,10 +115339,10 @@ index 0000000000000000000000000000000000000000..446796e7e4c14a7d95b2f2a01211d9a0 +MODULE_DESCRIPTION("ASoC Driver for RRA DigiDAC1"); +MODULE_LICENSE("GPL v2"); -From 4243b469d9bb8cccc463c1aa7dde2a08081abb7f Mon Sep 17 00:00:00 2001 +From e51cb396734f88bf2674b7ca2b4aa72197c6dd24 Mon Sep 17 00:00:00 2001 From: DigitalDreamtime Date: Sat, 2 Jul 2016 16:26:19 +0100 -Subject: [PATCH 081/333] Add support for Dion Audio LOCO DAC-AMP HAT +Subject: [PATCH 080/407] Add support for Dion Audio LOCO DAC-AMP HAT Using dedicated machine driver and pcm5102a codec driver. @@ -115543,10 +115515,10 @@ index 0000000000000000000000000000000000000000..89e65317512bc774453ac8d0d5b0ff98 +MODULE_DESCRIPTION("ASoC Driver for DionAudio LOCO"); +MODULE_LICENSE("GPL v2"); -From dbac1312e3081603b97cc5e77ebb0cc15c8f2f9a Mon Sep 17 00:00:00 2001 +From c826cf17c23c159b84be105e9be29415742c3b96 Mon Sep 17 00:00:00 2001 From: Clive Messer Date: Mon, 19 Sep 2016 14:01:04 +0100 -Subject: [PATCH 082/333] Allo Piano DAC boards: Initial 2 channel (stereo) +Subject: [PATCH 081/407] Allo Piano DAC boards: Initial 2 channel (stereo) support (#1645) Add initial 2 channel (stereo) support for Allo Piano DAC (2.0/2.1) boards, @@ -115753,10 +115725,10 @@ index 0000000000000000000000000000000000000000..8e8e62e5a36a279b425ed4655cfbac99 +MODULE_DESCRIPTION("ALSA ASoC Machine Driver for Allo Piano DAC"); +MODULE_LICENSE("GPL v2"); -From 5a64f7f87d319666f92e33cc17682878dca3e7fc Mon Sep 17 00:00:00 2001 +From b6b370e1f779cfac8fedd789eb39d1e0eb96da26 Mon Sep 17 00:00:00 2001 From: gtrainavicius Date: Sun, 23 Oct 2016 12:06:53 +0300 -Subject: [PATCH 083/333] Support for Blokas Labs pisound board +Subject: [PATCH 082/407] Support for Blokas Labs pisound board Pisound dynamic overlay (#1760) @@ -115773,11 +115745,11 @@ Print a logline when the kernel module is removed. create mode 100644 sound/soc/bcm/pisound.c diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt -index f0a48ea78659c933839554ca879babb1b621b264..779c19033acad30ed8fd71f015ee76caef1a0568 100644 +index bceffffb7502d80b71cbf3ddff2670cfcc7353d2..2b0dbc0a182cf5947227ad9fe482aae09b50a39b 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt -@@ -40,6 +40,7 @@ auvidea Auvidea GmbH - avago Avago Technologies +@@ -41,6 +41,7 @@ avago Avago Technologies + avia avia semiconductor avic Shanghai AVIC Optoelectronics Co., Ltd. axis Axis Communications AB +blokaslabs Vilniaus Blokas UAB @@ -116933,10 +116905,10 @@ index 0000000000000000000000000000000000000000..4b8545487d06e4ea70073a5d063fb231 +MODULE_DESCRIPTION("ASoC Driver for pisound, http://blokas.io/pisound"); +MODULE_LICENSE("GPL v2"); -From c7e415ce2612f4beae3973b5b7c378fec5bdf204 Mon Sep 17 00:00:00 2001 +From 9048868e60a6892a602e75218fae01b6f9d7b829 Mon Sep 17 00:00:00 2001 From: P33M Date: Wed, 21 Oct 2015 14:55:21 +0100 -Subject: [PATCH 084/333] rpi_display: add backlight driver and overlay +Subject: [PATCH 083/407] rpi_display: add backlight driver and overlay Add a mailbox-driven backlight controller for the Raspberry Pi DSI touchscreen display. Requires updated GPU firmware to recognise the @@ -117105,10 +117077,10 @@ index 0000000000000000000000000000000000000000..14a0d9b037395497c1fdae2961feccd5 +MODULE_DESCRIPTION("Raspberry Pi mailbox based Backlight Driver"); +MODULE_LICENSE("GPL"); -From 3b9129963bc6bec1b6fb5818c15d90775361a9c9 Mon Sep 17 00:00:00 2001 +From 058a0b2165a96b4879e012a7ee5afb4fb7bdf7a6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 23 Feb 2016 19:56:04 +0000 -Subject: [PATCH 085/333] bcm2835-virtgpio: Virtual GPIO driver +Subject: [PATCH 084/407] bcm2835-virtgpio: Virtual GPIO driver Add a virtual GPIO driver that uses the firmware mailbox interface to request that the VPU toggles LEDs. @@ -117382,10 +117354,10 @@ index b0f6e33bd30c35664ceee057f4c3ad32b914291d..e92278968b2b979db2a1f855f70e7aaf RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, -From 11eb6f72216c935640ec90a8614dd9e88806cfa5 Mon Sep 17 00:00:00 2001 +From c1be1f58fc7c5324e446c7d63c8b5bad8f64d8c2 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 23 Feb 2016 17:26:48 +0000 -Subject: [PATCH 086/333] amba_pl011: Don't use DT aliases for numbering +Subject: [PATCH 085/407] amba_pl011: Don't use DT aliases for numbering The pl011 driver looks for DT aliases of the form "serial", and if found uses as the device ID. This can cause @@ -117414,10 +117386,10 @@ index e2c33b9528d82ed7a2c27d083d7b1d222da68178..5a11ff833e1fd112ba04df3a427cd94b uap->old_cr = 0; uap->port.dev = dev; -From c692780c3b3c210c1c28342eee17b962c1c20530 Mon Sep 17 00:00:00 2001 +From 16c6d5359a7fcd10be6f058cfa20817d9e7cd2da Mon Sep 17 00:00:00 2001 From: Pantelis Antoniou Date: Wed, 3 Dec 2014 13:23:28 +0200 -Subject: [PATCH 087/333] OF: DT-Overlay configfs interface +Subject: [PATCH 086/407] OF: DT-Overlay configfs interface This is a port of Pantelis Antoniou's v3 port that makes use of the new upstreamed configfs support for binary attributes. @@ -117849,10 +117821,10 @@ index 0000000000000000000000000000000000000000..0037e6868a6cda8706c88194c6a4454b +} +late_initcall(of_cfs_init); -From 7fd2b287b25fe6f2b2b11d6cd6f4aaee0049cee3 Mon Sep 17 00:00:00 2001 +From d767ab015bbfc65574412f95d5ab6a7b121d9e5e Mon Sep 17 00:00:00 2001 From: Cheong2K Date: Fri, 26 Feb 2016 18:20:10 +0800 -Subject: [PATCH 088/333] brcm: adds support for BCM43341 wifi +Subject: [PATCH 087/407] brcm: adds support for BCM43341 wifi brcmfmac: Disable power management @@ -117899,10 +117871,10 @@ Signed-off-by: Phil Elwell 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -index 1d4352e1ac81a337c6c3e1e85983cb0fe151f8b8..3ac3056ab1d2074e4a60961455f0c355c5a18afd 100644 +index 27960b0bfbcd8f1bf2aed58e3c5097f933164623..98fa503627d62dd247a30a0db83ced788d41749d 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2756,6 +2756,8 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, +@@ -2745,6 +2745,8 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, * preference in cfg struct to apply this to * FW later while initializing the dongle */ @@ -117911,7 +117883,7 @@ index 1d4352e1ac81a337c6c3e1e85983cb0fe151f8b8..3ac3056ab1d2074e4a60961455f0c355 cfg->pwr_save = enabled; if (!check_vif_up(ifp->vif)) { -@@ -4750,12 +4752,15 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) +@@ -4751,12 +4753,15 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); if (err < 0) brcmf_err("BRCMF_C_DOWN error %d\n", err); @@ -117930,7 +117902,7 @@ index 1d4352e1ac81a337c6c3e1e85983cb0fe151f8b8..3ac3056ab1d2074e4a60961455f0c355 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) brcmf_fil_iovar_int_set(ifp, "mbss", 0); brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, -@@ -6744,12 +6749,18 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], +@@ -6745,12 +6750,18 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], struct brcmfmac_pd_cc *country_codes; struct brcmfmac_pd_cc_entry *cc; s32 found_index; @@ -117951,7 +117923,7 @@ index 1d4352e1ac81a337c6c3e1e85983cb0fe151f8b8..3ac3056ab1d2074e4a60961455f0c355 } if ((alpha2[0] == ccreq->country_abbrev[0]) && -@@ -6773,10 +6784,14 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], +@@ -6774,10 +6785,14 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], brcmf_dbg(TRACE, "No country code match found\n"); return -EINVAL; } @@ -118015,10 +117987,10 @@ index d0407d9ad7827cd756b6311410ffe2d9a7cacc78..f1fb8a3c7a3211e8429585861f2f42e0 #define BRCM_CC_4335_CHIP_ID 0x4335 #define BRCM_CC_4339_CHIP_ID 0x4339 -From 0d6fd1f2d1ef109cb5a78f790ddc74b8419bc1a1 Mon Sep 17 00:00:00 2001 +From b95e790677e4c409be9f3e7aae8e0b3e116d8a7f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 17 Dec 2015 13:37:07 +0000 -Subject: [PATCH 089/333] hci_h5: Don't send conf_req when ACTIVE +Subject: [PATCH 088/407] hci_h5: Don't send conf_req when ACTIVE Without this patch, a modem and kernel can continuously bombard each other with conf_req and conf_rsp messages, in a demented game of tag. @@ -118041,10 +118013,10 @@ index 0879d64b1caf58afb6e5d494c07d9ab7e7cdf983..5161ab30fd533d50f516bb93d5b9f402 if (H5_HDR_LEN(hdr) > 2) h5->tx_win = (data[2] & 0x07); -From ca6ef19dcfa9c8f8c3e1f33dbecfa9c2aac16f03 Mon Sep 17 00:00:00 2001 +From 9ae679357ddd8e702150ff9bda686b27df8719f7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 17:16:29 +0100 -Subject: [PATCH 090/333] config: Add default configs +Subject: [PATCH 089/407] config: Add default configs --- arch/arm/configs/bcm2709_defconfig | 1297 +++++++++++++++++++++++++++++++++++ @@ -120671,10 +120643,10 @@ index 0000000000000000000000000000000000000000..8acee9f31202ec14f2933d92dd70831c +CONFIG_CRC_ITU_T=y +CONFIG_LIBCRC32C=y -From 2348d2ec0ea2eb5af6431ae59ddc9b0999bdbbc7 Mon Sep 17 00:00:00 2001 +From 089d4722c7e77a3383e4f5cd5ed1225999e958f5 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Wed, 24 Aug 2016 03:35:56 -0700 -Subject: [PATCH 091/333] Add arm64 configuration and device tree differences. +Subject: [PATCH 090/407] Add arm64 configuration and device tree differences. Disable MMC_BCM2835_SDHOST and MMC_BCM2835 since these drivers are crashing at the moment. @@ -122089,10 +122061,10 @@ index 0000000000000000000000000000000000000000..d7406f5a4620151044b8f716b4d10bb8 +CONFIG_LIBCRC32C=y +CONFIG_BCM2708_VCHIQ=n -From 6563a0e08d79311233a7870b5668074ca16bc4b9 Mon Sep 17 00:00:00 2001 +From c54146b8dab8ae1f0f60798a4dbc108cd373f7e7 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 7 Mar 2016 15:05:11 +0000 -Subject: [PATCH 092/333] vchiq_arm: Tweak the logging output +Subject: [PATCH 091/407] vchiq_arm: Tweak the logging output Signed-off-by: Phil Elwell --- @@ -122167,10 +122139,10 @@ index 2c98da4307dff994a00dc246574ef0aaee05d5da..160db24aeea33a8296923501009c1f02 switch (type) { -From c22141c191a3fc668f42e1fbb120b0be266c412e Mon Sep 17 00:00:00 2001 +From df5e8718011cb7b313a59b2c28ae695309ce9604 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 23 Mar 2016 14:16:25 +0000 -Subject: [PATCH 093/333] vchiq_arm: Access the dequeue_pending flag locked +Subject: [PATCH 092/407] vchiq_arm: Access the dequeue_pending flag locked Reading through this code looking for another problem (now found in userland) the use of dequeue_pending outside a lock didn't seem safe. @@ -122228,10 +122200,10 @@ index 7b6cd4d80621e38ff6d47fcd87b45fbe9cd4259b..d8669fa7f39b077877eca1829ba9538b return add_completion(instance, reason, header, user_service, -From dd15e4c2a35e89699c8270b797671d2a9a28ec9d Mon Sep 17 00:00:00 2001 +From 76405a0d157eee6b8e573c81eaab3103c0ff9744 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 23 Mar 2016 20:53:47 +0000 -Subject: [PATCH 094/333] vchiq_arm: Service callbacks must not fail +Subject: [PATCH 093/407] vchiq_arm: Service callbacks must not fail Service callbacks are not allowed to return an error. The internal callback that delivers events and messages to user tasks does not enqueue them if @@ -122257,10 +122229,10 @@ index d8669fa7f39b077877eca1829ba9538bf2e21a82..54552c6ce54f413c9781ba279b936f98 DEBUG_TRACE(SERVICE_CALLBACK_LINE); } -From 40b6b6fcb5dc64a71af330e5357d649e96102ded Mon Sep 17 00:00:00 2001 +From 5020724e0540dd52e48629d29af754fa790968d2 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 21 Apr 2016 13:49:32 +0100 -Subject: [PATCH 095/333] vchiq_arm: Add completion records under the mutex +Subject: [PATCH 094/407] vchiq_arm: Add completion records under the mutex An issue was observed when flushing openmax components which generate a large number of messages returning @@ -122323,10 +122295,10 @@ index 54552c6ce54f413c9781ba279b936f98be4f47b0..bde8955b7d8505d73579b77b5b392154 return VCHIQ_SUCCESS; -From e76614e56511c0afd36234e9f2ca04cbff34611e Mon Sep 17 00:00:00 2001 +From 142747ad6741a60906dbbf4974b89399a42d6b8f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 20 Jun 2016 13:51:44 +0100 -Subject: [PATCH 096/333] vchiq_arm: Avoid use of mutex in add_completion +Subject: [PATCH 095/407] vchiq_arm: Avoid use of mutex in add_completion Claiming the completion_mutex within add_completion did prevent some messages appearing twice, but provokes a deadlock caused by vcsm using @@ -122520,10 +122492,10 @@ index 160db24aeea33a8296923501009c1f02bc41e599..71a3bedc55314f3b22dbff40c05dedf0 up(&state->slot_available_event); } -From 195c40051e64a8f25abce52e7987bbebf594d855 Mon Sep 17 00:00:00 2001 +From 200a8be913ec86a00c7395523cbb4454a5c93ac4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 3 Oct 2016 10:14:10 -0700 -Subject: [PATCH 097/333] staging/vchi: Convert to current get_user_pages() +Subject: [PATCH 096/407] staging/vchi: Convert to current get_user_pages() arguments. Signed-off-by: Eric Anholt @@ -122533,10 +122505,10 @@ Signed-off-by: Eric Anholt 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -index 1091b9f1dd070e3d27c269402b43b0a09d96bcdc..8c7f31f8d39537e7e1c8135271c5f8eea76ed7a0 100644 +index f72eebc71dd83ff3513d374711f8f12912a28d67..809b6a364b09b8383ba62a5d23708251b40734a2 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -@@ -420,7 +420,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, +@@ -426,7 +426,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, *need_release = 0; /* do not try and release vmalloc pages */ } else { down_read(&task->mm->mmap_sem); @@ -122560,10 +122532,10 @@ index e5cdda12c7e5c35c69eb96991cfdb8326def167f..085d37588c59198b4e5f00b9249bb842 num_pages, /* len */ 0, /* gup_flags */ -From fff9c93dd1868aeed2475f7e2b51241cee9a101c Mon Sep 17 00:00:00 2001 +From 1a9a0a2a7f43eb0ff4ff864105fa9181e77eeee7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 3 Oct 2016 10:16:03 -0700 -Subject: [PATCH 098/333] staging/vchi: Update for rename of +Subject: [PATCH 097/407] staging/vchi: Update for rename of page_cache_release() to put_page(). Signed-off-by: Eric Anholt @@ -122573,10 +122545,10 @@ Signed-off-by: Eric Anholt 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -index 8c7f31f8d39537e7e1c8135271c5f8eea76ed7a0..862fabf5682c7dededc8d7ca6773d5b227b72f3c 100644 +index 809b6a364b09b8383ba62a5d23708251b40734a2..5537ca042cba6aca18ba1df2dd130e411a01e632 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -@@ -438,7 +438,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, +@@ -444,7 +444,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, while (actual_pages > 0) { actual_pages--; @@ -122585,7 +122557,7 @@ index 8c7f31f8d39537e7e1c8135271c5f8eea76ed7a0..862fabf5682c7dededc8d7ca6773d5b2 } kfree(pagelist); if (actual_pages == 0) -@@ -577,7 +577,7 @@ free_pagelist(PAGELIST_T *pagelist, int actual) +@@ -585,7 +585,7 @@ free_pagelist(PAGELIST_T *pagelist, int actual) offset = 0; set_page_dirty(pg); } @@ -122608,10 +122580,10 @@ index 085d37588c59198b4e5f00b9249bb8421695854f..5a2b8fb459ebe086ec229f37b6381bdb kfree(pages); } -From b212c09294eec6c5e4d6a3756bdbbddd0403e68d Mon Sep 17 00:00:00 2001 +From f9fab4f4551d1c0c934dcabe1c757b1f545aaabc Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 3 Oct 2016 10:21:17 -0700 -Subject: [PATCH 099/333] drivers/vchi: Remove dependency on CONFIG_BROKEN. +Subject: [PATCH 098/407] drivers/vchi: Remove dependency on CONFIG_BROKEN. The driver builds now. @@ -122633,10 +122605,10 @@ index 9676fb29075a457109e4d4235f086987aec74868..db8e1beb89f9f8c48ea5964016c8285e help Kernel to VideoCore communication interface for the -From ee7caf1e3fbc0cf76ac29f18c64ac85d36a43e39 Mon Sep 17 00:00:00 2001 +From 64c4bd4eb101e1ab07499d756c98baf80857e40d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 14 Sep 2016 09:16:19 +0100 -Subject: [PATCH 100/333] raspberrypi-firmware: Export the general transaction +Subject: [PATCH 099/407] raspberrypi-firmware: Export the general transaction function. The vc4-firmware-kms module is going to be doing the MBOX FB call. @@ -122680,10 +122652,10 @@ index e92278968b2b979db2a1f855f70e7aafb224fa98..09e3d871d110eb0762ebdb5ea3293537 #endif /* __SOC_RASPBERRY_FIRMWARE_H__ */ -From f5ed407b8f36efa2331fd22b96d61a184da4add0 Mon Sep 17 00:00:00 2001 +From c69dc654c06a2def9dc199dae4b45a9eb440e9b5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 14 Sep 2016 09:18:09 +0100 -Subject: [PATCH 101/333] raspberrypi-firmware: Define the MBOX channel in the +Subject: [PATCH 100/407] raspberrypi-firmware: Define the MBOX channel in the header. Signed-off-by: Eric Anholt @@ -122705,10 +122677,10 @@ index 09e3d871d110eb0762ebdb5ea329353738d58661..2859db09e25bb945251e85edb39bc434 enum rpi_firmware_property_status { -From ed84fdbc0541b4db35d4439ebef876cab177a146 Mon Sep 17 00:00:00 2001 +From 5ee3ef420c7be788791a09fb9ede9696fea1df49 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 14 Sep 2016 08:39:33 +0100 -Subject: [PATCH 102/333] drm/vc4: Add a mode for using the closed firmware for +Subject: [PATCH 101/407] drm/vc4: Add a mode for using the closed firmware for display. Signed-off-by: Eric Anholt @@ -123475,10 +123447,10 @@ index 0000000000000000000000000000000000000000..d18a1dae51a2275846c9826b5bf1ba57 + }, +}; -From d4795eafd0d9335ef0bb03a84a743630b93f6adc Mon Sep 17 00:00:00 2001 +From fb83cc90847015b83189e132c2b82c9d42842a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 23 Sep 2016 18:24:38 +0200 -Subject: [PATCH 103/333] i2c: bcm2835: Protect against unexpected TXW/RXR +Subject: [PATCH 102/407] i2c: bcm2835: Protect against unexpected TXW/RXR interrupts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -123603,10 +123575,10 @@ index f283b714aa79e2e4685ed95b04b6b289f7e9eee7..d2ba1a4de36af512e8e3c97251bd3537 return -ETIMEDOUT; } -From e2ff260264aef0344ae3cd776466a6fbd7941378 Mon Sep 17 00:00:00 2001 +From e53ea8840d3240f46040f5bfd9c4b51ebd0039f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Mon, 19 Sep 2016 17:19:41 +0200 -Subject: [PATCH 104/333] i2c: bcm2835: Use dev_dbg logging on transfer errors +Subject: [PATCH 103/407] i2c: bcm2835: Use dev_dbg logging on transfer errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -123638,10 +123610,10 @@ index d2ba1a4de36af512e8e3c97251bd3537ae61591a..54d510abd46a117c9238fc6d7edec840 if (i2c_dev->msg_err & BCM2835_I2C_S_ERR) return -EREMOTEIO; -From fc3a911952bad60e4e8085ea4b946ca68d9b1e65 Mon Sep 17 00:00:00 2001 +From 0fa7edeb9fdbc11e288c3271ad24579a9f3b3adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 22 Sep 2016 22:05:50 +0200 -Subject: [PATCH 105/333] i2c: bcm2835: Can't support I2C_M_IGNORE_NAK +Subject: [PATCH 104/407] i2c: bcm2835: Can't support I2C_M_IGNORE_NAK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -123685,10 +123657,10 @@ index 54d510abd46a117c9238fc6d7edec84019d1f60d..565ef69ce61423544dc0558c85ef318b if (i2c_dev->msg_err & BCM2835_I2C_S_ERR) -From d3471f1468b1298552273ea26bc5f692d37dbce8 Mon Sep 17 00:00:00 2001 +From 9f88578ea7178421cd974f03b91586b674103a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 23 Sep 2016 04:54:27 +0200 -Subject: [PATCH 106/333] i2c: bcm2835: Add support for Repeated Start +Subject: [PATCH 105/407] i2c: bcm2835: Add support for Repeated Start Condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -123870,10 +123842,10 @@ index 565ef69ce61423544dc0558c85ef318b0ae9c324..241e08ae7c27cec23fad3c1bf3ebad3a static u32 bcm2835_i2c_func(struct i2c_adapter *adap) -From 1529a6f05233bd956e8a9b635bd03a14f5aa854f Mon Sep 17 00:00:00 2001 +From ddd4a5251807ae4111ff4414be991acebd84440c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 23 Sep 2016 04:57:17 +0200 -Subject: [PATCH 107/333] i2c: bcm2835: Support i2c-dev ioctl I2C_TIMEOUT +Subject: [PATCH 106/407] i2c: bcm2835: Support i2c-dev ioctl I2C_TIMEOUT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -123910,10 +123882,10 @@ index 241e08ae7c27cec23fad3c1bf3ebad3a4d2a8e6f..d2085dd3742eabebc537621968088261 bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, BCM2835_I2C_C_CLEAR); -From 9bd9738412c734572e8eb84823fd1455b830a16b Mon Sep 17 00:00:00 2001 +From 769299f418be7ea8de653f62372f44b0db0cb629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 27 Sep 2016 01:00:08 +0200 -Subject: [PATCH 108/333] i2c: bcm2835: Add support for dynamic clock +Subject: [PATCH 107/407] i2c: bcm2835: Add support for dynamic clock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -124029,10 +124001,10 @@ index d2085dd3742eabebc537621968088261f8dc7ea8..c3436f627028477f7e21b47e079fd5ab irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!irq) { -From 81cd88dfbb483f9f9a22128136234caf119617f5 Mon Sep 17 00:00:00 2001 +From 7d589a187405118555041ad88934a27aed4d00d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 1 Nov 2016 15:15:41 +0100 -Subject: [PATCH 109/333] i2c: bcm2835: Add debug support +Subject: [PATCH 108/407] i2c: bcm2835: Add debug support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -124221,10 +124193,10 @@ index c3436f627028477f7e21b47e079fd5ab06ec188a..8642f580ce41803bd22c76a0fa80d083 if (i2c_dev->msg_err & BCM2835_I2C_S_ERR) return -EREMOTEIO; -From 6f8de955b8c941a35751433e2474196aa321af89 Mon Sep 17 00:00:00 2001 +From 29b3bbea51b7ee1540a01b2ce034e0f064435eb1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 31 Dec 2016 14:15:50 +0000 -Subject: [PATCH 110/333] arm64: Add CONFIG_ARCH_BCM2835 +Subject: [PATCH 109/407] arm64: Add CONFIG_ARCH_BCM2835 --- arch/arm64/configs/bcmrpi3_defconfig | 1 + @@ -124240,10 +124212,10 @@ index d7406f5a4620151044b8f716b4d10bb818648e06..53da5c7a33e5898a66e549fb0c39fe3d CONFIG_BCM2708_VCHIQ=n +CONFIG_ARCH_BCM2835=y -From c4fa4640c5e8a2d2ad0d5761732e8cf48ed66373 Mon Sep 17 00:00:00 2001 +From b5329e81ab48f04e7da61211c1859137e7fdb10f Mon Sep 17 00:00:00 2001 From: Alex Tucker Date: Tue, 13 Dec 2016 19:50:18 +0000 -Subject: [PATCH 111/333] Add support for Silicon Labs Si7013/20/21 +Subject: [PATCH 110/407] Add support for Silicon Labs Si7013/20/21 humidity/temperature sensor. --- @@ -124318,10 +124290,10 @@ index f6d134c095af2398fc55ae7d2b0e86456c30627c..31bda8da4cb6a56bfe493a81b9189009 }; }; -From a00d2bd6882f19181fdb175edac08f16c2eb4593 Mon Sep 17 00:00:00 2001 +From 5c30317565d85b52c0e676532e7be0a95700be33 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 3 Jan 2017 21:27:46 +0000 -Subject: [PATCH 112/333] Document the si7020 option +Subject: [PATCH 111/407] Document the si7020 option --- arch/arm/boot/dts/overlays/README | 3 +++ @@ -124342,10 +124314,10 @@ index 81d991803be335e5a1bc3bb0a8c7a2c9f5c392bd..e8fa4ccb44c34a20485c4e6155467af9 Name: i2c0-bcm2708 Info: Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations -From f1a44ab25cd089964034fa86e1c7cbaa8aea5a6f Mon Sep 17 00:00:00 2001 +From 1f21d72df5116fa4de994d8f51626db9227099d5 Mon Sep 17 00:00:00 2001 From: Giedrius Trainavicius Date: Thu, 5 Jan 2017 02:38:16 +0200 -Subject: [PATCH 113/333] pisound improvements: +Subject: [PATCH 112/407] pisound improvements: * Added a writable sysfs object to enable scripts / user space software to blink MIDI activity LEDs for variable duration. @@ -124639,10 +124611,10 @@ index 4b8545487d06e4ea70073a5d063fb2310b3b94d0..ba70734b89e61a11201657406223f0b3 }; -From 448b1a0e81e82e70c2182a3e94ee3d02b71f9b48 Mon Sep 17 00:00:00 2001 +From 719dd6e2c86f077276b860ebc8f0ebd5bfe89dfc Mon Sep 17 00:00:00 2001 From: Aaron Shaw Date: Tue, 10 Jan 2017 16:05:41 +0000 -Subject: [PATCH 114/333] Add driver_name property +Subject: [PATCH 113/407] Add driver_name property Add driver name property for use with 5.1 passthrough audio in LibreElec and other Kodi based OSs --- @@ -124662,10 +124634,10 @@ index 8fd50dbe681508a2cfe8fdde1c9fedbe9a507fa7..05a224ec712d06b8b7587ab6b8bb562d .dai_link = snd_rpi_justboom_dac_dai, .num_links = ARRAY_SIZE(snd_rpi_justboom_dac_dai), -From eeb663b6aa7f0f5d07b245e2c9b26e456bcc2f34 Mon Sep 17 00:00:00 2001 +From 9e7d52c10001ca436497c761628271c818d8431b Mon Sep 17 00:00:00 2001 From: Aaron Shaw Date: Tue, 10 Jan 2017 16:11:04 +0000 -Subject: [PATCH 115/333] Add driver_name paramater +Subject: [PATCH 114/407] Add driver_name paramater Add driver_name parameter for use with 5.1 passthrough audio in LibreElec and other Kodi OSs --- @@ -124685,10 +124657,10 @@ index 91acb666380faa3c0deb2230f8a0f8bbec59417b..abfdc5c4dd5811e6847bddda4921abe3 .dai_link = snd_rpi_justboom_digi_dai, .num_links = ARRAY_SIZE(snd_rpi_justboom_digi_dai), -From 3451b0775c378379274e0baa903ebe8182dc74a9 Mon Sep 17 00:00:00 2001 +From 3a2a79e7a9d82f8d17708732d57f0e943d5faaf0 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 11 Jan 2017 13:01:21 +0000 -Subject: [PATCH 116/333] BCM270X_DT: Add pi3-disable-wifi overlay +Subject: [PATCH 115/407] BCM270X_DT: Add pi3-disable-wifi overlay pi3-disable-wifi is a minimal overlay to disable the onboard WiFi. @@ -124749,10 +124721,10 @@ index 0000000000000000000000000000000000000000..017199554bf2f4e381efcc7bb71e750c + }; +}; -From f184fb5a4b6fd0cd06ee9935c6e796b374173379 Mon Sep 17 00:00:00 2001 +From 20d188b5cad62e4e971a004a142cc4c893fff200 Mon Sep 17 00:00:00 2001 From: Electron752 Date: Thu, 12 Jan 2017 07:07:08 -0800 -Subject: [PATCH 117/333] ARM64: Make it work again on 4.9 (#1790) +Subject: [PATCH 116/407] ARM64: Make it work again on 4.9 (#1790) * Invoke the dtc compiler with the same options used in arm mode. * ARM64 now uses the bcm2835 platform just like ARM32. @@ -125157,10 +125129,10 @@ index 53da5c7a33e5898a66e549fb0c39fe3da555ca87..c7e891d72969a388d9b135a36dbfc9c9 -CONFIG_BCM2708_VCHIQ=n -CONFIG_ARCH_BCM2835=y -From 23aebae09cb04f3ff9d4ff48d83f7fe851edad69 Mon Sep 17 00:00:00 2001 +From 11ad54dd8b141f9ec1f6acacb640f33d2f04e524 Mon Sep 17 00:00:00 2001 From: Electron752 Date: Sat, 14 Jan 2017 02:54:26 -0800 -Subject: [PATCH 118/333] ARM64: Enable Kernel Address Space Randomization +Subject: [PATCH 117/407] ARM64: Enable Kernel Address Space Randomization (#1792) Randomization allows the mapping between virtual addresses and physical @@ -125192,10 +125164,10 @@ index c7e891d72969a388d9b135a36dbfc9c9cb609bf8..974d8889c0cf695eb88b57bbef11bc5a CONFIG_BINFMT_MISC=y CONFIG_COMPAT=y -From 9889f9addf81b0d08c7fff7a274846cd1276d68e Mon Sep 17 00:00:00 2001 +From 578118c6fc5f841bdeee082ebadb04e75d728cc1 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sun, 15 Jan 2017 07:31:59 -0800 -Subject: [PATCH 119/333] ARM64: Enable RTL8187/RTL8192CU wifi in build config +Subject: [PATCH 118/407] ARM64: Enable RTL8187/RTL8192CU wifi in build config These drivers build now, so they can be enabled back in the build configuration just like they are for @@ -125220,10 +125192,10 @@ index 974d8889c0cf695eb88b57bbef11bc5aa556b635..4670a490dfb1e582ec24a3b39a3cb9b2 CONFIG_ZD1211RW=m CONFIG_MAC80211_HWSIM=m -From dd798f4f4ad2f1031ad448ebdd9baef3ec381c8f Mon Sep 17 00:00:00 2001 +From f169651ccbdb2656ceb55f70679d0b67aa5ea296 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 16 Jan 2017 14:53:12 +0000 -Subject: [PATCH 120/333] BCM270X_DT: Add spi0-cs overlay +Subject: [PATCH 119/407] BCM270X_DT: Add spi0-cs overlay The spi0-cs overlay allows the software chip selectts to be modified using the cs0_pin and cs1_pin parameters. @@ -125311,10 +125283,10 @@ index 0000000000000000000000000000000000000000..7f79029d043c04d7496c7c3480450c69 + }; +}; -From 8eb8b66da62ddfb52120d259f94ccda7ec714e53 Mon Sep 17 00:00:00 2001 +From 7cd193931052631cf9378f4e59ef0b48ff622dbf Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 1 Jul 2016 22:09:24 +0100 -Subject: [PATCH 121/333] spi-bcm2835: Disable forced software CS +Subject: [PATCH 120/407] spi-bcm2835: Disable forced software CS Select software CS in bcm2708_common.dtsi, and disable the automatic conversion in the driver to allow hardware CS to be re-enabled with an @@ -125340,10 +125312,10 @@ index 74dd21b7373c7564ede01d84a4f63b93a6d52fa7..51cdefbf5eb265f49bd05e0aa91dfbee i2c0: i2c@7e205000 { -From ad85240f90077374dbe3975da2e31a10895947b2 Mon Sep 17 00:00:00 2001 +From 75f7db2e412040eb2efa788547d89d086124f168 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 16 Jan 2017 16:33:54 +0000 -Subject: [PATCH 122/333] config: Add CONFIG_TCP_CONG_BBR See: +Subject: [PATCH 121/407] config: Add CONFIG_TCP_CONG_BBR See: https://github.com/raspberrypi/linux/issues/1784 --- @@ -125378,10 +125350,10 @@ index 8acee9f31202ec14f2933d92dd70831cda8d7b51..219f67051a2542329449b0099165ae28 CONFIG_IPV6_ROUTER_PREF=y CONFIG_INET6_AH=m -From f669453f84859c8f08763482f1d58f4019c3c790 Mon Sep 17 00:00:00 2001 +From 1a98ebf0d14b6b9a305f5e79ed0648f2dfa5142b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 17 Jan 2017 11:34:58 +0000 -Subject: [PATCH 123/333] BCM270X_DT: Enable UART0 on CM3 +Subject: [PATCH 122/407] BCM270X_DT: Enable UART0 on CM3 Signed-off-by: Phil Elwell --- @@ -125404,10 +125376,10 @@ index 41874c25a84226c0e4af92ec4059e0a571fe6123..3ba6e621856c288ae4694f758604619f sdhost_pins: sdhost_pins { brcm,pins = <48 49 50 51 52 53>; -From 15535ce57b3206fef72815a6aa78f46b78145550 Mon Sep 17 00:00:00 2001 +From cf5f1160312e37733e96d67df9d4cc3d1eb41486 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 17 Jan 2017 14:39:39 +0000 -Subject: [PATCH 124/333] config: Add CONFIG_MD_M25P80 and CONFIG_MD_SPI_NOR +Subject: [PATCH 123/407] config: Add CONFIG_MD_M25P80 and CONFIG_MD_SPI_NOR See: https://github.com/raspberrypi/linux/issues/1781 @@ -125446,10 +125418,10 @@ index 219f67051a2542329449b0099165ae2885022bec..c4898d63d74718097ec3a1d1fe60b230 CONFIG_OF_CONFIGFS=y CONFIG_ZRAM=m -From 30e2fd09549061c987740eaff01deba07aab030b Mon Sep 17 00:00:00 2001 +From ab4819fc5ca5012a552aa0fd690c9e1771687ba1 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sat, 14 Jan 2017 21:33:51 -0800 -Subject: [PATCH 125/333] ARM64/DWC_OTG: Port dwc_otg driver to ARM64 +Subject: [PATCH 124/407] ARM64/DWC_OTG: Port dwc_otg driver to ARM64 In ARM64, the FIQ mechanism used by this driver is not current implemented. As a workaround, reqular IRQ is used instead @@ -125792,10 +125764,10 @@ index 6b2c7d0c93f36a63863ff4b0ecc1f3eab77e058b..d7b700ff17821ad1944e36721fe6b2db /** The OS page size */ #define DWC_OS_PAGE_SIZE PAGE_SIZE -From 4dd2d8a6fcc36b2c928676f4408e47a2d5936e03 Mon Sep 17 00:00:00 2001 +From 22ea39a490878318019146d05d5df1e664ea9f93 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sat, 14 Jan 2017 21:43:57 -0800 -Subject: [PATCH 126/333] ARM64: Round-Robin dispatch IRQs between CPUs. +Subject: [PATCH 125/407] ARM64: Round-Robin dispatch IRQs between CPUs. IRQ-CPU mapping is round robined on ARM64 to increase concurrency and allow multiple interrupts to be serviced @@ -125869,10 +125841,10 @@ index 93e3f7660c4230c9f1dd3b195958cb498949b0ca..486bcbfb32305ee417f6b3be7e91a3ff .name = "bcm2836-gpu", .irq_mask = bcm2836_arm_irqchip_mask_gpu_irq, -From ae53979036faba344d693380d4fba83ff48e308a Mon Sep 17 00:00:00 2001 +From e14f5c0663023eff96b84f01a6d2e7cb2768c25a Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sat, 14 Jan 2017 21:45:03 -0800 -Subject: [PATCH 127/333] ARM64: Enable DWC_OTG Driver In ARM64 Build +Subject: [PATCH 126/407] ARM64: Enable DWC_OTG Driver In ARM64 Build Config(bcmrpi3_defconfig) Signed-off-by: Michael Zoran @@ -125893,10 +125865,10 @@ index 4670a490dfb1e582ec24a3b39a3cb9b2488b1864..8c4392344eb4495689c220d5d176ee8c CONFIG_USB_STORAGE=y CONFIG_USB_STORAGE_REALTEK=m -From a57403fd7164bd56c0e21ce7786aec7000d2c26b Mon Sep 17 00:00:00 2001 +From b3748bd7f60b593b8ff504da269a0217526b01ce Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sat, 14 Jan 2017 21:46:04 -0800 -Subject: [PATCH 128/333] ARM64: Use dwc_otg driver by default for USB. +Subject: [PATCH 127/407] ARM64: Use dwc_otg driver by default for USB. If it breaks on anybody, they can use the standard device tree overlays to switch back to the dwc2 driver. @@ -125922,10 +125894,10 @@ index f6def5d7e5d622cf09e8f87332c7374fe28da08b..3e134a1208610b90e2d0fc22f03c6e9f -}; -#endif -From f09f062c3080593bdc97b382de02b81c3a2ce139 Mon Sep 17 00:00:00 2001 +From 8e884b232567aa6ebc96cfc97dfb0932846c2e8a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 23 Jan 2017 17:36:50 +0000 -Subject: [PATCH 129/333] BCM270X_DT: Add reference to audio_pins to CM dtb +Subject: [PATCH 128/407] BCM270X_DT: Add reference to audio_pins to CM dtb The CM1 dtb contains an empty audio_pins node, but no reference to it. Adding the usual pinctrl reference from the audio node enables the @@ -125953,10 +125925,10 @@ index eb8662f0d222b4c0a9a2bcb8bccb13e86a0006b3..10be69972bd1440f574e35d515f3d6a0 hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; }; -From 9a9271703c6c484961d3e9cb4cd27f7d85114b77 Mon Sep 17 00:00:00 2001 +From 2f051b7ece8201d5fd71dec10542fc5ef1d1b18a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 25 Jan 2017 11:30:38 +0000 -Subject: [PATCH 130/333] config: Add additional network scheduling modules +Subject: [PATCH 129/407] config: Add additional network scheduling modules --- arch/arm/configs/bcm2709_defconfig | 4 ++++ @@ -126008,10 +125980,10 @@ index c4898d63d74718097ec3a1d1fe60b2307a6a3140..b448eaa866c200f48351819072c7fefc CONFIG_NET_SCH_PLUG=m CONFIG_NET_CLS_BASIC=m -From 35c38d158eb6c9396b684a013fc311ce4d2d34d0 Mon Sep 17 00:00:00 2001 +From b286821e3df6b2deb3d2ca957e66f821112ace76 Mon Sep 17 00:00:00 2001 From: chris johnson Date: Sun, 22 Jan 2017 03:27:31 +0000 -Subject: [PATCH 131/333] ASoC: A simple-card overlay for ADAU7002 +Subject: [PATCH 130/407] ASoC: A simple-card overlay for ADAU7002 Usage: `dtoverlay=adau7002-simple` --- @@ -126109,10 +126081,10 @@ index 0000000000000000000000000000000000000000..e67e6625d7967abc92cf00cb604d4c12 + }; +}; -From 4513fd91e410b9626b8775732cd440f2799df6db Mon Sep 17 00:00:00 2001 +From 3aac88fb104525297282441ac1f7fee8ed858e4e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 25 Jan 2017 21:17:23 +0000 -Subject: [PATCH 132/333] config: Add SND_SOC_ADAU7002 codec module +Subject: [PATCH 131/407] config: Add SND_SOC_ADAU7002 codec module As there is now an overlay requiring it, build the codec module. @@ -126147,10 +126119,10 @@ index b448eaa866c200f48351819072c7fefcd8ad8132..5105a592c9bcfee1cc6a8b50fd1c6c32 CONFIG_SND_SOC_WM8804_I2C=m CONFIG_SND_SIMPLE_CARD=m -From ce41f5282b6f4b01f8f07d6c018a37882ee07168 Mon Sep 17 00:00:00 2001 +From 5ece6fd836f5e6aa82c34c2d7d03ef362028c642 Mon Sep 17 00:00:00 2001 From: Scott Ellis Date: Fri, 27 Jan 2017 06:42:42 -0500 -Subject: [PATCH 133/333] Add overlay for mcp3008 adc (#1818) +Subject: [PATCH 132/407] Add overlay for mcp3008 adc (#1818) Some example usage: @@ -126436,10 +126408,10 @@ index 0000000000000000000000000000000000000000..06bf4264959c380d8a9f90f74e780397 + }; +}; -From a14d25b106b231228302f8111189eafc6a2b7f9b Mon Sep 17 00:00:00 2001 +From d047f035a6019a53fb48b1391bf34b79045bed13 Mon Sep 17 00:00:00 2001 From: ED6E0F17 Date: Fri, 3 Feb 2017 14:52:42 +0000 -Subject: [PATCH 134/333] usb: dwc2: Avoid suspending if we're in gadget mode +Subject: [PATCH 133/407] usb: dwc2: Avoid suspending if we're in gadget mode (#1825) I've found when booting HiKey with the usb gadget cable attached @@ -126491,10 +126463,10 @@ index df5a065780054f21841ca9f08b8ab118922c530b..619ccfe1eafc4643b16970f8a1129ff9 goto skip_power_saving; -From 67495276b108df918fe42e96c2f05f43fefbfb63 Mon Sep 17 00:00:00 2001 +From 98331706fbd73e02e23d85d60f83fb405786e943 Mon Sep 17 00:00:00 2001 From: JamesH65 Date: Mon, 6 Feb 2017 15:24:47 +0000 -Subject: [PATCH 135/333] gpio_mem: Remove unnecessary dev_info output (#1830) +Subject: [PATCH 134/407] gpio_mem: Remove unnecessary dev_info output (#1830) The open function was spamming syslog every time called, so have removed call completely. @@ -126516,10 +126488,10 @@ index 911f5b7393ed48ceed8751f06967ae6463453f9c..f5e7f1ba8fb6f18dee77fad06a17480c dev_err(inst->dev, "Unknown minor device: %d", dev); ret = -ENXIO; -From fbcad54e77f3066ae9534f07e39541e2166b1b17 Mon Sep 17 00:00:00 2001 +From a63b17f579fafc50c33f36a6ec77f07a1bdccfb6 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 22 Jan 2017 12:49:36 +0100 -Subject: [PATCH 136/333] config: Enable regulator support +Subject: [PATCH 135/407] config: Enable regulator support Signed-off-by: Matthias Reichl --- @@ -126554,10 +126526,10 @@ index 5105a592c9bcfee1cc6a8b50fd1c6c32f1381158..74bc0d81bcb4d7f6676368926cdcc10e CONFIG_MEDIA_CAMERA_SUPPORT=y CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -From ddc4f69ea847898ce9782abc61640cbfc28d3c24 Mon Sep 17 00:00:00 2001 +From 71439e02a4d54f858b6c088657e1d5d7fb61d45a Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 22 Jan 2017 12:49:36 +0100 -Subject: [PATCH 137/333] BCM270x DT: expose 3.3V and 5V system rails +Subject: [PATCH 136/407] BCM270x DT: expose 3.3V and 5V system rails Signed-off-by: Matthias Reichl --- @@ -126590,10 +126562,10 @@ index a46cb4a8b1419edd95e0e07c18b0f373222dc2bf..36d853715f2379e1952ce3d3be58dd67 + }; }; -From b289a31002b3a3974bdd2701d338a75116525efc Mon Sep 17 00:00:00 2001 +From 81c296070600095a9d4b772b17989670008562a9 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 22 Jan 2017 12:49:36 +0100 -Subject: [PATCH 138/333] BCM270x DT: Consolidate audio card overlays +Subject: [PATCH 137/407] BCM270x DT: Consolidate audio card overlays Reference 3.3V / 5V system rails instead of instantiating local regulators. @@ -126888,10 +126860,10 @@ index 16b1247bfa618ff85936ddf78c3aea58075eaa67..f8d48233e28c7c18509b4a95692f6aff __overlay__ { compatible = "rra,digidac1-soundcard"; -From fdfaf6f6ae997b67b6f29ccdaccfecb3bc0acede Mon Sep 17 00:00:00 2001 +From 874a59615acb13409ab6f694880f17ed21c1f604 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 22 Jan 2017 12:49:37 +0100 -Subject: [PATCH 139/333] ASoC: Add driver for Cirrus Logic Audio Card +Subject: [PATCH 138/407] ASoC: Add driver for Cirrus Logic Audio Card Note: due to problems with deferred probing of regulators the following softdep should be added to a modprobe.d file @@ -128141,10 +128113,10 @@ index 0000000000000000000000000000000000000000..ac8651ddff7bd3701dffe22c7fb88352 +MODULE_DESCRIPTION("ASoC driver for Cirrus Logic Audio Card"); +MODULE_LICENSE("GPL"); -From ecdcc87a89eb054185e088896962dcce267af5d7 Mon Sep 17 00:00:00 2001 +From 7c82eb9cd99a9efb435e5f2ce9caf108727adf28 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 22 Jan 2017 12:49:37 +0100 -Subject: [PATCH 140/333] config: enable Cirrus Logic Audio Card +Subject: [PATCH 139/407] config: enable Cirrus Logic Audio Card Signed-off-by: Matthias Reichl --- @@ -128193,10 +128165,10 @@ index 74bc0d81bcb4d7f6676368926cdcc10e581fbcae..f0b87d15e959d88eb26e5a11244365da CONFIG_SND_BCM2708_SOC_RPI_PROTO=m CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m -From f8af32a41f506e8b1b86527d40bb479ed03c3697 Mon Sep 17 00:00:00 2001 +From 4bf34aa99d4a32ca056a2b12a22f4ae274f142ac Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 9 Feb 2017 14:33:30 +0000 -Subject: [PATCH 141/333] irq-bcm2836: Avoid "Invalid trigger warning" +Subject: [PATCH 140/407] irq-bcm2836: Avoid "Invalid trigger warning" Initialise the level for each IRQ to avoid a warning from the arm arch timer code. @@ -128220,10 +128192,10 @@ index 486bcbfb32305ee417f6b3be7e91a3ff069a586c..e10597c1a1e51e5e27aa574b6a26d871 static void -From 3b243945989186dbf9c0be7f01baf8ac10f980c9 Mon Sep 17 00:00:00 2001 +From 02f8fa0c7505d04bceb99c291afb497479f08d4b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 9 Feb 2017 14:36:44 +0000 -Subject: [PATCH 142/333] sound: Demote deferral errors to INFO level +Subject: [PATCH 141/407] sound: Demote deferral errors to INFO level At present there is no mechanism to specify driver load order, which can lead to deferrals and repeated retries until successful. @@ -128258,10 +128230,10 @@ index 4e3de566809c6b4776415482490ff80df2003351..d83f645de9ef60a05c6b8bb44bb2ae85 goto _err_defer; } -From c2b96b9c9b856b80baaadcbf0ba3417482bc2e3e Mon Sep 17 00:00:00 2001 +From 64a3dce4255f64306c75ac80b3d6acf38b2fd7a3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 9 Feb 2017 14:40:33 +0000 -Subject: [PATCH 143/333] sound: Suppress error message about deferrals +Subject: [PATCH 142/407] sound: Suppress error message about deferrals Since driver load deferrals are expected and will already have resulted in a kernel message, suppress an essentially @@ -128508,10 +128480,10 @@ index 9db678e885efd63d84d60a098a84ed6772b19a2d..fadbfade100228aaafabb0d3bdf35c01 return ret; } -From fcbfa6ac4dc09ba4690da779ca17917dfa712e0c Mon Sep 17 00:00:00 2001 +From 138fbe4304ec28007b9d22bf6483cd77a8d156fe Mon Sep 17 00:00:00 2001 From: Claggy3 Date: Sat, 11 Feb 2017 14:00:30 +0000 -Subject: [PATCH 144/333] Update vfpmodule.c +Subject: [PATCH 143/407] Update vfpmodule.c Christopher Alexander Tobias Schulze - May 2, 2015, 11:57 a.m. This patch fixes a problem with VFP state save and restore related @@ -128648,10 +128620,10 @@ index da0b33deba6d3c2906eef271f253ab7a30a92680..c6f1d6da808cda78a58f184e19e83522 /* * Save the userland NEON/VFP state. Under UP, -From 6e4267e73af495e16f5f25cb189a3a863c02a861 Mon Sep 17 00:00:00 2001 +From 95640bee1c031b655d6ddfa5908e016e643b786b Mon Sep 17 00:00:00 2001 From: Martin Cerveny Date: Mon, 13 Feb 2017 17:23:47 +0100 -Subject: [PATCH 145/333] dwc_otg: fix summarize urb->actual_length for +Subject: [PATCH 144/407] dwc_otg: fix summarize urb->actual_length for isochronous transfers Kernel does not copy input data of ISO transfers to userspace @@ -128679,10 +128651,10 @@ index 162a656501988e56c9d780b7793d365fde09f801..992269d61ecf48126379a38e528f7190 dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_urb, i); } -From 463b7dfa83259cc9901a174ae3d94065c17db89a Mon Sep 17 00:00:00 2001 +From aee20a4b1fac81d93cddcfc057d3926bee5fc51f Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 1 Dec 2016 22:00:19 +0100 -Subject: [PATCH 146/333] clk: bcm: Support rate change propagation on bcm2835 +Subject: [PATCH 145/407] clk: bcm: Support rate change propagation on bcm2835 clocks Some peripheral clocks, like the VEC (Video EnCoder) clock need to be set @@ -128807,10 +128779,10 @@ index a99ccf9f056d3a3e7c482339e08483f3701ebc04..dafaa6b22724ab41dac1327cfa81de09 init.ops = &bcm2835_vpu_clock_clk_ops; } else { -From f4ef8c2c6049fab1399aafe73f619212bd66bece Mon Sep 17 00:00:00 2001 +From d3b08f7e205161eac205e3fa1722ea140a3ab1db Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 1 Dec 2016 22:00:20 +0100 -Subject: [PATCH 147/333] clk: bcm: Allow rate change propagation to PLLH_AUX +Subject: [PATCH 146/407] clk: bcm: Allow rate change propagation to PLLH_AUX on VEC clock The VEC clock requires needs to be set at exactly 108MHz. Allow rate @@ -128845,10 +128817,10 @@ index dafaa6b22724ab41dac1327cfa81de09908a4dfd..0453d7c6a63923370e4191db2c4d083b /* dsi clocks */ [BCM2835_CLOCK_DSI0E] = REGISTER_PER_CLK( -From 434c023fcae46c254747d31f92362560d15006b7 Mon Sep 17 00:00:00 2001 +From 5fbb29f27f6858ae4dd488a4a3212ab835e72a1e Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Mon, 12 Dec 2016 09:00:53 +0100 -Subject: [PATCH 148/333] clk: bcm: Fix 'maybe-uninitialized' warning in +Subject: [PATCH 147/407] clk: bcm: Fix 'maybe-uninitialized' warning in bcm2835_clock_choose_div_and_prate() best_rate is reported as potentially uninitialized by gcc. @@ -128877,10 +128849,10 @@ index 0453d7c6a63923370e4191db2c4d083b893b3b47..9d895726ebb24bc78a2014870dbdd7c7 struct clk_hw *parent; -From 6adb20ed4f3eeb23885d34ee0968d7fee4954819 Mon Sep 17 00:00:00 2001 +From 911bf67fed2dca7df50716028979399836730eea Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Jan 2017 07:31:55 +1100 -Subject: [PATCH 149/333] clk: bcm2835: Don't rate change PLLs on behalf of DSI +Subject: [PATCH 148/407] clk: bcm2835: Don't rate change PLLs on behalf of DSI PLL dividers. Our core PLLs are intended to be configured once and left alone. With @@ -129052,10 +129024,10 @@ index 9d895726ebb24bc78a2014870dbdd7c779cd1cdf..b58cff2756581ba7e0be8a818cdbdf72 /* the clocks */ -From b82b8915eecba54c8e4593d78a40b9ee811d0ca7 Mon Sep 17 00:00:00 2001 +From b503261deb2448610bdd5bedf8e5563afccd5d68 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Jan 2017 07:31:56 +1100 -Subject: [PATCH 150/333] clk: bcm2835: Register the DSI0/DSI1 pixel clocks. +Subject: [PATCH 149/407] clk: bcm2835: Register the DSI0/DSI1 pixel clocks. The DSI pixel clocks are muxed from clocks generated in the analog phy by the DSI driver. In order to set them as parents, we need to do the @@ -129297,10 +129269,10 @@ index 360e00cefd35679b49890234b5c369fb52b89e20..a0c812b0fa391d149b4f546db39bdc4b +#define BCM2835_CLOCK_DSI0P 49 +#define BCM2835_CLOCK_DSI1P 50 -From d80c8de54e6f77084e312e42a426981607432732 Mon Sep 17 00:00:00 2001 +From 60547f6862479895b25468cb49644657c0266377 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Jan 2017 07:31:57 +1100 -Subject: [PATCH 151/333] clk: bcm2835: Add leaf clock measurement support, +Subject: [PATCH 150/407] clk: bcm2835: Add leaf clock measurement support, disabled by default This proved incredibly useful during debugging of the DSI driver, to @@ -129646,10 +129618,10 @@ index b2c277b378ee799a4f8e05ad076d1253e85cb392..136e5d28f9eaeaa10d45382a0f31da9f /* the gates */ -From cd0a65c4a6040ce6b78002c5082d2b627bce3465 Mon Sep 17 00:00:00 2001 +From d416327a55ba5a7a85a9aebe798617d12d92fd86 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 26 Apr 2016 13:46:13 -0700 -Subject: [PATCH 152/333] drm/panel: Add support for the Raspberry Pi 7" +Subject: [PATCH 151/407] drm/panel: Add support for the Raspberry Pi 7" Touchscreen. This driver communicates with the Atmel microcontroller for sequencing @@ -130230,10 +130202,10 @@ index 0000000000000000000000000000000000000000..1a536fe4d040f5fafe324baee110a622 +MODULE_DESCRIPTION("Raspberry Pi 7-inch touchscreen driver"); +MODULE_LICENSE("GPL v2"); -From 2dbd7082c50fe13152aa0a336c274f3a0fd71221 Mon Sep 17 00:00:00 2001 +From 094ea60f70d5b872209922e6e8a7ba5dbc43cb16 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 2 Jun 2016 12:29:45 -0700 -Subject: [PATCH 153/333] BCM270X: Add the DSI panel to the defconfig. +Subject: [PATCH 152/407] BCM270X: Add the DSI panel to the defconfig. Signed-off-by: Eric Anholt --- @@ -130282,10 +130254,10 @@ index 8c4392344eb4495689c220d5d176ee8c189079fd..301611d2283f5f8800339271cea59aed CONFIG_DRM_VC4=m CONFIG_FB=y -From 42d4686afac4874fe1e77c9a46f17f58e2851310 Mon Sep 17 00:00:00 2001 +From 18c24e31a56cb983ad121f24a9bff95313420f5f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 13 Dec 2016 15:15:10 -0800 -Subject: [PATCH 154/333] ARM: bcm2835: dt: Add the DSI module nodes and +Subject: [PATCH 153/407] ARM: bcm2835: dt: Add the DSI module nodes and clocks. The modules stay disabled by default, and if you want to enable DSI @@ -130389,10 +130361,10 @@ index 51cdefbf5eb265f49bd05e0aa91dfbeee3fbfdcc..41776b97b4b6b1c053d07fd357fac4ba compatible = "brcm,bcm2835-i2c"; reg = <0x7e804000 0x1000>; -From 6697d662440c1eec433a08ef6d78528a669a4a44 Mon Sep 17 00:00:00 2001 +From 2bc0c12370784471b83d8ee9700a7734121931a9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 2 Jun 2016 15:09:35 -0700 -Subject: [PATCH 155/333] BCM270X: Enable the DSI panel node in the VC4 +Subject: [PATCH 154/407] BCM270X: Enable the DSI panel node in the VC4 overlay. Signed-off-by: Eric Anholt @@ -130543,10 +130515,10 @@ index 4f1cc20f90dc6780f74e08ebee00e5a1a6062c85..f25cd9a3936861920b0d518ff2d773ee cma-256 = <0>,"+0-1-2-3-4"; cma-192 = <0>,"-0+1-2-3-4"; -From fbfb4c2693dd55104da1c4135b03e1710d98fb49 Mon Sep 17 00:00:00 2001 +From 2d8022c1e08ef83772a14b2ace74e2de9d67bbe0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 3 Nov 2016 18:53:10 -0700 -Subject: [PATCH 156/333] drm/vc4: Add support for rendering with ETC1 +Subject: [PATCH 155/407] drm/vc4: Add support for rendering with ETC1 textures. The validation for it ends up being quite simple, but I hadn't got @@ -130606,10 +130578,10 @@ index ad7edc3edf7ca1d653a0bc025a5eda6692b74370..69caa21f0cb23c9439238f6239c0041b struct drm_vc4_get_param { __u32 param; -From 620de3026e4dc66a45add79475d22f0e71486627 Mon Sep 17 00:00:00 2001 +From 8ebf3d4544599d3d6770e4d7095724bcfd2621a6 Mon Sep 17 00:00:00 2001 From: Jonas Pfeil Date: Tue, 8 Nov 2016 00:18:39 +0100 -Subject: [PATCH 157/333] drm/vc4: Add fragment shader threading support +Subject: [PATCH 156/407] drm/vc4: Add fragment shader threading support FS threading brings performance improvements of 0-20% in glmark2. @@ -130845,10 +130817,10 @@ index 69caa21f0cb23c9439238f6239c0041b178d5669..f07a090167261131076438960c1dec17 struct drm_vc4_get_param { __u32 param; -From 10c2ec3ad3ae9c153c217868f8955b0629e83320 Mon Sep 17 00:00:00 2001 +From e320e259ef5feeb3eab0e7b75e1f38655143f24d Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 2 Dec 2016 14:48:09 +0100 -Subject: [PATCH 158/333] drm: Add TV connector states to drm_connector_state +Subject: [PATCH 157/407] drm: Add TV connector states to drm_connector_state Some generic TV connector properties are exposed in drm_mode_config, but they are currently handled independently in each DRM encoder driver. @@ -130870,7 +130842,7 @@ Signed-off-by: Eric Anholt 2 files changed, 82 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c -index 4e19bde4bbffac08e700460b69db882f42d5463b..846da4f6416435221cb8d08a8c124f05852e93ca 100644 +index 34adde169a789616002b2e2f3af7186d5441023a..3c7610161c2e2bfaa94bcc12d3d1046f004a6558 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -989,12 +989,38 @@ int drm_atomic_connector_set_property(struct drm_connector *connector, @@ -130998,10 +130970,10 @@ index d8bb8d151825fe818a0fc8cf0b1d685feae6b686..c9fbc52e88879c9b91c63b4d1f7abf0f /** -From 2476ea415dfa5a1d3d5aa0ac658ea88688a4cfd2 Mon Sep 17 00:00:00 2001 +From 2f1fc6aab70899cf1ff56d5869fb719d878b751b Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 2 Dec 2016 14:48:08 +0100 -Subject: [PATCH 159/333] drm: Turn DRM_MODE_SUBCONNECTOR_xx definitions into +Subject: [PATCH 158/407] drm: Turn DRM_MODE_SUBCONNECTOR_xx definitions into an enum List of values like the DRM_MODE_SUBCONNECTOR_xx ones are better @@ -131048,10 +131020,10 @@ index df0e3504c349a950bf41540fbcd6cd944cf11d2f..970bfc0d7107451e5bc4e29c524a764c #define DRM_MODE_CONNECTOR_Unknown 0 #define DRM_MODE_CONNECTOR_VGA 1 -From ae696d49d8f02312c2c8bdb4c2b81bb3078327e1 Mon Sep 17 00:00:00 2001 +From 1eb0d1d23ac91063c2d6106b3fae07d2b0a974cb Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 2 Dec 2016 14:48:10 +0100 -Subject: [PATCH 160/333] drm/vc4: Add support for the VEC (Video Encoder) IP +Subject: [PATCH 159/407] drm/vc4: Add support for the VEC (Video Encoder) IP The VEC IP is a TV DAC, providing support for PAL and NTSC standards. @@ -131790,10 +131762,10 @@ index 0000000000000000000000000000000000000000..32bb8ef985fbc6f39f9e5f459846bb77 + }, +}; -From 86529e8e5ef8357f6cdb818ee827aded932760e9 Mon Sep 17 00:00:00 2001 +From 55d158db4f025bd4a4d329709c01b647a975c169 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 15 Sep 2016 15:25:23 +0100 -Subject: [PATCH 161/333] drm/vc4: Set up SCALER_DISPCTRL at boot. +Subject: [PATCH 160/407] drm/vc4: Set up SCALER_DISPCTRL at boot. We want the HVS on, obviously, and we also want DSP3 (PV1's source) to be muxed from HVS channel 2 like we expect in vc4_crtc.c. The @@ -131853,10 +131825,10 @@ index 39f6886b24100c43b590e47e0c7bc44846721d65..b3b297fba7097bc495fa8916292c5479 * SCALER_DISPSTAT_IRQDISP0. Note that short frame contributions are * always enabled. -From 0166abc72e519cc0e510efb5d58b8698fc0e6466 Mon Sep 17 00:00:00 2001 +From a464236920171f2c4936d5b688f0fa3acd4d36bb Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 10 Feb 2016 16:17:29 -0800 -Subject: [PATCH 162/333] drm/vc4: Add support for feeding DSI encoders from +Subject: [PATCH 161/407] drm/vc4: Add support for feeding DSI encoders from the pixel valve. We have to set a different pixel format, which tells the hardware to @@ -131971,10 +131943,10 @@ index b3b297fba7097bc495fa8916292c547925720199..385405a2df05eb3dd86d4f687aa82053 # define PV_VCONTROL_VIDEN BIT(0) -From 2a62b128abb164bf75852e4f452083202df5d7a5 Mon Sep 17 00:00:00 2001 +From a87d6faa513958a6f6b5427c4ac5d3acb9799011 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 10 Feb 2016 11:42:32 -0800 -Subject: [PATCH 163/333] drm/vc4: Add DSI driver +Subject: [PATCH 162/407] drm/vc4: Add DSI driver The DSI0 and DSI1 blocks on the 2835 are related hardware blocks. Some registers move around, and the featureset is slightly different, @@ -133802,10 +133774,10 @@ index 0000000000000000000000000000000000000000..17fcac381dbb37cd9a5ff210ad8578f4 + }, +}; -From 2fa052cc2f215bf395b3359bbd53dd3ff76f73ca Mon Sep 17 00:00:00 2001 +From 253c94650c07b28d4f3e9d3e86904ce0c25048c4 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 2 Dec 2016 14:48:12 +0100 -Subject: [PATCH 164/333] ARM: dts: bcm283x: Add VEC node in bcm283x.dtsi +Subject: [PATCH 163/407] ARM: dts: bcm283x: Add VEC node in bcm283x.dtsi Add the VEC (Video EnCoder) node definition in bcm283x.dtsi. @@ -133836,10 +133808,10 @@ index 41776b97b4b6b1c053d07fd357fac4ba4787ac53..d3cc586661f903e67a840189c0446aa8 compatible = "brcm,bcm2835-pixelvalve2"; reg = <0x7e807000 0x100>; -From c4af8f91964cd6ef3e9c73a9dd2bc4092f8c9c02 Mon Sep 17 00:00:00 2001 +From 2782121124b526dc32b6638874b089ea3ba32c0d Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 2 Dec 2016 14:48:13 +0100 -Subject: [PATCH 165/333] ARM: dts: bcm283x: Enable the VEC IP on all +Subject: [PATCH 164/407] ARM: dts: bcm283x: Enable the VEC IP on all RaspberryPi boards Enable the VEC IP on all RaspberryPi boards. @@ -133865,10 +133837,10 @@ index 365648898f3acc4f82dc6cb58e4bbebbe249be94..d4577a51e678cb600b475d3d3395ca4e + status = "okay"; +}; -From e46ccf0a0bb67b34a7c8e9a32dcb22fab11292af Mon Sep 17 00:00:00 2001 +From 78eccf54c65c107f571a58617303bba3f00c58bc Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Jan 2017 11:41:54 -0800 -Subject: [PATCH 166/333] BCM270X: Disable VEC unless vc4-kms-v3d is present. +Subject: [PATCH 165/407] BCM270X: Disable VEC unless vc4-kms-v3d is present. Signed-off-by: Eric Anholt --- @@ -133907,10 +133879,10 @@ index f25cd9a3936861920b0d518ff2d773ee467e2f49..a8ef8c9051668a7477dea30aa262568c cma-256 = <0>,"+0-1-2-3-4"; cma-192 = <0>,"-0+1-2-3-4"; -From a05f3d7833439d78ceaa9e265b55cb66c86d297d Mon Sep 17 00:00:00 2001 +From 2227e95ee07be88e3c97736f9b00b26d69c8916a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Feb 2017 17:09:18 -0800 -Subject: [PATCH 167/333] drm/vc4: Name the primary and cursor planes in fkms. +Subject: [PATCH 166/407] drm/vc4: Name the primary and cursor planes in fkms. This makes debugging nicer, compared to trying to remember what the IDs are. @@ -133934,10 +133906,10 @@ index d18a1dae51a2275846c9826b5bf1ba57ae97b55c..e49ce68b607a7ffc2329e3235362f3bc if (type == DRM_PLANE_TYPE_PRIMARY) { vc4_plane->fbinfo = -From 9e8f1c682a868d29d1ee9efca588208e0a53ceaf Mon Sep 17 00:00:00 2001 +From 2e0272e4b8249f4077222d397b19b3191a435525 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Feb 2017 17:10:09 -0800 -Subject: [PATCH 168/333] drm/vc4: Add DRM_DEBUG_ATOMIC for the insides of +Subject: [PATCH 167/407] drm/vc4: Add DRM_DEBUG_ATOMIC for the insides of fkms. Trying to debug weston on fkms involved figuring out what calls I was @@ -134007,10 +133979,10 @@ index e49ce68b607a7ffc2329e3235362f3bc21ed5cbb..dbf065677202fbebf8e3a0cffbe880aa RPI_FIRMWARE_SET_CURSOR_STATE, &packet_state, -From ef5c5d7599133674d68a6853ba28c289d174408f Mon Sep 17 00:00:00 2001 +From 80736c96167adf154db28ad01058a678720eb770 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 2 Feb 2017 09:42:18 -0800 -Subject: [PATCH 169/333] drm/vc4: Fix sending of page flip completion events +Subject: [PATCH 168/407] drm/vc4: Fix sending of page flip completion events in FKMS mode. In the rewrite of vc4_crtc.c for fkms, I dropped the part of the @@ -134052,10 +134024,10 @@ index dbf065677202fbebf8e3a0cffbe880aa42daef3f..da818a207bfa639b8cea48d94bcf4566 static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc) -From 4208c51bfbb7b59041dbc8cc8b1cce0ae86537ca Mon Sep 17 00:00:00 2001 +From c91109c6e22b5a3373816bed129084c28b99a2f7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 8 Feb 2017 15:00:54 -0800 -Subject: [PATCH 170/333] drm/vc4: Fulfill user BO creation requests from the +Subject: [PATCH 169/407] drm/vc4: Fulfill user BO creation requests from the kernel BO cache. The from_cache flag was actually "the BO is invisible to userspace", @@ -134108,10 +134080,10 @@ index ec9023bd935b6755b3c2b6a7e171cb269562234c..fd83a28076564b9ea5cf0f2ba29b884e cma_obj = drm_gem_cma_create(dev, size); -From 5e93c74fa219d2f84e1f283ba8896e1735fe059a Mon Sep 17 00:00:00 2001 +From 024a87f01028f4f6e827e0ccfc65f640ef6793f5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Oct 2015 08:58:08 -0700 -Subject: [PATCH 171/333] drm/vc4: Verify at boot that CMA doesn't cross a +Subject: [PATCH 170/407] drm/vc4: Verify at boot that CMA doesn't cross a 256MB boundary. I've seen lots of users cranking CMA up higher, so throw an error if @@ -134194,10 +134166,10 @@ index c960459eda7e640ea55be1d4ed80c6a9125a8877..b50245282a18bc790da0f901944c2e67 static unsigned long cma_bitmap_aligned_mask(const struct cma *cma, int align_order) -From 4b820b9a57bbbb599d8abffb652411b371446b11 Mon Sep 17 00:00:00 2001 +From 32a29eb522d6c408a742a98f6fc8effcb2981df3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 17 Feb 2017 09:47:11 +0000 -Subject: [PATCH 172/333] BCM270X_DT: Add SMSC ethernet controller to DT +Subject: [PATCH 171/407] BCM270X_DT: Add SMSC ethernet controller to DT With an ethernet node in the DT, a suitable firmware can populate the local-mac-address property, removing the need for a downstream patch @@ -134260,10 +134232,10 @@ index d29ba72de727fe26b5a586e0bd0a41181c68ae04..78101849441679baf3624cf67a0ff7a2 / { model = "Raspberry Pi 3 Model B"; -From 8adaacce18fb91e16485465a8505552e558e9712 Mon Sep 17 00:00:00 2001 +From b2845e8744f422ce6ff3add81a34735ad398ff1d Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 17 Feb 2017 15:26:13 +0000 -Subject: [PATCH 173/333] brcmfmac: Mute expected startup 'errors' +Subject: [PATCH 172/407] brcmfmac: Mute expected startup 'errors' The brcmfmac WiFi driver always complains about the '00' country code and the firmware version is reported as an error. Modify the driver to @@ -134276,10 +134248,10 @@ Signed-off-by: Phil Elwell 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -index 3ac3056ab1d2074e4a60961455f0c355c5a18afd..11e73bff0f479b6dc1157fe39120b33796acb894 100644 +index 98fa503627d62dd247a30a0db83ced788d41749d..3d28de96298c7cded3d231dd2f837ff182575c8c 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -6811,6 +6811,8 @@ static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy, +@@ -6812,6 +6812,8 @@ static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy, /* ignore non-ISO3166 country codes */ for (i = 0; i < sizeof(req->alpha2); i++) if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') { @@ -134302,10 +134274,10 @@ index 4051780f64f44a5ce522babe6c371a1beb79a824..b081673abcb4aa72d70d8e0834b608f6 /* locate firmware version number for ethtool */ ptr = strrchr(buf, ' ') + 1; -From 6adc0fdd9834f3d29b0b46f159322a3a0f8f0690 Mon Sep 17 00:00:00 2001 +From 8c79f28797174182e0a0857bbbdfc8b3982e12eb Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Feb 2017 17:20:08 +0000 -Subject: [PATCH 174/333] clk-bcm2835: Mark used PLLs and dividers CRITICAL +Subject: [PATCH 173/407] clk-bcm2835: Mark used PLLs and dividers CRITICAL The VPU configures and relies on several PLLs and dividers. Mark all enabled dividers and their PLLs as CRITICAL to prevent the kernel from @@ -134333,10 +134305,10 @@ index 136e5d28f9eaeaa10d45382a0f31da9f4adb91ef..4192863778c8009aacfc9a49ee38ad1c divider->data = data; -From a76f7d87569ccbfa8c26dbdbd7d13dbb44f62254 Mon Sep 17 00:00:00 2001 +From f3dadcc060593fe1db2e51d56cc1c25fd5b114af Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Feb 2017 17:20:08 +0000 -Subject: [PATCH 175/333] clk-bcm2835: Add claim-clocks property +Subject: [PATCH 174/407] clk-bcm2835: Add claim-clocks property The claim-clocks property can be used to prevent PLLs and dividers from being marked as critical. It contains a vector of clock IDs, @@ -134471,10 +134443,10 @@ index 4192863778c8009aacfc9a49ee38ad1ca62a01e4..6b245357e4e93c19a839eee92a82f95a sizeof(cprman_parent_names)); of_clk_parent_fill(dev->of_node, cprman->real_parent_names, -From 1dfd09ca2f5b859ae58f39d98eff6179fa0e875d Mon Sep 17 00:00:00 2001 +From fb96945a7764438118efec9d179b66c1ee8ce872 Mon Sep 17 00:00:00 2001 From: Scott Ellis Date: Thu, 23 Feb 2017 11:56:20 -0500 -Subject: [PATCH 176/333] Add ads1015 driver to config +Subject: [PATCH 175/407] Add ads1015 driver to config --- arch/arm/configs/bcm2709_defconfig | 3 ++- @@ -134528,10 +134500,10 @@ index 9a9cd1cdcb2f76d4408568681ec80885293bae48..554fed3a4fbfd1940422b808046c6d2b CONFIG_FB=y CONFIG_FB_BCM2708=y -From 98f6f6971310915ae0fd83d9cd758c47cbdc568a Mon Sep 17 00:00:00 2001 +From a4363a9c00ef47ca5a444d33f5bce9859109789e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 27 Jan 2017 18:49:30 +0000 -Subject: [PATCH 177/333] config: add slcan kernel module +Subject: [PATCH 176/407] config: add slcan kernel module See: https://github.com/raspberrypi/linux/issues/1819 --- @@ -134564,10 +134536,10 @@ index 554fed3a4fbfd1940422b808046c6d2b1f508394..99888182259b280790a7506b248a8130 CONFIG_IRDA=m CONFIG_IRLAN=m -From ecc50cd95a75ce79c969babde03d63a0be0e55f6 Mon Sep 17 00:00:00 2001 +From 68eaac8e21467fb1f4eaaea43972c9270dcb6b28 Mon Sep 17 00:00:00 2001 From: Miquel Date: Fri, 24 Feb 2017 20:51:06 +0100 -Subject: [PATCH 178/333] sound: Support for Dion Audio LOCO-V2 DAC-AMP HAT +Subject: [PATCH 177/407] sound: Support for Dion Audio LOCO-V2 DAC-AMP HAT Signed-off-by: Miquel Blauw --- @@ -134831,10 +134803,10 @@ index 0000000000000000000000000000000000000000..a009c49477972a9832175d86f201b035 +MODULE_DESCRIPTION("ASoC Driver for DionAudio LOCO-V2"); +MODULE_LICENSE("GPL v2"); -From 9c2092a775e3ee13b4b49cbe254aae5f4fe061e8 Mon Sep 17 00:00:00 2001 +From 1746721884c3b195e77742dd18f0efe0a71a0473 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Sun, 26 Feb 2017 01:13:02 +0000 -Subject: [PATCH 179/333] SQUASH: Add LOCO-V2 overlay from last commit +Subject: [PATCH 178/407] SQUASH: Add LOCO-V2 overlay from last commit --- .../dts/overlays/dionaudio-loco-v2-overlay.dts | 49 ++++++++++++++++++++++ @@ -134897,10 +134869,10 @@ index 0000000000000000000000000000000000000000..a1af93de30119734e8d14cbd454589d3 + }; +}; -From a112c026f3f9b568ede75c4667696b9d2459bc86 Mon Sep 17 00:00:00 2001 +From 736da2c903d1af5be1c8f09c9b690e774f84cfd5 Mon Sep 17 00:00:00 2001 From: Fe-Pi Date: Wed, 1 Mar 2017 04:42:43 -0700 -Subject: [PATCH 180/333] Add support for Fe-Pi audio sound card. (#1867) +Subject: [PATCH 179/407] Add support for Fe-Pi audio sound card. (#1867) Fe-Pi Audio Sound Card is based on NXP SGTL5000 codec. Mechanical specification of the board is the same the Raspberry Pi Zero. @@ -135249,10 +135221,10 @@ index 0000000000000000000000000000000000000000..015b56fd73cc36be5b5eecd17548fd03 +MODULE_DESCRIPTION("ASoC Driver for Fe-Pi Audio"); +MODULE_LICENSE("GPL v2"); -From 0a112ade84a1272c378f6faa9015ca73ab54b37c Mon Sep 17 00:00:00 2001 +From 93ad217221be3e601b8b86d45715b89bfe8739cf Mon Sep 17 00:00:00 2001 From: Scott Ellis Date: Wed, 1 Mar 2017 07:22:24 -0500 -Subject: [PATCH 181/333] Add overlay for ads1115 ADCs (#1864) +Subject: [PATCH 180/407] Add overlay for ads1115 ADCs (#1864) --- arch/arm/boot/dts/overlays/Makefile | 1 + @@ -135416,10 +135388,10 @@ index 0000000000000000000000000000000000000000..7c16a1af3172d14e1a976b1776b9f167 + }; +}; -From 63849896099f242a008cd1d71ad43491bb2a8b7c Mon Sep 17 00:00:00 2001 +From 0f746123264ec57d864a52c90c0246dd92c2fdb2 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 1 Mar 2017 16:06:53 +0000 -Subject: [PATCH 182/333] clk-bcm2835: Correct the prediv logic +Subject: [PATCH 181/407] clk-bcm2835: Correct the prediv logic If a clock has the prediv flag set, both the integer and fractional parts must be scaled when calculating the resulting frequency. @@ -135446,10 +135418,10 @@ index 6b245357e4e93c19a839eee92a82f95aec996e4e..8ea29fbc8dc451b9cff502bc1a918ae6 return bcm2835_pll_rate_from_divisors(parent_rate, ndiv, fdiv, pdiv); } -From 21632d9c4a620b8a5d9b3620b1abedfedc2aeeb7 Mon Sep 17 00:00:00 2001 +From d7437560a222e7b10b4968b903120b609971cb61 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 1 Mar 2017 16:07:39 +0000 -Subject: [PATCH 183/333] amba_pl011: Round input clock up +Subject: [PATCH 182/407] amba_pl011: Round input clock up The UART clock is initialised to be as close to the requested frequency as possible without exceeding it. Now that there is a @@ -135535,10 +135507,10 @@ index 5a11ff833e1fd112ba04df3a427cd94bf6793ec5..003a5b0c30295dbbcb94a28d0c64d124 /* unregisters the driver also if no more ports are left */ static void pl011_unregister_port(struct uart_amba_port *uap) -From f588d401f3521fcdffc580f5f79832b01461e718 Mon Sep 17 00:00:00 2001 +From 87c53e874dd099b3c1d6addd559b28e47fee43a0 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Mon, 13 Feb 2017 11:10:50 +0000 -Subject: [PATCH 184/333] BCM2835-V4L2: Ensure H264 header bytes get a sensible +Subject: [PATCH 183/407] BCM2835-V4L2: Ensure H264 header bytes get a sensible timestamp H264 header come off VC with 0 timestamps, which means they get a @@ -135627,10 +135599,10 @@ index e6aeb7e7e381de65d6c6586205069a4c5cd33274..7f8a68916a67001bc9241bce2928519a struct vchiq_mmal_port *port; /* port being used for capture */ /* camera port being used for capture */ -From 97c509f21effc49710a8b8aa821cbb59c2ac4101 Mon Sep 17 00:00:00 2001 +From a10321139f0a4aa96965158dee8b921857f3de67 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Mon, 13 Feb 2017 13:11:41 +0000 -Subject: [PATCH 185/333] BCM2835-V4L2: Correctly denote key frames in encoded +Subject: [PATCH 184/407] BCM2835-V4L2: Correctly denote key frames in encoded data Forward MMAL key frame flags to the V4L2 buffers. @@ -135655,10 +135627,10 @@ index e69731320f4e59249933bc21843913deab4a1209..6bdec0806126044cf7146d53326e4da5 "Buffer has ts %llu", dev->capture.last_timestamp); -From 853f1cb229d1b95d7317c90e02356411b52fb54f Mon Sep 17 00:00:00 2001 +From cdc2861928e350dc0c6225ba452c44dd73987e15 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Mon, 20 Feb 2017 17:01:21 +0000 -Subject: [PATCH 186/333] bcm2835-gpio-exp: Driver for GPIO expander via +Subject: [PATCH 185/407] bcm2835-gpio-exp: Driver for GPIO expander via mailbox service Pi3 and Compute Module 3 have a GPIO expander that the @@ -136076,10 +136048,10 @@ index 2859db09e25bb945251e85edb39bc43430857168..56b3f0fe1ea3d22fcf207e6df90b640e /* Dispmanx TAGS */ RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, -From eb8a2a405131da2dcb48f9ceb1e84624e36a74ba Mon Sep 17 00:00:00 2001 +From 43bbc1c0db5aefbb787f1e9fda8a94901a1e8ad5 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 24 May 2016 16:30:05 +0100 -Subject: [PATCH 187/333] BCM270X_DT: Add bcm2708-rpi-0-w.dts +Subject: [PATCH 186/407] BCM270X_DT: Add bcm2708-rpi-0-w.dts Add DT support for the Pi Zero W. N.B. It will not be loaded automatically without a corresponding change to the firmware. @@ -136307,10 +136279,10 @@ index 0000000000000000000000000000000000000000..db0f99ddf2f46e83827d56e21c4846dd + }; +}; -From 01d7f126153cdcca1a4485fa1307bf02e7c7782d Mon Sep 17 00:00:00 2001 +From 4a6c96302e7e9d1b916efa0ba6ef45aadc6f4b08 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 6 Mar 2017 09:06:18 +0000 -Subject: [PATCH 188/333] clk-bcm2835: Read max core clock from firmware +Subject: [PATCH 187/407] clk-bcm2835: Read max core clock from firmware The VPU is responsible for managing the core clock, usually under direction from the bcm2835-cpufreq driver but not via the clk-bcm2835 @@ -136438,10 +136410,10 @@ index 8ea29fbc8dc451b9cff502bc1a918ae65fb1b306..fe3298b54cdfb96bd90fb4f39e13921d for (i = 0; !of_property_read_u32_index(pdev->dev.of_node, "claim-clocks", -From 09d842645afec4e4f6abb2248e3a7d4ac9d20042 Mon Sep 17 00:00:00 2001 +From 8e33148920258a333684bca3851e040d4093be9a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 7 Mar 2017 19:48:23 +0000 -Subject: [PATCH 189/333] config: Add CONFIG_CRYPTO_LZ4 +Subject: [PATCH 188/407] config: Add CONFIG_CRYPTO_LZ4 Enabling this options allows LZ4 memory compression. @@ -136478,10 +136450,10 @@ index 2c124bbfa343bf2c160250d055e1509678a80850..1748fcb84bdc3853ffccba93a41cd2dc # CONFIG_CRYPTO_HW is not set CONFIG_ARM_CRYPTO=y -From f49d5ade059457fe5ecd6780a4c16626ff168390 Mon Sep 17 00:00:00 2001 +From fbd464b0d5c40ce1400198fdd3edc09e12bab819 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Thu, 23 Feb 2017 17:54:31 -0800 -Subject: [PATCH 190/333] drm/vc4: Don't wait for vblank when updating the +Subject: [PATCH 189/407] drm/vc4: Don't wait for vblank when updating the cursor Commonly used desktop environments such as xfce4 and gnome @@ -136538,10 +136510,10 @@ index 881bf489478b01b34e9e4df6013fe608c42215ee..14d69bb4967dedcd3bbc475639a8c27e * expected change from the drm_mode_cursor_universal() * helper. -From 395bfbecbb6c0b316fbb0cf2c3affd3fa49f78cc Mon Sep 17 00:00:00 2001 +From bcc460aedfc775135164e2bf2468de2f8f149714 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 6 Mar 2017 12:17:16 -0800 -Subject: [PATCH 191/333] panel-raspberrypi-touchscreen: Round up clk rate to +Subject: [PATCH 190/407] panel-raspberrypi-touchscreen: Round up clk rate to fix DSI panel. Commit 488f9bc8e3def93e0baef53cee2026c2cb0d8956 slightly increased the @@ -136576,10 +136548,10 @@ index 1a536fe4d040f5fafe324baee110a6225dd0be08..7f315f04b109621ca7f3861fdd8acf95 .hsync_start = HACT + HFP, .hsync_end = HACT + HFP + HSW, -From bfaa2b04167eb889aa546138ad76d4cb2eac5136 Mon Sep 17 00:00:00 2001 +From e3e95c6c54c04a31a1091deb343ab074e4988f3a Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Wed, 8 Mar 2017 20:04:13 +1100 -Subject: [PATCH 192/333] Add support for the AudioInjector.net Octo sound card +Subject: [PATCH 191/407] Add support for the AudioInjector.net Octo sound card --- arch/arm/boot/dts/overlays/Makefile | 1 + @@ -137050,10 +137022,10 @@ index 0000000000000000000000000000000000000000..9effea725798640887755dfa688da453 +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:audioinjector-octo-soundcard"); -From 9bd9691a00100615c17f57381edc8af4f0bad582 Mon Sep 17 00:00:00 2001 +From 48f9836cabf8f9a1f914c8649c13a370ddf2baef Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Wed, 8 Mar 2017 21:13:24 +1100 -Subject: [PATCH 193/333] ASoC: bcm2835_i2s.c: relax the ch2 register setting +Subject: [PATCH 192/407] ASoC: bcm2835_i2s.c: relax the ch2 register setting for 8 channels This patch allows ch2 registers to be set for 8 channels of audio. @@ -137082,10 +137054,10 @@ index 6ba20498202ed36906b52096893a88867a79269f..c8dd065aea8414b47aa2ea4fc04168b5 format |= BCM2835_I2S_CH1(BCM2835_I2S_CHPOS(ch1pos)); format |= BCM2835_I2S_CH2(BCM2835_I2S_CHPOS(ch2pos)); -From 29b7b2f34b075024b4da055a4bb2ccaa5edd8229 Mon Sep 17 00:00:00 2001 +From 2cbcf14f43074989219a2fc29b73eca0ee0886b5 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Fri, 10 Mar 2017 14:43:15 +0000 -Subject: [PATCH 194/333] bcm2835-v4l2: Fix buffer overflow problem +Subject: [PATCH 193/407] bcm2835-v4l2: Fix buffer overflow problem https://github.com/raspberrypi/linux/issues/1447 port_parameter_get() failed to account for the header @@ -137121,10 +137093,10 @@ index 781322542d5a8295f3d7d5a3eaaf0cac29930c30..e4b243b33f58913f3d2952c97d2a2e3f * but report true size of parameter */ -From d8facab91514a4e7ed040dffbf8e329c93791c5e Mon Sep 17 00:00:00 2001 +From c100d76794f226d889e2c17a4bb9f662c553fba1 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 10 Feb 2017 17:57:08 -0800 -Subject: [PATCH 195/333] build/arm64: Add rules for .dtbo files for dts +Subject: [PATCH 194/407] build/arm64: Add rules for .dtbo files for dts overlays We now create overlays as .dtbo files. @@ -137149,10 +137121,10 @@ index 3635b8662724569d3338ebb620d603c644fe38b7..822fefeb1cd0aa2dc8398f885cf28e9b dtbs: prepare scripts -From 83bdf63bdefa88503907986af885ac3c3c433274 Mon Sep 17 00:00:00 2001 +From 6b512f7362468e0dd40b49687d1c87d97fb17369 Mon Sep 17 00:00:00 2001 From: John Greb Date: Wed, 8 Mar 2017 15:12:29 +0000 -Subject: [PATCH 196/333] Match dwc2 device-tree fifo sizes to the hardware +Subject: [PATCH 195/407] Match dwc2 device-tree fifo sizes to the hardware values. Since commit aa381a7259c3f53727bcaa8c5f9359e940a0e3fd was reverted with 3fa9538539ac737096c81f3315a14670b1609092 the g-tx-fifo-size array in the device-tree needs to match the preset values in the bcm2835. @@ -137183,10 +137155,10 @@ index 527abc9f0ddf71f4dc7d58336d87684c931cc2f3..265a16bab008453edba198cf2366c423 }; }; -From ac319910e6b0f9d9820d1595da5fa04bfed88b8c Mon Sep 17 00:00:00 2001 +From e0395d0a189a39ff83a9e59ead61abe4d9302219 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 5 Mar 2017 11:46:41 +0000 -Subject: [PATCH 197/333] config: Add RTL8XXXU wifi module +Subject: [PATCH 196/407] config: Add RTL8XXXU wifi module --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -137218,10 +137190,10 @@ index bf52db66afb2aa18d6f6f9fb9b64dcbd97e24521..4bc0f8b52b7f39f99d650cb9c4cdfdba CONFIG_ZD1211RW=m CONFIG_MAC80211_HWSIM=m -From 2e57f1ca0b97013b5c339cf7f852e844dac79e99 Mon Sep 17 00:00:00 2001 +From 89f5fa7b19a4e9a47581847f41357bea76245e2c Mon Sep 17 00:00:00 2001 From: "K. Y. Srinivasan" Date: Thu, 22 Dec 2016 16:54:00 -0800 -Subject: [PATCH 198/333] Drivers: hv: vmbus: Fix a rescind handling bug +Subject: [PATCH 197/407] Drivers: hv: vmbus: Fix a rescind handling bug commit ccb61f8a99e6c29df4fb96a65dad4fad740d5be9 upstream. @@ -137253,10 +137225,10 @@ index 1606e7f08f4b36750be747feb5d0e9f36b3e6dd0..9aff4f6f5423a3b03fa834d4f69d4bb5 /* * If the channel has been rescinded; -From 43d73bce76989d6b059f83e91e1116068fd39391 Mon Sep 17 00:00:00 2001 +From d4ef183988fc60403940762aafec91e4bd6e9e1f Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Tue, 7 Mar 2017 12:18:20 +0000 -Subject: [PATCH 199/333] BCM270X_DT: Invert Pi3 power LED to match fw change +Subject: [PATCH 198/407] BCM270X_DT: Invert Pi3 power LED to match fw change Firmware expgpio driver reworked due to complaint over hotplug detect. @@ -137282,10 +137254,10 @@ index 173103aaca503833b5e29530ed94e14c7cab0444..b21d2866d204adc533b46d581028f290 }; -From 98bcc0b5a5de1412cf587ee873f398a96de82af4 Mon Sep 17 00:00:00 2001 +From a0f37db1e4641d6b68927d29b3fe614e473ffbec Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 14 Mar 2017 09:10:05 +0000 -Subject: [PATCH 200/333] BCM270X_DT: Add lm75 to i2c-sensor overlay +Subject: [PATCH 199/407] BCM270X_DT: Add lm75 to i2c-sensor overlay See: https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=177236 @@ -137348,10 +137320,10 @@ index 31bda8da4cb6a56bfe493a81b918900995fb0589..606b2d5012abf2e85712be631c42ea40 }; }; -From 83805c440f168c6676ce7e4b474385bffea20a95 Mon Sep 17 00:00:00 2001 +From 4d00bc356d2c81e776512e89e099fd152e863ee6 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Tue, 14 Mar 2017 14:23:06 +0000 -Subject: [PATCH 201/333] bcm2835-gpio-exp: Copy/paste error adding base twice +Subject: [PATCH 200/407] bcm2835-gpio-exp: Copy/paste error adding base twice brcmexp_gpio_set was adding gpio->gc.base to the offset twice, so passing an invalid number to the mailbox service. @@ -137377,10 +137349,10 @@ index 681a91492d4c33bdfd42416e069218e8611cc4d9..d68adafaee4ad406f45f4ff0d6b7c1ad set.state = val; /* Output state */ -From cc857754907d1164415bbf80ad5dda60e751368c Mon Sep 17 00:00:00 2001 +From 724c1499768ca4b383327471d0a3532343c8e5e3 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Wed, 15 Mar 2017 11:12:40 +0000 -Subject: [PATCH 202/333] bcm2835-camera: Correct port_parameter_get return +Subject: [PATCH 201/407] bcm2835-camera: Correct port_parameter_get return value The API for port_parameter_get() requires that the @@ -137438,10 +137410,10 @@ index e4b243b33f58913f3d2952c97d2a2e3fbbbd0ae8..ec2853ba9d4b1b0cd6e07a495a424e15 pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n", __func__, ret, port->component->handle, port->handle, parameter_id); -From 7513dfca3bf6c8921dc918b4c2025b522b42e7e0 Mon Sep 17 00:00:00 2001 +From 73a01c02bc75471ae61a40341c4098774a69abba Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 17 Mar 2017 12:24:41 +0000 -Subject: [PATCH 203/333] config: Make spidev a loadable module +Subject: [PATCH 202/407] config: Make spidev a loadable module spidev isn't required early in the boot process, and not all users need it (spi_bcm2835 is a module), so make it a loadable module. @@ -137497,10 +137469,10 @@ index 4bc0f8b52b7f39f99d650cb9c4cdfdba6fac59dd..8d64ce4465f6f276b2d58ed1e2e45fb0 CONFIG_SND_SIMPLE_CARD=m CONFIG_SOUND_PRIME=m -From 102f318d7745f522d2bf7a9781f01369d7fc873d Mon Sep 17 00:00:00 2001 +From bdb9f4538bf10c28a6ee2822a6c65f41c4799c75 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 23 Mar 2017 10:06:56 +0000 -Subject: [PATCH 204/333] ASoC: Add prompt for ICS43432 codec +Subject: [PATCH 203/407] ASoC: Add prompt for ICS43432 codec Without a prompt string, a config setting can't be included in a defconfig. Give CONFIG_SND_SOC_ICS43432 a prompt so that Pi soundcards @@ -137525,10 +137497,10 @@ index 9824cdd04b0c11c45b8cedd0187a0eba8f1dc2d4..c0b88d43df0de283c58ed6158680bc7e config SND_SOC_INNO_RK3036 tristate "Inno codec driver for RK3036 SoC" -From c977b9b9da8f91d8efaca8b112317148ea79a13b Mon Sep 17 00:00:00 2001 +From eaf7124d5cf9b9afd4ce45a70e185a9ec3bcb078 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 23 Mar 2017 16:34:46 +0000 -Subject: [PATCH 205/333] bcm2835-aux: Add aux interrupt controller +Subject: [PATCH 204/407] bcm2835-aux: Add aux interrupt controller The AUX block has a shared interrupt line with a register indicating which devices have active IRQs. Expose this as a nested interrupt @@ -137692,10 +137664,10 @@ index bd750cf2238d61489811e7d7bd3b5f9950ed53c8..41e0702fae4692221980b0d02aed1ba6 BCM2835_AUX_CLOCK_COUNT, GFP_KERNEL); if (!onecell) -From 6cdf98fe0a0bd31adc919f75eab8848249003c18 Mon Sep 17 00:00:00 2001 +From 3b4609fa3292ec9140ad9551ba37f8e3b899a1b2 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 23 Mar 2017 17:08:44 +0000 -Subject: [PATCH 206/333] BCM270X_DT: Enable AUX interrupt controller in DT +Subject: [PATCH 205/407] BCM270X_DT: Enable AUX interrupt controller in DT See: https://github.com/raspberrypi/linux/issues/1484 https://github.com/raspberrypi/linux/issues/1573 @@ -137748,10 +137720,10 @@ index d3cc586661f903e67a840189c0446aa80e16a44e..348c71bbc913644c04bab43fcb95abe9 #address-cells = <1>; #size-cells = <0>; -From e17749a4a83f600697fad577f4b3fbaecc0e385b Mon Sep 17 00:00:00 2001 +From d1aa5c7e6ca4104166f02eb90d4fa648802fbad4 Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Mon, 27 Mar 2017 22:26:49 +1100 -Subject: [PATCH 207/333] Audioinjector addons dts : add reset and regulators +Subject: [PATCH 206/407] Audioinjector addons dts : add reset and regulators for the Octo product. This patch adds a reset GPIO for the AudioInjector.net octo sound card. @@ -137818,10 +137790,10 @@ index dbf2f3cacc2e6bf5b7116fbadd97f2781580a79c..a36fa85a61f7eaab35ca481ed1dac621 codec = <&cs42448>; status = "okay"; -From 2be41b56296e6c9940aacfa248c7f517b51ec2b8 Mon Sep 17 00:00:00 2001 +From 534bccb82ed826bba791df37db02e10010a582d0 Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Mon, 27 Mar 2017 22:27:26 +1100 -Subject: [PATCH 208/333] AudioInjector Octo : Consolidate sample rates and add +Subject: [PATCH 207/407] AudioInjector Octo : Consolidate sample rates and add a codec reset. This patch consolidates the sample rates which the audioinjector.net octo @@ -137961,10 +137933,10 @@ index 9effea725798640887755dfa688da45338718afc..1198c36c4563b8673e5d386d1dfa92d4 dai->cpu_dai_name = NULL; dai->cpu_of_node = i2s_node; -From 1989504b19897950753d2372fb0304fb707159d7 Mon Sep 17 00:00:00 2001 +From 7104637e95c6d5098e31fe6a2c478c067e1d47d0 Mon Sep 17 00:00:00 2001 From: Peter Malkin Date: Mon, 27 Mar 2017 16:38:21 -0700 -Subject: [PATCH 209/333] Driver support for Google voiceHAT soundcard. +Subject: [PATCH 208/407] Driver support for Google voiceHAT soundcard. --- arch/arm/boot/dts/overlays/Makefile | 1 + @@ -138469,10 +138441,10 @@ index 0000000000000000000000000000000000000000..225854b8e5298b3c3018f59a49404354 +MODULE_DESCRIPTION("ASoC Driver for Google voiceHAT SoundCard"); +MODULE_LICENSE("GPL v2"); -From 65c719f9b7e44144da58d9123f8339793f01cf4c Mon Sep 17 00:00:00 2001 +From 8cf9c0059d8279611b231700cf452fe51a8abd7c Mon Sep 17 00:00:00 2001 From: Raashid Muhammed Date: Mon, 27 Mar 2017 12:35:00 +0530 -Subject: [PATCH 210/333] Add support for Allo Piano DAC 2.1 plus add-on board +Subject: [PATCH 209/407] Add support for Allo Piano DAC 2.1 plus add-on board for Raspberry Pi. The Piano DAC 2.1 has support for 4 channels with subwoofer. @@ -139100,10 +139072,10 @@ index 0000000000000000000000000000000000000000..f66f42abadbd5f9d3fe000676e8297ed +MODULE_DESCRIPTION("ALSA ASoC Machine Driver for Allo Piano DAC Plus"); +MODULE_LICENSE("GPL v2"); -From b2a4c96d4a003889c70f12134c67e3fa6e52dc80 Mon Sep 17 00:00:00 2001 +From aece32b2f14f8b63450e18262878ee44c7055c33 Mon Sep 17 00:00:00 2001 From: BabuSubashChandar Date: Tue, 28 Mar 2017 20:04:42 +0530 -Subject: [PATCH 211/333] Add support for Allo Boss DAC add-on board for +Subject: [PATCH 210/407] Add support for Allo Boss DAC add-on board for Raspberry Pi. (#1924) Signed-off-by: Baswaraj K @@ -139833,10 +139805,10 @@ index 0000000000000000000000000000000000000000..c080e31065d99ab309ab3bdf41a44adf +MODULE_DESCRIPTION("ALSA ASoC Machine Driver for Allo Boss DAC"); +MODULE_LICENSE("GPL v2"); -From 6b31bb19298813637f99900efc48dfa295cc1618 Mon Sep 17 00:00:00 2001 +From a0490bcf91458208b11b1dc2a0c39a565a5a74cd Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 28 Mar 2017 14:22:20 +0100 -Subject: [PATCH 212/333] BCM270X_DT: Allow multiple instances of w1-gpio +Subject: [PATCH 211/407] BCM270X_DT: Allow multiple instances of w1-gpio overlays Upcoming firmware will modify the address portion of node names when @@ -139901,10 +139873,10 @@ index 66a98f6c9601f51483f27803995bec772bb3350e..ef8bfbcabdb31231075d5c281df3b38b <&w1_pins>,"brcm,pins:4"; pullup = <&w1>,"rpi,parasitic-power:0"; -From 9b08c5e0748459b63b80358e66688544787c2a3b Mon Sep 17 00:00:00 2001 +From e236066d97809dffc9f8529a18dd80de97d38e1b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 28 Mar 2017 17:41:30 +0100 -Subject: [PATCH 213/333] leds-gpio: Remove stray assignment to brightness_set +Subject: [PATCH 212/407] leds-gpio: Remove stray assignment to brightness_set The brightness_set method is intended for use cases that must not block, and can only be used if the GPIO provider can never sleep. @@ -139930,10 +139902,10 @@ index 6a27a693034825de2897bb7b338b60cc10c9e59f..a6b352cb003ff5e6c87cf6d37d6502b6 if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) { state = gpiod_get_value_cansleep(led_dat->gpiod); -From 0a359745428a2ba445ee5751a6e052207d59bc4d Mon Sep 17 00:00:00 2001 +From 02182d636296fb8bbe77db65bc623bb993f14e16 Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Thu, 30 Mar 2017 11:43:57 +1100 -Subject: [PATCH 214/333] Audioinjector Octo : add extra sample rates, fix rst +Subject: [PATCH 213/407] Audioinjector Octo : add extra sample rates, fix rst and use bcm270x regs This patch adds new sample rates to the Audioinjector Octo sound card. The @@ -140095,10 +140067,10 @@ index 1198c36c4563b8673e5d386d1dfa92d43689e297..dcf403ab37639ba79e38278d7e4b1ade if (i2s_node && codec_node) { dai->cpu_dai_name = NULL; -From ac1ef1aced6e748e2094fccec486e867b374e367 Mon Sep 17 00:00:00 2001 +From 04d2f79b9d7d2f901a06ada1b83686d86185d0e9 Mon Sep 17 00:00:00 2001 From: BabuSubashChandar C Date: Thu, 30 Mar 2017 20:17:27 +0530 -Subject: [PATCH 215/333] Add support for new clock rate and mute gpios. +Subject: [PATCH 214/407] Add support for new clock rate and mute gpios. Signed-off-by: Baswaraj K Reviewed-by: Deepak @@ -140751,10 +140723,10 @@ index c080e31065d99ab309ab3bdf41a44adfdd8f8039..203ab76c7045b081578e23bda1099dd1 } -From b0da4e1f86c6d235fd7bd91513adb26ec81ed10a Mon Sep 17 00:00:00 2001 +From 54addab08f3886ecf09958c0c2fc5362f132afea Mon Sep 17 00:00:00 2001 From: BabuSubashChandar Date: Sat, 1 Apr 2017 00:46:52 +0530 -Subject: [PATCH 216/333] Add clock changes and mute gpios (#1938) +Subject: [PATCH 215/407] Add clock changes and mute gpios (#1938) Also improve code style and adhere to ALSA coding conventions. @@ -141447,10 +141419,10 @@ index f66f42abadbd5f9d3fe000676e8297ed91630e47..56e43f98846b41e487b3089813f7edc3 } -From ebc64b0430419668191cc23857180fd5159f1115 Mon Sep 17 00:00:00 2001 +From 63a93cf37a6632dcccb8051ad6108b4f2e8e6a85 Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Tue, 4 Apr 2017 19:20:59 +1000 -Subject: [PATCH 217/333] Audioinjector : make the octo and pi sound cards have +Subject: [PATCH 216/407] Audioinjector : make the octo and pi sound cards have different driver names This patch gives the audioinjector octo and pi soundcards different driver @@ -141487,10 +141459,10 @@ index ef54e0f07ea03f59e9957b5d98f3e7fdc998e469..491906bbf446826e55dd843f28e4860f .of_match_table = audioinjector_pi_soundcard_of_match, }, -From be67cecffca5025339d71ea31df497d5312f5479 Mon Sep 17 00:00:00 2001 +From 9c3b38122805836515d0ad42aa3071a8fb22e856 Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Tue, 4 Apr 2017 19:23:04 +1000 -Subject: [PATCH 218/333] Audioinjector octo : Make the playback and capture +Subject: [PATCH 217/407] Audioinjector octo : Make the playback and capture symmetric This patch ensures that the sample rate and channel count of the audioinjector @@ -141513,10 +141485,10 @@ index 49115c8e20ce1a2ba5a99feb8983a1cafb052ca2..5e79f4eff93a21ed3495c77a90f73525 }; -From dde81db3416d34a0cf6901acede568d1e014317e Mon Sep 17 00:00:00 2001 +From d012a88ebbd52b8e2cd4ba0bda6ef9103f6da5b8 Mon Sep 17 00:00:00 2001 From: Yasunari Takiguchi Date: Fri, 14 Apr 2017 10:43:57 +0100 -Subject: [PATCH 219/333] This is the driver for Sony CXD2880 DVB-T2/T tuner + +Subject: [PATCH 218/407] This is the driver for Sony CXD2880 DVB-T2/T tuner + demodulator. It includes the CXD2880 driver and the CXD2880 SPI adapter. The current CXD2880 driver version is 1.4.1 - 1.0.1 released on April 13, 2017. @@ -157648,10 +157620,10 @@ index 0000000000000000000000000000000000000000..82e122349055be817eb74ed5bbcd7560 +MODULE_AUTHOR("Sony Semiconductor Solutions Corporation"); +MODULE_LICENSE("GPL v2"); -From b8e6e24c6efb61ca4539ac3ecfae9c7bf46e68dc Mon Sep 17 00:00:00 2001 +From c57b543b45767d3a7775a3a15aa7ba57b5488b62 Mon Sep 17 00:00:00 2001 From: Yasunari Takiguchi Date: Thu, 22 Dec 2016 15:34:12 +0900 -Subject: [PATCH 220/333] BCM2708: Add Raspberry Pi TV HAT Device Tree Support +Subject: [PATCH 219/407] BCM2708: Add Raspberry Pi TV HAT Device Tree Support This is an EXAMPLE CODE of Raspberry Pi TV HAT device tree overlay. Although this is not a part of our release code, it has been used to verify @@ -157747,10 +157719,10 @@ index 0000000000000000000000000000000000000000..a68f6f793d8efd8b2e2adf9f2fb6426f + +}; -From 4c39be9c974a4e0e9c1de98900325cb9cece2075 Mon Sep 17 00:00:00 2001 +From 68fb082466ea477ed4711d42d27fdf89344d37a7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 7 Mar 2017 14:51:03 -0800 -Subject: [PATCH 221/333] drm/vc4: Allow using more than 256MB of CMA memory. +Subject: [PATCH 220/407] drm/vc4: Allow using more than 256MB of CMA memory. Until now, we've had to limit Raspberry Pi to 256MB of CMA memory to keep from triggering the hardware addressing bug between of the tile @@ -158235,10 +158207,10 @@ index 9fd171c361c23b52a4d507919ec7e26fd1e87aac..59d808e2a6cc6f3173b1309cc4f49109 return 0; } -From 4487afaf36cde6aaf368347d1cc5596c0143e07f Mon Sep 17 00:00:00 2001 +From b23263394360e7c31c191a4791c4cecff458be40 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 30 Mar 2017 10:23:27 -0700 -Subject: [PATCH 222/333] Revert "drm/vc4: Verify at boot that CMA doesn't +Subject: [PATCH 221/407] Revert "drm/vc4: Verify at boot that CMA doesn't cross a 256MB boundary." This reverts commit 016c804fa69381bd23a1a13cba08a3c4557fcdff. The @@ -158319,10 +158291,10 @@ index b50245282a18bc790da0f901944c2e670ffac2d2..c960459eda7e640ea55be1d4ed80c6a9 static unsigned long cma_bitmap_aligned_mask(const struct cma *cma, int align_order) -From 69e9d3daf36df62bd21df30798019bc4f28c17c5 Mon Sep 17 00:00:00 2001 +From f8ab62f5172ac09fecc2059b40cd3453c3197c7a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Feb 2017 12:28:02 -0800 -Subject: [PATCH 223/333] drm/vc4: Add HDMI audio support +Subject: [PATCH 222/407] drm/vc4: Add HDMI audio support The HDMI encoder IP embeds all needed blocks to output audio, with a custom DAI called MAI moving audio between the two parts of the HDMI @@ -159091,10 +159063,10 @@ index 385405a2df05eb3dd86d4f687aa8205331bec3cc..932093936178674173a84002b33e07e9 #define VC4_HD_VID_CTL 0x038 # define VC4_HD_VID_CTL_ENABLE BIT(31) -From 23f0997dce132380f019e49bedcc92523dfd4be6 Mon Sep 17 00:00:00 2001 +From 99dd1f559b2cc266442ad24e8d733d3e489b7d87 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 2 Feb 2017 11:37:36 +0100 -Subject: [PATCH 224/333] ARM: dts: bcm283x: Add HDMI audio related properties +Subject: [PATCH 223/407] ARM: dts: bcm283x: Add HDMI audio related properties Add the dmas and dma-names properties to support HDMI audio. @@ -159119,10 +159091,10 @@ index 348c71bbc913644c04bab43fcb95abe9b6c9c640..7d58cd79ac6bd99f0b47a909ac827c61 }; -From 6387bb28e59ecae300fc0cbf41972329eac21160 Mon Sep 17 00:00:00 2001 +From 79a854e918f199a8b43ff91e6adbca1037cbf6bc Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 12 Apr 2017 17:52:56 -0700 -Subject: [PATCH 225/333] panel-raspberrypi-touchscreen: Fix NULL deref if +Subject: [PATCH 224/407] panel-raspberrypi-touchscreen: Fix NULL deref if probe order goes wrong. If the i2c driver hadn't pobed before the panel driver probes, then @@ -159149,10 +159121,10 @@ index 7f315f04b109621ca7f3861fdd8acf956e752629..b57b7ad9aa4c5048186e98553af59ec9 } -From 14cc03bcb577b43c3bb85d852d550236684b0fd1 Mon Sep 17 00:00:00 2001 +From 2f0aef1f33f8c4a088a9eac662eb1a98d24b31c2 Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Wed, 19 Apr 2017 09:59:21 -0700 -Subject: [PATCH 226/333] smsc75xx: use skb_cow_head() to deal with cloned skbs +Subject: [PATCH 225/407] smsc75xx: use skb_cow_head() to deal with cloned skbs We need to ensure there is enough headroom to push extra header, but we also need to check if we are allowed to change headers. @@ -159188,10 +159160,10 @@ index 9af9799935dbbd4baed06eb03402803e0ce8d9c8..4cb9b11a545a9572ab6d248742ec5abe tx_cmd_a = (u32)(skb->len & TX_CMD_A_LEN) | TX_CMD_A_FCS; -From da587c2ee8f8a5b46534340a1e92cb9df147d258 Mon Sep 17 00:00:00 2001 +From bbc5f254b082695c6f311bb3966f187ca59f8591 Mon Sep 17 00:00:00 2001 From: James Hughes Date: Wed, 19 Apr 2017 11:13:40 +0100 -Subject: [PATCH 227/333] smsc95xx: Use skb_cow_head to deal with cloned skbs +Subject: [PATCH 226/407] smsc95xx: Use skb_cow_head to deal with cloned skbs The driver was failing to check that the SKB wasn't cloned before adding checksum data. @@ -159231,10 +159203,10 @@ index df60c989fc229bf0aab3c27e95ccd45323367840..f6661e388f6e801c1b88e48a3b71407b if (csum) { -From f72710e733975484459533ea35a73479d62eabce Mon Sep 17 00:00:00 2001 +From 8654db5d7dce525ca562bf4f2d1eb053e1556c3d Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Sun, 23 Apr 2017 19:36:53 +0100 -Subject: [PATCH 228/333] BCM270X_DT: Add bme280 and bmp180 to i2c-sensor +Subject: [PATCH 227/407] BCM270X_DT: Add bme280 and bmp180 to i2c-sensor overlay Signed-off-by: Phil Elwell @@ -159308,10 +159280,10 @@ index 606b2d5012abf2e85712be631c42ea40a0b512c5..e23e34b32a0a8927c14203d7384e8008 lm75 = <&lm75>,"status"; lm75addr = <&lm75>,"reg:0"; -From 9c6ebf2b652d737127a217961f9d6d19f92d4be1 Mon Sep 17 00:00:00 2001 +From 9bff223f5b50535f6093b166814eac159a72cbaa Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Sun, 23 Apr 2017 19:38:06 +0100 -Subject: [PATCH 229/333] config: Add CONFIG_BMP280 (and CONFIG_BMP280_I2C) +Subject: [PATCH 228/407] config: Add CONFIG_BMP280 (and CONFIG_BMP280_I2C) Signed-off-by: Phil Elwell --- @@ -159396,10 +159368,10 @@ index fd535ff21e7dab6717eb61f1b966b7d92791ec8d..7948b445f1232064dea01273393f3e3b CONFIG_PWM_PCA9685=m CONFIG_RASPBERRYPI_FIRMWARE=y -From d1058718f92cbb823043da569cb98a880d4d5716 Mon Sep 17 00:00:00 2001 +From a841dbe0f4e269ac6adec812042c17c1161f717c Mon Sep 17 00:00:00 2001 From: Scott Ellis Date: Tue, 25 Apr 2017 10:46:09 -0400 -Subject: [PATCH 230/333] config: Enable TI TMP102 temp sensor module +Subject: [PATCH 229/407] config: Enable TI TMP102 temp sensor module Signed-off-by: Scott Ellis --- @@ -159432,10 +159404,10 @@ index 7948b445f1232064dea01273393f3e3b135b4576..a338c313de9e9db3a338d066b5fad989 CONFIG_THERMAL_BCM2835=y CONFIG_WATCHDOG=y -From a50ff15f843b7efbe966a654775b816d262bf549 Mon Sep 17 00:00:00 2001 +From ea960ddb6362f189ddfb2f7227001eb3d5a420d9 Mon Sep 17 00:00:00 2001 From: Scott Ellis Date: Tue, 25 Apr 2017 13:05:42 -0400 -Subject: [PATCH 231/333] BCM270X_DT: Add tmp102 to i2c sensor overlay +Subject: [PATCH 230/407] BCM270X_DT: Add tmp102 to i2c sensor overlay Signed-off-by: Scott Ellis --- @@ -159515,10 +159487,10 @@ index e23e34b32a0a8927c14203d7384e800878627347..e86a13f92c3f75c14fa4425cdfb081d6 }; }; -From 84b365b047026902b1ce484e99acde3da633daa8 Mon Sep 17 00:00:00 2001 +From 4e76f86083e2e1c7b1cb8a02311a533be8ba5a38 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 26 Apr 2017 16:51:48 +0100 -Subject: [PATCH 232/333] dwc_otg: Add the dependency on FIQ +Subject: [PATCH 231/407] dwc_otg: Add the dependency on FIQ Signed-off-by: popcornmix --- @@ -159526,7 +159498,7 @@ Signed-off-by: popcornmix 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig -index f17b939c149562527937f49d90e23c7ab8b72328..5a5f6c925f43147082dcfaab15f9e05ed966838c 100644 +index 52fba4f05b8c817e1d58e6078bbb771d541e89a7..ed1d19b74e2fb0bc4143ca0193ca8ac459c8ef35 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -764,7 +764,7 @@ config USB_HWA_HCD @@ -159539,10 +159511,10 @@ index f17b939c149562527937f49d90e23c7ab8b72328..5a5f6c925f43147082dcfaab15f9e05e The Synopsis DWC controller is a dual-role host/peripheral/OTG ("On The Go") USB controllers. -From c55b495eada1dcd955d4094e008d70cc9952b98a Mon Sep 17 00:00:00 2001 +From 4155b1f1ece679613bf1155d1aae7d1de7570c1e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 26 Apr 2017 17:28:47 +0100 -Subject: [PATCH 233/333] clk: bcm2835: Limit PCM clock to OSC and PLLD_PER +Subject: [PATCH 232/407] clk: bcm2835: Limit PCM clock to OSC and PLLD_PER It is unwise to use sources other than the oscillator and PLLD_PER for the PCM peripheral (and perhaps others - TBD) because their rate can @@ -159587,10 +159559,10 @@ index fe3298b54cdfb96bd90fb4f39e13921d2e1d4356..c24b4defb2b046e4ecdc109befc2b224 [BCM2835_CLOCK_PWM] = REGISTER_PER_CLK( .name = "pwm", -From 0c5ed6da01f0d05b1698cfd2d30350822c0c1d7a Mon Sep 17 00:00:00 2001 +From b1e22073211bad3295be76cc4761420eb25d68fd Mon Sep 17 00:00:00 2001 From: P33M Date: Thu, 27 Apr 2017 16:24:34 +0100 -Subject: [PATCH 234/333] dwc_otg: make nak_holdoff work as intended with empty +Subject: [PATCH 233/407] dwc_otg: make nak_holdoff work as intended with empty queues If URBs reading from non-periodic split endpoints were dequeued and @@ -159674,10 +159646,10 @@ index c2dff94e8e6edd22e4427aaa1eac7aad972cb6bd..85a6d431ca54b47dc10573aa72d1ad69 } else { uint16_t frame_number = dwc_otg_hcd_get_frame_number(hcd); -From bca5c2327bc50bf3818919ee384bc0a384559231 Mon Sep 17 00:00:00 2001 +From e107020047bcfd006ea02f6c7218df16dd5fc93b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 18 Apr 2017 21:43:46 +0100 -Subject: [PATCH 235/333] vc4_fkms: Apply firmware overscan offset to hardware +Subject: [PATCH 234/407] vc4_fkms: Apply firmware overscan offset to hardware cursor --- @@ -159734,10 +159706,10 @@ index da818a207bfa639b8cea48d94bcf4566f97db816..943cbb38f1f2e6fc7c06870be7904677 return 0; -From 08b67d911abf6b676ba85f204a169d78661560eb Mon Sep 17 00:00:00 2001 +From 11f9c9ef7aea0a2dc48b074d1ba01df933ab5d1a Mon Sep 17 00:00:00 2001 From: P33M Date: Tue, 2 May 2017 16:31:15 +0100 -Subject: [PATCH 236/333] dwc_otg: fix split transaction data toggle handling +Subject: [PATCH 235/407] dwc_otg: fix split transaction data toggle handling around dequeues See https://github.com/raspberrypi/linux/issues/1709 @@ -159825,10 +159797,10 @@ index 608e036be2c9484465ab836de70129335d3d2d96..718a1accc0c219a1764ce53d291de6a2 } qtd = DWC_CIRCLEQ_FIRST(&hc->qh->qtd_list); -From e72d7748c486d5e3cf6da08e12fd7dbb026460fe Mon Sep 17 00:00:00 2001 +From 8d0c81a08f638e3d1de4e83dd2600f6485fd7a2c Mon Sep 17 00:00:00 2001 From: P33M Date: Thu, 4 May 2017 14:56:08 +0100 -Subject: [PATCH 237/333] fiq_fsm: Use correct states when starting isoc OUT +Subject: [PATCH 236/407] fiq_fsm: Use correct states when starting isoc OUT transfers (#1991) * fiq_fsm: Use correct states when starting isoc OUT transfers @@ -159867,10 +159839,10 @@ index 9304279592cb5b388086ef91cb52f1e9f94868ce..208252645c09d1d17bf07673989f91b7 break; } -From c57c2e47041c54ae6fada86ee55acee32ea4f2ba Mon Sep 17 00:00:00 2001 +From f7d6f62fc5d9516064da80675a4cf530e5aa4540 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 2 May 2017 16:36:05 +0100 -Subject: [PATCH 238/333] vcsm: Treat EBUSY as success rather than SIGBUS +Subject: [PATCH 237/407] vcsm: Treat EBUSY as success rather than SIGBUS Currently if two cores access the same page concurrently one will return VM_FAULT_NOPAGE and the other VM_FAULT_SIGBUS crashing the user code. @@ -159908,10 +159880,10 @@ index 1db6716c2c0c8b2013203391501f92d09db258af..ee4e05948c439a9045e0b65566d57587 } } -From 7868a2b49cda01c6cf379c7f6031d5a4938c5f44 Mon Sep 17 00:00:00 2001 +From e594af40141383d0c4e71b8ab7e90e312becbcea Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 4 May 2017 17:38:22 +0100 -Subject: [PATCH 239/333] bcm2708_fb: Avoid firmware mbox call in vc_mem_copy +Subject: [PATCH 238/407] bcm2708_fb: Avoid firmware mbox call in vc_mem_copy If firmware has locked up it is useful to get vcdbg log out without a firmware mbox response. Issue the mbox call at probe time instead. @@ -159975,10 +159947,10 @@ index 53c5a0bdadb4be9251affdabed66305842a08e72..612293cf9f1bd93ad2f2aefdd7ca0f5e if (ret == 0) { platform_set_drvdata(dev, fb); -From 52a6e726152cabfa73d798b71b8c40720d268e93 Mon Sep 17 00:00:00 2001 +From 6c5ca19fd3a6e10dba806ecbc4e898212c82a44f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 5 May 2017 13:23:10 +0100 -Subject: [PATCH 240/333] Revert "serial: 8250: Don't crash when nr_uarts is 0" +Subject: [PATCH 239/407] Revert "serial: 8250: Don't crash when nr_uarts is 0" This reverts commit 9c297d9ebd0d8c6d5e6e8675d527d6a221613abc. --- @@ -159999,10 +159971,10 @@ index cf9c7d2e3f95e1a19410247a89c2e49c1a2747a8..e8819aa20415603c80547e382838a8fa for (i = 0; i < nr_uarts; i++) { struct uart_8250_port *up = &serial8250_ports[i]; -From dd538e060fe82d22db0539fa979e2843cc4f73b3 Mon Sep 17 00:00:00 2001 +From 391dad3ee367155b162abb37764fb5b019be0a30 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 8 May 2017 16:30:18 +0100 -Subject: [PATCH 241/333] ARM: dts: bcm283x: Reserve first page for firmware +Subject: [PATCH 240/407] ARM: dts: bcm283x: Reserve first page for firmware The Raspberry Pi startup stub files for multi-core BCM27XX processors make the secondary CPUs spin until the corresponding mailbox is @@ -160049,10 +160021,10 @@ index 7d58cd79ac6bd99f0b47a909ac827c61aac642d9..0bc1932cde435bd151ffc2364bca5cd9 * bcm2835 and bcm2836 implementations, leaving the CPU configuration to * bcm2835.dtsi and bcm2836.dtsi. -From 52f380d6932c2520cb00b6f421e0755796eeb37a Mon Sep 17 00:00:00 2001 +From 9e530db4c3b0518ba30a0dab8f99ad4bf9fa5b7f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 8 May 2017 16:43:40 +0100 -Subject: [PATCH 242/333] irq_bcm2836: Send event when onlining sleeping cores +Subject: [PATCH 241/407] irq_bcm2836: Send event when onlining sleeping cores In order to reduce power consumption and bus traffic, it is sensible for secondary cores to enter a low-power idle state when waiting to @@ -160088,10 +160060,10 @@ index e10597c1a1e51e5e27aa574b6a26d87181f26221..6dccdf94f6f3b4c6a3f6cb1cae5a6ab2 } -From aaa6dd2c725e81adf9f0f8c24b7515f98cb8d38d Mon Sep 17 00:00:00 2001 +From e520ca557a5d972b809823d73dc5be2996896bcd Mon Sep 17 00:00:00 2001 From: Nisar Sayed Date: Tue, 9 May 2017 18:51:42 +0100 -Subject: [PATCH 243/333] According to RFC 2460, IPv6 UDP calculated checksum +Subject: [PATCH 242/407] According to RFC 2460, IPv6 UDP calculated checksum yields a result of zero must be changed to 0xffff, however this feature is not supported by smsc95xx family hence enable csum offload only for IPv4 TCP/UDP packets. @@ -160136,10 +160108,10 @@ index f6661e388f6e801c1b88e48a3b71407bd70cf56e..b84e98508b5d97165b68dfc30240950e smsc95xx_init_mac_address(dev); -From 78f7bb3c85a115502922bce10458d5540660341b Mon Sep 17 00:00:00 2001 +From a3d9e90a4a48ec130ad224becd4a1ca20c82ed7e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 10 May 2017 12:47:46 +0100 -Subject: [PATCH 244/333] dwcotg: Allow to build without FIQ on ARM64 +Subject: [PATCH 243/407] dwcotg: Allow to build without FIQ on ARM64 Signed-off-by: popcornmix --- @@ -160147,7 +160119,7 @@ Signed-off-by: popcornmix 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig -index 5a5f6c925f43147082dcfaab15f9e05ed966838c..c50476b3d72471faf94c280aab756599fe55ac90 100644 +index ed1d19b74e2fb0bc4143ca0193ca8ac459c8ef35..f3cecb64a380c6d7fca6116c2f94ca42eb3c1aba 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -764,7 +764,7 @@ config USB_HWA_HCD @@ -160160,10 +160132,10 @@ index 5a5f6c925f43147082dcfaab15f9e05ed966838c..c50476b3d72471faf94c280aab756599 The Synopsis DWC controller is a dual-role host/peripheral/OTG ("On The Go") USB controllers. -From 1c9f4d9894f4937dab498689409672390bf01c21 Mon Sep 17 00:00:00 2001 +From bc02dc578a2b8b5e1384ca7f975c8d2b7f51a21c Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 11 May 2017 16:58:16 +0100 -Subject: [PATCH 245/333] BCM270X_DT: Tidy up mmc, sdhost, sdio overlays +Subject: [PATCH 244/407] BCM270X_DT: Tidy up mmc, sdhost, sdio overlays The mmc, sdhost, sdio and sdio-1bit overlays had a few anachronisms and oddities which were overdue for fixing. @@ -160272,10 +160244,10 @@ index 398bd812c716c9e472fbac5aba4fe882114c65d1..215d5e3e8a8ca4363457fed1f7425427 }; }; -From 263b1cf91a5074b6ad8ff7741e22ab7ff5d7240e Mon Sep 17 00:00:00 2001 +From c14613800eaeaacea7abe1dc99ed85d57b21192c Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 11 May 2017 22:00:20 +0100 -Subject: [PATCH 246/333] SQUASH: BCM270X_DT: Fix typo in mmc overlay +Subject: [PATCH 245/407] SQUASH: BCM270X_DT: Fix typo in mmc overlay Signed-off-by: Phil Elwell --- @@ -160296,10 +160268,10 @@ index 64f1ff6684b19e76cfd00e6950919ac55227b44b..88251ad653917674f80c2975de2e425f }; }; -From e4b92ba7962dafe9d49a64fa658756ee9c504644 Mon Sep 17 00:00:00 2001 +From 0cb69678640828cf82be7f4be13de2e6bf6c3e86 Mon Sep 17 00:00:00 2001 From: P33M Date: Fri, 12 May 2017 12:24:00 +0100 -Subject: [PATCH 247/333] dwc_otg: fix several potential crash sources +Subject: [PATCH 246/407] dwc_otg: fix several potential crash sources On root port disconnect events, the host driver state is cleared and in-progress host channels are forcibly stopped. This doesn't play @@ -160495,10 +160467,10 @@ index 718a1accc0c219a1764ce53d291de6a2b6f93608..cf23baaa388562b5843be4cfa6c206cb release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); break; -From 0c4f6f431d459ef66de3062912b6759012ebe4ad Mon Sep 17 00:00:00 2001 +From 30ec82c009467c990a975860be5db8c48090733b Mon Sep 17 00:00:00 2001 From: P33M Date: Mon, 15 May 2017 14:27:48 +0100 -Subject: [PATCH 248/333] dwc_otg: delete hcd->channel_lock +Subject: [PATCH 247/407] dwc_otg: delete hcd->channel_lock The lock serves no purpose as it is only held while the HCD spinlock is already being held. @@ -160650,10 +160622,10 @@ index cf23baaa388562b5843be4cfa6c206cbdc4e780d..a4355afc77b68718fdaba6c5d4be257d /* Try to queue more transfers now that there's a free channel. */ -From a8d2416fac4026ad0a641e5967aee44ba5ab0084 Mon Sep 17 00:00:00 2001 +From 5561138ed8658d666e4cf4fdc59b9948e8323a1e Mon Sep 17 00:00:00 2001 From: P33M Date: Mon, 15 May 2017 14:51:42 +0100 -Subject: [PATCH 249/333] dwc_otg: remove unnecessary dma-mode channel halts on +Subject: [PATCH 248/407] dwc_otg: remove unnecessary dma-mode channel halts on disconnect interrupt Host channels are already halted in kill_urbs_in_qh_list() with the @@ -160721,10 +160693,10 @@ index 5ec991624c7865901b22ea01b9f2c58c8535ecfd..a2dc6337836b2719f4c954edeeb2a713 if(fiq_enable) { -From e6d972368d1a1fba8ba9235f1ee954b3cc174e41 Mon Sep 17 00:00:00 2001 +From cb7350ac93a58fbdfe016e4cc00b3f0c3eeb8810 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 15 May 2017 09:28:36 -0700 -Subject: [PATCH 250/333] drm/vc4: Mark the device as active when enabling +Subject: [PATCH 249/407] drm/vc4: Mark the device as active when enabling runtime PM. Failing to do so meant that we got a resume() callback on first use of @@ -160750,10 +160722,10 @@ index 882ec06225f1d5caca71bdb5c69664188192c2e2..77ed4ef3b8c8685a3cd8c871bbd249de pm_runtime_set_autosuspend_delay(dev, 40); /* a little over 2 frames. */ pm_runtime_enable(dev); -From d79fb0d3b97c76614e9910f670969ff13d377334 Mon Sep 17 00:00:00 2001 +From a393a21a27f525daf0259f6925fb6081ee2b82ca Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 15 May 2017 11:35:13 -0700 -Subject: [PATCH 251/333] BCM270X: Drop position requirement for CMA in VC4 +Subject: [PATCH 250/407] BCM270X: Drop position requirement for CMA in VC4 overlay. No longer necessary since 2aefcd576195a739a7a256099571c9c4a401005f, @@ -160811,10 +160783,10 @@ index c57e795824e9261e0f60bcb40d6a57241019fd91..bf9395041face775d335177583e0b222 }; -From 9ddcbb20e8821799abca73f5d16923a651a80d12 Mon Sep 17 00:00:00 2001 +From 896bf23232157468b3bee3c37b379410c980b7e3 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Mon, 15 May 2017 16:55:56 +0200 -Subject: [PATCH 252/333] config: Add Goodix touch controller module +Subject: [PATCH 251/407] config: Add Goodix touch controller module Signed-off-by: Ahmet Inan --- @@ -160847,10 +160819,10 @@ index a338c313de9e9db3a338d066b5fad989f6ece1ad..c274e53142ce231819e6421df1257e8a CONFIG_TOUCHSCREEN_USB_COMPOSITE=m CONFIG_TOUCHSCREEN_STMPE=m -From a372b3bde16a61c4c58a19b981f11efd6999e5f0 Mon Sep 17 00:00:00 2001 +From a2ec4dfc5564de9caeaa2a1af65a0a892aaed8f7 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Mon, 15 May 2017 17:10:53 +0200 -Subject: [PATCH 253/333] overlays: Add Goodix overlay +Subject: [PATCH 252/407] overlays: Add Goodix overlay Add support for I2C connected Goodix gt9271 multiple touch controller using GPIOs 4 and 17 (pins 7 and 11 on GPIO header) for interrupt and reset. @@ -160947,10 +160919,10 @@ index 0000000000000000000000000000000000000000..084f74042ed6379ebd9281374d5391a7 + }; +}; -From c29a0a0112c46077abf2233b026f56a95c2b5e11 Mon Sep 17 00:00:00 2001 +From f2e2ec491764f10046e6585bc681120864cef9c9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 16 May 2017 16:55:36 +0100 -Subject: [PATCH 254/333] config: Drop CONFIG_TOUCHSCREEN_EKTF2127 +Subject: [PATCH 253/407] config: Drop CONFIG_TOUCHSCREEN_EKTF2127 --- arch/arm/configs/bcm2709_defconfig | 1 - @@ -160969,10 +160941,10 @@ index c4c5b42016e54d87b9f8f99354b164a0548980f7..fdd17f5625e889257e69c90a0679dc9b CONFIG_TOUCHSCREEN_USB_COMPOSITE=m CONFIG_TOUCHSCREEN_STMPE=m -From f29ec3113a45dd6a4b20154fc6a3265c1b4ab7ae Mon Sep 17 00:00:00 2001 +From 6c8fcf77047dddff95f2e0d2e17a40aa8e32a1cd Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 16 May 2017 15:58:00 +0100 -Subject: [PATCH 255/333] config: Add CONFIG_TOUCHSCREEN_EDT_FT5X06 +Subject: [PATCH 254/407] config: Add CONFIG_TOUCHSCREEN_EDT_FT5X06 --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -161004,10 +160976,10 @@ index c274e53142ce231819e6421df1257e8a3544fd94..d50e88455b4ba5a891a47c2416a09f94 CONFIG_TOUCHSCREEN_USB_COMPOSITE=m CONFIG_TOUCHSCREEN_STMPE=m -From 364fc8ffa627e28b93e1a1afd4b0a05a1c3b3567 Mon Sep 17 00:00:00 2001 +From 23af01481dd0136c4c3293cbefd96e3ade99d545 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 16 May 2017 19:34:52 +0100 -Subject: [PATCH 256/333] config: Add CONFIG_I2C_ROBOTFUZZ_OSIF +Subject: [PATCH 255/407] config: Add CONFIG_I2C_ROBOTFUZZ_OSIF --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -161039,10 +161011,10 @@ index d50e88455b4ba5a891a47c2416a09f9402435b90..9699c93fbb6934b3fded4704316f1ad4 CONFIG_SPI_BCM2835=m CONFIG_SPI_BCM2835AUX=m -From 76a879b00d5500622ac147219d7714e8d01bc951 Mon Sep 17 00:00:00 2001 +From f1b50b645be2b61e3a4d8e76120824d4dff426e1 Mon Sep 17 00:00:00 2001 From: chenzhiwo Date: Wed, 17 May 2017 16:34:57 +0800 -Subject: [PATCH 257/333] Add device tree overlay for GPIO connected rotary +Subject: [PATCH 256/407] Add device tree overlay for GPIO connected rotary encoder. See Documentation/input/rotary-encoder.txt for more information. --- @@ -161134,10 +161106,10 @@ index 0000000000000000000000000000000000000000..c0c6bccff60cc15d9a9bf59d2c7cba41 + }; +}; -From 4974cd29aa54f6a7c12c75172391fb0fc2d6b6e6 Mon Sep 17 00:00:00 2001 +From cb0a1c447acbb1d30364a7d57d14c40d2dd9f82b Mon Sep 17 00:00:00 2001 From: Ed Blake Date: Thu, 10 Nov 2016 18:07:54 +0000 -Subject: [PATCH 258/333] serial: 8250: Add IrDA to UART capabilities +Subject: [PATCH 257/407] serial: 8250: Add IrDA to UART capabilities commit 98838d95075a5295f3478ceba18bcccf472e30f4 upstream. @@ -161218,10 +161190,10 @@ index 48ec7651989b093fc015e44b59657c7000e11012..04185e03d7bec56197cb765377320044 #endif -From a35e61ba42c722e2897f67ed37c99fc2631c317b Mon Sep 17 00:00:00 2001 +From 7eb9fe377e1fbe6710e4ce411c4dc19b44b81677 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 19 May 2017 15:07:27 +0100 -Subject: [PATCH 259/333] serial: 8250: Add CAP_MINI, set for bcm2835aux +Subject: [PATCH 258/407] serial: 8250: Add CAP_MINI, set for bcm2835aux The AUX/mini-UART in the BCM2835 family of procesors is a cut-down 8250 clone. In particular it is lacking support for the following @@ -161273,10 +161245,10 @@ index e10f1244409b344b850ffbbd4af5757a66c875f1..a23c7da42ea81342efc26fb35a92a69d data->uart.port.regshift = 2; data->uart.port.type = PORT_16550; diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c -index f24d3030b98c8d7543ac52e3ebadc65ecfe745ee..2d7a63f69b90415d6e1b6eb1c10612f4aa9fbed2 100644 +index 1ef31e3ee4a1f37886e829deb8668883f8e21044..d8f6fd3276ea1b1976b6e01ed536e16e6f8124cd 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c -@@ -2558,6 +2558,12 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, +@@ -2554,6 +2554,12 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, unsigned long flags; unsigned int baud, quot, frac = 0; @@ -161290,10 +161262,10 @@ index f24d3030b98c8d7543ac52e3ebadc65ecfe745ee..2d7a63f69b90415d6e1b6eb1c10612f4 baud = serial8250_get_baud_rate(port, termios, old); -From 9239400aa108612a265ea0224e76acbb21a7732b Mon Sep 17 00:00:00 2001 +From 48e9218d085587bbb0c50cbd101feda13c9ee81e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 18 May 2017 11:40:43 +0100 -Subject: [PATCH 260/333] config: Add FB_TFT_ST7789V module +Subject: [PATCH 259/407] config: Add FB_TFT_ST7789V module --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -161325,10 +161297,10 @@ index 9699c93fbb6934b3fded4704316f1ad4c4a639d6..b4554044aad7faabd4db57a87c11dba8 CONFIG_FB_TFT_TLS8204=m CONFIG_FB_TFT_UC1701=m -From 4a4ddcc23eb42038987a1917e18d5ab77616b9a6 Mon Sep 17 00:00:00 2001 +From 1e12d311c766a10674ee3188d04c19128e9498dc Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Tue, 18 Mar 2014 23:33:27 +0000 -Subject: [PATCH 261/333] usb/serial/ch341: Add parity support +Subject: [PATCH 260/407] usb/serial/ch341: Add parity support Based on wireshark packet traces from a windows machine. @@ -161393,10 +161365,10 @@ index e98590aab633cd6491f2886842179d314ded5fe6..4f25aba5bdfcabe7304b18860be85275 if (C_BAUD(tty) == B0) priv->line_control &= ~(CH341_BIT_DTR | CH341_BIT_RTS); -From 619f68a75ac622aade40632199d57e32ba083834 Mon Sep 17 00:00:00 2001 +From 20b990f5fb7df5ae0c39585a06b3f23b333252c3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Sat, 20 May 2017 22:10:14 +0100 -Subject: [PATCH 262/333] overlays: README: remove vestigial SDIO parameters +Subject: [PATCH 261/407] overlays: README: remove vestigial SDIO parameters Signed-off-by: Phil Elwell --- @@ -161450,10 +161422,10 @@ index 95600381448b0b485dbbbeb592ae1e82a8acec08..d5aebbe2d514c07c0fae72f80173c086 (default on: polling once at boot-time) -From a5c25fb8e099a107691b560f701a46ace7f5a55c Mon Sep 17 00:00:00 2001 +From d4bcf9e4aff05d59b58a35b8485fae7c72140af1 Mon Sep 17 00:00:00 2001 From: Liviu Dudau Date: Wed, 1 Mar 2017 12:26:28 +0000 -Subject: [PATCH 263/333] ASoC: TLV320AIC23: Unquote NULL from control name +Subject: [PATCH 262/407] ASoC: TLV320AIC23: Unquote NULL from control name commit a03faba972cb0f9b3a46d8054e674d5492e06c38 upstream. @@ -161494,10 +161466,10 @@ index 410cae0f2060474313872d6b9110bf05d3368e43..628a8eeaab689eb85b6d3dba54ec5a98 /* input mux */ {"Capture Source", "Line", "Line Input"}, -From 4ab13528df18295c6661d0f2449470eb087a96fe Mon Sep 17 00:00:00 2001 +From 61c09113bfec7445045eb3ecea4fab57459b78b0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 22 May 2017 15:28:27 +0100 -Subject: [PATCH 264/333] config: Add CONFIG_IPV6_ROUTE_INFO +Subject: [PATCH 263/407] config: Add CONFIG_IPV6_ROUTE_INFO --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -161529,10 +161501,10 @@ index b4554044aad7faabd4db57a87c11dba8e088d7d4..d92392cbdfa6b76184bf22da7c69ecb0 CONFIG_INET6_ESP=m CONFIG_INET6_IPCOMP=m -From 990327af34eb43668b2b838dcbe3a5e0ae9ad816 Mon Sep 17 00:00:00 2001 +From f8c863d4934e650ee5d067e9731468ed65343ae9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 22 May 2017 13:35:28 +0100 -Subject: [PATCH 265/333] config: Add CONFIG_IPV6_SIT_6RD +Subject: [PATCH 264/407] config: Add CONFIG_IPV6_SIT_6RD --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -161564,10 +161536,10 @@ index d92392cbdfa6b76184bf22da7c69ecb09ffdc842..65f16f4f64dd7ad9e9d4a337ec64d769 CONFIG_IPV6_MULTIPLE_TABLES=y CONFIG_IPV6_SUBTREES=y -From caecba22bbcb583f8fd7f45b2fda62fd3fc667b0 Mon Sep 17 00:00:00 2001 +From 36d908defd09140f95e5f0847fcef5efe37250b6 Mon Sep 17 00:00:00 2001 From: Anton Onishchenko Date: Tue, 23 May 2017 18:55:46 +0300 -Subject: [PATCH 266/333] mpu6050 device tree overlay (#2031) +Subject: [PATCH 265/407] mpu6050 device tree overlay (#2031) Add overlay and config options for InvenSense MPU6050 6-axis motion detector. @@ -161682,10 +161654,10 @@ index 65f16f4f64dd7ad9e9d4a337ec64d769bbff2bee..442eb48d4cb418d596e0dbad4bf0742d CONFIG_PWM_BCM2835=m CONFIG_PWM_PCA9685=m -From fb5c8d1bf31baaa89c8abf8c889171c83ac0df9a Mon Sep 17 00:00:00 2001 +From 62b8ffe55c7525135fd7a9091feea8a23fd3f412 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 22 May 2017 13:56:41 +0100 -Subject: [PATCH 267/333] clk: bcm2835: Minimise clock jitter for PCM clock +Subject: [PATCH 266/407] clk: bcm2835: Minimise clock jitter for PCM clock Fractional clock dividers generate accurate average frequencies but with jitter, particularly when the integer divisor is small. @@ -161810,10 +161782,10 @@ index c24b4defb2b046e4ecdc109befc2b22497060647..db3ba74acf78f4dfec0d2206b58bc7c3 .tcnt_mux = 23), [BCM2835_CLOCK_PWM] = REGISTER_PER_CLK( -From bd59e1ea4726080dc6f09abc6825fb1bb3a8a3cd Mon Sep 17 00:00:00 2001 +From 5970b3c3b4bbc7b0ae29f1041fad55003db1dfbe Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 24 May 2017 18:06:02 +0100 -Subject: [PATCH 268/333] Revert "hid: Reduce default mouse polling interval to +Subject: [PATCH 267/407] Revert "hid: Reduce default mouse polling interval to 60Hz" This reverts commit b45c0448b60d691508251cdccf242ea43bbabb14. @@ -161822,7 +161794,7 @@ This reverts commit b45c0448b60d691508251cdccf242ea43bbabb14. 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index 4a7af9d0b910f59d17421ce14138400dfd5834f3..ae83af649a607f67239f1a64bf45dd4b5770cc7d 100644 +index fb8777ab070b699ba50fd8bc8d9d86971f6f9f93..7838343eb37c541d698a7e78ff265e789fda7c98 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -49,7 +49,7 @@ @@ -161834,7 +161806,7 @@ index 4a7af9d0b910f59d17421ce14138400dfd5834f3..ae83af649a607f67239f1a64bf45dd4b module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); -@@ -1083,12 +1083,8 @@ static int usbhid_start(struct hid_device *hid) +@@ -1093,12 +1093,8 @@ static int usbhid_start(struct hid_device *hid) } /* Change the polling interval of mice. */ @@ -161850,10 +161822,10 @@ index 4a7af9d0b910f59d17421ce14138400dfd5834f3..ae83af649a607f67239f1a64bf45dd4b ret = -ENOMEM; if (usb_endpoint_dir_in(endpoint)) { -From a013be8f93b5bf9f661faecbbbfd743bebe48438 Mon Sep 17 00:00:00 2001 +From cb48e8e0511f5bc28c019c6788a8a87c08c3f05c Mon Sep 17 00:00:00 2001 From: Tobias Jakobi Date: Sat, 25 Feb 2017 20:27:27 +0100 -Subject: [PATCH 269/333] HID: usbhid: extend polling interval configuration to +Subject: [PATCH 268/407] HID: usbhid: extend polling interval configuration to joysticks For mouse devices we can currently change the polling interval @@ -161886,7 +161858,7 @@ index 86a6746f683393982cc93a6c3b99b989adbb1df8..d2e1858cf7e1d8ddfb0b81bc1e32e11a [UMS] The delay in seconds before a new device is scanned for Logical Units (default 1). diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index ae83af649a607f67239f1a64bf45dd4b5770cc7d..f7a692f9e50cdc80ebebab1ea260cde29b32d147 100644 +index 7838343eb37c541d698a7e78ff265e789fda7c98..22a955c5cc7e2ac83362c2bdc1a247b4776c9c08 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -53,6 +53,10 @@ static unsigned int hid_mousepoll_interval; @@ -161900,7 +161872,7 @@ index ae83af649a607f67239f1a64bf45dd4b5770cc7d..f7a692f9e50cdc80ebebab1ea260cde2 static unsigned int ignoreled; module_param_named(ignoreled, ignoreled, uint, 0644); MODULE_PARM_DESC(ignoreled, "Autosuspend with active leds"); -@@ -1082,9 +1086,17 @@ static int usbhid_start(struct hid_device *hid) +@@ -1092,9 +1096,17 @@ static int usbhid_start(struct hid_device *hid) hid->name, endpoint->bInterval, interval); } @@ -161922,10 +161894,10 @@ index ae83af649a607f67239f1a64bf45dd4b5770cc7d..f7a692f9e50cdc80ebebab1ea260cde2 ret = -ENOMEM; if (usb_endpoint_dir_in(endpoint)) { -From 10f0054f36568eb347621fe589edee1acc353a09 Mon Sep 17 00:00:00 2001 +From 42d1ad45b57773e10de9738cfd3a0747590f60d3 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 270/333] hid: Reduce default mouse polling interval to 60Hz +Subject: [PATCH 269/407] hid: Reduce default mouse polling interval to 60Hz Reduces overhead when using X --- @@ -161933,7 +161905,7 @@ Reduces overhead when using X 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index f7a692f9e50cdc80ebebab1ea260cde29b32d147..dbe506d3ceecb6d47e21f060d0bbac2b3c0165fe 100644 +index 22a955c5cc7e2ac83362c2bdc1a247b4776c9c08..34c9248680b2282fc23f9252825dc1f37f9309f0 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -49,7 +49,7 @@ @@ -161945,7 +161917,7 @@ index f7a692f9e50cdc80ebebab1ea260cde29b32d147..dbe506d3ceecb6d47e21f060d0bbac2b module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); -@@ -1089,7 +1089,9 @@ static int usbhid_start(struct hid_device *hid) +@@ -1099,7 +1099,9 @@ static int usbhid_start(struct hid_device *hid) /* Change the polling interval of mice and joysticks. */ switch (hid->collection->usage) { case HID_GD_MOUSE: @@ -161957,10 +161929,10 @@ index f7a692f9e50cdc80ebebab1ea260cde29b32d147..dbe506d3ceecb6d47e21f060d0bbac2b break; case HID_GD_JOYSTICK: -From 08bd0a947fa56bc8e47e1ce786f503f3ddb5b194 Mon Sep 17 00:00:00 2001 +From 88c231d9c7c000f1367b9da7d3accbaafcb751f8 Mon Sep 17 00:00:00 2001 From: P33M Date: Thu, 25 May 2017 16:04:53 +0100 -Subject: [PATCH 271/333] dwc_otg: make periodic scheduling behave properly for +Subject: [PATCH 270/407] dwc_otg: make periodic scheduling behave properly for FS buses If the root port is in full-speed mode, transfer times at 12mbit/s @@ -162131,10 +162103,10 @@ index 85a6d431ca54b47dc10573aa72d1ad69d06f2e36..4b1dd9de99e9e08b2e006fb5f8a7ef92 status = check_max_xfer_size(hcd, qh); if (status) { -From c2152b415d13622157076584880be869bfdd24ef Mon Sep 17 00:00:00 2001 +From ab35bb38f52608fa63314bd7b3788b371032b9ef Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 31 May 2017 09:33:55 +0100 -Subject: [PATCH 272/333] config: Adding SENSOR_JC42 +Subject: [PATCH 271/407] config: Adding SENSOR_JC42 The jc42 module supports a number of I2C-based temperature sensor modules. @@ -162190,10 +162162,10 @@ index 442eb48d4cb418d596e0dbad4bf0742d9e8e80b0..9dc64f7985cc1f91952ea382fac7920e CONFIG_SENSORS_SHT21=m CONFIG_SENSORS_SHTC1=m -From 956bb98551d9d55ba34902f67c1c3118ebee2714 Mon Sep 17 00:00:00 2001 +From 729728f5839e009dd6368463bccd2e8e4ef6c0fd Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 31 May 2017 15:27:39 +0100 -Subject: [PATCH 273/333] BCM270X_DT: Improve i2c-sensor and i2c-rtc overlay +Subject: [PATCH 272/407] BCM270X_DT: Improve i2c-sensor and i2c-rtc overlay Use the "__dormant__" feature to permit multiple instances of each overlay, which is more useful now that changing the "reg" property @@ -162554,10 +162526,10 @@ index e86a13f92c3f75c14fa4425cdfb081d6795ff76a..d2f0008addfadac8f6ed774a6e4f3f97 }; }; -From 4ce82ac32711f33f8bdb38ae81d5402835b292b8 Mon Sep 17 00:00:00 2001 +From 3ef6886f1dd74e1432e965e4e33ee1a71e8832c8 Mon Sep 17 00:00:00 2001 From: Stefan Tatschner Date: Mon, 29 May 2017 21:46:16 +0200 -Subject: [PATCH 274/333] Add device tree config for htu21 +Subject: [PATCH 273/407] Add device tree config for htu21 See: https://github.com/raspberrypi/linux/pull/2041 @@ -162639,10 +162611,10 @@ index d2f0008addfadac8f6ed774a6e4f3f97871c0d61..17c27e3b666a7a83619471b50c63bb93 }; }; -From db201504e1143c8ce45a268086d74179cf71f344 Mon Sep 17 00:00:00 2001 +From ac79c23eadd6ebfdfaea1defda1d6b10d9997a13 Mon Sep 17 00:00:00 2001 From: P33M Date: Fri, 26 May 2017 12:50:31 +0100 -Subject: [PATCH 275/333] dwc_otg: fiq_fsm: Make isochronous compatibility +Subject: [PATCH 274/407] dwc_otg: fiq_fsm: Make isochronous compatibility checks work properly Get rid of the spammy printk and local pointer mangling. @@ -162706,10 +162678,10 @@ index 38bf5fc792d32352f9e208e0e90f968599b9bc31..71834cf365e67d7ad995bba7869216c4 return 1; } -From 0daddd6703675e38d696554b39802e1c1e040d8b Mon Sep 17 00:00:00 2001 +From 6c52cea7cf9281aab9f318962347ba0eff7757e8 Mon Sep 17 00:00:00 2001 From: sandeepal Date: Fri, 2 Jun 2017 18:59:46 +0530 -Subject: [PATCH 276/333] Allo Digione Driver (#2048) +Subject: [PATCH 275/407] Allo Digione Driver (#2048) Driver for the Allo Digione soundcard --- @@ -163139,10 +163111,10 @@ index 0000000000000000000000000000000000000000..e3664e44c699d0102120ecf99e8b780a +MODULE_DESCRIPTION("ASoC Driver for Allo DigiOne"); +MODULE_LICENSE("GPL v2"); -From fc7aa0a16e93bba8b3f9bb915b665a232d430bc0 Mon Sep 17 00:00:00 2001 +From c641a9362b52fec746e6b44e20e77995b0e880f8 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Fri, 28 Apr 2017 15:14:55 -0400 -Subject: [PATCH 277/333] cgroup_get() expected to be called only on live +Subject: [PATCH 276/407] cgroup_get() expected to be called only on live cgroups and triggers warning on a dead cgroup; however, cgroup_sk_alloc() may be called while cloning a socket which is left in an empty and removed cgroup and thus may legitimately duplicate its reference on a dead cgroup. This @@ -163278,10 +163250,10 @@ index d0ecb18e0e3ad06483be2ddea9114c5a5860daaa..2650df194b5d0bb39bb92c295d93f691 return; } -From b07ce1fce5521d1cf856e0ee1677c076f2fa1544 Mon Sep 17 00:00:00 2001 +From 034811064b6b44e02c4b940d0852fdfb49cf5af7 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 26 May 2017 13:03:41 +0100 -Subject: [PATCH 278/333] BCM270X_DT: Add midi-uart1 overlay +Subject: [PATCH 277/407] BCM270X_DT: Add midi-uart1 overlay Add a scaler to the ttyS0 clock so that requesting 38400 baud results in an approximately 31250 baud signal. This is analagous to @@ -163379,10 +163351,10 @@ index 0000000000000000000000000000000000000000..e0bc410acbff3a7a175dd5d53b3ab0d0 + }; +}; -From e2ffd1e9d17148ea578e6a86eea18231e4d97278 Mon Sep 17 00:00:00 2001 +From 3b081b7a9975876cb678f03d84503273628d218e Mon Sep 17 00:00:00 2001 From: Andrei Gherzan Date: Mon, 5 Jun 2017 16:40:38 +0100 -Subject: [PATCH 279/333] dma-bcm2708: Fix module compilation of +Subject: [PATCH 278/407] dma-bcm2708: Fix module compilation of CONFIG_DMA_BCM2708 bcm2708-dmaengine.c defines functions like bcm_dma_start which are @@ -163425,10 +163397,10 @@ index c5bfff2765be4606077e6c8af73040ec13ee8974..6ca874d332a8bc666b1c9576ac51f479 #endif /* _PLAT_BCM2708_DMA_H */ -From 705da69c559b2306fae10555af8987cea568a5e2 Mon Sep 17 00:00:00 2001 +From 80e0ec0a16949a1d35dd7b06dcffbb285145b55e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 7 Jun 2017 08:53:36 +0100 -Subject: [PATCH 280/333] overlays: Fix i2c-rtc order and fragment numbering +Subject: [PATCH 279/407] overlays: Fix i2c-rtc order and fragment numbering See: https://github.com/raspberrypi/linux/issues/2059 @@ -163479,10 +163451,10 @@ index b73f902289c8e52705665d8da6d0e904eeaaaf18..6140f172a86b8731782f938f76cb5dac }; }; -From e58749bd528fbfc41d2919298ebcd30a9f18c652 Mon Sep 17 00:00:00 2001 +From afd1a454db5e7ef30040220da4dfd8feb8d5a657 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 5 Jun 2017 12:16:10 -0700 -Subject: [PATCH 281/333] drm/vc4: Add T-format scanout support. +Subject: [PATCH 280/407] drm/vc4: Add T-format scanout support. The T tiling format is what V3D uses for textures, with no raster support at all until later revisions of the hardware (and always at a @@ -163624,10 +163596,10 @@ index 932093936178674173a84002b33e07e9a37fdfe9..d382c34c1b9e0c6d5b949ca09bf1e840 + #endif /* VC4_REGS_H */ diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h -index a5890bf44c0afa3b78d1cfa66308b097d1c38710..4fccf9b898b1242877362ca0be872478c1f0ec8d 100644 +index d1601a62192971fc09eb856a95249727567fafa5..5acd9d03107517c0db9ba1a065e2340e37154103 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h -@@ -159,6 +159,7 @@ extern "C" { +@@ -160,6 +160,7 @@ extern "C" { #define DRM_FORMAT_MOD_VENDOR_NV 0x03 #define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 #define DRM_FORMAT_MOD_VENDOR_QCOM 0x05 @@ -163635,7 +163607,7 @@ index a5890bf44c0afa3b78d1cfa66308b097d1c38710..4fccf9b898b1242877362ca0be872478 /* add more to the end as needed */ #define fourcc_mod_code(vendor, val) \ -@@ -233,6 +234,27 @@ extern "C" { +@@ -234,6 +235,27 @@ extern "C" { */ #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) @@ -163664,10 +163636,10 @@ index a5890bf44c0afa3b78d1cfa66308b097d1c38710..4fccf9b898b1242877362ca0be872478 } #endif -From 563c1f1448a1a82266d2b20d3179f34931a9c42c Mon Sep 17 00:00:00 2001 +From a606bdf70e35699b074e5d04b2060f1c1e2ade10 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 5 Jun 2017 14:00:45 -0700 -Subject: [PATCH 282/333] drm/vc4: Add get/set tiling ioctls. +Subject: [PATCH 281/407] drm/vc4: Add get/set tiling ioctls. This allows mesa to set the tiling format for a BO and have that tiling format be respected by mesa on the other side of an @@ -163912,10 +163884,10 @@ index f07a090167261131076438960c1dec175d7d376e..6ac4c5c014cb9b98343f25721f74b727 } #endif -From bee1c8bfbe22546806fb8e86f08af742f35fc577 Mon Sep 17 00:00:00 2001 +From 267ffbf1b503690b5a64d547478369fd9f88efca Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jun 2017 14:39:49 -0700 -Subject: [PATCH 283/333] drm/vc4: Add FB modifier support to firmwarekms. +Subject: [PATCH 282/407] drm/vc4: Add FB modifier support to firmwarekms. Signed-off-by: Eric Anholt --- @@ -163946,10 +163918,10 @@ index 943cbb38f1f2e6fc7c06870be7904677e0a9c7a3..40a0cdc179ceabafb387724e1b835895 * set to nonzero, the configured pitch gets overwritten with * the previous pitch. So, to get the configured pitch -From 7623ab325efbe967525190e29a340387fbc1b231 Mon Sep 17 00:00:00 2001 +From 64e48d9b4589bcb50c4b3cf477d2f725a2fcf2fb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 12 Jun 2017 13:05:43 +0100 -Subject: [PATCH 284/333] config: Add CONFIG_CAN_GS_USB +Subject: [PATCH 283/407] config: Add CONFIG_CAN_GS_USB --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -163981,10 +163953,10 @@ index 372bfe1ca1fb638d78b1ece096ca1a8e5f5a13a8..83cfb1e8738bdb7ef3ee1502b9a64d65 CONFIG_IRLAN=m CONFIG_IRNET=m -From 3590bb5905b1bfc1aac3755f11a16b4548a7bde5 Mon Sep 17 00:00:00 2001 +From 57ffe29717cc1f7af12db73ad39afb0f5f410be8 Mon Sep 17 00:00:00 2001 From: P33M Date: Mon, 12 Jun 2017 16:10:03 +0100 -Subject: [PATCH 285/333] dwc_otg: add module parameter int_ep_interval_min +Subject: [PATCH 284/407] dwc_otg: add module parameter int_ep_interval_min Add a module parameter (defaulting to ignored) that clamps the polling rate of high-speed Interrupt endpoints to a minimum microframe interval. @@ -164066,10 +164038,10 @@ index 4b1dd9de99e9e08b2e006fb5f8a7ef92f20c2553..fe8e8f841f03660c2ad49ab8e66193be DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD QH Initialized\n"); -From 770f8f8f0fd628a082a9473ab0929c5e430a7d45 Mon Sep 17 00:00:00 2001 +From 1120166c07b783b91eab7618b3f34f157abc8a33 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 13 Jun 2017 15:06:22 +0100 -Subject: [PATCH 286/333] Revert "drm/vc4: Add FB modifier support to +Subject: [PATCH 285/407] Revert "drm/vc4: Add FB modifier support to firmwarekms." This reverts commit 9183dfdbf2cb3ec8e981204847b345f7ab95662d. @@ -164101,10 +164073,10 @@ index 40a0cdc179ceabafb387724e1b835895fa3e2ca2..943cbb38f1f2e6fc7c06870be7904677 * set to nonzero, the configured pitch gets overwritten with * the previous pitch. So, to get the configured pitch -From 4256275563b9b0d8723bd84869268dda1fa8f1af Mon Sep 17 00:00:00 2001 +From 07a1b2eb701ef958f79eb09cb82cb3a34705eca5 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 13 Jun 2017 15:06:24 +0100 -Subject: [PATCH 287/333] Revert "drm/vc4: Add get/set tiling ioctls." +Subject: [PATCH 286/407] Revert "drm/vc4: Add get/set tiling ioctls." This reverts commit 3ea95503a626b7e4157afa0745d11908546654b1. --- @@ -164344,10 +164316,10 @@ index 6ac4c5c014cb9b98343f25721f74b727a88f2bb5..f07a090167261131076438960c1dec17 } #endif -From 99c7c8a076f2352390bd64ced04089765687d0dc Mon Sep 17 00:00:00 2001 +From 850ecaa7594eb651fb76de469950338f7f25555d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 13 Jun 2017 15:06:25 +0100 -Subject: [PATCH 288/333] Revert "drm/vc4: Add T-format scanout support." +Subject: [PATCH 287/407] Revert "drm/vc4: Add T-format scanout support." This reverts commit 85e9ae254717d2e4a313945a465230a3102cad42. --- @@ -164464,10 +164436,10 @@ index d382c34c1b9e0c6d5b949ca09bf1e8401d44f91a..932093936178674173a84002b33e07e9 - #endif /* VC4_REGS_H */ diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h -index 4fccf9b898b1242877362ca0be872478c1f0ec8d..a5890bf44c0afa3b78d1cfa66308b097d1c38710 100644 +index 5acd9d03107517c0db9ba1a065e2340e37154103..d1601a62192971fc09eb856a95249727567fafa5 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h -@@ -159,7 +159,6 @@ extern "C" { +@@ -160,7 +160,6 @@ extern "C" { #define DRM_FORMAT_MOD_VENDOR_NV 0x03 #define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 #define DRM_FORMAT_MOD_VENDOR_QCOM 0x05 @@ -164475,7 +164447,7 @@ index 4fccf9b898b1242877362ca0be872478c1f0ec8d..a5890bf44c0afa3b78d1cfa66308b097 /* add more to the end as needed */ #define fourcc_mod_code(vendor, val) \ -@@ -234,27 +233,6 @@ extern "C" { +@@ -235,27 +234,6 @@ extern "C" { */ #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) @@ -164504,10 +164476,10 @@ index 4fccf9b898b1242877362ca0be872478c1f0ec8d..a5890bf44c0afa3b78d1cfa66308b097 } #endif -From 52c800829216697819e0f9851a94733de59481f5 Mon Sep 17 00:00:00 2001 +From ef20842ba96efa9578e6adfce14c024bac87bdea Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 5 Jun 2017 12:16:10 -0700 -Subject: [PATCH 289/333] drm/vc4: Add T-format scanout support. +Subject: [PATCH 288/407] drm/vc4: Add T-format scanout support. The T tiling format is what V3D uses for textures, with no raster support at all until later revisions of the hardware (and always at a @@ -164649,10 +164621,10 @@ index 932093936178674173a84002b33e07e9a37fdfe9..d382c34c1b9e0c6d5b949ca09bf1e840 + #endif /* VC4_REGS_H */ diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h -index a5890bf44c0afa3b78d1cfa66308b097d1c38710..4fccf9b898b1242877362ca0be872478c1f0ec8d 100644 +index d1601a62192971fc09eb856a95249727567fafa5..5acd9d03107517c0db9ba1a065e2340e37154103 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h -@@ -159,6 +159,7 @@ extern "C" { +@@ -160,6 +160,7 @@ extern "C" { #define DRM_FORMAT_MOD_VENDOR_NV 0x03 #define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 #define DRM_FORMAT_MOD_VENDOR_QCOM 0x05 @@ -164660,7 +164632,7 @@ index a5890bf44c0afa3b78d1cfa66308b097d1c38710..4fccf9b898b1242877362ca0be872478 /* add more to the end as needed */ #define fourcc_mod_code(vendor, val) \ -@@ -233,6 +234,27 @@ extern "C" { +@@ -234,6 +235,27 @@ extern "C" { */ #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) @@ -164689,10 +164661,10 @@ index a5890bf44c0afa3b78d1cfa66308b097d1c38710..4fccf9b898b1242877362ca0be872478 } #endif -From 1fda62703656be98bcd0788cca319de12930e42f Mon Sep 17 00:00:00 2001 +From 3d2266aa5b8d439ae012ddf23c72f1e0a13ff529 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 5 Jun 2017 14:00:45 -0700 -Subject: [PATCH 290/333] drm/vc4: Add get/set tiling ioctls. +Subject: [PATCH 289/407] drm/vc4: Add get/set tiling ioctls. This allows mesa to set the tiling format for a BO and have that tiling format be respected by mesa on the other side of an @@ -164937,10 +164909,10 @@ index f07a090167261131076438960c1dec175d7d376e..6ac4c5c014cb9b98343f25721f74b727 } #endif -From b099b8ae5c600ca1cfc24d01661bd67755581586 Mon Sep 17 00:00:00 2001 +From a3b7708dcd803c6663b0299d4991264d583e3f85 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jun 2017 14:39:49 -0700 -Subject: [PATCH 291/333] drm/vc4: Add FB modifier support to firmwarekms. +Subject: [PATCH 290/407] drm/vc4: Add FB modifier support to firmwarekms. Signed-off-by: Eric Anholt --- @@ -164971,10 +164943,10 @@ index 943cbb38f1f2e6fc7c06870be7904677e0a9c7a3..40a0cdc179ceabafb387724e1b835895 * set to nonzero, the configured pitch gets overwritten with * the previous pitch. So, to get the configured pitch -From 65b94393debc3d2529c04309b284c1a4fd52f2c0 Mon Sep 17 00:00:00 2001 +From 7ddf2cfeb7f2688e4d70138f1fd4cc103f12e85a Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Fri, 6 Jan 2017 19:15:23 +0100 -Subject: [PATCH 292/333] USB: serial: ch341: change initial line-control +Subject: [PATCH 291/407] USB: serial: ch341: change initial line-control settings commit 7c61b0d5e82bfe29b8dda55745afbf65b6ccc901 upstream. @@ -165306,10 +165278,10 @@ index 4f25aba5bdfcabe7304b18860be8527587390467..b27593a02734a1def9412e848c91feb5 return usb_serial_generic_resume(serial); -From 4ba8f0abf4500963af4484fca3a0545efa6871ac Mon Sep 17 00:00:00 2001 +From 33626b91d78a3bf0233fa314009b032a4535e98d Mon Sep 17 00:00:00 2001 From: P33M Date: Tue, 20 Jun 2017 13:44:01 +0100 -Subject: [PATCH 293/333] dwc_otg: fiq_fsm: Add non-periodic TT exclusivity +Subject: [PATCH 292/407] dwc_otg: fiq_fsm: Add non-periodic TT exclusivity constraints Certain hub types do not discriminate between pipe direction (IN or OUT) @@ -165476,10 +165448,10 @@ index 71834cf365e67d7ad995bba7869216c4091c3a74..7710370b30363e3170bf9bf522597c5f st->fsm = FIQ_PER_SSPLIT_STARTED; } else { -From 60390b7e6f36330c11108fda1e26f152b5359d9c Mon Sep 17 00:00:00 2001 +From 8a8cb9f9648b834f914f0e7c25403961c004b9ff Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 20 Jun 2017 17:51:47 +0100 -Subject: [PATCH 294/333] bcm2835-cpufreq: Change licence to GPLv2 +Subject: [PATCH 293/407] bcm2835-cpufreq: Change licence to GPLv2 Signed-off-by: Eben Upton Signed-off-by: Dom Cobley @@ -165532,10 +165504,10 @@ index 414fbdc10dfbfc6e4bb47870a7af3fd5780f9c9a..99345969b0e4d651fd9033d67de2febb /* ---------- INCLUDES ---------- */ #include -From 2d4c8442f7adb6854e32c366a4c21bb70e01cf27 Mon Sep 17 00:00:00 2001 +From 30c5a67ee0ee47a973610ce0b8b9f6bf01a66b4a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 21 Jun 2017 09:03:51 -0700 -Subject: [PATCH 295/333] bcm2708: Drop CMA alignment from FKMS mode as well. +Subject: [PATCH 294/407] bcm2708: Drop CMA alignment from FKMS mode as well. I dropped it from KMS mode in d88274d88ed81de1ade8e18e4c0ed91792ec82ea and should have done both of them at that time. @@ -165591,10 +165563,10 @@ index 95a595a35cb4fbb707bf4b18161f6a46860aa4ae..36fbf6c8c2e612a6dc5aa02d77cc8173 }; -From 528a8c742790d7ca20fe639e4903543fce683206 Mon Sep 17 00:00:00 2001 +From ec54e9d7c63d058109c156bf06a2c209173eee33 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 21 Jun 2017 17:19:04 +0100 -Subject: [PATCH 296/333] serial: 8250: Fix THRE flag usage for CAP_MINI +Subject: [PATCH 295/407] serial: 8250: Fix THRE flag usage for CAP_MINI The BCM2835 MINI UART has non-standard THRE semantics. Conventionally the bit means that the FIFO is empty (although there may still be a @@ -165623,7 +165595,7 @@ Signed-off-by: Phil Elwell 1 file changed, 4 insertions(+) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c -index 2d7a63f69b90415d6e1b6eb1c10612f4aa9fbed2..d2ecdb80e5f2d6bcb7e4edbb28280853bf1fd440 100644 +index d8f6fd3276ea1b1976b6e01ed536e16e6f8124cd..c77ad07d3db38316eece1713633b3e5e2dcf071e 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1746,6 +1746,10 @@ void serial8250_tx_chars(struct uart_8250_port *up) @@ -165638,10 +165610,10 @@ index 2d7a63f69b90415d6e1b6eb1c10612f4aa9fbed2..d2ecdb80e5f2d6bcb7e4edbb28280853 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) -From f239fe85d253c2bc4c48f5ae07908f8af902f1e5 Mon Sep 17 00:00:00 2001 +From 37958e89fded828003c498c980f009f91573fab4 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 23 Jun 2016 16:37:46 +0100 -Subject: [PATCH 297/333] mmc: Apply ERASE_BROKEN quirks correctly +Subject: [PATCH 296/407] mmc: Apply ERASE_BROKEN quirks correctly Signed-off-by: Phil Elwell --- @@ -165669,10 +165641,10 @@ index 894c105be9ce7f83147a62c433c787b90a5e7c17..f1aeab19e10a465bffe69d24fc3331c8 END_FIXUP }; -From 80000e9cabe10fec00c94e21e7a3c75e48b1060a Mon Sep 17 00:00:00 2001 +From 47093a83a6c3fa7addd940511212b29795f7bda8 Mon Sep 17 00:00:00 2001 From: Steve Conner Date: Thu, 29 Jun 2017 15:56:19 +0100 -Subject: [PATCH 298/333] New i2c-rtc-gpio device overlay (#2092) +Subject: [PATCH 297/407] New i2c-rtc-gpio device overlay (#2092) Created new i2c-rtc-gpio device overlay by combining i2c-rtc and i2c-gpio. Tested with PCF2127 on CM3. --- @@ -165936,10 +165908,10 @@ index 0000000000000000000000000000000000000000..8415e6081428fba9a47682964174fc02 + }; +}; -From 3a374e6f00303a841e842c3d384ee6931ddb9f7b Mon Sep 17 00:00:00 2001 +From 45b41713e0f16781cba8ff1c4d615f60294b1bef Mon Sep 17 00:00:00 2001 From: Allo Date: Mon, 3 Jul 2017 15:45:20 +0530 -Subject: [PATCH 299/333] PianoPlus: Dual Mono & Dual Stereo features added +Subject: [PATCH 298/407] PianoPlus: Dual Mono & Dual Stereo features added (#2069) --- @@ -166228,10 +166200,10 @@ index 56e43f98846b41e487b3089813f7edc3c08517eb..d4e99e3c6a383d92fb0cf9e8c1cd1e76 } -From eeb2484163e35cc23666ccc6e5551d3b7eac678b Mon Sep 17 00:00:00 2001 +From 20d3162bb309b591deaee0d332b1aa9e1641c033 Mon Sep 17 00:00:00 2001 From: Marta Lofstedt Date: Mon, 5 Dec 2016 14:04:08 +0200 -Subject: [PATCH 300/333] drm: allow changing DPMS mode +Subject: [PATCH 299/407] drm: allow changing DPMS mode The drm_atomic_helper_connector_dpms will set the connector back the old DPMS state @@ -166269,10 +166241,10 @@ index 50acd799babe1824e47e4bba6b9f03875429c17a..06572ffdb4082fe290b51bbd4c54b84c return ret; -From 09217832601a2168f16d514e1c20dffbfdf36738 Mon Sep 17 00:00:00 2001 +From 53ffaafbcce45c0b484f384083aa6c17a937029c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 6 Jul 2017 11:45:48 -0700 -Subject: [PATCH 301/333] drm/vc4: Add support for setting DPMS in firmwarekms. +Subject: [PATCH 300/407] drm/vc4: Add support for setting DPMS in firmwarekms. This ensures that the screen goes blank during DPMS (screensaver), including the cursor. Planes don't necessarily get disabled during @@ -166375,10 +166347,10 @@ index 40a0cdc179ceabafb387724e1b835895fa3e2ca2..c85cae7d2f5f88cd41d3cf41dafa1449 if (!vc4_encoder) return -ENOMEM; -From bba45b43f424bb98f42cf97d97c25bc6fd347971 Mon Sep 17 00:00:00 2001 +From 4e7b8f531c4bf6d46814c7b931697d446fb84ce7 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Sun, 9 Jul 2017 15:15:22 +0200 -Subject: [PATCH 302/333] overlays: Add gpio-shutdown overlay (#2103) +Subject: [PATCH 301/407] overlays: Add gpio-shutdown overlay (#2103) This overlay facilitates the addition of a powerbutton by converting GPIO edges into KEY_POWER keypresses, which can be handled by @@ -166534,10 +166506,10 @@ index 0000000000000000000000000000000000000000..863fb395c8539734b658682b900e1fbd + +}; -From f807d43658e3d9f2e207bd949e72c76658c63127 Mon Sep 17 00:00:00 2001 +From 22a4f5e320e9253472bacbb3e8383681198eca19 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Mon, 10 Jul 2017 11:05:17 +0200 -Subject: [PATCH 303/333] config: enable generic S/PDIF codec drivers (#2104) +Subject: [PATCH 302/407] config: enable generic S/PDIF codec drivers (#2104) These drivers can be used as dummy ADC/DAC drivers for attaching general codecs that don't need to be configured. @@ -166594,10 +166566,10 @@ index 83cfb1e8738bdb7ef3ee1502b9a64d654de80c1b..646d69bea48befde89bec7c85895d41c CONFIG_SND_SIMPLE_CARD=m CONFIG_SOUND_PRIME=m -From 416cce37049fc66108b81e104e6a9d81e12d726f Mon Sep 17 00:00:00 2001 +From 22cf1d1b9112fc56bce4b9bd290250c872fabef4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 12 Jul 2017 17:34:59 +0100 -Subject: [PATCH 304/333] fixups from rpi-4.9.y +Subject: [PATCH 303/407] fixups from rpi-4.9.y --- drivers/hv/channel.c | 5 ----- @@ -166636,10 +166608,10 @@ index 8642f580ce41803bd22c76a0fa80d083d0747be1..47167f403cc8329bd811b47c7011c299 val = bcm2835_i2c_readl(i2c_dev, BCM2835_I2C_S); } -From 46e277cd22251ad779d3dca413f1e632b388513f Mon Sep 17 00:00:00 2001 +From 1ee2f5854ce4aeb259f314c655ade308cb226b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 26 Jan 2017 23:56:03 +0100 -Subject: [PATCH 305/333] drm: debugfs: Remove all files automatically on +Subject: [PATCH 304/407] drm: debugfs: Remove all files automatically on cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -166707,10 +166679,10 @@ index 1205790ed960c755780e2efa32300ac775c15fa1..0ea2ecca76d18d4b0b76bb29cb9d04bf return 0; -From 69177fe198df8a295684a956078a255ef4352b7f Mon Sep 17 00:00:00 2001 +From 88651f13f5f19699c76c6cfd1352ab876c1c2d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sun, 22 Jan 2017 00:15:00 +0100 -Subject: [PATCH 306/333] drm: Add DRM support for tiny LCD displays +Subject: [PATCH 305/407] drm: Add DRM support for tiny LCD displays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -167564,10 +167536,10 @@ index 0000000000000000000000000000000000000000..468cd4aaa59ef66700fd41fbdb029997 + +#endif /* __LINUX_TINYDRM_H */ -From a21f08d1655d3525337532224ef6cdf71306debb Mon Sep 17 00:00:00 2001 +From 41e0d21beb4e3ed4e876d5193aa382f2161beea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sun, 22 Jan 2017 00:19:51 +0100 -Subject: [PATCH 307/333] drm/tinydrm: Add helper functions +Subject: [PATCH 306/407] drm/tinydrm: Add helper functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -168201,10 +168173,10 @@ index 0000000000000000000000000000000000000000..78175fe6ab228d7d8b17464e6cf8104d + +#endif /* __LINUX_TINYDRM_HELPERS_H */ -From efae19b749835c11cef618bcced715c07958f725 Mon Sep 17 00:00:00 2001 +From 757611792c5a2f1dba6951e9eae258976c91a579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sun, 22 Jan 2017 00:30:47 +0100 -Subject: [PATCH 308/333] drm/tinydrm: Add MIPI DBI support +Subject: [PATCH 307/407] drm/tinydrm: Add MIPI DBI support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -169389,10 +169361,10 @@ index 0000000000000000000000000000000000000000..d137b16ee8734ee2a0ec648509e1e838 + +#endif /* __LINUX_MIPI_DBI_H */ -From 104aea32dffb6bed0ca28ba67f7fd17a0b192b58 Mon Sep 17 00:00:00 2001 +From a5ee7414d3db3da89c25e81623308d3c681e4352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sun, 22 Jan 2017 15:23:48 +0100 -Subject: [PATCH 309/333] drm/tinydrm: Add support for Multi-Inno MI0283QT +Subject: [PATCH 308/407] drm/tinydrm: Add support for Multi-Inno MI0283QT display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -169803,10 +169775,10 @@ index 0000000000000000000000000000000000000000..807a09f43cad91f242a1b8f79ed6bc42 + +#endif /* __LINUX_ILI9341_H */ -From 40964bd465ceadd18ea59bfed13f4efe499a85cf Mon Sep 17 00:00:00 2001 +From 623a836769385c952e22ec6d49191770c81ac5d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 23 Feb 2017 14:29:55 +0100 -Subject: [PATCH 310/333] =?UTF-8?q?drm/tinydrm:=20mipi-dbi:=20Silence:=20?= +Subject: [PATCH 309/407] =?UTF-8?q?drm/tinydrm:=20mipi-dbi:=20Silence:=20?= =?UTF-8?q?=E2=80=98cmd=E2=80=99=20may=20be=20used=20uninitialized?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -169841,10 +169813,10 @@ index 80dfac7ba7ed611cfc1873c2052b26163c2a8e77..3f7892eb8e671593b9ab7ffc9501eb0b unsigned int i; int ret; -From 73ee1fa54b40355755e6b9d22f0003791808b6b2 Mon Sep 17 00:00:00 2001 +From b6937ae3800ee921421316c519b001f0e21a0910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 23 Feb 2017 14:29:56 +0100 -Subject: [PATCH 311/333] drm/tinydrm: mipi-dbi: Fix field width specifier +Subject: [PATCH 310/407] drm/tinydrm: mipi-dbi: Fix field width specifier warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -169891,10 +169863,10 @@ index 3f7892eb8e671593b9ab7ffc9501eb0bede483d7..186ffd9628d13a36dda2f2a6b2d6574a static const u8 mipi_dbi_dcs_read_commands[] = { -From 9d7a0bd57f73fee87a033e5ab8e918dc3985b0a8 Mon Sep 17 00:00:00 2001 +From 4eb40ebbcafedcaec95674bf63895699bbe203b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 23 Feb 2017 14:29:57 +0100 -Subject: [PATCH 312/333] drm/tinydrm: helpers: Properly fix backlight +Subject: [PATCH 311/407] drm/tinydrm: helpers: Properly fix backlight dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -169944,10 +169916,10 @@ index 78175fe6ab228d7d8b17464e6cf8104ded706958..9b9b6cfe3ba526b1c9e0d49adb28813a size_t tinydrm_spi_max_transfer_size(struct spi_device *spi, size_t max_len); bool tinydrm_spi_bpw_supported(struct spi_device *spi, u8 bpw); -From 6bfab368889268b6a8738ee73a222d5ed27c827c Mon Sep 17 00:00:00 2001 +From 914f3936007a4145d039795a9558a3a55709afac Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Wed, 8 Mar 2017 15:12:56 +0100 -Subject: [PATCH 313/333] drm: Create DEFINE_DRM_GEM_CMA_FOPS and roll it out +Subject: [PATCH 312/407] drm: Create DEFINE_DRM_GEM_CMA_FOPS and roll it out to drivers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -170024,10 +169996,10 @@ index acd6af8a8e675b5b58856651f18f788257bcc868..0ba18f33752ea7a639c81a2c567d39bd void drm_gem_cma_free_object(struct drm_gem_object *gem_obj); -From 81c994fa73780f6bfe8c0156cadca90b633fddc8 Mon Sep 17 00:00:00 2001 +From 8207ff534f7c3e48fcda798a782b09c8f0be1db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sun, 26 Mar 2017 16:25:29 +0200 -Subject: [PATCH 314/333] drm/tinydrm: Fix drm_driver.fops.owner +Subject: [PATCH 313/407] drm/tinydrm: Fix drm_driver.fops.owner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -170113,10 +170085,10 @@ index 468cd4aaa59ef66700fd41fbdb029997231a0b39..0cbb1b28129104e995895cc9c4bad909 void tinydrm_gem_cma_free_object(struct drm_gem_object *gem_obj); struct drm_gem_object * -From 758a8307c1f4b2868db7ea2d21643aa6ffa4f02d Mon Sep 17 00:00:00 2001 +From 4d6d8cc457b4faf85543762171ceebd3763fa5b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 31 May 2017 22:26:53 +0200 -Subject: [PATCH 315/333] drm/tinydrm: Add tinydrm_xrgb8888_to_gray8() helper +Subject: [PATCH 314/407] drm/tinydrm: Add tinydrm_xrgb8888_to_gray8() helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -170245,10 +170217,10 @@ index 9b9b6cfe3ba526b1c9e0d49adb28813a201a9764..a6c387f91effbcb4d6f6326f02b477ce struct backlight_device *tinydrm_of_find_backlight(struct device *dev); int tinydrm_enable_backlight(struct backlight_device *backlight); -From fd4d3bb8ab6a03c2c2982a26ac45981208b1f758 Mon Sep 17 00:00:00 2001 +From b2f555861910d3cdf9dbeb4bec83cf94656346c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 31 May 2017 22:27:40 +0200 -Subject: [PATCH 316/333] drm/tinydrm: Add RePaper e-ink driver +Subject: [PATCH 315/407] drm/tinydrm: Add RePaper e-ink driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -171418,10 +171390,10 @@ index 0000000000000000000000000000000000000000..c9ad119b2f7e1fef477f65aa00bc057c +MODULE_AUTHOR("Noralf Trønnes"); +MODULE_LICENSE("GPL"); -From b7589075be660de52c304b31dbf0d519fc176461 Mon Sep 17 00:00:00 2001 +From b24e9b1398adc07a6f76d00b256e4f0075dea0d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 15 Jul 2017 21:24:18 +0200 -Subject: [PATCH 317/333] config: Enable TINYDRM and drivers +Subject: [PATCH 316/407] config: Enable TINYDRM and drivers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -171463,10 +171435,10 @@ index 646d69bea48befde89bec7c85895d41cd644d226..0ace5c0ff13560dddc19801bcc796517 CONFIG_FB_BCM2708=y CONFIG_FB_UDL=m -From d2307a0894e21ae003d1ff37e1a71c95f63acb80 Mon Sep 17 00:00:00 2001 +From bfcf8f828027d1f92a520065c205e2cfc0eacbc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sun, 16 Jul 2017 00:13:36 +0200 -Subject: [PATCH 318/333] BCM270X_DT: Add PaPiRus overlay +Subject: [PATCH 317/407] BCM270X_DT: Add PaPiRus overlay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -171611,10 +171583,10 @@ index 0000000000000000000000000000000000000000..58eb8847f9ed8746cbffdbf4cdc83711 + }; +}; -From 09cf1dbbfc5d4dbdc5a7a27613b960098dac9759 Mon Sep 17 00:00:00 2001 +From b2561dd5dda9d5eb8fb5a8afe26acb07f1cd2649 Mon Sep 17 00:00:00 2001 From: James Hughes Date: Fri, 21 Jul 2017 09:55:12 +0100 -Subject: [PATCH 319/333] Sets the BCDC priority to constant 0 +Subject: [PATCH 318/407] Sets the BCDC priority to constant 0 This is to workaround for a possible issue in the wireless chip firmware where some packets with @@ -171640,10 +171612,10 @@ index 038a960c5104fe19dd66838e0a555d29d5f795d0..04ebb330b3e83650823a020bb88faca6 h->data_offset = offset; BCDC_SET_IF_IDX(h, ifidx); -From 6613870246de1dbf821418fb42a26cb3e3275924 Mon Sep 17 00:00:00 2001 +From 5541eb8605a304851f5a4510bb2031ffec5e5ff5 Mon Sep 17 00:00:00 2001 From: Eric Cooper Date: Sat, 29 Jul 2017 15:52:58 -0400 -Subject: [PATCH 320/333] overlays: i2c-rtc: add m41t62 +Subject: [PATCH 319/407] overlays: i2c-rtc: add m41t62 Add support for the ST M41T62 real-time clock chip. --- @@ -171707,10 +171679,10 @@ index 6140f172a86b8731782f938f76cb5dac9f28b662..fcb846a50d19cb97fc73de8b801962ac }; }; -From 5835acd4a62ab42a30ac752c7478da389fad7402 Mon Sep 17 00:00:00 2001 +From 081652a195e9ecc2046092ec2169d372fb2365e9 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 19 Jul 2017 15:20:50 +0100 -Subject: [PATCH 321/333] overlays: i2c1-bcm2708: Don't overwrite i2c1 pins +Subject: [PATCH 320/407] overlays: i2c1-bcm2708: Don't overwrite i2c1 pins node It is bad practise to overwrite an entire node in an overlay. Instead, @@ -171755,10 +171727,10 @@ index e303b9c61c82a28eab7b48f6b085661574d5a849..7c69047bcd88a5c900dddd08e60ad075 }; }; -From a6cc04cc6d345f37da9327bf40bc912dd1814498 Mon Sep 17 00:00:00 2001 +From 9cf68222c9fd1d15b3c989edaf110c033126461a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 14 Jul 2017 12:59:55 +0100 -Subject: [PATCH 322/333] bcm2835-mmc: Fix DMA usage +Subject: [PATCH 321/407] bcm2835-mmc: Fix DMA usage The previous change ("bcm2835-mmc: Only claim one DMA channel") used an incorrect variable, the effect of which was to prevent @@ -171793,10 +171765,10 @@ index 4fe8d1fe44578fbefcd48f8c327ba3d03f3d0a2a..981db05de1ff52a83550e41ab362eecf } #endif -From d3b6bca4d2595e2e3ec3322eb18893a07be0e01d Mon Sep 17 00:00:00 2001 +From fa94eb42aae9cb05b8443b388f55b4436150b5d3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 18 Jul 2017 15:30:48 +0100 -Subject: [PATCH 323/333] bcm2835-mmc: Prevent DMA race condition +Subject: [PATCH 322/407] bcm2835-mmc: Prevent DMA race condition The end of a read operation is triggered by the completion of the DMA transfer, but writes are complete when the data IRQ is raised. The @@ -171863,10 +171835,10 @@ index 981db05de1ff52a83550e41ab362eecf99cafa29..c4a5e992c6fb4a40b933239350ed4bfc static void bcm2835_mmc_finish_command(struct bcm2835_host *host) -From 5b4023a995c4fda75b0caa8d7b1ffd791e05860e Mon Sep 17 00:00:00 2001 +From 855e9b653388f26418935f1c3f5685db51101186 Mon Sep 17 00:00:00 2001 From: allocom Date: Sat, 5 Aug 2017 11:27:07 +0530 -Subject: [PATCH 324/333] allo-digione: 192kHz clicking sound fix +Subject: [PATCH 323/407] allo-digione: 192kHz clicking sound fix See: https://github.com/raspberrypi/linux/pull/2149 --- @@ -172036,10 +172008,10 @@ index e3664e44c699d0102120ecf99e8b780a4505ebad..9387b055875fdf92a13dc4a9d2727f95 ret = snd_soc_register_card(&snd_allo_digione); -From 0ca8d6d0b361f6b4c874207c1751143411777dd9 Mon Sep 17 00:00:00 2001 +From 505427f7528f9baf56458dd3efb266be454120de Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 10 Aug 2017 11:47:41 +0100 -Subject: [PATCH 325/333] Revert "usb: gadget: Fix copy/pasted error message" +Subject: [PATCH 324/407] Revert "usb: gadget: Fix copy/pasted error message" This reverts commit 92d6a813b03a576dd821667b6566a1ddf7617137. --- @@ -172060,10 +172032,10 @@ index b6d4b484c51aeefb154a653897391fecdca19ae6..b0f71957d00bded60c8f8da92e2cc15b } hidg->out_ep->driver_data = hidg; -From 8c8fd629c0141de50de66e5ca0e2986610301f67 Mon Sep 17 00:00:00 2001 +From af7a50411af5bf13f8ef0165457df67ab1fffd51 Mon Sep 17 00:00:00 2001 From: Krzysztof Opasiak Date: Tue, 24 Jan 2017 03:27:24 +0100 -Subject: [PATCH 326/333] usb: gadget: f_hid: fix: Move IN request allocation +Subject: [PATCH 325/407] usb: gadget: f_hid: fix: Move IN request allocation to set_alt() Since commit: ba1582f22231 ("usb: gadget: f_hid: use alloc_ep_req()") @@ -172288,10 +172260,10 @@ index b0f71957d00bded60c8f8da92e2cc15b376cce00..5815120c04021695d2453dece631bdbd } -From b7e2d9d008b1a7c4316e9c4d337144804d53d865 Mon Sep 17 00:00:00 2001 +From e25ab69be40efd52ef22f6f74bbaa70baf31fab3 Mon Sep 17 00:00:00 2001 From: allocom Date: Thu, 27 Jul 2017 23:49:36 +0530 -Subject: [PATCH 327/333] Bug fix: unmuted +Subject: [PATCH 326/407] Bug fix: unmuted --- sound/soc/bcm/allo-piano-dac-plus.c | 56 ++++++++++++++++++++++++++----------- @@ -172456,10 +172428,10 @@ index d4e99e3c6a383d92fb0cf9e8c1cd1e7657358d49..1756e244939256d9992ae034f72adc5d } -From ad4e2f6ed29462920e189d02a810070568ba588d Mon Sep 17 00:00:00 2001 +From 7938bd23be0bf7613baaf4fa0fa371351ec11df6 Mon Sep 17 00:00:00 2001 From: allocom Date: Sat, 5 Aug 2017 11:26:47 +0530 -Subject: [PATCH 328/333] allo-piano-dac-plus: Master volume added +Subject: [PATCH 327/407] allo-piano-dac-plus: Master volume added Master volume added, which controls both DACs volumes. @@ -172807,10 +172779,10 @@ index 1756e244939256d9992ae034f72adc5dc46a7ce8..730f57cb6730bb825b6a0aab1eadbb27 ret = snd_allo_piano_dsp_program(rtd, glb_ptr->set_mode, rate, -From c0e86c37fa74589e11716b83ffe4433d785fce55 Mon Sep 17 00:00:00 2001 +From d41076a00cadb95f9852c82bc1a70f4bc893b532 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 7 May 2017 11:34:26 +0200 -Subject: [PATCH 329/333] ASoC: bcm2835: Add support for TDM modes +Subject: [PATCH 328/407] ASoC: bcm2835: Add support for TDM modes bcm2835 supports arbitrary positioning of channel data within a frame and thus is capable of supporting TDM modes. Since @@ -173213,10 +173185,10 @@ index c8dd065aea8414b47aa2ea4fc04168b5e29002ad..dcacf7f83c9371df539a788ea33fedcf dev->dev = &pdev->dev; dev_set_drvdata(&pdev->dev, dev); -From 64dde9a04fa454feaca3b8237da2c4efc089df5a Mon Sep 17 00:00:00 2001 +From 7701c4fcd8ec19d6c243e9f71ef4059bf0f8c89f Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 7 May 2017 15:30:50 +0200 -Subject: [PATCH 330/333] ASoC: bcm2835: Support left/right justified and DSP +Subject: [PATCH 329/407] ASoC: bcm2835: Support left/right justified and DSP modes DSP modes and left/right justified modes can be supported @@ -173462,10 +173434,10 @@ index dcacf7f83c9371df539a788ea33fedcf97d64690..3a706fda4f39e42efbe12f19d87af9b1 } -From ffbed3ee0773b2d88262ac5a9e6743d4bbc71e2e Mon Sep 17 00:00:00 2001 +From 5cdc5927040a1bac32cca9873db66b198669da96 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 7 May 2017 16:19:54 +0200 -Subject: [PATCH 331/333] ASoC: bcm2835: Support additional samplerates up to +Subject: [PATCH 330/407] ASoC: bcm2835: Support additional samplerates up to 384kHz Sample rates are only restricted by the capabilities of the @@ -173508,10 +173480,10 @@ index 3a706fda4f39e42efbe12f19d87af9b100a348a5..43f5715a0d5dda851731ecf7ff27e76c | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE -From 53424b6946146d03248121014e33eeac1417a39e Mon Sep 17 00:00:00 2001 +From 481d2065030d9b2a362459825f6d01caff304b48 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 7 May 2017 16:24:57 +0200 -Subject: [PATCH 332/333] ASoC: bcm2835: Enforce full symmetry +Subject: [PATCH 331/407] ASoC: bcm2835: Enforce full symmetry bcm2835's configuration registers can't be changed when a stream is running, which means asymmetric configurations aren't supported. @@ -173547,10 +173519,10 @@ index 43f5715a0d5dda851731ecf7ff27e76c48fb6e57..2e449d7173fcecbcd647f90a26bd58b6 static bool bcm2835_i2s_volatile_reg(struct device *dev, unsigned int reg) -From 448bc59b6ed4129ed88482e6d6bb85ae8fe1f7e4 Mon Sep 17 00:00:00 2001 +From b3302d70bbc318bb2d451e106df4ba3c13072687 Mon Sep 17 00:00:00 2001 From: Conn Date: Mon, 17 Jul 2017 03:25:43 +0100 -Subject: [PATCH 333/333] config: enhance DualShock3 controller support +Subject: [PATCH 332/407] config: enhance DualShock3 controller support Enable rumble support in Sony HID & HID battery strength. --- @@ -173598,3 +173570,11740 @@ index 0ace5c0ff13560dddc19801bcc7965178620425c..23360b1b13197512851e3d14b18ebcc6 CONFIG_HID_SPEEDLINK=m CONFIG_HID_SUNPLUS=m CONFIG_HID_GREENASIA=m + +From b7aa409da1d6f925b007d0dd30be8cd1162065c9 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Thu, 18 Dec 2014 16:07:15 -0800 +Subject: [PATCH 333/407] mm: Remove the PFN busy warning + +See commit dae803e165a11bc88ca8dbc07a11077caf97bbcb -- the warning is +expected sometimes when using CMA. However, that commit still spams +my kernel log with these warnings. + +Signed-off-by: Eric Anholt +--- + mm/page_alloc.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/mm/page_alloc.c b/mm/page_alloc.c +index 7064aae8ded7526856d6be5f137e558cd79e1566..b654a6e129ab1f8f196f76766aa1a8624721c5c2 100644 +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -7351,8 +7351,6 @@ int alloc_contig_range(unsigned long start, unsigned long end, + + /* Make sure the range is really isolated. */ + if (test_pages_isolated(outer_start, end, false)) { +- pr_info_ratelimited("%s: [%lx, %lx) PFNs busy\n", +- __func__, outer_start, end); + ret = -EBUSY; + goto done; + } + +From d95c6a72f4d1309f3b9fb9d2fa55f09c7f06b4ff Mon Sep 17 00:00:00 2001 +From: Dan Pasanen +Date: Thu, 21 Sep 2017 09:55:42 -0500 +Subject: [PATCH 334/407] arm: partially revert + 702b94bff3c50542a6e4ab9a4f4cef093262fe65 + +* Re-expose some dmi APIs for use in VCSM +--- + arch/arm/include/asm/cacheflush.h | 21 +++++++++++++++++++++ + arch/arm/include/asm/glue-cache.h | 2 ++ + arch/arm/mm/cache-v6.S | 4 ++-- + arch/arm/mm/cache-v7.S | 4 ++-- + arch/arm/mm/proc-macros.S | 2 ++ + arch/arm/mm/proc-syms.c | 3 +++ + 6 files changed, 32 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h +index bdd283bc5842c31fd9f399e8353adcaf1eadfe39..58c6398b3828535ff2494b1d896976ea8de00c07 100644 +--- a/arch/arm/include/asm/cacheflush.h ++++ b/arch/arm/include/asm/cacheflush.h +@@ -94,6 +94,21 @@ + * DMA Cache Coherency + * =================== + * ++ * dma_inv_range(start, end) ++ * ++ * Invalidate (discard) the specified virtual address range. ++ * May not write back any entries. If 'start' or 'end' ++ * are not cache line aligned, those lines must be written ++ * back. ++ * - start - virtual start address ++ * - end - virtual end address ++ * ++ * dma_clean_range(start, end) ++ * ++ * Clean (write back) the specified virtual address range. ++ * - start - virtual start address ++ * - end - virtual end address ++ * + * dma_flush_range(start, end) + * + * Clean and invalidate the specified virtual address range. +@@ -115,6 +130,8 @@ struct cpu_cache_fns { + void (*dma_map_area)(const void *, size_t, int); + void (*dma_unmap_area)(const void *, size_t, int); + ++ void (*dma_inv_range)(const void *, const void *); ++ void (*dma_clean_range)(const void *, const void *); + void (*dma_flush_range)(const void *, const void *); + }; + +@@ -140,6 +157,8 @@ extern struct cpu_cache_fns cpu_cache; + * is visible to DMA, or data written by DMA to system memory is + * visible to the CPU. + */ ++#define dmac_inv_range cpu_cache.dma_inv_range ++#define dmac_clean_range cpu_cache.dma_clean_range + #define dmac_flush_range cpu_cache.dma_flush_range + + #else +@@ -159,6 +178,8 @@ extern void __cpuc_flush_dcache_area(void *, size_t); + * is visible to DMA, or data written by DMA to system memory is + * visible to the CPU. + */ ++extern void dmac_inv_range(const void *, const void *); ++extern void dmac_clean_range(const void *, const void *); + extern void dmac_flush_range(const void *, const void *); + + #endif +diff --git a/arch/arm/include/asm/glue-cache.h b/arch/arm/include/asm/glue-cache.h +index 01c3d92624e5ed3e0035c4305ca5b6797ba1888b..99f29f1963aec25c0016c5eadeb4a042e75bd4c9 100644 +--- a/arch/arm/include/asm/glue-cache.h ++++ b/arch/arm/include/asm/glue-cache.h +@@ -154,6 +154,8 @@ static inline void nop_dma_unmap_area(const void *s, size_t l, int f) { } + #define __cpuc_coherent_user_range __glue(_CACHE,_coherent_user_range) + #define __cpuc_flush_dcache_area __glue(_CACHE,_flush_kern_dcache_area) + ++#define dmac_inv_range __glue(_CACHE,_dma_inv_range) ++#define dmac_clean_range __glue(_CACHE,_dma_clean_range) + #define dmac_flush_range __glue(_CACHE,_dma_flush_range) + #endif + +diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S +index 24659952c2784de64a53dc2e889ab616bd19b12b..1ee5bc3a101884132a65adae32d6ef7417667ffc 100644 +--- a/arch/arm/mm/cache-v6.S ++++ b/arch/arm/mm/cache-v6.S +@@ -201,7 +201,7 @@ ENTRY(v6_flush_kern_dcache_area) + * - start - virtual start address of region + * - end - virtual end address of region + */ +-v6_dma_inv_range: ++ENTRY(v6_dma_inv_range) + #ifdef CONFIG_DMA_CACHE_RWFO + ldrb r2, [r0] @ read for ownership + strb r2, [r0] @ write for ownership +@@ -246,7 +246,7 @@ v6_dma_inv_range: + * - start - virtual start address of region + * - end - virtual end address of region + */ +-v6_dma_clean_range: ++ENTRY(v6_dma_clean_range) + bic r0, r0, #D_CACHE_LINE_SIZE - 1 + 1: + #ifdef CONFIG_DMA_CACHE_RWFO +diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S +index a134d8a13d001ee8ad4b1084c9a71c1dc9f8d832..2ddf36403d1c8f6dcade00ef2fffd44bf2e5c4e4 100644 +--- a/arch/arm/mm/cache-v7.S ++++ b/arch/arm/mm/cache-v7.S +@@ -349,7 +349,7 @@ ENDPROC(v7_flush_kern_dcache_area) + * - start - virtual start address of region + * - end - virtual end address of region + */ +-v7_dma_inv_range: ++ENTRY(v7_dma_inv_range) + dcache_line_size r2, r3 + sub r3, r2, #1 + tst r0, r3 +@@ -377,7 +377,7 @@ ENDPROC(v7_dma_inv_range) + * - start - virtual start address of region + * - end - virtual end address of region + */ +-v7_dma_clean_range: ++ENTRY(v7_dma_clean_range) + dcache_line_size r2, r3 + sub r3, r2, #1 + bic r0, r0, r3 +diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S +index 0d40c285bd864c87a5e02d59d35d789183334700..b4bc7614da42acf44eac072252c1f832db39a86c 100644 +--- a/arch/arm/mm/proc-macros.S ++++ b/arch/arm/mm/proc-macros.S +@@ -325,6 +325,8 @@ ENTRY(\name\()_cache_fns) + .long \name\()_flush_kern_dcache_area + .long \name\()_dma_map_area + .long \name\()_dma_unmap_area ++ .long \name\()_dma_inv_range ++ .long \name\()_dma_clean_range + .long \name\()_dma_flush_range + .size \name\()_cache_fns, . - \name\()_cache_fns + .endm +diff --git a/arch/arm/mm/proc-syms.c b/arch/arm/mm/proc-syms.c +index 054b491ff7649ca067ff821770aec80a4da42102..70e8b7d3443467ae9595924f1a9d043b984e2c93 100644 +--- a/arch/arm/mm/proc-syms.c ++++ b/arch/arm/mm/proc-syms.c +@@ -30,6 +30,9 @@ EXPORT_SYMBOL(__cpuc_flush_user_all); + EXPORT_SYMBOL(__cpuc_flush_user_range); + EXPORT_SYMBOL(__cpuc_coherent_kern_range); + EXPORT_SYMBOL(__cpuc_flush_dcache_area); ++EXPORT_SYMBOL(dmac_inv_range); ++EXPORT_SYMBOL(dmac_clean_range); ++EXPORT_SYMBOL(dmac_flush_range); + #else + EXPORT_SYMBOL(cpu_cache); + #endif + +From cf1ecee491d6883e018a3cde7634954c07d5d46c Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 18 Aug 2017 18:45:36 +0100 +Subject: [PATCH 335/407] vcsm: Provide flag to map pages up front + +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 30 +++++++++++++++++++++++++++--- + 1 file changed, 27 insertions(+), 3 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index ee4e05948c439a9045e0b65566d57587177a32e2..7d417214f4288cb24e6f20c840aef1b69dc9eb0b 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -142,6 +142,7 @@ struct SM_RESOURCE_T { + struct list_head map_list; /* Maps associated with a resource. */ + + struct SM_PRIV_DATA_T *private; ++ bool map; /* whether to map pages up front */ + }; + + /* Private file data associated with each opened device. +@@ -1376,6 +1377,20 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + vcsm_vma_open(vma); + resource->res_stats[MAP]++; + vmcs_sm_release_resource(resource, 0); ++ ++ if (resource->map) { ++ /* We don't use vmf->pgoff since that has the fake offset */ ++ unsigned long addr; ++ for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) { ++ /* Finally, remap it */ ++ unsigned long pfn = (unsigned long)resource->res_base_mem & 0x3FFFFFFF; ++ pfn += mm_vc_mem_phys_addr; ++ pfn += addr - vma->vm_start; ++ pfn >>= PAGE_SHIFT; ++ ret = vm_insert_pfn(vma, addr, pfn); ++ } ++ } ++ + return 0; + + error: +@@ -1394,10 +1409,18 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + struct SM_RESOURCE_T *resource; + VC_SM_ALLOC_T alloc = { 0 }; + VC_SM_ALLOC_RESULT_T result = { 0 }; ++ enum vmcs_sm_cache_e cached = ioparam->cached; ++ bool map = false; ++ ++ /* flag to requst buffer is mapped up front, rather than lazily */ ++ if (cached & 0x80 ) { ++ map = true; ++ cached &= ~0x80; ++ } + + /* Setup our allocation parameters */ +- alloc.type = ((ioparam->cached == VMCS_SM_CACHE_VC) +- || (ioparam->cached == ++ alloc.type = ((cached == VMCS_SM_CACHE_VC) ++ || (cached == + VMCS_SM_CACHE_BOTH)) ? VC_SM_ALLOC_CACHED : + VC_SM_ALLOC_NON_CACHED; + alloc.base_unit = ioparam->size; +@@ -1455,7 +1478,8 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + resource->res_handle = result.res_handle; + resource->res_base_mem = result.res_mem; + resource->res_size = alloc.base_unit * alloc.num_unit; +- resource->res_cached = ioparam->cached; ++ resource->res_cached = cached; ++ resource->map = map; + + /* Kernel/user GUID. This global identifier is used for mmap'ing the + * allocated region from user space, it is passed as the mmap'ing + +From 2bbefa5d77801ceb5cc0ec3ee96038e0863920a7 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 18 Aug 2017 18:46:20 +0100 +Subject: [PATCH 336/407] vcsm: Provide new ioctl to clean/invalidate a 2D + block + +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 45 ++++++++++++++++++++++++++++++++++ + include/linux/broadcom/vmcs_sm_ioctl.h | 16 ++++++++++++ + 2 files changed, 61 insertions(+) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 7d417214f4288cb24e6f20c840aef1b69dc9eb0b..cc8a3969cf38f013e53554514ade83cf7de532e0 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2814,6 +2814,51 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + } + break; ++ /* Flush/Invalidate the cache for a given mapping. */ ++ case VMCS_SM_CMD_CLEAN_INVALID2: ++ { ++ int i, j; ++ struct vmcs_sm_ioctl_clean_invalid2 ioparam; ++ struct vmcs_sm_ioctl_clean_invalid_block *block = NULL; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user header for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ block = kzalloc(ioparam.op_count * sizeof(struct vmcs_sm_ioctl_clean_invalid_block), GFP_KERNEL); ++ if (!block) { ++ ret = -EFAULT; ++ goto out; ++ } ++ if (copy_from_user(block, ++ (void *)(arg + sizeof(ioparam)), ioparam.op_count * sizeof(struct vmcs_sm_ioctl_clean_invalid_block)) != 0) { ++ pr_err("[%s]: failed to copy-from-user payload for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ for (i=0; iblock_count; ++j) { ++ extern void v7_dma_inv_range(void *start, void *end); ++ extern void v7_dma_clean_range(void *start, void *end); ++ unsigned long base = (unsigned long)op->start_address + j * op->inter_block_stride; ++ unsigned long end = base + op->block_size; ++ /* L1/L2 cache clean/invalidate */ ++ if (op->invalidate_mode == 1) ++ v7_dma_inv_range((void *)base, (void *)end); ++ else ++ v7_dma_clean_range((void *)base, (void *)end); ++ } ++ } ++ kfree(block); ++ } ++ break; + + default: + { +diff --git a/include/linux/broadcom/vmcs_sm_ioctl.h b/include/linux/broadcom/vmcs_sm_ioctl.h +index 334f36d0d697b047df2922b5f2db67f38cf76564..2de7f1f41070689c99cad3bd43d117458549cb51 100644 +--- a/include/linux/broadcom/vmcs_sm_ioctl.h ++++ b/include/linux/broadcom/vmcs_sm_ioctl.h +@@ -62,6 +62,7 @@ enum vmcs_sm_cmd_e { + VMCS_SM_CMD_HOST_WALK_PID_MAP, + + VMCS_SM_CMD_CLEAN_INVALID, ++ VMCS_SM_CMD_CLEAN_INVALID2, + + VMCS_SM_CMD_LAST /* Do no delete */ + }; +@@ -175,6 +176,18 @@ struct vmcs_sm_ioctl_clean_invalid { + } s[8]; + }; + ++struct vmcs_sm_ioctl_clean_invalid2 { ++ uint8_t op_count; ++ uint8_t zero[3]; ++ struct vmcs_sm_ioctl_clean_invalid_block { ++ uint16_t invalidate_mode; ++ uint16_t block_count; ++ void * start_address; ++ uint32_t block_size; ++ uint32_t inter_block_stride; ++ } s[0]; ++}; ++ + /* IOCTL numbers */ + #define VMCS_SM_IOCTL_MEM_ALLOC\ + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_ALLOC,\ +@@ -206,6 +219,9 @@ struct vmcs_sm_ioctl_clean_invalid { + #define VMCS_SM_IOCTL_MEM_CLEAN_INVALID\ + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_CLEAN_INVALID,\ + struct vmcs_sm_ioctl_clean_invalid) ++#define VMCS_SM_IOCTL_MEM_CLEAN_INVALID2\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_CLEAN_INVALID2,\ ++ struct vmcs_sm_ioctl_clean_invalid2) + + #define VMCS_SM_IOCTL_SIZE_USR_HDL\ + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_SIZE_USR_HANDLE,\ + +From 868227fa572a68d6be5671abc8cc345304e341d5 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 22 Aug 2017 13:48:22 +0100 +Subject: [PATCH 337/407] cache: Fix up previous commit for v6 + +--- + arch/arm/mm/cache-v7.S | 6 ++++-- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 8 ++++---- + 2 files changed, 8 insertions(+), 6 deletions(-) + +diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S +index 2ddf36403d1c8f6dcade00ef2fffd44bf2e5c4e4..48a81f3757d487e7ae3a9508facda401504dff8e 100644 +--- a/arch/arm/mm/cache-v7.S ++++ b/arch/arm/mm/cache-v7.S +@@ -349,7 +349,8 @@ ENDPROC(v7_flush_kern_dcache_area) + * - start - virtual start address of region + * - end - virtual end address of region + */ +-ENTRY(v7_dma_inv_range) ++ENTRY(rpi_dma_inv_range) ++v7_dma_inv_range: + dcache_line_size r2, r3 + sub r3, r2, #1 + tst r0, r3 +@@ -377,7 +378,8 @@ ENDPROC(v7_dma_inv_range) + * - start - virtual start address of region + * - end - virtual end address of region + */ +-ENTRY(v7_dma_clean_range) ++ENTRY(rpi_dma_clean_range) ++v7_dma_clean_range: + dcache_line_size r2, r3 + sub r3, r2, #1 + bic r0, r0, r3 +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index cc8a3969cf38f013e53554514ade83cf7de532e0..dda21c2fe7463ff1f550798b13fa64805cb6d2a7 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2845,15 +2845,15 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + for (i=0; iblock_count; ++j) { +- extern void v7_dma_inv_range(void *start, void *end); +- extern void v7_dma_clean_range(void *start, void *end); ++ extern void rpi_dma_inv_range(void *start, void *end); ++ extern void rpi_dma_clean_range(void *start, void *end); + unsigned long base = (unsigned long)op->start_address + j * op->inter_block_stride; + unsigned long end = base + op->block_size; + /* L1/L2 cache clean/invalidate */ + if (op->invalidate_mode == 1) +- v7_dma_inv_range((void *)base, (void *)end); ++ rpi_dma_inv_range((void *)base, (void *)end); + else +- v7_dma_clean_range((void *)base, (void *)end); ++ rpi_dma_clean_range((void *)base, (void *)end); + } + } + kfree(block); + +From 4fc5f54480a98cc9be5a850ee29b54a5ae80bbaf Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 25 Aug 2017 17:09:38 +0100 +Subject: [PATCH 338/407] vcsm: Allow build with multi-platform v6-v7 + +--- + arch/arm/mm/cache-v7.S | 6 ++---- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 30 +++++++++++++++++++++++------- + 2 files changed, 25 insertions(+), 11 deletions(-) + +diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S +index 48a81f3757d487e7ae3a9508facda401504dff8e..2ddf36403d1c8f6dcade00ef2fffd44bf2e5c4e4 100644 +--- a/arch/arm/mm/cache-v7.S ++++ b/arch/arm/mm/cache-v7.S +@@ -349,8 +349,7 @@ ENDPROC(v7_flush_kern_dcache_area) + * - start - virtual start address of region + * - end - virtual end address of region + */ +-ENTRY(rpi_dma_inv_range) +-v7_dma_inv_range: ++ENTRY(v7_dma_inv_range) + dcache_line_size r2, r3 + sub r3, r2, #1 + tst r0, r3 +@@ -378,8 +377,7 @@ ENDPROC(v7_dma_inv_range) + * - start - virtual start address of region + * - end - virtual end address of region + */ +-ENTRY(rpi_dma_clean_range) +-v7_dma_clean_range: ++ENTRY(v7_dma_clean_range) + dcache_line_size r2, r3 + sub r3, r2, #1 + bic r0, r0, r3 +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index dda21c2fe7463ff1f550798b13fa64805cb6d2a7..1dd5d227980a26c0b2f305435e71cb124f44c6dc 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2845,15 +2845,31 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + for (i=0; iblock_count; ++j) { +- extern void rpi_dma_inv_range(void *start, void *end); +- extern void rpi_dma_clean_range(void *start, void *end); ++ ++ ++ extern void v6_dma_inv_range(void *start, void *end); ++ extern void v6_dma_clean_range(void *start, void *end); + unsigned long base = (unsigned long)op->start_address + j * op->inter_block_stride; + unsigned long end = base + op->block_size; +- /* L1/L2 cache clean/invalidate */ +- if (op->invalidate_mode == 1) +- rpi_dma_inv_range((void *)base, (void *)end); +- else +- rpi_dma_clean_range((void *)base, (void *)end); ++ /* L1/L2 cache clean */ ++ if (op->invalidate_mode & 2) { ++#if defined(CONFIG_CPU_CACHE_V7) ++ extern void v7_dma_clean_range(void *start, void *end); ++ v7_dma_clean_range((void *)base, (void *)end); ++#elif defined(CONFIG_CPU_CACHE_V6) ++ extern void v6_dma_clean_range(void *start, void *end); ++ v6_dma_clean_range((void *)base, (void *)end); ++#endif ++ /* L1/L2 cache invalidate */ ++ } else if (op->invalidate_mode & 1) { ++#if defined(CONFIG_CPU_CACHE_V7) ++ extern void v7_dma_inv_range(void *start, void *end); ++ v7_dma_inv_range((void *)base, (void *)end); ++#elif defined(CONFIG_CPU_CACHE_V6) ++ extern void v6_dma_inv_range(void *start, void *end); ++ v6_dma_inv_range((void *)base, (void *)end); ++#endif ++ } + } + } + kfree(block); + +From d82ed5ede2b99fd3b930687369ac5551de38bede Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 4 Sep 2017 20:48:02 +0100 +Subject: [PATCH 339/407] vcsm: Allow both clean and invalidate to be requested + +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 1dd5d227980a26c0b2f305435e71cb124f44c6dc..1fe8608f462ab4ea6b2449494b6352d0a0af889c 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2861,7 +2861,8 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + v6_dma_clean_range((void *)base, (void *)end); + #endif + /* L1/L2 cache invalidate */ +- } else if (op->invalidate_mode & 1) { ++ } ++ if (op->invalidate_mode & 1) { + #if defined(CONFIG_CPU_CACHE_V7) + extern void v7_dma_inv_range(void *start, void *end); + v7_dma_inv_range((void *)base, (void *)end); + +From 28a242b03964c4e70c4a0f33b7e799ecffdfe37f Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 15 Feb 2017 11:16:05 +0000 +Subject: [PATCH 340/407] VCSM: Specify pointers in IPC msgs as uint32_t + +Pointers were specified as void* which will fail +rather badly if the kernel is switched to 64 bit. +GPU wants 32 bit addresses, so use uint32_t and +cast whereever necessary. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 12 ++++---- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 52 +++++++++++++++++--------------- + 2 files changed, 33 insertions(+), 31 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +index c4d5ff718a5ba9071ef87fa4c6cf632486c4d36f..6c19aac6dc9df90edb9432bc32e7477d532d3278 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_defs.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -88,7 +88,7 @@ typedef struct { + /* Resource handle */ + uint32_t res_handle; + /* Pointer to resource buffer */ +- void *res_mem; ++ uint32_t res_mem; + /* Resource base size (bytes) */ + uint32_t res_base_size; + /* Resource number */ +@@ -101,7 +101,7 @@ typedef struct { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ +- void *res_mem; ++ uint32_t res_mem; + + } VC_SM_FREE_T; + +@@ -110,7 +110,7 @@ typedef struct { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ +- void *res_mem; ++ uint32_t res_mem; + + } VC_SM_LOCK_UNLOCK_T; + +@@ -119,7 +119,7 @@ typedef struct { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ +- void *res_mem; ++ uint32_t res_mem; + /* Resource *new* size requested (bytes) */ + uint32_t res_new_size; + +@@ -133,10 +133,10 @@ typedef struct { + /* Resource handle */ + uint32_t res_handle; + /* Pointer to resource buffer */ +- void *res_mem; ++ uint32_t res_mem; + /* Pointer to former resource buffer if the memory + * was reallocated */ +- void *res_old_mem; ++ uint32_t res_old_mem; + + } VC_SM_LOCK_RESULT_T; + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 1fe8608f462ab4ea6b2449494b6352d0a0af889c..a23d2ab75fc041b2d562a65cafe787fc73f21233 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -877,7 +877,7 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + */ + if (resource->res_handle) { + VC_SM_FREE_T free = { +- resource->res_handle, resource->res_base_mem ++ resource->res_handle, (uint32_t)resource->res_base_mem + }; + int status = vc_vchi_sm_free(sm_state->sm_handle, &free, + &private->int_trans_id); +@@ -1136,17 +1136,17 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + int status; + + lock_unlock.res_handle = resource->res_handle; +- lock_unlock.res_mem = resource->res_base_mem; ++ lock_unlock.res_mem = (uint32_t)resource->res_base_mem; + + pr_debug("[%s]: attempt to lock data - hdl %x, base address %p\n", +- __func__, lock_unlock.res_handle, lock_unlock.res_mem); ++ __func__, lock_unlock.res_handle, ++ (void *)lock_unlock.res_mem); + + /* Lock the videocore allocated resource. + */ + status = vc_vchi_sm_lock(sm_state->sm_handle, + &lock_unlock, &lock_result, 0); +- if ((status != 0) || +- ((status == 0) && (lock_result.res_mem == NULL))) { ++ if (status || !lock_result.res_mem) { + pr_err("[%s]: failed to lock memory on videocore (status: %u)\n", + __func__, status); + resource->res_stats[LOCK_FAIL]++; +@@ -1162,10 +1162,10 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + + /* Keep track of the new base memory. + */ +- if ((lock_result.res_mem != NULL) && +- (lock_result.res_old_mem != NULL) && ++ if (lock_result.res_mem && ++ lock_result.res_old_mem && + (lock_result.res_mem != lock_result.res_old_mem)) { +- resource->res_base_mem = lock_result.res_mem; ++ resource->res_base_mem = (void *)lock_result.res_mem; + } + } + +@@ -1464,7 +1464,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + private->restart_sys = -EINTR; + private->int_action = VC_SM_MSG_TYPE_ALLOC; + goto error; +- } else if (status != 0 || (status == 0 && result.res_mem == NULL)) { ++ } else if (status != 0 || !result.res_mem) { + pr_err("[%s]: failed to allocate memory on videocore (status: %u, trans_id: %u)\n", + __func__, status, private->int_trans_id); + ret = -ENOMEM; +@@ -1476,7 +1476,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + */ + resource->private = private; + resource->res_handle = result.res_handle; +- resource->res_base_mem = result.res_mem; ++ resource->res_base_mem = (void *)result.res_mem; + resource->res_size = alloc.base_unit * alloc.num_unit; + resource->res_cached = cached; + resource->map = map; +@@ -1654,11 +1654,12 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + } + + resize.res_handle = resource->res_handle; +- resize.res_mem = resource->res_base_mem; ++ resize.res_mem = (uint32_t)resource->res_base_mem; + resize.res_new_size = ioparam->new_size; + + pr_debug("[%s]: attempt to resize data - guid %x, hdl %x, base address %p\n", +- __func__, ioparam->handle, resize.res_handle, resize.res_mem); ++ __func__, ioparam->handle, resize.res_handle, ++ (void *)resize.res_mem); + + /* Resize the videocore allocated resource. + */ +@@ -1671,7 +1672,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + private->restart_sys = -EINTR; + private->int_action = VC_SM_MSG_TYPE_RESIZE; + goto error; +- } else if (status != 0) { ++ } else if (status) { + pr_err("[%s]: failed to resize memory on videocore (status: %u, trans_id: %u)\n", + __func__, status, private->int_trans_id); + ret = -EPERM; +@@ -1729,14 +1730,14 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + } + + lock.res_handle = resource->res_handle; +- lock.res_mem = resource->res_base_mem; ++ lock.res_mem = (uint32_t)resource->res_base_mem; + + /* Take the lock and get the address to be mapped. + */ + if (vc_addr == 0) { + pr_debug("[%s]: attempt to lock data - guid %x, hdl %x, base address %p\n", + __func__, ioparam->handle, lock.res_handle, +- lock.res_mem); ++ (void *)lock.res_mem); + + /* Lock the videocore allocated resource. + */ +@@ -1749,8 +1750,8 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + private->restart_sys = -EINTR; + private->int_action = VC_SM_MSG_TYPE_LOCK; + goto error; +- } else if (status != 0 || +- (status == 0 && result.res_mem == NULL)) { ++ } else if (status || ++ (!status && !(void *)result.res_mem)) { + pr_err("[%s]: failed to lock memory on videocore (status: %u, trans_id: %u)\n", + __func__, status, private->int_trans_id); + ret = -EPERM; +@@ -1759,8 +1760,8 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + } + + pr_debug("[%s]: succeed to lock data - hdl %x, base address %p (%p), ref-cnt %d\n", +- __func__, lock.res_handle, result.res_mem, +- lock.res_mem, resource->lock_count); ++ __func__, lock.res_handle, (void *)result.res_mem, ++ (void *)lock.res_mem, resource->lock_count); + } + /* Lock assumed taken already, address to be mapped is known. + */ +@@ -1773,10 +1774,10 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + /* Keep track of the new base memory allocation if it has changed. + */ + if ((vc_addr == 0) && +- (result.res_mem != NULL) && +- (result.res_old_mem != NULL) && ++ ((void *)result.res_mem) && ++ ((void *)result.res_old_mem) && + (result.res_mem != result.res_old_mem)) { +- resource->res_base_mem = result.res_mem; ++ resource->res_base_mem = (void *)result.res_mem; + + /* Kernel allocated resources. + */ +@@ -1901,10 +1902,11 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + } + + unlock.res_handle = resource->res_handle; +- unlock.res_mem = resource->res_base_mem; ++ unlock.res_mem = (uint32_t)resource->res_base_mem; + + pr_debug("[%s]: attempt to unlock data - guid %x, hdl %x, base address %p\n", +- __func__, ioparam->handle, unlock.res_handle, unlock.res_mem); ++ __func__, ioparam->handle, unlock.res_handle, ++ (void *)unlock.res_mem); + + /* User space allocated resources. + */ +@@ -2039,7 +2041,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + } + + pr_debug("[%s]: success to unlock data - hdl %x, base address %p, ref-cnt %d\n", +- __func__, unlock.res_handle, unlock.res_mem, ++ __func__, unlock.res_handle, (void *)unlock.res_mem, + resource->lock_count); + + error: + +From ee331cce86582af1401a9494c1191f145bb27bc3 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 19 May 2017 14:29:12 +0100 +Subject: [PATCH 341/407] vcsm: code-style: Fix comment indentation + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 58 +++++++++++++++++++------------- + 1 file changed, 34 insertions(+), 24 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index 5e279f5a95fac7227cea15941bf0570ddc2b0886..f8e555dc30074e7ff226cf34a96aa30a34176775 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -19,63 +19,73 @@ + + #include "vc_sm_defs.h" + +-/* Forward declare. ++/* ++ * Forward declare. + */ + typedef struct sm_instance *VC_VCHI_SM_HANDLE_T; + +-/* Initialize the shared memory service, opens up vchi connection to talk to it. +-*/ ++/* ++ * Initialize the shared memory service, opens up vchi connection to talk to it. ++ */ + VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, + VCHI_CONNECTION_T **vchi_connections, + uint32_t num_connections); + +-/* Terminates the shared memory service. +-*/ ++/* ++ * Terminates the shared memory service. ++ */ + int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle); + +-/* Ask the shared memory service to allocate some memory on videocre and +-** return the result of this allocation (which upon success will be a pointer +-** to some memory in videocore space). +-*/ ++/* ++ * Ask the shared memory service to allocate some memory on videocre and ++ * return the result of this allocation (which upon success will be a pointer ++ * to some memory in videocore space). ++ */ + int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, + VC_SM_ALLOC_T *alloc, + VC_SM_ALLOC_RESULT_T *alloc_result, uint32_t *trans_id); + +-/* Ask the shared memory service to free up some memory that was previously +-** allocated by the vc_vchi_sm_alloc function call. +-*/ ++/* ++ * Ask the shared memory service to free up some memory that was previously ++ * allocated by the vc_vchi_sm_alloc function call. ++ */ + int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, + VC_SM_FREE_T *free, uint32_t *trans_id); + +-/* Ask the shared memory service to lock up some memory that was previously +-** allocated by the vc_vchi_sm_alloc function call. ++/* ++ * Ask the shared memory service to lock up some memory that was previously ++ * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + VC_SM_LOCK_UNLOCK_T *lock_unlock, + VC_SM_LOCK_RESULT_T *lock_result, uint32_t *trans_id); + +-/* Ask the shared memory service to unlock some memory that was previously +-** allocated by the vc_vchi_sm_alloc function call. ++/* ++ * Ask the shared memory service to unlock some memory that was previously ++ * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + VC_SM_LOCK_UNLOCK_T *lock_unlock, + uint32_t *trans_id, uint8_t wait_reply); + +-/* Ask the shared memory service to resize some memory that was previously +-** allocated by the vc_vchi_sm_alloc function call. ++/* ++ * Ask the shared memory service to resize some memory that was previously ++ * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, + VC_SM_RESIZE_T *resize, uint32_t *trans_id); + +-/* Walk the allocated resources on the videocore side, the allocation will +-** show up in the log. This is purely for debug/information and takes no +-** specific actions. ++/* ++ * Walk the allocated resources on the videocore side, the allocation will ++ * show up in the log. This is purely for debug/information and takes no ++ * specific actions. + */ + int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); + +-/* Clean up following a previously interrupted action which left the system +-** in a bad state of some sort. +-*/ ++/* ++ * Clean up following a previously interrupted action which left the system ++ * in a bad state of some sort. ++ */ + int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, + VC_SM_ACTION_CLEAN_T *action_clean); + + +From b2628c179c9d1a0028f966931333383319ec2426 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 25 Aug 2017 15:58:57 +0100 +Subject: [PATCH 342/407] vcsm: Convert to loading via device tree. + +Signed-off-by: Dave Stevenson +--- + arch/arm/boot/dts/bcm2708-rpi.dtsi | 6 ++++ + drivers/char/broadcom/vc_sm/vmcs_sm.c | 53 ++++++++++++++++++++++++----------- + 2 files changed, 43 insertions(+), 16 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi.dtsi b/arch/arm/boot/dts/bcm2708-rpi.dtsi +index 72ab7fc673cef529c501026964284009b7cd401e..097e8bff0b38b7de51e6de9dad98ca6179dbfae5 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi.dtsi +@@ -72,6 +72,12 @@ + firmware = <&firmware>; + }; + ++ vcsm: vcsm { ++ compatible = "raspberrypi,bcm2835-vcsm"; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++ + thermal: thermal { + compatible = "brcm,bcm2835-thermal"; + firmware = <&firmware>; +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index a23d2ab75fc041b2d562a65cafe787fc73f21233..57cd47f22449ad26eaedc86b4540764ec880dd5b 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -27,6 +27,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -45,6 +47,7 @@ + /* ---- Private Constants and Types --------------------------------------- */ + + #define DEVICE_NAME "vcsm" ++#define DRIVER_NAME "bcm2835-vcsm" + #define DEVICE_MINOR 0 + + #define VC_SM_DIR_ROOT_NAME "vc-smem" +@@ -165,6 +168,7 @@ struct SM_PRIV_DATA_T { + /* Global state information. + */ + struct SM_STATE_T { ++ struct platform_device *pdev; + VC_VCHI_SM_HANDLE_T sm_handle; /* Handle for videocore service. */ + struct dentry *dir_root; /* Debug fs entries root. */ + struct dentry *dir_alloc; /* Debug fs entries allocations. */ +@@ -3000,18 +3004,6 @@ static void vc_sm_connected_init(void) + + pr_info("[%s]: start\n", __func__); + +- /* Allocate memory for the state structure. +- */ +- sm_state = kzalloc(sizeof(struct SM_STATE_T), GFP_KERNEL); +- if (sm_state == NULL) { +- pr_err("[%s]: failed to allocate memory\n", __func__); +- ret = -ENOMEM; +- goto out; +- } +- +- mutex_init(&sm_state->lock); +- mutex_init(&sm_state->map_lock); +- + /* Initialize and create a VCHI connection for the shared memory service + ** running on videocore. + */ +@@ -3104,15 +3096,23 @@ static void vc_sm_connected_init(void) + } + + /* Driver loading. */ +-static int __init vc_sm_init(void) ++static int bcm2835_vcsm_probe(struct platform_device *pdev) + { + pr_info("vc-sm: Videocore shared memory driver\n"); ++ ++ sm_state = kzalloc(sizeof(*sm_state), GFP_KERNEL); ++ if (!sm_state) ++ return -ENOMEM; ++ sm_state->pdev = pdev; ++ mutex_init(&sm_state->lock); ++ mutex_init(&sm_state->map_lock); ++ + vchiq_add_connected_callback(vc_sm_connected_init); + return 0; + } + + /* Driver unloading. */ +-static void __exit vc_sm_exit(void) ++static int bcm2835_vcsm_remove(struct platform_device *pdev) + { + pr_debug("[%s]: start\n", __func__); + if (sm_inited) { +@@ -3135,6 +3135,7 @@ static void __exit vc_sm_exit(void) + } + + pr_debug("[%s]: end\n", __func__); ++ return 0; + } + + #if defined(__KERNEL__) +@@ -3302,8 +3303,28 @@ int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, + EXPORT_SYMBOL_GPL(vc_sm_map); + #endif + +-late_initcall(vc_sm_init); +-module_exit(vc_sm_exit); ++/* ++ * Register the driver with device tree ++ */ ++ ++static const struct of_device_id bcm2835_vcsm_of_match[] = { ++ {.compatible = "raspberrypi,bcm2835-vcsm",}, ++ { /* sentinel */ }, ++}; ++ ++MODULE_DEVICE_TABLE(of, bcm2835_vcsm_of_match); ++ ++static struct platform_driver bcm2835_vcsm_driver = { ++ .probe = bcm2835_vcsm_probe, ++ .remove = bcm2835_vcsm_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_vcsm_of_match, ++ }, ++}; ++ ++module_platform_driver(bcm2835_vcsm_driver); + + MODULE_AUTHOR("Broadcom"); + MODULE_DESCRIPTION("VideoCore SharedMemory Driver"); + +From 3ecdfebebaab90395d84a47f92c094c898c5518e Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 15 Feb 2017 11:17:44 +0000 +Subject: [PATCH 343/407] VCSM: New option to import a DMABUF for VPU use + +Takes a dmabuf, and then calls over to the VPU to wrap +it into a suitable handle. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 57 ++++++- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 21 ++- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 9 ++ + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 7 + + drivers/char/broadcom/vc_sm/vmcs_sm.c | 269 ++++++++++++++++++++++++++++++- + include/linux/broadcom/vmcs_sm_ioctl.h | 18 ++- + 6 files changed, 359 insertions(+), 22 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +index 6c19aac6dc9df90edb9432bc32e7477d532d3278..bf057969644546d8f036044aa14d6606173b6a35 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_defs.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -26,8 +26,9 @@ + /* Resource name maximum size */ + #define VC_SM_RESOURCE_NAME 32 + +-/* All message types supported for HOST->VC direction */ + typedef enum { ++ /* Message types supported for HOST->VC direction */ ++ + /* Allocate shared memory block */ + VC_SM_MSG_TYPE_ALLOC, + /* Lock allocated shared memory block */ +@@ -45,6 +46,21 @@ typedef enum { + + /* A previously applied action will need to be reverted */ + VC_SM_MSG_TYPE_ACTION_CLEAN, ++ ++ /* ++ * Import a physical address and wrap into a MEM_HANDLE_T. ++ * Release with VC_SM_MSG_TYPE_FREE. ++ */ ++ VC_SM_MSG_TYPE_IMPORT, ++ ++ /* Message types supported for VC->HOST direction */ ++ ++ /* ++ * VC has finished with an imported memory allocation. ++ * Release any Linux reference counts on the underlying block. ++ */ ++ VC_SM_MSG_TYPE_RELEASED, ++ + VC_SM_MSG_TYPE_MAX + } VC_SM_MSG_TYPE; + +@@ -165,6 +181,41 @@ typedef struct { + + } VC_SM_FREE_ALL_T; + ++/* Request to import memory (HOST->VC) */ ++struct vc_sm_import { ++ /* type of memory to allocate */ ++ VC_SM_ALLOC_TYPE_T type; ++ /* pointer to the VC (ie physical) address of the allocated memory */ ++ uint32_t addr; ++ /* size of buffer */ ++ uint32_t size; ++ /* opaque handle returned in RELEASED messages */ ++ int32_t kernel_id; ++ /* Allocator identifier */ ++ uint32_t allocator; ++ /* resource name (for easier tracking on vc side) */ ++ char name[VC_SM_RESOURCE_NAME]; ++}; ++ ++/* Result of a requested memory import (VC->HOST) */ ++struct vc_sm_import_result { ++ /* Transaction identifier */ ++ uint32_t trans_id; ++ ++ /* Resource handle */ ++ uint32_t res_handle; ++}; ++ ++/* Notification that VC has finished with an allocation (VC->HOST) */ ++struct vc_sm_released { ++ /* pointer to the VC (ie physical) address of the allocated memory */ ++ uint32_t addr; ++ /* size of buffer */ ++ uint32_t size; ++ /* opaque handle returned in RELEASED messages */ ++ int32_t kernel_id; ++}; ++ + /* Union of ALL messages */ + typedef union { + VC_SM_ALLOC_T alloc; +@@ -175,7 +226,9 @@ typedef union { + VC_SM_LOCK_RESULT_T lock_result; + VC_SM_RESULT_T result; + VC_SM_FREE_ALL_T free_all; +- ++ struct vc_sm_import import; ++ struct vc_sm_import_result import_result; ++ struct vc_sm_released released; + } VC_SM_MSG_UNION_T; + + #endif /* __VC_SM_DEFS_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index 965f9a209a025202fea8065d3947c36f4fa43d0a..31050d3eb242b744c1ca43d6672d63b8439f7bc5 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -26,30 +26,27 @@ typedef enum { + + } VC_SM_LOCK_CACHE_MODE_T; + +-/* Allocate a shared memory handle and block. +-*/ ++/* Allocate a shared memory handle and block. */ + int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle); + +-/* Free a previously allocated shared memory handle and block. +-*/ ++/* Free a previously allocated shared memory handle and block. */ + int vc_sm_free(int handle); + +-/* Lock a memory handle for use by kernel. +-*/ ++/* Lock a memory handle for use by kernel. */ + int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, + long unsigned int *data); + +-/* Unlock a memory handle in use by kernel. +-*/ ++/* Unlock a memory handle in use by kernel. */ + int vc_sm_unlock(int handle, int flush, int no_vc_unlock); + +-/* Get an internal resource handle mapped from the external one. +-*/ ++/* Get an internal resource handle mapped from the external one. */ + int vc_sm_int_handle(int handle); + +-/* Map a shared memory region for use by kernel. +-*/ ++/* Map a shared memory region for use by kernel. */ + int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, + long unsigned int *data); + ++/* Import a block of memory into the GPU space. */ ++int vc_sm_import_dmabuf(struct dma_buf *dmabuf, int *handle); ++ + #endif /* __VC_SM_KNL_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index 7c6ba1a244a8aff8132e0177e02b2b2a6cd364e0..5690b265e3fcc650449f009abb792ee84b97e788 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -490,3 +490,12 @@ int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, VC_SM_ACTION_CLEAN_T *msg) + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ACTION_CLEAN, + msg, sizeof(*msg), 0, 0, 0, 0); + } ++ ++int vc_vchi_sm_import(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_import *msg, ++ struct vc_sm_import_result *result, ++ uint32_t *cur_trans_id) ++{ ++ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_IMPORT, ++ msg, sizeof(*msg), result, sizeof(*result), ++ cur_trans_id, 1); ++} +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index f8e555dc30074e7ff226cf34a96aa30a34176775..562217831fa744db99d94295c1c5a46f3a4780fb 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -89,4 +89,11 @@ int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); + int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, + VC_SM_ACTION_CLEAN_T *action_clean); + ++/* ++ * Import a contiguous block of memory and wrap it in a GPU MEM_HANDLE_T. ++ */ ++int vc_vchi_sm_import(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_import *msg, ++ struct vc_sm_import_result *result, ++ uint32_t *cur_trans_id); ++ + #endif /* __VC_VCHI_SM_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 57cd47f22449ad26eaedc86b4540764ec880dd5b..91e34dcbe88411a639f077fdf93da70762b1b1a6 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -69,6 +70,7 @@ enum SM_STATS_T { + MAP, + FLUSH, + INVALID, ++ IMPORT, + + END_ATTEMPT, + +@@ -80,6 +82,7 @@ enum SM_STATS_T { + MAP_FAIL, + FLUSH_FAIL, + INVALID_FAIL, ++ IMPORT_FAIL, + + END_ALL, + +@@ -93,6 +96,7 @@ static const char *const sm_stats_human_read[] = { + "Map", + "Cache Flush", + "Cache Invalidate", ++ "Import", + }; + + typedef int (*VC_SM_SHOW) (struct seq_file *s, void *v); +@@ -144,6 +148,12 @@ struct SM_RESOURCE_T { + uint8_t map_count; /* Counter of mappings for this resource. */ + struct list_head map_list; /* Maps associated with a resource. */ + ++ /* DMABUF related fields */ ++ struct dma_buf *dma_buf; ++ struct dma_buf_attachment *attach; ++ struct sg_table *sgt; ++ dma_addr_t dma_addr; ++ + struct SM_PRIV_DATA_T *private; + bool map; /* whether to map pages up front */ + }; +@@ -500,7 +510,9 @@ static void vmcs_sm_remove_map(struct SM_STATE_T *state, + static int vc_sm_global_state_show(struct seq_file *s, void *v) + { + struct sm_mmap *map = NULL; ++ struct SM_RESOURCE_T *resource = NULL; + int map_count = 0; ++ int resource_count = 0; + + if (sm_state == NULL) + return 0; +@@ -512,7 +524,41 @@ static int vc_sm_global_state_show(struct seq_file *s, void *v) + */ + + mutex_lock(&(sm_state->map_lock)); ++ seq_puts(s, "\nResources\n"); ++ if (!list_empty(&sm_state->resource_list)) { ++ list_for_each_entry(resource, &sm_state->resource_list, ++ global_resource_list) { ++ resource_count++; ++ ++ seq_printf(s, "\nResource %p\n", ++ resource); ++ seq_printf(s, " PID %u\n", ++ resource->pid); ++ seq_printf(s, " RES_GUID 0x%x\n", ++ resource->res_guid); ++ seq_printf(s, " LOCK_COUNT %u\n", ++ resource->lock_count); ++ seq_printf(s, " REF_COUNT %u\n", ++ resource->ref_count); ++ seq_printf(s, " res_handle 0x%X\n", ++ resource->res_handle); ++ seq_printf(s, " res_base_mem %p\n", ++ resource->res_base_mem); ++ seq_printf(s, " SIZE %d\n", ++ resource->res_size); ++ seq_printf(s, " DMABUF %p\n", ++ resource->dma_buf); ++ seq_printf(s, " ATTACH %p\n", ++ resource->attach); ++ seq_printf(s, " SGT %p\n", ++ resource->sgt); ++ seq_printf(s, " DMA_ADDR 0x%08X\n", ++ resource->dma_addr); ++ } ++ } ++ seq_printf(s, "\n\nTotal resource count: %d\n\n", resource_count); + ++ seq_puts(s, "\nMappings\n"); + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + map_count++; +@@ -527,6 +573,8 @@ static int vc_sm_global_state_show(struct seq_file *s, void *v) + map->res_usr_hdl); + seq_printf(s, " USR-ADDR 0x%lx\n", + map->res_addr); ++ seq_printf(s, " SIZE %d\n", ++ map->resource->res_size); + } + } + +@@ -843,7 +891,8 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + list_del(&resource->resource_list); + list_del(&resource->global_resource_list); + +- /* Walk the global resource list, find out if the resource is used ++ /* ++ * Walk the global resource list, find out if the resource is used + * somewhere else. In which case we don't want to delete it. + */ + list_for_each_entry(res_tmp, &sm_state->resource_list, +@@ -877,8 +926,7 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + up_write(¤t->mm->mmap_sem); + } + +- /* Free up the videocore allocated resource. +- */ ++ /* Free up the videocore allocated resource. */ + if (resource->res_handle) { + VC_SM_FREE_T free = { + resource->res_handle, (uint32_t)resource->res_base_mem +@@ -893,13 +941,19 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + } + } + +- /* Free up the shared resource. +- */ ++ if (resource->sgt) ++ dma_buf_unmap_attachment(resource->attach, resource->sgt, ++ DMA_BIDIRECTIONAL); ++ if (resource->attach) ++ dma_buf_detach(resource->dma_buf, resource->attach); ++ if (resource->dma_buf) ++ dma_buf_put(resource->dma_buf); ++ ++ /* Free up the shared resource. */ + if (resource->res_shared) + vmcs_sm_release_resource(resource->res_shared, 0); + +- /* Free up the local resource tracking this allocation. +- */ ++ /* Free up the local resource tracking this allocation. */ + vc_sm_resource_deceased(resource, force); + kfree(resource); + } +@@ -2055,6 +2109,137 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + return ret; + } + ++/* ++ * Import a contiguous block of memory to be shared with VC. ++ */ ++int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, ++ struct vmcs_sm_ioctl_import_dmabuf *ioparam, ++ struct dma_buf *src_dma_buf) ++{ ++ int ret = 0; ++ int status; ++ struct SM_RESOURCE_T *resource = NULL; ++ struct vc_sm_import import = { 0 }; ++ struct vc_sm_import_result result = { 0 }; ++ struct dma_buf *dma_buf; ++ struct dma_buf_attachment *attach = NULL; ++ struct sg_table *sgt = NULL; ++ ++ /* Setup our allocation parameters */ ++ if (src_dma_buf) { ++ get_dma_buf(src_dma_buf); ++ dma_buf = src_dma_buf; ++ } else { ++ dma_buf = dma_buf_get(ioparam->dmabuf_fd); ++ } ++ if (IS_ERR(dma_buf)) ++ return PTR_ERR(dma_buf); ++ ++ attach = dma_buf_attach(dma_buf, &sm_state->pdev->dev); ++ if (IS_ERR(attach)) { ++ ret = PTR_ERR(attach); ++ goto error; ++ } ++ ++ sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL); ++ if (IS_ERR(sgt)) { ++ ret = PTR_ERR(sgt); ++ goto error; ++ } ++ ++ /* Verify that the address block is contiguous */ ++ if (sgt->nents != 1) { ++ ret = -ENOMEM; ++ goto error; ++ } ++ ++ import.type = ((ioparam->cached == VMCS_SM_CACHE_VC) || ++ (ioparam->cached == VMCS_SM_CACHE_BOTH)) ? ++ VC_SM_ALLOC_CACHED : VC_SM_ALLOC_NON_CACHED; ++ import.addr = (uint32_t)sg_dma_address(sgt->sgl); ++ import.size = sg_dma_len(sgt->sgl); ++ import.allocator = current->tgid; ++ ++ if (*ioparam->name) ++ memcpy(import.name, ioparam->name, sizeof(import.name) - 1); ++ else ++ memcpy(import.name, VMCS_SM_RESOURCE_NAME_DEFAULT, ++ sizeof(VMCS_SM_RESOURCE_NAME_DEFAULT)); ++ ++ pr_debug("[%s]: attempt to import \"%s\" data - type %u, addr %p, size %u\n", ++ __func__, import.name, import.type, ++ (void *)import.addr, import.size); ++ ++ /* Allocate local resource to track this allocation. */ ++ resource = kzalloc(sizeof(*resource), GFP_KERNEL); ++ if (!resource) { ++ ret = -ENOMEM; ++ goto error; ++ } ++ INIT_LIST_HEAD(&resource->map_list); ++ resource->ref_count++; ++ resource->pid = current->tgid; ++ ++ /* Allocate the videocore resource. */ ++ status = vc_vchi_sm_import(sm_state->sm_handle, &import, &result, ++ &private->int_trans_id); ++ if (status == -EINTR) { ++ pr_debug("[%s]: requesting import memory action restart (trans_id: %u)\n", ++ __func__, private->int_trans_id); ++ ret = -ERESTARTSYS; ++ private->restart_sys = -EINTR; ++ private->int_action = VC_SM_MSG_TYPE_IMPORT; ++ goto error; ++ } else if (status || !result.res_handle) { ++ pr_debug("[%s]: failed to import memory on videocore (status: %u, trans_id: %u)\n", ++ __func__, status, private->int_trans_id); ++ ret = -ENOMEM; ++ resource->res_stats[ALLOC_FAIL]++; ++ goto error; ++ } ++ ++ /* Keep track of the resource we created. ++ */ ++ resource->private = private; ++ resource->res_handle = result.res_handle; ++ resource->res_size = import.size; ++ resource->res_cached = ioparam->cached; ++ ++ resource->dma_buf = dma_buf; ++ resource->attach = attach; ++ resource->sgt = sgt; ++ resource->dma_addr = sg_dma_address(sgt->sgl); ++ ++ /* Kernel/user GUID. This global identifier is used for mmap'ing the ++ * allocated region from user space, it is passed as the mmap'ing ++ * offset, we use it to 'hide' the videocore handle/address. ++ */ ++ mutex_lock(&sm_state->lock); ++ resource->res_guid = ++sm_state->guid; ++ mutex_unlock(&sm_state->lock); ++ resource->res_guid <<= PAGE_SHIFT; ++ ++ vmcs_sm_add_resource(private, resource); ++ ++ /* We're done */ ++ resource->res_stats[IMPORT]++; ++ ioparam->handle = resource->res_guid; ++ return 0; ++ ++error: ++ resource->res_stats[IMPORT_FAIL]++; ++ if (resource) { ++ vc_sm_resource_deceased(resource, 1); ++ kfree(resource); ++ } ++ if (sgt) ++ dma_buf_unmap_attachment(attach, sgt, DMA_BIDIRECTIONAL); ++ if (attach) ++ dma_buf_detach(dma_buf, attach); ++ dma_buf_put(dma_buf); ++ return ret; ++} ++ + /* Handle control from host. */ + static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { +@@ -2166,6 +2351,40 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + break; + ++ case VMCS_SM_CMD_IMPORT_DMABUF: ++ { ++ struct vmcs_sm_ioctl_import_dmabuf ioparam; ++ ++ /* Get the parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ret = vc_sm_ioctl_import_dmabuf(file_data, &ioparam, ++ NULL); ++ if (!ret && ++ (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0)) { ++ struct vmcs_sm_ioctl_free freeparam = { ++ ioparam.handle ++ }; ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ vc_sm_ioctl_free(file_data, &freeparam); ++ ret = -EFAULT; ++ } ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ + /* Lock (attempt to) *and* register a cache behavior change. + */ + case VMCS_SM_CMD_LOCK_CACHE: +@@ -3301,6 +3520,42 @@ int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, + return ret; + } + EXPORT_SYMBOL_GPL(vc_sm_map); ++ ++/* Import a dmabuf to be shared with VC. */ ++int vc_sm_import_dmabuf(struct dma_buf *dmabuf, int *handle) ++{ ++ struct vmcs_sm_ioctl_import_dmabuf ioparam = { 0 }; ++ int ret; ++ struct SM_RESOURCE_T *resource; ++ ++ /* Validate we can work with this device. */ ++ if (!sm_state || !dmabuf || !handle) { ++ pr_err("[%s]: invalid input\n", __func__); ++ return -EPERM; ++ } ++ ++ ioparam.cached = 0; ++ strcpy(ioparam.name, "KRNL DMABUF"); ++ ++ ret = vc_sm_ioctl_import_dmabuf(sm_state->data_knl, &ioparam, dmabuf); ++ ++ if (!ret) { ++ resource = vmcs_sm_acquire_resource(sm_state->data_knl, ++ ioparam.handle); ++ if (resource) { ++ resource->pid = 0; ++ vmcs_sm_release_resource(resource, 0); ++ ++ /* Assign valid handle at this time.*/ ++ *handle = ioparam.handle; ++ } else { ++ ret = -ENOMEM; ++ } ++ } ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(vc_sm_import_dmabuf); + #endif + + /* +diff --git a/include/linux/broadcom/vmcs_sm_ioctl.h b/include/linux/broadcom/vmcs_sm_ioctl.h +index 2de7f1f41070689c99cad3bd43d117458549cb51..b75729d762f25aace133f7a008633b4094ae2de2 100644 +--- a/include/linux/broadcom/vmcs_sm_ioctl.h ++++ b/include/linux/broadcom/vmcs_sm_ioctl.h +@@ -64,7 +64,9 @@ enum vmcs_sm_cmd_e { + VMCS_SM_CMD_CLEAN_INVALID, + VMCS_SM_CMD_CLEAN_INVALID2, + +- VMCS_SM_CMD_LAST /* Do no delete */ ++ VMCS_SM_CMD_IMPORT_DMABUF, ++ ++ VMCS_SM_CMD_LAST /* Do not delete */ + }; + + /* Cache type supported, conveniently matches the user space definition in +@@ -188,6 +190,16 @@ struct vmcs_sm_ioctl_clean_invalid2 { + } s[0]; + }; + ++struct vmcs_sm_ioctl_import_dmabuf { ++ /* user -> kernel */ ++ int dmabuf_fd; ++ enum vmcs_sm_cache_e cached; ++ char name[VMCS_SM_RESOURCE_NAME]; ++ ++ /* kernel -> user */ ++ unsigned int handle; ++}; ++ + /* IOCTL numbers */ + #define VMCS_SM_IOCTL_MEM_ALLOC\ + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_ALLOC,\ +@@ -257,6 +269,10 @@ struct vmcs_sm_ioctl_clean_invalid2 { + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_HOST_WALK_PID_MAP,\ + struct vmcs_sm_ioctl_walk) + ++#define VMCS_SM_IOCTL_MEM_IMPORT_DMABUF\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_IMPORT_DMABUF,\ ++ struct vmcs_sm_ioctl_import_dmabuf) ++ + /* ---- Variable Externs ------------------------------------------------- */ + + /* ---- Function Prototypes ---------------------------------------------- */ + +From d7af0bdcf915ec70156556f135022b592a1fe3bd Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:26:12 +0100 +Subject: [PATCH 344/407] vcsm: Remove all typedefs from vc_sm_defs.h and + calling code + +Remove typedefs on the structures that make up the IPC +to the firmware for VCSM. Update all calling code appropriately. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 83 ++++++++++++++++---------------- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 2 +- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 34 +++++++------ + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 19 ++++---- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 26 +++++----- + 5 files changed, 84 insertions(+), 80 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +index bf057969644546d8f036044aa14d6606173b6a35..29057db43404716406b06e3c3745e3d82219be16 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_defs.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -19,14 +19,14 @@ + #define VC_SM_SERVER_NAME MAKE_FOURCC("SMEM") + + /* Maximum message length */ +-#define VC_SM_MAX_MSG_LEN (sizeof(VC_SM_MSG_UNION_T) + \ +- sizeof(VC_SM_MSG_HDR_T)) +-#define VC_SM_MAX_RSP_LEN (sizeof(VC_SM_MSG_UNION_T)) ++#define VC_SM_MAX_MSG_LEN (sizeof(union vc_sm_msg_union_t) + \ ++ sizeof(struct vc_sm_msg_hdr_t)) ++#define VC_SM_MAX_RSP_LEN (sizeof(union vc_sm_msg_union_t)) + + /* Resource name maximum size */ + #define VC_SM_RESOURCE_NAME 32 + +-typedef enum { ++enum vc_sm_msg_type { + /* Message types supported for HOST->VC direction */ + + /* Allocate shared memory block */ +@@ -62,27 +62,26 @@ typedef enum { + VC_SM_MSG_TYPE_RELEASED, + + VC_SM_MSG_TYPE_MAX +-} VC_SM_MSG_TYPE; ++}; + + /* Type of memory to be allocated */ +-typedef enum { ++enum vc_sm_alloc_type_t { + VC_SM_ALLOC_CACHED, + VC_SM_ALLOC_NON_CACHED, +- +-} VC_SM_ALLOC_TYPE_T; ++}; + + /* Message header for all messages in HOST->VC direction */ +-typedef struct { ++struct vc_sm_msg_hdr_t { + int32_t type; + uint32_t trans_id; + uint8_t body[0]; + +-} VC_SM_MSG_HDR_T; ++}; + + /* Request to allocate memory (HOST->VC) */ +-typedef struct { ++struct vc_sm_alloc_t { + /* type of memory to allocate */ +- VC_SM_ALLOC_TYPE_T type; ++ enum vc_sm_alloc_type_t type; + /* byte amount of data to allocate per unit */ + uint32_t base_unit; + /* number of unit to allocate */ +@@ -94,10 +93,10 @@ typedef struct { + /* resource name (for easier tracking on vc side) */ + char name[VC_SM_RESOURCE_NAME]; + +-} VC_SM_ALLOC_T; ++}; + + /* Result of a requested memory allocation (VC->HOST) */ +-typedef struct { ++struct vc_sm_alloc_result_t { + /* Transaction identifier */ + uint32_t trans_id; + +@@ -110,28 +109,28 @@ typedef struct { + /* Resource number */ + uint32_t res_num; + +-} VC_SM_ALLOC_RESULT_T; ++}; + + /* Request to free a previously allocated memory (HOST->VC) */ +-typedef struct { ++struct vc_sm_free_t { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ + uint32_t res_mem; + +-} VC_SM_FREE_T; ++}; + + /* Request to lock a previously allocated memory (HOST->VC) */ +-typedef struct { ++struct vc_sm_lock_unlock_t { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ + uint32_t res_mem; + +-} VC_SM_LOCK_UNLOCK_T; ++}; + + /* Request to resize a previously allocated memory (HOST->VC) */ +-typedef struct { ++struct vc_sm_resize_t { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ +@@ -139,10 +138,10 @@ typedef struct { + /* Resource *new* size requested (bytes) */ + uint32_t res_new_size; + +-} VC_SM_RESIZE_T; ++}; + + /* Result of a requested memory lock (VC->HOST) */ +-typedef struct { ++struct vc_sm_lock_result_t { + /* Transaction identifier */ + uint32_t trans_id; + +@@ -154,37 +153,36 @@ typedef struct { + * was reallocated */ + uint32_t res_old_mem; + +-} VC_SM_LOCK_RESULT_T; ++}; + + /* Generic result for a request (VC->HOST) */ +-typedef struct { ++struct vc_sm_result_t { + /* Transaction identifier */ + uint32_t trans_id; + + int32_t success; + +-} VC_SM_RESULT_T; ++}; + + /* Request to revert a previously applied action (HOST->VC) */ +-typedef struct { ++struct vc_sm_action_clean_t { + /* Action of interest */ +- VC_SM_MSG_TYPE res_action; ++ enum vc_sm_msg_type res_action; + /* Transaction identifier for the action of interest */ + uint32_t action_trans_id; + +-} VC_SM_ACTION_CLEAN_T; ++}; + + /* Request to remove all data associated with a given allocator (HOST->VC) */ +-typedef struct { ++struct vc_sm_free_all_t { + /* Allocator identifier */ + uint32_t allocator; +- +-} VC_SM_FREE_ALL_T; ++}; + + /* Request to import memory (HOST->VC) */ + struct vc_sm_import { + /* type of memory to allocate */ +- VC_SM_ALLOC_TYPE_T type; ++ enum vc_sm_alloc_type_t type; + /* pointer to the VC (ie physical) address of the allocated memory */ + uint32_t addr; + /* size of buffer */ +@@ -217,18 +215,19 @@ struct vc_sm_released { + }; + + /* Union of ALL messages */ +-typedef union { +- VC_SM_ALLOC_T alloc; +- VC_SM_ALLOC_RESULT_T alloc_result; +- VC_SM_FREE_T free; +- VC_SM_ACTION_CLEAN_T action_clean; +- VC_SM_RESIZE_T resize; +- VC_SM_LOCK_RESULT_T lock_result; +- VC_SM_RESULT_T result; +- VC_SM_FREE_ALL_T free_all; ++union vc_sm_msg_union_t { ++ struct vc_sm_alloc_t alloc; ++ struct vc_sm_alloc_result_t alloc_result; ++ struct vc_sm_free_t free; ++ struct vc_sm_lock_unlock_t lock_unlock; ++ struct vc_sm_action_clean_t action_clean; ++ struct vc_sm_resize_t resize; ++ struct vc_sm_lock_result_t lock_result; ++ struct vc_sm_result_t result; ++ struct vc_sm_free_all_t free_all; + struct vc_sm_import import; + struct vc_sm_import_result import_result; + struct vc_sm_released released; +-} VC_SM_MSG_UNION_T; ++}; + + #endif /* __VC_SM_DEFS_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index 31050d3eb242b744c1ca43d6672d63b8439f7bc5..3c684ddde5c1fac5c726a71deec305f7588f0200 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -27,7 +27,7 @@ typedef enum { + } VC_SM_LOCK_CACHE_MODE_T; + + /* Allocate a shared memory handle and block. */ +-int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle); ++int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle); + + /* Free a previously allocated shared memory handle and block. */ + int vc_sm_free(int handle); +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index 5690b265e3fcc650449f009abb792ee84b97e788..656bb9f43bd7937debc2e5f773921c617a9723d5 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -73,11 +73,11 @@ struct sm_instance { + /* ---- Private Functions ------------------------------------------------ */ + static struct + sm_cmd_rsp_blk *vc_vchi_cmd_create(struct sm_instance *instance, +- VC_SM_MSG_TYPE id, void *msg, ++ enum vc_sm_msg_type id, void *msg, + uint32_t size, int wait) + { + struct sm_cmd_rsp_blk *blk; +- VC_SM_MSG_HDR_T *hdr; ++ struct vc_sm_msg_hdr_t *hdr; + + if (down_interruptible(&instance->free_sema)) { + blk = kmalloc(sizeof(*blk), GFP_KERNEL); +@@ -99,7 +99,7 @@ sm_cmd_rsp_blk *vc_vchi_cmd_create(struct sm_instance *instance, + blk->wait = wait; + blk->length = sizeof(*hdr) + size; + +- hdr = (VC_SM_MSG_HDR_T *) blk->msg; ++ hdr = (struct vc_sm_msg_hdr_t *) blk->msg; + hdr->type = id; + mutex_lock(&instance->lock); + hdr->trans_id = blk->id = ++instance->trans_id; +@@ -129,7 +129,7 @@ static int vc_vchi_sm_videocore_io(void *arg) + { + struct sm_instance *instance = arg; + struct sm_cmd_rsp_blk *cmd = NULL, *cmd_tmp; +- VC_SM_RESULT_T *reply; ++ struct vc_sm_result_t *reply; + uint32_t reply_len; + int32_t status; + int svc_use = 1; +@@ -367,7 +367,7 @@ int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle) + } + + int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_MSG_TYPE msg_id, ++ enum vc_sm_msg_type msg_id, + void *msg, uint32_t msg_size, + void *result, uint32_t result_size, + uint32_t *cur_trans_id, uint8_t wait_reply) +@@ -426,7 +426,8 @@ int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, + if (result && result_size) { + memcpy(result, cmd_blk->msg, result_size); + } else { +- VC_SM_RESULT_T *res = (VC_SM_RESULT_T *) cmd_blk->msg; ++ struct vc_sm_result_t *res = ++ (struct vc_sm_result_t *) cmd_blk->msg; + status = (res->success == 0) ? 0 : -ENXIO; + } + +@@ -437,8 +438,9 @@ int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, + return status; + } + +-int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, VC_SM_ALLOC_T *msg, +- VC_SM_ALLOC_RESULT_T *result, uint32_t *cur_trans_id) ++int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *msg, ++ struct vc_sm_alloc_result_t *result, ++ uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ALLOC, + msg, sizeof(*msg), result, sizeof(*result), +@@ -446,15 +448,16 @@ int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, VC_SM_ALLOC_T *msg, + } + + int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_FREE_T *msg, uint32_t *cur_trans_id) ++ struct vc_sm_free_t *msg, uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_FREE, + msg, sizeof(*msg), 0, 0, cur_trans_id, 0); + } + + int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_LOCK_UNLOCK_T *msg, +- VC_SM_LOCK_RESULT_T *result, uint32_t *cur_trans_id) ++ struct vc_sm_lock_unlock_t *msg, ++ struct vc_sm_lock_result_t *result, ++ uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_LOCK, + msg, sizeof(*msg), result, sizeof(*result), +@@ -462,7 +465,7 @@ int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + } + + int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_LOCK_UNLOCK_T *msg, ++ struct vc_sm_lock_unlock_t *msg, + uint32_t *cur_trans_id, uint8_t wait_reply) + { + return vc_vchi_sm_send_msg(handle, wait_reply ? +@@ -472,8 +475,8 @@ int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + wait_reply); + } + +-int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, VC_SM_RESIZE_T *msg, +- uint32_t *cur_trans_id) ++int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_resize_t *msg, ++ uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_RESIZE, + msg, sizeof(*msg), 0, 0, cur_trans_id, 1); +@@ -485,7 +488,8 @@ int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle) + 0, 0, 0, 0, 0, 0); + } + +-int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, VC_SM_ACTION_CLEAN_T *msg) ++int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, ++ struct vc_sm_action_clean_t *msg) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ACTION_CLEAN, + msg, sizeof(*msg), 0, 0, 0, 0); +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index 562217831fa744db99d94295c1c5a46f3a4780fb..f97cddf14881535c7f62a2ce0166a5eb7e3fad6d 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -41,31 +41,32 @@ int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle); + * return the result of this allocation (which upon success will be a pointer + * to some memory in videocore space). + */ +-int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_ALLOC_T *alloc, +- VC_SM_ALLOC_RESULT_T *alloc_result, uint32_t *trans_id); ++int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *alloc, ++ struct vc_sm_alloc_result_t *alloc_result, ++ uint32_t *trans_id); + + /* + * Ask the shared memory service to free up some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_FREE_T *free, uint32_t *trans_id); ++ struct vc_sm_free_t *free, uint32_t *trans_id); + + /* + * Ask the shared memory service to lock up some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_LOCK_UNLOCK_T *lock_unlock, +- VC_SM_LOCK_RESULT_T *lock_result, uint32_t *trans_id); ++ struct vc_sm_lock_unlock_t *lock_unlock, ++ struct vc_sm_lock_result_t *lock_result, ++ uint32_t *trans_id); + + /* + * Ask the shared memory service to unlock some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_LOCK_UNLOCK_T *lock_unlock, ++ struct vc_sm_lock_unlock_t *lock_unlock, + uint32_t *trans_id, uint8_t wait_reply); + + /* +@@ -73,7 +74,7 @@ int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_RESIZE_T *resize, uint32_t *trans_id); ++ struct vc_sm_resize_t *resize, uint32_t *trans_id); + + /* + * Walk the allocated resources on the videocore side, the allocation will +@@ -87,7 +88,7 @@ int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); + * in a bad state of some sort. + */ + int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_ACTION_CLEAN_T *action_clean); ++ struct vc_sm_action_clean_t *action_clean); + + /* + * Import a contiguous block of memory and wrap it in a GPU MEM_HANDLE_T. +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 91e34dcbe88411a639f077fdf93da70762b1b1a6..8d2a5dd4ee8fc1be4a6d24de93239e95f96b63ca 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -170,7 +170,7 @@ struct SM_PRIV_DATA_T { + struct SM_PDE_T dir_res; /* Debug fs resource sub-tree. */ + + int restart_sys; /* Tracks restart on interrupt. */ +- VC_SM_MSG_TYPE int_action; /* Interrupted action. */ ++ enum vc_sm_msg_type int_action; /* Interrupted action. */ + uint32_t int_trans_id; /* Interrupted transaction. */ + + }; +@@ -928,7 +928,7 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + + /* Free up the videocore allocated resource. */ + if (resource->res_handle) { +- VC_SM_FREE_T free = { ++ struct vc_sm_free_t free = { + resource->res_handle, (uint32_t)resource->res_base_mem + }; + int status = vc_vchi_sm_free(sm_state->sm_handle, &free, +@@ -1123,7 +1123,7 @@ static int vc_sm_release(struct inode *inode, struct file *file) + pr_debug("[%s]: using private data %p\n", __func__, file_data); + + if (file_data->restart_sys == -EINTR) { +- VC_SM_ACTION_CLEAN_T action_clean; ++ struct vc_sm_action_clean_t action_clean; + + pr_debug("[%s]: releasing following EINTR on %u (trans_id: %u) (likely due to signal)...\n", + __func__, file_data->int_action, +@@ -1189,8 +1189,8 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + /* Lock the resource if necessary. + */ + if (!resource->lock_count) { +- VC_SM_LOCK_UNLOCK_T lock_unlock; +- VC_SM_LOCK_RESULT_T lock_result; ++ struct vc_sm_lock_unlock_t lock_unlock; ++ struct vc_sm_lock_result_t lock_result; + int status; + + lock_unlock.res_handle = resource->res_handle; +@@ -1465,8 +1465,8 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + int ret = 0; + int status; + struct SM_RESOURCE_T *resource; +- VC_SM_ALLOC_T alloc = { 0 }; +- VC_SM_ALLOC_RESULT_T result = { 0 }; ++ struct vc_sm_alloc_t alloc = { 0 }; ++ struct vc_sm_alloc_result_t result = { 0 }; + enum vmcs_sm_cache_e cached = ioparam->cached; + bool map = false; + +@@ -1671,7 +1671,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + { + int ret = 0; + int status; +- VC_SM_RESIZE_T resize; ++ struct vc_sm_resize_t resize; + struct SM_RESOURCE_T *resource; + + /* Locate resource from GUID. +@@ -1761,8 +1761,8 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + unsigned int vc_addr) + { + int status; +- VC_SM_LOCK_UNLOCK_T lock; +- VC_SM_LOCK_RESULT_T result; ++ struct vc_sm_lock_unlock_t lock; ++ struct vc_sm_lock_result_t result; + struct SM_RESOURCE_T *resource; + int ret = 0; + struct sm_mmap *map, *map_tmp; +@@ -1935,7 +1935,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + int flush, int wait_reply, int no_vc_unlock) + { + int status; +- VC_SM_LOCK_UNLOCK_T unlock; ++ struct vc_sm_lock_unlock_t unlock; + struct sm_mmap *map, *map_tmp; + struct SM_RESOURCE_T *resource; + int ret = 0; +@@ -2261,7 +2261,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + /* Action is a re-post of a previously interrupted action? */ + if (file_data->restart_sys == -EINTR) { +- VC_SM_ACTION_CLEAN_T action_clean; ++ struct vc_sm_action_clean_t action_clean; + + pr_debug("[%s]: clean up of action %u (trans_id: %u) following EINTR\n", + __func__, file_data->int_action, +@@ -3359,7 +3359,7 @@ static int bcm2835_vcsm_remove(struct platform_device *pdev) + + #if defined(__KERNEL__) + /* Allocate a shared memory handle and block. */ +-int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle) ++int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle) + { + struct vmcs_sm_ioctl_alloc ioparam = { 0 }; + int ret; + +From 48bcf3b34f003a4f6e2d72d1f57e159d92901b85 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:29:53 +0100 +Subject: [PATCH 345/407] vcsm: Correct block comment style on licence headers. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 28 +++++++++++++++------------- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 28 +++++++++++++++------------- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 28 +++++++++++++++------------- + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 28 +++++++++++++++------------- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 28 +++++++++++++++------------- + 5 files changed, 75 insertions(+), 65 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +index 29057db43404716406b06e3c3745e3d82219be16..8242e8ef28e445ae132187d02c74448b0226c1a4 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_defs.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -1,16 +1,18 @@ +-/***************************************************************************** +-* Copyright 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ ++/* ++ **************************************************************************** ++ * Copyright 2011 Broadcom Corporation. All rights reserved. ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2, available at ++ * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a ++ * license other than the GPL, without Broadcom's express prior written ++ * consent. ++ **************************************************************************** ++ */ + + #ifndef __VC_SM_DEFS_H__INCLUDED__ + #define __VC_SM_DEFS_H__INCLUDED__ +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index 3c684ddde5c1fac5c726a71deec305f7588f0200..8252d13999a78609fcc7e1bbe83307e2b1c1f8f1 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -1,16 +1,18 @@ +-/***************************************************************************** +-* Copyright 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ ++/* ++ **************************************************************************** ++ * Copyright 2011 Broadcom Corporation. All rights reserved. ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2, available at ++ * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a ++ * license other than the GPL, without Broadcom's express prior written ++ * consent. ++ **************************************************************************** ++ */ + + #ifndef __VC_SM_KNL_H__INCLUDED__ + #define __VC_SM_KNL_H__INCLUDED__ +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index 656bb9f43bd7937debc2e5f773921c617a9723d5..a19c0f46672f5d298c38b8433b7a0ca780ea60b8 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -1,16 +1,18 @@ +-/***************************************************************************** +-* Copyright 2011-2012 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ ++/* ++ **************************************************************************** ++ * Copyright 2011-2012 Broadcom Corporation. All rights reserved. ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2, available at ++ * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a ++ * license other than the GPL, without Broadcom's express prior written ++ * consent. ++ **************************************************************************** ++ */ + + /* ---- Include Files ----------------------------------------------------- */ + #include +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index f97cddf14881535c7f62a2ce0166a5eb7e3fad6d..110db20ef517af9589616e5892c5b48681e62966 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -1,16 +1,18 @@ +-/***************************************************************************** +-* Copyright 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ ++/* ++ **************************************************************************** ++ * Copyright 2011 Broadcom Corporation. All rights reserved. ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2, available at ++ * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a ++ * license other than the GPL, without Broadcom's express prior written ++ * consent. ++ **************************************************************************** ++ */ + + #ifndef __VC_VCHI_SM_H__INCLUDED__ + #define __VC_VCHI_SM_H__INCLUDED__ +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 8d2a5dd4ee8fc1be4a6d24de93239e95f96b63ca..8a089666286aaf787560a9eb889e022495ed9a25 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -1,16 +1,18 @@ +-/***************************************************************************** +-* Copyright 2011-2012 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ ++/* ++ **************************************************************************** ++ * Copyright 2011-2012 Broadcom Corporation. All rights reserved. ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2, available at ++ * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a ++ * license other than the GPL, without Broadcom's express prior written ++ * consent. ++ **************************************************************************** ++ */ + + /* ---- Include Files ----------------------------------------------------- */ + + +From 55614d7d053ea64971f4dbb301812ed6f89b8f21 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:34:13 +0100 +Subject: [PATCH 346/407] vcsm: Fix block comment formatting + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 6 ++++-- + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 10 +++++----- + 2 files changed, 9 insertions(+), 7 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +index 8242e8ef28e445ae132187d02c74448b0226c1a4..de6afe9f65af45582c79a62abd41c688274ad8f2 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_defs.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -151,8 +151,10 @@ struct vc_sm_lock_result_t { + uint32_t res_handle; + /* Pointer to resource buffer */ + uint32_t res_mem; +- /* Pointer to former resource buffer if the memory +- * was reallocated */ ++ /* ++ * Pointer to former resource buffer if the memory ++ * was reallocated ++ */ + uint32_t res_old_mem; + + }; +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index 110db20ef517af9589616e5892c5b48681e62966..48e721c7f2e4ac5abe376a8481e01b0bbcc6d3ad 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -23,7 +23,7 @@ + + /* + * Forward declare. +-*/ ++ */ + typedef struct sm_instance *VC_VCHI_SM_HANDLE_T; + + /* +@@ -57,7 +57,7 @@ int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, + /* + * Ask the shared memory service to lock up some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. +-*/ ++ */ + int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + struct vc_sm_lock_unlock_t *lock_unlock, + struct vc_sm_lock_result_t *lock_result, +@@ -66,7 +66,7 @@ int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + /* + * Ask the shared memory service to unlock some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. +-*/ ++ */ + int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + struct vc_sm_lock_unlock_t *lock_unlock, + uint32_t *trans_id, uint8_t wait_reply); +@@ -74,7 +74,7 @@ int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + /* + * Ask the shared memory service to resize some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. +-*/ ++ */ + int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, + struct vc_sm_resize_t *resize, uint32_t *trans_id); + +@@ -82,7 +82,7 @@ int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, + * Walk the allocated resources on the videocore side, the allocation will + * show up in the log. This is purely for debug/information and takes no + * specific actions. +-*/ ++ */ + int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); + + /* + +From c9ce5049260e835d160b5116c3faa92d380e5b1d Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:50:29 +0100 +Subject: [PATCH 347/407] vcsm: Remove typedef of VC_VCHI_SM_HANDLE_T + +Replaced with struct sm_instance *. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 22 +++++++++++----------- + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 22 +++++++++++----------- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 2 +- + 3 files changed, 23 insertions(+), 23 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index a19c0f46672f5d298c38b8433b7a0ca780ea60b8..596628063e61a85e3467f6488b669f16e428d96c 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -250,7 +250,7 @@ static void vc_sm_vchi_callback(void *param, + } + } + +-VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, ++struct sm_instance *vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, + VCHI_CONNECTION_T **vchi_connections, + uint32_t num_connections) + { +@@ -334,7 +334,7 @@ VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, + return NULL; + } + +-int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle) ++int vc_vchi_sm_stop(struct sm_instance **handle) + { + struct sm_instance *instance; + uint32_t i; +@@ -368,7 +368,7 @@ int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle) + return -EINVAL; + } + +-int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_send_msg(struct sm_instance *handle, + enum vc_sm_msg_type msg_id, + void *msg, uint32_t msg_size, + void *result, uint32_t result_size, +@@ -440,7 +440,7 @@ int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, + return status; + } + +-int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *msg, ++int vc_vchi_sm_alloc(struct sm_instance *handle, struct vc_sm_alloc_t *msg, + struct vc_sm_alloc_result_t *result, + uint32_t *cur_trans_id) + { +@@ -449,14 +449,14 @@ int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *msg, + cur_trans_id, 1); + } + +-int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_free(struct sm_instance *handle, + struct vc_sm_free_t *msg, uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_FREE, + msg, sizeof(*msg), 0, 0, cur_trans_id, 0); + } + +-int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_lock(struct sm_instance *handle, + struct vc_sm_lock_unlock_t *msg, + struct vc_sm_lock_result_t *result, + uint32_t *cur_trans_id) +@@ -466,7 +466,7 @@ int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + cur_trans_id, 1); + } + +-int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_unlock(struct sm_instance *handle, + struct vc_sm_lock_unlock_t *msg, + uint32_t *cur_trans_id, uint8_t wait_reply) + { +@@ -477,27 +477,27 @@ int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + wait_reply); + } + +-int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_resize_t *msg, ++int vc_vchi_sm_resize(struct sm_instance *handle, struct vc_sm_resize_t *msg, + uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_RESIZE, + msg, sizeof(*msg), 0, 0, cur_trans_id, 1); + } + +-int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle) ++int vc_vchi_sm_walk_alloc(struct sm_instance *handle) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_WALK_ALLOC, + 0, 0, 0, 0, 0, 0); + } + +-int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_clean_up(struct sm_instance *handle, + struct vc_sm_action_clean_t *msg) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ACTION_CLEAN, + msg, sizeof(*msg), 0, 0, 0, 0); + } + +-int vc_vchi_sm_import(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_import *msg, ++int vc_vchi_sm_import(struct sm_instance *handle, struct vc_sm_import *msg, + struct vc_sm_import_result *result, + uint32_t *cur_trans_id) + { +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index 48e721c7f2e4ac5abe376a8481e01b0bbcc6d3ad..abe4ed15836f2be756083d3fdb4edb544dacc1a6 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -24,26 +24,26 @@ + /* + * Forward declare. + */ +-typedef struct sm_instance *VC_VCHI_SM_HANDLE_T; ++struct sm_instance; + + /* + * Initialize the shared memory service, opens up vchi connection to talk to it. + */ +-VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, ++struct sm_instance *vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, + VCHI_CONNECTION_T **vchi_connections, + uint32_t num_connections); + + /* + * Terminates the shared memory service. + */ +-int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle); ++int vc_vchi_sm_stop(struct sm_instance **handle); + + /* + * Ask the shared memory service to allocate some memory on videocre and + * return the result of this allocation (which upon success will be a pointer + * to some memory in videocore space). + */ +-int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *alloc, ++int vc_vchi_sm_alloc(struct sm_instance *handle, struct vc_sm_alloc_t *alloc, + struct vc_sm_alloc_result_t *alloc_result, + uint32_t *trans_id); + +@@ -51,14 +51,14 @@ int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *alloc, + * Ask the shared memory service to free up some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ +-int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_free(struct sm_instance *handle, + struct vc_sm_free_t *free, uint32_t *trans_id); + + /* + * Ask the shared memory service to lock up some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ +-int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_lock(struct sm_instance *handle, + struct vc_sm_lock_unlock_t *lock_unlock, + struct vc_sm_lock_result_t *lock_result, + uint32_t *trans_id); +@@ -67,7 +67,7 @@ int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + * Ask the shared memory service to unlock some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ +-int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_unlock(struct sm_instance *handle, + struct vc_sm_lock_unlock_t *lock_unlock, + uint32_t *trans_id, uint8_t wait_reply); + +@@ -75,7 +75,7 @@ int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + * Ask the shared memory service to resize some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ +-int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_resize(struct sm_instance *handle, + struct vc_sm_resize_t *resize, uint32_t *trans_id); + + /* +@@ -83,19 +83,19 @@ int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, + * show up in the log. This is purely for debug/information and takes no + * specific actions. + */ +-int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); ++int vc_vchi_sm_walk_alloc(struct sm_instance *handle); + + /* + * Clean up following a previously interrupted action which left the system + * in a bad state of some sort. + */ +-int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_clean_up(struct sm_instance *handle, + struct vc_sm_action_clean_t *action_clean); + + /* + * Import a contiguous block of memory and wrap it in a GPU MEM_HANDLE_T. + */ +-int vc_vchi_sm_import(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_import *msg, ++int vc_vchi_sm_import(struct sm_instance *handle, struct vc_sm_import *msg, + struct vc_sm_import_result *result, + uint32_t *cur_trans_id); + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 8a089666286aaf787560a9eb889e022495ed9a25..c92e2753e4c73c2f8ffb1bcfc375141540a02bb3 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -181,7 +181,7 @@ struct SM_PRIV_DATA_T { + */ + struct SM_STATE_T { + struct platform_device *pdev; +- VC_VCHI_SM_HANDLE_T sm_handle; /* Handle for videocore service. */ ++ struct sm_instance *sm_handle; /* Handle for videocore service. */ + struct dentry *dir_root; /* Debug fs entries root. */ + struct dentry *dir_alloc; /* Debug fs entries allocations. */ + struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ + +From 4784d3831e4036a6011e992edf81a3e2d9e44061 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:55:08 +0100 +Subject: [PATCH 348/407] vcsm: "unsigned int" preferred over "unsigned" fixed. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 3 ++- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index 596628063e61a85e3467f6488b669f16e428d96c..a2695196a94a214be309e512602d811ea3fe0bed 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -320,7 +320,8 @@ struct sm_instance *vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, + set_user_nice(instance->io_thread, -10); + wake_up_process(instance->io_thread); + +- pr_debug("%s: success - instance 0x%x", __func__, (unsigned)instance); ++ pr_debug("%s: success - instance 0x%x", __func__, ++ (unsigned int)instance); + return instance; + + err_close_services: +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index c92e2753e4c73c2f8ffb1bcfc375141540a02bb3..4ccc6ab3a03a6b2ea62f34c2f7cb82c35f271ad3 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -227,7 +227,7 @@ static const char *const sm_cache_map_vector[] = { + + /* ---- Private Functions ------------------------------------------------ */ + +-static inline unsigned vcaddr_to_pfn(unsigned long vc_addr) ++static inline unsigned int vcaddr_to_pfn(unsigned long vc_addr) + { + unsigned long pfn = vc_addr & 0x3FFFFFFF; + pfn += mm_vc_mem_phys_addr; + +From e1e4f954753bfd754b986840da7138c24fff36ec Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:59:49 +0100 +Subject: [PATCH 349/407] vcsm: Fix blank lines after declarations. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 1 + + drivers/char/broadcom/vc_sm/vmcs_sm.c | 7 +++++++ + 2 files changed, 8 insertions(+) + +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index a2695196a94a214be309e512602d811ea3fe0bed..847a51c9c95753754046088f5a608c0e07c6c597 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -355,6 +355,7 @@ int vc_vchi_sm_stop(struct sm_instance **handle) + /* Close all VCHI service connections */ + for (i = 0; i < instance->num_connections; i++) { + int32_t success; ++ + vchi_service_use(instance->vchi_handle[i]); + + success = vchi_service_close(instance->vchi_handle[i]); +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 4ccc6ab3a03a6b2ea62f34c2f7cb82c35f271ad3..13911b69858b7dc6c09b8a184cd8e509296c422b 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -230,6 +230,7 @@ static const char *const sm_cache_map_vector[] = { + static inline unsigned int vcaddr_to_pfn(unsigned long vc_addr) + { + unsigned long pfn = vc_addr & 0x3FFFFFFF; ++ + pfn += mm_vc_mem_phys_addr; + pfn >>= PAGE_SHIFT; + return pfn; +@@ -1441,9 +1442,11 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + if (resource->map) { + /* We don't use vmf->pgoff since that has the fake offset */ + unsigned long addr; ++ + for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) { + /* Finally, remap it */ + unsigned long pfn = (unsigned long)resource->res_base_mem & 0x3FFFFFFF; ++ + pfn += mm_vc_mem_phys_addr; + pfn += addr - vma->vm_start; + pfn >>= PAGE_SHIFT; +@@ -1974,6 +1977,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + /* Flush if requested */ + if (resource->res_cached && flush) { + dma_addr_t phys_addr = 0; ++ + resource->res_stats[FLUSH]++; + + phys_addr = +@@ -1988,6 +1992,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + if (map->vma) { + unsigned long start; + unsigned long end; ++ + start = map->vma->vm_start; + end = map->vma->vm_end; + +@@ -3022,6 +3027,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + if ((resource != NULL) && resource->res_cached) { + unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); + unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); ++ + resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; + + /* L1/L2 cache flush */ +@@ -3071,6 +3077,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + for (i=0; iblock_count; ++j) { + + + +From 4d2241e3534be421c302f7716575e434d176c94a Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:01:11 +0100 +Subject: [PATCH 350/407] vcsm: Fix erroneous space in 'if' statement. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 13911b69858b7dc6c09b8a184cd8e509296c422b..9a6f2217815d0511c25de374d3455bf5b0dabe55 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -1476,7 +1476,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + bool map = false; + + /* flag to requst buffer is mapped up front, rather than lazily */ +- if (cached & 0x80 ) { ++ if (cached & 0x80) { + map = true; + cached &= ~0x80; + } + +From 28616d10d28b2777883ec4e976e45a22312ac3d7 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:21:09 +0100 +Subject: [PATCH 351/407] vcsm: Fix lots of block quote formatting issues + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 563 ++++++++++++++-------------------- + 1 file changed, 231 insertions(+), 332 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 9a6f2217815d0511c25de374d3455bf5b0dabe55..4680d8a9f5acb99a4c4a400ac589c57f8061a615 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -61,8 +61,7 @@ + #define VC_SM_DEBUG "debug" + #define VC_SM_WRITE_BUF_SIZE 128 + +-/* Statistics tracked per resource and globally. +-*/ ++/* Statistics tracked per resource and globally. */ + enum SM_STATS_T { + /* Attempt. */ + ALLOC, +@@ -109,27 +108,25 @@ struct SM_PDE_T { + + }; + +-/* Single resource allocation tracked for all devices. +-*/ ++/* Single resource allocation tracked for all devices. */ + struct sm_mmap { + struct list_head map_list; /* Linked list of maps. */ + + struct SM_RESOURCE_T *resource; /* Pointer to the resource. */ + +- pid_t res_pid; /* PID owning that resource. */ ++ pid_t res_pid; /* PID owning that resource. */ + unsigned int res_vc_hdl; /* Resource handle (videocore). */ + unsigned int res_usr_hdl; /* Resource handle (user). */ + + long unsigned int res_addr; /* Mapped virtual address. */ + struct vm_area_struct *vma; /* VM area for this mapping. */ +- unsigned int ref_count; /* Reference count to this vma. */ ++ unsigned int ref_count; /* Reference count to this vma. */ + + /* Used to link maps associated with a resource. */ + struct list_head resource_map_list; + }; + +-/* Single resource allocation tracked for each opened device. +-*/ ++/* Single resource allocation tracked for each opened device. */ + struct SM_RESOURCE_T { + struct list_head resource_list; /* List of resources. */ + struct list_head global_resource_list; /* Global list of resources. */ +@@ -160,8 +157,7 @@ struct SM_RESOURCE_T { + bool map; /* whether to map pages up front */ + }; + +-/* Private file data associated with each opened device. +-*/ ++/* Private file data associated with each opened device. */ + struct SM_PRIV_DATA_T { + struct list_head resource_list; /* List of resources. */ + +@@ -177,8 +173,7 @@ struct SM_PRIV_DATA_T { + + }; + +-/* Global state information. +-*/ ++/* Global state information. */ + struct SM_STATE_T { + struct platform_device *pdev; + struct sm_instance *sm_handle; /* Handle for videocore service. */ +@@ -236,9 +231,10 @@ static inline unsigned int vcaddr_to_pfn(unsigned long vc_addr) + return pfn; + } + +-/* Carries over to the state statistics the statistics once owned by a deceased +-** resource. +-*/ ++/* ++ * Carries over to the state statistics the statistics once owned by a deceased ++ * resource. ++ */ + static void vc_sm_resource_deceased(struct SM_RESOURCE_T *p_res, int terminated) + { + if (sm_state != NULL) { +@@ -262,9 +258,10 @@ static void vc_sm_resource_deceased(struct SM_RESOURCE_T *p_res, int terminated) + } + } + +-/* Fetch a videocore handle corresponding to a mapping of the pid+address +-** returns 0 (ie NULL) if no such handle exists in the global map. +-*/ ++/* ++ * Fetch a videocore handle corresponding to a mapping of the pid+address ++ * returns 0 (ie NULL) if no such handle exists in the global map. ++ */ + static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid, + unsigned int addr) + { +@@ -276,8 +273,7 @@ static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid, + + mutex_lock(&(sm_state->map_lock)); + +- /* Lookup the resource. +- */ ++ /* Lookup the resource. */ + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + if (map->res_pid != pid || map->res_addr != addr) +@@ -295,13 +291,14 @@ static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid, + mutex_unlock(&(sm_state->map_lock)); + + out: +- /* Use a debug log here as it may be a valid situation that we query +- ** for something that is not mapped, we do not want a kernel log each +- ** time around. +- ** +- ** There are other error log that would pop up accordingly if someone +- ** subsequently tries to use something invalid after being told not to +- ** use it... ++ /* ++ * Use a debug log here as it may be a valid situation that we query ++ * for something that is not mapped, we do not want a kernel log each ++ * time around. ++ * ++ * There are other error log that would pop up accordingly if someone ++ * subsequently tries to use something invalid after being told not to ++ * use it... + */ + if (handle == 0) { + pr_debug("[%s]: not a valid map (pid %u, addr %x)\n", +@@ -311,9 +308,10 @@ static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid, + return handle; + } + +-/* Fetch a user handle corresponding to a mapping of the pid+address +-** returns 0 (ie NULL) if no such handle exists in the global map. +-*/ ++/* ++ * Fetch a user handle corresponding to a mapping of the pid+address ++ * returns 0 (ie NULL) if no such handle exists in the global map. ++ */ + static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid, + unsigned int addr) + { +@@ -325,8 +323,7 @@ static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid, + + mutex_lock(&(sm_state->map_lock)); + +- /* Lookup the resource. +- */ ++ /* Lookup the resource. */ + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + if (map->res_pid != pid || map->res_addr != addr) +@@ -344,7 +341,8 @@ static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid, + mutex_unlock(&(sm_state->map_lock)); + + out: +- /* Use a debug log here as it may be a valid situation that we query ++ /* ++ * Use a debug log here as it may be a valid situation that we query + * for something that is not mapped yet. + * + * There are other error log that would pop up accordingly if someone +@@ -359,9 +357,10 @@ static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid, + } + + #if defined(DO_NOT_USE) +-/* Fetch an address corresponding to a mapping of the pid+handle +-** returns 0 (ie NULL) if no such address exists in the global map. +-*/ ++/* ++ * Fetch an address corresponding to a mapping of the pid+handle ++ * returns 0 (ie NULL) if no such address exists in the global map. ++ */ + static unsigned int vmcs_sm_usr_address_from_pid_and_vc_handle(unsigned int pid, + unsigned int hdl) + { +@@ -373,8 +372,7 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_vc_handle(unsigned int pid, + + mutex_lock(&(sm_state->map_lock)); + +- /* Lookup the resource. +- */ ++ /* Lookup the resource. */ + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + if (map->res_pid != pid || map->res_vc_hdl != hdl) +@@ -392,13 +390,14 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_vc_handle(unsigned int pid, + mutex_unlock(&(sm_state->map_lock)); + + out: +- /* Use a debug log here as it may be a valid situation that we query +- ** for something that is not mapped, we do not want a kernel log each +- ** time around. +- ** +- ** There are other error log that would pop up accordingly if someone +- ** subsequently tries to use something invalid after being told not to +- ** use it... ++ /* ++ * Use a debug log here as it may be a valid situation that we query ++ * for something that is not mapped, we do not want a kernel log each ++ * time around. ++ * ++ * There are other error log that would pop up accordingly if someone ++ * subsequently tries to use something invalid after being told not to ++ * use it... + */ + if (addr == 0) + pr_debug("[%s]: not a valid map (pid %u, hdl %x)\n", +@@ -408,9 +407,10 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_vc_handle(unsigned int pid, + } + #endif + +-/* Fetch an address corresponding to a mapping of the pid+handle +-** returns 0 (ie NULL) if no such address exists in the global map. +-*/ ++/* ++ * Fetch an address corresponding to a mapping of the pid+handle ++ * returns 0 (ie NULL) if no such address exists in the global map. ++ */ + static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + pid, + unsigned int +@@ -424,8 +424,7 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + + mutex_lock(&(sm_state->map_lock)); + +- /* Lookup the resource. +- */ ++ /* Lookup the resource. */ + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + if (map->res_pid != pid || map->res_usr_hdl != hdl) +@@ -443,7 +442,8 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + mutex_unlock(&(sm_state->map_lock)); + + out: +- /* Use a debug log here as it may be a valid situation that we query ++ /* ++ * Use a debug log here as it may be a valid situation that we query + * for something that is not mapped, we do not want a kernel log each + * time around. + * +@@ -458,19 +458,16 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + return addr; + } + +-/* Adds a resource mapping to the global data list. +-*/ ++/* Adds a resource mapping to the global data list. */ + static void vmcs_sm_add_map(struct SM_STATE_T *state, + struct SM_RESOURCE_T *resource, struct sm_mmap *map) + { + mutex_lock(&(state->map_lock)); + +- /* Add to the global list of mappings +- */ ++ /* Add to the global list of mappings */ + list_add(&map->map_list, &state->map_list); + +- /* Add to the list of mappings for this resource +- */ ++ /* Add to the list of mappings for this resource */ + list_add(&map->resource_map_list, &resource->map_list); + resource->map_count++; + +@@ -481,20 +478,17 @@ static void vmcs_sm_add_map(struct SM_STATE_T *state, + map->res_usr_hdl, map->res_addr); + } + +-/* Removes a resource mapping from the global data list. +-*/ ++/* Removes a resource mapping from the global data list. */ + static void vmcs_sm_remove_map(struct SM_STATE_T *state, + struct SM_RESOURCE_T *resource, + struct sm_mmap *map) + { + mutex_lock(&(state->map_lock)); + +- /* Remove from the global list of mappings +- */ ++ /* Remove from the global list of mappings */ + list_del(&map->map_list); + +- /* Remove from the list of mapping for this resource +- */ ++ /* Remove from the list of mapping for this resource */ + list_del(&map->resource_map_list); + if (resource->map_count > 0) + resource->map_count--; +@@ -508,8 +502,7 @@ static void vmcs_sm_remove_map(struct SM_STATE_T *state, + kfree(map); + } + +-/* Read callback for the global state proc entry. +-*/ ++/* Read callback for the global state proc entry. */ + static int vc_sm_global_state_show(struct seq_file *s, void *v) + { + struct sm_mmap *map = NULL; +@@ -523,8 +516,7 @@ static int vc_sm_global_state_show(struct seq_file *s, void *v) + seq_printf(s, "\nVC-ServiceHandle 0x%x\n", + (unsigned int)sm_state->sm_handle); + +- /* Log all applicable mapping(s). +- */ ++ /* Log all applicable mapping(s). */ + + mutex_lock(&(sm_state->map_lock)); + seq_puts(s, "\nResources\n"); +@@ -591,8 +583,7 @@ static int vc_sm_global_statistics_show(struct seq_file *s, void *v) + { + int ix; + +- /* Global state tracked statistics. +- */ ++ /* Global state tracked statistics. */ + if (sm_state != NULL) { + seq_puts(s, "\nDeceased Resources Statistics\n"); + +@@ -638,8 +629,7 @@ static int vc_sm_global_statistics_show(struct seq_file *s, void *v) + } + + #if 0 +-/* Read callback for the statistics proc entry. +-*/ ++/* Read callback for the statistics proc entry. */ + static int vc_sm_statistics_show(struct seq_file *s, void *v) + { + int ix; +@@ -654,8 +644,7 @@ static int vc_sm_statistics_show(struct seq_file *s, void *v) + if (file_data == NULL) + return 0; + +- /* Per process statistics. +- */ ++ /* Per process statistics. */ + + seq_printf(s, "\nStatistics for TGID %d\n", file_data->pid); + +@@ -771,9 +760,10 @@ static const struct file_operations vc_sm_debug_fs_fops = { + .release = single_release, + }; + +-/* Adds a resource to the private data list which tracks all the allocated +-** data. +-*/ ++/* ++ * Adds a resource to the private data list which tracks all the allocated ++ * data. ++ */ + static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, + struct SM_RESOURCE_T *resource) + { +@@ -787,9 +777,10 @@ static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, + resource->res_handle, resource->res_size, resource->res_cached); + } + +-/* Locates a resource and acquire a reference on it. +-** The resource won't be deleted while there is a reference on it. +-*/ ++/* ++ * Locates a resource and acquire a reference on it. ++ * The resource won't be deleted while there is a reference on it. ++ */ + static struct SM_RESOURCE_T *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T + *private, + unsigned int res_guid) +@@ -816,9 +807,10 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T + return ret; + } + +-/* Locates a resource and acquire a reference on it. +-** The resource won't be deleted while there is a reference on it. +-*/ ++/* ++ * Locates a resource and acquire a reference on it. ++ * The resource won't be deleted while there is a reference on it. ++ */ + static struct SM_RESOURCE_T *vmcs_sm_acquire_first_resource( + struct SM_PRIV_DATA_T *private) + { +@@ -841,9 +833,10 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_first_resource( + return ret; + } + +-/* Locates a resource and acquire a reference on it. +-** The resource won't be deleted while there is a reference on it. +-*/ ++/* ++ * Locates a resource and acquire a reference on it. ++ * The resource won't be deleted while there is a reference on it. ++ */ + static struct SM_RESOURCE_T *vmcs_sm_acquire_global_resource(unsigned int + res_guid) + { +@@ -870,9 +863,10 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_global_resource(unsigned int + return ret; + } + +-/* Release a previously acquired resource. +-** The resource will be deleted when its refcount reaches 0. +-*/ ++/* ++ * Release a previously acquired resource. ++ * The resource will be deleted when its refcount reaches 0. ++ */ + static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + { + struct SM_PRIV_DATA_T *private = resource->private; +@@ -961,16 +955,16 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + kfree(resource); + } + +-/* Dump the map table for the driver. If process is -1, dumps the whole table, +-** if process is a valid pid (non -1) dump only the entries associated with the +-** pid of interest. +-*/ ++/* ++ * Dump the map table for the driver. If process is -1, dumps the whole table, ++ * if process is a valid pid (non -1) dump only the entries associated with the ++ * pid of interest. ++ */ + static void vmcs_sm_host_walk_map_per_pid(int pid) + { + struct sm_mmap *map = NULL; + +- /* Make sure the device was started properly. +- */ ++ /* Make sure the device was started properly. */ + if (sm_state == NULL) { + pr_err("[%s]: invalid device\n", __func__); + return; +@@ -978,8 +972,7 @@ static void vmcs_sm_host_walk_map_per_pid(int pid) + + mutex_lock(&(sm_state->map_lock)); + +- /* Log all applicable mapping(s). +- */ ++ /* Log all applicable mapping(s). */ + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + if (pid == -1 || map->res_pid == pid) { +@@ -995,15 +988,15 @@ static void vmcs_sm_host_walk_map_per_pid(int pid) + return; + } + +-/* Dump the allocation table from host side point of view. This only dumps the +-** data allocated for this process/device referenced by the file_data. +-*/ ++/* ++ * Dump the allocation table from host side point of view. This only dumps the ++ * data allocated for this process/device referenced by the file_data. ++ */ + static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) + { + struct SM_RESOURCE_T *resource = NULL; + +- /* Make sure the device was started properly. +- */ ++ /* Make sure the device was started properly. */ + if ((sm_state == NULL) || (file_data == NULL)) { + pr_err("[%s]: invalid device\n", __func__); + return; +@@ -1026,8 +1019,7 @@ static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) + return; + } + +-/* Create support for private data tracking. +-*/ ++/* Create support for private data tracking. */ + static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) + { + char alloc_name[32]; +@@ -1078,15 +1070,15 @@ static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) + return file_data; + } + +-/* Open the device. Creates a private state to help track all allocation +-** associated with this device. +-*/ ++/* ++ * Open the device. Creates a private state to help track all allocation ++ * associated with this device. ++ */ + static int vc_sm_open(struct inode *inode, struct file *file) + { + int ret = 0; + +- /* Make sure the device was started properly. +- */ ++ /* Make sure the device was started properly. */ + if (!sm_state) { + pr_err("[%s]: invalid device\n", __func__); + ret = -EPERM; +@@ -1105,9 +1097,10 @@ static int vc_sm_open(struct inode *inode, struct file *file) + return ret; + } + +-/* Close the device. Free up all resources still associated with this device +-** at the time. +-*/ ++/* ++ * Close the device. Free up all resources still associated with this device ++ * at the time. ++ */ + static int vc_sm_release(struct inode *inode, struct file *file) + { + struct SM_PRIV_DATA_T *file_data = +@@ -1115,8 +1108,7 @@ static int vc_sm_release(struct inode *inode, struct file *file) + struct SM_RESOURCE_T *resource; + int ret = 0; + +- /* Make sure the device was started properly. +- */ ++ /* Make sure the device was started properly. */ + if (sm_state == NULL || file_data == NULL) { + pr_err("[%s]: invalid device\n", __func__); + ret = -EPERM; +@@ -1146,8 +1138,7 @@ static int vc_sm_release(struct inode *inode, struct file *file) + /* Remove the corresponding proc entry. */ + debugfs_remove_recursive(file_data->dir_pid); + +- /* Terminate the private data. +- */ ++ /* Terminate the private data. */ + kfree(file_data); + + out: +@@ -1175,8 +1166,7 @@ static void vcsm_vma_close(struct vm_area_struct *vma) + + map->ref_count--; + +- /* Remove from the map table. +- */ ++ /* Remove from the map table. */ + if (map->ref_count == 0) + vmcs_sm_remove_map(sm_state, map->resource, map); + } +@@ -1189,8 +1179,7 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + unsigned long pfn; + int ret = 0; + +- /* Lock the resource if necessary. +- */ ++ /* Lock the resource if necessary. */ + if (!resource->lock_count) { + struct vc_sm_lock_unlock_t lock_unlock; + struct vc_sm_lock_result_t lock_result; +@@ -1203,8 +1192,7 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + __func__, lock_unlock.res_handle, + (void *)lock_unlock.res_mem); + +- /* Lock the videocore allocated resource. +- */ ++ /* Lock the videocore allocated resource. */ + status = vc_vchi_sm_lock(sm_state->sm_handle, + &lock_unlock, &lock_result, 0); + if (status || !lock_result.res_mem) { +@@ -1221,8 +1209,7 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + resource->res_stats[LOCK]++; + resource->lock_count++; + +- /* Keep track of the new base memory. +- */ ++ /* Keep track of the new base memory. */ + if (lock_result.res_mem && + lock_result.res_old_mem && + (lock_result.res_mem != lock_result.res_old_mem)) { +@@ -1244,9 +1231,9 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + case 0: + case -ERESTARTSYS: + /* +- * EBUSY is ok: this just means that another thread +- * already did the job. +- */ ++ * EBUSY is ok: this just means that another thread ++ * already did the job. ++ */ + case -EBUSY: + return VM_FAULT_NOPAGE; + case -ENOMEM: +@@ -1324,8 +1311,7 @@ static void vcsm_vma_cache_clean_page_range(unsigned long addr, + } while (pgd++, addr = pgd_next, addr != end); + } + +-/* Map an allocated data into something that the user space. +-*/ ++/* Map an allocated data into something that the user space. */ + static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + { + int ret = 0; +@@ -1334,8 +1320,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + struct SM_RESOURCE_T *resource = NULL; + struct sm_mmap *map = NULL; + +- /* Make sure the device was started properly. +- */ ++ /* Make sure the device was started properly. */ + if ((sm_state == NULL) || (file_data == NULL)) { + pr_err("[%s]: invalid device\n", __func__); + return -EPERM; +@@ -1344,11 +1329,12 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + pr_debug("[%s]: private data %p, guid %x\n", __func__, file_data, + ((unsigned int)vma->vm_pgoff << PAGE_SHIFT)); + +- /* We lookup to make sure that the data we are being asked to mmap is +- ** something that we allocated. +- ** +- ** We use the offset information as the key to tell us which resource +- ** we are mapping. ++ /* ++ * We lookup to make sure that the data we are being asked to mmap is ++ * something that we allocated. ++ * ++ * We use the offset information as the key to tell us which resource ++ * we are mapping. + */ + resource = vmcs_sm_acquire_resource(file_data, + ((unsigned int)vma->vm_pgoff << +@@ -1363,8 +1349,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + __func__, resource->res_guid, current->tgid, resource->pid, + file_data->pid); + +- /* Check permissions. +- */ ++ /* Check permissions. */ + if (resource->pid && (resource->pid != current->tgid)) { + pr_err("[%s]: current tgid %u != %u owner\n", + __func__, current->tgid, resource->pid); +@@ -1372,8 +1357,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + goto error; + } + +- /* Verify that what we are asked to mmap is proper. +- */ ++ /* Verify that what we are asked to mmap is proper. */ + if (resource->res_size != (unsigned int)(vma->vm_end - vma->vm_start)) { + pr_err("[%s]: size inconsistency (resource: %u - mmap: %u)\n", + __func__, +@@ -1384,7 +1368,8 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + goto error; + } + +- /* Keep track of the tuple in the global resource list such that one ++ /* ++ * Keep track of the tuple in the global resource list such that one + * can do a mapping lookup for address/memory handle. + */ + map = kzalloc(sizeof(*map), GFP_KERNEL); +@@ -1403,8 +1388,9 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + map->vma = vma; + vmcs_sm_add_map(sm_state, resource, map); + +- /* We are not actually mapping the pages, we just provide a fault +- ** handler to allow pages to be mapped when accessed ++ /* ++ * We are not actually mapping the pages, we just provide a fault ++ * handler to allow pages to be mapped when accessed + */ + vma->vm_flags |= + VM_IO | VM_PFNMAP | VM_DONTCOPY | VM_DONTEXPAND; +@@ -1418,8 +1404,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + + if ((resource->res_cached == VMCS_SM_CACHE_NONE) || + (resource->res_cached == VMCS_SM_CACHE_VC)) { +- /* Allocated non host cached memory, honour it. +- */ ++ /* Allocated non host cached memory, honour it. */ + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + } + +@@ -1462,8 +1447,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + return ret; + } + +-/* Allocate a shared memory handle and block. +-*/ ++/* Allocate a shared memory handle and block. */ + int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_alloc *ioparam) + { +@@ -1505,8 +1489,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + __func__, alloc.name, alloc.type, ioparam->size, + alloc.base_unit, alloc.num_unit, alloc.alignement); + +- /* Allocate local resource to track this allocation. +- */ ++ /* Allocate local resource to track this allocation. */ + resource = kzalloc(sizeof(*resource), GFP_KERNEL); + if (!resource) { + ret = -ENOMEM; +@@ -1516,8 +1499,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + resource->ref_count++; + resource->pid = current->tgid; + +- /* Allocate the videocore resource. +- */ ++ /* Allocate the videocore resource. */ + status = vc_vchi_sm_alloc(sm_state->sm_handle, &alloc, &result, + &private->int_trans_id); + if (status == -EINTR) { +@@ -1535,8 +1517,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + goto error; + } + +- /* Keep track of the resource we created. +- */ ++ /* Keep track of the resource we created. */ + resource->private = private; + resource->res_handle = result.res_handle; + resource->res_base_mem = (void *)result.res_mem; +@@ -1544,7 +1525,8 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + resource->res_cached = cached; + resource->map = map; + +- /* Kernel/user GUID. This global identifier is used for mmap'ing the ++ /* ++ * Kernel/user GUID. This global identifier is used for mmap'ing the + * allocated region from user space, it is passed as the mmap'ing + * offset, we use it to 'hide' the videocore handle/address. + */ +@@ -1576,8 +1558,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + return ret; + } + +-/* Share an allocate memory handle and block. +-*/ ++/* Share an allocate memory handle and block.*/ + int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_alloc_share *ioparam) + { +@@ -1593,8 +1574,7 @@ int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + goto error; + } + +- /* Allocate local resource to track this allocation. +- */ ++ /* Allocate local resource to track this allocation. */ + resource = kzalloc(sizeof(*resource), GFP_KERNEL); + if (resource == NULL) { + pr_err("[%s]: failed to allocate local tracking resource\n", +@@ -1606,8 +1586,7 @@ int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + resource->ref_count++; + resource->pid = current->tgid; + +- /* Keep track of the resource we created. +- */ ++ /* Keep track of the resource we created. */ + resource->private = private; + resource->res_handle = shared_resource->res_handle; + resource->res_base_mem = shared_resource->res_base_mem; +@@ -1641,8 +1620,7 @@ int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + return ret; + } + +-/* Free a previously allocated shared memory handle and block. +-*/ ++/* Free a previously allocated shared memory handle and block.*/ + static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_free *ioparam) + { +@@ -1655,8 +1633,7 @@ static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, + return -EINVAL; + } + +- /* Check permissions. +- */ ++ /* Check permissions. */ + if (resource->pid && (resource->pid != current->tgid)) { + pr_err("[%s]: current tgid %u != %u owner\n", + __func__, current->tgid, resource->pid); +@@ -1669,8 +1646,7 @@ static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, + return 0; + } + +-/* Resize a previously allocated shared memory handle and block. +-*/ ++/* Resize a previously allocated shared memory handle and block. */ + static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_resize *ioparam) + { +@@ -1679,8 +1655,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + struct vc_sm_resize_t resize; + struct SM_RESOURCE_T *resource; + +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = vmcs_sm_acquire_resource(private, ioparam->handle); + if (!resource) { + pr_err("[%s]: failed resource - guid %x\n", +@@ -1689,9 +1664,10 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + goto error; + } + +- /* If the resource is locked, its reference count will be not NULL, +- ** in which case we will not be allowed to resize it anyways, so +- ** reject the attempt here. ++ /* ++ * If the resource is locked, its reference count will be not NULL, ++ * in which case we will not be allowed to resize it anyways, so ++ * reject the attempt here. + */ + if (resource->lock_count != 0) { + pr_err("[%s]: cannot resize - guid %x, ref-cnt %d\n", +@@ -1700,8 +1676,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + goto error; + } + +- /* Check permissions. +- */ ++ /* Check permissions. */ + if (resource->pid && (resource->pid != current->tgid)) { + pr_err("[%s]: current tgid %u != %u owner\n", __func__, + current->tgid, resource->pid); +@@ -1724,8 +1699,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + __func__, ioparam->handle, resize.res_handle, + (void *)resize.res_mem); + +- /* Resize the videocore allocated resource. +- */ ++ /* Resize the videocore allocated resource. */ + status = vc_vchi_sm_resize(sm_state->sm_handle, &resize, + &private->int_trans_id); + if (status == -EINTR) { +@@ -1746,8 +1720,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + __func__, resize.res_handle, resource->res_size, + resize.res_new_size); + +- /* Successfully resized, save the information and inform the user. +- */ ++ /* Successfully resized, save the information and inform the user. */ + ioparam->old_size = resource->res_size; + resource->res_size = resize.res_new_size; + +@@ -1758,8 +1731,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + return ret; + } + +-/* Lock a previously allocated shared memory handle and block. +-*/ ++/* Lock a previously allocated shared memory handle and block. */ + static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_lock_unlock *ioparam, + int change_cache, enum vmcs_sm_cache_e cache_type, +@@ -1775,16 +1747,14 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + + map = NULL; + +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = vmcs_sm_acquire_resource(private, ioparam->handle); + if (resource == NULL) { + ret = -EINVAL; + goto error; + } + +- /* Check permissions. +- */ ++ /* Check permissions. */ + if (resource->pid && (resource->pid != current->tgid)) { + pr_err("[%s]: current tgid %u != %u owner\n", __func__, + current->tgid, resource->pid); +@@ -1795,15 +1765,13 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + lock.res_handle = resource->res_handle; + lock.res_mem = (uint32_t)resource->res_base_mem; + +- /* Take the lock and get the address to be mapped. +- */ ++ /* Take the lock and get the address to be mapped. */ + if (vc_addr == 0) { + pr_debug("[%s]: attempt to lock data - guid %x, hdl %x, base address %p\n", + __func__, ioparam->handle, lock.res_handle, + (void *)lock.res_mem); + +- /* Lock the videocore allocated resource. +- */ ++ /* Lock the videocore allocated resource. */ + status = vc_vchi_sm_lock(sm_state->sm_handle, &lock, &result, + &private->int_trans_id); + if (status == -EINTR) { +@@ -1826,24 +1794,21 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + __func__, lock.res_handle, (void *)result.res_mem, + (void *)lock.res_mem, resource->lock_count); + } +- /* Lock assumed taken already, address to be mapped is known. +- */ ++ /* Lock assumed taken already, address to be mapped is known. */ + else + resource->res_base_mem = (void *)vc_addr; + + resource->res_stats[LOCK]++; + resource->lock_count++; + +- /* Keep track of the new base memory allocation if it has changed. +- */ ++ /* Keep track of the new base memory allocation if it has changed. */ + if ((vc_addr == 0) && + ((void *)result.res_mem) && + ((void *)result.res_old_mem) && + (result.res_mem != result.res_old_mem)) { + resource->res_base_mem = (void *)result.res_mem; + +- /* Kernel allocated resources. +- */ ++ /* Kernel allocated resources. */ + if (resource->pid == 0) { + if (!list_empty(&resource->map_list)) { + list_for_each_entry_safe(map, map_tmp, +@@ -1875,8 +1840,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + __func__, resource->map_count, private->pid, + current->tgid, ioparam->handle, ioparam->addr); + } else { +- /* Kernel allocated resources. +- */ ++ /* Kernel allocated resources. */ + if (resource->pid == 0) { + pr_debug("[%s]: attempt mapping kernel resource - guid %x, hdl %x\n", + __func__, ioparam->handle, lock.res_handle); +@@ -1933,8 +1897,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + return ret; + } + +-/* Unlock a previously allocated shared memory handle and block. +-*/ ++/* Unlock a previously allocated shared memory handle and block.*/ + static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_lock_unlock *ioparam, + int flush, int wait_reply, int no_vc_unlock) +@@ -1947,16 +1910,14 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + + map = NULL; + +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = vmcs_sm_acquire_resource(private, ioparam->handle); + if (resource == NULL) { + ret = -EINVAL; + goto error; + } + +- /* Check permissions. +- */ ++ /* Check permissions. */ + if (resource->pid && (resource->pid != current->tgid)) { + pr_err("[%s]: current tgid %u != %u owner\n", + __func__, current->tgid, resource->pid); +@@ -1971,8 +1932,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + __func__, ioparam->handle, unlock.res_handle, + (void *)unlock.res_mem); + +- /* User space allocated resources. +- */ ++ /* User space allocated resources. */ + if (resource->pid) { + /* Flush if requested */ + if (resource->res_cached && flush) { +@@ -2071,12 +2031,10 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + } + + if (resource->lock_count) { +- /* Bypass the videocore unlock. +- */ ++ /* Bypass the videocore unlock. */ + if (no_vc_unlock) + status = 0; +- /* Unlock the videocore allocated resource. +- */ ++ /* Unlock the videocore allocated resource. */ + else { + status = + vc_vchi_sm_unlock(sm_state->sm_handle, &unlock, +@@ -2116,9 +2074,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + return ret; + } + +-/* +- * Import a contiguous block of memory to be shared with VC. +- */ ++/* Import a contiguous block of memory to be shared with VC. */ + int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_import_dmabuf *ioparam, + struct dma_buf *src_dma_buf) +@@ -2205,8 +2161,7 @@ int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, + goto error; + } + +- /* Keep track of the resource we created. +- */ ++ /* Keep track of the resource we created. */ + resource->private = private; + resource->res_handle = result.res_handle; + resource->res_size = import.size; +@@ -2217,7 +2172,8 @@ int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, + resource->sgt = sgt; + resource->dma_addr = sg_dma_address(sgt->sgl); + +- /* Kernel/user GUID. This global identifier is used for mmap'ing the ++ /* ++ * Kernel/user GUID. This global identifier is used for mmap'ing the + * allocated region from user space, it is passed as the mmap'ing + * offset, we use it to 'hide' the videocore handle/address. + */ +@@ -2282,8 +2238,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + file_data->restart_sys = 0; + } + +- /* Now process the command. +- */ ++ /* Now process the command. */ + switch (cmdnr) { + /* New memory allocation. + */ +@@ -2291,8 +2246,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { + struct vmcs_sm_ioctl_alloc ioparam; + +- /* Get the parameter data. +- */ ++ /* Get the parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2314,20 +2268,17 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; + +- /* Share existing memory allocation. +- */ ++ /* Share existing memory allocation. */ + case VMCS_SM_CMD_ALLOC_SHARE: + { + struct vmcs_sm_ioctl_alloc_share ioparam; + +- /* Get the parameter data. +- */ ++ /* Get the parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2338,8 +2289,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + ret = vc_sm_ioctl_alloc_share(file_data, &ioparam); + +- /* Copy result back to user. +- */ ++ /* Copy result back to user. */ + if (!ret + && copy_to_user((void *)arg, &ioparam, + sizeof(ioparam)) != 0) { +@@ -2352,8 +2302,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; +@@ -2362,8 +2311,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { + struct vmcs_sm_ioctl_import_dmabuf ioparam; + +- /* Get the parameter data. +- */ ++ /* Get the parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2386,21 +2334,18 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; + +- /* Lock (attempt to) *and* register a cache behavior change. +- */ ++ /* Lock (attempt to) *and* register a cache behavior change. */ + case VMCS_SM_CMD_LOCK_CACHE: + { + struct vmcs_sm_ioctl_lock_cache ioparam; + struct vmcs_sm_ioctl_lock_unlock lock; + +- /* Get parameter data. +- */ ++ /* Get parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2414,20 +2359,17 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + vc_sm_ioctl_lock(file_data, &lock, 1, + ioparam.cached, 0); + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; + +- /* Lock (attempt to) existing memory allocation. +- */ ++ /* Lock (attempt to) existing memory allocation. */ + case VMCS_SM_CMD_LOCK: + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + +- /* Get parameter data. +- */ ++ /* Get parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2438,8 +2380,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + ret = vc_sm_ioctl_lock(file_data, &ioparam, 0, 0, 0); + +- /* Copy result back to user. +- */ ++ /* Copy result back to user. */ + if (copy_to_user((void *)arg, &ioparam, sizeof(ioparam)) + != 0) { + pr_err("[%s]: failed to copy-to-user for cmd %x\n", +@@ -2447,20 +2388,17 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; + +- /* Unlock (attempt to) existing memory allocation. +- */ ++ /* Unlock (attempt to) existing memory allocation. */ + case VMCS_SM_CMD_UNLOCK: + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + +- /* Get parameter data. +- */ ++ /* Get parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2471,20 +2409,17 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + ret = vc_sm_ioctl_unlock(file_data, &ioparam, 0, 1, 0); + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; + +- /* Resize (attempt to) existing memory allocation. +- */ ++ /* Resize (attempt to) existing memory allocation. */ + case VMCS_SM_CMD_RESIZE: + { + struct vmcs_sm_ioctl_resize ioparam; + +- /* Get parameter data. +- */ ++ /* Get parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2495,17 +2430,13 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + ret = vc_sm_ioctl_resize(file_data, &ioparam); + +- /* Copy result back to user. +- */ ++ /* Copy result back to user. */ + if (copy_to_user((void *)arg, &ioparam, sizeof(ioparam)) + != 0) { + pr_err("[%s]: failed to copy-to-user for cmd %x\n", + __func__, cmdnr); + ret = -EFAULT; + } +- +- /* Done. +- */ + goto out; + } + break; +@@ -2550,7 +2481,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + goto out; + } + break; +-/* Walk mapping table on host, information shows up in the ++ /* Walk mapping table on host, information shows up in the + ** kernel log. + */ + case VMCS_SM_CMD_HOST_WALK_MAP: +@@ -2589,7 +2520,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { + struct vmcs_sm_ioctl_walk ioparam; + +- /* Get parameter data. */ ++ /* Get parameter data. */ + if (copy_from_user(&ioparam, + (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2646,8 +2577,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { + struct vmcs_sm_ioctl_chk ioparam; + +- /* Get parameter data. +- */ ++ /* Get parameter data. */ + if (copy_from_user(&ioparam, + (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2662,7 +2592,8 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + vmcs_sm_acquire_resource(file_data, ioparam.handle); + if (resource == NULL) + ret = -EINVAL; +- /* If the resource is cacheable, return additional ++ /* ++ * If the resource is cacheable, return additional + * information that may be needed to flush the cache. + */ + else if ((resource->res_cached == VMCS_SM_CACHE_HOST) || +@@ -2688,8 +2619,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; +@@ -2768,8 +2698,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; +@@ -2851,8 +2780,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + break; + +- /* Maps a user address given process and vc handle. +- */ ++ /* Maps a user address given process and vc handle. */ + case VMCS_SM_CMD_MAPPED_USR_ADDRESS: + { + struct vmcs_sm_ioctl_map ioparam; +@@ -2955,8 +2883,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + goto out; + } + +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = + vmcs_sm_acquire_resource(file_data, ioparam.handle); + +@@ -2992,8 +2919,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + if (resource) + vmcs_sm_release_resource(resource, 0); + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; +@@ -3019,8 +2945,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + case 2: /* L1/L2 clean physical range */ + case 3: /* L1/L2 clean+invalidate all */ + { +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = + vmcs_sm_acquire_resource(file_data, ioparam.s[i].handle); + +@@ -3123,8 +3048,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + return ret; + } + +-/* Device operations that we managed in this driver. +-*/ ++/* Device operations that we managed in this driver. */ + static const struct file_operations vmcs_sm_ops = { + .owner = THIS_MODULE, + .unlocked_ioctl = vc_sm_ioctl, +@@ -3133,8 +3057,7 @@ static const struct file_operations vmcs_sm_ops = { + .mmap = vc_sm_mmap, + }; + +-/* Creation of device. +-*/ ++/* Creation of device. */ + static int vc_sm_create_sharedmemory(void) + { + int ret; +@@ -3144,8 +3067,7 @@ static int vc_sm_create_sharedmemory(void) + goto out; + } + +- /* Create a device class for creating dev nodes. +- */ ++ /* Create a device class for creating dev nodes. */ + sm_state->sm_class = class_create(THIS_MODULE, "vc-sm"); + if (IS_ERR(sm_state->sm_class)) { + pr_err("[%s]: unable to create device class\n", __func__); +@@ -3153,8 +3075,7 @@ static int vc_sm_create_sharedmemory(void) + goto out; + } + +- /* Create a character driver. +- */ ++ /* Create a character driver. */ + ret = alloc_chrdev_region(&sm_state->sm_devid, + DEVICE_MINOR, 1, DEVICE_NAME); + if (ret != 0) { +@@ -3169,8 +3090,7 @@ static int vc_sm_create_sharedmemory(void) + goto out_chrdev_unreg; + } + +- /* Create a device node. +- */ ++ /* Create a device node. */ + sm_state->sm_dev = device_create(sm_state->sm_class, + NULL, + MKDEV(MAJOR(sm_state->sm_devid), +@@ -3195,25 +3115,21 @@ static int vc_sm_create_sharedmemory(void) + return ret; + } + +-/* Termination of the device. +-*/ ++/* Termination of the device. */ + static int vc_sm_remove_sharedmemory(void) + { + int ret; + + if (sm_state == NULL) { +- /* Nothing to do. +- */ ++ /* Nothing to do. */ + ret = 0; + goto out; + } + +- /* Remove the sharedmemory character driver. +- */ ++ /* Remove the sharedmemory character driver. */ + cdev_del(&sm_state->sm_cdev); + +- /* Unregister region. +- */ ++ /* Unregister region. */ + unregister_chrdev_region(sm_state->sm_devid, 1); + + ret = 0; +@@ -3232,8 +3148,9 @@ static void vc_sm_connected_init(void) + + pr_info("[%s]: start\n", __func__); + +- /* Initialize and create a VCHI connection for the shared memory service +- ** running on videocore. ++ /* ++ * Initialize and create a VCHI connection for the shared memory service ++ * running on videocore. + */ + ret = vchi_initialise(&vchi_instance); + if (ret != 0) { +@@ -3306,8 +3223,7 @@ static void vc_sm_connected_init(void) + goto err_remove_shared_memory; + } + +- /* Done! +- */ ++ /* Done! */ + sm_inited = 1; + goto out; + +@@ -3344,20 +3260,16 @@ static int bcm2835_vcsm_remove(struct platform_device *pdev) + { + pr_debug("[%s]: start\n", __func__); + if (sm_inited) { +- /* Remove shared memory device. +- */ ++ /* Remove shared memory device. */ + vc_sm_remove_sharedmemory(); + +- /* Remove all proc entries. +- */ ++ /* Remove all proc entries. */ + debugfs_remove_recursive(sm_state->dir_root); + +- /* Stop the videocore shared memory service. +- */ ++ /* Stop the videocore shared memory service. */ + vc_vchi_sm_stop(&sm_state->sm_handle); + +- /* Free the memory for the state structure. +- */ ++ /* Free the memory for the state structure. */ + mutex_destroy(&(sm_state->map_lock)); + kfree(sm_state); + } +@@ -3374,8 +3286,7 @@ int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle) + int ret; + struct SM_RESOURCE_T *resource; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || alloc == NULL || handle == NULL) { + pr_err("[%s]: invalid input\n", __func__); + return -EPERM; +@@ -3396,8 +3307,7 @@ int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle) + resource->pid = 0; + vmcs_sm_release_resource(resource, 0); + +- /* Assign valid handle at this time. +- */ ++ /* Assign valid handle at this time. */ + *handle = ioparam.handle; + } else { + ret = -ENOMEM; +@@ -3408,22 +3318,19 @@ int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle) + } + EXPORT_SYMBOL_GPL(vc_sm_alloc); + +-/* Get an internal resource handle mapped from the external one. +-*/ ++/* Get an internal resource handle mapped from the external one. */ + int vc_sm_int_handle(int handle) + { + struct SM_RESOURCE_T *resource; + int ret = 0; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || handle == 0) { + pr_err("[%s]: invalid input\n", __func__); + return 0; + } + +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = vmcs_sm_acquire_resource(sm_state->data_knl, handle); + if (resource) { + ret = resource->res_handle; +@@ -3434,14 +3341,12 @@ int vc_sm_int_handle(int handle) + } + EXPORT_SYMBOL_GPL(vc_sm_int_handle); + +-/* Free a previously allocated shared memory handle and block. +-*/ ++/* Free a previously allocated shared memory handle and block. */ + int vc_sm_free(int handle) + { + struct vmcs_sm_ioctl_free ioparam = { handle }; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || handle == 0) { + pr_err("[%s]: invalid input\n", __func__); + return -EPERM; +@@ -3451,16 +3356,14 @@ int vc_sm_free(int handle) + } + EXPORT_SYMBOL_GPL(vc_sm_free); + +-/* Lock a memory handle for use by kernel. +-*/ ++/* Lock a memory handle for use by kernel. */ + int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, + long unsigned int *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + int ret; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || handle == 0 || data == NULL) { + pr_err("[%s]: invalid input\n", __func__); + return -EPERM; +@@ -3481,14 +3384,12 @@ int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, + } + EXPORT_SYMBOL_GPL(vc_sm_lock); + +-/* Unlock a memory handle in use by kernel. +-*/ ++/* Unlock a memory handle in use by kernel. */ + int vc_sm_unlock(int handle, int flush, int no_vc_unlock) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || handle == 0) { + pr_err("[%s]: invalid input\n", __func__); + return -EPERM; +@@ -3500,16 +3401,14 @@ int vc_sm_unlock(int handle, int flush, int no_vc_unlock) + } + EXPORT_SYMBOL_GPL(vc_sm_unlock); + +-/* Map a shared memory region for use by kernel. +-*/ ++/* Map a shared memory region for use by kernel. */ + int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, + long unsigned int *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + int ret; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || handle == 0 || data == NULL || sm_addr == 0) { + pr_err("[%s]: invalid input\n", __func__); + return -EPERM; + +From a7af6c217b1855cd92df6f74399504eecb3231a6 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:29:37 +0100 +Subject: [PATCH 352/407] vcsm: Fix indentation of switch/case statement. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 53 ++++++++++++++++++----------------- + 1 file changed, 27 insertions(+), 26 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 4680d8a9f5acb99a4c4a400ac589c57f8061a615..ac49776a74b7b3aeebf8a35980d871708311690e 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2940,33 +2940,34 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + for (i=0; ires_cached) { +- unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); +- unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); +- +- resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; +- +- /* L1/L2 cache flush */ +- down_read(¤t->mm->mmap_sem); +- vcsm_vma_cache_clean_page_range(base, end); +- up_read(¤t->mm->mmap_sem); +- } else if (resource == NULL) { +- ret = -EINVAL; +- goto out; +- } +- +- if (resource) +- vmcs_sm_release_resource(resource, 0); ++ default: ++ case 0: ++ break; /* NOOP */ ++ case 1: /* L1/L2 invalidate virtual range */ ++ case 2: /* L1/L2 clean physical range */ ++ case 3: /* L1/L2 clean+invalidate all */ ++ /* Locate resource from GUID. */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.s[i].handle); ++ ++ if ((resource != NULL) && resource->res_cached) { ++ unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); ++ unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); ++ ++ resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; ++ ++ /* L1/L2 cache flush */ ++ down_read(¤t->mm->mmap_sem); ++ vcsm_vma_cache_clean_page_range(base, end); ++ up_read(¤t->mm->mmap_sem); ++ } else if (resource == NULL) { ++ ret = -EINVAL; ++ goto out; + } ++ ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ + break; + } + } + +From d4879613611d9c4dee44514b195a9d4670dec407 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:24:48 +0100 +Subject: [PATCH 353/407] vcsm: Fix spaces around operators. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index ac49776a74b7b3aeebf8a35980d871708311690e..863675727bb7258ed4d13570f602c13b942da0d3 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2938,7 +2938,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + goto out; + } +- for (i=0; ires_cached) { +- unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); +- unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); ++ unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE - 1); ++ unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1); + +- resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; ++ resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID : FLUSH]++; + + /* L1/L2 cache flush */ + down_read(¤t->mm->mmap_sem); +@@ -3001,7 +3001,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + goto out; + } + +- for (i=0; iblock_count; ++j) { + +From d762acb7217048c7b7135d34c3eb103c609d5501 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:33:49 +0100 +Subject: [PATCH 354/407] vcsm: Fix use of S_IRUGO and use 0444 instead + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 863675727bb7258ed4d13570f602c13b942da0d3..c8df7c80596038c3d1f03af3b17095b9b50238c8 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -1047,7 +1047,7 @@ static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) + } else { + struct dentry *dir_entry; + +- dir_entry = debugfs_create_file(VC_SM_RESOURCES, S_IRUGO, ++ dir_entry = debugfs_create_file(VC_SM_RESOURCES, 0444, + file_data->dir_pid, file_data, + vc_sm_debug_fs_fops); + +@@ -1055,7 +1055,7 @@ static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) + file_data->dir_res.priv_data = file_data; + file_data->dir_res.show = &vc_sm_alloc_show; + +- dir_entry = debugfs_create_file(VC_SM_STATS, S_IRUGO, ++ dir_entry = debugfs_create_file(VC_SM_STATS, 0444, + file_data->dir_pid, file_data, + vc_sm_debug_fs_fops); + +@@ -3194,12 +3194,12 @@ static void vc_sm_connected_init(void) + + sm_state->dir_state.show = &vc_sm_global_state_show; + sm_state->dir_state.dir_entry = debugfs_create_file(VC_SM_STATE, +- S_IRUGO, sm_state->dir_root, &sm_state->dir_state, ++ 0444, sm_state->dir_root, &sm_state->dir_state, + &vc_sm_debug_fs_fops); + + sm_state->dir_stats.show = &vc_sm_global_statistics_show; + sm_state->dir_stats.dir_entry = debugfs_create_file(VC_SM_STATS, +- S_IRUGO, sm_state->dir_root, &sm_state->dir_stats, ++ 0444, sm_state->dir_root, &sm_state->dir_stats, + &vc_sm_debug_fs_fops); + + /* Create the proc entry children. */ + +From 997a4b8b985528c3da9e2af08d97552c81f27db6 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:36:11 +0100 +Subject: [PATCH 355/407] vcsm: Correct "long unsigned int" to "unsigned long" + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 4 ++-- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 16 ++++++++-------- + 2 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index 8252d13999a78609fcc7e1bbe83307e2b1c1f8f1..8538f618ffd33b2901d220f3fb755aae6001e6d7 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -36,7 +36,7 @@ int vc_sm_free(int handle); + + /* Lock a memory handle for use by kernel. */ + int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, +- long unsigned int *data); ++ unsigned long *data); + + /* Unlock a memory handle in use by kernel. */ + int vc_sm_unlock(int handle, int flush, int no_vc_unlock); +@@ -46,7 +46,7 @@ int vc_sm_int_handle(int handle); + + /* Map a shared memory region for use by kernel. */ + int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, +- long unsigned int *data); ++ unsigned long *data); + + /* Import a block of memory into the GPU space. */ + int vc_sm_import_dmabuf(struct dma_buf *dmabuf, int *handle); +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index c8df7c80596038c3d1f03af3b17095b9b50238c8..01da0badd8afe58d8c2570efcd26c77893f14490 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -118,7 +118,7 @@ struct sm_mmap { + unsigned int res_vc_hdl; /* Resource handle (videocore). */ + unsigned int res_usr_hdl; /* Resource handle (user). */ + +- long unsigned int res_addr; /* Mapped virtual address. */ ++ unsigned long res_addr; /* Mapped virtual address. */ + struct vm_area_struct *vma; /* VM area for this mapping. */ + unsigned int ref_count; /* Reference count to this vma. */ + +@@ -1383,7 +1383,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + map->res_pid = current->tgid; + map->res_vc_hdl = resource->res_handle; + map->res_usr_hdl = resource->res_guid; +- map->res_addr = (long unsigned int)vma->vm_start; ++ map->res_addr = (unsigned long)vma->vm_start; + map->resource = resource; + map->vma = vma; + vmcs_sm_add_map(sm_state, resource, map); +@@ -1743,7 +1743,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + struct SM_RESOURCE_T *resource; + int ret = 0; + struct sm_mmap *map, *map_tmp; +- long unsigned int phys_addr; ++ unsigned long phys_addr; + + map = NULL; + +@@ -1859,7 +1859,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + phys_addr += mm_vc_mem_phys_addr; + if (resource->res_cached + == VMCS_SM_CACHE_HOST) { +- ioparam->addr = (long unsigned int) ++ ioparam->addr = (unsigned long) + /* TODO - make cached work */ + ioremap_nocache(phys_addr, + resource->res_size); +@@ -1868,7 +1868,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + __func__, ioparam->handle, + lock.res_handle, ioparam->addr); + } else { +- ioparam->addr = (long unsigned int) ++ ioparam->addr = (unsigned long) + ioremap_nocache(phys_addr, + resource->res_size); + +@@ -1995,7 +1995,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + if (flush && + (resource->res_cached == + VMCS_SM_CACHE_HOST)) { +- long unsigned int ++ unsigned long + phys_addr; + phys_addr = (uint32_t) + resource->res_base_mem & 0x3FFFFFFF; +@@ -3359,7 +3359,7 @@ EXPORT_SYMBOL_GPL(vc_sm_free); + + /* Lock a memory handle for use by kernel. */ + int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, +- long unsigned int *data) ++ unsigned long *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + int ret; +@@ -3404,7 +3404,7 @@ EXPORT_SYMBOL_GPL(vc_sm_unlock); + + /* Map a shared memory region for use by kernel. */ + int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, +- long unsigned int *data) ++ unsigned long *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + int ret; + +From a7bea57255869deb48213d9f7d9b5bee609bc142 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:38:27 +0100 +Subject: [PATCH 356/407] vcsm: Fix "struct vm_operations_struct should + normally be const" + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 01da0badd8afe58d8c2570efcd26c77893f14490..4a1b22fe2ced80e909c1f7a5f0038b8c4b8c6bb3 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -1248,7 +1248,7 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + } + } + +-static struct vm_operations_struct vcsm_vm_ops = { ++static const struct vm_operations_struct vcsm_vm_ops = { + .open = vcsm_vma_open, + .close = vcsm_vma_close, + .fault = vcsm_vma_fault, + +From 4f52fc305b45c21091c26e0e845056b57b485c46 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:45:34 +0100 +Subject: [PATCH 357/407] vcsm: Fix "void function return statements are not + generally useful" + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 4a1b22fe2ced80e909c1f7a5f0038b8c4b8c6bb3..32333c6c23c1ecedc465289d2d416d9c083a823b 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -984,8 +984,6 @@ static void vmcs_sm_host_walk_map_per_pid(int pid) + } + + mutex_unlock(&(sm_state->map_lock)); +- +- return; + } + + /* +@@ -1015,8 +1013,6 @@ static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) + } + + mutex_unlock(&(sm_state->map_lock)); +- +- return; + } + + /* Create support for private data tracking. */ + +From 0eb9aac72b9b1d1ae8b4e8a2c76cf5c44f986e67 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:47:32 +0100 +Subject: [PATCH 358/407] vcsm: Fix "Prefer kcalloc over kzalloc with multiply" + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 32333c6c23c1ecedc465289d2d416d9c083a823b..a18407d111c471878c07936b56425a16f4fdf81f 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2984,7 +2984,9 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + goto out; + } +- block = kzalloc(ioparam.op_count * sizeof(struct vmcs_sm_ioctl_clean_invalid_block), GFP_KERNEL); ++ block = kcalloc(ioparam.op_count, ++ sizeof(struct vmcs_sm_ioctl_clean_invalid_block), ++ GFP_KERNEL); + if (!block) { + ret = -EFAULT; + goto out; + +From 207b09d9b1761953cfd31055f33a377e21390ebc Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:55:07 +0100 +Subject: [PATCH 359/407] vcsm: Remove VC_SM_LOCK_CACHE_MODE_T typedef. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 11 +++++------ + drivers/char/broadcom/vc_sm/vmcs_sm.c | 6 +++--- + 2 files changed, 8 insertions(+), 9 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index 8538f618ffd33b2901d220f3fb755aae6001e6d7..f7f74750d8358779c61dfcd6fc841aa1789a2c5e 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -22,11 +22,10 @@ + #endif + + /* Type of memory to be locked (ie mapped) */ +-typedef enum { ++enum vc_sm_lock_cache_mode { + VC_SM_LOCK_CACHED, + VC_SM_LOCK_NON_CACHED, +- +-} VC_SM_LOCK_CACHE_MODE_T; ++}; + + /* Allocate a shared memory handle and block. */ + int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle); +@@ -35,7 +34,7 @@ int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle); + int vc_sm_free(int handle); + + /* Lock a memory handle for use by kernel. */ +-int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, ++int vc_sm_lock(int handle, enum vc_sm_lock_cache_mode mode, + unsigned long *data); + + /* Unlock a memory handle in use by kernel. */ +@@ -45,8 +44,8 @@ int vc_sm_unlock(int handle, int flush, int no_vc_unlock); + int vc_sm_int_handle(int handle); + + /* Map a shared memory region for use by kernel. */ +-int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, +- unsigned long *data); ++int vc_sm_map(int handle, unsigned int sm_addr, ++ enum vc_sm_lock_cache_mode mode, unsigned long *data); + + /* Import a block of memory into the GPU space. */ + int vc_sm_import_dmabuf(struct dma_buf *dmabuf, int *handle); +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index a18407d111c471878c07936b56425a16f4fdf81f..2ad5ecbccf30df6738da913d47b85262c7238d59 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -3356,7 +3356,7 @@ int vc_sm_free(int handle) + EXPORT_SYMBOL_GPL(vc_sm_free); + + /* Lock a memory handle for use by kernel. */ +-int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, ++int vc_sm_lock(int handle, enum vc_sm_lock_cache_mode mode, + unsigned long *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; +@@ -3401,8 +3401,8 @@ int vc_sm_unlock(int handle, int flush, int no_vc_unlock) + EXPORT_SYMBOL_GPL(vc_sm_unlock); + + /* Map a shared memory region for use by kernel. */ +-int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, +- unsigned long *data) ++int vc_sm_map(int handle, unsigned int sm_addr, ++ enum vc_sm_lock_cache_mode mode, unsigned long *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + int ret; + +From 2b9e1004e2e92fb804aea7e02227ed4abbb9a80f Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 5 Sep 2017 10:12:21 +0100 +Subject: [PATCH 360/407] vcsm: Replace SM_RESOURCE_T with sm_resource_t + +Follow the Linux kernel coding style. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 66 +++++++++++++++++------------------ + 1 file changed, 33 insertions(+), 33 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 2ad5ecbccf30df6738da913d47b85262c7238d59..ea4fcd787f6b7f527aa323a06554be8557c6e6ae 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -112,7 +112,7 @@ struct SM_PDE_T { + struct sm_mmap { + struct list_head map_list; /* Linked list of maps. */ + +- struct SM_RESOURCE_T *resource; /* Pointer to the resource. */ ++ struct sm_resource_t *resource; /* Pointer to the resource. */ + + pid_t res_pid; /* PID owning that resource. */ + unsigned int res_vc_hdl; /* Resource handle (videocore). */ +@@ -127,7 +127,7 @@ struct sm_mmap { + }; + + /* Single resource allocation tracked for each opened device. */ +-struct SM_RESOURCE_T { ++struct sm_resource_t { + struct list_head resource_list; /* List of resources. */ + struct list_head global_resource_list; /* Global list of resources. */ + +@@ -140,7 +140,7 @@ struct SM_RESOURCE_T { + void *res_base_mem; /* Resource base memory address. */ + uint32_t res_size; /* Resource size allocated. */ + enum vmcs_sm_cache_e res_cached; /* Resource cache type. */ +- struct SM_RESOURCE_T *res_shared; /* Shared resource */ ++ struct sm_resource_t *res_shared; /* Shared resource */ + + enum SM_STATS_T res_stats[END_ALL]; /* Resource statistics. */ + +@@ -235,7 +235,7 @@ static inline unsigned int vcaddr_to_pfn(unsigned long vc_addr) + * Carries over to the state statistics the statistics once owned by a deceased + * resource. + */ +-static void vc_sm_resource_deceased(struct SM_RESOURCE_T *p_res, int terminated) ++static void vc_sm_resource_deceased(struct sm_resource_t *p_res, int terminated) + { + if (sm_state != NULL) { + if (p_res != NULL) { +@@ -460,7 +460,7 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + + /* Adds a resource mapping to the global data list. */ + static void vmcs_sm_add_map(struct SM_STATE_T *state, +- struct SM_RESOURCE_T *resource, struct sm_mmap *map) ++ struct sm_resource_t *resource, struct sm_mmap *map) + { + mutex_lock(&(state->map_lock)); + +@@ -480,7 +480,7 @@ static void vmcs_sm_add_map(struct SM_STATE_T *state, + + /* Removes a resource mapping from the global data list. */ + static void vmcs_sm_remove_map(struct SM_STATE_T *state, +- struct SM_RESOURCE_T *resource, ++ struct sm_resource_t *resource, + struct sm_mmap *map) + { + mutex_lock(&(state->map_lock)); +@@ -506,7 +506,7 @@ static void vmcs_sm_remove_map(struct SM_STATE_T *state, + static int vc_sm_global_state_show(struct seq_file *s, void *v) + { + struct sm_mmap *map = NULL; +- struct SM_RESOURCE_T *resource = NULL; ++ struct sm_resource_t *resource = NULL; + int map_count = 0; + int resource_count = 0; + +@@ -634,7 +634,7 @@ static int vc_sm_statistics_show(struct seq_file *s, void *v) + { + int ix; + struct SM_PRIV_DATA_T *file_data; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int res_count = 0; + struct SM_PDE_T *p_pde; + +@@ -691,7 +691,7 @@ static int vc_sm_statistics_show(struct seq_file *s, void *v) + static int vc_sm_alloc_show(struct seq_file *s, void *v) + { + struct SM_PRIV_DATA_T *file_data; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int alloc_count = 0; + struct SM_PDE_T *p_pde; + +@@ -765,7 +765,7 @@ static const struct file_operations vc_sm_debug_fs_fops = { + * data. + */ + static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, +- struct SM_RESOURCE_T *resource) ++ struct sm_resource_t *resource) + { + mutex_lock(&(sm_state->map_lock)); + list_add(&resource->resource_list, &privdata->resource_list); +@@ -781,11 +781,11 @@ static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, + * Locates a resource and acquire a reference on it. + * The resource won't be deleted while there is a reference on it. + */ +-static struct SM_RESOURCE_T *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T ++static struct sm_resource_t *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T + *private, + unsigned int res_guid) + { +- struct SM_RESOURCE_T *resource, *ret = NULL; ++ struct sm_resource_t *resource, *ret = NULL; + + mutex_lock(&(sm_state->map_lock)); + +@@ -811,10 +811,10 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T + * Locates a resource and acquire a reference on it. + * The resource won't be deleted while there is a reference on it. + */ +-static struct SM_RESOURCE_T *vmcs_sm_acquire_first_resource( ++static struct sm_resource_t *vmcs_sm_acquire_first_resource( + struct SM_PRIV_DATA_T *private) + { +- struct SM_RESOURCE_T *resource, *ret = NULL; ++ struct sm_resource_t *resource, *ret = NULL; + + mutex_lock(&(sm_state->map_lock)); + +@@ -837,10 +837,10 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_first_resource( + * Locates a resource and acquire a reference on it. + * The resource won't be deleted while there is a reference on it. + */ +-static struct SM_RESOURCE_T *vmcs_sm_acquire_global_resource(unsigned int ++static struct sm_resource_t *vmcs_sm_acquire_global_resource(unsigned int + res_guid) + { +- struct SM_RESOURCE_T *resource, *ret = NULL; ++ struct sm_resource_t *resource, *ret = NULL; + + mutex_lock(&(sm_state->map_lock)); + +@@ -867,11 +867,11 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_global_resource(unsigned int + * Release a previously acquired resource. + * The resource will be deleted when its refcount reaches 0. + */ +-static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) ++static void vmcs_sm_release_resource(struct sm_resource_t *resource, int force) + { + struct SM_PRIV_DATA_T *private = resource->private; + struct sm_mmap *map, *map_tmp; +- struct SM_RESOURCE_T *res_tmp; ++ struct sm_resource_t *res_tmp; + int ret; + + mutex_lock(&(sm_state->map_lock)); +@@ -992,7 +992,7 @@ static void vmcs_sm_host_walk_map_per_pid(int pid) + */ + static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) + { +- struct SM_RESOURCE_T *resource = NULL; ++ struct sm_resource_t *resource = NULL; + + /* Make sure the device was started properly. */ + if ((sm_state == NULL) || (file_data == NULL)) { +@@ -1101,7 +1101,7 @@ static int vc_sm_release(struct inode *inode, struct file *file) + { + struct SM_PRIV_DATA_T *file_data = + (struct SM_PRIV_DATA_T *)file->private_data; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int ret = 0; + + /* Make sure the device was started properly. */ +@@ -1170,7 +1170,7 @@ static void vcsm_vma_close(struct vm_area_struct *vma) + static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + { + struct sm_mmap *map = (struct sm_mmap *)vma->vm_private_data; +- struct SM_RESOURCE_T *resource = map->resource; ++ struct sm_resource_t *resource = map->resource; + pgoff_t page_offset; + unsigned long pfn; + int ret = 0; +@@ -1313,7 +1313,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + int ret = 0; + struct SM_PRIV_DATA_T *file_data = + (struct SM_PRIV_DATA_T *)file->private_data; +- struct SM_RESOURCE_T *resource = NULL; ++ struct sm_resource_t *resource = NULL; + struct sm_mmap *map = NULL; + + /* Make sure the device was started properly. */ +@@ -1449,7 +1449,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + { + int ret = 0; + int status; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + struct vc_sm_alloc_t alloc = { 0 }; + struct vc_sm_alloc_result_t result = { 0 }; + enum vmcs_sm_cache_e cached = ioparam->cached; +@@ -1558,7 +1558,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_alloc_share *ioparam) + { +- struct SM_RESOURCE_T *resource, *shared_resource; ++ struct sm_resource_t *resource, *shared_resource; + int ret = 0; + + pr_debug("[%s]: attempt to share resource %u\n", __func__, +@@ -1620,7 +1620,7 @@ int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_free *ioparam) + { +- struct SM_RESOURCE_T *resource = ++ struct sm_resource_t *resource = + vmcs_sm_acquire_resource(private, ioparam->handle); + + if (resource == NULL) { +@@ -1649,7 +1649,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + int ret = 0; + int status; + struct vc_sm_resize_t resize; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + + /* Locate resource from GUID. */ + resource = vmcs_sm_acquire_resource(private, ioparam->handle); +@@ -1736,7 +1736,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + int status; + struct vc_sm_lock_unlock_t lock; + struct vc_sm_lock_result_t result; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int ret = 0; + struct sm_mmap *map, *map_tmp; + unsigned long phys_addr; +@@ -1901,7 +1901,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + int status; + struct vc_sm_lock_unlock_t unlock; + struct sm_mmap *map, *map_tmp; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int ret = 0; + + map = NULL; +@@ -2077,7 +2077,7 @@ int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, + { + int ret = 0; + int status; +- struct SM_RESOURCE_T *resource = NULL; ++ struct sm_resource_t *resource = NULL; + struct vc_sm_import import = { 0 }; + struct vc_sm_import_result result = { 0 }; + struct dma_buf *dma_buf; +@@ -2206,7 +2206,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + unsigned int cmdnr = _IOC_NR(cmd); + struct SM_PRIV_DATA_T *file_data = + (struct SM_PRIV_DATA_T *)file->private_data; +- struct SM_RESOURCE_T *resource = NULL; ++ struct sm_resource_t *resource = NULL; + + /* Validate we can work with this device. */ + if ((sm_state == NULL) || (file_data == NULL)) { +@@ -3283,7 +3283,7 @@ int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle) + { + struct vmcs_sm_ioctl_alloc ioparam = { 0 }; + int ret; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + + /* Validate we can work with this device. */ + if (sm_state == NULL || alloc == NULL || handle == NULL) { +@@ -3320,7 +3320,7 @@ EXPORT_SYMBOL_GPL(vc_sm_alloc); + /* Get an internal resource handle mapped from the external one. */ + int vc_sm_int_handle(int handle) + { +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int ret = 0; + + /* Validate we can work with this device. */ +@@ -3433,7 +3433,7 @@ int vc_sm_import_dmabuf(struct dma_buf *dmabuf, int *handle) + { + struct vmcs_sm_ioctl_import_dmabuf ioparam = { 0 }; + int ret; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + + /* Validate we can work with this device. */ + if (!sm_state || !dmabuf || !handle) { + +From c75d3aa54a2afd543aa9ae1b6771c09642b497d0 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 5 Sep 2017 10:15:25 +0100 +Subject: [PATCH 361/407] vcsm: Replace SM_STATS_T with sm_stats_t + +Follows the kernel coding style + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index ea4fcd787f6b7f527aa323a06554be8557c6e6ae..a27a5e9d4cb93f6f9f5268fcffe669094291443f 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -62,7 +62,7 @@ + #define VC_SM_WRITE_BUF_SIZE 128 + + /* Statistics tracked per resource and globally. */ +-enum SM_STATS_T { ++enum sm_stats_t { + /* Attempt. */ + ALLOC, + FREE, +@@ -142,7 +142,7 @@ struct sm_resource_t { + enum vmcs_sm_cache_e res_cached; /* Resource cache type. */ + struct sm_resource_t *res_shared; /* Shared resource */ + +- enum SM_STATS_T res_stats[END_ALL]; /* Resource statistics. */ ++ enum sm_stats_t res_stats[END_ALL]; /* Resource statistics. */ + + uint8_t map_count; /* Counter of mappings for this resource. */ + struct list_head map_list; /* Maps associated with a resource. */ +@@ -187,8 +187,8 @@ struct SM_STATE_T { + struct list_head map_list; /* List of maps. */ + struct list_head resource_list; /* List of resources. */ + +- enum SM_STATS_T deceased[END_ALL]; /* Natural termination stats. */ +- enum SM_STATS_T terminated[END_ALL]; /* Forced termination stats. */ ++ enum sm_stats_t deceased[END_ALL]; /* Natural termination stats. */ ++ enum sm_stats_t terminated[END_ALL]; /* Forced termination stats. */ + uint32_t res_deceased_cnt; /* Natural termination counter. */ + uint32_t res_terminated_cnt; /* Forced termination counter. */ + + +From 52b4655802f8dcf507c6cd3ea70b5211eee7a80c Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 5 Sep 2017 10:16:07 +0100 +Subject: [PATCH 362/407] vcsm: Replace SM_STATE_T with sm_state_t + +Follow the Linux kernel coding style + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index a27a5e9d4cb93f6f9f5268fcffe669094291443f..56ab1c8fd6f59274c6223eb30bc159fbd6ce55ec 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -174,7 +174,7 @@ struct SM_PRIV_DATA_T { + }; + + /* Global state information. */ +-struct SM_STATE_T { ++struct sm_state_t { + struct platform_device *pdev; + struct sm_instance *sm_handle; /* Handle for videocore service. */ + struct dentry *dir_root; /* Debug fs entries root. */ +@@ -206,7 +206,7 @@ struct SM_STATE_T { + + /* ---- Private Variables ----------------------------------------------- */ + +-static struct SM_STATE_T *sm_state; ++static struct sm_state_t *sm_state; + static int sm_inited; + + #if 0 +@@ -459,7 +459,7 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + } + + /* Adds a resource mapping to the global data list. */ +-static void vmcs_sm_add_map(struct SM_STATE_T *state, ++static void vmcs_sm_add_map(struct sm_state_t *state, + struct sm_resource_t *resource, struct sm_mmap *map) + { + mutex_lock(&(state->map_lock)); +@@ -479,7 +479,7 @@ static void vmcs_sm_add_map(struct SM_STATE_T *state, + } + + /* Removes a resource mapping from the global data list. */ +-static void vmcs_sm_remove_map(struct SM_STATE_T *state, ++static void vmcs_sm_remove_map(struct sm_state_t *state, + struct sm_resource_t *resource, + struct sm_mmap *map) + { + +From bfdd4c994f9207413ecb83579f8447905495e7de Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 5 Sep 2017 10:17:18 +0100 +Subject: [PATCH 363/407] vcsm: Replace SM_PRIV_DATA_T with sm_priv_data_t + +Follows the Linux kernel coding style + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 54 +++++++++++++++++------------------ + 1 file changed, 27 insertions(+), 27 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 56ab1c8fd6f59274c6223eb30bc159fbd6ce55ec..fd6a4600326cfcff84ab6ce5b8f7e3852976ae24 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -153,12 +153,12 @@ struct sm_resource_t { + struct sg_table *sgt; + dma_addr_t dma_addr; + +- struct SM_PRIV_DATA_T *private; ++ struct sm_priv_data_t *private; + bool map; /* whether to map pages up front */ + }; + + /* Private file data associated with each opened device. */ +-struct SM_PRIV_DATA_T { ++struct sm_priv_data_t { + struct list_head resource_list; /* List of resources. */ + + pid_t pid; /* PID of creator. */ +@@ -197,7 +197,7 @@ struct sm_state_t { + struct class *sm_class; /* Class. */ + struct device *sm_dev; /* Device. */ + +- struct SM_PRIV_DATA_T *data_knl; /* Kernel internal data tracking. */ ++ struct sm_priv_data_t *data_knl; /* Kernel internal data tracking. */ + + struct mutex lock; /* Global lock. */ + uint32_t guid; /* GUID (next) tracker. */ +@@ -633,13 +633,13 @@ static int vc_sm_global_statistics_show(struct seq_file *s, void *v) + static int vc_sm_statistics_show(struct seq_file *s, void *v) + { + int ix; +- struct SM_PRIV_DATA_T *file_data; ++ struct sm_priv_data_t *file_data; + struct sm_resource_t *resource; + int res_count = 0; + struct SM_PDE_T *p_pde; + + p_pde = (struct SM_PDE_T *)(s->private); +- file_data = (struct SM_PRIV_DATA_T *)(p_pde->priv_data); ++ file_data = (struct sm_priv_data_t *)(p_pde->priv_data); + + if (file_data == NULL) + return 0; +@@ -690,13 +690,13 @@ static int vc_sm_statistics_show(struct seq_file *s, void *v) + /* Read callback for the allocation proc entry. */ + static int vc_sm_alloc_show(struct seq_file *s, void *v) + { +- struct SM_PRIV_DATA_T *file_data; ++ struct sm_priv_data_t *file_data; + struct sm_resource_t *resource; + int alloc_count = 0; + struct SM_PDE_T *p_pde; + + p_pde = (struct SM_PDE_T *)(s->private); +- file_data = (struct SM_PRIV_DATA_T *)(p_pde->priv_data); ++ file_data = (struct sm_priv_data_t *)(p_pde->priv_data); + + if (!file_data) + return 0; +@@ -764,7 +764,7 @@ static const struct file_operations vc_sm_debug_fs_fops = { + * Adds a resource to the private data list which tracks all the allocated + * data. + */ +-static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, ++static void vmcs_sm_add_resource(struct sm_priv_data_t *privdata, + struct sm_resource_t *resource) + { + mutex_lock(&(sm_state->map_lock)); +@@ -781,7 +781,7 @@ static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, + * Locates a resource and acquire a reference on it. + * The resource won't be deleted while there is a reference on it. + */ +-static struct sm_resource_t *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T ++static struct sm_resource_t *vmcs_sm_acquire_resource(struct sm_priv_data_t + *private, + unsigned int res_guid) + { +@@ -812,7 +812,7 @@ static struct sm_resource_t *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T + * The resource won't be deleted while there is a reference on it. + */ + static struct sm_resource_t *vmcs_sm_acquire_first_resource( +- struct SM_PRIV_DATA_T *private) ++ struct sm_priv_data_t *private) + { + struct sm_resource_t *resource, *ret = NULL; + +@@ -869,7 +869,7 @@ static struct sm_resource_t *vmcs_sm_acquire_global_resource(unsigned int + */ + static void vmcs_sm_release_resource(struct sm_resource_t *resource, int force) + { +- struct SM_PRIV_DATA_T *private = resource->private; ++ struct sm_priv_data_t *private = resource->private; + struct sm_mmap *map, *map_tmp; + struct sm_resource_t *res_tmp; + int ret; +@@ -990,7 +990,7 @@ static void vmcs_sm_host_walk_map_per_pid(int pid) + * Dump the allocation table from host side point of view. This only dumps the + * data allocated for this process/device referenced by the file_data. + */ +-static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) ++static void vmcs_sm_host_walk_alloc(struct sm_priv_data_t *file_data) + { + struct sm_resource_t *resource = NULL; + +@@ -1016,10 +1016,10 @@ static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) + } + + /* Create support for private data tracking. */ +-static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) ++static struct sm_priv_data_t *vc_sm_create_priv_data(pid_t id) + { + char alloc_name[32]; +- struct SM_PRIV_DATA_T *file_data = NULL; ++ struct sm_priv_data_t *file_data = NULL; + + /* Allocate private structure. */ + file_data = kzalloc(sizeof(*file_data), GFP_KERNEL); +@@ -1099,8 +1099,8 @@ static int vc_sm_open(struct inode *inode, struct file *file) + */ + static int vc_sm_release(struct inode *inode, struct file *file) + { +- struct SM_PRIV_DATA_T *file_data = +- (struct SM_PRIV_DATA_T *)file->private_data; ++ struct sm_priv_data_t *file_data = ++ (struct sm_priv_data_t *)file->private_data; + struct sm_resource_t *resource; + int ret = 0; + +@@ -1311,8 +1311,8 @@ static void vcsm_vma_cache_clean_page_range(unsigned long addr, + static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + { + int ret = 0; +- struct SM_PRIV_DATA_T *file_data = +- (struct SM_PRIV_DATA_T *)file->private_data; ++ struct sm_priv_data_t *file_data = ++ (struct sm_priv_data_t *)file->private_data; + struct sm_resource_t *resource = NULL; + struct sm_mmap *map = NULL; + +@@ -1444,7 +1444,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + } + + /* Allocate a shared memory handle and block. */ +-int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, ++int vc_sm_ioctl_alloc(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_alloc *ioparam) + { + int ret = 0; +@@ -1555,7 +1555,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + } + + /* Share an allocate memory handle and block.*/ +-int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, ++int vc_sm_ioctl_alloc_share(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_alloc_share *ioparam) + { + struct sm_resource_t *resource, *shared_resource; +@@ -1617,7 +1617,7 @@ int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + } + + /* Free a previously allocated shared memory handle and block.*/ +-static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, ++static int vc_sm_ioctl_free(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_free *ioparam) + { + struct sm_resource_t *resource = +@@ -1643,7 +1643,7 @@ static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, + } + + /* Resize a previously allocated shared memory handle and block. */ +-static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, ++static int vc_sm_ioctl_resize(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_resize *ioparam) + { + int ret = 0; +@@ -1728,7 +1728,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + } + + /* Lock a previously allocated shared memory handle and block. */ +-static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, ++static int vc_sm_ioctl_lock(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_lock_unlock *ioparam, + int change_cache, enum vmcs_sm_cache_e cache_type, + unsigned int vc_addr) +@@ -1894,7 +1894,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + } + + /* Unlock a previously allocated shared memory handle and block.*/ +-static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, ++static int vc_sm_ioctl_unlock(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_lock_unlock *ioparam, + int flush, int wait_reply, int no_vc_unlock) + { +@@ -2071,7 +2071,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + } + + /* Import a contiguous block of memory to be shared with VC. */ +-int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, ++int vc_sm_ioctl_import_dmabuf(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_import_dmabuf *ioparam, + struct dma_buf *src_dma_buf) + { +@@ -2204,8 +2204,8 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { + int ret = 0; + unsigned int cmdnr = _IOC_NR(cmd); +- struct SM_PRIV_DATA_T *file_data = +- (struct SM_PRIV_DATA_T *)file->private_data; ++ struct sm_priv_data_t *file_data = ++ (struct sm_priv_data_t *)file->private_data; + struct sm_resource_t *resource = NULL; + + /* Validate we can work with this device. */ + +From fe91d2694582d6273af4f6c4660ea3f822f3f03b Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 5 Sep 2017 10:18:33 +0100 +Subject: [PATCH 364/407] vcsm: Replace SM_PDE_T with sm_pde_t + +Follows the Linux kernel coding style + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index fd6a4600326cfcff84ab6ce5b8f7e3852976ae24..0b2d8a2456cfbf8c9f460cf5a10cadcf85e4ead3 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -101,7 +101,7 @@ static const char *const sm_stats_human_read[] = { + }; + + typedef int (*VC_SM_SHOW) (struct seq_file *s, void *v); +-struct SM_PDE_T { ++struct sm_pde_t { + VC_SM_SHOW show; /* Debug fs function hookup. */ + struct dentry *dir_entry; /* Debug fs directory entry. */ + void *priv_data; /* Private data */ +@@ -164,8 +164,8 @@ struct sm_priv_data_t { + pid_t pid; /* PID of creator. */ + + struct dentry *dir_pid; /* Debug fs entries root. */ +- struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ +- struct SM_PDE_T dir_res; /* Debug fs resource sub-tree. */ ++ struct sm_pde_t dir_stats; /* Debug fs entries statistics sub-tree. */ ++ struct sm_pde_t dir_res; /* Debug fs resource sub-tree. */ + + int restart_sys; /* Tracks restart on interrupt. */ + enum vc_sm_msg_type int_action; /* Interrupted action. */ +@@ -179,8 +179,8 @@ struct sm_state_t { + struct sm_instance *sm_handle; /* Handle for videocore service. */ + struct dentry *dir_root; /* Debug fs entries root. */ + struct dentry *dir_alloc; /* Debug fs entries allocations. */ +- struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ +- struct SM_PDE_T dir_state; /* Debug fs entries state sub-tree. */ ++ struct sm_pde_t dir_stats; /* Debug fs entries statistics sub-tree. */ ++ struct sm_pde_t dir_state; /* Debug fs entries state sub-tree. */ + struct dentry *debug; /* Debug fs entries debug. */ + + struct mutex map_lock; /* Global map lock. */ +@@ -636,9 +636,9 @@ static int vc_sm_statistics_show(struct seq_file *s, void *v) + struct sm_priv_data_t *file_data; + struct sm_resource_t *resource; + int res_count = 0; +- struct SM_PDE_T *p_pde; ++ struct sm_pde_t *p_pde; + +- p_pde = (struct SM_PDE_T *)(s->private); ++ p_pde = (struct sm_pde_t *)(s->private); + file_data = (struct sm_priv_data_t *)(p_pde->priv_data); + + if (file_data == NULL) +@@ -693,9 +693,9 @@ static int vc_sm_alloc_show(struct seq_file *s, void *v) + struct sm_priv_data_t *file_data; + struct sm_resource_t *resource; + int alloc_count = 0; +- struct SM_PDE_T *p_pde; ++ struct sm_pde_t *p_pde; + +- p_pde = (struct SM_PDE_T *)(s->private); ++ p_pde = (struct sm_pde_t *)(s->private); + file_data = (struct sm_priv_data_t *)(p_pde->priv_data); + + if (!file_data) +@@ -738,9 +738,9 @@ static int vc_sm_alloc_show(struct seq_file *s, void *v) + + static int vc_sm_seq_file_show(struct seq_file *s, void *v) + { +- struct SM_PDE_T *sm_pde; ++ struct sm_pde_t *sm_pde; + +- sm_pde = (struct SM_PDE_T *)(s->private); ++ sm_pde = (struct sm_pde_t *)(s->private); + + if (sm_pde && sm_pde->show) + sm_pde->show(s, v); + +From f7aed4b7b5f604bddbab5123f2adea943003150d Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 5 Sep 2017 16:24:03 +0100 +Subject: [PATCH 365/407] vcsm: Handle the clean+invalidate case directly + +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 66 +++++++++++++++++++++-------------- + 1 file changed, 39 insertions(+), 27 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 0b2d8a2456cfbf8c9f460cf5a10cadcf85e4ead3..ffbfa204e4837855068c2b8fb90ed61ef1c847a0 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -218,6 +218,32 @@ static const char *const sm_cache_map_vector[] = { + }; + #endif + ++typedef void cache_flush_op_fn(const void *, const void *); ++ ++#if defined(CONFIG_CPU_CACHE_V7) ++extern cache_flush_op_fn v7_dma_inv_range; ++extern cache_flush_op_fn v7_dma_clean_range; ++static cache_flush_op_fn * const flushops[4] = ++{ ++ 0, ++ v7_dma_inv_range, ++ v7_dma_clean_range, ++ v7_dma_flush_range, ++}; ++#elif defined(CONFIG_CPU_CACHE_V6) ++extern cache_flush_op_fn v6_dma_inv_range; ++extern cache_flush_op_fn v6_dma_clean_range; ++static cache_flush_op_fn * const flushops[4] = ++{ ++ 0, ++ v6_dma_inv_range, ++ v6_dma_clean_range, ++ v6_dma_flush_range, ++}; ++#else ++#error Unknown cache config ++#endif ++ + /* ---- Private Function Prototypes -------------------------------------- */ + + /* ---- Private Functions ------------------------------------------------ */ +@@ -2984,7 +3010,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + goto out; + } +- block = kcalloc(ioparam.op_count, ++ block = kmalloc(ioparam.op_count * + sizeof(struct vmcs_sm_ioctl_clean_invalid_block), + GFP_KERNEL); + if (!block) { +@@ -3000,35 +3026,21 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + + for (i = 0; i < ioparam.op_count; i++) { +- struct vmcs_sm_ioctl_clean_invalid_block *op = block + i; ++ const struct vmcs_sm_ioctl_clean_invalid_block * const op = block + i; ++ cache_flush_op_fn * const op_fn = flushops[op->invalidate_mode & 3]; + +- for (j = 0; j < op->block_count; ++j) { ++ if ((op->invalidate_mode & ~3) != 0) { ++ ret = -EINVAL; ++ break; ++ } + ++ if (op_fn == 0) ++ continue; + +- extern void v6_dma_inv_range(void *start, void *end); +- extern void v6_dma_clean_range(void *start, void *end); +- unsigned long base = (unsigned long)op->start_address + j * op->inter_block_stride; +- unsigned long end = base + op->block_size; +- /* L1/L2 cache clean */ +- if (op->invalidate_mode & 2) { +-#if defined(CONFIG_CPU_CACHE_V7) +- extern void v7_dma_clean_range(void *start, void *end); +- v7_dma_clean_range((void *)base, (void *)end); +-#elif defined(CONFIG_CPU_CACHE_V6) +- extern void v6_dma_clean_range(void *start, void *end); +- v6_dma_clean_range((void *)base, (void *)end); +-#endif +- /* L1/L2 cache invalidate */ +- } +- if (op->invalidate_mode & 1) { +-#if defined(CONFIG_CPU_CACHE_V7) +- extern void v7_dma_inv_range(void *start, void *end); +- v7_dma_inv_range((void *)base, (void *)end); +-#elif defined(CONFIG_CPU_CACHE_V6) +- extern void v6_dma_inv_range(void *start, void *end); +- v6_dma_inv_range((void *)base, (void *)end); +-#endif +- } ++ for (j = 0; j < op->block_count; ++j) { ++ const char * const base = (const char *)op->start_address + j * op->inter_block_stride; ++ const char * const end = base + op->block_size; ++ op_fn(base, end); + } + } + kfree(block); + +From 80dcff3ff2e171b4cf6ce94f89d279d2d258dad9 Mon Sep 17 00:00:00 2001 +From: Dan Pasanen +Date: Wed, 20 Sep 2017 10:17:41 -0500 +Subject: [PATCH 366/407] vcsm: fix multi-platform build + +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index ffbfa204e4837855068c2b8fb90ed61ef1c847a0..3d9cd0591d27537529e40370125ad64895e5f0b9 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -223,6 +223,7 @@ typedef void cache_flush_op_fn(const void *, const void *); + #if defined(CONFIG_CPU_CACHE_V7) + extern cache_flush_op_fn v7_dma_inv_range; + extern cache_flush_op_fn v7_dma_clean_range; ++extern cache_flush_op_fn v7_dma_flush_range; + static cache_flush_op_fn * const flushops[4] = + { + 0, +@@ -233,6 +234,7 @@ static cache_flush_op_fn * const flushops[4] = + #elif defined(CONFIG_CPU_CACHE_V6) + extern cache_flush_op_fn v6_dma_inv_range; + extern cache_flush_op_fn v6_dma_clean_range; ++extern cache_flush_op_fn v6_dma_flush_range; + static cache_flush_op_fn * const flushops[4] = + { + 0, + +From 02eb2564a781a4f6b0379ff15a26ee53dd5d1bfd Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Sun, 24 Sep 2017 22:43:16 +0100 +Subject: [PATCH 367/407] vc-sm: Fix a printf of a dma_addr_t from %u to %pad + +Avoids issues when other build parameters result in +dma_addr_t being a 64 bit value. +See #2196. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 3d9cd0591d27537529e40370125ad64895e5f0b9..754f29e88968ec8b7b8a9bd7e89b25ba16de66c3 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -575,8 +575,8 @@ static int vc_sm_global_state_show(struct seq_file *s, void *v) + resource->attach); + seq_printf(s, " SGT %p\n", + resource->sgt); +- seq_printf(s, " DMA_ADDR 0x%08X\n", +- resource->dma_addr); ++ seq_printf(s, " DMA_ADDR %pad\n", ++ &resource->dma_addr); + } + } + seq_printf(s, "\n\nTotal resource count: %d\n\n", resource_count); + +From b9e7e483d86c43bbd0de162e4c18d2adafba6232 Mon Sep 17 00:00:00 2001 +From: Dan Pasanen +Date: Thu, 21 Sep 2017 09:57:44 -0500 +Subject: [PATCH 368/407] vcsm: add macros for cache functions + +--- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 5 +++++ + drivers/char/broadcom/vc_sm/vmcs_sm.c | 11 +++++------ + 2 files changed, 10 insertions(+), 6 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index f7f74750d8358779c61dfcd6fc841aa1789a2c5e..e50fd8eaecef7a3c8451c040ffc3888cc37e28fc 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -27,6 +27,11 @@ enum vc_sm_lock_cache_mode { + VC_SM_LOCK_NON_CACHED, + }; + ++/* Cache functions */ ++#define VCSM_CACHE_OP_INV 0x01 ++#define VCSM_CACHE_OP_FLUSH 0x02 ++#define VCSM_CACHE_OP_CLEAN 0x03 ++ + /* Allocate a shared memory handle and block. */ + int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle); + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 754f29e88968ec8b7b8a9bd7e89b25ba16de66c3..80c5381a64c2f7b854c01e7aef93f63660d6c4ca 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2964,12 +2964,9 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + for (i = 0; i < sizeof(ioparam.s) / sizeof(*ioparam.s); i++) { + switch (ioparam.s[i].cmd) { +- default: +- case 0: +- break; /* NOOP */ +- case 1: /* L1/L2 invalidate virtual range */ +- case 2: /* L1/L2 clean physical range */ +- case 3: /* L1/L2 clean+invalidate all */ ++ case VCSM_CACHE_OP_INV: /* L1/L2 invalidate virtual range */ ++ case VCSM_CACHE_OP_FLUSH: /* L1/L2 clean physical range */ ++ case VCSM_CACHE_OP_CLEAN: /* L1/L2 clean+invalidate all */ + /* Locate resource from GUID. */ + resource = + vmcs_sm_acquire_resource(file_data, ioparam.s[i].handle); +@@ -2993,6 +2990,8 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + vmcs_sm_release_resource(resource, 0); + + break; ++ default: ++ break; /* NOOP */ + } + } + } + +From 1a30d45ae50f6754274e409b7bf20c95eefeffbc Mon Sep 17 00:00:00 2001 +From: Dan Pasanen +Date: Thu, 21 Sep 2017 07:41:02 -0500 +Subject: [PATCH 369/407] vcsm: use dma APIs for cache functions + +* Will handle multi-platform builds +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 45 +++++++++++++---------------------- + 1 file changed, 16 insertions(+), 29 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 80c5381a64c2f7b854c01e7aef93f63660d6c4ca..1c5a8a13ab9d565103e106b694b74089c778e0f5 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -218,34 +218,6 @@ static const char *const sm_cache_map_vector[] = { + }; + #endif + +-typedef void cache_flush_op_fn(const void *, const void *); +- +-#if defined(CONFIG_CPU_CACHE_V7) +-extern cache_flush_op_fn v7_dma_inv_range; +-extern cache_flush_op_fn v7_dma_clean_range; +-extern cache_flush_op_fn v7_dma_flush_range; +-static cache_flush_op_fn * const flushops[4] = +-{ +- 0, +- v7_dma_inv_range, +- v7_dma_clean_range, +- v7_dma_flush_range, +-}; +-#elif defined(CONFIG_CPU_CACHE_V6) +-extern cache_flush_op_fn v6_dma_inv_range; +-extern cache_flush_op_fn v6_dma_clean_range; +-extern cache_flush_op_fn v6_dma_flush_range; +-static cache_flush_op_fn * const flushops[4] = +-{ +- 0, +- v6_dma_inv_range, +- v6_dma_clean_range, +- v6_dma_flush_range, +-}; +-#else +-#error Unknown cache config +-#endif +- + /* ---- Private Function Prototypes -------------------------------------- */ + + /* ---- Private Functions ------------------------------------------------ */ +@@ -3028,7 +3000,22 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + for (i = 0; i < ioparam.op_count; i++) { + const struct vmcs_sm_ioctl_clean_invalid_block * const op = block + i; +- cache_flush_op_fn * const op_fn = flushops[op->invalidate_mode & 3]; ++ void (*op_fn)(const void *, const void *); ++ ++ switch(op->invalidate_mode & 3) { ++ case VCSM_CACHE_OP_INV: ++ op_fn = dmac_inv_range; ++ break; ++ case VCSM_CACHE_OP_CLEAN: ++ op_fn = dmac_clean_range; ++ break; ++ case VCSM_CACHE_OP_FLUSH: ++ op_fn = dmac_flush_range; ++ break; ++ default: ++ op_fn = 0; ++ break; ++ } + + if ((op->invalidate_mode & ~3) != 0) { + ret = -EINVAL; + +From 2d81766ea114ff3b88b5f8a6223adbff2f632f15 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 29 Sep 2017 16:15:01 +0100 +Subject: [PATCH 370/407] vcsm: Fix up macros to avoid breaking numbers used by + existing apps + +--- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index e50fd8eaecef7a3c8451c040ffc3888cc37e28fc..4f120421c2d11f7ae46752c38b073a4dfdf712c6 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -29,8 +29,8 @@ enum vc_sm_lock_cache_mode { + + /* Cache functions */ + #define VCSM_CACHE_OP_INV 0x01 +-#define VCSM_CACHE_OP_FLUSH 0x02 +-#define VCSM_CACHE_OP_CLEAN 0x03 ++#define VCSM_CACHE_OP_CLEAN 0x02 ++#define VCSM_CACHE_OP_FLUSH 0x03 + + /* Allocate a shared memory handle and block. */ + int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle); + +From 111366a09e74644eab116aa617d2dacbd9bc1bde Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 17 Oct 2017 16:21:13 +0100 +Subject: [PATCH 371/407] vc-cma: Remove the driver as non-functional on Pi + +vc-cma was pulled in from previous platforms. It +supposedly allowed the VPU relocatable heap to be +released to the kernel as CMA, but it was always +a little fragile. + +Remove it to avoid complications. + +Signed-off-by: Dave Stevenson +--- + arch/arm/configs/bcm2709_defconfig | 1 - + arch/arm/configs/bcmrpi_defconfig | 1 - + drivers/char/broadcom/Kconfig | 7 - + drivers/char/broadcom/Makefile | 1 - + drivers/char/broadcom/vc_cma/Makefile | 7 - + drivers/char/broadcom/vc_cma/vc_cma.c | 1193 --------------------------------- + 6 files changed, 1210 deletions(-) + delete mode 100644 drivers/char/broadcom/vc_cma/Makefile + delete mode 100644 drivers/char/broadcom/vc_cma/vc_cma.c + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index b35e737d79962ce6474932e3dac904adbe480158..32f70a26fef4f9b4132233dc07d85ed92452b393 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -593,7 +593,6 @@ CONFIG_GAMEPORT=m + CONFIG_GAMEPORT_NS558=m + CONFIG_GAMEPORT_L4=m + CONFIG_BRCM_CHAR_DRIVERS=y +-CONFIG_BCM_VC_CMA=y + CONFIG_BCM_VCIO=y + CONFIG_BCM_VC_SM=y + # CONFIG_LEGACY_PTYS is not set +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 23360b1b13197512851e3d14b18ebcc610f36733..43b258bf0f951982e32005e8235110cf5eed48cf 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -589,7 +589,6 @@ CONFIG_GAMEPORT=m + CONFIG_GAMEPORT_NS558=m + CONFIG_GAMEPORT_L4=m + CONFIG_BRCM_CHAR_DRIVERS=y +-CONFIG_BCM_VC_CMA=y + CONFIG_BCM_VCIO=y + CONFIG_BCM_VC_SM=y + # CONFIG_LEGACY_PTYS is not set +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index 032164919350db25c586c36f0e05d3e4891fb835..77bf68a88e685ea31502437a10cfa2925d0d4d6f 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -9,13 +9,6 @@ menuconfig BRCM_CHAR_DRIVERS + + if BRCM_CHAR_DRIVERS + +-config BCM_VC_CMA +- bool "Videocore CMA" +- depends on CMA && BCM2708_VCHIQ +- default n +- help +- Helper for videocore CMA access. +- + config BCM2708_VCMEM + bool "Videocore Memory" + default y +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index 14775c9b20b4b6a58f681f3687614676b5e2a871..7d9cb3e0b1c3c4f64c74e3d1b664a4d94170a3e0 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -1,4 +1,3 @@ +-obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o + obj-$(CONFIG_BCM_VCIO) += vcio.o + obj-$(CONFIG_BCM_VC_SM) += vc_sm/ +diff --git a/drivers/char/broadcom/vc_cma/Makefile b/drivers/char/broadcom/vc_cma/Makefile +deleted file mode 100644 +index d222313e28995bb54e9448192f5c99a352dde2e8..0000000000000000000000000000000000000000 +--- a/drivers/char/broadcom/vc_cma/Makefile ++++ /dev/null +@@ -1,7 +0,0 @@ +-ccflags-$(CONFIG_BCM_VC_CMA) += -Wall -Wstrict-prototypes -Wno-trigraphs -Werror +-ccflags-$(CONFIG_BCM_VC_CMA) += -Iinclude/linux/broadcom -Idrivers/staging/vc04_services -Idrivers/staging/vc04_services/interface/vchi -Idrivers/staging/vc04_services/interface/vchiq_arm +-ccflags-$(CONFIG_BCM_VC_CMA) += -D__KERNEL__ -D__linux__ +- +-obj-$(CONFIG_BCM_VC_CMA) += vc-cma.o +- +-vc-cma-objs := vc_cma.o +diff --git a/drivers/char/broadcom/vc_cma/vc_cma.c b/drivers/char/broadcom/vc_cma/vc_cma.c +deleted file mode 100644 +index 85f6e9da9e5baa0abfba618a171881c078f38496..0000000000000000000000000000000000000000 +--- a/drivers/char/broadcom/vc_cma/vc_cma.c ++++ /dev/null +@@ -1,1193 +0,0 @@ +-/** +- * Copyright (c) 2010-2012 Broadcom. All rights reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions +- * are met: +- * 1. Redistributions of source code must retain the above copyright +- * notice, this list of conditions, and the following disclaimer, +- * without modification. +- * 2. Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * 3. The names of the above-listed copyright holders may not be used +- * to endorse or promote products derived from this software without +- * specific prior written permission. +- * +- * ALTERNATIVELY, this software may be distributed under the terms of the +- * GNU General Public License ("GPL") version 2, as published by the Free +- * Software Foundation. +- * +- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include "vc_cma.h" +- +-#include "vchiq_util.h" +-#include "vchiq_connected.h" +-//#include "debug_sym.h" +-//#include "vc_mem.h" +- +-#define DRIVER_NAME "vc-cma" +- +-#define LOG_DBG(fmt, ...) \ +- if (vc_cma_debug) \ +- printk(KERN_INFO fmt "\n", ##__VA_ARGS__) +-#define LOG_INFO(fmt, ...) \ +- printk(KERN_INFO fmt "\n", ##__VA_ARGS__) +-#define LOG_ERR(fmt, ...) \ +- printk(KERN_ERR fmt "\n", ##__VA_ARGS__) +- +-#define VC_CMA_FOURCC VCHIQ_MAKE_FOURCC('C', 'M', 'A', ' ') +-#define VC_CMA_VERSION 2 +- +-#define VC_CMA_CHUNK_ORDER 6 /* 256K */ +-#define VC_CMA_CHUNK_SIZE (4096 << VC_CMA_CHUNK_ORDER) +-#define VC_CMA_MAX_PARAMS_PER_MSG \ +- ((VCHIQ_MAX_MSG_SIZE - sizeof(unsigned short))/sizeof(unsigned short)) +-#define VC_CMA_RESERVE_COUNT_MAX 16 +- +-#define PAGES_PER_CHUNK (VC_CMA_CHUNK_SIZE / PAGE_SIZE) +- +-#define VCADDR_TO_PHYSADDR(vcaddr) (mm_vc_mem_phys_addr + vcaddr) +- +-#define loud_error(...) \ +- LOG_ERR("===== " __VA_ARGS__) +- +-enum { +- VC_CMA_MSG_QUIT, +- VC_CMA_MSG_OPEN, +- VC_CMA_MSG_TICK, +- VC_CMA_MSG_ALLOC, /* chunk count */ +- VC_CMA_MSG_FREE, /* chunk, chunk, ... */ +- VC_CMA_MSG_ALLOCATED, /* chunk, chunk, ... */ +- VC_CMA_MSG_REQUEST_ALLOC, /* chunk count */ +- VC_CMA_MSG_REQUEST_FREE, /* chunk count */ +- VC_CMA_MSG_RESERVE, /* bytes lo, bytes hi */ +- VC_CMA_MSG_UPDATE_RESERVE, +- VC_CMA_MSG_MAX +-}; +- +-struct cma_msg { +- unsigned short type; +- unsigned short params[VC_CMA_MAX_PARAMS_PER_MSG]; +-}; +- +-struct vc_cma_reserve_user { +- unsigned int pid; +- unsigned int reserve; +-}; +- +-/* Device (/dev) related variables */ +-static dev_t vc_cma_devnum; +-static struct class *vc_cma_class; +-static struct cdev vc_cma_cdev; +-static int vc_cma_inited; +-static int vc_cma_debug; +- +-/* Proc entry */ +-static struct proc_dir_entry *vc_cma_proc_entry; +- +-phys_addr_t vc_cma_base; +-struct page *vc_cma_base_page; +-unsigned int vc_cma_size; +-EXPORT_SYMBOL(vc_cma_size); +-unsigned int vc_cma_initial; +-unsigned int vc_cma_chunks; +-unsigned int vc_cma_chunks_used; +-unsigned int vc_cma_chunks_reserved; +- +- +-void *vc_cma_dma_alloc; +-unsigned int vc_cma_dma_size; +- +-static int in_loud_error; +- +-unsigned int vc_cma_reserve_total; +-unsigned int vc_cma_reserve_count; +-struct vc_cma_reserve_user vc_cma_reserve_users[VC_CMA_RESERVE_COUNT_MAX]; +-static DEFINE_SEMAPHORE(vc_cma_reserve_mutex); +-static DEFINE_SEMAPHORE(vc_cma_worker_queue_push_mutex); +- +-static u64 vc_cma_dma_mask = DMA_BIT_MASK(32); +-static struct platform_device vc_cma_device = { +- .name = "vc-cma", +- .id = 0, +- .dev = { +- .dma_mask = &vc_cma_dma_mask, +- .coherent_dma_mask = DMA_BIT_MASK(32), +- }, +-}; +- +-static VCHIQ_INSTANCE_T cma_instance; +-static VCHIQ_SERVICE_HANDLE_T cma_service; +-static VCHIU_QUEUE_T cma_msg_queue; +-static struct task_struct *cma_worker; +- +-static int vc_cma_set_reserve(unsigned int reserve, unsigned int pid); +-static int vc_cma_alloc_chunks(int num_chunks, struct cma_msg *reply); +-static VCHIQ_STATUS_T cma_service_callback(VCHIQ_REASON_T reason, +- VCHIQ_HEADER_T * header, +- VCHIQ_SERVICE_HANDLE_T service, +- void *bulk_userdata); +-static void send_vc_msg(unsigned short type, +- unsigned short param1, unsigned short param2); +-static bool send_worker_msg(VCHIQ_HEADER_T * msg); +- +-static int early_vc_cma_mem(char *p) +-{ +- unsigned int new_size; +- printk(KERN_NOTICE "early_vc_cma_mem(%s)", p); +- vc_cma_size = memparse(p, &p); +- vc_cma_initial = vc_cma_size; +- if (*p == '/') +- vc_cma_size = memparse(p + 1, &p); +- if (*p == '@') +- vc_cma_base = memparse(p + 1, &p); +- +- new_size = (vc_cma_size - ((-vc_cma_base) & (VC_CMA_CHUNK_SIZE - 1))) +- & ~(VC_CMA_CHUNK_SIZE - 1); +- if (new_size > vc_cma_size) +- vc_cma_size = 0; +- vc_cma_initial = (vc_cma_initial + VC_CMA_CHUNK_SIZE - 1) +- & ~(VC_CMA_CHUNK_SIZE - 1); +- if (vc_cma_initial > vc_cma_size) +- vc_cma_initial = vc_cma_size; +- vc_cma_base = (vc_cma_base + VC_CMA_CHUNK_SIZE - 1) +- & ~(VC_CMA_CHUNK_SIZE - 1); +- +- printk(KERN_NOTICE " -> initial %x, size %x, base %x", vc_cma_initial, +- vc_cma_size, (unsigned int)vc_cma_base); +- +- return 0; +-} +- +-early_param("vc-cma-mem", early_vc_cma_mem); +- +-void __init vc_cma_early_init(void) +-{ +- LOG_DBG("vc_cma_early_init - vc_cma_chunks = %d", vc_cma_chunks); +- if (vc_cma_size) { +- int rc = platform_device_register(&vc_cma_device); +- LOG_DBG("platform_device_register -> %d", rc); +- } +-} +- +-void __init vc_cma_reserve(void) +-{ +- /* if vc_cma_size is set, then declare vc CMA area of the same +- * size from the end of memory +- */ +- if (vc_cma_size) { +- if (dma_declare_contiguous(&vc_cma_device.dev, vc_cma_size, +- vc_cma_base, 0) == 0) { +- if (!dev_get_cma_area(NULL)) { +- /* There is no default CMA area - make this +- the default */ +- struct cma *vc_cma_area = dev_get_cma_area( +- &vc_cma_device.dev); +- dma_contiguous_set_default(vc_cma_area); +- LOG_INFO("vc_cma_reserve - using vc_cma as " +- "the default contiguous DMA area"); +- } +- } else { +- LOG_ERR("vc_cma: dma_declare_contiguous(%x,%x) failed", +- vc_cma_size, (unsigned int)vc_cma_base); +- vc_cma_size = 0; +- } +- } +- vc_cma_chunks = vc_cma_size / VC_CMA_CHUNK_SIZE; +-} +- +-/**************************************************************************** +-* +-* vc_cma_open +-* +-***************************************************************************/ +- +-static int vc_cma_open(struct inode *inode, struct file *file) +-{ +- (void)inode; +- (void)file; +- +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_cma_release +-* +-***************************************************************************/ +- +-static int vc_cma_release(struct inode *inode, struct file *file) +-{ +- (void)inode; +- (void)file; +- +- vc_cma_set_reserve(0, current->tgid); +- +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_cma_ioctl +-* +-***************************************************************************/ +- +-static long vc_cma_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +-{ +- int rc = 0; +- +- (void)cmd; +- (void)arg; +- +- switch (cmd) { +- case VC_CMA_IOC_RESERVE: +- rc = vc_cma_set_reserve((unsigned int)arg, current->tgid); +- if (rc >= 0) +- rc = 0; +- break; +- default: +- LOG_ERR("vc-cma: Unknown ioctl %x", cmd); +- return -ENOTTY; +- } +- +- return rc; +-} +- +-/**************************************************************************** +-* +-* File Operations for the driver. +-* +-***************************************************************************/ +- +-static const struct file_operations vc_cma_fops = { +- .owner = THIS_MODULE, +- .open = vc_cma_open, +- .release = vc_cma_release, +- .unlocked_ioctl = vc_cma_ioctl, +-}; +- +-/**************************************************************************** +-* +-* vc_cma_proc_open +-* +-***************************************************************************/ +- +-static int vc_cma_show_info(struct seq_file *m, void *v) +-{ +- int i; +- +- seq_printf(m, "Videocore CMA:\n"); +- seq_printf(m, " Base : %08x\n", (unsigned int)vc_cma_base); +- seq_printf(m, " Length : %08x\n", vc_cma_size); +- seq_printf(m, " Initial : %08x\n", vc_cma_initial); +- seq_printf(m, " Chunk size : %08x\n", VC_CMA_CHUNK_SIZE); +- seq_printf(m, " Chunks : %4d (%d bytes)\n", +- (int)vc_cma_chunks, +- (int)(vc_cma_chunks * VC_CMA_CHUNK_SIZE)); +- seq_printf(m, " Used : %4d (%d bytes)\n", +- (int)vc_cma_chunks_used, +- (int)(vc_cma_chunks_used * VC_CMA_CHUNK_SIZE)); +- seq_printf(m, " Reserved : %4d (%d bytes)\n", +- (unsigned int)vc_cma_chunks_reserved, +- (int)(vc_cma_chunks_reserved * VC_CMA_CHUNK_SIZE)); +- +- for (i = 0; i < vc_cma_reserve_count; i++) { +- struct vc_cma_reserve_user *user = &vc_cma_reserve_users[i]; +- seq_printf(m, " PID %5d: %d bytes\n", user->pid, +- user->reserve); +- } +- seq_printf(m, " dma_alloc : %p (%d pages)\n", +- vc_cma_dma_alloc ? page_address(vc_cma_dma_alloc) : 0, +- vc_cma_dma_size); +- +- seq_printf(m, "\n"); +- +- return 0; +-} +- +-static int vc_cma_proc_open(struct inode *inode, struct file *file) +-{ +- return single_open(file, vc_cma_show_info, NULL); +-} +- +-/**************************************************************************** +-* +-* vc_cma_proc_write +-* +-***************************************************************************/ +- +-static int vc_cma_proc_write(struct file *file, +- const char __user *buffer, +- size_t size, loff_t *ppos) +-{ +- int rc = -EFAULT; +- char input_str[20]; +- +- memset(input_str, 0, sizeof(input_str)); +- +- if (size > sizeof(input_str)) { +- LOG_ERR("%s: input string length too long", __func__); +- goto out; +- } +- +- if (copy_from_user(input_str, buffer, size - 1)) { +- LOG_ERR("%s: failed to get input string", __func__); +- goto out; +- } +-#define ALLOC_STR "alloc" +-#define FREE_STR "free" +-#define DEBUG_STR "debug" +-#define RESERVE_STR "reserve" +-#define DMA_ALLOC_STR "dma_alloc" +-#define DMA_FREE_STR "dma_free" +- if (strncmp(input_str, ALLOC_STR, strlen(ALLOC_STR)) == 0) { +- int alloc_size; +- char *p = input_str + strlen(ALLOC_STR); +- +- while (*p == ' ') +- p++; +- alloc_size = memparse(p, NULL); +- LOG_INFO("/proc/vc-cma: alloc %d", alloc_size); +- if (alloc_size) +- send_vc_msg(VC_CMA_MSG_REQUEST_FREE, +- alloc_size / VC_CMA_CHUNK_SIZE, 0); +- else +- LOG_ERR("invalid size '%s'", p); +- rc = size; +- } else if (strncmp(input_str, FREE_STR, strlen(FREE_STR)) == 0) { +- int alloc_size; +- char *p = input_str + strlen(FREE_STR); +- +- while (*p == ' ') +- p++; +- alloc_size = memparse(p, NULL); +- LOG_INFO("/proc/vc-cma: free %d", alloc_size); +- if (alloc_size) +- send_vc_msg(VC_CMA_MSG_REQUEST_ALLOC, +- alloc_size / VC_CMA_CHUNK_SIZE, 0); +- else +- LOG_ERR("invalid size '%s'", p); +- rc = size; +- } else if (strncmp(input_str, DEBUG_STR, strlen(DEBUG_STR)) == 0) { +- char *p = input_str + strlen(DEBUG_STR); +- while (*p == ' ') +- p++; +- if ((strcmp(p, "on") == 0) || (strcmp(p, "1") == 0)) +- vc_cma_debug = 1; +- else if ((strcmp(p, "off") == 0) || (strcmp(p, "0") == 0)) +- vc_cma_debug = 0; +- LOG_INFO("/proc/vc-cma: debug %s", vc_cma_debug ? "on" : "off"); +- rc = size; +- } else if (strncmp(input_str, RESERVE_STR, strlen(RESERVE_STR)) == 0) { +- int alloc_size; +- int reserved; +- char *p = input_str + strlen(RESERVE_STR); +- while (*p == ' ') +- p++; +- alloc_size = memparse(p, NULL); +- +- reserved = vc_cma_set_reserve(alloc_size, current->tgid); +- rc = (reserved >= 0) ? size : reserved; +- } else if (strncmp(input_str, DMA_ALLOC_STR, strlen(DMA_ALLOC_STR)) == 0) { +- int alloc_size; +- char *p = input_str + strlen(DMA_ALLOC_STR); +- while (*p == ' ') +- p++; +- alloc_size = memparse(p, NULL); +- +- if (vc_cma_dma_alloc) { +- dma_release_from_contiguous(NULL, vc_cma_dma_alloc, +- vc_cma_dma_size); +- vc_cma_dma_alloc = NULL; +- vc_cma_dma_size = 0; +- } +- vc_cma_dma_alloc = dma_alloc_from_contiguous(NULL, alloc_size, 0); +- vc_cma_dma_size = (vc_cma_dma_alloc ? alloc_size : 0); +- if (vc_cma_dma_alloc) +- LOG_INFO("dma_alloc(%d pages) -> %p", alloc_size, page_address(vc_cma_dma_alloc)); +- else +- LOG_ERR("dma_alloc(%d pages) failed", alloc_size); +- rc = size; +- } else if (strncmp(input_str, DMA_FREE_STR, strlen(DMA_FREE_STR)) == 0) { +- if (vc_cma_dma_alloc) { +- dma_release_from_contiguous(NULL, vc_cma_dma_alloc, +- vc_cma_dma_size); +- vc_cma_dma_alloc = NULL; +- vc_cma_dma_size = 0; +- } +- rc = size; +- } +- +-out: +- return rc; +-} +- +-/**************************************************************************** +-* +-* File Operations for /proc interface. +-* +-***************************************************************************/ +- +-static const struct file_operations vc_cma_proc_fops = { +- .open = vc_cma_proc_open, +- .read = seq_read, +- .write = vc_cma_proc_write, +- .llseek = seq_lseek, +- .release = single_release +-}; +- +-static int vc_cma_set_reserve(unsigned int reserve, unsigned int pid) +-{ +- struct vc_cma_reserve_user *user = NULL; +- int delta = 0; +- int i; +- +- if (down_interruptible(&vc_cma_reserve_mutex)) +- return -ERESTARTSYS; +- +- for (i = 0; i < vc_cma_reserve_count; i++) { +- if (pid == vc_cma_reserve_users[i].pid) { +- user = &vc_cma_reserve_users[i]; +- delta = reserve - user->reserve; +- if (reserve) +- user->reserve = reserve; +- else { +- /* Remove this entry by copying downwards */ +- while ((i + 1) < vc_cma_reserve_count) { +- user[0].pid = user[1].pid; +- user[0].reserve = user[1].reserve; +- user++; +- i++; +- } +- vc_cma_reserve_count--; +- user = NULL; +- } +- break; +- } +- } +- +- if (reserve && !user) { +- if (vc_cma_reserve_count == VC_CMA_RESERVE_COUNT_MAX) { +- LOG_ERR("vc-cma: Too many reservations - " +- "increase CMA_RESERVE_COUNT_MAX"); +- up(&vc_cma_reserve_mutex); +- return -EBUSY; +- } +- user = &vc_cma_reserve_users[vc_cma_reserve_count]; +- user->pid = pid; +- user->reserve = reserve; +- delta = reserve; +- vc_cma_reserve_count++; +- } +- +- vc_cma_reserve_total += delta; +- +- send_vc_msg(VC_CMA_MSG_RESERVE, +- vc_cma_reserve_total & 0xffff, vc_cma_reserve_total >> 16); +- +- send_worker_msg((VCHIQ_HEADER_T *) VC_CMA_MSG_UPDATE_RESERVE); +- +- LOG_DBG("/proc/vc-cma: reserve %d (PID %d) - total %u", +- reserve, pid, vc_cma_reserve_total); +- +- up(&vc_cma_reserve_mutex); +- +- return vc_cma_reserve_total; +-} +- +-static VCHIQ_STATUS_T cma_service_callback(VCHIQ_REASON_T reason, +- VCHIQ_HEADER_T * header, +- VCHIQ_SERVICE_HANDLE_T service, +- void *bulk_userdata) +-{ +- switch (reason) { +- case VCHIQ_MESSAGE_AVAILABLE: +- if (!send_worker_msg(header)) +- return VCHIQ_RETRY; +- break; +- case VCHIQ_SERVICE_CLOSED: +- LOG_DBG("CMA service closed"); +- break; +- default: +- LOG_ERR("Unexpected CMA callback reason %d", reason); +- break; +- } +- return VCHIQ_SUCCESS; +-} +- +-static void send_vc_msg(unsigned short type, +- unsigned short param1, unsigned short param2) +-{ +- unsigned short msg[] = { type, param1, param2 }; +- VCHIQ_ELEMENT_T elem = { &msg, sizeof(msg) }; +- VCHIQ_STATUS_T ret; +- vchiq_use_service(cma_service); +- ret = vchiq_queue_message(cma_service, &elem, 1); +- vchiq_release_service(cma_service); +- if (ret != VCHIQ_SUCCESS) +- LOG_ERR("vchiq_queue_message returned %x", ret); +-} +- +-static bool send_worker_msg(VCHIQ_HEADER_T * msg) +-{ +- if (down_interruptible(&vc_cma_worker_queue_push_mutex)) +- return false; +- vchiu_queue_push(&cma_msg_queue, msg); +- up(&vc_cma_worker_queue_push_mutex); +- return true; +-} +- +-static int vc_cma_alloc_chunks(int num_chunks, struct cma_msg *reply) +-{ +- int i; +- for (i = 0; i < num_chunks; i++) { +- struct page *chunk; +- unsigned int chunk_num; +- uint8_t *chunk_addr; +- size_t chunk_size = PAGES_PER_CHUNK << PAGE_SHIFT; +- +- chunk = dma_alloc_from_contiguous(&vc_cma_device.dev, +- PAGES_PER_CHUNK, +- VC_CMA_CHUNK_ORDER); +- if (!chunk) +- break; +- +- chunk_addr = page_address(chunk); +- dmac_flush_range(chunk_addr, chunk_addr + chunk_size); +- outer_inv_range(__pa(chunk_addr), __pa(chunk_addr) + +- chunk_size); +- +- chunk_num = +- (page_to_phys(chunk) - vc_cma_base) / VC_CMA_CHUNK_SIZE; +- BUG_ON(((page_to_phys(chunk) - vc_cma_base) % +- VC_CMA_CHUNK_SIZE) != 0); +- if (chunk_num >= vc_cma_chunks) { +- phys_addr_t _pa = vc_cma_base + vc_cma_size - 1; +- LOG_ERR("%s: ===============================", +- __func__); +- LOG_ERR("%s: chunk phys %x, vc_cma %pa-%pa - " +- "bad SPARSEMEM configuration?", +- __func__, (unsigned int)page_to_phys(chunk), +- &vc_cma_base, &_pa); +- LOG_ERR("%s: dev->cma_area = %p", __func__, +- (void*)0/*vc_cma_device.dev.cma_area*/); +- LOG_ERR("%s: ===============================", +- __func__); +- break; +- } +- reply->params[i] = chunk_num; +- vc_cma_chunks_used++; +- } +- +- if (i < num_chunks) { +- LOG_ERR("%s: dma_alloc_from_contiguous failed " +- "for %x bytes (alloc %d of %d, %d free)", +- __func__, VC_CMA_CHUNK_SIZE, i, +- num_chunks, vc_cma_chunks - vc_cma_chunks_used); +- num_chunks = i; +- } +- +- LOG_DBG("CMA allocated %d chunks -> %d used", +- num_chunks, vc_cma_chunks_used); +- reply->type = VC_CMA_MSG_ALLOCATED; +- +- { +- VCHIQ_ELEMENT_T elem = { +- reply, +- offsetof(struct cma_msg, params[0]) + +- num_chunks * sizeof(reply->params[0]) +- }; +- VCHIQ_STATUS_T ret; +- vchiq_use_service(cma_service); +- ret = vchiq_queue_message(cma_service, &elem, 1); +- vchiq_release_service(cma_service); +- if (ret != VCHIQ_SUCCESS) +- LOG_ERR("vchiq_queue_message return " "%x", ret); +- } +- +- return num_chunks; +-} +- +-static int cma_worker_proc(void *param) +-{ +- static struct cma_msg reply; +- (void)param; +- +- while (1) { +- VCHIQ_HEADER_T *msg; +- static struct cma_msg msg_copy; +- struct cma_msg *cma_msg = &msg_copy; +- int type, msg_size; +- +- msg = vchiu_queue_pop(&cma_msg_queue); +- if ((unsigned int)msg >= VC_CMA_MSG_MAX) { +- msg_size = msg->size; +- memcpy(&msg_copy, msg->data, msg_size); +- type = cma_msg->type; +- vchiq_release_message(cma_service, msg); +- } else { +- msg_size = 0; +- type = (int)msg; +- if (type == VC_CMA_MSG_QUIT) +- break; +- else if (type == VC_CMA_MSG_UPDATE_RESERVE) { +- msg = NULL; +- cma_msg = NULL; +- } else { +- BUG(); +- continue; +- } +- } +- +- switch (type) { +- case VC_CMA_MSG_ALLOC:{ +- int num_chunks, free_chunks; +- num_chunks = cma_msg->params[0]; +- free_chunks = +- vc_cma_chunks - vc_cma_chunks_used; +- LOG_DBG("CMA_MSG_ALLOC(%d chunks)", num_chunks); +- if (num_chunks > VC_CMA_MAX_PARAMS_PER_MSG) { +- LOG_ERR +- ("CMA_MSG_ALLOC - chunk count (%d) " +- "exceeds VC_CMA_MAX_PARAMS_PER_MSG (%d)", +- num_chunks, +- VC_CMA_MAX_PARAMS_PER_MSG); +- num_chunks = VC_CMA_MAX_PARAMS_PER_MSG; +- } +- +- if (num_chunks > free_chunks) { +- LOG_ERR +- ("CMA_MSG_ALLOC - chunk count (%d) " +- "exceeds free chunks (%d)", +- num_chunks, free_chunks); +- num_chunks = free_chunks; +- } +- +- vc_cma_alloc_chunks(num_chunks, &reply); +- } +- break; +- +- case VC_CMA_MSG_FREE:{ +- int chunk_count = +- (msg_size - +- offsetof(struct cma_msg, +- params)) / +- sizeof(cma_msg->params[0]); +- int i; +- BUG_ON(chunk_count <= 0); +- +- LOG_DBG("CMA_MSG_FREE(%d chunks - %x, ...)", +- chunk_count, cma_msg->params[0]); +- for (i = 0; i < chunk_count; i++) { +- int chunk_num = cma_msg->params[i]; +- struct page *page = vc_cma_base_page + +- chunk_num * PAGES_PER_CHUNK; +- if (chunk_num >= vc_cma_chunks) { +- LOG_ERR +- ("CMA_MSG_FREE - chunk %d of %d" +- " (value %x) exceeds maximum " +- "(%x)", i, chunk_count, +- chunk_num, +- vc_cma_chunks - 1); +- break; +- } +- +- if (!dma_release_from_contiguous +- (&vc_cma_device.dev, page, +- PAGES_PER_CHUNK)) { +- phys_addr_t _pa = page_to_phys(page); +- LOG_ERR +- ("CMA_MSG_FREE - failed to " +- "release chunk %d (phys %pa, " +- "page %x)", chunk_num, +- &_pa, +- (unsigned int)page); +- } +- vc_cma_chunks_used--; +- } +- LOG_DBG("CMA released %d chunks -> %d used", +- i, vc_cma_chunks_used); +- } +- break; +- +- case VC_CMA_MSG_UPDATE_RESERVE:{ +- int chunks_needed = +- ((vc_cma_reserve_total + VC_CMA_CHUNK_SIZE - +- 1) +- / VC_CMA_CHUNK_SIZE) - +- vc_cma_chunks_reserved; +- +- LOG_DBG +- ("CMA_MSG_UPDATE_RESERVE(%d chunks needed)", +- chunks_needed); +- +- /* Cap the reservations to what is available */ +- if (chunks_needed > 0) { +- if (chunks_needed > +- (vc_cma_chunks - +- vc_cma_chunks_used)) +- chunks_needed = +- (vc_cma_chunks - +- vc_cma_chunks_used); +- +- chunks_needed = +- vc_cma_alloc_chunks(chunks_needed, +- &reply); +- } +- +- LOG_DBG +- ("CMA_MSG_UPDATE_RESERVE(%d chunks allocated)", +- chunks_needed); +- vc_cma_chunks_reserved += chunks_needed; +- } +- break; +- +- default: +- LOG_ERR("unexpected msg type %d", type); +- break; +- } +- } +- +- LOG_DBG("quitting..."); +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_cma_connected_init +-* +-* This function is called once the videocore has been connected. +-* +-***************************************************************************/ +- +-static void vc_cma_connected_init(void) +-{ +- VCHIQ_SERVICE_PARAMS_T service_params; +- +- LOG_DBG("vc_cma_connected_init"); +- +- if (!vchiu_queue_init(&cma_msg_queue, 16)) { +- LOG_ERR("could not create CMA msg queue"); +- goto fail_queue; +- } +- +- if (vchiq_initialise(&cma_instance) != VCHIQ_SUCCESS) +- goto fail_vchiq_init; +- +- vchiq_connect(cma_instance); +- +- service_params.fourcc = VC_CMA_FOURCC; +- service_params.callback = cma_service_callback; +- service_params.userdata = NULL; +- service_params.version = VC_CMA_VERSION; +- service_params.version_min = VC_CMA_VERSION; +- +- if (vchiq_open_service(cma_instance, &service_params, +- &cma_service) != VCHIQ_SUCCESS) { +- LOG_ERR("failed to open service - already in use?"); +- goto fail_vchiq_open; +- } +- +- vchiq_release_service(cma_service); +- +- cma_worker = kthread_create(cma_worker_proc, NULL, "cma_worker"); +- if (!cma_worker) { +- LOG_ERR("could not create CMA worker thread"); +- goto fail_worker; +- } +- set_user_nice(cma_worker, -20); +- wake_up_process(cma_worker); +- +- return; +- +-fail_worker: +- vchiq_close_service(cma_service); +-fail_vchiq_open: +- vchiq_shutdown(cma_instance); +-fail_vchiq_init: +- vchiu_queue_delete(&cma_msg_queue); +-fail_queue: +- return; +-} +- +-void +-loud_error_header(void) +-{ +- if (in_loud_error) +- return; +- +- LOG_ERR("============================================================" +- "================"); +- LOG_ERR("============================================================" +- "================"); +- LOG_ERR("====="); +- +- in_loud_error = 1; +-} +- +-void +-loud_error_footer(void) +-{ +- if (!in_loud_error) +- return; +- +- LOG_ERR("====="); +- LOG_ERR("============================================================" +- "================"); +- LOG_ERR("============================================================" +- "================"); +- +- in_loud_error = 0; +-} +- +-#if 1 +-static int check_cma_config(void) { return 1; } +-#else +-static int +-read_vc_debug_var(VC_MEM_ACCESS_HANDLE_T handle, +- const char *symbol, +- void *buf, size_t bufsize) +-{ +- VC_MEM_ADDR_T vcMemAddr; +- size_t vcMemSize; +- uint8_t *mapAddr; +- off_t vcMapAddr; +- +- if (!LookupVideoCoreSymbol(handle, symbol, +- &vcMemAddr, +- &vcMemSize)) { +- loud_error_header(); +- loud_error( +- "failed to find VC symbol \"%s\".", +- symbol); +- loud_error_footer(); +- return 0; +- } +- +- if (vcMemSize != bufsize) { +- loud_error_header(); +- loud_error( +- "VC symbol \"%s\" is the wrong size.", +- symbol); +- loud_error_footer(); +- return 0; +- } +- +- vcMapAddr = (off_t)vcMemAddr & VC_MEM_TO_ARM_ADDR_MASK; +- vcMapAddr += mm_vc_mem_phys_addr; +- mapAddr = ioremap_nocache(vcMapAddr, vcMemSize); +- if (mapAddr == 0) { +- loud_error_header(); +- loud_error( +- "failed to ioremap \"%s\" @ 0x%x " +- "(phys: 0x%x, size: %u).", +- symbol, +- (unsigned int)vcMapAddr, +- (unsigned int)vcMemAddr, +- (unsigned int)vcMemSize); +- loud_error_footer(); +- return 0; +- } +- +- memcpy(buf, mapAddr, bufsize); +- iounmap(mapAddr); +- +- return 1; +-} +- +- +-static int +-check_cma_config(void) +-{ +- VC_MEM_ACCESS_HANDLE_T mem_hndl; +- VC_MEM_ADDR_T mempool_start; +- VC_MEM_ADDR_T mempool_end; +- VC_MEM_ADDR_T mempool_offline_start; +- VC_MEM_ADDR_T mempool_offline_end; +- VC_MEM_ADDR_T cam_alloc_base; +- VC_MEM_ADDR_T cam_alloc_size; +- VC_MEM_ADDR_T cam_alloc_end; +- int success = 0; +- +- if (OpenVideoCoreMemory(&mem_hndl) != 0) +- goto out; +- +- /* Read the relevant VideoCore variables */ +- if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_START", +- &mempool_start, +- sizeof(mempool_start))) +- goto close; +- +- if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_END", +- &mempool_end, +- sizeof(mempool_end))) +- goto close; +- +- if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_OFFLINE_START", +- &mempool_offline_start, +- sizeof(mempool_offline_start))) +- goto close; +- +- if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_OFFLINE_END", +- &mempool_offline_end, +- sizeof(mempool_offline_end))) +- goto close; +- +- if (!read_vc_debug_var(mem_hndl, "cam_alloc_base", +- &cam_alloc_base, +- sizeof(cam_alloc_base))) +- goto close; +- +- if (!read_vc_debug_var(mem_hndl, "cam_alloc_size", +- &cam_alloc_size, +- sizeof(cam_alloc_size))) +- goto close; +- +- cam_alloc_end = cam_alloc_base + cam_alloc_size; +- +- success = 1; +- +- /* Now the sanity checks */ +- if (!mempool_offline_start) +- mempool_offline_start = mempool_start; +- if (!mempool_offline_end) +- mempool_offline_end = mempool_end; +- +- if (VCADDR_TO_PHYSADDR(mempool_offline_start) != vc_cma_base) { +- loud_error_header(); +- loud_error( +- "__MEMPOOL_OFFLINE_START(%x -> %lx) doesn't match " +- "vc_cma_base(%x)", +- mempool_offline_start, +- VCADDR_TO_PHYSADDR(mempool_offline_start), +- vc_cma_base); +- success = 0; +- } +- +- if (VCADDR_TO_PHYSADDR(mempool_offline_end) != +- (vc_cma_base + vc_cma_size)) { +- loud_error_header(); +- loud_error( +- "__MEMPOOL_OFFLINE_END(%x -> %lx) doesn't match " +- "vc_cma_base(%x) + vc_cma_size(%x) = %x", +- mempool_offline_start, +- VCADDR_TO_PHYSADDR(mempool_offline_end), +- vc_cma_base, vc_cma_size, vc_cma_base + vc_cma_size); +- success = 0; +- } +- +- if (mempool_end < mempool_start) { +- loud_error_header(); +- loud_error( +- "__MEMPOOL_END(%x) must not be before " +- "__MEMPOOL_START(%x)", +- mempool_end, +- mempool_start); +- success = 0; +- } +- +- if (mempool_offline_end < mempool_offline_start) { +- loud_error_header(); +- loud_error( +- "__MEMPOOL_OFFLINE_END(%x) must not be before " +- "__MEMPOOL_OFFLINE_START(%x)", +- mempool_offline_end, +- mempool_offline_start); +- success = 0; +- } +- +- if (mempool_offline_start < mempool_start) { +- loud_error_header(); +- loud_error( +- "__MEMPOOL_OFFLINE_START(%x) must not be before " +- "__MEMPOOL_START(%x)", +- mempool_offline_start, +- mempool_start); +- success = 0; +- } +- +- if (mempool_offline_end > mempool_end) { +- loud_error_header(); +- loud_error( +- "__MEMPOOL_OFFLINE_END(%x) must not be after " +- "__MEMPOOL_END(%x)", +- mempool_offline_end, +- mempool_end); +- success = 0; +- } +- +- if ((cam_alloc_base < mempool_end) && +- (cam_alloc_end > mempool_start)) { +- loud_error_header(); +- loud_error( +- "cam_alloc pool(%x-%x) overlaps " +- "mempool(%x-%x)", +- cam_alloc_base, cam_alloc_end, +- mempool_start, mempool_end); +- success = 0; +- } +- +- loud_error_footer(); +- +-close: +- CloseVideoCoreMemory(mem_hndl); +- +-out: +- return success; +-} +-#endif +- +-static int vc_cma_init(void) +-{ +- int rc = -EFAULT; +- struct device *dev; +- +- if (!check_cma_config()) +- goto out_release; +- +- LOG_INFO("vc-cma: Videocore CMA driver"); +- LOG_INFO("vc-cma: vc_cma_base = %pa", &vc_cma_base); +- LOG_INFO("vc-cma: vc_cma_size = 0x%08x (%u MiB)", +- vc_cma_size, vc_cma_size / (1024 * 1024)); +- LOG_INFO("vc-cma: vc_cma_initial = 0x%08x (%u MiB)", +- vc_cma_initial, vc_cma_initial / (1024 * 1024)); +- +- vc_cma_base_page = phys_to_page(vc_cma_base); +- +- if (vc_cma_chunks) { +- int chunks_needed = vc_cma_initial / VC_CMA_CHUNK_SIZE; +- +- for (vc_cma_chunks_used = 0; +- vc_cma_chunks_used < chunks_needed; vc_cma_chunks_used++) { +- struct page *chunk; +- chunk = dma_alloc_from_contiguous(&vc_cma_device.dev, +- PAGES_PER_CHUNK, +- VC_CMA_CHUNK_ORDER); +- if (!chunk) +- break; +- BUG_ON(((page_to_phys(chunk) - vc_cma_base) % +- VC_CMA_CHUNK_SIZE) != 0); +- } +- if (vc_cma_chunks_used != chunks_needed) { +- LOG_ERR("%s: dma_alloc_from_contiguous failed (%d " +- "bytes, allocation %d of %d)", +- __func__, VC_CMA_CHUNK_SIZE, +- vc_cma_chunks_used, chunks_needed); +- goto out_release; +- } +- +- vchiq_add_connected_callback(vc_cma_connected_init); +- } +- +- rc = alloc_chrdev_region(&vc_cma_devnum, 0, 1, DRIVER_NAME); +- if (rc < 0) { +- LOG_ERR("%s: alloc_chrdev_region failed (rc=%d)", __func__, rc); +- goto out_release; +- } +- +- cdev_init(&vc_cma_cdev, &vc_cma_fops); +- rc = cdev_add(&vc_cma_cdev, vc_cma_devnum, 1); +- if (rc != 0) { +- LOG_ERR("%s: cdev_add failed (rc=%d)", __func__, rc); +- goto out_unregister; +- } +- +- vc_cma_class = class_create(THIS_MODULE, DRIVER_NAME); +- if (IS_ERR(vc_cma_class)) { +- rc = PTR_ERR(vc_cma_class); +- LOG_ERR("%s: class_create failed (rc=%d)", __func__, rc); +- goto out_cdev_del; +- } +- +- dev = device_create(vc_cma_class, NULL, vc_cma_devnum, NULL, +- DRIVER_NAME); +- if (IS_ERR(dev)) { +- rc = PTR_ERR(dev); +- LOG_ERR("%s: device_create failed (rc=%d)", __func__, rc); +- goto out_class_destroy; +- } +- +- vc_cma_proc_entry = proc_create(DRIVER_NAME, 0444, NULL, &vc_cma_proc_fops); +- if (vc_cma_proc_entry == NULL) { +- rc = -EFAULT; +- LOG_ERR("%s: proc_create failed", __func__); +- goto out_device_destroy; +- } +- +- vc_cma_inited = 1; +- return 0; +- +-out_device_destroy: +- device_destroy(vc_cma_class, vc_cma_devnum); +- +-out_class_destroy: +- class_destroy(vc_cma_class); +- vc_cma_class = NULL; +- +-out_cdev_del: +- cdev_del(&vc_cma_cdev); +- +-out_unregister: +- unregister_chrdev_region(vc_cma_devnum, 1); +- +-out_release: +- /* It is tempting to try to clean up by calling +- dma_release_from_contiguous for all allocated chunks, but it isn't +- a very safe thing to do. If vc_cma_initial is non-zero it is because +- VideoCore is already using that memory, so giving it back to Linux +- is likely to be fatal. +- */ +- return -1; +-} +- +-/**************************************************************************** +-* +-* vc_cma_exit +-* +-***************************************************************************/ +- +-static void __exit vc_cma_exit(void) +-{ +- LOG_DBG("%s: called", __func__); +- +- if (vc_cma_inited) { +- remove_proc_entry(DRIVER_NAME, NULL); +- device_destroy(vc_cma_class, vc_cma_devnum); +- class_destroy(vc_cma_class); +- cdev_del(&vc_cma_cdev); +- unregister_chrdev_region(vc_cma_devnum, 1); +- } +-} +- +-module_init(vc_cma_init); +-module_exit(vc_cma_exit); +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Broadcom Corporation"); + +From 14dbacb2efc39b2eb76b8e1d4691a99590958a39 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Wed, 2 Aug 2017 12:48:04 -0700 +Subject: [PATCH 372/407] drm/vc4: Fix double destroy of the BO cache on + teardown. + +It's also destroyed from the top level vc4_drv.c initialization, which +is where the cache was actually initialized from. + +This used to just involve duplicate del_timer() and cancel_work_sync() +being called, but it started causing kmalloc issues once we +double-freed the new BO label array. + +Fixes: 1908a876f909 ("drm/vc4: Add an ioctl for labeling GEM BOs for summary stats") +Signed-off-by: Eric Anholt +--- + drivers/gpu/drm/vc4/vc4_gem.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c +index a5029ab49068bdbd69411cccbdb6f5111f387e38..066e7009358cd28df95fe45cd3204f71e8a21c55 100644 +--- a/drivers/gpu/drm/vc4/vc4_gem.c ++++ b/drivers/gpu/drm/vc4/vc4_gem.c +@@ -964,6 +964,4 @@ vc4_gem_destroy(struct drm_device *dev) + + if (vc4->hang_state) + vc4_free_hang_state(dev, vc4->hang_state); +- +- vc4_bo_cache_destroy(dev); + } + +From ae46f25cf8e247865708ec1e7bfc787995fc236c Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Wed, 2 Aug 2017 11:46:51 -0700 +Subject: [PATCH 373/407] drm/vc4: Don't disable DSI clocks on component + unload. + +The clocks are enabled/disabled at encoder enable/disable time, not at +component load. Fixes a WARN_ON at boot if V3D fails to probe. + +Fixes: 4078f5757144 ("drm/vc4: Add DSI driver") +Signed-off-by: Eric Anholt +--- + drivers/gpu/drm/vc4/vc4_dsi.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c +index 17fcac381dbb37cd9a5ff210ad8578f480177039..284f486ed9dbf44ff706cce7d111965fb82fab11 100644 +--- a/drivers/gpu/drm/vc4/vc4_dsi.c ++++ b/drivers/gpu/drm/vc4/vc4_dsi.c +@@ -1692,9 +1692,6 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master, + + mipi_dsi_host_unregister(&dsi->dsi_host); + +- clk_disable_unprepare(dsi->pll_phy_clock); +- clk_disable_unprepare(dsi->escape_clock); +- + if (dsi->port == 1) + vc4->dsi1 = NULL; + } + +From 14696f17c976a56b96d6ec32754f914b47c7c5b5 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Tue, 25 Jul 2017 11:27:16 -0700 +Subject: [PATCH 374/407] drm/vc4: Start using u64_to_user_ptr. + +Chris Wilson pointed out this little cleanup in a review of new code, +so let's fix up the code I was copying from. + +Signed-off-by: Eric Anholt +Link: https://patchwork.freedesktop.org/patch/msgid/20170725182718.31468-1-eric@anholt.net +Reviewed-by: Daniel Vetter +(cherry picked from commit 95d7cbcb6fbe3885d7a968cc86b98a08466742af) +--- + drivers/gpu/drm/vc4/vc4_gem.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c +index 066e7009358cd28df95fe45cd3204f71e8a21c55..7e90ea1702994531a734b322393021364d5284b3 100644 +--- a/drivers/gpu/drm/vc4/vc4_gem.c ++++ b/drivers/gpu/drm/vc4/vc4_gem.c +@@ -118,7 +118,7 @@ vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, + bo_state[i].size = vc4_bo->base.base.size; + } + +- if (copy_to_user((void __user *)(uintptr_t)get_state->bo, ++ if (copy_to_user(u64_to_user_ptr(get_state->bo), + bo_state, + state->bo_count * sizeof(*bo_state))) + ret = -EFAULT; +@@ -549,8 +549,7 @@ vc4_cl_lookup_bos(struct drm_device *dev, + goto fail; + } + +- if (copy_from_user(handles, +- (void __user *)(uintptr_t)args->bo_handles, ++ if (copy_from_user(handles, u64_to_user_ptr(args->bo_handles), + exec->bo_count * sizeof(uint32_t))) { + ret = -EFAULT; + DRM_ERROR("Failed to copy in GEM handles\n"); +@@ -626,21 +625,21 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) + exec->shader_state_size = args->shader_rec_count; + + if (copy_from_user(bin, +- (void __user *)(uintptr_t)args->bin_cl, ++ u64_to_user_ptr(args->bin_cl), + args->bin_cl_size)) { + ret = -EFAULT; + goto fail; + } + + if (copy_from_user(exec->shader_rec_u, +- (void __user *)(uintptr_t)args->shader_rec, ++ u64_to_user_ptr(args->shader_rec), + args->shader_rec_size)) { + ret = -EFAULT; + goto fail; + } + + if (copy_from_user(exec->uniforms_u, +- (void __user *)(uintptr_t)args->uniforms, ++ u64_to_user_ptr(args->uniforms), + args->uniforms_size)) { + ret = -EFAULT; + goto fail; + +From 384c99eb0300da63dca9f22562a7f7d283cd9e1e Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Tue, 25 Jul 2017 11:27:17 -0700 +Subject: [PATCH 375/407] drm/vc4: Add an ioctl for labeling GEM BOs for + summary stats + +This has proven immensely useful for debugging memory leaks and +overallocation (which is a rather serious concern on the platform, +given that we typically run at about 256MB of CMA out of up to 1GB +total memory, with framebuffers that are about 8MB ecah). + +The state of the art without this is to dump debug logs from every GL +application, guess as to kernel allocations based on bo_stats, and try +to merge that all together into a global picture of memory allocation +state. With this, you can add a couple of calls to the debug build of +the 3D driver and get a pretty detailed view of GPU memory usage from +/debug/dri/0/bo_stats (or when we debug print to dmesg on allocation +failure). + +The Mesa side currently labels at the gallium resource level (so you +see that a 1920x20 pixmap has been created, presumably for the window +system panel), but we could extend that to be even more useful with +glObjectLabel() names being sent all the way down to the kernel. + +(partial) example of sorted debugfs output with Mesa labeling all +resources: + + kernel BO cache: 16392kb BOs (3) + tiling shadow 1920x1080: 8160kb BOs (1) + resource 1920x1080@32/0: 8160kb BOs (1) +scanout resource 1920x1080@32/0: 8100kb BOs (1) + kernel: 8100kb BOs (1) + +v2: Use strndup_user(), use lockdep assertion instead of just a + comment, fix an array[-1] reference, extend comment about name + freeing. + +Signed-off-by: Eric Anholt +Link: https://patchwork.freedesktop.org/patch/msgid/20170725182718.31468-2-eric@anholt.net +Reviewed-by: Chris Wilson +(cherry picked from commit f30994622b2bf8e4fa224237ac65304b27a9cb6a) +--- + drivers/gpu/drm/vc4/vc4_bo.c | 256 ++++++++++++++++++++++++++++-------- + drivers/gpu/drm/vc4/vc4_drv.c | 8 +- + drivers/gpu/drm/vc4/vc4_drv.h | 39 +++++- + drivers/gpu/drm/vc4/vc4_gem.c | 2 +- + drivers/gpu/drm/vc4/vc4_render_cl.c | 2 +- + drivers/gpu/drm/vc4/vc4_v3d.c | 3 +- + include/uapi/drm/vc4_drm.h | 11 ++ + 7 files changed, 256 insertions(+), 65 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c +index 55bbadc86a1ee45205360fb26e8525a8326db017..42dd21a736bd6c9f8cba84a0dc21d46751efb976 100644 +--- a/drivers/gpu/drm/vc4/vc4_bo.c ++++ b/drivers/gpu/drm/vc4/vc4_bo.c +@@ -21,21 +21,35 @@ + #include "vc4_drv.h" + #include "uapi/drm/vc4_drm.h" + ++static const char * const bo_type_names[] = { ++ "kernel", ++ "V3D", ++ "V3D shader", ++ "dumb", ++ "binner", ++ "RCL", ++ "BCL", ++ "kernel BO cache", ++}; ++ ++static bool is_user_label(int label) ++{ ++ return label >= VC4_BO_TYPE_COUNT; ++} ++ + static void vc4_bo_stats_dump(struct vc4_dev *vc4) + { +- DRM_INFO("num bos allocated: %d\n", +- vc4->bo_stats.num_allocated); +- DRM_INFO("size bos allocated: %dkb\n", +- vc4->bo_stats.size_allocated / 1024); +- DRM_INFO("num bos used: %d\n", +- vc4->bo_stats.num_allocated - vc4->bo_stats.num_cached); +- DRM_INFO("size bos used: %dkb\n", +- (vc4->bo_stats.size_allocated - +- vc4->bo_stats.size_cached) / 1024); +- DRM_INFO("num bos cached: %d\n", +- vc4->bo_stats.num_cached); +- DRM_INFO("size bos cached: %dkb\n", +- vc4->bo_stats.size_cached / 1024); ++ int i; ++ ++ for (i = 0; i < vc4->num_labels; i++) { ++ if (!vc4->bo_labels[i].num_allocated) ++ continue; ++ ++ DRM_INFO("%30s: %6dkb BOs (%d)\n", ++ vc4->bo_labels[i].name, ++ vc4->bo_labels[i].size_allocated / 1024, ++ vc4->bo_labels[i].num_allocated); ++ } + } + + #ifdef CONFIG_DEBUG_FS +@@ -44,30 +58,103 @@ int vc4_bo_stats_debugfs(struct seq_file *m, void *unused) + struct drm_info_node *node = (struct drm_info_node *)m->private; + struct drm_device *dev = node->minor->dev; + struct vc4_dev *vc4 = to_vc4_dev(dev); +- struct vc4_bo_stats stats; ++ int i; + +- /* Take a snapshot of the current stats with the lock held. */ + mutex_lock(&vc4->bo_lock); +- stats = vc4->bo_stats; ++ for (i = 0; i < vc4->num_labels; i++) { ++ if (!vc4->bo_labels[i].num_allocated) ++ continue; ++ ++ seq_printf(m, "%30s: %6dkb BOs (%d)\n", ++ vc4->bo_labels[i].name, ++ vc4->bo_labels[i].size_allocated / 1024, ++ vc4->bo_labels[i].num_allocated); ++ } + mutex_unlock(&vc4->bo_lock); + +- seq_printf(m, "num bos allocated: %d\n", +- stats.num_allocated); +- seq_printf(m, "size bos allocated: %dkb\n", +- stats.size_allocated / 1024); +- seq_printf(m, "num bos used: %d\n", +- stats.num_allocated - stats.num_cached); +- seq_printf(m, "size bos used: %dkb\n", +- (stats.size_allocated - stats.size_cached) / 1024); +- seq_printf(m, "num bos cached: %d\n", +- stats.num_cached); +- seq_printf(m, "size bos cached: %dkb\n", +- stats.size_cached / 1024); +- + return 0; + } + #endif + ++/* Takes ownership of *name and returns the appropriate slot for it in ++ * the bo_labels[] array, extending it as necessary. ++ * ++ * This is inefficient and could use a hash table instead of walking ++ * an array and strcmp()ing. However, the assumption is that user ++ * labeling will be infrequent (scanout buffers and other long-lived ++ * objects, or debug driver builds), so we can live with it for now. ++ */ ++static int vc4_get_user_label(struct vc4_dev *vc4, const char *name) ++{ ++ int i; ++ int free_slot = -1; ++ ++ for (i = 0; i < vc4->num_labels; i++) { ++ if (!vc4->bo_labels[i].name) { ++ free_slot = i; ++ } else if (strcmp(vc4->bo_labels[i].name, name) == 0) { ++ kfree(name); ++ return i; ++ } ++ } ++ ++ if (free_slot != -1) { ++ WARN_ON(vc4->bo_labels[free_slot].num_allocated != 0); ++ vc4->bo_labels[free_slot].name = name; ++ return free_slot; ++ } else { ++ u32 new_label_count = vc4->num_labels + 1; ++ struct vc4_label *new_labels = ++ krealloc(vc4->bo_labels, ++ new_label_count * sizeof(*new_labels), ++ GFP_KERNEL); ++ ++ if (!new_labels) { ++ kfree(name); ++ return -1; ++ } ++ ++ free_slot = vc4->num_labels; ++ vc4->bo_labels = new_labels; ++ vc4->num_labels = new_label_count; ++ ++ vc4->bo_labels[free_slot].name = name; ++ vc4->bo_labels[free_slot].num_allocated = 0; ++ vc4->bo_labels[free_slot].size_allocated = 0; ++ ++ return free_slot; ++ } ++} ++ ++static void vc4_bo_set_label(struct drm_gem_object *gem_obj, int label) ++{ ++ struct vc4_bo *bo = to_vc4_bo(gem_obj); ++ struct vc4_dev *vc4 = to_vc4_dev(gem_obj->dev); ++ ++ lockdep_assert_held(&vc4->bo_lock); ++ ++ if (label != -1) { ++ vc4->bo_labels[label].num_allocated++; ++ vc4->bo_labels[label].size_allocated += gem_obj->size; ++ } ++ ++ vc4->bo_labels[bo->label].num_allocated--; ++ vc4->bo_labels[bo->label].size_allocated -= gem_obj->size; ++ ++ if (vc4->bo_labels[bo->label].num_allocated == 0 && ++ is_user_label(bo->label)) { ++ /* Free user BO label slots on last unreference. ++ * Slots are just where we track the stats for a given ++ * name, and once a name is unused we can reuse that ++ * slot. ++ */ ++ kfree(vc4->bo_labels[bo->label].name); ++ vc4->bo_labels[bo->label].name = NULL; ++ } ++ ++ bo->label = label; ++} ++ + static uint32_t bo_page_index(size_t size) + { + return (size / PAGE_SIZE) - 1; +@@ -77,7 +164,8 @@ static uint32_t bo_page_index(size_t size) + static void vc4_bo_destroy(struct vc4_bo *bo) + { + struct drm_gem_object *obj = &bo->base.base; +- struct vc4_dev *vc4 = to_vc4_dev(obj->dev); ++ ++ vc4_bo_set_label(obj, -1); + + if (bo->validated_shader) { + kfree(bo->validated_shader->texture_samples); +@@ -85,20 +173,12 @@ static void vc4_bo_destroy(struct vc4_bo *bo) + bo->validated_shader = NULL; + } + +- vc4->bo_stats.num_allocated--; +- vc4->bo_stats.size_allocated -= obj->size; + drm_gem_cma_free_object(obj); + } + + /* Must be called with bo_lock held. */ + static void vc4_bo_remove_from_cache(struct vc4_bo *bo) + { +- struct drm_gem_object *obj = &bo->base.base; +- struct vc4_dev *vc4 = to_vc4_dev(obj->dev); +- +- vc4->bo_stats.num_cached--; +- vc4->bo_stats.size_cached -= obj->size; +- + list_del(&bo->unref_head); + list_del(&bo->size_head); + } +@@ -159,7 +239,8 @@ static void vc4_bo_cache_purge(struct drm_device *dev) + } + + static struct vc4_bo *vc4_bo_get_from_cache(struct drm_device *dev, +- uint32_t size) ++ uint32_t size, ++ enum vc4_kernel_bo_type type) + { + struct vc4_dev *vc4 = to_vc4_dev(dev); + uint32_t page_index = bo_page_index(size); +@@ -180,6 +261,8 @@ static struct vc4_bo *vc4_bo_get_from_cache(struct drm_device *dev, + kref_init(&bo->base.base.refcount); + + out: ++ if (bo) ++ vc4_bo_set_label(&bo->base.base, type); + mutex_unlock(&vc4->bo_lock); + return bo; + } +@@ -200,15 +283,16 @@ struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size) + return ERR_PTR(-ENOMEM); + + mutex_lock(&vc4->bo_lock); +- vc4->bo_stats.num_allocated++; +- vc4->bo_stats.size_allocated += size; ++ bo->label = VC4_BO_TYPE_KERNEL; ++ vc4->bo_labels[VC4_BO_TYPE_KERNEL].num_allocated++; ++ vc4->bo_labels[VC4_BO_TYPE_KERNEL].size_allocated += size; + mutex_unlock(&vc4->bo_lock); + + return &bo->base.base; + } + + struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size, +- bool allow_unzeroed) ++ bool allow_unzeroed, enum vc4_kernel_bo_type type) + { + size_t size = roundup(unaligned_size, PAGE_SIZE); + struct vc4_dev *vc4 = to_vc4_dev(dev); +@@ -219,7 +303,7 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size, + return ERR_PTR(-EINVAL); + + /* First, try to get a vc4_bo from the kernel BO cache. */ +- bo = vc4_bo_get_from_cache(dev, size); ++ bo = vc4_bo_get_from_cache(dev, size, type); + if (bo) { + if (!allow_unzeroed) + memset(bo->base.vaddr, 0, bo->base.base.size); +@@ -241,8 +325,13 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size, + return ERR_PTR(-ENOMEM); + } + } ++ bo = to_vc4_bo(&cma_obj->base); + +- return to_vc4_bo(&cma_obj->base); ++ mutex_lock(&vc4->bo_lock); ++ vc4_bo_set_label(&cma_obj->base, type); ++ mutex_unlock(&vc4->bo_lock); ++ ++ return bo; + } + + int vc4_dumb_create(struct drm_file *file_priv, +@@ -259,7 +348,7 @@ int vc4_dumb_create(struct drm_file *file_priv, + if (args->size < args->pitch * args->height) + args->size = args->pitch * args->height; + +- bo = vc4_bo_create(dev, args->size, false); ++ bo = vc4_bo_create(dev, args->size, false, VC4_BO_TYPE_DUMB); + if (IS_ERR(bo)) + return PTR_ERR(bo); + +@@ -338,8 +427,7 @@ void vc4_free_object(struct drm_gem_object *gem_bo) + list_add(&bo->size_head, cache_list); + list_add(&bo->unref_head, &vc4->bo_cache.time_list); + +- vc4->bo_stats.num_cached++; +- vc4->bo_stats.size_cached += gem_bo->size; ++ vc4_bo_set_label(&bo->base.base, VC4_BO_TYPE_KERNEL_CACHE); + + vc4_bo_cache_free_old(dev); + +@@ -448,7 +536,7 @@ int vc4_create_bo_ioctl(struct drm_device *dev, void *data, + * We can't allocate from the BO cache, because the BOs don't + * get zeroed, and that might leak data between users. + */ +- bo = vc4_bo_create(dev, args->size, false); ++ bo = vc4_bo_create(dev, args->size, false, VC4_BO_TYPE_V3D); + if (IS_ERR(bo)) + return PTR_ERR(bo); + +@@ -501,7 +589,7 @@ vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, + return -EINVAL; + } + +- bo = vc4_bo_create(dev, args->size, true); ++ bo = vc4_bo_create(dev, args->size, true, VC4_BO_TYPE_V3D_SHADER); + if (IS_ERR(bo)) + return PTR_ERR(bo); + +@@ -617,9 +705,24 @@ int vc4_get_tiling_ioctl(struct drm_device *dev, void *data, + return 0; + } + +-void vc4_bo_cache_init(struct drm_device *dev) ++int vc4_bo_cache_init(struct drm_device *dev) + { + struct vc4_dev *vc4 = to_vc4_dev(dev); ++ int i; ++ ++ /* Create the initial set of BO labels that the kernel will ++ * use. This lets us avoid a bunch of string reallocation in ++ * the kernel's draw and BO allocation paths. ++ */ ++ vc4->bo_labels = kcalloc(VC4_BO_TYPE_COUNT, sizeof(*vc4->bo_labels), ++ GFP_KERNEL); ++ if (!vc4->bo_labels) ++ return -ENOMEM; ++ vc4->num_labels = VC4_BO_TYPE_COUNT; ++ ++ BUILD_BUG_ON(ARRAY_SIZE(bo_type_names) != VC4_BO_TYPE_COUNT); ++ for (i = 0; i < VC4_BO_TYPE_COUNT; i++) ++ vc4->bo_labels[i].name = bo_type_names[i]; + + mutex_init(&vc4->bo_lock); + +@@ -629,19 +732,66 @@ void vc4_bo_cache_init(struct drm_device *dev) + setup_timer(&vc4->bo_cache.time_timer, + vc4_bo_cache_time_timer, + (unsigned long)dev); ++ ++ return 0; + } + + void vc4_bo_cache_destroy(struct drm_device *dev) + { + struct vc4_dev *vc4 = to_vc4_dev(dev); ++ int i; + + del_timer(&vc4->bo_cache.time_timer); + cancel_work_sync(&vc4->bo_cache.time_work); + + vc4_bo_cache_purge(dev); + +- if (vc4->bo_stats.num_allocated) { +- DRM_ERROR("Destroying BO cache while BOs still allocated:\n"); +- vc4_bo_stats_dump(vc4); ++ for (i = 0; i < vc4->num_labels; i++) { ++ if (vc4->bo_labels[i].num_allocated) { ++ DRM_ERROR("Destroying BO cache with %d %s " ++ "BOs still allocated\n", ++ vc4->bo_labels[i].num_allocated, ++ vc4->bo_labels[i].name); ++ } ++ ++ if (is_user_label(i)) ++ kfree(vc4->bo_labels[i].name); ++ } ++ kfree(vc4->bo_labels); ++} ++ ++int vc4_label_bo_ioctl(struct drm_device *dev, void *data, ++ struct drm_file *file_priv) ++{ ++ struct vc4_dev *vc4 = to_vc4_dev(dev); ++ struct drm_vc4_label_bo *args = data; ++ char *name; ++ struct drm_gem_object *gem_obj; ++ int ret = 0, label; ++ ++ if (!args->len) ++ return -EINVAL; ++ ++ name = strndup_user(u64_to_user_ptr(args->name), args->len + 1); ++ if (IS_ERR(name)) ++ return PTR_ERR(name); ++ ++ gem_obj = drm_gem_object_lookup(file_priv, args->handle); ++ if (!gem_obj) { ++ DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); ++ kfree(name); ++ return -ENOENT; + } ++ ++ mutex_lock(&vc4->bo_lock); ++ label = vc4_get_user_label(vc4, name); ++ if (label != -1) ++ vc4_bo_set_label(gem_obj, label); ++ else ++ ret = -ENOMEM; ++ mutex_unlock(&vc4->bo_lock); ++ ++ drm_gem_object_unreference_unlocked(gem_obj); ++ ++ return ret; + } +diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c +index f528edc4b389e2e3843cd8be2faccf62947cbda4..e28fb8323a23d8bfe7cb5a0c234510ef9520b2fc 100644 +--- a/drivers/gpu/drm/vc4/vc4_drv.c ++++ b/drivers/gpu/drm/vc4/vc4_drv.c +@@ -126,6 +126,7 @@ static const struct drm_ioctl_desc vc4_drm_ioctls[] = { + DRM_IOCTL_DEF_DRV(VC4_GET_PARAM, vc4_get_param_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(VC4_SET_TILING, vc4_set_tiling_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(VC4_GET_TILING, vc4_get_tiling_ioctl, DRM_RENDER_ALLOW), ++ DRM_IOCTL_DEF_DRV(VC4_LABEL_BO, vc4_label_bo_ioctl, DRM_RENDER_ALLOW), + }; + + static struct drm_driver vc4_drm_driver = { +@@ -246,7 +247,9 @@ static int vc4_drm_bind(struct device *dev) + vc4->dev = drm; + drm->dev_private = vc4; + +- vc4_bo_cache_init(drm); ++ ret = vc4_bo_cache_init(drm); ++ if (ret) ++ goto dev_unref; + + drm_mode_config_init(drm); + +@@ -270,8 +273,9 @@ static int vc4_drm_bind(struct device *dev) + component_unbind_all(dev, drm); + gem_destroy: + vc4_gem_destroy(drm); +- drm_dev_unref(drm); + vc4_bo_cache_destroy(drm); ++dev_unref: ++ drm_dev_unref(drm); + return ret; + } + +diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h +index fcf1c45783736413c058a33f31e189ebaddb446e..585da9b8cdfec1548fb1466ad72c952f130078da 100644 +--- a/drivers/gpu/drm/vc4/vc4_drv.h ++++ b/drivers/gpu/drm/vc4/vc4_drv.h +@@ -9,6 +9,24 @@ + #include "drmP.h" + #include "drm_gem_cma_helper.h" + ++/* Don't forget to update vc4_bo.c: bo_type_names[] when adding to ++ * this. ++ */ ++enum vc4_kernel_bo_type { ++ /* Any kernel allocation (gem_create_object hook) before it ++ * gets another type set. ++ */ ++ VC4_BO_TYPE_KERNEL, ++ VC4_BO_TYPE_V3D, ++ VC4_BO_TYPE_V3D_SHADER, ++ VC4_BO_TYPE_DUMB, ++ VC4_BO_TYPE_BIN, ++ VC4_BO_TYPE_RCL, ++ VC4_BO_TYPE_BCL, ++ VC4_BO_TYPE_KERNEL_CACHE, ++ VC4_BO_TYPE_COUNT ++}; ++ + struct vc4_dev { + struct drm_device *dev; + +@@ -48,14 +66,14 @@ struct vc4_dev { + struct timer_list time_timer; + } bo_cache; + +- struct vc4_bo_stats { ++ u32 num_labels; ++ struct vc4_label { ++ const char *name; + u32 num_allocated; + u32 size_allocated; +- u32 num_cached; +- u32 size_cached; +- } bo_stats; ++ } *bo_labels; + +- /* Protects bo_cache and the BO stats. */ ++ /* Protects bo_cache and bo_labels. */ + struct mutex bo_lock; + + /* Sequence number for the last job queued in bin_job_list. +@@ -165,6 +183,11 @@ struct vc4_bo { + * DRM_IOCTL_VC4_CREATE_SHADER_BO. + */ + struct vc4_validated_shader_info *validated_shader; ++ ++ /* One of enum vc4_kernel_bo_type, or VC4_BO_TYPE_COUNT + i ++ * for user-allocated labels. ++ */ ++ int label; + }; + + static inline struct vc4_bo * +@@ -440,7 +463,7 @@ struct vc4_validated_shader_info { + struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size); + void vc4_free_object(struct drm_gem_object *gem_obj); + struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t size, +- bool from_cache); ++ bool from_cache, enum vc4_kernel_bo_type type); + int vc4_dumb_create(struct drm_file *file_priv, + struct drm_device *dev, + struct drm_mode_create_dumb *args); +@@ -458,10 +481,12 @@ int vc4_get_tiling_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv); + int vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv); ++int vc4_label_bo_ioctl(struct drm_device *dev, void *data, ++ struct drm_file *file_priv); + int vc4_mmap(struct file *filp, struct vm_area_struct *vma); + int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma); + void *vc4_prime_vmap(struct drm_gem_object *obj); +-void vc4_bo_cache_init(struct drm_device *dev); ++int vc4_bo_cache_init(struct drm_device *dev); + void vc4_bo_cache_destroy(struct drm_device *dev); + int vc4_bo_stats_debugfs(struct seq_file *m, void *arg); + +diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c +index 7e90ea1702994531a734b322393021364d5284b3..adb94d573a1881062ac0dee42a627746faea8657 100644 +--- a/drivers/gpu/drm/vc4/vc4_gem.c ++++ b/drivers/gpu/drm/vc4/vc4_gem.c +@@ -645,7 +645,7 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) + goto fail; + } + +- bo = vc4_bo_create(dev, exec_size, true); ++ bo = vc4_bo_create(dev, exec_size, true, VC4_BO_TYPE_BCL); + if (IS_ERR(bo)) { + DRM_ERROR("Couldn't allocate BO for binning\n"); + ret = PTR_ERR(bo); +diff --git a/drivers/gpu/drm/vc4/vc4_render_cl.c b/drivers/gpu/drm/vc4/vc4_render_cl.c +index 6face6aa0890b59bc91d3740fa063a5c46f7cc21..eb2794b12efe43dea0408fe772e8426628ae849f 100644 +--- a/drivers/gpu/drm/vc4/vc4_render_cl.c ++++ b/drivers/gpu/drm/vc4/vc4_render_cl.c +@@ -316,7 +316,7 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, + + size += xtiles * ytiles * loop_body_size; + +- setup->rcl = &vc4_bo_create(dev, size, true)->base; ++ setup->rcl = &vc4_bo_create(dev, size, true, VC4_BO_TYPE_RCL)->base; + if (IS_ERR(setup->rcl)) + return PTR_ERR(setup->rcl); + list_add_tail(&to_vc4_bo(&setup->rcl->base)->unref_head, +diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c +index 77ed4ef3b8c8685a3cd8c871bbd249debc4e2ac4..5a980e6692bcc9ae18b44608d1fdca874fcc61b6 100644 +--- a/drivers/gpu/drm/vc4/vc4_v3d.c ++++ b/drivers/gpu/drm/vc4/vc4_v3d.c +@@ -235,7 +235,8 @@ vc4_allocate_bin_bo(struct drm_device *drm) + INIT_LIST_HEAD(&list); + + while (true) { +- struct vc4_bo *bo = vc4_bo_create(drm, size, true); ++ struct vc4_bo *bo = vc4_bo_create(drm, size, true, ++ VC4_BO_TYPE_BIN); + + if (IS_ERR(bo)) { + ret = PTR_ERR(bo); +diff --git a/include/uapi/drm/vc4_drm.h b/include/uapi/drm/vc4_drm.h +index 6ac4c5c014cb9b98343f25721f74b727a88f2bb5..551628e571f955b1a69e57276f228ae1fc09af5c 100644 +--- a/include/uapi/drm/vc4_drm.h ++++ b/include/uapi/drm/vc4_drm.h +@@ -40,6 +40,7 @@ extern "C" { + #define DRM_VC4_GET_PARAM 0x07 + #define DRM_VC4_SET_TILING 0x08 + #define DRM_VC4_GET_TILING 0x09 ++#define DRM_VC4_LABEL_BO 0x0a + + #define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) + #define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) +@@ -51,6 +52,7 @@ extern "C" { + #define DRM_IOCTL_VC4_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_PARAM, struct drm_vc4_get_param) + #define DRM_IOCTL_VC4_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SET_TILING, struct drm_vc4_set_tiling) + #define DRM_IOCTL_VC4_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_TILING, struct drm_vc4_get_tiling) ++#define DRM_IOCTL_VC4_LABEL_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_LABEL_BO, struct drm_vc4_label_bo) + + struct drm_vc4_submit_rcl_surface { + __u32 hindex; /* Handle index, or ~0 if not present. */ +@@ -311,6 +313,15 @@ struct drm_vc4_set_tiling { + __u64 modifier; + }; + ++/** ++ * struct drm_vc4_label_bo - Attach a name to a BO for debug purposes. ++ */ ++struct drm_vc4_label_bo { ++ __u32 handle; ++ __u32 len; ++ __u64 name; ++}; ++ + #if defined(__cplusplus) + } + #endif + +From 0de7e84aa87f8690ddde6e720b1c1d9134c83b78 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Tue, 25 Jul 2017 11:27:18 -0700 +Subject: [PATCH 376/407] drm/vc4: Convert more lock requirement comments to + lockdep assertions. + +Since I do my development with lockdep on, this will help make sure I +don't introduce bugs here. + +Signed-off-by: Eric Anholt +Link: https://patchwork.freedesktop.org/patch/msgid/20170725182718.31468-3-eric@anholt.net +Reviewed-by: Daniel Vetter +(cherry picked from commit 4e6b1e91253ebf701b4ec3586cba5596527a4d0a) +--- + drivers/gpu/drm/vc4/vc4_bo.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c +index 42dd21a736bd6c9f8cba84a0dc21d46751efb976..3e89326033d7fe4d53ada276ec6fd4f82ba663cf 100644 +--- a/drivers/gpu/drm/vc4/vc4_bo.c ++++ b/drivers/gpu/drm/vc4/vc4_bo.c +@@ -160,10 +160,12 @@ static uint32_t bo_page_index(size_t size) + return (size / PAGE_SIZE) - 1; + } + +-/* Must be called with bo_lock held. */ + static void vc4_bo_destroy(struct vc4_bo *bo) + { + struct drm_gem_object *obj = &bo->base.base; ++ struct vc4_dev *vc4 = to_vc4_dev(obj->dev); ++ ++ lockdep_assert_held(&vc4->bo_lock); + + vc4_bo_set_label(obj, -1); + +@@ -176,9 +178,11 @@ static void vc4_bo_destroy(struct vc4_bo *bo) + drm_gem_cma_free_object(obj); + } + +-/* Must be called with bo_lock held. */ + static void vc4_bo_remove_from_cache(struct vc4_bo *bo) + { ++ struct vc4_dev *vc4 = to_vc4_dev(bo->base.base.dev); ++ ++ lockdep_assert_held(&vc4->bo_lock); + list_del(&bo->unref_head); + list_del(&bo->size_head); + } +@@ -358,12 +362,13 @@ int vc4_dumb_create(struct drm_file *file_priv, + return ret; + } + +-/* Must be called with bo_lock held. */ + static void vc4_bo_cache_free_old(struct drm_device *dev) + { + struct vc4_dev *vc4 = to_vc4_dev(dev); + unsigned long expire_time = jiffies - msecs_to_jiffies(1000); + ++ lockdep_assert_held(&vc4->bo_lock); ++ + while (!list_empty(&vc4->bo_cache.time_list)) { + struct vc4_bo *bo = list_last_entry(&vc4->bo_cache.time_list, + struct vc4_bo, unref_head); + +From d6d968c774a7d93609731f8bba39a13b2139aae5 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Tue, 27 Jun 2017 12:58:32 -0700 +Subject: [PATCH 377/407] drm/vc4: Fix DSI T_INIT timing. + +The DPHY spec requires a much larger T_INIT than I was specifying +before. In the absence of clear specs from the slave of what their +timing is, just use the value that the firmware was using. + +Signed-off-by: Eric Anholt +Link: http://patchwork.freedesktop.org/patch/msgid/20170627195839.3338-2-eric@anholt.net +Reviewed-by: Andrzej Hajda +(cherry picked from commit e65d51126f89a0d67ee6c5df58363730b1410ab5) +--- + drivers/gpu/drm/vc4/vc4_dsi.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c +index 284f486ed9dbf44ff706cce7d111965fb82fab11..5dcd03724c4ae53ae45513903db5036438f4dffa 100644 +--- a/drivers/gpu/drm/vc4/vc4_dsi.c ++++ b/drivers/gpu/drm/vc4/vc4_dsi.c +@@ -1102,7 +1102,17 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder) + DSI_HS_DLT4_TRAIL) | + VC4_SET_FIELD(0, DSI_HS_DLT4_ANLAT)); + +- DSI_PORT_WRITE(HS_DLT5, VC4_SET_FIELD(dsi_hs_timing(ui_ns, 1000, 5000), ++ /* T_INIT is how long STOP is driven after power-up to ++ * indicate to the slave (also coming out of power-up) that ++ * master init is complete, and should be greater than the ++ * maximum of two value: T_INIT,MASTER and T_INIT,SLAVE. The ++ * D-PHY spec gives a minimum 100us for T_INIT,MASTER and ++ * T_INIT,SLAVE, while allowing protocols on top of it to give ++ * greater minimums. The vc4 firmware uses an extremely ++ * conservative 5ms, and we maintain that here. ++ */ ++ DSI_PORT_WRITE(HS_DLT5, VC4_SET_FIELD(dsi_hs_timing(ui_ns, ++ 5 * 1000 * 1000, 0), + DSI_HS_DLT5_INIT)); + + DSI_PORT_WRITE(HS_DLT6, + +From f83778f202a5ccc53796561e283c6f9faebdeb56 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Tue, 27 Jun 2017 12:58:33 -0700 +Subject: [PATCH 378/407] drm/vc4: Fix misleading name of the continuous flag. + +The logic was all right in the end, the name was just backwards. + +Signed-off-by: Eric Anholt +Link: http://patchwork.freedesktop.org/patch/msgid/20170627195839.3338-3-eric@anholt.net +Reviewed-by: Andrzej Hajda +(cherry picked from commit ec878c0756a0c202e86256dca1de307ab1189ab8) +--- + drivers/gpu/drm/vc4/vc4_dsi.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c +index 5dcd03724c4ae53ae45513903db5036438f4dffa..c39dcf302c16ee53ae0cfb1d17d307d24f08aaf1 100644 +--- a/drivers/gpu/drm/vc4/vc4_dsi.c ++++ b/drivers/gpu/drm/vc4/vc4_dsi.c +@@ -828,18 +828,18 @@ static void vc4_dsi_latch_ulps(struct vc4_dsi *dsi, bool latch) + /* Enters or exits Ultra Low Power State. */ + static void vc4_dsi_ulps(struct vc4_dsi *dsi, bool ulps) + { +- bool continuous = dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS; +- u32 phyc_ulps = ((continuous ? DSI_PORT_BIT(PHYC_CLANE_ULPS) : 0) | ++ bool non_continuous = dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS; ++ u32 phyc_ulps = ((non_continuous ? DSI_PORT_BIT(PHYC_CLANE_ULPS) : 0) | + DSI_PHYC_DLANE0_ULPS | + (dsi->lanes > 1 ? DSI_PHYC_DLANE1_ULPS : 0) | + (dsi->lanes > 2 ? DSI_PHYC_DLANE2_ULPS : 0) | + (dsi->lanes > 3 ? DSI_PHYC_DLANE3_ULPS : 0)); +- u32 stat_ulps = ((continuous ? DSI1_STAT_PHY_CLOCK_ULPS : 0) | ++ u32 stat_ulps = ((non_continuous ? DSI1_STAT_PHY_CLOCK_ULPS : 0) | + DSI1_STAT_PHY_D0_ULPS | + (dsi->lanes > 1 ? DSI1_STAT_PHY_D1_ULPS : 0) | + (dsi->lanes > 2 ? DSI1_STAT_PHY_D2_ULPS : 0) | + (dsi->lanes > 3 ? DSI1_STAT_PHY_D3_ULPS : 0)); +- u32 stat_stop = ((continuous ? DSI1_STAT_PHY_CLOCK_STOP : 0) | ++ u32 stat_stop = ((non_continuous ? DSI1_STAT_PHY_CLOCK_STOP : 0) | + DSI1_STAT_PHY_D0_STOP | + (dsi->lanes > 1 ? DSI1_STAT_PHY_D1_STOP : 0) | + (dsi->lanes > 2 ? DSI1_STAT_PHY_D2_STOP : 0) | + +From ffd4688d1f19d5e9aad08d8254d3d14a99b73ce1 Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Tue, 11 Apr 2017 18:39:25 +0200 +Subject: [PATCH 379/407] drm/vc4: Add runtime PM support to the HDMI encoder + driver + +The HDMI driver is currently enabling all clocks at probe time and +keeps the power-domain connected to the HDMI encoder enabled. + +Move all activation code to vc4_hdmi_encoder_enable() and make sure +the clks and power domain are released when the HDMI encoder is not used +by adding deactivation steps in vc4_hdmi_encoder_disable(). + +Note that the sequencing imposed by the IP requires that we move +vc4_hdmi_encoder_mode_set() code into vc4_hdmi_encoder_enable(). + +Signed-off-by: Boris Brezillon +Signed-off-by: Eric Anholt +Reviewed-by: Eric Anholt +(cherry picked from commit 4f6e3d66ac522dec9733d433ad00e8e77747c372) +--- + drivers/gpu/drm/vc4/vc4_hdmi.c | 174 ++++++++++++++++++++++------------------- + 1 file changed, 92 insertions(+), 82 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c +index 8db1016cad929438f30ea44c6974dcb340b74596..d299fb40b847db59a2af7d07848b6563f14ffb2d 100644 +--- a/drivers/gpu/drm/vc4/vc4_hdmi.c ++++ b/drivers/gpu/drm/vc4/vc4_hdmi.c +@@ -34,6 +34,7 @@ + #include "linux/of_address.h" + #include "linux/of_gpio.h" + #include "linux/of_platform.h" ++#include "linux/pm_runtime.h" + #include "linux/rational.h" + #include "sound/dmaengine_pcm.h" + #include "sound/pcm_drm_eld.h" +@@ -436,13 +437,38 @@ static void vc4_hdmi_set_infoframes(struct drm_encoder *encoder) + vc4_hdmi_set_spd_infoframe(encoder); + } + +-static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder, +- struct drm_display_mode *unadjusted_mode, +- struct drm_display_mode *mode) ++static void vc4_hdmi_encoder_disable(struct drm_encoder *encoder) ++{ ++ struct drm_device *dev = encoder->dev; ++ struct vc4_dev *vc4 = to_vc4_dev(dev); ++ struct vc4_hdmi *hdmi = vc4->hdmi; ++ int ret; ++ ++ HDMI_WRITE(VC4_HDMI_RAM_PACKET_CONFIG, 0); ++ ++ HDMI_WRITE(VC4_HDMI_TX_PHY_RESET_CTL, 0xf << 16); ++ HD_WRITE(VC4_HD_VID_CTL, ++ HD_READ(VC4_HD_VID_CTL) & ~VC4_HD_VID_CTL_ENABLE); ++ ++ HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST); ++ udelay(1); ++ HD_WRITE(VC4_HD_M_CTL, 0); ++ ++ clk_disable_unprepare(hdmi->hsm_clock); ++ clk_disable_unprepare(hdmi->pixel_clock); ++ ++ ret = pm_runtime_put(&hdmi->pdev->dev); ++ if (ret < 0) ++ DRM_ERROR("Failed to release power domain: %d\n", ret); ++} ++ ++static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) + { ++ struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; + struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder); + struct drm_device *dev = encoder->dev; + struct vc4_dev *vc4 = to_vc4_dev(dev); ++ struct vc4_hdmi *hdmi = vc4->hdmi; + bool debug_dump_regs = false; + bool hsync_pos = mode->flags & DRM_MODE_FLAG_PHSYNC; + bool vsync_pos = mode->flags & DRM_MODE_FLAG_PVSYNC; +@@ -462,6 +488,64 @@ static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder, + interlaced, + VC4_HDMI_VERTB_VBP)); + u32 csc_ctl; ++ int ret; ++ ++ ret = pm_runtime_get_sync(&hdmi->pdev->dev); ++ if (ret < 0) { ++ DRM_ERROR("Failed to retain power domain: %d\n", ret); ++ return; ++ } ++ ++ /* This is the rate that is set by the firmware. The number ++ * needs to be a bit higher than the pixel clock rate ++ * (generally 148.5Mhz). ++ */ ++ ret = clk_set_rate(hdmi->hsm_clock, 163682864); ++ if (ret) { ++ DRM_ERROR("Failed to set HSM clock rate: %d\n", ret); ++ return; ++ } ++ ++ ret = clk_set_rate(hdmi->pixel_clock, ++ mode->clock * 1000 * ++ ((mode->flags & DRM_MODE_FLAG_DBLCLK) ? 2 : 1)); ++ if (ret) { ++ DRM_ERROR("Failed to set pixel clock rate: %d\n", ret); ++ return; ++ } ++ ++ ret = clk_prepare_enable(hdmi->pixel_clock); ++ if (ret) { ++ DRM_ERROR("Failed to turn on pixel clock: %d\n", ret); ++ return; ++ } ++ ++ ret = clk_prepare_enable(hdmi->hsm_clock); ++ if (ret) { ++ DRM_ERROR("Failed to turn on HDMI state machine clock: %d\n", ++ ret); ++ clk_disable_unprepare(hdmi->pixel_clock); ++ return; ++ } ++ ++ HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST); ++ udelay(1); ++ HD_WRITE(VC4_HD_M_CTL, 0); ++ ++ HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_ENABLE); ++ ++ HDMI_WRITE(VC4_HDMI_SW_RESET_CONTROL, ++ VC4_HDMI_SW_RESET_HDMI | ++ VC4_HDMI_SW_RESET_FORMAT_DETECT); ++ ++ HDMI_WRITE(VC4_HDMI_SW_RESET_CONTROL, 0); ++ ++ /* PHY should be in reset, like ++ * vc4_hdmi_encoder_disable() does. ++ */ ++ HDMI_WRITE(VC4_HDMI_TX_PHY_RESET_CTL, 0xf << 16); ++ ++ HDMI_WRITE(VC4_HDMI_TX_PHY_RESET_CTL, 0); + + if (debug_dump_regs) { + DRM_INFO("HDMI regs before:\n"); +@@ -470,9 +554,6 @@ static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder, + + HD_WRITE(VC4_HD_VID_CTL, 0); + +- clk_set_rate(vc4->hdmi->pixel_clock, mode->clock * 1000 * +- ((mode->flags & DRM_MODE_FLAG_DBLCLK) ? 2 : 1)); +- + HDMI_WRITE(VC4_HDMI_SCHEDULER_CONTROL, + HDMI_READ(VC4_HDMI_SCHEDULER_CONTROL) | + VC4_HDMI_SCHEDULER_CONTROL_MANUAL_FORMAT | +@@ -544,28 +625,6 @@ static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder, + DRM_INFO("HDMI regs after:\n"); + vc4_hdmi_dump_regs(dev); + } +-} +- +-static void vc4_hdmi_encoder_disable(struct drm_encoder *encoder) +-{ +- struct drm_device *dev = encoder->dev; +- struct vc4_dev *vc4 = to_vc4_dev(dev); +- +- HDMI_WRITE(VC4_HDMI_RAM_PACKET_CONFIG, 0); +- +- HDMI_WRITE(VC4_HDMI_TX_PHY_RESET_CTL, 0xf << 16); +- HD_WRITE(VC4_HD_VID_CTL, +- HD_READ(VC4_HD_VID_CTL) & ~VC4_HD_VID_CTL_ENABLE); +-} +- +-static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) +-{ +- struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder); +- struct drm_device *dev = encoder->dev; +- struct vc4_dev *vc4 = to_vc4_dev(dev); +- int ret; +- +- HDMI_WRITE(VC4_HDMI_TX_PHY_RESET_CTL, 0); + + HD_WRITE(VC4_HD_VID_CTL, + HD_READ(VC4_HD_VID_CTL) | +@@ -631,7 +690,6 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) + } + + static const struct drm_encoder_helper_funcs vc4_hdmi_encoder_helper_funcs = { +- .mode_set = vc4_hdmi_encoder_mode_set, + .disable = vc4_hdmi_encoder_disable, + .enable = vc4_hdmi_encoder_enable, + }; +@@ -1132,33 +1190,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) + return -EPROBE_DEFER; + } + +- /* Enable the clocks at startup. We can't quite recover from +- * turning off the pixel clock during disable/enables yet, so +- * it's always running. +- */ +- ret = clk_prepare_enable(hdmi->pixel_clock); +- if (ret) { +- DRM_ERROR("Failed to turn on pixel clock: %d\n", ret); +- goto err_put_i2c; +- } +- +- /* This is the rate that is set by the firmware. The number +- * needs to be a bit higher than the pixel clock rate +- * (generally 148.5Mhz). +- */ +- ret = clk_set_rate(hdmi->hsm_clock, 163682864); +- if (ret) { +- DRM_ERROR("Failed to set HSM clock rate: %d\n", ret); +- goto err_unprepare_pix; +- } +- +- ret = clk_prepare_enable(hdmi->hsm_clock); +- if (ret) { +- DRM_ERROR("Failed to turn on HDMI state machine clock: %d\n", +- ret); +- goto err_unprepare_pix; +- } +- + /* Only use the GPIO HPD pin if present in the DT, otherwise + * we'll use the HDMI core's register. + */ +@@ -1170,7 +1201,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) + &hpd_gpio_flags); + if (hdmi->hpd_gpio < 0) { + ret = hdmi->hpd_gpio; +- goto err_unprepare_hsm; ++ goto err_put_i2c; + } + + hdmi->hpd_active_low = hpd_gpio_flags & OF_GPIO_ACTIVE_LOW; +@@ -1178,25 +1209,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) + + vc4->hdmi = hdmi; + +- /* HDMI core must be enabled. */ +- if (!(HD_READ(VC4_HD_M_CTL) & VC4_HD_M_ENABLE)) { +- HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST); +- udelay(1); +- HD_WRITE(VC4_HD_M_CTL, 0); +- +- HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_ENABLE); +- +- HDMI_WRITE(VC4_HDMI_SW_RESET_CONTROL, +- VC4_HDMI_SW_RESET_HDMI | +- VC4_HDMI_SW_RESET_FORMAT_DETECT); +- +- HDMI_WRITE(VC4_HDMI_SW_RESET_CONTROL, 0); +- +- /* PHY should be in reset, like +- * vc4_hdmi_encoder_disable() does. +- */ +- HDMI_WRITE(VC4_HDMI_TX_PHY_RESET_CTL, 0xf << 16); +- } ++ pm_runtime_enable(dev); + + drm_encoder_init(drm, hdmi->encoder, &vc4_hdmi_encoder_funcs, + DRM_MODE_ENCODER_TMDS, NULL); +@@ -1216,10 +1229,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) + + err_destroy_encoder: + vc4_hdmi_encoder_destroy(hdmi->encoder); +-err_unprepare_hsm: +- clk_disable_unprepare(hdmi->hsm_clock); +-err_unprepare_pix: +- clk_disable_unprepare(hdmi->pixel_clock); ++ pm_runtime_disable(dev); + err_put_i2c: + put_device(&hdmi->ddc->dev); + +@@ -1238,8 +1248,8 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master, + vc4_hdmi_connector_destroy(hdmi->connector); + vc4_hdmi_encoder_destroy(hdmi->encoder); + +- clk_disable_unprepare(hdmi->pixel_clock); +- clk_disable_unprepare(hdmi->hsm_clock); ++ pm_runtime_disable(dev); ++ + put_device(&hdmi->ddc->dev); + + vc4->hdmi = NULL; + +From 1e19cd5a4ffde27b60197b0c2d432589acb4c841 Mon Sep 17 00:00:00 2001 +From: Hans Verkuil +Date: Sun, 16 Jul 2017 12:48:03 +0200 +Subject: [PATCH 380/407] drm/vc4: prepare for CEC support + +In order to support CEC the hsm clock needs to be enabled in +vc4_hdmi_bind(), not in vc4_hdmi_encoder_enable(). Otherwise you wouldn't +be able to support CEC when there is no hotplug detect signal, which is +required by some monitors that turn off the HPD when in standby, but keep +the CEC bus alive so they can be woken up. + +The HDMI core also has to be enabled in vc4_hdmi_bind() for the same +reason. + +Signed-off-by: Hans Verkuil +Signed-off-by: Eric Anholt +Reviewed-by: Eric Anholt +Link: https://patchwork.freedesktop.org/patch/msgid/20170716104804.48308-3-hverkuil@xs4all.nl +(cherry picked from commit 10ee275cb12f884ce09bed69ea387eae73d7fece) +--- + drivers/gpu/drm/vc4/vc4_hdmi.c | 59 +++++++++++++++++++++--------------------- + 1 file changed, 29 insertions(+), 30 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c +index d299fb40b847db59a2af7d07848b6563f14ffb2d..aa4b900a583cbbe6a5f10dd2c2f7f5bd531a2524 100644 +--- a/drivers/gpu/drm/vc4/vc4_hdmi.c ++++ b/drivers/gpu/drm/vc4/vc4_hdmi.c +@@ -450,11 +450,6 @@ static void vc4_hdmi_encoder_disable(struct drm_encoder *encoder) + HD_WRITE(VC4_HD_VID_CTL, + HD_READ(VC4_HD_VID_CTL) & ~VC4_HD_VID_CTL_ENABLE); + +- HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST); +- udelay(1); +- HD_WRITE(VC4_HD_M_CTL, 0); +- +- clk_disable_unprepare(hdmi->hsm_clock); + clk_disable_unprepare(hdmi->pixel_clock); + + ret = pm_runtime_put(&hdmi->pdev->dev); +@@ -496,16 +491,6 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) + return; + } + +- /* This is the rate that is set by the firmware. The number +- * needs to be a bit higher than the pixel clock rate +- * (generally 148.5Mhz). +- */ +- ret = clk_set_rate(hdmi->hsm_clock, 163682864); +- if (ret) { +- DRM_ERROR("Failed to set HSM clock rate: %d\n", ret); +- return; +- } +- + ret = clk_set_rate(hdmi->pixel_clock, + mode->clock * 1000 * + ((mode->flags & DRM_MODE_FLAG_DBLCLK) ? 2 : 1)); +@@ -520,20 +505,6 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) + return; + } + +- ret = clk_prepare_enable(hdmi->hsm_clock); +- if (ret) { +- DRM_ERROR("Failed to turn on HDMI state machine clock: %d\n", +- ret); +- clk_disable_unprepare(hdmi->pixel_clock); +- return; +- } +- +- HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST); +- udelay(1); +- HD_WRITE(VC4_HD_M_CTL, 0); +- +- HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_ENABLE); +- + HDMI_WRITE(VC4_HDMI_SW_RESET_CONTROL, + VC4_HDMI_SW_RESET_HDMI | + VC4_HDMI_SW_RESET_FORMAT_DETECT); +@@ -1190,6 +1161,23 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) + return -EPROBE_DEFER; + } + ++ /* This is the rate that is set by the firmware. The number ++ * needs to be a bit higher than the pixel clock rate ++ * (generally 148.5Mhz). ++ */ ++ ret = clk_set_rate(hdmi->hsm_clock, 163682864); ++ if (ret) { ++ DRM_ERROR("Failed to set HSM clock rate: %d\n", ret); ++ goto err_put_i2c; ++ } ++ ++ ret = clk_prepare_enable(hdmi->hsm_clock); ++ if (ret) { ++ DRM_ERROR("Failed to turn on HDMI state machine clock: %d\n", ++ ret); ++ goto err_put_i2c; ++ } ++ + /* Only use the GPIO HPD pin if present in the DT, otherwise + * we'll use the HDMI core's register. + */ +@@ -1201,7 +1189,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) + &hpd_gpio_flags); + if (hdmi->hpd_gpio < 0) { + ret = hdmi->hpd_gpio; +- goto err_put_i2c; ++ goto err_unprepare_hsm; + } + + hdmi->hpd_active_low = hpd_gpio_flags & OF_GPIO_ACTIVE_LOW; +@@ -1209,6 +1197,14 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) + + vc4->hdmi = hdmi; + ++ /* HDMI core must be enabled. */ ++ if (!(HD_READ(VC4_HD_M_CTL) & VC4_HD_M_ENABLE)) { ++ HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST); ++ udelay(1); ++ HD_WRITE(VC4_HD_M_CTL, 0); ++ ++ HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_ENABLE); ++ } + pm_runtime_enable(dev); + + drm_encoder_init(drm, hdmi->encoder, &vc4_hdmi_encoder_funcs, +@@ -1229,6 +1225,8 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) + + err_destroy_encoder: + vc4_hdmi_encoder_destroy(hdmi->encoder); ++err_unprepare_hsm: ++ clk_disable_unprepare(hdmi->hsm_clock); + pm_runtime_disable(dev); + err_put_i2c: + put_device(&hdmi->ddc->dev); +@@ -1248,6 +1246,7 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master, + vc4_hdmi_connector_destroy(hdmi->connector); + vc4_hdmi_encoder_destroy(hdmi->encoder); + ++ clk_disable_unprepare(hdmi->hsm_clock); + pm_runtime_disable(dev); + + put_device(&hdmi->ddc->dev); + +From 07e81b8c2b2e2c8b948cc6902433d07c2726a943 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Fri, 14 Jul 2017 17:33:08 -0700 +Subject: [PATCH 381/407] drm/vc4: Fix pitch setup for T-format scanout. + +The documentation said to use src_w here, and I didn't consider that +we actually needed to be using pitch somewhere in our setup. Fixes +scanout on my DSI panel when X11 does initial setup with 1920x1080 +HDMI and 800x480 DSI both at 0,0 of the same framebuffer. + +Signed-off-by: Eric Anholt +Fixes: 98830d91da08 ("drm/vc4: Add T-format scanout support.") +--- + drivers/gpu/drm/vc4/vc4_plane.c | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c +index 62c5f7df0f1a0034bf0b5630eba1344a0f85897b..8931d3f649f849ec755422360dd6188b0a9ffaa5 100644 +--- a/drivers/gpu/drm/vc4/vc4_plane.c ++++ b/drivers/gpu/drm/vc4/vc4_plane.c +@@ -547,14 +547,24 @@ static int vc4_plane_mode_set(struct drm_plane *plane, + tiling = SCALER_CTL0_TILING_LINEAR; + pitch0 = VC4_SET_FIELD(fb->pitches[0], SCALER_SRC_PITCH); + break; +- case DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED: ++ ++ case DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED: { ++ /* For T-tiled, the FB pitch is "how many bytes from ++ * one row to the next, such that pitch * tile_h == ++ * tile_size * tiles_per_row." ++ */ ++ u32 tile_size_shift = 12; ++ u32 tile_h_shift = 5; ++ u32 tiles_w = fb->pitches[0] >> (tile_size_shift - tile_h_shift); ++ + tiling = SCALER_CTL0_TILING_256B_OR_T; + +- pitch0 = (VC4_SET_FIELD(0, SCALER_PITCH0_TILE_Y_OFFSET), +- VC4_SET_FIELD(0, SCALER_PITCH0_TILE_WIDTH_L), +- VC4_SET_FIELD((vc4_state->src_w[0] + 31) >> 5, +- SCALER_PITCH0_TILE_WIDTH_R)); ++ pitch0 = (VC4_SET_FIELD(0, SCALER_PITCH0_TILE_Y_OFFSET) | ++ VC4_SET_FIELD(0, SCALER_PITCH0_TILE_WIDTH_L) | ++ VC4_SET_FIELD(tiles_w, SCALER_PITCH0_TILE_WIDTH_R)); + break; ++ } ++ + default: + DRM_DEBUG_KMS("Unsupported FB tiling flag 0x%16llx", + (long long)fb->modifier[0]); + +From 152e45fd402dae8ea50b14646a5b309ed786a816 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Mon, 24 Jul 2017 14:34:55 -0700 +Subject: [PATCH 382/407] drm/vc4: Demote user-accessible DRM_ERROR paths to + DRM_DEBUG. + +Userspace shouldn't be able to spam dmesg by passing bad arguments. +This has particularly become an issues since we started using a bad +argument to set_tiling to detect if set_tiling was supported. + +Signed-off-by: Eric Anholt +Fixes: 83753117f1de ("drm/vc4: Add get/set tiling ioctls.") +--- + drivers/gpu/drm/vc4/vc4_bo.c | 14 +++--- + drivers/gpu/drm/vc4/vc4_gem.c | 10 ++-- + drivers/gpu/drm/vc4/vc4_kms.c | 2 +- + drivers/gpu/drm/vc4/vc4_render_cl.c | 40 +++++++-------- + drivers/gpu/drm/vc4/vc4_validate.c | 79 +++++++++++++++--------------- + drivers/gpu/drm/vc4/vc4_validate_shaders.c | 72 +++++++++++++-------------- + 6 files changed, 109 insertions(+), 108 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c +index 3e89326033d7fe4d53ada276ec6fd4f82ba663cf..e7428184353cccee96135cc3246a8582edeb2c1b 100644 +--- a/drivers/gpu/drm/vc4/vc4_bo.c ++++ b/drivers/gpu/drm/vc4/vc4_bo.c +@@ -465,7 +465,7 @@ vc4_prime_export(struct drm_device *dev, struct drm_gem_object *obj, int flags) + struct vc4_bo *bo = to_vc4_bo(obj); + + if (bo->validated_shader) { +- DRM_ERROR("Attempting to export shader BO\n"); ++ DRM_DEBUG("Attempting to export shader BO\n"); + return ERR_PTR(-EINVAL); + } + +@@ -486,7 +486,7 @@ int vc4_mmap(struct file *filp, struct vm_area_struct *vma) + bo = to_vc4_bo(gem_obj); + + if (bo->validated_shader && (vma->vm_flags & VM_WRITE)) { +- DRM_ERROR("mmaping of shader BOs for writing not allowed.\n"); ++ DRM_DEBUG("mmaping of shader BOs for writing not allowed.\n"); + return -EINVAL; + } + +@@ -511,7 +511,7 @@ int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) + struct vc4_bo *bo = to_vc4_bo(obj); + + if (bo->validated_shader && (vma->vm_flags & VM_WRITE)) { +- DRM_ERROR("mmaping of shader BOs for writing not allowed.\n"); ++ DRM_DEBUG("mmaping of shader BOs for writing not allowed.\n"); + return -EINVAL; + } + +@@ -523,7 +523,7 @@ void *vc4_prime_vmap(struct drm_gem_object *obj) + struct vc4_bo *bo = to_vc4_bo(obj); + + if (bo->validated_shader) { +- DRM_ERROR("mmaping of shader BOs not allowed.\n"); ++ DRM_DEBUG("mmaping of shader BOs not allowed.\n"); + return ERR_PTR(-EINVAL); + } + +@@ -559,7 +559,7 @@ int vc4_mmap_bo_ioctl(struct drm_device *dev, void *data, + + gem_obj = drm_gem_object_lookup(file_priv, args->handle); + if (!gem_obj) { +- DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); ++ DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); + return -EINVAL; + } + +@@ -663,7 +663,7 @@ int vc4_set_tiling_ioctl(struct drm_device *dev, void *data, + + gem_obj = drm_gem_object_lookup(file_priv, args->handle); + if (!gem_obj) { +- DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); ++ DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); + return -ENOENT; + } + bo = to_vc4_bo(gem_obj); +@@ -695,7 +695,7 @@ int vc4_get_tiling_ioctl(struct drm_device *dev, void *data, + + gem_obj = drm_gem_object_lookup(file_priv, args->handle); + if (!gem_obj) { +- DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); ++ DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); + return -ENOENT; + } + bo = to_vc4_bo(gem_obj); +diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c +index adb94d573a1881062ac0dee42a627746faea8657..32e17b384fbc491e204b91f663a8485b6d79e948 100644 +--- a/drivers/gpu/drm/vc4/vc4_gem.c ++++ b/drivers/gpu/drm/vc4/vc4_gem.c +@@ -531,7 +531,7 @@ vc4_cl_lookup_bos(struct drm_device *dev, + /* See comment on bo_index for why we have to check + * this. + */ +- DRM_ERROR("Rendering requires BOs to validate\n"); ++ DRM_DEBUG("Rendering requires BOs to validate\n"); + return -EINVAL; + } + +@@ -561,7 +561,7 @@ vc4_cl_lookup_bos(struct drm_device *dev, + struct drm_gem_object *bo = idr_find(&file_priv->object_idr, + handles[i]); + if (!bo) { +- DRM_ERROR("Failed to look up GEM BO %d: %d\n", ++ DRM_DEBUG("Failed to look up GEM BO %d: %d\n", + i, handles[i]); + ret = -EINVAL; + spin_unlock(&file_priv->table_lock); +@@ -599,7 +599,7 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) + args->shader_rec_count >= (UINT_MAX / + sizeof(struct vc4_shader_state)) || + temp_size < exec_size) { +- DRM_ERROR("overflow in exec arguments\n"); ++ DRM_DEBUG("overflow in exec arguments\n"); + ret = -EINVAL; + goto fail; + } +@@ -838,7 +838,7 @@ vc4_wait_bo_ioctl(struct drm_device *dev, void *data, + + gem_obj = drm_gem_object_lookup(file_priv, args->handle); + if (!gem_obj) { +- DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); ++ DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); + return -EINVAL; + } + bo = to_vc4_bo(gem_obj); +@@ -865,7 +865,7 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, + int ret = 0; + + if ((args->flags & ~VC4_SUBMIT_CL_USE_CLEAR_COLOR) != 0) { +- DRM_ERROR("Unknown flags: 0x%02x\n", args->flags); ++ DRM_DEBUG("Unknown flags: 0x%02x\n", args->flags); + return -EINVAL; + } + +diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c +index 78080c3e966cacf4756d58d34069c3fb0bafdd87..3ccdd54f32628064bcc25e226f08fd33646246c4 100644 +--- a/drivers/gpu/drm/vc4/vc4_kms.c ++++ b/drivers/gpu/drm/vc4/vc4_kms.c +@@ -216,7 +216,7 @@ static struct drm_framebuffer *vc4_fb_create(struct drm_device *dev, + + gem_obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[0]); + if (!gem_obj) { +- DRM_ERROR("Failed to look up GEM BO %d\n", ++ DRM_DEBUG("Failed to look up GEM BO %d\n", + mode_cmd->handles[0]); + return ERR_PTR(-ENOENT); + +diff --git a/drivers/gpu/drm/vc4/vc4_render_cl.c b/drivers/gpu/drm/vc4/vc4_render_cl.c +index eb2794b12efe43dea0408fe772e8426628ae849f..43f8e6f7feff62d53a91070d97a38204a7152265 100644 +--- a/drivers/gpu/drm/vc4/vc4_render_cl.c ++++ b/drivers/gpu/drm/vc4/vc4_render_cl.c +@@ -374,14 +374,14 @@ static int vc4_full_res_bounds_check(struct vc4_exec_info *exec, + u32 render_tiles_stride = DIV_ROUND_UP(exec->args->width, 32); + + if (surf->offset > obj->base.size) { +- DRM_ERROR("surface offset %d > BO size %zd\n", ++ DRM_DEBUG("surface offset %d > BO size %zd\n", + surf->offset, obj->base.size); + return -EINVAL; + } + + if ((obj->base.size - surf->offset) / VC4_TILE_BUFFER_SIZE < + render_tiles_stride * args->max_y_tile + args->max_x_tile) { +- DRM_ERROR("MSAA tile %d, %d out of bounds " ++ DRM_DEBUG("MSAA tile %d, %d out of bounds " + "(bo size %zd, offset %d).\n", + args->max_x_tile, args->max_y_tile, + obj->base.size, +@@ -397,7 +397,7 @@ static int vc4_rcl_msaa_surface_setup(struct vc4_exec_info *exec, + struct drm_vc4_submit_rcl_surface *surf) + { + if (surf->flags != 0 || surf->bits != 0) { +- DRM_ERROR("MSAA surface had nonzero flags/bits\n"); ++ DRM_DEBUG("MSAA surface had nonzero flags/bits\n"); + return -EINVAL; + } + +@@ -411,7 +411,7 @@ static int vc4_rcl_msaa_surface_setup(struct vc4_exec_info *exec, + exec->rcl_write_bo[exec->rcl_write_bo_count++] = *obj; + + if (surf->offset & 0xf) { +- DRM_ERROR("MSAA write must be 16b aligned.\n"); ++ DRM_DEBUG("MSAA write must be 16b aligned.\n"); + return -EINVAL; + } + +@@ -433,7 +433,7 @@ static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, + int ret; + + if (surf->flags & ~VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { +- DRM_ERROR("Extra flags set\n"); ++ DRM_DEBUG("Extra flags set\n"); + return -EINVAL; + } + +@@ -449,12 +449,12 @@ static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, + + if (surf->flags & VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { + if (surf == &exec->args->zs_write) { +- DRM_ERROR("general zs write may not be a full-res.\n"); ++ DRM_DEBUG("general zs write may not be a full-res.\n"); + return -EINVAL; + } + + if (surf->bits != 0) { +- DRM_ERROR("load/store general bits set with " ++ DRM_DEBUG("load/store general bits set with " + "full res load/store.\n"); + return -EINVAL; + } +@@ -469,19 +469,19 @@ static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, + if (surf->bits & ~(VC4_LOADSTORE_TILE_BUFFER_TILING_MASK | + VC4_LOADSTORE_TILE_BUFFER_BUFFER_MASK | + VC4_LOADSTORE_TILE_BUFFER_FORMAT_MASK)) { +- DRM_ERROR("Unknown bits in load/store: 0x%04x\n", ++ DRM_DEBUG("Unknown bits in load/store: 0x%04x\n", + surf->bits); + return -EINVAL; + } + + if (tiling > VC4_TILING_FORMAT_LT) { +- DRM_ERROR("Bad tiling format\n"); ++ DRM_DEBUG("Bad tiling format\n"); + return -EINVAL; + } + + if (buffer == VC4_LOADSTORE_TILE_BUFFER_ZS) { + if (format != 0) { +- DRM_ERROR("No color format should be set for ZS\n"); ++ DRM_DEBUG("No color format should be set for ZS\n"); + return -EINVAL; + } + cpp = 4; +@@ -495,16 +495,16 @@ static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, + cpp = 4; + break; + default: +- DRM_ERROR("Bad tile buffer format\n"); ++ DRM_DEBUG("Bad tile buffer format\n"); + return -EINVAL; + } + } else { +- DRM_ERROR("Bad load/store buffer %d.\n", buffer); ++ DRM_DEBUG("Bad load/store buffer %d.\n", buffer); + return -EINVAL; + } + + if (surf->offset & 0xf) { +- DRM_ERROR("load/store buffer must be 16b aligned.\n"); ++ DRM_DEBUG("load/store buffer must be 16b aligned.\n"); + return -EINVAL; + } + +@@ -529,7 +529,7 @@ vc4_rcl_render_config_surface_setup(struct vc4_exec_info *exec, + int cpp; + + if (surf->flags != 0) { +- DRM_ERROR("No flags supported on render config.\n"); ++ DRM_DEBUG("No flags supported on render config.\n"); + return -EINVAL; + } + +@@ -537,7 +537,7 @@ vc4_rcl_render_config_surface_setup(struct vc4_exec_info *exec, + VC4_RENDER_CONFIG_FORMAT_MASK | + VC4_RENDER_CONFIG_MS_MODE_4X | + VC4_RENDER_CONFIG_DECIMATE_MODE_4X)) { +- DRM_ERROR("Unknown bits in render config: 0x%04x\n", ++ DRM_DEBUG("Unknown bits in render config: 0x%04x\n", + surf->bits); + return -EINVAL; + } +@@ -552,7 +552,7 @@ vc4_rcl_render_config_surface_setup(struct vc4_exec_info *exec, + exec->rcl_write_bo[exec->rcl_write_bo_count++] = *obj; + + if (tiling > VC4_TILING_FORMAT_LT) { +- DRM_ERROR("Bad tiling format\n"); ++ DRM_DEBUG("Bad tiling format\n"); + return -EINVAL; + } + +@@ -565,7 +565,7 @@ vc4_rcl_render_config_surface_setup(struct vc4_exec_info *exec, + cpp = 4; + break; + default: +- DRM_ERROR("Bad tile buffer format\n"); ++ DRM_DEBUG("Bad tile buffer format\n"); + return -EINVAL; + } + +@@ -586,7 +586,7 @@ int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec) + + if (args->min_x_tile > args->max_x_tile || + args->min_y_tile > args->max_y_tile) { +- DRM_ERROR("Bad render tile set (%d,%d)-(%d,%d)\n", ++ DRM_DEBUG("Bad render tile set (%d,%d)-(%d,%d)\n", + args->min_x_tile, args->min_y_tile, + args->max_x_tile, args->max_y_tile); + return -EINVAL; +@@ -595,7 +595,7 @@ int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec) + if (has_bin && + (args->max_x_tile > exec->bin_tiles_x || + args->max_y_tile > exec->bin_tiles_y)) { +- DRM_ERROR("Render tiles (%d,%d) outside of bin config " ++ DRM_DEBUG("Render tiles (%d,%d) outside of bin config " + "(%d,%d)\n", + args->max_x_tile, args->max_y_tile, + exec->bin_tiles_x, exec->bin_tiles_y); +@@ -638,7 +638,7 @@ int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec) + */ + if (!setup.color_write && !setup.zs_write && + !setup.msaa_color_write && !setup.msaa_zs_write) { +- DRM_ERROR("RCL requires color or Z/S write\n"); ++ DRM_DEBUG("RCL requires color or Z/S write\n"); + return -EINVAL; + } + +diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c +index 59d808e2a6cc6f3173b1309cc4f491098886cf36..35d26bc8628b0cb8aad9cf8ed29cd851b617dd77 100644 +--- a/drivers/gpu/drm/vc4/vc4_validate.c ++++ b/drivers/gpu/drm/vc4/vc4_validate.c +@@ -101,7 +101,7 @@ vc4_use_bo(struct vc4_exec_info *exec, uint32_t hindex) + struct vc4_bo *bo; + + if (hindex >= exec->bo_count) { +- DRM_ERROR("BO index %d greater than BO count %d\n", ++ DRM_DEBUG("BO index %d greater than BO count %d\n", + hindex, exec->bo_count); + return NULL; + } +@@ -109,7 +109,7 @@ vc4_use_bo(struct vc4_exec_info *exec, uint32_t hindex) + bo = to_vc4_bo(&obj->base); + + if (bo->validated_shader) { +- DRM_ERROR("Trying to use shader BO as something other than " ++ DRM_DEBUG("Trying to use shader BO as something other than " + "a shader\n"); + return NULL; + } +@@ -164,7 +164,8 @@ vc4_check_tex_size(struct vc4_exec_info *exec, struct drm_gem_cma_object *fbo, + * our math. + */ + if (width > 4096 || height > 4096) { +- DRM_ERROR("Surface dimesions (%d,%d) too large", width, height); ++ DRM_DEBUG("Surface dimensions (%d,%d) too large", ++ width, height); + return false; + } + +@@ -182,7 +183,7 @@ vc4_check_tex_size(struct vc4_exec_info *exec, struct drm_gem_cma_object *fbo, + aligned_height = round_up(height, utile_h); + break; + default: +- DRM_ERROR("buffer tiling %d unsupported\n", tiling_format); ++ DRM_DEBUG("buffer tiling %d unsupported\n", tiling_format); + return false; + } + +@@ -191,7 +192,7 @@ vc4_check_tex_size(struct vc4_exec_info *exec, struct drm_gem_cma_object *fbo, + + if (size + offset < size || + size + offset > fbo->base.size) { +- DRM_ERROR("Overflow in %dx%d (%dx%d) fbo size (%d + %d > %zd)\n", ++ DRM_DEBUG("Overflow in %dx%d (%dx%d) fbo size (%d + %d > %zd)\n", + width, height, + aligned_width, aligned_height, + size, offset, fbo->base.size); +@@ -205,7 +206,7 @@ static int + validate_flush(VALIDATE_ARGS) + { + if (!validate_bin_pos(exec, untrusted, exec->args->bin_cl_size - 1)) { +- DRM_ERROR("Bin CL must end with VC4_PACKET_FLUSH\n"); ++ DRM_DEBUG("Bin CL must end with VC4_PACKET_FLUSH\n"); + return -EINVAL; + } + exec->found_flush = true; +@@ -217,13 +218,13 @@ static int + validate_start_tile_binning(VALIDATE_ARGS) + { + if (exec->found_start_tile_binning_packet) { +- DRM_ERROR("Duplicate VC4_PACKET_START_TILE_BINNING\n"); ++ DRM_DEBUG("Duplicate VC4_PACKET_START_TILE_BINNING\n"); + return -EINVAL; + } + exec->found_start_tile_binning_packet = true; + + if (!exec->found_tile_binning_mode_config_packet) { +- DRM_ERROR("missing VC4_PACKET_TILE_BINNING_MODE_CONFIG\n"); ++ DRM_DEBUG("missing VC4_PACKET_TILE_BINNING_MODE_CONFIG\n"); + return -EINVAL; + } + +@@ -234,7 +235,7 @@ static int + validate_increment_semaphore(VALIDATE_ARGS) + { + if (!validate_bin_pos(exec, untrusted, exec->args->bin_cl_size - 2)) { +- DRM_ERROR("Bin CL must end with " ++ DRM_DEBUG("Bin CL must end with " + "VC4_PACKET_INCREMENT_SEMAPHORE\n"); + return -EINVAL; + } +@@ -255,7 +256,7 @@ validate_indexed_prim_list(VALIDATE_ARGS) + + /* Check overflow condition */ + if (exec->shader_state_count == 0) { +- DRM_ERROR("shader state must precede primitives\n"); ++ DRM_DEBUG("shader state must precede primitives\n"); + return -EINVAL; + } + shader_state = &exec->shader_state[exec->shader_state_count - 1]; +@@ -272,7 +273,7 @@ validate_indexed_prim_list(VALIDATE_ARGS) + + if (offset > ib->base.size || + (ib->base.size - offset) / index_size < length) { +- DRM_ERROR("IB access overflow (%d + %d*%d > %zd)\n", ++ DRM_DEBUG("IB access overflow (%d + %d*%d > %zd)\n", + offset, length, index_size, ib->base.size); + return -EINVAL; + } +@@ -292,13 +293,13 @@ validate_gl_array_primitive(VALIDATE_ARGS) + + /* Check overflow condition */ + if (exec->shader_state_count == 0) { +- DRM_ERROR("shader state must precede primitives\n"); ++ DRM_DEBUG("shader state must precede primitives\n"); + return -EINVAL; + } + shader_state = &exec->shader_state[exec->shader_state_count - 1]; + + if (length + base_index < length) { +- DRM_ERROR("primitive vertex count overflow\n"); ++ DRM_DEBUG("primitive vertex count overflow\n"); + return -EINVAL; + } + max_index = length + base_index - 1; +@@ -315,7 +316,7 @@ validate_gl_shader_state(VALIDATE_ARGS) + uint32_t i = exec->shader_state_count++; + + if (i >= exec->shader_state_size) { +- DRM_ERROR("More requests for shader states than declared\n"); ++ DRM_DEBUG("More requests for shader states than declared\n"); + return -EINVAL; + } + +@@ -323,7 +324,7 @@ validate_gl_shader_state(VALIDATE_ARGS) + exec->shader_state[i].max_index = 0; + + if (exec->shader_state[i].addr & ~0xf) { +- DRM_ERROR("high bits set in GL shader rec reference\n"); ++ DRM_DEBUG("high bits set in GL shader rec reference\n"); + return -EINVAL; + } + +@@ -347,7 +348,7 @@ validate_tile_binning_config(VALIDATE_ARGS) + int bin_slot; + + if (exec->found_tile_binning_mode_config_packet) { +- DRM_ERROR("Duplicate VC4_PACKET_TILE_BINNING_MODE_CONFIG\n"); ++ DRM_DEBUG("Duplicate VC4_PACKET_TILE_BINNING_MODE_CONFIG\n"); + return -EINVAL; + } + exec->found_tile_binning_mode_config_packet = true; +@@ -359,14 +360,14 @@ validate_tile_binning_config(VALIDATE_ARGS) + + if (exec->bin_tiles_x == 0 || + exec->bin_tiles_y == 0) { +- DRM_ERROR("Tile binning config of %dx%d too small\n", ++ DRM_DEBUG("Tile binning config of %dx%d too small\n", + exec->bin_tiles_x, exec->bin_tiles_y); + return -EINVAL; + } + + if (flags & (VC4_BIN_CONFIG_DB_NON_MS | + VC4_BIN_CONFIG_TILE_BUFFER_64BIT)) { +- DRM_ERROR("unsupported binning config flags 0x%02x\n", flags); ++ DRM_DEBUG("unsupported binning config flags 0x%02x\n", flags); + return -EINVAL; + } + +@@ -484,20 +485,20 @@ vc4_validate_bin_cl(struct drm_device *dev, + const struct cmd_info *info; + + if (cmd >= ARRAY_SIZE(cmd_info)) { +- DRM_ERROR("0x%08x: packet %d out of bounds\n", ++ DRM_DEBUG("0x%08x: packet %d out of bounds\n", + src_offset, cmd); + return -EINVAL; + } + + info = &cmd_info[cmd]; + if (!info->name) { +- DRM_ERROR("0x%08x: packet %d invalid\n", ++ DRM_DEBUG("0x%08x: packet %d invalid\n", + src_offset, cmd); + return -EINVAL; + } + + if (src_offset + info->len > len) { +- DRM_ERROR("0x%08x: packet %d (%s) length 0x%08x " ++ DRM_DEBUG("0x%08x: packet %d (%s) length 0x%08x " + "exceeds bounds (0x%08x)\n", + src_offset, cmd, info->name, info->len, + src_offset + len); +@@ -510,7 +511,7 @@ vc4_validate_bin_cl(struct drm_device *dev, + if (info->func && info->func(exec, + dst_pkt + 1, + src_pkt + 1)) { +- DRM_ERROR("0x%08x: packet %d (%s) failed to validate\n", ++ DRM_DEBUG("0x%08x: packet %d (%s) failed to validate\n", + src_offset, cmd, info->name); + return -EINVAL; + } +@@ -528,7 +529,7 @@ vc4_validate_bin_cl(struct drm_device *dev, + exec->ct0ea = exec->ct0ca + dst_offset; + + if (!exec->found_start_tile_binning_packet) { +- DRM_ERROR("Bin CL missing VC4_PACKET_START_TILE_BINNING\n"); ++ DRM_DEBUG("Bin CL missing VC4_PACKET_START_TILE_BINNING\n"); + return -EINVAL; + } + +@@ -540,7 +541,7 @@ vc4_validate_bin_cl(struct drm_device *dev, + * semaphore increment. + */ + if (!exec->found_increment_semaphore_packet || !exec->found_flush) { +- DRM_ERROR("Bin CL missing VC4_PACKET_INCREMENT_SEMAPHORE + " ++ DRM_DEBUG("Bin CL missing VC4_PACKET_INCREMENT_SEMAPHORE + " + "VC4_PACKET_FLUSH\n"); + return -EINVAL; + } +@@ -579,11 +580,11 @@ reloc_tex(struct vc4_exec_info *exec, + uint32_t remaining_size = tex->base.size - p0; + + if (p0 > tex->base.size - 4) { +- DRM_ERROR("UBO offset greater than UBO size\n"); ++ DRM_DEBUG("UBO offset greater than UBO size\n"); + goto fail; + } + if (p1 > remaining_size - 4) { +- DRM_ERROR("UBO clamp would allow reads " ++ DRM_DEBUG("UBO clamp would allow reads " + "outside of UBO\n"); + goto fail; + } +@@ -603,14 +604,14 @@ reloc_tex(struct vc4_exec_info *exec, + if (VC4_GET_FIELD(p3, VC4_TEX_P2_PTYPE) == + VC4_TEX_P2_PTYPE_CUBE_MAP_STRIDE) { + if (cube_map_stride) { +- DRM_ERROR("Cube map stride set twice\n"); ++ DRM_DEBUG("Cube map stride set twice\n"); + goto fail; + } + + cube_map_stride = p3 & VC4_TEX_P2_CMST_MASK; + } + if (!cube_map_stride) { +- DRM_ERROR("Cube map stride not set\n"); ++ DRM_DEBUG("Cube map stride not set\n"); + goto fail; + } + } +@@ -651,7 +652,7 @@ reloc_tex(struct vc4_exec_info *exec, + case VC4_TEXTURE_TYPE_RGBA64: + case VC4_TEXTURE_TYPE_YUV422R: + default: +- DRM_ERROR("Texture format %d unsupported\n", type); ++ DRM_DEBUG("Texture format %d unsupported\n", type); + goto fail; + } + utile_w = utile_width(cpp); +@@ -704,7 +705,7 @@ reloc_tex(struct vc4_exec_info *exec, + level_size = aligned_width * cpp * aligned_height; + + if (offset < level_size) { +- DRM_ERROR("Level %d (%dx%d -> %dx%d) size %db " ++ DRM_DEBUG("Level %d (%dx%d -> %dx%d) size %db " + "overflowed buffer bounds (offset %d)\n", + i, level_width, level_height, + aligned_width, aligned_height, +@@ -755,7 +756,7 @@ validate_gl_shader_rec(struct drm_device *dev, + + nr_relocs = ARRAY_SIZE(shader_reloc_offsets) + nr_attributes; + if (nr_relocs * 4 > exec->shader_rec_size) { +- DRM_ERROR("overflowed shader recs reading %d handles " ++ DRM_DEBUG("overflowed shader recs reading %d handles " + "from %d bytes left\n", + nr_relocs, exec->shader_rec_size); + return -EINVAL; +@@ -765,7 +766,7 @@ validate_gl_shader_rec(struct drm_device *dev, + exec->shader_rec_size -= nr_relocs * 4; + + if (packet_size > exec->shader_rec_size) { +- DRM_ERROR("overflowed shader recs copying %db packet " ++ DRM_DEBUG("overflowed shader recs copying %db packet " + "from %d bytes left\n", + packet_size, exec->shader_rec_size); + return -EINVAL; +@@ -785,7 +786,7 @@ validate_gl_shader_rec(struct drm_device *dev, + + for (i = 0; i < shader_reloc_count; i++) { + if (src_handles[i] > exec->bo_count) { +- DRM_ERROR("Shader handle %d too big\n", src_handles[i]); ++ DRM_DEBUG("Shader handle %d too big\n", src_handles[i]); + return -EINVAL; + } + +@@ -801,13 +802,13 @@ validate_gl_shader_rec(struct drm_device *dev, + + if (((*(uint16_t *)pkt_u & VC4_SHADER_FLAG_FS_SINGLE_THREAD) == 0) != + to_vc4_bo(&bo[0]->base)->validated_shader->is_threaded) { +- DRM_ERROR("Thread mode of CL and FS do not match\n"); ++ DRM_DEBUG("Thread mode of CL and FS do not match\n"); + return -EINVAL; + } + + if (to_vc4_bo(&bo[1]->base)->validated_shader->is_threaded || + to_vc4_bo(&bo[2]->base)->validated_shader->is_threaded) { +- DRM_ERROR("cs and vs cannot be threaded\n"); ++ DRM_DEBUG("cs and vs cannot be threaded\n"); + return -EINVAL; + } + +@@ -822,7 +823,7 @@ validate_gl_shader_rec(struct drm_device *dev, + *(uint32_t *)(pkt_v + o) = bo[i]->paddr + src_offset; + + if (src_offset != 0) { +- DRM_ERROR("Shaders must be at offset 0 of " ++ DRM_DEBUG("Shaders must be at offset 0 of " + "the BO.\n"); + return -EINVAL; + } +@@ -833,7 +834,7 @@ validate_gl_shader_rec(struct drm_device *dev, + + if (validated_shader->uniforms_src_size > + exec->uniforms_size) { +- DRM_ERROR("Uniforms src buffer overflow\n"); ++ DRM_DEBUG("Uniforms src buffer overflow\n"); + return -EINVAL; + } + +@@ -891,7 +892,7 @@ validate_gl_shader_rec(struct drm_device *dev, + + if (vbo->base.size < offset || + vbo->base.size - offset < attr_size) { +- DRM_ERROR("BO offset overflow (%d + %d > %zu)\n", ++ DRM_DEBUG("BO offset overflow (%d + %d > %zu)\n", + offset, attr_size, vbo->base.size); + return -EINVAL; + } +@@ -900,7 +901,7 @@ validate_gl_shader_rec(struct drm_device *dev, + max_index = ((vbo->base.size - offset - attr_size) / + stride); + if (state->max_index > max_index) { +- DRM_ERROR("primitives use index %d out of " ++ DRM_DEBUG("primitives use index %d out of " + "supplied %d\n", + state->max_index, max_index); + return -EINVAL; +diff --git a/drivers/gpu/drm/vc4/vc4_validate_shaders.c b/drivers/gpu/drm/vc4/vc4_validate_shaders.c +index 5dba13dd1e9b600b43a769d086d6eb428547ab66..433b37f9265601063eba24367de1eca89239a24c 100644 +--- a/drivers/gpu/drm/vc4/vc4_validate_shaders.c ++++ b/drivers/gpu/drm/vc4/vc4_validate_shaders.c +@@ -195,7 +195,7 @@ check_tmu_write(struct vc4_validated_shader_info *validated_shader, + uint32_t clamp_reg, clamp_offset; + + if (sig == QPU_SIG_SMALL_IMM) { +- DRM_ERROR("direct TMU read used small immediate\n"); ++ DRM_DEBUG("direct TMU read used small immediate\n"); + return false; + } + +@@ -204,7 +204,7 @@ check_tmu_write(struct vc4_validated_shader_info *validated_shader, + */ + if (is_mul || + QPU_GET_FIELD(inst, QPU_OP_ADD) != QPU_A_ADD) { +- DRM_ERROR("direct TMU load wasn't an add\n"); ++ DRM_DEBUG("direct TMU load wasn't an add\n"); + return false; + } + +@@ -215,13 +215,13 @@ check_tmu_write(struct vc4_validated_shader_info *validated_shader, + */ + clamp_reg = raddr_add_a_to_live_reg_index(inst); + if (clamp_reg == ~0) { +- DRM_ERROR("direct TMU load wasn't clamped\n"); ++ DRM_DEBUG("direct TMU load wasn't clamped\n"); + return false; + } + + clamp_offset = validation_state->live_min_clamp_offsets[clamp_reg]; + if (clamp_offset == ~0) { +- DRM_ERROR("direct TMU load wasn't clamped\n"); ++ DRM_DEBUG("direct TMU load wasn't clamped\n"); + return false; + } + +@@ -233,7 +233,7 @@ check_tmu_write(struct vc4_validated_shader_info *validated_shader, + + if (!(add_b == QPU_MUX_A && raddr_a == QPU_R_UNIF) && + !(add_b == QPU_MUX_B && raddr_b == QPU_R_UNIF)) { +- DRM_ERROR("direct TMU load didn't add to a uniform\n"); ++ DRM_DEBUG("direct TMU load didn't add to a uniform\n"); + return false; + } + +@@ -241,14 +241,14 @@ check_tmu_write(struct vc4_validated_shader_info *validated_shader, + } else { + if (raddr_a == QPU_R_UNIF || (sig != QPU_SIG_SMALL_IMM && + raddr_b == QPU_R_UNIF)) { +- DRM_ERROR("uniform read in the same instruction as " ++ DRM_DEBUG("uniform read in the same instruction as " + "texture setup.\n"); + return false; + } + } + + if (validation_state->tmu_write_count[tmu] >= 4) { +- DRM_ERROR("TMU%d got too many parameters before dispatch\n", ++ DRM_DEBUG("TMU%d got too many parameters before dispatch\n", + tmu); + return false; + } +@@ -260,7 +260,7 @@ check_tmu_write(struct vc4_validated_shader_info *validated_shader, + */ + if (!is_direct) { + if (validation_state->needs_uniform_address_update) { +- DRM_ERROR("Texturing with undefined uniform address\n"); ++ DRM_DEBUG("Texturing with undefined uniform address\n"); + return false; + } + +@@ -331,35 +331,35 @@ validate_uniform_address_write(struct vc4_validated_shader_info *validated_shade + case QPU_SIG_LOAD_TMU1: + break; + default: +- DRM_ERROR("uniforms address change must be " ++ DRM_DEBUG("uniforms address change must be " + "normal math\n"); + return false; + } + + if (is_mul || QPU_GET_FIELD(inst, QPU_OP_ADD) != QPU_A_ADD) { +- DRM_ERROR("Uniform address reset must be an ADD.\n"); ++ DRM_DEBUG("Uniform address reset must be an ADD.\n"); + return false; + } + + if (QPU_GET_FIELD(inst, QPU_COND_ADD) != QPU_COND_ALWAYS) { +- DRM_ERROR("Uniform address reset must be unconditional.\n"); ++ DRM_DEBUG("Uniform address reset must be unconditional.\n"); + return false; + } + + if (QPU_GET_FIELD(inst, QPU_PACK) != QPU_PACK_A_NOP && + !(inst & QPU_PM)) { +- DRM_ERROR("No packing allowed on uniforms reset\n"); ++ DRM_DEBUG("No packing allowed on uniforms reset\n"); + return false; + } + + if (add_lri == -1) { +- DRM_ERROR("First argument of uniform address write must be " ++ DRM_DEBUG("First argument of uniform address write must be " + "an immediate value.\n"); + return false; + } + + if (validation_state->live_immediates[add_lri] != expected_offset) { +- DRM_ERROR("Resetting uniforms with offset %db instead of %db\n", ++ DRM_DEBUG("Resetting uniforms with offset %db instead of %db\n", + validation_state->live_immediates[add_lri], + expected_offset); + return false; +@@ -367,7 +367,7 @@ validate_uniform_address_write(struct vc4_validated_shader_info *validated_shade + + if (!(add_b == QPU_MUX_A && raddr_a == QPU_R_UNIF) && + !(add_b == QPU_MUX_B && raddr_b == QPU_R_UNIF)) { +- DRM_ERROR("Second argument of uniform address write must be " ++ DRM_DEBUG("Second argument of uniform address write must be " + "a uniform.\n"); + return false; + } +@@ -412,7 +412,7 @@ check_reg_write(struct vc4_validated_shader_info *validated_shader, + switch (waddr) { + case QPU_W_UNIFORMS_ADDRESS: + if (is_b) { +- DRM_ERROR("relative uniforms address change " ++ DRM_DEBUG("relative uniforms address change " + "unsupported\n"); + return false; + } +@@ -447,11 +447,11 @@ check_reg_write(struct vc4_validated_shader_info *validated_shader, + /* XXX: I haven't thought about these, so don't support them + * for now. + */ +- DRM_ERROR("Unsupported waddr %d\n", waddr); ++ DRM_DEBUG("Unsupported waddr %d\n", waddr); + return false; + + case QPU_W_VPM_ADDR: +- DRM_ERROR("General VPM DMA unsupported\n"); ++ DRM_DEBUG("General VPM DMA unsupported\n"); + return false; + + case QPU_W_VPM: +@@ -554,7 +554,7 @@ check_instruction_writes(struct vc4_validated_shader_info *validated_shader, + bool ok; + + if (is_tmu_write(waddr_add) && is_tmu_write(waddr_mul)) { +- DRM_ERROR("ADD and MUL both set up textures\n"); ++ DRM_DEBUG("ADD and MUL both set up textures\n"); + return false; + } + +@@ -583,7 +583,7 @@ check_branch(uint64_t inst, + * there's no need for it. + */ + if (waddr_add != QPU_W_NOP || waddr_mul != QPU_W_NOP) { +- DRM_ERROR("branch instruction at %d wrote a register.\n", ++ DRM_DEBUG("branch instruction at %d wrote a register.\n", + validation_state->ip); + return false; + } +@@ -609,7 +609,7 @@ check_instruction_reads(struct vc4_validated_shader_info *validated_shader, + validated_shader->uniforms_size += 4; + + if (validation_state->needs_uniform_address_update) { +- DRM_ERROR("Uniform read with undefined uniform " ++ DRM_DEBUG("Uniform read with undefined uniform " + "address\n"); + return false; + } +@@ -655,19 +655,19 @@ vc4_validate_branches(struct vc4_shader_validation_state *validation_state) + continue; + + if (ip - last_branch < 4) { +- DRM_ERROR("Branch at %d during delay slots\n", ip); ++ DRM_DEBUG("Branch at %d during delay slots\n", ip); + return false; + } + last_branch = ip; + + if (inst & QPU_BRANCH_REG) { +- DRM_ERROR("branching from register relative " ++ DRM_DEBUG("branching from register relative " + "not supported\n"); + return false; + } + + if (!(inst & QPU_BRANCH_REL)) { +- DRM_ERROR("relative branching required\n"); ++ DRM_DEBUG("relative branching required\n"); + return false; + } + +@@ -677,13 +677,13 @@ vc4_validate_branches(struct vc4_shader_validation_state *validation_state) + * end of the shader object. + */ + if (branch_imm % sizeof(inst) != 0) { +- DRM_ERROR("branch target not aligned\n"); ++ DRM_DEBUG("branch target not aligned\n"); + return false; + } + + branch_target_ip = after_delay_ip + (branch_imm >> 3); + if (branch_target_ip >= validation_state->max_ip) { +- DRM_ERROR("Branch at %d outside of shader (ip %d/%d)\n", ++ DRM_DEBUG("Branch at %d outside of shader (ip %d/%d)\n", + ip, branch_target_ip, + validation_state->max_ip); + return false; +@@ -694,7 +694,7 @@ vc4_validate_branches(struct vc4_shader_validation_state *validation_state) + * the shader. + */ + if (after_delay_ip >= validation_state->max_ip) { +- DRM_ERROR("Branch at %d continues past shader end " ++ DRM_DEBUG("Branch at %d continues past shader end " + "(%d/%d)\n", + ip, after_delay_ip, validation_state->max_ip); + return false; +@@ -704,7 +704,7 @@ vc4_validate_branches(struct vc4_shader_validation_state *validation_state) + } + + if (max_branch_target > validation_state->max_ip - 3) { +- DRM_ERROR("Branch landed after QPU_SIG_PROG_END"); ++ DRM_DEBUG("Branch landed after QPU_SIG_PROG_END"); + return false; + } + +@@ -745,7 +745,7 @@ vc4_handle_branch_target(struct vc4_shader_validation_state *validation_state) + return true; + + if (texturing_in_progress(validation_state)) { +- DRM_ERROR("Branch target landed during TMU setup\n"); ++ DRM_DEBUG("Branch target landed during TMU setup\n"); + return false; + } + +@@ -832,7 +832,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) + case QPU_SIG_LAST_THREAD_SWITCH: + if (!check_instruction_writes(validated_shader, + &validation_state)) { +- DRM_ERROR("Bad write at ip %d\n", ip); ++ DRM_DEBUG("Bad write at ip %d\n", ip); + goto fail; + } + +@@ -850,7 +850,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) + validated_shader->is_threaded = true; + + if (ip < last_thread_switch_ip + 3) { +- DRM_ERROR("Thread switch too soon after " ++ DRM_DEBUG("Thread switch too soon after " + "last switch at ip %d\n", ip); + goto fail; + } +@@ -862,7 +862,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) + case QPU_SIG_LOAD_IMM: + if (!check_instruction_writes(validated_shader, + &validation_state)) { +- DRM_ERROR("Bad LOAD_IMM write at ip %d\n", ip); ++ DRM_DEBUG("Bad LOAD_IMM write at ip %d\n", ip); + goto fail; + } + break; +@@ -873,14 +873,14 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) + goto fail; + + if (ip < last_thread_switch_ip + 3) { +- DRM_ERROR("Branch in thread switch at ip %d", ++ DRM_DEBUG("Branch in thread switch at ip %d", + ip); + goto fail; + } + + break; + default: +- DRM_ERROR("Unsupported QPU signal %d at " ++ DRM_DEBUG("Unsupported QPU signal %d at " + "instruction %d\n", sig, ip); + goto fail; + } +@@ -893,7 +893,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) + } + + if (ip == validation_state.max_ip) { +- DRM_ERROR("shader failed to terminate before " ++ DRM_DEBUG("shader failed to terminate before " + "shader BO end at %zd\n", + shader_obj->base.size); + goto fail; +@@ -902,7 +902,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) + /* Might corrupt other thread */ + if (validated_shader->is_threaded && + validation_state.all_registers_used) { +- DRM_ERROR("Shader uses threading, but uses the upper " ++ DRM_DEBUG("Shader uses threading, but uses the upper " + "half of the registers, too\n"); + goto fail; + } + +From 119529c882e429dc778773123d1fe22ddfd1a974 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Mon, 17 Apr 2017 09:26:03 -0700 +Subject: [PATCH 383/407] drm/vc4: Fix refcounting of runtime PM get if it + errors out. + +We were returning without decrementing if the error happened, meaning +that at the next submit we wouldn't try to bring up the power domain. + +Signed-off-by: Eric Anholt +Link: http://patchwork.freedesktop.org/patch/msgid/20170417162603.12726-1-eric@anholt.net +Reviewed-by: Sean Paul +(cherry picked from commit 925d05e1f825db9490da33afe35bd5383d301e97) +--- + drivers/gpu/drm/vc4/vc4_gem.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c +index 32e17b384fbc491e204b91f663a8485b6d79e948..994295fe1084371c1169ef313efa58e2a6de30b5 100644 +--- a/drivers/gpu/drm/vc4/vc4_gem.c ++++ b/drivers/gpu/drm/vc4/vc4_gem.c +@@ -876,13 +876,16 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, + } + + mutex_lock(&vc4->power_lock); +- if (vc4->power_refcount++ == 0) ++ if (vc4->power_refcount++ == 0) { + ret = pm_runtime_get_sync(&vc4->v3d->pdev->dev); +- mutex_unlock(&vc4->power_lock); +- if (ret < 0) { +- kfree(exec); +- return ret; ++ if (ret < 0) { ++ mutex_unlock(&vc4->power_lock); ++ vc4->power_refcount--; ++ kfree(exec); ++ return ret; ++ } + } ++ mutex_unlock(&vc4->power_lock); + + exec->args = args; + INIT_LIST_HEAD(&exec->unref_list); + +From acc5eb032a2d4e8ce491cbf54e0e481db1e676f2 Mon Sep 17 00:00:00 2001 +From: James Hughes +Date: Fri, 22 Sep 2017 10:24:04 +0100 +Subject: [PATCH 384/407] Touchscreen spurious event fix + +Touchscreen driver was not checking event type, +which meant bad coords that arrived with the +finger up event were being used, causing this +spurious coordinate event. + +Fix is to ignore all finger up events. + +Signed-off-by: James Hughes +--- + drivers/input/touchscreen/rpi-ft5406.c | 24 ++++++++++++++++-------- + 1 file changed, 16 insertions(+), 8 deletions(-) + +diff --git a/drivers/input/touchscreen/rpi-ft5406.c b/drivers/input/touchscreen/rpi-ft5406.c +index 9d7d05482355d168c5c0c42508cd978979ee5f14..ab35716caafaa7339031ab537b8fbf3b2b3a6da9 100644 +--- a/drivers/input/touchscreen/rpi-ft5406.c ++++ b/drivers/input/touchscreen/rpi-ft5406.c +@@ -42,6 +42,9 @@ struct ft5406_regs { + + #define SCREEN_WIDTH 800 + #define SCREEN_HEIGHT 480 ++#define FTS_TOUCH_DOWN 0 ++#define FTS_TOUCH_UP 1 ++#define FTS_TOUCH_CONTACT 2 + + struct ft5406 { + struct platform_device * pdev; +@@ -81,18 +84,22 @@ static int ft5406_thread(void *arg) + int x = (((int) regs.point[i].xh & 0xf) << 8) + regs.point[i].xl; + int y = (((int) regs.point[i].yh & 0xf) << 8) + regs.point[i].yl; + int touchid = (regs.point[i].yh >> 4) & 0xf; ++ int event_id = (regs.point[i].xh >> 6) & 0x3; + + modified_ids |= 1 << touchid; + +- if(!((1 << touchid) & known_ids)) +- dev_dbg(&ts->pdev->dev, "x = %d, y = %d, touchid = %d\n", x, y, touchid); +- +- input_mt_slot(ts->input_dev, touchid); +- input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 1); ++ if (event_id == FTS_TOUCH_CONTACT || ++ event_id == FTS_TOUCH_DOWN) { ++ if(!((1 << touchid) & known_ids)) ++ dev_dbg(&ts->pdev->dev, "x = %d, y = %d, touchid = %d\n", ++ x, y, touchid); + +- input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); +- input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); ++ input_mt_slot(ts->input_dev, touchid); ++ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 1); + ++ input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); ++ input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); ++ } + } + + released_ids = known_ids & ~modified_ids; +@@ -100,7 +107,8 @@ static int ft5406_thread(void *arg) + { + if(released_ids & (1<pdev->dev, "Released %d, known = %x modified = %x\n", i, known_ids, modified_ids); ++ dev_dbg(&ts->pdev->dev, "Released %d, known = %x modified = %x\n", ++ i, known_ids, modified_ids); + input_mt_slot(ts->input_dev, i); + input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0); + modified_ids &= ~(1 << i); + +From 872c2ee28c5d0ad2cc4e7ebe236790aa58821bb4 Mon Sep 17 00:00:00 2001 +From: David H +Date: Wed, 4 Oct 2017 04:43:07 -0700 +Subject: [PATCH 385/407] bcm2835-camera: Fix timestamp calculation problem + (#2214) + +* bcm2835-camera: Fix timestamp calculation problem + +Use div_s64_rem() to convert usec timestamp to timeval +to avoid integer signedness bug. + +* bcm2835-camera: Store kernel start time in NSEC instead of USEC + +* bcm2835-camera: Reword debug message for clarity +--- + drivers/media/platform/bcm2835/bcm2835-camera.c | 41 ++++++------------------- + drivers/media/platform/bcm2835/bcm2835-camera.h | 2 +- + 2 files changed, 11 insertions(+), 32 deletions(-) + +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c +index 6bdec0806126044cf7146d53326e4da5b4269884..5b68abbf9e45ce5cefc14789bdc9c6e889ae0094 100644 +--- a/drivers/media/platform/bcm2835/bcm2835-camera.c ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.c +@@ -363,37 +363,17 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, + buf->vb.vb2_buf.timestamp); + + } else if(pts != 0) { +- struct timeval timestamp; + s64 runtime_us = pts - + dev->capture.vc_start_timestamp; +- u32 div = 0; +- u32 rem = 0; +- +- div = +- div_u64_rem(runtime_us, USEC_PER_SEC, &rem); +- timestamp.tv_sec = +- dev->capture.kernel_start_ts.tv_sec + div; +- timestamp.tv_usec = +- dev->capture.kernel_start_ts.tv_usec + rem; +- +- if (timestamp.tv_usec >= +- USEC_PER_SEC) { +- timestamp.tv_sec++; +- timestamp.tv_usec -= +- USEC_PER_SEC; +- } ++ buf->vb.vb2_buf.timestamp = (runtime_us * NSEC_PER_USEC) + ++ dev->capture.kernel_start_timestamp; + v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, +- "Convert start time %d.%06d and %llu " +- "with offset %llu to %d.%06d\n", +- (int)dev->capture.kernel_start_ts. +- tv_sec, +- (int)dev->capture.kernel_start_ts. +- tv_usec, +- dev->capture.vc_start_timestamp, pts, +- (int)timestamp.tv_sec, +- (int)timestamp.tv_usec); +- buf->vb.vb2_buf.timestamp = timestamp.tv_sec * 1000000000ULL + +- timestamp.tv_usec * 1000ULL; ++ "Buffer time set as converted timestamp - %llu " ++ "= (pts [%lld usec] - vc start time [%llu usec]) " ++ "+ kernel start time [%llu nsec]\n", ++ buf->vb.vb2_buf.timestamp, ++ pts, dev->capture.vc_start_timestamp, ++ dev->capture.kernel_start_timestamp); + } else { + if (dev->capture.last_timestamp) { + buf->vb.vb2_buf.timestamp = dev->capture.last_timestamp; +@@ -403,8 +383,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, + } + else { + buf->vb.vb2_buf.timestamp = +- dev->capture.kernel_start_ts.tv_sec * 1000000000ULL + +- dev->capture.kernel_start_ts.tv_usec * 1000ULL; ++ dev->capture.kernel_start_timestamp; + v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, + "Buffer time set as start timestamp - %lld", + buf->vb.vb2_buf.timestamp); +@@ -586,7 +565,7 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) + + dev->capture.last_timestamp = 0; + +- v4l2_get_timestamp(&dev->capture.kernel_start_ts); ++ dev->capture.kernel_start_timestamp = ktime_get_ns(); + + /* enable the camera port */ + dev->capture.port->cb_ctx = dev; +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.h b/drivers/media/platform/bcm2835/bcm2835-camera.h +index 7f8a68916a67001bc9241bce2928519a2ce1ba78..d1b2a675e41d9d6561f278bd9d2f1802d8793f23 100644 +--- a/drivers/media/platform/bcm2835/bcm2835-camera.h ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.h +@@ -92,7 +92,7 @@ struct bm2835_mmal_dev { + /* VC start timestamp for streaming */ + s64 vc_start_timestamp; + /* Kernel start timestamp for streaming */ +- struct timeval kernel_start_ts; ++ u64 kernel_start_timestamp; + /* Timestamp of last frame */ + u64 last_timestamp; + + +From 210fcae41a2cb3da0249ad4d8820de821c80ba6f Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 24 Aug 2017 16:16:16 +0100 +Subject: [PATCH 386/407] brcmfmac: Disable ARP offloading when promiscuous + +This is a test patch for brcmfmac from Franky Lin at Broadcom to disable +ARP offloading when in promiscuous mode, re-enabling the ability to +sniff ARP packets over WiFi. + +See: https://github.com/raspberrypi/linux/issues/2171 + +Signed-off-by: Phil Elwell +--- + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 41 ---------------------- + .../wireless/broadcom/brcm80211/brcmfmac/core.c | 39 ++++++++++++++++++++ + .../wireless/broadcom/brcm80211/brcmfmac/core.h | 1 + + 3 files changed, 40 insertions(+), 41 deletions(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +index 3d28de96298c7cded3d231dd2f837ff182575c8c..b8195c167d6cadc5ddcb52c4ceaa744eb9c423d0 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -481,47 +481,6 @@ send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key) + return err; + } + +-static s32 +-brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable) +-{ +- s32 err; +- u32 mode; +- +- if (enable) +- mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY; +- else +- mode = 0; +- +- /* Try to set and enable ARP offload feature, this may fail, then it */ +- /* is simply not supported and err 0 will be returned */ +- err = brcmf_fil_iovar_int_set(ifp, "arp_ol", mode); +- if (err) { +- brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n", +- mode, err); +- err = 0; +- } else { +- err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable); +- if (err) { +- brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n", +- enable, err); +- err = 0; +- } else +- brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n", +- enable, mode); +- } +- +- err = brcmf_fil_iovar_int_set(ifp, "ndoe", enable); +- if (err) { +- brcmf_dbg(TRACE, "failed to configure (%d) ND offload err = %d\n", +- enable, err); +- err = 0; +- } else +- brcmf_dbg(TRACE, "successfully configured (%d) ND offload to 0x%x\n", +- enable, mode); +- +- return err; +-} +- + static void + brcmf_cfg80211_update_proto_addr_mode(struct wireless_dev *wdev) + { +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +index f877301c9454b2e75715937cd015fbfe87fc271b..ef4085cda90e2975eb474cd39627c578684b0f55 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -71,6 +71,43 @@ struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx) + return ifp; + } + ++void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable) ++{ ++ s32 err; ++ u32 mode; ++ ++ if (enable) ++ mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY; ++ else ++ mode = 0; ++ ++ /* Try to set and enable ARP offload feature, this may fail, then it */ ++ /* is simply not supported and err 0 will be returned */ ++ err = brcmf_fil_iovar_int_set(ifp, "arp_ol", mode); ++ if (err) { ++ brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n", ++ mode, err); ++ err = 0; ++ } else { ++ err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable); ++ if (err) { ++ brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n", ++ enable, err); ++ err = 0; ++ } else ++ brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n", ++ enable, mode); ++ } ++ ++ err = brcmf_fil_iovar_int_set(ifp, "ndoe", enable); ++ if (err) ++ brcmf_dbg(TRACE, "failed to configure (%d) ND offload err = %d\n", ++ enable, err); ++ else ++ brcmf_dbg(TRACE, "successfully configured (%d) ND offload to 0x%x\n", ++ enable, mode); ++} ++ + static void _brcmf_set_multicast_list(struct work_struct *work) + { + struct brcmf_if *ifp; +@@ -134,6 +171,8 @@ static void _brcmf_set_multicast_list(struct work_struct *work) + if (err < 0) + brcmf_err("Setting BRCMF_C_SET_PROMISC failed, %d\n", + err); ++ ++ brcmf_configure_arp_nd_offload(ifp, !cmd_value); + } + + #if IS_ENABLED(CONFIG_IPV6) +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +index c94dcab260d0009bc960e1eef119f66c2187e718..ba699fadd4dc8c5155b8567d330135bdc421b9c4 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +@@ -208,6 +208,7 @@ int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp); + char *brcmf_ifname(struct brcmf_if *ifp); + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx); + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked); ++void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable); + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, + bool is_p2pdev, const char *name, u8 *mac_addr); + void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked); + +From e155c2d95b09bfefaa78a1dba0751970438299bf Mon Sep 17 00:00:00 2001 +From: Kevin Cernekee +Date: Sat, 16 Sep 2017 21:08:22 -0700 +Subject: [PATCH 387/407] brcmfmac: Avoid possible out-of-bounds read + +In brcmf_p2p_notify_rx_mgmt_p2p_probereq(), chanspec is assigned before +the length of rxframe is validated. This could lead to uninitialized +data being accessed (but not printed). Since we already have a +perfectly good endian-swapped copy of rxframe->chanspec in ch.chspec, +and ch.chspec is not modified by decchspec(), avoid the extra +assignment and use ch.chspec in the debug print. + +Suggested-by: Mattias Nissler +Signed-off-by: Kevin Cernekee +Reviewed-by: Arend van Spriel +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +index 85d949e03f79f7c9566c7b00a9bbe99853df7f16..10571ef8dfe0086ce689b3ff1700de0a1f6cabf1 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +@@ -1853,7 +1853,6 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp, + struct afx_hdl *afx_hdl = &p2p->afx_hdl; + struct brcmf_cfg80211_vif *vif = ifp->vif; + struct brcmf_rx_mgmt_data *rxframe = (struct brcmf_rx_mgmt_data *)data; +- u16 chanspec = be16_to_cpu(rxframe->chanspec); + struct brcmu_chan ch; + u8 *mgmt_frame; + u32 mgmt_frame_len; +@@ -1906,7 +1905,7 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp, + cfg80211_rx_mgmt(&vif->wdev, freq, 0, mgmt_frame, mgmt_frame_len, 0); + + brcmf_dbg(INFO, "mgmt_frame_len (%d) , e->datalen (%d), chanspec (%04x), freq (%d)\n", +- mgmt_frame_len, e->datalen, chanspec, freq); ++ mgmt_frame_len, e->datalen, ch.chspec, freq); + + return 0; + } + +From 61dbbbb94d3644916318efe0ee7b5c7d78458988 Mon Sep 17 00:00:00 2001 +From: Kevin Cernekee +Date: Sat, 16 Sep 2017 21:08:23 -0700 +Subject: [PATCH 388/407] brcmfmac: Delete redundant length check + +brcmf_fweh_process_event() sets event->datalen to the +endian-swapped value of event_packet->msg.datalen, which is the +same as emsg.datalen. This length is already validated in +brcmf_fweh_process_event(), so there is no need to check it +again upon dequeuing the event. + +Suggested-by: Arend van Spriel +Signed-off-by: Kevin Cernekee +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +index 6afcf86b9ba29aefa09ae2794e9f8f1bd06222db..27e7d38c03bad3dfa5905f39c5ee6b6cb21a18e6 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +@@ -257,11 +257,6 @@ static void brcmf_fweh_event_worker(struct work_struct *work) + brcmf_dbg_hex_dump(BRCMF_EVENT_ON(), event->data, + min_t(u32, emsg.datalen, 64), + "event payload, len=%d\n", emsg.datalen); +- if (emsg.datalen > event->datalen) { +- brcmf_err("event invalid length header=%d, msg=%d\n", +- event->datalen, emsg.datalen); +- goto event_free; +- } + + /* special handling of interface event */ + if (event->code == BRCMF_E_IF) { + +From 992269a3454192d0e664c2274b23d6cb79554360 Mon Sep 17 00:00:00 2001 +From: Chung-Hsien Hsu +Date: Sun, 14 May 2017 20:11:05 -0500 +Subject: [PATCH 389/407] brcmfmac: add CLM download support + +Future firmwares will be provided with minimal built-in CLM - the +NULL region (#n/0) becomes the initial country. It cannot be changed +until downloading a CLM blob file with some other regions. This patch +adds support for CLM blob file download. The blob file should be named +as firmware but with extension .clm_blob (e.g. +brcmfmac43430-sdio.clm_blob) and be placed in /lib/firmware/brcm/. + +Change-Id: I0901a4b38592fe28d0adeb8f3e2402292842f169 + +Signed-off-by: Chung-Hsien Hsu +--- + .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 13 ++ + .../wireless/broadcom/brcm80211/brcmfmac/common.c | 175 +++++++++++++++++++++ + .../broadcom/brcm80211/brcmfmac/fwil_types.h | 27 ++++ + .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 19 +++ + .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 19 +++ + .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 18 +++ + 6 files changed, 271 insertions(+) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +index 2b246545647ac35810e6ade0ac81adab4c0424d8..045e2acd60153a6d8e292932eceeabce48b1bd93 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +@@ -69,6 +69,7 @@ struct brcmf_bus_dcmd { + * @wowl_config: specify if dongle is configured for wowl when going to suspend + * @get_ramsize: obtain size of device memory. + * @get_memdump: obtain device memory dump in provided buffer. ++ * @get_fwname: obtain firmware name. + * + * This structure provides an abstract interface towards the + * bus specific driver. For control messages to common driver +@@ -85,6 +86,8 @@ struct brcmf_bus_ops { + void (*wowl_config)(struct device *dev, bool enabled); + size_t (*get_ramsize)(struct device *dev); + int (*get_memdump)(struct device *dev, void *data, size_t len); ++ int (*get_fwname)(struct device *dev, uint chip, uint chiprev, ++ unsigned char *fw_name); + }; + + +@@ -208,6 +211,16 @@ int brcmf_bus_get_memdump(struct brcmf_bus *bus, void *data, size_t len) + return bus->ops->get_memdump(bus->dev, data, len); + } + ++static inline ++int brcmf_bus_get_fwname(struct brcmf_bus *bus, uint chip, uint chiprev, ++ unsigned char *fw_name) ++{ ++ if (!bus->ops->get_fwname) ++ return -EOPNOTSUPP; ++ ++ return bus->ops->get_fwname(bus->dev, chip, chiprev, fw_name); ++} ++ + /* + * interface functions from common layer + */ +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +index b081673abcb4aa72d70d8e0834b608f65fea16e8..678dbb1dc7b01a94224741c16bca616232308bcd 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include + #include + #include "core.h" +@@ -28,6 +29,7 @@ + #include "tracepoint.h" + #include "common.h" + #include "of.h" ++#include "firmware.h" + + MODULE_AUTHOR("Broadcom Corporation"); + MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver."); +@@ -104,15 +106,170 @@ void brcmf_c_set_joinpref_default(struct brcmf_if *ifp) + brcmf_err("Set join_pref error (%d)\n", err); + } + ++int brcmf_c_download_2_dongle(struct brcmf_if *ifp, char *dcmd, u16 flag, ++ u16 dload_type, char *dload_buf, u32 len) ++{ ++ struct brcmf_dload_data_le *dload_ptr; ++ u32 dload_data_offset; ++ u16 flags; ++ s32 err; ++ ++ dload_ptr = (struct brcmf_dload_data_le *)dload_buf; ++ dload_data_offset = offsetof(struct brcmf_dload_data_le, data); ++ flags = flag | (DLOAD_HANDLER_VER << DLOAD_FLAG_VER_SHIFT); ++ ++ dload_ptr->flag = cpu_to_le16(flags); ++ dload_ptr->dload_type = cpu_to_le16(dload_type); ++ dload_ptr->len = cpu_to_le32(len - dload_data_offset); ++ dload_ptr->crc = cpu_to_le32(0); ++ len = len + 8 - (len % 8); ++ ++ err = brcmf_fil_iovar_data_set(ifp, dcmd, (void *)dload_buf, len); ++ ++ return err; ++} ++ ++int brcmf_c_get_clm_name(struct brcmf_if *ifp, u8 *clm_name) ++{ ++ struct brcmf_rev_info_le revinfo; ++ struct brcmf_bus *bus = ifp->drvr->bus_if; ++ u8 fw_name[BRCMF_FW_NAME_LEN]; ++ u8 *ptr; ++ size_t len; ++ u32 chipnum; ++ u32 chiprev; ++ s32 err; ++ ++ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_REVINFO, &revinfo, ++ sizeof(revinfo)); ++ if (err < 0) { ++ brcmf_err("retrieving revision info failed (%d)\n", err); ++ goto done; ++ } ++ ++ chipnum = le32_to_cpu(revinfo.chipnum); ++ chiprev = le32_to_cpu(revinfo.chiprev); ++ ++ memset(fw_name, 0, BRCMF_FW_NAME_LEN); ++ err = brcmf_bus_get_fwname(bus, chipnum, chiprev, fw_name); ++ if (err) { ++ brcmf_err("get firmware name failed (%d)\n", err); ++ goto done; ++ } ++ ++ /* generate CLM blob file name */ ++ ptr = strrchr(fw_name, '.'); ++ len = ptr - fw_name + 1; ++ if (len + strlen(".clm_blob") > BRCMF_FW_NAME_LEN) { ++ err = -E2BIG; ++ } else { ++ strlcpy(clm_name, fw_name, len); ++ strlcat(clm_name, ".clm_blob", BRCMF_FW_NAME_LEN); ++ } ++done: ++ return err; ++} ++ ++int brcmf_c_process_clm_blob(struct brcmf_if *ifp) ++{ ++ struct device *dev = ifp->drvr->bus_if->dev; ++ const struct firmware *clm = NULL; ++ u8 buf[BRCMF_DCMD_SMLEN]; ++ u8 clm_name[BRCMF_FW_NAME_LEN]; ++ u32 data_offset; ++ u32 size2alloc; ++ u8 *chunk_buf; ++ u32 chunk_len; ++ u32 datalen; ++ u32 cumulative_len = 0; ++ u16 dl_flag = DL_BEGIN; ++ s32 err; ++ ++ brcmf_dbg(INFO, "Enter\n"); ++ ++ memset(clm_name, 0, BRCMF_FW_NAME_LEN); ++ err = brcmf_c_get_clm_name(ifp, clm_name); ++ if (err) { ++ brcmf_err("get CLM blob file name failed (%d)\n", err); ++ return err; ++ } ++ ++ err = request_firmware(&clm, clm_name, dev); ++ if (err) { ++ if (err == -ENOENT) ++ return 0; ++ brcmf_err("request CLM blob file failed (%d)\n", err); ++ return err; ++ } ++ ++ datalen = clm->size; ++ data_offset = offsetof(struct brcmf_dload_data_le, data); ++ size2alloc = data_offset + MAX_CHUNK_LEN; ++ ++ chunk_buf = kzalloc(size2alloc, GFP_KERNEL); ++ if (!chunk_buf) { ++ err = -ENOMEM; ++ goto done; ++ } ++ ++ do { ++ if (datalen > MAX_CHUNK_LEN) { ++ chunk_len = MAX_CHUNK_LEN; ++ } else { ++ chunk_len = datalen; ++ dl_flag |= DL_END; ++ } ++ ++ memcpy(chunk_buf + data_offset, clm->data + cumulative_len, ++ chunk_len); ++ ++ err = brcmf_c_download_2_dongle(ifp, "clmload", dl_flag, ++ DL_TYPE_CLM, chunk_buf, ++ data_offset + chunk_len); ++ ++ dl_flag &= ~DL_BEGIN; ++ ++ cumulative_len += chunk_len; ++ datalen -= chunk_len; ++ } while ((datalen > 0) && (err == 0)); ++ ++ if (err) { ++ brcmf_err("clmload (%d byte file) failed (%d); ", ++ (u32)clm->size, err); ++ /* Retrieve clmload_status and print */ ++ memset(buf, 0, BRCMF_DCMD_SMLEN); ++ err = brcmf_fil_iovar_data_get(ifp, "clmload_status", buf, ++ BRCMF_DCMD_SMLEN); ++ if (err) ++ brcmf_err("get clmload_status failed (%d)\n", err); ++ else ++ brcmf_err("clmload_status=%d\n", *((int *)buf)); ++ err = -EIO; ++ } ++ ++ kfree(chunk_buf); ++done: ++ release_firmware(clm); ++ return err; ++} ++ + int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) + { + s8 eventmask[BRCMF_EVENTING_MASK_LEN]; + u8 buf[BRCMF_DCMD_SMLEN]; + struct brcmf_rev_info_le revinfo; + struct brcmf_rev_info *ri; ++ char *clmver; + char *ptr; + s32 err; + ++ /* Do any CLM downloading */ ++ err = brcmf_c_process_clm_blob(ifp); ++ if (err < 0) { ++ brcmf_err("download CLM blob file failed, %d\n", err); ++ goto done; ++ } ++ + /* retreive mac address */ + err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, + sizeof(ifp->mac_addr)); +@@ -167,6 +324,24 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) + ptr = strrchr(buf, ' ') + 1; + strlcpy(ifp->drvr->fwver, ptr, sizeof(ifp->drvr->fwver)); + ++ /* Query for 'clmver' to get CLM version info from firmware */ ++ memset(buf, 0, sizeof(buf)); ++ err = brcmf_fil_iovar_data_get(ifp, "clmver", buf, sizeof(buf)); ++ if (err) { ++ brcmf_err("retrieving clmver failed, %d\n", err); ++ goto done; ++ } else { ++ clmver = (char *)buf; ++ /* Replace all newline/linefeed characters with space ++ * character ++ */ ++ ptr = clmver; ++ while ((ptr = strchr(ptr, '\n')) != NULL) ++ *ptr = ' '; ++ ++ brcmf_err("CLM version = %s\n", clmver); ++ } ++ + /* set mpc */ + err = brcmf_fil_iovar_int_set(ifp, "mpc", 1); + if (err) { +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +index 59013572fbe3fc8cbbfc5d83f0d4ff4e827aa893..86305bb9c37f69e0c9f8c2f05f5afbcea8ba4643 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +@@ -151,6 +151,22 @@ + #define BRCMF_MFP_CAPABLE 1 + #define BRCMF_MFP_REQUIRED 2 + ++/* MAX_CHUNK_LEN is the amount of the clm file we send in each ioctl. ++ * It is relatively small because dongles (FW) have a small maximum size ++ * input payload restriction for ioctls. ++ */ ++#define MAX_CHUNK_LEN 1400 ++ ++#define DLOAD_HANDLER_VER 1 /* Downloader version */ ++#define DLOAD_FLAG_VER_MASK 0xf000 /* Downloader version mask */ ++#define DLOAD_FLAG_VER_SHIFT 12 /* Downloader version shift */ ++ ++#define DL_CRC_NOT_INUSE 0x0001 ++#define DL_BEGIN 0x0002 ++#define DL_END 0x0004 ++ ++#define DL_TYPE_CLM 2 ++ + /* join preference types for join_pref iovar */ + enum brcmf_join_pref_types { + BRCMF_JOIN_PREF_RSSI = 1, +@@ -817,4 +833,15 @@ struct brcmf_gtk_keyinfo_le { + u8 replay_counter[BRCMF_RSN_REPLAY_LEN]; + }; + ++/** ++ * struct brcmf_dload_data_le - data passing to firmware for downloading ++ */ ++struct brcmf_dload_data_le { ++ __le16 flag; ++ __le16 dload_type; ++ __le32 len; ++ __le32 crc; ++ u8 data[1]; ++}; ++ + #endif /* FWIL_TYPES_H_ */ +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +index d3d79219fbb05bbf4ba94d283403bcb978e8383b..eb4672f3b2303e9c6036cba9bffa697fdc0be07f 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1317,6 +1317,24 @@ static int brcmf_pcie_get_memdump(struct device *dev, void *data, size_t len) + return 0; + } + ++static int brcmf_pcie_get_fwname(struct device *dev, u32 chip, u32 chiprev, ++ u8 *fw_name) ++{ ++ struct brcmf_bus *bus_if = dev_get_drvdata(dev); ++ struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie; ++ struct brcmf_pciedev_info *devinfo = buspub->devinfo; ++ int ret = 0; ++ ++ if (devinfo->fw_name[0] != '\0') ++ strlcpy(fw_name, devinfo->fw_name, BRCMF_FW_NAME_LEN); ++ else ++ ret = brcmf_fw_map_chip_to_name(chip, chiprev, ++ brcmf_pcie_fwnames, ++ ARRAY_SIZE(brcmf_pcie_fwnames), ++ fw_name, NULL); ++ ++ return ret; ++} + + static const struct brcmf_bus_ops brcmf_pcie_bus_ops = { + .txdata = brcmf_pcie_tx, +@@ -1326,6 +1344,7 @@ static const struct brcmf_bus_ops brcmf_pcie_bus_ops = { + .wowl_config = brcmf_pcie_wowl_config, + .get_ramsize = brcmf_pcie_get_ramsize, + .get_memdump = brcmf_pcie_get_memdump, ++ .get_fwname = brcmf_pcie_get_fwname, + }; + + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +index 0aab6faef9220fc4a187db409d27adbc5598295f..a282b0274d0645555ca34993f829a9692f78bc79 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -3965,6 +3965,24 @@ brcmf_sdio_watchdog(unsigned long data) + } + } + ++static int brcmf_sdio_get_fwname(struct device *dev, u32 chip, u32 chiprev, ++ u8 *fw_name) ++{ ++ struct brcmf_bus *bus_if = dev_get_drvdata(dev); ++ struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; ++ int ret = 0; ++ ++ if (sdiodev->fw_name[0] != '\0') ++ strlcpy(fw_name, sdiodev->fw_name, BRCMF_FW_NAME_LEN); ++ else ++ ret = brcmf_fw_map_chip_to_name(chip, chiprev, ++ brcmf_sdio_fwnames, ++ ARRAY_SIZE(brcmf_sdio_fwnames), ++ fw_name, NULL); ++ ++ return ret; ++} ++ + static const struct brcmf_bus_ops brcmf_sdio_bus_ops = { + .stop = brcmf_sdio_bus_stop, + .preinit = brcmf_sdio_bus_preinit, +@@ -3975,6 +3993,7 @@ static const struct brcmf_bus_ops brcmf_sdio_bus_ops = { + .wowl_config = brcmf_sdio_wowl_config, + .get_ramsize = brcmf_sdio_bus_get_ramsize, + .get_memdump = brcmf_sdio_bus_get_memdump, ++ .get_fwname = brcmf_sdio_get_fwname, + }; + + static void brcmf_sdio_firmware_callback(struct device *dev, int err, +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +index 053f3b59f21e07a720406bb3165806e27f631025..49384fcc02c0d7f54c159d5d0c712d2f55b4c108 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -1125,12 +1125,30 @@ static void brcmf_usb_wowl_config(struct device *dev, bool enabled) + device_set_wakeup_enable(devinfo->dev, false); + } + ++static int brcmf_usb_get_fwname(struct device *dev, u32 chip, u32 chiprev, ++ u8 *fw_name) ++{ ++ struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); ++ int ret = 0; ++ ++ if (devinfo->fw_name[0] != '\0') ++ strlcpy(fw_name, devinfo->fw_name, BRCMF_FW_NAME_LEN); ++ else ++ ret = brcmf_fw_map_chip_to_name(chip, chiprev, ++ brcmf_usb_fwnames, ++ ARRAY_SIZE(brcmf_usb_fwnames), ++ fw_name, NULL); ++ ++ return ret; ++} ++ + static const struct brcmf_bus_ops brcmf_usb_bus_ops = { + .txdata = brcmf_usb_tx, + .stop = brcmf_usb_down, + .txctl = brcmf_usb_tx_ctlpkt, + .rxctl = brcmf_usb_rx_ctlpkt, + .wowl_config = brcmf_usb_wowl_config, ++ .get_fwname = brcmf_usb_get_fwname, + }; + + static int brcmf_usb_bus_setup(struct brcmf_usbdev_info *devinfo) + +From 51431aad8549803464d9e2b684c45a7c12666a8e Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 6 Oct 2017 13:23:32 +0100 +Subject: [PATCH 390/407] brcmfmac: request_firmware_direct is quieter + +Since we don't have any CLM-capable firmware yet, silence the warning +of its absence by using request_firmware_direct, which should also +be marginally quicker. + +Signed-off-by: Phil Elwell +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +index 678dbb1dc7b01a94224741c16bca616232308bcd..297fbd7db6a22501a8b63068910ff8a666db9987 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -194,7 +194,7 @@ int brcmf_c_process_clm_blob(struct brcmf_if *ifp) + return err; + } + +- err = request_firmware(&clm, clm_name, dev); ++ err = request_firmware_direct(&clm, clm_name, dev); + if (err) { + if (err == -ENOENT) + return 0; + +From 5491b411b010c07bee3f60acee9ac9c63ba24aea Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 29 Sep 2017 10:32:19 +0100 +Subject: [PATCH 391/407] amba_pl011: Add cts-event-workaround DT property + +The BCM2835 PL011 implementation seems to have a bug that can lead to a +transmission lockup if CTS changes frequently. A workaround was added to +the driver with a vendor-specific flag to enable it, but this flag is +currently not set for ARM implementations. + +Add a "cts-event-workaround" property to Pi DTBs and use the presence +of that property to force the flag to be enabled in the driver. + +See: https://github.com/raspberrypi/linux/issues/1280 + +Signed-off-by: Phil Elwell +--- + Documentation/devicetree/bindings/serial/pl011.txt | 3 +++ + arch/arm/boot/dts/bcm270x.dtsi | 5 +++++ + drivers/tty/serial/amba-pl011.c | 5 +++++ + 3 files changed, 13 insertions(+) + +diff --git a/Documentation/devicetree/bindings/serial/pl011.txt b/Documentation/devicetree/bindings/serial/pl011.txt +index 77863aefe9ef1eafe648b530c1570333aea7940b..8d65b0ec2828b6abb07589407a5126fde6e49a0e 100644 +--- a/Documentation/devicetree/bindings/serial/pl011.txt ++++ b/Documentation/devicetree/bindings/serial/pl011.txt +@@ -35,6 +35,9 @@ Optional properties: + - poll-timeout-ms: + Poll timeout when auto-poll is set, default + 3000ms. ++- cts-event-workaround: ++ Enables the (otherwise vendor-specific) workaround for the ++ CTS-induced TX lockup. + + See also bindings/arm/primecell.txt + +diff --git a/arch/arm/boot/dts/bcm270x.dtsi b/arch/arm/boot/dts/bcm270x.dtsi +index caa66393518603529d284f360b2000b0ed4852ef..6af5a365137754160d6c700431ac6870639d7d41 100644 +--- a/arch/arm/boot/dts/bcm270x.dtsi ++++ b/arch/arm/boot/dts/bcm270x.dtsi +@@ -26,6 +26,11 @@ + interrupts = <2 17>, <2 18>; + }; + ++ serial@7e201000 { /* uart0 */ ++ /* Enable CTS bug workaround */ ++ cts-event-workaround; ++ }; ++ + sdhost: sdhost@7e202000 { + compatible = "brcm,bcm2835-sdhost"; + reg = <0x7e202000 0x100>; +diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c +index 003a5b0c30295dbbcb94a28d0c64d1241d801e73..10c996f869a9cbda073ff48550ba055713b0311d 100644 +--- a/drivers/tty/serial/amba-pl011.c ++++ b/drivers/tty/serial/amba-pl011.c +@@ -2523,6 +2523,11 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) + if (IS_ERR(uap->clk)) + return PTR_ERR(uap->clk); + ++ if (of_property_read_bool(dev->dev.of_node, "cts-event-workaround")) { ++ vendor->cts_event_workaround = true; ++ dev_info(&dev->dev, "cts_event_workaround enabled\n"); ++ } ++ + uap->reg_offset = vendor->reg_offset; + uap->vendor = vendor; + uap->fifosize = vendor->get_fifosize(dev); + +From 69a4848bb6bfbb1d8c2242ffbf99d6ce026c8325 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 29 Sep 2017 10:32:19 +0100 +Subject: [PATCH 392/407] amba_pl011: Insert mb() for correct FIFO handling + +The pl011 register accessor functions use the _relaxed versions of the +standard readl() and writel() functions, meaning that there are no +automatic memory barriers. When polling a FIFO status register to check +for fullness, it is necessary to ensure that any outstanding writes have +completed; otherwise the flags are effectively stale, making it possible +that the next write is to a full FIFO. + +Signed-off-by: Phil Elwell +--- + drivers/tty/serial/amba-pl011.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c +index 10c996f869a9cbda073ff48550ba055713b0311d..a1adfe7f39b95d474ebab8233c4ed1b3a670a535 100644 +--- a/drivers/tty/serial/amba-pl011.c ++++ b/drivers/tty/serial/amba-pl011.c +@@ -1384,6 +1384,7 @@ static bool pl011_tx_char(struct uart_amba_port *uap, unsigned char c, + return false; /* unable to transmit character */ + + pl011_write(c, uap, REG_DR); ++ mb(); + uap->port.icount.tx++; + + return true; + +From 22fc6dfdc3ea99f74a9e21c9d5e81a8ea434dc4e Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 11 Oct 2017 13:48:04 +0100 +Subject: [PATCH 393/407] amba-pl011: Report AUTOCTS capability to framework + +The PL011 has full hardware RTS/CTS support which is enabled by +the driver when flow control is requested. However, it doesn't +notify the UART framework of the fact, causing the software CTS +support to be enabled at the same time. + +Software CTS triggers the sending of another batch of characters +when CTS becomes asserted. The pl011 interrupt handler processes +the CTIS bit before TXIS, which can cause some characters to be +sent between the time that the TXIS bit first becomes asserted +and the time it is handled by a call to px011_tx_chars. This +would be fine were it not for the optimisation in pl011_tx_char +that assumes the FIFO is half-empty if called from the interrupt +handler and skips the checking of the FIFO status register before +sending each character, leading to data loss if the FIFO is more +than half-full. + +Prevent the data loss and improve efficiency by indicating the +AUTOCTS support. + +Signed-off-by: Phil Elwell +--- + drivers/tty/serial/amba-pl011.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c +index a1adfe7f39b95d474ebab8233c4ed1b3a670a535..5b39ad028868748c98eef2fcf7a9d1a19408a09b 100644 +--- a/drivers/tty/serial/amba-pl011.c ++++ b/drivers/tty/serial/amba-pl011.c +@@ -2021,9 +2021,11 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios, + + old_cr |= UART011_CR_CTSEN; + uap->autorts = true; ++ port->status |= UPSTAT_AUTOCTS; + } else { + old_cr &= ~(UART011_CR_CTSEN | UART011_CR_RTSEN); + uap->autorts = false; ++ port->status &= ~UPSTAT_AUTOCTS; + } + + if (uap->vendor->oversampling) { + +From 55877eb5003b50b91e29e0f439dec07d8bb5e80e Mon Sep 17 00:00:00 2001 +From: Mariusz Bialonczyk +Date: Thu, 23 Feb 2017 07:38:43 +0100 +Subject: [PATCH 394/407] w1: add support for DS2438 Smart Battery Monitor + +[ Upstream commit e3af95e60738e2f0ecedca96f8f3baa2fa4d1b7d ] + +Detailed information about support and provided sysfs files +in my next commit which creates a documentation file: +Documentation/w1/slaves/w1_ds2438 + +Signed-off-by: Mariusz Bialonczyk +Signed-off-by: Greg Kroah-Hartman +--- + drivers/w1/slaves/Kconfig | 6 + + drivers/w1/slaves/Makefile | 1 + + drivers/w1/slaves/w1_ds2438.c | 390 ++++++++++++++++++++++++++++++++++++++++++ + drivers/w1/w1_family.h | 1 + + 4 files changed, 398 insertions(+) + create mode 100644 drivers/w1/slaves/w1_ds2438.c + +diff --git a/drivers/w1/slaves/Kconfig b/drivers/w1/slaves/Kconfig +index cfe74d09932e09f441c957a06662d97faccfd967..9b4a79782276f653b723e96ed04ac1e12718c1c1 100644 +--- a/drivers/w1/slaves/Kconfig ++++ b/drivers/w1/slaves/Kconfig +@@ -78,6 +78,12 @@ config W1_SLAVE_DS2433_CRC + Each block has 30 bytes of data and a two byte CRC16. + Full block writes are only allowed if the CRC is valid. + ++config W1_SLAVE_DS2438 ++ tristate "DS2438 Smart Battery Monitor 0x26 family support" ++ help ++ Say Y here if you want to use a 1-wire ++ DS2438 Smart Battery Monitor device support ++ + config W1_SLAVE_DS2760 + tristate "Dallas 2760 battery monitor chip (HP iPAQ & others)" + help +diff --git a/drivers/w1/slaves/Makefile b/drivers/w1/slaves/Makefile +index 1e9989afe7bf74d72ab93375e71ddb985a3bcb39..7ad7a2cf1e1200ef17c3d97907db5e2ffde60fbb 100644 +--- a/drivers/w1/slaves/Makefile ++++ b/drivers/w1/slaves/Makefile +@@ -10,6 +10,7 @@ obj-$(CONFIG_W1_SLAVE_DS2406) += w1_ds2406.o + obj-$(CONFIG_W1_SLAVE_DS2423) += w1_ds2423.o + obj-$(CONFIG_W1_SLAVE_DS2431) += w1_ds2431.o + obj-$(CONFIG_W1_SLAVE_DS2433) += w1_ds2433.o ++obj-$(CONFIG_W1_SLAVE_DS2438) += w1_ds2438.o + obj-$(CONFIG_W1_SLAVE_DS2760) += w1_ds2760.o + obj-$(CONFIG_W1_SLAVE_DS2780) += w1_ds2780.o + obj-$(CONFIG_W1_SLAVE_DS2781) += w1_ds2781.o +diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c +new file mode 100644 +index 0000000000000000000000000000000000000000..5ededb4965e143ab774d2705b2ad1e6b0d4fa51b +--- /dev/null ++++ b/drivers/w1/slaves/w1_ds2438.c +@@ -0,0 +1,390 @@ ++/* ++ * 1-Wire implementation for the ds2438 chip ++ * ++ * Copyright (c) 2017 Mariusz Bialonczyk ++ * ++ * This source code is licensed under the GNU General Public License, ++ * Version 2. See the file COPYING for more details. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "../w1.h" ++#include "../w1_family.h" ++ ++#define W1_DS2438_RETRIES 3 ++ ++/* Memory commands */ ++#define W1_DS2438_READ_SCRATCH 0xBE ++#define W1_DS2438_WRITE_SCRATCH 0x4E ++#define W1_DS2438_COPY_SCRATCH 0x48 ++#define W1_DS2438_RECALL_MEMORY 0xB8 ++/* Register commands */ ++#define W1_DS2438_CONVERT_TEMP 0x44 ++#define W1_DS2438_CONVERT_VOLTAGE 0xB4 ++ ++#define DS2438_PAGE_SIZE 8 ++#define DS2438_ADC_INPUT_VAD 0 ++#define DS2438_ADC_INPUT_VDD 1 ++#define DS2438_MAX_CONVERSION_TIME 10 /* ms */ ++ ++/* Page #0 definitions */ ++#define DS2438_STATUS_REG 0x00 /* Status/Configuration Register */ ++#define DS2438_STATUS_IAD (1 << 0) /* Current A/D Control Bit */ ++#define DS2438_STATUS_CA (1 << 1) /* Current Accumulator Configuration */ ++#define DS2438_STATUS_EE (1 << 2) /* Current Accumulator Shadow Selector bit */ ++#define DS2438_STATUS_AD (1 << 3) /* Voltage A/D Input Select Bit */ ++#define DS2438_STATUS_TB (1 << 4) /* Temperature Busy Flag */ ++#define DS2438_STATUS_NVB (1 << 5) /* Nonvolatile Memory Busy Flag */ ++#define DS2438_STATUS_ADB (1 << 6) /* A/D Converter Busy Flag */ ++ ++#define DS2438_TEMP_LSB 0x01 ++#define DS2438_TEMP_MSB 0x02 ++#define DS2438_VOLTAGE_LSB 0x03 ++#define DS2438_VOLTAGE_MSB 0x04 ++#define DS2438_CURRENT_LSB 0x05 ++#define DS2438_CURRENT_MSB 0x06 ++#define DS2438_THRESHOLD 0x07 ++ ++int w1_ds2438_get_page(struct w1_slave *sl, int pageno, u8 *buf) ++{ ++ unsigned int retries = W1_DS2438_RETRIES; ++ u8 w1_buf[2]; ++ u8 crc; ++ size_t count; ++ ++ while (retries--) { ++ crc = 0; ++ ++ if (w1_reset_select_slave(sl)) ++ continue; ++ w1_buf[0] = W1_DS2438_RECALL_MEMORY; ++ w1_buf[1] = 0x00; ++ w1_write_block(sl->master, w1_buf, 2); ++ ++ if (w1_reset_select_slave(sl)) ++ continue; ++ w1_buf[0] = W1_DS2438_READ_SCRATCH; ++ w1_buf[1] = 0x00; ++ w1_write_block(sl->master, w1_buf, 2); ++ ++ count = w1_read_block(sl->master, buf, DS2438_PAGE_SIZE + 1); ++ if (count == DS2438_PAGE_SIZE + 1) { ++ crc = w1_calc_crc8(buf, DS2438_PAGE_SIZE); ++ ++ /* check for correct CRC */ ++ if ((u8)buf[DS2438_PAGE_SIZE] == crc) ++ return 0; ++ } ++ } ++ return -1; ++} ++ ++int w1_ds2438_get_temperature(struct w1_slave *sl, int16_t *temperature) ++{ ++ unsigned int retries = W1_DS2438_RETRIES; ++ u8 w1_buf[DS2438_PAGE_SIZE + 1 /*for CRC*/]; ++ unsigned int tm = DS2438_MAX_CONVERSION_TIME; ++ unsigned long sleep_rem; ++ int ret; ++ ++ mutex_lock(&sl->master->bus_mutex); ++ ++ while (retries--) { ++ if (w1_reset_select_slave(sl)) ++ continue; ++ w1_write_8(sl->master, W1_DS2438_CONVERT_TEMP); ++ ++ mutex_unlock(&sl->master->bus_mutex); ++ sleep_rem = msleep_interruptible(tm); ++ if (sleep_rem != 0) { ++ ret = -1; ++ goto post_unlock; ++ } ++ ++ if (mutex_lock_interruptible(&sl->master->bus_mutex) != 0) { ++ ret = -1; ++ goto post_unlock; ++ } ++ ++ break; ++ } ++ ++ if (w1_ds2438_get_page(sl, 0, w1_buf) == 0) { ++ *temperature = (((int16_t) w1_buf[DS2438_TEMP_MSB]) << 8) | ((uint16_t) w1_buf[DS2438_TEMP_LSB]); ++ ret = 0; ++ } else ++ ret = -1; ++ ++ mutex_unlock(&sl->master->bus_mutex); ++ ++post_unlock: ++ return ret; ++} ++ ++int w1_ds2438_change_config_bit(struct w1_slave *sl, u8 mask, u8 value) ++{ ++ unsigned int retries = W1_DS2438_RETRIES; ++ u8 w1_buf[3]; ++ u8 status; ++ int perform_write = 0; ++ ++ while (retries--) { ++ if (w1_reset_select_slave(sl)) ++ continue; ++ w1_buf[0] = W1_DS2438_RECALL_MEMORY; ++ w1_buf[1] = 0x00; ++ w1_write_block(sl->master, w1_buf, 2); ++ ++ if (w1_reset_select_slave(sl)) ++ continue; ++ w1_buf[0] = W1_DS2438_READ_SCRATCH; ++ w1_buf[1] = 0x00; ++ w1_write_block(sl->master, w1_buf, 2); ++ ++ /* reading one byte of result */ ++ status = w1_read_8(sl->master); ++ ++ /* if bit0=1, set a value to a mask for easy compare */ ++ if (value) ++ value = mask; ++ ++ if ((status & mask) == value) ++ return 0; /* already set as requested */ ++ else { ++ /* changing bit */ ++ status ^= mask; ++ perform_write = 1; ++ } ++ break; ++ } ++ ++ if (perform_write) { ++ retries = W1_DS2438_RETRIES; ++ while (retries--) { ++ if (w1_reset_select_slave(sl)) ++ continue; ++ w1_buf[0] = W1_DS2438_WRITE_SCRATCH; ++ w1_buf[1] = 0x00; ++ w1_buf[2] = status; ++ w1_write_block(sl->master, w1_buf, 3); ++ ++ if (w1_reset_select_slave(sl)) ++ continue; ++ w1_buf[0] = W1_DS2438_COPY_SCRATCH; ++ w1_buf[1] = 0x00; ++ w1_write_block(sl->master, w1_buf, 2); ++ ++ return 0; ++ } ++ } ++ return -1; ++} ++ ++uint16_t w1_ds2438_get_voltage(struct w1_slave *sl, int adc_input, uint16_t *voltage) ++{ ++ unsigned int retries = W1_DS2438_RETRIES; ++ u8 w1_buf[DS2438_PAGE_SIZE + 1 /*for CRC*/]; ++ unsigned int tm = DS2438_MAX_CONVERSION_TIME; ++ unsigned long sleep_rem; ++ int ret; ++ ++ mutex_lock(&sl->master->bus_mutex); ++ ++ if (w1_ds2438_change_config_bit(sl, DS2438_STATUS_AD, adc_input)) { ++ ret = -1; ++ goto pre_unlock; ++ } ++ ++ while (retries--) { ++ if (w1_reset_select_slave(sl)) ++ continue; ++ w1_write_8(sl->master, W1_DS2438_CONVERT_VOLTAGE); ++ ++ mutex_unlock(&sl->master->bus_mutex); ++ sleep_rem = msleep_interruptible(tm); ++ if (sleep_rem != 0) { ++ ret = -1; ++ goto post_unlock; ++ } ++ ++ if (mutex_lock_interruptible(&sl->master->bus_mutex) != 0) { ++ ret = -1; ++ goto post_unlock; ++ } ++ ++ break; ++ } ++ ++ if (w1_ds2438_get_page(sl, 0, w1_buf) == 0) { ++ *voltage = (((uint16_t) w1_buf[DS2438_VOLTAGE_MSB]) << 8) | ((uint16_t) w1_buf[DS2438_VOLTAGE_LSB]); ++ ret = 0; ++ } else ++ ret = -1; ++ ++pre_unlock: ++ mutex_unlock(&sl->master->bus_mutex); ++ ++post_unlock: ++ return ret; ++} ++ ++static ssize_t iad_write(struct file *filp, struct kobject *kobj, ++ struct bin_attribute *bin_attr, char *buf, ++ loff_t off, size_t count) ++{ ++ struct w1_slave *sl = kobj_to_w1_slave(kobj); ++ int ret; ++ ++ if (count != 1 || off != 0) ++ return -EFAULT; ++ ++ mutex_lock(&sl->master->bus_mutex); ++ ++ if (w1_ds2438_change_config_bit(sl, DS2438_STATUS_IAD, *buf & 0x01) == 0) ++ ret = 1; ++ else ++ ret = -EIO; ++ ++ mutex_unlock(&sl->master->bus_mutex); ++ ++ return ret; ++} ++ ++static ssize_t page0_read(struct file *filp, struct kobject *kobj, ++ struct bin_attribute *bin_attr, char *buf, ++ loff_t off, size_t count) ++{ ++ struct w1_slave *sl = kobj_to_w1_slave(kobj); ++ int ret; ++ u8 w1_buf[DS2438_PAGE_SIZE + 1 /*for CRC*/]; ++ ++ if (off != 0) ++ return 0; ++ if (!buf) ++ return -EINVAL; ++ ++ mutex_lock(&sl->master->bus_mutex); ++ ++ if (w1_ds2438_get_page(sl, 0, w1_buf) == 0) { ++ memcpy(buf, &w1_buf, DS2438_PAGE_SIZE); ++ ret = DS2438_PAGE_SIZE; ++ } else ++ ret = -EIO; ++ ++ mutex_unlock(&sl->master->bus_mutex); ++ ++ return ret; ++} ++ ++static ssize_t temperature_read(struct file *filp, struct kobject *kobj, ++ struct bin_attribute *bin_attr, char *buf, ++ loff_t off, size_t count) ++{ ++ struct w1_slave *sl = kobj_to_w1_slave(kobj); ++ int ret; ++ ssize_t c = PAGE_SIZE; ++ int16_t temp; ++ ++ if (off != 0) ++ return 0; ++ if (!buf) ++ return -EINVAL; ++ ++ if (w1_ds2438_get_temperature(sl, &temp) == 0) { ++ c -= snprintf(buf + PAGE_SIZE - c, c, "%d\n", temp); ++ ret = PAGE_SIZE - c; ++ } else ++ ret = -EIO; ++ ++ return ret; ++} ++ ++static ssize_t vad_read(struct file *filp, struct kobject *kobj, ++ struct bin_attribute *bin_attr, char *buf, ++ loff_t off, size_t count) ++{ ++ struct w1_slave *sl = kobj_to_w1_slave(kobj); ++ int ret; ++ ssize_t c = PAGE_SIZE; ++ uint16_t voltage; ++ ++ if (off != 0) ++ return 0; ++ if (!buf) ++ return -EINVAL; ++ ++ if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, &voltage) == 0) { ++ c -= snprintf(buf + PAGE_SIZE - c, c, "%d\n", voltage); ++ ret = PAGE_SIZE - c; ++ } else ++ ret = -EIO; ++ ++ return ret; ++} ++ ++static ssize_t vdd_read(struct file *filp, struct kobject *kobj, ++ struct bin_attribute *bin_attr, char *buf, ++ loff_t off, size_t count) ++{ ++ struct w1_slave *sl = kobj_to_w1_slave(kobj); ++ int ret; ++ ssize_t c = PAGE_SIZE; ++ uint16_t voltage; ++ ++ if (off != 0) ++ return 0; ++ if (!buf) ++ return -EINVAL; ++ ++ if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, &voltage) == 0) { ++ c -= snprintf(buf + PAGE_SIZE - c, c, "%d\n", voltage); ++ ret = PAGE_SIZE - c; ++ } else ++ ret = -EIO; ++ ++ return ret; ++} ++ ++static BIN_ATTR(iad, S_IRUGO | S_IWUSR | S_IWGRP, NULL, iad_write, 1); ++static BIN_ATTR_RO(page0, DS2438_PAGE_SIZE); ++static BIN_ATTR_RO(temperature, 0/* real length varies */); ++static BIN_ATTR_RO(vad, 0/* real length varies */); ++static BIN_ATTR_RO(vdd, 0/* real length varies */); ++ ++static struct bin_attribute *w1_ds2438_bin_attrs[] = { ++ &bin_attr_iad, ++ &bin_attr_page0, ++ &bin_attr_temperature, ++ &bin_attr_vad, ++ &bin_attr_vdd, ++ NULL, ++}; ++ ++static const struct attribute_group w1_ds2438_group = { ++ .bin_attrs = w1_ds2438_bin_attrs, ++}; ++ ++static const struct attribute_group *w1_ds2438_groups[] = { ++ &w1_ds2438_group, ++ NULL, ++}; ++ ++static struct w1_family_ops w1_ds2438_fops = { ++ .groups = w1_ds2438_groups, ++}; ++ ++static struct w1_family w1_ds2438_family = { ++ .fid = W1_FAMILY_DS2438, ++ .fops = &w1_ds2438_fops, ++}; ++module_w1_family(w1_ds2438_family); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Mariusz Bialonczyk "); ++MODULE_DESCRIPTION("1-wire driver for Maxim/Dallas DS2438 Smart Battery Monitor"); ++MODULE_ALIAS("w1-family-" __stringify(W1_FAMILY_DS2438)); +diff --git a/drivers/w1/w1_family.h b/drivers/w1/w1_family.h +index 10a7a0767187c52d67a41c3fcffa7ecd38c80e63..627c90a1cb4e7872078cb773b271e2a58d0b95ed 100644 +--- a/drivers/w1/w1_family.h ++++ b/drivers/w1/w1_family.h +@@ -35,6 +35,7 @@ + #define W1_COUNTER_DS2423 0x1D + #define W1_THERM_DS1822 0x22 + #define W1_EEPROM_DS2433 0x23 ++#define W1_FAMILY_DS2438 0x26 + #define W1_THERM_DS18B20 0x28 + #define W1_FAMILY_DS2408 0x29 + #define W1_EEPROM_DS2431 0x2D + +From 37d227aebf624802911c727c2cc583a007a02fed Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 16 Aug 2017 16:52:50 +0100 +Subject: [PATCH 395/407] BCM270X_DT: Set spidev spi-max-frequency to 125MHz + +The BCM2835 SPI controllers have a maximum bus clock of half the system +clock speed, so with the 250MHz system clock found on Raspberry Pis +you get a theoretical maximum bus speed of 125MHz. Note that this +speed is unlikely to be reliable, and the maximum usable bus spee will +depend on both the attached device and the wiring. + +See: https://github.com/raspberrypi/linux/issues/2165 +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/bcm2708-rpi-0-w.dts | 4 ++-- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 4 ++-- + arch/arm/boot/dts/bcm2708-rpi-b.dts | 4 ++-- + arch/arm/boot/dts/bcm2708-rpi-cm.dts | 4 ++-- + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 4 ++-- + arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 4 ++-- + arch/arm/boot/dts/bcm2710-rpi-cm3.dts | 4 ++-- + arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts | 2 +- + arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts | 4 ++-- + arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts | 6 +++--- + arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts | 2 +- + arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts | 4 ++-- + arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts | 6 +++--- + 13 files changed, 26 insertions(+), 26 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-0-w.dts b/arch/arm/boot/dts/bcm2708-rpi-0-w.dts +index db0f99ddf2f46e83827d56e21c4846dd0b414c63..d585f052d580cc5a24b144c90a9237c25c2748ec 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-0-w.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-0-w.dts +@@ -108,7 +108,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + + spidev1: spidev@1{ +@@ -116,7 +116,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 08bf838fab551638e898930fba7ba49b3aeefbb3..ecbcfc35f2a80b9843cfbe55a21e25d7535706de 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -69,7 +69,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + + spidev1: spidev@1{ +@@ -77,7 +77,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index 4e6b4dd6a8d9c4f13bc865bb8ced68264162cb6c..2407c23d1eea3726fe6e8b29973fd430bbbfa368 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -69,7 +69,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + + spidev1: spidev@1{ +@@ -77,7 +77,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +index 10be69972bd1440f574e35d515f3d6a0505fd869..742cb65dedc18825fac79dc3788e4f71ae912060 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +@@ -52,7 +52,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + + spidev1: spidev@1{ +@@ -60,7 +60,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 2dc0e1204e6374bbc6924e26dc4a04b68718559a..7aea36283cbb6591818cb1260ba66549a972ff77 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -69,7 +69,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + + spidev1: spidev@1{ +@@ -77,7 +77,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +index cbec919208f3a7fdc2d07b46ed534c0951a76cd6..aadd762fae13f28f94ebb9370063f4c91dec5388 100644 +--- a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts ++++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +@@ -128,7 +128,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + + spidev1: spidev@1{ +@@ -136,7 +136,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2710-rpi-cm3.dts b/arch/arm/boot/dts/bcm2710-rpi-cm3.dts +index fe402e84cdda884583336422289ac8b3cc12fb28..b8b5cbc1b24cad8a4b13aee1e36b412b719d03f7 100644 +--- a/arch/arm/boot/dts/bcm2710-rpi-cm3.dts ++++ b/arch/arm/boot/dts/bcm2710-rpi-cm3.dts +@@ -89,7 +89,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + + spidev1: spidev@1{ +@@ -97,7 +97,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + }; + +diff --git a/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts +index 71c243947004fa887998065df9c259b50edfa428..c3d4f96b7aa92cd679cc8abc7c7aea1dc7c84eb6 100644 +--- a/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts ++++ b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts +@@ -36,7 +36,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts +index 2ae0885cf1e7fb7420f65e538310ab1addafbece..2ad62497dc895c6253c2a03b45e726e4f882d170 100644 +--- a/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts ++++ b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts +@@ -36,7 +36,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + +@@ -45,7 +45,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts +index 8f79044cd8f47ea055394822cc380497c985c7e5..ef82890453bfe36afd124f6a01f4ca5116b809d4 100644 +--- a/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts ++++ b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts +@@ -36,7 +36,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + +@@ -45,7 +45,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + +@@ -54,7 +54,7 @@ + reg = <2>; /* CE2 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts +index 6f57bc710fe123028a5a216063733f0cea9bbd54..761b6be4ff9b55da1bf3979c905a3cc8d87ca6fb 100644 +--- a/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts ++++ b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts +@@ -36,7 +36,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts +index d090631d36821b0c89833b9f217216f0b134a8f3..e533aba113deddd35ed3f9f6628eb130f1e09095 100644 +--- a/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts ++++ b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts +@@ -36,7 +36,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + +@@ -45,7 +45,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts +index e2586728c311829462f6a4b3b348e35603f033ce..a62e107dc98fa484bcaad7f8caddfca450d0aea6 100644 +--- a/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts ++++ b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts +@@ -36,7 +36,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + +@@ -45,7 +45,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + +@@ -54,7 +54,7 @@ + reg = <2>; /* CE2 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + }; + +From 4c322879fed3671a195da41e2fa0827d65600525 Mon Sep 17 00:00:00 2001 +From: neilneil2000 <31366098+neilneil2000@users.noreply.github.com> +Date: Thu, 12 Oct 2017 17:29:43 +0100 +Subject: [PATCH 396/407] GPIO and gpio-poweroff clarifications + +Notes added: +1) All GPIO references use the hardware numbering scheme +2) Enabling gpio-poweroff prevents the ability to boot the pi by driving GPIO3 low +--- + arch/arm/boot/dts/overlays/README | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index d4eeeae10671ddfb43c86c1317cea65688905d9f..011b2c696df709dadddc62e7001737bd9bb134fd 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -33,6 +33,9 @@ needed. + Configuring additional, optional hardware is done using Device Tree overlays + (see below). + ++GPIO numbering uses the hardware pin numbering scheme (aka BCM scheme) and ++not the physical pin numbers. ++ + raspi-config + ============ + +@@ -496,7 +499,8 @@ Params: gpio_pin Input pin number. Default is 18. + + + Name: gpio-poweroff +-Info: Drives a GPIO high or low on poweroff (including halt) ++Info: Drives a GPIO high or low on poweroff (including halt). Enabling this ++ overlay will prevent the ability to boot by driving GPIO3 low. + Load: dtoverlay=gpio-poweroff,= + Params: gpiopin GPIO for signalling (default 26) + + +From b4c9601ccf54d855e3b55e946d24a32df7b3dda6 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 13 Oct 2017 08:47:50 +0100 +Subject: [PATCH 397/407] overlays/README: Remove trailing whitespace + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/overlays/README | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 011b2c696df709dadddc62e7001737bd9bb134fd..3f5924f5375fcb8de86dae8686e2cd730ec1944d 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -33,7 +33,7 @@ needed. + Configuring additional, optional hardware is done using Device Tree overlays + (see below). + +-GPIO numbering uses the hardware pin numbering scheme (aka BCM scheme) and ++GPIO numbering uses the hardware pin numbering scheme (aka BCM scheme) and + not the physical pin numbers. + + raspi-config + +From 19296ba75ae66a70d91b6e8e47d72caf6cf55da6 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 15 Aug 2017 16:48:46 +0100 +Subject: [PATCH 398/407] config: Enable CONFIG_BRCMDBG temporarily for + debugging + +--- + arch/arm/configs/bcm2709_defconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 32f70a26fef4f9b4132233dc07d85ed92452b393..75ac6d4bbbc034f2845438b211e9b206db92a583 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -524,6 +524,7 @@ CONFIG_B43=m + CONFIG_B43LEGACY=m + CONFIG_BRCMFMAC=m + CONFIG_BRCMFMAC_USB=y ++CONFIG_BRCMDBG=y + CONFIG_HOSTAP=m + CONFIG_P54_COMMON=m + CONFIG_P54_USB=m + +From 8cf09045231e868eb65af1a196191ea85b9e6508 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 14 Sep 2017 16:16:24 +0100 +Subject: [PATCH 399/407] config: Add CONFIG_GPIO_WATCHDOG=m + +Enable the gpio_wdt module, to support external watchdogs. + +See: https://github.com/raspberrypi/linux/issues/2199 + +Signed-off-by: Phil Elwell +--- + arch/arm/configs/bcm2709_defconfig | 1 + + arch/arm/configs/bcmrpi_defconfig | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 75ac6d4bbbc034f2845438b211e9b206db92a583..49fc19d58ee82e503da34c9acf62c6ebcb5696e8 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -667,6 +667,7 @@ CONFIG_SENSORS_TMP102=m + CONFIG_THERMAL=y + CONFIG_THERMAL_BCM2835=y + CONFIG_WATCHDOG=y ++CONFIG_GPIO_WATCHDOG=m + CONFIG_BCM2835_WDT=y + CONFIG_UCB1400_CORE=m + CONFIG_MFD_STMPE=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 43b258bf0f951982e32005e8235110cf5eed48cf..bc848ec4917322e116e32cc5c1fc5af9afa8d4a3 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -660,6 +660,7 @@ CONFIG_SENSORS_TMP102=m + CONFIG_THERMAL=y + CONFIG_THERMAL_BCM2835=y + CONFIG_WATCHDOG=y ++CONFIG_GPIO_WATCHDOG=m + CONFIG_BCM2835_WDT=y + CONFIG_UCB1400_CORE=m + CONFIG_MFD_STMPE=y + +From b1615894b280f41c7ef2bbbe9355200ad81b4621 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 17 Oct 2017 17:17:20 +0100 +Subject: [PATCH 400/407] config: Add CONFIG_USB_LAN78XX=m + +Signed-off-by: Phil Elwell +--- + arch/arm/configs/bcm2709_defconfig | 1 + + arch/arm/configs/bcmrpi_defconfig | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 49fc19d58ee82e503da34c9acf62c6ebcb5696e8..889922c425ea6aa9708b1a1ef6ec9a74e9ced475 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -481,6 +481,7 @@ CONFIG_USB_KAWETH=m + CONFIG_USB_PEGASUS=m + CONFIG_USB_RTL8150=m + CONFIG_USB_RTL8152=m ++CONFIG_USB_LAN78XX=m + CONFIG_USB_USBNET=y + CONFIG_USB_NET_AX8817X=m + CONFIG_USB_NET_AX88179_178A=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index bc848ec4917322e116e32cc5c1fc5af9afa8d4a3..e44c3a11d80e66852e24326b081cdb62019042a5 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -477,6 +477,7 @@ CONFIG_USB_KAWETH=m + CONFIG_USB_PEGASUS=m + CONFIG_USB_RTL8150=m + CONFIG_USB_RTL8152=m ++CONFIG_USB_LAN78XX=m + CONFIG_USB_USBNET=y + CONFIG_USB_NET_AX8817X=m + CONFIG_USB_NET_AX88179_178A=m + +From e0165d0b6057f20af5f909c03d1df0cf314abae9 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 27 Oct 2017 21:34:12 +0100 +Subject: [PATCH 401/407] config: Add CONFIG_W1_SLAVE_DS2438=m + +See: https://github.com/raspberrypi/linux/issues/2246 +--- + arch/arm/configs/bcm2709_defconfig | 1 + + arch/arm/configs/bcmrpi_defconfig | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 889922c425ea6aa9708b1a1ef6ec9a74e9ced475..10be4184f8bfd29a66dba59fe8bfb438ef04f7c4 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -649,6 +649,7 @@ CONFIG_W1_SLAVE_DS2406=m + CONFIG_W1_SLAVE_DS2423=m + CONFIG_W1_SLAVE_DS2431=m + CONFIG_W1_SLAVE_DS2433=m ++CONFIG_W1_SLAVE_DS2438=m + CONFIG_W1_SLAVE_DS2760=m + CONFIG_W1_SLAVE_DS2780=m + CONFIG_W1_SLAVE_DS2781=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index e44c3a11d80e66852e24326b081cdb62019042a5..7b19098a3af9bb548a8a40f3a9d15533f92433e6 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -642,6 +642,7 @@ CONFIG_W1_SLAVE_DS2406=m + CONFIG_W1_SLAVE_DS2423=m + CONFIG_W1_SLAVE_DS2431=m + CONFIG_W1_SLAVE_DS2433=m ++CONFIG_W1_SLAVE_DS2438=m + CONFIG_W1_SLAVE_DS2760=m + CONFIG_W1_SLAVE_DS2780=m + CONFIG_W1_SLAVE_DS2781=m + +From 9020ece88eb585b9a2e6c3d00f55dc4dfda74162 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 16 Aug 2017 22:01:33 +0100 +Subject: [PATCH 402/407] config: Enable CONFIG_BRCMDBG temporarily for + debugging on pi0 + +--- + arch/arm/configs/bcmrpi_defconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 7b19098a3af9bb548a8a40f3a9d15533f92433e6..76842f6fd2c5ed729b19bcc955385e4f3d3c5408 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -521,6 +521,7 @@ CONFIG_B43=m + CONFIG_B43LEGACY=m + CONFIG_BRCMFMAC=m + CONFIG_BRCMFMAC_USB=y ++CONFIG_BRCMDBG=y + CONFIG_HOSTAP=m + CONFIG_P54_COMMON=m + CONFIG_P54_USB=m + +From e35a128c16cabb8923fb7f19f03b3d603aa871bf Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 18 Sep 2017 10:07:54 +0100 +Subject: [PATCH 403/407] Revert "config: Enable CONFIG_MEMCG, but leave it + disabled (due to memory cost). Enable with cgroup_enable=memory." + +This reverts commit 7dbc189967bef8e7f431c982557d0e73eb13f161. +--- + kernel/cgroup.c | 24 +----------------------- + 1 file changed, 1 insertion(+), 23 deletions(-) + +diff --git a/kernel/cgroup.c b/kernel/cgroup.c +index 2650df194b5d0bb39bb92c295d93f691b00faffb..2c785f9570243879d79b277d27393485824b5056 100644 +--- a/kernel/cgroup.c ++++ b/kernel/cgroup.c +@@ -5637,7 +5637,7 @@ int __init cgroup_init_early(void) + return 0; + } + +-static u16 cgroup_disable_mask __initdata = 1<<0; ++static u16 cgroup_disable_mask __initdata; + + /** + * cgroup_init - cgroup initialization +@@ -6178,28 +6178,6 @@ static int __init cgroup_no_v1(char *str) + } + __setup("cgroup_no_v1=", cgroup_no_v1); + +-static int __init cgroup_enable(char *str) +-{ +- struct cgroup_subsys *ss; +- char *token; +- int i; +- +- while ((token = strsep(&str, ",")) != NULL) { +- if (!*token) +- continue; +- +- for_each_subsys(ss, i) { +- if (strcmp(token, ss->name) && +- strcmp(token, ss->legacy_name)) +- continue; +- +- cgroup_disable_mask &= ~(1 << i); +- } +- } +- return 1; +-} +-__setup("cgroup_enable=", cgroup_enable); +- + /** + * css_tryget_online_from_dir - get corresponding css from a cgroup dentry + * @dentry: directory dentry of interest + +From 1706b6f999758903976da41342038c53a5ff1881 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 18 Sep 2017 12:01:46 +0100 +Subject: [PATCH 404/407] cgroup: Add kernel param to enable memory group + +cgroup support is useful, but enabling the "memory" cgroup has a 32-byte +overhead per page. Arrange that "memory" cgroup is disabled by default +unless the "cgroup_memory" parameter is set to a true value. + +See: https://github.com/raspberrypi/issues/1950 + +Signed-off-by: Phil Elwell +--- + kernel/cgroup.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/kernel/cgroup.c b/kernel/cgroup.c +index 2c785f9570243879d79b277d27393485824b5056..c3f5abf0fd7a47af325f97fa5342e799745fbeae 100644 +--- a/kernel/cgroup.c ++++ b/kernel/cgroup.c +@@ -5638,6 +5638,8 @@ int __init cgroup_init_early(void) + } + + static u16 cgroup_disable_mask __initdata; ++static bool cgroup_enable_memory; ++static int __init cgroup_disable(char *str); + + /** + * cgroup_init - cgroup initialization +@@ -5676,6 +5678,9 @@ int __init cgroup_init(void) + + mutex_unlock(&cgroup_mutex); + ++ if (!cgroup_enable_memory) ++ cgroup_disable("memory"); ++ + for_each_subsys(ss, ssid) { + if (ss->early_init) { + struct cgroup_subsys_state *css = +@@ -6151,6 +6156,13 @@ static int __init cgroup_disable(char *str) + } + __setup("cgroup_disable=", cgroup_disable); + ++static int __init cgroup_memory(char *str) ++{ ++ kstrtobool(str, &cgroup_enable_memory); ++ return 1; ++} ++__setup("cgroup_memory=", cgroup_memory); ++ + static int __init cgroup_no_v1(char *str) + { + struct cgroup_subsys *ss; + +From f2fcbde5ba3e5b5596500af548fc19d72bf28366 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 25 Oct 2017 09:20:56 +0100 +Subject: [PATCH 405/407] scripts: Update mkknlimg, just in case + +With the removal of the vc_cma driver, mkknlimg lost an indication that +the user had built a downstream kernel. Update the script, adding a few +more key strings, in case it is still being used. + +Note that mkknlimg is now deprecated, except to tag kernels as upstream +(283x), and thus requiring upstream DTBs. + +See: https://github.com/raspberrypi/linux/issues/2239 + +Signed-off-by: Phil Elwell +--- + scripts/mkknlimg | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/scripts/mkknlimg b/scripts/mkknlimg +index 60206de7fa9a49bd027c635306674a29a568652f..d72e15224232d5164374e93be48949bf596266ef 100755 +--- a/scripts/mkknlimg ++++ b/scripts/mkknlimg +@@ -68,17 +68,15 @@ if (! -r $kernel_file) + + my $wanted_strings = + { +- 'bcm2708_fb' => FLAG_PI, + 'brcm,bcm2835-mmc' => FLAG_PI, + 'brcm,bcm2835-sdhost' => FLAG_PI, +- 'brcm,bcm2708-pinctrl' => FLAG_PI | FLAG_DTOK, + 'brcm,bcm2835-gpio' => FLAG_PI | FLAG_DTOK, +- 'brcm,bcm2708' => FLAG_PI | FLAG_DTOK | FLAG_270X, +- 'brcm,bcm2709' => FLAG_PI | FLAG_DTOK | FLAG_270X, ++ 'brcm,bcm2708-fb' => FLAG_PI | FLAG_DTOK | FLAG_270X, ++ 'brcm,bcm2708-usb' => FLAG_PI | FLAG_DTOK | FLAG_270X, + 'brcm,bcm2835' => FLAG_PI | FLAG_DTOK | FLAG_283X, + 'brcm,bcm2836' => FLAG_PI | FLAG_DTOK | FLAG_283X, ++ 'brcm,bcm2837' => FLAG_PI | FLAG_DTOK | FLAG_283X, + 'of_cfs_init' => FLAG_DTOK | FLAG_DDTK, +- 'vc_cma_init' => FLAG_PI | FLAG_270X, + }; + + my $res = try_extract($kernel_file, $tmpfile1); + +From 537e940ca5771b6ef4b9be03e92a1a3b6a3e050f Mon Sep 17 00:00:00 2001 +From: Allo +Date: Mon, 16 Oct 2017 22:22:24 +0530 +Subject: [PATCH 406/407] Bug fix: initial max volume level & default mode + value. (#2224) + +Bug fix: initial max volume level & default mode value. + +Signed-off-by: allocom +--- + sound/soc/bcm/allo-piano-dac-plus.c | 33 ++++++++++++++++++++------------- + 1 file changed, 20 insertions(+), 13 deletions(-) + +diff --git a/sound/soc/bcm/allo-piano-dac-plus.c b/sound/soc/bcm/allo-piano-dac-plus.c +index 730f57cb6730bb825b6a0aab1eadbb27ac07795d..1800f5e4d414e2d83a9487a89a2800a3e1ec01b1 100644 +--- a/sound/soc/bcm/allo-piano-dac-plus.c ++++ b/sound/soc/bcm/allo-piano-dac-plus.c +@@ -118,7 +118,7 @@ static int __snd_allo_piano_dsp_program(struct snd_soc_pcm_runtime *rtd, + rate = 192000; + + if (lowpass > 14) +- glb_ptr->set_lowpass = lowpass = 3; ++ glb_ptr->set_lowpass = lowpass = 0; + + if (mode > 3) + glb_ptr->set_mode = mode = 0; +@@ -262,6 +262,7 @@ static int snd_allo_piano_dual_mode_put(struct snd_kcontrol *kcontrol, + glb_ptr->set_mode = 0; + } else { + glb_ptr->dual_mode = 0; ++ return 0; + } + } + +@@ -441,6 +442,14 @@ static int pcm512x_set_reg_sub(struct snd_kcontrol *kcontrol, + return ret; + } + ++ if (digital_gain_0db_limit) { ++ ret = snd_soc_limit_volume(card, "Subwoofer Playback Volume", ++ 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ++ ret); ++ } ++ + ret = snd_soc_write(rtd->codec_dais[1]->codec, + PCM512x_DIGITAL_VOLUME_3, (~right_val)); + if (ret < 0) +@@ -541,6 +550,14 @@ static int pcm512x_set_reg_master(struct snd_kcontrol *kcontrol, + + rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name); + ++ if (digital_gain_0db_limit) { ++ ret = snd_soc_limit_volume(card, "Master Playback Volume", ++ 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ++ ret); ++ } ++ + if (glb_ptr->dual_mode != 1) { + ret = snd_soc_write(rtd->codec_dais[1]->codec, + PCM512x_DIGITAL_VOLUME_2, (~left_val)); +@@ -693,6 +710,8 @@ static int snd_allo_piano_dac_init(struct snd_soc_pcm_runtime *rtd) + + memset(glb_ptr, 0x00, sizeof(glb_ptr)); + card->drvdata = glb_ptr; ++ glb_ptr->dual_mode = 2; ++ glb_ptr->set_mode = 0; + + mutex_init(&glb_ptr->lock); + +@@ -815,18 +834,6 @@ static int snd_allo_piano_dac_hw_params( + } + } + +- if (digital_gain_0db_limit) { +- ret = snd_soc_limit_volume(card, +- "Subwoofer Playback Volume", 207); +- if (ret < 0) +- dev_warn(card->dev, "Failed to set volume limit: %d\n", +- ret); +- ret = snd_soc_limit_volume(card, "Master Playback Volume", 207); +- if (ret < 0) +- dev_warn(card->dev, "Failed to set volume limit: %d\n", +- ret); +- } +- + ret = snd_allo_piano_dsp_program(rtd, glb_ptr->set_mode, rate, + glb_ptr->set_lowpass); + if (ret < 0) + +From fc904163584c253f5ad237dc6918b0fdf91dd7c2 Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek +Date: Tue, 17 Oct 2017 10:30:28 +0200 +Subject: [PATCH 407/407] Fixed a bug when using 352.8kHz sample rate + +Signed-off-by: Daniel Matuschek +--- + sound/soc/bcm/hifiberry_dacplus.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c +index b7b401cbe2b0d510d8b12d2dda6d5ff1fff42eb0..16697dd6c6db6856022731a07a9a1653dd94b9f5 100644 +--- a/sound/soc/bcm/hifiberry_dacplus.c ++++ b/sound/soc/bcm/hifiberry_dacplus.c +@@ -117,6 +117,7 @@ static int snd_rpi_hifiberry_dacplus_clk_for_rate(int sample_rate) + case 44100: + case 88200: + case 176400: ++ case 352800: + type = HIFIBERRY_DACPRO_CLK44EN; + break; + default: diff --git a/projects/RPi2/patches/linux/linux-01-RPi_support.patch b/projects/RPi2/patches/linux/linux-01-RPi_support.patch index eb672316bb..fce93fdfd8 100644 --- a/projects/RPi2/patches/linux/linux-01-RPi_support.patch +++ b/projects/RPi2/patches/linux/linux-01-RPi_support.patch @@ -1,7 +1,7 @@ -From cb6c7b02883f12f903d71c3d69a084bf453062bd Mon Sep 17 00:00:00 2001 +From e1d243c06c5596cafb7163b42258d7e8d547f4bc Mon Sep 17 00:00:00 2001 From: Steve Glendinning Date: Thu, 19 Feb 2015 18:47:12 +0000 -Subject: [PATCH 001/333] smsx95xx: fix crimes against truesize +Subject: [PATCH 001/407] smsx95xx: fix crimes against truesize smsc95xx is adjusting truesize when it shouldn't, and following a recent patch from Eric this is now triggering warnings. @@ -48,10 +48,10 @@ index 831aa33d078ae7d2dd57fdded5de71d1eb915f99..b77935bded8c0ff7808b00f170ff10e5 usbnet_skb_return(dev, ax_skb); } -From d09ed23cc9c1f56459c75c61878c58e52019f10c Mon Sep 17 00:00:00 2001 +From fae7f20a43788162ddcfd0f46a1bee2248673899 Mon Sep 17 00:00:00 2001 From: Sam Nazarko Date: Fri, 1 Apr 2016 17:27:21 +0100 -Subject: [PATCH 002/333] smsc95xx: Experimental: Enable turbo_mode and +Subject: [PATCH 002/407] smsc95xx: Experimental: Enable turbo_mode and packetsize=2560 by default See: http://forum.kodi.tv/showthread.php?tid=285288 @@ -94,10 +94,10 @@ index b77935bded8c0ff7808b00f170ff10e594300ad0..693f163684de921404738e33244881e0 netif_dbg(dev, ifup, dev->net, "rx_urb_size=%ld\n", -From 2e231430ec6b73340e4292eb699c6877206ea3e6 Mon Sep 17 00:00:00 2001 +From cf6fb036267f281dba2b46256a1b14151cb8c0c2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 003/333] Allow mac address to be set in smsc95xx +Subject: [PATCH 003/407] Allow mac address to be set in smsc95xx Signed-off-by: popcornmix --- @@ -193,10 +193,10 @@ index 693f163684de921404738e33244881e0aab92ec9..df60c989fc229bf0aab3c27e95ccd453 eth_hw_addr_random(dev->net); netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); -From f3fa5610d502ab0727495d76da9ee9504f335f4c Mon Sep 17 00:00:00 2001 +From 41757cea052deabb7a61bcf7e1b57eacc7764d75 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 13 Mar 2015 12:43:36 +0000 -Subject: [PATCH 004/333] Protect __release_resource against resources without +Subject: [PATCH 004/407] Protect __release_resource against resources without parents Without this patch, removing a device tree overlay can crash here. @@ -224,38 +224,10 @@ index 9b5f04404152c296af3a96132f27cfc80ffa9af9..f8a9af6e6b915812be2ba2c1c2b40106 for (;;) { tmp = *p; -From 4475ce72ed646839792779fbe32a1677382e020e Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Thu, 18 Dec 2014 16:07:15 -0800 -Subject: [PATCH 005/333] mm: Remove the PFN busy warning - -See commit dae803e165a11bc88ca8dbc07a11077caf97bbcb -- the warning is -expected sometimes when using CMA. However, that commit still spams -my kernel log with these warnings. - -Signed-off-by: Eric Anholt ---- - mm/page_alloc.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/mm/page_alloc.c b/mm/page_alloc.c -index 77b797c2d094c04d15e5afc8ca4b7b0527481f0c..96b753469c796c300db17571a52b9f649d626c5d 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -7335,8 +7335,6 @@ int alloc_contig_range(unsigned long start, unsigned long end, - - /* Make sure the range is really isolated. */ - if (test_pages_isolated(outer_start, end, false)) { -- pr_info("%s: [%lx, %lx) PFNs busy\n", -- __func__, outer_start, end); - ret = -EBUSY; - goto done; - } - -From aed8dbf6a6f7433226315d2603223d471ab67065 Mon Sep 17 00:00:00 2001 +From ba3cfb5227397ae7bf9b3903989838e65f10d816 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 4 Dec 2015 17:41:50 +0000 -Subject: [PATCH 006/333] irq-bcm2836: Prevent spurious interrupts, and trap +Subject: [PATCH 005/407] irq-bcm2836: Prevent spurious interrupts, and trap them early The old arch-specific IRQ macros included a dsb to ensure the @@ -282,10 +254,10 @@ index d96b2c947e74e3edab3917551c64fbd1ced0f34c..93e3f7660c4230c9f1dd3b195958cb49 #endif } else if (stat) { -From 356a3b55384324cb45be6ae24b730208dde0fa68 Mon Sep 17 00:00:00 2001 +From c52627cdd4c2be2e690114679179e0a356b881ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 12 Jun 2015 19:01:05 +0200 -Subject: [PATCH 007/333] irqchip: bcm2835: Add FIQ support +Subject: [PATCH 006/407] irqchip: bcm2835: Add FIQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -414,10 +386,10 @@ index 44d7c38dde479d771f3552e914bf8c1c1f5019f7..42ff5e6a8e0d532f5b60a1e7af7cc4d9 } -From 5f294f30378f1529740f71bd6edf9ed2df8c8716 Mon Sep 17 00:00:00 2001 +From f74e182870fc4382a0115644621d4206fb339d32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 23 Oct 2015 16:26:55 +0200 -Subject: [PATCH 008/333] irqchip: irq-bcm2835: Add 2836 FIQ support +Subject: [PATCH 007/407] irqchip: irq-bcm2835: Add 2836 FIQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -516,10 +488,10 @@ index 42ff5e6a8e0d532f5b60a1e7af7cc4d941bd5008..eccf6ed025299cb480884f5bcbe77abf for (b = 0; b < NR_BANKS; b++) { for (i = 0; i < bank_irqs[b]; i++) { -From 551fc81889dbc3c8123c7e77964880cbb25926fa Mon Sep 17 00:00:00 2001 +From fbd9629abc450df824ec29cd26a58ff5121f44b6 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 14 Jul 2015 10:26:09 +0100 -Subject: [PATCH 009/333] spidev: Add "spidev" compatible string to silence +Subject: [PATCH 008/407] spidev: Add "spidev" compatible string to silence warning See: https://github.com/raspberrypi/linux/issues/1054 @@ -540,10 +512,10 @@ index 2e05046f866bd01bf87edcdeff0d5b76d4d0aea7..d780491b8013a4e97fa843958964454e }; MODULE_DEVICE_TABLE(of, spidev_dt_ids); -From 74119a353aab6a5b4ff1ae737d53fe957b40ea78 Mon Sep 17 00:00:00 2001 +From ba9574119aa2d5e74b98f3ea1fe68df0d7a01fad Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 30 Jun 2015 14:12:42 +0100 -Subject: [PATCH 010/333] serial: 8250: Don't crash when nr_uarts is 0 +Subject: [PATCH 009/407] serial: 8250: Don't crash when nr_uarts is 0 --- drivers/tty/serial/8250/8250_core.c | 2 ++ @@ -563,10 +535,10 @@ index e8819aa20415603c80547e382838a8fa3ce54792..cf9c7d2e3f95e1a19410247a89c2e49c for (i = 0; i < nr_uarts; i++) { struct uart_8250_port *up = &serial8250_ports[i]; -From 20cbfc41f269111552b8b7fc722e44a3975dbde7 Mon Sep 17 00:00:00 2001 +From 39af1fd4a914b16f388238e373cd56f0c37ea8f6 Mon Sep 17 00:00:00 2001 From: notro Date: Thu, 10 Jul 2014 13:59:47 +0200 -Subject: [PATCH 011/333] pinctrl-bcm2835: Set base to 0 give expected gpio +Subject: [PATCH 010/407] pinctrl-bcm2835: Set base to 0 give expected gpio numbering Signed-off-by: Noralf Tronnes @@ -588,10 +560,10 @@ index fa77165fab2c1348163979da507df17e7168c49b..d11e2e4ea189466e686d762cb6c6fef9 .can_sleep = false, }; -From 20d3210b191d525ed5790b9814b900445b8486c6 Mon Sep 17 00:00:00 2001 +From cffcdc3b45cfd1ad1b64bb22b74ebca294dc16e2 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 24 Feb 2015 13:40:50 +0000 -Subject: [PATCH 012/333] pinctrl-bcm2835: Fix interrupt handling for GPIOs +Subject: [PATCH 011/407] pinctrl-bcm2835: Fix interrupt handling for GPIOs 28-31 and 46-53 Contrary to the documentation, the BCM2835 GPIO controller actually has @@ -737,10 +709,10 @@ index d11e2e4ea189466e686d762cb6c6fef9111ecf8e..107ad7d58de8f8a7f55e09c9cdcf7d66 }, }; -From 3db36cddf0584c7587332f45dd91a6c2c5a94e7f Mon Sep 17 00:00:00 2001 +From 06b777c5678d02834d471cb62feef95e5163027a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 26 Feb 2015 09:58:22 +0000 -Subject: [PATCH 013/333] pinctrl-bcm2835: Only request the interrupts listed +Subject: [PATCH 012/407] pinctrl-bcm2835: Only request the interrupts listed in the DTB Although the GPIO controller can generate three interrupts (four counting @@ -767,10 +739,10 @@ index 107ad7d58de8f8a7f55e09c9cdcf7d66fa7ab66b..644bdecbcfcb79d3b84a33769265fca5 pc->irq_data[i].irqgroup = i; -From d1dc72f13d76949f837b1198c8531c784464e411 Mon Sep 17 00:00:00 2001 +From 1cc6f083c797d2f9816dc3c720a0b50182a8bcec Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 6 May 2016 12:32:47 +0100 -Subject: [PATCH 014/333] pinctrl-bcm2835: Return pins to inputs when freed +Subject: [PATCH 013/407] pinctrl-bcm2835: Return pins to inputs when freed When dynamically unloading overlays, it is important that freed pins are restored to being inputs to prevent functions from being enabled in @@ -811,10 +783,10 @@ index 644bdecbcfcb79d3b84a33769265fca5d3d0c9e5..81a66cba2ab0f7e3ae179de7edd10122 .get_function_name = bcm2835_pmx_get_function_name, .get_function_groups = bcm2835_pmx_get_function_groups, -From 7075e707beab7ec7ee548af64e09b87b9281daf6 Mon Sep 17 00:00:00 2001 +From d951272d426a28ff3127b0e076c8c4b55615e582 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Jun 2015 14:10:44 +0100 -Subject: [PATCH 015/333] spi-bcm2835: Support pin groups other than 7-11 +Subject: [PATCH 014/407] spi-bcm2835: Support pin groups other than 7-11 The spi-bcm2835 driver automatically uses GPIO chip-selects due to some unreliability of the native ones. In doing so it chooses the @@ -895,10 +867,10 @@ index f35cc10772f6670397ea923ad30158270dd68578..5dfe20ffc2866fa6789825016c585175 /* and set up the "mode" and level */ dev_info(&spi->dev, "setting up native-CS%i as GPIO %i\n", -From a4aa5d7e264bfe688b9c264194f5a08cb5adfb37 Mon Sep 17 00:00:00 2001 +From b50a8360b376fc32b545a6ae49652421a9fee943 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 1 Jul 2016 22:09:24 +0100 -Subject: [PATCH 016/333] spi-bcm2835: Disable forced software CS +Subject: [PATCH 015/407] spi-bcm2835: Disable forced software CS Select software CS in bcm2708_common.dtsi, and disable the automatic conversion in the driver to allow hardware CS to be re-enabled with an @@ -932,10 +904,10 @@ index 5dfe20ffc2866fa6789825016c585175a29705b6..8493474d286f7a1ac6454a22c61c8c2c return 0; } -From 617a0b1f16de4bc8f806799a6e4b4b53ce288f84 Mon Sep 17 00:00:00 2001 +From 7a6a431dbd119629bfaafa6c76f85fe1e38e5ad5 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 8 Nov 2016 21:35:38 +0000 -Subject: [PATCH 017/333] spi-bcm2835: Remove unused code +Subject: [PATCH 016/407] spi-bcm2835: Remove unused code --- drivers/spi/spi-bcm2835.c | 61 ----------------------------------------------- @@ -1023,10 +995,10 @@ index 8493474d286f7a1ac6454a22c61c8c2cef9121bf..33d75ad38a7f77d085321ace9101900a } -From 70013bbcf19a833606d9d85d44d411e7fd18665a Mon Sep 17 00:00:00 2001 +From 07c224924e9f529153b35c6c51cf4839c9677da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 3 Jun 2015 12:26:13 +0200 -Subject: [PATCH 018/333] ARM: bcm2835: Set Serial number and Revision +Subject: [PATCH 017/407] ARM: bcm2835: Set Serial number and Revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1079,10 +1051,10 @@ index 0c1edfc98696da0e0bb7f4a18cdfbcdd27a9795d..8f152266ba9b470df2eaaed9ebcf158e static const char * const bcm2835_compat[] = { -From 237e85a741b9e91cb58f95fa18343f36fee93d28 Mon Sep 17 00:00:00 2001 +From 116c808d1e460052cddef6f2a017dc61ad782e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 3 Oct 2015 22:22:55 +0200 -Subject: [PATCH 019/333] dmaengine: bcm2835: Load driver early and support +Subject: [PATCH 018/407] dmaengine: bcm2835: Load driver early and support legacy API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -1185,10 +1157,10 @@ index 6204cc32d09c5096df8aec304c3c37b3bcb6be44..599c218dc8a73172dd4bd4a058fc8f95 MODULE_ALIAS("platform:bcm2835-dma"); MODULE_DESCRIPTION("BCM2835 DMA engine driver"); -From 4b1f5d3372391e7374e8f6965e795f77f6213b01 Mon Sep 17 00:00:00 2001 +From a13990a09baa3b466ee4ce58c4ac329fd672677f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 25 Jan 2016 17:25:12 +0000 -Subject: [PATCH 020/333] firmware: Updated mailbox header +Subject: [PATCH 019/407] firmware: Updated mailbox header --- include/soc/bcm2835/raspberrypi-firmware.h | 11 +++++++++++ @@ -1251,10 +1223,10 @@ index 3fb357193f09914fe21f8555a4b8613f74f22bc3..227a107214a02deadcca3db202da265e RPI_FIRMWARE_GET_COMMAND_LINE = 0x00050001, RPI_FIRMWARE_GET_DMA_CHANNELS = 0x00060001, -From dcf6ae69fce62c435a5ad105b21406f3fd0d08b6 Mon Sep 17 00:00:00 2001 +From 45767fdb8bfde01aa7b907a9b80564b78e07745f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 9 May 2016 17:28:18 -0700 -Subject: [PATCH 021/333] clk: bcm2835: Mark GPIO clocks enabled at boot as +Subject: [PATCH 020/407] clk: bcm2835: Mark GPIO clocks enabled at boot as critical. These divide off of PLLD_PER and are used for the ethernet and wifi @@ -1292,10 +1264,10 @@ index 2acaa77ad482a99f28ea64ea43c891501125304c..d13cbbf5bbe06314bfdf103ff85d5cd7 init.ops = &bcm2835_vpu_clock_clk_ops; } else { -From 8d793d200617c067b9e2e236f25444b9c9d42ede Mon Sep 17 00:00:00 2001 +From d3c6bce1142db56e0b1b1560e99d816ed0c5dab3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 15 Jun 2016 16:48:41 +0100 -Subject: [PATCH 022/333] rtc: Add SPI alias for pcf2123 driver +Subject: [PATCH 021/407] rtc: Add SPI alias for pcf2123 driver Without this alias, Device Tree won't cause the driver to be loaded. @@ -1315,10 +1287,10 @@ index 8895f77726e8da5444afcd602dceff8f25a9b3fd..1833b8853ceb0e6147cceb93a00e558c MODULE_LICENSE("GPL"); +MODULE_ALIAS("spi:rtc-pcf2123"); -From 11847a020d4fd6c199d1f1f34a82247894783e50 Mon Sep 17 00:00:00 2001 +From 03aca200255662f5811b73e4f8078684b66943b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 7 Oct 2016 16:50:59 +0200 -Subject: [PATCH 023/333] watchdog: bcm2835: Support setting reboot partition +Subject: [PATCH 022/407] watchdog: bcm2835: Support setting reboot partition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1442,10 +1414,10 @@ index 4dddd8298a227d64862f2e92954a465f2e44b3f6..1f545e024422f59280932713e6a1b051 register_restart_handler(&wdt->restart_handler); if (pm_power_off == NULL) -From 34b80d321529b8b96d6e4662e5f0f0d1c53dfa3f Mon Sep 17 00:00:00 2001 +From 91d7b97dfa953442a7acf4cecda8ee5711450aef Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 5 Apr 2016 19:40:12 +0100 -Subject: [PATCH 024/333] reboot: Use power off rather than busy spinning when +Subject: [PATCH 023/407] reboot: Use power off rather than busy spinning when halt is requested --- @@ -1468,10 +1440,10 @@ index 3fa867a2aae672755c6ce6448f4148c989dbf964..80dca8dcd6709034b643c6a3f35729e0 /* -From b26785c8e22a01b232480252e98c79119e1b5d10 Mon Sep 17 00:00:00 2001 +From c399ccab90d56f7b628a4ac81622a84bf2b622e9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 9 Nov 2016 13:02:52 +0000 -Subject: [PATCH 025/333] bcm: Make RASPBERRYPI_POWER depend on PM +Subject: [PATCH 024/407] bcm: Make RASPBERRYPI_POWER depend on PM --- drivers/soc/bcm/Kconfig | 1 + @@ -1490,10 +1462,10 @@ index a39b0d58ddd0fdf0ac1cc7295f8aafb12546e226..e037a6dd79d1881a09e3ca9115782709 help This enables support for the RPi power domains which can be enabled -From e64e6dcb6d571ebdf76fe415b3a79d685b639f5c Mon Sep 17 00:00:00 2001 +From 6987b66785f71b3c89243633a96c7f76a02825f7 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Fri, 2 Sep 2016 16:45:27 +0100 -Subject: [PATCH 026/333] Register the clocks early during the boot process, so +Subject: [PATCH 025/407] Register the clocks early during the boot process, so that special/critical clocks can get enabled early on in the boot process avoiding the risk of disabling a clock, pll_divider or pll when a claiming driver fails to install propperly - maybe it needs to defer. @@ -1538,10 +1510,10 @@ index d13cbbf5bbe06314bfdf103ff85d5cd73cbf7f7a..a99ccf9f056d3a3e7c482339e08483f3 MODULE_AUTHOR("Eric Anholt "); MODULE_DESCRIPTION("BCM2835 clock driver"); -From f8756a2d8cbb17cc54bdf9c18bca2ef53fb3b8cf Mon Sep 17 00:00:00 2001 +From 758d8c515025d4c2202a5fee253ab27f3ecd3755 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 6 Dec 2016 17:05:39 +0000 -Subject: [PATCH 027/333] bcm2835-rng: Avoid initialising if already enabled +Subject: [PATCH 026/407] bcm2835-rng: Avoid initialising if already enabled Avoids the 0x40000 cycles of warmup again if firmware has already used it --- @@ -1567,10 +1539,10 @@ index 574211a495491d9d6021dcaefe4274a63ed02055..e66c0fca8c6090e32f72796c0877a1cf err = hwrng_register(&bcm2835_rng_ops); if (err) { -From d93484077b2bad286709187debdb2af0220f31d3 Mon Sep 17 00:00:00 2001 +From a2ca496fd389aebc3b3aeb9f014ac4ede67f1372 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Aug 2016 16:28:44 +0100 -Subject: [PATCH 028/333] kbuild: Ignore dtco targets when filtering symbols +Subject: [PATCH 027/407] kbuild: Ignore dtco targets when filtering symbols --- scripts/Kbuild.include | 2 +- @@ -1590,10 +1562,10 @@ index 179219845dfcdfbeb586d12c5ec1296095d9fbf4..e0743e44f84188667a0c322e8c3d36f1 esac | tr ";" "\n" | sed -rn 's/^.*=== __KSYM_(.*) ===.*$$/KSYM_\1/p' -From ddba72b8985dbf4e0022b69dfe04070ef0b3a3bb Mon Sep 17 00:00:00 2001 +From cea6cd9f01e2028b1c0cf292e585a77b155a7cd9 Mon Sep 17 00:00:00 2001 From: Robert Tiemann Date: Mon, 20 Jul 2015 11:01:25 +0200 -Subject: [PATCH 029/333] BCM2835_DT: Fix I2S register map +Subject: [PATCH 028/407] BCM2835_DT: Fix I2S register map --- Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt | 4 ++-- @@ -1631,10 +1603,10 @@ index 65783de0aedf3da79adc36fd077b7a89954ddb6b..a89fe4220fdc3f26f75ee66daf187554 dmas = <&dma 2>, <&dma 3>; -From 1a7f3062339121dd6191be71d2443190f06cb832 Mon Sep 17 00:00:00 2001 +From 8e6b00a8c14d826727201c518595cfc9a77b3815 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 030/333] Main bcm2708/bcm2709 linux port +Subject: [PATCH 029/407] Main bcm2708/bcm2709 linux port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1841,10 +1813,10 @@ index cfb4b4496dd9f61362dea012176c146120fada07..d9c6c217c4d6a2408abe2665bf7f2700 MODULE_AUTHOR("Lubomir Rintel "); MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); -From 9c39f07e522a786892c1b48d7ce5c24f257738a9 Mon Sep 17 00:00:00 2001 +From d87165b144168a66b80a40ae045298a9607390f7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 031/333] Add dwc_otg driver +Subject: [PATCH 030/407] Add dwc_otg driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -2546,10 +2518,10 @@ index 358ca8dd784fe43700ae070764fa783500a792fe..abaac7c7142d8887c1516957fc52162c return i; } diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index f953d6d647f245be5452f6db70ea503552dff525..e17e9e094e5a85798579b25b34bd2b6f7f18c898 100644 +index 706b3d6a7614063995a39d51210712365f5ef6e5..4f2bbbb8632508f0722c9dc05e2ab3867a63bf90 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c -@@ -5040,7 +5040,7 @@ static void port_event(struct usb_hub *hub, int port1) +@@ -5045,7 +5045,7 @@ static void port_event(struct usb_hub *hub, int port1) if (portchange & USB_PORT_STAT_C_OVERCURRENT) { u16 status = 0, unused; @@ -2559,7 +2531,7 @@ index f953d6d647f245be5452f6db70ea503552dff525..e17e9e094e5a85798579b25b34bd2b6f USB_PORT_FEAT_C_OVER_CURRENT); msleep(100); /* Cool down */ diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c -index 3a47077461578f2af47af8d551353c2c7cb12f0e..85b7ff6f24b8023e1b589aa1a3557885c48d7a13 100644 +index 4c388451f31f6c74507137815e9038ea677dfa4f..09670e362e5534d69b6ab52c538afc7f1269fa5e 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1908,6 +1908,85 @@ int usb_set_configuration(struct usb_device *dev, int configuration) @@ -6488,7 +6460,7 @@ index 0000000000000000000000000000000000000000..a896d73f7a9336f5a34015c44ea5a6b0 +} +module_exit(fsg_cleanup); diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig -index 0b80cee30da4740e8c28c6ea7a4cc700163a12ee..f17b939c149562527937f49d90e23c7ab8b72328 100644 +index eb121b2a55d4b4de42a42cf6bdb6b8a938d584ab..52fba4f05b8c817e1d58e6078bbb771d541e89a7 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -762,6 +762,19 @@ config USB_HWA_HCD @@ -62901,10 +62873,10 @@ index 0000000000000000000000000000000000000000..cdc9963176e5a4a0d5250613b61e26c5 +test_main(); +0; -From c4fa4342ab77d7d2971fcf6c31d78679d5e43237 Mon Sep 17 00:00:00 2001 +From 654d18688cb53116625975178d5a75cdfccadfa4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 17:06:34 +0100 -Subject: [PATCH 032/333] bcm2708 framebuffer driver +Subject: [PATCH 031/407] bcm2708 framebuffer driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -66363,10 +66335,10 @@ index 3c14e43b82fefe1d32f591d1b2f61d2cd28d0fa8..7626beb6a5bb8df601ddf0f6e6909d1f +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 -From aa098698a51a5ff9f4aa1471a1848702ff78d625 Mon Sep 17 00:00:00 2001 +From 4e92ef91a256ce411440af5481d619f3836e5f0b Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 033/333] dmaengine: Add support for BCM2708 +Subject: [PATCH 032/407] dmaengine: Add support for BCM2708 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -66997,10 +66969,10 @@ index 0000000000000000000000000000000000000000..c5bfff2765be4606077e6c8af73040ec + +#endif /* _PLAT_BCM2708_DMA_H */ -From b4cfa205adf4df7fb8b91ede16aecd8f4b9532ff Mon Sep 17 00:00:00 2001 +From a390b74e66a16cf5e432bdcef9a9871ff622231b Mon Sep 17 00:00:00 2001 From: gellert Date: Fri, 15 Aug 2014 16:35:06 +0100 -Subject: [PATCH 034/333] MMC: added alternative MMC driver +Subject: [PATCH 033/407] MMC: added alternative MMC driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -68750,10 +68722,10 @@ index 0000000000000000000000000000000000000000..4fe8d1fe44578fbefcd48f8c327ba3d0 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gellert Weisz"); -From 56afd77c76dbd2f584443de1c7f9d1868a3fe851 Mon Sep 17 00:00:00 2001 +From 044cdf939034542fa2c34ca75e2186057270a4f8 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 25 Mar 2015 17:49:47 +0000 -Subject: [PATCH 035/333] Adding bcm2835-sdhost driver, and an overlay to +Subject: [PATCH 034/407] Adding bcm2835-sdhost driver, and an overlay to enable it BCM2835 has two SD card interfaces. This driver uses the other one. @@ -71158,10 +71130,10 @@ index 0000000000000000000000000000000000000000..a9bc79bfdbb71807819dfe2d8f165144 +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Phil Elwell"); -From 209cdc9f0cedd91a365cc4e93d330daa8aafa8d7 Mon Sep 17 00:00:00 2001 +From 2b7a4b743b851d3dd1c2c3e776146708a0100602 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 11 May 2016 12:50:33 +0100 -Subject: [PATCH 036/333] mmc: Add MMC_QUIRK_ERASE_BROKEN for some cards +Subject: [PATCH 035/407] mmc: Add MMC_QUIRK_ERASE_BROKEN for some cards Some SD cards have been found that corrupt data when small blocks are erased. Add a quirk to indicate that ERASE should not be used, @@ -71297,10 +71269,10 @@ index 73fad83acbcb6a157587180516f9ffe7c61eb7d7..e7c9d3098ac06e3c6554fa3373a311f9 unsigned int erase_shift; /* if erase unit is power 2 */ unsigned int pref_erase; /* in sectors */ -From cd13ba7ca132dceb2efdc2d1082fef6660929c2f Mon Sep 17 00:00:00 2001 +From 1b70f573828a17866cc8df67dab72a4841e3a240 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:31:47 +0100 -Subject: [PATCH 037/333] cma: Add vc_cma driver to enable use of CMA +Subject: [PATCH 036/407] cma: Add vc_cma driver to enable use of CMA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -72636,10 +72608,10 @@ index 0000000000000000000000000000000000000000..be2819d5d41f9d5ed65daf8eedb94c9e + +#endif /* VC_CMA_H */ -From 857b0e5f95c55c79120a76e29dd16b89692561c8 Mon Sep 17 00:00:00 2001 +From bc7f9bee1ad6df49d9c62bd4f652fe54b7e614ca Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 26 Mar 2012 22:15:50 +0100 -Subject: [PATCH 038/333] bcm2708: alsa sound driver +Subject: [PATCH 037/407] bcm2708: alsa sound driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -75374,10 +75346,10 @@ index 0000000000000000000000000000000000000000..af3e6eb690113fc32ce9e06bd2f0f294 + +#endif // _VC_AUDIO_DEFS_H_ -From 4a9238cc8f053e765f1795febf07f9b185ebf0ed Mon Sep 17 00:00:00 2001 +From 5e0b96ee5c98c9bcfbad5f007b54f05063ed5643 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 28 Oct 2016 15:36:43 +0100 -Subject: [PATCH 039/333] vc_mem: Add vc_mem driver for querying firmware +Subject: [PATCH 038/407] vc_mem: Add vc_mem driver for querying firmware memory addresses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -75901,10 +75873,10 @@ index 0000000000000000000000000000000000000000..20a475377eb3078ea1ecaef2b24efc35 + +#endif /* _VC_MEM_H */ -From 9b71b89ce276d4df64283ebc76f8aa4dcd9a654d Mon Sep 17 00:00:00 2001 +From 17ee812c69cd3dc9292997636d17e51135478c01 Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Tue, 22 Jul 2014 15:41:04 +0100 -Subject: [PATCH 040/333] vcsm: VideoCore shared memory service for BCM2835 +Subject: [PATCH 039/407] vcsm: VideoCore shared memory service for BCM2835 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -80311,10 +80283,10 @@ index 0000000000000000000000000000000000000000..334f36d0d697b047df2922b5f2db67f3 + +#endif /* __VMCS_SM_IOCTL_H__INCLUDED__ */ -From a9403662ab1c1bae44d4dd9704e93fee4e0234db Mon Sep 17 00:00:00 2001 +From 43792e2a9889510ade3b6013996f22ba4f2e26d0 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Fri, 21 Aug 2015 23:14:48 +0100 -Subject: [PATCH 041/333] Add /dev/gpiomem device for rootless user GPIO access +Subject: [PATCH 040/407] Add /dev/gpiomem device for rootless user GPIO access Signed-off-by: Luke Wren @@ -80625,10 +80597,10 @@ index 0000000000000000000000000000000000000000..911f5b7393ed48ceed8751f06967ae64 +MODULE_DESCRIPTION("gpiomem driver for accessing GPIO from userspace"); +MODULE_AUTHOR("Luke Wren "); -From fa5106e1d80ae6eed51817ea9a0603129c5e243c Mon Sep 17 00:00:00 2001 +From 30db84ef8d4b4d8363a7e09cfc8cd3828c85e4e1 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Sat, 5 Sep 2015 01:14:45 +0100 -Subject: [PATCH 042/333] Add SMI driver +Subject: [PATCH 041/407] Add SMI driver Signed-off-by: Luke Wren --- @@ -82579,10 +82551,10 @@ index 0000000000000000000000000000000000000000..ee3a75edfc033eeb0d90a687ffb68b10 + +#endif /* BCM2835_SMI_H */ -From 96f3ea8c5be50c76ad14ba5864cd06e7e7f78f19 Mon Sep 17 00:00:00 2001 +From 9b80129cb286efc600bcbb7d73201e8a5570fff0 Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Tue, 26 Apr 2016 14:59:21 +0000 -Subject: [PATCH 043/333] MISC: bcm2835: smi: use clock manager and fix reload +Subject: [PATCH 042/407] MISC: bcm2835: smi: use clock manager and fix reload issues Use clock manager instead of self-made clockmanager. @@ -82752,10 +82724,10 @@ index 63a4ea08b9930a3a31a985f0a1d969b488ed49ec..1261540703127d1d63b9f3c87042c6e5 return 0; } -From a760f93b3fd9c575140d21b82159db7b669e5973 Mon Sep 17 00:00:00 2001 +From c17d10e830267006e43f34ab86e0f11a7f01f672 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Sat, 5 Sep 2015 01:16:10 +0100 -Subject: [PATCH 044/333] Add SMI NAND driver +Subject: [PATCH 043/407] Add SMI NAND driver Signed-off-by: Luke Wren --- @@ -83120,10 +83092,10 @@ index 0000000000000000000000000000000000000000..02adda6da18bd0ba9ab19a104975b79d + ("Driver for NAND chips using Broadcom Secondary Memory Interface"); +MODULE_AUTHOR("Luke Wren "); -From c7794dbb7547701d54f61449a7eec794e3cbffdf Mon Sep 17 00:00:00 2001 +From aa72fa6381ee97140e1152ef07c415872f11e1a9 Mon Sep 17 00:00:00 2001 From: Aron Szabo Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 045/333] lirc: added support for RaspberryPi GPIO +Subject: [PATCH 044/407] lirc: added support for RaspberryPi GPIO lirc_rpi: Use read_current_timer to determine transmitter delay. Thanks to jjmz and others See: https://github.com/raspberrypi/linux/issues/525 @@ -83986,10 +83958,10 @@ index 0000000000000000000000000000000000000000..fb69624ccef00ddbdccf8256d6baf1b1 + +#endif -From 5d070f4725428ff20b87dc6589bac00ff6fe55d1 Mon Sep 17 00:00:00 2001 +From d62424e96ae52f0f3dcc9fda78258480a64cdeb1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 046/333] Add cpufreq driver +Subject: [PATCH 045/407] Add cpufreq driver Signed-off-by: popcornmix --- @@ -84000,7 +83972,7 @@ Signed-off-by: popcornmix create mode 100644 drivers/cpufreq/bcm2835-cpufreq.c diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm -index d89b8afe23b6956b6c48e19c87cecc081e7725a1..465c727bb3ba70249409728d8f643a0002c6779c 100644 +index bc3917d6015a34a64da7920f6ebbc90ea3ce55fc..51357ef228798725ba25ae63cd6a3369b619c89c 100644 --- a/drivers/cpufreq/Kconfig.arm +++ b/drivers/cpufreq/Kconfig.arm @@ -220,6 +220,15 @@ config ARM_STI_CPUFREQ @@ -84256,10 +84228,10 @@ index 0000000000000000000000000000000000000000..414fbdc10dfbfc6e4bb47870a7af3fd5 +module_init(bcm2835_cpufreq_module_init); +module_exit(bcm2835_cpufreq_module_exit); -From ac11ff5afe45aab6ba2aca0b4c84a6bdb0470de4 Mon Sep 17 00:00:00 2001 +From 43a03f7e26ad66d9c8bab2348d2c5097db3f16ee Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 19:24:24 +0000 -Subject: [PATCH 047/333] Added hwmon/thermal driver for reporting core +Subject: [PATCH 046/407] Added hwmon/thermal driver for reporting core temperature. Thanks Dorian MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -84425,10 +84397,10 @@ index 0000000000000000000000000000000000000000..c63fb9f9d143e19612a18fe530c7b2b3 +MODULE_DESCRIPTION("Thermal driver for bcm2835 chip"); +MODULE_LICENSE("GPL"); -From a1417df3514f4e193a0b5b368569e61015a3e86e Mon Sep 17 00:00:00 2001 +From b5345e62ce9c57f10d0ffd5b0a926bdf41f09cc5 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 15:44:08 +0100 -Subject: [PATCH 048/333] Add Chris Boot's i2c driver +Subject: [PATCH 047/407] Add Chris Boot's i2c driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -85093,10 +85065,10 @@ index 0000000000000000000000000000000000000000..962f2e5c7455d91bf32925d785f5f16b +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -From ebf4ec9ec3cf70555e90a087914ef77ce63aff3d Mon Sep 17 00:00:00 2001 +From 530ef66269864254c848bfe609e2fc1fda40cafe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 26 Jun 2015 14:27:06 +0200 -Subject: [PATCH 049/333] char: broadcom: Add vcio module +Subject: [PATCH 048/407] char: broadcom: Add vcio module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -85322,10 +85294,10 @@ index 0000000000000000000000000000000000000000..c19bc2075c77879563ef5e59038b5a14 +MODULE_DESCRIPTION("Mailbox userspace access"); +MODULE_LICENSE("GPL"); -From e6e0760c6311ad5550c58a8aa52b4dcf3af833d4 Mon Sep 17 00:00:00 2001 +From 36cbbc724cd702ddd54f0da387e3cc2ef637e74c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 26 Jun 2015 14:25:01 +0200 -Subject: [PATCH 050/333] firmware: bcm2835: Support ARCH_BCM270x +Subject: [PATCH 049/407] firmware: bcm2835: Support ARCH_BCM270x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -85408,10 +85380,10 @@ index dd506cd3a5b874f9e1acd07efb8cd151bb6145d1..3f070bd38a91511c986e3fb114b15bd4 MODULE_AUTHOR("Eric Anholt "); MODULE_DESCRIPTION("Raspberry Pi firmware driver"); -From 4e5618f7f1ee67d0cba853b28ced481ff27da470 Mon Sep 17 00:00:00 2001 +From 0e8a82291d32bbd0fb0ddcb12cbd5421e38400d0 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Wed, 30 Jan 2013 12:45:18 +0000 -Subject: [PATCH 051/333] bcm2835: add v4l2 camera device +Subject: [PATCH 050/407] bcm2835: add v4l2 camera device - Supports raw YUV capture, preview, JPEG and H264. - Uses videobuf2 for data transfer, using dma_buf. @@ -93153,10 +93125,10 @@ index 0000000000000000000000000000000000000000..9d1d11e4a53e510c04a416d92d195a7d + +#endif /* MMAL_VCHIQ_H */ -From 4f98e3ad49b6451b95b2b73ec1121bb49506ec97 Mon Sep 17 00:00:00 2001 +From 57c80bccbeb65e4a579ee6f7ad82aad5620d640b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 11 May 2015 09:00:42 +0100 -Subject: [PATCH 052/333] scripts: Add mkknlimg and knlinfo scripts from tools +Subject: [PATCH 051/407] scripts: Add mkknlimg and knlinfo scripts from tools repo The Raspberry Pi firmware looks for a trailer on the kernel image to @@ -93676,10 +93648,10 @@ index 0000000000000000000000000000000000000000..60206de7fa9a49bd027c635306674a29 + return $trailer; +} -From 114daaee5a7fdf861320ae856ea3f4570d5cc2e3 Mon Sep 17 00:00:00 2001 +From 92a609134995fe9ae69c2ce4f293d3b12a6f4fa1 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 10 Aug 2015 09:49:15 +0100 -Subject: [PATCH 053/333] scripts/dtc: Update to upstream version 1.4.1 +Subject: [PATCH 052/407] scripts/dtc: Update to upstream version 1.4.1 Includes the new localfixups format. @@ -96530,10 +96502,10 @@ index ad9b05ae698b0495ecbda42ffcf4743555313a27..2595dfda020fd9e03f0beff5006f229d -#define DTC_VERSION "DTC 1.4.1-g53bf130b" +#define DTC_VERSION "DTC 1.4.1-g25efc119" -From 1dba92cec81b0fc66d9dd92549041530e89f4ad8 Mon Sep 17 00:00:00 2001 +From 9abdaacb85a7506c4e4669f0db378bfc4c3ab1b8 Mon Sep 17 00:00:00 2001 From: notro Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 054/333] BCM2708: Add core Device Tree support +Subject: [PATCH 053/407] BCM2708: Add core Device Tree support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -106661,10 +106633,10 @@ index 0a07f9014944ed92a8e2e42983ae43be60b3e471..1967878a843461c3ff1f473b9a030eb0 # Bzip2 -From f5940d59cf8495c0101278d4f33915f9741c5bea Mon Sep 17 00:00:00 2001 +From 47b80548ba1ad1370ff1bedeab29700667a06265 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 6 Feb 2015 13:50:57 +0000 -Subject: [PATCH 055/333] BCM270x_DT: Add pwr_led, and the required "input" +Subject: [PATCH 054/407] BCM270x_DT: Add pwr_led, and the required "input" trigger The "input" trigger makes the associated GPIO an input. This is to support @@ -106840,10 +106812,10 @@ index ddfcb2df3656cf0ab6aebd1fa3d624a6ec2e94e9..271563eb835f9018712e2076a88f341d /* Set LED brightness level * Must not sleep. Use brightness_set_blocking for drivers -From a8b8d89ade70d426ddcbde8bc9a4f8b11c6ae5c3 Mon Sep 17 00:00:00 2001 +From b65a53aa87f4a8ed673ca002a0d160d777e9c243 Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 056/333] fbdev: add FBIOCOPYAREA ioctl +Subject: [PATCH 055/407] fbdev: add FBIOCOPYAREA ioctl Based on the patch authored by Ali Gholami Rudi at https://lkml.org/lkml/2009/7/13/153 @@ -107095,10 +107067,10 @@ index fb795c3b3c178ad3cd7c9e9e4547ffd492bac181..703fa8a70574323abe2fb32599254582 __u32 dx; /* screen-relative */ __u32 dy; -From 2683453d910b4ae1fff63f46ec6834e686be93e4 Mon Sep 17 00:00:00 2001 +From 58f787c938e61a3808ce547cb86b7d50bd981df9 Mon Sep 17 00:00:00 2001 From: Harm Hanemaaijer Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 057/333] Speed up console framebuffer imageblit function +Subject: [PATCH 056/407] Speed up console framebuffer imageblit function Especially on platforms with a slower CPU but a relatively high framebuffer fill bandwidth, like current ARM devices, the existing @@ -107307,10 +107279,10 @@ index a2bb276a8b2463eee98eb237c4647bc00cd93601..436494fba15abecb400ef28688466faf start_index, pitch_index); } else -From 5dffa69c937ef936d02ed9faa687d5c734a07830 Mon Sep 17 00:00:00 2001 +From 5e36d93fc1b0b7d61d592bf7bc4e0104c16e5b38 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 058/333] enabling the realtime clock 1-wire chip DS1307 and +Subject: [PATCH 057/407] enabling the realtime clock 1-wire chip DS1307 and 1-wire on GPIO4 (as a module) 1-wire: Add support for configuring pin for w1-gpio kernel module @@ -107560,10 +107532,10 @@ index d58594a3232492e33f1dd4babd3798b03e0f0203..feae94256256316fd9d850c3d83325af unsigned int ext_pullup_enable_pin; unsigned int pullup_duration; -From 790ccd6dc71732112c1399f8a192d5618e04f215 Mon Sep 17 00:00:00 2001 +From eb40b331ea7c107a559bb40c7f5dab9202c03d4c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Dec 2013 22:16:19 +0000 -Subject: [PATCH 059/333] config: Enable CONFIG_MEMCG, but leave it disabled +Subject: [PATCH 058/407] config: Enable CONFIG_MEMCG, but leave it disabled (due to memory cost). Enable with cgroup_enable=memory. --- @@ -107613,10 +107585,10 @@ index 4c233437ee1ad40d28ad8c32baf5029cdb0d0fdd..d0ecb18e0e3ad06483be2ddea9114c5a * css_tryget_online_from_dir - get corresponding css from a cgroup dentry * @dentry: directory dentry of interest -From c3d0468fe0f872810e0a985bc67748a7b3e9908e Mon Sep 17 00:00:00 2001 +From 13f9ee79b8d257b8b8787d94b911a8bc35d2a32c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 060/333] hid: Reduce default mouse polling interval to 60Hz +Subject: [PATCH 059/407] hid: Reduce default mouse polling interval to 60Hz Reduces overhead when using X --- @@ -107624,7 +107596,7 @@ Reduces overhead when using X 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index ae83af649a607f67239f1a64bf45dd4b5770cc7d..4a7af9d0b910f59d17421ce14138400dfd5834f3 100644 +index 7838343eb37c541d698a7e78ff265e789fda7c98..fb8777ab070b699ba50fd8bc8d9d86971f6f9f93 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -49,7 +49,7 @@ @@ -107636,7 +107608,7 @@ index ae83af649a607f67239f1a64bf45dd4b5770cc7d..4a7af9d0b910f59d17421ce14138400d module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); -@@ -1083,8 +1083,12 @@ static int usbhid_start(struct hid_device *hid) +@@ -1093,8 +1093,12 @@ static int usbhid_start(struct hid_device *hid) } /* Change the polling interval of mice. */ @@ -107652,10 +107624,10 @@ index ae83af649a607f67239f1a64bf45dd4b5770cc7d..4a7af9d0b910f59d17421ce14138400d ret = -ENOMEM; if (usb_endpoint_dir_in(endpoint)) { -From c14750a7a6b164ad7d1f99c7b4a2d6b1fe6aea70 Mon Sep 17 00:00:00 2001 +From d6a4189ad6844b065eb7c5f4dc7230d57f290f6c Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Tue, 12 May 2015 14:47:56 +0100 -Subject: [PATCH 061/333] rpi-ft5406: Add touchscreen driver for pi LCD display +Subject: [PATCH 060/407] rpi-ft5406: Add touchscreen driver for pi LCD display Fix driver detection failure Check that the buffer response is non-zero meaning the touchscreen was detected @@ -108013,10 +107985,10 @@ index 227a107214a02deadcca3db202da265eba1fdd21..b0f6e33bd30c35664ceee057f4c3ad32 RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, -From 12f9cdf674fe1d59b88f393bd343b508f0b16a40 Mon Sep 17 00:00:00 2001 +From c784c1980e742f53bfe88c6738ae2e7d46eeb5ba Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 28 Nov 2016 16:50:04 +0000 -Subject: [PATCH 062/333] Improve __copy_to_user and __copy_from_user +Subject: [PATCH 061/407] Improve __copy_to_user and __copy_from_user performance Provide a __copy_from_user that uses memcpy. On BCM2708, use @@ -109591,10 +109563,10 @@ index 333dc3c2e5ffbb2c5ab8fcfb6115b6162643cf20..46b787a6474ffa857da9b663948863ec bool "Broadcom BCM63xx DSL SoC" depends on ARCH_MULTI_V7 -From b12839f77156bf866a566bc8d5dd6743c781cd30 Mon Sep 17 00:00:00 2001 +From d732af0ce17e3c67c92c3955b3b3d39ab911c86e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 25 Jun 2015 12:16:11 +0100 -Subject: [PATCH 063/333] gpio-poweroff: Allow it to work on Raspberry Pi +Subject: [PATCH 062/407] gpio-poweroff: Allow it to work on Raspberry Pi The Raspberry Pi firmware manages the power-down and reboot process. To do this it installs a pm_power_off handler, causing @@ -109629,10 +109601,10 @@ index be3d81ff51cc3f510d85e4eed7a52960e51e7bc1..a030ae9fb1fca325061c093696e82186 "%s: pm_power_off function already registered", __func__); -From c03d21639664c679c8a39f002833e9c5d41f5ffe Mon Sep 17 00:00:00 2001 +From 18ede3b1281876a8ca105b15ccf9896269d96fe4 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 14 Jul 2015 14:32:47 +0100 -Subject: [PATCH 064/333] mfd: Add Raspberry Pi Sense HAT core driver +Subject: [PATCH 063/407] mfd: Add Raspberry Pi Sense HAT core driver --- drivers/input/joystick/Kconfig | 8 + @@ -110497,10 +110469,10 @@ index 0000000000000000000000000000000000000000..56196dc2af10e464a1e3f98b028dca1c + +#endif -From 569201c1c9bedf1ee2f7505b1b818a7985ed2518 Mon Sep 17 00:00:00 2001 +From 225642fb5b6f7502354552a5e549f743125706d6 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 065/333] ASoC: Add support for HifiBerry DAC +Subject: [PATCH 064/407] ASoC: Add support for HifiBerry DAC This adds a machine driver for the HifiBerry DAC. It is a sound card that can @@ -110675,10 +110647,10 @@ index 0000000000000000000000000000000000000000..45f2b770ad9e67728ca599a7445d6ae9 +MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); +MODULE_LICENSE("GPL v2"); -From 94905f5dc960b251bfce274cb05fa4c78de7632f Mon Sep 17 00:00:00 2001 +From b28deafdb970b6e2617ca2d570122e2d9c20f347 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Mon, 25 Jan 2016 15:48:59 +0000 -Subject: [PATCH 066/333] ASoC: Add support for Rpi-DAC +Subject: [PATCH 065/407] ASoC: Add support for Rpi-DAC --- sound/soc/bcm/Kconfig | 7 +++ @@ -110962,10 +110934,10 @@ index 0000000000000000000000000000000000000000..afe1b419582aa40c4b2729d242bb13cd +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); -From 27fcd7440478525edbee743ac8c867ce813e25cf Mon Sep 17 00:00:00 2001 +From 8817aa24cc4aa1ea6eff50792b7fbc19d08db216 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 067/333] ASoC: wm8804: Implement MCLK configuration options, +Subject: [PATCH 066/407] ASoC: wm8804: Implement MCLK configuration options, add 32bit support WM8804 can run with PLL frequencies of 256xfs and 128xfs for most sample rates. At 192kHz only 128xfs is supported. The existing driver selects 128xfs automatically for some lower samples rates. By using an @@ -111014,10 +110986,10 @@ index af95d648265b3e92e345101542b332aee35191d4..513f56ba132929662802d15cdc653af3 .component_driver = { .dapm_widgets = wm8804_dapm_widgets, -From e7e402da0efa855df7ffe7bba3356003285766ab Mon Sep 17 00:00:00 2001 +From 1675b074ff5bb33e9aa3449a5a544597c75a14ab Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 068/333] ASoC: BCM:Add support for HiFiBerry Digi. Driver is +Subject: [PATCH 067/407] ASoC: BCM:Add support for HiFiBerry Digi. Driver is based on the patched WM8804 driver. Signed-off-by: Daniel Matuschek @@ -111361,10 +111333,10 @@ index 0000000000000000000000000000000000000000..19dc953b7227ba86123fc7a2ba654499 +MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); +MODULE_LICENSE("GPL v2"); -From f9103ee9afc75f045e668d5ce3f60d666c6d244d Mon Sep 17 00:00:00 2001 +From d6634358676e0cd3f843bb72b185f0745627d8ad Mon Sep 17 00:00:00 2001 From: Gordon Garrity Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 069/333] Add IQaudIO Sound Card support for Raspberry Pi +Subject: [PATCH 068/407] Add IQaudIO Sound Card support for Raspberry Pi Set a limit of 0dB on Digital Volume Control @@ -111694,10 +111666,10 @@ index 0000000000000000000000000000000000000000..4e8e6dec14bcf4a1ff286c43742d4097 +MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); +MODULE_LICENSE("GPL v2"); -From dd4f716ff7faed7cf3d5387714b3e8f5275787fe Mon Sep 17 00:00:00 2001 +From 72a165ffee894f1c287dded2a891a3327fa8c868 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 25 Jul 2016 17:06:50 +0100 -Subject: [PATCH 070/333] iqaudio-dac: Compile fix - untested +Subject: [PATCH 069/407] iqaudio-dac: Compile fix - untested --- sound/soc/bcm/iqaudio-dac.c | 6 +++++- @@ -111721,10 +111693,10 @@ index 4e8e6dec14bcf4a1ff286c43742d4097249d6777..aa15bc4b49ca95edec905fddd8fd0a6d if (dapm->dev != codec_dai->dev) return 0; -From 3224ca3a5f3a217753c1bc9d6b115e5b82781a88 Mon Sep 17 00:00:00 2001 +From 02eeb3bcf6e1fe34628cc1ba22aa02fca7cc59eb Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 10:06:56 +0200 -Subject: [PATCH 071/333] Added support for HiFiBerry DAC+ +Subject: [PATCH 070/407] Added support for HiFiBerry DAC+ The driver is based on the HiFiBerry DAC driver. However HiFiBerry DAC+ uses a different codec chip (PCM5122), therefore a new driver is necessary. @@ -112354,10 +112326,10 @@ index 72b19e62f6267698aea45d2410d616d91c1825cb..c6839ef6e16754ed9de2698507b8986a dev_err(dev, "No LRCLK?\n"); return -EINVAL; -From 17ca3c4973526587ada18c972cea7568d9597244 Mon Sep 17 00:00:00 2001 +From 49772104061630a0dc576ae375513f22aef20cec Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 11:09:58 +0200 -Subject: [PATCH 072/333] Added driver for HiFiBerry Amp amplifier add-on board +Subject: [PATCH 071/407] Added driver for HiFiBerry Amp amplifier add-on board The driver contains a low-level hardware driver for the TAS5713 and the drivers for the Raspberry Pi I2S subsystem. @@ -113197,10 +113169,10 @@ index 0000000000000000000000000000000000000000..8f019e04898754d2f87e9630137be9e8 + +#endif /* _TAS5713_H */ -From a3213d4717b759ad95d65cba624aa6038dd9811e Mon Sep 17 00:00:00 2001 +From e7404aa8dea411bbaa811b80e63e50fa6518a2f6 Mon Sep 17 00:00:00 2001 From: Ryan Coe Date: Sat, 31 Jan 2015 18:25:49 -0700 -Subject: [PATCH 073/333] Update ds1307 driver for device-tree support +Subject: [PATCH 072/407] Update ds1307 driver for device-tree support Signed-off-by: Ryan Coe --- @@ -113227,10 +113199,10 @@ index 4e31036ee2596dec93accd26f627c5b95591ae9f..b92044cf03e750afa521a93519500e9d .driver = { .name = "rtc-ds1307", -From 7b36e748ad832db3376d92df58ab7bfa44e87010 Mon Sep 17 00:00:00 2001 +From 943d3d84749a1496ba7085d75c55beba28ca4716 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 25 Mar 2015 09:26:17 +0100 -Subject: [PATCH 074/333] Add driver for rpi-proto +Subject: [PATCH 073/407] Add driver for rpi-proto Forward port of 3.10.x driver from https://github.com/koalo We are using a custom board and would like to use rpi 3.18.x @@ -113446,10 +113418,10 @@ index 0000000000000000000000000000000000000000..9db678e885efd63d84d60a098a84ed67 +MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); +MODULE_LICENSE("GPL"); -From 23375d3c9864b7778c2bfc69355cf3c7cb6f44a3 Mon Sep 17 00:00:00 2001 +From 616971b56510e8790af0e399e3edacf5c6aa17ad Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Mon, 24 Aug 2015 16:03:47 +0100 -Subject: [PATCH 075/333] RaspiDAC3 support +Subject: [PATCH 074/407] RaspiDAC3 support Signed-off-by: Jan Grulich @@ -113692,10 +113664,10 @@ index 0000000000000000000000000000000000000000..dd9eeea2af0382307f437e6db09d1546 +MODULE_DESCRIPTION("ASoC Driver for RaspiDAC Rev.3x"); +MODULE_LICENSE("GPL v2"); -From 2cc622de75509e5219903d5bff60bfd1a6a9cde9 Mon Sep 17 00:00:00 2001 +From a10511a482f96587f41987752d02087e7148f583 Mon Sep 17 00:00:00 2001 From: Aaron Shaw Date: Thu, 7 Apr 2016 21:26:21 +0100 -Subject: [PATCH 076/333] Add Support for JustBoom Audio boards +Subject: [PATCH 075/407] Add Support for JustBoom Audio boards justboom-dac: Adjust for ALSA API change @@ -114149,10 +114121,10 @@ index 0000000000000000000000000000000000000000..91acb666380faa3c0deb2230f8a0f8bb +MODULE_DESCRIPTION("ASoC Driver for JustBoom PI Digi HAT Sound Card"); +MODULE_LICENSE("GPL v2"); -From 78b863b38b3c94134f10a8842199ec0295263008 Mon Sep 17 00:00:00 2001 +From 4e30b31bce3599419d371e96e7bd9916d4c69314 Mon Sep 17 00:00:00 2001 From: Andrey Grodzovsky Date: Tue, 3 May 2016 22:10:59 -0400 -Subject: [PATCH 077/333] ARM: adau1977-adc: Add basic machine driver for +Subject: [PATCH 076/407] ARM: adau1977-adc: Add basic machine driver for adau1977 codec driver. This commit adds basic support for the codec usage including: Device tree overlay, @@ -114334,10 +114306,10 @@ index 0000000000000000000000000000000000000000..6e2ee027926ee63c89222f75ceb89e3d +MODULE_DESCRIPTION("ASoC Driver for ADAU1977 ADC"); +MODULE_LICENSE("GPL v2"); -From 2f63dfe083262958b52e818f7eacb243981c86ec Mon Sep 17 00:00:00 2001 +From 300c5e9b4beb1e24857b5603919b20a7358f8d59 Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Mon, 16 May 2016 21:36:31 +1000 -Subject: [PATCH 078/333] New AudioInjector.net Pi soundcard with low jitter +Subject: [PATCH 077/407] New AudioInjector.net Pi soundcard with low jitter audio in and out. Contains the sound/soc/bcm ALSA machine driver and necessary alterations to the Kconfig and Makefile. @@ -114588,10 +114560,10 @@ index 0000000000000000000000000000000000000000..ef54e0f07ea03f59e9957b5d98f3e7fd +MODULE_ALIAS("platform:audioinjector-pi-soundcard"); + -From 0afac6fe3952fc47372f8bc6e80de5b7f8bf1412 Mon Sep 17 00:00:00 2001 +From b740d9d20e67da859e88eab5d3b9010038d432c4 Mon Sep 17 00:00:00 2001 From: DigitalDreamtime Date: Thu, 30 Jun 2016 18:38:42 +0100 -Subject: [PATCH 079/333] Add IQAudIO Digi WM8804 board support +Subject: [PATCH 078/407] Add IQAudIO Digi WM8804 board support Support IQAudIO Digi board with iqaudio_digi machine driver and iqaudio-digi-wm8804-audio overlay. @@ -114891,10 +114863,10 @@ index 0000000000000000000000000000000000000000..9b6e829bcb5b1762a853775e78163196 +MODULE_DESCRIPTION("ASoC Driver for IQAudIO WM8804 Digi"); +MODULE_LICENSE("GPL v2"); -From c493c9e355b9b724481dbf8ff00091a4911420dd Mon Sep 17 00:00:00 2001 +From 0c898a16ef0d017295880023e16bc8117b7251e1 Mon Sep 17 00:00:00 2001 From: escalator2015 Date: Tue, 24 May 2016 16:20:09 +0100 -Subject: [PATCH 080/333] New driver for RRA DigiDAC1 soundcard using WM8741 + +Subject: [PATCH 079/407] New driver for RRA DigiDAC1 soundcard using WM8741 + WM8804 --- @@ -115367,10 +115339,10 @@ index 0000000000000000000000000000000000000000..446796e7e4c14a7d95b2f2a01211d9a0 +MODULE_DESCRIPTION("ASoC Driver for RRA DigiDAC1"); +MODULE_LICENSE("GPL v2"); -From 4243b469d9bb8cccc463c1aa7dde2a08081abb7f Mon Sep 17 00:00:00 2001 +From e51cb396734f88bf2674b7ca2b4aa72197c6dd24 Mon Sep 17 00:00:00 2001 From: DigitalDreamtime Date: Sat, 2 Jul 2016 16:26:19 +0100 -Subject: [PATCH 081/333] Add support for Dion Audio LOCO DAC-AMP HAT +Subject: [PATCH 080/407] Add support for Dion Audio LOCO DAC-AMP HAT Using dedicated machine driver and pcm5102a codec driver. @@ -115543,10 +115515,10 @@ index 0000000000000000000000000000000000000000..89e65317512bc774453ac8d0d5b0ff98 +MODULE_DESCRIPTION("ASoC Driver for DionAudio LOCO"); +MODULE_LICENSE("GPL v2"); -From dbac1312e3081603b97cc5e77ebb0cc15c8f2f9a Mon Sep 17 00:00:00 2001 +From c826cf17c23c159b84be105e9be29415742c3b96 Mon Sep 17 00:00:00 2001 From: Clive Messer Date: Mon, 19 Sep 2016 14:01:04 +0100 -Subject: [PATCH 082/333] Allo Piano DAC boards: Initial 2 channel (stereo) +Subject: [PATCH 081/407] Allo Piano DAC boards: Initial 2 channel (stereo) support (#1645) Add initial 2 channel (stereo) support for Allo Piano DAC (2.0/2.1) boards, @@ -115753,10 +115725,10 @@ index 0000000000000000000000000000000000000000..8e8e62e5a36a279b425ed4655cfbac99 +MODULE_DESCRIPTION("ALSA ASoC Machine Driver for Allo Piano DAC"); +MODULE_LICENSE("GPL v2"); -From 5a64f7f87d319666f92e33cc17682878dca3e7fc Mon Sep 17 00:00:00 2001 +From b6b370e1f779cfac8fedd789eb39d1e0eb96da26 Mon Sep 17 00:00:00 2001 From: gtrainavicius Date: Sun, 23 Oct 2016 12:06:53 +0300 -Subject: [PATCH 083/333] Support for Blokas Labs pisound board +Subject: [PATCH 082/407] Support for Blokas Labs pisound board Pisound dynamic overlay (#1760) @@ -115773,11 +115745,11 @@ Print a logline when the kernel module is removed. create mode 100644 sound/soc/bcm/pisound.c diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt -index f0a48ea78659c933839554ca879babb1b621b264..779c19033acad30ed8fd71f015ee76caef1a0568 100644 +index bceffffb7502d80b71cbf3ddff2670cfcc7353d2..2b0dbc0a182cf5947227ad9fe482aae09b50a39b 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt -@@ -40,6 +40,7 @@ auvidea Auvidea GmbH - avago Avago Technologies +@@ -41,6 +41,7 @@ avago Avago Technologies + avia avia semiconductor avic Shanghai AVIC Optoelectronics Co., Ltd. axis Axis Communications AB +blokaslabs Vilniaus Blokas UAB @@ -116933,10 +116905,10 @@ index 0000000000000000000000000000000000000000..4b8545487d06e4ea70073a5d063fb231 +MODULE_DESCRIPTION("ASoC Driver for pisound, http://blokas.io/pisound"); +MODULE_LICENSE("GPL v2"); -From c7e415ce2612f4beae3973b5b7c378fec5bdf204 Mon Sep 17 00:00:00 2001 +From 9048868e60a6892a602e75218fae01b6f9d7b829 Mon Sep 17 00:00:00 2001 From: P33M Date: Wed, 21 Oct 2015 14:55:21 +0100 -Subject: [PATCH 084/333] rpi_display: add backlight driver and overlay +Subject: [PATCH 083/407] rpi_display: add backlight driver and overlay Add a mailbox-driven backlight controller for the Raspberry Pi DSI touchscreen display. Requires updated GPU firmware to recognise the @@ -117105,10 +117077,10 @@ index 0000000000000000000000000000000000000000..14a0d9b037395497c1fdae2961feccd5 +MODULE_DESCRIPTION("Raspberry Pi mailbox based Backlight Driver"); +MODULE_LICENSE("GPL"); -From 3b9129963bc6bec1b6fb5818c15d90775361a9c9 Mon Sep 17 00:00:00 2001 +From 058a0b2165a96b4879e012a7ee5afb4fb7bdf7a6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 23 Feb 2016 19:56:04 +0000 -Subject: [PATCH 085/333] bcm2835-virtgpio: Virtual GPIO driver +Subject: [PATCH 084/407] bcm2835-virtgpio: Virtual GPIO driver Add a virtual GPIO driver that uses the firmware mailbox interface to request that the VPU toggles LEDs. @@ -117382,10 +117354,10 @@ index b0f6e33bd30c35664ceee057f4c3ad32b914291d..e92278968b2b979db2a1f855f70e7aaf RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, -From 11eb6f72216c935640ec90a8614dd9e88806cfa5 Mon Sep 17 00:00:00 2001 +From c1be1f58fc7c5324e446c7d63c8b5bad8f64d8c2 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 23 Feb 2016 17:26:48 +0000 -Subject: [PATCH 086/333] amba_pl011: Don't use DT aliases for numbering +Subject: [PATCH 085/407] amba_pl011: Don't use DT aliases for numbering The pl011 driver looks for DT aliases of the form "serial", and if found uses as the device ID. This can cause @@ -117414,10 +117386,10 @@ index e2c33b9528d82ed7a2c27d083d7b1d222da68178..5a11ff833e1fd112ba04df3a427cd94b uap->old_cr = 0; uap->port.dev = dev; -From c692780c3b3c210c1c28342eee17b962c1c20530 Mon Sep 17 00:00:00 2001 +From 16c6d5359a7fcd10be6f058cfa20817d9e7cd2da Mon Sep 17 00:00:00 2001 From: Pantelis Antoniou Date: Wed, 3 Dec 2014 13:23:28 +0200 -Subject: [PATCH 087/333] OF: DT-Overlay configfs interface +Subject: [PATCH 086/407] OF: DT-Overlay configfs interface This is a port of Pantelis Antoniou's v3 port that makes use of the new upstreamed configfs support for binary attributes. @@ -117849,10 +117821,10 @@ index 0000000000000000000000000000000000000000..0037e6868a6cda8706c88194c6a4454b +} +late_initcall(of_cfs_init); -From 7fd2b287b25fe6f2b2b11d6cd6f4aaee0049cee3 Mon Sep 17 00:00:00 2001 +From d767ab015bbfc65574412f95d5ab6a7b121d9e5e Mon Sep 17 00:00:00 2001 From: Cheong2K Date: Fri, 26 Feb 2016 18:20:10 +0800 -Subject: [PATCH 088/333] brcm: adds support for BCM43341 wifi +Subject: [PATCH 087/407] brcm: adds support for BCM43341 wifi brcmfmac: Disable power management @@ -117899,10 +117871,10 @@ Signed-off-by: Phil Elwell 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -index 1d4352e1ac81a337c6c3e1e85983cb0fe151f8b8..3ac3056ab1d2074e4a60961455f0c355c5a18afd 100644 +index 27960b0bfbcd8f1bf2aed58e3c5097f933164623..98fa503627d62dd247a30a0db83ced788d41749d 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2756,6 +2756,8 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, +@@ -2745,6 +2745,8 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, * preference in cfg struct to apply this to * FW later while initializing the dongle */ @@ -117911,7 +117883,7 @@ index 1d4352e1ac81a337c6c3e1e85983cb0fe151f8b8..3ac3056ab1d2074e4a60961455f0c355 cfg->pwr_save = enabled; if (!check_vif_up(ifp->vif)) { -@@ -4750,12 +4752,15 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) +@@ -4751,12 +4753,15 @@ static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); if (err < 0) brcmf_err("BRCMF_C_DOWN error %d\n", err); @@ -117930,7 +117902,7 @@ index 1d4352e1ac81a337c6c3e1e85983cb0fe151f8b8..3ac3056ab1d2074e4a60961455f0c355 if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) brcmf_fil_iovar_int_set(ifp, "mbss", 0); brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, -@@ -6744,12 +6749,18 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], +@@ -6745,12 +6750,18 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], struct brcmfmac_pd_cc *country_codes; struct brcmfmac_pd_cc_entry *cc; s32 found_index; @@ -117951,7 +117923,7 @@ index 1d4352e1ac81a337c6c3e1e85983cb0fe151f8b8..3ac3056ab1d2074e4a60961455f0c355 } if ((alpha2[0] == ccreq->country_abbrev[0]) && -@@ -6773,10 +6784,14 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], +@@ -6774,10 +6785,14 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], brcmf_dbg(TRACE, "No country code match found\n"); return -EINVAL; } @@ -118015,10 +117987,10 @@ index d0407d9ad7827cd756b6311410ffe2d9a7cacc78..f1fb8a3c7a3211e8429585861f2f42e0 #define BRCM_CC_4335_CHIP_ID 0x4335 #define BRCM_CC_4339_CHIP_ID 0x4339 -From 0d6fd1f2d1ef109cb5a78f790ddc74b8419bc1a1 Mon Sep 17 00:00:00 2001 +From b95e790677e4c409be9f3e7aae8e0b3e116d8a7f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 17 Dec 2015 13:37:07 +0000 -Subject: [PATCH 089/333] hci_h5: Don't send conf_req when ACTIVE +Subject: [PATCH 088/407] hci_h5: Don't send conf_req when ACTIVE Without this patch, a modem and kernel can continuously bombard each other with conf_req and conf_rsp messages, in a demented game of tag. @@ -118041,10 +118013,10 @@ index 0879d64b1caf58afb6e5d494c07d9ab7e7cdf983..5161ab30fd533d50f516bb93d5b9f402 if (H5_HDR_LEN(hdr) > 2) h5->tx_win = (data[2] & 0x07); -From ca6ef19dcfa9c8f8c3e1f33dbecfa9c2aac16f03 Mon Sep 17 00:00:00 2001 +From 9ae679357ddd8e702150ff9bda686b27df8719f7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 17:16:29 +0100 -Subject: [PATCH 090/333] config: Add default configs +Subject: [PATCH 089/407] config: Add default configs --- arch/arm/configs/bcm2709_defconfig | 1297 +++++++++++++++++++++++++++++++++++ @@ -120671,10 +120643,10 @@ index 0000000000000000000000000000000000000000..8acee9f31202ec14f2933d92dd70831c +CONFIG_CRC_ITU_T=y +CONFIG_LIBCRC32C=y -From 2348d2ec0ea2eb5af6431ae59ddc9b0999bdbbc7 Mon Sep 17 00:00:00 2001 +From 089d4722c7e77a3383e4f5cd5ed1225999e958f5 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Wed, 24 Aug 2016 03:35:56 -0700 -Subject: [PATCH 091/333] Add arm64 configuration and device tree differences. +Subject: [PATCH 090/407] Add arm64 configuration and device tree differences. Disable MMC_BCM2835_SDHOST and MMC_BCM2835 since these drivers are crashing at the moment. @@ -122089,10 +122061,10 @@ index 0000000000000000000000000000000000000000..d7406f5a4620151044b8f716b4d10bb8 +CONFIG_LIBCRC32C=y +CONFIG_BCM2708_VCHIQ=n -From 6563a0e08d79311233a7870b5668074ca16bc4b9 Mon Sep 17 00:00:00 2001 +From c54146b8dab8ae1f0f60798a4dbc108cd373f7e7 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 7 Mar 2016 15:05:11 +0000 -Subject: [PATCH 092/333] vchiq_arm: Tweak the logging output +Subject: [PATCH 091/407] vchiq_arm: Tweak the logging output Signed-off-by: Phil Elwell --- @@ -122167,10 +122139,10 @@ index 2c98da4307dff994a00dc246574ef0aaee05d5da..160db24aeea33a8296923501009c1f02 switch (type) { -From c22141c191a3fc668f42e1fbb120b0be266c412e Mon Sep 17 00:00:00 2001 +From df5e8718011cb7b313a59b2c28ae695309ce9604 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 23 Mar 2016 14:16:25 +0000 -Subject: [PATCH 093/333] vchiq_arm: Access the dequeue_pending flag locked +Subject: [PATCH 092/407] vchiq_arm: Access the dequeue_pending flag locked Reading through this code looking for another problem (now found in userland) the use of dequeue_pending outside a lock didn't seem safe. @@ -122228,10 +122200,10 @@ index 7b6cd4d80621e38ff6d47fcd87b45fbe9cd4259b..d8669fa7f39b077877eca1829ba9538b return add_completion(instance, reason, header, user_service, -From dd15e4c2a35e89699c8270b797671d2a9a28ec9d Mon Sep 17 00:00:00 2001 +From 76405a0d157eee6b8e573c81eaab3103c0ff9744 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 23 Mar 2016 20:53:47 +0000 -Subject: [PATCH 094/333] vchiq_arm: Service callbacks must not fail +Subject: [PATCH 093/407] vchiq_arm: Service callbacks must not fail Service callbacks are not allowed to return an error. The internal callback that delivers events and messages to user tasks does not enqueue them if @@ -122257,10 +122229,10 @@ index d8669fa7f39b077877eca1829ba9538bf2e21a82..54552c6ce54f413c9781ba279b936f98 DEBUG_TRACE(SERVICE_CALLBACK_LINE); } -From 40b6b6fcb5dc64a71af330e5357d649e96102ded Mon Sep 17 00:00:00 2001 +From 5020724e0540dd52e48629d29af754fa790968d2 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 21 Apr 2016 13:49:32 +0100 -Subject: [PATCH 095/333] vchiq_arm: Add completion records under the mutex +Subject: [PATCH 094/407] vchiq_arm: Add completion records under the mutex An issue was observed when flushing openmax components which generate a large number of messages returning @@ -122323,10 +122295,10 @@ index 54552c6ce54f413c9781ba279b936f98be4f47b0..bde8955b7d8505d73579b77b5b392154 return VCHIQ_SUCCESS; -From e76614e56511c0afd36234e9f2ca04cbff34611e Mon Sep 17 00:00:00 2001 +From 142747ad6741a60906dbbf4974b89399a42d6b8f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 20 Jun 2016 13:51:44 +0100 -Subject: [PATCH 096/333] vchiq_arm: Avoid use of mutex in add_completion +Subject: [PATCH 095/407] vchiq_arm: Avoid use of mutex in add_completion Claiming the completion_mutex within add_completion did prevent some messages appearing twice, but provokes a deadlock caused by vcsm using @@ -122520,10 +122492,10 @@ index 160db24aeea33a8296923501009c1f02bc41e599..71a3bedc55314f3b22dbff40c05dedf0 up(&state->slot_available_event); } -From 195c40051e64a8f25abce52e7987bbebf594d855 Mon Sep 17 00:00:00 2001 +From 200a8be913ec86a00c7395523cbb4454a5c93ac4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 3 Oct 2016 10:14:10 -0700 -Subject: [PATCH 097/333] staging/vchi: Convert to current get_user_pages() +Subject: [PATCH 096/407] staging/vchi: Convert to current get_user_pages() arguments. Signed-off-by: Eric Anholt @@ -122533,10 +122505,10 @@ Signed-off-by: Eric Anholt 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -index 1091b9f1dd070e3d27c269402b43b0a09d96bcdc..8c7f31f8d39537e7e1c8135271c5f8eea76ed7a0 100644 +index f72eebc71dd83ff3513d374711f8f12912a28d67..809b6a364b09b8383ba62a5d23708251b40734a2 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -@@ -420,7 +420,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, +@@ -426,7 +426,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, *need_release = 0; /* do not try and release vmalloc pages */ } else { down_read(&task->mm->mmap_sem); @@ -122560,10 +122532,10 @@ index e5cdda12c7e5c35c69eb96991cfdb8326def167f..085d37588c59198b4e5f00b9249bb842 num_pages, /* len */ 0, /* gup_flags */ -From fff9c93dd1868aeed2475f7e2b51241cee9a101c Mon Sep 17 00:00:00 2001 +From 1a9a0a2a7f43eb0ff4ff864105fa9181e77eeee7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 3 Oct 2016 10:16:03 -0700 -Subject: [PATCH 098/333] staging/vchi: Update for rename of +Subject: [PATCH 097/407] staging/vchi: Update for rename of page_cache_release() to put_page(). Signed-off-by: Eric Anholt @@ -122573,10 +122545,10 @@ Signed-off-by: Eric Anholt 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -index 8c7f31f8d39537e7e1c8135271c5f8eea76ed7a0..862fabf5682c7dededc8d7ca6773d5b227b72f3c 100644 +index 809b6a364b09b8383ba62a5d23708251b40734a2..5537ca042cba6aca18ba1df2dd130e411a01e632 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c -@@ -438,7 +438,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, +@@ -444,7 +444,7 @@ create_pagelist(char __user *buf, size_t count, unsigned short type, while (actual_pages > 0) { actual_pages--; @@ -122585,7 +122557,7 @@ index 8c7f31f8d39537e7e1c8135271c5f8eea76ed7a0..862fabf5682c7dededc8d7ca6773d5b2 } kfree(pagelist); if (actual_pages == 0) -@@ -577,7 +577,7 @@ free_pagelist(PAGELIST_T *pagelist, int actual) +@@ -585,7 +585,7 @@ free_pagelist(PAGELIST_T *pagelist, int actual) offset = 0; set_page_dirty(pg); } @@ -122608,10 +122580,10 @@ index 085d37588c59198b4e5f00b9249bb8421695854f..5a2b8fb459ebe086ec229f37b6381bdb kfree(pages); } -From b212c09294eec6c5e4d6a3756bdbbddd0403e68d Mon Sep 17 00:00:00 2001 +From f9fab4f4551d1c0c934dcabe1c757b1f545aaabc Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 3 Oct 2016 10:21:17 -0700 -Subject: [PATCH 099/333] drivers/vchi: Remove dependency on CONFIG_BROKEN. +Subject: [PATCH 098/407] drivers/vchi: Remove dependency on CONFIG_BROKEN. The driver builds now. @@ -122633,10 +122605,10 @@ index 9676fb29075a457109e4d4235f086987aec74868..db8e1beb89f9f8c48ea5964016c8285e help Kernel to VideoCore communication interface for the -From ee7caf1e3fbc0cf76ac29f18c64ac85d36a43e39 Mon Sep 17 00:00:00 2001 +From 64c4bd4eb101e1ab07499d756c98baf80857e40d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 14 Sep 2016 09:16:19 +0100 -Subject: [PATCH 100/333] raspberrypi-firmware: Export the general transaction +Subject: [PATCH 099/407] raspberrypi-firmware: Export the general transaction function. The vc4-firmware-kms module is going to be doing the MBOX FB call. @@ -122680,10 +122652,10 @@ index e92278968b2b979db2a1f855f70e7aafb224fa98..09e3d871d110eb0762ebdb5ea3293537 #endif /* __SOC_RASPBERRY_FIRMWARE_H__ */ -From f5ed407b8f36efa2331fd22b96d61a184da4add0 Mon Sep 17 00:00:00 2001 +From c69dc654c06a2def9dc199dae4b45a9eb440e9b5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 14 Sep 2016 09:18:09 +0100 -Subject: [PATCH 101/333] raspberrypi-firmware: Define the MBOX channel in the +Subject: [PATCH 100/407] raspberrypi-firmware: Define the MBOX channel in the header. Signed-off-by: Eric Anholt @@ -122705,10 +122677,10 @@ index 09e3d871d110eb0762ebdb5ea329353738d58661..2859db09e25bb945251e85edb39bc434 enum rpi_firmware_property_status { -From ed84fdbc0541b4db35d4439ebef876cab177a146 Mon Sep 17 00:00:00 2001 +From 5ee3ef420c7be788791a09fb9ede9696fea1df49 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 14 Sep 2016 08:39:33 +0100 -Subject: [PATCH 102/333] drm/vc4: Add a mode for using the closed firmware for +Subject: [PATCH 101/407] drm/vc4: Add a mode for using the closed firmware for display. Signed-off-by: Eric Anholt @@ -123475,10 +123447,10 @@ index 0000000000000000000000000000000000000000..d18a1dae51a2275846c9826b5bf1ba57 + }, +}; -From d4795eafd0d9335ef0bb03a84a743630b93f6adc Mon Sep 17 00:00:00 2001 +From fb83cc90847015b83189e132c2b82c9d42842a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 23 Sep 2016 18:24:38 +0200 -Subject: [PATCH 103/333] i2c: bcm2835: Protect against unexpected TXW/RXR +Subject: [PATCH 102/407] i2c: bcm2835: Protect against unexpected TXW/RXR interrupts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -123603,10 +123575,10 @@ index f283b714aa79e2e4685ed95b04b6b289f7e9eee7..d2ba1a4de36af512e8e3c97251bd3537 return -ETIMEDOUT; } -From e2ff260264aef0344ae3cd776466a6fbd7941378 Mon Sep 17 00:00:00 2001 +From e53ea8840d3240f46040f5bfd9c4b51ebd0039f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Mon, 19 Sep 2016 17:19:41 +0200 -Subject: [PATCH 104/333] i2c: bcm2835: Use dev_dbg logging on transfer errors +Subject: [PATCH 103/407] i2c: bcm2835: Use dev_dbg logging on transfer errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -123638,10 +123610,10 @@ index d2ba1a4de36af512e8e3c97251bd3537ae61591a..54d510abd46a117c9238fc6d7edec840 if (i2c_dev->msg_err & BCM2835_I2C_S_ERR) return -EREMOTEIO; -From fc3a911952bad60e4e8085ea4b946ca68d9b1e65 Mon Sep 17 00:00:00 2001 +From 0fa7edeb9fdbc11e288c3271ad24579a9f3b3adc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 22 Sep 2016 22:05:50 +0200 -Subject: [PATCH 105/333] i2c: bcm2835: Can't support I2C_M_IGNORE_NAK +Subject: [PATCH 104/407] i2c: bcm2835: Can't support I2C_M_IGNORE_NAK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -123685,10 +123657,10 @@ index 54d510abd46a117c9238fc6d7edec84019d1f60d..565ef69ce61423544dc0558c85ef318b if (i2c_dev->msg_err & BCM2835_I2C_S_ERR) -From d3471f1468b1298552273ea26bc5f692d37dbce8 Mon Sep 17 00:00:00 2001 +From 9f88578ea7178421cd974f03b91586b674103a9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 23 Sep 2016 04:54:27 +0200 -Subject: [PATCH 106/333] i2c: bcm2835: Add support for Repeated Start +Subject: [PATCH 105/407] i2c: bcm2835: Add support for Repeated Start Condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -123870,10 +123842,10 @@ index 565ef69ce61423544dc0558c85ef318b0ae9c324..241e08ae7c27cec23fad3c1bf3ebad3a static u32 bcm2835_i2c_func(struct i2c_adapter *adap) -From 1529a6f05233bd956e8a9b635bd03a14f5aa854f Mon Sep 17 00:00:00 2001 +From ddd4a5251807ae4111ff4414be991acebd84440c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Fri, 23 Sep 2016 04:57:17 +0200 -Subject: [PATCH 107/333] i2c: bcm2835: Support i2c-dev ioctl I2C_TIMEOUT +Subject: [PATCH 106/407] i2c: bcm2835: Support i2c-dev ioctl I2C_TIMEOUT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -123910,10 +123882,10 @@ index 241e08ae7c27cec23fad3c1bf3ebad3a4d2a8e6f..d2085dd3742eabebc537621968088261 bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, BCM2835_I2C_C_CLEAR); -From 9bd9738412c734572e8eb84823fd1455b830a16b Mon Sep 17 00:00:00 2001 +From 769299f418be7ea8de653f62372f44b0db0cb629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 27 Sep 2016 01:00:08 +0200 -Subject: [PATCH 108/333] i2c: bcm2835: Add support for dynamic clock +Subject: [PATCH 107/407] i2c: bcm2835: Add support for dynamic clock MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -124029,10 +124001,10 @@ index d2085dd3742eabebc537621968088261f8dc7ea8..c3436f627028477f7e21b47e079fd5ab irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); if (!irq) { -From 81cd88dfbb483f9f9a22128136234caf119617f5 Mon Sep 17 00:00:00 2001 +From 7d589a187405118555041ad88934a27aed4d00d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Tue, 1 Nov 2016 15:15:41 +0100 -Subject: [PATCH 109/333] i2c: bcm2835: Add debug support +Subject: [PATCH 108/407] i2c: bcm2835: Add debug support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -124221,10 +124193,10 @@ index c3436f627028477f7e21b47e079fd5ab06ec188a..8642f580ce41803bd22c76a0fa80d083 if (i2c_dev->msg_err & BCM2835_I2C_S_ERR) return -EREMOTEIO; -From 6f8de955b8c941a35751433e2474196aa321af89 Mon Sep 17 00:00:00 2001 +From 29b3bbea51b7ee1540a01b2ce034e0f064435eb1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 31 Dec 2016 14:15:50 +0000 -Subject: [PATCH 110/333] arm64: Add CONFIG_ARCH_BCM2835 +Subject: [PATCH 109/407] arm64: Add CONFIG_ARCH_BCM2835 --- arch/arm64/configs/bcmrpi3_defconfig | 1 + @@ -124240,10 +124212,10 @@ index d7406f5a4620151044b8f716b4d10bb818648e06..53da5c7a33e5898a66e549fb0c39fe3d CONFIG_BCM2708_VCHIQ=n +CONFIG_ARCH_BCM2835=y -From c4fa4640c5e8a2d2ad0d5761732e8cf48ed66373 Mon Sep 17 00:00:00 2001 +From b5329e81ab48f04e7da61211c1859137e7fdb10f Mon Sep 17 00:00:00 2001 From: Alex Tucker Date: Tue, 13 Dec 2016 19:50:18 +0000 -Subject: [PATCH 111/333] Add support for Silicon Labs Si7013/20/21 +Subject: [PATCH 110/407] Add support for Silicon Labs Si7013/20/21 humidity/temperature sensor. --- @@ -124318,10 +124290,10 @@ index f6d134c095af2398fc55ae7d2b0e86456c30627c..31bda8da4cb6a56bfe493a81b9189009 }; }; -From a00d2bd6882f19181fdb175edac08f16c2eb4593 Mon Sep 17 00:00:00 2001 +From 5c30317565d85b52c0e676532e7be0a95700be33 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 3 Jan 2017 21:27:46 +0000 -Subject: [PATCH 112/333] Document the si7020 option +Subject: [PATCH 111/407] Document the si7020 option --- arch/arm/boot/dts/overlays/README | 3 +++ @@ -124342,10 +124314,10 @@ index 81d991803be335e5a1bc3bb0a8c7a2c9f5c392bd..e8fa4ccb44c34a20485c4e6155467af9 Name: i2c0-bcm2708 Info: Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations -From f1a44ab25cd089964034fa86e1c7cbaa8aea5a6f Mon Sep 17 00:00:00 2001 +From 1f21d72df5116fa4de994d8f51626db9227099d5 Mon Sep 17 00:00:00 2001 From: Giedrius Trainavicius Date: Thu, 5 Jan 2017 02:38:16 +0200 -Subject: [PATCH 113/333] pisound improvements: +Subject: [PATCH 112/407] pisound improvements: * Added a writable sysfs object to enable scripts / user space software to blink MIDI activity LEDs for variable duration. @@ -124639,10 +124611,10 @@ index 4b8545487d06e4ea70073a5d063fb2310b3b94d0..ba70734b89e61a11201657406223f0b3 }; -From 448b1a0e81e82e70c2182a3e94ee3d02b71f9b48 Mon Sep 17 00:00:00 2001 +From 719dd6e2c86f077276b860ebc8f0ebd5bfe89dfc Mon Sep 17 00:00:00 2001 From: Aaron Shaw Date: Tue, 10 Jan 2017 16:05:41 +0000 -Subject: [PATCH 114/333] Add driver_name property +Subject: [PATCH 113/407] Add driver_name property Add driver name property for use with 5.1 passthrough audio in LibreElec and other Kodi based OSs --- @@ -124662,10 +124634,10 @@ index 8fd50dbe681508a2cfe8fdde1c9fedbe9a507fa7..05a224ec712d06b8b7587ab6b8bb562d .dai_link = snd_rpi_justboom_dac_dai, .num_links = ARRAY_SIZE(snd_rpi_justboom_dac_dai), -From eeb663b6aa7f0f5d07b245e2c9b26e456bcc2f34 Mon Sep 17 00:00:00 2001 +From 9e7d52c10001ca436497c761628271c818d8431b Mon Sep 17 00:00:00 2001 From: Aaron Shaw Date: Tue, 10 Jan 2017 16:11:04 +0000 -Subject: [PATCH 115/333] Add driver_name paramater +Subject: [PATCH 114/407] Add driver_name paramater Add driver_name parameter for use with 5.1 passthrough audio in LibreElec and other Kodi OSs --- @@ -124685,10 +124657,10 @@ index 91acb666380faa3c0deb2230f8a0f8bbec59417b..abfdc5c4dd5811e6847bddda4921abe3 .dai_link = snd_rpi_justboom_digi_dai, .num_links = ARRAY_SIZE(snd_rpi_justboom_digi_dai), -From 3451b0775c378379274e0baa903ebe8182dc74a9 Mon Sep 17 00:00:00 2001 +From 3a2a79e7a9d82f8d17708732d57f0e943d5faaf0 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 11 Jan 2017 13:01:21 +0000 -Subject: [PATCH 116/333] BCM270X_DT: Add pi3-disable-wifi overlay +Subject: [PATCH 115/407] BCM270X_DT: Add pi3-disable-wifi overlay pi3-disable-wifi is a minimal overlay to disable the onboard WiFi. @@ -124749,10 +124721,10 @@ index 0000000000000000000000000000000000000000..017199554bf2f4e381efcc7bb71e750c + }; +}; -From f184fb5a4b6fd0cd06ee9935c6e796b374173379 Mon Sep 17 00:00:00 2001 +From 20d188b5cad62e4e971a004a142cc4c893fff200 Mon Sep 17 00:00:00 2001 From: Electron752 Date: Thu, 12 Jan 2017 07:07:08 -0800 -Subject: [PATCH 117/333] ARM64: Make it work again on 4.9 (#1790) +Subject: [PATCH 116/407] ARM64: Make it work again on 4.9 (#1790) * Invoke the dtc compiler with the same options used in arm mode. * ARM64 now uses the bcm2835 platform just like ARM32. @@ -125157,10 +125129,10 @@ index 53da5c7a33e5898a66e549fb0c39fe3da555ca87..c7e891d72969a388d9b135a36dbfc9c9 -CONFIG_BCM2708_VCHIQ=n -CONFIG_ARCH_BCM2835=y -From 23aebae09cb04f3ff9d4ff48d83f7fe851edad69 Mon Sep 17 00:00:00 2001 +From 11ad54dd8b141f9ec1f6acacb640f33d2f04e524 Mon Sep 17 00:00:00 2001 From: Electron752 Date: Sat, 14 Jan 2017 02:54:26 -0800 -Subject: [PATCH 118/333] ARM64: Enable Kernel Address Space Randomization +Subject: [PATCH 117/407] ARM64: Enable Kernel Address Space Randomization (#1792) Randomization allows the mapping between virtual addresses and physical @@ -125192,10 +125164,10 @@ index c7e891d72969a388d9b135a36dbfc9c9cb609bf8..974d8889c0cf695eb88b57bbef11bc5a CONFIG_BINFMT_MISC=y CONFIG_COMPAT=y -From 9889f9addf81b0d08c7fff7a274846cd1276d68e Mon Sep 17 00:00:00 2001 +From 578118c6fc5f841bdeee082ebadb04e75d728cc1 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sun, 15 Jan 2017 07:31:59 -0800 -Subject: [PATCH 119/333] ARM64: Enable RTL8187/RTL8192CU wifi in build config +Subject: [PATCH 118/407] ARM64: Enable RTL8187/RTL8192CU wifi in build config These drivers build now, so they can be enabled back in the build configuration just like they are for @@ -125220,10 +125192,10 @@ index 974d8889c0cf695eb88b57bbef11bc5aa556b635..4670a490dfb1e582ec24a3b39a3cb9b2 CONFIG_ZD1211RW=m CONFIG_MAC80211_HWSIM=m -From dd798f4f4ad2f1031ad448ebdd9baef3ec381c8f Mon Sep 17 00:00:00 2001 +From f169651ccbdb2656ceb55f70679d0b67aa5ea296 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 16 Jan 2017 14:53:12 +0000 -Subject: [PATCH 120/333] BCM270X_DT: Add spi0-cs overlay +Subject: [PATCH 119/407] BCM270X_DT: Add spi0-cs overlay The spi0-cs overlay allows the software chip selectts to be modified using the cs0_pin and cs1_pin parameters. @@ -125311,10 +125283,10 @@ index 0000000000000000000000000000000000000000..7f79029d043c04d7496c7c3480450c69 + }; +}; -From 8eb8b66da62ddfb52120d259f94ccda7ec714e53 Mon Sep 17 00:00:00 2001 +From 7cd193931052631cf9378f4e59ef0b48ff622dbf Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 1 Jul 2016 22:09:24 +0100 -Subject: [PATCH 121/333] spi-bcm2835: Disable forced software CS +Subject: [PATCH 120/407] spi-bcm2835: Disable forced software CS Select software CS in bcm2708_common.dtsi, and disable the automatic conversion in the driver to allow hardware CS to be re-enabled with an @@ -125340,10 +125312,10 @@ index 74dd21b7373c7564ede01d84a4f63b93a6d52fa7..51cdefbf5eb265f49bd05e0aa91dfbee i2c0: i2c@7e205000 { -From ad85240f90077374dbe3975da2e31a10895947b2 Mon Sep 17 00:00:00 2001 +From 75f7db2e412040eb2efa788547d89d086124f168 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 16 Jan 2017 16:33:54 +0000 -Subject: [PATCH 122/333] config: Add CONFIG_TCP_CONG_BBR See: +Subject: [PATCH 121/407] config: Add CONFIG_TCP_CONG_BBR See: https://github.com/raspberrypi/linux/issues/1784 --- @@ -125378,10 +125350,10 @@ index 8acee9f31202ec14f2933d92dd70831cda8d7b51..219f67051a2542329449b0099165ae28 CONFIG_IPV6_ROUTER_PREF=y CONFIG_INET6_AH=m -From f669453f84859c8f08763482f1d58f4019c3c790 Mon Sep 17 00:00:00 2001 +From 1a98ebf0d14b6b9a305f5e79ed0648f2dfa5142b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 17 Jan 2017 11:34:58 +0000 -Subject: [PATCH 123/333] BCM270X_DT: Enable UART0 on CM3 +Subject: [PATCH 122/407] BCM270X_DT: Enable UART0 on CM3 Signed-off-by: Phil Elwell --- @@ -125404,10 +125376,10 @@ index 41874c25a84226c0e4af92ec4059e0a571fe6123..3ba6e621856c288ae4694f758604619f sdhost_pins: sdhost_pins { brcm,pins = <48 49 50 51 52 53>; -From 15535ce57b3206fef72815a6aa78f46b78145550 Mon Sep 17 00:00:00 2001 +From cf5f1160312e37733e96d67df9d4cc3d1eb41486 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 17 Jan 2017 14:39:39 +0000 -Subject: [PATCH 124/333] config: Add CONFIG_MD_M25P80 and CONFIG_MD_SPI_NOR +Subject: [PATCH 123/407] config: Add CONFIG_MD_M25P80 and CONFIG_MD_SPI_NOR See: https://github.com/raspberrypi/linux/issues/1781 @@ -125446,10 +125418,10 @@ index 219f67051a2542329449b0099165ae2885022bec..c4898d63d74718097ec3a1d1fe60b230 CONFIG_OF_CONFIGFS=y CONFIG_ZRAM=m -From 30e2fd09549061c987740eaff01deba07aab030b Mon Sep 17 00:00:00 2001 +From ab4819fc5ca5012a552aa0fd690c9e1771687ba1 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sat, 14 Jan 2017 21:33:51 -0800 -Subject: [PATCH 125/333] ARM64/DWC_OTG: Port dwc_otg driver to ARM64 +Subject: [PATCH 124/407] ARM64/DWC_OTG: Port dwc_otg driver to ARM64 In ARM64, the FIQ mechanism used by this driver is not current implemented. As a workaround, reqular IRQ is used instead @@ -125792,10 +125764,10 @@ index 6b2c7d0c93f36a63863ff4b0ecc1f3eab77e058b..d7b700ff17821ad1944e36721fe6b2db /** The OS page size */ #define DWC_OS_PAGE_SIZE PAGE_SIZE -From 4dd2d8a6fcc36b2c928676f4408e47a2d5936e03 Mon Sep 17 00:00:00 2001 +From 22ea39a490878318019146d05d5df1e664ea9f93 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sat, 14 Jan 2017 21:43:57 -0800 -Subject: [PATCH 126/333] ARM64: Round-Robin dispatch IRQs between CPUs. +Subject: [PATCH 125/407] ARM64: Round-Robin dispatch IRQs between CPUs. IRQ-CPU mapping is round robined on ARM64 to increase concurrency and allow multiple interrupts to be serviced @@ -125869,10 +125841,10 @@ index 93e3f7660c4230c9f1dd3b195958cb498949b0ca..486bcbfb32305ee417f6b3be7e91a3ff .name = "bcm2836-gpu", .irq_mask = bcm2836_arm_irqchip_mask_gpu_irq, -From ae53979036faba344d693380d4fba83ff48e308a Mon Sep 17 00:00:00 2001 +From e14f5c0663023eff96b84f01a6d2e7cb2768c25a Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sat, 14 Jan 2017 21:45:03 -0800 -Subject: [PATCH 127/333] ARM64: Enable DWC_OTG Driver In ARM64 Build +Subject: [PATCH 126/407] ARM64: Enable DWC_OTG Driver In ARM64 Build Config(bcmrpi3_defconfig) Signed-off-by: Michael Zoran @@ -125893,10 +125865,10 @@ index 4670a490dfb1e582ec24a3b39a3cb9b2488b1864..8c4392344eb4495689c220d5d176ee8c CONFIG_USB_STORAGE=y CONFIG_USB_STORAGE_REALTEK=m -From a57403fd7164bd56c0e21ce7786aec7000d2c26b Mon Sep 17 00:00:00 2001 +From b3748bd7f60b593b8ff504da269a0217526b01ce Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sat, 14 Jan 2017 21:46:04 -0800 -Subject: [PATCH 128/333] ARM64: Use dwc_otg driver by default for USB. +Subject: [PATCH 127/407] ARM64: Use dwc_otg driver by default for USB. If it breaks on anybody, they can use the standard device tree overlays to switch back to the dwc2 driver. @@ -125922,10 +125894,10 @@ index f6def5d7e5d622cf09e8f87332c7374fe28da08b..3e134a1208610b90e2d0fc22f03c6e9f -}; -#endif -From f09f062c3080593bdc97b382de02b81c3a2ce139 Mon Sep 17 00:00:00 2001 +From 8e884b232567aa6ebc96cfc97dfb0932846c2e8a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 23 Jan 2017 17:36:50 +0000 -Subject: [PATCH 129/333] BCM270X_DT: Add reference to audio_pins to CM dtb +Subject: [PATCH 128/407] BCM270X_DT: Add reference to audio_pins to CM dtb The CM1 dtb contains an empty audio_pins node, but no reference to it. Adding the usual pinctrl reference from the audio node enables the @@ -125953,10 +125925,10 @@ index eb8662f0d222b4c0a9a2bcb8bccb13e86a0006b3..10be69972bd1440f574e35d515f3d6a0 hpd-gpios = <&gpio 46 GPIO_ACTIVE_HIGH>; }; -From 9a9271703c6c484961d3e9cb4cd27f7d85114b77 Mon Sep 17 00:00:00 2001 +From 2f051b7ece8201d5fd71dec10542fc5ef1d1b18a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 25 Jan 2017 11:30:38 +0000 -Subject: [PATCH 130/333] config: Add additional network scheduling modules +Subject: [PATCH 129/407] config: Add additional network scheduling modules --- arch/arm/configs/bcm2709_defconfig | 4 ++++ @@ -126008,10 +125980,10 @@ index c4898d63d74718097ec3a1d1fe60b2307a6a3140..b448eaa866c200f48351819072c7fefc CONFIG_NET_SCH_PLUG=m CONFIG_NET_CLS_BASIC=m -From 35c38d158eb6c9396b684a013fc311ce4d2d34d0 Mon Sep 17 00:00:00 2001 +From b286821e3df6b2deb3d2ca957e66f821112ace76 Mon Sep 17 00:00:00 2001 From: chris johnson Date: Sun, 22 Jan 2017 03:27:31 +0000 -Subject: [PATCH 131/333] ASoC: A simple-card overlay for ADAU7002 +Subject: [PATCH 130/407] ASoC: A simple-card overlay for ADAU7002 Usage: `dtoverlay=adau7002-simple` --- @@ -126109,10 +126081,10 @@ index 0000000000000000000000000000000000000000..e67e6625d7967abc92cf00cb604d4c12 + }; +}; -From 4513fd91e410b9626b8775732cd440f2799df6db Mon Sep 17 00:00:00 2001 +From 3aac88fb104525297282441ac1f7fee8ed858e4e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 25 Jan 2017 21:17:23 +0000 -Subject: [PATCH 132/333] config: Add SND_SOC_ADAU7002 codec module +Subject: [PATCH 131/407] config: Add SND_SOC_ADAU7002 codec module As there is now an overlay requiring it, build the codec module. @@ -126147,10 +126119,10 @@ index b448eaa866c200f48351819072c7fefcd8ad8132..5105a592c9bcfee1cc6a8b50fd1c6c32 CONFIG_SND_SOC_WM8804_I2C=m CONFIG_SND_SIMPLE_CARD=m -From ce41f5282b6f4b01f8f07d6c018a37882ee07168 Mon Sep 17 00:00:00 2001 +From 5ece6fd836f5e6aa82c34c2d7d03ef362028c642 Mon Sep 17 00:00:00 2001 From: Scott Ellis Date: Fri, 27 Jan 2017 06:42:42 -0500 -Subject: [PATCH 133/333] Add overlay for mcp3008 adc (#1818) +Subject: [PATCH 132/407] Add overlay for mcp3008 adc (#1818) Some example usage: @@ -126436,10 +126408,10 @@ index 0000000000000000000000000000000000000000..06bf4264959c380d8a9f90f74e780397 + }; +}; -From a14d25b106b231228302f8111189eafc6a2b7f9b Mon Sep 17 00:00:00 2001 +From d047f035a6019a53fb48b1391bf34b79045bed13 Mon Sep 17 00:00:00 2001 From: ED6E0F17 Date: Fri, 3 Feb 2017 14:52:42 +0000 -Subject: [PATCH 134/333] usb: dwc2: Avoid suspending if we're in gadget mode +Subject: [PATCH 133/407] usb: dwc2: Avoid suspending if we're in gadget mode (#1825) I've found when booting HiKey with the usb gadget cable attached @@ -126491,10 +126463,10 @@ index df5a065780054f21841ca9f08b8ab118922c530b..619ccfe1eafc4643b16970f8a1129ff9 goto skip_power_saving; -From 67495276b108df918fe42e96c2f05f43fefbfb63 Mon Sep 17 00:00:00 2001 +From 98331706fbd73e02e23d85d60f83fb405786e943 Mon Sep 17 00:00:00 2001 From: JamesH65 Date: Mon, 6 Feb 2017 15:24:47 +0000 -Subject: [PATCH 135/333] gpio_mem: Remove unnecessary dev_info output (#1830) +Subject: [PATCH 134/407] gpio_mem: Remove unnecessary dev_info output (#1830) The open function was spamming syslog every time called, so have removed call completely. @@ -126516,10 +126488,10 @@ index 911f5b7393ed48ceed8751f06967ae6463453f9c..f5e7f1ba8fb6f18dee77fad06a17480c dev_err(inst->dev, "Unknown minor device: %d", dev); ret = -ENXIO; -From fbcad54e77f3066ae9534f07e39541e2166b1b17 Mon Sep 17 00:00:00 2001 +From a63b17f579fafc50c33f36a6ec77f07a1bdccfb6 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 22 Jan 2017 12:49:36 +0100 -Subject: [PATCH 136/333] config: Enable regulator support +Subject: [PATCH 135/407] config: Enable regulator support Signed-off-by: Matthias Reichl --- @@ -126554,10 +126526,10 @@ index 5105a592c9bcfee1cc6a8b50fd1c6c32f1381158..74bc0d81bcb4d7f6676368926cdcc10e CONFIG_MEDIA_CAMERA_SUPPORT=y CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -From ddc4f69ea847898ce9782abc61640cbfc28d3c24 Mon Sep 17 00:00:00 2001 +From 71439e02a4d54f858b6c088657e1d5d7fb61d45a Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 22 Jan 2017 12:49:36 +0100 -Subject: [PATCH 137/333] BCM270x DT: expose 3.3V and 5V system rails +Subject: [PATCH 136/407] BCM270x DT: expose 3.3V and 5V system rails Signed-off-by: Matthias Reichl --- @@ -126590,10 +126562,10 @@ index a46cb4a8b1419edd95e0e07c18b0f373222dc2bf..36d853715f2379e1952ce3d3be58dd67 + }; }; -From b289a31002b3a3974bdd2701d338a75116525efc Mon Sep 17 00:00:00 2001 +From 81c296070600095a9d4b772b17989670008562a9 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 22 Jan 2017 12:49:36 +0100 -Subject: [PATCH 138/333] BCM270x DT: Consolidate audio card overlays +Subject: [PATCH 137/407] BCM270x DT: Consolidate audio card overlays Reference 3.3V / 5V system rails instead of instantiating local regulators. @@ -126888,10 +126860,10 @@ index 16b1247bfa618ff85936ddf78c3aea58075eaa67..f8d48233e28c7c18509b4a95692f6aff __overlay__ { compatible = "rra,digidac1-soundcard"; -From fdfaf6f6ae997b67b6f29ccdaccfecb3bc0acede Mon Sep 17 00:00:00 2001 +From 874a59615acb13409ab6f694880f17ed21c1f604 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 22 Jan 2017 12:49:37 +0100 -Subject: [PATCH 139/333] ASoC: Add driver for Cirrus Logic Audio Card +Subject: [PATCH 138/407] ASoC: Add driver for Cirrus Logic Audio Card Note: due to problems with deferred probing of regulators the following softdep should be added to a modprobe.d file @@ -128141,10 +128113,10 @@ index 0000000000000000000000000000000000000000..ac8651ddff7bd3701dffe22c7fb88352 +MODULE_DESCRIPTION("ASoC driver for Cirrus Logic Audio Card"); +MODULE_LICENSE("GPL"); -From ecdcc87a89eb054185e088896962dcce267af5d7 Mon Sep 17 00:00:00 2001 +From 7c82eb9cd99a9efb435e5f2ce9caf108727adf28 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 22 Jan 2017 12:49:37 +0100 -Subject: [PATCH 140/333] config: enable Cirrus Logic Audio Card +Subject: [PATCH 139/407] config: enable Cirrus Logic Audio Card Signed-off-by: Matthias Reichl --- @@ -128193,10 +128165,10 @@ index 74bc0d81bcb4d7f6676368926cdcc10e581fbcae..f0b87d15e959d88eb26e5a11244365da CONFIG_SND_BCM2708_SOC_RPI_PROTO=m CONFIG_SND_BCM2708_SOC_JUSTBOOM_DAC=m -From f8af32a41f506e8b1b86527d40bb479ed03c3697 Mon Sep 17 00:00:00 2001 +From 4bf34aa99d4a32ca056a2b12a22f4ae274f142ac Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 9 Feb 2017 14:33:30 +0000 -Subject: [PATCH 141/333] irq-bcm2836: Avoid "Invalid trigger warning" +Subject: [PATCH 140/407] irq-bcm2836: Avoid "Invalid trigger warning" Initialise the level for each IRQ to avoid a warning from the arm arch timer code. @@ -128220,10 +128192,10 @@ index 486bcbfb32305ee417f6b3be7e91a3ff069a586c..e10597c1a1e51e5e27aa574b6a26d871 static void -From 3b243945989186dbf9c0be7f01baf8ac10f980c9 Mon Sep 17 00:00:00 2001 +From 02f8fa0c7505d04bceb99c291afb497479f08d4b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 9 Feb 2017 14:36:44 +0000 -Subject: [PATCH 142/333] sound: Demote deferral errors to INFO level +Subject: [PATCH 141/407] sound: Demote deferral errors to INFO level At present there is no mechanism to specify driver load order, which can lead to deferrals and repeated retries until successful. @@ -128258,10 +128230,10 @@ index 4e3de566809c6b4776415482490ff80df2003351..d83f645de9ef60a05c6b8bb44bb2ae85 goto _err_defer; } -From c2b96b9c9b856b80baaadcbf0ba3417482bc2e3e Mon Sep 17 00:00:00 2001 +From 64a3dce4255f64306c75ac80b3d6acf38b2fd7a3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 9 Feb 2017 14:40:33 +0000 -Subject: [PATCH 143/333] sound: Suppress error message about deferrals +Subject: [PATCH 142/407] sound: Suppress error message about deferrals Since driver load deferrals are expected and will already have resulted in a kernel message, suppress an essentially @@ -128508,10 +128480,10 @@ index 9db678e885efd63d84d60a098a84ed6772b19a2d..fadbfade100228aaafabb0d3bdf35c01 return ret; } -From fcbfa6ac4dc09ba4690da779ca17917dfa712e0c Mon Sep 17 00:00:00 2001 +From 138fbe4304ec28007b9d22bf6483cd77a8d156fe Mon Sep 17 00:00:00 2001 From: Claggy3 Date: Sat, 11 Feb 2017 14:00:30 +0000 -Subject: [PATCH 144/333] Update vfpmodule.c +Subject: [PATCH 143/407] Update vfpmodule.c Christopher Alexander Tobias Schulze - May 2, 2015, 11:57 a.m. This patch fixes a problem with VFP state save and restore related @@ -128648,10 +128620,10 @@ index da0b33deba6d3c2906eef271f253ab7a30a92680..c6f1d6da808cda78a58f184e19e83522 /* * Save the userland NEON/VFP state. Under UP, -From 6e4267e73af495e16f5f25cb189a3a863c02a861 Mon Sep 17 00:00:00 2001 +From 95640bee1c031b655d6ddfa5908e016e643b786b Mon Sep 17 00:00:00 2001 From: Martin Cerveny Date: Mon, 13 Feb 2017 17:23:47 +0100 -Subject: [PATCH 145/333] dwc_otg: fix summarize urb->actual_length for +Subject: [PATCH 144/407] dwc_otg: fix summarize urb->actual_length for isochronous transfers Kernel does not copy input data of ISO transfers to userspace @@ -128679,10 +128651,10 @@ index 162a656501988e56c9d780b7793d365fde09f801..992269d61ecf48126379a38e528f7190 dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_urb, i); } -From 463b7dfa83259cc9901a174ae3d94065c17db89a Mon Sep 17 00:00:00 2001 +From aee20a4b1fac81d93cddcfc057d3926bee5fc51f Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 1 Dec 2016 22:00:19 +0100 -Subject: [PATCH 146/333] clk: bcm: Support rate change propagation on bcm2835 +Subject: [PATCH 145/407] clk: bcm: Support rate change propagation on bcm2835 clocks Some peripheral clocks, like the VEC (Video EnCoder) clock need to be set @@ -128807,10 +128779,10 @@ index a99ccf9f056d3a3e7c482339e08483f3701ebc04..dafaa6b22724ab41dac1327cfa81de09 init.ops = &bcm2835_vpu_clock_clk_ops; } else { -From f4ef8c2c6049fab1399aafe73f619212bd66bece Mon Sep 17 00:00:00 2001 +From d3b08f7e205161eac205e3fa1722ea140a3ab1db Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 1 Dec 2016 22:00:20 +0100 -Subject: [PATCH 147/333] clk: bcm: Allow rate change propagation to PLLH_AUX +Subject: [PATCH 146/407] clk: bcm: Allow rate change propagation to PLLH_AUX on VEC clock The VEC clock requires needs to be set at exactly 108MHz. Allow rate @@ -128845,10 +128817,10 @@ index dafaa6b22724ab41dac1327cfa81de09908a4dfd..0453d7c6a63923370e4191db2c4d083b /* dsi clocks */ [BCM2835_CLOCK_DSI0E] = REGISTER_PER_CLK( -From 434c023fcae46c254747d31f92362560d15006b7 Mon Sep 17 00:00:00 2001 +From 5fbb29f27f6858ae4dd488a4a3212ab835e72a1e Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Mon, 12 Dec 2016 09:00:53 +0100 -Subject: [PATCH 148/333] clk: bcm: Fix 'maybe-uninitialized' warning in +Subject: [PATCH 147/407] clk: bcm: Fix 'maybe-uninitialized' warning in bcm2835_clock_choose_div_and_prate() best_rate is reported as potentially uninitialized by gcc. @@ -128877,10 +128849,10 @@ index 0453d7c6a63923370e4191db2c4d083b893b3b47..9d895726ebb24bc78a2014870dbdd7c7 struct clk_hw *parent; -From 6adb20ed4f3eeb23885d34ee0968d7fee4954819 Mon Sep 17 00:00:00 2001 +From 911bf67fed2dca7df50716028979399836730eea Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Jan 2017 07:31:55 +1100 -Subject: [PATCH 149/333] clk: bcm2835: Don't rate change PLLs on behalf of DSI +Subject: [PATCH 148/407] clk: bcm2835: Don't rate change PLLs on behalf of DSI PLL dividers. Our core PLLs are intended to be configured once and left alone. With @@ -129052,10 +129024,10 @@ index 9d895726ebb24bc78a2014870dbdd7c779cd1cdf..b58cff2756581ba7e0be8a818cdbdf72 /* the clocks */ -From b82b8915eecba54c8e4593d78a40b9ee811d0ca7 Mon Sep 17 00:00:00 2001 +From b503261deb2448610bdd5bedf8e5563afccd5d68 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Jan 2017 07:31:56 +1100 -Subject: [PATCH 150/333] clk: bcm2835: Register the DSI0/DSI1 pixel clocks. +Subject: [PATCH 149/407] clk: bcm2835: Register the DSI0/DSI1 pixel clocks. The DSI pixel clocks are muxed from clocks generated in the analog phy by the DSI driver. In order to set them as parents, we need to do the @@ -129297,10 +129269,10 @@ index 360e00cefd35679b49890234b5c369fb52b89e20..a0c812b0fa391d149b4f546db39bdc4b +#define BCM2835_CLOCK_DSI0P 49 +#define BCM2835_CLOCK_DSI1P 50 -From d80c8de54e6f77084e312e42a426981607432732 Mon Sep 17 00:00:00 2001 +From 60547f6862479895b25468cb49644657c0266377 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Jan 2017 07:31:57 +1100 -Subject: [PATCH 151/333] clk: bcm2835: Add leaf clock measurement support, +Subject: [PATCH 150/407] clk: bcm2835: Add leaf clock measurement support, disabled by default This proved incredibly useful during debugging of the DSI driver, to @@ -129646,10 +129618,10 @@ index b2c277b378ee799a4f8e05ad076d1253e85cb392..136e5d28f9eaeaa10d45382a0f31da9f /* the gates */ -From cd0a65c4a6040ce6b78002c5082d2b627bce3465 Mon Sep 17 00:00:00 2001 +From d416327a55ba5a7a85a9aebe798617d12d92fd86 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 26 Apr 2016 13:46:13 -0700 -Subject: [PATCH 152/333] drm/panel: Add support for the Raspberry Pi 7" +Subject: [PATCH 151/407] drm/panel: Add support for the Raspberry Pi 7" Touchscreen. This driver communicates with the Atmel microcontroller for sequencing @@ -130230,10 +130202,10 @@ index 0000000000000000000000000000000000000000..1a536fe4d040f5fafe324baee110a622 +MODULE_DESCRIPTION("Raspberry Pi 7-inch touchscreen driver"); +MODULE_LICENSE("GPL v2"); -From 2dbd7082c50fe13152aa0a336c274f3a0fd71221 Mon Sep 17 00:00:00 2001 +From 094ea60f70d5b872209922e6e8a7ba5dbc43cb16 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 2 Jun 2016 12:29:45 -0700 -Subject: [PATCH 153/333] BCM270X: Add the DSI panel to the defconfig. +Subject: [PATCH 152/407] BCM270X: Add the DSI panel to the defconfig. Signed-off-by: Eric Anholt --- @@ -130282,10 +130254,10 @@ index 8c4392344eb4495689c220d5d176ee8c189079fd..301611d2283f5f8800339271cea59aed CONFIG_DRM_VC4=m CONFIG_FB=y -From 42d4686afac4874fe1e77c9a46f17f58e2851310 Mon Sep 17 00:00:00 2001 +From 18c24e31a56cb983ad121f24a9bff95313420f5f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 13 Dec 2016 15:15:10 -0800 -Subject: [PATCH 154/333] ARM: bcm2835: dt: Add the DSI module nodes and +Subject: [PATCH 153/407] ARM: bcm2835: dt: Add the DSI module nodes and clocks. The modules stay disabled by default, and if you want to enable DSI @@ -130389,10 +130361,10 @@ index 51cdefbf5eb265f49bd05e0aa91dfbeee3fbfdcc..41776b97b4b6b1c053d07fd357fac4ba compatible = "brcm,bcm2835-i2c"; reg = <0x7e804000 0x1000>; -From 6697d662440c1eec433a08ef6d78528a669a4a44 Mon Sep 17 00:00:00 2001 +From 2bc0c12370784471b83d8ee9700a7734121931a9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 2 Jun 2016 15:09:35 -0700 -Subject: [PATCH 155/333] BCM270X: Enable the DSI panel node in the VC4 +Subject: [PATCH 154/407] BCM270X: Enable the DSI panel node in the VC4 overlay. Signed-off-by: Eric Anholt @@ -130543,10 +130515,10 @@ index 4f1cc20f90dc6780f74e08ebee00e5a1a6062c85..f25cd9a3936861920b0d518ff2d773ee cma-256 = <0>,"+0-1-2-3-4"; cma-192 = <0>,"-0+1-2-3-4"; -From fbfb4c2693dd55104da1c4135b03e1710d98fb49 Mon Sep 17 00:00:00 2001 +From 2d8022c1e08ef83772a14b2ace74e2de9d67bbe0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 3 Nov 2016 18:53:10 -0700 -Subject: [PATCH 156/333] drm/vc4: Add support for rendering with ETC1 +Subject: [PATCH 155/407] drm/vc4: Add support for rendering with ETC1 textures. The validation for it ends up being quite simple, but I hadn't got @@ -130606,10 +130578,10 @@ index ad7edc3edf7ca1d653a0bc025a5eda6692b74370..69caa21f0cb23c9439238f6239c0041b struct drm_vc4_get_param { __u32 param; -From 620de3026e4dc66a45add79475d22f0e71486627 Mon Sep 17 00:00:00 2001 +From 8ebf3d4544599d3d6770e4d7095724bcfd2621a6 Mon Sep 17 00:00:00 2001 From: Jonas Pfeil Date: Tue, 8 Nov 2016 00:18:39 +0100 -Subject: [PATCH 157/333] drm/vc4: Add fragment shader threading support +Subject: [PATCH 156/407] drm/vc4: Add fragment shader threading support FS threading brings performance improvements of 0-20% in glmark2. @@ -130845,10 +130817,10 @@ index 69caa21f0cb23c9439238f6239c0041b178d5669..f07a090167261131076438960c1dec17 struct drm_vc4_get_param { __u32 param; -From 10c2ec3ad3ae9c153c217868f8955b0629e83320 Mon Sep 17 00:00:00 2001 +From e320e259ef5feeb3eab0e7b75e1f38655143f24d Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 2 Dec 2016 14:48:09 +0100 -Subject: [PATCH 158/333] drm: Add TV connector states to drm_connector_state +Subject: [PATCH 157/407] drm: Add TV connector states to drm_connector_state Some generic TV connector properties are exposed in drm_mode_config, but they are currently handled independently in each DRM encoder driver. @@ -130870,7 +130842,7 @@ Signed-off-by: Eric Anholt 2 files changed, 82 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c -index 4e19bde4bbffac08e700460b69db882f42d5463b..846da4f6416435221cb8d08a8c124f05852e93ca 100644 +index 34adde169a789616002b2e2f3af7186d5441023a..3c7610161c2e2bfaa94bcc12d3d1046f004a6558 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -989,12 +989,38 @@ int drm_atomic_connector_set_property(struct drm_connector *connector, @@ -130998,10 +130970,10 @@ index d8bb8d151825fe818a0fc8cf0b1d685feae6b686..c9fbc52e88879c9b91c63b4d1f7abf0f /** -From 2476ea415dfa5a1d3d5aa0ac658ea88688a4cfd2 Mon Sep 17 00:00:00 2001 +From 2f1fc6aab70899cf1ff56d5869fb719d878b751b Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 2 Dec 2016 14:48:08 +0100 -Subject: [PATCH 159/333] drm: Turn DRM_MODE_SUBCONNECTOR_xx definitions into +Subject: [PATCH 158/407] drm: Turn DRM_MODE_SUBCONNECTOR_xx definitions into an enum List of values like the DRM_MODE_SUBCONNECTOR_xx ones are better @@ -131048,10 +131020,10 @@ index df0e3504c349a950bf41540fbcd6cd944cf11d2f..970bfc0d7107451e5bc4e29c524a764c #define DRM_MODE_CONNECTOR_Unknown 0 #define DRM_MODE_CONNECTOR_VGA 1 -From ae696d49d8f02312c2c8bdb4c2b81bb3078327e1 Mon Sep 17 00:00:00 2001 +From 1eb0d1d23ac91063c2d6106b3fae07d2b0a974cb Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 2 Dec 2016 14:48:10 +0100 -Subject: [PATCH 160/333] drm/vc4: Add support for the VEC (Video Encoder) IP +Subject: [PATCH 159/407] drm/vc4: Add support for the VEC (Video Encoder) IP The VEC IP is a TV DAC, providing support for PAL and NTSC standards. @@ -131790,10 +131762,10 @@ index 0000000000000000000000000000000000000000..32bb8ef985fbc6f39f9e5f459846bb77 + }, +}; -From 86529e8e5ef8357f6cdb818ee827aded932760e9 Mon Sep 17 00:00:00 2001 +From 55d158db4f025bd4a4d329709c01b647a975c169 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 15 Sep 2016 15:25:23 +0100 -Subject: [PATCH 161/333] drm/vc4: Set up SCALER_DISPCTRL at boot. +Subject: [PATCH 160/407] drm/vc4: Set up SCALER_DISPCTRL at boot. We want the HVS on, obviously, and we also want DSP3 (PV1's source) to be muxed from HVS channel 2 like we expect in vc4_crtc.c. The @@ -131853,10 +131825,10 @@ index 39f6886b24100c43b590e47e0c7bc44846721d65..b3b297fba7097bc495fa8916292c5479 * SCALER_DISPSTAT_IRQDISP0. Note that short frame contributions are * always enabled. -From 0166abc72e519cc0e510efb5d58b8698fc0e6466 Mon Sep 17 00:00:00 2001 +From a464236920171f2c4936d5b688f0fa3acd4d36bb Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 10 Feb 2016 16:17:29 -0800 -Subject: [PATCH 162/333] drm/vc4: Add support for feeding DSI encoders from +Subject: [PATCH 161/407] drm/vc4: Add support for feeding DSI encoders from the pixel valve. We have to set a different pixel format, which tells the hardware to @@ -131971,10 +131943,10 @@ index b3b297fba7097bc495fa8916292c547925720199..385405a2df05eb3dd86d4f687aa82053 # define PV_VCONTROL_VIDEN BIT(0) -From 2a62b128abb164bf75852e4f452083202df5d7a5 Mon Sep 17 00:00:00 2001 +From a87d6faa513958a6f6b5427c4ac5d3acb9799011 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 10 Feb 2016 11:42:32 -0800 -Subject: [PATCH 163/333] drm/vc4: Add DSI driver +Subject: [PATCH 162/407] drm/vc4: Add DSI driver The DSI0 and DSI1 blocks on the 2835 are related hardware blocks. Some registers move around, and the featureset is slightly different, @@ -133802,10 +133774,10 @@ index 0000000000000000000000000000000000000000..17fcac381dbb37cd9a5ff210ad8578f4 + }, +}; -From 2fa052cc2f215bf395b3359bbd53dd3ff76f73ca Mon Sep 17 00:00:00 2001 +From 253c94650c07b28d4f3e9d3e86904ce0c25048c4 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 2 Dec 2016 14:48:12 +0100 -Subject: [PATCH 164/333] ARM: dts: bcm283x: Add VEC node in bcm283x.dtsi +Subject: [PATCH 163/407] ARM: dts: bcm283x: Add VEC node in bcm283x.dtsi Add the VEC (Video EnCoder) node definition in bcm283x.dtsi. @@ -133836,10 +133808,10 @@ index 41776b97b4b6b1c053d07fd357fac4ba4787ac53..d3cc586661f903e67a840189c0446aa8 compatible = "brcm,bcm2835-pixelvalve2"; reg = <0x7e807000 0x100>; -From c4af8f91964cd6ef3e9c73a9dd2bc4092f8c9c02 Mon Sep 17 00:00:00 2001 +From 2782121124b526dc32b6638874b089ea3ba32c0d Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Fri, 2 Dec 2016 14:48:13 +0100 -Subject: [PATCH 165/333] ARM: dts: bcm283x: Enable the VEC IP on all +Subject: [PATCH 164/407] ARM: dts: bcm283x: Enable the VEC IP on all RaspberryPi boards Enable the VEC IP on all RaspberryPi boards. @@ -133865,10 +133837,10 @@ index 365648898f3acc4f82dc6cb58e4bbebbe249be94..d4577a51e678cb600b475d3d3395ca4e + status = "okay"; +}; -From e46ccf0a0bb67b34a7c8e9a32dcb22fab11292af Mon Sep 17 00:00:00 2001 +From 78eccf54c65c107f571a58617303bba3f00c58bc Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 23 Jan 2017 11:41:54 -0800 -Subject: [PATCH 166/333] BCM270X: Disable VEC unless vc4-kms-v3d is present. +Subject: [PATCH 165/407] BCM270X: Disable VEC unless vc4-kms-v3d is present. Signed-off-by: Eric Anholt --- @@ -133907,10 +133879,10 @@ index f25cd9a3936861920b0d518ff2d773ee467e2f49..a8ef8c9051668a7477dea30aa262568c cma-256 = <0>,"+0-1-2-3-4"; cma-192 = <0>,"-0+1-2-3-4"; -From a05f3d7833439d78ceaa9e265b55cb66c86d297d Mon Sep 17 00:00:00 2001 +From 2227e95ee07be88e3c97736f9b00b26d69c8916a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Feb 2017 17:09:18 -0800 -Subject: [PATCH 167/333] drm/vc4: Name the primary and cursor planes in fkms. +Subject: [PATCH 166/407] drm/vc4: Name the primary and cursor planes in fkms. This makes debugging nicer, compared to trying to remember what the IDs are. @@ -133934,10 +133906,10 @@ index d18a1dae51a2275846c9826b5bf1ba57ae97b55c..e49ce68b607a7ffc2329e3235362f3bc if (type == DRM_PLANE_TYPE_PRIMARY) { vc4_plane->fbinfo = -From 9e8f1c682a868d29d1ee9efca588208e0a53ceaf Mon Sep 17 00:00:00 2001 +From 2e0272e4b8249f4077222d397b19b3191a435525 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Feb 2017 17:10:09 -0800 -Subject: [PATCH 168/333] drm/vc4: Add DRM_DEBUG_ATOMIC for the insides of +Subject: [PATCH 167/407] drm/vc4: Add DRM_DEBUG_ATOMIC for the insides of fkms. Trying to debug weston on fkms involved figuring out what calls I was @@ -134007,10 +133979,10 @@ index e49ce68b607a7ffc2329e3235362f3bc21ed5cbb..dbf065677202fbebf8e3a0cffbe880aa RPI_FIRMWARE_SET_CURSOR_STATE, &packet_state, -From ef5c5d7599133674d68a6853ba28c289d174408f Mon Sep 17 00:00:00 2001 +From 80736c96167adf154db28ad01058a678720eb770 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 2 Feb 2017 09:42:18 -0800 -Subject: [PATCH 169/333] drm/vc4: Fix sending of page flip completion events +Subject: [PATCH 168/407] drm/vc4: Fix sending of page flip completion events in FKMS mode. In the rewrite of vc4_crtc.c for fkms, I dropped the part of the @@ -134052,10 +134024,10 @@ index dbf065677202fbebf8e3a0cffbe880aa42daef3f..da818a207bfa639b8cea48d94bcf4566 static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc) -From 4208c51bfbb7b59041dbc8cc8b1cce0ae86537ca Mon Sep 17 00:00:00 2001 +From c91109c6e22b5a3373816bed129084c28b99a2f7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 8 Feb 2017 15:00:54 -0800 -Subject: [PATCH 170/333] drm/vc4: Fulfill user BO creation requests from the +Subject: [PATCH 169/407] drm/vc4: Fulfill user BO creation requests from the kernel BO cache. The from_cache flag was actually "the BO is invisible to userspace", @@ -134108,10 +134080,10 @@ index ec9023bd935b6755b3c2b6a7e171cb269562234c..fd83a28076564b9ea5cf0f2ba29b884e cma_obj = drm_gem_cma_create(dev, size); -From 5e93c74fa219d2f84e1f283ba8896e1735fe059a Mon Sep 17 00:00:00 2001 +From 024a87f01028f4f6e827e0ccfc65f640ef6793f5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 12 Oct 2015 08:58:08 -0700 -Subject: [PATCH 171/333] drm/vc4: Verify at boot that CMA doesn't cross a +Subject: [PATCH 170/407] drm/vc4: Verify at boot that CMA doesn't cross a 256MB boundary. I've seen lots of users cranking CMA up higher, so throw an error if @@ -134194,10 +134166,10 @@ index c960459eda7e640ea55be1d4ed80c6a9125a8877..b50245282a18bc790da0f901944c2e67 static unsigned long cma_bitmap_aligned_mask(const struct cma *cma, int align_order) -From 4b820b9a57bbbb599d8abffb652411b371446b11 Mon Sep 17 00:00:00 2001 +From 32a29eb522d6c408a742a98f6fc8effcb2981df3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 17 Feb 2017 09:47:11 +0000 -Subject: [PATCH 172/333] BCM270X_DT: Add SMSC ethernet controller to DT +Subject: [PATCH 171/407] BCM270X_DT: Add SMSC ethernet controller to DT With an ethernet node in the DT, a suitable firmware can populate the local-mac-address property, removing the need for a downstream patch @@ -134260,10 +134232,10 @@ index d29ba72de727fe26b5a586e0bd0a41181c68ae04..78101849441679baf3624cf67a0ff7a2 / { model = "Raspberry Pi 3 Model B"; -From 8adaacce18fb91e16485465a8505552e558e9712 Mon Sep 17 00:00:00 2001 +From b2845e8744f422ce6ff3add81a34735ad398ff1d Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 17 Feb 2017 15:26:13 +0000 -Subject: [PATCH 173/333] brcmfmac: Mute expected startup 'errors' +Subject: [PATCH 172/407] brcmfmac: Mute expected startup 'errors' The brcmfmac WiFi driver always complains about the '00' country code and the firmware version is reported as an error. Modify the driver to @@ -134276,10 +134248,10 @@ Signed-off-by: Phil Elwell 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -index 3ac3056ab1d2074e4a60961455f0c355c5a18afd..11e73bff0f479b6dc1157fe39120b33796acb894 100644 +index 98fa503627d62dd247a30a0db83ced788d41749d..3d28de96298c7cded3d231dd2f837ff182575c8c 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -6811,6 +6811,8 @@ static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy, +@@ -6812,6 +6812,8 @@ static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy, /* ignore non-ISO3166 country codes */ for (i = 0; i < sizeof(req->alpha2); i++) if (req->alpha2[i] < 'A' || req->alpha2[i] > 'Z') { @@ -134302,10 +134274,10 @@ index 4051780f64f44a5ce522babe6c371a1beb79a824..b081673abcb4aa72d70d8e0834b608f6 /* locate firmware version number for ethtool */ ptr = strrchr(buf, ' ') + 1; -From 6adc0fdd9834f3d29b0b46f159322a3a0f8f0690 Mon Sep 17 00:00:00 2001 +From 8c79f28797174182e0a0857bbbdfc8b3982e12eb Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Feb 2017 17:20:08 +0000 -Subject: [PATCH 174/333] clk-bcm2835: Mark used PLLs and dividers CRITICAL +Subject: [PATCH 173/407] clk-bcm2835: Mark used PLLs and dividers CRITICAL The VPU configures and relies on several PLLs and dividers. Mark all enabled dividers and their PLLs as CRITICAL to prevent the kernel from @@ -134333,10 +134305,10 @@ index 136e5d28f9eaeaa10d45382a0f31da9f4adb91ef..4192863778c8009aacfc9a49ee38ad1c divider->data = data; -From a76f7d87569ccbfa8c26dbdbd7d13dbb44f62254 Mon Sep 17 00:00:00 2001 +From f3dadcc060593fe1db2e51d56cc1c25fd5b114af Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Feb 2017 17:20:08 +0000 -Subject: [PATCH 175/333] clk-bcm2835: Add claim-clocks property +Subject: [PATCH 174/407] clk-bcm2835: Add claim-clocks property The claim-clocks property can be used to prevent PLLs and dividers from being marked as critical. It contains a vector of clock IDs, @@ -134471,10 +134443,10 @@ index 4192863778c8009aacfc9a49ee38ad1ca62a01e4..6b245357e4e93c19a839eee92a82f95a sizeof(cprman_parent_names)); of_clk_parent_fill(dev->of_node, cprman->real_parent_names, -From 1dfd09ca2f5b859ae58f39d98eff6179fa0e875d Mon Sep 17 00:00:00 2001 +From fb96945a7764438118efec9d179b66c1ee8ce872 Mon Sep 17 00:00:00 2001 From: Scott Ellis Date: Thu, 23 Feb 2017 11:56:20 -0500 -Subject: [PATCH 176/333] Add ads1015 driver to config +Subject: [PATCH 175/407] Add ads1015 driver to config --- arch/arm/configs/bcm2709_defconfig | 3 ++- @@ -134528,10 +134500,10 @@ index 9a9cd1cdcb2f76d4408568681ec80885293bae48..554fed3a4fbfd1940422b808046c6d2b CONFIG_FB=y CONFIG_FB_BCM2708=y -From 98f6f6971310915ae0fd83d9cd758c47cbdc568a Mon Sep 17 00:00:00 2001 +From a4363a9c00ef47ca5a444d33f5bce9859109789e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 27 Jan 2017 18:49:30 +0000 -Subject: [PATCH 177/333] config: add slcan kernel module +Subject: [PATCH 176/407] config: add slcan kernel module See: https://github.com/raspberrypi/linux/issues/1819 --- @@ -134564,10 +134536,10 @@ index 554fed3a4fbfd1940422b808046c6d2b1f508394..99888182259b280790a7506b248a8130 CONFIG_IRDA=m CONFIG_IRLAN=m -From ecc50cd95a75ce79c969babde03d63a0be0e55f6 Mon Sep 17 00:00:00 2001 +From 68eaac8e21467fb1f4eaaea43972c9270dcb6b28 Mon Sep 17 00:00:00 2001 From: Miquel Date: Fri, 24 Feb 2017 20:51:06 +0100 -Subject: [PATCH 178/333] sound: Support for Dion Audio LOCO-V2 DAC-AMP HAT +Subject: [PATCH 177/407] sound: Support for Dion Audio LOCO-V2 DAC-AMP HAT Signed-off-by: Miquel Blauw --- @@ -134831,10 +134803,10 @@ index 0000000000000000000000000000000000000000..a009c49477972a9832175d86f201b035 +MODULE_DESCRIPTION("ASoC Driver for DionAudio LOCO-V2"); +MODULE_LICENSE("GPL v2"); -From 9c2092a775e3ee13b4b49cbe254aae5f4fe061e8 Mon Sep 17 00:00:00 2001 +From 1746721884c3b195e77742dd18f0efe0a71a0473 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Sun, 26 Feb 2017 01:13:02 +0000 -Subject: [PATCH 179/333] SQUASH: Add LOCO-V2 overlay from last commit +Subject: [PATCH 178/407] SQUASH: Add LOCO-V2 overlay from last commit --- .../dts/overlays/dionaudio-loco-v2-overlay.dts | 49 ++++++++++++++++++++++ @@ -134897,10 +134869,10 @@ index 0000000000000000000000000000000000000000..a1af93de30119734e8d14cbd454589d3 + }; +}; -From a112c026f3f9b568ede75c4667696b9d2459bc86 Mon Sep 17 00:00:00 2001 +From 736da2c903d1af5be1c8f09c9b690e774f84cfd5 Mon Sep 17 00:00:00 2001 From: Fe-Pi Date: Wed, 1 Mar 2017 04:42:43 -0700 -Subject: [PATCH 180/333] Add support for Fe-Pi audio sound card. (#1867) +Subject: [PATCH 179/407] Add support for Fe-Pi audio sound card. (#1867) Fe-Pi Audio Sound Card is based on NXP SGTL5000 codec. Mechanical specification of the board is the same the Raspberry Pi Zero. @@ -135249,10 +135221,10 @@ index 0000000000000000000000000000000000000000..015b56fd73cc36be5b5eecd17548fd03 +MODULE_DESCRIPTION("ASoC Driver for Fe-Pi Audio"); +MODULE_LICENSE("GPL v2"); -From 0a112ade84a1272c378f6faa9015ca73ab54b37c Mon Sep 17 00:00:00 2001 +From 93ad217221be3e601b8b86d45715b89bfe8739cf Mon Sep 17 00:00:00 2001 From: Scott Ellis Date: Wed, 1 Mar 2017 07:22:24 -0500 -Subject: [PATCH 181/333] Add overlay for ads1115 ADCs (#1864) +Subject: [PATCH 180/407] Add overlay for ads1115 ADCs (#1864) --- arch/arm/boot/dts/overlays/Makefile | 1 + @@ -135416,10 +135388,10 @@ index 0000000000000000000000000000000000000000..7c16a1af3172d14e1a976b1776b9f167 + }; +}; -From 63849896099f242a008cd1d71ad43491bb2a8b7c Mon Sep 17 00:00:00 2001 +From 0f746123264ec57d864a52c90c0246dd92c2fdb2 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 1 Mar 2017 16:06:53 +0000 -Subject: [PATCH 182/333] clk-bcm2835: Correct the prediv logic +Subject: [PATCH 181/407] clk-bcm2835: Correct the prediv logic If a clock has the prediv flag set, both the integer and fractional parts must be scaled when calculating the resulting frequency. @@ -135446,10 +135418,10 @@ index 6b245357e4e93c19a839eee92a82f95aec996e4e..8ea29fbc8dc451b9cff502bc1a918ae6 return bcm2835_pll_rate_from_divisors(parent_rate, ndiv, fdiv, pdiv); } -From 21632d9c4a620b8a5d9b3620b1abedfedc2aeeb7 Mon Sep 17 00:00:00 2001 +From d7437560a222e7b10b4968b903120b609971cb61 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 1 Mar 2017 16:07:39 +0000 -Subject: [PATCH 183/333] amba_pl011: Round input clock up +Subject: [PATCH 182/407] amba_pl011: Round input clock up The UART clock is initialised to be as close to the requested frequency as possible without exceeding it. Now that there is a @@ -135535,10 +135507,10 @@ index 5a11ff833e1fd112ba04df3a427cd94bf6793ec5..003a5b0c30295dbbcb94a28d0c64d124 /* unregisters the driver also if no more ports are left */ static void pl011_unregister_port(struct uart_amba_port *uap) -From f588d401f3521fcdffc580f5f79832b01461e718 Mon Sep 17 00:00:00 2001 +From 87c53e874dd099b3c1d6addd559b28e47fee43a0 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Mon, 13 Feb 2017 11:10:50 +0000 -Subject: [PATCH 184/333] BCM2835-V4L2: Ensure H264 header bytes get a sensible +Subject: [PATCH 183/407] BCM2835-V4L2: Ensure H264 header bytes get a sensible timestamp H264 header come off VC with 0 timestamps, which means they get a @@ -135627,10 +135599,10 @@ index e6aeb7e7e381de65d6c6586205069a4c5cd33274..7f8a68916a67001bc9241bce2928519a struct vchiq_mmal_port *port; /* port being used for capture */ /* camera port being used for capture */ -From 97c509f21effc49710a8b8aa821cbb59c2ac4101 Mon Sep 17 00:00:00 2001 +From a10321139f0a4aa96965158dee8b921857f3de67 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Mon, 13 Feb 2017 13:11:41 +0000 -Subject: [PATCH 185/333] BCM2835-V4L2: Correctly denote key frames in encoded +Subject: [PATCH 184/407] BCM2835-V4L2: Correctly denote key frames in encoded data Forward MMAL key frame flags to the V4L2 buffers. @@ -135655,10 +135627,10 @@ index e69731320f4e59249933bc21843913deab4a1209..6bdec0806126044cf7146d53326e4da5 "Buffer has ts %llu", dev->capture.last_timestamp); -From 853f1cb229d1b95d7317c90e02356411b52fb54f Mon Sep 17 00:00:00 2001 +From cdc2861928e350dc0c6225ba452c44dd73987e15 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Mon, 20 Feb 2017 17:01:21 +0000 -Subject: [PATCH 186/333] bcm2835-gpio-exp: Driver for GPIO expander via +Subject: [PATCH 185/407] bcm2835-gpio-exp: Driver for GPIO expander via mailbox service Pi3 and Compute Module 3 have a GPIO expander that the @@ -136076,10 +136048,10 @@ index 2859db09e25bb945251e85edb39bc43430857168..56b3f0fe1ea3d22fcf207e6df90b640e /* Dispmanx TAGS */ RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, -From eb8a2a405131da2dcb48f9ceb1e84624e36a74ba Mon Sep 17 00:00:00 2001 +From 43bbc1c0db5aefbb787f1e9fda8a94901a1e8ad5 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 24 May 2016 16:30:05 +0100 -Subject: [PATCH 187/333] BCM270X_DT: Add bcm2708-rpi-0-w.dts +Subject: [PATCH 186/407] BCM270X_DT: Add bcm2708-rpi-0-w.dts Add DT support for the Pi Zero W. N.B. It will not be loaded automatically without a corresponding change to the firmware. @@ -136307,10 +136279,10 @@ index 0000000000000000000000000000000000000000..db0f99ddf2f46e83827d56e21c4846dd + }; +}; -From 01d7f126153cdcca1a4485fa1307bf02e7c7782d Mon Sep 17 00:00:00 2001 +From 4a6c96302e7e9d1b916efa0ba6ef45aadc6f4b08 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 6 Mar 2017 09:06:18 +0000 -Subject: [PATCH 188/333] clk-bcm2835: Read max core clock from firmware +Subject: [PATCH 187/407] clk-bcm2835: Read max core clock from firmware The VPU is responsible for managing the core clock, usually under direction from the bcm2835-cpufreq driver but not via the clk-bcm2835 @@ -136438,10 +136410,10 @@ index 8ea29fbc8dc451b9cff502bc1a918ae65fb1b306..fe3298b54cdfb96bd90fb4f39e13921d for (i = 0; !of_property_read_u32_index(pdev->dev.of_node, "claim-clocks", -From 09d842645afec4e4f6abb2248e3a7d4ac9d20042 Mon Sep 17 00:00:00 2001 +From 8e33148920258a333684bca3851e040d4093be9a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 7 Mar 2017 19:48:23 +0000 -Subject: [PATCH 189/333] config: Add CONFIG_CRYPTO_LZ4 +Subject: [PATCH 188/407] config: Add CONFIG_CRYPTO_LZ4 Enabling this options allows LZ4 memory compression. @@ -136478,10 +136450,10 @@ index 2c124bbfa343bf2c160250d055e1509678a80850..1748fcb84bdc3853ffccba93a41cd2dc # CONFIG_CRYPTO_HW is not set CONFIG_ARM_CRYPTO=y -From f49d5ade059457fe5ecd6780a4c16626ff168390 Mon Sep 17 00:00:00 2001 +From fbd464b0d5c40ce1400198fdd3edc09e12bab819 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Thu, 23 Feb 2017 17:54:31 -0800 -Subject: [PATCH 190/333] drm/vc4: Don't wait for vblank when updating the +Subject: [PATCH 189/407] drm/vc4: Don't wait for vblank when updating the cursor Commonly used desktop environments such as xfce4 and gnome @@ -136538,10 +136510,10 @@ index 881bf489478b01b34e9e4df6013fe608c42215ee..14d69bb4967dedcd3bbc475639a8c27e * expected change from the drm_mode_cursor_universal() * helper. -From 395bfbecbb6c0b316fbb0cf2c3affd3fa49f78cc Mon Sep 17 00:00:00 2001 +From bcc460aedfc775135164e2bf2468de2f8f149714 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 6 Mar 2017 12:17:16 -0800 -Subject: [PATCH 191/333] panel-raspberrypi-touchscreen: Round up clk rate to +Subject: [PATCH 190/407] panel-raspberrypi-touchscreen: Round up clk rate to fix DSI panel. Commit 488f9bc8e3def93e0baef53cee2026c2cb0d8956 slightly increased the @@ -136576,10 +136548,10 @@ index 1a536fe4d040f5fafe324baee110a6225dd0be08..7f315f04b109621ca7f3861fdd8acf95 .hsync_start = HACT + HFP, .hsync_end = HACT + HFP + HSW, -From bfaa2b04167eb889aa546138ad76d4cb2eac5136 Mon Sep 17 00:00:00 2001 +From e3e95c6c54c04a31a1091deb343ab074e4988f3a Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Wed, 8 Mar 2017 20:04:13 +1100 -Subject: [PATCH 192/333] Add support for the AudioInjector.net Octo sound card +Subject: [PATCH 191/407] Add support for the AudioInjector.net Octo sound card --- arch/arm/boot/dts/overlays/Makefile | 1 + @@ -137050,10 +137022,10 @@ index 0000000000000000000000000000000000000000..9effea725798640887755dfa688da453 +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:audioinjector-octo-soundcard"); -From 9bd9691a00100615c17f57381edc8af4f0bad582 Mon Sep 17 00:00:00 2001 +From 48f9836cabf8f9a1f914c8649c13a370ddf2baef Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Wed, 8 Mar 2017 21:13:24 +1100 -Subject: [PATCH 193/333] ASoC: bcm2835_i2s.c: relax the ch2 register setting +Subject: [PATCH 192/407] ASoC: bcm2835_i2s.c: relax the ch2 register setting for 8 channels This patch allows ch2 registers to be set for 8 channels of audio. @@ -137082,10 +137054,10 @@ index 6ba20498202ed36906b52096893a88867a79269f..c8dd065aea8414b47aa2ea4fc04168b5 format |= BCM2835_I2S_CH1(BCM2835_I2S_CHPOS(ch1pos)); format |= BCM2835_I2S_CH2(BCM2835_I2S_CHPOS(ch2pos)); -From 29b7b2f34b075024b4da055a4bb2ccaa5edd8229 Mon Sep 17 00:00:00 2001 +From 2cbcf14f43074989219a2fc29b73eca0ee0886b5 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Fri, 10 Mar 2017 14:43:15 +0000 -Subject: [PATCH 194/333] bcm2835-v4l2: Fix buffer overflow problem +Subject: [PATCH 193/407] bcm2835-v4l2: Fix buffer overflow problem https://github.com/raspberrypi/linux/issues/1447 port_parameter_get() failed to account for the header @@ -137121,10 +137093,10 @@ index 781322542d5a8295f3d7d5a3eaaf0cac29930c30..e4b243b33f58913f3d2952c97d2a2e3f * but report true size of parameter */ -From d8facab91514a4e7ed040dffbf8e329c93791c5e Mon Sep 17 00:00:00 2001 +From c100d76794f226d889e2c17a4bb9f662c553fba1 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 10 Feb 2017 17:57:08 -0800 -Subject: [PATCH 195/333] build/arm64: Add rules for .dtbo files for dts +Subject: [PATCH 194/407] build/arm64: Add rules for .dtbo files for dts overlays We now create overlays as .dtbo files. @@ -137149,10 +137121,10 @@ index 3635b8662724569d3338ebb620d603c644fe38b7..822fefeb1cd0aa2dc8398f885cf28e9b dtbs: prepare scripts -From 83bdf63bdefa88503907986af885ac3c3c433274 Mon Sep 17 00:00:00 2001 +From 6b512f7362468e0dd40b49687d1c87d97fb17369 Mon Sep 17 00:00:00 2001 From: John Greb Date: Wed, 8 Mar 2017 15:12:29 +0000 -Subject: [PATCH 196/333] Match dwc2 device-tree fifo sizes to the hardware +Subject: [PATCH 195/407] Match dwc2 device-tree fifo sizes to the hardware values. Since commit aa381a7259c3f53727bcaa8c5f9359e940a0e3fd was reverted with 3fa9538539ac737096c81f3315a14670b1609092 the g-tx-fifo-size array in the device-tree needs to match the preset values in the bcm2835. @@ -137183,10 +137155,10 @@ index 527abc9f0ddf71f4dc7d58336d87684c931cc2f3..265a16bab008453edba198cf2366c423 }; }; -From ac319910e6b0f9d9820d1595da5fa04bfed88b8c Mon Sep 17 00:00:00 2001 +From e0395d0a189a39ff83a9e59ead61abe4d9302219 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 5 Mar 2017 11:46:41 +0000 -Subject: [PATCH 197/333] config: Add RTL8XXXU wifi module +Subject: [PATCH 196/407] config: Add RTL8XXXU wifi module --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -137218,10 +137190,10 @@ index bf52db66afb2aa18d6f6f9fb9b64dcbd97e24521..4bc0f8b52b7f39f99d650cb9c4cdfdba CONFIG_ZD1211RW=m CONFIG_MAC80211_HWSIM=m -From 2e57f1ca0b97013b5c339cf7f852e844dac79e99 Mon Sep 17 00:00:00 2001 +From 89f5fa7b19a4e9a47581847f41357bea76245e2c Mon Sep 17 00:00:00 2001 From: "K. Y. Srinivasan" Date: Thu, 22 Dec 2016 16:54:00 -0800 -Subject: [PATCH 198/333] Drivers: hv: vmbus: Fix a rescind handling bug +Subject: [PATCH 197/407] Drivers: hv: vmbus: Fix a rescind handling bug commit ccb61f8a99e6c29df4fb96a65dad4fad740d5be9 upstream. @@ -137253,10 +137225,10 @@ index 1606e7f08f4b36750be747feb5d0e9f36b3e6dd0..9aff4f6f5423a3b03fa834d4f69d4bb5 /* * If the channel has been rescinded; -From 43d73bce76989d6b059f83e91e1116068fd39391 Mon Sep 17 00:00:00 2001 +From d4ef183988fc60403940762aafec91e4bd6e9e1f Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Tue, 7 Mar 2017 12:18:20 +0000 -Subject: [PATCH 199/333] BCM270X_DT: Invert Pi3 power LED to match fw change +Subject: [PATCH 198/407] BCM270X_DT: Invert Pi3 power LED to match fw change Firmware expgpio driver reworked due to complaint over hotplug detect. @@ -137282,10 +137254,10 @@ index 173103aaca503833b5e29530ed94e14c7cab0444..b21d2866d204adc533b46d581028f290 }; -From 98bcc0b5a5de1412cf587ee873f398a96de82af4 Mon Sep 17 00:00:00 2001 +From a0f37db1e4641d6b68927d29b3fe614e473ffbec Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 14 Mar 2017 09:10:05 +0000 -Subject: [PATCH 200/333] BCM270X_DT: Add lm75 to i2c-sensor overlay +Subject: [PATCH 199/407] BCM270X_DT: Add lm75 to i2c-sensor overlay See: https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=177236 @@ -137348,10 +137320,10 @@ index 31bda8da4cb6a56bfe493a81b918900995fb0589..606b2d5012abf2e85712be631c42ea40 }; }; -From 83805c440f168c6676ce7e4b474385bffea20a95 Mon Sep 17 00:00:00 2001 +From 4d00bc356d2c81e776512e89e099fd152e863ee6 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Tue, 14 Mar 2017 14:23:06 +0000 -Subject: [PATCH 201/333] bcm2835-gpio-exp: Copy/paste error adding base twice +Subject: [PATCH 200/407] bcm2835-gpio-exp: Copy/paste error adding base twice brcmexp_gpio_set was adding gpio->gc.base to the offset twice, so passing an invalid number to the mailbox service. @@ -137377,10 +137349,10 @@ index 681a91492d4c33bdfd42416e069218e8611cc4d9..d68adafaee4ad406f45f4ff0d6b7c1ad set.state = val; /* Output state */ -From cc857754907d1164415bbf80ad5dda60e751368c Mon Sep 17 00:00:00 2001 +From 724c1499768ca4b383327471d0a3532343c8e5e3 Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Wed, 15 Mar 2017 11:12:40 +0000 -Subject: [PATCH 202/333] bcm2835-camera: Correct port_parameter_get return +Subject: [PATCH 201/407] bcm2835-camera: Correct port_parameter_get return value The API for port_parameter_get() requires that the @@ -137438,10 +137410,10 @@ index e4b243b33f58913f3d2952c97d2a2e3fbbbd0ae8..ec2853ba9d4b1b0cd6e07a495a424e15 pr_debug("%s:result:%d component:0x%x port:%d parameter:%d\n", __func__, ret, port->component->handle, port->handle, parameter_id); -From 7513dfca3bf6c8921dc918b4c2025b522b42e7e0 Mon Sep 17 00:00:00 2001 +From 73a01c02bc75471ae61a40341c4098774a69abba Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 17 Mar 2017 12:24:41 +0000 -Subject: [PATCH 203/333] config: Make spidev a loadable module +Subject: [PATCH 202/407] config: Make spidev a loadable module spidev isn't required early in the boot process, and not all users need it (spi_bcm2835 is a module), so make it a loadable module. @@ -137497,10 +137469,10 @@ index 4bc0f8b52b7f39f99d650cb9c4cdfdba6fac59dd..8d64ce4465f6f276b2d58ed1e2e45fb0 CONFIG_SND_SIMPLE_CARD=m CONFIG_SOUND_PRIME=m -From 102f318d7745f522d2bf7a9781f01369d7fc873d Mon Sep 17 00:00:00 2001 +From bdb9f4538bf10c28a6ee2822a6c65f41c4799c75 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 23 Mar 2017 10:06:56 +0000 -Subject: [PATCH 204/333] ASoC: Add prompt for ICS43432 codec +Subject: [PATCH 203/407] ASoC: Add prompt for ICS43432 codec Without a prompt string, a config setting can't be included in a defconfig. Give CONFIG_SND_SOC_ICS43432 a prompt so that Pi soundcards @@ -137525,10 +137497,10 @@ index 9824cdd04b0c11c45b8cedd0187a0eba8f1dc2d4..c0b88d43df0de283c58ed6158680bc7e config SND_SOC_INNO_RK3036 tristate "Inno codec driver for RK3036 SoC" -From c977b9b9da8f91d8efaca8b112317148ea79a13b Mon Sep 17 00:00:00 2001 +From eaf7124d5cf9b9afd4ce45a70e185a9ec3bcb078 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 23 Mar 2017 16:34:46 +0000 -Subject: [PATCH 205/333] bcm2835-aux: Add aux interrupt controller +Subject: [PATCH 204/407] bcm2835-aux: Add aux interrupt controller The AUX block has a shared interrupt line with a register indicating which devices have active IRQs. Expose this as a nested interrupt @@ -137692,10 +137664,10 @@ index bd750cf2238d61489811e7d7bd3b5f9950ed53c8..41e0702fae4692221980b0d02aed1ba6 BCM2835_AUX_CLOCK_COUNT, GFP_KERNEL); if (!onecell) -From 6cdf98fe0a0bd31adc919f75eab8848249003c18 Mon Sep 17 00:00:00 2001 +From 3b4609fa3292ec9140ad9551ba37f8e3b899a1b2 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 23 Mar 2017 17:08:44 +0000 -Subject: [PATCH 206/333] BCM270X_DT: Enable AUX interrupt controller in DT +Subject: [PATCH 205/407] BCM270X_DT: Enable AUX interrupt controller in DT See: https://github.com/raspberrypi/linux/issues/1484 https://github.com/raspberrypi/linux/issues/1573 @@ -137748,10 +137720,10 @@ index d3cc586661f903e67a840189c0446aa80e16a44e..348c71bbc913644c04bab43fcb95abe9 #address-cells = <1>; #size-cells = <0>; -From e17749a4a83f600697fad577f4b3fbaecc0e385b Mon Sep 17 00:00:00 2001 +From d1aa5c7e6ca4104166f02eb90d4fa648802fbad4 Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Mon, 27 Mar 2017 22:26:49 +1100 -Subject: [PATCH 207/333] Audioinjector addons dts : add reset and regulators +Subject: [PATCH 206/407] Audioinjector addons dts : add reset and regulators for the Octo product. This patch adds a reset GPIO for the AudioInjector.net octo sound card. @@ -137818,10 +137790,10 @@ index dbf2f3cacc2e6bf5b7116fbadd97f2781580a79c..a36fa85a61f7eaab35ca481ed1dac621 codec = <&cs42448>; status = "okay"; -From 2be41b56296e6c9940aacfa248c7f517b51ec2b8 Mon Sep 17 00:00:00 2001 +From 534bccb82ed826bba791df37db02e10010a582d0 Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Mon, 27 Mar 2017 22:27:26 +1100 -Subject: [PATCH 208/333] AudioInjector Octo : Consolidate sample rates and add +Subject: [PATCH 207/407] AudioInjector Octo : Consolidate sample rates and add a codec reset. This patch consolidates the sample rates which the audioinjector.net octo @@ -137961,10 +137933,10 @@ index 9effea725798640887755dfa688da45338718afc..1198c36c4563b8673e5d386d1dfa92d4 dai->cpu_dai_name = NULL; dai->cpu_of_node = i2s_node; -From 1989504b19897950753d2372fb0304fb707159d7 Mon Sep 17 00:00:00 2001 +From 7104637e95c6d5098e31fe6a2c478c067e1d47d0 Mon Sep 17 00:00:00 2001 From: Peter Malkin Date: Mon, 27 Mar 2017 16:38:21 -0700 -Subject: [PATCH 209/333] Driver support for Google voiceHAT soundcard. +Subject: [PATCH 208/407] Driver support for Google voiceHAT soundcard. --- arch/arm/boot/dts/overlays/Makefile | 1 + @@ -138469,10 +138441,10 @@ index 0000000000000000000000000000000000000000..225854b8e5298b3c3018f59a49404354 +MODULE_DESCRIPTION("ASoC Driver for Google voiceHAT SoundCard"); +MODULE_LICENSE("GPL v2"); -From 65c719f9b7e44144da58d9123f8339793f01cf4c Mon Sep 17 00:00:00 2001 +From 8cf9c0059d8279611b231700cf452fe51a8abd7c Mon Sep 17 00:00:00 2001 From: Raashid Muhammed Date: Mon, 27 Mar 2017 12:35:00 +0530 -Subject: [PATCH 210/333] Add support for Allo Piano DAC 2.1 plus add-on board +Subject: [PATCH 209/407] Add support for Allo Piano DAC 2.1 plus add-on board for Raspberry Pi. The Piano DAC 2.1 has support for 4 channels with subwoofer. @@ -139100,10 +139072,10 @@ index 0000000000000000000000000000000000000000..f66f42abadbd5f9d3fe000676e8297ed +MODULE_DESCRIPTION("ALSA ASoC Machine Driver for Allo Piano DAC Plus"); +MODULE_LICENSE("GPL v2"); -From b2a4c96d4a003889c70f12134c67e3fa6e52dc80 Mon Sep 17 00:00:00 2001 +From aece32b2f14f8b63450e18262878ee44c7055c33 Mon Sep 17 00:00:00 2001 From: BabuSubashChandar Date: Tue, 28 Mar 2017 20:04:42 +0530 -Subject: [PATCH 211/333] Add support for Allo Boss DAC add-on board for +Subject: [PATCH 210/407] Add support for Allo Boss DAC add-on board for Raspberry Pi. (#1924) Signed-off-by: Baswaraj K @@ -139833,10 +139805,10 @@ index 0000000000000000000000000000000000000000..c080e31065d99ab309ab3bdf41a44adf +MODULE_DESCRIPTION("ALSA ASoC Machine Driver for Allo Boss DAC"); +MODULE_LICENSE("GPL v2"); -From 6b31bb19298813637f99900efc48dfa295cc1618 Mon Sep 17 00:00:00 2001 +From a0490bcf91458208b11b1dc2a0c39a565a5a74cd Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 28 Mar 2017 14:22:20 +0100 -Subject: [PATCH 212/333] BCM270X_DT: Allow multiple instances of w1-gpio +Subject: [PATCH 211/407] BCM270X_DT: Allow multiple instances of w1-gpio overlays Upcoming firmware will modify the address portion of node names when @@ -139901,10 +139873,10 @@ index 66a98f6c9601f51483f27803995bec772bb3350e..ef8bfbcabdb31231075d5c281df3b38b <&w1_pins>,"brcm,pins:4"; pullup = <&w1>,"rpi,parasitic-power:0"; -From 9b08c5e0748459b63b80358e66688544787c2a3b Mon Sep 17 00:00:00 2001 +From e236066d97809dffc9f8529a18dd80de97d38e1b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 28 Mar 2017 17:41:30 +0100 -Subject: [PATCH 213/333] leds-gpio: Remove stray assignment to brightness_set +Subject: [PATCH 212/407] leds-gpio: Remove stray assignment to brightness_set The brightness_set method is intended for use cases that must not block, and can only be used if the GPIO provider can never sleep. @@ -139930,10 +139902,10 @@ index 6a27a693034825de2897bb7b338b60cc10c9e59f..a6b352cb003ff5e6c87cf6d37d6502b6 if (template->default_state == LEDS_GPIO_DEFSTATE_KEEP) { state = gpiod_get_value_cansleep(led_dat->gpiod); -From 0a359745428a2ba445ee5751a6e052207d59bc4d Mon Sep 17 00:00:00 2001 +From 02182d636296fb8bbe77db65bc623bb993f14e16 Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Thu, 30 Mar 2017 11:43:57 +1100 -Subject: [PATCH 214/333] Audioinjector Octo : add extra sample rates, fix rst +Subject: [PATCH 213/407] Audioinjector Octo : add extra sample rates, fix rst and use bcm270x regs This patch adds new sample rates to the Audioinjector Octo sound card. The @@ -140095,10 +140067,10 @@ index 1198c36c4563b8673e5d386d1dfa92d43689e297..dcf403ab37639ba79e38278d7e4b1ade if (i2s_node && codec_node) { dai->cpu_dai_name = NULL; -From ac1ef1aced6e748e2094fccec486e867b374e367 Mon Sep 17 00:00:00 2001 +From 04d2f79b9d7d2f901a06ada1b83686d86185d0e9 Mon Sep 17 00:00:00 2001 From: BabuSubashChandar C Date: Thu, 30 Mar 2017 20:17:27 +0530 -Subject: [PATCH 215/333] Add support for new clock rate and mute gpios. +Subject: [PATCH 214/407] Add support for new clock rate and mute gpios. Signed-off-by: Baswaraj K Reviewed-by: Deepak @@ -140751,10 +140723,10 @@ index c080e31065d99ab309ab3bdf41a44adfdd8f8039..203ab76c7045b081578e23bda1099dd1 } -From b0da4e1f86c6d235fd7bd91513adb26ec81ed10a Mon Sep 17 00:00:00 2001 +From 54addab08f3886ecf09958c0c2fc5362f132afea Mon Sep 17 00:00:00 2001 From: BabuSubashChandar Date: Sat, 1 Apr 2017 00:46:52 +0530 -Subject: [PATCH 216/333] Add clock changes and mute gpios (#1938) +Subject: [PATCH 215/407] Add clock changes and mute gpios (#1938) Also improve code style and adhere to ALSA coding conventions. @@ -141447,10 +141419,10 @@ index f66f42abadbd5f9d3fe000676e8297ed91630e47..56e43f98846b41e487b3089813f7edc3 } -From ebc64b0430419668191cc23857180fd5159f1115 Mon Sep 17 00:00:00 2001 +From 63a93cf37a6632dcccb8051ad6108b4f2e8e6a85 Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Tue, 4 Apr 2017 19:20:59 +1000 -Subject: [PATCH 217/333] Audioinjector : make the octo and pi sound cards have +Subject: [PATCH 216/407] Audioinjector : make the octo and pi sound cards have different driver names This patch gives the audioinjector octo and pi soundcards different driver @@ -141487,10 +141459,10 @@ index ef54e0f07ea03f59e9957b5d98f3e7fdc998e469..491906bbf446826e55dd843f28e4860f .of_match_table = audioinjector_pi_soundcard_of_match, }, -From be67cecffca5025339d71ea31df497d5312f5479 Mon Sep 17 00:00:00 2001 +From 9c3b38122805836515d0ad42aa3071a8fb22e856 Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Tue, 4 Apr 2017 19:23:04 +1000 -Subject: [PATCH 218/333] Audioinjector octo : Make the playback and capture +Subject: [PATCH 217/407] Audioinjector octo : Make the playback and capture symmetric This patch ensures that the sample rate and channel count of the audioinjector @@ -141513,10 +141485,10 @@ index 49115c8e20ce1a2ba5a99feb8983a1cafb052ca2..5e79f4eff93a21ed3495c77a90f73525 }; -From dde81db3416d34a0cf6901acede568d1e014317e Mon Sep 17 00:00:00 2001 +From d012a88ebbd52b8e2cd4ba0bda6ef9103f6da5b8 Mon Sep 17 00:00:00 2001 From: Yasunari Takiguchi Date: Fri, 14 Apr 2017 10:43:57 +0100 -Subject: [PATCH 219/333] This is the driver for Sony CXD2880 DVB-T2/T tuner + +Subject: [PATCH 218/407] This is the driver for Sony CXD2880 DVB-T2/T tuner + demodulator. It includes the CXD2880 driver and the CXD2880 SPI adapter. The current CXD2880 driver version is 1.4.1 - 1.0.1 released on April 13, 2017. @@ -157648,10 +157620,10 @@ index 0000000000000000000000000000000000000000..82e122349055be817eb74ed5bbcd7560 +MODULE_AUTHOR("Sony Semiconductor Solutions Corporation"); +MODULE_LICENSE("GPL v2"); -From b8e6e24c6efb61ca4539ac3ecfae9c7bf46e68dc Mon Sep 17 00:00:00 2001 +From c57b543b45767d3a7775a3a15aa7ba57b5488b62 Mon Sep 17 00:00:00 2001 From: Yasunari Takiguchi Date: Thu, 22 Dec 2016 15:34:12 +0900 -Subject: [PATCH 220/333] BCM2708: Add Raspberry Pi TV HAT Device Tree Support +Subject: [PATCH 219/407] BCM2708: Add Raspberry Pi TV HAT Device Tree Support This is an EXAMPLE CODE of Raspberry Pi TV HAT device tree overlay. Although this is not a part of our release code, it has been used to verify @@ -157747,10 +157719,10 @@ index 0000000000000000000000000000000000000000..a68f6f793d8efd8b2e2adf9f2fb6426f + +}; -From 4c39be9c974a4e0e9c1de98900325cb9cece2075 Mon Sep 17 00:00:00 2001 +From 68fb082466ea477ed4711d42d27fdf89344d37a7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 7 Mar 2017 14:51:03 -0800 -Subject: [PATCH 221/333] drm/vc4: Allow using more than 256MB of CMA memory. +Subject: [PATCH 220/407] drm/vc4: Allow using more than 256MB of CMA memory. Until now, we've had to limit Raspberry Pi to 256MB of CMA memory to keep from triggering the hardware addressing bug between of the tile @@ -158235,10 +158207,10 @@ index 9fd171c361c23b52a4d507919ec7e26fd1e87aac..59d808e2a6cc6f3173b1309cc4f49109 return 0; } -From 4487afaf36cde6aaf368347d1cc5596c0143e07f Mon Sep 17 00:00:00 2001 +From b23263394360e7c31c191a4791c4cecff458be40 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 30 Mar 2017 10:23:27 -0700 -Subject: [PATCH 222/333] Revert "drm/vc4: Verify at boot that CMA doesn't +Subject: [PATCH 221/407] Revert "drm/vc4: Verify at boot that CMA doesn't cross a 256MB boundary." This reverts commit 016c804fa69381bd23a1a13cba08a3c4557fcdff. The @@ -158319,10 +158291,10 @@ index b50245282a18bc790da0f901944c2e670ffac2d2..c960459eda7e640ea55be1d4ed80c6a9 static unsigned long cma_bitmap_aligned_mask(const struct cma *cma, int align_order) -From 69e9d3daf36df62bd21df30798019bc4f28c17c5 Mon Sep 17 00:00:00 2001 +From f8ab62f5172ac09fecc2059b40cd3453c3197c7a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 27 Feb 2017 12:28:02 -0800 -Subject: [PATCH 223/333] drm/vc4: Add HDMI audio support +Subject: [PATCH 222/407] drm/vc4: Add HDMI audio support The HDMI encoder IP embeds all needed blocks to output audio, with a custom DAI called MAI moving audio between the two parts of the HDMI @@ -159091,10 +159063,10 @@ index 385405a2df05eb3dd86d4f687aa8205331bec3cc..932093936178674173a84002b33e07e9 #define VC4_HD_VID_CTL 0x038 # define VC4_HD_VID_CTL_ENABLE BIT(31) -From 23f0997dce132380f019e49bedcc92523dfd4be6 Mon Sep 17 00:00:00 2001 +From 99dd1f559b2cc266442ad24e8d733d3e489b7d87 Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 2 Feb 2017 11:37:36 +0100 -Subject: [PATCH 224/333] ARM: dts: bcm283x: Add HDMI audio related properties +Subject: [PATCH 223/407] ARM: dts: bcm283x: Add HDMI audio related properties Add the dmas and dma-names properties to support HDMI audio. @@ -159119,10 +159091,10 @@ index 348c71bbc913644c04bab43fcb95abe9b6c9c640..7d58cd79ac6bd99f0b47a909ac827c61 }; -From 6387bb28e59ecae300fc0cbf41972329eac21160 Mon Sep 17 00:00:00 2001 +From 79a854e918f199a8b43ff91e6adbca1037cbf6bc Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 12 Apr 2017 17:52:56 -0700 -Subject: [PATCH 225/333] panel-raspberrypi-touchscreen: Fix NULL deref if +Subject: [PATCH 224/407] panel-raspberrypi-touchscreen: Fix NULL deref if probe order goes wrong. If the i2c driver hadn't pobed before the panel driver probes, then @@ -159149,10 +159121,10 @@ index 7f315f04b109621ca7f3861fdd8acf956e752629..b57b7ad9aa4c5048186e98553af59ec9 } -From 14cc03bcb577b43c3bb85d852d550236684b0fd1 Mon Sep 17 00:00:00 2001 +From 2f0aef1f33f8c4a088a9eac662eb1a98d24b31c2 Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Wed, 19 Apr 2017 09:59:21 -0700 -Subject: [PATCH 226/333] smsc75xx: use skb_cow_head() to deal with cloned skbs +Subject: [PATCH 225/407] smsc75xx: use skb_cow_head() to deal with cloned skbs We need to ensure there is enough headroom to push extra header, but we also need to check if we are allowed to change headers. @@ -159188,10 +159160,10 @@ index 9af9799935dbbd4baed06eb03402803e0ce8d9c8..4cb9b11a545a9572ab6d248742ec5abe tx_cmd_a = (u32)(skb->len & TX_CMD_A_LEN) | TX_CMD_A_FCS; -From da587c2ee8f8a5b46534340a1e92cb9df147d258 Mon Sep 17 00:00:00 2001 +From bbc5f254b082695c6f311bb3966f187ca59f8591 Mon Sep 17 00:00:00 2001 From: James Hughes Date: Wed, 19 Apr 2017 11:13:40 +0100 -Subject: [PATCH 227/333] smsc95xx: Use skb_cow_head to deal with cloned skbs +Subject: [PATCH 226/407] smsc95xx: Use skb_cow_head to deal with cloned skbs The driver was failing to check that the SKB wasn't cloned before adding checksum data. @@ -159231,10 +159203,10 @@ index df60c989fc229bf0aab3c27e95ccd45323367840..f6661e388f6e801c1b88e48a3b71407b if (csum) { -From f72710e733975484459533ea35a73479d62eabce Mon Sep 17 00:00:00 2001 +From 8654db5d7dce525ca562bf4f2d1eb053e1556c3d Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Sun, 23 Apr 2017 19:36:53 +0100 -Subject: [PATCH 228/333] BCM270X_DT: Add bme280 and bmp180 to i2c-sensor +Subject: [PATCH 227/407] BCM270X_DT: Add bme280 and bmp180 to i2c-sensor overlay Signed-off-by: Phil Elwell @@ -159308,10 +159280,10 @@ index 606b2d5012abf2e85712be631c42ea40a0b512c5..e23e34b32a0a8927c14203d7384e8008 lm75 = <&lm75>,"status"; lm75addr = <&lm75>,"reg:0"; -From 9c6ebf2b652d737127a217961f9d6d19f92d4be1 Mon Sep 17 00:00:00 2001 +From 9bff223f5b50535f6093b166814eac159a72cbaa Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Sun, 23 Apr 2017 19:38:06 +0100 -Subject: [PATCH 229/333] config: Add CONFIG_BMP280 (and CONFIG_BMP280_I2C) +Subject: [PATCH 228/407] config: Add CONFIG_BMP280 (and CONFIG_BMP280_I2C) Signed-off-by: Phil Elwell --- @@ -159396,10 +159368,10 @@ index fd535ff21e7dab6717eb61f1b966b7d92791ec8d..7948b445f1232064dea01273393f3e3b CONFIG_PWM_PCA9685=m CONFIG_RASPBERRYPI_FIRMWARE=y -From d1058718f92cbb823043da569cb98a880d4d5716 Mon Sep 17 00:00:00 2001 +From a841dbe0f4e269ac6adec812042c17c1161f717c Mon Sep 17 00:00:00 2001 From: Scott Ellis Date: Tue, 25 Apr 2017 10:46:09 -0400 -Subject: [PATCH 230/333] config: Enable TI TMP102 temp sensor module +Subject: [PATCH 229/407] config: Enable TI TMP102 temp sensor module Signed-off-by: Scott Ellis --- @@ -159432,10 +159404,10 @@ index 7948b445f1232064dea01273393f3e3b135b4576..a338c313de9e9db3a338d066b5fad989 CONFIG_THERMAL_BCM2835=y CONFIG_WATCHDOG=y -From a50ff15f843b7efbe966a654775b816d262bf549 Mon Sep 17 00:00:00 2001 +From ea960ddb6362f189ddfb2f7227001eb3d5a420d9 Mon Sep 17 00:00:00 2001 From: Scott Ellis Date: Tue, 25 Apr 2017 13:05:42 -0400 -Subject: [PATCH 231/333] BCM270X_DT: Add tmp102 to i2c sensor overlay +Subject: [PATCH 230/407] BCM270X_DT: Add tmp102 to i2c sensor overlay Signed-off-by: Scott Ellis --- @@ -159515,10 +159487,10 @@ index e23e34b32a0a8927c14203d7384e800878627347..e86a13f92c3f75c14fa4425cdfb081d6 }; }; -From 84b365b047026902b1ce484e99acde3da633daa8 Mon Sep 17 00:00:00 2001 +From 4e76f86083e2e1c7b1cb8a02311a533be8ba5a38 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 26 Apr 2017 16:51:48 +0100 -Subject: [PATCH 232/333] dwc_otg: Add the dependency on FIQ +Subject: [PATCH 231/407] dwc_otg: Add the dependency on FIQ Signed-off-by: popcornmix --- @@ -159526,7 +159498,7 @@ Signed-off-by: popcornmix 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig -index f17b939c149562527937f49d90e23c7ab8b72328..5a5f6c925f43147082dcfaab15f9e05ed966838c 100644 +index 52fba4f05b8c817e1d58e6078bbb771d541e89a7..ed1d19b74e2fb0bc4143ca0193ca8ac459c8ef35 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -764,7 +764,7 @@ config USB_HWA_HCD @@ -159539,10 +159511,10 @@ index f17b939c149562527937f49d90e23c7ab8b72328..5a5f6c925f43147082dcfaab15f9e05e The Synopsis DWC controller is a dual-role host/peripheral/OTG ("On The Go") USB controllers. -From c55b495eada1dcd955d4094e008d70cc9952b98a Mon Sep 17 00:00:00 2001 +From 4155b1f1ece679613bf1155d1aae7d1de7570c1e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 26 Apr 2017 17:28:47 +0100 -Subject: [PATCH 233/333] clk: bcm2835: Limit PCM clock to OSC and PLLD_PER +Subject: [PATCH 232/407] clk: bcm2835: Limit PCM clock to OSC and PLLD_PER It is unwise to use sources other than the oscillator and PLLD_PER for the PCM peripheral (and perhaps others - TBD) because their rate can @@ -159587,10 +159559,10 @@ index fe3298b54cdfb96bd90fb4f39e13921d2e1d4356..c24b4defb2b046e4ecdc109befc2b224 [BCM2835_CLOCK_PWM] = REGISTER_PER_CLK( .name = "pwm", -From 0c5ed6da01f0d05b1698cfd2d30350822c0c1d7a Mon Sep 17 00:00:00 2001 +From b1e22073211bad3295be76cc4761420eb25d68fd Mon Sep 17 00:00:00 2001 From: P33M Date: Thu, 27 Apr 2017 16:24:34 +0100 -Subject: [PATCH 234/333] dwc_otg: make nak_holdoff work as intended with empty +Subject: [PATCH 233/407] dwc_otg: make nak_holdoff work as intended with empty queues If URBs reading from non-periodic split endpoints were dequeued and @@ -159674,10 +159646,10 @@ index c2dff94e8e6edd22e4427aaa1eac7aad972cb6bd..85a6d431ca54b47dc10573aa72d1ad69 } else { uint16_t frame_number = dwc_otg_hcd_get_frame_number(hcd); -From bca5c2327bc50bf3818919ee384bc0a384559231 Mon Sep 17 00:00:00 2001 +From e107020047bcfd006ea02f6c7218df16dd5fc93b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 18 Apr 2017 21:43:46 +0100 -Subject: [PATCH 235/333] vc4_fkms: Apply firmware overscan offset to hardware +Subject: [PATCH 234/407] vc4_fkms: Apply firmware overscan offset to hardware cursor --- @@ -159734,10 +159706,10 @@ index da818a207bfa639b8cea48d94bcf4566f97db816..943cbb38f1f2e6fc7c06870be7904677 return 0; -From 08b67d911abf6b676ba85f204a169d78661560eb Mon Sep 17 00:00:00 2001 +From 11f9c9ef7aea0a2dc48b074d1ba01df933ab5d1a Mon Sep 17 00:00:00 2001 From: P33M Date: Tue, 2 May 2017 16:31:15 +0100 -Subject: [PATCH 236/333] dwc_otg: fix split transaction data toggle handling +Subject: [PATCH 235/407] dwc_otg: fix split transaction data toggle handling around dequeues See https://github.com/raspberrypi/linux/issues/1709 @@ -159825,10 +159797,10 @@ index 608e036be2c9484465ab836de70129335d3d2d96..718a1accc0c219a1764ce53d291de6a2 } qtd = DWC_CIRCLEQ_FIRST(&hc->qh->qtd_list); -From e72d7748c486d5e3cf6da08e12fd7dbb026460fe Mon Sep 17 00:00:00 2001 +From 8d0c81a08f638e3d1de4e83dd2600f6485fd7a2c Mon Sep 17 00:00:00 2001 From: P33M Date: Thu, 4 May 2017 14:56:08 +0100 -Subject: [PATCH 237/333] fiq_fsm: Use correct states when starting isoc OUT +Subject: [PATCH 236/407] fiq_fsm: Use correct states when starting isoc OUT transfers (#1991) * fiq_fsm: Use correct states when starting isoc OUT transfers @@ -159867,10 +159839,10 @@ index 9304279592cb5b388086ef91cb52f1e9f94868ce..208252645c09d1d17bf07673989f91b7 break; } -From c57c2e47041c54ae6fada86ee55acee32ea4f2ba Mon Sep 17 00:00:00 2001 +From f7d6f62fc5d9516064da80675a4cf530e5aa4540 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 2 May 2017 16:36:05 +0100 -Subject: [PATCH 238/333] vcsm: Treat EBUSY as success rather than SIGBUS +Subject: [PATCH 237/407] vcsm: Treat EBUSY as success rather than SIGBUS Currently if two cores access the same page concurrently one will return VM_FAULT_NOPAGE and the other VM_FAULT_SIGBUS crashing the user code. @@ -159908,10 +159880,10 @@ index 1db6716c2c0c8b2013203391501f92d09db258af..ee4e05948c439a9045e0b65566d57587 } } -From 7868a2b49cda01c6cf379c7f6031d5a4938c5f44 Mon Sep 17 00:00:00 2001 +From e594af40141383d0c4e71b8ab7e90e312becbcea Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 4 May 2017 17:38:22 +0100 -Subject: [PATCH 239/333] bcm2708_fb: Avoid firmware mbox call in vc_mem_copy +Subject: [PATCH 238/407] bcm2708_fb: Avoid firmware mbox call in vc_mem_copy If firmware has locked up it is useful to get vcdbg log out without a firmware mbox response. Issue the mbox call at probe time instead. @@ -159975,10 +159947,10 @@ index 53c5a0bdadb4be9251affdabed66305842a08e72..612293cf9f1bd93ad2f2aefdd7ca0f5e if (ret == 0) { platform_set_drvdata(dev, fb); -From 52a6e726152cabfa73d798b71b8c40720d268e93 Mon Sep 17 00:00:00 2001 +From 6c5ca19fd3a6e10dba806ecbc4e898212c82a44f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 5 May 2017 13:23:10 +0100 -Subject: [PATCH 240/333] Revert "serial: 8250: Don't crash when nr_uarts is 0" +Subject: [PATCH 239/407] Revert "serial: 8250: Don't crash when nr_uarts is 0" This reverts commit 9c297d9ebd0d8c6d5e6e8675d527d6a221613abc. --- @@ -159999,10 +159971,10 @@ index cf9c7d2e3f95e1a19410247a89c2e49c1a2747a8..e8819aa20415603c80547e382838a8fa for (i = 0; i < nr_uarts; i++) { struct uart_8250_port *up = &serial8250_ports[i]; -From dd538e060fe82d22db0539fa979e2843cc4f73b3 Mon Sep 17 00:00:00 2001 +From 391dad3ee367155b162abb37764fb5b019be0a30 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 8 May 2017 16:30:18 +0100 -Subject: [PATCH 241/333] ARM: dts: bcm283x: Reserve first page for firmware +Subject: [PATCH 240/407] ARM: dts: bcm283x: Reserve first page for firmware The Raspberry Pi startup stub files for multi-core BCM27XX processors make the secondary CPUs spin until the corresponding mailbox is @@ -160049,10 +160021,10 @@ index 7d58cd79ac6bd99f0b47a909ac827c61aac642d9..0bc1932cde435bd151ffc2364bca5cd9 * bcm2835 and bcm2836 implementations, leaving the CPU configuration to * bcm2835.dtsi and bcm2836.dtsi. -From 52f380d6932c2520cb00b6f421e0755796eeb37a Mon Sep 17 00:00:00 2001 +From 9e530db4c3b0518ba30a0dab8f99ad4bf9fa5b7f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 8 May 2017 16:43:40 +0100 -Subject: [PATCH 242/333] irq_bcm2836: Send event when onlining sleeping cores +Subject: [PATCH 241/407] irq_bcm2836: Send event when onlining sleeping cores In order to reduce power consumption and bus traffic, it is sensible for secondary cores to enter a low-power idle state when waiting to @@ -160088,10 +160060,10 @@ index e10597c1a1e51e5e27aa574b6a26d87181f26221..6dccdf94f6f3b4c6a3f6cb1cae5a6ab2 } -From aaa6dd2c725e81adf9f0f8c24b7515f98cb8d38d Mon Sep 17 00:00:00 2001 +From e520ca557a5d972b809823d73dc5be2996896bcd Mon Sep 17 00:00:00 2001 From: Nisar Sayed Date: Tue, 9 May 2017 18:51:42 +0100 -Subject: [PATCH 243/333] According to RFC 2460, IPv6 UDP calculated checksum +Subject: [PATCH 242/407] According to RFC 2460, IPv6 UDP calculated checksum yields a result of zero must be changed to 0xffff, however this feature is not supported by smsc95xx family hence enable csum offload only for IPv4 TCP/UDP packets. @@ -160136,10 +160108,10 @@ index f6661e388f6e801c1b88e48a3b71407bd70cf56e..b84e98508b5d97165b68dfc30240950e smsc95xx_init_mac_address(dev); -From 78f7bb3c85a115502922bce10458d5540660341b Mon Sep 17 00:00:00 2001 +From a3d9e90a4a48ec130ad224becd4a1ca20c82ed7e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 10 May 2017 12:47:46 +0100 -Subject: [PATCH 244/333] dwcotg: Allow to build without FIQ on ARM64 +Subject: [PATCH 243/407] dwcotg: Allow to build without FIQ on ARM64 Signed-off-by: popcornmix --- @@ -160147,7 +160119,7 @@ Signed-off-by: popcornmix 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig -index 5a5f6c925f43147082dcfaab15f9e05ed966838c..c50476b3d72471faf94c280aab756599fe55ac90 100644 +index ed1d19b74e2fb0bc4143ca0193ca8ac459c8ef35..f3cecb64a380c6d7fca6116c2f94ca42eb3c1aba 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -764,7 +764,7 @@ config USB_HWA_HCD @@ -160160,10 +160132,10 @@ index 5a5f6c925f43147082dcfaab15f9e05ed966838c..c50476b3d72471faf94c280aab756599 The Synopsis DWC controller is a dual-role host/peripheral/OTG ("On The Go") USB controllers. -From 1c9f4d9894f4937dab498689409672390bf01c21 Mon Sep 17 00:00:00 2001 +From bc02dc578a2b8b5e1384ca7f975c8d2b7f51a21c Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 11 May 2017 16:58:16 +0100 -Subject: [PATCH 245/333] BCM270X_DT: Tidy up mmc, sdhost, sdio overlays +Subject: [PATCH 244/407] BCM270X_DT: Tidy up mmc, sdhost, sdio overlays The mmc, sdhost, sdio and sdio-1bit overlays had a few anachronisms and oddities which were overdue for fixing. @@ -160272,10 +160244,10 @@ index 398bd812c716c9e472fbac5aba4fe882114c65d1..215d5e3e8a8ca4363457fed1f7425427 }; }; -From 263b1cf91a5074b6ad8ff7741e22ab7ff5d7240e Mon Sep 17 00:00:00 2001 +From c14613800eaeaacea7abe1dc99ed85d57b21192c Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 11 May 2017 22:00:20 +0100 -Subject: [PATCH 246/333] SQUASH: BCM270X_DT: Fix typo in mmc overlay +Subject: [PATCH 245/407] SQUASH: BCM270X_DT: Fix typo in mmc overlay Signed-off-by: Phil Elwell --- @@ -160296,10 +160268,10 @@ index 64f1ff6684b19e76cfd00e6950919ac55227b44b..88251ad653917674f80c2975de2e425f }; }; -From e4b92ba7962dafe9d49a64fa658756ee9c504644 Mon Sep 17 00:00:00 2001 +From 0cb69678640828cf82be7f4be13de2e6bf6c3e86 Mon Sep 17 00:00:00 2001 From: P33M Date: Fri, 12 May 2017 12:24:00 +0100 -Subject: [PATCH 247/333] dwc_otg: fix several potential crash sources +Subject: [PATCH 246/407] dwc_otg: fix several potential crash sources On root port disconnect events, the host driver state is cleared and in-progress host channels are forcibly stopped. This doesn't play @@ -160495,10 +160467,10 @@ index 718a1accc0c219a1764ce53d291de6a2b6f93608..cf23baaa388562b5843be4cfa6c206cb release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE); break; -From 0c4f6f431d459ef66de3062912b6759012ebe4ad Mon Sep 17 00:00:00 2001 +From 30ec82c009467c990a975860be5db8c48090733b Mon Sep 17 00:00:00 2001 From: P33M Date: Mon, 15 May 2017 14:27:48 +0100 -Subject: [PATCH 248/333] dwc_otg: delete hcd->channel_lock +Subject: [PATCH 247/407] dwc_otg: delete hcd->channel_lock The lock serves no purpose as it is only held while the HCD spinlock is already being held. @@ -160650,10 +160622,10 @@ index cf23baaa388562b5843be4cfa6c206cbdc4e780d..a4355afc77b68718fdaba6c5d4be257d /* Try to queue more transfers now that there's a free channel. */ -From a8d2416fac4026ad0a641e5967aee44ba5ab0084 Mon Sep 17 00:00:00 2001 +From 5561138ed8658d666e4cf4fdc59b9948e8323a1e Mon Sep 17 00:00:00 2001 From: P33M Date: Mon, 15 May 2017 14:51:42 +0100 -Subject: [PATCH 249/333] dwc_otg: remove unnecessary dma-mode channel halts on +Subject: [PATCH 248/407] dwc_otg: remove unnecessary dma-mode channel halts on disconnect interrupt Host channels are already halted in kill_urbs_in_qh_list() with the @@ -160721,10 +160693,10 @@ index 5ec991624c7865901b22ea01b9f2c58c8535ecfd..a2dc6337836b2719f4c954edeeb2a713 if(fiq_enable) { -From e6d972368d1a1fba8ba9235f1ee954b3cc174e41 Mon Sep 17 00:00:00 2001 +From cb7350ac93a58fbdfe016e4cc00b3f0c3eeb8810 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 15 May 2017 09:28:36 -0700 -Subject: [PATCH 250/333] drm/vc4: Mark the device as active when enabling +Subject: [PATCH 249/407] drm/vc4: Mark the device as active when enabling runtime PM. Failing to do so meant that we got a resume() callback on first use of @@ -160750,10 +160722,10 @@ index 882ec06225f1d5caca71bdb5c69664188192c2e2..77ed4ef3b8c8685a3cd8c871bbd249de pm_runtime_set_autosuspend_delay(dev, 40); /* a little over 2 frames. */ pm_runtime_enable(dev); -From d79fb0d3b97c76614e9910f670969ff13d377334 Mon Sep 17 00:00:00 2001 +From a393a21a27f525daf0259f6925fb6081ee2b82ca Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 15 May 2017 11:35:13 -0700 -Subject: [PATCH 251/333] BCM270X: Drop position requirement for CMA in VC4 +Subject: [PATCH 250/407] BCM270X: Drop position requirement for CMA in VC4 overlay. No longer necessary since 2aefcd576195a739a7a256099571c9c4a401005f, @@ -160811,10 +160783,10 @@ index c57e795824e9261e0f60bcb40d6a57241019fd91..bf9395041face775d335177583e0b222 }; -From 9ddcbb20e8821799abca73f5d16923a651a80d12 Mon Sep 17 00:00:00 2001 +From 896bf23232157468b3bee3c37b379410c980b7e3 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Mon, 15 May 2017 16:55:56 +0200 -Subject: [PATCH 252/333] config: Add Goodix touch controller module +Subject: [PATCH 251/407] config: Add Goodix touch controller module Signed-off-by: Ahmet Inan --- @@ -160847,10 +160819,10 @@ index a338c313de9e9db3a338d066b5fad989f6ece1ad..c274e53142ce231819e6421df1257e8a CONFIG_TOUCHSCREEN_USB_COMPOSITE=m CONFIG_TOUCHSCREEN_STMPE=m -From a372b3bde16a61c4c58a19b981f11efd6999e5f0 Mon Sep 17 00:00:00 2001 +From a2ec4dfc5564de9caeaa2a1af65a0a892aaed8f7 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Mon, 15 May 2017 17:10:53 +0200 -Subject: [PATCH 253/333] overlays: Add Goodix overlay +Subject: [PATCH 252/407] overlays: Add Goodix overlay Add support for I2C connected Goodix gt9271 multiple touch controller using GPIOs 4 and 17 (pins 7 and 11 on GPIO header) for interrupt and reset. @@ -160947,10 +160919,10 @@ index 0000000000000000000000000000000000000000..084f74042ed6379ebd9281374d5391a7 + }; +}; -From c29a0a0112c46077abf2233b026f56a95c2b5e11 Mon Sep 17 00:00:00 2001 +From f2e2ec491764f10046e6585bc681120864cef9c9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 16 May 2017 16:55:36 +0100 -Subject: [PATCH 254/333] config: Drop CONFIG_TOUCHSCREEN_EKTF2127 +Subject: [PATCH 253/407] config: Drop CONFIG_TOUCHSCREEN_EKTF2127 --- arch/arm/configs/bcm2709_defconfig | 1 - @@ -160969,10 +160941,10 @@ index c4c5b42016e54d87b9f8f99354b164a0548980f7..fdd17f5625e889257e69c90a0679dc9b CONFIG_TOUCHSCREEN_USB_COMPOSITE=m CONFIG_TOUCHSCREEN_STMPE=m -From f29ec3113a45dd6a4b20154fc6a3265c1b4ab7ae Mon Sep 17 00:00:00 2001 +From 6c8fcf77047dddff95f2e0d2e17a40aa8e32a1cd Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 16 May 2017 15:58:00 +0100 -Subject: [PATCH 255/333] config: Add CONFIG_TOUCHSCREEN_EDT_FT5X06 +Subject: [PATCH 254/407] config: Add CONFIG_TOUCHSCREEN_EDT_FT5X06 --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -161004,10 +160976,10 @@ index c274e53142ce231819e6421df1257e8a3544fd94..d50e88455b4ba5a891a47c2416a09f94 CONFIG_TOUCHSCREEN_USB_COMPOSITE=m CONFIG_TOUCHSCREEN_STMPE=m -From 364fc8ffa627e28b93e1a1afd4b0a05a1c3b3567 Mon Sep 17 00:00:00 2001 +From 23af01481dd0136c4c3293cbefd96e3ade99d545 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 16 May 2017 19:34:52 +0100 -Subject: [PATCH 256/333] config: Add CONFIG_I2C_ROBOTFUZZ_OSIF +Subject: [PATCH 255/407] config: Add CONFIG_I2C_ROBOTFUZZ_OSIF --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -161039,10 +161011,10 @@ index d50e88455b4ba5a891a47c2416a09f9402435b90..9699c93fbb6934b3fded4704316f1ad4 CONFIG_SPI_BCM2835=m CONFIG_SPI_BCM2835AUX=m -From 76a879b00d5500622ac147219d7714e8d01bc951 Mon Sep 17 00:00:00 2001 +From f1b50b645be2b61e3a4d8e76120824d4dff426e1 Mon Sep 17 00:00:00 2001 From: chenzhiwo Date: Wed, 17 May 2017 16:34:57 +0800 -Subject: [PATCH 257/333] Add device tree overlay for GPIO connected rotary +Subject: [PATCH 256/407] Add device tree overlay for GPIO connected rotary encoder. See Documentation/input/rotary-encoder.txt for more information. --- @@ -161134,10 +161106,10 @@ index 0000000000000000000000000000000000000000..c0c6bccff60cc15d9a9bf59d2c7cba41 + }; +}; -From 4974cd29aa54f6a7c12c75172391fb0fc2d6b6e6 Mon Sep 17 00:00:00 2001 +From cb0a1c447acbb1d30364a7d57d14c40d2dd9f82b Mon Sep 17 00:00:00 2001 From: Ed Blake Date: Thu, 10 Nov 2016 18:07:54 +0000 -Subject: [PATCH 258/333] serial: 8250: Add IrDA to UART capabilities +Subject: [PATCH 257/407] serial: 8250: Add IrDA to UART capabilities commit 98838d95075a5295f3478ceba18bcccf472e30f4 upstream. @@ -161218,10 +161190,10 @@ index 48ec7651989b093fc015e44b59657c7000e11012..04185e03d7bec56197cb765377320044 #endif -From a35e61ba42c722e2897f67ed37c99fc2631c317b Mon Sep 17 00:00:00 2001 +From 7eb9fe377e1fbe6710e4ce411c4dc19b44b81677 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 19 May 2017 15:07:27 +0100 -Subject: [PATCH 259/333] serial: 8250: Add CAP_MINI, set for bcm2835aux +Subject: [PATCH 258/407] serial: 8250: Add CAP_MINI, set for bcm2835aux The AUX/mini-UART in the BCM2835 family of procesors is a cut-down 8250 clone. In particular it is lacking support for the following @@ -161273,10 +161245,10 @@ index e10f1244409b344b850ffbbd4af5757a66c875f1..a23c7da42ea81342efc26fb35a92a69d data->uart.port.regshift = 2; data->uart.port.type = PORT_16550; diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c -index f24d3030b98c8d7543ac52e3ebadc65ecfe745ee..2d7a63f69b90415d6e1b6eb1c10612f4aa9fbed2 100644 +index 1ef31e3ee4a1f37886e829deb8668883f8e21044..d8f6fd3276ea1b1976b6e01ed536e16e6f8124cd 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c -@@ -2558,6 +2558,12 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, +@@ -2554,6 +2554,12 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, unsigned long flags; unsigned int baud, quot, frac = 0; @@ -161290,10 +161262,10 @@ index f24d3030b98c8d7543ac52e3ebadc65ecfe745ee..2d7a63f69b90415d6e1b6eb1c10612f4 baud = serial8250_get_baud_rate(port, termios, old); -From 9239400aa108612a265ea0224e76acbb21a7732b Mon Sep 17 00:00:00 2001 +From 48e9218d085587bbb0c50cbd101feda13c9ee81e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 18 May 2017 11:40:43 +0100 -Subject: [PATCH 260/333] config: Add FB_TFT_ST7789V module +Subject: [PATCH 259/407] config: Add FB_TFT_ST7789V module --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -161325,10 +161297,10 @@ index 9699c93fbb6934b3fded4704316f1ad4c4a639d6..b4554044aad7faabd4db57a87c11dba8 CONFIG_FB_TFT_TLS8204=m CONFIG_FB_TFT_UC1701=m -From 4a4ddcc23eb42038987a1917e18d5ab77616b9a6 Mon Sep 17 00:00:00 2001 +From 1e12d311c766a10674ee3188d04c19128e9498dc Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Tue, 18 Mar 2014 23:33:27 +0000 -Subject: [PATCH 261/333] usb/serial/ch341: Add parity support +Subject: [PATCH 260/407] usb/serial/ch341: Add parity support Based on wireshark packet traces from a windows machine. @@ -161393,10 +161365,10 @@ index e98590aab633cd6491f2886842179d314ded5fe6..4f25aba5bdfcabe7304b18860be85275 if (C_BAUD(tty) == B0) priv->line_control &= ~(CH341_BIT_DTR | CH341_BIT_RTS); -From 619f68a75ac622aade40632199d57e32ba083834 Mon Sep 17 00:00:00 2001 +From 20b990f5fb7df5ae0c39585a06b3f23b333252c3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Sat, 20 May 2017 22:10:14 +0100 -Subject: [PATCH 262/333] overlays: README: remove vestigial SDIO parameters +Subject: [PATCH 261/407] overlays: README: remove vestigial SDIO parameters Signed-off-by: Phil Elwell --- @@ -161450,10 +161422,10 @@ index 95600381448b0b485dbbbeb592ae1e82a8acec08..d5aebbe2d514c07c0fae72f80173c086 (default on: polling once at boot-time) -From a5c25fb8e099a107691b560f701a46ace7f5a55c Mon Sep 17 00:00:00 2001 +From d4bcf9e4aff05d59b58a35b8485fae7c72140af1 Mon Sep 17 00:00:00 2001 From: Liviu Dudau Date: Wed, 1 Mar 2017 12:26:28 +0000 -Subject: [PATCH 263/333] ASoC: TLV320AIC23: Unquote NULL from control name +Subject: [PATCH 262/407] ASoC: TLV320AIC23: Unquote NULL from control name commit a03faba972cb0f9b3a46d8054e674d5492e06c38 upstream. @@ -161494,10 +161466,10 @@ index 410cae0f2060474313872d6b9110bf05d3368e43..628a8eeaab689eb85b6d3dba54ec5a98 /* input mux */ {"Capture Source", "Line", "Line Input"}, -From 4ab13528df18295c6661d0f2449470eb087a96fe Mon Sep 17 00:00:00 2001 +From 61c09113bfec7445045eb3ecea4fab57459b78b0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 22 May 2017 15:28:27 +0100 -Subject: [PATCH 264/333] config: Add CONFIG_IPV6_ROUTE_INFO +Subject: [PATCH 263/407] config: Add CONFIG_IPV6_ROUTE_INFO --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -161529,10 +161501,10 @@ index b4554044aad7faabd4db57a87c11dba8e088d7d4..d92392cbdfa6b76184bf22da7c69ecb0 CONFIG_INET6_ESP=m CONFIG_INET6_IPCOMP=m -From 990327af34eb43668b2b838dcbe3a5e0ae9ad816 Mon Sep 17 00:00:00 2001 +From f8c863d4934e650ee5d067e9731468ed65343ae9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 22 May 2017 13:35:28 +0100 -Subject: [PATCH 265/333] config: Add CONFIG_IPV6_SIT_6RD +Subject: [PATCH 264/407] config: Add CONFIG_IPV6_SIT_6RD --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -161564,10 +161536,10 @@ index d92392cbdfa6b76184bf22da7c69ecb09ffdc842..65f16f4f64dd7ad9e9d4a337ec64d769 CONFIG_IPV6_MULTIPLE_TABLES=y CONFIG_IPV6_SUBTREES=y -From caecba22bbcb583f8fd7f45b2fda62fd3fc667b0 Mon Sep 17 00:00:00 2001 +From 36d908defd09140f95e5f0847fcef5efe37250b6 Mon Sep 17 00:00:00 2001 From: Anton Onishchenko Date: Tue, 23 May 2017 18:55:46 +0300 -Subject: [PATCH 266/333] mpu6050 device tree overlay (#2031) +Subject: [PATCH 265/407] mpu6050 device tree overlay (#2031) Add overlay and config options for InvenSense MPU6050 6-axis motion detector. @@ -161682,10 +161654,10 @@ index 65f16f4f64dd7ad9e9d4a337ec64d769bbff2bee..442eb48d4cb418d596e0dbad4bf0742d CONFIG_PWM_BCM2835=m CONFIG_PWM_PCA9685=m -From fb5c8d1bf31baaa89c8abf8c889171c83ac0df9a Mon Sep 17 00:00:00 2001 +From 62b8ffe55c7525135fd7a9091feea8a23fd3f412 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 22 May 2017 13:56:41 +0100 -Subject: [PATCH 267/333] clk: bcm2835: Minimise clock jitter for PCM clock +Subject: [PATCH 266/407] clk: bcm2835: Minimise clock jitter for PCM clock Fractional clock dividers generate accurate average frequencies but with jitter, particularly when the integer divisor is small. @@ -161810,10 +161782,10 @@ index c24b4defb2b046e4ecdc109befc2b22497060647..db3ba74acf78f4dfec0d2206b58bc7c3 .tcnt_mux = 23), [BCM2835_CLOCK_PWM] = REGISTER_PER_CLK( -From bd59e1ea4726080dc6f09abc6825fb1bb3a8a3cd Mon Sep 17 00:00:00 2001 +From 5970b3c3b4bbc7b0ae29f1041fad55003db1dfbe Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 24 May 2017 18:06:02 +0100 -Subject: [PATCH 268/333] Revert "hid: Reduce default mouse polling interval to +Subject: [PATCH 267/407] Revert "hid: Reduce default mouse polling interval to 60Hz" This reverts commit b45c0448b60d691508251cdccf242ea43bbabb14. @@ -161822,7 +161794,7 @@ This reverts commit b45c0448b60d691508251cdccf242ea43bbabb14. 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index 4a7af9d0b910f59d17421ce14138400dfd5834f3..ae83af649a607f67239f1a64bf45dd4b5770cc7d 100644 +index fb8777ab070b699ba50fd8bc8d9d86971f6f9f93..7838343eb37c541d698a7e78ff265e789fda7c98 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -49,7 +49,7 @@ @@ -161834,7 +161806,7 @@ index 4a7af9d0b910f59d17421ce14138400dfd5834f3..ae83af649a607f67239f1a64bf45dd4b module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); -@@ -1083,12 +1083,8 @@ static int usbhid_start(struct hid_device *hid) +@@ -1093,12 +1093,8 @@ static int usbhid_start(struct hid_device *hid) } /* Change the polling interval of mice. */ @@ -161850,10 +161822,10 @@ index 4a7af9d0b910f59d17421ce14138400dfd5834f3..ae83af649a607f67239f1a64bf45dd4b ret = -ENOMEM; if (usb_endpoint_dir_in(endpoint)) { -From a013be8f93b5bf9f661faecbbbfd743bebe48438 Mon Sep 17 00:00:00 2001 +From cb48e8e0511f5bc28c019c6788a8a87c08c3f05c Mon Sep 17 00:00:00 2001 From: Tobias Jakobi Date: Sat, 25 Feb 2017 20:27:27 +0100 -Subject: [PATCH 269/333] HID: usbhid: extend polling interval configuration to +Subject: [PATCH 268/407] HID: usbhid: extend polling interval configuration to joysticks For mouse devices we can currently change the polling interval @@ -161886,7 +161858,7 @@ index 86a6746f683393982cc93a6c3b99b989adbb1df8..d2e1858cf7e1d8ddfb0b81bc1e32e11a [UMS] The delay in seconds before a new device is scanned for Logical Units (default 1). diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index ae83af649a607f67239f1a64bf45dd4b5770cc7d..f7a692f9e50cdc80ebebab1ea260cde29b32d147 100644 +index 7838343eb37c541d698a7e78ff265e789fda7c98..22a955c5cc7e2ac83362c2bdc1a247b4776c9c08 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -53,6 +53,10 @@ static unsigned int hid_mousepoll_interval; @@ -161900,7 +161872,7 @@ index ae83af649a607f67239f1a64bf45dd4b5770cc7d..f7a692f9e50cdc80ebebab1ea260cde2 static unsigned int ignoreled; module_param_named(ignoreled, ignoreled, uint, 0644); MODULE_PARM_DESC(ignoreled, "Autosuspend with active leds"); -@@ -1082,9 +1086,17 @@ static int usbhid_start(struct hid_device *hid) +@@ -1092,9 +1096,17 @@ static int usbhid_start(struct hid_device *hid) hid->name, endpoint->bInterval, interval); } @@ -161922,10 +161894,10 @@ index ae83af649a607f67239f1a64bf45dd4b5770cc7d..f7a692f9e50cdc80ebebab1ea260cde2 ret = -ENOMEM; if (usb_endpoint_dir_in(endpoint)) { -From 10f0054f36568eb347621fe589edee1acc353a09 Mon Sep 17 00:00:00 2001 +From 42d1ad45b57773e10de9738cfd3a0747590f60d3 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 270/333] hid: Reduce default mouse polling interval to 60Hz +Subject: [PATCH 269/407] hid: Reduce default mouse polling interval to 60Hz Reduces overhead when using X --- @@ -161933,7 +161905,7 @@ Reduces overhead when using X 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c -index f7a692f9e50cdc80ebebab1ea260cde29b32d147..dbe506d3ceecb6d47e21f060d0bbac2b3c0165fe 100644 +index 22a955c5cc7e2ac83362c2bdc1a247b4776c9c08..34c9248680b2282fc23f9252825dc1f37f9309f0 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -49,7 +49,7 @@ @@ -161945,7 +161917,7 @@ index f7a692f9e50cdc80ebebab1ea260cde29b32d147..dbe506d3ceecb6d47e21f060d0bbac2b module_param_named(mousepoll, hid_mousepoll_interval, uint, 0644); MODULE_PARM_DESC(mousepoll, "Polling interval of mice"); -@@ -1089,7 +1089,9 @@ static int usbhid_start(struct hid_device *hid) +@@ -1099,7 +1099,9 @@ static int usbhid_start(struct hid_device *hid) /* Change the polling interval of mice and joysticks. */ switch (hid->collection->usage) { case HID_GD_MOUSE: @@ -161957,10 +161929,10 @@ index f7a692f9e50cdc80ebebab1ea260cde29b32d147..dbe506d3ceecb6d47e21f060d0bbac2b break; case HID_GD_JOYSTICK: -From 08bd0a947fa56bc8e47e1ce786f503f3ddb5b194 Mon Sep 17 00:00:00 2001 +From 88c231d9c7c000f1367b9da7d3accbaafcb751f8 Mon Sep 17 00:00:00 2001 From: P33M Date: Thu, 25 May 2017 16:04:53 +0100 -Subject: [PATCH 271/333] dwc_otg: make periodic scheduling behave properly for +Subject: [PATCH 270/407] dwc_otg: make periodic scheduling behave properly for FS buses If the root port is in full-speed mode, transfer times at 12mbit/s @@ -162131,10 +162103,10 @@ index 85a6d431ca54b47dc10573aa72d1ad69d06f2e36..4b1dd9de99e9e08b2e006fb5f8a7ef92 status = check_max_xfer_size(hcd, qh); if (status) { -From c2152b415d13622157076584880be869bfdd24ef Mon Sep 17 00:00:00 2001 +From ab35bb38f52608fa63314bd7b3788b371032b9ef Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 31 May 2017 09:33:55 +0100 -Subject: [PATCH 272/333] config: Adding SENSOR_JC42 +Subject: [PATCH 271/407] config: Adding SENSOR_JC42 The jc42 module supports a number of I2C-based temperature sensor modules. @@ -162190,10 +162162,10 @@ index 442eb48d4cb418d596e0dbad4bf0742d9e8e80b0..9dc64f7985cc1f91952ea382fac7920e CONFIG_SENSORS_SHT21=m CONFIG_SENSORS_SHTC1=m -From 956bb98551d9d55ba34902f67c1c3118ebee2714 Mon Sep 17 00:00:00 2001 +From 729728f5839e009dd6368463bccd2e8e4ef6c0fd Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 31 May 2017 15:27:39 +0100 -Subject: [PATCH 273/333] BCM270X_DT: Improve i2c-sensor and i2c-rtc overlay +Subject: [PATCH 272/407] BCM270X_DT: Improve i2c-sensor and i2c-rtc overlay Use the "__dormant__" feature to permit multiple instances of each overlay, which is more useful now that changing the "reg" property @@ -162554,10 +162526,10 @@ index e86a13f92c3f75c14fa4425cdfb081d6795ff76a..d2f0008addfadac8f6ed774a6e4f3f97 }; }; -From 4ce82ac32711f33f8bdb38ae81d5402835b292b8 Mon Sep 17 00:00:00 2001 +From 3ef6886f1dd74e1432e965e4e33ee1a71e8832c8 Mon Sep 17 00:00:00 2001 From: Stefan Tatschner Date: Mon, 29 May 2017 21:46:16 +0200 -Subject: [PATCH 274/333] Add device tree config for htu21 +Subject: [PATCH 273/407] Add device tree config for htu21 See: https://github.com/raspberrypi/linux/pull/2041 @@ -162639,10 +162611,10 @@ index d2f0008addfadac8f6ed774a6e4f3f97871c0d61..17c27e3b666a7a83619471b50c63bb93 }; }; -From db201504e1143c8ce45a268086d74179cf71f344 Mon Sep 17 00:00:00 2001 +From ac79c23eadd6ebfdfaea1defda1d6b10d9997a13 Mon Sep 17 00:00:00 2001 From: P33M Date: Fri, 26 May 2017 12:50:31 +0100 -Subject: [PATCH 275/333] dwc_otg: fiq_fsm: Make isochronous compatibility +Subject: [PATCH 274/407] dwc_otg: fiq_fsm: Make isochronous compatibility checks work properly Get rid of the spammy printk and local pointer mangling. @@ -162706,10 +162678,10 @@ index 38bf5fc792d32352f9e208e0e90f968599b9bc31..71834cf365e67d7ad995bba7869216c4 return 1; } -From 0daddd6703675e38d696554b39802e1c1e040d8b Mon Sep 17 00:00:00 2001 +From 6c52cea7cf9281aab9f318962347ba0eff7757e8 Mon Sep 17 00:00:00 2001 From: sandeepal Date: Fri, 2 Jun 2017 18:59:46 +0530 -Subject: [PATCH 276/333] Allo Digione Driver (#2048) +Subject: [PATCH 275/407] Allo Digione Driver (#2048) Driver for the Allo Digione soundcard --- @@ -163139,10 +163111,10 @@ index 0000000000000000000000000000000000000000..e3664e44c699d0102120ecf99e8b780a +MODULE_DESCRIPTION("ASoC Driver for Allo DigiOne"); +MODULE_LICENSE("GPL v2"); -From fc7aa0a16e93bba8b3f9bb915b665a232d430bc0 Mon Sep 17 00:00:00 2001 +From c641a9362b52fec746e6b44e20e77995b0e880f8 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Fri, 28 Apr 2017 15:14:55 -0400 -Subject: [PATCH 277/333] cgroup_get() expected to be called only on live +Subject: [PATCH 276/407] cgroup_get() expected to be called only on live cgroups and triggers warning on a dead cgroup; however, cgroup_sk_alloc() may be called while cloning a socket which is left in an empty and removed cgroup and thus may legitimately duplicate its reference on a dead cgroup. This @@ -163278,10 +163250,10 @@ index d0ecb18e0e3ad06483be2ddea9114c5a5860daaa..2650df194b5d0bb39bb92c295d93f691 return; } -From b07ce1fce5521d1cf856e0ee1677c076f2fa1544 Mon Sep 17 00:00:00 2001 +From 034811064b6b44e02c4b940d0852fdfb49cf5af7 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 26 May 2017 13:03:41 +0100 -Subject: [PATCH 278/333] BCM270X_DT: Add midi-uart1 overlay +Subject: [PATCH 277/407] BCM270X_DT: Add midi-uart1 overlay Add a scaler to the ttyS0 clock so that requesting 38400 baud results in an approximately 31250 baud signal. This is analagous to @@ -163379,10 +163351,10 @@ index 0000000000000000000000000000000000000000..e0bc410acbff3a7a175dd5d53b3ab0d0 + }; +}; -From e2ffd1e9d17148ea578e6a86eea18231e4d97278 Mon Sep 17 00:00:00 2001 +From 3b081b7a9975876cb678f03d84503273628d218e Mon Sep 17 00:00:00 2001 From: Andrei Gherzan Date: Mon, 5 Jun 2017 16:40:38 +0100 -Subject: [PATCH 279/333] dma-bcm2708: Fix module compilation of +Subject: [PATCH 278/407] dma-bcm2708: Fix module compilation of CONFIG_DMA_BCM2708 bcm2708-dmaengine.c defines functions like bcm_dma_start which are @@ -163425,10 +163397,10 @@ index c5bfff2765be4606077e6c8af73040ec13ee8974..6ca874d332a8bc666b1c9576ac51f479 #endif /* _PLAT_BCM2708_DMA_H */ -From 705da69c559b2306fae10555af8987cea568a5e2 Mon Sep 17 00:00:00 2001 +From 80e0ec0a16949a1d35dd7b06dcffbb285145b55e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 7 Jun 2017 08:53:36 +0100 -Subject: [PATCH 280/333] overlays: Fix i2c-rtc order and fragment numbering +Subject: [PATCH 279/407] overlays: Fix i2c-rtc order and fragment numbering See: https://github.com/raspberrypi/linux/issues/2059 @@ -163479,10 +163451,10 @@ index b73f902289c8e52705665d8da6d0e904eeaaaf18..6140f172a86b8731782f938f76cb5dac }; }; -From e58749bd528fbfc41d2919298ebcd30a9f18c652 Mon Sep 17 00:00:00 2001 +From afd1a454db5e7ef30040220da4dfd8feb8d5a657 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 5 Jun 2017 12:16:10 -0700 -Subject: [PATCH 281/333] drm/vc4: Add T-format scanout support. +Subject: [PATCH 280/407] drm/vc4: Add T-format scanout support. The T tiling format is what V3D uses for textures, with no raster support at all until later revisions of the hardware (and always at a @@ -163624,10 +163596,10 @@ index 932093936178674173a84002b33e07e9a37fdfe9..d382c34c1b9e0c6d5b949ca09bf1e840 + #endif /* VC4_REGS_H */ diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h -index a5890bf44c0afa3b78d1cfa66308b097d1c38710..4fccf9b898b1242877362ca0be872478c1f0ec8d 100644 +index d1601a62192971fc09eb856a95249727567fafa5..5acd9d03107517c0db9ba1a065e2340e37154103 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h -@@ -159,6 +159,7 @@ extern "C" { +@@ -160,6 +160,7 @@ extern "C" { #define DRM_FORMAT_MOD_VENDOR_NV 0x03 #define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 #define DRM_FORMAT_MOD_VENDOR_QCOM 0x05 @@ -163635,7 +163607,7 @@ index a5890bf44c0afa3b78d1cfa66308b097d1c38710..4fccf9b898b1242877362ca0be872478 /* add more to the end as needed */ #define fourcc_mod_code(vendor, val) \ -@@ -233,6 +234,27 @@ extern "C" { +@@ -234,6 +235,27 @@ extern "C" { */ #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) @@ -163664,10 +163636,10 @@ index a5890bf44c0afa3b78d1cfa66308b097d1c38710..4fccf9b898b1242877362ca0be872478 } #endif -From 563c1f1448a1a82266d2b20d3179f34931a9c42c Mon Sep 17 00:00:00 2001 +From a606bdf70e35699b074e5d04b2060f1c1e2ade10 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 5 Jun 2017 14:00:45 -0700 -Subject: [PATCH 282/333] drm/vc4: Add get/set tiling ioctls. +Subject: [PATCH 281/407] drm/vc4: Add get/set tiling ioctls. This allows mesa to set the tiling format for a BO and have that tiling format be respected by mesa on the other side of an @@ -163912,10 +163884,10 @@ index f07a090167261131076438960c1dec175d7d376e..6ac4c5c014cb9b98343f25721f74b727 } #endif -From bee1c8bfbe22546806fb8e86f08af742f35fc577 Mon Sep 17 00:00:00 2001 +From 267ffbf1b503690b5a64d547478369fd9f88efca Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jun 2017 14:39:49 -0700 -Subject: [PATCH 283/333] drm/vc4: Add FB modifier support to firmwarekms. +Subject: [PATCH 282/407] drm/vc4: Add FB modifier support to firmwarekms. Signed-off-by: Eric Anholt --- @@ -163946,10 +163918,10 @@ index 943cbb38f1f2e6fc7c06870be7904677e0a9c7a3..40a0cdc179ceabafb387724e1b835895 * set to nonzero, the configured pitch gets overwritten with * the previous pitch. So, to get the configured pitch -From 7623ab325efbe967525190e29a340387fbc1b231 Mon Sep 17 00:00:00 2001 +From 64e48d9b4589bcb50c4b3cf477d2f725a2fcf2fb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 12 Jun 2017 13:05:43 +0100 -Subject: [PATCH 284/333] config: Add CONFIG_CAN_GS_USB +Subject: [PATCH 283/407] config: Add CONFIG_CAN_GS_USB --- arch/arm/configs/bcm2709_defconfig | 1 + @@ -163981,10 +163953,10 @@ index 372bfe1ca1fb638d78b1ece096ca1a8e5f5a13a8..83cfb1e8738bdb7ef3ee1502b9a64d65 CONFIG_IRLAN=m CONFIG_IRNET=m -From 3590bb5905b1bfc1aac3755f11a16b4548a7bde5 Mon Sep 17 00:00:00 2001 +From 57ffe29717cc1f7af12db73ad39afb0f5f410be8 Mon Sep 17 00:00:00 2001 From: P33M Date: Mon, 12 Jun 2017 16:10:03 +0100 -Subject: [PATCH 285/333] dwc_otg: add module parameter int_ep_interval_min +Subject: [PATCH 284/407] dwc_otg: add module parameter int_ep_interval_min Add a module parameter (defaulting to ignored) that clamps the polling rate of high-speed Interrupt endpoints to a minimum microframe interval. @@ -164066,10 +164038,10 @@ index 4b1dd9de99e9e08b2e006fb5f8a7ef92f20c2553..fe8e8f841f03660c2ad49ab8e66193be DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD QH Initialized\n"); -From 770f8f8f0fd628a082a9473ab0929c5e430a7d45 Mon Sep 17 00:00:00 2001 +From 1120166c07b783b91eab7618b3f34f157abc8a33 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 13 Jun 2017 15:06:22 +0100 -Subject: [PATCH 286/333] Revert "drm/vc4: Add FB modifier support to +Subject: [PATCH 285/407] Revert "drm/vc4: Add FB modifier support to firmwarekms." This reverts commit 9183dfdbf2cb3ec8e981204847b345f7ab95662d. @@ -164101,10 +164073,10 @@ index 40a0cdc179ceabafb387724e1b835895fa3e2ca2..943cbb38f1f2e6fc7c06870be7904677 * set to nonzero, the configured pitch gets overwritten with * the previous pitch. So, to get the configured pitch -From 4256275563b9b0d8723bd84869268dda1fa8f1af Mon Sep 17 00:00:00 2001 +From 07a1b2eb701ef958f79eb09cb82cb3a34705eca5 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 13 Jun 2017 15:06:24 +0100 -Subject: [PATCH 287/333] Revert "drm/vc4: Add get/set tiling ioctls." +Subject: [PATCH 286/407] Revert "drm/vc4: Add get/set tiling ioctls." This reverts commit 3ea95503a626b7e4157afa0745d11908546654b1. --- @@ -164344,10 +164316,10 @@ index 6ac4c5c014cb9b98343f25721f74b727a88f2bb5..f07a090167261131076438960c1dec17 } #endif -From 99c7c8a076f2352390bd64ced04089765687d0dc Mon Sep 17 00:00:00 2001 +From 850ecaa7594eb651fb76de469950338f7f25555d Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 13 Jun 2017 15:06:25 +0100 -Subject: [PATCH 288/333] Revert "drm/vc4: Add T-format scanout support." +Subject: [PATCH 287/407] Revert "drm/vc4: Add T-format scanout support." This reverts commit 85e9ae254717d2e4a313945a465230a3102cad42. --- @@ -164464,10 +164436,10 @@ index d382c34c1b9e0c6d5b949ca09bf1e8401d44f91a..932093936178674173a84002b33e07e9 - #endif /* VC4_REGS_H */ diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h -index 4fccf9b898b1242877362ca0be872478c1f0ec8d..a5890bf44c0afa3b78d1cfa66308b097d1c38710 100644 +index 5acd9d03107517c0db9ba1a065e2340e37154103..d1601a62192971fc09eb856a95249727567fafa5 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h -@@ -159,7 +159,6 @@ extern "C" { +@@ -160,7 +160,6 @@ extern "C" { #define DRM_FORMAT_MOD_VENDOR_NV 0x03 #define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 #define DRM_FORMAT_MOD_VENDOR_QCOM 0x05 @@ -164475,7 +164447,7 @@ index 4fccf9b898b1242877362ca0be872478c1f0ec8d..a5890bf44c0afa3b78d1cfa66308b097 /* add more to the end as needed */ #define fourcc_mod_code(vendor, val) \ -@@ -234,27 +233,6 @@ extern "C" { +@@ -235,27 +234,6 @@ extern "C" { */ #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) @@ -164504,10 +164476,10 @@ index 4fccf9b898b1242877362ca0be872478c1f0ec8d..a5890bf44c0afa3b78d1cfa66308b097 } #endif -From 52c800829216697819e0f9851a94733de59481f5 Mon Sep 17 00:00:00 2001 +From ef20842ba96efa9578e6adfce14c024bac87bdea Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 5 Jun 2017 12:16:10 -0700 -Subject: [PATCH 289/333] drm/vc4: Add T-format scanout support. +Subject: [PATCH 288/407] drm/vc4: Add T-format scanout support. The T tiling format is what V3D uses for textures, with no raster support at all until later revisions of the hardware (and always at a @@ -164649,10 +164621,10 @@ index 932093936178674173a84002b33e07e9a37fdfe9..d382c34c1b9e0c6d5b949ca09bf1e840 + #endif /* VC4_REGS_H */ diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h -index a5890bf44c0afa3b78d1cfa66308b097d1c38710..4fccf9b898b1242877362ca0be872478c1f0ec8d 100644 +index d1601a62192971fc09eb856a95249727567fafa5..5acd9d03107517c0db9ba1a065e2340e37154103 100644 --- a/include/uapi/drm/drm_fourcc.h +++ b/include/uapi/drm/drm_fourcc.h -@@ -159,6 +159,7 @@ extern "C" { +@@ -160,6 +160,7 @@ extern "C" { #define DRM_FORMAT_MOD_VENDOR_NV 0x03 #define DRM_FORMAT_MOD_VENDOR_SAMSUNG 0x04 #define DRM_FORMAT_MOD_VENDOR_QCOM 0x05 @@ -164660,7 +164632,7 @@ index a5890bf44c0afa3b78d1cfa66308b097d1c38710..4fccf9b898b1242877362ca0be872478 /* add more to the end as needed */ #define fourcc_mod_code(vendor, val) \ -@@ -233,6 +234,27 @@ extern "C" { +@@ -234,6 +235,27 @@ extern "C" { */ #define DRM_FORMAT_MOD_SAMSUNG_64_32_TILE fourcc_mod_code(SAMSUNG, 1) @@ -164689,10 +164661,10 @@ index a5890bf44c0afa3b78d1cfa66308b097d1c38710..4fccf9b898b1242877362ca0be872478 } #endif -From 1fda62703656be98bcd0788cca319de12930e42f Mon Sep 17 00:00:00 2001 +From 3d2266aa5b8d439ae012ddf23c72f1e0a13ff529 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 5 Jun 2017 14:00:45 -0700 -Subject: [PATCH 290/333] drm/vc4: Add get/set tiling ioctls. +Subject: [PATCH 289/407] drm/vc4: Add get/set tiling ioctls. This allows mesa to set the tiling format for a BO and have that tiling format be respected by mesa on the other side of an @@ -164937,10 +164909,10 @@ index f07a090167261131076438960c1dec175d7d376e..6ac4c5c014cb9b98343f25721f74b727 } #endif -From b099b8ae5c600ca1cfc24d01661bd67755581586 Mon Sep 17 00:00:00 2001 +From a3b7708dcd803c6663b0299d4991264d583e3f85 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 7 Jun 2017 14:39:49 -0700 -Subject: [PATCH 291/333] drm/vc4: Add FB modifier support to firmwarekms. +Subject: [PATCH 290/407] drm/vc4: Add FB modifier support to firmwarekms. Signed-off-by: Eric Anholt --- @@ -164971,10 +164943,10 @@ index 943cbb38f1f2e6fc7c06870be7904677e0a9c7a3..40a0cdc179ceabafb387724e1b835895 * set to nonzero, the configured pitch gets overwritten with * the previous pitch. So, to get the configured pitch -From 65b94393debc3d2529c04309b284c1a4fd52f2c0 Mon Sep 17 00:00:00 2001 +From 7ddf2cfeb7f2688e4d70138f1fd4cc103f12e85a Mon Sep 17 00:00:00 2001 From: Johan Hovold Date: Fri, 6 Jan 2017 19:15:23 +0100 -Subject: [PATCH 292/333] USB: serial: ch341: change initial line-control +Subject: [PATCH 291/407] USB: serial: ch341: change initial line-control settings commit 7c61b0d5e82bfe29b8dda55745afbf65b6ccc901 upstream. @@ -165306,10 +165278,10 @@ index 4f25aba5bdfcabe7304b18860be8527587390467..b27593a02734a1def9412e848c91feb5 return usb_serial_generic_resume(serial); -From 4ba8f0abf4500963af4484fca3a0545efa6871ac Mon Sep 17 00:00:00 2001 +From 33626b91d78a3bf0233fa314009b032a4535e98d Mon Sep 17 00:00:00 2001 From: P33M Date: Tue, 20 Jun 2017 13:44:01 +0100 -Subject: [PATCH 293/333] dwc_otg: fiq_fsm: Add non-periodic TT exclusivity +Subject: [PATCH 292/407] dwc_otg: fiq_fsm: Add non-periodic TT exclusivity constraints Certain hub types do not discriminate between pipe direction (IN or OUT) @@ -165476,10 +165448,10 @@ index 71834cf365e67d7ad995bba7869216c4091c3a74..7710370b30363e3170bf9bf522597c5f st->fsm = FIQ_PER_SSPLIT_STARTED; } else { -From 60390b7e6f36330c11108fda1e26f152b5359d9c Mon Sep 17 00:00:00 2001 +From 8a8cb9f9648b834f914f0e7c25403961c004b9ff Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 20 Jun 2017 17:51:47 +0100 -Subject: [PATCH 294/333] bcm2835-cpufreq: Change licence to GPLv2 +Subject: [PATCH 293/407] bcm2835-cpufreq: Change licence to GPLv2 Signed-off-by: Eben Upton Signed-off-by: Dom Cobley @@ -165532,10 +165504,10 @@ index 414fbdc10dfbfc6e4bb47870a7af3fd5780f9c9a..99345969b0e4d651fd9033d67de2febb /* ---------- INCLUDES ---------- */ #include -From 2d4c8442f7adb6854e32c366a4c21bb70e01cf27 Mon Sep 17 00:00:00 2001 +From 30c5a67ee0ee47a973610ce0b8b9f6bf01a66b4a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 21 Jun 2017 09:03:51 -0700 -Subject: [PATCH 295/333] bcm2708: Drop CMA alignment from FKMS mode as well. +Subject: [PATCH 294/407] bcm2708: Drop CMA alignment from FKMS mode as well. I dropped it from KMS mode in d88274d88ed81de1ade8e18e4c0ed91792ec82ea and should have done both of them at that time. @@ -165591,10 +165563,10 @@ index 95a595a35cb4fbb707bf4b18161f6a46860aa4ae..36fbf6c8c2e612a6dc5aa02d77cc8173 }; -From 528a8c742790d7ca20fe639e4903543fce683206 Mon Sep 17 00:00:00 2001 +From ec54e9d7c63d058109c156bf06a2c209173eee33 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 21 Jun 2017 17:19:04 +0100 -Subject: [PATCH 296/333] serial: 8250: Fix THRE flag usage for CAP_MINI +Subject: [PATCH 295/407] serial: 8250: Fix THRE flag usage for CAP_MINI The BCM2835 MINI UART has non-standard THRE semantics. Conventionally the bit means that the FIFO is empty (although there may still be a @@ -165623,7 +165595,7 @@ Signed-off-by: Phil Elwell 1 file changed, 4 insertions(+) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c -index 2d7a63f69b90415d6e1b6eb1c10612f4aa9fbed2..d2ecdb80e5f2d6bcb7e4edbb28280853bf1fd440 100644 +index d8f6fd3276ea1b1976b6e01ed536e16e6f8124cd..c77ad07d3db38316eece1713633b3e5e2dcf071e 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1746,6 +1746,10 @@ void serial8250_tx_chars(struct uart_8250_port *up) @@ -165638,10 +165610,10 @@ index 2d7a63f69b90415d6e1b6eb1c10612f4aa9fbed2..d2ecdb80e5f2d6bcb7e4edbb28280853 if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) -From f239fe85d253c2bc4c48f5ae07908f8af902f1e5 Mon Sep 17 00:00:00 2001 +From 37958e89fded828003c498c980f009f91573fab4 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 23 Jun 2016 16:37:46 +0100 -Subject: [PATCH 297/333] mmc: Apply ERASE_BROKEN quirks correctly +Subject: [PATCH 296/407] mmc: Apply ERASE_BROKEN quirks correctly Signed-off-by: Phil Elwell --- @@ -165669,10 +165641,10 @@ index 894c105be9ce7f83147a62c433c787b90a5e7c17..f1aeab19e10a465bffe69d24fc3331c8 END_FIXUP }; -From 80000e9cabe10fec00c94e21e7a3c75e48b1060a Mon Sep 17 00:00:00 2001 +From 47093a83a6c3fa7addd940511212b29795f7bda8 Mon Sep 17 00:00:00 2001 From: Steve Conner Date: Thu, 29 Jun 2017 15:56:19 +0100 -Subject: [PATCH 298/333] New i2c-rtc-gpio device overlay (#2092) +Subject: [PATCH 297/407] New i2c-rtc-gpio device overlay (#2092) Created new i2c-rtc-gpio device overlay by combining i2c-rtc and i2c-gpio. Tested with PCF2127 on CM3. --- @@ -165936,10 +165908,10 @@ index 0000000000000000000000000000000000000000..8415e6081428fba9a47682964174fc02 + }; +}; -From 3a374e6f00303a841e842c3d384ee6931ddb9f7b Mon Sep 17 00:00:00 2001 +From 45b41713e0f16781cba8ff1c4d615f60294b1bef Mon Sep 17 00:00:00 2001 From: Allo Date: Mon, 3 Jul 2017 15:45:20 +0530 -Subject: [PATCH 299/333] PianoPlus: Dual Mono & Dual Stereo features added +Subject: [PATCH 298/407] PianoPlus: Dual Mono & Dual Stereo features added (#2069) --- @@ -166228,10 +166200,10 @@ index 56e43f98846b41e487b3089813f7edc3c08517eb..d4e99e3c6a383d92fb0cf9e8c1cd1e76 } -From eeb2484163e35cc23666ccc6e5551d3b7eac678b Mon Sep 17 00:00:00 2001 +From 20d3162bb309b591deaee0d332b1aa9e1641c033 Mon Sep 17 00:00:00 2001 From: Marta Lofstedt Date: Mon, 5 Dec 2016 14:04:08 +0200 -Subject: [PATCH 300/333] drm: allow changing DPMS mode +Subject: [PATCH 299/407] drm: allow changing DPMS mode The drm_atomic_helper_connector_dpms will set the connector back the old DPMS state @@ -166269,10 +166241,10 @@ index 50acd799babe1824e47e4bba6b9f03875429c17a..06572ffdb4082fe290b51bbd4c54b84c return ret; -From 09217832601a2168f16d514e1c20dffbfdf36738 Mon Sep 17 00:00:00 2001 +From 53ffaafbcce45c0b484f384083aa6c17a937029c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 6 Jul 2017 11:45:48 -0700 -Subject: [PATCH 301/333] drm/vc4: Add support for setting DPMS in firmwarekms. +Subject: [PATCH 300/407] drm/vc4: Add support for setting DPMS in firmwarekms. This ensures that the screen goes blank during DPMS (screensaver), including the cursor. Planes don't necessarily get disabled during @@ -166375,10 +166347,10 @@ index 40a0cdc179ceabafb387724e1b835895fa3e2ca2..c85cae7d2f5f88cd41d3cf41dafa1449 if (!vc4_encoder) return -ENOMEM; -From bba45b43f424bb98f42cf97d97c25bc6fd347971 Mon Sep 17 00:00:00 2001 +From 4e7b8f531c4bf6d46814c7b931697d446fb84ce7 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Sun, 9 Jul 2017 15:15:22 +0200 -Subject: [PATCH 302/333] overlays: Add gpio-shutdown overlay (#2103) +Subject: [PATCH 301/407] overlays: Add gpio-shutdown overlay (#2103) This overlay facilitates the addition of a powerbutton by converting GPIO edges into KEY_POWER keypresses, which can be handled by @@ -166534,10 +166506,10 @@ index 0000000000000000000000000000000000000000..863fb395c8539734b658682b900e1fbd + +}; -From f807d43658e3d9f2e207bd949e72c76658c63127 Mon Sep 17 00:00:00 2001 +From 22a4f5e320e9253472bacbb3e8383681198eca19 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Mon, 10 Jul 2017 11:05:17 +0200 -Subject: [PATCH 303/333] config: enable generic S/PDIF codec drivers (#2104) +Subject: [PATCH 302/407] config: enable generic S/PDIF codec drivers (#2104) These drivers can be used as dummy ADC/DAC drivers for attaching general codecs that don't need to be configured. @@ -166594,10 +166566,10 @@ index 83cfb1e8738bdb7ef3ee1502b9a64d654de80c1b..646d69bea48befde89bec7c85895d41c CONFIG_SND_SIMPLE_CARD=m CONFIG_SOUND_PRIME=m -From 416cce37049fc66108b81e104e6a9d81e12d726f Mon Sep 17 00:00:00 2001 +From 22cf1d1b9112fc56bce4b9bd290250c872fabef4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 12 Jul 2017 17:34:59 +0100 -Subject: [PATCH 304/333] fixups from rpi-4.9.y +Subject: [PATCH 303/407] fixups from rpi-4.9.y --- drivers/hv/channel.c | 5 ----- @@ -166636,10 +166608,10 @@ index 8642f580ce41803bd22c76a0fa80d083d0747be1..47167f403cc8329bd811b47c7011c299 val = bcm2835_i2c_readl(i2c_dev, BCM2835_I2C_S); } -From 46e277cd22251ad779d3dca413f1e632b388513f Mon Sep 17 00:00:00 2001 +From 1ee2f5854ce4aeb259f314c655ade308cb226b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 26 Jan 2017 23:56:03 +0100 -Subject: [PATCH 305/333] drm: debugfs: Remove all files automatically on +Subject: [PATCH 304/407] drm: debugfs: Remove all files automatically on cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -166707,10 +166679,10 @@ index 1205790ed960c755780e2efa32300ac775c15fa1..0ea2ecca76d18d4b0b76bb29cb9d04bf return 0; -From 69177fe198df8a295684a956078a255ef4352b7f Mon Sep 17 00:00:00 2001 +From 88651f13f5f19699c76c6cfd1352ab876c1c2d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sun, 22 Jan 2017 00:15:00 +0100 -Subject: [PATCH 306/333] drm: Add DRM support for tiny LCD displays +Subject: [PATCH 305/407] drm: Add DRM support for tiny LCD displays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -167564,10 +167536,10 @@ index 0000000000000000000000000000000000000000..468cd4aaa59ef66700fd41fbdb029997 + +#endif /* __LINUX_TINYDRM_H */ -From a21f08d1655d3525337532224ef6cdf71306debb Mon Sep 17 00:00:00 2001 +From 41e0d21beb4e3ed4e876d5193aa382f2161beea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sun, 22 Jan 2017 00:19:51 +0100 -Subject: [PATCH 307/333] drm/tinydrm: Add helper functions +Subject: [PATCH 306/407] drm/tinydrm: Add helper functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -168201,10 +168173,10 @@ index 0000000000000000000000000000000000000000..78175fe6ab228d7d8b17464e6cf8104d + +#endif /* __LINUX_TINYDRM_HELPERS_H */ -From efae19b749835c11cef618bcced715c07958f725 Mon Sep 17 00:00:00 2001 +From 757611792c5a2f1dba6951e9eae258976c91a579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sun, 22 Jan 2017 00:30:47 +0100 -Subject: [PATCH 308/333] drm/tinydrm: Add MIPI DBI support +Subject: [PATCH 307/407] drm/tinydrm: Add MIPI DBI support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -169389,10 +169361,10 @@ index 0000000000000000000000000000000000000000..d137b16ee8734ee2a0ec648509e1e838 + +#endif /* __LINUX_MIPI_DBI_H */ -From 104aea32dffb6bed0ca28ba67f7fd17a0b192b58 Mon Sep 17 00:00:00 2001 +From a5ee7414d3db3da89c25e81623308d3c681e4352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sun, 22 Jan 2017 15:23:48 +0100 -Subject: [PATCH 309/333] drm/tinydrm: Add support for Multi-Inno MI0283QT +Subject: [PATCH 308/407] drm/tinydrm: Add support for Multi-Inno MI0283QT display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -169803,10 +169775,10 @@ index 0000000000000000000000000000000000000000..807a09f43cad91f242a1b8f79ed6bc42 + +#endif /* __LINUX_ILI9341_H */ -From 40964bd465ceadd18ea59bfed13f4efe499a85cf Mon Sep 17 00:00:00 2001 +From 623a836769385c952e22ec6d49191770c81ac5d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 23 Feb 2017 14:29:55 +0100 -Subject: [PATCH 310/333] =?UTF-8?q?drm/tinydrm:=20mipi-dbi:=20Silence:=20?= +Subject: [PATCH 309/407] =?UTF-8?q?drm/tinydrm:=20mipi-dbi:=20Silence:=20?= =?UTF-8?q?=E2=80=98cmd=E2=80=99=20may=20be=20used=20uninitialized?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -169841,10 +169813,10 @@ index 80dfac7ba7ed611cfc1873c2052b26163c2a8e77..3f7892eb8e671593b9ab7ffc9501eb0b unsigned int i; int ret; -From 73ee1fa54b40355755e6b9d22f0003791808b6b2 Mon Sep 17 00:00:00 2001 +From b6937ae3800ee921421316c519b001f0e21a0910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 23 Feb 2017 14:29:56 +0100 -Subject: [PATCH 311/333] drm/tinydrm: mipi-dbi: Fix field width specifier +Subject: [PATCH 310/407] drm/tinydrm: mipi-dbi: Fix field width specifier warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -169891,10 +169863,10 @@ index 3f7892eb8e671593b9ab7ffc9501eb0bede483d7..186ffd9628d13a36dda2f2a6b2d6574a static const u8 mipi_dbi_dcs_read_commands[] = { -From 9d7a0bd57f73fee87a033e5ab8e918dc3985b0a8 Mon Sep 17 00:00:00 2001 +From 4eb40ebbcafedcaec95674bf63895699bbe203b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Thu, 23 Feb 2017 14:29:57 +0100 -Subject: [PATCH 312/333] drm/tinydrm: helpers: Properly fix backlight +Subject: [PATCH 311/407] drm/tinydrm: helpers: Properly fix backlight dependency MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -169944,10 +169916,10 @@ index 78175fe6ab228d7d8b17464e6cf8104ded706958..9b9b6cfe3ba526b1c9e0d49adb28813a size_t tinydrm_spi_max_transfer_size(struct spi_device *spi, size_t max_len); bool tinydrm_spi_bpw_supported(struct spi_device *spi, u8 bpw); -From 6bfab368889268b6a8738ee73a222d5ed27c827c Mon Sep 17 00:00:00 2001 +From 914f3936007a4145d039795a9558a3a55709afac Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Wed, 8 Mar 2017 15:12:56 +0100 -Subject: [PATCH 313/333] drm: Create DEFINE_DRM_GEM_CMA_FOPS and roll it out +Subject: [PATCH 312/407] drm: Create DEFINE_DRM_GEM_CMA_FOPS and roll it out to drivers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -170024,10 +169996,10 @@ index acd6af8a8e675b5b58856651f18f788257bcc868..0ba18f33752ea7a639c81a2c567d39bd void drm_gem_cma_free_object(struct drm_gem_object *gem_obj); -From 81c994fa73780f6bfe8c0156cadca90b633fddc8 Mon Sep 17 00:00:00 2001 +From 8207ff534f7c3e48fcda798a782b09c8f0be1db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sun, 26 Mar 2017 16:25:29 +0200 -Subject: [PATCH 314/333] drm/tinydrm: Fix drm_driver.fops.owner +Subject: [PATCH 313/407] drm/tinydrm: Fix drm_driver.fops.owner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -170113,10 +170085,10 @@ index 468cd4aaa59ef66700fd41fbdb029997231a0b39..0cbb1b28129104e995895cc9c4bad909 void tinydrm_gem_cma_free_object(struct drm_gem_object *gem_obj); struct drm_gem_object * -From 758a8307c1f4b2868db7ea2d21643aa6ffa4f02d Mon Sep 17 00:00:00 2001 +From 4d6d8cc457b4faf85543762171ceebd3763fa5b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 31 May 2017 22:26:53 +0200 -Subject: [PATCH 315/333] drm/tinydrm: Add tinydrm_xrgb8888_to_gray8() helper +Subject: [PATCH 314/407] drm/tinydrm: Add tinydrm_xrgb8888_to_gray8() helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -170245,10 +170217,10 @@ index 9b9b6cfe3ba526b1c9e0d49adb28813a201a9764..a6c387f91effbcb4d6f6326f02b477ce struct backlight_device *tinydrm_of_find_backlight(struct device *dev); int tinydrm_enable_backlight(struct backlight_device *backlight); -From fd4d3bb8ab6a03c2c2982a26ac45981208b1f758 Mon Sep 17 00:00:00 2001 +From b2f555861910d3cdf9dbeb4bec83cf94656346c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Wed, 31 May 2017 22:27:40 +0200 -Subject: [PATCH 316/333] drm/tinydrm: Add RePaper e-ink driver +Subject: [PATCH 315/407] drm/tinydrm: Add RePaper e-ink driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -171418,10 +171390,10 @@ index 0000000000000000000000000000000000000000..c9ad119b2f7e1fef477f65aa00bc057c +MODULE_AUTHOR("Noralf Trønnes"); +MODULE_LICENSE("GPL"); -From b7589075be660de52c304b31dbf0d519fc176461 Mon Sep 17 00:00:00 2001 +From b24e9b1398adc07a6f76d00b256e4f0075dea0d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sat, 15 Jul 2017 21:24:18 +0200 -Subject: [PATCH 317/333] config: Enable TINYDRM and drivers +Subject: [PATCH 316/407] config: Enable TINYDRM and drivers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -171463,10 +171435,10 @@ index 646d69bea48befde89bec7c85895d41cd644d226..0ace5c0ff13560dddc19801bcc796517 CONFIG_FB_BCM2708=y CONFIG_FB_UDL=m -From d2307a0894e21ae003d1ff37e1a71c95f63acb80 Mon Sep 17 00:00:00 2001 +From bfcf8f828027d1f92a520065c205e2cfc0eacbc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= Date: Sun, 16 Jul 2017 00:13:36 +0200 -Subject: [PATCH 318/333] BCM270X_DT: Add PaPiRus overlay +Subject: [PATCH 317/407] BCM270X_DT: Add PaPiRus overlay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -171611,10 +171583,10 @@ index 0000000000000000000000000000000000000000..58eb8847f9ed8746cbffdbf4cdc83711 + }; +}; -From 09cf1dbbfc5d4dbdc5a7a27613b960098dac9759 Mon Sep 17 00:00:00 2001 +From b2561dd5dda9d5eb8fb5a8afe26acb07f1cd2649 Mon Sep 17 00:00:00 2001 From: James Hughes Date: Fri, 21 Jul 2017 09:55:12 +0100 -Subject: [PATCH 319/333] Sets the BCDC priority to constant 0 +Subject: [PATCH 318/407] Sets the BCDC priority to constant 0 This is to workaround for a possible issue in the wireless chip firmware where some packets with @@ -171640,10 +171612,10 @@ index 038a960c5104fe19dd66838e0a555d29d5f795d0..04ebb330b3e83650823a020bb88faca6 h->data_offset = offset; BCDC_SET_IF_IDX(h, ifidx); -From 6613870246de1dbf821418fb42a26cb3e3275924 Mon Sep 17 00:00:00 2001 +From 5541eb8605a304851f5a4510bb2031ffec5e5ff5 Mon Sep 17 00:00:00 2001 From: Eric Cooper Date: Sat, 29 Jul 2017 15:52:58 -0400 -Subject: [PATCH 320/333] overlays: i2c-rtc: add m41t62 +Subject: [PATCH 319/407] overlays: i2c-rtc: add m41t62 Add support for the ST M41T62 real-time clock chip. --- @@ -171707,10 +171679,10 @@ index 6140f172a86b8731782f938f76cb5dac9f28b662..fcb846a50d19cb97fc73de8b801962ac }; }; -From 5835acd4a62ab42a30ac752c7478da389fad7402 Mon Sep 17 00:00:00 2001 +From 081652a195e9ecc2046092ec2169d372fb2365e9 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 19 Jul 2017 15:20:50 +0100 -Subject: [PATCH 321/333] overlays: i2c1-bcm2708: Don't overwrite i2c1 pins +Subject: [PATCH 320/407] overlays: i2c1-bcm2708: Don't overwrite i2c1 pins node It is bad practise to overwrite an entire node in an overlay. Instead, @@ -171755,10 +171727,10 @@ index e303b9c61c82a28eab7b48f6b085661574d5a849..7c69047bcd88a5c900dddd08e60ad075 }; }; -From a6cc04cc6d345f37da9327bf40bc912dd1814498 Mon Sep 17 00:00:00 2001 +From 9cf68222c9fd1d15b3c989edaf110c033126461a Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 14 Jul 2017 12:59:55 +0100 -Subject: [PATCH 322/333] bcm2835-mmc: Fix DMA usage +Subject: [PATCH 321/407] bcm2835-mmc: Fix DMA usage The previous change ("bcm2835-mmc: Only claim one DMA channel") used an incorrect variable, the effect of which was to prevent @@ -171793,10 +171765,10 @@ index 4fe8d1fe44578fbefcd48f8c327ba3d03f3d0a2a..981db05de1ff52a83550e41ab362eecf } #endif -From d3b6bca4d2595e2e3ec3322eb18893a07be0e01d Mon Sep 17 00:00:00 2001 +From fa94eb42aae9cb05b8443b388f55b4436150b5d3 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 18 Jul 2017 15:30:48 +0100 -Subject: [PATCH 323/333] bcm2835-mmc: Prevent DMA race condition +Subject: [PATCH 322/407] bcm2835-mmc: Prevent DMA race condition The end of a read operation is triggered by the completion of the DMA transfer, but writes are complete when the data IRQ is raised. The @@ -171863,10 +171835,10 @@ index 981db05de1ff52a83550e41ab362eecf99cafa29..c4a5e992c6fb4a40b933239350ed4bfc static void bcm2835_mmc_finish_command(struct bcm2835_host *host) -From 5b4023a995c4fda75b0caa8d7b1ffd791e05860e Mon Sep 17 00:00:00 2001 +From 855e9b653388f26418935f1c3f5685db51101186 Mon Sep 17 00:00:00 2001 From: allocom Date: Sat, 5 Aug 2017 11:27:07 +0530 -Subject: [PATCH 324/333] allo-digione: 192kHz clicking sound fix +Subject: [PATCH 323/407] allo-digione: 192kHz clicking sound fix See: https://github.com/raspberrypi/linux/pull/2149 --- @@ -172036,10 +172008,10 @@ index e3664e44c699d0102120ecf99e8b780a4505ebad..9387b055875fdf92a13dc4a9d2727f95 ret = snd_soc_register_card(&snd_allo_digione); -From 0ca8d6d0b361f6b4c874207c1751143411777dd9 Mon Sep 17 00:00:00 2001 +From 505427f7528f9baf56458dd3efb266be454120de Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 10 Aug 2017 11:47:41 +0100 -Subject: [PATCH 325/333] Revert "usb: gadget: Fix copy/pasted error message" +Subject: [PATCH 324/407] Revert "usb: gadget: Fix copy/pasted error message" This reverts commit 92d6a813b03a576dd821667b6566a1ddf7617137. --- @@ -172060,10 +172032,10 @@ index b6d4b484c51aeefb154a653897391fecdca19ae6..b0f71957d00bded60c8f8da92e2cc15b } hidg->out_ep->driver_data = hidg; -From 8c8fd629c0141de50de66e5ca0e2986610301f67 Mon Sep 17 00:00:00 2001 +From af7a50411af5bf13f8ef0165457df67ab1fffd51 Mon Sep 17 00:00:00 2001 From: Krzysztof Opasiak Date: Tue, 24 Jan 2017 03:27:24 +0100 -Subject: [PATCH 326/333] usb: gadget: f_hid: fix: Move IN request allocation +Subject: [PATCH 325/407] usb: gadget: f_hid: fix: Move IN request allocation to set_alt() Since commit: ba1582f22231 ("usb: gadget: f_hid: use alloc_ep_req()") @@ -172288,10 +172260,10 @@ index b0f71957d00bded60c8f8da92e2cc15b376cce00..5815120c04021695d2453dece631bdbd } -From b7e2d9d008b1a7c4316e9c4d337144804d53d865 Mon Sep 17 00:00:00 2001 +From e25ab69be40efd52ef22f6f74bbaa70baf31fab3 Mon Sep 17 00:00:00 2001 From: allocom Date: Thu, 27 Jul 2017 23:49:36 +0530 -Subject: [PATCH 327/333] Bug fix: unmuted +Subject: [PATCH 326/407] Bug fix: unmuted --- sound/soc/bcm/allo-piano-dac-plus.c | 56 ++++++++++++++++++++++++++----------- @@ -172456,10 +172428,10 @@ index d4e99e3c6a383d92fb0cf9e8c1cd1e7657358d49..1756e244939256d9992ae034f72adc5d } -From ad4e2f6ed29462920e189d02a810070568ba588d Mon Sep 17 00:00:00 2001 +From 7938bd23be0bf7613baaf4fa0fa371351ec11df6 Mon Sep 17 00:00:00 2001 From: allocom Date: Sat, 5 Aug 2017 11:26:47 +0530 -Subject: [PATCH 328/333] allo-piano-dac-plus: Master volume added +Subject: [PATCH 327/407] allo-piano-dac-plus: Master volume added Master volume added, which controls both DACs volumes. @@ -172807,10 +172779,10 @@ index 1756e244939256d9992ae034f72adc5dc46a7ce8..730f57cb6730bb825b6a0aab1eadbb27 ret = snd_allo_piano_dsp_program(rtd, glb_ptr->set_mode, rate, -From c0e86c37fa74589e11716b83ffe4433d785fce55 Mon Sep 17 00:00:00 2001 +From d41076a00cadb95f9852c82bc1a70f4bc893b532 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 7 May 2017 11:34:26 +0200 -Subject: [PATCH 329/333] ASoC: bcm2835: Add support for TDM modes +Subject: [PATCH 328/407] ASoC: bcm2835: Add support for TDM modes bcm2835 supports arbitrary positioning of channel data within a frame and thus is capable of supporting TDM modes. Since @@ -173213,10 +173185,10 @@ index c8dd065aea8414b47aa2ea4fc04168b5e29002ad..dcacf7f83c9371df539a788ea33fedcf dev->dev = &pdev->dev; dev_set_drvdata(&pdev->dev, dev); -From 64dde9a04fa454feaca3b8237da2c4efc089df5a Mon Sep 17 00:00:00 2001 +From 7701c4fcd8ec19d6c243e9f71ef4059bf0f8c89f Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 7 May 2017 15:30:50 +0200 -Subject: [PATCH 330/333] ASoC: bcm2835: Support left/right justified and DSP +Subject: [PATCH 329/407] ASoC: bcm2835: Support left/right justified and DSP modes DSP modes and left/right justified modes can be supported @@ -173462,10 +173434,10 @@ index dcacf7f83c9371df539a788ea33fedcf97d64690..3a706fda4f39e42efbe12f19d87af9b1 } -From ffbed3ee0773b2d88262ac5a9e6743d4bbc71e2e Mon Sep 17 00:00:00 2001 +From 5cdc5927040a1bac32cca9873db66b198669da96 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 7 May 2017 16:19:54 +0200 -Subject: [PATCH 331/333] ASoC: bcm2835: Support additional samplerates up to +Subject: [PATCH 330/407] ASoC: bcm2835: Support additional samplerates up to 384kHz Sample rates are only restricted by the capabilities of the @@ -173508,10 +173480,10 @@ index 3a706fda4f39e42efbe12f19d87af9b100a348a5..43f5715a0d5dda851731ecf7ff27e76c | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE -From 53424b6946146d03248121014e33eeac1417a39e Mon Sep 17 00:00:00 2001 +From 481d2065030d9b2a362459825f6d01caff304b48 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 7 May 2017 16:24:57 +0200 -Subject: [PATCH 332/333] ASoC: bcm2835: Enforce full symmetry +Subject: [PATCH 331/407] ASoC: bcm2835: Enforce full symmetry bcm2835's configuration registers can't be changed when a stream is running, which means asymmetric configurations aren't supported. @@ -173547,10 +173519,10 @@ index 43f5715a0d5dda851731ecf7ff27e76c48fb6e57..2e449d7173fcecbcd647f90a26bd58b6 static bool bcm2835_i2s_volatile_reg(struct device *dev, unsigned int reg) -From 448bc59b6ed4129ed88482e6d6bb85ae8fe1f7e4 Mon Sep 17 00:00:00 2001 +From b3302d70bbc318bb2d451e106df4ba3c13072687 Mon Sep 17 00:00:00 2001 From: Conn Date: Mon, 17 Jul 2017 03:25:43 +0100 -Subject: [PATCH 333/333] config: enhance DualShock3 controller support +Subject: [PATCH 332/407] config: enhance DualShock3 controller support Enable rumble support in Sony HID & HID battery strength. --- @@ -173598,3 +173570,11740 @@ index 0ace5c0ff13560dddc19801bcc7965178620425c..23360b1b13197512851e3d14b18ebcc6 CONFIG_HID_SPEEDLINK=m CONFIG_HID_SUNPLUS=m CONFIG_HID_GREENASIA=m + +From b7aa409da1d6f925b007d0dd30be8cd1162065c9 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Thu, 18 Dec 2014 16:07:15 -0800 +Subject: [PATCH 333/407] mm: Remove the PFN busy warning + +See commit dae803e165a11bc88ca8dbc07a11077caf97bbcb -- the warning is +expected sometimes when using CMA. However, that commit still spams +my kernel log with these warnings. + +Signed-off-by: Eric Anholt +--- + mm/page_alloc.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/mm/page_alloc.c b/mm/page_alloc.c +index 7064aae8ded7526856d6be5f137e558cd79e1566..b654a6e129ab1f8f196f76766aa1a8624721c5c2 100644 +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -7351,8 +7351,6 @@ int alloc_contig_range(unsigned long start, unsigned long end, + + /* Make sure the range is really isolated. */ + if (test_pages_isolated(outer_start, end, false)) { +- pr_info_ratelimited("%s: [%lx, %lx) PFNs busy\n", +- __func__, outer_start, end); + ret = -EBUSY; + goto done; + } + +From d95c6a72f4d1309f3b9fb9d2fa55f09c7f06b4ff Mon Sep 17 00:00:00 2001 +From: Dan Pasanen +Date: Thu, 21 Sep 2017 09:55:42 -0500 +Subject: [PATCH 334/407] arm: partially revert + 702b94bff3c50542a6e4ab9a4f4cef093262fe65 + +* Re-expose some dmi APIs for use in VCSM +--- + arch/arm/include/asm/cacheflush.h | 21 +++++++++++++++++++++ + arch/arm/include/asm/glue-cache.h | 2 ++ + arch/arm/mm/cache-v6.S | 4 ++-- + arch/arm/mm/cache-v7.S | 4 ++-- + arch/arm/mm/proc-macros.S | 2 ++ + arch/arm/mm/proc-syms.c | 3 +++ + 6 files changed, 32 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h +index bdd283bc5842c31fd9f399e8353adcaf1eadfe39..58c6398b3828535ff2494b1d896976ea8de00c07 100644 +--- a/arch/arm/include/asm/cacheflush.h ++++ b/arch/arm/include/asm/cacheflush.h +@@ -94,6 +94,21 @@ + * DMA Cache Coherency + * =================== + * ++ * dma_inv_range(start, end) ++ * ++ * Invalidate (discard) the specified virtual address range. ++ * May not write back any entries. If 'start' or 'end' ++ * are not cache line aligned, those lines must be written ++ * back. ++ * - start - virtual start address ++ * - end - virtual end address ++ * ++ * dma_clean_range(start, end) ++ * ++ * Clean (write back) the specified virtual address range. ++ * - start - virtual start address ++ * - end - virtual end address ++ * + * dma_flush_range(start, end) + * + * Clean and invalidate the specified virtual address range. +@@ -115,6 +130,8 @@ struct cpu_cache_fns { + void (*dma_map_area)(const void *, size_t, int); + void (*dma_unmap_area)(const void *, size_t, int); + ++ void (*dma_inv_range)(const void *, const void *); ++ void (*dma_clean_range)(const void *, const void *); + void (*dma_flush_range)(const void *, const void *); + }; + +@@ -140,6 +157,8 @@ extern struct cpu_cache_fns cpu_cache; + * is visible to DMA, or data written by DMA to system memory is + * visible to the CPU. + */ ++#define dmac_inv_range cpu_cache.dma_inv_range ++#define dmac_clean_range cpu_cache.dma_clean_range + #define dmac_flush_range cpu_cache.dma_flush_range + + #else +@@ -159,6 +178,8 @@ extern void __cpuc_flush_dcache_area(void *, size_t); + * is visible to DMA, or data written by DMA to system memory is + * visible to the CPU. + */ ++extern void dmac_inv_range(const void *, const void *); ++extern void dmac_clean_range(const void *, const void *); + extern void dmac_flush_range(const void *, const void *); + + #endif +diff --git a/arch/arm/include/asm/glue-cache.h b/arch/arm/include/asm/glue-cache.h +index 01c3d92624e5ed3e0035c4305ca5b6797ba1888b..99f29f1963aec25c0016c5eadeb4a042e75bd4c9 100644 +--- a/arch/arm/include/asm/glue-cache.h ++++ b/arch/arm/include/asm/glue-cache.h +@@ -154,6 +154,8 @@ static inline void nop_dma_unmap_area(const void *s, size_t l, int f) { } + #define __cpuc_coherent_user_range __glue(_CACHE,_coherent_user_range) + #define __cpuc_flush_dcache_area __glue(_CACHE,_flush_kern_dcache_area) + ++#define dmac_inv_range __glue(_CACHE,_dma_inv_range) ++#define dmac_clean_range __glue(_CACHE,_dma_clean_range) + #define dmac_flush_range __glue(_CACHE,_dma_flush_range) + #endif + +diff --git a/arch/arm/mm/cache-v6.S b/arch/arm/mm/cache-v6.S +index 24659952c2784de64a53dc2e889ab616bd19b12b..1ee5bc3a101884132a65adae32d6ef7417667ffc 100644 +--- a/arch/arm/mm/cache-v6.S ++++ b/arch/arm/mm/cache-v6.S +@@ -201,7 +201,7 @@ ENTRY(v6_flush_kern_dcache_area) + * - start - virtual start address of region + * - end - virtual end address of region + */ +-v6_dma_inv_range: ++ENTRY(v6_dma_inv_range) + #ifdef CONFIG_DMA_CACHE_RWFO + ldrb r2, [r0] @ read for ownership + strb r2, [r0] @ write for ownership +@@ -246,7 +246,7 @@ v6_dma_inv_range: + * - start - virtual start address of region + * - end - virtual end address of region + */ +-v6_dma_clean_range: ++ENTRY(v6_dma_clean_range) + bic r0, r0, #D_CACHE_LINE_SIZE - 1 + 1: + #ifdef CONFIG_DMA_CACHE_RWFO +diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S +index a134d8a13d001ee8ad4b1084c9a71c1dc9f8d832..2ddf36403d1c8f6dcade00ef2fffd44bf2e5c4e4 100644 +--- a/arch/arm/mm/cache-v7.S ++++ b/arch/arm/mm/cache-v7.S +@@ -349,7 +349,7 @@ ENDPROC(v7_flush_kern_dcache_area) + * - start - virtual start address of region + * - end - virtual end address of region + */ +-v7_dma_inv_range: ++ENTRY(v7_dma_inv_range) + dcache_line_size r2, r3 + sub r3, r2, #1 + tst r0, r3 +@@ -377,7 +377,7 @@ ENDPROC(v7_dma_inv_range) + * - start - virtual start address of region + * - end - virtual end address of region + */ +-v7_dma_clean_range: ++ENTRY(v7_dma_clean_range) + dcache_line_size r2, r3 + sub r3, r2, #1 + bic r0, r0, r3 +diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S +index 0d40c285bd864c87a5e02d59d35d789183334700..b4bc7614da42acf44eac072252c1f832db39a86c 100644 +--- a/arch/arm/mm/proc-macros.S ++++ b/arch/arm/mm/proc-macros.S +@@ -325,6 +325,8 @@ ENTRY(\name\()_cache_fns) + .long \name\()_flush_kern_dcache_area + .long \name\()_dma_map_area + .long \name\()_dma_unmap_area ++ .long \name\()_dma_inv_range ++ .long \name\()_dma_clean_range + .long \name\()_dma_flush_range + .size \name\()_cache_fns, . - \name\()_cache_fns + .endm +diff --git a/arch/arm/mm/proc-syms.c b/arch/arm/mm/proc-syms.c +index 054b491ff7649ca067ff821770aec80a4da42102..70e8b7d3443467ae9595924f1a9d043b984e2c93 100644 +--- a/arch/arm/mm/proc-syms.c ++++ b/arch/arm/mm/proc-syms.c +@@ -30,6 +30,9 @@ EXPORT_SYMBOL(__cpuc_flush_user_all); + EXPORT_SYMBOL(__cpuc_flush_user_range); + EXPORT_SYMBOL(__cpuc_coherent_kern_range); + EXPORT_SYMBOL(__cpuc_flush_dcache_area); ++EXPORT_SYMBOL(dmac_inv_range); ++EXPORT_SYMBOL(dmac_clean_range); ++EXPORT_SYMBOL(dmac_flush_range); + #else + EXPORT_SYMBOL(cpu_cache); + #endif + +From cf1ecee491d6883e018a3cde7634954c07d5d46c Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 18 Aug 2017 18:45:36 +0100 +Subject: [PATCH 335/407] vcsm: Provide flag to map pages up front + +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 30 +++++++++++++++++++++++++++--- + 1 file changed, 27 insertions(+), 3 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index ee4e05948c439a9045e0b65566d57587177a32e2..7d417214f4288cb24e6f20c840aef1b69dc9eb0b 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -142,6 +142,7 @@ struct SM_RESOURCE_T { + struct list_head map_list; /* Maps associated with a resource. */ + + struct SM_PRIV_DATA_T *private; ++ bool map; /* whether to map pages up front */ + }; + + /* Private file data associated with each opened device. +@@ -1376,6 +1377,20 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + vcsm_vma_open(vma); + resource->res_stats[MAP]++; + vmcs_sm_release_resource(resource, 0); ++ ++ if (resource->map) { ++ /* We don't use vmf->pgoff since that has the fake offset */ ++ unsigned long addr; ++ for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) { ++ /* Finally, remap it */ ++ unsigned long pfn = (unsigned long)resource->res_base_mem & 0x3FFFFFFF; ++ pfn += mm_vc_mem_phys_addr; ++ pfn += addr - vma->vm_start; ++ pfn >>= PAGE_SHIFT; ++ ret = vm_insert_pfn(vma, addr, pfn); ++ } ++ } ++ + return 0; + + error: +@@ -1394,10 +1409,18 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + struct SM_RESOURCE_T *resource; + VC_SM_ALLOC_T alloc = { 0 }; + VC_SM_ALLOC_RESULT_T result = { 0 }; ++ enum vmcs_sm_cache_e cached = ioparam->cached; ++ bool map = false; ++ ++ /* flag to requst buffer is mapped up front, rather than lazily */ ++ if (cached & 0x80 ) { ++ map = true; ++ cached &= ~0x80; ++ } + + /* Setup our allocation parameters */ +- alloc.type = ((ioparam->cached == VMCS_SM_CACHE_VC) +- || (ioparam->cached == ++ alloc.type = ((cached == VMCS_SM_CACHE_VC) ++ || (cached == + VMCS_SM_CACHE_BOTH)) ? VC_SM_ALLOC_CACHED : + VC_SM_ALLOC_NON_CACHED; + alloc.base_unit = ioparam->size; +@@ -1455,7 +1478,8 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + resource->res_handle = result.res_handle; + resource->res_base_mem = result.res_mem; + resource->res_size = alloc.base_unit * alloc.num_unit; +- resource->res_cached = ioparam->cached; ++ resource->res_cached = cached; ++ resource->map = map; + + /* Kernel/user GUID. This global identifier is used for mmap'ing the + * allocated region from user space, it is passed as the mmap'ing + +From 2bbefa5d77801ceb5cc0ec3ee96038e0863920a7 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 18 Aug 2017 18:46:20 +0100 +Subject: [PATCH 336/407] vcsm: Provide new ioctl to clean/invalidate a 2D + block + +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 45 ++++++++++++++++++++++++++++++++++ + include/linux/broadcom/vmcs_sm_ioctl.h | 16 ++++++++++++ + 2 files changed, 61 insertions(+) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 7d417214f4288cb24e6f20c840aef1b69dc9eb0b..cc8a3969cf38f013e53554514ade83cf7de532e0 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2814,6 +2814,51 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + } + break; ++ /* Flush/Invalidate the cache for a given mapping. */ ++ case VMCS_SM_CMD_CLEAN_INVALID2: ++ { ++ int i, j; ++ struct vmcs_sm_ioctl_clean_invalid2 ioparam; ++ struct vmcs_sm_ioctl_clean_invalid_block *block = NULL; ++ ++ /* Get parameter data. */ ++ if (copy_from_user(&ioparam, ++ (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user header for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ block = kzalloc(ioparam.op_count * sizeof(struct vmcs_sm_ioctl_clean_invalid_block), GFP_KERNEL); ++ if (!block) { ++ ret = -EFAULT; ++ goto out; ++ } ++ if (copy_from_user(block, ++ (void *)(arg + sizeof(ioparam)), ioparam.op_count * sizeof(struct vmcs_sm_ioctl_clean_invalid_block)) != 0) { ++ pr_err("[%s]: failed to copy-from-user payload for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ for (i=0; iblock_count; ++j) { ++ extern void v7_dma_inv_range(void *start, void *end); ++ extern void v7_dma_clean_range(void *start, void *end); ++ unsigned long base = (unsigned long)op->start_address + j * op->inter_block_stride; ++ unsigned long end = base + op->block_size; ++ /* L1/L2 cache clean/invalidate */ ++ if (op->invalidate_mode == 1) ++ v7_dma_inv_range((void *)base, (void *)end); ++ else ++ v7_dma_clean_range((void *)base, (void *)end); ++ } ++ } ++ kfree(block); ++ } ++ break; + + default: + { +diff --git a/include/linux/broadcom/vmcs_sm_ioctl.h b/include/linux/broadcom/vmcs_sm_ioctl.h +index 334f36d0d697b047df2922b5f2db67f38cf76564..2de7f1f41070689c99cad3bd43d117458549cb51 100644 +--- a/include/linux/broadcom/vmcs_sm_ioctl.h ++++ b/include/linux/broadcom/vmcs_sm_ioctl.h +@@ -62,6 +62,7 @@ enum vmcs_sm_cmd_e { + VMCS_SM_CMD_HOST_WALK_PID_MAP, + + VMCS_SM_CMD_CLEAN_INVALID, ++ VMCS_SM_CMD_CLEAN_INVALID2, + + VMCS_SM_CMD_LAST /* Do no delete */ + }; +@@ -175,6 +176,18 @@ struct vmcs_sm_ioctl_clean_invalid { + } s[8]; + }; + ++struct vmcs_sm_ioctl_clean_invalid2 { ++ uint8_t op_count; ++ uint8_t zero[3]; ++ struct vmcs_sm_ioctl_clean_invalid_block { ++ uint16_t invalidate_mode; ++ uint16_t block_count; ++ void * start_address; ++ uint32_t block_size; ++ uint32_t inter_block_stride; ++ } s[0]; ++}; ++ + /* IOCTL numbers */ + #define VMCS_SM_IOCTL_MEM_ALLOC\ + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_ALLOC,\ +@@ -206,6 +219,9 @@ struct vmcs_sm_ioctl_clean_invalid { + #define VMCS_SM_IOCTL_MEM_CLEAN_INVALID\ + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_CLEAN_INVALID,\ + struct vmcs_sm_ioctl_clean_invalid) ++#define VMCS_SM_IOCTL_MEM_CLEAN_INVALID2\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_CLEAN_INVALID2,\ ++ struct vmcs_sm_ioctl_clean_invalid2) + + #define VMCS_SM_IOCTL_SIZE_USR_HDL\ + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_SIZE_USR_HANDLE,\ + +From 868227fa572a68d6be5671abc8cc345304e341d5 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 22 Aug 2017 13:48:22 +0100 +Subject: [PATCH 337/407] cache: Fix up previous commit for v6 + +--- + arch/arm/mm/cache-v7.S | 6 ++++-- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 8 ++++---- + 2 files changed, 8 insertions(+), 6 deletions(-) + +diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S +index 2ddf36403d1c8f6dcade00ef2fffd44bf2e5c4e4..48a81f3757d487e7ae3a9508facda401504dff8e 100644 +--- a/arch/arm/mm/cache-v7.S ++++ b/arch/arm/mm/cache-v7.S +@@ -349,7 +349,8 @@ ENDPROC(v7_flush_kern_dcache_area) + * - start - virtual start address of region + * - end - virtual end address of region + */ +-ENTRY(v7_dma_inv_range) ++ENTRY(rpi_dma_inv_range) ++v7_dma_inv_range: + dcache_line_size r2, r3 + sub r3, r2, #1 + tst r0, r3 +@@ -377,7 +378,8 @@ ENDPROC(v7_dma_inv_range) + * - start - virtual start address of region + * - end - virtual end address of region + */ +-ENTRY(v7_dma_clean_range) ++ENTRY(rpi_dma_clean_range) ++v7_dma_clean_range: + dcache_line_size r2, r3 + sub r3, r2, #1 + bic r0, r0, r3 +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index cc8a3969cf38f013e53554514ade83cf7de532e0..dda21c2fe7463ff1f550798b13fa64805cb6d2a7 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2845,15 +2845,15 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + for (i=0; iblock_count; ++j) { +- extern void v7_dma_inv_range(void *start, void *end); +- extern void v7_dma_clean_range(void *start, void *end); ++ extern void rpi_dma_inv_range(void *start, void *end); ++ extern void rpi_dma_clean_range(void *start, void *end); + unsigned long base = (unsigned long)op->start_address + j * op->inter_block_stride; + unsigned long end = base + op->block_size; + /* L1/L2 cache clean/invalidate */ + if (op->invalidate_mode == 1) +- v7_dma_inv_range((void *)base, (void *)end); ++ rpi_dma_inv_range((void *)base, (void *)end); + else +- v7_dma_clean_range((void *)base, (void *)end); ++ rpi_dma_clean_range((void *)base, (void *)end); + } + } + kfree(block); + +From 4fc5f54480a98cc9be5a850ee29b54a5ae80bbaf Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 25 Aug 2017 17:09:38 +0100 +Subject: [PATCH 338/407] vcsm: Allow build with multi-platform v6-v7 + +--- + arch/arm/mm/cache-v7.S | 6 ++---- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 30 +++++++++++++++++++++++------- + 2 files changed, 25 insertions(+), 11 deletions(-) + +diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S +index 48a81f3757d487e7ae3a9508facda401504dff8e..2ddf36403d1c8f6dcade00ef2fffd44bf2e5c4e4 100644 +--- a/arch/arm/mm/cache-v7.S ++++ b/arch/arm/mm/cache-v7.S +@@ -349,8 +349,7 @@ ENDPROC(v7_flush_kern_dcache_area) + * - start - virtual start address of region + * - end - virtual end address of region + */ +-ENTRY(rpi_dma_inv_range) +-v7_dma_inv_range: ++ENTRY(v7_dma_inv_range) + dcache_line_size r2, r3 + sub r3, r2, #1 + tst r0, r3 +@@ -378,8 +377,7 @@ ENDPROC(v7_dma_inv_range) + * - start - virtual start address of region + * - end - virtual end address of region + */ +-ENTRY(rpi_dma_clean_range) +-v7_dma_clean_range: ++ENTRY(v7_dma_clean_range) + dcache_line_size r2, r3 + sub r3, r2, #1 + bic r0, r0, r3 +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index dda21c2fe7463ff1f550798b13fa64805cb6d2a7..1dd5d227980a26c0b2f305435e71cb124f44c6dc 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2845,15 +2845,31 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + for (i=0; iblock_count; ++j) { +- extern void rpi_dma_inv_range(void *start, void *end); +- extern void rpi_dma_clean_range(void *start, void *end); ++ ++ ++ extern void v6_dma_inv_range(void *start, void *end); ++ extern void v6_dma_clean_range(void *start, void *end); + unsigned long base = (unsigned long)op->start_address + j * op->inter_block_stride; + unsigned long end = base + op->block_size; +- /* L1/L2 cache clean/invalidate */ +- if (op->invalidate_mode == 1) +- rpi_dma_inv_range((void *)base, (void *)end); +- else +- rpi_dma_clean_range((void *)base, (void *)end); ++ /* L1/L2 cache clean */ ++ if (op->invalidate_mode & 2) { ++#if defined(CONFIG_CPU_CACHE_V7) ++ extern void v7_dma_clean_range(void *start, void *end); ++ v7_dma_clean_range((void *)base, (void *)end); ++#elif defined(CONFIG_CPU_CACHE_V6) ++ extern void v6_dma_clean_range(void *start, void *end); ++ v6_dma_clean_range((void *)base, (void *)end); ++#endif ++ /* L1/L2 cache invalidate */ ++ } else if (op->invalidate_mode & 1) { ++#if defined(CONFIG_CPU_CACHE_V7) ++ extern void v7_dma_inv_range(void *start, void *end); ++ v7_dma_inv_range((void *)base, (void *)end); ++#elif defined(CONFIG_CPU_CACHE_V6) ++ extern void v6_dma_inv_range(void *start, void *end); ++ v6_dma_inv_range((void *)base, (void *)end); ++#endif ++ } + } + } + kfree(block); + +From d82ed5ede2b99fd3b930687369ac5551de38bede Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Mon, 4 Sep 2017 20:48:02 +0100 +Subject: [PATCH 339/407] vcsm: Allow both clean and invalidate to be requested + +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 1dd5d227980a26c0b2f305435e71cb124f44c6dc..1fe8608f462ab4ea6b2449494b6352d0a0af889c 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2861,7 +2861,8 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + v6_dma_clean_range((void *)base, (void *)end); + #endif + /* L1/L2 cache invalidate */ +- } else if (op->invalidate_mode & 1) { ++ } ++ if (op->invalidate_mode & 1) { + #if defined(CONFIG_CPU_CACHE_V7) + extern void v7_dma_inv_range(void *start, void *end); + v7_dma_inv_range((void *)base, (void *)end); + +From 28a242b03964c4e70c4a0f33b7e799ecffdfe37f Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 15 Feb 2017 11:16:05 +0000 +Subject: [PATCH 340/407] VCSM: Specify pointers in IPC msgs as uint32_t + +Pointers were specified as void* which will fail +rather badly if the kernel is switched to 64 bit. +GPU wants 32 bit addresses, so use uint32_t and +cast whereever necessary. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 12 ++++---- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 52 +++++++++++++++++--------------- + 2 files changed, 33 insertions(+), 31 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +index c4d5ff718a5ba9071ef87fa4c6cf632486c4d36f..6c19aac6dc9df90edb9432bc32e7477d532d3278 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_defs.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -88,7 +88,7 @@ typedef struct { + /* Resource handle */ + uint32_t res_handle; + /* Pointer to resource buffer */ +- void *res_mem; ++ uint32_t res_mem; + /* Resource base size (bytes) */ + uint32_t res_base_size; + /* Resource number */ +@@ -101,7 +101,7 @@ typedef struct { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ +- void *res_mem; ++ uint32_t res_mem; + + } VC_SM_FREE_T; + +@@ -110,7 +110,7 @@ typedef struct { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ +- void *res_mem; ++ uint32_t res_mem; + + } VC_SM_LOCK_UNLOCK_T; + +@@ -119,7 +119,7 @@ typedef struct { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ +- void *res_mem; ++ uint32_t res_mem; + /* Resource *new* size requested (bytes) */ + uint32_t res_new_size; + +@@ -133,10 +133,10 @@ typedef struct { + /* Resource handle */ + uint32_t res_handle; + /* Pointer to resource buffer */ +- void *res_mem; ++ uint32_t res_mem; + /* Pointer to former resource buffer if the memory + * was reallocated */ +- void *res_old_mem; ++ uint32_t res_old_mem; + + } VC_SM_LOCK_RESULT_T; + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 1fe8608f462ab4ea6b2449494b6352d0a0af889c..a23d2ab75fc041b2d562a65cafe787fc73f21233 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -877,7 +877,7 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + */ + if (resource->res_handle) { + VC_SM_FREE_T free = { +- resource->res_handle, resource->res_base_mem ++ resource->res_handle, (uint32_t)resource->res_base_mem + }; + int status = vc_vchi_sm_free(sm_state->sm_handle, &free, + &private->int_trans_id); +@@ -1136,17 +1136,17 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + int status; + + lock_unlock.res_handle = resource->res_handle; +- lock_unlock.res_mem = resource->res_base_mem; ++ lock_unlock.res_mem = (uint32_t)resource->res_base_mem; + + pr_debug("[%s]: attempt to lock data - hdl %x, base address %p\n", +- __func__, lock_unlock.res_handle, lock_unlock.res_mem); ++ __func__, lock_unlock.res_handle, ++ (void *)lock_unlock.res_mem); + + /* Lock the videocore allocated resource. + */ + status = vc_vchi_sm_lock(sm_state->sm_handle, + &lock_unlock, &lock_result, 0); +- if ((status != 0) || +- ((status == 0) && (lock_result.res_mem == NULL))) { ++ if (status || !lock_result.res_mem) { + pr_err("[%s]: failed to lock memory on videocore (status: %u)\n", + __func__, status); + resource->res_stats[LOCK_FAIL]++; +@@ -1162,10 +1162,10 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + + /* Keep track of the new base memory. + */ +- if ((lock_result.res_mem != NULL) && +- (lock_result.res_old_mem != NULL) && ++ if (lock_result.res_mem && ++ lock_result.res_old_mem && + (lock_result.res_mem != lock_result.res_old_mem)) { +- resource->res_base_mem = lock_result.res_mem; ++ resource->res_base_mem = (void *)lock_result.res_mem; + } + } + +@@ -1464,7 +1464,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + private->restart_sys = -EINTR; + private->int_action = VC_SM_MSG_TYPE_ALLOC; + goto error; +- } else if (status != 0 || (status == 0 && result.res_mem == NULL)) { ++ } else if (status != 0 || !result.res_mem) { + pr_err("[%s]: failed to allocate memory on videocore (status: %u, trans_id: %u)\n", + __func__, status, private->int_trans_id); + ret = -ENOMEM; +@@ -1476,7 +1476,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + */ + resource->private = private; + resource->res_handle = result.res_handle; +- resource->res_base_mem = result.res_mem; ++ resource->res_base_mem = (void *)result.res_mem; + resource->res_size = alloc.base_unit * alloc.num_unit; + resource->res_cached = cached; + resource->map = map; +@@ -1654,11 +1654,12 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + } + + resize.res_handle = resource->res_handle; +- resize.res_mem = resource->res_base_mem; ++ resize.res_mem = (uint32_t)resource->res_base_mem; + resize.res_new_size = ioparam->new_size; + + pr_debug("[%s]: attempt to resize data - guid %x, hdl %x, base address %p\n", +- __func__, ioparam->handle, resize.res_handle, resize.res_mem); ++ __func__, ioparam->handle, resize.res_handle, ++ (void *)resize.res_mem); + + /* Resize the videocore allocated resource. + */ +@@ -1671,7 +1672,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + private->restart_sys = -EINTR; + private->int_action = VC_SM_MSG_TYPE_RESIZE; + goto error; +- } else if (status != 0) { ++ } else if (status) { + pr_err("[%s]: failed to resize memory on videocore (status: %u, trans_id: %u)\n", + __func__, status, private->int_trans_id); + ret = -EPERM; +@@ -1729,14 +1730,14 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + } + + lock.res_handle = resource->res_handle; +- lock.res_mem = resource->res_base_mem; ++ lock.res_mem = (uint32_t)resource->res_base_mem; + + /* Take the lock and get the address to be mapped. + */ + if (vc_addr == 0) { + pr_debug("[%s]: attempt to lock data - guid %x, hdl %x, base address %p\n", + __func__, ioparam->handle, lock.res_handle, +- lock.res_mem); ++ (void *)lock.res_mem); + + /* Lock the videocore allocated resource. + */ +@@ -1749,8 +1750,8 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + private->restart_sys = -EINTR; + private->int_action = VC_SM_MSG_TYPE_LOCK; + goto error; +- } else if (status != 0 || +- (status == 0 && result.res_mem == NULL)) { ++ } else if (status || ++ (!status && !(void *)result.res_mem)) { + pr_err("[%s]: failed to lock memory on videocore (status: %u, trans_id: %u)\n", + __func__, status, private->int_trans_id); + ret = -EPERM; +@@ -1759,8 +1760,8 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + } + + pr_debug("[%s]: succeed to lock data - hdl %x, base address %p (%p), ref-cnt %d\n", +- __func__, lock.res_handle, result.res_mem, +- lock.res_mem, resource->lock_count); ++ __func__, lock.res_handle, (void *)result.res_mem, ++ (void *)lock.res_mem, resource->lock_count); + } + /* Lock assumed taken already, address to be mapped is known. + */ +@@ -1773,10 +1774,10 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + /* Keep track of the new base memory allocation if it has changed. + */ + if ((vc_addr == 0) && +- (result.res_mem != NULL) && +- (result.res_old_mem != NULL) && ++ ((void *)result.res_mem) && ++ ((void *)result.res_old_mem) && + (result.res_mem != result.res_old_mem)) { +- resource->res_base_mem = result.res_mem; ++ resource->res_base_mem = (void *)result.res_mem; + + /* Kernel allocated resources. + */ +@@ -1901,10 +1902,11 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + } + + unlock.res_handle = resource->res_handle; +- unlock.res_mem = resource->res_base_mem; ++ unlock.res_mem = (uint32_t)resource->res_base_mem; + + pr_debug("[%s]: attempt to unlock data - guid %x, hdl %x, base address %p\n", +- __func__, ioparam->handle, unlock.res_handle, unlock.res_mem); ++ __func__, ioparam->handle, unlock.res_handle, ++ (void *)unlock.res_mem); + + /* User space allocated resources. + */ +@@ -2039,7 +2041,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + } + + pr_debug("[%s]: success to unlock data - hdl %x, base address %p, ref-cnt %d\n", +- __func__, unlock.res_handle, unlock.res_mem, ++ __func__, unlock.res_handle, (void *)unlock.res_mem, + resource->lock_count); + + error: + +From ee331cce86582af1401a9494c1191f145bb27bc3 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 19 May 2017 14:29:12 +0100 +Subject: [PATCH 341/407] vcsm: code-style: Fix comment indentation + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 58 +++++++++++++++++++------------- + 1 file changed, 34 insertions(+), 24 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index 5e279f5a95fac7227cea15941bf0570ddc2b0886..f8e555dc30074e7ff226cf34a96aa30a34176775 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -19,63 +19,73 @@ + + #include "vc_sm_defs.h" + +-/* Forward declare. ++/* ++ * Forward declare. + */ + typedef struct sm_instance *VC_VCHI_SM_HANDLE_T; + +-/* Initialize the shared memory service, opens up vchi connection to talk to it. +-*/ ++/* ++ * Initialize the shared memory service, opens up vchi connection to talk to it. ++ */ + VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, + VCHI_CONNECTION_T **vchi_connections, + uint32_t num_connections); + +-/* Terminates the shared memory service. +-*/ ++/* ++ * Terminates the shared memory service. ++ */ + int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle); + +-/* Ask the shared memory service to allocate some memory on videocre and +-** return the result of this allocation (which upon success will be a pointer +-** to some memory in videocore space). +-*/ ++/* ++ * Ask the shared memory service to allocate some memory on videocre and ++ * return the result of this allocation (which upon success will be a pointer ++ * to some memory in videocore space). ++ */ + int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, + VC_SM_ALLOC_T *alloc, + VC_SM_ALLOC_RESULT_T *alloc_result, uint32_t *trans_id); + +-/* Ask the shared memory service to free up some memory that was previously +-** allocated by the vc_vchi_sm_alloc function call. +-*/ ++/* ++ * Ask the shared memory service to free up some memory that was previously ++ * allocated by the vc_vchi_sm_alloc function call. ++ */ + int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, + VC_SM_FREE_T *free, uint32_t *trans_id); + +-/* Ask the shared memory service to lock up some memory that was previously +-** allocated by the vc_vchi_sm_alloc function call. ++/* ++ * Ask the shared memory service to lock up some memory that was previously ++ * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + VC_SM_LOCK_UNLOCK_T *lock_unlock, + VC_SM_LOCK_RESULT_T *lock_result, uint32_t *trans_id); + +-/* Ask the shared memory service to unlock some memory that was previously +-** allocated by the vc_vchi_sm_alloc function call. ++/* ++ * Ask the shared memory service to unlock some memory that was previously ++ * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + VC_SM_LOCK_UNLOCK_T *lock_unlock, + uint32_t *trans_id, uint8_t wait_reply); + +-/* Ask the shared memory service to resize some memory that was previously +-** allocated by the vc_vchi_sm_alloc function call. ++/* ++ * Ask the shared memory service to resize some memory that was previously ++ * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, + VC_SM_RESIZE_T *resize, uint32_t *trans_id); + +-/* Walk the allocated resources on the videocore side, the allocation will +-** show up in the log. This is purely for debug/information and takes no +-** specific actions. ++/* ++ * Walk the allocated resources on the videocore side, the allocation will ++ * show up in the log. This is purely for debug/information and takes no ++ * specific actions. + */ + int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); + +-/* Clean up following a previously interrupted action which left the system +-** in a bad state of some sort. +-*/ ++/* ++ * Clean up following a previously interrupted action which left the system ++ * in a bad state of some sort. ++ */ + int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, + VC_SM_ACTION_CLEAN_T *action_clean); + + +From b2628c179c9d1a0028f966931333383319ec2426 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 25 Aug 2017 15:58:57 +0100 +Subject: [PATCH 342/407] vcsm: Convert to loading via device tree. + +Signed-off-by: Dave Stevenson +--- + arch/arm/boot/dts/bcm2708-rpi.dtsi | 6 ++++ + drivers/char/broadcom/vc_sm/vmcs_sm.c | 53 ++++++++++++++++++++++++----------- + 2 files changed, 43 insertions(+), 16 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi.dtsi b/arch/arm/boot/dts/bcm2708-rpi.dtsi +index 72ab7fc673cef529c501026964284009b7cd401e..097e8bff0b38b7de51e6de9dad98ca6179dbfae5 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi.dtsi ++++ b/arch/arm/boot/dts/bcm2708-rpi.dtsi +@@ -72,6 +72,12 @@ + firmware = <&firmware>; + }; + ++ vcsm: vcsm { ++ compatible = "raspberrypi,bcm2835-vcsm"; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++ + thermal: thermal { + compatible = "brcm,bcm2835-thermal"; + firmware = <&firmware>; +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index a23d2ab75fc041b2d562a65cafe787fc73f21233..57cd47f22449ad26eaedc86b4540764ec880dd5b 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -27,6 +27,8 @@ + #include + #include + #include ++#include ++#include + #include + #include + #include +@@ -45,6 +47,7 @@ + /* ---- Private Constants and Types --------------------------------------- */ + + #define DEVICE_NAME "vcsm" ++#define DRIVER_NAME "bcm2835-vcsm" + #define DEVICE_MINOR 0 + + #define VC_SM_DIR_ROOT_NAME "vc-smem" +@@ -165,6 +168,7 @@ struct SM_PRIV_DATA_T { + /* Global state information. + */ + struct SM_STATE_T { ++ struct platform_device *pdev; + VC_VCHI_SM_HANDLE_T sm_handle; /* Handle for videocore service. */ + struct dentry *dir_root; /* Debug fs entries root. */ + struct dentry *dir_alloc; /* Debug fs entries allocations. */ +@@ -3000,18 +3004,6 @@ static void vc_sm_connected_init(void) + + pr_info("[%s]: start\n", __func__); + +- /* Allocate memory for the state structure. +- */ +- sm_state = kzalloc(sizeof(struct SM_STATE_T), GFP_KERNEL); +- if (sm_state == NULL) { +- pr_err("[%s]: failed to allocate memory\n", __func__); +- ret = -ENOMEM; +- goto out; +- } +- +- mutex_init(&sm_state->lock); +- mutex_init(&sm_state->map_lock); +- + /* Initialize and create a VCHI connection for the shared memory service + ** running on videocore. + */ +@@ -3104,15 +3096,23 @@ static void vc_sm_connected_init(void) + } + + /* Driver loading. */ +-static int __init vc_sm_init(void) ++static int bcm2835_vcsm_probe(struct platform_device *pdev) + { + pr_info("vc-sm: Videocore shared memory driver\n"); ++ ++ sm_state = kzalloc(sizeof(*sm_state), GFP_KERNEL); ++ if (!sm_state) ++ return -ENOMEM; ++ sm_state->pdev = pdev; ++ mutex_init(&sm_state->lock); ++ mutex_init(&sm_state->map_lock); ++ + vchiq_add_connected_callback(vc_sm_connected_init); + return 0; + } + + /* Driver unloading. */ +-static void __exit vc_sm_exit(void) ++static int bcm2835_vcsm_remove(struct platform_device *pdev) + { + pr_debug("[%s]: start\n", __func__); + if (sm_inited) { +@@ -3135,6 +3135,7 @@ static void __exit vc_sm_exit(void) + } + + pr_debug("[%s]: end\n", __func__); ++ return 0; + } + + #if defined(__KERNEL__) +@@ -3302,8 +3303,28 @@ int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, + EXPORT_SYMBOL_GPL(vc_sm_map); + #endif + +-late_initcall(vc_sm_init); +-module_exit(vc_sm_exit); ++/* ++ * Register the driver with device tree ++ */ ++ ++static const struct of_device_id bcm2835_vcsm_of_match[] = { ++ {.compatible = "raspberrypi,bcm2835-vcsm",}, ++ { /* sentinel */ }, ++}; ++ ++MODULE_DEVICE_TABLE(of, bcm2835_vcsm_of_match); ++ ++static struct platform_driver bcm2835_vcsm_driver = { ++ .probe = bcm2835_vcsm_probe, ++ .remove = bcm2835_vcsm_remove, ++ .driver = { ++ .name = DRIVER_NAME, ++ .owner = THIS_MODULE, ++ .of_match_table = bcm2835_vcsm_of_match, ++ }, ++}; ++ ++module_platform_driver(bcm2835_vcsm_driver); + + MODULE_AUTHOR("Broadcom"); + MODULE_DESCRIPTION("VideoCore SharedMemory Driver"); + +From 3ecdfebebaab90395d84a47f92c094c898c5518e Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 15 Feb 2017 11:17:44 +0000 +Subject: [PATCH 343/407] VCSM: New option to import a DMABUF for VPU use + +Takes a dmabuf, and then calls over to the VPU to wrap +it into a suitable handle. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 57 ++++++- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 21 ++- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 9 ++ + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 7 + + drivers/char/broadcom/vc_sm/vmcs_sm.c | 269 ++++++++++++++++++++++++++++++- + include/linux/broadcom/vmcs_sm_ioctl.h | 18 ++- + 6 files changed, 359 insertions(+), 22 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +index 6c19aac6dc9df90edb9432bc32e7477d532d3278..bf057969644546d8f036044aa14d6606173b6a35 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_defs.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -26,8 +26,9 @@ + /* Resource name maximum size */ + #define VC_SM_RESOURCE_NAME 32 + +-/* All message types supported for HOST->VC direction */ + typedef enum { ++ /* Message types supported for HOST->VC direction */ ++ + /* Allocate shared memory block */ + VC_SM_MSG_TYPE_ALLOC, + /* Lock allocated shared memory block */ +@@ -45,6 +46,21 @@ typedef enum { + + /* A previously applied action will need to be reverted */ + VC_SM_MSG_TYPE_ACTION_CLEAN, ++ ++ /* ++ * Import a physical address and wrap into a MEM_HANDLE_T. ++ * Release with VC_SM_MSG_TYPE_FREE. ++ */ ++ VC_SM_MSG_TYPE_IMPORT, ++ ++ /* Message types supported for VC->HOST direction */ ++ ++ /* ++ * VC has finished with an imported memory allocation. ++ * Release any Linux reference counts on the underlying block. ++ */ ++ VC_SM_MSG_TYPE_RELEASED, ++ + VC_SM_MSG_TYPE_MAX + } VC_SM_MSG_TYPE; + +@@ -165,6 +181,41 @@ typedef struct { + + } VC_SM_FREE_ALL_T; + ++/* Request to import memory (HOST->VC) */ ++struct vc_sm_import { ++ /* type of memory to allocate */ ++ VC_SM_ALLOC_TYPE_T type; ++ /* pointer to the VC (ie physical) address of the allocated memory */ ++ uint32_t addr; ++ /* size of buffer */ ++ uint32_t size; ++ /* opaque handle returned in RELEASED messages */ ++ int32_t kernel_id; ++ /* Allocator identifier */ ++ uint32_t allocator; ++ /* resource name (for easier tracking on vc side) */ ++ char name[VC_SM_RESOURCE_NAME]; ++}; ++ ++/* Result of a requested memory import (VC->HOST) */ ++struct vc_sm_import_result { ++ /* Transaction identifier */ ++ uint32_t trans_id; ++ ++ /* Resource handle */ ++ uint32_t res_handle; ++}; ++ ++/* Notification that VC has finished with an allocation (VC->HOST) */ ++struct vc_sm_released { ++ /* pointer to the VC (ie physical) address of the allocated memory */ ++ uint32_t addr; ++ /* size of buffer */ ++ uint32_t size; ++ /* opaque handle returned in RELEASED messages */ ++ int32_t kernel_id; ++}; ++ + /* Union of ALL messages */ + typedef union { + VC_SM_ALLOC_T alloc; +@@ -175,7 +226,9 @@ typedef union { + VC_SM_LOCK_RESULT_T lock_result; + VC_SM_RESULT_T result; + VC_SM_FREE_ALL_T free_all; +- ++ struct vc_sm_import import; ++ struct vc_sm_import_result import_result; ++ struct vc_sm_released released; + } VC_SM_MSG_UNION_T; + + #endif /* __VC_SM_DEFS_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index 965f9a209a025202fea8065d3947c36f4fa43d0a..31050d3eb242b744c1ca43d6672d63b8439f7bc5 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -26,30 +26,27 @@ typedef enum { + + } VC_SM_LOCK_CACHE_MODE_T; + +-/* Allocate a shared memory handle and block. +-*/ ++/* Allocate a shared memory handle and block. */ + int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle); + +-/* Free a previously allocated shared memory handle and block. +-*/ ++/* Free a previously allocated shared memory handle and block. */ + int vc_sm_free(int handle); + +-/* Lock a memory handle for use by kernel. +-*/ ++/* Lock a memory handle for use by kernel. */ + int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, + long unsigned int *data); + +-/* Unlock a memory handle in use by kernel. +-*/ ++/* Unlock a memory handle in use by kernel. */ + int vc_sm_unlock(int handle, int flush, int no_vc_unlock); + +-/* Get an internal resource handle mapped from the external one. +-*/ ++/* Get an internal resource handle mapped from the external one. */ + int vc_sm_int_handle(int handle); + +-/* Map a shared memory region for use by kernel. +-*/ ++/* Map a shared memory region for use by kernel. */ + int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, + long unsigned int *data); + ++/* Import a block of memory into the GPU space. */ ++int vc_sm_import_dmabuf(struct dma_buf *dmabuf, int *handle); ++ + #endif /* __VC_SM_KNL_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index 7c6ba1a244a8aff8132e0177e02b2b2a6cd364e0..5690b265e3fcc650449f009abb792ee84b97e788 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -490,3 +490,12 @@ int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, VC_SM_ACTION_CLEAN_T *msg) + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ACTION_CLEAN, + msg, sizeof(*msg), 0, 0, 0, 0); + } ++ ++int vc_vchi_sm_import(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_import *msg, ++ struct vc_sm_import_result *result, ++ uint32_t *cur_trans_id) ++{ ++ return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_IMPORT, ++ msg, sizeof(*msg), result, sizeof(*result), ++ cur_trans_id, 1); ++} +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index f8e555dc30074e7ff226cf34a96aa30a34176775..562217831fa744db99d94295c1c5a46f3a4780fb 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -89,4 +89,11 @@ int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); + int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, + VC_SM_ACTION_CLEAN_T *action_clean); + ++/* ++ * Import a contiguous block of memory and wrap it in a GPU MEM_HANDLE_T. ++ */ ++int vc_vchi_sm_import(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_import *msg, ++ struct vc_sm_import_result *result, ++ uint32_t *cur_trans_id); ++ + #endif /* __VC_VCHI_SM_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 57cd47f22449ad26eaedc86b4540764ec880dd5b..91e34dcbe88411a639f077fdf93da70762b1b1a6 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -69,6 +70,7 @@ enum SM_STATS_T { + MAP, + FLUSH, + INVALID, ++ IMPORT, + + END_ATTEMPT, + +@@ -80,6 +82,7 @@ enum SM_STATS_T { + MAP_FAIL, + FLUSH_FAIL, + INVALID_FAIL, ++ IMPORT_FAIL, + + END_ALL, + +@@ -93,6 +96,7 @@ static const char *const sm_stats_human_read[] = { + "Map", + "Cache Flush", + "Cache Invalidate", ++ "Import", + }; + + typedef int (*VC_SM_SHOW) (struct seq_file *s, void *v); +@@ -144,6 +148,12 @@ struct SM_RESOURCE_T { + uint8_t map_count; /* Counter of mappings for this resource. */ + struct list_head map_list; /* Maps associated with a resource. */ + ++ /* DMABUF related fields */ ++ struct dma_buf *dma_buf; ++ struct dma_buf_attachment *attach; ++ struct sg_table *sgt; ++ dma_addr_t dma_addr; ++ + struct SM_PRIV_DATA_T *private; + bool map; /* whether to map pages up front */ + }; +@@ -500,7 +510,9 @@ static void vmcs_sm_remove_map(struct SM_STATE_T *state, + static int vc_sm_global_state_show(struct seq_file *s, void *v) + { + struct sm_mmap *map = NULL; ++ struct SM_RESOURCE_T *resource = NULL; + int map_count = 0; ++ int resource_count = 0; + + if (sm_state == NULL) + return 0; +@@ -512,7 +524,41 @@ static int vc_sm_global_state_show(struct seq_file *s, void *v) + */ + + mutex_lock(&(sm_state->map_lock)); ++ seq_puts(s, "\nResources\n"); ++ if (!list_empty(&sm_state->resource_list)) { ++ list_for_each_entry(resource, &sm_state->resource_list, ++ global_resource_list) { ++ resource_count++; ++ ++ seq_printf(s, "\nResource %p\n", ++ resource); ++ seq_printf(s, " PID %u\n", ++ resource->pid); ++ seq_printf(s, " RES_GUID 0x%x\n", ++ resource->res_guid); ++ seq_printf(s, " LOCK_COUNT %u\n", ++ resource->lock_count); ++ seq_printf(s, " REF_COUNT %u\n", ++ resource->ref_count); ++ seq_printf(s, " res_handle 0x%X\n", ++ resource->res_handle); ++ seq_printf(s, " res_base_mem %p\n", ++ resource->res_base_mem); ++ seq_printf(s, " SIZE %d\n", ++ resource->res_size); ++ seq_printf(s, " DMABUF %p\n", ++ resource->dma_buf); ++ seq_printf(s, " ATTACH %p\n", ++ resource->attach); ++ seq_printf(s, " SGT %p\n", ++ resource->sgt); ++ seq_printf(s, " DMA_ADDR 0x%08X\n", ++ resource->dma_addr); ++ } ++ } ++ seq_printf(s, "\n\nTotal resource count: %d\n\n", resource_count); + ++ seq_puts(s, "\nMappings\n"); + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + map_count++; +@@ -527,6 +573,8 @@ static int vc_sm_global_state_show(struct seq_file *s, void *v) + map->res_usr_hdl); + seq_printf(s, " USR-ADDR 0x%lx\n", + map->res_addr); ++ seq_printf(s, " SIZE %d\n", ++ map->resource->res_size); + } + } + +@@ -843,7 +891,8 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + list_del(&resource->resource_list); + list_del(&resource->global_resource_list); + +- /* Walk the global resource list, find out if the resource is used ++ /* ++ * Walk the global resource list, find out if the resource is used + * somewhere else. In which case we don't want to delete it. + */ + list_for_each_entry(res_tmp, &sm_state->resource_list, +@@ -877,8 +926,7 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + up_write(¤t->mm->mmap_sem); + } + +- /* Free up the videocore allocated resource. +- */ ++ /* Free up the videocore allocated resource. */ + if (resource->res_handle) { + VC_SM_FREE_T free = { + resource->res_handle, (uint32_t)resource->res_base_mem +@@ -893,13 +941,19 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + } + } + +- /* Free up the shared resource. +- */ ++ if (resource->sgt) ++ dma_buf_unmap_attachment(resource->attach, resource->sgt, ++ DMA_BIDIRECTIONAL); ++ if (resource->attach) ++ dma_buf_detach(resource->dma_buf, resource->attach); ++ if (resource->dma_buf) ++ dma_buf_put(resource->dma_buf); ++ ++ /* Free up the shared resource. */ + if (resource->res_shared) + vmcs_sm_release_resource(resource->res_shared, 0); + +- /* Free up the local resource tracking this allocation. +- */ ++ /* Free up the local resource tracking this allocation. */ + vc_sm_resource_deceased(resource, force); + kfree(resource); + } +@@ -2055,6 +2109,137 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + return ret; + } + ++/* ++ * Import a contiguous block of memory to be shared with VC. ++ */ ++int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, ++ struct vmcs_sm_ioctl_import_dmabuf *ioparam, ++ struct dma_buf *src_dma_buf) ++{ ++ int ret = 0; ++ int status; ++ struct SM_RESOURCE_T *resource = NULL; ++ struct vc_sm_import import = { 0 }; ++ struct vc_sm_import_result result = { 0 }; ++ struct dma_buf *dma_buf; ++ struct dma_buf_attachment *attach = NULL; ++ struct sg_table *sgt = NULL; ++ ++ /* Setup our allocation parameters */ ++ if (src_dma_buf) { ++ get_dma_buf(src_dma_buf); ++ dma_buf = src_dma_buf; ++ } else { ++ dma_buf = dma_buf_get(ioparam->dmabuf_fd); ++ } ++ if (IS_ERR(dma_buf)) ++ return PTR_ERR(dma_buf); ++ ++ attach = dma_buf_attach(dma_buf, &sm_state->pdev->dev); ++ if (IS_ERR(attach)) { ++ ret = PTR_ERR(attach); ++ goto error; ++ } ++ ++ sgt = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL); ++ if (IS_ERR(sgt)) { ++ ret = PTR_ERR(sgt); ++ goto error; ++ } ++ ++ /* Verify that the address block is contiguous */ ++ if (sgt->nents != 1) { ++ ret = -ENOMEM; ++ goto error; ++ } ++ ++ import.type = ((ioparam->cached == VMCS_SM_CACHE_VC) || ++ (ioparam->cached == VMCS_SM_CACHE_BOTH)) ? ++ VC_SM_ALLOC_CACHED : VC_SM_ALLOC_NON_CACHED; ++ import.addr = (uint32_t)sg_dma_address(sgt->sgl); ++ import.size = sg_dma_len(sgt->sgl); ++ import.allocator = current->tgid; ++ ++ if (*ioparam->name) ++ memcpy(import.name, ioparam->name, sizeof(import.name) - 1); ++ else ++ memcpy(import.name, VMCS_SM_RESOURCE_NAME_DEFAULT, ++ sizeof(VMCS_SM_RESOURCE_NAME_DEFAULT)); ++ ++ pr_debug("[%s]: attempt to import \"%s\" data - type %u, addr %p, size %u\n", ++ __func__, import.name, import.type, ++ (void *)import.addr, import.size); ++ ++ /* Allocate local resource to track this allocation. */ ++ resource = kzalloc(sizeof(*resource), GFP_KERNEL); ++ if (!resource) { ++ ret = -ENOMEM; ++ goto error; ++ } ++ INIT_LIST_HEAD(&resource->map_list); ++ resource->ref_count++; ++ resource->pid = current->tgid; ++ ++ /* Allocate the videocore resource. */ ++ status = vc_vchi_sm_import(sm_state->sm_handle, &import, &result, ++ &private->int_trans_id); ++ if (status == -EINTR) { ++ pr_debug("[%s]: requesting import memory action restart (trans_id: %u)\n", ++ __func__, private->int_trans_id); ++ ret = -ERESTARTSYS; ++ private->restart_sys = -EINTR; ++ private->int_action = VC_SM_MSG_TYPE_IMPORT; ++ goto error; ++ } else if (status || !result.res_handle) { ++ pr_debug("[%s]: failed to import memory on videocore (status: %u, trans_id: %u)\n", ++ __func__, status, private->int_trans_id); ++ ret = -ENOMEM; ++ resource->res_stats[ALLOC_FAIL]++; ++ goto error; ++ } ++ ++ /* Keep track of the resource we created. ++ */ ++ resource->private = private; ++ resource->res_handle = result.res_handle; ++ resource->res_size = import.size; ++ resource->res_cached = ioparam->cached; ++ ++ resource->dma_buf = dma_buf; ++ resource->attach = attach; ++ resource->sgt = sgt; ++ resource->dma_addr = sg_dma_address(sgt->sgl); ++ ++ /* Kernel/user GUID. This global identifier is used for mmap'ing the ++ * allocated region from user space, it is passed as the mmap'ing ++ * offset, we use it to 'hide' the videocore handle/address. ++ */ ++ mutex_lock(&sm_state->lock); ++ resource->res_guid = ++sm_state->guid; ++ mutex_unlock(&sm_state->lock); ++ resource->res_guid <<= PAGE_SHIFT; ++ ++ vmcs_sm_add_resource(private, resource); ++ ++ /* We're done */ ++ resource->res_stats[IMPORT]++; ++ ioparam->handle = resource->res_guid; ++ return 0; ++ ++error: ++ resource->res_stats[IMPORT_FAIL]++; ++ if (resource) { ++ vc_sm_resource_deceased(resource, 1); ++ kfree(resource); ++ } ++ if (sgt) ++ dma_buf_unmap_attachment(attach, sgt, DMA_BIDIRECTIONAL); ++ if (attach) ++ dma_buf_detach(dma_buf, attach); ++ dma_buf_put(dma_buf); ++ return ret; ++} ++ + /* Handle control from host. */ + static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { +@@ -2166,6 +2351,40 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + break; + ++ case VMCS_SM_CMD_IMPORT_DMABUF: ++ { ++ struct vmcs_sm_ioctl_import_dmabuf ioparam; ++ ++ /* Get the parameter data. ++ */ ++ if (copy_from_user ++ (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { ++ pr_err("[%s]: failed to copy-from-user for cmd %x\n", ++ __func__, cmdnr); ++ ret = -EFAULT; ++ goto out; ++ } ++ ++ ret = vc_sm_ioctl_import_dmabuf(file_data, &ioparam, ++ NULL); ++ if (!ret && ++ (copy_to_user((void *)arg, ++ &ioparam, sizeof(ioparam)) != 0)) { ++ struct vmcs_sm_ioctl_free freeparam = { ++ ioparam.handle ++ }; ++ pr_err("[%s]: failed to copy-to-user for cmd %x\n", ++ __func__, cmdnr); ++ vc_sm_ioctl_free(file_data, &freeparam); ++ ret = -EFAULT; ++ } ++ ++ /* Done. ++ */ ++ goto out; ++ } ++ break; ++ + /* Lock (attempt to) *and* register a cache behavior change. + */ + case VMCS_SM_CMD_LOCK_CACHE: +@@ -3301,6 +3520,42 @@ int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, + return ret; + } + EXPORT_SYMBOL_GPL(vc_sm_map); ++ ++/* Import a dmabuf to be shared with VC. */ ++int vc_sm_import_dmabuf(struct dma_buf *dmabuf, int *handle) ++{ ++ struct vmcs_sm_ioctl_import_dmabuf ioparam = { 0 }; ++ int ret; ++ struct SM_RESOURCE_T *resource; ++ ++ /* Validate we can work with this device. */ ++ if (!sm_state || !dmabuf || !handle) { ++ pr_err("[%s]: invalid input\n", __func__); ++ return -EPERM; ++ } ++ ++ ioparam.cached = 0; ++ strcpy(ioparam.name, "KRNL DMABUF"); ++ ++ ret = vc_sm_ioctl_import_dmabuf(sm_state->data_knl, &ioparam, dmabuf); ++ ++ if (!ret) { ++ resource = vmcs_sm_acquire_resource(sm_state->data_knl, ++ ioparam.handle); ++ if (resource) { ++ resource->pid = 0; ++ vmcs_sm_release_resource(resource, 0); ++ ++ /* Assign valid handle at this time.*/ ++ *handle = ioparam.handle; ++ } else { ++ ret = -ENOMEM; ++ } ++ } ++ ++ return ret; ++} ++EXPORT_SYMBOL_GPL(vc_sm_import_dmabuf); + #endif + + /* +diff --git a/include/linux/broadcom/vmcs_sm_ioctl.h b/include/linux/broadcom/vmcs_sm_ioctl.h +index 2de7f1f41070689c99cad3bd43d117458549cb51..b75729d762f25aace133f7a008633b4094ae2de2 100644 +--- a/include/linux/broadcom/vmcs_sm_ioctl.h ++++ b/include/linux/broadcom/vmcs_sm_ioctl.h +@@ -64,7 +64,9 @@ enum vmcs_sm_cmd_e { + VMCS_SM_CMD_CLEAN_INVALID, + VMCS_SM_CMD_CLEAN_INVALID2, + +- VMCS_SM_CMD_LAST /* Do no delete */ ++ VMCS_SM_CMD_IMPORT_DMABUF, ++ ++ VMCS_SM_CMD_LAST /* Do not delete */ + }; + + /* Cache type supported, conveniently matches the user space definition in +@@ -188,6 +190,16 @@ struct vmcs_sm_ioctl_clean_invalid2 { + } s[0]; + }; + ++struct vmcs_sm_ioctl_import_dmabuf { ++ /* user -> kernel */ ++ int dmabuf_fd; ++ enum vmcs_sm_cache_e cached; ++ char name[VMCS_SM_RESOURCE_NAME]; ++ ++ /* kernel -> user */ ++ unsigned int handle; ++}; ++ + /* IOCTL numbers */ + #define VMCS_SM_IOCTL_MEM_ALLOC\ + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_ALLOC,\ +@@ -257,6 +269,10 @@ struct vmcs_sm_ioctl_clean_invalid2 { + _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_HOST_WALK_PID_MAP,\ + struct vmcs_sm_ioctl_walk) + ++#define VMCS_SM_IOCTL_MEM_IMPORT_DMABUF\ ++ _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_IMPORT_DMABUF,\ ++ struct vmcs_sm_ioctl_import_dmabuf) ++ + /* ---- Variable Externs ------------------------------------------------- */ + + /* ---- Function Prototypes ---------------------------------------------- */ + +From d7af0bdcf915ec70156556f135022b592a1fe3bd Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:26:12 +0100 +Subject: [PATCH 344/407] vcsm: Remove all typedefs from vc_sm_defs.h and + calling code + +Remove typedefs on the structures that make up the IPC +to the firmware for VCSM. Update all calling code appropriately. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 83 ++++++++++++++++---------------- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 2 +- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 34 +++++++------ + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 19 ++++---- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 26 +++++----- + 5 files changed, 84 insertions(+), 80 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +index bf057969644546d8f036044aa14d6606173b6a35..29057db43404716406b06e3c3745e3d82219be16 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_defs.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -19,14 +19,14 @@ + #define VC_SM_SERVER_NAME MAKE_FOURCC("SMEM") + + /* Maximum message length */ +-#define VC_SM_MAX_MSG_LEN (sizeof(VC_SM_MSG_UNION_T) + \ +- sizeof(VC_SM_MSG_HDR_T)) +-#define VC_SM_MAX_RSP_LEN (sizeof(VC_SM_MSG_UNION_T)) ++#define VC_SM_MAX_MSG_LEN (sizeof(union vc_sm_msg_union_t) + \ ++ sizeof(struct vc_sm_msg_hdr_t)) ++#define VC_SM_MAX_RSP_LEN (sizeof(union vc_sm_msg_union_t)) + + /* Resource name maximum size */ + #define VC_SM_RESOURCE_NAME 32 + +-typedef enum { ++enum vc_sm_msg_type { + /* Message types supported for HOST->VC direction */ + + /* Allocate shared memory block */ +@@ -62,27 +62,26 @@ typedef enum { + VC_SM_MSG_TYPE_RELEASED, + + VC_SM_MSG_TYPE_MAX +-} VC_SM_MSG_TYPE; ++}; + + /* Type of memory to be allocated */ +-typedef enum { ++enum vc_sm_alloc_type_t { + VC_SM_ALLOC_CACHED, + VC_SM_ALLOC_NON_CACHED, +- +-} VC_SM_ALLOC_TYPE_T; ++}; + + /* Message header for all messages in HOST->VC direction */ +-typedef struct { ++struct vc_sm_msg_hdr_t { + int32_t type; + uint32_t trans_id; + uint8_t body[0]; + +-} VC_SM_MSG_HDR_T; ++}; + + /* Request to allocate memory (HOST->VC) */ +-typedef struct { ++struct vc_sm_alloc_t { + /* type of memory to allocate */ +- VC_SM_ALLOC_TYPE_T type; ++ enum vc_sm_alloc_type_t type; + /* byte amount of data to allocate per unit */ + uint32_t base_unit; + /* number of unit to allocate */ +@@ -94,10 +93,10 @@ typedef struct { + /* resource name (for easier tracking on vc side) */ + char name[VC_SM_RESOURCE_NAME]; + +-} VC_SM_ALLOC_T; ++}; + + /* Result of a requested memory allocation (VC->HOST) */ +-typedef struct { ++struct vc_sm_alloc_result_t { + /* Transaction identifier */ + uint32_t trans_id; + +@@ -110,28 +109,28 @@ typedef struct { + /* Resource number */ + uint32_t res_num; + +-} VC_SM_ALLOC_RESULT_T; ++}; + + /* Request to free a previously allocated memory (HOST->VC) */ +-typedef struct { ++struct vc_sm_free_t { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ + uint32_t res_mem; + +-} VC_SM_FREE_T; ++}; + + /* Request to lock a previously allocated memory (HOST->VC) */ +-typedef struct { ++struct vc_sm_lock_unlock_t { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ + uint32_t res_mem; + +-} VC_SM_LOCK_UNLOCK_T; ++}; + + /* Request to resize a previously allocated memory (HOST->VC) */ +-typedef struct { ++struct vc_sm_resize_t { + /* Resource handle (returned from alloc) */ + uint32_t res_handle; + /* Resource buffer (returned from alloc) */ +@@ -139,10 +138,10 @@ typedef struct { + /* Resource *new* size requested (bytes) */ + uint32_t res_new_size; + +-} VC_SM_RESIZE_T; ++}; + + /* Result of a requested memory lock (VC->HOST) */ +-typedef struct { ++struct vc_sm_lock_result_t { + /* Transaction identifier */ + uint32_t trans_id; + +@@ -154,37 +153,36 @@ typedef struct { + * was reallocated */ + uint32_t res_old_mem; + +-} VC_SM_LOCK_RESULT_T; ++}; + + /* Generic result for a request (VC->HOST) */ +-typedef struct { ++struct vc_sm_result_t { + /* Transaction identifier */ + uint32_t trans_id; + + int32_t success; + +-} VC_SM_RESULT_T; ++}; + + /* Request to revert a previously applied action (HOST->VC) */ +-typedef struct { ++struct vc_sm_action_clean_t { + /* Action of interest */ +- VC_SM_MSG_TYPE res_action; ++ enum vc_sm_msg_type res_action; + /* Transaction identifier for the action of interest */ + uint32_t action_trans_id; + +-} VC_SM_ACTION_CLEAN_T; ++}; + + /* Request to remove all data associated with a given allocator (HOST->VC) */ +-typedef struct { ++struct vc_sm_free_all_t { + /* Allocator identifier */ + uint32_t allocator; +- +-} VC_SM_FREE_ALL_T; ++}; + + /* Request to import memory (HOST->VC) */ + struct vc_sm_import { + /* type of memory to allocate */ +- VC_SM_ALLOC_TYPE_T type; ++ enum vc_sm_alloc_type_t type; + /* pointer to the VC (ie physical) address of the allocated memory */ + uint32_t addr; + /* size of buffer */ +@@ -217,18 +215,19 @@ struct vc_sm_released { + }; + + /* Union of ALL messages */ +-typedef union { +- VC_SM_ALLOC_T alloc; +- VC_SM_ALLOC_RESULT_T alloc_result; +- VC_SM_FREE_T free; +- VC_SM_ACTION_CLEAN_T action_clean; +- VC_SM_RESIZE_T resize; +- VC_SM_LOCK_RESULT_T lock_result; +- VC_SM_RESULT_T result; +- VC_SM_FREE_ALL_T free_all; ++union vc_sm_msg_union_t { ++ struct vc_sm_alloc_t alloc; ++ struct vc_sm_alloc_result_t alloc_result; ++ struct vc_sm_free_t free; ++ struct vc_sm_lock_unlock_t lock_unlock; ++ struct vc_sm_action_clean_t action_clean; ++ struct vc_sm_resize_t resize; ++ struct vc_sm_lock_result_t lock_result; ++ struct vc_sm_result_t result; ++ struct vc_sm_free_all_t free_all; + struct vc_sm_import import; + struct vc_sm_import_result import_result; + struct vc_sm_released released; +-} VC_SM_MSG_UNION_T; ++}; + + #endif /* __VC_SM_DEFS_H__INCLUDED__ */ +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index 31050d3eb242b744c1ca43d6672d63b8439f7bc5..3c684ddde5c1fac5c726a71deec305f7588f0200 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -27,7 +27,7 @@ typedef enum { + } VC_SM_LOCK_CACHE_MODE_T; + + /* Allocate a shared memory handle and block. */ +-int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle); ++int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle); + + /* Free a previously allocated shared memory handle and block. */ + int vc_sm_free(int handle); +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index 5690b265e3fcc650449f009abb792ee84b97e788..656bb9f43bd7937debc2e5f773921c617a9723d5 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -73,11 +73,11 @@ struct sm_instance { + /* ---- Private Functions ------------------------------------------------ */ + static struct + sm_cmd_rsp_blk *vc_vchi_cmd_create(struct sm_instance *instance, +- VC_SM_MSG_TYPE id, void *msg, ++ enum vc_sm_msg_type id, void *msg, + uint32_t size, int wait) + { + struct sm_cmd_rsp_blk *blk; +- VC_SM_MSG_HDR_T *hdr; ++ struct vc_sm_msg_hdr_t *hdr; + + if (down_interruptible(&instance->free_sema)) { + blk = kmalloc(sizeof(*blk), GFP_KERNEL); +@@ -99,7 +99,7 @@ sm_cmd_rsp_blk *vc_vchi_cmd_create(struct sm_instance *instance, + blk->wait = wait; + blk->length = sizeof(*hdr) + size; + +- hdr = (VC_SM_MSG_HDR_T *) blk->msg; ++ hdr = (struct vc_sm_msg_hdr_t *) blk->msg; + hdr->type = id; + mutex_lock(&instance->lock); + hdr->trans_id = blk->id = ++instance->trans_id; +@@ -129,7 +129,7 @@ static int vc_vchi_sm_videocore_io(void *arg) + { + struct sm_instance *instance = arg; + struct sm_cmd_rsp_blk *cmd = NULL, *cmd_tmp; +- VC_SM_RESULT_T *reply; ++ struct vc_sm_result_t *reply; + uint32_t reply_len; + int32_t status; + int svc_use = 1; +@@ -367,7 +367,7 @@ int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle) + } + + int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_MSG_TYPE msg_id, ++ enum vc_sm_msg_type msg_id, + void *msg, uint32_t msg_size, + void *result, uint32_t result_size, + uint32_t *cur_trans_id, uint8_t wait_reply) +@@ -426,7 +426,8 @@ int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, + if (result && result_size) { + memcpy(result, cmd_blk->msg, result_size); + } else { +- VC_SM_RESULT_T *res = (VC_SM_RESULT_T *) cmd_blk->msg; ++ struct vc_sm_result_t *res = ++ (struct vc_sm_result_t *) cmd_blk->msg; + status = (res->success == 0) ? 0 : -ENXIO; + } + +@@ -437,8 +438,9 @@ int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, + return status; + } + +-int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, VC_SM_ALLOC_T *msg, +- VC_SM_ALLOC_RESULT_T *result, uint32_t *cur_trans_id) ++int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *msg, ++ struct vc_sm_alloc_result_t *result, ++ uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ALLOC, + msg, sizeof(*msg), result, sizeof(*result), +@@ -446,15 +448,16 @@ int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, VC_SM_ALLOC_T *msg, + } + + int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_FREE_T *msg, uint32_t *cur_trans_id) ++ struct vc_sm_free_t *msg, uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_FREE, + msg, sizeof(*msg), 0, 0, cur_trans_id, 0); + } + + int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_LOCK_UNLOCK_T *msg, +- VC_SM_LOCK_RESULT_T *result, uint32_t *cur_trans_id) ++ struct vc_sm_lock_unlock_t *msg, ++ struct vc_sm_lock_result_t *result, ++ uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_LOCK, + msg, sizeof(*msg), result, sizeof(*result), +@@ -462,7 +465,7 @@ int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + } + + int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_LOCK_UNLOCK_T *msg, ++ struct vc_sm_lock_unlock_t *msg, + uint32_t *cur_trans_id, uint8_t wait_reply) + { + return vc_vchi_sm_send_msg(handle, wait_reply ? +@@ -472,8 +475,8 @@ int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + wait_reply); + } + +-int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, VC_SM_RESIZE_T *msg, +- uint32_t *cur_trans_id) ++int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_resize_t *msg, ++ uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_RESIZE, + msg, sizeof(*msg), 0, 0, cur_trans_id, 1); +@@ -485,7 +488,8 @@ int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle) + 0, 0, 0, 0, 0, 0); + } + +-int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, VC_SM_ACTION_CLEAN_T *msg) ++int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, ++ struct vc_sm_action_clean_t *msg) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ACTION_CLEAN, + msg, sizeof(*msg), 0, 0, 0, 0); +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index 562217831fa744db99d94295c1c5a46f3a4780fb..f97cddf14881535c7f62a2ce0166a5eb7e3fad6d 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -41,31 +41,32 @@ int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle); + * return the result of this allocation (which upon success will be a pointer + * to some memory in videocore space). + */ +-int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_ALLOC_T *alloc, +- VC_SM_ALLOC_RESULT_T *alloc_result, uint32_t *trans_id); ++int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *alloc, ++ struct vc_sm_alloc_result_t *alloc_result, ++ uint32_t *trans_id); + + /* + * Ask the shared memory service to free up some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_FREE_T *free, uint32_t *trans_id); ++ struct vc_sm_free_t *free, uint32_t *trans_id); + + /* + * Ask the shared memory service to lock up some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_LOCK_UNLOCK_T *lock_unlock, +- VC_SM_LOCK_RESULT_T *lock_result, uint32_t *trans_id); ++ struct vc_sm_lock_unlock_t *lock_unlock, ++ struct vc_sm_lock_result_t *lock_result, ++ uint32_t *trans_id); + + /* + * Ask the shared memory service to unlock some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_LOCK_UNLOCK_T *lock_unlock, ++ struct vc_sm_lock_unlock_t *lock_unlock, + uint32_t *trans_id, uint8_t wait_reply); + + /* +@@ -73,7 +74,7 @@ int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + * allocated by the vc_vchi_sm_alloc function call. + */ + int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_RESIZE_T *resize, uint32_t *trans_id); ++ struct vc_sm_resize_t *resize, uint32_t *trans_id); + + /* + * Walk the allocated resources on the videocore side, the allocation will +@@ -87,7 +88,7 @@ int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); + * in a bad state of some sort. + */ + int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, +- VC_SM_ACTION_CLEAN_T *action_clean); ++ struct vc_sm_action_clean_t *action_clean); + + /* + * Import a contiguous block of memory and wrap it in a GPU MEM_HANDLE_T. +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 91e34dcbe88411a639f077fdf93da70762b1b1a6..8d2a5dd4ee8fc1be4a6d24de93239e95f96b63ca 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -170,7 +170,7 @@ struct SM_PRIV_DATA_T { + struct SM_PDE_T dir_res; /* Debug fs resource sub-tree. */ + + int restart_sys; /* Tracks restart on interrupt. */ +- VC_SM_MSG_TYPE int_action; /* Interrupted action. */ ++ enum vc_sm_msg_type int_action; /* Interrupted action. */ + uint32_t int_trans_id; /* Interrupted transaction. */ + + }; +@@ -928,7 +928,7 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + + /* Free up the videocore allocated resource. */ + if (resource->res_handle) { +- VC_SM_FREE_T free = { ++ struct vc_sm_free_t free = { + resource->res_handle, (uint32_t)resource->res_base_mem + }; + int status = vc_vchi_sm_free(sm_state->sm_handle, &free, +@@ -1123,7 +1123,7 @@ static int vc_sm_release(struct inode *inode, struct file *file) + pr_debug("[%s]: using private data %p\n", __func__, file_data); + + if (file_data->restart_sys == -EINTR) { +- VC_SM_ACTION_CLEAN_T action_clean; ++ struct vc_sm_action_clean_t action_clean; + + pr_debug("[%s]: releasing following EINTR on %u (trans_id: %u) (likely due to signal)...\n", + __func__, file_data->int_action, +@@ -1189,8 +1189,8 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + /* Lock the resource if necessary. + */ + if (!resource->lock_count) { +- VC_SM_LOCK_UNLOCK_T lock_unlock; +- VC_SM_LOCK_RESULT_T lock_result; ++ struct vc_sm_lock_unlock_t lock_unlock; ++ struct vc_sm_lock_result_t lock_result; + int status; + + lock_unlock.res_handle = resource->res_handle; +@@ -1465,8 +1465,8 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + int ret = 0; + int status; + struct SM_RESOURCE_T *resource; +- VC_SM_ALLOC_T alloc = { 0 }; +- VC_SM_ALLOC_RESULT_T result = { 0 }; ++ struct vc_sm_alloc_t alloc = { 0 }; ++ struct vc_sm_alloc_result_t result = { 0 }; + enum vmcs_sm_cache_e cached = ioparam->cached; + bool map = false; + +@@ -1671,7 +1671,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + { + int ret = 0; + int status; +- VC_SM_RESIZE_T resize; ++ struct vc_sm_resize_t resize; + struct SM_RESOURCE_T *resource; + + /* Locate resource from GUID. +@@ -1761,8 +1761,8 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + unsigned int vc_addr) + { + int status; +- VC_SM_LOCK_UNLOCK_T lock; +- VC_SM_LOCK_RESULT_T result; ++ struct vc_sm_lock_unlock_t lock; ++ struct vc_sm_lock_result_t result; + struct SM_RESOURCE_T *resource; + int ret = 0; + struct sm_mmap *map, *map_tmp; +@@ -1935,7 +1935,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + int flush, int wait_reply, int no_vc_unlock) + { + int status; +- VC_SM_LOCK_UNLOCK_T unlock; ++ struct vc_sm_lock_unlock_t unlock; + struct sm_mmap *map, *map_tmp; + struct SM_RESOURCE_T *resource; + int ret = 0; +@@ -2261,7 +2261,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + /* Action is a re-post of a previously interrupted action? */ + if (file_data->restart_sys == -EINTR) { +- VC_SM_ACTION_CLEAN_T action_clean; ++ struct vc_sm_action_clean_t action_clean; + + pr_debug("[%s]: clean up of action %u (trans_id: %u) following EINTR\n", + __func__, file_data->int_action, +@@ -3359,7 +3359,7 @@ static int bcm2835_vcsm_remove(struct platform_device *pdev) + + #if defined(__KERNEL__) + /* Allocate a shared memory handle and block. */ +-int vc_sm_alloc(VC_SM_ALLOC_T *alloc, int *handle) ++int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle) + { + struct vmcs_sm_ioctl_alloc ioparam = { 0 }; + int ret; + +From 48bcf3b34f003a4f6e2d72d1f57e159d92901b85 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:29:53 +0100 +Subject: [PATCH 345/407] vcsm: Correct block comment style on licence headers. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 28 +++++++++++++++------------- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 28 +++++++++++++++------------- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 28 +++++++++++++++------------- + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 28 +++++++++++++++------------- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 28 +++++++++++++++------------- + 5 files changed, 75 insertions(+), 65 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +index 29057db43404716406b06e3c3745e3d82219be16..8242e8ef28e445ae132187d02c74448b0226c1a4 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_defs.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -1,16 +1,18 @@ +-/***************************************************************************** +-* Copyright 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ ++/* ++ **************************************************************************** ++ * Copyright 2011 Broadcom Corporation. All rights reserved. ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2, available at ++ * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a ++ * license other than the GPL, without Broadcom's express prior written ++ * consent. ++ **************************************************************************** ++ */ + + #ifndef __VC_SM_DEFS_H__INCLUDED__ + #define __VC_SM_DEFS_H__INCLUDED__ +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index 3c684ddde5c1fac5c726a71deec305f7588f0200..8252d13999a78609fcc7e1bbe83307e2b1c1f8f1 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -1,16 +1,18 @@ +-/***************************************************************************** +-* Copyright 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ ++/* ++ **************************************************************************** ++ * Copyright 2011 Broadcom Corporation. All rights reserved. ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2, available at ++ * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a ++ * license other than the GPL, without Broadcom's express prior written ++ * consent. ++ **************************************************************************** ++ */ + + #ifndef __VC_SM_KNL_H__INCLUDED__ + #define __VC_SM_KNL_H__INCLUDED__ +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index 656bb9f43bd7937debc2e5f773921c617a9723d5..a19c0f46672f5d298c38b8433b7a0ca780ea60b8 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -1,16 +1,18 @@ +-/***************************************************************************** +-* Copyright 2011-2012 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ ++/* ++ **************************************************************************** ++ * Copyright 2011-2012 Broadcom Corporation. All rights reserved. ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2, available at ++ * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a ++ * license other than the GPL, without Broadcom's express prior written ++ * consent. ++ **************************************************************************** ++ */ + + /* ---- Include Files ----------------------------------------------------- */ + #include +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index f97cddf14881535c7f62a2ce0166a5eb7e3fad6d..110db20ef517af9589616e5892c5b48681e62966 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -1,16 +1,18 @@ +-/***************************************************************************** +-* Copyright 2011 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ ++/* ++ **************************************************************************** ++ * Copyright 2011 Broadcom Corporation. All rights reserved. ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2, available at ++ * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a ++ * license other than the GPL, without Broadcom's express prior written ++ * consent. ++ **************************************************************************** ++ */ + + #ifndef __VC_VCHI_SM_H__INCLUDED__ + #define __VC_VCHI_SM_H__INCLUDED__ +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 8d2a5dd4ee8fc1be4a6d24de93239e95f96b63ca..8a089666286aaf787560a9eb889e022495ed9a25 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -1,16 +1,18 @@ +-/***************************************************************************** +-* Copyright 2011-2012 Broadcom Corporation. All rights reserved. +-* +-* Unless you and Broadcom execute a separate written software license +-* agreement governing use of this software, this software is licensed to you +-* under the terms of the GNU General Public License version 2, available at +-* http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). +-* +-* Notwithstanding the above, under no circumstances may you combine this +-* software in any way with any other Broadcom software provided under a +-* license other than the GPL, without Broadcom's express prior written +-* consent. +-*****************************************************************************/ ++/* ++ **************************************************************************** ++ * Copyright 2011-2012 Broadcom Corporation. All rights reserved. ++ * ++ * Unless you and Broadcom execute a separate written software license ++ * agreement governing use of this software, this software is licensed to you ++ * under the terms of the GNU General Public License version 2, available at ++ * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). ++ * ++ * Notwithstanding the above, under no circumstances may you combine this ++ * software in any way with any other Broadcom software provided under a ++ * license other than the GPL, without Broadcom's express prior written ++ * consent. ++ **************************************************************************** ++ */ + + /* ---- Include Files ----------------------------------------------------- */ + + +From 55614d7d053ea64971f4dbb301812ed6f89b8f21 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:34:13 +0100 +Subject: [PATCH 346/407] vcsm: Fix block comment formatting + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 6 ++++-- + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 10 +++++----- + 2 files changed, 9 insertions(+), 7 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +index 8242e8ef28e445ae132187d02c74448b0226c1a4..de6afe9f65af45582c79a62abd41c688274ad8f2 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_defs.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h +@@ -151,8 +151,10 @@ struct vc_sm_lock_result_t { + uint32_t res_handle; + /* Pointer to resource buffer */ + uint32_t res_mem; +- /* Pointer to former resource buffer if the memory +- * was reallocated */ ++ /* ++ * Pointer to former resource buffer if the memory ++ * was reallocated ++ */ + uint32_t res_old_mem; + + }; +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index 110db20ef517af9589616e5892c5b48681e62966..48e721c7f2e4ac5abe376a8481e01b0bbcc6d3ad 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -23,7 +23,7 @@ + + /* + * Forward declare. +-*/ ++ */ + typedef struct sm_instance *VC_VCHI_SM_HANDLE_T; + + /* +@@ -57,7 +57,7 @@ int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, + /* + * Ask the shared memory service to lock up some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. +-*/ ++ */ + int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + struct vc_sm_lock_unlock_t *lock_unlock, + struct vc_sm_lock_result_t *lock_result, +@@ -66,7 +66,7 @@ int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + /* + * Ask the shared memory service to unlock some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. +-*/ ++ */ + int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + struct vc_sm_lock_unlock_t *lock_unlock, + uint32_t *trans_id, uint8_t wait_reply); +@@ -74,7 +74,7 @@ int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + /* + * Ask the shared memory service to resize some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. +-*/ ++ */ + int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, + struct vc_sm_resize_t *resize, uint32_t *trans_id); + +@@ -82,7 +82,7 @@ int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, + * Walk the allocated resources on the videocore side, the allocation will + * show up in the log. This is purely for debug/information and takes no + * specific actions. +-*/ ++ */ + int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); + + /* + +From c9ce5049260e835d160b5116c3faa92d380e5b1d Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:50:29 +0100 +Subject: [PATCH 347/407] vcsm: Remove typedef of VC_VCHI_SM_HANDLE_T + +Replaced with struct sm_instance *. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 22 +++++++++++----------- + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 22 +++++++++++----------- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 2 +- + 3 files changed, 23 insertions(+), 23 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index a19c0f46672f5d298c38b8433b7a0ca780ea60b8..596628063e61a85e3467f6488b669f16e428d96c 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -250,7 +250,7 @@ static void vc_sm_vchi_callback(void *param, + } + } + +-VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, ++struct sm_instance *vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, + VCHI_CONNECTION_T **vchi_connections, + uint32_t num_connections) + { +@@ -334,7 +334,7 @@ VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, + return NULL; + } + +-int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle) ++int vc_vchi_sm_stop(struct sm_instance **handle) + { + struct sm_instance *instance; + uint32_t i; +@@ -368,7 +368,7 @@ int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle) + return -EINVAL; + } + +-int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_send_msg(struct sm_instance *handle, + enum vc_sm_msg_type msg_id, + void *msg, uint32_t msg_size, + void *result, uint32_t result_size, +@@ -440,7 +440,7 @@ int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, + return status; + } + +-int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *msg, ++int vc_vchi_sm_alloc(struct sm_instance *handle, struct vc_sm_alloc_t *msg, + struct vc_sm_alloc_result_t *result, + uint32_t *cur_trans_id) + { +@@ -449,14 +449,14 @@ int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *msg, + cur_trans_id, 1); + } + +-int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_free(struct sm_instance *handle, + struct vc_sm_free_t *msg, uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_FREE, + msg, sizeof(*msg), 0, 0, cur_trans_id, 0); + } + +-int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_lock(struct sm_instance *handle, + struct vc_sm_lock_unlock_t *msg, + struct vc_sm_lock_result_t *result, + uint32_t *cur_trans_id) +@@ -466,7 +466,7 @@ int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + cur_trans_id, 1); + } + +-int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_unlock(struct sm_instance *handle, + struct vc_sm_lock_unlock_t *msg, + uint32_t *cur_trans_id, uint8_t wait_reply) + { +@@ -477,27 +477,27 @@ int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + wait_reply); + } + +-int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_resize_t *msg, ++int vc_vchi_sm_resize(struct sm_instance *handle, struct vc_sm_resize_t *msg, + uint32_t *cur_trans_id) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_RESIZE, + msg, sizeof(*msg), 0, 0, cur_trans_id, 1); + } + +-int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle) ++int vc_vchi_sm_walk_alloc(struct sm_instance *handle) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_WALK_ALLOC, + 0, 0, 0, 0, 0, 0); + } + +-int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_clean_up(struct sm_instance *handle, + struct vc_sm_action_clean_t *msg) + { + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_ACTION_CLEAN, + msg, sizeof(*msg), 0, 0, 0, 0); + } + +-int vc_vchi_sm_import(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_import *msg, ++int vc_vchi_sm_import(struct sm_instance *handle, struct vc_sm_import *msg, + struct vc_sm_import_result *result, + uint32_t *cur_trans_id) + { +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +index 48e721c7f2e4ac5abe376a8481e01b0bbcc6d3ad..abe4ed15836f2be756083d3fdb4edb544dacc1a6 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.h ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h +@@ -24,26 +24,26 @@ + /* + * Forward declare. + */ +-typedef struct sm_instance *VC_VCHI_SM_HANDLE_T; ++struct sm_instance; + + /* + * Initialize the shared memory service, opens up vchi connection to talk to it. + */ +-VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, ++struct sm_instance *vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, + VCHI_CONNECTION_T **vchi_connections, + uint32_t num_connections); + + /* + * Terminates the shared memory service. + */ +-int vc_vchi_sm_stop(VC_VCHI_SM_HANDLE_T *handle); ++int vc_vchi_sm_stop(struct sm_instance **handle); + + /* + * Ask the shared memory service to allocate some memory on videocre and + * return the result of this allocation (which upon success will be a pointer + * to some memory in videocore space). + */ +-int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *alloc, ++int vc_vchi_sm_alloc(struct sm_instance *handle, struct vc_sm_alloc_t *alloc, + struct vc_sm_alloc_result_t *alloc_result, + uint32_t *trans_id); + +@@ -51,14 +51,14 @@ int vc_vchi_sm_alloc(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_alloc_t *alloc, + * Ask the shared memory service to free up some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ +-int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_free(struct sm_instance *handle, + struct vc_sm_free_t *free, uint32_t *trans_id); + + /* + * Ask the shared memory service to lock up some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ +-int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_lock(struct sm_instance *handle, + struct vc_sm_lock_unlock_t *lock_unlock, + struct vc_sm_lock_result_t *lock_result, + uint32_t *trans_id); +@@ -67,7 +67,7 @@ int vc_vchi_sm_lock(VC_VCHI_SM_HANDLE_T handle, + * Ask the shared memory service to unlock some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ +-int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_unlock(struct sm_instance *handle, + struct vc_sm_lock_unlock_t *lock_unlock, + uint32_t *trans_id, uint8_t wait_reply); + +@@ -75,7 +75,7 @@ int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, + * Ask the shared memory service to resize some memory that was previously + * allocated by the vc_vchi_sm_alloc function call. + */ +-int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_resize(struct sm_instance *handle, + struct vc_sm_resize_t *resize, uint32_t *trans_id); + + /* +@@ -83,19 +83,19 @@ int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, + * show up in the log. This is purely for debug/information and takes no + * specific actions. + */ +-int vc_vchi_sm_walk_alloc(VC_VCHI_SM_HANDLE_T handle); ++int vc_vchi_sm_walk_alloc(struct sm_instance *handle); + + /* + * Clean up following a previously interrupted action which left the system + * in a bad state of some sort. + */ +-int vc_vchi_sm_clean_up(VC_VCHI_SM_HANDLE_T handle, ++int vc_vchi_sm_clean_up(struct sm_instance *handle, + struct vc_sm_action_clean_t *action_clean); + + /* + * Import a contiguous block of memory and wrap it in a GPU MEM_HANDLE_T. + */ +-int vc_vchi_sm_import(VC_VCHI_SM_HANDLE_T handle, struct vc_sm_import *msg, ++int vc_vchi_sm_import(struct sm_instance *handle, struct vc_sm_import *msg, + struct vc_sm_import_result *result, + uint32_t *cur_trans_id); + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 8a089666286aaf787560a9eb889e022495ed9a25..c92e2753e4c73c2f8ffb1bcfc375141540a02bb3 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -181,7 +181,7 @@ struct SM_PRIV_DATA_T { + */ + struct SM_STATE_T { + struct platform_device *pdev; +- VC_VCHI_SM_HANDLE_T sm_handle; /* Handle for videocore service. */ ++ struct sm_instance *sm_handle; /* Handle for videocore service. */ + struct dentry *dir_root; /* Debug fs entries root. */ + struct dentry *dir_alloc; /* Debug fs entries allocations. */ + struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ + +From 4784d3831e4036a6011e992edf81a3e2d9e44061 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:55:08 +0100 +Subject: [PATCH 348/407] vcsm: "unsigned int" preferred over "unsigned" fixed. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 3 ++- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index 596628063e61a85e3467f6488b669f16e428d96c..a2695196a94a214be309e512602d811ea3fe0bed 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -320,7 +320,8 @@ struct sm_instance *vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance, + set_user_nice(instance->io_thread, -10); + wake_up_process(instance->io_thread); + +- pr_debug("%s: success - instance 0x%x", __func__, (unsigned)instance); ++ pr_debug("%s: success - instance 0x%x", __func__, ++ (unsigned int)instance); + return instance; + + err_close_services: +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index c92e2753e4c73c2f8ffb1bcfc375141540a02bb3..4ccc6ab3a03a6b2ea62f34c2f7cb82c35f271ad3 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -227,7 +227,7 @@ static const char *const sm_cache_map_vector[] = { + + /* ---- Private Functions ------------------------------------------------ */ + +-static inline unsigned vcaddr_to_pfn(unsigned long vc_addr) ++static inline unsigned int vcaddr_to_pfn(unsigned long vc_addr) + { + unsigned long pfn = vc_addr & 0x3FFFFFFF; + pfn += mm_vc_mem_phys_addr; + +From e1e4f954753bfd754b986840da7138c24fff36ec Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 16:59:49 +0100 +Subject: [PATCH 349/407] vcsm: Fix blank lines after declarations. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 1 + + drivers/char/broadcom/vc_sm/vmcs_sm.c | 7 +++++++ + 2 files changed, 8 insertions(+) + +diff --git a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +index a2695196a94a214be309e512602d811ea3fe0bed..847a51c9c95753754046088f5a608c0e07c6c597 100644 +--- a/drivers/char/broadcom/vc_sm/vc_vchi_sm.c ++++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c +@@ -355,6 +355,7 @@ int vc_vchi_sm_stop(struct sm_instance **handle) + /* Close all VCHI service connections */ + for (i = 0; i < instance->num_connections; i++) { + int32_t success; ++ + vchi_service_use(instance->vchi_handle[i]); + + success = vchi_service_close(instance->vchi_handle[i]); +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 4ccc6ab3a03a6b2ea62f34c2f7cb82c35f271ad3..13911b69858b7dc6c09b8a184cd8e509296c422b 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -230,6 +230,7 @@ static const char *const sm_cache_map_vector[] = { + static inline unsigned int vcaddr_to_pfn(unsigned long vc_addr) + { + unsigned long pfn = vc_addr & 0x3FFFFFFF; ++ + pfn += mm_vc_mem_phys_addr; + pfn >>= PAGE_SHIFT; + return pfn; +@@ -1441,9 +1442,11 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + if (resource->map) { + /* We don't use vmf->pgoff since that has the fake offset */ + unsigned long addr; ++ + for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) { + /* Finally, remap it */ + unsigned long pfn = (unsigned long)resource->res_base_mem & 0x3FFFFFFF; ++ + pfn += mm_vc_mem_phys_addr; + pfn += addr - vma->vm_start; + pfn >>= PAGE_SHIFT; +@@ -1974,6 +1977,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + /* Flush if requested */ + if (resource->res_cached && flush) { + dma_addr_t phys_addr = 0; ++ + resource->res_stats[FLUSH]++; + + phys_addr = +@@ -1988,6 +1992,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + if (map->vma) { + unsigned long start; + unsigned long end; ++ + start = map->vma->vm_start; + end = map->vma->vm_end; + +@@ -3022,6 +3027,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + if ((resource != NULL) && resource->res_cached) { + unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); + unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); ++ + resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; + + /* L1/L2 cache flush */ +@@ -3071,6 +3077,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + for (i=0; iblock_count; ++j) { + + + +From 4d2241e3534be421c302f7716575e434d176c94a Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:01:11 +0100 +Subject: [PATCH 350/407] vcsm: Fix erroneous space in 'if' statement. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 13911b69858b7dc6c09b8a184cd8e509296c422b..9a6f2217815d0511c25de374d3455bf5b0dabe55 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -1476,7 +1476,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + bool map = false; + + /* flag to requst buffer is mapped up front, rather than lazily */ +- if (cached & 0x80 ) { ++ if (cached & 0x80) { + map = true; + cached &= ~0x80; + } + +From 28616d10d28b2777883ec4e976e45a22312ac3d7 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:21:09 +0100 +Subject: [PATCH 351/407] vcsm: Fix lots of block quote formatting issues + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 563 ++++++++++++++-------------------- + 1 file changed, 231 insertions(+), 332 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 9a6f2217815d0511c25de374d3455bf5b0dabe55..4680d8a9f5acb99a4c4a400ac589c57f8061a615 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -61,8 +61,7 @@ + #define VC_SM_DEBUG "debug" + #define VC_SM_WRITE_BUF_SIZE 128 + +-/* Statistics tracked per resource and globally. +-*/ ++/* Statistics tracked per resource and globally. */ + enum SM_STATS_T { + /* Attempt. */ + ALLOC, +@@ -109,27 +108,25 @@ struct SM_PDE_T { + + }; + +-/* Single resource allocation tracked for all devices. +-*/ ++/* Single resource allocation tracked for all devices. */ + struct sm_mmap { + struct list_head map_list; /* Linked list of maps. */ + + struct SM_RESOURCE_T *resource; /* Pointer to the resource. */ + +- pid_t res_pid; /* PID owning that resource. */ ++ pid_t res_pid; /* PID owning that resource. */ + unsigned int res_vc_hdl; /* Resource handle (videocore). */ + unsigned int res_usr_hdl; /* Resource handle (user). */ + + long unsigned int res_addr; /* Mapped virtual address. */ + struct vm_area_struct *vma; /* VM area for this mapping. */ +- unsigned int ref_count; /* Reference count to this vma. */ ++ unsigned int ref_count; /* Reference count to this vma. */ + + /* Used to link maps associated with a resource. */ + struct list_head resource_map_list; + }; + +-/* Single resource allocation tracked for each opened device. +-*/ ++/* Single resource allocation tracked for each opened device. */ + struct SM_RESOURCE_T { + struct list_head resource_list; /* List of resources. */ + struct list_head global_resource_list; /* Global list of resources. */ +@@ -160,8 +157,7 @@ struct SM_RESOURCE_T { + bool map; /* whether to map pages up front */ + }; + +-/* Private file data associated with each opened device. +-*/ ++/* Private file data associated with each opened device. */ + struct SM_PRIV_DATA_T { + struct list_head resource_list; /* List of resources. */ + +@@ -177,8 +173,7 @@ struct SM_PRIV_DATA_T { + + }; + +-/* Global state information. +-*/ ++/* Global state information. */ + struct SM_STATE_T { + struct platform_device *pdev; + struct sm_instance *sm_handle; /* Handle for videocore service. */ +@@ -236,9 +231,10 @@ static inline unsigned int vcaddr_to_pfn(unsigned long vc_addr) + return pfn; + } + +-/* Carries over to the state statistics the statistics once owned by a deceased +-** resource. +-*/ ++/* ++ * Carries over to the state statistics the statistics once owned by a deceased ++ * resource. ++ */ + static void vc_sm_resource_deceased(struct SM_RESOURCE_T *p_res, int terminated) + { + if (sm_state != NULL) { +@@ -262,9 +258,10 @@ static void vc_sm_resource_deceased(struct SM_RESOURCE_T *p_res, int terminated) + } + } + +-/* Fetch a videocore handle corresponding to a mapping of the pid+address +-** returns 0 (ie NULL) if no such handle exists in the global map. +-*/ ++/* ++ * Fetch a videocore handle corresponding to a mapping of the pid+address ++ * returns 0 (ie NULL) if no such handle exists in the global map. ++ */ + static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid, + unsigned int addr) + { +@@ -276,8 +273,7 @@ static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid, + + mutex_lock(&(sm_state->map_lock)); + +- /* Lookup the resource. +- */ ++ /* Lookup the resource. */ + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + if (map->res_pid != pid || map->res_addr != addr) +@@ -295,13 +291,14 @@ static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid, + mutex_unlock(&(sm_state->map_lock)); + + out: +- /* Use a debug log here as it may be a valid situation that we query +- ** for something that is not mapped, we do not want a kernel log each +- ** time around. +- ** +- ** There are other error log that would pop up accordingly if someone +- ** subsequently tries to use something invalid after being told not to +- ** use it... ++ /* ++ * Use a debug log here as it may be a valid situation that we query ++ * for something that is not mapped, we do not want a kernel log each ++ * time around. ++ * ++ * There are other error log that would pop up accordingly if someone ++ * subsequently tries to use something invalid after being told not to ++ * use it... + */ + if (handle == 0) { + pr_debug("[%s]: not a valid map (pid %u, addr %x)\n", +@@ -311,9 +308,10 @@ static unsigned int vmcs_sm_vc_handle_from_pid_and_address(unsigned int pid, + return handle; + } + +-/* Fetch a user handle corresponding to a mapping of the pid+address +-** returns 0 (ie NULL) if no such handle exists in the global map. +-*/ ++/* ++ * Fetch a user handle corresponding to a mapping of the pid+address ++ * returns 0 (ie NULL) if no such handle exists in the global map. ++ */ + static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid, + unsigned int addr) + { +@@ -325,8 +323,7 @@ static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid, + + mutex_lock(&(sm_state->map_lock)); + +- /* Lookup the resource. +- */ ++ /* Lookup the resource. */ + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + if (map->res_pid != pid || map->res_addr != addr) +@@ -344,7 +341,8 @@ static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid, + mutex_unlock(&(sm_state->map_lock)); + + out: +- /* Use a debug log here as it may be a valid situation that we query ++ /* ++ * Use a debug log here as it may be a valid situation that we query + * for something that is not mapped yet. + * + * There are other error log that would pop up accordingly if someone +@@ -359,9 +357,10 @@ static unsigned int vmcs_sm_usr_handle_from_pid_and_address(unsigned int pid, + } + + #if defined(DO_NOT_USE) +-/* Fetch an address corresponding to a mapping of the pid+handle +-** returns 0 (ie NULL) if no such address exists in the global map. +-*/ ++/* ++ * Fetch an address corresponding to a mapping of the pid+handle ++ * returns 0 (ie NULL) if no such address exists in the global map. ++ */ + static unsigned int vmcs_sm_usr_address_from_pid_and_vc_handle(unsigned int pid, + unsigned int hdl) + { +@@ -373,8 +372,7 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_vc_handle(unsigned int pid, + + mutex_lock(&(sm_state->map_lock)); + +- /* Lookup the resource. +- */ ++ /* Lookup the resource. */ + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + if (map->res_pid != pid || map->res_vc_hdl != hdl) +@@ -392,13 +390,14 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_vc_handle(unsigned int pid, + mutex_unlock(&(sm_state->map_lock)); + + out: +- /* Use a debug log here as it may be a valid situation that we query +- ** for something that is not mapped, we do not want a kernel log each +- ** time around. +- ** +- ** There are other error log that would pop up accordingly if someone +- ** subsequently tries to use something invalid after being told not to +- ** use it... ++ /* ++ * Use a debug log here as it may be a valid situation that we query ++ * for something that is not mapped, we do not want a kernel log each ++ * time around. ++ * ++ * There are other error log that would pop up accordingly if someone ++ * subsequently tries to use something invalid after being told not to ++ * use it... + */ + if (addr == 0) + pr_debug("[%s]: not a valid map (pid %u, hdl %x)\n", +@@ -408,9 +407,10 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_vc_handle(unsigned int pid, + } + #endif + +-/* Fetch an address corresponding to a mapping of the pid+handle +-** returns 0 (ie NULL) if no such address exists in the global map. +-*/ ++/* ++ * Fetch an address corresponding to a mapping of the pid+handle ++ * returns 0 (ie NULL) if no such address exists in the global map. ++ */ + static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + pid, + unsigned int +@@ -424,8 +424,7 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + + mutex_lock(&(sm_state->map_lock)); + +- /* Lookup the resource. +- */ ++ /* Lookup the resource. */ + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + if (map->res_pid != pid || map->res_usr_hdl != hdl) +@@ -443,7 +442,8 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + mutex_unlock(&(sm_state->map_lock)); + + out: +- /* Use a debug log here as it may be a valid situation that we query ++ /* ++ * Use a debug log here as it may be a valid situation that we query + * for something that is not mapped, we do not want a kernel log each + * time around. + * +@@ -458,19 +458,16 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + return addr; + } + +-/* Adds a resource mapping to the global data list. +-*/ ++/* Adds a resource mapping to the global data list. */ + static void vmcs_sm_add_map(struct SM_STATE_T *state, + struct SM_RESOURCE_T *resource, struct sm_mmap *map) + { + mutex_lock(&(state->map_lock)); + +- /* Add to the global list of mappings +- */ ++ /* Add to the global list of mappings */ + list_add(&map->map_list, &state->map_list); + +- /* Add to the list of mappings for this resource +- */ ++ /* Add to the list of mappings for this resource */ + list_add(&map->resource_map_list, &resource->map_list); + resource->map_count++; + +@@ -481,20 +478,17 @@ static void vmcs_sm_add_map(struct SM_STATE_T *state, + map->res_usr_hdl, map->res_addr); + } + +-/* Removes a resource mapping from the global data list. +-*/ ++/* Removes a resource mapping from the global data list. */ + static void vmcs_sm_remove_map(struct SM_STATE_T *state, + struct SM_RESOURCE_T *resource, + struct sm_mmap *map) + { + mutex_lock(&(state->map_lock)); + +- /* Remove from the global list of mappings +- */ ++ /* Remove from the global list of mappings */ + list_del(&map->map_list); + +- /* Remove from the list of mapping for this resource +- */ ++ /* Remove from the list of mapping for this resource */ + list_del(&map->resource_map_list); + if (resource->map_count > 0) + resource->map_count--; +@@ -508,8 +502,7 @@ static void vmcs_sm_remove_map(struct SM_STATE_T *state, + kfree(map); + } + +-/* Read callback for the global state proc entry. +-*/ ++/* Read callback for the global state proc entry. */ + static int vc_sm_global_state_show(struct seq_file *s, void *v) + { + struct sm_mmap *map = NULL; +@@ -523,8 +516,7 @@ static int vc_sm_global_state_show(struct seq_file *s, void *v) + seq_printf(s, "\nVC-ServiceHandle 0x%x\n", + (unsigned int)sm_state->sm_handle); + +- /* Log all applicable mapping(s). +- */ ++ /* Log all applicable mapping(s). */ + + mutex_lock(&(sm_state->map_lock)); + seq_puts(s, "\nResources\n"); +@@ -591,8 +583,7 @@ static int vc_sm_global_statistics_show(struct seq_file *s, void *v) + { + int ix; + +- /* Global state tracked statistics. +- */ ++ /* Global state tracked statistics. */ + if (sm_state != NULL) { + seq_puts(s, "\nDeceased Resources Statistics\n"); + +@@ -638,8 +629,7 @@ static int vc_sm_global_statistics_show(struct seq_file *s, void *v) + } + + #if 0 +-/* Read callback for the statistics proc entry. +-*/ ++/* Read callback for the statistics proc entry. */ + static int vc_sm_statistics_show(struct seq_file *s, void *v) + { + int ix; +@@ -654,8 +644,7 @@ static int vc_sm_statistics_show(struct seq_file *s, void *v) + if (file_data == NULL) + return 0; + +- /* Per process statistics. +- */ ++ /* Per process statistics. */ + + seq_printf(s, "\nStatistics for TGID %d\n", file_data->pid); + +@@ -771,9 +760,10 @@ static const struct file_operations vc_sm_debug_fs_fops = { + .release = single_release, + }; + +-/* Adds a resource to the private data list which tracks all the allocated +-** data. +-*/ ++/* ++ * Adds a resource to the private data list which tracks all the allocated ++ * data. ++ */ + static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, + struct SM_RESOURCE_T *resource) + { +@@ -787,9 +777,10 @@ static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, + resource->res_handle, resource->res_size, resource->res_cached); + } + +-/* Locates a resource and acquire a reference on it. +-** The resource won't be deleted while there is a reference on it. +-*/ ++/* ++ * Locates a resource and acquire a reference on it. ++ * The resource won't be deleted while there is a reference on it. ++ */ + static struct SM_RESOURCE_T *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T + *private, + unsigned int res_guid) +@@ -816,9 +807,10 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T + return ret; + } + +-/* Locates a resource and acquire a reference on it. +-** The resource won't be deleted while there is a reference on it. +-*/ ++/* ++ * Locates a resource and acquire a reference on it. ++ * The resource won't be deleted while there is a reference on it. ++ */ + static struct SM_RESOURCE_T *vmcs_sm_acquire_first_resource( + struct SM_PRIV_DATA_T *private) + { +@@ -841,9 +833,10 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_first_resource( + return ret; + } + +-/* Locates a resource and acquire a reference on it. +-** The resource won't be deleted while there is a reference on it. +-*/ ++/* ++ * Locates a resource and acquire a reference on it. ++ * The resource won't be deleted while there is a reference on it. ++ */ + static struct SM_RESOURCE_T *vmcs_sm_acquire_global_resource(unsigned int + res_guid) + { +@@ -870,9 +863,10 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_global_resource(unsigned int + return ret; + } + +-/* Release a previously acquired resource. +-** The resource will be deleted when its refcount reaches 0. +-*/ ++/* ++ * Release a previously acquired resource. ++ * The resource will be deleted when its refcount reaches 0. ++ */ + static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + { + struct SM_PRIV_DATA_T *private = resource->private; +@@ -961,16 +955,16 @@ static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) + kfree(resource); + } + +-/* Dump the map table for the driver. If process is -1, dumps the whole table, +-** if process is a valid pid (non -1) dump only the entries associated with the +-** pid of interest. +-*/ ++/* ++ * Dump the map table for the driver. If process is -1, dumps the whole table, ++ * if process is a valid pid (non -1) dump only the entries associated with the ++ * pid of interest. ++ */ + static void vmcs_sm_host_walk_map_per_pid(int pid) + { + struct sm_mmap *map = NULL; + +- /* Make sure the device was started properly. +- */ ++ /* Make sure the device was started properly. */ + if (sm_state == NULL) { + pr_err("[%s]: invalid device\n", __func__); + return; +@@ -978,8 +972,7 @@ static void vmcs_sm_host_walk_map_per_pid(int pid) + + mutex_lock(&(sm_state->map_lock)); + +- /* Log all applicable mapping(s). +- */ ++ /* Log all applicable mapping(s). */ + if (!list_empty(&sm_state->map_list)) { + list_for_each_entry(map, &sm_state->map_list, map_list) { + if (pid == -1 || map->res_pid == pid) { +@@ -995,15 +988,15 @@ static void vmcs_sm_host_walk_map_per_pid(int pid) + return; + } + +-/* Dump the allocation table from host side point of view. This only dumps the +-** data allocated for this process/device referenced by the file_data. +-*/ ++/* ++ * Dump the allocation table from host side point of view. This only dumps the ++ * data allocated for this process/device referenced by the file_data. ++ */ + static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) + { + struct SM_RESOURCE_T *resource = NULL; + +- /* Make sure the device was started properly. +- */ ++ /* Make sure the device was started properly. */ + if ((sm_state == NULL) || (file_data == NULL)) { + pr_err("[%s]: invalid device\n", __func__); + return; +@@ -1026,8 +1019,7 @@ static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) + return; + } + +-/* Create support for private data tracking. +-*/ ++/* Create support for private data tracking. */ + static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) + { + char alloc_name[32]; +@@ -1078,15 +1070,15 @@ static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) + return file_data; + } + +-/* Open the device. Creates a private state to help track all allocation +-** associated with this device. +-*/ ++/* ++ * Open the device. Creates a private state to help track all allocation ++ * associated with this device. ++ */ + static int vc_sm_open(struct inode *inode, struct file *file) + { + int ret = 0; + +- /* Make sure the device was started properly. +- */ ++ /* Make sure the device was started properly. */ + if (!sm_state) { + pr_err("[%s]: invalid device\n", __func__); + ret = -EPERM; +@@ -1105,9 +1097,10 @@ static int vc_sm_open(struct inode *inode, struct file *file) + return ret; + } + +-/* Close the device. Free up all resources still associated with this device +-** at the time. +-*/ ++/* ++ * Close the device. Free up all resources still associated with this device ++ * at the time. ++ */ + static int vc_sm_release(struct inode *inode, struct file *file) + { + struct SM_PRIV_DATA_T *file_data = +@@ -1115,8 +1108,7 @@ static int vc_sm_release(struct inode *inode, struct file *file) + struct SM_RESOURCE_T *resource; + int ret = 0; + +- /* Make sure the device was started properly. +- */ ++ /* Make sure the device was started properly. */ + if (sm_state == NULL || file_data == NULL) { + pr_err("[%s]: invalid device\n", __func__); + ret = -EPERM; +@@ -1146,8 +1138,7 @@ static int vc_sm_release(struct inode *inode, struct file *file) + /* Remove the corresponding proc entry. */ + debugfs_remove_recursive(file_data->dir_pid); + +- /* Terminate the private data. +- */ ++ /* Terminate the private data. */ + kfree(file_data); + + out: +@@ -1175,8 +1166,7 @@ static void vcsm_vma_close(struct vm_area_struct *vma) + + map->ref_count--; + +- /* Remove from the map table. +- */ ++ /* Remove from the map table. */ + if (map->ref_count == 0) + vmcs_sm_remove_map(sm_state, map->resource, map); + } +@@ -1189,8 +1179,7 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + unsigned long pfn; + int ret = 0; + +- /* Lock the resource if necessary. +- */ ++ /* Lock the resource if necessary. */ + if (!resource->lock_count) { + struct vc_sm_lock_unlock_t lock_unlock; + struct vc_sm_lock_result_t lock_result; +@@ -1203,8 +1192,7 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + __func__, lock_unlock.res_handle, + (void *)lock_unlock.res_mem); + +- /* Lock the videocore allocated resource. +- */ ++ /* Lock the videocore allocated resource. */ + status = vc_vchi_sm_lock(sm_state->sm_handle, + &lock_unlock, &lock_result, 0); + if (status || !lock_result.res_mem) { +@@ -1221,8 +1209,7 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + resource->res_stats[LOCK]++; + resource->lock_count++; + +- /* Keep track of the new base memory. +- */ ++ /* Keep track of the new base memory. */ + if (lock_result.res_mem && + lock_result.res_old_mem && + (lock_result.res_mem != lock_result.res_old_mem)) { +@@ -1244,9 +1231,9 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + case 0: + case -ERESTARTSYS: + /* +- * EBUSY is ok: this just means that another thread +- * already did the job. +- */ ++ * EBUSY is ok: this just means that another thread ++ * already did the job. ++ */ + case -EBUSY: + return VM_FAULT_NOPAGE; + case -ENOMEM: +@@ -1324,8 +1311,7 @@ static void vcsm_vma_cache_clean_page_range(unsigned long addr, + } while (pgd++, addr = pgd_next, addr != end); + } + +-/* Map an allocated data into something that the user space. +-*/ ++/* Map an allocated data into something that the user space. */ + static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + { + int ret = 0; +@@ -1334,8 +1320,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + struct SM_RESOURCE_T *resource = NULL; + struct sm_mmap *map = NULL; + +- /* Make sure the device was started properly. +- */ ++ /* Make sure the device was started properly. */ + if ((sm_state == NULL) || (file_data == NULL)) { + pr_err("[%s]: invalid device\n", __func__); + return -EPERM; +@@ -1344,11 +1329,12 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + pr_debug("[%s]: private data %p, guid %x\n", __func__, file_data, + ((unsigned int)vma->vm_pgoff << PAGE_SHIFT)); + +- /* We lookup to make sure that the data we are being asked to mmap is +- ** something that we allocated. +- ** +- ** We use the offset information as the key to tell us which resource +- ** we are mapping. ++ /* ++ * We lookup to make sure that the data we are being asked to mmap is ++ * something that we allocated. ++ * ++ * We use the offset information as the key to tell us which resource ++ * we are mapping. + */ + resource = vmcs_sm_acquire_resource(file_data, + ((unsigned int)vma->vm_pgoff << +@@ -1363,8 +1349,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + __func__, resource->res_guid, current->tgid, resource->pid, + file_data->pid); + +- /* Check permissions. +- */ ++ /* Check permissions. */ + if (resource->pid && (resource->pid != current->tgid)) { + pr_err("[%s]: current tgid %u != %u owner\n", + __func__, current->tgid, resource->pid); +@@ -1372,8 +1357,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + goto error; + } + +- /* Verify that what we are asked to mmap is proper. +- */ ++ /* Verify that what we are asked to mmap is proper. */ + if (resource->res_size != (unsigned int)(vma->vm_end - vma->vm_start)) { + pr_err("[%s]: size inconsistency (resource: %u - mmap: %u)\n", + __func__, +@@ -1384,7 +1368,8 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + goto error; + } + +- /* Keep track of the tuple in the global resource list such that one ++ /* ++ * Keep track of the tuple in the global resource list such that one + * can do a mapping lookup for address/memory handle. + */ + map = kzalloc(sizeof(*map), GFP_KERNEL); +@@ -1403,8 +1388,9 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + map->vma = vma; + vmcs_sm_add_map(sm_state, resource, map); + +- /* We are not actually mapping the pages, we just provide a fault +- ** handler to allow pages to be mapped when accessed ++ /* ++ * We are not actually mapping the pages, we just provide a fault ++ * handler to allow pages to be mapped when accessed + */ + vma->vm_flags |= + VM_IO | VM_PFNMAP | VM_DONTCOPY | VM_DONTEXPAND; +@@ -1418,8 +1404,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + + if ((resource->res_cached == VMCS_SM_CACHE_NONE) || + (resource->res_cached == VMCS_SM_CACHE_VC)) { +- /* Allocated non host cached memory, honour it. +- */ ++ /* Allocated non host cached memory, honour it. */ + vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + } + +@@ -1462,8 +1447,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + return ret; + } + +-/* Allocate a shared memory handle and block. +-*/ ++/* Allocate a shared memory handle and block. */ + int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_alloc *ioparam) + { +@@ -1505,8 +1489,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + __func__, alloc.name, alloc.type, ioparam->size, + alloc.base_unit, alloc.num_unit, alloc.alignement); + +- /* Allocate local resource to track this allocation. +- */ ++ /* Allocate local resource to track this allocation. */ + resource = kzalloc(sizeof(*resource), GFP_KERNEL); + if (!resource) { + ret = -ENOMEM; +@@ -1516,8 +1499,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + resource->ref_count++; + resource->pid = current->tgid; + +- /* Allocate the videocore resource. +- */ ++ /* Allocate the videocore resource. */ + status = vc_vchi_sm_alloc(sm_state->sm_handle, &alloc, &result, + &private->int_trans_id); + if (status == -EINTR) { +@@ -1535,8 +1517,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + goto error; + } + +- /* Keep track of the resource we created. +- */ ++ /* Keep track of the resource we created. */ + resource->private = private; + resource->res_handle = result.res_handle; + resource->res_base_mem = (void *)result.res_mem; +@@ -1544,7 +1525,8 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + resource->res_cached = cached; + resource->map = map; + +- /* Kernel/user GUID. This global identifier is used for mmap'ing the ++ /* ++ * Kernel/user GUID. This global identifier is used for mmap'ing the + * allocated region from user space, it is passed as the mmap'ing + * offset, we use it to 'hide' the videocore handle/address. + */ +@@ -1576,8 +1558,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + return ret; + } + +-/* Share an allocate memory handle and block. +-*/ ++/* Share an allocate memory handle and block.*/ + int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_alloc_share *ioparam) + { +@@ -1593,8 +1574,7 @@ int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + goto error; + } + +- /* Allocate local resource to track this allocation. +- */ ++ /* Allocate local resource to track this allocation. */ + resource = kzalloc(sizeof(*resource), GFP_KERNEL); + if (resource == NULL) { + pr_err("[%s]: failed to allocate local tracking resource\n", +@@ -1606,8 +1586,7 @@ int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + resource->ref_count++; + resource->pid = current->tgid; + +- /* Keep track of the resource we created. +- */ ++ /* Keep track of the resource we created. */ + resource->private = private; + resource->res_handle = shared_resource->res_handle; + resource->res_base_mem = shared_resource->res_base_mem; +@@ -1641,8 +1620,7 @@ int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + return ret; + } + +-/* Free a previously allocated shared memory handle and block. +-*/ ++/* Free a previously allocated shared memory handle and block.*/ + static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_free *ioparam) + { +@@ -1655,8 +1633,7 @@ static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, + return -EINVAL; + } + +- /* Check permissions. +- */ ++ /* Check permissions. */ + if (resource->pid && (resource->pid != current->tgid)) { + pr_err("[%s]: current tgid %u != %u owner\n", + __func__, current->tgid, resource->pid); +@@ -1669,8 +1646,7 @@ static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, + return 0; + } + +-/* Resize a previously allocated shared memory handle and block. +-*/ ++/* Resize a previously allocated shared memory handle and block. */ + static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_resize *ioparam) + { +@@ -1679,8 +1655,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + struct vc_sm_resize_t resize; + struct SM_RESOURCE_T *resource; + +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = vmcs_sm_acquire_resource(private, ioparam->handle); + if (!resource) { + pr_err("[%s]: failed resource - guid %x\n", +@@ -1689,9 +1664,10 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + goto error; + } + +- /* If the resource is locked, its reference count will be not NULL, +- ** in which case we will not be allowed to resize it anyways, so +- ** reject the attempt here. ++ /* ++ * If the resource is locked, its reference count will be not NULL, ++ * in which case we will not be allowed to resize it anyways, so ++ * reject the attempt here. + */ + if (resource->lock_count != 0) { + pr_err("[%s]: cannot resize - guid %x, ref-cnt %d\n", +@@ -1700,8 +1676,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + goto error; + } + +- /* Check permissions. +- */ ++ /* Check permissions. */ + if (resource->pid && (resource->pid != current->tgid)) { + pr_err("[%s]: current tgid %u != %u owner\n", __func__, + current->tgid, resource->pid); +@@ -1724,8 +1699,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + __func__, ioparam->handle, resize.res_handle, + (void *)resize.res_mem); + +- /* Resize the videocore allocated resource. +- */ ++ /* Resize the videocore allocated resource. */ + status = vc_vchi_sm_resize(sm_state->sm_handle, &resize, + &private->int_trans_id); + if (status == -EINTR) { +@@ -1746,8 +1720,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + __func__, resize.res_handle, resource->res_size, + resize.res_new_size); + +- /* Successfully resized, save the information and inform the user. +- */ ++ /* Successfully resized, save the information and inform the user. */ + ioparam->old_size = resource->res_size; + resource->res_size = resize.res_new_size; + +@@ -1758,8 +1731,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + return ret; + } + +-/* Lock a previously allocated shared memory handle and block. +-*/ ++/* Lock a previously allocated shared memory handle and block. */ + static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_lock_unlock *ioparam, + int change_cache, enum vmcs_sm_cache_e cache_type, +@@ -1775,16 +1747,14 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + + map = NULL; + +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = vmcs_sm_acquire_resource(private, ioparam->handle); + if (resource == NULL) { + ret = -EINVAL; + goto error; + } + +- /* Check permissions. +- */ ++ /* Check permissions. */ + if (resource->pid && (resource->pid != current->tgid)) { + pr_err("[%s]: current tgid %u != %u owner\n", __func__, + current->tgid, resource->pid); +@@ -1795,15 +1765,13 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + lock.res_handle = resource->res_handle; + lock.res_mem = (uint32_t)resource->res_base_mem; + +- /* Take the lock and get the address to be mapped. +- */ ++ /* Take the lock and get the address to be mapped. */ + if (vc_addr == 0) { + pr_debug("[%s]: attempt to lock data - guid %x, hdl %x, base address %p\n", + __func__, ioparam->handle, lock.res_handle, + (void *)lock.res_mem); + +- /* Lock the videocore allocated resource. +- */ ++ /* Lock the videocore allocated resource. */ + status = vc_vchi_sm_lock(sm_state->sm_handle, &lock, &result, + &private->int_trans_id); + if (status == -EINTR) { +@@ -1826,24 +1794,21 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + __func__, lock.res_handle, (void *)result.res_mem, + (void *)lock.res_mem, resource->lock_count); + } +- /* Lock assumed taken already, address to be mapped is known. +- */ ++ /* Lock assumed taken already, address to be mapped is known. */ + else + resource->res_base_mem = (void *)vc_addr; + + resource->res_stats[LOCK]++; + resource->lock_count++; + +- /* Keep track of the new base memory allocation if it has changed. +- */ ++ /* Keep track of the new base memory allocation if it has changed. */ + if ((vc_addr == 0) && + ((void *)result.res_mem) && + ((void *)result.res_old_mem) && + (result.res_mem != result.res_old_mem)) { + resource->res_base_mem = (void *)result.res_mem; + +- /* Kernel allocated resources. +- */ ++ /* Kernel allocated resources. */ + if (resource->pid == 0) { + if (!list_empty(&resource->map_list)) { + list_for_each_entry_safe(map, map_tmp, +@@ -1875,8 +1840,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + __func__, resource->map_count, private->pid, + current->tgid, ioparam->handle, ioparam->addr); + } else { +- /* Kernel allocated resources. +- */ ++ /* Kernel allocated resources. */ + if (resource->pid == 0) { + pr_debug("[%s]: attempt mapping kernel resource - guid %x, hdl %x\n", + __func__, ioparam->handle, lock.res_handle); +@@ -1933,8 +1897,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + return ret; + } + +-/* Unlock a previously allocated shared memory handle and block. +-*/ ++/* Unlock a previously allocated shared memory handle and block.*/ + static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_lock_unlock *ioparam, + int flush, int wait_reply, int no_vc_unlock) +@@ -1947,16 +1910,14 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + + map = NULL; + +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = vmcs_sm_acquire_resource(private, ioparam->handle); + if (resource == NULL) { + ret = -EINVAL; + goto error; + } + +- /* Check permissions. +- */ ++ /* Check permissions. */ + if (resource->pid && (resource->pid != current->tgid)) { + pr_err("[%s]: current tgid %u != %u owner\n", + __func__, current->tgid, resource->pid); +@@ -1971,8 +1932,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + __func__, ioparam->handle, unlock.res_handle, + (void *)unlock.res_mem); + +- /* User space allocated resources. +- */ ++ /* User space allocated resources. */ + if (resource->pid) { + /* Flush if requested */ + if (resource->res_cached && flush) { +@@ -2071,12 +2031,10 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + } + + if (resource->lock_count) { +- /* Bypass the videocore unlock. +- */ ++ /* Bypass the videocore unlock. */ + if (no_vc_unlock) + status = 0; +- /* Unlock the videocore allocated resource. +- */ ++ /* Unlock the videocore allocated resource. */ + else { + status = + vc_vchi_sm_unlock(sm_state->sm_handle, &unlock, +@@ -2116,9 +2074,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + return ret; + } + +-/* +- * Import a contiguous block of memory to be shared with VC. +- */ ++/* Import a contiguous block of memory to be shared with VC. */ + int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_import_dmabuf *ioparam, + struct dma_buf *src_dma_buf) +@@ -2205,8 +2161,7 @@ int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, + goto error; + } + +- /* Keep track of the resource we created. +- */ ++ /* Keep track of the resource we created. */ + resource->private = private; + resource->res_handle = result.res_handle; + resource->res_size = import.size; +@@ -2217,7 +2172,8 @@ int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, + resource->sgt = sgt; + resource->dma_addr = sg_dma_address(sgt->sgl); + +- /* Kernel/user GUID. This global identifier is used for mmap'ing the ++ /* ++ * Kernel/user GUID. This global identifier is used for mmap'ing the + * allocated region from user space, it is passed as the mmap'ing + * offset, we use it to 'hide' the videocore handle/address. + */ +@@ -2282,8 +2238,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + file_data->restart_sys = 0; + } + +- /* Now process the command. +- */ ++ /* Now process the command. */ + switch (cmdnr) { + /* New memory allocation. + */ +@@ -2291,8 +2246,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { + struct vmcs_sm_ioctl_alloc ioparam; + +- /* Get the parameter data. +- */ ++ /* Get the parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2314,20 +2268,17 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; + +- /* Share existing memory allocation. +- */ ++ /* Share existing memory allocation. */ + case VMCS_SM_CMD_ALLOC_SHARE: + { + struct vmcs_sm_ioctl_alloc_share ioparam; + +- /* Get the parameter data. +- */ ++ /* Get the parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2338,8 +2289,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + ret = vc_sm_ioctl_alloc_share(file_data, &ioparam); + +- /* Copy result back to user. +- */ ++ /* Copy result back to user. */ + if (!ret + && copy_to_user((void *)arg, &ioparam, + sizeof(ioparam)) != 0) { +@@ -2352,8 +2302,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; +@@ -2362,8 +2311,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { + struct vmcs_sm_ioctl_import_dmabuf ioparam; + +- /* Get the parameter data. +- */ ++ /* Get the parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2386,21 +2334,18 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; + +- /* Lock (attempt to) *and* register a cache behavior change. +- */ ++ /* Lock (attempt to) *and* register a cache behavior change. */ + case VMCS_SM_CMD_LOCK_CACHE: + { + struct vmcs_sm_ioctl_lock_cache ioparam; + struct vmcs_sm_ioctl_lock_unlock lock; + +- /* Get parameter data. +- */ ++ /* Get parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2414,20 +2359,17 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + vc_sm_ioctl_lock(file_data, &lock, 1, + ioparam.cached, 0); + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; + +- /* Lock (attempt to) existing memory allocation. +- */ ++ /* Lock (attempt to) existing memory allocation. */ + case VMCS_SM_CMD_LOCK: + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + +- /* Get parameter data. +- */ ++ /* Get parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2438,8 +2380,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + ret = vc_sm_ioctl_lock(file_data, &ioparam, 0, 0, 0); + +- /* Copy result back to user. +- */ ++ /* Copy result back to user. */ + if (copy_to_user((void *)arg, &ioparam, sizeof(ioparam)) + != 0) { + pr_err("[%s]: failed to copy-to-user for cmd %x\n", +@@ -2447,20 +2388,17 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; + +- /* Unlock (attempt to) existing memory allocation. +- */ ++ /* Unlock (attempt to) existing memory allocation. */ + case VMCS_SM_CMD_UNLOCK: + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + +- /* Get parameter data. +- */ ++ /* Get parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2471,20 +2409,17 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + ret = vc_sm_ioctl_unlock(file_data, &ioparam, 0, 1, 0); + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; + +- /* Resize (attempt to) existing memory allocation. +- */ ++ /* Resize (attempt to) existing memory allocation. */ + case VMCS_SM_CMD_RESIZE: + { + struct vmcs_sm_ioctl_resize ioparam; + +- /* Get parameter data. +- */ ++ /* Get parameter data. */ + if (copy_from_user + (&ioparam, (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2495,17 +2430,13 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + ret = vc_sm_ioctl_resize(file_data, &ioparam); + +- /* Copy result back to user. +- */ ++ /* Copy result back to user. */ + if (copy_to_user((void *)arg, &ioparam, sizeof(ioparam)) + != 0) { + pr_err("[%s]: failed to copy-to-user for cmd %x\n", + __func__, cmdnr); + ret = -EFAULT; + } +- +- /* Done. +- */ + goto out; + } + break; +@@ -2550,7 +2481,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + goto out; + } + break; +-/* Walk mapping table on host, information shows up in the ++ /* Walk mapping table on host, information shows up in the + ** kernel log. + */ + case VMCS_SM_CMD_HOST_WALK_MAP: +@@ -2589,7 +2520,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { + struct vmcs_sm_ioctl_walk ioparam; + +- /* Get parameter data. */ ++ /* Get parameter data. */ + if (copy_from_user(&ioparam, + (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2646,8 +2577,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { + struct vmcs_sm_ioctl_chk ioparam; + +- /* Get parameter data. +- */ ++ /* Get parameter data. */ + if (copy_from_user(&ioparam, + (void *)arg, sizeof(ioparam)) != 0) { + pr_err("[%s]: failed to copy-from-user for cmd %x\n", +@@ -2662,7 +2592,8 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + vmcs_sm_acquire_resource(file_data, ioparam.handle); + if (resource == NULL) + ret = -EINVAL; +- /* If the resource is cacheable, return additional ++ /* ++ * If the resource is cacheable, return additional + * information that may be needed to flush the cache. + */ + else if ((resource->res_cached == VMCS_SM_CACHE_HOST) || +@@ -2688,8 +2619,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; +@@ -2768,8 +2698,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + } + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; +@@ -2851,8 +2780,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + break; + +- /* Maps a user address given process and vc handle. +- */ ++ /* Maps a user address given process and vc handle. */ + case VMCS_SM_CMD_MAPPED_USR_ADDRESS: + { + struct vmcs_sm_ioctl_map ioparam; +@@ -2955,8 +2883,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + goto out; + } + +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = + vmcs_sm_acquire_resource(file_data, ioparam.handle); + +@@ -2992,8 +2919,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + if (resource) + vmcs_sm_release_resource(resource, 0); + +- /* Done. +- */ ++ /* Done. */ + goto out; + } + break; +@@ -3019,8 +2945,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + case 2: /* L1/L2 clean physical range */ + case 3: /* L1/L2 clean+invalidate all */ + { +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = + vmcs_sm_acquire_resource(file_data, ioparam.s[i].handle); + +@@ -3123,8 +3048,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + return ret; + } + +-/* Device operations that we managed in this driver. +-*/ ++/* Device operations that we managed in this driver. */ + static const struct file_operations vmcs_sm_ops = { + .owner = THIS_MODULE, + .unlocked_ioctl = vc_sm_ioctl, +@@ -3133,8 +3057,7 @@ static const struct file_operations vmcs_sm_ops = { + .mmap = vc_sm_mmap, + }; + +-/* Creation of device. +-*/ ++/* Creation of device. */ + static int vc_sm_create_sharedmemory(void) + { + int ret; +@@ -3144,8 +3067,7 @@ static int vc_sm_create_sharedmemory(void) + goto out; + } + +- /* Create a device class for creating dev nodes. +- */ ++ /* Create a device class for creating dev nodes. */ + sm_state->sm_class = class_create(THIS_MODULE, "vc-sm"); + if (IS_ERR(sm_state->sm_class)) { + pr_err("[%s]: unable to create device class\n", __func__); +@@ -3153,8 +3075,7 @@ static int vc_sm_create_sharedmemory(void) + goto out; + } + +- /* Create a character driver. +- */ ++ /* Create a character driver. */ + ret = alloc_chrdev_region(&sm_state->sm_devid, + DEVICE_MINOR, 1, DEVICE_NAME); + if (ret != 0) { +@@ -3169,8 +3090,7 @@ static int vc_sm_create_sharedmemory(void) + goto out_chrdev_unreg; + } + +- /* Create a device node. +- */ ++ /* Create a device node. */ + sm_state->sm_dev = device_create(sm_state->sm_class, + NULL, + MKDEV(MAJOR(sm_state->sm_devid), +@@ -3195,25 +3115,21 @@ static int vc_sm_create_sharedmemory(void) + return ret; + } + +-/* Termination of the device. +-*/ ++/* Termination of the device. */ + static int vc_sm_remove_sharedmemory(void) + { + int ret; + + if (sm_state == NULL) { +- /* Nothing to do. +- */ ++ /* Nothing to do. */ + ret = 0; + goto out; + } + +- /* Remove the sharedmemory character driver. +- */ ++ /* Remove the sharedmemory character driver. */ + cdev_del(&sm_state->sm_cdev); + +- /* Unregister region. +- */ ++ /* Unregister region. */ + unregister_chrdev_region(sm_state->sm_devid, 1); + + ret = 0; +@@ -3232,8 +3148,9 @@ static void vc_sm_connected_init(void) + + pr_info("[%s]: start\n", __func__); + +- /* Initialize and create a VCHI connection for the shared memory service +- ** running on videocore. ++ /* ++ * Initialize and create a VCHI connection for the shared memory service ++ * running on videocore. + */ + ret = vchi_initialise(&vchi_instance); + if (ret != 0) { +@@ -3306,8 +3223,7 @@ static void vc_sm_connected_init(void) + goto err_remove_shared_memory; + } + +- /* Done! +- */ ++ /* Done! */ + sm_inited = 1; + goto out; + +@@ -3344,20 +3260,16 @@ static int bcm2835_vcsm_remove(struct platform_device *pdev) + { + pr_debug("[%s]: start\n", __func__); + if (sm_inited) { +- /* Remove shared memory device. +- */ ++ /* Remove shared memory device. */ + vc_sm_remove_sharedmemory(); + +- /* Remove all proc entries. +- */ ++ /* Remove all proc entries. */ + debugfs_remove_recursive(sm_state->dir_root); + +- /* Stop the videocore shared memory service. +- */ ++ /* Stop the videocore shared memory service. */ + vc_vchi_sm_stop(&sm_state->sm_handle); + +- /* Free the memory for the state structure. +- */ ++ /* Free the memory for the state structure. */ + mutex_destroy(&(sm_state->map_lock)); + kfree(sm_state); + } +@@ -3374,8 +3286,7 @@ int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle) + int ret; + struct SM_RESOURCE_T *resource; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || alloc == NULL || handle == NULL) { + pr_err("[%s]: invalid input\n", __func__); + return -EPERM; +@@ -3396,8 +3307,7 @@ int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle) + resource->pid = 0; + vmcs_sm_release_resource(resource, 0); + +- /* Assign valid handle at this time. +- */ ++ /* Assign valid handle at this time. */ + *handle = ioparam.handle; + } else { + ret = -ENOMEM; +@@ -3408,22 +3318,19 @@ int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle) + } + EXPORT_SYMBOL_GPL(vc_sm_alloc); + +-/* Get an internal resource handle mapped from the external one. +-*/ ++/* Get an internal resource handle mapped from the external one. */ + int vc_sm_int_handle(int handle) + { + struct SM_RESOURCE_T *resource; + int ret = 0; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || handle == 0) { + pr_err("[%s]: invalid input\n", __func__); + return 0; + } + +- /* Locate resource from GUID. +- */ ++ /* Locate resource from GUID. */ + resource = vmcs_sm_acquire_resource(sm_state->data_knl, handle); + if (resource) { + ret = resource->res_handle; +@@ -3434,14 +3341,12 @@ int vc_sm_int_handle(int handle) + } + EXPORT_SYMBOL_GPL(vc_sm_int_handle); + +-/* Free a previously allocated shared memory handle and block. +-*/ ++/* Free a previously allocated shared memory handle and block. */ + int vc_sm_free(int handle) + { + struct vmcs_sm_ioctl_free ioparam = { handle }; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || handle == 0) { + pr_err("[%s]: invalid input\n", __func__); + return -EPERM; +@@ -3451,16 +3356,14 @@ int vc_sm_free(int handle) + } + EXPORT_SYMBOL_GPL(vc_sm_free); + +-/* Lock a memory handle for use by kernel. +-*/ ++/* Lock a memory handle for use by kernel. */ + int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, + long unsigned int *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + int ret; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || handle == 0 || data == NULL) { + pr_err("[%s]: invalid input\n", __func__); + return -EPERM; +@@ -3481,14 +3384,12 @@ int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, + } + EXPORT_SYMBOL_GPL(vc_sm_lock); + +-/* Unlock a memory handle in use by kernel. +-*/ ++/* Unlock a memory handle in use by kernel. */ + int vc_sm_unlock(int handle, int flush, int no_vc_unlock) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || handle == 0) { + pr_err("[%s]: invalid input\n", __func__); + return -EPERM; +@@ -3500,16 +3401,14 @@ int vc_sm_unlock(int handle, int flush, int no_vc_unlock) + } + EXPORT_SYMBOL_GPL(vc_sm_unlock); + +-/* Map a shared memory region for use by kernel. +-*/ ++/* Map a shared memory region for use by kernel. */ + int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, + long unsigned int *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + int ret; + +- /* Validate we can work with this device. +- */ ++ /* Validate we can work with this device. */ + if (sm_state == NULL || handle == 0 || data == NULL || sm_addr == 0) { + pr_err("[%s]: invalid input\n", __func__); + return -EPERM; + +From a7af6c217b1855cd92df6f74399504eecb3231a6 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:29:37 +0100 +Subject: [PATCH 352/407] vcsm: Fix indentation of switch/case statement. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 53 ++++++++++++++++++----------------- + 1 file changed, 27 insertions(+), 26 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 4680d8a9f5acb99a4c4a400ac589c57f8061a615..ac49776a74b7b3aeebf8a35980d871708311690e 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2940,33 +2940,34 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + for (i=0; ires_cached) { +- unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); +- unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); +- +- resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; +- +- /* L1/L2 cache flush */ +- down_read(¤t->mm->mmap_sem); +- vcsm_vma_cache_clean_page_range(base, end); +- up_read(¤t->mm->mmap_sem); +- } else if (resource == NULL) { +- ret = -EINVAL; +- goto out; +- } +- +- if (resource) +- vmcs_sm_release_resource(resource, 0); ++ default: ++ case 0: ++ break; /* NOOP */ ++ case 1: /* L1/L2 invalidate virtual range */ ++ case 2: /* L1/L2 clean physical range */ ++ case 3: /* L1/L2 clean+invalidate all */ ++ /* Locate resource from GUID. */ ++ resource = ++ vmcs_sm_acquire_resource(file_data, ioparam.s[i].handle); ++ ++ if ((resource != NULL) && resource->res_cached) { ++ unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); ++ unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); ++ ++ resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; ++ ++ /* L1/L2 cache flush */ ++ down_read(¤t->mm->mmap_sem); ++ vcsm_vma_cache_clean_page_range(base, end); ++ up_read(¤t->mm->mmap_sem); ++ } else if (resource == NULL) { ++ ret = -EINVAL; ++ goto out; + } ++ ++ if (resource) ++ vmcs_sm_release_resource(resource, 0); ++ + break; + } + } + +From d4879613611d9c4dee44514b195a9d4670dec407 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:24:48 +0100 +Subject: [PATCH 353/407] vcsm: Fix spaces around operators. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index ac49776a74b7b3aeebf8a35980d871708311690e..863675727bb7258ed4d13570f602c13b942da0d3 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2938,7 +2938,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + goto out; + } +- for (i=0; ires_cached) { +- unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE-1); +- unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE-1) & ~(PAGE_SIZE-1); ++ unsigned long base = ioparam.s[i].addr & ~(PAGE_SIZE - 1); ++ unsigned long end = (ioparam.s[i].addr + ioparam.s[i].size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1); + +- resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; ++ resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID : FLUSH]++; + + /* L1/L2 cache flush */ + down_read(¤t->mm->mmap_sem); +@@ -3001,7 +3001,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + goto out; + } + +- for (i=0; iblock_count; ++j) { + +From d762acb7217048c7b7135d34c3eb103c609d5501 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:33:49 +0100 +Subject: [PATCH 354/407] vcsm: Fix use of S_IRUGO and use 0444 instead + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 863675727bb7258ed4d13570f602c13b942da0d3..c8df7c80596038c3d1f03af3b17095b9b50238c8 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -1047,7 +1047,7 @@ static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) + } else { + struct dentry *dir_entry; + +- dir_entry = debugfs_create_file(VC_SM_RESOURCES, S_IRUGO, ++ dir_entry = debugfs_create_file(VC_SM_RESOURCES, 0444, + file_data->dir_pid, file_data, + vc_sm_debug_fs_fops); + +@@ -1055,7 +1055,7 @@ static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) + file_data->dir_res.priv_data = file_data; + file_data->dir_res.show = &vc_sm_alloc_show; + +- dir_entry = debugfs_create_file(VC_SM_STATS, S_IRUGO, ++ dir_entry = debugfs_create_file(VC_SM_STATS, 0444, + file_data->dir_pid, file_data, + vc_sm_debug_fs_fops); + +@@ -3194,12 +3194,12 @@ static void vc_sm_connected_init(void) + + sm_state->dir_state.show = &vc_sm_global_state_show; + sm_state->dir_state.dir_entry = debugfs_create_file(VC_SM_STATE, +- S_IRUGO, sm_state->dir_root, &sm_state->dir_state, ++ 0444, sm_state->dir_root, &sm_state->dir_state, + &vc_sm_debug_fs_fops); + + sm_state->dir_stats.show = &vc_sm_global_statistics_show; + sm_state->dir_stats.dir_entry = debugfs_create_file(VC_SM_STATS, +- S_IRUGO, sm_state->dir_root, &sm_state->dir_stats, ++ 0444, sm_state->dir_root, &sm_state->dir_stats, + &vc_sm_debug_fs_fops); + + /* Create the proc entry children. */ + +From 997a4b8b985528c3da9e2af08d97552c81f27db6 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:36:11 +0100 +Subject: [PATCH 355/407] vcsm: Correct "long unsigned int" to "unsigned long" + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 4 ++-- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 16 ++++++++-------- + 2 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index 8252d13999a78609fcc7e1bbe83307e2b1c1f8f1..8538f618ffd33b2901d220f3fb755aae6001e6d7 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -36,7 +36,7 @@ int vc_sm_free(int handle); + + /* Lock a memory handle for use by kernel. */ + int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, +- long unsigned int *data); ++ unsigned long *data); + + /* Unlock a memory handle in use by kernel. */ + int vc_sm_unlock(int handle, int flush, int no_vc_unlock); +@@ -46,7 +46,7 @@ int vc_sm_int_handle(int handle); + + /* Map a shared memory region for use by kernel. */ + int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, +- long unsigned int *data); ++ unsigned long *data); + + /* Import a block of memory into the GPU space. */ + int vc_sm_import_dmabuf(struct dma_buf *dmabuf, int *handle); +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index c8df7c80596038c3d1f03af3b17095b9b50238c8..01da0badd8afe58d8c2570efcd26c77893f14490 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -118,7 +118,7 @@ struct sm_mmap { + unsigned int res_vc_hdl; /* Resource handle (videocore). */ + unsigned int res_usr_hdl; /* Resource handle (user). */ + +- long unsigned int res_addr; /* Mapped virtual address. */ ++ unsigned long res_addr; /* Mapped virtual address. */ + struct vm_area_struct *vma; /* VM area for this mapping. */ + unsigned int ref_count; /* Reference count to this vma. */ + +@@ -1383,7 +1383,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + map->res_pid = current->tgid; + map->res_vc_hdl = resource->res_handle; + map->res_usr_hdl = resource->res_guid; +- map->res_addr = (long unsigned int)vma->vm_start; ++ map->res_addr = (unsigned long)vma->vm_start; + map->resource = resource; + map->vma = vma; + vmcs_sm_add_map(sm_state, resource, map); +@@ -1743,7 +1743,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + struct SM_RESOURCE_T *resource; + int ret = 0; + struct sm_mmap *map, *map_tmp; +- long unsigned int phys_addr; ++ unsigned long phys_addr; + + map = NULL; + +@@ -1859,7 +1859,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + phys_addr += mm_vc_mem_phys_addr; + if (resource->res_cached + == VMCS_SM_CACHE_HOST) { +- ioparam->addr = (long unsigned int) ++ ioparam->addr = (unsigned long) + /* TODO - make cached work */ + ioremap_nocache(phys_addr, + resource->res_size); +@@ -1868,7 +1868,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + __func__, ioparam->handle, + lock.res_handle, ioparam->addr); + } else { +- ioparam->addr = (long unsigned int) ++ ioparam->addr = (unsigned long) + ioremap_nocache(phys_addr, + resource->res_size); + +@@ -1995,7 +1995,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + if (flush && + (resource->res_cached == + VMCS_SM_CACHE_HOST)) { +- long unsigned int ++ unsigned long + phys_addr; + phys_addr = (uint32_t) + resource->res_base_mem & 0x3FFFFFFF; +@@ -3359,7 +3359,7 @@ EXPORT_SYMBOL_GPL(vc_sm_free); + + /* Lock a memory handle for use by kernel. */ + int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, +- long unsigned int *data) ++ unsigned long *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + int ret; +@@ -3404,7 +3404,7 @@ EXPORT_SYMBOL_GPL(vc_sm_unlock); + + /* Map a shared memory region for use by kernel. */ + int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, +- long unsigned int *data) ++ unsigned long *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + int ret; + +From a7bea57255869deb48213d9f7d9b5bee609bc142 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:38:27 +0100 +Subject: [PATCH 356/407] vcsm: Fix "struct vm_operations_struct should + normally be const" + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 01da0badd8afe58d8c2570efcd26c77893f14490..4a1b22fe2ced80e909c1f7a5f0038b8c4b8c6bb3 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -1248,7 +1248,7 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + } + } + +-static struct vm_operations_struct vcsm_vm_ops = { ++static const struct vm_operations_struct vcsm_vm_ops = { + .open = vcsm_vma_open, + .close = vcsm_vma_close, + .fault = vcsm_vma_fault, + +From 4f52fc305b45c21091c26e0e845056b57b485c46 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:45:34 +0100 +Subject: [PATCH 357/407] vcsm: Fix "void function return statements are not + generally useful" + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 4a1b22fe2ced80e909c1f7a5f0038b8c4b8c6bb3..32333c6c23c1ecedc465289d2d416d9c083a823b 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -984,8 +984,6 @@ static void vmcs_sm_host_walk_map_per_pid(int pid) + } + + mutex_unlock(&(sm_state->map_lock)); +- +- return; + } + + /* +@@ -1015,8 +1013,6 @@ static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) + } + + mutex_unlock(&(sm_state->map_lock)); +- +- return; + } + + /* Create support for private data tracking. */ + +From 0eb9aac72b9b1d1ae8b4e8a2c76cf5c44f986e67 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:47:32 +0100 +Subject: [PATCH 358/407] vcsm: Fix "Prefer kcalloc over kzalloc with multiply" + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 32333c6c23c1ecedc465289d2d416d9c083a823b..a18407d111c471878c07936b56425a16f4fdf81f 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2984,7 +2984,9 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + goto out; + } +- block = kzalloc(ioparam.op_count * sizeof(struct vmcs_sm_ioctl_clean_invalid_block), GFP_KERNEL); ++ block = kcalloc(ioparam.op_count, ++ sizeof(struct vmcs_sm_ioctl_clean_invalid_block), ++ GFP_KERNEL); + if (!block) { + ret = -EFAULT; + goto out; + +From 207b09d9b1761953cfd31055f33a377e21390ebc Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 Sep 2017 17:55:07 +0100 +Subject: [PATCH 359/407] vcsm: Remove VC_SM_LOCK_CACHE_MODE_T typedef. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 11 +++++------ + drivers/char/broadcom/vc_sm/vmcs_sm.c | 6 +++--- + 2 files changed, 8 insertions(+), 9 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index 8538f618ffd33b2901d220f3fb755aae6001e6d7..f7f74750d8358779c61dfcd6fc841aa1789a2c5e 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -22,11 +22,10 @@ + #endif + + /* Type of memory to be locked (ie mapped) */ +-typedef enum { ++enum vc_sm_lock_cache_mode { + VC_SM_LOCK_CACHED, + VC_SM_LOCK_NON_CACHED, +- +-} VC_SM_LOCK_CACHE_MODE_T; ++}; + + /* Allocate a shared memory handle and block. */ + int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle); +@@ -35,7 +34,7 @@ int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle); + int vc_sm_free(int handle); + + /* Lock a memory handle for use by kernel. */ +-int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, ++int vc_sm_lock(int handle, enum vc_sm_lock_cache_mode mode, + unsigned long *data); + + /* Unlock a memory handle in use by kernel. */ +@@ -45,8 +44,8 @@ int vc_sm_unlock(int handle, int flush, int no_vc_unlock); + int vc_sm_int_handle(int handle); + + /* Map a shared memory region for use by kernel. */ +-int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, +- unsigned long *data); ++int vc_sm_map(int handle, unsigned int sm_addr, ++ enum vc_sm_lock_cache_mode mode, unsigned long *data); + + /* Import a block of memory into the GPU space. */ + int vc_sm_import_dmabuf(struct dma_buf *dmabuf, int *handle); +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index a18407d111c471878c07936b56425a16f4fdf81f..2ad5ecbccf30df6738da913d47b85262c7238d59 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -3356,7 +3356,7 @@ int vc_sm_free(int handle) + EXPORT_SYMBOL_GPL(vc_sm_free); + + /* Lock a memory handle for use by kernel. */ +-int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, ++int vc_sm_lock(int handle, enum vc_sm_lock_cache_mode mode, + unsigned long *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; +@@ -3401,8 +3401,8 @@ int vc_sm_unlock(int handle, int flush, int no_vc_unlock) + EXPORT_SYMBOL_GPL(vc_sm_unlock); + + /* Map a shared memory region for use by kernel. */ +-int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, +- unsigned long *data) ++int vc_sm_map(int handle, unsigned int sm_addr, ++ enum vc_sm_lock_cache_mode mode, unsigned long *data) + { + struct vmcs_sm_ioctl_lock_unlock ioparam; + int ret; + +From 2b9e1004e2e92fb804aea7e02227ed4abbb9a80f Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 5 Sep 2017 10:12:21 +0100 +Subject: [PATCH 360/407] vcsm: Replace SM_RESOURCE_T with sm_resource_t + +Follow the Linux kernel coding style. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 66 +++++++++++++++++------------------ + 1 file changed, 33 insertions(+), 33 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 2ad5ecbccf30df6738da913d47b85262c7238d59..ea4fcd787f6b7f527aa323a06554be8557c6e6ae 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -112,7 +112,7 @@ struct SM_PDE_T { + struct sm_mmap { + struct list_head map_list; /* Linked list of maps. */ + +- struct SM_RESOURCE_T *resource; /* Pointer to the resource. */ ++ struct sm_resource_t *resource; /* Pointer to the resource. */ + + pid_t res_pid; /* PID owning that resource. */ + unsigned int res_vc_hdl; /* Resource handle (videocore). */ +@@ -127,7 +127,7 @@ struct sm_mmap { + }; + + /* Single resource allocation tracked for each opened device. */ +-struct SM_RESOURCE_T { ++struct sm_resource_t { + struct list_head resource_list; /* List of resources. */ + struct list_head global_resource_list; /* Global list of resources. */ + +@@ -140,7 +140,7 @@ struct SM_RESOURCE_T { + void *res_base_mem; /* Resource base memory address. */ + uint32_t res_size; /* Resource size allocated. */ + enum vmcs_sm_cache_e res_cached; /* Resource cache type. */ +- struct SM_RESOURCE_T *res_shared; /* Shared resource */ ++ struct sm_resource_t *res_shared; /* Shared resource */ + + enum SM_STATS_T res_stats[END_ALL]; /* Resource statistics. */ + +@@ -235,7 +235,7 @@ static inline unsigned int vcaddr_to_pfn(unsigned long vc_addr) + * Carries over to the state statistics the statistics once owned by a deceased + * resource. + */ +-static void vc_sm_resource_deceased(struct SM_RESOURCE_T *p_res, int terminated) ++static void vc_sm_resource_deceased(struct sm_resource_t *p_res, int terminated) + { + if (sm_state != NULL) { + if (p_res != NULL) { +@@ -460,7 +460,7 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + + /* Adds a resource mapping to the global data list. */ + static void vmcs_sm_add_map(struct SM_STATE_T *state, +- struct SM_RESOURCE_T *resource, struct sm_mmap *map) ++ struct sm_resource_t *resource, struct sm_mmap *map) + { + mutex_lock(&(state->map_lock)); + +@@ -480,7 +480,7 @@ static void vmcs_sm_add_map(struct SM_STATE_T *state, + + /* Removes a resource mapping from the global data list. */ + static void vmcs_sm_remove_map(struct SM_STATE_T *state, +- struct SM_RESOURCE_T *resource, ++ struct sm_resource_t *resource, + struct sm_mmap *map) + { + mutex_lock(&(state->map_lock)); +@@ -506,7 +506,7 @@ static void vmcs_sm_remove_map(struct SM_STATE_T *state, + static int vc_sm_global_state_show(struct seq_file *s, void *v) + { + struct sm_mmap *map = NULL; +- struct SM_RESOURCE_T *resource = NULL; ++ struct sm_resource_t *resource = NULL; + int map_count = 0; + int resource_count = 0; + +@@ -634,7 +634,7 @@ static int vc_sm_statistics_show(struct seq_file *s, void *v) + { + int ix; + struct SM_PRIV_DATA_T *file_data; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int res_count = 0; + struct SM_PDE_T *p_pde; + +@@ -691,7 +691,7 @@ static int vc_sm_statistics_show(struct seq_file *s, void *v) + static int vc_sm_alloc_show(struct seq_file *s, void *v) + { + struct SM_PRIV_DATA_T *file_data; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int alloc_count = 0; + struct SM_PDE_T *p_pde; + +@@ -765,7 +765,7 @@ static const struct file_operations vc_sm_debug_fs_fops = { + * data. + */ + static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, +- struct SM_RESOURCE_T *resource) ++ struct sm_resource_t *resource) + { + mutex_lock(&(sm_state->map_lock)); + list_add(&resource->resource_list, &privdata->resource_list); +@@ -781,11 +781,11 @@ static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, + * Locates a resource and acquire a reference on it. + * The resource won't be deleted while there is a reference on it. + */ +-static struct SM_RESOURCE_T *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T ++static struct sm_resource_t *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T + *private, + unsigned int res_guid) + { +- struct SM_RESOURCE_T *resource, *ret = NULL; ++ struct sm_resource_t *resource, *ret = NULL; + + mutex_lock(&(sm_state->map_lock)); + +@@ -811,10 +811,10 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T + * Locates a resource and acquire a reference on it. + * The resource won't be deleted while there is a reference on it. + */ +-static struct SM_RESOURCE_T *vmcs_sm_acquire_first_resource( ++static struct sm_resource_t *vmcs_sm_acquire_first_resource( + struct SM_PRIV_DATA_T *private) + { +- struct SM_RESOURCE_T *resource, *ret = NULL; ++ struct sm_resource_t *resource, *ret = NULL; + + mutex_lock(&(sm_state->map_lock)); + +@@ -837,10 +837,10 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_first_resource( + * Locates a resource and acquire a reference on it. + * The resource won't be deleted while there is a reference on it. + */ +-static struct SM_RESOURCE_T *vmcs_sm_acquire_global_resource(unsigned int ++static struct sm_resource_t *vmcs_sm_acquire_global_resource(unsigned int + res_guid) + { +- struct SM_RESOURCE_T *resource, *ret = NULL; ++ struct sm_resource_t *resource, *ret = NULL; + + mutex_lock(&(sm_state->map_lock)); + +@@ -867,11 +867,11 @@ static struct SM_RESOURCE_T *vmcs_sm_acquire_global_resource(unsigned int + * Release a previously acquired resource. + * The resource will be deleted when its refcount reaches 0. + */ +-static void vmcs_sm_release_resource(struct SM_RESOURCE_T *resource, int force) ++static void vmcs_sm_release_resource(struct sm_resource_t *resource, int force) + { + struct SM_PRIV_DATA_T *private = resource->private; + struct sm_mmap *map, *map_tmp; +- struct SM_RESOURCE_T *res_tmp; ++ struct sm_resource_t *res_tmp; + int ret; + + mutex_lock(&(sm_state->map_lock)); +@@ -992,7 +992,7 @@ static void vmcs_sm_host_walk_map_per_pid(int pid) + */ + static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) + { +- struct SM_RESOURCE_T *resource = NULL; ++ struct sm_resource_t *resource = NULL; + + /* Make sure the device was started properly. */ + if ((sm_state == NULL) || (file_data == NULL)) { +@@ -1101,7 +1101,7 @@ static int vc_sm_release(struct inode *inode, struct file *file) + { + struct SM_PRIV_DATA_T *file_data = + (struct SM_PRIV_DATA_T *)file->private_data; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int ret = 0; + + /* Make sure the device was started properly. */ +@@ -1170,7 +1170,7 @@ static void vcsm_vma_close(struct vm_area_struct *vma) + static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) + { + struct sm_mmap *map = (struct sm_mmap *)vma->vm_private_data; +- struct SM_RESOURCE_T *resource = map->resource; ++ struct sm_resource_t *resource = map->resource; + pgoff_t page_offset; + unsigned long pfn; + int ret = 0; +@@ -1313,7 +1313,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + int ret = 0; + struct SM_PRIV_DATA_T *file_data = + (struct SM_PRIV_DATA_T *)file->private_data; +- struct SM_RESOURCE_T *resource = NULL; ++ struct sm_resource_t *resource = NULL; + struct sm_mmap *map = NULL; + + /* Make sure the device was started properly. */ +@@ -1449,7 +1449,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + { + int ret = 0; + int status; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + struct vc_sm_alloc_t alloc = { 0 }; + struct vc_sm_alloc_result_t result = { 0 }; + enum vmcs_sm_cache_e cached = ioparam->cached; +@@ -1558,7 +1558,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_alloc_share *ioparam) + { +- struct SM_RESOURCE_T *resource, *shared_resource; ++ struct sm_resource_t *resource, *shared_resource; + int ret = 0; + + pr_debug("[%s]: attempt to share resource %u\n", __func__, +@@ -1620,7 +1620,7 @@ int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, + struct vmcs_sm_ioctl_free *ioparam) + { +- struct SM_RESOURCE_T *resource = ++ struct sm_resource_t *resource = + vmcs_sm_acquire_resource(private, ioparam->handle); + + if (resource == NULL) { +@@ -1649,7 +1649,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + int ret = 0; + int status; + struct vc_sm_resize_t resize; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + + /* Locate resource from GUID. */ + resource = vmcs_sm_acquire_resource(private, ioparam->handle); +@@ -1736,7 +1736,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + int status; + struct vc_sm_lock_unlock_t lock; + struct vc_sm_lock_result_t result; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int ret = 0; + struct sm_mmap *map, *map_tmp; + unsigned long phys_addr; +@@ -1901,7 +1901,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + int status; + struct vc_sm_lock_unlock_t unlock; + struct sm_mmap *map, *map_tmp; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int ret = 0; + + map = NULL; +@@ -2077,7 +2077,7 @@ int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, + { + int ret = 0; + int status; +- struct SM_RESOURCE_T *resource = NULL; ++ struct sm_resource_t *resource = NULL; + struct vc_sm_import import = { 0 }; + struct vc_sm_import_result result = { 0 }; + struct dma_buf *dma_buf; +@@ -2206,7 +2206,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + unsigned int cmdnr = _IOC_NR(cmd); + struct SM_PRIV_DATA_T *file_data = + (struct SM_PRIV_DATA_T *)file->private_data; +- struct SM_RESOURCE_T *resource = NULL; ++ struct sm_resource_t *resource = NULL; + + /* Validate we can work with this device. */ + if ((sm_state == NULL) || (file_data == NULL)) { +@@ -3283,7 +3283,7 @@ int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle) + { + struct vmcs_sm_ioctl_alloc ioparam = { 0 }; + int ret; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + + /* Validate we can work with this device. */ + if (sm_state == NULL || alloc == NULL || handle == NULL) { +@@ -3320,7 +3320,7 @@ EXPORT_SYMBOL_GPL(vc_sm_alloc); + /* Get an internal resource handle mapped from the external one. */ + int vc_sm_int_handle(int handle) + { +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + int ret = 0; + + /* Validate we can work with this device. */ +@@ -3433,7 +3433,7 @@ int vc_sm_import_dmabuf(struct dma_buf *dmabuf, int *handle) + { + struct vmcs_sm_ioctl_import_dmabuf ioparam = { 0 }; + int ret; +- struct SM_RESOURCE_T *resource; ++ struct sm_resource_t *resource; + + /* Validate we can work with this device. */ + if (!sm_state || !dmabuf || !handle) { + +From c75d3aa54a2afd543aa9ae1b6771c09642b497d0 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 5 Sep 2017 10:15:25 +0100 +Subject: [PATCH 361/407] vcsm: Replace SM_STATS_T with sm_stats_t + +Follows the kernel coding style + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index ea4fcd787f6b7f527aa323a06554be8557c6e6ae..a27a5e9d4cb93f6f9f5268fcffe669094291443f 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -62,7 +62,7 @@ + #define VC_SM_WRITE_BUF_SIZE 128 + + /* Statistics tracked per resource and globally. */ +-enum SM_STATS_T { ++enum sm_stats_t { + /* Attempt. */ + ALLOC, + FREE, +@@ -142,7 +142,7 @@ struct sm_resource_t { + enum vmcs_sm_cache_e res_cached; /* Resource cache type. */ + struct sm_resource_t *res_shared; /* Shared resource */ + +- enum SM_STATS_T res_stats[END_ALL]; /* Resource statistics. */ ++ enum sm_stats_t res_stats[END_ALL]; /* Resource statistics. */ + + uint8_t map_count; /* Counter of mappings for this resource. */ + struct list_head map_list; /* Maps associated with a resource. */ +@@ -187,8 +187,8 @@ struct SM_STATE_T { + struct list_head map_list; /* List of maps. */ + struct list_head resource_list; /* List of resources. */ + +- enum SM_STATS_T deceased[END_ALL]; /* Natural termination stats. */ +- enum SM_STATS_T terminated[END_ALL]; /* Forced termination stats. */ ++ enum sm_stats_t deceased[END_ALL]; /* Natural termination stats. */ ++ enum sm_stats_t terminated[END_ALL]; /* Forced termination stats. */ + uint32_t res_deceased_cnt; /* Natural termination counter. */ + uint32_t res_terminated_cnt; /* Forced termination counter. */ + + +From 52b4655802f8dcf507c6cd3ea70b5211eee7a80c Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 5 Sep 2017 10:16:07 +0100 +Subject: [PATCH 362/407] vcsm: Replace SM_STATE_T with sm_state_t + +Follow the Linux kernel coding style + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index a27a5e9d4cb93f6f9f5268fcffe669094291443f..56ab1c8fd6f59274c6223eb30bc159fbd6ce55ec 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -174,7 +174,7 @@ struct SM_PRIV_DATA_T { + }; + + /* Global state information. */ +-struct SM_STATE_T { ++struct sm_state_t { + struct platform_device *pdev; + struct sm_instance *sm_handle; /* Handle for videocore service. */ + struct dentry *dir_root; /* Debug fs entries root. */ +@@ -206,7 +206,7 @@ struct SM_STATE_T { + + /* ---- Private Variables ----------------------------------------------- */ + +-static struct SM_STATE_T *sm_state; ++static struct sm_state_t *sm_state; + static int sm_inited; + + #if 0 +@@ -459,7 +459,7 @@ static unsigned int vmcs_sm_usr_address_from_pid_and_usr_handle(unsigned int + } + + /* Adds a resource mapping to the global data list. */ +-static void vmcs_sm_add_map(struct SM_STATE_T *state, ++static void vmcs_sm_add_map(struct sm_state_t *state, + struct sm_resource_t *resource, struct sm_mmap *map) + { + mutex_lock(&(state->map_lock)); +@@ -479,7 +479,7 @@ static void vmcs_sm_add_map(struct SM_STATE_T *state, + } + + /* Removes a resource mapping from the global data list. */ +-static void vmcs_sm_remove_map(struct SM_STATE_T *state, ++static void vmcs_sm_remove_map(struct sm_state_t *state, + struct sm_resource_t *resource, + struct sm_mmap *map) + { + +From bfdd4c994f9207413ecb83579f8447905495e7de Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 5 Sep 2017 10:17:18 +0100 +Subject: [PATCH 363/407] vcsm: Replace SM_PRIV_DATA_T with sm_priv_data_t + +Follows the Linux kernel coding style + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 54 +++++++++++++++++------------------ + 1 file changed, 27 insertions(+), 27 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 56ab1c8fd6f59274c6223eb30bc159fbd6ce55ec..fd6a4600326cfcff84ab6ce5b8f7e3852976ae24 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -153,12 +153,12 @@ struct sm_resource_t { + struct sg_table *sgt; + dma_addr_t dma_addr; + +- struct SM_PRIV_DATA_T *private; ++ struct sm_priv_data_t *private; + bool map; /* whether to map pages up front */ + }; + + /* Private file data associated with each opened device. */ +-struct SM_PRIV_DATA_T { ++struct sm_priv_data_t { + struct list_head resource_list; /* List of resources. */ + + pid_t pid; /* PID of creator. */ +@@ -197,7 +197,7 @@ struct sm_state_t { + struct class *sm_class; /* Class. */ + struct device *sm_dev; /* Device. */ + +- struct SM_PRIV_DATA_T *data_knl; /* Kernel internal data tracking. */ ++ struct sm_priv_data_t *data_knl; /* Kernel internal data tracking. */ + + struct mutex lock; /* Global lock. */ + uint32_t guid; /* GUID (next) tracker. */ +@@ -633,13 +633,13 @@ static int vc_sm_global_statistics_show(struct seq_file *s, void *v) + static int vc_sm_statistics_show(struct seq_file *s, void *v) + { + int ix; +- struct SM_PRIV_DATA_T *file_data; ++ struct sm_priv_data_t *file_data; + struct sm_resource_t *resource; + int res_count = 0; + struct SM_PDE_T *p_pde; + + p_pde = (struct SM_PDE_T *)(s->private); +- file_data = (struct SM_PRIV_DATA_T *)(p_pde->priv_data); ++ file_data = (struct sm_priv_data_t *)(p_pde->priv_data); + + if (file_data == NULL) + return 0; +@@ -690,13 +690,13 @@ static int vc_sm_statistics_show(struct seq_file *s, void *v) + /* Read callback for the allocation proc entry. */ + static int vc_sm_alloc_show(struct seq_file *s, void *v) + { +- struct SM_PRIV_DATA_T *file_data; ++ struct sm_priv_data_t *file_data; + struct sm_resource_t *resource; + int alloc_count = 0; + struct SM_PDE_T *p_pde; + + p_pde = (struct SM_PDE_T *)(s->private); +- file_data = (struct SM_PRIV_DATA_T *)(p_pde->priv_data); ++ file_data = (struct sm_priv_data_t *)(p_pde->priv_data); + + if (!file_data) + return 0; +@@ -764,7 +764,7 @@ static const struct file_operations vc_sm_debug_fs_fops = { + * Adds a resource to the private data list which tracks all the allocated + * data. + */ +-static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, ++static void vmcs_sm_add_resource(struct sm_priv_data_t *privdata, + struct sm_resource_t *resource) + { + mutex_lock(&(sm_state->map_lock)); +@@ -781,7 +781,7 @@ static void vmcs_sm_add_resource(struct SM_PRIV_DATA_T *privdata, + * Locates a resource and acquire a reference on it. + * The resource won't be deleted while there is a reference on it. + */ +-static struct sm_resource_t *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T ++static struct sm_resource_t *vmcs_sm_acquire_resource(struct sm_priv_data_t + *private, + unsigned int res_guid) + { +@@ -812,7 +812,7 @@ static struct sm_resource_t *vmcs_sm_acquire_resource(struct SM_PRIV_DATA_T + * The resource won't be deleted while there is a reference on it. + */ + static struct sm_resource_t *vmcs_sm_acquire_first_resource( +- struct SM_PRIV_DATA_T *private) ++ struct sm_priv_data_t *private) + { + struct sm_resource_t *resource, *ret = NULL; + +@@ -869,7 +869,7 @@ static struct sm_resource_t *vmcs_sm_acquire_global_resource(unsigned int + */ + static void vmcs_sm_release_resource(struct sm_resource_t *resource, int force) + { +- struct SM_PRIV_DATA_T *private = resource->private; ++ struct sm_priv_data_t *private = resource->private; + struct sm_mmap *map, *map_tmp; + struct sm_resource_t *res_tmp; + int ret; +@@ -990,7 +990,7 @@ static void vmcs_sm_host_walk_map_per_pid(int pid) + * Dump the allocation table from host side point of view. This only dumps the + * data allocated for this process/device referenced by the file_data. + */ +-static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) ++static void vmcs_sm_host_walk_alloc(struct sm_priv_data_t *file_data) + { + struct sm_resource_t *resource = NULL; + +@@ -1016,10 +1016,10 @@ static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *file_data) + } + + /* Create support for private data tracking. */ +-static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) ++static struct sm_priv_data_t *vc_sm_create_priv_data(pid_t id) + { + char alloc_name[32]; +- struct SM_PRIV_DATA_T *file_data = NULL; ++ struct sm_priv_data_t *file_data = NULL; + + /* Allocate private structure. */ + file_data = kzalloc(sizeof(*file_data), GFP_KERNEL); +@@ -1099,8 +1099,8 @@ static int vc_sm_open(struct inode *inode, struct file *file) + */ + static int vc_sm_release(struct inode *inode, struct file *file) + { +- struct SM_PRIV_DATA_T *file_data = +- (struct SM_PRIV_DATA_T *)file->private_data; ++ struct sm_priv_data_t *file_data = ++ (struct sm_priv_data_t *)file->private_data; + struct sm_resource_t *resource; + int ret = 0; + +@@ -1311,8 +1311,8 @@ static void vcsm_vma_cache_clean_page_range(unsigned long addr, + static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + { + int ret = 0; +- struct SM_PRIV_DATA_T *file_data = +- (struct SM_PRIV_DATA_T *)file->private_data; ++ struct sm_priv_data_t *file_data = ++ (struct sm_priv_data_t *)file->private_data; + struct sm_resource_t *resource = NULL; + struct sm_mmap *map = NULL; + +@@ -1444,7 +1444,7 @@ static int vc_sm_mmap(struct file *file, struct vm_area_struct *vma) + } + + /* Allocate a shared memory handle and block. */ +-int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, ++int vc_sm_ioctl_alloc(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_alloc *ioparam) + { + int ret = 0; +@@ -1555,7 +1555,7 @@ int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, + } + + /* Share an allocate memory handle and block.*/ +-int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, ++int vc_sm_ioctl_alloc_share(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_alloc_share *ioparam) + { + struct sm_resource_t *resource, *shared_resource; +@@ -1617,7 +1617,7 @@ int vc_sm_ioctl_alloc_share(struct SM_PRIV_DATA_T *private, + } + + /* Free a previously allocated shared memory handle and block.*/ +-static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, ++static int vc_sm_ioctl_free(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_free *ioparam) + { + struct sm_resource_t *resource = +@@ -1643,7 +1643,7 @@ static int vc_sm_ioctl_free(struct SM_PRIV_DATA_T *private, + } + + /* Resize a previously allocated shared memory handle and block. */ +-static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, ++static int vc_sm_ioctl_resize(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_resize *ioparam) + { + int ret = 0; +@@ -1728,7 +1728,7 @@ static int vc_sm_ioctl_resize(struct SM_PRIV_DATA_T *private, + } + + /* Lock a previously allocated shared memory handle and block. */ +-static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, ++static int vc_sm_ioctl_lock(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_lock_unlock *ioparam, + int change_cache, enum vmcs_sm_cache_e cache_type, + unsigned int vc_addr) +@@ -1894,7 +1894,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private, + } + + /* Unlock a previously allocated shared memory handle and block.*/ +-static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, ++static int vc_sm_ioctl_unlock(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_lock_unlock *ioparam, + int flush, int wait_reply, int no_vc_unlock) + { +@@ -2071,7 +2071,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private, + } + + /* Import a contiguous block of memory to be shared with VC. */ +-int vc_sm_ioctl_import_dmabuf(struct SM_PRIV_DATA_T *private, ++int vc_sm_ioctl_import_dmabuf(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_import_dmabuf *ioparam, + struct dma_buf *src_dma_buf) + { +@@ -2204,8 +2204,8 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + { + int ret = 0; + unsigned int cmdnr = _IOC_NR(cmd); +- struct SM_PRIV_DATA_T *file_data = +- (struct SM_PRIV_DATA_T *)file->private_data; ++ struct sm_priv_data_t *file_data = ++ (struct sm_priv_data_t *)file->private_data; + struct sm_resource_t *resource = NULL; + + /* Validate we can work with this device. */ + +From fe91d2694582d6273af4f6c4660ea3f822f3f03b Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 5 Sep 2017 10:18:33 +0100 +Subject: [PATCH 364/407] vcsm: Replace SM_PDE_T with sm_pde_t + +Follows the Linux kernel coding style + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 22 +++++++++++----------- + 1 file changed, 11 insertions(+), 11 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index fd6a4600326cfcff84ab6ce5b8f7e3852976ae24..0b2d8a2456cfbf8c9f460cf5a10cadcf85e4ead3 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -101,7 +101,7 @@ static const char *const sm_stats_human_read[] = { + }; + + typedef int (*VC_SM_SHOW) (struct seq_file *s, void *v); +-struct SM_PDE_T { ++struct sm_pde_t { + VC_SM_SHOW show; /* Debug fs function hookup. */ + struct dentry *dir_entry; /* Debug fs directory entry. */ + void *priv_data; /* Private data */ +@@ -164,8 +164,8 @@ struct sm_priv_data_t { + pid_t pid; /* PID of creator. */ + + struct dentry *dir_pid; /* Debug fs entries root. */ +- struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ +- struct SM_PDE_T dir_res; /* Debug fs resource sub-tree. */ ++ struct sm_pde_t dir_stats; /* Debug fs entries statistics sub-tree. */ ++ struct sm_pde_t dir_res; /* Debug fs resource sub-tree. */ + + int restart_sys; /* Tracks restart on interrupt. */ + enum vc_sm_msg_type int_action; /* Interrupted action. */ +@@ -179,8 +179,8 @@ struct sm_state_t { + struct sm_instance *sm_handle; /* Handle for videocore service. */ + struct dentry *dir_root; /* Debug fs entries root. */ + struct dentry *dir_alloc; /* Debug fs entries allocations. */ +- struct SM_PDE_T dir_stats; /* Debug fs entries statistics sub-tree. */ +- struct SM_PDE_T dir_state; /* Debug fs entries state sub-tree. */ ++ struct sm_pde_t dir_stats; /* Debug fs entries statistics sub-tree. */ ++ struct sm_pde_t dir_state; /* Debug fs entries state sub-tree. */ + struct dentry *debug; /* Debug fs entries debug. */ + + struct mutex map_lock; /* Global map lock. */ +@@ -636,9 +636,9 @@ static int vc_sm_statistics_show(struct seq_file *s, void *v) + struct sm_priv_data_t *file_data; + struct sm_resource_t *resource; + int res_count = 0; +- struct SM_PDE_T *p_pde; ++ struct sm_pde_t *p_pde; + +- p_pde = (struct SM_PDE_T *)(s->private); ++ p_pde = (struct sm_pde_t *)(s->private); + file_data = (struct sm_priv_data_t *)(p_pde->priv_data); + + if (file_data == NULL) +@@ -693,9 +693,9 @@ static int vc_sm_alloc_show(struct seq_file *s, void *v) + struct sm_priv_data_t *file_data; + struct sm_resource_t *resource; + int alloc_count = 0; +- struct SM_PDE_T *p_pde; ++ struct sm_pde_t *p_pde; + +- p_pde = (struct SM_PDE_T *)(s->private); ++ p_pde = (struct sm_pde_t *)(s->private); + file_data = (struct sm_priv_data_t *)(p_pde->priv_data); + + if (!file_data) +@@ -738,9 +738,9 @@ static int vc_sm_alloc_show(struct seq_file *s, void *v) + + static int vc_sm_seq_file_show(struct seq_file *s, void *v) + { +- struct SM_PDE_T *sm_pde; ++ struct sm_pde_t *sm_pde; + +- sm_pde = (struct SM_PDE_T *)(s->private); ++ sm_pde = (struct sm_pde_t *)(s->private); + + if (sm_pde && sm_pde->show) + sm_pde->show(s, v); + +From f7aed4b7b5f604bddbab5123f2adea943003150d Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 5 Sep 2017 16:24:03 +0100 +Subject: [PATCH 365/407] vcsm: Handle the clean+invalidate case directly + +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 66 +++++++++++++++++++++-------------- + 1 file changed, 39 insertions(+), 27 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 0b2d8a2456cfbf8c9f460cf5a10cadcf85e4ead3..ffbfa204e4837855068c2b8fb90ed61ef1c847a0 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -218,6 +218,32 @@ static const char *const sm_cache_map_vector[] = { + }; + #endif + ++typedef void cache_flush_op_fn(const void *, const void *); ++ ++#if defined(CONFIG_CPU_CACHE_V7) ++extern cache_flush_op_fn v7_dma_inv_range; ++extern cache_flush_op_fn v7_dma_clean_range; ++static cache_flush_op_fn * const flushops[4] = ++{ ++ 0, ++ v7_dma_inv_range, ++ v7_dma_clean_range, ++ v7_dma_flush_range, ++}; ++#elif defined(CONFIG_CPU_CACHE_V6) ++extern cache_flush_op_fn v6_dma_inv_range; ++extern cache_flush_op_fn v6_dma_clean_range; ++static cache_flush_op_fn * const flushops[4] = ++{ ++ 0, ++ v6_dma_inv_range, ++ v6_dma_clean_range, ++ v6_dma_flush_range, ++}; ++#else ++#error Unknown cache config ++#endif ++ + /* ---- Private Function Prototypes -------------------------------------- */ + + /* ---- Private Functions ------------------------------------------------ */ +@@ -2984,7 +3010,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + ret = -EFAULT; + goto out; + } +- block = kcalloc(ioparam.op_count, ++ block = kmalloc(ioparam.op_count * + sizeof(struct vmcs_sm_ioctl_clean_invalid_block), + GFP_KERNEL); + if (!block) { +@@ -3000,35 +3026,21 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + + for (i = 0; i < ioparam.op_count; i++) { +- struct vmcs_sm_ioctl_clean_invalid_block *op = block + i; ++ const struct vmcs_sm_ioctl_clean_invalid_block * const op = block + i; ++ cache_flush_op_fn * const op_fn = flushops[op->invalidate_mode & 3]; + +- for (j = 0; j < op->block_count; ++j) { ++ if ((op->invalidate_mode & ~3) != 0) { ++ ret = -EINVAL; ++ break; ++ } + ++ if (op_fn == 0) ++ continue; + +- extern void v6_dma_inv_range(void *start, void *end); +- extern void v6_dma_clean_range(void *start, void *end); +- unsigned long base = (unsigned long)op->start_address + j * op->inter_block_stride; +- unsigned long end = base + op->block_size; +- /* L1/L2 cache clean */ +- if (op->invalidate_mode & 2) { +-#if defined(CONFIG_CPU_CACHE_V7) +- extern void v7_dma_clean_range(void *start, void *end); +- v7_dma_clean_range((void *)base, (void *)end); +-#elif defined(CONFIG_CPU_CACHE_V6) +- extern void v6_dma_clean_range(void *start, void *end); +- v6_dma_clean_range((void *)base, (void *)end); +-#endif +- /* L1/L2 cache invalidate */ +- } +- if (op->invalidate_mode & 1) { +-#if defined(CONFIG_CPU_CACHE_V7) +- extern void v7_dma_inv_range(void *start, void *end); +- v7_dma_inv_range((void *)base, (void *)end); +-#elif defined(CONFIG_CPU_CACHE_V6) +- extern void v6_dma_inv_range(void *start, void *end); +- v6_dma_inv_range((void *)base, (void *)end); +-#endif +- } ++ for (j = 0; j < op->block_count; ++j) { ++ const char * const base = (const char *)op->start_address + j * op->inter_block_stride; ++ const char * const end = base + op->block_size; ++ op_fn(base, end); + } + } + kfree(block); + +From 80dcff3ff2e171b4cf6ce94f89d279d2d258dad9 Mon Sep 17 00:00:00 2001 +From: Dan Pasanen +Date: Wed, 20 Sep 2017 10:17:41 -0500 +Subject: [PATCH 366/407] vcsm: fix multi-platform build + +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index ffbfa204e4837855068c2b8fb90ed61ef1c847a0..3d9cd0591d27537529e40370125ad64895e5f0b9 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -223,6 +223,7 @@ typedef void cache_flush_op_fn(const void *, const void *); + #if defined(CONFIG_CPU_CACHE_V7) + extern cache_flush_op_fn v7_dma_inv_range; + extern cache_flush_op_fn v7_dma_clean_range; ++extern cache_flush_op_fn v7_dma_flush_range; + static cache_flush_op_fn * const flushops[4] = + { + 0, +@@ -233,6 +234,7 @@ static cache_flush_op_fn * const flushops[4] = + #elif defined(CONFIG_CPU_CACHE_V6) + extern cache_flush_op_fn v6_dma_inv_range; + extern cache_flush_op_fn v6_dma_clean_range; ++extern cache_flush_op_fn v6_dma_flush_range; + static cache_flush_op_fn * const flushops[4] = + { + 0, + +From 02eb2564a781a4f6b0379ff15a26ee53dd5d1bfd Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Sun, 24 Sep 2017 22:43:16 +0100 +Subject: [PATCH 367/407] vc-sm: Fix a printf of a dma_addr_t from %u to %pad + +Avoids issues when other build parameters result in +dma_addr_t being a 64 bit value. +See #2196. + +Signed-off-by: Dave Stevenson +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 3d9cd0591d27537529e40370125ad64895e5f0b9..754f29e88968ec8b7b8a9bd7e89b25ba16de66c3 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -575,8 +575,8 @@ static int vc_sm_global_state_show(struct seq_file *s, void *v) + resource->attach); + seq_printf(s, " SGT %p\n", + resource->sgt); +- seq_printf(s, " DMA_ADDR 0x%08X\n", +- resource->dma_addr); ++ seq_printf(s, " DMA_ADDR %pad\n", ++ &resource->dma_addr); + } + } + seq_printf(s, "\n\nTotal resource count: %d\n\n", resource_count); + +From b9e7e483d86c43bbd0de162e4c18d2adafba6232 Mon Sep 17 00:00:00 2001 +From: Dan Pasanen +Date: Thu, 21 Sep 2017 09:57:44 -0500 +Subject: [PATCH 368/407] vcsm: add macros for cache functions + +--- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 5 +++++ + drivers/char/broadcom/vc_sm/vmcs_sm.c | 11 +++++------ + 2 files changed, 10 insertions(+), 6 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index f7f74750d8358779c61dfcd6fc841aa1789a2c5e..e50fd8eaecef7a3c8451c040ffc3888cc37e28fc 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -27,6 +27,11 @@ enum vc_sm_lock_cache_mode { + VC_SM_LOCK_NON_CACHED, + }; + ++/* Cache functions */ ++#define VCSM_CACHE_OP_INV 0x01 ++#define VCSM_CACHE_OP_FLUSH 0x02 ++#define VCSM_CACHE_OP_CLEAN 0x03 ++ + /* Allocate a shared memory handle and block. */ + int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle); + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 754f29e88968ec8b7b8a9bd7e89b25ba16de66c3..80c5381a64c2f7b854c01e7aef93f63660d6c4ca 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -2964,12 +2964,9 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + } + for (i = 0; i < sizeof(ioparam.s) / sizeof(*ioparam.s); i++) { + switch (ioparam.s[i].cmd) { +- default: +- case 0: +- break; /* NOOP */ +- case 1: /* L1/L2 invalidate virtual range */ +- case 2: /* L1/L2 clean physical range */ +- case 3: /* L1/L2 clean+invalidate all */ ++ case VCSM_CACHE_OP_INV: /* L1/L2 invalidate virtual range */ ++ case VCSM_CACHE_OP_FLUSH: /* L1/L2 clean physical range */ ++ case VCSM_CACHE_OP_CLEAN: /* L1/L2 clean+invalidate all */ + /* Locate resource from GUID. */ + resource = + vmcs_sm_acquire_resource(file_data, ioparam.s[i].handle); +@@ -2993,6 +2990,8 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + vmcs_sm_release_resource(resource, 0); + + break; ++ default: ++ break; /* NOOP */ + } + } + } + +From 1a30d45ae50f6754274e409b7bf20c95eefeffbc Mon Sep 17 00:00:00 2001 +From: Dan Pasanen +Date: Thu, 21 Sep 2017 07:41:02 -0500 +Subject: [PATCH 369/407] vcsm: use dma APIs for cache functions + +* Will handle multi-platform builds +--- + drivers/char/broadcom/vc_sm/vmcs_sm.c | 45 +++++++++++++---------------------- + 1 file changed, 16 insertions(+), 29 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index 80c5381a64c2f7b854c01e7aef93f63660d6c4ca..1c5a8a13ab9d565103e106b694b74089c778e0f5 100644 +--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c ++++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c +@@ -218,34 +218,6 @@ static const char *const sm_cache_map_vector[] = { + }; + #endif + +-typedef void cache_flush_op_fn(const void *, const void *); +- +-#if defined(CONFIG_CPU_CACHE_V7) +-extern cache_flush_op_fn v7_dma_inv_range; +-extern cache_flush_op_fn v7_dma_clean_range; +-extern cache_flush_op_fn v7_dma_flush_range; +-static cache_flush_op_fn * const flushops[4] = +-{ +- 0, +- v7_dma_inv_range, +- v7_dma_clean_range, +- v7_dma_flush_range, +-}; +-#elif defined(CONFIG_CPU_CACHE_V6) +-extern cache_flush_op_fn v6_dma_inv_range; +-extern cache_flush_op_fn v6_dma_clean_range; +-extern cache_flush_op_fn v6_dma_flush_range; +-static cache_flush_op_fn * const flushops[4] = +-{ +- 0, +- v6_dma_inv_range, +- v6_dma_clean_range, +- v6_dma_flush_range, +-}; +-#else +-#error Unknown cache config +-#endif +- + /* ---- Private Function Prototypes -------------------------------------- */ + + /* ---- Private Functions ------------------------------------------------ */ +@@ -3028,7 +3000,22 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + + for (i = 0; i < ioparam.op_count; i++) { + const struct vmcs_sm_ioctl_clean_invalid_block * const op = block + i; +- cache_flush_op_fn * const op_fn = flushops[op->invalidate_mode & 3]; ++ void (*op_fn)(const void *, const void *); ++ ++ switch(op->invalidate_mode & 3) { ++ case VCSM_CACHE_OP_INV: ++ op_fn = dmac_inv_range; ++ break; ++ case VCSM_CACHE_OP_CLEAN: ++ op_fn = dmac_clean_range; ++ break; ++ case VCSM_CACHE_OP_FLUSH: ++ op_fn = dmac_flush_range; ++ break; ++ default: ++ op_fn = 0; ++ break; ++ } + + if ((op->invalidate_mode & ~3) != 0) { + ret = -EINVAL; + +From 2d81766ea114ff3b88b5f8a6223adbff2f632f15 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 29 Sep 2017 16:15:01 +0100 +Subject: [PATCH 370/407] vcsm: Fix up macros to avoid breaking numbers used by + existing apps + +--- + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/char/broadcom/vc_sm/vc_sm_knl.h b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +index e50fd8eaecef7a3c8451c040ffc3888cc37e28fc..4f120421c2d11f7ae46752c38b073a4dfdf712c6 100644 +--- a/drivers/char/broadcom/vc_sm/vc_sm_knl.h ++++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h +@@ -29,8 +29,8 @@ enum vc_sm_lock_cache_mode { + + /* Cache functions */ + #define VCSM_CACHE_OP_INV 0x01 +-#define VCSM_CACHE_OP_FLUSH 0x02 +-#define VCSM_CACHE_OP_CLEAN 0x03 ++#define VCSM_CACHE_OP_CLEAN 0x02 ++#define VCSM_CACHE_OP_FLUSH 0x03 + + /* Allocate a shared memory handle and block. */ + int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle); + +From 111366a09e74644eab116aa617d2dacbd9bc1bde Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Tue, 17 Oct 2017 16:21:13 +0100 +Subject: [PATCH 371/407] vc-cma: Remove the driver as non-functional on Pi + +vc-cma was pulled in from previous platforms. It +supposedly allowed the VPU relocatable heap to be +released to the kernel as CMA, but it was always +a little fragile. + +Remove it to avoid complications. + +Signed-off-by: Dave Stevenson +--- + arch/arm/configs/bcm2709_defconfig | 1 - + arch/arm/configs/bcmrpi_defconfig | 1 - + drivers/char/broadcom/Kconfig | 7 - + drivers/char/broadcom/Makefile | 1 - + drivers/char/broadcom/vc_cma/Makefile | 7 - + drivers/char/broadcom/vc_cma/vc_cma.c | 1193 --------------------------------- + 6 files changed, 1210 deletions(-) + delete mode 100644 drivers/char/broadcom/vc_cma/Makefile + delete mode 100644 drivers/char/broadcom/vc_cma/vc_cma.c + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index b35e737d79962ce6474932e3dac904adbe480158..32f70a26fef4f9b4132233dc07d85ed92452b393 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -593,7 +593,6 @@ CONFIG_GAMEPORT=m + CONFIG_GAMEPORT_NS558=m + CONFIG_GAMEPORT_L4=m + CONFIG_BRCM_CHAR_DRIVERS=y +-CONFIG_BCM_VC_CMA=y + CONFIG_BCM_VCIO=y + CONFIG_BCM_VC_SM=y + # CONFIG_LEGACY_PTYS is not set +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 23360b1b13197512851e3d14b18ebcc610f36733..43b258bf0f951982e32005e8235110cf5eed48cf 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -589,7 +589,6 @@ CONFIG_GAMEPORT=m + CONFIG_GAMEPORT_NS558=m + CONFIG_GAMEPORT_L4=m + CONFIG_BRCM_CHAR_DRIVERS=y +-CONFIG_BCM_VC_CMA=y + CONFIG_BCM_VCIO=y + CONFIG_BCM_VC_SM=y + # CONFIG_LEGACY_PTYS is not set +diff --git a/drivers/char/broadcom/Kconfig b/drivers/char/broadcom/Kconfig +index 032164919350db25c586c36f0e05d3e4891fb835..77bf68a88e685ea31502437a10cfa2925d0d4d6f 100644 +--- a/drivers/char/broadcom/Kconfig ++++ b/drivers/char/broadcom/Kconfig +@@ -9,13 +9,6 @@ menuconfig BRCM_CHAR_DRIVERS + + if BRCM_CHAR_DRIVERS + +-config BCM_VC_CMA +- bool "Videocore CMA" +- depends on CMA && BCM2708_VCHIQ +- default n +- help +- Helper for videocore CMA access. +- + config BCM2708_VCMEM + bool "Videocore Memory" + default y +diff --git a/drivers/char/broadcom/Makefile b/drivers/char/broadcom/Makefile +index 14775c9b20b4b6a58f681f3687614676b5e2a871..7d9cb3e0b1c3c4f64c74e3d1b664a4d94170a3e0 100644 +--- a/drivers/char/broadcom/Makefile ++++ b/drivers/char/broadcom/Makefile +@@ -1,4 +1,3 @@ +-obj-$(CONFIG_BCM_VC_CMA) += vc_cma/ + obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o + obj-$(CONFIG_BCM_VCIO) += vcio.o + obj-$(CONFIG_BCM_VC_SM) += vc_sm/ +diff --git a/drivers/char/broadcom/vc_cma/Makefile b/drivers/char/broadcom/vc_cma/Makefile +deleted file mode 100644 +index d222313e28995bb54e9448192f5c99a352dde2e8..0000000000000000000000000000000000000000 +--- a/drivers/char/broadcom/vc_cma/Makefile ++++ /dev/null +@@ -1,7 +0,0 @@ +-ccflags-$(CONFIG_BCM_VC_CMA) += -Wall -Wstrict-prototypes -Wno-trigraphs -Werror +-ccflags-$(CONFIG_BCM_VC_CMA) += -Iinclude/linux/broadcom -Idrivers/staging/vc04_services -Idrivers/staging/vc04_services/interface/vchi -Idrivers/staging/vc04_services/interface/vchiq_arm +-ccflags-$(CONFIG_BCM_VC_CMA) += -D__KERNEL__ -D__linux__ +- +-obj-$(CONFIG_BCM_VC_CMA) += vc-cma.o +- +-vc-cma-objs := vc_cma.o +diff --git a/drivers/char/broadcom/vc_cma/vc_cma.c b/drivers/char/broadcom/vc_cma/vc_cma.c +deleted file mode 100644 +index 85f6e9da9e5baa0abfba618a171881c078f38496..0000000000000000000000000000000000000000 +--- a/drivers/char/broadcom/vc_cma/vc_cma.c ++++ /dev/null +@@ -1,1193 +0,0 @@ +-/** +- * Copyright (c) 2010-2012 Broadcom. All rights reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions +- * are met: +- * 1. Redistributions of source code must retain the above copyright +- * notice, this list of conditions, and the following disclaimer, +- * without modification. +- * 2. Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * 3. The names of the above-listed copyright holders may not be used +- * to endorse or promote products derived from this software without +- * specific prior written permission. +- * +- * ALTERNATIVELY, this software may be distributed under the terms of the +- * GNU General Public License ("GPL") version 2, as published by the Free +- * Software Foundation. +- * +- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +- */ +- +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +-#include +- +-#include "vc_cma.h" +- +-#include "vchiq_util.h" +-#include "vchiq_connected.h" +-//#include "debug_sym.h" +-//#include "vc_mem.h" +- +-#define DRIVER_NAME "vc-cma" +- +-#define LOG_DBG(fmt, ...) \ +- if (vc_cma_debug) \ +- printk(KERN_INFO fmt "\n", ##__VA_ARGS__) +-#define LOG_INFO(fmt, ...) \ +- printk(KERN_INFO fmt "\n", ##__VA_ARGS__) +-#define LOG_ERR(fmt, ...) \ +- printk(KERN_ERR fmt "\n", ##__VA_ARGS__) +- +-#define VC_CMA_FOURCC VCHIQ_MAKE_FOURCC('C', 'M', 'A', ' ') +-#define VC_CMA_VERSION 2 +- +-#define VC_CMA_CHUNK_ORDER 6 /* 256K */ +-#define VC_CMA_CHUNK_SIZE (4096 << VC_CMA_CHUNK_ORDER) +-#define VC_CMA_MAX_PARAMS_PER_MSG \ +- ((VCHIQ_MAX_MSG_SIZE - sizeof(unsigned short))/sizeof(unsigned short)) +-#define VC_CMA_RESERVE_COUNT_MAX 16 +- +-#define PAGES_PER_CHUNK (VC_CMA_CHUNK_SIZE / PAGE_SIZE) +- +-#define VCADDR_TO_PHYSADDR(vcaddr) (mm_vc_mem_phys_addr + vcaddr) +- +-#define loud_error(...) \ +- LOG_ERR("===== " __VA_ARGS__) +- +-enum { +- VC_CMA_MSG_QUIT, +- VC_CMA_MSG_OPEN, +- VC_CMA_MSG_TICK, +- VC_CMA_MSG_ALLOC, /* chunk count */ +- VC_CMA_MSG_FREE, /* chunk, chunk, ... */ +- VC_CMA_MSG_ALLOCATED, /* chunk, chunk, ... */ +- VC_CMA_MSG_REQUEST_ALLOC, /* chunk count */ +- VC_CMA_MSG_REQUEST_FREE, /* chunk count */ +- VC_CMA_MSG_RESERVE, /* bytes lo, bytes hi */ +- VC_CMA_MSG_UPDATE_RESERVE, +- VC_CMA_MSG_MAX +-}; +- +-struct cma_msg { +- unsigned short type; +- unsigned short params[VC_CMA_MAX_PARAMS_PER_MSG]; +-}; +- +-struct vc_cma_reserve_user { +- unsigned int pid; +- unsigned int reserve; +-}; +- +-/* Device (/dev) related variables */ +-static dev_t vc_cma_devnum; +-static struct class *vc_cma_class; +-static struct cdev vc_cma_cdev; +-static int vc_cma_inited; +-static int vc_cma_debug; +- +-/* Proc entry */ +-static struct proc_dir_entry *vc_cma_proc_entry; +- +-phys_addr_t vc_cma_base; +-struct page *vc_cma_base_page; +-unsigned int vc_cma_size; +-EXPORT_SYMBOL(vc_cma_size); +-unsigned int vc_cma_initial; +-unsigned int vc_cma_chunks; +-unsigned int vc_cma_chunks_used; +-unsigned int vc_cma_chunks_reserved; +- +- +-void *vc_cma_dma_alloc; +-unsigned int vc_cma_dma_size; +- +-static int in_loud_error; +- +-unsigned int vc_cma_reserve_total; +-unsigned int vc_cma_reserve_count; +-struct vc_cma_reserve_user vc_cma_reserve_users[VC_CMA_RESERVE_COUNT_MAX]; +-static DEFINE_SEMAPHORE(vc_cma_reserve_mutex); +-static DEFINE_SEMAPHORE(vc_cma_worker_queue_push_mutex); +- +-static u64 vc_cma_dma_mask = DMA_BIT_MASK(32); +-static struct platform_device vc_cma_device = { +- .name = "vc-cma", +- .id = 0, +- .dev = { +- .dma_mask = &vc_cma_dma_mask, +- .coherent_dma_mask = DMA_BIT_MASK(32), +- }, +-}; +- +-static VCHIQ_INSTANCE_T cma_instance; +-static VCHIQ_SERVICE_HANDLE_T cma_service; +-static VCHIU_QUEUE_T cma_msg_queue; +-static struct task_struct *cma_worker; +- +-static int vc_cma_set_reserve(unsigned int reserve, unsigned int pid); +-static int vc_cma_alloc_chunks(int num_chunks, struct cma_msg *reply); +-static VCHIQ_STATUS_T cma_service_callback(VCHIQ_REASON_T reason, +- VCHIQ_HEADER_T * header, +- VCHIQ_SERVICE_HANDLE_T service, +- void *bulk_userdata); +-static void send_vc_msg(unsigned short type, +- unsigned short param1, unsigned short param2); +-static bool send_worker_msg(VCHIQ_HEADER_T * msg); +- +-static int early_vc_cma_mem(char *p) +-{ +- unsigned int new_size; +- printk(KERN_NOTICE "early_vc_cma_mem(%s)", p); +- vc_cma_size = memparse(p, &p); +- vc_cma_initial = vc_cma_size; +- if (*p == '/') +- vc_cma_size = memparse(p + 1, &p); +- if (*p == '@') +- vc_cma_base = memparse(p + 1, &p); +- +- new_size = (vc_cma_size - ((-vc_cma_base) & (VC_CMA_CHUNK_SIZE - 1))) +- & ~(VC_CMA_CHUNK_SIZE - 1); +- if (new_size > vc_cma_size) +- vc_cma_size = 0; +- vc_cma_initial = (vc_cma_initial + VC_CMA_CHUNK_SIZE - 1) +- & ~(VC_CMA_CHUNK_SIZE - 1); +- if (vc_cma_initial > vc_cma_size) +- vc_cma_initial = vc_cma_size; +- vc_cma_base = (vc_cma_base + VC_CMA_CHUNK_SIZE - 1) +- & ~(VC_CMA_CHUNK_SIZE - 1); +- +- printk(KERN_NOTICE " -> initial %x, size %x, base %x", vc_cma_initial, +- vc_cma_size, (unsigned int)vc_cma_base); +- +- return 0; +-} +- +-early_param("vc-cma-mem", early_vc_cma_mem); +- +-void __init vc_cma_early_init(void) +-{ +- LOG_DBG("vc_cma_early_init - vc_cma_chunks = %d", vc_cma_chunks); +- if (vc_cma_size) { +- int rc = platform_device_register(&vc_cma_device); +- LOG_DBG("platform_device_register -> %d", rc); +- } +-} +- +-void __init vc_cma_reserve(void) +-{ +- /* if vc_cma_size is set, then declare vc CMA area of the same +- * size from the end of memory +- */ +- if (vc_cma_size) { +- if (dma_declare_contiguous(&vc_cma_device.dev, vc_cma_size, +- vc_cma_base, 0) == 0) { +- if (!dev_get_cma_area(NULL)) { +- /* There is no default CMA area - make this +- the default */ +- struct cma *vc_cma_area = dev_get_cma_area( +- &vc_cma_device.dev); +- dma_contiguous_set_default(vc_cma_area); +- LOG_INFO("vc_cma_reserve - using vc_cma as " +- "the default contiguous DMA area"); +- } +- } else { +- LOG_ERR("vc_cma: dma_declare_contiguous(%x,%x) failed", +- vc_cma_size, (unsigned int)vc_cma_base); +- vc_cma_size = 0; +- } +- } +- vc_cma_chunks = vc_cma_size / VC_CMA_CHUNK_SIZE; +-} +- +-/**************************************************************************** +-* +-* vc_cma_open +-* +-***************************************************************************/ +- +-static int vc_cma_open(struct inode *inode, struct file *file) +-{ +- (void)inode; +- (void)file; +- +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_cma_release +-* +-***************************************************************************/ +- +-static int vc_cma_release(struct inode *inode, struct file *file) +-{ +- (void)inode; +- (void)file; +- +- vc_cma_set_reserve(0, current->tgid); +- +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_cma_ioctl +-* +-***************************************************************************/ +- +-static long vc_cma_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +-{ +- int rc = 0; +- +- (void)cmd; +- (void)arg; +- +- switch (cmd) { +- case VC_CMA_IOC_RESERVE: +- rc = vc_cma_set_reserve((unsigned int)arg, current->tgid); +- if (rc >= 0) +- rc = 0; +- break; +- default: +- LOG_ERR("vc-cma: Unknown ioctl %x", cmd); +- return -ENOTTY; +- } +- +- return rc; +-} +- +-/**************************************************************************** +-* +-* File Operations for the driver. +-* +-***************************************************************************/ +- +-static const struct file_operations vc_cma_fops = { +- .owner = THIS_MODULE, +- .open = vc_cma_open, +- .release = vc_cma_release, +- .unlocked_ioctl = vc_cma_ioctl, +-}; +- +-/**************************************************************************** +-* +-* vc_cma_proc_open +-* +-***************************************************************************/ +- +-static int vc_cma_show_info(struct seq_file *m, void *v) +-{ +- int i; +- +- seq_printf(m, "Videocore CMA:\n"); +- seq_printf(m, " Base : %08x\n", (unsigned int)vc_cma_base); +- seq_printf(m, " Length : %08x\n", vc_cma_size); +- seq_printf(m, " Initial : %08x\n", vc_cma_initial); +- seq_printf(m, " Chunk size : %08x\n", VC_CMA_CHUNK_SIZE); +- seq_printf(m, " Chunks : %4d (%d bytes)\n", +- (int)vc_cma_chunks, +- (int)(vc_cma_chunks * VC_CMA_CHUNK_SIZE)); +- seq_printf(m, " Used : %4d (%d bytes)\n", +- (int)vc_cma_chunks_used, +- (int)(vc_cma_chunks_used * VC_CMA_CHUNK_SIZE)); +- seq_printf(m, " Reserved : %4d (%d bytes)\n", +- (unsigned int)vc_cma_chunks_reserved, +- (int)(vc_cma_chunks_reserved * VC_CMA_CHUNK_SIZE)); +- +- for (i = 0; i < vc_cma_reserve_count; i++) { +- struct vc_cma_reserve_user *user = &vc_cma_reserve_users[i]; +- seq_printf(m, " PID %5d: %d bytes\n", user->pid, +- user->reserve); +- } +- seq_printf(m, " dma_alloc : %p (%d pages)\n", +- vc_cma_dma_alloc ? page_address(vc_cma_dma_alloc) : 0, +- vc_cma_dma_size); +- +- seq_printf(m, "\n"); +- +- return 0; +-} +- +-static int vc_cma_proc_open(struct inode *inode, struct file *file) +-{ +- return single_open(file, vc_cma_show_info, NULL); +-} +- +-/**************************************************************************** +-* +-* vc_cma_proc_write +-* +-***************************************************************************/ +- +-static int vc_cma_proc_write(struct file *file, +- const char __user *buffer, +- size_t size, loff_t *ppos) +-{ +- int rc = -EFAULT; +- char input_str[20]; +- +- memset(input_str, 0, sizeof(input_str)); +- +- if (size > sizeof(input_str)) { +- LOG_ERR("%s: input string length too long", __func__); +- goto out; +- } +- +- if (copy_from_user(input_str, buffer, size - 1)) { +- LOG_ERR("%s: failed to get input string", __func__); +- goto out; +- } +-#define ALLOC_STR "alloc" +-#define FREE_STR "free" +-#define DEBUG_STR "debug" +-#define RESERVE_STR "reserve" +-#define DMA_ALLOC_STR "dma_alloc" +-#define DMA_FREE_STR "dma_free" +- if (strncmp(input_str, ALLOC_STR, strlen(ALLOC_STR)) == 0) { +- int alloc_size; +- char *p = input_str + strlen(ALLOC_STR); +- +- while (*p == ' ') +- p++; +- alloc_size = memparse(p, NULL); +- LOG_INFO("/proc/vc-cma: alloc %d", alloc_size); +- if (alloc_size) +- send_vc_msg(VC_CMA_MSG_REQUEST_FREE, +- alloc_size / VC_CMA_CHUNK_SIZE, 0); +- else +- LOG_ERR("invalid size '%s'", p); +- rc = size; +- } else if (strncmp(input_str, FREE_STR, strlen(FREE_STR)) == 0) { +- int alloc_size; +- char *p = input_str + strlen(FREE_STR); +- +- while (*p == ' ') +- p++; +- alloc_size = memparse(p, NULL); +- LOG_INFO("/proc/vc-cma: free %d", alloc_size); +- if (alloc_size) +- send_vc_msg(VC_CMA_MSG_REQUEST_ALLOC, +- alloc_size / VC_CMA_CHUNK_SIZE, 0); +- else +- LOG_ERR("invalid size '%s'", p); +- rc = size; +- } else if (strncmp(input_str, DEBUG_STR, strlen(DEBUG_STR)) == 0) { +- char *p = input_str + strlen(DEBUG_STR); +- while (*p == ' ') +- p++; +- if ((strcmp(p, "on") == 0) || (strcmp(p, "1") == 0)) +- vc_cma_debug = 1; +- else if ((strcmp(p, "off") == 0) || (strcmp(p, "0") == 0)) +- vc_cma_debug = 0; +- LOG_INFO("/proc/vc-cma: debug %s", vc_cma_debug ? "on" : "off"); +- rc = size; +- } else if (strncmp(input_str, RESERVE_STR, strlen(RESERVE_STR)) == 0) { +- int alloc_size; +- int reserved; +- char *p = input_str + strlen(RESERVE_STR); +- while (*p == ' ') +- p++; +- alloc_size = memparse(p, NULL); +- +- reserved = vc_cma_set_reserve(alloc_size, current->tgid); +- rc = (reserved >= 0) ? size : reserved; +- } else if (strncmp(input_str, DMA_ALLOC_STR, strlen(DMA_ALLOC_STR)) == 0) { +- int alloc_size; +- char *p = input_str + strlen(DMA_ALLOC_STR); +- while (*p == ' ') +- p++; +- alloc_size = memparse(p, NULL); +- +- if (vc_cma_dma_alloc) { +- dma_release_from_contiguous(NULL, vc_cma_dma_alloc, +- vc_cma_dma_size); +- vc_cma_dma_alloc = NULL; +- vc_cma_dma_size = 0; +- } +- vc_cma_dma_alloc = dma_alloc_from_contiguous(NULL, alloc_size, 0); +- vc_cma_dma_size = (vc_cma_dma_alloc ? alloc_size : 0); +- if (vc_cma_dma_alloc) +- LOG_INFO("dma_alloc(%d pages) -> %p", alloc_size, page_address(vc_cma_dma_alloc)); +- else +- LOG_ERR("dma_alloc(%d pages) failed", alloc_size); +- rc = size; +- } else if (strncmp(input_str, DMA_FREE_STR, strlen(DMA_FREE_STR)) == 0) { +- if (vc_cma_dma_alloc) { +- dma_release_from_contiguous(NULL, vc_cma_dma_alloc, +- vc_cma_dma_size); +- vc_cma_dma_alloc = NULL; +- vc_cma_dma_size = 0; +- } +- rc = size; +- } +- +-out: +- return rc; +-} +- +-/**************************************************************************** +-* +-* File Operations for /proc interface. +-* +-***************************************************************************/ +- +-static const struct file_operations vc_cma_proc_fops = { +- .open = vc_cma_proc_open, +- .read = seq_read, +- .write = vc_cma_proc_write, +- .llseek = seq_lseek, +- .release = single_release +-}; +- +-static int vc_cma_set_reserve(unsigned int reserve, unsigned int pid) +-{ +- struct vc_cma_reserve_user *user = NULL; +- int delta = 0; +- int i; +- +- if (down_interruptible(&vc_cma_reserve_mutex)) +- return -ERESTARTSYS; +- +- for (i = 0; i < vc_cma_reserve_count; i++) { +- if (pid == vc_cma_reserve_users[i].pid) { +- user = &vc_cma_reserve_users[i]; +- delta = reserve - user->reserve; +- if (reserve) +- user->reserve = reserve; +- else { +- /* Remove this entry by copying downwards */ +- while ((i + 1) < vc_cma_reserve_count) { +- user[0].pid = user[1].pid; +- user[0].reserve = user[1].reserve; +- user++; +- i++; +- } +- vc_cma_reserve_count--; +- user = NULL; +- } +- break; +- } +- } +- +- if (reserve && !user) { +- if (vc_cma_reserve_count == VC_CMA_RESERVE_COUNT_MAX) { +- LOG_ERR("vc-cma: Too many reservations - " +- "increase CMA_RESERVE_COUNT_MAX"); +- up(&vc_cma_reserve_mutex); +- return -EBUSY; +- } +- user = &vc_cma_reserve_users[vc_cma_reserve_count]; +- user->pid = pid; +- user->reserve = reserve; +- delta = reserve; +- vc_cma_reserve_count++; +- } +- +- vc_cma_reserve_total += delta; +- +- send_vc_msg(VC_CMA_MSG_RESERVE, +- vc_cma_reserve_total & 0xffff, vc_cma_reserve_total >> 16); +- +- send_worker_msg((VCHIQ_HEADER_T *) VC_CMA_MSG_UPDATE_RESERVE); +- +- LOG_DBG("/proc/vc-cma: reserve %d (PID %d) - total %u", +- reserve, pid, vc_cma_reserve_total); +- +- up(&vc_cma_reserve_mutex); +- +- return vc_cma_reserve_total; +-} +- +-static VCHIQ_STATUS_T cma_service_callback(VCHIQ_REASON_T reason, +- VCHIQ_HEADER_T * header, +- VCHIQ_SERVICE_HANDLE_T service, +- void *bulk_userdata) +-{ +- switch (reason) { +- case VCHIQ_MESSAGE_AVAILABLE: +- if (!send_worker_msg(header)) +- return VCHIQ_RETRY; +- break; +- case VCHIQ_SERVICE_CLOSED: +- LOG_DBG("CMA service closed"); +- break; +- default: +- LOG_ERR("Unexpected CMA callback reason %d", reason); +- break; +- } +- return VCHIQ_SUCCESS; +-} +- +-static void send_vc_msg(unsigned short type, +- unsigned short param1, unsigned short param2) +-{ +- unsigned short msg[] = { type, param1, param2 }; +- VCHIQ_ELEMENT_T elem = { &msg, sizeof(msg) }; +- VCHIQ_STATUS_T ret; +- vchiq_use_service(cma_service); +- ret = vchiq_queue_message(cma_service, &elem, 1); +- vchiq_release_service(cma_service); +- if (ret != VCHIQ_SUCCESS) +- LOG_ERR("vchiq_queue_message returned %x", ret); +-} +- +-static bool send_worker_msg(VCHIQ_HEADER_T * msg) +-{ +- if (down_interruptible(&vc_cma_worker_queue_push_mutex)) +- return false; +- vchiu_queue_push(&cma_msg_queue, msg); +- up(&vc_cma_worker_queue_push_mutex); +- return true; +-} +- +-static int vc_cma_alloc_chunks(int num_chunks, struct cma_msg *reply) +-{ +- int i; +- for (i = 0; i < num_chunks; i++) { +- struct page *chunk; +- unsigned int chunk_num; +- uint8_t *chunk_addr; +- size_t chunk_size = PAGES_PER_CHUNK << PAGE_SHIFT; +- +- chunk = dma_alloc_from_contiguous(&vc_cma_device.dev, +- PAGES_PER_CHUNK, +- VC_CMA_CHUNK_ORDER); +- if (!chunk) +- break; +- +- chunk_addr = page_address(chunk); +- dmac_flush_range(chunk_addr, chunk_addr + chunk_size); +- outer_inv_range(__pa(chunk_addr), __pa(chunk_addr) + +- chunk_size); +- +- chunk_num = +- (page_to_phys(chunk) - vc_cma_base) / VC_CMA_CHUNK_SIZE; +- BUG_ON(((page_to_phys(chunk) - vc_cma_base) % +- VC_CMA_CHUNK_SIZE) != 0); +- if (chunk_num >= vc_cma_chunks) { +- phys_addr_t _pa = vc_cma_base + vc_cma_size - 1; +- LOG_ERR("%s: ===============================", +- __func__); +- LOG_ERR("%s: chunk phys %x, vc_cma %pa-%pa - " +- "bad SPARSEMEM configuration?", +- __func__, (unsigned int)page_to_phys(chunk), +- &vc_cma_base, &_pa); +- LOG_ERR("%s: dev->cma_area = %p", __func__, +- (void*)0/*vc_cma_device.dev.cma_area*/); +- LOG_ERR("%s: ===============================", +- __func__); +- break; +- } +- reply->params[i] = chunk_num; +- vc_cma_chunks_used++; +- } +- +- if (i < num_chunks) { +- LOG_ERR("%s: dma_alloc_from_contiguous failed " +- "for %x bytes (alloc %d of %d, %d free)", +- __func__, VC_CMA_CHUNK_SIZE, i, +- num_chunks, vc_cma_chunks - vc_cma_chunks_used); +- num_chunks = i; +- } +- +- LOG_DBG("CMA allocated %d chunks -> %d used", +- num_chunks, vc_cma_chunks_used); +- reply->type = VC_CMA_MSG_ALLOCATED; +- +- { +- VCHIQ_ELEMENT_T elem = { +- reply, +- offsetof(struct cma_msg, params[0]) + +- num_chunks * sizeof(reply->params[0]) +- }; +- VCHIQ_STATUS_T ret; +- vchiq_use_service(cma_service); +- ret = vchiq_queue_message(cma_service, &elem, 1); +- vchiq_release_service(cma_service); +- if (ret != VCHIQ_SUCCESS) +- LOG_ERR("vchiq_queue_message return " "%x", ret); +- } +- +- return num_chunks; +-} +- +-static int cma_worker_proc(void *param) +-{ +- static struct cma_msg reply; +- (void)param; +- +- while (1) { +- VCHIQ_HEADER_T *msg; +- static struct cma_msg msg_copy; +- struct cma_msg *cma_msg = &msg_copy; +- int type, msg_size; +- +- msg = vchiu_queue_pop(&cma_msg_queue); +- if ((unsigned int)msg >= VC_CMA_MSG_MAX) { +- msg_size = msg->size; +- memcpy(&msg_copy, msg->data, msg_size); +- type = cma_msg->type; +- vchiq_release_message(cma_service, msg); +- } else { +- msg_size = 0; +- type = (int)msg; +- if (type == VC_CMA_MSG_QUIT) +- break; +- else if (type == VC_CMA_MSG_UPDATE_RESERVE) { +- msg = NULL; +- cma_msg = NULL; +- } else { +- BUG(); +- continue; +- } +- } +- +- switch (type) { +- case VC_CMA_MSG_ALLOC:{ +- int num_chunks, free_chunks; +- num_chunks = cma_msg->params[0]; +- free_chunks = +- vc_cma_chunks - vc_cma_chunks_used; +- LOG_DBG("CMA_MSG_ALLOC(%d chunks)", num_chunks); +- if (num_chunks > VC_CMA_MAX_PARAMS_PER_MSG) { +- LOG_ERR +- ("CMA_MSG_ALLOC - chunk count (%d) " +- "exceeds VC_CMA_MAX_PARAMS_PER_MSG (%d)", +- num_chunks, +- VC_CMA_MAX_PARAMS_PER_MSG); +- num_chunks = VC_CMA_MAX_PARAMS_PER_MSG; +- } +- +- if (num_chunks > free_chunks) { +- LOG_ERR +- ("CMA_MSG_ALLOC - chunk count (%d) " +- "exceeds free chunks (%d)", +- num_chunks, free_chunks); +- num_chunks = free_chunks; +- } +- +- vc_cma_alloc_chunks(num_chunks, &reply); +- } +- break; +- +- case VC_CMA_MSG_FREE:{ +- int chunk_count = +- (msg_size - +- offsetof(struct cma_msg, +- params)) / +- sizeof(cma_msg->params[0]); +- int i; +- BUG_ON(chunk_count <= 0); +- +- LOG_DBG("CMA_MSG_FREE(%d chunks - %x, ...)", +- chunk_count, cma_msg->params[0]); +- for (i = 0; i < chunk_count; i++) { +- int chunk_num = cma_msg->params[i]; +- struct page *page = vc_cma_base_page + +- chunk_num * PAGES_PER_CHUNK; +- if (chunk_num >= vc_cma_chunks) { +- LOG_ERR +- ("CMA_MSG_FREE - chunk %d of %d" +- " (value %x) exceeds maximum " +- "(%x)", i, chunk_count, +- chunk_num, +- vc_cma_chunks - 1); +- break; +- } +- +- if (!dma_release_from_contiguous +- (&vc_cma_device.dev, page, +- PAGES_PER_CHUNK)) { +- phys_addr_t _pa = page_to_phys(page); +- LOG_ERR +- ("CMA_MSG_FREE - failed to " +- "release chunk %d (phys %pa, " +- "page %x)", chunk_num, +- &_pa, +- (unsigned int)page); +- } +- vc_cma_chunks_used--; +- } +- LOG_DBG("CMA released %d chunks -> %d used", +- i, vc_cma_chunks_used); +- } +- break; +- +- case VC_CMA_MSG_UPDATE_RESERVE:{ +- int chunks_needed = +- ((vc_cma_reserve_total + VC_CMA_CHUNK_SIZE - +- 1) +- / VC_CMA_CHUNK_SIZE) - +- vc_cma_chunks_reserved; +- +- LOG_DBG +- ("CMA_MSG_UPDATE_RESERVE(%d chunks needed)", +- chunks_needed); +- +- /* Cap the reservations to what is available */ +- if (chunks_needed > 0) { +- if (chunks_needed > +- (vc_cma_chunks - +- vc_cma_chunks_used)) +- chunks_needed = +- (vc_cma_chunks - +- vc_cma_chunks_used); +- +- chunks_needed = +- vc_cma_alloc_chunks(chunks_needed, +- &reply); +- } +- +- LOG_DBG +- ("CMA_MSG_UPDATE_RESERVE(%d chunks allocated)", +- chunks_needed); +- vc_cma_chunks_reserved += chunks_needed; +- } +- break; +- +- default: +- LOG_ERR("unexpected msg type %d", type); +- break; +- } +- } +- +- LOG_DBG("quitting..."); +- return 0; +-} +- +-/**************************************************************************** +-* +-* vc_cma_connected_init +-* +-* This function is called once the videocore has been connected. +-* +-***************************************************************************/ +- +-static void vc_cma_connected_init(void) +-{ +- VCHIQ_SERVICE_PARAMS_T service_params; +- +- LOG_DBG("vc_cma_connected_init"); +- +- if (!vchiu_queue_init(&cma_msg_queue, 16)) { +- LOG_ERR("could not create CMA msg queue"); +- goto fail_queue; +- } +- +- if (vchiq_initialise(&cma_instance) != VCHIQ_SUCCESS) +- goto fail_vchiq_init; +- +- vchiq_connect(cma_instance); +- +- service_params.fourcc = VC_CMA_FOURCC; +- service_params.callback = cma_service_callback; +- service_params.userdata = NULL; +- service_params.version = VC_CMA_VERSION; +- service_params.version_min = VC_CMA_VERSION; +- +- if (vchiq_open_service(cma_instance, &service_params, +- &cma_service) != VCHIQ_SUCCESS) { +- LOG_ERR("failed to open service - already in use?"); +- goto fail_vchiq_open; +- } +- +- vchiq_release_service(cma_service); +- +- cma_worker = kthread_create(cma_worker_proc, NULL, "cma_worker"); +- if (!cma_worker) { +- LOG_ERR("could not create CMA worker thread"); +- goto fail_worker; +- } +- set_user_nice(cma_worker, -20); +- wake_up_process(cma_worker); +- +- return; +- +-fail_worker: +- vchiq_close_service(cma_service); +-fail_vchiq_open: +- vchiq_shutdown(cma_instance); +-fail_vchiq_init: +- vchiu_queue_delete(&cma_msg_queue); +-fail_queue: +- return; +-} +- +-void +-loud_error_header(void) +-{ +- if (in_loud_error) +- return; +- +- LOG_ERR("============================================================" +- "================"); +- LOG_ERR("============================================================" +- "================"); +- LOG_ERR("====="); +- +- in_loud_error = 1; +-} +- +-void +-loud_error_footer(void) +-{ +- if (!in_loud_error) +- return; +- +- LOG_ERR("====="); +- LOG_ERR("============================================================" +- "================"); +- LOG_ERR("============================================================" +- "================"); +- +- in_loud_error = 0; +-} +- +-#if 1 +-static int check_cma_config(void) { return 1; } +-#else +-static int +-read_vc_debug_var(VC_MEM_ACCESS_HANDLE_T handle, +- const char *symbol, +- void *buf, size_t bufsize) +-{ +- VC_MEM_ADDR_T vcMemAddr; +- size_t vcMemSize; +- uint8_t *mapAddr; +- off_t vcMapAddr; +- +- if (!LookupVideoCoreSymbol(handle, symbol, +- &vcMemAddr, +- &vcMemSize)) { +- loud_error_header(); +- loud_error( +- "failed to find VC symbol \"%s\".", +- symbol); +- loud_error_footer(); +- return 0; +- } +- +- if (vcMemSize != bufsize) { +- loud_error_header(); +- loud_error( +- "VC symbol \"%s\" is the wrong size.", +- symbol); +- loud_error_footer(); +- return 0; +- } +- +- vcMapAddr = (off_t)vcMemAddr & VC_MEM_TO_ARM_ADDR_MASK; +- vcMapAddr += mm_vc_mem_phys_addr; +- mapAddr = ioremap_nocache(vcMapAddr, vcMemSize); +- if (mapAddr == 0) { +- loud_error_header(); +- loud_error( +- "failed to ioremap \"%s\" @ 0x%x " +- "(phys: 0x%x, size: %u).", +- symbol, +- (unsigned int)vcMapAddr, +- (unsigned int)vcMemAddr, +- (unsigned int)vcMemSize); +- loud_error_footer(); +- return 0; +- } +- +- memcpy(buf, mapAddr, bufsize); +- iounmap(mapAddr); +- +- return 1; +-} +- +- +-static int +-check_cma_config(void) +-{ +- VC_MEM_ACCESS_HANDLE_T mem_hndl; +- VC_MEM_ADDR_T mempool_start; +- VC_MEM_ADDR_T mempool_end; +- VC_MEM_ADDR_T mempool_offline_start; +- VC_MEM_ADDR_T mempool_offline_end; +- VC_MEM_ADDR_T cam_alloc_base; +- VC_MEM_ADDR_T cam_alloc_size; +- VC_MEM_ADDR_T cam_alloc_end; +- int success = 0; +- +- if (OpenVideoCoreMemory(&mem_hndl) != 0) +- goto out; +- +- /* Read the relevant VideoCore variables */ +- if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_START", +- &mempool_start, +- sizeof(mempool_start))) +- goto close; +- +- if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_END", +- &mempool_end, +- sizeof(mempool_end))) +- goto close; +- +- if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_OFFLINE_START", +- &mempool_offline_start, +- sizeof(mempool_offline_start))) +- goto close; +- +- if (!read_vc_debug_var(mem_hndl, "__MEMPOOL_OFFLINE_END", +- &mempool_offline_end, +- sizeof(mempool_offline_end))) +- goto close; +- +- if (!read_vc_debug_var(mem_hndl, "cam_alloc_base", +- &cam_alloc_base, +- sizeof(cam_alloc_base))) +- goto close; +- +- if (!read_vc_debug_var(mem_hndl, "cam_alloc_size", +- &cam_alloc_size, +- sizeof(cam_alloc_size))) +- goto close; +- +- cam_alloc_end = cam_alloc_base + cam_alloc_size; +- +- success = 1; +- +- /* Now the sanity checks */ +- if (!mempool_offline_start) +- mempool_offline_start = mempool_start; +- if (!mempool_offline_end) +- mempool_offline_end = mempool_end; +- +- if (VCADDR_TO_PHYSADDR(mempool_offline_start) != vc_cma_base) { +- loud_error_header(); +- loud_error( +- "__MEMPOOL_OFFLINE_START(%x -> %lx) doesn't match " +- "vc_cma_base(%x)", +- mempool_offline_start, +- VCADDR_TO_PHYSADDR(mempool_offline_start), +- vc_cma_base); +- success = 0; +- } +- +- if (VCADDR_TO_PHYSADDR(mempool_offline_end) != +- (vc_cma_base + vc_cma_size)) { +- loud_error_header(); +- loud_error( +- "__MEMPOOL_OFFLINE_END(%x -> %lx) doesn't match " +- "vc_cma_base(%x) + vc_cma_size(%x) = %x", +- mempool_offline_start, +- VCADDR_TO_PHYSADDR(mempool_offline_end), +- vc_cma_base, vc_cma_size, vc_cma_base + vc_cma_size); +- success = 0; +- } +- +- if (mempool_end < mempool_start) { +- loud_error_header(); +- loud_error( +- "__MEMPOOL_END(%x) must not be before " +- "__MEMPOOL_START(%x)", +- mempool_end, +- mempool_start); +- success = 0; +- } +- +- if (mempool_offline_end < mempool_offline_start) { +- loud_error_header(); +- loud_error( +- "__MEMPOOL_OFFLINE_END(%x) must not be before " +- "__MEMPOOL_OFFLINE_START(%x)", +- mempool_offline_end, +- mempool_offline_start); +- success = 0; +- } +- +- if (mempool_offline_start < mempool_start) { +- loud_error_header(); +- loud_error( +- "__MEMPOOL_OFFLINE_START(%x) must not be before " +- "__MEMPOOL_START(%x)", +- mempool_offline_start, +- mempool_start); +- success = 0; +- } +- +- if (mempool_offline_end > mempool_end) { +- loud_error_header(); +- loud_error( +- "__MEMPOOL_OFFLINE_END(%x) must not be after " +- "__MEMPOOL_END(%x)", +- mempool_offline_end, +- mempool_end); +- success = 0; +- } +- +- if ((cam_alloc_base < mempool_end) && +- (cam_alloc_end > mempool_start)) { +- loud_error_header(); +- loud_error( +- "cam_alloc pool(%x-%x) overlaps " +- "mempool(%x-%x)", +- cam_alloc_base, cam_alloc_end, +- mempool_start, mempool_end); +- success = 0; +- } +- +- loud_error_footer(); +- +-close: +- CloseVideoCoreMemory(mem_hndl); +- +-out: +- return success; +-} +-#endif +- +-static int vc_cma_init(void) +-{ +- int rc = -EFAULT; +- struct device *dev; +- +- if (!check_cma_config()) +- goto out_release; +- +- LOG_INFO("vc-cma: Videocore CMA driver"); +- LOG_INFO("vc-cma: vc_cma_base = %pa", &vc_cma_base); +- LOG_INFO("vc-cma: vc_cma_size = 0x%08x (%u MiB)", +- vc_cma_size, vc_cma_size / (1024 * 1024)); +- LOG_INFO("vc-cma: vc_cma_initial = 0x%08x (%u MiB)", +- vc_cma_initial, vc_cma_initial / (1024 * 1024)); +- +- vc_cma_base_page = phys_to_page(vc_cma_base); +- +- if (vc_cma_chunks) { +- int chunks_needed = vc_cma_initial / VC_CMA_CHUNK_SIZE; +- +- for (vc_cma_chunks_used = 0; +- vc_cma_chunks_used < chunks_needed; vc_cma_chunks_used++) { +- struct page *chunk; +- chunk = dma_alloc_from_contiguous(&vc_cma_device.dev, +- PAGES_PER_CHUNK, +- VC_CMA_CHUNK_ORDER); +- if (!chunk) +- break; +- BUG_ON(((page_to_phys(chunk) - vc_cma_base) % +- VC_CMA_CHUNK_SIZE) != 0); +- } +- if (vc_cma_chunks_used != chunks_needed) { +- LOG_ERR("%s: dma_alloc_from_contiguous failed (%d " +- "bytes, allocation %d of %d)", +- __func__, VC_CMA_CHUNK_SIZE, +- vc_cma_chunks_used, chunks_needed); +- goto out_release; +- } +- +- vchiq_add_connected_callback(vc_cma_connected_init); +- } +- +- rc = alloc_chrdev_region(&vc_cma_devnum, 0, 1, DRIVER_NAME); +- if (rc < 0) { +- LOG_ERR("%s: alloc_chrdev_region failed (rc=%d)", __func__, rc); +- goto out_release; +- } +- +- cdev_init(&vc_cma_cdev, &vc_cma_fops); +- rc = cdev_add(&vc_cma_cdev, vc_cma_devnum, 1); +- if (rc != 0) { +- LOG_ERR("%s: cdev_add failed (rc=%d)", __func__, rc); +- goto out_unregister; +- } +- +- vc_cma_class = class_create(THIS_MODULE, DRIVER_NAME); +- if (IS_ERR(vc_cma_class)) { +- rc = PTR_ERR(vc_cma_class); +- LOG_ERR("%s: class_create failed (rc=%d)", __func__, rc); +- goto out_cdev_del; +- } +- +- dev = device_create(vc_cma_class, NULL, vc_cma_devnum, NULL, +- DRIVER_NAME); +- if (IS_ERR(dev)) { +- rc = PTR_ERR(dev); +- LOG_ERR("%s: device_create failed (rc=%d)", __func__, rc); +- goto out_class_destroy; +- } +- +- vc_cma_proc_entry = proc_create(DRIVER_NAME, 0444, NULL, &vc_cma_proc_fops); +- if (vc_cma_proc_entry == NULL) { +- rc = -EFAULT; +- LOG_ERR("%s: proc_create failed", __func__); +- goto out_device_destroy; +- } +- +- vc_cma_inited = 1; +- return 0; +- +-out_device_destroy: +- device_destroy(vc_cma_class, vc_cma_devnum); +- +-out_class_destroy: +- class_destroy(vc_cma_class); +- vc_cma_class = NULL; +- +-out_cdev_del: +- cdev_del(&vc_cma_cdev); +- +-out_unregister: +- unregister_chrdev_region(vc_cma_devnum, 1); +- +-out_release: +- /* It is tempting to try to clean up by calling +- dma_release_from_contiguous for all allocated chunks, but it isn't +- a very safe thing to do. If vc_cma_initial is non-zero it is because +- VideoCore is already using that memory, so giving it back to Linux +- is likely to be fatal. +- */ +- return -1; +-} +- +-/**************************************************************************** +-* +-* vc_cma_exit +-* +-***************************************************************************/ +- +-static void __exit vc_cma_exit(void) +-{ +- LOG_DBG("%s: called", __func__); +- +- if (vc_cma_inited) { +- remove_proc_entry(DRIVER_NAME, NULL); +- device_destroy(vc_cma_class, vc_cma_devnum); +- class_destroy(vc_cma_class); +- cdev_del(&vc_cma_cdev); +- unregister_chrdev_region(vc_cma_devnum, 1); +- } +-} +- +-module_init(vc_cma_init); +-module_exit(vc_cma_exit); +-MODULE_LICENSE("GPL"); +-MODULE_AUTHOR("Broadcom Corporation"); + +From 14dbacb2efc39b2eb76b8e1d4691a99590958a39 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Wed, 2 Aug 2017 12:48:04 -0700 +Subject: [PATCH 372/407] drm/vc4: Fix double destroy of the BO cache on + teardown. + +It's also destroyed from the top level vc4_drv.c initialization, which +is where the cache was actually initialized from. + +This used to just involve duplicate del_timer() and cancel_work_sync() +being called, but it started causing kmalloc issues once we +double-freed the new BO label array. + +Fixes: 1908a876f909 ("drm/vc4: Add an ioctl for labeling GEM BOs for summary stats") +Signed-off-by: Eric Anholt +--- + drivers/gpu/drm/vc4/vc4_gem.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c +index a5029ab49068bdbd69411cccbdb6f5111f387e38..066e7009358cd28df95fe45cd3204f71e8a21c55 100644 +--- a/drivers/gpu/drm/vc4/vc4_gem.c ++++ b/drivers/gpu/drm/vc4/vc4_gem.c +@@ -964,6 +964,4 @@ vc4_gem_destroy(struct drm_device *dev) + + if (vc4->hang_state) + vc4_free_hang_state(dev, vc4->hang_state); +- +- vc4_bo_cache_destroy(dev); + } + +From ae46f25cf8e247865708ec1e7bfc787995fc236c Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Wed, 2 Aug 2017 11:46:51 -0700 +Subject: [PATCH 373/407] drm/vc4: Don't disable DSI clocks on component + unload. + +The clocks are enabled/disabled at encoder enable/disable time, not at +component load. Fixes a WARN_ON at boot if V3D fails to probe. + +Fixes: 4078f5757144 ("drm/vc4: Add DSI driver") +Signed-off-by: Eric Anholt +--- + drivers/gpu/drm/vc4/vc4_dsi.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c +index 17fcac381dbb37cd9a5ff210ad8578f480177039..284f486ed9dbf44ff706cce7d111965fb82fab11 100644 +--- a/drivers/gpu/drm/vc4/vc4_dsi.c ++++ b/drivers/gpu/drm/vc4/vc4_dsi.c +@@ -1692,9 +1692,6 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master, + + mipi_dsi_host_unregister(&dsi->dsi_host); + +- clk_disable_unprepare(dsi->pll_phy_clock); +- clk_disable_unprepare(dsi->escape_clock); +- + if (dsi->port == 1) + vc4->dsi1 = NULL; + } + +From 14696f17c976a56b96d6ec32754f914b47c7c5b5 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Tue, 25 Jul 2017 11:27:16 -0700 +Subject: [PATCH 374/407] drm/vc4: Start using u64_to_user_ptr. + +Chris Wilson pointed out this little cleanup in a review of new code, +so let's fix up the code I was copying from. + +Signed-off-by: Eric Anholt +Link: https://patchwork.freedesktop.org/patch/msgid/20170725182718.31468-1-eric@anholt.net +Reviewed-by: Daniel Vetter +(cherry picked from commit 95d7cbcb6fbe3885d7a968cc86b98a08466742af) +--- + drivers/gpu/drm/vc4/vc4_gem.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c +index 066e7009358cd28df95fe45cd3204f71e8a21c55..7e90ea1702994531a734b322393021364d5284b3 100644 +--- a/drivers/gpu/drm/vc4/vc4_gem.c ++++ b/drivers/gpu/drm/vc4/vc4_gem.c +@@ -118,7 +118,7 @@ vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, + bo_state[i].size = vc4_bo->base.base.size; + } + +- if (copy_to_user((void __user *)(uintptr_t)get_state->bo, ++ if (copy_to_user(u64_to_user_ptr(get_state->bo), + bo_state, + state->bo_count * sizeof(*bo_state))) + ret = -EFAULT; +@@ -549,8 +549,7 @@ vc4_cl_lookup_bos(struct drm_device *dev, + goto fail; + } + +- if (copy_from_user(handles, +- (void __user *)(uintptr_t)args->bo_handles, ++ if (copy_from_user(handles, u64_to_user_ptr(args->bo_handles), + exec->bo_count * sizeof(uint32_t))) { + ret = -EFAULT; + DRM_ERROR("Failed to copy in GEM handles\n"); +@@ -626,21 +625,21 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) + exec->shader_state_size = args->shader_rec_count; + + if (copy_from_user(bin, +- (void __user *)(uintptr_t)args->bin_cl, ++ u64_to_user_ptr(args->bin_cl), + args->bin_cl_size)) { + ret = -EFAULT; + goto fail; + } + + if (copy_from_user(exec->shader_rec_u, +- (void __user *)(uintptr_t)args->shader_rec, ++ u64_to_user_ptr(args->shader_rec), + args->shader_rec_size)) { + ret = -EFAULT; + goto fail; + } + + if (copy_from_user(exec->uniforms_u, +- (void __user *)(uintptr_t)args->uniforms, ++ u64_to_user_ptr(args->uniforms), + args->uniforms_size)) { + ret = -EFAULT; + goto fail; + +From 384c99eb0300da63dca9f22562a7f7d283cd9e1e Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Tue, 25 Jul 2017 11:27:17 -0700 +Subject: [PATCH 375/407] drm/vc4: Add an ioctl for labeling GEM BOs for + summary stats + +This has proven immensely useful for debugging memory leaks and +overallocation (which is a rather serious concern on the platform, +given that we typically run at about 256MB of CMA out of up to 1GB +total memory, with framebuffers that are about 8MB ecah). + +The state of the art without this is to dump debug logs from every GL +application, guess as to kernel allocations based on bo_stats, and try +to merge that all together into a global picture of memory allocation +state. With this, you can add a couple of calls to the debug build of +the 3D driver and get a pretty detailed view of GPU memory usage from +/debug/dri/0/bo_stats (or when we debug print to dmesg on allocation +failure). + +The Mesa side currently labels at the gallium resource level (so you +see that a 1920x20 pixmap has been created, presumably for the window +system panel), but we could extend that to be even more useful with +glObjectLabel() names being sent all the way down to the kernel. + +(partial) example of sorted debugfs output with Mesa labeling all +resources: + + kernel BO cache: 16392kb BOs (3) + tiling shadow 1920x1080: 8160kb BOs (1) + resource 1920x1080@32/0: 8160kb BOs (1) +scanout resource 1920x1080@32/0: 8100kb BOs (1) + kernel: 8100kb BOs (1) + +v2: Use strndup_user(), use lockdep assertion instead of just a + comment, fix an array[-1] reference, extend comment about name + freeing. + +Signed-off-by: Eric Anholt +Link: https://patchwork.freedesktop.org/patch/msgid/20170725182718.31468-2-eric@anholt.net +Reviewed-by: Chris Wilson +(cherry picked from commit f30994622b2bf8e4fa224237ac65304b27a9cb6a) +--- + drivers/gpu/drm/vc4/vc4_bo.c | 256 ++++++++++++++++++++++++++++-------- + drivers/gpu/drm/vc4/vc4_drv.c | 8 +- + drivers/gpu/drm/vc4/vc4_drv.h | 39 +++++- + drivers/gpu/drm/vc4/vc4_gem.c | 2 +- + drivers/gpu/drm/vc4/vc4_render_cl.c | 2 +- + drivers/gpu/drm/vc4/vc4_v3d.c | 3 +- + include/uapi/drm/vc4_drm.h | 11 ++ + 7 files changed, 256 insertions(+), 65 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c +index 55bbadc86a1ee45205360fb26e8525a8326db017..42dd21a736bd6c9f8cba84a0dc21d46751efb976 100644 +--- a/drivers/gpu/drm/vc4/vc4_bo.c ++++ b/drivers/gpu/drm/vc4/vc4_bo.c +@@ -21,21 +21,35 @@ + #include "vc4_drv.h" + #include "uapi/drm/vc4_drm.h" + ++static const char * const bo_type_names[] = { ++ "kernel", ++ "V3D", ++ "V3D shader", ++ "dumb", ++ "binner", ++ "RCL", ++ "BCL", ++ "kernel BO cache", ++}; ++ ++static bool is_user_label(int label) ++{ ++ return label >= VC4_BO_TYPE_COUNT; ++} ++ + static void vc4_bo_stats_dump(struct vc4_dev *vc4) + { +- DRM_INFO("num bos allocated: %d\n", +- vc4->bo_stats.num_allocated); +- DRM_INFO("size bos allocated: %dkb\n", +- vc4->bo_stats.size_allocated / 1024); +- DRM_INFO("num bos used: %d\n", +- vc4->bo_stats.num_allocated - vc4->bo_stats.num_cached); +- DRM_INFO("size bos used: %dkb\n", +- (vc4->bo_stats.size_allocated - +- vc4->bo_stats.size_cached) / 1024); +- DRM_INFO("num bos cached: %d\n", +- vc4->bo_stats.num_cached); +- DRM_INFO("size bos cached: %dkb\n", +- vc4->bo_stats.size_cached / 1024); ++ int i; ++ ++ for (i = 0; i < vc4->num_labels; i++) { ++ if (!vc4->bo_labels[i].num_allocated) ++ continue; ++ ++ DRM_INFO("%30s: %6dkb BOs (%d)\n", ++ vc4->bo_labels[i].name, ++ vc4->bo_labels[i].size_allocated / 1024, ++ vc4->bo_labels[i].num_allocated); ++ } + } + + #ifdef CONFIG_DEBUG_FS +@@ -44,30 +58,103 @@ int vc4_bo_stats_debugfs(struct seq_file *m, void *unused) + struct drm_info_node *node = (struct drm_info_node *)m->private; + struct drm_device *dev = node->minor->dev; + struct vc4_dev *vc4 = to_vc4_dev(dev); +- struct vc4_bo_stats stats; ++ int i; + +- /* Take a snapshot of the current stats with the lock held. */ + mutex_lock(&vc4->bo_lock); +- stats = vc4->bo_stats; ++ for (i = 0; i < vc4->num_labels; i++) { ++ if (!vc4->bo_labels[i].num_allocated) ++ continue; ++ ++ seq_printf(m, "%30s: %6dkb BOs (%d)\n", ++ vc4->bo_labels[i].name, ++ vc4->bo_labels[i].size_allocated / 1024, ++ vc4->bo_labels[i].num_allocated); ++ } + mutex_unlock(&vc4->bo_lock); + +- seq_printf(m, "num bos allocated: %d\n", +- stats.num_allocated); +- seq_printf(m, "size bos allocated: %dkb\n", +- stats.size_allocated / 1024); +- seq_printf(m, "num bos used: %d\n", +- stats.num_allocated - stats.num_cached); +- seq_printf(m, "size bos used: %dkb\n", +- (stats.size_allocated - stats.size_cached) / 1024); +- seq_printf(m, "num bos cached: %d\n", +- stats.num_cached); +- seq_printf(m, "size bos cached: %dkb\n", +- stats.size_cached / 1024); +- + return 0; + } + #endif + ++/* Takes ownership of *name and returns the appropriate slot for it in ++ * the bo_labels[] array, extending it as necessary. ++ * ++ * This is inefficient and could use a hash table instead of walking ++ * an array and strcmp()ing. However, the assumption is that user ++ * labeling will be infrequent (scanout buffers and other long-lived ++ * objects, or debug driver builds), so we can live with it for now. ++ */ ++static int vc4_get_user_label(struct vc4_dev *vc4, const char *name) ++{ ++ int i; ++ int free_slot = -1; ++ ++ for (i = 0; i < vc4->num_labels; i++) { ++ if (!vc4->bo_labels[i].name) { ++ free_slot = i; ++ } else if (strcmp(vc4->bo_labels[i].name, name) == 0) { ++ kfree(name); ++ return i; ++ } ++ } ++ ++ if (free_slot != -1) { ++ WARN_ON(vc4->bo_labels[free_slot].num_allocated != 0); ++ vc4->bo_labels[free_slot].name = name; ++ return free_slot; ++ } else { ++ u32 new_label_count = vc4->num_labels + 1; ++ struct vc4_label *new_labels = ++ krealloc(vc4->bo_labels, ++ new_label_count * sizeof(*new_labels), ++ GFP_KERNEL); ++ ++ if (!new_labels) { ++ kfree(name); ++ return -1; ++ } ++ ++ free_slot = vc4->num_labels; ++ vc4->bo_labels = new_labels; ++ vc4->num_labels = new_label_count; ++ ++ vc4->bo_labels[free_slot].name = name; ++ vc4->bo_labels[free_slot].num_allocated = 0; ++ vc4->bo_labels[free_slot].size_allocated = 0; ++ ++ return free_slot; ++ } ++} ++ ++static void vc4_bo_set_label(struct drm_gem_object *gem_obj, int label) ++{ ++ struct vc4_bo *bo = to_vc4_bo(gem_obj); ++ struct vc4_dev *vc4 = to_vc4_dev(gem_obj->dev); ++ ++ lockdep_assert_held(&vc4->bo_lock); ++ ++ if (label != -1) { ++ vc4->bo_labels[label].num_allocated++; ++ vc4->bo_labels[label].size_allocated += gem_obj->size; ++ } ++ ++ vc4->bo_labels[bo->label].num_allocated--; ++ vc4->bo_labels[bo->label].size_allocated -= gem_obj->size; ++ ++ if (vc4->bo_labels[bo->label].num_allocated == 0 && ++ is_user_label(bo->label)) { ++ /* Free user BO label slots on last unreference. ++ * Slots are just where we track the stats for a given ++ * name, and once a name is unused we can reuse that ++ * slot. ++ */ ++ kfree(vc4->bo_labels[bo->label].name); ++ vc4->bo_labels[bo->label].name = NULL; ++ } ++ ++ bo->label = label; ++} ++ + static uint32_t bo_page_index(size_t size) + { + return (size / PAGE_SIZE) - 1; +@@ -77,7 +164,8 @@ static uint32_t bo_page_index(size_t size) + static void vc4_bo_destroy(struct vc4_bo *bo) + { + struct drm_gem_object *obj = &bo->base.base; +- struct vc4_dev *vc4 = to_vc4_dev(obj->dev); ++ ++ vc4_bo_set_label(obj, -1); + + if (bo->validated_shader) { + kfree(bo->validated_shader->texture_samples); +@@ -85,20 +173,12 @@ static void vc4_bo_destroy(struct vc4_bo *bo) + bo->validated_shader = NULL; + } + +- vc4->bo_stats.num_allocated--; +- vc4->bo_stats.size_allocated -= obj->size; + drm_gem_cma_free_object(obj); + } + + /* Must be called with bo_lock held. */ + static void vc4_bo_remove_from_cache(struct vc4_bo *bo) + { +- struct drm_gem_object *obj = &bo->base.base; +- struct vc4_dev *vc4 = to_vc4_dev(obj->dev); +- +- vc4->bo_stats.num_cached--; +- vc4->bo_stats.size_cached -= obj->size; +- + list_del(&bo->unref_head); + list_del(&bo->size_head); + } +@@ -159,7 +239,8 @@ static void vc4_bo_cache_purge(struct drm_device *dev) + } + + static struct vc4_bo *vc4_bo_get_from_cache(struct drm_device *dev, +- uint32_t size) ++ uint32_t size, ++ enum vc4_kernel_bo_type type) + { + struct vc4_dev *vc4 = to_vc4_dev(dev); + uint32_t page_index = bo_page_index(size); +@@ -180,6 +261,8 @@ static struct vc4_bo *vc4_bo_get_from_cache(struct drm_device *dev, + kref_init(&bo->base.base.refcount); + + out: ++ if (bo) ++ vc4_bo_set_label(&bo->base.base, type); + mutex_unlock(&vc4->bo_lock); + return bo; + } +@@ -200,15 +283,16 @@ struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size) + return ERR_PTR(-ENOMEM); + + mutex_lock(&vc4->bo_lock); +- vc4->bo_stats.num_allocated++; +- vc4->bo_stats.size_allocated += size; ++ bo->label = VC4_BO_TYPE_KERNEL; ++ vc4->bo_labels[VC4_BO_TYPE_KERNEL].num_allocated++; ++ vc4->bo_labels[VC4_BO_TYPE_KERNEL].size_allocated += size; + mutex_unlock(&vc4->bo_lock); + + return &bo->base.base; + } + + struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size, +- bool allow_unzeroed) ++ bool allow_unzeroed, enum vc4_kernel_bo_type type) + { + size_t size = roundup(unaligned_size, PAGE_SIZE); + struct vc4_dev *vc4 = to_vc4_dev(dev); +@@ -219,7 +303,7 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size, + return ERR_PTR(-EINVAL); + + /* First, try to get a vc4_bo from the kernel BO cache. */ +- bo = vc4_bo_get_from_cache(dev, size); ++ bo = vc4_bo_get_from_cache(dev, size, type); + if (bo) { + if (!allow_unzeroed) + memset(bo->base.vaddr, 0, bo->base.base.size); +@@ -241,8 +325,13 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size, + return ERR_PTR(-ENOMEM); + } + } ++ bo = to_vc4_bo(&cma_obj->base); + +- return to_vc4_bo(&cma_obj->base); ++ mutex_lock(&vc4->bo_lock); ++ vc4_bo_set_label(&cma_obj->base, type); ++ mutex_unlock(&vc4->bo_lock); ++ ++ return bo; + } + + int vc4_dumb_create(struct drm_file *file_priv, +@@ -259,7 +348,7 @@ int vc4_dumb_create(struct drm_file *file_priv, + if (args->size < args->pitch * args->height) + args->size = args->pitch * args->height; + +- bo = vc4_bo_create(dev, args->size, false); ++ bo = vc4_bo_create(dev, args->size, false, VC4_BO_TYPE_DUMB); + if (IS_ERR(bo)) + return PTR_ERR(bo); + +@@ -338,8 +427,7 @@ void vc4_free_object(struct drm_gem_object *gem_bo) + list_add(&bo->size_head, cache_list); + list_add(&bo->unref_head, &vc4->bo_cache.time_list); + +- vc4->bo_stats.num_cached++; +- vc4->bo_stats.size_cached += gem_bo->size; ++ vc4_bo_set_label(&bo->base.base, VC4_BO_TYPE_KERNEL_CACHE); + + vc4_bo_cache_free_old(dev); + +@@ -448,7 +536,7 @@ int vc4_create_bo_ioctl(struct drm_device *dev, void *data, + * We can't allocate from the BO cache, because the BOs don't + * get zeroed, and that might leak data between users. + */ +- bo = vc4_bo_create(dev, args->size, false); ++ bo = vc4_bo_create(dev, args->size, false, VC4_BO_TYPE_V3D); + if (IS_ERR(bo)) + return PTR_ERR(bo); + +@@ -501,7 +589,7 @@ vc4_create_shader_bo_ioctl(struct drm_device *dev, void *data, + return -EINVAL; + } + +- bo = vc4_bo_create(dev, args->size, true); ++ bo = vc4_bo_create(dev, args->size, true, VC4_BO_TYPE_V3D_SHADER); + if (IS_ERR(bo)) + return PTR_ERR(bo); + +@@ -617,9 +705,24 @@ int vc4_get_tiling_ioctl(struct drm_device *dev, void *data, + return 0; + } + +-void vc4_bo_cache_init(struct drm_device *dev) ++int vc4_bo_cache_init(struct drm_device *dev) + { + struct vc4_dev *vc4 = to_vc4_dev(dev); ++ int i; ++ ++ /* Create the initial set of BO labels that the kernel will ++ * use. This lets us avoid a bunch of string reallocation in ++ * the kernel's draw and BO allocation paths. ++ */ ++ vc4->bo_labels = kcalloc(VC4_BO_TYPE_COUNT, sizeof(*vc4->bo_labels), ++ GFP_KERNEL); ++ if (!vc4->bo_labels) ++ return -ENOMEM; ++ vc4->num_labels = VC4_BO_TYPE_COUNT; ++ ++ BUILD_BUG_ON(ARRAY_SIZE(bo_type_names) != VC4_BO_TYPE_COUNT); ++ for (i = 0; i < VC4_BO_TYPE_COUNT; i++) ++ vc4->bo_labels[i].name = bo_type_names[i]; + + mutex_init(&vc4->bo_lock); + +@@ -629,19 +732,66 @@ void vc4_bo_cache_init(struct drm_device *dev) + setup_timer(&vc4->bo_cache.time_timer, + vc4_bo_cache_time_timer, + (unsigned long)dev); ++ ++ return 0; + } + + void vc4_bo_cache_destroy(struct drm_device *dev) + { + struct vc4_dev *vc4 = to_vc4_dev(dev); ++ int i; + + del_timer(&vc4->bo_cache.time_timer); + cancel_work_sync(&vc4->bo_cache.time_work); + + vc4_bo_cache_purge(dev); + +- if (vc4->bo_stats.num_allocated) { +- DRM_ERROR("Destroying BO cache while BOs still allocated:\n"); +- vc4_bo_stats_dump(vc4); ++ for (i = 0; i < vc4->num_labels; i++) { ++ if (vc4->bo_labels[i].num_allocated) { ++ DRM_ERROR("Destroying BO cache with %d %s " ++ "BOs still allocated\n", ++ vc4->bo_labels[i].num_allocated, ++ vc4->bo_labels[i].name); ++ } ++ ++ if (is_user_label(i)) ++ kfree(vc4->bo_labels[i].name); ++ } ++ kfree(vc4->bo_labels); ++} ++ ++int vc4_label_bo_ioctl(struct drm_device *dev, void *data, ++ struct drm_file *file_priv) ++{ ++ struct vc4_dev *vc4 = to_vc4_dev(dev); ++ struct drm_vc4_label_bo *args = data; ++ char *name; ++ struct drm_gem_object *gem_obj; ++ int ret = 0, label; ++ ++ if (!args->len) ++ return -EINVAL; ++ ++ name = strndup_user(u64_to_user_ptr(args->name), args->len + 1); ++ if (IS_ERR(name)) ++ return PTR_ERR(name); ++ ++ gem_obj = drm_gem_object_lookup(file_priv, args->handle); ++ if (!gem_obj) { ++ DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); ++ kfree(name); ++ return -ENOENT; + } ++ ++ mutex_lock(&vc4->bo_lock); ++ label = vc4_get_user_label(vc4, name); ++ if (label != -1) ++ vc4_bo_set_label(gem_obj, label); ++ else ++ ret = -ENOMEM; ++ mutex_unlock(&vc4->bo_lock); ++ ++ drm_gem_object_unreference_unlocked(gem_obj); ++ ++ return ret; + } +diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c +index f528edc4b389e2e3843cd8be2faccf62947cbda4..e28fb8323a23d8bfe7cb5a0c234510ef9520b2fc 100644 +--- a/drivers/gpu/drm/vc4/vc4_drv.c ++++ b/drivers/gpu/drm/vc4/vc4_drv.c +@@ -126,6 +126,7 @@ static const struct drm_ioctl_desc vc4_drm_ioctls[] = { + DRM_IOCTL_DEF_DRV(VC4_GET_PARAM, vc4_get_param_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(VC4_SET_TILING, vc4_set_tiling_ioctl, DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(VC4_GET_TILING, vc4_get_tiling_ioctl, DRM_RENDER_ALLOW), ++ DRM_IOCTL_DEF_DRV(VC4_LABEL_BO, vc4_label_bo_ioctl, DRM_RENDER_ALLOW), + }; + + static struct drm_driver vc4_drm_driver = { +@@ -246,7 +247,9 @@ static int vc4_drm_bind(struct device *dev) + vc4->dev = drm; + drm->dev_private = vc4; + +- vc4_bo_cache_init(drm); ++ ret = vc4_bo_cache_init(drm); ++ if (ret) ++ goto dev_unref; + + drm_mode_config_init(drm); + +@@ -270,8 +273,9 @@ static int vc4_drm_bind(struct device *dev) + component_unbind_all(dev, drm); + gem_destroy: + vc4_gem_destroy(drm); +- drm_dev_unref(drm); + vc4_bo_cache_destroy(drm); ++dev_unref: ++ drm_dev_unref(drm); + return ret; + } + +diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h +index fcf1c45783736413c058a33f31e189ebaddb446e..585da9b8cdfec1548fb1466ad72c952f130078da 100644 +--- a/drivers/gpu/drm/vc4/vc4_drv.h ++++ b/drivers/gpu/drm/vc4/vc4_drv.h +@@ -9,6 +9,24 @@ + #include "drmP.h" + #include "drm_gem_cma_helper.h" + ++/* Don't forget to update vc4_bo.c: bo_type_names[] when adding to ++ * this. ++ */ ++enum vc4_kernel_bo_type { ++ /* Any kernel allocation (gem_create_object hook) before it ++ * gets another type set. ++ */ ++ VC4_BO_TYPE_KERNEL, ++ VC4_BO_TYPE_V3D, ++ VC4_BO_TYPE_V3D_SHADER, ++ VC4_BO_TYPE_DUMB, ++ VC4_BO_TYPE_BIN, ++ VC4_BO_TYPE_RCL, ++ VC4_BO_TYPE_BCL, ++ VC4_BO_TYPE_KERNEL_CACHE, ++ VC4_BO_TYPE_COUNT ++}; ++ + struct vc4_dev { + struct drm_device *dev; + +@@ -48,14 +66,14 @@ struct vc4_dev { + struct timer_list time_timer; + } bo_cache; + +- struct vc4_bo_stats { ++ u32 num_labels; ++ struct vc4_label { ++ const char *name; + u32 num_allocated; + u32 size_allocated; +- u32 num_cached; +- u32 size_cached; +- } bo_stats; ++ } *bo_labels; + +- /* Protects bo_cache and the BO stats. */ ++ /* Protects bo_cache and bo_labels. */ + struct mutex bo_lock; + + /* Sequence number for the last job queued in bin_job_list. +@@ -165,6 +183,11 @@ struct vc4_bo { + * DRM_IOCTL_VC4_CREATE_SHADER_BO. + */ + struct vc4_validated_shader_info *validated_shader; ++ ++ /* One of enum vc4_kernel_bo_type, or VC4_BO_TYPE_COUNT + i ++ * for user-allocated labels. ++ */ ++ int label; + }; + + static inline struct vc4_bo * +@@ -440,7 +463,7 @@ struct vc4_validated_shader_info { + struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size); + void vc4_free_object(struct drm_gem_object *gem_obj); + struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t size, +- bool from_cache); ++ bool from_cache, enum vc4_kernel_bo_type type); + int vc4_dumb_create(struct drm_file *file_priv, + struct drm_device *dev, + struct drm_mode_create_dumb *args); +@@ -458,10 +481,12 @@ int vc4_get_tiling_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv); + int vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, + struct drm_file *file_priv); ++int vc4_label_bo_ioctl(struct drm_device *dev, void *data, ++ struct drm_file *file_priv); + int vc4_mmap(struct file *filp, struct vm_area_struct *vma); + int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma); + void *vc4_prime_vmap(struct drm_gem_object *obj); +-void vc4_bo_cache_init(struct drm_device *dev); ++int vc4_bo_cache_init(struct drm_device *dev); + void vc4_bo_cache_destroy(struct drm_device *dev); + int vc4_bo_stats_debugfs(struct seq_file *m, void *arg); + +diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c +index 7e90ea1702994531a734b322393021364d5284b3..adb94d573a1881062ac0dee42a627746faea8657 100644 +--- a/drivers/gpu/drm/vc4/vc4_gem.c ++++ b/drivers/gpu/drm/vc4/vc4_gem.c +@@ -645,7 +645,7 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) + goto fail; + } + +- bo = vc4_bo_create(dev, exec_size, true); ++ bo = vc4_bo_create(dev, exec_size, true, VC4_BO_TYPE_BCL); + if (IS_ERR(bo)) { + DRM_ERROR("Couldn't allocate BO for binning\n"); + ret = PTR_ERR(bo); +diff --git a/drivers/gpu/drm/vc4/vc4_render_cl.c b/drivers/gpu/drm/vc4/vc4_render_cl.c +index 6face6aa0890b59bc91d3740fa063a5c46f7cc21..eb2794b12efe43dea0408fe772e8426628ae849f 100644 +--- a/drivers/gpu/drm/vc4/vc4_render_cl.c ++++ b/drivers/gpu/drm/vc4/vc4_render_cl.c +@@ -316,7 +316,7 @@ static int vc4_create_rcl_bo(struct drm_device *dev, struct vc4_exec_info *exec, + + size += xtiles * ytiles * loop_body_size; + +- setup->rcl = &vc4_bo_create(dev, size, true)->base; ++ setup->rcl = &vc4_bo_create(dev, size, true, VC4_BO_TYPE_RCL)->base; + if (IS_ERR(setup->rcl)) + return PTR_ERR(setup->rcl); + list_add_tail(&to_vc4_bo(&setup->rcl->base)->unref_head, +diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c +index 77ed4ef3b8c8685a3cd8c871bbd249debc4e2ac4..5a980e6692bcc9ae18b44608d1fdca874fcc61b6 100644 +--- a/drivers/gpu/drm/vc4/vc4_v3d.c ++++ b/drivers/gpu/drm/vc4/vc4_v3d.c +@@ -235,7 +235,8 @@ vc4_allocate_bin_bo(struct drm_device *drm) + INIT_LIST_HEAD(&list); + + while (true) { +- struct vc4_bo *bo = vc4_bo_create(drm, size, true); ++ struct vc4_bo *bo = vc4_bo_create(drm, size, true, ++ VC4_BO_TYPE_BIN); + + if (IS_ERR(bo)) { + ret = PTR_ERR(bo); +diff --git a/include/uapi/drm/vc4_drm.h b/include/uapi/drm/vc4_drm.h +index 6ac4c5c014cb9b98343f25721f74b727a88f2bb5..551628e571f955b1a69e57276f228ae1fc09af5c 100644 +--- a/include/uapi/drm/vc4_drm.h ++++ b/include/uapi/drm/vc4_drm.h +@@ -40,6 +40,7 @@ extern "C" { + #define DRM_VC4_GET_PARAM 0x07 + #define DRM_VC4_SET_TILING 0x08 + #define DRM_VC4_GET_TILING 0x09 ++#define DRM_VC4_LABEL_BO 0x0a + + #define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) + #define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) +@@ -51,6 +52,7 @@ extern "C" { + #define DRM_IOCTL_VC4_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_PARAM, struct drm_vc4_get_param) + #define DRM_IOCTL_VC4_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SET_TILING, struct drm_vc4_set_tiling) + #define DRM_IOCTL_VC4_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_TILING, struct drm_vc4_get_tiling) ++#define DRM_IOCTL_VC4_LABEL_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_LABEL_BO, struct drm_vc4_label_bo) + + struct drm_vc4_submit_rcl_surface { + __u32 hindex; /* Handle index, or ~0 if not present. */ +@@ -311,6 +313,15 @@ struct drm_vc4_set_tiling { + __u64 modifier; + }; + ++/** ++ * struct drm_vc4_label_bo - Attach a name to a BO for debug purposes. ++ */ ++struct drm_vc4_label_bo { ++ __u32 handle; ++ __u32 len; ++ __u64 name; ++}; ++ + #if defined(__cplusplus) + } + #endif + +From 0de7e84aa87f8690ddde6e720b1c1d9134c83b78 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Tue, 25 Jul 2017 11:27:18 -0700 +Subject: [PATCH 376/407] drm/vc4: Convert more lock requirement comments to + lockdep assertions. + +Since I do my development with lockdep on, this will help make sure I +don't introduce bugs here. + +Signed-off-by: Eric Anholt +Link: https://patchwork.freedesktop.org/patch/msgid/20170725182718.31468-3-eric@anholt.net +Reviewed-by: Daniel Vetter +(cherry picked from commit 4e6b1e91253ebf701b4ec3586cba5596527a4d0a) +--- + drivers/gpu/drm/vc4/vc4_bo.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c +index 42dd21a736bd6c9f8cba84a0dc21d46751efb976..3e89326033d7fe4d53ada276ec6fd4f82ba663cf 100644 +--- a/drivers/gpu/drm/vc4/vc4_bo.c ++++ b/drivers/gpu/drm/vc4/vc4_bo.c +@@ -160,10 +160,12 @@ static uint32_t bo_page_index(size_t size) + return (size / PAGE_SIZE) - 1; + } + +-/* Must be called with bo_lock held. */ + static void vc4_bo_destroy(struct vc4_bo *bo) + { + struct drm_gem_object *obj = &bo->base.base; ++ struct vc4_dev *vc4 = to_vc4_dev(obj->dev); ++ ++ lockdep_assert_held(&vc4->bo_lock); + + vc4_bo_set_label(obj, -1); + +@@ -176,9 +178,11 @@ static void vc4_bo_destroy(struct vc4_bo *bo) + drm_gem_cma_free_object(obj); + } + +-/* Must be called with bo_lock held. */ + static void vc4_bo_remove_from_cache(struct vc4_bo *bo) + { ++ struct vc4_dev *vc4 = to_vc4_dev(bo->base.base.dev); ++ ++ lockdep_assert_held(&vc4->bo_lock); + list_del(&bo->unref_head); + list_del(&bo->size_head); + } +@@ -358,12 +362,13 @@ int vc4_dumb_create(struct drm_file *file_priv, + return ret; + } + +-/* Must be called with bo_lock held. */ + static void vc4_bo_cache_free_old(struct drm_device *dev) + { + struct vc4_dev *vc4 = to_vc4_dev(dev); + unsigned long expire_time = jiffies - msecs_to_jiffies(1000); + ++ lockdep_assert_held(&vc4->bo_lock); ++ + while (!list_empty(&vc4->bo_cache.time_list)) { + struct vc4_bo *bo = list_last_entry(&vc4->bo_cache.time_list, + struct vc4_bo, unref_head); + +From d6d968c774a7d93609731f8bba39a13b2139aae5 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Tue, 27 Jun 2017 12:58:32 -0700 +Subject: [PATCH 377/407] drm/vc4: Fix DSI T_INIT timing. + +The DPHY spec requires a much larger T_INIT than I was specifying +before. In the absence of clear specs from the slave of what their +timing is, just use the value that the firmware was using. + +Signed-off-by: Eric Anholt +Link: http://patchwork.freedesktop.org/patch/msgid/20170627195839.3338-2-eric@anholt.net +Reviewed-by: Andrzej Hajda +(cherry picked from commit e65d51126f89a0d67ee6c5df58363730b1410ab5) +--- + drivers/gpu/drm/vc4/vc4_dsi.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c +index 284f486ed9dbf44ff706cce7d111965fb82fab11..5dcd03724c4ae53ae45513903db5036438f4dffa 100644 +--- a/drivers/gpu/drm/vc4/vc4_dsi.c ++++ b/drivers/gpu/drm/vc4/vc4_dsi.c +@@ -1102,7 +1102,17 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *encoder) + DSI_HS_DLT4_TRAIL) | + VC4_SET_FIELD(0, DSI_HS_DLT4_ANLAT)); + +- DSI_PORT_WRITE(HS_DLT5, VC4_SET_FIELD(dsi_hs_timing(ui_ns, 1000, 5000), ++ /* T_INIT is how long STOP is driven after power-up to ++ * indicate to the slave (also coming out of power-up) that ++ * master init is complete, and should be greater than the ++ * maximum of two value: T_INIT,MASTER and T_INIT,SLAVE. The ++ * D-PHY spec gives a minimum 100us for T_INIT,MASTER and ++ * T_INIT,SLAVE, while allowing protocols on top of it to give ++ * greater minimums. The vc4 firmware uses an extremely ++ * conservative 5ms, and we maintain that here. ++ */ ++ DSI_PORT_WRITE(HS_DLT5, VC4_SET_FIELD(dsi_hs_timing(ui_ns, ++ 5 * 1000 * 1000, 0), + DSI_HS_DLT5_INIT)); + + DSI_PORT_WRITE(HS_DLT6, + +From f83778f202a5ccc53796561e283c6f9faebdeb56 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Tue, 27 Jun 2017 12:58:33 -0700 +Subject: [PATCH 378/407] drm/vc4: Fix misleading name of the continuous flag. + +The logic was all right in the end, the name was just backwards. + +Signed-off-by: Eric Anholt +Link: http://patchwork.freedesktop.org/patch/msgid/20170627195839.3338-3-eric@anholt.net +Reviewed-by: Andrzej Hajda +(cherry picked from commit ec878c0756a0c202e86256dca1de307ab1189ab8) +--- + drivers/gpu/drm/vc4/vc4_dsi.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c +index 5dcd03724c4ae53ae45513903db5036438f4dffa..c39dcf302c16ee53ae0cfb1d17d307d24f08aaf1 100644 +--- a/drivers/gpu/drm/vc4/vc4_dsi.c ++++ b/drivers/gpu/drm/vc4/vc4_dsi.c +@@ -828,18 +828,18 @@ static void vc4_dsi_latch_ulps(struct vc4_dsi *dsi, bool latch) + /* Enters or exits Ultra Low Power State. */ + static void vc4_dsi_ulps(struct vc4_dsi *dsi, bool ulps) + { +- bool continuous = dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS; +- u32 phyc_ulps = ((continuous ? DSI_PORT_BIT(PHYC_CLANE_ULPS) : 0) | ++ bool non_continuous = dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS; ++ u32 phyc_ulps = ((non_continuous ? DSI_PORT_BIT(PHYC_CLANE_ULPS) : 0) | + DSI_PHYC_DLANE0_ULPS | + (dsi->lanes > 1 ? DSI_PHYC_DLANE1_ULPS : 0) | + (dsi->lanes > 2 ? DSI_PHYC_DLANE2_ULPS : 0) | + (dsi->lanes > 3 ? DSI_PHYC_DLANE3_ULPS : 0)); +- u32 stat_ulps = ((continuous ? DSI1_STAT_PHY_CLOCK_ULPS : 0) | ++ u32 stat_ulps = ((non_continuous ? DSI1_STAT_PHY_CLOCK_ULPS : 0) | + DSI1_STAT_PHY_D0_ULPS | + (dsi->lanes > 1 ? DSI1_STAT_PHY_D1_ULPS : 0) | + (dsi->lanes > 2 ? DSI1_STAT_PHY_D2_ULPS : 0) | + (dsi->lanes > 3 ? DSI1_STAT_PHY_D3_ULPS : 0)); +- u32 stat_stop = ((continuous ? DSI1_STAT_PHY_CLOCK_STOP : 0) | ++ u32 stat_stop = ((non_continuous ? DSI1_STAT_PHY_CLOCK_STOP : 0) | + DSI1_STAT_PHY_D0_STOP | + (dsi->lanes > 1 ? DSI1_STAT_PHY_D1_STOP : 0) | + (dsi->lanes > 2 ? DSI1_STAT_PHY_D2_STOP : 0) | + +From ffd4688d1f19d5e9aad08d8254d3d14a99b73ce1 Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Tue, 11 Apr 2017 18:39:25 +0200 +Subject: [PATCH 379/407] drm/vc4: Add runtime PM support to the HDMI encoder + driver + +The HDMI driver is currently enabling all clocks at probe time and +keeps the power-domain connected to the HDMI encoder enabled. + +Move all activation code to vc4_hdmi_encoder_enable() and make sure +the clks and power domain are released when the HDMI encoder is not used +by adding deactivation steps in vc4_hdmi_encoder_disable(). + +Note that the sequencing imposed by the IP requires that we move +vc4_hdmi_encoder_mode_set() code into vc4_hdmi_encoder_enable(). + +Signed-off-by: Boris Brezillon +Signed-off-by: Eric Anholt +Reviewed-by: Eric Anholt +(cherry picked from commit 4f6e3d66ac522dec9733d433ad00e8e77747c372) +--- + drivers/gpu/drm/vc4/vc4_hdmi.c | 174 ++++++++++++++++++++++------------------- + 1 file changed, 92 insertions(+), 82 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c +index 8db1016cad929438f30ea44c6974dcb340b74596..d299fb40b847db59a2af7d07848b6563f14ffb2d 100644 +--- a/drivers/gpu/drm/vc4/vc4_hdmi.c ++++ b/drivers/gpu/drm/vc4/vc4_hdmi.c +@@ -34,6 +34,7 @@ + #include "linux/of_address.h" + #include "linux/of_gpio.h" + #include "linux/of_platform.h" ++#include "linux/pm_runtime.h" + #include "linux/rational.h" + #include "sound/dmaengine_pcm.h" + #include "sound/pcm_drm_eld.h" +@@ -436,13 +437,38 @@ static void vc4_hdmi_set_infoframes(struct drm_encoder *encoder) + vc4_hdmi_set_spd_infoframe(encoder); + } + +-static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder, +- struct drm_display_mode *unadjusted_mode, +- struct drm_display_mode *mode) ++static void vc4_hdmi_encoder_disable(struct drm_encoder *encoder) ++{ ++ struct drm_device *dev = encoder->dev; ++ struct vc4_dev *vc4 = to_vc4_dev(dev); ++ struct vc4_hdmi *hdmi = vc4->hdmi; ++ int ret; ++ ++ HDMI_WRITE(VC4_HDMI_RAM_PACKET_CONFIG, 0); ++ ++ HDMI_WRITE(VC4_HDMI_TX_PHY_RESET_CTL, 0xf << 16); ++ HD_WRITE(VC4_HD_VID_CTL, ++ HD_READ(VC4_HD_VID_CTL) & ~VC4_HD_VID_CTL_ENABLE); ++ ++ HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST); ++ udelay(1); ++ HD_WRITE(VC4_HD_M_CTL, 0); ++ ++ clk_disable_unprepare(hdmi->hsm_clock); ++ clk_disable_unprepare(hdmi->pixel_clock); ++ ++ ret = pm_runtime_put(&hdmi->pdev->dev); ++ if (ret < 0) ++ DRM_ERROR("Failed to release power domain: %d\n", ret); ++} ++ ++static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) + { ++ struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; + struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder); + struct drm_device *dev = encoder->dev; + struct vc4_dev *vc4 = to_vc4_dev(dev); ++ struct vc4_hdmi *hdmi = vc4->hdmi; + bool debug_dump_regs = false; + bool hsync_pos = mode->flags & DRM_MODE_FLAG_PHSYNC; + bool vsync_pos = mode->flags & DRM_MODE_FLAG_PVSYNC; +@@ -462,6 +488,64 @@ static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder, + interlaced, + VC4_HDMI_VERTB_VBP)); + u32 csc_ctl; ++ int ret; ++ ++ ret = pm_runtime_get_sync(&hdmi->pdev->dev); ++ if (ret < 0) { ++ DRM_ERROR("Failed to retain power domain: %d\n", ret); ++ return; ++ } ++ ++ /* This is the rate that is set by the firmware. The number ++ * needs to be a bit higher than the pixel clock rate ++ * (generally 148.5Mhz). ++ */ ++ ret = clk_set_rate(hdmi->hsm_clock, 163682864); ++ if (ret) { ++ DRM_ERROR("Failed to set HSM clock rate: %d\n", ret); ++ return; ++ } ++ ++ ret = clk_set_rate(hdmi->pixel_clock, ++ mode->clock * 1000 * ++ ((mode->flags & DRM_MODE_FLAG_DBLCLK) ? 2 : 1)); ++ if (ret) { ++ DRM_ERROR("Failed to set pixel clock rate: %d\n", ret); ++ return; ++ } ++ ++ ret = clk_prepare_enable(hdmi->pixel_clock); ++ if (ret) { ++ DRM_ERROR("Failed to turn on pixel clock: %d\n", ret); ++ return; ++ } ++ ++ ret = clk_prepare_enable(hdmi->hsm_clock); ++ if (ret) { ++ DRM_ERROR("Failed to turn on HDMI state machine clock: %d\n", ++ ret); ++ clk_disable_unprepare(hdmi->pixel_clock); ++ return; ++ } ++ ++ HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST); ++ udelay(1); ++ HD_WRITE(VC4_HD_M_CTL, 0); ++ ++ HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_ENABLE); ++ ++ HDMI_WRITE(VC4_HDMI_SW_RESET_CONTROL, ++ VC4_HDMI_SW_RESET_HDMI | ++ VC4_HDMI_SW_RESET_FORMAT_DETECT); ++ ++ HDMI_WRITE(VC4_HDMI_SW_RESET_CONTROL, 0); ++ ++ /* PHY should be in reset, like ++ * vc4_hdmi_encoder_disable() does. ++ */ ++ HDMI_WRITE(VC4_HDMI_TX_PHY_RESET_CTL, 0xf << 16); ++ ++ HDMI_WRITE(VC4_HDMI_TX_PHY_RESET_CTL, 0); + + if (debug_dump_regs) { + DRM_INFO("HDMI regs before:\n"); +@@ -470,9 +554,6 @@ static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder, + + HD_WRITE(VC4_HD_VID_CTL, 0); + +- clk_set_rate(vc4->hdmi->pixel_clock, mode->clock * 1000 * +- ((mode->flags & DRM_MODE_FLAG_DBLCLK) ? 2 : 1)); +- + HDMI_WRITE(VC4_HDMI_SCHEDULER_CONTROL, + HDMI_READ(VC4_HDMI_SCHEDULER_CONTROL) | + VC4_HDMI_SCHEDULER_CONTROL_MANUAL_FORMAT | +@@ -544,28 +625,6 @@ static void vc4_hdmi_encoder_mode_set(struct drm_encoder *encoder, + DRM_INFO("HDMI regs after:\n"); + vc4_hdmi_dump_regs(dev); + } +-} +- +-static void vc4_hdmi_encoder_disable(struct drm_encoder *encoder) +-{ +- struct drm_device *dev = encoder->dev; +- struct vc4_dev *vc4 = to_vc4_dev(dev); +- +- HDMI_WRITE(VC4_HDMI_RAM_PACKET_CONFIG, 0); +- +- HDMI_WRITE(VC4_HDMI_TX_PHY_RESET_CTL, 0xf << 16); +- HD_WRITE(VC4_HD_VID_CTL, +- HD_READ(VC4_HD_VID_CTL) & ~VC4_HD_VID_CTL_ENABLE); +-} +- +-static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) +-{ +- struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder); +- struct drm_device *dev = encoder->dev; +- struct vc4_dev *vc4 = to_vc4_dev(dev); +- int ret; +- +- HDMI_WRITE(VC4_HDMI_TX_PHY_RESET_CTL, 0); + + HD_WRITE(VC4_HD_VID_CTL, + HD_READ(VC4_HD_VID_CTL) | +@@ -631,7 +690,6 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) + } + + static const struct drm_encoder_helper_funcs vc4_hdmi_encoder_helper_funcs = { +- .mode_set = vc4_hdmi_encoder_mode_set, + .disable = vc4_hdmi_encoder_disable, + .enable = vc4_hdmi_encoder_enable, + }; +@@ -1132,33 +1190,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) + return -EPROBE_DEFER; + } + +- /* Enable the clocks at startup. We can't quite recover from +- * turning off the pixel clock during disable/enables yet, so +- * it's always running. +- */ +- ret = clk_prepare_enable(hdmi->pixel_clock); +- if (ret) { +- DRM_ERROR("Failed to turn on pixel clock: %d\n", ret); +- goto err_put_i2c; +- } +- +- /* This is the rate that is set by the firmware. The number +- * needs to be a bit higher than the pixel clock rate +- * (generally 148.5Mhz). +- */ +- ret = clk_set_rate(hdmi->hsm_clock, 163682864); +- if (ret) { +- DRM_ERROR("Failed to set HSM clock rate: %d\n", ret); +- goto err_unprepare_pix; +- } +- +- ret = clk_prepare_enable(hdmi->hsm_clock); +- if (ret) { +- DRM_ERROR("Failed to turn on HDMI state machine clock: %d\n", +- ret); +- goto err_unprepare_pix; +- } +- + /* Only use the GPIO HPD pin if present in the DT, otherwise + * we'll use the HDMI core's register. + */ +@@ -1170,7 +1201,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) + &hpd_gpio_flags); + if (hdmi->hpd_gpio < 0) { + ret = hdmi->hpd_gpio; +- goto err_unprepare_hsm; ++ goto err_put_i2c; + } + + hdmi->hpd_active_low = hpd_gpio_flags & OF_GPIO_ACTIVE_LOW; +@@ -1178,25 +1209,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) + + vc4->hdmi = hdmi; + +- /* HDMI core must be enabled. */ +- if (!(HD_READ(VC4_HD_M_CTL) & VC4_HD_M_ENABLE)) { +- HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST); +- udelay(1); +- HD_WRITE(VC4_HD_M_CTL, 0); +- +- HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_ENABLE); +- +- HDMI_WRITE(VC4_HDMI_SW_RESET_CONTROL, +- VC4_HDMI_SW_RESET_HDMI | +- VC4_HDMI_SW_RESET_FORMAT_DETECT); +- +- HDMI_WRITE(VC4_HDMI_SW_RESET_CONTROL, 0); +- +- /* PHY should be in reset, like +- * vc4_hdmi_encoder_disable() does. +- */ +- HDMI_WRITE(VC4_HDMI_TX_PHY_RESET_CTL, 0xf << 16); +- } ++ pm_runtime_enable(dev); + + drm_encoder_init(drm, hdmi->encoder, &vc4_hdmi_encoder_funcs, + DRM_MODE_ENCODER_TMDS, NULL); +@@ -1216,10 +1229,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) + + err_destroy_encoder: + vc4_hdmi_encoder_destroy(hdmi->encoder); +-err_unprepare_hsm: +- clk_disable_unprepare(hdmi->hsm_clock); +-err_unprepare_pix: +- clk_disable_unprepare(hdmi->pixel_clock); ++ pm_runtime_disable(dev); + err_put_i2c: + put_device(&hdmi->ddc->dev); + +@@ -1238,8 +1248,8 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master, + vc4_hdmi_connector_destroy(hdmi->connector); + vc4_hdmi_encoder_destroy(hdmi->encoder); + +- clk_disable_unprepare(hdmi->pixel_clock); +- clk_disable_unprepare(hdmi->hsm_clock); ++ pm_runtime_disable(dev); ++ + put_device(&hdmi->ddc->dev); + + vc4->hdmi = NULL; + +From 1e19cd5a4ffde27b60197b0c2d432589acb4c841 Mon Sep 17 00:00:00 2001 +From: Hans Verkuil +Date: Sun, 16 Jul 2017 12:48:03 +0200 +Subject: [PATCH 380/407] drm/vc4: prepare for CEC support + +In order to support CEC the hsm clock needs to be enabled in +vc4_hdmi_bind(), not in vc4_hdmi_encoder_enable(). Otherwise you wouldn't +be able to support CEC when there is no hotplug detect signal, which is +required by some monitors that turn off the HPD when in standby, but keep +the CEC bus alive so they can be woken up. + +The HDMI core also has to be enabled in vc4_hdmi_bind() for the same +reason. + +Signed-off-by: Hans Verkuil +Signed-off-by: Eric Anholt +Reviewed-by: Eric Anholt +Link: https://patchwork.freedesktop.org/patch/msgid/20170716104804.48308-3-hverkuil@xs4all.nl +(cherry picked from commit 10ee275cb12f884ce09bed69ea387eae73d7fece) +--- + drivers/gpu/drm/vc4/vc4_hdmi.c | 59 +++++++++++++++++++++--------------------- + 1 file changed, 29 insertions(+), 30 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c +index d299fb40b847db59a2af7d07848b6563f14ffb2d..aa4b900a583cbbe6a5f10dd2c2f7f5bd531a2524 100644 +--- a/drivers/gpu/drm/vc4/vc4_hdmi.c ++++ b/drivers/gpu/drm/vc4/vc4_hdmi.c +@@ -450,11 +450,6 @@ static void vc4_hdmi_encoder_disable(struct drm_encoder *encoder) + HD_WRITE(VC4_HD_VID_CTL, + HD_READ(VC4_HD_VID_CTL) & ~VC4_HD_VID_CTL_ENABLE); + +- HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST); +- udelay(1); +- HD_WRITE(VC4_HD_M_CTL, 0); +- +- clk_disable_unprepare(hdmi->hsm_clock); + clk_disable_unprepare(hdmi->pixel_clock); + + ret = pm_runtime_put(&hdmi->pdev->dev); +@@ -496,16 +491,6 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) + return; + } + +- /* This is the rate that is set by the firmware. The number +- * needs to be a bit higher than the pixel clock rate +- * (generally 148.5Mhz). +- */ +- ret = clk_set_rate(hdmi->hsm_clock, 163682864); +- if (ret) { +- DRM_ERROR("Failed to set HSM clock rate: %d\n", ret); +- return; +- } +- + ret = clk_set_rate(hdmi->pixel_clock, + mode->clock * 1000 * + ((mode->flags & DRM_MODE_FLAG_DBLCLK) ? 2 : 1)); +@@ -520,20 +505,6 @@ static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder) + return; + } + +- ret = clk_prepare_enable(hdmi->hsm_clock); +- if (ret) { +- DRM_ERROR("Failed to turn on HDMI state machine clock: %d\n", +- ret); +- clk_disable_unprepare(hdmi->pixel_clock); +- return; +- } +- +- HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST); +- udelay(1); +- HD_WRITE(VC4_HD_M_CTL, 0); +- +- HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_ENABLE); +- + HDMI_WRITE(VC4_HDMI_SW_RESET_CONTROL, + VC4_HDMI_SW_RESET_HDMI | + VC4_HDMI_SW_RESET_FORMAT_DETECT); +@@ -1190,6 +1161,23 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) + return -EPROBE_DEFER; + } + ++ /* This is the rate that is set by the firmware. The number ++ * needs to be a bit higher than the pixel clock rate ++ * (generally 148.5Mhz). ++ */ ++ ret = clk_set_rate(hdmi->hsm_clock, 163682864); ++ if (ret) { ++ DRM_ERROR("Failed to set HSM clock rate: %d\n", ret); ++ goto err_put_i2c; ++ } ++ ++ ret = clk_prepare_enable(hdmi->hsm_clock); ++ if (ret) { ++ DRM_ERROR("Failed to turn on HDMI state machine clock: %d\n", ++ ret); ++ goto err_put_i2c; ++ } ++ + /* Only use the GPIO HPD pin if present in the DT, otherwise + * we'll use the HDMI core's register. + */ +@@ -1201,7 +1189,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) + &hpd_gpio_flags); + if (hdmi->hpd_gpio < 0) { + ret = hdmi->hpd_gpio; +- goto err_put_i2c; ++ goto err_unprepare_hsm; + } + + hdmi->hpd_active_low = hpd_gpio_flags & OF_GPIO_ACTIVE_LOW; +@@ -1209,6 +1197,14 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) + + vc4->hdmi = hdmi; + ++ /* HDMI core must be enabled. */ ++ if (!(HD_READ(VC4_HD_M_CTL) & VC4_HD_M_ENABLE)) { ++ HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST); ++ udelay(1); ++ HD_WRITE(VC4_HD_M_CTL, 0); ++ ++ HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_ENABLE); ++ } + pm_runtime_enable(dev); + + drm_encoder_init(drm, hdmi->encoder, &vc4_hdmi_encoder_funcs, +@@ -1229,6 +1225,8 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) + + err_destroy_encoder: + vc4_hdmi_encoder_destroy(hdmi->encoder); ++err_unprepare_hsm: ++ clk_disable_unprepare(hdmi->hsm_clock); + pm_runtime_disable(dev); + err_put_i2c: + put_device(&hdmi->ddc->dev); +@@ -1248,6 +1246,7 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master, + vc4_hdmi_connector_destroy(hdmi->connector); + vc4_hdmi_encoder_destroy(hdmi->encoder); + ++ clk_disable_unprepare(hdmi->hsm_clock); + pm_runtime_disable(dev); + + put_device(&hdmi->ddc->dev); + +From 07e81b8c2b2e2c8b948cc6902433d07c2726a943 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Fri, 14 Jul 2017 17:33:08 -0700 +Subject: [PATCH 381/407] drm/vc4: Fix pitch setup for T-format scanout. + +The documentation said to use src_w here, and I didn't consider that +we actually needed to be using pitch somewhere in our setup. Fixes +scanout on my DSI panel when X11 does initial setup with 1920x1080 +HDMI and 800x480 DSI both at 0,0 of the same framebuffer. + +Signed-off-by: Eric Anholt +Fixes: 98830d91da08 ("drm/vc4: Add T-format scanout support.") +--- + drivers/gpu/drm/vc4/vc4_plane.c | 20 +++++++++++++++----- + 1 file changed, 15 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c +index 62c5f7df0f1a0034bf0b5630eba1344a0f85897b..8931d3f649f849ec755422360dd6188b0a9ffaa5 100644 +--- a/drivers/gpu/drm/vc4/vc4_plane.c ++++ b/drivers/gpu/drm/vc4/vc4_plane.c +@@ -547,14 +547,24 @@ static int vc4_plane_mode_set(struct drm_plane *plane, + tiling = SCALER_CTL0_TILING_LINEAR; + pitch0 = VC4_SET_FIELD(fb->pitches[0], SCALER_SRC_PITCH); + break; +- case DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED: ++ ++ case DRM_FORMAT_MOD_BROADCOM_VC4_T_TILED: { ++ /* For T-tiled, the FB pitch is "how many bytes from ++ * one row to the next, such that pitch * tile_h == ++ * tile_size * tiles_per_row." ++ */ ++ u32 tile_size_shift = 12; ++ u32 tile_h_shift = 5; ++ u32 tiles_w = fb->pitches[0] >> (tile_size_shift - tile_h_shift); ++ + tiling = SCALER_CTL0_TILING_256B_OR_T; + +- pitch0 = (VC4_SET_FIELD(0, SCALER_PITCH0_TILE_Y_OFFSET), +- VC4_SET_FIELD(0, SCALER_PITCH0_TILE_WIDTH_L), +- VC4_SET_FIELD((vc4_state->src_w[0] + 31) >> 5, +- SCALER_PITCH0_TILE_WIDTH_R)); ++ pitch0 = (VC4_SET_FIELD(0, SCALER_PITCH0_TILE_Y_OFFSET) | ++ VC4_SET_FIELD(0, SCALER_PITCH0_TILE_WIDTH_L) | ++ VC4_SET_FIELD(tiles_w, SCALER_PITCH0_TILE_WIDTH_R)); + break; ++ } ++ + default: + DRM_DEBUG_KMS("Unsupported FB tiling flag 0x%16llx", + (long long)fb->modifier[0]); + +From 152e45fd402dae8ea50b14646a5b309ed786a816 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Mon, 24 Jul 2017 14:34:55 -0700 +Subject: [PATCH 382/407] drm/vc4: Demote user-accessible DRM_ERROR paths to + DRM_DEBUG. + +Userspace shouldn't be able to spam dmesg by passing bad arguments. +This has particularly become an issues since we started using a bad +argument to set_tiling to detect if set_tiling was supported. + +Signed-off-by: Eric Anholt +Fixes: 83753117f1de ("drm/vc4: Add get/set tiling ioctls.") +--- + drivers/gpu/drm/vc4/vc4_bo.c | 14 +++--- + drivers/gpu/drm/vc4/vc4_gem.c | 10 ++-- + drivers/gpu/drm/vc4/vc4_kms.c | 2 +- + drivers/gpu/drm/vc4/vc4_render_cl.c | 40 +++++++-------- + drivers/gpu/drm/vc4/vc4_validate.c | 79 +++++++++++++++--------------- + drivers/gpu/drm/vc4/vc4_validate_shaders.c | 72 +++++++++++++-------------- + 6 files changed, 109 insertions(+), 108 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c +index 3e89326033d7fe4d53ada276ec6fd4f82ba663cf..e7428184353cccee96135cc3246a8582edeb2c1b 100644 +--- a/drivers/gpu/drm/vc4/vc4_bo.c ++++ b/drivers/gpu/drm/vc4/vc4_bo.c +@@ -465,7 +465,7 @@ vc4_prime_export(struct drm_device *dev, struct drm_gem_object *obj, int flags) + struct vc4_bo *bo = to_vc4_bo(obj); + + if (bo->validated_shader) { +- DRM_ERROR("Attempting to export shader BO\n"); ++ DRM_DEBUG("Attempting to export shader BO\n"); + return ERR_PTR(-EINVAL); + } + +@@ -486,7 +486,7 @@ int vc4_mmap(struct file *filp, struct vm_area_struct *vma) + bo = to_vc4_bo(gem_obj); + + if (bo->validated_shader && (vma->vm_flags & VM_WRITE)) { +- DRM_ERROR("mmaping of shader BOs for writing not allowed.\n"); ++ DRM_DEBUG("mmaping of shader BOs for writing not allowed.\n"); + return -EINVAL; + } + +@@ -511,7 +511,7 @@ int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) + struct vc4_bo *bo = to_vc4_bo(obj); + + if (bo->validated_shader && (vma->vm_flags & VM_WRITE)) { +- DRM_ERROR("mmaping of shader BOs for writing not allowed.\n"); ++ DRM_DEBUG("mmaping of shader BOs for writing not allowed.\n"); + return -EINVAL; + } + +@@ -523,7 +523,7 @@ void *vc4_prime_vmap(struct drm_gem_object *obj) + struct vc4_bo *bo = to_vc4_bo(obj); + + if (bo->validated_shader) { +- DRM_ERROR("mmaping of shader BOs not allowed.\n"); ++ DRM_DEBUG("mmaping of shader BOs not allowed.\n"); + return ERR_PTR(-EINVAL); + } + +@@ -559,7 +559,7 @@ int vc4_mmap_bo_ioctl(struct drm_device *dev, void *data, + + gem_obj = drm_gem_object_lookup(file_priv, args->handle); + if (!gem_obj) { +- DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); ++ DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); + return -EINVAL; + } + +@@ -663,7 +663,7 @@ int vc4_set_tiling_ioctl(struct drm_device *dev, void *data, + + gem_obj = drm_gem_object_lookup(file_priv, args->handle); + if (!gem_obj) { +- DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); ++ DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); + return -ENOENT; + } + bo = to_vc4_bo(gem_obj); +@@ -695,7 +695,7 @@ int vc4_get_tiling_ioctl(struct drm_device *dev, void *data, + + gem_obj = drm_gem_object_lookup(file_priv, args->handle); + if (!gem_obj) { +- DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); ++ DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); + return -ENOENT; + } + bo = to_vc4_bo(gem_obj); +diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c +index adb94d573a1881062ac0dee42a627746faea8657..32e17b384fbc491e204b91f663a8485b6d79e948 100644 +--- a/drivers/gpu/drm/vc4/vc4_gem.c ++++ b/drivers/gpu/drm/vc4/vc4_gem.c +@@ -531,7 +531,7 @@ vc4_cl_lookup_bos(struct drm_device *dev, + /* See comment on bo_index for why we have to check + * this. + */ +- DRM_ERROR("Rendering requires BOs to validate\n"); ++ DRM_DEBUG("Rendering requires BOs to validate\n"); + return -EINVAL; + } + +@@ -561,7 +561,7 @@ vc4_cl_lookup_bos(struct drm_device *dev, + struct drm_gem_object *bo = idr_find(&file_priv->object_idr, + handles[i]); + if (!bo) { +- DRM_ERROR("Failed to look up GEM BO %d: %d\n", ++ DRM_DEBUG("Failed to look up GEM BO %d: %d\n", + i, handles[i]); + ret = -EINVAL; + spin_unlock(&file_priv->table_lock); +@@ -599,7 +599,7 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) + args->shader_rec_count >= (UINT_MAX / + sizeof(struct vc4_shader_state)) || + temp_size < exec_size) { +- DRM_ERROR("overflow in exec arguments\n"); ++ DRM_DEBUG("overflow in exec arguments\n"); + ret = -EINVAL; + goto fail; + } +@@ -838,7 +838,7 @@ vc4_wait_bo_ioctl(struct drm_device *dev, void *data, + + gem_obj = drm_gem_object_lookup(file_priv, args->handle); + if (!gem_obj) { +- DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); ++ DRM_DEBUG("Failed to look up GEM BO %d\n", args->handle); + return -EINVAL; + } + bo = to_vc4_bo(gem_obj); +@@ -865,7 +865,7 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, + int ret = 0; + + if ((args->flags & ~VC4_SUBMIT_CL_USE_CLEAR_COLOR) != 0) { +- DRM_ERROR("Unknown flags: 0x%02x\n", args->flags); ++ DRM_DEBUG("Unknown flags: 0x%02x\n", args->flags); + return -EINVAL; + } + +diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c +index 78080c3e966cacf4756d58d34069c3fb0bafdd87..3ccdd54f32628064bcc25e226f08fd33646246c4 100644 +--- a/drivers/gpu/drm/vc4/vc4_kms.c ++++ b/drivers/gpu/drm/vc4/vc4_kms.c +@@ -216,7 +216,7 @@ static struct drm_framebuffer *vc4_fb_create(struct drm_device *dev, + + gem_obj = drm_gem_object_lookup(file_priv, mode_cmd->handles[0]); + if (!gem_obj) { +- DRM_ERROR("Failed to look up GEM BO %d\n", ++ DRM_DEBUG("Failed to look up GEM BO %d\n", + mode_cmd->handles[0]); + return ERR_PTR(-ENOENT); + +diff --git a/drivers/gpu/drm/vc4/vc4_render_cl.c b/drivers/gpu/drm/vc4/vc4_render_cl.c +index eb2794b12efe43dea0408fe772e8426628ae849f..43f8e6f7feff62d53a91070d97a38204a7152265 100644 +--- a/drivers/gpu/drm/vc4/vc4_render_cl.c ++++ b/drivers/gpu/drm/vc4/vc4_render_cl.c +@@ -374,14 +374,14 @@ static int vc4_full_res_bounds_check(struct vc4_exec_info *exec, + u32 render_tiles_stride = DIV_ROUND_UP(exec->args->width, 32); + + if (surf->offset > obj->base.size) { +- DRM_ERROR("surface offset %d > BO size %zd\n", ++ DRM_DEBUG("surface offset %d > BO size %zd\n", + surf->offset, obj->base.size); + return -EINVAL; + } + + if ((obj->base.size - surf->offset) / VC4_TILE_BUFFER_SIZE < + render_tiles_stride * args->max_y_tile + args->max_x_tile) { +- DRM_ERROR("MSAA tile %d, %d out of bounds " ++ DRM_DEBUG("MSAA tile %d, %d out of bounds " + "(bo size %zd, offset %d).\n", + args->max_x_tile, args->max_y_tile, + obj->base.size, +@@ -397,7 +397,7 @@ static int vc4_rcl_msaa_surface_setup(struct vc4_exec_info *exec, + struct drm_vc4_submit_rcl_surface *surf) + { + if (surf->flags != 0 || surf->bits != 0) { +- DRM_ERROR("MSAA surface had nonzero flags/bits\n"); ++ DRM_DEBUG("MSAA surface had nonzero flags/bits\n"); + return -EINVAL; + } + +@@ -411,7 +411,7 @@ static int vc4_rcl_msaa_surface_setup(struct vc4_exec_info *exec, + exec->rcl_write_bo[exec->rcl_write_bo_count++] = *obj; + + if (surf->offset & 0xf) { +- DRM_ERROR("MSAA write must be 16b aligned.\n"); ++ DRM_DEBUG("MSAA write must be 16b aligned.\n"); + return -EINVAL; + } + +@@ -433,7 +433,7 @@ static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, + int ret; + + if (surf->flags & ~VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { +- DRM_ERROR("Extra flags set\n"); ++ DRM_DEBUG("Extra flags set\n"); + return -EINVAL; + } + +@@ -449,12 +449,12 @@ static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, + + if (surf->flags & VC4_SUBMIT_RCL_SURFACE_READ_IS_FULL_RES) { + if (surf == &exec->args->zs_write) { +- DRM_ERROR("general zs write may not be a full-res.\n"); ++ DRM_DEBUG("general zs write may not be a full-res.\n"); + return -EINVAL; + } + + if (surf->bits != 0) { +- DRM_ERROR("load/store general bits set with " ++ DRM_DEBUG("load/store general bits set with " + "full res load/store.\n"); + return -EINVAL; + } +@@ -469,19 +469,19 @@ static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, + if (surf->bits & ~(VC4_LOADSTORE_TILE_BUFFER_TILING_MASK | + VC4_LOADSTORE_TILE_BUFFER_BUFFER_MASK | + VC4_LOADSTORE_TILE_BUFFER_FORMAT_MASK)) { +- DRM_ERROR("Unknown bits in load/store: 0x%04x\n", ++ DRM_DEBUG("Unknown bits in load/store: 0x%04x\n", + surf->bits); + return -EINVAL; + } + + if (tiling > VC4_TILING_FORMAT_LT) { +- DRM_ERROR("Bad tiling format\n"); ++ DRM_DEBUG("Bad tiling format\n"); + return -EINVAL; + } + + if (buffer == VC4_LOADSTORE_TILE_BUFFER_ZS) { + if (format != 0) { +- DRM_ERROR("No color format should be set for ZS\n"); ++ DRM_DEBUG("No color format should be set for ZS\n"); + return -EINVAL; + } + cpp = 4; +@@ -495,16 +495,16 @@ static int vc4_rcl_surface_setup(struct vc4_exec_info *exec, + cpp = 4; + break; + default: +- DRM_ERROR("Bad tile buffer format\n"); ++ DRM_DEBUG("Bad tile buffer format\n"); + return -EINVAL; + } + } else { +- DRM_ERROR("Bad load/store buffer %d.\n", buffer); ++ DRM_DEBUG("Bad load/store buffer %d.\n", buffer); + return -EINVAL; + } + + if (surf->offset & 0xf) { +- DRM_ERROR("load/store buffer must be 16b aligned.\n"); ++ DRM_DEBUG("load/store buffer must be 16b aligned.\n"); + return -EINVAL; + } + +@@ -529,7 +529,7 @@ vc4_rcl_render_config_surface_setup(struct vc4_exec_info *exec, + int cpp; + + if (surf->flags != 0) { +- DRM_ERROR("No flags supported on render config.\n"); ++ DRM_DEBUG("No flags supported on render config.\n"); + return -EINVAL; + } + +@@ -537,7 +537,7 @@ vc4_rcl_render_config_surface_setup(struct vc4_exec_info *exec, + VC4_RENDER_CONFIG_FORMAT_MASK | + VC4_RENDER_CONFIG_MS_MODE_4X | + VC4_RENDER_CONFIG_DECIMATE_MODE_4X)) { +- DRM_ERROR("Unknown bits in render config: 0x%04x\n", ++ DRM_DEBUG("Unknown bits in render config: 0x%04x\n", + surf->bits); + return -EINVAL; + } +@@ -552,7 +552,7 @@ vc4_rcl_render_config_surface_setup(struct vc4_exec_info *exec, + exec->rcl_write_bo[exec->rcl_write_bo_count++] = *obj; + + if (tiling > VC4_TILING_FORMAT_LT) { +- DRM_ERROR("Bad tiling format\n"); ++ DRM_DEBUG("Bad tiling format\n"); + return -EINVAL; + } + +@@ -565,7 +565,7 @@ vc4_rcl_render_config_surface_setup(struct vc4_exec_info *exec, + cpp = 4; + break; + default: +- DRM_ERROR("Bad tile buffer format\n"); ++ DRM_DEBUG("Bad tile buffer format\n"); + return -EINVAL; + } + +@@ -586,7 +586,7 @@ int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec) + + if (args->min_x_tile > args->max_x_tile || + args->min_y_tile > args->max_y_tile) { +- DRM_ERROR("Bad render tile set (%d,%d)-(%d,%d)\n", ++ DRM_DEBUG("Bad render tile set (%d,%d)-(%d,%d)\n", + args->min_x_tile, args->min_y_tile, + args->max_x_tile, args->max_y_tile); + return -EINVAL; +@@ -595,7 +595,7 @@ int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec) + if (has_bin && + (args->max_x_tile > exec->bin_tiles_x || + args->max_y_tile > exec->bin_tiles_y)) { +- DRM_ERROR("Render tiles (%d,%d) outside of bin config " ++ DRM_DEBUG("Render tiles (%d,%d) outside of bin config " + "(%d,%d)\n", + args->max_x_tile, args->max_y_tile, + exec->bin_tiles_x, exec->bin_tiles_y); +@@ -638,7 +638,7 @@ int vc4_get_rcl(struct drm_device *dev, struct vc4_exec_info *exec) + */ + if (!setup.color_write && !setup.zs_write && + !setup.msaa_color_write && !setup.msaa_zs_write) { +- DRM_ERROR("RCL requires color or Z/S write\n"); ++ DRM_DEBUG("RCL requires color or Z/S write\n"); + return -EINVAL; + } + +diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c +index 59d808e2a6cc6f3173b1309cc4f491098886cf36..35d26bc8628b0cb8aad9cf8ed29cd851b617dd77 100644 +--- a/drivers/gpu/drm/vc4/vc4_validate.c ++++ b/drivers/gpu/drm/vc4/vc4_validate.c +@@ -101,7 +101,7 @@ vc4_use_bo(struct vc4_exec_info *exec, uint32_t hindex) + struct vc4_bo *bo; + + if (hindex >= exec->bo_count) { +- DRM_ERROR("BO index %d greater than BO count %d\n", ++ DRM_DEBUG("BO index %d greater than BO count %d\n", + hindex, exec->bo_count); + return NULL; + } +@@ -109,7 +109,7 @@ vc4_use_bo(struct vc4_exec_info *exec, uint32_t hindex) + bo = to_vc4_bo(&obj->base); + + if (bo->validated_shader) { +- DRM_ERROR("Trying to use shader BO as something other than " ++ DRM_DEBUG("Trying to use shader BO as something other than " + "a shader\n"); + return NULL; + } +@@ -164,7 +164,8 @@ vc4_check_tex_size(struct vc4_exec_info *exec, struct drm_gem_cma_object *fbo, + * our math. + */ + if (width > 4096 || height > 4096) { +- DRM_ERROR("Surface dimesions (%d,%d) too large", width, height); ++ DRM_DEBUG("Surface dimensions (%d,%d) too large", ++ width, height); + return false; + } + +@@ -182,7 +183,7 @@ vc4_check_tex_size(struct vc4_exec_info *exec, struct drm_gem_cma_object *fbo, + aligned_height = round_up(height, utile_h); + break; + default: +- DRM_ERROR("buffer tiling %d unsupported\n", tiling_format); ++ DRM_DEBUG("buffer tiling %d unsupported\n", tiling_format); + return false; + } + +@@ -191,7 +192,7 @@ vc4_check_tex_size(struct vc4_exec_info *exec, struct drm_gem_cma_object *fbo, + + if (size + offset < size || + size + offset > fbo->base.size) { +- DRM_ERROR("Overflow in %dx%d (%dx%d) fbo size (%d + %d > %zd)\n", ++ DRM_DEBUG("Overflow in %dx%d (%dx%d) fbo size (%d + %d > %zd)\n", + width, height, + aligned_width, aligned_height, + size, offset, fbo->base.size); +@@ -205,7 +206,7 @@ static int + validate_flush(VALIDATE_ARGS) + { + if (!validate_bin_pos(exec, untrusted, exec->args->bin_cl_size - 1)) { +- DRM_ERROR("Bin CL must end with VC4_PACKET_FLUSH\n"); ++ DRM_DEBUG("Bin CL must end with VC4_PACKET_FLUSH\n"); + return -EINVAL; + } + exec->found_flush = true; +@@ -217,13 +218,13 @@ static int + validate_start_tile_binning(VALIDATE_ARGS) + { + if (exec->found_start_tile_binning_packet) { +- DRM_ERROR("Duplicate VC4_PACKET_START_TILE_BINNING\n"); ++ DRM_DEBUG("Duplicate VC4_PACKET_START_TILE_BINNING\n"); + return -EINVAL; + } + exec->found_start_tile_binning_packet = true; + + if (!exec->found_tile_binning_mode_config_packet) { +- DRM_ERROR("missing VC4_PACKET_TILE_BINNING_MODE_CONFIG\n"); ++ DRM_DEBUG("missing VC4_PACKET_TILE_BINNING_MODE_CONFIG\n"); + return -EINVAL; + } + +@@ -234,7 +235,7 @@ static int + validate_increment_semaphore(VALIDATE_ARGS) + { + if (!validate_bin_pos(exec, untrusted, exec->args->bin_cl_size - 2)) { +- DRM_ERROR("Bin CL must end with " ++ DRM_DEBUG("Bin CL must end with " + "VC4_PACKET_INCREMENT_SEMAPHORE\n"); + return -EINVAL; + } +@@ -255,7 +256,7 @@ validate_indexed_prim_list(VALIDATE_ARGS) + + /* Check overflow condition */ + if (exec->shader_state_count == 0) { +- DRM_ERROR("shader state must precede primitives\n"); ++ DRM_DEBUG("shader state must precede primitives\n"); + return -EINVAL; + } + shader_state = &exec->shader_state[exec->shader_state_count - 1]; +@@ -272,7 +273,7 @@ validate_indexed_prim_list(VALIDATE_ARGS) + + if (offset > ib->base.size || + (ib->base.size - offset) / index_size < length) { +- DRM_ERROR("IB access overflow (%d + %d*%d > %zd)\n", ++ DRM_DEBUG("IB access overflow (%d + %d*%d > %zd)\n", + offset, length, index_size, ib->base.size); + return -EINVAL; + } +@@ -292,13 +293,13 @@ validate_gl_array_primitive(VALIDATE_ARGS) + + /* Check overflow condition */ + if (exec->shader_state_count == 0) { +- DRM_ERROR("shader state must precede primitives\n"); ++ DRM_DEBUG("shader state must precede primitives\n"); + return -EINVAL; + } + shader_state = &exec->shader_state[exec->shader_state_count - 1]; + + if (length + base_index < length) { +- DRM_ERROR("primitive vertex count overflow\n"); ++ DRM_DEBUG("primitive vertex count overflow\n"); + return -EINVAL; + } + max_index = length + base_index - 1; +@@ -315,7 +316,7 @@ validate_gl_shader_state(VALIDATE_ARGS) + uint32_t i = exec->shader_state_count++; + + if (i >= exec->shader_state_size) { +- DRM_ERROR("More requests for shader states than declared\n"); ++ DRM_DEBUG("More requests for shader states than declared\n"); + return -EINVAL; + } + +@@ -323,7 +324,7 @@ validate_gl_shader_state(VALIDATE_ARGS) + exec->shader_state[i].max_index = 0; + + if (exec->shader_state[i].addr & ~0xf) { +- DRM_ERROR("high bits set in GL shader rec reference\n"); ++ DRM_DEBUG("high bits set in GL shader rec reference\n"); + return -EINVAL; + } + +@@ -347,7 +348,7 @@ validate_tile_binning_config(VALIDATE_ARGS) + int bin_slot; + + if (exec->found_tile_binning_mode_config_packet) { +- DRM_ERROR("Duplicate VC4_PACKET_TILE_BINNING_MODE_CONFIG\n"); ++ DRM_DEBUG("Duplicate VC4_PACKET_TILE_BINNING_MODE_CONFIG\n"); + return -EINVAL; + } + exec->found_tile_binning_mode_config_packet = true; +@@ -359,14 +360,14 @@ validate_tile_binning_config(VALIDATE_ARGS) + + if (exec->bin_tiles_x == 0 || + exec->bin_tiles_y == 0) { +- DRM_ERROR("Tile binning config of %dx%d too small\n", ++ DRM_DEBUG("Tile binning config of %dx%d too small\n", + exec->bin_tiles_x, exec->bin_tiles_y); + return -EINVAL; + } + + if (flags & (VC4_BIN_CONFIG_DB_NON_MS | + VC4_BIN_CONFIG_TILE_BUFFER_64BIT)) { +- DRM_ERROR("unsupported binning config flags 0x%02x\n", flags); ++ DRM_DEBUG("unsupported binning config flags 0x%02x\n", flags); + return -EINVAL; + } + +@@ -484,20 +485,20 @@ vc4_validate_bin_cl(struct drm_device *dev, + const struct cmd_info *info; + + if (cmd >= ARRAY_SIZE(cmd_info)) { +- DRM_ERROR("0x%08x: packet %d out of bounds\n", ++ DRM_DEBUG("0x%08x: packet %d out of bounds\n", + src_offset, cmd); + return -EINVAL; + } + + info = &cmd_info[cmd]; + if (!info->name) { +- DRM_ERROR("0x%08x: packet %d invalid\n", ++ DRM_DEBUG("0x%08x: packet %d invalid\n", + src_offset, cmd); + return -EINVAL; + } + + if (src_offset + info->len > len) { +- DRM_ERROR("0x%08x: packet %d (%s) length 0x%08x " ++ DRM_DEBUG("0x%08x: packet %d (%s) length 0x%08x " + "exceeds bounds (0x%08x)\n", + src_offset, cmd, info->name, info->len, + src_offset + len); +@@ -510,7 +511,7 @@ vc4_validate_bin_cl(struct drm_device *dev, + if (info->func && info->func(exec, + dst_pkt + 1, + src_pkt + 1)) { +- DRM_ERROR("0x%08x: packet %d (%s) failed to validate\n", ++ DRM_DEBUG("0x%08x: packet %d (%s) failed to validate\n", + src_offset, cmd, info->name); + return -EINVAL; + } +@@ -528,7 +529,7 @@ vc4_validate_bin_cl(struct drm_device *dev, + exec->ct0ea = exec->ct0ca + dst_offset; + + if (!exec->found_start_tile_binning_packet) { +- DRM_ERROR("Bin CL missing VC4_PACKET_START_TILE_BINNING\n"); ++ DRM_DEBUG("Bin CL missing VC4_PACKET_START_TILE_BINNING\n"); + return -EINVAL; + } + +@@ -540,7 +541,7 @@ vc4_validate_bin_cl(struct drm_device *dev, + * semaphore increment. + */ + if (!exec->found_increment_semaphore_packet || !exec->found_flush) { +- DRM_ERROR("Bin CL missing VC4_PACKET_INCREMENT_SEMAPHORE + " ++ DRM_DEBUG("Bin CL missing VC4_PACKET_INCREMENT_SEMAPHORE + " + "VC4_PACKET_FLUSH\n"); + return -EINVAL; + } +@@ -579,11 +580,11 @@ reloc_tex(struct vc4_exec_info *exec, + uint32_t remaining_size = tex->base.size - p0; + + if (p0 > tex->base.size - 4) { +- DRM_ERROR("UBO offset greater than UBO size\n"); ++ DRM_DEBUG("UBO offset greater than UBO size\n"); + goto fail; + } + if (p1 > remaining_size - 4) { +- DRM_ERROR("UBO clamp would allow reads " ++ DRM_DEBUG("UBO clamp would allow reads " + "outside of UBO\n"); + goto fail; + } +@@ -603,14 +604,14 @@ reloc_tex(struct vc4_exec_info *exec, + if (VC4_GET_FIELD(p3, VC4_TEX_P2_PTYPE) == + VC4_TEX_P2_PTYPE_CUBE_MAP_STRIDE) { + if (cube_map_stride) { +- DRM_ERROR("Cube map stride set twice\n"); ++ DRM_DEBUG("Cube map stride set twice\n"); + goto fail; + } + + cube_map_stride = p3 & VC4_TEX_P2_CMST_MASK; + } + if (!cube_map_stride) { +- DRM_ERROR("Cube map stride not set\n"); ++ DRM_DEBUG("Cube map stride not set\n"); + goto fail; + } + } +@@ -651,7 +652,7 @@ reloc_tex(struct vc4_exec_info *exec, + case VC4_TEXTURE_TYPE_RGBA64: + case VC4_TEXTURE_TYPE_YUV422R: + default: +- DRM_ERROR("Texture format %d unsupported\n", type); ++ DRM_DEBUG("Texture format %d unsupported\n", type); + goto fail; + } + utile_w = utile_width(cpp); +@@ -704,7 +705,7 @@ reloc_tex(struct vc4_exec_info *exec, + level_size = aligned_width * cpp * aligned_height; + + if (offset < level_size) { +- DRM_ERROR("Level %d (%dx%d -> %dx%d) size %db " ++ DRM_DEBUG("Level %d (%dx%d -> %dx%d) size %db " + "overflowed buffer bounds (offset %d)\n", + i, level_width, level_height, + aligned_width, aligned_height, +@@ -755,7 +756,7 @@ validate_gl_shader_rec(struct drm_device *dev, + + nr_relocs = ARRAY_SIZE(shader_reloc_offsets) + nr_attributes; + if (nr_relocs * 4 > exec->shader_rec_size) { +- DRM_ERROR("overflowed shader recs reading %d handles " ++ DRM_DEBUG("overflowed shader recs reading %d handles " + "from %d bytes left\n", + nr_relocs, exec->shader_rec_size); + return -EINVAL; +@@ -765,7 +766,7 @@ validate_gl_shader_rec(struct drm_device *dev, + exec->shader_rec_size -= nr_relocs * 4; + + if (packet_size > exec->shader_rec_size) { +- DRM_ERROR("overflowed shader recs copying %db packet " ++ DRM_DEBUG("overflowed shader recs copying %db packet " + "from %d bytes left\n", + packet_size, exec->shader_rec_size); + return -EINVAL; +@@ -785,7 +786,7 @@ validate_gl_shader_rec(struct drm_device *dev, + + for (i = 0; i < shader_reloc_count; i++) { + if (src_handles[i] > exec->bo_count) { +- DRM_ERROR("Shader handle %d too big\n", src_handles[i]); ++ DRM_DEBUG("Shader handle %d too big\n", src_handles[i]); + return -EINVAL; + } + +@@ -801,13 +802,13 @@ validate_gl_shader_rec(struct drm_device *dev, + + if (((*(uint16_t *)pkt_u & VC4_SHADER_FLAG_FS_SINGLE_THREAD) == 0) != + to_vc4_bo(&bo[0]->base)->validated_shader->is_threaded) { +- DRM_ERROR("Thread mode of CL and FS do not match\n"); ++ DRM_DEBUG("Thread mode of CL and FS do not match\n"); + return -EINVAL; + } + + if (to_vc4_bo(&bo[1]->base)->validated_shader->is_threaded || + to_vc4_bo(&bo[2]->base)->validated_shader->is_threaded) { +- DRM_ERROR("cs and vs cannot be threaded\n"); ++ DRM_DEBUG("cs and vs cannot be threaded\n"); + return -EINVAL; + } + +@@ -822,7 +823,7 @@ validate_gl_shader_rec(struct drm_device *dev, + *(uint32_t *)(pkt_v + o) = bo[i]->paddr + src_offset; + + if (src_offset != 0) { +- DRM_ERROR("Shaders must be at offset 0 of " ++ DRM_DEBUG("Shaders must be at offset 0 of " + "the BO.\n"); + return -EINVAL; + } +@@ -833,7 +834,7 @@ validate_gl_shader_rec(struct drm_device *dev, + + if (validated_shader->uniforms_src_size > + exec->uniforms_size) { +- DRM_ERROR("Uniforms src buffer overflow\n"); ++ DRM_DEBUG("Uniforms src buffer overflow\n"); + return -EINVAL; + } + +@@ -891,7 +892,7 @@ validate_gl_shader_rec(struct drm_device *dev, + + if (vbo->base.size < offset || + vbo->base.size - offset < attr_size) { +- DRM_ERROR("BO offset overflow (%d + %d > %zu)\n", ++ DRM_DEBUG("BO offset overflow (%d + %d > %zu)\n", + offset, attr_size, vbo->base.size); + return -EINVAL; + } +@@ -900,7 +901,7 @@ validate_gl_shader_rec(struct drm_device *dev, + max_index = ((vbo->base.size - offset - attr_size) / + stride); + if (state->max_index > max_index) { +- DRM_ERROR("primitives use index %d out of " ++ DRM_DEBUG("primitives use index %d out of " + "supplied %d\n", + state->max_index, max_index); + return -EINVAL; +diff --git a/drivers/gpu/drm/vc4/vc4_validate_shaders.c b/drivers/gpu/drm/vc4/vc4_validate_shaders.c +index 5dba13dd1e9b600b43a769d086d6eb428547ab66..433b37f9265601063eba24367de1eca89239a24c 100644 +--- a/drivers/gpu/drm/vc4/vc4_validate_shaders.c ++++ b/drivers/gpu/drm/vc4/vc4_validate_shaders.c +@@ -195,7 +195,7 @@ check_tmu_write(struct vc4_validated_shader_info *validated_shader, + uint32_t clamp_reg, clamp_offset; + + if (sig == QPU_SIG_SMALL_IMM) { +- DRM_ERROR("direct TMU read used small immediate\n"); ++ DRM_DEBUG("direct TMU read used small immediate\n"); + return false; + } + +@@ -204,7 +204,7 @@ check_tmu_write(struct vc4_validated_shader_info *validated_shader, + */ + if (is_mul || + QPU_GET_FIELD(inst, QPU_OP_ADD) != QPU_A_ADD) { +- DRM_ERROR("direct TMU load wasn't an add\n"); ++ DRM_DEBUG("direct TMU load wasn't an add\n"); + return false; + } + +@@ -215,13 +215,13 @@ check_tmu_write(struct vc4_validated_shader_info *validated_shader, + */ + clamp_reg = raddr_add_a_to_live_reg_index(inst); + if (clamp_reg == ~0) { +- DRM_ERROR("direct TMU load wasn't clamped\n"); ++ DRM_DEBUG("direct TMU load wasn't clamped\n"); + return false; + } + + clamp_offset = validation_state->live_min_clamp_offsets[clamp_reg]; + if (clamp_offset == ~0) { +- DRM_ERROR("direct TMU load wasn't clamped\n"); ++ DRM_DEBUG("direct TMU load wasn't clamped\n"); + return false; + } + +@@ -233,7 +233,7 @@ check_tmu_write(struct vc4_validated_shader_info *validated_shader, + + if (!(add_b == QPU_MUX_A && raddr_a == QPU_R_UNIF) && + !(add_b == QPU_MUX_B && raddr_b == QPU_R_UNIF)) { +- DRM_ERROR("direct TMU load didn't add to a uniform\n"); ++ DRM_DEBUG("direct TMU load didn't add to a uniform\n"); + return false; + } + +@@ -241,14 +241,14 @@ check_tmu_write(struct vc4_validated_shader_info *validated_shader, + } else { + if (raddr_a == QPU_R_UNIF || (sig != QPU_SIG_SMALL_IMM && + raddr_b == QPU_R_UNIF)) { +- DRM_ERROR("uniform read in the same instruction as " ++ DRM_DEBUG("uniform read in the same instruction as " + "texture setup.\n"); + return false; + } + } + + if (validation_state->tmu_write_count[tmu] >= 4) { +- DRM_ERROR("TMU%d got too many parameters before dispatch\n", ++ DRM_DEBUG("TMU%d got too many parameters before dispatch\n", + tmu); + return false; + } +@@ -260,7 +260,7 @@ check_tmu_write(struct vc4_validated_shader_info *validated_shader, + */ + if (!is_direct) { + if (validation_state->needs_uniform_address_update) { +- DRM_ERROR("Texturing with undefined uniform address\n"); ++ DRM_DEBUG("Texturing with undefined uniform address\n"); + return false; + } + +@@ -331,35 +331,35 @@ validate_uniform_address_write(struct vc4_validated_shader_info *validated_shade + case QPU_SIG_LOAD_TMU1: + break; + default: +- DRM_ERROR("uniforms address change must be " ++ DRM_DEBUG("uniforms address change must be " + "normal math\n"); + return false; + } + + if (is_mul || QPU_GET_FIELD(inst, QPU_OP_ADD) != QPU_A_ADD) { +- DRM_ERROR("Uniform address reset must be an ADD.\n"); ++ DRM_DEBUG("Uniform address reset must be an ADD.\n"); + return false; + } + + if (QPU_GET_FIELD(inst, QPU_COND_ADD) != QPU_COND_ALWAYS) { +- DRM_ERROR("Uniform address reset must be unconditional.\n"); ++ DRM_DEBUG("Uniform address reset must be unconditional.\n"); + return false; + } + + if (QPU_GET_FIELD(inst, QPU_PACK) != QPU_PACK_A_NOP && + !(inst & QPU_PM)) { +- DRM_ERROR("No packing allowed on uniforms reset\n"); ++ DRM_DEBUG("No packing allowed on uniforms reset\n"); + return false; + } + + if (add_lri == -1) { +- DRM_ERROR("First argument of uniform address write must be " ++ DRM_DEBUG("First argument of uniform address write must be " + "an immediate value.\n"); + return false; + } + + if (validation_state->live_immediates[add_lri] != expected_offset) { +- DRM_ERROR("Resetting uniforms with offset %db instead of %db\n", ++ DRM_DEBUG("Resetting uniforms with offset %db instead of %db\n", + validation_state->live_immediates[add_lri], + expected_offset); + return false; +@@ -367,7 +367,7 @@ validate_uniform_address_write(struct vc4_validated_shader_info *validated_shade + + if (!(add_b == QPU_MUX_A && raddr_a == QPU_R_UNIF) && + !(add_b == QPU_MUX_B && raddr_b == QPU_R_UNIF)) { +- DRM_ERROR("Second argument of uniform address write must be " ++ DRM_DEBUG("Second argument of uniform address write must be " + "a uniform.\n"); + return false; + } +@@ -412,7 +412,7 @@ check_reg_write(struct vc4_validated_shader_info *validated_shader, + switch (waddr) { + case QPU_W_UNIFORMS_ADDRESS: + if (is_b) { +- DRM_ERROR("relative uniforms address change " ++ DRM_DEBUG("relative uniforms address change " + "unsupported\n"); + return false; + } +@@ -447,11 +447,11 @@ check_reg_write(struct vc4_validated_shader_info *validated_shader, + /* XXX: I haven't thought about these, so don't support them + * for now. + */ +- DRM_ERROR("Unsupported waddr %d\n", waddr); ++ DRM_DEBUG("Unsupported waddr %d\n", waddr); + return false; + + case QPU_W_VPM_ADDR: +- DRM_ERROR("General VPM DMA unsupported\n"); ++ DRM_DEBUG("General VPM DMA unsupported\n"); + return false; + + case QPU_W_VPM: +@@ -554,7 +554,7 @@ check_instruction_writes(struct vc4_validated_shader_info *validated_shader, + bool ok; + + if (is_tmu_write(waddr_add) && is_tmu_write(waddr_mul)) { +- DRM_ERROR("ADD and MUL both set up textures\n"); ++ DRM_DEBUG("ADD and MUL both set up textures\n"); + return false; + } + +@@ -583,7 +583,7 @@ check_branch(uint64_t inst, + * there's no need for it. + */ + if (waddr_add != QPU_W_NOP || waddr_mul != QPU_W_NOP) { +- DRM_ERROR("branch instruction at %d wrote a register.\n", ++ DRM_DEBUG("branch instruction at %d wrote a register.\n", + validation_state->ip); + return false; + } +@@ -609,7 +609,7 @@ check_instruction_reads(struct vc4_validated_shader_info *validated_shader, + validated_shader->uniforms_size += 4; + + if (validation_state->needs_uniform_address_update) { +- DRM_ERROR("Uniform read with undefined uniform " ++ DRM_DEBUG("Uniform read with undefined uniform " + "address\n"); + return false; + } +@@ -655,19 +655,19 @@ vc4_validate_branches(struct vc4_shader_validation_state *validation_state) + continue; + + if (ip - last_branch < 4) { +- DRM_ERROR("Branch at %d during delay slots\n", ip); ++ DRM_DEBUG("Branch at %d during delay slots\n", ip); + return false; + } + last_branch = ip; + + if (inst & QPU_BRANCH_REG) { +- DRM_ERROR("branching from register relative " ++ DRM_DEBUG("branching from register relative " + "not supported\n"); + return false; + } + + if (!(inst & QPU_BRANCH_REL)) { +- DRM_ERROR("relative branching required\n"); ++ DRM_DEBUG("relative branching required\n"); + return false; + } + +@@ -677,13 +677,13 @@ vc4_validate_branches(struct vc4_shader_validation_state *validation_state) + * end of the shader object. + */ + if (branch_imm % sizeof(inst) != 0) { +- DRM_ERROR("branch target not aligned\n"); ++ DRM_DEBUG("branch target not aligned\n"); + return false; + } + + branch_target_ip = after_delay_ip + (branch_imm >> 3); + if (branch_target_ip >= validation_state->max_ip) { +- DRM_ERROR("Branch at %d outside of shader (ip %d/%d)\n", ++ DRM_DEBUG("Branch at %d outside of shader (ip %d/%d)\n", + ip, branch_target_ip, + validation_state->max_ip); + return false; +@@ -694,7 +694,7 @@ vc4_validate_branches(struct vc4_shader_validation_state *validation_state) + * the shader. + */ + if (after_delay_ip >= validation_state->max_ip) { +- DRM_ERROR("Branch at %d continues past shader end " ++ DRM_DEBUG("Branch at %d continues past shader end " + "(%d/%d)\n", + ip, after_delay_ip, validation_state->max_ip); + return false; +@@ -704,7 +704,7 @@ vc4_validate_branches(struct vc4_shader_validation_state *validation_state) + } + + if (max_branch_target > validation_state->max_ip - 3) { +- DRM_ERROR("Branch landed after QPU_SIG_PROG_END"); ++ DRM_DEBUG("Branch landed after QPU_SIG_PROG_END"); + return false; + } + +@@ -745,7 +745,7 @@ vc4_handle_branch_target(struct vc4_shader_validation_state *validation_state) + return true; + + if (texturing_in_progress(validation_state)) { +- DRM_ERROR("Branch target landed during TMU setup\n"); ++ DRM_DEBUG("Branch target landed during TMU setup\n"); + return false; + } + +@@ -832,7 +832,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) + case QPU_SIG_LAST_THREAD_SWITCH: + if (!check_instruction_writes(validated_shader, + &validation_state)) { +- DRM_ERROR("Bad write at ip %d\n", ip); ++ DRM_DEBUG("Bad write at ip %d\n", ip); + goto fail; + } + +@@ -850,7 +850,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) + validated_shader->is_threaded = true; + + if (ip < last_thread_switch_ip + 3) { +- DRM_ERROR("Thread switch too soon after " ++ DRM_DEBUG("Thread switch too soon after " + "last switch at ip %d\n", ip); + goto fail; + } +@@ -862,7 +862,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) + case QPU_SIG_LOAD_IMM: + if (!check_instruction_writes(validated_shader, + &validation_state)) { +- DRM_ERROR("Bad LOAD_IMM write at ip %d\n", ip); ++ DRM_DEBUG("Bad LOAD_IMM write at ip %d\n", ip); + goto fail; + } + break; +@@ -873,14 +873,14 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) + goto fail; + + if (ip < last_thread_switch_ip + 3) { +- DRM_ERROR("Branch in thread switch at ip %d", ++ DRM_DEBUG("Branch in thread switch at ip %d", + ip); + goto fail; + } + + break; + default: +- DRM_ERROR("Unsupported QPU signal %d at " ++ DRM_DEBUG("Unsupported QPU signal %d at " + "instruction %d\n", sig, ip); + goto fail; + } +@@ -893,7 +893,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) + } + + if (ip == validation_state.max_ip) { +- DRM_ERROR("shader failed to terminate before " ++ DRM_DEBUG("shader failed to terminate before " + "shader BO end at %zd\n", + shader_obj->base.size); + goto fail; +@@ -902,7 +902,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj) + /* Might corrupt other thread */ + if (validated_shader->is_threaded && + validation_state.all_registers_used) { +- DRM_ERROR("Shader uses threading, but uses the upper " ++ DRM_DEBUG("Shader uses threading, but uses the upper " + "half of the registers, too\n"); + goto fail; + } + +From 119529c882e429dc778773123d1fe22ddfd1a974 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Mon, 17 Apr 2017 09:26:03 -0700 +Subject: [PATCH 383/407] drm/vc4: Fix refcounting of runtime PM get if it + errors out. + +We were returning without decrementing if the error happened, meaning +that at the next submit we wouldn't try to bring up the power domain. + +Signed-off-by: Eric Anholt +Link: http://patchwork.freedesktop.org/patch/msgid/20170417162603.12726-1-eric@anholt.net +Reviewed-by: Sean Paul +(cherry picked from commit 925d05e1f825db9490da33afe35bd5383d301e97) +--- + drivers/gpu/drm/vc4/vc4_gem.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c +index 32e17b384fbc491e204b91f663a8485b6d79e948..994295fe1084371c1169ef313efa58e2a6de30b5 100644 +--- a/drivers/gpu/drm/vc4/vc4_gem.c ++++ b/drivers/gpu/drm/vc4/vc4_gem.c +@@ -876,13 +876,16 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, + } + + mutex_lock(&vc4->power_lock); +- if (vc4->power_refcount++ == 0) ++ if (vc4->power_refcount++ == 0) { + ret = pm_runtime_get_sync(&vc4->v3d->pdev->dev); +- mutex_unlock(&vc4->power_lock); +- if (ret < 0) { +- kfree(exec); +- return ret; ++ if (ret < 0) { ++ mutex_unlock(&vc4->power_lock); ++ vc4->power_refcount--; ++ kfree(exec); ++ return ret; ++ } + } ++ mutex_unlock(&vc4->power_lock); + + exec->args = args; + INIT_LIST_HEAD(&exec->unref_list); + +From acc5eb032a2d4e8ce491cbf54e0e481db1e676f2 Mon Sep 17 00:00:00 2001 +From: James Hughes +Date: Fri, 22 Sep 2017 10:24:04 +0100 +Subject: [PATCH 384/407] Touchscreen spurious event fix + +Touchscreen driver was not checking event type, +which meant bad coords that arrived with the +finger up event were being used, causing this +spurious coordinate event. + +Fix is to ignore all finger up events. + +Signed-off-by: James Hughes +--- + drivers/input/touchscreen/rpi-ft5406.c | 24 ++++++++++++++++-------- + 1 file changed, 16 insertions(+), 8 deletions(-) + +diff --git a/drivers/input/touchscreen/rpi-ft5406.c b/drivers/input/touchscreen/rpi-ft5406.c +index 9d7d05482355d168c5c0c42508cd978979ee5f14..ab35716caafaa7339031ab537b8fbf3b2b3a6da9 100644 +--- a/drivers/input/touchscreen/rpi-ft5406.c ++++ b/drivers/input/touchscreen/rpi-ft5406.c +@@ -42,6 +42,9 @@ struct ft5406_regs { + + #define SCREEN_WIDTH 800 + #define SCREEN_HEIGHT 480 ++#define FTS_TOUCH_DOWN 0 ++#define FTS_TOUCH_UP 1 ++#define FTS_TOUCH_CONTACT 2 + + struct ft5406 { + struct platform_device * pdev; +@@ -81,18 +84,22 @@ static int ft5406_thread(void *arg) + int x = (((int) regs.point[i].xh & 0xf) << 8) + regs.point[i].xl; + int y = (((int) regs.point[i].yh & 0xf) << 8) + regs.point[i].yl; + int touchid = (regs.point[i].yh >> 4) & 0xf; ++ int event_id = (regs.point[i].xh >> 6) & 0x3; + + modified_ids |= 1 << touchid; + +- if(!((1 << touchid) & known_ids)) +- dev_dbg(&ts->pdev->dev, "x = %d, y = %d, touchid = %d\n", x, y, touchid); +- +- input_mt_slot(ts->input_dev, touchid); +- input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 1); ++ if (event_id == FTS_TOUCH_CONTACT || ++ event_id == FTS_TOUCH_DOWN) { ++ if(!((1 << touchid) & known_ids)) ++ dev_dbg(&ts->pdev->dev, "x = %d, y = %d, touchid = %d\n", ++ x, y, touchid); + +- input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); +- input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); ++ input_mt_slot(ts->input_dev, touchid); ++ input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 1); + ++ input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x); ++ input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y); ++ } + } + + released_ids = known_ids & ~modified_ids; +@@ -100,7 +107,8 @@ static int ft5406_thread(void *arg) + { + if(released_ids & (1<pdev->dev, "Released %d, known = %x modified = %x\n", i, known_ids, modified_ids); ++ dev_dbg(&ts->pdev->dev, "Released %d, known = %x modified = %x\n", ++ i, known_ids, modified_ids); + input_mt_slot(ts->input_dev, i); + input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, 0); + modified_ids &= ~(1 << i); + +From 872c2ee28c5d0ad2cc4e7ebe236790aa58821bb4 Mon Sep 17 00:00:00 2001 +From: David H +Date: Wed, 4 Oct 2017 04:43:07 -0700 +Subject: [PATCH 385/407] bcm2835-camera: Fix timestamp calculation problem + (#2214) + +* bcm2835-camera: Fix timestamp calculation problem + +Use div_s64_rem() to convert usec timestamp to timeval +to avoid integer signedness bug. + +* bcm2835-camera: Store kernel start time in NSEC instead of USEC + +* bcm2835-camera: Reword debug message for clarity +--- + drivers/media/platform/bcm2835/bcm2835-camera.c | 41 ++++++------------------- + drivers/media/platform/bcm2835/bcm2835-camera.h | 2 +- + 2 files changed, 11 insertions(+), 32 deletions(-) + +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c +index 6bdec0806126044cf7146d53326e4da5b4269884..5b68abbf9e45ce5cefc14789bdc9c6e889ae0094 100644 +--- a/drivers/media/platform/bcm2835/bcm2835-camera.c ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.c +@@ -363,37 +363,17 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, + buf->vb.vb2_buf.timestamp); + + } else if(pts != 0) { +- struct timeval timestamp; + s64 runtime_us = pts - + dev->capture.vc_start_timestamp; +- u32 div = 0; +- u32 rem = 0; +- +- div = +- div_u64_rem(runtime_us, USEC_PER_SEC, &rem); +- timestamp.tv_sec = +- dev->capture.kernel_start_ts.tv_sec + div; +- timestamp.tv_usec = +- dev->capture.kernel_start_ts.tv_usec + rem; +- +- if (timestamp.tv_usec >= +- USEC_PER_SEC) { +- timestamp.tv_sec++; +- timestamp.tv_usec -= +- USEC_PER_SEC; +- } ++ buf->vb.vb2_buf.timestamp = (runtime_us * NSEC_PER_USEC) + ++ dev->capture.kernel_start_timestamp; + v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, +- "Convert start time %d.%06d and %llu " +- "with offset %llu to %d.%06d\n", +- (int)dev->capture.kernel_start_ts. +- tv_sec, +- (int)dev->capture.kernel_start_ts. +- tv_usec, +- dev->capture.vc_start_timestamp, pts, +- (int)timestamp.tv_sec, +- (int)timestamp.tv_usec); +- buf->vb.vb2_buf.timestamp = timestamp.tv_sec * 1000000000ULL + +- timestamp.tv_usec * 1000ULL; ++ "Buffer time set as converted timestamp - %llu " ++ "= (pts [%lld usec] - vc start time [%llu usec]) " ++ "+ kernel start time [%llu nsec]\n", ++ buf->vb.vb2_buf.timestamp, ++ pts, dev->capture.vc_start_timestamp, ++ dev->capture.kernel_start_timestamp); + } else { + if (dev->capture.last_timestamp) { + buf->vb.vb2_buf.timestamp = dev->capture.last_timestamp; +@@ -403,8 +383,7 @@ static void buffer_cb(struct vchiq_mmal_instance *instance, + } + else { + buf->vb.vb2_buf.timestamp = +- dev->capture.kernel_start_ts.tv_sec * 1000000000ULL + +- dev->capture.kernel_start_ts.tv_usec * 1000ULL; ++ dev->capture.kernel_start_timestamp; + v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, + "Buffer time set as start timestamp - %lld", + buf->vb.vb2_buf.timestamp); +@@ -586,7 +565,7 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count) + + dev->capture.last_timestamp = 0; + +- v4l2_get_timestamp(&dev->capture.kernel_start_ts); ++ dev->capture.kernel_start_timestamp = ktime_get_ns(); + + /* enable the camera port */ + dev->capture.port->cb_ctx = dev; +diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.h b/drivers/media/platform/bcm2835/bcm2835-camera.h +index 7f8a68916a67001bc9241bce2928519a2ce1ba78..d1b2a675e41d9d6561f278bd9d2f1802d8793f23 100644 +--- a/drivers/media/platform/bcm2835/bcm2835-camera.h ++++ b/drivers/media/platform/bcm2835/bcm2835-camera.h +@@ -92,7 +92,7 @@ struct bm2835_mmal_dev { + /* VC start timestamp for streaming */ + s64 vc_start_timestamp; + /* Kernel start timestamp for streaming */ +- struct timeval kernel_start_ts; ++ u64 kernel_start_timestamp; + /* Timestamp of last frame */ + u64 last_timestamp; + + +From 210fcae41a2cb3da0249ad4d8820de821c80ba6f Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 24 Aug 2017 16:16:16 +0100 +Subject: [PATCH 386/407] brcmfmac: Disable ARP offloading when promiscuous + +This is a test patch for brcmfmac from Franky Lin at Broadcom to disable +ARP offloading when in promiscuous mode, re-enabling the ability to +sniff ARP packets over WiFi. + +See: https://github.com/raspberrypi/linux/issues/2171 + +Signed-off-by: Phil Elwell +--- + .../broadcom/brcm80211/brcmfmac/cfg80211.c | 41 ---------------------- + .../wireless/broadcom/brcm80211/brcmfmac/core.c | 39 ++++++++++++++++++++ + .../wireless/broadcom/brcm80211/brcmfmac/core.h | 1 + + 3 files changed, 40 insertions(+), 41 deletions(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +index 3d28de96298c7cded3d231dd2f837ff182575c8c..b8195c167d6cadc5ddcb52c4ceaa744eb9c423d0 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +@@ -481,47 +481,6 @@ send_key_to_dongle(struct brcmf_if *ifp, struct brcmf_wsec_key *key) + return err; + } + +-static s32 +-brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable) +-{ +- s32 err; +- u32 mode; +- +- if (enable) +- mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY; +- else +- mode = 0; +- +- /* Try to set and enable ARP offload feature, this may fail, then it */ +- /* is simply not supported and err 0 will be returned */ +- err = brcmf_fil_iovar_int_set(ifp, "arp_ol", mode); +- if (err) { +- brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n", +- mode, err); +- err = 0; +- } else { +- err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable); +- if (err) { +- brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n", +- enable, err); +- err = 0; +- } else +- brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n", +- enable, mode); +- } +- +- err = brcmf_fil_iovar_int_set(ifp, "ndoe", enable); +- if (err) { +- brcmf_dbg(TRACE, "failed to configure (%d) ND offload err = %d\n", +- enable, err); +- err = 0; +- } else +- brcmf_dbg(TRACE, "successfully configured (%d) ND offload to 0x%x\n", +- enable, mode); +- +- return err; +-} +- + static void + brcmf_cfg80211_update_proto_addr_mode(struct wireless_dev *wdev) + { +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +index f877301c9454b2e75715937cd015fbfe87fc271b..ef4085cda90e2975eb474cd39627c578684b0f55 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +@@ -71,6 +71,43 @@ struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx) + return ifp; + } + ++void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable) ++{ ++ s32 err; ++ u32 mode; ++ ++ if (enable) ++ mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY; ++ else ++ mode = 0; ++ ++ /* Try to set and enable ARP offload feature, this may fail, then it */ ++ /* is simply not supported and err 0 will be returned */ ++ err = brcmf_fil_iovar_int_set(ifp, "arp_ol", mode); ++ if (err) { ++ brcmf_dbg(TRACE, "failed to set ARP offload mode to 0x%x, err = %d\n", ++ mode, err); ++ err = 0; ++ } else { ++ err = brcmf_fil_iovar_int_set(ifp, "arpoe", enable); ++ if (err) { ++ brcmf_dbg(TRACE, "failed to configure (%d) ARP offload err = %d\n", ++ enable, err); ++ err = 0; ++ } else ++ brcmf_dbg(TRACE, "successfully configured (%d) ARP offload to 0x%x\n", ++ enable, mode); ++ } ++ ++ err = brcmf_fil_iovar_int_set(ifp, "ndoe", enable); ++ if (err) ++ brcmf_dbg(TRACE, "failed to configure (%d) ND offload err = %d\n", ++ enable, err); ++ else ++ brcmf_dbg(TRACE, "successfully configured (%d) ND offload to 0x%x\n", ++ enable, mode); ++} ++ + static void _brcmf_set_multicast_list(struct work_struct *work) + { + struct brcmf_if *ifp; +@@ -134,6 +171,8 @@ static void _brcmf_set_multicast_list(struct work_struct *work) + if (err < 0) + brcmf_err("Setting BRCMF_C_SET_PROMISC failed, %d\n", + err); ++ ++ brcmf_configure_arp_nd_offload(ifp, !cmd_value); + } + + #if IS_ENABLED(CONFIG_IPV6) +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +index c94dcab260d0009bc960e1eef119f66c2187e718..ba699fadd4dc8c5155b8567d330135bdc421b9c4 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.h +@@ -208,6 +208,7 @@ int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp); + char *brcmf_ifname(struct brcmf_if *ifp); + struct brcmf_if *brcmf_get_ifp(struct brcmf_pub *drvr, int ifidx); + int brcmf_net_attach(struct brcmf_if *ifp, bool rtnl_locked); ++void brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable); + struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx, + bool is_p2pdev, const char *name, u8 *mac_addr); + void brcmf_remove_interface(struct brcmf_if *ifp, bool rtnl_locked); + +From e155c2d95b09bfefaa78a1dba0751970438299bf Mon Sep 17 00:00:00 2001 +From: Kevin Cernekee +Date: Sat, 16 Sep 2017 21:08:22 -0700 +Subject: [PATCH 387/407] brcmfmac: Avoid possible out-of-bounds read + +In brcmf_p2p_notify_rx_mgmt_p2p_probereq(), chanspec is assigned before +the length of rxframe is validated. This could lead to uninitialized +data being accessed (but not printed). Since we already have a +perfectly good endian-swapped copy of rxframe->chanspec in ch.chspec, +and ch.chspec is not modified by decchspec(), avoid the extra +assignment and use ch.chspec in the debug print. + +Suggested-by: Mattias Nissler +Signed-off-by: Kevin Cernekee +Reviewed-by: Arend van Spriel +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +index 85d949e03f79f7c9566c7b00a9bbe99853df7f16..10571ef8dfe0086ce689b3ff1700de0a1f6cabf1 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c +@@ -1853,7 +1853,6 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp, + struct afx_hdl *afx_hdl = &p2p->afx_hdl; + struct brcmf_cfg80211_vif *vif = ifp->vif; + struct brcmf_rx_mgmt_data *rxframe = (struct brcmf_rx_mgmt_data *)data; +- u16 chanspec = be16_to_cpu(rxframe->chanspec); + struct brcmu_chan ch; + u8 *mgmt_frame; + u32 mgmt_frame_len; +@@ -1906,7 +1905,7 @@ s32 brcmf_p2p_notify_rx_mgmt_p2p_probereq(struct brcmf_if *ifp, + cfg80211_rx_mgmt(&vif->wdev, freq, 0, mgmt_frame, mgmt_frame_len, 0); + + brcmf_dbg(INFO, "mgmt_frame_len (%d) , e->datalen (%d), chanspec (%04x), freq (%d)\n", +- mgmt_frame_len, e->datalen, chanspec, freq); ++ mgmt_frame_len, e->datalen, ch.chspec, freq); + + return 0; + } + +From 61dbbbb94d3644916318efe0ee7b5c7d78458988 Mon Sep 17 00:00:00 2001 +From: Kevin Cernekee +Date: Sat, 16 Sep 2017 21:08:23 -0700 +Subject: [PATCH 388/407] brcmfmac: Delete redundant length check + +brcmf_fweh_process_event() sets event->datalen to the +endian-swapped value of event_packet->msg.datalen, which is the +same as emsg.datalen. This length is already validated in +brcmf_fweh_process_event(), so there is no need to check it +again upon dequeuing the event. + +Suggested-by: Arend van Spriel +Signed-off-by: Kevin Cernekee +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +index 6afcf86b9ba29aefa09ae2794e9f8f1bd06222db..27e7d38c03bad3dfa5905f39c5ee6b6cb21a18e6 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fweh.c +@@ -257,11 +257,6 @@ static void brcmf_fweh_event_worker(struct work_struct *work) + brcmf_dbg_hex_dump(BRCMF_EVENT_ON(), event->data, + min_t(u32, emsg.datalen, 64), + "event payload, len=%d\n", emsg.datalen); +- if (emsg.datalen > event->datalen) { +- brcmf_err("event invalid length header=%d, msg=%d\n", +- event->datalen, emsg.datalen); +- goto event_free; +- } + + /* special handling of interface event */ + if (event->code == BRCMF_E_IF) { + +From 992269a3454192d0e664c2274b23d6cb79554360 Mon Sep 17 00:00:00 2001 +From: Chung-Hsien Hsu +Date: Sun, 14 May 2017 20:11:05 -0500 +Subject: [PATCH 389/407] brcmfmac: add CLM download support + +Future firmwares will be provided with minimal built-in CLM - the +NULL region (#n/0) becomes the initial country. It cannot be changed +until downloading a CLM blob file with some other regions. This patch +adds support for CLM blob file download. The blob file should be named +as firmware but with extension .clm_blob (e.g. +brcmfmac43430-sdio.clm_blob) and be placed in /lib/firmware/brcm/. + +Change-Id: I0901a4b38592fe28d0adeb8f3e2402292842f169 + +Signed-off-by: Chung-Hsien Hsu +--- + .../net/wireless/broadcom/brcm80211/brcmfmac/bus.h | 13 ++ + .../wireless/broadcom/brcm80211/brcmfmac/common.c | 175 +++++++++++++++++++++ + .../broadcom/brcm80211/brcmfmac/fwil_types.h | 27 ++++ + .../wireless/broadcom/brcm80211/brcmfmac/pcie.c | 19 +++ + .../wireless/broadcom/brcm80211/brcmfmac/sdio.c | 19 +++ + .../net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 18 +++ + 6 files changed, 271 insertions(+) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +index 2b246545647ac35810e6ade0ac81adab4c0424d8..045e2acd60153a6d8e292932eceeabce48b1bd93 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +@@ -69,6 +69,7 @@ struct brcmf_bus_dcmd { + * @wowl_config: specify if dongle is configured for wowl when going to suspend + * @get_ramsize: obtain size of device memory. + * @get_memdump: obtain device memory dump in provided buffer. ++ * @get_fwname: obtain firmware name. + * + * This structure provides an abstract interface towards the + * bus specific driver. For control messages to common driver +@@ -85,6 +86,8 @@ struct brcmf_bus_ops { + void (*wowl_config)(struct device *dev, bool enabled); + size_t (*get_ramsize)(struct device *dev); + int (*get_memdump)(struct device *dev, void *data, size_t len); ++ int (*get_fwname)(struct device *dev, uint chip, uint chiprev, ++ unsigned char *fw_name); + }; + + +@@ -208,6 +211,16 @@ int brcmf_bus_get_memdump(struct brcmf_bus *bus, void *data, size_t len) + return bus->ops->get_memdump(bus->dev, data, len); + } + ++static inline ++int brcmf_bus_get_fwname(struct brcmf_bus *bus, uint chip, uint chiprev, ++ unsigned char *fw_name) ++{ ++ if (!bus->ops->get_fwname) ++ return -EOPNOTSUPP; ++ ++ return bus->ops->get_fwname(bus->dev, chip, chiprev, fw_name); ++} ++ + /* + * interface functions from common layer + */ +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +index b081673abcb4aa72d70d8e0834b608f65fea16e8..678dbb1dc7b01a94224741c16bca616232308bcd 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include + #include + #include "core.h" +@@ -28,6 +29,7 @@ + #include "tracepoint.h" + #include "common.h" + #include "of.h" ++#include "firmware.h" + + MODULE_AUTHOR("Broadcom Corporation"); + MODULE_DESCRIPTION("Broadcom 802.11 wireless LAN fullmac driver."); +@@ -104,15 +106,170 @@ void brcmf_c_set_joinpref_default(struct brcmf_if *ifp) + brcmf_err("Set join_pref error (%d)\n", err); + } + ++int brcmf_c_download_2_dongle(struct brcmf_if *ifp, char *dcmd, u16 flag, ++ u16 dload_type, char *dload_buf, u32 len) ++{ ++ struct brcmf_dload_data_le *dload_ptr; ++ u32 dload_data_offset; ++ u16 flags; ++ s32 err; ++ ++ dload_ptr = (struct brcmf_dload_data_le *)dload_buf; ++ dload_data_offset = offsetof(struct brcmf_dload_data_le, data); ++ flags = flag | (DLOAD_HANDLER_VER << DLOAD_FLAG_VER_SHIFT); ++ ++ dload_ptr->flag = cpu_to_le16(flags); ++ dload_ptr->dload_type = cpu_to_le16(dload_type); ++ dload_ptr->len = cpu_to_le32(len - dload_data_offset); ++ dload_ptr->crc = cpu_to_le32(0); ++ len = len + 8 - (len % 8); ++ ++ err = brcmf_fil_iovar_data_set(ifp, dcmd, (void *)dload_buf, len); ++ ++ return err; ++} ++ ++int brcmf_c_get_clm_name(struct brcmf_if *ifp, u8 *clm_name) ++{ ++ struct brcmf_rev_info_le revinfo; ++ struct brcmf_bus *bus = ifp->drvr->bus_if; ++ u8 fw_name[BRCMF_FW_NAME_LEN]; ++ u8 *ptr; ++ size_t len; ++ u32 chipnum; ++ u32 chiprev; ++ s32 err; ++ ++ err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_REVINFO, &revinfo, ++ sizeof(revinfo)); ++ if (err < 0) { ++ brcmf_err("retrieving revision info failed (%d)\n", err); ++ goto done; ++ } ++ ++ chipnum = le32_to_cpu(revinfo.chipnum); ++ chiprev = le32_to_cpu(revinfo.chiprev); ++ ++ memset(fw_name, 0, BRCMF_FW_NAME_LEN); ++ err = brcmf_bus_get_fwname(bus, chipnum, chiprev, fw_name); ++ if (err) { ++ brcmf_err("get firmware name failed (%d)\n", err); ++ goto done; ++ } ++ ++ /* generate CLM blob file name */ ++ ptr = strrchr(fw_name, '.'); ++ len = ptr - fw_name + 1; ++ if (len + strlen(".clm_blob") > BRCMF_FW_NAME_LEN) { ++ err = -E2BIG; ++ } else { ++ strlcpy(clm_name, fw_name, len); ++ strlcat(clm_name, ".clm_blob", BRCMF_FW_NAME_LEN); ++ } ++done: ++ return err; ++} ++ ++int brcmf_c_process_clm_blob(struct brcmf_if *ifp) ++{ ++ struct device *dev = ifp->drvr->bus_if->dev; ++ const struct firmware *clm = NULL; ++ u8 buf[BRCMF_DCMD_SMLEN]; ++ u8 clm_name[BRCMF_FW_NAME_LEN]; ++ u32 data_offset; ++ u32 size2alloc; ++ u8 *chunk_buf; ++ u32 chunk_len; ++ u32 datalen; ++ u32 cumulative_len = 0; ++ u16 dl_flag = DL_BEGIN; ++ s32 err; ++ ++ brcmf_dbg(INFO, "Enter\n"); ++ ++ memset(clm_name, 0, BRCMF_FW_NAME_LEN); ++ err = brcmf_c_get_clm_name(ifp, clm_name); ++ if (err) { ++ brcmf_err("get CLM blob file name failed (%d)\n", err); ++ return err; ++ } ++ ++ err = request_firmware(&clm, clm_name, dev); ++ if (err) { ++ if (err == -ENOENT) ++ return 0; ++ brcmf_err("request CLM blob file failed (%d)\n", err); ++ return err; ++ } ++ ++ datalen = clm->size; ++ data_offset = offsetof(struct brcmf_dload_data_le, data); ++ size2alloc = data_offset + MAX_CHUNK_LEN; ++ ++ chunk_buf = kzalloc(size2alloc, GFP_KERNEL); ++ if (!chunk_buf) { ++ err = -ENOMEM; ++ goto done; ++ } ++ ++ do { ++ if (datalen > MAX_CHUNK_LEN) { ++ chunk_len = MAX_CHUNK_LEN; ++ } else { ++ chunk_len = datalen; ++ dl_flag |= DL_END; ++ } ++ ++ memcpy(chunk_buf + data_offset, clm->data + cumulative_len, ++ chunk_len); ++ ++ err = brcmf_c_download_2_dongle(ifp, "clmload", dl_flag, ++ DL_TYPE_CLM, chunk_buf, ++ data_offset + chunk_len); ++ ++ dl_flag &= ~DL_BEGIN; ++ ++ cumulative_len += chunk_len; ++ datalen -= chunk_len; ++ } while ((datalen > 0) && (err == 0)); ++ ++ if (err) { ++ brcmf_err("clmload (%d byte file) failed (%d); ", ++ (u32)clm->size, err); ++ /* Retrieve clmload_status and print */ ++ memset(buf, 0, BRCMF_DCMD_SMLEN); ++ err = brcmf_fil_iovar_data_get(ifp, "clmload_status", buf, ++ BRCMF_DCMD_SMLEN); ++ if (err) ++ brcmf_err("get clmload_status failed (%d)\n", err); ++ else ++ brcmf_err("clmload_status=%d\n", *((int *)buf)); ++ err = -EIO; ++ } ++ ++ kfree(chunk_buf); ++done: ++ release_firmware(clm); ++ return err; ++} ++ + int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) + { + s8 eventmask[BRCMF_EVENTING_MASK_LEN]; + u8 buf[BRCMF_DCMD_SMLEN]; + struct brcmf_rev_info_le revinfo; + struct brcmf_rev_info *ri; ++ char *clmver; + char *ptr; + s32 err; + ++ /* Do any CLM downloading */ ++ err = brcmf_c_process_clm_blob(ifp); ++ if (err < 0) { ++ brcmf_err("download CLM blob file failed, %d\n", err); ++ goto done; ++ } ++ + /* retreive mac address */ + err = brcmf_fil_iovar_data_get(ifp, "cur_etheraddr", ifp->mac_addr, + sizeof(ifp->mac_addr)); +@@ -167,6 +324,24 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) + ptr = strrchr(buf, ' ') + 1; + strlcpy(ifp->drvr->fwver, ptr, sizeof(ifp->drvr->fwver)); + ++ /* Query for 'clmver' to get CLM version info from firmware */ ++ memset(buf, 0, sizeof(buf)); ++ err = brcmf_fil_iovar_data_get(ifp, "clmver", buf, sizeof(buf)); ++ if (err) { ++ brcmf_err("retrieving clmver failed, %d\n", err); ++ goto done; ++ } else { ++ clmver = (char *)buf; ++ /* Replace all newline/linefeed characters with space ++ * character ++ */ ++ ptr = clmver; ++ while ((ptr = strchr(ptr, '\n')) != NULL) ++ *ptr = ' '; ++ ++ brcmf_err("CLM version = %s\n", clmver); ++ } ++ + /* set mpc */ + err = brcmf_fil_iovar_int_set(ifp, "mpc", 1); + if (err) { +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +index 59013572fbe3fc8cbbfc5d83f0d4ff4e827aa893..86305bb9c37f69e0c9f8c2f05f5afbcea8ba4643 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +@@ -151,6 +151,22 @@ + #define BRCMF_MFP_CAPABLE 1 + #define BRCMF_MFP_REQUIRED 2 + ++/* MAX_CHUNK_LEN is the amount of the clm file we send in each ioctl. ++ * It is relatively small because dongles (FW) have a small maximum size ++ * input payload restriction for ioctls. ++ */ ++#define MAX_CHUNK_LEN 1400 ++ ++#define DLOAD_HANDLER_VER 1 /* Downloader version */ ++#define DLOAD_FLAG_VER_MASK 0xf000 /* Downloader version mask */ ++#define DLOAD_FLAG_VER_SHIFT 12 /* Downloader version shift */ ++ ++#define DL_CRC_NOT_INUSE 0x0001 ++#define DL_BEGIN 0x0002 ++#define DL_END 0x0004 ++ ++#define DL_TYPE_CLM 2 ++ + /* join preference types for join_pref iovar */ + enum brcmf_join_pref_types { + BRCMF_JOIN_PREF_RSSI = 1, +@@ -817,4 +833,15 @@ struct brcmf_gtk_keyinfo_le { + u8 replay_counter[BRCMF_RSN_REPLAY_LEN]; + }; + ++/** ++ * struct brcmf_dload_data_le - data passing to firmware for downloading ++ */ ++struct brcmf_dload_data_le { ++ __le16 flag; ++ __le16 dload_type; ++ __le32 len; ++ __le32 crc; ++ u8 data[1]; ++}; ++ + #endif /* FWIL_TYPES_H_ */ +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +index d3d79219fbb05bbf4ba94d283403bcb978e8383b..eb4672f3b2303e9c6036cba9bffa697fdc0be07f 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1317,6 +1317,24 @@ static int brcmf_pcie_get_memdump(struct device *dev, void *data, size_t len) + return 0; + } + ++static int brcmf_pcie_get_fwname(struct device *dev, u32 chip, u32 chiprev, ++ u8 *fw_name) ++{ ++ struct brcmf_bus *bus_if = dev_get_drvdata(dev); ++ struct brcmf_pciedev *buspub = bus_if->bus_priv.pcie; ++ struct brcmf_pciedev_info *devinfo = buspub->devinfo; ++ int ret = 0; ++ ++ if (devinfo->fw_name[0] != '\0') ++ strlcpy(fw_name, devinfo->fw_name, BRCMF_FW_NAME_LEN); ++ else ++ ret = brcmf_fw_map_chip_to_name(chip, chiprev, ++ brcmf_pcie_fwnames, ++ ARRAY_SIZE(brcmf_pcie_fwnames), ++ fw_name, NULL); ++ ++ return ret; ++} + + static const struct brcmf_bus_ops brcmf_pcie_bus_ops = { + .txdata = brcmf_pcie_tx, +@@ -1326,6 +1344,7 @@ static const struct brcmf_bus_ops brcmf_pcie_bus_ops = { + .wowl_config = brcmf_pcie_wowl_config, + .get_ramsize = brcmf_pcie_get_ramsize, + .get_memdump = brcmf_pcie_get_memdump, ++ .get_fwname = brcmf_pcie_get_fwname, + }; + + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +index 0aab6faef9220fc4a187db409d27adbc5598295f..a282b0274d0645555ca34993f829a9692f78bc79 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -3965,6 +3965,24 @@ brcmf_sdio_watchdog(unsigned long data) + } + } + ++static int brcmf_sdio_get_fwname(struct device *dev, u32 chip, u32 chiprev, ++ u8 *fw_name) ++{ ++ struct brcmf_bus *bus_if = dev_get_drvdata(dev); ++ struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio; ++ int ret = 0; ++ ++ if (sdiodev->fw_name[0] != '\0') ++ strlcpy(fw_name, sdiodev->fw_name, BRCMF_FW_NAME_LEN); ++ else ++ ret = brcmf_fw_map_chip_to_name(chip, chiprev, ++ brcmf_sdio_fwnames, ++ ARRAY_SIZE(brcmf_sdio_fwnames), ++ fw_name, NULL); ++ ++ return ret; ++} ++ + static const struct brcmf_bus_ops brcmf_sdio_bus_ops = { + .stop = brcmf_sdio_bus_stop, + .preinit = brcmf_sdio_bus_preinit, +@@ -3975,6 +3993,7 @@ static const struct brcmf_bus_ops brcmf_sdio_bus_ops = { + .wowl_config = brcmf_sdio_wowl_config, + .get_ramsize = brcmf_sdio_bus_get_ramsize, + .get_memdump = brcmf_sdio_bus_get_memdump, ++ .get_fwname = brcmf_sdio_get_fwname, + }; + + static void brcmf_sdio_firmware_callback(struct device *dev, int err, +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +index 053f3b59f21e07a720406bb3165806e27f631025..49384fcc02c0d7f54c159d5d0c712d2f55b4c108 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -1125,12 +1125,30 @@ static void brcmf_usb_wowl_config(struct device *dev, bool enabled) + device_set_wakeup_enable(devinfo->dev, false); + } + ++static int brcmf_usb_get_fwname(struct device *dev, u32 chip, u32 chiprev, ++ u8 *fw_name) ++{ ++ struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); ++ int ret = 0; ++ ++ if (devinfo->fw_name[0] != '\0') ++ strlcpy(fw_name, devinfo->fw_name, BRCMF_FW_NAME_LEN); ++ else ++ ret = brcmf_fw_map_chip_to_name(chip, chiprev, ++ brcmf_usb_fwnames, ++ ARRAY_SIZE(brcmf_usb_fwnames), ++ fw_name, NULL); ++ ++ return ret; ++} ++ + static const struct brcmf_bus_ops brcmf_usb_bus_ops = { + .txdata = brcmf_usb_tx, + .stop = brcmf_usb_down, + .txctl = brcmf_usb_tx_ctlpkt, + .rxctl = brcmf_usb_rx_ctlpkt, + .wowl_config = brcmf_usb_wowl_config, ++ .get_fwname = brcmf_usb_get_fwname, + }; + + static int brcmf_usb_bus_setup(struct brcmf_usbdev_info *devinfo) + +From 51431aad8549803464d9e2b684c45a7c12666a8e Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 6 Oct 2017 13:23:32 +0100 +Subject: [PATCH 390/407] brcmfmac: request_firmware_direct is quieter + +Since we don't have any CLM-capable firmware yet, silence the warning +of its absence by using request_firmware_direct, which should also +be marginally quicker. + +Signed-off-by: Phil Elwell +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +index 678dbb1dc7b01a94224741c16bca616232308bcd..297fbd7db6a22501a8b63068910ff8a666db9987 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +@@ -194,7 +194,7 @@ int brcmf_c_process_clm_blob(struct brcmf_if *ifp) + return err; + } + +- err = request_firmware(&clm, clm_name, dev); ++ err = request_firmware_direct(&clm, clm_name, dev); + if (err) { + if (err == -ENOENT) + return 0; + +From 5491b411b010c07bee3f60acee9ac9c63ba24aea Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 29 Sep 2017 10:32:19 +0100 +Subject: [PATCH 391/407] amba_pl011: Add cts-event-workaround DT property + +The BCM2835 PL011 implementation seems to have a bug that can lead to a +transmission lockup if CTS changes frequently. A workaround was added to +the driver with a vendor-specific flag to enable it, but this flag is +currently not set for ARM implementations. + +Add a "cts-event-workaround" property to Pi DTBs and use the presence +of that property to force the flag to be enabled in the driver. + +See: https://github.com/raspberrypi/linux/issues/1280 + +Signed-off-by: Phil Elwell +--- + Documentation/devicetree/bindings/serial/pl011.txt | 3 +++ + arch/arm/boot/dts/bcm270x.dtsi | 5 +++++ + drivers/tty/serial/amba-pl011.c | 5 +++++ + 3 files changed, 13 insertions(+) + +diff --git a/Documentation/devicetree/bindings/serial/pl011.txt b/Documentation/devicetree/bindings/serial/pl011.txt +index 77863aefe9ef1eafe648b530c1570333aea7940b..8d65b0ec2828b6abb07589407a5126fde6e49a0e 100644 +--- a/Documentation/devicetree/bindings/serial/pl011.txt ++++ b/Documentation/devicetree/bindings/serial/pl011.txt +@@ -35,6 +35,9 @@ Optional properties: + - poll-timeout-ms: + Poll timeout when auto-poll is set, default + 3000ms. ++- cts-event-workaround: ++ Enables the (otherwise vendor-specific) workaround for the ++ CTS-induced TX lockup. + + See also bindings/arm/primecell.txt + +diff --git a/arch/arm/boot/dts/bcm270x.dtsi b/arch/arm/boot/dts/bcm270x.dtsi +index caa66393518603529d284f360b2000b0ed4852ef..6af5a365137754160d6c700431ac6870639d7d41 100644 +--- a/arch/arm/boot/dts/bcm270x.dtsi ++++ b/arch/arm/boot/dts/bcm270x.dtsi +@@ -26,6 +26,11 @@ + interrupts = <2 17>, <2 18>; + }; + ++ serial@7e201000 { /* uart0 */ ++ /* Enable CTS bug workaround */ ++ cts-event-workaround; ++ }; ++ + sdhost: sdhost@7e202000 { + compatible = "brcm,bcm2835-sdhost"; + reg = <0x7e202000 0x100>; +diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c +index 003a5b0c30295dbbcb94a28d0c64d1241d801e73..10c996f869a9cbda073ff48550ba055713b0311d 100644 +--- a/drivers/tty/serial/amba-pl011.c ++++ b/drivers/tty/serial/amba-pl011.c +@@ -2523,6 +2523,11 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id) + if (IS_ERR(uap->clk)) + return PTR_ERR(uap->clk); + ++ if (of_property_read_bool(dev->dev.of_node, "cts-event-workaround")) { ++ vendor->cts_event_workaround = true; ++ dev_info(&dev->dev, "cts_event_workaround enabled\n"); ++ } ++ + uap->reg_offset = vendor->reg_offset; + uap->vendor = vendor; + uap->fifosize = vendor->get_fifosize(dev); + +From 69a4848bb6bfbb1d8c2242ffbf99d6ce026c8325 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 29 Sep 2017 10:32:19 +0100 +Subject: [PATCH 392/407] amba_pl011: Insert mb() for correct FIFO handling + +The pl011 register accessor functions use the _relaxed versions of the +standard readl() and writel() functions, meaning that there are no +automatic memory barriers. When polling a FIFO status register to check +for fullness, it is necessary to ensure that any outstanding writes have +completed; otherwise the flags are effectively stale, making it possible +that the next write is to a full FIFO. + +Signed-off-by: Phil Elwell +--- + drivers/tty/serial/amba-pl011.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c +index 10c996f869a9cbda073ff48550ba055713b0311d..a1adfe7f39b95d474ebab8233c4ed1b3a670a535 100644 +--- a/drivers/tty/serial/amba-pl011.c ++++ b/drivers/tty/serial/amba-pl011.c +@@ -1384,6 +1384,7 @@ static bool pl011_tx_char(struct uart_amba_port *uap, unsigned char c, + return false; /* unable to transmit character */ + + pl011_write(c, uap, REG_DR); ++ mb(); + uap->port.icount.tx++; + + return true; + +From 22fc6dfdc3ea99f74a9e21c9d5e81a8ea434dc4e Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 11 Oct 2017 13:48:04 +0100 +Subject: [PATCH 393/407] amba-pl011: Report AUTOCTS capability to framework + +The PL011 has full hardware RTS/CTS support which is enabled by +the driver when flow control is requested. However, it doesn't +notify the UART framework of the fact, causing the software CTS +support to be enabled at the same time. + +Software CTS triggers the sending of another batch of characters +when CTS becomes asserted. The pl011 interrupt handler processes +the CTIS bit before TXIS, which can cause some characters to be +sent between the time that the TXIS bit first becomes asserted +and the time it is handled by a call to px011_tx_chars. This +would be fine were it not for the optimisation in pl011_tx_char +that assumes the FIFO is half-empty if called from the interrupt +handler and skips the checking of the FIFO status register before +sending each character, leading to data loss if the FIFO is more +than half-full. + +Prevent the data loss and improve efficiency by indicating the +AUTOCTS support. + +Signed-off-by: Phil Elwell +--- + drivers/tty/serial/amba-pl011.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c +index a1adfe7f39b95d474ebab8233c4ed1b3a670a535..5b39ad028868748c98eef2fcf7a9d1a19408a09b 100644 +--- a/drivers/tty/serial/amba-pl011.c ++++ b/drivers/tty/serial/amba-pl011.c +@@ -2021,9 +2021,11 @@ pl011_set_termios(struct uart_port *port, struct ktermios *termios, + + old_cr |= UART011_CR_CTSEN; + uap->autorts = true; ++ port->status |= UPSTAT_AUTOCTS; + } else { + old_cr &= ~(UART011_CR_CTSEN | UART011_CR_RTSEN); + uap->autorts = false; ++ port->status &= ~UPSTAT_AUTOCTS; + } + + if (uap->vendor->oversampling) { + +From 55877eb5003b50b91e29e0f439dec07d8bb5e80e Mon Sep 17 00:00:00 2001 +From: Mariusz Bialonczyk +Date: Thu, 23 Feb 2017 07:38:43 +0100 +Subject: [PATCH 394/407] w1: add support for DS2438 Smart Battery Monitor + +[ Upstream commit e3af95e60738e2f0ecedca96f8f3baa2fa4d1b7d ] + +Detailed information about support and provided sysfs files +in my next commit which creates a documentation file: +Documentation/w1/slaves/w1_ds2438 + +Signed-off-by: Mariusz Bialonczyk +Signed-off-by: Greg Kroah-Hartman +--- + drivers/w1/slaves/Kconfig | 6 + + drivers/w1/slaves/Makefile | 1 + + drivers/w1/slaves/w1_ds2438.c | 390 ++++++++++++++++++++++++++++++++++++++++++ + drivers/w1/w1_family.h | 1 + + 4 files changed, 398 insertions(+) + create mode 100644 drivers/w1/slaves/w1_ds2438.c + +diff --git a/drivers/w1/slaves/Kconfig b/drivers/w1/slaves/Kconfig +index cfe74d09932e09f441c957a06662d97faccfd967..9b4a79782276f653b723e96ed04ac1e12718c1c1 100644 +--- a/drivers/w1/slaves/Kconfig ++++ b/drivers/w1/slaves/Kconfig +@@ -78,6 +78,12 @@ config W1_SLAVE_DS2433_CRC + Each block has 30 bytes of data and a two byte CRC16. + Full block writes are only allowed if the CRC is valid. + ++config W1_SLAVE_DS2438 ++ tristate "DS2438 Smart Battery Monitor 0x26 family support" ++ help ++ Say Y here if you want to use a 1-wire ++ DS2438 Smart Battery Monitor device support ++ + config W1_SLAVE_DS2760 + tristate "Dallas 2760 battery monitor chip (HP iPAQ & others)" + help +diff --git a/drivers/w1/slaves/Makefile b/drivers/w1/slaves/Makefile +index 1e9989afe7bf74d72ab93375e71ddb985a3bcb39..7ad7a2cf1e1200ef17c3d97907db5e2ffde60fbb 100644 +--- a/drivers/w1/slaves/Makefile ++++ b/drivers/w1/slaves/Makefile +@@ -10,6 +10,7 @@ obj-$(CONFIG_W1_SLAVE_DS2406) += w1_ds2406.o + obj-$(CONFIG_W1_SLAVE_DS2423) += w1_ds2423.o + obj-$(CONFIG_W1_SLAVE_DS2431) += w1_ds2431.o + obj-$(CONFIG_W1_SLAVE_DS2433) += w1_ds2433.o ++obj-$(CONFIG_W1_SLAVE_DS2438) += w1_ds2438.o + obj-$(CONFIG_W1_SLAVE_DS2760) += w1_ds2760.o + obj-$(CONFIG_W1_SLAVE_DS2780) += w1_ds2780.o + obj-$(CONFIG_W1_SLAVE_DS2781) += w1_ds2781.o +diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c +new file mode 100644 +index 0000000000000000000000000000000000000000..5ededb4965e143ab774d2705b2ad1e6b0d4fa51b +--- /dev/null ++++ b/drivers/w1/slaves/w1_ds2438.c +@@ -0,0 +1,390 @@ ++/* ++ * 1-Wire implementation for the ds2438 chip ++ * ++ * Copyright (c) 2017 Mariusz Bialonczyk ++ * ++ * This source code is licensed under the GNU General Public License, ++ * Version 2. See the file COPYING for more details. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#include "../w1.h" ++#include "../w1_family.h" ++ ++#define W1_DS2438_RETRIES 3 ++ ++/* Memory commands */ ++#define W1_DS2438_READ_SCRATCH 0xBE ++#define W1_DS2438_WRITE_SCRATCH 0x4E ++#define W1_DS2438_COPY_SCRATCH 0x48 ++#define W1_DS2438_RECALL_MEMORY 0xB8 ++/* Register commands */ ++#define W1_DS2438_CONVERT_TEMP 0x44 ++#define W1_DS2438_CONVERT_VOLTAGE 0xB4 ++ ++#define DS2438_PAGE_SIZE 8 ++#define DS2438_ADC_INPUT_VAD 0 ++#define DS2438_ADC_INPUT_VDD 1 ++#define DS2438_MAX_CONVERSION_TIME 10 /* ms */ ++ ++/* Page #0 definitions */ ++#define DS2438_STATUS_REG 0x00 /* Status/Configuration Register */ ++#define DS2438_STATUS_IAD (1 << 0) /* Current A/D Control Bit */ ++#define DS2438_STATUS_CA (1 << 1) /* Current Accumulator Configuration */ ++#define DS2438_STATUS_EE (1 << 2) /* Current Accumulator Shadow Selector bit */ ++#define DS2438_STATUS_AD (1 << 3) /* Voltage A/D Input Select Bit */ ++#define DS2438_STATUS_TB (1 << 4) /* Temperature Busy Flag */ ++#define DS2438_STATUS_NVB (1 << 5) /* Nonvolatile Memory Busy Flag */ ++#define DS2438_STATUS_ADB (1 << 6) /* A/D Converter Busy Flag */ ++ ++#define DS2438_TEMP_LSB 0x01 ++#define DS2438_TEMP_MSB 0x02 ++#define DS2438_VOLTAGE_LSB 0x03 ++#define DS2438_VOLTAGE_MSB 0x04 ++#define DS2438_CURRENT_LSB 0x05 ++#define DS2438_CURRENT_MSB 0x06 ++#define DS2438_THRESHOLD 0x07 ++ ++int w1_ds2438_get_page(struct w1_slave *sl, int pageno, u8 *buf) ++{ ++ unsigned int retries = W1_DS2438_RETRIES; ++ u8 w1_buf[2]; ++ u8 crc; ++ size_t count; ++ ++ while (retries--) { ++ crc = 0; ++ ++ if (w1_reset_select_slave(sl)) ++ continue; ++ w1_buf[0] = W1_DS2438_RECALL_MEMORY; ++ w1_buf[1] = 0x00; ++ w1_write_block(sl->master, w1_buf, 2); ++ ++ if (w1_reset_select_slave(sl)) ++ continue; ++ w1_buf[0] = W1_DS2438_READ_SCRATCH; ++ w1_buf[1] = 0x00; ++ w1_write_block(sl->master, w1_buf, 2); ++ ++ count = w1_read_block(sl->master, buf, DS2438_PAGE_SIZE + 1); ++ if (count == DS2438_PAGE_SIZE + 1) { ++ crc = w1_calc_crc8(buf, DS2438_PAGE_SIZE); ++ ++ /* check for correct CRC */ ++ if ((u8)buf[DS2438_PAGE_SIZE] == crc) ++ return 0; ++ } ++ } ++ return -1; ++} ++ ++int w1_ds2438_get_temperature(struct w1_slave *sl, int16_t *temperature) ++{ ++ unsigned int retries = W1_DS2438_RETRIES; ++ u8 w1_buf[DS2438_PAGE_SIZE + 1 /*for CRC*/]; ++ unsigned int tm = DS2438_MAX_CONVERSION_TIME; ++ unsigned long sleep_rem; ++ int ret; ++ ++ mutex_lock(&sl->master->bus_mutex); ++ ++ while (retries--) { ++ if (w1_reset_select_slave(sl)) ++ continue; ++ w1_write_8(sl->master, W1_DS2438_CONVERT_TEMP); ++ ++ mutex_unlock(&sl->master->bus_mutex); ++ sleep_rem = msleep_interruptible(tm); ++ if (sleep_rem != 0) { ++ ret = -1; ++ goto post_unlock; ++ } ++ ++ if (mutex_lock_interruptible(&sl->master->bus_mutex) != 0) { ++ ret = -1; ++ goto post_unlock; ++ } ++ ++ break; ++ } ++ ++ if (w1_ds2438_get_page(sl, 0, w1_buf) == 0) { ++ *temperature = (((int16_t) w1_buf[DS2438_TEMP_MSB]) << 8) | ((uint16_t) w1_buf[DS2438_TEMP_LSB]); ++ ret = 0; ++ } else ++ ret = -1; ++ ++ mutex_unlock(&sl->master->bus_mutex); ++ ++post_unlock: ++ return ret; ++} ++ ++int w1_ds2438_change_config_bit(struct w1_slave *sl, u8 mask, u8 value) ++{ ++ unsigned int retries = W1_DS2438_RETRIES; ++ u8 w1_buf[3]; ++ u8 status; ++ int perform_write = 0; ++ ++ while (retries--) { ++ if (w1_reset_select_slave(sl)) ++ continue; ++ w1_buf[0] = W1_DS2438_RECALL_MEMORY; ++ w1_buf[1] = 0x00; ++ w1_write_block(sl->master, w1_buf, 2); ++ ++ if (w1_reset_select_slave(sl)) ++ continue; ++ w1_buf[0] = W1_DS2438_READ_SCRATCH; ++ w1_buf[1] = 0x00; ++ w1_write_block(sl->master, w1_buf, 2); ++ ++ /* reading one byte of result */ ++ status = w1_read_8(sl->master); ++ ++ /* if bit0=1, set a value to a mask for easy compare */ ++ if (value) ++ value = mask; ++ ++ if ((status & mask) == value) ++ return 0; /* already set as requested */ ++ else { ++ /* changing bit */ ++ status ^= mask; ++ perform_write = 1; ++ } ++ break; ++ } ++ ++ if (perform_write) { ++ retries = W1_DS2438_RETRIES; ++ while (retries--) { ++ if (w1_reset_select_slave(sl)) ++ continue; ++ w1_buf[0] = W1_DS2438_WRITE_SCRATCH; ++ w1_buf[1] = 0x00; ++ w1_buf[2] = status; ++ w1_write_block(sl->master, w1_buf, 3); ++ ++ if (w1_reset_select_slave(sl)) ++ continue; ++ w1_buf[0] = W1_DS2438_COPY_SCRATCH; ++ w1_buf[1] = 0x00; ++ w1_write_block(sl->master, w1_buf, 2); ++ ++ return 0; ++ } ++ } ++ return -1; ++} ++ ++uint16_t w1_ds2438_get_voltage(struct w1_slave *sl, int adc_input, uint16_t *voltage) ++{ ++ unsigned int retries = W1_DS2438_RETRIES; ++ u8 w1_buf[DS2438_PAGE_SIZE + 1 /*for CRC*/]; ++ unsigned int tm = DS2438_MAX_CONVERSION_TIME; ++ unsigned long sleep_rem; ++ int ret; ++ ++ mutex_lock(&sl->master->bus_mutex); ++ ++ if (w1_ds2438_change_config_bit(sl, DS2438_STATUS_AD, adc_input)) { ++ ret = -1; ++ goto pre_unlock; ++ } ++ ++ while (retries--) { ++ if (w1_reset_select_slave(sl)) ++ continue; ++ w1_write_8(sl->master, W1_DS2438_CONVERT_VOLTAGE); ++ ++ mutex_unlock(&sl->master->bus_mutex); ++ sleep_rem = msleep_interruptible(tm); ++ if (sleep_rem != 0) { ++ ret = -1; ++ goto post_unlock; ++ } ++ ++ if (mutex_lock_interruptible(&sl->master->bus_mutex) != 0) { ++ ret = -1; ++ goto post_unlock; ++ } ++ ++ break; ++ } ++ ++ if (w1_ds2438_get_page(sl, 0, w1_buf) == 0) { ++ *voltage = (((uint16_t) w1_buf[DS2438_VOLTAGE_MSB]) << 8) | ((uint16_t) w1_buf[DS2438_VOLTAGE_LSB]); ++ ret = 0; ++ } else ++ ret = -1; ++ ++pre_unlock: ++ mutex_unlock(&sl->master->bus_mutex); ++ ++post_unlock: ++ return ret; ++} ++ ++static ssize_t iad_write(struct file *filp, struct kobject *kobj, ++ struct bin_attribute *bin_attr, char *buf, ++ loff_t off, size_t count) ++{ ++ struct w1_slave *sl = kobj_to_w1_slave(kobj); ++ int ret; ++ ++ if (count != 1 || off != 0) ++ return -EFAULT; ++ ++ mutex_lock(&sl->master->bus_mutex); ++ ++ if (w1_ds2438_change_config_bit(sl, DS2438_STATUS_IAD, *buf & 0x01) == 0) ++ ret = 1; ++ else ++ ret = -EIO; ++ ++ mutex_unlock(&sl->master->bus_mutex); ++ ++ return ret; ++} ++ ++static ssize_t page0_read(struct file *filp, struct kobject *kobj, ++ struct bin_attribute *bin_attr, char *buf, ++ loff_t off, size_t count) ++{ ++ struct w1_slave *sl = kobj_to_w1_slave(kobj); ++ int ret; ++ u8 w1_buf[DS2438_PAGE_SIZE + 1 /*for CRC*/]; ++ ++ if (off != 0) ++ return 0; ++ if (!buf) ++ return -EINVAL; ++ ++ mutex_lock(&sl->master->bus_mutex); ++ ++ if (w1_ds2438_get_page(sl, 0, w1_buf) == 0) { ++ memcpy(buf, &w1_buf, DS2438_PAGE_SIZE); ++ ret = DS2438_PAGE_SIZE; ++ } else ++ ret = -EIO; ++ ++ mutex_unlock(&sl->master->bus_mutex); ++ ++ return ret; ++} ++ ++static ssize_t temperature_read(struct file *filp, struct kobject *kobj, ++ struct bin_attribute *bin_attr, char *buf, ++ loff_t off, size_t count) ++{ ++ struct w1_slave *sl = kobj_to_w1_slave(kobj); ++ int ret; ++ ssize_t c = PAGE_SIZE; ++ int16_t temp; ++ ++ if (off != 0) ++ return 0; ++ if (!buf) ++ return -EINVAL; ++ ++ if (w1_ds2438_get_temperature(sl, &temp) == 0) { ++ c -= snprintf(buf + PAGE_SIZE - c, c, "%d\n", temp); ++ ret = PAGE_SIZE - c; ++ } else ++ ret = -EIO; ++ ++ return ret; ++} ++ ++static ssize_t vad_read(struct file *filp, struct kobject *kobj, ++ struct bin_attribute *bin_attr, char *buf, ++ loff_t off, size_t count) ++{ ++ struct w1_slave *sl = kobj_to_w1_slave(kobj); ++ int ret; ++ ssize_t c = PAGE_SIZE; ++ uint16_t voltage; ++ ++ if (off != 0) ++ return 0; ++ if (!buf) ++ return -EINVAL; ++ ++ if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VAD, &voltage) == 0) { ++ c -= snprintf(buf + PAGE_SIZE - c, c, "%d\n", voltage); ++ ret = PAGE_SIZE - c; ++ } else ++ ret = -EIO; ++ ++ return ret; ++} ++ ++static ssize_t vdd_read(struct file *filp, struct kobject *kobj, ++ struct bin_attribute *bin_attr, char *buf, ++ loff_t off, size_t count) ++{ ++ struct w1_slave *sl = kobj_to_w1_slave(kobj); ++ int ret; ++ ssize_t c = PAGE_SIZE; ++ uint16_t voltage; ++ ++ if (off != 0) ++ return 0; ++ if (!buf) ++ return -EINVAL; ++ ++ if (w1_ds2438_get_voltage(sl, DS2438_ADC_INPUT_VDD, &voltage) == 0) { ++ c -= snprintf(buf + PAGE_SIZE - c, c, "%d\n", voltage); ++ ret = PAGE_SIZE - c; ++ } else ++ ret = -EIO; ++ ++ return ret; ++} ++ ++static BIN_ATTR(iad, S_IRUGO | S_IWUSR | S_IWGRP, NULL, iad_write, 1); ++static BIN_ATTR_RO(page0, DS2438_PAGE_SIZE); ++static BIN_ATTR_RO(temperature, 0/* real length varies */); ++static BIN_ATTR_RO(vad, 0/* real length varies */); ++static BIN_ATTR_RO(vdd, 0/* real length varies */); ++ ++static struct bin_attribute *w1_ds2438_bin_attrs[] = { ++ &bin_attr_iad, ++ &bin_attr_page0, ++ &bin_attr_temperature, ++ &bin_attr_vad, ++ &bin_attr_vdd, ++ NULL, ++}; ++ ++static const struct attribute_group w1_ds2438_group = { ++ .bin_attrs = w1_ds2438_bin_attrs, ++}; ++ ++static const struct attribute_group *w1_ds2438_groups[] = { ++ &w1_ds2438_group, ++ NULL, ++}; ++ ++static struct w1_family_ops w1_ds2438_fops = { ++ .groups = w1_ds2438_groups, ++}; ++ ++static struct w1_family w1_ds2438_family = { ++ .fid = W1_FAMILY_DS2438, ++ .fops = &w1_ds2438_fops, ++}; ++module_w1_family(w1_ds2438_family); ++ ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Mariusz Bialonczyk "); ++MODULE_DESCRIPTION("1-wire driver for Maxim/Dallas DS2438 Smart Battery Monitor"); ++MODULE_ALIAS("w1-family-" __stringify(W1_FAMILY_DS2438)); +diff --git a/drivers/w1/w1_family.h b/drivers/w1/w1_family.h +index 10a7a0767187c52d67a41c3fcffa7ecd38c80e63..627c90a1cb4e7872078cb773b271e2a58d0b95ed 100644 +--- a/drivers/w1/w1_family.h ++++ b/drivers/w1/w1_family.h +@@ -35,6 +35,7 @@ + #define W1_COUNTER_DS2423 0x1D + #define W1_THERM_DS1822 0x22 + #define W1_EEPROM_DS2433 0x23 ++#define W1_FAMILY_DS2438 0x26 + #define W1_THERM_DS18B20 0x28 + #define W1_FAMILY_DS2408 0x29 + #define W1_EEPROM_DS2431 0x2D + +From 37d227aebf624802911c727c2cc583a007a02fed Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 16 Aug 2017 16:52:50 +0100 +Subject: [PATCH 395/407] BCM270X_DT: Set spidev spi-max-frequency to 125MHz + +The BCM2835 SPI controllers have a maximum bus clock of half the system +clock speed, so with the 250MHz system clock found on Raspberry Pis +you get a theoretical maximum bus speed of 125MHz. Note that this +speed is unlikely to be reliable, and the maximum usable bus spee will +depend on both the attached device and the wiring. + +See: https://github.com/raspberrypi/linux/issues/2165 +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/bcm2708-rpi-0-w.dts | 4 ++-- + arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 4 ++-- + arch/arm/boot/dts/bcm2708-rpi-b.dts | 4 ++-- + arch/arm/boot/dts/bcm2708-rpi-cm.dts | 4 ++-- + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 4 ++-- + arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 4 ++-- + arch/arm/boot/dts/bcm2710-rpi-cm3.dts | 4 ++-- + arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts | 2 +- + arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts | 4 ++-- + arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts | 6 +++--- + arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts | 2 +- + arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts | 4 ++-- + arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts | 6 +++--- + 13 files changed, 26 insertions(+), 26 deletions(-) + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-0-w.dts b/arch/arm/boot/dts/bcm2708-rpi-0-w.dts +index db0f99ddf2f46e83827d56e21c4846dd0b414c63..d585f052d580cc5a24b144c90a9237c25c2748ec 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-0-w.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-0-w.dts +@@ -108,7 +108,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + + spidev1: spidev@1{ +@@ -116,7 +116,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +index 08bf838fab551638e898930fba7ba49b3aeefbb3..ecbcfc35f2a80b9843cfbe55a21e25d7535706de 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts +@@ -69,7 +69,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + + spidev1: spidev@1{ +@@ -77,7 +77,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-b.dts b/arch/arm/boot/dts/bcm2708-rpi-b.dts +index 4e6b4dd6a8d9c4f13bc865bb8ced68264162cb6c..2407c23d1eea3726fe6e8b29973fd430bbbfa368 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-b.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts +@@ -69,7 +69,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + + spidev1: spidev@1{ +@@ -77,7 +77,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dts b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +index 10be69972bd1440f574e35d515f3d6a0505fd869..742cb65dedc18825fac79dc3788e4f71ae912060 100644 +--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts ++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts +@@ -52,7 +52,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + + spidev1: spidev@1{ +@@ -60,7 +60,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +index 2dc0e1204e6374bbc6924e26dc4a04b68718559a..7aea36283cbb6591818cb1260ba66549a972ff77 100644 +--- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts ++++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts +@@ -69,7 +69,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + + spidev1: spidev@1{ +@@ -77,7 +77,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +index cbec919208f3a7fdc2d07b46ed534c0951a76cd6..aadd762fae13f28f94ebb9370063f4c91dec5388 100644 +--- a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts ++++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts +@@ -128,7 +128,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + + spidev1: spidev@1{ +@@ -136,7 +136,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + }; + +diff --git a/arch/arm/boot/dts/bcm2710-rpi-cm3.dts b/arch/arm/boot/dts/bcm2710-rpi-cm3.dts +index fe402e84cdda884583336422289ac8b3cc12fb28..b8b5cbc1b24cad8a4b13aee1e36b412b719d03f7 100644 +--- a/arch/arm/boot/dts/bcm2710-rpi-cm3.dts ++++ b/arch/arm/boot/dts/bcm2710-rpi-cm3.dts +@@ -89,7 +89,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + + spidev1: spidev@1{ +@@ -97,7 +97,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + }; + }; + +diff --git a/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts +index 71c243947004fa887998065df9c259b50edfa428..c3d4f96b7aa92cd679cc8abc7c7aea1dc7c84eb6 100644 +--- a/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts ++++ b/arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts +@@ -36,7 +36,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts +index 2ae0885cf1e7fb7420f65e538310ab1addafbece..2ad62497dc895c6253c2a03b45e726e4f882d170 100644 +--- a/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts ++++ b/arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts +@@ -36,7 +36,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + +@@ -45,7 +45,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts +index 8f79044cd8f47ea055394822cc380497c985c7e5..ef82890453bfe36afd124f6a01f4ca5116b809d4 100644 +--- a/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts ++++ b/arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts +@@ -36,7 +36,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + +@@ -45,7 +45,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + +@@ -54,7 +54,7 @@ + reg = <2>; /* CE2 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts +index 6f57bc710fe123028a5a216063733f0cea9bbd54..761b6be4ff9b55da1bf3979c905a3cc8d87ca6fb 100644 +--- a/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts ++++ b/arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts +@@ -36,7 +36,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts +index d090631d36821b0c89833b9f217216f0b134a8f3..e533aba113deddd35ed3f9f6628eb130f1e09095 100644 +--- a/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts ++++ b/arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts +@@ -36,7 +36,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + +@@ -45,7 +45,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + }; +diff --git a/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts +index e2586728c311829462f6a4b3b348e35603f033ce..a62e107dc98fa484bcaad7f8caddfca450d0aea6 100644 +--- a/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts ++++ b/arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts +@@ -36,7 +36,7 @@ + reg = <0>; /* CE0 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + +@@ -45,7 +45,7 @@ + reg = <1>; /* CE1 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + +@@ -54,7 +54,7 @@ + reg = <2>; /* CE2 */ + #address-cells = <1>; + #size-cells = <0>; +- spi-max-frequency = <500000>; ++ spi-max-frequency = <125000000>; + status = "okay"; + }; + }; + +From 4c322879fed3671a195da41e2fa0827d65600525 Mon Sep 17 00:00:00 2001 +From: neilneil2000 <31366098+neilneil2000@users.noreply.github.com> +Date: Thu, 12 Oct 2017 17:29:43 +0100 +Subject: [PATCH 396/407] GPIO and gpio-poweroff clarifications + +Notes added: +1) All GPIO references use the hardware numbering scheme +2) Enabling gpio-poweroff prevents the ability to boot the pi by driving GPIO3 low +--- + arch/arm/boot/dts/overlays/README | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index d4eeeae10671ddfb43c86c1317cea65688905d9f..011b2c696df709dadddc62e7001737bd9bb134fd 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -33,6 +33,9 @@ needed. + Configuring additional, optional hardware is done using Device Tree overlays + (see below). + ++GPIO numbering uses the hardware pin numbering scheme (aka BCM scheme) and ++not the physical pin numbers. ++ + raspi-config + ============ + +@@ -496,7 +499,8 @@ Params: gpio_pin Input pin number. Default is 18. + + + Name: gpio-poweroff +-Info: Drives a GPIO high or low on poweroff (including halt) ++Info: Drives a GPIO high or low on poweroff (including halt). Enabling this ++ overlay will prevent the ability to boot by driving GPIO3 low. + Load: dtoverlay=gpio-poweroff,= + Params: gpiopin GPIO for signalling (default 26) + + +From b4c9601ccf54d855e3b55e946d24a32df7b3dda6 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 13 Oct 2017 08:47:50 +0100 +Subject: [PATCH 397/407] overlays/README: Remove trailing whitespace + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/overlays/README | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index 011b2c696df709dadddc62e7001737bd9bb134fd..3f5924f5375fcb8de86dae8686e2cd730ec1944d 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -33,7 +33,7 @@ needed. + Configuring additional, optional hardware is done using Device Tree overlays + (see below). + +-GPIO numbering uses the hardware pin numbering scheme (aka BCM scheme) and ++GPIO numbering uses the hardware pin numbering scheme (aka BCM scheme) and + not the physical pin numbers. + + raspi-config + +From 19296ba75ae66a70d91b6e8e47d72caf6cf55da6 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 15 Aug 2017 16:48:46 +0100 +Subject: [PATCH 398/407] config: Enable CONFIG_BRCMDBG temporarily for + debugging + +--- + arch/arm/configs/bcm2709_defconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 32f70a26fef4f9b4132233dc07d85ed92452b393..75ac6d4bbbc034f2845438b211e9b206db92a583 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -524,6 +524,7 @@ CONFIG_B43=m + CONFIG_B43LEGACY=m + CONFIG_BRCMFMAC=m + CONFIG_BRCMFMAC_USB=y ++CONFIG_BRCMDBG=y + CONFIG_HOSTAP=m + CONFIG_P54_COMMON=m + CONFIG_P54_USB=m + +From 8cf09045231e868eb65af1a196191ea85b9e6508 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 14 Sep 2017 16:16:24 +0100 +Subject: [PATCH 399/407] config: Add CONFIG_GPIO_WATCHDOG=m + +Enable the gpio_wdt module, to support external watchdogs. + +See: https://github.com/raspberrypi/linux/issues/2199 + +Signed-off-by: Phil Elwell +--- + arch/arm/configs/bcm2709_defconfig | 1 + + arch/arm/configs/bcmrpi_defconfig | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 75ac6d4bbbc034f2845438b211e9b206db92a583..49fc19d58ee82e503da34c9acf62c6ebcb5696e8 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -667,6 +667,7 @@ CONFIG_SENSORS_TMP102=m + CONFIG_THERMAL=y + CONFIG_THERMAL_BCM2835=y + CONFIG_WATCHDOG=y ++CONFIG_GPIO_WATCHDOG=m + CONFIG_BCM2835_WDT=y + CONFIG_UCB1400_CORE=m + CONFIG_MFD_STMPE=y +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 43b258bf0f951982e32005e8235110cf5eed48cf..bc848ec4917322e116e32cc5c1fc5af9afa8d4a3 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -660,6 +660,7 @@ CONFIG_SENSORS_TMP102=m + CONFIG_THERMAL=y + CONFIG_THERMAL_BCM2835=y + CONFIG_WATCHDOG=y ++CONFIG_GPIO_WATCHDOG=m + CONFIG_BCM2835_WDT=y + CONFIG_UCB1400_CORE=m + CONFIG_MFD_STMPE=y + +From b1615894b280f41c7ef2bbbe9355200ad81b4621 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 17 Oct 2017 17:17:20 +0100 +Subject: [PATCH 400/407] config: Add CONFIG_USB_LAN78XX=m + +Signed-off-by: Phil Elwell +--- + arch/arm/configs/bcm2709_defconfig | 1 + + arch/arm/configs/bcmrpi_defconfig | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 49fc19d58ee82e503da34c9acf62c6ebcb5696e8..889922c425ea6aa9708b1a1ef6ec9a74e9ced475 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -481,6 +481,7 @@ CONFIG_USB_KAWETH=m + CONFIG_USB_PEGASUS=m + CONFIG_USB_RTL8150=m + CONFIG_USB_RTL8152=m ++CONFIG_USB_LAN78XX=m + CONFIG_USB_USBNET=y + CONFIG_USB_NET_AX8817X=m + CONFIG_USB_NET_AX88179_178A=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index bc848ec4917322e116e32cc5c1fc5af9afa8d4a3..e44c3a11d80e66852e24326b081cdb62019042a5 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -477,6 +477,7 @@ CONFIG_USB_KAWETH=m + CONFIG_USB_PEGASUS=m + CONFIG_USB_RTL8150=m + CONFIG_USB_RTL8152=m ++CONFIG_USB_LAN78XX=m + CONFIG_USB_USBNET=y + CONFIG_USB_NET_AX8817X=m + CONFIG_USB_NET_AX88179_178A=m + +From e0165d0b6057f20af5f909c03d1df0cf314abae9 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 27 Oct 2017 21:34:12 +0100 +Subject: [PATCH 401/407] config: Add CONFIG_W1_SLAVE_DS2438=m + +See: https://github.com/raspberrypi/linux/issues/2246 +--- + arch/arm/configs/bcm2709_defconfig | 1 + + arch/arm/configs/bcmrpi_defconfig | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig +index 889922c425ea6aa9708b1a1ef6ec9a74e9ced475..10be4184f8bfd29a66dba59fe8bfb438ef04f7c4 100644 +--- a/arch/arm/configs/bcm2709_defconfig ++++ b/arch/arm/configs/bcm2709_defconfig +@@ -649,6 +649,7 @@ CONFIG_W1_SLAVE_DS2406=m + CONFIG_W1_SLAVE_DS2423=m + CONFIG_W1_SLAVE_DS2431=m + CONFIG_W1_SLAVE_DS2433=m ++CONFIG_W1_SLAVE_DS2438=m + CONFIG_W1_SLAVE_DS2760=m + CONFIG_W1_SLAVE_DS2780=m + CONFIG_W1_SLAVE_DS2781=m +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index e44c3a11d80e66852e24326b081cdb62019042a5..7b19098a3af9bb548a8a40f3a9d15533f92433e6 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -642,6 +642,7 @@ CONFIG_W1_SLAVE_DS2406=m + CONFIG_W1_SLAVE_DS2423=m + CONFIG_W1_SLAVE_DS2431=m + CONFIG_W1_SLAVE_DS2433=m ++CONFIG_W1_SLAVE_DS2438=m + CONFIG_W1_SLAVE_DS2760=m + CONFIG_W1_SLAVE_DS2780=m + CONFIG_W1_SLAVE_DS2781=m + +From 9020ece88eb585b9a2e6c3d00f55dc4dfda74162 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 16 Aug 2017 22:01:33 +0100 +Subject: [PATCH 402/407] config: Enable CONFIG_BRCMDBG temporarily for + debugging on pi0 + +--- + arch/arm/configs/bcmrpi_defconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig +index 7b19098a3af9bb548a8a40f3a9d15533f92433e6..76842f6fd2c5ed729b19bcc955385e4f3d3c5408 100644 +--- a/arch/arm/configs/bcmrpi_defconfig ++++ b/arch/arm/configs/bcmrpi_defconfig +@@ -521,6 +521,7 @@ CONFIG_B43=m + CONFIG_B43LEGACY=m + CONFIG_BRCMFMAC=m + CONFIG_BRCMFMAC_USB=y ++CONFIG_BRCMDBG=y + CONFIG_HOSTAP=m + CONFIG_P54_COMMON=m + CONFIG_P54_USB=m + +From e35a128c16cabb8923fb7f19f03b3d603aa871bf Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 18 Sep 2017 10:07:54 +0100 +Subject: [PATCH 403/407] Revert "config: Enable CONFIG_MEMCG, but leave it + disabled (due to memory cost). Enable with cgroup_enable=memory." + +This reverts commit 7dbc189967bef8e7f431c982557d0e73eb13f161. +--- + kernel/cgroup.c | 24 +----------------------- + 1 file changed, 1 insertion(+), 23 deletions(-) + +diff --git a/kernel/cgroup.c b/kernel/cgroup.c +index 2650df194b5d0bb39bb92c295d93f691b00faffb..2c785f9570243879d79b277d27393485824b5056 100644 +--- a/kernel/cgroup.c ++++ b/kernel/cgroup.c +@@ -5637,7 +5637,7 @@ int __init cgroup_init_early(void) + return 0; + } + +-static u16 cgroup_disable_mask __initdata = 1<<0; ++static u16 cgroup_disable_mask __initdata; + + /** + * cgroup_init - cgroup initialization +@@ -6178,28 +6178,6 @@ static int __init cgroup_no_v1(char *str) + } + __setup("cgroup_no_v1=", cgroup_no_v1); + +-static int __init cgroup_enable(char *str) +-{ +- struct cgroup_subsys *ss; +- char *token; +- int i; +- +- while ((token = strsep(&str, ",")) != NULL) { +- if (!*token) +- continue; +- +- for_each_subsys(ss, i) { +- if (strcmp(token, ss->name) && +- strcmp(token, ss->legacy_name)) +- continue; +- +- cgroup_disable_mask &= ~(1 << i); +- } +- } +- return 1; +-} +-__setup("cgroup_enable=", cgroup_enable); +- + /** + * css_tryget_online_from_dir - get corresponding css from a cgroup dentry + * @dentry: directory dentry of interest + +From 1706b6f999758903976da41342038c53a5ff1881 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 18 Sep 2017 12:01:46 +0100 +Subject: [PATCH 404/407] cgroup: Add kernel param to enable memory group + +cgroup support is useful, but enabling the "memory" cgroup has a 32-byte +overhead per page. Arrange that "memory" cgroup is disabled by default +unless the "cgroup_memory" parameter is set to a true value. + +See: https://github.com/raspberrypi/issues/1950 + +Signed-off-by: Phil Elwell +--- + kernel/cgroup.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/kernel/cgroup.c b/kernel/cgroup.c +index 2c785f9570243879d79b277d27393485824b5056..c3f5abf0fd7a47af325f97fa5342e799745fbeae 100644 +--- a/kernel/cgroup.c ++++ b/kernel/cgroup.c +@@ -5638,6 +5638,8 @@ int __init cgroup_init_early(void) + } + + static u16 cgroup_disable_mask __initdata; ++static bool cgroup_enable_memory; ++static int __init cgroup_disable(char *str); + + /** + * cgroup_init - cgroup initialization +@@ -5676,6 +5678,9 @@ int __init cgroup_init(void) + + mutex_unlock(&cgroup_mutex); + ++ if (!cgroup_enable_memory) ++ cgroup_disable("memory"); ++ + for_each_subsys(ss, ssid) { + if (ss->early_init) { + struct cgroup_subsys_state *css = +@@ -6151,6 +6156,13 @@ static int __init cgroup_disable(char *str) + } + __setup("cgroup_disable=", cgroup_disable); + ++static int __init cgroup_memory(char *str) ++{ ++ kstrtobool(str, &cgroup_enable_memory); ++ return 1; ++} ++__setup("cgroup_memory=", cgroup_memory); ++ + static int __init cgroup_no_v1(char *str) + { + struct cgroup_subsys *ss; + +From f2fcbde5ba3e5b5596500af548fc19d72bf28366 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 25 Oct 2017 09:20:56 +0100 +Subject: [PATCH 405/407] scripts: Update mkknlimg, just in case + +With the removal of the vc_cma driver, mkknlimg lost an indication that +the user had built a downstream kernel. Update the script, adding a few +more key strings, in case it is still being used. + +Note that mkknlimg is now deprecated, except to tag kernels as upstream +(283x), and thus requiring upstream DTBs. + +See: https://github.com/raspberrypi/linux/issues/2239 + +Signed-off-by: Phil Elwell +--- + scripts/mkknlimg | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/scripts/mkknlimg b/scripts/mkknlimg +index 60206de7fa9a49bd027c635306674a29a568652f..d72e15224232d5164374e93be48949bf596266ef 100755 +--- a/scripts/mkknlimg ++++ b/scripts/mkknlimg +@@ -68,17 +68,15 @@ if (! -r $kernel_file) + + my $wanted_strings = + { +- 'bcm2708_fb' => FLAG_PI, + 'brcm,bcm2835-mmc' => FLAG_PI, + 'brcm,bcm2835-sdhost' => FLAG_PI, +- 'brcm,bcm2708-pinctrl' => FLAG_PI | FLAG_DTOK, + 'brcm,bcm2835-gpio' => FLAG_PI | FLAG_DTOK, +- 'brcm,bcm2708' => FLAG_PI | FLAG_DTOK | FLAG_270X, +- 'brcm,bcm2709' => FLAG_PI | FLAG_DTOK | FLAG_270X, ++ 'brcm,bcm2708-fb' => FLAG_PI | FLAG_DTOK | FLAG_270X, ++ 'brcm,bcm2708-usb' => FLAG_PI | FLAG_DTOK | FLAG_270X, + 'brcm,bcm2835' => FLAG_PI | FLAG_DTOK | FLAG_283X, + 'brcm,bcm2836' => FLAG_PI | FLAG_DTOK | FLAG_283X, ++ 'brcm,bcm2837' => FLAG_PI | FLAG_DTOK | FLAG_283X, + 'of_cfs_init' => FLAG_DTOK | FLAG_DDTK, +- 'vc_cma_init' => FLAG_PI | FLAG_270X, + }; + + my $res = try_extract($kernel_file, $tmpfile1); + +From 537e940ca5771b6ef4b9be03e92a1a3b6a3e050f Mon Sep 17 00:00:00 2001 +From: Allo +Date: Mon, 16 Oct 2017 22:22:24 +0530 +Subject: [PATCH 406/407] Bug fix: initial max volume level & default mode + value. (#2224) + +Bug fix: initial max volume level & default mode value. + +Signed-off-by: allocom +--- + sound/soc/bcm/allo-piano-dac-plus.c | 33 ++++++++++++++++++++------------- + 1 file changed, 20 insertions(+), 13 deletions(-) + +diff --git a/sound/soc/bcm/allo-piano-dac-plus.c b/sound/soc/bcm/allo-piano-dac-plus.c +index 730f57cb6730bb825b6a0aab1eadbb27ac07795d..1800f5e4d414e2d83a9487a89a2800a3e1ec01b1 100644 +--- a/sound/soc/bcm/allo-piano-dac-plus.c ++++ b/sound/soc/bcm/allo-piano-dac-plus.c +@@ -118,7 +118,7 @@ static int __snd_allo_piano_dsp_program(struct snd_soc_pcm_runtime *rtd, + rate = 192000; + + if (lowpass > 14) +- glb_ptr->set_lowpass = lowpass = 3; ++ glb_ptr->set_lowpass = lowpass = 0; + + if (mode > 3) + glb_ptr->set_mode = mode = 0; +@@ -262,6 +262,7 @@ static int snd_allo_piano_dual_mode_put(struct snd_kcontrol *kcontrol, + glb_ptr->set_mode = 0; + } else { + glb_ptr->dual_mode = 0; ++ return 0; + } + } + +@@ -441,6 +442,14 @@ static int pcm512x_set_reg_sub(struct snd_kcontrol *kcontrol, + return ret; + } + ++ if (digital_gain_0db_limit) { ++ ret = snd_soc_limit_volume(card, "Subwoofer Playback Volume", ++ 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ++ ret); ++ } ++ + ret = snd_soc_write(rtd->codec_dais[1]->codec, + PCM512x_DIGITAL_VOLUME_3, (~right_val)); + if (ret < 0) +@@ -541,6 +550,14 @@ static int pcm512x_set_reg_master(struct snd_kcontrol *kcontrol, + + rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name); + ++ if (digital_gain_0db_limit) { ++ ret = snd_soc_limit_volume(card, "Master Playback Volume", ++ 207); ++ if (ret < 0) ++ dev_warn(card->dev, "Failed to set volume limit: %d\n", ++ ret); ++ } ++ + if (glb_ptr->dual_mode != 1) { + ret = snd_soc_write(rtd->codec_dais[1]->codec, + PCM512x_DIGITAL_VOLUME_2, (~left_val)); +@@ -693,6 +710,8 @@ static int snd_allo_piano_dac_init(struct snd_soc_pcm_runtime *rtd) + + memset(glb_ptr, 0x00, sizeof(glb_ptr)); + card->drvdata = glb_ptr; ++ glb_ptr->dual_mode = 2; ++ glb_ptr->set_mode = 0; + + mutex_init(&glb_ptr->lock); + +@@ -815,18 +834,6 @@ static int snd_allo_piano_dac_hw_params( + } + } + +- if (digital_gain_0db_limit) { +- ret = snd_soc_limit_volume(card, +- "Subwoofer Playback Volume", 207); +- if (ret < 0) +- dev_warn(card->dev, "Failed to set volume limit: %d\n", +- ret); +- ret = snd_soc_limit_volume(card, "Master Playback Volume", 207); +- if (ret < 0) +- dev_warn(card->dev, "Failed to set volume limit: %d\n", +- ret); +- } +- + ret = snd_allo_piano_dsp_program(rtd, glb_ptr->set_mode, rate, + glb_ptr->set_lowpass); + if (ret < 0) + +From fc904163584c253f5ad237dc6918b0fdf91dd7c2 Mon Sep 17 00:00:00 2001 +From: Daniel Matuschek +Date: Tue, 17 Oct 2017 10:30:28 +0200 +Subject: [PATCH 407/407] Fixed a bug when using 352.8kHz sample rate + +Signed-off-by: Daniel Matuschek +--- + sound/soc/bcm/hifiberry_dacplus.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sound/soc/bcm/hifiberry_dacplus.c b/sound/soc/bcm/hifiberry_dacplus.c +index b7b401cbe2b0d510d8b12d2dda6d5ff1fff42eb0..16697dd6c6db6856022731a07a9a1653dd94b9f5 100644 +--- a/sound/soc/bcm/hifiberry_dacplus.c ++++ b/sound/soc/bcm/hifiberry_dacplus.c +@@ -117,6 +117,7 @@ static int snd_rpi_hifiberry_dacplus_clk_for_rate(int sample_rate) + case 44100: + case 88200: + case 176400: ++ case 352800: + type = HIFIBERRY_DACPRO_CLK44EN; + break; + default: