1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 #ifndef HDMI_HPR_H
10 #define HDMI_HPR_H
11 
12 #include "hdf_base.h"
13 #include "hdmi_if.h"
14 
15 #ifdef __cplusplus
16 #if __cplusplus
17 extern "C" {
18 #endif
19 #endif /* __cplusplus */
20 
21 /* HDR(High Dynamic Range) Sysytem. */
22 #define HDMI_ZERO_DRMIF_SEND_TIME 2000
23 #define HDMI_HDR_STATE_CHANGE_TIME 500
24 
25 enum HdmiHdrTimerType {
26     HDMI_HDR_TIMER_ZERO_DRMIF,
27     HDMI_HDR_TIMER_SDR_TO_HDR10,
28     HDMI_HDR_TIMER_TYPE_BUTT
29 };
30 
31 enum HdmiHdrState {
32     HDMI_HDR_STATE_NONE,   /* HDR state change, SDR->HDR10 don't change anything */
33     HDMI_HDR_STATE_OE,     /* HDR state change, SDR->HDR10 output disable and enable */
34     HDMI_HDR_STATE_AVMUTE, /* HDR state change, SDR->HDR10 send avmute */
35     HDMI_HDR_STATE_BUTT
36 };
37 
38 struct HdmiHdrTimerConfig {
39     enum HdmiHdrTimerType timerType;
40     bool start;
41     uint32_t time;
42 };
43 
44 struct HdmiHdrInfo {
45     enum HdmiHdrState state;    /* Make sure that switch smoothly from non-HDR10 to HDR10. */
46     struct HdmiHdrTimerConfig zeroDrmIfTimer; /* Send zero DRM infoFrame when the HDR mode from HDR10 to non-HDR10. */
47     struct HdmiHdrTimerConfig stateChangeTimer; /*  */
48 };
49 
50 struct HdmiHdr {
51     struct HdmiHdrInfo info;
52     void *priv;
53 };
54 
55 int32_t HdmiHdrAttrHandle(struct HdmiHdr *hdr, struct HdmiHdrAttr *curAttr);
56 int32_t HdmiHdrDrmInfoFrameStop(struct HdmiHdr *hdr);
57 int32_t HdmiHdrModeChangeTimeout(struct HdmiHdr *hdr);
58 
59 #ifdef __cplusplus
60 #if __cplusplus
61 }
62 #endif
63 #endif /* __cplusplus */
64 
65 #endif /* HDMI_HPR_H */
66