linux/drivers/gpu/drm/amd/display/modules/inc/mod_hdcp.h

/*
 * Copyright 2018 Advanced Micro Devices, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Authors: AMD
 *
 */

#ifndef MOD_HDCP_H_
#define MOD_HDCP_H_

#include "os_types.h"
#include "signal_types.h"

/* Forward Declarations */
struct mod_hdcp;

#define MAX_NUM_OF_DISPLAYS
#define MAX_NUM_OF_ATTEMPTS
#define MAX_NUM_OF_ERROR_TRACE

/* detailed return status */
enum mod_hdcp_status {};

struct mod_hdcp_displayport {};

struct mod_hdcp_hdmi {};
enum mod_hdcp_operation_mode {};

enum mod_hdcp_display_state {};

struct mod_hdcp_psp_caps {};

enum mod_hdcp_display_disable_option {};

struct mod_hdcp_ddc {};

struct mod_hdcp_psp {};

struct mod_hdcp_display_adjustment {};

struct mod_hdcp_link_adjustment_hdcp1 {};

enum mod_hdcp_force_hdcp_type {};

struct mod_hdcp_link_adjustment_hdcp2 {};

struct mod_hdcp_link_adjustment {};

struct mod_hdcp_error {};

struct mod_hdcp_trace {};

enum mod_hdcp_encryption_status {};

/* per link events dm has to notify to hdcp module */
enum mod_hdcp_event {};

/* output flags from module requesting timer operations */
struct mod_hdcp_output {};

/* used to represent per display info */
struct mod_hdcp_display {};

/* used to represent per link info */
/* in case a link has multiple displays, they share the same link info */
struct mod_hdcp_link {};

/* a query structure for a display's hdcp information */
struct mod_hdcp_display_query {};

/* contains values per on external display configuration change */
struct mod_hdcp_config {};

/* dm allocates memory of mod_hdcp per dc_link on dm init based on memory size*/
size_t mod_hdcp_get_memory_size(void);

/* called per link on link creation */
enum mod_hdcp_status mod_hdcp_setup(struct mod_hdcp *hdcp,
		struct mod_hdcp_config *config);

/* called per link on link destroy */
enum mod_hdcp_status mod_hdcp_teardown(struct mod_hdcp *hdcp);

/* called per display after stream is enabled */
enum mod_hdcp_status mod_hdcp_add_display(struct mod_hdcp *hdcp,
		struct mod_hdcp_link *link, struct mod_hdcp_display *display,
		struct mod_hdcp_output *output);

/* called per display before stream is disabled */
enum mod_hdcp_status mod_hdcp_remove_display(struct mod_hdcp *hdcp,
		uint8_t index, struct mod_hdcp_output *output);

/* called per display to apply new authentication adjustment */
enum mod_hdcp_status mod_hdcp_update_display(struct mod_hdcp *hdcp,
		uint8_t index,
		struct mod_hdcp_link_adjustment *link_adjust,
		struct mod_hdcp_display_adjustment *display_adjust,
		struct mod_hdcp_output *output);

/* called to query hdcp information on a specific index */
enum mod_hdcp_status mod_hdcp_query_display(struct mod_hdcp *hdcp,
		uint8_t index, struct mod_hdcp_display_query *query);

/* called per link on connectivity change */
enum mod_hdcp_status mod_hdcp_reset_connection(struct mod_hdcp *hdcp,
		struct mod_hdcp_output *output);

/* called per link on events (i.e. callback, watchdog, CP_IRQ) */
enum mod_hdcp_status mod_hdcp_process_event(struct mod_hdcp *hdcp,
		enum mod_hdcp_event event, struct mod_hdcp_output *output);

/* called to convert enum mod_hdcp_status to c string */
char *mod_hdcp_status_to_str(int32_t status);

/* called to convert state id to c string */
char *mod_hdcp_state_id_to_str(int32_t id);

/* called to convert signal type to operation mode */
enum mod_hdcp_operation_mode mod_hdcp_signal_type_to_operation_mode(
		enum signal_type signal);
#endif /* MOD_HDCP_H_ */