1// Copyright 2017 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#pragma once
6
7#include <ddk/device.h>
8#include <fbl/ref_ptr.h>
9
10#include <intel-hda/codec-utils/codec-driver-base.h>
11
12#include "utils.h"
13
14namespace audio {
15namespace intel_hda {
16namespace codecs {
17
18class RealtekCodec : public IntelHDACodecDriverBase {
19public:
20    static fbl::RefPtr<RealtekCodec> Create();
21
22    zx_status_t Init(zx_device_t* codec_dev);
23    zx_status_t Start() override;
24    zx_status_t ProcessSolicitedResponse(const CodecResponse& resp) override;
25
26protected:
27    void PrintDebugPrefix() const override;
28
29    zx_status_t SetupCommon();
30    zx_status_t SetupAcer12();
31    zx_status_t SetupIntelNUC();
32    zx_status_t RunCommandList(const CommandListEntry* cmds, size_t cmd_count);
33    zx_status_t CreateAndStartStreams(const StreamProperties* streams, size_t stream_cnt);
34
35private:
36    friend class fbl::RefPtr<RealtekCodec>;
37    RealtekCodec() { }
38    virtual ~RealtekCodec() { }
39
40    bool waiting_for_impl_id_ = true;
41};
42
43}  // namespace codecs
44}  // namespace audio
45}  // namespace intel_hda
46