24 #include <linux/kernel.h>
25 #include <linux/device.h>
27 #include <linux/videodev2.h>
54 static inline int dB_to_cx25840_vol(
int dB)
60 return (dB + 119) << 9;
63 static inline int cx25840_vol_to_dB(
int v)
67 else if (v > (127 << 9))
69 return (v >> 9) - 119;
72 static int snd_ivtv_mixer_tv_vol_info(
struct snd_kcontrol *kcontrol,
84 static int snd_ivtv_mixer_tv_vol_get(
struct snd_kcontrol *kctl,
93 vctrl.value = dB_to_cx25840_vol(uctl->
value.integer.value[0]);
97 snd_ivtv_unlock(itvsc);
100 uctl->
value.integer.value[0] = cx25840_vol_to_dB(vctrl.value);
104 static int snd_ivtv_mixer_tv_vol_put(
struct snd_kcontrol *kctl,
113 vctrl.value = dB_to_cx25840_vol(uctl->
value.integer.value[0]);
115 snd_ivtv_lock(itvsc);
121 (cx25840_vol_to_dB(vctrl.value) != uctl->
value.integer.value[0])) {
124 vctrl.value = dB_to_cx25840_vol(uctl->
value.integer.value[0]);
129 snd_ivtv_unlock(itvsc);
140 .name =
"Analog TV Capture Volume",
143 .info = snd_ivtv_mixer_tv_volume_info,
144 .get = snd_ivtv_mixer_tv_volume_get,
145 .put = snd_ivtv_mixer_tv_volume_put,
146 .tlv.p = snd_ivtv_mixer_tv_vol_db_scale
172 __func__, snd_ivtv_mixer_tv_vol.name, ret);