Commit 6e9f2d83 authored by Jean-Baptiste Maneyrol's avatar Jean-Baptiste Maneyrol Committed by Jonathan Cameron
Browse files

iio: imu: inv_icm42600: make timestamp module chip independent



Move icm42600 dependent function inside the core module.
Do some headers cleanup at the same time.

Signed-off-by: default avatarJean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20230606162147.79667-2-inv.git-commit@tdk.com


Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent f41f4443
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -516,6 +516,17 @@ static int inv_icm42600_irq_init(struct inv_icm42600_state *st, int irq,
					 "inv_icm42600", st);
}

static int inv_icm42600_timestamp_setup(struct inv_icm42600_state *st)
{
	unsigned int val;

	/* enable timestamp register */
	val = INV_ICM42600_TMST_CONFIG_TMST_TO_REGS_EN |
	      INV_ICM42600_TMST_CONFIG_TMST_EN;
	return regmap_update_bits(st->map, INV_ICM42600_REG_TMST_CONFIG,
				  INV_ICM42600_TMST_CONFIG_MASK, val);
}

static int inv_icm42600_enable_regulator_vddio(struct inv_icm42600_state *st)
{
	int ret;
+1 −13
Original line number Diff line number Diff line
@@ -3,11 +3,10 @@
 * Copyright (C) 2020 Invensense, Inc.
 */

#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/regmap.h>
#include <linux/math64.h>

#include "inv_icm42600.h"
#include "inv_icm42600_timestamp.h"

/* internal chip period is 32kHz, 31250ns */
@@ -56,17 +55,6 @@ void inv_icm42600_timestamp_init(struct inv_icm42600_timestamp *ts,
	inv_update_acc(&ts->chip_period, INV_ICM42600_TIMESTAMP_PERIOD);
}

int inv_icm42600_timestamp_setup(struct inv_icm42600_state *st)
{
	unsigned int val;

	/* enable timestamp register */
	val = INV_ICM42600_TMST_CONFIG_TMST_TO_REGS_EN |
	      INV_ICM42600_TMST_CONFIG_TMST_EN;
	return regmap_update_bits(st->map, INV_ICM42600_REG_TMST_CONFIG,
				  INV_ICM42600_TMST_CONFIG_MASK, val);
}

int inv_icm42600_timestamp_update_odr(struct inv_icm42600_timestamp *ts,
				      uint32_t period, bool fifo)
{
+0 −6
Original line number Diff line number Diff line
@@ -6,10 +6,6 @@
#ifndef INV_ICM42600_TIMESTAMP_H_
#define INV_ICM42600_TIMESTAMP_H_

#include <linux/kernel.h>

struct inv_icm42600_state;

/**
 * struct inv_icm42600_timestamp_interval - timestamps interval
 * @lo:	interval lower bound
@@ -53,8 +49,6 @@ struct inv_icm42600_timestamp {
void inv_icm42600_timestamp_init(struct inv_icm42600_timestamp *ts,
				 uint32_t period);

int inv_icm42600_timestamp_setup(struct inv_icm42600_state *st);

int inv_icm42600_timestamp_update_odr(struct inv_icm42600_timestamp *ts,
				      uint32_t period, bool fifo);