linux/drivers/iio/potentiometer/mcp4131.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Industrial I/O driver for Microchip digital potentiometers
 *
 * Copyright (c) 2016 Slawomir Stepien
 * Based on: Peter Rosin's code from mcp4531.c
 *
 * Datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/22060b.pdf
 *
 * DEVID	#Wipers	#Positions	Resistor Opts (kOhm)
 * mcp4131	1	129		5, 10, 50, 100
 * mcp4132	1	129		5, 10, 50, 100
 * mcp4141	1	129		5, 10, 50, 100
 * mcp4142	1	129		5, 10, 50, 100
 * mcp4151	1	257		5, 10, 50, 100
 * mcp4152	1	257		5, 10, 50, 100
 * mcp4161	1	257		5, 10, 50, 100
 * mcp4162	1	257		5, 10, 50, 100
 * mcp4231	2	129		5, 10, 50, 100
 * mcp4232	2	129		5, 10, 50, 100
 * mcp4241	2	129		5, 10, 50, 100
 * mcp4242	2	129		5, 10, 50, 100
 * mcp4251	2	257		5, 10, 50, 100
 * mcp4252	2	257		5, 10, 50, 100
 * mcp4261	2	257		5, 10, 50, 100
 * mcp4262	2	257		5, 10, 50, 100
 */

/*
 * TODO:
 * 1. Write wiper setting to EEPROM for EEPROM capable models.
 */

#include <linux/cache.h>
#include <linux/err.h>
#include <linux/export.h>
#include <linux/iio/iio.h>
#include <linux/iio/types.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/mutex.h>
#include <linux/property.h>
#include <linux/spi/spi.h>

#define MCP4131_WRITE
#define MCP4131_READ

#define MCP4131_WIPER_SHIFT
#define MCP4131_CMDERR(r)
#define MCP4131_RAW(r)

struct mcp4131_cfg {};

enum mcp4131_type {};

static const struct mcp4131_cfg mcp4131_cfg[] =;

struct mcp4131_data {};

#define MCP4131_CHANNEL(ch)

static const struct iio_chan_spec mcp4131_channels[] =;

static int mcp4131_read(struct spi_device *spi, void *buf, size_t len)
{}

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

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

static const struct iio_info mcp4131_info =;

static int mcp4131_probe(struct spi_device *spi)
{}

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

static const struct spi_device_id mcp4131_id[] =;
MODULE_DEVICE_TABLE(spi, mcp4131_id);

static struct spi_driver mcp4131_driver =;

module_spi_driver();

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