hdmirx: optimize the communication method with hdcp_rx22 [1/3]

PD#SWPL-2564

Problem:
hdcp_rx22 ocupy too much CPU resources

Solution:
1.Optimize hdcp_rx22 polling method
2.The driver code should match the hdcp_rx22 whose version is
HDCP2.2 RX0719

Verify:
Android P

Change-Id: I4e1ab48d4eb3b74de070a36cd719c67370f26505
Signed-off-by: yicheng shen <yicheng.shen@amlogic.com>
This commit is contained in:
yicheng shen
2019-07-19 05:13:44 -04:00
committed by Luke Go
parent e9e6a7a74d
commit 4bd1404666
4 changed files with 101 additions and 43 deletions

View File

@@ -355,6 +355,52 @@ err_free:
return rc;
}
/*
* set_param - set kernel param to hdcp_rx22
* amlogic added
*/
static long set_param(struct esm_device *esm,
struct esm_ioc_param __user *arg)
{
struct esm_ioc_param head;
memset(&head, 0, sizeof(head));
if (copy_from_user(&head, arg, sizeof(head)) != 0)
return -EFAULT;
esm_auth_fail_en = head.reauth;
esm_reset_flag = head.esm_reset;
hdcp22_stop_auth = head.auth_stop;
hdcp22_esm_reset2 = head.esm_reset2;
return 0;
}
/*
* get_param - hdcp_rx22 get param from kernel
* amlogic added
*/
static long get_param(struct esm_device *esm,
struct esm_ioc_param __user *arg)
{
struct esm_ioc_param head;
head.hpd = hpd_to_esm;
head.video_stable = video_stable_to_esm;
head.pwr_sts = pwr_sts_to_esm;
head.log = enable_hdcp22_esm_log;
head.esm_reset = esm_reset_flag;
head.reauth = esm_auth_fail_en;
head.esm_err = 0;
head.auth_stop = hdcp22_stop_auth;
head.esm_reset2 = hdcp22_esm_reset2;
head.esm_kill = hdcp22_kill_esm;
head.reset_mode = esm_recovery_mode;
if (copy_to_user(arg, &head, sizeof(head)) != 0)
return -EFAULT;
return 0;
}
/* free_esm_slot - free_esm_slot*/
static void free_esm_slot(struct esm_device *slot)
{
@@ -400,6 +446,10 @@ static long hld_ioctl(struct file *f,
return read_data(esm, data);
case ESM_IOC_MEMSET_DATA:
return set_data(esm, data);
case ESM_IOC_GET_PARAM:
return get_param(esm, data);
case ESM_IOC_SET_PARAM:
return set_param(esm, data);
}
return -ENOTTY;

View File

@@ -30,7 +30,7 @@
/* need update the version when update firmware */
#define ESM_VERSION "2.4.84.11.D3"
#define HDCP_RX22_VER "HDCP2.2 RX190104"
#define HDCP_RX22_VER "HDCP2.2 RX0719"
#define ESM_HL_DRIVER_SUCCESS 0
#define ESM_HL_DRIVER_FAILED (-1)
@@ -51,6 +51,8 @@ enum {
ESM_NR_MEMSET_DATA,
ESM_NR_READ_HPI,
ESM_NR_WRITE_HPI,
ESM_NR_GET_PARAM,
ESM_NR_SET_PARAM,
ESM_NR_MAX
};
@@ -141,4 +143,26 @@ struct esm_ioc_hpi_reg {
__u32 offset;
__u32 value;
};
/*
* to reduce cpu occupancy rate,use ioctl instead of sysfs
* amlogic added
*/
#define ESM_IOC_GET_PARAM _IOR('E', ESM_NR_GET_PARAM, struct esm_ioc_param)
#define ESM_IOC_SET_PARAM _IOW('E', ESM_NR_SET_PARAM, struct esm_ioc_param)
struct esm_ioc_param {
bool hpd;
bool video_stable;
bool pwr_sts;
bool log;
bool esm_reset;
bool reauth;
bool esm_err;
bool auth_stop;
bool esm_reset2;
bool esm_kill;
__u32 reset_mode;
};
#endif

View File

@@ -41,7 +41,7 @@
*
*
*/
#define RX_VER1 "ver.2019/07/08"
#define RX_VER1 "ver.2019/07/19"
/*
*
*
@@ -515,6 +515,16 @@ extern int sm_pause;
extern int suspend_pddq_sel;
extern int disable_port_num;
extern int disable_port_en;
extern bool video_stable_to_esm;
extern bool pwr_sts_to_esm;
extern bool enable_hdcp22_esm_log;
extern bool esm_reset_flag;
extern bool esm_auth_fail_en;
extern bool esm_error_flag;
extern bool hdcp22_stop_auth;
extern bool hdcp22_esm_reset2;
extern int esm_recovery_mode;
extern int rx_set_global_variable(const char *buf, int size);
extern void rx_get_global_variable(const char *buf);
extern int rx_pr(const char *fmt, ...);

View File

@@ -125,8 +125,6 @@ static int wait_no_sig_max = 600;
/* to inform ESM whether the cable is connected or not */
bool hpd_to_esm;
MODULE_PARM_DESC(hpd_to_esm, "\n hpd_to_esm\n");
module_param(hpd_to_esm, bool, 0664);
bool hdcp22_kill_esm;
MODULE_PARM_DESC(hdcp22_kill_esm, "\n hdcp22_kill_esm\n");
@@ -134,54 +132,33 @@ module_param(hdcp22_kill_esm, bool, 0664);
static int hdcp22_capable_sts = 0xff;
static bool esm_auth_fail_en;
MODULE_PARM_DESC(esm_auth_fail_en, "\n esm_auth_fail_en\n");
module_param(esm_auth_fail_en, bool, 0664);
bool esm_auth_fail_en;
static bool hdcp_mode_sel;
MODULE_PARM_DESC(hdcp_mode_sel, "\n hdcp_mode_sel\n");
module_param(hdcp_mode_sel, bool, 0664);
/* to inform hdcp_rx22 whether there's any device connected */
bool pwr_sts_to_esm;
static int hdcp22_auth_sts = 0xff;
/*the esm reset flag for hdcp_rx22*/
static bool esm_reset_flag;
MODULE_PARM_DESC(esm_reset_flag, "\n esm_reset_flag\n");
module_param(esm_reset_flag, bool, 0664);
bool esm_reset_flag;
/* to inform ESM whether the cable is connected or not */
static bool video_stable_to_esm;
MODULE_PARM_DESC(video_stable_to_esm, "\n video_stable_to_esm\n");
module_param(video_stable_to_esm, bool, 0664);
bool video_stable_to_esm;
static int enable_hdcp22_esm_log;
MODULE_PARM_DESC(enable_hdcp22_esm_log, "\n enable_hdcp22_esm_log\n");
module_param(enable_hdcp22_esm_log, int, 0664);
bool enable_hdcp22_esm_log;
static bool esm_error_flag;
MODULE_PARM_DESC(esm_error_flag, "\n esm_error_flag\n");
module_param(esm_error_flag, bool, 0664);
bool esm_error_flag;
static bool hdcp22_esm_reset2;
MODULE_PARM_DESC(hdcp22_esm_reset2, "\n hdcp22_esm_reset2\n");
module_param(hdcp22_esm_reset2, bool, 0664);
bool hdcp22_esm_reset2;
static bool hdcp22_stop_auth;
module_param(hdcp22_stop_auth, bool, 0664);
MODULE_PARM_DESC(hdcp22_stop_auth, "hdcp22_stop_auth");
static bool mute_kill_en;
MODULE_PARM_DESC(mute_kill_en, "\n mute_kill_en\n");
module_param(mute_kill_en, bool, 0664);
bool hdcp22_stop_auth;
int hdcp14_on;
MODULE_PARM_DESC(hdcp14_on, "\n hdcp14_on\n");
module_param(hdcp14_on, int, 0664);
/*esm recovery mode for changing resolution & hdmi2.0*/
static int esm_recovery_mode = ESM_REC_MODE_TMDS;
module_param(esm_recovery_mode, int, 0664);
MODULE_PARM_DESC(esm_recovery_mode, "esm_recovery_mode");
int esm_recovery_mode = ESM_REC_MODE_TMDS;
int phy_retry_times = 1;
/* No need to judge frame rate while checking timing stable,as there are
@@ -1556,10 +1533,8 @@ int rx_set_global_variable(const char *buf, int size)
return pr_var(aud_sr_stb_max, index);
if (set_pr_var(tmpbuf, hdcp22_kill_esm, value, &index, ret))
return pr_var(hdcp22_kill_esm, index);
if (set_pr_var(tmpbuf, mute_kill_en, value, &index, ret))
return pr_var(mute_kill_en, index);
if (set_pr_var(tmpbuf, hdcp_mode_sel, value, &index, ret))
return pr_var(hdcp_mode_sel, index);
if (set_pr_var(tmpbuf, pwr_sts_to_esm, value, &index, ret))
return pr_var(pwr_sts_to_esm, index);
if (set_pr_var(tmpbuf, audio_sample_rate, value, &index, ret))
return pr_var(audio_sample_rate, index);
if (set_pr_var(tmpbuf, auds_rcv_sts, value, &index, ret))
@@ -1758,8 +1733,7 @@ void rx_get_global_variable(const char *buf)
pr_var(force_vic, i++);
pr_var(aud_sr_stb_max, i++);
pr_var(hdcp22_kill_esm, i++);
pr_var(mute_kill_en, i++);
pr_var(hdcp_mode_sel, i++);
pr_var(pwr_sts_to_esm, i++);
pr_var(audio_sample_rate, i++);
pr_var(auds_rcv_sts, i++);
pr_var(audio_coding_type, i++);
@@ -1993,9 +1967,9 @@ void rx_5v_monitor(void)
/* inform hdcp_rx22 the 5v sts of rx */
if (hdcp22_on) {
if (!pwr_sts)
hdcp_mode_sel = true;
pwr_sts_to_esm = true;
else
hdcp_mode_sel = false;
pwr_sts_to_esm = false;
}
}