Mike Gorchak <mike@malva.ua.remove.this.for.no.spam> wrote:
- The docs nothing says about PCI Bus Master auto enabling. Hugh Brown and
Igor believes in that ado_pci_device function when internally call the
pci_attach_device function uses the undocumented (for now) PCI_MASTER_ENABLE
flag. Is that correct ?
This bit is indeed turned on the ado_pci_device as:
if ((pci->handle = pci_attach_device (NULL, PCI_SEARCH_VENDEV |
PCI_MASTER_ENABLE | PCI_INIT_ALL, index = pci_idx, &inf)) == NULL)
- ado_mixer_element_muxX() function set is not well documented (I mean
control callback for this element, callback’s function args is not
documented at all).
This callback in similar to the other element callbacks with
respect to most of the arguements, the “set” tells you to
set (write) / read the elements state and “inelements” is an
array of elements references. So in the example below for a
cs4218 codec 2 elements route to a stereo mux.
static int32_t
abc_input_mux_control (MIXER_CONTEXT_T * abc, ado_mixer_delement_t * element, uint8_t set,
ado_mixer_delement_t ** inelements, void *instance_data)
{
uint32_t i;
uint32_t data;
uint32_t tmp;
uint32_t val;
int32_t altered = 0;
data = (abc->cs4218_ctrl >> 16) & 0x3;
if (set)
{
for (i = 0, val = 0; i < 2; i++)
{
tmp = 0;
if (inelements == abc->input_l1)
tmp = 0;
else if (inelements == abc->input_l2)
tmp = 1;
val |= tmp << i;
}
altered = val != data;
if (altered)
{
abc->cs4218_ctrl = (abc->cs4218_ctrl & ~(0x3 << 16)) | (val << 16);
cs4218_ctrl_write (abc);
}
}
else
{
for (i = 0; i < 2; i++)
{
tmp = (data >> i) & 0x1;
if (tmp == 0)
inelements = abc->input_l1;
else if (tmp == 1)
inelements = abc->input_l2;
}
}
return (altered);
}
3) I can’t build full capture group. ado_mixer_capture_group_create function
uses cap_elem and mux_in_elem as last two args. This args is not documented
at all. The docs says ‘if the cap_elem is multiplexer’, but I trying to
create all elements, but only multiplexer type is usefull in this case. So
what does mean the word ‘if’ ? I need the good example of creating full
capture group when cap_elem and mux_in_elem is not NULL. I spent too many
hours to understand this mux’es, the result is always unsuccessfull, I
always get errors from ado_mixer_capture_group_create function or io-audio
is core dumped or input switch element doesn’t occurs in photon mixer. This
is for my CMI8738 audio driver, this audio doesn’t have AC’97 codec, so I
need manually create all mixer elements. ALSA architecture has more clear
interface for this things.
The capture element may not be a Mux we may support other
elements at some point, but for now if the element that
enables capture for this group is a mux, then the
mux_in_elem is need for io-audio to call the control
function above.
if (!error && (abc->input_l1 = ado_mixer_element_io (abc->mixer, SND_MIXER_MIC_IN,
SND_MIXER_ETYPE_INPUT, 0, 2, stereo_voices)) == NULL)
error++;
if (!error && (abc->input_l2 = ado_mixer_element_io (abc->mixer, SND_MIXER_LINE_IN,
SND_MIXER_ETYPE_INPUT, 0, 2, stereo_voices)) == NULL)
error++;
if (!error && (input_mux = ado_mixer_element_mux1 (mixer, SND_MIXER_ELEMENT_INPUT_MUX,
0, 2, abc_input_mux_control, NULL, NULL)) == NULL)
…
if (!error && (input_l1_grp = ado_mixer_capture_group_create (mixer, SND_MIXER_MIC_IN,
SND_MIXER_CHN_MASK_STEREO, NULL, NULL, input_mux, abc->input_l1)) == NULL)
error++;
if (!error && (input_l2_grp = ado_mixer_capture_group_create (mixer, SND_MIXER_LINE_IN,
SND_MIXER_CHN_MASK_STEREO, NULL, NULL, input_mux, abc->input_l2)) == NULL)
error++;
But as a side note I thought the CMI8738 used a SB16 legacy
mixer that doesn’t use Multiplexers but rather accumulators.
That is multiple input sources can be selected at the same
time. You may want to look at the ess1938 mixer source as it also
used accumulators rather then multiplexers.