linux/drivers/iio/chemical/pms7003.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Plantower PMS7003 particulate matter sensor driver
 *
 * Copyright (c) Tomasz Duszynski <[email protected]>
 */

#include <asm/unaligned.h>
#include <linux/completion.h>
#include <linux/device.h>
#include <linux/errno.h>
#include <linux/iio/buffer.h>
#include <linux/iio/iio.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/serdev.h>

#define PMS7003_DRIVER_NAME

#define PMS7003_MAGIC
/* last 2 data bytes hold frame checksum */
#define PMS7003_MAX_DATA_LENGTH
#define PMS7003_CHECKSUM_LENGTH
#define PMS7003_PM10_OFFSET
#define PMS7003_PM2P5_OFFSET
#define PMS7003_PM1_OFFSET

#define PMS7003_TIMEOUT
#define PMS7003_CMD_LENGTH
#define PMS7003_PM_MAX
#define PMS7003_PM_MIN

enum {};

enum pms7003_cmd {};

/*
 * commands have following format:
 *
 * +------+------+-----+------+-----+-----------+-----------+
 * | 0x42 | 0x4d | cmd | 0x00 | arg | cksum msb | cksum lsb |
 * +------+------+-----+------+-----+-----------+-----------+
 */
static const u8 pms7003_cmd_tbl[][PMS7003_CMD_LENGTH] =;

struct pms7003_frame {};

struct pms7003_state {};

static int pms7003_do_cmd(struct pms7003_state *state, enum pms7003_cmd cmd)
{}

static u16 pms7003_get_pm(const u8 *data)
{}

static irqreturn_t pms7003_trigger_handler(int irq, void *p)
{}

static int pms7003_read_raw(struct iio_dev *indio_dev,
			    struct iio_chan_spec const *chan,
			    int *val, int *val2, long mask)
{}

static const struct iio_info pms7003_info =;

#define PMS7003_CHAN(_index, _mod, _addr)

static const struct iio_chan_spec pms7003_channels[] =;

static u16 pms7003_calc_checksum(struct pms7003_frame *frame)
{}

static bool pms7003_frame_is_okay(struct pms7003_frame *frame)
{}

static size_t pms7003_receive_buf(struct serdev_device *serdev, const u8 *buf,
				  size_t size)
{}

static const struct serdev_device_ops pms7003_serdev_ops =;

static void pms7003_stop(void *data)
{}

static const unsigned long pms7003_scan_masks[] =;

static int pms7003_probe(struct serdev_device *serdev)
{}

static const struct of_device_id pms7003_of_match[] =;
MODULE_DEVICE_TABLE(of, pms7003_of_match);

static struct serdev_device_driver pms7003_driver =;
module_serdev_device_driver();

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