コード例 #1
0
/*
 * Novatek panel will reply with  MAX_RETURN_PACKET_SIZE bytes of data
 * plus DCS header, ECC and CRC for DCS long read response
 * currently, we set MAX_RETURN_PAKET_SIZE to 4 to align with 32 bits
 * register
 * currently, only MAX_RETURN_PACKET_SIZE (4) bytes per read
 */
int mipi_dsi_cmds_rx(struct dsi_buf *tp, struct dsi_buf *rp,
                     struct dsi_cmd_desc *cmds, int len)
{
    int cnt, res;

    if (len <= 2)
        cnt = 4;	/* short read */
    else
        cnt = MIPI_DSI_MRPS + 6; /* long read, 4 bytes header + 2 bytes crc */

    if (cnt > MIPI_DSI_REG_LEN) {
        PR_DISP_INFO("%s: len=%d too long\n", __func__, len);
        return -ERANGE;
    }

    res = cnt & 0x03;

    cnt += res;	/* 4 byte align */

    mipi_dsi_buf_init(tp);
    mipi_dsi_cmd_dma_add(tp, cmds);

    dsi_mutex_lock();
    dsi_busy_check();

    mipi_dsi_enable_irq();
    /* transmit read comamnd to client */
    mipi_dsi_cmd_dma_tx(tp);
    /*
     * once cmd_dma_done interrupt received,
     * return data from client is ready and stored
     * at RDBK_DATA register already
     */
    mipi_dsi_buf_reserve(rp, res);
    mipi_dsi_cmd_dma_rx(rp, cnt);

    mipi_dsi_disable_irq();
    dsi_mutex_unlock();

    /* strip off dcs read header & crc */
    rp->data += (4 + res);
    rp->len -= (6 + res);

    return len;
}
コード例 #2
0
/*
 * Novatek panel will reply with  MAX_RETURN_PACKET_SIZE bytes of data
 * plus DCS header, ECC and CRC for DCS long read response
 * currently, we set MAX_RETURN_PAKET_SIZE to 4 to align with 32 bits
 * register
 * currently, only MAX_RETURN_PACKET_SIZE (4) bytes per read
 *
 * ov_mutex need to be acquired before call this function.
 */
int mipi_dsi_cmds_rx(struct msm_fb_data_type *mfd,
			struct dsi_buf *tp, struct dsi_buf *rp,
			struct dsi_cmd_desc *cmds, int len)
{
	int cnt, res;

	if (len <= 2)
		cnt = 4;	/* short read */
	else
		cnt = MIPI_DSI_MRPS + 6; /* 4 bytes header + 2 bytes crc */

	if (cnt > MIPI_DSI_REG_LEN) {
		pr_debug("%s: len=%d too long\n", __func__, len);
		return -ERANGE;
	}

	res = cnt & 0x03;

	cnt += res;	/* 4 byte align */

	mipi_dsi_buf_init(tp);
	mipi_dsi_cmd_dma_add(tp, cmds);

	/* make sure mdp dma is not txing pixel data */
	if (mfd->panel_info.type == MIPI_CMD_PANEL)
		mdp4_dsi_cmd_dma_busy_wait(mfd);

	/* transmit read comamnd to client */
	mipi_dsi_cmd_dma_tx(tp);
	/*
	 * once cmd_dma_done interrupt received,
	 * return data from client is ready and stored
	 * at RDBK_DATA register already
	 */
	mipi_dsi_buf_reserve(rp, res);
	mipi_dsi_cmd_dma_rx(rp, cnt);

	/* strip off dcs read header & crc */
	rp->data += (4 + res);
	rp->len -= (6 + res);

	return len;
}
コード例 #3
0
char *mipi_dsi_buf_reserve_hdr(struct dsi_buf *dp, int hlen)
{
	dp->hdr = (uint32 *)dp->data;
	return mipi_dsi_buf_reserve(dp, hlen);
}