Commit f0493e65 authored by Mathieu Larouche's avatar Mathieu Larouche Committed by Dave Airlie

drm/mgag200: Added support for the new device G200eH3

- Added the new device ID
- Added new pll algorithm
Signed-off-by: default avatarMathieu Larouche <mathieu.larouche@matrox.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 618a6109
...@@ -36,6 +36,7 @@ static const struct pci_device_id pciidlist[] = { ...@@ -36,6 +36,7 @@ static const struct pci_device_id pciidlist[] = {
{ PCI_VENDOR_ID_MATROX, 0x533, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_EH }, { PCI_VENDOR_ID_MATROX, 0x533, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_EH },
{ PCI_VENDOR_ID_MATROX, 0x534, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_ER }, { PCI_VENDOR_ID_MATROX, 0x534, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_ER },
{ PCI_VENDOR_ID_MATROX, 0x536, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_EW3 }, { PCI_VENDOR_ID_MATROX, 0x536, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_EW3 },
{ PCI_VENDOR_ID_MATROX, 0x538, PCI_ANY_ID, PCI_ANY_ID, 0, 0, G200_EH3 },
{0,} {0,}
}; };
......
...@@ -180,6 +180,7 @@ enum mga_type { ...@@ -180,6 +180,7 @@ enum mga_type {
G200_WB, G200_WB,
G200_EV, G200_EV,
G200_EH, G200_EH,
G200_EH3,
G200_ER, G200_ER,
G200_EW3, G200_EW3,
}; };
......
...@@ -106,6 +106,7 @@ struct mga_i2c_chan *mgag200_i2c_create(struct drm_device *dev) ...@@ -106,6 +106,7 @@ struct mga_i2c_chan *mgag200_i2c_create(struct drm_device *dev)
clock = 2; clock = 2;
break; break;
case G200_EH: case G200_EH:
case G200_EH3:
case G200_ER: case G200_ER:
data = 2; data = 2;
clock = 1; clock = 1;
......
...@@ -497,6 +497,41 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) ...@@ -497,6 +497,41 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock)
bool pll_locked = false; bool pll_locked = false;
m = n = p = 0; m = n = p = 0;
if (mdev->type == G200_EH3) {
vcomax = 3000000;
vcomin = 1500000;
pllreffreq = 25000;
delta = 0xffffffff;
testp = 0;
for (testm = 150; testm >= 6; testm--) {
if (clock * testm > vcomax)
continue;
if (clock * testm < vcomin)
continue;
for (testn = 120; testn >= 60; testn--) {
computed = (pllreffreq * testn) / testm;
if (computed > clock)
tmpdelta = computed - clock;
else
tmpdelta = clock - computed;
if (tmpdelta < delta) {
delta = tmpdelta;
n = testn;
m = testm;
p = testp;
}
if (delta == 0)
break;
}
if (delta == 0)
break;
}
} else {
vcomax = 800000; vcomax = 800000;
vcomin = 400000; vcomin = 400000;
pllreffreq = 33333; pllreffreq = 33333;
...@@ -528,6 +563,7 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock) ...@@ -528,6 +563,7 @@ static int mga_g200eh_set_plls(struct mga_device *mdev, long clock)
} }
} }
} }
}
for (i = 0; i <= 32 && pll_locked == false; i++) { for (i = 0; i <= 32 && pll_locked == false; i++) {
WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL); WREG8(DAC_INDEX, MGA1064_PIX_CLK_CTL);
tmp = RREG8(DAC_DATA); tmp = RREG8(DAC_DATA);
...@@ -674,6 +710,7 @@ static int mga_crtc_set_plls(struct mga_device *mdev, long clock) ...@@ -674,6 +710,7 @@ static int mga_crtc_set_plls(struct mga_device *mdev, long clock)
return mga_g200ev_set_plls(mdev, clock); return mga_g200ev_set_plls(mdev, clock);
break; break;
case G200_EH: case G200_EH:
case G200_EH3:
return mga_g200eh_set_plls(mdev, clock); return mga_g200eh_set_plls(mdev, clock);
break; break;
case G200_ER: case G200_ER:
...@@ -933,6 +970,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, ...@@ -933,6 +970,7 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
option2 = 0x0000b000; option2 = 0x0000b000;
break; break;
case G200_EH: case G200_EH:
case G200_EH3:
dacvalue[MGA1064_MISC_CTL] = MGA1064_MISC_CTL_VGA8 | dacvalue[MGA1064_MISC_CTL] = MGA1064_MISC_CTL_VGA8 |
MGA1064_MISC_CTL_DAC_RAM_CS; MGA1064_MISC_CTL_DAC_RAM_CS;
option = 0x00000120; option = 0x00000120;
...@@ -979,7 +1017,8 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc, ...@@ -979,7 +1017,8 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
if ((mdev->type == G200_EV || if ((mdev->type == G200_EV ||
mdev->type == G200_WB || mdev->type == G200_WB ||
mdev->type == G200_EH || mdev->type == G200_EH ||
mdev->type == G200_EW3) && mdev->type == G200_EW3 ||
mdev->type == G200_EH3) &&
(i >= 0x44) && (i <= 0x4e)) (i >= 0x44) && (i <= 0x4e))
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment