*参照元 [#u2d0fdb8] #backlinks *説明 [#tb5621a5] -パス: [[linux-4.4.1/sound/soc/soc-ops.c]] -FIXME: これは何? --説明 **引数 [#y43212f4] -struct snd_kcontrol *kcontrol -- --[[linux-4.4.1/snd_kcontrol]] -struct snd_ctl_elem_value *ucontrol -- --[[linux-4.4.1/snd_ctl_elem_value]] **返り値 [#secc217a] -int -- **参考 [#xbb30c05] *実装 [#x7c3b2f5] /** * snd_soc_put_volsw - single mixer put callback * @kcontrol: mixer control * @ucontrol: control element information * * Callback to set the value of a single mixer control, or a double mixer * control that spans 2 registers. * * Returns 0 for success. */ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value; unsigned int reg = mc->reg; unsigned int reg2 = mc->rreg; unsigned int shift = mc->shift; unsigned int rshift = mc->rshift; int max = mc->max; int min = mc->min; unsigned int sign_bit = mc->sign_bit; unsigned int mask = (1 << fls(max)) - 1; unsigned int invert = mc->invert; int err; bool type_2r = false; unsigned int val2 = 0; unsigned int val, val_mask; - --[[linux-4.4.1/snd_soc_component]] --[[linux-4.4.1/snd_kcontrol_chip()]] --[[linux-4.4.1/soc_mixer_control]] --[[linux-4.4.1/fls()]] if (sign_bit) mask = BIT(sign_bit + 1) - 1; - --[[linux-4.4.1/BIT()]] val = ((ucontrol->value.integer.value[0] + min) & mask); if (invert) val = max - val; val_mask = mask << shift; val = val << shift; if (snd_soc_volsw_is_stereo(mc)) { val2 = ((ucontrol->value.integer.value[1] + min) & mask); if (invert) val2 = max - val2; if (reg == reg2) { val_mask |= mask << rshift; val |= val2 << rshift; } else { val2 = val2 << shift; type_2r = true; } - --[[linux-4.4.1/snd_soc_volsw_is_stereo()]] } err = snd_soc_component_update_bits(component, reg, val_mask, val); if (err < 0) return err; - --[[linux-4.4.1/snd_soc_component_update_bits()]] if (type_2r) err = snd_soc_component_update_bits(component, reg2, val_mask, val2); return err; } EXPORT_SYMBOL_GPL(snd_soc_put_volsw); - --[[linux-4.4.1/EXPORT_SYMBOL_GPL()]] *コメント [#o28c1d3c]