static int Ctp_it7250_tx_data(struct i2c_client *client, u8 reg,char *txData, int length)
{
#if 0
    int ret,i;
	struct i2c_adapter *adap = client->adapter;
	struct i2c_msg msg;
	
	u8 buf[128];//128
//	rk28printk("reg=0x%x txData=0x%x  \r\n",reg,*txData);
	buf[0]=reg;
	for (i=0;i<length;i++)
		{
		buf[i+1]=*txData++;
		rk28printk("buf[%d]=0x%x   ",i+1,buf[i+1]);
		}
	rk28printk("\r\n");
//	rk28printk("buf[0]=0x%x buf[1]=0x%x",buf[0],buf[1]);
	msg.addr = client->addr;
//rk28printk("i2c addr=0x%x",msg.addr);
	msg.buf =&buf[0];
	msg.len = length+1;//+1 means add the reg length;by roberts
	msg.flags = client->flags;
	msg.scl_rate = 400*1000;
    
	ret = i2c_transfer(adap, &msg, 1);
return ret;
#else
 return i2c_master_reg8_send(client, reg, txData, length, 400 * 1000);
#endif




}
BOOL i2c_write_byte( BYTE address,BYTE offset,BYTE byteno,BYTE *p_data,BYTE device )
{
	if(i2c_master_reg8_send(it66121->client, offset, p_data, byteno, IT66121_I2C_RATE) == byteno)
		return true;
	else
		return false;
}
static int bq3060_write(struct i2c_client *client, u8 reg, u8 const buf[], unsigned len)
{
    int ret;
    ///return 0;
    ret = i2c_master_reg8_send(client, reg, buf, (int)len, bq3060_SPEED);
    return ret;
}
Exemple #4
0
static int mma7660_tx_data(struct i2c_client *client, char *txData, int length)
{
	int ret = 0;
	char reg = txData[0];
	ret = i2c_master_reg8_send(client, reg, &txData[1], length-1, MMA7660_SPEED);
	return (ret > 0)? 0 : ret;
}
Exemple #5
0
int reg_send_data(struct i2c_client *client, const char start_reg,
				const char *buf, int count, unsigned int scl_rate)
{
    int ret; 
    
    ret = i2c_master_reg8_send(client, start_reg, buf, (int)count, 20*1000);
    return ret;  
}
Exemple #6
0
static int bq27541_write(struct i2c_client *client, u8 reg, u8 const buf[], unsigned len)
{
	int ret; 
	mutex_lock(&g_bq27541_mutex);
	ret = i2c_master_reg8_send(client, reg, buf, (int)len, BQ27510_SPEED);
	mutex_unlock(&g_bq27541_mutex);
	return ret;
}
static int lis3dh_tx_data(struct i2c_client *client, char *txData, int length)
{
	int liRet	= 0;
	char lcReg	= txData[0];
	liRet = i2c_master_reg8_send(client, lcReg, &txData[1], length-1, LIS3DH_SPEED);
	
	return (liRet > 0)? 0 : liRet;
}
Exemple #8
0
static int rk1000_control_probe(struct i2c_client *client,
			const struct i2c_device_id *id)
{
    int ret;
	struct clk *iis_clk;
	struct rkdisplay_platform_data *tv_data;
	/* reg[0x00] = 0x88, --> ADC_CON
	   reg[0x01] = 0x0d, --> CODEC_CON
	   reg[0x02] = 0x22, --> I2C_CON
	   reg[0x03] = 0x00, --> TVE_CON
	 */
	char data[4] = {0x88, 0x0d, 0x22, 0x00};
	
    printk("rk1000_control_probe\n");
    
    iis_clk = clk_get_sys("rk29_i2s.0", "i2s");
	if (IS_ERR(iis_clk)) {
		printk("failed to get i2s clk\n");
		ret = PTR_ERR(iis_clk);
	}else{
		DBG("got i2s clk ok!\n");
		clk_enable(iis_clk);
		clk_set_rate(iis_clk, 11289600);
		#ifdef CONFIG_ARCH_RK29
		rk29_mux_api_set(GPIO2D0_I2S0CLK_MIIRXCLKIN_NAME, GPIO2H_I2S0_CLK);
		#else
		rk30_mux_api_set(GPIO0B0_I2S8CHCLK_NAME, GPIO0B_I2S_8CH_CLK);
		#endif
		clk_put(iis_clk);
	}
    
    if(client->dev.platform_data) {
		tv_data = client->dev.platform_data;
		if(tv_data->io_reset_pin != INVALID_GPIO) {
	    	ret = gpio_request(tv_data->io_reset_pin, "rk1000 reset");
		    if (ret){   
		        printk("rk1000_control_probe request gpio fail\n");
		        //goto err1;
		    }
		    
		    gpio_set_value(tv_data->io_reset_pin, GPIO_LOW);
		    gpio_direction_output(tv_data->io_reset_pin, GPIO_LOW);
		    mdelay(2);
		    gpio_set_value(tv_data->io_reset_pin, GPIO_HIGH);
		}
	}
    
    rk1000_control_client = client;

#ifdef CONFIG_SND_SOC_RK1000
    data[1] = 0x00;
#endif

	ret = i2c_master_reg8_send(client,0,data, 4, 20 * 1000);
	
	printk("rk1000_control_probe ok\n");
    return 0;
}
static char rk610_hdmi_i2c_write_reg(char reg, char val)
{
	if(i2c_master_reg8_send(rk610_hdmi->client, reg, &val, 1, 100*1000) > 0)
		return 0;
	else {
		printk(KERN_ERR "[%s] write reg %02x error\n", __FUNCTION__, reg);
		return -EINVAL;
	}
}
/* set the gt801 registe,used i2c bus*/
static int gt801_write_regs(struct i2c_client *client, u8 reg, u8 const buf[], unsigned short len)
{
	int ret;
	ret = i2c_master_reg8_send(client,reg, buf, len, 200*1000);
 	if (ret < 0) {
	  printk("gt801_ts_work_func:i2c_transfer fail =%d\n",ret);
    }
	return ret;
}
Exemple #11
0
static int m41t62_i2c_set_regs(struct i2c_client *client, u8 reg, u8 const buf[], __u16 len)
{
	int ret; 
	ret = i2c_master_reg8_send(client, reg, buf, (int)len, RTC_SPEED);
	if(ret < 0)
	{
		printk("%s error>>>>>\n",__func__);
	}
	return ret;
}
Exemple #12
0
int ch7025_write_reg(char reg, char value)
{
	if(ch7025.client == NULL)
		return -1;
	
	if (i2c_master_reg8_send(ch7025.client, reg, &value, 1, CH7025_I2C_RATE) > 0)
		return 0;
	else
		return -1;
}
Exemple #13
0
int Colorado_send_msg(unsigned char addr, unsigned char *buf, unsigned short len, unsigned short rw_flag)
{
	int rc;
	char data = 0;
	g_client-> addr = addr;
	if(rw_flag)
	{
//		rc=i2c_smbus_read_byte_data(g_client, *buf);
		rc = i2c_master_reg8_recv(g_client, *buf, &data, 1, 100000);
//		D("Colorado_send_msg read addr 0x%02x reg 0x%x data 0x%x\n", addr << 1, *buf, data);
		*buf = data;
//		*buf = rc;
		
	} else
	{
//		rc=i2c_smbus_write_byte_data(g_client, buf[0], buf[1]);
//		D("Colorado_send_msg send addr 0x%02x reg 0x%x data 0x%x\n", addr << 1, buf[0], buf[1]);
		rc = i2c_master_reg8_send(g_client, buf[0], &(buf[1]), 1, 100000);	
	}
//	D("------\n");	
	return 0;
}
Exemple #14
0
int rk1000_control_write_block(u8 addr, u8 *buf, u8 len)
{
	int i;
	int ret = 0;
	struct i2c_client *client;
    
    client = rk1000_control_client;

	if(client == NULL){
		printk("rk1000_tv_i2c_client not init!\n");
		return -1;
	}

	for(i=0; i<len; i++){
		ret = i2c_master_reg8_send(client, addr+i, buf+i, 1 ,200*1000);
		if(ret != 1){
			printk("rk1000_control_set_reg err, addr=0x%.x, val=0x%.x", addr+i, buf[i]);
			break;
		}
	}

	return ret;
}
static int smb347_write(struct i2c_client *client,const char reg, char *buf, int len)
{
	int ret; 
	ret = i2c_master_reg8_send(client, reg, buf, len, SMB347_SPEED);
	return ret;
}
static int hym8563_i2c_set_regs(struct i2c_client *client, u8 reg, u8 const buf[], __u16 len)
{
	int ret; 
	ret = i2c_master_reg8_send(client, reg, buf, (int)len, RTC_SPEED);
	return ret;
}
static int cw_write_word(struct i2c_client *client, u8 reg, u8 const buf[])
{
        int ret;
        ret = i2c_master_reg8_send(client, reg, buf, 2, CW_I2C_SPEED);
        return ret;
}
/* set the it7260 registe,used i2c bus*/
static int ft5406_set_regs(struct i2c_client *client, u8 reg, u8 const buf[], unsigned short len)
{
	int ret; 
	ret = i2c_master_reg8_send(client, reg, buf, (int)len, FT5406_IIC_SPEED);
	return ret;
}
Exemple #19
0
int anx7150_i2c_write_p0_reg(struct i2c_client *client, char reg, char *val)
{
	client->addr = ANX7150_I2C_ADDR0;
	return i2c_master_reg8_send(client, reg, val, 1, ANX7150_SCL_RATE) > 0? 0: HDMI_ERROR_I2C;
}
static int vga_edid_i2c_set_regs(struct i2c_client *client, u8 reg, u8 const buf[], __u16 len)
{
	int ret; 
	ret = i2c_master_reg8_send(client, reg, buf, (int)len, DDC_I2C_RATE);
	return ret;
}
static int rk610_write_p0_reg(struct i2c_client *client, char reg, char *val)
{
	return i2c_master_reg8_send(client, reg, val, 1, 100*1000) > 0? 0: -EINVAL;
}
Exemple #22
0
static int tca6424_write_three_reg(struct i2c_client *client, const char reg, const char *buf, int count, int rate)
{
	int ret = -1;
	ret = i2c_master_reg8_send(client, reg, buf, count, rate);
	return (ret>0)?0:ret;
}
Exemple #23
0
static int rk610_hdmi_i2c_write_reg(char reg, char val)
{
	return i2c_master_reg8_send(rk610_hdmi->client, reg, &val, 1, 100*1000) > 0? 0: -EINVAL;
}