Changeset de16f89 in mainline
- Timestamp:
- 2014-09-05T08:52:51Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 089901e
- Parents:
- 3fec817
- Location:
- uspace/drv/audio/hdaudio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/hdaudio/hdactl.c
r3fec817 rde16f89 217 217 return EOK; 218 218 error: 219 if (hda->ctl->corb_virt != NULL) 220 dmamem_unmap_anonymous(&hda->ctl->corb_virt); 219 221 return EIO; 222 } 223 224 /** Tear down the CORB */ 225 static void hda_corb_fini(hda_t *hda) 226 { 227 uint8_t ctl; 228 229 /* Stop CORB */ 230 ctl = hda_reg8_read(&hda->regs->corbctl); 231 hda_reg8_write(&hda->regs->corbctl, ctl & ~BIT_V(uint8_t, corbctl_run)); 232 233 if (hda->ctl->corb_virt != NULL) 234 dmamem_unmap_anonymous(&hda->ctl->corb_virt); 220 235 } 221 236 … … 290 305 return EOK; 291 306 error: 307 if (hda->ctl->rirb_virt != NULL) 308 dmamem_unmap_anonymous(&hda->ctl->rirb_virt); 292 309 return EIO; 310 } 311 312 /** Tear down the RIRB */ 313 static void hda_rirb_fini(hda_t *hda) 314 { 315 uint8_t ctl; 316 317 /* Stop RIRB and disable RIRB interrupt */ 318 ctl = hda_reg8_read(&hda->regs->rirbctl); 319 hda_reg8_write(&hda->regs->rirbctl, ctl & 320 ~(BIT_V(uint8_t, rirbctl_run) | BIT_V(uint8_t, rirbctl_int))); 321 322 if (hda->ctl->rirb_virt != NULL) 323 dmamem_unmap_anonymous(&hda->ctl->rirb_virt); 293 324 } 294 325 … … 571 602 return ctl; 572 603 error: 604 hda_rirb_fini(hda); 605 hda_corb_fini(hda); 573 606 free(ctl); 574 607 hda->ctl = NULL; 575 608 return NULL; 609 } 610 611 void hda_ctl_fini(hda_ctl_t *ctl) 612 { 613 ddf_msg(LVL_NOTE, "hda_ctl_fini()"); 614 hda_rirb_fini(ctl->hda); 615 hda_corb_fini(ctl->hda); 616 free(ctl); 576 617 } 577 618 … … 595 636 596 637 return EOK; 597 }598 599 void hda_ctl_fini(hda_ctl_t *ctl)600 {601 ddf_msg(LVL_NOTE, "hda_ctl_fini()");602 free(ctl);603 638 } 604 639 -
uspace/drv/audio/hdaudio/hdaudio.c
r3fec817 rde16f89 150 150 static int hda_dev_add(ddf_dev_t *dev) 151 151 { 152 ddf_fun_t *fun_pcm ;152 ddf_fun_t *fun_pcm = NULL; 153 153 hda_t *hda = NULL; 154 154 hw_res_list_parsed_t res; 155 155 irq_code_t irq_code; 156 irq_cmd_t *cmds ;156 irq_cmd_t *cmds = NULL; 157 157 size_t ncmds_base; 158 158 size_t ncmds_sdesc; 159 159 size_t ncmds; 160 160 int i; 161 void *regs ;161 void *regs = NULL; 162 162 int rc; 163 163 164 164 ddf_msg(LVL_NOTE, "hda_dev_add()"); 165 hw_res_list_parsed_init(&res); 165 166 166 167 hda = ddf_dev_data_alloc(dev, sizeof(hda_t)); … … 181 182 182 183 ddf_msg(LVL_NOTE, "get HW res list"); 183 hw_res_list_parsed_init(&res);184 184 rc = hw_res_get_list_parsed(hda->parent_sess, &res, 0); 185 185 if (rc != EOK) { … … 270 270 } 271 271 272 free(cmds); 273 cmds = NULL; 274 272 275 if (hda_ctl_init(hda) == NULL) { 273 276 rc = EIO; … … 295 298 296 299 ddf_fun_add_to_category(fun_pcm, "audio-pcm"); 300 301 hw_res_list_parsed_clean(&res); 297 302 return EOK; 298 303 error: 304 if (fun_pcm != NULL) 305 ddf_fun_destroy(fun_pcm); 299 306 if (hda != NULL) { 300 307 if (hda->ctl != NULL) 301 308 hda_ctl_fini(hda->ctl); 302 309 } 310 free(cmds); 311 // pio_disable(regs); 312 hw_res_list_parsed_clean(&res); 303 313 304 314 ddf_msg(LVL_NOTE, "Failing hda_dev_add() -> %d", rc); … … 323 333 } 324 334 335 hda_ctl_fini(hda->ctl); 336 // pio_disable(regs); 325 337 return EOK; 326 338 }
Note:
See TracChangeset
for help on using the changeset viewer.