ret = i2c_smbus_read_byte_data(chip->client, reg);
if (ret < 0) {
dev_err(&chip->client->dev,
- "failed to read. err=%x\n", ret);
+ "%s: failed to read from register %x: %d\n",
+ __func__, reg, ret);
goto out_unlock;
}
/* note: lux is 31 bit max at this point */
if (ch1lux > ch0lux) {
- dev_dbg(&chip->client->dev, "ch1lux > ch0lux-return last value\n");
+ dev_dbg(&chip->client->dev,
+ "%s: ch1lux > ch0lux; returning last value\n",
+ __func__);
ret = chip->als_cur_info.lux;
goto out_unlock;
}
return -ERANGE;
chip->settings.als_gain_trim = ret;
- dev_info(&chip->client->dev,
- "%s als_calibrate completed\n", chip->client->name);
return ret;
}
*/
for (i = 0, dev_reg = chip->tsl2x7x_config;
i < TSL2X7X_MAX_CONFIG_REG; i++) {
- ret = i2c_smbus_write_byte_data(chip->client,
- TSL2X7X_CMD_REG + i,
+ int reg = TSL2X7X_CMD_REG + i;
+
+ ret = i2c_smbus_write_byte_data(chip->client, reg,
*dev_reg++);
if (ret < 0) {
dev_err(&chip->client->dev,
- "failed on write to reg %d.\n", i);
+ "%s: failed to write to register %x: %d\n",
+ __func__, reg, ret);
return ret;
}
}
*/
n = value[0];
if ((n % 3) || n < 6 ||
- n > ((ARRAY_SIZE(chip->tsl2x7x_device_lux) - 1) * 3)) {
- dev_info(dev, "LUX TABLE INPUT ERROR 1 Value[0]=%d\n", n);
+ n > ((ARRAY_SIZE(chip->tsl2x7x_device_lux) - 1) * 3))
return -EINVAL;
- }
- if ((value[(n - 2)] | value[(n - 1)] | value[n]) != 0) {
- dev_info(dev, "LUX TABLE INPUT ERROR 2 Value[0]=%d\n", n);
+ if ((value[(n - 2)] | value[(n - 1)] | value[n]) != 0)
return -EINVAL;
- }
if (chip->tsl2x7x_chip_status == TSL2X7X_CHIP_WORKING) {
ret = tsl2x7x_chip_off(indio_dev);
chip->settings.persistence &= 0xF0;
chip->settings.persistence |=
(filter_delay & 0x0F);
- dev_info(&chip->client->dev, "%s: ALS persistence = %d",
- __func__, filter_delay);
} else {
chip->settings.persistence &= 0x0F;
chip->settings.persistence |=
((filter_delay << 4) & 0xF0);
- dev_info(&chip->client->dev,
- "%s: Proximity persistence = %d",
- __func__, filter_delay);
}
ret = 0;
break;
case IIO_CHAN_INFO_INT_TIME:
chip->settings.als_time =
TSL2X7X_MAX_TIMER_CNT - (val2 / TSL2X7X_MIN_ITIME);
-
- dev_info(&chip->client->dev, "%s: als time = %d",
- __func__, chip->settings.als_time);
break;
default:
return -EINVAL;
ret = i2c_smbus_write_byte(clientp, TSL2X7X_CMD_REG | TSL2X7X_CNTRL);
if (ret < 0) {
- dev_err(&clientp->dev, "write to cmd reg failed. err = %d\n",
- ret);
+ dev_err(&clientp->dev,
+ "%s: Failed to write to CMD register: %d\n",
+ __func__, ret);
return ret;
}
indio_dev);
if (ret) {
dev_err(&clientp->dev,
- "%s: irq request failed", __func__);
+ "%s: irq request failed\n", __func__);
return ret;
}
}
return ret;
}
- dev_info(&clientp->dev, "%s Light sensor found.\n", id->name);
-
return 0;
}