LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: dtor@insightbb.com, pavel@ucw.cz, lenb@kernel.org,
	linux-input@atrey.karlin.mff.cuni.cz,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Fujitsu application panel driver
Date: Wed, 24 Oct 2007 16:03:00 -0700	[thread overview]
Message-ID: <20071024160300.85e1cbda.akpm@linux-foundation.org> (raw)
In-Reply-To: <20071023125555.38d63567@shemminger-laptop>

On Tue, 23 Oct 2007 12:55:55 -0700
Stephen Hemminger <shemminger@linux-foundation.org> wrote:

> This driver supports the application buttons on some Fujitsu Lifebook
> laptops. It is based on the earlier apanel driver done by Jochen
> Eisenger, but with many changes.  The original driver used ioctl's and
> a separate user space program (see http://apanel.sourceforge.net). This
> driver hooks into the input subsystem so that the normal keys act as
> expected without a daemon. In addition to buttons, the Mail Led is
> handled via LEDs class device.
> 
> The driver now supports redefinable keymaps and no longer has to
> have a DMI table for all Fujitsu laptops.
> 
> I thought about mixing this driver should be integrated into the Fujitsu laptop
> extras driver that handles backlight, but rejected the idea because
> it wasn't clear if all the Fujitsu laptops supported both.
> 
> ...
>
> +
> +/* Magic constants in BIOS that tell about buttons */
> +enum apanel_devid {
> +	APANEL_DEV_NONE	  = 0,
> +	APANEL_DEV_APPBTN = 1,
> +	APANEL_DEV_CDBTN  = 2,
> +	APANEL_DEV_LCD	  = 3,
> +	APANEL_DEV_LED	  = 4,
> +	APANEL_DEV_MAX,
> +};

APANEL_DEV_MAX == 5.

> +enum apanel_chip {
> +	CHIP_NONE    = 0,
> +	CHIP_OZ992C  = 1,
> +	CHIP_OZ163T  = 2,
> +	CHIP_OZ711M3 = 4,
> +};
> +
> +/* Result of BIOS snooping/probing -- what features are supported */
> +static enum apanel_chip device_chip[APANEL_DEV_MAX];
> +
> +/* names for APANEL_XXX */
> +static const char *device_names[APANEL_DEV_MAX] __initdata = {

We just wasted sizeof(char *)?

> +	[APANEL_DEV_APPBTN] = "Application Buttons",
> +	[APANEL_DEV_LCD]    = "LCD",
> +	[APANEL_DEV_LED]    = "LED",
> +	[APANEL_DEV_CDBTN]  = "CD Buttons",
> +};
> +
> +
> +/* Poll for key changes
> + *
> + * Read Application keys via SMI
> + *  A (0x4), B (0x8), Internet (0x2), Email (0x1).
> + *
> + * CD keys:
> + * Forward (0x100), Rewind (0x200), Stop (0x400), Pause (0x800)
> + */
> +static void apanel_poll(struct input_polled_dev *ipdev)
> +{
> +	struct apanel *ap = ipdev->private;
> +	struct input_dev *idev = ipdev->input;
> +	u8 cmd = device_chip[APANEL_DEV_APPBTN] == CHIP_OZ992C ? 0 : 8;
> +	s32 data;
> +	int i;
> +
> +	data = i2c_smbus_read_word_data(&ap->client, cmd);
> +	if (data < 0)
> +		return;	/* ignore errors (due to ACPI??) */
> +
> +	/* write back to clear latch */
> +	i2c_smbus_write_word_data(&ap->client, cmd, 0);
> +
> +	if (!data)
> +		return;
> +
> +	dev_dbg(&ipdev->input->dev, APANEL ": data %#x\n", data);
> +	for (i = 0; i < ipdev->input->keycodemax; i++)
> +		if (1ul << i & data)

You made me google for the c precedence table.

> +			report_key(idev, ap->keymap[i]);
> +}
>
> ...
>


  reply	other threads:[~2007-10-24 23:03 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-02 18:17 [PATCH] fujtisu " Stephen Hemminger
2007-07-02 19:16 ` Dmitry Torokhov
2007-09-03  8:58   ` Stephen Hemminger
2007-09-07 12:02     ` Pavel Machek
2007-09-12 11:38       ` [PATCH] Fujitsu application panel driver (rev3) Stephen Hemminger
2007-09-14  5:30         ` Dmitry Torokhov
2007-09-16 19:55           ` Stephen Hemminger
2007-09-16 20:22             ` Dmitry Torokhov
2007-10-23 19:55               ` [PATCH] Fujitsu application panel driver Stephen Hemminger
2007-10-24 23:03                 ` Andrew Morton [this message]
2007-10-25 20:19                   ` [PATCH] apanel: space savings Stephen Hemminger
2007-10-28  5:30                 ` [PATCH] Fujitsu application panel driver Dmitry Torokhov
2007-11-18 22:36                 ` Robert Gerlach
2007-11-19  4:43                   ` Stephen Hemminger
2007-11-19 12:50                     ` Robert Gerlach
2007-11-19 17:26                       ` Stephen Hemminger
2007-11-19 20:37                         ` Robert Gerlach
2007-11-19 23:19                       ` Stephen Hemminger
2007-12-19  9:04                         ` Robert Gerlach
2007-12-12 14:10                 ` Dmitry Torokhov
2007-12-12 22:21                   ` [PATCH] Fujitsu application panel led value Stephen Hemminger
2007-07-05  1:29 ` [PATCH] fujtisu application panel driver Jason Uhlenkott
2007-09-03  9:00   ` Stephen Hemminger

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=20071024160300.85e1cbda.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=dtor@insightbb.com \
    --cc=lenb@kernel.org \
    --cc=linux-input@atrey.karlin.mff.cuni.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=shemminger@linux-foundation.org \
    --subject='Re: [PATCH] Fujitsu application panel driver' \
    /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).