Commit 7f1a300f authored by Iker Perez del Palomar Sustatxa's avatar Iker Perez del Palomar Sustatxa Committed by Guenter Roeck

hwmon: (lm75) Add new fields into lm75_params_

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: default avatarIker Perez del Palomar Sustatxa <iker.perez@codethink.co.uk>
Link: https://lore.kernel.org/r/20190808080246.8371-4-iker.perez@codethink.co.uk
[groeck: Minor structure documentation fixes]
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 58608cfe
...@@ -61,15 +61,34 @@ enum lm75_type { /* keep sorted in alphabetical order */ ...@@ -61,15 +61,34 @@ enum lm75_type { /* keep sorted in alphabetical order */
* @resolution_limits: Limit register resolution. Optional. Should be set if * @resolution_limits: Limit register resolution. Optional. Should be set if
* the resolution of limit registers does not match the * the resolution of limit registers does not match the
* resolution of the temperature register. * resolution of the temperature register.
* default_sample_time: Sample time to be set by default. * @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.
* @default_sample_time:Sample time to be set by default.
* @num_sample_times: Number of possible sample times to be set. Optional.
* Should be set if the number of sample times is larger
* than one.
* @sample_times: All the possible sample times to be set. 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.
* Mandatory if num_sample_times is larger than 1.
* If set, number of entries must match num_sample_times.
* @sample_clr_mask: Clear mask used to set the sample time.
*/ */
struct lm75_params { struct lm75_params {
u8 set_mask; u8 set_mask;
u8 clr_mask; u8 clr_mask;
u8 default_resolution; u8 default_resolution;
u8 resolution_limits; u8 resolution_limits;
unsigned int default_sample_time; 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 */ /* Addresses scanned */
...@@ -221,7 +240,14 @@ static const struct lm75_params device_params[] = { ...@@ -221,7 +240,14 @@ static const struct lm75_params device_params[] = {
[tmp75b] = { /* not one-shot mode, Conversion rate 37Hz */ [tmp75b] = { /* not one-shot mode, Conversion rate 37Hz */
.clr_mask = 1 << 7 | 3 << 5, .clr_mask = 1 << 7 | 3 << 5,
.default_resolution = 12, .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, .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] = { [tmp75c] = {
.clr_mask = 1 << 5, /*not one-shot mode*/ .clr_mask = 1 << 5, /*not one-shot mode*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment