sgio2audio.c (681e4a5e13c1c8315694eb4f44e0cdd84c9082d2) | sgio2audio.c (e0f8cb5fac7f6ab0353caccab54e960bbe517123) |
---|---|
1/* 2 * Sound driver for Silicon Graphics O2 Workstations A/V board audio. 3 * 4 * Copyright 2003 Vivien Chappelier <vivien.chappelier@linux-mips.org> 5 * Copyright 2008 Thomas Bogendoerfer <tsbogend@alpha.franken.de> 6 * Mxier part taken from mace_audio.c: 7 * Copyright 2007 Thorben Jändling <tj.trevelyan@gmail.com> 8 * --- 223 unchanged lines hidden (view full) --- 232 oldsrc = ad1843_get_recsrc(&chip->ad1843); 233 newsrc = ad1843_set_recsrc(&chip->ad1843, 234 ucontrol->value.enumerated.item[0]); 235 236 return newsrc != oldsrc; 237} 238 239/* dac1/pcm0 mixer control */ | 1/* 2 * Sound driver for Silicon Graphics O2 Workstations A/V board audio. 3 * 4 * Copyright 2003 Vivien Chappelier <vivien.chappelier@linux-mips.org> 5 * Copyright 2008 Thomas Bogendoerfer <tsbogend@alpha.franken.de> 6 * Mxier part taken from mace_audio.c: 7 * Copyright 2007 Thorben Jändling <tj.trevelyan@gmail.com> 8 * --- 223 unchanged lines hidden (view full) --- 232 oldsrc = ad1843_get_recsrc(&chip->ad1843); 233 newsrc = ad1843_set_recsrc(&chip->ad1843, 234 ucontrol->value.enumerated.item[0]); 235 236 return newsrc != oldsrc; 237} 238 239/* dac1/pcm0 mixer control */ |
240static struct snd_kcontrol_new sgio2audio_ctrl_pcm0 __devinitdata = { | 240static struct snd_kcontrol_new sgio2audio_ctrl_pcm0 = { |
241 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 242 .name = "PCM Playback Volume", 243 .index = 0, 244 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 245 .private_value = AD1843_GAIN_PCM_0, 246 .info = sgio2audio_gain_info, 247 .get = sgio2audio_gain_get, 248 .put = sgio2audio_gain_put, 249}; 250 251/* dac2/pcm1 mixer control */ | 241 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 242 .name = "PCM Playback Volume", 243 .index = 0, 244 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 245 .private_value = AD1843_GAIN_PCM_0, 246 .info = sgio2audio_gain_info, 247 .get = sgio2audio_gain_get, 248 .put = sgio2audio_gain_put, 249}; 250 251/* dac2/pcm1 mixer control */ |
252static struct snd_kcontrol_new sgio2audio_ctrl_pcm1 __devinitdata = { | 252static struct snd_kcontrol_new sgio2audio_ctrl_pcm1 = { |
253 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 254 .name = "PCM Playback Volume", 255 .index = 1, 256 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 257 .private_value = AD1843_GAIN_PCM_1, 258 .info = sgio2audio_gain_info, 259 .get = sgio2audio_gain_get, 260 .put = sgio2audio_gain_put, 261}; 262 263/* record level mixer control */ | 253 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 254 .name = "PCM Playback Volume", 255 .index = 1, 256 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 257 .private_value = AD1843_GAIN_PCM_1, 258 .info = sgio2audio_gain_info, 259 .get = sgio2audio_gain_get, 260 .put = sgio2audio_gain_put, 261}; 262 263/* record level mixer control */ |
264static struct snd_kcontrol_new sgio2audio_ctrl_reclevel __devinitdata = { | 264static struct snd_kcontrol_new sgio2audio_ctrl_reclevel = { |
265 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 266 .name = "Capture Volume", 267 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 268 .private_value = AD1843_GAIN_RECLEV, 269 .info = sgio2audio_gain_info, 270 .get = sgio2audio_gain_get, 271 .put = sgio2audio_gain_put, 272}; 273 274/* record level source control */ | 265 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 266 .name = "Capture Volume", 267 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 268 .private_value = AD1843_GAIN_RECLEV, 269 .info = sgio2audio_gain_info, 270 .get = sgio2audio_gain_get, 271 .put = sgio2audio_gain_put, 272}; 273 274/* record level source control */ |
275static struct snd_kcontrol_new sgio2audio_ctrl_recsource __devinitdata = { | 275static struct snd_kcontrol_new sgio2audio_ctrl_recsource = { |
276 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 277 .name = "Capture Source", 278 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 279 .info = sgio2audio_source_info, 280 .get = sgio2audio_source_get, 281 .put = sgio2audio_source_put, 282}; 283 284/* line mixer control */ | 276 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 277 .name = "Capture Source", 278 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 279 .info = sgio2audio_source_info, 280 .get = sgio2audio_source_get, 281 .put = sgio2audio_source_put, 282}; 283 284/* line mixer control */ |
285static struct snd_kcontrol_new sgio2audio_ctrl_line __devinitdata = { | 285static struct snd_kcontrol_new sgio2audio_ctrl_line = { |
286 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 287 .name = "Line Playback Volume", 288 .index = 0, 289 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 290 .private_value = AD1843_GAIN_LINE, 291 .info = sgio2audio_gain_info, 292 .get = sgio2audio_gain_get, 293 .put = sgio2audio_gain_put, 294}; 295 296/* cd mixer control */ | 286 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 287 .name = "Line Playback Volume", 288 .index = 0, 289 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 290 .private_value = AD1843_GAIN_LINE, 291 .info = sgio2audio_gain_info, 292 .get = sgio2audio_gain_get, 293 .put = sgio2audio_gain_put, 294}; 295 296/* cd mixer control */ |
297static struct snd_kcontrol_new sgio2audio_ctrl_cd __devinitdata = { | 297static struct snd_kcontrol_new sgio2audio_ctrl_cd = { |
298 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 299 .name = "Line Playback Volume", 300 .index = 1, 301 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 302 .private_value = AD1843_GAIN_LINE_2, 303 .info = sgio2audio_gain_info, 304 .get = sgio2audio_gain_get, 305 .put = sgio2audio_gain_put, 306}; 307 308/* mic mixer control */ | 298 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 299 .name = "Line Playback Volume", 300 .index = 1, 301 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 302 .private_value = AD1843_GAIN_LINE_2, 303 .info = sgio2audio_gain_info, 304 .get = sgio2audio_gain_get, 305 .put = sgio2audio_gain_put, 306}; 307 308/* mic mixer control */ |
309static struct snd_kcontrol_new sgio2audio_ctrl_mic __devinitdata = { | 309static struct snd_kcontrol_new sgio2audio_ctrl_mic = { |
310 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 311 .name = "Mic Playback Volume", 312 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 313 .private_value = AD1843_GAIN_MIC, 314 .info = sgio2audio_gain_info, 315 .get = sgio2audio_gain_get, 316 .put = sgio2audio_gain_put, 317}; 318 319 | 310 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 311 .name = "Mic Playback Volume", 312 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 313 .private_value = AD1843_GAIN_MIC, 314 .info = sgio2audio_gain_info, 315 .get = sgio2audio_gain_get, 316 .put = sgio2audio_gain_put, 317}; 318 319 |
320static int __devinit snd_sgio2audio_new_mixer(struct snd_sgio2audio *chip) | 320static int snd_sgio2audio_new_mixer(struct snd_sgio2audio *chip) |
321{ 322 int err; 323 324 err = snd_ctl_add(chip->card, 325 snd_ctl_new1(&sgio2audio_ctrl_pcm0, chip)); 326 if (err < 0) 327 return err; 328 --- 392 unchanged lines hidden (view full) --- 721 .mmap = snd_pcm_lib_mmap_vmalloc, 722}; 723 724/* 725 * definitions of capture are omitted here... 726 */ 727 728/* create a pcm device */ | 321{ 322 int err; 323 324 err = snd_ctl_add(chip->card, 325 snd_ctl_new1(&sgio2audio_ctrl_pcm0, chip)); 326 if (err < 0) 327 return err; 328 --- 392 unchanged lines hidden (view full) --- 721 .mmap = snd_pcm_lib_mmap_vmalloc, 722}; 723 724/* 725 * definitions of capture are omitted here... 726 */ 727 728/* create a pcm device */ |
729static int __devinit snd_sgio2audio_new_pcm(struct snd_sgio2audio *chip) | 729static int snd_sgio2audio_new_pcm(struct snd_sgio2audio *chip) |
730{ 731 struct snd_pcm *pcm; 732 int err; 733 734 /* create first pcm device with one outputs and one input */ 735 err = snd_pcm_new(chip->card, "SGI O2 Audio", 0, 1, 1, &pcm); 736 if (err < 0) 737 return err; --- 91 unchanged lines hidden (view full) --- 829 830 return snd_sgio2audio_free(chip); 831} 832 833static struct snd_device_ops ops = { 834 .dev_free = snd_sgio2audio_dev_free, 835}; 836 | 730{ 731 struct snd_pcm *pcm; 732 int err; 733 734 /* create first pcm device with one outputs and one input */ 735 err = snd_pcm_new(chip->card, "SGI O2 Audio", 0, 1, 1, &pcm); 736 if (err < 0) 737 return err; --- 91 unchanged lines hidden (view full) --- 829 830 return snd_sgio2audio_free(chip); 831} 832 833static struct snd_device_ops ops = { 834 .dev_free = snd_sgio2audio_dev_free, 835}; 836 |
837static int __devinit snd_sgio2audio_create(struct snd_card *card, 838 struct snd_sgio2audio **rchip) | 837static int snd_sgio2audio_create(struct snd_card *card, 838 struct snd_sgio2audio **rchip) |
839{ 840 struct snd_sgio2audio *chip; 841 int i, err; 842 843 *rchip = NULL; 844 845 /* check if a codec is attached to the interface */ 846 /* (Audio or Audio/Video board present) */ --- 62 unchanged lines hidden (view full) --- 909 if (err < 0) { 910 snd_sgio2audio_free(chip); 911 return err; 912 } 913 *rchip = chip; 914 return 0; 915} 916 | 839{ 840 struct snd_sgio2audio *chip; 841 int i, err; 842 843 *rchip = NULL; 844 845 /* check if a codec is attached to the interface */ 846 /* (Audio or Audio/Video board present) */ --- 62 unchanged lines hidden (view full) --- 909 if (err < 0) { 910 snd_sgio2audio_free(chip); 911 return err; 912 } 913 *rchip = chip; 914 return 0; 915} 916 |
917static int __devinit snd_sgio2audio_probe(struct platform_device *pdev) | 917static int snd_sgio2audio_probe(struct platform_device *pdev) |
918{ 919 struct snd_card *card; 920 struct snd_sgio2audio *chip; 921 int err; 922 923 err = snd_card_create(index, id, THIS_MODULE, 0, &card); 924 if (err < 0) 925 return err; --- 27 unchanged lines hidden (view full) --- 953 if (err < 0) { 954 snd_card_free(card); 955 return err; 956 } 957 platform_set_drvdata(pdev, card); 958 return 0; 959} 960 | 918{ 919 struct snd_card *card; 920 struct snd_sgio2audio *chip; 921 int err; 922 923 err = snd_card_create(index, id, THIS_MODULE, 0, &card); 924 if (err < 0) 925 return err; --- 27 unchanged lines hidden (view full) --- 953 if (err < 0) { 954 snd_card_free(card); 955 return err; 956 } 957 platform_set_drvdata(pdev, card); 958 return 0; 959} 960 |
961static int __devexit snd_sgio2audio_remove(struct platform_device *pdev) | 961static int snd_sgio2audio_remove(struct platform_device *pdev) |
962{ 963 struct snd_card *card = platform_get_drvdata(pdev); 964 965 snd_card_free(card); 966 platform_set_drvdata(pdev, NULL); 967 return 0; 968} 969 970static struct platform_driver sgio2audio_driver = { 971 .probe = snd_sgio2audio_probe, | 962{ 963 struct snd_card *card = platform_get_drvdata(pdev); 964 965 snd_card_free(card); 966 platform_set_drvdata(pdev, NULL); 967 return 0; 968} 969 970static struct platform_driver sgio2audio_driver = { 971 .probe = snd_sgio2audio_probe, |
972 .remove = __devexit_p(snd_sgio2audio_remove), | 972 .remove = snd_sgio2audio_remove, |
973 .driver = { 974 .name = "sgio2audio", 975 .owner = THIS_MODULE, 976 } 977}; 978 979module_platform_driver(sgio2audio_driver); | 973 .driver = { 974 .name = "sgio2audio", 975 .owner = THIS_MODULE, 976 } 977}; 978 979module_platform_driver(sgio2audio_driver); |