From cf030d95bbf4a4bbd9049e5590953ea30a814cb5 Mon Sep 17 00:00:00 2001 From: Jon Mayo Date: Mon, 3 Jan 2011 17:26:25 -0800 Subject: [ARM] tegra: hdmi nvhdcp driver Device /dev/nvhdcpX is used to manage NVHDCP on framebuffer /dev/fbX. These devices are created on hdmi driver initialition when it is attached to dc. Currently only one nvhdcp device may be created. An ioctl interface is in video/nvhdcp.h Check for repeaters and store repeater info. userspace application queries this status to authenticate the connection. When authentication fails, auto-renegotiate every 1.75 seconds. Give up after 5 failed attempts, reset after hotplug or policy change. use TEGRA_DC_OUT_NVHDCP_POLICY_ON_DEMAND in tegra_dc_out.flags in board panel configuration to select a different default policy at probe. Currently only TEGRA_DC_OUT_NVHDCP_POLICY_ALWAYS_ON is supported. Change-Id: I0db66fc86096b98d2604544061721d291523de75 Reviewed-by: Jon Mayo Tested-by: Jon Mayo Reviewed-by: Phillip Smith Reviewed-by: Yu-Huan Hsu Signed-off-by: Erik Gilling --- include/video/nvhdcp.h | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 include/video/nvhdcp.h (limited to 'include') diff --git a/include/video/nvhdcp.h b/include/video/nvhdcp.h new file mode 100644 index 000000000000..f282ff8caa99 --- /dev/null +++ b/include/video/nvhdcp.h @@ -0,0 +1,91 @@ +/* + * include/video/nvhdcp.h + * + * Copyright (c) 2010-2011, NVIDIA Corporation. + * + * This software is licensed under the terms of the GNU General Public + * License version 2, as published by the Free Software Foundation, and + * may be copied, distributed, and modified under those terms. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef _LINUX_NVHDCP_H_ +#define _LINUX_NVHDCP_H_ + +#include +#include +#include + +/* maximum receivers and repeaters connected at a time */ +#define TEGRA_NVHDCP_MAX_DEVS 127 + +/* values for value_flags */ +#define TEGRA_NVHDCP_FLAG_AN 0x0001 +#define TEGRA_NVHDCP_FLAG_AKSV 0x0002 +#define TEGRA_NVHDCP_FLAG_BKSV 0x0004 +#define TEGRA_NVHDCP_FLAG_BSTATUS 0x0008 /* repeater status */ +#define TEGRA_NVHDCP_FLAG_CN 0x0010 /* c_n */ +#define TEGRA_NVHDCP_FLAG_CKSV 0x0020 /* c_ksv */ +#define TEGRA_NVHDCP_FLAG_DKSV 0x0040 /* d_ksv */ +#define TEGRA_NVHDCP_FLAG_KP 0x0080 /* k_prime */ +#define TEGRA_NVHDCP_FLAG_S 0x0100 /* hdcp_status */ +#define TEGRA_NVHDCP_FLAG_CS 0x0200 /* connection state */ +#define TEGRA_NVHDCP_FLAG_V 0x0400 +#define TEGRA_NVHDCP_FLAG_MP 0x0800 +#define TEGRA_NVHDCP_FLAG_BKSVLIST 0x1000 + +/* values for packet_results */ +#define TEGRA_NVHDCP_RESULT_SUCCESS 0 +#define TEGRA_NVHDCP_RESULT_UNSUCCESSFUL 1 +#define TEGRA_NVHDCP_RESULT_PENDING 0x103 +#define TEGRA_NVHDCP_RESULT_LINK_FAILED 0xc0000013 +/* TODO: replace with -EINVAL */ +#define TEGRA_NVHDCP_RESULT_INVALID_PARAMETER 0xc000000d +#define TEGRA_NVHDCP_RESULT_INVALID_PARAMETER_MIX 0xc0000030 +/* TODO: replace with -ENOMEM */ +#define TEGRA_NVHDCP_RESULT_NO_MEMORY 0xc0000017 + +struct tegra_nvhdcp_packet { + __u32 value_flags; // (IN/OUT) + __u32 packet_results; // (OUT) + + __u64 c_n; // (IN) upstream exchange number + __u64 c_ksv; // (IN) + + __u32 b_status; // (OUT) link/repeater status + __u64 hdcp_status; // (OUT) READ_S + __u64 cs; // (OUT) Connection State + + __u64 k_prime; // (OUT) + __u64 a_n; // (OUT) + __u64 a_ksv; // (OUT) + __u64 b_ksv; // (OUT) + __u64 d_ksv; // (OUT) + __u8 v_prime[20]; // (OUT) 160-bit + __u64 m_prime; // (OUT) + + // (OUT) Valid KSVs in the bKsvList. Maximum is 127 devices + __u32 num_bksv_list; + + // (OUT) Up to 127 receivers & repeaters + __u64 bksv_list[TEGRA_NVHDCP_MAX_DEVS]; +}; + +/* parameters to TEGRAIO_NVHDCP_SET_POLICY */ +#define TEGRA_NVHDCP_POLICY_ON_DEMAND 0 +#define TEGRA_NVHDCP_POLICY_ALWAYS_ON 1 + +/* ioctls */ +#define TEGRAIO_NVHDCP_ON _IO('F', 0x70) +#define TEGRAIO_NVHDCP_OFF _IO('F', 0x71) +#define TEGRAIO_NVHDCP_SET_POLICY _IOW('F', 0x72, __u32) +#define TEGRAIO_NVHDCP_READ_M _IOWR('F', 0x73, struct tegra_nvhdcp_packet) +#define TEGRAIO_NVHDCP_READ_S _IOWR('F', 0x74, struct tegra_nvhdcp_packet) +#define TEGRAIO_NVHDCP_RENEGOTIATE _IO('F', 0x75) + +#endif -- cgit v1.2.3