Changeset b7fd2a0 in mainline for uspace/drv/audio/hdaudio
- Timestamp:
- 2018-01-13T03:10:29Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a53ed3a
- Parents:
- 36f0738
- Location:
- uspace/drv/audio/hdaudio
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/hdaudio/codec.c
r36f0738 rb7fd2a0 46 46 #include "stream.h" 47 47 48 static int hda_ccmd(hda_codec_t *codec, int node, uint32_t vid, uint32_t payload,48 static errno_t hda_ccmd(hda_codec_t *codec, int node, uint32_t vid, uint32_t payload, 49 49 uint32_t *resp) 50 50 { … … 66 66 (payload & 0xffff); 67 67 } 68 int rc = hda_cmd(codec->hda, verb, resp);68 errno_t rc = hda_cmd(codec->hda, verb, resp); 69 69 /* 70 70 if (resp != NULL) { … … 78 78 } 79 79 80 static int hda_get_parameter(hda_codec_t *codec, int node, hda_param_id_t param,80 static errno_t hda_get_parameter(hda_codec_t *codec, int node, hda_param_id_t param, 81 81 uint32_t *resp) 82 82 { … … 84 84 } 85 85 86 static int hda_get_subnc(hda_codec_t *codec, int node, int *startnode,86 static errno_t hda_get_subnc(hda_codec_t *codec, int node, int *startnode, 87 87 int *nodecount) 88 88 { 89 int rc;89 errno_t rc; 90 90 uint32_t resp; 91 91 … … 103 103 104 104 /** Get Function Group Type */ 105 static int hda_get_fgrp_type(hda_codec_t *codec, int node, bool *unsol,105 static errno_t hda_get_fgrp_type(hda_codec_t *codec, int node, bool *unsol, 106 106 hda_fgrp_type_t *type) 107 107 { 108 int rc;108 errno_t rc; 109 109 uint32_t resp; 110 110 … … 119 119 } 120 120 121 static int hda_get_clist_len(hda_codec_t *codec, int node, bool *longform,121 static errno_t hda_get_clist_len(hda_codec_t *codec, int node, bool *longform, 122 122 int *items) 123 123 { 124 int rc;124 errno_t rc; 125 125 uint32_t resp; 126 126 … … 135 135 } 136 136 137 static int hda_get_clist_entry(hda_codec_t *codec, int node, int n, uint32_t *resp)137 static errno_t hda_get_clist_entry(hda_codec_t *codec, int node, int n, uint32_t *resp) 138 138 { 139 139 return hda_ccmd(codec, node, hda_clist_entry_get, n, resp); 140 140 } 141 141 142 static int hda_get_eapd_btl_enable(hda_codec_t *codec, int node, uint32_t *resp)142 static errno_t hda_get_eapd_btl_enable(hda_codec_t *codec, int node, uint32_t *resp) 143 143 { 144 144 return hda_ccmd(codec, node, hda_eapd_btl_enable_get, 0, resp); 145 145 } 146 146 147 static int hda_set_eapd_btl_enable(hda_codec_t *codec, int node, uint8_t payload)147 static errno_t hda_set_eapd_btl_enable(hda_codec_t *codec, int node, uint8_t payload) 148 148 { 149 149 return hda_ccmd(codec, node, hda_eapd_btl_enable_set, payload, NULL); … … 151 151 152 152 /** Get Suppported PCM Size, Rates */ 153 static int hda_get_supp_rates(hda_codec_t *codec, int node, uint32_t *rates)153 static errno_t hda_get_supp_rates(hda_codec_t *codec, int node, uint32_t *rates) 154 154 { 155 155 return hda_get_parameter(codec, node, hda_supp_rates, rates); … … 157 157 158 158 /** Get Suppported Stream Formats */ 159 static int hda_get_supp_formats(hda_codec_t *codec, int node, uint32_t *fmts)159 static errno_t hda_get_supp_formats(hda_codec_t *codec, int node, uint32_t *fmts) 160 160 { 161 161 return hda_get_parameter(codec, node, hda_supp_formats, fmts); 162 162 } 163 163 164 static int hda_set_converter_fmt(hda_codec_t *codec, int node, uint16_t fmt)164 static errno_t hda_set_converter_fmt(hda_codec_t *codec, int node, uint16_t fmt) 165 165 { 166 166 return hda_ccmd(codec, node, hda_converter_fmt_set, fmt, NULL); 167 167 } 168 168 169 static int hda_set_converter_ctl(hda_codec_t *codec, int node, uint8_t stream,169 static errno_t hda_set_converter_ctl(hda_codec_t *codec, int node, uint8_t stream, 170 170 uint8_t channel) 171 171 { … … 176 176 } 177 177 178 static int hda_set_pin_ctl(hda_codec_t *codec, int node, uint8_t pctl)178 static errno_t hda_set_pin_ctl(hda_codec_t *codec, int node, uint8_t pctl) 179 179 { 180 180 return hda_ccmd(codec, node, hda_pin_ctl_set, pctl, NULL); 181 181 } 182 182 183 static int hda_get_pin_ctl(hda_codec_t *codec, int node, uint8_t *pctl)184 { 185 int rc;183 static errno_t hda_get_pin_ctl(hda_codec_t *codec, int node, uint8_t *pctl) 184 { 185 errno_t rc; 186 186 uint32_t resp; 187 187 … … 195 195 196 196 /** Get Audio Widget Capabilities */ 197 static int hda_get_aw_caps(hda_codec_t *codec, int node,197 static errno_t hda_get_aw_caps(hda_codec_t *codec, int node, 198 198 hda_awidget_type_t *type, uint32_t *caps) 199 199 { 200 int rc;200 errno_t rc; 201 201 uint32_t resp; 202 202 … … 212 212 213 213 /** Get Pin Capabilities */ 214 static int hda_get_pin_caps(hda_codec_t *codec, int node, uint32_t *caps)214 static errno_t hda_get_pin_caps(hda_codec_t *codec, int node, uint32_t *caps) 215 215 { 216 216 return hda_get_parameter(codec, node, hda_pin_caps, caps); … … 218 218 219 219 /** Get Power State */ 220 static int hda_get_power_state(hda_codec_t *codec, int node, uint32_t *pstate)220 static errno_t hda_get_power_state(hda_codec_t *codec, int node, uint32_t *pstate) 221 221 { 222 222 return hda_ccmd(codec, node, hda_power_state_get, 0, pstate); … … 224 224 225 225 /** Get Configuration Default */ 226 static int hda_get_cfg_def(hda_codec_t *codec, int node, uint32_t *cfgdef)226 static errno_t hda_get_cfg_def(hda_codec_t *codec, int node, uint32_t *cfgdef) 227 227 { 228 228 return hda_ccmd(codec, node, hda_cfg_def_get, 0, cfgdef); 229 229 } 230 230 231 static int hda_get_conn_sel(hda_codec_t *codec, int node, uint32_t *conn)231 static errno_t hda_get_conn_sel(hda_codec_t *codec, int node, uint32_t *conn) 232 232 { 233 233 return hda_ccmd(codec, node, hda_conn_sel_get, 0, conn); … … 235 235 236 236 /** Get Amplifier Gain / Mute */ 237 static int hda_get_amp_gain_mute(hda_codec_t *codec, int node, uint16_t payload,237 static errno_t hda_get_amp_gain_mute(hda_codec_t *codec, int node, uint16_t payload, 238 238 uint32_t *resp) 239 239 { 240 240 // ddf_msg(LVL_NOTE, "hda_get_amp_gain_mute(codec, %d, %x)", 241 241 // node, payload); 242 int rc = hda_ccmd(codec, node, hda_amp_gain_mute_get, payload, resp);242 errno_t rc = hda_ccmd(codec, node, hda_amp_gain_mute_get, payload, resp); 243 243 // ddf_msg(LVL_NOTE, "hda_get_amp_gain_mute(codec, %d, %x, resp=%x)", 244 244 // node, payload, *resp); … … 247 247 248 248 /** Get GP I/O Count */ 249 static int hda_get_gpio_cnt(hda_codec_t *codec, int node, uint32_t *resp)249 static errno_t hda_get_gpio_cnt(hda_codec_t *codec, int node, uint32_t *resp) 250 250 { 251 251 return hda_get_parameter(codec, node, hda_gpio_cnt, resp); 252 252 } 253 253 254 static int hda_set_amp_gain_mute(hda_codec_t *codec, int node, uint16_t payload)254 static errno_t hda_set_amp_gain_mute(hda_codec_t *codec, int node, uint16_t payload) 255 255 { 256 256 // ddf_msg(LVL_NOTE, "hda_set_amp_gain_mute(codec, %d, %x)", … … 259 259 } 260 260 261 static int hda_set_out_amp_max(hda_codec_t *codec, uint8_t aw)261 static errno_t hda_set_out_amp_max(hda_codec_t *codec, uint8_t aw) 262 262 { 263 263 uint32_t ampcaps; 264 264 uint32_t gmleft, gmright; 265 265 uint32_t offset; 266 int rc;266 errno_t rc; 267 267 268 268 rc = hda_get_parameter(codec, aw, … … 294 294 } 295 295 296 static int hda_set_in_amp_max(hda_codec_t *codec, uint8_t aw)296 static errno_t hda_set_in_amp_max(hda_codec_t *codec, uint8_t aw) 297 297 { 298 298 uint32_t ampcaps; … … 300 300 uint32_t offset; 301 301 int i; 302 int rc;302 errno_t rc; 303 303 304 304 rc = hda_get_parameter(codec, aw, … … 332 332 } 333 333 334 static int hda_clist_dump(hda_codec_t *codec, uint8_t aw)335 { 336 int rc;334 static errno_t hda_clist_dump(hda_codec_t *codec, uint8_t aw) 335 { 336 errno_t rc; 337 337 bool longform; 338 338 int len; … … 394 394 } 395 395 396 static int hda_pin_init(hda_codec_t *codec, uint8_t aw)397 { 398 int rc;396 static errno_t hda_pin_init(hda_codec_t *codec, uint8_t aw) 397 { 398 errno_t rc; 399 399 uint32_t cfgdef; 400 400 uint32_t pcaps; … … 471 471 472 472 /** Init power-control in wiget capable of doing so. */ 473 static int hda_power_ctl_init(hda_codec_t *codec, uint8_t aw)474 { 475 int rc;473 static errno_t hda_power_ctl_init(hda_codec_t *codec, uint8_t aw) 474 { 475 errno_t rc; 476 476 uint32_t pwrstate; 477 477 … … 491 491 { 492 492 hda_codec_t *codec; 493 int rc;493 errno_t rc; 494 494 int sfg, nfg; 495 495 int saw, naw; … … 639 639 } 640 640 641 int hda_out_converter_setup(hda_codec_t *codec, hda_stream_t *stream)642 { 643 int rc;641 errno_t hda_out_converter_setup(hda_codec_t *codec, hda_stream_t *stream) 642 { 643 errno_t rc; 644 644 int out_aw; 645 645 int i; … … 666 666 } 667 667 668 int hda_in_converter_setup(hda_codec_t *codec, hda_stream_t *stream)669 { 670 int rc;668 errno_t hda_in_converter_setup(hda_codec_t *codec, hda_stream_t *stream) 669 { 670 errno_t rc; 671 671 672 672 /* Configure converter */ -
uspace/drv/audio/hdaudio/codec.h
r36f0738 rb7fd2a0 52 52 extern hda_codec_t *hda_codec_init(hda_t *, uint8_t); 53 53 extern void hda_codec_fini(hda_codec_t *); 54 extern int hda_out_converter_setup(hda_codec_t *, hda_stream_t *);55 extern int hda_in_converter_setup(hda_codec_t *, hda_stream_t *);54 extern errno_t hda_out_converter_setup(hda_codec_t *, hda_stream_t *); 55 extern errno_t hda_in_converter_setup(hda_codec_t *, hda_stream_t *); 56 56 57 57 #endif -
uspace/drv/audio/hdaudio/hdactl.c
r36f0738 rb7fd2a0 64 64 * to read as 0. 65 65 */ 66 static int hda_ctl_reg16_set_reset(uint16_t *reg, uint16_t mask)66 static errno_t hda_ctl_reg16_set_reset(uint16_t *reg, uint16_t mask) 67 67 { 68 68 uint16_t val; … … 116 116 * 117 117 */ 118 static int hda_rb_size_select(uint8_t sizecap, uint8_t *selsz)118 static errno_t hda_rb_size_select(uint8_t sizecap, uint8_t *selsz) 119 119 { 120 120 int i; … … 146 146 147 147 /** Initialize the CORB */ 148 static int hda_corb_init(hda_t *hda)148 static errno_t hda_corb_init(hda_t *hda) 149 149 { 150 150 uint8_t ctl; … … 152 152 uint8_t sizecap; 153 153 uint8_t selsz; 154 int rc;154 errno_t rc; 155 155 156 156 ddf_msg(LVL_NOTE, "hda_corb_init()"); … … 237 237 238 238 /** Initialize the RIRB */ 239 static int hda_rirb_init(hda_t *hda)239 static errno_t hda_rirb_init(hda_t *hda) 240 240 { 241 241 uint8_t ctl; … … 243 243 uint8_t sizecap; 244 244 uint8_t selsz; 245 int rc;245 errno_t rc; 246 246 247 247 ddf_msg(LVL_NOTE, "hda_rirb_init()"); … … 372 372 373 373 /** Write to CORB */ 374 static int hda_corb_write(hda_t *hda, uint32_t *data, size_t count)374 static errno_t hda_corb_write(hda_t *hda, uint32_t *data, size_t count) 375 375 { 376 376 size_t avail; … … 414 414 } 415 415 416 static int hda_rirb_read(hda_t *hda, hda_rirb_entry_t *data)416 static errno_t hda_rirb_read(hda_t *hda, hda_rirb_entry_t *data) 417 417 { 418 418 size_t wp; … … 436 436 } 437 437 438 static int hda_solrb_read(hda_t *hda, hda_rirb_entry_t *data, size_t count)438 static errno_t hda_solrb_read(hda_t *hda, hda_rirb_entry_t *data, size_t count) 439 439 { 440 440 hda_rirb_entry_t resp; … … 490 490 uint32_t intctl; 491 491 int cnt; 492 int rc;492 errno_t rc; 493 493 494 494 ctl = calloc(1, sizeof(hda_ctl_t)); … … 615 615 } 616 616 617 int hda_cmd(hda_t *hda, uint32_t verb, uint32_t *resp)618 { 619 int rc;617 errno_t hda_cmd(hda_t *hda, uint32_t verb, uint32_t *resp) 618 { 619 errno_t rc; 620 620 hda_rirb_entry_t rentry; 621 621 … … 639 639 { 640 640 hda_rirb_entry_t resp; 641 int rc;641 errno_t rc; 642 642 643 643 while (true) { -
uspace/drv/audio/hdaudio/hdactl.h
r36f0738 rb7fd2a0 78 78 extern void hda_ctl_fini(hda_ctl_t *); 79 79 extern void hda_ctl_interrupt(hda_ctl_t *); 80 extern int hda_cmd(hda_t *, uint32_t, uint32_t *);80 extern errno_t hda_cmd(hda_t *, uint32_t, uint32_t *); 81 81 extern void hda_ctl_dump_info(hda_ctl_t *); 82 82 -
uspace/drv/audio/hdaudio/hdaudio.c
r36f0738 rb7fd2a0 52 52 #define NAME "hdaudio" 53 53 54 static int hda_dev_add(ddf_dev_t *dev);55 static int hda_dev_remove(ddf_dev_t *dev);56 static int hda_dev_gone(ddf_dev_t *dev);57 static int hda_fun_online(ddf_fun_t *fun);58 static int hda_fun_offline(ddf_fun_t *fun);54 static errno_t hda_dev_add(ddf_dev_t *dev); 55 static errno_t hda_dev_remove(ddf_dev_t *dev); 56 static errno_t hda_dev_gone(ddf_dev_t *dev); 57 static errno_t hda_fun_online(ddf_fun_t *fun); 58 static errno_t hda_fun_offline(ddf_fun_t *fun); 59 59 60 60 static void hdaudio_interrupt(ipc_call_t *, ddf_dev_t *); … … 148 148 }; 149 149 150 static int hda_dev_add(ddf_dev_t *dev)150 static errno_t hda_dev_add(ddf_dev_t *dev) 151 151 { 152 152 ddf_fun_t *fun_pcm = NULL; … … 160 160 int i; 161 161 void *regs = NULL; 162 int rc;162 errno_t rc; 163 163 164 164 ddf_msg(LVL_NOTE, "hda_dev_add()"); … … 318 318 } 319 319 320 static int hda_dev_remove(ddf_dev_t *dev)320 static errno_t hda_dev_remove(ddf_dev_t *dev) 321 321 { 322 322 hda_t *hda = (hda_t *)ddf_dev_data_get(dev); 323 int rc;323 errno_t rc; 324 324 325 325 ddf_msg(LVL_DEBUG, "hda_dev_remove(%p)", dev); … … 340 340 } 341 341 342 static int hda_dev_gone(ddf_dev_t *dev)342 static errno_t hda_dev_gone(ddf_dev_t *dev) 343 343 { 344 344 hda_t *hda = (hda_t *)ddf_dev_data_get(dev); 345 int rc;345 errno_t rc; 346 346 347 347 ddf_msg(LVL_DEBUG, "hda_dev_remove(%p)", dev); … … 356 356 } 357 357 358 static int hda_fun_online(ddf_fun_t *fun)358 static errno_t hda_fun_online(ddf_fun_t *fun) 359 359 { 360 360 ddf_msg(LVL_DEBUG, "hda_fun_online()"); … … 362 362 } 363 363 364 static int hda_fun_offline(ddf_fun_t *fun)364 static errno_t hda_fun_offline(ddf_fun_t *fun) 365 365 { 366 366 ddf_msg(LVL_DEBUG, "hda_fun_offline()"); -
uspace/drv/audio/hdaudio/pcm_iface.c
r36f0738 rb7fd2a0 47 47 #include "stream.h" 48 48 49 static int hda_get_info_str(ddf_fun_t *, const char **);49 static errno_t hda_get_info_str(ddf_fun_t *, const char **); 50 50 static unsigned hda_query_cap(ddf_fun_t *, audio_cap_t); 51 static int hda_test_format(ddf_fun_t *, unsigned *, unsigned *,51 static errno_t hda_test_format(ddf_fun_t *, unsigned *, unsigned *, 52 52 pcm_sample_format_t *); 53 static int hda_get_buffer(ddf_fun_t *, void **, size_t *);54 static int hda_get_buffer_position(ddf_fun_t *, size_t *);55 static int hda_set_event_session(ddf_fun_t *, async_sess_t *);53 static errno_t hda_get_buffer(ddf_fun_t *, void **, size_t *); 54 static errno_t hda_get_buffer_position(ddf_fun_t *, size_t *); 55 static errno_t hda_set_event_session(ddf_fun_t *, async_sess_t *); 56 56 static async_sess_t *hda_get_event_session(ddf_fun_t *); 57 static int hda_release_buffer(ddf_fun_t *);58 static int hda_start_playback(ddf_fun_t *, unsigned, unsigned, unsigned,57 static errno_t hda_release_buffer(ddf_fun_t *); 58 static errno_t hda_start_playback(ddf_fun_t *, unsigned, unsigned, unsigned, 59 59 pcm_sample_format_t); 60 static int hda_stop_playback(ddf_fun_t *, bool);61 static int hda_start_capture(ddf_fun_t *, unsigned, unsigned, unsigned,60 static errno_t hda_stop_playback(ddf_fun_t *, bool); 61 static errno_t hda_start_capture(ddf_fun_t *, unsigned, unsigned, unsigned, 62 62 pcm_sample_format_t); 63 static int hda_stop_capture(ddf_fun_t *, bool);63 static errno_t hda_stop_capture(ddf_fun_t *, bool); 64 64 65 65 audio_pcm_iface_t hda_pcm_iface = { … … 90 90 } 91 91 92 static int hda_get_info_str(ddf_fun_t *fun, const char **name)92 static errno_t hda_get_info_str(ddf_fun_t *fun, const char **name) 93 93 { 94 94 ddf_msg(LVL_NOTE, "hda_get_info_str()"); … … 124 124 } 125 125 126 static int hda_test_format(ddf_fun_t *fun, unsigned *channels,126 static errno_t hda_test_format(ddf_fun_t *fun, unsigned *channels, 127 127 unsigned *rate, pcm_sample_format_t *format) 128 128 { 129 int rc = EOK;129 errno_t rc = EOK; 130 130 131 131 ddf_msg(LVL_NOTE, "hda_test_format(%u, %u, %d)\n", … … 150 150 } 151 151 152 static int hda_get_buffer(ddf_fun_t *fun, void **buffer, size_t *size)153 { 154 hda_t *hda = fun_to_hda(fun); 155 int rc;152 static errno_t hda_get_buffer(ddf_fun_t *fun, void **buffer, size_t *size) 153 { 154 hda_t *hda = fun_to_hda(fun); 155 errno_t rc; 156 156 157 157 hda_lock(hda); … … 183 183 } 184 184 185 static int hda_get_buffer_position(ddf_fun_t *fun, size_t *pos)185 static errno_t hda_get_buffer_position(ddf_fun_t *fun, size_t *pos) 186 186 { 187 187 ddf_msg(LVL_NOTE, "hda_get_buffer_position()"); … … 189 189 } 190 190 191 static int hda_set_event_session(ddf_fun_t *fun, async_sess_t *sess)191 static errno_t hda_set_event_session(ddf_fun_t *fun, async_sess_t *sess) 192 192 { 193 193 hda_t *hda = fun_to_hda(fun); … … 215 215 } 216 216 217 static int hda_release_buffer(ddf_fun_t *fun)217 static errno_t hda_release_buffer(ddf_fun_t *fun) 218 218 { 219 219 hda_t *hda = fun_to_hda(fun); … … 234 234 } 235 235 236 static int hda_start_playback(ddf_fun_t *fun, unsigned frames,236 static errno_t hda_start_playback(ddf_fun_t *fun, unsigned frames, 237 237 unsigned channels, unsigned rate, pcm_sample_format_t format) 238 238 { 239 239 hda_t *hda = fun_to_hda(fun); 240 int rc;240 errno_t rc; 241 241 242 242 ddf_msg(LVL_NOTE, "hda_start_playback()"); … … 275 275 } 276 276 277 static int hda_stop_playback(ddf_fun_t *fun, bool immediate)277 static errno_t hda_stop_playback(ddf_fun_t *fun, bool immediate) 278 278 { 279 279 hda_t *hda = fun_to_hda(fun); … … 293 293 } 294 294 295 static int hda_start_capture(ddf_fun_t *fun, unsigned frames, unsigned channels,295 static errno_t hda_start_capture(ddf_fun_t *fun, unsigned frames, unsigned channels, 296 296 unsigned rate, pcm_sample_format_t format) 297 297 { 298 298 hda_t *hda = fun_to_hda(fun); 299 int rc;299 errno_t rc; 300 300 301 301 ddf_msg(LVL_NOTE, "hda_start_capture()"); … … 334 334 } 335 335 336 static int hda_stop_capture(ddf_fun_t *fun, bool immediate)336 static errno_t hda_stop_capture(ddf_fun_t *fun, bool immediate) 337 337 { 338 338 hda_t *hda = fun_to_hda(fun); -
uspace/drv/audio/hdaudio/stream.c
r36f0738 rb7fd2a0 49 49 #include "stream.h" 50 50 51 int hda_stream_buffers_alloc(hda_t *hda, hda_stream_buffers_t **rbufs)51 errno_t hda_stream_buffers_alloc(hda_t *hda, hda_stream_buffers_t **rbufs) 52 52 { 53 53 void *bdl; … … 57 57 size_t i; 58 58 // size_t j, k; 59 int rc;59 errno_t rc; 60 60 61 61 bufs = calloc(1, sizeof(hda_stream_buffers_t)); -
uspace/drv/audio/hdaudio/stream.h
r36f0738 rb7fd2a0 77 77 } hda_stream_t; 78 78 79 extern int hda_stream_buffers_alloc(hda_t *, hda_stream_buffers_t **);79 extern errno_t hda_stream_buffers_alloc(hda_t *, hda_stream_buffers_t **); 80 80 extern void hda_stream_buffers_free(hda_stream_buffers_t *); 81 81 extern hda_stream_t *hda_stream_create(hda_t *, hda_stream_dir_t,
Note:
See TracChangeset
for help on using the changeset viewer.
