*参照元 [#c450f499]
#backlinks

*説明 [#a2cdae9b]
-パス: [[linux-4.4.1/sound/soc/soc-ops.c]]

-FIXME: これは何?
--説明


**引数 [#d2ff9146]
-struct snd_kcontrol *kcontrol
--
--[[linux-4.4.1/snd_kcontrol]]
-struct snd_ctl_elem_value *ucontrol
--
--[[linux-4.4.1/snd_ctl_elem_value]]


**返り値 [#p3ec70ae]
-int
--


**参考 [#o67efc35]


*実装 [#m886338a]
 /**
  * snd_soc_get_volsw - single mixer get callback
  * @kcontrol: mixer control
  * @ucontrol: control element information
  *
  * Callback to get the value of a single mixer control, or a double mixer
  * control that spans 2 registers.
  *
  * Returns 0 for success.
  */
 int snd_soc_get_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;
         int sign_bit = mc->sign_bit;
         unsigned int mask = (1 << fls(max)) - 1;
         unsigned int invert = mc->invert;
         int val;
         int ret;
 
-
--[[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()]]

         ret = snd_soc_read_signed(component, reg, mask, shift, sign_bit, &val);
         if (ret)
                 return ret;
 
-
--[[linux-4.4.1/snd_soc_read_signed()]]

         ucontrol->value.integer.value[0] = val - min;
         if (invert)
                 ucontrol->value.integer.value[0] =
                         max - ucontrol->value.integer.value[0];
 
         if (snd_soc_volsw_is_stereo(mc)) {
-
--[[linux-4.4.1/snd_soc_volsw_is_stereo()]]

                 if (reg == reg2)
                         ret = snd_soc_read_signed(component, reg, mask, rshift,
                                 sign_bit, &val);
                 else
                         ret = snd_soc_read_signed(component, reg2, mask, shift,
                                 sign_bit, &val);
                 if (ret)
                         return ret;
 
                 ucontrol->value.integer.value[1] = val - min;
                 if (invert)
                         ucontrol->value.integer.value[1] =
                                 max - ucontrol->value.integer.value[1];
         }
 
         return 0;
 }
 EXPORT_SYMBOL_GPL(snd_soc_get_volsw);
-
--[[linux-4.4.1/EXPORT_SYMBOL_GPL()]]


*コメント [#r0c8b935]


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS