Files
android_kernel_samsung_sm86…/hdcp/hdcp_main.h
Shubham Dhiman bae6b391eb driver : hdcp_qseecom: Retry HDCP key verify when Qseecomd down
HDCP has a dependency on Qseecomd for HDCP key
verification and other SCM calls. Qseecomd takes
a lot of time to be available during boot because
of which HDCP init fails.
Adding retry mechanism only when there is hdcp key
verification failure due to Qseecomd not starting
in time. For other error codes, like HDCP key not
programmed, there will be no retry.
If Qseecomd doesn’t come up within maximum retries,
code will stop retrying and hdcp key verification
will fail. For each retry, there is a sleep of 100ms.
The number of retries can be changed from the dtsi file.
By default, we are allowing 40 retries but it can be
changed. 40 retries are based on the qseecomd KPI which
can be anywhere between 2.9 sec to 3.6 sec.

Change-Id: I3661b349ec44604147d6e6700307fa416904bbfa
Signed-off-by: Shubham Dhiman <quic_shubhamd@quicinc.com>
2023-11-06 14:44:18 -05:00

114 rivejä
3.7 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef __HDCP_MAIN_H__
#define __HDCP_MAIN_H__
#include <linux/cdev.h>
#include <linux/completion.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/hdcp_qseecom.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/kthread.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/types.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <misc/qseecom_kernel.h>
#define HDCP2P2_APP_NAME "hdcp2p2"
#define HDCP1_APP_NAME "hdcp1"
#define HDCP1OPS_APP_NAME "ops"
#define HDCPSRM_APP_NAME "hdcpsrm"
#define QSEECOM_SBUFF_SIZE 0x1000
#define MAX_REC_ID_LIST_SIZE 160
#define MAX_TX_MESSAGE_SIZE 129
#define MAX_RX_MESSAGE_SIZE 534
#define MAX_TOPOLOGY_ELEMS 32
#define HDCP1_NOTIFY_TOPOLOGY 1
#define HDCP1_AKSV_SIZE 8
#define HDCP_CLIENT_MAKE_VERSION(maj, min, patch) \
((((maj)&0xFF) << 16) | (((min)&0xFF) << 8) | ((patch)&0xFF))
#define HCDP_TXMTR_GET_MAJOR_VERSION(v) (((v) >> 16) & 0xFF)
#define HCDP_TXMTR_GET_MINOR_VERSION(v) (((v) >> 8) & 0xFF)
#define HCDP_TXMTR_GET_PATCH_VERSION(v) ((v)&0xFF)
#define HDCP_CLIENT_MAJOR_VERSION 2
#define HDCP_CLIENT_MINOR_VERSION 1
#define HDCP_CLIENT_PATCH_VERSION 0
#define HDCP_SUCCESS 0
/* Wait 200ms after authentication */
#define SLEEP_FORCE_ENCRYPTION_MS 200
/* Error code when Qseecomd is not up at boot time */
#define QSEECOMD_ERROR -4103
/* Wait for 100ms on every retry to check if Qseecomd is up */
#define SLEEP_QSEECOMD_WAIT_MS 100
#define SLEEP_SET_HW_KEY_MS 300
/* flags set by tz in response message */
#define HDCP_TXMTR_SUBSTATE_INIT 0
#define HDCP_TXMTR_SUBSTATE_WAITING_FOR_RECIEVERID_LIST 1
#define HDCP_TXMTR_SUBSTATE_PROCESSED_RECIEVERID_LIST 2
#define HDCP_TXMTR_SUBSTATE_WAITING_FOR_STREAM_READY_MESSAGE 3
#define HDCP_TXMTR_SUBSTATE_REPEATER_AUTH_COMPLETE 4
enum hdcp_state {
HDCP_STATE_INIT = 0x00,
HDCP_STATE_APP_LOADED = 0x01,
HDCP_STATE_SESSION_INIT = 0x02,
HDCP_STATE_TXMTR_INIT = 0x04,
HDCP_STATE_AUTHENTICATED = 0x08,
HDCP_STATE_ERROR = 0x10
};
struct hdcp_ta_interface
{
void *(*trusted_app_hdcp1_init)(void);
bool (*trusted_app_hdcp1_feature_supported)(void *data);
int (*trusted_app_hdcp1_set_enc)(void *data,bool enable);
int (*trusted_app_hdcp1_ops_notify)(void *data, void *topo,
bool is_authenticated);
int (*trusted_app_hdcp1_start)(void *data, u32 *aksv_msb,
u32 *aksv_lsb);
void (*trusted_app_hdcp1_stop)(void *data);
void *(*trusted_app_hdcp2_init)(u32 device_type);
void (*trusted_app_hdcp2_deinit)(void *ctx);
int (*trusted_app_hdcp2_app_start)(void *ctx, uint32_t req_len);
int (*trusted_app_hdcp2_app_start_auth)(void *ctx, uint32_t req_len);
int (*trusted_app_hdcp2_app_process_msg)(void *ctx, uint32_t req_len);
int (*trusted_app_hdcp2_app_timeout)(void *ctx, uint32_t req_len);
int (*trusted_app_hdcp2_app_enable_encryption)(void *ctx, uint32_t req_len);
int (*trusted_app_hdcp2_app_query_stream)(void *ctx, uint32_t req_len);
int (*trusted_app_hdcp2_app_stop)(void *ctx);
bool (*trusted_app_hdcp2_feature_supported)(void *ctx);
int (*trusted_app_hdcp2_force_encryption)(void *ctx, uint32_t enable);
int (*trusted_app_hdcp2_open_stream)(void *ctx, uint8_t vc_payload_id,
uint8_t stream_number, uint32_t *stream_id);
int (*trusted_app_hdcp2_close_stream)(void *ctx, uint32_t stream_id);
int (*trusted_app_hdcp2_update_app_data)(void *ctx,
struct hdcp2_app_data *app_data);
};
int hdcp1_validate_aksv(u32 aksv_msb, u32 aksv_lsb);
#endif /* __HDCP_MAIN_H__ */