--- /dev/null
+From e0936c3471a8411a5df327641fa3ffe12a2fb07b Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Wed, 9 Aug 2017 02:16:20 +0000
+Subject: ASoC: rsnd: avoid duplicate free_irq()
+
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+
+commit e0936c3471a8411a5df327641fa3ffe12a2fb07b upstream.
+
+commit 1f8754d4daea5f ("ASoC: rsnd: don't call free_irq() on
+Parent SSI") fixed Parent SSI duplicate free_irq().
+But on Renesas Sound, not only Parent SSI but also Multi SSI
+have same issue.
+This patch avoid duplicate free_irq() if it was not pure SSI.
+
+Fixes: 1f8754d4daea5f ("ASoC: rsnd: don't call free_irq() on Parent SSI")
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: thongsyho <thong.ho.px@rvc.renesas.com>
+Signed-off-by: Nhan Nguyen <nhan.nguyen.yb@renesas.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/soc/sh/rcar/ssi.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/sound/soc/sh/rcar/ssi.c
++++ b/sound/soc/sh/rcar/ssi.c
+@@ -550,14 +550,14 @@ static int rsnd_ssi_dma_remove(struct rs
+ struct rsnd_priv *priv)
+ {
+ struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
+- struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io);
++ struct rsnd_mod *pure_ssi_mod = rsnd_io_to_mod_ssi(io);
+ struct device *dev = rsnd_priv_to_dev(priv);
+ int irq = ssi->info->irq;
+
+ rsnd_dma_quit(io, rsnd_mod_to_dma(mod));
+
+- /* Do nothing for SSI parent mod */
+- if (ssi_parent_mod == mod)
++ /* Do nothing if non SSI (= SSI parent, multi SSI) mod */
++ if (pure_ssi_mod != mod)
+ return 0;
+
+ /* PIO will request IRQ again */
--- /dev/null
+From 1f8754d4daea5f257370a52a30fcb22798c54516 Mon Sep 17 00:00:00 2001
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Date: Tue, 16 May 2017 01:48:24 +0000
+Subject: ASoC: rsnd: don't call free_irq() on Parent SSI
+
+From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+
+commit 1f8754d4daea5f257370a52a30fcb22798c54516 upstream.
+
+If SSI uses shared pin, some SSI will be used as parent SSI.
+Then, normal SSI's remove and Parent SSI's remove
+(these are same SSI) will be called when unbind or remove timing.
+In this case, free_irq() will be called twice.
+This patch solve this issue.
+
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
+Reported-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: thongsyho <thong.ho.px@rvc.renesas.com>
+Signed-off-by: Nhan Nguyen <nhan.nguyen.yb@renesas.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/soc/sh/rcar/rsnd.h | 2 ++
+ sound/soc/sh/rcar/ssi.c | 5 +++++
+ 2 files changed, 7 insertions(+)
+
+--- a/sound/soc/sh/rcar/rsnd.h
++++ b/sound/soc/sh/rcar/rsnd.h
+@@ -235,6 +235,7 @@ enum rsnd_mod_type {
+ RSND_MOD_MIX,
+ RSND_MOD_CTU,
+ RSND_MOD_SRC,
++ RSND_MOD_SSIP, /* SSI parent */
+ RSND_MOD_SSI,
+ RSND_MOD_MAX,
+ };
+@@ -365,6 +366,7 @@ struct rsnd_dai_stream {
+ };
+ #define rsnd_io_to_mod(io, i) ((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL)
+ #define rsnd_io_to_mod_ssi(io) rsnd_io_to_mod((io), RSND_MOD_SSI)
++#define rsnd_io_to_mod_ssip(io) rsnd_io_to_mod((io), RSND_MOD_SSIP)
+ #define rsnd_io_to_mod_src(io) rsnd_io_to_mod((io), RSND_MOD_SRC)
+ #define rsnd_io_to_mod_ctu(io) rsnd_io_to_mod((io), RSND_MOD_CTU)
+ #define rsnd_io_to_mod_mix(io) rsnd_io_to_mod((io), RSND_MOD_MIX)
+--- a/sound/soc/sh/rcar/ssi.c
++++ b/sound/soc/sh/rcar/ssi.c
+@@ -550,11 +550,16 @@ static int rsnd_ssi_dma_remove(struct rs
+ struct rsnd_priv *priv)
+ {
+ struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
++ struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io);
+ struct device *dev = rsnd_priv_to_dev(priv);
+ int irq = ssi->info->irq;
+
+ rsnd_dma_quit(io, rsnd_mod_to_dma(mod));
+
++ /* Do nothing for SSI parent mod */
++ if (ssi_parent_mod == mod)
++ return 0;
++
+ /* PIO will request IRQ again */
+ devm_free_irq(dev, irq, mod);
+
--- /dev/null
+From 7ac45d1635a4cd2e99a4b11903d4a2815ca1b27b Mon Sep 17 00:00:00 2001
+From: Julian Scheel <julian@jusst.de>
+Date: Wed, 24 May 2017 12:28:23 +0200
+Subject: ASoC: simple-card: Fix misleading error message
+
+From: Julian Scheel <julian@jusst.de>
+
+commit 7ac45d1635a4cd2e99a4b11903d4a2815ca1b27b upstream.
+
+In case cpu could not be found the error message would always refer to
+/codec/ not being found in DT. Fix this by catching the cpu node not found
+case explicitly.
+
+Signed-off-by: Julian Scheel <julian@jusst.de>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: thongsyho <thong.ho.px@rvc.renesas.com>
+Signed-off-by: Nhan Nguyen <nhan.nguyen.yb@renesas.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/soc/generic/simple-card.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+--- a/sound/soc/generic/simple-card.c
++++ b/sound/soc/generic/simple-card.c
+@@ -343,13 +343,19 @@ static int asoc_simple_card_dai_link_of(
+ snprintf(prop, sizeof(prop), "%scpu", prefix);
+ cpu = of_get_child_by_name(node, prop);
+
++ if (!cpu) {
++ ret = -EINVAL;
++ dev_err(dev, "%s: Can't find %s DT node\n", __func__, prop);
++ goto dai_link_of_err;
++ }
++
+ snprintf(prop, sizeof(prop), "%splat", prefix);
+ plat = of_get_child_by_name(node, prop);
+
+ snprintf(prop, sizeof(prop), "%scodec", prefix);
+ codec = of_get_child_by_name(node, prop);
+
+- if (!cpu || !codec) {
++ if (!codec) {
+ ret = -EINVAL;
+ dev_err(dev, "%s: Can't find %s DT node\n", __func__, prop);
+ goto dai_link_of_err;
--- /dev/null
+From 641307df71fe77d7b38a477067495ede05d47295 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Sat, 29 Jul 2017 02:31:33 +0300
+Subject: drm: rcar-du: Fix race condition when disabling planes at CRTC stop
+
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+
+commit 641307df71fe77d7b38a477067495ede05d47295 upstream.
+
+When stopping the CRTC the driver must disable all planes and wait for
+the change to take effect at the next vblank. Merely calling
+drm_crtc_wait_one_vblank() is not enough, as the function doesn't
+include any mechanism to handle the race with vblank interrupts.
+
+Replace the drm_crtc_wait_one_vblank() call with a manual mechanism that
+handles the vblank interrupt race.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
+Signed-off-by: thongsyho <thong.ho.px@rvc.renesas.com>
+Signed-off-by: Nhan Nguyen <nhan.nguyen.yb@renesas.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 54 +++++++++++++++++++++++++++++----
+ drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 8 ++++
+ 2 files changed, 56 insertions(+), 6 deletions(-)
+
+--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
++++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+@@ -371,6 +371,31 @@ static void rcar_du_crtc_start(struct rc
+ rcrtc->started = true;
+ }
+
++static void rcar_du_crtc_disable_planes(struct rcar_du_crtc *rcrtc)
++{
++ struct rcar_du_device *rcdu = rcrtc->group->dev;
++ struct drm_crtc *crtc = &rcrtc->crtc;
++ u32 status;
++ /* Make sure vblank interrupts are enabled. */
++ drm_crtc_vblank_get(crtc);
++ /*
++ * Disable planes and calculate how many vertical blanking interrupts we
++ * have to wait for. If a vertical blanking interrupt has been triggered
++ * but not processed yet, we don't know whether it occurred before or
++ * after the planes got disabled. We thus have to wait for two vblank
++ * interrupts in that case.
++ */
++ spin_lock_irq(&rcrtc->vblank_lock);
++ rcar_du_group_write(rcrtc->group, rcrtc->index % 2 ? DS2PR : DS1PR, 0);
++ status = rcar_du_crtc_read(rcrtc, DSSR);
++ rcrtc->vblank_count = status & DSSR_VBK ? 2 : 1;
++ spin_unlock_irq(&rcrtc->vblank_lock);
++ if (!wait_event_timeout(rcrtc->vblank_wait, rcrtc->vblank_count == 0,
++ msecs_to_jiffies(100)))
++ dev_warn(rcdu->dev, "vertical blanking timeout\n");
++ drm_crtc_vblank_put(crtc);
++}
++
+ static void rcar_du_crtc_stop(struct rcar_du_crtc *rcrtc)
+ {
+ struct drm_crtc *crtc = &rcrtc->crtc;
+@@ -379,17 +404,16 @@ static void rcar_du_crtc_stop(struct rca
+ return;
+
+ /* Disable all planes and wait for the change to take effect. This is
+- * required as the DSnPR registers are updated on vblank, and no vblank
+- * will occur once the CRTC is stopped. Disabling planes when starting
+- * the CRTC thus wouldn't be enough as it would start scanning out
+- * immediately from old frame buffers until the next vblank.
++ * required as the plane enable registers are updated on vblank, and no
++ * vblank will occur once the CRTC is stopped. Disabling planes when
++ * starting the CRTC thus wouldn't be enough as it would start scanning
++ * out immediately from old frame buffers until the next vblank.
+ *
+ * This increases the CRTC stop delay, especially when multiple CRTCs
+ * are stopped in one operation as we now wait for one vblank per CRTC.
+ * Whether this can be improved needs to be researched.
+ */
+- rcar_du_group_write(rcrtc->group, rcrtc->index % 2 ? DS2PR : DS1PR, 0);
+- drm_crtc_wait_one_vblank(crtc);
++ rcar_du_crtc_disable_planes(rcrtc);
+
+ /* Disable vertical blanking interrupt reporting. We first need to wait
+ * for page flip completion before stopping the CRTC as userspace
+@@ -528,10 +552,26 @@ static irqreturn_t rcar_du_crtc_irq(int
+ irqreturn_t ret = IRQ_NONE;
+ u32 status;
+
++ spin_lock(&rcrtc->vblank_lock);
++
+ status = rcar_du_crtc_read(rcrtc, DSSR);
+ rcar_du_crtc_write(rcrtc, DSRCR, status & DSRCR_MASK);
+
+ if (status & DSSR_VBK) {
++ /*
++ * Wake up the vblank wait if the counter reaches 0. This must
++ * be protected by the vblank_lock to avoid races in
++ * rcar_du_crtc_disable_planes().
++ */
++ if (rcrtc->vblank_count) {
++ if (--rcrtc->vblank_count == 0)
++ wake_up(&rcrtc->vblank_wait);
++ }
++ }
++
++ spin_unlock(&rcrtc->vblank_lock);
++
++ if (status & DSSR_VBK) {
+ drm_handle_vblank(rcrtc->crtc.dev, rcrtc->index);
+ rcar_du_crtc_finish_page_flip(rcrtc);
+ ret = IRQ_HANDLED;
+@@ -585,6 +625,8 @@ int rcar_du_crtc_create(struct rcar_du_g
+ }
+
+ init_waitqueue_head(&rcrtc->flip_wait);
++ init_waitqueue_head(&rcrtc->vblank_wait);
++ spin_lock_init(&rcrtc->vblank_lock);
+
+ rcrtc->group = rgrp;
+ rcrtc->mmio_offset = mmio_offsets[index];
+--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
++++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
+@@ -15,6 +15,7 @@
+ #define __RCAR_DU_CRTC_H__
+
+ #include <linux/mutex.h>
++#include <linux/spinlock.h>
+ #include <linux/wait.h>
+
+ #include <drm/drmP.h>
+@@ -32,6 +33,9 @@ struct rcar_du_group;
+ * @started: whether the CRTC has been started and is running
+ * @event: event to post when the pending page flip completes
+ * @flip_wait: wait queue used to signal page flip completion
++ * @vblank_lock: protects vblank_wait and vblank_count
++ * @vblank_wait: wait queue used to signal vertical blanking
++ * @vblank_count: number of vertical blanking interrupts to wait for
+ * @outputs: bitmask of the outputs (enum rcar_du_output) driven by this CRTC
+ * @enabled: whether the CRTC is enabled, used to control system resume
+ * @group: CRTC group this CRTC belongs to
+@@ -48,6 +52,10 @@ struct rcar_du_crtc {
+ struct drm_pending_vblank_event *event;
+ wait_queue_head_t flip_wait;
+
++ spinlock_t vblank_lock;
++ wait_queue_head_t vblank_wait;
++ unsigned int vblank_count;
++
+ unsigned int outputs;
+ bool enabled;
+
--- /dev/null
+From cbbb90b0c084d7dfb2ed8e3fecf8df200fbdd2a0 Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Mon, 10 Jul 2017 23:46:39 +0300
+Subject: drm: rcar-du: Use the VBK interrupt for vblank events
+
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+
+commit cbbb90b0c084d7dfb2ed8e3fecf8df200fbdd2a0 upstream.
+
+When implementing support for interlaced modes, the driver switched from
+reporting vblank events on the vertical blanking (VBK) interrupt to the
+frame end interrupt (FRM). This incorrectly divided the reported refresh
+rate by two. Fix it by moving back to the VBK interrupt.
+
+Fixes: 906eff7fcada ("drm: rcar-du: Implement support for interlaced modes")
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
+Signed-off-by: thongsyho <thong.ho.px@rvc.renesas.com>
+Signed-off-by: Nhan Nguyen <nhan.nguyen.yb@renesas.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
++++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+@@ -531,7 +531,7 @@ static irqreturn_t rcar_du_crtc_irq(int
+ status = rcar_du_crtc_read(rcrtc, DSSR);
+ rcar_du_crtc_write(rcrtc, DSRCR, status & DSRCR_MASK);
+
+- if (status & DSSR_FRM) {
++ if (status & DSSR_VBK) {
+ drm_handle_vblank(rcrtc->crtc.dev, rcrtc->index);
+ rcar_du_crtc_finish_page_flip(rcrtc);
+ ret = IRQ_HANDLED;
--- /dev/null
+From matthias.dev@gmx.de Tue Feb 6 12:26:56 2018
+From: Matthias <matthias.dev@gmx.de>
+Date: Tue, 6 Feb 2018 20:59:01 +0100
+Subject: net: cdc_ncm: initialize drvflags before usage
+To: stable@vger.kernel.org
+Cc: mrkiko.rs@gmail.com
+Message-ID: <20180206205901.79d22fef@olympia.home.net>
+
+From: Matthias Hintzmann <matthias.dev@gmx.de>
+
+ctx->drvflags is checked in the if clause before beeing initialized.
+Move initialization before first usage.
+
+Note, that the if clause was backported with commit 75f82a703b30
+("cdc_ncm: Set NTB format again after altsetting switch for Huawei
+devices") from mainline (upstream commit 2b02c20ce0c2 ("cdc_ncm: Set NTB
+format again after altsetting switch for Huawei devices"). In mainline,
+the initialization is at the right place before the if clause.
+
+[mrkiko.rs@gmail.com: commit message tweaks]
+
+Fixes: 75f82a703b30 ("cdc_ncm: Set NTB format again after altsetting switch for Huawei devices")
+Signed-off-by: Matthias Hintzmann <matthias.dev@gmx.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/usb/cdc_ncm.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/usb/cdc_ncm.c
++++ b/drivers/net/usb/cdc_ncm.c
+@@ -825,6 +825,9 @@ int cdc_ncm_bind_common(struct usbnet *d
+ goto error2;
+ }
+
++ /* Device-specific flags */
++ ctx->drvflags = drvflags;
++
+ /*
+ * Some Huawei devices have been observed to come out of reset in NDP32 mode.
+ * Let's check if this is the case, and set the device to NDP16 mode again if
+@@ -873,9 +876,6 @@ int cdc_ncm_bind_common(struct usbnet *d
+ /* finish setting up the device specific data */
+ cdc_ncm_setup(dev);
+
+- /* Device-specific flags */
+- ctx->drvflags = drvflags;
+-
+ /* Allocate the delayed NDP if needed. */
+ if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END) {
+ ctx->delayed_ndp16 = kzalloc(ctx->max_ndp_size, GFP_KERNEL);
asoc-pcm512x-add-missing-module_description-author-license.patch
usbip-vhci_hcd-clear-just-the-usb_port_stat_power-bit.patch
usbip-fix-3eee23c3ec14-tcp_socket-address-still-in-the-status-file.patch
+net-cdc_ncm-initialize-drvflags-before-usage.patch
+asoc-simple-card-fix-misleading-error-message.patch
+asoc-rsnd-don-t-call-free_irq-on-parent-ssi.patch
+asoc-rsnd-avoid-duplicate-free_irq.patch
+drm-rcar-du-use-the-vbk-interrupt-for-vblank-events.patch
+drm-rcar-du-fix-race-condition-when-disabling-planes-at-crtc-stop.patch