1 // Copyright 2018 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 "aml-mipi-regs.h"
6 #include "aml-mipi.h"
7 #include <ddk/debug.h>
8 #include <hw/reg.h>
9 #include <stdint.h>
10 #include <zircon/types.h>
11
12 namespace camera {
13
DumpCsiPhyRegs()14 void AmlMipiDevice::DumpCsiPhyRegs() {
15 zxlogf(INFO, "%s: MIPI CSI PHY REGS VALUES\n", __FUNCTION__);
16 for (int i = 0; i < 27; i++) {
17 zxlogf(INFO, "0x%x ---> 0x%x \n", (0xFF650000 + i * 4), csi_phy0_mmio_->Read32(i * 4));
18 }
19 }
20
DumpAPhyRegs()21 void AmlMipiDevice::DumpAPhyRegs() {
22 zxlogf(INFO, "%s: MIPI APHY REGS VALUES\n", __FUNCTION__);
23 for (int i = 0x13; i < 0x17; i++) {
24 zxlogf(INFO, "0x%x ---> 0x%x \n", (0xFF63c300 + i * 4), aphy0_mmio_->Read32(i * 4));
25 }
26 }
27
DumpHostRegs()28 void AmlMipiDevice::DumpHostRegs() {
29 zxlogf(INFO, "%s: MIPI HOST REGS VALUES\n", __FUNCTION__);
30 for (int i = 0; i < 8; i++) {
31 zxlogf(INFO, "0x%x ---> 0x%x \n", (0xff654000 + i * 4), csi_host0_mmio_->Read32(i * 4));
32 }
33 }
34
DumpFrontEndRegs()35 void AmlMipiDevice::DumpFrontEndRegs() {
36 zxlogf(INFO, "%s: MIPI ADAP FRONTEND REGS VALUES\n", __FUNCTION__);
37 auto frontend_reg = mipi_adap_mmio_->View(FRONTEND_BASE, 0x400);
38 for (int i = 0; i < 21; i++) {
39 printf("0x%x ---> 0x%x \n", (0xFF654800 + i * 4), frontend_reg.Read32(i * 4));
40 }
41 }
42
DumpReaderRegs()43 void AmlMipiDevice::DumpReaderRegs() {
44 zxlogf(INFO, "%s: MIPI ADAP READER REGS VALUES\n", __FUNCTION__);
45 auto reader_reg = mipi_adap_mmio_->View(RD_BASE, 0x100);
46 for (int i = 0; i < 8; i++) {
47 printf("0x%x ---> 0x%x \n", (0xFF655000 + i * 4), reader_reg.Read32(i * 4));
48 }
49 }
50
DumpAlignRegs()51 void AmlMipiDevice::DumpAlignRegs() {
52 zxlogf(INFO, "%s: MIPI ADAP ALIGN REGS VALUES\n", __FUNCTION__);
53 auto align_reg = mipi_adap_mmio_->View(ALIGN_BASE, 0x100);
54 for (int i = 48; i < 58; i++) {
55 printf("0x%x ---> 0x%x \n", (0xFF655000 + i * 4), align_reg.Read32(i * 4));
56 }
57 }
58
DumpPixelRegs()59 void AmlMipiDevice::DumpPixelRegs() {
60 zxlogf(INFO, "%s: MIPI ADAP PIXEL REGS VALUES\n", __FUNCTION__);
61 auto pixel_reg = mipi_adap_mmio_->View(PIXEL_BASE, 0x100);
62 for (int i = 0x20; i < 0x24; i++) {
63 printf("0x%x ---> 0x%x \n", (0xFF655000 + i * 4), pixel_reg.Read32(i * 4));
64 }
65 }
66
DumpMiscRegs()67 void AmlMipiDevice::DumpMiscRegs() {
68 zxlogf(INFO, "%s: MIPI ADAP MISC REGS VALUES\n", __FUNCTION__);
69 auto misc_reg = mipi_adap_mmio_->View(MISC_BASE, 0x100);
70 for (int i = 0x40; i < 0x64; i++) {
71 printf("0x%x ---> 0x%x \n", (0xFF655000 + i * 4), misc_reg.Read32(i * 4));
72 }
73 }
74
75 } // namespace camera
76