Skip to content

Commit

Permalink
iio: imu: inv_icm42600: add gyroscope IIO device
Browse files Browse the repository at this point in the history
Add IIO device for gyroscope sensor with data polling interface.
Attributes: raw, scale, sampling_frequency, calibbias.

Gyroscope in low noise mode.

Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
  • Loading branch information
Jean-Baptiste Maneyrol authored and Jonathan Cameron committed Jun 27, 2020
1 parent 9f9ff91 commit a095fad
Show file tree
Hide file tree
Showing 3 changed files with 613 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/iio/imu/inv_icm42600/inv_icm42600.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ struct inv_icm42600_suspended {
* @orientation: sensor chip orientation relative to main hardware.
* @conf: chip sensors configurations.
* @suspended: suspended sensors configuration.
* @indio_gyro: gyroscope IIO device.
* @buffer: data transfer buffer aligned for DMA.
*/
struct inv_icm42600_state {
struct mutex lock;
Expand All @@ -131,6 +133,8 @@ struct inv_icm42600_state {
struct iio_mount_matrix orientation;
struct inv_icm42600_conf conf;
struct inv_icm42600_suspended suspended;
struct iio_dev *indio_gyro;
uint8_t buffer[2] ____cacheline_aligned;
};

/* Virtual register addresses: @bank on MSB (4 upper bits), @address on LSB */
Expand Down Expand Up @@ -369,4 +373,6 @@ int inv_icm42600_debugfs_reg(struct iio_dev *indio_dev, unsigned int reg,
int inv_icm42600_core_probe(struct regmap *regmap, int chip,
inv_icm42600_bus_setup bus_setup);

struct iio_dev *inv_icm42600_gyro_init(struct inv_icm42600_state *st);

#endif
4 changes: 4 additions & 0 deletions drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,10 @@ int inv_icm42600_core_probe(struct regmap *regmap, int chip,
if (ret)
return ret;

st->indio_gyro = inv_icm42600_gyro_init(st);
if (IS_ERR(st->indio_gyro))
return PTR_ERR(st->indio_gyro);

/* setup runtime power management */
ret = pm_runtime_set_active(dev);
if (ret)
Expand Down
Loading

0 comments on commit a095fad

Please sign in to comment.