public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	linux-iio@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Sascha Weisenberger <sascha.weisenberger@siemens.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Rob Herring <robh@kernel.org>
Subject: Re: [PATCH v3] iio: adc: Add support for TI ADC108S102 and ADC128S102
Date: Fri, 5 May 2017 12:40:09 +0300	[thread overview]
Message-ID: <20170505094009.GP2697@lahna.fi.intel.com> (raw)
In-Reply-To: <6d6bf102-1bc9-7019-13fa-b8f86b002dc8@siemens.com>

On Fri, May 05, 2017 at 08:31:32AM +0200, Jan Kiszka wrote:
> +static int adc108s102_probe(struct spi_device *spi)
> +{
> +	struct adc108s102_state *st;
> +	struct iio_dev *indio_dev;
> +	int ret;
> +
> +	indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
> +	if (!indio_dev)
> +		return -ENOMEM;
> +
> +	st = iio_priv(indio_dev);
> +
> +	if (ACPI_COMPANION(&spi->dev)) {
> +		st->reg = NULL;
> +		ret = device_property_read_u32(&spi->dev, "va-millivolt",
> +					    &st->va_millivolt);

Please try to avoid things like this for now. You can just hard code the
voltage now and we can think how to solve this in ACPI if there will be
an actual user needing anything else than the voltage you are using on
your board.

> +		if (ret < 0) {
> +			dev_err(&spi->dev,
> +				"Missing va-millivolt device property\n");
> +			return -ENODEV;
> +		}
> +	} else {
> +		st->reg = devm_regulator_get(&spi->dev, "vref");
> +		if (IS_ERR(st->reg))
> +			return PTR_ERR(st->reg);

This should be an optional regulator and in case of ACPI you just don't
have it.

> +
> +		ret = regulator_enable(st->reg);
> +		if (ret < 0) {
> +			dev_err(&spi->dev, "Cannot enable vref regulator\n");
> +			return ret;
> +		}
> +	}

  reply	other threads:[~2017-05-05  9:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-05  6:31 [PATCH v3] iio: adc: Add support for TI ADC108S102 and ADC128S102 Jan Kiszka
2017-05-05  9:40 ` Mika Westerberg [this message]
2017-05-05 10:23   ` Jan Kiszka
2017-05-05 10:40     ` Mika Westerberg
2017-05-05 18:50       ` Jonathan Cameron
2017-05-05  9:54 ` Andy Shevchenko
2017-05-05 10:39   ` Jan Kiszka
2017-05-05 18:52     ` Jonathan Cameron
2017-05-05 20:09       ` Jan Kiszka
2017-05-05 20:32         ` Andy Shevchenko
2017-05-07 11:19           ` Jonathan Cameron
2017-05-05 18:55 ` Jonathan Cameron
2017-05-05 19:09   ` Andy Shevchenko
2017-05-07 11:17     ` 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=20170505094009.GP2697@lahna.fi.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jan.kiszka@siemens.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=robh@kernel.org \
    --cc=sascha.weisenberger@siemens.com \
    /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