[Openchrome-devel] drm-openchrome: Branch 'drm-next-4.17' - 2 commits - drivers/gpu/drm

2018-03-27 Thread Kevin Brace
 drivers/gpu/drm/openchrome/via_crtc.c |   24 
 drivers/gpu/drm/openchrome/via_drv.h  |5 ++---
 2 files changed, 14 insertions(+), 15 deletions(-)

New commits:
commit f9e35ef676897d21f1b5c1fc25228545f6daf9d2
Author: Kevin Brace 
Date:   Tue Mar 27 15:30:57 2018 -0700

drm/openchrome: Version bumped to 3.0.79

This version fixes corrupted hardware cursor(s) after standby resume
and hardware cursor(s) being left displayed after switching to VT
(Virtual Terminal). It will cause a minor regression of hardware
cursor(s) being turned off right after standby resume, although it
will turn back on when the associated input device is moved around the
screen.

Signed-off-by: Kevin Brace 

diff --git a/drivers/gpu/drm/openchrome/via_drv.h 
b/drivers/gpu/drm/openchrome/via_drv.h
index df2eb0a4f36d..c1beef590ece 100644
--- a/drivers/gpu/drm/openchrome/via_drv.h
+++ b/drivers/gpu/drm/openchrome/via_drv.h
@@ -30,12 +30,11 @@
 #define DRIVER_AUTHOR   "OpenChrome Project"
 #define DRIVER_NAME "openchrome"
 #define DRIVER_DESC "OpenChrome DRM for VIA Technologies Chrome IGP"
-#define DRIVER_DATE "20180309"
+#define DRIVER_DATE "20180327"
 
 #define DRIVER_MAJOR   3
 #define DRIVER_MINOR   0
-#define DRIVER_PATCHLEVEL  78
-
+#define DRIVER_PATCHLEVEL  79
 #include 
 
 #include "ttm/ttm_bo_api.h"
commit ad7ae852aba77aee36d67640028e218c0afcbd94
Author: Kevin Brace 
Date:   Tue Mar 27 15:19:39 2018 -0700

drm/openchrome: Fix for corrupted cursor(s) after standby resume

This commit fixes corrupted hardware cursor(s) after standby resume
likely introduced by commit 981d27b3a95a7df6fb6c6887b467f576bf8a8b97.
Furthermore, it also fixes a bug that causes hardware cursor(s) to stay
displayed after switching over to VT (Virtual Terminal). That being
said, this commit will cause a minor regression of turning off the
hardware cursor(s) right after standby resume, although they will be
displayed again when the input device is moved around the screen.

Signed-off-by: Kevin Brace 

diff --git a/drivers/gpu/drm/openchrome/via_crtc.c 
b/drivers/gpu/drm/openchrome/via_crtc.c
index 5a9dee74e8e5..502293529234 100644
--- a/drivers/gpu/drm/openchrome/via_crtc.c
+++ b/drivers/gpu/drm/openchrome/via_crtc.c
@@ -392,6 +392,8 @@ static int via_crtc_cursor_move(struct drm_crtc *crtc, int 
x, int y)
break;
}
 
+   via_show_cursor(crtc);
+
return 0;
 }
 
@@ -1845,9 +1847,6 @@ via_iga1_crtc_prepare(struct drm_crtc *crtc)
 {
DRM_DEBUG_KMS("Entered %s.\n", __func__);
 
-   /* Turn off the cursor */
-   via_hide_cursor(crtc);
-
drm_crtc_vblank_off(crtc);
 
/* Blank the screen */
@@ -1862,9 +1861,6 @@ via_iga1_crtc_commit(struct drm_crtc *crtc)
 {
DRM_DEBUG_KMS("Entered %s.\n", __func__);
 
-   /* Turn on the cursor */
-   via_show_cursor(crtc);
-
drm_crtc_vblank_on(crtc);
 
/* Turn on the monitor */
@@ -2022,6 +2018,11 @@ via_iga1_crtc_mode_set(struct drm_crtc *crtc,
 
ret = via_iga1_crtc_mode_set_base(crtc, x, y, fb);
 
+   /* Specify the cursor pattern. */
+   via_cursor_address(crtc);
+
+   /* Turn off the cursor. */
+   via_hide_cursor(crtc);
 exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
return ret;
@@ -2128,9 +2129,6 @@ via_iga2_crtc_prepare(struct drm_crtc *crtc)
 {
DRM_DEBUG_KMS("Entered %s.\n", __func__);
 
-   /* Turn off the cursor */
-   via_hide_cursor(crtc);
-
drm_crtc_vblank_off(crtc);
 
/* Blank the screen */
@@ -2145,9 +2143,6 @@ via_iga2_crtc_commit(struct drm_crtc *crtc)
 {
DRM_DEBUG_KMS("Entered %s.\n", __func__);
 
-   /* Turn on the cursor */
-   via_show_cursor(crtc);
-
drm_crtc_vblank_on(crtc);
 
/* Turn on the monitor */
@@ -2334,6 +2329,11 @@ via_iga2_crtc_mode_set(struct drm_crtc *crtc,
 
ret = via_iga2_crtc_mode_set_base(crtc, x, y, fb);
 
+   /* Specify the cursor pattern. */
+   via_cursor_address(crtc);
+
+   /* Turn off the cursor. */
+   via_hide_cursor(crtc);
 exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
return ret;
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] drm-openchrome: Branch 'drm-next-4.17' - 2 commits - drivers/gpu/drm

2018-03-09 Thread Kevin Brace
 drivers/gpu/drm/openchrome/via_drv.h |4 
 drivers/gpu/drm/openchrome/via_fp.c  |  176 +--
 2 files changed, 130 insertions(+), 50 deletions(-)

New commits:
commit 966e216ada5f104e2a3086949febe07fee9b9a1c
Author: Kevin Brace 
Date:   Fri Mar 9 11:37:36 2018 -0800

drm/openchrome: Version bumped to 3.0.78

Signed-off-by: Kevin Brace 

diff --git a/drivers/gpu/drm/openchrome/via_drv.h 
b/drivers/gpu/drm/openchrome/via_drv.h
index 2141edf4edf2..df2eb0a4f36d 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 "20180308"
+#define DRIVER_DATE "20180309"
 
 #define DRIVER_MAJOR   3
 #define DRIVER_MINOR   0
-#define DRIVER_PATCHLEVEL  77
+#define DRIVER_PATCHLEVEL  78
 
 #include 
 
commit 5a6b549b83816cb62ecff8dac655ed7d6da87f96
Author: Kevin Brace 
Date:   Fri Mar 9 11:33:03 2018 -0800

drm/openchrome: Fix for FP detection regression

Some of the code was borrowed from Radeon DRM.

Signed-off-by: Kevin Brace 

diff --git a/drivers/gpu/drm/openchrome/via_fp.c 
b/drivers/gpu/drm/openchrome/via_fp.c
index f88fe3a4c53b..67ec868af7e6 100644
--- a/drivers/gpu/drm/openchrome/via_fp.c
+++ b/drivers/gpu/drm/openchrome/via_fp.c
@@ -53,6 +53,43 @@ static via_fp_info via_fp_info_table[] = {
{1600, 1200}
 };
 
+static bool openchrome_fp_probe_edid(struct i2c_adapter *i2c_bus)
+{
+   u8 out = 0x0;
+   u8 buf[8];
+   struct i2c_msg msgs[] = {
+   {
+   .addr = DDC_ADDR,
+   .flags = 0,
+   .len = 1,
+   .buf = ,
+   },
+   {
+   .addr = DDC_ADDR,
+   .flags = I2C_M_RD,
+   .len = 8,
+   .buf = buf,
+   }
+   };
+   int i2c_ret;
+   bool ret = false;
+
+   DRM_DEBUG_KMS("Entered %s.\n", __func__);
+
+   i2c_ret = i2c_transfer(i2c_bus, msgs, 2);
+   if (i2c_ret != 2) {
+   goto exit;
+   }
+
+   if (drm_edid_header_is_valid(buf) < 6) {
+   goto exit;
+   }
+
+   ret = true;
+exit:
+   DRM_DEBUG_KMS("Exiting %s.\n", __func__);
+   return ret;
+}
 
 /* caculate the cetering timing using mode and adjusted_mode */
 static void
@@ -749,43 +786,63 @@ via_fp_detect(struct drm_connector *connector,  bool 
force)
struct i2c_adapter *i2c_bus;
struct edid *edid = NULL;
u8 mask;
+   uint32_t i, i2c_bus_bit;
 
DRM_DEBUG_KMS("Entered %s.\n", __func__);
 
-   drm_mode_connector_update_edid_property(connector, edid);
-
if (machine_is_olpc()) {
ret = connector_status_connected;
goto exit;
}
 
-   if (con->i2c_bus & VIA_I2C_BUS2) {
-   i2c_bus = via_find_ddc_bus(0x31);
-   } else if (con->i2c_bus & VIA_I2C_BUS3) {
-   i2c_bus = via_find_ddc_bus(0x2c);
-   } else {
-   i2c_bus = NULL;
-   }
+   i2c_bus_bit = VIA_I2C_BUS2;
+   for (i = 0; i < 2; i++) {
+   if (con->i2c_bus & i2c_bus_bit) {
+   if (i2c_bus_bit & VIA_I2C_BUS2) {
+   i2c_bus = via_find_ddc_bus(0x31);
+   } else if (i2c_bus_bit & VIA_I2C_BUS3) {
+   i2c_bus = via_find_ddc_bus(0x2c);
+   } else {
+   i2c_bus = NULL;
+   i2c_bus_bit = i2c_bus_bit << 1;
+   continue;
+   }
+   } else {
+   i2c_bus = NULL;
+   i2c_bus_bit = i2c_bus_bit << 1;
+   continue;
+   }
+
+   if (!openchrome_fp_probe_edid(i2c_bus)) {
+   i2c_bus_bit = i2c_bus_bit << 1;
+   continue;
+   }
 
-   if (i2c_bus) {
edid = drm_get_edid(>base, i2c_bus);
if (edid) {
-   drm_mode_connector_update_edid_property(connector,
-   edid);
-   kfree(edid);
-   ret = connector_status_connected;
+   if (edid->input & DRM_EDID_INPUT_DIGITAL) {
+   ret = connector_status_connected;
+   kfree(edid);
+   DRM_DEBUG_KMS("FP detected.\n");
+   DRM_DEBUG_KMS("i2c_bus_bit: %x\n", i2c_bus_bit);
+ 

[Openchrome-devel] drm-openchrome: Branch 'drm-next-4.17' - 2 commits - drivers/gpu/drm

2018-03-08 Thread Kevin Brace
 drivers/gpu/drm/openchrome/via_analog.c |   30 --
 drivers/gpu/drm/openchrome/via_drv.h|4 ++--
 2 files changed, 22 insertions(+), 12 deletions(-)

New commits:
commit 0f18af7cdaddb1d83614e8b2f85f3df927fe57ac
Author: Kevin Brace 
Date:   Thu Mar 8 14:47:55 2018 -0800

drm/openchrome: Version bumped to 3.0.77

Signed-off-by: Kevin Brace 

diff --git a/drivers/gpu/drm/openchrome/via_drv.h 
b/drivers/gpu/drm/openchrome/via_drv.h
index 787fec655475..2141edf4edf2 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 "20180213"
+#define DRIVER_DATE "20180308"
 
 #define DRIVER_MAJOR   3
 #define DRIVER_MINOR   0
-#define DRIVER_PATCHLEVEL  76
+#define DRIVER_PATCHLEVEL  77
 
 #include 
 
commit adb11f21f95efcc2c76817eb85e776844955496d
Author: Kevin Brace 
Date:   Thu Mar 8 14:42:53 2018 -0800

drm/openchrome: Only recognize analog interface type EDID for analog (VGA)

Signed-off-by: Kevin Brace 

diff --git a/drivers/gpu/drm/openchrome/via_analog.c 
b/drivers/gpu/drm/openchrome/via_analog.c
index 9eb8dff33923..9feec220a482 100644
--- a/drivers/gpu/drm/openchrome/via_analog.c
+++ b/drivers/gpu/drm/openchrome/via_analog.c
@@ -223,8 +223,6 @@ via_analog_detect(struct drm_connector *connector, bool 
force)
 
DRM_DEBUG_KMS("Entered %s.\n", __func__);
 
-   drm_mode_connector_update_edid_property(connector, edid);
-
if (con->i2c_bus & VIA_I2C_BUS1) {
i2c_bus = via_find_ddc_bus(0x26);
} else {
@@ -234,10 +232,11 @@ via_analog_detect(struct drm_connector *connector, bool 
force)
if (i2c_bus) {
edid = drm_get_edid(>base, i2c_bus);
if (edid) {
-   drm_mode_connector_update_edid_property(connector,
-   edid);
+   if (!(edid->input & DRM_EDID_INPUT_DIGITAL)) {
+   ret = connector_status_connected;
+   }
+
kfree(edid);
-   ret = connector_status_connected;
goto exit;
}
}
@@ -251,10 +250,11 @@ via_analog_detect(struct drm_connector *connector, bool 
force)
if (i2c_bus) {
edid = drm_get_edid(>base, i2c_bus);
if (edid) {
-   drm_mode_connector_update_edid_property(connector,
-   edid);
+   if (!(edid->input & DRM_EDID_INPUT_DIGITAL)) {
+   ret = connector_status_connected;
+   }
+
kfree(edid);
-   ret = connector_status_connected;
goto exit;
}
}
@@ -291,7 +291,12 @@ static int via_analog_get_modes(struct drm_connector 
*connector)
if (i2c_bus) {
edid = drm_get_edid(>base, i2c_bus);
if (edid) {
-   count = drm_add_edid_modes(connector, edid);
+   if (!(edid->input & DRM_EDID_INPUT_DIGITAL)) {
+   
drm_mode_connector_update_edid_property(connector,
+   edid);
+   count = drm_add_edid_modes(connector, edid);
+   }
+
kfree(edid);
goto exit;
}
@@ -306,7 +311,12 @@ static int via_analog_get_modes(struct drm_connector 
*connector)
if (i2c_bus) {
edid = drm_get_edid(>base, i2c_bus);
if (edid) {
-   count = drm_add_edid_modes(connector, edid);
+   if (!(edid->input & DRM_EDID_INPUT_DIGITAL)) {
+   
drm_mode_connector_update_edid_property(connector,
+   edid);
+   count = drm_add_edid_modes(connector, edid);
+   }
+
kfree(edid);
goto exit;
}
___
Openchrome-devel mailing list
Openchrome-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/openchrome-devel


[Openchrome-devel] drm-openchrome: Branch 'drm-next-4.17' - 2 commits - drivers/gpu/drm

2018-02-13 Thread Kevin Brace
 drivers/gpu/drm/openchrome/via_analog.c  |   90 ++-
 drivers/gpu/drm/openchrome/via_display.c |2 
 drivers/gpu/drm/openchrome/via_display.h |1 
 drivers/gpu/drm/openchrome/via_drv.h |5 +
 4 files changed, 94 insertions(+), 4 deletions(-)

New commits:
commit e3eb41c79815b57fb447ba6499e69052d21684fc
Author: Kevin Brace 
Date:   Tue Feb 13 17:07:33 2018 -0800

drm/openchrome: Version bumped to 3.0.76

Adds I2C bus 2 support for analog (VGA) output. This will now allow
DVI to VGA passive converter to work properly in most cases.

Signed-off-by: Kevin Brace 

diff --git a/drivers/gpu/drm/openchrome/via_drv.h 
b/drivers/gpu/drm/openchrome/via_drv.h
index c1b735b3c0e2..787fec655475 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 "20180211"
+#define DRIVER_DATE "20180213"
 
 #define DRIVER_MAJOR   3
 #define DRIVER_MINOR   0
-#define DRIVER_PATCHLEVEL  75
+#define DRIVER_PATCHLEVEL  76
 
 #include 
 
commit 975879a78784754ac027561155786d822c36f974
Author: Kevin Brace 
Date:   Tue Feb 13 17:04:25 2018 -0800

drm/openchrome: Add I2C bus 2 support for analog (VGA) output

Many DVI connectors are DVI-I type and analog signals come out of a
DVI-I connector. However, in many cases its I2C bus used is I2C bus 2,
but the support code for I2C bus 2 support with analog (VGA) output
was previously missing. This commit will now allow DVI to VGA passive
converter to work properly in most cases.

Signed-off-by: Kevin Brace 

diff --git a/drivers/gpu/drm/openchrome/via_analog.c 
b/drivers/gpu/drm/openchrome/via_analog.c
index 4eac3dea5e1f..9eb8dff33923 100644
--- a/drivers/gpu/drm/openchrome/via_analog.c
+++ b/drivers/gpu/drm/openchrome/via_analog.c
@@ -238,9 +238,28 @@ via_analog_detect(struct drm_connector *connector, bool 
force)
edid);
kfree(edid);
ret = connector_status_connected;
+   goto exit;
}
}
 
+   if (con->i2c_bus & VIA_I2C_BUS2) {
+   i2c_bus = via_find_ddc_bus(0x31);
+   } else {
+   i2c_bus = NULL;
+   }
+
+   if (i2c_bus) {
+   edid = drm_get_edid(>base, i2c_bus);
+   if (edid) {
+   drm_mode_connector_update_edid_property(connector,
+   edid);
+   kfree(edid);
+   ret = connector_status_connected;
+   goto exit;
+   }
+   }
+
+exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
return ret;
 }
@@ -274,9 +293,26 @@ static int via_analog_get_modes(struct drm_connector 
*connector)
if (edid) {
count = drm_add_edid_modes(connector, edid);
kfree(edid);
+   goto exit;
+   }
+   }
+
+   if (con->i2c_bus & VIA_I2C_BUS2) {
+   i2c_bus = via_find_ddc_bus(0x31);
+   } else {
+   i2c_bus = NULL;
+   }
+
+   if (i2c_bus) {
+   edid = drm_get_edid(>base, i2c_bus);
+   if (edid) {
+   count = drm_add_edid_modes(connector, edid);
+   kfree(edid);
+   goto exit;
}
}
 
+exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
return count;
 }
@@ -287,14 +323,64 @@ static const struct drm_connector_helper_funcs 
via_analog_connector_helper_funcs
.best_encoder = via_best_encoder,
 };
 
+void via_analog_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__);
+
+   switch (chipset) {
+   case PCI_DEVICE_ID_VIA_VT3157:
+   case PCI_DEVICE_ID_VIA_VT1122:
+   case PCI_DEVICE_ID_VIA_VX875:
+   case PCI_DEVICE_ID_VIA_VX900_VGA:
+   sr5a = vga_rseq(VGABASE, 0x5a);
+   DRM_DEBUG_KMS("SR5A: 0x%02x\n", sr5a);
+
+   /* 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));
+   DRM_DEBUG_KMS("SR5A: 0x%02x\n", sr5a);
+
+   sr13 = vga_rseq(VGABASE, 0x13);
+   DRM_DEBUG_KMS("SR13: 0x%02x\n", sr13);
+
+   if (!(sr13 & BIT(2))) {
+