mirror of
				https://github.com/DigitalDevices/dddvb.git
				synced 2025-03-01 10:35:23 +00:00 
			
		
		
		
	print the source of I2C errors
This commit is contained in:
		@@ -73,7 +73,7 @@ static int i2c_write_reg(struct i2c_adapter *adapter, u8 adr,
 | 
				
			|||||||
	struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = m, .len = 2};
 | 
						struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = m, .len = 2};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (i2c_transfer(adapter, &msg, 1) != 1) {
 | 
						if (i2c_transfer(adapter, &msg, 1) != 1) {
 | 
				
			||||||
		pr_err("Failed to write to I2C register %02x@%02x!\n",
 | 
							pr_err("cxd2099: failed to write to I2C register %02x@%02x!\n",
 | 
				
			||||||
		       reg, adr);
 | 
							       reg, adr);
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -86,7 +86,7 @@ static int i2c_write(struct i2c_adapter *adapter, u8 adr,
 | 
				
			|||||||
	struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = data, .len = len};
 | 
						struct i2c_msg msg = {.addr = adr, .flags = 0, .buf = data, .len = len};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (i2c_transfer(adapter, &msg, 1) != 1) {
 | 
						if (i2c_transfer(adapter, &msg, 1) != 1) {
 | 
				
			||||||
		pr_err("Failed to write to I2C!\n");
 | 
							pr_err("cxd2099: i2c_write error\n");
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
@@ -101,7 +101,7 @@ static int i2c_read_reg(struct i2c_adapter *adapter, u8 adr,
 | 
				
			|||||||
				   .buf = val, .len = 1} };
 | 
									   .buf = val, .len = 1} };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (i2c_transfer(adapter, msgs, 2) != 2) {
 | 
						if (i2c_transfer(adapter, msgs, 2) != 2) {
 | 
				
			||||||
		pr_err("error in i2c_read_reg\n");
 | 
							pr_err("cxd2099: i2c_read_reg error\n");
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
@@ -116,7 +116,7 @@ static int i2c_read(struct i2c_adapter *adapter, u8 adr,
 | 
				
			|||||||
				   .buf = data, .len = n} };
 | 
									   .buf = data, .len = n} };
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if (i2c_transfer(adapter, msgs, 2) != 2) {
 | 
						if (i2c_transfer(adapter, msgs, 2) != 2) {
 | 
				
			||||||
		pr_err("error in i2c_read\n");
 | 
							pr_err("cxd2099: i2c_read error\n");
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -191,13 +191,13 @@ static int read_register_unlocked(struct mxl *state, u32 reg, u32 *val)
 | 
				
			|||||||
	stat = i2cwrite(state, data,
 | 
						stat = i2cwrite(state, data,
 | 
				
			||||||
			MXL_HYDRA_REG_SIZE_IN_BYTES + MXL_HYDRA_I2C_HDR_SIZE);
 | 
								MXL_HYDRA_REG_SIZE_IN_BYTES + MXL_HYDRA_I2C_HDR_SIZE);
 | 
				
			||||||
	if (stat)
 | 
						if (stat)
 | 
				
			||||||
		pr_err("i2c read error 1\n");
 | 
							pr_err("mxl5xx: i2c read error 1\n");
 | 
				
			||||||
	if (!stat)
 | 
						if (!stat)
 | 
				
			||||||
		stat = i2cread(state, (u8 *) val,
 | 
							stat = i2cread(state, (u8 *) val,
 | 
				
			||||||
			       MXL_HYDRA_REG_SIZE_IN_BYTES);
 | 
								       MXL_HYDRA_REG_SIZE_IN_BYTES);
 | 
				
			||||||
	le32_to_cpus(val);
 | 
						le32_to_cpus(val);
 | 
				
			||||||
	if (stat)
 | 
						if (stat)
 | 
				
			||||||
		pr_err("i2c read error 2\n");
 | 
							pr_err("mxl5xx: i2c read error 2\n");
 | 
				
			||||||
	return stat;
 | 
						return stat;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -245,7 +245,7 @@ static int write_register(struct mxl *state, u32 reg, u32 val)
 | 
				
			|||||||
	stat = i2cwrite(state, data, sizeof(data));
 | 
						stat = i2cwrite(state, data, sizeof(data));
 | 
				
			||||||
	mutex_unlock(&state->base->i2c_lock);
 | 
						mutex_unlock(&state->base->i2c_lock);
 | 
				
			||||||
	if (stat)
 | 
						if (stat)
 | 
				
			||||||
		pr_err("i2c write error\n");
 | 
							pr_err("mxl5xx: i2c write error\n");
 | 
				
			||||||
	return stat;
 | 
						return stat;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -292,7 +292,7 @@ static int write_firmware_block(struct mxl *state,
 | 
				
			|||||||
			MXL_HYDRA_REG_SIZE_IN_BYTES + size);
 | 
								MXL_HYDRA_REG_SIZE_IN_BYTES + size);
 | 
				
			||||||
	mutex_unlock(&state->base->i2c_lock);
 | 
						mutex_unlock(&state->base->i2c_lock);
 | 
				
			||||||
	if (stat)
 | 
						if (stat)
 | 
				
			||||||
		pr_err("fw block write failed\n");
 | 
							pr_err("mxl5xx: fw block write failed\n");
 | 
				
			||||||
	return stat;
 | 
						return stat;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -309,14 +309,14 @@ static int read_register(struct mxl *state, u32 reg, u32 *val)
 | 
				
			|||||||
	stat = i2cwrite(state, data,
 | 
						stat = i2cwrite(state, data,
 | 
				
			||||||
			MXL_HYDRA_REG_SIZE_IN_BYTES + MXL_HYDRA_I2C_HDR_SIZE);
 | 
								MXL_HYDRA_REG_SIZE_IN_BYTES + MXL_HYDRA_I2C_HDR_SIZE);
 | 
				
			||||||
	if (stat)
 | 
						if (stat)
 | 
				
			||||||
		pr_err("i2c read error 1\n");
 | 
							pr_err("mxl5xx: i2c read error 1\n");
 | 
				
			||||||
	if (!stat)
 | 
						if (!stat)
 | 
				
			||||||
		stat = i2cread(state, (u8 *) val,
 | 
							stat = i2cread(state, (u8 *) val,
 | 
				
			||||||
			       MXL_HYDRA_REG_SIZE_IN_BYTES);
 | 
								       MXL_HYDRA_REG_SIZE_IN_BYTES);
 | 
				
			||||||
	mutex_unlock(&state->base->i2c_lock);
 | 
						mutex_unlock(&state->base->i2c_lock);
 | 
				
			||||||
	le32_to_cpus(val);
 | 
						le32_to_cpus(val);
 | 
				
			||||||
	if (stat)
 | 
						if (stat)
 | 
				
			||||||
		pr_err("i2c read error 2\n");
 | 
							pr_err("mxl5xx: i2c read error 2\n");
 | 
				
			||||||
	return stat;
 | 
						return stat;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -976,7 +976,7 @@ static int do_firmware_download(struct mxl *state, u8 *mbinBufferPtr,
 | 
				
			|||||||
	MXL_BOOL_E xcpuFwFlag = MXL_FALSE;
 | 
						MXL_BOOL_E xcpuFwFlag = MXL_FALSE;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
	if (mbinPtr->header.id != MBIN_FILE_HEADER_ID) {
 | 
						if (mbinPtr->header.id != MBIN_FILE_HEADER_ID) {
 | 
				
			||||||
		pr_err("%s: Invalid file header ID (%c)\n",
 | 
							pr_err("mxl5xx(%s): Invalid file header ID (%c)\n",
 | 
				
			||||||
		       __func__, mbinPtr->header.id);
 | 
							       __func__, mbinPtr->header.id);
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -986,7 +986,7 @@ static int do_firmware_download(struct mxl *state, u8 *mbinBufferPtr,
 | 
				
			|||||||
	segmentPtr = (MBIN_SEGMENT_T *) (&mbinPtr->data[0]);
 | 
						segmentPtr = (MBIN_SEGMENT_T *) (&mbinPtr->data[0]);
 | 
				
			||||||
	for (index = 0; index < mbinPtr->header.numSegments; index++) {
 | 
						for (index = 0; index < mbinPtr->header.numSegments; index++) {
 | 
				
			||||||
		if (segmentPtr->header.id != MBIN_SEGMENT_HEADER_ID) {
 | 
							if (segmentPtr->header.id != MBIN_SEGMENT_HEADER_ID) {
 | 
				
			||||||
			pr_err("%s: Invalid segment header ID (%c)\n",
 | 
								pr_err("mxl5xx(%s): Invalid segment header ID (%c)\n",
 | 
				
			||||||
			       __func__, segmentPtr->header.id);
 | 
								       __func__, segmentPtr->header.id);
 | 
				
			||||||
			return -EINVAL;
 | 
								return -EINVAL;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user