linux/drivers/iio/adc/axp20x_adc.c

// SPDX-License-Identifier: GPL-2.0-only
/* ADC driver for AXP20X and AXP22X PMICs
 *
 * Copyright (c) 2016 Free Electrons NextThing Co.
 *	Quentin Schulz <[email protected]>
 */

#include <linux/unaligned.h>
#include <linux/bitfield.h>
#include <linux/completion.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/thermal.h>

#include <linux/iio/iio.h>
#include <linux/iio/driver.h>
#include <linux/iio/machine.h>
#include <linux/mfd/axp20x.h>

#define AXP192_ADC_EN1_MASK
#define AXP192_ADC_EN2_MASK

#define AXP20X_ADC_EN1_MASK
#define AXP20X_ADC_EN2_MASK

#define AXP22X_ADC_EN1_MASK

#define AXP717_ADC_EN1_MASK

#define AXP192_GPIO30_IN_RANGE_GPIO0
#define AXP192_GPIO30_IN_RANGE_GPIO1
#define AXP192_GPIO30_IN_RANGE_GPIO2
#define AXP192_GPIO30_IN_RANGE_GPIO3

#define AXP20X_GPIO10_IN_RANGE_GPIO0
#define AXP20X_GPIO10_IN_RANGE_GPIO1

#define AXP20X_ADC_RATE_MASK
#define AXP20X_ADC_RATE_HZ(x)

#define AXP22X_ADC_RATE_HZ(x)

#define AXP717_ADC_DATA_TS
#define AXP717_ADC_DATA_TEMP
#define AXP717_ADC_DATA_VMID
#define AXP717_ADC_DATA_BKUP_BATT

#define AXP717_ADC_DATA_MASK

#define AXP813_V_I_ADC_RATE_MASK
#define AXP813_ADC_RATE_MASK
#define AXP813_TS_GPIO0_ADC_RATE_HZ(x)
#define AXP813_V_I_ADC_RATE_HZ(x)
#define AXP813_ADC_RATE_HZ(x)

#define AXP20X_ADC_CHANNEL(_channel, _name, _type, _reg)

#define AXP20X_ADC_CHANNEL_OFFSET(_channel, _name, _type, _reg)

struct axp_data;

struct axp20x_adc_iio {};

enum axp192_adc_channel_v {};

enum axp192_adc_channel_i {};

enum axp20x_adc_channel_v {};

enum axp20x_adc_channel_i {};

enum axp22x_adc_channel_v {};

enum axp22x_adc_channel_i {};

enum axp717_adc_channel_v {};

enum axp717_adc_channel_i {};

enum axp813_adc_channel_v {};

static struct iio_map axp20x_maps[] =;

static struct iio_map axp22x_maps[] =;

static struct iio_map axp717_maps[] =;

/*
 * Channels are mapped by physical system. Their channels share the same index.
 * i.e. acin_i is in_current0_raw and acin_v is in_voltage0_raw.
 * The only exception is for the battery. batt_v will be in_voltage6_raw and
 * charge current in_current6_raw and discharge current will be in_current7_raw.
 */
static const struct iio_chan_spec axp192_adc_channels[] =;

static const struct iio_chan_spec axp20x_adc_channels[] =;

static const struct iio_chan_spec axp22x_adc_channels[] =;

/*
 * Scale and offset is unknown for temp, ts, batt_chrg_i, vmid_v, and
 * bkup_batt_v channels. Leaving scale and offset undefined for now.
 */
static const struct iio_chan_spec axp717_adc_channels[] =;

static const struct iio_chan_spec axp813_adc_channels[] =;

static int axp192_adc_raw(struct iio_dev *indio_dev,
			  struct iio_chan_spec const *chan, int *val)
{}

static int axp20x_adc_raw(struct iio_dev *indio_dev,
			  struct iio_chan_spec const *chan, int *val)
{}

static int axp22x_adc_raw(struct iio_dev *indio_dev,
			  struct iio_chan_spec const *chan, int *val)
{}

static int axp717_adc_raw(struct iio_dev *indio_dev,
			  struct iio_chan_spec const *chan, int *val)
{}

static int axp813_adc_raw(struct iio_dev *indio_dev,
			  struct iio_chan_spec const *chan, int *val)
{}

static int axp192_adc_scale_voltage(int channel, int *val, int *val2)
{}

static int axp20x_adc_scale_voltage(int channel, int *val, int *val2)
{}

static int axp22x_adc_scale_voltage(int channel, int *val, int *val2)
{}
static int axp813_adc_scale_voltage(int channel, int *val, int *val2)
{}

static int axp20x_adc_scale_current(int channel, int *val, int *val2)
{}

static int axp192_adc_scale(struct iio_chan_spec const *chan, int *val,
			    int *val2)
{}

static int axp20x_adc_scale(struct iio_chan_spec const *chan, int *val,
			    int *val2)
{}

static int axp22x_adc_scale(struct iio_chan_spec const *chan, int *val,
			    int *val2)
{}

static int axp717_adc_scale(struct iio_chan_spec const *chan, int *val,
			    int *val2)
{}

static int axp813_adc_scale(struct iio_chan_spec const *chan, int *val,
			    int *val2)
{}

static int axp192_adc_offset_voltage(struct iio_dev *indio_dev, int channel,
				     int *val)
{}

static int axp20x_adc_offset_voltage(struct iio_dev *indio_dev, int channel,
				     int *val)
{}

static int axp192_adc_offset(struct iio_dev *indio_dev,
			     struct iio_chan_spec const *chan, int *val)
{}

static int axp20x_adc_offset(struct iio_dev *indio_dev,
			     struct iio_chan_spec const *chan, int *val)
{}

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

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

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

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

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

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

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

static const struct iio_info axp192_adc_iio_info =;

static const struct iio_info axp20x_adc_iio_info =;

static const struct iio_info axp22x_adc_iio_info =;

static const struct iio_info axp717_adc_iio_info =;

static const struct iio_info axp813_adc_iio_info =;

static int axp20x_adc_rate(struct axp20x_adc_iio *info, int rate)
{}

static int axp22x_adc_rate(struct axp20x_adc_iio *info, int rate)
{}

static int axp813_adc_rate(struct axp20x_adc_iio *info, int rate)
{}

struct axp_data {};

static const struct axp_data axp192_data =;

static const struct axp_data axp20x_data =;

static const struct axp_data axp22x_data =;

static const struct axp_data axp717_data =;

static const struct axp_data axp813_data =;

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

static const struct platform_device_id axp20x_adc_id_match[] =;
MODULE_DEVICE_TABLE(platform, axp20x_adc_id_match);

static int axp20x_probe(struct platform_device *pdev)
{}

static void axp20x_remove(struct platform_device *pdev)
{}

static struct platform_driver axp20x_adc_driver =;

module_platform_driver();

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