# Kernel driver max197

_Peios Kernel / Hardware and drivers / Hardware monitoring_

> Author:

<a id="rst-kernel-driver-max197"></a>

Author:

> - Vivien Didelot &lt;[vivien.didelot@savoirfairelinux.com](<mailto:vivien.didelot@savoirfairelinux.com>)&gt;

Supported chips:

> - Maxim MAX197
>
>   Prefix: 'max197'
>
>   Datasheet: [https://www.analog.com/media/en/technical-documentation/data-sheets/MAX197.pdf](<https://www.analog.com/media/en/technical-documentation/data-sheets/MAX197.pdf>)
>
> - Maxim MAX199
>
>   Prefix: 'max199'
>
>   Datasheet: [https://www.analog.com/media/en/technical-documentation/data-sheets/MAX199.pdf](<https://www.analog.com/media/en/technical-documentation/data-sheets/MAX199.pdf>)

<a id="rst-description"></a>

## Description

The A/D converters MAX197, and MAX199 are both 8-Channel, Multi-Range, 5V, 12-Bit DAS with 8+4 Bus Interface and Fault Protection.

The available ranges for the MAX197 are \{0,-5V\} to 5V, and \{0,-10V\} to 10V, while they are \{0,-2V\} to 2V, and \{0,-4V\} to 4V on the MAX199.

<a id="rst-platform-data"></a>

## Platform data

The MAX197 platform data (defined in linux/platform_data/max197.h) should be filled with a pointer to a conversion function, defined like:



```text
int convert(u8 ctrl);
```

ctrl is the control byte to write to start a new conversion. On success, the function must return the 12-bit raw value read from the chip, or a negative error code otherwise.

Control byte format:


<table>
<tbody>
<tr>
<td>


Bit

</td>
<td>


Name

</td>
<td>


Description

</td>
</tr>
<tr>
<td>


7,6

</td>
<td>


PD1,PD0

</td>
<td>


Clock and Power-Down modes

</td>
</tr>
<tr>
<td>


5

</td>
<td>


ACQMOD

</td>
<td>


Internal or External Controlled Acquisition

</td>
</tr>
<tr>
<td>


4

</td>
<td>


RNG

</td>
<td>


Full-scale voltage magnitude at the input

</td>
</tr>
<tr>
<td>


3

</td>
<td>


BIP

</td>
<td>


Unipolar or Bipolar conversion mode

</td>
</tr>
<tr>
<td>


2,1,0

</td>
<td>


A2,A1,A0

</td>
<td>


Channel

</td>
</tr>
</tbody>
</table>

<a id="rst-sysfs-interface"></a>

## Sysfs interface

>
> <table>
> <tbody>
> <tr>
> <td>
>
>
> in\[0-7\]\_input
>
> </td>
> <td>
>
>
> The conversion value for the corresponding channel. RO
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> in\[0-7\]\_min
>
> </td>
> <td>
>
>
> The lower limit (in mV) for the corresponding channel. For the MAX197, it will be adjusted to -10000, -5000, or 0. For the MAX199, it will be adjusted to -4000, -2000, or 0. RW
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> in\[0-7\]\_max
>
> </td>
> <td>
>
>
> The higher limit (in mV) for the corresponding channel. For the MAX197, it will be adjusted to 0, 5000, or 10000. For the MAX199, it will be adjusted to 0, 2000, or 4000. RW
>
> </td>
> </tr>
> </tbody>
> </table>
