static int32_t sprdfb_dsi_gen_read(uint8_t *param, uint16_t param_length, uint8_t bytes_to_read, uint8_t *read_buffer)
{
	uint16_t result;
	uint32_t reg_val, reg_val_1, reg_val_2;
	result = mipi_dsih_gen_rd_cmd(&(dsi_ctx.dsi_inst), 0, param, param_length, bytes_to_read, read_buffer);

	reg_val = dispc_glb_read(SPRD_MIPI_DSIC_BASE + R_DSI_HOST_PHY_STATUS);
#ifdef FB_DSIH_VERSION_1P21A
	reg_val_1 = dispc_glb_read(SPRD_MIPI_DSIC_BASE + R_DSI_HOST_INT_ST0);
	reg_val_2 = dispc_glb_read(SPRD_MIPI_DSIC_BASE + R_DSI_HOST_INT_ST1);
#else
	reg_val_1 = dispc_glb_read(SPRD_MIPI_DSIC_BASE + R_DSI_HOST_ERROR_ST0);
	reg_val_2 = dispc_glb_read(SPRD_MIPI_DSIC_BASE + R_DSI_HOST_ERROR_ST1);
#endif
	if(0 != (reg_val & 0x2)){
		printk("sprdfb: [%s] mipi read hang (0x%x)!\n", __FUNCTION__, reg_val);
		dsi_ctx.status = 2;
		result = 0;
	}

	if(0 != (reg_val_1 & 0x701)){
		printk("sprdfb: [%s] mipi read status error!(0x%x, 0x%x)\n", __FUNCTION__, reg_val_1, reg_val_2);
		result = 0;
	}

	if(0 == result){
		printk(KERN_ERR "sprdfb: [%s] return error (%d)\n", __FUNCTION__, result);
		return -1;
	}
	return 0;
}
static int32_t sprdfb_dsi_gen_read(uint8_t *param, uint16_t param_length, uint8_t bytes_to_read, uint8_t *read_buffer)
{
	uint16_t result;
	result = mipi_dsih_gen_rd_cmd(&(dsi_ctx.dsi_inst), 0, param, param_length, bytes_to_read, read_buffer);
	if(0 == result){
		FB_PRINT("sprdfb: [%s] error (%d)\n", __FUNCTION__, result);
		return -1;
	}
	return 0;
}
Beispiel #3
0
/**
 * Send a DCS READ command to peripheral
 * @param instance pointer to structure holding the DSI Host core information
 * @param vc destination virtual channel
 * @param command DCS code
 * @param bytes_to_read no of bytes to read (expected to arrive at buffer)
 * @param read_buffer pointer to 32-bit array to hold the read buffer words
 * return read_buffer_length
 * @note this function has an active delay to wait for the buffer to clear.
 * The delay is limited to 2 x DSIH_FIFO_ACTIVE_WAIT
 * (waiting for command buffer, and waiting for receiving)
 * @note this function will enable BTA
 */
uint16_t mipi_dsih_dcs_rd_cmd(dsih_ctrl_t * instance, uint8_t vc, uint8_t command, uint8_t bytes_to_read, uint8_t* read_buffer)
{
	if (instance == 0)
	{
		return 0;
	}
	if (instance->status != INITIALIZED)
	{
		return 0;
	}
	/* COMMAND_TYPE 0x06 - DCS Read no params refer to DSI spec p.47 */
	switch (command)
	{
		case 0xA8:
		case 0xA1:
		case 0x45:
		case 0x3E:
		case 0x2E:
		case 0x0F:
		case 0x0E:
		case 0x0D:
		case 0x0C:
		case 0x0B:
		case 0x0A:
		case 0x08:
		case 0x07:
		case 0x06:
			return mipi_dsih_gen_rd_cmd(instance, vc, 0x06, 0x0, command, bytes_to_read, read_buffer);
		default:
			if (instance->log_error != 0)
			{
				instance->log_error("invalid DCS command");
				printf("command %x\n", command);
			}
			return 0;
	}
	return 0;
}