All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
	Inki Dae <inki.dae@samsung.com>,
	Seung-Woo Kim <sw0312.kim@samsung.com>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Tobias Jakobi <tjakobi@math.uni-bielefeld.de>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Andrzej Pietrasiewicz <andrzej.p@samsung.com>,
	Hoegeun Kwon <hoegeun.kwon@samsung.com>
Subject: [PATCH v4 5/9] drm/exynos: Add generic support for devices shared with V4L2 subsystem
Date: Mon, 23 Oct 2017 09:54:24 +0200	[thread overview]
Message-ID: <20171023075428.7003-6-m.szyprowski@samsung.com> (raw)
In-Reply-To: <20171023075428.7003-1-m.szyprowski@samsung.com>

Some hardware modules, like FIMC in Exynos4 series are shared between
V4L2 (camera support) and DRM (memory-to-memory processing) subsystems.
This patch provides a simple check to let such drivers to be used in the
driver components framework.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_drv.c | 17 ++++++++++++++++-
 drivers/gpu/drm/exynos/exynos_drm_drv.h |  2 ++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index cac0d84385d3..60ae6ae06eb2 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -216,6 +216,7 @@ struct exynos_drm_driver_info {
 #define DRM_COMPONENT_DRIVER	BIT(0)	/* supports component framework */
 #define DRM_VIRTUAL_DEVICE	BIT(1)	/* create virtual platform device */
 #define DRM_DMA_DEVICE		BIT(2)	/* can be used for dma allocations */
+#define DRM_SHARED_DEVICE	BIT(3)	/* devices shared with V4L2 subsystem */
 
 #define DRV_PTR(drv, cond) (IS_ENABLED(cond) ? &drv : NULL)
 
@@ -267,6 +268,17 @@ static struct exynos_drm_driver_info exynos_drm_drivers[] = {
 	}
 };
 
+int exynos_drm_check_shared_device(struct device *dev)
+{
+	/*
+	 * Exynos DRM drivers handle only devices that support
+	 * the LCD Writeback data path, rest is handled by V4L2 driver
+	 */
+	if (!of_property_read_bool(dev->of_node, "samsung,lcd-wb"))
+		return -ENODEV;
+	return 0;
+}
+
 static int compare_dev(struct device *dev, void *data)
 {
 	return dev == (struct device *)data;
@@ -288,7 +300,10 @@ static struct component_match *exynos_drm_match_add(struct device *dev)
 					    &info->driver->driver,
 					    (void *)platform_bus_type.match))) {
 			put_device(p);
-			component_match_add(dev, &match, compare_dev, d);
+
+			if (!(info->flags & DRM_SHARED_DEVICE) ||
+			    exynos_drm_check_shared_device(d) == 0)
+				component_match_add(dev, &match, compare_dev, d);
 			p = d;
 		}
 		put_device(p);
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h
index b47f810d64d2..8b3b31d35168 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.h
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h
@@ -275,6 +275,8 @@ static inline int exynos_dpi_bind(struct drm_device *dev,
 }
 #endif
 
+int exynos_drm_check_shared_device(struct device *dev);
+
 int exynos_atomic_commit(struct drm_device *dev, struct drm_atomic_state *state,
 			 bool nonblock);
 int exynos_atomic_check(struct drm_device *dev, struct drm_atomic_state *state);
-- 
2.14.2

  parent reply	other threads:[~2017-10-23  7:54 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20171023075448eucas1p25e25bb36d36139e3917211ab8ac999ec@eucas1p2.samsung.com>
2017-10-23  7:54 ` [PATCH v4 0/9] Exynos DRM: rewrite IPP subsystem and userspace API Marek Szyprowski
     [not found]   ` <CGME20171023075448eucas1p10255809be25caa7e44a3889f26561bc8@eucas1p1.samsung.com>
2017-10-23  7:54     ` [PATCH v4 1/9] drm/exynos: ipp: Remove Exynos DRM IPP subsystem Marek Szyprowski
     [not found]   ` <CGME20171023075449eucas1p18211ed64e964860d201aaeb53a87a8be@eucas1p1.samsung.com>
2017-10-23  7:54     ` [PATCH v4 2/9] drm/exynos: ipp: Add IPP v2 framework Marek Szyprowski
2017-11-01  1:13       ` Inki Dae
2017-11-03 11:20         ` Marek Szyprowski
2017-11-01  3:47       ` Dave Airlie
2017-11-01 14:18         ` Tobias Jakobi
     [not found]   ` <CGME20171023075449eucas1p14adcde4cea94ca82a13a822ee59d9446@eucas1p1.samsung.com>
2017-10-23  7:54     ` [PATCH v4 3/9] drm/exynos: rotator: Convert driver to IPP v2 core API Marek Szyprowski
2017-11-01  5:40       ` Inki Dae
     [not found]   ` <CGME20171023075450eucas1p155afda476e368ae57ba7fe1a347a5f4c@eucas1p1.samsung.com>
2017-10-23  7:54     ` [PATCH v4 4/9] drm/exynos: gsc: " Marek Szyprowski
2017-11-01  6:02       ` Inki Dae
     [not found]   ` <CGME20171023075450eucas1p24923c2a0793ac24364b97770dadd56e0@eucas1p2.samsung.com>
2017-10-23  7:54     ` Marek Szyprowski [this message]
2017-11-01  6:26       ` [PATCH v4 5/9] drm/exynos: Add generic support for devices shared with V4L2 subsystem Inki Dae
2017-11-03 12:28         ` Marek Szyprowski
2017-11-06  1:20           ` Inki Dae
2017-11-07  9:07             ` Marek Szyprowski
     [not found]   ` <CGME20171023075451eucas1p1a833d9c805f6b7dc1b984e59afce23f3@eucas1p1.samsung.com>
2017-10-23  7:54     ` [PATCH v4 6/9] drm/exynos: fimc: Convert driver to IPP v2 core API Marek Szyprowski
     [not found]   ` <CGME20171023075452eucas1p1dada05e443a800977d9c888744877f38@eucas1p1.samsung.com>
2017-10-23  7:54     ` [PATCH v4 7/9] drm/exynos: Add driver for Exynos Scaler module Marek Szyprowski
     [not found]   ` <CGME20171023075452eucas1p2881393094c507e4409005a498658f28d@eucas1p2.samsung.com>
2017-10-23  7:54     ` [PATCH v4 8/9] ARM: dts: exynos: Add mem-2-mem Scaler devices Marek Szyprowski
     [not found]   ` <CGME20171023075453eucas1p18c5a22b967399885c14bff39b1e218f2@eucas1p1.samsung.com>
2017-10-23  7:54     ` [PATCH v4 9/9] ARM64: " Marek Szyprowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171023075428.7003-6-m.szyprowski@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=a.hajda@samsung.com \
    --cc=andrzej.p@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hoegeun.kwon@samsung.com \
    --cc=inki.dae@samsung.com \
    --cc=krzk@kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sw0312.kim@samsung.com \
    --cc=tjakobi@math.uni-bielefeld.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.