devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrzej Hajda <a.hajda@samsung.com>
To: Inki Dae <inki.dae@samsung.com>
Cc: devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	dri-devel@lists.freedesktop.org,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>
Subject: [PATCH v2 05/10] drm/exynos/mic: use mode info stored in CRTC to detect i80 mode
Date: Thu, 24 Aug 2017 15:33:54 +0200	[thread overview]
Message-ID: <1503581639-580-6-git-send-email-a.hajda@samsung.com> (raw)
In-Reply-To: <1503581639-580-1-git-send-email-a.hajda@samsung.com>

MIC driver should use info from CRTC to check mode of work instead of
illegally peeking into nodes of other devices.

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
---
 drivers/gpu/drm/exynos/exynos_drm_mic.c | 44 +++------------------------------
 1 file changed, 4 insertions(+), 40 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c b/drivers/gpu/drm/exynos/exynos_drm_mic.c
index 16bbee8..128ce176 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_mic.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c
@@ -21,9 +21,12 @@
 #include <linux/component.h>
 #include <linux/pm_runtime.h>
 #include <drm/drmP.h>
+#include <drm/drm_encoder.h>
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
 
+#include <exynos_drm_drv.h>
+
 /* Sysreg registers for MIC */
 #define DSD_CFG_MUX	0x1004
 #define MIC0_RGB_MUX	(1 << 0)
@@ -85,12 +88,6 @@
 
 #define MIC_BS_SIZE_2D(x)	((x) & 0x3fff)
 
-enum {
-	ENDPOINT_DECON_NODE,
-	ENDPOINT_DSI_NODE,
-	NUM_ENDPOINTS
-};
-
 static char *clk_names[] = { "pclk_mic0", "sclk_rgb_vclk_to_mic0" };
 #define NUM_CLKS		ARRAY_SIZE(clk_names)
 static DEFINE_MUTEX(mic_mutex);
@@ -229,36 +226,6 @@ static void mic_set_reg_on(struct exynos_mic *mic, bool enable)
 	writel(reg, mic->reg + MIC_OP);
 }
 
-static int parse_dt(struct exynos_mic *mic)
-{
-	int ret = 0, i, j;
-	struct device_node *remote_node;
-	struct device_node *nodes[3];
-
-	/*
-	 * The order of endpoints does matter.
-	 * The first node must be for decon and the second one must be for dsi.
-	 */
-	for (i = 0, j = 0; i < NUM_ENDPOINTS; i++) {
-		remote_node = of_graph_get_remote_node(mic->dev->of_node, i, 0);
-		if (!remote_node) {
-			ret = -EPIPE;
-			goto exit;
-		}
-		nodes[j++] = remote_node;
-
-		if (i == ENDPOINT_DECON_NODE &&
-			of_get_child_by_name(remote_node, "i80-if-timings"))
-			mic->i80_mode = 1;
-	}
-
-exit:
-	while (--j > -1)
-		of_node_put(nodes[j]);
-
-	return ret;
-}
-
 static void mic_disable(struct drm_bridge *bridge) { }
 
 static void mic_post_disable(struct drm_bridge *bridge)
@@ -286,6 +253,7 @@ static void mic_mode_set(struct drm_bridge *bridge,
 
 	mutex_lock(&mic_mutex);
 	drm_display_mode_to_videomode(mode, &mic->vm);
+	mic->i80_mode = to_exynos_crtc(bridge->encoder->crtc)->i80_mode;
 	mutex_unlock(&mic_mutex);
 }
 
@@ -417,10 +385,6 @@ static int exynos_mic_probe(struct platform_device *pdev)
 
 	mic->dev = dev;
 
-	ret = parse_dt(mic);
-	if (ret)
-		goto err;
-
 	ret = of_address_to_resource(dev->of_node, 0, &res);
 	if (ret) {
 		DRM_ERROR("mic: Failed to get mem region for MIC\n");
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-08-24 13:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170824133408eucas1p2466a3b4aac528667cd06df9c00aca1df@eucas1p2.samsung.com>
2017-08-24 13:33 ` [PATCH v2 00/10] drm/exynos: panel mode info propagation Andrzej Hajda
     [not found]   ` <CGME20170824133408eucas1p1e7b9988ac74fdd3e8dd8d25ead949ec5@eucas1p1.samsung.com>
     [not found]     ` <1503581639-580-1-git-send-email-a.hajda-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-08-24 13:33       ` [PATCH v2 01/10] drm/exynos/decon5433: use readl_poll_timeout helpers Andrzej Hajda
2017-08-24 13:54         ` Tobias Jakobi
2017-08-24 16:18           ` Andrzej Hajda
2017-08-25 11:25           ` Tobias Jakobi
2017-08-24 13:33       ` [PATCH v2 03/10] drm/exynos/dsi: refactor panel detection logic Andrzej Hajda
2017-08-25  1:46         ` Inki Dae
2017-08-24 13:33       ` [PATCH v2 07/10] drm/exynos: add mode_valid callback to exynos_drm Andrzej Hajda
2017-08-24 13:33       ` [PATCH v2 09/10] dt-bindings: exynos5433-decon: remove i80-if-timings property Andrzej Hajda
2017-08-31 18:40         ` Rob Herring
     [not found]   ` <CGME20170824133409eucas1p11409c10ac302f9cb56106888ab7d5a25@eucas1p1.samsung.com>
2017-08-24 13:33     ` [PATCH v2 02/10] drm/exynos: use helper to set possible crtcs Andrzej Hajda
2017-08-25  2:42       ` Inki Dae
     [not found]   ` <CGME20170824133409eucas1p2f3d79b5a88ef186562abf071f06bfc44@eucas1p2.samsung.com>
2017-08-24 13:33     ` [PATCH v2 04/10] drm/exynos/dsi: propagate info about command mode from panel Andrzej Hajda
     [not found]   ` <CGME20170824133410eucas1p1bc901ed868b664922cda5fecc920dd0e@eucas1p1.samsung.com>
2017-08-24 13:33     ` Andrzej Hajda [this message]
2017-08-25  2:55       ` [PATCH v2 05/10] drm/exynos/mic: use mode info stored in CRTC to detect i80 mode Inki Dae
     [not found]   ` <CGME20170824133410eucas1p1959faf82a55f5aed609a23027777389a@eucas1p1.samsung.com>
2017-08-24 13:33     ` [PATCH v2 06/10] drm/exynos/decon5433: refactor irq requesting code Andrzej Hajda
     [not found]   ` <CGME20170824133411eucas1p1601aabfcb12d8ae39f5b6400d16da99e@eucas1p1.samsung.com>
2017-08-24 13:33     ` [PATCH v2 08/10] drm/exynos/decon5433: use mode info stored in CRTC to detect i80 mode Andrzej Hajda
2017-08-25  2:15       ` Inki Dae
     [not found]   ` <CGME20170824133412eucas1p23233d7bed8b83d86b26de01bc1ecf2a1@eucas1p2.samsung.com>
2017-08-24 13:33     ` [PATCH v2 10/10] arm64: dts: exynos: remove i80-if-timings nodes Andrzej Hajda
2017-09-08 16:47       ` Krzysztof Kozlowski
2017-11-28 11:56         ` Krzysztof Kozlowski

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=1503581639-580-6-git-send-email-a.hajda@samsung.com \
    --to=a.hajda@samsung.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=inki.dae@samsung.com \
    --cc=krzk@kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).