24 #include <linux/kernel.h>
25 #include <linux/device.h>
27 #include <linux/videodev2.h>
54 static inline int dB_to_cx18_av_vol(
int dB)
60 return (dB + 119) << 9;
63 static inline int cx18_av_vol_to_dB(
int v)
67 else if (v > (127 << 9))
69 return (v >> 9) - 119;
72 static int snd_cx18_mixer_tv_vol_info(
struct snd_kcontrol *kcontrol,
84 static int snd_cx18_mixer_tv_vol_get(
struct snd_kcontrol *kctl,
93 vctrl.value = dB_to_cx18_av_vol(uctl->
value.integer.value[0]);
97 snd_cx18_unlock(cxsc);
100 uctl->
value.integer.value[0] = cx18_av_vol_to_dB(vctrl.value);
104 static int snd_cx18_mixer_tv_vol_put(
struct snd_kcontrol *kctl,
113 vctrl.value = dB_to_cx18_av_vol(uctl->
value.integer.value[0]);
121 (cx18_av_vol_to_dB(vctrl.value) != uctl->
value.integer.value[0])) {
124 vctrl.value = dB_to_cx18_av_vol(uctl->
value.integer.value[0]);
129 snd_cx18_unlock(cxsc);
140 .name =
"Analog TV Capture Volume",
143 .info = snd_cx18_mixer_tv_volume_info,
144 .get = snd_cx18_mixer_tv_volume_get,
145 .put = snd_cx18_mixer_tv_volume_put,
146 .tlv.p = snd_cx18_mixer_tv_vol_db_scale
172 __func__, snd_cx18_mixer_tv_vol.name, ret);