All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Hartmut Knaack <knaack.h@gmx.de>,
	linux-iio@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: Re: [PATCH]staging:iio:ad799x make use of platform_data optional
Date: Wed, 01 Jan 2014 12:55:59 +0000	[thread overview]
Message-ID: <52C4105F.3020600@kernel.org> (raw)
In-Reply-To: <52C00C37.2080009@gmx.de>


On 29/12/13 11:49, Hartmut Knaack wrote:
> Setting Vref with platform_data is a neat feature, though it is not essential
> for operating these devices. So make the use of platform_data optional and set
> default value of 1000 mV if nothing else is defined.
>
> Signed-off-by: Hartmut Knaack <knaack.h@gmx.de>

Hi Hartmut,

Why a default of 1V?  Does that correspond to anything in particular?

Whilst the way this is set here is clunky there is a need for this 
voltage to be supplied in some fashion.  Now we'd do it via a regulator
to give us nice standard device tree bindings and to allow for less 
simplistic hardware configurations.

So lets say we convert this to use a regulator, is there still a reason 
why one might want a default value?

Jonathan


> ---
> diff --git a/drivers/staging/iio/adc/ad799x_core.c b/drivers/staging/iio/adc/ad799x_core.c
> index 9428be8..e32a555 100644
> --- a/drivers/staging/iio/adc/ad799x_core.c
> +++ b/drivers/staging/iio/adc/ad799x_core.c
> @@ -545,10 +545,12 @@ static int ad799x_probe(struct i2c_client *client,
>
>   	/* TODO: Add pdata options for filtering and bit delay */
>
> -	if (!pdata)
> -		return -EINVAL;
> -
> -	st->int_vref_mv = pdata->vref_mv;
> +	if ((!pdata) || (!pdata->vref_mv)) {
> +		dev_warn(&client->dev,
> +			 "No platform data found, setting Vref to 1000 mV\n");
> +		st->int_vref_mv = 1000;
> +	} else
> +		st->int_vref_mv = pdata->vref_mv;
>
>   	st->reg = devm_regulator_get(&client->dev, "vcc");
>   	if (!IS_ERR(st->reg)) {
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  reply	other threads:[~2014-01-01 12:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-29 11:49 [PATCH]staging:iio:ad799x make use of platform_data optional Hartmut Knaack
2014-01-01 12:55 ` Jonathan Cameron [this message]
2014-01-01 13:17   ` Hartmut Knaack
2014-01-01 14:14     ` Jonathan Cameron
2014-01-01 15:37       ` Lars-Peter Clausen
2014-01-01 23:19         ` Hartmut Knaack

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=52C4105F.3020600@kernel.org \
    --to=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --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.