[openchrome-devel] drm-openchrome: Branch 'drm-next-4.21' - 3 commits - drivers/gpu/drm
Kevin Brace
kevinbrace at kemper.freedesktop.org
Tue Jan 8 01:34:28 UTC 2019
drivers/gpu/drm/openchrome/openchrome_analog.c | 68 +++--
drivers/gpu/drm/openchrome/openchrome_clocks.c | 3
drivers/gpu/drm/openchrome/openchrome_crtc.c | 163 +++++++------
drivers/gpu/drm/openchrome/openchrome_display.c | 36 +-
drivers/gpu/drm/openchrome/openchrome_drv.c | 216 +++++++++--------
drivers/gpu/drm/openchrome/openchrome_drv.h | 188 +++++++--------
drivers/gpu/drm/openchrome/openchrome_encoder.c | 17 -
drivers/gpu/drm/openchrome/openchrome_fb.c | 299 ++++++++++++------------
drivers/gpu/drm/openchrome/openchrome_fp.c | 289 ++++++++++++-----------
drivers/gpu/drm/openchrome/openchrome_gem.c | 8
drivers/gpu/drm/openchrome/openchrome_hdmi.c | 56 ++--
drivers/gpu/drm/openchrome/openchrome_i2c.c | 8
drivers/gpu/drm/openchrome/openchrome_ioc32.c | 8
drivers/gpu/drm/openchrome/openchrome_pm.c | 35 +-
drivers/gpu/drm/openchrome/openchrome_sii164.c | 54 ++--
drivers/gpu/drm/openchrome/openchrome_tmds.c | 190 ++++++++-------
drivers/gpu/drm/openchrome/openchrome_ttm.c | 54 ++--
drivers/gpu/drm/openchrome/openchrome_vt1632.c | 54 ++--
18 files changed, 940 insertions(+), 806 deletions(-)
New commits:
commit 9bbe9b1ef9c54215ccaf92bde367845b949c6612
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Jan 7 17:33:29 2019 -0800
drm/openchrome: Version bumped to 3.1.1
New header file. No change in the functionality.
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index 041e1bb2518c..494eb439df74 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -52,10 +52,10 @@
#define DRIVER_MAJOR 3
#define DRIVER_MINOR 1
-#define DRIVER_PATCHLEVEL 0
+#define DRIVER_PATCHLEVEL 1
#define DRIVER_NAME "openchrome"
#define DRIVER_DESC "OpenChrome DRM for VIA Technologies Chrome IGP"
-#define DRIVER_DATE "20190104"
+#define DRIVER_DATE "20190107"
#define DRIVER_AUTHOR "OpenChrome Project"
commit 2ef49cc6525f635d66d168d0cc165769ab118352
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Jan 7 17:30:48 2019 -0800
drm/openchrome: Change DRM private struct name to openchrome_drm_private
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_analog.c b/drivers/gpu/drm/openchrome/openchrome_analog.c
index 3a023a0007bb..3fd7ff64bafb 100644
--- a/drivers/gpu/drm/openchrome/openchrome_analog.c
+++ b/drivers/gpu/drm/openchrome/openchrome_analog.c
@@ -31,8 +31,8 @@
/*
* Enables or disables analog (VGA) output.
*/
-static void
-via_analog_power(struct via_device *dev_priv, bool outputState)
+static void via_analog_power(struct openchrome_drm_private *dev_private,
+ bool outputState)
{
DRM_DEBUG_KMS("Entered via_analog_power.\n");
@@ -46,8 +46,9 @@ via_analog_power(struct via_device *dev_priv, bool outputState)
/*
* Set analog (VGA) sync polarity.
*/
-static void
-via_analog_sync_polarity(struct via_device *dev_priv, unsigned int flags)
+static void via_analog_sync_polarity(
+ struct openchrome_drm_private *dev_private,
+ unsigned int flags)
{
u8 syncPolarity = 0x00;
@@ -73,8 +74,9 @@ via_analog_sync_polarity(struct via_device *dev_priv, unsigned int flags)
/*
* Sets analog (VGA) display source.
*/
-static void
-via_analog_display_source(struct via_device *dev_priv, int index)
+static void via_analog_display_source(
+ struct openchrome_drm_private *dev_private,
+ int index)
{
u8 displaySource = index;
@@ -100,26 +102,27 @@ static const struct drm_encoder_funcs via_dac_enc_funcs = {
static void
via_analog_dpms(struct drm_encoder *encoder, int mode)
{
- struct via_device *dev_priv = encoder->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
DRM_DEBUG_KMS("Entered via_analog_dpms.\n");
switch (mode) {
case DRM_MODE_DPMS_ON:
via_analog_set_dpms_control(VGABASE, VIA_ANALOG_DPMS_ON);
- via_analog_power(dev_priv, true);
+ via_analog_power(dev_private, true);
break;
case DRM_MODE_DPMS_STANDBY:
via_analog_set_dpms_control(VGABASE, VIA_ANALOG_DPMS_STANDBY);
- via_analog_power(dev_priv, true);
+ via_analog_power(dev_private, true);
break;
case DRM_MODE_DPMS_SUSPEND:
via_analog_set_dpms_control(VGABASE, VIA_ANALOG_DPMS_SUSPEND);
- via_analog_power(dev_priv, true);
+ via_analog_power(dev_private, true);
break;
case DRM_MODE_DPMS_OFF:
via_analog_set_dpms_control(VGABASE, VIA_ANALOG_DPMS_OFF);
- via_analog_power(dev_priv, false);
+ via_analog_power(dev_private, false);
break;
default:
DRM_ERROR("Bad DPMS mode.");
@@ -150,13 +153,14 @@ via_analog_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
- struct via_device *dev_priv = encoder->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
struct via_crtc *iga = container_of(encoder->crtc, struct via_crtc, base);
DRM_DEBUG_KMS("Entered via_analog_mode_set.\n");
- via_analog_sync_polarity(dev_priv, adjusted_mode->flags);
- via_analog_display_source(dev_priv, iga->index);
+ via_analog_sync_polarity(dev_private, adjusted_mode->flags);
+ via_analog_display_source(dev_private, iga->index);
DRM_DEBUG_KMS("Exiting via_analog_mode_set.\n");
}
@@ -164,13 +168,14 @@ via_analog_mode_set(struct drm_encoder *encoder,
static void
via_analog_prepare(struct drm_encoder *encoder)
{
- struct via_device *dev_priv = encoder->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
DRM_DEBUG_KMS("Entered via_analog_prepare.\n");
if (encoder->crtc) {
via_analog_set_dpms_control(VGABASE, VIA_ANALOG_DPMS_OFF);
- via_analog_power(dev_priv, false);
+ via_analog_power(dev_private, false);
}
DRM_DEBUG_KMS("Exiting via_analog_prepare.\n");
@@ -179,13 +184,14 @@ via_analog_prepare(struct drm_encoder *encoder)
static void
via_analog_commit(struct drm_encoder *encoder)
{
- struct via_device *dev_priv = encoder->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
DRM_DEBUG_KMS("Entered via_analog_commit.\n");
if (encoder->crtc) {
via_analog_set_dpms_control(VGABASE, VIA_ANALOG_DPMS_ON);
- via_analog_power(dev_priv, true);
+ via_analog_power(dev_private, true);
}
DRM_DEBUG_KMS("Exiting via_analog_commit.\n");
@@ -194,12 +200,13 @@ via_analog_commit(struct drm_encoder *encoder)
static void
via_analog_disable(struct drm_encoder *encoder)
{
- struct via_device *dev_priv = encoder->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
DRM_DEBUG_KMS("Entered via_analog_disable.\n");
via_analog_set_dpms_control(VGABASE, VIA_ANALOG_DPMS_OFF);
- via_analog_power(dev_priv, false);
+ via_analog_power(dev_private, false);
DRM_DEBUG_KMS("Exiting via_analog_disable.\n");
}
@@ -336,7 +343,8 @@ static const struct drm_connector_helper_funcs via_analog_connector_helper_funcs
void via_analog_probe(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ dev->dev_private;
u16 chipset = dev->pdev->device;
u8 sr13, sr5a;
@@ -360,28 +368,28 @@ void via_analog_probe(struct drm_device *dev)
DRM_DEBUG_KMS("SR13: 0x%02x\n", sr13);
if (!(sr13 & BIT(2))) {
- dev_priv->analog_presence = true;
+ dev_private->analog_presence = true;
DRM_DEBUG_KMS("Detected the presence of VGA.\n");
} else {
- dev_priv->analog_presence = false;
+ dev_private->analog_presence = false;
}
/* Restore SR5A. */
vga_wseq(VGABASE, 0x5a, sr5a);
break;
default:
- dev_priv->analog_presence = true;
+ dev_private->analog_presence = true;
DRM_DEBUG_KMS("Detected the presence of VGA.\n");
break;
}
- dev_priv->analog_i2c_bus = VIA_I2C_NONE;
+ dev_private->analog_i2c_bus = VIA_I2C_NONE;
- if (dev_priv->analog_presence) {
- dev_priv->analog_i2c_bus = VIA_I2C_BUS2 | VIA_I2C_BUS1;
+ if (dev_private->analog_presence) {
+ dev_private->analog_i2c_bus = VIA_I2C_BUS2 | VIA_I2C_BUS1;
}
- dev_priv->mapped_i2c_bus |= dev_priv->analog_i2c_bus;
+ dev_private->mapped_i2c_bus |= dev_private->analog_i2c_bus;
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
@@ -390,7 +398,7 @@ void via_analog_init(struct drm_device *dev)
{
struct via_connector *con;
struct via_encoder *enc;
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
enc = kzalloc(sizeof(*enc) + sizeof(*con), GFP_KERNEL);
if (!enc) {
@@ -406,7 +414,7 @@ void via_analog_init(struct drm_device *dev)
drm_connector_helper_add(&con->base, &via_analog_connector_helper_funcs);
drm_connector_register(&con->base);
- con->i2c_bus = dev_priv->analog_i2c_bus;
+ con->i2c_bus = dev_private->analog_i2c_bus;
con->base.doublescan_allowed = false;
con->base.interlace_allowed = true;
diff --git a/drivers/gpu/drm/openchrome/openchrome_clocks.c b/drivers/gpu/drm/openchrome/openchrome_clocks.c
index 6fd128ddc947..7ff44400ad3d 100644
--- a/drivers/gpu/drm/openchrome/openchrome_clocks.c
+++ b/drivers/gpu/drm/openchrome/openchrome_clocks.c
@@ -193,7 +193,8 @@ void
via_set_vclock(struct drm_crtc *crtc, u32 clk)
{
struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
struct drm_device *dev = crtc->dev;
unsigned long max_loop = 50, i = 0;
diff --git a/drivers/gpu/drm/openchrome/openchrome_crtc.c b/drivers/gpu/drm/openchrome/openchrome_crtc.c
index d2e15bb18a7e..9b6e87e45181 100644
--- a/drivers/gpu/drm/openchrome/openchrome_crtc.c
+++ b/drivers/gpu/drm/openchrome/openchrome_crtc.c
@@ -62,8 +62,9 @@ static void via_iga_common_init(void __iomem *regs)
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
-static void via_iga1_set_color_depth(struct via_device *dev_priv,
- u8 depth)
+static void via_iga1_set_color_depth(
+ struct openchrome_drm_private *dev_private,
+ u8 depth)
{
u8 value;
@@ -108,8 +109,9 @@ static void via_iga1_set_color_depth(struct via_device *dev_priv,
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
-static void via_iga2_set_color_depth(struct via_device *dev_priv,
- u8 depth)
+static void via_iga2_set_color_depth(
+ struct openchrome_drm_private *dev_private,
+ u8 depth)
{
u8 value;
@@ -153,7 +155,8 @@ static void via_hide_cursor(struct drm_crtc *crtc)
{
struct drm_device *dev = crtc->dev;
struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
uint32_t temp;
switch (dev->pdev->device) {
@@ -184,7 +187,8 @@ static void via_show_cursor(struct drm_crtc *crtc)
{
struct drm_device *dev = crtc->dev;
struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
switch (dev->pdev->device) {
case PCI_DEVICE_ID_VIA_PM800:
@@ -248,7 +252,8 @@ static void via_cursor_address(struct drm_crtc *crtc)
{
struct drm_device *dev = crtc->dev;
struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
if (!iga->cursor_kmap.bo) {
return;
@@ -339,7 +344,8 @@ static int via_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
{
struct drm_device *dev = crtc->dev;
struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
unsigned char xoff = 0, yoff = 0;
int xpos = x, ypos = y;
@@ -386,7 +392,8 @@ static int via_iga1_gamma_set(struct drm_crtc *crtc,
uint32_t size,
struct drm_modeset_acquire_ctx *ctx)
{
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
int end = (size > 256) ? 256 : size, i;
u8 val, sr1a = vga_rseq(VGABASE, 0x1A);
@@ -442,7 +449,8 @@ static int via_iga2_gamma_set(struct drm_crtc *crtc,
uint32_t size,
struct drm_modeset_acquire_ctx *ctx)
{
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
int end = (size > 256) ? 256 : size, i;
u8 sr1a = vga_rseq(VGABASE, 0x1A);
@@ -549,7 +557,8 @@ static const struct drm_crtc_funcs via_iga2_funcs = {
.destroy = via_crtc_destroy,
};
-static void via_load_vpit_regs(struct via_device *dev_priv)
+static void via_load_vpit_regs(
+ struct openchrome_drm_private *dev_private)
{
u8 ar[] = {0x00, 0x01, 0x02, 0x03,
0x04, 0x05, 0x06, 0x07,
@@ -584,11 +593,12 @@ static void via_load_vpit_regs(struct via_device *dev_priv)
vga_w(VGABASE, VGA_ATT_W, BIT(5));
}
-static void via_iga1_display_fifo_regs(struct drm_device *dev,
- struct via_device *dev_priv,
- struct via_crtc *iga,
- struct drm_display_mode *mode,
- struct drm_framebuffer *fb)
+static void via_iga1_display_fifo_regs(
+ struct drm_device *dev,
+ struct openchrome_drm_private *dev_private,
+ struct via_crtc *iga,
+ struct drm_display_mode *mode,
+ struct drm_framebuffer *fb)
{
u32 reg_value;
unsigned int fifo_max_depth;
@@ -601,7 +611,7 @@ static void via_iga1_display_fifo_regs(struct drm_device *dev,
switch (dev->pdev->device) {
case PCI_DEVICE_ID_VIA_CLE266:
- if (dev_priv->revision == CLE266_REVISION_AX) {
+ if (dev_private->revision == CLE266_REVISION_AX) {
if (mode->hdisplay > 1024) {
/* SR17[6:0] */
fifo_max_depth = 96;
@@ -626,7 +636,7 @@ static void via_iga1_display_fifo_regs(struct drm_device *dev,
enable_extended_display_fifo = false;
}
- if (dev_priv->vram_type <= VIA_MEM_DDR_200) {
+ if (dev_private->vram_type <= VIA_MEM_DDR_200) {
if (fb->format->depth == 32) {
if (mode->hdisplay > 1024) {
if (mode->vdisplay > 768) {
@@ -667,7 +677,7 @@ static void via_iga1_display_fifo_regs(struct drm_device *dev,
display_queue_expire_num = 124;
}
}
- /* dev_priv->revision == CLE266_REVISION_CX */
+ /* dev_private->revision == CLE266_REVISION_CX */
} else {
if (mode->hdisplay >= 1024) {
/* SR17[6:0] */
@@ -693,7 +703,7 @@ static void via_iga1_display_fifo_regs(struct drm_device *dev,
enable_extended_display_fifo = false;
}
- if (dev_priv->vram_type <= VIA_MEM_DDR_200) {
+ if (dev_private->vram_type <= VIA_MEM_DDR_200) {
if (mode->hdisplay > 1024) {
if (mode->vdisplay > 768) {
/* SR22[4:0] */
@@ -723,7 +733,7 @@ static void via_iga1_display_fifo_regs(struct drm_device *dev,
case PCI_DEVICE_ID_VIA_KM400:
if ((mode->hdisplay >= 1600) &&
- (dev_priv->vram_type <= VIA_MEM_DDR_200)) {
+ (dev_private->vram_type <= VIA_MEM_DDR_200)) {
/* SR17[6:0] */
fifo_max_depth = 58;
@@ -745,7 +755,7 @@ static void via_iga1_display_fifo_regs(struct drm_device *dev,
enable_extended_display_fifo = false;
- if (dev_priv->vram_type <= VIA_MEM_DDR_200) {
+ if (dev_private->vram_type <= VIA_MEM_DDR_200) {
if (mode->hdisplay >= 1600) {
/* SR22[4:0] */
display_queue_expire_num = 16;
@@ -977,11 +987,12 @@ static void via_iga1_display_fifo_regs(struct drm_device *dev,
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
-static void via_iga2_display_fifo_regs(struct drm_device *dev,
- struct via_device *dev_priv,
- struct via_crtc *iga,
- struct drm_display_mode *mode,
- struct drm_framebuffer *fb)
+static void via_iga2_display_fifo_regs(
+ struct drm_device *dev,
+ struct openchrome_drm_private *dev_private,
+ struct via_crtc *iga,
+ struct drm_display_mode *mode,
+ struct drm_framebuffer *fb)
{
u32 reg_value;
unsigned int fifo_max_depth;
@@ -994,11 +1005,11 @@ static void via_iga2_display_fifo_regs(struct drm_device *dev,
switch (dev->pdev->device) {
case PCI_DEVICE_ID_VIA_CLE266:
- if (dev_priv->revision == CLE266_REVISION_AX) {
- if (((dev_priv->vram_type <= VIA_MEM_DDR_200) &&
+ if (dev_private->revision == CLE266_REVISION_AX) {
+ if (((dev_private->vram_type <= VIA_MEM_DDR_200) &&
(fb->format->depth > 16) &&
(mode->vdisplay > 768)) ||
- ((dev_priv->vram_type <= VIA_MEM_DDR_266) &&
+ ((dev_private->vram_type <= VIA_MEM_DDR_266) &&
(fb->format->depth > 16) &&
(mode->hdisplay > 1280))) {
/* CR68[7:4] */
@@ -1017,7 +1028,7 @@ static void via_iga2_display_fifo_regs(struct drm_device *dev,
enable_extended_display_fifo = false;
}
- /* dev_priv->revision == CLE266_REVISION_CX */
+ /* dev_private->revision == CLE266_REVISION_CX */
} else {
if (mode->hdisplay >= 1024) {
/* CR68[7:4] */
@@ -1051,11 +1062,11 @@ static void via_iga2_display_fifo_regs(struct drm_device *dev,
enable_extended_display_fifo = true;
} else if (((mode->hdisplay > 1024) &&
- (fb->format->depth == 32) &&
- (dev_priv->vram_type <= VIA_MEM_DDR_333)) ||
- ((mode->hdisplay == 1024) &&
- (fb->format->depth == 32) &&
- (dev_priv->vram_type <= VIA_MEM_DDR_200))) {
+ (fb->format->depth == 32) &&
+ (dev_private->vram_type <= VIA_MEM_DDR_333)) ||
+ ((mode->hdisplay == 1024) &&
+ (fb->format->depth == 32) &&
+ (dev_private->vram_type <= VIA_MEM_DDR_200))) {
/* CR68[7:4] */
fifo_max_depth = 104;
@@ -1064,11 +1075,11 @@ static void via_iga2_display_fifo_regs(struct drm_device *dev,
enable_extended_display_fifo = true;
} else if (((mode->hdisplay > 1280) &&
- (fb->format->depth == 16) &&
- (dev_priv->vram_type <= VIA_MEM_DDR_333)) ||
- ((mode->hdisplay == 1280) &&
- (fb->format->depth == 16) &&
- (dev_priv->vram_type <= VIA_MEM_DDR_200))) {
+ (fb->format->depth == 16) &&
+ (dev_private->vram_type <= VIA_MEM_DDR_333)) ||
+ ((mode->hdisplay == 1280) &&
+ (fb->format->depth == 16) &&
+ (dev_private->vram_type <= VIA_MEM_DDR_200))) {
/* CR68[7:4] */
fifo_max_depth = 88;
@@ -1290,7 +1301,8 @@ via_load_crtc_pixel_timing(struct drm_crtc *crtc,
struct drm_display_mode *mode)
{
struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
u32 reg_value = 0;
reg_value = IGA1_PIXELTIMING_HOR_TOTAL_FORMULA(mode->crtc_htotal);
@@ -1364,7 +1376,8 @@ via_load_crtc_pixel_timing(struct drm_crtc *crtc,
void
via_load_crtc_timing(struct via_crtc *iga, struct drm_display_mode *mode)
{
- struct via_device *dev_priv = iga->base.dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ iga->base.dev->dev_private;
struct drm_device *dev = iga->base.dev;
u32 reg_value = 0;
@@ -1461,7 +1474,8 @@ void
via_set_scale_path(struct drm_crtc *crtc, u32 scale_type)
{
struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
u8 reg_cr_fd = vga_rcrt(VGABASE, 0xFD);
struct drm_device *dev = crtc->dev;
@@ -1506,7 +1520,8 @@ static void
via_disable_iga_scaling(struct drm_crtc *crtc)
{
struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
if (iga->index) {
/* IGA2 scalings disable */
@@ -1552,7 +1567,8 @@ bool
via_set_iga_scale_function(struct drm_crtc *crtc, u32 scale_type)
{
struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
if (!(scale_type & (VIA_SHRINK + VIA_EXPAND)))
return false;
@@ -1635,11 +1651,11 @@ via_set_iga_scale_function(struct drm_crtc *crtc, u32 scale_type)
* 2. load scale factors into registers
* 3. enable H or V scale ( set CRA2 bit7 or bit3 )
*/
-bool
-via_load_iga_scale_factor_regs(struct via_device *dev_priv,
- struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode,
- u32 scale_type, u32 is_hor_or_ver)
+bool via_load_iga_scale_factor_regs(
+ struct openchrome_drm_private *dev_private,
+ struct drm_display_mode *mode,
+ struct drm_display_mode *adjusted_mode,
+ u32 scale_type, u32 is_hor_or_ver)
{
u32 dst_hor_regs = adjusted_mode->crtc_hdisplay;
u32 dst_ver_regs = adjusted_mode->crtc_vdisplay;
@@ -1779,7 +1795,8 @@ drm_mode_crtc_load_lut(struct drm_crtc *crtc)
static void
via_iga1_crtc_dpms(struct drm_crtc *crtc, int mode)
{
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -1919,7 +1936,8 @@ via_iga1_crtc_mode_set(struct drm_crtc *crtc,
int x, int y, struct drm_framebuffer *fb)
{
struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
struct drm_device *dev = crtc->dev;
u8 reg_value = 0;
int ret;
@@ -1934,7 +1952,7 @@ via_iga1_crtc_mode_set(struct drm_crtc *crtc,
}
/* Load standard registers */
- via_load_vpit_regs(dev_priv);
+ via_load_vpit_regs(dev_private);
/* Unlock */
via_unlock_crtc(VGABASE, dev->pdev->device);
@@ -1977,7 +1995,7 @@ via_iga1_crtc_mode_set(struct drm_crtc *crtc,
via_iga1_set_hsync_shift(VGABASE, 0x05);
/* Load display FIFO. */
- via_iga1_display_fifo_regs(dev, dev_priv, iga,
+ via_iga1_display_fifo_regs(dev, dev_private, iga,
adjusted_mode, crtc->primary->fb);
/* Set PLL */
@@ -2010,7 +2028,8 @@ via_iga1_mode_set_base_atomic(struct drm_crtc *crtc,
u32 pitch = y * fb->pitches[0] +
((x * fb->format->cpp[0] * 8) >> 3), addr;
struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
struct via_framebuffer *via_fb = container_of(fb,
struct via_framebuffer, fb);
struct drm_gem_object *gem_obj = via_fb->gem_obj;
@@ -2028,7 +2047,7 @@ via_iga1_mode_set_base_atomic(struct drm_crtc *crtc,
/* Set palette LUT to 8-bit mode. */
via_iga1_set_palette_lut_resolution(VGABASE, true);
- via_iga1_set_color_depth(dev_priv, fb->format->depth);
+ via_iga1_set_color_depth(dev_private, fb->format->depth);
/* Set the framebuffer offset */
addr = round_up(bo->offset + pitch, 16) >> 1;
@@ -2055,7 +2074,8 @@ via_iga1_mode_set_base_atomic(struct drm_crtc *crtc,
static void
via_iga2_crtc_dpms(struct drm_crtc *crtc, int mode)
{
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -2193,7 +2213,8 @@ via_iga2_crtc_mode_set(struct drm_crtc *crtc,
int x, int y, struct drm_framebuffer *fb)
{
struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
struct drm_device *dev = crtc->dev;
int ret;
@@ -2207,7 +2228,7 @@ via_iga2_crtc_mode_set(struct drm_crtc *crtc,
}
/* Load standard registers */
- via_load_vpit_regs(dev_priv);
+ via_load_vpit_regs(dev_private);
/* Unlock */
via_unlock_crtc(VGABASE, dev->pdev->device);
@@ -2227,7 +2248,7 @@ via_iga2_crtc_mode_set(struct drm_crtc *crtc,
* because crtc_vdisplay=540, vdisplay=1080,
* we need 540 here, not 1080.
*/
- via_load_iga_scale_factor_regs(dev_priv,
+ via_load_iga_scale_factor_regs(dev_private,
mode, adjusted_mode,
VIA_SHRINK,
HOR_VER_SCALE);
@@ -2256,7 +2277,8 @@ via_iga2_crtc_mode_set(struct drm_crtc *crtc,
if (iga->scaling_mode & VIA_HOR_EXPAND) {
via_set_iga_scale_function(crtc,
VIA_HOR_EXPAND);
- via_load_iga_scale_factor_regs(dev_priv,
+ via_load_iga_scale_factor_regs(
+ dev_private,
mode, adjusted_mode,
VIA_EXPAND,
HOR_SCALE);
@@ -2266,7 +2288,8 @@ via_iga2_crtc_mode_set(struct drm_crtc *crtc,
if (iga->scaling_mode & VIA_VER_EXPAND) {
via_set_iga_scale_function(crtc,
VIA_VER_EXPAND);
- via_load_iga_scale_factor_regs(dev_priv,
+ via_load_iga_scale_factor_regs(
+ dev_private,
mode, adjusted_mode,
VIA_EXPAND,
VER_SCALE);
@@ -2282,7 +2305,7 @@ via_iga2_crtc_mode_set(struct drm_crtc *crtc,
adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE);
/* Load display FIFO. */
- via_iga2_display_fifo_regs(dev, dev_priv, iga,
+ via_iga2_display_fifo_regs(dev, dev_private, iga,
adjusted_mode, crtc->primary->fb);
/* Set PLL */
@@ -2315,7 +2338,8 @@ via_iga2_mode_set_base_atomic(struct drm_crtc *crtc,
u32 pitch = y * fb->pitches[0] +
((x * fb->format->cpp[0] * 8) >> 3), addr;
struct via_crtc *iga = container_of(crtc, struct via_crtc, base);
- struct via_device *dev_priv = crtc->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ crtc->dev->dev_private;
struct via_framebuffer *via_fb = container_of(fb,
struct via_framebuffer, fb);
struct drm_gem_object *gem_obj = via_fb->gem_obj;
@@ -2333,7 +2357,7 @@ via_iga2_mode_set_base_atomic(struct drm_crtc *crtc,
/* Set palette LUT to 8-bit mode. */
via_iga2_set_palette_lut_resolution(VGABASE, true);
- via_iga2_set_color_depth(dev_priv, fb->format->depth);
+ via_iga2_set_color_depth(dev_private, fb->format->depth);
/* Set the framebuffer offset */
addr = round_up(bo->offset + pitch, 16);
@@ -2381,8 +2405,9 @@ static const struct drm_crtc_helper_funcs via_iga2_helper_funcs = {
void
via_crtc_init(struct drm_device *dev, int index)
{
- struct via_device *dev_priv = dev->dev_private;
- struct via_crtc *iga = &dev_priv->iga[index];
+ struct openchrome_drm_private *dev_private =
+ dev->dev_private;
+ struct via_crtc *iga = &dev_private->iga[index];
struct drm_crtc *crtc = &iga->base;
int cursor_size = 64 * 64 * 4, i;
u16 *gamma;
@@ -2557,7 +2582,7 @@ via_crtc_init(struct drm_device *dev, int index)
|| dev->pdev->device == PCI_DEVICE_ID_VIA_KM400)
cursor_size = 32 * 32 * 4;
- if (via_ttm_allocate_kernel_buffer(&dev_priv->ttm.bdev,
+ if (via_ttm_allocate_kernel_buffer(&dev_private->ttm.bdev,
cursor_size, 16,
TTM_PL_FLAG_VRAM, &iga->cursor_kmap))
DRM_ERROR("failed to create cursor\n");
diff --git a/drivers/gpu/drm/openchrome/openchrome_display.c b/drivers/gpu/drm/openchrome/openchrome_display.c
index 28d3f86c87d9..86c56b27cd87 100644
--- a/drivers/gpu/drm/openchrome/openchrome_display.c
+++ b/drivers/gpu/drm/openchrome/openchrome_display.c
@@ -35,7 +35,8 @@ void
via_encoder_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;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
struct drm_device *dev = encoder->dev;
struct via_crtc *iga = NULL;
u8 value = 0;
@@ -151,7 +152,8 @@ void
via_encoder_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;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
/* First turn off the display */
encoder->helper_private->dpms(encoder, DRM_MODE_DPMS_OFF);
@@ -202,7 +204,8 @@ via_set_sync_polarity(struct drm_encoder *encoder, struct drm_display_mode *mode
struct drm_display_mode *adjusted_mode)
{
struct via_encoder *enc = container_of(encoder, struct via_encoder, base);
- struct via_device *dev_priv = encoder->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
u8 syncreg = 0;
if (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC)
@@ -339,7 +342,7 @@ static struct td_timer td_timer_regs[] = {
static void
via_init_td_timing_regs(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
unsigned int td_timer[4] = { 500, 50, 0, 510 }, i;
struct vga_registers timings;
u32 reg_value;
@@ -371,8 +374,7 @@ via_init_td_timing_regs(struct drm_device *dev)
}
}
-static void
-via_i2c_reg_init(struct via_device *dev_priv)
+static void via_i2c_reg_init(struct openchrome_drm_private *dev_private)
{
svga_wseq_mask(VGABASE, 0x31, 0x30, 0x30);
svga_wseq_mask(VGABASE, 0x26, 0x30, 0x30);
@@ -383,7 +385,7 @@ via_i2c_reg_init(struct via_device *dev_priv)
}
static void
-via_hwcursor_init(struct via_device *dev_priv)
+via_hwcursor_init(struct openchrome_drm_private *dev_private)
{
/* set 0 as transparent color key */
VIA_WRITE(PRIM_HI_TRANSCOLOR, 0);
@@ -405,7 +407,7 @@ via_hwcursor_init(struct via_device *dev_priv)
static void
via_init_crtc_regs(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
via_unlock_crtc(VGABASE, dev->pdev->device);
@@ -434,7 +436,7 @@ via_init_crtc_regs(struct drm_device *dev)
svga_wcrt_mask(VGABASE, 0x33, 0x00, BIT(3));
if ((dev->pdev->device == PCI_DEVICE_ID_VIA_CLE266) &&
- (dev_priv->revision == CLE266_REVISION_AX))
+ (dev_private->revision == CLE266_REVISION_AX))
svga_wseq_mask(VGABASE, 0x1A, BIT(1), BIT(1));
via_lock_crtc(VGABASE);
@@ -443,7 +445,7 @@ via_init_crtc_regs(struct drm_device *dev)
static void
via_display_init(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
u8 index = 0x3D, value;
/* Check if spread spectrum is enabled */
@@ -458,9 +460,9 @@ via_display_init(struct drm_device *dev)
value = vga_rseq(VGABASE, 0x1E);
vga_wseq(VGABASE, 0x1E, value & 0xF7);
- dev_priv->spread_spectrum = true;
+ dev_private->spread_spectrum = true;
} else
- dev_priv->spread_spectrum = false;
+ dev_private->spread_spectrum = false;
/* Load fixed CRTC timing registers */
via_init_crtc_regs(dev);
@@ -476,7 +478,7 @@ via_display_init(struct drm_device *dev)
int
via_modeset_init(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
int ret = 0;
int i;
@@ -488,13 +490,13 @@ via_modeset_init(struct drm_device *dev)
dev->mode_config.max_height = 4096;
/* Initialize the number of display connectors. */
- dev_priv->number_fp = 0;
- dev_priv->number_dvi = 0;
+ dev_private->number_fp = 0;
+ dev_private->number_dvi = 0;
via_display_init(dev);
- via_i2c_reg_init(dev_priv);
+ via_i2c_reg_init(dev_private);
via_i2c_init(dev);
- via_hwcursor_init(dev_priv);
+ via_hwcursor_init(dev_private);
for (i = 0; i < 2; i++)
via_crtc_init(dev, i);
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.c b/drivers/gpu/drm/openchrome/openchrome_drv.c
index d8db079c8805..33c0eac36e16 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.c
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.c
@@ -66,7 +66,7 @@ MODULE_DEVICE_TABLE(pci, via_pci_table);
static int via_detect_agp(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
struct drm_agp_info agp_info;
struct drm_agp_mode mode;
int ret = 0;
@@ -98,7 +98,7 @@ static int via_detect_agp(struct drm_device *dev)
goto out_err0;
}
- ret = ttm_bo_init_mm(&dev_priv->ttm.bdev, TTM_PL_TT,
+ ret = ttm_bo_init_mm(&dev_private->ttm.bdev, TTM_PL_TT,
agp_info.aperture_size >> PAGE_SHIFT);
if (!ret) {
DRM_INFO("Detected %lu MB of AGP Aperture at "
@@ -114,7 +114,8 @@ out_err0:
return ret;
}
-static void via_agp_engine_init(struct via_device *dev_priv)
+static void via_agp_engine_init(
+ struct openchrome_drm_private *dev_private)
{
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -135,9 +136,10 @@ static void via_agp_engine_init(struct via_device *dev_priv)
}
#endif
-static int openchrome_mmio_init(struct via_device *dev_priv)
+static int openchrome_mmio_init(
+ struct openchrome_drm_private *dev_private)
{
- struct drm_device *dev = dev_priv->dev;
+ struct drm_device *dev = dev_private->dev;
int ret = 0;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -148,36 +150,38 @@ static int openchrome_mmio_init(struct via_device *dev_priv)
* Obtain the starting base address and size, and
* map it to the OS for use.
*/
- dev_priv->mmio_base = pci_resource_start(dev->pdev, 1);
- dev_priv->mmio_size = pci_resource_len(dev->pdev, 1);
- dev_priv->mmio = ioremap(dev_priv->mmio_base,
- dev_priv->mmio_size);
- if (!dev_priv->mmio) {
+ dev_private->mmio_base = pci_resource_start(dev->pdev, 1);
+ dev_private->mmio_size = pci_resource_len(dev->pdev, 1);
+ dev_private->mmio = ioremap(dev_private->mmio_base,
+ dev_private->mmio_size);
+ if (!dev_private->mmio) {
ret = -ENOMEM;
goto exit;
}
DRM_INFO("VIA Technologies Chrome IGP MMIO Physical Address: "
"0x%08llx\n",
- dev_priv->mmio_base);
+ dev_private->mmio_base);
exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
return ret;
}
-static void openchrome_mmio_fini(struct via_device *dev_priv)
+static void openchrome_mmio_fini(
+ struct openchrome_drm_private *dev_private)
{
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- if (dev_priv->mmio) {
- iounmap(dev_priv->mmio);
- dev_priv->mmio = NULL;
+ if (dev_private->mmio) {
+ iounmap(dev_private->mmio);
+ dev_private->mmio = NULL;
}
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
-static void openchrome_graphics_unlock(struct via_device *dev_priv)
+static void openchrome_graphics_unlock(
+ struct openchrome_drm_private *dev_private)
{
uint8_t temp;
@@ -205,9 +209,10 @@ static void openchrome_graphics_unlock(struct via_device *dev_priv)
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
-static void chip_revision_info(struct via_device *dev_priv)
+static void chip_revision_info(
+ struct openchrome_drm_private *dev_private)
{
- struct drm_device *dev = dev_priv->dev;
+ struct drm_device *dev = dev_private->dev;
struct pci_bus *bus = NULL;
u16 device_id, subsystem_vendor_id, subsystem_device_id;
u8 tmp;
@@ -284,9 +289,9 @@ static void chip_revision_info(struct via_device *dev_priv)
tmp = vga_rcrt(VGABASE, 0x4F);
vga_wcrt(VGABASE, 0x4F, 0x55);
if (vga_rcrt(VGABASE, 0x4F) != 0x55) {
- dev_priv->revision = CLE266_REVISION_AX;
+ dev_private->revision = CLE266_REVISION_AX;
} else {
- dev_priv->revision = CLE266_REVISION_CX;
+ dev_private->revision = CLE266_REVISION_CX;
}
/* Restore original CR4F value. */
@@ -296,11 +301,11 @@ static void chip_revision_info(struct via_device *dev_priv)
case PCI_DEVICE_ID_VIA_VT3157:
tmp = vga_rseq(VGABASE, 0x43);
if (tmp & 0x02) {
- dev_priv->revision = CX700_REVISION_700M2;
+ dev_private->revision = CX700_REVISION_700M2;
} else if (tmp & 0x40) {
- dev_priv->revision = CX700_REVISION_700M;
+ dev_private->revision = CX700_REVISION_700M;
} else {
- dev_priv->revision = CX700_REVISION_700;
+ dev_private->revision = CX700_REVISION_700;
}
/* Check for VIA Technologies NanoBook reference
@@ -309,9 +314,9 @@ static void chip_revision_info(struct via_device *dev_priv)
* availability of DVI. */
if ((subsystem_vendor_id == 0x1509) &&
(subsystem_device_id == 0x2d30)) {
- dev_priv->is_via_nanobook = true;
+ dev_private->is_via_nanobook = true;
} else {
- dev_priv->is_via_nanobook = false;
+ dev_private->is_via_nanobook = false;
}
break;
@@ -323,9 +328,9 @@ static void chip_revision_info(struct via_device *dev_priv)
* Video Port 1) rather than its LVDS channel. */
if ((subsystem_vendor_id == 0x152d) &&
(subsystem_device_id == 0x0771)) {
- dev_priv->is_quanta_il1 = true;
+ dev_private->is_quanta_il1 = true;
} else {
- dev_priv->is_quanta_il1 = false;
+ dev_private->is_quanta_il1 = false;
}
/* Samsung NC20 netbook has its FP connected to LVDS2
@@ -334,9 +339,9 @@ static void chip_revision_info(struct via_device *dev_priv)
* FP. */
if ((subsystem_vendor_id == 0x144d) &&
(subsystem_device_id == 0xc04e)) {
- dev_priv->is_samsung_nc20 = true;
+ dev_private->is_samsung_nc20 = true;
} else {
- dev_priv->is_samsung_nc20 = false;
+ dev_private->is_samsung_nc20 = false;
}
break;
@@ -344,7 +349,7 @@ static void chip_revision_info(struct via_device *dev_priv)
case PCI_DEVICE_ID_VIA_VX875:
/* VX900 Chipset */
case PCI_DEVICE_ID_VIA_VX900_VGA:
- dev_priv->revision = vga_rseq(VGABASE, 0x3B);
+ dev_private->revision = vga_rseq(VGABASE, 0x3B);
break;
default:
break;
@@ -361,7 +366,7 @@ static int via_dumb_create(struct drm_file *filp,
struct drm_device *dev,
struct drm_mode_create_dumb *args)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
struct drm_gem_object *obj;
int ret;
@@ -369,7 +374,7 @@ static int via_dumb_create(struct drm_file *filp,
args->pitch = round_up(args->width * (args->bpp >> 3), 16);
args->size = args->pitch * args->height;
- obj = ttm_gem_create(dev, &dev_priv->ttm.bdev, args->size,
+ obj = ttm_gem_create(dev, &dev_private->ttm.bdev, args->size,
ttm_bo_type_device, TTM_PL_FLAG_VRAM,
16, PAGE_SIZE, false);
if (IS_ERR(obj))
@@ -420,28 +425,29 @@ static int gem_dumb_destroy(struct drm_file *filp,
return ret;
}
-static void openchrome_flag_init(struct via_device *dev_priv)
+static void openchrome_flag_init(
+ struct openchrome_drm_private *dev_private)
{
DRM_DEBUG_KMS("Entered %s.\n", __func__);
/*
* Special handling flags for a few special models.
*/
- dev_priv->is_via_nanobook = false;
- dev_priv->is_quanta_il1 = false;
+ dev_private->is_via_nanobook = false;
+ dev_private->is_quanta_il1 = false;
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
-static int via_device_init(struct via_device *dev_priv)
+static int via_device_init(struct openchrome_drm_private *dev_private)
{
int ret;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- openchrome_flag_init(dev_priv);
+ openchrome_flag_init(dev_private);
- ret = via_vram_detect(dev_priv);
+ ret = via_vram_detect(dev_private);
if (ret) {
DRM_ERROR("Failed to detect video RAM.\n");
goto exit;
@@ -450,19 +456,19 @@ static int via_device_init(struct via_device *dev_priv)
/*
* Map VRAM.
*/
- ret = openchrome_vram_init(dev_priv);
+ ret = openchrome_vram_init(dev_private);
if (ret) {
DRM_ERROR("Failed to initialize video RAM.\n");
goto exit;
}
- ret = openchrome_mmio_init(dev_priv);
+ ret = openchrome_mmio_init(dev_private);
if (ret) {
DRM_ERROR("Failed to initialize MMIO.\n");
goto exit;
}
- openchrome_graphics_unlock(dev_priv);
+ openchrome_graphics_unlock(dev_private);
exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
return ret;
@@ -470,7 +476,7 @@ exit:
static void via_driver_unload(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
struct ttm_buffer_object *bo;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -478,18 +484,18 @@ static void via_driver_unload(struct drm_device *dev)
if (drm_core_check_feature(dev, DRIVER_MODESET))
via_modeset_fini(dev);
- bo = dev_priv->vq.bo;
+ bo = dev_private->vq.bo;
if (bo) {
- via_bo_unpin(bo, &dev_priv->vq);
+ via_bo_unpin(bo, &dev_private->vq);
ttm_bo_unref(&bo);
}
- bo = dev_priv->gart.bo;
+ bo = dev_private->gart.bo;
if (bo) {
/* enable gtt write */
if (pci_is_pcie(dev->pdev))
svga_wseq_mask(VGABASE, 0x6C, 0, BIT(7));
- via_bo_unpin(bo, &dev_priv->gart);
+ via_bo_unpin(bo, &dev_private->gart);
ttm_bo_unref(&bo);
}
@@ -498,15 +504,15 @@ static void via_driver_unload(struct drm_device *dev)
/*
* Unmap VRAM.
*/
- openchrome_vram_fini(dev_priv);
+ openchrome_vram_fini(dev_private);
- openchrome_mmio_fini(dev_priv);
+ openchrome_mmio_fini(dev_private);
#if IS_ENABLED(CONFIG_AGP)
if (dev->agp && dev->agp->acquired)
drm_agp_release(dev);
#endif
- kfree(dev_priv);
+ kfree(dev_private);
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
return;
@@ -515,55 +521,57 @@ static void via_driver_unload(struct drm_device *dev)
static int via_driver_load(struct drm_device *dev,
unsigned long chipset)
{
- struct via_device *dev_priv;
+ struct openchrome_drm_private *dev_private;
int ret = 0;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- dev_priv = kzalloc(sizeof(struct via_device), GFP_KERNEL);
- if (!dev_priv) {
+ dev_private = kzalloc(sizeof(struct openchrome_drm_private),
+ GFP_KERNEL);
+ if (!dev_private) {
ret = -ENOMEM;
DRM_ERROR("Failed to allocate private "
"storage memory.\n");
goto exit;
}
- dev->dev_private = (void *)dev_priv;
- dev_priv->engine_type = chipset;
- dev_priv->vram_mtrr = -ENXIO;
- dev_priv->dev = dev;
+ dev->dev_private = (void *) dev_private;
+ dev_private->engine_type = chipset;
+ dev_private->vram_mtrr = -ENXIO;
+ dev_private->dev = dev;
- ret = via_device_init(dev_priv);
+ ret = via_device_init(dev_private);
if (ret) {
DRM_ERROR("Failed to initialize Chrome IGP.\n");
goto init_error;
}
- ret = via_mm_init(dev_priv);
+ ret = via_mm_init(dev_private);
if (ret) {
DRM_ERROR("Failed to initialize TTM.\n");
goto init_error;
}
- chip_revision_info(dev_priv);
+ chip_revision_info(dev_private);
#if IS_ENABLED(CONFIG_AGP)
- if ((dev_priv->engine_type <= VIA_ENG_H2) ||
+ if ((dev_private->engine_type <= VIA_ENG_H2) ||
(dev->agp &&
pci_find_capability(dev->pdev, PCI_CAP_ID_AGP))) {
ret = via_detect_agp(dev);
if (!ret)
- via_agp_engine_init(dev_priv);
+ via_agp_engine_init(dev_private);
else
DRM_ERROR("Failed to allocate AGP.\n");
}
#endif
if (pci_is_pcie(dev->pdev)) {
/* Allocate GART. */
- ret = via_ttm_allocate_kernel_buffer(&dev_priv->ttm.bdev,
+ ret = via_ttm_allocate_kernel_buffer(
+ &dev_private->ttm.bdev,
SGDMA_MEMORY, 16,
TTM_PL_FLAG_VRAM,
- &dev_priv->gart);
+ &dev_private->gart);
if (likely(!ret)) {
DRM_INFO("Allocated %u KB of DMA memory.\n",
SGDMA_MEMORY >> 10);
@@ -574,10 +582,10 @@ static int via_driver_load(struct drm_device *dev,
}
/* Allocate VQ. (Virtual Queue) */
- ret = via_ttm_allocate_kernel_buffer(&dev_priv->ttm.bdev,
+ ret = via_ttm_allocate_kernel_buffer(&dev_private->ttm.bdev,
VQ_MEMORY, 16,
TTM_PL_FLAG_VRAM,
- &dev_priv->vq);
+ &dev_private->vq);
if (likely(!ret)) {
DRM_INFO("Allocated %u KB of VQ (Virtual Queue) "
"memory.\n", VQ_MEMORY >> 10);
@@ -621,12 +629,13 @@ static int via_pm_ops_suspend(struct device *dev)
{
struct pci_dev *pdev = to_pci_dev(dev);
struct drm_device *drm_dev = pci_get_drvdata(pdev);
- struct via_device *dev_priv = drm_dev->dev_private;
+ struct openchrome_drm_private *dev_private = drm_dev->dev_private;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
console_lock();
- drm_fb_helper_set_suspend(&dev_priv->via_fbdev->helper, true);
+ drm_fb_helper_set_suspend(&dev_private->via_fbdev->helper,
+ true);
/*
* Frame Buffer Size Control register (SR14) and GTI registers
@@ -638,29 +647,29 @@ static int via_pm_ops_suspend(struct device *dev)
if ((drm_dev->pdev->device == PCI_DEVICE_ID_VIA_VT1122) ||
(drm_dev->pdev->device == PCI_DEVICE_ID_VIA_VX875) ||
(drm_dev->pdev->device == PCI_DEVICE_ID_VIA_VX900_VGA)) {
- dev_priv->saved_sr14 = vga_rseq(VGABASE, 0x14);
-
- dev_priv->saved_sr66 = vga_rseq(VGABASE, 0x66);
- dev_priv->saved_sr67 = vga_rseq(VGABASE, 0x67);
- dev_priv->saved_sr68 = vga_rseq(VGABASE, 0x68);
- dev_priv->saved_sr69 = vga_rseq(VGABASE, 0x69);
- dev_priv->saved_sr6a = vga_rseq(VGABASE, 0x6a);
- dev_priv->saved_sr6b = vga_rseq(VGABASE, 0x6b);
- dev_priv->saved_sr6c = vga_rseq(VGABASE, 0x6c);
- dev_priv->saved_sr6d = vga_rseq(VGABASE, 0x6d);
- dev_priv->saved_sr6e = vga_rseq(VGABASE, 0x6e);
- dev_priv->saved_sr6f = vga_rseq(VGABASE, 0x6f);
+ dev_private->saved_sr14 = vga_rseq(VGABASE, 0x14);
+
+ dev_private->saved_sr66 = vga_rseq(VGABASE, 0x66);
+ dev_private->saved_sr67 = vga_rseq(VGABASE, 0x67);
+ dev_private->saved_sr68 = vga_rseq(VGABASE, 0x68);
+ dev_private->saved_sr69 = vga_rseq(VGABASE, 0x69);
+ dev_private->saved_sr6a = vga_rseq(VGABASE, 0x6a);
+ dev_private->saved_sr6b = vga_rseq(VGABASE, 0x6b);
+ dev_private->saved_sr6c = vga_rseq(VGABASE, 0x6c);
+ dev_private->saved_sr6d = vga_rseq(VGABASE, 0x6d);
+ dev_private->saved_sr6e = vga_rseq(VGABASE, 0x6e);
+ dev_private->saved_sr6f = vga_rseq(VGABASE, 0x6f);
}
/* 3X5.3B through 3X5.3F are scratch pad registers.
* They are important for FP detection.
* Their values need to be saved because they get lost
* when resuming from standby. */
- dev_priv->saved_cr3b = vga_rcrt(VGABASE, 0x3b);
- dev_priv->saved_cr3c = vga_rcrt(VGABASE, 0x3c);
- dev_priv->saved_cr3d = vga_rcrt(VGABASE, 0x3d);
- dev_priv->saved_cr3e = vga_rcrt(VGABASE, 0x3e);
- dev_priv->saved_cr3f = vga_rcrt(VGABASE, 0x3f);
+ dev_private->saved_cr3b = vga_rcrt(VGABASE, 0x3b);
+ dev_private->saved_cr3c = vga_rcrt(VGABASE, 0x3c);
+ dev_private->saved_cr3d = vga_rcrt(VGABASE, 0x3d);
+ dev_private->saved_cr3e = vga_rcrt(VGABASE, 0x3e);
+ dev_private->saved_cr3f = vga_rcrt(VGABASE, 0x3f);
console_unlock();
@@ -672,7 +681,8 @@ static int via_pm_ops_resume(struct device *dev)
{
struct pci_dev *pdev = to_pci_dev(dev);
struct drm_device *drm_dev = pci_get_drvdata(pdev);
- struct via_device *dev_priv = drm_dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ drm_dev->dev_private;
void __iomem *regs = ioport_map(0x3c0, 100);
u8 val;
@@ -706,32 +716,32 @@ static int via_pm_ops_resume(struct device *dev)
if ((drm_dev->pdev->device == PCI_DEVICE_ID_VIA_VT1122) ||
(drm_dev->pdev->device == PCI_DEVICE_ID_VIA_VX875) ||
(drm_dev->pdev->device == PCI_DEVICE_ID_VIA_VX900_VGA)) {
- vga_wseq(VGABASE, 0x14, dev_priv->saved_sr14);
-
- vga_wseq(VGABASE, 0x66, dev_priv->saved_sr66);
- vga_wseq(VGABASE, 0x67, dev_priv->saved_sr67);
- vga_wseq(VGABASE, 0x68, dev_priv->saved_sr68);
- vga_wseq(VGABASE, 0x69, dev_priv->saved_sr69);
- vga_wseq(VGABASE, 0x6a, dev_priv->saved_sr6a);
- vga_wseq(VGABASE, 0x6b, dev_priv->saved_sr6b);
- vga_wseq(VGABASE, 0x6c, dev_priv->saved_sr6c);
- vga_wseq(VGABASE, 0x6d, dev_priv->saved_sr6d);
- vga_wseq(VGABASE, 0x6e, dev_priv->saved_sr6e);
- vga_wseq(VGABASE, 0x6f, dev_priv->saved_sr6f);
+ vga_wseq(VGABASE, 0x14, dev_private->saved_sr14);
+
+ vga_wseq(VGABASE, 0x66, dev_private->saved_sr66);
+ vga_wseq(VGABASE, 0x67, dev_private->saved_sr67);
+ vga_wseq(VGABASE, 0x68, dev_private->saved_sr68);
+ vga_wseq(VGABASE, 0x69, dev_private->saved_sr69);
+ vga_wseq(VGABASE, 0x6a, dev_private->saved_sr6a);
+ vga_wseq(VGABASE, 0x6b, dev_private->saved_sr6b);
+ vga_wseq(VGABASE, 0x6c, dev_private->saved_sr6c);
+ vga_wseq(VGABASE, 0x6d, dev_private->saved_sr6d);
+ vga_wseq(VGABASE, 0x6e, dev_private->saved_sr6e);
+ vga_wseq(VGABASE, 0x6f, dev_private->saved_sr6f);
}
/* 3X5.3B through 3X5.3F are scratch pad registers.
* They are important for FP detection.
* Their values need to be restored because they are undefined
* after resuming from standby. */
- vga_wcrt(VGABASE, 0x3b, dev_priv->saved_cr3b);
- vga_wcrt(VGABASE, 0x3c, dev_priv->saved_cr3c);
- vga_wcrt(VGABASE, 0x3d, dev_priv->saved_cr3d);
- vga_wcrt(VGABASE, 0x3e, dev_priv->saved_cr3e);
- vga_wcrt(VGABASE, 0x3f, dev_priv->saved_cr3f);
+ vga_wcrt(VGABASE, 0x3b, dev_private->saved_cr3b);
+ vga_wcrt(VGABASE, 0x3c, dev_private->saved_cr3c);
+ vga_wcrt(VGABASE, 0x3d, dev_private->saved_cr3d);
+ vga_wcrt(VGABASE, 0x3e, dev_private->saved_cr3e);
+ vga_wcrt(VGABASE, 0x3f, dev_private->saved_cr3f);
drm_helper_resume_force_mode(drm_dev);
- drm_fb_helper_set_suspend(&dev_priv->via_fbdev->helper, false);
+ drm_fb_helper_set_suspend(&dev_private->via_fbdev->helper, false);
console_unlock();
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index f084a2f687c5..041e1bb2518c 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -133,7 +133,7 @@ enum via_engine {
VIA_ENG_H6S2
};
-struct via_device {
+struct openchrome_drm_private {
struct drm_device *dev;
struct via_ttm ttm;
@@ -246,7 +246,7 @@ struct via_device {
/* VIA MMIO register access */
-#define VIA_BASE ((dev_priv->mmio))
+#define VIA_BASE ((dev_private->mmio))
#define VIA_READ(reg) ioread32(VIA_BASE + reg)
#define VIA_WRITE(reg, val) iowrite32(val, VIA_BASE + reg)
@@ -265,11 +265,13 @@ extern int via_hdmi_audio;
extern void via_engine_init(struct drm_device *dev);
-extern int via_vram_detect(struct via_device *dev_priv);
-extern int openchrome_vram_init(struct via_device *dev_priv);
-extern void openchrome_vram_fini(struct via_device *dev_priv);
+extern int via_vram_detect(struct openchrome_drm_private *dev_private);
+extern int openchrome_vram_init(
+ struct openchrome_drm_private *dev_private);
+extern void openchrome_vram_fini(
+ struct openchrome_drm_private *dev_private);
-extern int via_mm_init(struct via_device *dev_priv);
+extern int via_mm_init(struct openchrome_drm_private *dev_private);
void via_mm_fini(struct drm_device *dev);
extern void ttm_placement_from_domain(struct ttm_buffer_object *bo,
struct ttm_placement *placement,
@@ -310,16 +312,17 @@ extern struct drm_gem_object* ttm_gem_create(struct drm_device *dev,
extern struct ttm_buffer_object* ttm_gem_mapping(
struct drm_gem_object *obj);
-void openchrome_transmitter_io_pad_state(struct via_device *dev_priv,
- uint32_t di_port, bool io_pad_on);
+void openchrome_transmitter_io_pad_state(
+ struct openchrome_drm_private *dev_private,
+ uint32_t di_port, bool io_pad_on);
void openchrome_transmitter_clock_drive_strength(
- struct via_device *dev_priv,
- u32 di_port, u8 drive_strength);
+ struct openchrome_drm_private *dev_private,
+ u32 di_port, u8 drive_strength);
void openchrome_transmitter_data_drive_strength(
- struct via_device *dev_priv,
- u32 di_port, u8 drive_strength);
+ struct openchrome_drm_private *dev_private,
+ u32 di_port, u8 drive_strength);
void openchrome_transmitter_display_source(
- struct via_device *dev_priv,
- u32 di_port, int index);
+ struct openchrome_drm_private *dev_private,
+ u32 di_port, int index);
#endif /* _OPENCHROME_DRV_H */
diff --git a/drivers/gpu/drm/openchrome/openchrome_encoder.c b/drivers/gpu/drm/openchrome/openchrome_encoder.c
index 22272f115492..d3728e83ab0c 100644
--- a/drivers/gpu/drm/openchrome/openchrome_encoder.c
+++ b/drivers/gpu/drm/openchrome/openchrome_encoder.c
@@ -30,8 +30,9 @@
#include "openchrome_drv.h"
-void openchrome_transmitter_io_pad_state(struct via_device *dev_priv,
- uint32_t di_port, bool io_pad_on)
+void openchrome_transmitter_io_pad_state(
+ struct openchrome_drm_private *dev_private,
+ uint32_t di_port, bool io_pad_on)
{
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -82,8 +83,8 @@ void openchrome_transmitter_io_pad_state(struct via_device *dev_priv,
}
void openchrome_transmitter_clock_drive_strength(
- struct via_device *dev_priv,
- u32 di_port, u8 drive_strength)
+ struct openchrome_drm_private *dev_private,
+ u32 di_port, u8 drive_strength)
{
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -104,8 +105,8 @@ void openchrome_transmitter_clock_drive_strength(
}
void openchrome_transmitter_data_drive_strength(
- struct via_device *dev_priv,
- u32 di_port, u8 drive_strength)
+ struct openchrome_drm_private *dev_private,
+ u32 di_port, u8 drive_strength)
{
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -126,8 +127,8 @@ void openchrome_transmitter_data_drive_strength(
}
void openchrome_transmitter_display_source(
- struct via_device *dev_priv,
- u32 di_port, int index)
+ struct openchrome_drm_private *dev_private,
+ u32 di_port, int index)
{
u8 display_source = index & 0x01;
diff --git a/drivers/gpu/drm/openchrome/openchrome_fb.c b/drivers/gpu/drm/openchrome/openchrome_fb.c
index 18e4a3bcf202..a9fcc179843e 100644
--- a/drivers/gpu/drm/openchrome/openchrome_fb.c
+++ b/drivers/gpu/drm/openchrome/openchrome_fb.c
@@ -26,8 +26,8 @@
#include "openchrome_drv.h"
-static int
-cle266_mem_type(struct via_device *dev_priv, struct pci_dev *bridge)
+static int cle266_mem_type(struct openchrome_drm_private *dev_private,
+ struct pci_dev *bridge)
{
u8 type, fsb, freq;
int ret;
@@ -96,13 +96,13 @@ cle266_mem_type(struct via_device *dev_priv, struct pci_dev *bridge)
case 0x00: /* SDR */
switch (freq) {
case 66:
- dev_priv->vram_type = VIA_MEM_SDR66;
+ dev_private->vram_type = VIA_MEM_SDR66;
break;
case 100:
- dev_priv->vram_type = VIA_MEM_SDR100;
+ dev_private->vram_type = VIA_MEM_SDR100;
break;
case 133:
- dev_priv->vram_type = VIA_MEM_SDR133;
+ dev_private->vram_type = VIA_MEM_SDR133;
default:
break;
}
@@ -111,10 +111,10 @@ cle266_mem_type(struct via_device *dev_priv, struct pci_dev *bridge)
case 0x02: /* DDR */
switch (freq) {
case 100:
- dev_priv->vram_type = VIA_MEM_DDR_200;
+ dev_private->vram_type = VIA_MEM_DDR_200;
break;
case 133:
- dev_priv->vram_type = VIA_MEM_DDR_266;
+ dev_private->vram_type = VIA_MEM_DDR_266;
default:
break;
}
@@ -124,8 +124,8 @@ cle266_mem_type(struct via_device *dev_priv, struct pci_dev *bridge)
return ret;
}
-static int
-km400_mem_type(struct via_device *dev_priv, struct pci_dev *bridge)
+static int km400_mem_type(struct openchrome_drm_private *dev_private,
+ struct pci_dev *bridge)
{
u8 fsb, freq, rev;
int ret;
@@ -150,16 +150,16 @@ km400_mem_type(struct via_device *dev_priv, struct pci_dev *bridge)
case 0x00:
switch (freq) {
case 0x00:
- dev_priv->vram_type = VIA_MEM_DDR_200;
+ dev_private->vram_type = VIA_MEM_DDR_200;
break;
case 0x01:
- dev_priv->vram_type = VIA_MEM_DDR_266;
+ dev_private->vram_type = VIA_MEM_DDR_266;
break;
case 0x02:
- dev_priv->vram_type = VIA_MEM_DDR_400;
+ dev_private->vram_type = VIA_MEM_DDR_400;
break;
case 0x03:
- dev_priv->vram_type = VIA_MEM_DDR_333;
+ dev_private->vram_type = VIA_MEM_DDR_333;
default:
break;
}
@@ -168,13 +168,13 @@ km400_mem_type(struct via_device *dev_priv, struct pci_dev *bridge)
case 0x01:
switch (freq) {
case 0x00:
- dev_priv->vram_type = VIA_MEM_DDR_266;
+ dev_private->vram_type = VIA_MEM_DDR_266;
break;
case 0x01:
- dev_priv->vram_type = VIA_MEM_DDR_333;
+ dev_private->vram_type = VIA_MEM_DDR_333;
break;
case 0x02:
- dev_priv->vram_type = VIA_MEM_DDR_400;
+ dev_private->vram_type = VIA_MEM_DDR_400;
default:
break;
}
@@ -184,13 +184,13 @@ km400_mem_type(struct via_device *dev_priv, struct pci_dev *bridge)
case 0x03:
switch (freq) {
case 0x00:
- dev_priv->vram_type = VIA_MEM_DDR_333;
+ dev_private->vram_type = VIA_MEM_DDR_333;
break;
case 0x02:
- dev_priv->vram_type = VIA_MEM_DDR_400;
+ dev_private->vram_type = VIA_MEM_DDR_400;
break;
case 0x03:
- dev_priv->vram_type = VIA_MEM_DDR_266;
+ dev_private->vram_type = VIA_MEM_DDR_266;
default:
break;
}
@@ -209,19 +209,19 @@ km400_mem_type(struct via_device *dev_priv, struct pci_dev *bridge)
case 0x00:
switch (freq) {
case 0x00:
- dev_priv->vram_type = VIA_MEM_DDR_200;
+ dev_private->vram_type = VIA_MEM_DDR_200;
break;
case 0x01:
- dev_priv->vram_type = VIA_MEM_DDR_266;
+ dev_private->vram_type = VIA_MEM_DDR_266;
break;
case 0x03:
- dev_priv->vram_type = VIA_MEM_DDR_333;
+ dev_private->vram_type = VIA_MEM_DDR_333;
break;
case 0x07:
- dev_priv->vram_type = VIA_MEM_DDR_400;
+ dev_private->vram_type = VIA_MEM_DDR_400;
break;
default:
- dev_priv->vram_type = VIA_MEM_NONE;
+ dev_private->vram_type = VIA_MEM_NONE;
break;
}
break;
@@ -229,13 +229,13 @@ km400_mem_type(struct via_device *dev_priv, struct pci_dev *bridge)
case 0x01:
switch (freq) {
case 0x00:
- dev_priv->vram_type = VIA_MEM_DDR_266;
+ dev_private->vram_type = VIA_MEM_DDR_266;
break;
case 0x01:
- dev_priv->vram_type = VIA_MEM_DDR_333;
+ dev_private->vram_type = VIA_MEM_DDR_333;
break;
case 0x03:
- dev_priv->vram_type = VIA_MEM_DDR_400;
+ dev_private->vram_type = VIA_MEM_DDR_400;
default:
break;
}
@@ -244,13 +244,13 @@ km400_mem_type(struct via_device *dev_priv, struct pci_dev *bridge)
case 0x02:
switch (freq) {
case 0x00:
- dev_priv->vram_type = VIA_MEM_DDR_400;
+ dev_private->vram_type = VIA_MEM_DDR_400;
break;
case 0x04:
- dev_priv->vram_type = VIA_MEM_DDR_333;
+ dev_private->vram_type = VIA_MEM_DDR_333;
break;
case 0x06:
- dev_priv->vram_type = VIA_MEM_DDR_266;
+ dev_private->vram_type = VIA_MEM_DDR_266;
default:
break;
}
@@ -259,13 +259,13 @@ km400_mem_type(struct via_device *dev_priv, struct pci_dev *bridge)
case 0x03:
switch (freq) {
case 0x00:
- dev_priv->vram_type = VIA_MEM_DDR_333;
+ dev_private->vram_type = VIA_MEM_DDR_333;
break;
case 0x01:
- dev_priv->vram_type = VIA_MEM_DDR_400;
+ dev_private->vram_type = VIA_MEM_DDR_400;
break;
case 0x04:
- dev_priv->vram_type = VIA_MEM_DDR_266;
+ dev_private->vram_type = VIA_MEM_DDR_266;
default:
break;
}
@@ -276,9 +276,9 @@ km400_mem_type(struct via_device *dev_priv, struct pci_dev *bridge)
return ret;
}
-static int
-p4m800_mem_type(struct via_device *dev_priv, struct pci_bus *bus,
- struct pci_dev *fn3)
+static int p4m800_mem_type(struct openchrome_drm_private *dev_private,
+ struct pci_bus *bus,
+ struct pci_dev *fn3)
{
struct pci_dev *fn4 = pci_get_slot(bus, PCI_DEVFN(0, 4));
int ret, freq = 0;
@@ -326,24 +326,23 @@ p4m800_mem_type(struct via_device *dev_priv, struct pci_bus *bus,
switch (freq) {
case 0x03:
- dev_priv->vram_type = VIA_MEM_DDR_200;
+ dev_private->vram_type = VIA_MEM_DDR_200;
break;
case 0x04:
- dev_priv->vram_type = VIA_MEM_DDR_266;
+ dev_private->vram_type = VIA_MEM_DDR_266;
break;
case 0x05:
- dev_priv->vram_type = VIA_MEM_DDR_333;
+ dev_private->vram_type = VIA_MEM_DDR_333;
break;
case 0x06:
- dev_priv->vram_type = VIA_MEM_DDR_400;
+ dev_private->vram_type = VIA_MEM_DDR_400;
default:
break;
}
return ret;
}
-static int
-km8xx_mem_type(struct via_device *dev_priv)
+static int km8xx_mem_type(struct openchrome_drm_private *dev_private)
{
struct pci_dev *dram, *misc = NULL;
int ret = -ENXIO;
@@ -359,16 +358,16 @@ km8xx_mem_type(struct via_device *dev_priv)
pci_read_config_byte(dram, 0x94, &type);
switch (type & 0x03) {
case 0x00:
- dev_priv->vram_type = VIA_MEM_DDR2_400;
+ dev_private->vram_type = VIA_MEM_DDR2_400;
break;
case 0x01:
- dev_priv->vram_type = VIA_MEM_DDR2_533;
+ dev_private->vram_type = VIA_MEM_DDR2_533;
break;
case 0x02:
- dev_priv->vram_type = VIA_MEM_DDR2_667;
+ dev_private->vram_type = VIA_MEM_DDR2_667;
break;
case 0x03:
- dev_priv->vram_type = VIA_MEM_DDR2_800;
+ dev_private->vram_type = VIA_MEM_DDR2_800;
default:
break;
}
@@ -381,16 +380,16 @@ km8xx_mem_type(struct via_device *dev_priv)
switch (type) {
case 0x00:
- dev_priv->vram_type = VIA_MEM_DDR_200;
+ dev_private->vram_type = VIA_MEM_DDR_200;
break;
case 0x02:
- dev_priv->vram_type = VIA_MEM_DDR_266;
+ dev_private->vram_type = VIA_MEM_DDR_266;
break;
case 0x05:
- dev_priv->vram_type = VIA_MEM_DDR_333;
+ dev_private->vram_type = VIA_MEM_DDR_333;
break;
case 0x07:
- dev_priv->vram_type = VIA_MEM_DDR_400;
+ dev_private->vram_type = VIA_MEM_DDR_400;
default:
break;
}
@@ -410,35 +409,35 @@ km8xx_mem_type(struct via_device *dev_priv)
if (type & 0x01) { /* DDR3 */
switch (tmp & 0x07) {
case 0x03:
- dev_priv->vram_type = VIA_MEM_DDR3_800;
+ dev_private->vram_type = VIA_MEM_DDR3_800;
break;
case 0x04:
- dev_priv->vram_type = VIA_MEM_DDR3_1066;
+ dev_private->vram_type = VIA_MEM_DDR3_1066;
break;
case 0x05:
- dev_priv->vram_type = VIA_MEM_DDR3_1333;
+ dev_private->vram_type = VIA_MEM_DDR3_1333;
break;
case 0x06:
- dev_priv->vram_type = VIA_MEM_DDR3_1600;
+ dev_private->vram_type = VIA_MEM_DDR3_1600;
default:
break;
}
} else { /* DDR2 */
switch (tmp & 0x07) {
case 0x00:
- dev_priv->vram_type = VIA_MEM_DDR2_400;
+ dev_private->vram_type = VIA_MEM_DDR2_400;
break;
case 0x01:
- dev_priv->vram_type = VIA_MEM_DDR2_533;
+ dev_private->vram_type = VIA_MEM_DDR2_533;
break;
case 0x02:
- dev_priv->vram_type = VIA_MEM_DDR2_667;
+ dev_private->vram_type = VIA_MEM_DDR2_667;
break;
case 0x03:
- dev_priv->vram_type = VIA_MEM_DDR2_800;
+ dev_private->vram_type = VIA_MEM_DDR2_800;
break;
case 0x04:
- dev_priv->vram_type = VIA_MEM_DDR2_1066;
+ dev_private->vram_type = VIA_MEM_DDR2_1066;
default:
break;
}
@@ -454,13 +453,13 @@ km8xx_mem_type(struct via_device *dev_priv)
switch (tmp & 0x07) {
case 0x01:
- dev_priv->vram_type = VIA_MEM_DDR2_533;
+ dev_private->vram_type = VIA_MEM_DDR2_533;
break;
case 0x02:
- dev_priv->vram_type = VIA_MEM_DDR2_667;
+ dev_private->vram_type = VIA_MEM_DDR2_667;
break;
case 0x03:
- dev_priv->vram_type = VIA_MEM_DDR2_800;
+ dev_private->vram_type = VIA_MEM_DDR2_800;
default:
break;
}
@@ -468,9 +467,9 @@ km8xx_mem_type(struct via_device *dev_priv)
return ret;
}
-static int
-cn400_mem_type(struct via_device *dev_priv, struct pci_bus *bus,
- struct pci_dev *fn3)
+static int cn400_mem_type(struct openchrome_drm_private *dev_private,
+ struct pci_bus *bus,
+ struct pci_dev *fn3)
{
struct pci_dev *fn2 = pci_get_slot(bus, PCI_DEVFN(0, 2));
int ret, freq = 0;
@@ -514,24 +513,24 @@ cn400_mem_type(struct via_device *dev_priv, struct pci_bus *bus,
switch (freq) {
case 0x03:
- dev_priv->vram_type = VIA_MEM_DDR_200;
+ dev_private->vram_type = VIA_MEM_DDR_200;
break;
case 0x04:
- dev_priv->vram_type = VIA_MEM_DDR_266;
+ dev_private->vram_type = VIA_MEM_DDR_266;
break;
case 0x05:
- dev_priv->vram_type = VIA_MEM_DDR_333;
+ dev_private->vram_type = VIA_MEM_DDR_333;
break;
case 0x06:
- dev_priv->vram_type = VIA_MEM_DDR_400;
+ dev_private->vram_type = VIA_MEM_DDR_400;
default:
break;
}
return ret;
}
-static int
-cn700_mem_type(struct via_device *dev_priv, struct pci_dev *fn3)
+static int cn700_mem_type(struct openchrome_drm_private *dev_private,
+ struct pci_dev *fn3)
{
int ret;
u8 tmp;
@@ -540,22 +539,22 @@ cn700_mem_type(struct via_device *dev_priv, struct pci_dev *fn3)
if (!ret) {
switch (tmp & 0x07) {
case 0x00:
- dev_priv->vram_type = VIA_MEM_DDR_200;
+ dev_private->vram_type = VIA_MEM_DDR_200;
break;
case 0x01:
- dev_priv->vram_type = VIA_MEM_DDR_266;
+ dev_private->vram_type = VIA_MEM_DDR_266;
break;
case 0x02:
- dev_priv->vram_type = VIA_MEM_DDR_333;
+ dev_private->vram_type = VIA_MEM_DDR_333;
break;
case 0x03:
- dev_priv->vram_type = VIA_MEM_DDR_400;
+ dev_private->vram_type = VIA_MEM_DDR_400;
break;
case 0x04:
- dev_priv->vram_type = VIA_MEM_DDR2_400;
+ dev_private->vram_type = VIA_MEM_DDR2_400;
break;
case 0x05:
- dev_priv->vram_type = VIA_MEM_DDR2_533;
+ dev_private->vram_type = VIA_MEM_DDR2_533;
default:
break;
}
@@ -563,8 +562,8 @@ cn700_mem_type(struct via_device *dev_priv, struct pci_dev *fn3)
return ret;
}
-static int
-cx700_mem_type(struct via_device *dev_priv, struct pci_dev *fn3)
+static int cx700_mem_type(struct openchrome_drm_private *dev_private,
+ struct pci_dev *fn3)
{
u8 type, clock;
int ret;
@@ -582,16 +581,16 @@ cx700_mem_type(struct via_device *dev_priv, struct pci_dev *fn3)
case 0:
switch (clock & 0x07) {
case 0:
- dev_priv->vram_type = VIA_MEM_DDR_200;
+ dev_private->vram_type = VIA_MEM_DDR_200;
break;
case 1:
- dev_priv->vram_type = VIA_MEM_DDR_266;
+ dev_private->vram_type = VIA_MEM_DDR_266;
break;
case 2:
- dev_priv->vram_type = VIA_MEM_DDR_333;
+ dev_private->vram_type = VIA_MEM_DDR_333;
break;
case 3:
- dev_priv->vram_type = VIA_MEM_DDR_400;
+ dev_private->vram_type = VIA_MEM_DDR_400;
default:
break;
}
@@ -600,16 +599,16 @@ cx700_mem_type(struct via_device *dev_priv, struct pci_dev *fn3)
case 1:
switch (clock & 0x07) {
case 3:
- dev_priv->vram_type = VIA_MEM_DDR2_400;
+ dev_private->vram_type = VIA_MEM_DDR2_400;
break;
case 4:
- dev_priv->vram_type = VIA_MEM_DDR2_533;
+ dev_private->vram_type = VIA_MEM_DDR2_533;
break;
case 5:
- dev_priv->vram_type = VIA_MEM_DDR2_667;
+ dev_private->vram_type = VIA_MEM_DDR2_667;
break;
case 6:
- dev_priv->vram_type = VIA_MEM_DDR2_800;
+ dev_private->vram_type = VIA_MEM_DDR2_800;
default:
break;
}
@@ -619,8 +618,8 @@ cx700_mem_type(struct via_device *dev_priv, struct pci_dev *fn3)
return ret;
}
-static int
-vx900_mem_type(struct via_device *dev_priv, struct pci_dev *fn3)
+static int vx900_mem_type(struct openchrome_drm_private *dev_private,
+ struct pci_dev *fn3)
{
int ret;
u8 clock, type, volt;
@@ -642,21 +641,21 @@ vx900_mem_type(struct via_device *dev_priv, struct pci_dev *fn3)
switch (clock & 0x0F) {
case 0:
if (volt)
- dev_priv->vram_type = VIA_MEM_DDR2_800;
+ dev_private->vram_type = VIA_MEM_DDR2_800;
else
- dev_priv->vram_type = VIA_MEM_DDR2_533;
+ dev_private->vram_type = VIA_MEM_DDR2_533;
break;
case 4:
- dev_priv->vram_type = VIA_MEM_DDR2_533;
+ dev_private->vram_type = VIA_MEM_DDR2_533;
break;
case 5:
- dev_priv->vram_type = VIA_MEM_DDR2_667;
+ dev_private->vram_type = VIA_MEM_DDR2_667;
break;
case 6:
- dev_priv->vram_type = VIA_MEM_DDR2_800;
+ dev_private->vram_type = VIA_MEM_DDR2_800;
break;
case 7:
- dev_priv->vram_type = VIA_MEM_DDR2_1066;
+ dev_private->vram_type = VIA_MEM_DDR2_1066;
default:
break;
}
@@ -665,21 +664,21 @@ vx900_mem_type(struct via_device *dev_priv, struct pci_dev *fn3)
switch (clock & 0x0F) {
case 0:
if (volt)
- dev_priv->vram_type = VIA_MEM_DDR3_800;
+ dev_private->vram_type = VIA_MEM_DDR3_800;
else
- dev_priv->vram_type = VIA_MEM_DDR3_533;
+ dev_private->vram_type = VIA_MEM_DDR3_533;
break;
case 4:
- dev_priv->vram_type = VIA_MEM_DDR3_533;
+ dev_private->vram_type = VIA_MEM_DDR3_533;
break;
case 5:
- dev_priv->vram_type = VIA_MEM_DDR3_667;
+ dev_private->vram_type = VIA_MEM_DDR3_667;
break;
case 6:
- dev_priv->vram_type = VIA_MEM_DDR3_800;
+ dev_private->vram_type = VIA_MEM_DDR3_800;
break;
case 7:
- dev_priv->vram_type = VIA_MEM_DDR3_1066;
+ dev_private->vram_type = VIA_MEM_DDR3_1066;
default:
break;
}
@@ -688,9 +687,9 @@ vx900_mem_type(struct via_device *dev_priv, struct pci_dev *fn3)
return ret;
}
-int via_vram_detect(struct via_device *dev_priv)
+int via_vram_detect(struct openchrome_drm_private *dev_private)
{
- struct drm_device *dev = dev_priv->dev;
+ struct drm_device *dev = dev_private->dev;
struct pci_dev *bridge = NULL;
struct pci_dev *fn3 = NULL;
char *name = "unknown";
@@ -721,40 +720,40 @@ int via_vram_detect(struct via_device *dev_priv)
DRM_ERROR("No function 3 on host bridge...\n");
goto out_err;
}
- dev_priv->vram_start = pci_resource_start(dev->pdev, 0);
+ dev_private->vram_start = pci_resource_start(dev->pdev, 0);
switch (bridge->device) {
/* CLE266 */
case PCI_DEVICE_ID_VIA_862X_0:
- ret = cle266_mem_type(dev_priv, bridge);
+ ret = cle266_mem_type(dev_private, bridge);
if (ret)
goto out_err;
ret = pci_read_config_byte(bridge, 0xE1, &size);
if (ret)
goto out_err;
- dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
+ dev_private->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
break;
/* KM400 / KN400 / KM400A / KN400A */
case PCI_DEVICE_ID_VIA_8378_0:
- ret = km400_mem_type(dev_priv, bridge);
+ ret = km400_mem_type(dev_private, bridge);
ret = pci_read_config_byte(bridge, 0xE1, &size);
if (ret)
goto out_err;
- dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
+ dev_private->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
break;
/* P4M800 */
case PCI_DEVICE_ID_VIA_3296_0:
- ret = p4m800_mem_type(dev_priv, bus, fn3);
+ ret = p4m800_mem_type(dev_private, bus, fn3);
ret = pci_read_config_byte(fn3, 0xA1, &size);
if (ret)
goto out_err;
- dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
+ dev_private->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
break;
/* K8M800 / K8N800 */
@@ -764,12 +763,12 @@ int via_vram_detect(struct via_device *dev_priv)
ret = pci_read_config_byte(fn3, 0xA1, &size);
if (ret)
goto out_err;
- dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
+ dev_private->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
if (bridge->device == PCI_DEVICE_ID_VIA_VT3336)
- dev_priv->vram_size <<= 2;
+ dev_private->vram_size <<= 2;
- ret = km8xx_mem_type(dev_priv);
+ ret = km8xx_mem_type(dev_private);
if (ret)
goto out_err;
break;
@@ -779,9 +778,9 @@ int via_vram_detect(struct via_device *dev_priv)
ret = pci_read_config_byte(fn3, 0xA1, &size);
if (ret)
goto out_err;
- dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
+ dev_private->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
- ret = cn400_mem_type(dev_priv, bus, fn3);
+ ret = cn400_mem_type(dev_private, bus, fn3);
if (ret)
goto out_err;
break;
@@ -793,12 +792,12 @@ int via_vram_detect(struct via_device *dev_priv)
ret = pci_read_config_byte(fn3, 0xA1, &size);
if (ret)
goto out_err;
- dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
+ dev_private->vram_size = (1 << ((size & 0x70) >> 4)) << 20;
if (bridge->device != PCI_DEVICE_ID_VIA_P4M800CE)
- dev_priv->vram_size <<= 2;
+ dev_private->vram_size <<= 2;
- ret = cn700_mem_type(dev_priv, fn3);
+ ret = cn700_mem_type(dev_private, fn3);
if (ret)
goto out_err;
break;
@@ -814,23 +813,23 @@ int via_vram_detect(struct via_device *dev_priv)
ret = pci_read_config_byte(fn3, 0xA1, &size);
if (ret)
goto out_err;
- dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 22;
+ dev_private->vram_size = (1 << ((size & 0x70) >> 4)) << 22;
- ret = cx700_mem_type(dev_priv, fn3);
+ ret = cx700_mem_type(dev_private, fn3);
if (ret)
goto out_err;
break;
/* VX900 */
case PCI_DEVICE_ID_VIA_VT3410:
- dev_priv->vram_start = pci_resource_start(dev->pdev, 2);
+ dev_private->vram_start = pci_resource_start(dev->pdev, 2);
ret = pci_read_config_byte(fn3, 0xA1, &size);
if (ret)
goto out_err;
- dev_priv->vram_size = (1 << ((size & 0x70) >> 4)) << 22;
+ dev_private->vram_size = (1 << ((size & 0x70) >> 4)) << 22;
- ret = vx900_mem_type(dev_priv, fn3);
+ ret = vx900_mem_type(dev_private, fn3);
if (ret)
goto out_err;
break;
@@ -840,7 +839,7 @@ int via_vram_detect(struct via_device *dev_priv)
goto out_err;
}
- switch (dev_priv->vram_type) {
+ switch (dev_private->vram_type) {
case VIA_MEM_SDR66:
name = "SDR 66";
break;
@@ -911,36 +910,37 @@ out_err:
return ret;
}
-int openchrome_vram_init(struct via_device *dev_priv)
+int openchrome_vram_init(struct openchrome_drm_private *dev_private)
{
int ret = 0;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
/* Add an MTRR for the video RAM. */
- dev_priv->vram_mtrr = arch_phys_wc_add(dev_priv->vram_start,
- dev_priv->vram_size);
+ dev_private->vram_mtrr = arch_phys_wc_add(
+ dev_private->vram_start,
+ dev_private->vram_size);
DRM_INFO("VIA Technologies Chrome IGP VRAM "
"Physical Address: 0x%08llx\n",
- dev_priv->vram_start);
+ dev_private->vram_start);
DRM_INFO("VIA Technologies Chrome IGP VRAM "
"Size: %llu\n",
- (unsigned long long) dev_priv->vram_size >> 20);
+ (unsigned long long) dev_private->vram_size >> 20);
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
return ret;
}
-void openchrome_vram_fini(struct via_device *dev_priv)
+void openchrome_vram_fini(struct openchrome_drm_private *dev_private)
{
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- if (dev_priv->vram_mtrr) {
- arch_phys_wc_del(dev_priv->vram_mtrr);
- arch_io_free_memtype_wc(dev_priv->vram_start,
- dev_priv->vram_size);
- dev_priv->vram_mtrr = 0;
+ if (dev_private->vram_mtrr) {
+ arch_phys_wc_del(dev_private->vram_mtrr);
+ arch_io_free_memtype_wc(dev_private->vram_start,
+ dev_private->vram_size);
+ dev_private->vram_mtrr = 0;
}
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
@@ -982,9 +982,9 @@ static const struct drm_framebuffer_funcs via_fb_funcs = {
static void
via_output_poll_changed(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
- drm_fb_helper_hotplug_event(&dev_priv->via_fbdev->helper);
+ drm_fb_helper_hotplug_event(&dev_private->via_fbdev->helper);
}
static struct drm_framebuffer *
@@ -1083,7 +1083,8 @@ via_fb_probe(struct drm_fb_helper *helper,
struct drm_fb_helper_surface_size *sizes)
{
struct drm_device *dev = helper->dev;
- struct via_device *dev_priv = helper->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ helper->dev->dev_private;
struct via_framebuffer_device *via_fbdev = container_of(helper,
struct via_framebuffer_device, helper);
struct ttm_bo_kmap_obj *kmap = &via_fbdev->kmap;
@@ -1109,7 +1110,7 @@ via_fb_probe(struct drm_fb_helper *helper,
size = mode_cmd.pitches[0] * mode_cmd.height;
size = ALIGN(size, PAGE_SIZE);
- gem_obj = ttm_gem_create(dev, &dev_priv->ttm.bdev, size,
+ gem_obj = ttm_gem_create(dev, &dev_private->ttm.bdev, size,
ttm_bo_type_kernel, TTM_PL_FLAG_VRAM,
1, PAGE_SIZE, false);
if (unlikely(IS_ERR(gem_obj))) {
@@ -1194,7 +1195,7 @@ static struct drm_fb_helper_funcs via_drm_fb_helper_funcs = {
int via_fbdev_init(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
struct via_framebuffer_device *via_fbdev;
int bpp_sel = 32;
int ret = 0;
@@ -1210,7 +1211,7 @@ int via_fbdev_init(struct drm_device *dev)
goto exit;
}
- dev_priv->via_fbdev = via_fbdev;
+ dev_private->via_fbdev = via_fbdev;
drm_fb_helper_prepare(dev, &via_fbdev->helper,
&via_drm_fb_helper_funcs);
@@ -1244,9 +1245,9 @@ exit:
void via_fbdev_fini(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
- struct drm_fb_helper *fb_helper = &dev_priv->via_fbdev->helper;
- struct via_framebuffer *via_fb = &dev_priv->via_fbdev->via_fb;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
+ struct drm_fb_helper *fb_helper = &dev_private->via_fbdev->helper;
+ struct via_framebuffer *via_fb = &dev_private->via_fbdev->via_fb;
struct fb_info *info;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -1268,11 +1269,11 @@ void via_fbdev_fini(struct drm_device *dev)
via_fb->gem_obj = NULL;
}
- drm_fb_helper_fini(&dev_priv->via_fbdev->helper);
- drm_framebuffer_cleanup(&dev_priv->via_fbdev->via_fb.fb);
- if (dev_priv->via_fbdev) {
- kfree(dev_priv->via_fbdev);
- dev_priv->via_fbdev = NULL;
+ drm_fb_helper_fini(&dev_private->via_fbdev->helper);
+ drm_framebuffer_cleanup(&dev_private->via_fbdev->via_fb.fb);
+ if (dev_private->via_fbdev) {
+ kfree(dev_private->via_fbdev);
+ dev_private->via_fbdev = NULL;
}
exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
diff --git a/drivers/gpu/drm/openchrome/openchrome_fp.c b/drivers/gpu/drm/openchrome/openchrome_fp.c
index e62fef3ee97d..41af36b9572b 100644
--- a/drivers/gpu/drm/openchrome/openchrome_fp.c
+++ b/drivers/gpu/drm/openchrome/openchrome_fp.c
@@ -130,9 +130,9 @@ via_centering_timing(const struct drm_display_mode *mode,
adjusted_mode->crtc_vsync_end = adjusted_mode->vsync_end;
}
-static void
-via_fp_castle_rock_soft_power_seq(struct via_device *dev_priv,
- bool power_state)
+static void via_fp_castle_rock_soft_power_seq(
+ struct openchrome_drm_private *dev_private,
+ bool power_state)
{
DRM_DEBUG_KMS("Entered via_fp_castle_rock_soft_power_seq.\n");
@@ -183,8 +183,9 @@ via_fp_castle_rock_soft_power_seq(struct via_device *dev_priv,
DRM_DEBUG_KMS("Exiting via_fp_castle_rock_soft_power_seq.\n");
}
-static void
-via_fp_primary_soft_power_seq(struct via_device *dev_priv, bool power_state)
+static void via_fp_primary_soft_power_seq(
+ struct openchrome_drm_private *dev_private,
+ bool power_state)
{
DRM_DEBUG_KMS("Entered via_fp_primary_soft_power_seq.\n");
@@ -250,8 +251,9 @@ via_fp_primary_soft_power_seq(struct via_device *dev_priv, bool power_state)
DRM_DEBUG_KMS("Exiting via_fp_primary_soft_power_seq.\n");
}
-static void
-via_fp_secondary_soft_power_seq(struct via_device *dev_priv, bool power_state)
+static void via_fp_secondary_soft_power_seq(
+ struct openchrome_drm_private *dev_private,
+ bool power_state)
{
DRM_DEBUG_KMS("Entered via_fp_secondary_soft_power_seq.\n");
@@ -317,8 +319,9 @@ via_fp_secondary_soft_power_seq(struct via_device *dev_priv, bool power_state)
DRM_DEBUG_KMS("Exiting via_fp_secondary_soft_power_seq.\n");
}
-static void
-via_fp_primary_hard_power_seq(struct via_device *dev_priv, bool power_state)
+static void via_fp_primary_hard_power_seq(
+ struct openchrome_drm_private *dev_private,
+ bool power_state)
{
DRM_DEBUG_KMS("Entered via_fp_primary_hard_power_seq.\n");
@@ -348,15 +351,16 @@ via_fp_primary_hard_power_seq(struct via_device *dev_priv, bool power_state)
DRM_DEBUG_KMS("Entered via_fp_primary_hard_power_seq.\n");
}
-static void
-via_fp_power(struct via_device *dev_priv, unsigned short device,
- u32 di_port, bool power_state)
+static void via_fp_power(
+ struct openchrome_drm_private *dev_private,
+ unsigned short device,
+ u32 di_port, bool power_state)
{
DRM_DEBUG_KMS("Entered via_fp_power.\n");
switch (device) {
case PCI_DEVICE_ID_VIA_CLE266:
- via_fp_castle_rock_soft_power_seq(dev_priv,
+ via_fp_castle_rock_soft_power_seq(dev_private,
power_state);
break;
case PCI_DEVICE_ID_VIA_KM400:
@@ -366,24 +370,27 @@ via_fp_power(struct via_device *dev_priv, unsigned short device,
case PCI_DEVICE_ID_VIA_VT3343:
case PCI_DEVICE_ID_VIA_K8M890:
case PCI_DEVICE_ID_VIA_P4M900:
- via_fp_primary_hard_power_seq(dev_priv, power_state);
+ via_fp_primary_hard_power_seq(dev_private, power_state);
break;
case PCI_DEVICE_ID_VIA_VT3157:
case PCI_DEVICE_ID_VIA_VT1122:
if (di_port & VIA_DI_PORT_LVDS1) {
- via_fp_primary_soft_power_seq(dev_priv, power_state);
+ via_fp_primary_soft_power_seq(dev_private,
+ power_state);
via_lvds1_set_power(VGABASE, power_state);
}
if (di_port & VIA_DI_PORT_LVDS2) {
- via_fp_secondary_soft_power_seq(dev_priv, power_state);
+ via_fp_secondary_soft_power_seq(dev_private,
+ power_state);
via_lvds2_set_power(VGABASE, power_state);
}
break;
case PCI_DEVICE_ID_VIA_VX875:
case PCI_DEVICE_ID_VIA_VX900_VGA:
- via_fp_primary_hard_power_seq(dev_priv, power_state);
+ via_fp_primary_hard_power_seq(dev_private,
+ power_state);
via_lvds1_set_power(VGABASE, power_state);
break;
default:
@@ -399,7 +406,9 @@ via_fp_power(struct via_device *dev_priv, unsigned short device,
/*
* Sets flat panel I/O pad state.
*/
-static void via_fp_io_pad_setting(struct via_device *dev_priv, u32 di_port, bool io_pad_on)
+static void via_fp_io_pad_setting(
+ struct openchrome_drm_private *dev_private,
+ u32 di_port, bool io_pad_on)
{
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -441,8 +450,9 @@ static void via_fp_io_pad_setting(struct via_device *dev_priv, u32 di_port, bool
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
-static void via_fp_format(struct via_device *dev_priv,
- u32 di_port, u8 format)
+static void via_fp_format(
+ struct openchrome_drm_private *dev_private,
+ u32 di_port, u8 format)
{
u8 temp = format & 0x01;
@@ -467,8 +477,9 @@ static void via_fp_format(struct via_device *dev_priv,
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
-static void via_fp_output_format(struct via_device *dev_priv,
- u32 di_port, u8 output_format)
+static void via_fp_output_format(
+ struct openchrome_drm_private *dev_private,
+ u32 di_port, u8 output_format)
{
u8 temp = output_format & 0x01;
@@ -493,8 +504,9 @@ static void via_fp_output_format(struct via_device *dev_priv,
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
-static void via_fp_dithering(struct via_device *dev_priv,
- u32 di_port, bool dithering)
+static void via_fp_dithering(
+ struct openchrome_drm_private *dev_private,
+ u32 di_port, bool dithering)
{
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -520,8 +532,9 @@ static void via_fp_dithering(struct via_device *dev_priv,
/*
* Sets flat panel display source.
*/
-static void
-via_fp_display_source(struct via_device *dev_priv, u32 di_port, int index)
+static void via_fp_display_source(
+ struct openchrome_drm_private *dev_private,
+ u32 di_port, int index)
{
u8 display_source = index & 0x01;
@@ -573,7 +586,8 @@ static void via_fp_dpms(struct drm_encoder *encoder, int mode)
struct via_encoder *enc = container_of(encoder,
struct via_encoder, base);
struct drm_device *dev = encoder->dev;
- struct via_device *dev_priv = encoder->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
/* PCI Device ID */
u16 chipset = dev->pdev->device;
@@ -582,14 +596,14 @@ static void via_fp_dpms(struct drm_encoder *encoder, int mode)
switch (mode) {
case DRM_MODE_DPMS_ON:
- via_fp_power(dev_priv, chipset, enc->di_port, true);
- via_fp_io_pad_setting(dev_priv, enc->di_port, true);
+ via_fp_power(dev_private, chipset, enc->di_port, true);
+ via_fp_io_pad_setting(dev_private, enc->di_port, true);
break;
case DRM_MODE_DPMS_SUSPEND:
case DRM_MODE_DPMS_STANDBY:
case DRM_MODE_DPMS_OFF:
- via_fp_power(dev_priv, chipset, enc->di_port, false);
- via_fp_io_pad_setting(dev_priv, enc->di_port, false);
+ via_fp_power(dev_private, chipset, enc->di_port, false);
+ via_fp_io_pad_setting(dev_private, enc->di_port, false);
break;
default:
break;
@@ -668,15 +682,16 @@ static void via_fp_prepare(struct drm_encoder *encoder)
struct via_encoder *enc = container_of(encoder,
struct via_encoder, base);
struct drm_device *dev = encoder->dev;
- struct via_device *dev_priv = encoder->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
/* PCI Device ID */
u16 chipset = dev->pdev->device;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- via_fp_power(dev_priv, chipset, enc->di_port, false);
- via_fp_io_pad_setting(dev_priv, enc->di_port, false);
+ via_fp_power(dev_private, chipset, enc->di_port, false);
+ via_fp_io_pad_setting(dev_private, enc->di_port, false);
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
@@ -686,15 +701,16 @@ static void via_fp_commit(struct drm_encoder *encoder)
struct via_encoder *enc = container_of(encoder,
struct via_encoder, base);
struct drm_device *dev = encoder->dev;
- struct via_device *dev_priv = encoder->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
/* PCI Device ID */
u16 chipset = dev->pdev->device;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- via_fp_power(dev_priv, chipset, enc->di_port, true);
- via_fp_io_pad_setting(dev_priv, enc->di_port, true);
+ via_fp_power(dev_private, chipset, enc->di_port, true);
+ via_fp_io_pad_setting(dev_private, enc->di_port, true);
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
@@ -705,7 +721,8 @@ via_fp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
{
struct via_crtc *iga = container_of(encoder->crtc, struct via_crtc, base);
struct via_encoder *enc = container_of(encoder, struct via_encoder, base);
- struct via_device *dev_priv = encoder->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
/* PCI Device ID */
u16 chipset = encoder->dev->pdev->device;
@@ -727,19 +744,19 @@ via_fp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
case PCI_DEVICE_ID_VIA_VX875:
case PCI_DEVICE_ID_VIA_VX900_VGA:
/* OPENLDI Mode */
- via_fp_format(dev_priv, enc->di_port, 0x01);
+ via_fp_format(dev_private, enc->di_port, 0x01);
/* Sequential Mode */
- via_fp_output_format(dev_priv, enc->di_port, 0x01);
+ via_fp_output_format(dev_private, enc->di_port, 0x01);
/* Turn on dithering. */
- via_fp_dithering(dev_priv, enc->di_port, true);
+ via_fp_dithering(dev_private, enc->di_port, true);
break;
default:
break;
}
- via_fp_display_source(dev_priv, enc->di_port, iga->index);
+ via_fp_display_source(dev_private, enc->di_port, iga->index);
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
@@ -749,15 +766,16 @@ static void via_fp_disable(struct drm_encoder *encoder)
struct via_encoder *enc = container_of(encoder,
struct via_encoder, base);
struct drm_device *dev = encoder->dev;
- struct via_device *dev_priv = encoder->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
/* PCI Device ID */
u16 chipset = dev->pdev->device;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- via_fp_power(dev_priv, chipset, enc->di_port, false);
- via_fp_io_pad_setting(dev_priv, enc->di_port, false);
+ via_fp_power(dev_private, chipset, enc->di_port, false);
+ via_fp_io_pad_setting(dev_private, enc->di_port, false);
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
@@ -781,7 +799,8 @@ via_fp_detect(struct drm_connector *connector, bool force)
{
struct via_connector *con = container_of(connector,
struct via_connector, base);
- struct via_device *dev_priv = connector->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ connector->dev->dev_private;
enum drm_connector_status ret = connector_status_disconnected;
struct i2c_adapter *i2c_bus;
struct edid *edid = NULL;
@@ -904,7 +923,7 @@ via_fp_get_modes(struct drm_connector *connector)
{
struct via_connector *con = container_of(connector, struct via_connector, base);
struct drm_device *dev = connector->dev;
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
struct i2c_adapter *i2c_bus;
struct edid *edid = NULL;
struct drm_display_mode *native_mode = NULL;
@@ -1059,7 +1078,7 @@ struct drm_connector_helper_funcs via_fp_connector_helper_funcs = {
*/
void via_fp_probe(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
struct drm_connector connector;
struct i2c_adapter *i2c_bus;
struct edid *edid;
@@ -1082,15 +1101,15 @@ void via_fp_probe(struct drm_device *dev)
switch (chipset) {
case PCI_DEVICE_ID_VIA_CLE266:
if ((sr12 & BIT(4)) || (cr3b & BIT(3))) {
- dev_priv->int_fp1_presence = true;
- dev_priv->int_fp1_di_port = VIA_DI_PORT_DIP0;
+ dev_private->int_fp1_presence = true;
+ dev_private->int_fp1_di_port = VIA_DI_PORT_DIP0;
} else {
- dev_priv->int_fp1_presence = false;
- dev_priv->int_fp1_di_port = VIA_DI_PORT_NONE;
+ dev_private->int_fp1_presence = false;
+ dev_private->int_fp1_di_port = VIA_DI_PORT_NONE;
}
- dev_priv->int_fp2_presence = false;
- dev_priv->int_fp2_di_port = VIA_DI_PORT_NONE;
+ dev_private->int_fp2_presence = false;
+ dev_private->int_fp2_di_port = VIA_DI_PORT_NONE;
break;
case PCI_DEVICE_ID_VIA_KM400:
case PCI_DEVICE_ID_VIA_CN700:
@@ -1101,17 +1120,17 @@ void via_fp_probe(struct drm_device *dev)
* 1: AGP pins are used by FPDP
* (Flat Panel Display Port) */
if ((sr13 & BIT(3)) && (cr3b & BIT(1))) {
- dev_priv->int_fp1_presence = true;
- dev_priv->int_fp1_di_port =
+ dev_private->int_fp1_presence = true;
+ dev_private->int_fp1_di_port =
VIA_DI_PORT_FPDPHIGH |
VIA_DI_PORT_FPDPLOW;
} else {
- dev_priv->int_fp1_presence = false;
- dev_priv->int_fp1_di_port = VIA_DI_PORT_NONE;
+ dev_private->int_fp1_presence = false;
+ dev_private->int_fp1_di_port = VIA_DI_PORT_NONE;
}
- dev_priv->int_fp2_presence = false;
- dev_priv->int_fp2_di_port = VIA_DI_PORT_NONE;
+ dev_private->int_fp2_presence = false;
+ dev_private->int_fp2_di_port = VIA_DI_PORT_NONE;
break;
case PCI_DEVICE_ID_VIA_VT3343:
case PCI_DEVICE_ID_VIA_K8M890:
@@ -1123,22 +1142,22 @@ void via_fp_probe(struct drm_device *dev)
* 1: 24-bit FPDP (Flat Panel
* Display Port) */
if (sr12 & BIT(4)) {
- dev_priv->int_fp1_presence = true;
- dev_priv->int_fp1_di_port =
+ dev_private->int_fp1_presence = true;
+ dev_private->int_fp1_di_port =
VIA_DI_PORT_FPDPLOW |
VIA_DI_PORT_FPDPHIGH;
} else {
- dev_priv->int_fp1_presence = true;
- dev_priv->int_fp1_di_port =
+ dev_private->int_fp1_presence = true;
+ dev_private->int_fp1_di_port =
VIA_DI_PORT_FPDPLOW;
}
} else {
- dev_priv->int_fp1_presence = false;
- dev_priv->int_fp1_di_port = VIA_DI_PORT_NONE;
+ dev_private->int_fp1_presence = false;
+ dev_private->int_fp1_di_port = VIA_DI_PORT_NONE;
}
- dev_priv->int_fp2_presence = false;
- dev_priv->int_fp2_di_port = VIA_DI_PORT_NONE;
+ dev_private->int_fp2_presence = false;
+ dev_private->int_fp2_di_port = VIA_DI_PORT_NONE;
break;
case PCI_DEVICE_ID_VIA_VT3157:
case PCI_DEVICE_ID_VIA_VT1122:
@@ -1156,28 +1175,28 @@ void via_fp_probe(struct drm_device *dev)
sr13 = vga_rseq(VGABASE, 0x13);
if (cr3b & BIT(1)) {
- if (dev_priv->is_via_nanobook) {
- dev_priv->int_fp1_presence = false;
- dev_priv->int_fp1_di_port =
+ if (dev_private->is_via_nanobook) {
+ dev_private->int_fp1_presence = false;
+ dev_private->int_fp1_di_port =
VIA_DI_PORT_NONE;
- dev_priv->int_fp2_presence = true;
- dev_priv->int_fp2_di_port =
+ dev_private->int_fp2_presence = true;
+ dev_private->int_fp2_di_port =
VIA_DI_PORT_LVDS2;
- } else if (dev_priv->is_quanta_il1) {
+ } else if (dev_private->is_quanta_il1) {
/* From the Quanta IL1 schematic. */
- dev_priv->int_fp1_presence = true;
- dev_priv->int_fp1_di_port =
+ dev_private->int_fp1_presence = true;
+ dev_private->int_fp1_di_port =
VIA_DI_PORT_DVP1;
- dev_priv->int_fp2_presence = false;
- dev_priv->int_fp2_di_port =
+ dev_private->int_fp2_presence = false;
+ dev_private->int_fp2_di_port =
VIA_DI_PORT_NONE;
- } else if (dev_priv->is_samsung_nc20) {
- dev_priv->int_fp1_presence = false;
- dev_priv->int_fp1_di_port =
+ } else if (dev_private->is_samsung_nc20) {
+ dev_private->int_fp1_presence = false;
+ dev_private->int_fp1_di_port =
VIA_DI_PORT_NONE;
- dev_priv->int_fp2_presence = true;
- dev_priv->int_fp2_di_port =
+ dev_private->int_fp2_presence = true;
+ dev_private->int_fp2_di_port =
VIA_DI_PORT_LVDS2;
/* 3C5.13[7:6] - Integrated LVDS / DVI
@@ -1191,62 +1210,62 @@ void via_fp_probe(struct drm_device *dev)
* the clock jitter) */
} else if ((!(sr13 & BIT(7))) &&
(!(sr13 & BIT(6)))) {
- dev_priv->int_fp1_presence = true;
- dev_priv->int_fp1_di_port =
+ dev_private->int_fp1_presence = true;
+ dev_private->int_fp1_di_port =
VIA_DI_PORT_LVDS1;
/*
* For now, don't support the second
* FP.
*/
- dev_priv->int_fp2_presence = false;
- dev_priv->int_fp2_di_port =
+ dev_private->int_fp2_presence = false;
+ dev_private->int_fp2_di_port =
VIA_DI_PORT_NONE;
} else if ((!(sr13 & BIT(7))) &&
(sr13 & BIT(6))) {
- dev_priv->int_fp1_presence = false;
- dev_priv->int_fp1_di_port =
+ dev_private->int_fp1_presence = false;
+ dev_private->int_fp1_di_port =
VIA_DI_PORT_NONE;
- dev_priv->int_fp2_presence = true;
- dev_priv->int_fp2_di_port =
+ dev_private->int_fp2_presence = true;
+ dev_private->int_fp2_di_port =
VIA_DI_PORT_LVDS2;
} else if ((sr13 & BIT(7)) &&
(!(sr13 & BIT(6)))) {
- dev_priv->int_fp1_presence = true;
- dev_priv->int_fp1_di_port =
+ dev_private->int_fp1_presence = true;
+ dev_private->int_fp1_di_port =
VIA_DI_PORT_LVDS1 |
VIA_DI_PORT_LVDS2;
- dev_priv->int_fp2_presence = false;
- dev_priv->int_fp2_di_port =
+ dev_private->int_fp2_presence = false;
+ dev_private->int_fp2_di_port =
VIA_DI_PORT_NONE;
} else {
- dev_priv->int_fp1_presence = false;
- dev_priv->int_fp1_di_port =
+ dev_private->int_fp1_presence = false;
+ dev_private->int_fp1_di_port =
VIA_DI_PORT_NONE;
- dev_priv->int_fp2_presence = false;
- dev_priv->int_fp2_di_port =
+ dev_private->int_fp2_presence = false;
+ dev_private->int_fp2_di_port =
VIA_DI_PORT_NONE;
}
} else {
- dev_priv->int_fp1_presence = false;
- dev_priv->int_fp1_di_port = VIA_DI_PORT_NONE;
- dev_priv->int_fp2_presence = false;
- dev_priv->int_fp2_di_port = VIA_DI_PORT_NONE;
+ dev_private->int_fp1_presence = false;
+ dev_private->int_fp1_di_port = VIA_DI_PORT_NONE;
+ dev_private->int_fp2_presence = false;
+ dev_private->int_fp2_di_port = VIA_DI_PORT_NONE;
}
/* Restore SR5A. */
vga_wseq(VGABASE, 0x5a, sr5a);
break;
default:
- dev_priv->int_fp1_presence = false;
- dev_priv->int_fp1_di_port = VIA_DI_PORT_NONE;
- dev_priv->int_fp2_presence = false;
- dev_priv->int_fp2_di_port = VIA_DI_PORT_NONE;
+ dev_private->int_fp1_presence = false;
+ dev_private->int_fp1_di_port = VIA_DI_PORT_NONE;
+ dev_private->int_fp2_presence = false;
+ dev_private->int_fp2_di_port = VIA_DI_PORT_NONE;
break;
}
- dev_priv->int_fp1_i2c_bus = VIA_I2C_NONE;
- dev_priv->int_fp2_i2c_bus = VIA_I2C_NONE;
+ dev_private->int_fp1_i2c_bus = VIA_I2C_NONE;
+ dev_private->int_fp2_i2c_bus = VIA_I2C_NONE;
/* Zero clear connector struct.
* Not doing so leads to a crash. */
@@ -1259,24 +1278,24 @@ void via_fp_probe(struct drm_device *dev)
&via_fp_connector_helper_funcs);
drm_connector_register(&connector);
- if ((dev_priv->int_fp1_presence)
- && (!(dev_priv->mapped_i2c_bus & VIA_I2C_BUS2))) {
+ if ((dev_private->int_fp1_presence)
+ && (!(dev_private->mapped_i2c_bus & VIA_I2C_BUS2))) {
i2c_bus = via_find_ddc_bus(0x31);
edid = drm_get_edid(&connector, i2c_bus);
if (edid) {
- dev_priv->int_fp1_i2c_bus = VIA_I2C_BUS2;
- dev_priv->mapped_i2c_bus |= VIA_I2C_BUS2;
+ dev_private->int_fp1_i2c_bus = VIA_I2C_BUS2;
+ dev_private->mapped_i2c_bus |= VIA_I2C_BUS2;
kfree(edid);
}
}
- if ((dev_priv->int_fp2_presence)
- && (!(dev_priv->mapped_i2c_bus & VIA_I2C_BUS2))) {
+ if ((dev_private->int_fp2_presence)
+ && (!(dev_private->mapped_i2c_bus & VIA_I2C_BUS2))) {
i2c_bus = via_find_ddc_bus(0x31);
edid = drm_get_edid(&connector, i2c_bus);
if (edid) {
- dev_priv->int_fp2_i2c_bus = VIA_I2C_BUS2;
- dev_priv->mapped_i2c_bus |= VIA_I2C_BUS2;
+ dev_private->int_fp2_i2c_bus = VIA_I2C_BUS2;
+ dev_private->mapped_i2c_bus |= VIA_I2C_BUS2;
kfree(edid);
}
}
@@ -1286,33 +1305,33 @@ void via_fp_probe(struct drm_device *dev)
drm_connector_cleanup(&connector);
DRM_DEBUG_KMS("int_fp1_presence: %x\n",
- dev_priv->int_fp1_presence);
+ dev_private->int_fp1_presence);
DRM_DEBUG_KMS("int_fp1_di_port: 0x%08x\n",
- dev_priv->int_fp1_di_port);
+ dev_private->int_fp1_di_port);
DRM_DEBUG_KMS("int_fp1_i2c_bus: 0x%08x\n",
- dev_priv->int_fp1_i2c_bus);
+ dev_private->int_fp1_i2c_bus);
DRM_DEBUG_KMS("int_fp2_presence: %x\n",
- dev_priv->int_fp2_presence);
+ dev_private->int_fp2_presence);
DRM_DEBUG_KMS("int_fp2_di_port: 0x%08x\n",
- dev_priv->int_fp2_di_port);
+ dev_private->int_fp2_di_port);
DRM_DEBUG_KMS("int_fp2_i2c_bus: 0x%08x\n",
- dev_priv->int_fp2_i2c_bus);
+ dev_private->int_fp2_i2c_bus);
DRM_DEBUG_KMS("mapped_i2c_bus: 0x%08x\n",
- dev_priv->mapped_i2c_bus);
+ dev_private->mapped_i2c_bus);
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
void via_fp_init(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
struct via_connector *con;
struct via_encoder *enc;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- if ((!(dev_priv->int_fp1_presence)) &&
- (!(dev_priv->int_fp2_presence))) {
+ if ((!(dev_private->int_fp1_presence)) &&
+ (!(dev_private->int_fp2_presence))) {
goto exit;
}
@@ -1330,10 +1349,10 @@ void via_fp_init(struct drm_device *dev)
drm_connector_helper_add(&con->base, &via_fp_connector_helper_funcs);
drm_connector_register(&con->base);
- if (dev_priv->int_fp1_presence) {
- con->i2c_bus = dev_priv->int_fp1_i2c_bus;
- } else if (dev_priv->int_fp2_presence) {
- con->i2c_bus = dev_priv->int_fp2_i2c_bus;
+ if (dev_private->int_fp1_presence) {
+ con->i2c_bus = dev_private->int_fp1_i2c_bus;
+ } else if (dev_private->int_fp2_presence) {
+ con->i2c_bus = dev_private->int_fp2_i2c_bus;
} else {
con->i2c_bus = VIA_I2C_NONE;
}
@@ -1353,10 +1372,10 @@ void via_fp_init(struct drm_device *dev)
enc->base.possible_crtcs = BIT(1) | BIT(0);
- if (dev_priv->int_fp1_presence) {
- enc->di_port = dev_priv->int_fp1_di_port;
- } else if (dev_priv->int_fp2_presence) {
- enc->di_port = dev_priv->int_fp2_di_port;
+ if (dev_private->int_fp1_presence) {
+ enc->di_port = dev_private->int_fp1_di_port;
+ } else if (dev_private->int_fp2_presence) {
+ enc->di_port = dev_private->int_fp2_di_port;
} else {
enc->di_port = VIA_DI_PORT_NONE;
}
diff --git a/drivers/gpu/drm/openchrome/openchrome_gem.c b/drivers/gpu/drm/openchrome/openchrome_gem.c
index f2a53df4babd..f152954213d5 100644
--- a/drivers/gpu/drm/openchrome/openchrome_gem.c
+++ b/drivers/gpu/drm/openchrome/openchrome_gem.c
@@ -65,18 +65,18 @@ ttm_gem_mapping(struct drm_gem_object *obj)
*/
int ttm_mmap(struct file *filp, struct vm_area_struct *vma)
{
- struct via_device *dev_priv;
+ struct openchrome_drm_private *dev_private;
struct drm_file *file_priv;
if (unlikely(vma->vm_pgoff < DRM_FILE_PAGE_OFFSET))
return -EINVAL;
file_priv = filp->private_data;
- dev_priv = file_priv->minor->dev->dev_private;
- if (!dev_priv)
+ dev_private = file_priv->minor->dev->dev_private;
+ if (!dev_private)
return -EINVAL;
- return ttm_bo_mmap(filp, vma, &dev_priv->ttm.bdev);
+ return ttm_bo_mmap(filp, vma, &dev_private->ttm.bdev);
}
struct drm_gem_object *
diff --git a/drivers/gpu/drm/openchrome/openchrome_hdmi.c b/drivers/gpu/drm/openchrome/openchrome_hdmi.c
index e31a94f1b139..8552693706f5 100644
--- a/drivers/gpu/drm/openchrome/openchrome_hdmi.c
+++ b/drivers/gpu/drm/openchrome/openchrome_hdmi.c
@@ -40,7 +40,8 @@ static const struct drm_encoder_funcs via_hdmi_enc_funcs = {
static void
via_hdmi_enc_dpms(struct drm_encoder *encoder, int mode)
{
- struct via_device *dev_priv = encoder->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
switch (mode) {
case DRM_MODE_DPMS_SUSPEND:
@@ -149,7 +150,7 @@ static void
via_hdmi_native_mode_set(struct via_crtc *iga, struct drm_display_mode *mode,
bool audio_off)
{
- struct via_device *dev_priv = iga->base.dev->dev_private;
+ struct openchrome_drm_private *dev_private = iga->base.dev->dev_private;
u32 reg_c280, reg_c284;
int max_packet, delay;
u8 value = BIT(0);
@@ -236,7 +237,7 @@ via_hdmi_enc_mode_set(struct drm_encoder *encoder,
{
struct via_encoder *enc = container_of(encoder, struct via_encoder, base);
struct via_crtc *iga = container_of(encoder->crtc, struct via_crtc, base);
- struct via_device *dev_priv = encoder->dev->dev_private;
+ struct openchrome_drm_private *dev_private = encoder->dev->dev_private;
struct drm_connector *connector = NULL, *con;
struct drm_device *dev = encoder->dev;
@@ -381,9 +382,10 @@ static const struct drm_encoder_helper_funcs via_hdmi_enc_helper_funcs = {
.disable = via_encoder_disable,
};
-static unsigned int
-via_check_hdmi_i2c_status(struct via_device *dev_priv,
- unsigned int check_bits, unsigned int condition)
+static unsigned int via_check_hdmi_i2c_status(
+ struct openchrome_drm_private *dev_private,
+ unsigned int check_bits,
+ unsigned int condition)
{
unsigned int status = true, max = 50, loop = 0;
@@ -407,9 +409,10 @@ via_check_hdmi_i2c_status(struct via_device *dev_priv,
return status;
}
-unsigned int
-via_ddc_read_bytes_by_hdmi(struct via_device *dev_priv, unsigned int offset,
- unsigned char *block)
+unsigned int via_ddc_read_bytes_by_hdmi(
+ struct openchrome_drm_private *dev_private,
+ unsigned int offset,
+ unsigned char *block)
{
unsigned int status = true, temp = 0, i;
@@ -422,7 +425,8 @@ via_ddc_read_bytes_by_hdmi(struct via_device *dev_priv, unsigned int offset,
VIA_WRITE(0xC0B8, 0x0011);
VIA_WRITE(0xC0B8, 0x0019);
if (status)
- status = via_check_hdmi_i2c_status(dev_priv, 0x0018, true);
+ status = via_check_hdmi_i2c_status(dev_private,
+ 0x0018, true);
/* Slave Address */
temp = 0xA0;
@@ -431,7 +435,8 @@ via_ddc_read_bytes_by_hdmi(struct via_device *dev_priv, unsigned int offset,
VIA_WRITE(0xC0B4, temp);
VIA_WRITE(0xC0B8, 0x0009);
if (status)
- status = via_check_hdmi_i2c_status(dev_priv, 0x0008, true);
+ status = via_check_hdmi_i2c_status(dev_private,
+ 0x0008, true);
/* Offset */
temp = offset;
@@ -440,13 +445,15 @@ via_ddc_read_bytes_by_hdmi(struct via_device *dev_priv, unsigned int offset,
VIA_WRITE(0xC0B4, temp);
VIA_WRITE(0xC0B8, 0x0009);
if (status)
- status = via_check_hdmi_i2c_status(dev_priv, 0x0008, true);
+ status = via_check_hdmi_i2c_status(dev_private,
+ 0x0008, true);
/* START */
VIA_WRITE(0xC0B8, 0x0011);
VIA_WRITE(0xC0B8, 0x0019);
if (status)
- status = via_check_hdmi_i2c_status(dev_priv, 0x0018, true);
+ status = via_check_hdmi_i2c_status(dev_private,
+ 0x0018, true);
/* Slave Address + 1 */
temp = 0xA1;
@@ -455,13 +462,14 @@ via_ddc_read_bytes_by_hdmi(struct via_device *dev_priv, unsigned int offset,
VIA_WRITE(0xC0B4, temp);
VIA_WRITE(0xC0B8, 0x0009);
if (status)
- status = via_check_hdmi_i2c_status(dev_priv, 0x0008, true);
+ status = via_check_hdmi_i2c_status(dev_private,
+ 0x0008, true);
for (i = 0; i < EDID_LENGTH; i++) {
/* Read Data */
VIA_WRITE(0xC0B8, 0x0009);
- via_check_hdmi_i2c_status(dev_priv, 0x0008, true);
- via_check_hdmi_i2c_status(dev_priv, 0x0080, false);
+ via_check_hdmi_i2c_status(dev_private, 0x0008, true);
+ via_check_hdmi_i2c_status(dev_private, 0x0080, false);
*block++ = (unsigned char) ((VIA_READ(0xC0B4) & 0x0000FF00) >> 8);
VIA_WRITE(0xC0B8, (VIA_READ(0xC0B8) & ~0x80));
}
@@ -470,7 +478,8 @@ via_ddc_read_bytes_by_hdmi(struct via_device *dev_priv, unsigned int offset,
VIA_WRITE(0xC0B8, 0x0021);
VIA_WRITE(0xC0B8, 0x0029);
- status = via_check_hdmi_i2c_status(dev_priv, 0x0828, true);
+ status = via_check_hdmi_i2c_status(dev_private,
+ 0x0828, true);
if (!status) {
/* Reset */
VIA_WRITE_MASK(0xC0C4, 0x00000080, 0x00000080);
@@ -483,7 +492,8 @@ struct edid *
via_hdmi_get_edid(struct drm_connector *connector)
{
bool print_bad_edid = !connector->bad_edid_counter || (drm_debug & DRM_UT_KMS);
- struct via_device *dev_priv = connector->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ connector->dev->dev_private;
struct edid *edid = NULL;
int i, j = 0;
u8 *block;
@@ -497,7 +507,8 @@ via_hdmi_get_edid(struct drm_connector *connector)
/* base block fetch */
for (i = 0; i < 4; i++) {
- if (!via_ddc_read_bytes_by_hdmi(dev_priv, 0, block))
+ if (!via_ddc_read_bytes_by_hdmi(dev_private,
+ 0, block))
goto out;
if (drm_edid_block_valid(block, 0, print_bad_edid, NULL))
@@ -525,7 +536,9 @@ via_hdmi_get_edid(struct drm_connector *connector)
offset = (valid_extensions + 1) * EDID_LENGTH;
new = block + offset;
- if (!via_ddc_read_bytes_by_hdmi(dev_priv, offset, new))
+ if (!via_ddc_read_bytes_by_hdmi(
+ dev_private,
+ offset, new))
goto out;
if (drm_edid_block_valid(new, j, print_bad_edid, NULL)) {
@@ -571,7 +584,8 @@ out:
static enum drm_connector_status
via_hdmi_detect(struct drm_connector *connector, bool force)
{
- struct via_device *dev_priv = connector->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ connector->dev->dev_private;
enum drm_connector_status ret = connector_status_disconnected;
u32 mm_c730 = VIA_READ(0xc730) & 0xC0000000;
struct edid *edid = NULL;
diff --git a/drivers/gpu/drm/openchrome/openchrome_i2c.c b/drivers/gpu/drm/openchrome/openchrome_i2c.c
index 08a2648d86d4..158ec88a963c 100644
--- a/drivers/gpu/drm/openchrome/openchrome_i2c.c
+++ b/drivers/gpu/drm/openchrome/openchrome_i2c.c
@@ -31,7 +31,7 @@ static void via_i2c_setsda(void *data, int state)
{
struct via_i2c_stuff *i2c = data;
struct drm_device *dev = i2c_get_adapdata(&i2c->adapter);
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
u8 value, mask;
if (i2c->is_active == GPIO) {
@@ -49,7 +49,7 @@ static void via_i2c_setscl(void *data, int state)
{
struct via_i2c_stuff *i2c = data;
struct drm_device *dev = i2c_get_adapdata(&i2c->adapter);
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
u8 value, mask;
if (i2c->is_active == GPIO) {
@@ -67,7 +67,7 @@ static int via_i2c_getsda(void *data)
{
struct via_i2c_stuff *i2c = data;
struct drm_device *dev = i2c_get_adapdata(&i2c->adapter);
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
return vga_rseq(VGABASE, i2c->i2c_port) & BIT(2);
}
@@ -76,7 +76,7 @@ static int via_i2c_getscl(void *data)
{
struct via_i2c_stuff *i2c = data;
struct drm_device *dev = i2c_get_adapdata(&i2c->adapter);
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
return vga_rseq(VGABASE, i2c->i2c_port) & BIT(3);
}
diff --git a/drivers/gpu/drm/openchrome/openchrome_ioc32.c b/drivers/gpu/drm/openchrome/openchrome_ioc32.c
index 4a5fa6626a5d..d38f4fce3ab6 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ioc32.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ioc32.c
@@ -33,7 +33,7 @@ static int
via_getparam(struct drm_device *dev, void *data,
struct drm_file *filp)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
struct drm_via_param *args = data;
int ret = 0;
@@ -42,7 +42,7 @@ via_getparam(struct drm_device *dev, void *data,
args->value = dev->pdev->device;
break;
case VIA_PARAM_REVISION_ID:
- args->value = dev_priv->revision;
+ args->value = dev_private->revision;
break;
default:
ret = -EINVAL;
@@ -63,12 +63,12 @@ static int
via_gem_alloc(struct drm_device *dev, void *data,
struct drm_file *filp)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
struct drm_via_gem_object *args = data;
struct drm_gem_object *obj;
int ret = -ENOMEM;
- obj = ttm_gem_create(dev, &dev_priv->ttm.bdev, args->size,
+ obj = ttm_gem_create(dev, &dev_private->ttm.bdev, args->size,
ttm_bo_type_device, args->domains,
args->alignment, PAGE_SIZE, false);
if (obj != NULL) {
diff --git a/drivers/gpu/drm/openchrome/openchrome_pm.c b/drivers/gpu/drm/openchrome/openchrome_pm.c
index 971286c11d9c..8af8ae7c7543 100644
--- a/drivers/gpu/drm/openchrome/openchrome_pm.c
+++ b/drivers/gpu/drm/openchrome/openchrome_pm.c
@@ -26,8 +26,9 @@
#include "openchrome_drv.h"
-static void
-via_init_2d(struct via_device *dev_priv, int pci_device)
+static void via_init_2d(
+ struct openchrome_drm_private *dev_private,
+ int pci_device)
{
int i;
@@ -39,8 +40,8 @@ via_init_2d(struct via_device *dev_priv, int pci_device)
VIA_WRITE(0x60, 0x0);
}
-static void
-via_init_3d(struct via_device *dev_priv)
+static void via_init_3d(
+ struct openchrome_drm_private *dev_private)
{
unsigned long texture_stage;
int i;
@@ -171,12 +172,11 @@ via_init_3d(struct via_device *dev_priv)
VIA_WRITE(VIA_REG_TRANSPACE, 0x130002db);
}
-static void
-via_init_vq(struct via_device *dev_priv)
+static void via_init_vq(struct openchrome_drm_private *dev_private)
{
unsigned long vq_start_addr, vq_end_addr, vqlen;
unsigned long vqstartl, vqendl, vqstart_endh;
- struct ttm_buffer_object *bo = dev_priv->vq.bo;
+ struct ttm_buffer_object *bo = dev_private->vq.bo;
if (!bo)
return;
@@ -198,11 +198,11 @@ via_init_vq(struct via_device *dev_priv)
VIA_WRITE(0x420, 0x00000000);
}
-static void
-via_init_pcie_gart_table(struct via_device *dev_priv,
- struct pci_dev *pdev)
+static void via_init_pcie_gart_table(
+ struct openchrome_drm_private *dev_private,
+ struct pci_dev *pdev)
{
- struct ttm_buffer_object *bo = dev_priv->gart.bo;
+ struct ttm_buffer_object *bo = dev_private->gart.bo;
u8 value;
if (!pci_is_pcie(pdev) || !bo)
@@ -234,16 +234,15 @@ via_init_pcie_gart_table(struct via_device *dev_priv,
* 2. hw engine intialization:2D;3D;VQ
* 3. Ring Buffer mechanism setup
*/
-void
-via_engine_init(struct drm_device *dev)
+void via_engine_init(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
/* initial engines */
- via_init_2d(dev_priv, dev->pdev->device);
- via_init_3d(dev_priv);
- via_init_vq(dev_priv);
+ via_init_2d(dev_private, dev->pdev->device);
+ via_init_3d(dev_private);
+ via_init_vq(dev_private);
/* pcie gart table setup */
- via_init_pcie_gart_table(dev_priv, dev->pdev);
+ via_init_pcie_gart_table(dev_private, dev->pdev);
}
diff --git a/drivers/gpu/drm/openchrome/openchrome_sii164.c b/drivers/gpu/drm/openchrome/openchrome_sii164.c
index a3d4654f668f..561f51af60e9 100644
--- a/drivers/gpu/drm/openchrome/openchrome_sii164.c
+++ b/drivers/gpu/drm/openchrome/openchrome_sii164.c
@@ -131,7 +131,8 @@ static void openchrome_sii164_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;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
struct i2c_adapter *i2c_bus;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -155,13 +156,15 @@ static void openchrome_sii164_dpms(struct drm_encoder *encoder, int mode)
switch (mode) {
case DRM_MODE_DPMS_ON:
openchrome_sii164_power(i2c_bus, true);
- openchrome_transmitter_io_pad_state(dev_priv, enc->di_port, true);
+ openchrome_transmitter_io_pad_state(dev_private,
+ enc->di_port, true);
break;
case DRM_MODE_DPMS_STANDBY:
case DRM_MODE_DPMS_SUSPEND:
case DRM_MODE_DPMS_OFF:
openchrome_sii164_power(i2c_bus, false);
- openchrome_transmitter_io_pad_state(dev_priv, enc->di_port, false);
+ openchrome_transmitter_io_pad_state(dev_private,
+ enc->di_port, false);
break;
default:
DRM_ERROR("Bad DPMS mode.");
@@ -191,7 +194,8 @@ static void openchrome_sii164_mode_set(struct drm_encoder *encoder,
struct via_crtc *iga = container_of(encoder->crtc, struct via_crtc, base);
struct via_encoder *enc = container_of(encoder,
struct via_encoder, base);
- struct via_device *dev_priv = encoder->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
struct i2c_adapter *i2c_bus;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -211,15 +215,19 @@ static void openchrome_sii164_mode_set(struct drm_encoder *encoder,
goto exit;
}
- openchrome_transmitter_clock_drive_strength(dev_priv, enc->di_port, 0x03);
- openchrome_transmitter_data_drive_strength(dev_priv, enc->di_port, 0x03);
- openchrome_transmitter_io_pad_state(dev_priv, enc->di_port, true);
+ openchrome_transmitter_clock_drive_strength(dev_private,
+ enc->di_port, 0x03);
+ openchrome_transmitter_data_drive_strength(dev_private,
+ enc->di_port, 0x03);
+ openchrome_transmitter_io_pad_state(dev_private,
+ enc->di_port, true);
openchrome_sii164_display_registers(i2c_bus);
openchrome_sii164_init_registers(i2c_bus);
openchrome_sii164_display_registers(i2c_bus);
- openchrome_transmitter_display_source(dev_priv, enc->di_port, iga->index);
+ openchrome_transmitter_display_source(dev_private,
+ enc->di_port, iga->index);
exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
@@ -229,7 +237,8 @@ static void openchrome_sii164_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;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
struct i2c_adapter *i2c_bus;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -250,7 +259,8 @@ static void openchrome_sii164_prepare(struct drm_encoder *encoder)
}
openchrome_sii164_power(i2c_bus, false);
- openchrome_transmitter_io_pad_state(dev_priv, enc->di_port, false);
+ openchrome_transmitter_io_pad_state(dev_private,
+ enc->di_port, false);
exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
@@ -259,7 +269,8 @@ static void openchrome_sii164_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;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
struct i2c_adapter *i2c_bus;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -280,7 +291,8 @@ static void openchrome_sii164_commit(struct drm_encoder *encoder)
}
openchrome_sii164_power(i2c_bus, true);
- openchrome_transmitter_io_pad_state(dev_priv, enc->di_port, true);
+ openchrome_transmitter_io_pad_state(dev_private,
+ enc->di_port, true);
exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
@@ -290,7 +302,8 @@ static void openchrome_sii164_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;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
struct i2c_adapter *i2c_bus;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -311,7 +324,8 @@ static void openchrome_sii164_disable(struct drm_encoder *encoder)
}
openchrome_sii164_power(i2c_bus, false);
- openchrome_transmitter_io_pad_state(dev_priv, enc->di_port, false);
+ openchrome_transmitter_io_pad_state(dev_private,
+ enc->di_port, false);
exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
@@ -506,11 +520,11 @@ void openchrome_sii164_init(struct drm_device *dev)
{
struct via_connector *con;
struct via_encoder *enc;
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- if (!dev_priv->ext_tmds_presence) {
+ if (!dev_private->ext_tmds_presence) {
goto exit;
}
@@ -528,11 +542,11 @@ void openchrome_sii164_init(struct drm_device *dev)
enc->base.possible_crtcs = BIT(1) | BIT(0);
enc->base.possible_clones = 0;
- enc->i2c_bus = dev_priv->ext_tmds_i2c_bus;
- enc->di_port = dev_priv->ext_tmds_di_port;
+ enc->i2c_bus = dev_private->ext_tmds_i2c_bus;
+ enc->di_port = dev_private->ext_tmds_di_port;
/* Increment the number of DVI connectors. */
- dev_priv->number_dvi++;
+ dev_private->number_dvi++;
con = &enc->cons[0];
@@ -545,7 +559,7 @@ void openchrome_sii164_init(struct drm_device *dev)
con->base.doublescan_allowed = false;
con->base.interlace_allowed = false;
- con->i2c_bus = dev_priv->ext_tmds_i2c_bus;
+ con->i2c_bus = dev_private->ext_tmds_i2c_bus;
INIT_LIST_HEAD(&con->props);
drm_connector_attach_encoder(&con->base, &enc->base);
diff --git a/drivers/gpu/drm/openchrome/openchrome_tmds.c b/drivers/gpu/drm/openchrome/openchrome_tmds.c
index 536ae09dcf62..0415cf58ac8d 100644
--- a/drivers/gpu/drm/openchrome/openchrome_tmds.c
+++ b/drivers/gpu/drm/openchrome/openchrome_tmds.c
@@ -29,7 +29,7 @@
#include "openchrome_drv.h"
-static void via_tmds_power(struct via_device *dev_priv,
+static void via_tmds_power(struct openchrome_drm_private *dev_private,
bool power_state)
{
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -50,8 +50,9 @@ 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)
+static void via_tmds_io_pad_setting(
+ struct openchrome_drm_private *dev_private,
+ u32 di_port, bool io_pad_on)
{
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -74,7 +75,8 @@ static void via_tmds_io_pad_setting(struct via_device *dev_priv,
* 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)
+static void via_tmds_init_reg(
+ struct openchrome_drm_private *dev_private)
{
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -143,8 +145,9 @@ static void via_tmds_init_reg(struct via_device *dev_priv)
/*
* Set TMDS (DVI) sync polarity.
*/
-static void
-via_tmds_sync_polarity(struct via_device *dev_priv, unsigned int flags)
+static void via_tmds_sync_polarity(
+ struct openchrome_drm_private *dev_private,
+ unsigned int flags)
{
u8 syncPolarity = 0x00;
@@ -170,8 +173,9 @@ via_tmds_sync_polarity(struct via_device *dev_priv, unsigned int flags)
/*
* Sets TMDS (DVI) display source.
*/
-static void
-via_tmds_display_source(struct via_device *dev_priv, int index)
+static void via_tmds_display_source(
+ struct openchrome_drm_private *dev_private,
+ int index)
{
u8 displaySource = index;
@@ -195,20 +199,23 @@ 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;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
switch (mode) {
case DRM_MODE_DPMS_ON:
- via_tmds_power(dev_priv, true);
- via_tmds_io_pad_setting(dev_priv, enc->di_port, true);
+ via_tmds_power(dev_private, true);
+ via_tmds_io_pad_setting(dev_private,
+ 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);
- via_tmds_io_pad_setting(dev_priv, enc->di_port, false);
+ via_tmds_power(dev_private, false);
+ via_tmds_io_pad_setting(dev_private,
+ enc->di_port, false);
break;
default:
DRM_ERROR("Bad DPMS mode.");
@@ -235,12 +242,13 @@ 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;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- via_tmds_power(dev_priv, false);
- via_tmds_io_pad_setting(dev_priv, enc->di_port, false);
+ via_tmds_power(dev_private, false);
+ via_tmds_io_pad_setting(dev_private, enc->di_port, false);
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
@@ -249,12 +257,13 @@ 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;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- via_tmds_power(dev_priv, true);
- via_tmds_io_pad_setting(dev_priv, enc->di_port, true);
+ via_tmds_power(dev_private, true);
+ via_tmds_io_pad_setting(dev_private, enc->di_port, true);
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
@@ -267,15 +276,16 @@ via_tmds_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
- struct via_device *dev_priv = encoder->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
struct via_crtc *iga = container_of(encoder->crtc,
struct via_crtc, base);
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- via_tmds_init_reg(dev_priv);
- via_tmds_sync_polarity(dev_priv, adjusted_mode->flags);
- via_tmds_display_source(dev_priv, iga->index);
+ via_tmds_init_reg(dev_private);
+ via_tmds_sync_polarity(dev_private, adjusted_mode->flags);
+ via_tmds_display_source(dev_private, iga->index);
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
@@ -284,12 +294,13 @@ 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;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- via_tmds_power(dev_priv, false);
- via_tmds_io_pad_setting(dev_priv, enc->di_port, false);
+ via_tmds_power(dev_private, false);
+ via_tmds_io_pad_setting(dev_private, enc->di_port, false);
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
@@ -390,7 +401,7 @@ static const struct drm_connector_helper_funcs via_dvi_connector_helper_funcs =
*/
void via_tmds_probe(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
u16 chipset = dev->pdev->device;
u8 sr13, sr5a;
@@ -422,57 +433,60 @@ void via_tmds_probe(struct drm_device *dev)
* 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;
+ if (dev_private->is_via_nanobook) {
+ dev_private->int_tmds_presence = true;
+ dev_private->int_tmds_di_port =
+ VIA_DI_PORT_TMDS;
+ dev_private->int_tmds_i2c_bus = VIA_I2C_BUS2;
+ dev_private->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;
+ dev_private->int_tmds_presence = true;
+ dev_private->int_tmds_di_port =
+ VIA_DI_PORT_TMDS;
+ dev_private->int_tmds_i2c_bus = VIA_I2C_BUS2;
+ dev_private->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;
+ dev_private->int_tmds_presence = false;
+ dev_private->int_tmds_di_port =
+ VIA_DI_PORT_NONE;
+ dev_private->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;
+ dev_private->int_tmds_presence = false;
+ dev_private->int_tmds_di_port = VIA_DI_PORT_NONE;
+ dev_private->int_tmds_i2c_bus = VIA_I2C_NONE;
break;
}
DRM_DEBUG_KMS("int_tmds_presence: %x\n",
- dev_priv->int_tmds_presence);
+ dev_private->int_tmds_presence);
DRM_DEBUG_KMS("int_tmds_di_port: 0x%08x\n",
- dev_priv->int_tmds_di_port);
+ dev_private->int_tmds_di_port);
DRM_DEBUG_KMS("int_tmds_i2c_bus: 0x%08x\n",
- dev_priv->int_tmds_i2c_bus);
+ dev_private->int_tmds_i2c_bus);
DRM_DEBUG_KMS("mapped_i2c_bus: 0x%08x\n",
- dev_priv->mapped_i2c_bus);
+ dev_private->mapped_i2c_bus);
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
void via_tmds_init(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
struct via_connector *con;
struct via_encoder *enc;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- if (!dev_priv->int_tmds_presence) {
+ if (!dev_private->int_tmds_presence) {
goto exit;
}
@@ -491,10 +505,10 @@ void via_tmds_init(struct drm_device *dev)
enc->base.possible_crtcs = BIT(1) | BIT(0);
enc->base.possible_clones = 0;
- enc->di_port = dev_priv->int_tmds_di_port;
+ enc->di_port = dev_private->int_tmds_di_port;
/* Increment the number of DVI connectors. */
- dev_priv->number_dvi++;
+ dev_private->number_dvi++;
con = &enc->cons[0];
@@ -503,7 +517,7 @@ void via_tmds_init(struct drm_device *dev)
drm_connector_helper_add(&con->base, &via_dvi_connector_helper_funcs);
drm_connector_register(&con->base);
- con->i2c_bus = dev_priv->int_tmds_i2c_bus;
+ con->i2c_bus = dev_private->int_tmds_i2c_bus;
con->base.doublescan_allowed = false;
con->base.interlace_allowed = true;
INIT_LIST_HEAD(&con->props);
@@ -518,46 +532,50 @@ exit:
*/
void openchrome_ext_dvi_probe(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
struct i2c_adapter *i2c_bus;
u16 chipset = dev->pdev->device;
u8 sr12, sr13;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- dev_priv->ext_tmds_presence = false;
- dev_priv->ext_tmds_i2c_bus = VIA_I2C_NONE;
- dev_priv->ext_tmds_transmitter = VIA_TMDS_NONE;
+ dev_private->ext_tmds_presence = false;
+ dev_private->ext_tmds_i2c_bus = VIA_I2C_NONE;
+ dev_private->ext_tmds_transmitter = VIA_TMDS_NONE;
- if ((!dev_priv->ext_tmds_presence) &&
- (!(dev_priv->mapped_i2c_bus & VIA_I2C_BUS2))) {
+ if ((!dev_private->ext_tmds_presence) &&
+ (!(dev_private->mapped_i2c_bus & VIA_I2C_BUS2))) {
i2c_bus = via_find_ddc_bus(0x31);
if (openchrome_vt1632_probe(i2c_bus)) {
- dev_priv->ext_tmds_presence = true;
- dev_priv->ext_tmds_i2c_bus = VIA_I2C_BUS2;
- dev_priv->ext_tmds_transmitter = VIA_TMDS_VT1632;
- dev_priv->mapped_i2c_bus |= VIA_I2C_BUS2;
+ dev_private->ext_tmds_presence = true;
+ dev_private->ext_tmds_i2c_bus = VIA_I2C_BUS2;
+ dev_private->ext_tmds_transmitter =
+ VIA_TMDS_VT1632;
+ dev_private->mapped_i2c_bus |= VIA_I2C_BUS2;
} else if (openchrome_sii164_probe(i2c_bus)) {
- dev_priv->ext_tmds_presence = true;
- dev_priv->ext_tmds_i2c_bus = VIA_I2C_BUS2;
- dev_priv->ext_tmds_transmitter = VIA_TMDS_SII164;
- dev_priv->mapped_i2c_bus |= VIA_I2C_BUS2;
+ dev_private->ext_tmds_presence = true;
+ dev_private->ext_tmds_i2c_bus = VIA_I2C_BUS2;
+ dev_private->ext_tmds_transmitter =
+ VIA_TMDS_SII164;
+ dev_private->mapped_i2c_bus |= VIA_I2C_BUS2;
}
}
- if ((!(dev_priv->ext_tmds_presence)) &&
- (!(dev_priv->mapped_i2c_bus & VIA_I2C_BUS4))) {
+ if ((!(dev_private->ext_tmds_presence)) &&
+ (!(dev_private->mapped_i2c_bus & VIA_I2C_BUS4))) {
i2c_bus = via_find_ddc_bus(0x2c);
if (openchrome_vt1632_probe(i2c_bus)) {
- dev_priv->ext_tmds_presence = true;
- dev_priv->ext_tmds_i2c_bus = VIA_I2C_BUS4;
- dev_priv->ext_tmds_transmitter = VIA_TMDS_VT1632;
- dev_priv->mapped_i2c_bus |= VIA_I2C_BUS4;
+ dev_private->ext_tmds_presence = true;
+ dev_private->ext_tmds_i2c_bus = VIA_I2C_BUS4;
+ dev_private->ext_tmds_transmitter =
+ VIA_TMDS_VT1632;
+ dev_private->mapped_i2c_bus |= VIA_I2C_BUS4;
} else if (openchrome_sii164_probe(i2c_bus)) {
- dev_priv->ext_tmds_presence = true;
- dev_priv->ext_tmds_i2c_bus = VIA_I2C_BUS4;
- dev_priv->ext_tmds_transmitter = VIA_TMDS_SII164;
- dev_priv->mapped_i2c_bus |= VIA_I2C_BUS4;
+ dev_private->ext_tmds_presence = true;
+ dev_private->ext_tmds_i2c_bus = VIA_I2C_BUS4;
+ dev_private->ext_tmds_transmitter =
+ VIA_TMDS_SII164;
+ dev_private->mapped_i2c_bus |= VIA_I2C_BUS4;
}
}
@@ -566,7 +584,7 @@ void openchrome_ext_dvi_probe(struct drm_device *dev)
DRM_DEBUG_KMS("SR12: 0x%02x\n", sr12);
DRM_DEBUG_KMS("SR13: 0x%02x\n", sr13);
- if (dev_priv->ext_tmds_presence) {
+ if (dev_private->ext_tmds_presence) {
switch (chipset) {
case PCI_DEVICE_ID_VIA_CLE266:
@@ -575,17 +593,17 @@ void openchrome_ext_dvi_probe(struct drm_device *dev)
* capture device
* 1: Flat panel */
if (!(sr12 & BIT(4))) {
- dev_priv->ext_tmds_di_port =
+ dev_private->ext_tmds_di_port =
VIA_DI_PORT_DIP0;
/* 3C5.12[5] - FPD18 pin strapping
* 0: TMDS transmitter (DVI)
* 1: TV encoder */
} else if (!(sr12 & BIT(5))) {
- dev_priv->ext_tmds_di_port =
+ dev_private->ext_tmds_di_port =
VIA_DI_PORT_DIP1;
} else {
- dev_priv->ext_tmds_di_port =
+ dev_private->ext_tmds_di_port =
VIA_DI_PORT_NONE;
}
@@ -603,10 +621,10 @@ void openchrome_ext_dvi_probe(struct drm_device *dev)
* 0: TMDS transmitter (DVI)
* 1: TV encoder */
if ((sr12 & BIT(6)) && (!(sr12 & BIT(5)))) {
- dev_priv->ext_tmds_di_port =
+ dev_private->ext_tmds_di_port =
VIA_DI_PORT_DVP0;
} else {
- dev_priv->ext_tmds_di_port =
+ dev_private->ext_tmds_di_port =
VIA_DI_PORT_DVP1;
}
@@ -623,10 +641,10 @@ void openchrome_ext_dvi_probe(struct drm_device *dev)
* 0: TMDS transmitter (DVI)
* 1: TV encoder */
if ((sr12 & BIT(6)) && (!(sr12 & BIT(5)))) {
- dev_priv->ext_tmds_di_port =
+ dev_private->ext_tmds_di_port =
VIA_DI_PORT_DVP0;
} else {
- dev_priv->ext_tmds_di_port =
+ dev_private->ext_tmds_di_port =
VIA_DI_PORT_NONE;
}
@@ -635,10 +653,12 @@ void openchrome_ext_dvi_probe(struct drm_device *dev)
case PCI_DEVICE_ID_VIA_VT1122:
case PCI_DEVICE_ID_VIA_VX875:
case PCI_DEVICE_ID_VIA_VX900_VGA:
- dev_priv->ext_tmds_di_port = VIA_DI_PORT_DVP1;
+ dev_private->ext_tmds_di_port =
+ VIA_DI_PORT_DVP1;
break;
default:
- dev_priv->ext_tmds_di_port = VIA_DI_PORT_NONE;
+ dev_private->ext_tmds_di_port =
+ VIA_DI_PORT_NONE;
break;
}
}
diff --git a/drivers/gpu/drm/openchrome/openchrome_ttm.c b/drivers/gpu/drm/openchrome/openchrome_ttm.c
index 7e627e38d4ab..a89c494c949a 100644
--- a/drivers/gpu/drm/openchrome/openchrome_ttm.c
+++ b/drivers/gpu/drm/openchrome/openchrome_ttm.c
@@ -41,13 +41,14 @@ static void via_ttm_mem_global_release(struct drm_global_reference *ref)
ttm_mem_global_release(ref->object);
}
-static int via_ttm_global_init(struct via_device *dev_priv)
+static int via_ttm_global_init(
+ struct openchrome_drm_private *dev_private)
{
struct drm_global_reference *global_ref;
struct drm_global_reference *bo_ref;
int rc;
- global_ref = &dev_priv->ttm.mem_global_ref;
+ global_ref = &dev_private->ttm.mem_global_ref;
global_ref->global_type = DRM_GLOBAL_TTM_MEM;
global_ref->size = sizeof(struct ttm_mem_global);
global_ref->init = &via_ttm_mem_global_init;
@@ -60,9 +61,9 @@ static int via_ttm_global_init(struct via_device *dev_priv)
return rc;
}
- dev_priv->ttm.bo_global_ref.mem_glob =
- dev_priv->ttm.mem_global_ref.object;
- bo_ref = &dev_priv->ttm.bo_global_ref.ref;
+ dev_private->ttm.bo_global_ref.mem_glob =
+ dev_private->ttm.mem_global_ref.object;
+ bo_ref = &dev_private->ttm.bo_global_ref.ref;
bo_ref->global_type = DRM_GLOBAL_TTM_BO;
bo_ref->size = sizeof(struct ttm_bo_global);
bo_ref->init = &ttm_bo_global_init;
@@ -116,9 +117,11 @@ static int via_init_mem_type(struct ttm_bo_device *bdev, uint32_t type,
struct ttm_mem_type_manager *man)
{
#if IS_ENABLED(CONFIG_AGP)
- struct via_device *dev_priv = container_of(bdev,
- struct via_device, ttm.bdev);
- struct drm_device *dev = dev_priv->dev;
+ struct openchrome_drm_private *dev_private =
+ container_of(bdev,
+ struct openchrome_drm_private,
+ ttm.bdev);
+ struct drm_device *dev = dev_private->dev;
#endif
switch (type) {
@@ -202,11 +205,12 @@ static void via_evict_flags(struct ttm_buffer_object *bo,
static int via_ttm_io_mem_reserve(struct ttm_bo_device *bdev,
struct ttm_mem_reg *mem)
{
- struct via_device *dev_priv = container_of(bdev,
- struct via_device, ttm.bdev);
-
+ struct openchrome_drm_private *dev_private =
+ container_of(bdev,
+ struct openchrome_drm_private,
+ ttm.bdev);
struct ttm_mem_type_manager *man = &bdev->man[mem->mem_type];
- struct drm_device *dev = dev_priv->dev;
+ struct drm_device *dev = dev_private->dev;
mem->bus.base = 0;
mem->bus.addr = NULL;
@@ -269,23 +273,23 @@ static struct ttm_bo_driver via_bo_driver = {
.io_mem_free = via_ttm_io_mem_free,
};
-int via_mm_init(struct via_device *dev_priv)
+int via_mm_init(struct openchrome_drm_private *dev_private)
{
- struct drm_device *dev = dev_priv->dev;
+ struct drm_device *dev = dev_private->dev;
int ret;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- ret = via_ttm_global_init(dev_priv);
+ ret = via_ttm_global_init(dev_private);
if (ret) {
DRM_ERROR("Failed to initialise TTM: %d\n", ret);
goto exit;
}
- dev_priv->ttm.bdev.dev_mapping = dev->anon_inode->i_mapping;
+ dev_private->ttm.bdev.dev_mapping = dev->anon_inode->i_mapping;
- ret = ttm_bo_device_init(&dev_priv->ttm.bdev,
- dev_priv->ttm.bo_global_ref.ref.object,
+ ret = ttm_bo_device_init(&dev_private->ttm.bdev,
+ dev_private->ttm.bo_global_ref.ref.object,
&via_bo_driver,
dev->anon_inode->i_mapping,
DRM_FILE_PAGE_OFFSET,
@@ -295,8 +299,8 @@ int via_mm_init(struct via_device *dev_priv)
goto exit;
}
- ret = ttm_bo_init_mm(&dev_priv->ttm.bdev, TTM_PL_VRAM,
- dev_priv->vram_size >> PAGE_SHIFT);
+ ret = ttm_bo_init_mm(&dev_private->ttm.bdev, TTM_PL_VRAM,
+ dev_private->vram_size >> PAGE_SHIFT);
if (ret) {
DRM_ERROR("Failed to map video RAM: %d\n", ret);
goto exit;
@@ -309,15 +313,15 @@ exit:
void via_mm_fini(struct drm_device *dev)
{
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- ttm_bo_device_release(&dev_priv->ttm.bdev);
+ ttm_bo_device_release(&dev_private->ttm.bdev);
- via_ttm_global_release(&dev_priv->ttm.mem_global_ref,
- &dev_priv->ttm.bo_global_ref,
- &dev_priv->ttm.bdev);
+ via_ttm_global_release(&dev_private->ttm.mem_global_ref,
+ &dev_private->ttm.bo_global_ref,
+ &dev_private->ttm.bdev);
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
diff --git a/drivers/gpu/drm/openchrome/openchrome_vt1632.c b/drivers/gpu/drm/openchrome/openchrome_vt1632.c
index de7c5951283f..4b999f5f3ed9 100644
--- a/drivers/gpu/drm/openchrome/openchrome_vt1632.c
+++ b/drivers/gpu/drm/openchrome/openchrome_vt1632.c
@@ -151,7 +151,8 @@ static void openchrome_vt1632_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;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
struct i2c_adapter *i2c_bus;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -175,13 +176,15 @@ static void openchrome_vt1632_dpms(struct drm_encoder *encoder, int mode)
switch (mode) {
case DRM_MODE_DPMS_ON:
openchrome_vt1632_power(i2c_bus, true);
- openchrome_transmitter_io_pad_state(dev_priv, enc->di_port, true);
+ openchrome_transmitter_io_pad_state(dev_private,
+ enc->di_port, true);
break;
case DRM_MODE_DPMS_STANDBY:
case DRM_MODE_DPMS_SUSPEND:
case DRM_MODE_DPMS_OFF:
openchrome_vt1632_power(i2c_bus, false);
- openchrome_transmitter_io_pad_state(dev_priv, enc->di_port, false);
+ openchrome_transmitter_io_pad_state(dev_private,
+ enc->di_port, false);
break;
default:
DRM_ERROR("Bad DPMS mode.");
@@ -211,7 +214,8 @@ static void openchrome_vt1632_mode_set(struct drm_encoder *encoder,
struct via_crtc *iga = container_of(encoder->crtc, struct via_crtc, base);
struct via_encoder *enc = container_of(encoder,
struct via_encoder, base);
- struct via_device *dev_priv = encoder->dev->dev_private;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
struct i2c_adapter *i2c_bus;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -231,15 +235,19 @@ static void openchrome_vt1632_mode_set(struct drm_encoder *encoder,
goto exit;
}
- openchrome_transmitter_clock_drive_strength(dev_priv, enc->di_port, 0x03);
- openchrome_transmitter_data_drive_strength(dev_priv, enc->di_port, 0x03);
- openchrome_transmitter_io_pad_state(dev_priv, enc->di_port, true);
+ openchrome_transmitter_clock_drive_strength(dev_private,
+ enc->di_port, 0x03);
+ openchrome_transmitter_data_drive_strength(dev_private,
+ enc->di_port, 0x03);
+ openchrome_transmitter_io_pad_state(dev_private,
+ enc->di_port, true);
openchrome_vt1632_display_registers(i2c_bus);
openchrome_vt1632_init_registers(i2c_bus);
openchrome_vt1632_display_registers(i2c_bus);
- openchrome_transmitter_display_source(dev_priv, enc->di_port, iga->index);
+ openchrome_transmitter_display_source(dev_private,
+ enc->di_port, iga->index);
exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
@@ -249,7 +257,8 @@ static void openchrome_vt1632_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;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
struct i2c_adapter *i2c_bus;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -270,7 +279,8 @@ static void openchrome_vt1632_prepare(struct drm_encoder *encoder)
}
openchrome_vt1632_power(i2c_bus, false);
- openchrome_transmitter_io_pad_state(dev_priv, enc->di_port, false);
+ openchrome_transmitter_io_pad_state(dev_private,
+ enc->di_port, false);
exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
@@ -279,7 +289,8 @@ static void openchrome_vt1632_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;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
struct i2c_adapter *i2c_bus;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -300,7 +311,8 @@ static void openchrome_vt1632_commit(struct drm_encoder *encoder)
}
openchrome_vt1632_power(i2c_bus, true);
- openchrome_transmitter_io_pad_state(dev_priv, enc->di_port, true);
+ openchrome_transmitter_io_pad_state(dev_private,
+ enc->di_port, true);
exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
@@ -310,7 +322,8 @@ static void openchrome_vt1632_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;
+ struct openchrome_drm_private *dev_private =
+ encoder->dev->dev_private;
struct i2c_adapter *i2c_bus;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
@@ -331,7 +344,8 @@ static void openchrome_vt1632_disable(struct drm_encoder *encoder)
}
openchrome_vt1632_power(i2c_bus, false);
- openchrome_transmitter_io_pad_state(dev_priv, enc->di_port, false);
+ openchrome_transmitter_io_pad_state(dev_private,
+ enc->di_port, false);
exit:
DRM_DEBUG_KMS("Exiting %s.\n", __func__);
}
@@ -526,11 +540,11 @@ void openchrome_vt1632_init(struct drm_device *dev)
{
struct via_connector *con;
struct via_encoder *enc;
- struct via_device *dev_priv = dev->dev_private;
+ struct openchrome_drm_private *dev_private = dev->dev_private;
DRM_DEBUG_KMS("Entered %s.\n", __func__);
- if (!dev_priv->ext_tmds_presence) {
+ if (!dev_private->ext_tmds_presence) {
goto exit;
}
@@ -548,11 +562,11 @@ void openchrome_vt1632_init(struct drm_device *dev)
enc->base.possible_crtcs = BIT(1) | BIT(0);
enc->base.possible_clones = 0;
- enc->i2c_bus = dev_priv->ext_tmds_i2c_bus;
- enc->di_port = dev_priv->ext_tmds_di_port;
+ enc->i2c_bus = dev_private->ext_tmds_i2c_bus;
+ enc->di_port = dev_private->ext_tmds_di_port;
/* Increment the number of DVI connectors. */
- dev_priv->number_dvi++;
+ dev_private->number_dvi++;
con = &enc->cons[0];
@@ -565,7 +579,7 @@ void openchrome_vt1632_init(struct drm_device *dev)
con->base.doublescan_allowed = false;
con->base.interlace_allowed = false;
- con->i2c_bus = dev_priv->ext_tmds_i2c_bus;
+ con->i2c_bus = dev_private->ext_tmds_i2c_bus;
INIT_LIST_HEAD(&con->props);
drm_connector_attach_encoder(&con->base, &enc->base);
commit b17f68f245743ce6b26ef22e28227dd8e0df7dce
Author: Kevin Brace <kevinbrace at gmx.com>
Date: Mon Jan 7 17:28:39 2019 -0800
drm/openchrome: Insert a new header file
Signed-off-by: Kevin Brace <kevinbrace at gmx.com>
diff --git a/drivers/gpu/drm/openchrome/openchrome_drv.h b/drivers/gpu/drm/openchrome/openchrome_drv.h
index d57f735a0b83..f084a2f687c5 100644
--- a/drivers/gpu/drm/openchrome/openchrome_drv.h
+++ b/drivers/gpu/drm/openchrome/openchrome_drv.h
@@ -1,84 +1,96 @@
/*
- * Copyright 2014 James Simmons <jsimmons at infradead.org>
- * Influenced by sample code from VIA Technologies and the radeon driver.
+ * Copyright © 2019 Kevin Brace
*
- * Copyright 1998-2003 VIA Technologies, Inc. All Rights Reserved.
- * Copyright 2001-2003 S3 Graphics, Inc. All Rights Reserved.
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use, copy,
+ * modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
*
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
+ * The above copyright notice and this permission notice (including
+ * the next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
*
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHOR(S) OR COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
+/*
+ * Author(s):
+ *
+ * Kevin Brace <kevinbrace at gmx.com>
+ */
-#ifndef _VIA_DRV_H_
-#define _VIA_DRV_H_
+#ifndef _OPENCHROME_DRV_H
+#define _OPENCHROME_DRV_H
-#define DRIVER_AUTHOR "OpenChrome Project"
-#define DRIVER_NAME "openchrome"
-#define DRIVER_DESC "OpenChrome DRM for VIA Technologies Chrome IGP"
-#define DRIVER_DATE "20190104"
-#define DRIVER_MAJOR 3
-#define DRIVER_MINOR 1
-#define DRIVER_PATCHLEVEL 0
#include <linux/module.h>
+#include <video/vga.h>
+
+#include <drm/drmP.h>
+#include <drm/drm_global.h>
+#include <drm/drm_gem.h>
+
#include "ttm/ttm_bo_api.h"
#include "ttm/ttm_bo_driver.h"
#include "ttm/ttm_placement.h"
-#include "ttm/ttm_memory.h"
-#include "ttm/ttm_module.h"
-#include "ttm/ttm_page_alloc.h"
-#include "ttm/ttm_tt.h"
-#include <drm/drmP.h>
-#include <drm/drm_gem.h>
#include <drm/via_drm.h>
#include "openchrome_display.h"
#include "openchrome_regs.h"
+
+#define DRIVER_MAJOR 3
+#define DRIVER_MINOR 1
+#define DRIVER_PATCHLEVEL 0
+#define DRIVER_NAME "openchrome"
+#define DRIVER_DESC "OpenChrome DRM for VIA Technologies Chrome IGP"
+#define DRIVER_DATE "20190104"
+#define DRIVER_AUTHOR "OpenChrome Project"
+
+
#define VIA_MM_ALIGN_SIZE 16
-#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
+#define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT)
+
#define CLE266_REVISION_AX 0x0A
#define CLE266_REVISION_CX 0x0C
+
#define CX700_REVISION_700 0x0
#define CX700_REVISION_700M 0x1
#define CX700_REVISION_700M2 0x2
-/* For VT3353 */
-#define VX800_REVISION_A 0x0f
-#define VX800_REVISION_B0 0x10
-#define VX800_REVISION_B1 0x11
-#define VX800_REVISION_B2 0x12
-
-/* For VT3409 */
-#define VX855_REVISION_A0 0x00
-#define VX855_REVISION_A1 0x01
-#define VX855_REVISION_A2 0x02
+#define VIA_MEM_NONE 0x00
+#define VIA_MEM_SDR66 0x01
+#define VIA_MEM_SDR100 0x02
+#define VIA_MEM_SDR133 0x03
+#define VIA_MEM_DDR_200 0x04
+#define VIA_MEM_DDR_266 0x05
+#define VIA_MEM_DDR_333 0x06
+#define VIA_MEM_DDR_400 0x07
+#define VIA_MEM_DDR2_400 0x08
+#define VIA_MEM_DDR2_533 0x09
+#define VIA_MEM_DDR2_667 0x0A
+#define VIA_MEM_DDR2_800 0x0B
+#define VIA_MEM_DDR2_1066 0x0C
+#define VIA_MEM_DDR3_533 0x0D
+#define VIA_MEM_DDR3_667 0x0E
+#define VIA_MEM_DDR3_800 0x0F
+#define VIA_MEM_DDR3_1066 0x10
+#define VIA_MEM_DDR3_1333 0x11
+#define VIA_MEM_DDR3_1600 0x12
-/* For VT3410 */
-#define VX900_REVISION_A0 0x00
-#define VX900_REVISION_A1 0x01
-#define VX900_REVISION_A2 0x02
-#define VX900_REVISION_A3 0x03
struct via_state {
struct vga_regset crt_regs[256];
@@ -181,20 +193,26 @@ struct via_device {
uint8_t saved_cr3e;
uint8_t saved_cr3f;
- /* Due to the way VIA NanoBook reference design implemented
+ /*
+ * Due to the way VIA NanoBook reference design implemented
* the pin strapping settings, DRM needs to ignore them for
- * FP and DVI to be properly detected. */
+ * FP and DVI to be properly detected.
+ */
bool is_via_nanobook;
- /* Quanta IL1 netbook has its FP connected to DVP1
+ /*
+ * Quanta IL1 netbook has its FP connected to DVP1
* rather than LVDS, hence, a special flag register
- * is needed for properly controlling its FP. */
+ * is needed for properly controlling its FP.
+ */
bool is_quanta_il1;
- /* Samsung NC20 netbook has its FP connected to LVDS2
- * rather than the more logical LVDS1, hence, a special
- * flag register is needed for properly controlling its
- * FP. */
+ /*
+ * Samsung NC20 netbook has its FP connected to LVDS2
+ * rather than the more logical LVDS1, hence, a special
+ * flag register is needed for properly controlling its
+ * FP.
+ */
bool is_samsung_nc20;
bool analog_presence;
@@ -226,25 +244,6 @@ struct via_device {
u32 mapped_i2c_bus;
};
-#define VIA_MEM_NONE 0x00
-#define VIA_MEM_SDR66 0x01
-#define VIA_MEM_SDR100 0x02
-#define VIA_MEM_SDR133 0x03
-#define VIA_MEM_DDR_200 0x04
-#define VIA_MEM_DDR_266 0x05
-#define VIA_MEM_DDR_333 0x06
-#define VIA_MEM_DDR_400 0x07
-#define VIA_MEM_DDR2_400 0x08
-#define VIA_MEM_DDR2_533 0x09
-#define VIA_MEM_DDR2_667 0x0A
-#define VIA_MEM_DDR2_800 0x0B
-#define VIA_MEM_DDR2_1066 0x0C
-#define VIA_MEM_DDR3_533 0x0D
-#define VIA_MEM_DDR3_667 0x0E
-#define VIA_MEM_DDR3_800 0x0F
-#define VIA_MEM_DDR3_1066 0x10
-#define VIA_MEM_DDR3_1333 0x11
-#define VIA_MEM_DDR3_1600 0x12
/* VIA MMIO register access */
#define VIA_BASE ((dev_priv->mmio))
@@ -323,4 +322,4 @@ void openchrome_transmitter_display_source(
struct via_device *dev_priv,
u32 di_port, int index);
-#endif
+#endif /* _OPENCHROME_DRV_H */
More information about the openchrome-devel
mailing list