From: Ulrich Hecht <uli+renesas@fpond.eu>
To: laurent.pinchart@ideasonboard.com
Cc: linux-renesas-soc@vger.kernel.org,
kieran.bingham+renesas@ideasonboard.com,
jacopo+renesas@jmondi.org,
Koji Matsuoka <koji.matsuoka.xm@renesas.com>,
dri-devel@lists.freedesktop.org
Subject: [PROTO][PATCH 06/10] drm: rcar-du: Fix procedure for extal and dotclkin selection
Date: Tue, 14 Aug 2018 15:50:00 +0200 [thread overview]
Message-ID: <1534254604-24204-7-git-send-email-uli+renesas@fpond.eu> (raw)
In-Reply-To: <1534254604-24204-1-git-send-email-uli+renesas@fpond.eu>
From: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
This patch corrects that the extal clock used with the fixed value
is acquired from the device tree.
Also, it is possible to select extal or dotclkin for R8A77995 and
R8A77990. This patch adds its selection procedure.
Signed-off-by: Koji Matsuoka <koji.matsuoka.xm@renesas.com>
---
drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 12 ++++++++++++
drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 2 ++
drivers/gpu/drm/rcar-du/rcar_lvds_regs.h | 4 +---
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
index a903456..4e22d40 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
@@ -942,10 +942,22 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int swindex,
return PTR_ERR(rcrtc->clock);
}
+ sprintf(clk_name, "extal");
+ clk = devm_clk_get(rcdu->dev, clk_name);
+ if (!IS_ERR(clk)) {
+ rcrtc->extclock = clk;
+ rcrtc->extal_use = true;
+ } else if (PTR_ERR(rcrtc->clock) == -EPROBE_DEFER) {
+ dev_info(rcdu->dev, "can't get extal clock %u\n",
+ hwindex);
+ return -EPROBE_DEFER;
+ }
+
sprintf(clk_name, "dclkin.%u", hwindex);
clk = devm_clk_get(rcdu->dev, clk_name);
if (!IS_ERR(clk)) {
rcrtc->extclock = clk;
+ rcrtc->extal_use = false;
} else if (PTR_ERR(rcrtc->clock) == -EPROBE_DEFER) {
dev_info(rcdu->dev, "can't get external clock %u\n", hwindex);
return -EPROBE_DEFER;
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
index 65de551..fa27104 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
+++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
@@ -45,6 +45,7 @@ struct rcar_du_vsp;
* @vsp: VSP feeding video to this CRTC
* @vsp_pipe: index of the VSP pipeline feeding video to this CRTC
* @lvds_ch: index of LVDS
+ * @extal_use: extal clock use
*/
struct rcar_du_crtc {
struct drm_crtc crtc;
@@ -69,6 +70,7 @@ struct rcar_du_crtc {
struct rcar_du_vsp *vsp;
unsigned int vsp_pipe;
int lvds_ch;
+ bool extal_use;
};
#define to_rcar_crtc(c) container_of(c, struct rcar_du_crtc, crtc)
diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds_regs.h b/drivers/gpu/drm/rcar-du/rcar_lvds_regs.h
index e37db95..4899062 100644
--- a/drivers/gpu/drm/rcar-du/rcar_lvds_regs.h
+++ b/drivers/gpu/drm/rcar-du/rcar_lvds_regs.h
@@ -46,15 +46,13 @@
#define LVDPLLCR_PLLDIVCNT_148M (0x046c1 << 0)
#define LVDPLLCR_PLLDIVCNT_MASK (0x7ffff << 0)
-/* R-Car D3 */
#define LVDPLLCR_PLLON (1 << 22)
#define LVDPLLCR_PLLSEL_PLL0 (0 << 20)
#define LVDPLLCR_PLLSEL_LVX (1 << 20)
#define LVDPLLCR_PLLSEL_PLL1 (2 << 20)
#define LVDPLLCR_CKSEL_LVX (1 << 17)
#define LVDPLLCR_CKSEL_EXTAL (3 << 17)
-#define LVDPLLCR_CKSEL_DU_DOTCLKIN0 (5 << 17)
-#define LVDPLLCR_CKSEL_DU_DOTCLKIN1 (7 << 17)
+#define LVDPLLCR_CKSEL_DU_DOTCLKIN(n) ((5 + (n) * 2) << 17)
#define LVDPLLCR_OCKSEL_7 (0 << 16)
#define LVDPLLCR_OCKSEL_NOT_DIVIDED (1 << 16)
#define LVDPLLCR_STP_CLKOUTE1_DIS (0 << 14)
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-08-14 13:50 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-14 13:49 [PROTO][PATCH 00/10] R-Car D3 LVDS/HDMI support (with PLL) Ulrich Hecht
2018-08-14 13:49 ` [PROTO][PATCH 01/10] drm: rcar-du: Add clk_set_rate for external clock device Ulrich Hecht
2018-08-20 10:10 ` Laurent Pinchart
2018-08-14 13:49 ` [PROTO][PATCH 02/10] drm: rcar-du: Add r8a77995 device support Ulrich Hecht
2018-08-20 8:39 ` Laurent Pinchart
2018-08-14 13:49 ` [PROTO][PATCH 03/10] drm: rcar-du: Fix digital RGB routing for R8A77995 Ulrich Hecht
2018-08-20 9:25 ` Laurent Pinchart
2018-08-14 13:49 ` [PROTO][PATCH 04/10] drm: rcar-du: lvds: LVDS PLL support Ulrich Hecht
2018-08-20 10:48 ` Laurent Pinchart
2018-08-14 13:49 ` [PROTO][PATCH 05/10] drm/bridge: adv7511: Add max-clock, min-vrefresh options Ulrich Hecht
2018-08-20 9:28 ` Laurent Pinchart
2018-08-21 8:03 ` Ulrich Hecht
2018-08-21 8:09 ` Laurent Pinchart
2018-08-22 9:13 ` Ulrich Hecht
2018-08-22 14:00 ` Laurent Pinchart
2018-08-14 13:50 ` Ulrich Hecht [this message]
2018-08-20 9:40 ` [PROTO][PATCH 06/10] drm: rcar-du: Fix procedure for extal and dotclkin selection Laurent Pinchart
2018-08-14 13:50 ` [PROTO][PATCH 07/10] arm64: dts: r8a77995-draak: set external clock for DU Ulrich Hecht
2018-08-20 10:51 ` Laurent Pinchart
2018-08-14 13:50 ` [PROTO][PATCH 08/10] drm: rcar-du: lvds: Handle LVDS interface reset Ulrich Hecht
2018-08-14 13:50 ` [PROTO][PATCH 09/10] arm64: dts: renesas: r8a77995: Add LVDS support Ulrich Hecht
2018-08-14 13:50 ` [PROTO][PATCH 10/10] arm64: dts: renesas: r8a77995-draak: add HDMI output Ulrich Hecht
2018-08-20 11:01 ` Laurent Pinchart
2018-08-20 9:50 ` [PROTO][PATCH 00/10] R-Car D3 LVDS/HDMI support (with PLL) Laurent Pinchart
2018-08-21 8:02 ` Ulrich Hecht
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=1534254604-24204-7-git-send-email-uli+renesas@fpond.eu \
--to=uli+renesas@fpond.eu \
--cc=dri-devel@lists.freedesktop.org \
--cc=jacopo+renesas@jmondi.org \
--cc=kieran.bingham+renesas@ideasonboard.com \
--cc=koji.matsuoka.xm@renesas.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-renesas-soc@vger.kernel.org \
/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).