Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Linux/drivers/gpu/drm/msm/hdmi/   (Linux Kernel Version 6.17.9©)  Datei vom 24.10.2025 mit Größe 35 kB image not shown  

Quelle  hdmi_hdcp.c   Sprache: C

 

// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2010-2015, The Linux Foundation. All rights reserved.
 */


#include "hdmi.h"
#include <linux/firmware/qcom/qcom_scm.h>

#define HDCP_REG_ENABLE 0x01
#define HDCP_REG_DISABLE 0x00
#define HDCP_PORT_ADDR 0x74

#define HDCP_INT_STATUS_MASK ( \
  HDMI_HDCP_INT_CTRL_AUTH_SUCCESS_INT | \
  HDMI_HDCP_INT_CTRL_AUTH_FAIL_INT | \
  HDMI_HDCP_INT_CTRL_AUTH_XFER_REQ_INT | \
  HDMI_HDCP_INT_CTRL_AUTH_XFER_DONE_INT)

#define AUTH_WORK_RETRIES_TIME 100
#define AUTH_RETRIES_TIME 30

/* QFPROM Registers for HDMI/HDCP */
#define QFPROM_RAW_FEAT_CONFIG_ROW0_LSB  0x000000F8
#define QFPROM_RAW_FEAT_CONFIG_ROW0_MSB  0x000000FC
#define HDCP_KSV_LSB                     0x000060D8
#define HDCP_KSV_MSB                     0x000060DC

enum DS_TYPE {  /* type of downstream device */
 DS_UNKNOWN,
 DS_RECEIVER,
 DS_REPEATER,
};

enum hdmi_hdcp_state {
 HDCP_STATE_NO_AKSV,
 HDCP_STATE_INACTIVE,
 HDCP_STATE_AUTHENTICATING,
 HDCP_STATE_AUTHENTICATED,
 HDCP_STATE_AUTH_FAILED
};

struct hdmi_hdcp_reg_data {
 u32 reg_id;
 u32 off;
 char *name;
 u32 reg_val;
};

struct hdmi_hdcp_ctrl {
 struct hdmi *hdmi;
 u32 auth_retries;
 bool tz_hdcp;
 enum hdmi_hdcp_state hdcp_state;
 struct work_struct hdcp_auth_work;
 struct work_struct hdcp_reauth_work;

#define AUTH_ABORT_EV 1
#define AUTH_RESULT_RDY_EV 2
 unsigned long auth_event;
 wait_queue_head_t auth_event_queue;

 u32 ksv_fifo_w_index;
 /*
  * store aksv from qfprom
 */

 u32 aksv_lsb;
 u32 aksv_msb;
 bool aksv_valid;
 u32 ds_type;
 u32 bksv_lsb;
 u32 bksv_msb;
 u8 dev_count;
 u8 depth;
 u8 ksv_list[5 * 127];
 bool max_cascade_exceeded;
 bool max_dev_exceeded;
};

static int msm_hdmi_ddc_read(struct hdmi *hdmi, u16 addr, u8 offset,
 u8 *data, u16 data_len)
{
 int rc;
 int retry = 5;
 struct i2c_msg msgs[] = {
  {
   .addr = addr >> 1,
   .flags = 0,
   .len = 1,
   .buf = &offset,
  }, {
   .addr = addr >> 1,
   .flags = I2C_M_RD,
   .len = data_len,
   .buf = data,
  }
 };

 DBG("Start DDC read");
retry:
 rc = i2c_transfer(hdmi->i2c, msgs, 2);

 retry--;
 if (rc == 2)
  rc = 0;
 else if (retry > 0)
  goto retry;
 else
  rc = -EIO;

 DBG("End DDC read %d", rc);

 return rc;
}

#define HDCP_DDC_WRITE_MAX_BYTE_NUM 32

static int msm_hdmi_ddc_write(struct hdmi *hdmi, u16 addr, u8 offset,
 u8 *data, u16 data_len)
{
 int rc;
 int retry = 10;
 u8 buf[HDCP_DDC_WRITE_MAX_BYTE_NUM];
 struct i2c_msg msgs[] = {
  {
   .addr = addr >> 1,
   .flags = 0,
   .len = 1,
  }
 };

 DBG("Start DDC write");
 if (data_len > (HDCP_DDC_WRITE_MAX_BYTE_NUM - 1)) {
  pr_err("%s: write size too big\n", __func__);
  return -ERANGE;
 }

 buf[0] = offset;
 memcpy(&buf[1], data, data_len);
 msgs[0].buf = buf;
 msgs[0].len = data_len + 1;
retry:
 rc = i2c_transfer(hdmi->i2c, msgs, 1);

 retry--;
 if (rc == 1)
  rc = 0;
 else if (retry > 0)
  goto retry;
 else
  rc = -EIO;

 DBG("End DDC write %d", rc);

 return rc;
}

static int msm_hdmi_hdcp_scm_wr(struct hdmi_hdcp_ctrl *hdcp_ctrl, u32 *preg,
 u32 *pdata, u32 count)
{
 struct hdmi *hdmi = hdcp_ctrl->hdmi;
 struct qcom_scm_hdcp_req scm_buf[QCOM_SCM_HDCP_MAX_REQ_CNT];
 u32 resp, phy_addr, idx = 0;
 int i, ret = 0;

 WARN_ON(!pdata || !preg || (count == 0));

 if (hdcp_ctrl->tz_hdcp) {
  phy_addr = (u32)hdmi->mmio_phy_addr;

  while (count) {
   memset(scm_buf, 0, sizeof(scm_buf));
   for (i = 0; i < count && i < QCOM_SCM_HDCP_MAX_REQ_CNT;
    i++) {
    scm_buf[i].addr = phy_addr + preg[idx];
    scm_buf[i].val  = pdata[idx];
    idx++;
   }
   ret = qcom_scm_hdcp_req(scm_buf, i, &resp);

   if (ret || resp) {
    pr_err("%s: error: scm_call ret=%d resp=%u\n",
     __func__, ret, resp);
    ret = -EINVAL;
    break;
   }

   count -= i;
  }
 } else {
  for (i = 0; i < count; i++)
   hdmi_write(hdmi, preg[i], pdata[i]);
 }

 return ret;
}

void msm_hdmi_hdcp_irq(struct hdmi_hdcp_ctrl *hdcp_ctrl)
{
 struct hdmi *hdmi = hdcp_ctrl->hdmi;
 u32 reg_val, hdcp_int_status;
 unsigned long flags;

 spin_lock_irqsave(&hdmi->reg_lock, flags);
 reg_val = hdmi_read(hdmi, REG_HDMI_HDCP_INT_CTRL);
 hdcp_int_status = reg_val & HDCP_INT_STATUS_MASK;
 if (!hdcp_int_status) {
  spin_unlock_irqrestore(&hdmi->reg_lock, flags);
  return;
 }
 /* Clear Interrupts */
 reg_val |= hdcp_int_status << 1;
 /* Clear AUTH_FAIL_INFO as well */
 if (hdcp_int_status & HDMI_HDCP_INT_CTRL_AUTH_FAIL_INT)
  reg_val |= HDMI_HDCP_INT_CTRL_AUTH_FAIL_INFO_ACK;
 hdmi_write(hdmi, REG_HDMI_HDCP_INT_CTRL, reg_val);
 spin_unlock_irqrestore(&hdmi->reg_lock, flags);

 DBG("hdcp irq %x", hdcp_int_status);

 if (hdcp_int_status & HDMI_HDCP_INT_CTRL_AUTH_SUCCESS_INT) {
  pr_info("%s:AUTH_SUCCESS_INT received\n", __func__);
  if (HDCP_STATE_AUTHENTICATING == hdcp_ctrl->hdcp_state) {
   set_bit(AUTH_RESULT_RDY_EV, &hdcp_ctrl->auth_event);
   wake_up_all(&hdcp_ctrl->auth_event_queue);
  }
 }

 if (hdcp_int_status & HDMI_HDCP_INT_CTRL_AUTH_FAIL_INT) {
  reg_val = hdmi_read(hdmi, REG_HDMI_HDCP_LINK0_STATUS);
  pr_info("%s: AUTH_FAIL_INT rcvd, LINK0_STATUS=0x%08x\n",
   __func__, reg_val);
  if (HDCP_STATE_AUTHENTICATED == hdcp_ctrl->hdcp_state)
   queue_work(hdmi->workq, &hdcp_ctrl->hdcp_reauth_work);
  else if (HDCP_STATE_AUTHENTICATING ==
    hdcp_ctrl->hdcp_state) {
   set_bit(AUTH_RESULT_RDY_EV, &hdcp_ctrl->auth_event);
   wake_up_all(&hdcp_ctrl->auth_event_queue);
  }
 }
}

static int msm_hdmi_hdcp_msleep(struct hdmi_hdcp_ctrl *hdcp_ctrl, u32 ms, u32 ev)
{
 int rc;

 rc = wait_event_timeout(hdcp_ctrl->auth_event_queue,
  !!test_bit(ev, &hdcp_ctrl->auth_event),
  msecs_to_jiffies(ms));
 if (rc) {
  pr_info("%s: msleep is canceled by event %d\n",
    __func__, ev);
  clear_bit(ev, &hdcp_ctrl->auth_event);
  return -ECANCELED;
 }

 return 0;
}

static int msm_hdmi_hdcp_read_validate_aksv(struct hdmi_hdcp_ctrl *hdcp_ctrl)
{
 struct hdmi *hdmi = hdcp_ctrl->hdmi;

 /* Fetch aksv from QFPROM, this info should be public. */
 hdcp_ctrl->aksv_lsb = hdmi_qfprom_read(hdmi, HDCP_KSV_LSB);
 hdcp_ctrl->aksv_msb = hdmi_qfprom_read(hdmi, HDCP_KSV_MSB);

 /* check there are 20 ones in AKSV */
 if ((hweight32(hdcp_ctrl->aksv_lsb) + hweight32(hdcp_ctrl->aksv_msb))
   != 20) {
  pr_err("%s: AKSV QFPROM doesn't have 20 1's, 20 0's\n",
   __func__);
  pr_err("%s: QFPROM AKSV chk failed (AKSV=%02x%08x)\n",
   __func__, hdcp_ctrl->aksv_msb,
   hdcp_ctrl->aksv_lsb);
  return -EINVAL;
 }
 DBG("AKSV=%02x%08x", hdcp_ctrl->aksv_msb, hdcp_ctrl->aksv_lsb);

 return 0;
}

static int msm_reset_hdcp_ddc_failures(struct hdmi_hdcp_ctrl *hdcp_ctrl)
{
 struct hdmi *hdmi = hdcp_ctrl->hdmi;
 u32 reg_val, failure, nack0;
 int rc = 0;

 /* Check for any DDC transfer failures */
 reg_val = hdmi_read(hdmi, REG_HDMI_HDCP_DDC_STATUS);
 failure = reg_val & HDMI_HDCP_DDC_STATUS_FAILED;
 nack0 = reg_val & HDMI_HDCP_DDC_STATUS_NACK0;
 DBG("HDCP_DDC_STATUS=0x%x, FAIL=%d, NACK0=%d",
  reg_val, failure, nack0);

 if (failure) {
  /*
   * Indicates that the last HDCP HW DDC transfer failed.
   * This occurs when a transfer is attempted with HDCP DDC
   * disabled (HDCP_DDC_DISABLE=1) or the number of retries
   * matches HDCP_DDC_RETRY_CNT.
   * Failure occurred,  let's clear it.
 */

  DBG("DDC failure detected");

  /* First, Disable DDC */
  hdmi_write(hdmi, REG_HDMI_HDCP_DDC_CTRL_0,
   HDMI_HDCP_DDC_CTRL_0_DISABLE);

  /* ACK the Failure to Clear it */
  reg_val = hdmi_read(hdmi, REG_HDMI_HDCP_DDC_CTRL_1);
  reg_val |= HDMI_HDCP_DDC_CTRL_1_FAILED_ACK;
  hdmi_write(hdmi, REG_HDMI_HDCP_DDC_CTRL_1, reg_val);

  /* Check if the FAILURE got Cleared */
  reg_val = hdmi_read(hdmi, REG_HDMI_HDCP_DDC_STATUS);
  if (reg_val & HDMI_HDCP_DDC_STATUS_FAILED)
   pr_info("%s: Unable to clear HDCP DDC Failure\n",
    __func__);

  /* Re-Enable HDCP DDC */
  hdmi_write(hdmi, REG_HDMI_HDCP_DDC_CTRL_0, 0);
 }

 if (nack0) {
  DBG("Before: HDMI_DDC_SW_STATUS=0x%08x",
   hdmi_read(hdmi, REG_HDMI_DDC_SW_STATUS));
  /* Reset HDMI DDC software status */
  reg_val = hdmi_read(hdmi, REG_HDMI_DDC_CTRL);
  reg_val |= HDMI_DDC_CTRL_SW_STATUS_RESET;
  hdmi_write(hdmi, REG_HDMI_DDC_CTRL, reg_val);

  rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV);

  reg_val = hdmi_read(hdmi, REG_HDMI_DDC_CTRL);
  reg_val &= ~HDMI_DDC_CTRL_SW_STATUS_RESET;
  hdmi_write(hdmi, REG_HDMI_DDC_CTRL, reg_val);

  /* Reset HDMI DDC Controller */
  reg_val = hdmi_read(hdmi, REG_HDMI_DDC_CTRL);
  reg_val |= HDMI_DDC_CTRL_SOFT_RESET;
  hdmi_write(hdmi, REG_HDMI_DDC_CTRL, reg_val);

  /* If previous msleep is aborted, skip this msleep */
  if (!rc)
   rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV);

  reg_val = hdmi_read(hdmi, REG_HDMI_DDC_CTRL);
  reg_val &= ~HDMI_DDC_CTRL_SOFT_RESET;
  hdmi_write(hdmi, REG_HDMI_DDC_CTRL, reg_val);
  DBG("After: HDMI_DDC_SW_STATUS=0x%08x",
   hdmi_read(hdmi, REG_HDMI_DDC_SW_STATUS));
 }

 return rc;
}

static int msm_hdmi_hdcp_hw_ddc_clean(struct hdmi_hdcp_ctrl *hdcp_ctrl)
{
 int rc;
 u32 hdcp_ddc_status, ddc_hw_status;
 u32 xfer_done, xfer_req, hw_done;
 bool hw_not_ready;
 u32 timeout_count;
 struct hdmi *hdmi = hdcp_ctrl->hdmi;

 if (hdmi_read(hdmi, REG_HDMI_DDC_HW_STATUS) == 0)
  return 0;

 /* Wait to be clean on DDC HW engine */
 timeout_count = 100;
 do {
  hdcp_ddc_status = hdmi_read(hdmi, REG_HDMI_HDCP_DDC_STATUS);
  ddc_hw_status = hdmi_read(hdmi, REG_HDMI_DDC_HW_STATUS);

  xfer_done = hdcp_ddc_status & HDMI_HDCP_DDC_STATUS_XFER_DONE;
  xfer_req = hdcp_ddc_status & HDMI_HDCP_DDC_STATUS_XFER_REQ;
  hw_done = ddc_hw_status & HDMI_DDC_HW_STATUS_DONE;
  hw_not_ready = !xfer_done || xfer_req || !hw_done;

  if (hw_not_ready)
   break;

  timeout_count--;
  if (!timeout_count) {
   pr_warn("%s: hw_ddc_clean failed\n", __func__);
   return -ETIMEDOUT;
  }

  rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV);
  if (rc)
   return rc;
 } while (1);

 return 0;
}

static void msm_hdmi_hdcp_reauth_work(struct work_struct *work)
{
 struct hdmi_hdcp_ctrl *hdcp_ctrl = container_of(work,
  struct hdmi_hdcp_ctrl, hdcp_reauth_work);
 struct hdmi *hdmi = hdcp_ctrl->hdmi;
 unsigned long flags;
 u32 reg_val;

 DBG("HDCP REAUTH WORK");
 /*
  * Disable HPD circuitry.
  * This is needed to reset the HDCP cipher engine so that when we
  * attempt a re-authentication, HW would clear the AN0_READY and
  * AN1_READY bits in HDMI_HDCP_LINK0_STATUS register
 */

 spin_lock_irqsave(&hdmi->reg_lock, flags);
 reg_val = hdmi_read(hdmi, REG_HDMI_HPD_CTRL);
 reg_val &= ~HDMI_HPD_CTRL_ENABLE;
 hdmi_write(hdmi, REG_HDMI_HPD_CTRL, reg_val);

 /* Disable HDCP interrupts */
 hdmi_write(hdmi, REG_HDMI_HDCP_INT_CTRL, 0);
 spin_unlock_irqrestore(&hdmi->reg_lock, flags);

 hdmi_write(hdmi, REG_HDMI_HDCP_RESET,
  HDMI_HDCP_RESET_LINK0_DEAUTHENTICATE);

 /* Wait to be clean on DDC HW engine */
 if (msm_hdmi_hdcp_hw_ddc_clean(hdcp_ctrl)) {
  pr_info("%s: reauth work aborted\n", __func__);
  return;
 }

 /* Disable encryption and disable the HDCP block */
 hdmi_write(hdmi, REG_HDMI_HDCP_CTRL, 0);

 /* Enable HPD circuitry */
 spin_lock_irqsave(&hdmi->reg_lock, flags);
 reg_val = hdmi_read(hdmi, REG_HDMI_HPD_CTRL);
 reg_val |= HDMI_HPD_CTRL_ENABLE;
 hdmi_write(hdmi, REG_HDMI_HPD_CTRL, reg_val);
 spin_unlock_irqrestore(&hdmi->reg_lock, flags);

 /*
  * Only retry defined times then abort current authenticating process
 */

 if (++hdcp_ctrl->auth_retries == AUTH_RETRIES_TIME) {
  hdcp_ctrl->hdcp_state = HDCP_STATE_INACTIVE;
  hdcp_ctrl->auth_retries = 0;
  pr_info("%s: abort reauthentication!\n", __func__);

  return;
 }

 DBG("Queue AUTH WORK");
 hdcp_ctrl->hdcp_state = HDCP_STATE_AUTHENTICATING;
 queue_work(hdmi->workq, &hdcp_ctrl->hdcp_auth_work);
}

static int msm_hdmi_hdcp_auth_prepare(struct hdmi_hdcp_ctrl *hdcp_ctrl)
{
 struct hdmi *hdmi = hdcp_ctrl->hdmi;
 u32 link0_status;
 u32 reg_val;
 unsigned long flags;
 int rc;

 if (!hdcp_ctrl->aksv_valid) {
  rc = msm_hdmi_hdcp_read_validate_aksv(hdcp_ctrl);
  if (rc) {
   pr_err("%s: ASKV validation failed\n", __func__);
   hdcp_ctrl->hdcp_state = HDCP_STATE_NO_AKSV;
   return -ENOTSUPP;
  }
  hdcp_ctrl->aksv_valid = true;
 }

 spin_lock_irqsave(&hdmi->reg_lock, flags);
 /* disable HDMI Encrypt */
 reg_val = hdmi_read(hdmi, REG_HDMI_CTRL);
 reg_val &= ~HDMI_CTRL_ENCRYPTED;
 hdmi_write(hdmi, REG_HDMI_CTRL, reg_val);

 /* Enabling Software DDC */
 reg_val = hdmi_read(hdmi, REG_HDMI_DDC_ARBITRATION);
 reg_val &= ~HDMI_DDC_ARBITRATION_HW_ARBITRATION;
 hdmi_write(hdmi, REG_HDMI_DDC_ARBITRATION, reg_val);
 spin_unlock_irqrestore(&hdmi->reg_lock, flags);

 /*
  * Write AKSV read from QFPROM to the HDCP registers.
  * This step is needed for HDCP authentication and must be
  * written before enabling HDCP.
 */

 hdmi_write(hdmi, REG_HDMI_HDCP_SW_LOWER_AKSV, hdcp_ctrl->aksv_lsb);
 hdmi_write(hdmi, REG_HDMI_HDCP_SW_UPPER_AKSV, hdcp_ctrl->aksv_msb);

 /*
  * HDCP setup prior to enabling HDCP_CTRL.
  * Setup seed values for random number An.
 */

 hdmi_write(hdmi, REG_HDMI_HDCP_ENTROPY_CTRL0, 0xB1FFB0FF);
 hdmi_write(hdmi, REG_HDMI_HDCP_ENTROPY_CTRL1, 0xF00DFACE);

 /* Disable the RngCipher state */
 reg_val = hdmi_read(hdmi, REG_HDMI_HDCP_DEBUG_CTRL);
 reg_val &= ~HDMI_HDCP_DEBUG_CTRL_RNG_CIPHER;
 hdmi_write(hdmi, REG_HDMI_HDCP_DEBUG_CTRL, reg_val);
 DBG("HDCP_DEBUG_CTRL=0x%08x",
  hdmi_read(hdmi, REG_HDMI_HDCP_DEBUG_CTRL));

 /*
  * Ensure that all register writes are completed before
  * enabling HDCP cipher
 */

 wmb();

 /*
  * Enable HDCP
  * This needs to be done as early as possible in order for the
  * hardware to make An available to read
 */

 hdmi_write(hdmi, REG_HDMI_HDCP_CTRL, HDMI_HDCP_CTRL_ENABLE);

 /*
  * If we had stale values for the An ready bit, it should most
  * likely be cleared now after enabling HDCP cipher
 */

 link0_status = hdmi_read(hdmi, REG_HDMI_HDCP_LINK0_STATUS);
 DBG("After enabling HDCP Link0_Status=0x%08x", link0_status);
 if (!(link0_status &
  (HDMI_HDCP_LINK0_STATUS_AN_0_READY |
  HDMI_HDCP_LINK0_STATUS_AN_1_READY)))
  DBG("An not ready after enabling HDCP");

 /* Clear any DDC failures from previous tries before enable HDCP*/
 rc = msm_reset_hdcp_ddc_failures(hdcp_ctrl);

 return rc;
}

static void msm_hdmi_hdcp_auth_fail(struct hdmi_hdcp_ctrl *hdcp_ctrl)
{
 struct hdmi *hdmi = hdcp_ctrl->hdmi;
 u32 reg_val;
 unsigned long flags;

 DBG("hdcp auth failed, queue reauth work");
 /* clear HDMI Encrypt */
 spin_lock_irqsave(&hdmi->reg_lock, flags);
 reg_val = hdmi_read(hdmi, REG_HDMI_CTRL);
 reg_val &= ~HDMI_CTRL_ENCRYPTED;
 hdmi_write(hdmi, REG_HDMI_CTRL, reg_val);
 spin_unlock_irqrestore(&hdmi->reg_lock, flags);

 hdcp_ctrl->hdcp_state = HDCP_STATE_AUTH_FAILED;
 queue_work(hdmi->workq, &hdcp_ctrl->hdcp_reauth_work);
}

static void msm_hdmi_hdcp_auth_done(struct hdmi_hdcp_ctrl *hdcp_ctrl)
{
 struct hdmi *hdmi = hdcp_ctrl->hdmi;
 u32 reg_val;
 unsigned long flags;

 /*
  * Disable software DDC before going into part3 to make sure
  * there is no Arbitration between software and hardware for DDC
 */

 spin_lock_irqsave(&hdmi->reg_lock, flags);
 reg_val = hdmi_read(hdmi, REG_HDMI_DDC_ARBITRATION);
 reg_val |= HDMI_DDC_ARBITRATION_HW_ARBITRATION;
 hdmi_write(hdmi, REG_HDMI_DDC_ARBITRATION, reg_val);
 spin_unlock_irqrestore(&hdmi->reg_lock, flags);

 /* enable HDMI Encrypt */
 spin_lock_irqsave(&hdmi->reg_lock, flags);
 reg_val = hdmi_read(hdmi, REG_HDMI_CTRL);
 reg_val |= HDMI_CTRL_ENCRYPTED;
 hdmi_write(hdmi, REG_HDMI_CTRL, reg_val);
 spin_unlock_irqrestore(&hdmi->reg_lock, flags);

 hdcp_ctrl->hdcp_state = HDCP_STATE_AUTHENTICATED;
 hdcp_ctrl->auth_retries = 0;
}

/*
 * hdcp authenticating part 1
 * Wait Key/An ready
 * Read BCAPS from sink
 * Write BCAPS and AKSV into HDCP engine
 * Write An and AKSV to sink
 * Read BKSV from sink and write into HDCP engine
 */
static int msm_hdmi_hdcp_wait_key_an_ready(struct hdmi_hdcp_ctrl *hdcp_ctrl)
{
 int rc;
 struct hdmi *hdmi = hdcp_ctrl->hdmi;
 u32 #include<firmware/qcom/qcom_scmjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
 u32 timeout_count;
 bool an_ready;

/* Wait for HDCP keys to be checked and validated */

 ;
do
us =java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 61
 keys_state =link0_status> 28)&07java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
  ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   ;

 DBG"eys not d)=d l0=0x08x"
   timeout_count, keys_state, link0_status);

  timeout_count--;
  if (!timeout_count) {
   pr_err("%s: Wait key state timedout", __func__);
   return -ETIMEDOUT;
  }

  rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV);
  if (c)
return;
 } while max_cascade_exceeded

 timeout_count = 100;
 dojava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
= java.lang.StringIndexOutOfBoundsException: Range [31, 26) out of bounds for length 61
  (Start DDC read";
  & (ink0_status &HDMI_HDCP_LINK0_STATUS_AN_1_READY)java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
  (n_ready
 break

  DBG("An not java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 

 timeout_count;
  if (  rc
  (%:WaitAn" _)
   return -java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 3
 }

 rc =msm_hdmi_hdcp_msleephdcp_ctrl 20,AUTH_ABORT_EV;
   (c)
   return  return -RANGE;
 }while1)

 return 0;
}

 int msm_hdmi_hdcp_send_aksv_anstruct hdmi_hdcp_ctrl hdcp_ctrl)
{
 int rc =0;
 struct hdmi *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 link0_aksv_0;
 u32 link0_an[2];
 u8 aksv[5]*java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 23

 /* Read An0 and An1 */
inti  =0
 link0_an[1] = hdmi_read(hdmijava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 * Read AKSV */
 link0_aksv_0 = hdmi_read(hdmi, REG_HDMI_HDCP_RCVPORT_DATA3);
link0_aksv_1 (dmi REG_HDMI_HDCP_RCVPORT_DATA4)
  i+){
, link0_aksv_1)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
 *Copy An and tobyte arraysfor transmission *
 aksv[0] =  pr_err(%::scm_call ret=d =\"
 aksv1  link0_aksv_0> 8) &0xFF;
sv[]=(ink0_aksv_0 >>16)&0xFFjava.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
 for( =0;i<count +)
 aksv[4] hdmi_writehdmi, [] [];

 /* Write An to offset 0x18 */ retjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
 rc = * = hdcp_ctrl>dmi;
  (u16sizeoflink0_an);
 if (rc) {
 );
  returnrc;
 }
 DBG("Link0-An=%08x%08x",  hdcp_int_status =  HDCP_INT_STATUS_MASK;

 /* Write AKSV to offset 0x10 */
  =msm_hdmi_ddc_write(dmi,HDCP_PORT_ADDR, 0x10,aksv,5)
 if (rc  (dcp_int_status  HDMI_HDCP_INT_CTRL_AUTH_FAIL_INT
  hdmi_write(dmi , reg_val;
   spin_un(hdmi>,flags;
 }
 v_1 &0xFF,link0_aksv_0)

 return 0;
}

 hdmi_hdcp_ctrl *)
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 1
 int rc =java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  reg_val hdmi_read(hdmi, REG_HDMI_HDCP_LINK0_STATUS);
u8 [5]
  if( ==hdcp_ctrl-hdcp_state)

 /* Read BKSV at offset 0x00 */
 rc =msm_hdmi_ddc_readhdmi,HDCP_PORT_ADDR x00,, 5)java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
if()java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
  (%:BKSVfailed" _;
  return rc;
 !test_bite, &dcp_ctrlauth_event,

hdcp_ctrl> =[]|(ksv[]< 8)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
  (bksv[2] << 16) |  ,);
 hdcp_ctrl>ksv_msb =bksv4;
 DBG(":BKSV=

 /* check there are 20 ones in BKSV */
 struct  *dmi =>;
   != 20) {
  pr_err(:BKSV ' have 201sand 20 0'\";
  pr_err(": BKSV chk fail.  -aksv_msb=hdmi_qfprom_read(dmi,HDCP_KSV_MSB)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
  bksv[4] [] bksv2,bksv[] [0]
  return =20 {
 }

 /* Write BKSV read from sink to HDCP registers */
 reg[0] = hdcp_ctrl->aksv_lsb
 data[0 DBG(AKSV%%8x" hdcp_ctrl>, hdcp_ctrl-aksv_lsb)
 reg[1]java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 data[1] = hdcp_ctrl->bksv_msb;
 rc=msm_hdmi_hdcp_scm_wr(hdcp_ctrl, reg, data, 2);

returnrc;
}

static msm_hdmi_hdcp_recv_bcapsstruct  *hdcp_ctrl)
{
 int rc = 0;
struct hdmi =hdcp_ctrl>dmi;
 java.lang.StringIndexOutOfBoundsException: Range [0, 4) out of bounds for length 0
u8 bcaps

 rc = msm_hdmi_ddc_read(hdmi, HDCP_PORT_ADDR, 0x40, &bcaps, 1)   *Thisoccurs atransfer   withHDCPDDC
 if (rc) {
  pr_err("%s:BCAPS read failed\n", __func__);
  return rc;
 }
 DBG("BCAPS=%02x", bcaps);

 /* receiver (0), repeater (1) */
 hdcp_ctrl->ds_type = (bcaps & BIT(6)) ? DS_REPEATER : DS_RECEIVER;

 /* Write BCAPS to the hardware */
 reg = REG_HDMI_HDCP_RCVPORT_DATA12;
 data = (u32)bcaps;
 rc =msm_hdmi_hdcp_scm_wr&,&ata,1)java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54

 return rc;
}

static int msm_hdmi_hdcp_auth_part1_key_exchange(struct hdmi_hdcp_ctrl *hdcp_ctrl)
{
 struct hdmi *hdmi = hdcp_ctrl->hdmi;
 unsigned long flags;
 int rc;

 /* Wait for AKSV key and An ready */
 rc 
 if ( hdmi_write(dmi REG_HDMI_HDCP_DDC_CTRL_0
  pr_err( /
   reg_val (,);
 }

 /* Read BCAPS and send to HDCP engine */
 rc  msm_hdmi_hdcp_recv_bcaps()java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
 if (rc) {
  pr_err("%s: read bcaps error, abort\n",  (%:  to HDCPDDCFailuren,
  return  _func__;
 }

 /*
  * 1if (ack0) {
 /* Reset HDMI DDC software status */
 */

 hdmi_write (hdmi ,reg_val;

 /* Send AKSV and An to sink */
 rc =msm_hdmi_hdcp_send_aksv_an(hdcp_ctrl);
 if (rc) {
  pr_err("%s:An/Aksv write failed\n", __func__);
  return rc;
 }

 /* Read BKSV and send to HDCP engine*/
  (hdcp_ctrl;
 if 
  pr_err("%s:BKSV Process failed\n", if !)
  return rc;
 }

 /* Enable HDCP interrupts and ack/clear any stale interrupts */ &=~;
 spin_lock_irqsave(&hdmi->reg_lock, flags);
hdmi_writehdmi,,
  java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 11
  HDMI_HDCP_INT_CTRL_AUTH_SUCCESS_MASK
  java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 8
 HDMI_HDCP_INT_CTRL_AUTH_FAIL_MASK
  java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 19
 spin_unlock_irqrestorejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 0
}

/* read R0' from sink and pass it to HDCP engine */
static int java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 0
{
 struct *dmi =hdcp_ctrl>java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
 int 
 u8 buf[ break;

 /*
  HDCP  Testcase 1A-:
 *Wait  at least 100msbefore reading'
 */

 rc hdmi_hdcp_ctrl* =(work
 if (rc)
  return rc;

 /* Read R0' at offset 0x08 */
 rc = msm_hdmi_ddc_read
 if (rc) {
  pr_err("%s:R0' read failed\n", __func__);
  return rc;
 }
 DBG("R0'=%02x%02x", buf[1], buf[0]);

/* Write R0' to HDCP registers and check to see if it is a match */

 hdmi_write(hdmi, REG_HDMI_HDCP_RCVPORT_DATA2_0,
  (((u32)buf[1]) << 8 *AN1_READYbits HDMI_HDCP_LINK0_STATUS

 return 0;
}

/* Wait for authenticating result: R0/R0' are matched or not */
static int (structhdmi_hdcp_ctrl*)
{
  hdmi=->dmi;
 u32 link0_status;
 int rc

 /* wait for hdcp irq, 10 sec should be long enough */
 rcif (sm_hdmi_hdcp_hw_ddc_clean(dcp_ctrljava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
 java.lang.StringIndexOutOfBoundsException: Range [8, 3) out of bounds for length 11
  pr_err("%s: Wait Auth hdmi_write(hdmi, REG_HDMI_HDCP_CTRL, 0);
  return -ETIMEDOUT;
 }

 link0_status =  reg_val = hdmi_read(hdmi;
 if  reg_val=HDMI_HPD_CTRL_ENABLE;
 pr_err(%:Authentication Part I failed\n"_func__)
  return -INVAL;
 }

 /* Enable HDCP Encryption */
 hdmi_write(hdmi, REG_HDMI_HDCP_CTRL,
  HDMI_HDCP_CTRL_ENABLE |
  HDMI_HDCP_CTRL_ENCRYPTION_ENABLE);

 return 0;
}

static int msm_hdmi_hdcp_recv_check_bstatus(struct java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 46
 u16 *pbstatus)
{
 ntrc
 struct java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 0
 bool queue_workhdmi>orkq, &dcp_ctrl>dcp_auth_work)
 u32 repeater_cascade_depth msm_hdmi_hdcp_auth_preparestruct hdmi_hdcp_ctrlhdcp_ctrljava.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
 u16 bstatus;
 u8 buf[2];

 /* Read BSTATUS at offset 0x41 */
(hdmi HDCP_PORT_ADDR,0x41,buf,2;
 if (rc) {
  (%:BSTATUS read \",_func__)
   hdc-hdcp_state =HDCP_STATE_NO_AKSVjava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
 }
 *


 down_stream_devices = bstatus   & ~DMI_CTRL_ENCRYPTED;
 repeater_cascade_depth = (bstatus >>
 max_devs_exceeded =hdmi_readhdmi );
 max_cascade_exceeded = (bstatus & BIT(11) (dmi,REG_HDMI_DDC_ARBITRATION)

 if (down_stream_devices *WriteAKSV read from totheHDCP .
  /*
   * If no downstream devices are attached to the repeater
   * then part II fails.
   * todo: The other approach would be to continue 
 */

  pr_err("%s: No downstream devices\n", __func__);
  rc = -EINVAL;
  goto error;
 }

  (dmi REG_HDMI_HDCP_ENTROPY_CTRL0 xB1FFB0FFjava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
  *HDCPCompliance1B-5:
  * Check if no. of devices connected to  reg_val = hdmi_read(hdmi, REG_HDMI_HDCP_DEBUG_CT
  max_devices_connected bit 7 of .
 *
 if() {
  pr_err("%s: no. of devs  
   __func__);
  rc = -EINVAL;
  goto error;
 }

 /*
  * HDCP Compliance 1B-06:
  * Check if no. of cascade *Enable
  * exceed max_cascade_connected from bit 11 of Bstatus.
 */

 if (max_cascade_exceeded) {
  pr_err("%s: no. of cascade conn exceeds max allowed",
   __func__);
  rc = -EINVAL;
   *
 }

error:
 hdcp_ctrl->dev_count = down_stream_devices;
 hdcp_ctrl->max_cascade_exceeded = max_cascade_exceeded;
 hdcp_ctrl->max_dev_exceeded = max_devs_exceeded;
 hdcp_ctrl->depth = repeater_cascade_depth;
 return rc;
}

staticady(
 struct hdmi_hdcp_ctrl *hdcp_ctrl)
{
 int rc;
 struct hdmi *hdmi = hdcp_ctrl->hdmi;
 u32 reg, data;
 u32 (HDMI_HDCP_LINK0_|
  ;
 u8bcapsjava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10

 /*
  * Wait until READY bit is 
  * maximum permitted time tou32 ;
 */

 timeout_count = 100;
 do {
  /* Read BCAPS at offset 0x40 */hdmi_write(dmi,REG_HDMI_CTRL,)
  rc = java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 if(c){
   java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 0
   return rc;
  }

unsignedlong;
    

  timeout_count--;
  if (!  * there is Arbitrationbetweensoftwareandhardware DDC
   pr_err("%s: Wait KSV fifo ready timedout", __func__);
   return -ETIMEDOUT;
  }

  rc = msm_hdmi_hdcp_msleep (dmi, REG_HDMI_DDC_ARBITRATION, reg_val;
 spin_unlock_irqrestore&>eg_lock,)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
   return rc;
 } while (1);

 rc  hdmi_writehdmi ,reg_val;
 if (rc) {
  pr_err("%s:
  return rc;
 }

 /* Write BSTATUS and BCAPS to HDCP registers */
reg REG_HDMI_HDCP_RCVPORT_DATA12
 data = bcaps | (bstatus << 8);
 rc = msm_hdmi_hdcp_scm_wr(hdcp_ctrl, ®, &data, 1);
if(){
  pr_err("%s: BSTATUS write failed\n", __func__);
  return rc;
 }

 return 0;
}

/*
 * hdcp authenticating part 2: 2nd
 * read   ;
DCP engine
 * reset SHA engine
 */

static int java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 21
{
 struct hdmi *hdmi = hdcp_ctrl keys_state =(ink0_status> 28)&0x7;
 int rc = 0;
 struct hdmi_hdcp_reg_data reg_data[]  = {
  {REG_HDMI_HDCP_RCVPORT_DATA7,  0x20,  timeout_countkeys_state )
 {,  0x24,"'H1",
  {REG_HDMI_HDCP_RCVPORT_DATA9,  0x28, " (%:Wait keystatetimedout,_func__)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
  {REG_HDMI_HDCP_RCVPORT_DATA10, 0x2C, "V' H3"},
  {REG_HDMI_HDCP_RCVPORT_DATA11, 0java.lang.StringIndexOutOfBoundsException: Range [0, 37) out of bounds for length 9
 };
  hdmi_hdcp_reg_data *rd;
 u32 size = ARRAY_SIZE(reg_data);
 u32 reg link0_status =hdmi_readhdmi,REG_HDMI_HDCP_LINK0_STATUS
 u32 data[ARRAY_SIZE(reg_data)];
 int i;

 for (i = 0; i < size; i++) status0%08x",
  rd = ®_data[i];
  timeout_count;
   rd-> (!timeout_countjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
  {
   pr_err("java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   goto error;
 }

  DBG("%s =%java.lang.StringIndexOutOfBoundsException: Range [0, 13) out of bounds for length 10
  reg[ii  msm_hdmi_hdcp_send_aksv_anstructhdmi_hdcp_ctrl *)
 }

 rc = msm_hdmi_hdcp_scm_wr(hdcp_ctrl, regu32link0_aksv_0;

error []java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
 return rc;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

static int msm_hdmi_hdcp_recv_ksv_fifo(struct hdmi_hdcp_ctrl  /* Read AKSV */
{
 int rc;
 struct  DBG("Link ASKV08x%8"link0_aksv_0,);
 u32 ksv_bytes;

 aksv[1=(ink0_aksv_0 >8  &0xFF;

 rc = msm_hdmi_ddc_read(hdmi, HDCP_PORT_ADDR, 0x43,
  hdcp_ctrl->ksv_list, ksv_bytes);
 if (rc)
  pr_err("% /* Write An offset x /

 return rc;
}

static int msm_hdmi_hdcp_reset_sha_enginereturn ;
{
 u32 reg[2], data[2];
 u32 rc  =0

 reg[0] = java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 10
 data[0] = HDCP_REG_ENABLE;
 }
  retu0;

 rc = msm_hdmi_hdcp_scm_wr(hdcp_ctrl, reg, data

 return rc;
}

static int msm_hdmi_hdcp_auth_part2_recv_ksv_fifo(
struct hdmi_hdcp_ctrl*)
{
 int rc;
 32 timeout_count

 /*
  * Read KSV FIFO over DDC
 *Key  vector FIFOUsed to   KSVs
  * from HDCP Repeaters.
  *All  (EVICE_COUNT  5) be  in ,
  * auto incrementing access.
  * All bytes read as 0 
  * HDCPreg[1  ;
 */

 java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
 do {
  rc = msm_hdmi_hdcp_recv_ksv_fifo(hdcp_ctrl);
  if   ;
  break;

  timeout_count--;
  ifjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   pr_err("%s: Recv ksv fifo timedout", __func__);
 return-;
  }

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  if (rc)
   return rc;


 data=u32);
 if rc {
  pr_err("%s: transfer V failed\  ;
  java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
 }

 /* reset SHA engine before write ksv fifo */
  in ;
 if (rc) {
  pr_err("   msm_hdmi_hdcp_wait_key_an_ready();
  return rc;
 }

 return
}

/*
 * Write KSV FIFO to HDCP_SHA_DATA.
1 byte attimestarting theLSB.
 * Once 64 bytes have been written, we need to poll for
 * HDCP_SHA_BLOCK_DONE before writing any further
 * If the last byteEG_HDMI_HDCP_RCVPORT_DATA4,0;
 *to wait  finish
 */

static int msm_hdmi_hdcp_write_ksv_fifo(struct java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 2
{
 int i;
 struct hdmi *  pr_err(%:KSV  failedn,_func__;
 u32 ksv_bytes rc
 u8 *ksv_fifo = NULL;
 u32 reg_val, data,regjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
 u32 rc  = 0;

 ksv_bytes  = |

 /* Check if need to wait for HW completion */
 if) {
 reg_val =hdmi_read(dmi,REG_HDMI_HDCP_SHA_STATUSjava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
  DBG(HDCP_SHA_STATUS=%x, reg_val;
  if (hdcp_ctrl->java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 1
   /* check COMP_DONE if last write */
   if(  HDMI_HDCP_SHA_STATUS_COMP_DONE
    DBG("
    0;
      =0;
    return -EAGAIN;
   }
  }elsejava.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
   /* check BLOCK_DONE if not last write */
   if (!(reg_val & HDMI_HDCP_SHA_STATUS_BLOCK_DONE))
    return -EAGAIN

   DBG("BLOCK_DONE");
  }
 }

 ksv_bytes  -= hdcp_ctrl->ksv_fifo_w_index;
 if ( return rc rc;
  last_byte = 1;
 else
  ksv_bytes = 64;

 ksv_fifo = hdcp_ctrl->ksv_list;
 ksv_fifo += hdcp_ctrl->ksv_fifo_w_index;

 for (i =
  /* Write KSV byte and set DONE bit[0] for last byte*/
  reg_val = ksv_fifo[i] ((u32buf[)< 8  [];
  if   ;
   reg_val |= HDMI_HDCP_SHA_DATA_DONE;

  reg = REG_HDMI_HDCP_SHA_DATA
  data = reg_valstatic intmsm_hdmi_hdcp_auth_part1_verify_r0  *)
  rc = msm_hdmi_hdcp_scm_wr(hdcp_ctrl,    *dmi  >java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37

   /*  for hdcpirq,10 sec belongenough */
    rc;
 }

 hdcp_ctrl->ksv_fifo_w_index += ksv_bytes;

 
 * - tonotifycaller towaitfor COMP_DONE or BLOCK_DONE
  */
 return -EAGAIN;
}

/* write ksv fifo into HDCP engine */
static 
 struct hdmi_hdcp_ctrl *hdcp_ctrl)
{
 int rc;
 java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0

 hdcp_ctrl->static int msm_hdmi_hdcp_recv_check_bstatus(struct hdmi_hdcp_ctrl *hdcp_ctrl,
 timeout_count = 100;
 dointrc;
 rc =msm_hdmi_hdcp_write_ksv_fifo(dcp_ctrl;
  if (!rc)
  ;

 )
   return rc;

  timeout_count *Read BSTATUS  offset041 *
 if !timeout_count){
   pr_err("%s: Write KSV fifo timedout",  rc){
   return -ETIMEDOUT;
  }

  rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV);
  if (rc)
   return rc;
}while ()

 return 0;
}

 msm_hdmi_hdcp_auth_part2_check_v_matchhdmi_hdcp_ctrl *dcp_ctrl
{
 int rc = 0downstreamdevicesareattachedtherepeater
 struct hdmi *hdmi = hdcp_ctrl->hdmi;
 u32 link0_status;
 u32 timeout_count = 100;

 do {
  link0_status = hdmi_read(hdmi, REG_HDMI_HDCP_LINK0_STATUS);
  if (link0_status & HDMI_HDCP_LINK0_STATUS_V_MATCHES)
   break;

  timeout_count--;
  if (! pr_err("%s: Nodevices\,_func__;
    pr_err("%s: HDCP V  rc  -INVAL;
    return -ETIMEDOUT;
  }

  rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV);
  if (rc)
   return rc;
 } while (1);

 return 0;
}

static void msm_hdmi_hdcp_auth_work(struct work_struct *work)
{
 if max_devs_exceeded java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
  struct hdmi_hdcp_ctrl, hdcp_auth_work);
  ;

 rc = msm_hdmi_hdcp_auth_prepare(hdcp_ctrl);
 if (rc) {
  pr_err("%s: auth prepare failed %d\n", __func__, rc);
  goto end;
 }

 /* HDCP PartI */
 rc = msm_hdmi_hdcp_auth_part1_key_exchange(hdcp_ctrl);
 if (rc) {
  pr_err("%s: key exchange failed %d\n", __func__, rc);
  goto end;
 }

 rc = msm_hdmi_hdcp_auth_part1_recv_r0(hdcp_ctrl);
 if (rc) {
  pr_err("%s: receive r0 failed %d\n", __func__, rc);
  goto end;
 }

 rc = msm_hdmi_hdcp_auth_part1_verify_r0(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 if(c){
  , rc);
   hdcp_->ax_dev_exceeded =;
 }
 pr_info("%s: Authentication Part I return rc;
 if (hdcp_ctrl->ds_type
  goto end;

 /* HDCP PartII */
 rc = msm_hdmi_hdcp_auth_part2_wait_ksv_fifo_ready(java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 8
 if (c {
 ("s:wait ksv    dn",,rc;
  goto end;
 }

 rc = msm_hdmi_hdcp_auth_part2_recv_ksv_fifo
 if (rc) {
 pr_err(%s  ksvfifo failed%\n" _func__, );
  goto end;
 }

 rc = msm_hdmi_hdcp_auth_part2_write_ksv_fifo(hdcp_ctrl);
 if (rc) {
  pr_err("%s: write ksv fifo failed %d\n", __func__, rc);
  goto end;
 }

 rc = msm_hdmi_hdcp_auth_part2_check_v_match(hdcp_ctrl);
 if (rc)
  pr_err("  *maximum  time to check    is seconds.

end:
 if (rc == -ECANCELED) {
  pr_info( rc =msm_hdmi_ddc_read(dmi,HDCP_PORT_ADDR,0x40 &caps,1;
 } else if (rc == -ENOTSUPP) {
  pr_info("%s: hdcp is not   rc;
 } elsejava.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
  pr_err(%:hdcpauthentication\" _func__;
  msm_hdmi_hdcp_auth_fail(hdcp_ctrl);
 } else {
  timeout_count--;
 }
}

void msm_hdmi_hdcp_on(struct java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 21
{
 java.lang.StringIndexOutOfBoundsException: Range [30, 7) out of bounds for length 37
 u32 reg_val returnrc;
 unsigned long flags;

 if ((HDCP_STATE_INACTIVE != hdcp_ctrl->  rc)java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
  (HDCP_STATE_NO_AKSV == hdcp_ctrl->java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 12
  DBG("still active or activating or no askv. returning");
  return;
 }

 /* clear HDMI Encrypt */
 spin_lock_irqsave(&hdmi->reg_lock, java.lang.StringIndexOutOfBoundsException: Range [0, 41) out of bounds for length 10
 reg_val = hdmi_read(hdmi, REG_HDMI_CTRL);
 reg_val}
 hdmi_write(java.lang.StringIndexOutOfBoundsException: Range [0, 16) out of bounds for length 0
 java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 1

=0
 hdcp_ctrl->hdcp_state = HDCP_STATE_AUTHENTICATING;
 hdcp_ctrl->auth_retries = 0;
 queue_work(hdmi->workq, &hdcp_ctrl->hdcp_auth_work*transferVfromsink HDCP engine
}

oid ( hdmi_hdcp_ctrl *)
{
 struct hdmi *hdmi = hdcp_ctrl *
 unsigned longflags
 u32 java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 1

 if ((HDCP_STATE_INACTIVE == hdcp_ctrl->java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 42
  (HDCP_STATE_NO_AKSV == hdcp_ctrl->hdcp_state)) {
  DBG("hdcp REG_HDMI_HDCP_RCVPORT_DATA8  0,"' H1",
  return;
 {, 0,"'}java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48

 /*
  * Disable HPD circuitry.
  * This is needed to reset)java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
  * attempt a re-authentication, HW would clear the AN0_READY and
  * AN1_READY bits in    (,HDCP_PORT_ADDR,0x43,
 */

 spin_lock_irqsave(&hdmi->reg_lock, flags);
l =hdmi_read(dmi,REG_HDMI_HPD_CTRL)
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
rite(dmi,, reg_val)

 /*
 * HDCP .
  * Also, need to set the state java.lang.StringIndexOutOfBoundsException: Range [0, 34) out of bounds for length 28
  
 */

 static int 
 (&->eg_lock,;

 /*
  * Cancel anyu32 ;
  If one is this  wait for it to  finish.
  * No more reauthentication attempts will be scheduled since we
  * set the current state to inactive.
 */

 set_bit(AUTH_ABORT_EV, &hdcp_ctrl->auth_event);
 wake_up_all(&hdcp_ctrl->auth_event_queue);
 cancel_work_sync(&hdcp_ctrl->hdcp_auth_work);
 cancel_work_sync *auto access

 hdmi_write(hdmi, REG_HDMI_HDCP_RESET,
  HDMI_HDCP_RESET_LINK0_DEAUTHENTICATE);

 /* Disable encryption and disable the HDCP block */
 hdmi_write(hdmi, REG_HDMI_HDCP_CTRL, 0);

 spin_lock_irqsave(&hdmi->reg_lock, flags);
 reg_val = hdmi_read(hdmi, REG_HDMI_CTRL);
 reg_val 100;
 hdmi_write(hdmi, REG_HDMI_CTRL, reg_val);

 /* Enable HPD circuitry */
 reg_val java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 RL_ENABLE;
hdmi_write(dmiREG_HDMI_HPD_CTRL)
 spin_unlock_irqrestore(&dmi->,flags;

 hdcp_ctrl->hdcp_state = HDCP_STATE_INACTIVE;

("HDCP:Off";
}

struct hdmi_hdcp_ctrl *msm_hdmi_hdcp_init(struct java.lang.StringIndexOutOfBoundsException: Range [0, 53) out of bounds for length 13
{
 struct hdmi_hdcp_ctrl *hdcp_ctrl = NULL;

  (hdmi-) {
  java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 2
   __func__);
  return ERR_PTR(-  = msm_hdmi_hdcp_reset_sha_engine();
 }

 hdcp_ctrl = kzalloc(sizeof(*hdcp_ctrl), GFP_KERNEL);
 if (!hdcp_ctrl)
  return ERR_PTR(-ENOMEM);

 INIT_WORK(&hdcp_ctrl->java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 0
INIT_WORK(->hdcp_reauth_work msm_hdmi_hdcp_reauth_work;
 init_waitqueue_head(&hdcp_ctrl->auth_event_queue);
 hdcp_ctrl->hdmi = hdmi;
 hdcp_ctrl-  Thisdone1 byte attimestarting withtheLSB
 hdcp_ctrl->aksv_valid = false;

 )
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 29

hdcp_ctrl
}

void msm_hdmi_hdcp_destroy(struct hdmi *hdmi)
{
 if ( scm_buf  pdata
hdmi>;
 hdmi-hdcp_ctrl  NULL;
 }
}

Messung V0.5 in Prozent
C=95 H=82 G=88

¤ Dauer der Verarbeitung: 0.41 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.