Source
/*
* Maxim MAX197 A/D Converter driver
*
* Copyright (c) 2012 Savoir-faire Linux Inc.
* Vivien Didelot <vivien.didelot@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* For further information, see the Documentation/hwmon/max197 file.
*/
/* 4V */
/* 10V */
/* 8 Analog Input Channels */
/* Control byte format */
/* Bipolarity */
/* Full range */
/* Scale coefficient for raw data */
/* List of supported chips */
enum max197_chips { max197, max199 };
/**
* struct max197_data - device instance specific data
* @pdata: Platform data.
* @hwmon_dev: The hwmon device.
* @lock: Read/Write mutex.
* @limit: Max range value (10V for MAX197, 4V for MAX199).
* @scale: Need to scale.
* @ctrl_bytes: Channels control byte.
*/
struct max197_data {
struct max197_platform_data *pdata;
struct device *hwmon_dev;
struct mutex lock;
int limit;
bool scale;
u8 ctrl_bytes[MAX197_NUM_CH];
};
static inline void max197_set_unipolarity(struct max197_data *data, int channel)
{
data->ctrl_bytes[channel] &= ~MAX197_BIP;
}