Lines Matching +full:6 +full:- +full:axis
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Freescale MMA7660FC 3-Axis Accelerometer
7 * IIO driver for Freescale MMA7660FC; 7-bit I2C address: 0x4c.
21 #define MMA7660_REG_OUT_BIT_ALERT BIT(6)
32 * -1.5g - +1.5g (6-bit, signed)
34 * scale = (1.5 + 1.5) * 9.81 / (2^6 - 1) = 0.467142857
41 #define MMA7660_CHANNEL(reg, axis) { \ argument
45 .channel2 = IIO_MOD_##axis, \
82 struct i2c_client *client = data->client; in mma7660_set_mode()
84 if (mode == data->mode) in mma7660_set_mode()
89 dev_err(&client->dev, "failed to read sensor mode\n"); in mma7660_set_mode()
103 dev_err(&client->dev, "failed to change sensor mode\n"); in mma7660_set_mode()
107 data->mode = mode; in mma7660_set_mode()
115 struct i2c_client *client = data->client; in mma7660_read_accel()
127 dev_err(&client->dev, "register read failed\n"); in mma7660_read_accel()
130 } while (retries-- > 0 && ret & MMA7660_REG_OUT_BIT_ALERT); in mma7660_read_accel()
133 dev_err(&client->dev, "all register read retries failed\n"); in mma7660_read_accel()
134 return -ETIMEDOUT; in mma7660_read_accel()
149 mutex_lock(&data->lock); in mma7660_read_raw()
150 ret = mma7660_read_accel(data, chan->address); in mma7660_read_raw()
151 mutex_unlock(&data->lock); in mma7660_read_raw()
161 return -EINVAL; in mma7660_read_raw()
164 return -EINVAL; in mma7660_read_raw()
179 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data)); in mma7660_probe()
181 dev_err(&client->dev, "iio allocation failed!\n"); in mma7660_probe()
182 return -ENOMEM; in mma7660_probe()
186 data->client = client; in mma7660_probe()
188 mutex_init(&data->lock); in mma7660_probe()
189 data->mode = MMA7660_MODE_STANDBY; in mma7660_probe()
191 indio_dev->info = &mma7660_info; in mma7660_probe()
192 indio_dev->name = MMA7660_DRIVER_NAME; in mma7660_probe()
193 indio_dev->modes = INDIO_DIRECT_MODE; in mma7660_probe()
194 indio_dev->channels = mma7660_channels; in mma7660_probe()
195 indio_dev->num_channels = ARRAY_SIZE(mma7660_channels); in mma7660_probe()
203 dev_err(&client->dev, "device_register failed\n"); in mma7660_probe()
279 MODULE_DESCRIPTION("Freescale MMA7660FC 3-Axis Accelerometer driver");