linux/drivers/iio/adc/hx711.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * HX711: analog to digital converter for weight sensor module
 *
 * Copyright (c) 2016 Andreas Klinger <[email protected]>
 */
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
#include <linux/iio/buffer.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/gpio/consumer.h>
#include <linux/regulator/consumer.h>

/* gain to pulse and scale conversion */
#define HX711_GAIN_MAX
#define HX711_RESET_GAIN

struct hx711_gain_to_scale {};

/*
 * .scale depends on AVDD which in turn is known as soon as the regulator
 * is available
 * therefore we set .scale in hx711_probe()
 *
 * channel A in documentation is channel 0 in source code
 * channel B in documentation is channel 1 in source code
 */
static struct hx711_gain_to_scale hx711_gain_to_scale[HX711_GAIN_MAX] =;

static int hx711_get_gain_to_pulse(int gain)
{}

static int hx711_get_gain_to_scale(int gain)
{}

static int hx711_get_scale_to_gain(int scale)
{}

struct hx711_data {};

static int hx711_cycle(struct hx711_data *hx711_data)
{}

static int hx711_read(struct hx711_data *hx711_data)
{}

static int hx711_wait_for_ready(struct hx711_data *hx711_data)
{}

static int hx711_reset(struct hx711_data *hx711_data)
{}

static int hx711_set_gain_for_channel(struct hx711_data *hx711_data, int chan)
{}

static int hx711_reset_read(struct hx711_data *hx711_data, int chan)
{}

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

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

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

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

static ssize_t hx711_scale_available_show(struct device *dev,
				struct device_attribute *attr,
				char *buf)
{}

static IIO_DEVICE_ATTR(in_voltage0_scale_available, S_IRUGO,
	hx711_scale_available_show, NULL, 0);

static IIO_DEVICE_ATTR(in_voltage1_scale_available, S_IRUGO,
	hx711_scale_available_show, NULL, 1);

static struct attribute *hx711_attributes[] =;

static const struct attribute_group hx711_attribute_group =;

static const struct iio_info hx711_iio_info =;

static const struct iio_chan_spec hx711_chan_spec[] =;

static int hx711_probe(struct platform_device *pdev)
{}

static const struct of_device_id of_hx711_match[] =;

MODULE_DEVICE_TABLE(of, of_hx711_match);

static struct platform_driver hx711_driver =;

module_platform_driver();

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