aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorChristopher Kenna <cjk@cs.unc.edu>2012-09-28 13:46:28 -0400
committerChristopher Kenna <cjk@cs.unc.edu>2012-09-28 14:50:15 -0400
commitdaa22703f14c007e93b464c45fa60019a36f546d (patch)
treea1a130b6e128dc9d57c35c026977e1b4953105e1 /include/linux
parent5aa287dcf1b5879aa0150b0511833c52885f5b4c (diff)
Apply k4412 kernel from HardKernel for ODROID-X.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/akm8975.h87
-rw-r--r--include/linux/amba/mmci.h12
-rw-r--r--include/linux/android_aid.h28
-rw-r--r--include/linux/android_alarm.h106
-rw-r--r--include/linux/ashmem.h48
-rw-r--r--include/linux/backing-dev.h24
-rw-r--r--include/linux/bitmap.h24
-rw-r--r--include/linux/blkdev.h3
-rw-r--r--include/linux/cgroup.h14
-rw-r--r--include/linux/cgroup_subsys.h6
-rw-r--r--include/linux/clocksource.h1
-rw-r--r--include/linux/cma.h493
-rw-r--r--include/linux/cpu.h7
-rw-r--r--include/linux/cpuacct.h43
-rw-r--r--include/linux/cpufreq.h6
-rw-r--r--include/linux/crc32.h2
-rw-r--r--include/linux/cryptohash.h2
-rw-r--r--include/linux/earlysuspend.h56
-rw-r--r--include/linux/elevator.h2
-rw-r--r--include/linux/exynos_mem.h24
-rw-r--r--include/linux/genalloc.h50
-rw-r--r--include/linux/gpio_event.h170
-rw-r--r--include/linux/hardirq.h8
-rw-r--r--include/linux/hid.h4
-rw-r--r--include/linux/if_pppolac.h33
-rw-r--r--include/linux/if_pppopns.h32
-rw-r--r--include/linux/if_pppox.h27
-rw-r--r--include/linux/input/isa1200.h30
-rw-r--r--include/linux/input/odroidq-touch.h247
-rw-r--r--include/linux/input/touch-pdata.h186
-rw-r--r--include/linux/iocontext.h18
-rw-r--r--include/linux/ion.h418
-rw-r--r--include/linux/jrcu.h80
-rw-r--r--include/linux/kernel.h14
-rw-r--r--include/linux/keychord.h52
-rw-r--r--include/linux/keyreset.h28
-rw-r--r--include/linux/linux_logo.h1
-rw-r--r--include/linux/memcopy.h226
-rw-r--r--include/linux/mfd/max77686-private.h237
-rw-r--r--include/linux/mfd/max77686.h117
-rw-r--r--include/linux/mfd/max8698-private.h117
-rw-r--r--include/linux/mfd/max8698.h78
-rw-r--r--include/linux/mfd/max8997-private.h1
-rw-r--r--include/linux/mfd/s5m87xx/s5m-core.h377
-rw-r--r--include/linux/mfd/s5m87xx/s5m-pmic.h115
-rw-r--r--include/linux/mfd/s5m87xx/s5m-rtc.h95
-rw-r--r--include/linux/mm.h6
-rw-r--r--include/linux/mmc/card.h32
-rw-r--r--include/linux/mmc/core.h21
-rw-r--r--include/linux/mmc/dw_mmc.h60
-rw-r--r--include/linux/mmc/host.h136
-rw-r--r--include/linux/mmc/mmc.h125
-rw-r--r--include/linux/mmc/pm.h4
-rw-r--r--include/linux/mmc/sdhci.h1
-rw-r--r--include/linux/mmc/sdio.h31
-rw-r--r--include/linux/mmc/sdio_func.h10
-rw-r--r--include/linux/mmzone.h1
-rw-r--r--include/linux/mpu.h366
-rw-r--r--include/linux/mpu3050.h255
-rw-r--r--include/linux/mpu6000.h406
-rw-r--r--include/linux/mpu_v3.h503
-rw-r--r--include/linux/msdos_fs.h12
-rw-r--r--include/linux/netfilter/xt_qtaguid.h13
-rw-r--r--include/linux/netfilter/xt_quota2.h25
-rw-r--r--include/linux/netfilter/xt_socket.h6
-rw-r--r--include/linux/page-flags.h10
-rw-r--r--include/linux/pda_power.h2
-rw-r--r--include/linux/platform_data/exynos_usb3_drd.h22
-rw-r--r--include/linux/platform_data/ram_console.h22
-rw-r--r--include/linux/plist.h55
-rw-r--r--include/linux/power/cpupower.h22
-rw-r--r--include/linux/power/max17047_battery.h16
-rw-r--r--include/linux/power/max8677_charger.h39
-rw-r--r--include/linux/power_supply.h4
-rw-r--r--include/linux/preempt.h31
-rw-r--r--include/linux/rbtree.h11
-rw-r--r--include/linux/rcu_types.h18
-rw-r--r--include/linux/rcupdate.h13
-rw-r--r--include/linux/rtmutex.h4
-rw-r--r--include/linux/sched.h14
-rw-r--r--include/linux/serial_core.h1
-rw-r--r--include/linux/slab.h10
-rw-r--r--include/linux/slqb_def.h300
-rw-r--r--include/linux/sockios.h1
-rw-r--r--include/linux/splice.h2
-rw-r--r--include/linux/switch.h53
-rw-r--r--include/linux/synaptics_i2c_rmi.h55
-rw-r--r--include/linux/uid_stat.h29
-rw-r--r--include/linux/usb.h3
-rw-r--r--include/linux/usb/android_composite.h106
-rw-r--r--include/linux/usb/ch11.h38
-rw-r--r--include/linux/usb/ch9.h1
-rw-r--r--include/linux/usb/composite.h54
-rw-r--r--include/linux/usb/ehci_def.h6
-rw-r--r--include/linux/usb/exynos_usb3_drd.h396
-rw-r--r--include/linux/usb/f_accessory.h83
-rw-r--r--include/linux/usb/f_mtp.h75
-rw-r--r--include/linux/usb/gadget.h30
-rw-r--r--include/linux/usb/hsic_usb3503.h62
-rw-r--r--include/linux/usb/otg_id.h58
-rw-r--r--include/linux/usb/usbnet.h1
-rw-r--r--include/linux/v4l2-mediabus.h2
-rw-r--r--include/linux/videodev2.h313
-rw-r--r--include/linux/videodev2_exynos_camera.h1368
-rw-r--r--include/linux/videodev2_samsung.h1176
-rw-r--r--include/linux/wakelock.h91
-rw-r--r--include/linux/wifi_tiwlan.h27
-rw-r--r--include/linux/wl127x-rfkill.h35
-rw-r--r--include/linux/wlan_plat.h27
-rw-r--r--include/linux/writeback.h74
110 files changed, 10369 insertions, 153 deletions
diff --git a/include/linux/akm8975.h b/include/linux/akm8975.h
new file mode 100644
index 00000000000..6a7c4326001
--- /dev/null
+++ b/include/linux/akm8975.h
@@ -0,0 +1,87 @@
1/*
2 * Definitions for akm8975 compass chip.
3 */
4#ifndef AKM8975_H
5#define AKM8975_H
6
7#include <linux/ioctl.h>
8
9/*! \name AK8975 operation mode
10 \anchor AK8975_Mode
11 Defines an operation mode of the AK8975.*/
12/*! @{*/
13#define AK8975_MODE_SNG_MEASURE 0x01
14#define AK8975_MODE_SELF_TEST 0x08
15#define AK8975_MODE_FUSE_ACCESS 0x0F
16#define AK8975_MODE_POWER_DOWN 0x00
17/*! @}*/
18
19#define RBUFF_SIZE 8 /* Rx buffer size */
20
21/*! \name AK8975 register address
22\anchor AK8975_REG
23Defines a register address of the AK8975.*/
24/*! @{*/
25#define AK8975_REG_WIA 0x00
26#define AK8975_REG_INFO 0x01
27#define AK8975_REG_ST1 0x02
28#define AK8975_REG_HXL 0x03
29#define AK8975_REG_HXH 0x04
30#define AK8975_REG_HYL 0x05
31#define AK8975_REG_HYH 0x06
32#define AK8975_REG_HZL 0x07
33#define AK8975_REG_HZH 0x08
34#define AK8975_REG_ST2 0x09
35#define AK8975_REG_CNTL 0x0A
36#define AK8975_REG_RSV 0x0B
37#define AK8975_REG_ASTC 0x0C
38#define AK8975_REG_TS1 0x0D
39#define AK8975_REG_TS2 0x0E
40#define AK8975_REG_I2CDIS 0x0F
41/*! @}*/
42
43/*! \name AK8975 fuse-rom address
44\anchor AK8975_FUSE
45Defines a read-only address of the fuse ROM of the AK8975.*/
46/*! @{*/
47#define AK8975_FUSE_ASAX 0x10
48#define AK8975_FUSE_ASAY 0x11
49#define AK8975_FUSE_ASAZ 0x12
50/*! @}*/
51
52#define AKMIO 0xA1
53
54/* IOCTLs for AKM library */
55#define ECS_IOCTL_WRITE _IOW(AKMIO, 0x02, char[5])
56#define ECS_IOCTL_READ _IOWR(AKMIO, 0x03, char[5])
57#define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x08, char[RBUFF_SIZE])
58#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x0C, short[12])
59#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x0D, int)
60#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x0E, int)
61#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, short)
62
63/* IOCTLs for APPs */
64#define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short)
65#define ECS_IOCTL_APP_GET_MFLAG _IOW(AKMIO, 0x12, short)
66#define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short)
67#define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short)
68#define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, short)
69#define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY
70/* Set raw magnetic vector flag */
71#define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short)
72/* Get raw magnetic vector flag */
73#define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short)
74#define ECS_IOCTL_APP_SET_TFLAG _IOR(AKMIO, 0x15, short)
75
76
77struct akm8975_platform_data {
78 int intr;
79
80 int (*init)(void);
81 void (*exit)(void);
82 int (*power_on)(void);
83 int (*power_off)(void);
84};
85
86#endif
87
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index 21114810c7c..60c737f7bda 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -5,6 +5,15 @@
5#define AMBA_MMCI_H 5#define AMBA_MMCI_H
6 6
7#include <linux/mmc/host.h> 7#include <linux/mmc/host.h>
8#include <linux/mmc/card.h>
9#include <linux/mmc/sdio_func.h>
10
11struct embedded_sdio_data {
12 struct sdio_cis cis;
13 struct sdio_cccr cccr;
14 struct sdio_embedded_func *funcs;
15 int num_funcs;
16};
8 17
9/* Just some dummy forwarding */ 18/* Just some dummy forwarding */
10struct dma_chan; 19struct dma_chan;
@@ -55,6 +64,9 @@ struct mmci_platform_data {
55 bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 64 bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
56 void *dma_rx_param; 65 void *dma_rx_param;
57 void *dma_tx_param; 66 void *dma_tx_param;
67 unsigned int status_irq;
68 struct embedded_sdio_data *embedded_sdio;
69 int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id);
58}; 70};
59 71
60#endif 72#endif
diff --git a/include/linux/android_aid.h b/include/linux/android_aid.h
new file mode 100644
index 00000000000..0f904b3ba7f
--- /dev/null
+++ b/include/linux/android_aid.h
@@ -0,0 +1,28 @@
1/* include/linux/android_aid.h
2 *
3 * Copyright (C) 2008 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#ifndef _LINUX_ANDROID_AID_H
17#define _LINUX_ANDROID_AID_H
18
19/* AIDs that the kernel treats differently */
20#define AID_NET_BT_ADMIN 3001
21#define AID_NET_BT 3002
22#define AID_INET 3003
23#define AID_NET_RAW 3004
24#define AID_NET_ADMIN 3005
25#define AID_NET_BW_STATS 3006 /* read bandwidth statistics */
26#define AID_NET_BW_ACCT 3007 /* change bandwidth statistics accounting */
27
28#endif
diff --git a/include/linux/android_alarm.h b/include/linux/android_alarm.h
new file mode 100644
index 00000000000..f8f14e793db
--- /dev/null
+++ b/include/linux/android_alarm.h
@@ -0,0 +1,106 @@
1/* include/linux/android_alarm.h
2 *
3 * Copyright (C) 2006-2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#ifndef _LINUX_ANDROID_ALARM_H
17#define _LINUX_ANDROID_ALARM_H
18
19#include <linux/ioctl.h>
20#include <linux/time.h>
21
22enum android_alarm_type {
23 /* return code bit numbers or set alarm arg */
24 ANDROID_ALARM_RTC_WAKEUP,
25 ANDROID_ALARM_RTC,
26 ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP,
27 ANDROID_ALARM_ELAPSED_REALTIME,
28 ANDROID_ALARM_SYSTEMTIME,
29
30 ANDROID_ALARM_TYPE_COUNT,
31
32 /* return code bit numbers */
33 /* ANDROID_ALARM_TIME_CHANGE = 16 */
34};
35
36#ifdef __KERNEL__
37
38#include <linux/ktime.h>
39#include <linux/rbtree.h>
40
41/*
42 * The alarm interface is similar to the hrtimer interface but adds support
43 * for wakeup from suspend. It also adds an elapsed realtime clock that can
44 * be used for periodic timers that need to keep runing while the system is
45 * suspended and not be disrupted when the wall time is set.
46 */
47
48/**
49 * struct alarm - the basic alarm structure
50 * @node: red black tree node for time ordered insertion
51 * @type: alarm type. rtc/elapsed-realtime/systemtime, wakeup/non-wakeup.
52 * @softexpires: the absolute earliest expiry time of the alarm.
53 * @expires: the absolute expiry time.
54 * @function: alarm expiry callback function
55 *
56 * The alarm structure must be initialized by alarm_init()
57 *
58 */
59
60struct alarm {
61 struct rb_node node;
62 enum android_alarm_type type;
63 ktime_t softexpires;
64 ktime_t expires;
65 void (*function)(struct alarm *);
66};
67
68void alarm_init(struct alarm *alarm,
69 enum android_alarm_type type, void (*function)(struct alarm *));
70void alarm_start_range(struct alarm *alarm, ktime_t start, ktime_t end);
71int alarm_try_to_cancel(struct alarm *alarm);
72int alarm_cancel(struct alarm *alarm);
73ktime_t alarm_get_elapsed_realtime(void);
74
75/* set rtc while preserving elapsed realtime */
76int alarm_set_rtc(const struct timespec ts);
77
78#endif
79
80enum android_alarm_return_flags {
81 ANDROID_ALARM_RTC_WAKEUP_MASK = 1U << ANDROID_ALARM_RTC_WAKEUP,
82 ANDROID_ALARM_RTC_MASK = 1U << ANDROID_ALARM_RTC,
83 ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP_MASK =
84 1U << ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP,
85 ANDROID_ALARM_ELAPSED_REALTIME_MASK =
86 1U << ANDROID_ALARM_ELAPSED_REALTIME,
87 ANDROID_ALARM_SYSTEMTIME_MASK = 1U << ANDROID_ALARM_SYSTEMTIME,
88 ANDROID_ALARM_TIME_CHANGE_MASK = 1U << 16
89};
90
91/* Disable alarm */
92#define ANDROID_ALARM_CLEAR(type) _IO('a', 0 | ((type) << 4))
93
94/* Ack last alarm and wait for next */
95#define ANDROID_ALARM_WAIT _IO('a', 1)
96
97#define ALARM_IOW(c, type, size) _IOW('a', (c) | ((type) << 4), size)
98/* Set alarm */
99#define ANDROID_ALARM_SET(type) ALARM_IOW(2, type, struct timespec)
100#define ANDROID_ALARM_SET_AND_WAIT(type) ALARM_IOW(3, type, struct timespec)
101#define ANDROID_ALARM_GET_TIME(type) ALARM_IOW(4, type, struct timespec)
102#define ANDROID_ALARM_SET_RTC _IOW('a', 5, struct timespec)
103#define ANDROID_ALARM_BASE_CMD(cmd) (cmd & ~(_IOC(0, 0, 0xf0, 0)))
104#define ANDROID_ALARM_IOCTL_TO_TYPE(cmd) (_IOC_NR(cmd) >> 4)
105
106#endif
diff --git a/include/linux/ashmem.h b/include/linux/ashmem.h
new file mode 100644
index 00000000000..1976b10ef93
--- /dev/null
+++ b/include/linux/ashmem.h
@@ -0,0 +1,48 @@
1/*
2 * include/linux/ashmem.h
3 *
4 * Copyright 2008 Google Inc.
5 * Author: Robert Love
6 *
7 * This file is dual licensed. It may be redistributed and/or modified
8 * under the terms of the Apache 2.0 License OR version 2 of the GNU
9 * General Public License.
10 */
11
12#ifndef _LINUX_ASHMEM_H
13#define _LINUX_ASHMEM_H
14
15#include <linux/limits.h>
16#include <linux/ioctl.h>
17
18#define ASHMEM_NAME_LEN 256
19
20#define ASHMEM_NAME_DEF "dev/ashmem"
21
22/* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */
23#define ASHMEM_NOT_PURGED 0
24#define ASHMEM_WAS_PURGED 1
25
26/* Return values from ASHMEM_GET_PIN_STATUS: Is the mapping pinned? */
27#define ASHMEM_IS_UNPINNED 0
28#define ASHMEM_IS_PINNED 1
29
30struct ashmem_pin {
31 __u32 offset; /* offset into region, in bytes, page-aligned */
32 __u32 len; /* length forward from offset, in bytes, page-aligned */
33};
34
35#define __ASHMEMIOC 0x77
36
37#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN])
38#define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN])
39#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t)
40#define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4)
41#define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long)
42#define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6)
43#define ASHMEM_PIN _IOW(__ASHMEMIOC, 7, struct ashmem_pin)
44#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin)
45#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9)
46#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
47
48#endif /* _LINUX_ASHMEM_H */
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index 96f4094b706..b1038bd686a 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -16,7 +16,7 @@
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/timer.h> 17#include <linux/timer.h>
18#include <linux/writeback.h> 18#include <linux/writeback.h>
19#include <asm/atomic.h> 19#include <linux/atomic.h>
20 20
21struct page; 21struct page;
22struct device; 22struct device;
@@ -40,6 +40,8 @@ typedef int (congested_fn)(void *, int);
40enum bdi_stat_item { 40enum bdi_stat_item {
41 BDI_RECLAIMABLE, 41 BDI_RECLAIMABLE,
42 BDI_WRITEBACK, 42 BDI_WRITEBACK,
43 BDI_DIRTIED,
44 BDI_WRITTEN,
43 NR_BDI_STAT_ITEMS 45 NR_BDI_STAT_ITEMS
44}; 46};
45 47
@@ -57,6 +59,7 @@ struct bdi_writeback {
57 struct list_head b_dirty; /* dirty inodes */ 59 struct list_head b_dirty; /* dirty inodes */
58 struct list_head b_io; /* parked for writeback */ 60 struct list_head b_io; /* parked for writeback */
59 struct list_head b_more_io; /* parked for more writeback */ 61 struct list_head b_more_io; /* parked for more writeback */
62 spinlock_t list_lock; /* protects the b_* lists */
60}; 63};
61 64
62struct backing_dev_info { 65struct backing_dev_info {
@@ -71,6 +74,21 @@ struct backing_dev_info {
71 74
72 struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS]; 75 struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS];
73 76
77 unsigned long bw_time_stamp; /* last time write bw is updated */
78 unsigned long dirtied_stamp;
79 unsigned long written_stamp; /* pages written at bw_time_stamp */
80 unsigned long write_bandwidth; /* the estimated write bandwidth */
81 unsigned long avg_write_bandwidth; /* further smoothed write bw */
82
83 /*
84 * The base dirty throttle rate, re-calculated on every 200ms.
85 * All the bdi tasks' dirty rate will be curbed under it.
86 * @dirty_ratelimit tracks the estimated @balanced_dirty_ratelimit
87 * in small steps and is much more smooth/stable than the latter.
88 */
89 unsigned long dirty_ratelimit;
90 unsigned long balanced_dirty_ratelimit;
91
74 struct prop_local_percpu completions; 92 struct prop_local_percpu completions;
75 int dirty_exceeded; 93 int dirty_exceeded;
76 94
@@ -100,12 +118,14 @@ int bdi_register(struct backing_dev_info *bdi, struct device *parent,
100int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev); 118int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);
101void bdi_unregister(struct backing_dev_info *bdi); 119void bdi_unregister(struct backing_dev_info *bdi);
102int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); 120int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int);
103void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages); 121void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages,
122 enum wb_reason reason);
104void bdi_start_background_writeback(struct backing_dev_info *bdi); 123void bdi_start_background_writeback(struct backing_dev_info *bdi);
105int bdi_writeback_thread(void *data); 124int bdi_writeback_thread(void *data);
106int bdi_has_dirty_io(struct backing_dev_info *bdi); 125int bdi_has_dirty_io(struct backing_dev_info *bdi);
107void bdi_arm_supers_timer(void); 126void bdi_arm_supers_timer(void);
108void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi); 127void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi);
128void bdi_lock_two(struct bdi_writeback *wb1, struct bdi_writeback *wb2);
109 129
110extern spinlock_t bdi_lock; 130extern spinlock_t bdi_lock;
111extern struct list_head bdi_list; 131extern struct list_head bdi_list;
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index dcafe0bf000..50e2c16b20f 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -45,6 +45,7 @@
45 * bitmap_set(dst, pos, nbits) Set specified bit area 45 * bitmap_set(dst, pos, nbits) Set specified bit area
46 * bitmap_clear(dst, pos, nbits) Clear specified bit area 46 * bitmap_clear(dst, pos, nbits) Clear specified bit area
47 * bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area 47 * bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area
48 * bitmap_find_next_zero_area_off(buf, len, pos, n, mask) as above
48 * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n 49 * bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n
49 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n 50 * bitmap_shift_left(dst, src, n, nbits) *dst = *src << n
50 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src) 51 * bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src)
@@ -114,11 +115,24 @@ extern int __bitmap_weight(const unsigned long *bitmap, int bits);
114 115
115extern void bitmap_set(unsigned long *map, int i, int len); 116extern void bitmap_set(unsigned long *map, int i, int len);
116extern void bitmap_clear(unsigned long *map, int start, int nr); 117extern void bitmap_clear(unsigned long *map, int start, int nr);
117extern unsigned long bitmap_find_next_zero_area(unsigned long *map, 118
118 unsigned long size, 119extern unsigned long bitmap_find_next_zero_area_off(unsigned long *map,
119 unsigned long start, 120 unsigned long size,
120 unsigned int nr, 121 unsigned long start,
121 unsigned long align_mask); 122 unsigned int nr,
123 unsigned long align_mask,
124 unsigned long align_offset);
125
126static inline unsigned long
127bitmap_find_next_zero_area(unsigned long *map,
128 unsigned long size,
129 unsigned long start,
130 unsigned int nr,
131 unsigned long align_mask)
132{
133 return bitmap_find_next_zero_area_off(map, size, start, nr,
134 align_mask, 0);
135}
122 136
123extern int bitmap_scnprintf(char *buf, unsigned int len, 137extern int bitmap_scnprintf(char *buf, unsigned int len,
124 const unsigned long *src, int nbits); 138 const unsigned long *src, int nbits);
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index 1b130216ccd..fd467be1eb6 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -393,7 +393,7 @@ struct request_queue
393#define QUEUE_FLAG_ELVSWITCH 6 /* don't use elevator, just do FIFO */ 393#define QUEUE_FLAG_ELVSWITCH 6 /* don't use elevator, just do FIFO */
394#define QUEUE_FLAG_BIDI 7 /* queue supports bidi requests */ 394#define QUEUE_FLAG_BIDI 7 /* queue supports bidi requests */
395#define QUEUE_FLAG_NOMERGES 8 /* disable merge attempts */ 395#define QUEUE_FLAG_NOMERGES 8 /* disable merge attempts */
396#define QUEUE_FLAG_SAME_COMP 9 /* force complete on same CPU */ 396#define QUEUE_FLAG_SAME_COMP 9 /* complete on same CPU-group */
397#define QUEUE_FLAG_FAIL_IO 10 /* fake timeout */ 397#define QUEUE_FLAG_FAIL_IO 10 /* fake timeout */
398#define QUEUE_FLAG_STACKABLE 11 /* supports request stacking */ 398#define QUEUE_FLAG_STACKABLE 11 /* supports request stacking */
399#define QUEUE_FLAG_NONROT 12 /* non-rotational device (SSD) */ 399#define QUEUE_FLAG_NONROT 12 /* non-rotational device (SSD) */
@@ -403,6 +403,7 @@ struct request_queue
403#define QUEUE_FLAG_NOXMERGES 15 /* No extended merges */ 403#define QUEUE_FLAG_NOXMERGES 15 /* No extended merges */
404#define QUEUE_FLAG_ADD_RANDOM 16 /* Contributes to random pool */ 404#define QUEUE_FLAG_ADD_RANDOM 16 /* Contributes to random pool */
405#define QUEUE_FLAG_SECDISCARD 17 /* supports SECDISCARD */ 405#define QUEUE_FLAG_SECDISCARD 17 /* supports SECDISCARD */
406#define QUEUE_FLAG_SAME_FORCE 18 /* force complete on same CPU */
406 407
407#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ 408#define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \
408 (1 << QUEUE_FLAG_STACKABLE) | \ 409 (1 << QUEUE_FLAG_STACKABLE) | \
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index ab4ac0ccb85..543250e4840 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -84,12 +84,6 @@ enum {
84 CSS_REMOVED, /* This CSS is dead */ 84 CSS_REMOVED, /* This CSS is dead */
85}; 85};
86 86
87/* Caller must verify that the css is not for root cgroup */
88static inline void __css_get(struct cgroup_subsys_state *css, int count)
89{
90 atomic_add(count, &css->refcnt);
91}
92
93/* 87/*
94 * Call css_get() to hold a reference on the css; it can be used 88 * Call css_get() to hold a reference on the css; it can be used
95 * for a reference obtained via: 89 * for a reference obtained via:
@@ -97,6 +91,7 @@ static inline void __css_get(struct cgroup_subsys_state *css, int count)
97 * - task->cgroups for a locked task 91 * - task->cgroups for a locked task
98 */ 92 */
99 93
94extern void __css_get(struct cgroup_subsys_state *css, int count);
100static inline void css_get(struct cgroup_subsys_state *css) 95static inline void css_get(struct cgroup_subsys_state *css)
101{ 96{
102 /* We don't need to reference count the root state */ 97 /* We don't need to reference count the root state */
@@ -143,10 +138,7 @@ static inline void css_put(struct cgroup_subsys_state *css)
143enum { 138enum {
144 /* Control Group is dead */ 139 /* Control Group is dead */
145 CGRP_REMOVED, 140 CGRP_REMOVED,
146 /* 141 /* Control Group has ever had a child cgroup or a task */
147 * Control Group has previously had a child cgroup or a task,
148 * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set)
149 */
150 CGRP_RELEASABLE, 142 CGRP_RELEASABLE,
151 /* Control Group requires release notifications to userspace */ 143 /* Control Group requires release notifications to userspace */
152 CGRP_NOTIFY_ON_RELEASE, 144 CGRP_NOTIFY_ON_RELEASE,
@@ -287,6 +279,7 @@ struct css_set {
287 279
288 /* For RCU-protected deletion */ 280 /* For RCU-protected deletion */
289 struct rcu_head rcu_head; 281 struct rcu_head rcu_head;
282 struct work_struct work;
290}; 283};
291 284
292/* 285/*
@@ -466,6 +459,7 @@ struct cgroup_subsys {
466 struct cgroup *cgrp); 459 struct cgroup *cgrp);
467 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 460 int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
468 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp); 461 void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
462 int (*allow_attach)(struct cgroup *cgrp, struct task_struct *tsk);
469 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp, 463 int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
470 struct task_struct *tsk); 464 struct task_struct *tsk);
471 int (*can_attach_task)(struct cgroup *cgrp, struct task_struct *tsk); 465 int (*can_attach_task)(struct cgroup *cgrp, struct task_struct *tsk);
diff --git a/include/linux/cgroup_subsys.h b/include/linux/cgroup_subsys.h
index ac663c18776..c966638399e 100644
--- a/include/linux/cgroup_subsys.h
+++ b/include/linux/cgroup_subsys.h
@@ -64,3 +64,9 @@ SUBSYS(perf)
64#endif 64#endif
65 65
66/* */ 66/* */
67
68#ifdef CONFIG_CGROUP_BFQIO
69SUBSYS(bfqio)
70#endif
71
72/* */
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 18a1baf31f2..ddafbffd84b 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -202,6 +202,7 @@ struct clocksource {
202#define CLOCK_SOURCE_WATCHDOG 0x10 202#define CLOCK_SOURCE_WATCHDOG 0x10
203#define CLOCK_SOURCE_VALID_FOR_HRES 0x20 203#define CLOCK_SOURCE_VALID_FOR_HRES 0x20
204#define CLOCK_SOURCE_UNSTABLE 0x40 204#define CLOCK_SOURCE_UNSTABLE 0x40
205#define CLOCK_SOURCE_SCHED_CLOCK 0x80
205 206
206/* simplify initialization of mask field */ 207/* simplify initialization of mask field */
207#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1) 208#define CLOCKSOURCE_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
diff --git a/include/linux/cma.h b/include/linux/cma.h
new file mode 100644
index 00000000000..0287f4e9bec
--- /dev/null
+++ b/include/linux/cma.h
@@ -0,0 +1,493 @@
1#ifndef __LINUX_CMA_H
2#define __LINUX_CMA_H
3
4/* linux/include/linux/cma.h
5 *
6 * Contiguous Memory Allocator framework
7 * Copyright (c) 2010 by Samsung Electronics.
8 * Written by Michal Nazarewicz (m.nazarewicz@samsung.com)
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation
13 */
14
15/*
16 * See Documentation/contiguous-memory.txt for details.
17 */
18
19#include <linux/ioctl.h>
20#include <linux/types.h>
21
22
23#define CMA_MAGIC (('c' << 24) | ('M' << 16) | ('a' << 8) | 0x42)
24
25enum {
26 CMA_REQ_DEV_KIND,
27 CMA_REQ_FROM_REG
28};
29
30/**
31 * An information about area exportable to user space.
32 * @magic: must always be CMA_MAGIC.
33 * @type: type of the request.
34 * @spec: either "dev/kind\0" or "regions\0" depending on @type.
35 * In any case, the string must be NUL terminated.
36 * additionally, in the latter case scanning stops at
37 * semicolon (';').
38 * @size: size of the chunk to allocate.
39 * @alignment: desired alignment of the chunk (must be power of two or zero).
40 * @start: when ioctl() finishes this stores physical address of the chunk.
41 */
42struct cma_alloc_request {
43 __u32 magic;
44 __u32 type;
45
46 /* __u64 to be compatible accross 32 and 64 bit systems. */
47 __u64 size;
48 __u64 alignment;
49 __u64 start;
50
51 char spec[32];
52};
53
54#define IOCTL_CMA_ALLOC _IOWR('p', 0, struct cma_alloc_request)
55
56
57/***************************** Kernel level API *****************************/
58
59#ifdef __KERNEL__
60
61#include <linux/rbtree.h>
62#include <linux/list.h>
63#if defined CONFIG_CMA_SYSFS
64# include <linux/kobject.h>
65#endif
66
67
68struct device;
69struct cma_info;
70
71/*
72 * Don't call it directly, use cma_alloc(), cma_alloc_from() or
73 * cma_alloc_from_region().
74 */
75dma_addr_t __must_check
76__cma_alloc(const struct device *dev, const char *type,
77 size_t size, dma_addr_t alignment);
78
79/* Don't call it directly, use cma_info() or cma_info_about(). */
80int
81__cma_info(struct cma_info *info, const struct device *dev, const char *type);
82
83
84/**
85 * cma_alloc - allocates contiguous chunk of memory.
86 * @dev: The device to perform allocation for.
87 * @type: A type of memory to allocate. Platform may define
88 * several different types of memory and device drivers
89 * can then request chunks of different types. Usually it's
90 * safe to pass NULL here which is the same as passing
91 * "common".
92 * @size: Size of the memory to allocate in bytes.
93 * @alignment: Desired alignment in bytes. Must be a power of two or
94 * zero. If alignment is less then a page size it will be
95 * set to page size. If unsure, pass zero here.
96 *
97 * On error returns a negative error cast to dma_addr_t. Use
98 * IS_ERR_VALUE() to check if returned value is indeed an error.
99 * Otherwise bus address of the chunk is returned.
100 */
101static inline dma_addr_t __must_check
102cma_alloc(const struct device *dev, const char *type,
103 size_t size, dma_addr_t alignment)
104{
105 return dev ? __cma_alloc(dev, type, size, alignment) : -EINVAL;
106}
107
108
109/**
110 * struct cma_info - information about regions returned by cma_info().
111 * @lower_bound: The smallest address that is possible to be
112 * allocated for given (dev, type) pair.
113 * @upper_bound: The one byte after the biggest address that is
114 * possible to be allocated for given (dev, type)
115 * pair.
116 * @total_size: Total size of regions mapped to (dev, type) pair.
117 * @free_size: Total free size in all of the regions mapped to (dev, type)
118 * pair. Because of possible race conditions, it is not
119 * guaranteed that the value will be correct -- it gives only
120 * an approximation.
121 * @count: Number of regions mapped to (dev, type) pair.
122 */
123struct cma_info {
124 dma_addr_t lower_bound, upper_bound;
125 size_t total_size, free_size;
126 unsigned count;
127};
128
129/**
130 * cma_info - queries information about regions.
131 * @info: Pointer to a structure where to save the information.
132 * @dev: The device to query information for.
133 * @type: A type of memory to query information for.
134 * If unsure, pass NULL here which is equal to passing
135 * "common".
136 *
137 * On error returns a negative error, zero otherwise.
138 */
139static inline int
140cma_info(struct cma_info *info, const struct device *dev, const char *type)
141{
142 return dev ? __cma_info(info, dev, type) : -EINVAL;
143}
144
145
146/**
147 * cma_free - frees a chunk of memory.
148 * @addr: Beginning of the chunk.
149 *
150 * Returns -ENOENT if there is no chunk at given location; otherwise
151 * zero. In the former case issues a warning.
152 */
153int cma_free(dma_addr_t addr);
154
155/**
156 * cma_get_virt - frees virtual address of cma memory.
157 * @phys: physical addrress
158 * @size: size of memory
159 * @noncached : 0 is cached, 1 is non-cached.
160 *
161 * Returns -ENOENT if there is no chunk at given location; otherwise
162 * zero. In the former case issues a warning.
163 */
164void *cma_get_virt(dma_addr_t phys, dma_addr_t size, int noncached);
165
166
167/****************************** Lower lever API *****************************/
168
169/**
170 * cma_alloc_from - allocates contiguous chunk of memory from named regions.
171 * @regions: Comma separated list of region names. Terminated by NUL
172 * byte or a semicolon.
173 * @size: Size of the memory to allocate in bytes.
174 * @alignment: Desired alignment in bytes. Must be a power of two or
175 * zero. If alignment is less then a page size it will be
176 * set to page size. If unsure, pass zero here.
177 *
178 * On error returns a negative error cast to dma_addr_t. Use
179 * IS_ERR_VALUE() to check if returned value is indeed an error.
180 * Otherwise bus address of the chunk is returned.
181 */
182static inline dma_addr_t __must_check
183cma_alloc_from(const char *regions, size_t size, dma_addr_t alignment)
184{
185 return __cma_alloc(NULL, regions, size, alignment);
186}
187
188/**
189 * cma_info_about - queries information about named regions.
190 * @info: Pointer to a structure where to save the information.
191 * @regions: Comma separated list of region names. Terminated by NUL
192 * byte or a semicolon.
193 *
194 * On error returns a negative error, zero otherwise.
195 */
196static inline int
197cma_info_about(struct cma_info *info, const const char *regions)
198{
199 return __cma_info(info, NULL, regions);
200}
201
202
203
204struct cma_allocator;
205
206/**
207 * struct cma_region - a region reserved for CMA allocations.
208 * @name: Unique name of the region. Read only.
209 * @start: Bus address of the region in bytes. Always aligned at
210 * least to a full page. Read only.
211 * @size: Size of the region in bytes. Multiply of a page size.
212 * Read only.
213 * @free_space: Free space in the region. Read only.
214 * @alignment: Desired alignment of the region in bytes. A power of two,
215 * always at least page size. Early.
216 * @alloc: Allocator used with this region. NULL means allocator is
217 * not attached. Private.
218 * @alloc_name: Allocator name read from cmdline. Private. This may be
219 * different from @alloc->name.
220 * @private_data: Allocator's private data.
221 * @users: Number of chunks allocated in this region.
222 * @list: Entry in list of regions. Private.
223 * @used: Whether region was already used, ie. there was at least
224 * one allocation request for. Private.
225 * @registered: Whether this region has been registered. Read only.
226 * @reserved: Whether this region has been reserved. Early. Read only.
227 * @copy_name: Whether @name and @alloc_name needs to be copied when
228 * this region is converted from early to normal. Early.
229 * Private.
230 * @free_alloc_name: Whether @alloc_name was kmalloced(). Private.
231 *
232 * Regions come in two types: an early region and normal region. The
233 * former can be reserved or not-reserved. Fields marked as "early"
234 * are only meaningful in early regions.
235 *
236 * Early regions are important only during initialisation. The list
237 * of early regions is built from the "cma" command line argument or
238 * platform defaults. Platform initialisation code is responsible for
239 * reserving space for unreserved regions that are placed on
240 * cma_early_regions list.
241 *
242 * Later, during CMA initialisation all reserved regions from the
243 * cma_early_regions list are registered as normal regions and can be
244 * used using standard mechanisms.
245 */
246struct cma_region {
247 const char *name;
248 dma_addr_t start;
249 size_t size;
250 union {
251 size_t free_space; /* Normal region */
252 dma_addr_t alignment; /* Early region */
253 };
254
255 struct cma_allocator *alloc;
256 const char *alloc_name;
257 void *private_data;
258
259 unsigned users;
260 struct list_head list;
261
262#if defined CONFIG_CMA_SYSFS
263 struct kobject kobj;
264#endif
265
266 unsigned used:1;
267 unsigned registered:1;
268 unsigned reserved:1;
269 unsigned copy_name:1;
270 unsigned free_alloc_name:1;
271};
272
273
274/**
275 * cma_region_register() - registers a region.
276 * @reg: Region to region.
277 *
278 * Region's start and size must be set.
279 *
280 * If name is set the region will be accessible using normal mechanism
281 * like mapping or cma_alloc_from() function otherwise it will be
282 * a private region and accessible only using the
283 * cma_alloc_from_region() function.
284 *
285 * If alloc is set function will try to initialise given allocator
286 * (and will return error if it failes). Otherwise alloc_name may
287 * point to a name of an allocator to use (if not set, the default
288 * will be used).
289 *
290 * All other fields are ignored and/or overwritten.
291 *
292 * Returns zero or negative error. In particular, -EADDRINUSE if
293 * region overlap with already existing region.
294 */
295int __must_check cma_region_register(struct cma_region *reg);
296
297/**
298 * cma_region_unregister() - unregisters a region.
299 * @reg: Region to unregister.
300 *
301 * Region is unregistered only if there are no chunks allocated for
302 * it. Otherwise, function returns -EBUSY.
303 *
304 * On success returs zero.
305 */
306int __must_check cma_region_unregister(struct cma_region *reg);
307
308
309/**
310 * cma_alloc_from_region() - allocates contiguous chunk of memory from region.
311 * @reg: Region to allocate chunk from.
312 * @size: Size of the memory to allocate in bytes.
313 * @alignment: Desired alignment in bytes. Must be a power of two or
314 * zero. If alignment is less then a page size it will be
315 * set to page size. If unsure, pass zero here.
316 *
317 * On error returns a negative error cast to dma_addr_t. Use
318 * IS_ERR_VALUE() to check if returned value is indeed an error.
319 * Otherwise bus address of the chunk is returned.
320 */
321dma_addr_t __must_check
322cma_alloc_from_region(struct cma_region *reg,
323 size_t size, dma_addr_t alignment);
324
325
326
327/****************************** Allocators API ******************************/
328
329/**
330 * struct cma_chunk - an allocated contiguous chunk of memory.
331 * @start: Bus address in bytes.
332 * @size: Size in bytes.
333 * @free_space: Free space in region in bytes. Read only.
334 * @reg: Region this chunk belongs to.
335 * @by_start: A node in an red-black tree with all chunks sorted by
336 * start address.
337 *
338 * The cma_allocator::alloc() operation need to set only the @start
339 * and @size fields. The rest is handled by the caller (ie. CMA
340 * glue).
341 */
342struct cma_chunk {
343 dma_addr_t start;
344 size_t size;
345
346 struct cma_region *reg;
347 struct rb_node by_start;
348};
349
350
351/**
352 * struct cma_allocator - a CMA allocator.
353 * @name: Allocator's unique name
354 * @init: Initialises an allocator on given region.
355 * @cleanup: Cleans up after init. May assume that there are no chunks
356 * allocated in given region.
357 * @alloc: Allocates a chunk of memory of given size in bytes and
358 * with given alignment. Alignment is a power of
359 * two (thus non-zero) and callback does not need to check it.
360 * May also assume that it is the only call that uses given
361 * region (ie. access to the region is synchronised with
362 * a mutex). This has to allocate the chunk object (it may be
363 * contained in a bigger structure with allocator-specific data.
364 * Required.
365 * @free: Frees allocated chunk. May also assume that it is the only
366 * call that uses given region. This has to free() the chunk
367 * object as well. Required.
368 * @list: Entry in list of allocators. Private.
369 */
370struct cma_allocator {
371 const char *name;
372
373 int (*init)(struct cma_region *reg);
374 void (*cleanup)(struct cma_region *reg);
375 struct cma_chunk *(*alloc)(struct cma_region *reg, size_t size,
376 dma_addr_t alignment);
377 void (*free)(struct cma_chunk *chunk);
378
379 struct list_head list;
380};
381
382
383/**
384 * cma_allocator_register() - Registers an allocator.
385 * @alloc: Allocator to register.
386 *
387 * Adds allocator to the list of allocators managed by CMA.
388 *
389 * All of the fields of cma_allocator structure must be set except for
390 * the optional name and the list's head which will be overriden
391 * anyway.
392 *
393 * Returns zero or negative error code.
394 */
395int cma_allocator_register(struct cma_allocator *alloc);
396
397
398/**************************** Initialisation API ****************************/
399
400/**
401 * cma_set_defaults() - specifies default command line parameters.
402 * @regions: A zero-sized entry terminated list of early regions.
403 * This array must not be placed in __initdata section.
404 * @map: Map attribute.
405 *
406 * This function should be called prior to cma_early_regions_reserve()
407 * and after early parameters have been parsed.
408 *
409 * Returns zero or negative error.
410 */
411int __init cma_set_defaults(struct cma_region *regions, const char *map);
412
413
414/**
415 * cma_early_regions - a list of early regions.
416 *
417 * Platform needs to allocate space for each of the region before
418 * initcalls are executed. If space is reserved, the reserved flag
419 * must be set. Platform initialisation code may choose to use
420 * cma_early_regions_allocate().
421 *
422 * Later, during CMA initialisation all reserved regions from the
423 * cma_early_regions list are registered as normal regions and can be
424 * used using standard mechanisms.
425 */
426extern struct list_head cma_early_regions __initdata;
427
428
429/**
430 * cma_early_region_register() - registers an early region.
431 * @reg: Region to add.
432 *
433 * Region's size, start and alignment must be set (however the last
434 * two can be zero). If name is set the region will be accessible
435 * using normal mechanism like mapping or cma_alloc_from() function
436 * otherwise it will be a private region accessible only using the
437 * cma_alloc_from_region().
438 *
439 * During platform initialisation, space is reserved for early
440 * regions. Later, when CMA initialises, the early regions are
441 * "converted" into normal regions. If cma_region::alloc is set, CMA
442 * will then try to setup given allocator on the region. Failure to
443 * do so will result in the region not being registered even though
444 * the space for it will still be reserved. If cma_region::alloc is
445 * not set, allocator will be attached to the region on first use and
446 * the value of cma_region::alloc_name will be taken into account if
447 * set.
448 *
449 * All other fields are ignored and/or overwritten.
450 *
451 * Returns zero or negative error. No checking if regions overlap is
452 * performed.
453 */
454int __init __must_check cma_early_region_register(struct cma_region *reg);
455
456
457/**
458 * cma_early_region_reserve() - reserves a physically contiguous memory region.
459 * @reg: Early region to reserve memory for.
460 *
461 * If platform supports bootmem this is the first allocator this
462 * function tries to use. If that failes (or bootmem is not
463 * supported) function tries to use memblec if it is available.
464 *
465 * On success sets reg->reserved flag.
466 *
467 * Returns zero or negative error.
468 */
469int __init cma_early_region_reserve(struct cma_region *reg);
470
471/**
472 * cma_early_regions_reserve() - helper function for reserving early regions.
473 * @reserve: Callbac function used to reserve space for region. Needs
474 * to return non-negative if allocation succeeded, negative
475 * error otherwise. NULL means cma_early_region_alloc() will
476 * be used.
477 *
478 * This function traverses the %cma_early_regions list and tries to
479 * reserve memory for each early region. It uses the @reserve
480 * callback function for that purpose. The reserved flag of each
481 * region is updated accordingly.
482 */
483void __init cma_early_regions_reserve(int (*reserve)(struct cma_region *reg));
484
485#else
486
487#define cma_set_defaults(regions, map) ((int)0)
488#define cma_early_region_reserve(region) ((int)-EOPNOTSUPP)
489#define cma_early_regions_reserve(reserve) do { } while (0)
490
491#endif
492
493#endif
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 42af2eae880..111797a0919 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -175,4 +175,11 @@ static inline int disable_nonboot_cpus(void) { return 0; }
175static inline void enable_nonboot_cpus(void) {} 175static inline void enable_nonboot_cpus(void) {}
176#endif /* !CONFIG_PM_SLEEP_SMP */ 176#endif /* !CONFIG_PM_SLEEP_SMP */
177 177
178#define IDLE_START 1
179#define IDLE_END 2
180
181void idle_notifier_register(struct notifier_block *n);
182void idle_notifier_unregister(struct notifier_block *n);
183void idle_notifier_call_chain(unsigned long val);
184
178#endif /* _LINUX_CPU_H_ */ 185#endif /* _LINUX_CPU_H_ */
diff --git a/include/linux/cpuacct.h b/include/linux/cpuacct.h
new file mode 100644
index 00000000000..8f68e733fe1
--- /dev/null
+++ b/include/linux/cpuacct.h
@@ -0,0 +1,43 @@
1/* include/linux/cpuacct.h
2 *
3 * Copyright (C) 2010 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#ifndef _CPUACCT_H_
17#define _CPUACCT_H_
18
19#include <linux/cgroup.h>
20
21#ifdef CONFIG_CGROUP_CPUACCT
22
23/*
24 * Platform specific CPU frequency hooks for cpuacct. These functions are
25 * called from the scheduler.
26 */
27struct cpuacct_charge_calls {
28 /*
29 * Platforms can take advantage of this data and use
30 * per-cpu allocations if necessary.
31 */
32 void (*init) (void **cpuacct_data);
33 void (*charge) (void *cpuacct_data, u64 cputime, unsigned int cpu);
34 void (*cpufreq_show) (void *cpuacct_data, struct cgroup_map_cb *cb);
35 /* Returns power consumed in milliWatt seconds */
36 u64 (*power_usage) (void *cpuacct_data);
37};
38
39int cpuacct_charge_register(struct cpuacct_charge_calls *fn);
40
41#endif /* CONFIG_CGROUP_CPUACCT */
42
43#endif // _CPUACCT_H_
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 11be48e0d16..ce207b8097b 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -358,6 +358,12 @@ extern struct cpufreq_governor cpufreq_gov_ondemand;
358#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE) 358#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE)
359extern struct cpufreq_governor cpufreq_gov_conservative; 359extern struct cpufreq_governor cpufreq_gov_conservative;
360#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative) 360#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative)
361#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE)
362extern struct cpufreq_governor cpufreq_gov_interactive;
363#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_interactive)
364#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_ADAPTIVE)
365extern struct cpufreq_governor cpufreq_gov_adaptive;
366#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_adaptive)
361#endif 367#endif
362 368
363 369
diff --git a/include/linux/crc32.h b/include/linux/crc32.h
index 391a259b2cc..68267b64bb9 100644
--- a/include/linux/crc32.h
+++ b/include/linux/crc32.h
@@ -11,6 +11,8 @@
11extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len); 11extern u32 crc32_le(u32 crc, unsigned char const *p, size_t len);
12extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len); 12extern u32 crc32_be(u32 crc, unsigned char const *p, size_t len);
13 13
14extern u32 __crc32c_le(u32 crc, unsigned char const *p, size_t len);
15
14#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length) 16#define crc32(seed, data, length) crc32_le(seed, (unsigned char const *)(data), length)
15 17
16/* 18/*
diff --git a/include/linux/cryptohash.h b/include/linux/cryptohash.h
index d2984fbebbc..2cd9f1cf9fa 100644
--- a/include/linux/cryptohash.h
+++ b/include/linux/cryptohash.h
@@ -3,7 +3,7 @@
3 3
4#define SHA_DIGEST_WORDS 5 4#define SHA_DIGEST_WORDS 5
5#define SHA_MESSAGE_BYTES (512 /*bits*/ / 8) 5#define SHA_MESSAGE_BYTES (512 /*bits*/ / 8)
6#define SHA_WORKSPACE_WORDS 80 6#define SHA_WORKSPACE_WORDS 16
7 7
8void sha_init(__u32 *buf); 8void sha_init(__u32 *buf);
9void sha_transform(__u32 *digest, const char *data, __u32 *W); 9void sha_transform(__u32 *digest, const char *data, __u32 *W);
diff --git a/include/linux/earlysuspend.h b/include/linux/earlysuspend.h
new file mode 100644
index 00000000000..8343b817af3
--- /dev/null
+++ b/include/linux/earlysuspend.h
@@ -0,0 +1,56 @@
1/* include/linux/earlysuspend.h
2 *
3 * Copyright (C) 2007-2008 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#ifndef _LINUX_EARLYSUSPEND_H
17#define _LINUX_EARLYSUSPEND_H
18
19#ifdef CONFIG_HAS_EARLYSUSPEND
20#include <linux/list.h>
21#endif
22
23/* The early_suspend structure defines suspend and resume hooks to be called
24 * when the user visible sleep state of the system changes, and a level to
25 * control the order. They can be used to turn off the screen and input
26 * devices that are not used for wakeup.
27 * Suspend handlers are called in low to high level order, resume handlers are
28 * called in the opposite order. If, when calling register_early_suspend,
29 * the suspend handlers have already been called without a matching call to the
30 * resume handlers, the suspend handler will be called directly from
31 * register_early_suspend. This direct call can violate the normal level order.
32 */
33enum {
34 EARLY_SUSPEND_LEVEL_BLANK_SCREEN = 50,
35 EARLY_SUSPEND_LEVEL_STOP_DRAWING = 100,
36 EARLY_SUSPEND_LEVEL_DISABLE_FB = 150,
37};
38struct early_suspend {
39#ifdef CONFIG_HAS_EARLYSUSPEND
40 struct list_head link;
41 int level;
42 void (*suspend)(struct early_suspend *h);
43 void (*resume)(struct early_suspend *h);
44#endif
45};
46
47#ifdef CONFIG_HAS_EARLYSUSPEND
48void register_early_suspend(struct early_suspend *handler);
49void unregister_early_suspend(struct early_suspend *handler);
50#else
51#define register_early_suspend(handler) do { } while (0)
52#define unregister_early_suspend(handler) do { } while (0)
53#endif
54
55#endif
56
diff --git a/include/linux/elevator.h b/include/linux/elevator.h
index 21a8ebf2dc3..d800d514218 100644
--- a/include/linux/elevator.h
+++ b/include/linux/elevator.h
@@ -146,7 +146,7 @@ extern struct request *elv_rb_latter_request(struct request_queue *, struct requ
146/* 146/*
147 * rb support functions. 147 * rb support functions.
148 */ 148 */
149extern struct request *elv_rb_add(struct rb_root *, struct request *); 149extern void elv_rb_add(struct rb_root *, struct request *);
150extern void elv_rb_del(struct rb_root *, struct request *); 150extern void elv_rb_del(struct rb_root *, struct request *);
151extern struct request *elv_rb_find(struct rb_root *, sector_t); 151extern struct request *elv_rb_find(struct rb_root *, sector_t);
152 152
diff --git a/include/linux/exynos_mem.h b/include/linux/exynos_mem.h
new file mode 100644
index 00000000000..0cc9bea4c53
--- /dev/null
+++ b/include/linux/exynos_mem.h
@@ -0,0 +1,24 @@
1/* linux/include/linux/exynos_mem.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#ifndef __INCLUDE_EXYNOS_MEM_H
12#define __INCLUDE_EXYNOS_MEM_H __FILE__
13
14/* IOCTL commands */
15#define EXYNOS_MEM_SET_CACHEABLE _IOW('M', 200, bool)
16#define EXYNOS_MEM_PADDR_CACHE_FLUSH _IOW('M', 201, struct exynos_mem_flush_range)
17#define EXYNOS_MEM_PADDR_CACHE_CLEAN _IOW('M', 203, struct exynos_mem_flush_range)
18
19struct exynos_mem_flush_range {
20 phys_addr_t start;
21 size_t length;
22};
23
24#endif /* __INCLUDE_EXYNOS_MEM_H */
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index 5bbebda78b0..af44e88d0b0 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -11,28 +11,11 @@
11 11
12#ifndef __GENALLOC_H__ 12#ifndef __GENALLOC_H__
13#define __GENALLOC_H__ 13#define __GENALLOC_H__
14/*
15 * General purpose special memory pool descriptor.
16 */
17struct gen_pool {
18 rwlock_t lock;
19 struct list_head chunks; /* list of chunks in this pool */
20 int min_alloc_order; /* minimum allocation order */
21};
22 14
23/* 15struct gen_pool;
24 * General purpose special memory pool chunk descriptor. 16
25 */ 17struct gen_pool *__must_check gen_pool_create(unsigned order, int nid);
26struct gen_pool_chunk { 18
27 spinlock_t lock;
28 struct list_head next_chunk; /* next chunk in pool */
29 phys_addr_t phys_addr; /* physical starting address of memory chunk */
30 unsigned long start_addr; /* starting address of memory chunk */
31 unsigned long end_addr; /* ending address of memory chunk */
32 unsigned long bits[0]; /* bitmap for allocating memory chunk */
33};
34
35extern struct gen_pool *gen_pool_create(int, int);
36extern phys_addr_t gen_pool_virt_to_phys(struct gen_pool *pool, unsigned long); 19extern phys_addr_t gen_pool_virt_to_phys(struct gen_pool *pool, unsigned long);
37extern int gen_pool_add_virt(struct gen_pool *, unsigned long, phys_addr_t, 20extern int gen_pool_add_virt(struct gen_pool *, unsigned long, phys_addr_t,
38 size_t, int); 21 size_t, int);
@@ -53,7 +36,26 @@ static inline int gen_pool_add(struct gen_pool *pool, unsigned long addr,
53{ 36{
54 return gen_pool_add_virt(pool, addr, -1, size, nid); 37 return gen_pool_add_virt(pool, addr, -1, size, nid);
55} 38}
56extern void gen_pool_destroy(struct gen_pool *); 39
57extern unsigned long gen_pool_alloc(struct gen_pool *, size_t); 40void gen_pool_destroy(struct gen_pool *pool);
58extern void gen_pool_free(struct gen_pool *, unsigned long, size_t); 41
42unsigned long __must_check
43gen_pool_alloc_aligned(struct gen_pool *pool, size_t size,
44 unsigned alignment_order);
45
46/**
47 * gen_pool_alloc() - allocate special memory from the pool
48 * @pool: Pool to allocate from.
49 * @size: Number of bytes to allocate from the pool.
50 *
51 * Allocate the requested number of bytes from the specified pool.
52 * Uses a first-fit algorithm.
53 */
54static inline unsigned long __must_check
55gen_pool_alloc(struct gen_pool *pool, size_t size)
56{
57 return gen_pool_alloc_aligned(pool, size, 0);
58}
59
60void gen_pool_free(struct gen_pool *pool, unsigned long addr, size_t size);
59#endif /* __GENALLOC_H__ */ 61#endif /* __GENALLOC_H__ */
diff --git a/include/linux/gpio_event.h b/include/linux/gpio_event.h
new file mode 100644
index 00000000000..2613fc5e4a9
--- /dev/null
+++ b/include/linux/gpio_event.h
@@ -0,0 +1,170 @@
1/* include/linux/gpio_event.h
2 *
3 * Copyright (C) 2007 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#ifndef _LINUX_GPIO_EVENT_H
17#define _LINUX_GPIO_EVENT_H
18
19#include <linux/input.h>
20
21struct gpio_event_input_devs {
22 int count;
23 struct input_dev *dev[];
24};
25enum {
26 GPIO_EVENT_FUNC_UNINIT = 0x0,
27 GPIO_EVENT_FUNC_INIT = 0x1,
28 GPIO_EVENT_FUNC_SUSPEND = 0x2,
29 GPIO_EVENT_FUNC_RESUME = 0x3,
30};
31struct gpio_event_info {
32 int (*func)(struct gpio_event_input_devs *input_devs,
33 struct gpio_event_info *info,
34 void **data, int func);
35 int (*event)(struct gpio_event_input_devs *input_devs,
36 struct gpio_event_info *info,
37 void **data, unsigned int dev, unsigned int type,
38 unsigned int code, int value); /* out events */
39 bool no_suspend;
40};
41
42struct gpio_event_platform_data {
43 const char *name;
44 struct gpio_event_info **info;
45 size_t info_count;
46 int (*power)(const struct gpio_event_platform_data *pdata, bool on);
47 const char *names[]; /* If name is NULL, names contain a NULL */
48 /* terminated list of input devices to create */
49};
50
51#define GPIO_EVENT_DEV_NAME "gpio-event"
52
53/* Key matrix */
54
55enum gpio_event_matrix_flags {
56 /* unset: drive active output low, set: drive active output high */
57 GPIOKPF_ACTIVE_HIGH = 1U << 0,
58 GPIOKPF_DEBOUNCE = 1U << 1,
59 GPIOKPF_REMOVE_SOME_PHANTOM_KEYS = 1U << 2,
60 GPIOKPF_REMOVE_PHANTOM_KEYS = GPIOKPF_REMOVE_SOME_PHANTOM_KEYS |
61 GPIOKPF_DEBOUNCE,
62 GPIOKPF_DRIVE_INACTIVE = 1U << 3,
63 GPIOKPF_LEVEL_TRIGGERED_IRQ = 1U << 4,
64 GPIOKPF_PRINT_UNMAPPED_KEYS = 1U << 16,
65 GPIOKPF_PRINT_MAPPED_KEYS = 1U << 17,
66 GPIOKPF_PRINT_PHANTOM_KEYS = 1U << 18,
67};
68
69#define MATRIX_CODE_BITS (10)
70#define MATRIX_KEY_MASK ((1U << MATRIX_CODE_BITS) - 1)
71#define MATRIX_KEY(dev, code) \
72 (((dev) << MATRIX_CODE_BITS) | (code & MATRIX_KEY_MASK))
73
74extern int gpio_event_matrix_func(struct gpio_event_input_devs *input_devs,
75 struct gpio_event_info *info, void **data, int func);
76struct gpio_event_matrix_info {
77 /* initialize to gpio_event_matrix_func */
78 struct gpio_event_info info;
79 /* size must be ninputs * noutputs */
80 const unsigned short *keymap;
81 unsigned int *input_gpios;
82 unsigned int *output_gpios;
83 unsigned int ninputs;
84 unsigned int noutputs;
85 /* time to wait before reading inputs after driving each output */
86 ktime_t settle_time;
87 /* time to wait before scanning the keypad a second time */
88 ktime_t debounce_delay;
89 ktime_t poll_time;
90 unsigned flags;
91};
92
93/* Directly connected inputs and outputs */
94
95enum gpio_event_direct_flags {
96 GPIOEDF_ACTIVE_HIGH = 1U << 0,
97/* GPIOEDF_USE_DOWN_IRQ = 1U << 1, */
98/* GPIOEDF_USE_IRQ = (1U << 2) | GPIOIDF_USE_DOWN_IRQ, */
99 GPIOEDF_PRINT_KEYS = 1U << 8,
100 GPIOEDF_PRINT_KEY_DEBOUNCE = 1U << 9,
101 GPIOEDF_PRINT_KEY_UNSTABLE = 1U << 10,
102};
103
104struct gpio_event_direct_entry {
105 uint32_t gpio:16;
106 uint32_t code:10;
107 uint32_t dev:6;
108};
109
110/* inputs */
111extern int gpio_event_input_func(struct gpio_event_input_devs *input_devs,
112 struct gpio_event_info *info, void **data, int func);
113struct gpio_event_input_info {
114 /* initialize to gpio_event_input_func */
115 struct gpio_event_info info;
116 ktime_t debounce_time;
117 ktime_t poll_time;
118 uint16_t flags;
119 uint16_t type;
120 const struct gpio_event_direct_entry *keymap;
121 size_t keymap_size;
122};
123
124/* outputs */
125extern int gpio_event_output_func(struct gpio_event_input_devs *input_devs,
126 struct gpio_event_info *info, void **data, int func);
127extern int gpio_event_output_event(struct gpio_event_input_devs *input_devs,
128 struct gpio_event_info *info, void **data,
129 unsigned int dev, unsigned int type,
130 unsigned int code, int value);
131struct gpio_event_output_info {
132 /* initialize to gpio_event_output_func and gpio_event_output_event */
133 struct gpio_event_info info;
134 uint16_t flags;
135 uint16_t type;
136 const struct gpio_event_direct_entry *keymap;
137 size_t keymap_size;
138};
139
140
141/* axes */
142
143enum gpio_event_axis_flags {
144 GPIOEAF_PRINT_UNKNOWN_DIRECTION = 1U << 16,
145 GPIOEAF_PRINT_RAW = 1U << 17,
146 GPIOEAF_PRINT_EVENT = 1U << 18,
147};
148
149extern int gpio_event_axis_func(struct gpio_event_input_devs *input_devs,
150 struct gpio_event_info *info, void **data, int func);
151struct gpio_event_axis_info {
152 /* initialize to gpio_event_axis_func */
153 struct gpio_event_info info;
154 uint8_t count; /* number of gpios for this axis */
155 uint8_t dev; /* device index when using multiple input devices */
156 uint8_t type; /* EV_REL or EV_ABS */
157 uint16_t code;
158 uint16_t decoded_size;
159 uint16_t (*map)(struct gpio_event_axis_info *info, uint16_t in);
160 uint32_t *gpio;
161 uint32_t flags;
162};
163#define gpio_axis_2bit_gray_map gpio_axis_4bit_gray_map
164#define gpio_axis_3bit_gray_map gpio_axis_4bit_gray_map
165uint16_t gpio_axis_4bit_gray_map(
166 struct gpio_event_axis_info *info, uint16_t in);
167uint16_t gpio_axis_5bit_singletrack_map(
168 struct gpio_event_axis_info *info, uint16_t in);
169
170#endif
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index ba362171e8a..de48bdad279 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -139,7 +139,13 @@ static inline void account_system_vtime(struct task_struct *tsk)
139extern void account_system_vtime(struct task_struct *tsk); 139extern void account_system_vtime(struct task_struct *tsk);
140#endif 140#endif
141 141
142#if defined(CONFIG_NO_HZ) 142#if defined(CONFIG_JRCU)
143extern int rcu_nmi_seen;
144# define rcu_irq_enter() do { } while (0)
145# define rcu_irq_exit() do { } while (0)
146# define rcu_nmi_enter() do { rcu_nmi_seen = 1; } while (0)
147# define rcu_nmi_exit() do { } while (0)
148#elif defined(CONFIG_NO_HZ)
143#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU) 149#if defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU)
144extern void rcu_enter_nohz(void); 150extern void rcu_enter_nohz(void);
145extern void rcu_exit_nohz(void); 151extern void rcu_exit_nohz(void);
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 42f7e2fb501..4bfb4cac4b6 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -597,6 +597,8 @@ struct hid_usage_id {
597 * @input_mapping: invoked on input registering before mapping an usage 597 * @input_mapping: invoked on input registering before mapping an usage
598 * @input_mapped: invoked on input registering after mapping an usage 598 * @input_mapped: invoked on input registering after mapping an usage
599 * @feature_mapping: invoked on feature registering 599 * @feature_mapping: invoked on feature registering
600 * @input_register: called just before input device is registered after reports
601 * are parsed.
600 * @suspend: invoked on suspend (NULL means nop) 602 * @suspend: invoked on suspend (NULL means nop)
601 * @resume: invoked on resume if device was not reset (NULL means nop) 603 * @resume: invoked on resume if device was not reset (NULL means nop)
602 * @reset_resume: invoked on resume if device was reset (NULL means nop) 604 * @reset_resume: invoked on resume if device was reset (NULL means nop)
@@ -643,6 +645,8 @@ struct hid_driver {
643 void (*feature_mapping)(struct hid_device *hdev, 645 void (*feature_mapping)(struct hid_device *hdev,
644 struct hid_field *field, 646 struct hid_field *field,
645 struct hid_usage *usage); 647 struct hid_usage *usage);
648 int (*input_register)(struct hid_device *hdev, struct hid_input
649 *hidinput);
646#ifdef CONFIG_PM 650#ifdef CONFIG_PM
647 int (*suspend)(struct hid_device *hdev, pm_message_t message); 651 int (*suspend)(struct hid_device *hdev, pm_message_t message);
648 int (*resume)(struct hid_device *hdev); 652 int (*resume)(struct hid_device *hdev);
diff --git a/include/linux/if_pppolac.h b/include/linux/if_pppolac.h
new file mode 100644
index 00000000000..c06bd6c8ba2
--- /dev/null
+++ b/include/linux/if_pppolac.h
@@ -0,0 +1,33 @@
1/* include/linux/if_pppolac.h
2 *
3 * Header for PPP on L2TP Access Concentrator / PPPoLAC Socket (RFC 2661)
4 *
5 * Copyright (C) 2009 Google, Inc.
6 * Author: Chia-chi Yeh <chiachi@android.com>
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef __LINUX_IF_PPPOLAC_H
19#define __LINUX_IF_PPPOLAC_H
20
21#include <linux/socket.h>
22#include <linux/types.h>
23
24struct sockaddr_pppolac {
25 sa_family_t sa_family; /* AF_PPPOX */
26 unsigned int sa_protocol; /* PX_PROTO_OLAC */
27 int udp_socket;
28 struct __attribute__((packed)) {
29 __u16 tunnel, session;
30 } local, remote;
31} __attribute__((packed));
32
33#endif /* __LINUX_IF_PPPOLAC_H */
diff --git a/include/linux/if_pppopns.h b/include/linux/if_pppopns.h
new file mode 100644
index 00000000000..0cf34b4d551
--- /dev/null
+++ b/include/linux/if_pppopns.h
@@ -0,0 +1,32 @@
1/* include/linux/if_pppopns.h
2 *
3 * Header for PPP on PPTP Network Server / PPPoPNS Socket (RFC 2637)
4 *
5 * Copyright (C) 2009 Google, Inc.
6 * Author: Chia-chi Yeh <chiachi@android.com>
7 *
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17
18#ifndef __LINUX_IF_PPPOPNS_H
19#define __LINUX_IF_PPPOPNS_H
20
21#include <linux/socket.h>
22#include <linux/types.h>
23
24struct sockaddr_pppopns {
25 sa_family_t sa_family; /* AF_PPPOX */
26 unsigned int sa_protocol; /* PX_PROTO_OPNS */
27 int tcp_socket;
28 __u16 local;
29 __u16 remote;
30} __attribute__((packed));
31
32#endif /* __LINUX_IF_PPPOPNS_H */
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 397921b09ef..999ccd3fff3 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -27,6 +27,8 @@
27#include <linux/ppp_channel.h> 27#include <linux/ppp_channel.h>
28#endif /* __KERNEL__ */ 28#endif /* __KERNEL__ */
29#include <linux/if_pppol2tp.h> 29#include <linux/if_pppol2tp.h>
30#include <linux/if_pppolac.h>
31#include <linux/if_pppopns.h>
30 32
31/* For user-space programs to pick up these definitions 33/* For user-space programs to pick up these definitions
32 * which they wouldn't get otherwise without defining __KERNEL__ 34 * which they wouldn't get otherwise without defining __KERNEL__
@@ -60,7 +62,9 @@ struct pptp_addr {
60#define PX_PROTO_OE 0 /* Currently just PPPoE */ 62#define PX_PROTO_OE 0 /* Currently just PPPoE */
61#define PX_PROTO_OL2TP 1 /* Now L2TP also */ 63#define PX_PROTO_OL2TP 1 /* Now L2TP also */
62#define PX_PROTO_PPTP 2 64#define PX_PROTO_PPTP 2
63#define PX_MAX_PROTO 3 65#define PX_PROTO_OLAC 3
66#define PX_PROTO_OPNS 4
67#define PX_MAX_PROTO 5
64 68
65struct sockaddr_pppox { 69struct sockaddr_pppox {
66 sa_family_t sa_family; /* address family, AF_PPPOX */ 70 sa_family_t sa_family; /* address family, AF_PPPOX */
@@ -167,6 +171,25 @@ struct pptp_opt {
167 u32 seq_sent, seq_recv; 171 u32 seq_sent, seq_recv;
168 int ppp_flags; 172 int ppp_flags;
169}; 173};
174
175struct pppolac_opt {
176 __u32 local;
177 __u32 remote;
178 __u32 recv_sequence;
179 __u32 xmit_sequence;
180 atomic_t sequencing;
181 int (*backlog_rcv)(struct sock *sk_udp, struct sk_buff *skb);
182};
183
184struct pppopns_opt {
185 __u16 local;
186 __u16 remote;
187 __u32 recv_sequence;
188 __u32 xmit_sequence;
189 void (*data_ready)(struct sock *sk_raw, int length);
190 int (*backlog_rcv)(struct sock *sk_raw, struct sk_buff *skb);
191};
192
170#include <net/sock.h> 193#include <net/sock.h>
171 194
172struct pppox_sock { 195struct pppox_sock {
@@ -177,6 +200,8 @@ struct pppox_sock {
177 union { 200 union {
178 struct pppoe_opt pppoe; 201 struct pppoe_opt pppoe;
179 struct pptp_opt pptp; 202 struct pptp_opt pptp;
203 struct pppolac_opt lac;
204 struct pppopns_opt pns;
180 } proto; 205 } proto;
181 __be16 num; 206 __be16 num;
182}; 207};
diff --git a/include/linux/input/isa1200.h b/include/linux/input/isa1200.h
new file mode 100644
index 00000000000..c72f736d4e3
--- /dev/null
+++ b/include/linux/input/isa1200.h
@@ -0,0 +1,30 @@
1/*
2 * ISA1200 Haptic Driver
3 */
4
5#ifndef __LINUX_ISA1200_H
6#define __LINUX_ISA1200_H
7
8#include <linux/compiler.h>
9#include <linux/types.h>
10
11#define ISA1200_POWERDOWN_MODE (0<<3)
12#define ISA1200_PWM_INPUT_MODE (1<<3)
13#define ISA1200_PWM_GEN_MODE (2<<3)
14#define ISA1200_WAVE_GEN_MODE (3<<3)
15
16struct isa1200_platform_data {
17
18 int gpio_hen;
19 int gpio_len;
20 unsigned char mode_sel;
21
22 int pwm_gpio;
23 int pwm_func;
24
25 int pwm_id;
26 unsigned short pwm_periode_ns;
27 unsigned short pwm_duty;
28};
29
30#endif /* __LINUX_ISA1200_H */
diff --git a/include/linux/input/odroidq-touch.h b/include/linux/input/odroidq-touch.h
new file mode 100644
index 00000000000..979f45e5d5f
--- /dev/null
+++ b/include/linux/input/odroidq-touch.h
@@ -0,0 +1,247 @@
1//[*]--------------------------------------------------------------------------------------------------[*]
2//
3//
4//
5// I2C Touchscreen driver (platform data struct)
6// 2012.01.17
7//
8//
9//[*]--------------------------------------------------------------------------------------------------[*]
10#ifndef __ODROIDQ_TOUCH_H__
11#define __ODROIDQ_TOUCH_H__
12
13//[*]--------------------------------------------------------------------------------------------------[*]
14#ifdef CONFIG_HAS_EARLYSUSPEND
15 #include <linux/earlysuspend.h>
16#endif
17
18//[*]--------------------------------------------------------------------------------------------------[*]
19#define IRQ_MODE_EVENT
20
21//[*]--------------------------------------------------------------------------------------------------[*]
22#if defined(CONFIG_ANDROID_PARANOID_NETWORK)
23 #define SOFT_AVR_FILTER_ENABLE
24#endif
25
26#if defined(SOFT_AVR_FILTER_ENABLE)
27 #define SOFT_AVR_COUNT 10
28 #define SOFT_AVR_MOVE_TOL_X 20 // First move tol
29 #define SOFT_AVR_MOVE_TOL_Y 20 // First move tol
30 #define SOFT_AVR_ENABLE_SPEED 5
31#endif
32
33//[*]--------------------------------------------------------------------------------------------------[*]
34#define EVENT_MOVE_TOL 0x01 // 0x53 Register (0x00 ~ 0xFF : 0x10 default)
35#define X_TRACKING 0x80 // 0x54 Register (0x00 ~ 0xFF : 0x80 default)
36#define Y_TRACKING 0x80 // 0x55 Register (0x00 ~ 0xFF : 0x80 default)
37
38#if defined(SOFT_AVR_FILTER_ENABLE)
39 #define MOVE_AVR_FILTER 0x00 // 0x56 Register (0x00 ~ 0x03 : 0x00 default)
40#else
41 //#define MOVE_AVR_FILTER 0x01 // 0x56 Register (0x00 ~ 0x03 : 0x00 default)
42 #define MOVE_AVR_FILTER 0x02 // 0x56 Register (0x00 ~ 0x03 : 0x00 default)
43 //#define MOVE_AVR_FILTER 0x03 // 0x56 Register (0x00 ~ 0x03 : 0x00 default)
44#endif
45
46#define SCAN_MODE 0x01 // 0x26 Register (0x00 ~ ?? : 0x02 default)
47//#define SCAN_MODE 0x0F // 0x26 Register (0x00 ~ ?? : 0x02 default)
48
49//[*]--------------------------------------------------------------------------------------------------[*]
50#define MAX_FINGERS 10
51#define RESOULATION 64
52
53#define DRIVE_LINE_COUNT 23
54#define SENSE_LINE_COUNT 38
55
56//#define DRIVE_DATA_MAX (DRIVE_LINE_COUNT * RESOULATION)
57//#define SENSE_DATA_MAX (SENSE_LINE_COUNT * RESOULATION)
58
59#define DRIVE_DATA_MAX 800
60#define SENSE_DATA_MAX 1280
61
62#define TRANSPOSE_XY 0x04
63#define INVERT_Y 0x01
64#define INVERT_X 0x02
65
66// 0x65 Register (0x00 ~ 0x07 : 0x00 default)
67#define ORIENTATION 0x00
68
69#define TRACKING_ID_MAX 16
70
71#define PRESSURE_MAX 16
72
73//[*]--------------------------------------------------------------------------------------------------[*]
74// Register Define
75//[*]--------------------------------------------------------------------------------------------------[*]
76#define NOP 0x00
77#define DEVICE_ID 0x02
78#define VERSION_ID 0x03
79#define SLEEP_OUT_REG 0x04
80#define SLEEP_IN_REG 0x05
81#define DRIVE_NO_REG 0x06
82#define SENSE_NO_REG 0x07
83
84//[*]--------------------------------------------------------------------------------------------------[*]
85#define DRIVE_LINE0_REG 0x08
86#define DRIVE_LINE1_REG 0x09
87#define DRIVE_LINE2_REG 0x0A
88#define DRIVE_LINE3_REG 0x0B
89#define DRIVE_LINE4_REG 0x0C
90#define DRIVE_LINE5_REG 0x0D
91#define DRIVE_LINE6_REG 0x0E
92#define DRIVE_LINE7_REG 0x0F
93#define DRIVE_LINE8_REG 0x10
94#define DRIVE_LINE9_REG 0x11
95#define DRIVE_LINE10_REG 0x12
96#define DRIVE_LINE11_REG 0x13
97#define DRIVE_LINE12_REG 0x14
98#define DRIVE_LINE13_REG 0x15
99#define DRIVE_LINE14_REG 0x16
100#define DRIVE_LINE15_REG 0x17
101#define DRIVE_LINE16_REG 0x18
102#define DRIVE_LINE17_REG 0x19
103#define DRIVE_LINE18_REG 0x1A
104#define DRIVE_LINE19_REG 0x1B
105#define DRIVE_LINE20_REG 0x1C
106#define DRIVE_LINE21_REG 0x1D
107#define DRIVE_LINE22_REG 0x1E
108
109//[*]--------------------------------------------------------------------------------------------------[*]
110#define WOP_MODE_REG 0x25
111#define ROP_MODE_REG 0x26
112#define DOWN_TIME_REG 0x27
113#define FRAME_ESC_REG 0x28
114#define SCAN_FRAME_REG 0x2A
115
116//[*]--------------------------------------------------------------------------------------------------[*]
117#define MEDIAN_FILTER_SEL_REG 0x2C
118#define INT_GAIN_REG 0x2F
119#define START_INT_REG 0x30
120#define END_INT_REG 0x31
121
122//[*]--------------------------------------------------------------------------------------------------[*]
123#define MIN_AREA_REG 0x33
124#define MIN_LEVEL_REG 0x34
125#define MIN_WEIGHT_REG 0x35
126#define MAX_AREA_REG 0x36
127#define SEG_DEPTH_REG 0x37
128#define CG_METHOD_REG 0x39
129#define HYBRID_SELECT_REG 0x3A
130#define INT_BYPASS_REG 0x3C
131#define FILTER_SEL_REG 0x3D
132#define CALIBRATE_OFF_REG 0x3E
133
134//[*]--------------------------------------------------------------------------------------------------[*]
135#define EVENT_MOVE_TOL_REG 0x53
136#define X_TRACKING_TOL_REG 0x54
137#define Y_TRACKING_TOL_REG 0x55
138#define MOV_AVG_FILTER_REG 0x56
139#define ORIENTATION_REG 0x65
140#define X_SCALING_REG 0x66
141#define Y_SCALING_REG 0x67
142#define X_OFFSET_REG 0x68
143#define Y_OFFSET_REG 0x69
144
145//[*]--------------------------------------------------------------------------------------------------[*]
146#define TOUCH_STATUS 0x79
147
148typedef struct status__t {
149 unsigned short fifo_valid :1;
150 unsigned short fifo_overflow :1;
151 unsigned short large_object :1;
152 unsigned short abnomal_status :1;
153 unsigned short fingers :10;
154 unsigned short reserved :2;
155} __attribute__ ((packed)) status_t;
156
157typedef union status__u {
158 unsigned char byte[sizeof(status_t)];
159 status_t bits;
160} __attribute__ ((packed)) status_u;
161
162//[*]--------------------------------------------------------------------------------------------------[*]
163#define BUTTON_STATUS 0xB9
164
165//[*]--------------------------------------------------------------------------------------------------[*]
166#define EVENT_MASK_REG 0x7A
167#define IRQ_MASK_REG 0x7B
168
169//[*]--------------------------------------------------------------------------------------------------[*]
170#define FINGER00_REG 0x7C
171#define FINGER01_REG 0x7D
172#define FINGER02_REG 0x7E
173#define FINGER03_REG 0x7F
174#define FINGER04_REG 0x80
175#define FINGER05_REG 0x81
176#define FINGER06_REG 0x82
177#define FINGER07_REG 0x83
178#define FINGER08_REG 0x84
179#define FINGER09_REG 0x85
180
181typedef struct finger_data__t {
182 unsigned char speed :4; // LSB
183 unsigned char pressure :4;
184 unsigned char msb_y :4;
185 unsigned char msb_x :4;
186 unsigned char lsb_y :8;
187 unsigned char lsb_x :8; // MSB
188} __attribute__ ((packed)) finger_data_t;
189
190typedef union finger_data__u {
191 unsigned char byte[sizeof(finger_data_t)];
192 finger_data_t bits;
193} __attribute__ ((packed)) finger_data_u;
194
195//[*]--------------------------------------------------------------------------------------------------[*]
196#define EVENT_STACK 0x86
197
198typedef struct event_stack__t {
199 unsigned char speed :4; // LSB
200 unsigned char pressure :4;
201 unsigned char msb_y :4;
202 unsigned char msb_x :4;
203 unsigned char lsb_y :8;
204 unsigned char lsb_x :8;
205 unsigned char event :4;
206 unsigned char number :4; // MSB
207} __attribute__ ((packed)) event_stack_t;
208
209typedef union event_stack__u {
210 unsigned char byte[sizeof(event_stack_t)];
211 event_stack_t bits;
212} __attribute__ ((packed)) event_stack_u;
213
214//[*]--------------------------------------------------------------------------------------------------[*]
215#define EVENT_FIFO_SCLR 0x87
216#define TOUCH_IRQ_MODE 0x89 // 0 -> event, 1 -> frame
217//[*]--------------------------------------------------------------------------------------------------[*]
218#define INIT_RST 0xA2
219#define DRIVE_LEVEL_REG 0xD5
220#define ADC_RANGE_SEL_REG 0xD7
221#define BIAS_RES 0xD8
222#define INTG_CAP_REG 0xDB
223
224//[*]--------------------------------------------------------------------------------------------------[*]
225#define EVENT_UNKNOWN 0x00
226#define EVENT_PRESS 0x03
227#define EVENT_MOVE 0x04
228#define EVENT_RELEASE 0x05
229
230//[*]--------------------------------------------------------------------------------------------------[*]
231//[*]--------------------------------------------------------------------------------------------------[*]
232//
233// ODROID-Q Control Function define
234//
235//[*]--------------------------------------------------------------------------------------------------[*]
236extern int odroidq_calibration (struct touch *ts);
237extern int odroidq_i2c_read (struct i2c_client *client, unsigned char *cmd, unsigned int cmd_len, unsigned char *data, unsigned int len);
238extern void odroidq_work (struct touch *ts);
239extern void odroidq_enable (struct touch *ts);
240extern void odroidq_disable (struct touch *ts);
241extern int odroidq_early_probe (struct touch *ts);
242extern int odroidq_probe (struct touch *ts);
243
244//[*]--------------------------------------------------------------------------------------------------[*]
245#endif /* __ODROIDQ_TOUCH_H__ */
246//[*]--------------------------------------------------------------------------------------------------[*]
247//[*]--------------------------------------------------------------------------------------------------[*]
diff --git a/include/linux/input/touch-pdata.h b/include/linux/input/touch-pdata.h
new file mode 100644
index 00000000000..fed2d3b4e78
--- /dev/null
+++ b/include/linux/input/touch-pdata.h
@@ -0,0 +1,186 @@
1//[*]--------------------------------------------------------------------------------------------------[*]
2//
3//
4//
5// I2C Touchscreen driver (platform data struct)
6// 2012.01.17
7//
8//
9//[*]--------------------------------------------------------------------------------------------------[*]
10#ifndef __TOUCH_PDATA_H__
11#define __TOUCH_PDATA_H__
12
13//[*]--------------------------------------------------------------------------------------------------[*]
14#ifdef CONFIG_HAS_EARLYSUSPEND
15 #include <linux/earlysuspend.h>
16#endif
17
18#include <linux/interrupt.h>
19//[*]--------------------------------------------------------------------------------------------------[*]
20#define I2C_TOUCH_NAME "odroid-ts"
21
22#define I2C_SEND_MAX_SIZE 512 // I2C Send/Receive data max size
23
24//[*]--------------------------------------------------------------------------------------------------[*]
25// Button struct (1 = press, 0 = release)
26//[*]--------------------------------------------------------------------------------------------------[*]
27typedef struct button__t {
28 unsigned char bt0_press :1; // lsb
29 unsigned char bt1_press :1;
30 unsigned char bt2_press :1;
31 unsigned char bt3_press :1;
32 unsigned char bt4_press :1;
33 unsigned char bt5_press :1;
34 unsigned char bt6_press :1;
35 unsigned char bt7_press :1; // msb
36} __attribute__ ((packed)) button_t;
37
38typedef union button__u {
39 unsigned char ubyte;
40 button_t bits;
41} __attribute__ ((packed)) button_u;
42
43//[*]--------------------------------------------------------------------------------------------------[*]
44// Touch Event type define
45//[*]--------------------------------------------------------------------------------------------------[*]
46#define TS_EVENT_UNKNOWN 0x00
47#define TS_EVENT_PRESS 0x01
48#define TS_EVENT_MOVE 0x02
49#define TS_EVENT_RELEASE 0x03
50
51//[*]--------------------------------------------------------------------------------------------------[*]
52typedef struct finger__t {
53 unsigned int status; // true : ts data updated, false : no update data
54 unsigned int event; // ts event type
55 unsigned int id; // ts received id
56 unsigned int x; // ts data x
57 unsigned int y; // ts data y
58 unsigned int area; // ts finger area
59 unsigned int pressure; // ts finger pressure
60} __attribute__ ((packed)) finger_t;
61
62//[*]--------------------------------------------------------------------------------------------------[*]
63struct touch {
64 int irq;
65 struct i2c_client *client;
66 struct touch_pdata *pdata;
67 struct input_dev *input;
68 char phys[32];
69
70 // finger data
71 finger_t *finger;
72
73 // sysfs control flags
74 unsigned char disabled; // interrupt status
75 unsigned char fw_version;
76
77 unsigned char *fw_buf;
78 unsigned int fw_size;
79 int fw_status;
80
81 // irq func used
82 struct workqueue_struct *work_queue;
83 struct work_struct work;
84
85 // noise filter work
86 struct delayed_work filter_dwork;
87
88#if defined(CONFIG_HAS_EARLYSUSPEND)
89 struct early_suspend power;
90#endif
91};
92
93//[*]--------------------------------------------------------------------------------------------------[*]
94struct i2c_client;
95struct input_dev;
96struct device;
97
98//[*]--------------------------------------------------------------------------------------------------[*]
99#define IRQ_MODE_THREAD 0
100#define IRQ_MODE_NORMAL 1
101#define IRQ_MODE_POLLING 2
102
103//[*]--------------------------------------------------------------------------------------------------[*]
104// IRQ type & trigger action
105//[*]--------------------------------------------------------------------------------------------------[*]
106//
107// IRQF_TRIGGER_RISING, IRQF_TRIGGER_FALLING, IRQF_TRIGGER_HIGH, IRQF_TRIGGER_LOW
108// IRQF_DISABLED, IRQF_SHARED, IRQF_IRQPOLL, IRQF_ONESHOT, IRQF_NO_THREAD
109//
110//[*]--------------------------------------------------------------------------------------------------[*]
111struct touch_pdata {
112 char *name; /* input drv name */
113
114 int irq_gpio; /* irq gpio define */
115 int reset_gpio; /* reset gpio define */
116 int reset_level; /* reset level setting (1 = High reset, 0 = Low reset) */
117
118 int irq_mode; /* IRQ_MODE_THREAD, IRQ_MODE_NORMAL, IRQ_MODE_POLLING */
119 int irq_flags; /* irq flags setup : Therad irq mode(IRQF_TRIGGER_HIGH | IRQF_ONESHOT) */
120
121 int abs_max_x, abs_max_y;
122 int abs_min_x, abs_min_y;
123
124 int area_max, area_min;
125 int press_max, press_min;
126 int id_max, id_min;
127
128 int vendor, product, version;
129
130 int max_fingers;
131
132 int *keycode, keycnt;
133
134 //--------------------------------------------
135 // Control function
136 //--------------------------------------------
137 void (*gpio_init) (void); /* gpio early-init function */
138
139 irqreturn_t (*irq_func) (int irq, void *handle);
140 void (*touch_work) (struct touch *ts);
141
142 void (*report) (struct touch *ts);
143 void (*key_report) (struct touch *ts, unsigned char button_data);
144
145 int (*early_probe) (struct touch *ts);
146 int (*probe) (struct touch *ts);
147 void (*enable) (struct touch *ts);
148 void (*disable) (struct touch *ts);
149 int (*input_open) (struct input_dev *input);
150 void (*input_close) (struct input_dev *input);
151
152 void (*event_clear) (struct touch *ts);
153
154#ifdef CONFIG_HAS_EARLYSUSPEND
155 void (*resume) (struct early_suspend *h);
156 void (*suspend) (struct early_suspend *h);
157#endif
158
159 //--------------------------------------------
160 // I2C control function
161 //--------------------------------------------
162 int (*i2c_write) (struct i2c_client *client, unsigned char *cmd, unsigned int cmd_len, unsigned char *data, unsigned int len);
163 int (*i2c_read) (struct i2c_client *client, unsigned char *cmd, unsigned int cmd_len, unsigned char *data, unsigned int len);
164
165 //--------------------------------------------
166 // Firmware update control function
167 //--------------------------------------------
168 char *fw_filename;
169 int fw_filesize;
170
171 int (*i2c_boot_write) (struct i2c_client *client, unsigned char *cmd, unsigned int cmd_len, unsigned char *data, unsigned int len);
172 int (*i2c_boot_read) (struct i2c_client *client, unsigned char *cmd, unsigned int cmd_len, unsigned char *data, unsigned int len);
173 int (*fw_control) (struct touch *ts, unsigned int fw_status);
174 int (*flash_firmware) (struct device *dev, const char *fw_name);
175
176 //--------------------------------------------
177 // Calibration control func
178 //--------------------------------------------
179 int (*calibration) (struct touch *ts);
180};
181
182//[*]--------------------------------------------------------------------------------------------------[*]
183#endif /* __TOUCH_PDATA_H__ */
184//[*]--------------------------------------------------------------------------------------------------[*]
185//[*]--------------------------------------------------------------------------------------------------[*]
186
diff --git a/include/linux/iocontext.h b/include/linux/iocontext.h
index b2eee896dcb..7cbace3e14f 100644
--- a/include/linux/iocontext.h
+++ b/include/linux/iocontext.h
@@ -1,14 +1,14 @@
1#ifndef IOCONTEXT_H 1#ifndef IOCONTEXT_H
2#define IOCONTEXT_H 2#define IOCONTEXT_H
3 3
4#include <linux/bitmap.h>
4#include <linux/radix-tree.h> 5#include <linux/radix-tree.h>
5#include <linux/rcupdate.h> 6#include <linux/rcupdate.h>
6 7
7struct cfq_queue;
8struct cfq_io_context { 8struct cfq_io_context {
9 void *key; 9 void *key;
10 10
11 struct cfq_queue *cfqq[2]; 11 void *cfqq[2];
12 12
13 struct io_context *ioc; 13 struct io_context *ioc;
14 14
@@ -28,6 +28,16 @@ struct cfq_io_context {
28}; 28};
29 29
30/* 30/*
31 * Indexes into the ioprio_changed bitmap. A bit set indicates that
32 * the corresponding I/O scheduler needs to see a ioprio update.
33 */
34enum {
35 IOC_CFQ_IOPRIO_CHANGED,
36 IOC_BFQ_IOPRIO_CHANGED,
37 IOC_IOPRIO_CHANGED_BITS
38};
39
40/*
31 * I/O subsystem state of the associated processes. It is refcounted 41 * I/O subsystem state of the associated processes. It is refcounted
32 * and kmalloc'ed. These could be shared between processes. 42 * and kmalloc'ed. These could be shared between processes.
33 */ 43 */
@@ -39,7 +49,7 @@ struct io_context {
39 spinlock_t lock; 49 spinlock_t lock;
40 50
41 unsigned short ioprio; 51 unsigned short ioprio;
42 unsigned short ioprio_changed; 52 DECLARE_BITMAP(ioprio_changed, IOC_IOPRIO_CHANGED_BITS);
43 53
44#if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE) 54#if defined(CONFIG_BLK_CGROUP) || defined(CONFIG_BLK_CGROUP_MODULE)
45 unsigned short cgroup_changed; 55 unsigned short cgroup_changed;
@@ -53,6 +63,8 @@ struct io_context {
53 63
54 struct radix_tree_root radix_root; 64 struct radix_tree_root radix_root;
55 struct hlist_head cic_list; 65 struct hlist_head cic_list;
66 struct radix_tree_root bfq_radix_root;
67 struct hlist_head bfq_cic_list;
56 void __rcu *ioc_data; 68 void __rcu *ioc_data;
57}; 69};
58 70
diff --git a/include/linux/ion.h b/include/linux/ion.h
new file mode 100644
index 00000000000..fc3cf2809a4
--- /dev/null
+++ b/include/linux/ion.h
@@ -0,0 +1,418 @@
1/*
2 * include/linux/ion.h
3 *
4 * Copyright (C) 2011 Google, Inc.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef _LINUX_ION_H
18#define _LINUX_ION_H
19
20#include <linux/types.h>
21
22struct ion_handle;
23/**
24 * enum ion_heap_types - list of all possible types of heaps
25 * @ION_HEAP_TYPE_SYSTEM: memory allocated via vmalloc
26 * @ION_HEAP_TYPE_SYSTEM_CONTIG: memory allocated via kmalloc
27 * @ION_HEAP_TYPE_CARVEOUT: memory allocated from a prereserved
28 * carveout heap, allocations are physically
29 * contiguous
30 * @ION_HEAP_END: helper for iterating over heaps
31 */
32enum ion_heap_type {
33 ION_HEAP_TYPE_SYSTEM,
34 ION_HEAP_TYPE_SYSTEM_CONTIG,
35 ION_HEAP_TYPE_CARVEOUT,
36 ION_HEAP_TYPE_CUSTOM, /* must be last so device specific heaps always
37 are at the end of this enum */
38#ifdef CONFIG_ION_EXYNOS
39 ION_HEAP_TYPE_EXYNOS,
40 ION_HEAP_TYPE_EXYNOS_CONTIG,
41 ION_HEAP_TYPE_EXYNOS_USER,
42#endif
43 ION_NUM_HEAPS,
44};
45
46#define ION_HEAP_SYSTEM_MASK (1 << ION_HEAP_TYPE_SYSTEM)
47#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG)
48#define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT)
49
50#ifdef CONFIG_ION_EXYNOS
51#define ION_HEAP_EXYNOS_MASK (1 << ION_HEAP_TYPE_EXYNOS)
52#define ION_HEAP_EXYNOS_CONTIG_MASK (1 << ION_HEAP_TYPE_EXYNOS_CONTIG)
53#define ION_HEAP_EXYNOS_USER_MASK (1 << ION_HEAP_TYPE_EXYNOS_USER)
54#define ION_EXYNOS_WRITE_MASK (1 << (BITS_PER_LONG - 1))
55#endif
56
57#ifdef __KERNEL__
58struct ion_device;
59struct ion_heap;
60struct ion_mapper;
61struct ion_client;
62struct ion_buffer;
63
64/* This should be removed some day when phys_addr_t's are fully
65 plumbed in the kernel, and all instances of ion_phys_addr_t should
66 be converted to phys_addr_t. For the time being many kernel interfaces
67 do not accept phys_addr_t's that would have to */
68#define ion_phys_addr_t unsigned long
69
70/**
71 * struct ion_platform_heap - defines a heap in the given platform
72 * @type: type of the heap from ion_heap_type enum
73 * @id: unique identifier for heap. When allocating (lower numbers
74 * will be allocated from first)
75 * @name: used for debug purposes
76 * @base: base address of heap in physical memory if applicable
77 * @size: size of the heap in bytes if applicable
78 *
79 * Provided by the board file.
80 */
81struct ion_platform_heap {
82 enum ion_heap_type type;
83 unsigned int id;
84 const char *name;
85 ion_phys_addr_t base;
86 size_t size;
87};
88
89/**
90 * struct ion_platform_data - array of platform heaps passed from board file
91 * @nr: number of structures in the array
92 * @heaps: array of platform_heap structions
93 *
94 * Provided by the board file in the form of platform data to a platform device.
95 */
96struct ion_platform_data {
97 int nr;
98 struct ion_platform_heap heaps[];
99};
100
101/**
102 * ion_client_create() - allocate a client and returns it
103 * @dev: the global ion device
104 * @heap_mask: mask of heaps this client can allocate from
105 * @name: used for debugging
106 */
107struct ion_client *ion_client_create(struct ion_device *dev,
108 unsigned int heap_mask, const char *name);
109
110/**
111 * ion_client_destroy() - free's a client and all it's handles
112 * @client: the client
113 *
114 * Free the provided client and all it's resources including
115 * any handles it is holding.
116 */
117void ion_client_destroy(struct ion_client *client);
118
119/**
120 * ion_get_client() - obtain a user client from file descriptor from user
121 * @fd: the user client created by the request from user. This is
122 * passed from user.
123 *
124 * This function is requested by the device drivers that implement V4L2 and VB2
125 * interfaces. Those device drivers just obtains virtual address of a buffer
126 * even though it is allocated and mapped by ION. While they can retrieve the
127 * handle of the buffer, they are unable to access it because they do not know
128 * what client the handle belongs to.
129 * Note that the client obtained by this function is not released until
130 * ion_put_client() is called and the client is given.
131 */
132struct ion_client *ion_get_user_client(unsigned int fd_client);
133
134/**
135 * ion_put_client() - release the user client obtained by ion_get_client()
136 * @client - The user client to release.
137 */
138void ion_put_user_client(struct ion_client *user_client);
139
140/**
141 * ion_alloc - allocate ion memory
142 * @client: the client
143 * @len: size of the allocation
144 * @align: requested allocation alignment, lots of hardware blocks have
145 * alignment requirements of some kind
146 * @flags: mask of heaps to allocate from, if multiple bits are set
147 * heaps will be tried in order from lowest to highest order bit
148 *
149 * Allocate memory in one of the heaps provided in heap mask and return
150 * an opaque handle to it.
151 */
152struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
153 size_t align, unsigned int flags);
154
155/**
156 * ion_free - free a handle
157 * @client: the client
158 * @handle: the handle to free
159 *
160 * Free the provided handle.
161 */
162void ion_free(struct ion_client *client, struct ion_handle *handle);
163
164/**
165 * ion_phys - returns the physical address and len of a handle
166 * @client: the client
167 * @handle: the handle
168 * @addr: a pointer to put the address in
169 * @len: a pointer to put the length in
170 *
171 * This function queries the heap for a particular handle to get the
172 * handle's physical address. It't output is only correct if
173 * a heap returns physically contiguous memory -- in other cases
174 * this api should not be implemented -- ion_map_dma should be used
175 * instead. Returns -EINVAL if the handle is invalid. This has
176 * no implications on the reference counting of the handle --
177 * the returned value may not be valid if the caller is not
178 * holding a reference.
179 */
180int ion_phys(struct ion_client *client, struct ion_handle *handle,
181 ion_phys_addr_t *addr, size_t *len);
182
183/**
184 * ion_map_kernel - create mapping for the given handle
185 * @client: the client
186 * @handle: handle to map
187 *
188 * Map the given handle into the kernel and return a kernel address that
189 * can be used to access this address.
190 */
191void *ion_map_kernel(struct ion_client *client, struct ion_handle *handle);
192
193/**
194 * ion_unmap_kernel() - destroy a kernel mapping for a handle
195 * @client: the client
196 * @handle: handle to unmap
197 */
198void ion_unmap_kernel(struct ion_client *client, struct ion_handle *handle);
199
200/**
201 * ion_map_dma - create a dma mapping for a given handle
202 * @client: the client
203 * @handle: handle to map
204 *
205 * Return an sglist describing the given handle
206 */
207struct scatterlist *ion_map_dma(struct ion_client *client,
208 struct ion_handle *handle);
209
210/**
211 * ion_unmap_dma() - destroy a dma mapping for a handle
212 * @client: the client
213 * @handle: handle to unmap
214 */
215void ion_unmap_dma(struct ion_client *client, struct ion_handle *handle);
216
217/**
218 * ion_share() - given a handle, obtain a buffer to pass to other clients
219 * @client: the client
220 * @handle: the handle to share
221 *
222 * Given a handle, return a buffer, which exists in a global name
223 * space, and can be passed to other clients. Should be passed into ion_import
224 * to obtain a new handle for this buffer.
225 *
226 * NOTE: This function does do not an extra reference. The burden is on the
227 * caller to make sure the buffer doesn't go away while it's being passed to
228 * another client. That is, ion_free should not be called on this handle until
229 * the buffer has been imported into the other client.
230 */
231struct ion_buffer *ion_share(struct ion_client *client,
232 struct ion_handle *handle);
233
234/**
235 * ion_import() - given an buffer in another client, import it
236 * @client: this blocks client
237 * @buffer: the buffer to import (as obtained from ion_share)
238 *
239 * Given a buffer, add it to the client and return the handle to use to refer
240 * to it further. This is called to share a handle from one kernel client to
241 * another.
242 */
243struct ion_handle *ion_import(struct ion_client *client,
244 struct ion_buffer *buffer);
245
246/**
247 * ion_share_fd() - given a handle, obtain a buffer(fd) to pass to userspace
248 * @client: the client
249 * @handle: the handle to share
250 *
251 * Given a handle, return a fd of a buffer which can be passed to userspace.
252 * Should be passed into userspace or ion_import_fd to obtain a new handle for
253 * this buffer.
254 */
255int ion_share_fd(struct ion_client *client, struct ion_handle *handle);
256
257/**
258 * ion_import_fd() - given an fd obtained via ION_IOC_SHARE ioctl, import it
259 * @client: this blocks client
260 * @fd: the fd
261 *
262 * A helper function for drivers that will be recieving ion buffers shared
263 * with them from userspace. These buffers are represented by a file
264 * descriptor obtained as the return from the ION_IOC_SHARE ioctl.
265 * This function coverts that fd into the underlying buffer, and returns
266 * the handle to use to refer to it further.
267 */
268struct ion_handle *ion_import_fd(struct ion_client *client, int fd);
269
270/**
271 * ion_import_uva() - given a virtual address from user, that is mmapped on an
272 * fd obtained via ION_IOCTL_SHARE ioctl, import it
273 * @client: this blocks client
274 * @uva: virtual address in userspace.
275 * @offset: How many bytes are distant from the beginning of the ION buffer
276 *
277 * A helper function for drivers that will be recieving ion buffers shared
278 * with them from userspace. These buffers are represented by a virtual
279 * address that is mmaped on a file descriptor obtained as the return from the
280 * ION_IOC_SHARE ioctl.
281 * This function does same job with ion_import_fd().
282 */
283struct ion_handle *ion_import_uva(struct ion_client *client, unsigned long uva,
284 off_t *offset);
285
286#ifdef CONFIG_ION_EXYNOS
287struct ion_handle *ion_exynos_get_user_pages(struct ion_client *client,
288 unsigned long uvaddr, size_t len, unsigned int flags);
289#else
290#include <linux/err.h>
291static inline struct ion_handle *ion_exynos_get_user_pages(
292 struct ion_client *client, unsigned long uvaddr,
293 size_t len, unsigned int flags)
294{
295 return ERR_PTR(-ENOSYS);
296}
297#endif
298
299#endif /* __KERNEL__ */
300
301/**
302 * DOC: Ion Userspace API
303 *
304 * create a client by opening /dev/ion
305 * most operations handled via following ioctls
306 *
307 */
308
309/**
310 * struct ion_allocation_data - metadata passed from userspace for allocations
311 * @len: size of the allocation
312 * @align: required alignment of the allocation
313 * @flags: flags passed to heap
314 * @handle: pointer that will be populated with a cookie to use to refer
315 * to this allocation
316 *
317 * Provided by userspace as an argument to the ioctl
318 */
319struct ion_allocation_data {
320 size_t len;
321 size_t align;
322 unsigned int flags;
323 struct ion_handle *handle;
324};
325
326/**
327 * struct ion_fd_data - metadata passed to/from userspace for a handle/fd pair
328 * @handle: a handle
329 * @fd: a file descriptor representing that handle
330 *
331 * For ION_IOC_SHARE or ION_IOC_MAP userspace populates the handle field with
332 * the handle returned from ion alloc, and the kernel returns the file
333 * descriptor to share or map in the fd field. For ION_IOC_IMPORT, userspace
334 * provides the file descriptor and the kernel returns the handle.
335 */
336struct ion_fd_data {
337 struct ion_handle *handle;
338 int fd;
339};
340
341/**
342 * struct ion_handle_data - a handle passed to/from the kernel
343 * @handle: a handle
344 */
345struct ion_handle_data {
346 struct ion_handle *handle;
347};
348
349/**
350 * struct ion_custom_data - metadata passed to/from userspace for a custom ioctl
351 * @cmd: the custom ioctl function to call
352 * @arg: additional data to pass to the custom ioctl, typically a user
353 * pointer to a predefined structure
354 *
355 * This works just like the regular cmd and arg fields of an ioctl.
356 */
357struct ion_custom_data {
358 unsigned int cmd;
359 unsigned long arg;
360};
361
362#define ION_IOC_MAGIC 'I'
363
364/**
365 * DOC: ION_IOC_ALLOC - allocate memory
366 *
367 * Takes an ion_allocation_data struct and returns it with the handle field
368 * populated with the opaque handle for the allocation.
369 */
370#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \
371 struct ion_allocation_data)
372
373/**
374 * DOC: ION_IOC_FREE - free memory
375 *
376 * Takes an ion_handle_data struct and frees the handle.
377 */
378#define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
379
380/**
381 * DOC: ION_IOC_MAP - get a file descriptor to mmap
382 *
383 * Takes an ion_fd_data struct with the handle field populated with a valid
384 * opaque handle. Returns the struct with the fd field set to a file
385 * descriptor open in the current address space. This file descriptor
386 * can then be used as an argument to mmap.
387 */
388#define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data)
389
390/**
391 * DOC: ION_IOC_SHARE - creates a file descriptor to use to share an allocation
392 *
393 * Takes an ion_fd_data struct with the handle field populated with a valid
394 * opaque handle. Returns the struct with the fd field set to a file
395 * descriptor open in the current address space. This file descriptor
396 * can then be passed to another process. The corresponding opaque handle can
397 * be retrieved via ION_IOC_IMPORT.
398 */
399#define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)
400
401/**
402 * DOC: ION_IOC_IMPORT - imports a shared file descriptor
403 *
404 * Takes an ion_fd_data struct with the fd field populated with a valid file
405 * descriptor obtained from ION_IOC_SHARE and returns the struct with the handle
406 * filed set to the corresponding opaque handle.
407 */
408#define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, int)
409
410/**
411 * DOC: ION_IOC_CUSTOM - call architecture specific ion ioctl
412 *
413 * Takes the argument of the architecture specific ioctl to call and
414 * passes appropriate userdata for that ioctl
415 */
416#define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)
417
418#endif /* _LINUX_ION_H */
diff --git a/include/linux/jrcu.h b/include/linux/jrcu.h
new file mode 100644
index 00000000000..1c1d6a7059e
--- /dev/null
+++ b/include/linux/jrcu.h
@@ -0,0 +1,80 @@
1/*
2 * JRCU - An RCU suitable for small SMP systems.
3 *
4 * Author: Joe Korty <joe.korty@ccur.com>
5 * Copyright Concurrent Computer Corporation, 2011
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 */
21#ifndef __LINUX_JRCU_H
22#define __LINUX_JRCU_H
23
24#define __rcu_read_lock() preempt_disable()
25#define __rcu_read_unlock() jrcu_read_unlock()
26extern void jrcu_read_unlock(void);
27
28#define __rcu_read_lock_bh() __rcu_read_lock()
29#define __rcu_read_unlock_bh() __rcu_read_unlock()
30
31extern void call_rcu_sched(struct rcu_head *head, void (*func)(struct rcu_head *rcu));
32
33#define call_rcu_bh call_rcu_sched
34#define call_rcu call_rcu_sched
35
36extern void rcu_barrier(void);
37
38#define rcu_barrier_sched rcu_barrier
39#define rcu_barrier_bh rcu_barrier
40
41extern void synchronize_sched(void);
42
43#define synchronize_rcu synchronize_sched
44#define synchronize_rcu_bh synchronize_sched
45#define synchronize_rcu_expedited synchronize_sched
46#define synchronize_rcu_bh_expedited synchronize_sched
47#define synchronize_sched_expedited synchronize_sched
48
49#define rcu_init(cpu) do { } while (0)
50#define rcu_init_sched() do { } while (0)
51#define exit_rcu() do { } while (0)
52
53static inline void __rcu_check_callbacks(int cpu, int user) { }
54#define rcu_check_callbacks __rcu_check_callbacks
55
56#define rcu_needs_cpu(cpu) (0)
57#define rcu_batches_completed() (0)
58#define rcu_batches_completed_bh() (0)
59#define rcu_preempt_depth() (0)
60
61extern void rcu_force_quiescent_state(void);
62
63#define rcu_sched_force_quiescent_state rcu_force_quiescent_state
64#define rcu_bh_force_quiescent_state rcu_force_quiescent_state
65
66#define rcu_enter_nohz() do { } while (0)
67#define rcu_exit_nohz() do { } while (0)
68
69extern void rcu_note_context_switch(int cpu);
70
71#define rcu_sched_qs rcu_note_context_switch
72#define rcu_bh_qs rcu_note_context_switch
73#define rcu_virt_note_context_switch rcu_note_context_switch
74
75extern void rcu_note_might_resched(void);
76
77extern void rcu_scheduler_starting(void);
78extern int rcu_scheduler_active __read_mostly;
79
80#endif /* __LINUX_JRCU_H */
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 3a3925d2aad..ace5de46aef 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -127,11 +127,18 @@ struct completion;
127struct pt_regs; 127struct pt_regs;
128struct user; 128struct user;
129 129
130/* cannot bring in linux/rcupdate.h at this point */
131#ifdef CONFIG_JRCU
132extern void rcu_note_might_resched(void);
133#else
134#define rcu_note_might_resched()
135#endif /*JRCU */
136
130#ifdef CONFIG_PREEMPT_VOLUNTARY 137#ifdef CONFIG_PREEMPT_VOLUNTARY
131extern int _cond_resched(void); 138extern int _cond_resched(void);
132# define might_resched() _cond_resched() 139# define might_resched() do { _cond_resched(); rcu_note_might_resched(); } while (0)
133#else 140#else
134# define might_resched() do { } while (0) 141# define might_resched() do { rcu_note_might_resched(); } while (0)
135#endif 142#endif
136 143
137#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP 144#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
@@ -749,4 +756,7 @@ extern int __build_bug_on_failed;
749# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD 756# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
750#endif 757#endif
751 758
759/* To identify board information in panic logs, set this */
760extern char *mach_panic_string;
761
752#endif 762#endif
diff --git a/include/linux/keychord.h b/include/linux/keychord.h
new file mode 100644
index 00000000000..856a5850217
--- /dev/null
+++ b/include/linux/keychord.h
@@ -0,0 +1,52 @@
1/*
2 * Key chord input driver
3 *
4 * Copyright (C) 2008 Google, Inc.
5 * Author: Mike Lockwood <lockwood@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16*/
17
18#ifndef __LINUX_KEYCHORD_H_
19#define __LINUX_KEYCHORD_H_
20
21#include <linux/input.h>
22
23#define KEYCHORD_VERSION 1
24
25/*
26 * One or more input_keychord structs are written to /dev/keychord
27 * at once to specify the list of keychords to monitor.
28 * Reading /dev/keychord returns the id of a keychord when the
29 * keychord combination is pressed. A keychord is signalled when
30 * all of the keys in the keycode list are in the pressed state.
31 * The order in which the keys are pressed does not matter.
32 * The keychord will not be signalled if keys not in the keycode
33 * list are pressed.
34 * Keychords will not be signalled on key release events.
35 */
36struct input_keychord {
37 /* should be KEYCHORD_VERSION */
38 __u16 version;
39 /*
40 * client specified ID, returned from read()
41 * when this keychord is pressed.
42 */
43 __u16 id;
44
45 /* number of keycodes in this keychord */
46 __u16 count;
47
48 /* variable length array of keycodes */
49 __u16 keycodes[];
50};
51
52#endif /* __LINUX_KEYCHORD_H_ */
diff --git a/include/linux/keyreset.h b/include/linux/keyreset.h
new file mode 100644
index 00000000000..a2ac49e5b68
--- /dev/null
+++ b/include/linux/keyreset.h
@@ -0,0 +1,28 @@
1/*
2 * include/linux/keyreset.h - platform data structure for resetkeys driver
3 *
4 * Copyright (C) 2008 Google, Inc.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef _LINUX_KEYRESET_H
18#define _LINUX_KEYRESET_H
19
20#define KEYRESET_NAME "keyreset"
21
22struct keyreset_platform_data {
23 int (*reset_fn)(void);
24 int *keys_up;
25 int keys_down[]; /* 0 terminated */
26};
27
28#endif /* _LINUX_KEYRESET_H */
diff --git a/include/linux/linux_logo.h b/include/linux/linux_logo.h
index ca5bd91d12e..0f054a57b71 100644
--- a/include/linux/linux_logo.h
+++ b/include/linux/linux_logo.h
@@ -34,6 +34,7 @@ struct linux_logo {
34 34
35extern const struct linux_logo logo_linux_mono; 35extern const struct linux_logo logo_linux_mono;
36extern const struct linux_logo logo_linux_vga16; 36extern const struct linux_logo logo_linux_vga16;
37extern const struct linux_logo logo_samsung_clut224;
37extern const struct linux_logo logo_linux_clut224; 38extern const struct linux_logo logo_linux_clut224;
38extern const struct linux_logo logo_blackfin_vga16; 39extern const struct linux_logo logo_blackfin_vga16;
39extern const struct linux_logo logo_blackfin_clut224; 40extern const struct linux_logo logo_blackfin_clut224;
diff --git a/include/linux/memcopy.h b/include/linux/memcopy.h
new file mode 100644
index 00000000000..a7b157391fd
--- /dev/null
+++ b/include/linux/memcopy.h
@@ -0,0 +1,226 @@
1/*
2 * memcopy.h -- definitions for memory copy functions. Generic C version.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation; either version 2.1 of the License, or (at your option)
7 * any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
12 * Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
17 *
18 * The code is derived from the GNU C Library.
19 * Copyright (C) 1991, 1992, 1993, 1997, 2004 Free Software Foundation, Inc.
20 */
21#ifndef _LINUX_MEMCOPY_H_
22#define _LINUX_MEMCOPY_H_
23
24/*
25 * The strategy of the memory functions is:
26 *
27 * 1. Copy bytes until the destination pointer is aligned.
28 *
29 * 2. Copy words in unrolled loops. If the source and destination
30 * are not aligned in the same way, use word memory operations,
31 * but shift and merge two read words before writing.
32 *
33 * 3. Copy the few remaining bytes.
34 *
35 * This is fast on processors that have at least 10 registers for
36 * allocation by GCC, and that can access memory at reg+const in one
37 * instruction.
38 */
39
40#include <linux/types.h>
41#include <linux/compiler.h>
42#include <asm/byteorder.h>
43
44/*
45 * The macros defined in this file are:
46 *
47 * BYTE_COPY_FWD(dst_beg_ptr, src_beg_ptr, nbytes_to_copy)
48 *
49 * BYTE_COPY_BWD(dst_end_ptr, src_end_ptr, nbytes_to_copy)
50 *
51 * WORD_COPY_FWD(dst_beg_ptr, src_beg_ptr, nbytes_remaining, nbytes_to_copy)
52 *
53 * WORD_COPY_BWD(dst_end_ptr, src_end_ptr, nbytes_remaining, nbytes_to_copy)
54 *
55 * MERGE(old_word, sh_1, new_word, sh_2)
56 *
57 * MEM_COPY_FWD(dst_beg_ptr, src_beg_ptr, nbytes_to_copy)
58 *
59 * MEM_COPY_BWD(dst_end_ptr, src_end_ptr, nbytes_to_copy)
60 */
61
62#define OP_T_THRESHOLD 16
63
64/*
65 * Type to use for aligned memory operations.
66 * This should normally be the biggest type supported by a single load
67 * and store.
68 */
69#define op_t unsigned long int
70#define OPSIZ (sizeof(op_t))
71
72/* Type to use for unaligned operations. */
73typedef unsigned char byte;
74
75#ifndef MERGE
76# ifdef __LITTLE_ENDIAN
77# define MERGE(w0, sh_1, w1, sh_2) (((w0) >> (sh_1)) | ((w1) << (sh_2)))
78# elif defined(__BIG_ENDIAN)
79# define MERGE(w0, sh_1, w1, sh_2) (((w0) << (sh_1)) | ((w1) >> (sh_2)))
80# else
81# error "Macro MERGE() hasn't defined!"
82# endif
83#endif
84
85/*
86 * Copy exactly NBYTES bytes from SRC_BP to DST_BP,
87 * without any assumptions about alignment of the pointers.
88 */
89#ifndef BYTE_COPY_FWD
90#define BYTE_COPY_FWD(dst_bp, src_bp, nbytes) \
91do { \
92 size_t __nbytes = (nbytes); \
93 while (__nbytes > 0) { \
94 byte __x = ((byte *) src_bp)[0]; \
95 src_bp += 1; \
96 __nbytes -= 1; \
97 ((byte *) dst_bp)[0] = __x; \
98 dst_bp += 1; \
99 } \
100} while (0)
101#endif
102
103/*
104 * Copy exactly NBYTES_TO_COPY bytes from SRC_END_PTR to DST_END_PTR,
105 * beginning at the bytes right before the pointers and continuing towards
106 * smaller addresses. Don't assume anything about alignment of the
107 * pointers.
108 */
109#ifndef BYTE_COPY_BWD
110#define BYTE_COPY_BWD(dst_ep, src_ep, nbytes) \
111do { \
112 size_t __nbytes = (nbytes); \
113 while (__nbytes > 0) { \
114 byte __x; \
115 src_ep -= 1; \
116 __x = ((byte *) src_ep)[0]; \
117 dst_ep -= 1; \
118 __nbytes -= 1; \
119 ((byte *) dst_ep)[0] = __x; \
120 } \
121} while (0)
122#endif
123/*
124 * Copy *up to* NBYTES bytes from SRC_BP to DST_BP, with
125 * the assumption that DST_BP is aligned on an OPSIZ multiple. If
126 * not all bytes could be easily copied, store remaining number of bytes
127 * in NBYTES_LEFT, otherwise store 0.
128 */
129extern void _wordcopy_fwd_aligned(long int, long int, size_t);
130extern void _wordcopy_fwd_dest_aligned(long int, long int, size_t);
131#ifndef WORD_COPY_FWD
132#define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \
133do { \
134 if (src_bp % OPSIZ == 0) \
135 _wordcopy_fwd_aligned (dst_bp, src_bp, (nbytes) / OPSIZ); \
136 else \
137 _wordcopy_fwd_dest_aligned (dst_bp, src_bp, (nbytes) / OPSIZ);\
138 \
139 src_bp += (nbytes) & -OPSIZ; \
140 dst_bp += (nbytes) & -OPSIZ; \
141 (nbytes_left) = (nbytes) % OPSIZ; \
142} while (0)
143#endif
144
145/*
146 * Copy *up to* NBYTES_TO_COPY bytes from SRC_END_PTR to DST_END_PTR,
147 * beginning at the words (of type op_t) right before the pointers and
148 * continuing towards smaller addresses. May take advantage of that
149 * DST_END_PTR is aligned on an OPSIZ multiple. If not all bytes could be
150 * easily copied, store remaining number of bytes in NBYTES_REMAINING,
151 * otherwise store 0.
152 */
153extern void _wordcopy_bwd_aligned(long int, long int, size_t);
154extern void _wordcopy_bwd_dest_aligned(long int, long int, size_t);
155#ifndef WORD_COPY_BWD
156#define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes) \
157do { \
158 if (src_ep % OPSIZ == 0) \
159 _wordcopy_bwd_aligned (dst_ep, src_ep, (nbytes) / OPSIZ); \
160 else \
161 _wordcopy_bwd_dest_aligned (dst_ep, src_ep, (nbytes) / OPSIZ);\
162 \
163 src_ep -= (nbytes) & -OPSIZ; \
164 dst_ep -= (nbytes) & -OPSIZ; \
165 (nbytes_left) = (nbytes) % OPSIZ; \
166} while (0)
167#endif
168
169/* Copy memory from the beginning to the end */
170#ifndef MEM_COPY_FWD
171static __always_inline void mem_copy_fwd(unsigned long dstp,
172 unsigned long srcp,
173 size_t count)
174{
175 /* If there not too few bytes to copy, use word copy. */
176 if (count >= OP_T_THRESHOLD) {
177 /* Copy just a few bytes to make dstp aligned. */
178 count -= (-dstp) % OPSIZ;
179 BYTE_COPY_FWD(dstp, srcp, (-dstp) % OPSIZ);
180
181 /*
182 * Copy from srcp to dstp taking advantage of the known
183 * alignment of dstp. Number if bytes remaining is put in
184 * the third argument.
185 */
186 WORD_COPY_FWD(dstp, srcp, count, count);
187
188 /* Fall out and copy the tail. */
189 }
190
191 /* There are just a few bytes to copy. Use byte memory operations. */
192 BYTE_COPY_FWD(dstp, srcp, count);
193}
194#endif
195
196/* Copy memory from the end to the beginning. */
197#ifndef MEM_COPY_BWD
198static __always_inline void mem_copy_bwd(unsigned long dstp,
199 unsigned long srcp,
200 size_t count)
201{
202 srcp += count;
203 dstp += count;
204
205 /* If there not too few bytes to copy, use word copy. */
206 if (count >= OP_T_THRESHOLD) {
207 /* Copy just a few bytes to make dstp aligned. */
208 count -= dstp % OPSIZ;
209 BYTE_COPY_BWD(dstp, srcp, dstp % OPSIZ);
210
211 /*
212 * Copy from srcp to dstp taking advantage of the known
213 * alignment of dstp. Number if bytes remaining is put in
214 * the third argument.
215 */
216 WORD_COPY_BWD(dstp, srcp, count, count);
217
218 /* Fall out and copy the tail. */
219 }
220
221 /* There are just a few bytes to copy. Use byte memory operations. */
222 BYTE_COPY_BWD (dstp, srcp, count);
223}
224#endif
225
226#endif
diff --git a/include/linux/mfd/max77686-private.h b/include/linux/mfd/max77686-private.h
new file mode 100644
index 00000000000..33d2c8240fa
--- /dev/null
+++ b/include/linux/mfd/max77686-private.h
@@ -0,0 +1,237 @@
1/*
2 * max77686.h - Voltage regulator driver for the Maxim 77686
3 *
4 * Copyright (C) 2010 Samsung Electrnoics
5 * MyungJoo Ham <myungjoo.ham@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef __LINUX_MFD_MAX77686_PRIV_H
23#define __LINUX_MFD_MAX77686_PRIV_H
24
25#include <linux/i2c.h>
26
27#define MAX77686_REG_INVALID (0xff)
28
29enum max77686_pmic_reg {
30 MAX77686_REG_DEVICE_ID = 0x00,
31 MAX77686_REG_INTSRC = 0x01,
32 MAX77686_REG_INT1 = 0x02,
33 MAX77686_REG_INT2 = 0x03,
34 MAX77686_REG_INT1MSK = 0x04,
35 MAX77686_REG_INT2MSK = 0x05,
36
37 MAX77686_REG_STATUS1 = 0x06,
38 MAX77686_REG_STATUS2 = 0x07,
39
40 MAX77686_REG_PWRON = 0x08,
41 MAX77686_REG_ONOFFDELAY = 0x09,
42 MAX77686_REG_MRSTB = 0x0a,
43
44 MAX77686_REG_BUCK1CTRL = 0x10,
45 MAX77686_REG_BUCK1OUT = 0x11,
46
47 MAX77686_REG_BUCK2CTRL1 = 0x12,
48 MAX77686_REG_BUCK234FREQ= 0x13,
49 MAX77686_REG_BUCK2DVS1 = 0x14,
50 MAX77686_REG_BUCK2DVS2 = 0x15,
51 MAX77686_REG_BUCK2DVS3 = 0x16,
52 MAX77686_REG_BUCK2DVS4 = 0x17,
53 MAX77686_REG_BUCK2DVS5 = 0x18,
54 MAX77686_REG_BUCK2DVS6 = 0x19,
55 MAX77686_REG_BUCK2DVS7 = 0x1a,
56 MAX77686_REG_BUCK2DVS8 = 0x1b,
57
58 MAX77686_REG_BUCK3CTRL1 = 0x1c,
59 MAX77686_REG_BUCK3DVS1 = 0x1e,
60 MAX77686_REG_BUCK3DVS2 = 0x1f,
61 MAX77686_REG_BUCK3DVS3 = 0x20,
62 MAX77686_REG_BUCK3DVS4 = 0x21,
63 MAX77686_REG_BUCK3DVS5 = 0x22,
64 MAX77686_REG_BUCK3DVS6 = 0x23,
65 MAX77686_REG_BUCK3DVS7 = 0x24,
66 MAX77686_REG_BUCK3DVS8 = 0x25,
67
68 MAX77686_REG_BUCK4CTRL1 = 0x26,
69 MAX77686_REG_BUCK4DVS1 = 0x28,
70 MAX77686_REG_BUCK4DVS2 = 0x29,
71 MAX77686_REG_BUCK4DVS3 = 0x2a,
72 MAX77686_REG_BUCK4DVS4 = 0x2b,
73 MAX77686_REG_BUCK4DVS5 = 0x2c,
74 MAX77686_REG_BUCK4DVS6 = 0x2d,
75 MAX77686_REG_BUCK4DVS7 = 0x2e,
76 MAX77686_REG_BUCK4DVS8 = 0x2f,
77
78 MAX77686_REG_BUCK5CTRL = 0x30,
79 MAX77686_REG_BUCK5OUT = 0x31,
80 MAX77686_REG_BUCK6CTRL = 0x32,
81 MAX77686_REG_BUCK6OUT = 0x33,
82 MAX77686_REG_BUCK7CTRL = 0x34,
83 MAX77686_REG_BUCK7OUT = 0x35,
84 MAX77686_REG_BUCK8CTRL = 0x36,
85 MAX77686_REG_BUCK8OUT = 0x37,
86 MAX77686_REG_BUCK9CTRL = 0x38,
87 MAX77686_REG_BUCK9OUT = 0x39,
88
89 MAX77686_REG_LDO1CTRL1 = 0x40,
90 MAX77686_REG_LDO2CTRL1 = 0x41,
91 MAX77686_REG_LDO3CTRL1 = 0x42,
92 MAX77686_REG_LDO4CTRL1 = 0x43,
93 MAX77686_REG_LDO5CTRL1 = 0x44,
94 MAX77686_REG_LDO6CTRL1 = 0x45,
95 MAX77686_REG_LDO7CTRL1 = 0x46,
96 MAX77686_REG_LDO8CTRL1 = 0x47,
97 MAX77686_REG_LDO9CTRL1 = 0x48,
98 MAX77686_REG_LDO10CTRL1 = 0x49,
99 MAX77686_REG_LDO11CTRL1 = 0x4a,
100 MAX77686_REG_LDO12CTRL1 = 0x4b,
101 MAX77686_REG_LDO13CTRL1 = 0x4c,
102 MAX77686_REG_LDO14CTRL1 = 0x4d,
103 MAX77686_REG_LDO15CTRL1 = 0x4e,
104 MAX77686_REG_LDO16CTRL1 = 0x4f,
105 MAX77686_REG_LDO17CTRL1 = 0x50,
106 MAX77686_REG_LDO18CTRL1 = 0x51,
107 MAX77686_REG_LDO19CTRL1 = 0x52,
108 MAX77686_REG_LDO20CTRL1 = 0x53,
109 MAX77686_REG_LDO21CTRL1 = 0x54,
110 MAX77686_REG_LDO22CTRL1 = 0x55,
111 MAX77686_REG_LDO23CTRL1 = 0x56,
112 MAX77686_REG_LDO24CTRL1 = 0x57,
113 MAX77686_REG_LDO25CTRL1 = 0x58,
114 MAX77686_REG_LDO26CTRL1 = 0x59,
115
116 MAX77686_REG_LDO1CTRL2 = 0x60,
117 MAX77686_REG_LDO2CTRL2 = 0x61,
118 MAX77686_REG_LDO3CTRL2 = 0x62,
119 MAX77686_REG_LDO4CTRL2 = 0x63,
120 MAX77686_REG_LDO5CTRL2 = 0x64,
121 MAX77686_REG_LDO6CTRL2 = 0x65,
122 MAX77686_REG_LDO7CTRL2 = 0x66,
123 MAX77686_REG_LDO8CTRL2 = 0x67,
124 MAX77686_REG_LDO9CTRL2 = 0x68,
125 MAX77686_REG_LDO10CTRL2 = 0x69,
126 MAX77686_REG_LDO11CTRL2 = 0x6a,
127 MAX77686_REG_LDO12CTRL2 = 0x6b,
128 MAX77686_REG_LDO13CTRL2 = 0x6c,
129 MAX77686_REG_LDO14CTRL2 = 0x6d,
130 MAX77686_REG_LDO15CTRL2 = 0x6e,
131 MAX77686_REG_LDO16CTRL2 = 0x6f,
132 MAX77686_REG_LDO17CTRL2 = 0x70,
133 MAX77686_REG_LDO18CTRL2 = 0x71,
134 MAX77686_REG_LDO19CTRL2 = 0x72,
135 MAX77686_REG_LDO20CTRL2 = 0x73,
136 MAX77686_REG_LDO21CTRL2 = 0x74,
137 MAX77686_REG_LDO22CTRL2 = 0x75,
138 MAX77686_REG_LDO23CTRL2 = 0x76,
139 MAX77686_REG_LDO24CTRL2 = 0x77,
140 MAX77686_REG_LDO25CTRL2 = 0x78,
141 MAX77686_REG_LDO26CTRL2 = 0x79,
142
143 MAX77686_REG_BBAT_CHARGER= 0x7e,
144 MAX77686_REG_32KHZ = 0x7f,
145
146 MAX77686_REG_PMIC_END = 0x80,
147};
148
149/* slave addr = 0x0c: using "2nd part" of rev4 datasheet */
150enum max77686_rtc_reg {
151 MAX77686_RTC_INT = 0x00,
152 MAX77686_RTC_INTM = 0x01,
153 MAX77686_RTC_RTCCNTLM = 0x02,
154 MAX77686_RTC_RTCCNTL = 0x03,
155 MAX77686_RTC_UPDATE0 = 0x04,
156
157 MAX77686_RTC_SMPL = 0x06,
158 MAX77686_RTC_SEC = 0x07,
159 MAX77686_RTC_MIN = 0x08,
160 MAX77686_RTC_HOUR = 0x09,
161 MAX77686_RTC_DOW = 0x0a,
162 MAX77686_RTC_MONTH = 0x0b,
163 MAX77686_RTC_YEAR = 0x0c,
164 MAX77686_RTC_DOM = 0x0d,
165
166 MAX77686_RTC_ALARM1_SEC = 0x0e,
167 MAX77686_RTC_ALARM1_MIN = 0x0f,
168 MAX77686_RTC_ALARM1_HOUR = 0x10,
169 MAX77686_RTC_ALARM1_DOW = 0x11,
170 MAX77686_RTC_ALARM1_MONTH = 0x12,
171 MAX77686_RTC_ALARM1_YEAR = 0x13,
172 MAX77686_RTC_ALARM1_DOM = 0x14,
173
174 MAX77686_RTC_ALARM2_SEC = 0x15,
175 MAX77686_RTC_ALARM2_MIN = 0x16,
176 MAX77686_RTC_ALARM2_HOUR = 0x17,
177 MAX77686_RTC_ALARM2_DOW = 0x18,
178 MAX77686_RTC_ALARM2_MONTH = 0x19,
179 MAX77686_RTC_ALARM2_YEAR = 0x1a,
180 MAX77686_RTC_ALARM2_DOM = 0x1b,
181
182};
183
184enum max77686_irq_source {
185 PMIC_INT1 = 0,
186 PMIC_INT2,
187 MAX77686_IRQ_GROUP_NR,
188};
189
190enum max77686_irq {
191 MAX77686_TOPSYSIRQ_PWRONF,
192 MAX77686_TOPSYSIRQ_PWRONR,
193 MAX77686_TOPSYSIRQ_JIGONF,
194 MAX77686_TOPSYSIRQ_JIGONR,
195 MAX77686_TOPSYSIRQ_ACOKBF,
196 MAX77686_TOPSYSIRQ_ACOKBR,
197 MAX77686_TOPSYSIRQ_ONKEY1S,
198 MAX77686_TOPSYSIRQ_MRSTB,
199
200 MAX77686_TOPSYSIRQ_120C,
201 MAX77686_TOPSYSIRQ_140C,
202 MAX77686_IRQ_NR,
203};
204
205#define MAX77686_NUM_GPIO 12
206struct max77686_dev {
207 struct device *dev;
208 struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */
209 struct i2c_client *rtc; /* slave addr 0x0c */
210 struct mutex iolock;
211
212 int type;
213 struct platform_device *battery; /* battery control (not fuel gauge) */
214
215 int irq;
216 int ono;
217 int irq_base;
218 struct mutex irqlock;
219 int irq_masks_cur[MAX77686_IRQ_GROUP_NR];
220 int irq_masks_cache[MAX77686_IRQ_GROUP_NR];
221
222 /* For hibernation */
223 u8 reg_dump[MAX77686_REG_PMIC_END];
224
225};
226
227extern int max77686_irq_init(struct max77686_dev *max77686);
228extern void max77686_irq_exit(struct max77686_dev *max77686);
229extern int max77686_irq_resume(struct max77686_dev *max77686);
230
231extern int max77686_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest);
232extern int max77686_bulk_read(struct i2c_client *i2c, u8 reg, int count, u8 *buf);
233extern int max77686_write_reg(struct i2c_client *i2c, u8 reg, u8 value);
234extern int max77686_bulk_write(struct i2c_client *i2c, u8 reg, int count, u8 *buf);
235extern int max77686_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask);
236
237#endif /* __LINUX_MFD_MAX77686_PRIV_H */
diff --git a/include/linux/mfd/max77686.h b/include/linux/mfd/max77686.h
new file mode 100644
index 00000000000..bf718541369
--- /dev/null
+++ b/include/linux/mfd/max77686.h
@@ -0,0 +1,117 @@
1/*
2 * max77686.h - Driver for the Maxim 77686
3 *
4 * Copyright (C) 2009-2010 Samsung Electrnoics
5 * MyungJoo Ham <myungjoo.ham@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 * This driver is based on max77686.h
22 *
23 * MAX77686 has PMIC, MUIC, HAPTIC, RTC, FLASH, and Fuel Gauge devices.
24 * Except Fuel Gauge, every device shares the same I2C bus and included in
25 * this mfd driver. Although the fuel gauge is included in the chip, it is
26 * excluded from the driver because a) it has a different I2C bus from
27 * others and b) it can be enabled simply by using MAX17042 driver.
28 */
29
30#ifndef __LINUX_MFD_MAX77686_H
31#define __LINUX_MFD_MAX77686_H
32
33#include <linux/regulator/consumer.h>
34
35/* MAX77686 regulator IDs */
36enum max77686_regulators {
37 MAX77686_LDO1 = 0,
38 MAX77686_LDO2,
39 MAX77686_LDO3,
40 MAX77686_LDO4,
41 MAX77686_LDO5,
42 MAX77686_LDO6,
43 MAX77686_LDO7,
44 MAX77686_LDO8,
45 MAX77686_LDO9,
46 MAX77686_LDO10,
47 MAX77686_LDO11,
48 MAX77686_LDO12,
49 MAX77686_LDO13,
50 MAX77686_LDO14,
51 MAX77686_LDO15,
52 MAX77686_LDO16,
53 MAX77686_LDO17,
54 MAX77686_LDO18,
55 MAX77686_LDO19,
56 MAX77686_LDO20,
57 MAX77686_LDO21,
58 MAX77686_LDO22,
59 MAX77686_LDO23,
60 MAX77686_LDO24,
61 MAX77686_LDO25,
62 MAX77686_LDO26,
63 MAX77686_BUCK1,
64 MAX77686_BUCK2,
65 MAX77686_BUCK3,
66 MAX77686_BUCK4,
67 MAX77686_BUCK5,
68 MAX77686_BUCK6,
69 MAX77686_BUCK7,
70 MAX77686_BUCK8,
71 MAX77686_BUCK9,
72
73 MAX77686_EN32KHZ_AP,
74 MAX77686_EN32KHZ_CP,
75
76 MAX77686_REG_MAX,
77};
78
79struct max77686_regulator_data {
80 int id;
81 struct regulator_init_data *initdata;
82};
83
84struct max77686_platform_data {
85 /* IRQ */
86 int irq_base;
87 int ono;
88 int wakeup;
89
90 /* ---- PMIC ---- */
91 struct max77686_regulator_data *regulators;
92 int num_regulators;
93
94 /*
95 * SET1~3 DVS GPIOs control Buck1, 2, and 5 simultaneously. Therefore,
96 * With buckx_gpiodvs enabled, the buckx cannot be controlled
97 * independently. To control buckx (of 1, 2, and 5) independently,
98 * disable buckx_gpiodvs and control with BUCKxDVS1 register.
99 *
100 * When buckx_gpiodvs and bucky_gpiodvs are both enabled, set_voltage
101 * on buckx will change the voltage of bucky at the same time.
102 *
103 */
104 bool ignore_gpiodvs_side_effect;
105 int buck234_gpios[3]; /* GPIO of [0]SET1, [1]SET2, [2]SET3 */
106 int buck234_default_idx; /* Default value of SET1, 2, 3 */
107 unsigned int buck2_voltage[8]; /* buckx_voltage in uV */
108 bool buck2_gpiodvs;
109 unsigned int buck3_voltage[8];
110 bool buck3_gpiodvs;
111 unsigned int buck4_voltage[8];
112 bool buck4_gpiodvs;
113
114 /* RTC: Not implemented */
115};
116
117#endif /* __LINUX_MFD_MAX77686_H */
diff --git a/include/linux/mfd/max8698-private.h b/include/linux/mfd/max8698-private.h
new file mode 100644
index 00000000000..332b04c25b2
--- /dev/null
+++ b/include/linux/mfd/max8698-private.h
@@ -0,0 +1,117 @@
1/*
2 * max8698.h - Voltage regulator driver for the Maxim 8698
3 *
4 * Copyright (C) 2009-2010 Samsung Electrnoics
5 * Kyungmin Park <kyungmin.park@samsung.com>
6 * Marek Szyprowski <m.szyprowski@samsung.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 * 2010.10.25
23 * Modified by Taekki Kim <taekki.kim@samsung.com>
24 */
25
26#ifndef __LINUX_MFD_MAX8698_PRIV_H
27#define __LINUX_MFD_MAX8698_PRIV_H
28
29/* MAX 8698 registers */
30enum {
31 MAX8698_REG_ONOFF1,
32 MAX8698_REG_ONOFF2,
33 MAX8698_REG_ADISCHG_EN1,
34 MAX8698_REG_ADISCHG_EN2,
35 MAX8698_REG_DVSARM12,
36 MAX8698_REG_DVSARM34,
37 MAX8698_REG_DVSINT12,
38 MAX8698_REG_BUCK3,
39 MAX8698_REG_LDO2_LDO3,
40 MAX8698_REG_LDO4,
41 MAX8698_REG_LDO5,
42 MAX8698_REG_LDO6,
43 MAX8698_REG_LDO7,
44 MAX8698_REG_LDO8_BKCHAR,
45 MAX8698_REG_LDO9,
46 MAX8698_REG_LBCNFG,
47};
48
49/* ONOFF1 */
50#define MAX8698_SHIFT_EN1 7
51#define MAX8698_SHIFT_EN2 6
52#define MAX8698_SHIFT_EN3 5
53#define MAX8698_SHIFT_ELDO2 4
54#define MAX8698_SHIFT_ELDO3 3
55#define MAX8698_SHIFT_ELDO4 2
56#define MAX8698_SHIFT_ELDO5 1
57
58#define MAX8698_MASK_EN1 (0x1 << MAX8698_SHIFT_EN1)
59#define MAX8698_MASK_EN2 (0x1 << MAX8698_SHIFT_EN2)
60#define MAX8698_MASK_EN3 (0x1 << MAX8698_SHIFT_EN3)
61#define MAX8698_MASK_ELDO2 (0x1 << MAX8698_SHIFT_ELDO2)
62#define MAX8698_MASK_ELDO3 (0x1 << MAX8698_SHIFT_ELDO3)
63#define MAX8698_MASK_ELDO4 (0x1 << MAX8698_SHIFT_ELDO4)
64#define MAX8698_MASK_ELDO5 (0x1 << MAX8698_SHIFT_ELDO5)
65
66/* ONOFF2 */
67#define MAX8698_SHIFT_ELDO6 7
68#define MAX8698_SHIFT_ELDO7 6
69#define MAX8698_SHIFT_ELDO8 5
70#define MAX8698_SHIFT_ELDO9 4
71#define MAX8698_SHIFT_ELBCNFG 0
72
73#define MAX8698_MASK_ELDO6 (0x1 << MAX8698_SHIFT_ELDO6)
74#define MAX8698_MASK_ELDO7 (0x1 << MAX8698_SHIFT_ELDO7)
75#define MAX8698_MASK_ELDO8 (0x1 << MAX8698_SHIFT_ELDO8)
76#define MAX8698_MASK_ELDO9 (0x1 << MAX8698_SHIFT_ELDO9)
77#define MAX8698_MASK_ELBCNFG (0x1 << MAX8698_SHIFT_ELBCNFG)
78
79
80/**
81 * struct max8698_dev - max8698 master device for sub-drivers
82 * @dev: master device of the chip (can be used to access platform data)
83 * @i2c_client: i2c client private data
84 * @dev_read(): chip register read function
85 * @dev_write(): chip register write function
86 * @dev_update(): chip register update function
87 * @iolock: mutex for serializing io access
88 */
89
90struct max8698_dev {
91 struct device *dev;
92 struct i2c_client *i2c_client;
93 int (*dev_read)(struct max8698_dev *max8698, u8 reg, u8 *dest);
94 int (*dev_write)(struct max8698_dev *max8698, u8 reg, u8 val);
95 int (*dev_update)(struct max8698_dev *max8698, u8 reg, u8 val, u8 mask);
96 struct mutex iolock;
97};
98
99static inline int max8698_read_reg(struct max8698_dev *max8698, u8 reg,
100 u8 *value)
101{
102 return max8698->dev_read(max8698, reg, value);
103}
104
105static inline int max8698_write_reg(struct max8698_dev *max8698, u8 reg,
106 u8 value)
107{
108 return max8698->dev_write(max8698, reg, value);
109}
110
111static inline int max8698_update_reg(struct max8698_dev *max8698, u8 reg,
112 u8 value, u8 mask)
113{
114 return max8698->dev_update(max8698, reg, value, mask);
115}
116
117#endif /* __LINUX_MFD_MAX8698_PRIV_H */
diff --git a/include/linux/mfd/max8698.h b/include/linux/mfd/max8698.h
new file mode 100644
index 00000000000..9a1b52a5e27
--- /dev/null
+++ b/include/linux/mfd/max8698.h
@@ -0,0 +1,78 @@
1/*
2 * max8698.h - Voltage regulator driver for the Maxim 8698
3 *
4 * Copyright (C) 2009-2010 Samsung Electrnoics
5 * Kyungmin Park <kyungmin.park@samsung.com>
6 * Marek Szyprowski <m.szyprowski@samsung.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 * 2010.10.25
23 * Modified by Taekki Kim <taekki.kim@samsung.com>
24 */
25
26#ifndef __LINUX_MFD_MAX8698_H
27#define __LINUX_MFD_MAX8698_H
28
29#include <linux/regulator/machine.h>
30
31/* MAX 8698 regulator ids */
32enum {
33 MAX8698_LDO1 = 1,
34 MAX8698_LDO2,
35 MAX8698_LDO3,
36 MAX8698_LDO4,
37 MAX8698_LDO5,
38 MAX8698_LDO6,
39 MAX8698_LDO7,
40 MAX8698_LDO8,
41 MAX8698_LDO9,
42 MAX8698_BUCK1,
43 MAX8698_BUCK2,
44 MAX8698_BUCK3,
45};
46
47/**
48 * max8698_regulator_data - regulator data
49 * @id: regulator id
50 * @initdata: regulator init data (contraints, supplies, ...)
51 */
52struct max8698_regulator_data {
53 int id;
54 struct regulator_init_data *initdata;
55};
56
57/**
58 * struct max8698_board - packages regulator init data
59 * @num_regulators: number of regultors used
60 * @regulators: array of defined regulators
61 */
62
63struct max8698_platform_data {
64 int num_regulators;
65 struct max8698_regulator_data *regulators;
66
67 int dvsarm1;
68 int dvsarm2;
69 int dvsarm3;
70 int dvsarm4;
71 int dvsint1;
72 int dvsint2;
73 int set1;
74 int set2;
75 int set3;
76};
77
78#endif /* __LINUX_MFD_MAX8698_H */
diff --git a/include/linux/mfd/max8997-private.h b/include/linux/mfd/max8997-private.h
index 5ff2400ad46..3f4deb62d6b 100644
--- a/include/linux/mfd/max8997-private.h
+++ b/include/linux/mfd/max8997-private.h
@@ -326,7 +326,6 @@ struct max8997_dev {
326 int irq; 326 int irq;
327 int ono; 327 int ono;
328 int irq_base; 328 int irq_base;
329 bool wakeup;
330 struct mutex irqlock; 329 struct mutex irqlock;
331 int irq_masks_cur[MAX8997_IRQ_GROUP_NR]; 330 int irq_masks_cur[MAX8997_IRQ_GROUP_NR];
332 int irq_masks_cache[MAX8997_IRQ_GROUP_NR]; 331 int irq_masks_cache[MAX8997_IRQ_GROUP_NR];
diff --git a/include/linux/mfd/s5m87xx/s5m-core.h b/include/linux/mfd/s5m87xx/s5m-core.h
new file mode 100644
index 00000000000..797f7207905
--- /dev/null
+++ b/include/linux/mfd/s5m87xx/s5m-core.h
@@ -0,0 +1,377 @@
1/*
2 * s5m-core.h
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MFD_S5M_CORE_H
15#define __LINUX_MFD_S5M_CORE_H
16
17#define NUM_IRQ_REGS 4
18
19enum s5m_device_type {
20 S5M8751X,
21 S5M8763X,
22 S5M8767X,
23};
24
25/* S5M8767 registers */
26enum s5m8767_reg {
27 S5M8767_REG_ID,
28 S5M8767_REG_INT1,
29 S5M8767_REG_INT2,
30 S5M8767_REG_INT3,
31 S5M8767_REG_INT1M,
32 S5M8767_REG_INT2M,
33 S5M8767_REG_INT3M,
34 S5M8767_REG_STATUS1,
35 S5M8767_REG_STATUS2,
36 S5M8767_REG_STATUS3,
37 S5M8767_REG_CTRL1,
38 S5M8767_REG_CTRL2,
39 S5M8767_REG_LOWBAT1,
40 S5M8767_REG_LOWBAT2,
41 S5M8767_REG_BUCHG,
42 S5M8767_REG_DVSRAMP,
43 S5M8767_REG_DVSTIMER2 = 0x10,
44 S5M8767_REG_DVSTIMER3,
45 S5M8767_REG_DVSTIMER4,
46 S5M8767_REG_LDO1,
47 S5M8767_REG_LDO2,
48 S5M8767_REG_LDO3,
49 S5M8767_REG_LDO4,
50 S5M8767_REG_LDO5,
51 S5M8767_REG_LDO6,
52 S5M8767_REG_LDO7,
53 S5M8767_REG_LDO8,
54 S5M8767_REG_LDO9,
55 S5M8767_REG_LDO10,
56 S5M8767_REG_LDO11,
57 S5M8767_REG_LDO12,
58 S5M8767_REG_LDO13,
59 S5M8767_REG_LDO14 = 0x20,
60 S5M8767_REG_LDO15,
61 S5M8767_REG_LDO16,
62 S5M8767_REG_LDO17,
63 S5M8767_REG_LDO18,
64 S5M8767_REG_LDO19,
65 S5M8767_REG_LDO20,
66 S5M8767_REG_LDO21,
67 S5M8767_REG_LDO22,
68 S5M8767_REG_LDO23,
69 S5M8767_REG_LDO24,
70 S5M8767_REG_LDO25,
71 S5M8767_REG_LDO26,
72 S5M8767_REG_LDO27,
73 S5M8767_REG_LDO28,
74 S5M8767_REG_UVLO = 0x31,
75 S5M8767_REG_BUCK1CTRL1,
76 S5M8767_REG_BUCK1CTRL2,
77 S5M8767_REG_BUCK2CTRL,
78 S5M8767_REG_BUCK2DVS1,
79 S5M8767_REG_BUCK2DVS2,
80 S5M8767_REG_BUCK2DVS3,
81 S5M8767_REG_BUCK2DVS4,
82 S5M8767_REG_BUCK2DVS5,
83 S5M8767_REG_BUCK2DVS6,
84 S5M8767_REG_BUCK2DVS7,
85 S5M8767_REG_BUCK2DVS8,
86 S5M8767_REG_BUCK3CTRL,
87 S5M8767_REG_BUCK3DVS1,
88 S5M8767_REG_BUCK3DVS2,
89 S5M8767_REG_BUCK3DVS3,
90 S5M8767_REG_BUCK3DVS4,
91 S5M8767_REG_BUCK3DVS5,
92 S5M8767_REG_BUCK3DVS6,
93 S5M8767_REG_BUCK3DVS7,
94 S5M8767_REG_BUCK3DVS8,
95 S5M8767_REG_BUCK4CTRL,
96 S5M8767_REG_BUCK4DVS1,
97 S5M8767_REG_BUCK4DVS2,
98 S5M8767_REG_BUCK4DVS3,
99 S5M8767_REG_BUCK4DVS4,
100 S5M8767_REG_BUCK4DVS5,
101 S5M8767_REG_BUCK4DVS6,
102 S5M8767_REG_BUCK4DVS7,
103 S5M8767_REG_BUCK4DVS8,
104 S5M8767_REG_BUCK5CTRL1,
105 S5M8767_REG_BUCK5CTRL2,
106 S5M8767_REG_BUCK5CTRL3,
107 S5M8767_REG_BUCK5CTRL4,
108 S5M8767_REG_BUCK5CTRL5,
109 S5M8767_REG_BUCK6CTRL1,
110 S5M8767_REG_BUCK6CTRL2,
111 S5M8767_REG_BUCK7CTRL1,
112 S5M8767_REG_BUCK7CTRL2,
113 S5M8767_REG_BUCK8CTRL1,
114 S5M8767_REG_BUCK8CTRL2,
115 S5M8767_REG_BUCK9CTRL1,
116 S5M8767_REG_BUCK9CTRL2,
117 S5M8767_REG_LDO1CTRL,
118 S5M8767_REG_LDO2_1CTRL,
119 S5M8767_REG_LDO2_2CTRL,
120 S5M8767_REG_LDO2_3CTRL,
121 S5M8767_REG_LDO2_4CTRL,
122 S5M8767_REG_LDO3CTRL,
123 S5M8767_REG_LDO4CTRL,
124 S5M8767_REG_LDO5CTRL,
125 S5M8767_REG_LDO6CTRL,
126 S5M8767_REG_LDO7CTRL,
127 S5M8767_REG_LDO8CTRL,
128 S5M8767_REG_LDO9CTRL,
129 S5M8767_REG_LDO10CTRL,
130 S5M8767_REG_LDO11CTRL,
131 S5M8767_REG_LDO12CTRL,
132 S5M8767_REG_LDO13CTRL,
133 S5M8767_REG_LDO14CTRL,
134 S5M8767_REG_LDO15CTRL,
135 S5M8767_REG_LDO16CTRL,
136 S5M8767_REG_LDO17CTRL,
137 S5M8767_REG_LDO18CTRL,
138 S5M8767_REG_LDO19CTRL,
139 S5M8767_REG_LDO20CTRL,
140 S5M8767_REG_LDO21CTRL,
141 S5M8767_REG_LDO22CTRL,
142 S5M8767_REG_LDO23CTRL,
143 S5M8767_REG_LDO24CTRL,
144 S5M8767_REG_LDO25CTRL,
145 S5M8767_REG_LDO26CTRL,
146 S5M8767_REG_LDO27CTRL,
147 S5M8767_REG_LDO28CTRL,
148};
149
150/* S5M8763 registers */
151enum s5m8763_reg {
152 S5M8763_REG_IRQ1,
153 S5M8763_REG_IRQ2,
154 S5M8763_REG_IRQ3,
155 S5M8763_REG_IRQ4,
156 S5M8763_REG_IRQM1,
157 S5M8763_REG_IRQM2,
158 S5M8763_REG_IRQM3,
159 S5M8763_REG_IRQM4,
160 S5M8763_REG_STATUS1,
161 S5M8763_REG_STATUS2,
162 S5M8763_REG_STATUSM1,
163 S5M8763_REG_STATUSM2,
164 S5M8763_REG_CHGR1,
165 S5M8763_REG_CHGR2,
166 S5M8763_REG_LDO_ACTIVE_DISCHARGE1,
167 S5M8763_REG_LDO_ACTIVE_DISCHARGE2,
168 S5M8763_REG_BUCK_ACTIVE_DISCHARGE3,
169 S5M8763_REG_ONOFF1,
170 S5M8763_REG_ONOFF2,
171 S5M8763_REG_ONOFF3,
172 S5M8763_REG_ONOFF4,
173 S5M8763_REG_BUCK1_VOLTAGE1,
174 S5M8763_REG_BUCK1_VOLTAGE2,
175 S5M8763_REG_BUCK1_VOLTAGE3,
176 S5M8763_REG_BUCK1_VOLTAGE4,
177 S5M8763_REG_BUCK2_VOLTAGE1,
178 S5M8763_REG_BUCK2_VOLTAGE2,
179 S5M8763_REG_BUCK3,
180 S5M8763_REG_BUCK4,
181 S5M8763_REG_LDO1_LDO2,
182 S5M8763_REG_LDO3,
183 S5M8763_REG_LDO4,
184 S5M8763_REG_LDO5,
185 S5M8763_REG_LDO6,
186 S5M8763_REG_LDO7,
187 S5M8763_REG_LDO7_LDO8,
188 S5M8763_REG_LDO9_LDO10,
189 S5M8763_REG_LDO11,
190 S5M8763_REG_LDO12,
191 S5M8763_REG_LDO13,
192 S5M8763_REG_LDO14,
193 S5M8763_REG_LDO15,
194 S5M8763_REG_LDO16,
195 S5M8763_REG_BKCHR,
196 S5M8763_REG_LBCNFG1,
197 S5M8763_REG_LBCNFG2,
198};
199
200enum s5m8767_irq {
201 S5M8767_IRQ_PWRR,
202 S5M8767_IRQ_PWRF,
203 S5M8767_IRQ_PWR1S,
204 S5M8767_IRQ_JIGR,
205 S5M8767_IRQ_JIGF,
206 S5M8767_IRQ_LOWBAT2,
207 S5M8767_IRQ_LOWBAT1,
208
209 S5M8767_IRQ_MRB,
210 S5M8767_IRQ_DVSOK2,
211 S5M8767_IRQ_DVSOK3,
212 S5M8767_IRQ_DVSOK4,
213
214 S5M8767_IRQ_RTC60S,
215 S5M8767_IRQ_RTCA1,
216 S5M8767_IRQ_RTCA2,
217 S5M8767_IRQ_SMPL,
218 S5M8767_IRQ_RTC1S,
219 S5M8767_IRQ_WTSR,
220
221 S5M8767_IRQ_NR,
222};
223
224#define S5M8767_IRQ_PWRR_MASK (1 << 0)
225#define S5M8767_IRQ_PWRF_MASK (1 << 1)
226#define S5M8767_IRQ_PWR1S_MASK (1 << 3)
227#define S5M8767_IRQ_JIGR_MASK (1 << 4)
228#define S5M8767_IRQ_JIGF_MASK (1 << 5)
229#define S5M8767_IRQ_LOWBAT2_MASK (1 << 6)
230#define S5M8767_IRQ_LOWBAT1_MASK (1 << 7)
231
232#define S5M8767_IRQ_MRB_MASK (1 << 2)
233#define S5M8767_IRQ_DVSOK2_MASK (1 << 3)
234#define S5M8767_IRQ_DVSOK3_MASK (1 << 4)
235#define S5M8767_IRQ_DVSOK4_MASK (1 << 5)
236
237#define S5M8767_IRQ_RTC60S_MASK (1 << 0)
238#define S5M8767_IRQ_RTCA1_MASK (1 << 1)
239#define S5M8767_IRQ_RTCA2_MASK (1 << 2)
240#define S5M8767_IRQ_SMPL_MASK (1 << 3)
241#define S5M8767_IRQ_RTC1S_MASK (1 << 4)
242#define S5M8767_IRQ_WTSR_MASK (1 << 5)
243
244enum s5m8763_irq {
245 S5M8763_IRQ_DCINF,
246 S5M8763_IRQ_DCINR,
247 S5M8763_IRQ_JIGF,
248 S5M8763_IRQ_JIGR,
249 S5M8763_IRQ_PWRONF,
250 S5M8763_IRQ_PWRONR,
251
252 S5M8763_IRQ_WTSREVNT,
253 S5M8763_IRQ_SMPLEVNT,
254 S5M8763_IRQ_ALARM1,
255 S5M8763_IRQ_ALARM0,
256
257 S5M8763_IRQ_ONKEY1S,
258 S5M8763_IRQ_TOPOFFR,
259 S5M8763_IRQ_DCINOVPR,
260 S5M8763_IRQ_CHGRSTF,
261 S5M8763_IRQ_DONER,
262 S5M8763_IRQ_CHGFAULT,
263
264 S5M8763_IRQ_LOBAT1,
265 S5M8763_IRQ_LOBAT2,
266
267 S5M8763_IRQ_NR,
268};
269
270#define S5M8763_IRQ_DCINF_MASK (1 << 2)
271#define S5M8763_IRQ_DCINR_MASK (1 << 3)
272#define S5M8763_IRQ_JIGF_MASK (1 << 4)
273#define S5M8763_IRQ_JIGR_MASK (1 << 5)
274#define S5M8763_IRQ_PWRONF_MASK (1 << 6)
275#define S5M8763_IRQ_PWRONR_MASK (1 << 7)
276
277#define S5M8763_IRQ_WTSREVNT_MASK (1 << 0)
278#define S5M8763_IRQ_SMPLEVNT_MASK (1 << 1)
279#define S5M8763_IRQ_ALARM1_MASK (1 << 2)
280#define S5M8763_IRQ_ALARM0_MASK (1 << 3)
281
282#define S5M8763_IRQ_ONKEY1S_MASK (1 << 0)
283#define S5M8763_IRQ_TOPOFFR_MASK (1 << 2)
284#define S5M8763_IRQ_DCINOVPR_MASK (1 << 3)
285#define S5M8763_IRQ_CHGRSTF_MASK (1 << 4)
286#define S5M8763_IRQ_DONER_MASK (1 << 5)
287#define S5M8763_IRQ_CHGFAULT_MASK (1 << 7)
288
289#define S5M8763_IRQ_LOBAT1_MASK (1 << 0)
290#define S5M8763_IRQ_LOBAT2_MASK (1 << 1)
291
292#define S5M8763_ENRAMP (1 << 4)
293
294/**
295 * struct s5m87xx_dev - s5m87xx master device for sub-drivers
296 * @dev: master device of the chip (can be used to access platform data)
297 * @i2c: i2c client private data for regulator
298 * @rtc: i2c client private data for rtc
299 * @iolock: mutex for serializing io access
300 * @irqlock: mutex for buslock
301 * @irq_base: base IRQ number for s5m87xx, required for IRQs
302 * @irq: generic IRQ number for s5m87xx
303 * @ono: power onoff IRQ number for s5m87xx
304 * @irq_masks_cur: currently active value
305 * @irq_masks_cache: cached hardware value
306 * @type: indicate which s5m87xx "variant" is used
307 */
308struct s5m87xx_dev {
309 struct device *dev;
310 struct i2c_client *i2c;
311 struct i2c_client *rtc;
312 struct mutex iolock;
313 struct mutex irqlock;
314
315 int device_type;
316 int irq_base;
317 int irq;
318 int ono;
319 u8 irq_masks_cur[NUM_IRQ_REGS];
320 u8 irq_masks_cache[NUM_IRQ_REGS];
321 int type;
322 bool wakeup;
323 bool wtsr_smpl;
324};
325
326int s5m_irq_init(struct s5m87xx_dev *s5m87xx);
327void s5m_irq_exit(struct s5m87xx_dev *s5m87xx);
328int s5m_irq_resume(struct s5m87xx_dev *s5m87xx);
329
330extern int s5m_reg_read(struct i2c_client *i2c, u8 reg, u8 *dest);
331extern int s5m_bulk_read(struct i2c_client *i2c, u8 reg, int count, u8 *buf);
332extern int s5m_reg_write(struct i2c_client *i2c, u8 reg, u8 value);
333extern int s5m_bulk_write(struct i2c_client *i2c, u8 reg, int count, u8 *buf);
334extern int s5m_reg_update(struct i2c_client *i2c, u8 reg, u8 val, u8 mask);
335
336struct s5m_platform_data {
337 struct s5m_regulator_data *regulators;
338 struct s5m_opmode_data *opmode_data;
339
340 int device_type;
341 int num_regulators;
342
343 int irq_base;
344 int (*cfg_pmic_irq)(void);
345
346 int ono;
347 bool wakeup;
348 bool buck_voltage_lock;
349
350 int buck_gpios[3];
351 int buck2_voltage[8];
352 bool buck2_gpiodvs;
353 int buck3_voltage[8];
354 bool buck3_gpiodvs;
355 int buck4_voltage[8];
356 bool buck4_gpiodvs;
357
358 int buck_set1;
359 int buck_set2;
360 int buck_set3;
361 int buck2_enable;
362 int buck3_enable;
363 int buck4_enable;
364 int buck_default_idx;
365 int buck2_default_idx;
366 int buck3_default_idx;
367 int buck4_default_idx;
368
369 int buck_ramp_delay;
370 bool buck2_ramp_enable;
371 bool buck3_ramp_enable;
372 bool buck4_ramp_enable;
373
374 bool wtsr_smpl;
375};
376
377#endif /* __LINUX_MFD_S5M_CORE_H */
diff --git a/include/linux/mfd/s5m87xx/s5m-pmic.h b/include/linux/mfd/s5m87xx/s5m-pmic.h
new file mode 100644
index 00000000000..ba878df7c15
--- /dev/null
+++ b/include/linux/mfd/s5m87xx/s5m-pmic.h
@@ -0,0 +1,115 @@
1/* s5m87xx.h
2 *
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#ifndef __LINUX_MFD_S5M_PMIC_H
12#define __LINUX_MFD_S5M_PMIC_H
13
14#include <linux/regulator/machine.h>
15
16/* S5M8767 regulator ids */
17enum s5m8767_regulators {
18 S5M8767_LDO1,
19 S5M8767_LDO2,
20 S5M8767_LDO3,
21 S5M8767_LDO4,
22 S5M8767_LDO5,
23 S5M8767_LDO6,
24 S5M8767_LDO7,
25 S5M8767_LDO8,
26 S5M8767_LDO9,
27 S5M8767_LDO10,
28 S5M8767_LDO11,
29 S5M8767_LDO12,
30 S5M8767_LDO13,
31 S5M8767_LDO14,
32 S5M8767_LDO15,
33 S5M8767_LDO16,
34 S5M8767_LDO17,
35 S5M8767_LDO18,
36 S5M8767_LDO19,
37 S5M8767_LDO20,
38 S5M8767_LDO21,
39 S5M8767_LDO22,
40 S5M8767_LDO23,
41 S5M8767_LDO24,
42 S5M8767_LDO25,
43 S5M8767_LDO26,
44 S5M8767_LDO27,
45 S5M8767_LDO28,
46 S5M8767_BUCK1,
47 S5M8767_BUCK2,
48 S5M8767_BUCK3,
49 S5M8767_BUCK4,
50 S5M8767_BUCK5,
51 S5M8767_BUCK6,
52 S5M8767_BUCK7,
53 S5M8767_BUCK8,
54 S5M8767_BUCK9,
55 S5M8767_AP_EN32KHZ,
56 S5M8767_CP_EN32KHZ,
57 S5M8767_BT_EN32KHZ,
58
59 S5M8767_REG_MAX,
60};
61
62
63#define S5M8767_PMIC_EN_SHIFT 6
64
65/* S5M8763 regulator ids */
66enum s5m8763_regulators {
67 S5M8763_LDO1,
68 S5M8763_LDO2,
69 S5M8763_LDO3,
70 S5M8763_LDO4,
71 S5M8763_LDO5,
72 S5M8763_LDO6,
73 S5M8763_LDO7,
74 S5M8763_LDO8,
75 S5M8763_LDO9,
76 S5M8763_LDO10,
77 S5M8763_LDO11,
78 S5M8763_LDO12,
79 S5M8763_LDO13,
80 S5M8763_LDO14,
81 S5M8763_LDO15,
82 S5M8763_LDO16,
83 S5M8763_BUCK1,
84 S5M8763_BUCK2,
85 S5M8763_BUCK3,
86 S5M8763_BUCK4,
87 S5M8763_AP_EN32KHZ,
88 S5M8763_CP_EN32KHZ,
89 S5M8763_ENCHGVI,
90 S5M8763_ESAFEUSB1,
91 S5M8763_ESAFEUSB2,
92};
93
94/**
95 * s5m87xx_regulator_data - regulator data
96 * @id: regulator id
97 * @initdata: regulator init data (contraints, supplies, ...)
98 */
99struct s5m_regulator_data {
100 int id;
101 struct regulator_init_data *initdata;
102};
103
104struct s5m_opmode_data {
105 int id;
106 int mode;
107};
108
109enum s5m_opmode {
110 S5M_OPMODE_NORMAL,
111 S5M_OPMODE_LP,
112 S5M_OPMODE_STANDBY,
113};
114
115#endif /* __LINUX_MFD_S5M_PMIC_H */
diff --git a/include/linux/mfd/s5m87xx/s5m-rtc.h b/include/linux/mfd/s5m87xx/s5m-rtc.h
new file mode 100644
index 00000000000..a1caa971dcd
--- /dev/null
+++ b/include/linux/mfd/s5m87xx/s5m-rtc.h
@@ -0,0 +1,95 @@
1/*
2 * s5m-rtc.h
3 *
4 * Copyright (c) 2011 Samsung Electronics Co., Ltd
5 * http://www.samsung.com
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#ifndef __LINUX_MFD_S5M_RTC_H
15#define __LINUX_MFD_S5M_RTC_H
16
17enum s5m87xx_rtc_reg {
18 S5M87XX_RTC_SEC,
19 S5M87XX_RTC_MIN,
20 S5M87XX_RTC_HOUR,
21 S5M87XX_RTC_WEEKDAY,
22 S5M87XX_RTC_DATE,
23 S5M87XX_RTC_MONTH,
24 S5M87XX_RTC_YEAR1,
25 S5M87XX_RTC_YEAR2,
26 S5M87XX_ALARM0_SEC,
27 S5M87XX_ALARM0_MIN,
28 S5M87XX_ALARM0_HOUR,
29 S5M87XX_ALARM0_WEEKDAY,
30 S5M87XX_ALARM0_DATE,
31 S5M87XX_ALARM0_MONTH,
32 S5M87XX_ALARM0_YEAR1,
33 S5M87XX_ALARM0_YEAR2,
34 S5M87XX_ALARM1_SEC,
35 S5M87XX_ALARM1_MIN,
36 S5M87XX_ALARM1_HOUR,
37 S5M87XX_ALARM1_WEEKDAY,
38 S5M87XX_ALARM1_DATE,
39 S5M87XX_ALARM1_MONTH,
40 S5M87XX_ALARM1_YEAR1,
41 S5M87XX_ALARM1_YEAR2,
42 S5M87XX_ALARM0_CONF,
43 S5M87XX_ALARM1_CONF,
44 S5M87XX_RTC_STATUS,
45 S5M87XX_WTSR_SMPL_CNTL,
46 S5M87XX_RTC_UDR_CON,
47};
48
49#define RTC_I2C_ADDR (0x0C >> 1)
50
51#define HOUR_12 (1 << 7)
52#define HOUR_AMPM (1 << 6)
53#define HOUR_PM (1 << 5)
54#define ALARM0_STATUS (1 << 1)
55#define ALARM1_STATUS (1 << 2)
56#define UPDATE_AD (1 << 0)
57
58/* RTC Control Register */
59#define BCD_EN_SHIFT 0
60#define BCD_EN_MASK (1 << BCD_EN_SHIFT)
61#define MODEL24_SHIFT 1
62#define MODEL24_MASK (1 << MODEL24_SHIFT)
63/* RTC Update Register1 */
64#define RTC_UDR_SHIFT 0
65#define RTC_UDR_MASK (1 << RTC_UDR_SHIFT)
66#define RTC_TCON_SHIFT 1
67#define RTC_TCON_MASK (1 << RTC_TCON_SHIFT)
68#define RTC_TIME_EN_SHIFT 3
69#define RTC_TIME_EN_MASK (1 << RTC_TIME_EN_SHIFT)
70
71/* RTC Hour register */
72#define HOUR_PM_SHIFT 6
73#define HOUR_PM_MASK (1 << HOUR_PM_SHIFT)
74/* RTC Alarm Enable */
75#define ALARM_ENABLE_SHIFT 7
76#define ALARM_ENABLE_MASK (1 << ALARM_ENABLE_SHIFT)
77
78#define SMPL_ENABLE_SHIFT 7
79#define SMPL_ENABLE_MASK (1 << SMPL_ENABLE_SHIFT)
80
81#define WTSR_ENABLE_SHIFT 6
82#define WTSR_ENABLE_MASK (1 << WTSR_ENABLE_SHIFT)
83
84enum {
85 RTC_SEC = 0,
86 RTC_MIN,
87 RTC_HOUR,
88 RTC_WEEKDAY,
89 RTC_DATE,
90 RTC_MONTH,
91 RTC_YEAR1,
92 RTC_YEAR2,
93};
94
95#endif /* __LINUX_MFD_S5M_RTC_H */
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 18eea056b47..16b0785f367 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -870,6 +870,7 @@ extern bool skip_free_areas_node(unsigned int flags, int nid);
870 870
871int shmem_lock(struct file *file, int lock, struct user_struct *user); 871int shmem_lock(struct file *file, int lock, struct user_struct *user);
872struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags); 872struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
873void shmem_set_file(struct vm_area_struct *vma, struct file *file);
873int shmem_zero_setup(struct vm_area_struct *); 874int shmem_zero_setup(struct vm_area_struct *);
874 875
875extern int can_do_mlock(void); 876extern int can_do_mlock(void);
@@ -995,6 +996,9 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
995 struct page **pages); 996 struct page **pages);
996struct page *get_dump_page(unsigned long addr); 997struct page *get_dump_page(unsigned long addr);
997 998
999extern int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm,
1000 unsigned long address, unsigned int fault_flags);
1001
998extern int try_to_release_page(struct page * page, gfp_t gfp_mask); 1002extern int try_to_release_page(struct page * page, gfp_t gfp_mask);
999extern void do_invalidatepage(struct page *page, unsigned long offset); 1003extern void do_invalidatepage(struct page *page, unsigned long offset);
1000 1004
@@ -1468,7 +1472,7 @@ int write_one_page(struct page *page, int wait);
1468void task_dirty_inc(struct task_struct *tsk); 1472void task_dirty_inc(struct task_struct *tsk);
1469 1473
1470/* readahead.c */ 1474/* readahead.c */
1471#define VM_MAX_READAHEAD 128 /* kbytes */ 1475#define VM_MAX_READAHEAD 2048 /* kbytes */
1472#define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */ 1476#define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */
1473 1477
1474int force_page_cache_readahead(struct address_space *mapping, struct file *filp, 1478int force_page_cache_readahead(struct address_space *mapping, struct file *filp,
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 6ad43554ac0..6ca73e329bd 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -50,8 +50,16 @@ struct mmc_ext_csd {
50 u8 rel_sectors; 50 u8 rel_sectors;
51 u8 rel_param; 51 u8 rel_param;
52 u8 part_config; 52 u8 part_config;
53 u8 boot_part_prot;
54 u8 rst_n_function;
55 u8 cache_ctrl;
56 u8 max_packed_writes;
57 u8 max_packed_reads;
58 u8 packed_event_en;
53 unsigned int part_time; /* Units: ms */ 59 unsigned int part_time; /* Units: ms */
54 unsigned int sa_timeout; /* Units: 100ns */ 60 unsigned int sa_timeout; /* Units: 100ns */
61 unsigned int generic_cmd6_time; /* Units: 10ms */
62 unsigned int power_off_longtime; /* Units: ms */
55 unsigned int hs_max_dtr; 63 unsigned int hs_max_dtr;
56 unsigned int sectors; 64 unsigned int sectors;
57 unsigned int card_type; 65 unsigned int card_type;
@@ -64,10 +72,15 @@ struct mmc_ext_csd {
64 unsigned long long enhanced_area_offset; /* Units: Byte */ 72 unsigned long long enhanced_area_offset; /* Units: Byte */
65 unsigned int enhanced_area_size; /* Units: KB */ 73 unsigned int enhanced_area_size; /* Units: KB */
66 unsigned int boot_size; /* in bytes */ 74 unsigned int boot_size; /* in bytes */
75 unsigned int cache_size; /* Units: KB */
76 bool hpi_en; /* HPI enablebit */
77 bool hpi; /* HPI support bit */
78 unsigned int hpi_cmd; /* cmd used as HPI */
67 u8 raw_partition_support; /* 160 */ 79 u8 raw_partition_support; /* 160 */
68 u8 raw_erased_mem_count; /* 181 */ 80 u8 raw_erased_mem_count; /* 181 */
69 u8 raw_ext_csd_structure; /* 194 */ 81 u8 raw_ext_csd_structure; /* 194 */
70 u8 raw_card_type; /* 196 */ 82 u8 raw_card_type; /* 196 */
83 u8 out_of_int_time; /* 198 */
71 u8 raw_s_a_timeout; /* 217 */ 84 u8 raw_s_a_timeout; /* 217 */
72 u8 raw_hc_erase_gap_size; /* 221 */ 85 u8 raw_hc_erase_gap_size; /* 221 */
73 u8 raw_erase_timeout_mult; /* 223 */ 86 u8 raw_erase_timeout_mult; /* 223 */
@@ -77,6 +90,9 @@ struct mmc_ext_csd {
77 u8 raw_sec_feature_support;/* 231 */ 90 u8 raw_sec_feature_support;/* 231 */
78 u8 raw_trim_mult; /* 232 */ 91 u8 raw_trim_mult; /* 232 */
79 u8 raw_sectors[4]; /* 212 - 4 bytes */ 92 u8 raw_sectors[4]; /* 212 - 4 bytes */
93
94 unsigned int feature_support;
95#define MMC_DISCARD_FEATURE BIT(0) /* CMD38 feature */
80}; 96};
81 97
82struct sd_scr { 98struct sd_scr {
@@ -177,6 +193,8 @@ struct mmc_card {
177#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */ 193#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */
178#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */ 194#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */
179#define MMC_CARD_SDXC (1<<6) /* card is SDXC */ 195#define MMC_CARD_SDXC (1<<6) /* card is SDXC */
196#define MMC_CARD_REMOVED (1<<7) /* card has been removed */
197#define MMC_STATE_HIGHSPEED_200 (1<<8) /* card is in HS200 mode */
180 unsigned int quirks; /* card quirks */ 198 unsigned int quirks; /* card quirks */
181#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ 199#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
182#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ 200#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
@@ -189,6 +207,12 @@ struct mmc_card {
189#define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */ 207#define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */
190#define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */ 208#define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */
191 209
210 unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */
211#define MMC_NO_POWER_NOTIFICATION 0
212#define MMC_POWERED_ON 1
213#define MMC_POWEROFF_SHORT 2
214#define MMC_POWEROFF_LONG 3
215
192 unsigned int erase_size; /* erase size in sectors */ 216 unsigned int erase_size; /* erase size in sectors */
193 unsigned int erase_shift; /* if erase unit is power 2 */ 217 unsigned int erase_shift; /* if erase unit is power 2 */
194 unsigned int pref_erase; /* in sectors */ 218 unsigned int pref_erase; /* in sectors */
@@ -310,18 +334,24 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
310#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT) 334#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
311#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY) 335#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
312#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED) 336#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED)
337#define mmc_card_hs200(c) ((c)->state & MMC_STATE_HIGHSPEED_200)
313#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR) 338#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR)
314#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR) 339#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR)
315#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED) 340#define mmc_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
341#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
316#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC) 342#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC)
343#define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED))
317 344
318#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT) 345#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
319#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY) 346#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
320#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED) 347#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
348#define mmc_card_set_hs200(c) ((c)->state |= MMC_STATE_HIGHSPEED_200)
321#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR) 349#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
322#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR) 350#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR)
351#define mmc_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
323#define mmc_sd_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED) 352#define mmc_sd_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
324#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC) 353#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC)
354#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED)
325 355
326/* 356/*
327 * Quirk add/remove for MMC products. 357 * Quirk add/remove for MMC products.
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index b6718e549a5..3d055c36e6a 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -18,6 +18,8 @@ struct mmc_request;
18struct mmc_command { 18struct mmc_command {
19 u32 opcode; 19 u32 opcode;
20 u32 arg; 20 u32 arg;
21#define MMC_CMD23_ARG_REL_WR (1 << 31)
22#define MMC_CMD23_ARG_PACKED ((0 << 31) | (1 << 30))
21 u32 resp[4]; 23 u32 resp[4];
22 unsigned int flags; /* expected response type */ 24 unsigned int flags; /* expected response type */
23#define MMC_RSP_PRESENT (1 << 0) 25#define MMC_RSP_PRESENT (1 << 0)
@@ -117,6 +119,7 @@ struct mmc_data {
117 119
118 unsigned int sg_len; /* size of scatter list */ 120 unsigned int sg_len; /* size of scatter list */
119 struct scatterlist *sg; /* I/O scatter list */ 121 struct scatterlist *sg; /* I/O scatter list */
122 s32 host_cookie; /* host private data */
120}; 123};
121 124
122struct mmc_request { 125struct mmc_request {
@@ -125,23 +128,29 @@ struct mmc_request {
125 struct mmc_data *data; 128 struct mmc_data *data;
126 struct mmc_command *stop; 129 struct mmc_command *stop;
127 130
128 void *done_data; /* completion data */ 131 struct completion completion;
129 void (*done)(struct mmc_request *);/* completion function */ 132 void (*done)(struct mmc_request *);/* completion function */
130}; 133};
131 134
132struct mmc_host; 135struct mmc_host;
133struct mmc_card; 136struct mmc_card;
137struct mmc_async_req;
134 138
139extern struct mmc_async_req *mmc_start_req(struct mmc_host *,
140 struct mmc_async_req *, int *);
141extern int mmc_interrupt_hpi(struct mmc_card *);
135extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *); 142extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
136extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int); 143extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
137extern int mmc_app_cmd(struct mmc_host *, struct mmc_card *); 144extern int mmc_app_cmd(struct mmc_host *, struct mmc_card *);
138extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *, 145extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
139 struct mmc_command *, int); 146 struct mmc_command *, int);
140extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int); 147extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int);
148extern int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd);
141 149
142#define MMC_ERASE_ARG 0x00000000 150#define MMC_ERASE_ARG 0x00000000
143#define MMC_SECURE_ERASE_ARG 0x80000000 151#define MMC_SECURE_ERASE_ARG 0x80000000
144#define MMC_TRIM_ARG 0x00000001 152#define MMC_TRIM_ARG 0x00000001
153#define MMC_DISCARD_ARG 0x00000003
145#define MMC_SECURE_TRIM1_ARG 0x80000001 154#define MMC_SECURE_TRIM1_ARG 0x80000001
146#define MMC_SECURE_TRIM2_ARG 0x80008000 155#define MMC_SECURE_TRIM2_ARG 0x80008000
147 156
@@ -152,11 +161,17 @@ extern int mmc_erase(struct mmc_card *card, unsigned int from, unsigned int nr,
152 unsigned int arg); 161 unsigned int arg);
153extern int mmc_can_erase(struct mmc_card *card); 162extern int mmc_can_erase(struct mmc_card *card);
154extern int mmc_can_trim(struct mmc_card *card); 163extern int mmc_can_trim(struct mmc_card *card);
164extern int mmc_can_discard(struct mmc_card *card);
165extern int mmc_can_sanitize(struct mmc_card *card);
155extern int mmc_can_secure_erase_trim(struct mmc_card *card); 166extern int mmc_can_secure_erase_trim(struct mmc_card *card);
156extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from, 167extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from,
157 unsigned int nr); 168 unsigned int nr);
169extern unsigned int mmc_calc_max_discard(struct mmc_card *card);
158 170
159extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen); 171extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen);
172extern int mmc_hw_reset(struct mmc_host *host);
173extern int mmc_hw_reset_check(struct mmc_host *host);
174extern int mmc_can_reset(struct mmc_card *card);
160 175
161extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *); 176extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *);
162extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int); 177extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
@@ -166,6 +181,10 @@ extern void mmc_release_host(struct mmc_host *host);
166extern void mmc_do_release_host(struct mmc_host *host); 181extern void mmc_do_release_host(struct mmc_host *host);
167extern int mmc_try_claim_host(struct mmc_host *host); 182extern int mmc_try_claim_host(struct mmc_host *host);
168 183
184extern int mmc_flush_cache(struct mmc_card *);
185
186extern int mmc_detect_card_removed(struct mmc_host *host);
187
169/** 188/**
170 * mmc_claim_host - exclusively claim a host 189 * mmc_claim_host - exclusively claim a host
171 * @host: mmc host to claim 190 * @host: mmc host to claim
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index bdd7ceeb99e..99df3199ccb 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -14,6 +14,8 @@
14#ifndef _LINUX_MMC_DW_MMC_H_ 14#ifndef _LINUX_MMC_DW_MMC_H_
15#define _LINUX_MMC_DW_MMC_H_ 15#define _LINUX_MMC_DW_MMC_H_
16 16
17#include <linux/scatterlist.h>
18
17#define MAX_MCI_SLOTS 2 19#define MAX_MCI_SLOTS 2
18 20
19enum dw_mci_state { 21enum dw_mci_state {
@@ -35,6 +37,11 @@ enum {
35 37
36struct mmc_data; 38struct mmc_data;
37 39
40struct dw_mci_next {
41 unsigned int sg_len;
42 s32 cookie;
43};
44
38/** 45/**
39 * struct dw_mci - MMC controller state shared between all slots 46 * struct dw_mci - MMC controller state shared between all slots
40 * @lock: Spinlock protecting the queue and associated data. 47 * @lock: Spinlock protecting the queue and associated data.
@@ -74,6 +81,7 @@ struct mmc_data;
74 * @pdev: Platform device associated with the MMC controller. 81 * @pdev: Platform device associated with the MMC controller.
75 * @pdata: Platform data associated with the MMC controller. 82 * @pdata: Platform data associated with the MMC controller.
76 * @slot: Slots sharing this MMC controller. 83 * @slot: Slots sharing this MMC controller.
84 * @fifo_depth: depth of FIFO.
77 * @data_shift: log2 of FIFO item size. 85 * @data_shift: log2 of FIFO item size.
78 * @push_data: Pointer to FIFO push function. 86 * @push_data: Pointer to FIFO push function.
79 * @pull_data: Pointer to FIFO pull function. 87 * @pull_data: Pointer to FIFO pull function.
@@ -108,19 +116,24 @@ struct dw_mci {
108 void __iomem *regs; 116 void __iomem *regs;
109 117
110 struct scatterlist *sg; 118 struct scatterlist *sg;
111 unsigned int pio_offset; 119 struct sg_mapping_iter sg_miter;
112 120
113 struct dw_mci_slot *cur_slot; 121 struct dw_mci_slot *cur_slot;
114 struct mmc_request *mrq; 122 struct mmc_request *mrq;
115 struct mmc_command *cmd; 123 struct mmc_command *cmd;
116 struct mmc_data *data; 124 struct mmc_data *data;
125 struct clk *hclk;
126 struct clk *cclk;
127 bool prv_err;
117 128
118 /* DMA interface members*/ 129 /* DMA interface members*/
119 int use_dma; 130 int use_dma;
131 int using_dma;
120 132
121 dma_addr_t sg_dma; 133 dma_addr_t sg_dma;
122 void *sg_cpu; 134 void *sg_cpu;
123 struct dw_mci_dma_ops *dma_ops; 135 struct dw_mci_dma_ops *dma_ops;
136 unsigned int buf_size;
124#ifdef CONFIG_MMC_DW_IDMAC 137#ifdef CONFIG_MMC_DW_IDMAC
125 unsigned int ring_size; 138 unsigned int ring_size;
126#else 139#else
@@ -141,11 +154,14 @@ struct dw_mci {
141 u32 current_speed; 154 u32 current_speed;
142 u32 num_slots; 155 u32 num_slots;
143 u32 fifoth_val; 156 u32 fifoth_val;
157 u16 verid;
158 u16 data_offset;
144 struct platform_device *pdev; 159 struct platform_device *pdev;
145 struct dw_mci_board *pdata; 160 struct dw_mci_board *pdata;
146 struct dw_mci_slot *slot[MAX_MCI_SLOTS]; 161 struct dw_mci_slot *slot[MAX_MCI_SLOTS];
147 162
148 /* FIFO push and pull */ 163 /* FIFO push and pull */
164 int fifo_depth;
149 int data_shift; 165 int data_shift;
150 void (*push_data)(struct dw_mci *host, void *buf, int cnt); 166 void (*push_data)(struct dw_mci *host, void *buf, int cnt);
151 void (*pull_data)(struct dw_mci *host, void *buf, int cnt); 167 void (*pull_data)(struct dw_mci *host, void *buf, int cnt);
@@ -154,6 +170,7 @@ struct dw_mci {
154 u32 quirks; 170 u32 quirks;
155 171
156 struct regulator *vmmc; /* Power regulator */ 172 struct regulator *vmmc; /* Power regulator */
173 struct dw_mci_next next_data;
157}; 174};
158 175
159/* DMA ops for Internal/External DMAC interface */ 176/* DMA ops for Internal/External DMAC interface */
@@ -177,6 +194,13 @@ struct dw_mci_dma_ops {
177/* Unreliable card detection */ 194/* Unreliable card detection */
178#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3) 195#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3)
179 196
197enum dw_mci_cd_types {
198 DW_MCI_CD_INTERNAL, /* use mmc internal CD line */
199 DW_MCI_CD_EXTERNAL, /* use external callback */
200 DW_MCI_CD_GPIO, /* use external gpio pin for CD line */
201 DW_MCI_CD_NONE, /* no CD line, use polling to detect card */
202 DW_MCI_CD_PERMANENT, /* no CD line, card permanently wired to host */
203};
180 204
181struct dma_pdata; 205struct dma_pdata;
182 206
@@ -196,15 +220,49 @@ struct dw_mci_board {
196 unsigned int bus_hz; /* Bus speed */ 220 unsigned int bus_hz; /* Bus speed */
197 221
198 unsigned int caps; /* Capabilities */ 222 unsigned int caps; /* Capabilities */
223 unsigned int caps2; /* More capabilities */
224 /*
225 * Override fifo depth. If 0, autodetect it from the FIFOTH register,
226 * but note that this may not be reliable after a bootloader has used
227 * it.
228 */
229 unsigned int fifo_depth;
230
231 unsigned int buf_size; /* Buffer size */
199 232
200 /* delay in mS before detecting cards after interrupt */ 233 /* delay in mS before detecting cards after interrupt */
201 u32 detect_delay_ms; 234 u32 detect_delay_ms;
202 235
236 char *hclk_name;
237 char *cclk_name;
238
203 int (*init)(u32 slot_id, irq_handler_t , void *); 239 int (*init)(u32 slot_id, irq_handler_t , void *);
204 int (*get_ro)(u32 slot_id); 240 int (*get_ro)(u32 slot_id);
205 int (*get_cd)(u32 slot_id); 241 int (*get_cd)(u32 slot_id);
206 int (*get_ocr)(u32 slot_id); 242 int (*get_ocr)(u32 slot_id);
207 int (*get_bus_wd)(u32 slot_id); 243 int (*get_bus_wd)(u32 slot_id);
244 void (*cfg_gpio)(int width);
245 void (*set_io_timing)(void *data, unsigned char timing);
246
247 /* Phase Shift Value */
248 unsigned int sdr_timing;
249 unsigned int ddr_timing;
250
251 /* cd_type: Type of Card Detection method (see cd_types enum above) */
252
253 enum dw_mci_cd_types cd_type;
254
255 /* ext_cd_cleanup: Cleanup external card detect subsystem.
256 * ext_cd_init: Initialize external card detect subsystem.
257 * notify_func argument is a callback to the dwmci driver
258 * that triggers the card detection event. Callback arguments:
259 * dev is pointer to platform device of the host controller,
260 * state is new state of the card (0 - removed, 1 - inserted).
261 */
262
263 int (*ext_cd_init)(void (*notify_func)(struct platform_device *, int state));
264 int (*ext_cd_cleanup)(void (*notify_func)(struct platform_device *,int state));
265
208 /* 266 /*
209 * Enable power to selected slot and set voltage to desired level. 267 * Enable power to selected slot and set voltage to desired level.
210 * Voltage levels are specified using MMC_VDD_xxx defines defined 268 * Voltage levels are specified using MMC_VDD_xxx defines defined
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
index f8d1e741d80..56d81029b48 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -12,6 +12,7 @@
12 12
13#include <linux/leds.h> 13#include <linux/leds.h>
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/wakelock.h>
15 16
16#include <linux/mmc/core.h> 17#include <linux/mmc/core.h>
17#include <linux/mmc/pm.h> 18#include <linux/mmc/pm.h>
@@ -55,12 +56,15 @@ struct mmc_ios {
55#define MMC_TIMING_UHS_SDR50 3 56#define MMC_TIMING_UHS_SDR50 3
56#define MMC_TIMING_UHS_SDR104 4 57#define MMC_TIMING_UHS_SDR104 4
57#define MMC_TIMING_UHS_DDR50 5 58#define MMC_TIMING_UHS_DDR50 5
59#define MMC_TIMING_MMC_HS200 6
58 60
59 unsigned char ddr; /* dual data rate used */ 61 unsigned char ddr; /* dual data rate used */
60 62
61#define MMC_SDR_MODE 0 63#define MMC_SDR_MODE 0
62#define MMC_1_2V_DDR_MODE 1 64#define MMC_1_2V_DDR_MODE 1
63#define MMC_1_8V_DDR_MODE 2 65#define MMC_1_8V_DDR_MODE 2
66#define MMC_1_2V_SDR_MODE 3
67#define MMC_1_8V_SDR_MODE 4
64 68
65 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */ 69 unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */
66 70
@@ -106,6 +110,15 @@ struct mmc_host_ops {
106 */ 110 */
107 int (*enable)(struct mmc_host *host); 111 int (*enable)(struct mmc_host *host);
108 int (*disable)(struct mmc_host *host, int lazy); 112 int (*disable)(struct mmc_host *host, int lazy);
113 /*
114 * It is optional for the host to implement pre_req and post_req in
115 * order to support double buffering of requests (prepare one
116 * request while another request is active).
117 */
118 void (*post_req)(struct mmc_host *host, struct mmc_request *req,
119 int err);
120 void (*pre_req)(struct mmc_host *host, struct mmc_request *req,
121 bool is_first_req);
109 void (*request)(struct mmc_host *host, struct mmc_request *req); 122 void (*request)(struct mmc_host *host, struct mmc_request *req);
110 /* 123 /*
111 * Avoid calling these three functions too often or in a "fast path", 124 * Avoid calling these three functions too often or in a "fast path",
@@ -137,13 +150,27 @@ struct mmc_host_ops {
137 void (*init_card)(struct mmc_host *host, struct mmc_card *card); 150 void (*init_card)(struct mmc_host *host, struct mmc_card *card);
138 151
139 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios); 152 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios);
140 int (*execute_tuning)(struct mmc_host *host); 153
154 /* The tuning command opcode value is different for SD and eMMC cards */
155 int (*execute_tuning)(struct mmc_host *host, u32 opcode);
141 void (*enable_preset_value)(struct mmc_host *host, bool enable); 156 void (*enable_preset_value)(struct mmc_host *host, bool enable);
157 int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
158 void (*hw_reset)(struct mmc_host *host);
142}; 159};
143 160
144struct mmc_card; 161struct mmc_card;
145struct device; 162struct device;
146 163
164struct mmc_async_req {
165 /* active mmc request */
166 struct mmc_request *mrq;
167 /*
168 * Check error status of completed mmc request.
169 * Returns 0 if success otherwise non zero.
170 */
171 int (*err_check) (struct mmc_card *, struct mmc_async_req *);
172};
173
147struct mmc_host { 174struct mmc_host {
148 struct device *parent; 175 struct device *parent;
149 struct device class_dev; 176 struct device class_dev;
@@ -211,17 +238,40 @@ struct mmc_host {
211#define MMC_CAP_MAX_CURRENT_600 (1 << 28) /* Host max current limit is 600mA */ 238#define MMC_CAP_MAX_CURRENT_600 (1 << 28) /* Host max current limit is 600mA */
212#define MMC_CAP_MAX_CURRENT_800 (1 << 29) /* Host max current limit is 800mA */ 239#define MMC_CAP_MAX_CURRENT_800 (1 << 29) /* Host max current limit is 800mA */
213#define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */ 240#define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */
241#define MMC_CAP_HW_RESET (1 << 31) /* Hardware reset */
242
243 unsigned int caps2; /* More host capabilities */
244
245#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
246#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
247#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */
248#define MMC_CAP2_PACKED_RD (1 << 3) /* Allow packed read */
249#define MMC_CAP2_PACKED_WR (1 << 4) /* Allow packed write */
250#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
251 MMC_CAP2_PACKED_WR) /* Allow packed commands */
252#define MMC_CAP2_NO_MULTI_READ (1 << 5) /* Multiblock reads don't work */
253#define MMC_CAP2_NO_SLEEP_CMD (1 << 6) /* Don't allow sleep command */
254#define MMC_CAP2_HS200_1_8V_SDR (1 << 7) /* can support */
255#define MMC_CAP2_HS200_1_2V_SDR (1 << 8) /* can support */
256#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
257 MMC_CAP2_HS200_1_2V_SDR)
214 258
215 mmc_pm_flag_t pm_caps; /* supported pm features */ 259 mmc_pm_flag_t pm_caps; /* supported pm features */
260 unsigned int power_notify_type;
261#define MMC_HOST_PW_NOTIFY_NONE 0
262#define MMC_HOST_PW_NOTIFY_SHORT 1
263#define MMC_HOST_PW_NOTIFY_LONG 2
216 264
217#ifdef CONFIG_MMC_CLKGATE 265#ifdef CONFIG_MMC_CLKGATE
218 int clk_requests; /* internal reference counter */ 266 int clk_requests; /* internal reference counter */
219 unsigned int clk_delay; /* number of MCI clk hold cycles */ 267 unsigned int clk_delay; /* number of MCI clk hold cycles */
220 bool clk_gated; /* clock gated */ 268 bool clk_gated; /* clock gated */
221 struct work_struct clk_gate_work; /* delayed clock gate */ 269 struct delayed_work clk_gate_work; /* delayed clock gate */
222 unsigned int clk_old; /* old clock value cache */ 270 unsigned int clk_old; /* old clock value cache */
223 spinlock_t clk_lock; /* lock for clk fields */ 271 spinlock_t clk_lock; /* lock for clk fields */
224 struct mutex clk_gate_mutex; /* mutex for clock gating */ 272 struct mutex clk_gate_mutex; /* mutex for clock gating */
273 struct device_attribute clkgate_delay_attr;
274 unsigned long clkgate_delay;
225#endif 275#endif
226 276
227 /* host specific block data */ 277 /* host specific block data */
@@ -231,6 +281,7 @@ struct mmc_host {
231 unsigned int max_req_size; /* maximum number of bytes in one req */ 281 unsigned int max_req_size; /* maximum number of bytes in one req */
232 unsigned int max_blk_size; /* maximum size of one mmc block */ 282 unsigned int max_blk_size; /* maximum size of one mmc block */
233 unsigned int max_blk_count; /* maximum number of blocks in one req */ 283 unsigned int max_blk_count; /* maximum number of blocks in one req */
284 unsigned int max_discard_to; /* max. discard timeout in ms */
234 285
235 /* private data */ 286 /* private data */
236 spinlock_t lock; /* lock for claim and bus ops */ 287 spinlock_t lock; /* lock for claim and bus ops */
@@ -245,6 +296,22 @@ struct mmc_host {
245#ifdef CONFIG_MMC_DEBUG 296#ifdef CONFIG_MMC_DEBUG
246 unsigned int removed:1; /* host is being removed */ 297 unsigned int removed:1; /* host is being removed */
247#endif 298#endif
299 unsigned int state; /* card slot state for SD */
300#define MMC_SD_STATE_PRESENT (1<<0) /* present state for SD */
301#define MMC_SD_INIT_STATUS (1<<1) /* present state for SD */
302#define MMC_SD_PREV_STATUS (1<<2) /* present state for SD */
303
304#define mmc_host_sd_present(h) ((h)->state & MMC_SD_STATE_PRESENT)
305#define mmc_host_sd_set_present(h) ((h)->state |= MMC_SD_STATE_PRESENT)
306#define mmc_host_sd_clear_present(h) ((h)->state &= ~MMC_SD_STATE_PRESENT)
307
308#define mmc_host_sd_init_stat(h) ((h)->state & MMC_SD_INIT_STATUS)
309#define mmc_host_sd_set_init_stat(h) ((h)->state |= MMC_SD_INIT_STATUS)
310#define mmc_host_sd_clear_init_stat(h) ((h)->state &= ~MMC_SD_INIT_STATUS)
311
312#define mmc_host_sd_prev_stat(h) ((h)->state & MMC_SD_PREV_STATUS)
313#define mmc_host_sd_set_prev_stat(h) ((h)->state |= MMC_SD_PREV_STATUS)
314#define mmc_host_sd_clear_prev_stat(h) ((h)->state &= ~MMC_SD_PREV_STATUS)
248 315
249 /* Only used with MMC_CAP_DISABLE */ 316 /* Only used with MMC_CAP_DISABLE */
250 int enabled; /* host is enabled */ 317 int enabled; /* host is enabled */
@@ -261,10 +328,16 @@ struct mmc_host {
261 int claim_cnt; /* "claim" nesting count */ 328 int claim_cnt; /* "claim" nesting count */
262 329
263 struct delayed_work detect; 330 struct delayed_work detect;
331 int detect_change; /* card detect flag */
332 struct wake_lock detect_wake_lock;
264 333
265 const struct mmc_bus_ops *bus_ops; /* current bus driver */ 334 const struct mmc_bus_ops *bus_ops; /* current bus driver */
266 unsigned int bus_refs; /* reference counter */ 335 unsigned int bus_refs; /* reference counter */
267 336
337 unsigned int bus_resume_flags;
338#define MMC_BUSRESUME_MANUAL_RESUME (1 << 0)
339#define MMC_BUSRESUME_NEEDS_RESUME (1 << 1)
340
268 unsigned int sdio_irqs; 341 unsigned int sdio_irqs;
269 struct task_struct *sdio_irq_thread; 342 struct task_struct *sdio_irq_thread;
270 bool sdio_irq_pending; 343 bool sdio_irq_pending;
@@ -282,6 +355,17 @@ struct mmc_host {
282 355
283 struct dentry *debugfs_root; 356 struct dentry *debugfs_root;
284 357
358#ifdef CONFIG_MMC_EMBEDDED_SDIO
359 struct {
360 struct sdio_cis *cis;
361 struct sdio_cccr *cccr;
362 struct sdio_embedded_func *funcs;
363 int num_funcs;
364 } embedded_sdio_data;
365#endif
366
367 struct mmc_async_req *areq; /* active async req */
368
285 unsigned long private[0] ____cacheline_aligned; 369 unsigned long private[0] ____cacheline_aligned;
286}; 370};
287 371
@@ -290,6 +374,14 @@ extern int mmc_add_host(struct mmc_host *);
290extern void mmc_remove_host(struct mmc_host *); 374extern void mmc_remove_host(struct mmc_host *);
291extern void mmc_free_host(struct mmc_host *); 375extern void mmc_free_host(struct mmc_host *);
292 376
377#ifdef CONFIG_MMC_EMBEDDED_SDIO
378extern void mmc_set_embedded_sdio_data(struct mmc_host *host,
379 struct sdio_cis *cis,
380 struct sdio_cccr *cccr,
381 struct sdio_embedded_func *funcs,
382 int num_funcs);
383#endif
384
293static inline void *mmc_priv(struct mmc_host *host) 385static inline void *mmc_priv(struct mmc_host *host)
294{ 386{
295 return (void *)host->private; 387 return (void *)host->private;
@@ -300,6 +392,18 @@ static inline void *mmc_priv(struct mmc_host *host)
300#define mmc_dev(x) ((x)->parent) 392#define mmc_dev(x) ((x)->parent)
301#define mmc_classdev(x) (&(x)->class_dev) 393#define mmc_classdev(x) (&(x)->class_dev)
302#define mmc_hostname(x) (dev_name(&(x)->class_dev)) 394#define mmc_hostname(x) (dev_name(&(x)->class_dev))
395#define mmc_bus_needs_resume(host) ((host)->bus_resume_flags & MMC_BUSRESUME_NEEDS_RESUME)
396#define mmc_bus_manual_resume(host) ((host)->bus_resume_flags & MMC_BUSRESUME_MANUAL_RESUME)
397
398static inline void mmc_set_bus_resume_policy(struct mmc_host *host, int manual)
399{
400 if (manual)
401 host->bus_resume_flags |= MMC_BUSRESUME_MANUAL_RESUME;
402 else
403 host->bus_resume_flags &= ~MMC_BUSRESUME_MANUAL_RESUME;
404}
405
406extern int mmc_resume_bus(struct mmc_host *host);
303 407
304extern int mmc_suspend_host(struct mmc_host *); 408extern int mmc_suspend_host(struct mmc_host *);
305extern int mmc_resume_host(struct mmc_host *); 409extern int mmc_resume_host(struct mmc_host *);
@@ -310,6 +414,8 @@ extern int mmc_power_restore_host(struct mmc_host *host);
310extern void mmc_detect_change(struct mmc_host *, unsigned long delay); 414extern void mmc_detect_change(struct mmc_host *, unsigned long delay);
311extern void mmc_request_done(struct mmc_host *, struct mmc_request *); 415extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
312 416
417extern int mmc_cache_ctrl(struct mmc_host *, u8);
418
313static inline void mmc_signal_sdio_irq(struct mmc_host *host) 419static inline void mmc_signal_sdio_irq(struct mmc_host *host)
314{ 420{
315 host->ops->enable_sdio_irq(host, 0); 421 host->ops->enable_sdio_irq(host, 0);
@@ -375,5 +481,29 @@ static inline int mmc_host_cmd23(struct mmc_host *host)
375{ 481{
376 return host->caps & MMC_CAP_CMD23; 482 return host->caps & MMC_CAP_CMD23;
377} 483}
378#endif
379 484
485static inline int mmc_boot_partition_access(struct mmc_host *host)
486{
487 return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC);
488}
489
490#ifdef CONFIG_MMC_CLKGATE
491void mmc_host_clk_hold(struct mmc_host *host);
492void mmc_host_clk_release(struct mmc_host *host);
493unsigned int mmc_host_clk_rate(struct mmc_host *host);
494
495#else
496static inline void mmc_host_clk_hold(struct mmc_host *host)
497{
498}
499
500static inline void mmc_host_clk_release(struct mmc_host *host)
501{
502}
503
504static inline unsigned int mmc_host_clk_rate(struct mmc_host *host)
505{
506 return host->ios.clock;
507}
508#endif
509#endif /* LINUX_MMC_HOST_H */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index ac26a685cca..df020caf560 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -51,6 +51,7 @@
51#define MMC_READ_SINGLE_BLOCK 17 /* adtc [31:0] data addr R1 */ 51#define MMC_READ_SINGLE_BLOCK 17 /* adtc [31:0] data addr R1 */
52#define MMC_READ_MULTIPLE_BLOCK 18 /* adtc [31:0] data addr R1 */ 52#define MMC_READ_MULTIPLE_BLOCK 18 /* adtc [31:0] data addr R1 */
53#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */ 53#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */
54#define MMC_SEND_TUNING_BLOCK_HS200 21 /* adtc R1 */
54 55
55 /* class 3 */ 56 /* class 3 */
56#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */ 57#define MMC_WRITE_DAT_UNTIL_STOP 20 /* adtc [31:0] data addr R1 */
@@ -138,8 +139,19 @@ static inline bool mmc_op_multi(u32 opcode)
138#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */ 139#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
139#define R1_READY_FOR_DATA (1 << 8) /* sx, a */ 140#define R1_READY_FOR_DATA (1 << 8) /* sx, a */
140#define R1_SWITCH_ERROR (1 << 7) /* sx, c */ 141#define R1_SWITCH_ERROR (1 << 7) /* sx, c */
142#define R1_EXP_EVENT (1 << 6) /* sr, a */
141#define R1_APP_CMD (1 << 5) /* sr, c */ 143#define R1_APP_CMD (1 << 5) /* sr, c */
142 144
145#define R1_STATE_IDLE 0
146#define R1_STATE_READY 1
147#define R1_STATE_IDENT 2
148#define R1_STATE_STBY 3
149#define R1_STATE_TRAN 4
150#define R1_STATE_DATA 5
151#define R1_STATE_RCV 6
152#define R1_STATE_PRG 7
153#define R1_STATE_DIS 8
154
143/* 155/*
144 * MMC/SD in SPI mode reports R1 status always, and R2 for SEND_STATUS 156 * MMC/SD in SPI mode reports R1 status always, and R2 for SEND_STATUS
145 * R1 is the low order byte; R2 is the next highest byte, when present. 157 * R1 is the low order byte; R2 is the next highest byte, when present.
@@ -260,18 +272,35 @@ struct _mmc_csd {
260 * EXT_CSD fields 272 * EXT_CSD fields
261 */ 273 */
262 274
275#define EXT_CSD_FLUSH_CACHE 32 /* W */
276#define EXT_CSD_CACHE_CTRL 33 /* R/W */
277#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */
278#define EXT_CSD_PACKED_FAILURE_INDEX 35 /* RO */
279#define EXT_CSD_PACKED_CMD_STATUS 36 /* RO */
280#define EXT_CSD_EXP_EVENTS_STATUS 54 /* RO, 2 bytes */
281#define EXT_CSD_EXP_EVENTS_CTRL 56 /* R/W, 2 bytes */
263#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */ 282#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
264#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */ 283#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
284#define EXT_CSD_HPI_MGMT 161 /* R/W */
285#define EXT_CSD_RST_N_FUNCTION 162 /* R/W */
286#define EXT_CSD_SANITIZE_START 165 /* W */
265#define EXT_CSD_WR_REL_PARAM 166 /* RO */ 287#define EXT_CSD_WR_REL_PARAM 166 /* RO */
266#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */ 288#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
289#define EXT_CSD_BOOT_CONFIG_PROT 178 /* R/W */
267#define EXT_CSD_PART_CONFIG 179 /* R/W */ 290#define EXT_CSD_PART_CONFIG 179 /* R/W */
268#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */ 291#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */
269#define EXT_CSD_BUS_WIDTH 183 /* R/W */ 292#define EXT_CSD_BUS_WIDTH 183 /* R/W */
270#define EXT_CSD_HS_TIMING 185 /* R/W */ 293#define EXT_CSD_HS_TIMING 185 /* R/W */
294#define EXT_CSD_POWER_CLASS 187 /* R/W */
271#define EXT_CSD_REV 192 /* RO */ 295#define EXT_CSD_REV 192 /* RO */
272#define EXT_CSD_STRUCTURE 194 /* RO */ 296#define EXT_CSD_STRUCTURE 194 /* RO */
273#define EXT_CSD_CARD_TYPE 196 /* RO */ 297#define EXT_CSD_CARD_TYPE 196 /* RO */
298#define EXT_CSD_OUT_OF_INTERRUPT_TIME 198 /* RO */
274#define EXT_CSD_PART_SWITCH_TIME 199 /* RO */ 299#define EXT_CSD_PART_SWITCH_TIME 199 /* RO */
300#define EXT_CSD_PWR_CL_52_195 200 /* RO */
301#define EXT_CSD_PWR_CL_26_195 201 /* RO */
302#define EXT_CSD_PWR_CL_52_360 202 /* RO */
303#define EXT_CSD_PWR_CL_26_360 203 /* RO */
275#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ 304#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
276#define EXT_CSD_S_A_TIMEOUT 217 /* RO */ 305#define EXT_CSD_S_A_TIMEOUT 217 /* RO */
277#define EXT_CSD_REL_WR_SEC_C 222 /* RO */ 306#define EXT_CSD_REL_WR_SEC_C 222 /* RO */
@@ -283,6 +312,16 @@ struct _mmc_csd {
283#define EXT_CSD_SEC_ERASE_MULT 230 /* RO */ 312#define EXT_CSD_SEC_ERASE_MULT 230 /* RO */
284#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */ 313#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */
285#define EXT_CSD_TRIM_MULT 232 /* RO */ 314#define EXT_CSD_TRIM_MULT 232 /* RO */
315#define EXT_CSD_PWR_CL_200_195 236 /* RO */
316#define EXT_CSD_PWR_CL_200_360 237 /* RO */
317#define EXT_CSD_PWR_CL_DDR_52_195 238 /* RO */
318#define EXT_CSD_PWR_CL_DDR_52_360 239 /* RO */
319#define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */
320#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */
321#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */
322#define EXT_CSD_MAX_PACKED_WRITES 500 /* RO */
323#define EXT_CSD_MAX_PACKED_READS 501 /* RO */
324#define EXT_CSD_HPI_FEATURES 503 /* RO */
286 325
287/* 326/*
288 * EXT_CSD field definitions 327 * EXT_CSD field definitions
@@ -300,13 +339,76 @@ struct _mmc_csd {
300 339
301#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */ 340#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */
302#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */ 341#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */
303#define EXT_CSD_CARD_TYPE_MASK 0xF /* Mask out reserved bits */ 342#define EXT_CSD_CARD_TYPE_MASK 0x3F /* Mask out reserved bits */
304#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */ 343#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */
305 /* DDR mode @1.8V or 3V I/O */ 344 /* DDR mode @1.8V or 3V I/O */
306#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */ 345#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */
307 /* DDR mode @1.2V I/O */ 346 /* DDR mode @1.2V I/O */
308#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \ 347#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \
309 | EXT_CSD_CARD_TYPE_DDR_1_2V) 348 | EXT_CSD_CARD_TYPE_DDR_1_2V)
349#define EXT_CSD_CARD_TYPE_SDR_1_8V (1<<4) /* Card can run at 200MHz */
350#define EXT_CSD_CARD_TYPE_SDR_1_2V (1<<5) /* Card can run at 200MHz */
351 /* SDR mode @1.2V I/O */
352
353#define EXT_CSD_CARD_TYPE_SDR_200 (EXT_CSD_CARD_TYPE_SDR_1_8V | \
354 EXT_CSD_CARD_TYPE_SDR_1_2V)
355
356#define EXT_CSD_CARD_TYPE_SDR_ALL (EXT_CSD_CARD_TYPE_SDR_200 | \
357 EXT_CSD_CARD_TYPE_52 | \
358 EXT_CSD_CARD_TYPE_26)
359
360#define EXT_CSD_CARD_TYPE_SDR_1_2V_ALL (EXT_CSD_CARD_TYPE_SDR_1_2V | \
361 EXT_CSD_CARD_TYPE_52 | \
362 EXT_CSD_CARD_TYPE_26)
363
364#define EXT_CSD_CARD_TYPE_SDR_1_8V_ALL (EXT_CSD_CARD_TYPE_SDR_1_8V | \
365 EXT_CSD_CARD_TYPE_52 | \
366 EXT_CSD_CARD_TYPE_26)
367
368#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_1_2V | \
369 EXT_CSD_CARD_TYPE_DDR_1_8V | \
370 EXT_CSD_CARD_TYPE_52 | \
371 EXT_CSD_CARD_TYPE_26)
372
373#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_1_8V | \
374 EXT_CSD_CARD_TYPE_DDR_1_8V | \
375 EXT_CSD_CARD_TYPE_52 | \
376 EXT_CSD_CARD_TYPE_26)
377
378#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_1_2V | \
379 EXT_CSD_CARD_TYPE_DDR_1_2V | \
380 EXT_CSD_CARD_TYPE_52 | \
381 EXT_CSD_CARD_TYPE_26)
382
383#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_1_8V | \
384 EXT_CSD_CARD_TYPE_DDR_1_2V | \
385 EXT_CSD_CARD_TYPE_52 | \
386 EXT_CSD_CARD_TYPE_26)
387
388#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_52 (EXT_CSD_CARD_TYPE_SDR_1_2V | \
389 EXT_CSD_CARD_TYPE_DDR_52 | \
390 EXT_CSD_CARD_TYPE_52 | \
391 EXT_CSD_CARD_TYPE_26)
392
393#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_52 (EXT_CSD_CARD_TYPE_SDR_1_8V | \
394 EXT_CSD_CARD_TYPE_DDR_52 | \
395 EXT_CSD_CARD_TYPE_52 | \
396 EXT_CSD_CARD_TYPE_26)
397
398#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_200 | \
399 EXT_CSD_CARD_TYPE_DDR_1_8V | \
400 EXT_CSD_CARD_TYPE_52 | \
401 EXT_CSD_CARD_TYPE_26)
402
403#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_200 | \
404 EXT_CSD_CARD_TYPE_DDR_1_2V | \
405 EXT_CSD_CARD_TYPE_52 | \
406 EXT_CSD_CARD_TYPE_26)
407
408#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_52 (EXT_CSD_CARD_TYPE_SDR_200 | \
409 EXT_CSD_CARD_TYPE_DDR_52 | \
410 EXT_CSD_CARD_TYPE_52 | \
411 EXT_CSD_CARD_TYPE_26)
310 412
311#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */ 413#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
312#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */ 414#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
@@ -317,6 +419,27 @@ struct _mmc_csd {
317#define EXT_CSD_SEC_ER_EN BIT(0) 419#define EXT_CSD_SEC_ER_EN BIT(0)
318#define EXT_CSD_SEC_BD_BLK_EN BIT(2) 420#define EXT_CSD_SEC_BD_BLK_EN BIT(2)
319#define EXT_CSD_SEC_GB_CL_EN BIT(4) 421#define EXT_CSD_SEC_GB_CL_EN BIT(4)
422#define EXT_CSD_SEC_SANITIZE BIT(6) /* v4.5 only */
423
424#define EXT_CSD_RST_N_EN_MASK 0x3
425#define EXT_CSD_RST_N_ENABLED 1 /* RST_n is enabled on card */
426
427#define EXT_CSD_NO_POWER_NOTIFICATION 0
428#define EXT_CSD_POWER_ON 1
429#define EXT_CSD_POWER_OFF_SHORT 2
430#define EXT_CSD_POWER_OFF_LONG 3
431
432#define EXT_CSD_PWR_CL_8BIT_MASK 0xF0 /* 8 bit PWR CLS */
433#define EXT_CSD_PWR_CL_4BIT_MASK 0x0F /* 8 bit PWR CLS */
434#define EXT_CSD_PWR_CL_8BIT_SHIFT 4
435#define EXT_CSD_PWR_CL_4BIT_SHIFT 0
436
437#define EXT_CSD_PACKED_EVENT_EN (1 << 3)
438
439#define EXT_CSD_PACKED_FAILURE (1 << 3)
440
441#define EXT_CSD_PACKED_GENERIC_ERROR (1 << 0)
442#define EXT_CSD_PACKED_INDEXED_ERROR (1 << 1)
320 443
321/* 444/*
322 * MMC_SWITCH access modes 445 * MMC_SWITCH access modes
diff --git a/include/linux/mmc/pm.h b/include/linux/mmc/pm.h
index d37aac49cf9..66ac136c638 100644
--- a/include/linux/mmc/pm.h
+++ b/include/linux/mmc/pm.h
@@ -26,5 +26,9 @@ typedef unsigned int mmc_pm_flag_t;
26 26
27#define MMC_PM_KEEP_POWER (1 << 0) /* preserve card power during suspend */ 27#define MMC_PM_KEEP_POWER (1 << 0) /* preserve card power during suspend */
28#define MMC_PM_WAKE_SDIO_IRQ (1 << 1) /* wake up host system on SDIO IRQ assertion */ 28#define MMC_PM_WAKE_SDIO_IRQ (1 << 1) /* wake up host system on SDIO IRQ assertion */
29#define MMC_PM_IGNORE_PM_NOTIFY (1 << 2) /* ignore mmc pm notify */
30
31/* ignore mmc suspend.resume for BCM WIFI */
32#define MMC_PM_IGNORE_SUSPEND_RESUME (1 << 30)
29 33
30#endif 34#endif
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 6a68c4eb4e4..636c932166b 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -94,6 +94,7 @@ struct sdhci_host {
94 const struct sdhci_ops *ops; /* Low level hw interface */ 94 const struct sdhci_ops *ops; /* Low level hw interface */
95 95
96 struct regulator *vmmc; /* Power regulator */ 96 struct regulator *vmmc; /* Power regulator */
97 char *vmmc_name; /* Power regulator's name */
97 98
98 /* Internal data */ 99 /* Internal data */
99 struct mmc_host *mmc; /* MMC structure */ 100 struct mmc_host *mmc; /* MMC structure */
diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
index 245cdacee54..c83115efea9 100644
--- a/include/linux/mmc/sdio.h
+++ b/include/linux/mmc/sdio.h
@@ -38,6 +38,7 @@
38 * [8:0] Byte/block count 38 * [8:0] Byte/block count
39 */ 39 */
40 40
41#define R4_18V_PRESENT (1<<24)
41#define R4_MEMORY_PRESENT (1 << 27) 42#define R4_MEMORY_PRESENT (1 << 27)
42 43
43/* 44/*
@@ -72,17 +73,20 @@
72#define SDIO_CCCR_REV_1_00 0 /* CCCR/FBR Version 1.00 */ 73#define SDIO_CCCR_REV_1_00 0 /* CCCR/FBR Version 1.00 */
73#define SDIO_CCCR_REV_1_10 1 /* CCCR/FBR Version 1.10 */ 74#define SDIO_CCCR_REV_1_10 1 /* CCCR/FBR Version 1.10 */
74#define SDIO_CCCR_REV_1_20 2 /* CCCR/FBR Version 1.20 */ 75#define SDIO_CCCR_REV_1_20 2 /* CCCR/FBR Version 1.20 */
76#define SDIO_CCCR_REV_3_00 3 /* CCCR/FBR Version 3.00 */
75 77
76#define SDIO_SDIO_REV_1_00 0 /* SDIO Spec Version 1.00 */ 78#define SDIO_SDIO_REV_1_00 0 /* SDIO Spec Version 1.00 */
77#define SDIO_SDIO_REV_1_10 1 /* SDIO Spec Version 1.10 */ 79#define SDIO_SDIO_REV_1_10 1 /* SDIO Spec Version 1.10 */
78#define SDIO_SDIO_REV_1_20 2 /* SDIO Spec Version 1.20 */ 80#define SDIO_SDIO_REV_1_20 2 /* SDIO Spec Version 1.20 */
79#define SDIO_SDIO_REV_2_00 3 /* SDIO Spec Version 2.00 */ 81#define SDIO_SDIO_REV_2_00 3 /* SDIO Spec Version 2.00 */
82#define SDIO_SDIO_REV_3_00 4 /* SDIO Spec Version 3.00 */
80 83
81#define SDIO_CCCR_SD 0x01 84#define SDIO_CCCR_SD 0x01
82 85
83#define SDIO_SD_REV_1_01 0 /* SD Physical Spec Version 1.01 */ 86#define SDIO_SD_REV_1_01 0 /* SD Physical Spec Version 1.01 */
84#define SDIO_SD_REV_1_10 1 /* SD Physical Spec Version 1.10 */ 87#define SDIO_SD_REV_1_10 1 /* SD Physical Spec Version 1.10 */
85#define SDIO_SD_REV_2_00 2 /* SD Physical Spec Version 2.00 */ 88#define SDIO_SD_REV_2_00 2 /* SD Physical Spec Version 2.00 */
89#define SDIO_SD_REV_3_00 3 /* SD Physical Spev Version 3.00 */
86 90
87#define SDIO_CCCR_IOEx 0x02 91#define SDIO_CCCR_IOEx 0x02
88#define SDIO_CCCR_IORx 0x03 92#define SDIO_CCCR_IORx 0x03
@@ -132,8 +136,31 @@
132#define SDIO_CCCR_SPEED 0x13 136#define SDIO_CCCR_SPEED 0x13
133 137
134#define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */ 138#define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */
135#define SDIO_SPEED_EHS 0x02 /* Enable High-Speed mode */ 139#define SDIO_SPEED_BSS_SHIFT 1
136 140#define SDIO_SPEED_BSS_MASK (7<<SDIO_SPEED_BSS_SHIFT)
141#define SDIO_SPEED_SDR12 (0<<SDIO_SPEED_BSS_SHIFT)
142#define SDIO_SPEED_SDR25 (1<<SDIO_SPEED_BSS_SHIFT)
143#define SDIO_SPEED_SDR50 (2<<SDIO_SPEED_BSS_SHIFT)
144#define SDIO_SPEED_SDR104 (3<<SDIO_SPEED_BSS_SHIFT)
145#define SDIO_SPEED_DDR50 (4<<SDIO_SPEED_BSS_SHIFT)
146#define SDIO_SPEED_EHS SDIO_SPEED_SDR25 /* Enable High-Speed */
147
148#define SDIO_CCCR_UHS 0x14
149#define SDIO_UHS_SDR50 0x01
150#define SDIO_UHS_SDR104 0x02
151#define SDIO_UHS_DDR50 0x04
152
153#define SDIO_CCCR_DRIVE_STRENGTH 0x15
154#define SDIO_SDTx_MASK 0x07
155#define SDIO_DRIVE_SDTA (1<<0)
156#define SDIO_DRIVE_SDTC (1<<1)
157#define SDIO_DRIVE_SDTD (1<<2)
158#define SDIO_DRIVE_DTSx_MASK 0x03
159#define SDIO_DRIVE_DTSx_SHIFT 4
160#define SDIO_DTSx_SET_TYPE_B (0 << SDIO_DRIVE_DTSx_SHIFT)
161#define SDIO_DTSx_SET_TYPE_A (1 << SDIO_DRIVE_DTSx_SHIFT)
162#define SDIO_DTSx_SET_TYPE_C (2 << SDIO_DRIVE_DTSx_SHIFT)
163#define SDIO_DTSx_SET_TYPE_D (3 << SDIO_DRIVE_DTSx_SHIFT)
137/* 164/*
138 * Function Basic Registers (FBR) 165 * Function Basic Registers (FBR)
139 */ 166 */
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index 31baaf82f45..557acae8cf9 100644
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -23,6 +23,14 @@ struct sdio_func;
23typedef void (sdio_irq_handler_t)(struct sdio_func *); 23typedef void (sdio_irq_handler_t)(struct sdio_func *);
24 24
25/* 25/*
26 * Structure used to hold embedded SDIO device data from platform layer
27 */
28struct sdio_embedded_func {
29 uint8_t f_class;
30 uint32_t f_maxblksize;
31};
32
33/*
26 * SDIO function CIS tuple (unknown to the core) 34 * SDIO function CIS tuple (unknown to the core)
27 */ 35 */
28struct sdio_func_tuple { 36struct sdio_func_tuple {
@@ -130,6 +138,8 @@ extern int sdio_release_irq(struct sdio_func *func);
130extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz); 138extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz);
131 139
132extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret); 140extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret);
141extern u8 sdio_readb_ext(struct sdio_func *func, unsigned int addr, int *err_ret,
142 unsigned in);
133extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret); 143extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret);
134extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret); 144extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret);
135 145
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index b32f3f9182c..37bc8cc20ac 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -100,6 +100,7 @@ enum zone_stat_item {
100 NR_UNSTABLE_NFS, /* NFS unstable pages */ 100 NR_UNSTABLE_NFS, /* NFS unstable pages */
101 NR_BOUNCE, 101 NR_BOUNCE,
102 NR_VMSCAN_WRITE, 102 NR_VMSCAN_WRITE,
103 NR_VMSCAN_IMMEDIATE, /* Prioritise for reclaim when writeback ends */
103 NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */ 104 NR_WRITEBACK_TEMP, /* Writeback using temporary buffers */
104 NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */ 105 NR_ISOLATED_ANON, /* Temporary isolated pages from anon lru */
105 NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */ 106 NR_ISOLATED_FILE, /* Temporary isolated pages from file lru */
diff --git a/include/linux/mpu.h b/include/linux/mpu.h
new file mode 100644
index 00000000000..fd66ba0db87
--- /dev/null
+++ b/include/linux/mpu.h
@@ -0,0 +1,366 @@
1/*
2 $License:
3 Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 $
18 */
19
20#ifndef __MPU_H_
21#define __MPU_H_
22
23#include <linux/types.h>
24#include <linux/ioctl.h>
25
26/* Number of axes on each sensor */
27#define GYRO_NUM_AXES (3)
28#define ACCEL_NUM_AXES (3)
29#define COMPASS_NUM_AXES (3)
30
31struct mpu_read_write {
32 /* Memory address or register address depending on ioctl */
33 __u16 address;
34 __u16 length;
35 __u8 *data;
36};
37
38enum mpuirq_data_type {
39 MPUIRQ_DATA_TYPE_MPU_IRQ,
40 MPUIRQ_DATA_TYPE_SLAVE_IRQ,
41 MPUIRQ_DATA_TYPE_PM_EVENT,
42 MPUIRQ_DATA_TYPE_NUM_TYPES,
43};
44
45/* User space PM event notification */
46#define MPU_PM_EVENT_SUSPEND_PREPARE (3)
47#define MPU_PM_EVENT_POST_SUSPEND (4)
48
49struct mpuirq_data {
50 __u32 interruptcount;
51 __u64 irqtime;
52 __u32 data_type;
53 __s32 data;
54};
55
56enum ext_slave_config_key {
57 MPU_SLAVE_CONFIG_ODR_SUSPEND,
58 MPU_SLAVE_CONFIG_ODR_RESUME,
59 MPU_SLAVE_CONFIG_FSR_SUSPEND,
60 MPU_SLAVE_CONFIG_FSR_RESUME,
61 MPU_SLAVE_CONFIG_MOT_THS,
62 MPU_SLAVE_CONFIG_NMOT_THS,
63 MPU_SLAVE_CONFIG_MOT_DUR,
64 MPU_SLAVE_CONFIG_NMOT_DUR,
65 MPU_SLAVE_CONFIG_IRQ_SUSPEND,
66 MPU_SLAVE_CONFIG_IRQ_RESUME,
67 MPU_SLAVE_WRITE_REGISTERS,
68 MPU_SLAVE_READ_REGISTERS,
69 MPU_SLAVE_CONFIG_INTERNAL_REFERENCE,
70 /* AMI 306 specific config keys */
71 MPU_SLAVE_PARAM,
72 MPU_SLAVE_WINDOW,
73 MPU_SLAVE_READWINPARAMS,
74 MPU_SLAVE_SEARCHOFFSET,
75 /* AKM specific config keys */
76 MPU_SLAVE_READ_SCALE,
77 /* MPU3050 and MPU6050 Keys */
78 MPU_SLAVE_INT_CONFIG,
79 MPU_SLAVE_EXT_SYNC,
80 MPU_SLAVE_FULL_SCALE,
81 MPU_SLAVE_LPF,
82 MPU_SLAVE_CLK_SRC,
83 MPU_SLAVE_DIVIDER,
84 MPU_SLAVE_DMP_ENABLE,
85 MPU_SLAVE_FIFO_ENABLE,
86 MPU_SLAVE_DMP_CFG1,
87 MPU_SLAVE_DMP_CFG2,
88 MPU_SLAVE_TC,
89 MPU_SLAVE_GYRO,
90 MPU_SLAVE_ADDR,
91 MPU_SLAVE_PRODUCT_REVISION,
92 MPU_SLAVE_SILICON_REVISION,
93 MPU_SLAVE_PRODUCT_ID,
94 MPU_SLAVE_GYRO_SENS_TRIM,
95 MPU_SLAVE_ACCEL_SENS_TRIM,
96 MPU_SLAVE_RAM,
97 /* -------------------------- */
98 MPU_SLAVE_CONFIG_NUM_CONFIG_KEYS
99};
100
101/* For the MPU_SLAVE_CONFIG_IRQ_SUSPEND and MPU_SLAVE_CONFIG_IRQ_RESUME */
102enum ext_slave_config_irq_type {
103 MPU_SLAVE_IRQ_TYPE_NONE,
104 MPU_SLAVE_IRQ_TYPE_MOTION,
105 MPU_SLAVE_IRQ_TYPE_DATA_READY,
106};
107
108/* Structure for the following IOCTS's
109 * MPU_CONFIG_GYRO
110 * MPU_CONFIG_ACCEL
111 * MPU_CONFIG_COMPASS
112 * MPU_CONFIG_PRESSURE
113 * MPU_GET_CONFIG_GYRO
114 * MPU_GET_CONFIG_ACCEL
115 * MPU_GET_CONFIG_COMPASS
116 * MPU_GET_CONFIG_PRESSURE
117 *
118 * @key one of enum ext_slave_config_key
119 * @len length of data pointed to by data
120 * @apply zero if communication with the chip is not necessary, false otherwise
121 * This flag can be used to select cached data or to refresh cashed data
122 * cache data to be pushed later or push immediately. If true and the
123 * slave is on the secondary bus the MPU will first enger bypass mode
124 * before calling the slaves .config or .get_config funcion
125 * @data pointer to the data to confgure or get
126 */
127struct ext_slave_config {
128 __u8 key;
129 __u16 len;
130 __u8 apply;
131 void *data;
132};
133
134enum ext_slave_type {
135 EXT_SLAVE_TYPE_GYROSCOPE,
136 EXT_SLAVE_TYPE_ACCEL,
137 EXT_SLAVE_TYPE_COMPASS,
138 EXT_SLAVE_TYPE_PRESSURE,
139 /*EXT_SLAVE_TYPE_TEMPERATURE */
140
141 EXT_SLAVE_NUM_TYPES
142};
143
144enum ext_slave_id {
145 ID_INVALID = 0,
146
147 ACCEL_ID_LIS331,
148 ACCEL_ID_LSM303DLX,
149 ACCEL_ID_LIS3DH,
150 ACCEL_ID_KXSD9,
151 ACCEL_ID_KXTF9,
152 ACCEL_ID_BMA150,
153 ACCEL_ID_BMA222,
154 ACCEL_ID_BMA250,
155 ACCEL_ID_ADXL34X,
156 ACCEL_ID_MMA8450,
157 ACCEL_ID_MMA845X,
158 ACCEL_ID_MPU6050,
159
160 COMPASS_ID_AK8975,
161 COMPASS_ID_AK8972,
162 COMPASS_ID_AMI30X,
163 COMPASS_ID_AMI306,
164 COMPASS_ID_YAS529,
165 COMPASS_ID_YAS530,
166 COMPASS_ID_HMC5883,
167 COMPASS_ID_LSM303DLH,
168 COMPASS_ID_LSM303DLM,
169 COMPASS_ID_MMC314X,
170 COMPASS_ID_HSCDTD002B,
171 COMPASS_ID_HSCDTD004A,
172
173 PRESSURE_ID_BMA085,
174};
175
176enum ext_slave_endian {
177 EXT_SLAVE_BIG_ENDIAN,
178 EXT_SLAVE_LITTLE_ENDIAN,
179 EXT_SLAVE_FS8_BIG_ENDIAN,
180 EXT_SLAVE_FS16_BIG_ENDIAN,
181};
182
183enum ext_slave_bus {
184 EXT_SLAVE_BUS_INVALID = -1,
185 EXT_SLAVE_BUS_PRIMARY = 0,
186 EXT_SLAVE_BUS_SECONDARY = 1
187};
188
189
190/**
191 * struct ext_slave_platform_data - Platform data for mpu3050 and mpu6050
192 * slave devices
193 *
194 * @type: the type of slave device based on the enum ext_slave_type
195 * definitions.
196 * @irq: the irq number attached to the slave if any.
197 * @adapt_num: the I2C adapter number.
198 * @bus: the bus the slave is attached to: enum ext_slave_bus
199 * @address: the I2C slave address of the slave device.
200 * @orientation: the mounting matrix of the device relative to MPU.
201 * @irq_data: private data for the slave irq handler
202 * @private_data: additional data, user customizable. Not touched by the MPU
203 * driver.
204 *
205 * The orientation matricies are 3x3 rotation matricies
206 * that are applied to the data to rotate from the mounting orientation to the
207 * platform orientation. The values must be one of 0, 1, or -1 and each row and
208 * column should have exactly 1 non-zero value.
209 */
210struct ext_slave_platform_data {
211 __u8 type;
212 __u32 irq;
213 __u32 adapt_num;
214 __u32 bus;
215 __u8 address;
216 __s8 orientation[9];
217 void *irq_data;
218 void *private_data;
219};
220
221struct fix_pnt_range {
222 __s32 mantissa;
223 __s32 fraction;
224};
225
226static inline long range_fixedpoint_to_long_mg(struct fix_pnt_range rng)
227{
228 return (long)(rng.mantissa * 1000 + rng.fraction / 10);
229}
230
231struct ext_slave_read_trigger {
232 __u8 reg;
233 __u8 value;
234};
235
236/**
237 * struct ext_slave_descr - Description of the slave device for programming.
238 *
239 * @suspend: function pointer to put the device in suspended state
240 * @resume: function pointer to put the device in running state
241 * @read: function that reads the device data
242 * @init: function used to preallocate memory used by the driver
243 * @exit: function used to free memory allocated for the driver
244 * @config: function used to configure the device
245 * @get_config:function used to get the device's configuration
246 *
247 * @name: text name of the device
248 * @type: device type. enum ext_slave_type
249 * @id: enum ext_slave_id
250 * @read_reg: starting register address to retrieve data.
251 * @read_len: length in bytes of the sensor data. Typically 6.
252 * @endian: byte order of the data. enum ext_slave_endian
253 * @range: full scale range of the slave ouput: struct fix_pnt_range
254 * @trigger: If reading data first requires writing a register this is the
255 * data to write.
256 *
257 * Defines the functions and information about the slave the mpu3050 and
258 * mpu6050 needs to use the slave device.
259 */
260struct ext_slave_descr {
261 int (*init) (void *mlsl_handle,
262 struct ext_slave_descr *slave,
263 struct ext_slave_platform_data *pdata);
264 int (*exit) (void *mlsl_handle,
265 struct ext_slave_descr *slave,
266 struct ext_slave_platform_data *pdata);
267 int (*suspend) (void *mlsl_handle,
268 struct ext_slave_descr *slave,
269 struct ext_slave_platform_data *pdata);
270 int (*resume) (void *mlsl_handle,
271 struct ext_slave_descr *slave,
272 struct ext_slave_platform_data *pdata);
273 int (*read) (void *mlsl_handle,
274 struct ext_slave_descr *slave,
275 struct ext_slave_platform_data *pdata,
276 __u8 *data);
277 int (*config) (void *mlsl_handle,
278 struct ext_slave_descr *slave,
279 struct ext_slave_platform_data *pdata,
280 struct ext_slave_config *config);
281 int (*get_config) (void *mlsl_handle,
282 struct ext_slave_descr *slave,
283 struct ext_slave_platform_data *pdata,
284 struct ext_slave_config *config);
285
286 char *name;
287 __u8 type;
288 __u8 id;
289 __u8 read_reg;
290 __u8 read_len;
291 __u8 endian;
292 struct fix_pnt_range range;
293 struct ext_slave_read_trigger *trigger;
294};
295
296/**
297 * struct mpu_platform_data - Platform data for the mpu driver
298 * @int_config: Bits [7:3] of the int config register.
299 * @level_shifter: 0: VLogic, 1: VDD
300 * @orientation: Orientation matrix of the gyroscope
301 *
302 * Contains platform specific information on how to configure the MPU3050 to
303 * work on this platform. The orientation matricies are 3x3 rotation matricies
304 * that are applied to the data to rotate from the mounting orientation to the
305 * platform orientation. The values must be one of 0, 1, or -1 and each row and
306 * column should have exactly 1 non-zero value.
307 */
308struct mpu_platform_data {
309 __u8 int_config;
310 __u8 level_shifter;
311 __s8 orientation[GYRO_NUM_AXES * GYRO_NUM_AXES];
312};
313
314#define MPU_IOCTL (0x81) /* Magic number for MPU Iocts */
315/* IOCTL commands for /dev/mpu */
316
317/*--------------------------------------------------------------------------
318 * Deprecated, debugging only
319 */
320#define MPU_SET_MPU_PLATFORM_DATA \
321 _IOWR(MPU_IOCTL, 0x01, struct mpu_platform_data)
322#define MPU_SET_EXT_SLAVE_PLATFORM_DATA \
323 _IOWR(MPU_IOCTL, 0x01, struct ext_slave_platform_data)
324/*--------------------------------------------------------------------------*/
325#define MPU_GET_EXT_SLAVE_PLATFORM_DATA \
326 _IOWR(MPU_IOCTL, 0x02, struct ext_slave_platform_data)
327#define MPU_GET_MPU_PLATFORM_DATA \
328 _IOWR(MPU_IOCTL, 0x02, struct mpu_platform_data)
329#define MPU_GET_EXT_SLAVE_DESCR \
330 _IOWR(MPU_IOCTL, 0x02, struct ext_slave_descr)
331
332#define MPU_READ _IOWR(MPU_IOCTL, 0x10, struct mpu_read_write)
333#define MPU_WRITE _IOW(MPU_IOCTL, 0x10, struct mpu_read_write)
334#define MPU_READ_MEM _IOWR(MPU_IOCTL, 0x11, struct mpu_read_write)
335#define MPU_WRITE_MEM _IOW(MPU_IOCTL, 0x11, struct mpu_read_write)
336#define MPU_READ_FIFO _IOWR(MPU_IOCTL, 0x12, struct mpu_read_write)
337#define MPU_WRITE_FIFO _IOW(MPU_IOCTL, 0x12, struct mpu_read_write)
338
339#define MPU_READ_COMPASS _IOR(MPU_IOCTL, 0x12, __u8)
340#define MPU_READ_ACCEL _IOR(MPU_IOCTL, 0x13, __u8)
341#define MPU_READ_PRESSURE _IOR(MPU_IOCTL, 0x14, __u8)
342
343#define MPU_CONFIG_GYRO _IOW(MPU_IOCTL, 0x20, struct ext_slave_config)
344#define MPU_CONFIG_ACCEL _IOW(MPU_IOCTL, 0x21, struct ext_slave_config)
345#define MPU_CONFIG_COMPASS _IOW(MPU_IOCTL, 0x22, struct ext_slave_config)
346#define MPU_CONFIG_PRESSURE _IOW(MPU_IOCTL, 0x23, struct ext_slave_config)
347
348#define MPU_GET_CONFIG_GYRO _IOWR(MPU_IOCTL, 0x20, struct ext_slave_config)
349#define MPU_GET_CONFIG_ACCEL _IOWR(MPU_IOCTL, 0x21, struct ext_slave_config)
350#define MPU_GET_CONFIG_COMPASS _IOWR(MPU_IOCTL, 0x22, struct ext_slave_config)
351#define MPU_GET_CONFIG_PRESSURE _IOWR(MPU_IOCTL, 0x23, struct ext_slave_config)
352
353#define MPU_SUSPEND _IOW(MPU_IOCTL, 0x30, __u32)
354#define MPU_RESUME _IOW(MPU_IOCTL, 0x31, __u32)
355/* Userspace PM Event response */
356#define MPU_PM_EVENT_HANDLED _IO(MPU_IOCTL, 0x32)
357
358#define MPU_GET_REQUESTED_SENSORS _IOR(MPU_IOCTL, 0x40, __u8)
359#define MPU_SET_REQUESTED_SENSORS _IOW(MPU_IOCTL, 0x40, __u8)
360#define MPU_GET_IGNORE_SYSTEM_SUSPEND _IOR(MPU_IOCTL, 0x41, __u8)
361#define MPU_SET_IGNORE_SYSTEM_SUSPEND _IOW(MPU_IOCTL, 0x41, __u8)
362#define MPU_GET_MLDL_STATUS _IOR(MPU_IOCTL, 0x42, __u8)
363#define MPU_GET_I2C_SLAVES_ENABLED _IOR(MPU_IOCTL, 0x43, __u8)
364
365
366#endif /* __MPU_H_ */
diff --git a/include/linux/mpu3050.h b/include/linux/mpu3050.h
new file mode 100644
index 00000000000..a8dcd5a9473
--- /dev/null
+++ b/include/linux/mpu3050.h
@@ -0,0 +1,255 @@
1/*
2 $License:
3 Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 $
18 */
19
20#ifndef __MPU3050_H_
21#define __MPU3050_H_
22
23#ifdef __KERNEL__
24#include <linux/types.h>
25#endif
26
27#ifdef M_HW
28#error MPU6000 build including MPU3050 header
29#endif
30
31#define MPU_NAME "mpu3050"
32#define DEFAULT_MPU_SLAVEADDR 0x68
33
34/*==== MPU REGISTER SET ====*/
35enum mpu_register {
36 MPUREG_WHO_AM_I = 0, /* 00 0x00 */
37 MPUREG_PRODUCT_ID, /* 01 0x01 */
38 MPUREG_02_RSVD, /* 02 0x02 */
39 MPUREG_03_RSVD, /* 03 0x03 */
40 MPUREG_04_RSVD, /* 04 0x04 */
41 MPUREG_XG_OFFS_TC, /* 05 0x05 */
42 MPUREG_06_RSVD, /* 06 0x06 */
43 MPUREG_07_RSVD, /* 07 0x07 */
44 MPUREG_YG_OFFS_TC, /* 08 0x08 */
45 MPUREG_09_RSVD, /* 09 0x09 */
46 MPUREG_0A_RSVD, /* 10 0x0a */
47 MPUREG_ZG_OFFS_TC, /* 11 0x0b */
48 MPUREG_X_OFFS_USRH, /* 12 0x0c */
49 MPUREG_X_OFFS_USRL, /* 13 0x0d */
50 MPUREG_Y_OFFS_USRH, /* 14 0x0e */
51 MPUREG_Y_OFFS_USRL, /* 15 0x0f */
52 MPUREG_Z_OFFS_USRH, /* 16 0x10 */
53 MPUREG_Z_OFFS_USRL, /* 17 0x11 */
54 MPUREG_FIFO_EN1, /* 18 0x12 */
55 MPUREG_FIFO_EN2, /* 19 0x13 */
56 MPUREG_AUX_SLV_ADDR, /* 20 0x14 */
57 MPUREG_SMPLRT_DIV, /* 21 0x15 */
58 MPUREG_DLPF_FS_SYNC, /* 22 0x16 */
59 MPUREG_INT_CFG, /* 23 0x17 */
60 MPUREG_ACCEL_BURST_ADDR,/* 24 0x18 */
61 MPUREG_19_RSVD, /* 25 0x19 */
62 MPUREG_INT_STATUS, /* 26 0x1a */
63 MPUREG_TEMP_OUT_H, /* 27 0x1b */
64 MPUREG_TEMP_OUT_L, /* 28 0x1c */
65 MPUREG_GYRO_XOUT_H, /* 29 0x1d */
66 MPUREG_GYRO_XOUT_L, /* 30 0x1e */
67 MPUREG_GYRO_YOUT_H, /* 31 0x1f */
68 MPUREG_GYRO_YOUT_L, /* 32 0x20 */
69 MPUREG_GYRO_ZOUT_H, /* 33 0x21 */
70 MPUREG_GYRO_ZOUT_L, /* 34 0x22 */
71 MPUREG_23_RSVD, /* 35 0x23 */
72 MPUREG_24_RSVD, /* 36 0x24 */
73 MPUREG_25_RSVD, /* 37 0x25 */
74 MPUREG_26_RSVD, /* 38 0x26 */
75 MPUREG_27_RSVD, /* 39 0x27 */
76 MPUREG_28_RSVD, /* 40 0x28 */
77 MPUREG_29_RSVD, /* 41 0x29 */
78 MPUREG_2A_RSVD, /* 42 0x2a */
79 MPUREG_2B_RSVD, /* 43 0x2b */
80 MPUREG_2C_RSVD, /* 44 0x2c */
81 MPUREG_2D_RSVD, /* 45 0x2d */
82 MPUREG_2E_RSVD, /* 46 0x2e */
83 MPUREG_2F_RSVD, /* 47 0x2f */
84 MPUREG_30_RSVD, /* 48 0x30 */
85 MPUREG_31_RSVD, /* 49 0x31 */
86 MPUREG_32_RSVD, /* 50 0x32 */
87 MPUREG_33_RSVD, /* 51 0x33 */
88 MPUREG_34_RSVD, /* 52 0x34 */
89 MPUREG_DMP_CFG_1, /* 53 0x35 */
90 MPUREG_DMP_CFG_2, /* 54 0x36 */
91 MPUREG_BANK_SEL, /* 55 0x37 */
92 MPUREG_MEM_START_ADDR, /* 56 0x38 */
93 MPUREG_MEM_R_W, /* 57 0x39 */
94 MPUREG_FIFO_COUNTH, /* 58 0x3a */
95 MPUREG_FIFO_COUNTL, /* 59 0x3b */
96 MPUREG_FIFO_R_W, /* 60 0x3c */
97 MPUREG_USER_CTRL, /* 61 0x3d */
98 MPUREG_PWR_MGM, /* 62 0x3e */
99 MPUREG_3F_RSVD, /* 63 0x3f */
100 NUM_OF_MPU_REGISTERS /* 64 0x40 */
101};
102
103/*==== BITS FOR MPU ====*/
104
105/*---- MPU 'FIFO_EN1' register (12) ----*/
106#define BIT_TEMP_OUT 0x80
107#define BIT_GYRO_XOUT 0x40
108#define BIT_GYRO_YOUT 0x20
109#define BIT_GYRO_ZOUT 0x10
110#define BIT_ACCEL_XOUT 0x08
111#define BIT_ACCEL_YOUT 0x04
112#define BIT_ACCEL_ZOUT 0x02
113#define BIT_AUX_1OUT 0x01
114/*---- MPU 'FIFO_EN2' register (13) ----*/
115#define BIT_AUX_2OUT 0x02
116#define BIT_AUX_3OUT 0x01
117/*---- MPU 'DLPF_FS_SYNC' register (16) ----*/
118#define BITS_EXT_SYNC_NONE 0x00
119#define BITS_EXT_SYNC_TEMP 0x20
120#define BITS_EXT_SYNC_GYROX 0x40
121#define BITS_EXT_SYNC_GYROY 0x60
122#define BITS_EXT_SYNC_GYROZ 0x80
123#define BITS_EXT_SYNC_ACCELX 0xA0
124#define BITS_EXT_SYNC_ACCELY 0xC0
125#define BITS_EXT_SYNC_ACCELZ 0xE0
126#define BITS_EXT_SYNC_MASK 0xE0
127#define BITS_FS_250DPS 0x00
128#define BITS_FS_500DPS 0x08
129#define BITS_FS_1000DPS 0x10
130#define BITS_FS_2000DPS 0x18
131#define BITS_FS_MASK 0x18
132#define BITS_DLPF_CFG_256HZ_NOLPF2 0x00
133#define BITS_DLPF_CFG_188HZ 0x01
134#define BITS_DLPF_CFG_98HZ 0x02
135#define BITS_DLPF_CFG_42HZ 0x03
136#define BITS_DLPF_CFG_20HZ 0x04
137#define BITS_DLPF_CFG_10HZ 0x05
138#define BITS_DLPF_CFG_5HZ 0x06
139#define BITS_DLPF_CFG_2100HZ_NOLPF 0x07
140#define BITS_DLPF_CFG_MASK 0x07
141/*---- MPU 'INT_CFG' register (17) ----*/
142#define BIT_ACTL 0x80
143#define BIT_ACTL_LOW 0x80
144#define BIT_ACTL_HIGH 0x00
145#define BIT_OPEN 0x40
146#define BIT_OPEN_DRAIN 0x40
147#define BIT_PUSH_PULL 0x00
148#define BIT_LATCH_INT_EN 0x20
149#define BIT_LATCH_INT_EN 0x20
150#define BIT_INT_PULSE_WIDTH_50US 0x00
151#define BIT_INT_ANYRD_2CLEAR 0x10
152#define BIT_INT_STAT_READ_2CLEAR 0x00
153#define BIT_MPU_RDY_EN 0x04
154#define BIT_DMP_INT_EN 0x02
155#define BIT_RAW_RDY_EN 0x01
156/*---- MPU 'INT_STATUS' register (1A) ----*/
157#define BIT_INT_STATUS_FIFO_OVERLOW 0x80
158#define BIT_MPU_RDY 0x04
159#define BIT_DMP_INT 0x02
160#define BIT_RAW_RDY 0x01
161/*---- MPU 'BANK_SEL' register (37) ----*/
162#define BIT_PRFTCH_EN 0x20
163#define BIT_CFG_USER_BANK 0x10
164#define BITS_MEM_SEL 0x0f
165/*---- MPU 'USER_CTRL' register (3D) ----*/
166#define BIT_DMP_EN 0x80
167#define BIT_FIFO_EN 0x40
168#define BIT_AUX_IF_EN 0x20
169#define BIT_AUX_RD_LENG 0x10
170#define BIT_AUX_IF_RST 0x08
171#define BIT_DMP_RST 0x04
172#define BIT_FIFO_RST 0x02
173#define BIT_GYRO_RST 0x01
174/*---- MPU 'PWR_MGM' register (3E) ----*/
175#define BIT_H_RESET 0x80
176#define BIT_SLEEP 0x40
177#define BIT_STBY_XG 0x20
178#define BIT_STBY_YG 0x10
179#define BIT_STBY_ZG 0x08
180#define BITS_CLKSEL 0x07
181
182/*---- MPU Silicon Revision ----*/
183#define MPU_SILICON_REV_A4 1 /* MPU A4 Device */
184#define MPU_SILICON_REV_B1 2 /* MPU B1 Device */
185#define MPU_SILICON_REV_B4 3 /* MPU B4 Device */
186#define MPU_SILICON_REV_B6 4 /* MPU B6 Device */
187
188/*---- MPU Memory ----*/
189#define MPU_MEM_BANK_SIZE (256)
190#define FIFO_HW_SIZE (512)
191
192enum MPU_MEMORY_BANKS {
193 MPU_MEM_RAM_BANK_0 = 0,
194 MPU_MEM_RAM_BANK_1,
195 MPU_MEM_RAM_BANK_2,
196 MPU_MEM_RAM_BANK_3,
197 MPU_MEM_NUM_RAM_BANKS,
198 MPU_MEM_OTP_BANK_0 = MPU_MEM_NUM_RAM_BANKS,
199 /* This one is always last */
200 MPU_MEM_NUM_BANKS
201};
202
203#define MPU_NUM_AXES (3)
204
205/*---- structure containing control variables used by MLDL ----*/
206/*---- MPU clock source settings ----*/
207/*---- MPU filter selections ----*/
208enum mpu_filter {
209 MPU_FILTER_256HZ_NOLPF2 = 0,
210 MPU_FILTER_188HZ,
211 MPU_FILTER_98HZ,
212 MPU_FILTER_42HZ,
213 MPU_FILTER_20HZ,
214 MPU_FILTER_10HZ,
215 MPU_FILTER_5HZ,
216 MPU_FILTER_2100HZ_NOLPF,
217 NUM_MPU_FILTER
218};
219
220enum mpu_fullscale {
221 MPU_FS_250DPS = 0,
222 MPU_FS_500DPS,
223 MPU_FS_1000DPS,
224 MPU_FS_2000DPS,
225 NUM_MPU_FS
226};
227
228enum mpu_clock_sel {
229 MPU_CLK_SEL_INTERNAL = 0,
230 MPU_CLK_SEL_PLLGYROX,
231 MPU_CLK_SEL_PLLGYROY,
232 MPU_CLK_SEL_PLLGYROZ,
233 MPU_CLK_SEL_PLLEXT32K,
234 MPU_CLK_SEL_PLLEXT19M,
235 MPU_CLK_SEL_RESERVED,
236 MPU_CLK_SEL_STOP,
237 NUM_CLK_SEL
238};
239
240enum mpu_ext_sync {
241 MPU_EXT_SYNC_NONE = 0,
242 MPU_EXT_SYNC_TEMP,
243 MPU_EXT_SYNC_GYROX,
244 MPU_EXT_SYNC_GYROY,
245 MPU_EXT_SYNC_GYROZ,
246 MPU_EXT_SYNC_ACCELX,
247 MPU_EXT_SYNC_ACCELY,
248 MPU_EXT_SYNC_ACCELZ,
249 NUM_MPU_EXT_SYNC
250};
251
252#define DLPF_FS_SYNC_VALUE(ext_sync, full_scale, lpf) \
253 ((ext_sync << 5) | (full_scale << 3) | lpf)
254
255#endif /* __MPU3050_H_ */
diff --git a/include/linux/mpu6000.h b/include/linux/mpu6000.h
new file mode 100644
index 00000000000..5a63c8f07b7
--- /dev/null
+++ b/include/linux/mpu6000.h
@@ -0,0 +1,406 @@
1/*
2 $License:
3 Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 $
18 */
19
20/**
21 * @defgroup
22 * @brief
23 *
24 * @{
25 * @file mpu6000.h
26 * @brief
27 */
28
29#ifndef __MPU6000_H_
30#define __MPU6000_H_
31
32#define MPU_NAME "mpu6000"
33#define DEFAULT_MPU_SLAVEADDR 0x68
34
35/*==== M_HW REGISTER SET ====*/
36enum {
37 MPUREG_XG_OFFS_TC = 0, /* 0x00 */
38 MPUREG_YG_OFFS_TC, /* 0x00 */
39 MPUREG_ZG_OFFS_TC, /* 0x00 */
40 MPUREG_X_FINE_GAIN, /* 0x00 */
41 MPUREG_Y_FINE_GAIN, /* 0x00 */
42 MPUREG_Z_FINE_GAIN, /* 0x00 */
43 MPUREG_XA_OFFS_H, /* 0x00 */
44 MPUREG_XA_OFFS_L_TC, /* 0x00 */
45 MPUREG_YA_OFFS_H, /* 0x00 */
46 MPUREG_YA_OFFS_L_TC, /* 0x00 */
47 MPUREG_ZA_OFFS_H, /* 0x00 */
48 MPUREG_ZA_OFFS_L_TC, /* 0xB */
49 MPUREG_0C_RSVD, /* 0x00 */
50 MPUREG_0D_RSVD, /* 0x00 */
51 MPUREG_0E_RSVD, /* 0x00 */
52 MPUREG_0F_RSVD, /* 0x00 */
53 MPUREG_10_RSVD, /* 0x00 */
54 MPUREG_11_RSVD, /* 0x00 */
55 MPUREG_12_RSVD, /* 0x00 */
56 MPUREG_XG_OFFS_USRH, /* 0x00 */
57 MPUREG_XG_OFFS_USRL, /* 0x00 */
58 MPUREG_YG_OFFS_USRH, /* 0x00 */
59 MPUREG_YG_OFFS_USRL, /* 0x00 */
60 MPUREG_ZG_OFFS_USRH, /* 0x00 */
61 MPUREG_ZG_OFFS_USRL, /* 0x00 */
62 MPUREG_SMPLRT_DIV, /* 0x19 */
63 MPUREG_CONFIG, /* 0x1A ==> DLPF_FS_SYNC */
64 MPUREG_GYRO_CONFIG, /* 0x00 */
65 MPUREG_ACCEL_CONFIG, /* 0x00 */
66 MPUREG_ACCEL_FF_THR, /* 0x00 */
67 MPUREG_ACCEL_FF_DUR, /* 0x00 */
68 MPUREG_ACCEL_MOT_THR, /* 0x00 */
69 MPUREG_ACCEL_MOT_DUR, /* 0x00 */
70 MPUREG_ACCEL_ZRMOT_THR, /* 0x00 */
71 MPUREG_ACCEL_ZRMOT_DUR, /* 0x00 */
72 MPUREG_FIFO_EN, /* 0x23 */
73 MPUREG_I2C_MST_CTRL, /* 0x00 */
74 MPUREG_I2C_SLV0_ADDR, /* 0x25 */
75 MPUREG_I2C_SLV0_REG, /* 0x00 */
76 MPUREG_I2C_SLV0_CTRL, /* 0x00 */
77 MPUREG_I2C_SLV1_ADDR, /* 0x28 */
78 MPUREG_I2C_SLV1_REG_PASSWORD, /* 0x00 */
79 MPUREG_I2C_SLV1_CTRL, /* 0x00 */
80 MPUREG_I2C_SLV2_ADDR, /* 0x2B */
81 MPUREG_I2C_SLV2_REG, /* 0x00 */
82 MPUREG_I2C_SLV2_CTRL, /* 0x00 */
83 MPUREG_I2C_SLV3_ADDR, /* 0x2E */
84 MPUREG_I2C_SLV3_REG, /* 0x00 */
85 MPUREG_I2C_SLV3_CTRL, /* 0x00 */
86 MPUREG_I2C_SLV4_ADDR, /* 0x31 */
87 MPUREG_I2C_SLV4_REG, /* 0x00 */
88 MPUREG_I2C_SLV4_DO, /* 0x00 */
89 MPUREG_I2C_SLV4_CTRL, /* 0x00 */
90 MPUREG_I2C_SLV4_DI, /* 0x00 */
91 MPUREG_I2C_MST_STATUS, /* 0x36 */
92 MPUREG_INT_PIN_CFG, /* 0x37 ==> -* INT_CFG */
93 MPUREG_INT_ENABLE, /* 0x38 ==> / */
94 MPUREG_DMP_INT_STATUS, /* 0x39 */
95 MPUREG_INT_STATUS, /* 0x3A */
96 MPUREG_ACCEL_XOUT_H, /* 0x3B */
97 MPUREG_ACCEL_XOUT_L, /* 0x00 */
98 MPUREG_ACCEL_YOUT_H, /* 0x00 */
99 MPUREG_ACCEL_YOUT_L, /* 0x00 */
100 MPUREG_ACCEL_ZOUT_H, /* 0x00 */
101 MPUREG_ACCEL_ZOUT_L, /* 0x00 */
102 MPUREG_TEMP_OUT_H, /* 0x41 */
103 MPUREG_TEMP_OUT_L, /* 0x00 */
104 MPUREG_GYRO_XOUT_H, /* 0x43 */
105 MPUREG_GYRO_XOUT_L, /* 0x00 */
106 MPUREG_GYRO_YOUT_H, /* 0x00 */
107 MPUREG_GYRO_YOUT_L, /* 0x00 */
108 MPUREG_GYRO_ZOUT_H, /* 0x00 */
109 MPUREG_GYRO_ZOUT_L, /* 0x00 */
110 MPUREG_EXT_SLV_SENS_DATA_00, /* 0x49 */
111 MPUREG_EXT_SLV_SENS_DATA_01, /* 0x00 */
112 MPUREG_EXT_SLV_SENS_DATA_02, /* 0x00 */
113 MPUREG_EXT_SLV_SENS_DATA_03, /* 0x00 */
114 MPUREG_EXT_SLV_SENS_DATA_04, /* 0x00 */
115 MPUREG_EXT_SLV_SENS_DATA_05, /* 0x00 */
116 MPUREG_EXT_SLV_SENS_DATA_06, /* 0x4F */
117 MPUREG_EXT_SLV_SENS_DATA_07, /* 0x00 */
118 MPUREG_EXT_SLV_SENS_DATA_08, /* 0x00 */
119 MPUREG_EXT_SLV_SENS_DATA_09, /* 0x00 */
120 MPUREG_EXT_SLV_SENS_DATA_10, /* 0x00 */
121 MPUREG_EXT_SLV_SENS_DATA_11, /* 0x00 */
122 MPUREG_EXT_SLV_SENS_DATA_12, /* 0x55 */
123 MPUREG_EXT_SLV_SENS_DATA_13, /* 0x00 */
124 MPUREG_EXT_SLV_SENS_DATA_14, /* 0x00 */
125 MPUREG_EXT_SLV_SENS_DATA_15, /* 0x00 */
126 MPUREG_EXT_SLV_SENS_DATA_16, /* 0x00 */
127 MPUREG_EXT_SLV_SENS_DATA_17, /* 0x00 */
128 MPUREG_EXT_SLV_SENS_DATA_18, /* 0x5B */
129 MPUREG_EXT_SLV_SENS_DATA_19, /* 0x00 */
130 MPUREG_EXT_SLV_SENS_DATA_20, /* 0x00 */
131 MPUREG_EXT_SLV_SENS_DATA_21, /* 0x00 */
132 MPUREG_EXT_SLV_SENS_DATA_22, /* 0x00 */
133 MPUREG_EXT_SLV_SENS_DATA_23, /* 0x00 */
134 ACCEL_INTEL_STATUS, /* 0x61 */
135 MPUREG_62_RSVD, /* 0x00 */
136 MPUREG_63_RSVD, /* 0x00 */
137 MPUREG_64_RSVD, /* 0x00 */
138 MPUREG_65_RSVD, /* 0x00 */
139 MPUREG_66_RSVD, /* 0x00 */
140 MPUREG_67_RSVD, /* 0x00 */
141 SIGNAL_PATH_RESET, /* 0x68 */
142 ACCEL_INTEL_CTRL, /* 0x69 */
143 MPUREG_USER_CTRL, /* 0x6A */
144 MPUREG_PWR_MGMT_1, /* 0x6B */
145 MPUREG_PWR_MGMT_2, /* 0x00 */
146 MPUREG_BANK_SEL, /* 0x6D */
147 MPUREG_MEM_START_ADDR, /* 0x6E */
148 MPUREG_MEM_R_W, /* 0x6F */
149 MPUREG_PRGM_STRT_ADDRH, /* 0x00 */
150 MPUREG_PRGM_STRT_ADDRL, /* 0x00 */
151 MPUREG_FIFO_COUNTH, /* 0x72 */
152 MPUREG_FIFO_COUNTL, /* 0x00 */
153 MPUREG_FIFO_R_W, /* 0x74 */
154 MPUREG_WHOAMI, /* 0x75,117 */
155
156 NUM_OF_MPU_REGISTERS /* = 0x76,118 */
157};
158
159/*==== M_HW MEMORY ====*/
160enum MPU_MEMORY_BANKS {
161 MEM_RAM_BANK_0 = 0,
162 MEM_RAM_BANK_1,
163 MEM_RAM_BANK_2,
164 MEM_RAM_BANK_3,
165 MEM_RAM_BANK_4,
166 MEM_RAM_BANK_5,
167 MEM_RAM_BANK_6,
168 MEM_RAM_BANK_7,
169 MEM_RAM_BANK_8,
170 MEM_RAM_BANK_9,
171 MEM_RAM_BANK_10,
172 MEM_RAM_BANK_11,
173 MPU_MEM_NUM_RAM_BANKS,
174 MPU_MEM_OTP_BANK_0 = 16
175};
176
177
178/*==== M_HW parameters ====*/
179
180#define NUM_REGS (NUM_OF_MPU_REGISTERS)
181#define START_SENS_REGS (0x3B)
182#define NUM_SENS_REGS (0x60-START_SENS_REGS+1)
183
184/*---- MPU Memory ----*/
185#define NUM_BANKS (MPU_MEM_NUM_RAM_BANKS)
186#define BANK_SIZE (256)
187#define MEM_SIZE (NUM_BANKS*BANK_SIZE)
188#define MPU_MEM_BANK_SIZE (BANK_SIZE) /*alternative name */
189
190#define FIFO_HW_SIZE (1024)
191
192#define NUM_EXT_SLAVES (4)
193
194
195/*==== BITS FOR M_HW ====*/
196
197/*---- M_HW 'FIFO_EN' register (23) ----*/
198#define BIT_TEMP_OUT 0x80
199#define BIT_GYRO_XOUT 0x40
200#define BIT_GYRO_YOUT 0x20
201#define BIT_GYRO_ZOUT 0x10
202#define BIT_ACCEL 0x08
203#define BIT_SLV_2 0x04
204#define BIT_SLV_1 0x02
205#define BIT_SLV_0 0x01
206/*---- M_HW 'CONFIG' register (1A) ----*/
207/*NONE 0xC0 */
208#define BITS_EXT_SYNC_SET 0x38
209#define BITS_DLPF_CFG 0x07
210/*---- M_HW 'GYRO_CONFIG' register (1B) ----*/
211/* voluntarily modified label from BITS_FS_SEL to
212 * BITS_GYRO_FS_SEL to avoid confusion with MPU
213 */
214#define BITS_GYRO_FS_SEL 0x18
215/*NONE 0x07 */
216/*---- M_HW 'ACCEL_CONFIG' register (1C) ----*/
217#define BITS_ACCEL_FS_SEL 0x18
218#define BITS_ACCEL_HPF 0x07
219/*---- M_HW 'I2C_MST_CTRL' register (24) ----*/
220#define BIT_MULT_MST_DIS 0x80
221#define BIT_WAIT_FOR_ES 0x40
222#define BIT_I2C_MST_VDDIO 0x20
223/*NONE 0x10 */
224#define BITS_I2C_MST_CLK 0x0F
225/*---- M_HW 'I2C_SLV?_CTRL' register (27,2A,2D,30) ----*/
226#define BIT_SLV_ENABLE 0x80
227#define BIT_SLV_BYTE_SW 0x40
228/*NONE 0x20 */
229#define BIT_SLV_GRP 0x10
230#define BITS_SLV_LENG 0x0F
231/*---- M_HW 'I2C_SLV4_ADDR' register (31) ----*/
232#define BIT_I2C_SLV4_RNW 0x80
233/*---- M_HW 'I2C_SLV4_CTRL' register (34) ----*/
234#define BIT_I2C_SLV4_EN 0x80
235#define BIT_SLV4_DONE_INT_EN 0x40
236/*NONE 0x3F */
237/*---- M_HW 'I2C_MST_STATUS' register (36) ----*/
238#define BIT_PASSTHROUGH 0x80
239#define BIT_I2C_SLV4_DONE 0x40
240#define BIT_I2C_LOST_ARB 0x20
241#define BIT_I2C_SLV4_NACK 0x10
242#define BIT_I2C_SLV3_NACK 0x08
243#define BIT_I2C_SLV2_NACK 0x04
244#define BIT_I2C_SLV1_NACK 0x02
245#define BIT_I2C_SLV0_NACK 0x01
246/*---- M_HW 'INT_PIN_CFG' register (37) ----*/
247#define BIT_ACTL 0x80
248#define BIT_ACTL_LOW 0x80
249#define BIT_ACTL_HIGH 0x00
250#define BIT_OPEN 0x40
251#define BIT_LATCH_INT_EN 0x20
252#define BIT_INT_ANYRD_2CLEAR 0x10
253#define BIT_ACTL_FSYNC 0x08
254#define BIT_FSYNC_INT_EN 0x04
255#define BIT_BYPASS_EN 0x02
256#define BIT_CLKOUT_EN 0x01
257/*---- M_HW 'INT_ENABLE' register (38) ----*/
258#define BIT_FF_EN 0x80
259#define BIT_MOT_EN 0x40
260#define BIT_ZMOT_EN 0x20
261#define BIT_FIFO_OVERFLOW_EN 0x10
262#define BIT_I2C_MST_INT_EN 0x08
263#define BIT_PLL_RDY_EN 0x04
264#define BIT_DMP_INT_EN 0x02
265#define BIT_RAW_RDY_EN 0x01
266/*---- M_HW 'DMP_INT_STATUS' register (39) ----*/
267/*NONE 0x80 */
268/*NONE 0x40 */
269#define BIT_DMP_INT_5 0x20
270#define BIT_DMP_INT_4 0x10
271#define BIT_DMP_INT_3 0x08
272#define BIT_DMP_INT_2 0x04
273#define BIT_DMP_INT_1 0x02
274#define BIT_DMP_INT_0 0x01
275/*---- M_HW 'INT_STATUS' register (3A) ----*/
276#define BIT_FF_INT 0x80
277#define BIT_MOT_INT 0x40
278#define BIT_ZMOT_INT 0x20
279#define BIT_FIFO_OVERFLOW_INT 0x10
280#define BIT_I2C_MST_INT 0x08
281#define BIT_PLL_RDY_INT 0x04
282#define BIT_DMP_INT 0x02
283#define BIT_RAW_DATA_RDY_INT 0x01
284/*---- M_HW 'BANK_SEL' register (6D) ----*/
285#define BIT_PRFTCH_EN 0x40
286#define BIT_CFG_USER_BANK 0x20
287#define BITS_MEM_SEL 0x1f
288/*---- M_HW 'USER_CTRL' register (6A) ----*/
289#define BIT_DMP_EN 0x80
290#define BIT_FIFO_EN 0x40
291#define BIT_I2C_MST_EN 0x20
292#define BIT_I2C_IF_DIS 0x10
293#define BIT_DMP_RST 0x08
294#define BIT_FIFO_RST 0x04
295#define BIT_I2C_MST_RST 0x02
296#define BIT_SIG_COND_RST 0x01
297/*---- M_HW 'PWR_MGMT_1' register (6B) ----*/
298#define BIT_H_RESET 0x80
299#define BITS_PWRSEL 0x70
300#define BIT_WKUP_INT 0x08
301#define BITS_CLKSEL 0x07
302/*---- M_HW 'PWR_MGMT_2' register (6C) ----*/
303#define BITS_LPA_WAKE_CTRL 0xC0
304#define BIT_STBY_XA 0x20
305#define BIT_STBY_YA 0x10
306#define BIT_STBY_ZA 0x08
307#define BIT_STBY_XG 0x04
308#define BIT_STBY_YG 0x02
309#define BIT_STBY_ZG 0x01
310
311/* although it has 6, this refers to the gyros */
312#define MPU_NUM_AXES (3)
313
314#define ACCEL_MOT_THR_LSB (32) /* mg */
315#define ACCEL_MOT_DUR_LSB (1)
316#define ACCEL_ZRMOT_THR_LSB_CONVERSION(mg) ((mg *1000)/255)
317#define ACCEL_ZRMOT_DUR_LSB (64)
318
319/*----------------------------------------------------------------------------*/
320/*---- Alternative names to take care of conflicts with current mpu3050.h ----*/
321/*----------------------------------------------------------------------------*/
322
323/*-- registers --*/
324#define MPUREG_DLPF_FS_SYNC MPUREG_CONFIG /* 0x1A */
325
326#define MPUREG_PRODUCT_ID MPUREG_WHOAMI /* 0x75 HACK!*/
327#define MPUREG_PWR_MGM MPUREG_PWR_MGMT_1 /* 0x6B */
328#define MPUREG_FIFO_EN1 MPUREG_FIFO_EN /* 0x23 */
329#define MPUREG_DMP_CFG_1 MPUREG_PRGM_STRT_ADDRH /* 0x70 */
330#define MPUREG_DMP_CFG_2 MPUREG_PRGM_STRT_ADDRL /* 0x71 */
331#define MPUREG_INT_CFG MPUREG_INT_ENABLE /* 0x38 */
332#define MPUREG_X_OFFS_USRH MPUREG_XG_OFFS_USRH /* 0x13 */
333#define MPUREG_WHO_AM_I MPUREG_WHOAMI /* 0x75 */
334#define MPUREG_23_RSVD MPUREG_EXT_SLV_SENS_DATA_00 /* 0x49 */
335#define MPUREG_AUX_SLV_ADDR MPUREG_I2C_SLV0_ADDR /* 0x25 */
336#define MPUREG_ACCEL_BURST_ADDR MPUREG_I2C_SLV0_REG /* 0x26 */
337
338/*-- bits --*/
339/* 'USER_CTRL' register */
340#define BIT_AUX_IF_EN BIT_I2C_MST_EN
341#define BIT_AUX_RD_LENG BIT_I2C_MST_EN
342#define BIT_IME_IF_RST BIT_I2C_MST_RST
343#define BIT_GYRO_RST BIT_SIG_COND_RST
344/* 'INT_ENABLE' register */
345#define BIT_RAW_RDY BIT_RAW_DATA_RDY_INT
346#define BIT_MPU_RDY_EN BIT_PLL_RDY_EN
347/* 'INT_STATUS' register */
348#define BIT_INT_STATUS_FIFO_OVERLOW BIT_FIFO_OVERFLOW_INT
349
350
351
352/*---- M_HW Silicon Revisions ----*/
353#define MPU_SILICON_REV_A1 1 /* M_HW A1 Device */
354#define MPU_SILICON_REV_B1 2 /* M_HW B1 Device */
355
356/*---- structure containing control variables used by MLDL ----*/
357/*---- MPU clock source settings ----*/
358/*---- MPU filter selections ----*/
359enum mpu_filter {
360 MPU_FILTER_256HZ_NOLPF2 = 0,
361 MPU_FILTER_188HZ,
362 MPU_FILTER_98HZ,
363 MPU_FILTER_42HZ,
364 MPU_FILTER_20HZ,
365 MPU_FILTER_10HZ,
366 MPU_FILTER_5HZ,
367 MPU_FILTER_2100HZ_NOLPF,
368 NUM_MPU_FILTER
369};
370
371enum mpu_fullscale {
372 MPU_FS_250DPS = 0,
373 MPU_FS_500DPS,
374 MPU_FS_1000DPS,
375 MPU_FS_2000DPS,
376 NUM_MPU_FS
377};
378
379enum mpu_clock_sel {
380 MPU_CLK_SEL_INTERNAL = 0,
381 MPU_CLK_SEL_PLLGYROX,
382 MPU_CLK_SEL_PLLGYROY,
383 MPU_CLK_SEL_PLLGYROZ,
384 MPU_CLK_SEL_PLLEXT32K,
385 MPU_CLK_SEL_PLLEXT19M,
386 MPU_CLK_SEL_RESERVED,
387 MPU_CLK_SEL_STOP,
388 NUM_CLK_SEL
389};
390
391enum mpu_ext_sync {
392 MPU_EXT_SYNC_NONE = 0,
393 MPU_EXT_SYNC_TEMP,
394 MPU_EXT_SYNC_GYROX,
395 MPU_EXT_SYNC_GYROY,
396 MPU_EXT_SYNC_GYROZ,
397 MPU_EXT_SYNC_ACCELX,
398 MPU_EXT_SYNC_ACCELY,
399 MPU_EXT_SYNC_ACCELZ,
400 NUM_MPU_EXT_SYNC
401};
402
403#define DLPF_FS_SYNC_VALUE(ext_sync, full_scale, lpf) \
404 ((ext_sync << 5) | (full_scale << 3) | lpf)
405
406#endif /* __IMU6000_H_ */
diff --git a/include/linux/mpu_v3.h b/include/linux/mpu_v3.h
new file mode 100644
index 00000000000..165632f01f4
--- /dev/null
+++ b/include/linux/mpu_v3.h
@@ -0,0 +1,503 @@
1/*
2 $License:
3 Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 $
18 */
19
20#ifndef __MPU_H_
21#define __MPU_H_
22
23#ifdef __KERNEL__
24#include <linux/types.h>
25#endif
26
27//#define MPL_IUS_BUILD
28
29#ifndef MPL_IUS_BUILD
30#define MPL_IKR_BUILD //IKR local copy
31#endif
32
33
34/**
35FEATURES DEFIED BY IKR
36*/
37#ifdef MPL_IKR_BUILD
38#define FEATURE_USES_MPU_ACCEL
39#define FEATURE_USES_9AXIS_FUSION
40#define FEATURE_USES_LPF
41#define FEATURE_USES_TIMERIRQ
42#define FEATURAE_USES_GM
43#endif //MPL_IKR_BUILD
44
45
46
47#ifdef M_HW
48#include "mpu6000.h"
49#else
50#include "mpu3050.h"
51#endif
52
53/* Number of axes on each sensor */
54#define GYRO_NUM_AXES (3)
55#define ACCEL_NUM_AXES (3)
56#define COMPASS_NUM_AXES (3)
57
58/* IOCTL commands for /dev/mpu */
59#define MPU_SET_MPU_CONFIG (0x00)
60#define MPU_SET_INT_CONFIG (0x01)
61#define MPU_SET_EXT_SYNC (0x02)
62#define MPU_SET_FULL_SCALE (0x03)
63#define MPU_SET_LPF (0x04)
64#define MPU_SET_CLK_SRC (0x05)
65#define MPU_SET_DIVIDER (0x06)
66#define MPU_SET_LEVEL_SHIFTER (0x07)
67#define MPU_SET_DMP_ENABLE (0x08)
68#define MPU_SET_FIFO_ENABLE (0x09)
69#define MPU_SET_DMP_CFG1 (0x0a)
70#define MPU_SET_DMP_CFG2 (0x0b)
71#define MPU_SET_OFFSET_TC (0x0c)
72#define MPU_SET_RAM (0x0d)
73
74#define MPU_SET_PLATFORM_DATA (0x0e)
75
76#define MPU_GET_MPU_CONFIG (0x80)
77#define MPU_GET_INT_CONFIG (0x81)
78#define MPU_GET_EXT_SYNC (0x82)
79#define MPU_GET_FULL_SCALE (0x83)
80#define MPU_GET_LPF (0x84)
81#define MPU_GET_CLK_SRC (0x85)
82#define MPU_GET_DIVIDER (0x86)
83#define MPU_GET_LEVEL_SHIFTER (0x87)
84#define MPU_GET_DMP_ENABLE (0x88)
85#define MPU_GET_FIFO_ENABLE (0x89)
86#define MPU_GET_DMP_CFG1 (0x8a)
87#define MPU_GET_DMP_CFG2 (0x8b)
88#define MPU_GET_OFFSET_TC (0x8c)
89#define MPU_GET_RAM (0x8d)
90
91#define MPU_READ_REGISTER (0x40)
92#define MPU_WRITE_REGISTER (0x41)
93#define MPU_READ_MEMORY (0x42)
94#define MPU_WRITE_MEMORY (0x43)
95
96#define MPU_SUSPEND (0x44)
97#define MPU_RESUME (0x45)
98#define MPU_READ_COMPASS (0x46)
99#define MPU_READ_ACCEL (0x47)
100#define MPU_READ_PRESSURE (0x48)
101
102#define MPU_CONFIG_ACCEL (0x20)
103#define MPU_CONFIG_COMPASS (0x21)
104#define MPU_CONFIG_PRESSURE (0x22)
105
106#define MPU_GET_CONFIG_ACCEL (0x28)
107#define MPU_GET_CONFIG_COMPASS (0x29)
108#define MPU_GET_CONFIG_PRESSURE (0x2a)
109
110/* Structure for the following IOCTL's:
111 MPU_SET_RAM
112 MPU_GET_RAM
113 MPU_READ_REGISTER
114 MPU_WRITE_REGISTER
115 MPU_READ_MEMORY
116 MPU_WRITE_MEMORY
117*/
118struct mpu_read_write {
119 unsigned short address;
120 unsigned short length;
121 unsigned char *data;
122};
123
124struct mpuirq_data {
125 int interruptcount;
126 unsigned long long irqtime;
127 int data_type;
128 int data_size;
129 void *data;
130};
131enum ext_slave_config_key {
132 MPU_SLAVE_CONFIG_ODR_SUSPEND,
133 MPU_SLAVE_CONFIG_ODR_RESUME,
134 MPU_SLAVE_CONFIG_FSR_SUSPEND,
135 MPU_SLAVE_CONFIG_FSR_RESUME,
136 MPU_SLAVE_CONFIG_MOT_THS,
137 MPU_SLAVE_CONFIG_NMOT_THS,
138 MPU_SLAVE_CONFIG_MOT_DUR,
139 MPU_SLAVE_CONFIG_NMOT_DUR,
140 MPU_SLAVE_CONFIG_IRQ_SUSPEND,
141 MPU_SLAVE_CONFIG_IRQ_RESUME,
142 MPU_SLAVE_CONFIG_NUM_CONFIG_KEYS,
143};
144
145/* For the MPU_SLAVE_CONFIG_IRQ_SUSPEND and MPU_SLAVE_CONFIG_IRQ_RESUME */
146enum ext_slave_config_irq_type {
147 MPU_SLAVE_IRQ_TYPE_NONE,
148 MPU_SLAVE_IRQ_TYPE_MOTION,
149 MPU_SLAVE_IRQ_TYPE_DATA_READY,
150};
151
152/* Structure for the following IOCTS's
153 * MPU_CONFIG_ACCEL
154 * MPU_CONFIG_COMPASS
155 * MPU_CONFIG_PRESSURE
156 * MPU_GET_CONFIG_ACCEL
157 * MPU_GET_CONFIG_COMPASS
158 * MPU_GET_CONFIG_PRESSURE
159 */
160struct ext_slave_config {
161 int key;
162 int len;
163 int apply;
164 void *data;
165};
166
167enum ext_slave_type {
168 EXT_SLAVE_TYPE_GYROSCOPE,
169 EXT_SLAVE_TYPE_ACCELEROMETER,
170 EXT_SLAVE_TYPE_COMPASS,
171 EXT_SLAVE_TYPE_PRESSURE,
172 /*EXT_SLAVE_TYPE_TEMPERATURE */
173};
174
175enum ext_slave_id {
176 ID_INVALID = 0,
177
178 ACCEL_ID_LIS331,
179 ACCEL_ID_LSM303,
180 ACCEL_ID_KXSD9,
181 ACCEL_ID_KXTF9,
182 ACCEL_ID_BMA150,
183 ACCEL_ID_BMA222,
184 ACCEL_ID_BMA250,
185 ACCEL_ID_ADI346,
186 ACCEL_ID_MMA8450,
187 ACCEL_ID_MMA845X,
188 ACCEL_ID_MPU6000,
189 ACCEL_ID_LIS3DH,
190
191 COMPASS_ID_AKM,
192 COMPASS_ID_AMI30X,
193 COMPASS_ID_YAS529,
194 COMPASS_ID_YAS530,
195 COMPASS_ID_HMC5883,
196 COMPASS_ID_LSM303,
197 COMPASS_ID_MMC314X,
198 COMPASS_ID_MMC328X, //MEMSIC328X
199 COMPASS_ID_HSCDTD002B,
200 COMPASS_ID_HSCDTD004A,
201 COMPASS_ID_AMS0303,
202
203 PRESSURE_ID_BMA085,
204};
205
206enum ext_slave_endian {
207 EXT_SLAVE_BIG_ENDIAN,
208 EXT_SLAVE_LITTLE_ENDIAN,
209 EXT_SLAVE_FS8_BIG_ENDIAN,
210 EXT_SLAVE_FS16_BIG_ENDIAN,
211};
212
213enum ext_slave_bus {
214 EXT_SLAVE_BUS_INVALID = -1,
215 EXT_SLAVE_BUS_PRIMARY = 0,
216 EXT_SLAVE_BUS_SECONDARY = 1
217};
218
219
220/**
221 * struct ext_slave_platform_data - Platform data for mpu3050 slave devices
222 *
223 * @get_slave_descr: Function pointer to retrieve the struct ext_slave_descr
224 * for this slave
225 * @irq: the irq number attached to the slave if any.
226 * @adapt_num: the I2C adapter number.
227 * @bus: the bus the slave is attached to: enum ext_slave_bus
228 * @address: the I2C slave address of the slave device.
229 * @orientation: the mounting matrix of the device relative to MPU.
230 * @irq_data: private data for the slave irq handler
231 * @private_data: additional data, user customizable. Not touched by the MPU
232 * driver.
233 *
234 * The orientation matricies are 3x3 rotation matricies
235 * that are applied to the data to rotate from the mounting orientation to the
236 * platform orientation. The values must be one of 0, 1, or -1 and each row and
237 * column should have exactly 1 non-zero value.
238 */
239struct ext_slave_platform_data {
240 struct ext_slave_descr *(*get_slave_descr) (void);
241 int irq;
242 int adapt_num;
243 int bus;
244 unsigned char address;
245 signed char orientation[9];
246 void *irq_data;
247 void *private_data;
248};
249
250
251struct tFixPntRange {
252 long mantissa;
253 long fraction;
254};
255
256/**
257 * struct ext_slave_descr - Description of the slave device for programming.
258 *
259 * @suspend: function pointer to put the device in suspended state
260 * @resume: function pointer to put the device in running state
261 * @read: function that reads the device data
262 * @init: function used to preallocate memory used by the driver
263 * @exit: function used to free memory allocated for the driver
264 * @config: function used to configure the device
265 * @get_config:function used to get the device's configuration
266 *
267 * @name: text name of the device
268 * @type: device type. enum ext_slave_type
269 * @id: enum ext_slave_id
270 * @reg: starting register address to retrieve data.
271 * @len: length in bytes of the sensor data. Should be 6.
272 * @endian: byte order of the data. enum ext_slave_endian
273 * @range: full scale range of the slave ouput: struct tFixPntRange
274 *
275 * Defines the functions and information about the slave the mpu3050 needs to
276 * use the slave device.
277 */
278struct ext_slave_descr {
279 int (*init) (void *mlsl_handle,
280 struct ext_slave_descr *slave,
281 struct ext_slave_platform_data *pdata);
282 int (*exit) (void *mlsl_handle,
283 struct ext_slave_descr *slave,
284 struct ext_slave_platform_data *pdata);
285 int (*suspend) (void *mlsl_handle,
286 struct ext_slave_descr *slave,
287 struct ext_slave_platform_data *pdata);
288 int (*resume) (void *mlsl_handle,
289 struct ext_slave_descr *slave,
290 struct ext_slave_platform_data *pdata);
291 int (*read) (void *mlsl_handle,
292 struct ext_slave_descr *slave,
293 struct ext_slave_platform_data *pdata,
294 unsigned char *data);
295 int (*config) (void *mlsl_handle,
296 struct ext_slave_descr *slave,
297 struct ext_slave_platform_data *pdata,
298 struct ext_slave_config *config);
299 int (*get_config) (void *mlsl_handle,
300 struct ext_slave_descr *slave,
301 struct ext_slave_platform_data *pdata,
302 struct ext_slave_config *config);
303
304 char *name;
305 unsigned char type;
306 unsigned char id;
307 unsigned char reg;
308 unsigned int len;
309 unsigned char endian;
310 struct tFixPntRange range;
311};
312
313/**
314 * struct mpu3050_platform_data - Platform data for the mpu3050 driver
315 * @int_config: Bits [7:3] of the int config register.
316 * @orientation: Orientation matrix of the gyroscope
317 * @level_shifter: 0: VLogic, 1: VDD
318 * @accel: Accel platform data
319 * @compass: Compass platform data
320 * @pressure: Pressure platform data
321 *
322 * Contains platform specific information on how to configure the MPU3050 to
323 * work on this platform. The orientation matricies are 3x3 rotation matricies
324 * that are applied to the data to rotate from the mounting orientation to the
325 * platform orientation. The values must be one of 0, 1, or -1 and each row and
326 * column should have exactly 1 non-zero value.
327 */
328struct mpu3050_platform_data {
329 unsigned char int_config;
330 signed char orientation[MPU_NUM_AXES * MPU_NUM_AXES];
331 unsigned char level_shifter;
332 struct ext_slave_platform_data accel;
333 struct ext_slave_platform_data compass;
334 struct ext_slave_platform_data pressure;
335};
336
337
338/*
339 Accelerometer
340*/
341#define get_accel_slave_descr NULL
342
343#ifdef CONFIG_MPU_SENSORS_ADXL346_V3 /* ADI accelerometer */
344struct ext_slave_descr *adxl346_get_slave_descr(void);
345#undef get_accel_slave_descr
346#define get_accel_slave_descr adxl346_get_slave_descr
347#endif
348
349#ifdef CONFIG_MPU_SENSORS_BMA150_V3 /* Bosch accelerometer */
350struct ext_slave_descr *bma150_get_slave_descr(void);
351#undef get_accel_slave_descr
352#define get_accel_slave_descr bma150_get_slave_descr
353#endif
354
355#ifdef CONFIG_MPU_SENSORS_BMA222_V3 /* Bosch 222 accelerometer */
356struct ext_slave_descr *bma222_get_slave_descr(void);
357#undef get_accel_slave_descr
358#define get_accel_slave_descr bma222_get_slave_descr
359#endif
360
361#ifdef CONFIG_MPU_SENSORS_BMA250_V3 /* Bosch 250 accelerometer */
362struct ext_slave_descr *bma250_get_slave_descr(void);
363#undef get_accel_slave_descr
364#define get_accel_slave_descr bma250_get_slave_descr
365#endif
366
367#ifdef CONFIG_MPU_SENSORS_KXSD9_V3 /* Kionix accelerometer */
368struct ext_slave_descr *kxsd9_get_slave_descr(void);
369#undef get_accel_slave_descr
370#define get_accel_slave_descr kxsd9_get_slave_descr
371#endif
372
373#ifdef CONFIG_MPU_SENSORS_KXTF9_V3 /* Kionix accelerometer */
374struct ext_slave_descr *kxtf9_get_slave_descr(void);
375#undef get_accel_slave_descr
376#define get_accel_slave_descr kxtf9_get_slave_descr
377#endif
378
379#ifdef CONFIG_MPU_SENSORS_LIS331DLH_V3 /* ST accelerometer */
380struct ext_slave_descr *lis331dlh_get_slave_descr(void);
381#undef get_accel_slave_descr
382#define get_accel_slave_descr lis331dlh_get_slave_descr
383#endif
384
385
386#ifdef CONFIG_MPU_SENSORS_LIS3DH_V3 /* ST accelerometer */
387struct ext_slave_descr *lis3dh_get_slave_descr(void);
388#undef get_accel_slave_descr
389#define get_accel_slave_descr lis3dh_get_slave_descr
390#endif
391
392#ifdef CONFIG_MPU_SENSORS_LSM303DLHA_V3 /* ST accelerometer */
393struct ext_slave_descr *lsm303dlha_get_slave_descr(void);
394#undef get_accel_slave_descr
395#define get_accel_slave_descr lsm303dlha_get_slave_descr
396#endif
397
398/* MPU6000 Accel */
399#if defined(CONFIG_MPU_SENSORS_MPU6000_V3) || \
400 defined(CONFIG_MPU_SENSORS_MPU6000_MODULE_V3)
401struct ext_slave_descr *mantis_get_slave_descr(void);
402#undef get_accel_slave_descr
403#define get_accel_slave_descr mantis_get_slave_descr
404#endif
405
406#ifdef CONFIG_MPU_SENSORS_MMA8450_V3 /* Freescale accelerometer */
407struct ext_slave_descr *mma8450_get_slave_descr(void);
408#undef get_accel_slave_descr
409#define get_accel_slave_descr mma8450_get_slave_descr
410#endif
411
412#ifdef CONFIG_MPU_SENSORS_MMA845X_V3 /* Freescale accelerometer */
413struct ext_slave_descr *mma845x_get_slave_descr(void);
414#undef get_accel_slave_descr
415#define get_accel_slave_descr mma845x_get_slave_descr
416#endif
417
418
419/*
420 Compass
421*/
422#define get_compass_slave_descr NULL
423
424#ifdef CONFIG_MPU_SENSORS_AK8975_V3 /* AKM compass */
425struct ext_slave_descr *ak8975_get_slave_descr(void);
426#undef get_compass_slave_descr
427#define get_compass_slave_descr ak8975_get_slave_descr
428#endif
429
430#ifdef CONFIG_MPU_SENSORS_AMI30X_V3 /* AICHI Steel compass */
431struct ext_slave_descr *ami30x_get_slave_descr(void);
432#undef get_compass_slave_descr
433#define get_compass_slave_descr ami30x_get_slave_descr
434#endif
435
436#ifdef CONFIG_MPU_SENSORS_HMC5883_V3 /* Honeywell compass */
437struct ext_slave_descr *hmc5883_get_slave_descr(void);
438#undef get_compass_slave_descr
439#define get_compass_slave_descr hmc5883_get_slave_descr
440#endif
441
442#ifdef CONFIG_MPU_SENSORS_MMC314X_V3 /* MEMSIC compass */
443struct ext_slave_descr *mmc314x_get_slave_descr(void);
444#undef get_compass_slave_descr
445#define get_compass_slave_descr mmc314x_get_slave_descr
446#endif
447
448#ifdef CONFIG_MPU_SENSORS_MMC328X_V3 /* MEMSIC compass */
449struct ext_slave_descr *mmc328x_get_slave_descr(void);
450#undef get_compass_slave_descr
451#define get_compass_slave_descr mmc328x_get_slave_descr
452#endif
453
454#ifdef CONFIG_MPU_SENSORS_LSM303DLHM_V3 /* ST compass */
455struct ext_slave_descr *lsm303dlhm_get_slave_descr(void);
456#undef get_compass_slave_descr
457#define get_compass_slave_descr lsm303dlhm_get_slave_descr
458#endif
459
460#ifdef CONFIG_MPU_SENSORS_YAS529_V3 /* Yamaha compass */
461struct ext_slave_descr *yas529_get_slave_descr(void);
462#undef get_compass_slave_descr
463#define get_compass_slave_descr yas529_get_slave_descr
464#endif
465
466#ifdef CONFIG_MPU_SENSORS_YAS530_V3 /* Yamaha compass */
467struct ext_slave_descr *yas530_get_slave_descr(void);
468#undef get_compass_slave_descr
469#define get_compass_slave_descr yas530_get_slave_descr
470#endif
471
472#ifdef CONFIG_MPU_SENSORS_HSCDTD002B_V3 /* Alps HSCDTD002B compass */
473struct ext_slave_descr *hscdtd002b_get_slave_descr(void);
474#undef get_compass_slave_descr
475#define get_compass_slave_descr hscdtd002b_get_slave_descr
476#endif
477
478#ifdef CONFIG_MPU_SENSORS_HSCDTD004A_V3 /* Alps HSCDTD004A compass */
479struct ext_slave_descr *hscdtd004a_get_slave_descr(void);
480#undef get_compass_slave_descr
481#define get_compass_slave_descr hscdtd004a_get_slave_descr
482#endif
483
484#ifdef CONFIG_MPU_SENSORS_AMS0303_V3 /* Amotech ams0303 compass */
485struct ext_slave_descr *ams0303_get_slave_descr(void);
486#undef get_compass_slave_descr
487#define get_compass_slave_descr ams0303_get_slave_descr
488#endif
489
490
491/*
492 Pressure
493*/
494#define get_pressure_slave_descr NULL
495
496#ifdef CONFIG_MPU_SENSORS_BMA085_V3 /* BMA pressure */
497struct ext_slave_descr *bma085_get_slave_descr(void);
498#undef get_pressure_slave_descr
499#define get_pressure_slave_descr bma085_get_slave_descr
500#endif
501
502#endif /* __MPU_H_ */
503
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index 34066e65fde..f38d4f0a5ae 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -101,6 +101,7 @@ struct __fat_dirent {
101/* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */ 101/* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */
102#define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32) 102#define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32)
103#define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32) 103#define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32)
104#define VFAT_IOCTL_GET_VOLUME_ID _IOR('r', 0x12, __u32)
104 105
105struct fat_boot_sector { 106struct fat_boot_sector {
106 __u8 ignored[3]; /* Boot strap short or near jump */ 107 __u8 ignored[3]; /* Boot strap short or near jump */
@@ -138,6 +139,17 @@ struct fat_boot_fsinfo {
138 __le32 reserved2[4]; 139 __le32 reserved2[4];
139}; 140};
140 141
142struct fat_boot_bsx {
143 __u8 drive; /* drive number */
144 __u8 reserved1;
145 __u8 signature; /* extended boot signature */
146 __u8 vol_id[4]; /* volume ID */
147 __u8 vol_label[11]; /* volume label */
148 __u8 type[8]; /* file system type */
149};
150#define FAT16_BSX_OFFSET 36 /* offset of fat_boot_bsx in FAT12 and FAT16 */
151#define FAT32_BSX_OFFSET 64 /* offset of fat_boot_bsx in FAT32 */
152
141struct msdos_dir_entry { 153struct msdos_dir_entry {
142 __u8 name[MSDOS_NAME];/* name and extension */ 154 __u8 name[MSDOS_NAME];/* name and extension */
143 __u8 attr; /* attribute bits */ 155 __u8 attr; /* attribute bits */
diff --git a/include/linux/netfilter/xt_qtaguid.h b/include/linux/netfilter/xt_qtaguid.h
new file mode 100644
index 00000000000..ca60fbdec2f
--- /dev/null
+++ b/include/linux/netfilter/xt_qtaguid.h
@@ -0,0 +1,13 @@
1#ifndef _XT_QTAGUID_MATCH_H
2#define _XT_QTAGUID_MATCH_H
3
4/* For now we just replace the xt_owner.
5 * FIXME: make iptables aware of qtaguid. */
6#include <linux/netfilter/xt_owner.h>
7
8#define XT_QTAGUID_UID XT_OWNER_UID
9#define XT_QTAGUID_GID XT_OWNER_GID
10#define XT_QTAGUID_SOCKET XT_OWNER_SOCKET
11#define xt_qtaguid_match_info xt_owner_match_info
12
13#endif /* _XT_QTAGUID_MATCH_H */
diff --git a/include/linux/netfilter/xt_quota2.h b/include/linux/netfilter/xt_quota2.h
new file mode 100644
index 00000000000..eadc6903314
--- /dev/null
+++ b/include/linux/netfilter/xt_quota2.h
@@ -0,0 +1,25 @@
1#ifndef _XT_QUOTA_H
2#define _XT_QUOTA_H
3
4enum xt_quota_flags {
5 XT_QUOTA_INVERT = 1 << 0,
6 XT_QUOTA_GROW = 1 << 1,
7 XT_QUOTA_PACKET = 1 << 2,
8 XT_QUOTA_NO_CHANGE = 1 << 3,
9 XT_QUOTA_MASK = 0x0F,
10};
11
12struct xt_quota_counter;
13
14struct xt_quota_mtinfo2 {
15 char name[15];
16 u_int8_t flags;
17
18 /* Comparison-invariant */
19 aligned_u64 quota;
20
21 /* Used internally by the kernel */
22 struct xt_quota_counter *master __attribute__((aligned(8)));
23};
24
25#endif /* _XT_QUOTA_H */
diff --git a/include/linux/netfilter/xt_socket.h b/include/linux/netfilter/xt_socket.h
index 26d7217bd4f..63594564831 100644
--- a/include/linux/netfilter/xt_socket.h
+++ b/include/linux/netfilter/xt_socket.h
@@ -11,4 +11,10 @@ struct xt_socket_mtinfo1 {
11 __u8 flags; 11 __u8 flags;
12}; 12};
13 13
14void xt_socket_put_sk(struct sock *sk);
15struct sock *xt_socket_get4_sk(const struct sk_buff *skb,
16 struct xt_action_param *par);
17struct sock *xt_socket_get6_sk(const struct sk_buff *skb,
18 struct xt_action_param *par);
19
14#endif /* _XT_SOCKET_H */ 20#endif /* _XT_SOCKET_H */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 6081493db68..10229f76bcc 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -51,6 +51,9 @@
51 * PG_hwpoison indicates that a page got corrupted in hardware and contains 51 * PG_hwpoison indicates that a page got corrupted in hardware and contains
52 * data with incorrect ECC bits that triggered a machine check. Accessing is 52 * data with incorrect ECC bits that triggered a machine check. Accessing is
53 * not safe since it may cause another machine check. Don't touch! 53 * not safe since it may cause another machine check. Don't touch!
54 *
55 * PG_wasactive reflects that a page previously was promoted to active status.
56 * Such pages should be considered higher priority for cleancache backends.
54 */ 57 */
55 58
56/* 59/*
@@ -104,6 +107,9 @@ enum pageflags {
104#ifdef CONFIG_MEMORY_FAILURE 107#ifdef CONFIG_MEMORY_FAILURE
105 PG_hwpoison, /* hardware poisoned page. Don't touch */ 108 PG_hwpoison, /* hardware poisoned page. Don't touch */
106#endif 109#endif
110#ifdef CONFIG_CLEANCACHE
111 PG_was_active,
112#endif
107#ifdef CONFIG_TRANSPARENT_HUGEPAGE 113#ifdef CONFIG_TRANSPARENT_HUGEPAGE
108 PG_compound_lock, 114 PG_compound_lock,
109#endif 115#endif
@@ -212,6 +218,10 @@ PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked)
212 218
213__PAGEFLAG(SlobFree, slob_free) 219__PAGEFLAG(SlobFree, slob_free)
214 220
221#ifdef CONFIG_CLEANCACHE
222PAGEFLAG(WasActive, was_active)
223#endif
224
215__PAGEFLAG(SlubFrozen, slub_frozen) 225__PAGEFLAG(SlubFrozen, slub_frozen)
216 226
217/* 227/*
diff --git a/include/linux/pda_power.h b/include/linux/pda_power.h
index c9e4d814ff7..2bb62bf296a 100644
--- a/include/linux/pda_power.h
+++ b/include/linux/pda_power.h
@@ -35,6 +35,8 @@ struct pda_power_pdata {
35 unsigned int polling_interval; /* msecs, default is 2000 */ 35 unsigned int polling_interval; /* msecs, default is 2000 */
36 36
37 unsigned long ac_max_uA; /* current to draw when on AC */ 37 unsigned long ac_max_uA; /* current to draw when on AC */
38
39 bool use_otg_notifier;
38}; 40};
39 41
40#endif /* __PDA_POWER_H__ */ 42#endif /* __PDA_POWER_H__ */
diff --git a/include/linux/platform_data/exynos_usb3_drd.h b/include/linux/platform_data/exynos_usb3_drd.h
new file mode 100644
index 00000000000..1bad86fddd5
--- /dev/null
+++ b/include/linux/platform_data/exynos_usb3_drd.h
@@ -0,0 +1,22 @@
1/* inlude/linux/platform_data/exynos_usb3_drd.h
2 *
3 * Copyright (c) 2012 Samsung Electronics Co. Ltd
4 * Author: Anton Tikhomirov <av.tikhomirov@samsung.com>
5 *
6 * EXYNOS SuperSpeed USB 3.0 DRD Controller platform data
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef _EXYNOS_USB3_DRD_H_
14#define _EXYNOS_USB3_DRD_H_
15
16struct exynos_usb3_drd_pdata {
17 int phy_type;
18 int (*phy_init)(struct platform_device *pdev, int type);
19 int (*phy_exit)(struct platform_device *pdev, int type);
20};
21
22#endif
diff --git a/include/linux/platform_data/ram_console.h b/include/linux/platform_data/ram_console.h
new file mode 100644
index 00000000000..9f1125c1106
--- /dev/null
+++ b/include/linux/platform_data/ram_console.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2010 Google, Inc.
3 *
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 */
14
15#ifndef _INCLUDE_LINUX_PLATFORM_DATA_RAM_CONSOLE_H_
16#define _INCLUDE_LINUX_PLATFORM_DATA_RAM_CONSOLE_H_
17
18struct ram_console_platform_data {
19 const char *bootinfo;
20};
21
22#endif /* _INCLUDE_LINUX_PLATFORM_DATA_RAM_CONSOLE_H_ */
diff --git a/include/linux/plist.h b/include/linux/plist.h
index c9b9f322c8d..aa0fb390bd2 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -77,14 +77,9 @@
77 77
78#include <linux/kernel.h> 78#include <linux/kernel.h>
79#include <linux/list.h> 79#include <linux/list.h>
80#include <linux/spinlock_types.h>
81 80
82struct plist_head { 81struct plist_head {
83 struct list_head node_list; 82 struct list_head node_list;
84#ifdef CONFIG_DEBUG_PI_LIST
85 raw_spinlock_t *rawlock;
86 spinlock_t *spinlock;
87#endif
88}; 83};
89 84
90struct plist_node { 85struct plist_node {
@@ -93,37 +88,13 @@ struct plist_node {
93 struct list_head node_list; 88 struct list_head node_list;
94}; 89};
95 90
96#ifdef CONFIG_DEBUG_PI_LIST
97# define PLIST_HEAD_LOCK_INIT(_lock) .spinlock = _lock
98# define PLIST_HEAD_LOCK_INIT_RAW(_lock) .rawlock = _lock
99#else
100# define PLIST_HEAD_LOCK_INIT(_lock)
101# define PLIST_HEAD_LOCK_INIT_RAW(_lock)
102#endif
103
104#define _PLIST_HEAD_INIT(head) \
105 .node_list = LIST_HEAD_INIT((head).node_list)
106
107/** 91/**
108 * PLIST_HEAD_INIT - static struct plist_head initializer 92 * PLIST_HEAD_INIT - static struct plist_head initializer
109 * @head: struct plist_head variable name 93 * @head: struct plist_head variable name
110 * @_lock: lock to initialize for this list
111 */
112#define PLIST_HEAD_INIT(head, _lock) \
113{ \
114 _PLIST_HEAD_INIT(head), \
115 PLIST_HEAD_LOCK_INIT(&(_lock)) \
116}
117
118/**
119 * PLIST_HEAD_INIT_RAW - static struct plist_head initializer
120 * @head: struct plist_head variable name
121 * @_lock: lock to initialize for this list
122 */ 94 */
123#define PLIST_HEAD_INIT_RAW(head, _lock) \ 95#define PLIST_HEAD_INIT(head) \
124{ \ 96{ \
125 _PLIST_HEAD_INIT(head), \ 97 .node_list = LIST_HEAD_INIT((head).node_list) \
126 PLIST_HEAD_LOCK_INIT_RAW(&(_lock)) \
127} 98}
128 99
129/** 100/**
@@ -141,31 +112,11 @@ struct plist_node {
141/** 112/**
142 * plist_head_init - dynamic struct plist_head initializer 113 * plist_head_init - dynamic struct plist_head initializer
143 * @head: &struct plist_head pointer 114 * @head: &struct plist_head pointer
144 * @lock: spinlock protecting the list (debugging)
145 */ 115 */
146static inline void 116static inline void
147plist_head_init(struct plist_head *head, spinlock_t *lock) 117plist_head_init(struct plist_head *head)
148{ 118{
149 INIT_LIST_HEAD(&head->node_list); 119 INIT_LIST_HEAD(&head->node_list);
150#ifdef CONFIG_DEBUG_PI_LIST
151 head->spinlock = lock;
152 head->rawlock = NULL;
153#endif
154}
155
156/**
157 * plist_head_init_raw - dynamic struct plist_head initializer
158 * @head: &struct plist_head pointer
159 * @lock: raw_spinlock protecting the list (debugging)
160 */
161static inline void
162plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock)
163{
164 INIT_LIST_HEAD(&head->node_list);
165#ifdef CONFIG_DEBUG_PI_LIST
166 head->rawlock = lock;
167 head->spinlock = NULL;
168#endif
169} 120}
170 121
171/** 122/**
diff --git a/include/linux/power/cpupower.h b/include/linux/power/cpupower.h
new file mode 100644
index 00000000000..9bc7039a03f
--- /dev/null
+++ b/include/linux/power/cpupower.h
@@ -0,0 +1,22 @@
1/*
2 * cpupower.h
3 *
4 * Copyright (c) 2011 Vincent Guittot <vincent.guittot@linaro.org>
5 *
6 * This file is released under the GPLv2
7 *
8 */
9
10#ifndef _CPUPOWER_H_
11#define _CPUPOWER_H_
12
13#define ARM_DEFAULT_SCALE 0
14#define ARM_POWER_SCALE 1
15
16struct cputopo_power {
17 int max; /* max idx in the table */
18 unsigned int step; /* frequency step for the table */
19 unsigned int *table; /* table of cpu_power */
20};
21
22#endif
diff --git a/include/linux/power/max17047_battery.h b/include/linux/power/max17047_battery.h
new file mode 100644
index 00000000000..9806eeca524
--- /dev/null
+++ b/include/linux/power/max17047_battery.h
@@ -0,0 +1,16 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 */
6
7#ifndef __MAX17047_BATTERY_H_
8#define __MAX17047_BATTERY_H_
9
10struct max17047_platform_data {
11 int (*battery_online)(void);
12 int (*charger_online)(void);
13 int (*charger_enable)(void);
14};
15
16#endif /* __MAX17047_BATTERY_H_ */
diff --git a/include/linux/power/max8677_charger.h b/include/linux/power/max8677_charger.h
new file mode 100644
index 00000000000..c7f20b630dc
--- /dev/null
+++ b/include/linux/power/max8677_charger.h
@@ -0,0 +1,39 @@
1/*
2 * max8903_charger.h - Maxim 8903 USB/Adapter Charger Driver
3 *
4 * Copyright (C) 2011 Samsung Electronics
5 * MyungJoo Ham <myungjoo.ham@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23#ifndef __MAX8677_CHARGER_H__
24#define __MAX8677_CHARGER_H__
25
26struct max8677_pdata {
27 /*
28 * GPIOs
29 * cen, chg, flt, and usus are optional.
30 * dok, dcm, and uok are not optional depending on the status of
31 * dc_valid and usb_valid.
32 */
33 int cen; /* Charger Enable input */
34 int uok; /* USB Power OK output */
35 int chg; /* Charger status output */
36 int done; /* Charging Done flag */
37};
38
39#endif /* __MAX8677_CHARGER_H__ */
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 204c18dfdc9..2287c321413 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -14,6 +14,7 @@
14#define __LINUX_POWER_SUPPLY_H__ 14#define __LINUX_POWER_SUPPLY_H__
15 15
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/wakelock.h>
17#include <linux/workqueue.h> 18#include <linux/workqueue.h>
18#include <linux/leds.h> 19#include <linux/leds.h>
19 20
@@ -163,6 +164,9 @@ struct power_supply {
163 /* private */ 164 /* private */
164 struct device *dev; 165 struct device *dev;
165 struct work_struct changed_work; 166 struct work_struct changed_work;
167 spinlock_t changed_lock;
168 bool changed;
169 struct wake_lock work_wake_lock;
166 170
167#ifdef CONFIG_LEDS_TRIGGERS 171#ifdef CONFIG_LEDS_TRIGGERS
168 struct led_trigger *charging_full_trig; 172 struct led_trigger *charging_full_trig;
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index 2e681d9555b..35872aa6554 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -10,18 +10,45 @@
10#include <linux/linkage.h> 10#include <linux/linkage.h>
11#include <linux/list.h> 11#include <linux/list.h>
12 12
13/* cannot include rcupdate.h here, so open-code this */
14
15#if defined(CONFIG_JRCU)
16# define __add_preempt_count(val) do { \
17 int newval = (preempt_count() += (val)); \
18 if (newval == (val)) \
19 smp_wmb(); \
20} while (0)
21#else
22# define __add_preempt_count(val) do { preempt_count() += (val); } while (0)
23#endif
24
25#if defined(CONFIG_JRCU_LAZY) || !defined(CONFIG_JRCU)
26# define __sub_preempt_count(val) do { preempt_count() -= (val); } while (0)
27#else
28# define __sub_preempt_count(val) do { \
29 int newval = (preempt_count() -= (val)); \
30 if (newval == 0) { \
31 /* race with preemption OK, preempt will do the mb for us */ \
32 smp_wmb(); \
33 } \
34} while (0)
35#endif
36
13#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER) 37#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER)
14 extern void add_preempt_count(int val); 38 extern void add_preempt_count(int val);
15 extern void sub_preempt_count(int val); 39 extern void sub_preempt_count(int val);
16#else 40#else
17# define add_preempt_count(val) do { preempt_count() += (val); } while (0) 41# define add_preempt_count(val) __add_preempt_count(val)
18# define sub_preempt_count(val) do { preempt_count() -= (val); } while (0) 42# define sub_preempt_count(val) __sub_preempt_count(val)
19#endif 43#endif
20 44
21#define inc_preempt_count() add_preempt_count(1) 45#define inc_preempt_count() add_preempt_count(1)
22#define dec_preempt_count() sub_preempt_count(1) 46#define dec_preempt_count() sub_preempt_count(1)
23 47
24#define preempt_count() (current_thread_info()->preempt_count) 48#define preempt_count() (current_thread_info()->preempt_count)
49#ifdef CONFIG_PREEMPT_COUNT_CPU
50extern int preempt_count_cpu(int cpu);
51#endif
25 52
26#ifdef CONFIG_PREEMPT 53#ifdef CONFIG_PREEMPT
27 54
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 033b507b33b..fcda1b2195f 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -130,6 +130,17 @@ static inline void rb_set_color(struct rb_node *rb, int color)
130} 130}
131 131
132#define RB_ROOT (struct rb_root) { NULL, } 132#define RB_ROOT (struct rb_root) { NULL, }
133
134static inline void rb_root_init(struct rb_root *root, struct rb_node *node)
135{
136 root->rb_node = node;
137 if (node) {
138 node->rb_parent_color = RB_BLACK; /* black, no parent */
139 node->rb_left = NULL;
140 node->rb_right = NULL;
141 }
142}
143
133#define rb_entry(ptr, type, member) container_of(ptr, type, member) 144#define rb_entry(ptr, type, member) container_of(ptr, type, member)
134 145
135#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL) 146#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL)
diff --git a/include/linux/rcu_types.h b/include/linux/rcu_types.h
new file mode 100644
index 00000000000..fd3570d0e6c
--- /dev/null
+++ b/include/linux/rcu_types.h
@@ -0,0 +1,18 @@
1#ifndef __LINUX_RCU_TYPES_H
2#define __LINUX_RCU_TYPES_H
3
4#ifdef __KERNEL__
5
6/**
7 * struct rcu_head - callback structure for use with RCU
8 * @next: next update requests in a list
9 * @func: actual update function to call after the grace period.
10 */
11struct rcu_head {
12 struct rcu_head *next;
13 void (*func)(struct rcu_head *head);
14};
15
16#endif
17
18#endif
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 99f9aa7c280..d13d2d577d2 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -33,6 +33,7 @@
33#ifndef __LINUX_RCUPDATE_H 33#ifndef __LINUX_RCUPDATE_H
34#define __LINUX_RCUPDATE_H 34#define __LINUX_RCUPDATE_H
35 35
36#include <linux/rcu_types.h>
36#include <linux/cache.h> 37#include <linux/cache.h>
37#include <linux/spinlock.h> 38#include <linux/spinlock.h>
38#include <linux/threads.h> 39#include <linux/threads.h>
@@ -64,16 +65,6 @@ static inline void rcutorture_record_progress(unsigned long vernum)
64#define ULONG_CMP_GE(a, b) (ULONG_MAX / 2 >= (a) - (b)) 65#define ULONG_CMP_GE(a, b) (ULONG_MAX / 2 >= (a) - (b))
65#define ULONG_CMP_LT(a, b) (ULONG_MAX / 2 < (a) - (b)) 66#define ULONG_CMP_LT(a, b) (ULONG_MAX / 2 < (a) - (b))
66 67
67/**
68 * struct rcu_head - callback structure for use with RCU
69 * @next: next update requests in a list
70 * @func: actual update function to call after the grace period.
71 */
72struct rcu_head {
73 struct rcu_head *next;
74 void (*func)(struct rcu_head *head);
75};
76
77/* Exported common interfaces */ 68/* Exported common interfaces */
78extern void call_rcu_sched(struct rcu_head *head, 69extern void call_rcu_sched(struct rcu_head *head,
79 void (*func)(struct rcu_head *rcu)); 70 void (*func)(struct rcu_head *rcu));
@@ -156,6 +147,8 @@ static inline void rcu_exit_nohz(void)
156#include <linux/rcutree.h> 147#include <linux/rcutree.h>
157#elif defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU) 148#elif defined(CONFIG_TINY_RCU) || defined(CONFIG_TINY_PREEMPT_RCU)
158#include <linux/rcutiny.h> 149#include <linux/rcutiny.h>
150#elif defined(CONFIG_JRCU)
151#include <linux/jrcu.h>
159#else 152#else
160#error "Unknown RCU implementation specified to kernel configuration" 153#error "Unknown RCU implementation specified to kernel configuration"
161#endif 154#endif
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index 8d522ffeda3..de17134244f 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -66,7 +66,7 @@ struct hrtimer_sleeper;
66 66
67#define __RT_MUTEX_INITIALIZER(mutexname) \ 67#define __RT_MUTEX_INITIALIZER(mutexname) \
68 { .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \ 68 { .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \
69 , .wait_list = PLIST_HEAD_INIT_RAW(mutexname.wait_list, mutexname.wait_lock) \ 69 , .wait_list = PLIST_HEAD_INIT(mutexname.wait_list) \
70 , .owner = NULL \ 70 , .owner = NULL \
71 __DEBUG_RT_MUTEX_INITIALIZER(mutexname)} 71 __DEBUG_RT_MUTEX_INITIALIZER(mutexname)}
72 72
@@ -100,7 +100,7 @@ extern void rt_mutex_unlock(struct rt_mutex *lock);
100 100
101#ifdef CONFIG_RT_MUTEXES 101#ifdef CONFIG_RT_MUTEXES
102# define INIT_RT_MUTEXES(tsk) \ 102# define INIT_RT_MUTEXES(tsk) \
103 .pi_waiters = PLIST_HEAD_INIT(tsk.pi_waiters, tsk.pi_lock), \ 103 .pi_waiters = PLIST_HEAD_INIT(tsk.pi_waiters), \
104 INIT_RT_MUTEX_DEBUG(tsk) 104 INIT_RT_MUTEX_DEBUG(tsk)
105#else 105#else
106# define INIT_RT_MUTEXES(tsk) 106# define INIT_RT_MUTEXES(tsk)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 443ec43bebe..1c44f22adae 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -901,6 +901,7 @@ struct sched_group_power {
901 * single CPU. 901 * single CPU.
902 */ 902 */
903 unsigned int power, power_orig; 903 unsigned int power, power_orig;
904 unsigned long next_update;
904}; 905};
905 906
906struct sched_group { 907struct sched_group {
@@ -1526,6 +1527,13 @@ struct task_struct {
1526 int make_it_fail; 1527 int make_it_fail;
1527#endif 1528#endif
1528 struct prop_local_single dirties; 1529 struct prop_local_single dirties;
1530 /*
1531 * when (nr_dirtied >= nr_dirtied_pause), it's time to call
1532 * balance_dirty_pages() for some dirty throttling pause
1533 */
1534 int nr_dirtied;
1535 int nr_dirtied_pause;
1536
1529#ifdef CONFIG_LATENCYTOP 1537#ifdef CONFIG_LATENCYTOP
1530 int latency_record_count; 1538 int latency_record_count;
1531 struct latency_record latency_record[LT_SAVECOUNT]; 1539 struct latency_record latency_record[LT_SAVECOUNT];
@@ -1754,6 +1762,9 @@ static inline void put_task_struct(struct task_struct *t)
1754extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st); 1762extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
1755extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st); 1763extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
1756 1764
1765extern int task_free_register(struct notifier_block *n);
1766extern int task_free_unregister(struct notifier_block *n);
1767
1757/* 1768/*
1758 * Per process flags 1769 * Per process flags
1759 */ 1770 */
@@ -1886,6 +1897,7 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
1886 * Please use one of the three interfaces below. 1897 * Please use one of the three interfaces below.
1887 */ 1898 */
1888extern unsigned long long notrace sched_clock(void); 1899extern unsigned long long notrace sched_clock(void);
1900extern unsigned long long notrace sched_clock_clksrc(void);
1889/* 1901/*
1890 * See the comment in kernel/sched_clock.c 1902 * See the comment in kernel/sched_clock.c
1891 */ 1903 */
@@ -1960,6 +1972,8 @@ extern void wake_up_idle_cpu(int cpu);
1960static inline void wake_up_idle_cpu(int cpu) { } 1972static inline void wake_up_idle_cpu(int cpu) { }
1961#endif 1973#endif
1962 1974
1975extern void force_cpu_resched(int cpu);
1976
1963extern unsigned int sysctl_sched_latency; 1977extern unsigned int sysctl_sched_latency;
1964extern unsigned int sysctl_sched_min_granularity; 1978extern unsigned int sysctl_sched_min_granularity;
1965extern unsigned int sysctl_sched_wakeup_granularity; 1979extern unsigned int sysctl_sched_wakeup_granularity;
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index a5c31146a33..0d239897b2f 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -245,6 +245,7 @@ struct uart_ops {
245 void (*pm)(struct uart_port *, unsigned int state, 245 void (*pm)(struct uart_port *, unsigned int state,
246 unsigned int oldstate); 246 unsigned int oldstate);
247 int (*set_wake)(struct uart_port *, unsigned int state); 247 int (*set_wake)(struct uart_port *, unsigned int state);
248 void (*wake_peer)(struct uart_port *);
248 249
249 /* 250 /*
250 * Return a string describing the type of the port 251 * Return a string describing the type of the port
diff --git a/include/linux/slab.h b/include/linux/slab.h
index ad4dd1c8d30..3ea67d7bba6 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -79,6 +79,10 @@
79/* The following flags affect the page allocator grouping pages by mobility */ 79/* The following flags affect the page allocator grouping pages by mobility */
80#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */ 80#define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Objects are reclaimable */
81#define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */ 81#define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are short-lived */
82
83/* Following flags should only be used by allocator specific flags */
84#define SLAB_ALLOC_PRIVATE 0x000000ffUL
85
82/* 86/*
83 * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests. 87 * ZERO_SIZE_PTR will be returned for zero sized kmalloc requests.
84 * 88 *
@@ -163,6 +167,8 @@ size_t ksize(const void *);
163 */ 167 */
164#ifdef CONFIG_SLUB 168#ifdef CONFIG_SLUB
165#include <linux/slub_def.h> 169#include <linux/slub_def.h>
170#elif defined(CONFIG_SLQB)
171#include <linux/slqb_def.h>
166#elif defined(CONFIG_SLOB) 172#elif defined(CONFIG_SLOB)
167#include <linux/slob_def.h> 173#include <linux/slob_def.h>
168#else 174#else
@@ -265,7 +271,7 @@ static inline void *kmem_cache_alloc_node(struct kmem_cache *cachep,
265 * allocator where we care about the real place the memory allocation 271 * allocator where we care about the real place the memory allocation
266 * request comes from. 272 * request comes from.
267 */ 273 */
268#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \ 274#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || defined(CONFIG_SLQB_DEBUG) || \
269 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) 275 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING))
270extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long); 276extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);
271#define kmalloc_track_caller(size, flags) \ 277#define kmalloc_track_caller(size, flags) \
@@ -284,7 +290,7 @@ extern void *__kmalloc_track_caller(size_t, gfp_t, unsigned long);
284 * standard allocator where we care about the real place the memory 290 * standard allocator where we care about the real place the memory
285 * allocation request comes from. 291 * allocation request comes from.
286 */ 292 */
287#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || \ 293#if defined(CONFIG_DEBUG_SLAB) || defined(CONFIG_SLUB) || defined(CONFIG_SLQB_DEBUG) || \
288 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING)) 294 (defined(CONFIG_SLAB) && defined(CONFIG_TRACING))
289extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long); 295extern void *__kmalloc_node_track_caller(size_t, gfp_t, int, unsigned long);
290#define kmalloc_node_track_caller(size, flags, node) \ 296#define kmalloc_node_track_caller(size, flags, node) \
diff --git a/include/linux/slqb_def.h b/include/linux/slqb_def.h
new file mode 100644
index 00000000000..1cb68cc9663
--- /dev/null
+++ b/include/linux/slqb_def.h
@@ -0,0 +1,300 @@
1#ifndef _LINUX_SLQB_DEF_H
2#define _LINUX_SLQB_DEF_H
3
4/*
5 * SLQB : A slab allocator with object queues.
6 *
7 * (C) 2008 Nick Piggin <npiggin@suse.de>
8 */
9#include <linux/types.h>
10#include <linux/gfp.h>
11#include <linux/workqueue.h>
12#include <linux/kobject.h>
13#include <linux/rcu_types.h>
14#include <linux/mm_types.h>
15#include <linux/kernel.h>
16
17#define SLAB_NUMA 0x00000001UL /* shortcut */
18
19enum stat_item {
20 ALLOC, /* Allocation count */
21 ALLOC_SLAB_FILL, /* Fill freelist from page list */
22 ALLOC_SLAB_NEW, /* New slab acquired from page allocator */
23 FREE, /* Free count */
24 FREE_REMOTE, /* NUMA: freeing to remote list */
25 FLUSH_FREE_LIST, /* Freelist flushed */
26 FLUSH_FREE_LIST_OBJECTS, /* Objects flushed from freelist */
27 FLUSH_FREE_LIST_REMOTE, /* Objects flushed from freelist to remote */
28 FLUSH_SLAB_PARTIAL, /* Freeing moves slab to partial list */
29 FLUSH_SLAB_FREE, /* Slab freed to the page allocator */
30 FLUSH_RFREE_LIST, /* Rfree list flushed */
31 FLUSH_RFREE_LIST_OBJECTS, /* Rfree objects flushed */
32 CLAIM_REMOTE_LIST, /* Remote freed list claimed */
33 CLAIM_REMOTE_LIST_OBJECTS, /* Remote freed objects claimed */
34 NR_SLQB_STAT_ITEMS
35};
36
37/*
38 * Singly-linked list with head, tail, and nr
39 */
40struct kmlist {
41 unsigned long nr;
42 void **head;
43 void **tail;
44};
45
46/*
47 * Every kmem_cache_list has a kmem_cache_remote_free structure, by which
48 * objects can be returned to the kmem_cache_list from remote CPUs.
49 */
50struct kmem_cache_remote_free {
51 spinlock_t lock;
52 struct kmlist list;
53} ____cacheline_aligned;
54
55/*
56 * A kmem_cache_list manages all the slabs and objects allocated from a given
57 * source. Per-cpu kmem_cache_lists allow node-local allocations. Per-node
58 * kmem_cache_lists allow off-node allocations (but require locking).
59 */
60struct kmem_cache_list {
61 /* Fastpath LIFO freelist of objects */
62 struct kmlist freelist;
63#ifdef CONFIG_SMP
64 /* remote_free has reached a watermark */
65 int remote_free_check;
66#endif
67 /* kmem_cache corresponding to this list */
68 struct kmem_cache *cache;
69
70 /* Number of partial slabs (pages) */
71 unsigned long nr_partial;
72
73 /* Slabs which have some free objects */
74 struct list_head partial;
75
76 /* Total number of slabs allocated */
77 unsigned long nr_slabs;
78
79 /* Protects nr_partial, nr_slabs, and partial */
80 spinlock_t page_lock;
81
82#ifdef CONFIG_SMP
83 /*
84 * In the case of per-cpu lists, remote_free is for objects freed by
85 * non-owner CPU back to its home list. For per-node lists, remote_free
86 * is always used to free objects.
87 */
88 struct kmem_cache_remote_free remote_free;
89#endif
90
91#ifdef CONFIG_SLQB_STATS
92 unsigned long stats[NR_SLQB_STAT_ITEMS];
93#endif
94} ____cacheline_aligned;
95
96/*
97 * Primary per-cpu, per-kmem_cache structure.
98 */
99struct kmem_cache_cpu {
100 struct kmem_cache_list list; /* List for node-local slabs */
101 unsigned int colour_next; /* Next colour offset to use */
102
103#ifdef CONFIG_SMP
104 /*
105 * rlist is a list of objects that don't fit on list.freelist (ie.
106 * wrong node). The objects all correspond to a given kmem_cache_list,
107 * remote_cache_list. To free objects to another list, we must first
108 * flush the existing objects, then switch remote_cache_list.
109 *
110 * An NR_CPUS or MAX_NUMNODES array would be nice here, but then we
111 * get to O(NR_CPUS^2) memory consumption situation.
112 */
113 struct kmlist rlist;
114 struct kmem_cache_list *remote_cache_list;
115#endif
116} ____cacheline_aligned_in_smp;
117
118/*
119 * Per-node, per-kmem_cache structure. Used for node-specific allocations.
120 */
121struct kmem_cache_node {
122 struct kmem_cache_list list;
123 spinlock_t list_lock; /* protects access to list */
124} ____cacheline_aligned;
125
126/*
127 * Management object for a slab cache.
128 */
129struct kmem_cache {
130 unsigned long flags;
131 int hiwater; /* LIFO list high watermark */
132 int freebatch; /* LIFO freelist batch flush size */
133#ifdef CONFIG_SMP
134 struct kmem_cache_cpu **cpu_slab; /* dynamic per-cpu structures */
135#else
136 struct kmem_cache_cpu cpu_slab;
137#endif
138 int objsize; /* Size of object without meta data */
139 int offset; /* Free pointer offset. */
140 int objects; /* Number of objects in slab */
141
142#ifdef CONFIG_NUMA
143 struct kmem_cache_node **node_slab; /* dynamic per-node structures */
144#endif
145
146 int size; /* Size of object including meta data */
147 int order; /* Allocation order */
148 gfp_t allocflags; /* gfp flags to use on allocation */
149 unsigned int colour_range; /* range of colour counter */
150 unsigned int colour_off; /* offset per colour */
151 void (*ctor)(void *);
152
153 const char *name; /* Name (only for display!) */
154 struct list_head list; /* List of slab caches */
155
156 int align; /* Alignment */
157 int inuse; /* Offset to metadata */
158
159#ifdef CONFIG_SLQB_SYSFS
160 struct kobject kobj; /* For sysfs */
161#endif
162} ____cacheline_aligned;
163
164/*
165 * Kmalloc subsystem.
166 */
167#if defined(ARCH_KMALLOC_MINALIGN) && ARCH_KMALLOC_MINALIGN > 8
168#define KMALLOC_MIN_SIZE ARCH_KMALLOC_MINALIGN
169#else
170#define KMALLOC_MIN_SIZE 8
171#endif
172
173#define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE)
174#define KMALLOC_SHIFT_SLQB_HIGH (PAGE_SHIFT + \
175 ((9 <= (MAX_ORDER - 1)) ? 9 : (MAX_ORDER - 1)))
176
177extern struct kmem_cache kmalloc_caches[KMALLOC_SHIFT_SLQB_HIGH + 1];
178extern struct kmem_cache kmalloc_caches_dma[KMALLOC_SHIFT_SLQB_HIGH + 1];
179
180/*
181 * Constant size allocations use this path to find index into kmalloc caches
182 * arrays. get_slab() function is used for non-constant sizes.
183 */
184static __always_inline int kmalloc_index(size_t size)
185{
186 extern int ____kmalloc_too_large(void);
187
188 if (unlikely(size <= KMALLOC_MIN_SIZE))
189 return KMALLOC_SHIFT_LOW;
190
191#if L1_CACHE_BYTES < 64
192 if (size > 64 && size <= 96)
193 return 1;
194#endif
195#if L1_CACHE_BYTES < 128
196 if (size > 128 && size <= 192)
197 return 2;
198#endif
199 if (size <= 8) return 3;
200 if (size <= 16) return 4;
201 if (size <= 32) return 5;
202 if (size <= 64) return 6;
203 if (size <= 128) return 7;
204 if (size <= 256) return 8;
205 if (size <= 512) return 9;
206 if (size <= 1024) return 10;
207 if (size <= 2 * 1024) return 11;
208 if (size <= 4 * 1024) return 12;
209 if (size <= 8 * 1024) return 13;
210 if (size <= 16 * 1024) return 14;
211 if (size <= 32 * 1024) return 15;
212 if (size <= 64 * 1024) return 16;
213 if (size <= 128 * 1024) return 17;
214 if (size <= 256 * 1024) return 18;
215 if (size <= 512 * 1024) return 19;
216 if (size <= 1024 * 1024) return 20;
217 if (size <= 2 * 1024 * 1024) return 21;
218 if (size <= 4 * 1024 * 1024) return 22;
219 if (size <= 8 * 1024 * 1024) return 23;
220 if (size <= 16 * 1024 * 1024) return 24;
221 if (size <= 32 * 1024 * 1024) return 25;
222 return ____kmalloc_too_large();
223}
224
225#ifdef CONFIG_ZONE_DMA
226#define SLQB_DMA __GFP_DMA
227#else
228/* Disable "DMA slabs" */
229#define SLQB_DMA (__force gfp_t)0
230#endif
231
232/*
233 * Find the kmalloc slab cache for a given combination of allocation flags and
234 * size. Should really only be used for constant 'size' arguments, due to
235 * bloat.
236 */
237static __always_inline struct kmem_cache *kmalloc_slab(size_t size, gfp_t flags)
238{
239 int index;
240
241 if (unlikely(size > 1UL << KMALLOC_SHIFT_SLQB_HIGH))
242 return NULL;
243 if (unlikely(!size))
244 return ZERO_SIZE_PTR;
245
246 index = kmalloc_index(size);
247 if (likely(!(flags & SLQB_DMA)))
248 return &kmalloc_caches[index];
249 else
250 return &kmalloc_caches_dma[index];
251}
252
253void *kmem_cache_alloc(struct kmem_cache *, gfp_t);
254void *__kmalloc(size_t size, gfp_t flags);
255
256#ifndef ARCH_KMALLOC_MINALIGN
257#define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long)
258#endif
259
260#ifndef ARCH_SLAB_MINALIGN
261#define ARCH_SLAB_MINALIGN __alignof__(unsigned long long)
262#endif
263
264#define KMALLOC_HEADER (ARCH_KMALLOC_MINALIGN < sizeof(void *) ? \
265 sizeof(void *) : ARCH_KMALLOC_MINALIGN)
266
267static __always_inline void *kmalloc(size_t size, gfp_t flags)
268{
269 if (__builtin_constant_p(size)) {
270 struct kmem_cache *s;
271
272 s = kmalloc_slab(size, flags);
273 if (unlikely(ZERO_OR_NULL_PTR(s)))
274 return s;
275
276 return kmem_cache_alloc(s, flags);
277 }
278 return __kmalloc(size, flags);
279}
280
281#ifdef CONFIG_NUMA
282void *__kmalloc_node(size_t size, gfp_t flags, int node);
283void *kmem_cache_alloc_node(struct kmem_cache *, gfp_t flags, int node);
284
285static __always_inline void *kmalloc_node(size_t size, gfp_t flags, int node)
286{
287 if (__builtin_constant_p(size)) {
288 struct kmem_cache *s;
289
290 s = kmalloc_slab(size, flags);
291 if (unlikely(ZERO_OR_NULL_PTR(s)))
292 return s;
293
294 return kmem_cache_alloc_node(s, flags, node);
295 }
296 return __kmalloc_node(size, flags, node);
297}
298#endif
299
300#endif /* _LINUX_SLQB_DEF_H */
diff --git a/include/linux/sockios.h b/include/linux/sockios.h
index 7997a506ad4..f7ffe36db03 100644
--- a/include/linux/sockios.h
+++ b/include/linux/sockios.h
@@ -65,6 +65,7 @@
65#define SIOCDIFADDR 0x8936 /* delete PA address */ 65#define SIOCDIFADDR 0x8936 /* delete PA address */
66#define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */ 66#define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */
67#define SIOCGIFCOUNT 0x8938 /* get number of devices */ 67#define SIOCGIFCOUNT 0x8938 /* get number of devices */
68#define SIOCKILLADDR 0x8939 /* kill sockets with this local addr */
68 69
69#define SIOCGIFBR 0x8940 /* Bridging support */ 70#define SIOCGIFBR 0x8940 /* Bridging support */
70#define SIOCSIFBR 0x8941 /* Set bridging options */ 71#define SIOCSIFBR 0x8941 /* Set bridging options */
diff --git a/include/linux/splice.h b/include/linux/splice.h
index 997c3b4c212..26e5b613ded 100644
--- a/include/linux/splice.h
+++ b/include/linux/splice.h
@@ -88,5 +88,7 @@ extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
88extern int splice_grow_spd(struct pipe_inode_info *, struct splice_pipe_desc *); 88extern int splice_grow_spd(struct pipe_inode_info *, struct splice_pipe_desc *);
89extern void splice_shrink_spd(struct pipe_inode_info *, 89extern void splice_shrink_spd(struct pipe_inode_info *,
90 struct splice_pipe_desc *); 90 struct splice_pipe_desc *);
91extern void spd_release_page(struct splice_pipe_desc *, unsigned int);
91 92
93extern const struct pipe_buf_operations page_cache_pipe_buf_ops;
92#endif 94#endif
diff --git a/include/linux/switch.h b/include/linux/switch.h
new file mode 100644
index 00000000000..3e4c748e343
--- /dev/null
+++ b/include/linux/switch.h
@@ -0,0 +1,53 @@
1/*
2 * Switch class driver
3 *
4 * Copyright (C) 2008 Google, Inc.
5 * Author: Mike Lockwood <lockwood@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16*/
17
18#ifndef __LINUX_SWITCH_H__
19#define __LINUX_SWITCH_H__
20
21struct switch_dev {
22 const char *name;
23 struct device *dev;
24 int index;
25 int state;
26
27 ssize_t (*print_name)(struct switch_dev *sdev, char *buf);
28 ssize_t (*print_state)(struct switch_dev *sdev, char *buf);
29};
30
31struct gpio_switch_platform_data {
32 const char *name;
33 unsigned gpio;
34
35 /* if NULL, switch_dev.name will be printed */
36 const char *name_on;
37 const char *name_off;
38 /* if NULL, "0" or "1" will be printed */
39 const char *state_on;
40 const char *state_off;
41};
42
43extern int switch_dev_register(struct switch_dev *sdev);
44extern void switch_dev_unregister(struct switch_dev *sdev);
45
46static inline int switch_get_state(struct switch_dev *sdev)
47{
48 return sdev->state;
49}
50
51extern void switch_set_state(struct switch_dev *sdev, int state);
52
53#endif /* __LINUX_SWITCH_H__ */
diff --git a/include/linux/synaptics_i2c_rmi.h b/include/linux/synaptics_i2c_rmi.h
new file mode 100644
index 00000000000..5539cc52077
--- /dev/null
+++ b/include/linux/synaptics_i2c_rmi.h
@@ -0,0 +1,55 @@
1/*
2 * include/linux/synaptics_i2c_rmi.h - platform data structure for f75375s sensor
3 *
4 * Copyright (C) 2008 Google, Inc.
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#ifndef _LINUX_SYNAPTICS_I2C_RMI_H
18#define _LINUX_SYNAPTICS_I2C_RMI_H
19
20#define SYNAPTICS_I2C_RMI_NAME "synaptics-rmi-ts"
21
22enum {
23 SYNAPTICS_FLIP_X = 1UL << 0,
24 SYNAPTICS_FLIP_Y = 1UL << 1,
25 SYNAPTICS_SWAP_XY = 1UL << 2,
26 SYNAPTICS_SNAP_TO_INACTIVE_EDGE = 1UL << 3,
27};
28
29struct synaptics_i2c_rmi_platform_data {
30 uint32_t version; /* Use this entry for panels with */
31 /* (major << 8 | minor) version or above. */
32 /* If non-zero another array entry follows */
33 int (*power)(int on); /* Only valid in first array entry */
34 uint32_t flags;
35 unsigned long irqflags;
36 uint32_t inactive_left; /* 0x10000 = screen width */
37 uint32_t inactive_right; /* 0x10000 = screen width */
38 uint32_t inactive_top; /* 0x10000 = screen height */
39 uint32_t inactive_bottom; /* 0x10000 = screen height */
40 uint32_t snap_left_on; /* 0x10000 = screen width */
41 uint32_t snap_left_off; /* 0x10000 = screen width */
42 uint32_t snap_right_on; /* 0x10000 = screen width */
43 uint32_t snap_right_off; /* 0x10000 = screen width */
44 uint32_t snap_top_on; /* 0x10000 = screen height */
45 uint32_t snap_top_off; /* 0x10000 = screen height */
46 uint32_t snap_bottom_on; /* 0x10000 = screen height */
47 uint32_t snap_bottom_off; /* 0x10000 = screen height */
48 uint32_t fuzz_x; /* 0x10000 = screen width */
49 uint32_t fuzz_y; /* 0x10000 = screen height */
50 int fuzz_p;
51 int fuzz_w;
52 int8_t sensitivity_adjust;
53};
54
55#endif /* _LINUX_SYNAPTICS_I2C_RMI_H */
diff --git a/include/linux/uid_stat.h b/include/linux/uid_stat.h
new file mode 100644
index 00000000000..6bd6c4e52d1
--- /dev/null
+++ b/include/linux/uid_stat.h
@@ -0,0 +1,29 @@
1/* include/linux/uid_stat.h
2 *
3 * Copyright (C) 2008-2009 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#ifndef __uid_stat_h
17#define __uid_stat_h
18
19/* Contains definitions for resource tracking per uid. */
20
21#ifdef CONFIG_UID_STAT
22int uid_stat_tcp_snd(uid_t uid, int size);
23int uid_stat_tcp_rcv(uid_t uid, int size);
24#else
25#define uid_stat_tcp_snd(uid, size) do {} while (0);
26#define uid_stat_tcp_rcv(uid, size) do {} while (0);
27#endif
28
29#endif /* _LINUX_UID_STAT_H */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 6cd15762977..bca6a158e55 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -989,6 +989,9 @@ extern int usb_disabled(void);
989 989
990/* The following flags are used internally by usbcore and HCDs */ 990/* The following flags are used internally by usbcore and HCDs */
991#define URB_DIR_IN 0x0200 /* Transfer from device to host */ 991#define URB_DIR_IN 0x0200 /* Transfer from device to host */
992#ifdef CONFIG_HOST_COMPLIANT_TEST
993#define URB_HCD_DRIVER_TEST 0x0400 /* Do NOT hand back or free this URB. */
994#endif
992#define URB_DIR_OUT 0 995#define URB_DIR_OUT 0
993#define URB_DIR_MASK URB_DIR_IN 996#define URB_DIR_MASK URB_DIR_IN
994 997
diff --git a/include/linux/usb/android_composite.h b/include/linux/usb/android_composite.h
new file mode 100644
index 00000000000..7f9000711f4
--- /dev/null
+++ b/include/linux/usb/android_composite.h
@@ -0,0 +1,106 @@
1/*
2 * Platform data for Android USB
3 *
4 * Copyright (C) 2008 Google, Inc.
5 * Author: Mike Lockwood <lockwood@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17#ifndef __LINUX_USB_ANDROID_H
18#define __LINUX_USB_ANDROID_H
19
20#include <linux/usb/composite.h>
21#include <linux/if_ether.h>
22
23struct android_usb_function {
24 struct list_head list;
25 char *name;
26 int (*bind_config)(struct usb_configuration *c);
27};
28
29struct android_usb_product {
30 /* Vendor ID for this set of functions.
31 * Default vendor_id in platform data will be used if this is zero.
32 */
33 __u16 vendor_id;
34
35 /* Product ID for this set of functions. */
36 __u16 product_id;
37
38 /* List of function names associated with this product.
39 * This is used to compute the USB product ID dynamically
40 * based on which functions are enabled.
41 */
42 int num_functions;
43 char **functions;
44};
45
46struct android_usb_platform_data {
47 /* USB device descriptor fields */
48 __u16 vendor_id;
49
50 /* Default product ID. */
51 __u16 product_id;
52
53 __u16 version;
54
55 char *product_name;
56 char *manufacturer_name;
57 char *serial_number;
58
59 /* List of available USB products.
60 * This is used to compute the USB product ID dynamically
61 * based on which functions are enabled.
62 * if num_products is zero or no match can be found,
63 * we use the default product ID
64 */
65 int num_products;
66 struct android_usb_product *products;
67
68 /* List of all supported USB functions.
69 * This list is used to define the order in which
70 * the functions appear in the configuration's list of USB interfaces.
71 * This is necessary to avoid depending upon the order in which
72 * the individual function drivers are initialized.
73 */
74 int num_functions;
75 char **functions;
76};
77
78/* Platform data for "usb_mass_storage" driver. */
79struct usb_mass_storage_platform_data {
80 /* Contains values for the SC_INQUIRY SCSI command. */
81 char *vendor;
82 char *product;
83 int release;
84
85 /* number of LUNS */
86 int nluns;
87};
88
89/* Platform data for USB ethernet driver. */
90struct usb_ether_platform_data {
91 u8 ethaddr[ETH_ALEN];
92 u32 vendorID;
93 const char *vendorDescr;
94};
95
96/* Platform data for ACM driver. */
97struct acm_platform_data {
98 u8 num_inst;
99};
100
101extern void android_register_function(struct android_usb_function *f);
102
103extern void android_enable_function(struct usb_function *f, int enable);
104
105
106#endif /* __LINUX_USB_ANDROID_H */
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
index 1eb735b53fc..8d2b5471b97 100644
--- a/include/linux/usb/ch11.h
+++ b/include/linux/usb/ch11.h
@@ -77,6 +77,44 @@
77#define USB_PORT_FEAT_C_BH_PORT_RESET 29 77#define USB_PORT_FEAT_C_BH_PORT_RESET 29
78#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30 78#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
79 79
80#ifdef CONFIG_HOST_COMPLIANT_TEST
81/*
82 * Hub Port Test Mode Selector Codes
83 * See USB 2.0 spec Table 11-24
84 */
85#define USB_PORT_TEST_J 0x01
86#define USB_PORT_TEST_K 0x02
87#define USB_PORT_TEST_SE0_NAK 0x03
88#define USB_PORT_TEST_PACKET 0x04
89#define USB_PORT_TEST_FORCE_ENABLE 0x05
90
91/*
92 * Product IDs used to trigger USB Hi-Speed Host Electrical Tests
93 * on the root hub. See USB 2.0 spec 7.1.20 and the
94 * Embedded High-speed Host Electrical Test Procedure.
95 */
96#define EHSET_TEST_SE0_NAK 0x0101
97#define EHSET_TEST_J 0x0102
98#define EHSET_TEST_K 0x0103
99#define EHSET_TEST_PACKET 0x0104
100/* Note that the FORCE ENABLE test is no longer used in the EHSET spec. */
101#define EHSET_TEST_FORCE_ENABLE 0x0105
102#define EHSET_HS_HOST_PORT_SUSPEND_RESUME 0x0106
103#define EHSET_SINGLE_STEP_GET_DEV_DESC 0x0107
104#define EHSET_SINGLE_STEP_SET_FEATURE 0x0108
105#define LOW_LEVEL_TEST_J 0x010a
106#define LOW_LEVEL_TEST_K 0x010b
107#define LOW_LEVEL_SE0_NAK 0x010c
108#define LOW_LEVEL_TEST_PACKET 0x010d
109
110/*
111 * This is used for the Hi-Speed Host Electrical Tests
112 * on the root hub. See USB 2.0 spec 7.1.20 and the
113 * Embedded High-speed Host Electrical Test Procedure.
114 */
115#define USB_PORT_TEST_SINGLE_STEP_SET_FEATURE 0x00
116
117#endif
80/* 118/*
81 * Hub Status and Hub Change results 119 * Hub Status and Hub Change results
82 * See USB 2.0 spec Table 11-19 and Table 11-20 120 * See USB 2.0 spec Table 11-19 and Table 11-20
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index cf65b5cff72..4b8e1e57685 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -87,6 +87,7 @@
87#define USB_REQ_GET_INTERFACE 0x0A 87#define USB_REQ_GET_INTERFACE 0x0A
88#define USB_REQ_SET_INTERFACE 0x0B 88#define USB_REQ_SET_INTERFACE 0x0B
89#define USB_REQ_SYNCH_FRAME 0x0C 89#define USB_REQ_SYNCH_FRAME 0x0C
90#define USB_REQ_SET_SEL 0x30
90 91
91#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */ 92#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
92#define USB_REQ_GET_ENCRYPTION 0x0E 93#define USB_REQ_GET_ENCRYPTION 0x0E
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index b78cba466d3..03f19414700 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -36,7 +36,9 @@
36 36
37#include <linux/usb/ch9.h> 37#include <linux/usb/ch9.h>
38#include <linux/usb/gadget.h> 38#include <linux/usb/gadget.h>
39 39#ifdef CONFIG_USB_ANDROID
40#include <linux/switch.h>
41#endif
40/* 42/*
41 * USB function drivers should return USB_GADGET_DELAYED_STATUS if they 43 * USB function drivers should return USB_GADGET_DELAYED_STATUS if they
42 * wish to delay the data/status stages of the control transfer till they 44 * wish to delay the data/status stages of the control transfer till they
@@ -46,6 +48,9 @@
46 */ 48 */
47#define USB_GADGET_DELAYED_STATUS 0x7fff /* Impossibly large value */ 49#define USB_GADGET_DELAYED_STATUS 0x7fff /* Impossibly large value */
48 50
51#ifdef CONFIG_USB_ANDROID
52struct usb_composite_dev;
53#endif
49struct usb_configuration; 54struct usb_configuration;
50 55
51/** 56/**
@@ -59,6 +64,10 @@ struct usb_configuration;
59 * @hs_descriptors: Table of high speed descriptors, using interface and 64 * @hs_descriptors: Table of high speed descriptors, using interface and
60 * string identifiers assigned during @bind(). If this pointer is null, 65 * string identifiers assigned during @bind(). If this pointer is null,
61 * the function will not be available at high speed. 66 * the function will not be available at high speed.
67 * @ss_descriptors: Table of super speed descriptors, using interface and
68 * string identifiers assigned during @bind(). If this
69 * pointer is null after initiation, the function will not
70 * be available at super speed.
62 * @config: assigned when @usb_add_function() is called; this is the 71 * @config: assigned when @usb_add_function() is called; this is the
63 * configuration with which this function is associated. 72 * configuration with which this function is associated.
64 * @bind: Before the gadget can register, all of its functions bind() to the 73 * @bind: Before the gadget can register, all of its functions bind() to the
@@ -77,6 +86,10 @@ struct usb_configuration;
77 * @setup: Used for interface-specific control requests. 86 * @setup: Used for interface-specific control requests.
78 * @suspend: Notifies functions when the host stops sending USB traffic. 87 * @suspend: Notifies functions when the host stops sending USB traffic.
79 * @resume: Notifies functions when the host restarts USB traffic. 88 * @resume: Notifies functions when the host restarts USB traffic.
89 * @get_status: Returns function status as a reply to
90 * GetStatus() request when the recepient is Interface.
91 * @func_suspend: callback to be called when
92 * SetFeature(FUNCTION_SUSPEND) is reseived
80 * 93 *
81 * A single USB function uses one or more interfaces, and should in most 94 * A single USB function uses one or more interfaces, and should in most
82 * cases support operation at both full and high speeds. Each function is 95 * cases support operation at both full and high speeds. Each function is
@@ -106,9 +119,14 @@ struct usb_function {
106 struct usb_gadget_strings **strings; 119 struct usb_gadget_strings **strings;
107 struct usb_descriptor_header **descriptors; 120 struct usb_descriptor_header **descriptors;
108 struct usb_descriptor_header **hs_descriptors; 121 struct usb_descriptor_header **hs_descriptors;
122 struct usb_descriptor_header **ss_descriptors;
109 123
110 struct usb_configuration *config; 124 struct usb_configuration *config;
111 125
126#ifdef CONFIG_USB_ANDROID
127 /* disabled is zero if the function is enabled */
128 int disabled;
129#endif
112 /* REVISIT: bind() functions can be marked __init, which 130 /* REVISIT: bind() functions can be marked __init, which
113 * makes trouble for section mismatch analysis. See if 131 * makes trouble for section mismatch analysis. See if
114 * we can't restructure things to avoid mismatching. 132 * we can't restructure things to avoid mismatching.
@@ -132,10 +150,17 @@ struct usb_function {
132 void (*suspend)(struct usb_function *); 150 void (*suspend)(struct usb_function *);
133 void (*resume)(struct usb_function *); 151 void (*resume)(struct usb_function *);
134 152
153 int (*get_status)(struct usb_function *);
154 int (*func_suspend)(struct usb_function *,
155 u8 suspend_opt);
156
135 /* private: */ 157 /* private: */
136 /* internals */ 158 /* internals */
137 struct list_head list; 159 struct list_head list;
138 DECLARE_BITMAP(endpoints, 32); 160 DECLARE_BITMAP(endpoints, 32);
161#ifdef CONFIG_USB_ANDROID
162 struct device *dev;
163#endif
139}; 164};
140 165
141int usb_add_function(struct usb_configuration *, struct usb_function *); 166int usb_add_function(struct usb_configuration *, struct usb_function *);
@@ -145,6 +170,10 @@ int usb_function_activate(struct usb_function *);
145 170
146int usb_interface_id(struct usb_configuration *, struct usb_function *); 171int usb_interface_id(struct usb_configuration *, struct usb_function *);
147 172
173#ifdef CONFIG_USB_ANDROID
174void usb_function_set_enabled(struct usb_function *, int);
175void usb_composite_force_reset(struct usb_composite_dev *);
176#endif
148/** 177/**
149 * ep_choose - select descriptor endpoint at current device speed 178 * ep_choose - select descriptor endpoint at current device speed
150 * @g: gadget, connected and running at some speed 179 * @g: gadget, connected and running at some speed
@@ -231,6 +260,7 @@ struct usb_configuration {
231 struct list_head list; 260 struct list_head list;
232 struct list_head functions; 261 struct list_head functions;
233 u8 next_interface_id; 262 u8 next_interface_id;
263 unsigned superspeed:1;
234 unsigned highspeed:1; 264 unsigned highspeed:1;
235 unsigned fullspeed:1; 265 unsigned fullspeed:1;
236 struct usb_function *interface[MAX_CONFIG_INTERFACES]; 266 struct usb_function *interface[MAX_CONFIG_INTERFACES];
@@ -240,6 +270,9 @@ int usb_add_config(struct usb_composite_dev *,
240 struct usb_configuration *, 270 struct usb_configuration *,
241 int (*)(struct usb_configuration *)); 271 int (*)(struct usb_configuration *));
242 272
273int usb_remove_config(struct usb_composite_dev *,
274 struct usb_configuration *);
275
243/** 276/**
244 * struct usb_composite_driver - groups configurations into a gadget 277 * struct usb_composite_driver - groups configurations into a gadget
245 * @name: For diagnostics, identifies the driver. 278 * @name: For diagnostics, identifies the driver.
@@ -281,6 +314,10 @@ struct usb_composite_driver {
281 struct usb_gadget_strings **strings; 314 struct usb_gadget_strings **strings;
282 unsigned needs_serial:1; 315 unsigned needs_serial:1;
283 316
317#ifdef CONFIG_USB_ANDROID
318 struct class *class;
319 atomic_t function_count;
320#endif
284 int (*unbind)(struct usb_composite_dev *); 321 int (*unbind)(struct usb_composite_dev *);
285 322
286 void (*disconnect)(struct usb_composite_dev *); 323 void (*disconnect)(struct usb_composite_dev *);
@@ -288,6 +325,10 @@ struct usb_composite_driver {
288 /* global suspend hooks */ 325 /* global suspend hooks */
289 void (*suspend)(struct usb_composite_dev *); 326 void (*suspend)(struct usb_composite_dev *);
290 void (*resume)(struct usb_composite_dev *); 327 void (*resume)(struct usb_composite_dev *);
328
329#ifdef CONFIG_USB_ANDROID
330 void (*enable_function)(struct usb_function *f, int enable);
331#endif
291}; 332};
292 333
293extern int usb_composite_probe(struct usb_composite_driver *driver, 334extern int usb_composite_probe(struct usb_composite_driver *driver,
@@ -358,6 +399,17 @@ struct usb_composite_dev {
358 399
359 /* protects deactivations and delayed_status counts*/ 400 /* protects deactivations and delayed_status counts*/
360 spinlock_t lock; 401 spinlock_t lock;
402
403#ifdef CONFIG_USB_ANDROID
404 /* switch indicating connected/disconnected state */
405 struct switch_dev sw_connected;
406 /* switch indicating current configuration */
407 struct switch_dev sw_config;
408 /* current connected state for sw_connected */
409 bool connected;
410
411 struct work_struct switch_work;
412#endif
361}; 413};
362 414
363extern int usb_string_id(struct usb_composite_dev *c); 415extern int usb_string_id(struct usb_composite_dev *c);
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h
index 7cc95ee3606..b776e1d931c 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -133,8 +133,14 @@ struct ehci_regs {
133#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */ 133#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */
134/* 19:16 for port testing */ 134/* 19:16 for port testing */
135#define PORT_TEST(x) (((x)&0xf)<<16) /* Port Test Control */ 135#define PORT_TEST(x) (((x)&0xf)<<16) /* Port Test Control */
136#ifdef CONFIG_HOST_COMPLIANT_TEST
137#define PORT_TEST_J PORT_TEST(0x1)
138#define PORT_TEST_K PORT_TEST(0x2)
139#define PORT_TEST_SE0_NAK PORT_TEST(0x3)
140#endif
136#define PORT_TEST_PKT PORT_TEST(0x4) /* Port Test Control - packet test */ 141#define PORT_TEST_PKT PORT_TEST(0x4) /* Port Test Control - packet test */
137#define PORT_TEST_FORCE PORT_TEST(0x5) /* Port Test Control - force enable */ 142#define PORT_TEST_FORCE PORT_TEST(0x5) /* Port Test Control - force enable */
143
138#define PORT_LED_OFF (0<<14) 144#define PORT_LED_OFF (0<<14)
139#define PORT_LED_AMBER (1<<14) 145#define PORT_LED_AMBER (1<<14)
140#define PORT_LED_GREEN (2<<14) 146#define PORT_LED_GREEN (2<<14)
diff --git a/include/linux/usb/exynos_usb3_drd.h b/include/linux/usb/exynos_usb3_drd.h
new file mode 100644
index 00000000000..d8aa24ff869
--- /dev/null
+++ b/include/linux/usb/exynos_usb3_drd.h
@@ -0,0 +1,396 @@
1/* include/linux/usb/exynos_usb3_drd.h
2 *
3 * Copyright (c) 2012 Samsung Electronics Co. Ltd
4 * Author: Anton Tikhomirov <av.tikhomirov@samsung.com>
5 *
6 * Exynos SuperSpeed USB 3.0 DRD Controller global and OTG registers
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __LINUX_USB_EXYNOS_USB3_DRD_H
14#define __LINUX_USB_EXYNOS_USB3_DRD_H
15
16/* Global registers */
17#define EXYNOS_USB3_GSBUSCFG0 0xC100
18#define EXYNOS_USB3_GSBUSCFG0_SBusStoreAndForward (1 << 12)
19#define EXYNOS_USB3_GSBUSCFG0_DatBigEnd (1 << 11)
20#define EXYNOS_USB3_GSBUSCFG0_INCR256BrstEna (1 << 7)
21#define EXYNOS_USB3_GSBUSCFG0_INCR128BrstEna (1 << 6)
22#define EXYNOS_USB3_GSBUSCFG0_INCR64BrstEna (1 << 5)
23#define EXYNOS_USB3_GSBUSCFG0_INCR32BrstEna (1 << 4)
24#define EXYNOS_USB3_GSBUSCFG0_INCR16BrstEna (1 << 3)
25#define EXYNOS_USB3_GSBUSCFG0_INCR8BrstEna (1 << 2)
26#define EXYNOS_USB3_GSBUSCFG0_INCR4BrstEna (1 << 1)
27#define EXYNOS_USB3_GSBUSCFG0_INCRBrstEna (1 << 0)
28
29#define EXYNOS_USB3_GSBUSCFG1 0xC104
30#define EXYNOS_USB3_GSBUSCFG1_EN1KPAGE (1 << 12)
31#define EXYNOS_USB3_GSBUSCFG1_BREQLIMIT_MASK (0xf << 8)
32#define EXYNOS_USB3_GSBUSCFG1_BREQLIMIT_SHIFT 8
33#define EXYNOS_USB3_GSBUSCFG1_BREQLIMIT(_x) ((_x) << 8)
34
35#define EXYNOS_USB3_GTXTHRCFG 0xC108
36#define EXYNOS_USB3_GTXTHRCFG_USBTxPktCntSel (1 << 29)
37#define EXYNOS_USB3_GTXTHRCFG_USBTxPktCnt_MASK (0xf << 24)
38#define EXYNOS_USB3_GTXTHRCFG_USBTxPktCnt_SHIFT 24
39#define EXYNOS_USB3_GTXTHRCFG_USBTxPktCnt(_x) ((_x) << 24)
40#define EXYNOS_USB3_GTXTHRCFG_USBMaxTxBurstSize_MASK (0xff << 16)
41#define EXYNOS_USB3_GTXTHRCFG_USBMaxTxBurstSize_SHIFT 16
42#define EXYNOS_USB3_GTXTHRCFG_USBMaxTxBurstSize(_x) ((_x) << 16)
43
44#define EXYNOS_USB3_GRXTHRCFG 0xC10C
45#define EXYNOS_USB3_GRXTHRCFG_USBRxPktCntSel (1 << 29)
46#define EXYNOS_USB3_GRXTHRCFG_USBRxPktCnt_MASK (0xf << 24)
47#define EXYNOS_USB3_GRXTHRCFG_USBRxPktCnt_SHIFT 24
48#define EXYNOS_USB3_GRXTHRCFG_USBRxPktCnt(_x) ((_x) << 24)
49#define EXYNOS_USB3_GRXTHRCFG_USBMaxRxBurstSize_MASK (0x1f << 19)
50#define EXYNOS_USB3_GRXTHRCFG_USBMaxRxBurstSize_SHIFT 19
51#define EXYNOS_USB3_GRXTHRCFG_USBMaxRxBurstSize(_x) ((_x) << 19)
52
53#define EXYNOS_USB3_GCTL 0xC110
54#define EXYNOS_USB3_GCTL_PwrDnScale_MASK (0x1fff << 19)
55#define EXYNOS_USB3_GCTL_PwrDnScale_SHIFT 19
56#define EXYNOS_USB3_GCTL_PwrDnScale(_x) ((_x) << 19)
57#define EXYNOS_USB3_GCTL_U2RSTECN (1 << 16)
58#define EXYNOS_USB3_GCTL_FRMSCLDWN_MASK (0x3 << 14)
59#define EXYNOS_USB3_GCTL_FRMSCLDWN_SHIFT 14
60#define EXYNOS_USB3_GCTL_FRMSCLDWN(_x) ((_x) << 14)
61#define EXYNOS_USB3_GCTL_PrtCapDir_MASK (0x3 << 12)
62#define EXYNOS_USB3_GCTL_PrtCapDir_SHIFT 12
63#define EXYNOS_USB3_GCTL_PrtCapDir(_x) ((_x) << 12)
64#define EXYNOS_USB3_GCTL_CoreSoftReset (1 << 11)
65#define EXYNOS_USB3_GCTL_LocalLpBkEn (1 << 10)
66#define EXYNOS_USB3_GCTL_LpbkEn (1 << 9)
67#define EXYNOS_USB3_GCTL_DebugAttach (1 << 8)
68#define EXYNOS_USB3_GCTL_RAMClkSel_MASK (0x3 << 6)
69#define EXYNOS_USB3_GCTL_RAMClkSel_SHIFT 6
70#define EXYNOS_USB3_GCTL_RAMClkSel(_x) ((_x) << 6)
71#define EXYNOS_USB3_GCTL_ScaleDown_MASK (0x3 << 4)
72#define EXYNOS_USB3_GCTL_ScaleDown_SHIFT 4
73#define EXYNOS_USB3_GCTL_ScaleDown(_x) ((_x) << 4)
74#define EXYNOS_USB3_GCTL_DisScramble (1 << 3)
75#define EXYNOS_USB3_GCTL_SsPwrClmp (1 << 2)
76#define EXYNOS_USB3_GCTL_HsFsLsPwrClmp (1 << 1)
77#define EXYNOS_USB3_GCTL_DsblClkGtng (1 << 0)
78
79#define EXYNOS_USB3_GEVTEN 0xC114
80#define EXYNOS_USB3_GEVTEN_I2CEvtEn (1 << 1)
81#define EXYNOS_USB3_GEVTEN_ULPICKEvtEn (1 << 0)
82#define EXYNOS_USB3_GEVTEN_I2CCKEvtEn (1 << 0)
83
84#define EXYNOS_USB3_GSTS 0xC118
85#define EXYNOS_USB3_GSTS_CBELT_MASK (0xfff << 20)
86#define EXYNOS_USB3_GSTS_CBELT_SHIFT 20
87#define EXYNOS_USB3_GSTS_CBELT(_x) ((_x) << 20)
88#define EXYNOS_USB3_GSTS_OTG_IP (1 << 10)
89#define EXYNOS_USB3_GSTS_BC_IP (1 << 9)
90#define EXYNOS_USB3_GSTS_ADP_IP (1 << 8)
91#define EXYNOS_USB3_GSTS_Host_IP (1 << 7)
92#define EXYNOS_USB3_GSTS_Device_IP (1 << 6)
93#define EXYNOS_USB3_GSTS_CSRTimeout (1 << 5)
94#define EXYNOS_USB3_GSTS_BusErrAddrVld (1 << 4)
95#define EXYNOS_USB3_GSTS_CurMod_MASK (0x3 << 0)
96#define EXYNOS_USB3_GSTS_CurMod_SHIFT 0
97#define EXYNOS_USB3_GSTS_CurMod(_x) ((_x) << 0)
98
99#define EXYNOS_USB3_GSNPSID 0xC120
100
101#define EXYNOS_USB3_GGPIO 0xC124
102#define EXYNOS_USB3_GGPIO_GPO_MASK (0xffff << 16)
103#define EXYNOS_USB3_GGPIO_GPO_SHIFT 16
104#define EXYNOS_USB3_GGPIO_GPO(_x) ((_x) << 16)
105#define EXYNOS_USB3_GGPIO_GPI_MASK (0xffff << 0)
106#define EXYNOS_USB3_GGPIO_GPI_SHIFT 0
107#define EXYNOS_USB3_GGPIO_GPI(_x) ((x) << 0)
108
109#define EXYNOS_USB3_GUID 0xC128
110
111#define EXYNOS_USB3_GUCTL 0xC12C
112#define EXYNOS_USB3_GUCTL_SprsCtrlTransEn (1 << 17)
113#define EXYNOS_USB3_GUCTL_ResBwHSEPS (1 << 16)
114#define EXYNOS_USB3_GUCTL_CMdevAddr (1 << 15)
115#define EXYNOS_USB3_GUCTL_USBHstInAutoRetryEn (1 << 14)
116#define EXYNOS_USB3_GUCTL_USBHstInMaxBurst_MASK (0x7 << 11)
117#define EXYNOS_USB3_GUCTL_USBHstInMaxBurst_SHIFT 11
118#define EXYNOS_USB3_GUCTL_USBHstInMaxBurst(_x) ((_x) << 11)
119#define EXYNOS_USB3_GUCTL_DTCT_MASK (0x3 << 9)
120#define EXYNOS_USB3_GUCTL_DTCT_SHIFT 9
121#define EXYNOS_USB3_GUCTL_DTCT(_x) ((_x) << 9)
122#define EXYNOS_USB3_GUCTL_DTFT_MASK (0x1ff << 0)
123#define EXYNOS_USB3_GUCTL_DTFT_SHIFT 0
124#define EXYNOS_USB3_GUCTL_DTFT(_x) ((_x) << 0)
125
126#define EXYNOS_USB3_GBUSERRADDR_31_0 0xC130
127#define EXYNOS_USB3_GBUSERRADDR_63_32 0xC134
128#define EXYNOS_USB3_GPRTBIMAP_31_0 0xC138
129#define EXYNOS_USB3_GPRTBIMAP_63_32 0xC13C
130
131#define EXYNOS_USB3_GHWPARAMS0 0xC140
132#define EXYNOS_USB3_GHWPARAMS1 0xC144
133#define EXYNOS_USB3_GHWPARAMS2 0xC148
134#define EXYNOS_USB3_GHWPARAMS3 0xC14C
135#define EXYNOS_USB3_GHWPARAMS4 0xC150
136#define EXYNOS_USB3_GHWPARAMS5 0xC154
137#define EXYNOS_USB3_GHWPARAMS6 0xC158
138#define EXYNOS_USB3_GHWPARAMS7 0xC15C
139
140#define EXYNOS_USB3_GDBGFIFOSPACE 0xC160
141#define EXYNOS_USB3_GDBGLTSSM 0xC164
142
143#define EXYNOS_USB3_GDBGLSPMUX 0xC170
144#define EXYNOS_USB3_GDBGLSP 0xC174
145#define EXYNOS_USB3_GDBGEPINFO0 0xC178
146#define EXYNOS_USB3_GDBGEPINFO1 0xC17C
147
148#define EXYNOS_USB3_GPRTBIMAP_HS_31_0 0xC180
149#define EXYNOS_USB3_GPRTBIMAP_HS_63_32 0xC184
150#define EXYNOS_USB3_GPRTBIMAP_FS_31_0 0xC188
151#define EXYNOS_USB3_GPRTBIMAP_FS_63_32 0xC18C
152
153#define EXYNOS_USB3_GUSB2PHYCFG(_a) (0xC200 + ((_a) * 0x04))
154#define EXYNOS_USB3_GUSB2PHYCFGx_PHYSoftRst (1 << 31)
155#define EXYNOS_USB3_GUSB2PHYCFGx_PhyIntrNum_MASK (0x3f << 19)
156#define EXYNOS_USB3_GUSB2PHYCFGx_PhyIntrNum_SHIFT 19
157#define EXYNOS_USB3_GUSB2PHYCFGx_PhyIntrNum(_x) ((_x) << 19)
158#define EXYNOS_USB3_GUSB2PHYCFGx_ULPIExtVbusIndicator (1 << 18)
159#define EXYNOS_USB3_GUSB2PHYCFGx_ULPIExtVbusDrv (1 << 17)
160#define EXYNOS_USB3_GUSB2PHYCFGx_ULPIClkSusM (1 << 16)
161#define EXYNOS_USB3_GUSB2PHYCFGx_ULPIAutoRes (1 << 15)
162#define EXYNOS_USB3_GUSB2PHYCFGx_PhyLPwrClkSel (1 << 14)
163#define EXYNOS_USB3_GUSB2PHYCFGx_USBTrdTim_MASK (0xf << 10)
164#define EXYNOS_USB3_GUSB2PHYCFGx_USBTrdTim_SHIFT 10
165#define EXYNOS_USB3_GUSB2PHYCFGx_USBTrdTim(_x) ((_x) << 10)
166#define EXYNOS_USB3_GUSB2PHYCFGx_EnblSlpM (1 << 8)
167#define EXYNOS_USB3_GUSB2PHYCFGx_PHYSel (1 << 7)
168#define EXYNOS_USB3_GUSB2PHYCFGx_SusPHY (1 << 6)
169#define EXYNOS_USB3_GUSB2PHYCFGx_FSIntf (1 << 5)
170#define EXYNOS_USB3_GUSB2PHYCFGx_ULPI_UTMI_Sel (1 << 4)
171#define EXYNOS_USB3_GUSB2PHYCFGx_PHYIf (1 << 3)
172#define EXYNOS_USB3_GUSB2PHYCFGx_TOutCal_MASK (0x7 << 0)
173#define EXYNOS_USB3_GUSB2PHYCFGx_TOutCal_SHIFT 0
174#define EXYNOS_USB3_GUSB2PHYCFGx_TOutCal(_x) ((_x) << 0)
175
176#define EXYNOS_USB3_GUSB2I2CCTL(_a) (0xC240 + ((_a) * 0x04))
177
178#define EXYNOS_USB3_GUSB2PHYACC(_a) (0xC280 + ((_a) * 0x04))
179#define EXYNOS_USB3_GUSB2PHYACCx_DisUlpiDrvr (1 << 26)
180#define EXYNOS_USB3_GUSB2PHYACCx_NewRegReq (1 << 25)
181#define EXYNOS_USB3_GUSB2PHYACCx_VStsDone (1 << 24)
182#define EXYNOS_USB3_GUSB2PHYACCx_VStsBsy (1 << 23)
183#define EXYNOS_USB3_GUSB2PHYACCx_RegWr (1 << 22)
184#define EXYNOS_USB3_GUSB2PHYACCx_RegAddr_MASK (0x3f << 16)
185#define EXYNOS_USB3_GUSB2PHYACCx_RegAddr_SHIFT 16
186#define EXYNOS_USB3_GUSB2PHYACCx_RegAddr(_x) ((_x) << 16)
187/* Next 2 fields are overlaping. Is it error in user manual? */
188#define EXYNOS_USB3_GUSB2PHYACCx_VCtrl_MASK (0xff << 8)
189#define EXYNOS_USB3_GUSB2PHYACCx_VCtrl_SHIFT 8
190#define EXYNOS_USB3_GUSB2PHYACCx_VCtrl(_x) ((_x) << 8)
191/*--------*/
192#define EXYNOS_USB3_GUSB2PHYACCx_ExtRegAddr_MASK (0x3f << 8)
193#define EXYNOS_USB3_GUSB2PHYACCx_ExtRegAddr_SHIFT 8
194#define EXYNOS_USB3_GUSB2PHYACCx_ExtRegAddr(_x) ((_x) << 8)
195/*--------*/
196#define EXYNOS_USB3_GUSB2PHYACCx_RegData_MASK (0xff << 0)
197#define EXYNOS_USB3_GUSB2PHYACCx_RegData_SHIFT 0
198#define EXYNOS_USB3_GUSB2PHYACCx_RegData(_x) ((_x) << 0)
199
200#define EXYNOS_USB3_GUSB3PIPECTL(_a) (0xC2C0 + ((_a) * 0x04))
201#define EXYNOS_USB3_GUSB3PIPECTLx_PHYSoftRst (1 << 31)
202#define EXYNOS_USB3_GUSB3PIPECTLx_request_p1p2p3 (1 << 24)
203#define EXYNOS_USB3_GUSB3PIPECTLx_StartRxdetU3RxDet (1 << 23)
204#define EXYNOS_USB3_GUSB3PIPECTLx_DisRxDetU3RxDet (1 << 22)
205#define EXYNOS_USB3_GUSB3PIPECTLx_delay_p1p2p3_MASK (0x7 << 19)
206#define EXYNOS_USB3_GUSB3PIPECTLx_delay_p1p2p3_SHIFT 19
207#define EXYNOS_USB3_GUSB3PIPECTLx_delay_p1p2p3(_x) ((_x) << 19)
208#define EXYNOS_USB3_GUSB3PIPECTLx_delay_phy_pwr_p1p2p3 (1 << 18)
209#define EXYNOS_USB3_GUSB3PIPECTLx_SuspSSPhy (1 << 17)
210#define EXYNOS_USB3_GUSB3PIPECTLx_DatWidth_MASK (0x3 << 15)
211#define EXYNOS_USB3_GUSB3PIPECTLx_DatWidth_SHIFT 15
212#define EXYNOS_USB3_GUSB3PIPECTLx_DatWidth(_x) ((_x) << 15)
213#define EXYNOS_USB3_GUSB3PIPECTLx_AbortRxDetInU2 (1 << 14)
214#define EXYNOS_USB3_GUSB3PIPECTLx_SkipRxDet (1 << 13)
215#define EXYNOS_USB3_GUSB3PIPECTLx_LFPSP0Algn (1 << 12)
216#define EXYNOS_USB3_GUSB3PIPECTLx_P3P2TranOK (1 << 11)
217#define EXYNOS_USB3_GUSB3PIPECTLx_LFPSFilt (1 << 9)
218#define EXYNOS_USB3_GUSB3PIPECTLx_TxSwing (1 << 6)
219#define EXYNOS_USB3_GUSB3PIPECTLx_TxMargin_MASK (0x7 << 3)
220#define EXYNOS_USB3_GUSB3PIPECTLx_TxMargin_SHIFT 3
221#define EXYNOS_USB3_GUSB3PIPECTLx_TxMargin(_x) ((_x) << 3)
222#define EXYNOS_USB3_GUSB3PIPECTLx_TxDeemphasis_MASK (0x3 << 1)
223#define EXYNOS_USB3_GUSB3PIPECTLx_TxDeemphasis_SHIFT 1
224#define EXYNOS_USB3_GUSB3PIPECTLx_TxDeemphasis(_x) ((_x) << 1)
225#define EXYNOS_USB3_GUSB3PIPECTLx_ElasticBufferMode (1 << 0)
226
227#define EXYNOS_USB3_GTXFIFOSIZ(_a) (0xC300 + ((_a) * 0x04))
228#define EXYNOS_USB3_GTXFIFOSIZx_TxFStAddr_n_MASK (0xffff << 16)
229#define EXYNOS_USB3_GTXFIFOSIZx_TxFStAddr_n_SHIFT 16
230#define EXYNOS_USB3_GTXFIFOSIZx_TxFStAddr_n(_x) ((_x) << 16)
231#define EXYNOS_USB3_GTXFIFOSIZx_TxFDep_n_MASK (0xffff << 0)
232#define EXYNOS_USB3_GTXFIFOSIZx_TxFDep_n_SHIFT 0
233#define EXYNOS_USB3_GTXFIFOSIZx_TxFDep_n(_x) ((_x) << 0)
234
235#define EXYNOS_USB3_GRXFIFOSIZ(_a) (0xC380 + ((_a) * 0x04))
236#define EXYNOS_USB3_GRXFIFOSIZx_RxFStAddr_n_MASK (0xffff << 16)
237#define EXYNOS_USB3_GRXFIFOSIZx_RxFStAddr_n_SHIFT 16
238#define EXYNOS_USB3_GRXFIFOSIZx_RxFStAddr_n(_x) ((_x) << 16)
239#define EXYNOS_USB3_GRXFIFOSIZx_RxFDep_n_MASK (0xffff << 0)
240#define EXYNOS_USB3_GRXFIFOSIZx_RxFDep_n_SHIFT 0
241#define EXYNOS_USB3_GRXFIFOSIZx_RxFDep_n(_x) ((_x) << 0)
242
243#define EXYNOS_USB3_GEVNTADR_31_0(_a) (0xC400 + ((_a) * 0x10))
244#define EXYNOS_USB3_GEVNTADR_63_32(_a) (0xC404 + ((_a) * 0x10))
245
246#define EXYNOS_USB3_GEVNTSIZ(_a) (0xC408 + ((_a) * 0x10))
247#define EXYNOS_USB3_GEVNTSIZx_EvntIntMask (1 << 31)
248#define EXYNOS_USB3_GEVNTSIZx_EVNTSiz_MASK (0xffff << 0)
249#define EXYNOS_USB3_GEVNTSIZx_EVNTSiz_SHIFT 0
250#define EXYNOS_USB3_GEVNTSIZx_EVNTSiz(x) ((_x) << 0)
251
252#define EXYNOS_USB3_GEVNTCOUNT(_a) (0xC40C + ((_a) * 0x10))
253#define EXYNOS_USB3_GEVNTCOUNTx_EVNTCount_MASK (0xffff << 0)
254#define EXYNOS_USB3_GEVNTCOUNTx_EVNTCount_SHIFT 0
255#define EXYNOS_USB3_GEVNTCOUNTx_EVNTCount(_x) ((_x) << 0)
256
257/* Event Buffer Content for Device Endpoint-Specific Events (DEPEVT) */
258#define EXYNOS_USB3_DEPEVT_EventParam_MASK (0xffff << 16)
259#define EXYNOS_USB3_DEPEVT_EventParam_SHIFT 16
260#define EXYNOS_USB3_DEPEVT_EventParam(_x) ((_x) << 16)
261#define EXYNOS_USB3_DEPEVT_EventStatus_MASK (0xf << 12)
262#define EXYNOS_USB3_DEPEVT_EventStatus_SHIFT 12
263#define EXYNOS_USB3_DEPEVT_EVENT_MASK (0xf << 6)
264#define EXYNOS_USB3_DEPEVT_EVENT_SHIFT 6
265#define EXYNOS_USB3_DEPEVT_EVENT_EPCmdCmplt (7 << 6)
266#define EXYNOS_USB3_DEPEVT_EVENT_StreamEvt (6 << 6)
267#define EXYNOS_USB3_DEPEVT_EVENT_RxTxfifoEvt (4 << 6)
268#define EXYNOS_USB3_DEPEVT_EVENT_XferNotReady (3 << 6)
269#define EXYNOS_USB3_DEPEVT_EVENT_XferInProgress (2 << 6)
270#define EXYNOS_USB3_DEPEVT_EVENT_XferComplete (1 << 6)
271#define EXYNOS_USB3_DEPEVT_EPNUM_MASK (0x1f << 1)
272#define EXYNOS_USB3_DEPEVT_EPNUM_SHIFT 1
273#define EXYNOS_USB3_DEPEVT_EPNUM(_x) ((_x) << 1)
274
275/* Event Buffer Content for Device-Specific Events (DEVT) */
276#define EXYNOS_USB3_DEVT_EventParam_MASK (0xf << 16)
277#define EXYNOS_USB3_DEVT_EventParam_SHIFT 16
278#define EXYNOS_USB3_DEVT_EventParam_SS (1 << 20)
279#define EXYNOS_USB3_DEVT_EventParam(_x) ((_x) << 16)
280#define EXYNOS_USB3_DEVT_EVENT_MASK (0xf << 8)
281#define EXYNOS_USB3_DEVT_EVENT_SHIFT 8
282#define EXYNOS_USB3_DEVT_EVENT_VndrDevTstRcved (12 << 8)
283#define EXYNOS_USB3_DEVT_EVENT_EvntOverflow (11 << 8)
284#define EXYNOS_USB3_DEVT_EVENT_CmdCmplt (10 << 8)
285#define EXYNOS_USB3_DEVT_EVENT_ErrticErr (9 << 8)
286#define EXYNOS_USB3_DEVT_EVENT_Sof (7 << 8)
287#define EXYNOS_USB3_DEVT_EVENT_EOPF (6 << 8)
288#define EXYNOS_USB3_DEVT_EVENT_WkUpEvt (4 << 8)
289#define EXYNOS_USB3_DEVT_EVENT_ULStChng (3 << 8)
290#define EXYNOS_USB3_DEVT_EVENT_ConnectDone (2 << 8)
291#define EXYNOS_USB3_DEVT_EVENT_USBRst (1 << 8)
292#define EXYNOS_USB3_DEVT_EVENT_DisconnEvt (0 << 8)
293
294#define EXYNOS_USB3_GHWPARAMS8 0xC600
295
296/* USB 2.0 OTG and Battery Charger registers */
297#define EXYNOS_USB3_OCFG 0xCC00
298#define EXYNOS_USB3_OCFG_OTG_Version (1 << 2)
299#define EXYNOS_USB3_OCFG_HNPCap (1 << 1)
300#define EXYNOS_USB3_OCFG_SRPCap (1 << 0)
301
302#define EXYNOS_USB3_OCTL 0xCC04
303#define EXYNOS_USB3_OCTL_PeriMode (1 << 6)
304#define EXYNOS_USB3_OCTL_PrtPwrCtl (1 << 5)
305#define EXYNOS_USB3_OCTL_HNPReq (1 << 4)
306#define EXYNOS_USB3_OCTL_SesReq (1 << 3)
307#define EXYNOS_USB3_OCTL_TermSelDLPulse (1 << 2)
308#define EXYNOS_USB3_OCTL_DevSetHNPEn (1 << 1)
309#define EXYNOS_USB3_OCTL_HstSetHNPEn (1 << 0)
310
311#define EXYNOS_USB3_OEVT 0xCC08
312#define EXYNOS_USB3_OEVT_DeviceMode (1 << 31)
313#define EXYNOS_USB3_OEVT_OTGConIDStsChngEvnt (1 << 24)
314#define EXYNOS_USB3_OEVT_OTGADevBHostEndEvnt (1 << 20)
315#define EXYNOS_USB3_OEVT_OTGADevHostEvnt (1 << 19)
316#define EXYNOS_USB3_OEVT_OTGADevHNPChngEvnt (1 << 18)
317#define EXYNOS_USB3_OEVT_OTGADevSRPDetEvnt (1 << 17)
318#define EXYNOS_USB3_OEVT_OTGADevSessEndDetEvnt (1 << 16)
319#define EXYNOS_USB3_OEVT_OTGBDevBHostEndEvnt (1 << 11)
320#define EXYNOS_USB3_OEVT_OTGBDevHNPChngEvnt (1 << 10)
321#define EXYNOS_USB3_OEVT_OTGBDevSessVldDetEvnt (1 << 9)
322#define EXYNOS_USB3_OEVT_OTGBDevVBUSChngEvnt (1 << 8)
323#define EXYNOS_USB3_OEVT_BSesVld (1 << 3)
324#define EXYNOS_USB3_OEVT_HstNegSts (1 << 2)
325#define EXYNOS_USB3_OEVT_SesReqSts (1 << 1)
326#define EXYNOS_USB3_OEVT_OEVTError (1 << 0)
327
328#define EXYNOS_USB3_OEVTEN 0xCC0C
329#define EXYNOS_USB3_OEVTEN_OTGConIDStsChngEvntEn (1 << 24)
330#define EXYNOS_USB3_OEVTEN_OTGADevBHostEndEvntEn (1 << 20)
331#define EXYNOS_USB3_OEVTEN_OTGADevHostEvntEn (1 << 19)
332#define EXYNOS_USB3_OEVTEN_OTGADevHNPChngEvntEn (1 << 18)
333#define EXYNOS_USB3_OEVTEN_OTGADevSRPDetEvntEn (1 << 17)
334#define EXYNOS_USB3_OEVTEN_OTGADevSessEndDetEvntEn (1 << 16)
335#define EXYNOS_USB3_OEVTEN_OTGBDevBHostEndEvntEn (1 << 11)
336#define EXYNOS_USB3_OEVTEN_OTGBDevHNPChngEvntEn (1 << 10)
337#define EXYNOS_USB3_OEVTEN_OTGBDevSessVldDetEvntEn (1 << 9)
338#define EXYNOS_USB3_OEVTEN_OTGBDevVBUSChngEvntEn (1 << 8)
339
340#define EXYNOS_USB3_OSTS 0xCC10
341#define EXYNOS_USB3_OSTS_OTG_state_MASK (0xf << 8)
342#define EXYNOS_USB3_OSTS_OTG_state_SHIFT 8
343#define EXYNOS_USB3_OSTS_OTG_state(_x) ((_x) << 8)
344#define EXYNOS_USB3_OSTS_PeripheralState (1 << 4)
345#define EXYNOS_USB3_OSTS_xHCIPrtPower (1 << 3)
346#define EXYNOS_USB3_OSTS_BSesVld (1 << 2)
347#define EXYNOS_USB3_OSTS_VbusVld (1 << 1)
348#define EXYNOS_USB3_OSTS_ConIDSts (1 << 0)
349
350#define EXYNOS_USB3_ADPCFG 0xCC20
351#define EXYNOS_USB3_ADPCFG_PrbPer_MASK (0x3 << 30)
352#define EXYNOS_USB3_ADPCFG_PrbPer_SHIFT 30
353#define EXYNOS_USB3_ADPCFG_PrbPer(_x) ((_x) << 30)
354#define EXYNOS_USB3_ADPCFG_PrbDelta_MASK (0x3 << 28)
355#define EXYNOS_USB3_ADPCFG_PrbDelta_SHIFT 28
356#define EXYNOS_USB3_ADPCFG_PrbDelta(_x) ((_x) << 28)
357#define EXYNOS_USB3_ADPCFG_PrbDschg_MASK (0x3 << 26)
358#define EXYNOS_USB3_ADPCFG_PrbDschg_SHIFT 26
359#define EXYNOS_USB3_ADPCFG_PrbDschg(_x) ((_x) << 26)
360
361#define EXYNOS_USB3_ADPCTL 0xCC24
362#define EXYNOS_USB3_ADPCTL_EnaPrb (1 << 28)
363#define EXYNOS_USB3_ADPCTL_EnaSns (1 << 27)
364#define EXYNOS_USB3_ADPCTL_ADPEn (1 << 26)
365#define EXYNOS_USB3_ADPCTL_ADPRes (1 << 25)
366#define EXYNOS_USB3_ADPCTL_WB (1 << 24)
367
368#define EXYNOS_USB3_ADPEVT 0xCC28
369#define EXYNOS_USB3_ADPEVT_AdpPrbEvnt (1 << 28)
370#define EXYNOS_USB3_ADPEVT_AdpSnsEvnt (1 << 27)
371#define EXYNOS_USB3_ADPEVT_AdpTmoutEvnt (1 << 26)
372#define EXYNOS_USB3_ADPEVT_ADPRstCmpltEvnt (1 << 25)
373#define EXYNOS_USB3_ADPEVT_RTIM_MASK (0x7ff << 0)
374#define EXYNOS_USB3_ADPEVT_RTIM_SHIFT 0
375#define EXYNOS_USB3_ADPEVT_RTIM(_x) ((_x) << 0)
376
377#define EXYNOS_USB3_ADPEVTEN 0xCC2C
378#define EXYNOS_USB3_ADPEVTEN_AdpPrbEvntEn (1 << 28)
379#define EXYNOS_USB3_ADPEVTEN_AdpSnsEvntEn (1 << 27)
380#define EXYNOS_USB3_ADPEVTEN_AdpTmoutEvntEn (1 << 26)
381#define EXYNOS_USB3_ADPEVTEN_ADPRstCmpltEvntEn (1 << 25)
382
383#define EXYNOS_USB3_BCFG 0xCC30
384#define EXYNOS_USB3_BCFG_IDDIG_SEL (1 << 1)
385#define EXYNOS_USB3_BCFG_CHIRP_EN (1 << 0)
386
387#define EXYNOS_USB3_BCEVT 0xCC38
388#define EXYNOS_USB3_BCEVT_MV_ChngEvnt (1 << 24)
389#define EXYNOS_USB3_BCEVT_MultValIdBc_MASK (0x1f << 0)
390#define EXYNOS_USB3_BCEVT_MultValIdBc_SHIFT 0
391#define EXYNOS_USB3_BCEVT_MultValIdBc(_x) ((_x) << 0)
392
393#define EXYNOS_USB3_BCEVTEN 0xCC3C
394#define EXYNOS_USB3_BCEVTEN_MV_ChngEvntEn (1 << 24)
395
396#endif /* __LINUX_USB_EXYNOS_USB3_DRD_H */
diff --git a/include/linux/usb/f_accessory.h b/include/linux/usb/f_accessory.h
new file mode 100644
index 00000000000..5b2dcf9728e
--- /dev/null
+++ b/include/linux/usb/f_accessory.h
@@ -0,0 +1,83 @@
1/*
2 * Gadget Function Driver for Android USB accessories
3 *
4 * Copyright (C) 2011 Google, Inc.
5 * Author: Mike Lockwood <lockwood@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __LINUX_USB_F_ACCESSORY_H
19#define __LINUX_USB_F_ACCESSORY_H
20
21/* Use Google Vendor ID when in accessory mode */
22#define USB_ACCESSORY_VENDOR_ID 0x18D1
23
24
25/* Product ID to use when in accessory mode */
26#define USB_ACCESSORY_PRODUCT_ID 0x2D00
27
28/* Product ID to use when in accessory mode and adb is enabled */
29#define USB_ACCESSORY_ADB_PRODUCT_ID 0x2D01
30
31/* Indexes for strings sent by the host via ACCESSORY_SEND_STRING */
32#define ACCESSORY_STRING_MANUFACTURER 0
33#define ACCESSORY_STRING_MODEL 1
34#define ACCESSORY_STRING_DESCRIPTION 2
35#define ACCESSORY_STRING_VERSION 3
36#define ACCESSORY_STRING_URI 4
37#define ACCESSORY_STRING_SERIAL 5
38
39/* Control request for retrieving device's protocol version (currently 1)
40 *
41 * requestType: USB_DIR_IN | USB_TYPE_VENDOR
42 * request: ACCESSORY_GET_PROTOCOL
43 * value: 0
44 * index: 0
45 * data version number (16 bits little endian)
46 */
47#define ACCESSORY_GET_PROTOCOL 51
48
49/* Control request for host to send a string to the device
50 *
51 * requestType: USB_DIR_OUT | USB_TYPE_VENDOR
52 * request: ACCESSORY_SEND_STRING
53 * value: 0
54 * index: string ID
55 * data zero terminated UTF8 string
56 *
57 * The device can later retrieve these strings via the
58 * ACCESSORY_GET_STRING_* ioctls
59 */
60#define ACCESSORY_SEND_STRING 52
61
62/* Control request for starting device in accessory mode.
63 * The host sends this after setting all its strings to the device.
64 *
65 * requestType: USB_DIR_OUT | USB_TYPE_VENDOR
66 * request: ACCESSORY_START
67 * value: 0
68 * index: 0
69 * data none
70 */
71#define ACCESSORY_START 53
72
73/* ioctls for retrieving strings set by the host */
74#define ACCESSORY_GET_STRING_MANUFACTURER _IOW('M', 1, char[256])
75#define ACCESSORY_GET_STRING_MODEL _IOW('M', 2, char[256])
76#define ACCESSORY_GET_STRING_DESCRIPTION _IOW('M', 3, char[256])
77#define ACCESSORY_GET_STRING_VERSION _IOW('M', 4, char[256])
78#define ACCESSORY_GET_STRING_URI _IOW('M', 5, char[256])
79#define ACCESSORY_GET_STRING_SERIAL _IOW('M', 6, char[256])
80/* returns 1 if there is a start request pending */
81#define ACCESSORY_IS_START_REQUESTED _IO('M', 7)
82
83#endif /* __LINUX_USB_F_ACCESSORY_H */
diff --git a/include/linux/usb/f_mtp.h b/include/linux/usb/f_mtp.h
new file mode 100644
index 00000000000..7422b17c6eb
--- /dev/null
+++ b/include/linux/usb/f_mtp.h
@@ -0,0 +1,75 @@
1/*
2 * Gadget Function Driver for MTP
3 *
4 * Copyright (C) 2010 Google, Inc.
5 * Author: Mike Lockwood <lockwood@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __LINUX_USB_F_MTP_H
19#define __LINUX_USB_F_MTP_H
20
21#include <linux/ioctl.h>
22
23#ifdef __KERNEL__
24
25struct mtp_data_header {
26 /* length of packet, including this header */
27 uint32_t length;
28 /* container type (2 for data packet) */
29 uint16_t type;
30 /* MTP command code */
31 uint16_t command;
32 /* MTP transaction ID */
33 uint32_t transaction_id;
34};
35
36#endif /* __KERNEL__ */
37
38struct mtp_file_range {
39 /* file descriptor for file to transfer */
40 int fd;
41 /* offset in file for start of transfer */
42 loff_t offset;
43 /* number of bytes to transfer */
44 int64_t length;
45 /* MTP command ID for data header,
46 * used only for MTP_SEND_FILE_WITH_HEADER
47 */
48 uint16_t command;
49 /* MTP transaction ID for data header,
50 * used only for MTP_SEND_FILE_WITH_HEADER
51 */
52 uint32_t transaction_id;
53};
54
55struct mtp_event {
56 /* size of the event */
57 size_t length;
58 /* event data to send */
59 void *data;
60};
61
62/* Sends the specified file range to the host */
63#define MTP_SEND_FILE _IOW('M', 0, struct mtp_file_range)
64/* Receives data from the host and writes it to a file.
65 * The file is created if it does not exist.
66 */
67#define MTP_RECEIVE_FILE _IOW('M', 1, struct mtp_file_range)
68/* Sends an event to the host via the interrupt endpoint */
69#define MTP_SEND_EVENT _IOW('M', 3, struct mtp_event)
70/* Sends the specified file range to the host,
71 * with a 12 byte MTP data packet header at the beginning.
72 */
73#define MTP_SEND_FILE_WITH_HEADER _IOW('M', 4, struct mtp_file_range)
74
75#endif /* __LINUX_USB_F_MTP_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index dd1571db55e..e4144c48575 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -131,6 +131,7 @@ struct usb_ep_ops {
131 * @maxpacket:The maximum packet size used on this endpoint. The initial 131 * @maxpacket:The maximum packet size used on this endpoint. The initial
132 * value can sometimes be reduced (hardware allowing), according to 132 * value can sometimes be reduced (hardware allowing), according to
133 * the endpoint descriptor used to configure the endpoint. 133 * the endpoint descriptor used to configure the endpoint.
134 * @maxburst: The maximum burst size.
134 * @driver_data:for use by the gadget driver. all other fields are 135 * @driver_data:for use by the gadget driver. all other fields are
135 * read-only to gadget drivers. 136 * read-only to gadget drivers.
136 * 137 *
@@ -145,6 +146,9 @@ struct usb_ep {
145 const struct usb_ep_ops *ops; 146 const struct usb_ep_ops *ops;
146 struct list_head ep_list; 147 struct list_head ep_list;
147 unsigned maxpacket:16; 148 unsigned maxpacket:16;
149
150 unsigned numstreams:5;
151 unsigned maxburst:4;
148}; 152};
149 153
150/*-------------------------------------------------------------------------*/ 154/*-------------------------------------------------------------------------*/
@@ -416,6 +420,13 @@ static inline void usb_ep_fifo_flush(struct usb_ep *ep)
416 420
417/*-------------------------------------------------------------------------*/ 421/*-------------------------------------------------------------------------*/
418 422
423struct usb_dcd_config_params {
424 __u8 bU1devExitLat; /* U1 Device exit Latency */
425#define USB_DEFAULT_U1_DEV_EXIT_LAT 0x01 /* Less then 1 microsec */
426 __le16 bU2DevExitLat; /* U2 Device exit Latency */
427#define USB_DEFAULT_U2_DEV_EXIT_LAT 0x1F4 /* Less then 500 microsec */
428};
429
419struct usb_gadget; 430struct usb_gadget;
420 431
421/* the rest of the api to the controller hardware: device operations, 432/* the rest of the api to the controller hardware: device operations,
@@ -430,6 +441,7 @@ struct usb_gadget_ops {
430 int (*pullup) (struct usb_gadget *, int is_on); 441 int (*pullup) (struct usb_gadget *, int is_on);
431 int (*ioctl)(struct usb_gadget *, 442 int (*ioctl)(struct usb_gadget *,
432 unsigned code, unsigned long param); 443 unsigned code, unsigned long param);
444 void (*get_config_params)(struct usb_dcd_config_params *);
433}; 445};
434 446
435/** 447/**
@@ -521,6 +533,24 @@ static inline int gadget_is_dualspeed(struct usb_gadget *g)
521} 533}
522 534
523/** 535/**
536 * gadget_is_superspeed() - return true if the hardware handles
537 * supperspeed
538 * @g: controller that might support supper speed
539 */
540static inline int gadget_is_superspeed(struct usb_gadget *g)
541{
542#ifdef CONFIG_USB_GADGET_SUPERSPEED
543 /*
544 * runtime test would check "g->is_superspeed" ... that might be
545 * useful to work around hardware bugs, but is mostly pointless
546 */
547 return 1;
548#else
549 return 0;
550#endif
551}
552
553/**
524 * gadget_is_otg - return true iff the hardware is OTG-ready 554 * gadget_is_otg - return true iff the hardware is OTG-ready
525 * @g: controller that might have a Mini-AB connector 555 * @g: controller that might have a Mini-AB connector
526 * 556 *
diff --git a/include/linux/usb/hsic_usb3503.h b/include/linux/usb/hsic_usb3503.h
new file mode 100644
index 00000000000..76600efb4b5
--- /dev/null
+++ b/include/linux/usb/hsic_usb3503.h
@@ -0,0 +1,62 @@
1#ifndef __HSIC_USB3503_H__
2#define __HSIC_USB3503_H__
3
4#define USB3503_VIDL 0x00
5#define USB3503_VIDM 0x01
6#define USB3503_PIDL 0x02
7#define USB3503_PIDM 0x03
8#define USB3503_DIDL 0x04
9#define USB3503_DIDM 0x05
10#define USB3503_CFG1 0x06
11#define USB3503_CFG2 0x07
12#define USB3503_CFG3 0x08
13#define USB3503_NRD 0x09
14#define USB3503_PDS 0x0A
15#define USB3503_PDB 0x0B
16#define USB3503_MAXPS 0x0C
17#define USB3503_MAXPB 0x0D
18#define USB3503_HCMCS 0x0E
19#define USB3503_HCMCB 0x0F
20
21#define USB3503_PWRT 0x10
22#define USB3503_LANGIDH 0x11
23#define USB3503_LANGIDL 0x12
24#define USB3503_MFRSL 0x13
25#define USB3503_PRDSL 0x14
26#define USB3503_SERSL 0x15
27
28#define USB3503_MANSTR 0x16 // 0x16 ~ 0x53 Manufacture string
29#define USB3503_PRDSTR 0x54 // 0x54 ~ 0x91 Product string
30#define USB3503_SERSTR 0x92 // 0x92 ~ 0xCF Serial string
31
32#define USB3503_BCEN 0xD0
33
34#define USB3503_PRTPWR 0xE5
35#define USB3503_OCS 0xE6
36#define USB3503_SP_ILOCK 0xE7
37#define USB3503_INT_STATUS 0xE8
38#define USB3503_INT_MASK 0xE9
39
40#define USB3503_CFGP 0xEE
41
42#define USB3503_VSNSUP3 0xF4
43#define USB3503_VSNS21 0xF5
44#define USB3503_BSTUP3 0xF6
45#define USB3503_BST21 0xF8
46
47#define USB3503_PRTSP 0xFA
48#define USB3503_PRTR12 0xFB
49#define USB3503_PRTR34 0xFC
50
51#define USB3503_STCD 0xFF
52
53
54struct usb3503_platform_data {
55 int gpio_reset;
56 int gpio_hub_con;
57
58 int sys_irq;
59 int irq_gpio;
60};
61
62#endif //__HSIC_USB3503_H__
diff --git a/include/linux/usb/otg_id.h b/include/linux/usb/otg_id.h
new file mode 100644
index 00000000000..f9f5189a73b
--- /dev/null
+++ b/include/linux/usb/otg_id.h
@@ -0,0 +1,58 @@
1/*
2 * Copyright (C) 2011 Google, Inc.
3 *
4 * Author:
5 * Colin Cross <ccross@android.com>
6 *
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 */
17
18#ifndef __LINUX_USB_OTG_ID_H
19#define __LINUX_USB_OTG_ID_H
20
21#include <linux/notifier.h>
22#include <linux/plist.h>
23
24/**
25 * otg_id_notifier_block
26 *
27 * @priority: Order the notifications will be called in. Higher numbers
28 * get called first.
29 * @detect: Called during otg_id_notify. Return OTG_ID_HANDLED if the USB cable
30 * has been identified
31 * @proxy_wait: Called during otg_id_notify if a previous handler returns
32 * OTG_ID_PROXY_WAIT. This should wait on ID change then call otg_id_notify.
33 * This is used when a handler knows what's connected but can't detect
34 * the change itself.
35 * @cancel: Called after detect has returned OTG_ID_HANDLED to ask it to
36 * release detection resources to allow a new identification to occur.
37 */
38
39struct otg_id_notifier_block {
40 int priority;
41 int (*detect)(struct otg_id_notifier_block *otg_id_nb);
42 int (*proxy_wait)(struct otg_id_notifier_block *otg_id_nb);
43 void (*cancel)(struct otg_id_notifier_block *otg_id_nb);
44 struct plist_node p;
45};
46
47#define OTG_ID_PROXY_WAIT 2
48#define OTG_ID_HANDLED 1
49#define OTG_ID_UNHANDLED 0
50
51int otg_id_register_notifier(struct otg_id_notifier_block *otg_id_nb);
52void otg_id_unregister_notifier(struct otg_id_notifier_block *otg_id_nb);
53
54void otg_id_notify(void);
55int otg_id_suspend(void);
56void otg_id_resume(void);
57
58#endif /* __LINUX_USB_OTG_ID_H */
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index 76f439647c4..2a38d4e8c68 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -47,6 +47,7 @@ struct usbnet {
47 u32 xid; 47 u32 xid;
48 u32 hard_mtu; /* count any extra framing */ 48 u32 hard_mtu; /* count any extra framing */
49 size_t rx_urb_size; /* size for rx urbs */ 49 size_t rx_urb_size; /* size for rx urbs */
50 int rx_queue_enable;
50 struct mii_if_info mii; 51 struct mii_if_info mii;
51 52
52 /* various kinds of pending driver work */ 53 /* various kinds of pending driver work */
diff --git a/include/linux/v4l2-mediabus.h b/include/linux/v4l2-mediabus.h
index 5ea7f753a34..1a13cf3e582 100644
--- a/include/linux/v4l2-mediabus.h
+++ b/include/linux/v4l2-mediabus.h
@@ -46,6 +46,7 @@ enum v4l2_mbus_pixelcode {
46 V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006, 46 V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006,
47 V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007, 47 V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
48 V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008, 48 V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
49 V4L2_MBUS_FMT_XRGB8888_4X8_LE = 0x1009,
49 50
50 /* YUV (including grey) - next is 0x2014 */ 51 /* YUV (including grey) - next is 0x2014 */
51 V4L2_MBUS_FMT_Y8_1X8 = 0x2001, 52 V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
@@ -65,6 +66,7 @@ enum v4l2_mbus_pixelcode {
65 V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010, 66 V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010,
66 V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011, 67 V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011,
67 V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012, 68 V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012,
69 V4L2_MBUS_FMT_YUV8_1X24 = 0x2014,
68 V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d, 70 V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
69 V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e, 71 V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
70 72
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index eeeda13b4d5..2abdc21a04c 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -345,11 +345,14 @@ struct v4l2_pix_format {
345#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ 345#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
346 346
347/* two non contiguous planes - one Y, one Cr + Cb interleaved */ 347/* two non contiguous planes - one Y, one Cr + Cb interleaved */
348#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */ 348#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
349#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */ 349#define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') /* 21 Y/CrCb 4:2:0 */
350#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
351#define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 16x16 macroblocks */
350 352
351/* three non contiguous planes - Y, Cb, Cr */ 353/* three non contiguous planes - Y, Cb, Cr */
352#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */ 354#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'U', 'V', 'M') /* 12 YUV420 planar */
355#define V4L2_PIX_FMT_YVU420M v4l2_fourcc('Y', 'V', 'U', 'M') /* 12 YVU420 planar */
353 356
354/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */ 357/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */
355#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ 358#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */
@@ -378,6 +381,22 @@ struct v4l2_pix_format {
378#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */ 381#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */
379#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */ 382#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */
380 383
384
385#define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /* H264 */
386#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */
387#define V4L2_PIX_FMT_MPEG12 v4l2_fourcc('M', 'P', '1', '2') /* MPEG-1/2 */
388#define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 */
389#define V4L2_PIX_FMT_FIMV v4l2_fourcc('F', 'I', 'M', 'V') /* FIMV */
390#define V4L2_PIX_FMT_FIMV1 v4l2_fourcc('F', 'I', 'M', '1') /* FIMV1 */
391#define V4L2_PIX_FMT_FIMV2 v4l2_fourcc('F', 'I', 'M', '2') /* FIMV2 */
392#define V4L2_PIX_FMT_FIMV3 v4l2_fourcc('F', 'I', 'M', '3') /* FIMV3 */
393#define V4L2_PIX_FMT_FIMV4 v4l2_fourcc('F', 'I', 'M', '4') /* FIMV4 */
394#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */
395#define V4L2_PIX_FMT_VC1 v4l2_fourcc('V', 'C', '1', 'A') /* VC-1 */
396#define V4L2_PIX_FMT_VC1_RCV v4l2_fourcc('V', 'C', '1', 'R') /* VC-1 RCV */
397#define V4L2_PIX_FMT_VP8 v4l2_fourcc('V', 'P', '8', '0') /* VP8 */
398
399
381/* Vendor-specific formats */ 400/* Vendor-specific formats */
382#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */ 401#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
383#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */ 402#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */
@@ -403,6 +422,13 @@ struct v4l2_pix_format {
403#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */ 422#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */
404#define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */ 423#define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */
405 424
425#define V4L2_PIX_FMT_JPEG_444 v4l2_fourcc('J', 'P', 'G', '4') /* yuv444 of JFIF JPEG */
426#define V4L2_PIX_FMT_JPEG_422 v4l2_fourcc('J', 'P', 'G', '2') /* yuv422 of JFIF JPEG */
427#define V4L2_PIX_FMT_JPEG_420 v4l2_fourcc('J', 'P', 'G', '0') /* yuv420 of JFIF JPEG */
428#define V4L2_PIX_FMT_JPEG_GRAY v4l2_fourcc('J', 'P', 'G', 'G') /* grey of JFIF JPEG */
429#define V4L2_PIX_FMT_YUV444_2P v4l2_fourcc('Y', 'U', '2', 'P') /* 16 xxxxyyyy uuuuvvvv */
430#define V4L2_PIX_FMT_YVU444_2P v4l2_fourcc('Y', 'V', '2', 'P') /* 16 xxxxyyyy uuuuvvvv */
431#define V4L2_PIX_FMT_YUV444_3P v4l2_fourcc('Y', 'U', '3', 'P') /* 16 xxxxyyyy uuuuvvvv */
406/* 432/*
407 * F O R M A T E N U M E R A T I O N 433 * F O R M A T E N U M E R A T I O N
408 */ 434 */
@@ -580,7 +606,9 @@ struct v4l2_plane {
580 unsigned long userptr; 606 unsigned long userptr;
581 } m; 607 } m;
582 __u32 data_offset; 608 __u32 data_offset;
583 __u32 reserved[11]; 609 void *cookie;
610 void *share;
611 __u32 reserved[9];
584}; 612};
585 613
586/** 614/**
@@ -873,6 +901,34 @@ struct v4l2_dv_enum_preset {
873#define V4L2_DV_1080P50 17 /* BT.1120 */ 901#define V4L2_DV_1080P50 17 /* BT.1120 */
874#define V4L2_DV_1080P60 18 /* BT.1120 */ 902#define V4L2_DV_1080P60 18 /* BT.1120 */
875 903
904#define V4L2_DV_480P60 19
905#define V4L2_DV_1080I59_94 20
906#define V4L2_DV_1080P59_94 21
907
908#define V4L2_DV_720P60_FP 22
909#define V4L2_DV_720P60_SB_HALF 23
910#define V4L2_DV_720P60_TB 24
911#define V4L2_DV_720P59_94_FP 25
912#define V4L2_DV_720P59_94_SB_HALF 26
913#define V4L2_DV_720P59_94_TB 27
914#define V4L2_DV_720P50_FP 28
915#define V4L2_DV_720P50_SB_HALF 29
916#define V4L2_DV_720P50_TB 30
917#define V4L2_DV_1080P24_FP 31
918#define V4L2_DV_1080P24_SB_HALF 32
919#define V4L2_DV_1080P24_TB 33
920#define V4L2_DV_1080P23_98_FP 34
921#define V4L2_DV_1080P23_98_SB_HALF 35
922#define V4L2_DV_1080P23_98_TB 36
923#define V4L2_DV_1080I60_SB_HALF 37
924#define V4L2_DV_1080I59_94_SB_HALF 38
925#define V4L2_DV_1080I50_SB_HALF 39
926#define V4L2_DV_1080P60_SB_HALF 40
927#define V4L2_DV_1080P60_TB 41
928#define V4L2_DV_1080P30_FP 42
929#define V4L2_DV_1080P30_SB_HALF 43
930#define V4L2_DV_1080P30_TB 44
931
876/* 932/*
877 * D V B T T I M I N G S 933 * D V B T T I M I N G S
878 */ 934 */
@@ -1026,6 +1082,7 @@ struct v4l2_ext_controls {
1026#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ 1082#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
1027#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ 1083#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
1028#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ 1084#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
1085#define V4L2_CTRL_CLASS_CODEC 0x009c0000 /* Codec control class */
1029 1086
1030#define V4L2_CTRL_ID_MASK (0x0fffffff) 1087#define V4L2_CTRL_ID_MASK (0x0fffffff)
1031#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) 1088#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
@@ -1145,8 +1202,36 @@ enum v4l2_colorfx {
1145#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37) 1202#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37)
1146#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38) 1203#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38)
1147 1204
1205/*
1206 * This is custom CID
1207 */
1208/* for rgb alpha function */
1209#define V4L2_CID_GLOBAL_ALPHA (V4L2_CID_BASE+39)
1210
1211/* cacheable configuration */
1212#define V4L2_CID_CACHEABLE (V4L2_CID_BASE+40)
1213
1214/* jpeg captured size */
1215#define V4L2_CID_CAM_JPEG_MEMSIZE (V4L2_CID_BASE+41)
1216#define V4L2_CID_CAM_JPEG_ENCODEDSIZE (V4L2_CID_BASE+42)
1217
1218#define V4L2_CID_SET_SHAREABLE (V4L2_CID_BASE+43)
1219
1220/* TV configuration */
1221#define V4L2_CID_TV_LAYER_BLEND_ENABLE (V4L2_CID_BASE+44)
1222#define V4L2_CID_TV_LAYER_BLEND_ALPHA (V4L2_CID_BASE+45)
1223#define V4L2_CID_TV_PIXEL_BLEND_ENABLE (V4L2_CID_BASE+46)
1224#define V4L2_CID_TV_CHROMA_ENABLE (V4L2_CID_BASE+47)
1225#define V4L2_CID_TV_CHROMA_VALUE (V4L2_CID_BASE+48)
1226#define V4L2_CID_TV_HPD_STATUS (V4L2_CID_BASE+49)
1227
1228/* for color space conversion equation selection */
1229#define V4L2_CID_CSC_EQ_MODE (V4L2_CID_BASE+50)
1230#define V4L2_CID_CSC_EQ (V4L2_CID_BASE+51)
1231#define V4L2_CID_CSC_RANGE (V4L2_CID_BASE+52)
1232
1148/* last CID + 1 */ 1233/* last CID + 1 */
1149#define V4L2_CID_LASTP1 (V4L2_CID_BASE+39) 1234#define V4L2_CID_LASTP1 (V4L2_CID_BASE+53)
1150 1235
1151/* MPEG-class control IDs defined by V4L2 */ 1236/* MPEG-class control IDs defined by V4L2 */
1152#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) 1237#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
@@ -1360,6 +1445,224 @@ enum v4l2_mpeg_cx2341x_video_median_filter_type {
1360#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) 1445#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
1361#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11) 1446#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11)
1362 1447
1448/* For codecs */
1449
1450#define V4L2_CID_CODEC_BASE (V4L2_CTRL_CLASS_CODEC | 0x900)
1451#define V4L2_CID_CODEC_CLASS (V4L2_CTRL_CLASS_CODEC | 1)
1452
1453/* Codec class control IDs specific to the MFC5X driver */
1454#define V4L2_CID_CODEC_MFC5X_BASE (V4L2_CTRL_CLASS_CODEC | 0x1000)
1455
1456/* For both decoding and encoding */
1457
1458/* For decoding */
1459
1460#define V4L2_CID_CODEC_LOOP_FILTER_MPEG4_ENABLE (V4L2_CID_CODEC_BASE + 110)
1461#define V4L2_CID_CODEC_DISPLAY_DELAY (V4L2_CID_CODEC_BASE + 137)
1462#define V4L2_CID_CODEC_REQ_NUM_BUFS (V4L2_CID_CODEC_BASE + 140)
1463#define V4L2_CID_CODEC_SLICE_INTERFACE (V4L2_CID_CODEC_BASE + 141)
1464#define V4L2_CID_CODEC_PACKED_PB (V4L2_CID_CODEC_BASE + 142)
1465#define V4L2_CID_CODEC_FRAME_TAG (V4L2_CID_CODEC_BASE + 143)
1466#define V4L2_CID_CODEC_CRC_ENABLE (V4L2_CID_CODEC_BASE + 144)
1467#define V4L2_CID_CODEC_CRC_DATA_LUMA (V4L2_CID_CODEC_BASE + 145)
1468#define V4L2_CID_CODEC_CRC_DATA_CHROMA (V4L2_CID_CODEC_BASE + 146)
1469#define V4L2_CID_CODEC_CRC_DATA_LUMA_BOT (V4L2_CID_CODEC_BASE + 147)
1470#define V4L2_CID_CODEC_CRC_DATA_CHROMA_BOT (V4L2_CID_CODEC_BASE + 148)
1471#define V4L2_CID_CODEC_CRC_GENERATED (V4L2_CID_CODEC_BASE + 149)
1472#define V4L2_CID_CODEC_FRAME_TYPE (V4L2_CID_CODEC_BASE + 154)
1473#define V4L2_CID_CODEC_CHECK_STATE (V4L2_CID_CODEC_BASE + 155)
1474#define V4L2_CID_CODEC_DISPLAY_STATUS (V4L2_CID_CODEC_BASE + 156)
1475#define V4L2_CID_CODEC_FRAME_PACK_SEI_PARSE (V4L2_CID_CODEC_BASE + 157)
1476#define V4L2_CID_CODEC_FRAME_PACK_SEI_AVAIL (V4L2_CID_CODEC_BASE + 158)
1477#define V4L2_CID_CODEC_FRAME_PACK_ARRGMENT_ID (V4L2_CID_CODEC_BASE + 159)
1478#define V4L2_CID_CODEC_FRAME_PACK_SEI_INFO (V4L2_CID_CODEC_BASE + 160)
1479#define V4L2_CID_CODEC_FRAME_PACK_GRID_POS (V4L2_CID_CODEC_BASE + 161)
1480
1481/* For encoding */
1482#define V4L2_CID_CODEC_LOOP_FILTER_H264 (V4L2_CID_CODEC_BASE + 9)
1483enum v4l2_cid_codec_loop_filter_h264 {
1484 V4L2_CID_CODEC_LOOP_FILTER_H264_ENABLE = 0,
1485 V4L2_CID_CODEC_LOOP_FILTER_H264_DISABLE = 1,
1486 V4L2_CID_CODEC_LOOP_FILTER_H264_DISABLE_AT_BOUNDARY = 2,
1487};
1488
1489#define V4L2_CID_CODEC_FRAME_INSERTION (V4L2_CID_CODEC_BASE + 10)
1490enum v4l2_cid_codec_frame_insertion {
1491 V4L2_CID_CODEC_FRAME_INSERT_NONE = 0x0,
1492 V4L2_CID_CODEC_FRAME_INSERT_I_FRAME = 0x1,
1493 V4L2_CID_CODEC_FRAME_INSERT_NOT_CODED = 0x2,
1494};
1495
1496#define V4L2_CID_CODEC_ENCODED_LUMA_ADDR (V4L2_CID_CODEC_BASE + 11)
1497#define V4L2_CID_CODEC_ENCODED_CHROMA_ADDR (V4L2_CID_CODEC_BASE + 12)
1498
1499#define V4L2_CID_CODEC_ENCODED_I_PERIOD_CH V4L2_CID_CODEC_MFC5X_ENC_GOP_SIZE
1500#define V4L2_CID_CODEC_ENCODED_FRAME_RATE_CH V4L2_CID_CODEC_MFC5X_ENC_H264_RC_FRAME_RATE
1501#define V4L2_CID_CODEC_ENCODED_BIT_RATE_CH V4L2_CID_CODEC_MFC5X_ENC_RC_BIT_RATE
1502
1503#define V4L2_CID_CODEC_FRAME_PACK_SEI_GEN (V4L2_CID_CODEC_BASE + 13)
1504#define V4L2_CID_CODEC_FRAME_PACK_FRM0_FLAG (V4L2_CID_CODEC_BASE + 14)
1505enum v4l2_codec_mfc5x_enc_flag {
1506 V4L2_CODEC_MFC5X_ENC_FLAG_DISABLE = 0,
1507 V4L2_CODEC_MFC5X_ENC_FLAG_ENABLE = 1,
1508};
1509#define V4L2_CID_CODEC_FRAME_PACK_ARRGMENT_TYPE (V4L2_CID_CODEC_BASE + 15)
1510enum v4l2_codec_mfc5x_enc_frame_pack_arrgment_type {
1511 V4L2_CODEC_MFC5X_ENC_FRAME_PACK_SIDE_BY_SIDE = 0,
1512 V4L2_CODEC_MFC5X_ENC_FRAME_PACK_TOP_AND_BOT = 1,
1513 V4L2_CODEC_MFC5X_ENC_FRAME_PACK_TMP_INTER = 2,
1514};
1515
1516/* common */
1517enum v4l2_codec_mfc5x_enc_switch {
1518 V4L2_CODEC_MFC5X_ENC_SW_DISABLE = 0,
1519 V4L2_CODEC_MFC5X_ENC_SW_ENABLE = 1,
1520};
1521enum v4l2_codec_mfc5x_enc_switch_inv {
1522 V4L2_CODEC_MFC5X_ENC_SW_INV_ENABLE = 0,
1523 V4L2_CODEC_MFC5X_ENC_SW_INV_DISABLE = 1,
1524};
1525#define V4L2_CID_CODEC_MFC5X_ENC_GOP_SIZE (V4L2_CID_CODEC_MFC5X_BASE+300)
1526#define V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MODE (V4L2_CID_CODEC_MFC5X_BASE+301)
1527enum v4l2_codec_mfc5x_enc_multi_slice_mode {
1528 V4L2_CODEC_MFC5X_ENC_MULTI_SLICE_MODE_DISABLE = 0,
1529 V4L2_CODEC_MFC5X_ENC_MULTI_SLICE_MODE_MACROBLOCK_COUNT = 1,
1530 V4L2_CODEC_MFC5X_ENC_MULTI_SLICE_MODE_BIT_COUNT = 3,
1531};
1532#define V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_MB (V4L2_CID_CODEC_MFC5X_BASE+302)
1533#define V4L2_CID_CODEC_MFC5X_ENC_MULTI_SLICE_BIT (V4L2_CID_CODEC_MFC5X_BASE+303)
1534#define V4L2_CID_CODEC_MFC5X_ENC_INTRA_REFRESH_MB (V4L2_CID_CODEC_MFC5X_BASE+304)
1535#define V4L2_CID_CODEC_MFC5X_ENC_PAD_CTRL_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+305)
1536#define V4L2_CID_CODEC_MFC5X_ENC_PAD_LUMA_VALUE (V4L2_CID_CODEC_MFC5X_BASE+306)
1537#define V4L2_CID_CODEC_MFC5X_ENC_PAD_CB_VALUE (V4L2_CID_CODEC_MFC5X_BASE+307)
1538#define V4L2_CID_CODEC_MFC5X_ENC_PAD_CR_VALUE (V4L2_CID_CODEC_MFC5X_BASE+308)
1539#define V4L2_CID_CODEC_MFC5X_ENC_RC_FRAME_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+309)
1540#define V4L2_CID_CODEC_MFC5X_ENC_RC_BIT_RATE (V4L2_CID_CODEC_MFC5X_BASE+310)
1541#define V4L2_CID_CODEC_MFC5X_ENC_RC_REACTION_COEFF (V4L2_CID_CODEC_MFC5X_BASE+311)
1542#define V4L2_CID_CODEC_MFC5X_ENC_STREAM_SIZE (V4L2_CID_CODEC_MFC5X_BASE+312)
1543#define V4L2_CID_CODEC_MFC5X_ENC_FRAME_COUNT (V4L2_CID_CODEC_MFC5X_BASE+313)
1544#define V4L2_CID_CODEC_MFC5X_ENC_FRAME_TYPE (V4L2_CID_CODEC_MFC5X_BASE+314)
1545enum v4l2_codec_mfc5x_enc_frame_type {
1546 V4L2_CODEC_MFC5X_ENC_FRAME_TYPE_NOT_CODED = 0,
1547 V4L2_CODEC_MFC5X_ENC_FRAME_TYPE_I_FRAME = 1,
1548 V4L2_CODEC_MFC5X_ENC_FRAME_TYPE_P_FRAME = 2,
1549 V4L2_CODEC_MFC5X_ENC_FRAME_TYPE_B_FRAME = 3,
1550 V4L2_CODEC_MFC5X_ENC_FRAME_TYPE_SKIPPED = 4,
1551 V4L2_CODEC_MFC5X_ENC_FRAME_TYPE_OTHERS = 5,
1552};
1553#define V4L2_CID_CODEC_MFC5X_ENC_FORCE_FRAME_TYPE (V4L2_CID_CODEC_MFC5X_BASE+315)
1554enum v4l2_codec_mfc5x_enc_force_frame_type {
1555 V4L2_CODEC_MFC5X_ENC_FORCE_FRAME_TYPE_I_FRAME = 1,
1556 V4L2_CODEC_MFC5X_ENC_FORCE_FRAME_TYPE_NOT_CODED = 2,
1557};
1558#define V4L2_CID_CODEC_MFC5X_ENC_VBV_BUF_SIZE (V4L2_CID_CODEC_MFC5X_BASE+316)
1559#define V4L2_CID_CODEC_MFC5X_ENC_SEQ_HDR_MODE (V4L2_CID_CODEC_MFC5X_BASE+317)
1560enum v4l2_codec_mfc5x_enc_seq_hdr_mode {
1561 V4L2_CODEC_MFC5X_ENC_SEQ_HDR_MODE_SEQ = 0,
1562 V4L2_CODEC_MFC5X_ENC_SEQ_HDR_MODE_SEQ_FRAME = 1,
1563};
1564#define V4L2_CID_CODEC_MFC5X_ENC_FRAME_SKIP_MODE (V4L2_CID_CODEC_MFC5X_BASE+318)
1565enum v4l2_codec_mfc5x_enc_frame_skip_mode {
1566 V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_DISABLE = 0,
1567 V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_LEVEL = 1,
1568 V4L2_CODEC_MFC5X_ENC_FRAME_SKIP_MODE_VBV_BUF_SIZE = 2,
1569};
1570#define V4L2_CID_CODEC_MFC5X_ENC_RC_FIXED_TARGET_BIT (V4L2_CID_CODEC_MFC5X_BASE+319)
1571#define V4L2_CID_CODEC_MFC5X_ENC_FRAME_DELTA (V4L2_CID_CODEC_MFC5X_BASE+320)
1572
1573/* codec specific */
1574#define V4L2_CID_CODEC_MFC5X_ENC_H264_B_FRAMES (V4L2_CID_CODEC_MFC5X_BASE+400)
1575#define V4L2_CID_CODEC_MFC5X_ENC_H264_PROFILE (V4L2_CID_CODEC_MFC5X_BASE+401)
1576enum v4l2_codec_mfc5x_enc_h264_profile {
1577 V4L2_CODEC_MFC5X_ENC_H264_PROFILE_MAIN = 0,
1578 V4L2_CODEC_MFC5X_ENC_H264_PROFILE_HIGH = 1,
1579 V4L2_CODEC_MFC5X_ENC_H264_PROFILE_BASELINE = 2,
1580};
1581#define V4L2_CID_CODEC_MFC5X_ENC_H264_LEVEL (V4L2_CID_CODEC_MFC5X_BASE+402)
1582#define V4L2_CID_CODEC_MFC5X_ENC_H264_INTERLACE (V4L2_CID_CODEC_MFC5X_BASE+403)
1583#define V4L2_CID_CODEC_MFC5X_ENC_H264_LOOP_FILTER_MODE (V4L2_CID_CODEC_MFC5X_BASE+404)
1584enum v4l2_codec_mfc5x_enc_h264_loop_filter {
1585 V4L2_CODEC_MFC5X_ENC_H264_LOOP_FILTER_ENABLE = 0,
1586 V4L2_CODEC_MFC5X_ENC_H264_LOOP_FILTER_DISABLE = 1,
1587 V4L2_CODEC_MFC5X_ENC_H264_LOOP_FILTER_DISABLE_AT_BOUNDARY = 2,
1588};
1589#define V4L2_CID_CODEC_MFC5X_ENC_H264_LOOP_FILTER_ALPHA (V4L2_CID_CODEC_MFC5X_BASE+405)
1590#define V4L2_CID_CODEC_MFC5X_ENC_H264_LOOP_FILTER_BETA (V4L2_CID_CODEC_MFC5X_BASE+406)
1591#define V4L2_CID_CODEC_MFC5X_ENC_H264_ENTROPY_MODE (V4L2_CID_CODEC_MFC5X_BASE+407)
1592enum v4l2_codec_mfc5x_enc_h264_entropy_mode {
1593 V4L2_CODEC_MFC5X_ENC_H264_ENTROPY_MODE_CAVLC = 0,
1594 V4L2_CODEC_MFC5X_ENC_H264_ENTROPY_MODE_CABAC = 1,
1595};
1596#define V4L2_CID_CODEC_MFC5X_ENC_H264_MAX_REF_PIC (V4L2_CID_CODEC_MFC5X_BASE+408)
1597#define V4L2_CID_CODEC_MFC5X_ENC_H264_NUM_REF_PIC_4P (V4L2_CID_CODEC_MFC5X_BASE+409)
1598#define V4L2_CID_CODEC_MFC5X_ENC_H264_8X8_TRANSFORM (V4L2_CID_CODEC_MFC5X_BASE+410)
1599#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+411)
1600#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_FRAME_RATE (V4L2_CID_CODEC_MFC5X_BASE+412)
1601#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_FRAME_QP (V4L2_CID_CODEC_MFC5X_BASE+413)
1602#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MIN_QP (V4L2_CID_CODEC_MFC5X_BASE+414)
1603#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MAX_QP (V4L2_CID_CODEC_MFC5X_BASE+415)
1604#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_DARK (V4L2_CID_CODEC_MFC5X_BASE+416)
1605#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_SMOOTH (V4L2_CID_CODEC_MFC5X_BASE+417)
1606#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_STATIC (V4L2_CID_CODEC_MFC5X_BASE+418)
1607#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_MB_ACTIVITY (V4L2_CID_CODEC_MFC5X_BASE+419)
1608#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_P_FRAME_QP (V4L2_CID_CODEC_MFC5X_BASE+420)
1609#define V4L2_CID_CODEC_MFC5X_ENC_H264_RC_B_FRAME_QP (V4L2_CID_CODEC_MFC5X_BASE+421)
1610#define V4L2_CID_CODEC_MFC5X_ENC_H264_AR_VUI_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+422)
1611#define V4L2_CID_CODEC_MFC5X_ENC_H264_AR_VUI_IDC (V4L2_CID_CODEC_MFC5X_BASE+423)
1612#define V4L2_CID_CODEC_MFC5X_ENC_H264_EXT_SAR_WIDTH (V4L2_CID_CODEC_MFC5X_BASE+424)
1613#define V4L2_CID_CODEC_MFC5X_ENC_H264_EXT_SAR_HEIGHT (V4L2_CID_CODEC_MFC5X_BASE+425)
1614#define V4L2_CID_CODEC_MFC5X_ENC_H264_OPEN_GOP (V4L2_CID_CODEC_MFC5X_BASE+426)
1615#define V4L2_CID_CODEC_MFC5X_ENC_H264_I_PERIOD (V4L2_CID_CODEC_MFC5X_BASE+427)
1616#define V4L2_CID_CODEC_MFC5X_ENC_H264_HIER_P_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+428)
1617#define V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER0_QP (V4L2_CID_CODEC_MFC5X_BASE+429)
1618#define V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER1_QP (V4L2_CID_CODEC_MFC5X_BASE+430)
1619#define V4L2_CID_CODEC_MFC5X_ENC_H264_LAYER2_QP (V4L2_CID_CODEC_MFC5X_BASE+431)
1620#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+432)
1621#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+433)
1622
1623#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_B_FRAMES (V4L2_CID_CODEC_MFC5X_BASE+440)
1624#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_PROFILE (V4L2_CID_CODEC_MFC5X_BASE+441)
1625enum v4l2_codec_mfc5x_enc_mpeg4_profile {
1626 V4L2_CODEC_MFC5X_ENC_MPEG4_PROFILE_SIMPLE = 0,
1627 V4L2_CODEC_MFC5X_ENC_MPEG4_PROFILE_ADVANCED_SIMPLE = 1,
1628};
1629#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_LEVEL (V4L2_CID_CODEC_MFC5X_BASE+442)
1630#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_FRAME_QP (V4L2_CID_CODEC_MFC5X_BASE+443)
1631#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_MIN_QP (V4L2_CID_CODEC_MFC5X_BASE+444)
1632#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_MAX_QP (V4L2_CID_CODEC_MFC5X_BASE+445)
1633#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_QUARTER_PIXEL (V4L2_CID_CODEC_MFC5X_BASE+446)
1634#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_P_FRAME_QP (V4L2_CID_CODEC_MFC5X_BASE+447)
1635#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_B_FRAME_QP (V4L2_CID_CODEC_MFC5X_BASE+448)
1636#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_VOP_TIME_RES (V4L2_CID_CODEC_MFC5X_BASE+449)
1637#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_VOP_FRM_DELTA (V4L2_CID_CODEC_MFC5X_BASE+450)
1638#define V4L2_CID_CODEC_MFC5X_ENC_MPEG4_RC_MB_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+451)
1639
1640#define V4L2_CID_CODEC_MFC5X_ENC_H263_RC_FRAME_RATE (V4L2_CID_CODEC_MFC5X_BASE+460)
1641#define V4L2_CID_CODEC_MFC5X_ENC_H263_RC_FRAME_QP (V4L2_CID_CODEC_MFC5X_BASE+461)
1642#define V4L2_CID_CODEC_MFC5X_ENC_H263_RC_MIN_QP (V4L2_CID_CODEC_MFC5X_BASE+462)
1643#define V4L2_CID_CODEC_MFC5X_ENC_H263_RC_MAX_QP (V4L2_CID_CODEC_MFC5X_BASE+463)
1644#define V4L2_CID_CODEC_MFC5X_ENC_H263_RC_P_FRAME_QP (V4L2_CID_CODEC_MFC5X_BASE+464)
1645#define V4L2_CID_CODEC_MFC5X_ENC_H263_RC_MB_ENABLE (V4L2_CID_CODEC_MFC5X_BASE+465)
1646
1647/* FMO/ASO parameters */
1648#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_MAP_TYPE (V4L2_CID_CODEC_MFC5X_BASE+480)
1649#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SLICE_NUM (V4L2_CID_CODEC_MFC5X_BASE+481)
1650#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN1 (V4L2_CID_CODEC_MFC5X_BASE+482)
1651#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN2 (V4L2_CID_CODEC_MFC5X_BASE+483)
1652#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN3 (V4L2_CID_CODEC_MFC5X_BASE+484)
1653#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_RUN_LEN4 (V4L2_CID_CODEC_MFC5X_BASE+485)
1654#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SG_DIR (V4L2_CID_CODEC_MFC5X_BASE+486)
1655#define V4L2_CID_CODEC_MFC5X_ENC_H264_FMO_SG_RATE (V4L2_CID_CODEC_MFC5X_BASE+487)
1656#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_0 (V4L2_CID_CODEC_MFC5X_BASE+488)
1657#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_1 (V4L2_CID_CODEC_MFC5X_BASE+489)
1658#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_2 (V4L2_CID_CODEC_MFC5X_BASE+490)
1659#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_3 (V4L2_CID_CODEC_MFC5X_BASE+491)
1660#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_4 (V4L2_CID_CODEC_MFC5X_BASE+492)
1661#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_5 (V4L2_CID_CODEC_MFC5X_BASE+493)
1662#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_6 (V4L2_CID_CODEC_MFC5X_BASE+494)
1663#define V4L2_CID_CODEC_MFC5X_ENC_H264_ASO_SL_ORDER_7 (V4L2_CID_CODEC_MFC5X_BASE+495)
1664
1665
1363/* Camera class control IDs */ 1666/* Camera class control IDs */
1364#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900) 1667#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900)
1365#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1) 1668#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1)
diff --git a/include/linux/videodev2_exynos_camera.h b/include/linux/videodev2_exynos_camera.h
new file mode 100644
index 00000000000..0c51beff764
--- /dev/null
+++ b/include/linux/videodev2_exynos_camera.h
@@ -0,0 +1,1368 @@
1/*
2 * Video for Linux Two header file for samsung
3 *
4 * Copyright (C) 2009, Dongsoo Nathaniel Kim<dongsoo45.kim@samsung.com>
5 *
6 * This header file contains several v4l2 APIs to be proposed to v4l2
7 * community and until bein accepted, will be used restrictly in Samsung's
8 * camera interface driver FIMC.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef __LINUX_VIDEODEV2_SAMSUNG_H
17#define __LINUX_VIDEODEV2_SAMSUNG_H
18
19/* Values for 'capabilities' field */
20/* Object detection device */
21#define V4L2_CAP_OBJ_RECOGNITION 0x10000000
22/* strobe control */
23#define V4L2_CAP_STROBE 0x20000000
24
25#define V4L2_CID_FOCUS_MODE (V4L2_CID_CAMERA_CLASS_BASE+17)
26/* Focus Methods */
27enum v4l2_focus_mode {
28 V4L2_FOCUS_MODE_AUTO = 0,
29 V4L2_FOCUS_MODE_MACRO = 1,
30 V4L2_FOCUS_MODE_MANUAL = 2,
31 V4L2_FOCUS_MODE_LASTP = 2,
32};
33
34#define V4L2_CID_ZOOM_MODE (V4L2_CID_CAMERA_CLASS_BASE+18)
35/* Zoom Methods */
36enum v4l2_zoom_mode {
37 V4L2_ZOOM_MODE_CONTINUOUS = 0,
38 V4L2_ZOOM_MODE_OPTICAL = 1,
39 V4L2_ZOOM_MODE_DIGITAL = 2,
40 V4L2_ZOOM_MODE_LASTP = 2,
41};
42
43/* Exposure Methods */
44#define V4L2_CID_PHOTOMETRY (V4L2_CID_CAMERA_CLASS_BASE+19)
45enum v4l2_photometry_mode {
46 V4L2_PHOTOMETRY_MULTISEG = 0, /*Multi Segment*/
47 V4L2_PHOTOMETRY_CWA = 1, /*Centre Weighted Average*/
48 V4L2_PHOTOMETRY_SPOT = 2,
49 V4L2_PHOTOMETRY_AFSPOT = 3, /*Spot metering on focused point*/
50 V4L2_PHOTOMETRY_LASTP = V4L2_PHOTOMETRY_AFSPOT,
51};
52
53/* Manual exposure control items menu type: iris, shutter, iso */
54#define V4L2_CID_CAM_APERTURE (V4L2_CID_CAMERA_CLASS_BASE+20)
55enum v4l2_aperture_mode {
56 APERTURE_F_AUTO = 0,
57 APERTURE_F_2_8,
58 APERTURE_F_3_2,
59 APERTURE_F_3_6,
60 APERTURE_F_4_0,
61 APERTURE_F_4_5,
62 APERTURE_F_5_1,
63 APERTURE_F_5_7,
64 APERTURE_F_6_4,
65 APERTURE_F_7_2,
66 APERTURE_MAX,
67};
68#define V4L2_CID_CAM_SHUTTER (V4L2_CID_CAMERA_CLASS_BASE+21)
69#define V4L2_CID_CAM_ISO (V4L2_CID_CAMERA_CLASS_BASE+22)
70
71/* Following CIDs are menu type */
72#define V4L2_CID_SCENEMODE (V4L2_CID_CAMERA_CLASS_BASE+23)
73#define V4L2_CID_CAM_STABILIZE (V4L2_CID_CAMERA_CLASS_BASE+24)
74#define V4L2_CID_CAM_MULTISHOT (V4L2_CID_CAMERA_CLASS_BASE+25)
75
76/* Control dynamic range */
77#define V4L2_CID_CAM_DR (V4L2_CID_CAMERA_CLASS_BASE+26)
78
79/* White balance preset control */
80#define V4L2_CID_WHITE_BALANCE_PRESET (V4L2_CID_CAMERA_CLASS_BASE+27)
81#define V4L2_CID_CAM_SENSOR_FW_VER (V4L2_CID_CAMERA_CLASS_BASE + 28)
82#define V4L2_CID_CAM_PHONE_FW_VER (V4L2_CID_CAMERA_CLASS_BASE + 29)
83
84/* CID extensions */
85#define V4L2_CID_ROTATION (V4L2_CID_PRIVATE_BASE + 0)
86#define V4L2_CID_PADDR_Y (V4L2_CID_PRIVATE_BASE + 1)
87#define V4L2_CID_PADDR_CB (V4L2_CID_PRIVATE_BASE + 2)
88#define V4L2_CID_PADDR_CR (V4L2_CID_PRIVATE_BASE + 3)
89#define V4L2_CID_PADDR_CBCR (V4L2_CID_PRIVATE_BASE + 4)
90#define V4L2_CID_OVERLAY_AUTO (V4L2_CID_PRIVATE_BASE + 5)
91#define V4L2_CID_OVERLAY_VADDR0 (V4L2_CID_PRIVATE_BASE + 6)
92#define V4L2_CID_OVERLAY_VADDR1 (V4L2_CID_PRIVATE_BASE + 7)
93#define V4L2_CID_OVERLAY_VADDR2 (V4L2_CID_PRIVATE_BASE + 8)
94#define V4L2_CID_OVLY_MODE (V4L2_CID_PRIVATE_BASE + 9)
95#define V4L2_CID_DST_INFO (V4L2_CID_PRIVATE_BASE + 10)
96/* UMP secure id control */
97#define V4L2_CID_GET_UMP_SECURE_ID (V4L2_CID_PRIVATE_BASE + 11)
98#define V4L2_CID_GET_PHY_SRC_YADDR (V4L2_CID_PRIVATE_BASE + 12)
99#define V4L2_CID_GET_PHY_SRC_CADDR (V4L2_CID_PRIVATE_BASE + 13)
100#define V4L2_CID_IMAGE_EFFECT_FN (V4L2_CID_PRIVATE_BASE + 16)
101#define V4L2_CID_IMAGE_EFFECT_APPLY (V4L2_CID_PRIVATE_BASE + 17)
102#define V4L2_CID_IMAGE_EFFECT_CB (V4L2_CID_PRIVATE_BASE + 18)
103#define V4L2_CID_IMAGE_EFFECT_CR (V4L2_CID_PRIVATE_BASE + 19)
104#define V4L2_CID_RESERVED_MEM_BASE_ADDR (V4L2_CID_PRIVATE_BASE + 20)
105#define V4L2_CID_FIMC_VERSION (V4L2_CID_PRIVATE_BASE + 21)
106
107#define V4L2_CID_CACHE_FLUSH (V4L2_CID_PRIVATE_BASE + 61)
108#define V4L2_CID_RESERVED_MEM_SIZE (V4L2_CID_PRIVATE_BASE + 63)
109#define V4L2_CID_STREAM_PAUSE (V4L2_CID_PRIVATE_BASE + 53)
110#define V4L2_CID_CACHE_FLUSH (V4L2_CID_PRIVATE_BASE + 61)
111#define V4L2_CID_RESERVED_MEM_SIZE (V4L2_CID_PRIVATE_BASE + 63)
112
113/* CID Extensions for camera sensor operations */
114#define V4L2_CID_CAM_PREVIEW_ONOFF (V4L2_CID_PRIVATE_BASE + 64)
115#define V4L2_CID_CAM_CAPTURE (V4L2_CID_PRIVATE_BASE + 65)
116/* #define V4L2_CID_CAM_JPEG_MEMSIZE (V4L2_CID_PRIVATE_BASE + 66) */
117
118#define V4L2_CID_CAM_DATE_INFO_YEAR (V4L2_CID_PRIVATE_BASE + 14)
119#define V4L2_CID_CAM_DATE_INFO_MONTH (V4L2_CID_PRIVATE_BASE + 15)
120#define V4L2_CID_CAM_DATE_INFO_DATE (V4L2_CID_PRIVATE_BASE + 22)
121#define V4L2_CID_CAM_SENSOR_VER (V4L2_CID_PRIVATE_BASE + 23)
122#define V4L2_CID_CAM_FW_MINOR_VER (V4L2_CID_PRIVATE_BASE + 24)
123#define V4L2_CID_CAM_FW_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 25)
124#define V4L2_CID_CAM_PRM_MINOR_VER (V4L2_CID_PRIVATE_BASE + 26)
125#define V4L2_CID_CAM_PRM_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 27)
126#define V4L2_CID_CAM_FW_VER (V4L2_CID_PRIVATE_BASE + 28)
127#define V4L2_CID_CAM_SET_FW_ADDR (V4L2_CID_PRIVATE_BASE + 29)
128#define V4L2_CID_CAM_SET_FW_SIZE (V4L2_CID_PRIVATE_BASE + 30)
129#define V4L2_CID_CAM_UPDATE_FW (V4L2_CID_PRIVATE_BASE + 31)
130enum v4l2_firmware_mode {
131 FW_MODE_NONE,
132 FW_MODE_VERSION,
133 FW_MODE_UPDATE,
134 FW_MODE_DUMP,
135};
136
137#define V4L2_CID_CAM_JPEG_MAIN_SIZE (V4L2_CID_PRIVATE_BASE + 32)
138#define V4L2_CID_CAM_JPEG_MAIN_OFFSET (V4L2_CID_PRIVATE_BASE + 33)
139#define V4L2_CID_CAM_JPEG_THUMB_SIZE (V4L2_CID_PRIVATE_BASE + 34)
140#define V4L2_CID_CAM_JPEG_THUMB_OFFSET (V4L2_CID_PRIVATE_BASE + 35)
141#define V4L2_CID_CAM_JPEG_POSTVIEW_OFFSET (V4L2_CID_PRIVATE_BASE + 36)
142#define V4L2_CID_CAM_JPEG_QUALITY (V4L2_CID_PRIVATE_BASE + 37)
143#define V4L2_CID_CAM_SENSOR_MAKER (V4L2_CID_PRIVATE_BASE + 38)
144#define V4L2_CID_CAM_SENSOR_OPTICAL (V4L2_CID_PRIVATE_BASE + 39)
145#define V4L2_CID_CAM_AF_VER_LOW (V4L2_CID_PRIVATE_BASE + 40)
146#define V4L2_CID_CAM_AF_VER_HIGH (V4L2_CID_PRIVATE_BASE + 41)
147#define V4L2_CID_CAM_GAMMA_RG_LOW (V4L2_CID_PRIVATE_BASE + 42)
148#define V4L2_CID_CAM_GAMMA_RG_HIGH (V4L2_CID_PRIVATE_BASE + 43)
149#define V4L2_CID_CAM_GAMMA_BG_LOW (V4L2_CID_PRIVATE_BASE + 44)
150#define V4L2_CID_CAM_GAMMA_BG_HIGH (V4L2_CID_PRIVATE_BASE + 45)
151#define V4L2_CID_CAM_DUMP_FW (V4L2_CID_PRIVATE_BASE + 46)
152#define V4L2_CID_CAM_GET_DUMP_SIZE (V4L2_CID_PRIVATE_BASE + 47)
153#define V4L2_CID_CAMERA_VT_MODE (V4L2_CID_PRIVATE_BASE + 48)
154enum cam_vt_mode {
155 CAM_VT_MODE_NONE ,
156 CAM_VT_MODE_3G ,
157 CAM_VT_MODE_VOIP ,
158};
159
160#define V4L2_CID_CAMERA_VGA_BLUR (V4L2_CID_PRIVATE_BASE + 49)
161#define V4L2_CID_CAMERA_CAPTURE (V4L2_CID_PRIVATE_BASE + 50)
162#define V4L2_CID_CAMERA_HDR (V4L2_CID_PRIVATE_BASE + 51)
163#define V4L2_CID_CAMERA_HYBRID (V4L2_CID_PRIVATE_BASE + 52)
164#define V4L2_CID_CAMERA_HYBRID_CAPTURE (V4L2_CID_PRIVATE_BASE + 62)
165#define V4L2_CID_CAMERA_POSTVIEW_CAPTURE (V4L2_CID_PRIVATE_BASE + 67)
166#define V4L2_CID_CAMERA_CAPTURE_MODE (V4L2_CID_PRIVATE_BASE + 68)
167#define V4L2_CID_CAMERA_YUV_CAPTURE (V4L2_CID_PRIVATE_BASE + 69)
168
169#define V4L2_CID_MAIN_SW_DATE_INFO_YEAR (V4L2_CID_PRIVATE_BASE + 54)
170#define V4L2_CID_MAIN_SW_DATE_INFO_MONTH (V4L2_CID_PRIVATE_BASE + 55)
171#define V4L2_CID_MAIN_SW_DATE_INFO_DATE (V4L2_CID_PRIVATE_BASE + 56)
172#define V4L2_CID_MAIN_SW_FW_MINOR_VER (V4L2_CID_PRIVATE_BASE + 57)
173#define V4L2_CID_MAIN_SW_FW_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 58)
174#define V4L2_CID_MAIN_SW_PRM_MINOR_VER (V4L2_CID_PRIVATE_BASE + 59)
175#define V4L2_CID_MAIN_SW_PRM_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 60)
176
177#define V4L2_CID_FIMC_IS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x1000)
178#define V4L2_CID_FIMC_IS_TUNE_BASE (V4L2_CTRL_CLASS_CAMERA | 0x2000)
179
180#define V4L2_CID_IS_LOAD_FW (V4L2_CID_FIMC_IS_BASE + 10)
181#define V4L2_CID_IS_INIT_PARAM (V4L2_CID_FIMC_IS_BASE + 11)
182#define V4L2_CID_IS_RESET (V4L2_CID_FIMC_IS_BASE + 12)
183#define V4L2_CID_IS_S_POWER (V4L2_CID_FIMC_IS_BASE + 13)
184enum is_set_power {
185 IS_POWER_OFF,
186 IS_POWER_ON
187};
188
189#define V4L2_CID_IS_S_STREAM (V4L2_CID_FIMC_IS_BASE + 14)
190enum is_set_stream {
191 IS_DISABLE_STREAM,
192 IS_ENABLE_STREAM
193};
194
195#define V4L2_CID_IS_S_SCENARIO_MODE (V4L2_CID_FIMC_IS_BASE + 15)
196#define V4L2_CID_IS_S_FORMAT_SCENARIO (V4L2_CID_FIMC_IS_BASE + 16)
197enum scenario_mode {
198 IS_MODE_PREVIEW_STILL,
199 IS_MODE_PREVIEW_VIDEO,
200 IS_MODE_CAPTURE_STILL,
201 IS_MODE_CAPTURE_VIDEO,
202 IS_MODE_MAX
203};
204
205/* global */
206#define V4L2_CID_IS_CAMERA_SHOT_MODE_NORMAL (V4L2_CID_FIMC_IS_BASE + 101)
207/* value : 1 : single shot , >=2 : continuous shot */
208
209#define V4L2_CID_IS_CAMERA_SENSOR_NUM (V4L2_CID_FIMC_IS_BASE + 201)
210
211#define V4L2_CID_IS_CAMERA_FOCUS_MODE (V4L2_CID_FIMC_IS_BASE + 401)
212enum is_focus_mode {
213 IS_FOCUS_MODE_AUTO,
214 IS_FOCUS_MODE_MACRO,
215 IS_FOCUS_MODE_INFINITY,
216 IS_FOCUS_MODE_CONTINUOUS,
217 IS_FOCUS_MODE_TOUCH,
218 IS_FOCUS_MODE_FACEDETECT,
219 IS_FOCUS_MODE_IDLE,
220 IS_FOCUS_MODE_MAX,
221};
222
223#define V4L2_CID_IS_CAMERA_FLASH_MODE (V4L2_CID_FIMC_IS_BASE + 402)
224enum is_flash_mode {
225 IS_FLASH_MODE_OFF,
226 IS_FLASH_MODE_AUTO,
227 IS_FLASH_MODE_AUTO_REDEYE,
228 IS_FLASH_MODE_ON,
229 IS_FLASH_MODE_TORCH,
230 IS_FLASH_MODE_MAX
231};
232
233#define V4L2_CID_IS_CAMERA_AWB_MODE (V4L2_CID_FIMC_IS_BASE + 403)
234enum is_awb_mode {
235 IS_AWB_AUTO,
236 IS_AWB_DAYLIGHT,
237 IS_AWB_CLOUDY,
238 IS_AWB_TUNGSTEN,
239 IS_AWB_FLUORESCENT,
240 IS_AWB_MAX
241};
242
243#define V4L2_CID_IS_CAMERA_IMAGE_EFFECT (V4L2_CID_FIMC_IS_BASE + 404)
244enum is_image_effect {
245 IS_IMAGE_EFFECT_DISABLE,
246 IS_IMAGE_EFFECT_MONOCHROME,
247 IS_IMAGE_EFFECT_NEGATIVE_MONO,
248 IS_IMAGE_EFFECT_NEGATIVE_COLOR,
249 IS_IMAGE_EFFECT_SEPIA,
250 IS_IMAGE_EFFECT_SEPIA_CB,
251 IS_IMAGE_EFFECT_SEPIA_CR,
252 IS_IMAGE_EFFECT_NEGATIVE,
253 IS_IMAGE_EFFECT_ARTFREEZE,
254 IS_IMAGE_EFFECT_EMBOSSING,
255 IS_IMAGE_EFFECT_SILHOUETTE,
256 IS_IMAGE_EFFECT_MAX
257};
258
259#define V4L2_CID_IS_CAMERA_ISO (V4L2_CID_FIMC_IS_BASE + 405)
260enum is_iso {
261 IS_ISO_AUTO,
262 IS_ISO_50,
263 IS_ISO_100,
264 IS_ISO_200,
265 IS_ISO_400,
266 IS_ISO_800,
267 IS_ISO_1600,
268 IS_ISO_MAX
269};
270
271#define V4L2_CID_IS_CAMERA_CONTRAST (V4L2_CID_FIMC_IS_BASE + 406)
272enum is_contrast {
273 IS_CONTRAST_AUTO,
274 IS_CONTRAST_MINUS_2,
275 IS_CONTRAST_MINUS_1,
276 IS_CONTRAST_DEFAULT,
277 IS_CONTRAST_PLUS_1,
278 IS_CONTRAST_PLUS_2,
279 IS_CONTRAST_MAX
280};
281
282#define V4L2_CID_IS_CAMERA_SATURATION (V4L2_CID_FIMC_IS_BASE + 407)
283enum is_saturation {
284 IS_SATURATION_MINUS_2,
285 IS_SATURATION_MINUS_1,
286 IS_SATURATION_DEFAULT,
287 IS_SATURATION_PLUS_1,
288 IS_SATURATION_PLUS_2,
289 IS_SATURATION_MAX
290};
291
292#define V4L2_CID_IS_CAMERA_SHARPNESS (V4L2_CID_FIMC_IS_BASE + 408)
293enum is_sharpness {
294 IS_SHARPNESS_MINUS_2,
295 IS_SHARPNESS_MINUS_1,
296 IS_SHARPNESS_DEFAULT,
297 IS_SHARPNESS_PLUS_1,
298 IS_SHARPNESS_PLUS_2,
299 IS_SHARPNESS_MAX
300};
301
302#define V4L2_CID_IS_CAMERA_EXPOSURE (V4L2_CID_FIMC_IS_BASE + 409)
303enum is_exposure {
304 IS_EXPOSURE_MINUS_4,
305 IS_EXPOSURE_MINUS_3,
306 IS_EXPOSURE_MINUS_2,
307 IS_EXPOSURE_MINUS_1,
308 IS_EXPOSURE_DEFAULT,
309 IS_EXPOSURE_PLUS_1,
310 IS_EXPOSURE_PLUS_2,
311 IS_EXPOSURE_PLUS_3,
312 IS_EXPOSURE_PLUS_4,
313 IS_EXPOSURE_MAX
314};
315
316#define V4L2_CID_IS_CAMERA_BRIGHTNESS (V4L2_CID_FIMC_IS_BASE + 410)
317enum is_brightness {
318 IS_BRIGHTNESS_MINUS_2,
319 IS_BRIGHTNESS_MINUS_1,
320 IS_BRIGHTNESS_DEFAULT,
321 IS_BRIGHTNESS_PLUS_1,
322 IS_BRIGHTNESS_PLUS_2,
323 IS_BRIGHTNESS_MAX
324};
325
326#define V4L2_CID_IS_CAMERA_HUE (V4L2_CID_FIMC_IS_BASE + 411)
327enum is_hue {
328 IS_HUE_MINUS_2,
329 IS_HUE_MINUS_1,
330 IS_HUE_DEFAULT,
331 IS_HUE_PLUS_1,
332 IS_HUE_PLUS_2,
333 IS_HUE_MAX
334};
335
336#define V4L2_CID_IS_CAMERA_METERING (V4L2_CID_FIMC_IS_BASE + 412)
337enum is_metering {
338 IS_METERING_AVERAGE,
339 IS_METERING_SPOT,
340 IS_METERING_MATRIX,
341 IS_METERING_CENTER,
342 IS_METERING_MAX
343};
344#define V4L2_CID_IS_CAMERA_METERING_POSITION_X (V4L2_CID_FIMC_IS_BASE + 500)
345#define V4L2_CID_IS_CAMERA_METERING_POSITION_Y (V4L2_CID_FIMC_IS_BASE + 501)
346#define V4L2_CID_IS_CAMERA_METERING_WINDOW_X (V4L2_CID_FIMC_IS_BASE + 502)
347#define V4L2_CID_IS_CAMERA_METERING_WINDOW_Y (V4L2_CID_FIMC_IS_BASE + 503)
348
349#define V4L2_CID_IS_CAMERA_AFC_MODE (V4L2_CID_FIMC_IS_BASE + 413)
350enum is_afc_mode {
351 IS_AFC_DISABLE,
352 IS_AFC_AUTO,
353 IS_AFC_MANUAL_50HZ,
354 IS_AFC_MANUAL_60HZ,
355 IS_AFC_MAX
356};
357
358#define V4L2_CID_IS_AWB_LOCK_UNLOCK (V4L2_CID_FIMC_IS_BASE + 496)
359enum is_awb_lock_unlock {
360 IS_AWB_LOCK,
361 IS_AWB_UNLOCK,
362 IS_AWB_LOCK_UNLOCK_MAX
363};
364
365#define V4L2_CID_IS_AE_LOCK_UNLOCK (V4L2_CID_FIMC_IS_BASE + 497)
366enum is_ae_lock_unlock {
367 IS_AE_LOCK,
368 IS_AE_UNLOCK,
369 IS_AE_LOCK_UNLOCK_MAX
370};
371
372#define V4L2_CID_IS_FD_GET_FACE_COUNT (V4L2_CID_FIMC_IS_BASE + 600)
373#define V4L2_CID_IS_FD_GET_FACE_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 601)
374#define V4L2_CID_IS_FD_GET_FACE_CONFIDENCE (V4L2_CID_FIMC_IS_BASE + 602)
375#define V4L2_CID_IS_FD_GET_FACE_SMILE_LEVEL (V4L2_CID_FIMC_IS_BASE + 603)
376#define V4L2_CID_IS_FD_GET_FACE_BLINK_LEVEL (V4L2_CID_FIMC_IS_BASE + 604)
377#define V4L2_CID_IS_FD_GET_FACE_TOPLEFT_X (V4L2_CID_FIMC_IS_BASE + 605)
378#define V4L2_CID_IS_FD_GET_FACE_TOPLEFT_Y (V4L2_CID_FIMC_IS_BASE + 606)
379#define V4L2_CID_IS_FD_GET_FACE_BOTTOMRIGHT_X (V4L2_CID_FIMC_IS_BASE + 607)
380#define V4L2_CID_IS_FD_GET_FACE_BOTTOMRIGHT_Y (V4L2_CID_FIMC_IS_BASE + 608)
381#define V4L2_CID_IS_FD_GET_LEFT_EYE_TOPLEFT_X (V4L2_CID_FIMC_IS_BASE + 609)
382#define V4L2_CID_IS_FD_GET_LEFT_EYE_TOPLEFT_Y (V4L2_CID_FIMC_IS_BASE + 610)
383#define V4L2_CID_IS_FD_GET_LEFT_EYE_BOTTOMRIGHT_X (V4L2_CID_FIMC_IS_BASE + 611)
384#define V4L2_CID_IS_FD_GET_LEFT_EYE_BOTTOMRIGHT_Y (V4L2_CID_FIMC_IS_BASE + 612)
385#define V4L2_CID_IS_FD_GET_RIGHT_EYE_TOPLEFT_X (V4L2_CID_FIMC_IS_BASE + 613)
386#define V4L2_CID_IS_FD_GET_RIGHT_EYE_TOPLEFT_Y (V4L2_CID_FIMC_IS_BASE + 614)
387#define V4L2_CID_IS_FD_GET_RIGHT_EYE_BOTTOMRIGHT_X (V4L2_CID_FIMC_IS_BASE + 615)
388#define V4L2_CID_IS_FD_GET_RIGHT_EYE_BOTTOMRIGHT_Y (V4L2_CID_FIMC_IS_BASE + 616)
389#define V4L2_CID_IS_FD_GET_MOUTH_TOPLEFT_X (V4L2_CID_FIMC_IS_BASE + 617)
390#define V4L2_CID_IS_FD_GET_MOUTH_TOPLEFT_Y (V4L2_CID_FIMC_IS_BASE + 618)
391#define V4L2_CID_IS_FD_GET_MOUTH_BOTTOMRIGHT_X (V4L2_CID_FIMC_IS_BASE + 619)
392#define V4L2_CID_IS_FD_GET_MOUTH_BOTTOMRIGHT_Y (V4L2_CID_FIMC_IS_BASE + 620)
393#define V4L2_CID_IS_FD_GET_ANGLE (V4L2_CID_FIMC_IS_BASE + 621)
394#define V4L2_CID_IS_FD_GET_YAW_ANGLE (V4L2_CID_FIMC_IS_BASE + 622)
395#define V4L2_CID_IS_FD_GET_NEXT (V4L2_CID_FIMC_IS_BASE + 623)
396#define V4L2_CID_IS_FD_GET_DATA (V4L2_CID_FIMC_IS_BASE + 624)
397
398#define V4L2_CID_IS_FD_SET_MAX_FACE_NUMBER (V4L2_CID_FIMC_IS_BASE + 650)
399#define V4L2_CID_IS_FD_SET_ROLL_ANGLE (V4L2_CID_FIMC_IS_BASE + 651)
400
401enum is_fd_roll_angle {
402 /* 0, 45, 0, -45 */
403 IS_FD_ROLL_ANGLE_BASIC = 0,
404 /* 0, 30, 0, -30, 0, 45, 0, -45 */
405 IS_FD_ROLL_ANGLE_PRECISE_BASIC = 1,
406 /* 0, 90, 0, -90 */
407 IS_FD_ROLL_ANGLE_SIDES = 2,
408 /* 0, 90, 0, -90 0, 45, 0, -45 */
409 IS_FD_ROLL_ANGLE_PRECISE_SIDES = 3,
410 /* 0, 90, 0, -90, 0, 180 */
411 IS_FD_ROLL_ANGLE_FULL = 4,
412 /* 0, 90, 0, -90, 0, 180, 0, 135, 0, -135 */
413 IS_FD_ROLL_ANGLE_PRECISE_FULL = 5,
414};
415
416#define V4L2_CID_IS_FD_SET_YAW_ANGLE (V4L2_CID_FIMC_IS_BASE + 652)
417enum is_fd_yaw_angle {
418 IS_FD_YAW_ANGLE_0 = 0,
419 IS_FD_YAW_ANGLE_45 = 1,
420 IS_FD_YAW_ANGLE_90 = 2,
421 IS_FD_YAW_ANGLE_45_90 = 3,
422};
423
424#define V4L2_CID_IS_FD_SET_SMILE_MODE (V4L2_CID_FIMC_IS_BASE + 653)
425enum is_fd_smile_mode {
426 IS_FD_SMILE_MODE_DISABLE = 0,
427 IS_FD_SMILE_MODE_ENABLE = 1,
428};
429
430#define V4L2_CID_IS_FD_SET_BLINK_MODE (V4L2_CID_FIMC_IS_BASE + 654)
431enum is_fd_blink_mode {
432 IS_FD_BLINK_MODE_DISABLE = 0,
433 IS_FD_BLINK_MODE_ENABLE = 1,
434};
435
436#define V4L2_CID_IS_FD_SET_EYE_DETECT_MODE (V4L2_CID_FIMC_IS_BASE + 655)
437enum is_fd_eye_detect_mode {
438 IS_FD_EYE_DETECT_DISABLE = 0,
439 IS_FD_EYE_DETECT_ENABLE = 1,
440};
441
442#define V4L2_CID_IS_FD_SET_MOUTH_DETECT_MODE (V4L2_CID_FIMC_IS_BASE + 656)
443enum is_fd_mouth_detect_mode {
444 IS_FD_MOUTH_DETECT_DISABLE = 0,
445 IS_FD_MOUTH_DETECT_ENABLE = 1,
446};
447
448#define V4L2_CID_IS_FD_SET_ORIENTATION_MODE (V4L2_CID_FIMC_IS_BASE + 657)
449enum is_fd_orientation_mode {
450 IS_FD_ORIENTATION_DISABLE = 0,
451 IS_FD_ORIENTATION_ENABLE = 1,
452};
453
454#define V4L2_CID_IS_FD_SET_ORIENTATION (V4L2_CID_FIMC_IS_BASE + 658)
455#define V4L2_CID_IS_FD_SET_DATA_ADDRESS (V4L2_CID_FIMC_IS_BASE + 659)
456
457#define V4L2_CID_IS_SET_ISP (V4L2_CID_FIMC_IS_BASE + 440)
458enum is_isp_bypass_mode {
459 IS_ISP_BYPASS_DISABLE,
460 IS_ISP_BYPASS_ENABLE,
461 IS_ISP_BYPASS_MAX
462};
463
464#define V4L2_CID_IS_SET_DRC (V4L2_CID_FIMC_IS_BASE + 441)
465enum is_drc_bypass_mode {
466 IS_DRC_BYPASS_DISABLE,
467 IS_DRC_BYPASS_ENABLE,
468 IS_DRC_BYPASS_MAX
469};
470
471#define V4L2_CID_IS_SET_FD (V4L2_CID_FIMC_IS_BASE + 442)
472enum is_fd_bypass_mode {
473 IS_FD_BYPASS_DISABLE,
474 IS_FD_BYPASS_ENABLE,
475 IS_FD_BYPASS_MAX
476};
477
478#define V4L2_CID_IS_SET_ODC (V4L2_CID_FIMC_IS_BASE + 443)
479enum is_odc_bypass_mode {
480 IS_ODC_BYPASS_DISABLE,
481 IS_ODC_BYPASS_ENABLE,
482 IS_ODC_BYPASS_MAX
483};
484
485#define V4L2_CID_IS_SET_DIS (V4L2_CID_FIMC_IS_BASE + 444)
486enum is_dis_bypass_mode {
487 IS_DIS_BYPASS_DISABLE,
488 IS_DIS_BYPASS_ENABLE,
489 IS_DIS_BYPASS_MAX
490};
491
492#define V4L2_CID_IS_SET_3DNR (V4L2_CID_FIMC_IS_BASE + 445)
493enum is_tdnr_bypass_mode {
494 IS_TDNR_BYPASS_DISABLE,
495 IS_TDNR_BYPASS_ENABLE,
496 IS_TDNR_BYPASS_MAX
497};
498
499#define V4L2_CID_IS_SET_SCALERC (V4L2_CID_FIMC_IS_BASE + 446)
500enum is_scalerc_bypass_mode {
501 IS_SCALERC_BYPASS_DISABLE,
502 IS_SCALERC_BYPASS_ENABLE,
503 IS_SCALERC_BYPASS_MAX
504};
505
506#define V4L2_CID_IS_SET_SCALERP (V4L2_CID_FIMC_IS_BASE + 446)
507enum is_scalerp_bypass_mode {
508 IS_SCALERP_BYPASS_DISABLE,
509 IS_SCALERP_BYPASS_ENABLE,
510 IS_SCALERP_BYPASS_MAX
511};
512
513#define V4L2_CID_IS_ROTATION_MODE (V4L2_CID_FIMC_IS_BASE + 450)
514enum is_rotation_mode {
515 IS_ROTATION_0,
516 IS_ROTATION_90,
517 IS_ROTATION_180,
518 IS_ROTATION_270,
519 IS_ROTATION_MAX
520};
521
522#define V4L2_CID_IS_3DNR_1ST_FRAME_MODE (V4L2_CID_FIMC_IS_BASE + 451)
523enum is_tdnr_1st_frame_mode {
524 IS_TDNR_1ST_FRAME_NOPROCESSING,
525 IS_TDNR_1ST_FRAME_2DNR,
526 IS_TDNR_MAX
527};
528
529#define V4L2_CID_IS_CAMERA_OBJECT_POSITION_X (V4L2_CID_FIMC_IS_BASE + 452)
530#define V4L2_CID_IS_CAMERA_OBJECT_POSITION_Y (V4L2_CID_FIMC_IS_BASE + 453)
531#define V4L2_CID_IS_CAMERA_WINDOW_SIZE_X (V4L2_CID_FIMC_IS_BASE + 454)
532#define V4L2_CID_IS_CAMERA_WINDOW_SIZE_Y (V4L2_CID_FIMC_IS_BASE + 455)
533
534#define V4L2_CID_IS_CAMERA_EXIF_EXPTIME (V4L2_CID_FIMC_IS_BASE + 456)
535#define V4L2_CID_IS_CAMERA_EXIF_FLASH (V4L2_CID_FIMC_IS_BASE + 457)
536#define V4L2_CID_IS_CAMERA_EXIF_ISO (V4L2_CID_FIMC_IS_BASE + 458)
537#define V4L2_CID_IS_CAMERA_EXIF_SHUTTERSPEED (V4L2_CID_FIMC_IS_BASE + 459)
538#define V4L2_CID_IS_CAMERA_EXIF_BRIGHTNESS (V4L2_CID_FIMC_IS_BASE + 460)
539
540#define V4L2_CID_IS_CAMERA_ISP_SEL_INPUT (V4L2_CID_FIMC_IS_BASE + 461)
541enum is_isp_sel_input {
542 IS_ISP_INPUT_OTF,
543 IS_ISP_INPUT_DMA1,
544 IS_ISP_INPUT_DMA2,
545 IS_ISP_INPUT_DMA12,
546 IS_ISP_INPUT_MAX
547};
548
549#define V4L2_CID_IS_CAMERA_ISP_SEL_OUTPUT (V4L2_CID_FIMC_IS_BASE + 462)
550enum is_isp_sel_output {
551 IS_ISP_OUTPUT_OTF,
552 IS_ISP_OUTPUT_DMA1,
553 IS_ISP_OUTPUT_DMA2,
554 IS_ISP_OUTPUT_DMA12,
555 IS_ISP_OUTPUT_OTF_DMA1,
556 IS_ISP_OUTPUT_OTF_DMA2,
557 IS_ISP_OUTPUT_OTF_DMA12,
558 IS_ISP_OUTPUT_MAX
559};
560
561#define V4L2_CID_IS_CAMERA_DRC_SEL_INPUT (V4L2_CID_FIMC_IS_BASE + 463)
562enum is_drc_sel_input {
563 IS_DRC_INPUT_OTF,
564 IS_DRC_INPUT_DMA,
565 IS_DRC_INPUT_MAX
566};
567
568#define V4L2_CID_IS_CAMERA_FD_SEL_INPUT (V4L2_CID_FIMC_IS_BASE + 464)
569enum is_fd_sel_input {
570 IS_FD_INPUT_OTF,
571 IS_FD_INPUT_DMA,
572 IS_FD_INPUT_MAX
573};
574
575#define V4L2_CID_IS_CAMERA_INIT_WIDTH (V4L2_CID_FIMC_IS_BASE + 465)
576#define V4L2_CID_IS_CAMERA_INIT_HEIGHT (V4L2_CID_FIMC_IS_BASE + 466)
577
578#define V4L2_CID_IS_CMD_ISP (V4L2_CID_FIMC_IS_BASE + 467)
579enum is_isp_cmd_mode {
580 IS_ISP_COMMAND_STOP,
581 IS_ISP_COMMAND_START,
582 IS_ISP_COMMAND_MAX
583};
584
585#define V4L2_CID_IS_CMD_DRC (V4L2_CID_FIMC_IS_BASE + 468)
586enum is_drc_cmd_mode {
587 IS_DRC_COMMAND_STOP,
588 IS_DRC_COMMAND_START,
589 IS_DRC_COMMAND_MAX
590};
591
592#define V4L2_CID_IS_CMD_FD (V4L2_CID_FIMC_IS_BASE + 469)
593enum is_fd_cmd_mode {
594 IS_FD_COMMAND_STOP,
595 IS_FD_COMMAND_START,
596 IS_FD_COMMAND_MAX
597};
598
599#define V4L2_CID_IS_CMD_ODC (V4L2_CID_FIMC_IS_BASE + 470)
600enum is_odc_cmd_mode {
601 IS_ODC_COMMAND_STOP,
602 IS_ODC_COMMAND_START,
603 IS_ODC_COMMAND_MAX
604};
605
606#define V4L2_CID_IS_CMD_DIS (V4L2_CID_FIMC_IS_BASE + 471)
607enum is_dis_cmd_mode {
608 IS_DIS_COMMAND_STOP,
609 IS_DIS_COMMAND_START,
610 IS_DIS_COMMAND_MAX
611};
612
613#define V4L2_CID_IS_CMD_TDNR (V4L2_CID_FIMC_IS_BASE + 472)
614enum is_tdnr_cmd_mode {
615 IS_TDNR_COMMAND_STOP,
616 IS_TDNR_COMMAND_START,
617 IS_TDNR_COMMAND_MAX
618};
619
620#define V4L2_CID_IS_CMD_SCALERC (V4L2_CID_FIMC_IS_BASE + 473)
621enum is_scalerc_cmd_mode {
622 IS_SCALERC_COMMAND_STOP,
623 IS_SCALERC_COMMAND_START,
624 IS_SCALERC_COMMAND_MAX
625};
626
627#define V4L2_CID_IS_CMD_SCALERP (V4L2_CID_FIMC_IS_BASE + 474)
628enum is_scalerp_cmd_mode {
629 IS_SCALERP_COMMAND_STOP,
630 IS_SCALERP_COMMAND_START,
631 IS_SCALERP_COMMAND_MAX
632};
633
634#define V4L2_CID_IS_GET_SENSOR_OFFSET_X (V4L2_CID_FIMC_IS_BASE + 480)
635#define V4L2_CID_IS_GET_SENSOR_OFFSET_Y (V4L2_CID_FIMC_IS_BASE + 481)
636#define V4L2_CID_IS_GET_SENSOR_WIDTH (V4L2_CID_FIMC_IS_BASE + 482)
637#define V4L2_CID_IS_GET_SENSOR_HEIGHT (V4L2_CID_FIMC_IS_BASE + 483)
638
639#define V4L2_CID_IS_GET_FRAME_VALID (V4L2_CID_FIMC_IS_BASE + 484)
640#define V4L2_CID_IS_SET_FRAME_VALID (V4L2_CID_FIMC_IS_BASE + 485)
641#define V4L2_CID_IS_GET_FRAME_BADMARK (V4L2_CID_FIMC_IS_BASE + 486)
642#define V4L2_CID_IS_SET_FRAME_BADMARK (V4L2_CID_FIMC_IS_BASE + 487)
643#define V4L2_CID_IS_GET_FRAME_CAPTURED (V4L2_CID_FIMC_IS_BASE + 488)
644#define V4L2_CID_IS_SET_FRAME_CAPTURED (V4L2_CID_FIMC_IS_BASE + 489)
645#define V4L2_CID_IS_SET_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 490)
646#define V4L2_CID_IS_GET_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 491)
647#define V4L2_CID_IS_CLEAR_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 492)
648#define V4L2_CID_IS_GET_LOSTED_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 493)
649#define V4L2_CID_IS_ISP_DMA_BUFFER_NUM (V4L2_CID_FIMC_IS_BASE + 494)
650#define V4L2_CID_IS_ISP_DMA_BUFFER_ADDRESS (V4L2_CID_FIMC_IS_BASE + 495)
651
652#define V4L2_CID_IS_ZOOM_STATE (V4L2_CID_FIMC_IS_BASE + 660)
653#define V4L2_CID_IS_ZOOM_MAX_LEVEL (V4L2_CID_FIMC_IS_BASE + 661)
654#define V4L2_CID_IS_ZOOM (V4L2_CID_FIMC_IS_BASE + 662)
655#define V4L2_CID_IS_FW_DEBUG_REGION_ADDR (V4L2_CID_FIMC_IS_BASE + 663)
656
657#define V4L2_CID_IS_TUNE_SEL_ENTRY (V4L2_CID_FIMC_IS_TUNE_BASE)
658#define V4L2_CID_IS_TUNE_SENSOR_EXPOSURE (V4L2_CID_FIMC_IS_TUNE_BASE + 1)
659#define V4L2_CID_IS_TUNE_SENSOR_ANALOG_GAIN (V4L2_CID_FIMC_IS_TUNE_BASE + 2)
660#define V4L2_CID_IS_TUNE_SENSOR_FRAME_RATE (V4L2_CID_FIMC_IS_TUNE_BASE + 3)
661#define V4L2_CID_IS_TUNE_SENSOR_ACTUATOR_POS (V4L2_CID_FIMC_IS_TUNE_BASE + 4)
662
663enum v4l2_blur {
664 BLUR_LEVEL_0 = 0,
665 BLUR_LEVEL_1,
666 BLUR_LEVEL_2,
667 BLUR_LEVEL_3,
668 BLUR_LEVEL_MAX,
669};
670
671#if 1
672#define V4L2_CID_CAMERA_SCENE_MODE (V4L2_CID_PRIVATE_BASE+70)
673enum v4l2_scene_mode {
674 SCENE_MODE_BASE,
675 SCENE_MODE_NONE,
676 SCENE_MODE_PORTRAIT,
677 SCENE_MODE_NIGHTSHOT,
678 SCENE_MODE_BACK_LIGHT,
679 SCENE_MODE_LANDSCAPE,
680 SCENE_MODE_SPORTS,
681 SCENE_MODE_PARTY_INDOOR,
682 SCENE_MODE_BEACH_SNOW,
683 SCENE_MODE_SUNSET,
684 SCENE_MODE_DUSK_DAWN,
685 SCENE_MODE_FALL_COLOR,
686 SCENE_MODE_FIREWORKS,
687 SCENE_MODE_TEXT,
688 SCENE_MODE_CANDLE_LIGHT,
689 SCENE_MODE_MAX,
690};
691
692#define V4L2_CID_CAMERA_FLASH_MODE (V4L2_CID_PRIVATE_BASE+71)
693enum v4l2_flash_mode {
694 FLASH_MODE_BASE,
695 FLASH_MODE_OFF,
696 FLASH_MODE_AUTO,
697 FLASH_MODE_ON,
698 FLASH_MODE_TORCH,
699 FLASH_MODE_RED_EYE,
700 FLASH_MODE_FILL_IN,
701 FLASH_MODE_SLOW_SYNC,
702 FLASH_MODE_RED_EYE_FIX,
703 FLASH_MODE_MAX,
704};
705
706#define V4L2_CID_CAMERA_BRIGHTNESS (V4L2_CID_PRIVATE_BASE+72)
707enum v4l2_ev_mode {
708 EV_MINUS_4 = -4,
709 EV_MINUS_3 = -3,
710 EV_MINUS_2 = -2,
711 EV_MINUS_1 = -1,
712 EV_DEFAULT = 0,
713 EV_PLUS_1 = 1,
714 EV_PLUS_2 = 2,
715 EV_PLUS_3 = 3,
716 EV_PLUS_4 = 4,
717 EV_MAX,
718 EV_MAX_V4L2 = EV_MAX,
719};
720
721enum v4l2_exposure {
722 EXPOSURE_MINUS_6 = -6,
723 EXPOSURE_MINUS_5 = -5,
724 EXPOSURE_MINUS_4 = -4,
725 EXPOSURE_MINUS_3 = -3,
726 EXPOSURE_MINUS_2 = -2,
727 EXPOSURE_MINUS_1 = -1,
728 EXPOSURE_DEFAULT = 0,
729 EXPOSURE_PLUS_1 = 1,
730 EXPOSURE_PLUS_2 = 2,
731 EXPOSURE_PLUS_3 = 3,
732 EXPOSURE_PLUS_4 = 4,
733 EXPOSURE_PLUS_5 = 5,
734 EXPOSURE_PLUS_6 = 6,
735 EXPOSURE_MAX,
736};
737
738#define V4L2_CID_CAMERA_WHITE_BALANCE (V4L2_CID_PRIVATE_BASE+73)
739enum v4l2_wb_mode {
740 WHITE_BALANCE_BASE = 0,
741 WHITE_BALANCE_AUTO,
742 WHITE_BALANCE_SUNNY,
743 WHITE_BALANCE_CLOUDY,
744 WHITE_BALANCE_TUNGSTEN,
745 WHITE_BALANCE_FLUORESCENT,
746 WHITE_BALANCE_FLUORESCENT_H,
747 WHITE_BALANCE_FLUORESCENT_L,
748 WHITE_BALANCE_CUSTOM,
749 WHITE_BALANCE_K,
750 WHITE_BALANCE_MAX,
751};
752
753#define V4L2_CID_CAMERA_EFFECT (V4L2_CID_PRIVATE_BASE+74)
754enum v4l2_effect_mode {
755 IMAGE_EFFECT_BASE = 0,
756 IMAGE_EFFECT_NONE,
757 IMAGE_EFFECT_BNW,
758 IMAGE_EFFECT_SEPIA,
759 IMAGE_EFFECT_AQUA,
760 IMAGE_EFFECT_ANTIQUE,
761 IMAGE_EFFECT_NEGATIVE,
762 IMAGE_EFFECT_SHARPEN,
763 IMAGE_EFFECT_SKETCH,
764 IMAGE_EFFECT_WASHED,
765 IMAGE_EFFECT_VINTAGE_WARM,
766 IMAGE_EFFECT_VINTAGE_COLD,
767 IMAGE_EFFECT_SOLARIZE,
768 IMAGE_EFFECT_POSTERIZE,
769 IMAGE_EFFECT_POINT_BLUE,
770 IMAGE_EFFECT_POINT_RED_YELLOW,
771 IMAGE_EFFECT_POINT_COLOR_3,
772 IMAGE_EFFECT_POINT_GREEN,
773 IMAGE_EFFECT_MAX,
774};
775
776#define V4L2_CID_CAMERA_ISO (V4L2_CID_PRIVATE_BASE+75)
777enum v4l2_iso_mode {
778 ISO_AUTO = 0,
779 ISO_50,
780 ISO_100,
781 ISO_200,
782 ISO_400,
783 ISO_800,
784 ISO_1600,
785 ISO_SPORTS,
786 ISO_NIGHT,
787 ISO_MOVIE,
788 ISO_MAX,
789};
790
791#define V4L2_CID_CAMERA_METERING (V4L2_CID_PRIVATE_BASE+76)
792enum v4l2_metering_mode {
793 METERING_BASE = 0,
794 METERING_MATRIX,
795 METERING_CENTER,
796 METERING_SPOT,
797 METERING_MAX,
798};
799
800#define V4L2_CID_CAMERA_CONTRAST (V4L2_CID_PRIVATE_BASE+77)
801enum v4l2_contrast_mode {
802 CONTRAST_MINUS_4 = 0,
803 CONTRAST_MINUS_3,
804 CONTRAST_MINUS_2,
805 CONTRAST_MINUS_1,
806 CONTRAST_DEFAULT,
807 CONTRAST_PLUS_1,
808 CONTRAST_PLUS_2,
809 CONTRAST_PLUS_3,
810 CONTRAST_PLUS_4,
811 CONTRAST_MAX,
812};
813
814#define V4L2_CID_CAMERA_SATURATION (V4L2_CID_PRIVATE_BASE+78)
815enum v4l2_saturation_mode {
816 SATURATION_MINUS_2 = 0,
817 SATURATION_MINUS_1,
818 SATURATION_DEFAULT,
819 SATURATION_PLUS_1,
820 SATURATION_PLUS_2,
821 SATURATION_MAX,
822};
823
824#define V4L2_CID_CAMERA_SHARPNESS (V4L2_CID_PRIVATE_BASE+79)
825enum v4l2_sharpness_mode {
826 SHARPNESS_MINUS_2 = 0,
827 SHARPNESS_MINUS_1,
828 SHARPNESS_DEFAULT,
829 SHARPNESS_PLUS_1,
830 SHARPNESS_PLUS_2,
831 SHARPNESS_PLUS_3,
832 SHARPNESS_MAX,
833};
834
835#define V4L2_CID_CAMERA_WDR (V4L2_CID_PRIVATE_BASE+80)
836enum v4l2_wdr_mode {
837 WDR_OFF,
838 WDR_ON,
839 WDR_MAX,
840};
841
842#define V4L2_CID_CAMERA_ANTI_SHAKE (V4L2_CID_PRIVATE_BASE+81)
843enum v4l2_anti_shake_mode {
844 ANTI_SHAKE_OFF,
845 ANTI_SHAKE_STILL_ON,
846 ANTI_SHAKE_MOVIE_ON,
847 ANTI_SHAKE_MAX,
848};
849
850#define V4L2_CID_CAMERA_TOUCH_AF_START_STOP (V4L2_CID_PRIVATE_BASE+82)
851enum v4l2_touch_af {
852 TOUCH_AF_STOP = 0,
853 TOUCH_AF_START,
854 TOUCH_AF_MAX,
855};
856
857#define V4L2_CID_CAMERA_SMART_AUTO (V4L2_CID_PRIVATE_BASE+83)
858enum v4l2_smart_auto {
859 SMART_AUTO_OFF = 0,
860 SMART_AUTO_ON,
861 SMART_AUTO_MAX,
862};
863
864#define V4L2_CID_CAMERA_VINTAGE_MODE (V4L2_CID_PRIVATE_BASE+84)
865enum v4l2_vintage_mode {
866 VINTAGE_MODE_BASE,
867 VINTAGE_MODE_OFF,
868 VINTAGE_MODE_NORMAL,
869 VINTAGE_MODE_WARM,
870 VINTAGE_MODE_COOL,
871 VINTAGE_MODE_BNW,
872 VINTAGE_MODE_MAX,
873};
874
875#define V4L2_CID_CAMERA_JPEG_QUALITY (V4L2_CID_PRIVATE_BASE+85)
876/* (V4L2_CID_PRIVATE_BASE+86) */
877#define V4L2_CID_CAMERA_GPS_LATITUDE (V4L2_CID_CAMERA_CLASS_BASE+30)
878/* (V4L2_CID_PRIVATE_BASE+87) */
879#define V4L2_CID_CAMERA_GPS_LONGITUDE (V4L2_CID_CAMERA_CLASS_BASE + 31)
880/* (V4L2_CID_PRIVATE_BASE+88) */
881#define V4L2_CID_CAMERA_GPS_TIMESTAMP (V4L2_CID_CAMERA_CLASS_BASE + 32)
882/* (V4L2_CID_PRIVATE_BASE+89)*/
883#define V4L2_CID_CAMERA_GPS_ALTITUDE (V4L2_CID_CAMERA_CLASS_BASE + 33)
884#define V4L2_CID_CAMERA_EXIF_TIME_INFO (V4L2_CID_CAMERA_CLASS_BASE + 34)
885#define V4L2_CID_CAMERA_GPS_PROCESSINGMETHOD (V4L2_CID_CAMERA_CLASS_BASE+35)
886
887#define V4L2_CID_FOCUS_AUTO_MODE (V4L2_CID_CAMERA_CLASS_BASE+36)
888enum v4l2_focus_mode_type {
889 V4L2_FOCUS_AUTO_NORMAL = 0,
890 V4L2_FOCUS_AUTO_MACRO,
891 V4L2_FOCUS_AUTO_CONTINUOUS,
892 V4L2_FOCUS_AUTO_FACE_DETECTION,
893 V4L2_FOCUS_AUTO_RECTANGLE,
894 V4L2_FOCUS_AUTO_MAX,
895};
896#define V4L2_CID_FOCUS_AUTO_RECTANGLE_LEFT (V4L2_CID_CAMERA_CLASS_BASE+37)
897#define V4L2_CID_FOCUS_AUTO_RECTANGLE_TOP (V4L2_CID_CAMERA_CLASS_BASE+38)
898#define V4L2_CID_FOCUS_AUTO_RECTANGLE_WIDTH (V4L2_CID_CAMERA_CLASS_BASE+39)
899#define V4L2_CID_FOCUS_AUTO_RECTANGLE_HEIGHT (V4L2_CID_CAMERA_CLASS_BASE+40)
900
901#define V4L2_CID_CAMERA_ZOOM (V4L2_CID_PRIVATE_BASE+90)
902enum v4l2_zoom_level {
903 ZOOM_LEVEL_0 = 0,
904 ZOOM_LEVEL_1,
905 ZOOM_LEVEL_2,
906 ZOOM_LEVEL_3,
907 ZOOM_LEVEL_4,
908 ZOOM_LEVEL_5,
909 ZOOM_LEVEL_6,
910 ZOOM_LEVEL_7,
911 ZOOM_LEVEL_8,
912 ZOOM_LEVEL_9,
913 ZOOM_LEVEL_10,
914 ZOOM_LEVEL_11,
915 ZOOM_LEVEL_12,
916 ZOOM_LEVEL_MAX = 31,
917};
918
919#define V4L2_CID_CAMERA_FACE_DETECTION (V4L2_CID_PRIVATE_BASE+91)
920enum v4l2_face_detection {
921 FACE_DETECTION_OFF = 0,
922 FACE_DETECTION_ON,
923 FACE_DETECTION_NOLINE,
924 FACE_DETECTION_ON_BEAUTY,
925 FACE_DETECTION_NORMAL,
926 FACE_DETECTION_SMILE_SHOT,
927 FACE_DETECTION_BLINK,
928 FACE_DETECTION_MAX,
929};
930
931#define V4L2_CID_CAMERA_SMART_AUTO_STATUS (V4L2_CID_PRIVATE_BASE+92)
932enum v4l2_smart_auto_status {
933 SMART_AUTO_STATUS_AUTO = 0,
934 SMART_AUTO_STATUS_LANDSCAPE,
935 SMART_AUTO_STATUS_PORTRAIT,
936 SMART_AUTO_STATUS_MACRO,
937 SMART_AUTO_STATUS_NIGHT,
938 SMART_AUTO_STATUS_PORTRAIT_NIGHT,
939 SMART_AUTO_STATUS_BACKLIT,
940 SMART_AUTO_STATUS_PORTRAIT_BACKLIT,
941 SMART_AUTO_STATUS_ANTISHAKE,
942 SMART_AUTO_STATUS_PORTRAIT_ANTISHAKE,
943 SMART_AUTO_STATUS_MAX,
944};
945
946#define V4L2_CID_CAMERA_SET_AUTO_FOCUS (V4L2_CID_PRIVATE_BASE+93)
947enum v4l2_auto_focus {
948 AUTO_FOCUS_OFF = 0,
949 AUTO_FOCUS_ON,
950 AUTO_FOCUS_MAX,
951};
952
953#define V4L2_CID_CAMERA_BEAUTY_SHOT (V4L2_CID_PRIVATE_BASE+94)
954enum v4l2_beauty_shot {
955 BEAUTY_SHOT_OFF = 0,
956 BEAUTY_SHOT_ON,
957 BEAUTY_SHOT_MAX,
958};
959
960#define V4L2_CID_CAMERA_AEAWB_LOCK_UNLOCK (V4L2_CID_PRIVATE_BASE+95)
961enum v4l2_ae_awb_lockunlock {
962 AE_UNLOCK_AWB_UNLOCK = 0,
963 AE_LOCK_AWB_UNLOCK,
964 AE_UNLOCK_AWB_LOCK,
965 AE_LOCK_AWB_LOCK,
966 AE_AWB_MAX
967};
968
969#define V4L2_CID_CAMERA_FACEDETECT_LOCKUNLOCK (V4L2_CID_PRIVATE_BASE+96)
970enum v4l2_face_lock {
971 FACE_LOCK_OFF = 0,
972 FACE_LOCK_ON,
973 FIRST_FACE_TRACKING,
974 FACE_LOCK_MAX,
975};
976
977#define V4L2_CID_CAMERA_OBJECT_POSITION_X (V4L2_CID_PRIVATE_BASE+97)
978#define V4L2_CID_CAMERA_OBJECT_POSITION_Y (V4L2_CID_PRIVATE_BASE+98)
979#define V4L2_CID_CAMERA_FOCUS_MODE (V4L2_CID_PRIVATE_BASE+99)
980enum v4l2_focusmode {
981 FOCUS_MODE_AUTO = 0,
982 FOCUS_MODE_MACRO,
983 FOCUS_MODE_FACEDETECT,
984 FOCUS_MODE_AUTO_DEFAULT,
985 FOCUS_MODE_MACRO_DEFAULT,
986 FOCUS_MODE_FACEDETECT_DEFAULT,
987 FOCUS_MODE_INFINITY,
988 FOCUS_MODE_FIXED,
989 FOCUS_MODE_CONTINOUS,
990 FOCUS_MODE_CONTINOUS_PICTURE,
991 FOCUS_MODE_CONTINOUS_PICTURE_MACRO,
992 FOCUS_MODE_CONTINOUS_VIDEO,
993 FOCUS_MODE_TOUCH,
994 FOCUS_MODE_MAX,
995 FOCUS_MODE_DEFAULT = (1 << 8),
996};
997
998#define V4L2_CID_CAMERA_OBJ_TRACKING_STATUS (V4L2_CID_PRIVATE_BASE+100)
999enum v4l2_obj_tracking_status {
1000 OBJECT_TRACKING_STATUS_BASE,
1001 OBJECT_TRACKING_STATUS_PROGRESSING,
1002 OBJECT_TRACKING_STATUS_SUCCESS,
1003 OBJECT_TRACKING_STATUS_FAIL,
1004 OBJECT_TRACKING_STATUS_MISSING,
1005 OBJECT_TRACKING_STATUS_MAX,
1006};
1007
1008#define V4L2_CID_CAMERA_OBJ_TRACKING_START_STOP (V4L2_CID_PRIVATE_BASE+101)
1009enum v4l2_ot_start_stop {
1010 OT_STOP = 0,
1011 OT_START,
1012 OT_MAX,
1013};
1014
1015#define V4L2_CID_CAMERA_CAF_START_STOP (V4L2_CID_PRIVATE_BASE+102)
1016enum v4l2_caf_start_stop {
1017 CAF_STOP = 0,
1018 CAF_START,
1019 CAF_MAX,
1020};
1021
1022#define V4L2_CID_CAMERA_AUTO_FOCUS_RESULT (V4L2_CID_PRIVATE_BASE+103)
1023enum v4l2_af_status {
1024 CAMERA_AF_STATUS_IN_PROGRESS = 0,
1025 CAMERA_AF_STATUS_SUCCESS,
1026 CAMERA_AF_STATUS_FAIL,
1027 CAMERA_AF_STATUS_1ST_SUCCESS,
1028 CAMERA_AF_STATUS_RESTART,
1029 CAMERA_AF_STATUS_MAX,
1030};
1031
1032#define V4L2_CID_CAMERA_FRAME_RATE (V4L2_CID_PRIVATE_BASE+104)
1033enum v4l2_frame_rate {
1034 FRAME_RATE_AUTO = 0,
1035 FRAME_RATE_7 = 7,
1036 FRAME_RATE_15 = 15,
1037 FRAME_RATE_20 = 20,
1038 FRAME_RATE_25 = 25,
1039 FRAME_RATE_30 = 30,
1040 FRAME_RATE_60 = 60,
1041 FRAME_RATE_120 = 120,
1042 FRAME_RATE_MAX
1043};
1044
1045#define V4L2_CID_CAMERA_ANTI_BANDING (V4L2_CID_PRIVATE_BASE+105)
1046enum v4l2_anti_banding {
1047 ANTI_BANDING_AUTO = 0,
1048 ANTI_BANDING_50HZ = 1,
1049 ANTI_BANDING_60HZ = 2,
1050 ANTI_BANDING_OFF = 3,
1051};
1052
1053#define V4L2_CID_CAMERA_SET_GAMMA (V4L2_CID_PRIVATE_BASE+106)
1054enum v4l2_gamma_mode {
1055 GAMMA_OFF = 0,
1056 GAMMA_ON = 1,
1057 GAMMA_MAX,
1058};
1059
1060#define V4L2_CID_CAMERA_SET_SLOW_AE (V4L2_CID_PRIVATE_BASE+107)
1061enum v4l2_slow_ae_mode {
1062 SLOW_AE_OFF,
1063 SLOW_AE_ON,
1064 SLOW_AE_MAX,
1065};
1066
1067#define V4L2_CID_CAMERA_BATCH_REFLECTION (V4L2_CID_PRIVATE_BASE+108)
1068#define V4L2_CID_CAMERA_EXIF_ORIENTATION (V4L2_CID_PRIVATE_BASE+109)
1069#define V4L2_CID_CAMERA_GET_LUX (V4L2_CID_PRIVATE_BASE+110)
1070
1071/* s1_camera [ Defense process by ESD input ] */
1072#define V4L2_CID_CAMERA_RESET (V4L2_CID_PRIVATE_BASE+111)
1073#define V4L2_CID_CAMERA_CHECK_DATALINE (V4L2_CID_PRIVATE_BASE+112)
1074#define V4L2_CID_CAMERA_CHECK_DATALINE_STOP (V4L2_CID_PRIVATE_BASE+113)
1075
1076#endif
1077
1078/* Modify NTTS1 */
1079#if defined(CONFIG_ARIES_NTT)
1080#define V4L2_CID_CAMERA_AE_AWB_DISABLE_LOCK (V4L2_CID_PRIVATE_BASE+114)
1081#endif
1082#define V4L2_CID_CAMERA_THUMBNAIL_NULL (V4L2_CID_PRIVATE_BASE+115)
1083#define V4L2_CID_CAMERA_SENSOR_MODE (V4L2_CID_PRIVATE_BASE+116)
1084enum v4l2_sensor_mode {
1085 SENSOR_CAMERA,
1086 SENSOR_MOVIE,
1087};
1088
1089enum stream_mode_t {
1090 STREAM_MODE_CAM_OFF,
1091 STREAM_MODE_CAM_ON,
1092 STREAM_MODE_MOVIE_OFF,
1093 STREAM_MODE_MOVIE_ON,
1094 STREAM_MODE_WAIT_OFF
1095};
1096
1097#define V4L2_CID_CAMERA_EXIF_EXPTIME (V4L2_CID_PRIVATE_BASE+117)
1098#define V4L2_CID_CAMERA_EXIF_FLASH (V4L2_CID_PRIVATE_BASE+118)
1099#define V4L2_CID_CAMERA_EXIF_ISO (V4L2_CID_PRIVATE_BASE+119)
1100#define V4L2_CID_CAMERA_EXIF_TV (V4L2_CID_PRIVATE_BASE+120)
1101#define V4L2_CID_CAMERA_EXIF_BV (V4L2_CID_PRIVATE_BASE+121)
1102#define V4L2_CID_CAMERA_EXIF_EBV (V4L2_CID_PRIVATE_BASE+122)
1103#define V4L2_CID_CAMERA_CHECK_ESD (V4L2_CID_PRIVATE_BASE+123)
1104#define V4L2_CID_CAMERA_APP_CHECK (V4L2_CID_PRIVATE_BASE+124)
1105#define V4L2_CID_CAMERA_CHECK_SENSOR_STATUS (V4L2_CID_PRIVATE_BASE+150)
1106#define V4L2_CID_CAMERA_DEFAULT_FOCUS_POSITION (V4L2_CID_PRIVATE_BASE+151)
1107#define V4L2_CID_CAMERA_BUSFREQ_LOCK (V4L2_CID_PRIVATE_BASE+125)
1108#define V4L2_CID_CAMERA_BUSFREQ_UNLOCK (V4L2_CID_PRIVATE_BASE+126)
1109
1110/* If you would like to control AE and AWB lock with signle command,
1111 * use V4L2_CID_CAMERA_AEAWB_LOCK_UNLOCK above.
1112 */
1113#define V4L2_CID_CAMERA_AE_LOCK_UNLOCK (V4L2_CID_PRIVATE_BASE + 127)
1114enum v4l2_ae_lockunlock {
1115 AE_UNLOCK = 0,
1116 AE_LOCK,
1117 AE_LOCK_MAX
1118};
1119
1120#define V4L2_CID_CAMERA_AWB_LOCK_UNLOCK (V4L2_CID_PRIVATE_BASE + 128)
1121enum v4l2_awb_lockunlock {
1122 AWB_UNLOCK = 0,
1123 AWB_LOCK,
1124 AWB_LOCK_MAX
1125};
1126
1127#define V4L2_CID_CAMERA_SENSOR_OUTPUT_SIZE (V4L2_CID_PRIVATE_BASE + 129)
1128#define V4L2_CID_EMBEDDEDDATA_ENABLE (V4L2_CID_PRIVATE_BASE + 130)
1129#define V4L2_CID_CAMERA_JPEG_RESOLUTION (V4L2_CID_PRIVATE_BASE + 131)
1130#define V4L2_CID_CAMERA_FACE_ZOOM (V4L2_CID_PRIVATE_BASE + 132)
1131enum v4l2_face_zoom {
1132 FACE_ZOOM_STOP = 0,
1133 FACE_ZOOM_START
1134};
1135
1136/* control for post processing block in ISP */
1137#define V4L2_CID_CAMERA_SET_ODC (V4L2_CID_PRIVATE_BASE+127)
1138enum set_odc_mode {
1139 CAMERA_ODC_ON,
1140 CAMERA_ODC_OFF
1141};
1142
1143#define V4L2_CID_CAMERA_SET_DIS (V4L2_CID_PRIVATE_BASE+128)
1144enum set_dis_mode {
1145 CAMERA_DIS_ON,
1146 CAMERA_DIS_OFF
1147};
1148
1149#define V4L2_CID_CAMERA_SET_3DNR (V4L2_CID_PRIVATE_BASE+129)
1150enum set_3dnr_mode {
1151 CAMERA_3DNR_ON,
1152 CAMERA_3DNR_OFF
1153};
1154
1155#define V4L2_CID_CAMERA_BRACKET (V4L2_CID_PRIVATE_BASE+134)
1156enum v4l2_face_bracket_mode {
1157 BRACKET_MODE_OFF = 0,
1158 BRACKET_MODE_AEB,
1159 BRACKET_MODE_WBB,
1160 BRACKET_MODE_MAX,
1161};
1162
1163#define V4L2_CID_CAMERA_BRACKET_AEB (V4L2_CID_PRIVATE_BASE+135)
1164enum v4l2_face_bracket_aeb_value {
1165 BRACKET_AEB_VALUE1 = 1,
1166 BRACKET_AEB_VALUE2,
1167 BRACKET_AEB_VALUE3,
1168 BRACKET_AEB_VALUE4,
1169 BRACKET_AEB_VALUE5,
1170 BRACKET_AEB_VALUE6,
1171};
1172
1173#define V4L2_CID_CAMERA_BRACKET_WBB (V4L2_CID_PRIVATE_BASE+136)
1174enum v4l2_face_bracket_wbb_value {
1175 BRACKET_WBB_VALUE1 = 1,
1176 BRACKET_WBB_VALUE2,
1177 BRACKET_WBB_VALUE3,
1178 BRACKET_WBB_VALUE4,
1179 BRACKET_WBB_VALUE5,
1180 BRACKET_WBB_VALUE6,
1181};
1182
1183#define V4L2_CID_CAMERA_DRIVE_DIAL (V4L2_CID_PRIVATE_BASE+137)
1184enum v4l2_drive_dial {
1185 DRIVEDIAL_SINGLE = 1,
1186 DRIVEDIAL_BKT = 2,
1187 DRIVEDIAL_CONTI_3 = 3,
1188 DRIVEDIAL_CONTI_5 = 5,
1189 DRIVEDIAL_CONTI_10 = 10,
1190};
1191
1192enum v4l2_running_cap_mode {
1193 RUNNING_MODE_SINGLE = 0,
1194 RUNNING_MODE_CONTINUOUS,
1195 RUNNING_MODE_BRACKET,
1196 RUNNING_MODE_HDR,
1197 RUNNING_MODE_BLINK,
1198 RUNNING_MODE_MAX
1199};
1200
1201#define V4L2_CID_CAMERA_FD_EYE_BLINK_RESULT (V4L2_CID_PRIVATE_BASE+138)
1202
1203#define V4L2_CID_CAMERA_OPTICAL_ZOOM_STEP (V4L2_CID_PRIVATE_BASE + 139)
1204#define V4L2_CID_CAMERA_OPTICAL_ZOOM_CTRL (V4L2_CID_PRIVATE_BASE + 140)
1205
1206enum v4l2_optical_zoom_ctrl {
1207 V4L2_OPTICAL_ZOOM_TELE,
1208 V4L2_OPTICAL_ZOOM_WIDE,
1209 V4L2_OPTICAL_ZOOM_STOP,
1210};
1211
1212#define V4L2_CID_CAMERA_LDC (V4L2_CID_PRIVATE_BASE+142)
1213enum set_LDC_mode {
1214 LDC_SET_OFF = 0,
1215 LDC_SET_ON = 1,
1216};
1217
1218#define V4L2_CID_CAMERA_LSC (V4L2_CID_PRIVATE_BASE+143)
1219enum set_LSC_mode {
1220 LSC_SET_OFF = 0,
1221 LSC_SET_ON = 1,
1222};
1223
1224/* Pixel format FOURCC depth Description */
1225enum v4l2_pix_format_mode {
1226 V4L2_PIX_FMT_MODE_PREVIEW,
1227 V4L2_PIX_FMT_MODE_CAPTURE,
1228 V4L2_PIX_FMT_MODE_HDR,
1229 V4L2_PIX_FMT_MODE_VT_MIRROR,
1230 V4L2_PIX_FMT_MODE_VT_NONMIRROR,
1231};
1232
1233/* 12 Y/CbCr 4:2:0 64x32 macroblocks */
1234#define V4L2_PIX_FMT_NV12T v4l2_fourcc('T', 'V', '1', '2')
1235#define V4L2_PIX_FMT_NV21T v4l2_fourcc('T', 'V', '2', '1')
1236#define V4L2_PIX_FMT_INTERLEAVED v4l2_fourcc('I', 'T', 'L', 'V')
1237
1238/*
1239 * * V4L2 extention for digital camera
1240 * */
1241/* Strobe flash light */
1242enum v4l2_strobe_control {
1243 /* turn off the flash light */
1244 V4L2_STROBE_CONTROL_OFF = 0,
1245 /* turn on the flash light */
1246 V4L2_STROBE_CONTROL_ON = 1,
1247 /* act guide light before splash */
1248 V4L2_STROBE_CONTROL_AFGUIDE = 2,
1249 /* charge the flash light */
1250 V4L2_STROBE_CONTROL_CHARGE = 3,
1251};
1252
1253enum v4l2_strobe_conf {
1254 V4L2_STROBE_OFF = 0, /* Always off */
1255 V4L2_STROBE_ON = 1, /* Always splashes */
1256 /* Auto control presets */
1257 V4L2_STROBE_AUTO = 2,
1258 V4L2_STROBE_REDEYE_REDUCTION = 3,
1259 V4L2_STROBE_SLOW_SYNC = 4,
1260 V4L2_STROBE_FRONT_CURTAIN = 5,
1261 V4L2_STROBE_REAR_CURTAIN = 6,
1262 /* Extra manual control presets */
1263 /* keep turned on until turning off */
1264 V4L2_STROBE_PERMANENT = 7,
1265 V4L2_STROBE_EXTERNAL = 8,
1266};
1267
1268enum v4l2_strobe_status {
1269 V4L2_STROBE_STATUS_OFF = 0,
1270 /* while processing configurations */
1271 V4L2_STROBE_STATUS_BUSY = 1,
1272 V4L2_STROBE_STATUS_ERR = 2,
1273 V4L2_STROBE_STATUS_CHARGING = 3,
1274 V4L2_STROBE_STATUS_CHARGED = 4,
1275};
1276
1277/* capabilities field */
1278/* No strobe supported */
1279#define V4L2_STROBE_CAP_NONE 0x0000
1280/* Always flash off mode */
1281#define V4L2_STROBE_CAP_OFF 0x0001
1282/* Always use flash light mode */
1283#define V4L2_STROBE_CAP_ON 0x0002
1284/* Flashlight works automatic */
1285#define V4L2_STROBE_CAP_AUTO 0x0004
1286/* Red-eye reduction */
1287#define V4L2_STROBE_CAP_REDEYE 0x0008
1288/* Slow sync */
1289#define V4L2_STROBE_CAP_SLOWSYNC 0x0010
1290/* Front curtain */
1291#define V4L2_STROBE_CAP_FRONT_CURTAIN 0x0020
1292/* Rear curtain */
1293#define V4L2_STROBE_CAP_REAR_CURTAIN 0x0040
1294/* keep turned on until turning off */
1295#define V4L2_STROBE_CAP_PERMANENT 0x0080
1296/* use external strobe */
1297#define V4L2_STROBE_CAP_EXTERNAL 0x0100
1298
1299/* Set mode and Get status */
1300struct v4l2_strobe {
1301 /* off/on/charge:0/1/2 */
1302 enum v4l2_strobe_control control;
1303 /* supported strobe capabilities */
1304 __u32 capabilities;
1305 enum v4l2_strobe_conf mode;
1306 enum v4l2_strobe_status status; /* read only */
1307/* default is 0 and range of value varies from each models */
1308 __u32 flash_ev;
1309 __u32 reserved[4];
1310};
1311
1312#define VIDIOC_S_STROBE _IOWR('V', 83, struct v4l2_strobe)
1313#define VIDIOC_G_STROBE _IOR('V', 84, struct v4l2_strobe)
1314
1315/* Object recognition and collateral actions */
1316enum v4l2_recog_mode {
1317 V4L2_RECOGNITION_MODE_OFF = 0,
1318 V4L2_RECOGNITION_MODE_ON = 1,
1319 V4L2_RECOGNITION_MODE_LOCK = 2,
1320};
1321
1322enum v4l2_recog_action {
1323 V4L2_RECOGNITION_ACTION_NONE = 0, /* only recognition */
1324 V4L2_RECOGNITION_ACTION_BLINK = 1, /* Capture on blinking */
1325 V4L2_RECOGNITION_ACTION_SMILE = 2, /* Capture on smiling */
1326};
1327
1328enum v4l2_recog_pattern {
1329 V4L2_RECOG_PATTERN_FACE = 0, /* Face */
1330 V4L2_RECOG_PATTERN_HUMAN = 1, /* Human */
1331 V4L2_RECOG_PATTERN_CHAR = 2, /* Character */
1332};
1333
1334struct v4l2_recog_rect {
1335 enum v4l2_recog_pattern p; /* detected pattern */
1336 struct v4l2_rect o; /* detected area */
1337 __u32 reserved[4];
1338};
1339
1340struct v4l2_recog_data {
1341 __u8 detect_cnt; /* detected object counter */
1342 struct v4l2_rect o; /* detected area */
1343 __u32 reserved[4];
1344};
1345
1346struct v4l2_recognition {
1347 enum v4l2_recog_mode mode;
1348
1349 /* Which pattern to detect */
1350 enum v4l2_recog_pattern pattern;
1351
1352 /* How many object to detect */
1353 __u8 obj_num;
1354
1355 /* select detected object */
1356 __u32 detect_idx;
1357
1358 /* read only :Get object coordination */
1359 struct v4l2_recog_data data;
1360
1361 enum v4l2_recog_action action;
1362 __u32 reserved[4];
1363};
1364
1365#define VIDIOC_S_RECOGNITION _IOWR('V', 85, struct v4l2_recognition)
1366#define VIDIOC_G_RECOGNITION _IOR('V', 86, struct v4l2_recognition)
1367
1368#endif /* __LINUX_VIDEODEV2_SAMSUNG_H */
diff --git a/include/linux/videodev2_samsung.h b/include/linux/videodev2_samsung.h
new file mode 100644
index 00000000000..23cd0aa14b4
--- /dev/null
+++ b/include/linux/videodev2_samsung.h
@@ -0,0 +1,1176 @@
1/*
2 * Video for Linux Two header file for samsung
3 *
4 * Copyright (C) 2009, Dongsoo Nathaniel Kim<dongsoo45.kim@samsung.com>
5 *
6 * This header file contains several v4l2 APIs to be proposed to v4l2
7 * community and until bein accepted, will be used restrictly in Samsung's
8 * camera interface driver FIMC.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef __LINUX_VIDEODEV2_SAMSUNG_H
17#define __LINUX_VIDEODEV2_SAMSUNG_H
18
19/* Values for 'capabilities' field */
20/* Object detection device */
21#define V4L2_CAP_OBJ_RECOGNITION 0x10000000
22/* strobe control */
23#define V4L2_CAP_STROBE 0x20000000
24
25#define V4L2_CID_FOCUS_MODE (V4L2_CID_CAMERA_CLASS_BASE+17)
26/* Focus Methods */
27enum v4l2_focus_mode {
28 V4L2_FOCUS_MODE_AUTO = 0,
29 V4L2_FOCUS_MODE_MACRO = 1,
30 V4L2_FOCUS_MODE_MANUAL = 2,
31 V4L2_FOCUS_MODE_LASTP = 2,
32};
33
34#define V4L2_CID_ZOOM_MODE (V4L2_CID_CAMERA_CLASS_BASE+18)
35/* Zoom Methods */
36enum v4l2_zoom_mode {
37 V4L2_ZOOM_MODE_CONTINUOUS = 0,
38 V4L2_ZOOM_MODE_OPTICAL = 1,
39 V4L2_ZOOM_MODE_DIGITAL = 2,
40 V4L2_ZOOM_MODE_LASTP = 2,
41};
42
43/* Exposure Methods */
44#define V4L2_CID_PHOTOMETRY (V4L2_CID_CAMERA_CLASS_BASE+19)
45enum v4l2_photometry_mode {
46 V4L2_PHOTOMETRY_MULTISEG = 0, /*Multi Segment*/
47 V4L2_PHOTOMETRY_CWA = 1, /*Centre Weighted Average*/
48 V4L2_PHOTOMETRY_SPOT = 2,
49 V4L2_PHOTOMETRY_AFSPOT = 3, /*Spot metering on focused point*/
50 V4L2_PHOTOMETRY_LASTP = V4L2_PHOTOMETRY_AFSPOT,
51};
52
53/* Manual exposure control items menu type: iris, shutter, iso */
54#define V4L2_CID_CAM_APERTURE (V4L2_CID_CAMERA_CLASS_BASE+20)
55#define V4L2_CID_CAM_SHUTTER (V4L2_CID_CAMERA_CLASS_BASE+21)
56#define V4L2_CID_CAM_ISO (V4L2_CID_CAMERA_CLASS_BASE+22)
57
58/* Following CIDs are menu type */
59#define V4L2_CID_SCENEMODE (V4L2_CID_CAMERA_CLASS_BASE+23)
60#define V4L2_CID_CAM_STABILIZE (V4L2_CID_CAMERA_CLASS_BASE+24)
61#define V4L2_CID_CAM_MULTISHOT (V4L2_CID_CAMERA_CLASS_BASE+25)
62
63/* Control dynamic range */
64#define V4L2_CID_CAM_DR (V4L2_CID_CAMERA_CLASS_BASE+26)
65
66/* White balance preset control */
67#define V4L2_CID_WHITE_BALANCE_PRESET (V4L2_CID_CAMERA_CLASS_BASE+27)
68#define V4L2_CID_CAM_SENSOR_FW_VER (V4L2_CID_CAMERA_CLASS_BASE + 28)
69#define V4L2_CID_CAM_PHONE_FW_VER (V4L2_CID_CAMERA_CLASS_BASE + 29)
70
71/* CID extensions */
72#define V4L2_CID_ROTATION (V4L2_CID_PRIVATE_BASE + 0)
73#define V4L2_CID_PADDR_Y (V4L2_CID_PRIVATE_BASE + 1)
74#define V4L2_CID_PADDR_CB (V4L2_CID_PRIVATE_BASE + 2)
75#define V4L2_CID_PADDR_CR (V4L2_CID_PRIVATE_BASE + 3)
76#define V4L2_CID_PADDR_CBCR (V4L2_CID_PRIVATE_BASE + 4)
77#define V4L2_CID_OVERLAY_AUTO (V4L2_CID_PRIVATE_BASE + 5)
78#define V4L2_CID_OVERLAY_VADDR0 (V4L2_CID_PRIVATE_BASE + 6)
79#define V4L2_CID_OVERLAY_VADDR1 (V4L2_CID_PRIVATE_BASE + 7)
80#define V4L2_CID_OVERLAY_VADDR2 (V4L2_CID_PRIVATE_BASE + 8)
81#define V4L2_CID_OVLY_MODE (V4L2_CID_PRIVATE_BASE + 9)
82#define V4L2_CID_DST_INFO (V4L2_CID_PRIVATE_BASE + 10)
83/* UMP secure id control */
84#define V4L2_CID_GET_UMP_SECURE_ID (V4L2_CID_PRIVATE_BASE + 11)
85#define V4L2_CID_GET_PHY_SRC_YADDR (V4L2_CID_PRIVATE_BASE + 12)
86#define V4L2_CID_GET_PHY_SRC_CADDR (V4L2_CID_PRIVATE_BASE + 13)
87#define V4L2_CID_IMAGE_EFFECT_FN (V4L2_CID_PRIVATE_BASE + 16)
88#define V4L2_CID_IMAGE_EFFECT_APPLY (V4L2_CID_PRIVATE_BASE + 17)
89#define V4L2_CID_IMAGE_EFFECT_CB (V4L2_CID_PRIVATE_BASE + 18)
90#define V4L2_CID_IMAGE_EFFECT_CR (V4L2_CID_PRIVATE_BASE + 19)
91#define V4L2_CID_RESERVED_MEM_BASE_ADDR (V4L2_CID_PRIVATE_BASE + 20)
92#define V4L2_CID_FIMC_VERSION (V4L2_CID_PRIVATE_BASE + 21)
93
94#define V4L2_CID_STREAM_PAUSE (V4L2_CID_PRIVATE_BASE + 53)
95
96/* CID Extensions for camera sensor operations */
97#define V4L2_CID_CAM_PREVIEW_ONOFF (V4L2_CID_PRIVATE_BASE + 64)
98#define V4L2_CID_CAM_CAPTURE (V4L2_CID_PRIVATE_BASE + 65)
99//#define V4L2_CID_CAM_JPEG_MEMSIZE (V4L2_CID_PRIVATE_BASE + 66)
100
101#define V4L2_CID_CAM_DATE_INFO_YEAR (V4L2_CID_PRIVATE_BASE + 14)
102#define V4L2_CID_CAM_DATE_INFO_MONTH (V4L2_CID_PRIVATE_BASE + 15)
103#define V4L2_CID_CAM_DATE_INFO_DATE (V4L2_CID_PRIVATE_BASE + 22)
104#define V4L2_CID_CAM_SENSOR_VER (V4L2_CID_PRIVATE_BASE + 23)
105#define V4L2_CID_CAM_FW_MINOR_VER (V4L2_CID_PRIVATE_BASE + 24)
106#define V4L2_CID_CAM_FW_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 25)
107#define V4L2_CID_CAM_PRM_MINOR_VER (V4L2_CID_PRIVATE_BASE + 26)
108#define V4L2_CID_CAM_PRM_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 27)
109#define V4L2_CID_CAM_FW_VER (V4L2_CID_PRIVATE_BASE + 28)
110#define V4L2_CID_CAM_SET_FW_ADDR (V4L2_CID_PRIVATE_BASE + 29)
111#define V4L2_CID_CAM_SET_FW_SIZE (V4L2_CID_PRIVATE_BASE + 30)
112#define V4L2_CID_CAM_UPDATE_FW (V4L2_CID_PRIVATE_BASE + 31)
113enum v4l2_firmware_mode {
114 FW_MODE_UPDATE,
115 FW_MODE_VERSION,
116 FW_MODE_DUMP,
117};
118
119#define V4L2_CID_CAM_JPEG_MAIN_SIZE (V4L2_CID_PRIVATE_BASE + 32)
120#define V4L2_CID_CAM_JPEG_MAIN_OFFSET (V4L2_CID_PRIVATE_BASE + 33)
121#define V4L2_CID_CAM_JPEG_THUMB_SIZE (V4L2_CID_PRIVATE_BASE + 34)
122#define V4L2_CID_CAM_JPEG_THUMB_OFFSET (V4L2_CID_PRIVATE_BASE + 35)
123#define V4L2_CID_CAM_JPEG_POSTVIEW_OFFSET (V4L2_CID_PRIVATE_BASE + 36)
124#define V4L2_CID_CAM_JPEG_QUALITY (V4L2_CID_PRIVATE_BASE + 37)
125#define V4L2_CID_CAM_SENSOR_MAKER (V4L2_CID_PRIVATE_BASE + 38)
126#define V4L2_CID_CAM_SENSOR_OPTICAL (V4L2_CID_PRIVATE_BASE + 39)
127#define V4L2_CID_CAM_AF_VER_LOW (V4L2_CID_PRIVATE_BASE + 40)
128#define V4L2_CID_CAM_AF_VER_HIGH (V4L2_CID_PRIVATE_BASE + 41)
129#define V4L2_CID_CAM_GAMMA_RG_LOW (V4L2_CID_PRIVATE_BASE + 42)
130#define V4L2_CID_CAM_GAMMA_RG_HIGH (V4L2_CID_PRIVATE_BASE + 43)
131#define V4L2_CID_CAM_GAMMA_BG_LOW (V4L2_CID_PRIVATE_BASE + 44)
132#define V4L2_CID_CAM_GAMMA_BG_HIGH (V4L2_CID_PRIVATE_BASE + 45)
133#define V4L2_CID_CAM_DUMP_FW (V4L2_CID_PRIVATE_BASE + 46)
134#define V4L2_CID_CAM_GET_DUMP_SIZE (V4L2_CID_PRIVATE_BASE + 47)
135#define V4L2_CID_CAMERA_VT_MODE (V4L2_CID_PRIVATE_BASE + 48)
136#define V4L2_CID_CAMERA_VGA_BLUR (V4L2_CID_PRIVATE_BASE + 49)
137#define V4L2_CID_CAMERA_CAPTURE (V4L2_CID_PRIVATE_BASE + 50)
138#define V4L2_CID_CAMERA_HDR (V4L2_CID_PRIVATE_BASE + 51)
139
140#define V4L2_CID_MAIN_SW_DATE_INFO_YEAR (V4L2_CID_PRIVATE_BASE + 54)
141#define V4L2_CID_MAIN_SW_DATE_INFO_MONTH (V4L2_CID_PRIVATE_BASE + 55)
142#define V4L2_CID_MAIN_SW_DATE_INFO_DATE (V4L2_CID_PRIVATE_BASE + 56)
143#define V4L2_CID_MAIN_SW_FW_MINOR_VER (V4L2_CID_PRIVATE_BASE + 57)
144#define V4L2_CID_MAIN_SW_FW_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 58)
145#define V4L2_CID_MAIN_SW_PRM_MINOR_VER (V4L2_CID_PRIVATE_BASE + 59)
146#define V4L2_CID_MAIN_SW_PRM_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 60)
147
148#define V4L2_CID_FIMC_IS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x1000)
149#define V4L2_CID_FIMC_IS_TUNE_BASE (V4L2_CTRL_CLASS_CAMERA | 0x2000)
150
151#define V4L2_CID_IS_LOAD_FW (V4L2_CID_FIMC_IS_BASE + 10)
152#define V4L2_CID_IS_INIT_PARAM (V4L2_CID_FIMC_IS_BASE + 11)
153#define V4L2_CID_IS_RESET (V4L2_CID_FIMC_IS_BASE + 12)
154#define V4L2_CID_IS_S_POWER (V4L2_CID_FIMC_IS_BASE + 13)
155enum is_set_power {
156 IS_POWER_OFF,
157 IS_POWER_ON
158};
159
160#define V4L2_CID_IS_S_STREAM (V4L2_CID_FIMC_IS_BASE + 14)
161enum is_set_stream {
162 IS_DISABLE_STREAM,
163 IS_ENABLE_STREAM
164};
165
166#define V4L2_CID_IS_S_SCENARIO_MODE (V4L2_CID_FIMC_IS_BASE + 15)
167#define V4L2_CID_IS_S_FORMAT_SCENARIO (V4L2_CID_FIMC_IS_BASE + 16)
168enum scenario_mode {
169 IS_MODE_PREVIEW_STILL,
170 IS_MODE_PREVIEW_VIDEO,
171 IS_MODE_CAPTURE_STILL,
172 IS_MODE_CAPTURE_VIDEO,
173 IS_MODE_MAX
174};
175
176/* global */
177#define V4L2_CID_IS_CAMERA_SHOT_MODE_NORMAL (V4L2_CID_FIMC_IS_BASE + 101)
178/* value : 1 : single shot , >=2 : continuous shot */
179
180#define V4L2_CID_IS_CAMERA_SENSOR_NUM (V4L2_CID_FIMC_IS_BASE + 201)
181
182#define V4L2_CID_IS_CAMERA_FOCUS_MODE (V4L2_CID_FIMC_IS_BASE + 401)
183enum is_focus_mode {
184 IS_FOCUS_MODE_AUTO,
185 IS_FOCUS_MODE_MACRO,
186 IS_FOCUS_MODE_INFINITY,
187 IS_FOCUS_MODE_CONTINUOUS,
188 IS_FOCUS_MODE_TOUCH,
189 IS_FOCUS_MODE_FACEDETECT,
190 IS_FOCUS_MODE_IDLE,
191 IS_FOCUS_MODE_MAX,
192};
193
194#define V4L2_CID_IS_CAMERA_FLASH_MODE (V4L2_CID_FIMC_IS_BASE + 402)
195enum is_flash_mode {
196 IS_FLASH_MODE_OFF,
197 IS_FLASH_MODE_AUTO,
198 IS_FLASH_MODE_AUTO_REDEYE,
199 IS_FLASH_MODE_ON,
200 IS_FLASH_MODE_TORCH,
201 IS_FLASH_MODE_MAX
202};
203
204#define V4L2_CID_IS_CAMERA_AWB_MODE (V4L2_CID_FIMC_IS_BASE + 403)
205enum is_awb_mode {
206 IS_AWB_AUTO,
207 IS_AWB_DAYLIGHT,
208 IS_AWB_CLOUDY,
209 IS_AWB_TUNGSTEN,
210 IS_AWB_FLUORESCENT,
211 IS_AWB_MAX
212};
213
214#define V4L2_CID_IS_CAMERA_IMAGE_EFFECT (V4L2_CID_FIMC_IS_BASE + 404)
215enum is_image_effect {
216 IS_IMAGE_EFFECT_DISABLE,
217 IS_IMAGE_EFFECT_MONOCHROME,
218 IS_IMAGE_EFFECT_NEGATIVE_MONO,
219 IS_IMAGE_EFFECT_NEGATIVE_COLOR,
220 IS_IMAGE_EFFECT_SEPIA,
221 IS_IMAGE_EFFECT_SEPIA_CB,
222 IS_IMAGE_EFFECT_SEPIA_CR,
223 IS_IMAGE_EFFECT_NEGATIVE,
224 IS_IMAGE_EFFECT_ARTFREEZE,
225 IS_IMAGE_EFFECT_EMBOSSING,
226 IS_IMAGE_EFFECT_SILHOUETTE,
227 IS_IMAGE_EFFECT_MAX
228};
229
230#define V4L2_CID_IS_CAMERA_ISO (V4L2_CID_FIMC_IS_BASE + 405)
231enum is_iso {
232 IS_ISO_AUTO,
233 IS_ISO_50,
234 IS_ISO_100,
235 IS_ISO_200,
236 IS_ISO_400,
237 IS_ISO_800,
238 IS_ISO_1600,
239 IS_ISO_MAX
240};
241
242#define V4L2_CID_IS_CAMERA_CONTRAST (V4L2_CID_FIMC_IS_BASE + 406)
243enum is_contrast {
244 IS_CONTRAST_AUTO,
245 IS_CONTRAST_MINUS_2,
246 IS_CONTRAST_MINUS_1,
247 IS_CONTRAST_DEFAULT,
248 IS_CONTRAST_PLUS_1,
249 IS_CONTRAST_PLUS_2,
250 IS_CONTRAST_MAX
251};
252
253#define V4L2_CID_IS_CAMERA_SATURATION (V4L2_CID_FIMC_IS_BASE + 407)
254enum is_saturation {
255 IS_SATURATION_MINUS_2,
256 IS_SATURATION_MINUS_1,
257 IS_SATURATION_DEFAULT,
258 IS_SATURATION_PLUS_1,
259 IS_SATURATION_PLUS_2,
260 IS_SATURATION_MAX
261};
262
263#define V4L2_CID_IS_CAMERA_SHARPNESS (V4L2_CID_FIMC_IS_BASE + 408)
264enum is_sharpness {
265 IS_SHARPNESS_MINUS_2,
266 IS_SHARPNESS_MINUS_1,
267 IS_SHARPNESS_DEFAULT,
268 IS_SHARPNESS_PLUS_1,
269 IS_SHARPNESS_PLUS_2,
270 IS_SHARPNESS_MAX
271};
272
273#define V4L2_CID_IS_CAMERA_EXPOSURE (V4L2_CID_FIMC_IS_BASE + 409)
274enum is_exposure {
275 IS_EXPOSURE_MINUS_4,
276 IS_EXPOSURE_MINUS_3,
277 IS_EXPOSURE_MINUS_2,
278 IS_EXPOSURE_MINUS_1,
279 IS_EXPOSURE_DEFAULT,
280 IS_EXPOSURE_PLUS_1,
281 IS_EXPOSURE_PLUS_2,
282 IS_EXPOSURE_PLUS_3,
283 IS_EXPOSURE_PLUS_4,
284 IS_EXPOSURE_MAX
285};
286
287#define V4L2_CID_IS_CAMERA_BRIGHTNESS (V4L2_CID_FIMC_IS_BASE + 410)
288enum is_brightness {
289 IS_BRIGHTNESS_MINUS_2,
290 IS_BRIGHTNESS_MINUS_1,
291 IS_BRIGHTNESS_DEFAULT,
292 IS_BRIGHTNESS_PLUS_1,
293 IS_BRIGHTNESS_PLUS_2,
294 IS_BRIGHTNESS_MAX
295};
296
297#define V4L2_CID_IS_CAMERA_HUE (V4L2_CID_FIMC_IS_BASE + 411)
298enum is_hue {
299 IS_HUE_MINUS_2,
300 IS_HUE_MINUS_1,
301 IS_HUE_DEFAULT,
302 IS_HUE_PLUS_1,
303 IS_HUE_PLUS_2,
304 IS_HUE_MAX
305};
306
307#define V4L2_CID_IS_CAMERA_METERING (V4L2_CID_FIMC_IS_BASE + 412)
308enum is_metering {
309 IS_METERING_AVERAGE,
310 IS_METERING_SPOT,
311 IS_METERING_MATRIX,
312 IS_METERING_CENTER,
313 IS_METERING_MAX
314};
315#define V4L2_CID_IS_CAMERA_METERING_POSITION_X (V4L2_CID_FIMC_IS_BASE + 500)
316#define V4L2_CID_IS_CAMERA_METERING_POSITION_Y (V4L2_CID_FIMC_IS_BASE + 501)
317#define V4L2_CID_IS_CAMERA_METERING_WINDOW_X (V4L2_CID_FIMC_IS_BASE + 502)
318#define V4L2_CID_IS_CAMERA_METERING_WINDOW_Y (V4L2_CID_FIMC_IS_BASE + 503)
319
320#define V4L2_CID_IS_CAMERA_AFC_MODE (V4L2_CID_FIMC_IS_BASE + 413)
321enum is_afc_mode {
322 IS_AFC_DISABLE,
323 IS_AFC_AUTO,
324 IS_AFC_MANUAL_50HZ,
325 IS_AFC_MANUAL_60HZ,
326 IS_AFC_MAX
327};
328
329#define V4L2_CID_IS_AWB_LOCK_UNLOCK (V4L2_CID_FIMC_IS_BASE + 496)
330enum is_awb_lock_unlock {
331 IS_AWB_LOCK,
332 IS_AWB_UNLOCK,
333 IS_AWB_LOCK_UNLOCK_MAX
334};
335
336#define V4L2_CID_IS_AE_LOCK_UNLOCK (V4L2_CID_FIMC_IS_BASE + 497)
337enum is_ae_lock_unlock {
338 IS_AE_LOCK,
339 IS_AE_UNLOCK,
340 IS_AE_LOCK_UNLOCK_MAX
341};
342
343#define V4L2_CID_IS_FD_GET_FACE_COUNT (V4L2_CID_FIMC_IS_BASE + 600)
344#define V4L2_CID_IS_FD_GET_FACE_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 601)
345#define V4L2_CID_IS_FD_GET_FACE_CONFIDENCE (V4L2_CID_FIMC_IS_BASE + 602)
346#define V4L2_CID_IS_FD_GET_FACE_SMILE_LEVEL (V4L2_CID_FIMC_IS_BASE + 603)
347#define V4L2_CID_IS_FD_GET_FACE_BLINK_LEVEL (V4L2_CID_FIMC_IS_BASE + 604)
348#define V4L2_CID_IS_FD_GET_FACE_TOPLEFT_X (V4L2_CID_FIMC_IS_BASE + 605)
349#define V4L2_CID_IS_FD_GET_FACE_TOPLEFT_Y (V4L2_CID_FIMC_IS_BASE + 606)
350#define V4L2_CID_IS_FD_GET_FACE_BOTTOMRIGHT_X (V4L2_CID_FIMC_IS_BASE + 607)
351#define V4L2_CID_IS_FD_GET_FACE_BOTTOMRIGHT_Y (V4L2_CID_FIMC_IS_BASE + 608)
352#define V4L2_CID_IS_FD_GET_LEFT_EYE_TOPLEFT_X (V4L2_CID_FIMC_IS_BASE + 609)
353#define V4L2_CID_IS_FD_GET_LEFT_EYE_TOPLEFT_Y (V4L2_CID_FIMC_IS_BASE + 610)
354#define V4L2_CID_IS_FD_GET_LEFT_EYE_BOTTOMRIGHT_X (V4L2_CID_FIMC_IS_BASE + 611)
355#define V4L2_CID_IS_FD_GET_LEFT_EYE_BOTTOMRIGHT_Y (V4L2_CID_FIMC_IS_BASE + 612)
356#define V4L2_CID_IS_FD_GET_RIGHT_EYE_TOPLEFT_X (V4L2_CID_FIMC_IS_BASE + 613)
357#define V4L2_CID_IS_FD_GET_RIGHT_EYE_TOPLEFT_Y (V4L2_CID_FIMC_IS_BASE + 614)
358#define V4L2_CID_IS_FD_GET_RIGHT_EYE_BOTTOMRIGHT_X (V4L2_CID_FIMC_IS_BASE + 615)
359#define V4L2_CID_IS_FD_GET_RIGHT_EYE_BOTTOMRIGHT_Y (V4L2_CID_FIMC_IS_BASE + 616)
360#define V4L2_CID_IS_FD_GET_MOUTH_TOPLEFT_X (V4L2_CID_FIMC_IS_BASE + 617)
361#define V4L2_CID_IS_FD_GET_MOUTH_TOPLEFT_Y (V4L2_CID_FIMC_IS_BASE + 618)
362#define V4L2_CID_IS_FD_GET_MOUTH_BOTTOMRIGHT_X (V4L2_CID_FIMC_IS_BASE + 619)
363#define V4L2_CID_IS_FD_GET_MOUTH_BOTTOMRIGHT_Y (V4L2_CID_FIMC_IS_BASE + 620)
364#define V4L2_CID_IS_FD_GET_ANGLE (V4L2_CID_FIMC_IS_BASE + 621)
365#define V4L2_CID_IS_FD_GET_YAW_ANGLE (V4L2_CID_FIMC_IS_BASE + 622)
366#define V4L2_CID_IS_FD_GET_NEXT (V4L2_CID_FIMC_IS_BASE + 623)
367#define V4L2_CID_IS_FD_GET_DATA (V4L2_CID_FIMC_IS_BASE + 624)
368
369#define V4L2_CID_IS_FD_SET_MAX_FACE_NUMBER (V4L2_CID_FIMC_IS_BASE + 650)
370#define V4L2_CID_IS_FD_SET_ROLL_ANGLE (V4L2_CID_FIMC_IS_BASE + 651)
371enum is_fd_roll_angle {
372 /* 0, 45, 0, -45 */
373 IS_FD_ROLL_ANGLE_BASIC = 0,
374 /* 0, 30, 0, -30, 0, 45, 0, -45 */
375 IS_FD_ROLL_ANGLE_PRECISE_BASIC = 1,
376 /* 0, 90, 0, -90 */
377 IS_FD_ROLL_ANGLE_SIDES = 2,
378 /* 0, 90, 0, -90 0, 45, 0, -45 */
379 IS_FD_ROLL_ANGLE_PRECISE_SIDES = 3,
380 /* 0, 90, 0, -90, 0, 180 */
381 IS_FD_ROLL_ANGLE_FULL = 4,
382 /* 0, 90, 0, -90, 0, 180, 0, 135, 0, -135 */
383 IS_FD_ROLL_ANGLE_PRECISE_FULL = 5,
384};
385
386#define V4L2_CID_IS_FD_SET_YAW_ANGLE (V4L2_CID_FIMC_IS_BASE + 652)
387enum is_fd_yaw_angle {
388 IS_FD_YAW_ANGLE_0 = 0,
389 IS_FD_YAW_ANGLE_45 = 1,
390 IS_FD_YAW_ANGLE_90 = 2,
391 IS_FD_YAW_ANGLE_45_90 = 3,
392};
393
394#define V4L2_CID_IS_FD_SET_SMILE_MODE (V4L2_CID_FIMC_IS_BASE + 653)
395enum is_fd_smile_mode {
396 IS_FD_SMILE_MODE_DISABLE = 0,
397 IS_FD_SMILE_MODE_ENABLE = 1,
398};
399
400#define V4L2_CID_IS_FD_SET_BLINK_MODE (V4L2_CID_FIMC_IS_BASE + 654)
401enum is_fd_blink_mode {
402 IS_FD_BLINK_MODE_DISABLE = 0,
403 IS_FD_BLINK_MODE_ENABLE = 1,
404};
405
406#define V4L2_CID_IS_FD_SET_EYE_DETECT_MODE (V4L2_CID_FIMC_IS_BASE + 655)
407enum is_fd_eye_detect_mode {
408 IS_FD_EYE_DETECT_DISABLE = 0,
409 IS_FD_EYE_DETECT_ENABLE = 1,
410};
411
412#define V4L2_CID_IS_FD_SET_MOUTH_DETECT_MODE (V4L2_CID_FIMC_IS_BASE + 656)
413enum is_fd_mouth_detect_mode {
414 IS_FD_MOUTH_DETECT_DISABLE = 0,
415 IS_FD_MOUTH_DETECT_ENABLE = 1,
416};
417
418#define V4L2_CID_IS_FD_SET_ORIENTATION_MODE (V4L2_CID_FIMC_IS_BASE + 657)
419enum is_fd_orientation_mode {
420 IS_FD_ORIENTATION_DISABLE = 0,
421 IS_FD_ORIENTATION_ENABLE = 1,
422};
423
424#define V4L2_CID_IS_FD_SET_ORIENTATION (V4L2_CID_FIMC_IS_BASE + 658)
425#define V4L2_CID_IS_FD_SET_DATA_ADDRESS (V4L2_CID_FIMC_IS_BASE + 659)
426
427#define V4L2_CID_IS_SET_ISP (V4L2_CID_FIMC_IS_BASE + 440)
428enum is_isp_bypass_mode {
429 IS_ISP_BYPASS_DISABLE,
430 IS_ISP_BYPASS_ENABLE,
431 IS_ISP_BYPASS_MAX
432};
433
434#define V4L2_CID_IS_SET_DRC (V4L2_CID_FIMC_IS_BASE + 441)
435enum is_drc_bypass_mode {
436 IS_DRC_BYPASS_DISABLE,
437 IS_DRC_BYPASS_ENABLE,
438 IS_DRC_BYPASS_MAX
439};
440
441#define V4L2_CID_IS_SET_FD (V4L2_CID_FIMC_IS_BASE + 442)
442enum is_fd_bypass_mode {
443 IS_FD_BYPASS_DISABLE,
444 IS_FD_BYPASS_ENABLE,
445 IS_FD_BYPASS_MAX
446};
447
448#define V4L2_CID_IS_SET_ODC (V4L2_CID_FIMC_IS_BASE + 443)
449enum is_odc_bypass_mode {
450 IS_ODC_BYPASS_DISABLE,
451 IS_ODC_BYPASS_ENABLE,
452 IS_ODC_BYPASS_MAX
453};
454
455#define V4L2_CID_IS_SET_DIS (V4L2_CID_FIMC_IS_BASE + 444)
456enum is_dis_bypass_mode {
457 IS_DIS_BYPASS_DISABLE,
458 IS_DIS_BYPASS_ENABLE,
459 IS_DIS_BYPASS_MAX
460};
461
462#define V4L2_CID_IS_SET_3DNR (V4L2_CID_FIMC_IS_BASE + 445)
463enum is_tdnr_bypass_mode {
464 IS_TDNR_BYPASS_DISABLE,
465 IS_TDNR_BYPASS_ENABLE,
466 IS_TDNR_BYPASS_MAX
467};
468
469#define V4L2_CID_IS_SET_SCALERC (V4L2_CID_FIMC_IS_BASE + 446)
470enum is_scalerc_bypass_mode {
471 IS_SCALERC_BYPASS_DISABLE,
472 IS_SCALERC_BYPASS_ENABLE,
473 IS_SCALERC_BYPASS_MAX
474};
475
476#define V4L2_CID_IS_SET_SCALERP (V4L2_CID_FIMC_IS_BASE + 446)
477enum is_scalerp_bypass_mode {
478 IS_SCALERP_BYPASS_DISABLE,
479 IS_SCALERP_BYPASS_ENABLE,
480 IS_SCALERP_BYPASS_MAX
481};
482
483#define V4L2_CID_IS_ROTATION_MODE (V4L2_CID_FIMC_IS_BASE + 450)
484enum is_rotation_mode {
485 IS_ROTATION_0,
486 IS_ROTATION_90,
487 IS_ROTATION_180,
488 IS_ROTATION_270,
489 IS_ROTATION_MAX
490};
491
492#define V4L2_CID_IS_3DNR_1ST_FRAME_MODE (V4L2_CID_FIMC_IS_BASE + 451)
493enum is_tdnr_1st_frame_mode {
494 IS_TDNR_1ST_FRAME_NOPROCESSING,
495 IS_TDNR_1ST_FRAME_2DNR,
496 IS_TDNR_MAX
497};
498
499#define V4L2_CID_IS_CAMERA_OBJECT_POSITION_X (V4L2_CID_FIMC_IS_BASE + 452)
500#define V4L2_CID_IS_CAMERA_OBJECT_POSITION_Y (V4L2_CID_FIMC_IS_BASE + 453)
501#define V4L2_CID_IS_CAMERA_WINDOW_SIZE_X (V4L2_CID_FIMC_IS_BASE + 454)
502#define V4L2_CID_IS_CAMERA_WINDOW_SIZE_Y (V4L2_CID_FIMC_IS_BASE + 455)
503
504#define V4L2_CID_IS_CAMERA_EXIF_EXPTIME (V4L2_CID_FIMC_IS_BASE + 456)
505#define V4L2_CID_IS_CAMERA_EXIF_FLASH (V4L2_CID_FIMC_IS_BASE + 457)
506#define V4L2_CID_IS_CAMERA_EXIF_ISO (V4L2_CID_FIMC_IS_BASE + 458)
507#define V4L2_CID_IS_CAMERA_EXIF_SHUTTERSPEED (V4L2_CID_FIMC_IS_BASE + 459)
508#define V4L2_CID_IS_CAMERA_EXIF_BRIGHTNESS (V4L2_CID_FIMC_IS_BASE + 460)
509
510#define V4L2_CID_IS_CAMERA_ISP_SEL_INPUT (V4L2_CID_FIMC_IS_BASE + 461)
511enum is_isp_sel_input {
512 IS_ISP_INPUT_OTF,
513 IS_ISP_INPUT_DMA1,
514 IS_ISP_INPUT_DMA2,
515 IS_ISP_INPUT_DMA12,
516 IS_ISP_INPUT_MAX
517};
518
519#define V4L2_CID_IS_CAMERA_ISP_SEL_OUTPUT (V4L2_CID_FIMC_IS_BASE + 462)
520enum is_isp_sel_output {
521 IS_ISP_OUTPUT_OTF,
522 IS_ISP_OUTPUT_DMA1,
523 IS_ISP_OUTPUT_DMA2,
524 IS_ISP_OUTPUT_DMA12,
525 IS_ISP_OUTPUT_OTF_DMA1,
526 IS_ISP_OUTPUT_OTF_DMA2,
527 IS_ISP_OUTPUT_OTF_DMA12,
528 IS_ISP_OUTPUT_MAX
529};
530
531#define V4L2_CID_IS_CAMERA_DRC_SEL_INPUT (V4L2_CID_FIMC_IS_BASE + 463)
532enum is_drc_sel_input {
533 IS_DRC_INPUT_OTF,
534 IS_DRC_INPUT_DMA,
535 IS_DRC_INPUT_MAX
536};
537
538#define V4L2_CID_IS_CAMERA_FD_SEL_INPUT (V4L2_CID_FIMC_IS_BASE + 464)
539enum is_fd_sel_input {
540 IS_FD_INPUT_OTF,
541 IS_FD_INPUT_DMA,
542 IS_FD_INPUT_MAX
543};
544
545#define V4L2_CID_IS_CAMERA_INIT_WIDTH (V4L2_CID_FIMC_IS_BASE + 465)
546#define V4L2_CID_IS_CAMERA_INIT_HEIGHT (V4L2_CID_FIMC_IS_BASE + 466)
547
548#define V4L2_CID_IS_CMD_ISP (V4L2_CID_FIMC_IS_BASE + 467)
549enum is_isp_cmd_mode {
550 IS_ISP_COMMAND_STOP,
551 IS_ISP_COMMAND_START,
552 IS_ISP_COMMAND_MAX
553};
554
555#define V4L2_CID_IS_CMD_DRC (V4L2_CID_FIMC_IS_BASE + 468)
556enum is_drc_cmd_mode {
557 IS_DRC_COMMAND_STOP,
558 IS_DRC_COMMAND_START,
559 IS_DRC_COMMAND_MAX
560};
561
562#define V4L2_CID_IS_CMD_FD (V4L2_CID_FIMC_IS_BASE + 469)
563enum is_fd_cmd_mode {
564 IS_FD_COMMAND_STOP,
565 IS_FD_COMMAND_START,
566 IS_FD_COMMAND_MAX
567};
568
569#define V4L2_CID_IS_CMD_ODC (V4L2_CID_FIMC_IS_BASE + 470)
570enum is_odc_cmd_mode {
571 IS_ODC_COMMAND_STOP,
572 IS_ODC_COMMAND_START,
573 IS_ODC_COMMAND_MAX
574};
575
576#define V4L2_CID_IS_CMD_DIS (V4L2_CID_FIMC_IS_BASE + 471)
577enum is_dis_cmd_mode {
578 IS_DIS_COMMAND_STOP,
579 IS_DIS_COMMAND_START,
580 IS_DIS_COMMAND_MAX
581};
582
583#define V4L2_CID_IS_CMD_TDNR (V4L2_CID_FIMC_IS_BASE + 472)
584enum is_tdnr_cmd_mode {
585 IS_TDNR_COMMAND_STOP,
586 IS_TDNR_COMMAND_START,
587 IS_TDNR_COMMAND_MAX
588};
589
590#define V4L2_CID_IS_CMD_SCALERC (V4L2_CID_FIMC_IS_BASE + 473)
591enum is_scalerc_cmd_mode {
592 IS_SCALERC_COMMAND_STOP,
593 IS_SCALERC_COMMAND_START,
594 IS_SCALERC_COMMAND_MAX
595};
596
597#define V4L2_CID_IS_CMD_SCALERP (V4L2_CID_FIMC_IS_BASE + 474)
598enum is_scalerp_cmd_mode {
599 IS_SCALERP_COMMAND_STOP,
600 IS_SCALERP_COMMAND_START,
601 IS_SCALERP_COMMAND_MAX
602};
603
604#define V4L2_CID_IS_GET_SENSOR_OFFSET_X (V4L2_CID_FIMC_IS_BASE + 480)
605#define V4L2_CID_IS_GET_SENSOR_OFFSET_Y (V4L2_CID_FIMC_IS_BASE + 481)
606#define V4L2_CID_IS_GET_SENSOR_WIDTH (V4L2_CID_FIMC_IS_BASE + 482)
607#define V4L2_CID_IS_GET_SENSOR_HEIGHT (V4L2_CID_FIMC_IS_BASE + 483)
608
609#define V4L2_CID_IS_GET_FRAME_VALID (V4L2_CID_FIMC_IS_BASE + 484)
610#define V4L2_CID_IS_SET_FRAME_VALID (V4L2_CID_FIMC_IS_BASE + 485)
611#define V4L2_CID_IS_GET_FRAME_BADMARK (V4L2_CID_FIMC_IS_BASE + 486)
612#define V4L2_CID_IS_SET_FRAME_BADMARK (V4L2_CID_FIMC_IS_BASE + 487)
613#define V4L2_CID_IS_GET_FRAME_CAPTURED (V4L2_CID_FIMC_IS_BASE + 488)
614#define V4L2_CID_IS_SET_FRAME_CAPTURED (V4L2_CID_FIMC_IS_BASE + 489)
615#define V4L2_CID_IS_SET_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 490)
616#define V4L2_CID_IS_GET_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 491)
617#define V4L2_CID_IS_CLEAR_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 492)
618#define V4L2_CID_IS_GET_LOSTED_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 493)
619#define V4L2_CID_IS_ISP_DMA_BUFFER_NUM (V4L2_CID_FIMC_IS_BASE + 494)
620#define V4L2_CID_IS_ISP_DMA_BUFFER_ADDRESS (V4L2_CID_FIMC_IS_BASE + 495)
621
622#define V4L2_CID_IS_ZOOM_STATE (V4L2_CID_FIMC_IS_BASE + 660)
623#define V4L2_CID_IS_ZOOM_MAX_LEVEL (V4L2_CID_FIMC_IS_BASE + 661)
624#define V4L2_CID_IS_ZOOM (V4L2_CID_FIMC_IS_BASE + 662)
625#define V4L2_CID_IS_FW_DEBUG_REGION_ADDR (V4L2_CID_FIMC_IS_BASE + 663)
626
627#define V4L2_CID_IS_TUNE_SEL_ENTRY (V4L2_CID_FIMC_IS_TUNE_BASE)
628#define V4L2_CID_IS_TUNE_SENSOR_EXPOSURE (V4L2_CID_FIMC_IS_TUNE_BASE + 1)
629#define V4L2_CID_IS_TUNE_SENSOR_ANALOG_GAIN (V4L2_CID_FIMC_IS_TUNE_BASE + 2)
630#define V4L2_CID_IS_TUNE_SENSOR_FRAME_RATE (V4L2_CID_FIMC_IS_TUNE_BASE + 3)
631#define V4L2_CID_IS_TUNE_SENSOR_ACTUATOR_POS (V4L2_CID_FIMC_IS_TUNE_BASE + 4)
632
633enum v4l2_blur
634{
635 BLUR_LEVEL_0 = 0,
636 BLUR_LEVEL_1,
637 BLUR_LEVEL_2,
638 BLUR_LEVEL_3,
639 BLUR_LEVEL_MAX,
640};
641
642#if 1
643#define V4L2_CID_CAMERA_SCENE_MODE (V4L2_CID_PRIVATE_BASE+70)
644enum v4l2_scene_mode
645{
646 SCENE_MODE_BASE,
647 SCENE_MODE_NONE,
648 SCENE_MODE_PORTRAIT,
649 SCENE_MODE_NIGHTSHOT,
650 SCENE_MODE_BACK_LIGHT,
651 SCENE_MODE_LANDSCAPE,
652 SCENE_MODE_SPORTS,
653 SCENE_MODE_PARTY_INDOOR,
654 SCENE_MODE_BEACH_SNOW,
655 SCENE_MODE_SUNSET,
656 SCENE_MODE_DUSK_DAWN,
657 SCENE_MODE_FALL_COLOR,
658 SCENE_MODE_FIREWORKS,
659 SCENE_MODE_TEXT,
660 SCENE_MODE_CANDLE_LIGHT,
661 SCENE_MODE_MAX,
662};
663
664#define V4L2_CID_CAMERA_FLASH_MODE (V4L2_CID_PRIVATE_BASE+71)
665enum v4l2_flash_mode
666{
667 FLASH_MODE_BASE,
668 FLASH_MODE_OFF,
669 FLASH_MODE_AUTO,
670 FLASH_MODE_ON,
671 FLASH_MODE_TORCH,
672 FLASH_MODE_MAX,
673};
674
675#define V4L2_CID_CAMERA_BRIGHTNESS (V4L2_CID_PRIVATE_BASE+72)
676enum v4l2_ev_mode {
677 EV_MINUS_4 = 0,
678 EV_MINUS_3,
679 EV_MINUS_2,
680 EV_MINUS_1,
681 EV_DEFAULT,
682 EV_PLUS_1,
683 EV_PLUS_2,
684 EV_PLUS_3,
685 EV_PLUS_4,
686 EV_MAX,
687};
688
689#define V4L2_CID_CAMERA_WHITE_BALANCE (V4L2_CID_PRIVATE_BASE+73)
690enum v4l2_wb_mode {
691 WHITE_BALANCE_BASE = 0,
692 WHITE_BALANCE_AUTO,
693 WHITE_BALANCE_SUNNY,
694 WHITE_BALANCE_CLOUDY,
695 WHITE_BALANCE_TUNGSTEN,
696 WHITE_BALANCE_FLUORESCENT,
697 WHITE_BALANCE_MAX,
698};
699
700#define V4L2_CID_CAMERA_EFFECT (V4L2_CID_PRIVATE_BASE+74)
701enum v4l2_effect_mode {
702 IMAGE_EFFECT_BASE = 0,
703 IMAGE_EFFECT_NONE,
704 IMAGE_EFFECT_BNW,
705 IMAGE_EFFECT_SEPIA,
706 IMAGE_EFFECT_AQUA,
707 IMAGE_EFFECT_ANTIQUE,
708 IMAGE_EFFECT_NEGATIVE,
709 IMAGE_EFFECT_SHARPEN,
710 IMAGE_EFFECT_MAX,
711};
712
713#define V4L2_CID_CAMERA_ISO (V4L2_CID_PRIVATE_BASE+75)
714enum v4l2_iso_mode {
715 ISO_AUTO = 0,
716 ISO_50,
717 ISO_100,
718 ISO_200,
719 ISO_400,
720 ISO_800,
721 ISO_1600,
722 ISO_SPORTS,
723 ISO_NIGHT,
724 ISO_MOVIE,
725 ISO_MAX,
726};
727
728#define V4L2_CID_CAMERA_METERING (V4L2_CID_PRIVATE_BASE+76)
729enum v4l2_metering_mode {
730 METERING_BASE = 0,
731 METERING_MATRIX,
732 METERING_CENTER,
733 METERING_SPOT,
734 METERING_MAX,
735};
736
737#define V4L2_CID_CAMERA_CONTRAST (V4L2_CID_PRIVATE_BASE+77)
738enum v4l2_contrast_mode {
739 CONTRAST_MINUS_2 = 0,
740 CONTRAST_MINUS_1,
741 CONTRAST_DEFAULT,
742 CONTRAST_PLUS_1,
743 CONTRAST_PLUS_2,
744 CONTRAST_MAX,
745};
746
747#define V4L2_CID_CAMERA_SATURATION (V4L2_CID_PRIVATE_BASE+78)
748enum v4l2_saturation_mode {
749 SATURATION_MINUS_2 = 0,
750 SATURATION_MINUS_1,
751 SATURATION_DEFAULT,
752 SATURATION_PLUS_1,
753 SATURATION_PLUS_2,
754 SATURATION_MAX,
755};
756
757#define V4L2_CID_CAMERA_SHARPNESS (V4L2_CID_PRIVATE_BASE+79)
758enum v4l2_sharpness_mode {
759 SHARPNESS_MINUS_2 = 0,
760 SHARPNESS_MINUS_1,
761 SHARPNESS_DEFAULT,
762 SHARPNESS_PLUS_1,
763 SHARPNESS_PLUS_2,
764 SHARPNESS_MAX,
765};
766
767#define V4L2_CID_CAMERA_WDR (V4L2_CID_PRIVATE_BASE+80)
768enum v4l2_wdr_mode {
769 WDR_OFF,
770 WDR_ON,
771 WDR_MAX,
772};
773
774#define V4L2_CID_CAMERA_ANTI_SHAKE (V4L2_CID_PRIVATE_BASE+81)
775enum v4l2_anti_shake_mode {
776 ANTI_SHAKE_OFF,
777 ANTI_SHAKE_STILL_ON,
778 ANTI_SHAKE_MOVIE_ON,
779 ANTI_SHAKE_MAX,
780};
781
782#define V4L2_CID_CAMERA_TOUCH_AF_START_STOP (V4L2_CID_PRIVATE_BASE+82)
783enum v4l2_touch_af {
784 TOUCH_AF_STOP = 0,
785 TOUCH_AF_START,
786 TOUCH_AF_MAX,
787};
788
789#define V4L2_CID_CAMERA_SMART_AUTO (V4L2_CID_PRIVATE_BASE+83)
790enum v4l2_smart_auto {
791 SMART_AUTO_OFF = 0,
792 SMART_AUTO_ON,
793 SMART_AUTO_MAX,
794};
795
796#define V4L2_CID_CAMERA_VINTAGE_MODE (V4L2_CID_PRIVATE_BASE+84)
797enum v4l2_vintage_mode {
798 VINTAGE_MODE_BASE,
799 VINTAGE_MODE_OFF,
800 VINTAGE_MODE_NORMAL,
801 VINTAGE_MODE_WARM,
802 VINTAGE_MODE_COOL,
803 VINTAGE_MODE_BNW,
804 VINTAGE_MODE_MAX,
805};
806
807#define V4L2_CID_CAMERA_JPEG_QUALITY (V4L2_CID_PRIVATE_BASE+85)
808#define V4L2_CID_CAMERA_GPS_LATITUDE (V4L2_CID_CAMERA_CLASS_BASE + 30)//(V4L2_CID_PRIVATE_BASE+86)
809#define V4L2_CID_CAMERA_GPS_LONGITUDE (V4L2_CID_CAMERA_CLASS_BASE + 31)//(V4L2_CID_PRIVATE_BASE+87)
810#define V4L2_CID_CAMERA_GPS_TIMESTAMP (V4L2_CID_CAMERA_CLASS_BASE + 32)//(V4L2_CID_PRIVATE_BASE+88)
811#define V4L2_CID_CAMERA_GPS_ALTITUDE (V4L2_CID_CAMERA_CLASS_BASE + 33)//(V4L2_CID_PRIVATE_BASE+89)
812#define V4L2_CID_CAMERA_EXIF_TIME_INFO (V4L2_CID_CAMERA_CLASS_BASE + 34)
813#define V4L2_CID_CAMERA_GPS_PROCESSINGMETHOD (V4L2_CID_CAMERA_CLASS_BASE+35)
814#define V4L2_CID_CAMERA_ZOOM (V4L2_CID_PRIVATE_BASE+90)
815enum v4l2_zoom_level {
816 ZOOM_LEVEL_0 = 0,
817 ZOOM_LEVEL_1,
818 ZOOM_LEVEL_2,
819 ZOOM_LEVEL_3,
820 ZOOM_LEVEL_4,
821 ZOOM_LEVEL_5,
822 ZOOM_LEVEL_6,
823 ZOOM_LEVEL_7,
824 ZOOM_LEVEL_8,
825 ZOOM_LEVEL_9,
826 ZOOM_LEVEL_10,
827 ZOOM_LEVEL_11,
828 ZOOM_LEVEL_12,
829 ZOOM_LEVEL_MAX = 31,
830};
831
832#define V4L2_CID_CAMERA_FACE_DETECTION (V4L2_CID_PRIVATE_BASE+91)
833enum v4l2_face_detection {
834 FACE_DETECTION_OFF = 0,
835 FACE_DETECTION_ON,
836 FACE_DETECTION_NOLINE,
837 FACE_DETECTION_ON_BEAUTY,
838 FACE_DETECTION_MAX,
839};
840
841#define V4L2_CID_CAMERA_SMART_AUTO_STATUS (V4L2_CID_PRIVATE_BASE+92)
842enum v4l2_smart_auto_status {
843 SMART_AUTO_STATUS_AUTO = 0,
844 SMART_AUTO_STATUS_LANDSCAPE,
845 SMART_AUTO_STATUS_PORTRAIT,
846 SMART_AUTO_STATUS_MACRO,
847 SMART_AUTO_STATUS_NIGHT,
848 SMART_AUTO_STATUS_PORTRAIT_NIGHT,
849 SMART_AUTO_STATUS_BACKLIT,
850 SMART_AUTO_STATUS_PORTRAIT_BACKLIT,
851 SMART_AUTO_STATUS_ANTISHAKE,
852 SMART_AUTO_STATUS_PORTRAIT_ANTISHAKE,
853 SMART_AUTO_STATUS_MAX,
854};
855
856#define V4L2_CID_CAMERA_SET_AUTO_FOCUS (V4L2_CID_PRIVATE_BASE+93)
857enum v4l2_auto_focus {
858 AUTO_FOCUS_OFF = 0,
859 AUTO_FOCUS_ON,
860 AUTO_FOCUS_MAX,
861};
862
863#define V4L2_CID_CAMERA_BEAUTY_SHOT (V4L2_CID_PRIVATE_BASE+94)
864enum v4l2_beauty_shot {
865 BEAUTY_SHOT_OFF = 0,
866 BEAUTY_SHOT_ON,
867 BEAUTY_SHOT_MAX,
868};
869
870#define V4L2_CID_CAMERA_AEAWB_LOCK_UNLOCK (V4L2_CID_PRIVATE_BASE+95)
871enum v4l2_ae_awb_lockunlock {
872 AE_UNLOCK_AWB_UNLOCK = 0,
873 AE_LOCK_AWB_UNLOCK,
874 AE_UNLOCK_AWB_LOCK,
875 AE_LOCK_AWB_LOCK,
876 AE_AWB_MAX
877};
878
879#define V4L2_CID_CAMERA_FACEDETECT_LOCKUNLOCK (V4L2_CID_PRIVATE_BASE+96)
880enum v4l2_face_lock {
881 FACE_LOCK_OFF = 0,
882 FACE_LOCK_ON,
883 FIRST_FACE_TRACKING,
884 FACE_LOCK_MAX,
885};
886
887#define V4L2_CID_CAMERA_OBJECT_POSITION_X (V4L2_CID_PRIVATE_BASE+97)
888#define V4L2_CID_CAMERA_OBJECT_POSITION_Y (V4L2_CID_PRIVATE_BASE+98)
889#define V4L2_CID_CAMERA_FOCUS_MODE (V4L2_CID_PRIVATE_BASE+99)
890enum v4l2_focusmode {
891 FOCUS_MODE_AUTO = 0,
892 FOCUS_MODE_MACRO,
893 FOCUS_MODE_FACEDETECT,
894 FOCUS_MODE_INFINITY,
895 FOCUS_MODE_CONTINOUS,
896 FOCUS_MODE_TOUCH,
897 FOCUS_MODE_MAX,
898 FOCUS_MODE_DEFAULT = (1 << 8),
899};
900
901#define V4L2_CID_CAMERA_OBJ_TRACKING_STATUS (V4L2_CID_PRIVATE_BASE+100)
902enum v4l2_obj_tracking_status {
903 OBJECT_TRACKING_STATUS_BASE,
904 OBJECT_TRACKING_STATUS_PROGRESSING,
905 OBJECT_TRACKING_STATUS_SUCCESS,
906 OBJECT_TRACKING_STATUS_FAIL,
907 OBJECT_TRACKING_STATUS_MISSING,
908 OBJECT_TRACKING_STATUS_MAX,
909};
910
911#define V4L2_CID_CAMERA_OBJ_TRACKING_START_STOP (V4L2_CID_PRIVATE_BASE+101)
912enum v4l2_ot_start_stop {
913 OT_STOP = 0,
914 OT_START,
915 OT_MAX,
916};
917
918#define V4L2_CID_CAMERA_CAF_START_STOP (V4L2_CID_PRIVATE_BASE+102)
919enum v4l2_caf_start_stop {
920 CAF_STOP = 0,
921 CAF_START,
922 CAF_MAX,
923};
924
925#define V4L2_CID_CAMERA_AUTO_FOCUS_RESULT (V4L2_CID_PRIVATE_BASE+103)
926#define V4L2_CID_CAMERA_FRAME_RATE (V4L2_CID_PRIVATE_BASE+104)
927enum v4l2_frame_rate {
928 FRAME_RATE_AUTO = 0,
929 FRAME_RATE_7 = 7,
930 FRAME_RATE_15 = 15,
931 FRAME_RATE_20 = 20,
932 FRAME_RATE_30 = 30,
933 FRAME_RATE_60 = 60,
934 FRAME_RATE_120 = 120,
935 FRAME_RATE_MAX
936};
937
938#define V4L2_CID_CAMERA_ANTI_BANDING (V4L2_CID_PRIVATE_BASE+105)
939enum v4l2_anti_banding{
940 ANTI_BANDING_AUTO = 0,
941 ANTI_BANDING_50HZ = 1,
942 ANTI_BANDING_60HZ = 2,
943 ANTI_BANDING_OFF = 3,
944};
945
946#define V4L2_CID_CAMERA_SET_GAMMA (V4L2_CID_PRIVATE_BASE+106)
947enum v4l2_gamma_mode{
948 GAMMA_OFF = 0,
949 GAMMA_ON = 1,
950 GAMMA_MAX,
951};
952
953#define V4L2_CID_CAMERA_SET_SLOW_AE (V4L2_CID_PRIVATE_BASE+107)
954enum v4l2_slow_ae_mode{
955 SLOW_AE_OFF,
956 SLOW_AE_ON,
957 SLOW_AE_MAX,
958};
959
960#define V4L2_CID_CAMERA_BATCH_REFLECTION (V4L2_CID_PRIVATE_BASE+108)
961#define V4L2_CID_CAMERA_EXIF_ORIENTATION (V4L2_CID_PRIVATE_BASE+109)
962
963#define V4L2_CID_CAMERA_RESET (V4L2_CID_PRIVATE_BASE+111) //s1_camera [ Defense process by ESD input ]
964#define V4L2_CID_CAMERA_CHECK_DATALINE (V4L2_CID_PRIVATE_BASE+112)
965#define V4L2_CID_CAMERA_CHECK_DATALINE_STOP (V4L2_CID_PRIVATE_BASE+113)
966
967#endif
968
969#if defined(CONFIG_ARIES_NTT) // Modify NTTS1
970#define V4L2_CID_CAMERA_AE_AWB_DISABLE_LOCK (V4L2_CID_PRIVATE_BASE+114)
971#endif
972#define V4L2_CID_CAMERA_THUMBNAIL_NULL (V4L2_CID_PRIVATE_BASE+115)
973#define V4L2_CID_CAMERA_SENSOR_MODE (V4L2_CID_PRIVATE_BASE+116)
974enum v4l2_sensor_mode {
975 SENSOR_CAMERA,
976 SENSOR_MOVIE,
977};
978
979typedef enum {
980 STREAM_MODE_CAM_OFF,
981 STREAM_MODE_CAM_ON,
982 STREAM_MODE_MOVIE_OFF,
983 STREAM_MODE_MOVIE_ON,
984} stream_mode_t;
985
986#define V4L2_CID_CAMERA_EXIF_EXPTIME (V4L2_CID_PRIVATE_BASE+117)
987#define V4L2_CID_CAMERA_EXIF_FLASH (V4L2_CID_PRIVATE_BASE+118)
988#define V4L2_CID_CAMERA_EXIF_ISO (V4L2_CID_PRIVATE_BASE+119)
989#define V4L2_CID_CAMERA_EXIF_TV (V4L2_CID_PRIVATE_BASE+120)
990#define V4L2_CID_CAMERA_EXIF_BV (V4L2_CID_PRIVATE_BASE+121)
991#define V4L2_CID_CAMERA_EXIF_EBV (V4L2_CID_PRIVATE_BASE+122)
992#define V4L2_CID_CAMERA_CHECK_ESD (V4L2_CID_PRIVATE_BASE+123)
993#define V4L2_CID_CAMERA_APP_CHECK (V4L2_CID_PRIVATE_BASE+124)
994#define V4L2_CID_CAMERA_BUSFREQ_LOCK (V4L2_CID_PRIVATE_BASE+125)
995#define V4L2_CID_CAMERA_BUSFREQ_UNLOCK (V4L2_CID_PRIVATE_BASE+126)
996
997#define V4L2_CID_EMBEDDEDDATA_ENABLE (V4L2_CID_PRIVATE_BASE + 130)
998
999
1000#define V4L2_CID_CAMERA_GET_ISO (V4L2_CID_PRIVATE_BASE+202)
1001#define V4L2_CID_CAMERA_GET_SHT_TIME (V4L2_CID_PRIVATE_BASE+203)
1002#define V4L2_CID_CAMERA_GET_FLASH_ONOFF (V4L2_CID_PRIVATE_BASE+204)
1003#define V4L2_CID_CAMERA_RETURN_FOCUS (V4L2_CID_PRIVATE_BASE+205)
1004#define V4L2_CID_ESD_INT (V4L2_CID_PRIVATE_BASE+206)
1005
1006
1007
1008
1009
1010/* Pixel format FOURCC depth Description */
1011enum v4l2_pix_format_mode {
1012 V4L2_PIX_FMT_MODE_PREVIEW,
1013 V4L2_PIX_FMT_MODE_CAPTURE,
1014 V4L2_PIX_FMT_MODE_HDR,
1015 V4L2_PIX_FMT_MODE_VT_MIRROR,
1016 V4L2_PIX_FMT_MODE_VT_NONMIRROR,
1017};
1018/* 12 Y/CbCr 4:2:0 64x32 macroblocks */
1019#define V4L2_PIX_FMT_NV12T v4l2_fourcc('T', 'V', '1', '2')
1020#define V4L2_PIX_FMT_NV21T v4l2_fourcc('T', 'V', '2', '1')
1021#define V4L2_PIX_FMT_INTERLEAVED v4l2_fourcc('I', 'T', 'L', 'V')
1022
1023/*
1024 * * V4L2 extention for digital camera
1025 * */
1026/* Strobe flash light */
1027enum v4l2_strobe_control {
1028 /* turn off the flash light */
1029 V4L2_STROBE_CONTROL_OFF = 0,
1030 /* turn on the flash light */
1031 V4L2_STROBE_CONTROL_ON = 1,
1032 /* act guide light before splash */
1033 V4L2_STROBE_CONTROL_AFGUIDE = 2,
1034 /* charge the flash light */
1035 V4L2_STROBE_CONTROL_CHARGE = 3,
1036};
1037
1038enum v4l2_strobe_conf {
1039 V4L2_STROBE_OFF = 0, /* Always off */
1040 V4L2_STROBE_ON = 1, /* Always splashes */
1041 /* Auto control presets */
1042 V4L2_STROBE_AUTO = 2,
1043 V4L2_STROBE_REDEYE_REDUCTION = 3,
1044 V4L2_STROBE_SLOW_SYNC = 4,
1045 V4L2_STROBE_FRONT_CURTAIN = 5,
1046 V4L2_STROBE_REAR_CURTAIN = 6,
1047 /* Extra manual control presets */
1048 /* keep turned on until turning off */
1049 V4L2_STROBE_PERMANENT = 7,
1050 V4L2_STROBE_EXTERNAL = 8,
1051};
1052
1053enum v4l2_strobe_status {
1054 V4L2_STROBE_STATUS_OFF = 0,
1055 /* while processing configurations */
1056 V4L2_STROBE_STATUS_BUSY = 1,
1057 V4L2_STROBE_STATUS_ERR = 2,
1058 V4L2_STROBE_STATUS_CHARGING = 3,
1059 V4L2_STROBE_STATUS_CHARGED = 4,
1060};
1061
1062/* capabilities field */
1063/* No strobe supported */
1064#define V4L2_STROBE_CAP_NONE 0x0000
1065/* Always flash off mode */
1066#define V4L2_STROBE_CAP_OFF 0x0001
1067/* Always use flash light mode */
1068#define V4L2_STROBE_CAP_ON 0x0002
1069/* Flashlight works automatic */
1070#define V4L2_STROBE_CAP_AUTO 0x0004
1071/* Red-eye reduction */
1072#define V4L2_STROBE_CAP_REDEYE 0x0008
1073/* Slow sync */
1074#define V4L2_STROBE_CAP_SLOWSYNC 0x0010
1075/* Front curtain */
1076#define V4L2_STROBE_CAP_FRONT_CURTAIN 0x0020
1077/* Rear curtain */
1078#define V4L2_STROBE_CAP_REAR_CURTAIN 0x0040
1079/* keep turned on until turning off */
1080#define V4L2_STROBE_CAP_PERMANENT 0x0080
1081/* use external strobe */
1082#define V4L2_STROBE_CAP_EXTERNAL 0x0100
1083
1084/* Set mode and Get status */
1085struct v4l2_strobe {
1086 /* off/on/charge:0/1/2 */
1087 enum v4l2_strobe_control control;
1088 /* supported strobe capabilities */
1089 __u32 capabilities;
1090 enum v4l2_strobe_conf mode;
1091 enum v4l2_strobe_status status; /* read only */
1092 /* default is 0 and range of value varies from each models */
1093 __u32 flash_ev;
1094 __u32 reserved[4];
1095};
1096
1097#define VIDIOC_S_STROBE _IOWR('V', 83, struct v4l2_strobe)
1098#define VIDIOC_G_STROBE _IOR('V', 84, struct v4l2_strobe)
1099
1100/* Object recognition and collateral actions */
1101enum v4l2_recog_mode {
1102 V4L2_RECOGNITION_MODE_OFF = 0,
1103 V4L2_RECOGNITION_MODE_ON = 1,
1104 V4L2_RECOGNITION_MODE_LOCK = 2,
1105};
1106
1107enum v4l2_recog_action {
1108 V4L2_RECOGNITION_ACTION_NONE = 0, /* only recognition */
1109 V4L2_RECOGNITION_ACTION_BLINK = 1, /* Capture on blinking */
1110 V4L2_RECOGNITION_ACTION_SMILE = 2, /* Capture on smiling */
1111};
1112
1113enum v4l2_recog_pattern {
1114 V4L2_RECOG_PATTERN_FACE = 0, /* Face */
1115 V4L2_RECOG_PATTERN_HUMAN = 1, /* Human */
1116 V4L2_RECOG_PATTERN_CHAR = 2, /* Character */
1117};
1118
1119struct v4l2_recog_rect {
1120 enum v4l2_recog_pattern p; /* detected pattern */
1121 struct v4l2_rect o; /* detected area */
1122 __u32 reserved[4];
1123};
1124
1125struct v4l2_recog_data {
1126 __u8 detect_cnt; /* detected object counter */
1127 struct v4l2_rect o; /* detected area */
1128 __u32 reserved[4];
1129};
1130
1131struct v4l2_recognition {
1132 enum v4l2_recog_mode mode;
1133
1134 /* Which pattern to detect */
1135 enum v4l2_recog_pattern pattern;
1136
1137 /* How many object to detect */
1138 __u8 obj_num;
1139
1140 /* select detected object */
1141 __u32 detect_idx;
1142
1143 /* read only :Get object coordination */
1144 struct v4l2_recog_data data;
1145
1146 enum v4l2_recog_action action;
1147 __u32 reserved[4];
1148};
1149
1150#define VIDIOC_S_RECOGNITION _IOWR('V', 85, struct v4l2_recognition)
1151#define VIDIOC_G_RECOGNITION _IOR('V', 86, struct v4l2_recognition)
1152
1153/* We use this struct as the v4l2_streamparm raw_data for
1154 * VIDIOC_G_PARM and VIDIOC_S_PARM
1155 */
1156struct sec_cam_parm {
1157 struct v4l2_captureparm capture;
1158 int contrast;
1159 int effects;
1160 int brightness;
1161 int exposure;
1162 int flash_mode;
1163 int focus_mode;
1164 int aeawb_mode;
1165 int iso;
1166 int metering;
1167 int saturation;
1168 int scene_mode;
1169 int sharpness;
1170 int hue;
1171 int white_balance;
1172 int anti_banding;
1173 int fps;
1174};
1175
1176#endif /* __LINUX_VIDEODEV2_SAMSUNG_H */
diff --git a/include/linux/wakelock.h b/include/linux/wakelock.h
new file mode 100644
index 00000000000..a096d24ada1
--- /dev/null
+++ b/include/linux/wakelock.h
@@ -0,0 +1,91 @@
1/* include/linux/wakelock.h
2 *
3 * Copyright (C) 2007-2008 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15
16#ifndef _LINUX_WAKELOCK_H
17#define _LINUX_WAKELOCK_H
18
19#include <linux/list.h>
20#include <linux/ktime.h>
21
22/* A wake_lock prevents the system from entering suspend or other low power
23 * states when active. If the type is set to WAKE_LOCK_SUSPEND, the wake_lock
24 * prevents a full system suspend. If the type is WAKE_LOCK_IDLE, low power
25 * states that cause large interrupt latencies or that disable a set of
26 * interrupts will not entered from idle until the wake_locks are released.
27 */
28
29enum {
30 WAKE_LOCK_SUSPEND, /* Prevent suspend */
31 WAKE_LOCK_IDLE, /* Prevent low power idle */
32 WAKE_LOCK_TYPE_COUNT
33};
34
35struct wake_lock {
36#ifdef CONFIG_HAS_WAKELOCK
37 struct list_head link;
38 int flags;
39 const char *name;
40 unsigned long expires;
41#ifdef CONFIG_WAKELOCK_STAT
42 struct {
43 int count;
44 int expire_count;
45 int wakeup_count;
46 ktime_t total_time;
47 ktime_t prevent_suspend_time;
48 ktime_t max_time;
49 ktime_t last_time;
50 } stat;
51#endif
52#endif
53};
54
55#ifdef CONFIG_HAS_WAKELOCK
56
57void wake_lock_init(struct wake_lock *lock, int type, const char *name);
58void wake_lock_destroy(struct wake_lock *lock);
59void wake_lock(struct wake_lock *lock);
60void wake_lock_timeout(struct wake_lock *lock, long timeout);
61void wake_unlock(struct wake_lock *lock);
62
63/* wake_lock_active returns a non-zero value if the wake_lock is currently
64 * locked. If the wake_lock has a timeout, it does not check the timeout
65 * but if the timeout had aready been checked it will return 0.
66 */
67int wake_lock_active(struct wake_lock *lock);
68
69/* has_wake_lock returns 0 if no wake locks of the specified type are active,
70 * and non-zero if one or more wake locks are held. Specifically it returns
71 * -1 if one or more wake locks with no timeout are active or the
72 * number of jiffies until all active wake locks time out.
73 */
74long has_wake_lock(int type);
75
76#else
77
78static inline void wake_lock_init(struct wake_lock *lock, int type,
79 const char *name) {}
80static inline void wake_lock_destroy(struct wake_lock *lock) {}
81static inline void wake_lock(struct wake_lock *lock) {}
82static inline void wake_lock_timeout(struct wake_lock *lock, long timeout) {}
83static inline void wake_unlock(struct wake_lock *lock) {}
84
85static inline int wake_lock_active(struct wake_lock *lock) { return 0; }
86static inline long has_wake_lock(int type) { return 0; }
87
88#endif
89
90#endif
91
diff --git a/include/linux/wifi_tiwlan.h b/include/linux/wifi_tiwlan.h
new file mode 100644
index 00000000000..f07e0679fb8
--- /dev/null
+++ b/include/linux/wifi_tiwlan.h
@@ -0,0 +1,27 @@
1/* include/linux/wifi_tiwlan.h
2 *
3 * Copyright (C) 2008 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15#ifndef _LINUX_WIFI_TIWLAN_H_
16#define _LINUX_WIFI_TIWLAN_H_
17
18#include <linux/wlan_plat.h>
19
20#define WMPA_NUMBER_OF_SECTIONS 3
21#define WMPA_NUMBER_OF_BUFFERS 160
22#define WMPA_SECTION_HEADER 24
23#define WMPA_SECTION_SIZE_0 (WMPA_NUMBER_OF_BUFFERS * 64)
24#define WMPA_SECTION_SIZE_1 (WMPA_NUMBER_OF_BUFFERS * 256)
25#define WMPA_SECTION_SIZE_2 (WMPA_NUMBER_OF_BUFFERS * 2048)
26
27#endif
diff --git a/include/linux/wl127x-rfkill.h b/include/linux/wl127x-rfkill.h
new file mode 100644
index 00000000000..9057ec63d5d
--- /dev/null
+++ b/include/linux/wl127x-rfkill.h
@@ -0,0 +1,35 @@
1/*
2 * Bluetooth TI wl127x rfkill power control via GPIO
3 *
4 * Copyright (C) 2009 Motorola, Inc.
5 * Copyright (C) 2008 Texas Instruments
6 * Initial code: Pavan Savoy <pavan.savoy@gmail.com> (wl127x_power.c)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#ifndef _LINUX_WL127X_RFKILL_H
25#define _LINUX_WL127X_RFKILL_H
26
27#include <linux/rfkill.h>
28
29struct wl127x_rfkill_platform_data {
30 int nshutdown_gpio;
31
32 struct rfkill *rfkill; /* for driver only */
33};
34
35#endif
diff --git a/include/linux/wlan_plat.h b/include/linux/wlan_plat.h
new file mode 100644
index 00000000000..40ec3482d1e
--- /dev/null
+++ b/include/linux/wlan_plat.h
@@ -0,0 +1,27 @@
1/* include/linux/wlan_plat.h
2 *
3 * Copyright (C) 2010 Google, Inc.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 */
15#ifndef _LINUX_WLAN_PLAT_H_
16#define _LINUX_WLAN_PLAT_H_
17
18struct wifi_platform_data {
19 int (*set_power)(int val);
20 int (*set_reset)(int val);
21 int (*set_carddetect)(int val);
22 void *(*mem_prealloc)(int section, unsigned long size);
23 int (*get_mac_addr)(unsigned char *buf);
24 void *(*get_country_code)(char *ccode);
25};
26
27#endif
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index 3f6542ca619..a378c295851 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -7,9 +7,28 @@
7#include <linux/sched.h> 7#include <linux/sched.h>
8#include <linux/fs.h> 8#include <linux/fs.h>
9 9
10struct backing_dev_info; 10/*
11 * The 1/4 region under the global dirty thresh is for smooth dirty throttling:
12 *
13 * (thresh - thresh/DIRTY_FULL_SCOPE, thresh)
14 *
15 * Further beyond, all dirtier tasks will enter a loop waiting (possibly long
16 * time) for the dirty pages to drop, unless written enough pages.
17 *
18 * The global dirty threshold is normally equal to the global dirty limit,
19 * except when the system suddenly allocates a lot of anonymous memory and
20 * knocks down the global dirty threshold quickly, in which case the global
21 * dirty limit will follow down slowly to prevent livelocking all dirtier tasks.
22 */
23#define DIRTY_SCOPE 8
24#define DIRTY_FULL_SCOPE (DIRTY_SCOPE / 2)
11 25
12extern spinlock_t inode_wb_list_lock; 26/*
27 * 4MB minimal write chunk size
28 */
29#define MIN_WRITEBACK_PAGES (4096UL >> (PAGE_CACHE_SHIFT - 10))
30
31struct backing_dev_info;
13 32
14/* 33/*
15 * fs/fs-writeback.c 34 * fs/fs-writeback.c
@@ -20,17 +39,29 @@ enum writeback_sync_modes {
20}; 39};
21 40
22/* 41/*
42 * why some writeback work was initiated
43 */
44enum wb_reason {
45 WB_REASON_BACKGROUND,
46 WB_REASON_TRY_TO_FREE_PAGES,
47 WB_REASON_SYNC,
48 WB_REASON_PERIODIC,
49 WB_REASON_LAPTOP_TIMER,
50 WB_REASON_FREE_MORE_MEM,
51 WB_REASON_FS_FREE_SPACE,
52 WB_REASON_FORKER_THREAD,
53
54 WB_REASON_MAX,
55};
56extern const char *wb_reason_name[];
57
58/*
23 * A control structure which tells the writeback code what to do. These are 59 * A control structure which tells the writeback code what to do. These are
24 * always on the stack, and hence need no locking. They are always initialised 60 * always on the stack, and hence need no locking. They are always initialised
25 * in a manner such that unspecified fields are set to zero. 61 * in a manner such that unspecified fields are set to zero.
26 */ 62 */
27struct writeback_control { 63struct writeback_control {
28 enum writeback_sync_modes sync_mode; 64 enum writeback_sync_modes sync_mode;
29 unsigned long *older_than_this; /* If !NULL, only write back inodes
30 older than this */
31 unsigned long wb_start; /* Time writeback_inodes_wb was
32 called. This is needed to avoid
33 extra jobs and livelock */
34 long nr_to_write; /* Write this many pages, and decrement 65 long nr_to_write; /* Write this many pages, and decrement
35 this for each page written */ 66 this for each page written */
36 long pages_skipped; /* Pages which were not written */ 67 long pages_skipped; /* Pages which were not written */
@@ -43,14 +74,11 @@ struct writeback_control {
43 loff_t range_start; 74 loff_t range_start;
44 loff_t range_end; 75 loff_t range_end;
45 76
46 unsigned nonblocking:1; /* Don't get stuck on request queues */
47 unsigned encountered_congestion:1; /* An output: a queue is full */
48 unsigned for_kupdate:1; /* A kupdate writeback */ 77 unsigned for_kupdate:1; /* A kupdate writeback */
49 unsigned for_background:1; /* A background writeback */ 78 unsigned for_background:1; /* A background writeback */
50 unsigned tagged_writepages:1; /* tag-and-write to avoid livelock */ 79 unsigned tagged_writepages:1; /* tag-and-write to avoid livelock */
51 unsigned for_reclaim:1; /* Invoked from the page allocator */ 80 unsigned for_reclaim:1; /* Invoked from the page allocator */
52 unsigned range_cyclic:1; /* range_start is cyclic */ 81 unsigned range_cyclic:1; /* range_start is cyclic */
53 unsigned more_io:1; /* more io to be dispatched */
54}; 82};
55 83
56/* 84/*
@@ -58,15 +86,17 @@ struct writeback_control {
58 */ 86 */
59struct bdi_writeback; 87struct bdi_writeback;
60int inode_wait(void *); 88int inode_wait(void *);
61void writeback_inodes_sb(struct super_block *); 89void writeback_inodes_sb(struct super_block *, enum wb_reason reason);
62void writeback_inodes_sb_nr(struct super_block *, unsigned long nr); 90void writeback_inodes_sb_nr(struct super_block *, unsigned long nr,
63int writeback_inodes_sb_if_idle(struct super_block *); 91 enum wb_reason reason);
64int writeback_inodes_sb_nr_if_idle(struct super_block *, unsigned long nr); 92int writeback_inodes_sb_if_idle(struct super_block *, enum wb_reason reason);
93int writeback_inodes_sb_nr_if_idle(struct super_block *, unsigned long nr,
94 enum wb_reason reason);
65void sync_inodes_sb(struct super_block *); 95void sync_inodes_sb(struct super_block *);
66void writeback_inodes_wb(struct bdi_writeback *wb, 96long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages,
67 struct writeback_control *wbc); 97 enum wb_reason reason);
68long wb_do_writeback(struct bdi_writeback *wb, int force_wait); 98long wb_do_writeback(struct bdi_writeback *wb, int force_wait);
69void wakeup_flusher_threads(long nr_pages); 99void wakeup_flusher_threads(long nr_pages, enum wb_reason reason);
70 100
71/* writeback.h requires fs.h; it, too, is not included from here. */ 101/* writeback.h requires fs.h; it, too, is not included from here. */
72static inline void wait_on_inode(struct inode *inode) 102static inline void wait_on_inode(struct inode *inode)
@@ -95,6 +125,8 @@ static inline void laptop_sync_completion(void) { }
95#endif 125#endif
96void throttle_vm_writeout(gfp_t gfp_mask); 126void throttle_vm_writeout(gfp_t gfp_mask);
97 127
128extern unsigned long global_dirty_limit;
129
98/* These are exported to sysctl. */ 130/* These are exported to sysctl. */
99extern int dirty_background_ratio; 131extern int dirty_background_ratio;
100extern unsigned long dirty_background_bytes; 132extern unsigned long dirty_background_bytes;
@@ -129,6 +161,14 @@ void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty);
129unsigned long bdi_dirty_limit(struct backing_dev_info *bdi, 161unsigned long bdi_dirty_limit(struct backing_dev_info *bdi,
130 unsigned long dirty); 162 unsigned long dirty);
131 163
164void __bdi_update_bandwidth(struct backing_dev_info *bdi,
165 unsigned long thresh,
166 unsigned long bg_thresh,
167 unsigned long dirty,
168 unsigned long bdi_thresh,
169 unsigned long bdi_dirty,
170 unsigned long start_time);
171
132void page_writeback_init(void); 172void page_writeback_init(void);
133void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, 173void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
134 unsigned long nr_pages_dirtied); 174 unsigned long nr_pages_dirtied);