1 /*
2  * Copyright (C) Fuzhou Rockchip Electronics Co.Ltd
3  * Author Huicong Xu <xhc@rock-chips.com>
4  *
5  * This software is licensed under the terms of the GNU General Public
6  * License version 2, as published by the Free Software Foundation, and
7  * may be copied, distributed, and modified under those terms.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  */
14 
15 #ifndef DW_HDMI_HDCP_H
16 #define DW_HDMI_HDCP_H
17 
18 #include <linux/miscdevice.h>
19 
20 #define DW_HDCP_DRIVER_NAME "dw-hdmi-hdcp"
21 #define HDCP_PRIVATE_KEY_SIZE 280
22 #define HDCP_KEY_SHA_SIZE 20
23 
24 struct hdcp_keys {
25     u8 KSV[8];
26     u8 devicekey[HDCP_PRIVATE_KEY_SIZE];
27     u8 sha1[HDCP_KEY_SHA_SIZE];
28 };
29 
30 struct dw_hdcp {
31     bool enable;
32     int retry_times;
33     int remaining_times;
34     char *seeds;
35     int invalidkey;
36     char *invalidkeys;
37     int hdcp2_enable;
38     int status;
39     u32 reg_io_width;
40 
41     struct miscdevice mdev;
42     struct hdcp_keys *keys;
43     struct device *dev;
44     struct dw_hdmi *hdmi;
45     void __iomem *regs;
46 
47     void (*write)(struct dw_hdmi *hdmi, u8 val, int offset);
48     u8 (*read)(struct dw_hdmi *hdmi, int offset);
49     int (*hdcp_start)(struct dw_hdcp *hdcp);
50     int (*hdcp_stop)(struct dw_hdcp *hdcp);
51     void (*hdcp_isr)(struct dw_hdcp *hdcp, int hdcp_int);
52 };
53 
54 #endif
55