Home | History | Annotate | Download | only in linux
      1 /*
      2  * include/video/nvhdcp.h
      3  *
      4  * Copyright (c) 2010-2011, NVIDIA Corporation.
      5  *
      6  * This software is licensed under the terms of the GNU General Public
      7  * License version 2, as published by the Free Software Foundation, and
      8  * may be copied, distributed, and modified under those terms.
      9  *
     10  * This program is distributed in the hope that it will be useful,
     11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13  * GNU General Public License for more details.
     14  *
     15  */
     16 
     17 #ifndef _LINUX_NVHDCP_H_
     18 #define _LINUX_NVHDCP_H_
     19 
     20 #include <linux/fb.h>
     21 #include <linux/types.h>
     22 #include <asm/ioctl.h>
     23 
     24 /* maximum receivers and repeaters connected at a time */
     25 #define TEGRA_NVHDCP_MAX_DEVS	127
     26 
     27 /* values for value_flags */
     28 #define TEGRA_NVHDCP_FLAG_AN			0x0001
     29 #define TEGRA_NVHDCP_FLAG_AKSV			0x0002
     30 #define TEGRA_NVHDCP_FLAG_BKSV			0x0004
     31 #define TEGRA_NVHDCP_FLAG_BSTATUS		0x0008 /* repeater status */
     32 #define TEGRA_NVHDCP_FLAG_CN			0x0010 /* c_n */
     33 #define TEGRA_NVHDCP_FLAG_CKSV			0x0020 /* c_ksv */
     34 #define TEGRA_NVHDCP_FLAG_DKSV			0x0040 /* d_ksv */
     35 #define TEGRA_NVHDCP_FLAG_KP			0x0080 /* k_prime */
     36 #define TEGRA_NVHDCP_FLAG_S			0x0100 /* hdcp_status */
     37 #define TEGRA_NVHDCP_FLAG_CS			0x0200 /* connection state */
     38 #define TEGRA_NVHDCP_FLAG_V			0x0400
     39 #define TEGRA_NVHDCP_FLAG_MP			0x0800
     40 #define TEGRA_NVHDCP_FLAG_BKSVLIST		0x1000
     41 
     42 /* values for packet_results */
     43 #define TEGRA_NVHDCP_RESULT_SUCCESS		0
     44 #define TEGRA_NVHDCP_RESULT_UNSUCCESSFUL	1
     45 #define TEGRA_NVHDCP_RESULT_PENDING		0x103
     46 #define TEGRA_NVHDCP_RESULT_LINK_FAILED		0xc0000013
     47 /* TODO: replace with -EINVAL */
     48 #define TEGRA_NVHDCP_RESULT_INVALID_PARAMETER	0xc000000d
     49 #define TEGRA_NVHDCP_RESULT_INVALID_PARAMETER_MIX	0xc0000030
     50 /* TODO: replace with -ENOMEM */
     51 #define TEGRA_NVHDCP_RESULT_NO_MEMORY		0xc0000017
     52 
     53 struct tegra_nvhdcp_packet {
     54 	__u32	value_flags;		// (IN/OUT)
     55 	__u32	packet_results;		// (OUT)
     56 
     57 	__u64	c_n;			// (IN) upstream exchange number
     58 	__u64	c_ksv;			// (IN)
     59 
     60 	__u32	b_status;	// (OUT) link/repeater status
     61 	__u64	hdcp_status;	// (OUT) READ_S
     62 	__u64	cs;		// (OUT) Connection State
     63 
     64 	__u64	k_prime;	// (OUT)
     65 	__u64	a_n;		// (OUT)
     66 	__u64	a_ksv;		// (OUT)
     67 	__u64	b_ksv;		// (OUT)
     68 	__u64	d_ksv;		// (OUT)
     69 	__u8	v_prime[20];	// (OUT) 160-bit
     70 	__u64	m_prime;	// (OUT)
     71 
     72 	// (OUT) Valid KSVs in the bKsvList. Maximum is 127 devices
     73 	__u32	num_bksv_list;
     74 
     75 	// (OUT) Up to 127 receivers & repeaters
     76 	__u64	bksv_list[TEGRA_NVHDCP_MAX_DEVS];
     77 };
     78 
     79 /* parameters to TEGRAIO_NVHDCP_SET_POLICY */
     80 #define TEGRA_NVHDCP_POLICY_ON_DEMAND	0
     81 #define TEGRA_NVHDCP_POLICY_ALWAYS_ON	1
     82 
     83 /* ioctls */
     84 #define TEGRAIO_NVHDCP_ON		_IO('F', 0x70)
     85 #define TEGRAIO_NVHDCP_OFF		_IO('F', 0x71)
     86 #define TEGRAIO_NVHDCP_SET_POLICY	_IOW('F', 0x72, __u32)
     87 #define TEGRAIO_NVHDCP_READ_M		_IOWR('F', 0x73, struct tegra_nvhdcp_packet)
     88 #define TEGRAIO_NVHDCP_READ_S		_IOWR('F', 0x74, struct tegra_nvhdcp_packet)
     89 #define TEGRAIO_NVHDCP_RENEGOTIATE	_IO('F', 0x75)
     90 
     91 #endif
     92