linux/drivers/iio/proximity/srf04.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * SRF04: ultrasonic sensor for distance measuring by using GPIOs
 *
 * Copyright (c) 2017 Andreas Klinger <[email protected]>
 *
 * For details about the device see:
 * https://www.robot-electronics.co.uk/htm/srf04tech.htm
 *
 * the measurement cycle as timing diagram looks like:
 *
 *          +---+
 * GPIO     |   |
 * trig:  --+   +------------------------------------------------------
 *          ^   ^
 *          |<->|
 *         udelay(trigger_pulse_us)
 *
 * ultra           +-+ +-+ +-+
 * sonic           | | | | | |
 * burst: ---------+ +-+ +-+ +-----------------------------------------
 *                           .
 * ultra                     .              +-+ +-+ +-+
 * sonic                     .              | | | | | |
 * echo:  ----------------------------------+ +-+ +-+ +----------------
 *                           .                        .
 *                           +------------------------+
 * GPIO                      |                        |
 * echo:  -------------------+                        +---------------
 *                           ^                        ^
 *                           interrupt                interrupt
 *                           (ts_rising)              (ts_falling)
 *                           |<---------------------->|
 *                              pulse time measured
 *                              --> one round trip of ultra sonic waves
 */
#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/pm_runtime.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>

struct srf04_cfg {};

struct srf04_data {};

static const struct srf04_cfg srf04_cfg =;

static const struct srf04_cfg mb_lv_cfg =;

static irqreturn_t srf04_handle_irq(int irq, void *dev_id)
{}

static int srf04_read(struct srf04_data *data)
{}

static int srf04_read_raw(struct iio_dev *indio_dev,
			    struct iio_chan_spec const *channel, int *val,
			    int *val2, long info)
{}

static const struct iio_info srf04_iio_info =;

static const struct iio_chan_spec srf04_chan_spec[] =;

static const struct of_device_id of_srf04_match[] =;

MODULE_DEVICE_TABLE(of, of_srf04_match);

static int srf04_probe(struct platform_device *pdev)
{}

static void srf04_remove(struct platform_device *pdev)
{}

static int  srf04_pm_runtime_suspend(struct device *dev)
{}

static int srf04_pm_runtime_resume(struct device *dev)
{}

static const struct dev_pm_ops srf04_pm_ops =;

static struct platform_driver srf04_driver =;

module_platform_driver();

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