| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * IIO driver for the Measurement Computing CIO-DAC |
|---|
| 3 | 4 | * Copyright (C) 2016 William Breathitt Gray |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | | - * it under the terms of the GNU General Public License, version 2, as |
|---|
| 7 | | - * published by the Free Software Foundation. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope that it will be useful, but |
|---|
| 10 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|---|
| 12 | | - * General Public License for more details. |
|---|
| 13 | 5 | * |
|---|
| 14 | 6 | * This driver supports the following Measurement Computing devices: CIO-DAC16, |
|---|
| 15 | 7 | * CIO-DAC06, and PC104-DAC06. |
|---|
| .. | .. |
|---|
| 74 | 66 | if (mask != IIO_CHAN_INFO_RAW) |
|---|
| 75 | 67 | return -EINVAL; |
|---|
| 76 | 68 | |
|---|
| 77 | | - /* DAC can only accept up to a 16-bit value */ |
|---|
| 78 | | - if ((unsigned int)val > 65535) |
|---|
| 69 | + /* DAC can only accept up to a 12-bit value */ |
|---|
| 70 | + if ((unsigned int)val > 4095) |
|---|
| 79 | 71 | return -EINVAL; |
|---|
| 80 | 72 | |
|---|
| 81 | 73 | priv->chan_out_states[chan->channel] = val; |
|---|
| .. | .. |
|---|
| 118 | 110 | indio_dev->channels = cio_dac_channels; |
|---|
| 119 | 111 | indio_dev->num_channels = CIO_DAC_NUM_CHAN; |
|---|
| 120 | 112 | indio_dev->name = dev_name(dev); |
|---|
| 121 | | - indio_dev->dev.parent = dev; |
|---|
| 122 | 113 | |
|---|
| 123 | 114 | priv = iio_priv(indio_dev); |
|---|
| 124 | 115 | priv->base = base[id]; |
|---|