linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Iker Perez <iker.perez@codethink.co.uk>
Cc: linux-hwmon@vger.kernel.org, jdelvare@suse.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] hwmon: (lm75) Add new fields into lm75_params_
Date: Wed, 7 Aug 2019 06:51:17 -0700	[thread overview]
Message-ID: <20190807135117.GA11447@roeck-us.net> (raw)
In-Reply-To: <20190806091107.13322-4-iker.perez@codethink.co.uk>

On Tue, Aug 06, 2019 at 10:11:06AM +0100, Iker Perez wrote:
> From: Iker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk>
> 
> The new fields are included to prepare the driver for next patch. The
> fields are:
> 
> * *resolutions: Stores all the supported resolutions by the device.
> * num_sample_times: Stores the number of possible sample times.
> * *sample_times: Stores all the possible sample times to be set.
> * sample_set_masks: The set_masks for the possible sample times
> * sample_clr_mask: Clear mask to set the default sample time.
> 
> Signed-off-by: Iker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk>
> ---
>  drivers/hwmon/lm75.c | 26 +++++++++++++++++++++-----
>  1 file changed, 21 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
> index 477ac0732ddf..a8d0a6fb9762 100644
> --- a/drivers/hwmon/lm75.c
> +++ b/drivers/hwmon/lm75.c
> @@ -58,15 +58,24 @@ enum lm75_type {		/* keep sorted in alphabetical order */
>   *			the chip.
>   * @resolution:		Number of bits to represent the temperatue value.
>   * @resolution_limits:	Resolution range.
> + * @num_sample_times:	Number of possible sample times to be set.

Please add something like:
				Optional. Should be set if the number
				of sample times is larger than one.

>   * default_sample_time:	Sample time to be set by default.
> + * @sample_times:	All the possible sample times to be set.

Please add something like:
				Mandatory if num_sample_times is larger than 1.
				If set, number of entries must match
				num_sample_times.

> + * @sample_set_masks:	All the set_masks for the possible sample times.

Please add something like:
				Mandatory if num_sample_times is larger than 1.
				If set, number of entries must match
				num_sample_times.

> + * @sample_clr_mask:	Clear mask to set the default sample time.

Please add something like:

 * @resolutions:		List of resolutions associated with sample
				times.
				Optional. Should be set if num_sample_times is
				larger than 1, and if the resolution changes
				with sample times. If set, number of entries
				must match num_sample_times.

>   */
>  
>  struct lm75_params {
> -	u8		set_mask;
> -	u8		clr_mask;
> -	u8		default_resolution;
> -	u8		resolution_limits;
> -	unsigned int	default_sample_time;
> +	u8			set_mask;
> +	u8			clr_mask;
> +	u8			default_resolution;
> +	u8			resolution_limits;
> +	const u8		*resolutions;
> +	unsigned int		default_sample_time;
> +	u8			num_sample_times;
> +	const unsigned int	*sample_times;
> +	const u8		*sample_set_masks;
> +	u8			sample_clr_mask;
>  };
>  
>  /* Addresses scanned */
> @@ -214,7 +223,14 @@ static const struct lm75_params device_params[] = {
>  	[tmp75b] = { /* not one-shot mode, Conversion rate 37Hz */
>  		.clr_mask = 1 << 7 | 3 << 5,
>  		.default_resolution = 12,
> +		.sample_set_masks = (u8 []){ 0 << 5, 1 << 5, 2 << 5,
> +			3 << 5 },
> +		.sample_clr_mask = 3 << 5,
>  		.default_sample_time = MSEC_PER_SEC / 37,
> +		.sample_times = (unsigned int []){ MSEC_PER_SEC / 37,
> +			MSEC_PER_SEC / 18,
> +			MSEC_PER_SEC / 9, MSEC_PER_SEC / 4 },
> +		.num_sample_times = 4,
>  	},
>  	[tmp75c] = {
>  		.clr_mask = 1 << 5,	/*not one-shot mode*/
> -- 
> 2.11.0
> 

  reply	other threads:[~2019-08-07 13:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-06  9:11 [PATCH 0/4] Add support for variable sample time in lm75 driver Iker Perez
2019-08-06  9:11 ` [PATCH 1/4] hwmon: (lm75) Create structure to save all the configuration parameters Iker Perez
2019-08-06 22:39   ` Guenter Roeck
2019-08-07 13:53   ` Guenter Roeck
2019-08-06  9:11 ` [PATCH 2/4] hwmon: (lm75) Create function from code to write into registers Iker Perez
2019-08-06  9:11 ` [PATCH 3/4] hwmon: (lm75) Add new fields into lm75_params_ Iker Perez
2019-08-07 13:51   ` Guenter Roeck [this message]
2019-08-06  9:11 ` [PATCH 4/4] hwmon: (lm75) Modularize lm75_write and make hwmon_chip writable Iker Perez

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=20190807135117.GA11447@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=iker.perez@codethink.co.uk \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).