mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
Added a sysctl control variable "ac97rate" to allow manual tuning of
the link rate - some ich motherboards overclock ac97 out of the box. Will hopefully replace this with a callibration loop in time for 4.5R freeze. Problem reported by Luigi Rizzo and fix derived from his code (put diff in ich.c rather than ac97.c). MFC after: 3 days
This commit is contained in:
parent
1abb0234c3
commit
2ae4ee833d
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=88033
@ -79,6 +79,7 @@ struct sc_info {
|
||||
|
||||
struct ac97_info *codec;
|
||||
struct sc_chinfo ch[3];
|
||||
int ac97rate;
|
||||
struct ich_desc *dtbl;
|
||||
};
|
||||
|
||||
@ -284,10 +285,16 @@ ichchan_setspeed(kobj_t obj, void *data, u_int32_t speed)
|
||||
struct sc_chinfo *ch = data;
|
||||
struct sc_info *sc = ch->parent;
|
||||
|
||||
if (ch->spdreg)
|
||||
return ac97_setrate(sc->codec, ch->spdreg, speed);
|
||||
else
|
||||
if (ch->spdreg) {
|
||||
int r;
|
||||
if (sc->ac97rate <= 32000 || sc->ac97rate >= 64000)
|
||||
sc->ac97rate = 48000;
|
||||
r = speed * 48000 / sc->ac97rate;
|
||||
return ac97_setrate(sc->codec, ch->spdreg, r) *
|
||||
sc->ac97rate / 48000;
|
||||
} else {
|
||||
return 48000;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
@ -399,6 +406,22 @@ ich_intr(void *p)
|
||||
}
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
/* Sysctl to control ac97 speed (some boards overclocked ac97). */
|
||||
|
||||
static int
|
||||
ich_initsys(struct sc_info* sc)
|
||||
{
|
||||
#ifdef SND_DYNSYSCTL
|
||||
SYSCTL_ADD_INT(snd_sysctl_tree(sc->dev),
|
||||
SYSCTL_CHILDREN(snd_sysctl_tree_top(sc->dev)),
|
||||
OID_AUTO, "ac97rate", CTLFLAG_RW,
|
||||
&sc->ac97rate, 48000,
|
||||
"AC97 link rate (default = 48000)");
|
||||
#endif /* SND_DYNSYSCTL */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/* Probe and attach the card */
|
||||
|
||||
@ -549,6 +572,8 @@ ich_pci_attach(device_t dev)
|
||||
|
||||
pcm_setstatus(dev, status);
|
||||
|
||||
ich_initsys(sc);
|
||||
|
||||
return 0;
|
||||
|
||||
bad:
|
||||
|
Loading…
Reference in New Issue
Block a user