Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 227127
b: refs/heads/master
c: 67b989a
h: refs/heads/master
i:
  227125: 3f5ba44
  227123: 184ad32
  227119: c7b61de
v: v3
  • Loading branch information
Dmitry Torokhov committed Dec 16, 2010
1 parent 701f49b commit 20785f9
Show file tree
Hide file tree
Showing 51 changed files with 2,829 additions and 591 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 69479f8da68f1930b2078b2ebf6533fb00339918
refs/heads/master: 67b989a0c17e34a7c2c095e58a2f3d1b4408e3cb
115 changes: 115 additions & 0 deletions trunk/Documentation/input/cma3000_d0x.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
Kernel driver for CMA3000-D0x
============================

Supported chips:
* VTI CMA3000-D0x
Datasheet:
CMA3000-D0X Product Family Specification 8281000A.02.pdf
<http://www.vti.fi/en/>

Author: Hemanth V <hemanthv@ti.com>


Description
-----------
CMA3000 Tri-axis accelerometer supports Motion detect, Measurement and
Free fall modes.

Motion Detect Mode: Its the low power mode where interrupts are generated only
when motion exceeds the defined thresholds.

Measurement Mode: This mode is used to read the acceleration data on X,Y,Z
axis and supports 400, 100, 40 Hz sample frequency.

Free fall Mode: This mode is intended to save system resources.

Threshold values: Chip supports defining threshold values for above modes
which includes time and g value. Refer product specifications for more details.

CMA3000 chip supports mutually exclusive I2C and SPI interfaces for
communication, currently the driver supports I2C based communication only.
Initial configuration for bus mode is set in non volatile memory and can later
be modified through bus interface command.

Driver reports acceleration data through input subsystem. It generates ABS_MISC
event with value 1 when free fall is detected.

Platform data need to be configured for initial default values.

Platform Data
-------------
fuzz_x: Noise on X Axis

fuzz_y: Noise on Y Axis

fuzz_z: Noise on Z Axis

g_range: G range in milli g i.e 2000 or 8000

mode: Default Operating mode

mdthr: Motion detect g range threshold value

mdfftmr: Motion detect and free fall time threshold value

ffthr: Free fall g range threshold value

Input Interface
--------------
Input driver version is 1.0.0
Input device ID: bus 0x18 vendor 0x0 product 0x0 version 0x0
Input device name: "cma3000-accelerometer"
Supported events:
Event type 0 (Sync)
Event type 3 (Absolute)
Event code 0 (X)
Value 47
Min -8000
Max 8000
Fuzz 200
Event code 1 (Y)
Value -28
Min -8000
Max 8000
Fuzz 200
Event code 2 (Z)
Value 905
Min -8000
Max 8000
Fuzz 200
Event code 40 (Misc)
Value 0
Min 0
Max 1
Event type 4 (Misc)


Register/Platform parameters Description
----------------------------------------

mode:
0: power down mode
1: 100 Hz Measurement mode
2: 400 Hz Measurement mode
3: 40 Hz Measurement mode
4: Motion Detect mode (default)
5: 100 Hz Free fall mode
6: 40 Hz Free fall mode
7: Power off mode

grange:
2000: 2000 mg or 2G Range
8000: 8000 mg or 8G Range

mdthr:
X: X * 71mg (8G Range)
X: X * 18mg (2G Range)

mdfftmr:
X: (X & 0x70) * 100 ms (MDTMR)
(X & 0x0F) * 2.5 ms (FFTMR 400 Hz)
(X & 0x0F) * 10 ms (FFTMR 100 Hz)

ffthr:
X: (X >> 2) * 18mg (2G Range)
X: (X & 0x0F) * 71 mg (8G Range)
141 changes: 141 additions & 0 deletions trunk/arch/arm/plat-spear/include/plat/keyboard.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
/*
* Copyright (C) 2010 ST Microelectronics
* Rajeev Kumar<rajeev-dlh.kumar@st.com>
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/

#ifndef __PLAT_KEYBOARD_H
#define __PLAT_KEYBOARD_H

#include <linux/bitops.h>
#include <linux/input.h>
#include <linux/input/matrix_keypad.h>
#include <linux/types.h>

#define DECLARE_KEYMAP(_name) \
int _name[] = { \
KEY(0, 0, KEY_ESC), \
KEY(0, 1, KEY_1), \
KEY(0, 2, KEY_2), \
KEY(0, 3, KEY_3), \
KEY(0, 4, KEY_4), \
KEY(0, 5, KEY_5), \
KEY(0, 6, KEY_6), \
KEY(0, 7, KEY_7), \
KEY(0, 8, KEY_8), \
KEY(1, 0, KEY_9), \
KEY(1, 1, KEY_MINUS), \
KEY(1, 2, KEY_EQUAL), \
KEY(1, 3, KEY_BACKSPACE), \
KEY(1, 4, KEY_TAB), \
KEY(1, 5, KEY_Q), \
KEY(1, 6, KEY_W), \
KEY(1, 7, KEY_E), \
KEY(1, 8, KEY_R), \
KEY(2, 0, KEY_T), \
KEY(2, 1, KEY_Y), \
KEY(2, 2, KEY_U), \
KEY(2, 3, KEY_I), \
KEY(2, 4, KEY_O), \
KEY(2, 5, KEY_P), \
KEY(2, 6, KEY_LEFTBRACE), \
KEY(2, 7, KEY_RIGHTBRACE), \
KEY(2, 8, KEY_ENTER), \
KEY(3, 0, KEY_LEFTCTRL), \
KEY(3, 1, KEY_A), \
KEY(3, 2, KEY_S), \
KEY(3, 3, KEY_D), \
KEY(3, 4, KEY_F), \
KEY(3, 5, KEY_G), \
KEY(3, 6, KEY_H), \
KEY(3, 7, KEY_J), \
KEY(3, 8, KEY_K), \
KEY(4, 0, KEY_L), \
KEY(4, 1, KEY_SEMICOLON), \
KEY(4, 2, KEY_APOSTROPHE), \
KEY(4, 3, KEY_GRAVE), \
KEY(4, 4, KEY_LEFTSHIFT), \
KEY(4, 5, KEY_BACKSLASH), \
KEY(4, 6, KEY_Z), \
KEY(4, 7, KEY_X), \
KEY(4, 8, KEY_C), \
KEY(4, 0, KEY_L), \
KEY(4, 1, KEY_SEMICOLON), \
KEY(4, 2, KEY_APOSTROPHE), \
KEY(4, 3, KEY_GRAVE), \
KEY(4, 4, KEY_LEFTSHIFT), \
KEY(4, 5, KEY_BACKSLASH), \
KEY(4, 6, KEY_Z), \
KEY(4, 7, KEY_X), \
KEY(4, 8, KEY_C), \
KEY(4, 0, KEY_L), \
KEY(4, 1, KEY_SEMICOLON), \
KEY(4, 2, KEY_APOSTROPHE), \
KEY(4, 3, KEY_GRAVE), \
KEY(4, 4, KEY_LEFTSHIFT), \
KEY(4, 5, KEY_BACKSLASH), \
KEY(4, 6, KEY_Z), \
KEY(4, 7, KEY_X), \
KEY(4, 8, KEY_C), \
KEY(5, 0, KEY_V), \
KEY(5, 1, KEY_B), \
KEY(5, 2, KEY_N), \
KEY(5, 3, KEY_M), \
KEY(5, 4, KEY_COMMA), \
KEY(5, 5, KEY_DOT), \
KEY(5, 6, KEY_SLASH), \
KEY(5, 7, KEY_RIGHTSHIFT), \
KEY(5, 8, KEY_KPASTERISK), \
KEY(6, 0, KEY_LEFTALT), \
KEY(6, 1, KEY_SPACE), \
KEY(6, 2, KEY_CAPSLOCK), \
KEY(6, 3, KEY_F1), \
KEY(6, 4, KEY_F2), \
KEY(6, 5, KEY_F3), \
KEY(6, 6, KEY_F4), \
KEY(6, 7, KEY_F5), \
KEY(6, 8, KEY_F6), \
KEY(7, 0, KEY_F7), \
KEY(7, 1, KEY_F8), \
KEY(7, 2, KEY_F9), \
KEY(7, 3, KEY_F10), \
KEY(7, 4, KEY_NUMLOCK), \
KEY(7, 5, KEY_SCROLLLOCK), \
KEY(7, 6, KEY_KP7), \
KEY(7, 7, KEY_KP8), \
KEY(7, 8, KEY_KP9), \
KEY(8, 0, KEY_KPMINUS), \
KEY(8, 1, KEY_KP4), \
KEY(8, 2, KEY_KP5), \
KEY(8, 3, KEY_KP6), \
KEY(8, 4, KEY_KPPLUS), \
KEY(8, 5, KEY_KP1), \
KEY(8, 6, KEY_KP2), \
KEY(8, 7, KEY_KP3), \
KEY(8, 8, KEY_KP0), \
}

/**
* struct kbd_platform_data - spear keyboard platform data
* keymap: pointer to keymap data (table and size)
* rep: enables key autorepeat
*
* This structure is supposed to be used by platform code to supply
* keymaps to drivers that implement keyboards.
*/
struct kbd_platform_data {
const struct matrix_keymap_data *keymap;
bool rep;
};

/* This function is used to set platform data field of pdev->dev */
static inline void
kbd_set_plat_data(struct platform_device *pdev, struct kbd_platform_data *data)
{
pdev->dev.platform_data = data;
}

#endif /* __PLAT_KEYBOARD_H */
2 changes: 1 addition & 1 deletion trunk/drivers/input/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Each configuration option enables a list of files.

obj-$(CONFIG_INPUT) += input-core.o
input-core-objs := input.o input-compat.o ff-core.o input-mt.o
input-core-y := input.o input-compat.o input-mt.o ff-core.o

obj-$(CONFIG_INPUT_FF_MEMLESS) += ff-memless.o
obj-$(CONFIG_INPUT_POLLDEV) += input-polldev.o
Expand Down
14 changes: 6 additions & 8 deletions trunk/drivers/input/apm-power.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/input.h>
#include <linux/slab.h>
Expand All @@ -23,8 +25,7 @@ static void system_power_event(unsigned int keycode)
switch (keycode) {
case KEY_SUSPEND:
apm_queue_event(APM_USER_SUSPEND);

printk(KERN_INFO "apm-power: Requesting system suspend...\n");
pr_info("Requesting system suspend...\n");
break;
default:
break;
Expand Down Expand Up @@ -65,18 +66,15 @@ static int apmpower_connect(struct input_handler *handler,

error = input_register_handle(handle);
if (error) {
printk(KERN_ERR
"apm-power: Failed to register input power handler, "
"error %d\n", error);
pr_err("Failed to register input power handler, error %d\n",
error);
kfree(handle);
return error;
}

error = input_open_device(handle);
if (error) {
printk(KERN_ERR
"apm-power: Failed to open input power device, "
"error %d\n", error);
pr_err("Failed to open input power device, error %d\n", error);
input_unregister_handle(handle);
kfree(handle);
return error;
Expand Down
18 changes: 10 additions & 8 deletions trunk/drivers/input/evbug.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/slab.h>
#include <linux/module.h>
#include <linux/input.h>
Expand All @@ -38,8 +40,8 @@ MODULE_LICENSE("GPL");

static void evbug_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
{
printk(KERN_DEBUG "evbug.c: Event. Dev: %s, Type: %d, Code: %d, Value: %d\n",
dev_name(&handle->dev->dev), type, code, value);
printk(KERN_DEBUG pr_fmt("Event. Dev: %s, Type: %d, Code: %d, Value: %d\n"),
dev_name(&handle->dev->dev), type, code, value);
}

static int evbug_connect(struct input_handler *handler, struct input_dev *dev,
Expand All @@ -64,10 +66,10 @@ static int evbug_connect(struct input_handler *handler, struct input_dev *dev,
if (error)
goto err_unregister_handle;

printk(KERN_DEBUG "evbug.c: Connected device: %s (%s at %s)\n",
dev_name(&dev->dev),
dev->name ?: "unknown",
dev->phys ?: "unknown");
printk(KERN_DEBUG pr_fmt("Connected device: %s (%s at %s)\n"),
dev_name(&dev->dev),
dev->name ?: "unknown",
dev->phys ?: "unknown");

return 0;

Expand All @@ -80,8 +82,8 @@ static int evbug_connect(struct input_handler *handler, struct input_dev *dev,

static void evbug_disconnect(struct input_handle *handle)
{
printk(KERN_DEBUG "evbug.c: Disconnected device: %s\n",
dev_name(&handle->dev->dev));
printk(KERN_DEBUG pr_fmt("Disconnected device: %s\n"),
dev_name(&handle->dev->dev));

input_close_device(handle);
input_unregister_handle(handle);
Expand Down
15 changes: 8 additions & 7 deletions trunk/drivers/input/evdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* the Free Software Foundation.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#define EVDEV_MINOR_BASE 64
#define EVDEV_MINORS 32
#define EVDEV_MIN_BUFFER_SIZE 64U
Expand Down Expand Up @@ -522,12 +524,11 @@ static int handle_eviocgbit(struct input_dev *dev,
if (type == EV_KEY && size == OLD_KEY_MAX) {
len = OLD_KEY_MAX;
if (printk_timed_ratelimit(&keymax_warn_time, 10 * 1000))
printk(KERN_WARNING
"evdev.c(EVIOCGBIT): Suspicious buffer size %u, "
"limiting output to %zu bytes. See "
"http://userweb.kernel.org/~dtor/eviocgbit-bug.html\n",
OLD_KEY_MAX,
BITS_TO_LONGS(OLD_KEY_MAX) * sizeof(long));
pr_warning("(EVIOCGBIT): Suspicious buffer size %u, "
"limiting output to %zu bytes. See "
"http://userweb.kernel.org/~dtor/eviocgbit-bug.html\n",
OLD_KEY_MAX,
BITS_TO_LONGS(OLD_KEY_MAX) * sizeof(long));
}

return bits_to_user(bits, len, size, p, compat_mode);
Expand Down Expand Up @@ -894,7 +895,7 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev,
break;

if (minor == EVDEV_MINORS) {
printk(KERN_ERR "evdev: no more free evdev devices\n");
pr_err("no more free evdev devices\n");
return -ENFILE;
}

Expand Down
Loading

0 comments on commit 20785f9

Please sign in to comment.