linux/drivers/iio/proximity/sx_common.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright 2021 Google LLC.
 *
 * Common part of most Semtech SAR sensor.
 */

#include <linux/bitops.h>
#include <linux/byteorder/generic.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/export.h>
#include <linux/interrupt.h>
#include <linux/irqreturn.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <vdso/bits.h>

#include <linux/iio/buffer.h>
#include <linux/iio/events.h>
#include <linux/iio/iio.h>
#include <linux/iio/trigger.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/trigger_consumer.h>

#include "sx_common.h"

/* All Semtech SAR sensors have IRQ bit in the same order. */
#define SX_COMMON_CONVDONE_IRQ
#define SX_COMMON_FAR_IRQ
#define SX_COMMON_CLOSE_IRQ

const struct iio_event_spec sx_common_events[3] =;
EXPORT_SYMBOL_NS_GPL();

static irqreturn_t sx_common_irq_handler(int irq, void *private)
{}

static void sx_common_push_events(struct iio_dev *indio_dev)
{}

static int sx_common_enable_irq(struct sx_common_data *data, unsigned int irq)
{}

static int sx_common_disable_irq(struct sx_common_data *data, unsigned int irq)
{}

static int sx_common_update_chan_en(struct sx_common_data *data,
				    unsigned long chan_read,
				    unsigned long chan_event)
{}

static int sx_common_get_read_channel(struct sx_common_data *data, int channel)
{}

static int sx_common_put_read_channel(struct sx_common_data *data, int channel)
{}

static int sx_common_get_event_channel(struct sx_common_data *data, int channel)
{}

static int sx_common_put_event_channel(struct sx_common_data *data, int channel)
{}

/**
 * sx_common_read_proximity() - Read raw proximity value.
 * @data:	Internal data
 * @chan:	Channel to read
 * @val:	pointer to return read value.
 *
 * Request a conversion, wait for the sensor to be ready and
 * return the raw proximity value.
 */
int sx_common_read_proximity(struct sx_common_data *data,
			     const struct iio_chan_spec *chan, int *val)
{}
EXPORT_SYMBOL_NS_GPL();

/**
 * sx_common_read_event_config() - Configure event setting.
 * @indio_dev:	iio device object
 * @chan:	Channel to read
 * @type:	Type of event (unused)
 * @dir:	Direction of event (unused)
 *
 * return if the given channel is used for event gathering.
 */
int sx_common_read_event_config(struct iio_dev *indio_dev,
				const struct iio_chan_spec *chan,
				enum iio_event_type type,
				enum iio_event_direction dir)
{}
EXPORT_SYMBOL_NS_GPL();

/**
 * sx_common_write_event_config() - Configure event setting.
 * @indio_dev:	iio device object
 * @chan:	Channel to enable
 * @type:	Type of event (unused)
 * @dir:	Direction of event (unused)
 * @state:	State of the event.
 *
 * Enable/Disable event on a given channel.
 */
int sx_common_write_event_config(struct iio_dev *indio_dev,
				 const struct iio_chan_spec *chan,
				 enum iio_event_type type,
				 enum iio_event_direction dir, int state)
{}
EXPORT_SYMBOL_NS_GPL();

static int sx_common_set_trigger_state(struct iio_trigger *trig, bool state)
{}

static const struct iio_trigger_ops sx_common_trigger_ops =;

static irqreturn_t sx_common_irq_thread_handler(int irq, void *private)
{}

static irqreturn_t sx_common_trigger_handler(int irq, void *private)
{}

static int sx_common_buffer_preenable(struct iio_dev *indio_dev)
{}

static int sx_common_buffer_postdisable(struct iio_dev *indio_dev)
{}

static const struct iio_buffer_setup_ops sx_common_buffer_setup_ops =;

void sx_common_get_raw_register_config(struct device *dev,
				       struct sx_common_reg_default *reg_def)
{}
EXPORT_SYMBOL_NS_GPL();

#define SX_COMMON_SOFT_RESET

static int sx_common_init_device(struct device *dev, struct iio_dev *indio_dev)
{}

/**
 * sx_common_probe() - Common setup for Semtech SAR sensor
 * @client:		I2C client object
 * @chip_info:		Semtech sensor chip information.
 * @regmap_config:	Sensor registers map configuration.
 */
int sx_common_probe(struct i2c_client *client,
		    const struct sx_common_chip_info *chip_info,
		    const struct regmap_config *regmap_config)
{}
EXPORT_SYMBOL_NS_GPL();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();