On Mon, Aug 18, 2014 at 09:58:11AM +0530, Subhransu S. Prusty wrote:
On Thu, Aug 14, 2014 at 02:07:08PM +0100, Mark Brown wrote:
for (i = 0; i < w->num_kcontrols; i++) { if (dapm_kcontrol_get_value(w->kcontrols[i])) { val |= 1 << i; }
Is this ok?
No, that doesn't seem safe. Why not read the data from the control - if we were calling a function which returned the value that'd be much clearer.
So lets step back and see what is required here.
I get a mixer update for one of the inputs of the mixer. This needs to be communicated to the DSP via the IPC. But the IPC expects that we send all the values of all the inputs of a mixer to the DSP.
That is why here we are reading the all mixer inputs to find the values and send the bitmap of all inputs.
So from the driver if I have to find out what is the value of the inputs in mixer, how do I do that, is there a simpler way? Or should we push this/<something else> into framework to query
The problem is that it looks like you are reading the value from the control, treating it as a boolean and discarding it.