Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/hda_codec.c
Show First 20 Lines • Show All 199 Lines • ▼ Show 20 Lines | struct hda_codec_softc { | ||||
struct hda_codec_inst *hci; | struct hda_codec_inst *hci; | ||||
struct hda_codec_stream streams[HDA_CODEC_STREAMS_COUNT]; | struct hda_codec_stream streams[HDA_CODEC_STREAMS_COUNT]; | ||||
}; | }; | ||||
/* | /* | ||||
* HDA Codec module function declarations | * HDA Codec module function declarations | ||||
*/ | */ | ||||
static int hda_codec_init(struct hda_codec_inst *hci, const char *play, | static int hda_codec_init(struct hda_codec_inst *hci, const char *play, | ||||
const char *rec, const char *opts); | const char *rec); | ||||
static int hda_codec_reset(struct hda_codec_inst *hci); | static int hda_codec_reset(struct hda_codec_inst *hci); | ||||
static int hda_codec_command(struct hda_codec_inst *hci, uint32_t cmd_data); | static int hda_codec_command(struct hda_codec_inst *hci, uint32_t cmd_data); | ||||
static int hda_codec_notify(struct hda_codec_inst *hci, uint8_t run, | static int hda_codec_notify(struct hda_codec_inst *hci, uint8_t run, | ||||
uint8_t stream, uint8_t dir); | uint8_t stream, uint8_t dir); | ||||
static int hda_codec_parse_format(uint16_t fmt, struct audio_params *params); | static int hda_codec_parse_format(uint16_t fmt, struct audio_params *params); | ||||
static uint32_t hda_codec_audio_output_nid(struct hda_codec_softc *sc, | static uint32_t hda_codec_audio_output_nid(struct hda_codec_softc *sc, | ||||
▲ Show 20 Lines • Show All 169 Lines • ▼ Show 20 Lines | |||||
}; | }; | ||||
/* | /* | ||||
* HDA Codec module function definitions | * HDA Codec module function definitions | ||||
*/ | */ | ||||
static int | static int | ||||
hda_codec_init(struct hda_codec_inst *hci, const char *play, | hda_codec_init(struct hda_codec_inst *hci, const char *play, | ||||
const char *rec, const char *opts) | const char *rec) | ||||
{ | { | ||||
struct hda_codec_softc *sc = NULL; | struct hda_codec_softc *sc = NULL; | ||||
struct hda_codec_stream *st = NULL; | struct hda_codec_stream *st = NULL; | ||||
int err; | int err; | ||||
if (!(play || rec)) | if (!(play || rec)) | ||||
return (-1); | return (-1); | ||||
DPRINTF("cad: 0x%x opts: %s", hci->cad, opts); | |||||
sc = calloc(1, sizeof(*sc)); | sc = calloc(1, sizeof(*sc)); | ||||
if (!sc) | if (!sc) | ||||
return (-1); | return (-1); | ||||
if (play && rec) | if (play && rec) | ||||
sc->get_parameters = hda_codec_duplex_parameters; | sc->get_parameters = hda_codec_duplex_parameters; | ||||
else { | else { | ||||
▲ Show 20 Lines • Show All 541 Lines • Show Last 20 Lines |