Exemplo n.º 1
0
static int mddi_r61581_lcd_off(struct platform_device *pdev)
{
	MDDI_MSG_DEBUG("[MDDI] turning r61581 off\n");

	if (r61581_initialized)
		mddi_r61581_sleep(1);

	return 0;
}
Exemplo n.º 2
0
static int mddi_r61581_lcd_on(struct platform_device *pdev)
{
	MDDI_MSG_DEBUG("[MDDI] turning r61581 on\n");
	if (r61581_initialized) {
		mddi_r61581_sleep(0);
	} else {
		mddi_r61581_hw_reset();

		mddi_wait(10);

		serigo(0x00B0, 1, "\x0", TRUE);
		serigo(0x00B3, 4, "\x02\x00\x00\x00", TRUE);
		serigo(0x00B4, 1, "\x00", TRUE);
		serigo(0x00C0, 8, "\x03\x3B\x00\x02\x00\x01\x00\x43", TRUE);
		serigo(0x00C1, 4, "\x08\x17\x08\x08", TRUE);

		serigo(0x00C4, 4, "\x22\x02\x00\x00", TRUE);
		serigo(0x00C8, 20, "\x09\x08\x10\x85\x07\x08\x16\x05\x00\x32"
			"\x05\x16\x08\x88\x09\x10\x09\x04\x32\x00", TRUE);

		serigo(0x002A, 4, "\x00\x00\x01\x3F", TRUE);
		serigo(0x002B, 4, "\x00\x00\x01\xDF", TRUE);
		serigo(0x0035, 1, "\x00", TRUE);
		serigo(0x003A, 1, "\x66", TRUE);
		serigo(0x0044, 2, "\x00\x01", TRUE);
		serigo(0x002C, 0, "\x00", TRUE);
		serigo(0x0011, 0, "\x00", TRUE);

		mddi_wait(150);

		serigo(0x00D0, 4, "\x07\x07\x16\x72", TRUE);
		serigo(0x00D1, 3, "\x03\x3A\x0A", TRUE);
		serigo(0x00D2, 3, "\x02\x44\x04", TRUE);
		serigo(0x0029, 0, "\x00", TRUE);
		serigo(0x002C, 0, "\x00", TRUE);

		mddi_wait(10);
		r61581_initialized = TRUE;
	}
	return 0;
}
Exemplo n.º 3
0
int mddi_host_register_read(uint32 reg_addr,
     uint32 *reg_value_ptr, boolean wait, mddi_host_type host) {
	mddi_linked_list_type *curr_llist_ptr;
	mddi_register_access_packet_type *regacc_pkt_ptr;
	uint16 curr_llist_idx;
	int ret = 0;

	if (in_interrupt())
		MDDI_MSG_CRIT("Called from ISR context\n");

	if (!mddi_host_powered) {
		MDDI_MSG_ERR("MDDI powered down!\n");
		mddi_init();
	}

	down(&mddi_host_mutex);

	mddi_reg_read_value_ptr = reg_value_ptr;
	curr_llist_idx = mddi_get_reg_read_llist_item(host, TRUE);
	if (curr_llist_idx == UNASSIGNED_INDEX) {
		up(&mddi_host_mutex);

		/* need to change this to some sort of wait */
		MDDI_MSG_ERR("Attempting to queue up more than 1 reg read\n");
		return -EINVAL;
	}

	curr_llist_ptr = &llist_extern[host][curr_llist_idx];
	curr_llist_ptr->link_controller_flags = 0x11;
	curr_llist_ptr->packet_header_count = 14;
	curr_llist_ptr->packet_data_count = 0;

	curr_llist_ptr->next_packet_pointer = NULL;
	curr_llist_ptr->packet_data_pointer = NULL;
	curr_llist_ptr->reserved = 0;

	regacc_pkt_ptr = &curr_llist_ptr->packet_header.register_pkt;

	regacc_pkt_ptr->packet_length = curr_llist_ptr->packet_header_count;
	regacc_pkt_ptr->packet_type = 146;	/* register access packet */
	regacc_pkt_ptr->bClient_ID = 0;
	regacc_pkt_ptr->read_write_info = 0x8001;
	regacc_pkt_ptr->register_address = reg_addr;

	/* now adjust pointers */
	mddi_queue_forward_packets(curr_llist_idx, curr_llist_idx, wait,
				   NULL, host);
	/* need to check if we can write the pointer or not */

	up(&mddi_host_mutex);

	if (wait) {
		int wait_ret;

		mddi_linked_list_notify_type *llist_notify_ptr;
		llist_notify_ptr = &llist_extern_notify[host][curr_llist_idx];
		wait_ret = wait_for_completion_timeout(
					&(llist_notify_ptr->done_comp), 5 * HZ);

		if (wait_ret <= 0)
			ret = -EBUSY;

		if (wait_ret < 0)
//			printk(KERN_ERR "%s: failed to wait for completion!\n",
;
		else if (!wait_ret)
;
	}

	MDDI_MSG_DEBUG("Reg Read value=0x%x\n", *reg_value_ptr);

	return ret;
}				/* mddi_host_register_read */
Exemplo n.º 4
0
int mddi_host_register_write(uint32 reg_addr,
     uint32 reg_val, enum mddi_data_packet_size_type packet_size,
     boolean wait, mddi_llist_done_cb_type done_cb, mddi_host_type host) {
	mddi_linked_list_type *curr_llist_ptr;
	mddi_linked_list_type *curr_llist_dma_ptr;
	mddi_register_access_packet_type *regacc_pkt_ptr;
	uint16 curr_llist_idx;
	int ret = 0;

	if (in_interrupt())
		MDDI_MSG_CRIT("Called from ISR context\n");

	if (!mddi_host_powered) {
		MDDI_MSG_ERR("MDDI powered down!\n");
		mddi_init();
	}

	down(&mddi_host_mutex);

	curr_llist_idx = mddi_get_next_free_llist_item(host, TRUE);
	curr_llist_ptr = &llist_extern[host][curr_llist_idx];
	curr_llist_dma_ptr = &llist_dma_extern[host][curr_llist_idx];

	curr_llist_ptr->link_controller_flags = 1;
	curr_llist_ptr->packet_header_count = 14;
	curr_llist_ptr->packet_data_count = 4;

	curr_llist_ptr->next_packet_pointer = NULL;
	curr_llist_ptr->reserved = 0;

	regacc_pkt_ptr = &curr_llist_ptr->packet_header.register_pkt;

	regacc_pkt_ptr->packet_length = curr_llist_ptr->packet_header_count +
					(uint16)packet_size;
	regacc_pkt_ptr->packet_type = 146;	/* register access packet */
	regacc_pkt_ptr->bClient_ID = 0;
	regacc_pkt_ptr->read_write_info = 0x0001;
	regacc_pkt_ptr->register_address = reg_addr;
	regacc_pkt_ptr->register_data_list = reg_val;

	MDDI_MSG_DEBUG("Reg Access write reg=0x%x, value=0x%x\n",
		       regacc_pkt_ptr->register_address,
		       regacc_pkt_ptr->register_data_list);

	regacc_pkt_ptr = &curr_llist_dma_ptr->packet_header.register_pkt;
	curr_llist_ptr->packet_data_pointer =
	    (void *)(&regacc_pkt_ptr->register_data_list);

	/* now adjust pointers */
	mddi_queue_forward_packets(curr_llist_idx, curr_llist_idx, wait,
				   done_cb, host);

	up(&mddi_host_mutex);

	if (wait) {
		int wait_ret;

		mddi_linked_list_notify_type *llist_notify_ptr;
		llist_notify_ptr = &llist_extern_notify[host][curr_llist_idx];
		wait_ret = wait_for_completion_timeout(
					&(llist_notify_ptr->done_comp), 5 * HZ);

		if (wait_ret <= 0)
			ret = -EBUSY;

		if (wait_ret < 0)
//			printk(KERN_ERR "%s: failed to wait for completion!\n",
;
		else if (!wait_ret)
;
	}

	return ret;
}				/* mddi_host_register_write */
Exemplo n.º 5
0
int mddi_host_register_multiwrite(uint32 reg_addr,
	uint32 *value_list_ptr,
	uint32 value_count, boolean wait, mddi_llist_done_cb_type done_cb,
	mddi_host_type host)
{
	mddi_linked_list_type *curr_llist_ptr;
	mddi_linked_list_type *curr_llist_dma_ptr;
	mddi_register_access_packet_type *regacc_pkt_ptr;
	uint16 curr_llist_idx;
	int ret = 0;

	if (!value_list_ptr || !value_count ||
		value_count > MDDI_HOST_MAX_CLIENT_REG_IN_SAME_ADDR) {
		MDDI_MSG_ERR("\n Invalid value_list or value_count");
		return -EINVAL;
	}

	if (in_interrupt())
		MDDI_MSG_CRIT("Called from ISR context\n");

	if (!mddi_host_powered) {
		MDDI_MSG_ERR("MDDI powered down!\n");
		mddi_init();
	}

	down(&mddi_host_mutex);

	curr_llist_idx = mddi_get_next_free_llist_item(host, TRUE);
	curr_llist_ptr = &llist_extern[host][curr_llist_idx];
	curr_llist_dma_ptr = &llist_dma_extern[host][curr_llist_idx];

	curr_llist_ptr->link_controller_flags = 1;
	curr_llist_ptr->packet_header_count = 14;
	curr_llist_ptr->packet_data_count =
		(uint16)(value_count * 4);

	curr_llist_ptr->next_packet_pointer = NULL;
	curr_llist_ptr->reserved = 0;

	regacc_pkt_ptr = &curr_llist_ptr->packet_header.register_pkt;

	regacc_pkt_ptr->packet_length = curr_llist_ptr->packet_header_count
		+ curr_llist_ptr->packet_data_count;
	regacc_pkt_ptr->packet_type = 146;	/* register access packet */
	regacc_pkt_ptr->bClient_ID = 0;
	regacc_pkt_ptr->read_write_info = value_count;
	regacc_pkt_ptr->register_address = reg_addr;
	memcpy((void *)&regacc_pkt_ptr->register_data_list[0], value_list_ptr,
		   curr_llist_ptr->packet_data_count);

/*< DTS2011090102706 jiaoshuangwei 20110901 begin */
#ifdef CONFIG_HUAWEI_KERNEL
/* qualcomm offer patch */
   regacc_pkt_ptr = &curr_llist_dma_ptr->packet_header.register_pkt; 
#endif
/* DTS2011090102706 jiaoshuangwei 20110901 end >*/
	curr_llist_ptr->packet_data_pointer =
		(void *)(&regacc_pkt_ptr->register_data_list[0]);
	MDDI_MSG_DEBUG("Reg Access write reg=0x%x, value=0x%x\n",
		       regacc_pkt_ptr->register_address,
		       regacc_pkt_ptr->register_data_list[0]);

	/* now adjust pointers */
	mddi_queue_forward_packets(curr_llist_idx, curr_llist_idx, wait,
				   done_cb, host);

	up(&mddi_host_mutex);

	if (wait) {
		int wait_ret;

		mddi_linked_list_notify_type *llist_notify_ptr;
		llist_notify_ptr = &llist_extern_notify[host][curr_llist_idx];
		wait_ret = wait_for_completion_timeout(
					&(llist_notify_ptr->done_comp), 5 * HZ);

		if (wait_ret <= 0)
			ret = -EBUSY;

		if (wait_ret < 0)
			printk(KERN_ERR "%s: failed to wait for completion!\n",
				__func__);
		else if (!wait_ret)
			printk(KERN_ERR "%s: Timed out waiting!\n", __func__);
	}

	return ret;
}
Exemplo n.º 6
0
void mddi_host_register_write16( 
  uint32 reg_addr, 
  uint32 reg_val0, 
  uint32 reg_val1, 
  uint32 reg_val2, 
  uint32 reg_val3, 
  uint32 reg_nbrs, 
  boolean wait, mddi_llist_done_cb_type done_cb, mddi_host_type host) { 
  mddi_linked_list_type *curr_llist_ptr; 
  mddi_linked_list_type *curr_llist_dma_ptr; 
  mddi_register_access_packet_type *regacc_pkt_ptr; 
  uint16 curr_llist_idx; 
 
  if (in_interrupt()) 
    MDDI_MSG_CRIT("Called from ISR context\n"); 
 
  if (!mddi_host_powered) { 
    MDDI_MSG_ERR("MDDI powered down!\n"); 
    mddi_init(); 
  } 
 
  down(&mddi_host_mutex); 
 
  curr_llist_idx = mddi_get_next_free_llist_item(host, TRUE); 
  curr_llist_ptr = &llist_extern[host][curr_llist_idx]; 
  curr_llist_dma_ptr = &llist_dma_extern[host][curr_llist_idx]; 
 
  curr_llist_ptr->link_controller_flags = 1; 
  curr_llist_ptr->packet_header_count = 14; 
  curr_llist_ptr->packet_data_count = reg_nbrs*4; 
 
  curr_llist_ptr->next_packet_pointer = NULL; 
  curr_llist_ptr->reserved = 0; 
 
  regacc_pkt_ptr = &curr_llist_ptr->packet_header.register_pkt; 
  regacc_pkt_ptr->packet_length = curr_llist_ptr->packet_header_count + curr_llist_ptr->packet_data_count; 
  regacc_pkt_ptr->packet_type = 146;  /* register access packet */ 
  regacc_pkt_ptr->bClient_ID = 0; 
  regacc_pkt_ptr->read_write_info = reg_nbrs; 
  regacc_pkt_ptr->register_address = reg_addr; 
  regacc_pkt_ptr->register_data_list[0] = reg_val0; 
  regacc_pkt_ptr->register_data_list_ext[0] = reg_val1; 
  regacc_pkt_ptr->register_data_list_ext[1] = reg_val2; 
  regacc_pkt_ptr->register_data_list_ext[2] = reg_val3; 
 
  MDDI_MSG_DEBUG("Reg Access write reg=0x%x, value=0x%x\n", 
    regacc_pkt_ptr->register_address, 
    regacc_pkt_ptr->register_data_list[0]); 
 
  regacc_pkt_ptr = &curr_llist_dma_ptr->packet_header.register_pkt; 
  curr_llist_ptr->packet_data_pointer = (void *)(&regacc_pkt_ptr->register_data_list); 
 
  /* now adjust pointers */ 
  mddi_queue_forward_packets(curr_llist_idx, curr_llist_idx, wait, done_cb, host); 
 
  up(&mddi_host_mutex); 
 
  if (wait) { 
    mddi_linked_list_notify_type *llist_notify_ptr; 
    llist_notify_ptr = &llist_extern_notify[host][curr_llist_idx]; 
    wait_for_completion_interruptible(&(llist_notify_ptr->done_comp)); 
  } 
}
Exemplo n.º 7
0
void mddi_host_register_write_xl( 
  uint32 reg_addr, 
  uint32 *reg_val_ext,  /* array of register data */ 
  uint32 reg_nbrs, 
  boolean wait, mddi_llist_done_cb_type done_cb, mddi_host_type host) { 
  mddi_linked_list_type *curr_llist_ptr; 
  mddi_linked_list_type *curr_llist_dma_ptr; 
  mddi_register_access_packet_xl_type *regacc_pkt_ptr; 
  uint16 curr_llist_idx; 
  uint16 idx_values = 0; 
 
  if (in_interrupt()) +    MDDI_MSG_CRIT("Called from ISR context\n"); 
 
  if (!mddi_host_powered) { 
    MDDI_MSG_ERR("MDDI powered down!\n"); 
    mddi_init(); 
  } 
 
  down(&mddi_host_mutex); 
 
  curr_llist_idx = mddi_get_next_free_llist_item(host, TRUE); 
  curr_llist_ptr = &llist_extern[host][curr_llist_idx]; 
  curr_llist_dma_ptr = &llist_dma_extern[host][curr_llist_idx]; 
 
  curr_llist_ptr->link_controller_flags = 1; 
  curr_llist_ptr->packet_header_count = 14; 
  curr_llist_ptr->packet_data_count = reg_nbrs*4; 
 
  curr_llist_ptr->next_packet_pointer = NULL; 
  curr_llist_ptr->reserved = 0; 
 
  regacc_pkt_ptr = &curr_llist_ptr->packet_header.register_xl_pkt; 
 
  regacc_pkt_ptr->packet_length = curr_llist_ptr->packet_header_count + 
    curr_llist_ptr->packet_data_count; 
  regacc_pkt_ptr->packet_type = 146;  /* register access packet */ 
  regacc_pkt_ptr->bClient_ID = 0; 
  regacc_pkt_ptr->read_write_info = reg_nbrs; 
  regacc_pkt_ptr->register_address = reg_addr; 
  regacc_pkt_ptr->register_data_list = reg_val_ext[0]; 
 
  /* Handle multiple parameter writes to a single register */ 
  if ((reg_nbrs > 1) && (reg_nbrs <= MDDI_ACCESS_PKT_REG_DATA_EXT)) { 
    for (idx_values = 1; idx_values < reg_nbrs; idx_values++) { 
      regacc_pkt_ptr->register_data_list_ext[idx_values - 1] = 
        reg_val_ext[idx_values]; 
    } 
  } 
 
  MDDI_MSG_DEBUG("Reg Access write reg=0x%x, value=0x%x\n", 
    regacc_pkt_ptr->register_address, 
    regacc_pkt_ptr->register_data_list); 
 
  regacc_pkt_ptr = &curr_llist_dma_ptr->packet_header.register_xl_pkt; 
  curr_llist_ptr->packet_data_pointer = (void *)(&regacc_pkt_ptr->register_data_list); 
 
  /* now adjust pointers */ 
  mddi_queue_forward_packets(curr_llist_idx, curr_llist_idx, wait, done_cb, host); 
 
  up(&mddi_host_mutex); 
 
  if (wait) { 
    mddi_linked_list_notify_type *llist_notify_ptr; 
    llist_notify_ptr = &llist_extern_notify[host][curr_llist_idx]; 
    wait_for_completion_interruptible(&(llist_notify_ptr->done_comp)); 
  } 
} 
void mddi_host_register_cmds_write32(unsigned reg_addr, unsigned count, unsigned int reg_val[], boolean wait, mddi_llist_done_cb_type done_cb, mddi_host_type host)
{
	mddi_linked_list_type *curr_llist_ptr;
	mddi_linked_list_type *curr_llist_dma_ptr;
	mddi_register_access_packet_type *regacc_pkt_ptr;
	unsigned curr_llist_idx;

	unsigned *data_list;
	unsigned i;

	MDDI_MSG_DEBUG("%s: started.\n", __func__);

	if (in_interrupt()) {
		MDDI_MSG_CRIT("Called from ISR context\n");
	}

	if (!mddi_host_powered) {
		MDDI_MSG_ERR("MDDI powered down!\n");
		mddi_init();
	}

	down(&mddi_host_mutex);

	curr_llist_idx = mddi_get_next_free_llist_item(host, TRUE);
	curr_llist_ptr = &llist_extern[host][curr_llist_idx];
	curr_llist_dma_ptr = &llist_dma_extern[host][curr_llist_idx];

	curr_llist_ptr->link_controller_flags = 1;
	curr_llist_ptr->packet_header_count = 14;
	curr_llist_ptr->packet_data_count = count << 2;

	curr_llist_ptr->next_packet_pointer = NULL;
	curr_llist_ptr->reserved = 0;

	regacc_pkt_ptr = &curr_llist_ptr->packet_header.register_pkt;
	
	regacc_pkt_ptr->packet_length = curr_llist_ptr->packet_header_count + (count << 2);
	regacc_pkt_ptr->packet_type = 146;	/* register access packet */
	regacc_pkt_ptr->bClient_ID = 0;
	regacc_pkt_ptr->read_write_info = count;
	regacc_pkt_ptr->register_address = reg_addr;

	data_list = (unsigned *)&regacc_pkt_ptr->register_data_list;

	for (i = 0; i < count; i++) {
		data_list[i] = reg_val[i];
	}
	
	MDDI_MSG_DEBUG("Reg Access write reg=0x%x, value=0x%x\n",
		       (unsigned int)regacc_pkt_ptr->register_address,
		       (unsigned int)regacc_pkt_ptr->register_data_list);

	regacc_pkt_ptr = &curr_llist_dma_ptr->packet_header.register_pkt;
	curr_llist_ptr->packet_data_pointer =
	    (void *)(&regacc_pkt_ptr->register_data_list);

	/* now adjust pointers */
	mddi_queue_forward_packets(curr_llist_idx, curr_llist_idx, wait,
				   done_cb, host);

	up(&mddi_host_mutex);

	if (wait) {
		mddi_linked_list_notify_type *llist_notify_ptr;
		llist_notify_ptr = &llist_extern_notify[host][curr_llist_idx];
		wait_for_completion_interruptible(&
						  (llist_notify_ptr->
						   done_comp));
	}

} /* mddi_host_register_cmds_write32 */
void mddi_host_register_cmds_write8(unsigned reg_addr, unsigned count, unsigned char reg_val[], boolean wait, mddi_llist_done_cb_type done_cb, mddi_host_type host)
{
	mddi_linked_list_type *curr_llist_ptr;
	mddi_linked_list_type *curr_llist_dma_ptr;
	mddi_register_access_packet_type *regacc_pkt_ptr;
	unsigned curr_llist_idx;

    unsigned *data_list;
    unsigned data32, count32;
    unsigned i;
	
	if (in_interrupt()) {
		MDDI_MSG_CRIT("Called from ISR context\n");
	}

	if (!mddi_host_powered) {
		MDDI_MSG_ERR("MDDI powered down!\n");
		mddi_init();
	}

	count32 = (count + 3) / 4;

	down(&mddi_host_mutex);

	curr_llist_idx = mddi_get_next_free_llist_item(host, TRUE);
	curr_llist_ptr = &llist_extern[host][curr_llist_idx];
	curr_llist_dma_ptr = &llist_dma_extern[host][curr_llist_idx];

	curr_llist_ptr->link_controller_flags = 1;
	curr_llist_ptr->packet_header_count = 14;
	curr_llist_ptr->packet_data_count = count32 * 4;

	curr_llist_ptr->next_packet_pointer = NULL;
	curr_llist_ptr->reserved = 0;

	regacc_pkt_ptr = &curr_llist_ptr->packet_header.register_pkt;
	
	regacc_pkt_ptr->packet_length = curr_llist_ptr->packet_header_count + (count32 * 4);
	regacc_pkt_ptr->packet_type = 146;	/* register access packet */
	regacc_pkt_ptr->bClient_ID = 0;
	regacc_pkt_ptr->read_write_info = count32;
	regacc_pkt_ptr->register_address = reg_addr;
		
	data_list = (unsigned *)&regacc_pkt_ptr->register_data_list;
	
	for(i = 0; i < count32; i++) {
		data32 = *((unsigned*)(reg_val + (i * 4)));
		*(data_list + i) = data32;
		MDDI_MSG_DEBUG("Mddi command packet data: 0x%x\n", data32);
	}

	regacc_pkt_ptr = &curr_llist_dma_ptr->packet_header.register_pkt;
	curr_llist_ptr->packet_data_pointer =
	    (void *)(&regacc_pkt_ptr->register_data_list);

	/* now adjust pointers */
	mddi_queue_forward_packets(curr_llist_idx, curr_llist_idx, wait,
				   done_cb, host);

	up(&mddi_host_mutex);

	if (wait) {
		mddi_linked_list_notify_type *llist_notify_ptr;
		llist_notify_ptr = &llist_extern_notify[host][curr_llist_idx];
		wait_for_completion_interruptible(&
						  (llist_notify_ptr->
						   done_comp));
	}

} /* mddi_host_register_cmds_write8 */
Exemplo n.º 10
0
boolean mddi_video_stream_black_display(uint32 x0, uint32 y0,
			uint32 width, uint32 height, mddi_host_type host)
{
	uint32 row = 0;
	uint32 depth = 16;
	uint32 rows_per_block = 16;
	size_t pixelbytes_per_row = width * (depth / 8);
	dma_addr_t  pixeldata_dma_addr;
	void *pixeldata_ptr;

	if (in_interrupt())
		return FALSE;
	if (!mddi_host_powered)
		return FALSE;

	pixeldata_ptr = dma_alloc_coherent(NULL,
					pixelbytes_per_row * rows_per_block,
					&pixeldata_dma_addr, GFP_KERNEL);

	if (pixeldata_ptr != NULL) {
		int wait_ret = 0;
		boolean wait = FALSE;
		uint16 curr_llist_idx = UNASSIGNED_INDEX;
		mddi_linked_list_notify_type *llist_notify_ptr;

		memset(pixeldata_ptr, 0 /* black */,
			pixelbytes_per_row * rows_per_block);

		MDDI_MSG_DEBUG("%s: mutex down\n", __func__);
		down(&mddi_host_mutex);

		while (height > row) {
			mddi_linked_list_type *curr_llist_ptr;
			mddi_linked_list_type *curr_llist_dma_ptr;
			mddi_video_stream_packet_type *video_pkt_ptr;

			/* always wait for a new available llist item */
			curr_llist_idx =
				mddi_get_next_free_llist_item(host, TRUE);
			curr_llist_ptr = &llist_extern[host][curr_llist_idx];
			curr_llist_dma_ptr =
				&llist_dma_extern[host][curr_llist_idx];
			curr_llist_ptr->link_controller_flags = 1;
			curr_llist_ptr->packet_header_count = 26;
			curr_llist_ptr->packet_data_count =
				pixelbytes_per_row * rows_per_block;
			curr_llist_ptr->next_packet_pointer = NULL;
			curr_llist_ptr->reserved = 0;

			/* video stream packet */
			video_pkt_ptr =
				&curr_llist_ptr->packet_header.video_pkt;
			video_pkt_ptr->packet_length =
				curr_llist_ptr->packet_header_count +
				curr_llist_ptr->packet_data_count;
			video_pkt_ptr->packet_type = 0x10;
			video_pkt_ptr->bClient_ID = 0;
			video_pkt_ptr->video_data_format_descriptor = 0x5565;
			video_pkt_ptr->pixel_data_attributes = 0x00C3;
			video_pkt_ptr->x_left_edge = x0;
			video_pkt_ptr->y_top_edge = y0;
			video_pkt_ptr->x_right_edge = x0 + width - 1;
			video_pkt_ptr->y_bottom_edge = y0 + height - 1;
			video_pkt_ptr->x_start = 0;
			video_pkt_ptr->y_start = row;
			video_pkt_ptr->pixel_count = width * rows_per_block;
			video_pkt_ptr->parameter_CRC = 0;
			curr_llist_ptr->packet_data_pointer =
				(void *)pixeldata_dma_addr;
			MDDI_MSG_DEBUG("row=%d, idx=%d\n",
				 row, curr_llist_idx);

			row += rows_per_block;

			/* need to wait for the last packet to finish */
			if (row >= height)
				wait = TRUE;

			/* add a packet to the queue */
			mddi_queue_forward_packets(curr_llist_idx,
				curr_llist_idx, wait, NULL, host);
		}
		up(&mddi_host_mutex);
		MDDI_MSG_DEBUG("%s: mutex up\n", __func__);

		llist_notify_ptr =
			&llist_extern_notify[host][curr_llist_idx];
		wait_ret = wait_for_completion_timeout(
			&(llist_notify_ptr->done_comp), 5 * HZ);

		dma_free_coherent(NULL,
			pixelbytes_per_row * rows_per_block,
			pixeldata_ptr,
			pixeldata_dma_addr);

		if (wait_ret <= 0)
			return FALSE;

		MDDI_MSG_DEBUG("%s: finished ok!\n", __func__);
		return TRUE;
	} else {
		return FALSE;
	}
}