diff --git a/packages/graphics/bcm2835-driver/package.mk b/packages/graphics/bcm2835-driver/package.mk index 9f7f70e016..1421bfe7ef 100644 --- a/packages/graphics/bcm2835-driver/package.mk +++ b/packages/graphics/bcm2835-driver/package.mk @@ -17,8 +17,8 @@ ################################################################################ PKG_NAME="bcm2835-driver" -PKG_VERSION="7f7df25" -PKG_SHA256="eb5a677cd0e9c9160ae78bce4bf46cb66d30a20185e0fc1dd31afa5782967afa" +PKG_VERSION="478d637" +PKG_SHA256="35954bcd8568b057195c72bbc645d3f74a7201c83486359ce6a29482018706ce" PKG_ARCH="any" PKG_LICENSE="nonfree" PKG_SITE="http://www.broadcom.com" diff --git a/packages/linux/package.mk b/packages/linux/package.mk index f69e30c271..bcfa438aa4 100644 --- a/packages/linux/package.mk +++ b/packages/linux/package.mk @@ -63,8 +63,8 @@ case "$LINUX" in PKG_DEPENDS_TARGET="$PKG_DEPENDS_TARGET imx6-status-led imx6-soc-fan irqbalanced" ;; *) - PKG_VERSION="4.13" - PKG_SHA256="2db3d6066c3ad93eb25b973a3d2951e022a7e975ee2fa7cbe5bddf84d9a49a2c" + PKG_VERSION="4.13.6" + PKG_SHA256="47d419ceae1d353dad565b858301ac9670c747deb37936c8a935915b3bdd6050" PKG_URL="https://www.kernel.org/pub/linux/kernel/v4.x/$PKG_NAME-$PKG_VERSION.tar.xz" PKG_PATCH_DIRS="default" ;; diff --git a/packages/linux/patches/default/linux-999-i915-implement-passthrough-colors.patch b/packages/linux/patches/default/linux-999-i915-implement-passthrough-colors.patch index 96c11d30bb..0448469b41 100644 --- a/packages/linux/patches/default/linux-999-i915-implement-passthrough-colors.patch +++ b/packages/linux/patches/default/linux-999-i915-implement-passthrough-colors.patch @@ -1,8 +1,24 @@ +From 81f46f38dc5b67b223774310951ad9ce444c120b Mon Sep 17 00:00:00 2001 +From: fritsch +Date: Sat, 16 Sep 2017 12:42:34 +0200 +Subject: [PATCH] i915: Implement uncompressed Video Range output + +Signed-off-by: fritsch +--- + drivers/gpu/drm/i915/i915_drv.h | 1 + + drivers/gpu/drm/i915/intel_color.c | 11 +++++++---- + drivers/gpu/drm/i915/intel_display.c | 6 ++++-- + drivers/gpu/drm/i915/intel_dp.c | 3 ++- + drivers/gpu/drm/i915/intel_drv.h | 11 +++++++++-- + drivers/gpu/drm/i915/intel_hdmi.c | 16 +++++++++++++--- + drivers/gpu/drm/i915/intel_modes.c | 1 + + 7 files changed, 37 insertions(+), 12 deletions(-) + diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h -index e1f7c97..d99e406 100644 +index 5aecbf795b55..70bd525317c8 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h -@@ -4044,6 +4044,7 @@ __raw_write(64, q) +@@ -4230,6 +4230,7 @@ __raw_write(64, q) #define INTEL_BROADCAST_RGB_AUTO 0 #define INTEL_BROADCAST_RGB_FULL 1 #define INTEL_BROADCAST_RGB_LIMITED 2 @@ -10,48 +26,149 @@ index e1f7c97..d99e406 100644 static inline i915_reg_t i915_vgacntrl_reg(struct drm_i915_private *dev_priv) { +diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c +index ff9ecd211abb..a2dccc64a5a0 100644 +--- a/drivers/gpu/drm/i915/intel_color.c ++++ b/drivers/gpu/drm/i915/intel_color.c +@@ -149,7 +149,7 @@ static void i9xx_load_csc_matrix(struct drm_crtc_state *crtc_state) + (struct drm_color_ctm *)crtc_state->ctm->data; + uint64_t input[9] = { 0, }; + +- if (intel_crtc_state->limited_color_range) { ++ if (intel_crtc_state->limited_color_range && intel_crtc_state->compress_range) { + ctm_mult_by_limited(input, ctm->matrix); + } else { + for (i = 0; i < ARRAY_SIZE(input); i++) +@@ -201,7 +201,8 @@ static void i9xx_load_csc_matrix(struct drm_crtc_state *crtc_state) + * into consideration. + */ + for (i = 0; i < 3; i++) { +- if (intel_crtc_state->limited_color_range) ++ if (intel_crtc_state->limited_color_range && ++ intel_crtc_state->compress_range) + coeffs[i * 3 + i] = + I9XX_CSC_COEFF_LIMITED_RANGE; + else +@@ -225,7 +226,8 @@ static void i9xx_load_csc_matrix(struct drm_crtc_state *crtc_state) + if (INTEL_GEN(dev_priv) > 6) { + uint16_t postoff = 0; + +- if (intel_crtc_state->limited_color_range) ++ if (intel_crtc_state->limited_color_range && ++ intel_crtc_state->compress_range) + postoff = (16 * (1 << 12) / 255) & 0x1fff; + + I915_WRITE(PIPE_CSC_POSTOFF_HI(pipe), postoff); +@@ -236,7 +238,8 @@ static void i9xx_load_csc_matrix(struct drm_crtc_state *crtc_state) + } else { + uint32_t mode = CSC_MODE_YUV_TO_RGB; + +- if (intel_crtc_state->limited_color_range) ++ if (intel_crtc_state->limited_color_range && ++ intel_crtc_state->compress_range) + mode |= CSC_BLACK_SCREEN_OFFSET; + + I915_WRITE(PIPE_CSC_MODE(pipe), mode); +diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c +index 8599e425abb1..4de43eb12f0e 100644 +--- a/drivers/gpu/drm/i915/intel_display.c ++++ b/drivers/gpu/drm/i915/intel_display.c +@@ -7247,7 +7247,8 @@ static void i9xx_set_pipeconf(struct intel_crtc *intel_crtc) + pipeconf |= PIPECONF_PROGRESSIVE; + + if ((IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) && +- intel_crtc->config->limited_color_range) ++ intel_crtc->config->limited_color_range && ++ intel_crtc->config->compress_range) + pipeconf |= PIPECONF_COLOR_RANGE_SELECT; + + I915_WRITE(PIPECONF(intel_crtc->pipe), pipeconf); +@@ -8177,7 +8178,8 @@ static void ironlake_set_pipeconf(struct drm_crtc *crtc) + else + val |= PIPECONF_PROGRESSIVE; + +- if (intel_crtc->config->limited_color_range) ++ if (intel_crtc->config->limited_color_range && ++ intel_crtc->config->compress_range) + val |= PIPECONF_COLOR_RANGE_SELECT; + + I915_WRITE(PIPECONF(pipe), val); +diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c +index 887953c0f495..437dd0465be3 100644 +--- a/drivers/gpu/drm/i915/intel_dp.c ++++ b/drivers/gpu/drm/i915/intel_dp.c +@@ -1926,7 +1926,8 @@ static void intel_dp_prepare(struct intel_encoder *encoder, + trans_dp &= ~TRANS_DP_ENH_FRAMING; + I915_WRITE(TRANS_DP_CTL(crtc->pipe), trans_dp); + } else { +- if (IS_G4X(dev_priv) && pipe_config->limited_color_range) ++ if (IS_G4X(dev_priv) && pipe_config->limited_color_range && ++ pipe_config->compress_range) + intel_dp->DP |= DP_COLOR_RANGE_16_235; + + if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h -index d93efb4..0de8a5e 100644 +index 307807672896..35602a1ed471 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h -@@ -652,6 +652,13 @@ struct intel_crtc_state { +@@ -649,11 +649,18 @@ struct intel_crtc_state { + enum transcoder cpu_transcoder; + + /* +- * Use reduced/limited/broadcast rbg range, compressing from the full +- * range fed into the crtcs. ++ * Use reduced/limited/broadcast rbg range. */ bool limited_color_range; + /* + * -+ * Use reduced/limited/broadcast rgb range without compressing. ++ * Compress the input range when doing limited/broadcast rgb range ++ * output. This is the default for Limited 16:235 Output mode. + * + */ -+ bool video_color_range; ++ bool compress_range; + /* Bitmask of encoder types (enum intel_output_type) * driven by the pipe. */ diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c -index ec0779a..42fd4e5 100644 +index e6f8f30ce7bd..4963903f177e 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c -@@ -470,7 +470,7 @@ static void intel_hdmi_set_avi_infoframe(struct drm_encoder *encoder, +@@ -880,7 +880,8 @@ static void intel_hdmi_prepare(struct intel_encoder *encoder, + intel_dp_dual_mode_set_tmds_output(intel_hdmi, true); + + hdmi_val = SDVO_ENCODING_HDMI; +- if (!HAS_PCH_SPLIT(dev_priv) && crtc_state->limited_color_range) ++ if (!HAS_PCH_SPLIT(dev_priv) && crtc_state->limited_color_range ++ && crtc_state->compress_range) + hdmi_val |= HDMI_COLOR_RANGE_16_235; + if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) + hdmi_val |= SDVO_VSYNC_ACTIVE_HIGH; +@@ -1419,9 +1420,18 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, + pipe_config->has_hdmi_sink && + drm_default_rgb_quant_range(adjusted_mode) == + HDMI_QUANTIZATION_RANGE_LIMITED; ++ pipe_config->compress_range = pipe_config->limited_color_range; ++ } else if (intel_conn_state->broadcast_rgb ++ == INTEL_BROADCAST_RGB_LIMITED) { ++ pipe_config->limited_color_range = true; ++ pipe_config->compress_range = true; ++ } else if (intel_conn_state->broadcast_rgb ++ == INTEL_BROADCAST_RGB_FULL) { ++ pipe_config->limited_color_range = false; ++ pipe_config->compress_range = false; + } else { +- pipe_config->limited_color_range = +- intel_conn_state->broadcast_rgb == INTEL_BROADCAST_RGB_LIMITED; ++ pipe_config->limited_color_range = true; ++ pipe_config->compress_range = false; } - drm_hdmi_avi_infoframe_quant_range(&frame.avi, adjusted_mode, -- crtc_state->limited_color_range ? -+ (crtc_state->limited_color_range || crtc_state->video_color_range) ? - HDMI_QUANTIZATION_RANGE_LIMITED : - HDMI_QUANTIZATION_RANGE_FULL, - intel_hdmi->rgb_quant_range_selectable); -@@ -1370,6 +1370,8 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder, - intel_conn_state->broadcast_rgb == INTEL_BROADCAST_RGB_LIMITED; - } - -+ pipe_config->video_color_range = (intel_conn_state->broadcast_rgb == INTEL_BROADCAST_RGB_VIDEO); -+ if (adjusted_mode->flags & DRM_MODE_FLAG_DBLCLK) { - pipe_config->pixel_multiplier = 2; - clock_8bpc *= 2; diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c -index 951e834..d817558 100644 +index 951e834dd274..d817558410eb 100644 --- a/drivers/gpu/drm/i915/intel_modes.c +++ b/drivers/gpu/drm/i915/intel_modes.c @@ -102,6 +102,7 @@ static const struct drm_prop_enum_list broadcast_rgb_names[] = { @@ -62,3 +179,7 @@ index 951e834..d817558 100644 }; void +-- +2.11.0 + + diff --git a/packages/tools/bcm2835-bootloader/package.mk b/packages/tools/bcm2835-bootloader/package.mk index 9997cd4a07..eb28a107f4 100644 --- a/packages/tools/bcm2835-bootloader/package.mk +++ b/packages/tools/bcm2835-bootloader/package.mk @@ -17,8 +17,8 @@ ################################################################################ PKG_NAME="bcm2835-bootloader" -PKG_VERSION="7f7df25" -PKG_SHA256="1a542dddf065d1bf69076b505bcd73a32e5167a29326e9b22d74cec87f304fae" +PKG_VERSION="478d637" +PKG_SHA256="d4bc570248d053efa23f8007a154116fdd9053841513e5a59f2cfb1586b42fbb" PKG_ARCH="arm" PKG_LICENSE="nonfree" PKG_SITE="http://www.broadcom.com" diff --git a/projects/RPi/patches/linux/linux-01-RPi_support.patch b/projects/RPi/patches/linux/linux-01-RPi_support.patch index 34e42117fb..07d21a7a4f 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 4d31e91165e50dab3ce5b4b78bc589d67bd70e0b Mon Sep 17 00:00:00 2001 +From a4db2799cecece0dcb712a6d7589bcad79b37f3b Mon Sep 17 00:00:00 2001 From: Steve Glendinning Date: Thu, 19 Feb 2015 18:47:12 +0000 -Subject: [PATCH 001/173] smsx95xx: fix crimes against truesize +Subject: [PATCH 001/140] 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 340c13484e5cc7dd5001577b7522d5a4318bd5b6..7d3d98f0405ad948f9ab3e035a70e15c usbnet_skb_return(dev, ax_skb); } -From 54fc9336b4a858bf7833f4549f96b16e187192b2 Mon Sep 17 00:00:00 2001 +From 7074ad3ab7788c09d9b9750b6e758c45f6ea6dd7 Mon Sep 17 00:00:00 2001 From: Sam Nazarko Date: Fri, 1 Apr 2016 17:27:21 +0100 -Subject: [PATCH 002/173] smsc95xx: Experimental: Enable turbo_mode and +Subject: [PATCH 002/140] smsc95xx: Experimental: Enable turbo_mode and packetsize=2560 by default See: http://forum.kodi.tv/showthread.php?tid=285288 @@ -94,10 +94,10 @@ index 7d3d98f0405ad948f9ab3e035a70e15c667e4fa1..8d34e517db08d895e6135f785c42bf63 netif_dbg(dev, ifup, dev->net, "rx_urb_size=%ld\n", -From 9c3373c84a4a3740f9e502e256b6cf6b75499e53 Mon Sep 17 00:00:00 2001 +From 8882b456563f00096ba923d407149f38dd6428f8 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 26 Mar 2013 17:26:38 +0000 -Subject: [PATCH 003/173] Allow mac address to be set in smsc95xx +Subject: [PATCH 003/140] Allow mac address to be set in smsc95xx Signed-off-by: popcornmix --- @@ -193,10 +193,10 @@ index 8d34e517db08d895e6135f785c42bf639671815c..5df7e105c41532c3185e46ee54f43a37 eth_hw_addr_random(dev->net); netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n"); -From 4733376458500aefc53f7bb02e16c6fd57439295 Mon Sep 17 00:00:00 2001 +From 15b39ad8fd596ce3088bfcc755c3db60f0f5975b Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 13 Mar 2015 12:43:36 +0000 -Subject: [PATCH 004/173] Protect __release_resource against resources without +Subject: [PATCH 004/140] Protect __release_resource against resources without parents Without this patch, removing a device tree overlay can crash here. @@ -224,10 +224,10 @@ index 9b5f04404152c296af3a96132f27cfc80ffa9af9..f8a9af6e6b915812be2ba2c1c2b40106 for (;;) { tmp = *p; -From 6ae5f9ee8ed27f0a0646a8949b27747a60df627e Mon Sep 17 00:00:00 2001 +From b0d1bf48ab3e8b6210c1caa3636ba97ca2ec9509 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 4 Dec 2015 17:41:50 +0000 -Subject: [PATCH 005/173] irq-bcm2836: Prevent spurious interrupts, and trap +Subject: [PATCH 005/140] irq-bcm2836: Prevent spurious interrupts, and trap them early The old arch-specific IRQ macros included a dsb to ensure the @@ -254,10 +254,10 @@ index e7463e3c08143acae3e8cc5682f918c6a0b07ebd..a8db33b50ad9ff83d284fa54fe4d3b65 #endif } else if (stat) { -From df9ca00f2536bd3c258fd212fbc50f0388ec0051 Mon Sep 17 00:00:00 2001 +From bcc31be258801d789d9ac084a83d80ffa85a46f9 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 9 Feb 2017 14:33:30 +0000 -Subject: [PATCH 006/173] irq-bcm2836: Avoid "Invalid trigger warning" +Subject: [PATCH 006/140] irq-bcm2836: Avoid "Invalid trigger warning" Initialise the level for each IRQ to avoid a warning from the arm arch timer code. @@ -281,10 +281,10 @@ index a8db33b50ad9ff83d284fa54fe4d3b65f859df0f..c4e151451cf8c8ebde5225515eac2786 static void -From 738c1a7eac3f687fc2e828be2ab02a173367afe3 Mon Sep 17 00:00:00 2001 +From 95f389600967c928a40c822b87ef8bb92481a286 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/173] irqchip: bcm2835: Add FIQ support +Subject: [PATCH 007/140] irqchip: bcm2835: Add FIQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -413,10 +413,10 @@ index 44d7c38dde479d771f3552e914bf8c1c1f5019f7..42ff5e6a8e0d532f5b60a1e7af7cc4d9 } -From 2088067b398e00f0fb16984d0723193853ebe910 Mon Sep 17 00:00:00 2001 +From 4e09a1c79699100f0cc1a117544889876b4f1e6e 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/173] irqchip: irq-bcm2835: Add 2836 FIQ support +Subject: [PATCH 008/140] irqchip: irq-bcm2835: Add 2836 FIQ support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -515,10 +515,49 @@ index 42ff5e6a8e0d532f5b60a1e7af7cc4d941bd5008..eccf6ed025299cb480884f5bcbe77abf for (b = 0; b < NR_BANKS; b++) { for (i = 0; i < bank_irqs[b]; i++) { -From 5f9a37381bb18029137e2d8e6c269a15586f82a8 Mon Sep 17 00:00:00 2001 +From 6f38025644e36974fbde019fea47854769f8edbe Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Mon, 8 May 2017 16:43:40 +0100 +Subject: [PATCH 009/140] 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 +be started. The wfe instruction causes a core to wait until an event +or interrupt arrives before continuing to the next instruction. +The sev instruction sends a wakeup event to the other cores, so call +it from bcm2836_smp_boot_secondary, the function that wakes up the +waiting cores during booting. + +It is harmless to use this patch without the corresponding change +adding wfe to the ARMv7/ARMv8-32 stubs, but if the stubs are updated +and this patch is not applied then the other cores will sleep forever. + +See: https://github.com/raspberrypi/linux/issues/1989 + +Signed-off-by: Phil Elwell +--- + drivers/irqchip/irq-bcm2836.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c +index c4e151451cf8c8ebde5225515eac2786d6f61d46..bee4d2d2ebacc3233423bb9d825e076b9f52fccd 100644 +--- a/drivers/irqchip/irq-bcm2836.c ++++ b/drivers/irqchip/irq-bcm2836.c +@@ -227,6 +227,9 @@ static int __init bcm2836_smp_boot_secondary(unsigned int cpu, + writel(secondary_startup_phys, + intc.base + LOCAL_MAILBOX3_SET0 + 16 * cpu); + ++ dsb(sy); /* Ensure write has completed before waking the other CPUs */ ++ sev(); ++ + return 0; + } + + +From 383c10f831d02305aaba58197243f2b0db5f740f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 14 Jul 2015 10:26:09 +0100 -Subject: [PATCH 009/173] spidev: Add "spidev" compatible string to silence +Subject: [PATCH 010/140] spidev: Add "spidev" compatible string to silence warning See: https://github.com/raspberrypi/linux/issues/1054 @@ -539,10 +578,10 @@ index cda10719d1d1b21b32866d2b79363faa461ab8e1..4f3779d3aa0960640506725bde918075 }; MODULE_DEVICE_TABLE(of, spidev_dt_ids); -From da0f0b0a74f2827634a1914ac8fa0460a611d722 Mon Sep 17 00:00:00 2001 +From a3cdf4d43fcb42b970d30c589269cfb403d8f83e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 3 Jan 2017 18:25:01 +0000 -Subject: [PATCH 010/173] Revert "pinctrl: bcm2835: switch to GPIOLIB_IRQCHIP" +Subject: [PATCH 011/140] Revert "pinctrl: bcm2835: switch to GPIOLIB_IRQCHIP" This reverts commit 85ae9e512f437cd09bf61564bdba29ab88bab3e3. --- @@ -841,10 +880,10 @@ index 230883168e99a1a3fecc7916ef0a7e0de7e8b3f1..ff3789a11b3c36b922b9d08035abb638 if (IS_ERR(pc->pctl_dev)) { gpiochip_remove(&pc->gpio_chip); -From 0c433b8e5412030ca229b85830abdda47c841eed Mon Sep 17 00:00:00 2001 +From 05643d82a5ad915c6e53b0e04a7c45b2c5e74b17 Mon Sep 17 00:00:00 2001 From: notro Date: Thu, 10 Jul 2014 13:59:47 +0200 -Subject: [PATCH 011/173] pinctrl-bcm2835: Set base to 0 give expected gpio +Subject: [PATCH 012/140] pinctrl-bcm2835: Set base to 0 give expected gpio numbering Signed-off-by: Noralf Tronnes @@ -866,10 +905,10 @@ index ff3789a11b3c36b922b9d08035abb638187c2f5a..d2b537572095c86576f78536f737c102 .can_sleep = false, }; -From d9319a075ad9a562fcd70597768b0f52d5c88a4e Mon Sep 17 00:00:00 2001 +From c5d7f73e2afb1c56a96540642db0e30964ffc76f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 26 Feb 2015 09:58:22 +0000 -Subject: [PATCH 012/173] pinctrl-bcm2835: Only request the interrupts listed +Subject: [PATCH 013/140] pinctrl-bcm2835: Only request the interrupts listed in the DTB Although the GPIO controller can generate three interrupts (four counting @@ -896,10 +935,10 @@ index d2b537572095c86576f78536f737c102487f99f4..a9d480df32562defbf8be0faf0a39bfe pc->irq_data[i].irqgroup = i; -From 81ba2330c131e7da3bca1b59f01cd254d11d5fa4 Mon Sep 17 00:00:00 2001 +From fbe196baa84a1ef4a18df77dcb0a9fc9cf1d6589 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Jun 2015 14:10:44 +0100 -Subject: [PATCH 013/173] spi-bcm2835: Support pin groups other than 7-11 +Subject: [PATCH 014/140] 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 @@ -980,10 +1019,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 26b6abf66e4e353b6d308fcf6d50e36053b16db0 Mon Sep 17 00:00:00 2001 +From 158e33e4448ed3ef822312bbe2beeca6e773f648 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 1 Jul 2016 22:09:24 +0100 -Subject: [PATCH 014/173] spi-bcm2835: Disable forced software CS +Subject: [PATCH 015/140] 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 @@ -1017,10 +1056,10 @@ index 5dfe20ffc2866fa6789825016c585175a29705b6..8493474d286f7a1ac6454a22c61c8c2c return 0; } -From f9164bc59cb04046bd40a67c7779b0cfc6075d5f Mon Sep 17 00:00:00 2001 +From 34c2649fc5eab3bbfe2750fc9d499206bfe26b73 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 8 Nov 2016 21:35:38 +0000 -Subject: [PATCH 015/173] spi-bcm2835: Remove unused code +Subject: [PATCH 016/140] spi-bcm2835: Remove unused code --- drivers/spi/spi-bcm2835.c | 61 ----------------------------------------------- @@ -1108,10 +1147,10 @@ index 8493474d286f7a1ac6454a22c61c8c2cef9121bf..33d75ad38a7f77d085321ace9101900a } -From 6f25ff462e75767582fdace353a5408fe684ab04 Mon Sep 17 00:00:00 2001 +From 97e821d313541c4bff20e0ff30596bcafd1f7568 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 016/173] ARM: bcm2835: Set Serial number and Revision +Subject: [PATCH 017/140] ARM: bcm2835: Set Serial number and Revision MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1164,10 +1203,10 @@ index 0c1edfc98696da0e0bb7f4a18cdfbcdd27a9795d..8f152266ba9b470df2eaaed9ebcf158e static const char * const bcm2835_compat[] = { -From de38cbe1a0cb31cc4fe4e0768dd0be0b92183907 Mon Sep 17 00:00:00 2001 +From f568285d4cfb1ec5ce2e5cad2751d2c22fac3c14 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 017/173] dmaengine: bcm2835: Load driver early and support +Subject: [PATCH 018/140] dmaengine: bcm2835: Load driver early and support legacy API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -1270,10 +1309,10 @@ index 6204cc32d09c5096df8aec304c3c37b3bcb6be44..599c218dc8a73172dd4bd4a058fc8f95 MODULE_ALIAS("platform:bcm2835-dma"); MODULE_DESCRIPTION("BCM2835 DMA engine driver"); -From d7df3482e5e76edbf7f4d6847b8823cd1743535c Mon Sep 17 00:00:00 2001 +From fa9d4eef7edbd723af6fa91a0177f52bc84b3362 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 25 Jan 2016 17:25:12 +0000 -Subject: [PATCH 018/173] firmware: Updated mailbox header +Subject: [PATCH 019/140] firmware: Updated mailbox header --- include/soc/bcm2835/raspberrypi-firmware.h | 9 +++++++++ @@ -1334,10 +1373,10 @@ index cb979ad90401e299344dd5fae38d09c489d8bd58..30fb37fe175df604a738258a2a632bca RPI_FIRMWARE_VCHIQ_INIT = 0x00048010, -From 8b0d445303d35756ce6bcc859ab12a70d589c291 Mon Sep 17 00:00:00 2001 +From dea7ec9177df736cac782b7412c94e2fb699797f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 15 Jun 2016 16:48:41 +0100 -Subject: [PATCH 019/173] rtc: Add SPI alias for pcf2123 driver +Subject: [PATCH 020/140] rtc: Add SPI alias for pcf2123 driver Without this alias, Device Tree won't cause the driver to be loaded. @@ -1357,10 +1396,10 @@ index 8895f77726e8da5444afcd602dceff8f25a9b3fd..1833b8853ceb0e6147cceb93a00e558c MODULE_LICENSE("GPL"); +MODULE_ALIAS("spi:rtc-pcf2123"); -From d635eba91a9931609ed9295098d577eb01c3608e Mon Sep 17 00:00:00 2001 +From 27ea0bd00ac33fa11c6027dd71373fb281b6723e 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 020/173] watchdog: bcm2835: Support setting reboot partition +Subject: [PATCH 021/140] watchdog: bcm2835: Support setting reboot partition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -1462,10 +1501,10 @@ index b339e0e67b4c1275fd4992fea4f1e24c0575b783..26b7177573fac2af1cd4ab5488d2686f static int bcm2835_wdt_probe(struct platform_device *pdev) -From e011b348aadd95d8a1fe0169305a1e50ce1fc480 Mon Sep 17 00:00:00 2001 +From 1adc5a8abbbda1ec874d1099c6307bc992469beb Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 5 Apr 2016 19:40:12 +0100 -Subject: [PATCH 021/173] reboot: Use power off rather than busy spinning when +Subject: [PATCH 022/140] reboot: Use power off rather than busy spinning when halt is requested --- @@ -1488,10 +1527,10 @@ index 3b2aa9a9fe268d45335f781c4aa22cf573753a1b..0180d89a34af45c56243fe0f17fbe209 /* -From 4b568920b166692346db6adf3a8aa94a76b5a0ed Mon Sep 17 00:00:00 2001 +From 44d0094da00b84ea95a944810ebd125b8448cf67 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 9 Nov 2016 13:02:52 +0000 -Subject: [PATCH 022/173] bcm: Make RASPBERRYPI_POWER depend on PM +Subject: [PATCH 023/140] bcm: Make RASPBERRYPI_POWER depend on PM --- drivers/soc/bcm/Kconfig | 1 + @@ -1510,10 +1549,10 @@ index 49f1e2a75d614bc21db152327c7b425ae2504f8d..dccd2374ed00631abd441e3e9d78ee74 help This enables support for the RPi power domains which can be enabled -From bb1668bb395ef4cc0ece7b7ac18fbfa7b7c5b642 Mon Sep 17 00:00:00 2001 +From 26f58ea52ccb0a6705e9e2bcf98d0bbb8dbf5d3a Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Fri, 2 Sep 2016 16:45:27 +0100 -Subject: [PATCH 023/173] Register the clocks early during the boot process, so +Subject: [PATCH 024/140] 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. @@ -1558,10 +1597,10 @@ index 58ce6af8452db9ca8b4d3c380a06e448919f6a8d..11d89d106026f15719ea25047d6f357b MODULE_AUTHOR("Eric Anholt "); MODULE_DESCRIPTION("BCM2835 clock driver"); -From 198027c8f72b1c11e435eddf7c81e02dde1ec2aa Mon Sep 17 00:00:00 2001 +From bad622a01d58fbaf66102eb7492e68a123ee41d0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 6 Dec 2016 17:05:39 +0000 -Subject: [PATCH 024/173] bcm2835-rng: Avoid initialising if already enabled +Subject: [PATCH 025/140] bcm2835-rng: Avoid initialising if already enabled Avoids the 0x40000 cycles of warmup again if firmware has already used it --- @@ -1587,10 +1626,10 @@ index 574211a495491d9d6021dcaefe4274a63ed02055..e66c0fca8c6090e32f72796c0877a1cf err = hwrng_register(&bcm2835_rng_ops); if (err) { -From 1b4b16d21a4bcf96dc625ad9444c69c28eeef072 Mon Sep 17 00:00:00 2001 +From b72a5d031240e59db68168b7d5e75612b22121e8 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 24 Aug 2016 16:28:44 +0100 -Subject: [PATCH 025/173] kbuild: Ignore dtco targets when filtering symbols +Subject: [PATCH 026/140] kbuild: Ignore dtco targets when filtering symbols --- scripts/Kbuild.include | 2 +- @@ -1610,10 +1649,10 @@ index 9ffd3dda3889c56a7a72229bed21ff5c49d62856..00da6c9bacbf33334233e22ca5209ade esac | tr ";" "\n" | sed -rn 's/^.*=== __KSYM_(.*) ===.*$$/KSYM_\1/p' -From 1b013838bed35a7ba38be239e8590414ab5bfa08 Mon Sep 17 00:00:00 2001 +From 243fc413d23c221895ffdecac83fe575cc78aad2 Mon Sep 17 00:00:00 2001 From: Robert Tiemann Date: Mon, 20 Jul 2015 11:01:25 +0200 -Subject: [PATCH 026/173] BCM2835_DT: Fix I2S register map +Subject: [PATCH 027/140] BCM2835_DT: Fix I2S register map --- Documentation/devicetree/bindings/dma/brcm,bcm2835-dma.txt | 4 ++-- @@ -1651,10 +1690,10 @@ index 65783de0aedf3da79adc36fd077b7a89954ddb6b..a89fe4220fdc3f26f75ee66daf187554 dmas = <&dma 2>, <&dma 3>; -From 3541d2299cb53a29213bd9a653fa4c4c636a251c Mon Sep 17 00:00:00 2001 +From 03c7eb1f9221b496436a415d52d07a5b10ced50f Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Feb 2017 17:20:08 +0000 -Subject: [PATCH 027/173] clk-bcm2835: Mark used PLLs and dividers CRITICAL +Subject: [PATCH 028/140] 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 @@ -1682,10 +1721,10 @@ index 11d89d106026f15719ea25047d6f357b4bfcb2c5..fe8f5d65f2749cb3ddc878df61664826 divider->data = data; -From ef265510cf7bcb062ecf5026e9d916ef0ab58dd4 Mon Sep 17 00:00:00 2001 +From 297a78d9469ee56d17b38b45ecf2a3204d26bdaf Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 13 Feb 2017 17:20:08 +0000 -Subject: [PATCH 028/173] clk-bcm2835: Add claim-clocks property +Subject: [PATCH 029/140] 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, @@ -1787,10 +1826,10 @@ index fe8f5d65f2749cb3ddc878df616648267441e0ee..92b5e0f5145b32d3bfc3592fe381e8be sizeof(cprman_parent_names)); of_clk_parent_fill(dev->of_node, cprman->real_parent_names, -From b0cd805d9a43ad2112f2cb57ac6e417b3d7423b1 Mon Sep 17 00:00:00 2001 +From eb82e7c98eca02feee2b42d59d5020cd04251bcf Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 6 Mar 2017 09:06:18 +0000 -Subject: [PATCH 029/173] clk-bcm2835: Read max core clock from firmware +Subject: [PATCH 030/140] 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 @@ -1905,10 +1944,51 @@ index 92b5e0f5145b32d3bfc3592fe381e8be3cd90c72..336f8c9c44325d0a94e591a8557f7af2 for (i = 0; !of_property_read_u32_index(pdev->dev.of_node, "claim-clocks", -From d61da4f3762793e7d7a28dd51ca8505110f679ba Mon Sep 17 00:00:00 2001 +From 816b027029ba959826a7135f0dfe3c5285ee0546 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Mon, 9 May 2016 17:28:18 -0700 +Subject: [PATCH 031/140] clk: bcm2835: Mark GPIO clocks enabled at boot as + critical. + +These divide off of PLLD_PER and are used for the ethernet and wifi +PHYs source PLLs. Neither of them is currently represented by a phy +device that would grab the clock for us. + +This keeps other drivers from killing the networking PHYs when they +disable their own clocks and trigger PLLD_PER's refcount going to 0. + +v2: Skip marking as critical if they aren't on at boot. + +Signed-off-by: Eric Anholt +--- + drivers/clk/bcm/clk-bcm2835.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c +index 336f8c9c44325d0a94e591a8557f7af246adc857..caa05e5ad0b7b5cd683e04fb3591a3dfcb40823f 100644 +--- a/drivers/clk/bcm/clk-bcm2835.c ++++ b/drivers/clk/bcm/clk-bcm2835.c +@@ -1484,6 +1484,15 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman, + init.flags = data->flags | CLK_IGNORE_UNUSED; + + /* ++ * Some GPIO clocks for ethernet/wifi PLLs are marked as ++ * critical (since some platforms use them), but if the ++ * firmware didn't have them turned on then they clearly ++ * aren't actually critical. ++ */ ++ if ((cprman_read(cprman, data->ctl_reg) & CM_ENABLE) == 0) ++ init.flags &= ~CLK_IS_CRITICAL; ++ ++ /* + * Pass the CLK_SET_RATE_PARENT flag if we are allowed to propagate + * rate changes on at least of the parents. + */ + +From c5323d71ce36eddbf9885306f7d5cae94380c8c8 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 9 Feb 2017 14:36:44 +0000 -Subject: [PATCH 030/173] sound: Demote deferral errors to INFO level +Subject: [PATCH 032/140] 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. @@ -1943,10 +2023,10 @@ index 13c875e2392a40ec5651d7c12a28b9ac9f3aab85..23d56057e49b5ff6b6c3c352c150fee8 goto _err_defer; } -From f933329702240c201e0b4e4fbc18243d2e81f144 Mon Sep 17 00:00:00 2001 +From 9cd2c24aafc314994938e84beb39d50a4a6ebcdd Mon Sep 17 00:00:00 2001 From: Claggy3 Date: Sat, 11 Feb 2017 14:00:30 +0000 -Subject: [PATCH 031/173] Update vfpmodule.c +Subject: [PATCH 033/140] 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 @@ -2083,10 +2163,10 @@ index a71a48e71fffa8626fe90106815376c44bbe679b..d6c0a5a0a5ae3510db3ace5e3f5d3410 /* * Save the userland NEON/VFP state. Under UP, -From 281224342f791bcaa650dd6112a313ce76b13f92 Mon Sep 17 00:00:00 2001 +From cf5fe7abe9bb28853e72241a1018326c46de0fdc Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Wed, 8 Mar 2017 21:13:24 +1100 -Subject: [PATCH 032/173] ASoC: bcm2835_i2s.c: relax the ch2 register setting +Subject: [PATCH 034/140] 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. @@ -2107,10 +2187,10 @@ index 6ba20498202ed36906b52096893a88867a79269f..56df7d8a43d0aac055a91b0d24aca8e1 format |= BCM2835_I2S_CH1(BCM2835_I2S_CHPOS(ch1pos)); format |= BCM2835_I2S_CH2(BCM2835_I2S_CHPOS(ch2pos)); -From 1d225fa894026b0a705f35363b18fed51fd6b977 Mon Sep 17 00:00:00 2001 +From a1afd97cfaea33d38e9aa9018849435658995ff8 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 033/173] i2c: bcm2835: Add debug support +Subject: [PATCH 035/140] i2c: bcm2835: Add debug support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -2299,10 +2379,104 @@ index cd07a69e2e9355540442785f95e90823b05c9d10..47167f403cc8329bd811b47c7011c299 if (i2c_dev->msg_err & BCM2835_I2C_S_ERR) return -EREMOTEIO; -From 4f96629b6c09bc6d99e205e145e8398611183658 Mon Sep 17 00:00:00 2001 +From 190d35674eb17b66b31ace4ae4fbbc9b0e35f107 Mon Sep 17 00:00:00 2001 +From: Eric Anholt +Date: Thu, 18 Dec 2014 16:07:15 -0800 +Subject: [PATCH 036/140] 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 1423da8dd16f5bdc83e20ddf6665b2022a9a6492..6ce930c02160d55dc4eee1e7197a5efa6ba7d44a 100644 +--- a/mm/page_alloc.c ++++ b/mm/page_alloc.c +@@ -7692,8 +7692,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 be5a0f9212af4ccccdfec150b3a5d21b0289512f Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 23 Mar 2017 10:06:56 +0000 +Subject: [PATCH 037/140] 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 +can use the driver. + +Signed-off-by: Phil Elwell +--- + sound/soc/codecs/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig +index 6c78b0b49b8145c24740d93c4174c059d91ddae9..d6450d5fc144737f967b8e00678baa9b8f92295f 100644 +--- a/sound/soc/codecs/Kconfig ++++ b/sound/soc/codecs/Kconfig +@@ -571,7 +571,7 @@ config SND_SOC_HDAC_HDMI + select HDMI + + config SND_SOC_ICS43432 +- tristate ++ tristate "InvenSense ICS43432 I2S microphone codec" + + config SND_SOC_INNO_RK3036 + tristate "Inno codec driver for RK3036 SoC" + +From 4250ecc6c11e64b42116298be0ef4c82a6348bec Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Thu, 18 May 2017 15:36:46 +0100 +Subject: [PATCH 038/140] staging: bcm2835-audio: Fix memory corruption + +I'm all for fixing memory leaks, but freeing a block while it is still +being used is a recipe for hard-to-debug kernel exeptions. + +1) There is already a vchi method for freeing the instance, so use it. +2) Only call it on error, and then only before initted is false. + +Signed-off-by: Phil Elwell +Fixes: 0adbfd4694c2 ("staging: bcm2835-audio: fix memory leak in bcm2835_audio_open_connection()") +--- + drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +index 5f3d8f2339e34834d11edfa8de1d5819e3e32b4f..89f96f3c02805f4114ec9b488e18d00e1f348239 100644 +--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c ++++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c +@@ -409,6 +409,7 @@ static int bcm2835_audio_open_connection(struct bcm2835_alsa_stream *alsa_stream + LOG_ERR("%s: failed to connect VCHI instance (ret=%d)\n", + __func__, ret); + ++ vchi_disconnect(vchi_instance); + ret = -EIO; + goto err_free_mem; + } +@@ -431,7 +432,6 @@ static int bcm2835_audio_open_connection(struct bcm2835_alsa_stream *alsa_stream + LOG_DBG(" success !\n"); + ret = 0; + err_free_mem: +- kfree(vchi_instance); + + return ret; + } + +From 37b132acacac2b951bcae9bb31285dc5daf7b980 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 12 May 2013 12:24:19 +0100 -Subject: [PATCH 034/173] Main bcm2708/bcm2709 linux port +Subject: [PATCH 039/140] Main bcm2708/bcm2709 linux port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -2490,10 +2664,10 @@ index cfb4b4496dd9f61362dea012176c146120fada07..d9c6c217c4d6a2408abe2665bf7f2700 MODULE_AUTHOR("Lubomir Rintel "); MODULE_DESCRIPTION("BCM2835 mailbox IPC driver"); -From 2cf89e248c1f9d4fe0cbc6721141d9aadd427187 Mon Sep 17 00:00:00 2001 +From 7eff023dc567fe2c2b4170ab82f6785db8fe7e3b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 1 May 2013 19:46:17 +0100 -Subject: [PATCH 035/173] Add dwc_otg driver +Subject: [PATCH 040/140] Add dwc_otg driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -3069,6 +3243,47 @@ in hcd->free_hc_list becoming corrupted. dwcotg: Allow to build without FIQ on ARM64 Signed-off-by: popcornmix + +dwc_otg: make periodic scheduling behave properly for FS buses + +If the root port is in full-speed mode, transfer times at 12mbit/s +would be calculated but matched against high-speed quotas. + +Reinitialise hcd->frame_usecs[i] on each port enable event so that +full-speed bandwidth can be tracked sensibly. + +Also, don't bother using the FIQ for transfers when in full-speed +mode - at the slower bus speed, interrupt frequency is reduced by +an order of magnitude. + +Related issue: https://github.com/raspberrypi/linux/issues/2020 + +dwc_otg: fiq_fsm: Make isochronous compatibility checks work properly + +Get rid of the spammy printk and local pointer mangling. +Also, there is a nominal benefit for using fiq_fsm for isochronous +transfers in FS mode (~1.1k IRQs per second vs 2.1k IRQs per second) +so remove the root port speed check. + +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. + +The parameter is modifiable at runtime as it is used when activating new +endpoints (such as on device connect). + +dwc_otg: fiq_fsm: Add non-periodic TT exclusivity constraints + +Certain hub types do not discriminate between pipe direction (IN or OUT) +when considering non-periodic transfers. Therefore these hubs get confused +if multiple transfers are issued in different directions with the same +device address and endpoint number. + +Constrain queuing non-periodic split transactions so they are performed +serially in such cases. + +Related: https://github.com/raspberrypi/linux/issues/2024 --- arch/arm/include/asm/irqflags.h | 16 +- arch/arm/kernel/fiqasm.S | 4 + @@ -3117,18 +3332,18 @@ Signed-off-by: popcornmix drivers/usb/host/dwc_otg/dwc_otg_cil_intr.c | 1596 +++++ drivers/usb/host/dwc_otg/dwc_otg_core_if.h | 705 ++ drivers/usb/host/dwc_otg/dwc_otg_dbg.h | 117 + - drivers/usb/host/dwc_otg/dwc_otg_driver.c | 1757 +++++ + drivers/usb/host/dwc_otg/dwc_otg_driver.c | 1761 +++++ drivers/usb/host/dwc_otg/dwc_otg_driver.h | 86 + - drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c | 1358 ++++ - drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h | 370 + + drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c | 1390 ++++ + drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h | 372 + drivers/usb/host/dwc_otg/dwc_otg_fiq_stub.S | 80 + - drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 4242 ++++++++++++ - drivers/usb/host/dwc_otg/dwc_otg_hcd.h | 867 +++ + drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 4284 ++++++++++++ + drivers/usb/host/dwc_otg/dwc_otg_hcd.h | 870 +++ drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c | 1134 ++++ drivers/usb/host/dwc_otg/dwc_otg_hcd_if.h | 417 ++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 2749 ++++++++ + drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 2753 ++++++++ drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 1007 +++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c | 967 +++ + drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c | 971 +++ drivers/usb/host/dwc_otg/dwc_otg_os_dep.h | 188 + drivers/usb/host/dwc_otg/dwc_otg_pcd.c | 2725 ++++++++ drivers/usb/host/dwc_otg/dwc_otg_pcd.h | 273 + @@ -3140,7 +3355,7 @@ Signed-off-by: popcornmix drivers/usb/host/dwc_otg/test/dwc_otg_test.pm | 337 + drivers/usb/host/dwc_otg/test/test_mod_param.pl | 133 + drivers/usb/host/dwc_otg/test/test_sysfs.pl | 193 + - 70 files changed, 59917 insertions(+), 16 deletions(-) + 70 files changed, 60008 insertions(+), 16 deletions(-) create mode 100644 drivers/usb/gadget/file_storage.c create mode 100644 drivers/usb/host/dwc_common_port/Makefile create mode 100644 drivers/usb/host/dwc_common_port/Makefile.fbsd @@ -3271,7 +3486,7 @@ index bd3e0c5a6db25e7a162d922c6508de1ad0b68025..15c80079c97bb9eeec478932af88a293 return i; } diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c -index 822f8c50e4233c70d159a4e374ad66b49502c0c1..2b0a828258fd46e05e9dea9a23168cd746b4fe54 100644 +index 78c2aca5b0fc18153aa2715471bd5d2243ca358e..98bea9a4fa9a93bf207715ead68b5dfa4a368ec0 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -5039,7 +5039,7 @@ static void port_event(struct usb_hub *hub, int port1) @@ -3284,7 +3499,7 @@ index 822f8c50e4233c70d159a4e374ad66b49502c0c1..2b0a828258fd46e05e9dea9a23168cd7 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 4c38ea41ae969e6fac8ced209a655957322ba36f..abb0d9b614f469a4fb356f47ca22fb9684fffa2f 100644 +index 371a07d874a370bc70ad6ef1499debac8b34b6fe..30d4879d2d9b1433d71eb6f99aa67f653608e88e 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c @@ -1909,6 +1909,85 @@ int usb_set_configuration(struct usb_device *dev, int configuration) @@ -35260,10 +35475,10 @@ index 0000000000000000000000000000000000000000..ccc24e010e449cbda488050d901e9a39 +#endif diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c new file mode 100644 -index 0000000000000000000000000000000000000000..cb060a7179a3eec791506ed2779b553cad9841b0 +index 0000000000000000000000000000000000000000..95943e07528276b26b51ea2d57a1f433f280aaef --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c -@@ -0,0 +1,1757 @@ +@@ -0,0 +1,1761 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_driver.c $ + * $Revision: #92 $ @@ -35515,6 +35730,7 @@ index 0000000000000000000000000000000000000000..cb060a7179a3eec791506ed2779b553c + +unsigned short fiq_fsm_mask = 0x0F; + ++unsigned short int_ep_interval_min = 0; +/** + * This function shows the Driver Version. + */ @@ -36664,7 +36880,10 @@ index 0000000000000000000000000000000000000000..cb060a7179a3eec791506ed2779b553c + "Bit 1 : Periodic split transactions\n" + "Bit 2 : High-speed multi-transfer isochronous\n" + "All other bits should be set 0."); -+ ++module_param(int_ep_interval_min, ushort, 0644); ++MODULE_PARM_DESC(int_ep_interval_min, "Clamp high-speed Interrupt endpoints to a minimum polling interval.\n" ++ "0..1 = Use endpoint default\n" ++ "2..n = Minimum interval n microframes. Use powers of 2.\n"); + +/** @page "Module Parameters" + * @@ -37115,10 +37334,10 @@ index 0000000000000000000000000000000000000000..6a8be63a0ab20f4e1c56251b85648aa2 +#endif diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c new file mode 100644 -index 0000000000000000000000000000000000000000..2035e0762dc6d60673c8fbc47a90b72254f50b69 +index 0000000000000000000000000000000000000000..b7731e7edb4602f93f028d786194822161bbf0f8 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c -@@ -0,0 +1,1358 @@ +@@ -0,0 +1,1390 @@ +/* + * dwc_otg_fiq_fsm.c - The finite state machine FIQ + * @@ -37295,6 +37514,32 @@ index 0000000000000000000000000000000000000000..2035e0762dc6d60673c8fbc47a90b722 + mb(); +} + ++/** ++ * fiq_fsm_restart_np_pending() - Restart a single non-periodic contended transfer ++ * @st: Pointer to the channel's state ++ * @num_channels: Total number of host channels ++ * @orig_channel: Channel index of completed transfer ++ * ++ * In the case where an IN and OUT transfer are simultaneously scheduled to the ++ * same device/EP, inadequate hub implementations will misbehave. Once the first ++ * transfer is complete, a pending non-periodic split can then be issued. ++ */ ++static void notrace fiq_fsm_restart_np_pending(struct fiq_state *st, int num_channels, int orig_channel) ++{ ++ int i; ++ int dev_addr = st->channel[orig_channel].hcchar_copy.b.devaddr; ++ int ep_num = st->channel[orig_channel].hcchar_copy.b.epnum; ++ for (i = 0; i < num_channels; i++) { ++ if (st->channel[i].fsm == FIQ_NP_SSPLIT_PENDING && ++ st->channel[i].hcchar_copy.b.devaddr == dev_addr && ++ st->channel[i].hcchar_copy.b.epnum == ep_num) { ++ st->channel[i].fsm = FIQ_NP_SSPLIT_STARTED; ++ fiq_fsm_restart_channel(st, i, 0); ++ break; ++ } ++ } ++} ++ +static inline int notrace fiq_get_xfer_len(struct fiq_state *st, int n) +{ + /* The xfersize register is a bit wonky. For IN transfers, it decrements by the packet size. */ @@ -37974,6 +38219,9 @@ index 0000000000000000000000000000000000000000..2035e0762dc6d60673c8fbc47a90b722 + st->fsm = FIQ_NP_SPLIT_HS_ABORTED; + } + } ++ if (st->fsm != FIQ_NP_IN_CSPLIT_RETRY) { ++ fiq_fsm_restart_np_pending(state, num_channels, n); ++ } + break; + + case FIQ_NP_OUT_CSPLIT_RETRY: @@ -38023,6 +38271,9 @@ index 0000000000000000000000000000000000000000..2035e0762dc6d60673c8fbc47a90b722 + st->fsm = FIQ_NP_SPLIT_HS_ABORTED; + } + } ++ if (st->fsm != FIQ_NP_OUT_CSPLIT_RETRY) { ++ fiq_fsm_restart_np_pending(state, num_channels, n); ++ } + break; + + /* Periodic split states (except isoc out) */ @@ -38479,10 +38730,10 @@ index 0000000000000000000000000000000000000000..2035e0762dc6d60673c8fbc47a90b722 +} diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h new file mode 100644 -index 0000000000000000000000000000000000000000..f9fddfbcffb37f32c808fd78f222b676378398b1 +index 0000000000000000000000000000000000000000..8340041ce65665c094e2ad49fd5e8eb1751506f3 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h -@@ -0,0 +1,370 @@ +@@ -0,0 +1,372 @@ +/* + * dwc_otg_fiq_fsm.h - Finite state machine FIQ header definitions + * @@ -38655,6 +38906,8 @@ index 0000000000000000000000000000000000000000..f9fddfbcffb37f32c808fd78f222b676 + /* Nonperiodic state groups */ + FIQ_NP_SSPLIT_STARTED = 1, + FIQ_NP_SSPLIT_RETRY = 2, ++ /* TT contention - working around hub bugs */ ++ FIQ_NP_SSPLIT_PENDING = 33, + FIQ_NP_OUT_CSPLIT_RETRY = 3, + FIQ_NP_IN_CSPLIT_RETRY = 4, + FIQ_NP_SPLIT_DONE = 5, @@ -38941,10 +39194,10 @@ index 0000000000000000000000000000000000000000..ffa8d21bc61e893fee86ba04955587e7 +END(_dwc_otg_fiq_stub) diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c new file mode 100644 -index 0000000000000000000000000000000000000000..5e4d4ffe7966486d40a5b5e2423ac4df0de772a8 +index 0000000000000000000000000000000000000000..60464acab588a1e189f39b268ffc25766c13dc85 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -@@ -0,0 +1,4242 @@ +@@ -0,0 +1,4284 @@ + +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.c $ @@ -39873,8 +40126,6 @@ index 0000000000000000000000000000000000000000..5e4d4ffe7966486d40a5b5e2423ac4df + DWC_FREE(dwc_otg_hcd); +} + -+int init_hcd_usecs(dwc_otg_hcd_t *_hcd); -+ +int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if) +{ + struct device *dev = dwc_otg_hcd_to_dev(hcd); @@ -40372,6 +40623,7 @@ index 0000000000000000000000000000000000000000..5e4d4ffe7966486d40a5b5e2423ac4df + +/** + * fiq_fsm_transaction_suitable() - Test a QH for compatibility with the FIQ ++ * @hcd: Pointer to the dwc_otg_hcd struct + * @qh: pointer to the endpoint's queue head + * + * Transaction start/end control flow is grafted onto the existing dwc_otg @@ -40381,7 +40633,7 @@ index 0000000000000000000000000000000000000000..5e4d4ffe7966486d40a5b5e2423ac4df + * Returns: 0 for unsuitable, 1 implies the FIQ can be enabled for this transaction. + */ + -+int fiq_fsm_transaction_suitable(dwc_otg_qh_t *qh) ++int fiq_fsm_transaction_suitable(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) +{ + if (qh->do_split) { + switch (qh->ep_type) { @@ -40400,28 +40652,22 @@ index 0000000000000000000000000000000000000000..5e4d4ffe7966486d40a5b5e2423ac4df + } + } else if (qh->ep_type == UE_ISOCHRONOUS) { + if (fiq_fsm_mask & (1 << 2)) { -+ /* HS ISOCH support. We test for compatibility: ++ /* ISOCH support. We test for compatibility: + * - DWORD aligned buffers + * - Must be at least 2 transfers (otherwise pointless to use the FIQ) + * If yes, then the fsm enqueue function will handle the state machine setup. + */ + dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); + dwc_otg_hcd_urb_t *urb = qtd->urb; -+ struct dwc_otg_hcd_iso_packet_desc (*iso_descs)[0] = &urb->iso_descs; -+ int nr_iso_frames = urb->packet_count; ++ dwc_dma_t ptr; + int i; -+ uint32_t ptr; + -+ if (nr_iso_frames < 2) ++ if (urb->packet_count < 2) + return 0; -+ for (i = 0; i < nr_iso_frames; i++) { -+ ptr = urb->dma + iso_descs[i]->offset; -+ if (ptr & 0x3) { -+ printk_ratelimited("%s: Non-Dword aligned isochronous frame offset." -+ " Cannot queue FIQ-accelerated transfer to device %d endpoint %d\n", -+ __FUNCTION__, qh->channel->dev_addr, qh->channel->ep_num); ++ for (i = 0; i < urb->packet_count; i++) { ++ ptr = urb->dma + urb->iso_descs[i].offset; ++ if (ptr & 0x3) + return 0; -+ } + } + return 1; + } @@ -40522,6 +40768,45 @@ index 0000000000000000000000000000000000000000..5e4d4ffe7966486d40a5b5e2423ac4df + } +} + ++/** ++ * fiq_fsm_np_tt_contended() - Avoid performing contended non-periodic transfers ++ * @hcd: Pointer to the dwc_otg_hcd struct ++ * @qh: Pointer to the endpoint's queue head ++ * ++ * Certain hub chips don't differentiate between IN and OUT non-periodic pipes ++ * with the same endpoint number. If transfers get completed out of order ++ * (disregarding the direction token) then the hub can lock up ++ * or return erroneous responses. ++ * ++ * Returns 1 if initiating the transfer would cause contention, 0 otherwise. ++ */ ++int fiq_fsm_np_tt_contended(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) ++{ ++ int i; ++ struct fiq_channel_state *st; ++ int dev_addr = qh->channel->dev_addr; ++ int ep_num = qh->channel->ep_num; ++ for (i = 0; i < hcd->core_if->core_params->host_channels; i++) { ++ if (i == qh->channel->hc_num) ++ continue; ++ st = &hcd->fiq_state->channel[i]; ++ switch (st->fsm) { ++ case FIQ_NP_SSPLIT_STARTED: ++ case FIQ_NP_SSPLIT_RETRY: ++ case FIQ_NP_SSPLIT_PENDING: ++ case FIQ_NP_OUT_CSPLIT_RETRY: ++ case FIQ_NP_IN_CSPLIT_RETRY: ++ if (st->hcchar_copy.b.devaddr == dev_addr && ++ st->hcchar_copy.b.epnum == ep_num) ++ return 1; ++ break; ++ default: ++ break; ++ } ++ } ++ return 0; ++} ++ +/* + * Pushing a periodic request into the queue near the EOF1 point + * in a microframe causes erroneous behaviour (frmovrun) interrupt. @@ -40844,7 +41129,12 @@ index 0000000000000000000000000000000000000000..5e4d4ffe7966486d40a5b5e2423ac4df + switch (hc->ep_type) { + case UE_CONTROL: + case UE_BULK: -+ st->fsm = FIQ_NP_SSPLIT_STARTED; ++ if (fiq_fsm_np_tt_contended(hcd, qh)) { ++ st->fsm = FIQ_NP_SSPLIT_PENDING; ++ start_immediate = 0; ++ } else { ++ st->fsm = FIQ_NP_SSPLIT_STARTED; ++ } + break; + case UE_ISOCHRONOUS: + if (hc->ep_is_in) { @@ -40868,7 +41158,12 @@ index 0000000000000000000000000000000000000000..5e4d4ffe7966486d40a5b5e2423ac4df + break; + case UE_INTERRUPT: + if (fiq_fsm_mask & 0x8) { -+ st->fsm = FIQ_NP_SSPLIT_STARTED; ++ if (fiq_fsm_np_tt_contended(hcd, qh)) { ++ st->fsm = FIQ_NP_SSPLIT_PENDING; ++ start_immediate = 0; ++ } else { ++ st->fsm = FIQ_NP_SSPLIT_STARTED; ++ } + } else if (start_immediate) { + st->fsm = FIQ_PER_SSPLIT_STARTED; + } else { @@ -41161,7 +41456,7 @@ index 0000000000000000000000000000000000000000..5e4d4ffe7966486d40a5b5e2423ac4df + continue; + } + -+ if (fiq_fsm_enable && fiq_fsm_transaction_suitable(qh)) { ++ if (fiq_fsm_enable && fiq_fsm_transaction_suitable(hcd, qh)) { + if (qh->do_split) + fiq_fsm_queue_split_transaction(hcd, qh); + else @@ -41298,7 +41593,7 @@ index 0000000000000000000000000000000000000000..5e4d4ffe7966486d40a5b5e2423ac4df + qh = DWC_LIST_ENTRY(hcd->non_periodic_qh_ptr, dwc_otg_qh_t, + qh_list_entry); + -+ if(fiq_fsm_enable && fiq_fsm_transaction_suitable(qh)) { ++ if(fiq_fsm_enable && fiq_fsm_transaction_suitable(hcd, qh)) { + fiq_fsm_queue_split_transaction(hcd, qh); + } else { + status = queue_transaction(hcd, qh->channel, @@ -43189,10 +43484,10 @@ index 0000000000000000000000000000000000000000..5e4d4ffe7966486d40a5b5e2423ac4df +#endif /* DWC_DEVICE_ONLY */ diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h new file mode 100644 -index 0000000000000000000000000000000000000000..7f7e9eaffd6a3c3d898855562fbec11289f77f53 +index 0000000000000000000000000000000000000000..5ed8dccf03959a610849aa6c8946ca745dbae207 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h -@@ -0,0 +1,867 @@ +@@ -0,0 +1,870 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd.h $ + * $Revision: #58 $ @@ -43605,7 +43900,8 @@ index 0000000000000000000000000000000000000000..7f7e9eaffd6a3c3d898855562fbec112 + unsigned port_suspend_change:1; + unsigned port_over_current_change:1; + unsigned port_l1_change:1; -+ unsigned reserved:26; ++ unsigned port_speed:2; ++ unsigned reserved:24; + } b; + } flags; + @@ -43824,7 +44120,7 @@ index 0000000000000000000000000000000000000000..7f7e9eaffd6a3c3d898855562fbec112 +void dwc_otg_hcd_release_port(dwc_otg_hcd_t * dwc_otg_hcd, dwc_otg_qh_t *qh); + +extern int fiq_fsm_queue_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh); -+extern int fiq_fsm_transaction_suitable(dwc_otg_qh_t *qh); ++extern int fiq_fsm_transaction_suitable(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh); +extern void dwc_otg_cleanup_fiq_channel(dwc_otg_hcd_t *hcd, uint32_t num); + +/** @} */ @@ -44018,6 +44314,8 @@ index 0000000000000000000000000000000000000000..7f7e9eaffd6a3c3d898855562fbec112 + return frame & 0x7; +} + ++extern void init_hcd_usecs(dwc_otg_hcd_t *_hcd); ++ +void dwc_otg_hcd_save_data_toggle(dwc_hc_t * hc, + dwc_otg_hc_regs_t * hc_regs, + dwc_otg_qtd_t * qtd); @@ -45625,10 +45923,10 @@ index 0000000000000000000000000000000000000000..fb57db09378f4ab95d57cb58aa570a91 +#endif /* DWC_DEVICE_ONLY */ diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c new file mode 100644 -index 0000000000000000000000000000000000000000..fc52495e4749f45dcf270c1c22960f163b6dc86d +index 0000000000000000000000000000000000000000..ed855eb9c3b64d54e93c5aa7e06212e779400dfd --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -@@ -0,0 +1,2749 @@ +@@ -0,0 +1,2753 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_intr.c $ + * $Revision: #89 $ @@ -46145,6 +46443,10 @@ index 0000000000000000000000000000000000000000..fc52495e4749f45dcf270c1c22960f16 + dwc_otg_host_if_t *host_if = + dwc_otg_hcd->core_if->host_if; + ++ dwc_otg_hcd->flags.b.port_speed = hprt0.b.prtspd; ++ if (microframe_schedule) ++ init_hcd_usecs(dwc_otg_hcd); ++ + /* Every time when port enables calculate + * HFIR.FrInterval + */ @@ -49393,10 +49695,10 @@ index 0000000000000000000000000000000000000000..96ec6338bbcb8ebe69a233d21a4b9d24 +#endif /* DWC_DEVICE_ONLY */ diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c new file mode 100644 -index 0000000000000000000000000000000000000000..85a6d431ca54b47dc10573aa72d1ad69d06f2e36 +index 0000000000000000000000000000000000000000..fe8e8f841f03660c2ad49ab8e66193bec62558d3 --- /dev/null +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -@@ -0,0 +1,967 @@ +@@ -0,0 +1,971 @@ +/* ========================================================================== + * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_hcd_queue.c $ + * $Revision: #44 $ @@ -49442,6 +49744,7 @@ index 0000000000000000000000000000000000000000..85a6d431ca54b47dc10573aa72d1ad69 +#include "dwc_otg_regs.h" + +extern bool microframe_schedule; ++extern unsigned short int_ep_interval_min; + +/** + * Free each QTD in the QH's QTD-list then free the QH. QH should already be @@ -49617,21 +49920,19 @@ index 0000000000000000000000000000000000000000..85a6d431ca54b47dc10573aa72d1ad69 + SCHEDULE_SLOP); + qh->interval = urb->interval; + -+#if 0 -+ /* Increase interrupt polling rate for debugging. */ -+ if (qh->ep_type == UE_INTERRUPT) { -+ qh->interval = 8; -+ } -+#endif + hprt.d32 = DWC_READ_REG32(hcd->core_if->host_if->hprt0); -+ if ((hprt.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) && -+ ((dev_speed == USB_SPEED_LOW) || -+ (dev_speed == USB_SPEED_FULL))) { -+ qh->interval *= 8; -+ qh->sched_frame |= 0x7; -+ qh->start_split_frame = qh->sched_frame; ++ if (hprt.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) { ++ if (dev_speed == USB_SPEED_LOW || ++ dev_speed == USB_SPEED_FULL) { ++ qh->interval *= 8; ++ qh->sched_frame |= 0x7; ++ qh->start_split_frame = qh->sched_frame; ++ } else if (int_ep_interval_min >= 2 && ++ qh->interval < int_ep_interval_min && ++ qh->ep_type == UE_INTERRUPT) { ++ qh->interval = int_ep_interval_min; ++ } + } -+ + } + + DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD QH Initialized\n"); @@ -49807,13 +50108,17 @@ index 0000000000000000000000000000000000000000..85a6d431ca54b47dc10573aa72d1ad69 +/* + * called from dwc_otg_hcd.c:dwc_otg_hcd_init + */ -+int init_hcd_usecs(dwc_otg_hcd_t *_hcd) ++void init_hcd_usecs(dwc_otg_hcd_t *_hcd) +{ + int i; -+ for (i=0; i<8; i++) { -+ _hcd->frame_usecs[i] = max_uframe_usecs[i]; ++ if (_hcd->flags.b.port_speed == DWC_HPRT0_PRTSPD_FULL_SPEED) { ++ _hcd->frame_usecs[0] = 900; ++ for (i = 1; i < 8; i++) ++ _hcd->frame_usecs[i] = 0; ++ } else { ++ for (i = 0; i < 8; i++) ++ _hcd->frame_usecs[i] = max_uframe_usecs[i]; + } -+ return 0; +} + +static int find_single_uframe(dwc_otg_hcd_t * _hcd, dwc_otg_qh_t * _qh) @@ -49940,8 +50245,9 @@ index 0000000000000000000000000000000000000000..85a6d431ca54b47dc10573aa72d1ad69 + int ret; + ret = -1; + -+ if (_qh->speed == USB_SPEED_HIGH) { -+ /* if this is a hs transaction we need a full frame */ ++ if (_qh->speed == USB_SPEED_HIGH || ++ _hcd->flags.b.port_speed == DWC_HPRT0_PRTSPD_FULL_SPEED) { ++ /* if this is a hs transaction we need a full frame - or account for FS usecs */ + ret = find_single_uframe(_hcd, _qh); + } else { + /* if this is a fs transaction we may need a sequence of frames */ @@ -50026,7 +50332,7 @@ index 0000000000000000000000000000000000000000..85a6d431ca54b47dc10573aa72d1ad69 + if (status) { + DWC_INFO("%s: Insufficient periodic bandwidth for " + "periodic transfer.\n", __func__); -+ return status; ++ return -DWC_E_NO_SPACE; + } + status = check_max_xfer_size(hcd, qh); + if (status) { @@ -63635,10 +63941,10 @@ index 0000000000000000000000000000000000000000..cdc9963176e5a4a0d5250613b61e26c5 +test_main(); +0; -From a40d36f39959c4f362ac2358c81a024725e44f94 Mon Sep 17 00:00:00 2001 +From b4a37449c8579db59598df6349e9a67bcde67b4b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 17:06:34 +0100 -Subject: [PATCH 036/173] bcm2708 framebuffer driver +Subject: [PATCH 041/140] bcm2708 framebuffer driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -67097,10 +67403,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 1753129c47da9aadf7041d176407003fc466d9df Mon Sep 17 00:00:00 2001 +From 0869ad47982e5ab21d51598327f1e8ff703e269e Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 14:22:53 +0100 -Subject: [PATCH 037/173] dmaengine: Add support for BCM2708 +Subject: [PATCH 042/140] dmaengine: Add support for BCM2708 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -67731,10 +68037,10 @@ index 0000000000000000000000000000000000000000..c5bfff2765be4606077e6c8af73040ec + +#endif /* _PLAT_BCM2708_DMA_H */ -From c9c5b3c903a77dbef477d199e2a5916d056fe4ed Mon Sep 17 00:00:00 2001 +From 287c654b110b9abf269be95b6713a944d1c9a0e8 Mon Sep 17 00:00:00 2001 From: gellert Date: Fri, 15 Aug 2014 16:35:06 +0100 -Subject: [PATCH 038/173] MMC: added alternative MMC driver +Subject: [PATCH 043/140] MMC: added alternative MMC driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -67817,21 +68123,156 @@ See: https://github.com/raspberrypi/linux/issues/1327 Signed-off-by: Phil Elwell --- + drivers/mmc/core/block.c | 28 +- + drivers/mmc/core/core.c | 3 +- + drivers/mmc/core/host.c | 17 +- + drivers/mmc/core/quirks.h | 8 + drivers/mmc/host/Kconfig | 29 + drivers/mmc/host/Makefile | 1 + - drivers/mmc/host/bcm2835-mmc.c | 1574 ++++++++++++++++++++++++++++++++++++++++ - 3 files changed, 1604 insertions(+) + drivers/mmc/host/bcm2835-mmc.c | 1584 ++++++++++++++++++++++++++++++++++++++++ + include/linux/mmc/card.h | 2 + + 8 files changed, 1667 insertions(+), 5 deletions(-) create mode 100644 drivers/mmc/host/bcm2835-mmc.c +diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c +index 8bd7aba811e969a3b7cfdc6cf12e685f25e8c37e..cd1eb5cf73358a0104fbf4b6ed8e72dd491d658d 100644 +--- a/drivers/mmc/core/block.c ++++ b/drivers/mmc/core/block.c +@@ -125,6 +125,13 @@ static DEFINE_MUTEX(open_lock); + module_param(perdev_minors, int, 0444); + MODULE_PARM_DESC(perdev_minors, "Minors numbers to allocate per device"); + ++/* ++ * Allow quirks to be overridden for the current card ++ */ ++static char *card_quirks; ++module_param(card_quirks, charp, 0644); ++MODULE_PARM_DESC(card_quirks, "Force the use of the indicated quirks (a bitfield)"); ++ + static inline int mmc_blk_part_switch(struct mmc_card *card, + struct mmc_blk_data *md); + +@@ -2287,6 +2294,7 @@ static int mmc_blk_probe(struct mmc_card *card) + { + struct mmc_blk_data *md, *part_md; + char cap_str[10]; ++ char quirk_str[24]; + + /* + * Check that the card supports the command class(es) we need. +@@ -2294,7 +2302,16 @@ static int mmc_blk_probe(struct mmc_card *card) + if (!(card->csd.cmdclass & CCC_BLOCK_READ)) + return -ENODEV; + +- mmc_fixup_device(card, mmc_blk_fixups); ++ if (card_quirks) { ++ unsigned long quirks; ++ if (kstrtoul(card_quirks, 0, &quirks) == 0) ++ card->quirks = (unsigned int)quirks; ++ else ++ pr_err("mmc_block: Invalid card_quirks parameter '%s'\n", ++ card_quirks); ++ } ++ else ++ mmc_fixup_device(card, mmc_blk_fixups); + + md = mmc_blk_alloc(card); + if (IS_ERR(md)) +@@ -2302,9 +2319,14 @@ static int mmc_blk_probe(struct mmc_card *card) + + string_get_size((u64)get_capacity(md->disk), 512, STRING_UNITS_2, + cap_str, sizeof(cap_str)); +- pr_info("%s: %s %s %s %s\n", ++ if (card->quirks) ++ snprintf(quirk_str, sizeof(quirk_str), ++ " (quirks 0x%08x)", card->quirks); ++ else ++ quirk_str[0] = '\0'; ++ pr_info("%s: %s %s %s%s%s\n", + md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), +- cap_str, md->read_only ? "(ro)" : ""); ++ cap_str, md->read_only ? " (ro)" : "", quirk_str); + + if (mmc_blk_alloc_parts(card, md)) + goto out; +diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c +index 26431267a3e2d790d4eae99e65881ca60bd2047d..0ec589ace762a27f3c5ea39226fef3a67442675f 100644 +--- a/drivers/mmc/core/core.c ++++ b/drivers/mmc/core/core.c +@@ -2211,7 +2211,8 @@ EXPORT_SYMBOL(mmc_erase); + int mmc_can_erase(struct mmc_card *card) + { + if ((card->host->caps & MMC_CAP_ERASE) && +- (card->csd.cmdclass & CCC_ERASE) && card->erase_size) ++ (card->csd.cmdclass & CCC_ERASE) && card->erase_size && ++ !(card->quirks & MMC_QUIRK_ERASE_BROKEN)) + return 1; + return 0; + } +diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c +index 1503412f826cd0e0e9ad37a0554b31596a49eb77..2f5b3cf86293b96b104eac7c6d48a5839d7e974b 100644 +--- a/drivers/mmc/core/host.c ++++ b/drivers/mmc/core/host.c +@@ -344,15 +344,30 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) + { + int err; + struct mmc_host *host; ++ int id; + + host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL); + if (!host) + return NULL; + ++ /* If OF aliases exist, start dynamic assignment after highest */ ++ id = of_alias_get_highest_id("mmc"); ++ id = (id < 0) ? 0 : id + 1; ++ ++ /* If this devices has OF node, maybe it has an alias */ ++ if (dev->of_node) { ++ int of_id = of_alias_get_id(dev->of_node, "mmc"); ++ ++ if (of_id < 0) ++ dev_warn(dev, "/aliases ID not available\n"); ++ else ++ id = of_id; ++ } ++ + /* scanning will be enabled when we're ready */ + host->rescan_disable = 1; + +- err = ida_simple_get(&mmc_host_ida, 0, 0, GFP_KERNEL); ++ err = ida_simple_get(&mmc_host_ida, id, 0, GFP_KERNEL); + if (err < 0) { + kfree(host); + return NULL; +diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h +index fb725934fa21cee1b98fd7bc08227bf6d0317549..c9d5d644688c1509d7febcff0322fbaba0a842d6 100644 +--- a/drivers/mmc/core/quirks.h ++++ b/drivers/mmc/core/quirks.h +@@ -90,6 +90,14 @@ static const struct mmc_fixup mmc_blk_fixups[] = { + MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc, + MMC_QUIRK_TRIM_BROKEN), + ++ /* ++ * On some Kingston SD cards, multiple erases of less than 64 ++ * sectors can cause corruption. ++ */ ++ MMC_FIXUP("SD16G", 0x41, 0x3432, add_quirk, MMC_QUIRK_ERASE_BROKEN), ++ MMC_FIXUP("SD32G", 0x41, 0x3432, add_quirk, MMC_QUIRK_ERASE_BROKEN), ++ MMC_FIXUP("SD64G", 0x41, 0x3432, add_quirk, MMC_QUIRK_ERASE_BROKEN), ++ + END_FIXUP + }; + diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig -index 5755b69f2f728ffb829f257c2016a8965ce19c93..d657e99b7b5a9218cd37dd529ca08eef8c681981 100644 +index 5755b69f2f728ffb829f257c2016a8965ce19c93..267a5be5b029603fcb0a30d59c9c44784b6633d9 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -4,6 +4,35 @@ comment "MMC/SD/SDIO Host Controller Drivers" -+config MMC_BCM2835 ++config MMC_BCM2835_MMC + tristate "MMC support on BCM2835" + depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 + help @@ -67843,7 +68284,7 @@ index 5755b69f2f728ffb829f257c2016a8965ce19c93..d657e99b7b5a9218cd37dd529ca08eef + +config MMC_BCM2835_DMA + bool "DMA support on BCM2835 Arasan controller" -+ depends on MMC_BCM2835 ++ depends on MMC_BCM2835_MMC + help + Enable DMA support on the Arasan SDHCI controller in Broadcom 2708 + based chips. @@ -67852,7 +68293,7 @@ index 5755b69f2f728ffb829f257c2016a8965ce19c93..d657e99b7b5a9218cd37dd529ca08eef + +config MMC_BCM2835_PIO_DMA_BARRIER + int "Block count limit for PIO transfers" -+ depends on MMC_BCM2835 && MMC_BCM2835_DMA ++ depends on MMC_BCM2835_MMC && MMC_BCM2835_DMA + range 0 256 + default 2 + help @@ -67864,23 +68305,23 @@ index 5755b69f2f728ffb829f257c2016a8965ce19c93..d657e99b7b5a9218cd37dd529ca08eef tristate "ARM AMBA Multimedia Card Interface support" depends on ARM_AMBA diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile -index 4d454711631158559c99a4df7953b17f3b1330d6..b8815fc623d7bba9f1375778daa274febeb32769 100644 +index 4d454711631158559c99a4df7953b17f3b1330d6..b27b702f59ba2b473a9d4da77eb5edb0f8763f03 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile @@ -18,6 +18,7 @@ obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o obj-$(CONFIG_MMC_SDHCI_SIRF) += sdhci-sirf.o obj-$(CONFIG_MMC_SDHCI_F_SDH30) += sdhci_f_sdh30.o obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o -+obj-$(CONFIG_MMC_BCM2835) += bcm2835-mmc.o ++obj-$(CONFIG_MMC_BCM2835_MMC) += bcm2835-mmc.o obj-$(CONFIG_MMC_WBSD) += wbsd.o obj-$(CONFIG_MMC_AU1X) += au1xmmc.o obj-$(CONFIG_MMC_MTK) += mtk-sd.o diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c new file mode 100644 -index 0000000000000000000000000000000000000000..4fe8d1fe44578fbefcd48f8c327ba3d03f3d0a2a +index 0000000000000000000000000000000000000000..c4a5e992c6fb4a40b933239350ed4bfc8fb40155 --- /dev/null +++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -0,0 +1,1574 @@ +@@ -0,0 +1,1584 @@ +/* + * BCM2835 MMC host driver. + * @@ -67998,6 +68439,7 @@ index 0000000000000000000000000000000000000000..4fe8d1fe44578fbefcd48f8c327ba3d0 + + bool have_dma; + bool use_dma; ++ bool wait_for_dma; + /*end of DMA part*/ + + int max_delay; /* maximum length of time spent waiting */ @@ -68224,6 +68666,8 @@ index 0000000000000000000000000000000000000000..4fe8d1fe44578fbefcd48f8c327ba3d0 + + spin_lock_irqsave(&host->lock, flags); + ++ host->use_dma = false; ++ + if (host->data && !(host->data->flags & MMC_DATA_WRITE)) { + /* otherwise handled in SDHCI IRQ */ + dma_chan = host->dma_chan_rxtx; @@ -68234,6 +68678,9 @@ index 0000000000000000000000000000000000000000..4fe8d1fe44578fbefcd48f8c327ba3d0 + dir_data); + + bcm2835_mmc_finish_data(host); ++ } else if (host->wait_for_dma) { ++ host->wait_for_dma = false; ++ tasklet_schedule(&host->finish_tasklet); + } + + spin_unlock_irqrestore(&host->lock, flags); @@ -68573,6 +69020,7 @@ index 0000000000000000000000000000000000000000..4fe8d1fe44578fbefcd48f8c327ba3d0 + mod_timer(&host->timer, timeout); + + host->cmd = cmd; ++ host->use_dma = false; + + bcm2835_mmc_prepare_data(host, cmd); + @@ -68642,8 +69090,11 @@ index 0000000000000000000000000000000000000000..4fe8d1fe44578fbefcd48f8c327ba3d0 + } + + bcm2835_mmc_send_command(host, data->stop); -+ } else ++ } else if (host->use_dma) { ++ host->wait_for_dma = true; ++ } else { + tasklet_schedule(&host->finish_tasklet); ++ } +} + +static void bcm2835_mmc_finish_command(struct bcm2835_host *host) @@ -69237,14 +69688,14 @@ index 0000000000000000000000000000000000000000..4fe8d1fe44578fbefcd48f8c327ba3d0 + if (ret == 0) { + host->dma_cfg_rx = cfg; + -+ host->use_dma = true; ++ host->have_dma = true; + } else { + pr_err("%s: unable to configure DMA channel. " -+ "Faling back to PIO\n", ++ "Falling back to PIO\n", + mmc_hostname(mmc)); + dma_release_channel(host->dma_chan_rxtx); + host->dma_chan_rxtx = NULL; -+ host->use_dma = false; ++ host->have_dma = false; + } + } +#endif @@ -69455,11 +69906,24 @@ index 0000000000000000000000000000000000000000..4fe8d1fe44578fbefcd48f8c327ba3d0 +MODULE_DESCRIPTION("BCM2835 SDHCI driver"); +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Gellert Weisz"); +diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h +index 46c73e97e61f08a41d9753079345f5965caebbc5..388c551ed11e9d06ea1c25b6553d47a8d668953a 100644 +--- a/include/linux/mmc/card.h ++++ b/include/linux/mmc/card.h +@@ -269,6 +269,8 @@ struct mmc_card { + #define MMC_QUIRK_TRIM_BROKEN (1<<12) /* Skip trim */ + #define MMC_QUIRK_BROKEN_HPI (1<<13) /* Disable broken HPI support */ + ++#define MMC_QUIRK_ERASE_BROKEN (1<<31) /* Skip erase */ ++ + bool reenable_cmdq; /* Re-enable Command Queue */ + + unsigned int erase_size; /* erase size in sectors */ -From 7c111fc21e11126c810c8dd325ae4334bd54b9b2 Mon Sep 17 00:00:00 2001 +From 3b1911c2500d518f1a6124f57871dbb5abfd24a1 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 25 Mar 2015 17:49:47 +0000 -Subject: [PATCH 039/173] Adding bcm2835-sdhost driver, and an overlay to +Subject: [PATCH 044/140] Adding bcm2835-sdhost driver, and an overlay to enable it BCM2835 has two SD card interfaces. This driver uses the other one. @@ -69633,7 +70097,7 @@ Signed-off-by: Phil Elwell create mode 100644 drivers/mmc/host/bcm2835-sdhost.c diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig -index d657e99b7b5a9218cd37dd529ca08eef8c681981..64bd7825131d3dcb003e7ece581b8d599a717b31 100644 +index 267a5be5b029603fcb0a30d59c9c44784b6633d9..dc41121c101e2ac6fe000fe2ab556561a340b78f 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -33,6 +33,16 @@ config MMC_BCM2835_PIO_DMA_BARRIER @@ -69654,13 +70118,13 @@ index d657e99b7b5a9218cd37dd529ca08eef8c681981..64bd7825131d3dcb003e7ece581b8d59 tristate "ARM AMBA Multimedia Card Interface support" depends on ARM_AMBA diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile -index b8815fc623d7bba9f1375778daa274febeb32769..cd3a47d8965958ccf3ac3d186a05bbd437494154 100644 +index b27b702f59ba2b473a9d4da77eb5edb0f8763f03..9ba643d3b2e12960f5ce4b0eb5d75c1c360980ce 100644 --- a/drivers/mmc/host/Makefile +++ b/drivers/mmc/host/Makefile @@ -19,6 +19,7 @@ obj-$(CONFIG_MMC_SDHCI_SIRF) += sdhci-sirf.o obj-$(CONFIG_MMC_SDHCI_F_SDH30) += sdhci_f_sdh30.o obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o - obj-$(CONFIG_MMC_BCM2835) += bcm2835-mmc.o + obj-$(CONFIG_MMC_BCM2835_MMC) += bcm2835-mmc.o +obj-$(CONFIG_MMC_BCM2835_SDHOST) += bcm2835-sdhost.o obj-$(CONFIG_MMC_WBSD) += wbsd.o obj-$(CONFIG_MMC_AU1X) += au1xmmc.o @@ -71865,10 +72329,10 @@ index 0000000000000000000000000000000000000000..9c6f199a7830959f31012d86bc1f8b1a +MODULE_LICENSE("GPL v2"); +MODULE_AUTHOR("Phil Elwell"); -From ea3ad2b086d049e17be572c35e6c5bba86ebe6e4 Mon Sep 17 00:00:00 2001 +From fa28ef9733c4e9e4587c8a9ecb2e67c13e8b64e4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 28 Oct 2016 15:36:43 +0100 -Subject: [PATCH 040/173] vc_mem: Add vc_mem driver for querying firmware +Subject: [PATCH 045/140] vc_mem: Add vc_mem driver for querying firmware memory addresses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 @@ -72393,10 +72857,10 @@ index 0000000000000000000000000000000000000000..20a475377eb3078ea1ecaef2b24efc35 + +#endif /* _VC_MEM_H */ -From 5d1c473f557525d28a8b9f4a29330f6d8b746a1f Mon Sep 17 00:00:00 2001 +From de3753e80fb6395629f1bdad616b21a761d1241d Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Tue, 22 Jul 2014 15:41:04 +0100 -Subject: [PATCH 041/173] vcsm: VideoCore shared memory service for BCM2835 +Subject: [PATCH 046/140] vcsm: VideoCore shared memory service for BCM2835 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -72445,19 +72909,32 @@ and the other VM_FAULT_SIGBUS crashing the user code. Also report when mapping fails. Signed-off-by: popcornmix + +vcsm: Provide new ioctl to clean/invalidate a 2D block + +vcsm: Convert to loading via device tree. + +Signed-off-by: Dave Stevenson + +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/Kconfig | 2 + drivers/char/Makefile | 1 + drivers/char/broadcom/Kconfig | 9 + drivers/char/broadcom/Makefile | 1 + drivers/char/broadcom/vc_sm/Makefile | 9 + - drivers/char/broadcom/vc_sm/vc_sm_defs.h | 181 ++ - drivers/char/broadcom/vc_sm/vc_sm_knl.h | 55 + - drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 499 +++++ - drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 82 + - drivers/char/broadcom/vc_sm/vmcs_sm.c | 3222 ++++++++++++++++++++++++++++++ - include/linux/broadcom/vmcs_sm_ioctl.h | 248 +++ - 11 files changed, 4309 insertions(+) + drivers/char/broadcom/vc_sm/vc_sm_defs.h | 237 ++ + drivers/char/broadcom/vc_sm/vc_sm_knl.h | 53 + + drivers/char/broadcom/vc_sm/vc_vchi_sm.c | 516 +++++ + drivers/char/broadcom/vc_sm/vc_vchi_sm.h | 102 + + drivers/char/broadcom/vc_sm/vmcs_sm.c | 3505 ++++++++++++++++++++++++++++++ + include/linux/broadcom/vmcs_sm_ioctl.h | 280 +++ + 11 files changed, 4715 insertions(+) create mode 100644 drivers/char/broadcom/vc_sm/Makefile create mode 100644 drivers/char/broadcom/vc_sm/vc_sm_defs.h create mode 100644 drivers/char/broadcom/vc_sm/vc_sm_knl.h @@ -72529,23 +73006,25 @@ index 0000000000000000000000000000000000000000..19ce263bc273dcdb24ea2b4431e4cafc + vc_vchi_sm.o diff --git a/drivers/char/broadcom/vc_sm/vc_sm_defs.h b/drivers/char/broadcom/vc_sm/vc_sm_defs.h new file mode 100644 -index 0000000000000000000000000000000000000000..c4d5ff718a5ba9071ef87fa4c6cf632486c4d36f +index 0000000000000000000000000000000000000000..de6afe9f65af45582c79a62abd41c688274ad8f2 --- /dev/null +++ b/drivers/char/broadcom/vc_sm/vc_sm_defs.h -@@ -0,0 +1,181 @@ -+/***************************************************************************** -+* 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. -+*****************************************************************************/ +@@ -0,0 +1,237 @@ ++/* ++ **************************************************************************** ++ * 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__ @@ -72554,15 +73033,16 @@ index 0000000000000000000000000000000000000000..c4d5ff718a5ba9071ef87fa4c6cf6324 +#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 + -+/* All message types supported for HOST->VC direction */ -+typedef enum { ++enum vc_sm_msg_type { ++ /* Message types supported for HOST->VC direction */ ++ + /* Allocate shared memory block */ + VC_SM_MSG_TYPE_ALLOC, + /* Lock allocated shared memory block */ @@ -72580,28 +73060,42 @@ index 0000000000000000000000000000000000000000..c4d5ff718a5ba9071ef87fa4c6cf6324 + + /* 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; ++}; + +/* 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 */ @@ -72613,126 +73107,167 @@ index 0000000000000000000000000000000000000000..c4d5ff718a5ba9071ef87fa4c6cf6324 + /* 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; + + /* 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 */ + 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) */ -+ void *res_mem; ++ 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) */ -+ void *res_mem; ++ 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) */ -+ void *res_mem; ++ uint32_t res_mem; + /* 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; + + /* Resource handle */ + uint32_t res_handle; + /* Pointer to resource buffer */ -+ void *res_mem; -+ /* Pointer to former resource buffer if the memory -+ * was reallocated */ -+ void *res_old_mem; ++ uint32_t res_mem; ++ /* ++ * Pointer to former resource buffer if the memory ++ * 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 */ ++ enum 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; -+ 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; -+ -+} VC_SM_MSG_UNION_T; ++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; ++}; + +#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 new file mode 100644 -index 0000000000000000000000000000000000000000..965f9a209a025202fea8065d3947c36f4fa43d0a +index 0000000000000000000000000000000000000000..f7f74750d8358779c61dfcd6fc841aa1789a2c5e --- /dev/null +++ b/drivers/char/broadcom/vc_sm/vc_sm_knl.h -@@ -0,0 +1,55 @@ -+/***************************************************************************** -+* 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. -+*****************************************************************************/ +@@ -0,0 +1,53 @@ ++/* ++ **************************************************************************** ++ * 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__ @@ -72742,58 +73277,56 @@ index 0000000000000000000000000000000000000000..965f9a209a025202fea8065d3947c36f +#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); + -+/* 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. -+*/ -+int vc_sm_lock(int handle, VC_SM_LOCK_CACHE_MODE_T mode, -+ long unsigned int *data); ++/* Lock a memory handle for use by kernel. */ ++int vc_sm_lock(int handle, enum vc_sm_lock_cache_mode mode, ++ unsigned long *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. -+*/ -+int vc_sm_map(int handle, unsigned int sm_addr, VC_SM_LOCK_CACHE_MODE_T mode, -+ long unsigned int *data); ++/* Map a shared memory region for use by kernel. */ ++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); + +#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 new file mode 100644 -index 0000000000000000000000000000000000000000..76abd126c4617b6310fcf0ebd7ab1d5f73a18a70 +index 0000000000000000000000000000000000000000..f8b909a09adb0743ed5d55dadf8fbf2fef055197 --- /dev/null +++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.c -@@ -0,0 +1,499 @@ -+/***************************************************************************** -+* 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. -+*****************************************************************************/ +@@ -0,0 +1,516 @@ ++/* ++ **************************************************************************** ++ * 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 @@ -72866,11 +73399,11 @@ index 0000000000000000000000000000000000000000..76abd126c4617b6310fcf0ebd7ab1d5f + +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); @@ -72892,7 +73425,7 @@ index 0000000000000000000000000000000000000000..76abd126c4617b6310fcf0ebd7ab1d5f + 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; @@ -72922,7 +73455,7 @@ index 0000000000000000000000000000000000000000..76abd126c4617b6310fcf0ebd7ab1d5f +{ + 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; @@ -73038,7 +73571,7 @@ index 0000000000000000000000000000000000000000..76abd126c4617b6310fcf0ebd7ab1d5f + } +} + -+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) +{ @@ -73108,7 +73641,8 @@ index 0000000000000000000000000000000000000000..76abd126c4617b6310fcf0ebd7ab1d5f + 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: @@ -73122,7 +73656,7 @@ index 0000000000000000000000000000000000000000..76abd126c4617b6310fcf0ebd7ab1d5f + 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; @@ -73142,6 +73676,7 @@ index 0000000000000000000000000000000000000000..76abd126c4617b6310fcf0ebd7ab1d5f + /* 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]); @@ -73156,8 +73691,8 @@ index 0000000000000000000000000000000000000000..76abd126c4617b6310fcf0ebd7ab1d5f + return -EINVAL; +} + -+int vc_vchi_sm_send_msg(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_MSG_TYPE msg_id, ++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, + uint32_t *cur_trans_id, uint8_t wait_reply) @@ -73216,7 +73751,8 @@ index 0000000000000000000000000000000000000000..76abd126c4617b6310fcf0ebd7ab1d5f + 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; + } + @@ -73227,32 +73763,34 @@ index 0000000000000000000000000000000000000000..76abd126c4617b6310fcf0ebd7ab1d5f + 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(struct sm_instance *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), + cur_trans_id, 1); +} + -+int vc_vchi_sm_free(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_FREE_T *msg, uint32_t *cur_trans_id) ++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, -+ VC_SM_LOCK_UNLOCK_T *msg, -+ VC_SM_LOCK_RESULT_T *result, uint32_t *cur_trans_id) ++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) +{ + return vc_vchi_sm_send_msg(handle, VC_SM_MSG_TYPE_LOCK, + msg, sizeof(*msg), result, sizeof(*result), + cur_trans_id, 1); +} + -+int vc_vchi_sm_unlock(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_LOCK_UNLOCK_T *msg, ++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) +{ + return vc_vchi_sm_send_msg(handle, wait_reply ? @@ -73262,43 +73800,55 @@ index 0000000000000000000000000000000000000000..76abd126c4617b6310fcf0ebd7ab1d5f + 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(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, VC_SM_ACTION_CLEAN_T *msg) ++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(struct sm_instance *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 new file mode 100644 -index 0000000000000000000000000000000000000000..5e279f5a95fac7227cea15941bf0570ddc2b0886 +index 0000000000000000000000000000000000000000..abe4ed15836f2be756083d3fdb4edb544dacc1a6 --- /dev/null +++ b/drivers/char/broadcom/vc_sm/vc_vchi_sm.h -@@ -0,0 +1,82 @@ -+/***************************************************************************** -+* 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. -+*****************************************************************************/ +@@ -0,0 +1,102 @@ ++/* ++ **************************************************************************** ++ * 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__ @@ -73307,86 +73857,106 @@ index 0000000000000000000000000000000000000000..5e279f5a95fac7227cea15941bf0570d + +#include "vc_sm_defs.h" + -+/* Forward declare. -+*/ -+typedef struct sm_instance *VC_VCHI_SM_HANDLE_T; ++/* ++ * Forward declare. ++ */ ++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, ++/* ++ * Initialize the shared memory service, opens up vchi connection to talk to it. ++ */ ++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); ++/* ++ * Terminates the shared memory service. ++ */ ++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, -+ VC_SM_ALLOC_T *alloc, -+ VC_SM_ALLOC_RESULT_T *alloc_result, uint32_t *trans_id); ++/* ++ * 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(struct sm_instance *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); ++/* ++ * 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(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, -+ VC_SM_LOCK_UNLOCK_T *lock_unlock, -+ VC_SM_LOCK_RESULT_T *lock_result, 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(struct sm_instance *handle, ++ 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, ++/* ++ * 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(struct sm_instance *handle, ++ struct 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. -+*/ -+int vc_vchi_sm_resize(VC_VCHI_SM_HANDLE_T handle, -+ VC_SM_RESIZE_T *resize, uint32_t *trans_id); ++/* ++ * 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(struct sm_instance *handle, ++ struct 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. -+*/ -+int vc_vchi_sm_walk_alloc(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(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, -+ VC_SM_ACTION_CLEAN_T *action_clean); ++/* ++ * Clean up following a previously interrupted action which left the system ++ * in a bad state of some sort. ++ */ ++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(struct sm_instance *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 new file mode 100644 -index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd4203179500 +index 0000000000000000000000000000000000000000..034ae2f27f870621af9f49453501f1cde051f32a --- /dev/null +++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c -@@ -0,0 +1,3222 @@ -+/***************************************************************************** -+* 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. -+*****************************************************************************/ +@@ -0,0 +1,3505 @@ ++/* ++ **************************************************************************** ++ * 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 ----------------------------------------------------- */ + @@ -73395,6 +73965,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +#include +#include +#include ++#include +#include +#include +#include @@ -73403,6 +73974,8 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +#include +#include +#include ++#include ++#include +#include +#include +#include @@ -73421,6 +73994,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +/* ---- 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" @@ -73431,9 +74005,8 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +#define VC_SM_DEBUG "debug" +#define VC_SM_WRITE_BUF_SIZE 128 + -+/* Statistics tracked per resource and globally. -+*/ -+enum SM_STATS_T { ++/* Statistics tracked per resource and globally. */ ++enum sm_stats_t { + /* Attempt. */ + ALLOC, + FREE, @@ -73442,6 +74015,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + MAP, + FLUSH, + INVALID, ++ IMPORT, + + END_ATTEMPT, + @@ -73453,6 +74027,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + MAP_FAIL, + FLUSH_FAIL, + INVALID_FAIL, ++ IMPORT_FAIL, + + END_ALL, + @@ -73466,38 +74041,37 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + "Map", + "Cache Flush", + "Cache Invalidate", ++ "Import", +}; + +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 */ + +}; + -+/* 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. */ ++ 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. */ ++ 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. */ ++ 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. -+*/ -+struct SM_RESOURCE_T { ++/* 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. */ + @@ -73510,49 +74084,55 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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. */ ++ 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. */ + -+ struct SM_PRIV_DATA_T *private; ++ /* 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 */ +}; + -+/* Private file data associated with each opened device. -+*/ -+struct SM_PRIV_DATA_T { ++/* Private file data associated with each opened device. */ ++struct sm_priv_data_t { + struct list_head resource_list; /* List of resources. */ + + 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. */ -+ VC_SM_MSG_TYPE int_action; /* Interrupted action. */ ++ enum vc_sm_msg_type int_action; /* Interrupted action. */ + uint32_t int_trans_id; /* Interrupted transaction. */ + +}; + -+/* Global state information. -+*/ -+struct SM_STATE_T { -+ VC_VCHI_SM_HANDLE_T sm_handle; /* Handle for videocore service. */ ++/* Global state information. */ ++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. */ + 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. */ + 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. */ + @@ -73561,7 +74141,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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. */ @@ -73570,7 +74150,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + +/* ---- Private Variables ----------------------------------------------- */ + -+static struct SM_STATE_T *sm_state; ++static struct sm_state_t *sm_state; +static int sm_inited; + +#if 0 @@ -73582,22 +74162,50 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +}; +#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 ------------------------------------------------ */ + -+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; + pfn >>= PAGE_SHIFT; + return pfn; +} + -+/* 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) ++/* ++ * 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) { + if (p_res != NULL) { @@ -73620,9 +74228,10 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + } +} + -+/* 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) +{ @@ -73634,8 +74243,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + + 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) @@ -73653,13 +74261,14 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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", @@ -73669,9 +74278,10 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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) +{ @@ -73683,8 +74293,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + + 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) @@ -73702,7 +74311,8 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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 @@ -73717,9 +74327,10 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +} + +#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) +{ @@ -73731,8 +74342,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + + 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) @@ -73750,13 +74360,14 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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", @@ -73766,9 +74377,10 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +} +#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 @@ -73782,8 +74394,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + + 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) @@ -73801,7 +74412,8 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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. + * @@ -73816,19 +74428,16 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + return addr; +} + -+/* 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) ++/* 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++; + @@ -73839,20 +74448,17 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + map->res_usr_hdl, map->res_addr); +} + -+/* 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, ++/* 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--; @@ -73866,12 +74472,13 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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; ++ struct sm_resource_t *resource = NULL; + int map_count = 0; ++ int resource_count = 0; + + if (sm_state == NULL) + return 0; @@ -73879,11 +74486,44 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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"); ++ 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++; @@ -73898,6 +74538,8 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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); + } + } + @@ -73911,8 +74553,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +{ + int ix; + -+ /* Global state tracked statistics. -+ */ ++ /* Global state tracked statistics. */ + if (sm_state != NULL) { + seq_puts(s, "\nDeceased Resources Statistics\n"); + @@ -73958,24 +74599,22 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +} + +#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; -+ struct SM_PRIV_DATA_T *file_data; -+ struct SM_RESOURCE_T *resource; ++ 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); -+ file_data = (struct SM_PRIV_DATA_T *)(p_pde->priv_data); ++ p_pde = (struct sm_pde_t *)(s->private); ++ file_data = (struct sm_priv_data_t *)(p_pde->priv_data); + + if (file_data == NULL) + return 0; + -+ /* Per process statistics. -+ */ ++ /* Per process statistics. */ + + seq_printf(s, "\nStatistics for TGID %d\n", file_data->pid); + @@ -74021,13 +74660,13 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +/* 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_RESOURCE_T *resource; ++ 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); -+ file_data = (struct SM_PRIV_DATA_T *)(p_pde->priv_data); ++ p_pde = (struct sm_pde_t *)(s->private); ++ file_data = (struct sm_priv_data_t *)(p_pde->priv_data); + + if (!file_data) + return 0; @@ -74069,9 +74708,9 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + +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); @@ -74091,11 +74730,12 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + .release = single_release, +}; + -+/* 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) ++/* ++ * 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) +{ + mutex_lock(&(sm_state->map_lock)); + list_add(&resource->resource_list, &privdata->resource_list); @@ -74107,14 +74747,15 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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. -+*/ -+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_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)); + @@ -74136,13 +74777,14 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + return ret; +} + -+/* 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) ++/* ++ * 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) +{ -+ struct SM_RESOURCE_T *resource, *ret = NULL; ++ struct sm_resource_t *resource, *ret = NULL; + + mutex_lock(&(sm_state->map_lock)); + @@ -74161,13 +74803,14 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + return ret; +} + -+/* 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 ++/* ++ * 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) +{ -+ struct SM_RESOURCE_T *resource, *ret = NULL; ++ struct sm_resource_t *resource, *ret = NULL; + + mutex_lock(&(sm_state->map_lock)); + @@ -74190,14 +74833,15 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + return ret; +} + -+/* 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) ++/* ++ * 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; ++ 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)); @@ -74214,7 +74858,8 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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, @@ -74248,11 +74893,10 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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, resource->res_base_mem ++ 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, + &private->int_trans_id); @@ -74264,27 +74908,33 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + } + } + -+ /* 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); +} + -+/* 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; @@ -74292,8 +74942,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + + 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) { @@ -74305,19 +74954,17 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + } + + mutex_unlock(&(sm_state->map_lock)); -+ -+ 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. -+*/ -+static void vmcs_sm_host_walk_alloc(struct SM_PRIV_DATA_T *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; ++ 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; @@ -74336,16 +74983,13 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + } + + mutex_unlock(&(sm_state->map_lock)); -+ -+ return; +} + -+/* Create support for private data tracking. -+*/ -+static struct SM_PRIV_DATA_T *vc_sm_create_priv_data(pid_t id) ++/* Create support for private data tracking. */ ++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); @@ -74369,7 +75013,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + } 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); + @@ -74377,7 +75021,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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); + @@ -74392,15 +75036,15 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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; @@ -74419,18 +75063,18 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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 = -+ (struct SM_PRIV_DATA_T *)file->private_data; -+ struct SM_RESOURCE_T *resource; ++ struct sm_priv_data_t *file_data = ++ (struct sm_priv_data_t *)file->private_data; ++ 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; @@ -74440,7 +75084,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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, @@ -74460,8 +75104,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + /* Remove the corresponding proc entry. */ + debugfs_remove_recursive(file_data->dir_pid); + -+ /* Terminate the private data. -+ */ ++ /* Terminate the private data. */ + kfree(file_data); + +out: @@ -74489,8 +75132,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + + 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); +} @@ -74498,30 +75140,28 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +static int vcsm_vma_fault(struct vm_fault *vmf) +{ + struct sm_mmap *map = (struct sm_mmap *)vmf->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; + -+ /* Lock the resource if necessary. -+ */ ++ /* 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; -+ 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. -+ */ ++ /* 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]++; @@ -74535,12 +75175,11 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + resource->res_stats[LOCK]++; + resource->lock_count++; + -+ /* Keep track of the new base memory. -+ */ -+ if ((lock_result.res_mem != NULL) && -+ (lock_result.res_old_mem != NULL) && ++ /* 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)) { -+ resource->res_base_mem = lock_result.res_mem; ++ resource->res_base_mem = (void *)lock_result.res_mem; + } + } + @@ -74558,9 +75197,9 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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: @@ -74575,7 +75214,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + } +} + -+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, @@ -74638,18 +75277,16 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + } 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; -+ struct SM_PRIV_DATA_T *file_data = -+ (struct SM_PRIV_DATA_T *)file->private_data; -+ struct SM_RESOURCE_T *resource = NULL; ++ 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; + -+ /* 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; @@ -74658,11 +75295,12 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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 << @@ -74677,8 +75315,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + __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); @@ -74686,8 +75323,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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__, @@ -74698,7 +75334,8 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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); @@ -74712,13 +75349,14 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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); + -+ /* 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; @@ -74732,8 +75370,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + + 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); + } + @@ -74752,6 +75389,22 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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: @@ -74760,20 +75413,27 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + return ret; +} + -+/* Allocate a shared memory handle and block. -+*/ -+int vc_sm_ioctl_alloc(struct SM_PRIV_DATA_T *private, ++/* Allocate a shared memory handle and block. */ ++int vc_sm_ioctl_alloc(struct sm_priv_data_t *private, + struct vmcs_sm_ioctl_alloc *ioparam) +{ + int ret = 0; + int status; -+ struct SM_RESOURCE_T *resource; -+ VC_SM_ALLOC_T alloc = { 0 }; -+ VC_SM_ALLOC_RESULT_T result = { 0 }; ++ 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; ++ 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; @@ -74795,8 +75455,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + __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; @@ -74806,8 +75465,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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) { @@ -74817,7 +75475,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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; @@ -74825,15 +75483,16 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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 = result.res_mem; ++ resource->res_base_mem = (void *)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 ++ /* ++ * 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. + */ @@ -74865,12 +75524,11 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + return ret; +} + -+/* Share an allocate memory handle and block. -+*/ -+int vc_sm_ioctl_alloc_share(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, + 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__, @@ -74882,8 +75540,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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", @@ -74895,8 +75552,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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; @@ -74930,12 +75586,11 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + return ret; +} + -+/* Free a previously allocated shared memory handle and block. -+*/ -+static int vc_sm_ioctl_free(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, + 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) { @@ -74944,8 +75599,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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); @@ -74958,18 +75612,16 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + return 0; +} + -+/* Resize a previously allocated shared memory handle and block. -+*/ -+static int vc_sm_ioctl_resize(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, + struct vmcs_sm_ioctl_resize *ioparam) +{ + int ret = 0; + int status; -+ VC_SM_RESIZE_T resize; -+ struct SM_RESOURCE_T *resource; ++ 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", @@ -74978,9 +75630,10 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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", @@ -74989,8 +75642,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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); @@ -75006,14 +75658,14 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + } + + 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. -+ */ ++ /* Resize the videocore allocated resource. */ + status = vc_vchi_sm_resize(sm_state->sm_handle, &resize, + &private->int_trans_id); + if (status == -EINTR) { @@ -75023,7 +75675,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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; @@ -75034,8 +75686,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + __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; + @@ -75046,33 +75697,30 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + return ret; +} + -+/* Lock a previously allocated shared memory handle and block. -+*/ -+static int vc_sm_ioctl_lock(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, + struct vmcs_sm_ioctl_lock_unlock *ioparam, + int change_cache, enum vmcs_sm_cache_e cache_type, + unsigned int vc_addr) +{ + int status; -+ VC_SM_LOCK_UNLOCK_T lock; -+ VC_SM_LOCK_RESULT_T result; -+ struct SM_RESOURCE_T *resource; ++ 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; -+ long unsigned int phys_addr; ++ unsigned long phys_addr; + + 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); @@ -75081,17 +75729,15 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + } + + 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. -+ */ ++ /* 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. -+ */ ++ /* Lock the videocore allocated resource. */ + status = vc_vchi_sm_lock(sm_state->sm_handle, &lock, &result, + &private->int_trans_id); + if (status == -EINTR) { @@ -75101,8 +75747,8 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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; @@ -75111,27 +75757,24 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + } + + 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. -+ */ ++ /* 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) && -+ (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. -+ */ ++ /* Kernel allocated resources. */ + if (resource->pid == 0) { + if (!list_empty(&resource->map_list)) { + list_for_each_entry_safe(map, map_tmp, @@ -75163,8 +75806,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + __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); @@ -75183,7 +75825,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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); @@ -75192,7 +75834,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + __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); + @@ -75221,30 +75863,27 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + return ret; +} + -+/* Unlock a previously allocated shared memory handle and block. -+*/ -+static int vc_sm_ioctl_unlock(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, + struct vmcs_sm_ioctl_lock_unlock *ioparam, + 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; ++ struct sm_resource_t *resource; + int ret = 0; + + 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); @@ -75253,17 +75892,18 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + } + + 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. -+ */ ++ /* User space allocated resources. */ + if (resource->pid) { + /* Flush if requested */ + if (resource->res_cached && flush) { + dma_addr_t phys_addr = 0; ++ + resource->res_stats[FLUSH]++; + + phys_addr = @@ -75278,6 +75918,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + if (map->vma) { + unsigned long start; + unsigned long end; ++ + start = map->vma->vm_start; + end = map->vma->vm_end; + @@ -75320,7 +75961,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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; @@ -75356,12 +75997,10 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + } + + 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, @@ -75391,7 +76030,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + } + + 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: @@ -75401,14 +76040,143 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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) +{ + 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_RESOURCE_T *resource = NULL; ++ 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. */ + if ((sm_state == NULL) || (file_data == NULL)) { @@ -75422,7 +76190,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + + /* 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, @@ -75436,8 +76204,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + file_data->restart_sys = 0; + } + -+ /* Now process the command. -+ */ ++ /* Now process the command. */ + switch (cmdnr) { + /* New memory allocation. + */ @@ -75445,8 +76212,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + { + 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", @@ -75468,20 +76234,17 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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", @@ -75492,8 +76255,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + + 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) { @@ -75506,21 +76268,50 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + ret = -EFAULT; + } + -+ /* Done. -+ */ ++ /* Done. */ + goto out; + } + break; + -+ /* Lock (attempt to) *and* register a cache behavior change. -+ */ ++ 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: + { + 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", @@ -75534,20 +76325,17 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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", @@ -75558,8 +76346,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + + 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", @@ -75567,20 +76354,17 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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", @@ -75591,20 +76375,17 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + + 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", @@ -75615,17 +76396,13 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + + 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; @@ -75670,7 +76447,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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: @@ -75709,7 +76486,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + { + 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", @@ -75766,8 +76543,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + { + 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", @@ -75782,7 +76558,8 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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) || @@ -75808,8 +76585,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + ret = -EFAULT; + } + -+ /* Done. -+ */ ++ /* Done. */ + goto out; + } + break; @@ -75888,8 +76664,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + ret = -EFAULT; + } + -+ /* Done. -+ */ ++ /* Done. */ + goto out; + } + break; @@ -75971,8 +76746,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + } + 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; @@ -76075,8 +76849,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + goto out; + } + -+ /* Locate resource from GUID. -+ */ ++ /* Locate resource from GUID. */ + resource = + vmcs_sm_acquire_resource(file_data, ioparam.handle); + @@ -76112,8 +76885,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + if (resource) + vmcs_sm_release_resource(resource, 0); + -+ /* Done. -+ */ ++ /* Done. */ + goto out; + } + break; @@ -76132,40 +76904,92 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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); -+ resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID:FLUSH]++; ++ 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); + -+ /* 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; -+ } ++ resource->res_stats[ioparam.s[i].cmd == 1 ? INVALID : FLUSH]++; + -+ if (resource) -+ vmcs_sm_release_resource(resource, 0); ++ /* 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; + } + } + } + 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 = kmalloc(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; 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]; ++ ++ if ((op->invalidate_mode & ~3) != 0) { ++ ret = -EINVAL; ++ break; ++ } ++ ++ if (op_fn == 0) ++ continue; ++ ++ 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); ++ } ++ break; + + default: + { @@ -76179,8 +77003,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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, @@ -76189,8 +77012,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + .mmap = vc_sm_mmap, +}; + -+/* Creation of device. -+*/ ++/* Creation of device. */ +static int vc_sm_create_sharedmemory(void) +{ + int ret; @@ -76200,8 +77022,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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__); @@ -76209,8 +77030,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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) { @@ -76225,8 +77045,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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), @@ -76251,25 +77070,21 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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; @@ -76288,20 +77103,9 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + + 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. ++ /* ++ * Initialize and create a VCHI connection for the shared memory service ++ * running on videocore. + */ + ret = vchi_initialise(&vchi_instance); + if (ret != 0) { @@ -76344,12 +77148,12 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + + 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. */ @@ -76374,8 +77178,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + goto err_remove_shared_memory; + } + -+ /* Done! -+ */ ++ /* Done! */ + sm_inited = 1; + goto out; + @@ -76392,49 +77195,53 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +} + +/* 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) { -+ /* 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); + } + + pr_debug("[%s]: end\n", __func__); ++ return 0; +} + +#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; -+ struct SM_RESOURCE_T *resource; ++ 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; @@ -76455,8 +77262,7 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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; @@ -76467,22 +77273,19 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +} +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; ++ 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; @@ -76493,14 +77296,12 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +} +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; @@ -76510,16 +77311,14 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +} +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) ++/* Lock a memory handle for use by kernel. */ ++int vc_sm_lock(int handle, enum vc_sm_lock_cache_mode mode, ++ unsigned long *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; @@ -76540,14 +77339,12 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +} +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; @@ -76559,16 +77356,14 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 +} +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) ++/* Map a shared memory region for use by kernel. */ ++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; + -+ /* 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; @@ -76588,20 +77383,76 @@ index 0000000000000000000000000000000000000000..fd2ca788dcd56b1702454d71b7bedd42 + 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 + -+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"); +MODULE_LICENSE("GPL v2"); diff --git a/include/linux/broadcom/vmcs_sm_ioctl.h b/include/linux/broadcom/vmcs_sm_ioctl.h new file mode 100644 -index 0000000000000000000000000000000000000000..334f36d0d697b047df2922b5f2db67f38cf76564 +index 0000000000000000000000000000000000000000..b75729d762f25aace133f7a008633b4094ae2de2 --- /dev/null +++ b/include/linux/broadcom/vmcs_sm_ioctl.h -@@ -0,0 +1,248 @@ +@@ -0,0 +1,280 @@ +/***************************************************************************** +* Copyright 2011 Broadcom Corporation. All rights reserved. +* @@ -76666,8 +77517,11 @@ index 0000000000000000000000000000000000000000..334f36d0d697b047df2922b5f2db67f3 + VMCS_SM_CMD_HOST_WALK_PID_MAP, + + 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 @@ -76779,6 +77633,28 @@ index 0000000000000000000000000000000000000000..334f36d0d697b047df2922b5f2db67f3 + } 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]; ++}; ++ ++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,\ @@ -76810,6 +77686,9 @@ index 0000000000000000000000000000000000000000..334f36d0d697b047df2922b5f2db67f3 +#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,\ @@ -76845,16 +77724,20 @@ index 0000000000000000000000000000000000000000..334f36d0d697b047df2922b5f2db67f3 + _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 ---------------------------------------------- */ + +#endif /* __VMCS_SM_IOCTL_H__INCLUDED__ */ -From 7b75205c2cd9672a52e657b0075ffa7355bf5093 Mon Sep 17 00:00:00 2001 +From 2a1298a2412032b281b243c87048e2f0ba3b451a Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Fri, 21 Aug 2015 23:14:48 +0100 -Subject: [PATCH 042/173] Add /dev/gpiomem device for rootless user GPIO access +Subject: [PATCH 047/140] Add /dev/gpiomem device for rootless user GPIO access Signed-off-by: Luke Wren @@ -77162,10 +78045,10 @@ index 0000000000000000000000000000000000000000..f5e7f1ba8fb6f18dee77fad06a17480c +MODULE_DESCRIPTION("gpiomem driver for accessing GPIO from userspace"); +MODULE_AUTHOR("Luke Wren "); -From 2c20cabf60049a431c4946d2c8bbbd940dc43355 Mon Sep 17 00:00:00 2001 +From 7a1b32b10f7370ed22a0e9cae747668d06ed74ae Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Sat, 5 Sep 2015 01:14:45 +0100 -Subject: [PATCH 043/173] Add SMI driver +Subject: [PATCH 048/140] Add SMI driver Signed-off-by: Luke Wren --- @@ -79116,10 +79999,10 @@ index 0000000000000000000000000000000000000000..ee3a75edfc033eeb0d90a687ffb68b10 + +#endif /* BCM2835_SMI_H */ -From 674631fb6af7dc61e7c2d2d9b50d96e29b46a72a Mon Sep 17 00:00:00 2001 +From 38b5823e839dc18067c264cfd23073ce98aa5fdb Mon Sep 17 00:00:00 2001 From: Martin Sperl Date: Tue, 26 Apr 2016 14:59:21 +0000 -Subject: [PATCH 044/173] MISC: bcm2835: smi: use clock manager and fix reload +Subject: [PATCH 049/140] MISC: bcm2835: smi: use clock manager and fix reload issues Use clock manager instead of self-made clockmanager. @@ -79289,10 +80172,10 @@ index 63a4ea08b9930a3a31a985f0a1d969b488ed49ec..1261540703127d1d63b9f3c87042c6e5 return 0; } -From 437fba9ae6f282ea8d2fd7e568358f529640e222 Mon Sep 17 00:00:00 2001 +From 893e7ebc479745718ee41edb9d49b2da2d04d198 Mon Sep 17 00:00:00 2001 From: Luke Wren Date: Sat, 5 Sep 2015 01:16:10 +0100 -Subject: [PATCH 045/173] Add SMI NAND driver +Subject: [PATCH 050/140] Add SMI NAND driver Signed-off-by: Luke Wren --- @@ -79657,10 +80540,10 @@ index 0000000000000000000000000000000000000000..02adda6da18bd0ba9ab19a104975b79d + ("Driver for NAND chips using Broadcom Secondary Memory Interface"); +MODULE_AUTHOR("Luke Wren "); -From 2ac4a21d9ef42dd54a9e532cffef4cac2ee31750 Mon Sep 17 00:00:00 2001 +From b4a7c152d73c353b50086d7edb7406be3000cd7b Mon Sep 17 00:00:00 2001 From: Aron Szabo Date: Sat, 16 Jun 2012 12:15:55 +0200 -Subject: [PATCH 046/173] lirc: added support for RaspberryPi GPIO +Subject: [PATCH 051/140] 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 @@ -80520,17 +81403,22 @@ index 0000000000000000000000000000000000000000..fb69624ccef00ddbdccf8256d6baf1b1 + +#endif -From 751fe8b7692ced63db9d9e88a5e079ca9f3f632b Mon Sep 17 00:00:00 2001 +From 2d1050f4cd8b26845e015aed37f84077861790b2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 3 Jul 2013 00:49:20 +0100 -Subject: [PATCH 047/173] Add cpufreq driver +Subject: [PATCH 052/140] Add cpufreq driver Signed-off-by: popcornmix + +bcm2835-cpufreq: Change licence to GPLv2 + +Signed-off-by: Eben Upton +Signed-off-by: Dom Cobley --- drivers/cpufreq/Kconfig.arm | 9 ++ drivers/cpufreq/Makefile | 1 + - drivers/cpufreq/bcm2835-cpufreq.c | 218 ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 228 insertions(+) + drivers/cpufreq/bcm2835-cpufreq.c | 210 ++++++++++++++++++++++++++++++++++++++ + 3 files changed, 220 insertions(+) create mode 100644 drivers/cpufreq/bcm2835-cpufreq.c diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm @@ -80567,32 +81455,24 @@ index ab3a42cd29ef210bcf0cad2ee48c74cb954b14f2..f81761612a9bef474090a868305bb86e obj-$(CONFIG_ARM_TEGRA186_CPUFREQ) += tegra186-cpufreq.o diff --git a/drivers/cpufreq/bcm2835-cpufreq.c b/drivers/cpufreq/bcm2835-cpufreq.c new file mode 100644 -index 0000000000000000000000000000000000000000..414fbdc10dfbfc6e4bb47870a7af3fd5780f9c9a +index 0000000000000000000000000000000000000000..99345969b0e4d651fd9033d67de2febb13fc0892 --- /dev/null +++ b/drivers/cpufreq/bcm2835-cpufreq.c -@@ -0,0 +1,218 @@ -+/***************************************************************************** -+* 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. -+*****************************************************************************/ -+ -+/***************************************************************************** -+* FILENAME: bcm2835-cpufreq.h -+* DESCRIPTION: This driver dynamically manages the CPU Frequency of the ARM -+* processor. Messages are sent to Videocore either setting or requesting the -+* frequency of the ARM in order to match an appropiate frequency to the current -+* usage of the processor. The policy which selects the frequency to use is -+* defined in the kernel .config file, but can be changed during runtime. -+*****************************************************************************/ +@@ -0,0 +1,210 @@ ++/* ++ * Copyright 2011 Broadcom Corporation. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * as published by the Free Software Foundation; version 2 ++ * of the License. ++ * ++ * This driver dynamically manages the CPU Frequency of the ARM ++ * processor. Messages are sent to Videocore either setting or requesting the ++ * frequency of the ARM in order to match an appropiate frequency to the current ++ * usage of the processor. The policy which selects the frequency to use is ++ * defined in the kernel .config file, but can be changed during runtime. ++ */ + +/* ---------- INCLUDES ---------- */ +#include @@ -80790,10 +81670,10 @@ index 0000000000000000000000000000000000000000..414fbdc10dfbfc6e4bb47870a7af3fd5 +module_init(bcm2835_cpufreq_module_init); +module_exit(bcm2835_cpufreq_module_exit); -From 5ce7c9c8296f76830f0674046a97234e5a8c66e4 Mon Sep 17 00:00:00 2001 +From f4e57386232d104bb8ba8e791c7ae9b479fe540e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 17 Jun 2015 15:44:08 +0100 -Subject: [PATCH 048/173] Add Chris Boot's i2c driver +Subject: [PATCH 053/140] Add Chris Boot's i2c driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -81458,10 +82338,10 @@ index 0000000000000000000000000000000000000000..962f2e5c7455d91bf32925d785f5f16b +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:" DRV_NAME); -From 15fbd36ded7f781a25e607281877489e64d157b9 Mon Sep 17 00:00:00 2001 +From 871a760603c56511f1ca2a9c399ea2fec70869c9 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/173] char: broadcom: Add vcio module +Subject: [PATCH 054/140] char: broadcom: Add vcio module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -81686,10 +82566,10 @@ index 0000000000000000000000000000000000000000..c19bc2075c77879563ef5e59038b5a14 +MODULE_DESCRIPTION("Mailbox userspace access"); +MODULE_LICENSE("GPL"); -From 4d25c2b0be3edd7396a0b22a2e793c32a31e9f49 Mon Sep 17 00:00:00 2001 +From 2951a142ab1051bf124ac0709c068079576c2082 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/173] firmware: bcm2835: Support ARCH_BCM270x +Subject: [PATCH 055/140] firmware: bcm2835: Support ARCH_BCM270x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -81772,10 +82652,10 @@ index dd506cd3a5b874f9e1acd07efb8cd151bb6145d1..3f070bd38a91511c986e3fb114b15bd4 MODULE_AUTHOR("Eric Anholt "); MODULE_DESCRIPTION("Raspberry Pi firmware driver"); -From 121799ce3c68fd5c4982dab632114b83ef46f27d Mon Sep 17 00:00:00 2001 +From 4ddb6a04d7accb78b8f72ac03c5b3717a5f6b2ca Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Mon, 11 May 2015 09:00:42 +0100 -Subject: [PATCH 051/173] scripts: Add mkknlimg and knlinfo scripts from tools +Subject: [PATCH 056/140] scripts: Add mkknlimg and knlinfo scripts from tools repo The Raspberry Pi firmware looks for a trailer on the kernel image to @@ -82302,10 +83182,10 @@ index 0000000000000000000000000000000000000000..84be2593ec1de8f97b0167ff06b3e05d + return $trailer; +} -From a5e82c204eb88de5fa9f1ea33cf39bf57f28c09b Mon Sep 17 00:00:00 2001 +From 41c99cc7a7409f9c6e557c2ded1f97f70ce86d7d Mon Sep 17 00:00:00 2001 From: notro Date: Wed, 9 Jul 2014 14:46:08 +0200 -Subject: [PATCH 052/173] BCM2708: Add core Device Tree support +Subject: [PATCH 057/140] BCM2708: Add core Device Tree support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @@ -82505,12 +83385,12 @@ Signed-off-by: Phil Elwell arch/arm/Makefile | 2 + arch/arm/boot/.gitignore | 2 +- arch/arm/boot/dts/Makefile | 20 + - arch/arm/boot/dts/bcm2708-rpi-0-w.dts | 162 +++ + arch/arm/boot/dts/bcm2708-rpi-0-w.dts | 162 ++ arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 122 ++ arch/arm/boot/dts/bcm2708-rpi-b.dts | 112 ++ arch/arm/boot/dts/bcm2708-rpi-cm.dts | 95 ++ arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 17 + - arch/arm/boot/dts/bcm2708-rpi.dtsi | 174 +++ + arch/arm/boot/dts/bcm2708-rpi.dtsi | 162 ++ arch/arm/boot/dts/bcm2708.dtsi | 20 + arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 122 ++ arch/arm/boot/dts/bcm2709.dtsi | 22 + @@ -82519,8 +83399,8 @@ Signed-off-by: Phil Elwell arch/arm/boot/dts/bcm2710-rpi-cm3.dts | 129 ++ arch/arm/boot/dts/bcm2710.dtsi | 148 ++ arch/arm/boot/dts/bcm283x.dtsi | 13 +- - arch/arm/boot/dts/overlays/Makefile | 118 ++ - arch/arm/boot/dts/overlays/README | 1517 ++++++++++++++++++++ + arch/arm/boot/dts/overlays/Makefile | 125 ++ + arch/arm/boot/dts/overlays/README | 1620 ++++++++++++++++++++ .../arm/boot/dts/overlays/adau1977-adc-overlay.dts | 40 + .../boot/dts/overlays/adau7002-simple-overlay.dts | 52 + arch/arm/boot/dts/overlays/ads1015-overlay.dts | 98 ++ @@ -82528,6 +83408,7 @@ Signed-off-by: Phil Elwell arch/arm/boot/dts/overlays/ads7846-overlay.dts | 89 ++ .../dts/overlays/akkordion-iqdacplus-overlay.dts | 49 + .../allo-boss-dac-pcm512x-audio-overlay.dts | 59 + + .../arm/boot/dts/overlays/allo-digione-overlay.dts | 44 + .../allo-piano-dac-pcm512x-audio-overlay.dts | 54 + .../allo-piano-dac-plus-pcm512x-audio-overlay.dts | 55 + arch/arm/boot/dts/overlays/at86rf233-overlay.dts | 57 + @@ -82545,9 +83426,11 @@ Signed-off-by: Phil Elwell arch/arm/boot/dts/overlays/enc28j60-overlay.dts | 53 + .../boot/dts/overlays/enc28j60-spi2-overlay.dts | 47 + arch/arm/boot/dts/overlays/fe-pi-audio-overlay.dts | 70 + + arch/arm/boot/dts/overlays/goodix-overlay.dts | 46 + .../overlays/googlevoicehat-soundcard-overlay.dts | 49 + arch/arm/boot/dts/overlays/gpio-ir-overlay.dts | 44 + .../boot/dts/overlays/gpio-poweroff-overlay.dts | 34 + + .../boot/dts/overlays/gpio-shutdown-overlay.dts | 80 + .../boot/dts/overlays/hifiberry-amp-overlay.dts | 39 + .../boot/dts/overlays/hifiberry-dac-overlay.dts | 34 + .../dts/overlays/hifiberry-dacplus-overlay.dts | 59 + @@ -82559,10 +83442,11 @@ Signed-off-by: Phil Elwell arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts | 43 + arch/arm/boot/dts/overlays/i2c-mux-overlay.dts | 139 ++ .../boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts | 26 + - arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts | 83 ++ - arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts | 49 + + .../arm/boot/dts/overlays/i2c-rtc-gpio-overlay.dts | 183 +++ + arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts | 164 ++ + arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts | 142 ++ .../arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts | 61 + - .../arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts | 37 + + .../arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts | 34 + .../boot/dts/overlays/i2s-gpio28-31-overlay.dts | 18 + arch/arm/boot/dts/overlays/iqaudio-dac-overlay.dts | 46 + .../boot/dts/overlays/iqaudio-dacplus-overlay.dts | 49 + @@ -82571,12 +83455,14 @@ Signed-off-by: Phil Elwell .../boot/dts/overlays/justboom-digi-overlay.dts | 41 + arch/arm/boot/dts/overlays/lirc-rpi-overlay.dts | 57 + arch/arm/boot/dts/overlays/mcp23017-overlay.dts | 54 + - arch/arm/boot/dts/overlays/mcp23s17-overlay.dts | 732 ++++++++++ + arch/arm/boot/dts/overlays/mcp23s17-overlay.dts | 732 +++++++++ .../arm/boot/dts/overlays/mcp2515-can0-overlay.dts | 73 + .../arm/boot/dts/overlays/mcp2515-can1-overlay.dts | 73 + arch/arm/boot/dts/overlays/mcp3008-overlay.dts | 205 +++ arch/arm/boot/dts/overlays/midi-uart0-overlay.dts | 36 + + arch/arm/boot/dts/overlays/midi-uart1-overlay.dts | 43 + arch/arm/boot/dts/overlays/mmc-overlay.dts | 39 + + arch/arm/boot/dts/overlays/mpu6050-overlay.dts | 28 + arch/arm/boot/dts/overlays/mz61581-overlay.dts | 117 ++ arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts | 27 + .../boot/dts/overlays/pi3-disable-bt-overlay.dts | 46 + @@ -82594,6 +83480,7 @@ Signed-off-by: Phil Elwell arch/arm/boot/dts/overlays/pwm-overlay.dts | 43 + arch/arm/boot/dts/overlays/qca7000-overlay.dts | 52 + arch/arm/boot/dts/overlays/raspidac3-overlay.dts | 49 + + .../boot/dts/overlays/rotary-encoder-overlay.dts | 43 + .../boot/dts/overlays/rpi-backlight-overlay.dts | 21 + .../dts/overlays/rpi-cirrus-wm5102-overlay.dts | 146 ++ arch/arm/boot/dts/overlays/rpi-dac-overlay.dts | 34 + @@ -82618,10 +83505,10 @@ Signed-off-by: Phil Elwell arch/arm/boot/dts/overlays/spi0-hw-cs-overlay.dts | 26 + arch/arm/boot/dts/overlays/spi1-1cs-overlay.dts | 57 + arch/arm/boot/dts/overlays/spi1-2cs-overlay.dts | 69 + - arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts | 81 ++ + arch/arm/boot/dts/overlays/spi1-3cs-overlay.dts | 81 + arch/arm/boot/dts/overlays/spi2-1cs-overlay.dts | 57 + arch/arm/boot/dts/overlays/spi2-2cs-overlay.dts | 69 + - arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts | 81 ++ + arch/arm/boot/dts/overlays/spi2-3cs-overlay.dts | 81 + arch/arm/boot/dts/overlays/tinylcd35-overlay.dts | 224 +++ arch/arm/boot/dts/overlays/uart1-overlay.dts | 38 + .../arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts | 89 ++ @@ -82632,7 +83519,7 @@ Signed-off-by: Phil Elwell arch/arm/boot/dts/overlays/wittypi-overlay.dts | 44 + scripts/Makefile.dtbinst | 8 +- scripts/Makefile.lib | 11 + - 130 files changed, 10133 insertions(+), 6 deletions(-) + 137 files changed, 10869 insertions(+), 6 deletions(-) create mode 100644 arch/arm/boot/dts/bcm2708-rpi-0-w.dts create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b-plus.dts create mode 100644 arch/arm/boot/dts/bcm2708-rpi-b.dts @@ -82655,6 +83542,7 @@ Signed-off-by: Phil Elwell create mode 100644 arch/arm/boot/dts/overlays/ads7846-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/akkordion-iqdacplus-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/allo-boss-dac-pcm512x-audio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/allo-digione-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/allo-piano-dac-pcm512x-audio-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/allo-piano-dac-plus-pcm512x-audio-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/at86rf233-overlay.dts @@ -82672,9 +83560,11 @@ Signed-off-by: Phil Elwell create mode 100644 arch/arm/boot/dts/overlays/enc28j60-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/fe-pi-audio-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/goodix-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/googlevoicehat-soundcard-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/gpio-ir-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/gpio-poweroff-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/gpio-shutdown-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dac-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/hifiberry-dacplus-overlay.dts @@ -82686,6 +83576,7 @@ Signed-off-by: Phil Elwell create mode 100644 arch/arm/boot/dts/overlays/i2c-gpio-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/i2c-mux-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/i2c-pwm-pca9685a-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/i2c-rtc-gpio-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts @@ -82703,7 +83594,9 @@ Signed-off-by: Phil Elwell create mode 100644 arch/arm/boot/dts/overlays/mcp2515-can1-overlay.dts create mode 100755 arch/arm/boot/dts/overlays/mcp3008-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/midi-uart0-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/midi-uart1-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/mmc-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/mpu6050-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/mz61581-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/pi3-act-led-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/pi3-disable-bt-overlay.dts @@ -82721,6 +83614,7 @@ Signed-off-by: Phil Elwell create mode 100644 arch/arm/boot/dts/overlays/pwm-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/qca7000-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/raspidac3-overlay.dts + create mode 100644 arch/arm/boot/dts/overlays/rotary-encoder-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/rpi-cirrus-wm5102-overlay.dts create mode 100644 arch/arm/boot/dts/overlays/rpi-dac-overlay.dts @@ -83362,10 +84256,10 @@ index 0000000000000000000000000000000000000000..d0299e3d9a09ddcdad80cb0957b30b14 +}; diff --git a/arch/arm/boot/dts/bcm2708-rpi.dtsi b/arch/arm/boot/dts/bcm2708-rpi.dtsi new file mode 100644 -index 0000000000000000000000000000000000000000..29dde110e769082a24640d3c7284afb8e99b226c +index 0000000000000000000000000000000000000000..f88b844f0aff82742966fd820f6f69cf25c2dfab --- /dev/null +++ b/arch/arm/boot/dts/bcm2708-rpi.dtsi -@@ -0,0 +1,174 @@ +@@ -0,0 +1,162 @@ +/* Downstream version of bcm2835-rpi.dtsi */ + +#include @@ -83442,6 +84336,12 @@ index 0000000000000000000000000000000000000000..29dde110e769082a24640d3c7284afb8 + firmware = <&firmware>; + }; + ++ vcsm: vcsm { ++ compatible = "raspberrypi,bcm2835-vcsm"; ++ firmware = <&firmware>; ++ status = "okay"; ++ }; ++ + thermal: thermal@7e212000 { + #thermal-sensor-cells = <0>; + status = "okay"; @@ -83458,30 +84358,6 @@ index 0000000000000000000000000000000000000000..29dde110e769082a24640d3c7284afb8 + sound: sound { + status = "disabled"; + }; -+ -+ thermal-zones { -+ cpu_thermal: cpu-thermal { -+ polling-delay-passive = <0>; -+ polling-delay = <1000>; -+ -+ thermal-sensors = <&thermal>; -+ -+ /* No trips -+ trips { -+ cpu-crit { -+ temperature = <80000>; -+ hysteresis = <0>; -+ type = "critical"; -+ }; -+ }; -+ */ -+ -+ coefficients = <(-538) 407000>; -+ -+ cooling-maps { -+ }; -+ }; -+ }; + }; + + __overrides__ { @@ -83540,6 +84416,12 @@ index 0000000000000000000000000000000000000000..29dde110e769082a24640d3c7284afb8 +&fb { + status = "okay"; +}; ++ ++&cpu_thermal { ++ coefficients = <(-538) 407000>; ++ ++ /delete-node/ trips; ++}; diff --git a/arch/arm/boot/dts/bcm2708.dtsi b/arch/arm/boot/dts/bcm2708.dtsi new file mode 100644 index 0000000000000000000000000000000000000000..756bd3687b488da98f749b27ddfe098693990045 @@ -84411,10 +85293,10 @@ index 431dcfc900c024d85a88231d1df007916dafdfeb..6a119d30c5f8c2d13deacea646af8c30 #size-cells = <0>; diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile new file mode 100644 -index 0000000000000000000000000000000000000000..e2f66a55dc5afe13d690c2c17827054ac94b7168 +index 0000000000000000000000000000000000000000..c50b1dfa9d7334df47ce087f9d2a7a816afa05ba --- /dev/null +++ b/arch/arm/boot/dts/overlays/Makefile -@@ -0,0 +1,118 @@ +@@ -0,0 +1,125 @@ +# Overlays for the Raspberry Pi platform + +dtbo-$(CONFIG_ARCH_BCM2835) += \ @@ -84425,6 +85307,7 @@ index 0000000000000000000000000000000000000000..e2f66a55dc5afe13d690c2c17827054a + ads7846.dtbo \ + akkordion-iqdacplus.dtbo \ + allo-boss-dac-pcm512x-audio.dtbo \ ++ allo-digione.dtbo \ + allo-piano-dac-pcm512x-audio.dtbo \ + allo-piano-dac-plus-pcm512x-audio.dtbo \ + at86rf233.dtbo \ @@ -84442,9 +85325,11 @@ index 0000000000000000000000000000000000000000..e2f66a55dc5afe13d690c2c17827054a + enc28j60.dtbo \ + enc28j60-spi2.dtbo \ + fe-pi-audio.dtbo \ ++ goodix.dtbo \ + googlevoicehat-soundcard.dtbo \ + gpio-ir.dtbo \ + gpio-poweroff.dtbo \ ++ gpio-shutdown.dtbo \ + hifiberry-amp.dtbo \ + hifiberry-dac.dtbo \ + hifiberry-dacplus.dtbo \ @@ -84457,6 +85342,7 @@ index 0000000000000000000000000000000000000000..e2f66a55dc5afe13d690c2c17827054a + i2c-mux.dtbo \ + i2c-pwm-pca9685a.dtbo \ + i2c-rtc.dtbo \ ++ i2c-rtc-gpio.dtbo \ + i2c-sensor.dtbo \ + i2c0-bcm2708.dtbo \ + i2c1-bcm2708.dtbo \ @@ -84473,7 +85359,9 @@ index 0000000000000000000000000000000000000000..e2f66a55dc5afe13d690c2c17827054a + mcp2515-can1.dtbo \ + mcp3008.dtbo \ + midi-uart0.dtbo \ ++ midi-uart1.dtbo \ + mmc.dtbo \ ++ mpu6050.dtbo \ + mz61581.dtbo \ + pi3-act-led.dtbo \ + pi3-disable-bt.dtbo \ @@ -84491,6 +85379,7 @@ index 0000000000000000000000000000000000000000..e2f66a55dc5afe13d690c2c17827054a + pwm-2chan.dtbo \ + qca7000.dtbo \ + raspidac3.dtbo \ ++ rotary-encoder.dtbo \ + rpi-backlight.dtbo \ + rpi-cirrus-wm5102.dtbo \ + rpi-dac.dtbo \ @@ -84535,10 +85424,10 @@ index 0000000000000000000000000000000000000000..e2f66a55dc5afe13d690c2c17827054a +clean-files := *.dtbo diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README new file mode 100644 -index 0000000000000000000000000000000000000000..e2a803e5180cf78d67b6723cfd2f6d3b2b54e53b +index 0000000000000000000000000000000000000000..e6d777a601c91d192bc5713f9a73e1a2d4d708ef --- /dev/null +++ b/arch/arm/boot/dts/overlays/README -@@ -0,0 +1,1517 @@ +@@ -0,0 +1,1620 @@ +Introduction +============ + @@ -84828,6 +85717,12 @@ index 0000000000000000000000000000000000000000..e2a803e5180cf78d67b6723cfd2f6d3b + slave" + + ++Name: allo-digione ++Info: Configures the Allo Digione audio card ++Load: dtoverlay=allo-digione ++Params: ++ ++ +Name: allo-piano-dac-pcm512x-audio +Info: Configures the Allo Piano DAC (2.0/2.1) audio cards. + (NB. This initial support is for 2.0 channel audio ONLY! ie. stereo. @@ -85000,6 +85895,14 @@ index 0000000000000000000000000000000000000000..e2a803e5180cf78d67b6723cfd2f6d3b +Params: + + ++Name: goodix ++Info: Enables I2C connected Goodix gt9271 multiple touch controller using ++ GPIOs 4 and 17 (pins 7 and 11 on GPIO header) for interrupt and reset. ++Load: dtoverlay=goodix,= ++Params: interrupt GPIO used for interrupt (default 4) ++ reset GPIO used for reset (default 17) ++ ++ +Name: googlevoicehat-soundcard +Info: Configures the Google voiceHAT soundcard +Load: dtoverlay=googlevoicehat-soundcard @@ -85035,6 +85938,38 @@ index 0000000000000000000000000000000000000000..e2a803e5180cf78d67b6723cfd2f6d3b + will also cause the pin to go low. + + ++Name: gpio-shutdown ++Info: Initiates a shutdown when GPIO pin changes. The given GPIO pin ++ is configured as an input key that generates KEY_POWER events. ++ This event is handled by systemd-logind by initiating a ++ shutdown. Systemd versions older than 225 need an udev rule ++ enable listening to the input device: ++ ++ ACTION!="REMOVE", SUBSYSTEM=="input", KERNEL=="event*", \ ++ SUBSYSTEMS=="platform", DRIVERS=="gpio-keys", \ ++ ATTRS{keys}=="116", TAG+="power-switch" ++ ++ This overlay only handles shutdown. After shutdown, the system ++ can be powered up again by driving GPIO3 low. The default ++ configuration uses GPIO3 with a pullup, so if you connect a ++ button between GPIO3 and GND (pin 5 and 6 on the 40-pin header), ++ you get a shutdown and power-up button. ++Load: dtoverlay=gpio-shutdown,= ++Params: gpio_pin GPIO pin to trigger on (default 3) ++ ++ active_low When this is 1 (active low), a falling ++ edge generates a key down event and a ++ rising edge generates a key up event. ++ When this is 0 (active high), this is ++ reversed. The default is 1 (active low). ++ ++ gpio_pull Desired pull-up/down state (off, down, up) ++ Default is "up". ++ ++ Note that the default pin (GPIO3) has an ++ external pullup. ++ ++ +Name: hifiberry-amp +Info: Configures the HifiBerry Amp and Amp+ audio cards +Load: dtoverlay=hifiberry-amp @@ -85189,22 +86124,77 @@ index 0000000000000000000000000000000000000000..e2a803e5180cf78d67b6723cfd2f6d3b + source + + ++Name: i2c-rtc-gpio ++Info: Adds support for a number of I2C Real Time Clock devices ++ using the software i2c controller ++Load: dtoverlay=i2c-rtc-gpio,= ++Params: abx80x Select one of the ABx80x family: ++ AB0801, AB0803, AB0804, AB0805, ++ AB1801, AB1803, AB1804, AB1805 ++ ++ ds1307 Select the DS1307 device ++ ++ ds1339 Select the DS1339 device ++ ++ ds3231 Select the DS3231 device ++ ++ mcp7940x Select the MCP7940x device ++ ++ mcp7941x Select the MCP7941x device ++ ++ pcf2127 Select the PCF2127 device ++ ++ pcf8523 Select the PCF8523 device ++ ++ pcf8563 Select the PCF8563 device ++ ++ trickle-diode-type Diode type for trickle charge - "standard" or ++ "schottky" (ABx80x only) ++ ++ trickle-resistor-ohms Resistor value for trickle charge (DS1339, ++ ABx80x) ++ ++ wakeup-source Specify that the RTC can be used as a wakeup ++ source ++ ++ i2c_gpio_sda GPIO used for I2C data (default "23") ++ ++ i2c_gpio_scl GPIO used for I2C clock (default "24") ++ ++ i2c_gpio_delay_us Clock delay in microseconds ++ (default "2" = ~100kHz) ++ ++ +Name: i2c-sensor +Info: Adds support for a number of I2C barometric pressure and temperature + sensors on i2c_arm +Load: dtoverlay=i2c-sensor,= -+Params: bmp085 Select the Bosch sensortronic BMP085 ++Params: addr Set the address for the BME280, BMP280, TMP102 ++ or LM75 + -+ bmp280 Select the Bosch sensortronic BMP280 ++ bme280 Select the Bosch Sensortronic BME280 ++ Valid addresses 0x76-0x77, default 0x76 ++ ++ bmp085 Select the Bosch Sensortronic BMP085 ++ ++ bmp180 Select the Bosch Sensortronic BMP180 ++ ++ bmp280 Select the Bosch Sensortronic BMP280 ++ Valid addresses 0x76-0x77, default 0x76 ++ ++ htu21 Select the HTU21 temperature and humidity sensor + + lm75 Select the Maxim LM75 temperature sensor ++ Valid addresses 0x48-0x4f, default 0x4f + -+ lm75addr Choose the address for the LM75 (0x48-0x4f - -+ default 0x4f) ++ lm75addr Deprecated - use addr parameter instead + + si7020 Select the Silicon Labs Si7013/20/21 humidity/ + temperature sensor + ++ tmp102 Select the Texas Instruments TMP102 temp sensor ++ Valid addresses 0x48-0x4b, default 0x48 ++ + +Name: i2c0-bcm2708 +Info: Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations @@ -85405,6 +86395,13 @@ index 0000000000000000000000000000000000000000..e2a803e5180cf78d67b6723cfd2f6d3b +Params: + + ++Name: midi-uart1 ++Info: Configures UART1 (ttyS0) so that a requested 38.4kbaud actually gets ++ 31.25kbaud, the frequency required for MIDI ++Load: dtoverlay=midi-uart1 ++Params: ++ ++ +Name: mmc +Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock +Load: dtoverlay=mmc,= @@ -85412,6 +86409,12 @@ index 0000000000000000000000000000000000000000..e2a803e5180cf78d67b6723cfd2f6d3b + requests 50MHz + + ++Name: mpu6050 ++Info: Overlay for i2c connected mpu6050 imu ++Load: dtoverlay=mpu6050,= ++Params: interrupt GPIO pin for interrupt (default 4) ++ ++ +Name: mz61581 +Info: MZ61581 display by Tontec +Load: dtoverlay=mz61581,= @@ -85636,6 +86639,15 @@ index 0000000000000000000000000000000000000000..e2a803e5180cf78d67b6723cfd2f6d3b +Params: + + ++Name: rotary-encoder ++Info: Overlay for GPIO connected rotary encoder. ++Load: dtoverlay=rotary-encoder,= ++Params: rotary0_pin_a GPIO connected to rotary encoder channel A ++ (default 4). ++ rotary0_pin_b GPIO connected to rotary encoder channel B ++ (default 17). ++ ++ +Name: rpi-backlight +Info: Raspberry Pi official display backlight driver +Load: dtoverlay=rpi-backlight @@ -85737,19 +86749,9 @@ index 0000000000000000000000000000000000000000..e2a803e5180cf78d67b6723cfd2f6d3b +Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, + and enables SDIO via GPIOs 22-27. +Load: dtoverlay=sdio,= -+Params: overclock_50 SD Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ -+ sdio_overclock SDIO Clock (in MHz) to use when the MMC ++Params: sdio_overclock SDIO Clock (in MHz) to use when the MMC + framework requests 50MHz + -+ force_pio Disable DMA support (default off) -+ -+ pio_limit Number of blocks above which to use DMA -+ (default 1) -+ -+ debug Enable debug output (default off) -+ + poll_once Disable SDIO-device polling every second + (default on: polling once at boot-time) + @@ -85760,19 +86762,9 @@ index 0000000000000000000000000000000000000000..e2a803e5180cf78d67b6723cfd2f6d3b +Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, + and enables 1-bit SDIO via GPIOs 22-25. +Load: dtoverlay=sdio-1bit,= -+Params: overclock_50 SD Clock (in MHz) to use when the MMC framework -+ requests 50MHz -+ -+ sdio_overclock SDIO Clock (in MHz) to use when the MMC ++Params: sdio_overclock SDIO Clock (in MHz) to use when the MMC + framework requests 50MHz + -+ force_pio Disable DMA support (default off) -+ -+ pio_limit Number of blocks above which to use DMA -+ (default 1) -+ -+ debug Enable debug output (default off) -+ + poll_once Disable SDIO-device polling every second + (default on: polling once at boot-time) + @@ -86588,6 +87580,56 @@ index 0000000000000000000000000000000000000000..ac1cfe093d9aa8a77ef25cc62a9d8100 + slave = <&boss_dac>,"allo,slave?"; + }; +}; +diff --git a/arch/arm/boot/dts/overlays/allo-digione-overlay.dts b/arch/arm/boot/dts/overlays/allo-digione-overlay.dts +new file mode 100644 +index 0000000000000000000000000000000000000000..101277a11a24e9b3eb441c44c3f19c61836fe77c +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/allo-digione-overlay.dts +@@ -0,0 +1,44 @@ ++// Definitions for Allo DigiOne ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2s>; ++ __overlay__ { ++ status = "okay"; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ wm8804@3b { ++ #sound-dai-cells = <0>; ++ compatible = "wlf,wm8804"; ++ reg = <0x3b>; ++ PVDD-supply = <&vdd_3v3_reg>; ++ DVDD-supply = <&vdd_3v3_reg>; ++ status = "okay"; ++ wlf,reset-gpio = <&gpio 17 0>; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&sound>; ++ __overlay__ { ++ compatible = "allo,allo-digione"; ++ i2s-controller = <&i2s>; ++ status = "okay"; ++ clock44-gpio = <&gpio 5 0>; ++ clock48-gpio = <&gpio 6 0>; ++ }; ++ }; ++}; diff --git a/arch/arm/boot/dts/overlays/allo-piano-dac-pcm512x-audio-overlay.dts b/arch/arm/boot/dts/overlays/allo-piano-dac-pcm512x-audio-overlay.dts new file mode 100644 index 0000000000000000000000000000000000000000..a5468d850a911cd509365cf25f8ffa6ad071b90a @@ -87399,6 +88441,58 @@ index 0000000000000000000000000000000000000000..81a07ed5a8c7594e65f0df2176418cac + }; + }; +}; +diff --git a/arch/arm/boot/dts/overlays/goodix-overlay.dts b/arch/arm/boot/dts/overlays/goodix-overlay.dts +new file mode 100644 +index 0000000000000000000000000000000000000000..084f74042ed6379ebd9281374d5391a7e23a431e +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/goodix-overlay.dts +@@ -0,0 +1,46 @@ ++// Device tree overlay for I2C connected Goodix gt9271 multiple touch controller ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ goodix_pins: goodix_pins { ++ brcm,pins = <4 17>; // interrupt and reset ++ brcm,function = <0 0>; // in ++ brcm,pull = <2 2>; // pull-up ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ gt9271: gt9271@14 { ++ compatible = "goodix,gt9271"; ++ reg = <0x14>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&goodix_pins>; ++ interrupt-parent = <&gpio>; ++ interrupts = <4 2>; // high-to-low edge triggered ++ irq-gpios = <&gpio 4 0>; // Pin7 on GPIO header ++ reset-gpios = <&gpio 17 0>; // Pin11 on GPIO header ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ interrupt = <&goodix_pins>,"brcm,pins:0", ++ <>9271>,"interrupts:0", ++ <>9271>,"irq-gpios:4"; ++ reset = <&goodix_pins>,"brcm,pins:4", ++ <>9271>,"reset-gpios:4"; ++ }; ++}; diff --git a/arch/arm/boot/dts/overlays/googlevoicehat-soundcard-overlay.dts b/arch/arm/boot/dts/overlays/googlevoicehat-soundcard-overlay.dts new file mode 100644 index 0000000000000000000000000000000000000000..9a9e9a0ca28cf774a868b2882ae57b00de1cf7b7 @@ -87544,6 +88638,92 @@ index 0000000000000000000000000000000000000000..ff8cb36d94d4940d5151ace24afc4ad1 + active_low = <&power_ctrl>,"gpios:8"; + }; +}; +diff --git a/arch/arm/boot/dts/overlays/gpio-shutdown-overlay.dts b/arch/arm/boot/dts/overlays/gpio-shutdown-overlay.dts +new file mode 100644 +index 0000000000000000000000000000000000000000..863fb395c8539734b658682b900e1fbd96c9443e +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/gpio-shutdown-overlay.dts +@@ -0,0 +1,80 @@ ++// Definitions for gpio-poweroff module ++/dts-v1/; ++/plugin/; ++ ++// This overlay sets up an input device that generates KEY_POWER events ++// when a given GPIO pin changes. It defaults to using GPIO3, which can ++// also be used to wake up (start) the Rpi again after shutdown. Since ++// wakeup is active-low, this defaults to active-low with a pullup ++// enabled, but all of this can be changed using overlay parameters (but ++// note that GPIO3 has an external pullup on at least some boards). ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ // Configure the gpio pin controller ++ target = <&gpio>; ++ __overlay__ { ++ // Define a pinctrl state, that sets up the gpio ++ // as an input with a pullup enabled. This does ++ // not take effect by itself, only when referenced ++ // by a "pinctrl client", as is done below. See: ++ // https://www.kernel.org/doc/Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt ++ // https://www.kernel.org/doc/Documentation/devicetree/bindings/pinctrl/brcm,bcm2835-gpio.txt ++ pin_state: shutdown_button_pins { ++ brcm,pins = <3>; // gpio number ++ brcm,function = <0>; // 0 = input, 1 = output ++ brcm,pull = <2>; // 0 = none, 1 = pull down, 2 = pull up ++ }; ++ }; ++ }; ++ fragment@1 { ++ // Add a new device to the /soc devicetree node ++ target-path = "/soc"; ++ __overlay__ { ++ shutdown_button { ++ // Let the gpio-keys driver handle this device. See: ++ // https://www.kernel.org/doc/Documentation/devicetree/bindings/input/gpio-keys.txt ++ compatible = "gpio-keys"; ++ ++ // Declare a single pinctrl state (referencing the one declared above) and name it ++ // default, so it is activated automatically. ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pin_state>; ++ ++ // Enable this device ++ status = "okay"; ++ ++ // Define a single key, called "shutdown" that monitors the gpio and sends KEY_POWER ++ // (keycode 116, see ++ // https://github.com/torvalds/linux/blob/v4.12/include/uapi/linux/input-event-codes.h#L190) ++ button: shutdown { ++ label = "shutdown"; ++ linux,code = <116>; // KEY_POWER ++ gpios = <&gpio 3 1>; ++ }; ++ }; ++ }; ++ }; ++ ++ // This defines parameters that can be specified when loading ++ // the overlay. Each foo = line specifies one parameter, named ++ // foo. The rest of the specification gives properties where the ++ // parameter value is inserted into (changing the values above ++ // or adding new ones). ++ __overrides__ { ++ // Allow overriding the GPIO number. ++ gpio_pin = <&button>,"gpios:4", ++ <&pin_state>,"brcm,pins:0"; ++ ++ // Allow changing the internal pullup/down state. 0 = none, 1 = pulldown, 2 = pullup ++ // Note that GPIO3 and GPIO2 are the I2c pins and have an external pullup (at least ++ // on some boards). ++ gpio_pull = <&pin_state>,"brcm,pull:0"; ++ ++ // Allow setting the active_low flag. 0 = active high, 1 = active low ++ active_low = <&button>,"gpios:8"; ++ }; ++ ++}; diff --git a/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts b/arch/arm/boot/dts/overlays/hifiberry-amp-overlay.dts new file mode 100644 index 0000000000000000000000000000000000000000..5f5785534fd3d9a97309796f842c8881e2d6979a @@ -88288,13 +89468,14 @@ index 0000000000000000000000000000000000000000..d1ffd2326669e46ad68939f94713cc99 + addr = <&pca>,"reg:0"; + }; +}; -diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-gpio-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-gpio-overlay.dts new file mode 100644 -index 0000000000000000000000000000000000000000..1efcf0b712c9c5c19210545002ac1f0931db58f5 +index 0000000000000000000000000000000000000000..8415e6081428fba9a47682964174fc023cfd2b0c --- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts -@@ -0,0 +1,83 @@ ++++ b/arch/arm/boot/dts/overlays/i2c-rtc-gpio-overlay.dts +@@ -0,0 +1,183 @@ +// Definitions for several I2C based Real Time Clocks ++// Available through i2c-gpio +/dts-v1/; +/plugin/; + @@ -88302,8 +89483,23 @@ index 0000000000000000000000000000000000000000..1efcf0b712c9c5c19210545002ac1f09 + compatible = "brcm,bcm2708"; + + fragment@0 { -+ target = <&i2c_arm>; ++ target-path = "/"; + __overlay__ { ++ i2c_gpio: i2c-gpio-rtc@0 { ++ compatible = "i2c-gpio"; ++ gpios = <&gpio 23 0 /* sda */ ++ &gpio 24 0 /* scl */ ++ >; ++ i2c-gpio,delay-us = <2>; /* ~100 kHz */ ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c_gpio>; ++ __dormant__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; @@ -88313,61 +89509,315 @@ index 0000000000000000000000000000000000000000..1efcf0b712c9c5c19210545002ac1f09 + reg = <0x69>; + abracon,tc-diode = "standard"; + abracon,tc-resistor = <0>; -+ status = "disable"; ++ status = "okay"; + }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c_gpio>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ + ds1307: ds1307@68 { + compatible = "maxim,ds1307"; + reg = <0x68>; -+ status = "disable"; ++ status = "okay"; + }; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&i2c_gpio>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ + ds1339: ds1339@68 { + compatible = "dallas,ds1339"; + trickle-resistor-ohms = <0>; + reg = <0x68>; -+ status = "disable"; -+ }; -+ mcp7940x: mcp7940x@6f { -+ compatible = "microchip,mcp7940x"; -+ reg = <0x6f>; -+ status = "disable"; -+ }; -+ mcp7941x: mcp7941x@6f { -+ compatible = "microchip,mcp7941x"; -+ reg = <0x6f>; -+ status = "disable"; -+ }; -+ ds3231: ds3231@68 { -+ compatible = "maxim,ds3231"; -+ reg = <0x68>; -+ status = "disable"; -+ }; -+ pcf2127: pcf2127@51 { -+ compatible = "nxp,pcf2127"; -+ reg = <0x51>; -+ status = "disable"; -+ }; -+ pcf8523: pcf8523@68 { -+ compatible = "nxp,pcf8523"; -+ reg = <0x68>; -+ status = "disable"; -+ }; -+ pcf8563: pcf8563@51 { -+ compatible = "nxp,pcf8563"; -+ reg = <0x51>; -+ status = "disable"; ++ status = "okay"; + }; + }; + }; ++ ++ fragment@4 { ++ target = <&i2c_gpio>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ ds3231: ds3231@68 { ++ compatible = "maxim,ds3231"; ++ reg = <0x68>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@5 { ++ target = <&i2c_gpio>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ mcp7940x: mcp7940x@6f { ++ compatible = "microchip,mcp7940x"; ++ reg = <0x6f>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@6 { ++ target = <&i2c_gpio>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ mcp7941x: mcp7941x@6f { ++ compatible = "microchip,mcp7941x"; ++ reg = <0x6f>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@7 { ++ target = <&i2c_gpio>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcf2127: pcf2127@51 { ++ compatible = "nxp,pcf2127"; ++ reg = <0x51>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@8 { ++ target = <&i2c_gpio>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcf8523: pcf8523@68 { ++ compatible = "nxp,pcf8523"; ++ reg = <0x68>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@9 { ++ target = <&i2c_gpio>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ + __overrides__ { -+ abx80x = <&abx80x>,"status"; -+ ds1307 = <&ds1307>,"status"; -+ ds1339 = <&ds1339>,"status"; -+ ds3231 = <&ds3231>,"status"; -+ mcp7940x = <&mcp7940x>,"status"; -+ mcp7941x = <&mcp7941x>,"status"; -+ pcf2127 = <&pcf2127>,"status"; -+ pcf8523 = <&pcf8523>,"status"; -+ pcf8563 = <&pcf8563>,"status"; ++ abx80x = <0>,"+1"; ++ ds1307 = <0>,"+2"; ++ ds1339 = <0>,"+3"; ++ ds3231 = <0>,"+4"; ++ mcp7940x = <0>,"+5"; ++ mcp7941x = <0>,"+6"; ++ pcf2127 = <0>,"+7"; ++ pcf8523 = <0>,"+8"; ++ pcf8563 = <0>,"+9"; ++ trickle-diode-type = <&abx80x>,"abracon,tc-diode"; ++ trickle-resistor-ohms = <&ds1339>,"trickle-resistor-ohms:0", ++ <&abx80x>,"abracon,tc-resistor"; ++ wakeup-source = <&ds1339>,"wakeup-source?", ++ <&ds3231>,"wakeup-source?", ++ <&mcp7940x>,"wakeup-source?", ++ <&mcp7941x>,"wakeup-source?"; ++ i2c_gpio_sda = <&i2c_gpio>,"gpios:4"; ++ i2c_gpio_scl = <&i2c_gpio>,"gpios:16"; ++ i2c_gpio_delay_us = <&i2c_gpio>,"i2c-gpio,delay-us:0"; ++ }; ++}; +diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +new file mode 100644 +index 0000000000000000000000000000000000000000..6140f172a86b8731782f938f76cb5dac9f28b662 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts +@@ -0,0 +1,164 @@ ++// Definitions for several I2C based Real Time Clocks ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ abx80x: abx80x@69 { ++ compatible = "abracon,abx80x"; ++ reg = <0x69>; ++ abracon,tc-diode = "standard"; ++ abracon,tc-resistor = <0>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ ds1307: ds1307@68 { ++ compatible = "maxim,ds1307"; ++ reg = <0x68>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ ds1339: ds1339@68 { ++ compatible = "dallas,ds1339"; ++ trickle-resistor-ohms = <0>; ++ reg = <0x68>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ ds3231: ds3231@68 { ++ compatible = "maxim,ds3231"; ++ reg = <0x68>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ mcp7940x: mcp7940x@6f { ++ compatible = "microchip,mcp7940x"; ++ reg = <0x6f>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@5 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ mcp7941x: mcp7941x@6f { ++ compatible = "microchip,mcp7941x"; ++ reg = <0x6f>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@6 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcf2127: pcf2127@51 { ++ compatible = "nxp,pcf2127"; ++ reg = <0x51>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@7 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcf8523: pcf8523@68 { ++ compatible = "nxp,pcf8523"; ++ reg = <0x68>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@8 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ pcf8563: pcf8563@51 { ++ compatible = "nxp,pcf8563"; ++ reg = <0x51>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ abx80x = <0>,"+0"; ++ ds1307 = <0>,"+1"; ++ ds1339 = <0>,"+2"; ++ ds3231 = <0>,"+3"; ++ mcp7940x = <0>,"+4"; ++ mcp7941x = <0>,"+5"; ++ pcf2127 = <0>,"+6"; ++ pcf8523 = <0>,"+7"; ++ pcf8563 = <0>,"+8"; + trickle-diode-type = <&abx80x>,"abracon,tc-diode"; + trickle-resistor-ohms = <&ds1339>,"trickle-resistor-ohms:0", + <&abx80x>,"abracon,tc-resistor"; @@ -88379,11 +89829,11 @@ index 0000000000000000000000000000000000000000..1efcf0b712c9c5c19210545002ac1f09 +}; diff --git a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts new file mode 100644 -index 0000000000000000000000000000000000000000..606b2d5012abf2e85712be631c42ea40a0b512c5 +index 0000000000000000000000000000000000000000..17c27e3b666a7a83619471b50c63bb93836653c5 --- /dev/null +++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -@@ -0,0 +1,49 @@ -+// Definitions for I2C based sensors using the Industrial IO interface. +@@ -0,0 +1,142 @@ ++// Definitions for I2C based sensors using the Industrial IO or HWMON interface. +/dts-v1/; +/plugin/; + @@ -88392,7 +89842,22 @@ index 0000000000000000000000000000000000000000..606b2d5012abf2e85712be631c42ea40 + + fragment@0 { + target = <&i2c_arm>; -+ __overlay__ { ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ bme280: bme280@76 { ++ compatible = "bosch,bme280"; ++ reg = <0x76>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&i2c_arm>; ++ __dormant__ { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; @@ -88401,35 +89866,113 @@ index 0000000000000000000000000000000000000000..606b2d5012abf2e85712be631c42ea40 + compatible = "bosch,bmp085"; + reg = <0x77>; + default-oversampling = <3>; -+ status = "disable"; ++ status = "okay"; + }; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ bmp180: bmp180@77 { ++ compatible = "bosch,bmp180"; ++ reg = <0x77>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@3 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; + + bmp280: bmp280@76 { + compatible = "bosch,bmp280"; + reg = <0x76>; -+ status = "disable"; ++ status = "okay"; + }; ++ }; ++ }; ++ ++ fragment@4 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ htu21: htu21@40 { ++ compatible = "htu21"; ++ reg = <0x40>; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@5 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; + + lm75: lm75@4f { + compatible = "lm75"; + reg = <0x4f>; -+ status = "disable"; ++ status = "okay"; + }; ++ }; ++ }; ++ ++ fragment@6 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; + + si7020: si7020@40 { + compatible = "si7020"; + reg = <0x40>; -+ status = "disable"; ++ status = "okay"; ++ }; ++ }; ++ }; ++ ++ fragment@7 { ++ target = <&i2c_arm>; ++ __dormant__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ ++ tmp102: tmp102@48 { ++ compatible = "ti,tmp102"; ++ reg = <0x48>; ++ status = "okay"; + }; + }; + }; + + __overrides__ { -+ bmp085 = <&bmp085>,"status"; -+ bmp280 = <&bmp280>,"status"; -+ lm75 = <&lm75>,"status"; ++ addr = <&bme280>,"reg:0", <&bmp280>,"reg:0", <&tmp102>,"reg:0", ++ <&lm75>,"reg:0"; ++ bme280 = <0>,"+0"; ++ bmp085 = <0>,"+1"; ++ bmp180 = <0>,"+2"; ++ bmp280 = <0>,"+3"; ++ htu21 = <0>,"+4"; ++ lm75 = <0>,"+5"; + lm75addr = <&lm75>,"reg:0"; -+ si7020 = <&si7020>,"status"; ++ si7020 = <0>,"+6"; ++ tmp102 = <0>,"+7"; + }; +}; diff --git a/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c0-bcm2708-overlay.dts @@ -88501,10 +90044,10 @@ index 0000000000000000000000000000000000000000..1f4fc7b570604a50ff6d3f6d676c3c46 +}; diff --git a/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts new file mode 100644 -index 0000000000000000000000000000000000000000..e303b9c61c82a28eab7b48f6b085661574d5a849 +index 0000000000000000000000000000000000000000..7c69047bcd88a5c900dddd08e60ad0750b96d785 --- /dev/null +++ b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts -@@ -0,0 +1,37 @@ +@@ -0,0 +1,34 @@ +/* + * Device tree overlay for i2c_bcm2708, i2c1 bus + * @@ -88527,19 +90070,16 @@ index 0000000000000000000000000000000000000000..e303b9c61c82a28eab7b48f6b0856615 + }; + + fragment@1 { -+ target = <&gpio>; -+ __overlay__ { -+ i2c1_pins: i2c1 { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; /* alt0 */ -+ }; ++ target = <&i2c1_pins>; ++ pins: __overlay__ { ++ brcm,pins = <2 3>; ++ brcm,function = <4>; /* alt 0 */ + }; + }; -+ + __overrides__ { -+ sda1_pin = <&i2c1_pins>,"brcm,pins:0"; -+ scl1_pin = <&i2c1_pins>,"brcm,pins:4"; -+ pin_func = <&i2c1_pins>,"brcm,function:0"; ++ sda1_pin = <&pins>,"brcm,pins:0"; ++ scl1_pin = <&pins>,"brcm,pins:4"; ++ pin_func = <&pins>,"brcm,function:0"; + }; +}; diff --git a/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts b/arch/arm/boot/dts/overlays/i2s-gpio28-31-overlay.dts @@ -90097,6 +91637,55 @@ index 0000000000000000000000000000000000000000..565af7cf79d761877be3bd06191f31aa + }; + }; +}; +diff --git a/arch/arm/boot/dts/overlays/midi-uart1-overlay.dts b/arch/arm/boot/dts/overlays/midi-uart1-overlay.dts +new file mode 100644 +index 0000000000000000000000000000000000000000..e0bc410acbff3a7a175dd5d53b3ab0d0802e8239 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/midi-uart1-overlay.dts +@@ -0,0 +1,43 @@ ++/dts-v1/; ++/plugin/; ++ ++#include ++ ++/* ++ * Fake a higher clock rate to get a larger divisor, and thereby a lower ++ * baudrate. The real clock is 48MHz, which we scale so that requesting ++ * 38.4kHz results in an actual 31.25kHz. ++ * ++ * 48000000*38400/31250 = 58982400 ++ */ ++ ++/{ ++ compatible = "brcm,bcm2835"; ++ ++ fragment@0 { ++ target-path = "/clocks"; ++ __overlay__ { ++ midi_clk: clock@5 { ++ compatible = "fixed-factor-clock"; ++ #clock-cells = <0>; ++ clocks = <&aux BCM2835_AUX_CLOCK_UART>; ++ clock-mult = <38400>; ++ clock-div = <31250>; ++ }; ++ }; ++ }; ++ ++ fragment@1 { ++ target = <&uart1>; ++ __overlay__ { ++ clocks = <&midi_clk>; ++ }; ++ }; ++ ++ fragment@2 { ++ target = <&aux>; ++ __overlay__ { ++ clock-output-names = "aux_uart", "aux_spi1", "aux_spi2"; ++ }; ++ }; ++}; diff --git a/arch/arm/boot/dts/overlays/mmc-overlay.dts b/arch/arm/boot/dts/overlays/mmc-overlay.dts new file mode 100644 index 0000000000000000000000000000000000000000..88251ad653917674f80c2975de2e425fca00b71f @@ -90142,6 +91731,40 @@ index 0000000000000000000000000000000000000000..88251ad653917674f80c2975de2e425f + overclock_50 = <&frag0>,"brcm,overclock-50:0"; + }; +}; +diff --git a/arch/arm/boot/dts/overlays/mpu6050-overlay.dts b/arch/arm/boot/dts/overlays/mpu6050-overlay.dts +new file mode 100644 +index 0000000000000000000000000000000000000000..06037969c3abba270b3cad45875342f3c730506e +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/mpu6050-overlay.dts +@@ -0,0 +1,28 @@ ++// Definitions for MPU6050 ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&i2c1>; ++ __overlay__ { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ status = "okay"; ++ clock-frequency = <400000>; ++ ++ mpu6050: mpu6050@68 { ++ compatible = "invensense,mpu6050"; ++ reg = <0x68>; ++ interrupt-parent = <&gpio>; ++ interrupts = <4 1>; ++ }; ++ }; ++ }; ++ ++ __overrides__ { ++ interrupt = <&mpu6050>,"interrupts:0"; ++ }; ++}; diff --git a/arch/arm/boot/dts/overlays/mz61581-overlay.dts b/arch/arm/boot/dts/overlays/mz61581-overlay.dts new file mode 100644 index 0000000000000000000000000000000000000000..2c29aaed44c5959d7f0df2a3baf2af052b24b6b4 @@ -91467,6 +93090,55 @@ index 0000000000000000000000000000000000000000..2c3c97813f22c94eff6da2193aff0920 + }; + }; +}; +diff --git a/arch/arm/boot/dts/overlays/rotary-encoder-overlay.dts b/arch/arm/boot/dts/overlays/rotary-encoder-overlay.dts +new file mode 100644 +index 0000000000000000000000000000000000000000..c0c6bccff60cc15d9a9bf59d2c7cba41eb9c1cdc +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/rotary-encoder-overlay.dts +@@ -0,0 +1,43 @@ ++// Device tree overlay for GPIO connected rotary encoder. ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2708"; ++ ++ fragment@0 { ++ target = <&gpio>; ++ __overlay__ { ++ rotary0_pins: rotary0_pins { ++ brcm,pins = <4 17>; /* gpio 4 17 */ ++ brcm,function = <0 0>; /* input */ ++ brcm,pull = <2 2>; /* pull-up */ ++ }; ++ ++ }; ++ }; ++ ++ fragment@1 { ++ target-path = "/"; ++ __overlay__ { ++ rotary0: rotary@0 { ++ compatible = "rotary-encoder"; ++ status = "okay"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&rotary0_pins>; ++ gpios = <&gpio 4 0>, <&gpio 17 0>; ++ linux,axis = <0>; /* REL_X */ ++ rotary-encoder,encoding = "gray"; ++ rotary-encoder,relative-axis; ++ }; ++ }; ++ ++ }; ++ ++ __overrides__ { ++ rotary0_pin_a = <&rotary0>,"gpios:4", ++ <&rotary0_pins>,"brcm,pins:0"; ++ rotary0_pin_b = <&rotary0>,"gpios:16", ++ <&rotary0_pins>,"brcm,pins:4"; ++ }; ++}; diff --git a/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts b/arch/arm/boot/dts/overlays/rpi-backlight-overlay.dts new file mode 100644 index 0000000000000000000000000000000000000000..c021d02bb75ff5ceb5c5066d00e4bca942554032 @@ -93267,7 +94939,7 @@ index 0000000000000000000000000000000000000000..fa73e1feaeb1bf53a6755e81a998e71c +}; diff --git a/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts b/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts new file mode 100644 -index 0000000000000000000000000000000000000000..95a595a35cb4fbb707bf4b18161f6a46860aa4ae +index 0000000000000000000000000000000000000000..36fbf6c8c2e612a6dc5aa02d77cc8173098c16ca --- /dev/null +++ b/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts @@ -0,0 +1,89 @@ @@ -93284,35 +94956,35 @@ index 0000000000000000000000000000000000000000..95a595a35cb4fbb707bf4b18161f6a46 + fragment@0 { + target-path = "/chosen"; + __overlay__ { -+ bootargs = "cma=256M@256M"; ++ bootargs = "cma=256M"; + }; + }; + + fragment@1 { + target-path = "/chosen"; + __dormant__ { -+ bootargs = "cma=192M@256M"; ++ bootargs = "cma=192M"; + }; + }; + + fragment@2 { + target-path = "/chosen"; + __dormant__ { -+ bootargs = "cma=128M@128M"; ++ bootargs = "cma=128M"; + }; + }; + + fragment@3 { + target-path = "/chosen"; + __dormant__ { -+ bootargs = "cma=96M@128M"; ++ bootargs = "cma=96M"; + }; + }; + + fragment@4 { + target-path = "/chosen"; + __dormant__ { -+ bootargs = "cma=64M@64M"; ++ bootargs = "cma=64M"; + }; + }; + @@ -93750,10 +95422,10 @@ index 58c05e5d9870b6c18a72da7dc44ff3112994946d..9842523b225a88505d796cc689c04f40 # Bzip2 -From 6b4c72c0307a6de6dda6ffae1eae88bf174ccd52 Mon Sep 17 00:00:00 2001 +From 21aaf80fa4722da3ab5632c51f2bbd0169497f37 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 6 Feb 2015 13:50:57 +0000 -Subject: [PATCH 053/173] BCM270x_DT: Add pwr_led, and the required "input" +Subject: [PATCH 058/140] BCM270x_DT: Add pwr_led, and the required "input" trigger The "input" trigger makes the associated GPIO an input. This is to support @@ -93928,10 +95600,10 @@ index 64c56d454f7df9f864a5242ce4212df586f66886..3fd74c8737871cb56f0355c858fc135e /* set_brightness_work / blink_timer flags, atomic, private. */ unsigned long work_flags; -From d1c26c42c63b3606fd7951c008b83864621ffc3f Mon Sep 17 00:00:00 2001 +From aca60316476dc6b915c17999236e6a1cea557615 Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka Date: Mon, 17 Jun 2013 13:32:11 +0300 -Subject: [PATCH 054/173] fbdev: add FBIOCOPYAREA ioctl +Subject: [PATCH 059/140] fbdev: add FBIOCOPYAREA ioctl Based on the patch authored by Ali Gholami Rudi at https://lkml.org/lkml/2009/7/13/153 @@ -94199,10 +95871,10 @@ index fb795c3b3c178ad3cd7c9e9e4547ffd492bac181..703fa8a70574323abe2fb32599254582 __u32 dx; /* screen-relative */ __u32 dy; -From 9c7384a03b7b1f487a69293d8dc3b1a3b70ddb9d Mon Sep 17 00:00:00 2001 +From 86560161d4d90f60ce42ef1990b4eda6179389d1 Mon Sep 17 00:00:00 2001 From: Harm Hanemaaijer Date: Thu, 20 Jun 2013 20:21:39 +0200 -Subject: [PATCH 055/173] Speed up console framebuffer imageblit function +Subject: [PATCH 060/140] 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 @@ -94411,10 +96083,10 @@ index a2bb276a8b2463eee98eb237c4647bc00cd93601..436494fba15abecb400ef28688466faf start_index, pitch_index); } else -From d0718fee7b3a522e9660f108423528f001c88049 Mon Sep 17 00:00:00 2001 +From 8514030b5c470fe0b6e21e4df43a094a6fff277e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 8 May 2013 11:46:50 +0100 -Subject: [PATCH 056/173] enabling the realtime clock 1-wire chip DS1307 and +Subject: [PATCH 061/140] 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 @@ -94664,10 +96336,10 @@ index 90cbe7e65059f6b604a87c6bf39cd9bbeae7684c..a52be51ee0a5511a75d4eaa8dacaec5e u8, w1_slave_found_callback); }; -From be35652a05671e3011baea91e94db18e7ea6a384 Mon Sep 17 00:00:00 2001 +From 9b7df9fec216cf1c8e3c738b3b9e60227f0109ad Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 14 Jul 2014 22:02:09 +0100 -Subject: [PATCH 057/173] hid: Reduce default mouse polling interval to 60Hz +Subject: [PATCH 062/140] hid: Reduce default mouse polling interval to 60Hz Reduces overhead when using X --- @@ -94699,10 +96371,10 @@ index c008847e0b20a2accb00451b10fb1c648f67925b..4a86428a3b4e3d51e9ac6ce9c9c11097 break; case HID_GD_JOYSTICK: -From 2ed02be91b7155dbe5d0c0a850bf761d8150806a Mon Sep 17 00:00:00 2001 +From 5c05748148e215bc4cf0b50779ffb8d460a3e809 Mon Sep 17 00:00:00 2001 From: Gordon Hollingworth Date: Tue, 12 May 2015 14:47:56 +0100 -Subject: [PATCH 058/173] rpi-ft5406: Add touchscreen driver for pi LCD display +Subject: [PATCH 063/140] 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 @@ -95060,10 +96732,10 @@ index 30fb37fe175df604a738258a2a632bca3bfff33f..4a3d79d3b48eb483a4e4bf498f617515 RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, -From 9c0b94406c5c1ec11a41bf9b2710051c36ce70e8 Mon Sep 17 00:00:00 2001 +From 4237130a4718221b3641f9aaf1c9841a53168003 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 28 Nov 2016 16:50:04 +0000 -Subject: [PATCH 059/173] Improve __copy_to_user and __copy_from_user +Subject: [PATCH 064/140] Improve __copy_to_user and __copy_from_user performance Provide a __copy_from_user that uses memcpy. On BCM2708, use @@ -96638,10 +98310,10 @@ index 17ec37811c32f09126ed42753037e055c5cec115..c08f81812d0d56a0d90c1eb6777d0622 bool "Broadcom BCM63xx DSL SoC" depends on ARCH_MULTI_V7 -From 348a5e09f4bb1417fe37049c1334664d6dc4b5f3 Mon Sep 17 00:00:00 2001 +From bfab69cc0d2b83afe083373f00c74223a2e2df7c Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 25 Jun 2015 12:16:11 +0100 -Subject: [PATCH 060/173] gpio-poweroff: Allow it to work on Raspberry Pi +Subject: [PATCH 065/140] 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 @@ -96676,10 +98348,10 @@ index be3d81ff51cc3f510d85e4eed7a52960e51e7bc1..a030ae9fb1fca325061c093696e82186 "%s: pm_power_off function already registered", __func__); -From 90f2efe61b9ba3c4a3bb0aed6c5aa76484b6d899 Mon Sep 17 00:00:00 2001 +From c3d1e6c32cd18b2897163e47be092f3468234803 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 14 Jul 2015 14:32:47 +0100 -Subject: [PATCH 061/173] mfd: Add Raspberry Pi Sense HAT core driver +Subject: [PATCH 066/140] mfd: Add Raspberry Pi Sense HAT core driver --- drivers/input/joystick/Kconfig | 8 + @@ -97544,10 +99216,10 @@ index 0000000000000000000000000000000000000000..56196dc2af10e464a1e3f98b028dca1c + +#endif -From 0d38f30ad88b8ad88309340e9171341ce8e98831 Mon Sep 17 00:00:00 2001 +From 7d21df3d60fda096368db2c76b6642a8305db1c4 Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Fri, 22 Nov 2013 19:19:08 +0100 -Subject: [PATCH 062/173] ASoC: Add support for HifiBerry DAC +Subject: [PATCH 067/140] ASoC: Add support for HifiBerry DAC This adds a machine driver for the HifiBerry DAC. It is a sound card that can @@ -97722,10 +99394,10 @@ index 0000000000000000000000000000000000000000..ee9f133953544629282631e5ef3f73fe +MODULE_DESCRIPTION("ASoC Driver for HifiBerry DAC"); +MODULE_LICENSE("GPL v2"); -From 95d9c85a641399f9d3a569db4ea02029f9bf12c8 Mon Sep 17 00:00:00 2001 +From 9b48466a67640e1174c7edc93cf0c6c57e94d4df Mon Sep 17 00:00:00 2001 From: Florian Meier Date: Mon, 25 Jan 2016 15:48:59 +0000 -Subject: [PATCH 063/173] ASoC: Add support for Rpi-DAC +Subject: [PATCH 068/140] ASoC: Add support for Rpi-DAC --- sound/soc/bcm/Kconfig | 7 +++ @@ -97891,7 +99563,7 @@ index 0000000000000000000000000000000000000000..38224467cbab7d5be3be731e73e2cf78 +MODULE_DESCRIPTION("ASoC Driver for RPi-DAC"); +MODULE_LICENSE("GPL v2"); diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index 6c78b0b49b8145c24740d93c4174c059d91ddae9..d8b8cf059e8730432c692e8ce4e4fb9f1269550a 100644 +index d6450d5fc144737f967b8e00678baa9b8f92295f..bdd081016d9eca07a5c72bf238f22b85c3454013 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -108,6 +108,7 @@ config SND_SOC_ALL_CODECS @@ -98009,10 +99681,10 @@ index 0000000000000000000000000000000000000000..afe1b419582aa40c4b2729d242bb13cd +MODULE_AUTHOR("Florian Meier "); +MODULE_LICENSE("GPL v2"); -From 9fc26baae7c35ba5d07b9a95827d3228680c0705 Mon Sep 17 00:00:00 2001 +From 830d0cb628a743c59efa452dfcab8607d2791b0a Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:41:23 +0100 -Subject: [PATCH 064/173] ASoC: wm8804: Implement MCLK configuration options, +Subject: [PATCH 069/140] 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 @@ -98061,10 +99733,10 @@ index af95d648265b3e92e345101542b332aee35191d4..513f56ba132929662802d15cdc653af3 .component_driver = { .dapm_widgets = wm8804_dapm_widgets, -From 37aa9704aff6efd6cb8c9593dab934a0896efa7b Mon Sep 17 00:00:00 2001 +From 656bc1ebf607d72431109874330b84a0f708595a Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Wed, 15 Jan 2014 21:42:08 +0100 -Subject: [PATCH 065/173] ASoC: BCM:Add support for HiFiBerry Digi. Driver is +Subject: [PATCH 070/140] ASoC: BCM:Add support for HiFiBerry Digi. Driver is based on the patched WM8804 driver. Signed-off-by: Daniel Matuschek @@ -98408,10 +100080,10 @@ index 0000000000000000000000000000000000000000..7620dd02de40b6d644ff038b445d375d +MODULE_DESCRIPTION("ASoC Driver for HifiBerry Digi"); +MODULE_LICENSE("GPL v2"); -From 133a00f5a6cd57787cca59ab2f7913ba5e362517 Mon Sep 17 00:00:00 2001 +From 9cb797da9370482bcfc0fb542ca5987ee4fb0abe Mon Sep 17 00:00:00 2001 From: Gordon Garrity Date: Sat, 8 Mar 2014 16:56:57 +0000 -Subject: [PATCH 066/173] Add IQaudIO Sound Card support for Raspberry Pi +Subject: [PATCH 071/140] Add IQaudIO Sound Card support for Raspberry Pi Set a limit of 0dB on Digital Volume Control @@ -98746,10 +100418,10 @@ index 0000000000000000000000000000000000000000..1ee4097c846376666775272ed692ca33 +MODULE_DESCRIPTION("ASoC Driver for IQAudio DAC"); +MODULE_LICENSE("GPL v2"); -From b87d532365fca2082ac3b45e057010e60eb09bf9 Mon Sep 17 00:00:00 2001 +From 8426dddb71252f8be2247e89784628918df5e183 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 10:06:56 +0200 -Subject: [PATCH 067/173] Added support for HiFiBerry DAC+ +Subject: [PATCH 072/140] 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. @@ -99379,10 +101051,10 @@ index 72b19e62f6267698aea45d2410d616d91c1825cb..c6839ef6e16754ed9de2698507b8986a dev_err(dev, "No LRCLK?\n"); return -EINVAL; -From 563426f03b8ebee2e70b8b1d0027329348b5d05c Mon Sep 17 00:00:00 2001 +From 983285fb27e7456e7f0f1accdd470619223eb5a8 Mon Sep 17 00:00:00 2001 From: Daniel Matuschek Date: Mon, 4 Aug 2014 11:09:58 +0200 -Subject: [PATCH 068/173] Added driver for HiFiBerry Amp amplifier add-on board +Subject: [PATCH 073/140] 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. @@ -99582,7 +101254,7 @@ index 0000000000000000000000000000000000000000..221c6c38e6465ffe5d5ad77fa80a0b14 +MODULE_DESCRIPTION("ASoC driver for HiFiBerry-AMP"); +MODULE_LICENSE("GPL v2"); diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index d8b8cf059e8730432c692e8ce4e4fb9f1269550a..aca3a53f08dba8762307f7c25a5d7c5561b9cf71 100644 +index bdd081016d9eca07a5c72bf238f22b85c3454013..a3be6e005a895b995897cc007bb85c780a42de8b 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -150,6 +150,7 @@ config SND_SOC_ALL_CODECS @@ -100217,10 +101889,10 @@ index 0000000000000000000000000000000000000000..8f019e04898754d2f87e9630137be9e8 + +#endif /* _TAS5713_H */ -From 554deb30893bb040bd210b2caf2cf4011b85acfd Mon Sep 17 00:00:00 2001 +From 123849bba7eaff2461afffafa68638189c7cd693 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 25 Mar 2015 09:26:17 +0100 -Subject: [PATCH 069/173] Add driver for rpi-proto +Subject: [PATCH 074/140] 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 @@ -100435,10 +102107,10 @@ index 0000000000000000000000000000000000000000..fadbfade100228aaafabb0d3bdf35c01 +MODULE_DESCRIPTION("ASoC Driver for Raspberry Pi connected to PROTO board (WM8731)"); +MODULE_LICENSE("GPL"); -From 1db46d8581da2dc1918791cf285b358f61915072 Mon Sep 17 00:00:00 2001 +From bdb31e32e880cb3fd0003e25d496d2b583bdd69c Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Mon, 24 Aug 2015 16:03:47 +0100 -Subject: [PATCH 070/173] RaspiDAC3 support +Subject: [PATCH 075/140] RaspiDAC3 support Signed-off-by: Jan Grulich @@ -100681,10 +102353,10 @@ index 0000000000000000000000000000000000000000..ad2b5b89bc8213dc2e277306ef50d6e3 +MODULE_DESCRIPTION("ASoC Driver for RaspiDAC Rev.3x"); +MODULE_LICENSE("GPL v2"); -From 3e9ea889a1832600d5d85e95ca8f9e1208636aca Mon Sep 17 00:00:00 2001 +From c57c9516011dd71f070fbef4a4e3e453e47f5856 Mon Sep 17 00:00:00 2001 From: Aaron Shaw Date: Thu, 7 Apr 2016 21:26:21 +0100 -Subject: [PATCH 071/173] Add Support for JustBoom Audio boards +Subject: [PATCH 076/140] Add Support for JustBoom Audio boards justboom-dac: Adjust for ALSA API change @@ -101140,10 +102812,10 @@ index 0000000000000000000000000000000000000000..909cf8928f2f4313982316f9c5b8a709 +MODULE_DESCRIPTION("ASoC Driver for JustBoom PI Digi HAT Sound Card"); +MODULE_LICENSE("GPL v2"); -From f9f3c49616174451761f9650eeb54a7cd3d0c4a7 Mon Sep 17 00:00:00 2001 +From 7c70a244a51dd9224698d40a0f3c3f082b1e1eb5 Mon Sep 17 00:00:00 2001 From: Andrey Grodzovsky Date: Tue, 3 May 2016 22:10:59 -0400 -Subject: [PATCH 072/173] ARM: adau1977-adc: Add basic machine driver for +Subject: [PATCH 077/140] ARM: adau1977-adc: Add basic machine driver for adau1977 codec driver. This commit adds basic support for the codec usage including: Device tree overlay, @@ -101325,10 +102997,10 @@ index 0000000000000000000000000000000000000000..f3d7e5db7bb912e1d7ca6f8e8d42df5f +MODULE_DESCRIPTION("ASoC Driver for ADAU1977 ADC"); +MODULE_LICENSE("GPL v2"); -From 89146d6df7d2f1f0ac537dc1a6fab18d45745bac Mon Sep 17 00:00:00 2001 +From 9d480be77806328f8c27527fc0c63ba55fb2f7a9 Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Mon, 16 May 2016 21:36:31 +1000 -Subject: [PATCH 073/173] New AudioInjector.net Pi soundcard with low jitter +Subject: [PATCH 078/140] 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. @@ -101381,7 +103053,7 @@ index 8c20ce506f2b0d653be39ceb9224503a0ef63c39..4d4189b6d0c57645c5ec19554f1e77d4 + diff --git a/sound/soc/bcm/audioinjector-pi-soundcard.c b/sound/soc/bcm/audioinjector-pi-soundcard.c new file mode 100644 -index 0000000000000000000000000000000000000000..ef54e0f07ea03f59e9957b5d98f3e7fdc998e469 +index 0000000000000000000000000000000000000000..491906bbf446826e55dd843f28e4860f48e908b8 --- /dev/null +++ b/sound/soc/bcm/audioinjector-pi-soundcard.c @@ -0,0 +1,193 @@ @@ -101564,7 +103236,7 @@ index 0000000000000000000000000000000000000000..ef54e0f07ea03f59e9957b5d98f3e7fd + +static struct platform_driver audioinjector_pi_soundcard_driver = { + .driver = { -+ .name = "audioinjector-audio", ++ .name = "audioinjector-stereo", + .owner = THIS_MODULE, + .of_match_table = audioinjector_pi_soundcard_of_match, + }, @@ -101579,10 +103251,10 @@ index 0000000000000000000000000000000000000000..ef54e0f07ea03f59e9957b5d98f3e7fd +MODULE_ALIAS("platform:audioinjector-pi-soundcard"); + -From d2152e820d65214d326d86028f5e58f35b329688 Mon Sep 17 00:00:00 2001 +From 645eaaa24a0d4a54f3c0b04ab4b482d4e581e1b5 Mon Sep 17 00:00:00 2001 From: DigitalDreamtime Date: Thu, 30 Jun 2016 18:38:42 +0100 -Subject: [PATCH 074/173] Add IQAudIO Digi WM8804 board support +Subject: [PATCH 079/140] Add IQAudIO Digi WM8804 board support Support IQAudIO Digi board with iqaudio_digi machine driver and iqaudio-digi-wm8804-audio overlay. @@ -101882,10 +103554,10 @@ index 0000000000000000000000000000000000000000..33aa2be8a43a12a12cfb5d844dd9732c +MODULE_DESCRIPTION("ASoC Driver for IQAudIO WM8804 Digi"); +MODULE_LICENSE("GPL v2"); -From 1660ae420d3e1bf946ab26d857a3efa44ed18399 Mon Sep 17 00:00:00 2001 +From 68d5b7ce6bd338df8ca9c51207559f014b0263d3 Mon Sep 17 00:00:00 2001 From: escalator2015 Date: Tue, 24 May 2016 16:20:09 +0100 -Subject: [PATCH 075/173] New driver for RRA DigiDAC1 soundcard using WM8741 + +Subject: [PATCH 080/140] New driver for RRA DigiDAC1 soundcard using WM8741 + WM8804 --- @@ -102358,10 +104030,10 @@ index 0000000000000000000000000000000000000000..f200688bb4ae32b90a0ced555aed94b0 +MODULE_DESCRIPTION("ASoC Driver for RRA DigiDAC1"); +MODULE_LICENSE("GPL v2"); -From 314dc26021276267e532ae3a6695b3c730d670ca Mon Sep 17 00:00:00 2001 +From b2982faba369ea6d24ce18592cb800952d55ef0a Mon Sep 17 00:00:00 2001 From: DigitalDreamtime Date: Sat, 2 Jul 2016 16:26:19 +0100 -Subject: [PATCH 076/173] Add support for Dion Audio LOCO DAC-AMP HAT +Subject: [PATCH 081/140] Add support for Dion Audio LOCO DAC-AMP HAT Using dedicated machine driver and pcm5102a codec driver. @@ -102534,10 +104206,10 @@ index 0000000000000000000000000000000000000000..65e03741d349a2dc5bd91f69855ea952 +MODULE_DESCRIPTION("ASoC Driver for DionAudio LOCO"); +MODULE_LICENSE("GPL v2"); -From 5f645d53ff8cd061433ae75986e3c29d672d413f Mon Sep 17 00:00:00 2001 +From e4f067be16838b65c22b3bdcd8a9dae216730cb5 Mon Sep 17 00:00:00 2001 From: Clive Messer Date: Mon, 19 Sep 2016 14:01:04 +0100 -Subject: [PATCH 077/173] Allo Piano DAC boards: Initial 2 channel (stereo) +Subject: [PATCH 082/140] 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, @@ -102744,10 +104416,10 @@ index 0000000000000000000000000000000000000000..eaf50fb6dbca1970ae1c6f8662088b0f +MODULE_DESCRIPTION("ALSA ASoC Machine Driver for Allo Piano DAC"); +MODULE_LICENSE("GPL v2"); -From 9122ceca49ddb8ce8a648cd5181e8bdd9c582086 Mon Sep 17 00:00:00 2001 +From 487311f6c5b8abef16645206d5e26a63de8c7ad5 Mon Sep 17 00:00:00 2001 From: Raashid Muhammed Date: Mon, 27 Mar 2017 12:35:00 +0530 -Subject: [PATCH 078/173] Add support for Allo Piano DAC 2.1 plus add-on board +Subject: [PATCH 083/140] 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. @@ -102763,11 +104435,13 @@ Also improve code style and adhere to ALSA coding conventions. Signed-off-by: Baswaraj K Reviewed-by: Vijay Kumar B. Reviewed-by: Raashid Muhammed + +PianoPlus: Dual Mono & Dual Stereo features added (#2069) --- sound/soc/bcm/Kconfig | 7 + sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/allo-piano-dac-plus.c | 683 ++++++++++++++++++++++++++++++++++++ - 3 files changed, 692 insertions(+) + sound/soc/bcm/allo-piano-dac-plus.c | 805 ++++++++++++++++++++++++++++++++++++ + 3 files changed, 814 insertions(+) create mode 100644 sound/soc/bcm/allo-piano-dac-plus.c diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig @@ -102804,10 +104478,10 @@ index 64f007f8ba38276a42e0bd8db92544db9412544b..023b2c17098b4e64bb188a598f0b4923 +obj-$(CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC_PLUS) += snd-soc-allo-piano-dac-plus.o diff --git a/sound/soc/bcm/allo-piano-dac-plus.c b/sound/soc/bcm/allo-piano-dac-plus.c new file mode 100644 -index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3c08517eb +index 0000000000000000000000000000000000000000..d4e99e3c6a383d92fb0cf9e8c1cd1e7657358d49 --- /dev/null +++ b/sound/soc/bcm/allo-piano-dac-plus.c -@@ -0,0 +1,683 @@ +@@ -0,0 +1,805 @@ +/* + * ALSA ASoC Machine Driver for Allo Piano DAC Plus Subwoofer + * @@ -102846,6 +104520,7 @@ index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3 + +struct glb_pool { + struct mutex lock; ++ unsigned int dual_mode; + unsigned int set_lowpass; + unsigned int set_mode; + unsigned int set_rate; @@ -102857,8 +104532,8 @@ index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3 + +static struct gpio_desc *mute_gpio[2]; + -+ +static const char * const allo_piano_mode_texts[] = { ++ "None", + "2.0", + "2.1", + "2.2", @@ -102867,6 +104542,15 @@ index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3 +static const SOC_ENUM_SINGLE_DECL(allo_piano_mode_enum, + 0, 0, allo_piano_mode_texts); + ++static const char * const allo_piano_dual_mode_texts[] = { ++ "None", ++ "Dual-Mono", ++ "Dual-Stereo", ++}; ++ ++static const SOC_ENUM_SINGLE_DECL(allo_piano_dual_mode_enum, ++ 0, 0, allo_piano_dual_mode_texts); ++ +static const char * const allo_piano_dsp_low_pass_texts[] = { + "60", + "70", @@ -102892,10 +104576,10 @@ index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3 + unsigned int mode, unsigned int rate, unsigned int lowpass) +{ + const struct firmware *fw; -+ char firmware_name[60]; -+ int ret = 0, dac = 0; + struct snd_soc_card *card = rtd->card; + struct glb_pool *glb_ptr = card->drvdata; ++ char firmware_name[60]; ++ int ret = 0, dac = 0; + + if (rate <= 46000) + rate = 44100; @@ -102910,26 +104594,35 @@ index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3 + else + rate = 192000; + -+ if ((lowpass > 14) || (lowpass < 0)) -+ lowpass = 3; -+ if ((mode > 2) || (mode < 0)) -+ mode = 0; ++ if (lowpass > 14) ++ glb_ptr->set_lowpass = lowpass = 3; ++ ++ if (mode > 3) ++ glb_ptr->set_mode = mode = 0; ++ ++ if (mode > 0) ++ glb_ptr->dual_mode = 0; + + /* same configuration loaded */ + if ((rate == glb_ptr->set_rate) && (lowpass == glb_ptr->set_lowpass) + && (mode == glb_ptr->set_mode)) + return 0; + -+ if (mode == 0) { /* 2.0 */ -+ snd_soc_write(rtd->codec_dais[1]->codec, -+ PCM512x_MUTE, 0x11); ++ switch (mode) { ++ case 0: /* None */ ++ return 1; ++ ++ case 1: /* 2.0 */ ++ snd_soc_write(rtd->codec_dais[0]->codec, PCM512x_MUTE, 0x00); ++ snd_soc_write(rtd->codec_dais[1]->codec, PCM512x_MUTE, 0x11); + glb_ptr->set_rate = rate; + glb_ptr->set_mode = mode; + glb_ptr->set_lowpass = lowpass; + return 1; -+ } else { -+ snd_soc_write(rtd->codec_dais[1]->codec, -+ PCM512x_MUTE, 0x00); ++ ++ default: ++ snd_soc_write(rtd->codec_dais[0]->codec, PCM512x_MUTE, 0x00); ++ snd_soc_write(rtd->codec_dais[1]->codec, PCM512x_MUTE, 0x00); + } + + for (dac = 0; dac < rtd->num_codecs; dac++) { @@ -102938,13 +104631,13 @@ index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3 + int i = 1; + + if (dac == 0) { /* high */ -+ sprintf(firmware_name, ++ snprintf(firmware_name, sizeof(firmware_name), + "allo/piano/2.2/allo-piano-dsp-%d-%d-%d.bin", + rate, ((lowpass * 10) + 60), dac); + } else { /* low */ -+ sprintf(firmware_name, ++ snprintf(firmware_name, sizeof(firmware_name), + "allo/piano/2.%d/allo-piano-dsp-%d-%d-%d.bin", -+ mode, rate, ((lowpass * 10) + 60), dac); ++ (mode - 1), rate, ((lowpass * 10) + 60), dac); + } + + dev_info(codec->dev, "Dsp Firmware File Name: %s\n", @@ -103009,6 +104702,80 @@ index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3 + return ret; +} + ++static int snd_allo_piano_dual_mode_get(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); ++ struct glb_pool *glb_ptr = card->drvdata; ++ ++ ucontrol->value.integer.value[0] = glb_ptr->dual_mode; ++ ++ return 0; ++} ++ ++static int snd_allo_piano_dual_mode_put(struct snd_kcontrol *kcontrol, ++ struct snd_ctl_elem_value *ucontrol) ++{ ++ struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); ++ struct glb_pool *glb_ptr = card->drvdata; ++ struct snd_soc_pcm_runtime *rtd; ++ struct snd_card *snd_card_ptr = card->snd_card; ++ struct snd_kcontrol *kctl; ++ struct soc_mixer_control *mc; ++ unsigned int left_val = 0; ++ ++ rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name); ++ ++ if (ucontrol->value.integer.value[0] > 0) { ++ glb_ptr->dual_mode = ucontrol->value.integer.value[0]; ++ glb_ptr->set_mode = 0; ++ } else if (ucontrol->value.integer.value[0] <= 0) { ++ if (glb_ptr->set_mode <= 0) { ++ glb_ptr->dual_mode = 1; ++ glb_ptr->set_mode = 0; ++ } ++ } else { ++ glb_ptr->dual_mode = 0; ++ return 0; ++ } ++ ++ if (glb_ptr->dual_mode == 1) { ++ snd_soc_write(rtd->codec_dais[0]->codec, PCM512x_MUTE, 0x01); ++ snd_soc_write(rtd->codec_dais[1]->codec, PCM512x_MUTE, 0x10); ++ snd_soc_write(rtd->codec_dais[0]->codec, ++ PCM512x_DIGITAL_VOLUME_3, 0xff); ++ ++ list_for_each_entry(kctl, &snd_card_ptr->controls, list) { ++ if (!strncmp(kctl->id.name, "Digital Playback Volume", ++ sizeof(kctl->id.name))) { ++ mc = (struct soc_mixer_control *) ++ kctl->private_value; ++ mc->rreg = mc->reg; ++ break; ++ } ++ } ++ } else { ++ left_val = snd_soc_read(rtd->codec_dais[0]->codec, ++ PCM512x_DIGITAL_VOLUME_2); ++ list_for_each_entry(kctl, &snd_card_ptr->controls, list) { ++ if (!strncmp(kctl->id.name, "Digital Playback Volume", ++ sizeof(kctl->id.name))) { ++ mc = (struct soc_mixer_control *) ++ kctl->private_value; ++ mc->rreg = PCM512x_DIGITAL_VOLUME_3; ++ break; ++ } ++ } ++ ++ snd_soc_write(rtd->codec_dais[0]->codec, ++ PCM512x_DIGITAL_VOLUME_3, left_val); ++ snd_soc_write(rtd->codec_dais[0]->codec, PCM512x_MUTE, 0x00); ++ snd_soc_write(rtd->codec_dais[1]->codec, PCM512x_MUTE, 0x00); ++ } ++ ++ return 0; ++} ++ +static int snd_allo_piano_mode_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) +{ @@ -103025,8 +104792,30 @@ index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3 + struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); + struct snd_soc_pcm_runtime *rtd; + struct glb_pool *glb_ptr = card->drvdata; ++ struct snd_card *snd_card_ptr = card->snd_card; ++ struct snd_kcontrol *kctl; ++ struct soc_mixer_control *mc; ++ unsigned int left_val = 0; + + rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name); ++ ++ if ((glb_ptr->dual_mode == 1) && ++ (ucontrol->value.integer.value[0] > 0)) { ++ left_val = snd_soc_read(rtd->codec_dais[0]->codec, ++ PCM512x_DIGITAL_VOLUME_2); ++ list_for_each_entry(kctl, &snd_card_ptr->controls, list) { ++ if (!strncmp(kctl->id.name, "Digital Playback Volume", ++ sizeof(kctl->id.name))) { ++ mc = (struct soc_mixer_control *) ++ kctl->private_value; ++ mc->rreg = PCM512x_DIGITAL_VOLUME_3; ++ break; ++ } ++ } ++ snd_soc_write(rtd->codec_dais[0]->codec, ++ PCM512x_DIGITAL_VOLUME_3, left_val); ++ } ++ + return(snd_allo_piano_dsp_program(rtd, + ucontrol->value.integer.value[0], + glb_ptr->set_rate, glb_ptr->set_lowpass)); @@ -103154,6 +104943,11 @@ index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3 + snd_allo_piano_mode_get, + snd_allo_piano_mode_put), + ++ SOC_ENUM_EXT("Dual Mode Route", ++ allo_piano_dual_mode_enum, ++ snd_allo_piano_dual_mode_get, ++ snd_allo_piano_dual_mode_put), ++ + SOC_ENUM_EXT("Lowpass Route", allo_piano_enum, + snd_allo_piano_lowpass_get, + snd_allo_piano_lowpass_put), @@ -103282,7 +105076,7 @@ index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3 + PCM512x_RATE_DET_4); + if (val < 0) { + dev_err(rtd->codec_dais[dac]->codec->dev, -+ "Failed to read register PCM512x_RATE_DET_4\n"); ++ "Failed to read register PCM512x_RATE_DET_4\n"); + return val; + } + @@ -103292,7 +105086,7 @@ index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3 + PCM512x_SREF_BCK); + + dev_info(rtd->codec_dais[dac]->codec->dev, -+ "Setting BCLK as input clock & Enable PLL\n"); ++ "Setting BCLK as input clock & Enable PLL\n"); + } else { + snd_soc_write(rtd->codec_dais[dac]->codec, + PCM512x_PLL_EN, @@ -103303,7 +105097,7 @@ index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3 + PCM512x_SREF_SCK); + + dev_info(rtd->codec_dais[dac]->codec->dev, -+ "Setting SCLK as input clock & disabled PLL\n"); ++ "Setting SCLK as input clock & disabled PLL\n"); + } + } + @@ -103314,6 +105108,7 @@ index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3 + 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) @@ -103331,6 +105126,7 @@ index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3 + struct snd_soc_card *card = rtd->card; + + snd_allo_piano_gpio_unmute(card); ++ + return 0; +} + @@ -103492,11 +105288,11 @@ index 0000000000000000000000000000000000000000..56e43f98846b41e487b3089813f7edc3 +MODULE_DESCRIPTION("ALSA ASoC Machine Driver for Allo Piano DAC Plus"); +MODULE_LICENSE("GPL v2"); -From 74245f043c6887e406fe0a5cb7c75074985b8ca5 Mon Sep 17 00:00:00 2001 +From b10d8862688ede1ea743346a337ba147bf55262c Mon Sep 17 00:00:00 2001 From: BabuSubashChandar Date: Tue, 28 Mar 2017 20:04:42 +0530 -Subject: [PATCH 079/173] Add support for Allo Boss DAC add-on board for - Raspberry Pi. (#1924) +Subject: [PATCH 084/140] Add support for Allo Boss DAC add-on board for + Raspberry Pi. (#1924) Signed-off-by: Baswaraj K Reviewed-by: Deepak @@ -104198,10 +105994,10 @@ index 0000000000000000000000000000000000000000..203ab76c7045b081578e23bda1099dd1 +MODULE_DESCRIPTION("ALSA ASoC Machine Driver for Allo Boss DAC"); +MODULE_LICENSE("GPL v2"); -From 73c0d15d727f497ee7df6fa6f9e0829e04fe1d70 Mon Sep 17 00:00:00 2001 +From 13b67b30ed00ad876af4b2a195201fe74930a640 Mon Sep 17 00:00:00 2001 From: gtrainavicius Date: Sun, 23 Oct 2016 12:06:53 +0300 -Subject: [PATCH 080/173] Support for Blokas Labs pisound board +Subject: [PATCH 085/140] Support for Blokas Labs pisound board Pisound dynamic overlay (#1760) @@ -105400,10 +107196,10 @@ index 0000000000000000000000000000000000000000..06ff1e53dc9d860946965b6303577762 +MODULE_DESCRIPTION("ASoC Driver for pisound, http://blokas.io/pisound"); +MODULE_LICENSE("GPL v2"); -From 3dd54e337ec7f50b718a63db94550d7f3bced8e7 Mon Sep 17 00:00:00 2001 +From 483300719c269f7f05b57eadfc87f9d58c4682ba Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 22 Jan 2017 12:49:37 +0100 -Subject: [PATCH 081/173] ASoC: Add driver for Cirrus Logic Audio Card +Subject: [PATCH 086/140] 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 @@ -106468,10 +108264,10 @@ index 0000000000000000000000000000000000000000..ac8651ddff7bd3701dffe22c7fb88352 +MODULE_DESCRIPTION("ASoC driver for Cirrus Logic Audio Card"); +MODULE_LICENSE("GPL"); -From bc36160418de7ebd7bf4c4d2a52f0d769194954b Mon Sep 17 00:00:00 2001 +From 5c7ba9f1a3f7444848bde41f50fcb6d17212f189 Mon Sep 17 00:00:00 2001 From: Miquel Date: Fri, 24 Feb 2017 20:51:06 +0100 -Subject: [PATCH 082/173] sound: Support for Dion Audio LOCO-V2 DAC-AMP HAT +Subject: [PATCH 087/140] sound: Support for Dion Audio LOCO-V2 DAC-AMP HAT Signed-off-by: Miquel Blauw --- @@ -106666,10 +108462,10 @@ index 0000000000000000000000000000000000000000..a009c49477972a9832175d86f201b035 +MODULE_DESCRIPTION("ASoC Driver for DionAudio LOCO-V2"); +MODULE_LICENSE("GPL v2"); -From 314df407eb4bf4166ab8b91da5e3f73609946f50 Mon Sep 17 00:00:00 2001 +From 8b9fbdbd345bccc3a0398d316a92732fab9c78e5 Mon Sep 17 00:00:00 2001 From: Fe-Pi Date: Wed, 1 Mar 2017 04:42:43 -0700 -Subject: [PATCH 083/173] Add support for Fe-Pi audio sound card. (#1867) +Subject: [PATCH 088/140] 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. @@ -106883,10 +108679,10 @@ index 0000000000000000000000000000000000000000..015b56fd73cc36be5b5eecd17548fd03 +MODULE_DESCRIPTION("ASoC Driver for Fe-Pi Audio"); +MODULE_LICENSE("GPL v2"); -From e3ee86733ec6df9188b0d64d70877adb452c9ad6 Mon Sep 17 00:00:00 2001 +From 6fc099a2fbb15008c3318f0a5905bbac3b90b069 Mon Sep 17 00:00:00 2001 From: Matt Flax Date: Wed, 8 Mar 2017 20:04:13 +1100 -Subject: [PATCH 084/173] Add support for the AudioInjector.net Octo sound card +Subject: [PATCH 089/140] Add support for the AudioInjector.net Octo sound card AudioInjector Octo: sample rates, regulators, reset @@ -106897,11 +108693,16 @@ new supported rates are (in kHz) : Reference the bcm270x DT regulators in the overlay. This patch adds a reset GPIO for the AudioInjector.net octo sound card. + +Audioinjector octo : Make the playback and capture symmetric + +This patch ensures that the sample rate and channel count of the audioinjector +octo sound card are symmetric. --- sound/soc/bcm/Kconfig | 7 + sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/audioinjector-octo-soundcard.c | 339 +++++++++++++++++++++++++++ - 3 files changed, 348 insertions(+) + sound/soc/bcm/audioinjector-octo-soundcard.c | 341 +++++++++++++++++++++++++++ + 3 files changed, 350 insertions(+) create mode 100644 sound/soc/bcm/audioinjector-octo-soundcard.c diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig @@ -106944,10 +108745,10 @@ index c3feaf198d997935fdf6815f9f8555d8704e53af..113b6899dd9fd6c4a6f706f57e32201d obj-$(CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO_V2) += snd-soc-dionaudio-loco-v2.o diff --git a/sound/soc/bcm/audioinjector-octo-soundcard.c b/sound/soc/bcm/audioinjector-octo-soundcard.c new file mode 100644 -index 0000000000000000000000000000000000000000..dcf403ab37639ba79e38278d7e4b1ade452c292a +index 0000000000000000000000000000000000000000..5e79f4eff93a21ed3495c77a90f73525695cb3d5 --- /dev/null +++ b/sound/soc/bcm/audioinjector-octo-soundcard.c -@@ -0,0 +1,339 @@ +@@ -0,0 +1,341 @@ +/* + * ASoC Driver for AudioInjector Pi octo channel soundcard (hat) + * @@ -107154,6 +108955,8 @@ index 0000000000000000000000000000000000000000..dcf403ab37639ba79e38278d7e4b1ade + .codec_dai_name = "cs42448", + .ops = &audioinjector_octo_ops, + .init = audioinjector_octo_dai_init, ++ .symmetric_rates = 1, ++ .symmetric_channels = 1, + }, +}; + @@ -107274,7 +109077,7 @@ index 0000000000000000000000000000000000000000..dcf403ab37639ba79e38278d7e4b1ade + +static struct platform_driver audioinjector_octo_driver = { + .driver = { -+ .name = "audioinjector-audio", ++ .name = "audioinjector-octo", + .owner = THIS_MODULE, + .of_match_table = audioinjector_octo_of_match, + }, @@ -107288,10 +109091,10 @@ index 0000000000000000000000000000000000000000..dcf403ab37639ba79e38278d7e4b1ade +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:audioinjector-octo-soundcard"); -From 87a8a2b436a1694ede168fa77994e29c16fec183 Mon Sep 17 00:00:00 2001 +From 36083bf5e2caae3ca21a4b7d2e95bb985f918eca Mon Sep 17 00:00:00 2001 From: Peter Malkin Date: Mon, 27 Mar 2017 16:38:21 -0700 -Subject: [PATCH 085/173] Driver support for Google voiceHAT soundcard. +Subject: [PATCH 090/140] Driver support for Google voiceHAT soundcard. --- sound/soc/bcm/Kconfig | 7 ++ @@ -107682,10 +109485,335 @@ index 0000000000000000000000000000000000000000..225854b8e5298b3c3018f59a49404354 +MODULE_DESCRIPTION("ASoC Driver for Google voiceHAT SoundCard"); +MODULE_LICENSE("GPL v2"); -From ef2d4677dbd95942ef4b799dc343411183e53f5b Mon Sep 17 00:00:00 2001 +From 09a6a9b29bd6ff6c589c863025122a1a29ffefe4 Mon Sep 17 00:00:00 2001 +From: sandeepal +Date: Fri, 2 Jun 2017 18:59:46 +0530 +Subject: [PATCH 091/140] Allo Digione Driver (#2048) + +Driver for the Allo Digione soundcard +--- + sound/soc/bcm/Kconfig | 7 ++ + sound/soc/bcm/Makefile | 2 + + sound/soc/bcm/allo-digione.c | 268 +++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 277 insertions(+) + create mode 100644 sound/soc/bcm/allo-digione.c + +diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig +index 355bdeb25f81d15593f78df0e87a48404908ca4b..381d32bb9deb3cf2c531e2a4563418cd6eb9d505 100644 +--- a/sound/soc/bcm/Kconfig ++++ b/sound/soc/bcm/Kconfig +@@ -176,6 +176,13 @@ config SND_BCM2708_SOC_ALLO_BOSS_DAC + help + Say Y or M if you want to add support for Allo Boss DAC. + ++config SND_BCM2708_SOC_ALLO_DIGIONE ++ tristate "Support for Allo DigiOne" ++ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S ++ select SND_SOC_PCM512x_I2C ++ help ++ Say Y or M if you want to add support for Allo DigiOne. ++ + config SND_BCM2708_SOC_FE_PI_AUDIO + tristate "Support for Fe-Pi-Audio" + depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S +diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile +index 72e1620fa4038035804cf3b2a09c6b12e7ae0fe1..53ea8229d7ac2065176983385dd7ba85ee3915ea 100644 +--- a/sound/soc/bcm/Makefile ++++ b/sound/soc/bcm/Makefile +@@ -34,6 +34,7 @@ snd-soc-dionaudio-loco-v2-objs := dionaudio_loco-v2.o + snd-soc-allo-boss-dac-objs := allo-boss-dac.o + snd-soc-allo-piano-dac-objs := allo-piano-dac.o + snd-soc-allo-piano-dac-plus-objs := allo-piano-dac-plus.o ++snd-soc-allo-digione-objs := allo-digione.o + snd-soc-pisound-objs := pisound.o + snd-soc-fe-pi-audio-objs := fe-pi-audio.o + +@@ -60,5 +61,6 @@ obj-$(CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO_V2) += snd-soc-dionaudio-loco-v2.o + obj-$(CONFIG_SND_BCM2708_SOC_ALLO_BOSS_DAC) += snd-soc-allo-boss-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC) += snd-soc-allo-piano-dac.o + obj-$(CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC_PLUS) += snd-soc-allo-piano-dac-plus.o ++obj-$(CONFIG_SND_BCM2708_SOC_ALLO_DIGIONE) += snd-soc-allo-digione.o + obj-$(CONFIG_SND_PISOUND) += snd-soc-pisound.o + obj-$(CONFIG_SND_BCM2708_SOC_FE_PI_AUDIO) += snd-soc-fe-pi-audio.o +diff --git a/sound/soc/bcm/allo-digione.c b/sound/soc/bcm/allo-digione.c +new file mode 100644 +index 0000000000000000000000000000000000000000..e3664e44c699d0102120ecf99e8b780a4505ebad +--- /dev/null ++++ b/sound/soc/bcm/allo-digione.c +@@ -0,0 +1,268 @@ ++/* ++ * ASoC Driver for Allo DigiOne ++ * ++ * Author: Baswaraj ++ * Copyright 2017 ++ * based on code by Daniel Matuschek ++ * based on code by Florian Meier ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License ++ * version 2 as published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ */ ++ ++#include ++#include ++ ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "../codecs/wm8804.h" ++ ++static short int auto_shutdown_output = 0; ++module_param(auto_shutdown_output, short, ++ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); ++MODULE_PARM_DESC(auto_shutdown_output, "Shutdown SP/DIF output if playback is stopped"); ++ ++#define CLK_44EN_RATE 22579200UL ++#define CLK_48EN_RATE 24576000UL ++ ++static struct gpio_desc *snd_allo_clk44gpio; ++static struct gpio_desc *snd_allo_clk48gpio; ++ ++static int samplerate = 44100; ++ ++static uint32_t snd_allo_digione_enable_clock(int sample_rate) ++{ ++ switch (sample_rate) { ++ case 11025: ++ case 22050: ++ case 44100: ++ case 88200: ++ case 176400: ++ gpiod_set_value_cansleep(snd_allo_clk44gpio, 1); ++ gpiod_set_value_cansleep(snd_allo_clk48gpio, 0); ++ return CLK_44EN_RATE; ++ default: ++ gpiod_set_value_cansleep(snd_allo_clk48gpio, 1); ++ gpiod_set_value_cansleep(snd_allo_clk44gpio, 0); ++ return CLK_48EN_RATE; ++ } ++} ++ ++ ++static int snd_allo_digione_init(struct snd_soc_pcm_runtime *rtd) ++{ ++ struct snd_soc_codec *codec = rtd->codec; ++ ++ /* enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ return 0; ++} ++ ++static int snd_allo_digione_startup(struct snd_pcm_substream *substream) ++{ ++ /* turn on digital output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); ++ return 0; ++} ++ ++static void snd_allo_digione_shutdown(struct snd_pcm_substream *substream) ++{ ++ /* turn off output */ ++ if (auto_shutdown_output) { ++ /* turn off output */ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_codec *codec = rtd->codec; ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); ++ } ++} ++ ++static int snd_allo_digione_hw_params(struct snd_pcm_substream *substream, ++ struct snd_pcm_hw_params *params) ++{ ++ struct snd_soc_pcm_runtime *rtd = substream->private_data; ++ struct snd_soc_dai *codec_dai = rtd->codec_dai; ++ struct snd_soc_codec *codec = rtd->codec; ++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; ++ ++ int sysclk = 27000000; /* This is fixed on this board */ ++ ++ long mclk_freq = 0; ++ int mclk_div = 1; ++ int sampling_freq = 1; ++ ++ int ret; ++ ++ samplerate = params_rate(params); ++ ++ if (samplerate <= 96000) { ++ mclk_freq = samplerate * 256; ++ mclk_div = WM8804_MCLKDIV_256FS; ++ } else { ++ mclk_freq = samplerate * 128; ++ mclk_div = WM8804_MCLKDIV_128FS; ++ } ++ ++ sysclk = snd_allo_digione_enable_clock(samplerate); ++ ++ switch (samplerate) { ++ case 32000: ++ sampling_freq=0x03; ++ break; ++ case 44100: ++ sampling_freq=0x00; ++ break; ++ case 48000: ++ sampling_freq=0x02; ++ break; ++ case 88200: ++ sampling_freq=0x08; ++ break; ++ case 96000: ++ sampling_freq=0x0a; ++ break; ++ case 176400: ++ sampling_freq=0x0c; ++ break; ++ case 192000: ++ sampling_freq=0x0e; ++ break; ++ default: ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", ++ samplerate); ++ } ++ ++ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); ++ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); ++ ++ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, ++ sysclk, SND_SOC_CLOCK_OUT); ++ ++ if (ret < 0) { ++ dev_err(codec->dev, ++ "Failed to set WM8804 SYSCLK: %d\n", ret); ++ return ret; ++ } ++ ++ /* Enable TX output */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); ++ ++ /* Power on */ ++ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); ++ ++ /* set sampling frequency status bits */ ++ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); ++ ++ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); ++} ++ ++/* machine stream operations */ ++static struct snd_soc_ops snd_allo_digione_ops = { ++ .hw_params = snd_allo_digione_hw_params, ++ .startup = snd_allo_digione_startup, ++ .shutdown = snd_allo_digione_shutdown, ++}; ++ ++static struct snd_soc_dai_link snd_allo_digione_dai[] = { ++{ ++ .name = "Allo DigiOne", ++ .stream_name = "Allo DigiOne HiFi", ++ .cpu_dai_name = "bcm2708-i2s.0", ++ .codec_dai_name = "wm8804-spdif", ++ .platform_name = "bcm2708-i2s.0", ++ .codec_name = "wm8804.1-003b", ++ .dai_fmt = SND_SOC_DAIFMT_I2S | ++ SND_SOC_DAIFMT_NB_NF | ++ SND_SOC_DAIFMT_CBM_CFM, ++ .ops = &snd_allo_digione_ops, ++ .init = snd_allo_digione_init, ++}, ++}; ++ ++/* audio machine driver */ ++static struct snd_soc_card snd_allo_digione = { ++ .name = "snd_allo_digione", ++ .driver_name = "AlloDigiOne", ++ .owner = THIS_MODULE, ++ .dai_link = snd_allo_digione_dai, ++ .num_links = ARRAY_SIZE(snd_allo_digione_dai), ++}; ++ ++static int snd_allo_digione_probe(struct platform_device *pdev) ++{ ++ int ret = 0; ++ ++ snd_allo_digione.dev = &pdev->dev; ++ ++ if (pdev->dev.of_node) { ++ struct device_node *i2s_node; ++ struct snd_soc_dai_link *dai = &snd_allo_digione_dai[0]; ++ i2s_node = of_parse_phandle(pdev->dev.of_node, ++ "i2s-controller", 0); ++ ++ if (i2s_node) { ++ dai->cpu_dai_name = NULL; ++ dai->cpu_of_node = i2s_node; ++ dai->platform_name = NULL; ++ dai->platform_of_node = i2s_node; ++ } ++ ++ snd_allo_clk44gpio = ++ devm_gpiod_get(&pdev->dev, "clock44", GPIOD_OUT_LOW); ++ if (IS_ERR(snd_allo_clk44gpio)) ++ dev_err(&pdev->dev, "devm_gpiod_get() failed\n"); ++ ++ snd_allo_clk48gpio = ++ devm_gpiod_get(&pdev->dev, "clock48", GPIOD_OUT_LOW); ++ if (IS_ERR(snd_allo_clk48gpio)) ++ dev_err(&pdev->dev, "devm_gpiod_get() failed\n"); ++ } ++ ++ ret = snd_soc_register_card(&snd_allo_digione); ++ if (ret && ret != -EPROBE_DEFER) ++ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", ++ ret); ++ ++ return ret; ++} ++ ++static int snd_allo_digione_remove(struct platform_device *pdev) ++{ ++ return snd_soc_unregister_card(&snd_allo_digione); ++} ++ ++static const struct of_device_id snd_allo_digione_of_match[] = { ++ { .compatible = "allo,allo-digione", }, ++ {}, ++}; ++MODULE_DEVICE_TABLE(of, snd_allo_digione_of_match); ++ ++static struct platform_driver snd_allo_digione_driver = { ++ .driver = { ++ .name = "snd-allo-digione", ++ .owner = THIS_MODULE, ++ .of_match_table = snd_allo_digione_of_match, ++ }, ++ .probe = snd_allo_digione_probe, ++ .remove = snd_allo_digione_remove, ++}; ++ ++module_platform_driver(snd_allo_digione_driver); ++ ++MODULE_AUTHOR("Baswaraj "); ++MODULE_DESCRIPTION("ASoC Driver for Allo DigiOne"); ++MODULE_LICENSE("GPL v2"); + +From 7dd4a5d27937d7ac6c8b19967d1bb7c8c400d546 Mon Sep 17 00:00:00 2001 From: P33M Date: Wed, 21 Oct 2015 14:55:21 +0100 -Subject: [PATCH 086/173] rpi_display: add backlight driver and overlay +Subject: [PATCH 092/140] 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 @@ -107854,10 +109982,10 @@ index 0000000000000000000000000000000000000000..14a0d9b037395497c1fdae2961feccd5 +MODULE_DESCRIPTION("Raspberry Pi mailbox based Backlight Driver"); +MODULE_LICENSE("GPL"); -From 80071abd1a5757097e30e3474d7945df9e5e1540 Mon Sep 17 00:00:00 2001 +From d58cbfb78e4453dfc9bee758e007ef62ec3b61d6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 23 Feb 2016 19:56:04 +0000 -Subject: [PATCH 087/173] bcm2835-virtgpio: Virtual GPIO driver +Subject: [PATCH 093/140] bcm2835-virtgpio: Virtual GPIO driver Add a virtual GPIO driver that uses the firmware mailbox interface to request that the VPU toggles LEDs. @@ -108131,10 +110259,10 @@ index 4a3d79d3b48eb483a4e4bf498f617515e3ad158f..5f34e1257117fb48013c9926a8a223d6 RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT = 0x0004800f, -From 8bda6e9cef790aab89b07d56fbbea72db787bc32 Mon Sep 17 00:00:00 2001 +From e159ad377562e591fd9f325d5c078e3c4c4fbb7e Mon Sep 17 00:00:00 2001 From: Dave Stevenson Date: Mon, 20 Feb 2017 17:01:21 +0000 -Subject: [PATCH 088/173] bcm2835-gpio-exp: Driver for GPIO expander via +Subject: [PATCH 094/140] bcm2835-gpio-exp: Driver for GPIO expander via mailbox service Pi3 and Compute Module 3 have a GPIO expander that the @@ -108460,10 +110588,10 @@ index 5f34e1257117fb48013c9926a8a223d64a598ab7..c819c21b0158a59c1308882e5a40e3f3 /* Dispmanx TAGS */ RPI_FIRMWARE_FRAMEBUFFER_ALLOCATE = 0x00040001, -From 4982ff8f2f3780a6d82f03da3f52375b602e0d28 Mon Sep 17 00:00:00 2001 +From 649c6b45bf6bcfe75291df59295fa9b877252cb1 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 23 Feb 2016 17:26:48 +0000 -Subject: [PATCH 089/173] amba_pl011: Don't use DT aliases for numbering +Subject: [PATCH 095/140] 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 @@ -108492,10 +110620,10 @@ index 1888d168a41c87c605962da2605df8ab1c02bd20..e22b9e79836a6aeef4c8f9fb618b9595 uap->old_cr = 0; uap->port.dev = dev; -From a9fa581c618a4ad0f041e7ff6f82e5fad0f7cdb4 Mon Sep 17 00:00:00 2001 +From 97dea4a3e5882a052896e287c8f5bfdc38124c22 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 1 Mar 2017 16:07:39 +0000 -Subject: [PATCH 090/173] amba_pl011: Round input clock up +Subject: [PATCH 096/140] 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 @@ -108581,10 +110709,10 @@ index e22b9e79836a6aeef4c8f9fb618b9595c551500f..4b815abbf9913075885ee60f4d9ad49d /* unregisters the driver also if no more ports are left */ static void pl011_unregister_port(struct uart_amba_port *uap) -From 7bae3b057de6271cc60c5fb58df61de79ba11ff5 Mon Sep 17 00:00:00 2001 +From 775b6bba8e2bf257cf3eb2a6478d04dd7e5a4f74 Mon Sep 17 00:00:00 2001 From: Pantelis Antoniou Date: Wed, 3 Dec 2014 13:23:28 +0200 -Subject: [PATCH 091/173] OF: DT-Overlay configfs interface +Subject: [PATCH 097/140] 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. @@ -109016,10 +111144,10 @@ index 0000000000000000000000000000000000000000..0037e6868a6cda8706c88194c6a4454b +} +late_initcall(of_cfs_init); -From ee744cbd4f413ecab6f664274972c3807c9d606e Mon Sep 17 00:00:00 2001 +From ccf9d17ab87c0aa8740d1534f9a936389540e74a Mon Sep 17 00:00:00 2001 From: Cheong2K Date: Fri, 26 Feb 2016 18:20:10 +0800 -Subject: [PATCH 092/173] brcm: adds support for BCM43341 wifi +Subject: [PATCH 098/140] brcm: adds support for BCM43341 wifi brcmfmac: Disable power management @@ -109065,10 +111193,10 @@ Signed-off-by: Phil Elwell 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -index 7e689c86d56576cf96ca755b16107216470fccdf..508cab2d0817914d454958f92167d350c74d9a5d 100644 +index f27d6fe4d5c0ef9af4e5f14e45c8abb4cf94d901..2145343c18c91f6a43543eb42ca7bbc7a37f14b5 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -2821,6 +2821,8 @@ brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *ndev, +@@ -2810,6 +2810,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 */ @@ -109077,7 +111205,7 @@ index 7e689c86d56576cf96ca755b16107216470fccdf..508cab2d0817914d454958f92167d350 cfg->pwr_save = enabled; if (!check_vif_up(ifp->vif)) { -@@ -6851,12 +6853,18 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], +@@ -6852,12 +6854,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; @@ -109098,7 +111226,7 @@ index 7e689c86d56576cf96ca755b16107216470fccdf..508cab2d0817914d454958f92167d350 } if ((alpha2[0] == ccreq->country_abbrev[0]) && -@@ -6880,10 +6888,14 @@ static s32 brcmf_translate_country_code(struct brcmf_pub *drvr, char alpha2[2], +@@ -6881,10 +6889,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; } @@ -109151,10 +111279,10 @@ index f3556122c6ace17c419e13023057861957a507fa..f8d4647016a1cde3d51dd43da07a46ce BRCMF_FW_NVRAM_ENTRY(BRCM_CC_43362_CHIP_ID, 0xFFFFFFFE, 43362), BRCMF_FW_NVRAM_ENTRY(BRCM_CC_4339_CHIP_ID, 0xFFFFFFFF, 4339), -From 862219e4c44154cb99abcdd78281a2082de3d53f Mon Sep 17 00:00:00 2001 +From 73961925dc0b241f5118707237772f00d03dc1c9 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Fri, 17 Feb 2017 15:26:13 +0000 -Subject: [PATCH 093/173] brcmfmac: Mute expected startup 'errors' +Subject: [PATCH 099/140] brcmfmac: Mute expected startup 'errors' The brcmfmac WiFi driver always complains about the '00' country code. Modify the driver to ignore '00' silently. @@ -109165,10 +111293,10 @@ Signed-off-by: Phil Elwell 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -index 508cab2d0817914d454958f92167d350c74d9a5d..987b1f5b999b0ecb68b6ce741b8e3ddbfab2bcc0 100644 +index 2145343c18c91f6a43543eb42ca7bbc7a37f14b5..0f7b4e6b5ee3485806cd93873f00af347613cdc8 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c -@@ -6919,6 +6919,8 @@ static void brcmf_cfg80211_reg_notifier(struct wiphy *wiphy, +@@ -6920,6 +6920,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') { @@ -109178,10 +111306,10 @@ index 508cab2d0817914d454958f92167d350c74d9a5d..987b1f5b999b0ecb68b6ce741b8e3ddb req->alpha2[0], req->alpha2[1]); return; -From 1c5d4e984dc9d4729c336c7d56f41507f0973806 Mon Sep 17 00:00:00 2001 +From afd7b2d7e39d1712bf9da1ce86aaa0b261866cc0 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 17 Dec 2015 13:37:07 +0000 -Subject: [PATCH 094/173] hci_h5: Don't send conf_req when ACTIVE +Subject: [PATCH 100/140] 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. @@ -109204,24 +111332,24 @@ index c0e4e26dc30d7c3c6a771b7b86df88c8cf763646..7308287259eedcaf229f8a496a0e3826 if (H5_HDR_LEN(hdr) > 2) h5->tx_win = (data[2] & 0x07); -From 3de80acbf475780288c867ec9b885da847d90d4a Mon Sep 17 00:00:00 2001 +From 58c09ea42879034082a369944349310c260a0505 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Apr 2015 17:16:29 +0100 -Subject: [PATCH 095/173] config: Add default configs +Subject: [PATCH 101/140] config: Add default configs --- - arch/arm/configs/bcm2709_defconfig | 1312 +++++++++++++++++++++++++++++++++++ - arch/arm/configs/bcmrpi_defconfig | 1318 ++++++++++++++++++++++++++++++++++++ - 2 files changed, 2630 insertions(+) + arch/arm/configs/bcm2709_defconfig | 1326 +++++++++++++++++++++++++++++++++++ + arch/arm/configs/bcmrpi_defconfig | 1331 ++++++++++++++++++++++++++++++++++++ + 2 files changed, 2657 insertions(+) create mode 100644 arch/arm/configs/bcm2709_defconfig create mode 100644 arch/arm/configs/bcmrpi_defconfig diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig new file mode 100644 -index 0000000000000000000000000000000000000000..93cdfa4ce3e7d3ff9f437a05a9ee6bcf4b895a20 +index 0000000000000000000000000000000000000000..62909413e1d625a1d33559d965ee8707ca57ba91 --- /dev/null +++ b/arch/arm/configs/bcm2709_defconfig -@@ -0,0 +1,1312 @@ +@@ -0,0 +1,1326 @@ +CONFIG_LOCALVERSION="-v7" +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_SYSVIPC=y @@ -109327,9 +111455,11 @@ index 0000000000000000000000000000000000000000..93cdfa4ce3e7d3ff9f437a05a9ee6bcf +CONFIG_TCP_CONG_BBR=m +CONFIG_IPV6=m +CONFIG_IPV6_ROUTER_PREF=y ++CONFIG_IPV6_ROUTE_INFO=y +CONFIG_INET6_AH=m +CONFIG_INET6_ESP=m +CONFIG_INET6_IPCOMP=m ++CONFIG_IPV6_SIT_6RD=y +CONFIG_IPV6_TUNNEL=m +CONFIG_IPV6_MULTIPLE_TABLES=y +CONFIG_IPV6_SUBTREES=y @@ -109584,6 +111714,7 @@ index 0000000000000000000000000000000000000000..93cdfa4ce3e7d3ff9f437a05a9ee6bcf +CONFIG_CAN_VCAN=m +CONFIG_CAN_SLCAN=m +CONFIG_CAN_MCP251X=m ++CONFIG_CAN_GS_USB=m +CONFIG_IRDA=m +CONFIG_IRLAN=m +CONFIG_IRNET=m @@ -109789,6 +111920,7 @@ index 0000000000000000000000000000000000000000..93cdfa4ce3e7d3ff9f437a05a9ee6bcf +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_ADS7846=m +CONFIG_TOUCHSCREEN_EGALAX=m ++CONFIG_TOUCHSCREEN_GOODIX=m +CONFIG_TOUCHSCREEN_EDT_FT5X06=m +CONFIG_TOUCHSCREEN_RPI_FT5406=m +CONFIG_TOUCHSCREEN_USB_COMPOSITE=m @@ -109838,6 +111970,7 @@ index 0000000000000000000000000000000000000000..93cdfa4ce3e7d3ff9f437a05a9ee6bcf +CONFIG_I2C_BCM2708=m +CONFIG_I2C_BCM2835=m +CONFIG_I2C_GPIO=m ++CONFIG_I2C_ROBOTFUZZ_OSIF=m +CONFIG_SPI=y +CONFIG_SPI_BCM2835=m +CONFIG_SPI_BCM2835AUX=m @@ -109873,11 +112006,13 @@ index 0000000000000000000000000000000000000000..93cdfa4ce3e7d3ff9f437a05a9ee6bcf +CONFIG_POWER_RESET_GPIO=y +CONFIG_BATTERY_DS2760=m +CONFIG_HWMON=m ++CONFIG_SENSORS_JC42=m +CONFIG_SENSORS_LM75=m +CONFIG_SENSORS_SHT21=m +CONFIG_SENSORS_SHTC1=m +CONFIG_SENSORS_ADS1015=m +CONFIG_SENSORS_INA2XX=m ++CONFIG_SENSORS_TMP102=m +CONFIG_THERMAL=y +CONFIG_BCM2835_THERMAL=y +CONFIG_WATCHDOG=y @@ -109889,6 +112024,8 @@ index 0000000000000000000000000000000000000000..93cdfa4ce3e7d3ff9f437a05a9ee6bcf +CONFIG_MFD_WM5102=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=m ++CONFIG_REGULATOR_ARIZONA_LDO1=m ++CONFIG_REGULATOR_ARIZONA_MICSUPP=m +CONFIG_MEDIA_SUPPORT=m +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y @@ -110107,13 +112244,16 @@ index 0000000000000000000000000000000000000000..93cdfa4ce3e7d3ff9f437a05a9ee6bcf +CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m +CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC_PLUS=m +CONFIG_SND_BCM2708_SOC_ALLO_BOSS_DAC=m ++CONFIG_SND_BCM2708_SOC_ALLO_DIGIONE=m +CONFIG_SND_BCM2708_SOC_FE_PI_AUDIO=m +CONFIG_SND_PISOUND=m +CONFIG_SND_SOC_ADAU1701=m +CONFIG_SND_SOC_ADAU7002=m +CONFIG_SND_SOC_AK4554=m ++CONFIG_SND_SOC_SPDIF=m +CONFIG_SND_SOC_WM8804_I2C=m +CONFIG_SND_SIMPLE_CARD=m ++CONFIG_HID_BATTERY_STRENGTH=y +CONFIG_HIDRAW=y +CONFIG_UHID=m +CONFIG_HID_A4TECH=m @@ -110156,6 +112296,7 @@ index 0000000000000000000000000000000000000000..93cdfa4ce3e7d3ff9f437a05a9ee6bcf +CONFIG_HID_ROCCAT=m +CONFIG_HID_SAMSUNG=m +CONFIG_HID_SONY=m ++CONFIG_SONY_FF=y +CONFIG_HID_SPEEDLINK=m +CONFIG_HID_SUNPLUS=m +CONFIG_HID_GREENASIA=m @@ -110361,6 +112502,7 @@ index 0000000000000000000000000000000000000000..93cdfa4ce3e7d3ff9f437a05a9ee6bcf +CONFIG_FB_TFT_SSD1331=m +CONFIG_FB_TFT_SSD1351=m +CONFIG_FB_TFT_ST7735R=m ++CONFIG_FB_TFT_ST7789V=m +CONFIG_FB_TFT_TINYLCD=m +CONFIG_FB_TFT_TLS8204=m +CONFIG_FB_TFT_UC1701=m @@ -110379,13 +112521,13 @@ index 0000000000000000000000000000000000000000..93cdfa4ce3e7d3ff9f437a05a9ee6bcf +CONFIG_EXTCON=m +CONFIG_EXTCON_ARIZONA=m +CONFIG_IIO=m -+CONFIG_IIO_BUFFER=y +CONFIG_IIO_BUFFER_CB=m -+CONFIG_IIO_KFIFO_BUF=m +CONFIG_MCP320X=m +CONFIG_MCP3422=m +CONFIG_DHT11=m +CONFIG_HTU21=m ++CONFIG_INV_MPU6050_I2C=m ++CONFIG_BMP280=m +CONFIG_PWM_BCM2835=m +CONFIG_PWM_PCA9685=m +CONFIG_RASPBERRYPI_FIRMWARE=y @@ -110536,10 +112678,10 @@ index 0000000000000000000000000000000000000000..93cdfa4ce3e7d3ff9f437a05a9ee6bcf +CONFIG_LIBCRC32C=y diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig new file mode 100644 -index 0000000000000000000000000000000000000000..29fd2abc2cbfcaed37cb630b5edffaa5b4994f6e +index 0000000000000000000000000000000000000000..e0dd8723047ff488e81a03ef42fdbc68c43dc721 --- /dev/null +++ b/arch/arm/configs/bcmrpi_defconfig -@@ -0,0 +1,1318 @@ +@@ -0,0 +1,1331 @@ +# CONFIG_LOCALVERSION_AUTO is not set +CONFIG_SYSVIPC=y +CONFIG_POSIX_MQUEUE=y @@ -110640,9 +112782,11 @@ index 0000000000000000000000000000000000000000..29fd2abc2cbfcaed37cb630b5edffaa5 +CONFIG_TCP_CONG_BBR=m +CONFIG_IPV6=m +CONFIG_IPV6_ROUTER_PREF=y ++CONFIG_IPV6_ROUTE_INFO=y +CONFIG_INET6_AH=m +CONFIG_INET6_ESP=m +CONFIG_INET6_IPCOMP=m ++CONFIG_IPV6_SIT_6RD=y +CONFIG_IPV6_TUNNEL=m +CONFIG_IPV6_MULTIPLE_TABLES=y +CONFIG_IPV6_SUBTREES=y @@ -110897,6 +113041,7 @@ index 0000000000000000000000000000000000000000..29fd2abc2cbfcaed37cb630b5edffaa5 +CONFIG_CAN_VCAN=m +CONFIG_CAN_SLCAN=m +CONFIG_CAN_MCP251X=m ++CONFIG_CAN_GS_USB=m +CONFIG_IRDA=m +CONFIG_IRLAN=m +CONFIG_IRNET=m @@ -111102,8 +113247,8 @@ index 0000000000000000000000000000000000000000..29fd2abc2cbfcaed37cb630b5edffaa5 +CONFIG_INPUT_TOUCHSCREEN=y +CONFIG_TOUCHSCREEN_ADS7846=m +CONFIG_TOUCHSCREEN_EGALAX=m -+CONFIG_TOUCHSCREEN_EDT_FT5X06=m +CONFIG_TOUCHSCREEN_GOODIX=m ++CONFIG_TOUCHSCREEN_EDT_FT5X06=m +CONFIG_TOUCHSCREEN_RPI_FT5406=m +CONFIG_TOUCHSCREEN_USB_COMPOSITE=m +CONFIG_TOUCHSCREEN_STMPE=m @@ -111152,6 +113297,7 @@ index 0000000000000000000000000000000000000000..29fd2abc2cbfcaed37cb630b5edffaa5 +CONFIG_I2C_BCM2708=m +CONFIG_I2C_BCM2835=m +CONFIG_I2C_GPIO=m ++CONFIG_I2C_ROBOTFUZZ_OSIF=m +CONFIG_SPI=y +CONFIG_SPI_BCM2835=m +CONFIG_SPI_BCM2835AUX=m @@ -111185,11 +113331,13 @@ index 0000000000000000000000000000000000000000..29fd2abc2cbfcaed37cb630b5edffaa5 +CONFIG_POWER_RESET_GPIO=y +CONFIG_BATTERY_DS2760=m +CONFIG_HWMON=m ++CONFIG_SENSORS_JC42=m +CONFIG_SENSORS_LM75=m +CONFIG_SENSORS_SHT21=m +CONFIG_SENSORS_SHTC1=m +CONFIG_SENSORS_ADS1015=m +CONFIG_SENSORS_INA2XX=m ++CONFIG_SENSORS_TMP102=m +CONFIG_THERMAL=y +CONFIG_BCM2835_THERMAL=y +CONFIG_WATCHDOG=y @@ -111201,6 +113349,8 @@ index 0000000000000000000000000000000000000000..29fd2abc2cbfcaed37cb630b5edffaa5 +CONFIG_MFD_WM5102=y +CONFIG_REGULATOR=y +CONFIG_REGULATOR_FIXED_VOLTAGE=m ++CONFIG_REGULATOR_ARIZONA_LDO1=m ++CONFIG_REGULATOR_ARIZONA_MICSUPP=m +CONFIG_MEDIA_SUPPORT=m +CONFIG_MEDIA_CAMERA_SUPPORT=y +CONFIG_MEDIA_ANALOG_TV_SUPPORT=y @@ -111419,13 +113569,16 @@ index 0000000000000000000000000000000000000000..29fd2abc2cbfcaed37cb630b5edffaa5 +CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m +CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC_PLUS=m +CONFIG_SND_BCM2708_SOC_ALLO_BOSS_DAC=m ++CONFIG_SND_BCM2708_SOC_ALLO_DIGIONE=m +CONFIG_SND_BCM2708_SOC_FE_PI_AUDIO=m +CONFIG_SND_PISOUND=m +CONFIG_SND_SOC_ADAU1701=m +CONFIG_SND_SOC_ADAU7002=m +CONFIG_SND_SOC_AK4554=m ++CONFIG_SND_SOC_SPDIF=m +CONFIG_SND_SOC_WM8804_I2C=m +CONFIG_SND_SIMPLE_CARD=m ++CONFIG_HID_BATTERY_STRENGTH=y +CONFIG_HIDRAW=y +CONFIG_UHID=m +CONFIG_HID_A4TECH=m @@ -111468,6 +113621,7 @@ index 0000000000000000000000000000000000000000..29fd2abc2cbfcaed37cb630b5edffaa5 +CONFIG_HID_ROCCAT=m +CONFIG_HID_SAMSUNG=m +CONFIG_HID_SONY=m ++CONFIG_SONY_FF=y +CONFIG_HID_SPEEDLINK=m +CONFIG_HID_SUNPLUS=m +CONFIG_HID_GREENASIA=m @@ -111686,6 +113840,7 @@ index 0000000000000000000000000000000000000000..29fd2abc2cbfcaed37cb630b5edffaa5 +CONFIG_FB_TFT_SSD1331=m +CONFIG_FB_TFT_SSD1351=m +CONFIG_FB_TFT_ST7735R=m ++CONFIG_FB_TFT_ST7789V=m +CONFIG_FB_TFT_TINYLCD=m +CONFIG_FB_TFT_TLS8204=m +CONFIG_FB_TFT_UC1701=m @@ -111704,13 +113859,13 @@ index 0000000000000000000000000000000000000000..29fd2abc2cbfcaed37cb630b5edffaa5 +CONFIG_EXTCON=m +CONFIG_EXTCON_ARIZONA=m +CONFIG_IIO=m -+CONFIG_IIO_BUFFER=y +CONFIG_IIO_BUFFER_CB=m -+CONFIG_IIO_KFIFO_BUF=m +CONFIG_MCP320X=m +CONFIG_MCP3422=m +CONFIG_DHT11=m +CONFIG_HTU21=m ++CONFIG_INV_MPU6050_I2C=m ++CONFIG_BMP280=m +CONFIG_PWM_BCM2835=m +CONFIG_PWM_PCA9685=m +CONFIG_RASPBERRYPI_FIRMWARE=y @@ -111859,10 +114014,10 @@ index 0000000000000000000000000000000000000000..29fd2abc2cbfcaed37cb630b5edffaa5 +CONFIG_CRC_ITU_T=y +CONFIG_LIBCRC32C=y -From aa0d7e5a28f52a73aa338d6460da265ff880861b Mon Sep 17 00:00:00 2001 +From 52692e6fb51071aba67a21dfed7ef26b936b1f5e Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Wed, 24 Aug 2016 03:35:56 -0700 -Subject: [PATCH 096/173] Add arm64 configuration and device tree differences. +Subject: [PATCH 102/140] Add arm64 configuration and device tree differences. Disable MMC_BCM2835_SDHOST and MMC_BCM2835 since these drivers are crashing at the moment. @@ -113276,10 +115431,10 @@ index 0000000000000000000000000000000000000000..e6b09fafa27eed2b762e3d53b55041f7 +CONFIG_LIBCRC32C=y +CONFIG_BCM2835_VCHIQ=n -From 8e2219a0baafc84fd4d99777767c2fb2af678d61 Mon Sep 17 00:00:00 2001 +From 5e6067a57caafa51959926d333bcacf178712847 Mon Sep 17 00:00:00 2001 From: Electron752 Date: Thu, 12 Jan 2017 07:07:08 -0800 -Subject: [PATCH 097/173] ARM64: Make it work again on 4.9 (#1790) +Subject: [PATCH 103/140] 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. @@ -113288,10 +115443,10 @@ Subject: [PATCH 097/173] ARM64: Make it work again on 4.9 (#1790) Signed-off-by: Michael Zoran --- arch/arm64/Kconfig.platforms | 28 -------- - arch/arm64/boot/dts/broadcom/Makefile | 9 +++ + arch/arm64/boot/dts/broadcom/Makefile | 11 ++- arch/arm64/boot/dts/overlays | 1 + arch/arm64/configs/bcmrpi3_defconfig | 125 +++++++++++----------------------- - 4 files changed, 48 insertions(+), 115 deletions(-) + 4 files changed, 49 insertions(+), 116 deletions(-) create mode 120000 arch/arm64/boot/dts/overlays diff --git a/arch/arm64/Kconfig.platforms b/arch/arm64/Kconfig.platforms @@ -113333,10 +115488,10 @@ index d8550598e3403e7d35050e48e71bac17ed8dc493..1b7f6ea1171f5cc7a1df649d146520c1 bool "Allwinner sunxi 64-bit SoC Family" select ARCH_HAS_RESET_CONTROLLER diff --git a/arch/arm64/boot/dts/broadcom/Makefile b/arch/arm64/boot/dts/broadcom/Makefile -index 1046bed8bf1509eaf3127733b9263fa39a166895..97af2ececc52ca3aad7b84dc2fdb5c269a45bde0 100644 +index 1046bed8bf1509eaf3127733b9263fa39a166895..3b76320112196a1fce7a0941c696fd1ec43b817f 100644 --- a/arch/arm64/boot/dts/broadcom/Makefile +++ b/arch/arm64/boot/dts/broadcom/Makefile -@@ -1,6 +1,15 @@ +@@ -1,8 +1,17 @@ +# Enable fixups to support overlays on BCM2835 platforms + +ifeq ($(CONFIG_ARCH_BCM2835),y) @@ -113350,8 +115505,11 @@ index 1046bed8bf1509eaf3127733b9263fa39a166895..97af2ececc52ca3aad7b84dc2fdb5c26 + +dts-dirs += ../overlays - dts-dirs := stingray +-dts-dirs := stingray ++dts-dirs += stingray always := $(dtb-y) + subdir-y := $(dts-dirs) + clean-files := *.dtb diff --git a/arch/arm64/boot/dts/overlays b/arch/arm64/boot/dts/overlays new file mode 120000 index 0000000000000000000000000000000000000000..ded08646b6f66cdf734f8bf9c1be3a2e3a7103d7 @@ -113688,10 +115846,10 @@ index e6b09fafa27eed2b762e3d53b55041f793683d27..c7e891d72969a388d9b135a36dbfc9c9 CONFIG_LIBCRC32C=y -CONFIG_BCM2835_VCHIQ=n -From 22c1d2230b0a3c24579468f54d01fa5de1596eb4 Mon Sep 17 00:00:00 2001 +From a58835766a9c4e97a6c772acad04add80c41d2de Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Thu, 12 Jan 2017 19:10:07 -0800 -Subject: [PATCH 098/173] ARM64: Enable HDMI audio and vc04_services in +Subject: [PATCH 104/140] ARM64: Enable HDMI audio and vc04_services in bcmrpi3_defconfig Signed-off-by: Michael Zoran @@ -113720,10 +115878,10 @@ index c7e891d72969a388d9b135a36dbfc9c9cb609bf8..4b90f9b64abe9f089ba56b13d5a00de3 CONFIG_BCM2835_MBOX=y # CONFIG_IOMMU_SUPPORT is not set -From 7b4499e2b9552b0b365016240a16c8072bb5f627 Mon Sep 17 00:00:00 2001 +From bfb1c145e90669e32a6096f18e1a91d207096aed Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Thu, 12 Jan 2017 19:14:03 -0800 -Subject: [PATCH 099/173] ARM64: Run bcmrpi3_defconfig through savedefconfig. +Subject: [PATCH 105/140] ARM64: Run bcmrpi3_defconfig through savedefconfig. Signed-off-by: Michael Zoran --- @@ -113768,10 +115926,10 @@ index 4b90f9b64abe9f089ba56b13d5a00de33343bfb9..dac962ca1634662ce7d966f1ffb53b5b CONFIG_FB_TFT_AGM1264K_FL=m CONFIG_FB_TFT_BD663474=m -From 17093b0945689c18b8695f59f9994313671ab152 Mon Sep 17 00:00:00 2001 +From 501721a584fac6afc8f6dddbb9459bec0e3c6975 Mon Sep 17 00:00:00 2001 From: Electron752 Date: Sat, 14 Jan 2017 02:54:26 -0800 -Subject: [PATCH 100/173] ARM64: Enable Kernel Address Space Randomization +Subject: [PATCH 106/140] ARM64: Enable Kernel Address Space Randomization (#1792) Randomization allows the mapping between virtual addresses and physical @@ -113803,10 +115961,10 @@ index dac962ca1634662ce7d966f1ffb53b5bfa27c506..aae33b4b3c3e736ea7cd3ca242158ad6 CONFIG_BINFMT_MISC=y CONFIG_COMPAT=y -From 4e8ce0d9fe85bd01daead09f28aa2be3cbce7edb Mon Sep 17 00:00:00 2001 +From f745912853b2650e4599a184bda3e77af92beeb4 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sun, 15 Jan 2017 07:31:59 -0800 -Subject: [PATCH 101/173] ARM64: Enable RTL8187/RTL8192CU wifi in build config +Subject: [PATCH 107/140] 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 @@ -113831,10 +115989,10 @@ index aae33b4b3c3e736ea7cd3ca242158ad6ba558aff..b7d762df19b85e369a32cd823dfd0621 CONFIG_ZD1211RW=m CONFIG_MAC80211_HWSIM=m -From 5144c8dd8cfdaecf22c4bc4b7aabbae11faa034f Mon Sep 17 00:00:00 2001 +From 356a07a55d720520a31fe07517a4056b3458343e Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sat, 14 Jan 2017 21:33:51 -0800 -Subject: [PATCH 102/173] ARM64/DWC_OTG: Port dwc_otg driver to ARM64 +Subject: [PATCH 108/140] 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 @@ -113891,7 +116049,7 @@ index e7bdd12015fee1727a7956ae3e3b2786e88892c1..4872b8113b68bc9087cf5e128657c580 dwc_otg-objs += dwc_otg_cfi.o endif diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c -index 2035e0762dc6d60673c8fbc47a90b72254f50b69..208252645c09d1d17bf07673989f91b7f4b3ef7a 100644 +index b7731e7edb4602f93f028d786194822161bbf0f8..0163e9cf620ba58df36a872b82cea92734baada6 100644 --- a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c +++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c @@ -74,6 +74,21 @@ void notrace _fiq_print(enum fiq_debug_level dbg_lvl, volatile struct fiq_state @@ -113926,7 +116084,7 @@ index 2035e0762dc6d60673c8fbc47a90b72254f50b69..208252645c09d1d17bf07673989f91b7 * fiq_fsm_restart_channel() - Poke channel enable bit for a split transaction * @channel: channel to re-enable diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h -index f9fddfbcffb37f32c808fd78f222b676378398b1..0a1ddf3f89f45ca75b8880722fbc22cbdc9f4a2f 100644 +index 8340041ce65665c094e2ad49fd5e8eb1751506f3..ed088f34f210e9a337ab9b80fff0cf9e9b0241ea 100644 --- a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h +++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h @@ -127,6 +127,12 @@ enum fiq_debug_level { @@ -113951,7 +116109,7 @@ index f9fddfbcffb37f32c808fd78f222b676378398b1..0a1ddf3f89f45ca75b8880722fbc22cb struct fiq_state; extern void _fiq_print (enum fiq_debug_level dbg_lvl, volatile struct fiq_state *state, char *fmt, ...); -@@ -355,6 +363,22 @@ struct fiq_state { +@@ -357,6 +365,22 @@ struct fiq_state { struct fiq_channel_state channel[0]; }; @@ -113975,10 +116133,10 @@ index f9fddfbcffb37f32c808fd78f222b676378398b1..0a1ddf3f89f45ca75b8880722fbc22cb extern void fiq_fsm_spin_unlock(fiq_lock_t *lock); diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -index 5e4d4ffe7966486d40a5b5e2423ac4df0de772a8..a2dc6337836b2719f4c954edeeb2a71301931b04 100644 +index 60464acab588a1e189f39b268ffc25766c13dc85..7710370b30363e3170bf9bf522597c5f41dfb908 100644 --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -@@ -1002,6 +1002,10 @@ int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if) +@@ -1000,6 +1000,10 @@ int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if) } DWC_MEMSET(hcd->fiq_state, 0, (sizeof(struct fiq_state) + (sizeof(struct fiq_channel_state) * num_channels))); @@ -114006,7 +116164,7 @@ index fb57db09378f4ab95d57cb58aa570a915ccb61c3..a384db5e7ac219936ace65e5616e68c8 /** * Returns private data set by diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -index fc52495e4749f45dcf270c1c22960f163b6dc86d..a4355afc77b68718fdaba6c5d4be257dadc75036 100644 +index ed855eb9c3b64d54e93c5aa7e06212e779400dfd..c8f52709a7d24974c0a38dcf1708f91073e96b0e 100644 --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c @@ -36,8 +36,9 @@ @@ -114177,10 +116335,10 @@ index 6b2c7d0c93f36a63863ff4b0ecc1f3eab77e058b..d7b700ff17821ad1944e36721fe6b2db /** The OS page size */ #define DWC_OS_PAGE_SIZE PAGE_SIZE -From 1776d57f4d2d9e1241edd81b0f94b54d44d911bd Mon Sep 17 00:00:00 2001 +From a001d835cd9fed5d966f431503535440642c8bf7 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sat, 14 Jan 2017 21:43:57 -0800 -Subject: [PATCH 103/173] ARM64: Round-Robin dispatch IRQs between CPUs. +Subject: [PATCH 109/140] 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 @@ -114222,7 +116380,7 @@ index 8ed457fd74bd23bee27b64a2c9e3828ce0e4fb87..a035e1ceacc0494fa293e6811ff8f7e3 static int armctrl_xlate(struct irq_domain *d, struct device_node *ctrlr, diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c -index c4e151451cf8c8ebde5225515eac2786d6f61d46..9a7ee04ee0d9b7aa734cf3159ed59c19a338de0d 100644 +index bee4d2d2ebacc3233423bb9d825e076b9f52fccd..014f13f89eb896f5cfc75ed9891787d0490baa4b 100644 --- a/drivers/irqchip/irq-bcm2836.c +++ b/drivers/irqchip/irq-bcm2836.c @@ -145,6 +145,27 @@ static void bcm2836_arm_irqchip_unmask_gpu_irq(struct irq_data *d) @@ -114254,10 +116412,10 @@ index c4e151451cf8c8ebde5225515eac2786d6f61d46..9a7ee04ee0d9b7aa734cf3159ed59c19 .name = "bcm2836-gpu", .irq_mask = bcm2836_arm_irqchip_mask_gpu_irq, -From 32cdec81d123f94e87194e77a0e45b639880b130 Mon Sep 17 00:00:00 2001 +From d0b6f242050d6d1fe2deba49d5f456d603d08bee Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sat, 14 Jan 2017 21:45:03 -0800 -Subject: [PATCH 104/173] ARM64: Enable DWC_OTG Driver In ARM64 Build +Subject: [PATCH 110/140] ARM64: Enable DWC_OTG Driver In ARM64 Build Config(bcmrpi3_defconfig) Signed-off-by: Michael Zoran @@ -114278,10 +116436,10 @@ index b7d762df19b85e369a32cd823dfd062145bdefa7..4d85c231c5ea0244e1b05fb4a5e3c8fd CONFIG_USB_STORAGE=y CONFIG_USB_STORAGE_REALTEK=m -From 3503301d0f63751ed4be814d6bf4c9c4e0cc0148 Mon Sep 17 00:00:00 2001 +From 69a3ca6d91532168323592b97805c860b194a368 Mon Sep 17 00:00:00 2001 From: Michael Zoran Date: Sat, 11 Feb 2017 01:18:31 -0800 -Subject: [PATCH 105/173] ARM64: Force hardware emulation of deprecated +Subject: [PATCH 111/140] ARM64: Force hardware emulation of deprecated instructions. --- @@ -114289,7 +116447,7 @@ Subject: [PATCH 105/173] ARM64: Force hardware emulation of deprecated 1 file changed, 5 insertions(+) diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c -index f0e6d717885b1fcf3b22f64c10c38f19c25f809d..0cb830d30fb6d2bd26ab572efe893649c7a28d3c 100644 +index d06fbe4cd38d7423c900aff64b0e728f995478d3..877b7c90f9555203d5d55d739359a256f16982ad 100644 --- a/arch/arm64/kernel/armv8_deprecated.c +++ b/arch/arm64/kernel/armv8_deprecated.c @@ -183,10 +183,15 @@ static void __init register_insn_emulation(struct insn_emulation_ops *ops) @@ -114309,10 +116467,10 @@ index f0e6d717885b1fcf3b22f64c10c38f19c25f809d..0cb830d30fb6d2bd26ab572efe893649 case INSN_OBSOLETE: insn->current_mode = INSN_UNDEF; -From c75fea4314f25493f1a4fa41c0495dccb07d45a2 Mon Sep 17 00:00:00 2001 +From c58958548bd48497f205f951d42a7bdc02f8128f Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 10 Feb 2017 17:57:08 -0800 -Subject: [PATCH 106/173] build/arm64: Add rules for .dtbo files for dts +Subject: [PATCH 112/140] build/arm64: Add rules for .dtbo files for dts overlays We now create overlays as .dtbo files. @@ -114337,51 +116495,41 @@ index 9b41f1e3b1a039cd45fe842e10abff0181186fdf..dc2859b8eed168ed52e95c503e7a5ce3 dtbs: prepare scripts -From 2f1efd7d3d0b00d0ee8d633a19534ac7442f3de4 Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Mon, 9 May 2016 17:28:18 -0700 -Subject: [PATCH 107/173] clk: bcm2835: Mark GPIO clocks enabled at boot as - critical. +From 918d12dc6e3643f5ad2f4bc2846314cce3348cc5 Mon Sep 17 00:00:00 2001 +From: Bilal Amarni +Date: Wed, 24 May 2017 10:52:50 +0200 +Subject: [PATCH 113/140] enable drivers for GPIO expander and vcio -These divide off of PLLD_PER and are used for the ethernet and wifi -PHYs source PLLs. Neither of them is currently represented by a phy -device that would grab the clock for us. - -This keeps other drivers from killing the networking PHYs when they -disable their own clocks and trigger PLLD_PER's refcount going to 0. - -v2: Skip marking as critical if they aren't on at boot. - -Signed-off-by: Eric Anholt --- - drivers/clk/bcm/clk-bcm2835.c | 9 +++++++++ - 1 file changed, 9 insertions(+) + arch/arm64/configs/bcmrpi3_defconfig | 3 +++ + 1 file changed, 3 insertions(+) -diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c -index 336f8c9c44325d0a94e591a8557f7af246adc857..caa05e5ad0b7b5cd683e04fb3591a3dfcb40823f 100644 ---- a/drivers/clk/bcm/clk-bcm2835.c -+++ b/drivers/clk/bcm/clk-bcm2835.c -@@ -1484,6 +1484,15 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman, - init.flags = data->flags | CLK_IGNORE_UNUSED; - - /* -+ * Some GPIO clocks for ethernet/wifi PLLs are marked as -+ * critical (since some platforms use them), but if the -+ * firmware didn't have them turned on then they clearly -+ * aren't actually critical. -+ */ -+ if ((cprman_read(cprman, data->ctl_reg) & CM_ENABLE) == 0) -+ init.flags &= ~CLK_IS_CRITICAL; -+ -+ /* - * Pass the CLK_SET_RATE_PARENT flag if we are allowed to propagate - * rate changes on at least of the parents. - */ +diff --git a/arch/arm64/configs/bcmrpi3_defconfig b/arch/arm64/configs/bcmrpi3_defconfig +index 4d85c231c5ea0244e1b05fb4a5e3c8fd3e651ddf..9dcb58a519d041fadae99c81a7bda621b2a49f12 100644 +--- a/arch/arm64/configs/bcmrpi3_defconfig ++++ b/arch/arm64/configs/bcmrpi3_defconfig +@@ -575,6 +575,8 @@ CONFIG_SERIO_RAW=m + CONFIG_GAMEPORT=m + CONFIG_GAMEPORT_NS558=m + CONFIG_GAMEPORT_L4=m ++CONFIG_BRCM_CHAR_DRIVERS=y ++CONFIG_BCM_VCIO=y + # CONFIG_BCM2835_DEVGPIOMEM is not set + # CONFIG_BCM2835_SMI_DEV is not set + # CONFIG_LEGACY_PTYS is not set +@@ -609,6 +611,7 @@ CONFIG_PPS=m + CONFIG_PPS_CLIENT_LDISC=m + CONFIG_PPS_CLIENT_GPIO=m + CONFIG_GPIO_SYSFS=y ++CONFIG_GPIO_BCM_EXP=y + CONFIG_GPIO_BCM_VIRT=y + CONFIG_GPIO_ARIZONA=m + CONFIG_GPIO_STMPE=y -From 3fc8182fc7a7b27f4867368e5ded2b76f9deefa6 Mon Sep 17 00:00:00 2001 +From 1138cc25b0edc65efd20cbfd12aa6e4e96b972ad Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Tue, 24 Feb 2015 13:40:50 +0000 -Subject: [PATCH 108/173] pinctrl-bcm2835: Fix interrupt handling for GPIOs +Subject: [PATCH 114/140] pinctrl-bcm2835: Fix interrupt handling for GPIOs 28-31 and 46-53 Contrary to the documentation, the BCM2835 GPIO controller actually has @@ -114414,38 +116562,10 @@ index a9d480df32562defbf8be0faf0a39bfe06ff71f9..18c92bae3b2e7e9f8208ca0d4487b08b .suppress_bind_attrs = true, }, -From 8d5d79c2d7ee7973c9901827d6a192b248f2a2eb Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Thu, 23 Mar 2017 10:06:56 +0000 -Subject: [PATCH 109/173] 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 -can use the driver. - -Signed-off-by: Phil Elwell ---- - sound/soc/codecs/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig -index aca3a53f08dba8762307f7c25a5d7c5561b9cf71..a3be6e005a895b995897cc007bb85c780a42de8b 100644 ---- a/sound/soc/codecs/Kconfig -+++ b/sound/soc/codecs/Kconfig -@@ -573,7 +573,7 @@ config SND_SOC_HDAC_HDMI - select HDMI - - config SND_SOC_ICS43432 -- tristate -+ tristate "InvenSense ICS43432 I2S microphone codec" - - config SND_SOC_INNO_RK3036 - tristate "Inno codec driver for RK3036 SoC" - -From cacb59c057cd62127e01ef15603e71ddb7fcc7ce Mon Sep 17 00:00:00 2001 +From 78a515655cc24a391bc753eeb6e9e42b7a1d6001 Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Thu, 23 Mar 2017 16:34:46 +0000 -Subject: [PATCH 110/173] bcm2835-aux: Add aux interrupt controller +Subject: [PATCH 115/140] 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 @@ -114609,213 +116729,10 @@ index bd750cf2238d61489811e7d7bd3b5f9950ed53c8..41e0702fae4692221980b0d02aed1ba6 BCM2835_AUX_CLOCK_COUNT, GFP_KERNEL); if (!onecell) -From f2512ac2b55b875a24a50e59b889afc8140c254e Mon Sep 17 00:00:00 2001 -From: Stefan Agner -Date: Fri, 29 Apr 2016 10:32:17 -0700 -Subject: [PATCH 111/173] mmc: read mmc alias from device tree - -To get the SD/MMC host device ID, read the alias from the device -tree. - -This is useful in case a SoC has multipe SD/MMC host controllers while -the second controller should logically be the first device (e.g. if -the second controller is connected to an internal eMMC). Combined -with block device numbering using MMC/SD host device ID, this -results in predictable name assignment of the internal eMMC block -device. - -Signed-off-by: Stefan Agner -Signed-off-by: Dmitry Torokhov -[dianders: rebase + roll in http://crosreview.com/259916] -Signed-off-by: Douglas Anderson ---- - drivers/mmc/core/host.c | 17 ++++++++++++++++- - 1 file changed, 16 insertions(+), 1 deletion(-) - -diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c -index 1503412f826cd0e0e9ad37a0554b31596a49eb77..2f5b3cf86293b96b104eac7c6d48a5839d7e974b 100644 ---- a/drivers/mmc/core/host.c -+++ b/drivers/mmc/core/host.c -@@ -344,15 +344,30 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) - { - int err; - struct mmc_host *host; -+ int id; - - host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL); - if (!host) - return NULL; - -+ /* If OF aliases exist, start dynamic assignment after highest */ -+ id = of_alias_get_highest_id("mmc"); -+ id = (id < 0) ? 0 : id + 1; -+ -+ /* If this devices has OF node, maybe it has an alias */ -+ if (dev->of_node) { -+ int of_id = of_alias_get_id(dev->of_node, "mmc"); -+ -+ if (of_id < 0) -+ dev_warn(dev, "/aliases ID not available\n"); -+ else -+ id = of_id; -+ } -+ - /* scanning will be enabled when we're ready */ - host->rescan_disable = 1; - -- err = ida_simple_get(&mmc_host_ida, 0, 0, GFP_KERNEL); -+ err = ida_simple_get(&mmc_host_ida, id, 0, GFP_KERNEL); - if (err < 0) { - kfree(host); - return NULL; - -From ecf97118ac5de61d3bf2d83b466280ee29a63822 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 11 May 2016 12:50:33 +0100 -Subject: [PATCH 112/173] 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, -and set it for cards of that type. - -Signed-off-by: Phil Elwell - -mmc: Apply QUIRK_BROKEN_ERASE to other capacities - -Signed-off-by: Phil Elwell - -mmc: Add card_quirks module parameter, log quirks - -Use mmc_block.card_quirks to override the quirks for all SD or MMC -cards. The value is a bitfield using the bit positions defined in -include/linux/mmc/card.h. If the module parameter is placed in the -kernel command line (or bootargs) stored on the card then, assuming the -device only has one SD card interface, the override effectively becomes -card-specific. - -Signed-off-by: Phil Elwell ---- - drivers/mmc/core/block.c | 28 +++++++++++++++++++++++++--- - drivers/mmc/core/core.c | 3 ++- - drivers/mmc/core/quirks.h | 11 +++++++++++ - include/linux/mmc/card.h | 2 ++ - 4 files changed, 40 insertions(+), 4 deletions(-) - -diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c -index 8bd7aba811e969a3b7cfdc6cf12e685f25e8c37e..cd1eb5cf73358a0104fbf4b6ed8e72dd491d658d 100644 ---- a/drivers/mmc/core/block.c -+++ b/drivers/mmc/core/block.c -@@ -125,6 +125,13 @@ static DEFINE_MUTEX(open_lock); - module_param(perdev_minors, int, 0444); - MODULE_PARM_DESC(perdev_minors, "Minors numbers to allocate per device"); - -+/* -+ * Allow quirks to be overridden for the current card -+ */ -+static char *card_quirks; -+module_param(card_quirks, charp, 0644); -+MODULE_PARM_DESC(card_quirks, "Force the use of the indicated quirks (a bitfield)"); -+ - static inline int mmc_blk_part_switch(struct mmc_card *card, - struct mmc_blk_data *md); - -@@ -2287,6 +2294,7 @@ static int mmc_blk_probe(struct mmc_card *card) - { - struct mmc_blk_data *md, *part_md; - char cap_str[10]; -+ char quirk_str[24]; - - /* - * Check that the card supports the command class(es) we need. -@@ -2294,7 +2302,16 @@ static int mmc_blk_probe(struct mmc_card *card) - if (!(card->csd.cmdclass & CCC_BLOCK_READ)) - return -ENODEV; - -- mmc_fixup_device(card, mmc_blk_fixups); -+ if (card_quirks) { -+ unsigned long quirks; -+ if (kstrtoul(card_quirks, 0, &quirks) == 0) -+ card->quirks = (unsigned int)quirks; -+ else -+ pr_err("mmc_block: Invalid card_quirks parameter '%s'\n", -+ card_quirks); -+ } -+ else -+ mmc_fixup_device(card, mmc_blk_fixups); - - md = mmc_blk_alloc(card); - if (IS_ERR(md)) -@@ -2302,9 +2319,14 @@ static int mmc_blk_probe(struct mmc_card *card) - - string_get_size((u64)get_capacity(md->disk), 512, STRING_UNITS_2, - cap_str, sizeof(cap_str)); -- pr_info("%s: %s %s %s %s\n", -+ if (card->quirks) -+ snprintf(quirk_str, sizeof(quirk_str), -+ " (quirks 0x%08x)", card->quirks); -+ else -+ quirk_str[0] = '\0'; -+ pr_info("%s: %s %s %s%s%s\n", - md->disk->disk_name, mmc_card_id(card), mmc_card_name(card), -- cap_str, md->read_only ? "(ro)" : ""); -+ cap_str, md->read_only ? " (ro)" : "", quirk_str); - - if (mmc_blk_alloc_parts(card, md)) - goto out; -diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c -index 26431267a3e2d790d4eae99e65881ca60bd2047d..0ec589ace762a27f3c5ea39226fef3a67442675f 100644 ---- a/drivers/mmc/core/core.c -+++ b/drivers/mmc/core/core.c -@@ -2211,7 +2211,8 @@ EXPORT_SYMBOL(mmc_erase); - int mmc_can_erase(struct mmc_card *card) - { - if ((card->host->caps & MMC_CAP_ERASE) && -- (card->csd.cmdclass & CCC_ERASE) && card->erase_size) -+ (card->csd.cmdclass & CCC_ERASE) && card->erase_size && -+ !(card->quirks & MMC_QUIRK_ERASE_BROKEN)) - return 1; - return 0; - } -diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h -index fb725934fa21cee1b98fd7bc08227bf6d0317549..05c8d7381fff5ae88531129d9a5ddd554bddb43e 100644 ---- a/drivers/mmc/core/quirks.h -+++ b/drivers/mmc/core/quirks.h -@@ -90,6 +90,17 @@ static const struct mmc_fixup mmc_blk_fixups[] = { - MMC_FIXUP("V10016", CID_MANFID_KINGSTON, CID_OEMID_ANY, add_quirk_mmc, - MMC_QUIRK_TRIM_BROKEN), - -+ /* -+ * On some Kingston SD cards, multiple erases of less than 64 -+ * sectors can cause corruption. -+ */ -+ MMC_FIXUP("SD16G", 0x41, 0x3432, add_quirk_mmc, -+ MMC_QUIRK_ERASE_BROKEN), -+ MMC_FIXUP("SD32G", 0x41, 0x3432, add_quirk_mmc, -+ MMC_QUIRK_ERASE_BROKEN), -+ MMC_FIXUP("SD64G", 0x41, 0x3432, add_quirk_mmc, -+ MMC_QUIRK_ERASE_BROKEN), -+ - END_FIXUP - }; - -diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h -index 46c73e97e61f08a41d9753079345f5965caebbc5..388c551ed11e9d06ea1c25b6553d47a8d668953a 100644 ---- a/include/linux/mmc/card.h -+++ b/include/linux/mmc/card.h -@@ -269,6 +269,8 @@ struct mmc_card { - #define MMC_QUIRK_TRIM_BROKEN (1<<12) /* Skip trim */ - #define MMC_QUIRK_BROKEN_HPI (1<<13) /* Disable broken HPI support */ - -+#define MMC_QUIRK_ERASE_BROKEN (1<<31) /* Skip erase */ -+ - bool reenable_cmdq; /* Re-enable Command Queue */ - - unsigned int erase_size; /* erase size in sectors */ - -From c8b7e3062f047e73581ea9467b79a0c7ca70282c Mon Sep 17 00:00:00 2001 +From 5f3b8b992711a8e3bbce0d3e75055655b0baaf22 Mon Sep 17 00:00:00 2001 From: Yasunari Takiguchi Date: Fri, 14 Apr 2017 10:43:57 +0100 -Subject: [PATCH 113/173] This is the driver for Sony CXD2880 DVB-T2/T tuner + +Subject: [PATCH 116/140] 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. @@ -130947,10 +132864,10 @@ index 0000000000000000000000000000000000000000..82e122349055be817eb74ed5bbcd7560 +MODULE_AUTHOR("Sony Semiconductor Solutions Corporation"); +MODULE_LICENSE("GPL v2"); -From 2572d44289de83da22f0c5537264db7ab390d054 Mon Sep 17 00:00:00 2001 +From 89964c12ef76826e1660d11cbf40efc71b54a8de Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 14 Sep 2016 09:18:09 +0100 -Subject: [PATCH 114/173] raspberrypi-firmware: Define the MBOX channel in the +Subject: [PATCH 117/140] raspberrypi-firmware: Define the MBOX channel in the header. Signed-off-by: Eric Anholt @@ -130972,10 +132889,10 @@ index c819c21b0158a59c1308882e5a40e3f3fe73cbdf..de2a3dcd562beb752266eaf0070e5586 enum rpi_firmware_property_status { -From 6a1197ebcdaf028b90367012c289167371d085c8 Mon Sep 17 00:00:00 2001 +From 14d34e161f528106d9ad080515eede60388b8a2b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 14 Sep 2016 09:16:19 +0100 -Subject: [PATCH 115/173] raspberrypi-firmware: Export the general transaction +Subject: [PATCH 118/140] raspberrypi-firmware: Export the general transaction function. The vc4-firmware-kms module is going to be doing the MBOX FB call. @@ -131019,10 +132936,10 @@ index de2a3dcd562beb752266eaf0070e55861d553f5f..dc7fd58afd5dddebf9b17065bb069a1d #endif /* __SOC_RASPBERRY_FIRMWARE_H__ */ -From ca0b875af245f0577d38b589bd7c32680ef13e0c Mon Sep 17 00:00:00 2001 +From 2da4d8717d305d42889b1affc758120434b6d3d9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 14 Sep 2016 08:39:33 +0100 -Subject: [PATCH 116/173] drm/vc4: Add a mode for using the closed firmware for +Subject: [PATCH 119/140] drm/vc4: Add a mode for using the closed firmware for display. Signed-off-by: Eric Anholt @@ -131794,10 +133711,10 @@ index 0000000000000000000000000000000000000000..7dd233eed677c1689492ab95bc864753 + }, +}; -From 8d12d4e3904b051c0df8fcfa3aa5dedc93ec6e6c Mon Sep 17 00:00:00 2001 +From f1040b49dd5045284ee7192162b890718771e3e5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Feb 2017 17:09:18 -0800 -Subject: [PATCH 117/173] drm/vc4: Name the primary and cursor planes in fkms. +Subject: [PATCH 120/140] drm/vc4: Name the primary and cursor planes in fkms. This makes debugging nicer, compared to trying to remember what the IDs are. @@ -131821,10 +133738,10 @@ index 7dd233eed677c1689492ab95bc86475330d2d63b..e6097046fb25361bc61d657083d95b63 if (type == DRM_PLANE_TYPE_PRIMARY) { vc4_plane->fbinfo = -From f561f2b6efcfec7d3daae3b9c3288533d192c6d6 Mon Sep 17 00:00:00 2001 +From 98ce9c60b4f0bd3bea4be160a526ae23871a3861 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 1 Feb 2017 17:10:09 -0800 -Subject: [PATCH 118/173] drm/vc4: Add DRM_DEBUG_ATOMIC for the insides of +Subject: [PATCH 121/140] drm/vc4: Add DRM_DEBUG_ATOMIC for the insides of fkms. Trying to debug weston on fkms involved figuring out what calls I was @@ -131894,10 +133811,10 @@ index e6097046fb25361bc61d657083d95b634232aabc..72d0b9cffe3d2997d69040c46f4aee11 RPI_FIRMWARE_SET_CURSOR_STATE, &packet_state, -From 59e5aba1a8af1803c655cfec60ba4ef0fda99424 Mon Sep 17 00:00:00 2001 +From 832128c3dbbee984fd3a328cd8e342af8f26f7b1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 2 Feb 2017 09:42:18 -0800 -Subject: [PATCH 119/173] drm/vc4: Fix sending of page flip completion events +Subject: [PATCH 122/140] 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 @@ -131939,10 +133856,10 @@ index 72d0b9cffe3d2997d69040c46f4aee11e22aa213..185f9bd3c1b2d47d0c1fc5293db4199b static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc) -From 86905ab00857eb22f1eb8909858ba2e7e3a9165a Mon Sep 17 00:00:00 2001 +From 84cea6b060a32d005d61d4d555a87a48ec722547 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 18 Apr 2017 21:43:46 +0100 -Subject: [PATCH 120/173] vc4_fkms: Apply firmware overscan offset to hardware +Subject: [PATCH 123/140] vc4_fkms: Apply firmware overscan offset to hardware cursor --- @@ -131999,1031 +133916,10 @@ index 185f9bd3c1b2d47d0c1fc5293db4199bd8963023..072f377b7423ee603d73ace2bf6d620f return 0; -From 4a5fef4b0d90416a76e64de8f4dbc2d75924894f Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 16 May 2017 14:39:49 +0100 -Subject: [PATCH 121/173] mmc: Change downstream MMC driver CONFIG option - -The upstream SDHOST driver has now claimed CONFIG_MMC_BCM2835, which -clashes with the downstream MMC driver. Rename the downstream option to -CONFIG_MMC_BCM2835_MMC. - -Signed-off-by: Phil Elwell ---- - drivers/mmc/host/Kconfig | 4 ++-- - drivers/mmc/host/Makefile | 2 +- - 2 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig -index 64bd7825131d3dcb003e7ece581b8d599a717b31..d47cce77c0551d78fa51f50e2c8086f26c7b9e56 100644 ---- a/drivers/mmc/host/Kconfig -+++ b/drivers/mmc/host/Kconfig -@@ -4,7 +4,7 @@ - - comment "MMC/SD/SDIO Host Controller Drivers" - --config MMC_BCM2835 -+config MMC_BCM2835_MMC - tristate "MMC support on BCM2835" - depends on MACH_BCM2708 || MACH_BCM2709 || ARCH_BCM2835 - help -@@ -16,7 +16,7 @@ config MMC_BCM2835 - - config MMC_BCM2835_DMA - bool "DMA support on BCM2835 Arasan controller" -- depends on MMC_BCM2835 -+ depends on MMC_BCM2835_MMC - help - Enable DMA support on the Arasan SDHCI controller in Broadcom 2708 - based chips. -diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile -index cd3a47d8965958ccf3ac3d186a05bbd437494154..9ba643d3b2e12960f5ce4b0eb5d75c1c360980ce 100644 ---- a/drivers/mmc/host/Makefile -+++ b/drivers/mmc/host/Makefile -@@ -18,7 +18,7 @@ obj-$(CONFIG_MMC_SDHCI_S3C) += sdhci-s3c.o - obj-$(CONFIG_MMC_SDHCI_SIRF) += sdhci-sirf.o - obj-$(CONFIG_MMC_SDHCI_F_SDH30) += sdhci_f_sdh30.o - obj-$(CONFIG_MMC_SDHCI_SPEAR) += sdhci-spear.o --obj-$(CONFIG_MMC_BCM2835) += bcm2835-mmc.o -+obj-$(CONFIG_MMC_BCM2835_MMC) += bcm2835-mmc.o - obj-$(CONFIG_MMC_BCM2835_SDHOST) += bcm2835-sdhost.o - obj-$(CONFIG_MMC_WBSD) += wbsd.o - obj-$(CONFIG_MMC_AU1X) += au1xmmc.o - -From 451c7dce838d727f0e9d6ad48ccdff3e8365a20e Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 16 May 2017 19:34:52 +0100 -Subject: [PATCH 122/173] config: Add CONFIG_I2C_ROBOTFUZZ_OSIF - ---- - 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 93cdfa4ce3e7d3ff9f437a05a9ee6bcf4b895a20..4afeb9120a1d8411648c9ac685665aeb395af448 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -614,6 +614,7 @@ CONFIG_I2C_MUX_PCA954x=m - CONFIG_I2C_BCM2708=m - CONFIG_I2C_BCM2835=m - CONFIG_I2C_GPIO=m -+CONFIG_I2C_ROBOTFUZZ_OSIF=m - CONFIG_SPI=y - CONFIG_SPI_BCM2835=m - CONFIG_SPI_BCM2835AUX=m -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 29fd2abc2cbfcaed37cb630b5edffaa5b4994f6e..05d6d108cb2d013588ccc971c83dcd212308f230 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -610,6 +610,7 @@ CONFIG_I2C_MUX_PCA954x=m - CONFIG_I2C_BCM2708=m - CONFIG_I2C_BCM2835=m - CONFIG_I2C_GPIO=m -+CONFIG_I2C_ROBOTFUZZ_OSIF=m - CONFIG_SPI=y - CONFIG_SPI_BCM2835=m - CONFIG_SPI_BCM2835AUX=m - -From e9a21552d4dbd7a939b72176dab7d056724fdf8b Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 18 May 2017 11:40:43 +0100 -Subject: [PATCH 123/173] config: Add FB_TFT_ST7789V module - ---- - 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 4afeb9120a1d8411648c9ac685665aeb395af448..cdf0206ea890c3843542f8f1db546e93e9a1f8ba 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -1138,6 +1138,7 @@ CONFIG_FB_TFT_SSD1306=m - CONFIG_FB_TFT_SSD1331=m - CONFIG_FB_TFT_SSD1351=m - CONFIG_FB_TFT_ST7735R=m -+CONFIG_FB_TFT_ST7789V=m - CONFIG_FB_TFT_TINYLCD=m - CONFIG_FB_TFT_TLS8204=m - CONFIG_FB_TFT_UC1701=m -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 05d6d108cb2d013588ccc971c83dcd212308f230..54175b3c558e89d56b7d65752bccc6bdaebcfd5a 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -1145,6 +1145,7 @@ CONFIG_FB_TFT_SSD1306=m - CONFIG_FB_TFT_SSD1331=m - CONFIG_FB_TFT_SSD1351=m - CONFIG_FB_TFT_ST7735R=m -+CONFIG_FB_TFT_ST7789V=m - CONFIG_FB_TFT_TINYLCD=m - CONFIG_FB_TFT_TLS8204=m - CONFIG_FB_TFT_UC1701=m - -From 65838dba857839a2f18ea265152747eaf9738da9 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Thu, 18 May 2017 15:36:46 +0100 -Subject: [PATCH 124/173] staging: bcm2835-audio: Fix memory corruption - -I'm all for fixing memory leaks, but freeing a block while it is still -being used is a recipe for hard-to-debug kernel exeptions. - -1) There is already a vchi method for freeing the instance, so use it. -2) Only call it on error, and then only before initted is false. - -Signed-off-by: Phil Elwell -Fixes: 0adbfd4694c2 ("staging: bcm2835-audio: fix memory leak in bcm2835_audio_open_connection()") ---- - drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c -index 5f3d8f2339e34834d11edfa8de1d5819e3e32b4f..89f96f3c02805f4114ec9b488e18d00e1f348239 100644 ---- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c -+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c -@@ -409,6 +409,7 @@ static int bcm2835_audio_open_connection(struct bcm2835_alsa_stream *alsa_stream - LOG_ERR("%s: failed to connect VCHI instance (ret=%d)\n", - __func__, ret); - -+ vchi_disconnect(vchi_instance); - ret = -EIO; - goto err_free_mem; - } -@@ -431,7 +432,6 @@ static int bcm2835_audio_open_connection(struct bcm2835_alsa_stream *alsa_stream - LOG_DBG(" success !\n"); - ret = 0; - err_free_mem: -- kfree(vchi_instance); - - return ret; - } - -From 65e912f0f3280b6facb6f9e89747c498cb38d706 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 15 May 2017 16:40:05 +0100 -Subject: [PATCH 125/173] config: Add CONFIG_TOUCHSCREEN_GOODIX - ---- - arch/arm/configs/bcm2709_defconfig | 1 + - arch/arm/configs/bcmrpi_defconfig | 1 - - 2 files changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index cdf0206ea890c3843542f8f1db546e93e9a1f8ba..2624359759f0318290287c6201cf7e511367128d 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -566,6 +566,7 @@ CONFIG_INPUT_TOUCHSCREEN=y - CONFIG_TOUCHSCREEN_ADS7846=m - CONFIG_TOUCHSCREEN_EGALAX=m - CONFIG_TOUCHSCREEN_EDT_FT5X06=m -+CONFIG_TOUCHSCREEN_GOODIX=m - CONFIG_TOUCHSCREEN_RPI_FT5406=m - CONFIG_TOUCHSCREEN_USB_COMPOSITE=m - CONFIG_TOUCHSCREEN_STMPE=m -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 54175b3c558e89d56b7d65752bccc6bdaebcfd5a..1d2d27cb950b5e799370b7ca557f4bcb2508169b 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -560,7 +560,6 @@ CONFIG_JOYSTICK_RPISENSE=m - CONFIG_INPUT_TOUCHSCREEN=y - CONFIG_TOUCHSCREEN_ADS7846=m - CONFIG_TOUCHSCREEN_EGALAX=m --CONFIG_TOUCHSCREEN_EDT_FT5X06=m - CONFIG_TOUCHSCREEN_GOODIX=m - CONFIG_TOUCHSCREEN_RPI_FT5406=m - CONFIG_TOUCHSCREEN_USB_COMPOSITE=m - -From 128dd2e40b0ddd9e1259a063cd9d3aac04d289d6 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 16 May 2017 15:58:00 +0100 -Subject: [PATCH 126/173] config: Add CONFIG_TOUCHSCREEN_EDT_FT5X06 - ---- - 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 2624359759f0318290287c6201cf7e511367128d..e1855e95ad612c5c615da8edd90b9b6cfd4e0807 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -567,6 +567,7 @@ CONFIG_TOUCHSCREEN_ADS7846=m - CONFIG_TOUCHSCREEN_EGALAX=m - CONFIG_TOUCHSCREEN_EDT_FT5X06=m - CONFIG_TOUCHSCREEN_GOODIX=m -+CONFIG_TOUCHSCREEN_EDT_FT5X06=m - CONFIG_TOUCHSCREEN_RPI_FT5406=m - CONFIG_TOUCHSCREEN_USB_COMPOSITE=m - CONFIG_TOUCHSCREEN_STMPE=m -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 1d2d27cb950b5e799370b7ca557f4bcb2508169b..de0b998202e23eec39fafce0e8cd346e68817f6c 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -561,6 +561,7 @@ CONFIG_INPUT_TOUCHSCREEN=y - CONFIG_TOUCHSCREEN_ADS7846=m - CONFIG_TOUCHSCREEN_EGALAX=m - CONFIG_TOUCHSCREEN_GOODIX=m -+CONFIG_TOUCHSCREEN_EDT_FT5X06=m - CONFIG_TOUCHSCREEN_RPI_FT5406=m - CONFIG_TOUCHSCREEN_USB_COMPOSITE=m - CONFIG_TOUCHSCREEN_STMPE=m - -From d9e51f8dfd5eee9e765b27ae146f0ad190eca7c1 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 22 May 2017 13:35:28 +0100 -Subject: [PATCH 127/173] config: Add CONFIG_IPV6_SIT_6RD - ---- - 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 e1855e95ad612c5c615da8edd90b9b6cfd4e0807..43928722d8f751b137d40ac22ae672bc6282c091 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -106,6 +106,7 @@ CONFIG_IPV6_ROUTER_PREF=y - CONFIG_INET6_AH=m - CONFIG_INET6_ESP=m - CONFIG_INET6_IPCOMP=m -+CONFIG_IPV6_SIT_6RD=y - CONFIG_IPV6_TUNNEL=m - CONFIG_IPV6_MULTIPLE_TABLES=y - CONFIG_IPV6_SUBTREES=y -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index de0b998202e23eec39fafce0e8cd346e68817f6c..c4d82bec0aefc191c6049500fbeda6ea0a47f590 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -101,6 +101,7 @@ CONFIG_IPV6_ROUTER_PREF=y - CONFIG_INET6_AH=m - CONFIG_INET6_ESP=m - CONFIG_INET6_IPCOMP=m -+CONFIG_IPV6_SIT_6RD=y - CONFIG_IPV6_TUNNEL=m - CONFIG_IPV6_MULTIPLE_TABLES=y - CONFIG_IPV6_SUBTREES=y - -From ec2378c3a78dff7313dc551eb857e74cb36e5bd2 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 22 May 2017 15:28:27 +0100 -Subject: [PATCH 128/173] config: Add CONFIG_IPV6_ROUTE_INFO - ---- - 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 43928722d8f751b137d40ac22ae672bc6282c091..ba89462cf80f17e6275c1e7912d754d672d4c68d 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -103,6 +103,7 @@ CONFIG_TCP_CONG_ADVANCED=y - CONFIG_TCP_CONG_BBR=m - CONFIG_IPV6=m - CONFIG_IPV6_ROUTER_PREF=y -+CONFIG_IPV6_ROUTE_INFO=y - CONFIG_INET6_AH=m - CONFIG_INET6_ESP=m - CONFIG_INET6_IPCOMP=m -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index c4d82bec0aefc191c6049500fbeda6ea0a47f590..7d3522df2b28e53cb63a0813168918792b65becb 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -98,6 +98,7 @@ CONFIG_TCP_CONG_ADVANCED=y - CONFIG_TCP_CONG_BBR=m - CONFIG_IPV6=m - CONFIG_IPV6_ROUTER_PREF=y -+CONFIG_IPV6_ROUTE_INFO=y - CONFIG_INET6_AH=m - CONFIG_INET6_ESP=m - CONFIG_INET6_IPCOMP=m - -From 30f1a565079205ce4c5d797b03f62001d5b1e119 Mon Sep 17 00:00:00 2001 -From: P33M -Date: Thu, 25 May 2017 16:04:53 +0100 -Subject: [PATCH 129/173] dwc_otg: make periodic scheduling behave properly for - FS buses - -If the root port is in full-speed mode, transfer times at 12mbit/s -would be calculated but matched against high-speed quotas. - -Reinitialise hcd->frame_usecs[i] on each port enable event so that -full-speed bandwidth can be tracked sensibly. - -Also, don't bother using the FIQ for transfers when in full-speed -mode - at the slower bus speed, interrupt frequency is reduced by -an order of magnitude. - -Related issue: https://github.com/raspberrypi/linux/issues/2020 ---- - drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 15 ++++++++++----- - drivers/usb/host/dwc_otg/dwc_otg_hcd.h | 7 +++++-- - drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 4 ++++ - drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c | 19 ++++++++++++------- - 4 files changed, 31 insertions(+), 14 deletions(-) - -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -index a2dc6337836b2719f4c954edeeb2a71301931b04..38bf5fc792d32352f9e208e0e90f968599b9bc31 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -@@ -926,8 +926,6 @@ static void dwc_otg_hcd_free(dwc_otg_hcd_t * dwc_otg_hcd) - DWC_FREE(dwc_otg_hcd); - } - --int init_hcd_usecs(dwc_otg_hcd_t *_hcd); -- - int dwc_otg_hcd_init(dwc_otg_hcd_t * hcd, dwc_otg_core_if_t * core_if) - { - struct device *dev = dwc_otg_hcd_to_dev(hcd); -@@ -1429,6 +1427,7 @@ static void assign_and_init_hc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) - - /** - * fiq_fsm_transaction_suitable() - Test a QH for compatibility with the FIQ -+ * @hcd: Pointer to the dwc_otg_hcd struct - * @qh: pointer to the endpoint's queue head - * - * Transaction start/end control flow is grafted onto the existing dwc_otg -@@ -1438,8 +1437,14 @@ static void assign_and_init_hc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) - * Returns: 0 for unsuitable, 1 implies the FIQ can be enabled for this transaction. - */ - --int fiq_fsm_transaction_suitable(dwc_otg_qh_t *qh) -+int fiq_fsm_transaction_suitable(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) - { -+ /* There is little benefit in using the FIQ to perform transfers if -+ * the root port is not in high-speed mode. -+ */ -+ if (hcd->flags.b.port_speed != DWC_HPRT0_PRTSPD_HIGH_SPEED) -+ return 0; -+ - if (qh->do_split) { - switch (qh->ep_type) { - case UE_CONTROL: -@@ -2218,7 +2223,7 @@ static void process_periodic_channels(dwc_otg_hcd_t * hcd) - continue; - } - -- if (fiq_fsm_enable && fiq_fsm_transaction_suitable(qh)) { -+ if (fiq_fsm_enable && fiq_fsm_transaction_suitable(hcd, qh)) { - if (qh->do_split) - fiq_fsm_queue_split_transaction(hcd, qh); - else -@@ -2355,7 +2360,7 @@ static void process_non_periodic_channels(dwc_otg_hcd_t * hcd) - qh = DWC_LIST_ENTRY(hcd->non_periodic_qh_ptr, dwc_otg_qh_t, - qh_list_entry); - -- if(fiq_fsm_enable && fiq_fsm_transaction_suitable(qh)) { -+ if(fiq_fsm_enable && fiq_fsm_transaction_suitable(hcd, qh)) { - fiq_fsm_queue_split_transaction(hcd, qh); - } else { - status = queue_transaction(hcd, qh->channel, -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h -index 7f7e9eaffd6a3c3d898855562fbec11289f77f53..5ed8dccf03959a610849aa6c8946ca745dbae207 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.h -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.h -@@ -410,7 +410,8 @@ struct dwc_otg_hcd { - unsigned port_suspend_change:1; - unsigned port_over_current_change:1; - unsigned port_l1_change:1; -- unsigned reserved:26; -+ unsigned port_speed:2; -+ unsigned reserved:24; - } b; - } flags; - -@@ -629,7 +630,7 @@ int dwc_otg_hcd_allocate_port(dwc_otg_hcd_t * hcd, dwc_otg_qh_t *qh); - void dwc_otg_hcd_release_port(dwc_otg_hcd_t * dwc_otg_hcd, dwc_otg_qh_t *qh); - - extern int fiq_fsm_queue_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh); --extern int fiq_fsm_transaction_suitable(dwc_otg_qh_t *qh); -+extern int fiq_fsm_transaction_suitable(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh); - extern void dwc_otg_cleanup_fiq_channel(dwc_otg_hcd_t *hcd, uint32_t num); - - /** @} */ -@@ -823,6 +824,8 @@ static inline uint16_t dwc_micro_frame_num(uint16_t frame) - return frame & 0x7; - } - -+extern void init_hcd_usecs(dwc_otg_hcd_t *_hcd); -+ - void dwc_otg_hcd_save_data_toggle(dwc_hc_t * hc, - dwc_otg_hc_regs_t * hc_regs, - dwc_otg_qtd_t * qtd); -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -index a4355afc77b68718fdaba6c5d4be257dadc75036..c8f52709a7d24974c0a38dcf1708f91073e96b0e 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c -@@ -515,6 +515,10 @@ int32_t dwc_otg_hcd_handle_port_intr(dwc_otg_hcd_t * dwc_otg_hcd) - dwc_otg_host_if_t *host_if = - dwc_otg_hcd->core_if->host_if; - -+ dwc_otg_hcd->flags.b.port_speed = hprt0.b.prtspd; -+ if (microframe_schedule) -+ init_hcd_usecs(dwc_otg_hcd); -+ - /* Every time when port enables calculate - * HFIR.FrInterval - */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -index 85a6d431ca54b47dc10573aa72d1ad69d06f2e36..4b1dd9de99e9e08b2e006fb5f8a7ef92f20c2553 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -@@ -408,13 +408,17 @@ const unsigned short max_uframe_usecs[]={ 100, 100, 100, 100, 100, 100, 30, 0 }; - /* - * called from dwc_otg_hcd.c:dwc_otg_hcd_init - */ --int init_hcd_usecs(dwc_otg_hcd_t *_hcd) -+void init_hcd_usecs(dwc_otg_hcd_t *_hcd) - { - int i; -- for (i=0; i<8; i++) { -- _hcd->frame_usecs[i] = max_uframe_usecs[i]; -+ if (_hcd->flags.b.port_speed == DWC_HPRT0_PRTSPD_FULL_SPEED) { -+ _hcd->frame_usecs[0] = 900; -+ for (i = 1; i < 8; i++) -+ _hcd->frame_usecs[i] = 0; -+ } else { -+ for (i = 0; i < 8; i++) -+ _hcd->frame_usecs[i] = max_uframe_usecs[i]; - } -- return 0; - } - - static int find_single_uframe(dwc_otg_hcd_t * _hcd, dwc_otg_qh_t * _qh) -@@ -541,8 +545,9 @@ static int find_uframe(dwc_otg_hcd_t * _hcd, dwc_otg_qh_t * _qh) - int ret; - ret = -1; - -- if (_qh->speed == USB_SPEED_HIGH) { -- /* if this is a hs transaction we need a full frame */ -+ if (_qh->speed == USB_SPEED_HIGH || -+ _hcd->flags.b.port_speed == DWC_HPRT0_PRTSPD_FULL_SPEED) { -+ /* if this is a hs transaction we need a full frame - or account for FS usecs */ - ret = find_single_uframe(_hcd, _qh); - } else { - /* if this is a fs transaction we may need a sequence of frames */ -@@ -627,7 +632,7 @@ static int schedule_periodic(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) - if (status) { - DWC_INFO("%s: Insufficient periodic bandwidth for " - "periodic transfer.\n", __func__); -- return status; -+ return -DWC_E_NO_SPACE; - } - status = check_max_xfer_size(hcd, qh); - if (status) { - -From 513a113092ed066fbe36cfc3c08389deb1c04acf Mon Sep 17 00:00:00 2001 -From: P33M -Date: Fri, 26 May 2017 12:50:31 +0100 -Subject: [PATCH 130/173] dwc_otg: fiq_fsm: Make isochronous compatibility - checks work properly - -Get rid of the spammy printk and local pointer mangling. -Also, there is a nominal benefit for using fiq_fsm for isochronous -transfers in FS mode (~1.1k IRQs per second vs 2.1k IRQs per second) -so remove the root port speed check. ---- - drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 24 ++++++------------------ - 1 file changed, 6 insertions(+), 18 deletions(-) - -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -index 38bf5fc792d32352f9e208e0e90f968599b9bc31..71834cf365e67d7ad995bba7869216c4091c3a74 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -@@ -1439,12 +1439,6 @@ static void assign_and_init_hc(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh) - - int fiq_fsm_transaction_suitable(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) - { -- /* There is little benefit in using the FIQ to perform transfers if -- * the root port is not in high-speed mode. -- */ -- if (hcd->flags.b.port_speed != DWC_HPRT0_PRTSPD_HIGH_SPEED) -- return 0; -- - if (qh->do_split) { - switch (qh->ep_type) { - case UE_CONTROL: -@@ -1462,28 +1456,22 @@ int fiq_fsm_transaction_suitable(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) - } - } else if (qh->ep_type == UE_ISOCHRONOUS) { - if (fiq_fsm_mask & (1 << 2)) { -- /* HS ISOCH support. We test for compatibility: -+ /* ISOCH support. We test for compatibility: - * - DWORD aligned buffers - * - Must be at least 2 transfers (otherwise pointless to use the FIQ) - * If yes, then the fsm enqueue function will handle the state machine setup. - */ - dwc_otg_qtd_t *qtd = DWC_CIRCLEQ_FIRST(&qh->qtd_list); - dwc_otg_hcd_urb_t *urb = qtd->urb; -- struct dwc_otg_hcd_iso_packet_desc (*iso_descs)[0] = &urb->iso_descs; -- int nr_iso_frames = urb->packet_count; -+ dwc_dma_t ptr; - int i; -- uint32_t ptr; - -- if (nr_iso_frames < 2) -+ if (urb->packet_count < 2) - return 0; -- for (i = 0; i < nr_iso_frames; i++) { -- ptr = urb->dma + iso_descs[i]->offset; -- if (ptr & 0x3) { -- printk_ratelimited("%s: Non-Dword aligned isochronous frame offset." -- " Cannot queue FIQ-accelerated transfer to device %d endpoint %d\n", -- __FUNCTION__, qh->channel->dev_addr, qh->channel->ep_num); -+ for (i = 0; i < urb->packet_count; i++) { -+ ptr = urb->dma + urb->iso_descs[i].offset; -+ if (ptr & 0x3) - return 0; -- } - } - return 1; - } - -From 179f3d51610b2d63525037a97c7a41e2a3dec0b5 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Mon, 12 Jun 2017 13:05:43 +0100 -Subject: [PATCH 131/173] config: Add CONFIG_CAN_GS_USB - ---- - 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 ba89462cf80f17e6275c1e7912d754d672d4c68d..fd6d3980bc003801a6868e6098f3868a2544573f 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -362,6 +362,7 @@ CONFIG_CAN=m - CONFIG_CAN_VCAN=m - CONFIG_CAN_SLCAN=m - CONFIG_CAN_MCP251X=m -+CONFIG_CAN_GS_USB=m - CONFIG_IRDA=m - CONFIG_IRLAN=m - CONFIG_IRNET=m -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 7d3522df2b28e53cb63a0813168918792b65becb..bf0d3fd830a0a0cc9443ef52e7f167eb704ed152 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -357,6 +357,7 @@ CONFIG_CAN=m - CONFIG_CAN_VCAN=m - CONFIG_CAN_SLCAN=m - CONFIG_CAN_MCP251X=m -+CONFIG_CAN_GS_USB=m - CONFIG_IRDA=m - CONFIG_IRLAN=m - CONFIG_IRNET=m - -From 0334f3d7c7cf1025d9939521423c78b276df45c2 Mon Sep 17 00:00:00 2001 -From: P33M -Date: Mon, 12 Jun 2017 16:10:03 +0100 -Subject: [PATCH 132/173] 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. - -The parameter is modifiable at runtime as it is used when activating new -endpoints (such as on device connect). ---- - drivers/usb/host/dwc_otg/dwc_otg_driver.c | 6 +++++- - drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c | 25 ++++++++++++------------- - 2 files changed, 17 insertions(+), 14 deletions(-) - -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_driver.c b/drivers/usb/host/dwc_otg/dwc_otg_driver.c -index cb060a7179a3eec791506ed2779b553cad9841b0..95943e07528276b26b51ea2d57a1f433f280aaef 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_driver.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c -@@ -249,6 +249,7 @@ uint16_t nak_holdoff = 8; - - unsigned short fiq_fsm_mask = 0x0F; - -+unsigned short int_ep_interval_min = 0; - /** - * This function shows the Driver Version. - */ -@@ -1398,7 +1399,10 @@ MODULE_PARM_DESC(fiq_fsm_mask, "Bitmask of transactions to perform in the FIQ.\n - "Bit 1 : Periodic split transactions\n" - "Bit 2 : High-speed multi-transfer isochronous\n" - "All other bits should be set 0."); -- -+module_param(int_ep_interval_min, ushort, 0644); -+MODULE_PARM_DESC(int_ep_interval_min, "Clamp high-speed Interrupt endpoints to a minimum polling interval.\n" -+ "0..1 = Use endpoint default\n" -+ "2..n = Minimum interval n microframes. Use powers of 2.\n"); - - /** @page "Module Parameters" - * -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -index 4b1dd9de99e9e08b2e006fb5f8a7ef92f20c2553..fe8e8f841f03660c2ad49ab8e66193bec62558d3 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_queue.c -@@ -43,6 +43,7 @@ - #include "dwc_otg_regs.h" - - extern bool microframe_schedule; -+extern unsigned short int_ep_interval_min; - - /** - * Free each QTD in the QH's QTD-list then free the QH. QH should already be -@@ -218,21 +219,19 @@ void qh_init(dwc_otg_hcd_t * hcd, dwc_otg_qh_t * qh, dwc_otg_hcd_urb_t * urb) - SCHEDULE_SLOP); - qh->interval = urb->interval; - --#if 0 -- /* Increase interrupt polling rate for debugging. */ -- if (qh->ep_type == UE_INTERRUPT) { -- qh->interval = 8; -- } --#endif - hprt.d32 = DWC_READ_REG32(hcd->core_if->host_if->hprt0); -- if ((hprt.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) && -- ((dev_speed == USB_SPEED_LOW) || -- (dev_speed == USB_SPEED_FULL))) { -- qh->interval *= 8; -- qh->sched_frame |= 0x7; -- qh->start_split_frame = qh->sched_frame; -+ if (hprt.b.prtspd == DWC_HPRT0_PRTSPD_HIGH_SPEED) { -+ if (dev_speed == USB_SPEED_LOW || -+ dev_speed == USB_SPEED_FULL) { -+ qh->interval *= 8; -+ qh->sched_frame |= 0x7; -+ qh->start_split_frame = qh->sched_frame; -+ } else if (int_ep_interval_min >= 2 && -+ qh->interval < int_ep_interval_min && -+ qh->ep_type == UE_INTERRUPT) { -+ qh->interval = int_ep_interval_min; -+ } - } -- - } - - DWC_DEBUGPL(DBG_HCD, "DWC OTG HCD QH Initialized\n"); - -From a016915f594e2e4e5fe411b6e9a70fd4aed38223 Mon Sep 17 00:00:00 2001 -From: P33M -Date: Tue, 20 Jun 2017 13:44:01 +0100 -Subject: [PATCH 133/173] dwc_otg: fiq_fsm: Add non-periodic TT exclusivity - constraints - -Certain hub types do not discriminate between pipe direction (IN or OUT) -when considering non-periodic transfers. Therefore these hubs get confused -if multiple transfers are issued in different directions with the same -device address and endpoint number. - -Constrain queuing non-periodic split transactions so they are performed -serially in such cases. - -Related: https://github.com/raspberrypi/linux/issues/2024 ---- - drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c | 32 ++++++++++++++++++ - drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h | 2 ++ - drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 53 ++++++++++++++++++++++++++++-- - 3 files changed, 85 insertions(+), 2 deletions(-) - -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c -index 208252645c09d1d17bf07673989f91b7f4b3ef7a..0163e9cf620ba58df36a872b82cea92734baada6 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c -@@ -191,6 +191,32 @@ static void notrace fiq_fsm_setup_csplit(struct fiq_state *st, int n) - mb(); - } - -+/** -+ * fiq_fsm_restart_np_pending() - Restart a single non-periodic contended transfer -+ * @st: Pointer to the channel's state -+ * @num_channels: Total number of host channels -+ * @orig_channel: Channel index of completed transfer -+ * -+ * In the case where an IN and OUT transfer are simultaneously scheduled to the -+ * same device/EP, inadequate hub implementations will misbehave. Once the first -+ * transfer is complete, a pending non-periodic split can then be issued. -+ */ -+static void notrace fiq_fsm_restart_np_pending(struct fiq_state *st, int num_channels, int orig_channel) -+{ -+ int i; -+ int dev_addr = st->channel[orig_channel].hcchar_copy.b.devaddr; -+ int ep_num = st->channel[orig_channel].hcchar_copy.b.epnum; -+ for (i = 0; i < num_channels; i++) { -+ if (st->channel[i].fsm == FIQ_NP_SSPLIT_PENDING && -+ st->channel[i].hcchar_copy.b.devaddr == dev_addr && -+ st->channel[i].hcchar_copy.b.epnum == ep_num) { -+ st->channel[i].fsm = FIQ_NP_SSPLIT_STARTED; -+ fiq_fsm_restart_channel(st, i, 0); -+ break; -+ } -+ } -+} -+ - static inline int notrace fiq_get_xfer_len(struct fiq_state *st, int n) - { - /* The xfersize register is a bit wonky. For IN transfers, it decrements by the packet size. */ -@@ -870,6 +896,9 @@ static int notrace noinline fiq_fsm_do_hcintr(struct fiq_state *state, int num_c - st->fsm = FIQ_NP_SPLIT_HS_ABORTED; - } - } -+ if (st->fsm != FIQ_NP_IN_CSPLIT_RETRY) { -+ fiq_fsm_restart_np_pending(state, num_channels, n); -+ } - break; - - case FIQ_NP_OUT_CSPLIT_RETRY: -@@ -919,6 +948,9 @@ static int notrace noinline fiq_fsm_do_hcintr(struct fiq_state *state, int num_c - st->fsm = FIQ_NP_SPLIT_HS_ABORTED; - } - } -+ if (st->fsm != FIQ_NP_OUT_CSPLIT_RETRY) { -+ fiq_fsm_restart_np_pending(state, num_channels, n); -+ } - break; - - /* Periodic split states (except isoc out) */ -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h -index 0a1ddf3f89f45ca75b8880722fbc22cbdc9f4a2f..ed088f34f210e9a337ab9b80fff0cf9e9b0241ea 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h -+++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.h -@@ -178,6 +178,8 @@ enum fiq_fsm_state { - /* Nonperiodic state groups */ - FIQ_NP_SSPLIT_STARTED = 1, - FIQ_NP_SSPLIT_RETRY = 2, -+ /* TT contention - working around hub bugs */ -+ FIQ_NP_SSPLIT_PENDING = 33, - FIQ_NP_OUT_CSPLIT_RETRY = 3, - FIQ_NP_IN_CSPLIT_RETRY = 4, - FIQ_NP_SPLIT_DONE = 5, -diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -index 71834cf365e67d7ad995bba7869216c4091c3a74..7710370b30363e3170bf9bf522597c5f41dfb908 100644 ---- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -+++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c -@@ -1572,6 +1572,45 @@ int fiq_fsm_setup_periodic_dma(dwc_otg_hcd_t *hcd, struct fiq_channel_state *st, - } - } - -+/** -+ * fiq_fsm_np_tt_contended() - Avoid performing contended non-periodic transfers -+ * @hcd: Pointer to the dwc_otg_hcd struct -+ * @qh: Pointer to the endpoint's queue head -+ * -+ * Certain hub chips don't differentiate between IN and OUT non-periodic pipes -+ * with the same endpoint number. If transfers get completed out of order -+ * (disregarding the direction token) then the hub can lock up -+ * or return erroneous responses. -+ * -+ * Returns 1 if initiating the transfer would cause contention, 0 otherwise. -+ */ -+int fiq_fsm_np_tt_contended(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) -+{ -+ int i; -+ struct fiq_channel_state *st; -+ int dev_addr = qh->channel->dev_addr; -+ int ep_num = qh->channel->ep_num; -+ for (i = 0; i < hcd->core_if->core_params->host_channels; i++) { -+ if (i == qh->channel->hc_num) -+ continue; -+ st = &hcd->fiq_state->channel[i]; -+ switch (st->fsm) { -+ case FIQ_NP_SSPLIT_STARTED: -+ case FIQ_NP_SSPLIT_RETRY: -+ case FIQ_NP_SSPLIT_PENDING: -+ case FIQ_NP_OUT_CSPLIT_RETRY: -+ case FIQ_NP_IN_CSPLIT_RETRY: -+ if (st->hcchar_copy.b.devaddr == dev_addr && -+ st->hcchar_copy.b.epnum == ep_num) -+ return 1; -+ break; -+ default: -+ break; -+ } -+ } -+ return 0; -+} -+ - /* - * Pushing a periodic request into the queue near the EOF1 point - * in a microframe causes erroneous behaviour (frmovrun) interrupt. -@@ -1894,7 +1933,12 @@ int fiq_fsm_queue_split_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) - switch (hc->ep_type) { - case UE_CONTROL: - case UE_BULK: -- st->fsm = FIQ_NP_SSPLIT_STARTED; -+ if (fiq_fsm_np_tt_contended(hcd, qh)) { -+ st->fsm = FIQ_NP_SSPLIT_PENDING; -+ start_immediate = 0; -+ } else { -+ st->fsm = FIQ_NP_SSPLIT_STARTED; -+ } - break; - case UE_ISOCHRONOUS: - if (hc->ep_is_in) { -@@ -1918,7 +1962,12 @@ int fiq_fsm_queue_split_transaction(dwc_otg_hcd_t *hcd, dwc_otg_qh_t *qh) - break; - case UE_INTERRUPT: - if (fiq_fsm_mask & 0x8) { -- st->fsm = FIQ_NP_SSPLIT_STARTED; -+ if (fiq_fsm_np_tt_contended(hcd, qh)) { -+ st->fsm = FIQ_NP_SSPLIT_PENDING; -+ start_immediate = 0; -+ } else { -+ st->fsm = FIQ_NP_SSPLIT_STARTED; -+ } - } else if (start_immediate) { - st->fsm = FIQ_PER_SSPLIT_STARTED; - } else { - -From 7d234795e354ec54b088e8f3d3b1ee0db815722d Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Fri, 26 May 2017 13:03:41 +0100 -Subject: [PATCH 134/173] 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 -midi-uart0, except for ttyS0, which may be useful on Pi3 and also -may avoid an issue with ttyAMA0 failing to synchronise to an active -data stream. - -See: https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=183860 - -Signed-off-by: Phil Elwell ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 7 ++++ - arch/arm/boot/dts/overlays/midi-uart1-overlay.dts | 43 +++++++++++++++++++++++ - 3 files changed, 51 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/midi-uart1-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index e2f66a55dc5afe13d690c2c17827054ac94b7168..e0ff5793f124fce73732e175bfca424f0a97b632 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -56,6 +56,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ - mcp2515-can1.dtbo \ - mcp3008.dtbo \ - midi-uart0.dtbo \ -+ midi-uart1.dtbo \ - mmc.dtbo \ - mz61581.dtbo \ - pi3-act-led.dtbo \ -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index e2a803e5180cf78d67b6723cfd2f6d3b2b54e53b..ec9e7b1941678796facf625b3770c20ed0b15b25 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -864,6 +864,13 @@ Load: dtoverlay=midi-uart0 - Params: - - -+Name: midi-uart1 -+Info: Configures UART1 (ttyS0) so that a requested 38.4kbaud actually gets -+ 31.25kbaud, the frequency required for MIDI -+Load: dtoverlay=midi-uart1 -+Params: -+ -+ - Name: mmc - Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock - Load: dtoverlay=mmc,= -diff --git a/arch/arm/boot/dts/overlays/midi-uart1-overlay.dts b/arch/arm/boot/dts/overlays/midi-uart1-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..e0bc410acbff3a7a175dd5d53b3ab0d0802e8239 ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/midi-uart1-overlay.dts -@@ -0,0 +1,43 @@ -+/dts-v1/; -+/plugin/; -+ -+#include -+ -+/* -+ * Fake a higher clock rate to get a larger divisor, and thereby a lower -+ * baudrate. The real clock is 48MHz, which we scale so that requesting -+ * 38.4kHz results in an actual 31.25kHz. -+ * -+ * 48000000*38400/31250 = 58982400 -+ */ -+ -+/{ -+ compatible = "brcm,bcm2835"; -+ -+ fragment@0 { -+ target-path = "/clocks"; -+ __overlay__ { -+ midi_clk: clock@5 { -+ compatible = "fixed-factor-clock"; -+ #clock-cells = <0>; -+ clocks = <&aux BCM2835_AUX_CLOCK_UART>; -+ clock-mult = <38400>; -+ clock-div = <31250>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&uart1>; -+ __overlay__ { -+ clocks = <&midi_clk>; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&aux>; -+ __overlay__ { -+ clock-output-names = "aux_uart", "aux_spi1", "aux_spi2"; -+ }; -+ }; -+}; - -From 5dfe95ff49ef769f8d7674639e0c4561f50b847b Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Sat, 20 May 2017 22:10:14 +0100 -Subject: [PATCH 135/173] overlays: README: remove vestigial SDIO parameters - -Signed-off-by: Phil Elwell ---- - arch/arm/boot/dts/overlays/README | 24 ++---------------------- - 1 file changed, 2 insertions(+), 22 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index ec9e7b1941678796facf625b3770c20ed0b15b25..499cd1920fd373702cfbc9f6e0fcaebca8a47cfc 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -1203,19 +1203,9 @@ Name: sdio - Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, - and enables SDIO via GPIOs 22-27. - Load: dtoverlay=sdio,= --Params: overclock_50 SD Clock (in MHz) to use when the MMC framework -- requests 50MHz -- -- sdio_overclock SDIO Clock (in MHz) to use when the MMC -+Params: sdio_overclock SDIO Clock (in MHz) to use when the MMC - framework requests 50MHz - -- force_pio Disable DMA support (default off) -- -- pio_limit Number of blocks above which to use DMA -- (default 1) -- -- debug Enable debug output (default off) -- - poll_once Disable SDIO-device polling every second - (default on: polling once at boot-time) - -@@ -1226,19 +1216,9 @@ Name: sdio-1bit - Info: Selects the bcm2835-sdhost SD/MMC driver, optionally with overclock, - and enables 1-bit SDIO via GPIOs 22-25. - Load: dtoverlay=sdio-1bit,= --Params: overclock_50 SD Clock (in MHz) to use when the MMC framework -- requests 50MHz -- -- sdio_overclock SDIO Clock (in MHz) to use when the MMC -+Params: sdio_overclock SDIO Clock (in MHz) to use when the MMC - framework requests 50MHz - -- force_pio Disable DMA support (default off) -- -- pio_limit Number of blocks above which to use DMA -- (default 1) -- -- debug Enable debug output (default off) -- - poll_once Disable SDIO-device polling every second - (default on: polling once at boot-time) - - -From eaf3d7aa7038a5f1b13fd2b62cd0674f915824d4 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 27 Jun 2017 15:07:14 +0100 -Subject: [PATCH 136/173] SQUASH: mmc: Apply ERASE_BROKEN quirks correctly - -Squash with: mmc: Add MMC_QUIRK_ERASE_BROKEN for some cards - -Signed-off-by: Phil Elwell ---- - drivers/mmc/core/quirks.h | 9 +++------ - 1 file changed, 3 insertions(+), 6 deletions(-) - -diff --git a/drivers/mmc/core/quirks.h b/drivers/mmc/core/quirks.h -index 05c8d7381fff5ae88531129d9a5ddd554bddb43e..c9d5d644688c1509d7febcff0322fbaba0a842d6 100644 ---- a/drivers/mmc/core/quirks.h -+++ b/drivers/mmc/core/quirks.h -@@ -94,12 +94,9 @@ static const struct mmc_fixup mmc_blk_fixups[] = { - * On some Kingston SD cards, multiple erases of less than 64 - * sectors can cause corruption. - */ -- MMC_FIXUP("SD16G", 0x41, 0x3432, add_quirk_mmc, -- MMC_QUIRK_ERASE_BROKEN), -- MMC_FIXUP("SD32G", 0x41, 0x3432, add_quirk_mmc, -- MMC_QUIRK_ERASE_BROKEN), -- MMC_FIXUP("SD64G", 0x41, 0x3432, add_quirk_mmc, -- MMC_QUIRK_ERASE_BROKEN), -+ MMC_FIXUP("SD16G", 0x41, 0x3432, add_quirk, MMC_QUIRK_ERASE_BROKEN), -+ MMC_FIXUP("SD32G", 0x41, 0x3432, add_quirk, MMC_QUIRK_ERASE_BROKEN), -+ MMC_FIXUP("SD64G", 0x41, 0x3432, add_quirk, MMC_QUIRK_ERASE_BROKEN), - - END_FIXUP - }; - -From 5e831629bc1d7eefbe3a98bea00f0758a9fb1990 Mon Sep 17 00:00:00 2001 +From fd8ac75172f2c4f3c3ffc00a9dee82e395753039 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 7 May 2017 11:34:26 +0200 -Subject: [PATCH 137/173] ASoC: bcm2835: Add support for TDM modes +Subject: [PATCH 124/140] 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 @@ -133425,10 +134321,10 @@ index 56df7d8a43d0aac055a91b0d24aca8e1b4e308e4..dcacf7f83c9371df539a788ea33fedcf dev->dev = &pdev->dev; dev_set_drvdata(&pdev->dev, dev); -From a6b31aa9fe739751f7f3990027408f1a6bde3cf0 Mon Sep 17 00:00:00 2001 +From 5f426708cac0c7c6cd9b235c41b67efc0119c3fd Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 7 May 2017 15:30:50 +0200 -Subject: [PATCH 138/173] ASoC: bcm2835: Support left/right justified and DSP +Subject: [PATCH 125/140] ASoC: bcm2835: Support left/right justified and DSP modes DSP modes and left/right justified modes can be supported @@ -133674,10 +134570,10 @@ index dcacf7f83c9371df539a788ea33fedcf97d64690..3a706fda4f39e42efbe12f19d87af9b1 } -From 44e6d969cd8d8978d9d6e96cfde02566954ea6d9 Mon Sep 17 00:00:00 2001 +From 0e3b657011ab7be605f2ffe0599a613bd55576a4 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 7 May 2017 16:19:54 +0200 -Subject: [PATCH 139/173] ASoC: bcm2835: Support additional samplerates up to +Subject: [PATCH 126/140] ASoC: bcm2835: Support additional samplerates up to 384kHz Sample rates are only restricted by the capabilities of the @@ -133720,10 +134616,10 @@ index 3a706fda4f39e42efbe12f19d87af9b100a348a5..43f5715a0d5dda851731ecf7ff27e76c | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE -From 35185a071e2e90872f7ccc8ba5110949300ce6fd Mon Sep 17 00:00:00 2001 +From 2dc5c8752afdc76d3bd039510a267aa005f0e589 Mon Sep 17 00:00:00 2001 From: Matthias Reichl Date: Sun, 7 May 2017 16:24:57 +0200 -Subject: [PATCH 140/173] ASoC: bcm2835: Enforce full symmetry +Subject: [PATCH 127/140] 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. @@ -133759,1643 +134655,10 @@ index 43f5715a0d5dda851731ecf7ff27e76c48fb6e57..2e449d7173fcecbcd647f90a26bd58b6 static bool bcm2835_i2s_volatile_reg(struct device *dev, unsigned int reg) -From 45e973ed24dd64930b942ecfe824904f561cc00e Mon Sep 17 00:00:00 2001 -From: Matthias Reichl -Date: Thu, 6 Jul 2017 18:52:16 +0200 -Subject: [PATCH 141/173] config: add missing arizona regulator modules - -In kernel 4.12 CONFIG_REGULATOR_ARIZONA was replaced by 2 separate -options for LDO1 and MICSUPP regulators. Enable these, they are -needed by the Cirrus Logic Audio Card. - -Also regenerate configs with make savedefconfig to get rid of -the duplicated CONFIG_TOUCHSCREEN_EDT_FT5X06 entry. - -Signed-off-by: Matthias Reichl ---- - arch/arm/configs/bcm2709_defconfig | 3 ++- - arch/arm/configs/bcmrpi_defconfig | 2 ++ - 2 files changed, 4 insertions(+), 1 deletion(-) - -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index fd6d3980bc003801a6868e6098f3868a2544573f..95da3daaf33c7cfab76f6af397e058e9ed8d998f 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -568,7 +568,6 @@ CONFIG_JOYSTICK_RPISENSE=m - CONFIG_INPUT_TOUCHSCREEN=y - CONFIG_TOUCHSCREEN_ADS7846=m - CONFIG_TOUCHSCREEN_EGALAX=m --CONFIG_TOUCHSCREEN_EDT_FT5X06=m - CONFIG_TOUCHSCREEN_GOODIX=m - CONFIG_TOUCHSCREEN_EDT_FT5X06=m - CONFIG_TOUCHSCREEN_RPI_FT5406=m -@@ -671,6 +670,8 @@ CONFIG_MFD_ARIZONA_SPI=m - CONFIG_MFD_WM5102=y - CONFIG_REGULATOR=y - CONFIG_REGULATOR_FIXED_VOLTAGE=m -+CONFIG_REGULATOR_ARIZONA_LDO1=m -+CONFIG_REGULATOR_ARIZONA_MICSUPP=m - CONFIG_MEDIA_SUPPORT=m - CONFIG_MEDIA_CAMERA_SUPPORT=y - CONFIG_MEDIA_ANALOG_TV_SUPPORT=y -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index bf0d3fd830a0a0cc9443ef52e7f167eb704ed152..06d0520e332f21afaa27ac112c0eee6c36a9a9df 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -663,6 +663,8 @@ CONFIG_MFD_ARIZONA_SPI=m - CONFIG_MFD_WM5102=y - CONFIG_REGULATOR=y - CONFIG_REGULATOR_FIXED_VOLTAGE=m -+CONFIG_REGULATOR_ARIZONA_LDO1=m -+CONFIG_REGULATOR_ARIZONA_MICSUPP=m - CONFIG_MEDIA_SUPPORT=m - CONFIG_MEDIA_CAMERA_SUPPORT=y - CONFIG_MEDIA_ANALOG_TV_SUPPORT=y - -From 023dc39250043ccc51c52feac97e463813042707 Mon Sep 17 00:00:00 2001 -From: Matt Flax -Date: Tue, 4 Apr 2017 19:20:59 +1000 -Subject: [PATCH 142/173] Audioinjector : make the octo and pi sound cards have - different driver names - -This patch gives the audioinjector octo and pi soundcards different driver -names. This allows both the be loaded without clashing. ---- - sound/soc/bcm/audioinjector-octo-soundcard.c | 2 +- - sound/soc/bcm/audioinjector-pi-soundcard.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/sound/soc/bcm/audioinjector-octo-soundcard.c b/sound/soc/bcm/audioinjector-octo-soundcard.c -index dcf403ab37639ba79e38278d7e4b1ade452c292a..49115c8e20ce1a2ba5a99feb8983a1cafb052ca2 100644 ---- a/sound/soc/bcm/audioinjector-octo-soundcard.c -+++ b/sound/soc/bcm/audioinjector-octo-soundcard.c -@@ -324,7 +324,7 @@ MODULE_DEVICE_TABLE(of, audioinjector_octo_of_match); - - static struct platform_driver audioinjector_octo_driver = { - .driver = { -- .name = "audioinjector-audio", -+ .name = "audioinjector-octo", - .owner = THIS_MODULE, - .of_match_table = audioinjector_octo_of_match, - }, -diff --git a/sound/soc/bcm/audioinjector-pi-soundcard.c b/sound/soc/bcm/audioinjector-pi-soundcard.c -index ef54e0f07ea03f59e9957b5d98f3e7fdc998e469..491906bbf446826e55dd843f28e4860f48e908b8 100644 ---- a/sound/soc/bcm/audioinjector-pi-soundcard.c -+++ b/sound/soc/bcm/audioinjector-pi-soundcard.c -@@ -177,7 +177,7 @@ MODULE_DEVICE_TABLE(of, audioinjector_pi_soundcard_of_match); - - static struct platform_driver audioinjector_pi_soundcard_driver = { - .driver = { -- .name = "audioinjector-audio", -+ .name = "audioinjector-stereo", - .owner = THIS_MODULE, - .of_match_table = audioinjector_pi_soundcard_of_match, - }, - -From d7ddfc8a6b3f9fce8c4ebc1b5f99219d2cc93289 Mon Sep 17 00:00:00 2001 -From: Matt Flax -Date: Tue, 4 Apr 2017 19:23:04 +1000 -Subject: [PATCH 143/173] Audioinjector octo : Make the playback and capture - symmetric - -This patch ensures that the sample rate and channel count of the audioinjector -octo sound card are symmetric. ---- - sound/soc/bcm/audioinjector-octo-soundcard.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/sound/soc/bcm/audioinjector-octo-soundcard.c b/sound/soc/bcm/audioinjector-octo-soundcard.c -index 49115c8e20ce1a2ba5a99feb8983a1cafb052ca2..5e79f4eff93a21ed3495c77a90f73525695cb3d5 100644 ---- a/sound/soc/bcm/audioinjector-octo-soundcard.c -+++ b/sound/soc/bcm/audioinjector-octo-soundcard.c -@@ -204,6 +204,8 @@ static struct snd_soc_dai_link audioinjector_octo_dai[] = { - .codec_dai_name = "cs42448", - .ops = &audioinjector_octo_ops, - .init = audioinjector_octo_dai_init, -+ .symmetric_rates = 1, -+ .symmetric_channels = 1, - }, - }; - - -From 9d033a4fbcf7494550753f3d2d978300b6a9c9aa Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Sun, 23 Apr 2017 19:36:53 +0100 -Subject: [PATCH 144/173] BCM270X_DT: Add bme280 and bmp180 to i2c-sensor - overlay - -Signed-off-by: Phil Elwell ---- - arch/arm/boot/dts/overlays/README | 11 +++++++++-- - arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts | 15 +++++++++++++++ - 2 files changed, 24 insertions(+), 2 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 499cd1920fd373702cfbc9f6e0fcaebca8a47cfc..d32a31cbf4a4382ddfc1b38018ef3ff0ff445145 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -652,9 +652,16 @@ Name: i2c-sensor - Info: Adds support for a number of I2C barometric pressure and temperature - sensors on i2c_arm - Load: dtoverlay=i2c-sensor,= --Params: bmp085 Select the Bosch sensortronic BMP085 -+Params: addr Set the address for the BME280 and BMP280 (0x76 -+ or 0x77 - default 0x76) - -- bmp280 Select the Bosch sensortronic BMP280 -+ bme280 Select the Bosch Sensortronic BME280 -+ -+ bmp085 Select the Bosch Sensortronic BMP085 -+ -+ bmp180 Select the Bosch Sensortronic BMP180 -+ -+ bmp280 Select the Bosch Sensortronic BMP280 - - lm75 Select the Maxim LM75 temperature sensor - -diff --git a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -index 606b2d5012abf2e85712be631c42ea40a0b512c5..e23e34b32a0a8927c14203d7384e800878627347 100644 ---- a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -+++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -@@ -12,6 +12,12 @@ - #size-cells = <0>; - status = "okay"; - -+ bme280: bme280@76 { -+ compatible = "bosch,bme280"; -+ reg = <0x76>; -+ status = "disable"; -+ }; -+ - bmp085: bmp085@77 { - compatible = "bosch,bmp085"; - reg = <0x77>; -@@ -19,6 +25,12 @@ - status = "disable"; - }; - -+ bmp180: bmp180@77 { -+ compatible = "bosch,bmp180"; -+ reg = <0x77>; -+ status = "disable"; -+ }; -+ - bmp280: bmp280@76 { - compatible = "bosch,bmp280"; - reg = <0x76>; -@@ -40,7 +52,10 @@ - }; - - __overrides__ { -+ addr = <&bme280>,"reg:0", <&bmp280>,"reg:0"; -+ bme280 = <&bme280>,"status"; - bmp085 = <&bmp085>,"status"; -+ bmp180 = <&bmp180>,"status"; - bmp280 = <&bmp280>,"status"; - lm75 = <&lm75>,"status"; - lm75addr = <&lm75>,"reg:0"; - -From bc28b940403b534e37ded263719bf201b6552eab Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Sun, 23 Apr 2017 19:38:06 +0100 -Subject: [PATCH 145/173] config: Add CONFIG_BMP280 (and CONFIG_BMP280_I2C) - -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 95da3daaf33c7cfab76f6af397e058e9ed8d998f..c86d93a0b103cf812f502088f31ec222f4dea90a 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -1170,6 +1170,7 @@ CONFIG_MCP320X=m - CONFIG_MCP3422=m - CONFIG_DHT11=m - CONFIG_HTU21=m -+CONFIG_BMP280=m - CONFIG_PWM_BCM2835=m - CONFIG_PWM_PCA9685=m - CONFIG_RASPBERRYPI_FIRMWARE=y -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 06d0520e332f21afaa27ac112c0eee6c36a9a9df..515f335d2a638de60d07a45df19ce52a7579f9ca 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -1176,6 +1176,7 @@ CONFIG_MCP320X=m - CONFIG_MCP3422=m - CONFIG_DHT11=m - CONFIG_HTU21=m -+CONFIG_BMP280=m - CONFIG_PWM_BCM2835=m - CONFIG_PWM_PCA9685=m - CONFIG_RASPBERRYPI_FIRMWARE=y - -From 05b3c24c5689b336a7b3114e08bb75ff07df5507 Mon Sep 17 00:00:00 2001 -From: Scott Ellis -Date: Tue, 25 Apr 2017 10:46:09 -0400 -Subject: [PATCH 146/173] config: Enable TI TMP102 temp sensor module - -Signed-off-by: Scott Ellis ---- - 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 c86d93a0b103cf812f502088f31ec222f4dea90a..5f5830fb19c497895c3e6d6e3a47e961fc84e09a 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -659,6 +659,7 @@ CONFIG_SENSORS_SHT21=m - CONFIG_SENSORS_SHTC1=m - CONFIG_SENSORS_ADS1015=m - CONFIG_SENSORS_INA2XX=m -+CONFIG_SENSORS_TMP102=m - CONFIG_THERMAL=y - CONFIG_BCM2835_THERMAL=y - CONFIG_WATCHDOG=y -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 515f335d2a638de60d07a45df19ce52a7579f9ca..bfda35e4c4bce99b5125eab80f97c73a159de969 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -652,6 +652,7 @@ CONFIG_SENSORS_SHT21=m - CONFIG_SENSORS_SHTC1=m - CONFIG_SENSORS_ADS1015=m - CONFIG_SENSORS_INA2XX=m -+CONFIG_SENSORS_TMP102=m - CONFIG_THERMAL=y - CONFIG_BCM2835_THERMAL=y - CONFIG_WATCHDOG=y - -From e70fd08d60935d04026931c60a6ebc7115e1fe2c Mon Sep 17 00:00:00 2001 -From: Scott Ellis -Date: Tue, 25 Apr 2017 13:05:42 -0400 -Subject: [PATCH 147/173] BCM270X_DT: Add tmp102 to i2c sensor overlay - -Signed-off-by: Scott Ellis ---- - arch/arm/boot/dts/overlays/README | 9 +++++++-- - arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts | 11 +++++++++-- - 2 files changed, 16 insertions(+), 4 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index d32a31cbf4a4382ddfc1b38018ef3ff0ff445145..4171208933e675a5a3a7e17f8b15447f30a11887 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -652,16 +652,18 @@ Name: i2c-sensor - Info: Adds support for a number of I2C barometric pressure and temperature - sensors on i2c_arm - Load: dtoverlay=i2c-sensor,= --Params: addr Set the address for the BME280 and BMP280 (0x76 -- or 0x77 - default 0x76) -+Params: addr Set the address for the BME280, BMP280 or -+ TMP102 - - bme280 Select the Bosch Sensortronic BME280 -+ Valid addresses 0x76-0x77, default 0x76 - - bmp085 Select the Bosch Sensortronic BMP085 - - bmp180 Select the Bosch Sensortronic BMP180 - - bmp280 Select the Bosch Sensortronic BMP280 -+ Valid addresses 0x76-0x77, default 0x76 - - lm75 Select the Maxim LM75 temperature sensor - -@@ -671,6 +673,9 @@ Params: addr Set the address for the BME280 and BMP280 (0x76 - si7020 Select the Silicon Labs Si7013/20/21 humidity/ - temperature sensor - -+ tmp102 Select the Texas Instruments TMP102 temp sensor -+ Valid addresses 0x48-0x4b, default 0x48 -+ - - Name: i2c0-bcm2708 - Info: Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations -diff --git a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -index e23e34b32a0a8927c14203d7384e800878627347..e86a13f92c3f75c14fa4425cdfb081d6795ff76a 100644 ---- a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -+++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -@@ -1,4 +1,4 @@ --// Definitions for I2C based sensors using the Industrial IO interface. -+// Definitions for I2C based sensors using the Industrial IO or HWMON interface. - /dts-v1/; - /plugin/; - -@@ -48,11 +48,17 @@ - reg = <0x40>; - status = "disable"; - }; -+ -+ tmp102: tmp102@48 { -+ compatible = "ti,tmp102"; -+ reg = <0x48>; -+ status = "disable"; -+ }; - }; - }; - - __overrides__ { -- addr = <&bme280>,"reg:0", <&bmp280>,"reg:0"; -+ addr = <&bme280>,"reg:0", <&bmp280>,"reg:0", <&tmp102>,"reg:0"; - bme280 = <&bme280>,"status"; - bmp085 = <&bmp085>,"status"; - bmp180 = <&bmp180>,"status"; -@@ -60,5 +66,6 @@ - lm75 = <&lm75>,"status"; - lm75addr = <&lm75>,"reg:0"; - si7020 = <&si7020>,"status"; -+ tmp102 = <&tmp102>,"status"; - }; - }; - -From 80ff6ff1ba623da4a2e680a4ea641d47ad00c93d Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Mon, 8 May 2017 16:43:40 +0100 -Subject: [PATCH 148/173] 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 -be started. The wfe instruction causes a core to wait until an event -or interrupt arrives before continuing to the next instruction. -The sev instruction sends a wakeup event to the other cores, so call -it from bcm2836_smp_boot_secondary, the function that wakes up the -waiting cores during booting. - -It is harmless to use this patch without the corresponding change -adding wfe to the ARMv7/ARMv8-32 stubs, but if the stubs are updated -and this patch is not applied then the other cores will sleep forever. - -See: https://github.com/raspberrypi/linux/issues/1989 - -Signed-off-by: Phil Elwell ---- - drivers/irqchip/irq-bcm2836.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/drivers/irqchip/irq-bcm2836.c b/drivers/irqchip/irq-bcm2836.c -index 9a7ee04ee0d9b7aa734cf3159ed59c19a338de0d..014f13f89eb896f5cfc75ed9891787d0490baa4b 100644 ---- a/drivers/irqchip/irq-bcm2836.c -+++ b/drivers/irqchip/irq-bcm2836.c -@@ -248,6 +248,9 @@ static int __init bcm2836_smp_boot_secondary(unsigned int cpu, - writel(secondary_startup_phys, - intc.base + LOCAL_MAILBOX3_SET0 + 16 * cpu); - -+ dsb(sy); /* Ensure write has completed before waking the other CPUs */ -+ sev(); -+ - return 0; - } - - -From ae1b61f594b8a110ee91f13b30bedf6eea13ff4e Mon Sep 17 00:00:00 2001 -From: Ahmet Inan -Date: Mon, 15 May 2017 17:10:53 +0200 -Subject: [PATCH 149/173] 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. - -Signed-off-by: Ahmet Inan ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 8 +++++ - arch/arm/boot/dts/overlays/goodix-overlay.dts | 46 +++++++++++++++++++++++++++ - 3 files changed, 55 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/goodix-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index e0ff5793f124fce73732e175bfca424f0a97b632..ddf431837b619f99beb8df45a2714c112e02273c 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -25,6 +25,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ - enc28j60.dtbo \ - enc28j60-spi2.dtbo \ - fe-pi-audio.dtbo \ -+ goodix.dtbo \ - googlevoicehat-soundcard.dtbo \ - gpio-ir.dtbo \ - gpio-poweroff.dtbo \ -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 4171208933e675a5a3a7e17f8b15447f30a11887..dc391ac88f738c9a711b01a87561c94733745457 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -459,6 +459,14 @@ Load: dtoverlay=fe-pi-audio - Params: - - -+Name: goodix -+Info: Enables I2C connected Goodix gt9271 multiple touch controller using -+ GPIOs 4 and 17 (pins 7 and 11 on GPIO header) for interrupt and reset. -+Load: dtoverlay=goodix,= -+Params: interrupt GPIO used for interrupt (default 4) -+ reset GPIO used for reset (default 17) -+ -+ - Name: googlevoicehat-soundcard - Info: Configures the Google voiceHAT soundcard - Load: dtoverlay=googlevoicehat-soundcard -diff --git a/arch/arm/boot/dts/overlays/goodix-overlay.dts b/arch/arm/boot/dts/overlays/goodix-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..084f74042ed6379ebd9281374d5391a7e23a431e ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/goodix-overlay.dts -@@ -0,0 +1,46 @@ -+// Device tree overlay for I2C connected Goodix gt9271 multiple touch controller -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ goodix_pins: goodix_pins { -+ brcm,pins = <4 17>; // interrupt and reset -+ brcm,function = <0 0>; // in -+ brcm,pull = <2 2>; // pull-up -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ gt9271: gt9271@14 { -+ compatible = "goodix,gt9271"; -+ reg = <0x14>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&goodix_pins>; -+ interrupt-parent = <&gpio>; -+ interrupts = <4 2>; // high-to-low edge triggered -+ irq-gpios = <&gpio 4 0>; // Pin7 on GPIO header -+ reset-gpios = <&gpio 17 0>; // Pin11 on GPIO header -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ interrupt = <&goodix_pins>,"brcm,pins:0", -+ <>9271>,"interrupts:0", -+ <>9271>,"irq-gpios:4"; -+ reset = <&goodix_pins>,"brcm,pins:4", -+ <>9271>,"reset-gpios:4"; -+ }; -+}; - -From c183f774a63c80cae7889f78d070eb5ce325cf9b Mon Sep 17 00:00:00 2001 -From: chenzhiwo -Date: Wed, 17 May 2017 16:34:57 +0800 -Subject: [PATCH 150/173] Add device tree overlay for GPIO connected rotary - encoder. See Documentation/input/rotary-encoder.txt for more information. - ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 9 +++++ - .../boot/dts/overlays/rotary-encoder-overlay.dts | 43 ++++++++++++++++++++++ - 3 files changed, 53 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/rotary-encoder-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index ddf431837b619f99beb8df45a2714c112e02273c..6853e3575f001522a402e7eb31933d32fbac581d 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -76,6 +76,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ - pwm-2chan.dtbo \ - qca7000.dtbo \ - raspidac3.dtbo \ -+ rotary-encoder.dtbo \ - rpi-backlight.dtbo \ - rpi-cirrus-wm5102.dtbo \ - rpi-dac.dtbo \ -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index dc391ac88f738c9a711b01a87561c94733745457..f7e11387e535ce2dba8272798a023963315685b6 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -1122,6 +1122,15 @@ Load: dtoverlay=raspidac3 - Params: - - -+Name: rotary-encoder -+Info: Overlay for GPIO connected rotary encoder. -+Load: dtoverlay=rotary-encoder,= -+Params: rotary0_pin_a GPIO connected to rotary encoder channel A -+ (default 4). -+ rotary0_pin_b GPIO connected to rotary encoder channel B -+ (default 17). -+ -+ - Name: rpi-backlight - Info: Raspberry Pi official display backlight driver - Load: dtoverlay=rpi-backlight -diff --git a/arch/arm/boot/dts/overlays/rotary-encoder-overlay.dts b/arch/arm/boot/dts/overlays/rotary-encoder-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..c0c6bccff60cc15d9a9bf59d2c7cba41eb9c1cdc ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/rotary-encoder-overlay.dts -@@ -0,0 +1,43 @@ -+// Device tree overlay for GPIO connected rotary encoder. -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&gpio>; -+ __overlay__ { -+ rotary0_pins: rotary0_pins { -+ brcm,pins = <4 17>; /* gpio 4 17 */ -+ brcm,function = <0 0>; /* input */ -+ brcm,pull = <2 2>; /* pull-up */ -+ }; -+ -+ }; -+ }; -+ -+ fragment@1 { -+ target-path = "/"; -+ __overlay__ { -+ rotary0: rotary@0 { -+ compatible = "rotary-encoder"; -+ status = "okay"; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&rotary0_pins>; -+ gpios = <&gpio 4 0>, <&gpio 17 0>; -+ linux,axis = <0>; /* REL_X */ -+ rotary-encoder,encoding = "gray"; -+ rotary-encoder,relative-axis; -+ }; -+ }; -+ -+ }; -+ -+ __overrides__ { -+ rotary0_pin_a = <&rotary0>,"gpios:4", -+ <&rotary0_pins>,"brcm,pins:0"; -+ rotary0_pin_b = <&rotary0>,"gpios:16", -+ <&rotary0_pins>,"brcm,pins:4"; -+ }; -+}; - -From 9c1c2351c13ce7b2d20de04a438125bb0d75734d Mon Sep 17 00:00:00 2001 -From: Anton Onishchenko -Date: Tue, 23 May 2017 18:55:46 +0300 -Subject: [PATCH 151/173] mpu6050 device tree overlay (#2031) - -Add overlay and config options for InvenSense MPU6050 6-axis motion -detector. ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 6 ++++++ - arch/arm/boot/dts/overlays/mpu6050-overlay.dts | 28 ++++++++++++++++++++++++++ - arch/arm/configs/bcm2709_defconfig | 3 +-- - arch/arm/configs/bcmrpi_defconfig | 3 +-- - 5 files changed, 37 insertions(+), 4 deletions(-) - create mode 100644 arch/arm/boot/dts/overlays/mpu6050-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index 6853e3575f001522a402e7eb31933d32fbac581d..c95b37f0a4c72160421f44819c5f29246d3352f9 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -59,6 +59,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ - midi-uart0.dtbo \ - midi-uart1.dtbo \ - mmc.dtbo \ -+ mpu6050.dtbo \ - mz61581.dtbo \ - pi3-act-led.dtbo \ - pi3-disable-bt.dtbo \ -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index f7e11387e535ce2dba8272798a023963315685b6..d560490c2661c3396d37315bbb9b2d9e93b5ac15 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -898,6 +898,12 @@ Params: overclock_50 Clock (in MHz) to use when the MMC framework - requests 50MHz - - -+Name: mpu6050 -+Info: Overlay for i2c connected mpu6050 imu -+Load: dtoverlay=mpu6050,= -+Params: interrupt GPIO pin for interrupt (default 4) -+ -+ - Name: mz61581 - Info: MZ61581 display by Tontec - Load: dtoverlay=mz61581,= -diff --git a/arch/arm/boot/dts/overlays/mpu6050-overlay.dts b/arch/arm/boot/dts/overlays/mpu6050-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..06037969c3abba270b3cad45875342f3c730506e ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/mpu6050-overlay.dts -@@ -0,0 +1,28 @@ -+// Definitions for MPU6050 -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ clock-frequency = <400000>; -+ -+ mpu6050: mpu6050@68 { -+ compatible = "invensense,mpu6050"; -+ reg = <0x68>; -+ interrupt-parent = <&gpio>; -+ interrupts = <4 1>; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ interrupt = <&mpu6050>,"interrupts:0"; -+ }; -+}; -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 5f5830fb19c497895c3e6d6e3a47e961fc84e09a..b310e13042b20c709a8139d0b3973c3ed5f283cf 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -1164,13 +1164,12 @@ CONFIG_RASPBERRYPI_POWER=y - CONFIG_EXTCON=m - CONFIG_EXTCON_ARIZONA=m - CONFIG_IIO=m --CONFIG_IIO_BUFFER=y - CONFIG_IIO_BUFFER_CB=m --CONFIG_IIO_KFIFO_BUF=m - CONFIG_MCP320X=m - CONFIG_MCP3422=m - CONFIG_DHT11=m - CONFIG_HTU21=m -+CONFIG_INV_MPU6050_I2C=m - CONFIG_BMP280=m - CONFIG_PWM_BCM2835=m - CONFIG_PWM_PCA9685=m -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index bfda35e4c4bce99b5125eab80f97c73a159de969..a9841b71a4b633a81392c533578845d62f6aa78f 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -1170,13 +1170,12 @@ CONFIG_RASPBERRYPI_POWER=y - CONFIG_EXTCON=m - CONFIG_EXTCON_ARIZONA=m - CONFIG_IIO=m --CONFIG_IIO_BUFFER=y - CONFIG_IIO_BUFFER_CB=m --CONFIG_IIO_KFIFO_BUF=m - CONFIG_MCP320X=m - CONFIG_MCP3422=m - CONFIG_DHT11=m - CONFIG_HTU21=m -+CONFIG_INV_MPU6050_I2C=m - CONFIG_BMP280=m - CONFIG_PWM_BCM2835=m - CONFIG_PWM_PCA9685=m - -From 3bcb0faa9c3c8d30eb78355ee4897c551a2b5ab4 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 31 May 2017 09:33:55 +0100 -Subject: [PATCH 152/173] config: Adding SENSOR_JC42 - -The jc42 module supports a number of I2C-based temperature -sensor modules. - -[ DM_RAID0 config lost because now selected by DM_RAID ] - -See: https://github.com/raspberrypi/linux/issues/2046 - -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 b310e13042b20c709a8139d0b3973c3ed5f283cf..00845b52952479976b4fdfdc94a16a366d82ae7d 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -654,6 +654,7 @@ CONFIG_POWER_RESET=y - CONFIG_POWER_RESET_GPIO=y - CONFIG_BATTERY_DS2760=m - CONFIG_HWMON=m -+CONFIG_SENSORS_JC42=m - CONFIG_SENSORS_LM75=m - CONFIG_SENSORS_SHT21=m - CONFIG_SENSORS_SHTC1=m -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index a9841b71a4b633a81392c533578845d62f6aa78f..2ba46a28c2e7b21a401cc3544353937eca44218d 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -647,6 +647,7 @@ CONFIG_POWER_RESET=y - CONFIG_POWER_RESET_GPIO=y - CONFIG_BATTERY_DS2760=m - CONFIG_HWMON=m -+CONFIG_SENSORS_JC42=m - CONFIG_SENSORS_LM75=m - CONFIG_SENSORS_SHT21=m - CONFIG_SENSORS_SHTC1=m - -From 0b1e677ecc506655be6c22dd09851ad6ddd69982 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 31 May 2017 15:27:39 +0100 -Subject: [PATCH 153/173] 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 -also changes the node address. Although the overlay grows slightly, -when applied only the requested node is included. - -Usage does not change, except that the "lm75addr" parameter of the -i2c-sensor overlay has been deprecated in favour of the generic -"addr" parameter. - -Signed-off-by: Phil Elwell ---- - arch/arm/boot/dts/overlays/README | 8 +- - arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts | 127 ++++++++++++++++++---- - arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts | 87 ++++++++++++--- - 3 files changed, 179 insertions(+), 43 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index d560490c2661c3396d37315bbb9b2d9e93b5ac15..ce8706a8aa88c36b0dee95c56ee58b4a524b8b43 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -660,8 +660,8 @@ Name: i2c-sensor - Info: Adds support for a number of I2C barometric pressure and temperature - sensors on i2c_arm - Load: dtoverlay=i2c-sensor,= --Params: addr Set the address for the BME280, BMP280 or -- TMP102 -+Params: addr Set the address for the BME280, BMP280, TMP102 -+ or LM75 - - bme280 Select the Bosch Sensortronic BME280 - Valid addresses 0x76-0x77, default 0x76 -@@ -674,9 +674,9 @@ Params: addr Set the address for the BME280, BMP280 or - Valid addresses 0x76-0x77, default 0x76 - - lm75 Select the Maxim LM75 temperature sensor -+ Valid addresses 0x48-0x4f, default 0x4f - -- lm75addr Choose the address for the LM75 (0x48-0x4f - -- default 0x4f) -+ lm75addr Deprecated - use addr parameter instead - - si7020 Select the Silicon Labs Si7013/20/21 humidity/ - temperature sensor -diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts -index 1efcf0b712c9c5c19210545002ac1f0931db58f5..6140f172a86b8731782f938f76cb5dac9f28b662 100644 ---- a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts -+++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts -@@ -7,7 +7,7 @@ - - fragment@0 { - target = <&i2c_arm>; -- __overlay__ { -+ __dormant__ { - #address-cells = <1>; - #size-cells = <0>; - status = "okay"; -@@ -17,61 +17,142 @@ - reg = <0x69>; - abracon,tc-diode = "standard"; - abracon,tc-resistor = <0>; -- status = "disable"; -+ status = "okay"; - }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ - ds1307: ds1307@68 { - compatible = "maxim,ds1307"; - reg = <0x68>; -- status = "disable"; -+ status = "okay"; - }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ - ds1339: ds1339@68 { - compatible = "dallas,ds1339"; - trickle-resistor-ohms = <0>; - reg = <0x68>; -- status = "disable"; -+ status = "okay"; - }; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ ds3231: ds3231@68 { -+ compatible = "maxim,ds3231"; -+ reg = <0x68>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ - mcp7940x: mcp7940x@6f { - compatible = "microchip,mcp7940x"; - reg = <0x6f>; -- status = "disable"; -+ status = "okay"; - }; -+ }; -+ }; -+ -+ fragment@5 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ - mcp7941x: mcp7941x@6f { - compatible = "microchip,mcp7941x"; - reg = <0x6f>; -- status = "disable"; -- }; -- ds3231: ds3231@68 { -- compatible = "maxim,ds3231"; -- reg = <0x68>; -- status = "disable"; -+ status = "okay"; - }; -+ }; -+ }; -+ -+ fragment@6 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ - pcf2127: pcf2127@51 { - compatible = "nxp,pcf2127"; - reg = <0x51>; -- status = "disable"; -+ status = "okay"; - }; -+ }; -+ }; -+ -+ fragment@7 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ - pcf8523: pcf8523@68 { - compatible = "nxp,pcf8523"; - reg = <0x68>; -- status = "disable"; -+ status = "okay"; - }; -+ }; -+ }; -+ -+ fragment@8 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ - pcf8563: pcf8563@51 { - compatible = "nxp,pcf8563"; - reg = <0x51>; -- status = "disable"; -+ status = "okay"; - }; - }; - }; -+ - __overrides__ { -- abx80x = <&abx80x>,"status"; -- ds1307 = <&ds1307>,"status"; -- ds1339 = <&ds1339>,"status"; -- ds3231 = <&ds3231>,"status"; -- mcp7940x = <&mcp7940x>,"status"; -- mcp7941x = <&mcp7941x>,"status"; -- pcf2127 = <&pcf2127>,"status"; -- pcf8523 = <&pcf8523>,"status"; -- pcf8563 = <&pcf8563>,"status"; -+ abx80x = <0>,"+0"; -+ ds1307 = <0>,"+1"; -+ ds1339 = <0>,"+2"; -+ ds3231 = <0>,"+3"; -+ mcp7940x = <0>,"+4"; -+ mcp7941x = <0>,"+5"; -+ pcf2127 = <0>,"+6"; -+ pcf8523 = <0>,"+7"; -+ pcf8563 = <0>,"+8"; - trickle-diode-type = <&abx80x>,"abracon,tc-diode"; - trickle-resistor-ohms = <&ds1339>,"trickle-resistor-ohms:0", - <&abx80x>,"abracon,tc-resistor"; -diff --git a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -index e86a13f92c3f75c14fa4425cdfb081d6795ff76a..d2f0008addfadac8f6ed774a6e4f3f97871c0d61 100644 ---- a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -+++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -@@ -7,7 +7,7 @@ - - fragment@0 { - target = <&i2c_arm>; -- __overlay__ { -+ __dormant__ { - #address-cells = <1>; - #size-cells = <0>; - status = "okay"; -@@ -15,57 +15,112 @@ - bme280: bme280@76 { - compatible = "bosch,bme280"; - reg = <0x76>; -- status = "disable"; -+ status = "okay"; - }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; - - bmp085: bmp085@77 { - compatible = "bosch,bmp085"; - reg = <0x77>; - default-oversampling = <3>; -- status = "disable"; -+ status = "okay"; - }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; - - bmp180: bmp180@77 { - compatible = "bosch,bmp180"; - reg = <0x77>; -- status = "disable"; -+ status = "okay"; - }; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; - - bmp280: bmp280@76 { - compatible = "bosch,bmp280"; - reg = <0x76>; -- status = "disable"; -+ status = "okay"; - }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; - - lm75: lm75@4f { - compatible = "lm75"; - reg = <0x4f>; -- status = "disable"; -+ status = "okay"; - }; -+ }; -+ }; -+ -+ fragment@5 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; - - si7020: si7020@40 { - compatible = "si7020"; - reg = <0x40>; -- status = "disable"; -+ status = "okay"; - }; -+ }; -+ }; -+ -+ fragment@6 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; - - tmp102: tmp102@48 { - compatible = "ti,tmp102"; - reg = <0x48>; -- status = "disable"; -+ status = "okay"; - }; - }; - }; - - __overrides__ { -- addr = <&bme280>,"reg:0", <&bmp280>,"reg:0", <&tmp102>,"reg:0"; -- bme280 = <&bme280>,"status"; -- bmp085 = <&bmp085>,"status"; -- bmp180 = <&bmp180>,"status"; -- bmp280 = <&bmp280>,"status"; -- lm75 = <&lm75>,"status"; -+ addr = <&bme280>,"reg:0", <&bmp280>,"reg:0", <&tmp102>,"reg:0", -+ <&lm75>,"reg:0"; -+ bme280 = <0>,"+0"; -+ bmp085 = <0>,"+1"; -+ bmp180 = <0>,"+2"; -+ bmp280 = <0>,"+3"; -+ lm75 = <0>,"+4"; - lm75addr = <&lm75>,"reg:0"; -- si7020 = <&si7020>,"status"; -- tmp102 = <&tmp102>,"status"; -+ si7020 = <0>,"+5"; -+ tmp102 = <0>,"+6"; - }; - }; - -From 52595ff8c04eae49d88eaf32b9d74cab4b898773 Mon Sep 17 00:00:00 2001 -From: Stefan Tatschner -Date: Mon, 29 May 2017 21:46:16 +0200 -Subject: [PATCH 154/173] Add device tree config for htu21 - -See: https://github.com/raspberrypi/linux/pull/2041 - -Signed-off-by: Phil Elwell ---- - arch/arm/boot/dts/overlays/README | 2 ++ - arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts | 26 ++++++++++++++++++----- - 2 files changed, 23 insertions(+), 5 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index ce8706a8aa88c36b0dee95c56ee58b4a524b8b43..bce02c82f3438995e5a74080876391f758bfe27b 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -673,6 +673,8 @@ Params: addr Set the address for the BME280, BMP280, TMP102 - bmp280 Select the Bosch Sensortronic BMP280 - Valid addresses 0x76-0x77, default 0x76 - -+ htu21 Select the HTU21 temperature and humidity sensor -+ - lm75 Select the Maxim LM75 temperature sensor - Valid addresses 0x48-0x4f, default 0x4f - -diff --git a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -index d2f0008addfadac8f6ed774a6e4f3f97871c0d61..17c27e3b666a7a83619471b50c63bb93836653c5 100644 ---- a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -+++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts -@@ -73,6 +73,21 @@ - #size-cells = <0>; - status = "okay"; - -+ htu21: htu21@40 { -+ compatible = "htu21"; -+ reg = <0x40>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@5 { -+ target = <&i2c_arm>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ - lm75: lm75@4f { - compatible = "lm75"; - reg = <0x4f>; -@@ -81,7 +96,7 @@ - }; - }; - -- fragment@5 { -+ fragment@6 { - target = <&i2c_arm>; - __dormant__ { - #address-cells = <1>; -@@ -96,7 +111,7 @@ - }; - }; - -- fragment@6 { -+ fragment@7 { - target = <&i2c_arm>; - __dormant__ { - #address-cells = <1>; -@@ -118,9 +133,10 @@ - bmp085 = <0>,"+1"; - bmp180 = <0>,"+2"; - bmp280 = <0>,"+3"; -- lm75 = <0>,"+4"; -+ htu21 = <0>,"+4"; -+ lm75 = <0>,"+5"; - lm75addr = <&lm75>,"reg:0"; -- si7020 = <0>,"+5"; -- tmp102 = <0>,"+6"; -+ si7020 = <0>,"+6"; -+ tmp102 = <0>,"+7"; - }; - }; - -From f216bda69d0eda5a267c97047826989a4512e711 Mon Sep 17 00:00:00 2001 -From: sandeepal -Date: Fri, 2 Jun 2017 18:59:46 +0530 -Subject: [PATCH 155/173] Allo Digione Driver (#2048) - -Driver for the Allo Digione soundcard ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 6 + - .../arm/boot/dts/overlays/allo-digione-overlay.dts | 44 ++++ - arch/arm/configs/bcm2709_defconfig | 1 + - arch/arm/configs/bcmrpi_defconfig | 1 + - sound/soc/bcm/Kconfig | 7 + - sound/soc/bcm/Makefile | 2 + - sound/soc/bcm/allo-digione.c | 268 +++++++++++++++++++++ - 8 files changed, 330 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/allo-digione-overlay.dts - create mode 100644 sound/soc/bcm/allo-digione.c - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index c95b37f0a4c72160421f44819c5f29246d3352f9..eca81982c0f19988abd05165fc62a80d26f539cb 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -8,6 +8,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ - ads7846.dtbo \ - akkordion-iqdacplus.dtbo \ - allo-boss-dac-pcm512x-audio.dtbo \ -+ allo-digione.dtbo \ - allo-piano-dac-pcm512x-audio.dtbo \ - allo-piano-dac-plus-pcm512x-audio.dtbo \ - at86rf233.dtbo \ -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index bce02c82f3438995e5a74080876391f758bfe27b..19df6883be4277240283d5f63f27e34a22a2eec5 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -287,6 +287,12 @@ Params: 24db_digital_gain Allow gain to be applied via the PCM512x codec - slave" - - -+Name: allo-digione -+Info: Configures the Allo Digione audio card -+Load: dtoverlay=allo-digione -+Params: -+ -+ - Name: allo-piano-dac-pcm512x-audio - Info: Configures the Allo Piano DAC (2.0/2.1) audio cards. - (NB. This initial support is for 2.0 channel audio ONLY! ie. stereo. -diff --git a/arch/arm/boot/dts/overlays/allo-digione-overlay.dts b/arch/arm/boot/dts/overlays/allo-digione-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..101277a11a24e9b3eb441c44c3f19c61836fe77c ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/allo-digione-overlay.dts -@@ -0,0 +1,44 @@ -+// Definitions for Allo DigiOne -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target = <&i2s>; -+ __overlay__ { -+ status = "okay"; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c1>; -+ __overlay__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ wm8804@3b { -+ #sound-dai-cells = <0>; -+ compatible = "wlf,wm8804"; -+ reg = <0x3b>; -+ PVDD-supply = <&vdd_3v3_reg>; -+ DVDD-supply = <&vdd_3v3_reg>; -+ status = "okay"; -+ wlf,reset-gpio = <&gpio 17 0>; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&sound>; -+ __overlay__ { -+ compatible = "allo,allo-digione"; -+ i2s-controller = <&i2s>; -+ status = "okay"; -+ clock44-gpio = <&gpio 5 0>; -+ clock48-gpio = <&gpio 6 0>; -+ }; -+ }; -+}; -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 00845b52952479976b4fdfdc94a16a366d82ae7d..d2838cde4019be5f6faf0a70038c6365df9e6dde 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -892,6 +892,7 @@ CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO_V2=m - CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m - CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC_PLUS=m - CONFIG_SND_BCM2708_SOC_ALLO_BOSS_DAC=m -+CONFIG_SND_BCM2708_SOC_ALLO_DIGIONE=m - CONFIG_SND_BCM2708_SOC_FE_PI_AUDIO=m - CONFIG_SND_PISOUND=m - CONFIG_SND_SOC_ADAU1701=m -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 2ba46a28c2e7b21a401cc3544353937eca44218d..efdb0fbc1b07c7b679cb20d8c1270c77d5d3c684 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -885,6 +885,7 @@ CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO_V2=m - CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC=m - CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC_PLUS=m - CONFIG_SND_BCM2708_SOC_ALLO_BOSS_DAC=m -+CONFIG_SND_BCM2708_SOC_ALLO_DIGIONE=m - CONFIG_SND_BCM2708_SOC_FE_PI_AUDIO=m - CONFIG_SND_PISOUND=m - CONFIG_SND_SOC_ADAU1701=m -diff --git a/sound/soc/bcm/Kconfig b/sound/soc/bcm/Kconfig -index 355bdeb25f81d15593f78df0e87a48404908ca4b..381d32bb9deb3cf2c531e2a4563418cd6eb9d505 100644 ---- a/sound/soc/bcm/Kconfig -+++ b/sound/soc/bcm/Kconfig -@@ -176,6 +176,13 @@ config SND_BCM2708_SOC_ALLO_BOSS_DAC - help - Say Y or M if you want to add support for Allo Boss DAC. - -+config SND_BCM2708_SOC_ALLO_DIGIONE -+ tristate "Support for Allo DigiOne" -+ depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -+ select SND_SOC_PCM512x_I2C -+ help -+ Say Y or M if you want to add support for Allo DigiOne. -+ - config SND_BCM2708_SOC_FE_PI_AUDIO - tristate "Support for Fe-Pi-Audio" - depends on SND_BCM2708_SOC_I2S || SND_BCM2835_SOC_I2S -diff --git a/sound/soc/bcm/Makefile b/sound/soc/bcm/Makefile -index 72e1620fa4038035804cf3b2a09c6b12e7ae0fe1..53ea8229d7ac2065176983385dd7ba85ee3915ea 100644 ---- a/sound/soc/bcm/Makefile -+++ b/sound/soc/bcm/Makefile -@@ -34,6 +34,7 @@ snd-soc-dionaudio-loco-v2-objs := dionaudio_loco-v2.o - snd-soc-allo-boss-dac-objs := allo-boss-dac.o - snd-soc-allo-piano-dac-objs := allo-piano-dac.o - snd-soc-allo-piano-dac-plus-objs := allo-piano-dac-plus.o -+snd-soc-allo-digione-objs := allo-digione.o - snd-soc-pisound-objs := pisound.o - snd-soc-fe-pi-audio-objs := fe-pi-audio.o - -@@ -60,5 +61,6 @@ obj-$(CONFIG_SND_BCM2708_SOC_DIONAUDIO_LOCO_V2) += snd-soc-dionaudio-loco-v2.o - obj-$(CONFIG_SND_BCM2708_SOC_ALLO_BOSS_DAC) += snd-soc-allo-boss-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC) += snd-soc-allo-piano-dac.o - obj-$(CONFIG_SND_BCM2708_SOC_ALLO_PIANO_DAC_PLUS) += snd-soc-allo-piano-dac-plus.o -+obj-$(CONFIG_SND_BCM2708_SOC_ALLO_DIGIONE) += snd-soc-allo-digione.o - obj-$(CONFIG_SND_PISOUND) += snd-soc-pisound.o - obj-$(CONFIG_SND_BCM2708_SOC_FE_PI_AUDIO) += snd-soc-fe-pi-audio.o -diff --git a/sound/soc/bcm/allo-digione.c b/sound/soc/bcm/allo-digione.c -new file mode 100644 -index 0000000000000000000000000000000000000000..e3664e44c699d0102120ecf99e8b780a4505ebad ---- /dev/null -+++ b/sound/soc/bcm/allo-digione.c -@@ -0,0 +1,268 @@ -+/* -+ * ASoC Driver for Allo DigiOne -+ * -+ * Author: Baswaraj -+ * Copyright 2017 -+ * based on code by Daniel Matuschek -+ * based on code by Florian Meier -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * version 2 as published by the Free Software Foundation. -+ * -+ * This program is distributed in the hope that it will be useful, but -+ * WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * General Public License for more details. -+ */ -+ -+#include -+#include -+ -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "../codecs/wm8804.h" -+ -+static short int auto_shutdown_output = 0; -+module_param(auto_shutdown_output, short, -+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); -+MODULE_PARM_DESC(auto_shutdown_output, "Shutdown SP/DIF output if playback is stopped"); -+ -+#define CLK_44EN_RATE 22579200UL -+#define CLK_48EN_RATE 24576000UL -+ -+static struct gpio_desc *snd_allo_clk44gpio; -+static struct gpio_desc *snd_allo_clk48gpio; -+ -+static int samplerate = 44100; -+ -+static uint32_t snd_allo_digione_enable_clock(int sample_rate) -+{ -+ switch (sample_rate) { -+ case 11025: -+ case 22050: -+ case 44100: -+ case 88200: -+ case 176400: -+ gpiod_set_value_cansleep(snd_allo_clk44gpio, 1); -+ gpiod_set_value_cansleep(snd_allo_clk48gpio, 0); -+ return CLK_44EN_RATE; -+ default: -+ gpiod_set_value_cansleep(snd_allo_clk48gpio, 1); -+ gpiod_set_value_cansleep(snd_allo_clk44gpio, 0); -+ return CLK_48EN_RATE; -+ } -+} -+ -+ -+static int snd_allo_digione_init(struct snd_soc_pcm_runtime *rtd) -+{ -+ struct snd_soc_codec *codec = rtd->codec; -+ -+ /* enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ return 0; -+} -+ -+static int snd_allo_digione_startup(struct snd_pcm_substream *substream) -+{ -+ /* turn on digital output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x00); -+ return 0; -+} -+ -+static void snd_allo_digione_shutdown(struct snd_pcm_substream *substream) -+{ -+ /* turn off output */ -+ if (auto_shutdown_output) { -+ /* turn off output */ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_codec *codec = rtd->codec; -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x3c, 0x3c); -+ } -+} -+ -+static int snd_allo_digione_hw_params(struct snd_pcm_substream *substream, -+ struct snd_pcm_hw_params *params) -+{ -+ struct snd_soc_pcm_runtime *rtd = substream->private_data; -+ struct snd_soc_dai *codec_dai = rtd->codec_dai; -+ struct snd_soc_codec *codec = rtd->codec; -+ struct snd_soc_dai *cpu_dai = rtd->cpu_dai; -+ -+ int sysclk = 27000000; /* This is fixed on this board */ -+ -+ long mclk_freq = 0; -+ int mclk_div = 1; -+ int sampling_freq = 1; -+ -+ int ret; -+ -+ samplerate = params_rate(params); -+ -+ if (samplerate <= 96000) { -+ mclk_freq = samplerate * 256; -+ mclk_div = WM8804_MCLKDIV_256FS; -+ } else { -+ mclk_freq = samplerate * 128; -+ mclk_div = WM8804_MCLKDIV_128FS; -+ } -+ -+ sysclk = snd_allo_digione_enable_clock(samplerate); -+ -+ switch (samplerate) { -+ case 32000: -+ sampling_freq=0x03; -+ break; -+ case 44100: -+ sampling_freq=0x00; -+ break; -+ case 48000: -+ sampling_freq=0x02; -+ break; -+ case 88200: -+ sampling_freq=0x08; -+ break; -+ case 96000: -+ sampling_freq=0x0a; -+ break; -+ case 176400: -+ sampling_freq=0x0c; -+ break; -+ case 192000: -+ sampling_freq=0x0e; -+ break; -+ default: -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK, unsupported samplerate %d\n", -+ samplerate); -+ } -+ -+ snd_soc_dai_set_clkdiv(codec_dai, WM8804_MCLK_DIV, mclk_div); -+ snd_soc_dai_set_pll(codec_dai, 0, 0, sysclk, mclk_freq); -+ -+ ret = snd_soc_dai_set_sysclk(codec_dai, WM8804_TX_CLKSRC_PLL, -+ sysclk, SND_SOC_CLOCK_OUT); -+ -+ if (ret < 0) { -+ dev_err(codec->dev, -+ "Failed to set WM8804 SYSCLK: %d\n", ret); -+ return ret; -+ } -+ -+ /* Enable TX output */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x4, 0x0); -+ -+ /* Power on */ -+ snd_soc_update_bits(codec, WM8804_PWRDN, 0x9, 0); -+ -+ /* set sampling frequency status bits */ -+ snd_soc_update_bits(codec, WM8804_SPDTX4, 0x0f, sampling_freq); -+ -+ return snd_soc_dai_set_bclk_ratio(cpu_dai, 64); -+} -+ -+/* machine stream operations */ -+static struct snd_soc_ops snd_allo_digione_ops = { -+ .hw_params = snd_allo_digione_hw_params, -+ .startup = snd_allo_digione_startup, -+ .shutdown = snd_allo_digione_shutdown, -+}; -+ -+static struct snd_soc_dai_link snd_allo_digione_dai[] = { -+{ -+ .name = "Allo DigiOne", -+ .stream_name = "Allo DigiOne HiFi", -+ .cpu_dai_name = "bcm2708-i2s.0", -+ .codec_dai_name = "wm8804-spdif", -+ .platform_name = "bcm2708-i2s.0", -+ .codec_name = "wm8804.1-003b", -+ .dai_fmt = SND_SOC_DAIFMT_I2S | -+ SND_SOC_DAIFMT_NB_NF | -+ SND_SOC_DAIFMT_CBM_CFM, -+ .ops = &snd_allo_digione_ops, -+ .init = snd_allo_digione_init, -+}, -+}; -+ -+/* audio machine driver */ -+static struct snd_soc_card snd_allo_digione = { -+ .name = "snd_allo_digione", -+ .driver_name = "AlloDigiOne", -+ .owner = THIS_MODULE, -+ .dai_link = snd_allo_digione_dai, -+ .num_links = ARRAY_SIZE(snd_allo_digione_dai), -+}; -+ -+static int snd_allo_digione_probe(struct platform_device *pdev) -+{ -+ int ret = 0; -+ -+ snd_allo_digione.dev = &pdev->dev; -+ -+ if (pdev->dev.of_node) { -+ struct device_node *i2s_node; -+ struct snd_soc_dai_link *dai = &snd_allo_digione_dai[0]; -+ i2s_node = of_parse_phandle(pdev->dev.of_node, -+ "i2s-controller", 0); -+ -+ if (i2s_node) { -+ dai->cpu_dai_name = NULL; -+ dai->cpu_of_node = i2s_node; -+ dai->platform_name = NULL; -+ dai->platform_of_node = i2s_node; -+ } -+ -+ snd_allo_clk44gpio = -+ devm_gpiod_get(&pdev->dev, "clock44", GPIOD_OUT_LOW); -+ if (IS_ERR(snd_allo_clk44gpio)) -+ dev_err(&pdev->dev, "devm_gpiod_get() failed\n"); -+ -+ snd_allo_clk48gpio = -+ devm_gpiod_get(&pdev->dev, "clock48", GPIOD_OUT_LOW); -+ if (IS_ERR(snd_allo_clk48gpio)) -+ dev_err(&pdev->dev, "devm_gpiod_get() failed\n"); -+ } -+ -+ ret = snd_soc_register_card(&snd_allo_digione); -+ if (ret && ret != -EPROBE_DEFER) -+ dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", -+ ret); -+ -+ return ret; -+} -+ -+static int snd_allo_digione_remove(struct platform_device *pdev) -+{ -+ return snd_soc_unregister_card(&snd_allo_digione); -+} -+ -+static const struct of_device_id snd_allo_digione_of_match[] = { -+ { .compatible = "allo,allo-digione", }, -+ {}, -+}; -+MODULE_DEVICE_TABLE(of, snd_allo_digione_of_match); -+ -+static struct platform_driver snd_allo_digione_driver = { -+ .driver = { -+ .name = "snd-allo-digione", -+ .owner = THIS_MODULE, -+ .of_match_table = snd_allo_digione_of_match, -+ }, -+ .probe = snd_allo_digione_probe, -+ .remove = snd_allo_digione_remove, -+}; -+ -+module_platform_driver(snd_allo_digione_driver); -+ -+MODULE_AUTHOR("Baswaraj "); -+MODULE_DESCRIPTION("ASoC Driver for Allo DigiOne"); -+MODULE_LICENSE("GPL v2"); - -From f8b82a9b4a3c6441b44117532d48a136e80ad45e Mon Sep 17 00:00:00 2001 +From b6efd06f333e14d1f8c48d9a9aca39cb75f4b882 Mon Sep 17 00:00:00 2001 From: Andrei Gherzan Date: Mon, 5 Jun 2017 16:40:38 +0100 -Subject: [PATCH 156/173] dma-bcm2708: Fix module compilation of +Subject: [PATCH 128/140] dma-bcm2708: Fix module compilation of CONFIG_DMA_BCM2708 bcm2708-dmaengine.c defines functions like bcm_dma_start which are @@ -135438,1249 +134701,10 @@ index c5bfff2765be4606077e6c8af73040ec13ee8974..6ca874d332a8bc666b1c9576ac51f479 #endif /* _PLAT_BCM2708_DMA_H */ -From 80c2c56f8363ee02686636240a31a304da2a15e9 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 20 Jun 2017 17:51:47 +0100 -Subject: [PATCH 157/173] bcm2835-cpufreq: Change licence to GPLv2 - -Signed-off-by: Eben Upton -Signed-off-by: Dom Cobley ---- - drivers/cpufreq/bcm2835-cpufreq.c | 36 ++++++++++++++---------------------- - 1 file changed, 14 insertions(+), 22 deletions(-) - -diff --git a/drivers/cpufreq/bcm2835-cpufreq.c b/drivers/cpufreq/bcm2835-cpufreq.c -index 414fbdc10dfbfc6e4bb47870a7af3fd5780f9c9a..99345969b0e4d651fd9033d67de2febb13fc0892 100644 ---- a/drivers/cpufreq/bcm2835-cpufreq.c -+++ b/drivers/cpufreq/bcm2835-cpufreq.c -@@ -1,25 +1,17 @@ --/***************************************************************************** --* 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. --*****************************************************************************/ -- --/***************************************************************************** --* FILENAME: bcm2835-cpufreq.h --* DESCRIPTION: This driver dynamically manages the CPU Frequency of the ARM --* processor. Messages are sent to Videocore either setting or requesting the --* frequency of the ARM in order to match an appropiate frequency to the current --* usage of the processor. The policy which selects the frequency to use is --* defined in the kernel .config file, but can be changed during runtime. --*****************************************************************************/ -+/* -+ * Copyright 2011 Broadcom Corporation. -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License -+ * as published by the Free Software Foundation; version 2 -+ * of the License. -+ * -+ * This driver dynamically manages the CPU Frequency of the ARM -+ * processor. Messages are sent to Videocore either setting or requesting the -+ * frequency of the ARM in order to match an appropiate frequency to the current -+ * usage of the processor. The policy which selects the frequency to use is -+ * defined in the kernel .config file, but can be changed during runtime. -+ */ - - /* ---------- INCLUDES ---------- */ - #include - -From e94077bd011f60fc34f14a722f088d9842102162 Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Wed, 21 Jun 2017 09:03:51 -0700 -Subject: [PATCH 158/173] 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. - -Signed-off-by: Eric Anholt ---- - arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts b/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts -index 95a595a35cb4fbb707bf4b18161f6a46860aa4ae..36fbf6c8c2e612a6dc5aa02d77cc8173098c16ca 100644 ---- a/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts -+++ b/arch/arm/boot/dts/overlays/vc4-fkms-v3d-overlay.dts -@@ -11,35 +11,35 @@ - fragment@0 { - target-path = "/chosen"; - __overlay__ { -- bootargs = "cma=256M@256M"; -+ bootargs = "cma=256M"; - }; - }; - - fragment@1 { - target-path = "/chosen"; - __dormant__ { -- bootargs = "cma=192M@256M"; -+ bootargs = "cma=192M"; - }; - }; - - fragment@2 { - target-path = "/chosen"; - __dormant__ { -- bootargs = "cma=128M@128M"; -+ bootargs = "cma=128M"; - }; - }; - - fragment@3 { - target-path = "/chosen"; - __dormant__ { -- bootargs = "cma=96M@128M"; -+ bootargs = "cma=96M"; - }; - }; - - fragment@4 { - target-path = "/chosen"; - __dormant__ { -- bootargs = "cma=64M@64M"; -+ bootargs = "cma=64M"; - }; - }; - - -From fc3cb5a0158c0a950571fe0d7612558f5385ce2f Mon Sep 17 00:00:00 2001 -From: Steve Conner -Date: Thu, 29 Jun 2017 15:56:19 +0100 -Subject: [PATCH 159/173] 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. ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 41 +++++ - .../arm/boot/dts/overlays/i2c-rtc-gpio-overlay.dts | 183 +++++++++++++++++++++ - 3 files changed, 225 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/i2c-rtc-gpio-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index eca81982c0f19988abd05165fc62a80d26f539cb..8a3131f5a4bc90d4a597b416416953e8e49d41ec 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -42,6 +42,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ - i2c-mux.dtbo \ - i2c-pwm-pca9685a.dtbo \ - i2c-rtc.dtbo \ -+ i2c-rtc-gpio.dtbo \ - i2c-sensor.dtbo \ - i2c0-bcm2708.dtbo \ - i2c1-bcm2708.dtbo \ -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index 19df6883be4277240283d5f63f27e34a22a2eec5..a69e3a0d8dce1633598dd3cd8e00cad9509eee03 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -662,6 +662,47 @@ Params: abx80x Select one of the ABx80x family: - source - - -+Name: i2c-rtc-gpio -+Info: Adds support for a number of I2C Real Time Clock devices -+ using the software i2c controller -+Load: dtoverlay=i2c-rtc-gpio,= -+Params: abx80x Select one of the ABx80x family: -+ AB0801, AB0803, AB0804, AB0805, -+ AB1801, AB1803, AB1804, AB1805 -+ -+ ds1307 Select the DS1307 device -+ -+ ds1339 Select the DS1339 device -+ -+ ds3231 Select the DS3231 device -+ -+ mcp7940x Select the MCP7940x device -+ -+ mcp7941x Select the MCP7941x device -+ -+ pcf2127 Select the PCF2127 device -+ -+ pcf8523 Select the PCF8523 device -+ -+ pcf8563 Select the PCF8563 device -+ -+ trickle-diode-type Diode type for trickle charge - "standard" or -+ "schottky" (ABx80x only) -+ -+ trickle-resistor-ohms Resistor value for trickle charge (DS1339, -+ ABx80x) -+ -+ wakeup-source Specify that the RTC can be used as a wakeup -+ source -+ -+ i2c_gpio_sda GPIO used for I2C data (default "23") -+ -+ i2c_gpio_scl GPIO used for I2C clock (default "24") -+ -+ i2c_gpio_delay_us Clock delay in microseconds -+ (default "2" = ~100kHz) -+ -+ - Name: i2c-sensor - Info: Adds support for a number of I2C barometric pressure and temperature - sensors on i2c_arm -diff --git a/arch/arm/boot/dts/overlays/i2c-rtc-gpio-overlay.dts b/arch/arm/boot/dts/overlays/i2c-rtc-gpio-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..8415e6081428fba9a47682964174fc023cfd2b0c ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/i2c-rtc-gpio-overlay.dts -@@ -0,0 +1,183 @@ -+// Definitions for several I2C based Real Time Clocks -+// Available through i2c-gpio -+/dts-v1/; -+/plugin/; -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ target-path = "/"; -+ __overlay__ { -+ i2c_gpio: i2c-gpio-rtc@0 { -+ compatible = "i2c-gpio"; -+ gpios = <&gpio 23 0 /* sda */ -+ &gpio 24 0 /* scl */ -+ >; -+ i2c-gpio,delay-us = <2>; /* ~100 kHz */ -+ #address-cells = <1>; -+ #size-cells = <0>; -+ }; -+ }; -+ }; -+ -+ fragment@1 { -+ target = <&i2c_gpio>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ abx80x: abx80x@69 { -+ compatible = "abracon,abx80x"; -+ reg = <0x69>; -+ abracon,tc-diode = "standard"; -+ abracon,tc-resistor = <0>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@2 { -+ target = <&i2c_gpio>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ ds1307: ds1307@68 { -+ compatible = "maxim,ds1307"; -+ reg = <0x68>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@3 { -+ target = <&i2c_gpio>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ ds1339: ds1339@68 { -+ compatible = "dallas,ds1339"; -+ trickle-resistor-ohms = <0>; -+ reg = <0x68>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@4 { -+ target = <&i2c_gpio>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ ds3231: ds3231@68 { -+ compatible = "maxim,ds3231"; -+ reg = <0x68>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@5 { -+ target = <&i2c_gpio>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ mcp7940x: mcp7940x@6f { -+ compatible = "microchip,mcp7940x"; -+ reg = <0x6f>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@6 { -+ target = <&i2c_gpio>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ mcp7941x: mcp7941x@6f { -+ compatible = "microchip,mcp7941x"; -+ reg = <0x6f>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@7 { -+ target = <&i2c_gpio>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcf2127: pcf2127@51 { -+ compatible = "nxp,pcf2127"; -+ reg = <0x51>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@8 { -+ target = <&i2c_gpio>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcf8523: pcf8523@68 { -+ compatible = "nxp,pcf8523"; -+ reg = <0x68>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ fragment@9 { -+ target = <&i2c_gpio>; -+ __dormant__ { -+ #address-cells = <1>; -+ #size-cells = <0>; -+ status = "okay"; -+ -+ pcf8563: pcf8563@51 { -+ compatible = "nxp,pcf8563"; -+ reg = <0x51>; -+ status = "okay"; -+ }; -+ }; -+ }; -+ -+ __overrides__ { -+ abx80x = <0>,"+1"; -+ ds1307 = <0>,"+2"; -+ ds1339 = <0>,"+3"; -+ ds3231 = <0>,"+4"; -+ mcp7940x = <0>,"+5"; -+ mcp7941x = <0>,"+6"; -+ pcf2127 = <0>,"+7"; -+ pcf8523 = <0>,"+8"; -+ pcf8563 = <0>,"+9"; -+ trickle-diode-type = <&abx80x>,"abracon,tc-diode"; -+ trickle-resistor-ohms = <&ds1339>,"trickle-resistor-ohms:0", -+ <&abx80x>,"abracon,tc-resistor"; -+ wakeup-source = <&ds1339>,"wakeup-source?", -+ <&ds3231>,"wakeup-source?", -+ <&mcp7940x>,"wakeup-source?", -+ <&mcp7941x>,"wakeup-source?"; -+ i2c_gpio_sda = <&i2c_gpio>,"gpios:4"; -+ i2c_gpio_scl = <&i2c_gpio>,"gpios:16"; -+ i2c_gpio_delay_us = <&i2c_gpio>,"i2c-gpio,delay-us:0"; -+ }; -+}; - -From 8764e8f87f6ee8a31c0ee25485b48e61797c6b8a Mon Sep 17 00:00:00 2001 -From: Allo -Date: Mon, 3 Jul 2017 15:45:20 +0530 -Subject: [PATCH 160/173] PianoPlus: Dual Mono & Dual Stereo features added - (#2069) - ---- - sound/soc/bcm/allo-piano-dac-plus.c | 160 +++++++++++++++++++++++++++++++----- - 1 file changed, 141 insertions(+), 19 deletions(-) - -diff --git a/sound/soc/bcm/allo-piano-dac-plus.c b/sound/soc/bcm/allo-piano-dac-plus.c -index 56e43f98846b41e487b3089813f7edc3c08517eb..d4e99e3c6a383d92fb0cf9e8c1cd1e7657358d49 100644 ---- a/sound/soc/bcm/allo-piano-dac-plus.c -+++ b/sound/soc/bcm/allo-piano-dac-plus.c -@@ -36,6 +36,7 @@ struct dsp_code { - - struct glb_pool { - struct mutex lock; -+ unsigned int dual_mode; - unsigned int set_lowpass; - unsigned int set_mode; - unsigned int set_rate; -@@ -47,8 +48,8 @@ bool glb_mclk; - - static struct gpio_desc *mute_gpio[2]; - -- - static const char * const allo_piano_mode_texts[] = { -+ "None", - "2.0", - "2.1", - "2.2", -@@ -57,6 +58,15 @@ static const char * const allo_piano_mode_texts[] = { - static const SOC_ENUM_SINGLE_DECL(allo_piano_mode_enum, - 0, 0, allo_piano_mode_texts); - -+static const char * const allo_piano_dual_mode_texts[] = { -+ "None", -+ "Dual-Mono", -+ "Dual-Stereo", -+}; -+ -+static const SOC_ENUM_SINGLE_DECL(allo_piano_dual_mode_enum, -+ 0, 0, allo_piano_dual_mode_texts); -+ - static const char * const allo_piano_dsp_low_pass_texts[] = { - "60", - "70", -@@ -82,10 +92,10 @@ static int __snd_allo_piano_dsp_program(struct snd_soc_pcm_runtime *rtd, - unsigned int mode, unsigned int rate, unsigned int lowpass) - { - const struct firmware *fw; -- char firmware_name[60]; -- int ret = 0, dac = 0; - struct snd_soc_card *card = rtd->card; - struct glb_pool *glb_ptr = card->drvdata; -+ char firmware_name[60]; -+ int ret = 0, dac = 0; - - if (rate <= 46000) - rate = 44100; -@@ -100,26 +110,35 @@ static int __snd_allo_piano_dsp_program(struct snd_soc_pcm_runtime *rtd, - else - rate = 192000; - -- if ((lowpass > 14) || (lowpass < 0)) -- lowpass = 3; -- if ((mode > 2) || (mode < 0)) -- mode = 0; -+ if (lowpass > 14) -+ glb_ptr->set_lowpass = lowpass = 3; -+ -+ if (mode > 3) -+ glb_ptr->set_mode = mode = 0; -+ -+ if (mode > 0) -+ glb_ptr->dual_mode = 0; - - /* same configuration loaded */ - if ((rate == glb_ptr->set_rate) && (lowpass == glb_ptr->set_lowpass) - && (mode == glb_ptr->set_mode)) - return 0; - -- if (mode == 0) { /* 2.0 */ -- snd_soc_write(rtd->codec_dais[1]->codec, -- PCM512x_MUTE, 0x11); -+ switch (mode) { -+ case 0: /* None */ -+ return 1; -+ -+ case 1: /* 2.0 */ -+ snd_soc_write(rtd->codec_dais[0]->codec, PCM512x_MUTE, 0x00); -+ snd_soc_write(rtd->codec_dais[1]->codec, PCM512x_MUTE, 0x11); - glb_ptr->set_rate = rate; - glb_ptr->set_mode = mode; - glb_ptr->set_lowpass = lowpass; - return 1; -- } else { -- snd_soc_write(rtd->codec_dais[1]->codec, -- PCM512x_MUTE, 0x00); -+ -+ default: -+ snd_soc_write(rtd->codec_dais[0]->codec, PCM512x_MUTE, 0x00); -+ snd_soc_write(rtd->codec_dais[1]->codec, PCM512x_MUTE, 0x00); - } - - for (dac = 0; dac < rtd->num_codecs; dac++) { -@@ -128,13 +147,13 @@ static int __snd_allo_piano_dsp_program(struct snd_soc_pcm_runtime *rtd, - int i = 1; - - if (dac == 0) { /* high */ -- sprintf(firmware_name, -+ snprintf(firmware_name, sizeof(firmware_name), - "allo/piano/2.2/allo-piano-dsp-%d-%d-%d.bin", - rate, ((lowpass * 10) + 60), dac); - } else { /* low */ -- sprintf(firmware_name, -+ snprintf(firmware_name, sizeof(firmware_name), - "allo/piano/2.%d/allo-piano-dsp-%d-%d-%d.bin", -- mode, rate, ((lowpass * 10) + 60), dac); -+ (mode - 1), rate, ((lowpass * 10) + 60), dac); - } - - dev_info(codec->dev, "Dsp Firmware File Name: %s\n", -@@ -199,6 +218,80 @@ static int snd_allo_piano_dsp_program(struct snd_soc_pcm_runtime *rtd, - return ret; - } - -+static int snd_allo_piano_dual_mode_get(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); -+ struct glb_pool *glb_ptr = card->drvdata; -+ -+ ucontrol->value.integer.value[0] = glb_ptr->dual_mode; -+ -+ return 0; -+} -+ -+static int snd_allo_piano_dual_mode_put(struct snd_kcontrol *kcontrol, -+ struct snd_ctl_elem_value *ucontrol) -+{ -+ struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); -+ struct glb_pool *glb_ptr = card->drvdata; -+ struct snd_soc_pcm_runtime *rtd; -+ struct snd_card *snd_card_ptr = card->snd_card; -+ struct snd_kcontrol *kctl; -+ struct soc_mixer_control *mc; -+ unsigned int left_val = 0; -+ -+ rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name); -+ -+ if (ucontrol->value.integer.value[0] > 0) { -+ glb_ptr->dual_mode = ucontrol->value.integer.value[0]; -+ glb_ptr->set_mode = 0; -+ } else if (ucontrol->value.integer.value[0] <= 0) { -+ if (glb_ptr->set_mode <= 0) { -+ glb_ptr->dual_mode = 1; -+ glb_ptr->set_mode = 0; -+ } -+ } else { -+ glb_ptr->dual_mode = 0; -+ return 0; -+ } -+ -+ if (glb_ptr->dual_mode == 1) { -+ snd_soc_write(rtd->codec_dais[0]->codec, PCM512x_MUTE, 0x01); -+ snd_soc_write(rtd->codec_dais[1]->codec, PCM512x_MUTE, 0x10); -+ snd_soc_write(rtd->codec_dais[0]->codec, -+ PCM512x_DIGITAL_VOLUME_3, 0xff); -+ -+ list_for_each_entry(kctl, &snd_card_ptr->controls, list) { -+ if (!strncmp(kctl->id.name, "Digital Playback Volume", -+ sizeof(kctl->id.name))) { -+ mc = (struct soc_mixer_control *) -+ kctl->private_value; -+ mc->rreg = mc->reg; -+ break; -+ } -+ } -+ } else { -+ left_val = snd_soc_read(rtd->codec_dais[0]->codec, -+ PCM512x_DIGITAL_VOLUME_2); -+ list_for_each_entry(kctl, &snd_card_ptr->controls, list) { -+ if (!strncmp(kctl->id.name, "Digital Playback Volume", -+ sizeof(kctl->id.name))) { -+ mc = (struct soc_mixer_control *) -+ kctl->private_value; -+ mc->rreg = PCM512x_DIGITAL_VOLUME_3; -+ break; -+ } -+ } -+ -+ snd_soc_write(rtd->codec_dais[0]->codec, -+ PCM512x_DIGITAL_VOLUME_3, left_val); -+ snd_soc_write(rtd->codec_dais[0]->codec, PCM512x_MUTE, 0x00); -+ snd_soc_write(rtd->codec_dais[1]->codec, PCM512x_MUTE, 0x00); -+ } -+ -+ return 0; -+} -+ - static int snd_allo_piano_mode_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) - { -@@ -215,8 +308,30 @@ static int snd_allo_piano_mode_put(struct snd_kcontrol *kcontrol, - struct snd_soc_card *card = snd_kcontrol_chip(kcontrol); - struct snd_soc_pcm_runtime *rtd; - struct glb_pool *glb_ptr = card->drvdata; -+ struct snd_card *snd_card_ptr = card->snd_card; -+ struct snd_kcontrol *kctl; -+ struct soc_mixer_control *mc; -+ unsigned int left_val = 0; - - rtd = snd_soc_get_pcm_runtime(card, card->dai_link[0].name); -+ -+ if ((glb_ptr->dual_mode == 1) && -+ (ucontrol->value.integer.value[0] > 0)) { -+ left_val = snd_soc_read(rtd->codec_dais[0]->codec, -+ PCM512x_DIGITAL_VOLUME_2); -+ list_for_each_entry(kctl, &snd_card_ptr->controls, list) { -+ if (!strncmp(kctl->id.name, "Digital Playback Volume", -+ sizeof(kctl->id.name))) { -+ mc = (struct soc_mixer_control *) -+ kctl->private_value; -+ mc->rreg = PCM512x_DIGITAL_VOLUME_3; -+ break; -+ } -+ } -+ snd_soc_write(rtd->codec_dais[0]->codec, -+ PCM512x_DIGITAL_VOLUME_3, left_val); -+ } -+ - return(snd_allo_piano_dsp_program(rtd, - ucontrol->value.integer.value[0], - glb_ptr->set_rate, glb_ptr->set_lowpass)); -@@ -344,6 +459,11 @@ static const struct snd_kcontrol_new allo_piano_controls[] = { - snd_allo_piano_mode_get, - snd_allo_piano_mode_put), - -+ SOC_ENUM_EXT("Dual Mode Route", -+ allo_piano_dual_mode_enum, -+ snd_allo_piano_dual_mode_get, -+ snd_allo_piano_dual_mode_put), -+ - SOC_ENUM_EXT("Lowpass Route", allo_piano_enum, - snd_allo_piano_lowpass_get, - snd_allo_piano_lowpass_put), -@@ -472,7 +592,7 @@ static int snd_allo_piano_dac_hw_params( - PCM512x_RATE_DET_4); - if (val < 0) { - dev_err(rtd->codec_dais[dac]->codec->dev, -- "Failed to read register PCM512x_RATE_DET_4\n"); -+ "Failed to read register PCM512x_RATE_DET_4\n"); - return val; - } - -@@ -482,7 +602,7 @@ static int snd_allo_piano_dac_hw_params( - PCM512x_SREF_BCK); - - dev_info(rtd->codec_dais[dac]->codec->dev, -- "Setting BCLK as input clock & Enable PLL\n"); -+ "Setting BCLK as input clock & Enable PLL\n"); - } else { - snd_soc_write(rtd->codec_dais[dac]->codec, - PCM512x_PLL_EN, -@@ -493,7 +613,7 @@ static int snd_allo_piano_dac_hw_params( - PCM512x_SREF_SCK); - - dev_info(rtd->codec_dais[dac]->codec->dev, -- "Setting SCLK as input clock & disabled PLL\n"); -+ "Setting SCLK as input clock & disabled PLL\n"); - } - } - -@@ -504,6 +624,7 @@ static int snd_allo_piano_dac_hw_params( - 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) -@@ -521,6 +642,7 @@ static int snd_allo_piano_dac_prepare( - struct snd_soc_card *card = rtd->card; - - snd_allo_piano_gpio_unmute(card); -+ - return 0; - } - - -From d5506bfa946eb2799dd9ffb8b904ff801651ffb7 Mon Sep 17 00:00:00 2001 -From: Matthijs Kooijman -Date: Sun, 9 Jul 2017 15:15:22 +0200 -Subject: [PATCH 161/173] 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 -systemd-logind to shut down the system. - -Signed-off-by: Matthijs Kooijman ---- - arch/arm/boot/dts/overlays/Makefile | 1 + - arch/arm/boot/dts/overlays/README | 32 +++++++++ - .../boot/dts/overlays/gpio-shutdown-overlay.dts | 80 ++++++++++++++++++++++ - 3 files changed, 113 insertions(+) - create mode 100644 arch/arm/boot/dts/overlays/gpio-shutdown-overlay.dts - -diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile -index 8a3131f5a4bc90d4a597b416416953e8e49d41ec..c50b1dfa9d7334df47ce087f9d2a7a816afa05ba 100644 ---- a/arch/arm/boot/dts/overlays/Makefile -+++ b/arch/arm/boot/dts/overlays/Makefile -@@ -30,6 +30,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ - googlevoicehat-soundcard.dtbo \ - gpio-ir.dtbo \ - gpio-poweroff.dtbo \ -+ gpio-shutdown.dtbo \ - hifiberry-amp.dtbo \ - hifiberry-dac.dtbo \ - hifiberry-dacplus.dtbo \ -diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README -index a69e3a0d8dce1633598dd3cd8e00cad9509eee03..e6d777a601c91d192bc5713f9a73e1a2d4d708ef 100644 ---- a/arch/arm/boot/dts/overlays/README -+++ b/arch/arm/boot/dts/overlays/README -@@ -508,6 +508,38 @@ Params: gpiopin GPIO for signalling (default 26) - will also cause the pin to go low. - - -+Name: gpio-shutdown -+Info: Initiates a shutdown when GPIO pin changes. The given GPIO pin -+ is configured as an input key that generates KEY_POWER events. -+ This event is handled by systemd-logind by initiating a -+ shutdown. Systemd versions older than 225 need an udev rule -+ enable listening to the input device: -+ -+ ACTION!="REMOVE", SUBSYSTEM=="input", KERNEL=="event*", \ -+ SUBSYSTEMS=="platform", DRIVERS=="gpio-keys", \ -+ ATTRS{keys}=="116", TAG+="power-switch" -+ -+ This overlay only handles shutdown. After shutdown, the system -+ can be powered up again by driving GPIO3 low. The default -+ configuration uses GPIO3 with a pullup, so if you connect a -+ button between GPIO3 and GND (pin 5 and 6 on the 40-pin header), -+ you get a shutdown and power-up button. -+Load: dtoverlay=gpio-shutdown,= -+Params: gpio_pin GPIO pin to trigger on (default 3) -+ -+ active_low When this is 1 (active low), a falling -+ edge generates a key down event and a -+ rising edge generates a key up event. -+ When this is 0 (active high), this is -+ reversed. The default is 1 (active low). -+ -+ gpio_pull Desired pull-up/down state (off, down, up) -+ Default is "up". -+ -+ Note that the default pin (GPIO3) has an -+ external pullup. -+ -+ - Name: hifiberry-amp - Info: Configures the HifiBerry Amp and Amp+ audio cards - Load: dtoverlay=hifiberry-amp -diff --git a/arch/arm/boot/dts/overlays/gpio-shutdown-overlay.dts b/arch/arm/boot/dts/overlays/gpio-shutdown-overlay.dts -new file mode 100644 -index 0000000000000000000000000000000000000000..863fb395c8539734b658682b900e1fbd96c9443e ---- /dev/null -+++ b/arch/arm/boot/dts/overlays/gpio-shutdown-overlay.dts -@@ -0,0 +1,80 @@ -+// Definitions for gpio-poweroff module -+/dts-v1/; -+/plugin/; -+ -+// This overlay sets up an input device that generates KEY_POWER events -+// when a given GPIO pin changes. It defaults to using GPIO3, which can -+// also be used to wake up (start) the Rpi again after shutdown. Since -+// wakeup is active-low, this defaults to active-low with a pullup -+// enabled, but all of this can be changed using overlay parameters (but -+// note that GPIO3 has an external pullup on at least some boards). -+ -+/ { -+ compatible = "brcm,bcm2708"; -+ -+ fragment@0 { -+ // Configure the gpio pin controller -+ target = <&gpio>; -+ __overlay__ { -+ // Define a pinctrl state, that sets up the gpio -+ // as an input with a pullup enabled. This does -+ // not take effect by itself, only when referenced -+ // by a "pinctrl client", as is done below. See: -+ // https://www.kernel.org/doc/Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt -+ // https://www.kernel.org/doc/Documentation/devicetree/bindings/pinctrl/brcm,bcm2835-gpio.txt -+ pin_state: shutdown_button_pins { -+ brcm,pins = <3>; // gpio number -+ brcm,function = <0>; // 0 = input, 1 = output -+ brcm,pull = <2>; // 0 = none, 1 = pull down, 2 = pull up -+ }; -+ }; -+ }; -+ fragment@1 { -+ // Add a new device to the /soc devicetree node -+ target-path = "/soc"; -+ __overlay__ { -+ shutdown_button { -+ // Let the gpio-keys driver handle this device. See: -+ // https://www.kernel.org/doc/Documentation/devicetree/bindings/input/gpio-keys.txt -+ compatible = "gpio-keys"; -+ -+ // Declare a single pinctrl state (referencing the one declared above) and name it -+ // default, so it is activated automatically. -+ pinctrl-names = "default"; -+ pinctrl-0 = <&pin_state>; -+ -+ // Enable this device -+ status = "okay"; -+ -+ // Define a single key, called "shutdown" that monitors the gpio and sends KEY_POWER -+ // (keycode 116, see -+ // https://github.com/torvalds/linux/blob/v4.12/include/uapi/linux/input-event-codes.h#L190) -+ button: shutdown { -+ label = "shutdown"; -+ linux,code = <116>; // KEY_POWER -+ gpios = <&gpio 3 1>; -+ }; -+ }; -+ }; -+ }; -+ -+ // This defines parameters that can be specified when loading -+ // the overlay. Each foo = line specifies one parameter, named -+ // foo. The rest of the specification gives properties where the -+ // parameter value is inserted into (changing the values above -+ // or adding new ones). -+ __overrides__ { -+ // Allow overriding the GPIO number. -+ gpio_pin = <&button>,"gpios:4", -+ <&pin_state>,"brcm,pins:0"; -+ -+ // Allow changing the internal pullup/down state. 0 = none, 1 = pulldown, 2 = pullup -+ // Note that GPIO3 and GPIO2 are the I2c pins and have an external pullup (at least -+ // on some boards). -+ gpio_pull = <&pin_state>,"brcm,pull:0"; -+ -+ // Allow setting the active_low flag. 0 = active high, 1 = active low -+ active_low = <&button>,"gpios:8"; -+ }; -+ -+}; - -From a1cc7e0ae96efd623d7d54ba1d55fa213fb9c8c2 Mon Sep 17 00:00:00 2001 -From: Matthias Reichl -Date: Mon, 10 Jul 2017 11:05:17 +0200 -Subject: [PATCH 162/173] 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. - -This option will build 2 additional drivers, spdif_receiver -and spdif_transmitter. - -Since these drivers have DT bindings they are handy for quick -testing of I2S peripherals with simple-audio-card. - -eg: - -fragment@0 { - target-path = "/"; - __overlay__ { - dummy_receiver: spdif-receiver { - #address-cells = <0>; - #size-cells = <0>; - #sound-dai-cells = <0>; - compatible = "linux,spdif-dir"; - status = "okay"; - }; - }; -}; - -Signed-off-by: Matthias Reichl ---- - 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 d2838cde4019be5f6faf0a70038c6365df9e6dde..6f49e2b69f0cb27154dd26eba20eabdde2d60052 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -898,6 +898,7 @@ CONFIG_SND_PISOUND=m - CONFIG_SND_SOC_ADAU1701=m - CONFIG_SND_SOC_ADAU7002=m - CONFIG_SND_SOC_AK4554=m -+CONFIG_SND_SOC_SPDIF=m - CONFIG_SND_SOC_WM8804_I2C=m - CONFIG_SND_SIMPLE_CARD=m - CONFIG_HIDRAW=y -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index efdb0fbc1b07c7b679cb20d8c1270c77d5d3c684..472a330439a19ac5d4f70c22059f015816823694 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -891,6 +891,7 @@ CONFIG_SND_PISOUND=m - CONFIG_SND_SOC_ADAU1701=m - CONFIG_SND_SOC_ADAU7002=m - CONFIG_SND_SOC_AK4554=m -+CONFIG_SND_SOC_SPDIF=m - CONFIG_SND_SOC_WM8804_I2C=m - CONFIG_SND_SIMPLE_CARD=m - CONFIG_HIDRAW=y - -From bba1b7cbb27a7284d6733d26a4d2e704d7f5f5d6 Mon Sep 17 00:00:00 2001 -From: Bilal Amarni -Date: Wed, 24 May 2017 10:52:50 +0200 -Subject: [PATCH 163/173] [ARM64] enable drivers for GPIO expander and vcio - ---- - arch/arm64/configs/bcmrpi3_defconfig | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/arch/arm64/configs/bcmrpi3_defconfig b/arch/arm64/configs/bcmrpi3_defconfig -index 4d85c231c5ea0244e1b05fb4a5e3c8fd3e651ddf..9dcb58a519d041fadae99c81a7bda621b2a49f12 100644 ---- a/arch/arm64/configs/bcmrpi3_defconfig -+++ b/arch/arm64/configs/bcmrpi3_defconfig -@@ -575,6 +575,8 @@ CONFIG_SERIO_RAW=m - CONFIG_GAMEPORT=m - CONFIG_GAMEPORT_NS558=m - CONFIG_GAMEPORT_L4=m -+CONFIG_BRCM_CHAR_DRIVERS=y -+CONFIG_BCM_VCIO=y - # CONFIG_BCM2835_DEVGPIOMEM is not set - # CONFIG_BCM2835_SMI_DEV is not set - # CONFIG_LEGACY_PTYS is not set -@@ -609,6 +611,7 @@ CONFIG_PPS=m - CONFIG_PPS_CLIENT_LDISC=m - CONFIG_PPS_CLIENT_GPIO=m - CONFIG_GPIO_SYSFS=y -+CONFIG_GPIO_BCM_EXP=y - CONFIG_GPIO_BCM_VIRT=y - CONFIG_GPIO_ARIZONA=m - CONFIG_GPIO_STMPE=y - -From 0497442c11084d7658140f1d0c12e1366a08bf10 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Fri, 14 Jul 2017 12:59:55 +0100 -Subject: [PATCH 164/173] 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 -DMA from being used at all. Fix that bug by using the right -variable. - -Signed-off-by: Phil Elwell ---- - drivers/mmc/host/bcm2835-mmc.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 4fe8d1fe44578fbefcd48f8c327ba3d03f3d0a2a..981db05de1ff52a83550e41ab362eecf99cafa29 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -1354,14 +1354,14 @@ static int bcm2835_mmc_add_host(struct bcm2835_host *host) - if (ret == 0) { - host->dma_cfg_rx = cfg; - -- host->use_dma = true; -+ host->have_dma = true; - } else { - pr_err("%s: unable to configure DMA channel. " -- "Faling back to PIO\n", -+ "Falling back to PIO\n", - mmc_hostname(mmc)); - dma_release_channel(host->dma_chan_rxtx); - host->dma_chan_rxtx = NULL; -- host->use_dma = false; -+ host->have_dma = false; - } - } - #endif - -From d44a3ce8b3a6a47686f34b6dcc20fc990c5411bc Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Sun, 16 Jul 2017 21:39:16 +0100 -Subject: [PATCH 165/173] BCM270X_DT: Use the upstream thermal-zones DT node - -Signed-off-by: Phil Elwell ---- - arch/arm/boot/dts/bcm2708-rpi.dtsi | 30 ++++++------------------------ - 1 file changed, 6 insertions(+), 24 deletions(-) - -diff --git a/arch/arm/boot/dts/bcm2708-rpi.dtsi b/arch/arm/boot/dts/bcm2708-rpi.dtsi -index 29dde110e769082a24640d3c7284afb8e99b226c..8cc83a350d02bb485f7a4fcb129df9e00fb3f958 100644 ---- a/arch/arm/boot/dts/bcm2708-rpi.dtsi -+++ b/arch/arm/boot/dts/bcm2708-rpi.dtsi -@@ -90,30 +90,6 @@ - sound: sound { - status = "disabled"; - }; -- -- thermal-zones { -- cpu_thermal: cpu-thermal { -- polling-delay-passive = <0>; -- polling-delay = <1000>; -- -- thermal-sensors = <&thermal>; -- -- /* No trips -- trips { -- cpu-crit { -- temperature = <80000>; -- hysteresis = <0>; -- type = "critical"; -- }; -- }; -- */ -- -- coefficients = <(-538) 407000>; -- -- cooling-maps { -- }; -- }; -- }; - }; - - __overrides__ { -@@ -172,3 +148,9 @@ sdhost_pins: &sdhost_gpio48 { - &fb { - status = "okay"; - }; -+ -+&cpu_thermal { -+ coefficients = <(-538) 407000>; -+ -+ /delete-node/ trips; -+}; - -From 755af56f608bde7a8c4bb223f72a2945503c753b Mon Sep 17 00:00:00 2001 -From: Conn -Date: Mon, 17 Jul 2017 03:25:43 +0100 -Subject: [PATCH 166/173] config: enhance DualShock3 controller support - -Enable rumble support in Sony HID & HID battery strength. ---- - arch/arm/configs/bcm2709_defconfig | 2 ++ - arch/arm/configs/bcmrpi_defconfig | 2 ++ - 2 files changed, 4 insertions(+) - -diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig -index 6f49e2b69f0cb27154dd26eba20eabdde2d60052..62909413e1d625a1d33559d965ee8707ca57ba91 100644 ---- a/arch/arm/configs/bcm2709_defconfig -+++ b/arch/arm/configs/bcm2709_defconfig -@@ -901,6 +901,7 @@ CONFIG_SND_SOC_AK4554=m - CONFIG_SND_SOC_SPDIF=m - CONFIG_SND_SOC_WM8804_I2C=m - CONFIG_SND_SIMPLE_CARD=m -+CONFIG_HID_BATTERY_STRENGTH=y - CONFIG_HIDRAW=y - CONFIG_UHID=m - CONFIG_HID_A4TECH=m -@@ -943,6 +944,7 @@ CONFIG_HID_PICOLCD=m - CONFIG_HID_ROCCAT=m - CONFIG_HID_SAMSUNG=m - CONFIG_HID_SONY=m -+CONFIG_SONY_FF=y - CONFIG_HID_SPEEDLINK=m - CONFIG_HID_SUNPLUS=m - CONFIG_HID_GREENASIA=m -diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig -index 472a330439a19ac5d4f70c22059f015816823694..e0dd8723047ff488e81a03ef42fdbc68c43dc721 100644 ---- a/arch/arm/configs/bcmrpi_defconfig -+++ b/arch/arm/configs/bcmrpi_defconfig -@@ -894,6 +894,7 @@ CONFIG_SND_SOC_AK4554=m - CONFIG_SND_SOC_SPDIF=m - CONFIG_SND_SOC_WM8804_I2C=m - CONFIG_SND_SIMPLE_CARD=m -+CONFIG_HID_BATTERY_STRENGTH=y - CONFIG_HIDRAW=y - CONFIG_UHID=m - CONFIG_HID_A4TECH=m -@@ -936,6 +937,7 @@ CONFIG_HID_PICOLCD=m - CONFIG_HID_ROCCAT=m - CONFIG_HID_SAMSUNG=m - CONFIG_HID_SONY=m -+CONFIG_SONY_FF=y - CONFIG_HID_SPEEDLINK=m - CONFIG_HID_SUNPLUS=m - CONFIG_HID_GREENASIA=m - -From 000bbf308083a5facd5fa5022a941683550d561d Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Wed, 19 Jul 2017 15:20:50 +0100 -Subject: [PATCH 167/173] overlays: i2c1-bcm2708: Don't overwrite i2c1 pins - node - -It is bad practise to overwrite an entire node in an overlay. Instead, -target the node and overwrite any properties that need changing. - -See: https://github.com/raspberrypi/linux/pull/2118 - -Suggested-by: soodvarun78 -Signed-off-by: Phil Elwell ---- - arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts | 17 +++++++---------- - 1 file changed, 7 insertions(+), 10 deletions(-) - -diff --git a/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts -index e303b9c61c82a28eab7b48f6b085661574d5a849..7c69047bcd88a5c900dddd08e60ad0750b96d785 100644 ---- a/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts -+++ b/arch/arm/boot/dts/overlays/i2c1-bcm2708-overlay.dts -@@ -20,18 +20,15 @@ - }; - - fragment@1 { -- target = <&gpio>; -- __overlay__ { -- i2c1_pins: i2c1 { -- brcm,pins = <2 3>; -- brcm,function = <4>; /* alt0 */ -- }; -+ target = <&i2c1_pins>; -+ pins: __overlay__ { -+ brcm,pins = <2 3>; -+ brcm,function = <4>; /* alt 0 */ - }; - }; -- - __overrides__ { -- sda1_pin = <&i2c1_pins>,"brcm,pins:0"; -- scl1_pin = <&i2c1_pins>,"brcm,pins:4"; -- pin_func = <&i2c1_pins>,"brcm,function:0"; -+ sda1_pin = <&pins>,"brcm,pins:0"; -+ scl1_pin = <&pins>,"brcm,pins:4"; -+ pin_func = <&pins>,"brcm,function:0"; - }; - }; - -From ea1f4704015786c01fbfd270f3a11bf5f550cc13 Mon Sep 17 00:00:00 2001 -From: Phil Elwell -Date: Tue, 18 Jul 2017 15:30:48 +0100 -Subject: [PATCH 168/173] 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 -bcm2835-mmc driver contains a race between the handling of the DMA -completion interrupt and the submission of the next request. Fix the -race by deferring the completion of the request until the DMA -transfer finishes. - -Signed-off-by: Phil Elwell ---- - drivers/mmc/host/bcm2835-mmc.c | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/drivers/mmc/host/bcm2835-mmc.c b/drivers/mmc/host/bcm2835-mmc.c -index 981db05de1ff52a83550e41ab362eecf99cafa29..c4a5e992c6fb4a40b933239350ed4bfc8fb40155 100644 ---- a/drivers/mmc/host/bcm2835-mmc.c -+++ b/drivers/mmc/host/bcm2835-mmc.c -@@ -115,6 +115,7 @@ struct bcm2835_host { - - bool have_dma; - bool use_dma; -+ bool wait_for_dma; - /*end of DMA part*/ - - int max_delay; /* maximum length of time spent waiting */ -@@ -341,6 +342,8 @@ static void bcm2835_mmc_dma_complete(void *param) - - spin_lock_irqsave(&host->lock, flags); - -+ host->use_dma = false; -+ - if (host->data && !(host->data->flags & MMC_DATA_WRITE)) { - /* otherwise handled in SDHCI IRQ */ - dma_chan = host->dma_chan_rxtx; -@@ -351,6 +354,9 @@ static void bcm2835_mmc_dma_complete(void *param) - dir_data); - - bcm2835_mmc_finish_data(host); -+ } else if (host->wait_for_dma) { -+ host->wait_for_dma = false; -+ tasklet_schedule(&host->finish_tasklet); - } - - spin_unlock_irqrestore(&host->lock, flags); -@@ -690,6 +696,7 @@ void bcm2835_mmc_send_command(struct bcm2835_host *host, struct mmc_command *cmd - mod_timer(&host->timer, timeout); - - host->cmd = cmd; -+ host->use_dma = false; - - bcm2835_mmc_prepare_data(host, cmd); - -@@ -759,8 +766,11 @@ static void bcm2835_mmc_finish_data(struct bcm2835_host *host) - } - - bcm2835_mmc_send_command(host, data->stop); -- } else -+ } else if (host->use_dma) { -+ host->wait_for_dma = true; -+ } else { - tasklet_schedule(&host->finish_tasklet); -+ } - } - - static void bcm2835_mmc_finish_command(struct bcm2835_host *host) - -From 680b71b741156963a7bafea1f8a8e1a35d2c1219 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Sven=20K=C3=B6hler?= -Date: Mon, 7 Aug 2017 18:49:20 +0200 -Subject: [PATCH 169/173] Fix dependencies broken since driver was renamed - ---- - drivers/mmc/host/Kconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig -index d47cce77c0551d78fa51f50e2c8086f26c7b9e56..dc41121c101e2ac6fe000fe2ab556561a340b78f 100644 ---- a/drivers/mmc/host/Kconfig -+++ b/drivers/mmc/host/Kconfig -@@ -25,7 +25,7 @@ config MMC_BCM2835_DMA - - config MMC_BCM2835_PIO_DMA_BARRIER - int "Block count limit for PIO transfers" -- depends on MMC_BCM2835 && MMC_BCM2835_DMA -+ depends on MMC_BCM2835_MMC && MMC_BCM2835_DMA - range 0 256 - default 2 - help - -From 0e7c5fbfb2d9173f593a8fefe4bbd727b8de361f Mon Sep 17 00:00:00 2001 -From: Eric Anholt -Date: Thu, 18 Dec 2014 16:07:15 -0800 -Subject: [PATCH 170/173] 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 1423da8dd16f5bdc83e20ddf6665b2022a9a6492..6ce930c02160d55dc4eee1e7197a5efa6ba7d44a 100644 ---- a/mm/page_alloc.c -+++ b/mm/page_alloc.c -@@ -7692,8 +7692,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 3349f1df8142f5463d3a856483691b10eb44e016 Mon Sep 17 00:00:00 2001 +From b22199c4589523501a080d57fe33ce3e129f1531 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 25 Aug 2017 19:18:13 +0100 -Subject: [PATCH 171/173] cache: export clean and invalidate +Subject: [PATCH 129/140] cache: export clean and invalidate --- arch/arm/mm/cache-v6.S | 4 ++-- @@ -136732,216 +134756,937 @@ index de78109d002db1a5e7c94a6c1bc8bb94161d07b8..4c850aa3af2b2439fced4e130441329a sub r3, r2, #1 bic r0, r0, r3 -From d0795818dbfcdb270b5c3b9d3bdccd29b1208d5d Mon Sep 17 00:00:00 2001 -From: Olivier Schonken -Date: Mon, 28 Aug 2017 10:52:32 +0200 -Subject: [PATCH 172/173] Fix DTB overlay compilation for arm64 broadcom - -The dts-dirs variable was overwritten by the assignment of the -stingray directory after the overlays directory, thus no overlays -were being built - -Signed-off-by: Olivier Schonken ---- - arch/arm64/boot/dts/broadcom/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/arch/arm64/boot/dts/broadcom/Makefile b/arch/arm64/boot/dts/broadcom/Makefile -index 97af2ececc52ca3aad7b84dc2fdb5c269a45bde0..3b76320112196a1fce7a0941c696fd1ec43b817f 100644 ---- a/arch/arm64/boot/dts/broadcom/Makefile -+++ b/arch/arm64/boot/dts/broadcom/Makefile -@@ -11,7 +11,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += bcm2710-rpi-3-b.dtb - - dts-dirs += ../overlays - --dts-dirs := stingray -+dts-dirs += stingray - always := $(dtb-y) - subdir-y := $(dts-dirs) - clean-files := *.dtb - -From 80d497d63c3cb89e861723360e653fb2d7750940 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Fri, 25 Aug 2017 19:18:26 +0100 -Subject: [PATCH 173/173] vcsm: Provide new ioctl to clean/invalidate a 2D - block +From ef18bccaf8f722ce25e5cd2bf5d9093abac997c3 Mon Sep 17 00:00:00 2001 +From: Dan Pasanen +Date: Wed, 20 Sep 2017 10:17:41 -0500 +Subject: [PATCH 130/140] vcsm: fix multi-platform build --- - drivers/char/broadcom/vc_sm/vmcs_sm.c | 92 ++++++++++++++++++++++++++++++++-- - include/linux/broadcom/vmcs_sm_ioctl.h | 16 ++++++ - 2 files changed, 105 insertions(+), 3 deletions(-) + 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 fd2ca788dcd56b1702454d71b7bedd4203179500..d49e39566d521c95a96375c556516e444d52b6a0 100644 +index 034ae2f27f870621af9f49453501f1cde051f32a..b7814d67500b98fcd6f376d526a3d4a4b84fd152 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. */ +@@ -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 7a99631cfabb45b3989be013975dcb69eab868e8 Mon Sep 17 00:00:00 2001 +From: Dan Pasanen +Date: Thu, 21 Sep 2017 09:55:42 -0500 +Subject: [PATCH 131/140] 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/proc-macros.S | 2 ++ + arch/arm/mm/proc-syms.c | 3 +++ + 4 files changed, 28 insertions(+) + +diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h +index 74504b154256e36ff4897ed1c7df43eb4d91bdef..8ccb358b7043cabeb3d2b6769ef4eb11827d78ed 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); - struct SM_PRIV_DATA_T *private; -+ bool map; /* whether to map pages up front */ ++ void (*dma_inv_range)(const void *, const void *); ++ void (*dma_clean_range)(const void *, const void *); + void (*dma_flush_range)(const void *, const void *); + } __no_randomize_layout; + +@@ -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/proc-macros.S b/arch/arm/mm/proc-macros.S +index f944836da8a222cd97c4e29070afa3aa370e0cbb..e6abed8db42b247ac731e49415bdc4fe92826095 100644 +--- a/arch/arm/mm/proc-macros.S ++++ b/arch/arm/mm/proc-macros.S +@@ -323,6 +323,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 c704414b4ffa21cbef4af1b91c75dc6d37ca343c Mon Sep 17 00:00:00 2001 +From: Dan Pasanen +Date: Thu, 21 Sep 2017 09:57:44 -0500 +Subject: [PATCH 132/140] 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, }; - /* 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); ++/* Cache functions */ ++#define VCSM_CACHE_OP_INV 0x01 ++#define VCSM_CACHE_OP_FLUSH 0x02 ++#define VCSM_CACHE_OP_CLEAN 0x03 + -+ 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; + /* Allocate a shared memory handle and block. */ + int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle); - 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; -+ } +diff --git a/drivers/char/broadcom/vc_sm/vmcs_sm.c b/drivers/char/broadcom/vc_sm/vmcs_sm.c +index b7814d67500b98fcd6f376d526a3d4a4b84fd152..32763bd01e2e3831778fbcd1066df3cbf582235d 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); - /* 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 -@@ -2790,6 +2814,68 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) + break; ++ default: ++ break; /* NOOP */ + } } } - 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; + +From 9f042caa5460f06fafb87ce7d2630d3c01be061b Mon Sep 17 00:00:00 2001 +From: Dan Pasanen +Date: Thu, 21 Sep 2017 07:41:02 -0500 +Subject: [PATCH 133/140] 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 32763bd01e2e3831778fbcd1066df3cbf582235d..cfa4ff747de2a96e03dab995aa54fc80eb880157 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 *); + -+ /* 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 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 -+ } ++ 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; + } -+ } -+ 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, + if ((op->invalidate_mode & ~3) != 0) { + ret = -EINVAL; + +From 81d085df96d1f462c73e1a36bd82f8abd9fdb848 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Fri, 29 Sep 2017 16:15:01 +0100 +Subject: [PATCH 134/140] 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 { - VMCS_SM_CMD_CLEAN_INVALID, -+ VMCS_SM_CMD_CLEAN_INVALID2, + /* 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 - VMCS_SM_CMD_LAST /* Do no delete */ - }; -@@ -175,6 +176,18 @@ struct vmcs_sm_ioctl_clean_invalid { - } s[8]; + /* Allocate a shared memory handle and block. */ + int vc_sm_alloc(struct vc_sm_alloc_t *alloc, int *handle); + +From 549e3c459e47777dad7bd5c07809088ba3460995 Mon Sep 17 00:00:00 2001 +From: Chung-Hsien Hsu +Date: Sun, 14 May 2017 20:11:05 -0500 +Subject: [PATCH 135/140] 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 163ddc49f95117774f03184b9f0679bd82d086d2..fb60a7c66e2ce70f5b1da75851cdb74e06833760 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bus.h +@@ -71,6 +71,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 +@@ -87,6 +88,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); }; -+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]; + +@@ -224,6 +227,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 df138305217384de2359313bc7d005285388e78e..f0309e039592ba6e388084a13f052c03f99cf1ef 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 e0d22fedb2b45932f04a35458f44408804b23d90..b99dc2b760463fb13747473f1126bea6ad094855 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h +@@ -155,6 +155,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, +@@ -932,4 +948,15 @@ struct brcmf_gscan_config { + struct brcmf_gscan_bucket_config bucket[1]; + }; + ++/** ++ * 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]; +}; + - /* 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) + #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 f878706613e679515410e573eb770f1b1a28ef26..b370ee7f52788d779cf6d14e15a5ee4de3fa6c35 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1350,6 +1350,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, +@@ -1359,6 +1377,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 f8d4647016a1cde3d51dd43da07a46ce9771fa18..63f7624ed7f4e0783e9835670a14914585d99f0b 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -3978,6 +3978,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, +@@ -3988,6 +4006,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 0eea48e73331d57297099266b1725df2be35a565..f00016f804ac98995369c1e68586a86d5bd310d9 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +@@ -1126,12 +1126,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 72cbda0085b603109edc6c8500c7a17ad568b7fd Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 6 Oct 2017 13:23:32 +0100 +Subject: [PATCH 136/140] 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 f0309e039592ba6e388084a13f052c03f99cf1ef..b5889360da96096775db6425337a72156aab6d73 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 d476c9cd8b92b5d24f6e1ac0f049fd22e99d88fa Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 29 Sep 2017 10:32:19 +0100 +Subject: [PATCH 137/140] 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 81914a615c8b011fe7d70a2e14f16491947c49b7..d312c2739624eca57b218b26e272e187012cb7d1 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; ++ }; ++ + i2s@7e203000 { /* i2s */ + #sound-dai-cells = <0>; + reg = <0x7e203000 0x24>; +diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c +index 4b815abbf9913075885ee60f4d9ad49d89ec96b2..8c6e495b74ca61b8ff8ee79bc6e9d84d572b990a 100644 +--- a/drivers/tty/serial/amba-pl011.c ++++ b/drivers/tty/serial/amba-pl011.c +@@ -2664,6 +2664,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 0cc5b2c76b399a8c25a1bb7eb8bb86a4e68f2a31 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Fri, 29 Sep 2017 10:32:19 +0100 +Subject: [PATCH 138/140] 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 8c6e495b74ca61b8ff8ee79bc6e9d84d572b990a..f6428446dfc0eb060d18c119d065d85ee6fea18c 100644 +--- a/drivers/tty/serial/amba-pl011.c ++++ b/drivers/tty/serial/amba-pl011.c +@@ -1403,6 +1403,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 66d3a2744f7cf19f697ca70f2dacfe05ff4080e0 Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Wed, 11 Oct 2017 13:48:04 +0100 +Subject: [PATCH 139/140] 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 f6428446dfc0eb060d18c119d065d85ee6fea18c..aa661160a87330f013879e56a2da2ed6db7ec104 100644 +--- a/drivers/tty/serial/amba-pl011.c ++++ b/drivers/tty/serial/amba-pl011.c +@@ -2047,9 +2047,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 e300970d92c387679fb6207ed9737fbdf1bf39b9 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 140/140] 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 e6d777a601c91d192bc5713f9a73e1a2d4d708ef..b34c9a9f115b4d7ac81ef4d9417beaadd62259b2 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) - #define VMCS_SM_IOCTL_SIZE_USR_HDL\ - _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_SIZE_USR_HANDLE,\ diff --git a/tools/distro-tool b/tools/distro-tool index 1a0c176abc..0977d43f72 100755 --- a/tools/distro-tool +++ b/tools/distro-tool @@ -814,6 +814,7 @@ generate_work_worker() { PKG_URL="${PKG_URL/${PKG_VERSION}/${revision}}" PKG_SOURCE_NAME="${PKG_SOURCE_NAME/${PKG_VERSION}/${revision}}" PKG_VERSION="${revision}" + PKG_SHA256= fi PKG_IS_ADDON=No