int mipi_dsi_wait_and_read(struct balong_fb_data_type *balongfd, u32 *val)
{
    int err = 0;
    int is_timeout = 1;
    unsigned long dw_jiffies = 0;
    MIPIDSI_CMD_PKT_STATUS_UNION    mipidsi_cmd_pkt_status;

    /*wait dsi read data*/
    dw_jiffies = jiffies + HZ;
    do
    {
        if (!balongfd->ade_ldi_on)
        {
            /*ldi off, discard this read operation*/
            balongfb_loge("ldi off, waiting data can read.\n");
            return -1;
        }
        mipidsi_cmd_pkt_status.ul32 = get_MIPIDSI_CMD_PKT_STATUS();
        if (0x1 != mipidsi_cmd_pkt_status.bits.gen_pld_r_empty)
        {
            /*data is ready, we can read data from PLD*/
            is_timeout = 0;
            break;
        }
    } while (time_after(dw_jiffies, jiffies));

    if (is_timeout == 1)
    {
        /*read timeout*/
        balongfb_loge("dsi read timeout.\n");
        err = -1;
        return err;
    }

    //down(&balong_fb_blank_sem);
    if (balongfd->ade_ldi_on)
    {
        /*read data*/
        *val = get_MIPIDSI_GEN_PLD_DATA();
    }
    else
    {
        /*panel off, discard this read operation*/
        balongfb_loge("panel off, when reading data.\n");
        err = -1;
    }
   // up(&balong_fb_blank_sem);
    return err;
}
Пример #2
0
void mipi_dsi_sread(u32 *out)
{
    unsigned long dw_jiffies = 0;
    MIPIDSI_CMD_PKT_STATUS_UNION    mipidsi_cmd_pkt_status;


    dw_jiffies = jiffies + HZ / 2;
    do {
        mipidsi_cmd_pkt_status.ul32 = get_MIPIDSI_CMD_PKT_STATUS();
        if (0x1 == mipidsi_cmd_pkt_status.bits.gen_rd_cmd_busy) {
            break;
        }
    } while (time_after(dw_jiffies, jiffies));

    dw_jiffies = jiffies + HZ / 2;
    do {
        mipidsi_cmd_pkt_status.ul32 = get_MIPIDSI_CMD_PKT_STATUS();
        if (0x1 != mipidsi_cmd_pkt_status.bits.gen_rd_cmd_busy) {
            break;
        }
    } while (time_after(dw_jiffies, jiffies));

    *out = get_MIPIDSI_GEN_PLD_DATA();
}