diff mbox series

[v2,1/1] Added tilt interrupt support in inv_icm42600

Message ID 20231116134528.21467-1-hiten.chauhan@siliconsignals.io (mailing list archive)
State Superseded
Headers show
Series [v2,1/1] Added tilt interrupt support in inv_icm42600 | expand

Commit Message

Hiten Chauhan Nov. 16, 2023, 1:45 p.m. UTC
Description:
Add new device attribute to enable and disable
Tilt interrupt from kernel user space

Signed-off-by: Hiten Chauhan <hiten.chauhan@siliconsignals.io>

Comments

kernel test robot Nov. 16, 2023, 6:23 p.m. UTC | #1
Hi Hiten,

kernel test robot noticed the following build errors:

[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on linus/master v6.7-rc1 next-20231116]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Hiten-Chauhan/Added-tilt-interrupt-support-in-inv_icm42600/20231116-214808
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20231116134528.21467-1-hiten.chauhan%40siliconsignals.io
patch subject: [PATCH v2 1/1] Added tilt interrupt support in inv_icm42600
config: arm-randconfig-001-20231117 (https://download.01.org/0day-ci/archive/20231117/202311170235.HaVJnmWa-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231117/202311170235.HaVJnmWa-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311170235.HaVJnmWa-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

>> drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c:117:61: error: macro "DEVICE_ATTR_RW" passed 4 arguments, but takes just 1
     117 |                    tilt_interrupt_show, tilt_interrupt_store);
         |                                                             ^
   In file included from drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c:7:
   include/linux/device.h:179: note: macro "DEVICE_ATTR_RW" defined here
     179 | #define DEVICE_ATTR_RW(_name) \
         | 
>> drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c:116:8: error: type defaults to 'int' in declaration of 'DEVICE_ATTR_RW' [-Werror=implicit-int]
     116 | static DEVICE_ATTR_RW(tilt_interrupt, 0644,
         |        ^~~~~~~~~~~~~~
>> drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c:120:10: error: 'dev_attr_tilt_interrupt' undeclared here (not in a function)
     120 |         &dev_attr_tilt_interrupt.attr,
         |          ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c:116:8: warning: 'DEVICE_ATTR_RW' defined but not used [-Wunused-variable]
     116 | static DEVICE_ATTR_RW(tilt_interrupt, 0644,
         |        ^~~~~~~~~~~~~~
>> drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c:82:16: warning: 'tilt_interrupt_store' defined but not used [-Wunused-function]
      82 | static ssize_t tilt_interrupt_store(struct device *dev,
         |                ^~~~~~~~~~~~~~~~~~~~
>> drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c:65:16: warning: 'tilt_interrupt_show' defined but not used [-Wunused-function]
      65 | static ssize_t tilt_interrupt_show(struct device *dev,
         |                ^~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/DEVICE_ATTR_RW +117 drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c

   > 7	#include <linux/device.h>
     8	#include <linux/mutex.h>
     9	#include <linux/pm_runtime.h>
    10	#include <linux/regmap.h>
    11	#include <linux/delay.h>
    12	#include <linux/math64.h>
    13	
    14	#include <linux/iio/buffer.h>
    15	#include <linux/iio/common/inv_sensors_timestamp.h>
    16	#include <linux/iio/iio.h>
    17	#include <linux/iio/kfifo_buf.h>
    18	
    19	#include "inv_icm42600.h"
    20	#include "inv_icm42600_temp.h"
    21	#include "inv_icm42600_buffer.h"
    22	
    23	#define INV_ICM42600_ACCEL_CHAN(_modifier, _index, _ext_info)		\
    24		{								\
    25			.type = IIO_ACCEL,					\
    26			.modified = 1,						\
    27			.channel2 = _modifier,					\
    28			.info_mask_separate =					\
    29				BIT(IIO_CHAN_INFO_RAW) |			\
    30				BIT(IIO_CHAN_INFO_CALIBBIAS),			\
    31			.info_mask_shared_by_type =				\
    32				BIT(IIO_CHAN_INFO_SCALE),			\
    33			.info_mask_shared_by_type_available =			\
    34				BIT(IIO_CHAN_INFO_SCALE) |			\
    35				BIT(IIO_CHAN_INFO_CALIBBIAS),			\
    36			.info_mask_shared_by_all =				\
    37				BIT(IIO_CHAN_INFO_SAMP_FREQ),			\
    38			.info_mask_shared_by_all_available =			\
    39				BIT(IIO_CHAN_INFO_SAMP_FREQ),			\
    40			.scan_index = _index,					\
    41			.scan_type = {						\
    42				.sign = 's',					\
    43				.realbits = 16,					\
    44				.storagebits = 16,				\
    45				.endianness = IIO_BE,				\
    46			},							\
    47			.ext_info = _ext_info,					\
    48		}
    49	
    50	uint8_t inv_icm42605_int_reg;
    51	
    52	enum inv_icm42600_accel_scan {
    53		INV_ICM42600_ACCEL_SCAN_X,
    54		INV_ICM42600_ACCEL_SCAN_Y,
    55		INV_ICM42600_ACCEL_SCAN_Z,
    56		INV_ICM42600_ACCEL_SCAN_TEMP,
    57		INV_ICM42600_ACCEL_SCAN_TIMESTAMP,
    58	};
    59	
    60	static const struct iio_chan_spec_ext_info inv_icm42600_accel_ext_infos[] = {
    61		IIO_MOUNT_MATRIX(IIO_SHARED_BY_ALL, inv_icm42600_get_mount_matrix),
    62		{},
    63	};
    64	
  > 65	static ssize_t tilt_interrupt_show(struct device *dev,
    66				       struct device_attribute *attr, char *buf)
    67	{
    68		struct inv_icm42600_state *st = dev_get_drvdata(dev);
    69		unsigned int val;
    70		int ret;
    71	
    72		ret = regmap_read(st->map, inv_icm42605_int_reg, &val);
    73	
    74		if (ret != 0)
    75			return ret;
    76	
    77		snprintf(buf, PAGE_SIZE, "Read reg %x value %x\n", inv_icm42605_int_reg, val);
    78	
    79		return strlen(buf);
    80	}
    81	
  > 82	static ssize_t tilt_interrupt_store(struct device *dev,
    83			struct device_attribute *attr, const char *buf,
    84			size_t count)
    85	{
    86		struct inv_icm42600_state *st = dev_get_drvdata(dev);
    87		int ret;
    88		int value;
    89	
    90		if (!st)
    91			return -EINVAL;
    92	
    93		if (kstrtoint(buf, 10, &value))
    94			return -EINVAL;
    95	
    96		inv_icm42605_int_reg = INV_ICM42605_REG_INT_STATUS3;
    97	
    98		switch (value) {
    99		case 1:
   100			ret = inv_icm42605_generate_tilt_interrupt(st);
   101			if (ret != 0)
   102				return -EIO;
   103			break;
   104		case 0:
   105			ret = inv_icm42605_disable_tilt_interrupt(st);
   106			if (ret != 0)
   107				return -EIO;
   108			break;
   109		default:
   110			return -EINVAL;
   111		}
   112	
   113		return count;
   114	}
   115	
 > 116	static DEVICE_ATTR_RW(tilt_interrupt, 0644,
 > 117			   tilt_interrupt_show, tilt_interrupt_store);
   118	
   119	static struct attribute *icm42605_attrs[] = {
 > 120		&dev_attr_tilt_interrupt.attr,
   121		NULL,
   122	};
   123
kernel test robot Nov. 20, 2023, 1:54 p.m. UTC | #2
Hi Hiten,

kernel test robot noticed the following build errors:

[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on linus/master v6.7-rc2 next-20231120]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Hiten-Chauhan/Added-tilt-interrupt-support-in-inv_icm42600/20231116-214808
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20231116134528.21467-1-hiten.chauhan%40siliconsignals.io
patch subject: [PATCH v2 1/1] Added tilt interrupt support in inv_icm42600
config: i386-randconfig-062-20231120 (https://download.01.org/0day-ci/archive/20231120/202311202146.D4gNcBnT-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231120/202311202146.D4gNcBnT-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311202146.D4gNcBnT-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c:116:39: error: too many arguments provided to function-like macro invocation
   static DEVICE_ATTR_RW(tilt_interrupt, 0644,
                                         ^
   include/linux/device.h:179:9: note: macro 'DEVICE_ATTR_RW' defined here
   #define DEVICE_ATTR_RW(_name) \
           ^
>> drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c:116:8: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
   static DEVICE_ATTR_RW(tilt_interrupt, 0644,
   ~~~~~~ ^
   int
>> drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c:120:3: error: use of undeclared identifier 'dev_attr_tilt_interrupt'
           &dev_attr_tilt_interrupt.attr,
            ^
   3 errors generated.


vim +116 drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c

   115	
 > 116	static DEVICE_ATTR_RW(tilt_interrupt, 0644,
   117			   tilt_interrupt_show, tilt_interrupt_store);
   118	
   119	static struct attribute *icm42605_attrs[] = {
 > 120		&dev_attr_tilt_interrupt.attr,
   121		NULL,
   122	};
   123
Hiten Chauhan Nov. 20, 2023, 2:05 p.m. UTC | #3
Hi @kernel test robot

I have already updated suggestions in my patch v3   "[PATCH v3] Added tilt interrupt support in inv_icm42600"


From: kernel test robot <lkp@intel.com>
Sent: Monday, November 20, 2023 7:24 PM
To: Hiten Chauhan <hiten.chauhan@siliconsignals.io>; jmaneyrol@invensense.com <jmaneyrol@invensense.com>; jic23@kernel.org <jic23@kernel.org>; lars@metafoo.de <lars@metafoo.de>; linux-iio@vger.kernel.org <linux-iio@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>
Cc: oe-kbuild-all@lists.linux.dev <oe-kbuild-all@lists.linux.dev>; Hiten Chauhan <hiten.chauhan@siliconsignals.io>
Subject: Re: [PATCH v2 1/1] Added tilt interrupt support in inv_icm42600 
 
Hi Hiten,

kernel test robot noticed the following build errors:

[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on linus/master v6.7-rc2 next-20231120]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Hiten-Chauhan/Added-tilt-interrupt-support-in-inv_icm42600/20231116-214808
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20231116134528.21467-1-hiten.chauhan%40siliconsignals.io
patch subject: [PATCH v2 1/1] Added tilt interrupt support in inv_icm42600
config: i386-randconfig-062-20231120 (https://download.01.org/0day-ci/archive/20231120/202311202146.D4gNcBnT-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231120/202311202146.D4gNcBnT-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311202146.D4gNcBnT-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c:116:39: error: too many arguments provided to function-like macro invocation
   static DEVICE_ATTR_RW(tilt_interrupt, 0644,
                                         ^
   include/linux/device.h:179:9: note: macro 'DEVICE_ATTR_RW' defined here
   #define DEVICE_ATTR_RW(_name) \
           ^
>> drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c:116:8: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
   static DEVICE_ATTR_RW(tilt_interrupt, 0644,
   ~~~~~~ ^
   int
>> drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c:120:3: error: use of undeclared identifier 'dev_attr_tilt_interrupt'
           &dev_attr_tilt_interrupt.attr,
            ^
   3 errors generated.


vim +116 drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c

   115  
 > 116   static DEVICE_ATTR_RW(tilt_interrupt, 0644,
   117                     tilt_interrupt_show, tilt_interrupt_store);
   118  
   119  static struct attribute *icm42605_attrs[] = {
 > 120           &dev_attr_tilt_interrupt.attr,
   121          NULL,
   122  };
   123
diff mbox series

Patch

diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600.h b/drivers/iio/imu/inv_icm42600/inv_icm42600.h
index 0e290c807b0f..39ed39e77deb 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600.h
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600.h
@@ -187,6 +187,8 @@  struct inv_icm42600_state {
 #define INV_ICM42600_FIFO_CONFIG_STOP_ON_FULL		\
 		FIELD_PREP(INV_ICM42600_FIFO_CONFIG_MASK, 2)
 
+#define INV_ICM42600_REG_MASK        GENMASK(7, 0)
+
 /* all sensor data are 16 bits (2 registers wide) in big-endian */
 #define INV_ICM42600_REG_TEMP_DATA			0x001D
 #define INV_ICM42600_REG_ACCEL_DATA_X			0x001F
@@ -239,6 +241,7 @@  struct inv_icm42600_state {
 #define INV_ICM42600_REG_PWR_MGMT0			0x004E
 #define INV_ICM42600_PWR_MGMT0_TEMP_DIS			BIT(5)
 #define INV_ICM42600_PWR_MGMT0_IDLE			BIT(4)
+#define INV_ICM42600_PWR_ACCEL_MODE			BIT(1)
 #define INV_ICM42600_PWR_MGMT0_GYRO(_mode)		\
 		FIELD_PREP(GENMASK(3, 2), (_mode))
 #define INV_ICM42600_PWR_MGMT0_ACCEL(_mode)		\
@@ -306,6 +309,21 @@  struct inv_icm42600_state {
 #define INV_ICM42600_WHOAMI_ICM42622			0x46
 #define INV_ICM42600_WHOAMI_ICM42631			0x5C
 
+/* Register configs for tilt interrupt */
+#define INV_ICM42605_REG_APEX_CONFIG4                  0x4043
+#define INV_ICM42605_APEX_CONFIG4_MASK                 GENMASK(7, 0)
+
+#define INV_ICM42605_REG_APEX_CONFIG0                  0x0056
+#define INV_ICM42605_APEX_CONFIG0_TILT_ENABLE          BIT(4)
+#define INV_ICM42605_APEX_CONFIG0                      BIT(1)
+
+#define INV_ICM42605_REG_INTF_CONFIG1                   0x404D
+#define INV_ICM42605_INTF_CONFIG1_MASK                  GENMASK(5, 0)
+#define INV_ICM42605_INTF_CONFIG1_TILT_DET_INT1_EN      BIT(3)
+
+#define INV_ICM42605_REG_INT_STATUS3                   0x0038
+
+
 /* User bank 1 (MSB 0x10) */
 #define INV_ICM42600_REG_SENSOR_CONFIG0			0x1003
 #define INV_ICM42600_SENSOR_CONFIG0_ZG_DISABLE		BIT(5)
@@ -364,6 +382,8 @@  typedef int (*inv_icm42600_bus_setup)(struct inv_icm42600_state *);
 extern const struct regmap_config inv_icm42600_regmap_config;
 extern const struct dev_pm_ops inv_icm42600_pm_ops;
 
+extern uint8_t inv_icm42605_int_reg;
+
 const struct iio_mount_matrix *
 inv_icm42600_get_mount_matrix(const struct iio_dev *indio_dev,
 			      const struct iio_chan_spec *chan);
@@ -395,4 +415,8 @@  struct iio_dev *inv_icm42600_accel_init(struct inv_icm42600_state *st);
 
 int inv_icm42600_accel_parse_fifo(struct iio_dev *indio_dev);
 
+int inv_icm42605_generate_tilt_interrupt(struct inv_icm42600_state *st);
+
+int inv_icm42605_disable_tilt_interrupt(struct inv_icm42600_state *st);
+
 #endif
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
index b1e4fde27d25..7140ac967d88 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
@@ -47,6 +47,8 @@ 
 		.ext_info = _ext_info,					\
 	}
 
+uint8_t inv_icm42605_int_reg;
+
 enum inv_icm42600_accel_scan {
 	INV_ICM42600_ACCEL_SCAN_X,
 	INV_ICM42600_ACCEL_SCAN_Y,
@@ -60,6 +62,69 @@  static const struct iio_chan_spec_ext_info inv_icm42600_accel_ext_infos[] = {
 	{},
 };
 
+static ssize_t tilt_interrupt_show(struct device *dev,
+			       struct device_attribute *attr, char *buf)
+{
+	struct inv_icm42600_state *st = dev_get_drvdata(dev);
+	unsigned int val;
+	int ret;
+
+	ret = regmap_read(st->map, inv_icm42605_int_reg, &val);
+
+	if (ret != 0)
+		return ret;
+
+	snprintf(buf, PAGE_SIZE, "Read reg %x value %x\n", inv_icm42605_int_reg, val);
+
+	return strlen(buf);
+}
+
+static ssize_t tilt_interrupt_store(struct device *dev,
+		struct device_attribute *attr, const char *buf,
+		size_t count)
+{
+	struct inv_icm42600_state *st = dev_get_drvdata(dev);
+	int ret;
+	int value;
+
+	if (!st)
+		return -EINVAL;
+
+	if (kstrtoint(buf, 10, &value))
+		return -EINVAL;
+
+	inv_icm42605_int_reg = INV_ICM42605_REG_INT_STATUS3;
+
+	switch (value) {
+	case 1:
+		ret = inv_icm42605_generate_tilt_interrupt(st);
+		if (ret != 0)
+			return -EIO;
+		break;
+	case 0:
+		ret = inv_icm42605_disable_tilt_interrupt(st);
+		if (ret != 0)
+			return -EIO;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return count;
+}
+
+static DEVICE_ATTR_RW(tilt_interrupt, 0644,
+		   tilt_interrupt_show, tilt_interrupt_store);
+
+static struct attribute *icm42605_attrs[] = {
+	&dev_attr_tilt_interrupt.attr,
+	NULL,
+};
+
+static const struct attribute_group icm42605_attrs_group = {
+	.attrs = icm42605_attrs,
+};
+
 static const struct iio_chan_spec inv_icm42600_accel_channels[] = {
 	INV_ICM42600_ACCEL_CHAN(IIO_MOD_X, INV_ICM42600_ACCEL_SCAN_X,
 				inv_icm42600_accel_ext_infos),
@@ -702,6 +767,7 @@  static const struct iio_info inv_icm42600_accel_info = {
 	.update_scan_mode = inv_icm42600_accel_update_scan_mode,
 	.hwfifo_set_watermark = inv_icm42600_accel_hwfifo_set_watermark,
 	.hwfifo_flush_to_buffer = inv_icm42600_accel_hwfifo_flush,
+	.attrs = &icm42605_attrs_group,
 };
 
 struct iio_dev *inv_icm42600_accel_init(struct inv_icm42600_state *st)
@@ -791,3 +857,67 @@  int inv_icm42600_accel_parse_fifo(struct iio_dev *indio_dev)
 
 	return 0;
 }
+
+int inv_icm42605_generate_tilt_interrupt(struct inv_icm42600_state *st)
+{
+	int ret;
+	int val;
+	char sleep = 10;
+
+	ret = regmap_update_bits(st->map, INV_ICM42605_REG_APEX_CONFIG4,
+				 INV_ICM42605_APEX_CONFIG4_MASK, 0);
+	if (ret)
+		return ret;
+
+	val = INV_ICM42600_PWR_ACCEL_MODE;
+	ret = regmap_write(st->map, INV_ICM42600_REG_PWR_MGMT0, val);
+	if (ret)
+		return ret;
+
+	val = INV_ICM42605_APEX_CONFIG0;
+	ret = regmap_write(st->map, INV_ICM42605_REG_APEX_CONFIG0, val);
+	if (ret)
+		return ret;
+
+	val = INV_ICM42600_SIGNAL_PATH_RESET_DMP_MEM_RESET;
+	ret = regmap_write(st->map, INV_ICM42600_REG_SIGNAL_PATH_RESET, val);
+	if (ret)
+		return ret;
+
+	msleep(sleep);
+
+	val = INV_ICM42600_SIGNAL_PATH_RESET_DMP_INIT_EN;
+	ret = regmap_write(st->map, INV_ICM42600_REG_SIGNAL_PATH_RESET, val);
+	if (ret)
+		return ret;
+
+	val = INV_ICM42605_APEX_CONFIG0_TILT_ENABLE |
+	      INV_ICM42605_APEX_CONFIG0;
+	ret = regmap_write(st->map, INV_ICM42605_REG_APEX_CONFIG0, val);
+	if (ret)
+		return ret;
+
+	ret = regmap_update_bits(st->map, INV_ICM42605_REG_INTF_CONFIG1,
+				 INV_ICM42605_INTF_CONFIG1_MASK,
+				 INV_ICM42605_INTF_CONFIG1_TILT_DET_INT1_EN);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+int inv_icm42605_disable_tilt_interrupt(struct inv_icm42600_state *st)
+{
+	int ret;
+
+	ret = regmap_write(st->map, INV_ICM42605_REG_APEX_CONFIG0, 0);
+	if (ret)
+		return ret;
+
+	ret = regmap_update_bits(st->map, INV_ICM42605_REG_INTF_CONFIG1,
+			INV_ICM42605_INTF_CONFIG1_MASK, 0);
+	if (ret)
+		return ret;
+
+	return 0;
+}