static int mhl_chip_init(void) { /* Read the chip rev ID */ mhl_msm_state->chip_rev_id = mhl_i2c_reg_read(TX_PAGE_L0, 0x04); pr_debug("MHL: chip rev ID read=[%x]\n", mhl_msm_state->chip_rev_id); /* Reset the TX chip */ mhl_sii_reset_pin(1); msleep(20); mhl_sii_reset_pin(0); msleep(20); mhl_sii_reset_pin(1); /* MHL spec requires a 100 ms wait here. */ msleep(100); /* * Need to disable MHL discovery */ mhl_init_reg_settings(true); /* * Power down the chip to the * D3 - a low power standby mode * cable impedance measurement logic is operational */ switch_mode(POWER_STATE_D3); return 0; }
static int mhl_tx_chip_init(struct mhl_tx_ctrl *mhl_ctrl) { uint8_t chip_rev_id = 0x00; struct i2c_client *client = mhl_ctrl->i2c_handle; unsigned long flags; spin_lock_irqsave(&mhl_ctrl->lock, flags); mhl_ctrl->dwnstream_hpd = 0; mhl_ctrl->tx_powered_off = false; spin_unlock_irqrestore(&mhl_ctrl->lock, flags); /* Reset the TX chip */ mhl_sii_reset_pin(mhl_ctrl, 0); msleep(20); mhl_sii_reset_pin(mhl_ctrl, 1); /* TX PR-guide requires a 100 ms wait here */ msleep(100); /* Read the chip rev ID */ chip_rev_id = MHL_SII_PAGE0_RD(0x04); pr_debug("MHL: chip rev ID read=[%x]\n", chip_rev_id); mhl_ctrl->chip_rev_id = chip_rev_id; /* * Need to disable MHL discovery if * MHL-USB handshake is implemented */ mhl_init_reg_settings(mhl_ctrl, true); switch_mode(mhl_ctrl, POWER_STATE_D3, true); return 0; }
static int mhl_tx_chip_init(struct mhl_tx_ctrl *mhl_ctrl) { uint8_t chip_rev_id = 0x00; struct i2c_client *client = mhl_ctrl->i2c_handle; /* Reset the TX chip */ mhl_sii_reset_pin(mhl_ctrl, 0); msleep(20); mhl_sii_reset_pin(mhl_ctrl, 1); /* TX PR-guide requires a 100 ms wait here */ msleep(100); /* Read the chip rev ID */ chip_rev_id = MHL_SII_PAGE0_RD(0x04); pr_debug("MHL: chip rev ID read=[%x]\n", chip_rev_id); mhl_ctrl->chip_rev_id = chip_rev_id; /* * Need to disable MHL discovery if * MHL-USB handshake is implemented */ mhl_init_reg_settings(mhl_ctrl, true); switch_mode(mhl_ctrl, POWER_STATE_D3); return 0; }
/* USB_HANDSHAKING FUNCTIONS */ static int mhl_sii_device_discovery(void *data, int id, void (*usb_notify_cb)(int online)) { int rc; struct mhl_tx_ctrl *mhl_ctrl = data; if (id) { /* When MHL cable is disconnected we get a sii8334 * mhl_disconnect interrupt which is handled separately. */ pr_debug("%s: USB ID pin high\n", __func__); return id; } if (!mhl_ctrl || !usb_notify_cb) { pr_warn("%s: cb || ctrl is NULL\n", __func__); /* return "USB" so caller can proceed */ return -EINVAL; } if (!mhl_ctrl->notify_usb_online) mhl_ctrl->notify_usb_online = usb_notify_cb; if (!mhl_ctrl->disc_enabled) { mhl_sii_reset_pin(mhl_ctrl, 0); msleep(50); mhl_sii_reset_pin(mhl_ctrl, 1); /* TX PR-guide requires a 100 ms wait here */ msleep(100); mhl_init_reg_settings(mhl_ctrl, true); rc = mhl_sii_wait_for_rgnd(mhl_ctrl); } else { if (mhl_ctrl->cur_state == POWER_STATE_D3) { rc = mhl_sii_wait_for_rgnd(mhl_ctrl); } else { /* in MHL mode */ pr_debug("%s:%u\n", __func__, __LINE__); rc = 0; } } pr_debug("%s: ret result: %s\n", __func__, rc ? "usb" : " mhl"); return rc; }
static int mhl_chip_init(void) { mhl_msm_state->chip_rev_id = mhl_i2c_reg_read(TX_PAGE_L0, 0x04); pr_debug("MHL: chip rev ID read=[%x]\n", mhl_msm_state->chip_rev_id); mhl_sii_reset_pin(1); msleep(20); mhl_sii_reset_pin(0); msleep(20); mhl_sii_reset_pin(1); msleep(100); mhl_init_reg_settings(true); switch_mode(POWER_STATE_D3); return 0; }