Linux IIO development
 help / color / mirror / Atom feed
From: Alexander Sverdlin <alexander.sverdlin@gmail.com>
To: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org, Jonathan Cameron <jic23@kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>
Subject: Re: [PATCH 5/5] iio: adc: New driver for Cirrus Logic EP93xx ADC
Date: Wed, 25 Nov 2015 14:01:49 +0100	[thread overview]
Message-ID: <5655B13D.5060708@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1511251331310.11807@pmeerw.net>

Hi!

On 25/11/15 13:43, Peter Meerwald-Stadler wrote:
>> New driver adding support for ADC found on Cirrus Logic EP93xx series of SoCs.
>> > Board specific code must take care to create platform device with all necessary
>> > resources.
> comments below

Thanks for spelling corrections :)

[...]

>> > +		/* At this point conversion must be completed, but anyway... */
>> > +		while (1) {
>> > +			u32 t;
>> > +
>> > +			t = ep93xx_adc_reg_read(priv->base + EP93XX_ADC_RESULT);
>> > +			if (t & EP93XX_ADC_SDR) {
>> > +				/* Sign extend lower 16 bits */
>> > +				*value = (s16)t;
> there would be a nice sign_extend function

Yes, but we don't need its flexibility for the 16 bit case?

> maybe have a timeout?

Maybe... I'll add it...

>> > +				break;
>> > +			}
>> > +		}
>> > +		mutex_unlock(&priv->lock);
>> > +		return IIO_VAL_INT;
>> > +
>> > +	case IIO_CHAN_INFO_OFFSET:
>> > +		/* According to datasheet, range is -25000..25000 */
> huh? so 0 V returns what value?

Manual says it returns ~-25000. This seems to be true in reality, but I cannot tell
you now if it could be even below -25000. But as I've understood, all the relevant
calculations in IIO core are signed, so this should not be a problem.

[...]

>> > +		dev_err(&pdev->dev, "Cannot obtain clock");
> put \n at the end of the message

Yes, thanks for that notice...

[...]

>> > +	ret = clk_enable(priv->clk);
>> > +	if (ret) {
>> > +		dev_err(&pdev->dev, "Cannot enable clock");
>> > +		return ret;
>> > +	}
>> > +
> clock should be disabled on error in the following error path

True... I'll try to postpone clock enabling to the very end...

[...]

>> > +	ret = devm_iio_device_register(&pdev->dev, iiodev);
>> > +	if (ret)
>> > +		return ret;
>> > +
>> > +	platform_set_drvdata(pdev, iiodev);
> this should be done before _register()

I don't agree here, because this is for platform device only and is
only used in _remove() below, not for IIO device.

> just do
> return devm_iio_device_register(..)

Thanks for review!

Regards,
Alexander.

  reply	other threads:[~2015-11-25 13:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <56558B23.4080506@gmail.com>
2015-11-25 11:50 ` [PATCH 1/5] clk: ep93xx: Implement clk_get_parent() Alexander Sverdlin
2015-11-25 11:50 ` [PATCH 2/5] clk: ep93xx: Add ADC clock Alexander Sverdlin
2015-11-25 11:50 ` [PATCH 3/5] ep93xx: Add ADC platform device support to core Alexander Sverdlin
2015-11-25 11:50 ` [PATCH 4/5] edb93xx: Add ADC platform device Alexander Sverdlin
2015-11-25 11:51 ` [PATCH 5/5] iio: adc: New driver for Cirrus Logic EP93xx ADC Alexander Sverdlin
2015-11-25 12:43   ` Peter Meerwald-Stadler
2015-11-25 13:01     ` Alexander Sverdlin [this message]
2015-11-29 16:12   ` Jonathan Cameron
2015-11-29 16:40     ` Alexander Sverdlin
2015-11-29 17:19       ` Jonathan Cameron
2015-11-29 18:27         ` Alexander Sverdlin
2015-12-05 18:50           ` 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=5655B13D.5060708@gmail.com \
    --to=alexander.sverdlin@gmail.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox