From: Alain Volmat <avolmat@me.com>
To: Alain Volmat <alain.volmat@foss.st.com>,
David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>
Cc: Alain Volmat <avolmat@me.com>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH 03/14] drm/sti: add support for VTG on the stih418 platform
Date: Thu, 27 Jul 2023 21:51:27 +0000 [thread overview]
Message-ID: <20230727215141.53910-4-avolmat@me.com> (raw)
In-Reply-To: <20230727215141.53910-1-avolmat@me.com>
VTG integrated into the STiH418 differ in the number of outputs
available and allocation of each output. Indeed on STiH418, there
are 6 outputs (4 on the STiH407/STiH410) and HDMI is connected to
the 5th output in case of STiH418 while it is on the 1st output
in case of STiH407/STiH410.
A new compatible st,stih418-vtg is added to differentiate that.
Signed-off-by: Alain Volmat <avolmat@me.com>
---
drivers/gpu/drm/sti/sti_vtg.c | 62 +++++++++++++++++++++++++++++------
1 file changed, 52 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/sti/sti_vtg.c b/drivers/gpu/drm/sti/sti_vtg.c
index 5e5f82b6a5d9..b0cab72ea502 100644
--- a/drivers/gpu/drm/sti/sti_vtg.c
+++ b/drivers/gpu/drm/sti/sti_vtg.c
@@ -60,6 +60,18 @@
#define VTG_TOP_V_HD_4 0x012c
#define VTG_BOT_V_HD_4 0x0130
+#define VTG_H_HD_5 0x0140
+#define VTG_TOP_V_VD_5 0x0144
+#define VTG_BOT_V_VD_5 0x0148
+#define VTG_TOP_V_HD_5 0x014c
+#define VTG_BOT_V_HD_5 0x0150
+
+#define VTG_H_HD_6 0x0160
+#define VTG_TOP_V_VD_6 0x0164
+#define VTG_BOT_V_VD_6 0x0168
+#define VTG_TOP_V_HD_6 0x016c
+#define VTG_BOT_V_HD_6 0x0170
+
#define VTG_IRQ_BOTTOM BIT(0)
#define VTG_IRQ_TOP BIT(1)
#define VTG_IRQ_MASK (VTG_IRQ_TOP | VTG_IRQ_BOTTOM)
@@ -92,7 +104,12 @@ struct sti_vtg_regs_offs {
u32 bot_v_hd;
};
-#define VTG_MAX_SYNC_OUTPUT 4
+struct sti_vtg_data {
+ unsigned int nb_sync_output;
+ unsigned int hdmi_sync_id;
+};
+
+#define VTG_MAX_SYNC_OUTPUT 6
static const struct sti_vtg_regs_offs vtg_regs_offs[VTG_MAX_SYNC_OUTPUT] = {
{ VTG_H_HD_1,
VTG_TOP_V_VD_1, VTG_BOT_V_VD_1, VTG_TOP_V_HD_1, VTG_BOT_V_HD_1 },
@@ -101,7 +118,11 @@ static const struct sti_vtg_regs_offs vtg_regs_offs[VTG_MAX_SYNC_OUTPUT] = {
{ VTG_H_HD_3,
VTG_TOP_V_VD_3, VTG_BOT_V_VD_3, VTG_TOP_V_HD_3, VTG_BOT_V_HD_3 },
{ VTG_H_HD_4,
- VTG_TOP_V_VD_4, VTG_BOT_V_VD_4, VTG_TOP_V_HD_4, VTG_BOT_V_HD_4 }
+ VTG_TOP_V_VD_4, VTG_BOT_V_VD_4, VTG_TOP_V_HD_4, VTG_BOT_V_HD_4 },
+ { VTG_H_HD_5,
+ VTG_TOP_V_VD_5, VTG_BOT_V_VD_5, VTG_TOP_V_HD_5, VTG_BOT_V_HD_5 },
+ { VTG_H_HD_6,
+ VTG_TOP_V_VD_6, VTG_BOT_V_VD_6, VTG_TOP_V_HD_6, VTG_BOT_V_HD_6 }
};
/*
@@ -138,6 +159,7 @@ struct sti_vtg {
u32 irq_status;
struct raw_notifier_head notifier_list;
struct drm_crtc *crtc;
+ struct sti_vtg_data data;
};
struct sti_vtg *of_vtg_find(struct device_node *np)
@@ -252,7 +274,7 @@ static void vtg_set_mode(struct sti_vtg *vtg,
vtg_set_output_window(vtg->regs, mode);
/* Set hsync and vsync position for HDMI */
- vtg_set_hsync_vsync_pos(&sync[VTG_SYNC_ID_HDMI - 1], HDMI_DELAY, mode);
+ vtg_set_hsync_vsync_pos(&sync[vtg->data.hdmi_sync_id - 1], HDMI_DELAY, mode);
/* Set hsync and vsync position for HD DCS */
vtg_set_hsync_vsync_pos(&sync[VTG_SYNC_ID_HDDCS - 1], 0, mode);
@@ -264,7 +286,7 @@ static void vtg_set_mode(struct sti_vtg *vtg,
vtg_set_hsync_vsync_pos(&sync[VTG_SYNC_ID_DVO - 1], DVO_DELAY, mode);
/* Progam the syncs outputs */
- for (i = 0; i < VTG_MAX_SYNC_OUTPUT ; i++) {
+ for (i = 0; i < vtg->data.nb_sync_output ; i++) {
writel(sync[i].hsync,
vtg->regs + vtg_regs_offs[i].h_hd);
writel(sync[i].vsync_line_top,
@@ -376,9 +398,27 @@ static irqreturn_t vtg_irq(int irq, void *arg)
return IRQ_WAKE_THREAD;
}
+static const struct sti_vtg_data stih407_vtg_data = {
+ .nb_sync_output = 4,
+ .hdmi_sync_id = 1,
+};
+
+static const struct sti_vtg_data stih418_vtg_data = {
+ .nb_sync_output = 6,
+ .hdmi_sync_id = 5,
+};
+
+static const struct of_device_id vtg_of_match[] = {
+ { .compatible = "st,vtg", .data = &stih407_vtg_data, },
+ { .compatible = "st,stih418-vtg", .data = &stih418_vtg_data, },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, vtg_of_match);
+
static int vtg_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
+ struct device_node *np = dev->of_node;
struct sti_vtg *vtg;
struct resource *res;
int ret;
@@ -387,6 +427,14 @@ static int vtg_probe(struct platform_device *pdev)
if (!vtg)
return -ENOMEM;
+ memcpy(&vtg->data, of_match_node(vtg_of_match, np)->data,
+ sizeof(struct sti_vtg_data));
+
+ if (vtg->data.nb_sync_output > VTG_MAX_SYNC_OUTPUT) {
+ dev_err(dev, "Invalid number of VTG sync output\n");
+ return -EINVAL;
+ }
+
/* Get Memory ressources */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
@@ -422,12 +470,6 @@ static int vtg_probe(struct platform_device *pdev)
return 0;
}
-static const struct of_device_id vtg_of_match[] = {
- { .compatible = "st,vtg", },
- { /* sentinel */ }
-};
-MODULE_DEVICE_TABLE(of, vtg_of_match);
-
struct platform_driver sti_vtg_driver = {
.driver = {
.name = "sti-vtg",
--
2.34.1
next prev parent reply other threads:[~2023-07-27 21:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-27 21:51 [PATCH 00/14] drm/sti: add display support on stih418 family Alain Volmat
2023-07-27 21:51 ` [PATCH 01/14] drm/sti: add hdmi tx6g0c28 phy for STi platform Alain Volmat
2023-07-27 21:51 ` [PATCH 02/14] dt-bindings: display: add st,stih418-vtg compatible for sti vtg Alain Volmat
2023-07-28 7:22 ` Krzysztof Kozlowski
2023-07-27 21:51 ` Alain Volmat [this message]
2023-07-27 21:51 ` [PATCH 04/14] drm/sti: add STih418 platform support in sti mixer Alain Volmat
2023-07-27 21:51 ` [PATCH 05/14] drm/sti: add support for stih418 in tvout Alain Volmat
2023-07-27 21:51 ` [PATCH 06/14] drm/sti: remove VTG_SYNC_ID_HDMI from sti_vtg.h Alain Volmat
2023-07-27 21:51 ` [PATCH 07/14] drm/sti: add more possible GDP / VID planes entries in sti_plane Alain Volmat
2023-07-27 21:51 ` [PATCH 08/14] drm/sti: add more planes supports in sti_mixer Alain Volmat
2023-07-27 21:51 ` [PATCH 09/14] drm/sti: add support for GDPPLUS / stih418 GDPs Alain Volmat
2023-07-27 21:51 ` [PATCH 10/14] drm/sti: add compositor support for stih418 platform Alain Volmat
2023-07-27 21:51 ` [PATCH 11/14] ARM: dts: sti: move vtg_main / vtg_aux into stih407/stih410 dtsi Alain Volmat
2023-07-27 21:51 ` [PATCH 12/14] ARM: dts: sti: addition of display nodes for stih418 platform Alain Volmat
2023-07-28 7:24 ` Krzysztof Kozlowski
2023-07-27 21:51 ` [PATCH 13/14] ARM: dts: sti: add the gpu node for the MALI-400 on stih418.dtsi Alain Volmat
2023-07-27 21:51 ` [PATCH 14/14] ARM: dts: sti: enable basic display on stih418-b2264 board Alain Volmat
2023-07-28 7:24 ` 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=20230727215141.53910-4-avolmat@me.com \
--to=avolmat@me.com \
--cc=airlied@gmail.com \
--cc=alain.volmat@foss.st.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®