From: Henrik Rydberg <rydberg@euromail.se>
To: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: Jean Delvare <khali@linux-fr.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>
Subject: Re: [lm-sensors] [PATCH 5/8] hwmon: applesmc: Extract all features generically
Date: Fri, 05 Nov 2010 09:52:55 +0100 [thread overview]
Message-ID: <4CD3C5E7.1030301@euromail.se> (raw)
In-Reply-To: <20101105025020.GD28308@ericsson.com>
>> /* Dynamic device node attributes */
>> struct applesmc_dev_attr {
>> struct sensor_device_attribute sda; /* hwmon attributes */
>> @@ -145,6 +135,10 @@ static struct applesmc_registers {
>> unsigned int temp_count; /* number of temperature registers */
>> unsigned int temp_begin; /* temperature lower index bound */
>> unsigned int temp_end; /* temperature upper index bound */
>> + bool has_accelerometer; /* has motion sensor */
>> + bool has_left_light; /* has left light sensor */
>> + bool has_right_light; /* has right light sensor */
>> + bool has_key_light; /* has keyboard backlight */
>
> Maybe has_key_backlight ? Might be a bit less confusing.
Good point, thanks.
>> @@ -534,9 +535,26 @@ static int applesmc_init_smcreg_try(void)
>> return ret;
>> s->temp_count = s->temp_end - s->temp_begin;
>>
>> + ret = applesmc_has_key(LIGHT_SENSOR_LEFT_KEY, &s->has_left_light);
>> + if (ret)
>> + return ret;
>> + ret = applesmc_has_key(LIGHT_SENSOR_RIGHT_KEY, &s->has_right_light);
>> + if (ret)
>> + return ret;
>> + ret = applesmc_has_key(MOTION_SENSOR_KEY, &s->has_accelerometer);
>> + if (ret)
>> + return ret;
>> + ret = applesmc_has_key(BACKLIGHT_KEY, &s->has_key_light);
>> + if (ret)
>> + return ret;
>> +
>> s->init_complete = true;
>>
>> - pr_info("key=%d temp=%d\n", s->key_count, s->temp_count);
>> + pr_info("key=%d temp=%d acc=%d, light=%d, keyb=%d\n",
>
> light= and keyb= are a bit confusing. Maybe at least use backlight= ?
I think "key" is important, since there are many confusions regarding lcd and
key backlight. And the dmesg line becomes awfully long quickly... I'll check.
>
>> + s->key_count, s->temp_count,
>> + s->has_accelerometer,
>> + s->has_left_light + s->has_right_light,
>
> Resulting output is 0, 1, or 3. And "1" can mean left or right.
> Is this useful ?
Yes. Newer models seem to be moving away from the whole light sensor thing, but
a few machines had "stereo" light sensors, which later turned into a single
sensor. The "left and right" is less important than "stereo and mono", which
boils down to the number of sensors. Maybe I can change the names to make this
clearer.
>> +static int applesmc_dmi_match(const struct dmi_system_id *id)
>> +{
>> + pr_info("%s detected\n", id->ident);
>
> Is this useful enough to be pr_info or just noisy ?
Nah, noise. :-)
>> @@ -1468,18 +1349,20 @@ static int __init applesmc_init(void)
>> if (ret)
>> goto out_fans;
>>
>> - if (applesmc_accelerometer) {
>> + if (smcreg.has_accelerometer) {
>> ret = applesmc_create_accelerometer();
>> if (ret)
>> goto out_temperature;
>> }
>>
>> - if (applesmc_light) {
>> + if (smcreg.has_left_light) {
>> /* Add light sensor file */
>> ret = sysfs_create_file(&pdev->dev.kobj, &dev_attr_light.attr);
>> if (ret)
>> goto out_accelerometer;
>> + }
>>
> So "light" == left light sensor. How about the right light sensor ?
>
> If (theoretically) a device as only a right light sensor, you would display
> that a light sensor exists and then not create a sysfs file for it.
Yep. See comment above.
> Maybe add a right_light sysfs attribute ? Or drop the knowledge about it entirely
> since you don't use it anyway. Or merge the two into a single attribute file
> (if that makes sense).
Merging the has_left and has_right into a number might resolve the problems.
Thanks,
Henrik
next prev parent reply other threads:[~2010-11-05 8:53 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-31 7:50 [PATCH 0/8] hwmon: applesmc: Dynamic configuration rewrite Henrik Rydberg
2010-10-31 7:50 ` [PATCH 1/8] hwmon: applesmc: Relax the severity of device init failure Henrik Rydberg
2010-11-02 16:03 ` [lm-sensors] " Guenter Roeck
2010-11-03 14:45 ` Henrik Rydberg
2010-10-31 7:50 ` [PATCH 2/8] hwmon: applesmc: Introduce a register lookup table Henrik Rydberg
2010-11-04 4:21 ` [lm-sensors] " Guenter Roeck
2010-11-04 8:20 ` Henrik Rydberg
2010-10-31 7:50 ` [PATCH 3/8] hwmon: applesmc: Dynamic creation of temperature files Henrik Rydberg
2010-11-05 2:23 ` [lm-sensors] " Guenter Roeck
2010-10-31 7:50 ` [PATCH 4/8] hwmon: applesmc: Handle new temperature format Henrik Rydberg
2010-11-05 2:32 ` [lm-sensors] " Guenter Roeck
2010-11-05 2:35 ` Guenter Roeck
2010-11-05 8:34 ` Henrik Rydberg
2010-10-31 7:50 ` [PATCH 5/8] hwmon: applesmc: Extract all features generically Henrik Rydberg
2010-11-05 2:50 ` [lm-sensors] " Guenter Roeck
2010-11-05 8:52 ` Henrik Rydberg [this message]
2010-10-31 7:50 ` [PATCH 6/8] hwmon: applesmc: Dynamic creation of fan files Henrik Rydberg
2010-11-05 2:59 ` [lm-sensors] " Guenter Roeck
2010-11-05 8:56 ` Henrik Rydberg
2010-10-31 7:50 ` [PATCH 7/8] hwmon: applesmc: Simplify feature sysfs handling Henrik Rydberg
2010-11-05 3:07 ` [lm-sensors] " Guenter Roeck
2010-10-31 7:50 ` [PATCH 8/8] hwmon: applesmc: Update copyright information Henrik Rydberg
2010-11-05 3:09 ` [lm-sensors] " Guenter Roeck
2010-11-05 9:00 ` Henrik Rydberg
2010-11-05 11:45 ` Guenter Roeck
2010-10-31 8:31 ` [PATCH 0/8] hwmon: applesmc: Dynamic configuration rewrite Joe Perches
2010-10-31 8:44 ` Henrik Rydberg
2010-10-31 8:55 ` Joe Perches
2010-10-31 10:05 ` Jean Delvare
2010-11-03 13:48 ` [lm-sensors] " Guenter Roeck
2010-11-03 14:43 ` Henrik Rydberg
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=4CD3C5E7.1030301@euromail.se \
--to=rydberg@euromail.se \
--cc=guenter.roeck@ericsson.com \
--cc=khali@linux-fr.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lm-sensors@lm-sensors.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