* @version_names: version letters or namings
* @volatile_reg: device-specific volatile registers
* @volatile_reg_qty: quantity of device-specific volatile registers
+ * @scaling_val2: scaling value for IIO_CHAN_INFO_SCALE
*/
struct yas5xx_chip_info {
unsigned int devid;
char *version_names[2];
const int *volatile_reg;
int volatile_reg_qty;
+ u32 scaling_val2;
};
/**
}
return IIO_VAL_INT;
case IIO_CHAN_INFO_SCALE:
- switch (ci->devid) {
- case YAS530_DEVICE_ID:
- /*
- * Raw values of YAS530 are in picotesla. Divide by
- * 100000000 (10^8) to get Gauss.
- */
- *val = 1;
- *val2 = 100000000;
- break;
- case YAS532_DEVICE_ID:
- /*
- * Raw values of YAS532 are in nanotesla. Divide by
- * 100000 (10^5) to get Gauss.
- */
- *val = 1;
- *val2 = 100000;
- break;
- default:
- dev_err(yas5xx->dev, "unknown device type\n");
- return -EINVAL;
- }
+ *val = 1;
+ *val2 = ci->scaling_val2;
return IIO_VAL_FRACTIONAL;
default:
/* Unknown request */
.version_names = { "A", "B" },
.volatile_reg = yas530_volatile_reg,
.volatile_reg_qty = ARRAY_SIZE(yas530_volatile_reg),
+ .scaling_val2 = 100000000, /* picotesla to Gauss */
},
[yas532] = {
.devid = YAS532_DEVICE_ID,
.version_names = { "AB", "AC" },
.volatile_reg = yas530_volatile_reg,
.volatile_reg_qty = ARRAY_SIZE(yas530_volatile_reg),
+ .scaling_val2 = 100000, /* nanotesla to Gauss */
},
[yas533] = {
.devid = YAS532_DEVICE_ID,
.version_names = { "AB", "AC" },
.volatile_reg = yas530_volatile_reg,
.volatile_reg_qty = ARRAY_SIZE(yas530_volatile_reg),
+ .scaling_val2 = 100000, /* nanotesla to Gauss */
},
};