- Rename hw.snd.unit to hw.snd.default_unit to make the purpose more obvious.

- Enable 4 automatic vchan's by default.
- Add some comments which provide ides/questions for improvement.
- Prefix some temporary sysctl's with an underscore to denote that it is not
  an official API but a workaround until the real solution is implemented.
This commit is contained in:
Alexander Leidinger 2006-06-18 14:14:41 +00:00
parent ea6af27ab0
commit 851a904af5
10 changed files with 61 additions and 15 deletions

View File

@ -244,6 +244,7 @@ SYSCTL_NODE(_hw, OID_AUTO, midi, CTLFLAG_RD, 0, "Midi driver");
SYSCTL_NODE(_hw_midi, OID_AUTO, stat, CTLFLAG_RD, 0, "Status device");
int midi_debug;
/* XXX: should this be moved into debug.midi? */
SYSCTL_INT(_hw_midi, OID_AUTO, debug, CTLFLAG_RW, &midi_debug, 0, "");
int midi_dumpraw;

View File

@ -153,6 +153,7 @@ struct seq_softc {
SYSCTL_NODE(_hw_midi, OID_AUTO, seq, CTLFLAG_RD, 0, "Midi sequencer");
int seq_debug;
/* XXX: should this be moved into debug.midi? */
SYSCTL_INT(_hw_midi_seq, OID_AUTO, debug, CTLFLAG_RW, &seq_debug, 0, "");
midi_cmdtab cmdtab_seqevent[] = {

View File

@ -741,9 +741,14 @@ static int
cmi_initsys(struct sc_info* sc)
{
#ifdef SND_DYNSYSCTL
/* XXX: an user should be able to set this with a control tool,
if not done before 7.0-RELEASE, this needs to be converted
to a device specific sysctl "dev.pcm.X.yyy" via
device_get_sysctl_*() as discussed on multimedia@ in msg-id
<861wujij2q.fsf@xps.des.no> */
SYSCTL_ADD_INT(snd_sysctl_tree(sc->dev),
SYSCTL_CHILDREN(snd_sysctl_tree_top(sc->dev)),
OID_AUTO, "spdif_enabled", CTLFLAG_RW,
OID_AUTO, "_spdif_enabled", CTLFLAG_RW,
&sc->spdif_enabled, 0,
"enable SPDIF output at 44.1 kHz and above");
#endif /* SND_DYNSYSCTL */

View File

@ -1360,9 +1360,14 @@ es_init_sysctls(device_t dev)
(devid == CT5880_PCI_ID && revid == CT5880REV_CT5880_C) ||
(devid == CT5880_PCI_ID && revid == CT5880REV_CT5880_D) ||
(devid == CT5880_PCI_ID && revid == CT5880REV_CT5880_E)) {
/* XXX: an user should be able to set this with a control tool,
if not done before 7.0-RELEASE, this needs to be converted
to a device specific sysctl "dev.pcm.X.yyy" via
device_get_sysctl_*() as discussed on multimedia@ in msg-id
<861wujij2q.fsf@xps.des.no> */
SYSCTL_ADD_PROC(snd_sysctl_tree(dev),
SYSCTL_CHILDREN(snd_sysctl_tree_top(dev)),
OID_AUTO, "spdif_enabled",
OID_AUTO, "_spdif_enabled",
CTLTYPE_INT | CTLFLAG_RW, dev, sizeof(dev),
sysctl_es137x_spdif_enable, "I",
"Enable S/PDIF output on primary playback channel");
@ -1371,9 +1376,14 @@ es_init_sysctls(device_t dev)
* Enable fixed rate sysctl if both DAC2 / ADC enabled.
*/
if (es->ch[ES_DAC2].channel != NULL && es->ch[ES_ADC].channel != NULL) {
/* XXX: an user should be able to set this with a control tool,
if not done before 7.0-RELEASE, this needs to be converted
to a device specific sysctl "dev.pcm.X.yyy" via
device_get_sysctl_*() as discussed on multimedia@ in msg-id
<861wujij2q.fsf@xps.des.no> */
SYSCTL_ADD_PROC(snd_sysctl_tree(dev),
SYSCTL_CHILDREN(snd_sysctl_tree_top(dev)),
OID_AUTO, "fixed_rate",
OID_AUTO, "_fixed_rate",
CTLTYPE_INT | CTLFLAG_RW, dev, sizeof(dev),
sysctl_es137x_fixed_rate, "I",
"Enable fixed rate playback/recording");
@ -1382,9 +1392,14 @@ es_init_sysctls(device_t dev)
* Enable single pcm mixer sysctl if both DAC1/2 enabled.
*/
if (es->ch[ES_DAC1].channel != NULL && es->ch[ES_DAC2].channel != NULL) {
/* XXX: an user should be able to set this with a control tool,
if not done before 7.0-RELEASE, this needs to be converted
to a device specific sysctl "dev.pcm.X.yyy" via
device_get_sysctl_*() as discussed on multimedia@ in msg-id
<861wujij2q.fsf@xps.des.no> */
SYSCTL_ADD_PROC(snd_sysctl_tree(dev),
SYSCTL_CHILDREN(snd_sysctl_tree_top(dev)),
OID_AUTO, "single_pcm_mixer",
OID_AUTO, "_single_pcm_mixer",
CTLTYPE_INT | CTLFLAG_RW, dev, sizeof(dev),
sysctl_es137x_single_pcm_mixer, "I",
"Single PCM mixer controller for both DAC1/DAC2");
@ -1394,6 +1409,9 @@ es_init_sysctls(device_t dev)
device_get_unit(dev), "latency_timer", &r) == 0 &&
!(r < 0 || r > 255))
pci_write_config(dev, PCIR_LATTIMER, r, 1);
/* XXX: this needs to be converted to a device specific sysctl
"dev.pcm.X.yyy" via device_get_sysctl_*() as discussed on
multimedia@ in msg-id <861wujij2q.fsf@xps.des.no> */
SYSCTL_ADD_PROC(snd_sysctl_tree(dev),
SYSCTL_CHILDREN(snd_sysctl_tree_top(dev)),
OID_AUTO, "latency_timer",

View File

@ -561,6 +561,9 @@ static int
ich_initsys(struct sc_info* sc)
{
#ifdef SND_DYNSYSCTL
/* XXX: this should move to a device specific sysctl "dev.pcm.X.yyy"
via device_get_sysctl_*() as discussed on multimedia@ in msg-id
<861wujij2q.fsf@xps.des.no> */
SYSCTL_ADD_INT(snd_sysctl_tree(sc->dev),
SYSCTL_CHILDREN(snd_sysctl_tree_top(sc->dev)),
OID_AUTO, "ac97rate", CTLFLAG_RW,

View File

@ -189,6 +189,9 @@ static unsigned int powerstate_idle = PCI_POWERSTATE_D1;
#endif
static unsigned int powerstate_init = PCI_POWERSTATE_D2;
/* XXX: this should move to a device specific sysctl dev.pcm.X.debug.Y via
device_get_sysctl_*() as discussed on multimedia@ in msg-id
<861wujij2q.fsf@xps.des.no> */
SYSCTL_NODE(_debug, OID_AUTO, maestro, CTLFLAG_RD, 0, "");
SYSCTL_UINT(_debug_maestro, OID_AUTO, powerstate_active, CTLFLAG_RW,
&powerstate_active, 0, "The Dx power state when active (0-1)");

View File

@ -186,15 +186,19 @@ static void
via_init_sysctls(device_t dev)
{
#ifdef SND_DYNSYSCTL
/* XXX: an user should be able to set this with a control tool,
if not done before 7.0-RELEASE, this needs to be converted to
a device specific sysctl "dev.pcm.X.yyy" via device_get_sysctl_*()
as discussed on multimedia@ in msg-id <861wujij2q.fsf@xps.des.no> */
SYSCTL_ADD_PROC(snd_sysctl_tree(dev),
SYSCTL_CHILDREN(snd_sysctl_tree_top(dev)),
OID_AUTO, "spdif_enabled",
OID_AUTO, "_spdif_enabled",
CTLTYPE_INT | CTLFLAG_RW, dev, sizeof(dev),
sysctl_via8233_spdif_enable, "I",
"Enable S/PDIF output on primary playback channel");
SYSCTL_ADD_PROC(snd_sysctl_tree(dev),
SYSCTL_CHILDREN(snd_sysctl_tree_top(dev)),
OID_AUTO, "via_dxs_src",
OID_AUTO, "_via_dxs_src",
CTLTYPE_INT | CTLFLAG_RW, dev, sizeof(dev),
sysctl_via8233_dxs_src, "I",
"Enable VIA DXS Sample Rate Converter");

View File

@ -222,7 +222,9 @@ sysctl_hw_snd_feeder_rate_buffersize(SYSCTL_HANDLER_ARGS)
feeder_rate_buffersize = val & ~1;
return err;
}
SYSCTL_PROC(_hw_snd, OID_AUTO, feeder_rate_buffersize, CTLTYPE_INT | CTLFLAG_RW,
/* XXX: this should be settable by an user via a control tool, the sysadmin
needs a max and min sysctl to limit what an user can do */
SYSCTL_PROC(_hw_snd, OID_AUTO, _feeder_rate_buffersize, CTLTYPE_INT | CTLFLAG_RW,
0, sizeof(int), sysctl_hw_snd_feeder_rate_buffersize, "I", "");
static void

View File

@ -40,10 +40,13 @@ int pcm_veto_load = 1;
#ifdef USING_DEVFS
int snd_unit = 0;
TUNABLE_INT("hw.snd.unit", &snd_unit);
TUNABLE_INT("hw.snd.default_unit", &snd_unit);
#endif
int snd_maxautovchans = 0;
int snd_maxautovchans = 4;
/* XXX: a tunable implies that we may need more than one sound channel before
the system can change a sysctl (/etc/sysctl.conf), do we really need
this? */
TUNABLE_INT("hw.snd.maxautovchans", &snd_maxautovchans);
SYSCTL_NODE(_hw, OID_AUTO, snd, CTLFLAG_RD, 0, "Sound driver");
@ -364,7 +367,7 @@ pcm_setmaxautovchans(struct snddev_info *d, int num)
#ifdef USING_DEVFS
static int
sysctl_hw_snd_unit(SYSCTL_HANDLER_ARGS)
sysctl_hw_snd_default_unit(SYSCTL_HANDLER_ARGS)
{
struct snddev_info *d;
int error, unit;
@ -381,8 +384,9 @@ sysctl_hw_snd_unit(SYSCTL_HANDLER_ARGS)
}
return (error);
}
SYSCTL_PROC(_hw_snd, OID_AUTO, unit, CTLTYPE_INT | CTLFLAG_RW,
0, sizeof(int), sysctl_hw_snd_unit, "I", "");
/* XXX: do we need a way to let the user change the default unit? */
SYSCTL_PROC(_hw_snd, OID_AUTO, default_unit, CTLTYPE_INT | CTLFLAG_RW,
0, sizeof(int), sysctl_hw_snd_default_unit, "I", "");
#endif
static int
@ -867,8 +871,10 @@ pcm_register(device_t dev, void *devinfo, int numplay, int numrec)
sysctl_ctx_free(&d->sysctl_tree);
goto no;
}
/* XXX: an user should be able to set this with a control tool, the
sysadmin then needs min+max sysctls for this */
SYSCTL_ADD_INT(snd_sysctl_tree(dev), SYSCTL_CHILDREN(snd_sysctl_tree_top(dev)),
OID_AUTO, "buffersize", CTLFLAG_RD, &d->bufsz, 0, "");
OID_AUTO, "_buffersize", CTLFLAG_RD, &d->bufsz, 0, "");
#endif
if (numplay > 0) {
d->flags |= SD_F_AUTOVCHAN;

View File

@ -607,11 +607,14 @@ vchan_initsys(device_t dev)
struct snddev_info *d;
d = device_get_softc(dev);
/* XXX: the user should be able to set this with a control tool, the
sysadmin needs a sysctl so set a max value for "vchan" and min+max
values for "vchanrate" to limit what an user can do */
SYSCTL_ADD_PROC(snd_sysctl_tree(dev), SYSCTL_CHILDREN(snd_sysctl_tree_top(dev)),
OID_AUTO, "vchans", CTLTYPE_INT | CTLFLAG_RW, d, sizeof(d),
OID_AUTO, "_vchans", CTLTYPE_INT | CTLFLAG_RW, d, sizeof(d),
sysctl_hw_snd_vchans, "I", "");
SYSCTL_ADD_PROC(snd_sysctl_tree(dev), SYSCTL_CHILDREN(snd_sysctl_tree_top(dev)),
OID_AUTO, "vchanrate", CTLTYPE_INT | CTLFLAG_RW, d, sizeof(d),
OID_AUTO, "_vchanrate", CTLTYPE_INT | CTLFLAG_RW, d, sizeof(d),
sysctl_hw_snd_vchanrate, "I", "");
#endif