.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), \
.info_mask_separate_available = \
BIT(IIO_CHAN_INFO_HARDWAREGAIN), \
+ .info_mask_shared_by_all_available = \
+ BIT(IIO_CHAN_INFO_SAMP_FREQ), \
.indexed = 1, \
.channel = idx, \
.extend_name = name, \
400, 600, 800, 1000, 2000, 3000, 4000, 5000,
};
-static ssize_t sx9310_show_samp_freq_avail(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- size_t len = 0;
- int i;
-
- for (i = 0; i < ARRAY_SIZE(sx9310_samp_freq_table); i++)
- len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%d ",
- sx9310_samp_freq_table[i].val,
- sx9310_samp_freq_table[i].val2);
- buf[len - 1] = '\n';
- return len;
-}
-static IIO_DEV_ATTR_SAMP_FREQ_AVAIL(sx9310_show_samp_freq_avail);
-
static const struct regmap_range sx9310_writable_reg_ranges[] = {
regmap_reg_range(SX9310_REG_IRQ_MSK, SX9310_REG_IRQ_FUNC),
regmap_reg_range(SX9310_REG_PROX_CTRL0, SX9310_REG_PROX_CTRL19),
*length = ARRAY_SIZE(sx9310_gain_vals);
*vals = sx9310_gain_vals;
return IIO_AVAIL_LIST;
+ case IIO_CHAN_INFO_SAMP_FREQ:
+ *type = IIO_VAL_INT_PLUS_MICRO;
+ *length = ARRAY_SIZE(sx9310_samp_freq_table) * 2;
+ *vals = (int *)sx9310_samp_freq_table;
+ return IIO_AVAIL_LIST;
}
return -EINVAL;
return ret;
}
-static struct attribute *sx9310_attributes[] = {
- &iio_dev_attr_sampling_frequency_available.dev_attr.attr,
- NULL
-};
-
-static const struct attribute_group sx9310_attribute_group = {
- .attrs = sx9310_attributes,
-};
-
static const struct iio_info sx9310_info = {
- .attrs = &sx9310_attribute_group,
.read_raw = sx9310_read_raw,
.read_avail = sx9310_read_avail,
.read_event_value = sx9310_read_event_val,