Changeset 703 for GPL/trunk/alsa-kernel/pci/rme9652/hdsp.c
- Timestamp:
- Sep 26, 2021, 6:18:40 PM (4 years ago)
- Location:
- GPL/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-next merged: 696-702
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/pci/rme9652/hdsp.c
r695 r703 290 290 return 110100480000000 / rate; // 105 MHz 291 291 */ 292 #define DDS_NUMERATOR 104857600000000ULL ;/* = 2^20 * 10^8 */292 #define DDS_NUMERATOR 104857600000000ULL /* = 2^20 * 10^8 */ 293 293 294 294 #define hdsp_encode_latency(x) (((x)<<1) & HDSP_LatencyMask) … … 1319 1319 if (hmidi->output) { 1320 1320 if (!snd_rawmidi_transmit_empty (hmidi->output)) { 1321 if ((n_pending = snd_hdsp_midi_output_possible (hmidi->hdsp, hmidi->id)) > 0) { 1321 n_pending = snd_hdsp_midi_output_possible(hmidi->hdsp, hmidi->id); 1322 if (n_pending > 0) { 1322 1323 if (n_pending > (int)sizeof (buf)) 1323 1324 n_pending = sizeof (buf); 1324 1325 1325 if ((to_write = snd_rawmidi_transmit (hmidi->output, buf, n_pending)) > 0) { 1326 to_write = snd_rawmidi_transmit(hmidi->output, buf, n_pending); 1327 if (to_write > 0) { 1326 1328 for (i = 0; i < to_write; ++i) 1327 1329 snd_hdsp_midi_write_byte (hmidi->hdsp, hmidi->id, buf[i]); … … 1342 1344 1343 1345 spin_lock_irqsave (&hmidi->lock, flags); 1344 if ((n_pending = snd_hdsp_midi_input_available (hmidi->hdsp, hmidi->id)) > 0) { 1346 n_pending = snd_hdsp_midi_input_available(hmidi->hdsp, hmidi->id); 1347 if (n_pending > 0) { 1345 1348 if (hmidi->input) { 1346 1349 if (n_pending > (int)sizeof (buf)) … … 3323 3326 3324 3327 for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_controls); idx++) { 3325 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp))) < 0) 3328 kctl = snd_ctl_new1(&snd_hdsp_controls[idx], hdsp); 3329 err = snd_ctl_add(card, kctl); 3330 if (err < 0) 3326 3331 return err; 3327 3332 if (idx == 1) /* IEC958 (S/PDIF) Stream */ … … 3332 3337 snd_hdsp_adat_sync_check.name = "ADAT Lock Status"; 3333 3338 snd_hdsp_adat_sync_check.index = 1; 3334 if ((err = snd_ctl_add (card, kctl = snd_ctl_new1(&snd_hdsp_adat_sync_check, hdsp)))) 3339 kctl = snd_ctl_new1(&snd_hdsp_adat_sync_check, hdsp); 3340 err = snd_ctl_add(card, kctl); 3341 if (err < 0) 3335 3342 return err; 3336 3343 if (hdsp->io_type == Digiface || hdsp->io_type == H9652) { 3337 3344 for (idx = 1; idx < 3; ++idx) { 3338 3345 snd_hdsp_adat_sync_check.index = idx+1; 3339 if ((err = snd_ctl_add (card, kctl = snd_ctl_new1(&snd_hdsp_adat_sync_check, hdsp)))) 3346 kctl = snd_ctl_new1(&snd_hdsp_adat_sync_check, hdsp); 3347 err = snd_ctl_add(card, kctl); 3348 if (err < 0) 3340 3349 return err; 3341 3350 } … … 3345 3354 if (hdsp->io_type == H9632) { 3346 3355 for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_9632_controls); idx++) { 3347 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_9632_controls[idx], hdsp))) < 0) 3356 kctl = snd_ctl_new1(&snd_hdsp_9632_controls[idx], hdsp); 3357 err = snd_ctl_add(card, kctl); 3358 if (err < 0) 3348 3359 return err; 3349 3360 } … … 3363 3374 /* AEB control for H96xx card */ 3364 3375 if (hdsp->io_type == H9632 || hdsp->io_type == H9652) { 3365 if ((err = snd_ctl_add(card, kctl = snd_ctl_new1(&snd_hdsp_96xx_aeb, hdsp))) < 0) 3366 return err; 3376 kctl = snd_ctl_new1(&snd_hdsp_96xx_aeb, hdsp); 3377 err = snd_ctl_add(card, kctl); 3378 if (err < 0) 3379 return err; 3367 3380 } 3368 3381 … … 3943 3956 return NULL; 3944 3957 3945 if ((mapped_channel = hdsp->channel_map[channel]) < 0) 3958 mapped_channel = hdsp->channel_map[channel]; 3959 if (mapped_channel < 0) 3946 3960 return NULL; 3947 3961 … … 4115 4129 spin_lock_irq(&hdsp->lock); 4116 4130 if (! hdsp->clock_source_locked) { 4117 if ((err = hdsp_set_rate(hdsp, params_rate(params), 0)) < 0) { 4131 err = hdsp_set_rate(hdsp, params_rate(params), 0); 4132 if (err < 0) { 4118 4133 spin_unlock_irq(&hdsp->lock); 4119 4134 _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_RATE); … … 4123 4138 spin_unlock_irq(&hdsp->lock); 4124 4139 4125 if ((err = hdsp_set_interrupt_interval(hdsp, params_period_size(params))) < 0) { 4140 err = hdsp_set_interrupt_interval(hdsp, params_period_size(params)); 4141 if (err < 0) { 4126 4142 _snd_pcm_hw_param_setempty(params, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); 4127 4143 return err; … … 4855 4871 if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL; 4856 4872 if (hdsp->io_type == Undefined) { 4857 if ((err = hdsp_get_iobox_version(hdsp)) < 0) 4873 err = hdsp_get_iobox_version(hdsp); 4874 if (err < 0) 4858 4875 return err; 4859 4876 } … … 4861 4878 hdsp_version.io_type = hdsp->io_type; 4862 4879 hdsp_version.firmware_rev = hdsp->firmware_rev; 4863 if ( (err = copy_to_user(argp, &hdsp_version, sizeof(hdsp_version))))4864 4880 if (copy_to_user(argp, &hdsp_version, sizeof(hdsp_version))) 4881 return -EFAULT; 4865 4882 break; 4866 4883 } … … 4901 4918 hdsp->state |= HDSP_FirmwareCached; 4902 4919 4903 if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0) 4920 err = snd_hdsp_load_firmware_from_cache(hdsp); 4921 if (err < 0) 4904 4922 return err; 4905 4923 4906 4924 if (!(hdsp->state & HDSP_InitializationComplete)) { 4907 if ((err = snd_hdsp_enable_io(hdsp)) < 0) 4925 err = snd_hdsp_enable_io(hdsp); 4926 if (err < 0) 4908 4927 return err; 4909 4928 … … 4911 4930 snd_hdsp_initialize_midi_flush(hdsp); 4912 4931 4913 if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { 4932 err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp); 4933 if (err < 0) { 4914 4934 dev_err(hdsp->card->dev, 4915 4935 "error creating alsa devices\n"); … … 4961 4981 int err; 4962 4982 4963 if ((err = snd_hwdep_new(card, "HDSP hwdep", 0, &hw)) < 0) 4983 err = snd_hwdep_new(card, "HDSP hwdep", 0, &hw); 4984 if (err < 0) 4964 4985 return err; 4965 4986 … … 4979 5000 int err; 4980 5001 4981 if ((err = snd_pcm_new(card, hdsp->card_name, 0, 1, 1, &pcm)) < 0) 5002 err = snd_pcm_new(card, hdsp->card_name, 0, 1, 1, &pcm); 5003 if (err < 0) 4982 5004 return err; 4983 5005 … … 5085 5107 int err; 5086 5108 5087 if ((err = snd_hdsp_create_pcm(card, hdsp)) < 0) { 5109 err = snd_hdsp_create_pcm(card, hdsp); 5110 if (err < 0) { 5088 5111 dev_err(card->dev, 5089 5112 "Error creating pcm interface\n"); … … 5092 5115 5093 5116 5094 if ((err = snd_hdsp_create_midi(card, hdsp, 0)) < 0) { 5117 err = snd_hdsp_create_midi(card, hdsp, 0); 5118 if (err < 0) { 5095 5119 dev_err(card->dev, 5096 5120 "Error creating first midi interface\n"); … … 5099 5123 5100 5124 if (hdsp->io_type == Digiface || hdsp->io_type == H9652) { 5101 if ((err = snd_hdsp_create_midi(card, hdsp, 1)) < 0) { 5125 err = snd_hdsp_create_midi(card, hdsp, 1); 5126 if (err < 0) { 5102 5127 dev_err(card->dev, 5103 5128 "Error creating second midi interface\n"); … … 5106 5131 } 5107 5132 5108 if ((err = snd_hdsp_create_controls(card, hdsp)) < 0) { 5133 err = snd_hdsp_create_controls(card, hdsp); 5134 if (err < 0) { 5109 5135 dev_err(card->dev, 5110 5136 "Error creating ctl interface\n"); … … 5120 5146 hdsp->playback_substream = NULL; 5121 5147 5122 if ((err = snd_hdsp_set_defaults(hdsp)) < 0) { 5148 err = snd_hdsp_set_defaults(hdsp); 5149 if (err < 0) { 5123 5150 dev_err(card->dev, 5124 5151 "Error setting default values\n"); … … 5131 5158 hdsp->port, hdsp->irq); 5132 5159 5133 if ((err = snd_card_register(card)) < 0) { 5160 err = snd_card_register(card); 5161 if (err < 0) { 5134 5162 dev_err(card->dev, 5135 5163 "error registering card\n"); … … 5152 5180 return 0; 5153 5181 if (hdsp->io_type == Undefined) { 5154 if ((err = hdsp_get_iobox_version(hdsp)) < 0) 5182 err = hdsp_get_iobox_version(hdsp); 5183 if (err < 0) 5155 5184 return err; 5156 5185 if (hdsp->io_type == H9652 || hdsp->io_type == H9632) … … 5198 5227 hdsp->state |= HDSP_FirmwareCached; 5199 5228 5200 if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0) 5229 err = snd_hdsp_load_firmware_from_cache(hdsp); 5230 if (err < 0) 5201 5231 return err; 5202 5232 5203 5233 if (!(hdsp->state & HDSP_InitializationComplete)) { 5204 if ((err = snd_hdsp_enable_io(hdsp)) < 0) 5234 err = snd_hdsp_enable_io(hdsp); 5235 if (err < 0) 5205 5236 return err; 5206 5237 5207 if ((err = snd_hdsp_create_hwdep(hdsp->card, hdsp)) < 0) { 5238 err = snd_hdsp_create_hwdep(hdsp->card, hdsp); 5239 if (err < 0) { 5208 5240 dev_err(hdsp->card->dev, 5209 5241 "error creating hwdep device\n"); … … 5212 5244 snd_hdsp_initialize_channels(hdsp); 5213 5245 snd_hdsp_initialize_midi_flush(hdsp); 5214 if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { 5246 err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp); 5247 if (err < 0) { 5215 5248 dev_err(hdsp->card->dev, 5216 5249 "error creating alsa devices\n"); … … 5281 5314 } 5282 5315 5283 if ((err = pci_enable_device(pci)) < 0) 5316 err = pci_enable_device(pci); 5317 if (err < 0) 5284 5318 return err; 5285 5319 5286 5320 pci_set_master(hdsp->pci); 5287 5321 5288 if ((err = pci_request_regions(pci, "hdsp")) < 0) 5322 err = pci_request_regions(pci, "hdsp"); 5323 if (err < 0) 5289 5324 return err; 5290 5325 hdsp->port = pci_resource_start(pci, 0); 5291 if ((hdsp->iobase = ioremap(hdsp->port, HDSP_IO_EXTENT)) == NULL) { 5326 hdsp->iobase = ioremap(hdsp->port, HDSP_IO_EXTENT); 5327 if (!hdsp->iobase) { 5292 5328 dev_err(hdsp->card->dev, "unable to remap region 0x%lx-0x%lx\n", 5293 5329 hdsp->port, hdsp->port + HDSP_IO_EXTENT - 1); … … 5307 5343 hdsp->dds_value = 0; 5308 5344 5309 if ((err = snd_hdsp_initialize_memory(hdsp)) < 0) 5345 err = snd_hdsp_initialize_memory(hdsp); 5346 if (err < 0) 5310 5347 return err; 5311 5348 … … 5319 5356 5320 5357 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { 5321 if ((err = hdsp_request_fw_loader(hdsp)) < 0) 5358 err = hdsp_request_fw_loader(hdsp); 5359 if (err < 0) 5322 5360 /* we don't fail as this can happen 5323 5361 if userspace is not ready for … … 5332 5370 dev_info(hdsp->card->dev, 5333 5371 "card initialization pending : waiting for firmware\n"); 5334 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) 5372 err = snd_hdsp_create_hwdep(card, hdsp); 5373 if (err < 0) 5335 5374 return err; 5336 5375 return 0; … … 5347 5386 } 5348 5387 5349 if ((err = snd_hdsp_enable_io(hdsp)) != 0) 5388 err = snd_hdsp_enable_io(hdsp); 5389 if (err) 5350 5390 return err; 5351 5391 … … 5356 5396 hdsp->io_type = H9632; 5357 5397 5358 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) 5398 err = snd_hdsp_create_hwdep(card, hdsp); 5399 if (err < 0) 5359 5400 return err; 5360 5401 … … 5364 5405 hdsp->state |= HDSP_FirmwareLoaded; 5365 5406 5366 if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0) 5407 err = snd_hdsp_create_alsa_devices(card, hdsp); 5408 if (err < 0) 5367 5409 return err; 5368 5410
Note:
See TracChangeset
for help on using the changeset viewer.