Skip to content

Commit

Permalink
drm/mgag200: Introduce separate variable for PLL S parameter
Browse files Browse the repository at this point in the history
The S parameter is controls the loop filter bandwidth when programming
the PLL. It's currently stored as part of P (i.e., the clock divider.)

Add a separate variable for S prepares the PLL code for further
refactoring. The value of s is currently 0, so it has not yet an effect
on the programming.

v2:
	* add a note on the current value of s to commit message

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210714142240.21979-6-tzimmermann@suse.de
  • Loading branch information
Thomas Zimmermann committed Aug 8, 2021
1 parent f86c3ed commit d9d9922
Showing 1 changed file with 16 additions and 20 deletions.
36 changes: 16 additions & 20 deletions drivers/gpu/drm/mgag200/mgag200_mode.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,17 @@ static int mgag200_compute_pixpll_values_g200se(struct mga_device *mdev, long cl
unsigned int vcomax, vcomin, pllreffreq;
unsigned int delta, tmpdelta, permitteddelta;
unsigned int testp, testm, testn;
unsigned int p, m, n;
unsigned int p, m, n, s;
unsigned int computed;
unsigned int fvv;
unsigned int i;

if (unique_rev_id <= 0x03) {
m = n = p = s = 0;

m = n = p = 0;
if (unique_rev_id <= 0x03) {
vcomax = 320000;
vcomin = 160000;
pllreffreq = 25000;

delta = 0xffffffff;
permitteddelta = clock * 5 / 1000;

Expand Down Expand Up @@ -247,9 +246,6 @@ static int mgag200_compute_pixpll_values_g200se(struct mga_device *mdev, long cl
}
}
} else {


m = n = p = 0;
vcomax = 1600000;
vcomin = 800000;
pllreffreq = 25000;
Expand Down Expand Up @@ -310,7 +306,7 @@ static int mgag200_compute_pixpll_values_g200se(struct mga_device *mdev, long cl
pixpllc->m = m;
pixpllc->n = n;
pixpllc->p = p;
pixpllc->s = 0;
pixpllc->s = s;

return 0;
}
Expand Down Expand Up @@ -344,10 +340,10 @@ static int mgag200_compute_pixpll_values_g200wb(struct mga_device *mdev, long cl
unsigned int vcomax, vcomin, pllreffreq;
unsigned int delta, tmpdelta;
unsigned int testp, testm, testn, testp2;
unsigned int p, m, n;
unsigned int p, m, n, s;
unsigned int computed;

m = n = p = 0;
m = n = p = s = 0;

delta = 0xffffffff;

Expand Down Expand Up @@ -421,7 +417,7 @@ static int mgag200_compute_pixpll_values_g200wb(struct mga_device *mdev, long cl
pixpllc->m = m;
pixpllc->n = n;
pixpllc->p = p;
pixpllc->s = 0;
pixpllc->s = s;

return 0;
}
Expand Down Expand Up @@ -542,10 +538,10 @@ static int mgag200_compute_pixpll_values_g200ev(struct mga_device *mdev, long cl
unsigned int vcomax, vcomin, pllreffreq;
unsigned int delta, tmpdelta;
unsigned int testp, testm, testn;
unsigned int p, m, n;
unsigned int p, m, n, s;
unsigned int computed;

m = n = p = 0;
m = n = p = s = 0;
vcomax = 550000;
vcomin = 150000;
pllreffreq = 50000;
Expand Down Expand Up @@ -579,7 +575,7 @@ static int mgag200_compute_pixpll_values_g200ev(struct mga_device *mdev, long cl
pixpllc->m = m;
pixpllc->n = n;
pixpllc->p = p;
pixpllc->s = 0;
pixpllc->s = s;

return 0;
}
Expand Down Expand Up @@ -652,10 +648,10 @@ static int mgag200_compute_pixpll_values_g200eh(struct mga_device *mdev, long cl
unsigned int vcomax, vcomin, pllreffreq;
unsigned int delta, tmpdelta;
unsigned int testp, testm, testn;
unsigned int p, m, n;
unsigned int p, m, n, s;
unsigned int computed;

m = n = p = 0;
m = n = p = s = 0;

if (mdev->type == G200_EH3) {
vcomax = 3000000;
Expand Down Expand Up @@ -727,7 +723,7 @@ static int mgag200_compute_pixpll_values_g200eh(struct mga_device *mdev, long cl
pixpllc->m = m;
pixpllc->n = n;
pixpllc->p = p;
pixpllc->s = 0;
pixpllc->s = s;

return 0;
}
Expand Down Expand Up @@ -801,10 +797,10 @@ static int mgag200_compute_pixpll_values_g200er(struct mga_device *mdev, long cl
unsigned int vcomax, vcomin, pllreffreq;
unsigned int delta, tmpdelta;
int testr, testn, testm, testo;
unsigned int p, m, n;
unsigned int p, m, n, s;
unsigned int computed, vco;

m = n = p = 0;
m = n = p = s = 0;
vcomax = 1488000;
vcomin = 1056000;
pllreffreq = 48000;
Expand Down Expand Up @@ -846,7 +842,7 @@ static int mgag200_compute_pixpll_values_g200er(struct mga_device *mdev, long cl
pixpllc->m = m;
pixpllc->n = n;
pixpllc->p = p;
pixpllc->s = 0;
pixpllc->s = s;

return 0;
}
Expand Down

0 comments on commit d9d9922

Please sign in to comment.