From: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: linux-iio@vger.kernel.org
Subject: Re: [PATCH 3/3] iio:ad5064: Initialize register cache correctly
Date: Sat, 02 Mar 2013 16:25:16 +0000 [thread overview]
Message-ID: <513227EC.8090706@kernel.org> (raw)
In-Reply-To: <1362143239-891-3-git-send-email-lars@metafoo.de>
On 03/01/2013 01:07 PM, Lars-Peter Clausen wrote:
> Initialize the register cache to the proper mid-scale value based on the
> resolution of the device.
>
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
applied to togreg branch of iio.git
Thanks
> ---
> drivers/iio/dac/ad5064.c | 13 ++++++++-----
> 1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
> index a491976..0c8d03a 100644
> --- a/drivers/iio/dac/ad5064.c
> +++ b/drivers/iio/dac/ad5064.c
> @@ -438,6 +438,7 @@ static int __devinit ad5064_probe(struct device *dev, enum ad5064_type type,
> {
> struct iio_dev *indio_dev;
> struct ad5064_state *st;
> + unsigned int midscale;
> unsigned int i;
> int ret;
>
> @@ -474,11 +475,6 @@ static int __devinit ad5064_probe(struct device *dev, enum ad5064_type type,
> goto error_free_reg;
> }
>
> - for (i = 0; i < st->chip_info->num_channels; ++i) {
> - st->pwr_down_mode[i] = AD5064_LDAC_PWRDN_1K;
> - st->dac_cache[i] = 0x8000;
> - }
> -
> indio_dev->dev.parent = dev;
> indio_dev->name = name;
> indio_dev->info = &ad5064_info;
> @@ -486,6 +482,13 @@ static int __devinit ad5064_probe(struct device *dev, enum ad5064_type type,
> indio_dev->channels = st->chip_info->channels;
> indio_dev->num_channels = st->chip_info->num_channels;
>
> + midscale = (1 << indio_dev->channels[0].scan_type.realbits) / 2;
> +
> + for (i = 0; i < st->chip_info->num_channels; ++i) {
> + st->pwr_down_mode[i] = AD5064_LDAC_PWRDN_1K;
> + st->dac_cache[i] = midscale;
> + }
> +
> ret = iio_device_register(indio_dev);
> if (ret)
> goto error_disable_reg;
>
next prev parent reply other threads:[~2013-03-02 16:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-01 13:07 [PATCH 1/3] iio:ad5064: Fix address of the second channel for ad5065/ad5045/ad5025 Lars-Peter Clausen
2013-03-01 13:07 ` [PATCH 2/3] iio:ad5064: Fix off by one in DAC value range check Lars-Peter Clausen
2013-03-02 16:24 ` Jonathan Cameron
2013-03-01 13:07 ` [PATCH 3/3] iio:ad5064: Initialize register cache correctly Lars-Peter Clausen
2013-03-02 16:25 ` Jonathan Cameron [this message]
2013-03-02 16:23 ` [PATCH 1/3] iio:ad5064: Fix address of the second channel for ad5065/ad5045/ad5025 Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=513227EC.8090706@kernel.org \
--to=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.