Skip to contentSkip to conversation

Questions: hw_param rules in rme9652, hdsp.c, also for hdspm.c ?

DISCUSSION [email protected] 3 participants 4 messages Oct 8, 2003 – Oct 9, 2003

lore
Share & tools
lore
#0 lore raw

Hello !

I tried to be Luke ;-), and found following rules for the hammerfall cards:

(Maybe I interpret these false)

A) rule_channel which set the limits to channels

->min to double speed channels and channels max to hdsp->singlespeed channels

(in hdsp double speed channels is 13 and ss speed are 26, in hdspm they are 32 and 64)

Why ? Is there a reason to let channels min not to be 1 ?

-> In my opninion I would drop these and also set
.channels_min = 1;
in ..._playback and ..._record_subinfo.

B) Rule set channel according to rate

Here if rate->min is greater than 48000 ( which means double speed rate), set
channelslimit max to double speed channel. thats ok.

but why also set channel->min in the interval also to nummer of double speed channels and not 1 (or leave it to be as is).

-> So i suggest to set t interval to min=1 (or .channels_min from the subinfo).

C) Rule set rate according to channels:

if channel->min count is bigger than ss_speed channels (which means more then max channels of the card), than set rate limits to singlespeed.

first this should never happen (since in subinfo limited) and
if then should it be if channel->min is bigger than double speed channels set rate to single speed which would be

	if (c->min >= hdsp->ds_channels) {
		snd_interval_t t = {
			.min = 32000,
			.max = 48000,
			.integer = 1,
		};
        }

and the else tree (will never be evaluated) says

if channels max < double speed channels use double speed rate

Why is it not allowed to use single speed wenn less channels than double speed can handle are needed ?

-> I would suggest to drop the else tree.

In my hdspm driver the changes works until now (playback only tested) but maybe there is a reason i dont know.

mfg winfried

PS: Here the source for other Lukes ;-)

Rule A)
static int snd_hdsp_hw_rule_channels(snd_pcm_hw_params_t *params,
snd_pcm_hw_rule_t *rule)

{
	hdsp_t *hdsp = rule->private;
	snd_interval_t *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
	unsigned int list[2] = { hdsp->ds_channels, hdsp->ss_channels };
	return snd_interval_list(c, 2, list, 0);
}

Rule B)
static int snd_hdsp_hw_rule_channels_rate(snd_pcm_hw_params_t *params,
snd_pcm_hw_rule_t *rule)

{
	hdsp_t *hdsp = rule->private;
	snd_interval_t *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
	snd_interval_t *r = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
	if (r->min > 48000) {
		snd_interval_t t = {
			.min = hdsp->ds_channels,
			.max = hdsp->ds_channels,
			.integer = 1,
		};
		return snd_interval_refine(c, &t);
	} else if (r->max < 64000) {
		snd_interval_t t = {
			.min = hdsp->ss_channels,
			.max = hdsp->ss_channels,
			.integer = 1,
		};
		return snd_interval_refine(c, &t);
	}
	return 0;
}

Rule C)
static int snd_hdsp_hw_rule_rate_channels(snd_pcm_hw_params_t *params,
snd_pcm_hw_rule_t *rule)

{
	hdsp_t *hdsp = rule->private;
	snd_interval_t *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
	snd_interval_t *r = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
	if (c->min >= hdsp->ss_channels) {
		snd_interval_t t = {
			.min = 32000,
			.max = 48000,
			.integer = 1,
		};
		return snd_interval_refine(r, &t);
	} else if (c->max <= hdsp->ds_channels) {
		snd_interval_t t = {
			.min = 64000,
			.max = 96000,
			.integer = 1,
		};
		return snd_interval_refine(r, &t);
	}
	return 0;
}

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php

#1 lore raw
Quoted 6 lines · On Wed, 8 Oct 2003 [email protected] wrote:

Hello !

I tried to be Luke ;-), and found following rules for the hammerfall cards:

(Maybe I interpret these false)

Quoted 8 lines

A) rule_channel which set the limits to channels

->min to double speed channels and channels max to hdsp->singlespeed channels

(in hdsp double speed channels is 13 and ss speed are 26, in hdspm they are 32 and 64)

Why ? Is there a reason to let channels min not to be 1 ?

Nope. I think that hdsp cards work with all channels simultaneously, thus you'll have to propagate all channels to the user space. It's on applications if it does not use some of them, but being clever than the user space code is not the right thing for ALSA drivers.

Jaroslav

-----
Jaroslav Kysela <[email protected]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php

#2 lore raw
In reply to [email protected]
Quoted 4 lines

(in hdsp double speed channels is 13 and ss speed are 26, in hdspm they are 32 and 64)

Why ? Is there a reason to let channels min not to be 1 ?

ALSA kernel drivers mirror hardware capabilities. its not possible to configure the hardware to use just 1 channel. user space (alsa-lib) allows use of other numbers of channels.

Quoted 1 line

B) Rule set channel according to rate

[ ... ]

Quoted 1 line

-> So i suggest to set t interval to min=1 (or .channels_min from the subinfo).

same reason.

Quoted 1 line

C) Rule set rate according to channels:

[ ... ]

Quoted 2 lines

Why is it not allowed to use single speed wenn less channels than double speed can handle are needed ?

same reason.

to repeat: ALSA kernel drivers mirror hardware capabilities. all other stuff is in user-space, where it can exist just once and be shared across all cards, without polluting the kernel with policy decisions. the MADI driver should reflect what the hardware can do, nothing more and nothing less. alsalib will handle the rest.

--p

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php

#3 lore raw

Thanx,
that make it clear.

Quoted 9 lines
Quoted 3 lines

[hw_rules to make min channels max channels]

Why ? Is there a reason to let channels min not to be 1 ?

ALSA kernel drivers mirror hardware capabilities. its not possible to configure the hardware to use just 1 channel. user space (alsa-lib) allows use of other numbers of channels.

Ok, on the rme9652 this is definitive true, I agree.

Since I can enable DMA individual on the HDSP-MADI card as a new function, I can say hardware supports the use of less channels and so

so I will set min channels to 1.

Even I saw in the hdsp.c driver,

static inline int snd_hdsp_enable_io (hdsp_t *hdsp);
...

	for (i = 0; i < HDSP_MAX_CHANNELS; ++i) {
		hdsp_write (hdsp, HDSP_inputEnable + (4 * i), 1);
		hdsp_write (hdsp, HDSP_outputEnable + (4 * i), 1);
	}

...

which I think, but I am not sure about, can turn DMA-channels for each channel on and off, so the card can be used with lesser channels (and DMA-.., PCI-Load) for better performance.

But I think, this isnt a big problem not to use this. On 64channels with DMA in/out it make sense to scale Bus-usage, since setting the matrix mixer you can play all outputs with lesser channels, even with one.

Quoted 8 lines
Quoted 2 lines

C) Rule set rate according to channels:

[ ... ]

Quoted 2 lines

Why is it not allowed to use single speed wenn less channels than double speed can handle are needed ?

same reason.

Rule C) Here is a little different question:

	if (c->min >= hdsp->ss_channels) {
		snd_interval_t t = {
			.min = 32000,
			.max = 48000,
			.integer = 1,
		};
		return snd_interval_refine(r, &t);
	} else if (c->max <= hdsp->ds_channels) {
		snd_interval_t t = {
			.min = 64000,
			.max = 96000,
			.integer = 1,
		};
		return snd_interval_refine(r, &t);
	}

should be if (c->min >= hdsp->ds_channels) since ds_channels are lower count than ss_channels and then single speed should be used if more channels are requested than ds_channels, that
would make sense.

and second part if (c->max <= hdsp->ds_channels)
i dont know why to force to double speed ?

mfg winfried

-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php