1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Support for Intel High-Definition Audio codec
5 * Copyright 2018 Google LLC
7 * Taken from coreboot file of the same name
10 #ifndef __HDA_CODEC_H_
11 #define __HDA_CODEC_H_
16 * struct hda_codec_priv - Private data required by the HDA codec
18 * @regs: HDA registers
19 * @beep_nid: Node ID of beep node (>0)
21 struct hda_codec_priv {
22 struct hda_regs *regs;
27 * hda_wait_for_ready() - Wait for the codec to indicate it is ready
29 * @regs: HDA registers
30 * @return 0 if OK -ETIMEDOUT if codec did not respond in time
32 int hda_wait_for_ready(struct hda_regs *regs);
35 * hda_wait_for_valid() - Wait for the codec to accept the last command
37 * @regs: HDA registers
38 * @return 0 if OK -ETIMEDOUT if codec did not respond in time
40 int hda_wait_for_valid(struct hda_regs *regs);
43 * hda_codec_detect() - Detect which codecs are present
45 * @regs: HDA registers
46 * @return bit mask of active codecs (0 if none)
47 * @return 0 if OK, -ve on error
49 int hda_codec_detect(struct hda_regs *regs);
52 * hda_codecs_init() - Init all codecs
55 * @regs: HDA registers
56 * @codec_mask: Mask of codecs to init (bits 3:0)
57 * @return 0 if OK, -ve on error
59 int hda_codecs_init(struct udevice *dev, struct hda_regs *regs, u32 codec_mask);
62 * hda_codec_start_beep() - Start beeping
64 * This tells the sound hardware to start a beep. It will continue until stopped
65 * by sound_stop_beep().
68 * @frequency_hz: Beep frequency in hertz
69 * @return if OK, -ve on error
71 int hda_codec_start_beep(struct udevice *dev, int frequency_hz);
74 * hda_codec_stop_beep() - Stop beeping
76 * This tells the sound hardware to stop a previously started beep.
79 * @return if OK, -ve on error
81 int hda_codec_stop_beep(struct udevice *dev);
84 * hda_codec_init() - Set up the HDA codec base address
86 * This should be called at the start of the probe() method.
89 * @return 0 if OK, -ve on error
91 int hda_codec_init(struct udevice *dev);
94 * hda_codec_finish_init() - Finish setting up the HDA codec base address
96 * This should be called at the end of the probe() method.
99 * @return 0 if OK, -ve on error
101 int hda_codec_finish_init(struct udevice *dev);
103 #endif /* __HDA_CODEC_H_ */