Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1636300

Re: [PATCH v3] iio: adc: Add support for TI ADC108S102 and ADC128S102

From Jan Kiszka <jan.kiszka@siemens.com>
Newsgroups linux.kernel
Subject Re: [PATCH v3] iio: adc: Add support for TI ADC108S102 and ADC128S102
Date 2017-05-05 12:40 +0200
Message-ID <tDIOu-vu-17@gated-at.bofh.it> (permalink)
References <tDF4d-6re-3@gated-at.bofh.it> <tDIbM-8pT-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2017-05-05 11:54, Andy Shevchenko wrote:
> On Fri, 2017-05-05 at 08:31 +0200, Jan Kiszka wrote:
>> This is an upstream port of an IIO driver for the TI ADC108S102 and
>> ADC128S102. The former can be found on the Intel Galileo Gen2 and the
>> Siemens SIMATIC IOT2000. For those boards, ACPI-based enumeration is
>> included.
>>
>> Due to the lack of regulators under ACPI, we need a special device
>> property to define the voltage provide to the VA pin of the ADC
>> ("va-millivolt"). For DT usage, the regulator "vref-supply" is
>> requested. Note that DT usage has not been tested.
> 
> +1 to what Mika commented on this and just some additional information.
> 
> Other than that looks pretty good.
> 
>> Changes in v3:
>>  - Reworked reference voltage handling, splitting up the different
>> ACPI
>>    case from DT usage. This also means that the "va-millivolt"
>>    (formerly and incorrectly called "ext-vin-microvolt") becomes
>>    ACPI-only
> 
> Just to be clean, there is *no* such thing as *XYZ-only* device
> properties. The idea behind them is to provide resource provider
> agnostic API to read properties.

Well, as along as ACPI does its own thing /wrt regulators, we have that
problem. But let's wait until someone designs an ACPI board with that
chip and a different reference voltage.

> 
>> +			if (st->reg)
>> +				*val = regulator_get_voltage(st->reg) 
>> / 1000;
>> +			else
>> +				*val = st->va_millivolt;
>> +
> 
> Another way is to not just hard code the value, but create a fixed
> voltage regulator out of it. In this case you will have one way to get
> its value.

That's a good idea.

> 
>> +		st->reg = devm_regulator_get(&spi->dev, "vref");
> 
> It should be _optional like I mentioned in one of previous review.
> 
>> +	if (!IS_ERR(st->reg))
> 
> This is redundant

It's not for the existing code because regulator_disable doesn't test
this for us. It will be, though, when I switch back to making it
mandatory for everyone.

Jan

> 
>> +		regulator_disable(st->reg);
> 
>> +	if (!IS_ERR(st->reg))
> 
> Ditto.
> 
>> +		regulator_disable(st->reg);
> 
> 

-- 
Siemens AG, Corporate Technology, CT RDA ITP SES-DE
Corporate Competence Center Embedded Linux

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3] iio: adc: Add support for TI ADC108S102 and ADC128S102 Jan Kiszka <jan.kiszka@siemens.com> - 2017-05-05 08:40 +0200
  Re: [PATCH v3] iio: adc: Add support for TI ADC108S102 and ADC128S102 Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-05-05 11:50 +0200
    Re: [PATCH v3] iio: adc: Add support for TI ADC108S102 and ADC128S102 Jan Kiszka <jan.kiszka@siemens.com> - 2017-05-05 12:30 +0200
      Re: [PATCH v3] iio: adc: Add support for TI ADC108S102 and ADC128S102 Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-05-05 12:50 +0200
        Re: [PATCH v3] iio: adc: Add support for TI ADC108S102 and ADC128S102 Jonathan Cameron <jic23@kernel.org> - 2017-05-05 21:00 +0200
  Re: [PATCH v3] iio: adc: Add support for TI ADC108S102 and  ADC128S102 Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-05 12:00 +0200
    Re: [PATCH v3] iio: adc: Add support for TI ADC108S102 and ADC128S102 Jan Kiszka <jan.kiszka@siemens.com> - 2017-05-05 12:40 +0200
      Re: [PATCH v3] iio: adc: Add support for TI ADC108S102 and ADC128S102 Jonathan Cameron <jic23@kernel.org> - 2017-05-05 21:00 +0200
        Re: [PATCH v3] iio: adc: Add support for TI ADC108S102 and ADC128S102 Jan Kiszka <jan.kiszka@siemens.com> - 2017-05-05 22:20 +0200
          Re: [PATCH v3] iio: adc: Add support for TI ADC108S102 and  ADC128S102 Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-05 22:40 +0200
            Re: [PATCH v3] iio: adc: Add support for TI ADC108S102 and ADC128S102 Jonathan Cameron <jic23@kernel.org> - 2017-05-08 00:00 +0200
  Re: [PATCH v3] iio: adc: Add support for TI ADC108S102 and ADC128S102 Jonathan Cameron <jic23@kernel.org> - 2017-05-05 21:00 +0200
    Re: [PATCH v3] iio: adc: Add support for TI ADC108S102 and  ADC128S102 Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2017-05-05 21:10 +0200
      Re: [PATCH v3] iio: adc: Add support for TI ADC108S102 and ADC128S102 Jonathan Cameron <jic23@kernel.org> - 2017-05-08 00:00 +0200

csiph-web