All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: "Pop, Cristian" <Cristian.Pop@analog.com>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"Ardelean, Alexandru" <alexandru.Ardelean@analog.com>,
	"Bogdan, Dragos" <Dragos.Bogdan@analog.com>,
	"Berghe, Darius" <Darius.Berghe@analog.com>,
	"Caprioru, Mircea" <Mircea.Caprioru@analog.com>
Subject: Re: AD 5766 driver software reset during runtime
Date: Sun, 3 May 2020 14:02:18 +0100	[thread overview]
Message-ID: <20200503140218.6862a3a6@archlinux> (raw)
In-Reply-To: <CH2PR03MB5271407F0344001EB87E1427E7AA0@CH2PR03MB5271.namprd03.prod.outlook.com>

On Thu, 30 Apr 2020 06:52:50 +0000
"Pop, Cristian" <Cristian.Pop@analog.com> wrote:

> Hello to all,
> 
> For those who are receiving this email for the second time, it seems
> that linux-iio@vger.kernel.org, doesn't accept HTML format emails, so
> this is a plain text version.
> 
> I have been developing a linux kernel drive for a DAC converter,
> ad5766 and it supports changing the output span range, from eight
> available output ranges during runtime. This is done setting scale
> and offset attributes trough a `write_raw` call. When changing the
> range during runtime for this chip, a software reset is necessary,
> before writing to the span register. Do you think this is acceptable
> upstream? Should we make the span ranges selectable at runtime? From
> what I heard, it's not always a good idea to do reset of a device at
> runtime.

There is no fundamental issue with doing resets at runtime - we often
have to do this to get out of error conditions etc and it also often
happens if we remove and reprobe a device.

What I really don't want to see is a userspace reset control.  If
some other control requires a reset to actually set the value, then fine.

I would suggest you want to block that control unless all the dac
channels are disabled.  Right now it looks like the driver
doesn't support power down, but I think the hardware does from
a quick glance at the datasheet.  Resetting with powered up channels
sounds like a bad idea to me.

Thanks,

Jonathan

> 
> AD5722 software reset in driver before setting a new offset / range:
> https://github.com/analogdevicesinc/linux/blob/4c7d019397e696dcaf735c52169a92fcbe5b5b8b/drivers/iio/dac/ad5766.c#L309
> 
> AD5722 software reset in driver, before setting a new scale / range:
> https://github.com/analogdevicesinc/linux/blob/4c7d019397e696dcaf735c52169a92fcbe5b5b8b/drivers/iio/dac/ad5766.c#L357
> 
> AD5722 datasheet:
> https://www.analog.com/media/en/technical-documentation/data-sheets/AD5722_5732_5752.pdf
> 
> Thanks and best regards,
> Cristian Pop


      reply	other threads:[~2020-05-03 13:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30  6:52 AD 5766 driver software reset during runtime Pop, Cristian
2020-05-03 13:02 ` Jonathan Cameron [this message]

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=20200503140218.6862a3a6@archlinux \
    --to=jic23@kernel.org \
    --cc=Cristian.Pop@analog.com \
    --cc=Darius.Berghe@analog.com \
    --cc=Dragos.Bogdan@analog.com \
    --cc=Mircea.Caprioru@analog.com \
    --cc=alexandru.Ardelean@analog.com \
    --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.