All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Titinger <mtitinger@baylibre.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de,
	pmeerw@pmeerw.net, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] iio: ina2xx: add support for TI INA2xx Power Monitors
Date: Wed, 2 Dec 2015 18:09:40 +0100	[thread overview]
Message-ID: <565F25D4.10006@baylibre.com> (raw)
In-Reply-To: <565F1FF8.5030508@roeck-us.net>

On 02/12/2015 17:44, Guenter Roeck wrote:
> On 12/02/2015 08:20 AM, Marc Titinger wrote:
>> On 02/12/2015 17:04, Guenter Roeck wrote:
>>> On 12/02/2015 02:20 AM, Marc Titinger wrote:
>>>> On 02/12/2015 03:14, Guenter Roeck wrote:
>>>>> On Mon, Nov 30, 2015 at 12:49:14PM +0100, Marc Titinger wrote:
>>>>>> in SOFTWARE buffer mode, a kthread will capture the active
>>>>>> scan_elements
>>>>>> into a kfifo, then compute the remaining time until the next capture
>>>>>> tick
>>>>>> and do an active wait (udelay).
>>>>>>
>>>>>> This will produce a stream of up to fours channels plus a 64bits
>>>>>> timestamps (ns).
>>>>>>
>>>>>> Tested with ina226, on BeagleBoneBlack.
>>>>>>
>>>>>> Datasheet: http://www.ti.com/lit/gpn/ina226
>>>>>>
>>>>>> Signed-off-by: Marc Titinger <mtitinger@baylibre.com>
>>>>>> ---
>>>>>>   drivers/iio/adc/Kconfig      |   9 +
>>>>>>   drivers/iio/adc/Makefile     |   1 +
>>>>>>   drivers/iio/adc/ina2xx-iio.c | 678
>>>>>> +++++++++++++++++++++++++++++++++++++++++++
>>>>>>   3 files changed, 688 insertions(+)
>>>>>>   create mode 100644 drivers/iio/adc/ina2xx-iio.c
>>>>>> +
>>>>> [ ... ]
>>>>>> +
>>>>>> +static const struct i2c_device_id ina2xx_id[] = {
>>>>>> +    {"ina219", ina219},
>>>>>> +    {"ina220", ina219},
>>>>>> +    {"ina226", ina226},
>>>>>> +    {"ina230", ina226},
>>>>>> +    {"ina231", ina226},
>>>>>> +    {}
>>>>>> +};
>>>>>
>>>>> I wonder what is going to happen if both this driver and the hwmon
>>>>> driver for the same chips are configured in a system which supports
>>>>> devicetree (or any system, really). Unless I am missing something,
>>>>> the result will be that both drivers will try to instantiate, and
>>>>> one will fail with -EBUSY. Or the instantiated driver is more or less
>>>>> random, depending on which one happens to be loaded. Not a good
>>>>> situation to be in.
>>>>
>>>> I agree, we should put a mutual exclusion in Kconfig, plus maybe a
>>>> cross-reference in the help section.
>>>>
>>>>>
>>>>> For the time being, it might make sense to add cross-dependencies
>>>>> in Kconfig to only permit one of the two drivers to be configured.
>>>>>
>>>>> Ultimately we may need a better solution for the iio-hwmon bridge,
>>>>> one that makes the underlying driver transparent in both devicetree
>>>>> properties and user space ABI. No idea how to do that, though.
>>>>>
>>>>
>>>> IDK if ina2xx is a special case or if this matter of dual driver
>>>> stacks for the same chip already occurred and requires specific
>>>> plumbing. Making the user aware of the mutual of the exclusion sounds
>>>> fine with me.
>>>>
>>> htu21. We'll drop that driver from hwmon with the 4.5 kernel.
>>> We could just drop ina2xx as well, but it is more widely used
>>> and referenced from dts files. The ABI changes, so I am not sure
>>> if we can just do that.
>>
>> I changed iio/adc/Kconfig to the following:
>>
>> +config INA2XX_ADC
>> +       tristate "Texas Instruments INA2xx Power Monitors IIO driver"
>> +       depends on I2C && !SENSORS_INA2XX
>> +       select REGMAP_I2C
>> +       select IIO_BUFFER
>> +       select IIO_KFIFO_BUF
>> +       help
>> +         Say yes here to build support for TI INA2xx family of Power
>> Monitors.
>> +         This driver is mutually exclusive with the HWMON version.
>> +
>>
>>
>> anything the patch should also add to hwmon/Kconfig (that will not
>> lead to a cycling reference warning) ?
>>
>
> You could try the opposite, but I don't know if that works.
>
>      depends on I2C && !INA2XX_ADC

I tried: it's functional, but leads to a ugly warning:

drivers/iio/adc/Kconfig:173:error: recursive dependency detected!
drivers/iio/adc/Kconfig:173:	symbol INA2XX_ADC depends on SENSORS_INA2XX
drivers/hwmon/Kconfig:1453:	symbol SENSORS_INA2XX depends on INA2XX_ADC

Anyone knows how to implement a radio button in Kconfig ? ;)


>
> Guenter
>


  reply	other threads:[~2015-12-02 17:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-30 11:49 [PATCH v2 0/2] IIO version of INA2xx Marc Titinger
2015-11-30 11:49 ` [PATCH v2 1/2] iio: ina2xx: add support for TI INA2xx Power Monitors Marc Titinger
2015-11-30 12:16   ` Peter Meerwald-Stadler
2015-12-05 18:29     ` Jonathan Cameron
2015-12-02  2:14   ` Guenter Roeck
2015-12-02 10:20     ` Marc Titinger
2015-12-02 16:04       ` Guenter Roeck
2015-12-02 16:20         ` Marc Titinger
2015-12-02 16:44           ` Guenter Roeck
2015-12-02 17:09             ` Marc Titinger [this message]
2015-12-02 17:20               ` Guenter Roeck
2015-11-30 11:49 ` [PATCH v2 2/2] iio: ina2xx: provide a sysfs parameter to allow async readout of the ADCs Marc Titinger
2015-12-05 18:30   ` 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=565F25D4.10006@baylibre.com \
    --to=mtitinger@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --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 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.