aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorAdrian Knoth <adi@drcomp.erfurt.thur.de>2012-12-03 08:55:51 -0500
committerTakashi Iwai <tiwai@suse.de>2012-12-03 09:30:01 -0500
commit467b10350525e53ddeea0b8de5b8b386a830d2a9 (patch)
tree2fa5003f9d5bd5ea3245d958131e3ca45bcbfd3c /sound/pci
parentc9e1668c68c623296f4aca35ffca5763665e58de (diff)
ALSA: hdspm - Remove obsolete settings functions
With HDSPM_TOGGLE_SETTING in place, these functions are no longer required. Removing them makes the code DRY and considerably shorter. Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/rme9652/hdspm.c393
1 files changed, 0 insertions, 393 deletions
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index f958e204eb4b..a7e0de1a1b4b 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -2944,399 +2944,6 @@ static int snd_hdspm_put_toggle_setting(struct snd_kcontrol *kcontrol,
2944 return change; 2944 return change;
2945} 2945}
2946 2946
2947
2948#define HDSPM_LINE_OUT(xname, xindex) \
2949{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2950 .name = xname, \
2951 .index = xindex, \
2952 .info = snd_hdspm_info_line_out, \
2953 .get = snd_hdspm_get_line_out, \
2954 .put = snd_hdspm_put_line_out \
2955}
2956
2957static int hdspm_line_out(struct hdspm * hdspm)
2958{
2959 return (hdspm->control_register & HDSPM_LineOut) ? 1 : 0;
2960}
2961
2962
2963static int hdspm_set_line_output(struct hdspm * hdspm, int out)
2964{
2965 if (out)
2966 hdspm->control_register |= HDSPM_LineOut;
2967 else
2968 hdspm->control_register &= ~HDSPM_LineOut;
2969 hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);
2970
2971 return 0;
2972}
2973
2974#define snd_hdspm_info_line_out snd_ctl_boolean_mono_info
2975
2976static int snd_hdspm_get_line_out(struct snd_kcontrol *kcontrol,
2977 struct snd_ctl_elem_value *ucontrol)
2978{
2979 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
2980
2981 spin_lock_irq(&hdspm->lock);
2982 ucontrol->value.integer.value[0] = hdspm_line_out(hdspm);
2983 spin_unlock_irq(&hdspm->lock);
2984 return 0;
2985}
2986
2987static int snd_hdspm_put_line_out(struct snd_kcontrol *kcontrol,
2988 struct snd_ctl_elem_value *ucontrol)
2989{
2990 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
2991 int change;
2992 unsigned int val;
2993
2994 if (!snd_hdspm_use_is_exclusive(hdspm))
2995 return -EBUSY;
2996 val = ucontrol->value.integer.value[0] & 1;
2997 spin_lock_irq(&hdspm->lock);
2998 change = (int) val != hdspm_line_out(hdspm);
2999 hdspm_set_line_output(hdspm, val);
3000 spin_unlock_irq(&hdspm->lock);
3001 return change;
3002}
3003
3004
3005#define HDSPM_TX_64(xname, xindex) \
3006{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3007 .name = xname, \
3008 .index = xindex, \
3009 .info = snd_hdspm_info_tx_64, \
3010 .get = snd_hdspm_get_tx_64, \
3011 .put = snd_hdspm_put_tx_64 \
3012}
3013
3014static int hdspm_tx_64(struct hdspm * hdspm)
3015{
3016 return (hdspm->control_register & HDSPM_TX_64ch) ? 1 : 0;
3017}
3018
3019static int hdspm_set_tx_64(struct hdspm * hdspm, int out)
3020{
3021 if (out)
3022 hdspm->control_register |= HDSPM_TX_64ch;
3023 else
3024 hdspm->control_register &= ~HDSPM_TX_64ch;
3025 hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);
3026
3027 return 0;
3028}
3029
3030#define snd_hdspm_info_tx_64 snd_ctl_boolean_mono_info
3031
3032static int snd_hdspm_get_tx_64(struct snd_kcontrol *kcontrol,
3033 struct snd_ctl_elem_value *ucontrol)
3034{
3035 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3036
3037 spin_lock_irq(&hdspm->lock);
3038 ucontrol->value.integer.value[0] = hdspm_tx_64(hdspm);
3039 spin_unlock_irq(&hdspm->lock);
3040 return 0;
3041}
3042
3043static int snd_hdspm_put_tx_64(struct snd_kcontrol *kcontrol,
3044 struct snd_ctl_elem_value *ucontrol)
3045{
3046 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3047 int change;
3048 unsigned int val;
3049
3050 if (!snd_hdspm_use_is_exclusive(hdspm))
3051 return -EBUSY;
3052 val = ucontrol->value.integer.value[0] & 1;
3053 spin_lock_irq(&hdspm->lock);
3054 change = (int) val != hdspm_tx_64(hdspm);
3055 hdspm_set_tx_64(hdspm, val);
3056 spin_unlock_irq(&hdspm->lock);
3057 return change;
3058}
3059
3060
3061#define HDSPM_C_TMS(xname, xindex) \
3062{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3063 .name = xname, \
3064 .index = xindex, \
3065 .info = snd_hdspm_info_c_tms, \
3066 .get = snd_hdspm_get_c_tms, \
3067 .put = snd_hdspm_put_c_tms \
3068}
3069
3070static int hdspm_c_tms(struct hdspm * hdspm)
3071{
3072 return (hdspm->control_register & HDSPM_clr_tms) ? 1 : 0;
3073}
3074
3075static int hdspm_set_c_tms(struct hdspm * hdspm, int out)
3076{
3077 if (out)
3078 hdspm->control_register |= HDSPM_clr_tms;
3079 else
3080 hdspm->control_register &= ~HDSPM_clr_tms;
3081 hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);
3082
3083 return 0;
3084}
3085
3086#define snd_hdspm_info_c_tms snd_ctl_boolean_mono_info
3087
3088static int snd_hdspm_get_c_tms(struct snd_kcontrol *kcontrol,
3089 struct snd_ctl_elem_value *ucontrol)
3090{
3091 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3092
3093 spin_lock_irq(&hdspm->lock);
3094 ucontrol->value.integer.value[0] = hdspm_c_tms(hdspm);
3095 spin_unlock_irq(&hdspm->lock);
3096 return 0;
3097}
3098
3099static int snd_hdspm_put_c_tms(struct snd_kcontrol *kcontrol,
3100 struct snd_ctl_elem_value *ucontrol)
3101{
3102 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3103 int change;
3104 unsigned int val;
3105
3106 if (!snd_hdspm_use_is_exclusive(hdspm))
3107 return -EBUSY;
3108 val = ucontrol->value.integer.value[0] & 1;
3109 spin_lock_irq(&hdspm->lock);
3110 change = (int) val != hdspm_c_tms(hdspm);
3111 hdspm_set_c_tms(hdspm, val);
3112 spin_unlock_irq(&hdspm->lock);
3113 return change;
3114}
3115
3116
3117#define HDSPM_SAFE_MODE(xname, xindex) \
3118{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3119 .name = xname, \
3120 .index = xindex, \
3121 .info = snd_hdspm_info_safe_mode, \
3122 .get = snd_hdspm_get_safe_mode, \
3123 .put = snd_hdspm_put_safe_mode \
3124}
3125
3126static int hdspm_safe_mode(struct hdspm * hdspm)
3127{
3128 return (hdspm->control_register & HDSPM_AutoInp) ? 1 : 0;
3129}
3130
3131static int hdspm_set_safe_mode(struct hdspm * hdspm, int out)
3132{
3133 if (out)
3134 hdspm->control_register |= HDSPM_AutoInp;
3135 else
3136 hdspm->control_register &= ~HDSPM_AutoInp;
3137 hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);
3138
3139 return 0;
3140}
3141
3142#define snd_hdspm_info_safe_mode snd_ctl_boolean_mono_info
3143
3144static int snd_hdspm_get_safe_mode(struct snd_kcontrol *kcontrol,
3145 struct snd_ctl_elem_value *ucontrol)
3146{
3147 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3148
3149 spin_lock_irq(&hdspm->lock);
3150 ucontrol->value.integer.value[0] = hdspm_safe_mode(hdspm);
3151 spin_unlock_irq(&hdspm->lock);
3152 return 0;
3153}
3154
3155static int snd_hdspm_put_safe_mode(struct snd_kcontrol *kcontrol,
3156 struct snd_ctl_elem_value *ucontrol)
3157{
3158 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3159 int change;
3160 unsigned int val;
3161
3162 if (!snd_hdspm_use_is_exclusive(hdspm))
3163 return -EBUSY;
3164 val = ucontrol->value.integer.value[0] & 1;
3165 spin_lock_irq(&hdspm->lock);
3166 change = (int) val != hdspm_safe_mode(hdspm);
3167 hdspm_set_safe_mode(hdspm, val);
3168 spin_unlock_irq(&hdspm->lock);
3169 return change;
3170}
3171
3172
3173#define HDSPM_EMPHASIS(xname, xindex) \
3174{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3175 .name = xname, \
3176 .index = xindex, \
3177 .info = snd_hdspm_info_emphasis, \
3178 .get = snd_hdspm_get_emphasis, \
3179 .put = snd_hdspm_put_emphasis \
3180}
3181
3182static int hdspm_emphasis(struct hdspm * hdspm)
3183{
3184 return (hdspm->control_register & HDSPM_Emphasis) ? 1 : 0;
3185}
3186
3187static int hdspm_set_emphasis(struct hdspm * hdspm, int emp)
3188{
3189 if (emp)
3190 hdspm->control_register |= HDSPM_Emphasis;
3191 else
3192 hdspm->control_register &= ~HDSPM_Emphasis;
3193 hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);
3194
3195 return 0;
3196}
3197
3198#define snd_hdspm_info_emphasis snd_ctl_boolean_mono_info
3199
3200static int snd_hdspm_get_emphasis(struct snd_kcontrol *kcontrol,
3201 struct snd_ctl_elem_value *ucontrol)
3202{
3203 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3204
3205 spin_lock_irq(&hdspm->lock);
3206 ucontrol->value.enumerated.item[0] = hdspm_emphasis(hdspm);
3207 spin_unlock_irq(&hdspm->lock);
3208 return 0;
3209}
3210
3211static int snd_hdspm_put_emphasis(struct snd_kcontrol *kcontrol,
3212 struct snd_ctl_elem_value *ucontrol)
3213{
3214 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3215 int change;
3216 unsigned int val;
3217
3218 if (!snd_hdspm_use_is_exclusive(hdspm))
3219 return -EBUSY;
3220 val = ucontrol->value.integer.value[0] & 1;
3221 spin_lock_irq(&hdspm->lock);
3222 change = (int) val != hdspm_emphasis(hdspm);
3223 hdspm_set_emphasis(hdspm, val);
3224 spin_unlock_irq(&hdspm->lock);
3225 return change;
3226}
3227
3228
3229#define HDSPM_DOLBY(xname, xindex) \
3230{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3231 .name = xname, \
3232 .index = xindex, \
3233 .info = snd_hdspm_info_dolby, \
3234 .get = snd_hdspm_get_dolby, \
3235 .put = snd_hdspm_put_dolby \
3236}
3237
3238static int hdspm_dolby(struct hdspm * hdspm)
3239{
3240 return (hdspm->control_register & HDSPM_Dolby) ? 1 : 0;
3241}
3242
3243static int hdspm_set_dolby(struct hdspm * hdspm, int dol)
3244{
3245 if (dol)
3246 hdspm->control_register |= HDSPM_Dolby;
3247 else
3248 hdspm->control_register &= ~HDSPM_Dolby;
3249 hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);
3250
3251 return 0;
3252}
3253
3254#define snd_hdspm_info_dolby snd_ctl_boolean_mono_info
3255
3256static int snd_hdspm_get_dolby(struct snd_kcontrol *kcontrol,
3257 struct snd_ctl_elem_value *ucontrol)
3258{
3259 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3260
3261 spin_lock_irq(&hdspm->lock);
3262 ucontrol->value.enumerated.item[0] = hdspm_dolby(hdspm);
3263 spin_unlock_irq(&hdspm->lock);
3264 return 0;
3265}
3266
3267static int snd_hdspm_put_dolby(struct snd_kcontrol *kcontrol,
3268 struct snd_ctl_elem_value *ucontrol)
3269{
3270 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3271 int change;
3272 unsigned int val;
3273
3274 if (!snd_hdspm_use_is_exclusive(hdspm))
3275 return -EBUSY;
3276 val = ucontrol->value.integer.value[0] & 1;
3277 spin_lock_irq(&hdspm->lock);
3278 change = (int) val != hdspm_dolby(hdspm);
3279 hdspm_set_dolby(hdspm, val);
3280 spin_unlock_irq(&hdspm->lock);
3281 return change;
3282}
3283
3284
3285#define HDSPM_PROFESSIONAL(xname, xindex) \
3286{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3287 .name = xname, \
3288 .index = xindex, \
3289 .info = snd_hdspm_info_professional, \
3290 .get = snd_hdspm_get_professional, \
3291 .put = snd_hdspm_put_professional \
3292}
3293
3294static int hdspm_professional(struct hdspm * hdspm)
3295{
3296 return (hdspm->control_register & HDSPM_Professional) ? 1 : 0;
3297}
3298
3299static int hdspm_set_professional(struct hdspm * hdspm, int dol)
3300{
3301 if (dol)
3302 hdspm->control_register |= HDSPM_Professional;
3303 else
3304 hdspm->control_register &= ~HDSPM_Professional;
3305 hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);
3306
3307 return 0;
3308}
3309
3310#define snd_hdspm_info_professional snd_ctl_boolean_mono_info
3311
3312static int snd_hdspm_get_professional(struct snd_kcontrol *kcontrol,
3313 struct snd_ctl_elem_value *ucontrol)
3314{
3315 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3316
3317 spin_lock_irq(&hdspm->lock);
3318 ucontrol->value.enumerated.item[0] = hdspm_professional(hdspm);
3319 spin_unlock_irq(&hdspm->lock);
3320 return 0;
3321}
3322
3323static int snd_hdspm_put_professional(struct snd_kcontrol *kcontrol,
3324 struct snd_ctl_elem_value *ucontrol)
3325{
3326 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3327 int change;
3328 unsigned int val;
3329
3330 if (!snd_hdspm_use_is_exclusive(hdspm))
3331 return -EBUSY;
3332 val = ucontrol->value.integer.value[0] & 1;
3333 spin_lock_irq(&hdspm->lock);
3334 change = (int) val != hdspm_professional(hdspm);
3335 hdspm_set_professional(hdspm, val);
3336 spin_unlock_irq(&hdspm->lock);
3337 return change;
3338}
3339
3340#define HDSPM_INPUT_SELECT(xname, xindex) \ 2947#define HDSPM_INPUT_SELECT(xname, xindex) \
3341{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 2948{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3342 .name = xname, \ 2949 .name = xname, \