ms5637.c (8c125f5f325e5caf171f6af95b7cfe7f3e3ba78b) | ms5637.c (07498719bedecc8be1ecc62ea50315e91a668cac) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * ms5637.c - Support for Measurement-Specialties MS5637, MS5805 4 * MS5837 and MS8607 pressure & temperature sensor 5 * 6 * Copyright (c) 2015 Measurement-Specialties 7 * 8 * (7-bit I2C slave address 0x76) --- 22 unchanged lines hidden (view full) --- 31#include "../common/ms_sensors/ms_sensors_i2c.h" 32 33struct ms_tp_data { 34 const char *name; 35 const struct ms_tp_hw_data *hw; 36}; 37 38static const int ms5637_samp_freq[6] = { 960, 480, 240, 120, 60, 30 }; | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * ms5637.c - Support for Measurement-Specialties MS5637, MS5805 4 * MS5837 and MS8607 pressure & temperature sensor 5 * 6 * Copyright (c) 2015 Measurement-Specialties 7 * 8 * (7-bit I2C slave address 0x76) --- 22 unchanged lines hidden (view full) --- 31#include "../common/ms_sensors/ms_sensors_i2c.h" 32 33struct ms_tp_data { 34 const char *name; 35 const struct ms_tp_hw_data *hw; 36}; 37 38static const int ms5637_samp_freq[6] = { 960, 480, 240, 120, 60, 30 }; |
39/* String copy of the above const for readability purpose */ 40static const char ms5637_show_samp_freq[] = "960 480 240 120 60 30"; | |
41 | 39 |
40static ssize_t ms5637_show_samp_freq(struct device *dev, struct device_attribute *attr, char *buf) 41{ 42 struct iio_dev *indio_dev = dev_to_iio_dev(dev); 43 struct ms_tp_dev *dev_data = iio_priv(indio_dev); 44 int i, len = 0; 45 46 for (i = 0; i <= dev_data->hw->max_res_index; i++) 47 len += sysfs_emit_at(buf, len, "%u ", ms5637_samp_freq[i]); 48 sysfs_emit_at(buf, len - 1, "\n"); 49 50 return len; 51} 52 |
|
42static int ms5637_read_raw(struct iio_dev *indio_dev, 43 struct iio_chan_spec const *channel, int *val, 44 int *val2, long mask) 45{ 46 int ret; 47 int temperature; 48 unsigned int pressure; 49 struct ms_tp_dev *dev_data = iio_priv(indio_dev); --- 59 unchanged lines hidden (view full) --- 109 }, 110 { 111 .type = IIO_PRESSURE, 112 .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), 113 .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), 114 } 115}; 116 | 53static int ms5637_read_raw(struct iio_dev *indio_dev, 54 struct iio_chan_spec const *channel, int *val, 55 int *val2, long mask) 56{ 57 int ret; 58 int temperature; 59 unsigned int pressure; 60 struct ms_tp_dev *dev_data = iio_priv(indio_dev); --- 59 unchanged lines hidden (view full) --- 120 }, 121 { 122 .type = IIO_PRESSURE, 123 .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), 124 .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), 125 } 126}; 127 |
117static IIO_CONST_ATTR_SAMP_FREQ_AVAIL(ms5637_show_samp_freq); | 128static IIO_DEV_ATTR_SAMP_FREQ_AVAIL(ms5637_show_samp_freq); |
118 119static struct attribute *ms5637_attributes[] = { | 129 130static struct attribute *ms5637_attributes[] = { |
120 &iio_const_attr_sampling_frequency_available.dev_attr.attr, | 131 &iio_dev_attr_sampling_frequency_available.dev_attr.attr, |
121 NULL, 122}; 123 124static const struct attribute_group ms5637_attribute_group = { 125 .attrs = ms5637_attributes, 126}; 127 128static const struct iio_info ms5637_info = { --- 107 unchanged lines hidden --- | 132 NULL, 133}; 134 135static const struct attribute_group ms5637_attribute_group = { 136 .attrs = ms5637_attributes, 137}; 138 139static const struct iio_info ms5637_info = { --- 107 unchanged lines hidden --- |