hal2.c (681e4a5e13c1c8315694eb4f44e0cdd84c9082d2) | hal2.c (e0f8cb5fac7f6ab0353caccab54e960bbe517123) |
---|---|
1/* 2 * Driver for A2 audio system used in SGI machines 3 * Copyright (c) 2008 Thomas Bogendoerfer <tsbogend@alpha.fanken.de> 4 * 5 * Based on OSS code from Ladislav Michl <ladis@linux-mips.org>, which 6 * was based on code from Ulf Carlsson 7 * 8 * This program is free software; you can redistribute it and/or modify --- 246 unchanged lines hidden (view full) --- 255 new |= (l << H2I_C2_L_GAIN_SHIFT); 256 new |= (r << H2I_C2_R_GAIN_SHIFT); 257 hal2_i_write32(hal2, H2I_ADC_C2, new); 258 break; 259 } 260 return old != new; 261} 262 | 1/* 2 * Driver for A2 audio system used in SGI machines 3 * Copyright (c) 2008 Thomas Bogendoerfer <tsbogend@alpha.fanken.de> 4 * 5 * Based on OSS code from Ladislav Michl <ladis@linux-mips.org>, which 6 * was based on code from Ulf Carlsson 7 * 8 * This program is free software; you can redistribute it and/or modify --- 246 unchanged lines hidden (view full) --- 255 new |= (l << H2I_C2_L_GAIN_SHIFT); 256 new |= (r << H2I_C2_R_GAIN_SHIFT); 257 hal2_i_write32(hal2, H2I_ADC_C2, new); 258 break; 259 } 260 return old != new; 261} 262 |
263static struct snd_kcontrol_new hal2_ctrl_headphone __devinitdata = { | 263static struct snd_kcontrol_new hal2_ctrl_headphone = { |
264 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 265 .name = "Headphone Playback Volume", 266 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 267 .private_value = H2_MIX_OUTPUT_ATT, 268 .info = hal2_gain_info, 269 .get = hal2_gain_get, 270 .put = hal2_gain_put, 271}; 272 | 264 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 265 .name = "Headphone Playback Volume", 266 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 267 .private_value = H2_MIX_OUTPUT_ATT, 268 .info = hal2_gain_info, 269 .get = hal2_gain_get, 270 .put = hal2_gain_put, 271}; 272 |
273static struct snd_kcontrol_new hal2_ctrl_mic __devinitdata = { | 273static struct snd_kcontrol_new hal2_ctrl_mic = { |
274 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 275 .name = "Mic Capture Volume", 276 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 277 .private_value = H2_MIX_INPUT_GAIN, 278 .info = hal2_gain_info, 279 .get = hal2_gain_get, 280 .put = hal2_gain_put, 281}; 282 | 274 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 275 .name = "Mic Capture Volume", 276 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 277 .private_value = H2_MIX_INPUT_GAIN, 278 .info = hal2_gain_info, 279 .get = hal2_gain_get, 280 .put = hal2_gain_put, 281}; 282 |
283static int __devinit hal2_mixer_create(struct snd_hal2 *hal2) | 283static int hal2_mixer_create(struct snd_hal2 *hal2) |
284{ 285 int err; 286 287 /* mute DAC */ 288 hal2_i_write32(hal2, H2I_DAC_C2, 289 H2I_C2_L_ATT_M | H2I_C2_R_ATT_M | H2I_C2_MUTE); 290 /* mute ADC */ 291 hal2_i_write32(hal2, H2I_ADC_C2, 0); --- 436 unchanged lines hidden (view full) --- 728 .hw_params = hal2_pcm_hw_params, 729 .hw_free = hal2_pcm_hw_free, 730 .prepare = hal2_capture_prepare, 731 .trigger = hal2_capture_trigger, 732 .pointer = hal2_capture_pointer, 733 .ack = hal2_capture_ack, 734}; 735 | 284{ 285 int err; 286 287 /* mute DAC */ 288 hal2_i_write32(hal2, H2I_DAC_C2, 289 H2I_C2_L_ATT_M | H2I_C2_R_ATT_M | H2I_C2_MUTE); 290 /* mute ADC */ 291 hal2_i_write32(hal2, H2I_ADC_C2, 0); --- 436 unchanged lines hidden (view full) --- 728 .hw_params = hal2_pcm_hw_params, 729 .hw_free = hal2_pcm_hw_free, 730 .prepare = hal2_capture_prepare, 731 .trigger = hal2_capture_trigger, 732 .pointer = hal2_capture_pointer, 733 .ack = hal2_capture_ack, 734}; 735 |
736static int __devinit hal2_pcm_create(struct snd_hal2 *hal2) | 736static int hal2_pcm_create(struct snd_hal2 *hal2) |
737{ 738 struct snd_pcm *pcm; 739 int err; 740 741 /* create first pcm device with one outputs and one input */ 742 err = snd_pcm_new(hal2->card, "SGI HAL2 Audio", 0, 1, 1, &pcm); 743 if (err < 0) 744 return err; --- 124 unchanged lines hidden (view full) --- 869 free_irq(SGI_HPCDMA_IRQ, hal2); 870 kfree(hal2); 871 return err; 872 } 873 *rchip = hal2; 874 return 0; 875} 876 | 737{ 738 struct snd_pcm *pcm; 739 int err; 740 741 /* create first pcm device with one outputs and one input */ 742 err = snd_pcm_new(hal2->card, "SGI HAL2 Audio", 0, 1, 1, &pcm); 743 if (err < 0) 744 return err; --- 124 unchanged lines hidden (view full) --- 869 free_irq(SGI_HPCDMA_IRQ, hal2); 870 kfree(hal2); 871 return err; 872 } 873 *rchip = hal2; 874 return 0; 875} 876 |
877static int __devinit hal2_probe(struct platform_device *pdev) | 877static int hal2_probe(struct platform_device *pdev) |
878{ 879 struct snd_card *card; 880 struct snd_hal2 *chip; 881 int err; 882 883 err = snd_card_create(index, id, THIS_MODULE, 0, &card); 884 if (err < 0) 885 return err; --- 26 unchanged lines hidden (view full) --- 912 if (err < 0) { 913 snd_card_free(card); 914 return err; 915 } 916 platform_set_drvdata(pdev, card); 917 return 0; 918} 919 | 878{ 879 struct snd_card *card; 880 struct snd_hal2 *chip; 881 int err; 882 883 err = snd_card_create(index, id, THIS_MODULE, 0, &card); 884 if (err < 0) 885 return err; --- 26 unchanged lines hidden (view full) --- 912 if (err < 0) { 913 snd_card_free(card); 914 return err; 915 } 916 platform_set_drvdata(pdev, card); 917 return 0; 918} 919 |
920static int __devexit hal2_remove(struct platform_device *pdev) | 920static int hal2_remove(struct platform_device *pdev) |
921{ 922 struct snd_card *card = platform_get_drvdata(pdev); 923 924 snd_card_free(card); 925 platform_set_drvdata(pdev, NULL); 926 return 0; 927} 928 929static struct platform_driver hal2_driver = { 930 .probe = hal2_probe, | 921{ 922 struct snd_card *card = platform_get_drvdata(pdev); 923 924 snd_card_free(card); 925 platform_set_drvdata(pdev, NULL); 926 return 0; 927} 928 929static struct platform_driver hal2_driver = { 930 .probe = hal2_probe, |
931 .remove = __devexit_p(hal2_remove), | 931 .remove = hal2_remove, |
932 .driver = { 933 .name = "sgihal2", 934 .owner = THIS_MODULE, 935 } 936}; 937 938module_platform_driver(hal2_driver); | 932 .driver = { 933 .name = "sgihal2", 934 .owner = THIS_MODULE, 935 } 936}; 937 938module_platform_driver(hal2_driver); |