All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ivan T. Ivanov" <iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
To: linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3 1/2] iio: vadc: Qualcomm SPMI PMIC voltage ADC driver
Date: Thu, 02 Oct 2014 12:29:53 +0300	[thread overview]
Message-ID: <542D1B11.8070600@mm-sol.com> (raw)
In-Reply-To: <1411563415-11933-2-git-send-email-svarbanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>


Hi Stan,

On 09/24/2014 03:56 PM, Stanimir Varbanov wrote:

<snip>

> +static int vadc_get_dt_data(struct vadc_priv *vadc, struct device_node *node)
> +{
> +	struct iio_chan_spec *iio_chan = vadc->iio_chans;
> +	const struct vadc_channels *vadc_chan;
> +	struct vadc_channel_prop prop;
> +	struct device_node *child;
> +	int ret, index = 0;
> +
> +	for_each_available_child_of_node(node, child) {
> +		ret = vadc_get_dt_channel_data(vadc->dev, &prop, child);
> +		if (ret)
> +			return ret;
> +
> +		vadc->chan_props[index] = prop;
> +
> +		vadc_chan = &vadc_chans[prop.channel];
> +
> +		iio_chan->channel = prop.channel;
> +		iio_chan->datasheet_name = vadc_chan->datasheet_name;
> +		iio_chan->info_mask_separate = vadc_chan->info_mask;
> +		iio_chan->type = vadc_chan->type;
> +		iio_chan->indexed = 1;
> +		iio_chan->scan_type.sign = 's';
> +		iio_chan->scan_type.realbits = 15;
> +		iio_chan->scan_type.storagebits = 16;
> +		iio_chan->address = index++;
> +
> +		iio_chan++;
> +	}
> +
> +	return 0;
> +}
> +

<snip>

> +static int vadc_probe(struct platform_device *pdev)
> +{

<snip>

> +
> +	indio_dev->dev.parent = dev;
> +	indio_dev->dev.of_node = node;
> +	indio_dev->name = pdev->name;
> +	indio_dev->modes = INDIO_DIRECT_MODE;
> +	indio_dev->info = &vadc_info;
> +	indio_dev->channels = vadc->iio_chans;
> +	indio_dev->num_channels = vadc->nchannels;

This will not work as we thought. Registration will be fine and entries
in sysfs are created as expected, but this is breaking numbering scheme
for client drivers. For us the problem is that iio framework expect channels
numbering to be linear and channel number should not be greater than
channel count. For example even if die temperature channel is always 8, if
I describe only 5 channels in DTS files (4 for reference points measurement)
and 1 for die temperature, clients could not get OF reference to 
temperature
channel using io-channels = <&pm8941_vadc 8>;

Jonathan, please, could you advise us.

Regards,
Ivan

> +
> +	return devm_iio_device_register(dev, indio_dev);
> +}
> +
>

WARNING: multiple messages have this Message-ID (diff)
From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
To: linux-iio@vger.kernel.org
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v3 1/2] iio: vadc: Qualcomm SPMI PMIC voltage ADC driver
Date: Thu, 02 Oct 2014 12:29:53 +0300	[thread overview]
Message-ID: <542D1B11.8070600@mm-sol.com> (raw)
In-Reply-To: <1411563415-11933-2-git-send-email-svarbanov@mm-sol.com>


Hi Stan,

On 09/24/2014 03:56 PM, Stanimir Varbanov wrote:

<snip>

> +static int vadc_get_dt_data(struct vadc_priv *vadc, struct device_node *node)
> +{
> +	struct iio_chan_spec *iio_chan = vadc->iio_chans;
> +	const struct vadc_channels *vadc_chan;
> +	struct vadc_channel_prop prop;
> +	struct device_node *child;
> +	int ret, index = 0;
> +
> +	for_each_available_child_of_node(node, child) {
> +		ret = vadc_get_dt_channel_data(vadc->dev, &prop, child);
> +		if (ret)
> +			return ret;
> +
> +		vadc->chan_props[index] = prop;
> +
> +		vadc_chan = &vadc_chans[prop.channel];
> +
> +		iio_chan->channel = prop.channel;
> +		iio_chan->datasheet_name = vadc_chan->datasheet_name;
> +		iio_chan->info_mask_separate = vadc_chan->info_mask;
> +		iio_chan->type = vadc_chan->type;
> +		iio_chan->indexed = 1;
> +		iio_chan->scan_type.sign = 's';
> +		iio_chan->scan_type.realbits = 15;
> +		iio_chan->scan_type.storagebits = 16;
> +		iio_chan->address = index++;
> +
> +		iio_chan++;
> +	}
> +
> +	return 0;
> +}
> +

<snip>

> +static int vadc_probe(struct platform_device *pdev)
> +{

<snip>

> +
> +	indio_dev->dev.parent = dev;
> +	indio_dev->dev.of_node = node;
> +	indio_dev->name = pdev->name;
> +	indio_dev->modes = INDIO_DIRECT_MODE;
> +	indio_dev->info = &vadc_info;
> +	indio_dev->channels = vadc->iio_chans;
> +	indio_dev->num_channels = vadc->nchannels;

This will not work as we thought. Registration will be fine and entries
in sysfs are created as expected, but this is breaking numbering scheme
for client drivers. For us the problem is that iio framework expect channels
numbering to be linear and channel number should not be greater than
channel count. For example even if die temperature channel is always 8, if
I describe only 5 channels in DTS files (4 for reference points measurement)
and 1 for die temperature, clients could not get OF reference to 
temperature
channel using io-channels = <&pm8941_vadc 8>;

Jonathan, please, could you advise us.

Regards,
Ivan

> +
> +	return devm_iio_device_register(dev, indio_dev);
> +}
> +
>


WARNING: multiple messages have this Message-ID (diff)
From: "Ivan T. Ivanov" <iivanov@mm-sol.com>
To: linux-kernel@vger.kernel.org
Cc: linux-iio@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	devicetree@vger.kernel.org
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v3 1/2] iio: vadc: Qualcomm SPMI PMIC voltage ADC driver
Date: Thu, 02 Oct 2014 12:29:53 +0300	[thread overview]
Message-ID: <542D1B11.8070600@mm-sol.com> (raw)
In-Reply-To: <1411563415-11933-2-git-send-email-svarbanov@mm-sol.com>


Hi Stan,

On 09/24/2014 03:56 PM, Stanimir Varbanov wrote:

<snip>

> +static int vadc_get_dt_data(struct vadc_priv *vadc, struct device_node *node)
> +{
> +	struct iio_chan_spec *iio_chan = vadc->iio_chans;
> +	const struct vadc_channels *vadc_chan;
> +	struct vadc_channel_prop prop;
> +	struct device_node *child;
> +	int ret, index = 0;
> +
> +	for_each_available_child_of_node(node, child) {
> +		ret = vadc_get_dt_channel_data(vadc->dev, &prop, child);
> +		if (ret)
> +			return ret;
> +
> +		vadc->chan_props[index] = prop;
> +
> +		vadc_chan = &vadc_chans[prop.channel];
> +
> +		iio_chan->channel = prop.channel;
> +		iio_chan->datasheet_name = vadc_chan->datasheet_name;
> +		iio_chan->info_mask_separate = vadc_chan->info_mask;
> +		iio_chan->type = vadc_chan->type;
> +		iio_chan->indexed = 1;
> +		iio_chan->scan_type.sign = 's';
> +		iio_chan->scan_type.realbits = 15;
> +		iio_chan->scan_type.storagebits = 16;
> +		iio_chan->address = index++;
> +
> +		iio_chan++;
> +	}
> +
> +	return 0;
> +}
> +

<snip>

> +static int vadc_probe(struct platform_device *pdev)
> +{

<snip>

> +
> +	indio_dev->dev.parent = dev;
> +	indio_dev->dev.of_node = node;
> +	indio_dev->name = pdev->name;
> +	indio_dev->modes = INDIO_DIRECT_MODE;
> +	indio_dev->info = &vadc_info;
> +	indio_dev->channels = vadc->iio_chans;
> +	indio_dev->num_channels = vadc->nchannels;

This will not work as we thought. Registration will be fine and entries
in sysfs are created as expected, but this is breaking numbering scheme
for client drivers. For us the problem is that iio framework expect channels
numbering to be linear and channel number should not be greater than
channel count. For example even if die temperature channel is always 8, if
I describe only 5 channels in DTS files (4 for reference points measurement)
and 1 for die temperature, clients could not get OF reference to 
temperature
channel using io-channels = <&pm8941_vadc 8>;

Jonathan, please, could you advise us.

Regards,
Ivan

> +
> +	return devm_iio_device_register(dev, indio_dev);
> +}
> +
>


  parent reply	other threads:[~2014-10-02  9:29 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24 12:56 [PATCH v3 0/2] Intial support for voltage ADC Stanimir Varbanov
     [not found] ` <1411563415-11933-1-git-send-email-svarbanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-09-24 12:56   ` [PATCH v3 1/2] iio: vadc: Qualcomm SPMI PMIC voltage ADC driver Stanimir Varbanov
2014-09-24 12:56     ` Stanimir Varbanov
     [not found]     ` <1411563415-11933-2-git-send-email-svarbanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-09-25 12:47       ` Ivan T. Ivanov
2014-09-25 12:47         ` Ivan T. Ivanov
2014-09-25 15:30         ` Stanimir Varbanov
2014-09-25 15:30           ` Stanimir Varbanov
     [not found]           ` <54243533.7080809-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-09-25 19:27             ` Ivan T. Ivanov
2014-09-25 19:27               ` Ivan T. Ivanov
2014-10-12 22:14           ` Hartmut Knaack
2014-10-12 22:14             ` Hartmut Knaack
2014-10-02  9:29       ` Ivan T. Ivanov [this message]
2014-10-02  9:29         ` Ivan T. Ivanov
2014-10-02  9:29         ` Ivan T. Ivanov
     [not found]         ` <542D1B11.8070600-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-10-02 12:08           ` Ivan T. Ivanov
2014-10-02 12:08             ` Ivan T. Ivanov
2014-10-04 11:51             ` Jonathan Cameron
     [not found]               ` <542FDF41.2040106-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-10-07 11:57                 ` Ivan T. Ivanov
2014-10-07 11:57                   ` Ivan T. Ivanov
2014-10-16 13:58                 ` Ivan T. Ivanov
2014-10-16 13:58                   ` Ivan T. Ivanov
2014-10-12 22:07     ` Hartmut Knaack
2014-10-14  9:36       ` Stanimir Varbanov
2014-10-14  9:36         ` Stanimir Varbanov
2014-09-24 12:56   ` [PATCH v3 2/2] DT: iio: vadc: document dt binding Stanimir Varbanov
2014-09-24 12:56     ` Stanimir Varbanov
2014-09-27  9:43     ` Jonathan Cameron
2014-10-11 23:05     ` Hartmut Knaack
2014-10-14  5:28       ` Stanimir Varbanov
2014-10-14  5:28         ` Stanimir Varbanov
     [not found]     ` <1411563415-11933-3-git-send-email-svarbanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-10-13 15:00       ` Mark Rutland
2014-10-13 15:00         ` Mark Rutland
2014-10-14  9:27         ` Stanimir Varbanov
2014-10-14  9:27           ` Stanimir Varbanov
     [not found]           ` <543CEC7F.50208-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-10-31 14:40             ` Ivan T. Ivanov
2014-10-31 14:40               ` Ivan T. Ivanov

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=542D1B11.8070600@mm-sol.com \
    --to=iivanov-neyub+7iv8pqt0dzr+alfa@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.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.