Merge "msm: mdss: dp: add connected sysfs node"
This commit is contained in:
commit
fffab8aac5
9 changed files with 340 additions and 144 deletions
|
@ -43,6 +43,7 @@ obj-$(CONFIG_FB_MSM_MDSS) += mdss_hdmi_util.o
|
|||
obj-$(CONFIG_FB_MSM_MDSS) += mdss_hdmi_edid.o
|
||||
obj-$(CONFIG_FB_MSM_MDSS) += mdss_cec_core.o
|
||||
obj-$(CONFIG_FB_MSM_MDSS) += mdss_dba_utils.o
|
||||
obj-$(CONFIG_FB_MSM_MDSS) += mdss_hdcp_1x.o
|
||||
obj-$(CONFIG_FB_MSM_MDSS_DP_PANEL) += mdss_dp.o mdss_dp_util.o
|
||||
obj-$(CONFIG_FB_MSM_MDSS_DP_PANEL) += mdss_dp_aux.o
|
||||
|
||||
|
@ -50,7 +51,6 @@ obj-$(CONFIG_FB_MSM_MDSS) += mdss_io_util.o
|
|||
obj-$(CONFIG_FB_MSM_MDSS) += msm_ext_display.o
|
||||
obj-$(CONFIG_FB_MSM_MDSS_HDMI_PANEL) += mdss_hdmi_tx.o
|
||||
obj-$(CONFIG_FB_MSM_MDSS_HDMI_PANEL) += mdss_hdmi_panel.o
|
||||
obj-$(CONFIG_FB_MSM_MDSS_HDMI_PANEL) += mdss_hdmi_hdcp.o
|
||||
obj-$(CONFIG_FB_MSM_MDSS_HDMI_PANEL) += mdss_hdmi_hdcp2p2.o
|
||||
obj-$(CONFIG_FB_MSM_MDSS_HDMI_PANEL) += mdss_hdmi_cec.o
|
||||
obj-$(CONFIG_FB_MSM_MDSS_HDMI_PANEL) += mdss_hdmi_audio.o
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include "mdss_dp.h"
|
||||
#include "mdss_dp_util.h"
|
||||
#include "mdss_hdmi_panel.h"
|
||||
#include <linux/hdcp_qseecom.h>
|
||||
#include "mdss_hdcp_1x.h"
|
||||
#include "mdss_debug.h"
|
||||
|
||||
#define RGB_COMPONENTS 3
|
||||
|
@ -982,6 +984,8 @@ int mdss_dp_on(struct mdss_panel_data *pdata)
|
|||
if (mdss_dp_mainlink_ready(dp_drv, BIT(0)))
|
||||
pr_debug("mainlink ready\n");
|
||||
|
||||
dp_drv->power_on = true;
|
||||
|
||||
mutex_unlock(&dp_drv->host_mutex);
|
||||
pr_debug("End-\n");
|
||||
|
||||
|
@ -1031,6 +1035,7 @@ int mdss_dp_off(struct mdss_panel_data *pdata)
|
|||
pr_debug("End--: state_ctrl=%x\n",
|
||||
dp_read(dp_drv->base + DP_STATE_CTRL));
|
||||
|
||||
dp_drv->power_on = false;
|
||||
mutex_unlock(&dp_drv->train_mutex);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1214,12 +1219,168 @@ end:
|
|||
return rc;
|
||||
}
|
||||
|
||||
static void mdss_dp_hdcp_cb(void *ptr, enum hdcp_states status)
|
||||
{
|
||||
struct mdss_dp_drv_pdata *dp = ptr;
|
||||
struct hdcp_ops *ops;
|
||||
int rc = 0;
|
||||
|
||||
if (!dp) {
|
||||
pr_debug("invalid input\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ops = dp->hdcp_ops;
|
||||
|
||||
mutex_lock(&dp->train_mutex);
|
||||
|
||||
switch (status) {
|
||||
case HDCP_STATE_AUTHENTICATED:
|
||||
pr_debug("hdcp 1.3 authenticated\n");
|
||||
break;
|
||||
case HDCP_STATE_AUTH_FAIL:
|
||||
if (dp->power_on) {
|
||||
pr_debug("Reauthenticating\n");
|
||||
if (ops && ops->reauthenticate) {
|
||||
rc = ops->reauthenticate(dp->hdcp_data);
|
||||
if (rc)
|
||||
pr_err("HDCP reauth failed. rc=%d\n",
|
||||
rc);
|
||||
}
|
||||
} else {
|
||||
pr_debug("not reauthenticating, cable disconnected\n");
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
mutex_unlock(&dp->train_mutex);
|
||||
}
|
||||
|
||||
static int mdss_dp_hdcp_init(struct mdss_panel_data *pdata)
|
||||
{
|
||||
struct hdcp_init_data hdcp_init_data = {0};
|
||||
struct mdss_dp_drv_pdata *dp_drv = NULL;
|
||||
struct resource *res;
|
||||
int rc = 0;
|
||||
|
||||
if (!pdata) {
|
||||
pr_err("Invalid input data\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
dp_drv = container_of(pdata, struct mdss_dp_drv_pdata,
|
||||
panel_data);
|
||||
|
||||
res = platform_get_resource_byname(dp_drv->pdev,
|
||||
IORESOURCE_MEM, "dp_ctrl");
|
||||
if (!res) {
|
||||
pr_err("Error getting dp ctrl resource\n");
|
||||
rc = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
hdcp_init_data.phy_addr = res->start;
|
||||
hdcp_init_data.core_io = &dp_drv->ctrl_io;
|
||||
hdcp_init_data.qfprom_io = &dp_drv->qfprom_io;
|
||||
hdcp_init_data.hdcp_io = &dp_drv->hdcp_io;
|
||||
hdcp_init_data.mutex = &dp_drv->hdcp_mutex;
|
||||
hdcp_init_data.sysfs_kobj = dp_drv->kobj;
|
||||
hdcp_init_data.workq = dp_drv->workq;
|
||||
hdcp_init_data.notify_status = mdss_dp_hdcp_cb;
|
||||
hdcp_init_data.cb_data = (void *)dp_drv;
|
||||
hdcp_init_data.sec_access = true;
|
||||
hdcp_init_data.client_id = HDCP_CLIENT_DP;
|
||||
|
||||
dp_drv->hdcp_data = hdcp_1x_init(&hdcp_init_data);
|
||||
if (IS_ERR_OR_NULL(dp_drv->hdcp_data)) {
|
||||
pr_err("Error hdcp init\n");
|
||||
rc = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
pr_debug("HDCP 1.3 initialized\n");
|
||||
|
||||
dp_drv->hdcp_ops = hdcp_1x_start(dp_drv->hdcp_data);
|
||||
|
||||
return 0;
|
||||
error:
|
||||
return rc;
|
||||
}
|
||||
|
||||
static struct mdss_dp_drv_pdata *mdss_dp_get_drvdata(struct device *device)
|
||||
{
|
||||
struct msm_fb_data_type *mfd;
|
||||
struct mdss_panel_data *pd;
|
||||
struct mdss_dp_drv_pdata *dp = NULL;
|
||||
struct fb_info *fbi = dev_get_drvdata(device);
|
||||
|
||||
if (fbi) {
|
||||
mfd = (struct msm_fb_data_type *)fbi->par;
|
||||
pd = dev_get_platdata(&mfd->pdev->dev);
|
||||
|
||||
dp = container_of(pd, struct mdss_dp_drv_pdata, panel_data);
|
||||
}
|
||||
|
||||
return dp;
|
||||
}
|
||||
|
||||
static ssize_t mdss_dp_rda_connected(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
ssize_t ret;
|
||||
struct mdss_dp_drv_pdata *dp = mdss_dp_get_drvdata(dev);
|
||||
|
||||
if (!dp)
|
||||
return -EINVAL;
|
||||
|
||||
ret = snprintf(buf, PAGE_SIZE, "%d\n", dp->cable_connected);
|
||||
pr_debug("%d\n", dp->cable_connected);
|
||||
|
||||
return ret;
|
||||
}
|
||||
static DEVICE_ATTR(connected, S_IRUGO, mdss_dp_rda_connected, NULL);
|
||||
|
||||
static struct attribute *mdss_dp_fs_attrs[] = {
|
||||
&dev_attr_connected.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct attribute_group mdss_dp_fs_attrs_group = {
|
||||
.attrs = mdss_dp_fs_attrs,
|
||||
};
|
||||
|
||||
static int mdss_dp_sysfs_create(struct mdss_dp_drv_pdata *dp,
|
||||
struct fb_info *fbi)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (!dp || !fbi) {
|
||||
pr_err("ivalid input\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
rc = sysfs_create_group(&fbi->dev->kobj,
|
||||
&mdss_dp_fs_attrs_group);
|
||||
if (rc) {
|
||||
pr_err("failed, rc=%d\n", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
pr_debug("sysfs ceated\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mdss_dp_event_handler(struct mdss_panel_data *pdata,
|
||||
int event, void *arg)
|
||||
{
|
||||
int rc = 0;
|
||||
struct fb_info *fbi;
|
||||
struct mdss_dp_drv_pdata *dp = NULL;
|
||||
struct hdcp_ops *ops;
|
||||
|
||||
if (!pdata) {
|
||||
pr_err("%s: Invalid input data\n", __func__);
|
||||
|
@ -1231,13 +1392,25 @@ static int mdss_dp_event_handler(struct mdss_panel_data *pdata,
|
|||
dp = container_of(pdata, struct mdss_dp_drv_pdata,
|
||||
panel_data);
|
||||
|
||||
ops = dp->hdcp_ops;
|
||||
|
||||
switch (event) {
|
||||
case MDSS_EVENT_UNBLANK:
|
||||
rc = mdss_dp_on(pdata);
|
||||
break;
|
||||
case MDSS_EVENT_PANEL_ON:
|
||||
if (hdcp1_check_if_supported_load_app()) {
|
||||
if (ops && ops->authenticate)
|
||||
rc = ops->authenticate(dp->hdcp_data);
|
||||
}
|
||||
break;
|
||||
case MDSS_EVENT_PANEL_OFF:
|
||||
rc = mdss_dp_off(pdata);
|
||||
break;
|
||||
case MDSS_EVENT_BLANK:
|
||||
if (ops && ops->off)
|
||||
ops->off(dp->hdcp_data);
|
||||
break;
|
||||
case MDSS_EVENT_FB_REGISTERED:
|
||||
fbi = (struct fb_info *)arg;
|
||||
if (!fbi || !fbi->dev)
|
||||
|
@ -1245,7 +1418,9 @@ static int mdss_dp_event_handler(struct mdss_panel_data *pdata,
|
|||
|
||||
dp->kobj = &fbi->dev->kobj;
|
||||
dp->fb_node = fbi->node;
|
||||
mdss_dp_sysfs_create(dp, fbi);
|
||||
mdss_dp_edid_init(pdata);
|
||||
mdss_dp_hdcp_init(pdata);
|
||||
mdss_dp_register_switch_event(dp);
|
||||
break;
|
||||
case MDSS_EVENT_CHECK_PARAMS:
|
||||
|
@ -1339,6 +1514,14 @@ static int mdss_retrieve_dp_ctrl_resources(struct platform_device *pdev,
|
|||
return rc;
|
||||
}
|
||||
|
||||
if (msm_dss_ioremap_byname(pdev, &dp_drv->qfprom_io,
|
||||
"qfprom_physical"))
|
||||
pr_warn("unable to remap dp qfprom resources\n");
|
||||
|
||||
if (msm_dss_ioremap_byname(pdev, &dp_drv->hdcp_io,
|
||||
"hdcp_physical"))
|
||||
pr_warn("unable to remap dp hdcp resources\n");
|
||||
|
||||
pr_debug("DP Driver base=%p size=%x\n",
|
||||
dp_drv->base, dp_drv->base_size);
|
||||
|
||||
|
@ -1501,6 +1684,11 @@ irqreturn_t dp_isr(int irq, void *ptr)
|
|||
dp_aux_native_handler(dp, isr1);
|
||||
}
|
||||
|
||||
if (dp->hdcp_ops && dp->hdcp_ops->isr) {
|
||||
if (dp->hdcp_ops->isr(dp->hdcp_data))
|
||||
pr_err("dp_hdcp_isr failed\n");
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
|
@ -1723,6 +1911,7 @@ static int mdss_dp_probe(struct platform_device *pdev)
|
|||
mutex_init(&dp_drv->emutex);
|
||||
mutex_init(&dp_drv->host_mutex);
|
||||
mutex_init(&dp_drv->pd_msg_mutex);
|
||||
mutex_init(&dp_drv->hdcp_mutex);
|
||||
spin_lock_init(&dp_drv->lock);
|
||||
|
||||
if (mdss_dp_usbpd_setup(dp_drv)) {
|
||||
|
|
|
@ -345,12 +345,15 @@ struct mdss_dp_drv_pdata {
|
|||
bool core_power;
|
||||
bool core_clks_on;
|
||||
bool link_clks_on;
|
||||
bool power_on;
|
||||
|
||||
/* dp specific */
|
||||
unsigned char *base;
|
||||
struct dss_io_data ctrl_io;
|
||||
struct dss_io_data phy_io;
|
||||
struct dss_io_data tcsr_reg_io;
|
||||
struct dss_io_data qfprom_io;
|
||||
struct dss_io_data hdcp_io;
|
||||
int base_size;
|
||||
unsigned char *mmss_cc_base;
|
||||
u32 mask1;
|
||||
|
@ -397,6 +400,7 @@ struct mdss_dp_drv_pdata {
|
|||
struct mutex train_mutex;
|
||||
struct mutex host_mutex;
|
||||
struct mutex pd_msg_mutex;
|
||||
struct mutex hdcp_mutex;
|
||||
bool cable_connected;
|
||||
u32 aux_cmd_busy;
|
||||
u32 aux_cmd_i2c;
|
||||
|
@ -430,6 +434,9 @@ struct mdss_dp_drv_pdata {
|
|||
u32 vic;
|
||||
u32 new_vic;
|
||||
int fb_node;
|
||||
|
||||
void *hdcp_data;
|
||||
struct hdcp_ops *hdcp_ops;
|
||||
};
|
||||
|
||||
static inline const char *__mdss_dp_pm_name(enum dp_pm_type module)
|
||||
|
|
|
@ -355,7 +355,7 @@ static int dp_aux_write_buf(struct mdss_dp_drv_pdata *ep, u32 addr,
|
|||
static int dp_aux_read_buf(struct mdss_dp_drv_pdata *ep, u32 addr,
|
||||
int len, int i2c)
|
||||
{
|
||||
struct edp_cmd cmd;
|
||||
struct edp_cmd cmd = {0};
|
||||
|
||||
cmd.read = 1;
|
||||
cmd.i2c = i2c;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <linux/iopoll.h>
|
||||
#include <soc/qcom/scm.h>
|
||||
#include <linux/hdcp_qseecom.h>
|
||||
#include "mdss_hdmi_hdcp.h"
|
||||
#include "mdss_hdcp_1x.h"
|
||||
#include "mdss_dp_util.h"
|
||||
#include "video/msm_hdmi_hdcp_mgr.h"
|
||||
|
||||
|
@ -60,7 +60,7 @@ struct hdcp_sink_addr {
|
|||
u32 len;
|
||||
};
|
||||
|
||||
struct hdmi_hdcp_reg_data {
|
||||
struct hdcp_1x_reg_data {
|
||||
u32 reg_id;
|
||||
struct hdcp_sink_addr *sink;
|
||||
};
|
||||
|
@ -220,24 +220,24 @@ struct hdcp_reg_set {
|
|||
BIT(16), BIT(19), BIT(21), BIT(23), BIT(26), 0, 0, \
|
||||
BIT(15), BIT(18), BIT(22), BIT(25), 0, 0}
|
||||
|
||||
struct hdmi_hdcp_ctrl {
|
||||
struct hdcp_1x_ctrl {
|
||||
u32 auth_retries;
|
||||
u32 tp_msgid;
|
||||
u32 tz_hdcp;
|
||||
enum hdmi_hdcp_state hdcp_state;
|
||||
enum hdcp_states hdcp_state;
|
||||
struct HDCP_V2V1_MSG_TOPOLOGY cached_tp;
|
||||
struct HDCP_V2V1_MSG_TOPOLOGY current_tp;
|
||||
struct delayed_work hdcp_auth_work;
|
||||
struct work_struct hdcp_int_work;
|
||||
struct completion r0_checked;
|
||||
struct hdmi_hdcp_init_data init_data;
|
||||
struct hdmi_hdcp_ops *ops;
|
||||
struct hdcp_init_data init_data;
|
||||
struct hdcp_ops *ops;
|
||||
struct hdcp_reg_set reg_set;
|
||||
struct hdcp_int_set int_set;
|
||||
struct hdcp_sink_addr_map sink_addr;
|
||||
};
|
||||
|
||||
const char *hdcp_state_name(enum hdmi_hdcp_state hdcp_state)
|
||||
const char *hdcp_state_name(enum hdcp_states hdcp_state)
|
||||
{
|
||||
switch (hdcp_state) {
|
||||
case HDCP_STATE_INACTIVE: return "HDCP_STATE_INACTIVE";
|
||||
|
@ -248,16 +248,16 @@ const char *hdcp_state_name(enum hdmi_hdcp_state hdcp_state)
|
|||
}
|
||||
} /* hdcp_state_name */
|
||||
|
||||
static int hdmi_hdcp_count_one(u8 *array, u8 len)
|
||||
static int hdcp_1x_count_one(u8 *array, u8 len)
|
||||
{
|
||||
int i, j, count = 0;
|
||||
for (i = 0; i < len; i++)
|
||||
for (j = 0; j < 8; j++)
|
||||
count += (((array[i] >> j) & 0x1) ? 1 : 0);
|
||||
return count;
|
||||
} /* hdmi_hdcp_count_one */
|
||||
} /* hdcp_1x_count_one */
|
||||
|
||||
static void reset_hdcp_ddc_failures(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
||||
static void reset_hdcp_ddc_failures(struct hdcp_1x_ctrl *hdcp_ctrl)
|
||||
{
|
||||
int hdcp_ddc_ctrl1_reg;
|
||||
int hdcp_ddc_status;
|
||||
|
@ -340,7 +340,7 @@ static void reset_hdcp_ddc_failures(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
|||
__func__, HDCP_STATE_NAME, hdcp_ddc_status, failure, nack0);
|
||||
} /* reset_hdcp_ddc_failures */
|
||||
|
||||
static void hdmi_hdcp_hw_ddc_clean(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
||||
static void hdcp_1x_hw_ddc_clean(struct hdcp_1x_ctrl *hdcp_ctrl)
|
||||
{
|
||||
struct dss_io_data *io = NULL;
|
||||
u32 hdcp_ddc_status, ddc_hw_status;
|
||||
|
@ -387,7 +387,7 @@ static void hdmi_hdcp_hw_ddc_clean(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
|||
if (ddc_hw_not_ready)
|
||||
msleep(20);
|
||||
} while (ddc_hw_not_ready && --timeout_count);
|
||||
} /* hdmi_hdcp_hw_ddc_clean */
|
||||
} /* hdcp_1x_hw_ddc_clean */
|
||||
|
||||
static int hdcp_scm_call(struct scm_hdcp_req *req, u32 *resp)
|
||||
{
|
||||
|
@ -422,7 +422,7 @@ static int hdcp_scm_call(struct scm_hdcp_req *req, u32 *resp)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int hdmi_hdcp_load_keys(void *input)
|
||||
static int hdcp_1x_load_keys(void *input)
|
||||
{
|
||||
int rc = 0;
|
||||
bool use_sw_keys = false;
|
||||
|
@ -432,7 +432,7 @@ static int hdmi_hdcp_load_keys(void *input)
|
|||
u8 aksv[5];
|
||||
struct dss_io_data *io;
|
||||
struct dss_io_data *qfprom_io;
|
||||
struct hdmi_hdcp_ctrl *hdcp_ctrl = input;
|
||||
struct hdcp_1x_ctrl *hdcp_ctrl = input;
|
||||
struct hdcp_reg_set *reg_set;
|
||||
|
||||
if (!hdcp_ctrl || !hdcp_ctrl->init_data.core_io ||
|
||||
|
@ -495,7 +495,7 @@ static int hdmi_hdcp_load_keys(void *input)
|
|||
aksv[4] = aksv_msb & 0xFF;
|
||||
|
||||
/* check there are 20 ones in AKSV */
|
||||
if (hdmi_hdcp_count_one(aksv, 5) != 20) {
|
||||
if (hdcp_1x_count_one(aksv, 5) != 20) {
|
||||
DEV_ERR("%s: AKSV bit count failed\n", __func__);
|
||||
rc = -EINVAL;
|
||||
goto end;
|
||||
|
@ -519,7 +519,7 @@ end:
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int hdmi_hdcp_read(struct hdmi_hdcp_ctrl *hdcp_ctrl,
|
||||
static int hdcp_1x_read(struct hdcp_1x_ctrl *hdcp_ctrl,
|
||||
struct hdcp_sink_addr *sink,
|
||||
u8 *buf, bool realign)
|
||||
{
|
||||
|
@ -563,7 +563,7 @@ static int hdmi_hdcp_read(struct hdmi_hdcp_ctrl *hdcp_ctrl,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int hdmi_hdcp_write(struct hdmi_hdcp_ctrl *hdcp_ctrl,
|
||||
static int hdcp_1x_write(struct hdcp_1x_ctrl *hdcp_ctrl,
|
||||
u32 offset, u32 len, u8 *buf, char *name)
|
||||
{
|
||||
int rc = 0;
|
||||
|
@ -600,7 +600,7 @@ static int hdmi_hdcp_write(struct hdmi_hdcp_ctrl *hdcp_ctrl,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static void hdmi_hdcp_enable_interrupts(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
||||
static void hdcp_1x_enable_interrupts(struct hdcp_1x_ctrl *hdcp_ctrl)
|
||||
{
|
||||
u32 intr_reg;
|
||||
struct dss_io_data *io;
|
||||
|
@ -616,7 +616,7 @@ static void hdmi_hdcp_enable_interrupts(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
|||
DSS_REG_W(io, isr->int_reg, intr_reg);
|
||||
}
|
||||
|
||||
static int hdmi_hdcp_authentication_part1(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
||||
static int hdcp_1x_authentication_part1(struct hdcp_1x_ctrl *hdcp_ctrl)
|
||||
{
|
||||
int rc;
|
||||
u32 link0_aksv_0, link0_aksv_1;
|
||||
|
@ -629,7 +629,7 @@ static int hdmi_hdcp_authentication_part1(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
|||
struct hdcp_reg_set *reg_set;
|
||||
u8 aksv[5], *bksv = NULL;
|
||||
u8 an[8];
|
||||
u8 bcaps;
|
||||
u8 bcaps = 0;
|
||||
u32 link0_status;
|
||||
u8 buf[0xFF];
|
||||
struct scm_hdcp_req scm_buf[SCM_HDCP_MAX_REG];
|
||||
|
@ -657,14 +657,14 @@ static int hdmi_hdcp_authentication_part1(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
|||
goto error;
|
||||
}
|
||||
|
||||
rc = hdmi_hdcp_read(hdcp_ctrl, &hdcp_ctrl->sink_addr.bcaps,
|
||||
rc = hdcp_1x_read(hdcp_ctrl, &hdcp_ctrl->sink_addr.bcaps,
|
||||
&bcaps, false);
|
||||
if (IS_ERR_VALUE(rc)) {
|
||||
DEV_ERR("%s: error reading bcaps\n", __func__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
hdmi_hdcp_enable_interrupts(hdcp_ctrl);
|
||||
hdcp_1x_enable_interrupts(hdcp_ctrl);
|
||||
|
||||
/* receiver (0), repeater (1) */
|
||||
hdcp_ctrl->current_tp.ds_type =
|
||||
|
@ -754,26 +754,26 @@ static int hdmi_hdcp_authentication_part1(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
|||
an[6] = (link0_an_1 >> 16) & 0xFF;
|
||||
an[7] = (link0_an_1 >> 24) & 0xFF;
|
||||
|
||||
rc = hdmi_hdcp_write(hdcp_ctrl, 0x18, 8, an, "an");
|
||||
rc = hdcp_1x_write(hdcp_ctrl, 0x18, 8, an, "an");
|
||||
if (IS_ERR_VALUE(rc)) {
|
||||
DEV_ERR("%s: error writing an to sink\n", __func__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
rc = hdmi_hdcp_write(hdcp_ctrl, 0x10, 5, aksv, "aksv");
|
||||
rc = hdcp_1x_write(hdcp_ctrl, 0x10, 5, aksv, "aksv");
|
||||
if (IS_ERR_VALUE(rc)) {
|
||||
DEV_ERR("%s: error writing aksv to sink\n", __func__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
rc = hdmi_hdcp_read(hdcp_ctrl, &hdcp_ctrl->sink_addr.bksv, bksv, false);
|
||||
rc = hdcp_1x_read(hdcp_ctrl, &hdcp_ctrl->sink_addr.bksv, bksv, false);
|
||||
if (IS_ERR_VALUE(rc)) {
|
||||
DEV_ERR("%s: error reading bksv from sink\n", __func__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* check there are 20 ones in BKSV */
|
||||
if (hdmi_hdcp_count_one(bksv, 5) != 20) {
|
||||
if (hdcp_1x_count_one(bksv, 5) != 20) {
|
||||
DEV_ERR("%s: %s: BKSV doesn't have 20 1's and 20 0's\n",
|
||||
__func__, HDCP_STATE_NAME);
|
||||
DEV_ERR("%s: %s: BKSV chk fail. BKSV=%02x%02x%02x%02x%02x\n",
|
||||
|
@ -831,7 +831,7 @@ static int hdmi_hdcp_authentication_part1(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
|||
}
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
rc = hdmi_hdcp_read(hdcp_ctrl, &hdcp_ctrl->sink_addr.r0, buf, false);
|
||||
rc = hdcp_1x_read(hdcp_ctrl, &hdcp_ctrl->sink_addr.r0, buf, false);
|
||||
if (IS_ERR_VALUE(rc)) {
|
||||
DEV_ERR("%s: error reading R0' from sink\n", __func__);
|
||||
goto error;
|
||||
|
@ -873,10 +873,10 @@ error:
|
|||
DEV_INFO("%s: %s: Authentication Part I successful\n",
|
||||
__func__, HDCP_STATE_NAME);
|
||||
return rc;
|
||||
} /* hdmi_hdcp_authentication_part1 */
|
||||
} /* hdcp_1x_authentication_part1 */
|
||||
|
||||
static int hdmi_hdcp_set_v_h(struct hdmi_hdcp_ctrl *hdcp_ctrl,
|
||||
struct hdmi_hdcp_reg_data *rd, u8 *buf)
|
||||
static int hdcp_1x_set_v_h(struct hdcp_1x_ctrl *hdcp_ctrl,
|
||||
struct hdcp_1x_reg_data *rd, u8 *buf)
|
||||
{
|
||||
int rc;
|
||||
struct dss_io_data *io;
|
||||
|
@ -886,7 +886,7 @@ static int hdmi_hdcp_set_v_h(struct hdmi_hdcp_ctrl *hdcp_ctrl,
|
|||
else
|
||||
io = hdcp_ctrl->init_data.core_io;
|
||||
|
||||
rc = hdmi_hdcp_read(hdcp_ctrl, rd->sink, buf, false);
|
||||
rc = hdcp_1x_read(hdcp_ctrl, rd->sink, buf, false);
|
||||
if (IS_ERR_VALUE(rc)) {
|
||||
DEV_ERR("%s: error reading %s\n", __func__, rd->sink->name);
|
||||
goto end;
|
||||
|
@ -903,14 +903,14 @@ end:
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int hdmi_hdcp_transfer_v_h(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
||||
static int hdcp_1x_transfer_v_h(struct hdcp_1x_ctrl *hdcp_ctrl)
|
||||
{
|
||||
int rc = 0;
|
||||
u8 buf[4];
|
||||
struct scm_hdcp_req scm_buf[SCM_HDCP_MAX_REG];
|
||||
u32 phy_addr;
|
||||
struct hdcp_reg_set *reg_set = &hdcp_ctrl->reg_set;
|
||||
struct hdmi_hdcp_reg_data reg_data[] = {
|
||||
struct hdcp_1x_reg_data reg_data[] = {
|
||||
{reg_set_data(7), &hdcp_ctrl->sink_addr.v_h0},
|
||||
{reg_set_data(8), &hdcp_ctrl->sink_addr.v_h1},
|
||||
{reg_set_data(9), &hdcp_ctrl->sink_addr.v_h2},
|
||||
|
@ -925,10 +925,10 @@ static int hdmi_hdcp_transfer_v_h(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
|||
memset(scm_buf, 0x00, sizeof(scm_buf));
|
||||
|
||||
for (iter = 0; iter < size; iter++) {
|
||||
struct hdmi_hdcp_reg_data *rd = reg_data + iter;
|
||||
struct hdcp_1x_reg_data *rd = reg_data + iter;
|
||||
|
||||
memset(buf, 0, sizeof(buf));
|
||||
hdmi_hdcp_set_v_h(hdcp_ctrl, rd, buf);
|
||||
hdcp_1x_set_v_h(hdcp_ctrl, rd, buf);
|
||||
|
||||
if (hdcp_ctrl->tz_hdcp) {
|
||||
u32 reg_val = buf[3] << 24 | buf[2] << 16 |
|
||||
|
@ -950,7 +950,7 @@ error:
|
|||
return rc;
|
||||
}
|
||||
|
||||
static int hdmi_hdcp_authentication_part2(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
||||
static int hdcp_1x_authentication_part2(struct hdcp_1x_ctrl *hdcp_ctrl)
|
||||
{
|
||||
int rc, i;
|
||||
u32 timeout_count, down_stream_devices = 0;
|
||||
|
@ -998,7 +998,7 @@ static int hdmi_hdcp_authentication_part2(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
|||
*/
|
||||
timeout_count = 50;
|
||||
do {
|
||||
rc = hdmi_hdcp_read(hdcp_ctrl, &hdcp_ctrl->sink_addr.bcaps,
|
||||
rc = hdcp_1x_read(hdcp_ctrl, &hdcp_ctrl->sink_addr.bcaps,
|
||||
&bcaps, true);
|
||||
if (IS_ERR_VALUE(rc)) {
|
||||
DEV_ERR("%s: error reading bcaps\n", __func__);
|
||||
|
@ -1007,7 +1007,7 @@ static int hdmi_hdcp_authentication_part2(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
|||
msleep(100);
|
||||
} while (!(bcaps & BIT(5)) && --timeout_count);
|
||||
|
||||
rc = hdmi_hdcp_read(hdcp_ctrl, &hdcp_ctrl->sink_addr.bstatus,
|
||||
rc = hdcp_1x_read(hdcp_ctrl, &hdcp_ctrl->sink_addr.bstatus,
|
||||
buf, true);
|
||||
if (IS_ERR_VALUE(rc)) {
|
||||
DEV_ERR("%s: error reading bstatus\n", __func__);
|
||||
|
@ -1094,7 +1094,7 @@ static int hdmi_hdcp_authentication_part2(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
|||
hdcp_ctrl->sink_addr.ksv_fifo.len = ksv_bytes;
|
||||
|
||||
do {
|
||||
rc = hdmi_hdcp_read(hdcp_ctrl, &hdcp_ctrl->sink_addr.ksv_fifo,
|
||||
rc = hdcp_1x_read(hdcp_ctrl, &hdcp_ctrl->sink_addr.ksv_fifo,
|
||||
ksv_fifo, false);
|
||||
if (IS_ERR_VALUE(rc)) {
|
||||
DEV_DBG("%s: could not read ksv fifo (%d)\n",
|
||||
|
@ -1114,7 +1114,7 @@ static int hdmi_hdcp_authentication_part2(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
|||
goto error;
|
||||
}
|
||||
|
||||
rc = hdmi_hdcp_transfer_v_h(hdcp_ctrl);
|
||||
rc = hdcp_1x_transfer_v_h(hdcp_ctrl);
|
||||
if (rc)
|
||||
goto error;
|
||||
|
||||
|
@ -1252,9 +1252,9 @@ error:
|
|||
hdcp_ctrl->current_tp.depth = repeater_cascade_depth;
|
||||
|
||||
return rc;
|
||||
} /* hdmi_hdcp_authentication_part2 */
|
||||
} /* hdcp_1x_authentication_part2 */
|
||||
|
||||
static void hdmi_hdcp_cache_topology(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
||||
static void hdcp_1x_cache_topology(struct hdcp_1x_ctrl *hdcp_ctrl)
|
||||
{
|
||||
if (!hdcp_ctrl || !hdcp_ctrl->init_data.core_io) {
|
||||
DEV_ERR("%s: invalid input\n", __func__);
|
||||
|
@ -1266,7 +1266,7 @@ static void hdmi_hdcp_cache_topology(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
|||
sizeof(hdcp_ctrl->cached_tp));
|
||||
}
|
||||
|
||||
static void hdmi_hdcp_notify_topology(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
||||
static void hdcp_1x_notify_topology(struct hdcp_1x_ctrl *hdcp_ctrl)
|
||||
{
|
||||
char a[16], b[16];
|
||||
char *envp[] = {
|
||||
|
@ -1284,10 +1284,10 @@ static void hdmi_hdcp_notify_topology(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
|||
envp[0], envp[1], envp[2]);
|
||||
}
|
||||
|
||||
static void hdmi_hdcp_int_work(struct work_struct *work)
|
||||
static void hdcp_1x_int_work(struct work_struct *work)
|
||||
{
|
||||
struct hdmi_hdcp_ctrl *hdcp_ctrl = container_of(work,
|
||||
struct hdmi_hdcp_ctrl, hdcp_int_work);
|
||||
struct hdcp_1x_ctrl *hdcp_ctrl = container_of(work,
|
||||
struct hdcp_1x_ctrl, hdcp_int_work);
|
||||
|
||||
if (!hdcp_ctrl) {
|
||||
DEV_ERR("%s: invalid input\n", __func__);
|
||||
|
@ -1303,14 +1303,14 @@ static void hdmi_hdcp_int_work(struct work_struct *work)
|
|||
hdcp_ctrl->init_data.cb_data,
|
||||
hdcp_ctrl->hdcp_state);
|
||||
}
|
||||
} /* hdmi_hdcp_int_work */
|
||||
} /* hdcp_1x_int_work */
|
||||
|
||||
static void hdmi_hdcp_auth_work(struct work_struct *work)
|
||||
static void hdcp_1x_auth_work(struct work_struct *work)
|
||||
{
|
||||
int rc;
|
||||
struct delayed_work *dw = to_delayed_work(work);
|
||||
struct hdmi_hdcp_ctrl *hdcp_ctrl = container_of(dw,
|
||||
struct hdmi_hdcp_ctrl, hdcp_auth_work);
|
||||
struct hdcp_1x_ctrl *hdcp_ctrl = container_of(dw,
|
||||
struct hdcp_1x_ctrl, hdcp_auth_work);
|
||||
struct dss_io_data *io;
|
||||
|
||||
if (!hdcp_ctrl) {
|
||||
|
@ -1330,7 +1330,7 @@ static void hdmi_hdcp_auth_work(struct work_struct *work)
|
|||
DSS_REG_W_ND(io, HDMI_DDC_ARBITRATION, DSS_REG_R(io,
|
||||
HDMI_DDC_ARBITRATION) & ~(BIT(4)));
|
||||
|
||||
rc = hdmi_hdcp_authentication_part1(hdcp_ctrl);
|
||||
rc = hdcp_1x_authentication_part1(hdcp_ctrl);
|
||||
if (rc) {
|
||||
DEV_DBG("%s: %s: HDCP Auth Part I failed\n", __func__,
|
||||
HDCP_STATE_NAME);
|
||||
|
@ -1338,7 +1338,7 @@ static void hdmi_hdcp_auth_work(struct work_struct *work)
|
|||
}
|
||||
|
||||
if (hdcp_ctrl->current_tp.ds_type == DS_REPEATER) {
|
||||
rc = hdmi_hdcp_authentication_part2(hdcp_ctrl);
|
||||
rc = hdcp_1x_authentication_part2(hdcp_ctrl);
|
||||
if (rc) {
|
||||
DEV_DBG("%s: %s: HDCP Auth Part II failed\n", __func__,
|
||||
HDCP_STATE_NAME);
|
||||
|
@ -1367,8 +1367,8 @@ error:
|
|||
} else {
|
||||
hdcp_ctrl->hdcp_state = HDCP_STATE_AUTHENTICATED;
|
||||
hdcp_ctrl->auth_retries = 0;
|
||||
hdmi_hdcp_cache_topology(hdcp_ctrl);
|
||||
hdmi_hdcp_notify_topology(hdcp_ctrl);
|
||||
hdcp_1x_cache_topology(hdcp_ctrl);
|
||||
hdcp_1x_notify_topology(hdcp_ctrl);
|
||||
}
|
||||
mutex_unlock(hdcp_ctrl->init_data.mutex);
|
||||
|
||||
|
@ -1386,11 +1386,11 @@ error:
|
|||
mutex_unlock(hdcp_ctrl->init_data.mutex);
|
||||
}
|
||||
return;
|
||||
} /* hdmi_hdcp_auth_work */
|
||||
} /* hdcp_1x_auth_work */
|
||||
|
||||
int hdmi_hdcp_authenticate(void *input)
|
||||
int hdcp_1x_authenticate(void *input)
|
||||
{
|
||||
struct hdmi_hdcp_ctrl *hdcp_ctrl = (struct hdmi_hdcp_ctrl *)input;
|
||||
struct hdcp_1x_ctrl *hdcp_ctrl = (struct hdcp_1x_ctrl *)input;
|
||||
|
||||
if (!hdcp_ctrl) {
|
||||
DEV_ERR("%s: invalid input\n", __func__);
|
||||
|
@ -1406,7 +1406,7 @@ int hdmi_hdcp_authenticate(void *input)
|
|||
DEV_DBG("%s: %s: Queuing work to start HDCP authentication", __func__,
|
||||
HDCP_STATE_NAME);
|
||||
|
||||
if (!hdmi_hdcp_load_keys(input)) {
|
||||
if (!hdcp_1x_load_keys(input)) {
|
||||
flush_delayed_work(&hdcp_ctrl->hdcp_auth_work);
|
||||
|
||||
queue_delayed_work(hdcp_ctrl->init_data.workq,
|
||||
|
@ -1419,11 +1419,11 @@ int hdmi_hdcp_authenticate(void *input)
|
|||
}
|
||||
|
||||
return 0;
|
||||
} /* hdmi_hdcp_authenticate */
|
||||
} /* hdcp_1x_authenticate */
|
||||
|
||||
int hdmi_hdcp_reauthenticate(void *input)
|
||||
int hdcp_1x_reauthenticate(void *input)
|
||||
{
|
||||
struct hdmi_hdcp_ctrl *hdcp_ctrl = (struct hdmi_hdcp_ctrl *)input;
|
||||
struct hdcp_1x_ctrl *hdcp_ctrl = (struct hdcp_1x_ctrl *)input;
|
||||
struct dss_io_data *io;
|
||||
struct hdcp_reg_set *reg_set;
|
||||
struct hdcp_int_set *isr;
|
||||
|
@ -1453,7 +1453,7 @@ int hdmi_hdcp_reauthenticate(void *input)
|
|||
}
|
||||
|
||||
/* Wait to be clean on DDC HW engine */
|
||||
hdmi_hdcp_hw_ddc_clean(hdcp_ctrl);
|
||||
hdcp_1x_hw_ddc_clean(hdcp_ctrl);
|
||||
}
|
||||
|
||||
/* Disable HDCP interrupts */
|
||||
|
@ -1465,7 +1465,7 @@ int hdmi_hdcp_reauthenticate(void *input)
|
|||
/* Disable encryption and disable the HDCP block */
|
||||
DSS_REG_W(io, reg_set->ctrl, 0);
|
||||
|
||||
if (!hdmi_hdcp_load_keys(input))
|
||||
if (!hdcp_1x_load_keys(input))
|
||||
queue_delayed_work(hdcp_ctrl->init_data.workq,
|
||||
&hdcp_ctrl->hdcp_auth_work, HZ/2);
|
||||
else
|
||||
|
@ -1473,11 +1473,11 @@ int hdmi_hdcp_reauthenticate(void *input)
|
|||
&hdcp_ctrl->hdcp_int_work);
|
||||
|
||||
return ret;
|
||||
} /* hdmi_hdcp_reauthenticate */
|
||||
} /* hdcp_1x_reauthenticate */
|
||||
|
||||
void hdmi_hdcp_off(void *input)
|
||||
void hdcp_1x_off(void *input)
|
||||
{
|
||||
struct hdmi_hdcp_ctrl *hdcp_ctrl = (struct hdmi_hdcp_ctrl *)input;
|
||||
struct hdcp_1x_ctrl *hdcp_ctrl = (struct hdcp_1x_ctrl *)input;
|
||||
struct dss_io_data *io;
|
||||
struct hdcp_reg_set *reg_set;
|
||||
struct hdcp_int_set *isr;
|
||||
|
@ -1531,11 +1531,11 @@ void hdmi_hdcp_off(void *input)
|
|||
DSS_REG_W(io, reg_set->ctrl, 0);
|
||||
|
||||
DEV_DBG("%s: %s: HDCP: Off\n", __func__, HDCP_STATE_NAME);
|
||||
} /* hdmi_hdcp_off */
|
||||
} /* hdcp_1x_off */
|
||||
|
||||
int hdmi_hdcp_isr(void *input)
|
||||
int hdcp_1x_isr(void *input)
|
||||
{
|
||||
struct hdmi_hdcp_ctrl *hdcp_ctrl = (struct hdmi_hdcp_ctrl *)input;
|
||||
struct hdcp_1x_ctrl *hdcp_ctrl = (struct hdcp_1x_ctrl *)input;
|
||||
int rc = 0;
|
||||
struct dss_io_data *io;
|
||||
u32 hdcp_int_val;
|
||||
|
@ -1626,13 +1626,13 @@ int hdmi_hdcp_isr(void *input)
|
|||
|
||||
error:
|
||||
return rc;
|
||||
} /* hdmi_hdcp_isr */
|
||||
} /* hdcp_1x_isr */
|
||||
|
||||
static ssize_t hdmi_hdcp_sysfs_rda_status(struct device *dev,
|
||||
static ssize_t hdcp_1x_sysfs_rda_status(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
ssize_t ret;
|
||||
struct hdmi_hdcp_ctrl *hdcp_ctrl =
|
||||
struct hdcp_1x_ctrl *hdcp_ctrl =
|
||||
hdmi_get_featuredata_from_sysfs_dev(dev, HDMI_TX_FEAT_HDCP);
|
||||
|
||||
if (!hdcp_ctrl) {
|
||||
|
@ -1646,13 +1646,13 @@ static ssize_t hdmi_hdcp_sysfs_rda_status(struct device *dev,
|
|||
mutex_unlock(hdcp_ctrl->init_data.mutex);
|
||||
|
||||
return ret;
|
||||
} /* hdmi_hdcp_sysfs_rda_hdcp*/
|
||||
} /* hdcp_1x_sysfs_rda_hdcp*/
|
||||
|
||||
static ssize_t hdmi_hdcp_sysfs_rda_tp(struct device *dev,
|
||||
static ssize_t hdcp_1x_sysfs_rda_tp(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
ssize_t ret = 0;
|
||||
struct hdmi_hdcp_ctrl *hdcp_ctrl =
|
||||
struct hdcp_1x_ctrl *hdcp_ctrl =
|
||||
hdmi_get_featuredata_from_sysfs_dev(dev, HDMI_TX_FEAT_HDCP);
|
||||
|
||||
if (!hdcp_ctrl) {
|
||||
|
@ -1680,14 +1680,14 @@ static ssize_t hdmi_hdcp_sysfs_rda_tp(struct device *dev,
|
|||
}
|
||||
|
||||
return ret;
|
||||
} /* hdmi_hdcp_sysfs_rda_tp*/
|
||||
} /* hdcp_1x_sysfs_rda_tp*/
|
||||
|
||||
static ssize_t hdmi_hdcp_sysfs_wta_tp(struct device *dev,
|
||||
static ssize_t hdcp_1x_sysfs_wta_tp(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t count)
|
||||
{
|
||||
int msgid = 0;
|
||||
ssize_t ret = count;
|
||||
struct hdmi_hdcp_ctrl *hdcp_ctrl =
|
||||
struct hdcp_1x_ctrl *hdcp_ctrl =
|
||||
hdmi_get_featuredata_from_sysfs_dev(dev, HDMI_TX_FEAT_HDCP);
|
||||
|
||||
if (!hdcp_ctrl || !buf) {
|
||||
|
@ -1710,25 +1710,25 @@ static ssize_t hdmi_hdcp_sysfs_wta_tp(struct device *dev,
|
|||
return ret;
|
||||
} /* hdmi_tx_sysfs_wta_hpd */
|
||||
|
||||
static DEVICE_ATTR(status, S_IRUGO, hdmi_hdcp_sysfs_rda_status, NULL);
|
||||
static DEVICE_ATTR(tp, S_IRUGO | S_IWUSR, hdmi_hdcp_sysfs_rda_tp,
|
||||
hdmi_hdcp_sysfs_wta_tp);
|
||||
static DEVICE_ATTR(status, S_IRUGO, hdcp_1x_sysfs_rda_status, NULL);
|
||||
static DEVICE_ATTR(tp, S_IRUGO | S_IWUSR, hdcp_1x_sysfs_rda_tp,
|
||||
hdcp_1x_sysfs_wta_tp);
|
||||
|
||||
|
||||
static struct attribute *hdmi_hdcp_fs_attrs[] = {
|
||||
static struct attribute *hdcp_1x_fs_attrs[] = {
|
||||
&dev_attr_status.attr,
|
||||
&dev_attr_tp.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct attribute_group hdmi_hdcp_fs_attr_group = {
|
||||
static struct attribute_group hdcp_1x_fs_attr_group = {
|
||||
.name = "hdcp",
|
||||
.attrs = hdmi_hdcp_fs_attrs,
|
||||
.attrs = hdcp_1x_fs_attrs,
|
||||
};
|
||||
|
||||
void hdmi_hdcp_deinit(void *input)
|
||||
void hdcp_1x_deinit(void *input)
|
||||
{
|
||||
struct hdmi_hdcp_ctrl *hdcp_ctrl = (struct hdmi_hdcp_ctrl *)input;
|
||||
struct hdcp_1x_ctrl *hdcp_ctrl = (struct hdcp_1x_ctrl *)input;
|
||||
|
||||
if (!hdcp_ctrl) {
|
||||
DEV_ERR("%s: invalid input\n", __func__);
|
||||
|
@ -1736,12 +1736,12 @@ void hdmi_hdcp_deinit(void *input)
|
|||
}
|
||||
|
||||
sysfs_remove_group(hdcp_ctrl->init_data.sysfs_kobj,
|
||||
&hdmi_hdcp_fs_attr_group);
|
||||
&hdcp_1x_fs_attr_group);
|
||||
|
||||
kfree(hdcp_ctrl);
|
||||
} /* hdmi_hdcp_deinit */
|
||||
} /* hdcp_1x_deinit */
|
||||
|
||||
static void hdmi_hdcp_update_client_reg_set(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
||||
static void hdcp_1x_update_client_reg_set(struct hdcp_1x_ctrl *hdcp_ctrl)
|
||||
{
|
||||
if (hdcp_ctrl->init_data.client_id == HDCP_CLIENT_HDMI) {
|
||||
struct hdcp_reg_set reg_set = HDCP_REG_SET_CLIENT_HDMI;
|
||||
|
@ -1762,15 +1762,15 @@ static void hdmi_hdcp_update_client_reg_set(struct hdmi_hdcp_ctrl *hdcp_ctrl)
|
|||
}
|
||||
}
|
||||
|
||||
void *hdmi_hdcp_init(struct hdmi_hdcp_init_data *init_data)
|
||||
void *hdcp_1x_init(struct hdcp_init_data *init_data)
|
||||
{
|
||||
struct hdmi_hdcp_ctrl *hdcp_ctrl = NULL;
|
||||
struct hdcp_1x_ctrl *hdcp_ctrl = NULL;
|
||||
int ret;
|
||||
static struct hdmi_hdcp_ops ops = {
|
||||
.hdmi_hdcp_isr = hdmi_hdcp_isr,
|
||||
.hdmi_hdcp_reauthenticate = hdmi_hdcp_reauthenticate,
|
||||
.hdmi_hdcp_authenticate = hdmi_hdcp_authenticate,
|
||||
.hdmi_hdcp_off = hdmi_hdcp_off
|
||||
static struct hdcp_ops ops = {
|
||||
.isr = hdcp_1x_isr,
|
||||
.reauthenticate = hdcp_1x_reauthenticate,
|
||||
.authenticate = hdcp_1x_authenticate,
|
||||
.off = hdcp_1x_off
|
||||
};
|
||||
|
||||
if (!init_data || !init_data->core_io || !init_data->qfprom_io ||
|
||||
|
@ -1795,16 +1795,16 @@ void *hdmi_hdcp_init(struct hdmi_hdcp_init_data *init_data)
|
|||
hdcp_ctrl->init_data = *init_data;
|
||||
hdcp_ctrl->ops = &ops;
|
||||
|
||||
hdmi_hdcp_update_client_reg_set(hdcp_ctrl);
|
||||
hdcp_1x_update_client_reg_set(hdcp_ctrl);
|
||||
|
||||
if (sysfs_create_group(init_data->sysfs_kobj,
|
||||
&hdmi_hdcp_fs_attr_group)) {
|
||||
&hdcp_1x_fs_attr_group)) {
|
||||
DEV_ERR("%s: hdcp sysfs group creation failed\n", __func__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
INIT_DELAYED_WORK(&hdcp_ctrl->hdcp_auth_work, hdmi_hdcp_auth_work);
|
||||
INIT_WORK(&hdcp_ctrl->hdcp_int_work, hdmi_hdcp_int_work);
|
||||
INIT_DELAYED_WORK(&hdcp_ctrl->hdcp_auth_work, hdcp_1x_auth_work);
|
||||
INIT_WORK(&hdcp_ctrl->hdcp_int_work, hdcp_1x_int_work);
|
||||
|
||||
hdcp_ctrl->hdcp_state = HDCP_STATE_INACTIVE;
|
||||
init_completion(&hdcp_ctrl->r0_checked);
|
||||
|
@ -1825,10 +1825,10 @@ void *hdmi_hdcp_init(struct hdmi_hdcp_init_data *init_data)
|
|||
|
||||
error:
|
||||
return (void *)hdcp_ctrl;
|
||||
} /* hdmi_hdcp_init */
|
||||
} /* hdcp_1x_init */
|
||||
|
||||
struct hdmi_hdcp_ops *hdmi_hdcp_start(void *input)
|
||||
struct hdcp_ops *hdcp_1x_start(void *input)
|
||||
{
|
||||
return ((struct hdmi_hdcp_ctrl *)input)->ops;
|
||||
return ((struct hdcp_1x_ctrl *)input)->ops;
|
||||
}
|
||||
|
|
@ -22,7 +22,7 @@ enum hdcp_client_id {
|
|||
HDCP_CLIENT_DP,
|
||||
};
|
||||
|
||||
enum hdmi_hdcp_state {
|
||||
enum hdcp_states {
|
||||
HDCP_STATE_INACTIVE,
|
||||
HDCP_STATE_AUTHENTICATING,
|
||||
HDCP_STATE_AUTHENTICATED,
|
||||
|
@ -32,7 +32,7 @@ enum hdmi_hdcp_state {
|
|||
HDCP_STATE_AUTH_ENC_2P2
|
||||
};
|
||||
|
||||
struct hdmi_hdcp_init_data {
|
||||
struct hdcp_init_data {
|
||||
struct dss_io_data *core_io;
|
||||
struct dss_io_data *qfprom_io;
|
||||
struct dss_io_data *hdcp_io;
|
||||
|
@ -40,7 +40,7 @@ struct hdmi_hdcp_init_data {
|
|||
struct kobject *sysfs_kobj;
|
||||
struct workqueue_struct *workq;
|
||||
void *cb_data;
|
||||
void (*notify_status)(void *cb_data, enum hdmi_hdcp_state status);
|
||||
void (*notify_status)(void *cb_data, enum hdcp_states status);
|
||||
struct hdmi_tx_ddc_ctrl *ddc_ctrl;
|
||||
void *dp_data;
|
||||
u32 phy_addr;
|
||||
|
@ -51,22 +51,22 @@ struct hdmi_hdcp_init_data {
|
|||
enum hdcp_client_id client_id;
|
||||
};
|
||||
|
||||
struct hdmi_hdcp_ops {
|
||||
int (*hdmi_hdcp_isr)(void *ptr);
|
||||
int (*hdmi_hdcp_reauthenticate)(void *input);
|
||||
int (*hdmi_hdcp_authenticate)(void *hdcp_ctrl);
|
||||
struct hdcp_ops {
|
||||
int (*isr)(void *ptr);
|
||||
int (*reauthenticate)(void *input);
|
||||
int (*authenticate)(void *hdcp_ctrl);
|
||||
bool (*feature_supported)(void *input);
|
||||
void (*hdmi_hdcp_off)(void *hdcp_ctrl);
|
||||
void (*off)(void *hdcp_ctrl);
|
||||
};
|
||||
|
||||
void *hdmi_hdcp_init(struct hdmi_hdcp_init_data *init_data);
|
||||
void *hdmi_hdcp2p2_init(struct hdmi_hdcp_init_data *init_data);
|
||||
void hdmi_hdcp_deinit(void *input);
|
||||
void *hdcp_1x_init(struct hdcp_init_data *init_data);
|
||||
void *hdmi_hdcp2p2_init(struct hdcp_init_data *init_data);
|
||||
void hdcp_1x_deinit(void *input);
|
||||
void hdmi_hdcp2p2_deinit(void *input);
|
||||
|
||||
struct hdmi_hdcp_ops *hdmi_hdcp_start(void *input);
|
||||
struct hdmi_hdcp_ops *hdmi_hdcp2p2_start(void *input);
|
||||
struct hdcp_ops *hdcp_1x_start(void *input);
|
||||
struct hdcp_ops *hdmi_hdcp2p2_start(void *input);
|
||||
|
||||
const char *hdcp_state_name(enum hdmi_hdcp_state hdcp_state);
|
||||
const char *hdcp_state_name(enum hdcp_states hdcp_state);
|
||||
|
||||
#endif /* __MDSS_HDMI_HDCP_H__ */
|
|
@ -20,7 +20,7 @@
|
|||
#include <linux/kthread.h>
|
||||
|
||||
#include <linux/hdcp_qseecom.h>
|
||||
#include "mdss_hdmi_hdcp.h"
|
||||
#include "mdss_hdcp_1x.h"
|
||||
#include "video/msm_hdmi_hdcp_mgr.h"
|
||||
#include "mdss_hdmi_util.h"
|
||||
|
||||
|
@ -56,11 +56,11 @@ struct hdmi_hdcp2p2_ctrl {
|
|||
atomic_t auth_state;
|
||||
bool tethered;
|
||||
enum hdmi_hdcp2p2_sink_status sink_status; /* Is sink connected */
|
||||
struct hdmi_hdcp_init_data init_data; /* Feature data from HDMI drv */
|
||||
struct hdcp_init_data init_data; /* Feature data from HDMI drv */
|
||||
struct mutex mutex; /* mutex to protect access to ctrl */
|
||||
struct mutex msg_lock; /* mutex to protect access to msg buffer */
|
||||
struct mutex wakeup_mutex; /* mutex to protect access to wakeup call*/
|
||||
struct hdmi_hdcp_ops *ops;
|
||||
struct hdcp_ops *ops;
|
||||
void *lib_ctx; /* Handle to HDCP 2.2 Trustzone library */
|
||||
struct hdcp_txmtr_ops *lib; /* Ops for driver to call into TZ */
|
||||
|
||||
|
@ -401,7 +401,7 @@ static ssize_t hdmi_hdcp2p2_sysfs_wta_min_level_change(struct device *dev,
|
|||
struct hdcp_lib_wakeup_data cdata = {
|
||||
HDCP_LIB_WKUP_CMD_QUERY_STREAM_TYPE};
|
||||
bool enc_notify = true;
|
||||
enum hdmi_hdcp_state enc_lvl;
|
||||
enum hdcp_states enc_lvl;
|
||||
int min_enc_lvl;
|
||||
int rc;
|
||||
|
||||
|
@ -982,15 +982,15 @@ void hdmi_hdcp2p2_deinit(void *input)
|
|||
kfree(ctrl);
|
||||
}
|
||||
|
||||
void *hdmi_hdcp2p2_init(struct hdmi_hdcp_init_data *init_data)
|
||||
void *hdmi_hdcp2p2_init(struct hdcp_init_data *init_data)
|
||||
{
|
||||
int rc;
|
||||
struct hdmi_hdcp2p2_ctrl *ctrl;
|
||||
static struct hdmi_hdcp_ops ops = {
|
||||
.hdmi_hdcp_reauthenticate = hdmi_hdcp2p2_reauthenticate,
|
||||
.hdmi_hdcp_authenticate = hdmi_hdcp2p2_authenticate,
|
||||
static struct hdcp_ops ops = {
|
||||
.reauthenticate = hdmi_hdcp2p2_reauthenticate,
|
||||
.authenticate = hdmi_hdcp2p2_authenticate,
|
||||
.feature_supported = hdmi_hdcp2p2_feature_supported,
|
||||
.hdmi_hdcp_off = hdmi_hdcp2p2_off
|
||||
.off = hdmi_hdcp2p2_off
|
||||
};
|
||||
|
||||
static struct hdcp_client_ops client_ops = {
|
||||
|
@ -1094,7 +1094,7 @@ error:
|
|||
return false;
|
||||
}
|
||||
|
||||
struct hdmi_hdcp_ops *hdmi_hdcp2p2_start(void *input)
|
||||
struct hdcp_ops *hdmi_hdcp2p2_start(void *input)
|
||||
{
|
||||
struct hdmi_hdcp2p2_ctrl *ctrl = input;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "mdss_fb.h"
|
||||
#include "mdss_hdmi_cec.h"
|
||||
#include "mdss_hdmi_edid.h"
|
||||
#include "mdss_hdmi_hdcp.h"
|
||||
#include "mdss_hdcp_1x.h"
|
||||
#include "mdss_hdmi_tx.h"
|
||||
#include "mdss_hdmi_audio.h"
|
||||
#include "mdss.h"
|
||||
|
@ -1447,7 +1447,7 @@ end:
|
|||
return enc_en;
|
||||
} /* hdmi_tx_is_encryption_set */
|
||||
|
||||
static void hdmi_tx_hdcp_cb(void *ptr, enum hdmi_hdcp_state status)
|
||||
static void hdmi_tx_hdcp_cb(void *ptr, enum hdcp_states status)
|
||||
{
|
||||
struct hdmi_tx_ctrl *hdmi_ctrl = (struct hdmi_tx_ctrl *)ptr;
|
||||
|
||||
|
@ -1526,7 +1526,7 @@ static void hdmi_tx_hdcp_cb_work(struct work_struct *work)
|
|||
|
||||
if (hdmi_tx_is_panel_on(hdmi_ctrl)) {
|
||||
DEV_DBG("%s: Reauthenticating\n", __func__);
|
||||
rc = hdmi_ctrl->hdcp_ops->hdmi_hdcp_reauthenticate(
|
||||
rc = hdmi_ctrl->hdcp_ops->reauthenticate(
|
||||
hdmi_ctrl->hdcp_data);
|
||||
if (rc)
|
||||
DEV_ERR("%s: HDCP reauth failed. rc=%d\n",
|
||||
|
@ -1777,7 +1777,7 @@ end:
|
|||
|
||||
static int hdmi_tx_init_hdcp(struct hdmi_tx_ctrl *hdmi_ctrl)
|
||||
{
|
||||
struct hdmi_hdcp_init_data hdcp_init_data = {0};
|
||||
struct hdcp_init_data hdcp_init_data = {0};
|
||||
struct resource *res;
|
||||
void *hdcp_data;
|
||||
int rc = 0;
|
||||
|
@ -1803,9 +1803,10 @@ static int hdmi_tx_init_hdcp(struct hdmi_tx_ctrl *hdmi_ctrl)
|
|||
hdcp_init_data.hdmi_tx_ver = hdmi_ctrl->hdmi_tx_major_version;
|
||||
hdcp_init_data.sec_access = true;
|
||||
hdcp_init_data.timing = &hdmi_ctrl->timing;
|
||||
hdcp_init_data.client_id = HDCP_CLIENT_HDMI;
|
||||
|
||||
if (hdmi_ctrl->hdcp14_present) {
|
||||
hdcp_data = hdmi_hdcp_init(&hdcp_init_data);
|
||||
hdcp_data = hdcp_1x_init(&hdcp_init_data);
|
||||
|
||||
if (IS_ERR_OR_NULL(hdcp_data)) {
|
||||
DEV_ERR("%s: hdcp 1.4 init failed\n", __func__);
|
||||
|
@ -1982,7 +1983,7 @@ static void hdmi_tx_deinit_features(struct hdmi_tx_ctrl *hdmi_ctrl,
|
|||
if (features & HDMI_TX_FEAT_HDCP) {
|
||||
fd = hdmi_tx_get_fd(HDMI_TX_FEAT_HDCP);
|
||||
|
||||
hdmi_hdcp_deinit(fd);
|
||||
hdcp_1x_deinit(fd);
|
||||
hdmi_tx_set_fd(HDMI_TX_FEAT_HDCP, 0);
|
||||
}
|
||||
|
||||
|
@ -2170,7 +2171,7 @@ error:
|
|||
static void hdmi_tx_update_hdcp_info(struct hdmi_tx_ctrl *hdmi_ctrl)
|
||||
{
|
||||
void *fd = NULL;
|
||||
struct hdmi_hdcp_ops *ops = NULL;
|
||||
struct hdcp_ops *ops = NULL;
|
||||
|
||||
if (!hdmi_ctrl) {
|
||||
DEV_ERR("%s: invalid input\n", __func__);
|
||||
|
@ -2194,7 +2195,7 @@ static void hdmi_tx_update_hdcp_info(struct hdmi_tx_ctrl *hdmi_ctrl)
|
|||
|
||||
if (hdmi_ctrl->hdcp14_present) {
|
||||
fd = hdmi_tx_get_fd(HDMI_TX_FEAT_HDCP);
|
||||
ops = hdmi_hdcp_start(fd);
|
||||
ops = hdcp_1x_start(fd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3445,10 +3446,10 @@ static irqreturn_t hdmi_tx_isr(int irq, void *data)
|
|||
}
|
||||
|
||||
if (hdmi_ctrl->hdcp_ops && hdmi_ctrl->hdcp_data) {
|
||||
if (hdmi_ctrl->hdcp_ops->hdmi_hdcp_isr) {
|
||||
if (hdmi_ctrl->hdcp_ops->hdmi_hdcp_isr(
|
||||
if (hdmi_ctrl->hdcp_ops->isr) {
|
||||
if (hdmi_ctrl->hdcp_ops->isr(
|
||||
hdmi_ctrl->hdcp_data))
|
||||
DEV_ERR("%s: hdmi_hdcp_isr failed\n",
|
||||
DEV_ERR("%s: hdcp_1x_isr failed\n",
|
||||
__func__);
|
||||
}
|
||||
}
|
||||
|
@ -3553,7 +3554,7 @@ static int hdmi_tx_start_hdcp(struct hdmi_tx_ctrl *hdmi_ctrl)
|
|||
if (hdmi_tx_is_encryption_set(hdmi_ctrl))
|
||||
hdmi_tx_config_avmute(hdmi_ctrl, true);
|
||||
|
||||
rc = hdmi_ctrl->hdcp_ops->hdmi_hdcp_authenticate(hdmi_ctrl->hdcp_data);
|
||||
rc = hdmi_ctrl->hdcp_ops->authenticate(hdmi_ctrl->hdcp_data);
|
||||
if (rc)
|
||||
DEV_ERR("%s: hdcp auth failed. rc=%d\n", __func__, rc);
|
||||
|
||||
|
@ -3570,8 +3571,7 @@ static int hdmi_tx_hdcp_off(struct hdmi_tx_ctrl *hdmi_ctrl)
|
|||
}
|
||||
|
||||
DEV_DBG("%s: Turning off HDCP\n", __func__);
|
||||
hdmi_ctrl->hdcp_ops->hdmi_hdcp_off(
|
||||
hdmi_ctrl->hdcp_data);
|
||||
hdmi_ctrl->hdcp_ops->off(hdmi_ctrl->hdcp_data);
|
||||
|
||||
flush_delayed_work(&hdmi_ctrl->hdcp_cb_work);
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ struct hdmi_tx_ctrl {
|
|||
struct delayed_work hdcp_cb_work;
|
||||
struct work_struct cable_notify_work;
|
||||
struct hdmi_tx_ddc_ctrl ddc_ctrl;
|
||||
struct hdmi_hdcp_ops *hdcp_ops;
|
||||
struct hdcp_ops *hdcp_ops;
|
||||
struct cec_ops hdmi_cec_ops;
|
||||
struct cec_cbs hdmi_cec_cbs;
|
||||
struct hdmi_audio_ops audio_ops;
|
||||
|
|
Loading…
Add table
Reference in a new issue