Commit 46d78462 authored by Vivien Didelot's avatar Vivien Didelot Committed by Guenter Roeck

hwmon: (ads7828) driver cleanup

As there is no reliable way to identify the chip, it is preferable to
remove the detect callback, to avoid misdetection.

Module parameters are not worth it here, so let's get rid of them and
add an ads7828_platform_data structure instead.

Clean the code by removing unused macros, fixing coding style issues,
avoiding function prototypes and using convenient macros such as
module_i2c_driver().
Signed-off-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 22e32f4f
......@@ -4,22 +4,33 @@ Kernel driver ads7828
Supported chips:
* Texas Instruments/Burr-Brown ADS7828
Prefix: 'ads7828'
Addresses scanned: I2C 0x48, 0x49, 0x4a, 0x4b
Datasheet: Publicly available at the Texas Instruments website :
Datasheet: Publicly available at the Texas Instruments website:
http://focus.ti.com/lit/ds/symlink/ads7828.pdf
Authors:
Steve Hardy <shardy@redhat.com>
Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Module Parameters
-----------------
Platform data
-------------
* se_input: bool (default Y)
Single ended operation - set to N for differential mode
* int_vref: bool (default Y)
Operate with the internal 2.5V reference - set to N for external reference
* vref_mv: int (default 2500)
If using an external reference, set this to the reference voltage in mV
The ads7828 driver accepts an optional ads7828_platform_data structure (defined
in include/linux/platform_data/ads7828.h). The structure fields are:
* diff_input: (bool) Differential operation
set to true for differential mode, false for default single ended mode.
* ext_vref: (bool) External reference
set to true if it operates with an external reference, false for default
internal reference.
* vref_mv: (unsigned int) Voltage reference
if using an external reference, set this to the reference voltage in mV,
otherwise it will default to the internal value (2500mV). This value will be
bounded with limits accepted by the chip, described in the datasheet.
If no structure is provided, the configuration defaults to single ended
operation and internal voltage reference (2.5V).
Description
-----------
......@@ -34,3 +45,7 @@ where 4 differential pairs can be measured.
The chip also has the facility to use an external voltage reference. This
may be required if your hardware supplies the ADS7828 from a 5V supply, see
the datasheet for more details.
There is no reliable way to identify this chip, so the driver will not scan
some addresses to try to auto-detect it. That means that you will have to
statically declare the device in the platform support code.
This diff is collapsed.
/*
* TI ADS7828 A/D Converter platform data definition
*
* Copyright (c) 2012 Savoir-faire Linux Inc.
* Vivien Didelot <vivien.didelot@savoirfairelinux.com>
*
* For further information, see the Documentation/hwmon/ads7828 file.
*
* 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.
*/
#ifndef _PDATA_ADS7828_H
#define _PDATA_ADS7828_H
/**
* struct ads7828_platform_data - optional ADS7828 connectivity info
* @diff_input: Differential input mode.
* @ext_vref: Use an external voltage reference.
* @vref_mv: Voltage reference value, if external.
*/
struct ads7828_platform_data {
bool diff_input;
bool ext_vref;
unsigned int vref_mv;
};
#endif /* _PDATA_ADS7828_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment