[Openchrome-devel] drm-openchrome: Branch 'drm-next-4.13' - 14 commits - drivers/gpu/drm
Kevin Brace
kevinbrace at kemper.freedesktop.org
Fri Oct 27 20:03:52 UTC 2017
drivers/gpu/drm/openchrome/crtc_hw.h | 4
drivers/gpu/drm/openchrome/via_display.c | 20 -
drivers/gpu/drm/openchrome/via_display.h | 42 ++--
drivers/gpu/drm/openchrome/via_drv.c | 90 +++++++-
drivers/gpu/drm/openchrome/via_drv.h | 13 +
drivers/gpu/drm/openchrome/via_tmds.c | 319 ++++++++++++++++++++++++++-----
6 files changed, 397 insertions(+), 91 deletions(-)
New commits:
commit e1d559e17ce4a9eef2c6ff9db62d9de6c5943871
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Fri Oct 27 13:00:40 2017 -0700
Version bumped to 3.0.50
This version adds initial support for DVI provided by CX700 / VX700
and VX800 chipsets' integrated TMDS transmitter. Standby resume was
tested with the DVI, and it is working.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/via_drv.h b/drivers/gpu/drm/openchrome/via_drv.h
index c516a4848cc4..a29409192937 100644
--- a/drivers/gpu/drm/openchrome/via_drv.h
+++ b/drivers/gpu/drm/openchrome/via_drv.h
@@ -30,11 +30,11 @@
#define DRIVER_AUTHOR "OpenChrome Project"
#define DRIVER_NAME "openchrome"
#define DRIVER_DESC "OpenChrome DRM for VIA Technologies Chrome IGP"
-#define DRIVER_DATE "20171008"
+#define DRIVER_DATE "20171027"
#define DRIVER_MAJOR 3
#define DRIVER_MINOR 0
-#define DRIVER_PATCHLEVEL 49
+#define DRIVER_PATCHLEVEL 50
#include <linux/module.h>
commit 569ccbf6dace42eeb1f2ce9a4ee76b4e235dc0b0
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Fri Oct 27 12:54:00 2017 -0700
Add via_tmds_disable
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/via_tmds.c b/drivers/gpu/drm/openchrome/via_tmds.c
index 90ebf79b8c04..06f8a2effade 100644
--- a/drivers/gpu/drm/openchrome/via_tmds.c
+++ b/drivers/gpu/drm/openchrome/via_tmds.c
@@ -279,6 +279,20 @@ via_tmds_mode_set(struct drm_encoder *encoder,
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
+static void via_tmds_disable(struct drm_encoder *encoder)
+{
+ struct via_encoder *enc = container_of(encoder,
+ struct via_encoder, base);
+ struct via_device *dev_priv = encoder->dev->dev_private;
+
+ DRM_DEBUG_KMS("Entered %s.", __func__);
+
+ via_tmds_power(dev_priv, false);
+ via_tmds_io_pad_setting(dev_priv, enc->di_port, false);
+
+ DRM_DEBUG_KMS("Exiting %s.\n", __func__);
+}
+
static const struct drm_encoder_helper_funcs
via_tmds_enc_helper_funcs = {
.dpms = via_tmds_dpms,
@@ -286,7 +300,7 @@ static const struct drm_encoder_helper_funcs
.prepare = via_tmds_prepare,
.commit = via_tmds_commit,
.mode_set = via_tmds_mode_set,
- .disable = via_encoder_disable,
+ .disable = via_tmds_disable,
};
static enum drm_connector_status
commit 80b89f50d42df54a7644144250f0b1c7d6039d38
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Fri Oct 27 12:48:55 2017 -0700
Add via_tmds_commit
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/via_tmds.c b/drivers/gpu/drm/openchrome/via_tmds.c
index eef31a794d0c..90ebf79b8c04 100644
--- a/drivers/gpu/drm/openchrome/via_tmds.c
+++ b/drivers/gpu/drm/openchrome/via_tmds.c
@@ -244,6 +244,20 @@ static void via_tmds_prepare(struct drm_encoder *encoder)
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
+static void via_tmds_commit(struct drm_encoder *encoder)
+{
+ struct via_encoder *enc = container_of(encoder,
+ struct via_encoder, base);
+ struct via_device *dev_priv = encoder->dev->dev_private;
+
+ DRM_DEBUG_KMS("Entered %s.", __func__);
+
+ via_tmds_power(dev_priv, true);
+ via_tmds_io_pad_setting(dev_priv, enc->di_port, true);
+
+ DRM_DEBUG_KMS("Exiting %s.\n", __func__);
+}
+
/*
* Handle CX700 / VX700 and VX800 integrated TMDS (DVI) mode setting.
*/
@@ -270,8 +284,8 @@ static const struct drm_encoder_helper_funcs
.dpms = via_tmds_dpms,
.mode_fixup = via_tmds_mode_fixup,
.prepare = via_tmds_prepare,
+ .commit = via_tmds_commit,
.mode_set = via_tmds_mode_set,
- .commit = via_encoder_commit,
.disable = via_encoder_disable,
};
commit c015d8e570356c84c2634485bcc9d83ecab82939
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Fri Oct 27 12:47:25 2017 -0700
Add via_tmds_prepare
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/via_tmds.c b/drivers/gpu/drm/openchrome/via_tmds.c
index ccd8e4f30188..eef31a794d0c 100644
--- a/drivers/gpu/drm/openchrome/via_tmds.c
+++ b/drivers/gpu/drm/openchrome/via_tmds.c
@@ -230,6 +230,20 @@ via_tmds_mode_fixup(struct drm_encoder *encoder,
return true;
}
+static void via_tmds_prepare(struct drm_encoder *encoder)
+{
+ struct via_encoder *enc = container_of(encoder,
+ struct via_encoder, base);
+ struct via_device *dev_priv = encoder->dev->dev_private;
+
+ DRM_DEBUG_KMS("Entered %s.", __func__);
+
+ via_tmds_power(dev_priv, false);
+ via_tmds_io_pad_setting(dev_priv, enc->di_port, false);
+
+ DRM_DEBUG_KMS("Exiting %s.\n", __func__);
+}
+
/*
* Handle CX700 / VX700 and VX800 integrated TMDS (DVI) mode setting.
*/
@@ -251,11 +265,12 @@ via_tmds_mode_set(struct drm_encoder *encoder,
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
-static const struct drm_encoder_helper_funcs via_tmds_enc_helper_funcs = {
+static const struct drm_encoder_helper_funcs
+ via_tmds_enc_helper_funcs = {
.dpms = via_tmds_dpms,
.mode_fixup = via_tmds_mode_fixup,
+ .prepare = via_tmds_prepare,
.mode_set = via_tmds_mode_set,
- .prepare = via_encoder_prepare,
.commit = via_encoder_commit,
.disable = via_encoder_disable,
};
commit 38bcf47e8bc8938dc2e544fb0dade0522b1d5b8d
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Fri Oct 27 12:46:23 2017 -0700
Update via_tmds_dpms
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/via_tmds.c b/drivers/gpu/drm/openchrome/via_tmds.c
index e947b519069b..ccd8e4f30188 100644
--- a/drivers/gpu/drm/openchrome/via_tmds.c
+++ b/drivers/gpu/drm/openchrome/via_tmds.c
@@ -190,29 +190,31 @@ static const struct drm_encoder_funcs via_tmds_enc_funcs = {
.destroy = via_encoder_cleanup,
};
-/* Manage the power state of the DAC */
-static void
-via_tmds_dpms(struct drm_encoder *encoder, int mode)
+static void via_tmds_dpms(struct drm_encoder *encoder, int mode)
{
+ struct via_encoder *enc = container_of(encoder,
+ struct via_encoder, base);
struct via_device *dev_priv = encoder->dev->dev_private;
- DRM_DEBUG("Entered via_tmds_dpms.\n");
+ DRM_DEBUG_KMS("Entered %s.\n", __func__);
switch (mode) {
- case DRM_MODE_DPMS_SUSPEND:
+ case DRM_MODE_DPMS_ON:
+ via_tmds_power(dev_priv, true);
+ via_tmds_io_pad_setting(dev_priv, enc->di_port, true);
+ break;
case DRM_MODE_DPMS_STANDBY:
+ case DRM_MODE_DPMS_SUSPEND:
case DRM_MODE_DPMS_OFF:
via_tmds_power(dev_priv, false);
- break;
- case DRM_MODE_DPMS_ON:
- via_tmds_power(dev_priv, true);
+ via_tmds_io_pad_setting(dev_priv, enc->di_port, false);
break;
default:
- DRM_ERROR("Bad DPMS mode.");
- break;
+ DRM_ERROR("Bad DPMS mode.");
+ break;
}
- DRM_DEBUG("Exiting via_tmds_dpms.\n");
+ DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
/* Pass our mode to the connectors and the CRTC to give them a chance to
commit 1af432fcc3d2dd8f0493b94cb1571c40341d70da
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Fri Oct 27 12:43:20 2017 -0700
Update via_tmds_init
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/via_display.c b/drivers/gpu/drm/openchrome/via_display.c
index 6eff9b0a1e1c..cb25d3de1e8f 100644
--- a/drivers/gpu/drm/openchrome/via_display.c
+++ b/drivers/gpu/drm/openchrome/via_display.c
@@ -514,22 +514,13 @@ via_modeset_init(struct drm_device *dev)
via_fp_probe(dev);
+ via_tmds_init(dev);
+
via_analog_init(dev);
via_lvds_init(dev);
switch (dev->pdev->device) {
- /* Only CX700 / VX700 and VX800 have an integrated TMDS (DVI)
- * transmitter. */
- case PCI_DEVICE_ID_VIA_VT3157:
- case PCI_DEVICE_ID_VIA_VT1122:
- via_tmds_init(dev);
- break;
- default:
- break;
- }
-
- switch (dev->pdev->device) {
case PCI_DEVICE_ID_VIA_VX900_VGA:
via_hdmi_init(dev, VIA_DI_PORT_NONE);
break;
diff --git a/drivers/gpu/drm/openchrome/via_display.h b/drivers/gpu/drm/openchrome/via_display.h
index d0b076c05eae..642907a83a36 100644
--- a/drivers/gpu/drm/openchrome/via_display.h
+++ b/drivers/gpu/drm/openchrome/via_display.h
@@ -188,6 +188,6 @@ extern void via_fp_probe(struct drm_device *dev);
extern void via_hdmi_init(struct drm_device *dev, u32 di_port);
extern void via_analog_init(struct drm_device *dev);
extern void via_lvds_init(struct drm_device *dev);
-extern int via_tmds_init(struct drm_device *dev);
+extern void via_tmds_init(struct drm_device *dev);
#endif
diff --git a/drivers/gpu/drm/openchrome/via_tmds.c b/drivers/gpu/drm/openchrome/via_tmds.c
index 90f8718dbe21..e947b519069b 100644
--- a/drivers/gpu/drm/openchrome/via_tmds.c
+++ b/drivers/gpu/drm/openchrome/via_tmds.c
@@ -373,35 +373,41 @@ void via_tmds_probe(struct drm_device *dev)
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
-int
-via_tmds_init(struct drm_device *dev)
+void via_tmds_init(struct drm_device *dev)
{
struct via_device *dev_priv = dev->dev_private;
struct via_connector *con;
struct via_encoder *enc;
int i2c_port = 0x31;
- if (!(vga_rseq(VGABASE, 0x3E) & BIT(5))) {
- DRM_INFO("Internal DVI not detected\n");
- return 1;
+ DRM_DEBUG_KMS("Entered %s.\n", __func__);
+
+ if (!dev_priv->int_tmds_presence) {
+ goto exit;
}
enc = kzalloc(sizeof(*enc) + 2 * sizeof(*con), GFP_KERNEL);
if (!enc) {
- DRM_ERROR("Failed to allocate connector and encoder\n");
- return -ENOMEM;
+ DRM_ERROR("Failed to allocate connector "
+ "and encoder.\n");
+ goto exit;
}
/* Setup the encoders and attach them */
drm_encoder_init(dev, &enc->base, &via_tmds_enc_funcs,
- DRM_MODE_ENCODER_DAC, NULL);
+ DRM_MODE_ENCODER_TMDS, NULL);
drm_encoder_helper_add(&enc->base, &via_tmds_enc_helper_funcs);
enc->base.possible_crtcs = BIT(1) | BIT(0);
enc->base.possible_clones = 0;
- enc->di_port = VIA_DI_PORT_DFPL;
- /* Piece together our DVI-D connector */
+ enc->di_port = dev_priv->int_tmds_di_port;
+
+ /* Increment the number of DVI connectors. */
+ dev_priv->number_dvi++;
+
+
+ /* Piece together our DVI-D connector. */
con = &enc->cons[0];
drm_connector_init(dev, &con->base, &via_dvi_connector_funcs,
DRM_MODE_CONNECTOR_DVID);
@@ -415,17 +421,19 @@ via_tmds_init(struct drm_device *dev)
drm_mode_connector_attach_encoder(&con->base, &enc->base);
- /* Now handle the DVI-A case */
+ /* Now handle the DVI-A case. */
con = &enc->cons[1];
drm_connector_init(dev, &con->base, &via_dvi_connector_funcs,
DRM_MODE_CONNECTOR_DVIA);
drm_connector_helper_add(&con->base, &via_dvi_connector_helper_funcs);
drm_connector_register(&con->base);
+
con->ddc_bus = via_find_ddc_bus(i2c_port);
con->base.doublescan_allowed = false;
con->base.interlace_allowed = true;
INIT_LIST_HEAD(&con->props);
drm_mode_connector_attach_encoder(&con->base, &enc->base);
- return 0;
+exit:
+ DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
commit 7036601358f7c54c4fb91d727a256c65866f91ea
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Fri Oct 27 12:06:56 2017 -0700
Update via_tmds_mode_set
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/via_tmds.c b/drivers/gpu/drm/openchrome/via_tmds.c
index 869c4308eb59..90f8718dbe21 100644
--- a/drivers/gpu/drm/openchrome/via_tmds.c
+++ b/drivers/gpu/drm/openchrome/via_tmds.c
@@ -237,14 +237,16 @@ via_tmds_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *adjusted_mode)
{
struct via_device *dev_priv = encoder->dev->dev_private;
- struct via_crtc *iga = container_of(encoder->crtc, struct via_crtc, base);
+ struct via_crtc *iga = container_of(encoder->crtc,
+ struct via_crtc, base);
- DRM_DEBUG_KMS("Entered via_tmds_mode_set.\n");
+ DRM_DEBUG_KMS("Entered %s.", __func__);
+ via_tmds_init_reg(dev_priv);
via_tmds_sync_polarity(dev_priv, adjusted_mode->flags);
via_tmds_display_source(dev_priv, iga->index);
- DRM_DEBUG_KMS("Exiting via_tmds_mode_set.\n");
+ DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
static const struct drm_encoder_helper_funcs via_tmds_enc_helper_funcs = {
commit eafd865a01c008c9fe5b0e30da1f9fafb1416068
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Fri Oct 27 12:03:59 2017 -0700
Add via_tmds_init_reg
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/via_tmds.c b/drivers/gpu/drm/openchrome/via_tmds.c
index 430d71ae0fdd..869c4308eb59 100644
--- a/drivers/gpu/drm/openchrome/via_tmds.c
+++ b/drivers/gpu/drm/openchrome/via_tmds.c
@@ -69,6 +69,77 @@ static void via_tmds_io_pad_setting(struct via_device *dev_priv,
}
/*
+ * Initializes most registers related to VIA Technologies IGP
+ * integrated TMDS transmitter. Synchronization polarity and
+ * display output source need to be set separately.
+ */
+static void via_tmds_init_reg(struct via_device *dev_priv)
+{
+ DRM_DEBUG_KMS("Entered %s.\n", __func__);
+
+ /* Turn off hardware controlled FP power on / off circuit. */
+ via_fp_set_primary_hard_power(VGABASE, false);
+
+ /* Use software FP power sequence control. */
+ via_fp_set_primary_power_seq_type(VGABASE, false);
+
+ /* Turn off software controlled primary FP power rails. */
+ via_fp_set_primary_soft_vdd(VGABASE, false);
+ via_fp_set_primary_soft_vee(VGABASE, false);
+
+ /* Turn off software controlled primary FP back light
+ * control. */
+ via_fp_set_primary_soft_back_light(VGABASE, false);
+
+ /* Turn off direct control of FP back light. */
+ via_fp_set_primary_direct_back_light_ctrl(VGABASE, false);
+
+ /* Activate DVI + LVDS2 mode. */
+ /* 3X5.D2[5:4] - Display Channel Select
+ * 00: LVDS1 + LVDS2
+ * 01: DVI + LVDS2
+ * 10: One Dual LVDS Channel (High Resolution Pannel)
+ * 11: Single Channel DVI */
+ svga_wcrt_mask(VGABASE, 0xd2, 0x10, 0x30);
+
+ /* Various DVI PLL settings should be set to default settings. */
+ /* 3X5.D1[7] - PLL2 Reference Clock Edge Select Bit
+ * 0: PLLCK lock to rising edge of reference clock
+ * 1: PLLCK lock to falling edge of reference clock
+ * 3X5.D1[6:5] - PLL2 Charge Pump Current Set Bits
+ * 00: ICH = 12.5 uA
+ * 01: ICH = 25.0 uA
+ * 10: ICH = 37.5 uA
+ * 11: ICH = 50.0 uA
+ * 3X5.D1[4:1] - Reserved
+ * 3X5.D1[0] - PLL2 Control Voltage Measurement Enable Bit */
+ svga_wcrt_mask(VGABASE, 0xd1, 0x00, 0xe1);
+
+ /* Disable DVI test mode. */
+ /* 3X5.D5[7] - PD1 Enable Selection
+ * 1: Select by power flag
+ * 0: By register
+ * 3X5.D5[5] - DVI Testing Mode Enable
+ * 3X5.D5[4] - DVI Testing Format Selection
+ * 0: Half cycle
+ * 1: LFSR mode */
+ svga_wcrt_mask(VGABASE, 0xd5, 0x00, 0xb0);
+
+ /* Disable DVI sense interrupt. */
+ /* 3C5.2B[7] - DVI Sense Interrupt Enable
+ * 0: Disable
+ * 1: Enable */
+ svga_wseq_mask(VGABASE, 0x2b, 0x00, 0x80);
+
+ /* Clear DVI sense interrupt status. */
+ /* 3C5.2B[6] - DVI Sense Interrupt Status
+ * (This bit has a RW1C attribute.) */
+ svga_wseq_mask(VGABASE, 0x2b, 0x40, 0x40);
+
+ DRM_DEBUG_KMS("Exiting %s.\n", __func__);
+}
+
+/*
* Set TMDS (DVI) sync polarity.
*/
static void
commit d6f952fa5bdcd7b628b8c8ad63f5d0f7e0b8d9b0
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Fri Oct 27 12:01:36 2017 -0700
Add via_tmds_io_pad_setting
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/via_tmds.c b/drivers/gpu/drm/openchrome/via_tmds.c
index 98cafe4abccd..430d71ae0fdd 100644
--- a/drivers/gpu/drm/openchrome/via_tmds.c
+++ b/drivers/gpu/drm/openchrome/via_tmds.c
@@ -49,6 +49,25 @@ static void via_tmds_power(struct via_device *dev_priv,
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
+static void via_tmds_io_pad_setting(struct via_device *dev_priv,
+ u32 di_port, bool io_pad_on)
+{
+ DRM_DEBUG_KMS("Entered %s.\n", __func__);
+
+ switch(di_port) {
+ case VIA_DI_PORT_TMDS:
+ via_lvds1_set_io_pad_setting(VGABASE,
+ io_pad_on ? 0x03 : 0x00);
+ break;
+ default:
+ break;
+ }
+
+ DRM_DEBUG_KMS("DVI I/O Pad: %s\n", io_pad_on ? "On": "Off");
+
+ DRM_DEBUG_KMS("Exiting %s.\n", __func__);
+}
+
/*
* Set TMDS (DVI) sync polarity.
*/
commit fe2aa800cae388e899a20c05df919114d435aef1
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Fri Oct 27 11:58:25 2017 -0700
Replace viaTMDSPower with via_tmds_power
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/via_tmds.c b/drivers/gpu/drm/openchrome/via_tmds.c
index 5fdf09ffb313..98cafe4abccd 100644
--- a/drivers/gpu/drm/openchrome/via_tmds.c
+++ b/drivers/gpu/drm/openchrome/via_tmds.c
@@ -28,32 +28,25 @@
#include "via_drv.h"
-static void
-viaTMDSPower(struct via_device *dev_priv,
- bool powerState)
+static void via_tmds_power(struct via_device *dev_priv,
+ bool power_state)
{
- DRM_DEBUG("Entered viaTMDSPower.\n");
-
- if (powerState) {
- /* Software control for LVDS1 power sequence. */
- via_lvds1_set_power_seq(VGABASE, true);
-
- via_lvds1_set_soft_display_period(VGABASE, true);
- via_lvds1_set_soft_data(VGABASE, true);
- via_tmds_set_power(VGABASE, true);
- } else {
- /* Software control for LVDS1 power sequence. */
- via_lvds1_set_power_seq(VGABASE, true);
+ DRM_DEBUG_KMS("Entered %s.\n", __func__);
- via_tmds_set_power(VGABASE, false);
- via_lvds1_set_soft_data(VGABASE, false);
- via_lvds1_set_soft_display_period(VGABASE, false);
- }
+ if (power_state) {
+ via_lvds1_set_soft_display_period(VGABASE, true);
+ via_lvds1_set_soft_data(VGABASE, true);
+ via_tmds_set_power(VGABASE, true);
+ } else {
+ via_tmds_set_power(VGABASE, false);
+ via_lvds1_set_soft_data(VGABASE, false);
+ via_lvds1_set_soft_display_period(VGABASE, false);
+ }
- DRM_INFO("Integrated TMDS (DVI) Power: %s\n",
- powerState ? "On" : "Off");
+ DRM_INFO("DVI Power: %s\n",
+ power_state ? "On" : "Off");
- DRM_DEBUG("Exiting viaTMDSPower.\n");
+ DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
/*
@@ -119,10 +112,10 @@ via_tmds_dpms(struct drm_encoder *encoder, int mode)
case DRM_MODE_DPMS_SUSPEND:
case DRM_MODE_DPMS_STANDBY:
case DRM_MODE_DPMS_OFF:
- viaTMDSPower(dev_priv, false);
+ via_tmds_power(dev_priv, false);
break;
case DRM_MODE_DPMS_ON:
- viaTMDSPower(dev_priv, true);
+ via_tmds_power(dev_priv, true);
break;
default:
DRM_ERROR("Bad DPMS mode.");
commit eb4a153388ef2e759ecf75accd0569df35f32d6e
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Fri Oct 27 11:56:33 2017 -0700
Add via_tmds_probe
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/via_display.c b/drivers/gpu/drm/openchrome/via_display.c
index 6fd9d2308dd8..6eff9b0a1e1c 100644
--- a/drivers/gpu/drm/openchrome/via_display.c
+++ b/drivers/gpu/drm/openchrome/via_display.c
@@ -497,6 +497,10 @@ via_modeset_init(struct drm_device *dev)
dev->mode_config.max_width = 2044;
dev->mode_config.max_height = 4096;
+ /* Initialize the number of display connectors. */
+ dev_priv->number_fp = 0;
+ dev_priv->number_dvi = 0;
+
via_display_init(dev);
via_i2c_reg_init(dev_priv);
via_i2c_init(dev);
@@ -505,8 +509,7 @@ via_modeset_init(struct drm_device *dev)
for (i = 0; i < 2; i++)
via_crtc_init(dev, i);
- /* Initialize the number of FP connectors. */
- dev_priv->number_fp = 0;
+ via_tmds_probe(dev);
via_fp_probe(dev);
diff --git a/drivers/gpu/drm/openchrome/via_display.h b/drivers/gpu/drm/openchrome/via_display.h
index 33ffbff4a489..d0b076c05eae 100644
--- a/drivers/gpu/drm/openchrome/via_display.h
+++ b/drivers/gpu/drm/openchrome/via_display.h
@@ -53,6 +53,31 @@
/* Is IGA Hor and Ver scaling up/down status */
#define HOR_VER_SCALE (BIT(0) | BIT(1))
+#define VIA_I2C_NONE 0x0
+#define VIA_I2C_BUS1 BIT(0)
+#define VIA_I2C_BUS2 BIT(1)
+#define VIA_I2C_BUS3 BIT(2)
+#define VIA_I2C_BUS4 BIT(3)
+#define VIA_I2C_BUS5 BIT(4)
+
+#define VIA_DI_PORT_NONE 0x0
+#define VIA_DI_PORT_DIP0 BIT(0)
+#define VIA_DI_PORT_DIP1 BIT(1)
+#define VIA_DI_PORT_DVP0 BIT(2)
+#define VIA_DI_PORT_DVP1 BIT(3)
+#define VIA_DI_PORT_DFPL BIT(4)
+#define VIA_DI_PORT_FPDPLOW BIT(4)
+#define VIA_DI_PORT_DFPH BIT(5)
+#define VIA_DI_PORT_FPDPHIGH BIT(5)
+#define VIA_DI_PORT_DFP BIT(6)
+#define VIA_DI_PORT_LVDS1 BIT(7)
+#define VIA_DI_PORT_TMDS BIT(7)
+#define VIA_DI_PORT_LVDS2 BIT(8)
+
+/* External TMDS (DVI) Transmitter Type */
+#define VIA_TMDS_NONE 0x0
+#define VIA_TMDS_VT1632 BIT(0)
+
struct via_crtc {
struct drm_crtc base;
struct ttm_bo_kmap_obj cursor_kmap;
@@ -79,19 +104,6 @@ struct via_connector {
uint32_t flags;
};
-#define VIA_DI_PORT_NONE 0x00
-#define VIA_DI_PORT_DIP0 BIT(0)
-#define VIA_DI_PORT_DIP1 BIT(1)
-#define VIA_DI_PORT_DVP0 BIT(2)
-#define VIA_DI_PORT_DVP1 BIT(3)
-#define VIA_DI_PORT_DFPL BIT(4)
-#define VIA_DI_PORT_FPDPLOW BIT(4)
-#define VIA_DI_PORT_DFPH BIT(5)
-#define VIA_DI_PORT_FPDPHIGH BIT(5)
-#define VIA_DI_PORT_DFP BIT(6)
-#define VIA_DI_PORT_LVDS1 BIT(7)
-#define VIA_DI_PORT_LVDS2 BIT(8)
-
struct via_encoder {
struct drm_encoder base;
uint32_t flags;
@@ -170,7 +182,7 @@ extern int via_connector_mode_valid(struct drm_connector *connector,
extern void via_connector_destroy(struct drm_connector *connector);
extern int via_get_edid_modes(struct drm_connector *connector);
-/* FP */
+extern void via_tmds_probe(struct drm_device *dev);
extern void via_fp_probe(struct drm_device *dev);
extern void via_hdmi_init(struct drm_device *dev, u32 di_port);
diff --git a/drivers/gpu/drm/openchrome/via_drv.h b/drivers/gpu/drm/openchrome/via_drv.h
index 52aad8df5074..c516a4848cc4 100644
--- a/drivers/gpu/drm/openchrome/via_drv.h
+++ b/drivers/gpu/drm/openchrome/via_drv.h
@@ -209,14 +209,23 @@ struct via_device {
* is needed for properly controlling its FP. */
bool is_quanta_il1;
+ bool int_tmds_presence;
+ u32 int_tmds_di_port;
+ u32 int_tmds_i2c_bus;
+
bool int_fp1_presence;
u32 int_fp1_di_port;
bool int_fp2_presence;
u32 int_fp2_di_port;
+ /* Keeping track of the number of DVI connectors. */
+ u32 number_dvi;
+
/* Keeping track of the number of FP (Flat Panel) connectors. */
u32 number_fp;
+
+ u32 mapped_i2c_bus;
};
#define VIA_MEM_NONE 0x00
diff --git a/drivers/gpu/drm/openchrome/via_tmds.c b/drivers/gpu/drm/openchrome/via_tmds.c
index c043e4c957fa..5fdf09ffb313 100644
--- a/drivers/gpu/drm/openchrome/via_tmds.c
+++ b/drivers/gpu/drm/openchrome/via_tmds.c
@@ -209,6 +209,85 @@ static const struct drm_connector_helper_funcs via_dvi_connector_helper_funcs =
.best_encoder = via_best_encoder,
};
+/*
+ * Probe (pre-initialization detection) of integrated TMDS transmitters.
+ */
+void via_tmds_probe(struct drm_device *dev)
+{
+ struct via_device *dev_priv = dev->dev_private;
+ u16 chipset = dev->pdev->device;
+ u8 sr13, sr5a;
+
+ DRM_DEBUG_KMS("Entered %s.\n", __func__);
+
+ /* Detect the presence of integrated TMDS transmitter. */
+ switch (chipset) {
+ case PCI_DEVICE_ID_VIA_VT3157:
+ case PCI_DEVICE_ID_VIA_VT1122:
+ sr5a = vga_rseq(VGABASE, 0x5a);
+
+ /* Setting SR5A[0] to 1.
+ * This allows the reading out the alternative
+ * pin strapping information from SR12 and SR13. */
+ svga_wseq_mask(VGABASE, 0x5a, BIT(0), BIT(0));
+
+ sr13 = vga_rseq(VGABASE, 0x13);
+ DRM_DEBUG_KMS("sr13: 0x%02x\n", sr13);
+
+ vga_wseq(VGABASE, 0x5a, sr5a);
+
+ /* 3C5.13[7:6] - Integrated LVDS / DVI Mode Select
+ * (DVP1D15-14 pin strapping)
+ * 00: LVDS1 + LVDS2
+ * 01: DVI + LVDS2
+ * 10: Dual LVDS Channel (High Resolution Panel)
+ * 11: One DVI only (decrease the clock jitter) */
+ /* Check for DVI presence using pin strappings.
+ * VIA Technologies NanoBook reference design based products
+ * have their pin strappings set to a wrong setting to communicate
+ * the presence of DVI, so it requires special handling here. */
+ if (dev_priv->is_via_nanobook) {
+ dev_priv->int_tmds_presence = true;
+ dev_priv->int_tmds_di_port = VIA_DI_PORT_TMDS;
+ dev_priv->int_tmds_i2c_bus = VIA_I2C_BUS2;
+ dev_priv->mapped_i2c_bus |= VIA_I2C_BUS2;
+ DRM_DEBUG_KMS("Integrated TMDS (DVI) "
+ "transmitter detected.\n");
+ } else if (((!(sr13 & BIT(7))) && (sr13 & BIT(6))) ||
+ ((sr13 & BIT(7)) && (sr13 & BIT(6)))) {
+ dev_priv->int_tmds_presence = true;
+ dev_priv->int_tmds_di_port = VIA_DI_PORT_TMDS;
+ dev_priv->int_tmds_i2c_bus = VIA_I2C_BUS2;
+ dev_priv->mapped_i2c_bus |= VIA_I2C_BUS2;
+ DRM_DEBUG_KMS("Integrated TMDS (DVI) "
+ "transmitter detected via pin "
+ "strapping.\n");
+ } else {
+ dev_priv->int_tmds_presence = false;
+ dev_priv->int_tmds_di_port = VIA_DI_PORT_NONE;
+ dev_priv->int_tmds_i2c_bus = VIA_I2C_NONE;
+ }
+
+ break;
+ default:
+ dev_priv->int_tmds_presence = false;
+ dev_priv->int_tmds_di_port = VIA_DI_PORT_NONE;
+ dev_priv->int_tmds_i2c_bus = VIA_I2C_NONE;
+ break;
+ }
+
+ DRM_DEBUG_KMS("int_tmds_presence: %x\n",
+ dev_priv->int_tmds_presence);
+ DRM_DEBUG_KMS("int_tmds_di_port: 0x%08x\n",
+ dev_priv->int_tmds_di_port);
+ DRM_DEBUG_KMS("int_tmds_i2c_bus: 0x%08x\n",
+ dev_priv->int_tmds_i2c_bus);
+ DRM_DEBUG_KMS("mapped_i2c_bus: 0x%08x\n",
+ dev_priv->mapped_i2c_bus);
+
+ DRM_DEBUG_KMS("Exiting %s.\n", __func__);
+}
+
int
via_tmds_init(struct drm_device *dev)
{
commit 2b063961c00aad292cffd2e556970ddc30ae13ef
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Fri Oct 27 11:51:15 2017 -0700
Updating chip_revision_info code
Added code to detect VIA Technologies NanoBook reference design and
Quanta IL1 netbook.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/via_drv.c b/drivers/gpu/drm/openchrome/via_drv.c
index d8df814dfba0..a3ac3a81c008 100644
--- a/drivers/gpu/drm/openchrome/via_drv.c
+++ b/drivers/gpu/drm/openchrome/via_drv.c
@@ -154,26 +154,70 @@ via_mmio_setup(struct via_device *dev_priv)
DRM_INFO("Exiting via_mmio_setup.\n");
}
-static void
-chip_revision_info(struct drm_device *dev)
+static void chip_revision_info(struct drm_device *dev)
{
struct via_device *dev_priv = dev->dev_private;
+ struct pci_bus *bus;
+ struct pci_dev *device;
+ u16 device_id, subsystem_vendor_id, subsystem_device_id;
u8 tmp;
+ int ret;
+
+ DRM_DEBUG_KMS("Entered %s.\n", __func__);
+
+ bus = pci_find_bus(0, 1);
+ if (!bus) {
+ goto pci_error;
+ }
+
+ device = pci_get_slot(bus, PCI_DEVFN(0, 0));
+ if (!device) {
+ goto pci_error;
+ }
+
+ ret = pci_read_config_word(device, 0x02, &device_id);
+ if (ret) {
+ goto pci_error;
+ }
+
+ ret = pci_read_config_word(device, 0x2c,
+ &subsystem_vendor_id);
+ if (ret) {
+ goto pci_error;
+ }
+
+ ret = pci_read_config_word(device, 0x2e,
+ &subsystem_device_id);
+ if (ret) {
+ goto pci_error;
+ }
+
+ DRM_DEBUG_KMS("Chrome IGP Device ID: "
+ "0x%04X\n", device_id);
+ DRM_DEBUG_KMS("Chrome IGP Subsystem Vendor ID: "
+ "0x%04X\n", subsystem_vendor_id);
+ DRM_DEBUG_KMS("Chrome IGP Subsystem Device ID: "
+ "0x%04X\n", subsystem_device_id);
switch (dev->pdev->device) {
- /* Check revision of CLE266 Chip */
+
+ /* Check the revision of CLE266 chipset. */
case PCI_DEVICE_ID_VIA_CLE266:
- /* CR4F only define in CLE266.CX chip */
+
+ /* CR4F only defined in CLE266.CX chipset. */
tmp = vga_rcrt(VGABASE, 0x4F);
vga_wcrt(VGABASE, 0x4F, 0x55);
- if (vga_rcrt(VGABASE, 0x4F) != 0x55)
+ if (vga_rcrt(VGABASE, 0x4F) != 0x55) {
dev_priv->revision = CLE266_REVISION_AX;
- else
+ } else {
dev_priv->revision = CLE266_REVISION_CX;
- /* restore orignal CR4F value */
+ }
+
+ /* Restore original CR4F value. */
vga_wcrt(VGABASE, 0x4F, tmp);
break;
+ /* CX700 / VX700 Chipset */
case PCI_DEVICE_ID_VIA_VT3157:
tmp = vga_rseq(VGABASE, 0x43);
if (tmp & 0x02) {
@@ -183,17 +227,47 @@ chip_revision_info(struct drm_device *dev)
} else {
dev_priv->revision = CX700_REVISION_700;
}
+
+ /* Check for VIA Technologies NanoBook reference
+ * design. This is necessary due to its strapping
+ * resistors not being set to indicate the
+ * availability of DVI. */
+ if ((subsystem_vendor_id == 0x1509) &&
+ (subsystem_device_id == 0x2d30)) {
+ dev_priv->is_via_nanobook = true;
+ } else {
+ dev_priv->is_via_nanobook = false;
+ }
+
break;
+ /* VX800 / VX820 Chipset */
case PCI_DEVICE_ID_VIA_VT1122:
+
+ /* Check for Quanta IL1 netbook. This is necessary
+ * due to its flat panel connected to DVP1 (Digital
+ * Video Port 1) rather than its LVDS channel. */
+ if ((subsystem_vendor_id == 0x152d) &&
+ (subsystem_device_id == 0x0771)) {
+ dev_priv->is_quanta_il1 = true;
+ } else {
+ dev_priv->is_quanta_il1 = false;
+ }
+
+ break;
case PCI_DEVICE_ID_VIA_VX875:
case PCI_DEVICE_ID_VIA_VX900_VGA:
dev_priv->revision = vga_rseq(VGABASE, 0x3B);
break;
-
default:
break;
}
+
+ goto exit;
+pci_error:
+ DRM_ERROR("PCI bus related error.");
+exit:
+ DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
static int via_dumb_create(struct drm_file *filp, struct drm_device *dev,
commit 0d6f6245e07e601a5d4cae8877dea4793541f5af
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Fri Oct 27 11:47:50 2017 -0700
Fix for via_lvds2_set_io_pad_setting writing to the wrong location
This is a really bad error.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/crtc_hw.h b/drivers/gpu/drm/openchrome/crtc_hw.h
index 86159cb6b99d..130cdc133098 100644
--- a/drivers/gpu/drm/openchrome/crtc_hw.h
+++ b/drivers/gpu/drm/openchrome/crtc_hw.h
@@ -817,7 +817,7 @@ via_lvds2_set_io_pad_setting(void __iomem *regs, u8 io_pad_state)
* 10: Depend on the other control signal
* 11: Pad on/off according to the
* Power Management Status (PMS) */
- svga_wcrt_mask(regs, 0x2A,
+ svga_wseq_mask(regs, 0x2A,
io_pad_state << 2, BIT(3) | BIT(2));
DRM_DEBUG_KMS("LVDS2 I/O Pad State: %s\n",
((io_pad_state & (BIT(1) | BIT(0))) == 0x03) ?
commit 87b17080938aa88c8486086bb61ee252af7a9f96
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Fri Oct 27 11:46:04 2017 -0700
Fix for via_lvds1_set_io_pad_setting writing to the wrong location
This is a really bad error.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/crtc_hw.h b/drivers/gpu/drm/openchrome/crtc_hw.h
index fe57d1476851..86159cb6b99d 100644
--- a/drivers/gpu/drm/openchrome/crtc_hw.h
+++ b/drivers/gpu/drm/openchrome/crtc_hw.h
@@ -764,7 +764,7 @@ via_lvds1_set_io_pad_setting(void __iomem *regs, u8 io_pad_state)
* 10: Depend on the other control signal
* 11: Pad on/off according to the
* Power Management Status (PMS) */
- svga_wcrt_mask(regs, 0x2A,
+ svga_wseq_mask(regs, 0x2A,
io_pad_state, BIT(1) | BIT(0));
DRM_DEBUG_KMS("LVDS1 I/O Pad State: %s\n",
((io_pad_state & (BIT(1) | BIT(0))) == 0x03) ?
More information about the Openchrome-devel
mailing list