aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-kernel/most
diff options
context:
space:
mode:
authorChristian Gromm <christian.gromm@microchip.com>2017-09-04 17:21:29 +0200
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2017-09-26 21:00:22 +0000
commite3253ac2cbc5fb9df6fcc6df6b0de1db34490abf (patch)
treee6a230b2ff138ac410ae11a0ca2b0b94e58a9358 /recipes-kernel/most
parentc3b43f6db27847fec4588e709d6d16f24065655c (diff)
recipes-kernel: most: add most.bbappend file
This patch adds a patch queue to eliminate problems DMA coherent memory allocation on aarch64 architecture, prevents the driver from printing warning, due to bad video driver capabilities and passes a valid parent device to the sound subsystem when registering a new sound card. --- v2 (jsmoeller): use _append everywhere v3 (christian gromm): fix path in patch files Change-Id: Idceefee7855445481eeb4940d5c5f632e27feb73 Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
Diffstat (limited to 'recipes-kernel/most')
-rw-r--r--recipes-kernel/most/files/0001-let-HDMs-do-the-coherent-memory-allocation.patch140
-rw-r--r--recipes-kernel/most/files/0002-most-pass-parent-devcie-to-snd_card_new.patch52
-rw-r--r--recipes-kernel/most/files/0003-core-remove-kernel-log-for-MBO-status.patch26
-rw-r--r--recipes-kernel/most/files/0004-most-video-set-device_caps.patch25
-rw-r--r--recipes-kernel/most/files/0005-most-video-set-V4L2_CAP_DEVICE_CAPS-flag.patch25
-rw-r--r--recipes-kernel/most/most.bbappend10
6 files changed, 278 insertions, 0 deletions
diff --git a/recipes-kernel/most/files/0001-let-HDMs-do-the-coherent-memory-allocation.patch b/recipes-kernel/most/files/0001-let-HDMs-do-the-coherent-memory-allocation.patch
new file mode 100644
index 000000000..b387faac1
--- /dev/null
+++ b/recipes-kernel/most/files/0001-let-HDMs-do-the-coherent-memory-allocation.patch
@@ -0,0 +1,140 @@
+From b4fe384dde3e230d8c252525fcd5297015b147d1 Mon Sep 17 00:00:00 2001
+From: Christian Gromm <christian.gromm@microchip.com>
+Date: Wed, 2 Aug 2017 14:51:20 +0200
+Subject: [PATCH 1/5] let HDMs do the coherent memory allocation
+
+On arm64/aarch64 architectures the allocation of coherent memory
+needs a device that has the dma_ops proberly set. That's why the
+core module of the MOST driver is no longer able to allocate this
+kind of memory. This patch moves the allocation process down to
+the HDM layer where the proper devices exist in either the USB
+host controller or the platform device.
+
+Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
+
+
+Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
+---
+ driver/hdm-dim2/dim2_hdm.c | 12 ++++++++++++
+ driver/hdm-usb/hdm_usb.c | 18 ++++++++++++++++++
+ driver/include/mostcore.h | 2 ++
+ driver/mostcore/core.c | 17 +++++++++++------
+ 4 files changed, 43 insertions(+), 6 deletions(-)
+
+diff --git a/hdm-dim2/dim2_hdm.c b/hdm-dim2/dim2_hdm.c
+index 35aee9f..1b164cf 100644
+--- a/hdm-dim2/dim2_hdm.c
++++ b/hdm-dim2/dim2_hdm.c
+@@ -722,6 +722,16 @@ static int poison_channel(struct most_interface *most_iface, int ch_idx)
+ return ret;
+ }
+
++static void *dma_alloc(struct mbo *mbo, u32 size)
++{
++ return dma_alloc_coherent(NULL, size, &mbo->bus_address, GFP_KERNEL);
++}
++
++static void dma_free(struct mbo *mbo, u32 size)
++{
++ dma_free_coherent(NULL, size, mbo->virt_address, mbo->bus_address);
++}
++
+ /*
+ * dim2_probe - dim2 probe handler
+ * @pdev: platform device structure
+@@ -820,6 +830,8 @@ static int dim2_probe(struct platform_device *pdev)
+ dev->most_iface.channel_vector = dev->capabilities;
+ dev->most_iface.configure = configure_channel;
+ dev->most_iface.enqueue = enqueue;
++ dev->most_iface.dma_alloc = dma_alloc;
++ dev->most_iface.dma_free = dma_free;
+ dev->most_iface.poison_channel = poison_channel;
+ dev->most_iface.request_netinfo = request_netinfo;
+
+diff --git a/hdm-usb/hdm_usb.c b/hdm-usb/hdm_usb.c
+index 3433646..0b689b5 100644
+--- a/hdm-usb/hdm_usb.c
++++ b/hdm-usb/hdm_usb.c
+@@ -629,6 +629,22 @@ _error:
+ return retval;
+ }
+
++static void *hdm_dma_alloc(struct mbo *mbo, u32 size)
++{
++ struct most_dev *mdev = to_mdev(mbo->ifp);
++
++ return usb_alloc_coherent(mdev->usb_device, size, GFP_KERNEL,
++ &mbo->bus_address);
++}
++
++static void hdm_dma_free(struct mbo *mbo, u32 size)
++{
++ struct most_dev *mdev = to_mdev(mbo->ifp);
++
++ usb_free_coherent(mdev->usb_device, size, mbo->virt_address,
++ mbo->bus_address);
++}
++
+ /**
+ * hdm_configure_channel - receive channel configuration from core
+ * @iface: interface
+@@ -1140,6 +1156,8 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
+ mdev->iface.request_netinfo = hdm_request_netinfo;
+ mdev->iface.enqueue = hdm_enqueue;
+ mdev->iface.poison_channel = hdm_poison_channel;
++ mdev->iface.dma_alloc = hdm_dma_alloc;
++ mdev->iface.dma_free = hdm_dma_free;
+ mdev->iface.description = mdev->description;
+ mdev->iface.num_channels = num_endpoints;
+
+diff --git a/include/mostcore.h b/include/mostcore.h
+index 5f8339b..deefe25 100644
+--- a/include/mostcore.h
++++ b/include/mostcore.h
+@@ -241,6 +241,8 @@ struct most_interface {
+ const char *description;
+ int num_channels;
+ struct most_channel_capability *channel_vector;
++ void *(*dma_alloc)(struct mbo *mbo, u32 size);
++ void (*dma_free)(struct mbo *mbo, u32 size);
+ int (*configure)(struct most_interface *iface, int channel_idx,
+ struct most_channel_config *channel_config);
+ int (*enqueue)(struct most_interface *iface, int channel_idx,
+diff --git a/mostcore/core.c b/mostcore/core.c
+index 4c580d1..931efb9 100644
+--- a/mostcore/core.c
++++ b/mostcore/core.c
+@@ -184,8 +184,10 @@ static void most_free_mbo_coherent(struct mbo *mbo)
+ struct most_c_obj *c = mbo->context;
+ u16 const coherent_buf_size = c->cfg.buffer_size + c->cfg.extra_len;
+
+- dma_free_coherent(NULL, coherent_buf_size, mbo->virt_address,
+- mbo->bus_address);
++ if (c->iface->dma_free)
++ c->iface->dma_free(mbo, coherent_buf_size);
++ else
++ kfree(mbo->virt_address);
+ kfree(mbo);
+ if (atomic_sub_and_test(1, &c->mbo_ref))
+ complete(&c->cleanup);
+@@ -1289,10 +1291,13 @@ static int arm_mbo_chain(struct most_c_obj *c, int dir,
+ mbo->context = c;
+ mbo->ifp = c->iface;
+ mbo->hdm_channel_id = c->channel_id;
+- mbo->virt_address = dma_alloc_coherent(NULL,
+- coherent_buf_size,
+- &mbo->bus_address,
+- GFP_KERNEL);
++ if (c->iface->dma_alloc) {
++ mbo->virt_address =
++ c->iface->dma_alloc(mbo, coherent_buf_size);
++ } else {
++ mbo->virt_address =
++ kzalloc(coherent_buf_size, GFP_KERNEL);
++ }
+ if (!mbo->virt_address) {
+ pr_info("WARN: No DMA coherent buffer.\n");
+ retval = i;
+--
+2.7.4
+
diff --git a/recipes-kernel/most/files/0002-most-pass-parent-devcie-to-snd_card_new.patch b/recipes-kernel/most/files/0002-most-pass-parent-devcie-to-snd_card_new.patch
new file mode 100644
index 000000000..2e341dd94
--- /dev/null
+++ b/recipes-kernel/most/files/0002-most-pass-parent-devcie-to-snd_card_new.patch
@@ -0,0 +1,52 @@
+From c4a379b4d3058b153832991ba1a1d697cad06600 Mon Sep 17 00:00:00 2001
+From: Christian Gromm <christian.gromm@microchip.com>
+Date: Fri, 1 Sep 2017 13:53:32 +0200
+Subject: [PATCH 2/5] most: pass parent devcie to snd_card_new
+
+Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
+---
+ driver/aim-sound/sound.c | 2 +-
+ driver/hdm-usb/hdm_usb.c | 1 +
+ driver/include/mostcore.h | 1 +
+ 3 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/aim-sound/sound.c b/aim-sound/sound.c
+index e4198e5..a2ccc79 100644
+--- a/aim-sound/sound.c
++++ b/aim-sound/sound.c
+@@ -595,7 +595,7 @@ static int audio_probe_channel(struct most_interface *iface, int channel_id,
+ return ret;
+ }
+
+- ret = snd_card_new(NULL, -1, card_name, THIS_MODULE,
++ ret = snd_card_new(iface->dev, -1, card_name, THIS_MODULE,
+ sizeof(*channel), &card);
+ if (ret < 0)
+ return ret;
+diff --git a/hdm-usb/hdm_usb.c b/hdm-usb/hdm_usb.c
+index 0b689b5..0937496 100644
+--- a/hdm-usb/hdm_usb.c
++++ b/hdm-usb/hdm_usb.c
+@@ -1160,6 +1160,7 @@ hdm_probe(struct usb_interface *interface, const struct usb_device_id *id)
+ mdev->iface.dma_free = hdm_dma_free;
+ mdev->iface.description = mdev->description;
+ mdev->iface.num_channels = num_endpoints;
++ mdev->iface.dev = &interface->dev;
+
+ snprintf(mdev->description, sizeof(mdev->description),
+ "usb_device %d-%s:%d.%d",
+diff --git a/include/mostcore.h b/include/mostcore.h
+index deefe25..d3523a9 100644
+--- a/include/mostcore.h
++++ b/include/mostcore.h
+@@ -237,6 +237,7 @@ struct mbo {
+ */
+ struct most_interface {
+ struct module *mod;
++ struct device *dev;
+ enum most_interface_type interface;
+ const char *description;
+ int num_channels;
+--
+2.7.4
+
diff --git a/recipes-kernel/most/files/0003-core-remove-kernel-log-for-MBO-status.patch b/recipes-kernel/most/files/0003-core-remove-kernel-log-for-MBO-status.patch
new file mode 100644
index 000000000..4703844a1
--- /dev/null
+++ b/recipes-kernel/most/files/0003-core-remove-kernel-log-for-MBO-status.patch
@@ -0,0 +1,26 @@
+From b269994be937cbb31c0d73ecc899ca8a545a6a4a Mon Sep 17 00:00:00 2001
+From: Christian Gromm <christian.gromm@microchip.com>
+Date: Mon, 4 Sep 2017 11:09:17 +0200
+Subject: [PATCH 3/5] core: remove kernel log for MBO status
+
+Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
+---
+ driver/mostcore/core.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/mostcore/core.c b/mostcore/core.c
+index 931efb9..595becc 100644
+--- a/mostcore/core.c
++++ b/mostcore/core.c
+@@ -1348,8 +1348,6 @@ static void most_write_completion(struct mbo *mbo)
+ BUG_ON((!mbo) || (!mbo->context));
+
+ c = mbo->context;
+- if (mbo->status == MBO_E_INVAL)
+- pr_info("WARN: Tx MBO status: invalid\n");
+ if (unlikely(c->is_poisoned || (mbo->status == MBO_E_CLOSE)))
+ trash_mbo(mbo);
+ else
+--
+2.7.4
+
diff --git a/recipes-kernel/most/files/0004-most-video-set-device_caps.patch b/recipes-kernel/most/files/0004-most-video-set-device_caps.patch
new file mode 100644
index 000000000..010d4b0d0
--- /dev/null
+++ b/recipes-kernel/most/files/0004-most-video-set-device_caps.patch
@@ -0,0 +1,25 @@
+From a5fd2ae8d4a3b2a8f7a33a4ea469ea7ee0d946ef Mon Sep 17 00:00:00 2001
+From: Christian Gromm <christian.gromm@microchip.com>
+Date: Mon, 4 Sep 2017 15:36:38 +0200
+Subject: [PATCH 4/5] most: video: set device_caps
+
+Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
+---
+ driver/aim-v4l2/video.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/aim-v4l2/video.c b/aim-v4l2/video.c
+index e074841..6405a03 100644
+--- a/aim-v4l2/video.c
++++ b/aim-v4l2/video.c
+@@ -263,6 +263,7 @@ static int vidioc_querycap(struct file *file, void *priv,
+ snprintf(cap->bus_info, sizeof(cap->bus_info),
+ "%s", mdev->iface->description);
+
++ cap->device_caps =
+ cap->capabilities =
+ V4L2_CAP_READWRITE |
+ V4L2_CAP_TUNER |
+--
+2.7.4
+
diff --git a/recipes-kernel/most/files/0005-most-video-set-V4L2_CAP_DEVICE_CAPS-flag.patch b/recipes-kernel/most/files/0005-most-video-set-V4L2_CAP_DEVICE_CAPS-flag.patch
new file mode 100644
index 000000000..ebaee9e14
--- /dev/null
+++ b/recipes-kernel/most/files/0005-most-video-set-V4L2_CAP_DEVICE_CAPS-flag.patch
@@ -0,0 +1,25 @@
+From 7518453386ad3e82008186a6c9ca86ed8c136801 Mon Sep 17 00:00:00 2001
+From: Christian Gromm <christian.gromm@microchip.com>
+Date: Mon, 4 Sep 2017 16:08:38 +0200
+Subject: [PATCH 5/5] most: video: set V4L2_CAP_DEVICE_CAPS flag
+
+Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
+---
+ driver/aim-v4l2/video.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/aim-v4l2/video.c b/aim-v4l2/video.c
+index 6405a03..db75d4d 100644
+--- a/aim-v4l2/video.c
++++ b/aim-v4l2/video.c
+@@ -265,6 +265,7 @@ static int vidioc_querycap(struct file *file, void *priv,
+
+ cap->device_caps =
+ cap->capabilities =
++ V4L2_CAP_DEVICE_CAPS |
+ V4L2_CAP_READWRITE |
+ V4L2_CAP_TUNER |
+ V4L2_CAP_VIDEO_CAPTURE;
+--
+2.7.4
+
diff --git a/recipes-kernel/most/most.bbappend b/recipes-kernel/most/most.bbappend
new file mode 100644
index 000000000..ed94d34b1
--- /dev/null
+++ b/recipes-kernel/most/most.bbappend
@@ -0,0 +1,10 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI_append = " \
+ file://0001-let-HDMs-do-the-coherent-memory-allocation.patch \
+ file://0005-most-video-set-V4L2_CAP_DEVICE_CAPS-flag.patch \
+ file://0004-most-video-set-device_caps.patch \
+ file://0003-core-remove-kernel-log-for-MBO-status.patch \
+ file://0002-most-pass-parent-devcie-to-snd_card_new.patch \
+ "
+