LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Gerb Stralko" <gerb.stralko@gmail.com>
To: "Nicolas Boichat" <nicolas@boichat.ch>
Cc: linux-kernel@vger.kernel.org, lm-sensors@lm-sensors.org,
rlove@rlove.org, linux-kernel@hansmi.ch
Subject: Re: [RFC][PATCH] Apple SMC driver (hardware monitoring and control)
Date: Tue, 20 Mar 2007 12:12:00 -0400 [thread overview]
Message-ID: <75b57c110703200912t3fe623c6g8cd163bef8c3b7bb@mail.gmail.com> (raw)
In-Reply-To: <45F7C083.7090504@boichat.ch>
> +/* data port used by apple SMC */
> +#define APPLESMC_DATA_PORT 0x300
> +/* command/status port used by apple SMC */
> +#define APPLESMC_CMD_PORT 0x304
> +
> +#define APPLESMC_NR_PORTS 5 /* 0x300-0x304 */
> +
> +#define APPLESMC_STATUS_MASK 0x0f
> +#define APPLESMC_READ_CMD 0x10
> +#define APPLESMC_WRITE_CMD 0x11
> +
> +#define LIGHT_SENSOR_LEFT_KEY "ALV0" //r-o length 6
> +#define LIGHT_SENSOR_RIGHT_KEY "ALV1" //r-o length 6
> +#define BACKLIGHT_KEY "LKSB" //w-o
> +
> +#define CLAMSHELL_KEY "MSLD" //r-o length 1 (unused)
> +
> +#define MOTION_SENSOR_X_KEY "MO_X" //r-o length 2
> +#define MOTION_SENSOR_Y_KEY "MO_Y" //r-o length 2
> +#define MOTION_SENSOR_Z_KEY "MO_Z" //r-o length 2
> +#define MOTION_SENSOR_KEY "MOCN" //r/w length 2
> +
> +#define FANS_COUNT "FNum" //r-o length 1
> +#define FANS_MANUAL "FS! " //r-w length 2
> +#define FAN_ACTUAL_SPEED "F0Ac" //r-o length 2
> +#define FAN_MIN_SPEED "F0Mn" //r-o length 2
> +#define FAN_MAX_SPEED "F0Mx" //r-o length 2
> +#define FAN_SAFE_SPEED "F0Sf" //r-o length 2
> +#define FAN_TARGET_SPEED "F0Tg" //r-w length 2
> +
> +/* Temperature sensors keys. First set for Macbook(Pro), second for Macmini */
> +static const char* temperature_sensors_sets[][8] = {
> + { "TB0T", "TC0D", "TC0P", "Th0H", "Ts0P", "Th1H", "Ts1P", NULL },
> + { "TC0D", "TC0P", NULL }
> +};
> +
> +#define INIT_TIMEOUT_MSECS 5000 /* wait up to 5s for device init ... */
> +#define INIT_WAIT_MSECS 50 /* ... in 50ms increments */
> +
> +#define APPLESMC_POLL_PERIOD (HZ/20) /* poll for input every 1/20s */
> +#define APPLESMC_INPUT_FUZZ 4 /* input event threshold */
> +#define APPLESMC_INPUT_FLAT 4
> +
> +#define SENSOR_X 0
> +#define SENSOR_Y 1
> +#define SENSOR_Z 2
> +
> +/* Structure to be passed to DMI_MATCH function */
> +struct dmi_match_data {
> +/* Indicates whether this computer has an accelerometer. */
> + int accelerometer;
> +/* Indicates whether this computer has light sensors and keyboard backlight. */
> + int light;
> +/* Indicates which temperature sensors set to use. */
> + int temperature_set;
> +};
> +
> +static int debug = 0;
> +static struct platform_device *pdev;
> +static s16 rest_x;
> +static s16 rest_y;
> +static struct timer_list applesmc_timer;
> +static struct input_dev *applesmc_idev;
> +
> +/* Indicates whether this computer has an accelerometer. */
> +static unsigned int applesmc_accelerometer = 0;
> +
> +/* Indicates whether this computer has light sensors and keyboard backlight. */
> +static unsigned int applesmc_light = 0;
> +
> +/* Indicates which temperature sensors set to use. */
> +static unsigned int applesmc_temperature_set = 0;
> +
Is it possible to put some of this in a header file? I think it may
make the driver look alittle nicer and IMO easier to read. If this is
a problem or not just plain _stupid_ then just ignore me. I'm not
trying to be nit picky, i just think this is a *great* driver and I'm
excited to use it, but the cleaner it is the more manageable it will
be in the future.
-Jerry
next prev parent reply other threads:[~2007-03-20 16:12 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-14 9:29 Nicolas Boichat
2007-03-14 11:11 ` Cong WANG
2007-03-14 14:00 ` Cong WANG
2007-03-15 11:31 ` Nicolas Boichat
2007-03-19 5:19 ` [PATCH] " Nicolas Boichat
2007-03-19 6:54 ` Andrew Morton
2007-03-19 7:35 ` Nicolas Boichat
2007-03-20 7:12 ` Nicolas Boichat
2007-03-22 15:37 ` Dmitry Torokhov
2007-04-09 13:53 ` [PATCH] Apple SMC driver - fix input device Nicolas Boichat
2007-04-09 15:17 ` Dmitry Torokhov
2007-04-09 20:04 ` Andrew Morton
2007-04-09 20:11 ` Dmitry Torokhov
2007-04-09 21:51 ` Paul Mackerras
2007-03-19 21:43 ` [RFC][PATCH] Apple SMC driver (hardware monitoring and control) Bob Copeland
2007-03-20 7:02 ` Nicolas Boichat
2007-03-20 15:14 ` Bob Copeland
2007-03-21 4:03 ` Bob Copeland
[not found] ` <eb4a44160703200016i74786682n41f87f3d88f90409@mail.gmail.com>
2007-04-14 8:05 ` [PATCH] applesmc - fix crash when activating a led trigger on the keyboard backlight Nicolas Boichat
2007-04-14 8:45 ` Richard Purdie
2007-04-14 13:31 ` [PATCH] applesmc - fix crash when activating a led trigger on the keyboard backlight - use a workqueue Nicolas Boichat
2007-03-20 10:08 ` [lm-sensors] [RFC][PATCH] Apple SMC driver (hardware monitoring and control) Jean Delvare
2007-03-22 10:36 ` Nicolas Boichat
2007-03-20 16:12 ` Gerb Stralko [this message]
2007-04-11 12:25 ` Jean Delvare
2007-04-11 12:47 ` Nicolas Boichat
2007-04-13 5:33 ` [PATCH 1/2] Apple SMC driver - standardize and sanitize sysfs tree + minor features addition Nicolas Boichat
2007-04-13 6:38 ` [PATCH 2/2] Apple SMC driver - implement key enumeration Nicolas Boichat
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=75b57c110703200912t3fe623c6g8cd163bef8c3b7bb@mail.gmail.com \
--to=gerb.stralko@gmail.com \
--cc=linux-kernel@hansmi.ch \
--cc=linux-kernel@vger.kernel.org \
--cc=lm-sensors@lm-sensors.org \
--cc=nicolas@boichat.ch \
--cc=rlove@rlove.org \
--subject='Re: [RFC][PATCH] Apple SMC driver (hardware monitoring and control)' \
/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
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).