diff mbox

[1/2] add ad714x platform_data definition

Message ID 1251777330-16994-2-git-send-email-21cnbao@gmail.com
State New, archived
Headers show

Commit Message

Barry Song Sept. 1, 2009, 3:55 a.m. UTC
AD714x is very flexible, it can be used as buttons, scrollwheel,
slider, touchpad at the same time. That depends on the boards.
The platform_data for the device's "struct device" holds these
information.
The data-struct defined in this file descript the hardware feature
of button/scrollwheel/slider/touchpad components on target boards,
which need be filled in the arch/mach-/.

Signed-off-by: Barry Song <21cnbao@gmail.com>
---
 include/linux/spi/ad714x.h |   60 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)
 create mode 100644 include/linux/spi/ad714x.h

Comments

Mike Frysinger Sept. 1, 2009, 6:41 p.m. UTC | #1
On Mon, Aug 31, 2009 at 23:55, Barry Song<21cnbao@gmail.com> wrote:
> --- /dev/null
> +++ b/include/linux/spi/ad714x.h
> @@ -0,0 +1,60 @@
> +/*
> + * include/linux/ad714x.h
> + *
> + * AD714x is very flexible, it can be used as buttons, scrollwheel,
> + * slider, touchpad at the same time. That depends on the boards.
> + * The platform_data for the device's "struct device" holds this
> + * information.
> + */

missing lines:
 * Copyright 2009 Analog Devices Inc.
 *
 * Licensed under the GPL-2 or later.

> +#ifndef AD714X_HW_H
> +#define AD714X_HW_H

header files should not be using an unprefixed name space (even if
it's an uncommon define name), and the name really should match the
header.  i.e. __LINUX_SPI_AD714X_H__
-mike
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Brownell Sept. 2, 2009, 1:57 a.m. UTC | #2
On Monday 31 August 2009, Barry Song wrote:
> --- /dev/null
> +++ b/include/linux/spi/ad714x.h

Doesn't belong under SPI since this is also used by the
I2C version of the chip.  Likely include/linux/input/*h
is best.


> @@ -0,0 +1,60 @@
> +/*
> + * include/linux/ad714x.h

Never include the directories.  And the coding style says
this should have a twitter-sized description of the driver
in that line, like

   * ad714x.h -- platform data for capacitance sensor driver

It's good policy to include a brief GPL statement at the top
of every source file too, including a Copyright (C) you.


> + *
> + * AD714x is very flexible, it can be used as buttons, scrollwheel,
> + * slider, touchpad at the same time. That depends on the boards.
> + * The platform_data for the device's "struct device" holds this
> + * information.
> + */
> +
> +
> +#ifndef AD714X_HW_H
> +#define AD714X_HW_H

As noted:  __LINUX_INPUT_AD714X_H is the style to use here.

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Song, Barry Sept. 2, 2009, 2:09 a.m. UTC | #3
>-----Original Message-----
>From: uclinux-dist-devel-bounces@blackfin.uclinux.org 
>[mailto:uclinux-dist-devel-bounces@blackfin.uclinux.org] On 
>Behalf Of Mike Frysinger
>Sent: Wednesday, September 02, 2009 2:41 AM
>To: Barry Song
>Cc: dbrownell@users.sourceforge.net; dtor@mail.ru; 
>dmitry.torokhov@gmail.com; 
>spi-devel-general@lists.sourceforge.net; 
>linux-input@vger.kernel.org; uclinux-dist-devel@blackfin.uclinux.org
>Subject: Re: [Uclinux-dist-devel] [PATCH 1/2] add ad714x 
>platform_datadefinition
>
>On Mon, Aug 31, 2009 at 23:55, Barry Song<21cnbao@gmail.com> wrote:
>> --- /dev/null
>> +++ b/include/linux/spi/ad714x.h
>> @@ -0,0 +1,60 @@
>> +/*
>> + * include/linux/ad714x.h
>> + *
>> + * AD714x is very flexible, it can be used as buttons, scrollwheel,
>> + * slider, touchpad at the same time. That depends on the boards.
>> + * The platform_data for the device's "struct device" holds this
>> + * information.
>> + */
>
>missing lines:
> * Copyright 2009 Analog Devices Inc.
> *
> * Licensed under the GPL-2 or later.
>
>> +#ifndef AD714X_HW_H
>> +#define AD714X_HW_H
>
>header files should not be using an unprefixed name space (even if
>it's an uncommon define name), and the name really should match the
>header.  i.e. __LINUX_SPI_AD714X_H__
Fixed.
>-mike
>_______________________________________________
>Uclinux-dist-devel mailing list
>Uclinux-dist-devel@blackfin.uclinux.org
>https://blackfin.uclinux.org/mailman/listinfo/uclinux-dist-devel
>
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Song, Barry Sept. 2, 2009, 4:47 a.m. UTC | #4
>-----Original Message-----
>From: uclinux-dist-devel-bounces@blackfin.uclinux.org 
>[mailto:uclinux-dist-devel-bounces@blackfin.uclinux.org] On 
>Behalf Of David Brownell
>Sent: Wednesday, September 02, 2009 9:58 AM
>To: Barry Song
>Cc: dbrownell@users.sourceforge.net; dtor@mail.ru; 
>dmitry.torokhov@gmail.com; 
>spi-devel-general@lists.sourceforge.net; 
>linux-input@vger.kernel.org; uclinux-dist-devel@blackfin.uclinux.org
>Subject: Re: [Uclinux-dist-devel] [PATCH 1/2] add ad714x 
>platform_datadefinition
>
>On Monday 31 August 2009, Barry Song wrote:
>> --- /dev/null
>> +++ b/include/linux/spi/ad714x.h
>
>Doesn't belong under SPI since this is also used by the
>I2C version of the chip.  Likely include/linux/input/*h
>is best.

I really wanted to place it to include/linux/input, but the
include/linux/input doesn't exist and current input header files are
placed in the parent dir "include/linux".

>
>
>> @@ -0,0 +1,60 @@
>> +/*
>> + * include/linux/ad714x.h
>
>Never include the directories.  And the coding style says
>this should have a twitter-sized description of the driver
>in that line, like
>
>   * ad714x.h -- platform data for capacitance sensor driver
>
>It's good policy to include a brief GPL statement at the top
>of every source file too, including a Copyright (C) you.
>
>
>> + *
>> + * AD714x is very flexible, it can be used as buttons, scrollwheel,
>> + * slider, touchpad at the same time. That depends on the boards.
>> + * The platform_data for the device's "struct device" holds this
>> + * information.
>> + */
>> +
>> +
>> +#ifndef AD714X_HW_H
>> +#define AD714X_HW_H
>
>As noted:  __LINUX_INPUT_AD714X_H is the style to use here.
>
>_______________________________________________
>Uclinux-dist-devel mailing list
>Uclinux-dist-devel@blackfin.uclinux.org
>https://blackfin.uclinux.org/mailman/listinfo/uclinux-dist-devel
>
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Brownell Sept. 2, 2009, 5:14 a.m. UTC | #5
On Tuesday 01 September 2009, Song, Barry wrote:
> >Doesn't belong under SPI since this is also used by the
> >I2C version of the chip.  Likely include/linux/input/*h
> >is best.
> 
> I really wanted to place it to include/linux/input, but the
> include/linux/input doesn't exist and current input header files are
> placed in the parent dir "include/linux".
> 

$ ls include/linux/input
matrix_keypad.h
$ 
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Song, Barry Sept. 2, 2009, 5:24 a.m. UTC | #6
>-----Original Message-----
>From: David Brownell [mailto:david-b@pacbell.net] 
>Sent: Wednesday, September 02, 2009 1:14 PM
>To: Song, Barry
>Cc: Barry Song; dbrownell@users.sourceforge.net; dtor@mail.ru; 
>dmitry.torokhov@gmail.com; 
>spi-devel-general@lists.sourceforge.net; 
>linux-input@vger.kernel.org; uclinux-dist-devel@blackfin.uclinux.org
>Subject: Re: [Uclinux-dist-devel] [PATCH 1/2] add ad714x 
>platform_datadefinition
>
>On Tuesday 01 September 2009, Song, Barry wrote:
>> >Doesn't belong under SPI since this is also used by the
>> >I2C version of the chip.  Likely include/linux/input/*h
>> >is best.
>> 
>> I really wanted to place it to include/linux/input, but the
>> include/linux/input doesn't exist and current input header files are
>> placed in the parent dir "include/linux".
>> 
>
>$ ls include/linux/input
>matrix_keypad.h
Thanks. A sync issue. A recent commit adds this file.

author	Eric Miao <eric.y.miao@gmail.com>
	Mon, 29 Jun 2009 07:20:52 +0000 (00:20 -0700)
committer	Dmitry Torokhov <dmitry.torokhov@gmail.com>
	Mon, 29 Jun 2009 07:30:16 +0000 (00:30 -0700)
commit	bab7614d6d1b1fc96ec6c5a7ca34c8641060e659
tree	f7b493a73b03d39e982a325117a14a04b712d1c0	
parent	cb589529f74d69abc111887b45308f333f950ade

>$ 
>
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Bill Gatliff Sept. 2, 2009, 12:16 p.m. UTC | #7
David Brownell wrote:
> It's good policy to include a brief GPL statement at the top
> of every source file too, including a Copyright (C) you.
>   

I think "good policy" is probably understating things a bit.  :)



b.g.
diff mbox

Patch

diff --git a/include/linux/spi/ad714x.h b/include/linux/spi/ad714x.h
new file mode 100644
index 0000000..f6439a9
--- /dev/null
+++ b/include/linux/spi/ad714x.h
@@ -0,0 +1,60 @@ 
+/*
+ * include/linux/ad714x.h
+ *
+ * AD714x is very flexible, it can be used as buttons, scrollwheel,
+ * slider, touchpad at the same time. That depends on the boards.
+ * The platform_data for the device's "struct device" holds this
+ * information.
+ */
+
+
+#ifndef AD714X_HW_H
+#define AD714X_HW_H
+
+#define STAGE_NUM              12
+#define STAGE_CFGREG_NUM       8
+#define SYS_CFGREG_NUM         8
+
+/* board information which need be initialized in arch/mach... */
+struct ad714x_slider_plat {
+	int start_stage;
+	int end_stage;
+	int max_coord;
+};
+
+struct ad714x_wheel_plat {
+	int start_stage;
+	int end_stage;
+	int max_coord;
+};
+
+struct ad714x_touchpad_plat {
+	int x_start_stage;
+	int x_end_stage;
+	int x_max_coord;
+
+	int y_start_stage;
+	int y_end_stage;
+	int y_max_coord;
+};
+
+struct ad714x_button_plat {
+	int keycode;
+	unsigned short l_mask;
+	unsigned short h_mask;
+};
+
+struct ad714x_platform_data {
+	int slider_num;
+	int wheel_num;
+	int touchpad_num;
+	int button_num;
+	struct ad714x_slider_plat *slider;
+	struct ad714x_wheel_plat *wheel;
+	struct ad714x_touchpad_plat *touchpad;
+	struct ad714x_button_plat *button;
+	unsigned short stage_cfg_reg[STAGE_NUM][STAGE_CFGREG_NUM];
+	unsigned short sys_cfg_reg[SYS_CFGREG_NUM];
+};
+
+#endif