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#pragma once
6
7#include <unistd.h>
8#include <zircon/compiler.h>
9#include <ddk/protocol/platform-device.h>
10#include <fbl/unique_ptr.h>
11#include <hwreg/mmio.h>
12#include <ddk/protocol/gpio.h>
13#include "dw-mipi-dsi.h"
14
15namespace astro_display {
16
17class Lcd {
18public:
19    Lcd(uint8_t panel_type) : panel_type_(panel_type) {}
20
21    zx_status_t Init(zx_device_t* parent);
22    zx_status_t Enable();
23    zx_status_t Disable();
24private:
25    zx_status_t LoadInitTable(const uint8_t* buffer, size_t size);
26    zx_status_t GetDisplayId();
27
28    uint8_t                                     panel_type_;
29    gpio_protocol_t                             gpio_ = {};
30    fbl::unique_ptr<astro_display::DwMipiDsi>   dsi_;
31
32    bool                                        initialized_ = false;
33    bool                                        enabled_ =false;
34};
35
36} // namespace astro_display
37