All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: John Muir <john@jmuir.com>
Cc: Jean Delvare <jdelvare@suse.com>,
	Jonathan Corbet <corbet@lwn.net>,
	linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>, John Muir <muirj@google.com>,
	Anatol Pomazau <anatol@google.com>
Subject: Re: [PATCH 1/2] hwmon: Add Texas Instruments TMP108 temperature sensor driver.
Date: Thu, 1 Dec 2016 14:08:17 -0800	[thread overview]
Message-ID: <20161201220817.GA5274@roeck-us.net> (raw)
In-Reply-To: <126058B2-9FD8-4F95-AEAA-3F1A60CCC1FD@jmuir.com>

Hi John,

On Thu, Dec 01, 2016 at 01:50:22PM -0800, John Muir wrote:
> Hi Guenter,
> 
[ ... ]
> 
> >> +static int __maybe_unused tmp108_resume(struct device *dev)
> >> +{
> >> +	struct tmp108 *tmp108 = dev_get_drvdata(dev);
> >> +	int err;
> >> +
> >> +	err = regmap_write(tmp108->regmap, TMP108_REG_CONF,
> >> +			   tmp108->curr_config);
> >> +
> >> +	tmp108->ready_time = jiffies;
> >> +	if (tmp108->curr_config & TMP108_MODE_CONTINUOUS)
> > 
> > Since only continuous mode is supported, and it is somewhat unlikely
> > that we'll ever support one-shot mode, I think it would be better to
> > unconditionally set continuous mode and the delay here and drop
> > curr_config entirely. curr_config adds quite some complexity to the
> > driver with no real gain.
> 
> OK. Due to my ignorance I was assuming that the could would need to restore the current configuration during resume, and also the previous versions (that you did not see) of this code was not using regmap. In fact I see that there is also a function called ‘regmap_sync’ which is used (mainly by audio codecs) to do this (i.e.; as part of device reset but there are examples in resume()). The configuration register is now marked volatile so it would be skipped by regmap_sync anyway.
> 
> Should we be concerned about restoring the configuration here?
> 
Interesting question. If the chip was really powered off, you would
have to restore the entire configuration, not just the configuration
register. Given that, I think it is sufficient to just restore the
operational mode, ie the value changed when entering suspend.

Where did you find regmap_sync() ? It seems to be hiding from me.

Thanks,
Guenter

  reply	other threads:[~2016-12-01 22:08 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-27  1:26 [PATCH 0/3] Texas Instruments TMP108 temperature sensor driver John Muir
2016-11-27  2:18 ` Guenter Roeck
2016-11-30 20:36 ` [PATCH v2 0/2] " John Muir
2016-11-30 20:36   ` [PATCH 1/2] hwmon: Add " John Muir
2016-12-01 15:19     ` Guenter Roeck
2016-12-01 21:50       ` John Muir
2016-12-01 22:08         ` Guenter Roeck [this message]
2016-12-01 22:15           ` John Muir
2016-11-30 20:36   ` [PATCH 2/2] devicetree: hwmon: Add documentation for TMP108 driver John Muir
2016-12-01  0:42     ` Guenter Roeck
2016-12-01  1:41       ` John Muir
2016-12-02  2:32   ` [PATCH v3 0/2] Texas Instruments TMP108 temperature sensor driver John Muir
2016-12-02  2:32     ` [PATCH v3 1/2] hwmon: Add " John Muir
2016-12-02  4:40       ` Guenter Roeck
2016-12-02  5:45         ` John Muir
2016-12-02  2:32     ` [PATCH v3 2/2] devicetree: hwmon: Add documentation for TMP108 driver John Muir
2016-12-02  4:42       ` Guenter Roeck

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=20161201220817.GA5274@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=anatol@google.com \
    --cc=corbet@lwn.net \
    --cc=jdelvare@suse.com \
    --cc=john@jmuir.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=muirj@google.com \
    --cc=robh+dt@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.