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 #include <zircon/device/intel-hda.h>
6 #include <lib/fdio/io.h>
7 
8 #include "intel_hda_device.h"
9 
10 namespace audio {
11 namespace intel_hda {
12 
Probe()13 zx_status_t IntelHDADevice::Probe() {
14     zx_status_t res = ZirconDevice::Connect();
15     if (res != ZX_OK)
16         return res;
17 
18     ihda_get_ids_req_t req;
19     ihda_get_ids_resp_t resp;
20 
21     InitRequest(&req, IHDA_CMD_GET_IDS);
22     res = CallDevice(req, &resp);
23     if (res != ZX_OK)
24         return res;
25 
26     vid_       = resp.vid;
27     did_       = resp.did;
28     ihda_vmaj_ = resp.ihda_vmaj;
29     ihda_vmin_ = resp.ihda_vmin;
30     rev_id_    = resp.rev_id;
31     step_id_   = resp.step_id;
32 
33     return ZX_OK;
34 }
35 
36 }  // namespace audio
37 }  // namespace intel_hda
38