aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorcodeworkx <daniel.hillenbrand@codeworkx.de>2012-06-02 13:09:29 +0200
committercodeworkx <daniel.hillenbrand@codeworkx.de>2012-06-02 13:09:29 +0200
commitc6da2cfeb05178a11c6d062a06f8078150ee492f (patch)
treef3b4021d252c52d6463a9b3c1bb7245e399b009c /include/linux
parentc6d7c4dbff353eac7919342ae6b3299a378160a6 (diff)
downloadkernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.zip
kernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.tar.gz
kernel_samsung_smdk4412-c6da2cfeb05178a11c6d062a06f8078150ee492f.tar.bz2
samsung update 1
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/30pin_con.h54
-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.h112
-rw-r--r--include/linux/android_pmem.h93
-rw-r--r--include/linux/ashmem.h48
-rw-r--r--include/linux/atmel_mxt1386.h856
-rw-r--r--include/linux/backlight.h10
-rw-r--r--include/linux/battery/charger/bq24190_charger.h60
-rw-r--r--include/linux/battery/charger/dummy_charger.h27
-rw-r--r--include/linux/battery/charger/max8903_charger.h27
-rw-r--r--include/linux/battery/charger/smb328_charger.h51
-rw-r--r--include/linux/battery/fuelgauge/dummy_fuelgauge.h30
-rw-r--r--include/linux/battery/fuelgauge/max17042_fuelgauge.h382
-rw-r--r--include/linux/battery/fuelgauge/max17048_fuelgauge.h53
-rw-r--r--include/linux/battery/fuelgauge/max17050_fuelgauge.h169
-rw-r--r--include/linux/battery/max17047_fuelgauge.h33
-rw-r--r--include/linux/battery/samsung_battery.h345
-rw-r--r--include/linux/battery/sec_battery.h255
-rw-r--r--include/linux/battery/sec_charger.h106
-rw-r--r--include/linux/battery/sec_charging_common.h503
-rw-r--r--include/linux/battery/sec_fuelgauge.h127
-rwxr-xr-xinclude/linux/bh1721fvc.h28
-rw-r--r--include/linux/bitmap.h24
-rw-r--r--include/linux/cgroup.h14
-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/cpu_cooling.h45
-rw-r--r--include/linux/cpuacct.h43
-rw-r--r--include/linux/cpufreq.h20
-rw-r--r--include/linux/cpufreq_pegasusq.h22
-rw-r--r--include/linux/crypto.h121
-rw-r--r--include/linux/devfreq.h292
-rw-r--r--include/linux/devfreq/exynos4_bus.h28
-rw-r--r--include/linux/devfreq/exynos4_display.h28
-rw-r--r--include/linux/device.h3
-rw-r--r--include/linux/dma-buf.h253
-rwxr-xr-xinclude/linux/earlysuspend.h55
-rw-r--r--include/linux/extcon.h328
-rw-r--r--include/linux/extcon/adc_jack.h107
-rw-r--r--include/linux/exynos_mem.h25
-rw-r--r--include/linux/exynos_thermal.h59
-rw-r--r--include/linux/fb.h4
-rw-r--r--include/linux/ftrace_event.h2
-rw-r--r--include/linux/genalloc.h50
-rw-r--r--include/linux/genhd.h7
-rw-r--r--include/linux/gfp.h2
-rwxr-xr-xinclude/linux/gp2a.h34
-rw-r--r--include/linux/gpio_event.h170
-rw-r--r--include/linux/gpio_keys.h1
-rw-r--r--include/linux/hid.h4
-rw-r--r--include/linux/host_notify.h64
-rw-r--r--include/linux/hwmon.h34
-rwxr-xr-xinclude/linux/i2c/ak8975.h72
-rw-r--r--include/linux/i2c/es305.h46
-rw-r--r--include/linux/i2c/fm34_we395.h35
-rw-r--r--include/linux/i2c/mms114.h26
-rw-r--r--include/linux/i2c/mxt1536e.h109
-rw-r--r--include/linux/i2c/mxt1664s.h108
-rw-r--r--include/linux/i2c/mxt224.h257
-rw-r--r--include/linux/i2c/mxt224_gc.h190
-rw-r--r--include/linux/i2c/mxt224_u1.h169
-rw-r--r--include/linux/i2c/mxt540e.h133
-rw-r--r--include/linux/i2c/mxt768e.h137
-rw-r--r--include/linux/i2c/touchkey_i2c.h159
-rw-r--r--include/linux/i2c/voice_processor.h27
-rw-r--r--include/linux/ieee80211.h10
-rw-r--r--include/linux/if_arp.h1
-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.h6
-rw-r--r--include/linux/iommu.h142
-rw-r--r--include/linux/ion.h419
-rw-r--r--include/linux/ir_remote_con.h6
-rw-r--r--include/linux/irq.h1
-rw-r--r--include/linux/isa1200_vibrator.h81
-rw-r--r--include/linux/jack.h29
-rw-r--r--include/linux/kernel.h3
-rw-r--r--include/linux/keychord.h52
-rw-r--r--include/linux/keyreset.h28
-rw-r--r--include/linux/lcd.h15
-rw-r--r--include/linux/ld9040.h45
-rw-r--r--include/linux/leds-aat1290a.h65
-rw-r--r--include/linux/leds-an30259a.h83
-rw-r--r--include/linux/leds-lp5521.h16
-rw-r--r--include/linux/leds-max77693.h159
-rw-r--r--include/linux/leds-max8997.h20
-rw-r--r--include/linux/leds-spfcw043.h63
-rw-r--r--include/linux/leds.h6
-rw-r--r--include/linux/mdnie.h9
-rw-r--r--include/linux/melfas_touchkey.h30
-rw-r--r--include/linux/melfas_ts.h47
-rw-r--r--include/linux/mfd/max77686-private.h259
-rw-r--r--include/linux/mfd/max77686.h136
-rw-r--r--include/linux/mfd/max77693-private.h406
-rw-r--r--include/linux/mfd/max77693.h141
-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.h664
-rw-r--r--include/linux/mfd/max8997.h221
-rw-r--r--include/linux/mfd/mc1n2_pdata.h29
-rw-r--r--include/linux/mfd/s5m87xx/s5m-core.h385
-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/mfd/wm8994/core.h8
-rw-r--r--include/linux/mfd/wm8994/pdata.h44
-rw-r--r--include/linux/mfd/wm8994/registers.h218
-rw-r--r--include/linux/mhd9234.h30
-rw-r--r--include/linux/mm.h1
-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
-rwxr-xr-x[-rw-r--r--]include/linux/mmc/sdio_func.h11
-rw-r--r--include/linux/mms152.h130
-rw-r--r--include/linux/mms_ts_gc.h115
-rwxr-xr-xinclude/linux/mpu.h488
-rwxr-xr-xinclude/linux/mpu3050.h255
-rw-r--r--include/linux/mpu6000.h406
-rw-r--r--include/linux/mpu6050a2.h425
-rw-r--r--include/linux/mpu6050b1.h439
-rw-r--r--include/linux/mpu6x.h509
-rw-r--r--include/linux/mpu_411.h368
-rw-r--r--include/linux/msdos_fs.h13
-rw-r--r--include/linux/msm_charm.h19
-rw-r--r--include/linux/msm_rmnet.h54
-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/nfc/pn65n.h33
-rw-r--r--include/linux/nl80211.h4
-rw-r--r--include/linux/opp.h12
-rw-r--r--include/linux/pda_power.h2
-rw-r--r--include/linux/phone_svn/ipc_spi.h59
-rw-r--r--include/linux/phone_svn/modemctl.h103
-rw-r--r--include/linux/platform_data/c2c.h131
-rw-r--r--include/linux/platform_data/exynos4_tmu.h95
-rw-r--r--include/linux/platform_data/exynos_usb3_drd.h22
-rw-r--r--include/linux/platform_data/lte_modem_bootloader.h40
-rw-r--r--include/linux/platform_data/mms_ts.h104
-rw-r--r--include/linux/platform_data/mms_ts_gc.h39
-rw-r--r--include/linux/platform_data/modem.h323
-rw-r--r--include/linux/platform_data/ntc_thermistor.h53
-rw-r--r--include/linux/platform_data/ram_console.h22
-rw-r--r--include/linux/platform_data/usb3503.h42
-rw-r--r--include/linux/plist.h55
-rw-r--r--include/linux/pm_qos_params.h9
-rw-r--r--include/linux/pn544.h33
-rw-r--r--include/linux/power/charger-manager.h242
-rw-r--r--include/linux/power/max17042_battery.h2
-rw-r--r--include/linux/power/max17042_fuelgauge_px.h343
-rw-r--r--include/linux/power/max17042_fuelgauge_u1.h86
-rw-r--r--include/linux/power/max8922_charger_u1.h22
-rw-r--r--include/linux/power/sec_battery_px.h75
-rw-r--r--include/linux/power/sec_battery_u1.h85
-rw-r--r--include/linux/power/smb136_charger.h28
-rw-r--r--include/linux/power/smb136_charger_q1.h101
-rw-r--r--include/linux/power/smb328_charger.h104
-rwxr-xr-xinclude/linux/power/smb347_charger.h37
-rw-r--r--include/linux/power_supply.h17
-rw-r--r--include/linux/rbtree.h11
-rw-r--r--include/linux/rmi.h560
-rw-r--r--include/linux/rtc.h11
-rw-r--r--include/linux/rtmutex.h4
-rw-r--r--include/linux/sched.h5
-rw-r--r--include/linux/sec_jack.h65
-rw-r--r--include/linux/sensor/ak8975.h73
-rw-r--r--include/linux/sensor/bh1721.h28
-rw-r--r--include/linux/sensor/cm3663.h31
-rw-r--r--include/linux/sensor/cm36651.h11
-rw-r--r--include/linux/sensor/gp2a.h68
-rw-r--r--include/linux/sensor/gp2a_analog.h33
-rw-r--r--include/linux/sensor/k3dh.h41
-rw-r--r--include/linux/sensor/k3g.h40
-rw-r--r--include/linux/sensor/lps331ap.h84
-rw-r--r--include/linux/sensor/lsm330dlc_accel.h185
-rw-r--r--include/linux/sensor/lsm330dlc_gyro.h30
-rw-r--r--include/linux/sensor/pas2m110.h31
-rw-r--r--include/linux/sensor/sensors_core.h25
-rw-r--r--include/linux/sensor/taos.h146
-rw-r--r--include/linux/serial_core.h1
-rw-r--r--include/linux/si4705_pdata.h38
-rwxr-xr-xinclude/linux/sii9234.h69
-rw-r--r--include/linux/sii9234_rcp.h177
-rw-r--r--include/linux/sockios.h1
-rw-r--r--include/linux/stmpe811-adc.h52
-rw-r--r--include/linux/suspend.h8
-rw-r--r--include/linux/switch.h53
-rw-r--r--include/linux/synaptics_i2c_rmi.h55
-rw-r--r--include/linux/synaptics_s7301.h205
-rw-r--r--include/linux/thermal.h1
-rw-r--r--include/linux/timed_output.h37
-rw-r--r--include/linux/uart_select.h26
-rw-r--r--include/linux/uid_stat.h29
-rw-r--r--include/linux/usb.h4
-rw-r--r--include/linux/usb/android_composite.h100
-rw-r--r--include/linux/usb/ch11.h38
-rw-r--r--include/linux/usb/ch9.h2
-rw-r--r--include/linux/usb/composite.h67
-rw-r--r--include/linux/usb/ehci_def.h6
-rw-r--r--include/linux/usb/exynos_usb3_drd.h404
-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.h32
-rw-r--r--include/linux/usb/otg_id.h58
-rw-r--r--include/linux/usb/quirks.h9
-rw-r--r--include/linux/v4l2-mediabus.h2
-rw-r--r--include/linux/videodev2.h472
-rw-r--r--include/linux/videodev2_exynos_camera.h1363
-rw-r--r--include/linux/videodev2_exynos_media.h225
-rw-r--r--include/linux/wacom_i2c.h213
-rwxr-xr-xinclude/linux/wakelock.h90
-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/workqueue.h4
223 files changed, 22735 insertions, 523 deletions
diff --git a/include/linux/30pin_con.h b/include/linux/30pin_con.h
new file mode 100644
index 0000000..9e3a4c1
--- /dev/null
+++ b/include/linux/30pin_con.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2008 Samsung Electronics, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __ASM_ARCH_ACC_CONN_H
+#define __ASM_ARCH_ACC_CONN_H
+
+#ifdef CONFIG_SEC_KEYBOARD_DOCK
+struct sec_keyboard_callbacks {
+ int (*check_keyboard_dock)(struct sec_keyboard_callbacks *cb,
+ bool attached);
+};
+
+struct sec_keyboard_platform_data {
+ int accessory_irq_gpio;
+ int (*wakeup_key)(void);
+ void (*check_uart_path)(bool en);
+ void (*acc_power)(u8 token, bool active);
+ void (*register_cb)(struct sec_keyboard_callbacks *cb);
+};
+#endif
+
+struct acc_con_platform_data {
+ void (*otg_en) (int active);
+ void (*acc_power) (u8 token, bool active);
+ void (*usb_ldo_en) (int active);
+ int (*get_acc_state)(void);
+ int (*get_dock_state)(void);
+ int (*check_keyboard)(bool attached);
+ int accessory_irq_gpio;
+ int dock_irq_gpio;
+ int mhl_irq_gpio;
+ int hdmi_hpd_gpio;
+};
+
+#if defined(CONFIG_STMPE811_ADC)
+u16 stmpe811_get_adc_data(u8 channel);
+#endif
+
+extern struct device *sec_switch_dev;
+#ifdef CONFIG_SAMSUNG_MHL_9290
+int acc_register_notifier(struct notifier_block *nb);
+#endif
+#endif
diff --git a/include/linux/akm8975.h b/include/linux/akm8975.h
new file mode 100644
index 0000000..6a7c432
--- /dev/null
+++ b/include/linux/akm8975.h
@@ -0,0 +1,87 @@
+/*
+ * Definitions for akm8975 compass chip.
+ */
+#ifndef AKM8975_H
+#define AKM8975_H
+
+#include <linux/ioctl.h>
+
+/*! \name AK8975 operation mode
+ \anchor AK8975_Mode
+ Defines an operation mode of the AK8975.*/
+/*! @{*/
+#define AK8975_MODE_SNG_MEASURE 0x01
+#define AK8975_MODE_SELF_TEST 0x08
+#define AK8975_MODE_FUSE_ACCESS 0x0F
+#define AK8975_MODE_POWER_DOWN 0x00
+/*! @}*/
+
+#define RBUFF_SIZE 8 /* Rx buffer size */
+
+/*! \name AK8975 register address
+\anchor AK8975_REG
+Defines a register address of the AK8975.*/
+/*! @{*/
+#define AK8975_REG_WIA 0x00
+#define AK8975_REG_INFO 0x01
+#define AK8975_REG_ST1 0x02
+#define AK8975_REG_HXL 0x03
+#define AK8975_REG_HXH 0x04
+#define AK8975_REG_HYL 0x05
+#define AK8975_REG_HYH 0x06
+#define AK8975_REG_HZL 0x07
+#define AK8975_REG_HZH 0x08
+#define AK8975_REG_ST2 0x09
+#define AK8975_REG_CNTL 0x0A
+#define AK8975_REG_RSV 0x0B
+#define AK8975_REG_ASTC 0x0C
+#define AK8975_REG_TS1 0x0D
+#define AK8975_REG_TS2 0x0E
+#define AK8975_REG_I2CDIS 0x0F
+/*! @}*/
+
+/*! \name AK8975 fuse-rom address
+\anchor AK8975_FUSE
+Defines a read-only address of the fuse ROM of the AK8975.*/
+/*! @{*/
+#define AK8975_FUSE_ASAX 0x10
+#define AK8975_FUSE_ASAY 0x11
+#define AK8975_FUSE_ASAZ 0x12
+/*! @}*/
+
+#define AKMIO 0xA1
+
+/* IOCTLs for AKM library */
+#define ECS_IOCTL_WRITE _IOW(AKMIO, 0x02, char[5])
+#define ECS_IOCTL_READ _IOWR(AKMIO, 0x03, char[5])
+#define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x08, char[RBUFF_SIZE])
+#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x0C, short[12])
+#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x0D, int)
+#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x0E, int)
+#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, short)
+
+/* IOCTLs for APPs */
+#define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short)
+#define ECS_IOCTL_APP_GET_MFLAG _IOW(AKMIO, 0x12, short)
+#define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short)
+#define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short)
+#define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, short)
+#define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY
+/* Set raw magnetic vector flag */
+#define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short)
+/* Get raw magnetic vector flag */
+#define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short)
+#define ECS_IOCTL_APP_SET_TFLAG _IOR(AKMIO, 0x15, short)
+
+
+struct akm8975_platform_data {
+ int intr;
+
+ int (*init)(void);
+ void (*exit)(void);
+ int (*power_on)(void);
+ int (*power_off)(void);
+};
+
+#endif
+
diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h
index 2111481..60c737f 100644
--- a/include/linux/amba/mmci.h
+++ b/include/linux/amba/mmci.h
@@ -5,6 +5,15 @@
#define AMBA_MMCI_H
#include <linux/mmc/host.h>
+#include <linux/mmc/card.h>
+#include <linux/mmc/sdio_func.h>
+
+struct embedded_sdio_data {
+ struct sdio_cis cis;
+ struct sdio_cccr cccr;
+ struct sdio_embedded_func *funcs;
+ int num_funcs;
+};
/* Just some dummy forwarding */
struct dma_chan;
@@ -55,6 +64,9 @@ struct mmci_platform_data {
bool (*dma_filter)(struct dma_chan *chan, void *filter_param);
void *dma_rx_param;
void *dma_tx_param;
+ unsigned int status_irq;
+ struct embedded_sdio_data *embedded_sdio;
+ int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id);
};
#endif
diff --git a/include/linux/android_aid.h b/include/linux/android_aid.h
new file mode 100644
index 0000000..0f904b3
--- /dev/null
+++ b/include/linux/android_aid.h
@@ -0,0 +1,28 @@
+/* include/linux/android_aid.h
+ *
+ * Copyright (C) 2008 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_ANDROID_AID_H
+#define _LINUX_ANDROID_AID_H
+
+/* AIDs that the kernel treats differently */
+#define AID_NET_BT_ADMIN 3001
+#define AID_NET_BT 3002
+#define AID_INET 3003
+#define AID_NET_RAW 3004
+#define AID_NET_ADMIN 3005
+#define AID_NET_BW_STATS 3006 /* read bandwidth statistics */
+#define AID_NET_BW_ACCT 3007 /* change bandwidth statistics accounting */
+
+#endif
diff --git a/include/linux/android_alarm.h b/include/linux/android_alarm.h
new file mode 100644
index 0000000..68c9b0f
--- /dev/null
+++ b/include/linux/android_alarm.h
@@ -0,0 +1,112 @@
+/* include/linux/android_alarm.h
+ *
+ * Copyright (C) 2006-2007 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_ANDROID_ALARM_H
+#define _LINUX_ANDROID_ALARM_H
+
+#include <linux/ioctl.h>
+#include <linux/time.h>
+
+enum android_alarm_type {
+ /* return code bit numbers or set alarm arg */
+ ANDROID_ALARM_RTC_WAKEUP,
+ ANDROID_ALARM_RTC,
+ ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP,
+ ANDROID_ALARM_ELAPSED_REALTIME,
+ ANDROID_ALARM_SYSTEMTIME,
+
+ ANDROID_ALARM_TYPE_COUNT,
+
+ /* return code bit numbers */
+ /* ANDROID_ALARM_TIME_CHANGE = 16 */
+};
+
+#ifdef __KERNEL__
+
+#include <linux/ktime.h>
+#include <linux/rbtree.h>
+
+/*
+ * The alarm interface is similar to the hrtimer interface but adds support
+ * for wakeup from suspend. It also adds an elapsed realtime clock that can
+ * be used for periodic timers that need to keep runing while the system is
+ * suspended and not be disrupted when the wall time is set.
+ */
+
+/**
+ * struct alarm - the basic alarm structure
+ * @node: red black tree node for time ordered insertion
+ * @type: alarm type. rtc/elapsed-realtime/systemtime, wakeup/non-wakeup.
+ * @softexpires: the absolute earliest expiry time of the alarm.
+ * @expires: the absolute expiry time.
+ * @function: alarm expiry callback function
+ *
+ * The alarm structure must be initialized by alarm_init()
+ *
+ */
+
+struct alarm {
+ struct rb_node node;
+ enum android_alarm_type type;
+ ktime_t softexpires;
+ ktime_t expires;
+ void (*function)(struct alarm *);
+};
+
+void alarm_init(struct alarm *alarm,
+ enum android_alarm_type type, void (*function)(struct alarm *));
+void alarm_start_range(struct alarm *alarm, ktime_t start, ktime_t end);
+int alarm_try_to_cancel(struct alarm *alarm);
+int alarm_cancel(struct alarm *alarm);
+ktime_t alarm_get_elapsed_realtime(void);
+
+/* set rtc while preserving elapsed realtime */
+int alarm_set_rtc(const struct timespec ts);
+#if defined(CONFIG_RTC_ALARM_BOOT)
+int alarm_set_alarm_boot(char *alarm_data);
+#endif
+
+#endif
+
+enum android_alarm_return_flags {
+ ANDROID_ALARM_RTC_WAKEUP_MASK = 1U << ANDROID_ALARM_RTC_WAKEUP,
+ ANDROID_ALARM_RTC_MASK = 1U << ANDROID_ALARM_RTC,
+ ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP_MASK =
+ 1U << ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP,
+ ANDROID_ALARM_ELAPSED_REALTIME_MASK =
+ 1U << ANDROID_ALARM_ELAPSED_REALTIME,
+ ANDROID_ALARM_SYSTEMTIME_MASK = 1U << ANDROID_ALARM_SYSTEMTIME,
+ ANDROID_ALARM_TIME_CHANGE_MASK = 1U << 16
+};
+
+/* Disable alarm */
+#define ANDROID_ALARM_CLEAR(type) _IO('a', 0 | ((type) << 4))
+
+/* Ack last alarm and wait for next */
+#define ANDROID_ALARM_WAIT _IO('a', 1)
+
+#define ALARM_IOW(c, type, size) _IOW('a', (c) | ((type) << 4), size)
+/* Set alarm */
+#define ANDROID_ALARM_SET(type) ALARM_IOW(2, type, struct timespec)
+#define ANDROID_ALARM_SET_AND_WAIT(type) ALARM_IOW(3, type, struct timespec)
+#define ANDROID_ALARM_GET_TIME(type) ALARM_IOW(4, type, struct timespec)
+#define ANDROID_ALARM_SET_RTC _IOW('a', 5, struct timespec)
+#if defined(CONFIG_RTC_ALARM_BOOT)
+#define ANDROID_ALARM_SET_ALARM_BOOT _IOW('a', 7, struct timespec)
+#endif
+#define ANDROID_ALARM_BASE_CMD(cmd) (cmd & ~(_IOC(0, 0, 0xf0, 0)))
+#define ANDROID_ALARM_IOCTL_TO_TYPE(cmd) (_IOC_NR(cmd) >> 4)
+
+#endif
diff --git a/include/linux/android_pmem.h b/include/linux/android_pmem.h
new file mode 100644
index 0000000..f633621
--- /dev/null
+++ b/include/linux/android_pmem.h
@@ -0,0 +1,93 @@
+/* include/linux/android_pmem.h
+ *
+ * Copyright (C) 2007 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _ANDROID_PMEM_H_
+#define _ANDROID_PMEM_H_
+
+#define PMEM_IOCTL_MAGIC 'p'
+#define PMEM_GET_PHYS _IOW(PMEM_IOCTL_MAGIC, 1, unsigned int)
+#define PMEM_MAP _IOW(PMEM_IOCTL_MAGIC, 2, unsigned int)
+#define PMEM_GET_SIZE _IOW(PMEM_IOCTL_MAGIC, 3, unsigned int)
+#define PMEM_UNMAP _IOW(PMEM_IOCTL_MAGIC, 4, unsigned int)
+/* This ioctl will allocate pmem space, backing the file, it will fail
+ * if the file already has an allocation, pass it the len as the argument
+ * to the ioctl */
+#define PMEM_ALLOCATE _IOW(PMEM_IOCTL_MAGIC, 5, unsigned int)
+/* This will connect a one pmem file to another, pass the file that is already
+ * backed in memory as the argument to the ioctl
+ */
+#define PMEM_CONNECT _IOW(PMEM_IOCTL_MAGIC, 6, unsigned int)
+/* Returns the total size of the pmem region it is sent to as a pmem_region
+ * struct (with offset set to 0).
+ */
+#define PMEM_GET_TOTAL_SIZE _IOW(PMEM_IOCTL_MAGIC, 7, unsigned int)
+#define PMEM_CACHE_FLUSH _IOW(PMEM_IOCTL_MAGIC, 8, unsigned int)
+
+struct android_pmem_platform_data
+{
+ const char* name;
+ /* starting physical address of memory region */
+ unsigned long start;
+ /* size of memory region */
+ unsigned long size;
+ /* set to indicate the region should not be managed with an allocator */
+ unsigned no_allocator;
+ /* set to indicate maps of this region should be cached, if a mix of
+ * cached and uncached is desired, set this and open the device with
+ * O_SYNC to get an uncached region */
+ unsigned cached;
+ /* The MSM7k has bits to enable a write buffer in the bus controller*/
+ unsigned buffered;
+};
+
+struct pmem_region {
+ unsigned long offset;
+ unsigned long len;
+};
+
+#ifdef CONFIG_ANDROID_PMEM
+int is_pmem_file(struct file *file);
+int get_pmem_file(int fd, unsigned long *start, unsigned long *vstart,
+ unsigned long *end, struct file **filp);
+int get_pmem_user_addr(struct file *file, unsigned long *start,
+ unsigned long *end);
+void put_pmem_file(struct file* file);
+void flush_pmem_file(struct file *file, unsigned long start, unsigned long len);
+int pmem_setup(struct android_pmem_platform_data *pdata,
+ long (*ioctl)(struct file *, unsigned int, unsigned long),
+ int (*release)(struct inode *, struct file *));
+int pmem_remap(struct pmem_region *region, struct file *file,
+ unsigned operation);
+
+#else
+static inline int is_pmem_file(struct file *file) { return 0; }
+static inline int get_pmem_file(int fd, unsigned long *start,
+ unsigned long *vstart, unsigned long *end,
+ struct file **filp) { return -ENOSYS; }
+static inline int get_pmem_user_addr(struct file *file, unsigned long *start,
+ unsigned long *end) { return -ENOSYS; }
+static inline void put_pmem_file(struct file* file) { return; }
+static inline void flush_pmem_file(struct file *file, unsigned long start,
+ unsigned long len) { return; }
+static inline int pmem_setup(struct android_pmem_platform_data *pdata,
+ long (*ioctl)(struct file *, unsigned int, unsigned long),
+ int (*release)(struct inode *, struct file *)) { return -ENOSYS; }
+
+static inline int pmem_remap(struct pmem_region *region, struct file *file,
+ unsigned operation) { return -ENOSYS; }
+#endif
+
+#endif //_ANDROID_PPP_H_
+
diff --git a/include/linux/ashmem.h b/include/linux/ashmem.h
new file mode 100644
index 0000000..1976b10
--- /dev/null
+++ b/include/linux/ashmem.h
@@ -0,0 +1,48 @@
+/*
+ * include/linux/ashmem.h
+ *
+ * Copyright 2008 Google Inc.
+ * Author: Robert Love
+ *
+ * This file is dual licensed. It may be redistributed and/or modified
+ * under the terms of the Apache 2.0 License OR version 2 of the GNU
+ * General Public License.
+ */
+
+#ifndef _LINUX_ASHMEM_H
+#define _LINUX_ASHMEM_H
+
+#include <linux/limits.h>
+#include <linux/ioctl.h>
+
+#define ASHMEM_NAME_LEN 256
+
+#define ASHMEM_NAME_DEF "dev/ashmem"
+
+/* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */
+#define ASHMEM_NOT_PURGED 0
+#define ASHMEM_WAS_PURGED 1
+
+/* Return values from ASHMEM_GET_PIN_STATUS: Is the mapping pinned? */
+#define ASHMEM_IS_UNPINNED 0
+#define ASHMEM_IS_PINNED 1
+
+struct ashmem_pin {
+ __u32 offset; /* offset into region, in bytes, page-aligned */
+ __u32 len; /* length forward from offset, in bytes, page-aligned */
+};
+
+#define __ASHMEMIOC 0x77
+
+#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN])
+#define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN])
+#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t)
+#define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4)
+#define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long)
+#define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6)
+#define ASHMEM_PIN _IOW(__ASHMEMIOC, 7, struct ashmem_pin)
+#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin)
+#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9)
+#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
+
+#endif /* _LINUX_ASHMEM_H */
diff --git a/include/linux/atmel_mxt1386.h b/include/linux/atmel_mxt1386.h
new file mode 100644
index 0000000..1de731d
--- /dev/null
+++ b/include/linux/atmel_mxt1386.h
@@ -0,0 +1,856 @@
+/*
+ * Atmel maXTouch header file
+ *
+ * Copyright (c) 2010 Iiro Valkonen <iiro.valkonen@atmel.com>
+ * Copyright (c) 2010 Ulf Samuelsson <ulf.samuelsson@atmel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 or 3 as
+ * published by the Free Software Foundation.
+ * See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ */
+
+#ifndef _LINUX_MXT1386_H
+#define _LINUX_MXT1386_H
+#include <linux/wakelock.h>
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+#include <linux/earlysuspend.h>
+#endif
+
+/*Avoid Touch lockup due to wrong auto calibratoin*/
+/*Loose the calibration threshold to recalibrate easily at anti-touch
+ * for 4seconds after wakeup,
+ * and tighten the calibration threshold to recalibrate at least at idle time
+ * to avoid calibration repetition problem
+ */
+#define MXT_CALIBRATE_WORKAROUND
+
+/*For Performance*/
+#define MXT_FACTORY_TEST
+
+/*Normal Feature*/
+#define MXT_SLEEP_POWEROFF
+#define MXT_ERROR_WORKAROUND
+
+#define MXT_I2C_APP_ADDR 0x4c
+#define MXT_I2C_BOOTLOADER_ADDR 0x26
+
+/*botton_right, botton_left, center, top_right, top_left*/
+#define MXT1386_MAX_CHANNEL 1386
+#define MXT1386_PAGE_SIZE 64
+#define MXT1386_PAGE_SIZE_SLAVE 8
+#define MXT1386_MAX_PAGE ((MXT1386_PAGE_SIZE_SLAVE * 3) - 1)
+#define MXT1386_PAGE_WIDTH 14
+#define MXT1386_MIN_REF_VALUE 4840
+#define MXT1386_MAX_REF_VALUE 13500
+
+#define MXT_I2C_SPEED_KHZ 400
+#define MXT_I2C_MAX_LENGTH 300
+
+#define MAXTOUCH_FAMILYID 0xA0/*0x80*/
+#define MXT224_CAL_VARIANTID 0x01
+#define MXT224_UNCAL_VARIANTID 0x00
+
+#define MXT_MAX_X_VAL_12_BIT 4095
+#define MXT_MAX_Y_VAL_12_BIT 4095
+#define MXT_MAX_X_VAL_10_BIT 1023
+#define MXT_MAX_Y_VAL_10_BIT 1023
+
+
+#define MXT_MAX_REPORTED_WIDTH 255
+#define MXT_MAX_REPORTED_PRESSURE 255
+
+
+#define MXT_MAX_TOUCH_SIZE 255
+#define MXT_MAX_NUM_TOUCHES 10 /* 10 finger */
+
+/* Fixed addresses inside maXTouch device */
+#define MXT_ADDR_INFO_BLOCK 0
+#define MXT_ADDR_OBJECT_TABLE 7
+#define MXT_ID_BLOCK_SIZE 7
+#define MXT_OBJECT_TABLE_ELEMENT_SIZE 6
+/* Object types */
+/*#define MXT_DEBUG_DELTAS_T2 2*/
+/*#define MXT_DEBUG_REFERENCES_T3 3*/
+#define MXT_GEN_MESSAGEPROCESSOR_T5 5
+#define MXT_GEN_COMMANDPROCESSOR_T6 6
+#define MXT_GEN_POWERCONFIG_T7 7
+#define MXT_GEN_ACQUIRECONFIG_T8 8
+#define MXT_TOUCH_MULTITOUCHSCREEN_T9 9
+#define MXT_TOUCH_KEYARRAY_T15 15
+#define MXT_SPT_COMMSCONFIG_T18 18
+/*#define MXT_SPT_GPIOPWM_T19 19*/
+/*#define MXT_PROCI_GRIPFACESUPPRESSION_T20 20*/
+#define MXT_PROCG_NOISESUPPRESSION_T22 22
+/*#define MXT_TOUCH_PROXIMITY_T23 23*/
+#define MXT_PROCI_ONETOUCHGESTUREPROCESSOR_T24 24
+#define MXT_SPT_SELFTEST_T25 25
+/*#define MXT_DEBUG_CTERANGE_T26 26*/
+#define MXT_PROCI_TWOTOUCHGESTUREPROCESSOR_T27 27
+#define MXT_SPT_CTECONFIG_T28 28
+#define MXT_DEBUG_DIAGNOSTICS_T37 37
+#define MXT_USER_INFO_T38 38
+#define MXT_GEN_EXTENSION_T39 39
+#define MXT_PROCI_GRIPSUPPRESSION_T40 40
+#define MXT_PROCI_PALMSUPPRESSION_T41 41
+#define MXT_SPT_DIGITIZER_T43 43
+#define MXT_MESSAGECOUNT_T44 44
+
+#define MXT_MAX_OBJECT_TYPES 45/*40*/
+
+#define MXT_END_OF_MESSAGES 0xFF
+
+/* Configuration Object Adress Fields */
+/* GEN_MESSAGEPROCESSOR_T5 Address Definitions */
+/* T5 does not have any configuration */
+
+/* GEN_COMMANDPROCESSOR_T6 Address Definitions */
+#define MXT_ADR_T6_RESET 0x00
+#define MXT_ADR_T6_BACKUPNV 0x01
+#define MXT_ADR_T6_CALIBRATE 0x02
+#define MXT_ADR_T6_REPORTALL 0x03
+#define MXT_ADR_T6_RESERVED 0x04
+#define MXT_ADR_T6_DIAGNOSTICS 0x05
+/* T6 Diagnostics Debug Command */
+#define MXT_CMD_T6_PAGE_UP 0x01
+#define MXT_CMD_T6_PAGE_DOWN 0x02
+#define MXT_CMD_T6_DELTAS_MODE 0x10
+#define MXT_CMD_T6_REFERENCES_MODE 0x11
+#define MXT_CMD_T6_CTE_MODE 0x31
+
+/* GEN_POWERCONFIG_T7 Address Definitions */
+#define MXT_ADR_T7_IDLEACQINT 0x00
+#define MXT_ADR_T7_ACTVACQINT 0x01
+#define MXT_ADR_T7_ACTV2IDLETO 0x02
+
+/* GEN_ACQUIRECONFIG_T8 Address Definitions */
+#define MXT_ADR_T8_CHRGTIME 0x00
+#define MXT_ADR_T8_RESERVED 0x01
+#define MXT_ADR_T8_TCHDRIFT 0x02
+#define MXT_ADR_T8_DRIFTSTS 0x03
+#define MXT_ADR_T8_TCHAUTOCAL 0x04
+#define MXT_ADR_T8_SYNC 0x05
+#define MXT_ADR_T8_ATCHCALST 0x06
+#define MXT_ADR_T8_ATCHCALSTHR 0x07
+#define MXT_ADR_T8_ATCHFRCCALTHR 0x08
+#define MXT_ADR_T8_ATCHFRCCALRATIO 0x09
+
+/* TOUCH_MULTITOUCHSCREEN_T9 Address Definitions */
+#define MXT_ADR_T9_CTRL 0x00
+#define MXT_T9_CFGB_ENABLE(x) (((x) >> 0) & 0x01)
+#define MXT_T9_CFGB_RPRTEN(x) (((x) >> 1) & 0x01)
+#define MXT_T9_CFGB_DISAMP(x) (((x) >> 2) & 0x01)
+#define MXT_T9_CFGB_DISVECT(x) (((x) >> 3) & 0x01)
+#define MXT_T9_CFGB_DISMOVE(x) (((x) >> 4) & 0x01)
+#define MXT_T9_CFGB_DISREL(x) (((x) >> 5) & 0x01)
+#define MXT_T9_CFGB_DISPRSS(x) (((x) >> 6) & 0x01)
+
+#define MXT_T9_ENABLE (0x01)
+#define MXT_T9_RPRTEN (0x02)
+#define MXT_T9_DISAMP (0x04)
+#define MXT_T9_DISVECT (0x08)
+#define MXT_T9_DISMOVE (0x10)
+#define MXT_T9_DISREL (0x20)
+#define MXT_T9_DISPRSS (0x40)
+#define MXT_ADR_T9_XORIGIN 0x01
+#define MXT_ADR_T9_YORIGIN 0x02
+#define MXT_ADR_T9_XSIZE 0x03
+#define MXT_ADR_T9_YSIZE 0x04
+#define MXT_ADR_T9_AKSCFG 0x05
+#define MXT_ADR_T9_BLEN 0x06
+#define MXT_T9_CFGBF_BL(x) (x & 0x0F)
+#define MXT_T9_CFGBF_GAIN(x) ((x >> 4) & 0x0F)
+#define MXT_ADR_T9_TCHTHR 0x07
+#define MXT_ADR_T9_TCHDI 0x08
+#define MXT_ADR_T9_ORIENT 0x09
+#define MXT_T9_CFGB_SWITCH(x) (((x) >> 0) & 0x01)
+#define MXT_T9_CFGB_INVERTX(x) (((x) >> 1) & 0x01)
+#define MXT_T9_CFGB_INVERTY(x) (((x) >> 2) & 0x01)
+#define MXT_ADR_T9_MRGTIMEOUT 0x0a
+#define MXT_ADR_T9_MOVHYSTI 0x0b
+#define MXT_ADR_T9_MOVHYSTN 0x0c
+#define MXT_ADR_T9_MOVFILTER 0x0d
+#define MXT_T9_CFGBF_ADAPTTHR(x) (((x) >> 0) & 0xF)
+#define MXT_T9_CFGB_DISABLE(x) (((x) >> 7) & 0x01)
+#define MXT_ADR_T9_NUMTOUCH 0x0e
+#define MXT_ADR_T9_MRGHYST 0x0f
+#define MXT_ADR_T9_MRGTHR 0x10
+#define MXT_ADR_T9_AMPHYST 0x11
+/* 16 bit */
+#define MXT_ADR_T9_XRANGE 0x12
+/* 16 bit */
+#define MXT_ADR_T9_YRANGE 0x14
+#define MXT_ADR_T9_XLOCLIP 0x16
+#define MXT_ADR_T9_XHICLIP 0x17
+#define MXT_ADR_T9_YLOCLIP 0x18
+#define MXT_ADR_T9_YHICLIP 0x19
+#define MXT_ADR_T9_XEDGECTRL 0x1a
+#define MXT_ADR_T9_XEDGEDIST 0x1b
+#define MXT_ADR_T9_YEDGECTRL 0x1c
+#define MXT_ADR_T9_YEDGEDIST 0x1d
+
+/* TOUCH_KEYARRAY_T15 Address Definitions */
+#define MXT_ADR_T15_CTRL 0x00
+#define MXT_T15_CFGB_ENABLE(x) (((x) >> 0) & 0x01)
+#define MXT_T15_CFGB_RPRTEN(x) (((x) >> 1) & 0x01)
+#define MXT_T15_CFGB_INTAKSEN(x) (((x) >> 7) & 0x01)
+#define MXT_ADR_T15_XORIGIN 0x01
+#define MXT_ADR_T15_YORIGIN 0x02
+#define MXT_ADR_T15_XSIZE 0x03
+#define MXT_ADR_T15_YSIZE 0x04
+#define MXT_ADR_T15_AKSCFG 0x05
+#define MXT_ADR_T15_BLEN 0x06
+#define MXT_T15_CFGBF_BL(x) (x & 0x0F)
+#define MXT_T15_CFGBF_GAIN(x) ((x >> 4) & 0x0F)
+#define MXT_ADR_T15_TCHTHR 0x07
+#define MXT_ADR_T15_TCHDI 0x08
+#define MXT_ADR_T15_RESERVED1 0x09
+#define MXT_ADR_T15_RESERVED2 0x0a
+
+/* Adress Definitions for SPT_GPIOPWM_T19 Address Definitions */
+#define MXT_ADR_T19_CTRL 0x00
+#define MXT_ADR_T19_REPORTMASK 0x01
+#define MXT_ADR_T19_DIR 0x02
+#define MXT_ADR_T19_INTPULLUP 0x03
+#define MXT_ADR_T19_OUT 0x04
+#define MXT_ADR_T19_WAKE 0x05
+#define MXT_ADR_T19_PWM 0x06
+#define MXT_ADR_T19_PERIOD 0x07
+/* 32 bit */
+#define MXT_ADR_T19_DUTY 0x08
+
+/* PROCI_GRIPFACESUPPRESSION_T20 Address Definitions */
+#define MXT_ADR_T20_CTRL 0x00
+#define MXT_ADR_T20_XLOGRIP 0x01
+#define MXT_ADR_T20_XHIGRIP 0x02
+#define MXT_ADR_T20_YLOGRIP 0x03
+#define MXT_ADR_T20_YHIGRIP 0x04
+#define MXT_ADR_T20_MAXTCHS 0x05
+#define MXT_ADR_T20_RESERVED 0x06
+#define MXT_ADR_T20_SZTHR1 0x07
+#define MXT_ADR_T20_SZTHR2 0x08
+#define MXT_ADR_T20_SHPTHR1 0x09
+#define MXT_ADR_T20_SHPTHR2 0x0a
+#define MXT_ADR_T20_SUPEXTTO 0x0b
+
+/* PROCG_NOISESUPPRESSION_T22 Address Definitions */
+#define MXT_ADR_T22_CTRL 0x00
+/* 16 bit */
+#define MXT_ADR_T22_RESERVED1_2 0x01
+/* 16 bit */
+#define MXT_ADR_T22_GCAFUL 0x03
+/* 16 bit */
+#define MXT_ADR_T22_GCAFLL 0x05
+#define MXT_ADR_T22_ACTVGCAFVALID 0x07
+#define MXT_ADR_T22_NOISETHR 0x08
+#define MXT_ADR_T22_RESERVED9 0x09
+#define MXT_ADR_T22_FREQHOPSCALE 0x0a
+/* 5 bytes */
+#define MXT_ADR_T22_FREQ 0x0b
+#define MXT_ADR_T22_IDLEGCAFVALID 0x10
+
+/* TOUCH_PROXIMITY_T23 Address Definitions */
+#define MXT_ADR_T23_CTRL 0x00
+#define MXT_ADR_T23_XORIGIN 0x01
+#define MXT_ADR_T23_YORIGIN 0x02
+#define MXT_ADR_T23_XSIZE 0x03
+#define MXT_ADR_T23_YSIZE 0x04
+#define MXT_ADR_T23_RESERVED 0x05
+#define MXT_ADR_T23_BLEN 0x06
+#define MXT_ADR_T23_TCHTHR 0x07
+#define MXT_ADR_T23_TCHDI 0x09
+#define MXT_ADR_T23_AVERAGE 0x0a
+/* 16 bit */
+#define MXT_ADR_T23_RATE 0x0b
+
+/* PROCI_ONETOUCHGESTUREPROCESSOR_T24 Address Definitions */
+#define MXT_ADR_T24_CTRL 0x00
+#define MXT_ADR_T24_NUMGEST 0x01
+/* 16 bit */
+#define MXT_ADR_T24_GESTEN 0x02
+#define MXT_ADR_T24_PRESSPROC 0x04
+#define MXT_ADR_T24_TAPTO 0x05
+#define MXT_ADR_T24_FLICKTO 0x06
+#define MXT_ADR_T24_DRAGTO 0x07
+#define MXT_ADR_T24_SPRESSTO 0x08
+#define MXT_ADR_T24_LPRESSTO 0x09
+#define MXT_ADR_T24_REPPRESSTO 0x0a
+/* 16 bit */
+#define MXT_ADR_T24_FLICKTHR 0x0b
+/* 16 bit */
+#define MXT_ADR_T24_DRAGTHR 0x0d
+/* 16 bit */
+#define MXT_ADR_T24_TAPTHR 0x0f
+/* 16 bit */
+#define MXT_ADR_T24_THROWTHR 0x11
+
+/* SPT_SELFTEST_T25 Address Definitions */
+#define MXT_ADR_T25_CTRL 0x00
+#define MXT_ADR_T25_CMD 0x01
+/* 16 bit */
+#define MXT_ADR_T25_HISIGLIM0 0x02
+/* 16 bit */
+#define MXT_ADR_T25_LOSIGLIM0 0x04
+
+/* PROCI_TWOTOUCHGESTUREPROCESSOR_T27 Address Definitions */
+#define MXT_ADR_T27_CTRL 0x00
+#define MXT_ADR_T27_NUMGEST 0x01
+#define MXT_ADR_T27_RESERVED2 0x02
+#define MXT_ADR_T27_GESTEN 0x03
+#define MXT_ADR_T27_ROTATETHR 0x04
+
+/* 16 bit */
+#define MXT_ADR_T27_ZOOMTHR 0x05
+
+/* SPT_CTECONFIG_T28 Address Definitions */
+#define MXT_ADR_T28_CTRL 0x00
+#define MXT_ADR_T28_CMD 0x01
+#define MXT_ADR_T28_MODE 0x02
+#define MXT_ADR_T28_IDLEGCAFDEPTH 0x03
+#define MXT_ADR_T28_ACTVGCAFDEPTH 0x04
+
+/* DEBUG_DIAGNOSTICS_T37 Address Definitions */
+#define MXT_ADR_T37_MODE 0x00
+#define MXT_ADR_T37_PAGE 0x01
+#define MXT_ADR_T37_DATA 0x02
+
+/************************************************************************
+ * MESSAGE OBJECTS ADDRESS FIELDS
+ *
+ ************************************************************************/
+#define MXT_MSG_REPORTID 0x00
+
+
+/* MXT_GEN_MESSAGEPROCESSOR_T5 Message address definitions */
+#define MXT_MSG_T5_REPORTID 0x00
+#define MXT_MSG_T5_MESSAGE 0x01
+#define MXT_MSG_T5_CHECKSUM 0x08
+
+/* MXT_GEN_COMMANDPROCESSOR_T6 Message address definitions */
+#define MXT_MSG_T6_STATUS 0x01
+#define MXT_MSGB_T6_COMSERR 0x04
+#define MXT_MSGB_T6_CFGERR 0x08
+#define MXT_MSGB_T6_CAL 0x10
+#define MXT_MSGB_T6_SIGERR 0x20
+#define MXT_MSGB_T6_OFL 0x40
+#define MXT_MSGB_T6_RESET 0x80
+/* Three bytes */
+#define MXT_MSG_T6_CHECKSUM 0x02
+
+/* MXT_GEN_POWERCONFIG_T7 NO Message address definitions */
+/* MXT_GEN_ACQUIRECONFIG_T8 Message address definitions */
+/* MXT_TOUCH_MULTITOUCHSCREEN_T9 Message address definitions */
+
+#define MXT_MSG_T9_STATUS 0x01
+/* Status bit field */
+#define MXT_MSGB_T9_SUPPRESS 0x02
+#define MXT_MSGB_T9_AMP 0x04
+#define MXT_MSGB_T9_VECTOR 0x08
+#define MXT_MSGB_T9_MOVE 0x10
+#define MXT_MSGB_T9_RELEASE 0x20
+#define MXT_MSGB_T9_PRESS 0x40
+#define MXT_MSGB_T9_DETECT 0x80
+
+#define MXT_MSG_T9_XPOSMSB 0x02
+#define MXT_MSG_T9_YPOSMSB 0x03
+#define MXT_MSG_T9_XYPOSLSB 0x04
+#define MXT_MSG_T9_TCHAREA 0x05
+#define MXT_MSG_T9_TCHAMPLITUDE 0x06
+#define MXT_MSG_T9_TCHVECTOR 0x07
+
+/* MXT_TOUCH_KEYARRAY_T15 Message address definitions */
+#define MXT_MSG_T15_STATUS 0x01
+#define MXT_MSGB_T15_DETECT 0x80
+/* 4 bytes */
+#define MXT_MSG_T15_KEYSTATE 0x02
+
+/* MXT_SPT_GPIOPWM_T19 Message address definitions */
+#define MXT_MSG_T19_STATUS 0x01
+
+/* MXT_PROCI_GRIPFACESUPPRESSION_T20 Message address definitions */
+#define MXT_MSG_T20_STATUS 0x01
+#define MXT_MSGB_T20_FACE_SUPPRESS 0x01
+/* MXT_PROCG_NOISESUPPRESSION_T22 Message address definitions */
+#define MXT_MSG_T22_STATUS 0x01
+#define MXT_MSGB_T22_FHCHG 0x01
+#define MXT_MSGB_T22_GCAFERR 0x04
+#define MXT_MSGB_T22_FHERR 0x08
+#define MXT_MSG_T22_GCAFDEPTH 0x02
+
+/* MXT_TOUCH_PROXIMITY_T23 Message address definitions */
+#define MXT_MSG_T23_STATUS 0x01
+#define MXT_MSGB_T23_FALL 0x20
+#define MXT_MSGB_T23_RISE 0x40
+#define MXT_MSGB_T23_DETECT 0x80
+/* 16 bit */
+#define MXT_MSG_T23_PROXDELTA 0x02
+
+/* MXT_PROCI_ONETOUCHGESTUREPROCESSOR_T24 Message address definitions */
+#define MXT_MSG_T24_STATUS 0x01
+#define MXT_MSG_T24_XPOSMSB 0x02
+#define MXT_MSG_T24_YPOSMSB 0x03
+#define MXT_MSG_T24_XYPOSLSB 0x04
+#define MXT_MSG_T24_DIR 0x05
+/* 16 bit */
+#define MXT_MSG_T24_DIST 0x06
+
+/* MXT_SPT_SELFTEST_T25 Message address definitions */
+#define MXT_MSG_T25_STATUS 0x01
+/* 5 Bytes */
+#define MXT_MSGR_T25_OK 0xFE
+#define MXT_MSGR_T25_INVALID_TEST 0xFD
+#define MXT_MSGR_T25_PIN_FAULT 0x11
+#define MXT_MSGR_T25_SIGNAL_LIMIT_FAULT 0x17
+#define MXT_MSGR_T25_GAIN_ERROR 0x20
+#define MXT_MSG_T25_INFO 0x02
+
+/* MXT_PROCI_TWOTOUCHGESTUREPROCESSOR_T27 Message address definitions */
+#define MXT_MSG_T27_STATUS 0x01
+#define MXT_MSGB_T27_ROTATEDIR 0x10
+#define MXT_MSGB_T27_PINCH 0x20
+#define MXT_MSGB_T27_ROTATE 0x40
+#define MXT_MSGB_T27_STRETCH 0x80
+#define MXT_MSG_T27_XPOSMSB 0x02
+#define MXT_MSG_T27_YPOSMSB 0x03
+#define MXT_MSG_T27_XYPOSLSB 0x04
+#define MXT_MSG_T27_ANGLE 0x05
+
+/* 16 bit */
+#define MXT_MSG_T27_SEPARATION 0x06
+
+/* MXT_SPT_CTECONFIG_T28 Message address definitions */
+#define MXT_MSG_T28_STATUS 0x01
+#define MXT_MSGB_T28_CHKERR 0x01
+
+/* MXT_DEBUG_DIAGNOSTICS_T37 NO Message address definitions */
+
+/* One Touch Events */
+#define MT_GESTURE_RESERVED 0x00
+#define MT_GESTURE_PRESS 0x01
+#define MT_GESTURE_RELEASE 0x02
+#define MT_GESTURE_TAP 0x03
+#define MT_GESTURE_DOUBLE_TAP 0x04
+#define MT_GESTURE_FLICK 0x05
+#define MT_GESTURE_DRAG 0x06
+#define MT_GESTURE_SHORT_PRESS 0x07
+#define MT_GESTURE_LONG_PRESS 0x08
+#define MT_GESTURE_REPEAT_PRESS 0x09
+#define MT_GESTURE_TAP_AND_PRESS 0x0a
+#define MT_GESTURE_THROW 0x0b
+
+/* reset mode */
+#define RESET_TO_NORMAL 0
+#define RESET_TO_BOOTLOADER 1
+
+/* Bootloader states */
+#define WAITING_BOOTLOAD_COMMAND 0xC0
+#define WAITING_FRAME_DATA 0x80
+#define FRAME_CRC_CHECK 0x02
+#define FRAME_CRC_PASS 0x04
+#define FRAME_CRC_FAIL 0x03
+#define APP_CRC_FAIL 0x40
+#define BOOTLOAD_STATUS_MASK 0x3f /* 0011 1111*/
+
+#define MXT_MAX_FRAME_SIZE 532/*276*/
+
+/* Firmware */
+#define MXT1386_FIRMWARE "mxt1386.fw"
+
+/* level of debugging messages */
+#define DEBUG_INFO 1
+#define DEBUG_VERBOSE 2
+#define DEBUG_MESSAGES 5
+#define DEBUG_RAW 8
+#define DEBUG_TRACE 10
+
+#define TSP_STATE_INACTIVE -1
+#define TSP_STATE_RELEASE 0
+#define TSP_STATE_PRESS 1
+#define TSP_STATE_MOVE 2
+
+extern struct class *sec_class;
+
+/* Device Info descriptor */
+/* Parsed from maXTouch "Id information" inside device */
+struct mxt_device_info {
+ u8 family_id;
+ u8 variant_id;
+ u8 major;
+ u8 minor;
+ u8 build;
+ u8 num_objs;
+ u8 x_size;
+ u8 y_size;
+ u8 family[16]; /* Family name */
+ u8 variant[16]; /* Variant name */
+ u16 num_nodes; /* Number of sensor nodes */
+};
+
+/* object descriptor table, parsed from maXTouch "object table" */
+struct mxt_object {
+ u8 type;
+ u16 chip_addr;
+ u8 size;
+ u8 instances;
+ u8 num_report_ids;
+};
+
+/* Mapping from report id to object type and instance */
+struct report_id_map {
+ u8 object;
+ u8 instance;
+/*
+ * This is the first report ID belonging to object. It enables us to
+ * find out easily the touch number: each touch has different report
+ * ID (which are assigned to touches in increasing order). By
+ * subtracting the first report ID from current, we get the touch
+ * number.
+ */
+ u8 first_rid;
+};
+
+
+/*mxt configuration data*/
+__packed struct gen_commandprocessor_t6_config_t{
+ /* Force chip reset */
+ uint8_t reset;
+ /* Force backup to eeprom/flash */
+ uint8_t backupnv;
+ /* Force recalibration */
+ uint8_t calibrate;
+ /* Force all objects to report */
+ uint8_t reportall;
+ uint8_t reserved;
+ /* Controls the diagnostic object */
+ uint8_t diagnostic;
+};
+
+__packed struct gen_powerconfig_t7_config_t{
+ /* Idle power mode sleep length in ms */
+ uint8_t idleacqint;
+ /* Active power mode sleep length in ms */
+ uint8_t actvacqint;
+ /* Active to idle power mode delay length in units of 0.2s*/
+ uint8_t actv2idleto;
+};
+
+__packed struct gen_acquisitionconfig_t8_config_t{
+ /* Charge-transfer dwell time */
+ uint8_t chrgtime;
+ /* reserved */
+ uint8_t reserved;
+ /* Touch drift compensation period */
+ uint8_t tchdrift;
+ /* Drift suspend time */
+ uint8_t driftst;
+ /* Touch automatic calibration delay in units of 0.2s*/
+ uint8_t tchautocal;
+ /* Measurement synchronisation control */
+ uint8_t sync;
+ /* recalibration suspend time after last detection */
+ uint8_t atchcalst;
+ /* Anti-touch calibration suspend threshold */
+ uint8_t atchcalsthr;
+ uint8_t atchcalfrcthr;
+ uint8_t atchcalfrcratio;
+};
+
+__packed struct touch_multitouchscreen_t9_config_t{
+ /* Screen Configuration */
+ /* ACENABLE LCENABLE Main configuration field */
+ uint8_t ctrl;
+
+ /* Physical Configuration */
+ /* LCMASK ACMASK Object x start position on matrix */
+ uint8_t xorigin;
+ /* LCMASK ACMASK Object y start position on matrix */
+ uint8_t yorigin;
+ /* LCMASK ACMASK Object x size (i.e. width) */
+ uint8_t xsize;
+ /* LCMASK ACMASK Object y size (i.e. height) */
+ uint8_t ysize;
+
+ /* Detection Configuration */
+ /* Adjacent key suppression config */
+ uint8_t akscfg;
+ /* Sets the gain of the analog circuits in front
+ * of the ADC. The gain should be set in
+ * conjunction with the burst length to optimize
+ * the signal acquisition. Maximum gain values for
+ * a given object/burst length can be obtained following
+ * a full calibration of the system. GAIN
+ * has a maximum setting of 4; settings above 4 are capped at 4.*/
+ uint8_t blen;
+ /* ACMASK Threshold for all object channels */
+ uint8_t tchthr;
+ /* Detect integration config */
+ uint8_t tchdi;
+ /* LCMASK Controls flipping and rotating of touchscreen object */
+ uint8_t orient;
+ /* Timeout on how long a touch might ever stay
+ * merged - units of 0.2s, used to tradeoff power
+ * consumption against being able to detect a touch
+ * de-merging early */
+ uint8_t mrgtimeout;
+
+ /* Position Filter Configuration */
+ /* Movement hysteresis setting used after touchdown */
+ uint8_t movhysti;
+ /* Movement hysteresis setting used once dragging */
+ uint8_t movhystn;
+ /* Position filter setting controlling the rate of */
+ uint8_t movfilter;
+
+ /* Multitouch Configuration */
+ /* The number of touches that the screen will attempt
+ * to track */
+ uint8_t numtouch;
+ /* The hysteresis applied on top of the merge threshold
+ * to stop oscillation */
+ uint8_t mrghyst;
+ /* The threshold for the point when two peaks are
+ * considered one touch */
+ uint8_t mrgthr;
+ uint8_t amphyst; /* TBD */
+
+ /* Resolution Controls */
+ uint16_t xrange; /* LCMASK */
+ uint16_t yrange; /* LCMASK */
+ uint8_t xloclip; /* LCMASK */
+ uint8_t xhiclip; /* LCMASK */
+ uint8_t yloclip; /* LCMASK */
+ uint8_t yhiclip; /* LCMASK */
+ /* edge correction controls */
+ uint8_t xedgectrl; /* LCMASK */
+ uint8_t xedgedist; /* LCMASK */
+ uint8_t yedgectrl; /* LCMASK */
+ uint8_t yedgedist; /* LCMASK */
+ uint8_t jumplimit;
+ uint8_t tchhyst;
+ uint8_t xpitch;
+ uint8_t ypitch;
+};
+
+__packed struct procg_noisesuppression_t22_config_t{
+ uint8_t ctrl;
+ uint8_t reserved;
+ uint8_t reserved1;
+ uint8_t reserved2;
+ uint8_t reserved3;
+ uint8_t reserved4;
+ uint8_t reserved5;
+ uint8_t reserved6;
+ uint8_t noisethr;
+ uint8_t reserved7;
+ uint8_t freqhopscale;
+ uint8_t freq[5u]; /* LCMASK ACMASK */
+ uint8_t reserved8; /* LCMASK */
+};
+
+__packed struct spt_cteconfig_t28_config_t{
+ /* Ctrl field reserved for future expansion */
+ uint8_t ctrl;
+ /* Cmd field for sending CTE commands */
+ uint8_t cmd;
+ /* LCMASK CTE mode configuration field */
+ uint8_t mode;
+ /* LCMASK The global gcaf number of averages when idle */
+ uint8_t idlegcafdepth;
+ /* LCMASK The global gcaf number of averages when active */
+ uint8_t actvgcafdepth;
+ uint8_t voltage;
+};
+
+__packed struct proci_gripsuppression_t40_config_t{
+ uint8_t ctrl;
+ uint8_t xlogrip;
+ uint8_t xhigrip;
+ uint8_t ylogrip;
+ uint8_t yhigrip;
+};
+
+__packed struct proci_palmsuppression_t41_config_t{
+ uint8_t ctrl;
+ uint8_t reserved1;
+ uint8_t reserved2;
+ uint8_t largeobjthr;
+ uint8_t distancethr;
+ uint8_t supextto;
+};
+
+struct multi_touch_info {
+ uint16_t size;
+ int16_t pressure;
+ int16_t x;
+ int16_t y;
+ int status;
+};
+
+struct mxt_callbacks {
+ void (*inform_charger)(struct mxt_callbacks *, int mode);
+};
+
+struct mxt_platform_data {
+ u8 numtouch; /* Number of touches to report */
+ u8 (*valid_interrupt) (void);
+ void (*init_platform_hw)(void);
+ void (*exit_platform_hw)(void);
+ void (*suspend_platform_hw)(void);
+ void (*resume_platform_hw)(void);
+ void (*register_cb)(struct mxt_callbacks *);
+ int max_x; /* The default reported X range */
+ int max_y; /* The default reported Y range */
+ struct gen_powerconfig_t7_config_t power_config;
+ struct gen_acquisitionconfig_t8_config_t acquisition_config;
+ struct touch_multitouchscreen_t9_config_t touchscreen_config;
+ struct procg_noisesuppression_t22_config_t noise_suppression_config;
+ struct spt_cteconfig_t28_config_t cte_config;
+ struct proci_gripsuppression_t40_config_t gripsupression_config;
+ struct proci_palmsuppression_t41_config_t palmsupression_config;
+ uint8_t idleacqint_for_ta_connect;
+ uint8_t tchthr_for_ta_connect;
+ uint8_t tchdi_for_ta_connect;
+ uint8_t noisethr_for_ta_connect;
+ uint8_t idlegcafdepth_ta_connect;
+ u16 fherr_cnt;
+ u16 fherr_chg_cnt;
+ uint8_t tch_blen_for_fherr;
+ uint8_t tchthr_for_fherr;
+ uint8_t noisethr_for_fherr;
+ uint8_t movefilter_for_fherr;
+ uint8_t jumplimit_for_fherr;
+ uint8_t freqhopscale_for_fherr;
+ uint8_t freq_for_fherr1[5];
+ uint8_t freq_for_fherr2[5];
+ uint8_t freq_for_fherr3[5];
+ u16 fherr_cnt_no_ta;
+ u16 fherr_chg_cnt_no_ta;
+ uint8_t tch_blen_for_fherr_no_ta;
+ uint8_t tchthr_for_fherr_no_ta;
+ uint8_t movfilter_fherr_no_ta;
+ uint8_t noisethr_for_fherr_no_ta;
+#ifdef MXT_CALIBRATE_WORKAROUND
+ /* recalibration suspend time after last detection */
+ uint8_t atchcalst_idle;
+ /* Anti-touch calibration suspend threshold */
+ uint8_t atchcalsthr_idle;
+ uint8_t atchcalfrcthr_idle;
+ uint8_t atchcalfrcratio_idle;
+#endif
+};
+
+/* Driver datastructure */
+struct mxt_data {
+ struct mxt_device_info device_info;
+ struct i2c_client *client;
+ struct input_dev *input;
+ struct mxt_platform_data *pdata;
+ struct delayed_work firmup_dwork;
+ struct delayed_work dwork;
+ struct work_struct ta_work;
+ struct work_struct fhe_work;
+ struct report_id_map *rid_map;
+ struct mxt_object *object_table;
+ struct wake_lock wakelock;
+ struct mxt_callbacks callbacks;
+ struct mutex mutex;
+#ifdef MXT_CALIBRATE_WORKAROUND
+ struct delayed_work calibrate_dwork;
+#endif
+#ifdef CONFIG_HAS_EARLYSUSPEND
+ struct early_suspend early_suspend;
+#endif
+ struct multi_touch_info mtouch_info[MXT_MAX_NUM_TOUCHES];
+#ifdef CONFIG_SEC_TOUCHSCREEN_DVFS_LOCK
+ struct delayed_work dvfs_dwork;
+ u32 cpufreq_level;
+ bool dvfs_lock_status;
+#endif
+ bool new_msgs;
+ bool fherr_cnt_no_ta_calready;
+ char phys_name[32];
+ int irq;
+ int valid_irq_counter;
+ int invalid_irq_counter;
+ int irq_counter;
+ int message_counter;
+ int read_fail_counter;
+ int bytes_to_read;
+ s16 *delta;
+ u8 *last_message;
+ u8 xpos_format;
+ u8 ypos_format;
+ u8 message_size;
+ u8 firm_status_data;
+ u8 firm_normal_status_ack;
+ u16 last_read_addr;
+ u16 report_id_count;
+ u16 msg_proc_addr;
+ u16 *reference;
+ u16 *cte;
+ u16 set_mode_for_ta;
+ u16 enabled;
+ u32 info_block_crc;
+ u32 configuration_crc;
+ spinlock_t lock;
+ wait_queue_head_t msg_queue;
+ /* for the factory test */
+ u32 index;
+ s16 delta_data[MXT1386_MAX_CHANNEL];
+ u16 ref_data[MXT1386_MAX_CHANNEL];
+};
+
+enum tsp_ta_settings {
+ TSP_SETTING_IDLEACQINT = 0,
+ TSP_SETTING_BLEN,
+ TSP_SETTING_TCHTHR,
+ TSP_SETTING_NOISETHR,
+ TSP_SETTING_IDLEDEPTH,
+ TSP_SETTING_MOVEFILTER,
+ TSP_SETTING_FREQUENCY,
+ TSP_SETTING_FREQ_SCALE,
+ TSP_SETTING_JUMPLIMIT,
+ TSP_SETTING_MAX,
+};
+
+#define SET_BIT(nr, val) (nr |= (0x1 << val))
+
+/* Returns the start address of object in mXT memory. */
+#define MXT_BASE_ADDR(object_type) \
+get_object_address(object_type, 0, mxt->object_table, mxt->device_info.num_objs)
+
+/* Returns the size of object in mXT memory. */
+#define MXT_GET_SIZE(object_type) \
+get_object_size(object_type, mxt->object_table, mxt->device_info.num_objs)
+
+/* Routines for memory access within a 16 bit address space */
+int mxt_read_byte(
+ struct i2c_client *client,
+ __u16 addr,
+ __u8 *value
+ );
+int mxt_write_byte(
+ struct i2c_client *client,
+ __u16 addr,
+ __u8 value
+ );
+int mxt_write_block(
+ struct i2c_client *client,
+ __u16 addr,
+ __u16 length,
+ __u8 *value
+ );
+
+#if 1
+/* Should be implemented in board support */
+u8 mxt_valid_interrupt(void);
+#else
+#define mxt_valid_interrupt() 1
+#endif
+
+void mxt_hw_reset(void);
+
+#endif /* _LINUX_MXT1386_H */
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 5ffc6dd..237e090 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -55,10 +55,12 @@ struct backlight_ops {
/* Check if given framebuffer device is the one bound to this backlight;
return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */
int (*check_fb)(struct backlight_device *, struct fb_info *);
+ int (*set_dimming)(struct backlight_device *);
};
/* This structure defines all the properties of a backlight */
struct backlight_properties {
+ bool dimming;
/* Current User requested brightness (0 - max_brightness) */
int brightness;
/* Maximal value for brightness (read-only) */
@@ -111,12 +113,20 @@ static inline void backlight_update_status(struct backlight_device *bd)
mutex_unlock(&bd->update_lock);
}
+static inline void backlight_set_dimming(struct backlight_device *bd)
+{
+ if (bd->ops && bd->ops->set_dimming)
+ bd->ops->set_dimming(bd);
+}
+
extern struct backlight_device *backlight_device_register(const char *name,
struct device *dev, void *devdata, const struct backlight_ops *ops,
const struct backlight_properties *props);
extern void backlight_device_unregister(struct backlight_device *bd);
extern void backlight_force_update(struct backlight_device *bd,
enum backlight_update_reason reason);
+extern int backlight_dimming_mode_register_client(struct notifier_block *nb);
+extern int backlight_dimming_mode_unregister_client(struct notifier_block *nb);
#define to_backlight_device(obj) container_of(obj, struct backlight_device, dev)
diff --git a/include/linux/battery/charger/bq24190_charger.h b/include/linux/battery/charger/bq24190_charger.h
new file mode 100644
index 0000000..9302981
--- /dev/null
+++ b/include/linux/battery/charger/bq24190_charger.h
@@ -0,0 +1,60 @@
+/*
+ * bq24190_charger.h
+ * Samsung SMB328 Charger Header
+ *
+ * Copyright (C) 2012 Samsung Electronics, Inc.
+ *
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __BQ24190_CHARGER_H
+#define __BQ24190_CHARGER_H __FILE__
+
+/* Slave address should be shifted to the right 1bit.
+ * R/W bit should NOT be included.
+ */
+#if defined(CONFIG_CHARGER_BQ24191)
+#define SEC_CHARGER_I2C_SLAVEADDR 0x6a
+#else
+/* bq24190, bq24192 */
+#define SEC_CHARGER_I2C_SLAVEADDR 0x6b
+#endif
+
+#define BQ24190_CHARGING_ENABLE 0x20
+#define BQ24190_CHARGING_DONE 0x30
+
+/* BQ2419x Registers */
+
+/* Input Source Control */
+#define BQ24190_REG_INSRC 0x00
+/* Power-On Configuration */
+#define BQ24190_REG_PWRON_CFG 0x01
+/* Charge Current Control */
+#define BQ24190_REG_CHRG_C 0x02
+/* Pre-charge/Termination Current Control */
+#define BQ24190_REG_PCHRG_TRM_C 0x03
+/* Charge Voltage Control */
+#define BQ24190_REG_CHRG_V 0x04
+/* Charge Termination/Timer Control */
+#define BQ24190_REG_CHRG_TRM_TMR 0x05
+/* IR Compensation / Thermal Regulation Control */
+#define BQ24190_REG_IRCMP_TREG 0x06
+/* Misc Operation Control */
+#define BQ24190_REG_MISC_OP 0x07
+/* System Status */
+#define BQ24190_REG_STATUS 0x08
+/* Fault */
+#define BQ24190_REG_FAULT 0x09
+/* Vendor / Part / Revision Status */
+#define BQ24190_REG_DEVID 0x0A
+
+#endif /* __BQ24190_CHARGER_H */
diff --git a/include/linux/battery/charger/dummy_charger.h b/include/linux/battery/charger/dummy_charger.h
new file mode 100644
index 0000000..66100b7
--- /dev/null
+++ b/include/linux/battery/charger/dummy_charger.h
@@ -0,0 +1,27 @@
+/*
+ * dummy_charger.h
+ * Samsung dummy Charger Header
+ *
+ * Copyright (C) 2012 Samsung Electronics, Inc.
+ *
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __DUMMY_CHARGER_H
+#define __DUMMY_CHARGER_H __FILE__
+
+/* Slave address should be shifted to the right 1bit.
+ * R/W bit should NOT be included.
+ */
+#define SEC_CHARGER_I2C_SLAVEADDR 0x00
+
+#endif /* __DUMMY_CHARGER_H */
diff --git a/include/linux/battery/charger/max8903_charger.h b/include/linux/battery/charger/max8903_charger.h
new file mode 100644
index 0000000..2f42343
--- /dev/null
+++ b/include/linux/battery/charger/max8903_charger.h
@@ -0,0 +1,27 @@
+/*
+ * max8903_charger.h
+ * Samsung MAX8903 Charger Header
+ *
+ * Copyright (C) 2012 Samsung Electronics, Inc.
+ *
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MAX8903_CHARGER_H
+#define __MAX8903_CHARGER_H __FILE__
+
+/* Slave address should be shifted to the right 1bit.
+ * R/W bit should NOT be included.
+ */
+#define SEC_CHARGER_I2C_SLAVEADDR 0x00
+
+#endif /* __MAX8903_CHARGER_H */
diff --git a/include/linux/battery/charger/smb328_charger.h b/include/linux/battery/charger/smb328_charger.h
new file mode 100644
index 0000000..26f3d01
--- /dev/null
+++ b/include/linux/battery/charger/smb328_charger.h
@@ -0,0 +1,51 @@
+/*
+ * smb328_charger.h
+ * Samsung SMB328 Charger Header
+ *
+ * Copyright (C) 2012 Samsung Electronics, Inc.
+ *
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __SMB328_CHARGER_H
+#define __SMB328_CHARGER_H __FILE__
+
+/* Slave address should be shifted to the right 1bit.
+ * R/W bit should NOT be included.
+ */
+#define SEC_CHARGER_I2C_SLAVEADDR (0x69>>1)
+
+/* Register define */
+#define SMB328A_INPUT_AND_CHARGE_CURRENTS 0x00
+#define SMB328A_CURRENT_TERMINATION 0x01
+#define SMB328A_FLOAT_VOLTAGE 0x02
+#define SMB328A_FUNCTION_CONTROL_A1 0x03
+#define SMB328A_FUNCTION_CONTROL_A2 0x04
+#define SMB328A_FUNCTION_CONTROL_B 0x05
+#define SMB328A_OTG_PWR_AND_LDO_CONTROL 0x06
+#define SMB328A_VARIOUS_CONTROL_FUNCTION_A 0x07
+#define SMB328A_CELL_TEMPERATURE_MONITOR 0x08
+#define SMB328A_INTERRUPT_SIGNAL_SELECTION 0x09
+#define SMB328A_I2C_BUS_SLAVE_ADDRESS 0x0A
+
+#define SMB328A_CLEAR_IRQ 0x30
+#define SMB328A_COMMAND 0x31
+#define SMB328A_INTERRUPT_STATUS_A 0x32
+#define SMB328A_BATTERY_CHARGING_STATUS_A 0x33
+#define SMB328A_INTERRUPT_STATUS_B 0x34
+#define SMB328A_BATTERY_CHARGING_STATUS_B 0x35
+#define SMB328A_BATTERY_CHARGING_STATUS_C 0x36
+#define SMB328A_INTERRUPT_STATUS_C 0x37
+#define SMB328A_BATTERY_CHARGING_STATUS_D 0x38
+#define SMB328A_AUTOMATIC_INPUT_CURRENT_LIMMIT_STATUS 0x39
+
+#endif /* __SMB328_CHARGER_H */
diff --git a/include/linux/battery/fuelgauge/dummy_fuelgauge.h b/include/linux/battery/fuelgauge/dummy_fuelgauge.h
new file mode 100644
index 0000000..14c466c
--- /dev/null
+++ b/include/linux/battery/fuelgauge/dummy_fuelgauge.h
@@ -0,0 +1,30 @@
+/*
+ * dummy_fuelgauge.h
+ * Samsung Dummy Fuel Gauge Header
+ *
+ * Copyright (C) 2012 Samsung Electronics, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __DUMMY_FUELGAUGE_H
+#define __DUMMY_FUELGAUGE_H __FILE__
+
+/* Slave address should be shifted to the right 1bit.
+ * R/W bit should NOT be included.
+ */
+#define SEC_FUELGAUGE_I2C_SLAVEADDR 0x00
+
+struct sec_fg_info {
+ bool dummy;
+};
+
+#endif /* __DUMMY_FUELGAUGE_H */
diff --git a/include/linux/battery/fuelgauge/max17042_fuelgauge.h b/include/linux/battery/fuelgauge/max17042_fuelgauge.h
new file mode 100644
index 0000000..5513523
--- /dev/null
+++ b/include/linux/battery/fuelgauge/max17042_fuelgauge.h
@@ -0,0 +1,382 @@
+/*
+ * max17042_fuelgauge.h
+ * Samsung MAX17042 Fuel Gauge Header
+ *
+ * Copyright (C) 2012 Samsung Electronics, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MAX17042_FUELGAUGE_H
+#define __MAX17042_FUELGAUGE_H __FILE__
+
+/* Slave address should be shifted to the right 1bit.
+ * R/W bit should NOT be included.
+ */
+#define SEC_FUELGAUGE_I2C_SLAVEADDR 0x36
+
+#if defined(CONFIG_FUELGAUGE_MAX17042_VOLTAGE_TRACKING)
+#define MAX17042_REG_STATUS 0x00
+#define MAX17042_REG_VALRT_TH 0x01
+#define MAX17042_REG_TALRT_TH 0x02
+#define MAX17042_REG_SALRT_TH 0x03
+#define MAX17042_REG_VCELL 0x09
+#define MAX17042_REG_TEMPERATURE 0x08
+#define MAX17042_REG_AVGVCELL 0x19
+#define MAX17042_REG_CONFIG 0x1D
+#define MAX17042_REG_VERSION 0x21
+#define MAX17042_REG_LEARNCFG 0x28
+#define MAX17042_REG_FILTERCFG 0x29
+#define MAX17042_REG_MISCCFG 0x2B
+#define MAX17042_REG_CGAIN 0x2E
+#define MAX17042_REG_RCOMP 0x38
+#define MAX17042_REG_VFOCV 0xFB
+#define MAX17042_REG_SOC_VF 0xFF
+
+struct sec_fg_info {
+ bool dummy;
+};
+
+#endif
+
+#if defined(CONFIG_FUELGAUGE_MAX17042_COULOMB_COUNTING)
+#define PRINT_COUNT 10
+
+/* Register address */
+#define STATUS_REG 0x00
+#define VALRT_THRESHOLD_REG 0x01
+#define TALRT_THRESHOLD_REG 0x02
+#define SALRT_THRESHOLD_REG 0x03
+#define REMCAP_REP_REG 0x05
+#define SOCREP_REG 0x06
+#define TEMPERATURE_REG 0x08
+#define VCELL_REG 0x09
+#define CURRENT_REG 0x0A
+#define AVG_CURRENT_REG 0x0B
+#define SOCMIX_REG 0x0D
+#define SOCAV_REG 0x0E
+#define REMCAP_MIX_REG 0x0F
+#define FULLCAP_REG 0x10
+#define RFAST_REG 0x15
+#define AVR_TEMPERATURE_REG 0x16
+#define CYCLES_REG 0x17
+#define DESIGNCAP_REG 0x18
+#define AVR_VCELL_REG 0x19
+#define CONFIG_REG 0x1D
+#define REMCAP_AV_REG 0x1F
+#define FULLCAP_NOM_REG 0x23
+#define MISCCFG_REG 0x2B
+#define RCOMP_REG 0x38
+#define FSTAT_REG 0x3D
+#define DQACC_REG 0x45
+#define DPACC_REG 0x46
+#define OCV_REG 0xEE
+#define VFOCV_REG 0xFB
+#define VFSOC_REG 0xFF
+
+#define FG_LEVEL 0
+#define FG_TEMPERATURE 1
+#define FG_VOLTAGE 2
+#define FG_CURRENT 3
+#define FG_CURRENT_AVG 4
+#define FG_BATTERY_TYPE 5
+#define FG_CHECK_STATUS 6
+#define FG_VF_SOC 7
+
+#define LOW_BATT_COMP_RANGE_NUM 5
+#define LOW_BATT_COMP_LEVEL_NUM 2
+#define MAX_LOW_BATT_CHECK_CNT 10
+
+enum {
+ POSITIVE = 0,
+ NEGATIVE,
+};
+
+enum {
+ UNKNOWN_TYPE = 0,
+ SDI_BATTERY_TYPE,
+ ATL_BATTERY_TYPE,
+};
+
+struct max17042_platform_data {
+ int sdi_capacity;
+ int sdi_vfcapacity;
+ int sdi_low_bat_comp_start_vol;
+ int atl_capacity;
+ int atl_vfcapacity;
+ int atl_low_bat_comp_start_vol;
+};
+
+struct sec_fg_info {
+ /* test print count */
+ int pr_cnt;
+ /* battery type */
+ int battery_type;
+ /* capacity and vfcapacity */
+ u16 capacity;
+ u16 vfcapacity;
+ int soc_restart_flag;
+ /* full charge comp */
+ struct delayed_work full_comp_work;
+ u32 previous_fullcap;
+ u32 previous_vffullcap;
+ u32 full_charged_cap;
+ /* cap corruption check */
+ u32 previous_repsoc;
+ u32 previous_vfsoc;
+ u32 previous_remcap;
+ u32 previous_mixcap;
+ u32 previous_fullcapacity;
+ u32 previous_vfcapacity;
+ u32 previous_vfocv;
+ /* low battery comp */
+ int low_batt_comp_cnt[LOW_BATT_COMP_RANGE_NUM][LOW_BATT_COMP_LEVEL_NUM];
+ int low_batt_comp_flag;
+ int check_start_vol;
+ /* low battery boot */
+ int low_batt_boot_flag;
+
+ /* battery info */
+ u32 soc;
+
+ /* miscellaneous */
+ int fg_chk_cnt;
+ int fg_skip;
+ int fg_skip_cnt;
+ int full_check_flag;
+ bool is_first_check;
+};
+
+/* Battery parameter */
+#define sdi_capacity 0x3730
+#define sdi_vfcapacity 0x4996
+#define sdi_low_bat_comp_start_vol 3600
+#define atl_capacity 0x3022
+#define atl_vfcapacity 0x4024
+#define atl_low_bat_comp_start_vol 3450
+
+/* Current range for P2(not dependent on battery type */
+#if defined(CONFIG_MACH_P2_REV00) || defined(CONFIG_MACH_P2_REV01) || \
+ defined(CONFIG_MACH_P2_REV02)
+#define CURRENT_RANGE1 0
+#define CURRENT_RANGE2 -100
+#define CURRENT_RANGE3 -750
+#define CURRENT_RANGE4 -1250
+#define CURRENT_RANGE_MAX CURRENT_RANGE4
+#define CURRENT_RANGE_MAX_NUM 4
+/* SDI type low battery compensation offset */
+#define SDI_Range4_1_Offset 3320
+#define SDI_Range4_3_Offset 3410
+#define SDI_Range3_1_Offset 3451
+#define SDI_Range3_3_Offset 3454
+#define SDI_Range2_1_Offset 3461
+#define SDI_Range2_3_Offset 3544
+#define SDI_Range1_1_Offset 3456
+#define SDI_Range1_3_Offset 3536
+#define SDI_Range4_1_Slope 0
+#define SDI_Range4_3_Slope 0
+#define SDI_Range3_1_Slope 97
+#define SDI_Range3_3_Slope 27
+#define SDI_Range2_1_Slope 96
+#define SDI_Range2_3_Slope 134
+#define SDI_Range1_1_Slope 0
+#define SDI_Range1_3_Slope 0
+/* ATL type low battery compensation offset */
+#define ATL_Range5_1_Offset 3277
+#define ATL_Range5_3_Offset 3293
+#define ATL_Range4_1_Offset 3312
+#define ATL_Range4_3_Offset 3305
+#define ATL_Range3_1_Offset 3310
+#define ATL_Range3_3_Offset 3333
+#define ATL_Range2_1_Offset 3335
+#define ATL_Range2_3_Offset 3356
+#define ATL_Range1_1_Offset 3325
+#define ATL_Range1_3_Offset 3342
+#define ATL_Range5_1_Slope 0
+#define ATL_Range5_3_Slope 0
+#define ATL_Range4_1_Slope 30
+#define ATL_Range4_3_Slope 667
+#define ATL_Range3_1_Slope 20
+#define ATL_Range3_3_Slope 40
+#define ATL_Range2_1_Slope 60
+#define ATL_Range2_3_Slope 76
+#define ATL_Range1_1_Slope 0
+#define ATL_Range1_3_Slope 0
+#elif defined(CONFIG_MACH_P4W_REV00) || defined(CONFIG_MACH_P4W_REV01) || \
+ defined(CONFIG_MACH_P11) /* P4W battery parameter */
+/* Current range for P4W(not dependent on battery type */
+#define CURRENT_RANGE1 0
+#define CURRENT_RANGE2 -200
+#define CURRENT_RANGE3 -600
+#define CURRENT_RANGE4 -1500
+#define CURRENT_RANGE5 -2500
+#define CURRENT_RANGE_MAX CURRENT_RANGE5
+#define CURRENT_RANGE_MAX_NUM 5
+/* SDI type low battery compensation offset */
+#define SDI_Range5_1_Offset 3318
+#define SDI_Range5_3_Offset 3383
+#define SDI_Range4_1_Offset 3451
+#define SDI_Range4_3_Offset 3618
+#define SDI_Range3_1_Offset 3453
+#define SDI_Range3_3_Offset 3615
+#define SDI_Range2_1_Offset 3447
+#define SDI_Range2_3_Offset 3606
+#define SDI_Range1_1_Offset 3438
+#define SDI_Range1_3_Offset 3591
+#define SDI_Range5_1_Slope 0
+#define SDI_Range5_3_Slope 0
+#define SDI_Range4_1_Slope 53
+#define SDI_Range4_3_Slope 94
+#define SDI_Range3_1_Slope 54
+#define SDI_Range3_3_Slope 92
+#define SDI_Range2_1_Slope 45
+#define SDI_Range2_3_Slope 78
+#define SDI_Range1_1_Slope 0
+#define SDI_Range1_3_Slope 0
+/* Default value for build */
+/* ATL type low battery compensation offset */
+#define ATL_Range4_1_Offset 3298
+#define ATL_Range4_3_Offset 3330
+#define ATL_Range3_1_Offset 3375
+#define ATL_Range3_3_Offset 3445
+#define ATL_Range2_1_Offset 3371
+#define ATL_Range2_3_Offset 3466
+#define ATL_Range1_1_Offset 3362
+#define ATL_Range1_3_Offset 3443
+#define ATL_Range4_1_Slope 0
+#define ATL_Range4_3_Slope 0
+#define ATL_Range3_1_Slope 50
+#define ATL_Range3_3_Slope 77
+#define ATL_Range2_1_Slope 40
+#define ATL_Range2_3_Slope 111
+#define ATL_Range1_1_Slope 0
+#define ATL_Range1_3_Slope 0
+#elif defined(CONFIG_MACH_P8_REV00) || defined(CONFIG_MACH_P8_REV01) \
+ || defined(CONFIG_MACH_P8LTE_REV00) /* P8 battery parameter */
+/* Current range for P8(not dependent on battery type */
+#define CURRENT_RANGE1 0
+#define CURRENT_RANGE2 -200
+#define CURRENT_RANGE3 -600
+#define CURRENT_RANGE4 -1500
+#define CURRENT_RANGE5 -2500
+#define CURRENT_RANGE_MAX CURRENT_RANGE5
+#define CURRENT_RANGE_MAX_NUM 5
+/* SDI type low battery compensation Slope & Offset for 1% SOC range*/
+#define SDI_Range1_1_Slope 0
+#define SDI_Range2_1_Slope 54
+#define SDI_Range3_1_Slope 66
+#define SDI_Range4_1_Slope 69
+#define SDI_Range5_1_Slope 0
+
+#define SDI_Range1_1_Offset 3391
+#define SDI_Range2_1_Offset 3402
+#define SDI_Range3_1_Offset 3409
+#define SDI_Range4_1_Offset 3414
+#define SDI_Range5_1_Offset 3240
+
+/* SDI type low battery compensation Slope & Offset for 3% SOC range*/
+#define SDI_Range1_3_Slope 0
+#define SDI_Range2_3_Slope 92
+#define SDI_Range3_3_Slope 125
+#define SDI_Range4_3_Slope 110
+#define SDI_Range5_3_Slope 0
+
+#define SDI_Range1_3_Offset 3524
+#define SDI_Range2_3_Offset 3542
+#define SDI_Range3_3_Offset 3562
+#define SDI_Range4_3_Offset 3539
+#define SDI_Range5_3_Offset 3265
+
+/* ATL type low battery compensation offset */
+#define ATL_Range4_1_Offset 3298
+#define ATL_Range4_3_Offset 3330
+#define ATL_Range3_1_Offset 3375
+#define ATL_Range3_3_Offset 3445
+#define ATL_Range2_1_Offset 3371
+#define ATL_Range2_3_Offset 3466
+#define ATL_Range1_1_Offset 3362
+#define ATL_Range1_3_Offset 3443
+
+#define ATL_Range4_1_Slope 0
+#define ATL_Range4_3_Slope 0
+#define ATL_Range3_1_Slope 50
+#define ATL_Range3_3_Slope 77
+#define ATL_Range2_1_Slope 40
+#define ATL_Range2_3_Slope 111
+#define ATL_Range1_1_Slope 0
+#define ATL_Range1_3_Slope 0
+#else /* default value */
+/* Current range for default(not dependent on battery type */
+#define CURRENT_RANGE1 0
+#define CURRENT_RANGE2 -100
+#define CURRENT_RANGE3 -750
+#define CURRENT_RANGE4 -1250
+#define CURRENT_RANGE_MIN CURRENT_RANGE1
+#define CURRENT_RANGE_MAX CURRENT_RANGE4
+/* added as dummy value to fix build error */
+#define CURRENT_RANGE_MAX_NUM 4
+/* SDI type low battery compensation offset */
+#define SDI_Range4_1_Offset 3371
+#define SDI_Range4_3_Offset 3478
+#define SDI_Range3_1_Offset 3453
+#define SDI_Range3_3_Offset 3614
+#define SDI_Range2_1_Offset 3447
+#define SDI_Range2_3_Offset 3606
+#define SDI_Range1_1_Offset 3438
+#define SDI_Range1_3_Offset 3591
+#define SDI_Range4_1_Slope 0
+#define SDI_Range4_3_Slope 0
+#define SDI_Range3_1_Slope 50
+#define SDI_Range3_3_Slope 90
+#define SDI_Range2_1_Slope 50
+#define SDI_Range2_3_Slope 78
+#define SDI_Range1_1_Slope 0
+#define SDI_Range1_3_Slope 0
+/* ATL type low battery compensation offset */
+#define ATL_Range4_1_Offset 3298
+#define ATL_Range4_3_Offset 3330
+#define ATL_Range3_1_Offset 3375
+#define ATL_Range3_3_Offset 3445
+#define ATL_Range2_1_Offset 3371
+#define ATL_Range2_3_Offset 3466
+#define ATL_Range1_1_Offset 3362
+#define ATL_Range1_3_Offset 3443
+#define ATL_Range4_1_Slope 0
+#define ATL_Range4_3_Slope 0
+#define ATL_Range3_1_Slope 50
+#define ATL_Range3_3_Slope 77
+#define ATL_Range2_1_Slope 40
+#define ATL_Range2_3_Slope 111
+#define ATL_Range1_1_Slope 0
+#define ATL_Range1_3_Slope 0
+#endif
+
+/* Temperature adjust value */
+#define SDI_TRIM1_1 122
+#define SDI_TRIM1_2 8950
+#define SDI_TRIM2_1 200
+#define SDI_TRIM2_2 51000
+
+/* FullCap learning setting */
+#define VFSOC_FOR_FULLCAP_LEARNING 90
+#define LOW_CURRENT_FOR_FULLCAP_LEARNING 20
+#define HIGH_CURRENT_FOR_FULLCAP_LEARNING 120
+#define LOW_AVGCURRENT_FOR_FULLCAP_LEARNING 20
+#define HIGH_AVGCURRENT_FOR_FULLCAP_LEARNING 100
+
+/* power off margin */
+#define POWER_OFF_SOC_HIGH_MARGIN 0x200
+#define POWER_OFF_VOLTAGE_HIGH_MARGIN 3500
+
+#endif
+
+#endif /* __MAX17042_FUELGAUGE_H */
+
diff --git a/include/linux/battery/fuelgauge/max17048_fuelgauge.h b/include/linux/battery/fuelgauge/max17048_fuelgauge.h
new file mode 100644
index 0000000..3fe5ddf
--- /dev/null
+++ b/include/linux/battery/fuelgauge/max17048_fuelgauge.h
@@ -0,0 +1,53 @@
+/*
+ * max17048_fuelgauge.h
+ * Samsung MAX17048 Fuel Gauge Header
+ *
+ * Copyright (C) 2012 Samsung Electronics, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MAX17048_FUELGAUGE_H
+#define __MAX17048_FUELGAUGE_H __FILE__
+
+/* Slave address should be shifted to the right 1bit.
+ * R/W bit should NOT be included.
+ */
+#define SEC_FUELGAUGE_I2C_SLAVEADDR (0x6D >> 1)
+
+#define MAX17048_VCELL_MSB 0x02
+#define MAX17048_VCELL_LSB 0x03
+#define MAX17048_SOC_MSB 0x04
+#define MAX17048_SOC_LSB 0x05
+#define MAX17048_MODE_MSB 0x06
+#define MAX17048_MODE_LSB 0x07
+#define MAX17048_VER_MSB 0x08
+#define MAX17048_VER_LSB 0x09
+#define MAX17048_RCOMP_MSB 0x0C
+#define MAX17048_RCOMP_LSB 0x0D
+#define MAX17048_CMD_MSB 0xFE
+#define MAX17048_CMD_LSB 0xFF
+
+#define RCOMP0_TEMP 20
+
+struct battery_data_t {
+ u8 RCOMP0;
+ u8 RCOMP_charging;
+ int temp_cohot;
+ int temp_cocold;
+ u8 *type_str;
+};
+
+struct sec_fg_info {
+ bool dummy
+};
+
+#endif /* __MAX17048_FUELGAUGE_H */
diff --git a/include/linux/battery/fuelgauge/max17050_fuelgauge.h b/include/linux/battery/fuelgauge/max17050_fuelgauge.h
new file mode 100644
index 0000000..8576730
--- /dev/null
+++ b/include/linux/battery/fuelgauge/max17050_fuelgauge.h
@@ -0,0 +1,169 @@
+/*
+ * max17050_fuelgauge.h
+ * Samsung MAX17050 Fuel Gauge Header
+ *
+ * Copyright (C) 2012 Samsung Electronics, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MAX17050_FUELGAUGE_H
+#define __MAX17050_FUELGAUGE_H __FILE__
+
+#include <linux/android_alarm.h>
+
+/* Slave address should be shifted to the right 1bit.
+ * R/W bit should NOT be included.
+ */
+#define SEC_FUELGAUGE_I2C_SLAVEADDR 0x36
+
+#if defined(CONFIG_FUELGAUGE_MAX17050_VOLTAGE_TRACKING)
+#define MAX17050_REG_STATUS 0x00
+#define MAX17050_REG_VALRT_TH 0x01
+#define MAX17050_REG_TALRT_TH 0x02
+#define MAX17050_REG_SALRT_TH 0x03
+#define MAX17050_REG_VCELL 0x09
+#define MAX17050_REG_TEMPERATURE 0x08
+#define MAX17050_REG_AVGVCELL 0x19
+#define MAX17050_REG_CONFIG 0x1D
+#define MAX17050_REG_VERSION 0x21
+#define MAX17050_REG_LEARNCFG 0x28
+#define MAX17050_REG_FILTERCFG 0x29
+#define MAX17050_REG_MISCCFG 0x2B
+#define MAX17050_REG_CGAIN 0x2E
+#define MAX17050_REG_RCOMP 0x38
+#define MAX17050_REG_VFOCV 0xFB
+#define MAX17050_REG_SOC_VF 0xFF
+
+struct sec_fg_info {
+ bool dummy;
+};
+
+#endif
+
+#if defined(CONFIG_FUELGAUGE_MAX17050_COULOMB_COUNTING)
+#define PRINT_COUNT 10
+
+/* Register address */
+#define STATUS_REG 0x00
+#define VALRT_THRESHOLD_REG 0x01
+#define TALRT_THRESHOLD_REG 0x02
+#define SALRT_THRESHOLD_REG 0x03
+#define REMCAP_REP_REG 0x05
+#define SOCREP_REG 0x06
+#define TEMPERATURE_REG 0x08
+#define VCELL_REG 0x09
+#define CURRENT_REG 0x0A
+#define AVG_CURRENT_REG 0x0B
+#define SOCMIX_REG 0x0D
+#define SOCAV_REG 0x0E
+#define REMCAP_MIX_REG 0x0F
+#define FULLCAP_REG 0x10
+#define RFAST_REG 0x15
+#define AVR_TEMPERATURE_REG 0x16
+#define CYCLES_REG 0x17
+#define DESIGNCAP_REG 0x18
+#define AVR_VCELL_REG 0x19
+#define CONFIG_REG 0x1D
+#define REMCAP_AV_REG 0x1F
+#define FULLCAP_NOM_REG 0x23
+#define MISCCFG_REG 0x2B
+#define RCOMP_REG 0x38
+#define FSTAT_REG 0x3D
+#define DQACC_REG 0x45
+#define DPACC_REG 0x46
+#define OCV_REG 0xEE
+#define VFOCV_REG 0xFB
+#define VFSOC_REG 0xFF
+
+#define FG_LEVEL 0
+#define FG_TEMPERATURE 1
+#define FG_VOLTAGE 2
+#define FG_CURRENT 3
+#define FG_CURRENT_AVG 4
+#define FG_CHECK_STATUS 5
+#define FG_VF_SOC 6
+#define FG_AV_SOC 7
+
+#define LOW_BATT_COMP_RANGE_NUM 5
+#define LOW_BATT_COMP_LEVEL_NUM 2
+#define MAX_LOW_BATT_CHECK_CNT 10
+
+enum {
+ POSITIVE = 0,
+ NEGATIVE,
+};
+
+enum {
+ RANGE = 0,
+ SLOPE,
+ OFFSET,
+ TABLE_MAX
+};
+
+#define CURRENT_RANGE_MAX_NUM 5
+#define TEMP_RANGE_MAX_NUM 3
+
+struct battery_data_t {
+ u16 Capacity;
+ u16 low_battery_comp_voltage;
+ s32 low_battery_table[CURRENT_RANGE_MAX_NUM][TABLE_MAX];
+ s32 temp_adjust_table[TEMP_RANGE_MAX_NUM][TABLE_MAX];
+ u8 *type_str;
+};
+
+struct sec_fg_info {
+ /* test print count */
+ int pr_cnt;
+ /* full charge comp */
+ struct delayed_work full_comp_work;
+ u32 previous_fullcap;
+ u32 previous_vffullcap;
+ /* low battery comp */
+ int low_batt_comp_cnt[LOW_BATT_COMP_RANGE_NUM][LOW_BATT_COMP_LEVEL_NUM];
+ int low_batt_comp_flag;
+ /* low battery boot */
+ int low_batt_boot_flag;
+ bool is_low_batt_alarm;
+
+ /* battery info */
+ u32 soc;
+
+ /* miscellaneous */
+ unsigned long fullcap_check_interval;
+ int full_check_flag;
+ bool is_first_check;
+};
+
+/* FullCap learning setting */
+#define VFFULLCAP_CHECK_INTERVAL 300 /* sec */
+/* soc should be 0.1% unit */
+#define VFSOC_FOR_FULLCAP_LEARNING 950
+#define LOW_CURRENT_FOR_FULLCAP_LEARNING 20
+#define HIGH_CURRENT_FOR_FULLCAP_LEARNING 120
+#define LOW_AVGCURRENT_FOR_FULLCAP_LEARNING 20
+#define HIGH_AVGCURRENT_FOR_FULLCAP_LEARNING 100
+
+/* power off margin */
+/* soc should be 0.1% unit */
+#define POWER_OFF_SOC_HIGH_MARGIN 20
+#define POWER_OFF_VOLTAGE_HIGH_MARGIN 3500
+#define POWER_OFF_VOLTAGE_LOW_MARGIN 3400
+
+/* FG recovery handler */
+/* soc should be 0.1% unit */
+#define STABLE_LOW_BATTERY_DIFF 30
+#define STABLE_LOW_BATTERY_DIFF_LOWBATT 10
+#define LOW_BATTERY_SOC_REDUCE_UNIT 10
+#endif
+
+#endif /* __MAX17050_FUELGAUGE_H */
+
diff --git a/include/linux/battery/max17047_fuelgauge.h b/include/linux/battery/max17047_fuelgauge.h
new file mode 100644
index 0000000..dac19c6
--- /dev/null
+++ b/include/linux/battery/max17047_fuelgauge.h
@@ -0,0 +1,33 @@
+/*
+ * max17047_fuelgauge.h
+ *
+ * Copyright (C) 2011 Samsung Electronics
+ * SangYoung Son <hello.son@samsung.com>
+ *
+ * based on max17042_battery.h
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MAX17047_BATTERY_H_
+#define __MAX17047_BATTERY_H_
+
+struct max17047_platform_data {
+ int irq_gpio;
+
+ bool enable_current_sense;
+ bool enable_gauging_temperature;
+
+ const char *psy_name;
+};
+
+#endif
+
diff --git a/include/linux/battery/samsung_battery.h b/include/linux/battery/samsung_battery.h
new file mode 100644
index 0000000..4576d8f
--- /dev/null
+++ b/include/linux/battery/samsung_battery.h
@@ -0,0 +1,345 @@
+/*
+ * Copyright (C) 2010 Samsung Electronics, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MACH_SAMSUNG_BATTERY_H
+#define __MACH_SAMSUNG_BATTERY_H __FILE__
+
+#include <linux/gpio.h>
+#include <linux/delay.h>
+#include <linux/power_supply.h>
+#include <linux/android_alarm.h>
+
+/* macro */
+#define MAX(x, y) ((x) > (y) ? (x) : (y))
+#define MIN(x, y) ((x) < (y) ? (x) : (y))
+#define ABS(x) ((x) < 0 ? (-1 * (x)) : (x))
+
+/* common */
+enum {
+ DISABLE = 0,
+ ENABLE,
+};
+
+struct battery_info {
+ struct device *dev;
+ struct samsung_battery_platform_data *pdata;
+#if defined(CONFIG_S3C_ADC)
+ struct s3c_adc_client *adc_client;
+#endif
+
+ bool use_sub_charger;
+ char *fuelgauge_name;
+ char *charger_name;
+ char *sub_charger_name;
+
+ /* android common power supply */
+ struct power_supply psy_bat;
+ struct power_supply psy_usb;
+ struct power_supply psy_ac;
+
+ /* charger, fuelgauge psy depends on machine */
+ struct power_supply *psy_charger;
+ struct power_supply *psy_fuelgauge;
+ struct power_supply *psy_sub_charger;
+
+ /* workqueue */
+ struct work_struct monitor_work;
+ unsigned int monitor_mode;
+ unsigned int monitor_interval;
+ int monitor_weight;
+ unsigned int monitor_count;
+ struct work_struct error_work;
+
+ /* mutex */
+ struct mutex mon_lock;
+ struct mutex ops_lock;
+ struct mutex err_lock;
+
+ /* wakelock */
+ struct wake_lock charge_wake_lock;
+ struct wake_lock monitor_wake_lock;
+ struct wake_lock emer_wake_lock;
+
+ /* is_suspended */
+ bool is_suspended;
+
+ /* charge state */
+ unsigned int charge_real_state;
+ unsigned int charge_virt_state;
+ unsigned int charge_type;
+ unsigned int charge_current;
+ unsigned int input_current;
+
+ /* battery state */
+ unsigned int battery_health;
+ unsigned int battery_present;
+ unsigned int battery_vcell;
+ unsigned int battery_vfocv;
+ int battery_v_diff;
+ unsigned int battery_soc;
+ unsigned int battery_raw_soc;
+ int battery_r_s_delta;
+
+ /* temperature */
+ int battery_temper;
+ int battery_temper_adc;
+ int battery_t_delta;
+ int battery_temper_avg;
+ int battery_temper_adc_avg;
+
+ /* cable type */
+ unsigned int cable_type;
+
+ /* For SAMSUNG charge spec */
+ unsigned int vf_state;
+ unsigned int temper_state;
+ unsigned int overheated_state;
+ unsigned int freezed_state;
+ unsigned int full_charged_state;
+ unsigned int abstimer_state;
+ unsigned int recharge_phase;
+ unsigned int recharge_start;
+ unsigned int health_state;
+
+ unsigned int lpm_state;
+ unsigned int siop_state;
+ unsigned int siop_charge_current;
+ unsigned int led_state;
+
+ /* ambiguous state */
+ unsigned int ambiguous_state;
+
+ /* time management */
+ unsigned int charge_start_time;
+ struct alarm alarm;
+ bool slow_poll;
+ ktime_t last_poll;
+
+ struct proc_dir_entry *entry;
+
+ /* For debugging */
+ unsigned int battery_test_mode;
+ unsigned int battery_error_test;
+
+#if defined(CONFIG_TARGET_LOCALE_KOR) || defined(CONFIG_MACH_M0_CTC)
+ bool is_unspec_phase;
+ bool is_unspec_recovery;
+ int battery_full_soc;
+ unsigned int prev_cable_type;
+ unsigned int prev_battery_health;
+ unsigned int prev_charge_virt_state;
+ unsigned int prev_battery_soc;
+ struct wake_lock update_wake_lock;
+#endif
+};
+
+/* jig state */
+extern bool is_jig_attached;
+
+/*
+ * Use for charger
+ */
+enum charger_state {
+ CHARGER_STATE_ENABLE = 0,
+ CHARGER_STATE_DISABLE = 1
+};
+
+enum current_type {
+ CURRENT_TYPE_CHRAGE = 0,
+ CURRENT_TYPE_INPUT = 1,
+};
+
+/*
+ * Use for fuelgauge
+ */
+enum voltage_type {
+ VOLTAGE_TYPE_VCELL = 0,
+ VOLTAGE_TYPE_VFOCV = 1,
+};
+
+enum soc_type {
+ SOC_TYPE_ADJUSTED = 0,
+ SOC_TYPE_RAW = 1,
+#if defined(CONFIG_TARGET_LOCALE_KOR) || defined(CONFIG_MACH_M0_CTC)
+ SOC_TYPE_FULL = 2,
+#endif
+};
+
+/*
+ * Use for battery
+ */
+#define OFF_CURR 0 /* charger off current */
+#define KEEP_CURR -1 /* keep previous current */
+
+/* VF error check */
+#define VF_CHECK_COUNT 10
+#define VF_CHECK_DELAY 1000
+#define RESET_SOC_DIFF_TH 100000
+
+/* average count */
+#define CNT_VOLTAGE_AVG 5
+#define CNT_CURRENT_AVG 5
+#define CNT_TEMPER_AVG 5
+#define CNT_ADC_SAMPLE 6
+
+/* adc error retry */
+#define ADC_ERR_CNT 5
+#define ADC_ERR_DELAY 200
+
+/* voltage diff for recharge voltage calculation */
+#if defined(CONFIG_TARGET_LOCALE_KOR)
+/* KOR model spec : max-voltage minus 60mV */
+#define RECHG_DROP_VALUE 60000
+#else
+#define RECHG_DROP_VALUE 50000 /* 4300mV */
+#endif
+
+enum {
+ CHARGE_DISABLE = 0,
+ CHARGE_ENABLE,
+};
+
+enum {
+ JIG_OFF = 0,
+ JIG_ON,
+};
+
+/* cable detect source */
+enum {
+ CABLE_DET_MUIC = 0,
+ CABLE_DET_ADC,
+ CABLE_DET_CHARGER,
+
+ CABLE_DET_UNKNOWN,
+};
+
+
+/* temperature source */
+enum {
+ TEMPER_FUELGAUGE = 0,
+ TEMPER_AP_ADC,
+ TEMPER_EXT_ADC,
+
+ TEMPER_UNKNOWN,
+};
+
+/* siop state */
+enum {
+ SIOP_DEACTIVE = 0,
+ SIOP_ACTIVE,
+};
+
+/* monitoring mode */
+enum {
+ MONITOR_CHNG = 0,
+ MONITOR_CHNG_SUSP,
+ MONITOR_NORM,
+ MONITOR_NORM_SUSP,
+ MONITOR_EMER_LV1,
+ MONITOR_EMER_LV2,
+};
+
+/* Temperature from adc */
+#if defined(CONFIG_STMPE811_ADC)
+#define BATTERY_TEMPER_CH 7
+u16 stmpe811_get_adc_data(u8 channel);
+int stmpe811_get_adc_value(u8 channel);
+#endif
+
+/* LED control */
+enum led_state {
+ BATT_LED_CHARGING = 0,
+ BATT_LED_DISCHARGING,
+ BATT_LED_NOT_CHARGING,
+ BATT_LED_FULL,
+};
+
+enum led_color {
+ BATT_LED_RED = 0,
+ BATT_LED_GREEN,
+ BATT_LED_BLUE,
+};
+
+enum led_pattern {
+ BATT_LED_PATT_OFF = 0,
+ BATT_LED_PATT_CHG,
+ BATT_LED_PATT_NOT_CHG,
+};
+
+/**
+ * struct sec_bat_plaform_data - init data for sec batter driver
+ * @fuel_gauge_name: power supply name of fuel gauge
+ * @charger_name: power supply name of charger
+ */
+struct samsung_battery_platform_data {
+ char *charger_name;
+ char *fuelgauge_name;
+ char *sub_charger_name;
+ bool use_sub_charger;
+
+ /* battery voltage design */
+ unsigned int voltage_max;
+ unsigned int voltage_min;
+
+ /* charge current */
+ unsigned int in_curr_limit;
+ unsigned int chg_curr_ta;
+ unsigned int chg_curr_usb;
+ unsigned int chg_curr_cdp;
+ unsigned int chg_curr_wpc;
+ unsigned int chg_curr_dock;
+ unsigned int chg_curr_etc;
+
+ /* variable monitoring interval */
+ unsigned int chng_interval;
+ unsigned int chng_susp_interval;
+ unsigned int norm_interval;
+ unsigned int norm_susp_interval;
+ unsigned int emer_lv1_interval;
+ unsigned int emer_lv2_interval;
+
+ /* Recharge sceanario */
+ unsigned int recharge_voltage;
+ unsigned int abstimer_charge_duration;
+ unsigned int abstimer_recharge_duration;
+
+ /* cable detect */
+ int cb_det_src;
+ int cb_det_gpio;
+ int cb_det_adc_ch;
+
+ /* Temperature scenario */
+ int overheat_stop_temp;
+ int overheat_recovery_temp;
+ int freeze_stop_temp;
+ int freeze_recovery_temp;
+
+ /* Temperature source 0: fuelgauge, 1: ap adc, 2: ex. adc */
+ int temper_src;
+ int temper_ch;
+#ifdef CONFIG_S3C_ADC
+ int (*covert_adc) (int, int);
+#endif
+
+ /* suspend in charging */
+ bool suspend_chging;
+
+ /* support led indicator */
+ bool led_indicator;
+
+ /* support battery_standever */
+ bool battery_standever;
+};
+
+#endif /* __MACH_SAMSUNG_BATTERY_H */
diff --git a/include/linux/battery/sec_battery.h b/include/linux/battery/sec_battery.h
new file mode 100644
index 0000000..4c57e62
--- /dev/null
+++ b/include/linux/battery/sec_battery.h
@@ -0,0 +1,255 @@
+/*
+ * sec_battery.h
+ * Samsung Mobile Battery Header
+ *
+ *
+ * Copyright (C) 2012 Samsung Electronics, Inc.
+ *
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __SEC_BATTERY_H
+#define __SEC_BATTERY_H __FILE__
+
+#include <linux/battery/sec_charging_common.h>
+#include <linux/android_alarm.h>
+#include <linux/wakelock.h>
+#include <linux/workqueue.h>
+#include <linux/proc_fs.h>
+#include <linux/jiffies.h>
+
+static enum power_supply_property sec_battery_props[] = {
+ POWER_SUPPLY_PROP_STATUS,
+ POWER_SUPPLY_PROP_CHARGE_TYPE,
+ POWER_SUPPLY_PROP_HEALTH,
+ POWER_SUPPLY_PROP_PRESENT,
+ POWER_SUPPLY_PROP_ONLINE,
+ POWER_SUPPLY_PROP_TECHNOLOGY,
+ POWER_SUPPLY_PROP_VOLTAGE_NOW,
+ POWER_SUPPLY_PROP_VOLTAGE_AVG,
+ POWER_SUPPLY_PROP_CURRENT_NOW,
+ POWER_SUPPLY_PROP_CURRENT_AVG,
+ POWER_SUPPLY_PROP_CAPACITY,
+ POWER_SUPPLY_PROP_TEMP,
+ POWER_SUPPLY_PROP_TEMP_AMBIENT,
+};
+
+static enum power_supply_property sec_power_props[] = {
+ POWER_SUPPLY_PROP_ONLINE,
+};
+
+#define ADC_CH_COUNT 10
+#define ADC_SAMPLE_COUNT 10
+
+struct adc_sample_info {
+ unsigned int cnt;
+ int total_adc;
+ int average_adc;
+ int adc_arr[ADC_SAMPLE_COUNT];
+ int index;
+};
+
+struct sec_battery_info {
+ struct device *dev;
+ sec_battery_platform_data_t *pdata;
+ /* power supply used in Android */
+ struct power_supply psy_bat;
+ struct power_supply psy_usb;
+ struct power_supply psy_ac;
+ unsigned int irq;
+
+ int status;
+ int health;
+ bool present;
+
+ int voltage_now; /* cell voltage (mV) */
+ int voltage_avg; /* average voltage (mV) */
+ int voltage_ocv; /* open circuit voltage (mV) */
+ int current_now; /* current (mA) */
+ int current_avg; /* average current (mA) */
+ int current_adc;
+
+ unsigned int capacity; /* SOC (%) */
+
+ struct mutex adclock;
+ struct adc_sample_info adc_sample[ADC_CH_COUNT];
+
+ /* keep awake until monitor is done */
+ struct wake_lock monitor_wake_lock;
+ struct workqueue_struct *monitor_wqueue;
+ struct work_struct monitor_work;
+ unsigned int polling_count;
+ unsigned int polling_time;
+ bool polling_in_sleep;
+ bool polling_short;
+
+ struct delayed_work polling_work;
+ struct alarm polling_alarm;
+ ktime_t last_poll_time;
+
+ /* event set */
+ unsigned int event;
+ unsigned int event_wait;
+ struct timer_list event_expired_timer;
+
+ /* battery check */
+ unsigned int check_count;
+ /* ADC check */
+ unsigned int check_adc_count;
+ unsigned int check_adc_value;
+
+ /* time check */
+ unsigned long charging_start_time;
+ unsigned long charging_passed_time;
+ unsigned long charging_next_time;
+
+ /* temperature check */
+ int temperature; /* battery temperature */
+ int temper_amb; /* target temperature */
+
+ int temp_adc;
+
+ int temp_high_threshold;
+ int temp_high_recovery;
+ int temp_low_threshold;
+ int temp_low_recovery;
+
+ unsigned int temp_high_cnt;
+ unsigned int temp_low_cnt;
+ unsigned int temp_recover_cnt;
+
+ /* charging */
+ unsigned int charging_mode;
+ int cable_type;
+ struct wake_lock cable_wake_lock;
+ struct work_struct cable_work;
+ struct wake_lock vbus_wake_lock;
+ unsigned int full_check_cnt;
+
+ /* test mode */
+ bool test_activated;
+};
+
+static char *supply_list[] = {
+ "battery",
+};
+
+ssize_t sec_bat_show_attrs(struct device *dev,
+ struct device_attribute *attr, char *buf);
+
+ssize_t sec_bat_store_attrs(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count);
+
+#define SEC_BATTERY_ATTR(_name) \
+{ \
+ .attr = {.name = #_name, .mode = 0664}, \
+ .show = sec_bat_show_attrs, \
+ .store = sec_bat_store_attrs, \
+}
+
+/* event check */
+#define EVENT_NONE (0)
+#define EVENT_2G_CALL (0x1 << 0)
+#define EVENT_3G_CALL (0x1 << 1)
+#define EVENT_MUSIC (0x1 << 2)
+#define EVENT_VIDEO (0x1 << 3)
+#define EVENT_BROWSER (0x1 << 4)
+#define EVENT_HOTSPOT (0x1 << 5)
+#define EVENT_CAMERA (0x1 << 6)
+#define EVENT_CAMCORDER (0x1 << 7)
+#define EVENT_DATA_CALL (0x1 << 8)
+#define EVENT_WIFI (0x1 << 9)
+#define EVENT_WIBRO (0x1 << 10)
+#define EVENT_LTE (0x1 << 11)
+
+static struct device_attribute sec_battery_attrs[] = {
+ SEC_BATTERY_ATTR(batt_reset_soc),
+ SEC_BATTERY_ATTR(batt_read_raw_soc),
+ SEC_BATTERY_ATTR(batt_read_adj_soc),
+ SEC_BATTERY_ATTR(batt_type),
+ SEC_BATTERY_ATTR(batt_vfocv),
+ SEC_BATTERY_ATTR(batt_vol_adc),
+ SEC_BATTERY_ATTR(batt_vol_adc_cal),
+ SEC_BATTERY_ATTR(batt_vol_aver),
+ SEC_BATTERY_ATTR(batt_vol_adc_aver),
+ SEC_BATTERY_ATTR(batt_temp_adc),
+ SEC_BATTERY_ATTR(batt_temp_aver),
+ SEC_BATTERY_ATTR(batt_temp_adc_aver),
+ SEC_BATTERY_ATTR(batt_vf_adc),
+
+ SEC_BATTERY_ATTR(batt_lp_charging),
+ SEC_BATTERY_ATTR(siop_activated),
+ SEC_BATTERY_ATTR(batt_charging_source),
+ SEC_BATTERY_ATTR(fg_reg_dump),
+ SEC_BATTERY_ATTR(fg_reset_cap),
+ SEC_BATTERY_ATTR(auth),
+ SEC_BATTERY_ATTR(chg_current_adc),
+ SEC_BATTERY_ATTR(wc_adc),
+ SEC_BATTERY_ATTR(wc_status),
+
+ SEC_BATTERY_ATTR(2g_call),
+ SEC_BATTERY_ATTR(3g_call),
+ SEC_BATTERY_ATTR(music),
+ SEC_BATTERY_ATTR(video),
+ SEC_BATTERY_ATTR(browser),
+ SEC_BATTERY_ATTR(hotspot),
+ SEC_BATTERY_ATTR(camera),
+ SEC_BATTERY_ATTR(camcorger),
+ SEC_BATTERY_ATTR(data_call),
+ SEC_BATTERY_ATTR(wifi),
+ SEC_BATTERY_ATTR(wibro),
+ SEC_BATTERY_ATTR(lte),
+ SEC_BATTERY_ATTR(event),
+};
+
+enum {
+ BATT_RESET_SOC = 0,
+ BATT_READ_RAW_SOC,
+ BATT_READ_ADJ_SOC,
+ BATT_TYPE,
+ BATT_VFOCV,
+ BATT_VOL_ADC,
+ BATT_VOL_ADC_CAL,
+ BATT_VOL_AVER,
+ BATT_VOL_ADC_AVER,
+ BATT_TEMP_ADC,
+ BATT_TEMP_AVER,
+ BATT_TEMP_ADC_AVER,
+ BATT_VF_ADC,
+
+ BATT_LP_CHARGING,
+ SIOP_ACTIVATED,
+ BATT_CHARGING_SOURCE,
+ FG_REG_DUMP,
+ FG_RESET_CAP,
+ AUTH,
+ CHG_CURRENT_ADC,
+ WC_ADC,
+ WC_STATUS,
+
+ BATT_EVENT_2G_CALL,
+ BATT_EVENT_3G_CALL,
+ BATT_EVENT_MUSIC,
+ BATT_EVENT_VIDEO,
+ BATT_EVENT_BROWSER,
+ BATT_EVENT_HOTSPOT,
+ BATT_EVENT_CAMERA,
+ BATT_EVENT_CAMCORDER,
+ BATT_EVENT_DATA_CALL,
+ BATT_EVENT_WIFI,
+ BATT_EVENT_WIBRO,
+ BATT_EVENT_LTE,
+ BATT_EVENT,
+};
+
+#endif /* __SEC_BATTERY_H */
diff --git a/include/linux/battery/sec_charger.h b/include/linux/battery/sec_charger.h
new file mode 100644
index 0000000..c84b272
--- /dev/null
+++ b/include/linux/battery/sec_charger.h
@@ -0,0 +1,106 @@
+/*
+ * sec_charger.h
+ * Samsung Mobile Charger Header
+ *
+ * Copyright (C) 2012 Samsung Electronics, Inc.
+ *
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __SEC_CHARGER_H
+#define __SEC_CHARGER_H __FILE__
+
+#include <linux/battery/sec_charging_common.h>
+
+#if defined(CONFIG_CHARGER_DUMMY)
+#include <linux/battery/charger/dummy_charger.h>
+#elif defined(CONFIG_CHARGER_MAX8903)
+#include <linux/battery/charger/max8903_charger.h>
+#elif defined(CONFIG_CHARGER_SMB328)
+#include <linux/battery/charger/smb328_charger.h>
+#elif defined(CONFIG_CHARGER_SMB347)
+#include <linux/battery/charger/smb347_charger.h>
+#elif defined(CONFIG_CHARGER_BQ24157)
+#include <linux/battery/charger/bq24157_charger.h>
+#elif defined(CONFIG_CHARGER_BQ24190) || \
+ defined(CONFIG_CHARGER_BQ24191)
+#include <linux/battery/charger/bq24190_charger.h>
+#endif
+
+static enum power_supply_property sec_charger_props[] = {
+ POWER_SUPPLY_PROP_STATUS,
+ POWER_SUPPLY_PROP_HEALTH,
+ POWER_SUPPLY_PROP_ONLINE,
+ POWER_SUPPLY_PROP_CURRENT_NOW,
+};
+
+struct sec_charger_info {
+ struct i2c_client *client;
+ sec_battery_platform_data_t *pdata;
+ struct power_supply psy_chg;
+ struct delayed_work isr_work;
+
+ int cable_type;
+ bool is_charging;
+
+ /* charging current : + charging, - OTG */
+ int charging_current;
+
+ /* register programming */
+ int reg_addr;
+ int reg_data;
+};
+
+bool sec_hal_chg_init(struct i2c_client *);
+bool sec_hal_chg_suspend(struct i2c_client *);
+bool sec_hal_chg_resume(struct i2c_client *);
+bool sec_hal_chg_get_property(struct i2c_client *,
+ enum power_supply_property,
+ union power_supply_propval *);
+bool sec_hal_chg_set_property(struct i2c_client *,
+ enum power_supply_property,
+ const union power_supply_propval *);
+
+ssize_t sec_hal_chg_show_attrs(struct device *dev,
+ const ptrdiff_t offset, char *buf);
+
+ssize_t sec_hal_chg_store_attrs(struct device *dev,
+ const ptrdiff_t offset,
+ const char *buf, size_t count);
+
+ssize_t sec_chg_show_attrs(struct device *dev,
+ struct device_attribute *attr, char *buf);
+
+ssize_t sec_chg_store_attrs(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count);
+
+#define SEC_CHARGER_ATTR(_name) \
+{ \
+ .attr = {.name = #_name, .mode = 0666}, \
+ .show = sec_chg_show_attrs, \
+ .store = sec_chg_store_attrs, \
+}
+
+static struct device_attribute sec_charger_attrs[] = {
+ SEC_CHARGER_ATTR(reg),
+ SEC_CHARGER_ATTR(data),
+ SEC_CHARGER_ATTR(regs),
+};
+
+enum {
+ CHG_REG = 0,
+ CHG_DATA,
+ CHG_REGS,
+};
+
+#endif /* __SEC_CHARGER_H */
diff --git a/include/linux/battery/sec_charging_common.h b/include/linux/battery/sec_charging_common.h
new file mode 100644
index 0000000..d35f77b
--- /dev/null
+++ b/include/linux/battery/sec_charging_common.h
@@ -0,0 +1,503 @@
+/*
+ * sec_charging_common.h
+ * Samsung Mobile Charging Common Header
+ *
+ * Copyright (C) 2012 Samsung Electronics, Inc.
+ *
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __SEC_CHARGING_COMMON_H
+#define __SEC_CHARGING_COMMON_H __FILE__
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/err.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/irq.h>
+#include <linux/interrupt.h>
+#include <linux/i2c.h>
+#include <linux/power_supply.h>
+#include <linux/slab.h>
+#include <linux/device.h>
+
+/* definitions */
+#define SEC_SIZEOF_POWER_SUPPLY_TYPE 11 /* P10 */
+
+enum sec_battery_voltage_mode {
+ /* average voltage */
+ SEC_BATTEY_VOLTAGE_AVERAGE = 0,
+ /* open circuit voltage */
+ SEC_BATTEY_VOLTAGE_OCV,
+};
+
+/* ADC type */
+#define SEC_BATTERY_ADC_TYPE_NUM 3
+
+enum sec_battery_adc_type {
+ /* NOT using this ADC channel */
+ SEC_BATTERY_ADC_TYPE_NONE = 0,
+ /* ADC in AP */
+ SEC_BATTERY_ADC_TYPE_AP,
+ /* ADC by additional IC */
+ SEC_BATTERY_ADC_TYPE_IC,
+};
+
+enum sec_battery_adc_channel {
+ SEC_BAT_ADC_CHANNEL_CABLE_CHECK = 0,
+ SEC_BAT_ADC_CHANNEL_BAT_CHECK,
+ SEC_BAT_ADC_CHANNEL_TEMP,
+ SEC_BAT_ADC_CHANNEL_TEMP_AMBIENT,
+ SEC_BAT_ADC_CHANNEL_FULL_CHECK,
+};
+
+/* charging mode */
+enum sec_battery_charging_mode {
+ /* no charging */
+ SEC_BATTERY_CHARGING_NONE = 0,
+ /* normal charging */
+ SEC_BATTERY_CHARGING_NORMAL,
+ /* charging after 1st full-check*/
+ SEC_BATTERY_CHARGING_2ND,
+ /* recharging */
+ SEC_BATTERY_CHARGING_RECHARGING,
+};
+
+struct sec_bat_adc_api {
+ bool (*init)(struct platform_device *);
+ bool (*exit)(void);
+ int (*read)(unsigned int);
+};
+#define sec_bat_adc_api_t struct sec_bat_adc_api
+
+/* monitor activation */
+enum sec_battery_polling_time_type {
+ /* same order with power supply status */
+ SEC_BATTERY_POLLING_TIME_BASIC = 0,
+ SEC_BATTERY_POLLING_TIME_CHARGING,
+ SEC_BATTERY_POLLING_TIME_DISCHARGING,
+ SEC_BATTERY_POLLING_TIME_NOT_CHARGING,
+ SEC_BATTERY_POLLING_TIME_SLEEP,
+};
+
+enum sec_battery_monitor_polling {
+ /* polling work queue */
+ SEC_BATTERY_MONITOR_WORKQUEUE,
+ /* alarm polling */
+ SEC_BATTERY_MONITOR_ALARM,
+ /* timer polling */
+ SEC_BATTERY_MONITOR_TIMER,
+};
+#define sec_battery_monitor_polling_t \
+ enum sec_battery_monitor_polling
+
+/* full charged check : POWER_SUPPLY_PROP_STATUS */
+enum sec_battery_full_charged {
+ /* current check by ADC */
+ SEC_BATTERY_FULLCHARGED_ADC,
+ /* current check by ADC and dual check (1st, 2nd top-off) */
+ SEC_BATTERY_FULLCHARGED_ADC_DUAL,
+ /* fuel gauge current check */
+ SEC_BATTERY_FULLCHARGED_FG_CURRENT,
+ /* fuel gauge current check and dual check (1st, 2nd top-off) */
+ SEC_BATTERY_FULLCHARGED_FG_CURRENT_DUAL,
+ /* charger GPIO */
+ SEC_BATTERY_FULLCHARGED_CHGGPIO,
+ /* charger interrupt */
+ SEC_BATTERY_FULLCHARGED_CHGINT,
+ /* charger power supply property */
+ SEC_BATTERY_FULLCHARGED_CHGPSY,
+};
+#define sec_battery_full_charged_t \
+ enum sec_battery_full_charged
+
+/* full check condition type (can be used overlapped) */
+#define sec_battery_full_condition_t unsigned int
+/* SEC_BATTERY_FULL_CONDITION_NOTIMEFULL
+ * no full-charged by absolute-timer
+ */
+#define SEC_BATTERY_FULL_CONDITION_NOTIMEFULL 1
+/* SEC_BATTERY_FULL_CONDITION_SOC
+ * use capacity for full-charged check
+ */
+#define SEC_BATTERY_FULL_CONDITION_SOC 2
+/* SEC_BATTERY_FULL_CONDITION_AVGVCELL
+ * use average VCELL for full-charged check
+ */
+#define SEC_BATTERY_FULL_CONDITION_AVGVCELL 4
+/* SEC_BATTERY_FULL_CONDITION_OCV
+ * use OCV for full-charged check
+ */
+#define SEC_BATTERY_FULL_CONDITION_OCV 8
+
+/* recharge check condition type (can be used overlapped) */
+#define sec_battery_recharge_condition_t unsigned int
+/* SEC_BATTERY_RECHARGE_CONDITION_SOC
+ * use capacity for recharging check
+ */
+#define SEC_BATTERY_RECHARGE_CONDITION_SOC 1
+/* SEC_BATTERY_RECHARGE_CONDITION_AVGVCELL
+ * use average VCELL for recharging check
+ */
+#define SEC_BATTERY_RECHARGE_CONDITION_AVGVCELL 2
+/* SEC_BATTERY_RECHARGE_CONDITION_VCELL
+ * use VCELL for recharging check
+ */
+#define SEC_BATTERY_RECHARGE_CONDITION_VCELL 4
+
+/* battery check : POWER_SUPPLY_PROP_PRESENT */
+enum sec_battery_check {
+ /* No Check for internal battery */
+ SEC_BATTERY_CHECK_NONE,
+ /* by ADC */
+ SEC_BATTERY_CHECK_ADC,
+ /* by callback function (battery certification by 1 wired)*/
+ SEC_BATTERY_CHECK_CALLBACK,
+ /* by PMIC */
+ SEC_BATTERY_CHECK_PMIC,
+ /* by fuel gauge */
+ SEC_BATTERY_CHECK_FUELGAUGE,
+ /* by charger */
+ SEC_BATTERY_CHECK_CHARGER,
+ /* by interrupt (use check_battery_callback() to check battery) */
+ SEC_BATTERY_CHECK_INT,
+};
+#define sec_battery_check_t \
+ enum sec_battery_check
+
+/* OVP, UVLO check : POWER_SUPPLY_PROP_HEALTH */
+enum sec_battery_ovp_uvlo {
+ /* by callback function */
+ SEC_BATTERY_OVP_UVLO_CALLBACK,
+ /* by PMIC polling */
+ SEC_BATTERY_OVP_UVLO_PMICPOLLING,
+ /* by PMIC interrupt */
+ SEC_BATTERY_OVP_UVLO_PMICINT,
+ /* by charger polling */
+ SEC_BATTERY_OVP_UVLO_CHGPOLLING,
+ /* by charger interrupt */
+ SEC_BATTERY_OVP_UVLO_CHGINT,
+};
+#define sec_battery_ovp_uvlo_t \
+ enum sec_battery_ovp_uvlo
+
+/* thermal source */
+enum sec_battery_thermal_source {
+ /* by fuel gauge */
+ SEC_BATTERY_THERMAL_SOURCE_FG,
+ /* by external source */
+ SEC_BATTERY_THERMAL_SOURCE_CALLBACK,
+ /* by ADC */
+ SEC_BATTERY_THERMAL_SOURCE_ADC,
+};
+#define sec_battery_thermal_source_t \
+ enum sec_battery_thermal_source
+
+/* temperature check type */
+enum sec_battery_temp_check {
+ SEC_BATTERY_TEMP_CHECK_NONE = 0, /* no temperature check */
+ SEC_BATTERY_TEMP_CHECK_ADC, /* by ADC value */
+ SEC_BATTERY_TEMP_CHECK_TEMP, /* by temperature */
+};
+#define sec_battery_temp_check_t \
+ enum sec_battery_temp_check
+
+/* cable check (can be used overlapped) */
+#define sec_battery_cable_check_t unsigned int
+/* SEC_BATTERY_CABLE_CHECK_NOUSBCHARGE
+ * for USB cable in tablet model,
+ * status is stick to discharging,
+ * but internal charging logic is working
+ */
+#define SEC_BATTERY_CABLE_CHECK_NOUSBCHARGE 1
+/* SEC_BATTERY_CABLE_CHECK_PSY
+ * check cable by power supply set_property
+ */
+#define SEC_BATTERY_CABLE_CHECK_PSY 2
+/* SEC_BATTERY_CABLE_CHECK_INT
+ * check cable by interrupt
+ */
+#define SEC_BATTERY_CABLE_CHECK_INT 4
+/* SEC_BATTERY_CABLE_CHECK_POLLING
+ * check cable by GPIO polling
+ */
+#define SEC_BATTERY_CABLE_CHECK_POLLING 8
+
+/* check cable source */
+enum sec_battery_cable_source {
+ /* already given by external argument */
+ SEC_BATTERY_CABLE_SOURCE_EXTERNAL,
+ /* by callback (MUIC, USB switch) */
+ SEC_BATTERY_CABLE_SOURCE_CALLBACK,
+ /* by ADC */
+ SEC_BATTERY_CABLE_SOURCE_ADC,
+};
+#define sec_battery_cable_source_t \
+ enum sec_battery_cable_source
+
+/* capacity calculation type (can be used overlapped) */
+#define sec_fuelgauge_capacity_type_t unsigned int
+/* SEC_FUELGAUGE_CAPACITY_TYPE_RESET
+ * use capacity information to reset fuel gauge
+ * (only for driver algorithm, can NOT be set by user)
+ */
+#define SEC_FUELGAUGE_CAPACITY_TYPE_RESET (-1)
+/* SEC_FUELGAUGE_CAPACITY_TYPE_RAW
+ * use capacity information from fuel gauge directly
+ */
+#define SEC_FUELGAUGE_CAPACITY_TYPE_RAW 0
+/* SEC_FUELGAUGE_CAPACITY_TYPE_SCALE
+ * rescale capacity by scaling, need min and max value for scaling
+ */
+#define SEC_FUELGAUGE_CAPACITY_TYPE_SCALE 1
+/* SEC_FUELGAUGE_CAPACITY_TYPE_ATOMIC
+ * change capacity value by only -1 or +1
+ * no sudden change of capacity
+ */
+#define SEC_FUELGAUGE_CAPACITY_TYPE_ATOMIC 2
+
+/**
+ * struct sec_bat_adc_table_data - adc to temperature table for sec battery
+ * driver
+ * @adc: adc value
+ * @temperature: temperature(C) * 10
+ */
+struct sec_bat_adc_table_data {
+ int adc;
+ int temperature;
+};
+#define sec_bat_adc_table_data_t \
+ struct sec_bat_adc_table_data
+
+struct sec_bat_adc_region {
+ int min;
+ int max;
+};
+#define sec_bat_adc_region_t \
+ struct sec_bat_adc_region
+
+struct sec_charging_current {
+ int input_current_limit;
+ int fast_charging_current;
+ int full_check_current_1st;
+ int full_check_current_2nd;
+};
+#define sec_charging_current_t \
+ struct sec_charging_current
+
+struct sec_battery_platform_data {
+ /* NO NEED TO BE CHANGED */
+ /* callback functions */
+ void (*initial_check)(void);
+ bool (*bat_gpio_init)(void);
+ bool (*fg_gpio_init)(void);
+ bool (*chg_gpio_init)(void);
+ bool (*is_lpm)(void);
+ bool (*check_jig_status) (void);
+ int (*check_cable_callback)(void);
+ void (*cable_switch_check)(void);
+ void (*cable_switch_normal)(void);
+ bool (*check_cable_result_callback)(int);
+ bool (*check_battery_callback)(void);
+ bool (*check_battery_result_callback)(void);
+ int (*ovp_uvlo_callback)(void);
+ bool (*ovp_uvlo_result_callback)(int);
+ bool (*fuelalert_process)(bool);
+ bool (*get_temperature_callback)(
+ enum power_supply_property,
+ union power_supply_propval*);
+
+ /* ADC API for each ADC type */
+ sec_bat_adc_api_t adc_api[SEC_BATTERY_ADC_TYPE_NUM];
+ /* ADC region by power supply type
+ * ADC region should be exclusive
+ */
+ sec_bat_adc_region_t *cable_adc_value;
+ /* charging current for type (0: not use) */
+ sec_charging_current_t *charging_current;
+ int *polling_time;
+ /* NO NEED TO BE CHANGED */
+
+ char *pmic_name;
+
+ /* battery */
+ char *vendor;
+ int technology;
+ int battery_type;
+ void *battery_data;
+
+ int bat_gpio_ta_nconnected;
+ /* 1 : active high, 0 : active low */
+ int bat_polarity_ta_nconnected;
+ int bat_irq;
+ unsigned long bat_irq_attr;
+ sec_battery_cable_check_t cable_check_type;
+ sec_battery_cable_source_t cable_source_type;
+
+ bool use_LED; /* use charging LED */
+
+ bool event_check;
+ /* sustaining event after deactivated (second) */
+ unsigned int event_waiting_time;
+
+ /* Monitor setting */
+ sec_battery_monitor_polling_t polling_type;
+ /* for initial check */
+ unsigned int monitor_initial_count;
+
+ /* Battery check */
+ sec_battery_check_t battery_check_type;
+ /* how many times do we need to check battery */
+ unsigned int check_count;
+ /* ADC */
+ /* battery check ADC maximum value */
+ unsigned int check_adc_max;
+ /* battery check ADC minimum value */
+ unsigned int check_adc_min;
+
+ /* OVP/UVLO check */
+ sec_battery_ovp_uvlo_t ovp_uvlo_check_type;
+
+ sec_battery_thermal_source_t thermal_source;
+ sec_bat_adc_table_data_t *temp_adc_table;
+ unsigned int temp_adc_table_size;
+ sec_bat_adc_table_data_t *temp_amb_adc_table;
+ unsigned int temp_amb_adc_table_size;
+
+ sec_battery_temp_check_t temp_check_type;
+ unsigned int temp_check_count;
+ /*
+ * limit can be ADC value or Temperature
+ * depending on temp_check_type
+ * temperature should be temp x 10 (0.1 degree)
+ */
+ int temp_high_threshold_event;
+ int temp_high_recovery_event;
+ int temp_low_threshold_event;
+ int temp_low_recovery_event;
+ int temp_high_threshold_normal;
+ int temp_high_recovery_normal;
+ int temp_low_threshold_normal;
+ int temp_low_recovery_normal;
+ int temp_high_threshold_lpm;
+ int temp_high_recovery_lpm;
+ int temp_low_threshold_lpm;
+ int temp_low_recovery_lpm;
+
+ sec_battery_full_charged_t full_check_type;
+ unsigned int full_check_count;
+ /* ADC for single termination */
+ unsigned int full_check_adc_1st;
+ /* ADC for dual termination */
+ unsigned int full_check_adc_2nd;
+ int chg_gpio_full_check;
+ /* 1 : active high, 0 : active low */
+ int chg_polarity_full_check;
+ sec_battery_full_condition_t full_condition_type;
+ unsigned int full_condition_soc;
+ unsigned int full_condition_avgvcell;
+ unsigned int full_condition_ocv;
+
+ sec_battery_recharge_condition_t recharge_condition_type;
+ unsigned int recharge_condition_soc;
+ unsigned int recharge_condition_avgvcell;
+ unsigned int recharge_condition_vcell;
+
+ /* for absolute timer (second) */
+ unsigned long charging_total_time;
+ /* for recharging timer (second) */
+ unsigned long recharging_total_time;
+ /* reset charging for abnormal malfunction (0: not use) */
+ unsigned long charging_reset_time;
+
+ /* fuel gauge */
+ char *fuelgauge_name;
+ int fg_irq;
+ unsigned long fg_irq_attr;
+ /* fuel alert SOC (-1: not use) */
+ int fuel_alert_soc;
+ /* fuel alert can be repeated */
+ bool repeated_fuelalert;
+ sec_fuelgauge_capacity_type_t capacity_calculation_type;
+ /* soc should be soc x 10 (0.1% degree)
+ * only for scaling
+ */
+ unsigned int capacity_max;
+ unsigned int capacity_min;
+
+ /* charger */
+ char *charger_name;
+ int chg_gpio_en;
+ /* 1 : active high, 0 : active low */
+ int chg_polarity_en;
+ int chg_gpio_curr_adj;
+ /* 1 : active high, 0 : active low */
+ int chg_polarity_curr_adj;
+ int chg_gpio_status;
+ /* 1 : active high, 0 : active low */
+ int chg_polarity_status;
+ int chg_irq;
+ unsigned long chg_irq_attr;
+ /* float voltage (mV) */
+ int chg_float_voltage;
+
+ /* ADC setting */
+ unsigned int adc_check_count;
+ /* ADC type for each channel */
+ unsigned int adc_type[];
+};
+#define sec_battery_platform_data_t \
+ struct sec_battery_platform_data
+
+static inline struct power_supply *get_power_supply_by_name(char *name)
+{
+ if (!name)
+ return (struct power_supply *)NULL;
+ else
+ return power_supply_get_by_name(name);
+}
+
+#define psy_do_property(name, function, property, value) \
+{ \
+ struct power_supply *psy; \
+ int ret; \
+ psy = get_power_supply_by_name((name)); \
+ if (!psy) { \
+ pr_err("%s: Fail to "#function" psy (%s)\n", \
+ __func__, (name)); \
+ value.intval = 0; \
+ } else { \
+ ret = psy->function##_property(psy, (property), &(value)); \
+ if (ret < 0) { \
+ pr_err("%s: Fail to "#name" "#function" (%d=>%d)\n", \
+ __func__, (property), ret); \
+ value.intval = 0; \
+ } \
+ } \
+}
+
+#define adc_init(pdev, pdata, channel) \
+ ((pdata)->adc_api)[((pdata)->adc_type[(channel)])].init((pdev))
+
+#define adc_exit(pdata, channel) \
+ ((pdata)->adc_api)[((pdata)->adc_type[(channel)])].exit()
+
+#define adc_read(pdata, channel) \
+ ((pdata)->adc_api)[((pdata)->adc_type[(channel)])].read((channel))
+
+#define get_battery_data(driver) \
+ (((struct battery_data_t *)(driver)->pdata->battery_data) \
+ [(driver)->pdata->battery_type])
+
+#endif /* __SEC_CHARGING_COMMON_H */
diff --git a/include/linux/battery/sec_fuelgauge.h b/include/linux/battery/sec_fuelgauge.h
new file mode 100644
index 0000000..c3c3ab6
--- /dev/null
+++ b/include/linux/battery/sec_fuelgauge.h
@@ -0,0 +1,127 @@
+/*
+ * sec_fuelgauge.h
+ * Samsung Mobile Fuel Gauge Header
+ *
+ * Copyright (C) 2012 Samsung Electronics, Inc.
+ *
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __SEC_FUELGAUGE_H
+#define __SEC_FUELGAUGE_H __FILE__
+
+#include <linux/battery/sec_charging_common.h>
+
+#if defined(CONFIG_FUELGAUGE_DUMMY)
+#include <linux/battery/fuelgauge/dummy_fuelgauge.h>
+#elif defined(CONFIG_FUELGAUGE_MAX17042)
+#include <linux/battery/fuelgauge/max17042_fuelgauge.h>
+#elif defined(CONFIG_FUELGAUGE_MAX17048)
+#include <linux/battery/fuelgauge/max17048_fuelgauge.h>
+#elif defined(CONFIG_FUELGAUGE_MAX17050)
+#include <linux/battery/fuelgauge/max17050_fuelgauge.h>
+#endif
+
+struct sec_fuelgauge_reg_data {
+ u8 reg_addr;
+ u8 reg_data1;
+ u8 reg_data2;
+};
+
+static enum power_supply_property sec_fuelgauge_props[] = {
+ POWER_SUPPLY_PROP_STATUS,
+ POWER_SUPPLY_PROP_VOLTAGE_NOW,
+ POWER_SUPPLY_PROP_VOLTAGE_AVG,
+ POWER_SUPPLY_PROP_CURRENT_NOW,
+ POWER_SUPPLY_PROP_CURRENT_AVG,
+ POWER_SUPPLY_PROP_CAPACITY,
+ POWER_SUPPLY_PROP_TEMP,
+ POWER_SUPPLY_PROP_TEMP_AMBIENT,
+};
+
+struct sec_fuelgauge_info {
+ struct i2c_client *client;
+ sec_battery_platform_data_t *pdata;
+ struct power_supply psy_fg;
+ struct delayed_work isr_work;
+
+ int cable_type;
+ bool is_charging;
+
+ /* HW-dedicated fuel guage info structure
+ * used in individual fuel gauge file only
+ * (ex. dummy_fuelgauge.c)
+ */
+ struct sec_fg_info info;
+
+ bool is_fuel_alerted;
+ struct wake_lock fuel_alert_wake_lock;
+
+ unsigned int capacity_old; /* only for atomic calculation */
+
+ bool initial_update_of_soc;
+ struct mutex fg_lock;
+
+ /* register programming */
+ int reg_addr;
+ u8 reg_data[2];
+};
+
+bool sec_hal_fg_init(struct i2c_client *);
+bool sec_hal_fg_suspend(struct i2c_client *);
+bool sec_hal_fg_resume(struct i2c_client *);
+bool sec_hal_fg_fuelalert_init(struct i2c_client *, int);
+bool sec_hal_fg_is_fuelalerted(struct i2c_client *);
+bool sec_hal_fg_fuelalert_process(void *, bool);
+bool sec_hal_fg_full_charged(struct i2c_client *);
+bool sec_hal_fg_reset(struct i2c_client *);
+bool sec_hal_fg_get_property(struct i2c_client *,
+ enum power_supply_property,
+ union power_supply_propval *);
+bool sec_hal_fg_set_property(struct i2c_client *,
+ enum power_supply_property,
+ const union power_supply_propval *);
+
+ssize_t sec_hal_fg_show_attrs(struct device *dev,
+ const ptrdiff_t offset, char *buf);
+
+ssize_t sec_hal_fg_store_attrs(struct device *dev,
+ const ptrdiff_t offset,
+ const char *buf, size_t count);
+
+ssize_t sec_fg_show_attrs(struct device *dev,
+ struct device_attribute *attr, char *buf);
+
+ssize_t sec_fg_store_attrs(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count);
+
+#define SEC_FG_ATTR(_name) \
+{ \
+ .attr = {.name = #_name, .mode = 0666}, \
+ .show = sec_fg_show_attrs, \
+ .store = sec_fg_store_attrs, \
+}
+
+static struct device_attribute sec_fg_attrs[] = {
+ SEC_FG_ATTR(reg),
+ SEC_FG_ATTR(data),
+ SEC_FG_ATTR(regs),
+};
+
+enum {
+ FG_REG = 0,
+ FG_DATA,
+ FG_REGS,
+};
+
+#endif /* __SEC_FUELGAUGE_H */
diff --git a/include/linux/bh1721fvc.h b/include/linux/bh1721fvc.h
new file mode 100755
index 0000000..1b7d4ce
--- /dev/null
+++ b/include/linux/bh1721fvc.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2010 Samsung Electronics. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef _BH1721FVC_H_
+#define _BH1721FVC_H_
+
+#include <linux/types.h>
+
+struct bh1721fvc_platform_data {
+ int (*reset)(void);
+ int (*output)(int);
+};
+
+#endif
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h
index dcafe0b..50e2c16 100644
--- a/include/linux/bitmap.h
+++ b/include/linux/bitmap.h
@@ -45,6 +45,7 @@
* bitmap_set(dst, pos, nbits) Set specified bit area
* bitmap_clear(dst, pos, nbits) Clear specified bit area
* bitmap_find_next_zero_area(buf, len, pos, n, mask) Find bit free area
+ * bitmap_find_next_zero_area_off(buf, len, pos, n, mask) as above
* bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n
* bitmap_shift_left(dst, src, n, nbits) *dst = *src << n
* 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);
extern void bitmap_set(unsigned long *map, int i, int len);
extern void bitmap_clear(unsigned long *map, int start, int nr);
-extern unsigned long bitmap_find_next_zero_area(unsigned long *map,
- unsigned long size,
- unsigned long start,
- unsigned int nr,
- unsigned long align_mask);
+
+extern unsigned long bitmap_find_next_zero_area_off(unsigned long *map,
+ unsigned long size,
+ unsigned long start,
+ unsigned int nr,
+ unsigned long align_mask,
+ unsigned long align_offset);
+
+static inline unsigned long
+bitmap_find_next_zero_area(unsigned long *map,
+ unsigned long size,
+ unsigned long start,
+ unsigned int nr,
+ unsigned long align_mask)
+{
+ return bitmap_find_next_zero_area_off(map, size, start, nr,
+ align_mask, 0);
+}
extern int bitmap_scnprintf(char *buf, unsigned int len,
const unsigned long *src, int nbits);
diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index ab4ac0c..543250e 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -84,12 +84,6 @@ enum {
CSS_REMOVED, /* This CSS is dead */
};
-/* Caller must verify that the css is not for root cgroup */
-static inline void __css_get(struct cgroup_subsys_state *css, int count)
-{
- atomic_add(count, &css->refcnt);
-}
-
/*
* Call css_get() to hold a reference on the css; it can be used
* for a reference obtained via:
@@ -97,6 +91,7 @@ static inline void __css_get(struct cgroup_subsys_state *css, int count)
* - task->cgroups for a locked task
*/
+extern void __css_get(struct cgroup_subsys_state *css, int count);
static inline void css_get(struct cgroup_subsys_state *css)
{
/* We don't need to reference count the root state */
@@ -143,10 +138,7 @@ static inline void css_put(struct cgroup_subsys_state *css)
enum {
/* Control Group is dead */
CGRP_REMOVED,
- /*
- * Control Group has previously had a child cgroup or a task,
- * but no longer (only if CGRP_NOTIFY_ON_RELEASE is set)
- */
+ /* Control Group has ever had a child cgroup or a task */
CGRP_RELEASABLE,
/* Control Group requires release notifications to userspace */
CGRP_NOTIFY_ON_RELEASE,
@@ -287,6 +279,7 @@ struct css_set {
/* For RCU-protected deletion */
struct rcu_head rcu_head;
+ struct work_struct work;
};
/*
@@ -466,6 +459,7 @@ struct cgroup_subsys {
struct cgroup *cgrp);
int (*pre_destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
void (*destroy)(struct cgroup_subsys *ss, struct cgroup *cgrp);
+ int (*allow_attach)(struct cgroup *cgrp, struct task_struct *tsk);
int (*can_attach)(struct cgroup_subsys *ss, struct cgroup *cgrp,
struct task_struct *tsk);
int (*can_attach_task)(struct cgroup *cgrp, struct task_struct *tsk);
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 18a1baf..ddafbff 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -202,6 +202,7 @@ struct clocksource {
#define CLOCK_SOURCE_WATCHDOG 0x10
#define CLOCK_SOURCE_VALID_FOR_HRES 0x20
#define CLOCK_SOURCE_UNSTABLE 0x40
+#define CLOCK_SOURCE_SCHED_CLOCK 0x80
/* simplify initialization of mask field */
#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 0000000..0287f4e
--- /dev/null
+++ b/include/linux/cma.h
@@ -0,0 +1,493 @@
+#ifndef __LINUX_CMA_H
+#define __LINUX_CMA_H
+
+/* linux/include/linux/cma.h
+ *
+ * Contiguous Memory Allocator framework
+ * Copyright (c) 2010 by Samsung Electronics.
+ * Written by Michal Nazarewicz (m.nazarewicz@samsung.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation
+ */
+
+/*
+ * See Documentation/contiguous-memory.txt for details.
+ */
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+
+#define CMA_MAGIC (('c' << 24) | ('M' << 16) | ('a' << 8) | 0x42)
+
+enum {
+ CMA_REQ_DEV_KIND,
+ CMA_REQ_FROM_REG
+};
+
+/**
+ * An information about area exportable to user space.
+ * @magic: must always be CMA_MAGIC.
+ * @type: type of the request.
+ * @spec: either "dev/kind\0" or "regions\0" depending on @type.
+ * In any case, the string must be NUL terminated.
+ * additionally, in the latter case scanning stops at
+ * semicolon (';').
+ * @size: size of the chunk to allocate.
+ * @alignment: desired alignment of the chunk (must be power of two or zero).
+ * @start: when ioctl() finishes this stores physical address of the chunk.
+ */
+struct cma_alloc_request {
+ __u32 magic;
+ __u32 type;
+
+ /* __u64 to be compatible accross 32 and 64 bit systems. */
+ __u64 size;
+ __u64 alignment;
+ __u64 start;
+
+ char spec[32];
+};
+
+#define IOCTL_CMA_ALLOC _IOWR('p', 0, struct cma_alloc_request)
+
+
+/***************************** Kernel level API *****************************/
+
+#ifdef __KERNEL__
+
+#include <linux/rbtree.h>
+#include <linux/list.h>
+#if defined CONFIG_CMA_SYSFS
+# include <linux/kobject.h>
+#endif
+
+
+struct device;
+struct cma_info;
+
+/*
+ * Don't call it directly, use cma_alloc(), cma_alloc_from() or
+ * cma_alloc_from_region().
+ */
+dma_addr_t __must_check
+__cma_alloc(const struct device *dev, const char *type,
+ size_t size, dma_addr_t alignment);
+
+/* Don't call it directly, use cma_info() or cma_info_about(). */
+int
+__cma_info(struct cma_info *info, const struct device *dev, const char *type);
+
+
+/**
+ * cma_alloc - allocates contiguous chunk of memory.
+ * @dev: The device to perform allocation for.
+ * @type: A type of memory to allocate. Platform may define
+ * several different types of memory and device drivers
+ * can then request chunks of different types. Usually it's
+ * safe to pass NULL here which is the same as passing
+ * "common".
+ * @size: Size of the memory to allocate in bytes.
+ * @alignment: Desired alignment in bytes. Must be a power of two or
+ * zero. If alignment is less then a page size it will be
+ * set to page size. If unsure, pass zero here.
+ *
+ * On error returns a negative error cast to dma_addr_t. Use
+ * IS_ERR_VALUE() to check if returned value is indeed an error.
+ * Otherwise bus address of the chunk is returned.
+ */
+static inline dma_addr_t __must_check
+cma_alloc(const struct device *dev, const char *type,
+ size_t size, dma_addr_t alignment)
+{
+ return dev ? __cma_alloc(dev, type, size, alignment) : -EINVAL;
+}
+
+
+/**
+ * struct cma_info - information about regions returned by cma_info().
+ * @lower_bound: The smallest address that is possible to be
+ * allocated for given (dev, type) pair.
+ * @upper_bound: The one byte after the biggest address that is
+ * possible to be allocated for given (dev, type)
+ * pair.
+ * @total_size: Total size of regions mapped to (dev, type) pair.
+ * @free_size: Total free size in all of the regions mapped to (dev, type)
+ * pair. Because of possible race conditions, it is not
+ * guaranteed that the value will be correct -- it gives only
+ * an approximation.
+ * @count: Number of regions mapped to (dev, type) pair.
+ */
+struct cma_info {
+ dma_addr_t lower_bound, upper_bound;
+ size_t total_size, free_size;
+ unsigned count;
+};
+
+/**
+ * cma_info - queries information about regions.
+ * @info: Pointer to a structure where to save the information.
+ * @dev: The device to query information for.
+ * @type: A type of memory to query information for.
+ * If unsure, pass NULL here which is equal to passing
+ * "common".
+ *
+ * On error returns a negative error, zero otherwise.
+ */
+static inline int
+cma_info(struct cma_info *info, const struct device *dev, const char *type)
+{
+ return dev ? __cma_info(info, dev, type) : -EINVAL;
+}
+
+
+/**
+ * cma_free - frees a chunk of memory.
+ * @addr: Beginning of the chunk.
+ *
+ * Returns -ENOENT if there is no chunk at given location; otherwise
+ * zero. In the former case issues a warning.
+ */
+int cma_free(dma_addr_t addr);
+
+/**
+ * cma_get_virt - frees virtual address of cma memory.
+ * @phys: physical addrress
+ * @size: size of memory
+ * @noncached : 0 is cached, 1 is non-cached.
+ *
+ * Returns -ENOENT if there is no chunk at given location; otherwise
+ * zero. In the former case issues a warning.
+ */
+void *cma_get_virt(dma_addr_t phys, dma_addr_t size, int noncached);
+
+
+/****************************** Lower lever API *****************************/
+
+/**
+ * cma_alloc_from - allocates contiguous chunk of memory from named regions.
+ * @regions: Comma separated list of region names. Terminated by NUL
+ * byte or a semicolon.
+ * @size: Size of the memory to allocate in bytes.
+ * @alignment: Desired alignment in bytes. Must be a power of two or
+ * zero. If alignment is less then a page size it will be
+ * set to page size. If unsure, pass zero here.
+ *
+ * On error returns a negative error cast to dma_addr_t. Use
+ * IS_ERR_VALUE() to check if returned value is indeed an error.
+ * Otherwise bus address of the chunk is returned.
+ */
+static inline dma_addr_t __must_check
+cma_alloc_from(const char *regions, size_t size, dma_addr_t alignment)
+{
+ return __cma_alloc(NULL, regions, size, alignment);
+}
+
+/**
+ * cma_info_about - queries information about named regions.
+ * @info: Pointer to a structure where to save the information.
+ * @regions: Comma separated list of region names. Terminated by NUL
+ * byte or a semicolon.
+ *
+ * On error returns a negative error, zero otherwise.
+ */
+static inline int
+cma_info_about(struct cma_info *info, const const char *regions)
+{
+ return __cma_info(info, NULL, regions);
+}
+
+
+
+struct cma_allocator;
+
+/**
+ * struct cma_region - a region reserved for CMA allocations.
+ * @name: Unique name of the region. Read only.
+ * @start: Bus address of the region in bytes. Always aligned at
+ * least to a full page. Read only.
+ * @size: Size of the region in bytes. Multiply of a page size.
+ * Read only.
+ * @free_space: Free space in the region. Read only.
+ * @alignment: Desired alignment of the region in bytes. A power of two,
+ * always at least page size. Early.
+ * @alloc: Allocator used with this region. NULL means allocator is
+ * not attached. Private.
+ * @alloc_name: Allocator name read from cmdline. Private. This may be
+ * different from @alloc->name.
+ * @private_data: Allocator's private data.
+ * @users: Number of chunks allocated in this region.
+ * @list: Entry in list of regions. Private.
+ * @used: Whether region was already used, ie. there was at least
+ * one allocation request for. Private.
+ * @registered: Whether this region has been registered. Read only.
+ * @reserved: Whether this region has been reserved. Early. Read only.
+ * @copy_name: Whether @name and @alloc_name needs to be copied when
+ * this region is converted from early to normal. Early.
+ * Private.
+ * @free_alloc_name: Whether @alloc_name was kmalloced(). Private.
+ *
+ * Regions come in two types: an early region and normal region. The
+ * former can be reserved or not-reserved. Fields marked as "early"
+ * are only meaningful in early regions.
+ *
+ * Early regions are important only during initialisation. The list
+ * of early regions is built from the "cma" command line argument or
+ * platform defaults. Platform initialisation code is responsible for
+ * reserving space for unreserved regions that are placed on
+ * cma_early_regions list.
+ *
+ * Later, during CMA initialisation all reserved regions from the
+ * cma_early_regions list are registered as normal regions and can be
+ * used using standard mechanisms.
+ */
+struct cma_region {
+ const char *name;
+ dma_addr_t start;
+ size_t size;
+ union {
+ size_t free_space; /* Normal region */
+ dma_addr_t alignment; /* Early region */
+ };
+
+ struct cma_allocator *alloc;
+ const char *alloc_name;
+ void *private_data;
+
+ unsigned users;
+ struct list_head list;
+
+#if defined CONFIG_CMA_SYSFS
+ struct kobject kobj;
+#endif
+
+ unsigned used:1;
+ unsigned registered:1;
+ unsigned reserved:1;
+ unsigned copy_name:1;
+ unsigned free_alloc_name:1;
+};
+
+
+/**
+ * cma_region_register() - registers a region.
+ * @reg: Region to region.
+ *
+ * Region's start and size must be set.
+ *
+ * If name is set the region will be accessible using normal mechanism
+ * like mapping or cma_alloc_from() function otherwise it will be
+ * a private region and accessible only using the
+ * cma_alloc_from_region() function.
+ *
+ * If alloc is set function will try to initialise given allocator
+ * (and will return error if it failes). Otherwise alloc_name may
+ * point to a name of an allocator to use (if not set, the default
+ * will be used).
+ *
+ * All other fields are ignored and/or overwritten.
+ *
+ * Returns zero or negative error. In particular, -EADDRINUSE if
+ * region overlap with already existing region.
+ */
+int __must_check cma_region_register(struct cma_region *reg);
+
+/**
+ * cma_region_unregister() - unregisters a region.
+ * @reg: Region to unregister.
+ *
+ * Region is unregistered only if there are no chunks allocated for
+ * it. Otherwise, function returns -EBUSY.
+ *
+ * On success returs zero.
+ */
+int __must_check cma_region_unregister(struct cma_region *reg);
+
+
+/**
+ * cma_alloc_from_region() - allocates contiguous chunk of memory from region.
+ * @reg: Region to allocate chunk from.
+ * @size: Size of the memory to allocate in bytes.
+ * @alignment: Desired alignment in bytes. Must be a power of two or
+ * zero. If alignment is less then a page size it will be
+ * set to page size. If unsure, pass zero here.
+ *
+ * On error returns a negative error cast to dma_addr_t. Use
+ * IS_ERR_VALUE() to check if returned value is indeed an error.
+ * Otherwise bus address of the chunk is returned.
+ */
+dma_addr_t __must_check
+cma_alloc_from_region(struct cma_region *reg,
+ size_t size, dma_addr_t alignment);
+
+
+
+/****************************** Allocators API ******************************/
+
+/**
+ * struct cma_chunk - an allocated contiguous chunk of memory.
+ * @start: Bus address in bytes.
+ * @size: Size in bytes.
+ * @free_space: Free space in region in bytes. Read only.
+ * @reg: Region this chunk belongs to.
+ * @by_start: A node in an red-black tree with all chunks sorted by
+ * start address.
+ *
+ * The cma_allocator::alloc() operation need to set only the @start
+ * and @size fields. The rest is handled by the caller (ie. CMA
+ * glue).
+ */
+struct cma_chunk {
+ dma_addr_t start;
+ size_t size;
+
+ struct cma_region *reg;
+ struct rb_node by_start;
+};
+
+
+/**
+ * struct cma_allocator - a CMA allocator.
+ * @name: Allocator's unique name
+ * @init: Initialises an allocator on given region.
+ * @cleanup: Cleans up after init. May assume that there are no chunks
+ * allocated in given region.
+ * @alloc: Allocates a chunk of memory of given size in bytes and
+ * with given alignment. Alignment is a power of
+ * two (thus non-zero) and callback does not need to check it.
+ * May also assume that it is the only call that uses given
+ * region (ie. access to the region is synchronised with
+ * a mutex). This has to allocate the chunk object (it may be
+ * contained in a bigger structure with allocator-specific data.
+ * Required.
+ * @free: Frees allocated chunk. May also assume that it is the only
+ * call that uses given region. This has to free() the chunk
+ * object as well. Required.
+ * @list: Entry in list of allocators. Private.
+ */
+struct cma_allocator {
+ const char *name;
+
+ int (*init)(struct cma_region *reg);
+ void (*cleanup)(struct cma_region *reg);
+ struct cma_chunk *(*alloc)(struct cma_region *reg, size_t size,
+ dma_addr_t alignment);
+ void (*free)(struct cma_chunk *chunk);
+
+ struct list_head list;
+};
+
+
+/**
+ * cma_allocator_register() - Registers an allocator.
+ * @alloc: Allocator to register.
+ *
+ * Adds allocator to the list of allocators managed by CMA.
+ *
+ * All of the fields of cma_allocator structure must be set except for
+ * the optional name and the list's head which will be overriden
+ * anyway.
+ *
+ * Returns zero or negative error code.
+ */
+int cma_allocator_register(struct cma_allocator *alloc);
+
+
+/**************************** Initialisation API ****************************/
+
+/**
+ * cma_set_defaults() - specifies default command line parameters.
+ * @regions: A zero-sized entry terminated list of early regions.
+ * This array must not be placed in __initdata section.
+ * @map: Map attribute.
+ *
+ * This function should be called prior to cma_early_regions_reserve()
+ * and after early parameters have been parsed.
+ *
+ * Returns zero or negative error.
+ */
+int __init cma_set_defaults(struct cma_region *regions, const char *map);
+
+
+/**
+ * cma_early_regions - a list of early regions.
+ *
+ * Platform needs to allocate space for each of the region before
+ * initcalls are executed. If space is reserved, the reserved flag
+ * must be set. Platform initialisation code may choose to use
+ * cma_early_regions_allocate().
+ *
+ * Later, during CMA initialisation all reserved regions from the
+ * cma_early_regions list are registered as normal regions and can be
+ * used using standard mechanisms.
+ */
+extern struct list_head cma_early_regions __initdata;
+
+
+/**
+ * cma_early_region_register() - registers an early region.
+ * @reg: Region to add.
+ *
+ * Region's size, start and alignment must be set (however the last
+ * two can be zero). If name is set the region will be accessible
+ * using normal mechanism like mapping or cma_alloc_from() function
+ * otherwise it will be a private region accessible only using the
+ * cma_alloc_from_region().
+ *
+ * During platform initialisation, space is reserved for early
+ * regions. Later, when CMA initialises, the early regions are
+ * "converted" into normal regions. If cma_region::alloc is set, CMA
+ * will then try to setup given allocator on the region. Failure to
+ * do so will result in the region not being registered even though
+ * the space for it will still be reserved. If cma_region::alloc is
+ * not set, allocator will be attached to the region on first use and
+ * the value of cma_region::alloc_name will be taken into account if
+ * set.
+ *
+ * All other fields are ignored and/or overwritten.
+ *
+ * Returns zero or negative error. No checking if regions overlap is
+ * performed.
+ */
+int __init __must_check cma_early_region_register(struct cma_region *reg);
+
+
+/**
+ * cma_early_region_reserve() - reserves a physically contiguous memory region.
+ * @reg: Early region to reserve memory for.
+ *
+ * If platform supports bootmem this is the first allocator this
+ * function tries to use. If that failes (or bootmem is not
+ * supported) function tries to use memblec if it is available.
+ *
+ * On success sets reg->reserved flag.
+ *
+ * Returns zero or negative error.
+ */
+int __init cma_early_region_reserve(struct cma_region *reg);
+
+/**
+ * cma_early_regions_reserve() - helper function for reserving early regions.
+ * @reserve: Callbac function used to reserve space for region. Needs
+ * to return non-negative if allocation succeeded, negative
+ * error otherwise. NULL means cma_early_region_alloc() will
+ * be used.
+ *
+ * This function traverses the %cma_early_regions list and tries to
+ * reserve memory for each early region. It uses the @reserve
+ * callback function for that purpose. The reserved flag of each
+ * region is updated accordingly.
+ */
+void __init cma_early_regions_reserve(int (*reserve)(struct cma_region *reg));
+
+#else
+
+#define cma_set_defaults(regions, map) ((int)0)
+#define cma_early_region_reserve(region) ((int)-EOPNOTSUPP)
+#define cma_early_regions_reserve(reserve) do { } while (0)
+
+#endif
+
+#endif
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index 5f09323..97f1ca7 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -174,4 +174,11 @@ static inline int disable_nonboot_cpus(void) { return 0; }
static inline void enable_nonboot_cpus(void) {}
#endif /* !CONFIG_PM_SLEEP_SMP */
+#define IDLE_START 1
+#define IDLE_END 2
+
+void idle_notifier_register(struct notifier_block *n);
+void idle_notifier_unregister(struct notifier_block *n);
+void idle_notifier_call_chain(unsigned long val);
+
#endif /* _LINUX_CPU_H_ */
diff --git a/include/linux/cpu_cooling.h b/include/linux/cpu_cooling.h
new file mode 100644
index 0000000..859600f
--- /dev/null
+++ b/include/linux/cpu_cooling.h
@@ -0,0 +1,45 @@
+/*
+ * linux/include/linux/cpu_cooling.h
+ *
+ * Copyright (C) 2011 Samsung Electronics Co., Ltd(http://www.samsung.com)
+ * Copyright (C) 2011 Amit Daniel <amit.kachhap at linaro.org>
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+ *
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ */
+
+#ifndef __CPU_COOLING_H__
+#define __CPU_COOLING_H__
+
+#include <linux/thermal.h>
+
+struct freq_pctg_table {
+ unsigned int freq_clip_pctg[NR_CPUS];
+ unsigned int polling_interval;
+};
+
+extern struct thermal_cooling_device *cpufreq_cooling_register(
+ struct freq_pctg_table *tab_ptr, unsigned int tab_size,
+ const struct cpumask *mask_val);
+
+extern void cpufreq_cooling_unregister(void);
+
+extern struct thermal_cooling_device *cpuhotplug_cooling_register(
+ const struct cpumask *mask_val);
+
+extern void cpuhotplug_cooling_unregister(void);
+
+#endif /* __CPU_COOLING_H__ */
diff --git a/include/linux/cpuacct.h b/include/linux/cpuacct.h
new file mode 100644
index 0000000..8f68e73
--- /dev/null
+++ b/include/linux/cpuacct.h
@@ -0,0 +1,43 @@
+/* include/linux/cpuacct.h
+ *
+ * Copyright (C) 2010 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _CPUACCT_H_
+#define _CPUACCT_H_
+
+#include <linux/cgroup.h>
+
+#ifdef CONFIG_CGROUP_CPUACCT
+
+/*
+ * Platform specific CPU frequency hooks for cpuacct. These functions are
+ * called from the scheduler.
+ */
+struct cpuacct_charge_calls {
+ /*
+ * Platforms can take advantage of this data and use
+ * per-cpu allocations if necessary.
+ */
+ void (*init) (void **cpuacct_data);
+ void (*charge) (void *cpuacct_data, u64 cputime, unsigned int cpu);
+ void (*cpufreq_show) (void *cpuacct_data, struct cgroup_map_cb *cb);
+ /* Returns power consumed in milliWatt seconds */
+ u64 (*power_usage) (void *cpuacct_data);
+};
+
+int cpuacct_charge_register(struct cpuacct_charge_calls *fn);
+
+#endif /* CONFIG_CGROUP_CPUACCT */
+
+#endif // _CPUACCT_H_
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 11be48e..3eb41ff 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -331,6 +331,17 @@ static inline unsigned int cpufreq_quick_get(unsigned int cpu)
}
#endif
+#ifdef CONFIG_CPU_FREQ_GOV_ONDEMAND_FLEXRATE
+extern int cpufreq_ondemand_flexrate_request(unsigned int rate_ms,
+ unsigned int duration);
+#else
+static inline int cpufreq_ondemand_flexrate_request(unsigned int rate_ms,
+ unsigned int duration)
+{
+ return 0;
+}
+#endif
+
/*********************************************************************
* CPUFREQ DEFAULT GOVERNOR *
@@ -358,6 +369,15 @@ extern struct cpufreq_governor cpufreq_gov_ondemand;
#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE)
extern struct cpufreq_governor cpufreq_gov_conservative;
#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_conservative)
+#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_INTERACTIVE)
+extern struct cpufreq_governor cpufreq_gov_interactive;
+#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_interactive)
+#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_ADAPTIVE)
+extern struct cpufreq_governor cpufreq_gov_adaptive;
+#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_adaptive)
+#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_PEGASUSQ)
+extern struct cpufreq_governor cpufreq_gov_pegasusq;
+#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_pegasusq)
#endif
diff --git a/include/linux/cpufreq_pegasusq.h b/include/linux/cpufreq_pegasusq.h
new file mode 100644
index 0000000..ed48127
--- /dev/null
+++ b/include/linux/cpufreq_pegasusq.h
@@ -0,0 +1,22 @@
+/*
+ * linux/include/linux/cpufreq_pegasusq.h
+ *
+ * Copyright (C) 2001 Samsung Electronics co. ltd
+ * ByungChang Cha <bc.cha@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _LINUX_CPUFREQ_PEGASUSQ_H
+#define _LINUX_CPUFREQ_PEGASUSQ_H
+
+/* return -EINVAL when
+ * 1. num_core is invalid value
+ * 2. already locked with smaller num_core value
+ */
+int cpufreq_pegasusq_cpu_lock(int num_core);
+int cpufreq_pegasusq_cpu_unlock(int num_core);
+
+#endif
diff --git a/include/linux/crypto.h b/include/linux/crypto.h
index a6a7a1c..408bcb4 100644
--- a/include/linux/crypto.h
+++ b/include/linux/crypto.h
@@ -7,10 +7,10 @@
*
* Portions derived from Cryptoapi, by Alexander Kjeldaas <astor@fast.no>
* and Nettle, by Niels Möller.
- *
+ *
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
+ * Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
*/
@@ -25,6 +25,9 @@
#include <linux/string.h>
#include <linux/uaccess.h>
+#ifdef CONFIG_CRYPTO_FIPS
+#include <linux/err.h>
+#endif
/*
* Algorithm masks and types.
*/
@@ -81,10 +84,10 @@
#define CRYPTO_TFM_REQ_MAY_SLEEP 0x00000200
#define CRYPTO_TFM_REQ_MAY_BACKLOG 0x00000400
#define CRYPTO_TFM_RES_WEAK_KEY 0x00100000
-#define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000
-#define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000
-#define CRYPTO_TFM_RES_BAD_BLOCK_LEN 0x00800000
-#define CRYPTO_TFM_RES_BAD_FLAGS 0x01000000
+#define CRYPTO_TFM_RES_BAD_KEY_LEN 0x00200000
+#define CRYPTO_TFM_RES_BAD_KEY_SCHED 0x00400000
+#define CRYPTO_TFM_RES_BAD_BLOCK_LEN 0x00800000
+#define CRYPTO_TFM_RES_BAD_FLAGS 0x01000000
/*
* Miscellaneous stuff.
@@ -103,6 +106,10 @@
#define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN)))
+#ifdef CONFIG_CRYPTO_FIPS
+bool in_fips_err(void);
+#endif
+
struct scatterlist;
struct crypto_ablkcipher;
struct crypto_async_request;
@@ -296,7 +303,7 @@ struct crypto_alg {
int (*cra_init)(struct crypto_tfm *tfm);
void (*cra_exit)(struct crypto_tfm *tfm);
void (*cra_destroy)(struct crypto_alg *alg);
-
+
struct module *cra_module;
};
@@ -401,7 +408,7 @@ struct rng_tfm {
struct crypto_tfm {
u32 crt_flags;
-
+
union {
struct ablkcipher_tfm ablkcipher;
struct aead_tfm aead;
@@ -413,7 +420,7 @@ struct crypto_tfm {
} crt_u;
void (*exit)(struct crypto_tfm *tfm);
-
+
struct crypto_alg *__crt_alg;
void *__crt_ctx[] CRYPTO_MINALIGN_ATTR;
@@ -473,10 +480,10 @@ struct crypto_attr_u32 {
u32 num;
};
-/*
+/*
* Transform user interface.
*/
-
+
struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask);
void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm);
@@ -654,6 +661,11 @@ static inline int crypto_ablkcipher_encrypt(struct ablkcipher_request *req)
{
struct ablkcipher_tfm *crt =
crypto_ablkcipher_crt(crypto_ablkcipher_reqtfm(req));
+
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
return crt->encrypt(req);
}
@@ -661,6 +673,12 @@ static inline int crypto_ablkcipher_decrypt(struct ablkcipher_request *req)
{
struct ablkcipher_tfm *crt =
crypto_ablkcipher_crt(crypto_ablkcipher_reqtfm(req));
+
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
return crt->decrypt(req);
}
@@ -687,6 +705,11 @@ static inline struct ablkcipher_request *ablkcipher_request_alloc(
{
struct ablkcipher_request *req;
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return NULL;
+#endif
+
req = kmalloc(sizeof(struct ablkcipher_request) +
crypto_ablkcipher_reqsize(tfm), gfp);
@@ -795,11 +818,21 @@ static inline struct crypto_aead *crypto_aead_reqtfm(struct aead_request *req)
static inline int crypto_aead_encrypt(struct aead_request *req)
{
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
return crypto_aead_crt(crypto_aead_reqtfm(req))->encrypt(req);
}
static inline int crypto_aead_decrypt(struct aead_request *req)
{
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
return crypto_aead_crt(crypto_aead_reqtfm(req))->decrypt(req);
}
@@ -819,6 +852,11 @@ static inline struct aead_request *aead_request_alloc(struct crypto_aead *tfm,
{
struct aead_request *req;
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return NULL;
+#endif
+
req = kmalloc(sizeof(*req) + crypto_aead_reqsize(tfm), gfp);
if (likely(req))
@@ -967,6 +1005,11 @@ static inline int crypto_blkcipher_encrypt(struct blkcipher_desc *desc,
struct scatterlist *src,
unsigned int nbytes)
{
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
desc->info = crypto_blkcipher_crt(desc->tfm)->iv;
return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes);
}
@@ -976,6 +1019,11 @@ static inline int crypto_blkcipher_encrypt_iv(struct blkcipher_desc *desc,
struct scatterlist *src,
unsigned int nbytes)
{
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
return crypto_blkcipher_crt(desc->tfm)->encrypt(desc, dst, src, nbytes);
}
@@ -984,6 +1032,11 @@ static inline int crypto_blkcipher_decrypt(struct blkcipher_desc *desc,
struct scatterlist *src,
unsigned int nbytes)
{
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
desc->info = crypto_blkcipher_crt(desc->tfm)->iv;
return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes);
}
@@ -993,6 +1046,11 @@ static inline int crypto_blkcipher_decrypt_iv(struct blkcipher_desc *desc,
struct scatterlist *src,
unsigned int nbytes)
{
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
return crypto_blkcipher_crt(desc->tfm)->decrypt(desc, dst, src, nbytes);
}
@@ -1090,6 +1148,11 @@ static inline int crypto_cipher_setkey(struct crypto_cipher *tfm,
static inline void crypto_cipher_encrypt_one(struct crypto_cipher *tfm,
u8 *dst, const u8 *src)
{
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return;
+#endif
+
crypto_cipher_crt(tfm)->cit_encrypt_one(crypto_cipher_tfm(tfm),
dst, src);
}
@@ -1097,6 +1160,11 @@ static inline void crypto_cipher_encrypt_one(struct crypto_cipher *tfm,
static inline void crypto_cipher_decrypt_one(struct crypto_cipher *tfm,
u8 *dst, const u8 *src)
{
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return;
+#endif
+
crypto_cipher_crt(tfm)->cit_decrypt_one(crypto_cipher_tfm(tfm),
dst, src);
}
@@ -1181,6 +1249,11 @@ static inline void crypto_hash_clear_flags(struct crypto_hash *tfm, u32 flags)
static inline int crypto_hash_init(struct hash_desc *desc)
{
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
return crypto_hash_crt(desc->tfm)->init(desc);
}
@@ -1188,11 +1261,21 @@ static inline int crypto_hash_update(struct hash_desc *desc,
struct scatterlist *sg,
unsigned int nbytes)
{
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
return crypto_hash_crt(desc->tfm)->update(desc, sg, nbytes);
}
static inline int crypto_hash_final(struct hash_desc *desc, u8 *out)
{
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
return crypto_hash_crt(desc->tfm)->final(desc, out);
}
@@ -1200,6 +1283,11 @@ static inline int crypto_hash_digest(struct hash_desc *desc,
struct scatterlist *sg,
unsigned int nbytes, u8 *out)
{
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
return crypto_hash_crt(desc->tfm)->digest(desc, sg, nbytes, out);
}
@@ -1264,6 +1352,11 @@ static inline int crypto_comp_compress(struct crypto_comp *tfm,
const u8 *src, unsigned int slen,
u8 *dst, unsigned int *dlen)
{
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
return crypto_comp_crt(tfm)->cot_compress(crypto_comp_tfm(tfm),
src, slen, dst, dlen);
}
@@ -1272,9 +1365,13 @@ static inline int crypto_comp_decompress(struct crypto_comp *tfm,
const u8 *src, unsigned int slen,
u8 *dst, unsigned int *dlen)
{
+#ifdef CONFIG_CRYPTO_FIPS
+ if (unlikely(in_fips_err()))
+ return -EACCES;
+#endif
+
return crypto_comp_crt(tfm)->cot_decompress(crypto_comp_tfm(tfm),
src, slen, dst, dlen);
}
#endif /* _LINUX_CRYPTO_H */
-
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
new file mode 100644
index 0000000..77de4c4
--- /dev/null
+++ b/include/linux/devfreq.h
@@ -0,0 +1,292 @@
+/*
+ * devfreq: Generic Dynamic Voltage and Frequency Scaling (DVFS) Framework
+ * for Non-CPU Devices.
+ *
+ * Copyright (C) 2011 Samsung Electronics
+ * MyungJoo Ham <myungjoo.ham@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LINUX_DEVFREQ_H__
+#define __LINUX_DEVFREQ_H__
+
+#include <linux/device.h>
+#include <linux/notifier.h>
+#include <linux/opp.h>
+
+#define DEVFREQ_NAME_LEN 16
+
+struct devfreq;
+
+/**
+ * struct devfreq_dev_status - Data given from devfreq user device to
+ * governors. Represents the performance
+ * statistics.
+ * @total_time The total time represented by this instance of
+ * devfreq_dev_status
+ * @busy_time The time that the device was working among the
+ * total_time.
+ * @current_frequency The operating frequency.
+ * @private_data An entry not specified by the devfreq framework.
+ * A device and a specific governor may have their
+ * own protocol with private_data. However, because
+ * this is governor-specific, a governor using this
+ * will be only compatible with devices aware of it.
+ */
+struct devfreq_dev_status {
+ /* both since the last measure */
+ unsigned long total_time;
+ unsigned long busy_time;
+ unsigned long current_frequency;
+ void *private_date;
+};
+
+/**
+ * struct devfreq_pm_qos_table - An PM QoS requiement entry for devfreq dev.
+ * @freq Lowest frequency to meet the QoS requirement
+ * represented by qos_value. If freq=0, it means that
+ * this element is the last in the array.
+ * @qos_value The qos value defined in pm_qos_params.h
+ *
+ * Note that the array of devfreq_pm_qos_table should be sorted by freq
+ * in the ascending order except for the last element, which should be 0.
+ */
+struct devfreq_pm_qos_table {
+ unsigned long freq; /* 0 if this is the last element */
+ s32 qos_value;
+};
+
+/*
+ * target callback, which is to provide additional information to the
+ * devfreq driver.
+ */
+
+/* The resulting frequency should be at least this. (least upper bound) */
+#define DEVFREQ_OPTION_FREQ_LUB 0x0
+/* The resulting frequency should be at most this. (greatest lower bound) */
+#define DEVFREQ_OPTION_FREQ_GLB 0x1
+
+/**
+ * struct devfreq_dev_profile - Devfreq's user device profile
+ * @initial_freq The operating frequency when devfreq_add_device() is
+ * called.
+ * @polling_ms The polling interval in ms. 0 disables polling.
+ * @qos_type QoS Type (defined in pm_qos_params.h)
+ * 0 (PM_QOS_RESERVED) if not used.
+ * @qos_use_max true: throughput (larger is faster)
+ * false: latency (smaller is faster)
+ * @qos_list Array of QoS requirements ending with .freq = 0
+ * NULL if not used. It should be either NULL or
+ * have a length > 1 with a first element effective.
+ * @target The device should set its operating frequency at
+ * freq or lowest-upper-than-freq value. If freq is
+ * higher than any operable frequency, set maximum.
+ * Before returning, target function should set
+ * freq at the current frequency.
+ * The "option" parameter's possible values are
+ * explained above with "DEVFREQ_OPTION_*" macros.
+ * @get_dev_status The device should provide the current performance
+ * status to devfreq, which is used by governors.
+ * @exit An optional callback that is called when devfreq
+ * is removing the devfreq object due to error or
+ * from devfreq_remove_device() call. If the user
+ * has registered devfreq->nb at a notifier-head,
+ * this is the time to unregister it.
+ *
+ * Note that the array of qos_list should be sorted by freq
+ * in the ascending order.
+ */
+struct devfreq_dev_profile {
+ unsigned long initial_freq;
+ unsigned int polling_ms;
+
+ int qos_type;
+ bool qos_use_max;
+ struct devfreq_pm_qos_table *qos_list;
+
+ int (*target)(struct device *dev, unsigned long *freq, u32 options);
+ int (*get_dev_status)(struct device *dev,
+ struct devfreq_dev_status *stat);
+ void (*exit)(struct device *dev);
+};
+
+/**
+ * struct devfreq_governor - Devfreq policy governor
+ * @name Governor's name
+ * @get_target_freq Returns desired operating frequency for the device.
+ * Basically, get_target_freq will run
+ * devfreq_dev_profile.get_dev_status() to get the
+ * status of the device (load = busy_time / total_time).
+ * If no_central_polling is set, this callback is called
+ * only with update_devfreq() notified by OPP.
+ * @init Called when the devfreq is being attached to a device
+ * @exit Called when the devfreq is being removed from a
+ * device. Governor should stop any internal routines
+ * before return because related data may be
+ * freed after exit().
+ * @no_central_polling Do not use devfreq's central polling mechanism.
+ * When this is set, devfreq will not call
+ * get_target_freq with devfreq_monitor(). However,
+ * devfreq will call get_target_freq with
+ * devfreq_update() notified by OPP framework.
+ *
+ * Note that the callbacks are called with devfreq->lock locked by devfreq.
+ */
+struct devfreq_governor {
+ const char name[DEVFREQ_NAME_LEN];
+ int (*get_target_freq)(struct devfreq *this, unsigned long *freq);
+ int (*init)(struct devfreq *this);
+ void (*exit)(struct devfreq *this);
+ const bool no_central_polling;
+};
+
+/**
+ * struct devfreq - Device devfreq structure
+ * @node list node - contains the devices with devfreq that have been
+ * registered.
+ * @lock a mutex to protect accessing devfreq.
+ * @dev device registered by devfreq class. dev.parent is the device
+ * using devfreq.
+ * @profile device-specific devfreq profile
+ * @governor method how to choose frequency based on the usage.
+ * @nb notifier block used to notify devfreq object that it should
+ * reevaluate operable frequencies. Devfreq users may use
+ * devfreq.nb to the corresponding register notifier call chain.
+ * @polling_jiffies interval in jiffies.
+ * @previous_freq previously configured frequency value.
+ * @next_polling the number of remaining jiffies to poll with
+ * "devfreq_monitor" executions to reevaluate
+ * frequency/voltage of the device. Set by
+ * profile's polling_ms interval.
+ * @data Private data of the governor. The devfreq framework does not
+ * touch this.
+ * @being_removed a flag to mark that this object is being removed in
+ * order to prevent trying to remove the object multiple times.
+ * @min_freq Limit minimum frequency requested by user (0: none)
+ * @max_freq Limit maximum frequency requested by user (0: none)
+ * @qos_nb notifier block used to notify pm qos requests
+ * @qos_min_freq Limit minimum frequency requested by QoS
+ *
+ * This structure stores the devfreq information for a give device.
+ *
+ * Note that when a governor accesses entries in struct devfreq in its
+ * functions except for the context of callbacks defined in struct
+ * devfreq_governor, the governor should protect its access with the
+ * struct mutex lock in struct devfreq. A governor may use this mutex
+ * to protect its own private data in void *data as well.
+ */
+struct devfreq {
+ struct list_head node;
+
+ struct mutex lock;
+ struct device dev;
+ struct devfreq_dev_profile *profile;
+ const struct devfreq_governor *governor;
+ struct notifier_block nb;
+
+ unsigned long polling_jiffies;
+ unsigned long previous_freq;
+ unsigned int next_polling;
+
+ void *data; /* private data for governors */
+
+ bool being_removed;
+
+ unsigned long min_freq;
+ unsigned long max_freq;
+ struct notifier_block qos_nb;
+ unsigned long qos_min_freq;
+};
+
+#if defined(CONFIG_PM_DEVFREQ)
+extern struct devfreq *devfreq_add_device(struct device *dev,
+ struct devfreq_dev_profile *profile,
+ const struct devfreq_governor *governor,
+ void *data);
+extern int devfreq_remove_device(struct devfreq *devfreq);
+
+/* Helper functions for devfreq user device driver with OPP. */
+extern struct opp *devfreq_recommended_opp(struct device *dev,
+ unsigned long *freq, bool floor);
+extern int devfreq_register_opp_notifier(struct device *dev,
+ struct devfreq *devfreq);
+extern int devfreq_unregister_opp_notifier(struct device *dev,
+ struct devfreq *devfreq);
+
+#ifdef CONFIG_DEVFREQ_GOV_POWERSAVE
+extern const struct devfreq_governor devfreq_powersave;
+#endif
+#ifdef CONFIG_DEVFREQ_GOV_PERFORMANCE
+extern const struct devfreq_governor devfreq_performance;
+#endif
+#ifdef CONFIG_DEVFREQ_GOV_USERSPACE
+extern const struct devfreq_governor devfreq_userspace;
+#endif
+#ifdef CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND
+extern const struct devfreq_governor devfreq_simple_ondemand;
+/**
+ * struct devfreq_simple_ondemand_data - void *data fed to struct devfreq
+ * and devfreq_add_device
+ * @ upthreshold If the load is over this value, the frequency jumps.
+ * Specify 0 to use the default. Valid value = 0 to 100.
+ * @ downdifferential If the load is under upthreshold - downdifferential,
+ * the governor may consider slowing the frequency down.
+ * Specify 0 to use the default. Valid value = 0 to 100.
+ * downdifferential < upthreshold must hold.
+ *
+ * If the fed devfreq_simple_ondemand_data pointer is NULL to the governor,
+ * the governor uses the default values.
+ */
+struct devfreq_simple_ondemand_data {
+ unsigned int upthreshold;
+ unsigned int downdifferential;
+};
+
+int devfreq_simple_ondemand_flexrate_do(struct devfreq *devfreq,
+ unsigned long interval,
+ unsigned long number);
+#endif
+
+#else /* !CONFIG_PM_DEVFREQ */
+static struct devfreq *devfreq_add_device(struct device *dev,
+ struct devfreq_dev_profile *profile,
+ struct devfreq_governor *governor,
+ void *data)
+{
+ return NULL;
+}
+
+static int devfreq_remove_device(struct devfreq *devfreq)
+{
+ return 0;
+}
+
+static struct opp *devfreq_recommended_opp(struct device *dev,
+ unsigned long *freq, bool floor)
+{
+ return -EINVAL;
+}
+
+static int devfreq_register_opp_notifier(struct device *dev,
+ struct devfreq *devfreq)
+{
+ return -EINVAL;
+}
+
+static int devfreq_unregister_opp_notifier(struct device *dev,
+ struct devfreq *devfreq)
+{
+ return -EINVAL;
+}
+
+#define devfreq_powersave NULL
+#define devfreq_performance NULL
+#define devfreq_userspace NULL
+#define devfreq_simple_ondemand NULL
+
+#endif /* CONFIG_PM_DEVFREQ */
+
+#endif /* __LINUX_DEVFREQ_H__ */
diff --git a/include/linux/devfreq/exynos4_bus.h b/include/linux/devfreq/exynos4_bus.h
new file mode 100644
index 0000000..24d3f73
--- /dev/null
+++ b/include/linux/devfreq/exynos4_bus.h
@@ -0,0 +1,28 @@
+/* include/linux/devfreq/exynos4_bus.h
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ * MyungJoo Ham <myungjoo.ham@samsung.com>
+ *
+ * EXYNOS4 - Memory/Bus clock frequency scaling support in DEVFREQ framework
+ * This version supports EXYNOS4210 only. This changes bus frequencies
+ * and vddint voltages. Exynos4412/4212 should be able to be supported
+ * with minor modifications.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+#ifndef __EXYNOS4_BUS_H
+#define __EXYNOS4_BUS_H __FILE__
+
+#ifdef CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND
+#include <linux/devfreq.h>
+struct exynos4_bus_platdata {
+ struct devfreq_simple_ondemand_data threshold;
+ unsigned int polling_ms; /* 0 to use default(50) */
+};
+#endif
+
+#endif /* __EXYNOS4_BUS_H */
diff --git a/include/linux/devfreq/exynos4_display.h b/include/linux/devfreq/exynos4_display.h
new file mode 100644
index 0000000..8a4b957
--- /dev/null
+++ b/include/linux/devfreq/exynos4_display.h
@@ -0,0 +1,28 @@
+/* include/linux/devfreq/exynos4_display.h
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * Chanwoo Choi <cw00.choi@samsung.com>
+ * Myungjoo Ham <myungjoo.ham@samsung.com>
+ * Kyungmin Park <kyungmin.park@samsung.com>
+ *
+ * EXYNOS4 - Dynamic LCD refresh rate support
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_ARCH_EXYNOS4_DISPLAY_H
+#define __ASM_ARCH_EXYNOS4_DISPLAY_H __FILE__
+
+#define EXYNOS4_DISPLAY_LV_HF 60
+#define EXYNOS4_DISPLAY_LV_LF 40
+#define EXYNOS4_DISPLAY_LV_DEFAULT EXYNOS4_DISPLAY_LV_HF
+
+/* Register/unregister display client to exynos4_display */
+extern int exynos4_display_register_client(struct notifier_block *nb);
+extern int exynos4_display_unregister_client(struct notifier_block *nb);
+
+#endif /* __ASM_ARCH_EXYNOS4_DISPLAY_H */
diff --git a/include/linux/device.h b/include/linux/device.h
index e4f62d8..69b6a9d 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -33,6 +33,7 @@ struct class;
struct subsys_private;
struct bus_type;
struct device_node;
+struct iommu_ops;
struct bus_attribute {
struct attribute attr;
@@ -96,6 +97,8 @@ struct bus_type {
const struct dev_pm_ops *pm;
+ struct iommu_ops *iommu_ops;
+
struct subsys_private *p;
};
diff --git a/include/linux/dma-buf.h b/include/linux/dma-buf.h
new file mode 100644
index 0000000..cc25316
--- /dev/null
+++ b/include/linux/dma-buf.h
@@ -0,0 +1,253 @@
+/*
+ * Header file for dma buffer sharing framework.
+ *
+ * Copyright(C) 2011 Linaro Limited. All rights reserved.
+ * Author: Sumit Semwal <sumit.semwal@ti.com>
+ *
+ * Many thanks to linaro-mm-sig list, and specially
+ * Arnd Bergmann <arnd@arndb.de>, Rob Clark <rob@ti.com> and
+ * Daniel Vetter <daniel@ffwll.ch> for their support in creation and
+ * refining of this idea.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef __DMA_BUF_H__
+#define __DMA_BUF_H__
+
+#include <linux/file.h>
+#include <linux/err.h>
+#include <linux/scatterlist.h>
+#include <linux/list.h>
+#include <linux/dma-mapping.h>
+#include <linux/fs.h>
+
+struct device;
+struct dma_buf;
+struct dma_buf_attachment;
+
+/**
+ * struct dma_buf_ops - operations possible on struct dma_buf
+ * @attach: [optional] allows different devices to 'attach' themselves to the
+ * given buffer. It might return -EBUSY to signal that backing storage
+ * is already allocated and incompatible with the requirements
+ * of requesting device.
+ * @detach: [optional] detach a given device from this buffer.
+ * @map_dma_buf: returns list of scatter pages allocated, increases usecount
+ * of the buffer. Requires atleast one attach to be called
+ * before. Returned sg list should already be mapped into
+ * _device_ address space. This call may sleep. May also return
+ * -EINTR. Should return -EINVAL if attach hasn't been called yet.
+ * @unmap_dma_buf: decreases usecount of buffer, might deallocate scatter
+ * pages.
+ * @release: release this buffer; to be called after the last dma_buf_put.
+ * @begin_cpu_access: [optional] called before cpu access to invalidate cpu
+ * caches and allocate backing storage (if not yet done)
+ * respectively pin the objet into memory.
+ * @end_cpu_access: [optional] called after cpu access to flush cashes.
+ * @kmap_atomic: maps a page from the buffer into kernel address
+ * space, users may not block until the subsequent unmap call.
+ * This callback must not sleep.
+ * @kunmap_atomic: [optional] unmaps a atomically mapped page from the buffer.
+ * This Callback must not sleep.
+ * @kmap: maps a page from the buffer into kernel address space.
+ * @kunmap: [optional] unmaps a page from the buffer.
+ */
+struct dma_buf_ops {
+ int (*attach)(struct dma_buf *, struct device *,
+ struct dma_buf_attachment *);
+
+ void (*detach)(struct dma_buf *, struct dma_buf_attachment *);
+
+ /* For {map,unmap}_dma_buf below, any specific buffer attributes
+ * required should get added to device_dma_parameters accessible
+ * via dev->dma_params.
+ */
+ struct sg_table * (*map_dma_buf)(struct dma_buf_attachment *,
+ enum dma_data_direction);
+ void (*unmap_dma_buf)(struct dma_buf_attachment *,
+ struct sg_table *,
+ enum dma_data_direction);
+ /* TODO: Add try_map_dma_buf version, to return immed with -EBUSY
+ * if the call would block.
+ */
+
+ /* after final dma_buf_put() */
+ void (*release)(struct dma_buf *);
+
+ int (*begin_cpu_access)(struct dma_buf *, size_t, size_t,
+ enum dma_data_direction);
+ void (*end_cpu_access)(struct dma_buf *, size_t, size_t,
+ enum dma_data_direction);
+ void *(*kmap_atomic)(struct dma_buf *, unsigned long);
+ void (*kunmap_atomic)(struct dma_buf *, unsigned long, void *);
+ void *(*kmap)(struct dma_buf *, unsigned long);
+ void (*kunmap)(struct dma_buf *, unsigned long, void *);
+};
+
+/**
+ * struct dma_buf - shared buffer object
+ * @size: size of the buffer
+ * @file: file pointer used for sharing buffers across, and for refcounting.
+ * @attachments: list of dma_buf_attachment that denotes all devices attached.
+ * @ops: dma_buf_ops associated with this buffer object.
+ * @priv: exporter specific private data for this buffer object.
+ */
+struct dma_buf {
+ size_t size;
+ struct file *file;
+ struct list_head attachments;
+ const struct dma_buf_ops *ops;
+ /* mutex to serialize list manipulation and attach/detach */
+ struct mutex lock;
+ void *priv;
+};
+
+/**
+ * struct dma_buf_attachment - holds device-buffer attachment data
+ * @dmabuf: buffer for this attachment.
+ * @dev: device attached to the buffer.
+ * @node: list of dma_buf_attachment.
+ * @priv: exporter specific attachment data.
+ *
+ * This structure holds the attachment information between the dma_buf buffer
+ * and its user device(s). The list contains one attachment struct per device
+ * attached to the buffer.
+ */
+struct dma_buf_attachment {
+ struct dma_buf *dmabuf;
+ struct device *dev;
+ struct list_head node;
+ void *priv;
+};
+
+/**
+ * get_dma_buf - convenience wrapper for get_file.
+ * @dmabuf: [in] pointer to dma_buf
+ *
+ * Increments the reference count on the dma-buf, needed in case of drivers
+ * that either need to create additional references to the dmabuf on the
+ * kernel side. For example, an exporter that needs to keep a dmabuf ptr
+ * so that subsequent exports don't create a new dmabuf.
+ */
+static inline void get_dma_buf(struct dma_buf *dmabuf)
+{
+ get_file(dmabuf->file);
+}
+
+#ifdef CONFIG_DMA_SHARED_BUFFER
+struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
+ struct device *dev);
+void dma_buf_detach(struct dma_buf *dmabuf,
+ struct dma_buf_attachment *dmabuf_attach);
+struct dma_buf *dma_buf_export(void *priv, const struct dma_buf_ops *ops,
+ size_t size, int flags);
+int dma_buf_fd(struct dma_buf *dmabuf, int flags);
+struct dma_buf *dma_buf_get(int fd);
+void dma_buf_put(struct dma_buf *dmabuf);
+
+struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *,
+ enum dma_data_direction);
+void dma_buf_unmap_attachment(struct dma_buf_attachment *, struct sg_table *,
+ enum dma_data_direction);
+int dma_buf_begin_cpu_access(struct dma_buf *dma_buf, size_t start, size_t len,
+ enum dma_data_direction dir);
+void dma_buf_end_cpu_access(struct dma_buf *dma_buf, size_t start, size_t len,
+ enum dma_data_direction dir);
+void *dma_buf_kmap_atomic(struct dma_buf *, unsigned long);
+void dma_buf_kunmap_atomic(struct dma_buf *, unsigned long, void *);
+void *dma_buf_kmap(struct dma_buf *, unsigned long);
+void dma_buf_kunmap(struct dma_buf *, unsigned long, void *);
+#else
+
+static inline struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
+ struct device *dev)
+{
+ return ERR_PTR(-ENODEV);
+}
+
+static inline void dma_buf_detach(struct dma_buf *dmabuf,
+ struct dma_buf_attachment *dmabuf_attach)
+{
+ return;
+}
+
+static inline struct dma_buf *dma_buf_export(void *priv,
+ const struct dma_buf_ops *ops,
+ size_t size, int flags)
+{
+ return ERR_PTR(-ENODEV);
+}
+
+static inline int dma_buf_fd(struct dma_buf *dmabuf, int flags)
+{
+ return -ENODEV;
+}
+
+static inline struct dma_buf *dma_buf_get(int fd)
+{
+ return ERR_PTR(-ENODEV);
+}
+
+static inline void dma_buf_put(struct dma_buf *dmabuf)
+{
+ return;
+}
+
+static inline struct sg_table *dma_buf_map_attachment(
+ struct dma_buf_attachment *attach, enum dma_data_direction write)
+{
+ return ERR_PTR(-ENODEV);
+}
+
+static inline void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
+ struct sg_table *sg, enum dma_data_direction dir)
+{
+ return;
+}
+
+static inline int dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
+ size_t start, size_t len,
+ enum dma_data_direction dir)
+{
+ return -ENODEV;
+}
+
+static inline void dma_buf_end_cpu_access(struct dma_buf *dmabuf,
+ size_t start, size_t len,
+ enum dma_data_direction dir)
+{
+}
+
+static inline void *dma_buf_kmap_atomic(struct dma_buf *dmabuf,
+ unsigned long pnum)
+{
+ return NULL;
+}
+
+static inline void dma_buf_kunmap_atomic(struct dma_buf *dmabuf,
+ unsigned long pnum, void *vaddr)
+{
+}
+
+static inline void *dma_buf_kmap(struct dma_buf *dmabuf, unsigned long pnum)
+{
+ return NULL;
+}
+
+static inline void dma_buf_kunmap(struct dma_buf *dmabuf,
+ unsigned long pnum, void *vaddr)
+{
+}
+#endif /* CONFIG_DMA_SHARED_BUFFER */
+
+#endif /* __DMA_BUF_H__ */
diff --git a/include/linux/earlysuspend.h b/include/linux/earlysuspend.h
new file mode 100755
index 0000000..336a07b
--- /dev/null
+++ b/include/linux/earlysuspend.h
@@ -0,0 +1,55 @@
+/* include/linux/earlysuspend.h
+ *
+ * Copyright (C) 2007-2008 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_EARLYSUSPEND_H
+#define _LINUX_EARLYSUSPEND_H
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+#include <linux/list.h>
+#endif
+
+/* The early_suspend structure defines suspend and resume hooks to be called
+ * when the user visible sleep state of the system changes, and a level to
+ * control the order. They can be used to turn off the screen and input
+ * devices that are not used for wakeup.
+ * Suspend handlers are called in low to high level order, resume handlers are
+ * called in the opposite order. If, when calling register_early_suspend,
+ * the suspend handlers have already been called without a matching call to the
+ * resume handlers, the suspend handler will be called directly from
+ * register_early_suspend. This direct call can violate the normal level order.
+ */
+enum {
+ EARLY_SUSPEND_LEVEL_BLANK_SCREEN = 50,
+ EARLY_SUSPEND_LEVEL_STOP_DRAWING = 100,
+ EARLY_SUSPEND_LEVEL_DISABLE_FB = 150,
+};
+struct early_suspend {
+#ifdef CONFIG_HAS_EARLYSUSPEND
+ struct list_head link;
+ int level;
+ void (*suspend)(struct early_suspend *h);
+ void (*resume)(struct early_suspend *h);
+#endif
+};
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+void register_early_suspend(struct early_suspend *handler);
+void unregister_early_suspend(struct early_suspend *handler);
+#else
+#define register_early_suspend(handler) do { } while (0)
+#define unregister_early_suspend(handler) do { } while (0)
+#endif
+
+#endif
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
new file mode 100644
index 0000000..f912294
--- /dev/null
+++ b/include/linux/extcon.h
@@ -0,0 +1,328 @@
+/*
+ * External connector (extcon) class driver
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Author: Donggeun Kim <dg77.kim@samsung.com>
+ * Author: MyungJoo Ham <myungjoo.ham@samsung.com>
+ *
+ * based on switch class driver
+ * Copyright (C) 2008 Google, Inc.
+ * Author: Mike Lockwood <lockwood@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+*/
+
+#ifndef __LINUX_EXTCON_H__
+#define __LINUX_EXTCON_H__
+
+#include <linux/notifier.h>
+
+#define SUPPORTED_CABLE_MAX 32
+#define CABLE_NAME_MAX 30
+
+/* Check cable state whether cable is attached/detached now */
+#define IS_ATTACH(cur, prev, mask) \
+ (((cur & mask) != 0) && ((prev & mask) == 0))
+#define IS_DETACH(cur, prev, mask) \
+ (((cur & mask) == 0) && ((prev & mask) != 0))
+
+/*
+ * The standard cable name is to help support general notifier
+ * and notifee device drivers to share the common names.
+ * Please use standard cable names unless your notifier device has
+ * a very unique and abnormal cable or
+ * the cable type is supposed to be used with only one unique
+ * pair of notifier/notifee devices.
+ *
+ * Please add any other "standard" cables used with extcon dev.
+ *
+ * You may add a dot and number to specify version or specification
+ * of the specific cable if it is required. (e.g., "Fast-charger.18"
+ * and "Fast-charger.10" for 1.8A and 1.0A chargers)
+ * However, the notifee and notifier should be able to handle such
+ * string and if the notifee can negotiate the protocol or idenify,
+ * you don't need such convention. This convention is helpful when
+ * notifier can distinguish but notifiee cannot.
+ */
+enum extcon_cable_name {
+ EXTCON_USB = 0,
+ EXTCON_USB_HOST,
+ EXTCON_TA, /* Travel Adaptor */
+ EXTCON_FAST_CHARGER,
+ EXTCON_SLOW_CHARGER,
+ EXTCON_CHARGE_DOWNSTREAM, /* Charging an external device */
+ EXTCON_HDMI,
+ EXTCON_MHL,
+ EXTCON_DVI,
+ EXTCON_VGA,
+ EXTCON_DOCK,
+ EXTCON_LINE_IN,
+ EXTCON_LINE_OUT,
+ EXTCON_MIC_IN,
+ EXTCON_HEADPHONE_OUT,
+ EXTCON_SPDIF_IN,
+ EXTCON_SPDIF_OUT,
+ EXTCON_VIDEO_IN,
+ EXTCON_VIDEO_OUT,
+};
+extern const char *extcon_cable_name[];
+
+struct extcon_cable;
+
+/**
+ * struct extcon_dev - An extcon device represents one external connector.
+ * @name The name of this extcon device. Parent device name is used
+ * if NULL.
+ * @supported_cable Array of supported cable name ending with NULL.
+ * If supported_cable is NULL, cable name related APIs
+ * are disabled.
+ * @mutually_exclusive Array of mutually exclusive set of cables that cannot
+ * be attached simultaneously. The array should be
+ * ending with NULL or be NULL (no mutually exclusive
+ * cables). For example, if it is { 0x7, 0x30, 0}, then,
+ * {0, 1}, {0, 1, 2}, {0, 2}, {1, 2}, or {4, 5} cannot
+ * be attached simulataneously. {0x7, 0} is equivalent to
+ * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there
+ * can be no simultaneous connections.
+ * @print_name An optional callback to override the method to print the
+ * name of the extcon device.
+ * @print_state An optional callback to override the method to print the
+ * status of the extcon device.
+ * @dev Device of this extcon. Do not provide at register-time.
+ * @state Attach/detach state of this extcon. Do not provide at
+ * register-time
+ * @nh Notifier for the state change events from this extcon
+ * @entry To support list of extcon devices so that uses can search
+ * for extcon devices based on the extcon name.
+ * @lock
+ * @max_supported Internal value to store the number of cables.
+ * @extcon_dev_type Device_type struct to provide attribute_groups
+ * customized for each extcon device.
+ * @cables Sysfs subdirectories. Each represents one cable.
+ *
+ * In most cases, users only need to provide "User initializing data" of
+ * this struct when registering an extcon. In some exceptional cases,
+ * optional callbacks may be needed. However, the values in "internal data"
+ * are overwritten by register function.
+ */
+struct extcon_dev {
+ /* --- Optional user initializing data --- */
+ const char *name;
+ const char **supported_cable;
+ const u32 *mutually_exclusive;
+
+ /* --- Optional callbacks to override class functions --- */
+ ssize_t (*print_name)(struct extcon_dev *edev, char *buf);
+ ssize_t (*print_state)(struct extcon_dev *edev, char *buf);
+
+ /* --- Internal data. Please do not set. --- */
+ struct device *dev;
+ u32 state;
+ struct raw_notifier_head nh;
+ struct list_head entry;
+ spinlock_t lock; /* could be called by irq handler */
+ int max_supported;
+
+ /* /sys/class/extcon/.../cable.n/... */
+ struct device_type extcon_dev_type;
+ struct extcon_cable *cables;
+ /* /sys/class/extcon/.../mutually_exclusive/... */
+ struct attribute_group attr_g_muex;
+ struct attribute **attrs_muex;
+ struct device_attribute *d_attrs_muex;
+};
+
+/**
+ * struct extcon_cable - An internal data for each cable of extcon device.
+ * @edev The extcon device
+ * @cable_index Index of this cable in the edev
+ * @attr_g Attribute group for the cable
+ * @attr_name "name" sysfs entry
+ * @attr_state "state" sysfs entry
+ * @attrs Array pointing to attr_name and attr_state for attr_g
+ */
+struct extcon_cable {
+ struct extcon_dev *edev;
+ int cable_index;
+
+ struct attribute_group attr_g;
+ struct device_attribute attr_name;
+ struct device_attribute attr_state;
+
+ struct attribute *attrs[3]; /* to be fed to attr_g.attrs */
+};
+
+/**
+ * struct extcon_specific_cable_nb - An internal data for
+ * extcon_register_interest().
+ * @internal_nb a notifier block bridging extcon notifier and cable notifier.
+ * @user_nb user provided notifier block for events from a specific cable.
+ * @cable_index the target cable.
+ * @edev the target extcon device.
+ * @previous_value the saved previous event value.
+ */
+struct extcon_specific_cable_nb {
+ struct notifier_block internal_nb;
+ struct notifier_block *user_nb;
+ int cable_index;
+ struct extcon_dev *edev;
+ unsigned long previous_value;
+};
+
+#ifdef CONFIG_EXTCON
+
+/*
+ * Following APIs are for notifiers or configurations.
+ * Notifiers are the external port and connection devices.
+ */
+extern int extcon_dev_register(struct extcon_dev *edev, struct device *dev);
+extern void extcon_dev_unregister(struct extcon_dev *edev);
+extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name);
+
+/*
+ * get/set/update_state access the 32b encoded state value, which represents
+ * states of all possible cables of the multistate port. For example, if one
+ * calls extcon_set_state(edev, 0x7), it may mean that all the three cables
+ * are attached to the port.
+ */
+static inline u32 extcon_get_state(struct extcon_dev *edev)
+{
+ return edev->state;
+}
+
+extern int extcon_set_state(struct extcon_dev *edev, u32 state);
+extern int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state);
+
+/*
+ * get/set_cable_state access each bit of the 32b encoded state value.
+ * They are used to access the status of each cable based on the cable_name
+ * or cable_index, which is retrived by extcon_find_cable_index
+ */
+extern int extcon_find_cable_index(struct extcon_dev *sdev,
+ const char *cable_name);
+extern int extcon_get_cable_state_(struct extcon_dev *edev, int cable_index);
+extern int extcon_set_cable_state_(struct extcon_dev *edev, int cable_index,
+ bool cable_state);
+
+extern int extcon_get_cable_state(struct extcon_dev *edev,
+ const char *cable_name);
+extern int extcon_set_cable_state(struct extcon_dev *edev,
+ const char *cable_name, bool cable_state);
+
+/*
+ * Following APIs are for notifiees (those who want to be notified)
+ * to register a callback for events from a specific cable of the extcon.
+ * Notifiees are the connected device drivers wanting to get notified by
+ * a specific external port of a connection device.
+ */
+extern int extcon_register_interest(struct extcon_specific_cable_nb *obj,
+ const char *extcon_name,
+ const char *cable_name,
+ struct notifier_block *nb);
+extern int extcon_unregister_interest(struct extcon_specific_cable_nb *nb);
+
+/*
+ * Following APIs are to monitor every action of a notifier.
+ * Registerer gets notified for every external port of a connection device.
+ * Probably this could be used to debug an action of notifier; however,
+ * we do not recommend to use this at normal 'notifiee' device drivers who
+ * want to be notified by a specific external port of the notifier.
+ */
+extern int extcon_register_notifier(struct extcon_dev *edev,
+ struct notifier_block *nb);
+extern int extcon_unregister_notifier(struct extcon_dev *edev,
+ struct notifier_block *nb);
+#else /* CONFIG_EXTCON */
+static inline int extcon_dev_register(struct extcon_dev *edev,
+ struct device *dev)
+{
+ return 0;
+}
+
+static inline void extcon_dev_unregister(struct extcon_dev *edev) { }
+
+static inline u32 extcon_get_state(struct extcon_dev *edev)
+{
+ return 0;
+}
+
+static inline int extcon_set_state(struct extcon_dev *edev, u32 state)
+{
+ return 0;
+}
+
+static inline int extcon_update_state(struct extcon_dev *edev, u32 mask,
+ u32 state)
+{
+ return 0;
+}
+
+static inline int extcon_find_cable_index(struct extcon_dev *edev,
+ const char *cable_name)
+{
+ return 0;
+}
+
+static inline int extcon_get_cable_state_(struct extcon_dev *edev,
+ int cable_index)
+{
+ return 0;
+}
+
+static inline int extcon_set_cable_state_(struct extcon_dev *edev,
+ int cable_index, bool cable_state)
+{
+ return 0;
+}
+
+static inline int extcon_get_cable_state(struct extcon_dev *edev,
+ const char *cable_name)
+{
+ return 0;
+}
+
+static inline int extcon_set_cable_state(struct extcon_dev *edev,
+ const char *cable_name, int state)
+{
+ return 0;
+}
+
+static inline struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name)
+{
+ return NULL;
+}
+
+static inline int extcon_register_notifier(struct extcon_dev *edev,
+ struct notifier_block *nb)
+{
+ return 0;
+}
+
+static inline int extcon_unregister_notifier(struct extcon_dev *edev,
+ struct notifier_block *nb)
+{
+ return 0;
+}
+
+static inline int extcon_register_interest(struct extcon_specific_cable_nb *obj,
+ const char *extcon_name,
+ const char *cable_name,
+ struct notifier_block *nb)
+{
+ return 0;
+}
+
+static inline int extcon_unregister_interest(struct extcon_specific_cable_nb *obj)
+{
+ return 0;
+}
+#endif /* CONFIG_EXTCON */
+#endif /* __LINUX_EXTCON_H__ */
diff --git a/include/linux/extcon/adc_jack.h b/include/linux/extcon/adc_jack.h
new file mode 100644
index 0000000..1650b85
--- /dev/null
+++ b/include/linux/extcon/adc_jack.h
@@ -0,0 +1,107 @@
+/*
+ * include/linux/extcon/adc_jack.h
+ *
+ * Analog Jack extcon driver with ADC-based detection capability.
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * MyungJoo Ham <myungjoo.ham@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#ifndef _EXTCON_ADC_JACK_H_
+#define _EXTCON_ADC_JACK_H_ __FILE__
+#include <linux/extcon.h>
+
+/**
+ * struct adc_jack_data - internal data for adc_jack device driver
+ * @edev - extcon device.
+ * @cable_names - list of supported cables.
+ * @num_cables - size of cable_names.
+ * @adc_condition - list of adc value conditions.
+ * @num_condition - size of adc_condition.
+ * @irq - irq number of attach/detach event (0 if not exist).
+ * @handling_delay - interrupt handler will schedule extcon event
+ * handling at handling_delay jiffies.
+ * @handler - extcon event handler called by interrupt handler.
+ * @get_adc - a callback to get ADC value to identify state.
+ * @ready - true if it is safe to run handler.
+ */
+struct adc_jack_data {
+ struct extcon_dev edev;
+
+ const char **cable_names;
+ int num_cables;
+ struct adc_jack_cond *adc_condition;
+ int num_conditions;
+
+ int irq;
+ unsigned long handling_delay; /* in jiffies */
+ struct delayed_work handler;
+
+ int (*get_adc)(u32 *value);
+
+ bool ready;
+};
+
+/**
+ * struct adc_jack_cond - condition to use an extcon state
+ * @state - the corresponding extcon state (if 0, this struct denotes
+ * the last adc_jack_cond element among the array)
+ * @min_adc - min adc value for this condition
+ * @max_adc - max adc value for this condition
+ *
+ * For example, if { .state = 0x3, .min_adc = 100, .max_adc = 200}, it means
+ * that if ADC value is between (inclusive) 100 and 200, than the cable 0 and
+ * 1 are attached (1<<0 | 1<<1 == 0x3)
+ *
+ * Note that you don't need to describe condition for "no cable attached"
+ * because when no adc_jack_cond is met, state = 0 is automatically chosen.
+ */
+struct adc_jack_cond {
+ u32 state; /* extcon state value. 0 if invalid */
+
+ u32 min_adc;
+ u32 max_adc;
+};
+
+/**
+ * struct adc_jack_pdata - platform data for adc jack device.
+ * @name - name of the extcon device. If null, "adc-jack" is used.
+ * @cable_names - array of cable names ending with null. If the array itself
+ * if null, extcon standard cable names are chosen.
+ * @adc_contition - array of struct adc_jack_cond conditions ending
+ * with .state = 0 entry. This describes how to decode
+ * adc values into extcon state.
+ * @irq - IRQ number that is triggerred by cable attach/detach
+ * events. If irq = 0, use should manually update extcon state
+ * with extcon APIs.
+ * @irq_flags - irq flags used for the @irq
+ * @handling_delay_ms - in some devices, we need to read ADC value some
+ * milli-seconds after the interrupt occurs. You may
+ * describe such delays with @handling_delay_ms, which
+ * is rounded-off by jiffies.
+ * @get_adc - the callback to read ADC value to identify cable states.
+ */
+struct adc_jack_pdata {
+ const char *name;
+ /*
+ * NULL if standard extcon names are used.
+ * The last entry should be NULL
+ */
+ const char **cable_names;
+ /* The last entry's state should be 0 */
+ struct adc_jack_cond *adc_condition;
+
+ int irq; /* Jack insertion/removal interrupt */
+ unsigned long irq_flags;
+ unsigned long handling_delay_ms; /* in ms */
+
+ /* When we have ADC subsystem, this can be generalized. */
+ int (*get_adc)(u32 *value);
+};
+
+#endif /* _EXTCON_ADC_JACK_H */
diff --git a/include/linux/exynos_mem.h b/include/linux/exynos_mem.h
new file mode 100644
index 0000000..9c7bed9
--- /dev/null
+++ b/include/linux/exynos_mem.h
@@ -0,0 +1,25 @@
+/* linux/include/linux/exynos_mem.h
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __INCLUDE_EXYNOS_MEM_H
+#define __INCLUDE_EXYNOS_MEM_H __FILE__
+
+/* IOCTL commands */
+#define EXYNOS_MEM_SET_CACHEABLE _IOW('M', 200, bool)
+#define EXYNOS_MEM_PADDR_CACHE_FLUSH _IOW('M', 201, struct exynos_mem_flush_range)
+#define EXYNOS_MEM_SET_PHYADDR _IOW('M', 202, unsigned int)
+#define EXYNOS_MEM_PADDR_CACHE_CLEAN _IOW('M', 203, struct exynos_mem_flush_range)
+
+struct exynos_mem_flush_range {
+ phys_addr_t start;
+ size_t length;
+};
+
+#endif /* __INCLUDE_EXYNOS_MEM_H */
diff --git a/include/linux/exynos_thermal.h b/include/linux/exynos_thermal.h
new file mode 100644
index 0000000..de7195b
--- /dev/null
+++ b/include/linux/exynos_thermal.h
@@ -0,0 +1,59 @@
+/* linux/include/linux/exynos_thermal.h
+ *
+ * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef THERMAL_INTERFACE_H
+#define THERMAL_INTERFACE_H
+/* CPU Zone information */
+
+#define SENSOR_NAME_LEN 16
+
+#define PANIC_ZONE 4
+#define WARN_ZONE 3
+#define MONITOR_ZONE 2
+#define SAFE_ZONE 1
+#define NO_ACTION 0
+
+/**
+ * struct exynos4_tmu_platform_data
+ * @name: name of the temperature sensor
+ * @read_temperature: A function pointer to read temperature info
+ * @private_data: Temperature sensor private data
+ * @sensor_data: Sensor specific information like trigger temperature, level
+ */
+struct thermal_sensor_conf {
+ char name[SENSOR_NAME_LEN];
+ int (*read_temperature)(void *data);
+ void *private_data;
+ void *sensor_data;
+};
+
+/**
+ * exynos4_register_thermal: Register to the exynos thermal interface.
+ * @sensor_conf: Structure containing temperature sensor information
+ *
+ * returns zero on success, else negative errno.
+ */
+int exynos4_register_thermal(struct thermal_sensor_conf *sensor_conf);
+
+/**
+ * exynos4_unregister_thermal: Un-register from the exynos thermal interface.
+ *
+ * return not applicable.
+ */
+void exynos4_unregister_thermal(void);
+
+/**
+ * exynos4_report_trigger: Report any trigger level crossed in the
+ * temperature sensor. This may be useful to take any cooling action.
+ *
+ * return not applicable.
+ */
+extern void exynos4_report_trigger(void);
+#endif
diff --git a/include/linux/fb.h b/include/linux/fb.h
index 6a82748..8eff91e 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -549,6 +549,10 @@ struct fb_cursor_user {
#define FB_EVENT_FB_UNBIND 0x0E
/* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga switcheroo */
#define FB_EVENT_REMAP_ALL_CONSOLE 0x0F
+/* A hardware display blank early change occured */
+#define FB_EARLY_EVENT_BLANK 0x10
+/* A hardware display blank revert early change occured */
+#define FB_R_EARLY_EVENT_BLANK 0x11
struct fb_event {
struct fb_info *info;
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 59d3ef1..fd8c333 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -139,8 +139,10 @@ struct event_filter;
enum trace_reg {
TRACE_REG_REGISTER,
TRACE_REG_UNREGISTER,
+#ifdef CONFIG_PERF_EVENTS
TRACE_REG_PERF_REGISTER,
TRACE_REG_PERF_UNREGISTER,
+#endif
};
struct ftrace_event_call;
diff --git a/include/linux/genalloc.h b/include/linux/genalloc.h
index 5bbebda..af44e88 100644
--- a/include/linux/genalloc.h
+++ b/include/linux/genalloc.h
@@ -11,28 +11,11 @@
#ifndef __GENALLOC_H__
#define __GENALLOC_H__
-/*
- * General purpose special memory pool descriptor.
- */
-struct gen_pool {
- rwlock_t lock;
- struct list_head chunks; /* list of chunks in this pool */
- int min_alloc_order; /* minimum allocation order */
-};
-/*
- * General purpose special memory pool chunk descriptor.
- */
-struct gen_pool_chunk {
- spinlock_t lock;
- struct list_head next_chunk; /* next chunk in pool */
- phys_addr_t phys_addr; /* physical starting address of memory chunk */
- unsigned long start_addr; /* starting address of memory chunk */
- unsigned long end_addr; /* ending address of memory chunk */
- unsigned long bits[0]; /* bitmap for allocating memory chunk */
-};
-
-extern struct gen_pool *gen_pool_create(int, int);
+struct gen_pool;
+
+struct gen_pool *__must_check gen_pool_create(unsigned order, int nid);
+
extern phys_addr_t gen_pool_virt_to_phys(struct gen_pool *pool, unsigned long);
extern int gen_pool_add_virt(struct gen_pool *, unsigned long, phys_addr_t,
size_t, int);
@@ -53,7 +36,26 @@ static inline int gen_pool_add(struct gen_pool *pool, unsigned long addr,
{
return gen_pool_add_virt(pool, addr, -1, size, nid);
}
-extern void gen_pool_destroy(struct gen_pool *);
-extern unsigned long gen_pool_alloc(struct gen_pool *, size_t);
-extern void gen_pool_free(struct gen_pool *, unsigned long, size_t);
+
+void gen_pool_destroy(struct gen_pool *pool);
+
+unsigned long __must_check
+gen_pool_alloc_aligned(struct gen_pool *pool, size_t size,
+ unsigned alignment_order);
+
+/**
+ * gen_pool_alloc() - allocate special memory from the pool
+ * @pool: Pool to allocate from.
+ * @size: Number of bytes to allocate from the pool.
+ *
+ * Allocate the requested number of bytes from the specified pool.
+ * Uses a first-fit algorithm.
+ */
+static inline unsigned long __must_check
+gen_pool_alloc(struct gen_pool *pool, size_t size)
+{
+ return gen_pool_alloc_aligned(pool, size, 0);
+}
+
+void gen_pool_free(struct gen_pool *pool, unsigned long addr, size_t size);
#endif /* __GENALLOC_H__ */
diff --git a/include/linux/genhd.h b/include/linux/genhd.h
index 300d758..2d1b595 100644
--- a/include/linux/genhd.h
+++ b/include/linux/genhd.h
@@ -128,6 +128,9 @@ struct hd_struct {
#define GENHD_FL_EXT_DEVT 64 /* allow extended devt */
#define GENHD_FL_NATIVE_CAPACITY 128
#define GENHD_FL_BLOCK_EVENTS_ON_EXCL_WRITE 256
+#ifdef CONFIG_USB_HOST_NOTIFY
+#define GENHD_IF_USB 1
+#endif
enum {
DISK_EVENT_MEDIA_CHANGE = 1 << 0, /* media changed */
@@ -190,6 +193,10 @@ struct gendisk {
struct blk_integrity *integrity;
#endif
int node_id;
+#ifdef CONFIG_USB_HOST_NOTIFY
+ int media_present;
+ int interfaces;
+#endif
};
static inline struct gendisk *part_to_disk(struct hd_struct *part)
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index cb40892..15c2623 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -289,6 +289,8 @@ static inline void arch_free_page(struct page *page, int order) { }
static inline void arch_alloc_page(struct page *page, int order) { }
#endif
+extern struct rw_semaphore page_alloc_slow_rwsem;
+
struct page *
__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
struct zonelist *zonelist, nodemask_t *nodemask);
diff --git a/include/linux/gp2a.h b/include/linux/gp2a.h
new file mode 100755
index 0000000..10476eb
--- /dev/null
+++ b/include/linux/gp2a.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2010 Samsung Electronics. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+
+#ifndef __LINUX_GP2A_H
+#define __LINUX_GP2A_H
+
+#include <linux/types.h>
+
+#ifdef __KERNEL__
+#define GP2A_OPT "gp2a-opt"
+struct gp2a_platform_data {
+ int p_out; /* proximity-sensor-output gpio */
+ int (*power)(bool); /* power to the chip */
+ int (*light_adc_value)(void); /* get light level from adc */
+};
+#endif /* __KERNEL__ */
+
+#endif
diff --git a/include/linux/gpio_event.h b/include/linux/gpio_event.h
new file mode 100644
index 0000000..2613fc5
--- /dev/null
+++ b/include/linux/gpio_event.h
@@ -0,0 +1,170 @@
+/* include/linux/gpio_event.h
+ *
+ * Copyright (C) 2007 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_GPIO_EVENT_H
+#define _LINUX_GPIO_EVENT_H
+
+#include <linux/input.h>
+
+struct gpio_event_input_devs {
+ int count;
+ struct input_dev *dev[];
+};
+enum {
+ GPIO_EVENT_FUNC_UNINIT = 0x0,
+ GPIO_EVENT_FUNC_INIT = 0x1,
+ GPIO_EVENT_FUNC_SUSPEND = 0x2,
+ GPIO_EVENT_FUNC_RESUME = 0x3,
+};
+struct gpio_event_info {
+ int (*func)(struct gpio_event_input_devs *input_devs,
+ struct gpio_event_info *info,
+ void **data, int func);
+ int (*event)(struct gpio_event_input_devs *input_devs,
+ struct gpio_event_info *info,
+ void **data, unsigned int dev, unsigned int type,
+ unsigned int code, int value); /* out events */
+ bool no_suspend;
+};
+
+struct gpio_event_platform_data {
+ const char *name;
+ struct gpio_event_info **info;
+ size_t info_count;
+ int (*power)(const struct gpio_event_platform_data *pdata, bool on);
+ const char *names[]; /* If name is NULL, names contain a NULL */
+ /* terminated list of input devices to create */
+};
+
+#define GPIO_EVENT_DEV_NAME "gpio-event"
+
+/* Key matrix */
+
+enum gpio_event_matrix_flags {
+ /* unset: drive active output low, set: drive active output high */
+ GPIOKPF_ACTIVE_HIGH = 1U << 0,
+ GPIOKPF_DEBOUNCE = 1U << 1,
+ GPIOKPF_REMOVE_SOME_PHANTOM_KEYS = 1U << 2,
+ GPIOKPF_REMOVE_PHANTOM_KEYS = GPIOKPF_REMOVE_SOME_PHANTOM_KEYS |
+ GPIOKPF_DEBOUNCE,
+ GPIOKPF_DRIVE_INACTIVE = 1U << 3,
+ GPIOKPF_LEVEL_TRIGGERED_IRQ = 1U << 4,
+ GPIOKPF_PRINT_UNMAPPED_KEYS = 1U << 16,
+ GPIOKPF_PRINT_MAPPED_KEYS = 1U << 17,
+ GPIOKPF_PRINT_PHANTOM_KEYS = 1U << 18,
+};
+
+#define MATRIX_CODE_BITS (10)
+#define MATRIX_KEY_MASK ((1U << MATRIX_CODE_BITS) - 1)
+#define MATRIX_KEY(dev, code) \
+ (((dev) << MATRIX_CODE_BITS) | (code & MATRIX_KEY_MASK))
+
+extern int gpio_event_matrix_func(struct gpio_event_input_devs *input_devs,
+ struct gpio_event_info *info, void **data, int func);
+struct gpio_event_matrix_info {
+ /* initialize to gpio_event_matrix_func */
+ struct gpio_event_info info;
+ /* size must be ninputs * noutputs */
+ const unsigned short *keymap;
+ unsigned int *input_gpios;
+ unsigned int *output_gpios;
+ unsigned int ninputs;
+ unsigned int noutputs;
+ /* time to wait before reading inputs after driving each output */
+ ktime_t settle_time;
+ /* time to wait before scanning the keypad a second time */
+ ktime_t debounce_delay;
+ ktime_t poll_time;
+ unsigned flags;
+};
+
+/* Directly connected inputs and outputs */
+
+enum gpio_event_direct_flags {
+ GPIOEDF_ACTIVE_HIGH = 1U << 0,
+/* GPIOEDF_USE_DOWN_IRQ = 1U << 1, */
+/* GPIOEDF_USE_IRQ = (1U << 2) | GPIOIDF_USE_DOWN_IRQ, */
+ GPIOEDF_PRINT_KEYS = 1U << 8,
+ GPIOEDF_PRINT_KEY_DEBOUNCE = 1U << 9,
+ GPIOEDF_PRINT_KEY_UNSTABLE = 1U << 10,
+};
+
+struct gpio_event_direct_entry {
+ uint32_t gpio:16;
+ uint32_t code:10;
+ uint32_t dev:6;
+};
+
+/* inputs */
+extern int gpio_event_input_func(struct gpio_event_input_devs *input_devs,
+ struct gpio_event_info *info, void **data, int func);
+struct gpio_event_input_info {
+ /* initialize to gpio_event_input_func */
+ struct gpio_event_info info;
+ ktime_t debounce_time;
+ ktime_t poll_time;
+ uint16_t flags;
+ uint16_t type;
+ const struct gpio_event_direct_entry *keymap;
+ size_t keymap_size;
+};
+
+/* outputs */
+extern int gpio_event_output_func(struct gpio_event_input_devs *input_devs,
+ struct gpio_event_info *info, void **data, int func);
+extern int gpio_event_output_event(struct gpio_event_input_devs *input_devs,
+ struct gpio_event_info *info, void **data,
+ unsigned int dev, unsigned int type,
+ unsigned int code, int value);
+struct gpio_event_output_info {
+ /* initialize to gpio_event_output_func and gpio_event_output_event */
+ struct gpio_event_info info;
+ uint16_t flags;
+ uint16_t type;
+ const struct gpio_event_direct_entry *keymap;
+ size_t keymap_size;
+};
+
+
+/* axes */
+
+enum gpio_event_axis_flags {
+ GPIOEAF_PRINT_UNKNOWN_DIRECTION = 1U << 16,
+ GPIOEAF_PRINT_RAW = 1U << 17,
+ GPIOEAF_PRINT_EVENT = 1U << 18,
+};
+
+extern int gpio_event_axis_func(struct gpio_event_input_devs *input_devs,
+ struct gpio_event_info *info, void **data, int func);
+struct gpio_event_axis_info {
+ /* initialize to gpio_event_axis_func */
+ struct gpio_event_info info;
+ uint8_t count; /* number of gpios for this axis */
+ uint8_t dev; /* device index when using multiple input devices */
+ uint8_t type; /* EV_REL or EV_ABS */
+ uint16_t code;
+ uint16_t decoded_size;
+ uint16_t (*map)(struct gpio_event_axis_info *info, uint16_t in);
+ uint32_t *gpio;
+ uint32_t flags;
+};
+#define gpio_axis_2bit_gray_map gpio_axis_4bit_gray_map
+#define gpio_axis_3bit_gray_map gpio_axis_4bit_gray_map
+uint16_t gpio_axis_4bit_gray_map(
+ struct gpio_event_axis_info *info, uint16_t in);
+uint16_t gpio_axis_5bit_singletrack_map(
+ struct gpio_event_axis_info *info, uint16_t in);
+
+#endif
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index b5ca4b2..c3be488 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -11,6 +11,7 @@ struct gpio_keys_button {
int wakeup; /* configure the button as a wake-up source */
int debounce_interval; /* debounce ticks interval in msecs */
bool can_disable;
+ void (*isr_hook)(unsigned int code, int value); /*key callback funtion*/
int value; /* axis value for EV_ABS */
};
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 42f7e2f..4bfb4ca 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -597,6 +597,8 @@ struct hid_usage_id {
* @input_mapping: invoked on input registering before mapping an usage
* @input_mapped: invoked on input registering after mapping an usage
* @feature_mapping: invoked on feature registering
+ * @input_register: called just before input device is registered after reports
+ * are parsed.
* @suspend: invoked on suspend (NULL means nop)
* @resume: invoked on resume if device was not reset (NULL means nop)
* @reset_resume: invoked on resume if device was reset (NULL means nop)
@@ -643,6 +645,8 @@ struct hid_driver {
void (*feature_mapping)(struct hid_device *hdev,
struct hid_field *field,
struct hid_usage *usage);
+ int (*input_register)(struct hid_device *hdev, struct hid_input
+ *hidinput);
#ifdef CONFIG_PM
int (*suspend)(struct hid_device *hdev, pm_message_t message);
int (*resume)(struct hid_device *hdev);
diff --git a/include/linux/host_notify.h b/include/linux/host_notify.h
new file mode 100644
index 0000000..2b7ac18
--- /dev/null
+++ b/include/linux/host_notify.h
@@ -0,0 +1,64 @@
+/*
+ * Host notify class driver
+ *
+ * Copyright (C) 2011 Samsung, Inc.
+ * Author: Dongrak Shin <dongrak.shin@samsung.com>
+ *
+*/
+
+#ifndef __LINUX_HOST_NOTIFY_H__
+#define __LINUX_HOST_NOTIFY_H__
+
+enum host_uevent_state {
+ NOTIFY_HOST_NONE,
+ NOTIFY_HOST_ADD,
+ NOTIFY_HOST_REMOVE,
+ NOTIFY_HOST_OVERCURRENT,
+ NOTIFY_HOST_LOWBATT,
+ NOTIFY_HOST_UNKNOWN,
+};
+
+enum otg_mode {
+ NOTIFY_NONE_MODE,
+ NOTIFY_HOST_MODE,
+ NOTIFY_PERIPHERAL_MODE,
+ NOTIFY_TEST_MODE,
+};
+
+enum booster_power {
+ NOTIFY_POWER_OFF,
+ NOTIFY_POWER_ON,
+};
+
+enum set_command {
+ NOTIFY_SET_OFF,
+ NOTIFY_SET_ON,
+};
+
+struct host_notify_dev {
+ const char *name;
+ struct device *dev;
+ int index;
+ int state;
+ int mode;
+ int booster;
+ void (*set_mode)(int);
+ void (*set_booster)(int);
+};
+
+struct host_notifier_platform_data {
+ struct host_notify_dev ndev;
+ int gpio;
+ void (*booster)(int);
+ void (*powered_booster)(int);
+ int (*usbhostd_start)(void);
+ int (*usbhostd_stop)(void);
+ int thread_enable;
+ int irq_enable;
+};
+
+extern void host_state_notify(struct host_notify_dev *ndev, int state);
+extern int host_notify_dev_register(struct host_notify_dev *ndev);
+extern void host_notify_dev_unregister(struct host_notify_dev *ndev);
+
+#endif /* __LINUX_HOST_NOTIFY_H__ */
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index 6b6ee70..2244580 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -20,6 +20,40 @@ struct device *hwmon_device_register(struct device *dev);
void hwmon_device_unregister(struct device *dev);
+struct hwmon_property;
+
+/*
+ * Register property: add the sysfs entry for the hwmon framework
+ * so that the hwmon property can be accessed with
+ * hwmon_get_value()/hwmon_set_value().
+ * Unregister property: the reverse.
+ *
+ * Note that register/unregister property functions do not touch
+ * sysfs itself. The user should call sysfs_create/update/merge/...
+ * themselves.
+ */
+extern struct hwmon_property *hwmon_register_property(struct device *hwmon,
+ const struct device_attribute *attr);
+extern int hwmon_unregister_property(struct device *hwmon,
+ struct hwmon_property *);
+extern int hwmon_register_properties(struct device *hwmon,
+ const struct attribute_group *attrs);
+extern int hwmon_unregister_properties(struct device *hwmon,
+ const struct attribute_group *attrs);
+
+/* Note that hwmon_device_unregister does the same anyway */
+extern void hwmon_unregister_all_properties(struct device *hwmon);
+
+extern struct device *hwmon_find_device(struct device *dev);
+extern struct device *hwmon_find_device_name(char *devname);
+
+extern struct hwmon_property *hwmon_get_property(struct device *hwmon,
+ const char *name);
+extern int hwmon_get_value(struct device *hwmon, struct hwmon_property * prop,
+ int *value);
+extern int hwmon_set_value(struct device *hwmon, struct hwmon_property * prop,
+ int value);
+
/* Scale user input to sensible values */
static inline int SENSORS_LIMIT(long value, long low, long high)
{
diff --git a/include/linux/i2c/ak8975.h b/include/linux/i2c/ak8975.h
new file mode 100755
index 0000000..50b0754
--- /dev/null
+++ b/include/linux/i2c/ak8975.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2010 Samsung Electronics. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef AKM8975_H
+#define AKM8975_H
+
+#include <linux/ioctl.h>
+
+#define AKM8975_I2C_NAME "ak8975"
+
+#define SENSOR_DATA_SIZE 8 /* Rx buffer size, i.e from ST1 to ST2 */
+#define AKMIO 0xA1
+
+/* IOCTLs for AKM library */
+/* WRITE and READ sizes don't include data. On WRITE, the first value is data
+ * size plus one and the second value is the register address. On READ
+ * the first value is the data size and second value is the register
+ * address and the data is written back into the buffer starting at
+ * the second byte (the length is unchanged).
+ */
+#define ECS_IOCTL_WRITE _IOW(AKMIO, 0x01, char*)
+#define ECS_IOCTL_READ _IOWR(AKMIO, 0x02, char*)
+#define ECS_IOCTL_RESET _IO(AKMIO, 0x03)
+#define ECS_IOCTL_SET_MODE _IOW(AKMIO, 0x04, short)
+#define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x05, \
+ char[SENSOR_DATA_SIZE])
+#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x06, short[12])
+#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x07, int)
+#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x08, int)
+#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, int64_t)
+#define ECS_IOCTL_GET_PROJECT_NAME _IOR(AKMIO, 0x0D, char[64])
+#define ECS_IOCTL_GET_MATRIX _IOR(AKMIO, 0x0E, short[4][3][3])
+
+/* IOCTLs for APPs */
+#define ECS_IOCTL_APP_SET_MODE _IOW(AKMIO, 0x10, short)
+#define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short)
+#define ECS_IOCTL_APP_GET_MFLAG _IOR(AKMIO, 0x12, short)
+#define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short)
+#define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short)
+#define ECS_IOCTL_APP_SET_TFLAG _IOW(AKMIO, 0x15, short)
+#define ECS_IOCTL_APP_GET_TFLAG _IOR(AKMIO, 0x16, short)
+#define ECS_IOCTL_APP_RESET_PEDOMETER _IO(AKMIO, 0x17)
+#define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, int64_t)
+#define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY
+
+/* Set raw magnetic vector flag */
+#define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short)
+
+/* Get raw magnetic vector flag */
+#define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short)
+
+#ifdef __KERNEL__
+struct akm8975_platform_data {
+ int gpio_data_ready_int;
+};
+#endif
+
+#endif
diff --git a/include/linux/i2c/es305.h b/include/linux/i2c/es305.h
new file mode 100644
index 0000000..a2fcf02
--- /dev/null
+++ b/include/linux/i2c/es305.h
@@ -0,0 +1,46 @@
+/* include/linux/i2c/es305.h - audience ES305 voice processor driver
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __ES305_PDATA_H__
+#define __ES305_PDATA_H__
+
+#define MODULE_NAME "[Audience] :"
+#define DEBUG 0
+#define RETRY_CNT 5
+
+enum es305_cmd {
+ ES305_SW_RESET,
+ ES305_SYNC,
+ ES305_BOOT,
+ ES305_SLEEP,
+ ES305_BYPASS_DATA,
+};
+
+struct es305_platform_data {
+ void (*set_mclk) (bool, bool);
+ int gpio_wakeup;
+ int gpio_reset;
+};
+
+int es305_load_firmware(void);
+int es305_hw_reset(void);
+int es305_set_cmd(enum es305_cmd);
+#endif
diff --git a/include/linux/i2c/fm34_we395.h b/include/linux/i2c/fm34_we395.h
new file mode 100644
index 0000000..718209d
--- /dev/null
+++ b/include/linux/i2c/fm34_we395.h
@@ -0,0 +1,35 @@
+/* include/linux/i2c/fm34_we395.h - fm34_we395 voice processor driver
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+
+#ifndef __FEM34_WE395_PDATA_H__
+#define __FM34_WE395_PDATA_H__
+
+#if defined(CONFIG_MACH_C1_KOR_LGT) || defined(CONFIG_MACH_C1VZW)
+int fm34_set_mode(int mode);
+#endif
+
+struct fm34_platform_data {
+ void (*set_mclk) (bool, bool);
+ int gpio_pwdn;
+ int gpio_rst;
+ int gpio_bp;
+};
+#endif
diff --git a/include/linux/i2c/mms114.h b/include/linux/i2c/mms114.h
new file mode 100644
index 0000000..84cab18
--- /dev/null
+++ b/include/linux/i2c/mms114.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics Co.Ltd
+ * Author: Joonyoung Shim <jy0922.shim@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ */
+
+#ifndef __LINUX_MMS114_H
+#define __LINUX_MMS114_H
+
+struct mms114_platform_data {
+ unsigned int x_size;
+ unsigned int y_size;
+ unsigned int contact_threshold;
+ unsigned int moving_threshold;
+ bool x_invert;
+ bool y_invert;
+
+ void (*cfg_pin)(bool);
+};
+
+#endif /* __LINUX_MMS114_H */
diff --git a/include/linux/i2c/mxt1536e.h b/include/linux/i2c/mxt1536e.h
new file mode 100644
index 0000000..0a3505c
--- /dev/null
+++ b/include/linux/i2c/mxt1536e.h
@@ -0,0 +1,109 @@
+
+/*
+ * Copyright (C) 2010, Samsung Electronics Co. Ltd. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+
+#ifndef __MXT_H__
+#define __MXT_H__
+
+#define MXT_DEV_NAME "Atmel MXT1536E"
+
+enum { RESERVED_T0 = 0,
+ RESERVED_T1,
+ DEBUG_DELTAS_T2,
+ DEBUG_REFERENCES_T3,
+ DEBUG_SIGNALS_T4,
+ GEN_MESSAGEPROCESSOR_T5,
+ GEN_COMMANDPROCESSOR_T6,
+ GEN_POWERCONFIG_T7,
+ GEN_ACQUISITIONCONFIG_T8,
+ TOUCH_MULTITOUCHSCREEN_T9,
+ TOUCH_SINGLETOUCHSCREEN_T10,
+ TOUCH_XSLIDER_T11,
+ TOUCH_YSLIDER_T12,
+ TOUCH_XWHEEL_T13,
+ TOUCH_YWHEEL_T14,
+ TOUCH_KEYARRAY_T15,
+ PROCG_SIGNALFILTER_T16,
+ PROCI_LINEARIZATIONTABLE_T17,
+ SPT_COMCONFIG_T18,
+ SPT_GPIOPWM_T19,
+ PROCI_GRIPFACESUPPRESSION_T20,
+ RESERVED_T21,
+ PROCG_NOISESUPPRESSION_T22,
+ TOUCH_PROXIMITY_T23,
+ PROCI_ONETOUCHGESTUREPROCESSOR_T24,
+ SPT_SELFTEST_T25,
+ DEBUG_CTERANGE_T26,
+ PROCI_TWOTOUCHGESTUREPROCESSOR_T27,
+ SPT_CTECONFIG_T28,
+ SPT_GPI_T29,
+ SPT_GATE_T30,
+ TOUCH_KEYSET_T31,
+ TOUCH_XSLIDERSET_T32,
+ RESERVED_T33,
+ GEN_MESSAGEBLOCK_T34,
+ SPT_GENERICDATA_T35,
+ RESERVED_T36,
+ DEBUG_DIAGNOSTIC_T37,
+ SPT_USERDATA_T38,
+ SPARE_T39,
+ PROCI_GRIPSUPPRESSION_T40,
+ SPARE_T41,
+ PROCI_TOUCHSUPPRESSION_T42,
+ SPT_DIGITIZER_T43,
+ SPARE_T44,
+ SPARE_T45,
+ SPT_CTECONFIG_T46,
+ PROCI_STYLUS_T47,
+ PROCG_NOISESUPPRESSION_T48,
+ SPARE_T49,
+ SPARE_T50,
+ SPARE_T51,
+ TOUCH_PROXIMITY_KEY_T52,
+ GEN_DATASOURCE_T53,
+ SPARE_T54,
+ ADAPTIVE_T55,
+ PROCI_SHIELDLESS_T56,
+ SPT_GENERICDATA_T57,
+ RESERVED_T255 = 255,
+};
+
+
+struct mxt_platform_data {
+ int max_finger_touches;
+ int gpio_read_done;
+ int min_x;
+ int max_x;
+ int min_y;
+ int max_y;
+ int min_z;
+ int max_z;
+ int min_w;
+ int max_w;
+ const u8 **config_e;
+ void (*power_on) (void);
+ void (*power_off) (void);
+ void (*read_ta_status) (bool *);
+};
+
+
+typedef enum
+ { MXT_PAGE_UP = 0x01, MXT_PAGE_DOWN = 0x02, MXT_DELTA_MODE =
+ 0x10, MXT_REFERENCE_MODE = 0x11, MXT_CTE_MODE = 0x31
+} diagnostic_debug_command;
+
+#endif
+
diff --git a/include/linux/i2c/mxt1664s.h b/include/linux/i2c/mxt1664s.h
new file mode 100644
index 0000000..e8795af
--- /dev/null
+++ b/include/linux/i2c/mxt1664s.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2012, Samsung Electronics Co. Ltd. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MXT_H__
+#define __MXT_H__
+
+#define MXT_DEV_NAME "Atmel MXT1664S"
+
+#define MXT_1664S_SW_RESET_TIME 300 /* msec */
+#define MXT_1664S_HW_RESET_TIME 300 /* msec */
+#define MXT_1664S_FW_RESET_TIME 500 /* msec */
+
+enum { RESERVED_T0 = 0,
+ RESERVED_T1,
+ DEBUG_DELTAS_T2,
+ DEBUG_REFERENCES_T3,
+ DEBUG_SIGNALS_T4,
+ GEN_MESSAGEPROCESSOR_T5,
+ GEN_COMMANDPROCESSOR_T6,
+ GEN_POWERCONFIG_T7,
+ GEN_ACQUISITIONCONFIG_T8,
+ TOUCH_MULTITOUCHSCREEN_T9,
+ TOUCH_SINGLETOUCHSCREEN_T10,
+ TOUCH_XSLIDER_T11,
+ TOUCH_YSLIDER_T12,
+ TOUCH_XWHEEL_T13,
+ TOUCH_YWHEEL_T14,
+ TOUCH_KEYARRAY_T15,
+ PROCG_SIGNALFILTER_T16,
+ PROCI_LINEARIZATIONTABLE_T17,
+ SPT_COMCONFIG_T18,
+ SPT_GPIOPWM_T19,
+ PROCI_GRIPFACESUPPRESSION_T20,
+ RESERVED_T21,
+ PROCG_NOISESUPPRESSION_T22,
+ TOUCH_PROXIMITY_T23,
+ PROCI_ONETOUCHGESTUREPROCESSOR_T24,
+ SPT_SELFTEST_T25,
+ DEBUG_CTERANGE_T26,
+ PROCI_TWOTOUCHGESTUREPROCESSOR_T27,
+ SPT_CTECONFIG_T28,
+ SPT_GPI_T29,
+ SPT_GATE_T30,
+ TOUCH_KEYSET_T31,
+ TOUCH_XSLIDERSET_T32,
+ RESERVED_T33,
+ GEN_MESSAGEBLOCK_T34,
+ SPT_GENERICDATA_T35,
+ RESERVED_T36,
+ DEBUG_DIAGNOSTIC_T37,
+ SPT_USERDATA_T38,
+ SPARE_T39,
+ PROCI_GRIPSUPPRESSION_T40,
+ SPARE_T41,
+ PROCI_TOUCHSUPPRESSION_T42,
+ SPT_DIGITIZER_T43,
+ SPARE_T44,
+ SPARE_T45,
+ SPT_CTECONFIG_T46,
+ PROCI_STYLUS_T47,
+ PROCG_NOISESUPPRESSION_T48,
+ SPARE_T49,
+ SPARE_T50,
+ SPARE_T51,
+ TOUCH_PROXIMITY_KEY_T52,
+ GEN_DATASOURCE_T53,
+ SPARE_T54,
+ ADAPTIVE_T55,
+ PROCI_SHIELDLESS_T56,
+ PROCI_EXTRATOUCHSCREENDATA_T57,
+ SPARE_T58,
+ SPARE_T59,
+ SPARE_T60,
+ SPT_TIMER_T61,
+ PROCG_NOISESUPPRESSION_T62,
+ RESERVED_T255 = 255,
+};
+
+struct mxt_platform_data {
+ int max_finger_touches;
+ int gpio_read_done;
+ const u8 **config;
+ int min_x;
+ int max_x;
+ int min_y;
+ int max_y;
+ int min_z;
+ int max_z;
+ int min_w;
+ int max_w;
+ int (*power_on) (void);
+ int (*power_off) (void);
+ u8 boot_address;
+};
+
+#endif /* */
diff --git a/include/linux/i2c/mxt224.h b/include/linux/i2c/mxt224.h
new file mode 100644
index 0000000..aad3bdd
--- /dev/null
+++ b/include/linux/i2c/mxt224.h
@@ -0,0 +1,257 @@
+/*
+ * AT42QT602240/ATMXT224 Touchscreen driver
+ *
+ * Copyright (C) 2012 Samsung Electronics Co.Ltd
+ * This touch driver is based on mxt224_u1.h
+ * Author: Taeheon Kim <th908.kim@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#ifndef __MXT224_H__
+#define __MXT224_H__
+
+#define MXT224_DEV_NAME "Atmel MXT224"
+
+#define MXT224_MAX_MT_FINGERS 10
+
+#define MAX_USING_FINGER_NUM 10
+
+#define MXT224_AUTOCAL_WAIT_TIME 2000
+
+#define DRIVER_FILTER
+enum {
+ RESERVED_T0 = 0,
+ RESERVED_T1,
+ DEBUG_DELTAS_T2,
+ DEBUG_REFERENCES_T3,
+ DEBUG_SIGNALS_T4,
+ GEN_MESSAGEPROCESSOR_T5,
+ GEN_COMMANDPROCESSOR_T6,
+ GEN_POWERCONFIG_T7,
+ GEN_ACQUISITIONCONFIG_T8,
+ TOUCH_MULTITOUCHSCREEN_T9,
+ TOUCH_SINGLETOUCHSCREEN_T10,
+ TOUCH_XSLIDER_T11,
+ TOUCH_YSLIDER_T12,
+ TOUCH_XWHEEL_T13,
+ TOUCH_YWHEEL_T14,
+ TOUCH_KEYARRAY_T15,
+ PROCG_SIGNALFILTER_T16,
+ PROCI_LINEARIZATIONTABLE_T17,
+ SPT_COMCONFIG_T18,
+ SPT_GPIOPWM_T19,
+ PROCI_GRIPFACESUPPRESSION_T20,
+ RESERVED_T21,
+ PROCG_NOISESUPPRESSION_T22,
+ TOUCH_PROXIMITY_T23,
+ PROCI_ONETOUCHGESTUREPROCESSOR_T24,
+ SPT_SELFTEST_T25,
+ DEBUG_CTERANGE_T26,
+ PROCI_TWOTOUCHGESTUREPROCESSOR_T27,
+ SPT_CTECONFIG_T28,
+ SPT_GPI_T29,
+ SPT_GATE_T30,
+ TOUCH_KEYSET_T31,
+ TOUCH_XSLIDERSET_T32,
+ RESERVED_T33,
+ GEN_MESSAGEBLOCK_T34,
+ SPT_GENERICDATA_T35,
+ RESERVED_T36,
+ DEBUG_DIAGNOSTIC_T37,
+ SPT_USERDATA_T38,
+ SPARE_T39,
+ PROCI_GRIPSUPPRESSION_T40,
+ SPARE_T41,
+ PROCI_TOUCHSUPPRESSION_T42,
+ SPARE_T43,
+ SPARE_T44,
+ SPARE_T45,
+ SPT_CTECONFIG_T46,
+ PROCI_STYLUS_T47,
+ PROCG_NOISESUPPRESSION_T48,
+ SPARE_T49,
+ SPARE_T50,
+ RESERVED_T255 = 255,
+};
+struct t22_freq_table_config_t {
+ u8 fherr_setting;
+ u8 fherr_cnt;
+ u8 fherr_num;
+ u8 t9_blen_for_fherr;
+ u8 t9_blen_for_fherr_cnt;
+ u8 t9_thr_for_fherr;
+ u8 t9_movfilter_for_fherr;
+ u8 t22_noisethr_for_fherr;
+ u8 t22_freqscale_for_fherr;
+ u8 freq_for_fherr1[5];
+ u8 freq_for_fherr2[5];
+ u8 freq_for_fherr3[5];
+ u8 freq_for_fherr4[5];
+};
+
+struct t48_median_config_t {
+ bool median_on_flag;
+ bool mferr_setting;
+ u8 mferr_count;
+ u8 t46_actvsyncsperx_for_mferr;
+ u8 t48_mfinvlddiffthr_for_mferr;
+ u8 t48_mferrorthr_for_mferr;
+ u8 t48_thr_for_mferr;
+ u8 t48_movfilter_for_mferr;
+};
+struct object_t {
+ u8 object_type;
+ u16 i2c_address;
+ u8 size;
+ u8 instances;
+ u8 num_report_ids;
+} __packed;
+
+struct finger_info {
+ s16 x;
+ s16 y;
+ s16 z;
+ u16 w;
+ int16_t component;
+};
+struct mxt224_callbacks {
+ void (*inform_charger)(struct mxt224_callbacks *, int mode);
+};
+
+struct mxt224_platform_data {
+ int max_finger_touches;
+ const u8 **config;
+ const u8 **config_e;
+ const u8 *t48_config_batt_e;
+ const u8 *t48_config_chrg_e;
+ int gpio_read_done;
+ int min_x;
+ int max_x;
+ int min_y;
+ int max_y;
+ int min_z;
+ int max_z;
+ int min_w;
+ int max_w;
+ u8 atchcalst;
+ u8 atchcalsthr;
+ u8 tchthr_batt;
+ u8 tchthr_charging;
+ u8 tchthr_batt_init;
+ u8 noisethr_batt;
+ u8 noisethr_charging;
+ u8 movfilter_batt;
+ u8 movfilter_charging;
+ u8 atchcalst_e;
+ u8 atchcalsthr_e;
+ u8 tchthr_batt_e;
+ u8 tchthr_charging_e;
+ u8 calcfg_batt_e;
+ u8 calcfg_charging_e;
+ u8 atchfrccalthr_e;
+ u8 atchfrccalratio_e;
+ u8 chrgtime_batt_e;
+ u8 chrgtime_charging_e;
+ u8 blen_batt_e;
+ u8 blen_charging_e;
+ u8 movfilter_batt_e;
+ u8 movfilter_charging_e;
+ u8 actvsyncsperx_e;
+ u8 nexttchdi_e;
+ void (*power_on) (void);
+ void (*power_off) (void);
+ void (*register_cb)(struct mxt224_callbacks *);
+ void (*read_ta_status) (void *);
+};
+
+struct mxt224_data {
+ struct i2c_client *client;
+ struct input_dev *input_dev;
+ struct mxt224_platform_data *pdata;
+#ifdef CONFIG_HAS_EARLYSUSPEND
+ struct early_suspend early_suspend;
+#endif
+ u8 family_id;
+ u32 finger_mask;
+ struct object_t *objects;
+ u8 objects_len;
+ u8 tsp_version;
+ const u8 *power_cfg;
+ const u8 *noise_suppression_cfg_ta;
+ const u8 *noise_suppression_cfg;
+ u8 finger_type;
+ u16 msg_proc;
+ u16 cmd_proc;
+ u16 msg_object_size;
+ u32 x_dropbits:2;
+ u32 y_dropbits:2;
+ int num_fingers;
+ struct finger_info fingers[MXT224_MAX_MT_FINGERS];
+ struct t22_freq_table_config_t freq_table;
+ struct t48_median_config_t noise_median;
+
+ int mxt224_enabled;
+ bool g_debug_switch;
+ u8 mxt_version_disp;
+ u8 tsp_version_disp;
+ int optiacl_gain;
+ int firm_status_data;
+ bool lock_status;
+ int touch_state; /* 1:release, 2:press, 3:others */
+ int palm_chk_flag;
+ bool ta_status_pre;
+ int errcondition;
+ int threshold;
+ int threshold_e;
+ bool boot_or_resume; /*1: boot_or_resume,0: others */
+ bool sleep_mode_flag;
+ char *tsp_config_version;
+ bool median_err_flag;
+ int touch_is_pressed_arr[MAX_USING_FINGER_NUM];
+ struct completion init_done;
+ struct mutex lock;
+ bool enabled;
+#ifdef DRIVER_FILTER
+ bool gbfilter;
+#endif
+ unsigned int qt_time_point_freq;
+ unsigned int qt_time_diff_freq;
+ unsigned int qt_time_point;
+ unsigned int qt_time_diff;
+ unsigned int qt_timer_state;
+ unsigned int good_check_flag;
+ unsigned int not_yet_count;
+ u8 cal_check_flag;
+ u8 doing_calibration_flag;
+ unsigned char test_node[5];
+ uint16_t qt_refrence_node[209];
+ uint16_t qt_delta_node[209];
+ int index_delta;
+ int index_reference;
+ struct mxt224_callbacks callbacks;
+};
+
+enum {
+ QT_PAGE_UP = 0x01,
+ QT_PAGE_DOWN = 0x02,
+ QT_DELTA_MODE = 0x10,
+ QT_REFERENCE_MODE = 0x11,
+ QT_CTE_MODE = 0x31
+};
+
+enum {
+ ERR_RTN_CONDITION_T9,
+ ERR_RTN_CONDITION_T48,
+ ERR_RTN_CONDITION_IDLE
+};
+
+#define ERR_RTN_CONDITION_MAX (ERR_RTN_CONDITION_IDLE + 1)
+
+
+extern struct class *sec_class;
+#endif /* __MXT224_H__ */
+
diff --git a/include/linux/i2c/mxt224_gc.h b/include/linux/i2c/mxt224_gc.h
new file mode 100644
index 0000000..4d78f7a
--- /dev/null
+++ b/include/linux/i2c/mxt224_gc.h
@@ -0,0 +1,190 @@
+/*
+ * AT42QT602240/ATMXT224 Touchscreen driver
+ *
+ * Copyright (C) 2012 Samsung Electronics Co.Ltd
+ * This touch driver is based on mxt224_u1.h
+ * Author: Taeheon Kim <th908.kim@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#ifndef __MXT224_H__
+#define __MXT224_H__
+
+#define MXT224_DEV_NAME "Atmel MXT224"
+
+#define MXT224_MAX_MT_FINGERS 10
+
+#define MAX_USING_FINGER_NUM 10
+
+#define MXT224_AUTOCAL_WAIT_TIME 2000
+
+#define DRIVER_FILTER
+enum {
+ RESERVED_T0 = 0,
+ RESERVED_T1,
+ DEBUG_DELTAS_T2,
+ DEBUG_REFERENCES_T3,
+ DEBUG_SIGNALS_T4,
+ GEN_MESSAGEPROCESSOR_T5,
+ GEN_COMMANDPROCESSOR_T6,
+ GEN_POWERCONFIG_T7,
+ GEN_ACQUISITIONCONFIG_T8,
+ TOUCH_MULTITOUCHSCREEN_T9,
+ TOUCH_SINGLETOUCHSCREEN_T10,
+ TOUCH_XSLIDER_T11,
+ TOUCH_YSLIDER_T12,
+ TOUCH_XWHEEL_T13,
+ TOUCH_YWHEEL_T14,
+ TOUCH_KEYARRAY_T15,
+ PROCG_SIGNALFILTER_T16,
+ PROCI_LINEARIZATIONTABLE_T17,
+ SPT_COMCONFIG_T18,
+ SPT_GPIOPWM_T19,
+ PROCI_GRIPFACESUPPRESSION_T20,
+ RESERVED_T21,
+ PROCG_NOISESUPPRESSION_T22,
+ TOUCH_PROXIMITY_T23,
+ PROCI_ONETOUCHGESTUREPROCESSOR_T24,
+ SPT_SELFTEST_T25,
+ DEBUG_CTERANGE_T26,
+ PROCI_TWOTOUCHGESTUREPROCESSOR_T27,
+ SPT_CTECONFIG_T28,
+ SPT_GPI_T29,
+ SPT_GATE_T30,
+ TOUCH_KEYSET_T31,
+ TOUCH_XSLIDERSET_T32,
+ RESERVED_T33,
+ GEN_MESSAGEBLOCK_T34,
+ SPT_GENERICDATA_T35,
+ RESERVED_T36,
+ DEBUG_DIAGNOSTIC_T37,
+ SPT_USERDATA_T38,
+ SPARE_T39,
+ PROCI_GRIPSUPPRESSION_T40,
+ SPARE_T41,
+ PROCI_TOUCHSUPPRESSION_T42,
+ SPARE_T43,
+ SPARE_T44,
+ SPARE_T45,
+ SPT_CTECONFIG_T46,
+ PROCI_STYLUS_T47,
+ PROCG_NOISESUPPRESSION_T48,
+ SPARE_T49,
+ SPARE_T50,
+ RESERVED_T255 = 255,
+};
+struct t22_freq_table_config_t {
+ u8 fherr_setting;
+ u8 fherr_cnt;
+ u8 fherr_num;
+ u8 t9_blen_for_fherr;
+ u8 t9_blen_for_fherr_cnt;
+ u8 t9_thr_for_fherr;
+ u8 t9_movfilter_for_fherr;
+ u8 t22_noisethr_for_fherr;
+ u8 t22_freqscale_for_fherr;
+ u8 freq_for_fherr1[5];
+ u8 freq_for_fherr2[5];
+ u8 freq_for_fherr3[5];
+ u8 freq_for_fherr4[5];
+};
+
+struct t48_median_config_t {
+ bool median_on_flag;
+ bool mferr_setting;
+ u8 mferr_count;
+ u8 t46_actvsyncsperx_for_mferr;
+ u8 t48_mfinvlddiffthr_for_mferr;
+ u8 t48_mferrorthr_for_mferr;
+ u8 t48_thr_for_mferr;
+ u8 t48_movfilter_for_mferr;
+};
+struct object_t {
+ u8 object_type;
+ u16 i2c_address;
+ u8 size;
+ u8 instances;
+ u8 num_report_ids;
+} __packed;
+
+struct finger_info {
+ s16 x;
+ s16 y;
+ s16 z;
+ u16 w;
+ int16_t component;
+};
+struct mxt224_callbacks {
+ void (*inform_charger)(struct mxt224_callbacks *, int mode);
+};
+
+struct mxt224_platform_data {
+ int max_finger_touches;
+ const u8 **config;
+ const u8 **config_e;
+ const u8 *t48_config_batt_e;
+ const u8 *t48_config_chrg_e;
+ int gpio_read_done;
+ int min_x;
+ int max_x;
+ int min_y;
+ int max_y;
+ int min_z;
+ int max_z;
+ int min_w;
+ int max_w;
+ u8 atchcalst;
+ u8 atchcalsthr;
+ u8 tchthr_batt;
+ u8 tchthr_charging;
+ u8 tchthr_batt_init;
+ u8 noisethr_batt;
+ u8 noisethr_charging;
+ u8 movfilter_batt;
+ u8 movfilter_charging;
+ u8 atchcalst_e;
+ u8 atchcalsthr_e;
+ u8 tchthr_batt_e;
+ u8 tchthr_charging_e;
+ u8 calcfg_batt_e;
+ u8 calcfg_charging_e;
+ u8 atchfrccalthr_e;
+ u8 atchfrccalratio_e;
+ u8 chrgtime_batt_e;
+ u8 chrgtime_charging_e;
+ u8 blen_batt_e;
+ u8 blen_charging_e;
+ u8 movfilter_batt_e;
+ u8 movfilter_charging_e;
+ u8 actvsyncsperx_e;
+ u8 nexttchdi_e;
+ void (*power_on) (void);
+ void (*power_off) (void);
+ void (*register_cb)(struct mxt224_callbacks *);
+ void (*read_ta_status) (void *);
+};
+
+enum {
+ QT_PAGE_UP = 0x01,
+ QT_PAGE_DOWN = 0x02,
+ QT_DELTA_MODE = 0x10,
+ QT_REFERENCE_MODE = 0x11,
+ QT_CTE_MODE = 0x31
+};
+
+enum {
+ ERR_RTN_CONDITION_T9,
+ ERR_RTN_CONDITION_T48,
+ ERR_RTN_CONDITION_IDLE
+};
+
+#define ERR_RTN_CONDITION_MAX (ERR_RTN_CONDITION_IDLE + 1)
+
+
+extern struct class *sec_class;
+#endif /* __MXT224_H__ */
+
diff --git a/include/linux/i2c/mxt224_u1.h b/include/linux/i2c/mxt224_u1.h
new file mode 100644
index 0000000..66878c2
--- /dev/null
+++ b/include/linux/i2c/mxt224_u1.h
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2010, Samsung Electronics Co. Ltd. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MXT224_H__
+#define __MXT224_H__
+
+#define MXT224_DEV_NAME "Atmel MXT224"
+
+#define MXT224_MAX_MT_FINGERS 10
+
+enum {
+ RESERVED_T0 = 0,
+ RESERVED_T1,
+ DEBUG_DELTAS_T2,
+ DEBUG_REFERENCES_T3,
+ DEBUG_SIGNALS_T4,
+ GEN_MESSAGEPROCESSOR_T5,
+ GEN_COMMANDPROCESSOR_T6,
+ GEN_POWERCONFIG_T7,
+ GEN_ACQUISITIONCONFIG_T8,
+ TOUCH_MULTITOUCHSCREEN_T9,
+ TOUCH_SINGLETOUCHSCREEN_T10,
+ TOUCH_XSLIDER_T11,
+ TOUCH_YSLIDER_T12,
+ TOUCH_XWHEEL_T13,
+ TOUCH_YWHEEL_T14,
+ TOUCH_KEYARRAY_T15,
+ PROCG_SIGNALFILTER_T16,
+ PROCI_LINEARIZATIONTABLE_T17,
+ SPT_COMCONFIG_T18,
+ SPT_GPIOPWM_T19,
+ PROCI_GRIPFACESUPPRESSION_T20,
+ RESERVED_T21,
+ PROCG_NOISESUPPRESSION_T22,
+ TOUCH_PROXIMITY_T23,
+ PROCI_ONETOUCHGESTUREPROCESSOR_T24,
+ SPT_SELFTEST_T25,
+ DEBUG_CTERANGE_T26,
+ PROCI_TWOTOUCHGESTUREPROCESSOR_T27,
+ SPT_CTECONFIG_T28,
+ SPT_GPI_T29,
+ SPT_GATE_T30,
+ TOUCH_KEYSET_T31,
+ TOUCH_XSLIDERSET_T32,
+ RESERVED_T33,
+ GEN_MESSAGEBLOCK_T34,
+ SPT_GENERICDATA_T35,
+ RESERVED_T36,
+ DEBUG_DIAGNOSTIC_T37,
+ SPT_USERDATA_T38,
+ SPARE_T39,
+ PROCI_GRIPSUPPRESSION_T40,
+ SPARE_T41,
+ PROCI_TOUCHSUPPRESSION_T42,
+ SPARE_T43,
+ SPARE_T44,
+ SPARE_T45,
+ SPT_CTECONFIG_T46,
+ PROCI_STYLUS_T47,
+ PROCG_NOISESUPPRESSION_T48,
+ SPARE_T49,
+ SPARE_T50,
+ RESERVED_T255 = 255,
+};
+
+struct mxt224_platform_data {
+ int max_finger_touches;
+ const u8 **config;
+ const u8 **config_e;
+ const u8 *t48_config_batt_e;
+ const u8 *t48_config_chrg_e;
+ int gpio_read_done;
+ int min_x;
+ int max_x;
+ int min_y;
+ int max_y;
+ int min_z;
+ int max_z;
+ int min_w;
+ int max_w;
+ u8 atchcalst;
+ u8 atchcalsthr;
+ u8 tchthr_batt;
+ u8 tchthr_charging;
+ u8 tchthr_batt_init;
+ u8 noisethr_batt;
+ u8 noisethr_charging;
+ u8 movfilter_batt;
+ u8 movfilter_charging;
+ u8 atchcalst_e;
+ u8 atchcalsthr_e;
+ u8 tchthr_batt_e;
+ u8 tchthr_charging_e;
+ u8 calcfg_batt_e;
+ u8 calcfg_charging_e;
+ u8 atchfrccalthr_e;
+ u8 atchfrccalratio_e;
+ u8 chrgtime_batt_e;
+ u8 chrgtime_charging_e;
+ u8 blen_batt_e;
+ u8 blen_charging_e;
+ u8 movfilter_batt_e;
+ u8 movfilter_charging_e;
+ u8 actvsyncsperx_e;
+ u8 nexttchdi_e;
+ void (*power_on) (void);
+ void (*power_off) (void);
+ void (*register_cb) (void *);
+ void (*read_ta_status) (void *);
+};
+
+enum {
+ QT_PAGE_UP = 0x01,
+ QT_PAGE_DOWN = 0x02,
+ QT_DELTA_MODE = 0x10,
+ QT_REFERENCE_MODE = 0x11,
+ QT_CTE_MODE = 0x31
+};
+
+enum {
+ ERR_RTN_CONDITION_T9,
+ ERR_RTN_CONDITION_T48,
+ ERR_RTN_CONDITION_IDLE
+};
+
+#define ERR_RTN_CONDITION_MAX (ERR_RTN_CONDITION_IDLE + 1)
+
+struct t22_freq_table_config_t {
+ u8 fherr_setting;
+ u8 fherr_cnt;
+ u8 fherr_num;
+ u8 t9_blen_for_fherr;
+ u8 t9_blen_for_fherr_cnt;
+ u8 t9_thr_for_fherr;
+ u8 t9_movfilter_for_fherr;
+ u8 t22_noisethr_for_fherr;
+ u8 t22_freqscale_for_fherr;
+ u8 freq_for_fherr1[5];
+ u8 freq_for_fherr2[5];
+ u8 freq_for_fherr3[5];
+ u8 freq_for_fherr4[5];
+};
+
+struct t48_median_config_t {
+ bool median_on_flag;
+ bool mferr_setting;
+ u8 mferr_count;
+ u8 t46_actvsyncsperx_for_mferr;
+ u8 t48_mfinvlddiffthr_for_mferr;
+ u8 t48_mferrorthr_for_mferr;
+ u8 t48_thr_for_mferr;
+ u8 t48_movfilter_for_mferr;
+};
+
+int get_tsp_status(void);
+extern struct class *sec_class;
+#endif
diff --git a/include/linux/i2c/mxt540e.h b/include/linux/i2c/mxt540e.h
new file mode 100644
index 0000000..6c34a39
--- /dev/null
+++ b/include/linux/i2c/mxt540e.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2010, Samsung Electronics Co. Ltd. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MXT540E_H__
+#define __MXT540E_H__
+
+#define MXT540E_DEV_NAME "Atmel MXT540E"
+
+#define MXT540E_SW_RESET_TIME 300 /* msec */
+#define MXT540E_HW_RESET_TIME 130 /* msec */
+
+enum {
+ RESERVED_T0 = 0,
+ RESERVED_T1,
+ DEBUG_DELTAS_T2,
+ DEBUG_REFERENCES_T3,
+ DEBUG_SIGNALS_T4,
+ GEN_MESSAGEPROCESSOR_T5,
+ GEN_COMMANDPROCESSOR_T6,
+ GEN_POWERCONFIG_T7,
+ GEN_ACQUISITIONCONFIG_T8,
+ TOUCH_MULTITOUCHSCREEN_T9,
+ TOUCH_SINGLETOUCHSCREEN_T10,
+ TOUCH_XSLIDER_T11,
+ TOUCH_YSLIDER_T12,
+ TOUCH_XWHEEL_T13,
+ TOUCH_YWHEEL_T14,
+ TOUCH_KEYARRAY_T15,
+ PROCG_SIGNALFILTER_T16,
+ PROCI_LINEARIZATIONTABLE_T17,
+ SPT_COMCONFIG_T18,
+ SPT_GPIOPWM_T19,
+ PROCI_GRIPFACESUPPRESSION_T20,
+ RESERVED_T21,
+ PROCG_NOISESUPPRESSION_T22,
+ TOUCH_PROXIMITY_T23,
+ PROCI_ONETOUCHGESTUREPROCESSOR_T24,
+ SPT_SELFTEST_T25,
+ DEBUG_CTERANGE_T26,
+ PROCI_TWOTOUCHGESTUREPROCESSOR_T27,
+ SPT_CTECONFIG_T28,
+ SPT_GPI_T29,
+ SPT_GATE_T30,
+ TOUCH_KEYSET_T31,
+ TOUCH_XSLIDERSET_T32,
+ RESERVED_T33,
+ GEN_MESSAGEBLOCK_T34,
+ SPARE_T35,
+ RESERVED_T36,
+ DEBUG_DIAGNOSTIC_T37,
+ SPT_USERDATA_T38,
+ SPARE_T39,
+ PROCI_GRIPSUPPRESSION_T40,
+ SPARE_T41,
+ PROCI_TOUCHSUPPRESSION_T42,
+ SPT_DIGITIZER_T43,
+ SPARE_T44,
+ SPARE_T45,
+ SPT_CTECONFIG_T46,
+ PROCI_STYLUS_T47,
+ PROCG_NOISESUPPRESSION_T48,
+ SPARE_T49,
+ SPARE_T50,
+ SPARE_T51,
+ TOUCH_PROXKEY_T52,
+ GEN_DATASOURCE_T53,
+ SPARE_T54,
+ ADAPTIVE_T55,
+ SPARE_T56,
+ SPT_GENERICDATA_T57,
+ SPARE_T58,
+ SPARE_T59,
+ SPARE_T60,
+ SPT_TIMER_T61,
+ RESERVED_T255 = 255,
+};
+
+struct mxt540e_platform_data {
+ int max_finger_touches;
+ const u8 **config_e;
+ int gpio_read_done;
+ int min_x;
+ int max_x;
+ int min_y;
+ int max_y;
+ int min_z;
+ int max_z;
+ int min_w;
+ int max_w;
+ u8 chrgtime_batt;
+ u8 chrgtime_charging;
+ u8 tchthr_batt;
+ u8 tchthr_charging;
+ u8 actvsyncsperx_batt;
+ u8 actvsyncsperx_charging;
+ u8 calcfg_batt_e;
+ u8 calcfg_charging_e;
+ u8 atchfrccalthr_e;
+ u8 atchfrccalratio_e;
+ const u8 *t48_config_batt_e;
+ const u8 *t48_config_chrg_e;
+ void (*power_on) (void);
+ void (*power_off) (void);
+ void (*power_on_with_oleddet) (void);
+ void (*power_off_with_oleddet) (void);
+ void (*register_cb) (void *);
+ void (*read_ta_status) (void *);
+};
+
+enum {
+ MXT_PAGE_UP = 0x01,
+ MXT_PAGE_DOWN = 0x02,
+ MXT_DELTA_MODE = 0x10,
+ MXT_REFERENCE_MODE = 0x11,
+ MXT_CTE_MODE = 0x31
+};
+
+int get_tsp_status(void);
+extern struct class *sec_class;
+
+#endif
diff --git a/include/linux/i2c/mxt768e.h b/include/linux/i2c/mxt768e.h
new file mode 100644
index 0000000..e190ce8
--- /dev/null
+++ b/include/linux/i2c/mxt768e.h
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2010, Samsung Electronics Co. Ltd. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MXT_H__
+#define __MXT_H__
+
+#define MXT_DEV_NAME "Atmel MXT768E"
+#define MXT_SW_RESET_TIME 300 /* msec */
+#define MXT_HW_RESET_TIME 300 /* msec */
+
+enum { RESERVED_T0 = 0,
+ RESERVED_T1,
+ DEBUG_DELTAS_T2,
+ DEBUG_REFERENCES_T3,
+ DEBUG_SIGNALS_T4,
+ GEN_MESSAGEPROCESSOR_T5,
+ GEN_COMMANDPROCESSOR_T6,
+ GEN_POWERCONFIG_T7,
+ GEN_ACQUISITIONCONFIG_T8,
+ TOUCH_MULTITOUCHSCREEN_T9,
+ TOUCH_SINGLETOUCHSCREEN_T10,
+ TOUCH_XSLIDER_T11,
+ TOUCH_YSLIDER_T12,
+ TOUCH_XWHEEL_T13,
+ TOUCH_YWHEEL_T14,
+ TOUCH_KEYARRAY_T15,
+ PROCG_SIGNALFILTER_T16,
+ PROCI_LINEARIZATIONTABLE_T17,
+ SPT_COMCONFIG_T18,
+ SPT_GPIOPWM_T19,
+ PROCI_GRIPFACESUPPRESSION_T20,
+ RESERVED_T21,
+ PROCG_NOISESUPPRESSION_T22,
+ TOUCH_PROXIMITY_T23,
+ PROCI_ONETOUCHGESTUREPROCESSOR_T24,
+ SPT_SELFTEST_T25,
+ DEBUG_CTERANGE_T26,
+ PROCI_TWOTOUCHGESTUREPROCESSOR_T27,
+ SPT_CTECONFIG_T28,
+ SPT_GPI_T29,
+ SPT_GATE_T30,
+ TOUCH_KEYSET_T31,
+ TOUCH_XSLIDERSET_T32,
+ RESERVED_T33,
+ GEN_MESSAGEBLOCK_T34,
+ SPT_GENERICDATA_T35,
+ RESERVED_T36,
+ DEBUG_DIAGNOSTIC_T37,
+ SPT_USERDATA_T38,
+ SPARE_T39,
+ PROCI_GRIPSUPPRESSION_T40,
+ SPARE_T41,
+ PROCI_TOUCHSUPPRESSION_T42,
+ SPT_DIGITIZER_T43,
+ SPARE_T44,
+ SPARE_T45,
+ SPT_CTECONFIG_T46,
+ PROCI_STYLUS_T47,
+ PROCG_NOISESUPPRESSION_T48,
+ SPARE_T49,
+ SPARE_T50,
+ SPARE_T51,
+ TOUCH_PROXIMITY_KEY_T52,
+ GEN_DATASOURCE_T53,
+ SPARE_T54,
+ ADAPTIVE_T55,
+ PROCI_SHIELDLESS_T56,
+ SPT_GENERICDATA_T57,
+ RESERVED_T255 = 255,
+};
+
+struct mxt_platform_data {
+ int max_finger_touches;
+ int gpio_read_done;
+ const u8 **config;
+ int min_x;
+ int max_x;
+ int min_y;
+ int max_y;
+ int min_z;
+ int max_z;
+ int min_w;
+ int max_w;
+ u8 tchthr_batt;
+ u8 tchthr_charging;
+ u8 calcfg_batt;
+ u8 calcfg_charging;
+ u8 idlesyncsperx_batt;
+ u8 idlesyncsperx_charging;
+ u8 actvsyncsperx_batt;
+ u8 actvsyncsperx_charging;
+ u8 xloclip_batt;
+ u8 xloclip_charging;
+ u8 xhiclip_batt;
+ u8 xhiclip_charging;
+ u8 yloclip_batt;
+ u8 yloclip_charging;
+ u8 yhiclip_batt;
+ u8 yhiclip_charging;
+ u8 xedgectrl_batt;
+ u8 xedgectrl_charging;
+ u8 xedgedist_batt;
+ u8 xedgedist_charging;
+ u8 yedgectrl_batt;
+ u8 yedgectrl_charging;
+ u8 yedgedist_batt;
+ u8 yedgedist_charging;
+ const u8 *t48_config_batt;
+ const u8 *t48_config_chrg;
+ void (*power_on) (void);
+ void (*power_off) (void);
+ void (*register_cb) (void *);
+ void (*read_ta_status) (bool *);
+};
+
+enum {
+ MXT_PAGE_UP = 0x01,
+ MXT_PAGE_DOWN = 0x02,
+ MXT_DELTA_MODE = 0x10,
+ MXT_REFERENCE_MODE = 0x11,
+ MXT_CTE_MODE = 0x31
+};
+
+extern struct class *sec_class;
+#endif /* */
diff --git a/include/linux/i2c/touchkey_i2c.h b/include/linux/i2c/touchkey_i2c.h
new file mode 100644
index 0000000..e214c28
--- /dev/null
+++ b/include/linux/i2c/touchkey_i2c.h
@@ -0,0 +1,159 @@
+#ifndef _LINUX_CYPRESS_TOUCHKEY_I2C_H
+#define _LINUX_CYPRESS_TOUCHKEY_I2C_H
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/input.h>
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/slab.h>
+#include <linux/hrtimer.h>
+#include <linux/gpio.h>
+#include <linux/irq.h>
+#include <linux/delay.h>
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+#include <linux/earlysuspend.h>
+#endif
+
+/* Touchkey Register */
+#define KEYCODE_REG 0x00
+
+#define TK_BIT_PRESS_EV 0x08
+#define TK_BIT_KEYCODE 0x07
+
+#define TK_BIT_AUTOCAL 0x80
+
+#if defined(CONFIG_MACH_Q1_BD)\
+ || defined(CONFIG_TARGET_LOCALE_NA)\
+ || defined(CONFIG_MACH_M0)\
+ || defined(CONFIG_MACH_C1)\
+ || defined(CONFIG_MACH_C1VZW)
+#define TK_CMD_LED_ON 0x10
+#define TK_CMD_LED_OFF 0x20
+#else
+#define TK_CMD_LED_ON 1
+#define TK_CMD_LED_OFF 2
+#endif
+
+#define I2C_M_WR 0 /* for i2c */
+
+#define TK_UPDATE_DOWN 1
+#define TK_UPDATE_FAIL -1
+#define TK_UPDATE_PASS 0
+
+/* Firmware Version */
+#if defined(CONFIG_MACH_Q1_BD)
+#define TK_FIRMWARE_VER 0x12
+#define TK_MODULE_VER 0x11
+#elif defined(CONFIG_MACH_C1_NA_USCC_REV05)
+#define TK_FIRMWARE_VER 0x0E
+#define TK_MODULE_VER 0x08
+#elif defined(CONFIG_MACH_M0) || defined(CONFIG_MACH_C1VZW)\
+ || defined(CONFIG_MACH_C1)
+#define TK_FIRMWARE_VER 0x06
+#define TK_MODULE_VER 0x05
+#elif defined(CONFIG_MACH_S2PLUS)
+#define TK_FIRMWARE_VER 0x04
+#define TK_MODULE_VER 0x00
+#else
+#define TK_FIRMWARE_VER 0x04
+#define TK_MODULE_VER 0x00
+#endif
+
+/* LDO Regulator */
+#if defined(CONFIG_MACH_S2PLUS)
+#define TK_REGULATOR_NAME "3_touch_1.8v"
+#elif defined(CONFIG_MACH_M0)\
+ || defined(CONFIG_MACH_C1)\
+ || defined(CONFIG_MACH_C1VZW)
+#define TK_REGULATOR_NAME "touchkey"
+#else
+#define TK_REGULATOR_NAME "touch"
+#endif
+
+/* LED LDO Type*/
+#if defined(CONFIG_MACH_S2PLUS) \
+ || defined(CONFIG_MACH_M0)\
+ || defined(CONFIG_MACH_C1_KOR_SKT)\
+ || defined(CONFIG_MACH_C1_KOR_KT)\
+ || defined(CONFIG_MACH_C1VZW)\
+ || defined(CONFIG_MACH_C1)
+#define LED_LDO_WITH_EN_PIN
+#else
+#define LED_LDO_WITH_REGULATOR
+#endif
+
+/* Autocalibration */
+#if defined(CONFIG_TARGET_LOCALE_NAATT)\
+ || defined(CONFIG_TARGET_LOCALE_NA)\
+ || defined(CONFIG_MACH_Q1_BD)\
+ || defined(CONFIG_MACH_M0)\
+ || defined(CONFIG_MACH_C1)\
+ || defined(CONFIG_MACH_C1VZW)
+#define TK_HAS_AUTOCAL
+#endif
+
+/* Generalized SMBus access */
+#if defined(CONFIG_MACH_M0) || defined(CONFIG_MACH_C1VZW)\
+ || defined(CONFIG_MACH_C1)
+#define TK_USE_GENERAL_SMBUS
+#endif
+
+/* Boot-up Firmware Update */
+#if defined(CONFIG_MACH_Q1_BD) \
+ || defined(CONFIG_MACH_C1_NA_USCC_REV05) \
+ || defined(CONFIG_TARGET_LOCALE_NA)\
+ || defined(CONFIG_MACH_M0)\
+ || defined(CONFIG_MACH_C1)\
+ || defined(CONFIG_MACH_C1VZW)
+#define TK_HAS_FIRMWARE_UPDATE
+#endif
+
+#if defined(CONFIG_MACH_M0_CHNOPEN) || defined(CONFIG_MACH_M0_HKTW)
+#define TOUCHKEY_FW_UPDATEABLE_HW_REV 10
+#elif defined(CONFIG_MACH_M0)
+#define TOUCHKEY_FW_UPDATEABLE_HW_REV 11
+#elif defined(CONFIG_MACH_C1)
+#if defined(CONFIG_MACH_C1_KOR_SKT) || defined(CONFIG_MACH_C1_KOR_KT)
+#define TOUCHKEY_FW_UPDATEABLE_HW_REV 8
+#elif defined(CONFIG_MACH_C1_KOR_LGT)
+#define TOUCHKEY_FW_UPDATEABLE_HW_REV 5
+#else
+#define TOUCHKEY_FW_UPDATEABLE_HW_REV 7
+#endif
+#else
+#define TOUCHKEY_FW_UPDATEABLE_HW_REV 11
+#endif
+
+struct touchkey_platform_data {
+ int gpio_sda;
+ int gpio_scl;
+ int gpio_int;
+ void (*init_platform_hw)(void);
+ int (*suspend) (void);
+ int (*resume) (void);
+ int (*power_on) (bool);
+ int (*led_power_on) (bool);
+ int (*reset_platform_hw)(void);
+};
+
+/*Parameters for i2c driver*/
+struct touchkey_i2c {
+ struct i2c_client *client;
+ struct input_dev *input_dev;
+ struct early_suspend early_suspend;
+ struct mutex lock;
+ struct device *dev;
+ int irq;
+ int module_ver;
+ int firmware_ver;
+ struct touchkey_platform_data *pdata;
+ char *name;
+ int (*power)(int on);
+ struct work_struct update_work;
+ int update_status;
+};
+
+#endif /* _LINUX_CYPRESS_TOUCHKEY_I2C_H */
diff --git a/include/linux/i2c/voice_processor.h b/include/linux/i2c/voice_processor.h
new file mode 100644
index 0000000..2ea8e03
--- /dev/null
+++ b/include/linux/i2c/voice_processor.h
@@ -0,0 +1,27 @@
+/* include/linux/i2c/voice_processor.h - voice processor driver
+ *
+ * Copyright (C) 2012 Samsung Corporation.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __VOICE_PROCESSOR_H__
+#define __VOICE_PROCESSOR_H__
+
+enum voice_processing_mode {
+ VOICE_NS_BYPASS_MODE = 0,
+ VOICE_NS_HANDSET_MODE,
+ VOICE_NS_LOUD_MODE,
+ VOICE_NS_FTM_LOOPBACK_MODE,
+ NUM_OF_VOICE_NS_MODE,
+};
+
+#endif
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index bf56b6f..12c830e 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1434,12 +1434,22 @@ enum ieee80211_sa_query_action {
#define WLAN_CIPHER_SUITE_CCMP 0x000FAC04
#define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
#define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06
+/*
+WAPI
+*/
+#define WLAN_CIPHER_SUITE_SMS4 0x000FAC07
/* AKM suite selectors */
#define WLAN_AKM_SUITE_8021X 0x000FAC01
#define WLAN_AKM_SUITE_PSK 0x000FAC02
#define WLAN_AKM_SUITE_SAE 0x000FAC08
#define WLAN_AKM_SUITE_FT_OVER_SAE 0x000FAC09
+#define WLAN_AKM_SUITE_CCKM 0x000FAC04 /* CCKM */
+/*
+WAPI
+*/
+#define WLAN_AKM_SUITE_WAPI_PSK 0x000FAC04
+#define WLAN_AKM_SUITE_WAPI_CERT 0x000FAC12
#define WLAN_MAX_KEY_LEN 32
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 6d722f4..2cc79ae 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -59,6 +59,7 @@
#define ARPHRD_LAPB 516 /* LAPB */
#define ARPHRD_DDCMP 517 /* Digital's DDCMP protocol */
#define ARPHRD_RAWHDLC 518 /* Raw HDLC */
+#define ARPHRD_RAWIP 530 /* Raw IP */
#define ARPHRD_TUNNEL 768 /* IPIP tunnel */
#define ARPHRD_TUNNEL6 769 /* IP6IP6 tunnel */
diff --git a/include/linux/if_pppolac.h b/include/linux/if_pppolac.h
new file mode 100644
index 0000000..c06bd6c
--- /dev/null
+++ b/include/linux/if_pppolac.h
@@ -0,0 +1,33 @@
+/* include/linux/if_pppolac.h
+ *
+ * Header for PPP on L2TP Access Concentrator / PPPoLAC Socket (RFC 2661)
+ *
+ * Copyright (C) 2009 Google, Inc.
+ * Author: Chia-chi Yeh <chiachi@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __LINUX_IF_PPPOLAC_H
+#define __LINUX_IF_PPPOLAC_H
+
+#include <linux/socket.h>
+#include <linux/types.h>
+
+struct sockaddr_pppolac {
+ sa_family_t sa_family; /* AF_PPPOX */
+ unsigned int sa_protocol; /* PX_PROTO_OLAC */
+ int udp_socket;
+ struct __attribute__((packed)) {
+ __u16 tunnel, session;
+ } local, remote;
+} __attribute__((packed));
+
+#endif /* __LINUX_IF_PPPOLAC_H */
diff --git a/include/linux/if_pppopns.h b/include/linux/if_pppopns.h
new file mode 100644
index 0000000..0cf34b4
--- /dev/null
+++ b/include/linux/if_pppopns.h
@@ -0,0 +1,32 @@
+/* include/linux/if_pppopns.h
+ *
+ * Header for PPP on PPTP Network Server / PPPoPNS Socket (RFC 2637)
+ *
+ * Copyright (C) 2009 Google, Inc.
+ * Author: Chia-chi Yeh <chiachi@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __LINUX_IF_PPPOPNS_H
+#define __LINUX_IF_PPPOPNS_H
+
+#include <linux/socket.h>
+#include <linux/types.h>
+
+struct sockaddr_pppopns {
+ sa_family_t sa_family; /* AF_PPPOX */
+ unsigned int sa_protocol; /* PX_PROTO_OPNS */
+ int tcp_socket;
+ __u16 local;
+ __u16 remote;
+} __attribute__((packed));
+
+#endif /* __LINUX_IF_PPPOPNS_H */
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h
index 397921b..999ccd3 100644
--- a/include/linux/if_pppox.h
+++ b/include/linux/if_pppox.h
@@ -27,6 +27,8 @@
#include <linux/ppp_channel.h>
#endif /* __KERNEL__ */
#include <linux/if_pppol2tp.h>
+#include <linux/if_pppolac.h>
+#include <linux/if_pppopns.h>
/* For user-space programs to pick up these definitions
* which they wouldn't get otherwise without defining __KERNEL__
@@ -60,7 +62,9 @@ struct pptp_addr {
#define PX_PROTO_OE 0 /* Currently just PPPoE */
#define PX_PROTO_OL2TP 1 /* Now L2TP also */
#define PX_PROTO_PPTP 2
-#define PX_MAX_PROTO 3
+#define PX_PROTO_OLAC 3
+#define PX_PROTO_OPNS 4
+#define PX_MAX_PROTO 5
struct sockaddr_pppox {
sa_family_t sa_family; /* address family, AF_PPPOX */
@@ -167,6 +171,25 @@ struct pptp_opt {
u32 seq_sent, seq_recv;
int ppp_flags;
};
+
+struct pppolac_opt {
+ __u32 local;
+ __u32 remote;
+ __u32 recv_sequence;
+ __u32 xmit_sequence;
+ atomic_t sequencing;
+ int (*backlog_rcv)(struct sock *sk_udp, struct sk_buff *skb);
+};
+
+struct pppopns_opt {
+ __u16 local;
+ __u16 remote;
+ __u32 recv_sequence;
+ __u32 xmit_sequence;
+ void (*data_ready)(struct sock *sk_raw, int length);
+ int (*backlog_rcv)(struct sock *sk_raw, struct sk_buff *skb);
+};
+
#include <net/sock.h>
struct pppox_sock {
@@ -177,6 +200,8 @@ struct pppox_sock {
union {
struct pppoe_opt pppoe;
struct pptp_opt pptp;
+ struct pppolac_opt lac;
+ struct pppopns_opt pns;
} proto;
__be16 num;
};
diff --git a/include/linux/input.h b/include/linux/input.h
index 771d6d8..92d2741 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -783,11 +783,15 @@ struct input_keymap_entry {
#define ABS_MT_TRACKING_ID 0x39 /* Unique ID of initiated contact */
#define ABS_MT_PRESSURE 0x3a /* Pressure on contact area */
#define ABS_MT_DISTANCE 0x3b /* Contact hover distance */
+#define ABS_MT_ANGLE 0x3c /* touch angle */
+#define ABS_MT_COMPONENT 0x3c /* touch component */
+#define ABS_MT_PALM 0x3d /* palm touch */
+#define ABS_MT_SUMSIZE 0x3d /* touch sumsize */
#ifdef __KERNEL__
/* Implementation details, userspace should not care about these */
#define ABS_MT_FIRST ABS_MT_TOUCH_MAJOR
-#define ABS_MT_LAST ABS_MT_DISTANCE
+#define ABS_MT_LAST ABS_MT_PALM
#endif
#define ABS_MAX 0x3f
diff --git a/include/linux/iommu.h b/include/linux/iommu.h
index 0a2ba40..c83cabd 100644
--- a/include/linux/iommu.h
+++ b/include/linux/iommu.h
@@ -19,19 +19,139 @@
#ifndef __LINUX_IOMMU_H
#define __LINUX_IOMMU_H
+#include <linux/errno.h>
+
#define IOMMU_READ (1)
#define IOMMU_WRITE (2)
#define IOMMU_CACHE (4) /* DMA cache coherency */
+struct iommu_ops;
+struct bus_type;
struct device;
+struct iommu_domain;
+
+/* iommu fault flags */
+#define IOMMU_FAULT_READ 0x0
+#define IOMMU_FAULT_WRITE 0x1
+
+typedef int (*iommu_fault_handler_t)(struct iommu_domain *,
+ struct device *, unsigned long, int);
struct iommu_domain {
void *priv;
+#if defined(CONFIG_ARCH_EXYNOS5)
+ struct iommu_ops *ops;
+ iommu_fault_handler_t handler;
+#endif
};
#define IOMMU_CAP_CACHE_COHERENCY 0x1
#define IOMMU_CAP_INTR_REMAP 0x2 /* isolates device intrs */
+#ifdef CONFIG_IOMMU_API
+
+/**
+ * struct iommu_ops - iommu ops and capabilities
+ * @domain_init: init iommu domain
+ * @domain_destroy: destroy iommu domain
+ * @attach_dev: attach device to an iommu domain
+ * @detach_dev: detach device from an iommu domain
+ * @map: map a physically contiguous memory region to an iommu domain
+ * @unmap: unmap a physically contiguous memory region from an iommu domain
+ * @iova_to_phys: translate iova to physical address
+ * @domain_has_cap: domain capabilities query
+ * @commit: commit iommu domain
+ * @pgsize_bitmap: bitmap of supported page sizes
+ */
+struct iommu_ops {
+ int (*domain_init)(struct iommu_domain *domain);
+ void (*domain_destroy)(struct iommu_domain *domain);
+ int (*attach_dev)(struct iommu_domain *domain, struct device *dev);
+ void (*detach_dev)(struct iommu_domain *domain, struct device *dev);
+ int (*map)(struct iommu_domain *domain, unsigned long iova,
+ phys_addr_t paddr, size_t size, int prot);
+ size_t (*unmap)(struct iommu_domain *domain, unsigned long iova,
+ size_t size);
+ phys_addr_t (*iova_to_phys)(struct iommu_domain *domain,
+ unsigned long iova);
+ int (*domain_has_cap)(struct iommu_domain *domain,
+ unsigned long cap);
+ int (*device_group)(struct device *dev, unsigned int *groupid);
+ unsigned long pgsize_bitmap;
+};
+
+extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops);
+extern bool iommu_present(struct bus_type *bus);
+extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus);
+extern void iommu_domain_free(struct iommu_domain *domain);
+extern int iommu_attach_device(struct iommu_domain *domain,
+ struct device *dev);
+extern void iommu_detach_device(struct iommu_domain *domain,
+ struct device *dev);
+extern int iommu_map(struct iommu_domain *domain, unsigned long iova,
+ phys_addr_t paddr, size_t size, int prot);
+extern size_t iommu_unmap(struct iommu_domain *domain, unsigned long iova,
+ size_t size);
+extern phys_addr_t iommu_iova_to_phys(struct iommu_domain *domain,
+ unsigned long iova);
+extern int iommu_domain_has_cap(struct iommu_domain *domain,
+ unsigned long cap);
+extern void iommu_set_fault_handler(struct iommu_domain *domain,
+ iommu_fault_handler_t handler);
+extern int iommu_device_group(struct device *dev, unsigned int *groupid);
+
+/**
+ * report_iommu_fault() - report about an IOMMU fault to the IOMMU framework
+ * @domain: the iommu domain where the fault has happened
+ * @dev: the device where the fault has happened
+ * @iova: the faulting address
+ * @flags: mmu fault flags (e.g. IOMMU_FAULT_READ/IOMMU_FAULT_WRITE/...)
+ *
+ * This function should be called by the low-level IOMMU implementations
+ * whenever IOMMU faults happen, to allow high-level users, that are
+ * interested in such events, to know about them.
+ *
+ * This event may be useful for several possible use cases:
+ * - mere logging of the event
+ * - dynamic TLB/PTE loading
+ * - if restarting of the faulting device is required
+ *
+ * Returns 0 on success and an appropriate error code otherwise (if dynamic
+ * PTE/TLB loading will one day be supported, implementations will be able
+ * to tell whether it succeeded or not according to this return value).
+ *
+ * Specifically, -ENOSYS is returned if a fault handler isn't installed
+ * (though fault handlers can also return -ENOSYS, in case they want to
+ * elicit the default behavior of the IOMMU drivers).
+ */
+static inline int report_iommu_fault(struct iommu_domain *domain,
+ struct device *dev, unsigned long iova, int flags)
+{
+ int ret = -ENOSYS;
+
+ /*
+ * if upper layers showed interest and installed a fault handler,
+ * invoke it.
+ */
+ if (domain->handler)
+ ret = domain->handler(domain, dev, iova, flags);
+
+ return ret;
+}
+#elif defined(CONFIG_IOMMU_EXYNOS4_API)
+/**
+ * struct iommu_ops - iommu ops and capabilities
+ * @domain_init: init iommu domain
+ * @domain_destroy: destroy iommu domain
+ * @attach_dev: attach device to an iommu domain
+ * @detach_dev: detach device from an iommu domain
+ * @map: map a physically contiguous memory region to an iommu domain
+ * @unmap: unmap a physically contiguous memory region from an iommu domain
+ * @iova_to_phys: translate iova to physical address
+ * @domain_has_cap: domain capabilities query
+ * @commit: commit iommu domain
+ * @pgsize_bitmap: bitmap of supported page sizes
+ */
struct iommu_ops {
int (*domain_init)(struct iommu_domain *domain);
void (*domain_destroy)(struct iommu_domain *domain);
@@ -40,15 +160,13 @@ struct iommu_ops {
int (*map)(struct iommu_domain *domain, unsigned long iova,
phys_addr_t paddr, int gfp_order, int prot);
int (*unmap)(struct iommu_domain *domain, unsigned long iova,
- int gfp_order);
+ int gfp_order);
phys_addr_t (*iova_to_phys)(struct iommu_domain *domain,
unsigned long iova);
int (*domain_has_cap)(struct iommu_domain *domain,
unsigned long cap);
};
-#ifdef CONFIG_IOMMU_API
-
extern void register_iommu(struct iommu_ops *ops);
extern bool iommu_found(void);
extern struct iommu_domain *iommu_domain_alloc(void);
@@ -68,16 +186,14 @@ extern int iommu_domain_has_cap(struct iommu_domain *domain,
#else /* CONFIG_IOMMU_API */
-static inline void register_iommu(struct iommu_ops *ops)
-{
-}
+struct iommu_ops {};
-static inline bool iommu_found(void)
+static inline bool iommu_present(struct bus_type *bus)
{
return false;
}
-static inline struct iommu_domain *iommu_domain_alloc(void)
+static inline struct iommu_domain *iommu_domain_alloc(struct bus_type *bus)
{
return NULL;
}
@@ -121,6 +237,16 @@ static inline int domain_has_cap(struct iommu_domain *domain,
return 0;
}
+static inline void iommu_set_fault_handler(struct iommu_domain *domain,
+ iommu_fault_handler_t handler)
+{
+}
+
+static inline int iommu_device_group(struct device *dev, unsigned int *groupid)
+{
+ return -ENODEV;
+}
+
#endif /* CONFIG_IOMMU_API */
#endif /* __LINUX_IOMMU_H */
diff --git a/include/linux/ion.h b/include/linux/ion.h
new file mode 100644
index 0000000..d96dbeb
--- /dev/null
+++ b/include/linux/ion.h
@@ -0,0 +1,419 @@
+/*
+ * include/linux/ion.h
+ *
+ * Copyright (C) 2011 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_ION_H
+#define _LINUX_ION_H
+
+#include <linux/types.h>
+
+struct ion_handle;
+/**
+ * enum ion_heap_types - list of all possible types of heaps
+ * @ION_HEAP_TYPE_SYSTEM: memory allocated via vmalloc
+ * @ION_HEAP_TYPE_SYSTEM_CONTIG: memory allocated via kmalloc
+ * @ION_HEAP_TYPE_CARVEOUT: memory allocated from a prereserved
+ * carveout heap, allocations are physically
+ * contiguous
+ * @ION_HEAP_END: helper for iterating over heaps
+ */
+enum ion_heap_type {
+ ION_HEAP_TYPE_SYSTEM,
+ ION_HEAP_TYPE_SYSTEM_CONTIG,
+ ION_HEAP_TYPE_CARVEOUT,
+ ION_HEAP_TYPE_CUSTOM, /* must be last so device specific heaps always
+ are at the end of this enum */
+#ifdef CONFIG_ION_EXYNOS
+ ION_HEAP_TYPE_EXYNOS_CONTIG,
+ ION_HEAP_TYPE_EXYNOS,
+ ION_HEAP_TYPE_EXYNOS_USER,
+#endif
+ ION_NUM_HEAPS,
+};
+
+#define ION_HEAP_SYSTEM_MASK (1 << ION_HEAP_TYPE_SYSTEM)
+#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG)
+#define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT)
+
+#ifdef CONFIG_ION_EXYNOS
+#define ION_HEAP_EXYNOS_MASK (1 << ION_HEAP_TYPE_EXYNOS)
+#define ION_HEAP_EXYNOS_CONTIG_MASK (1 << ION_HEAP_TYPE_EXYNOS_CONTIG)
+#define ION_HEAP_EXYNOS_USER_MASK (1 << ION_HEAP_TYPE_EXYNOS_USER)
+#define ION_EXYNOS_NONCACHE_MASK (1 << (BITS_PER_LONG - 2))
+#define ION_EXYNOS_WRITE_MASK (1 << (BITS_PER_LONG - 1))
+#endif
+
+#ifdef __KERNEL__
+struct ion_device;
+struct ion_heap;
+struct ion_mapper;
+struct ion_client;
+struct ion_buffer;
+
+/* This should be removed some day when phys_addr_t's are fully
+ plumbed in the kernel, and all instances of ion_phys_addr_t should
+ be converted to phys_addr_t. For the time being many kernel interfaces
+ do not accept phys_addr_t's that would have to */
+#define ion_phys_addr_t unsigned long
+
+/**
+ * struct ion_platform_heap - defines a heap in the given platform
+ * @type: type of the heap from ion_heap_type enum
+ * @id: unique identifier for heap. When allocating (lower numbers
+ * will be allocated from first)
+ * @name: used for debug purposes
+ * @base: base address of heap in physical memory if applicable
+ * @size: size of the heap in bytes if applicable
+ *
+ * Provided by the board file.
+ */
+struct ion_platform_heap {
+ enum ion_heap_type type;
+ unsigned int id;
+ const char *name;
+ ion_phys_addr_t base;
+ size_t size;
+};
+
+/**
+ * struct ion_platform_data - array of platform heaps passed from board file
+ * @nr: number of structures in the array
+ * @heaps: array of platform_heap structions
+ *
+ * Provided by the board file in the form of platform data to a platform device.
+ */
+struct ion_platform_data {
+ int nr;
+ struct ion_platform_heap heaps[];
+};
+
+/**
+ * ion_client_create() - allocate a client and returns it
+ * @dev: the global ion device
+ * @heap_mask: mask of heaps this client can allocate from
+ * @name: used for debugging
+ */
+struct ion_client *ion_client_create(struct ion_device *dev,
+ unsigned int heap_mask, const char *name);
+
+/**
+ * ion_client_destroy() - free's a client and all it's handles
+ * @client: the client
+ *
+ * Free the provided client and all it's resources including
+ * any handles it is holding.
+ */
+void ion_client_destroy(struct ion_client *client);
+
+/**
+ * ion_get_client() - obtain a user client from file descriptor from user
+ * @fd: the user client created by the request from user. This is
+ * passed from user.
+ *
+ * This function is requested by the device drivers that implement V4L2 and VB2
+ * interfaces. Those device drivers just obtains virtual address of a buffer
+ * even though it is allocated and mapped by ION. While they can retrieve the
+ * handle of the buffer, they are unable to access it because they do not know
+ * what client the handle belongs to.
+ * Note that the client obtained by this function is not released until
+ * ion_put_client() is called and the client is given.
+ */
+struct ion_client *ion_get_user_client(unsigned int fd_client);
+
+/**
+ * ion_put_client() - release the user client obtained by ion_get_client()
+ * @client - The user client to release.
+ */
+void ion_put_user_client(struct ion_client *user_client);
+
+/**
+ * ion_alloc - allocate ion memory
+ * @client: the client
+ * @len: size of the allocation
+ * @align: requested allocation alignment, lots of hardware blocks have
+ * alignment requirements of some kind
+ * @flags: mask of heaps to allocate from, if multiple bits are set
+ * heaps will be tried in order from lowest to highest order bit
+ *
+ * Allocate memory in one of the heaps provided in heap mask and return
+ * an opaque handle to it.
+ */
+struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
+ size_t align, unsigned int flags);
+
+/**
+ * ion_free - free a handle
+ * @client: the client
+ * @handle: the handle to free
+ *
+ * Free the provided handle.
+ */
+void ion_free(struct ion_client *client, struct ion_handle *handle);
+
+/**
+ * ion_phys - returns the physical address and len of a handle
+ * @client: the client
+ * @handle: the handle
+ * @addr: a pointer to put the address in
+ * @len: a pointer to put the length in
+ *
+ * This function queries the heap for a particular handle to get the
+ * handle's physical address. It't output is only correct if
+ * a heap returns physically contiguous memory -- in other cases
+ * this api should not be implemented -- ion_map_dma should be used
+ * instead. Returns -EINVAL if the handle is invalid. This has
+ * no implications on the reference counting of the handle --
+ * the returned value may not be valid if the caller is not
+ * holding a reference.
+ */
+int ion_phys(struct ion_client *client, struct ion_handle *handle,
+ ion_phys_addr_t *addr, size_t *len);
+
+/**
+ * ion_map_kernel - create mapping for the given handle
+ * @client: the client
+ * @handle: handle to map
+ *
+ * Map the given handle into the kernel and return a kernel address that
+ * can be used to access this address.
+ */
+void *ion_map_kernel(struct ion_client *client, struct ion_handle *handle);
+
+/**
+ * ion_unmap_kernel() - destroy a kernel mapping for a handle
+ * @client: the client
+ * @handle: handle to unmap
+ */
+void ion_unmap_kernel(struct ion_client *client, struct ion_handle *handle);
+
+/**
+ * ion_map_dma - create a dma mapping for a given handle
+ * @client: the client
+ * @handle: handle to map
+ *
+ * Return an sglist describing the given handle
+ */
+struct scatterlist *ion_map_dma(struct ion_client *client,
+ struct ion_handle *handle);
+
+/**
+ * ion_unmap_dma() - destroy a dma mapping for a handle
+ * @client: the client
+ * @handle: handle to unmap
+ */
+void ion_unmap_dma(struct ion_client *client, struct ion_handle *handle);
+
+/**
+ * ion_share() - given a handle, obtain a buffer to pass to other clients
+ * @client: the client
+ * @handle: the handle to share
+ *
+ * Given a handle, return a buffer, which exists in a global name
+ * space, and can be passed to other clients. Should be passed into ion_import
+ * to obtain a new handle for this buffer.
+ *
+ * NOTE: This function does do not an extra reference. The burden is on the
+ * caller to make sure the buffer doesn't go away while it's being passed to
+ * another client. That is, ion_free should not be called on this handle until
+ * the buffer has been imported into the other client.
+ */
+struct ion_buffer *ion_share(struct ion_client *client,
+ struct ion_handle *handle);
+
+/**
+ * ion_import() - given an buffer in another client, import it
+ * @client: this blocks client
+ * @buffer: the buffer to import (as obtained from ion_share)
+ *
+ * Given a buffer, add it to the client and return the handle to use to refer
+ * to it further. This is called to share a handle from one kernel client to
+ * another.
+ */
+struct ion_handle *ion_import(struct ion_client *client,
+ struct ion_buffer *buffer);
+
+/**
+ * ion_share_fd() - given a handle, obtain a buffer(fd) to pass to userspace
+ * @client: the client
+ * @handle: the handle to share
+ *
+ * Given a handle, return a fd of a buffer which can be passed to userspace.
+ * Should be passed into userspace or ion_import_fd to obtain a new handle for
+ * this buffer.
+ */
+int ion_share_fd(struct ion_client *client, struct ion_handle *handle);
+
+/**
+ * ion_import_fd() - given an fd obtained via ION_IOC_SHARE ioctl, import it
+ * @client: this blocks client
+ * @fd: the fd
+ *
+ * A helper function for drivers that will be recieving ion buffers shared
+ * with them from userspace. These buffers are represented by a file
+ * descriptor obtained as the return from the ION_IOC_SHARE ioctl.
+ * This function coverts that fd into the underlying buffer, and returns
+ * the handle to use to refer to it further.
+ */
+struct ion_handle *ion_import_fd(struct ion_client *client, int fd);
+
+/**
+ * ion_import_uva() - given a virtual address from user, that is mmapped on an
+ * fd obtained via ION_IOCTL_SHARE ioctl, import it
+ * @client: this blocks client
+ * @uva: virtual address in userspace.
+ * @offset: How many bytes are distant from the beginning of the ION buffer
+ *
+ * A helper function for drivers that will be recieving ion buffers shared
+ * with them from userspace. These buffers are represented by a virtual
+ * address that is mmaped on a file descriptor obtained as the return from the
+ * ION_IOC_SHARE ioctl.
+ * This function does same job with ion_import_fd().
+ */
+struct ion_handle *ion_import_uva(struct ion_client *client, unsigned long uva,
+ off_t *offset);
+
+#ifdef CONFIG_ION_EXYNOS
+struct ion_handle *ion_exynos_get_user_pages(struct ion_client *client,
+ unsigned long uvaddr, size_t len, unsigned int flags);
+#else
+#include <linux/err.h>
+static inline struct ion_handle *ion_exynos_get_user_pages(
+ struct ion_client *client, unsigned long uvaddr,
+ size_t len, unsigned int flags)
+{
+ return ERR_PTR(-ENOSYS);
+}
+#endif
+
+#endif /* __KERNEL__ */
+
+/**
+ * DOC: Ion Userspace API
+ *
+ * create a client by opening /dev/ion
+ * most operations handled via following ioctls
+ *
+ */
+
+/**
+ * struct ion_allocation_data - metadata passed from userspace for allocations
+ * @len: size of the allocation
+ * @align: required alignment of the allocation
+ * @flags: flags passed to heap
+ * @handle: pointer that will be populated with a cookie to use to refer
+ * to this allocation
+ *
+ * Provided by userspace as an argument to the ioctl
+ */
+struct ion_allocation_data {
+ size_t len;
+ size_t align;
+ unsigned int flags;
+ struct ion_handle *handle;
+};
+
+/**
+ * struct ion_fd_data - metadata passed to/from userspace for a handle/fd pair
+ * @handle: a handle
+ * @fd: a file descriptor representing that handle
+ *
+ * For ION_IOC_SHARE or ION_IOC_MAP userspace populates the handle field with
+ * the handle returned from ion alloc, and the kernel returns the file
+ * descriptor to share or map in the fd field. For ION_IOC_IMPORT, userspace
+ * provides the file descriptor and the kernel returns the handle.
+ */
+struct ion_fd_data {
+ struct ion_handle *handle;
+ int fd;
+};
+
+/**
+ * struct ion_handle_data - a handle passed to/from the kernel
+ * @handle: a handle
+ */
+struct ion_handle_data {
+ struct ion_handle *handle;
+};
+
+/**
+ * struct ion_custom_data - metadata passed to/from userspace for a custom ioctl
+ * @cmd: the custom ioctl function to call
+ * @arg: additional data to pass to the custom ioctl, typically a user
+ * pointer to a predefined structure
+ *
+ * This works just like the regular cmd and arg fields of an ioctl.
+ */
+struct ion_custom_data {
+ unsigned int cmd;
+ unsigned long arg;
+};
+
+#define ION_IOC_MAGIC 'I'
+
+/**
+ * DOC: ION_IOC_ALLOC - allocate memory
+ *
+ * Takes an ion_allocation_data struct and returns it with the handle field
+ * populated with the opaque handle for the allocation.
+ */
+#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \
+ struct ion_allocation_data)
+
+/**
+ * DOC: ION_IOC_FREE - free memory
+ *
+ * Takes an ion_handle_data struct and frees the handle.
+ */
+#define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data)
+
+/**
+ * DOC: ION_IOC_MAP - get a file descriptor to mmap
+ *
+ * Takes an ion_fd_data struct with the handle field populated with a valid
+ * opaque handle. Returns the struct with the fd field set to a file
+ * descriptor open in the current address space. This file descriptor
+ * can then be used as an argument to mmap.
+ */
+#define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data)
+
+/**
+ * DOC: ION_IOC_SHARE - creates a file descriptor to use to share an allocation
+ *
+ * Takes an ion_fd_data struct with the handle field populated with a valid
+ * opaque handle. Returns the struct with the fd field set to a file
+ * descriptor open in the current address space. This file descriptor
+ * can then be passed to another process. The corresponding opaque handle can
+ * be retrieved via ION_IOC_IMPORT.
+ */
+#define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data)
+
+/**
+ * DOC: ION_IOC_IMPORT - imports a shared file descriptor
+ *
+ * Takes an ion_fd_data struct with the fd field populated with a valid file
+ * descriptor obtained from ION_IOC_SHARE and returns the struct with the handle
+ * filed set to the corresponding opaque handle.
+ */
+#define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, int)
+
+/**
+ * DOC: ION_IOC_CUSTOM - call architecture specific ion ioctl
+ *
+ * Takes the argument of the architecture specific ioctl to call and
+ * passes appropriate userdata for that ioctl
+ */
+#define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)
+
+#endif /* _LINUX_ION_H */
diff --git a/include/linux/ir_remote_con.h b/include/linux/ir_remote_con.h
new file mode 100644
index 0000000..423b4b4
--- /dev/null
+++ b/include/linux/ir_remote_con.h
@@ -0,0 +1,6 @@
+#ifndef _IR_REMOTE_CON_H
+#define _IR_REMOTE_CON_H
+
+extern struct class *sec_class;
+
+#endif
diff --git a/include/linux/irq.h b/include/linux/irq.h
index baa397e..d9e3319 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -679,6 +679,7 @@ void irq_gc_unmask_enable_reg(struct irq_data *d);
void irq_gc_ack_set_bit(struct irq_data *d);
void irq_gc_ack_clr_bit(struct irq_data *d);
void irq_gc_mask_disable_reg_and_ack(struct irq_data *d);
+void irq_gc_mask_and_ack_set(struct irq_data *d);
void irq_gc_eoi(struct irq_data *d);
int irq_gc_set_wake(struct irq_data *d, unsigned int on);
diff --git a/include/linux/isa1200_vibrator.h b/include/linux/isa1200_vibrator.h
new file mode 100644
index 0000000..16d46b0
--- /dev/null
+++ b/include/linux/isa1200_vibrator.h
@@ -0,0 +1,81 @@
+/* arch/arm/mach-tegra/sec_vibrator.c
+ *
+ * Copyright (C) 2011 Samsung Electronics Co. Ltd. All Rights Reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_SEC_VIBRATOR_H
+#define _LINUX_SEC_VIBRATOR_H
+
+#define HAPTIC_CONTROL_REG0 0x30
+#define HAPTIC_CONTROL_REG1 0x31
+#define HAPTIC_CONTROL_REG2 0x32
+#define HAPTIC_PLL_REG 0x33
+#define HAPTIC_CONTROL_REG4 0x34
+#define HAPTIC_PWM_DUTY_REG 0x35
+#define HAPTIC_PWM_PERIOD_REG 0x36
+#define HAPTIC_AMPLITUDE_REG 0x37
+
+/* HAPTIC_CONTROL_REG0 */
+#define CTL0_DIVIDER128 0
+#define CTL0_DIVIDER256 1
+#define CTL0_DIVIDER512 2
+#define CTL0_DIVIDER1024 3
+#define CTL0_13MHZ 1 << 2
+#define CTL0_PWM_INPUT 1 << 3
+#define CTL0_PWM_GEN 2 << 3
+#define CTL0_WAVE_GEN 3 << 3
+#define CTL0_HIGH_DRIVE 1 << 5
+#define CTL0_OVER_DR_EN 1 << 6
+#define CTL0_NORMAL_OP 1 << 7
+
+/* HAPTIC_CONTROL_REG1 */
+#define CTL1_HAPTICOFF_16U 0
+#define CTL1_HAPTICOFF_32U 1
+#define CTL1_HAPTICOFF_64U 2
+#define CTL1_HAPTICOFF_100U 3
+#define CTL1_HAPTICON_1U 1 << 2
+#define CTL1_SMART_EN 1 << 3
+#define CTL1_PLL_EN 1 << 4
+#define CTL1_ERM_TYPE 1 << 5
+#define CTL1_DEFAULT 1 << 6
+#define CTL1_EXT_CLOCK 1 << 7
+
+/* HAPTIC_CONTROL_REG2 */
+#define CTL2_EFFECT_EN 1
+#define CTL2_START_EFF_EN 1 << 2
+#define CTL2_SOFT_RESET_EN 1 << 7
+
+struct isa1200_vibrator_platform_data {
+ struct clk *(*get_clk) (void);
+ int (*gpio_en) (bool) ;
+ int pwm_id;
+ int max_timeout;
+ u8 ctrl0;
+ u8 ctrl1;
+ u8 ctrl2;
+ u8 ctrl4;
+ u8 pll;
+ u8 duty;
+ u8 period;
+ u16 pwm_duty;
+ u16 pwm_period;
+};
+
+#if defined(CONFIG_VIBETONZ)
+extern int vibtonz_i2c_write(u8 addr, int length, u8 *data);
+extern void vibtonz_clk_enable(bool en);
+extern void vibtonz_chip_enable(bool en);
+extern void vibtonz_clk_config(int duty);
+#endif
+
+#endif
diff --git a/include/linux/jack.h b/include/linux/jack.h
new file mode 100644
index 0000000..95f9c4d
--- /dev/null
+++ b/include/linux/jack.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2009 Samsung Electronics
+ * Minkyu Kang <mk7.kang@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __JACK_H_
+#define __JACK_H_
+
+struct jack_platform_data {
+ int usb_online;
+ int charger_online;
+ int hdmi_online;
+ int earjack_online;
+ int earkey_online;
+ int ums_online;
+ int cdrom_online;
+ int jig_online;
+ int host_online;
+ int cradle_online;
+};
+
+int jack_get_data(const char *name);
+void jack_event_handler(const char *name, int value);
+
+#endif
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 953352a..47e8dbe 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -736,4 +736,7 @@ extern int __build_bug_on_failed;
# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
#endif
+/* To identify board information in panic logs, set this */
+extern char *mach_panic_string;
+
#endif
diff --git a/include/linux/keychord.h b/include/linux/keychord.h
new file mode 100644
index 0000000..856a585
--- /dev/null
+++ b/include/linux/keychord.h
@@ -0,0 +1,52 @@
+/*
+ * Key chord input driver
+ *
+ * Copyright (C) 2008 Google, Inc.
+ * Author: Mike Lockwood <lockwood@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+*/
+
+#ifndef __LINUX_KEYCHORD_H_
+#define __LINUX_KEYCHORD_H_
+
+#include <linux/input.h>
+
+#define KEYCHORD_VERSION 1
+
+/*
+ * One or more input_keychord structs are written to /dev/keychord
+ * at once to specify the list of keychords to monitor.
+ * Reading /dev/keychord returns the id of a keychord when the
+ * keychord combination is pressed. A keychord is signalled when
+ * all of the keys in the keycode list are in the pressed state.
+ * The order in which the keys are pressed does not matter.
+ * The keychord will not be signalled if keys not in the keycode
+ * list are pressed.
+ * Keychords will not be signalled on key release events.
+ */
+struct input_keychord {
+ /* should be KEYCHORD_VERSION */
+ __u16 version;
+ /*
+ * client specified ID, returned from read()
+ * when this keychord is pressed.
+ */
+ __u16 id;
+
+ /* number of keycodes in this keychord */
+ __u16 count;
+
+ /* variable length array of keycodes */
+ __u16 keycodes[];
+};
+
+#endif /* __LINUX_KEYCHORD_H_ */
diff --git a/include/linux/keyreset.h b/include/linux/keyreset.h
new file mode 100644
index 0000000..a2ac49e
--- /dev/null
+++ b/include/linux/keyreset.h
@@ -0,0 +1,28 @@
+/*
+ * include/linux/keyreset.h - platform data structure for resetkeys driver
+ *
+ * Copyright (C) 2008 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_KEYRESET_H
+#define _LINUX_KEYRESET_H
+
+#define KEYRESET_NAME "keyreset"
+
+struct keyreset_platform_data {
+ int (*reset_fn)(void);
+ int *keys_up;
+ int keys_down[]; /* 0 terminated */
+};
+
+#endif /* _LINUX_KEYRESET_H */
diff --git a/include/linux/lcd.h b/include/linux/lcd.h
index 8877123..9fb77ae 100644
--- a/include/linux/lcd.h
+++ b/include/linux/lcd.h
@@ -40,6 +40,16 @@ struct lcd_ops {
/* Get the LCD panel power status (0: full on, 1..3: controller
power on, flat panel power off, 4: full off), see FB_BLANK_XXX */
int (*get_power)(struct lcd_device *);
+ /*
+ * Enable or disable power to the LCD(0: on; 4: off, see FB_BLANK_XXX)
+ * and this callback would be called proir to fb driver's callback.
+ *
+ * P.S. note that if early_set_power is not NULL then early fb notifier
+ * would be registered.
+ */
+ int (*early_set_power)(struct lcd_device *, int power);
+ /* revert the effects of the early blank event. */
+ int (*r_early_set_power)(struct lcd_device *, int power);
/* Enable or disable power to the LCD (0: on; 4: off, see FB_BLANK_XXX) */
int (*set_power)(struct lcd_device *, int power);
/* Get the current contrast setting (0-max_contrast) */
@@ -76,6 +86,9 @@ struct lcd_platform_data {
lcd power off and 1, lcd power on. */
int (*power_on)(struct lcd_device *ld, int enable);
+ int (*gpio_cfg_earlysuspend)(struct lcd_device *ld);
+ int (*gpio_cfg_lateresume)(struct lcd_device *ld);
+
/* it indicates whether lcd panel was enabled
from bootloader or not. */
int lcd_enabled;
@@ -87,6 +100,8 @@ struct lcd_platform_data {
unsigned int power_on_delay;
/* stable time needing to become lcd power off. */
unsigned int power_off_delay;
+ /*stable time needing to become sleep in mode after sleep out mode. */
+ unsigned int sleep_in_delay;
/* it could be used for any purpose. */
void *pdata;
diff --git a/include/linux/ld9040.h b/include/linux/ld9040.h
new file mode 100644
index 0000000..88bdf56
--- /dev/null
+++ b/include/linux/ld9040.h
@@ -0,0 +1,45 @@
+/*inclue/linux/ld9040.h
+ *
+ * Copyright (c) 2010 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com/
+ *
+ * Header file for Samsung Display Panel(AMOLED) driver
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+#include <linux/types.h>
+
+struct ld9040_panel_data {
+ const unsigned short *seq_user_set;
+ const unsigned short *seq_displayctl_set;
+ const unsigned short *seq_gtcon_set;
+ const unsigned short *seq_panelcondition_set;
+ const unsigned short *seq_pwrctl_set;
+ const unsigned short *display_on;
+ const unsigned short *display_off;
+ const unsigned short *sleep_in;
+ const unsigned short *sleep_out;
+ const unsigned short *acl_on;
+ const unsigned short **acl_table;
+ const unsigned short *elvss_on;
+ const unsigned short **elvss_table;
+ const unsigned short **gamma19_table;
+ const unsigned short **gamma22_table;
+ const unsigned short lcdtype;
+
+ struct spi_ops *ops;
+};
+
+struct spi_ops {
+ void (*setcs)(u8 is_on);
+ void (*setsck)(u8 is_on);
+ void (*setmosi)(u8 is_on);
+ void (*setmosi2miso)(u8 is_on);
+ unsigned int (*getmiso)(void);
+};
+
+#define LCDTYPE_M2 (1)
+#define LCDTYPE_SM2_A1 (0)
+#define LCDTYPE_SM2_A2 (2)
diff --git a/include/linux/leds-aat1290a.h b/include/linux/leds-aat1290a.h
new file mode 100644
index 0000000..c29583c
--- /dev/null
+++ b/include/linux/leds-aat1290a.h
@@ -0,0 +1,65 @@
+/*
+ * leds-aat1290a.h - Flash-led driver for AAT 1290A
+ *
+ * Copyright (C) 2011 Samsung Electronics
+ * DongHyun Chang <dh348.chang@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LEDS_AAT1290A_H__
+#define __LEDS_AAT1290A_H__
+
+#include <linux/platform_device.h>
+#include <linux/miscdevice.h>
+#include <linux/fs.h>
+#include <linux/delay.h>
+
+#define LED_ERROR(x, ...) printk(KERN_ERR "%s : " x, __func__, ##__VA_ARGS__)
+
+enum aat1290a_brightness {
+ TORCH_BRIGHTNESS_100 = 1,
+ TORCH_BRIGHTNESS_89,
+ TORCH_BRIGHTNESS_79,
+ TORCH_BRIGHTNESS_71,
+ TORCH_BRIGHTNESS_63,
+ TORCH_BRIGHTNESS_56,
+ TORCH_BRIGHTNESS_50,
+ TORCH_BRIGHTNESS_45,
+ TORCH_BRIGHTNESS_40,
+ TORCH_BRIGHTNESS_36,
+ TORCH_BRIGHTNESS_32,
+ TORCH_BRIGHTNESS_28,
+ TORCH_BRIGHTNESS_25,
+ TORCH_BRIGHTNESS_22,
+ TORCH_BRIGHTNESS_20,
+ TORCH_BRIGHTNESS_0,
+ TORCH_BRIGHTNESS_INVALID,
+};
+
+enum aat1290a_status {
+ STATUS_UNAVAILABLE = 0,
+ STATUS_AVAILABLE,
+ STATUS_INVALID,
+};
+
+#define IOCTL_AAT1290A 'A'
+#define IOCTL_AAT1290A_SET_BRIGHTNESS \
+ _IOW(IOCTL_AAT1290A, 0, enum aat1290a_brightness)
+#define IOCTL_AAT1290A_GET_STATUS \
+ _IOR(IOCTL_AAT1290A, 1, enum aat1290a_status)
+#define IOCTL_AAT1290A_SET_POWER _IOW(IOCTL_AAT1290A, 2, int)
+
+struct aat1290a_led_platform_data {
+ enum aat1290a_brightness brightness;
+ enum aat1290a_status status;
+ void (*switch_sel) (int enable);
+ int (*initGpio) (void);
+ int (*setGpio) (void);
+ int (*freeGpio) (void);
+ void (*torch_en) (int onoff);
+ void (*torch_set) (int onoff);
+};
+#endif
diff --git a/include/linux/leds-an30259a.h b/include/linux/leds-an30259a.h
new file mode 100644
index 0000000..dbb1500
--- /dev/null
+++ b/include/linux/leds-an30259a.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics Co. Ltd. All Rights Reserved.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LEDS_AN30259A_H
+#define _LEDS_AN30259A_H
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+#define LED_LIGHT_OFF 0
+#define LED_LIGHT_ON 1
+#define LED_LIGHT_PULSE 2
+#define LED_LIGHT_SLOPE 3
+
+/*
+ * This struct gets passed to the ioctl call.
+ * If only one of struct gets passed to the ioctl then it is assumed to define
+ * the behavior for all 3 color components: R, G and B.
+ * If 3 structs are passed, then each one is assumed to describe a single color:
+ * R first, then G, then B.
+ *
+ * Requesting a color value of 0 is equivalent to requesting LED_LIGHT_OFF
+ *
+ * If only describing a single color (ie passing a single struct), then
+ * start_delay will get ignored
+ *
+ * Other parameters may get ignored depending on the requested state:
+ * LIGHT_ON only requires color
+ * LIGHT_PULSE requires color, time_on and time_off
+ *
+ * Total time for time_slope_up_1 + time_slope_up_2 + time_on as well as for
+ * time_slope_down_1 + time_slope_down_2 + time_off will be rounded up to the
+ * nearest .5 seconds.
+ *
+ * Each of the time_slope_* values will get rounded up to the nearest multiple
+ * of 4ms up to 7680ms
+ */
+
+struct an30259_led_conf {
+ const char *name;
+ int brightness;
+ int max_brightness;
+ int flags;
+};
+
+struct an30259a_pr_control {
+ /* LED color in RGB format */
+ __u32 color;
+ /* see defines above */
+ __u32 state;
+ /* initial delay in ms */
+ __u16 start_delay;
+ /* time to reach mid_brightness_up from off in ms */
+ __u16 time_slope_up_1;
+ /* time to reach color from mid_brightness_up in ms */
+ __u16 time_slope_up_2;
+ /* time at max brightness in ms */
+ __u16 time_on;
+ /* time to reach mid_brightness_down from max brightness in ms */
+ __u16 time_slope_down_1;
+ /* time to reach off from mid_brightness_down in ms */
+ __u16 time_slope_down_2;
+ /* time off in ms */
+ __u16 time_off;
+ /* mid point brightness in 1/128 increments of color */
+ __u8 mid_brightness;
+} __packed;
+
+#define AN30259A_PR_SET_LED _IOW('S', 42, struct an30259a_pr_control)
+#define AN30259A_PR_SET_LEDS _IOW('S', 43, struct an30259a_pr_control[3])
+#define AN30259A_PR_SET_IMAX _IOW('S', 44, __u8)
+#endif /* _LEDS_AN30259A_H */
diff --git a/include/linux/leds-lp5521.h b/include/linux/leds-lp5521.h
index fd548d2..0d72c7f 100644
--- a/include/linux/leds-lp5521.h
+++ b/include/linux/leds-lp5521.h
@@ -5,6 +5,8 @@
*
* Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
*
+ * Updated: Milo(Woogyom) Kim <milo.kim@ti.com>
+ *
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* version 2 as published by the Free Software Foundation.
@@ -26,6 +28,7 @@
/* See Documentation/leds/leds-lp5521.txt */
struct lp5521_led_config {
+ char *name;
u8 chan_nr;
u8 led_current; /* mA x10, 0 if led is not connected */
u8 max_current;
@@ -35,10 +38,23 @@ struct lp5521_led_config {
#define LP5521_CLOCK_INT 1
#define LP5521_CLOCK_EXT 2
+/* Bits in CONFIG register */
+#define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */
+#define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */
+#define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */
+#define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */
+#define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */
+#define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */
+#define LP5521_R_TO_BATT 4 /* R out: 0 = CP, 1 = Vbat */
+#define LP5521_CLK_SRC_EXT 0 /* Ext-clk source (CLK_32K) */
+#define LP5521_CLK_INT 1 /* Internal clock */
+#define LP5521_CLK_AUTO 2 /* Automatic clock selection */
+
struct lp5521_platform_data {
struct lp5521_led_config *led_config;
u8 num_channels;
u8 clock_mode;
+ u8 update_config;
int (*setup_resources)(void);
void (*release_resources)(void);
void (*enable)(bool state);
diff --git a/include/linux/leds-max77693.h b/include/linux/leds-max77693.h
new file mode 100644
index 0000000..d12cf33
--- /dev/null
+++ b/include/linux/leds-max77693.h
@@ -0,0 +1,159 @@
+/*
+ * leds-max77693.h - Flash-led driver for Maxim MAX77693
+ *
+ * Copyright (C) 2011 Samsung Electronics
+ * ByungChang Cha <bc.cha@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LEDS_MAX77693_H__
+#define __LEDS_MAX77693_H__
+
+/* MAX77693_IFLASH1 */
+#define MAX77693_FLASH_IOUT1 0x3F
+
+/* MAX77693_IFLASH2 */
+#define MAX77693_FLASH_IOUT2 0x3F
+
+/* MAX77693_ITORCH */
+#define MAX77693_TORCH_IOUT1 0x0F
+#define MAX77693_TORCH_IOUT2 0xF0
+
+/* MAX77693_TORCH_TIMER */
+#define MAX77693_TORCH_TMR_DUR 0x0F
+#define MAX77693_DIS_TORCH_TMR 0x40
+#define MAX77693_TORCH_TMR_MODE 0x80
+#define MAX77693_TORCH_TMR_MODE_ONESHOT 0x00
+#define MAX77693_TORCH_TMR_MDOE_MAXTIMER 0x01
+
+/* MAX77693_FLASH_TIMER */
+#define MAX77693_FLASH_TMR_DUR 0x0F
+#define MAX77693_FLASH_TMR_MODE 0x80
+/* MAX77693_FLASH_TMR_MODE value */
+#define MAX77693_FLASH_TMR_MODE_ONESHOT 0x00
+#define MAX77693_FLASH_TMR_MDOE_MAXTIMER 0x01
+
+/* MAX77693_FLASH_EN */
+#define MAX77693_TORCH_FLED2_EN 0x03
+#define MAX77693_TORCH_FLED1_EN 0x0C
+#define MAX77693_FLASH_FLED2_EN 0x30
+#define MAX77693_FLASH_FLED1_EN 0xC0
+/* MAX77693_TORCH_FLEDx_EN value */
+#define MAX77693_TORCH_OFF 0x00
+#define MAX77693_TORCH_BY_FLASHEN 0x01
+#define MAX77693_TORCH_BY_TORCHEN 0x02
+#define MAX77693_TORCH_BY_I2C 0X03
+/* MAX77693_FLASH_FLEDx_EN value */
+#define MAX77693_FLASH_OFF 0x00
+#define MAX77693_FLASH_BY_FLASHEN 0x01
+#define MAX77693_FLASH_BY_TORCHEN 0x02
+#define MAX77693_FLASH_BY_I2C 0x03
+
+/* MAX77693_VOUT_CNTL */
+#define MAX77693_BOOST_FLASH_MODE 0x07
+#define MAX77693_BOOST_FLASH_FLEDNUM 0x80
+/* MAX77693_BOOST_FLASH_MODE vaule*/
+#define MAX77693_BOOST_FLASH_MODE_OFF 0x00
+#define MAX77693_BOOST_FLASH_MODE_FLED1 0x01
+#define MAX77693_BOOST_FLASH_MODE_FLED2 0x02
+#define MAX77693_BOOST_FLASH_MODE_BOTH 0x03
+#define MAX77693_BOOST_FLASH_MODE_FIXED 0x04
+/* MAX77693_BOOST_FLASH_FLEDNUM vaule*/
+#define MAX77693_BOOST_FLASH_FLEDNUM_1 0x00
+#define MAX77693_BOOST_FLASH_FLEDNUM_2 0x80
+
+/* MAX77693_VOUT_FLASH1 */
+#define MAX77693_BOOST_VOUT_FLASH 0x7F
+#define MAX77693_BOOST_VOUT_FLASH_FROM_VOLT(mV) \
+ ((mV) <= 3300 ? 0x00 : \
+ ((mV) <= 5500 ? (((mV) - 3300) / 25 + 0x0C) : 0x7F))
+
+#define MAX_FLASH_CURRENT 1000 /* 1000mA(0x1f) */
+#define MAX_TORCH_CURRENT 250 /* 250mA(0x0f) */
+#define MAX_FLASH_DRV_LEVEL 63 /* 15.625 + 15.625*63 mA */
+#define MAX_TORCH_DRV_LEVEL 15 /* 15.625 + 15.625*15 mA */
+
+enum max77693_led_id
+{
+ MAX77693_FLASH_LED_1,
+ MAX77693_FLASH_LED_2,
+ MAX77693_TORCH_LED_1,
+ MAX77693_TORCH_LED_2,
+ MAX77693_LED_MAX,
+};
+
+enum max77693_led_time
+{
+ MAX77693_FLASH_TIME_62P5MS,
+ MAX77693_FLASH_TIME_125MS,
+ MAX77693_FLASH_TIME_187P5MS,
+ MAX77693_FLASH_TIME_250MS,
+ MAX77693_FLASH_TIME_312P5MS,
+ MAX77693_FLASH_TIME_375MS,
+ MAX77693_FLASH_TIME_437P5MS,
+ MAX77693_FLASH_TIME_500MS,
+ MAX77693_FLASH_TIME_562P5MS,
+ MAX77693_FLASH_TIME_625MS,
+ MAX77693_FLASH_TIME_687P5MS,
+ MAX77693_FLASH_TIME_750MS,
+ MAX77693_FLASH_TIME_812P5MS,
+ MAX77693_FLASH_TIME_875MS,
+ MAX77693_FLASH_TIME_937P5MS,
+ MAX77693_FLASH_TIME_1000MS,
+ MAX77693_FLASH_TIME_MAX,
+};
+
+enum max77693_torch_time
+{
+ MAX77693_TORCH_TIME_262MS,
+ MAX77693_TORCH_TIME_524MS,
+ MAX77693_TORCH_TIME_786MS,
+ MAX77693_TORCH_TIME_1048MS,
+ MAX77693_TORCH_TIME_1572MS,
+ MAX77693_TORCH_TIME_2096MS,
+ MAX77693_TORCH_TIME_2620MS,
+ MAX77693_TORCH_TIME_3114MS,
+ MAX77693_TORCH_TIME_4193MS,
+ MAX77693_TORCH_TIME_5242MS,
+ MAX77693_TORCH_TIME_6291MS,
+ MAX77693_TORCH_TIME_7340MS,
+ MAX77693_TORCH_TIME_9437MS,
+ MAX77693_TORCH_TIME_11534MS,
+ MAX77693_TORCH_TIME_13631MS,
+ MAX77693_TORCH_TIME_15728MS,
+ MAX77693_TORCH_TIME_MAX,
+};
+
+enum max77693_timer_mode
+{
+ MAX77693_TIMER_MODE_ONE_SHOT,
+ MAX77693_TIMER_MODE_MAX_TIMER,
+};
+
+enum max77693_led_cntrl_mode
+{
+ MAX77693_LED_CTRL_BY_FLASHSTB,
+ MAX77693_LED_CTRL_BY_I2C,
+};
+
+struct max77693_led
+{
+ const char *name;
+ const char *default_trigger;
+ int id;
+ int timer;
+ int brightness;
+ enum max77693_timer_mode timer_mode;
+ enum max77693_led_cntrl_mode cntrl_mode;
+};
+
+struct max77693_led_platform_data
+{
+ int num_leds;
+ struct max77693_led leds[MAX77693_LED_MAX];
+};
+
+#endif
diff --git a/include/linux/leds-max8997.h b/include/linux/leds-max8997.h
new file mode 100644
index 0000000..6168f66
--- /dev/null
+++ b/include/linux/leds-max8997.h
@@ -0,0 +1,20 @@
+/*
+ * leds-regulator.h - platform data structure for MAX8997 LEDs.
+ *
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#ifndef __LINUX_LEDS_MAX8997_H
+#define __LINUX_LEDS_MAX8997_H
+
+struct led_max8997_platform_data {
+ char *name; /* LED name as expected by LED class */
+ unsigned int brightness; /* initial brightness value */
+};
+
+#endif /* __LINUX_LEDS_MAX8997_H */
diff --git a/include/linux/leds-spfcw043.h b/include/linux/leds-spfcw043.h
new file mode 100644
index 0000000..e550b67
--- /dev/null
+++ b/include/linux/leds-spfcw043.h
@@ -0,0 +1,63 @@
+/*
+ * leds-spfcw043.h - Flash-led driver for SPFCW043
+ *
+ * Copyright (C) 2011 Samsung Electronics
+ * DongHyun Chang <dh348.chang@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LEDS_SPFCW043_H__
+#define __LEDS_SPFCW043_H__
+
+#include <linux/platform_device.h>
+#include <linux/miscdevice.h>
+#include <linux/fs.h>
+#include <linux/delay.h>
+
+#define LED_ERROR(x, ...) printk(KERN_ERR "%s : " x, __func__, ##__VA_ARGS__)
+
+enum spfcw043_brightness {
+ TORCH_BRIGHTNESS_100 = 1,
+ TORCH_BRIGHTNESS_89,
+ TORCH_BRIGHTNESS_79,
+ TORCH_BRIGHTNESS_71,
+ TORCH_BRIGHTNESS_63,
+ TORCH_BRIGHTNESS_56,
+ TORCH_BRIGHTNESS_50,
+ TORCH_BRIGHTNESS_45,
+ TORCH_BRIGHTNESS_40,
+ TORCH_BRIGHTNESS_36,
+ TORCH_BRIGHTNESS_32,
+ TORCH_BRIGHTNESS_28,
+ TORCH_BRIGHTNESS_25,
+ TORCH_BRIGHTNESS_22,
+ TORCH_BRIGHTNESS_20,
+ TORCH_BRIGHTNESS_0,
+ TORCH_BRIGHTNESS_INVALID,
+};
+
+enum spfcw043_status {
+ STATUS_UNAVAILABLE = 0,
+ STATUS_AVAILABLE,
+ STATUS_INVALID,
+};
+
+#define IOCTL_SPFCW043 'A'
+#define IOCTL_SPFCW043_SET_BRIGHTNESS \
+ _IOW(IOCTL_SPFCW043, 0, enum spfcw043_brightness)
+#define IOCTL_SPFCW043_GET_STATUS \
+ _IOR(IOCTL_SPFCW043, 1, enum spfcw043_status)
+#define IOCTL_SPFCW043_SET_POWER _IOW(IOCTL_SPFCW043, 2, int)
+
+struct spfcw043_led_platform_data {
+ enum spfcw043_brightness brightness;
+ enum spfcw043_status status;
+ int (*setGpio) (void);
+ int (*freeGpio) (void);
+ void (*torch_en) (int onoff);
+ void (*torch_set) (int onoff);
+};
+#endif
diff --git a/include/linux/leds.h b/include/linux/leds.h
index 5884def..dcc1d70 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -24,6 +24,12 @@ struct device;
enum led_brightness {
LED_OFF = 0,
+#if defined(CONFIG_MACH_Q1_BD)
+ LED_BRIGHTNESS_LEVEL1 = 1,
+ LED_BRIGHTNESS_LEVEL2 = 2,
+ LED_BRIGHTNESS_LEVEL3 = 3,
+ LED_BRIGHTNESS_MAX_LEVEL = LED_BRIGHTNESS_LEVEL3,
+#endif
LED_HALF = 127,
LED_FULL = 255,
};
diff --git a/include/linux/mdnie.h b/include/linux/mdnie.h
new file mode 100644
index 0000000..97213da
--- /dev/null
+++ b/include/linux/mdnie.h
@@ -0,0 +1,9 @@
+#ifndef __MDNIE_H__
+#define __MDNIE__
+
+struct platform_mdnie_data {
+ unsigned int display_type;
+ struct lcd_platform_data *lcd_pd;
+};
+
+#endif
diff --git a/include/linux/melfas_touchkey.h b/include/linux/melfas_touchkey.h
new file mode 100644
index 0000000..219af68
--- /dev/null
+++ b/include/linux/melfas_touchkey.h
@@ -0,0 +1,30 @@
+//--------------------------------------------------------
+//
+//
+// Melfas MCS8000 Series Download base v1.0 2011.08.26
+//
+//
+//--------------------------------------------------------
+
+/*
+ * include/linux/melfas_ts.h - platform data structure for MCS Series sensor
+ *
+ * Copyright (C) 2010 Melfas, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_MELFAS_TS_H
+#define _LINUX_MELFAS_TS_H
+
+#define MELFAS_TS_NAME "melfas-ts"
+
+#endif /* _LINUX_MELFAS_TS_H */
diff --git a/include/linux/melfas_ts.h b/include/linux/melfas_ts.h
new file mode 100644
index 0000000..4805ce8
--- /dev/null
+++ b/include/linux/melfas_ts.h
@@ -0,0 +1,47 @@
+/*
+ * include/linux/melfas_ts.h - platform data structure for MMS Series sensor
+ *
+ * Copyright (C) 2010 Melfas, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_MELFAS_TS_H
+#define _LINUX_MELFAS_TS_H
+
+#define MELFAS_TS_NAME "melfas-ts"
+
+struct melfas_tsi_platform_data {
+ int x_size;
+ int y_size;
+ int version;
+ int gpio_int;
+ int (*power)(int on);
+
+ void (*input_event)(void *data);
+
+ bool mt_protocol_b;
+ bool enable_btn_touch;
+
+ void (*set_touch_i2c)(void);
+ void (*set_touch_i2c_to_gpio)(void);
+
+#ifdef CONFIG_INPUT_FBSUSPEND
+ struct notifier_block fb_notif;
+#endif
+
+#if defined(CONFIG_MACH_C1CTC) || defined(CONFIG_MACH_M0_CHNOPEN) ||\
+ defined(CONFIG_MACH_M0_CMCC) || defined(CONFIG_MACH_M0_CTC)
+ int (*lcd_type)(void);
+#endif
+};
+
+#endif /* _LINUX_MELFAS_TS_H */
diff --git a/include/linux/mfd/max77686-private.h b/include/linux/mfd/max77686-private.h
new file mode 100644
index 0000000..17273d5
--- /dev/null
+++ b/include/linux/mfd/max77686-private.h
@@ -0,0 +1,259 @@
+/*
+ * max77686.h - Voltage regulator driver for the Maxim 77686
+ *
+ * Copyright (C) 2011 Samsung Electrnoics
+ * Chiwoong Byun <woong.byun@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __LINUX_MFD_MAX77686_PRIV_H
+#define __LINUX_MFD_MAX77686_PRIV_H
+
+#include <linux/i2c.h>
+
+#define MAX77686_REG_INVALID (0xff)
+
+enum max77686_pmic_reg {
+ MAX77686_REG_DEVICE_ID = 0x00,
+ MAX77686_REG_INTSRC = 0x01,
+ MAX77686_REG_INT1 = 0x02,
+ MAX77686_REG_INT2 = 0x03,
+
+ MAX77686_REG_INT1MSK = 0x04,
+ MAX77686_REG_INT2MSK = 0x05,
+
+ MAX77686_REG_STATUS1 = 0x06,
+ MAX77686_REG_STATUS2 = 0x07,
+
+ MAX77686_REG_PWRON = 0x08,
+ MAX77686_REG_ONOFF_DELAY = 0x09,
+ MAX77686_REG_MRSTB = 0x0A,
+ /* Reserved: 0x0B-0x0F */
+
+ MAX77686_REG_BUCK1CTRL = 0x10,
+ MAX77686_REG_BUCK1OUT = 0x11,
+ MAX77686_REG_BUCK2CTRL1 = 0x12,
+ MAX77686_REG_BUCK234FREQ = 0x13,
+ MAX77686_REG_BUCK2DVS1 = 0x14,
+ MAX77686_REG_BUCK2DVS2 = 0x15,
+ MAX77686_REG_BUCK2DVS3 = 0x16,
+ MAX77686_REG_BUCK2DVS4 = 0x17,
+ MAX77686_REG_BUCK2DVS5 = 0x18,
+ MAX77686_REG_BUCK2DVS6 = 0x19,
+ MAX77686_REG_BUCK2DVS7 = 0x1A,
+ MAX77686_REG_BUCK2DVS8 = 0x1B,
+ MAX77686_REG_BUCK3CTRL1 = 0x1C,
+ /* Reserved: 0x1D */
+ MAX77686_REG_BUCK3DVS1 = 0x1E,
+ MAX77686_REG_BUCK3DVS2 = 0x1F,
+ MAX77686_REG_BUCK3DVS3 = 0x20,
+ MAX77686_REG_BUCK3DVS4 = 0x21,
+ MAX77686_REG_BUCK3DVS5 = 0x22,
+ MAX77686_REG_BUCK3DVS6 = 0x23,
+ MAX77686_REG_BUCK3DVS7 = 0x24,
+ MAX77686_REG_BUCK3DVS8 = 0x25,
+ MAX77686_REG_BUCK4CTRL1 = 0x26,
+ /* Reserved: 0x27 */
+ MAX77686_REG_BUCK4DVS1 = 0x28,
+ MAX77686_REG_BUCK4DVS2 = 0x29,
+ MAX77686_REG_BUCK4DVS3 = 0x2A,
+ MAX77686_REG_BUCK4DVS4 = 0x2B,
+ MAX77686_REG_BUCK4DVS5 = 0x2C,
+ MAX77686_REG_BUCK4DVS6 = 0x2D,
+ MAX77686_REG_BUCK4DVS7 = 0x2E,
+ MAX77686_REG_BUCK4DVS8 = 0x2F,
+ MAX77686_REG_BUCK5CTRL = 0x30,
+ MAX77686_REG_BUCK5OUT = 0x31,
+ MAX77686_REG_BUCK6CTRL = 0x32,
+ MAX77686_REG_BUCK6OUT = 0x33,
+ MAX77686_REG_BUCK7CTRL = 0x34,
+ MAX77686_REG_BUCK7OUT = 0x35,
+ MAX77686_REG_BUCK8CTRL = 0x36,
+ MAX77686_REG_BUCK8OUT = 0x37,
+ MAX77686_REG_BUCK9CTRL = 0x38,
+ MAX77686_REG_BUCK9OUT = 0x39,
+ /* Reserved: 0x3A-0x3F */
+
+ MAX77686_REG_LDO1CTRL1 = 0x40,
+ MAX77686_REG_LDO2CTRL1 = 0x41,
+ MAX77686_REG_LDO3CTRL1 = 0x42,
+ MAX77686_REG_LDO4CTRL1 = 0x43,
+ MAX77686_REG_LDO5CTRL1 = 0x44,
+ MAX77686_REG_LDO6CTRL1 = 0x45,
+ MAX77686_REG_LDO7CTRL1 = 0x46,
+ MAX77686_REG_LDO8CTRL1 = 0x47,
+ MAX77686_REG_LDO9CTRL1 = 0x48,
+ MAX77686_REG_LDO10CTRL1 = 0x49,
+ MAX77686_REG_LDO11CTRL1 = 0x4A,
+ MAX77686_REG_LDO12CTRL1 = 0x4B,
+ MAX77686_REG_LDO13CTRL1 = 0x4C,
+ MAX77686_REG_LDO14CTRL1 = 0x4D,
+ MAX77686_REG_LDO15CTRL1 = 0x4E,
+ MAX77686_REG_LDO16CTRL1 = 0x4F,
+ MAX77686_REG_LDO17CTRL1 = 0x50,
+ MAX77686_REG_LDO18CTRL1 = 0x51,
+ MAX77686_REG_LDO19CTRL1 = 0x52,
+ MAX77686_REG_LDO20CTRL1 = 0x53,
+ MAX77686_REG_LDO21CTRL1 = 0x54,
+ MAX77686_REG_LDO22CTRL1 = 0x55,
+ MAX77686_REG_LDO23CTRL1 = 0x56,
+ MAX77686_REG_LDO24CTRL1 = 0x57,
+ MAX77686_REG_LDO25CTRL1 = 0x58,
+ MAX77686_REG_LDO26CTRL1 = 0x59,
+ /* Reserved: 0x5A-0x5F */
+ MAX77686_REG_LDO1CTRL2 = 0x60,
+ MAX77686_REG_LDO2CTRL2 = 0x61,
+ MAX77686_REG_LDO3CTRL2 = 0x62,
+ MAX77686_REG_LDO4CTRL2 = 0x63,
+ MAX77686_REG_LDO5CTRL2 = 0x64,
+ MAX77686_REG_LDO6CTRL2 = 0x65,
+ MAX77686_REG_LDO7CTRL2 = 0x66,
+ MAX77686_REG_LDO8CTRL2 = 0x67,
+ MAX77686_REG_LDO9CTRL2 = 0x68,
+ MAX77686_REG_LDO10CTRL2 = 0x69,
+ MAX77686_REG_LDO11CTRL2 = 0x6A,
+ MAX77686_REG_LDO12CTRL2 = 0x6B,
+ MAX77686_REG_LDO13CTRL2 = 0x6C,
+ MAX77686_REG_LDO14CTRL2 = 0x6D,
+ MAX77686_REG_LDO15CTRL2 = 0x6E,
+ MAX77686_REG_LDO16CTRL2 = 0x6F,
+ MAX77686_REG_LDO17CTRL2 = 0x70,
+ MAX77686_REG_LDO18CTRL2 = 0x71,
+ MAX77686_REG_LDO19CTRL2 = 0x72,
+ MAX77686_REG_LDO20CTRL2 = 0x73,
+ MAX77686_REG_LDO21CTRL2 = 0x74,
+ MAX77686_REG_LDO22CTRL2 = 0x75,
+ MAX77686_REG_LDO23CTRL2 = 0x76,
+ MAX77686_REG_LDO24CTRL2 = 0x77,
+ MAX77686_REG_LDO25CTRL2 = 0x78,
+ MAX77686_REG_LDO26CTRL2 = 0x79,
+ /* Reserved: 0x7A-0x7D */
+
+ MAX77686_REG_BBAT_CHG = 0x7E,
+ MAX77686_REG_32KHZ = 0x7F,
+
+ MAX77686_REG_PMIC_END = 0x80,
+};
+
+enum max77686_rtc_reg {
+ MAX77686_RTC_INT = 0x00,
+ MAX77686_RTC_INTM = 0x01,
+ MAX77686_RTC_CONTROLM = 0x02,
+ MAX77686_RTC_CONTROL = 0x03,
+ MAX77686_RTC_UPDATE0 = 0x04,
+ /* Reserved: 0x5 */
+ MAX77686_WTSR_SMPL_CNTL = 0x06,
+ MAX77686_RTC_SEC = 0x07,
+ MAX77686_RTC_MIN = 0x08,
+ MAX77686_RTC_HOUR = 0x09,
+ MAX77686_RTC_WEEKDAY = 0x0A,
+ MAX77686_RTC_MONTH = 0x0B,
+ MAX77686_RTC_YEAR = 0x0C,
+ MAX77686_RTC_DATE = 0x0D,
+ MAX77686_ALARM1_SEC = 0x0E,
+ MAX77686_ALARM1_MIN = 0x0F,
+ MAX77686_ALARM1_HOUR = 0x10,
+ MAX77686_ALARM1_WEEKDAY = 0x11,
+ MAX77686_ALARM1_MONTH = 0x12,
+ MAX77686_ALARM1_YEAR = 0x13,
+ MAX77686_ALARM1_DATE = 0x14,
+ MAX77686_ALARM2_SEC = 0x15,
+ MAX77686_ALARM2_MIN = 0x16,
+ MAX77686_ALARM2_HOUR = 0x17,
+ MAX77686_ALARM2_WEEKDAY = 0x18,
+ MAX77686_ALARM2_MONTH = 0x19,
+ MAX77686_ALARM2_YEAR = 0x1A,
+ MAX77686_ALARM2_DATE = 0x1B,
+};
+
+#define MAX77686_IRQSRC_PMIC (0)
+#define MAX77686_IRQSRC_RTC (1 << 0)
+
+#define MAX77686_REG_RAMP_RATE_100MV (0x3<<6)
+#define MAX77686_REG_RAMP_RATE_55MV (0x2<<6)
+#define MAX77686_REG_RAMP_RATE_27MV (0x1<<6)
+#define MAX77686_REG_RAMP_RATE_13MV (0x0<<6)
+
+enum max77686_irq_source {
+ PMIC_INT1 = 0,
+ PMIC_INT2,
+ RTC_INT,
+
+ MAX77686_IRQ_GROUP_NR,
+};
+
+enum max77686_irq {
+ MAX77686_PMICIRQ_PWRONF,
+ MAX77686_PMICIRQ_PWRONR,
+ MAX77686_PMICIRQ_JIGONBF,
+ MAX77686_PMICIRQ_JIGONBR,
+ MAX77686_PMICIRQ_ACOKBF,
+ MAX77686_PMICIRQ_ACOKBR,
+ MAX77686_PMICIRQ_ONKEY1S,
+ MAX77686_PMICIRQ_MRSTB,
+
+ MAX77686_PMICIRQ_140C,
+ MAX77686_PMICIRQ_120C,
+
+ MAX77686_RTCIRQ_RTC60S,
+ MAX77686_RTCIRQ_RTCA1,
+ MAX77686_RTCIRQ_RTCA2,
+ MAX77686_RTCIRQ_SMPL,
+ MAX77686_RTCIRQ_RTC1S,
+ MAX77686_RTCIRQ_WTSR,
+
+ MAX77686_IRQ_NR,
+};
+
+struct max77686_dev {
+ struct device *dev;
+ struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */
+ struct i2c_client *rtc; /* slave addr 0x0c */
+ struct mutex iolock;
+
+ int type;
+
+ int irq;
+ int irq_gpio;
+ int irq_base;
+ bool wakeup;
+ struct mutex irqlock;
+ int irq_masks_cur[MAX77686_IRQ_GROUP_NR];
+ int irq_masks_cache[MAX77686_IRQ_GROUP_NR];
+ int wtsr_smpl;
+
+#ifdef CONFIG_HIBERNATION
+ u8 reg_dump[MAX77686_REG_PMIC_END];
+#endif
+};
+
+enum max77686_types {
+ TYPE_MAX77686,
+};
+
+extern int max77686_irq_init(struct max77686_dev *max77686);
+extern void max77686_irq_exit(struct max77686_dev *max77686);
+extern int max77686_irq_resume(struct max77686_dev *max77686);
+
+extern int max77686_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest);
+extern int max77686_bulk_read(struct i2c_client *i2c, u8 reg, int count,
+ u8 *buf);
+extern int max77686_write_reg(struct i2c_client *i2c, u8 reg, u8 value);
+extern int max77686_bulk_write(struct i2c_client *i2c, u8 reg, int count,
+ u8 *buf);
+extern int max77686_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask);
+
+#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 0000000..d6ddb93
--- /dev/null
+++ b/include/linux/mfd/max77686.h
@@ -0,0 +1,136 @@
+/*
+ * max77686.h - Driver for the Maxim 77686
+ *
+ * Copyright (C) 2011 Samsung Electrnoics
+ * Chiwoong Byun <woong.byun@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * This driver is based on max8997.h
+ *
+ * MAX77686 has PMIC, RTC devices.
+ * The devices share the same I2C bus and included in
+ * this mfd driver.
+ */
+
+#ifndef __LINUX_MFD_MAX77686_H
+#define __LINUX_MFD_MAX77686_H
+
+#include <linux/regulator/consumer.h>
+
+#define MAX77686_SMPL_ENABLE (0x1)
+#define MAX77686_WTSR_ENABLE (0x2)
+
+/* MAX77686 regulator IDs */
+enum max77686_regulators {
+ MAX77686_LDO1 = 0,
+ MAX77686_LDO2,
+ MAX77686_LDO3,
+ MAX77686_LDO4,
+ MAX77686_LDO5,
+ MAX77686_LDO6,
+ MAX77686_LDO7,
+ MAX77686_LDO8,
+ MAX77686_LDO9,
+ MAX77686_LDO10,
+ MAX77686_LDO11,
+ MAX77686_LDO12,
+ MAX77686_LDO13,
+ MAX77686_LDO14,
+ MAX77686_LDO15,
+ MAX77686_LDO16,
+ MAX77686_LDO17,
+ MAX77686_LDO18,
+ MAX77686_LDO19,
+ MAX77686_LDO20,
+ MAX77686_LDO21,
+ MAX77686_LDO22,
+ MAX77686_LDO23,
+ MAX77686_LDO24,
+ MAX77686_LDO25,
+ MAX77686_LDO26,
+ MAX77686_BUCK1,
+ MAX77686_BUCK2,
+ MAX77686_BUCK3,
+ MAX77686_BUCK4,
+ MAX77686_BUCK5,
+ MAX77686_BUCK6,
+ MAX77686_BUCK7,
+ MAX77686_BUCK8,
+ MAX77686_BUCK9,
+ MAX77686_EN32KHZ_AP,
+ MAX77686_EN32KHZ_CP,
+ MAX77686_P32KH,
+
+ MAX77686_REG_MAX,
+};
+
+struct max77686_regulator_data {
+ int id;
+ struct regulator_init_data *initdata;
+};
+
+enum max77686_opmode {
+ MAX77686_OPMODE_NORMAL,
+ MAX77686_OPMODE_LP,
+ MAX77686_OPMODE_STANDBY,
+};
+
+enum max77686_ramp_rate {
+ MAX77686_RAMP_RATE_100MV,
+ MAX77686_RAMP_RATE_13MV,
+ MAX77686_RAMP_RATE_27MV,
+ MAX77686_RAMP_RATE_55MV,
+};
+
+struct max77686_opmode_data {
+ int id;
+ int mode;
+};
+
+struct max77686_buck234_gpio_data {
+ int gpio;
+ int data;
+};
+
+struct max77686_platform_data {
+ /* IRQ */
+ int irq_gpio;
+ int irq_base;
+ int ono;
+ int wakeup;
+
+ /* ---- PMIC ---- */
+ struct max77686_regulator_data *regulators;
+ int num_regulators;
+ int has_full_constraints;
+
+ struct max77686_opmode_data *opmode_data;
+ int ramp_rate;
+ int wtsr_smpl;
+
+ /*
+ * GPIO-DVS feature is not enabled with the current version of
+ * MAX77686 driver. Buck2/3/4_voltages[0] is used as the default
+ * voltage at probe. DVS/SELB gpios are set as OUTPUT-LOW.
+ */
+ struct max77686_buck234_gpio_data buck234_gpio_dvs[3]; /* GPIO of [0]DVS1, [1]DVS2, [2]DVS3 */
+ int buck234_gpio_selb[3]; /* [0]SELB2, [1]SELB3, [2]SELB4 */
+ unsigned int buck2_voltage[8]; /* buckx_voltage in uV */
+ unsigned int buck3_voltage[8];
+ unsigned int buck4_voltage[8];
+};
+
+#endif /* __LINUX_MFD_MAX77686_H */
diff --git a/include/linux/mfd/max77693-private.h b/include/linux/mfd/max77693-private.h
new file mode 100644
index 0000000..ff0b1a2
--- /dev/null
+++ b/include/linux/mfd/max77693-private.h
@@ -0,0 +1,406 @@
+/*
+ * max77693-private.h - Voltage regulator driver for the Maxim 77693
+ *
+ * Copyright (C) 2011 Samsung Electrnoics
+ * SangYoung Son <hello.son@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __LINUX_MFD_MAX77693_PRIV_H
+#define __LINUX_MFD_MAX77693_PRIV_H
+
+#include <linux/i2c.h>
+
+#define MAX77693_NUM_IRQ_MUIC_REGS 3
+#define MAX77693_REG_INVALID (0xff)
+
+#define MAX77693_IRQSRC_CHG (1 << 0)
+#define MAX77693_IRQSRC_TOP (1 << 1)
+#define MAX77693_IRQSRC_FLASH (1 << 2)
+#define MAX77693_IRQSRC_MUIC (1 << 3)
+
+/* pmic revision */
+enum max77693_pmic_rev {
+ MAX77693_REV_PASS1 = 0x00,
+ MAX77693_REV_PASS2 = 0x01,
+ MAX77693_REV_PASS3 = 0x02,
+};
+
+/* Slave addr = 0xCC: Charger, Flash LED, Haptic */
+enum max77693_pmic_reg {
+ MAX77693_LED_REG_IFLASH1 = 0x00,
+ MAX77693_LED_REG_IFLASH2 = 0x01,
+ MAX77693_LED_REG_ITORCH = 0x02,
+ MAX77693_LED_REG_ITORCHTORCHTIMER = 0x03,
+ MAX77693_LED_REG_FLASH_TIMER = 0x04,
+ MAX77693_LED_REG_FLASH_EN = 0x05,
+ MAX77693_LED_REG_MAX_FLASH1 = 0x06,
+ MAX77693_LED_REG_MAX_FLASH2 = 0x07,
+ MAX77693_LED_REG_MAX_FLASH3 = 0x08,
+ MAX77693_LED_REG_MAX_FLASH4 = 0x09,
+ MAX77693_LED_REG_VOUT_CNTL = 0x0A,
+ MAX77693_LED_REG_VOUT_FLASH1 = 0x0B,
+ MAX77693_LED_REG_VOUT_FLASH2 = 0x0C,
+ MAX77693_LED_REG_RESERVED_0D = 0x0D,
+ MAX77693_LED_REG_FLASH_INT = 0x0E,
+ MAX77693_LED_REG_FLASH_INT_MASK = 0x0F,
+ MAX77693_LED_REG_FLASH_INT_STATUS = 0x10,
+ MAX77693_LED_REG_RESERVED_11 = 0x11,
+
+ MAX77693_PMIC_REG_PMIC_ID1 = 0x20,
+ MAX77693_PMIC_REG_PMIC_ID2 = 0x21,
+ MAX77693_PMIC_REG_INTSRC = 0x22,
+ MAX77693_PMIC_REG_INTSRC_MASK = 0x23,
+ MAX77693_PMIC_REG_TOPSYS_INT = 0x24,
+ MAX77693_PMIC_REG_RESERVED_25 = 0x25,
+ MAX77693_PMIC_REG_TOPSYS_INT_MASK = 0x26,
+ MAX77693_PMIC_REG_RESERVED_27 = 0x27,
+ MAX77693_PMIC_REG_TOPSYS_STAT = 0x28,
+ MAX77693_PMIC_REG_RESERVED_29 = 0x29,
+ MAX77693_PMIC_REG_MAINCTRL1 = 0x2A,
+ MAX77693_PMIC_REG_LSCNFG = 0x2B,
+ MAX77693_PMIC_REG_RESERVED_2C = 0x2C,
+ MAX77693_PMIC_REG_RESERVED_2D = 0x2D,
+
+ MAX77693_CHG_REG_CHG_INT = 0xB0,
+ MAX77693_CHG_REG_CHG_INT_MASK = 0xB1,
+ MAX77693_CHG_REG_CHG_INT_OK = 0xB2,
+ MAX77693_CHG_REG_CHG_DTLS_00 = 0xB3,
+ MAX77693_CHG_REG_CHG_DTLS_01 = 0xB4,
+ MAX77693_CHG_REG_CHG_DTLS_02 = 0xB5,
+ MAX77693_CHG_REG_CHG_DTLS_03 = 0xB6,
+ MAX77693_CHG_REG_CHG_CNFG_00 = 0xB7,
+ MAX77693_CHG_REG_CHG_CNFG_01 = 0xB8,
+ MAX77693_CHG_REG_CHG_CNFG_02 = 0xB9,
+ MAX77693_CHG_REG_CHG_CNFG_03 = 0xBA,
+ MAX77693_CHG_REG_CHG_CNFG_04 = 0xBB,
+ MAX77693_CHG_REG_CHG_CNFG_05 = 0xBC,
+ MAX77693_CHG_REG_CHG_CNFG_06 = 0xBD,
+ MAX77693_CHG_REG_CHG_CNFG_07 = 0xBE,
+ MAX77693_CHG_REG_CHG_CNFG_08 = 0xBF,
+ MAX77693_CHG_REG_CHG_CNFG_09 = 0xC0,
+ MAX77693_CHG_REG_CHG_CNFG_10 = 0xC1,
+ MAX77693_CHG_REG_CHG_CNFG_11 = 0xC2,
+ MAX77693_CHG_REG_CHG_CNFG_12 = 0xC3,
+ MAX77693_CHG_REG_CHG_CNFG_13 = 0xC4,
+ MAX77693_CHG_REG_CHG_CNFG_14 = 0xC5,
+ MAX77693_CHG_REG_SAFEOUT_CTRL = 0xC6,
+
+ MAX77693_PMIC_REG_END,
+};
+
+/* Slave addr = 0x4A: MUIC */
+enum max77693_muic_reg {
+ MAX77693_MUIC_REG_ID = 0x00,
+ MAX77693_MUIC_REG_INT1 = 0x01,
+ MAX77693_MUIC_REG_INT2 = 0x02,
+ MAX77693_MUIC_REG_INT3 = 0x03,
+ MAX77693_MUIC_REG_STATUS1 = 0x04,
+ MAX77693_MUIC_REG_STATUS2 = 0x05,
+ MAX77693_MUIC_REG_STATUS3 = 0x06,
+ MAX77693_MUIC_REG_INTMASK1 = 0x07,
+ MAX77693_MUIC_REG_INTMASK2 = 0x08,
+ MAX77693_MUIC_REG_INTMASK3 = 0x09,
+ MAX77693_MUIC_REG_CDETCTRL1 = 0x0A,
+ MAX77693_MUIC_REG_CDETCTRL2 = 0x0B,
+ MAX77693_MUIC_REG_CTRL1 = 0x0C,
+ MAX77693_MUIC_REG_CTRL2 = 0x0D,
+ MAX77693_MUIC_REG_CTRL3 = 0x0E,
+
+ MAX77693_MUIC_REG_END,
+};
+
+/* Slave addr = 0x90: Haptic */
+enum max77693_haptic_reg {
+ MAX77693_HAPTIC_REG_STATUS = 0x00,
+ MAX77693_HAPTIC_REG_CONFIG1 = 0x01,
+ MAX77693_HAPTIC_REG_CONFIG2 = 0x02,
+ MAX77693_HAPTIC_REG_CONFIG_CHNL = 0x03,
+ MAX77693_HAPTIC_REG_CONFG_CYC1 = 0x04,
+ MAX77693_HAPTIC_REG_CONFG_CYC2 = 0x05,
+ MAX77693_HAPTIC_REG_CONFIG_PER1 = 0x06,
+ MAX77693_HAPTIC_REG_CONFIG_PER2 = 0x07,
+ MAX77693_HAPTIC_REG_CONFIG_PER3 = 0x08,
+ MAX77693_HAPTIC_REG_CONFIG_PER4 = 0x09,
+ MAX77693_HAPTIC_REG_CONFIG_DUTY1 = 0x0A,
+ MAX77693_HAPTIC_REG_CONFIG_DUTY2 = 0x0B,
+ MAX77693_HAPTIC_REG_CONFIG_PWM1 = 0x0C,
+ MAX77693_HAPTIC_REG_CONFIG_PWM2 = 0x0D,
+ MAX77693_HAPTIC_REG_CONFIG_PWM3 = 0x0E,
+ MAX77693_HAPTIC_REG_CONFIG_PWM4 = 0x0F,
+ MAX77693_HAPTIC_REG_REV = 0x10,
+
+ MAX77693_HAPTIC_REG_END,
+};
+
+/* MAX77693 REGISTER ENABLE or DISABLE bit */
+#define MAX77693_ENABLE_BIT 1
+#define MAX77693_DISABLE_BIT 0
+
+/* MAX77693 CHG_CNFG_00 register */
+#define CHG_CNFG_00_MODE_SHIFT 0
+#define CHG_CNFG_00_CHG_SHIFT 0
+#define CHG_CNFG_00_OTG_SHIFT 1
+#define CHG_CNFG_00_BUCK_SHIFT 2
+#define CHG_CNFG_00_BOOST_SHIFT 3
+#define CHG_CNFG_00_DIS_MUIC_CTRL_SHIFT 5
+#define CHG_CNFG_00_MODE_MASK (0xf << CHG_CNFG_00_MODE_SHIFT)
+#define CHG_CNFG_00_CHG_MASK (1 << CHG_CNFG_00_CHG_SHIFT)
+#define CHG_CNFG_00_OTG_MASK (1 << CHG_CNFG_00_OTG_SHIFT)
+#define CHG_CNFG_00_BUCK_MASK (1 << CHG_CNFG_00_BUCK_SHIFT)
+#define CHG_CNFG_00_BOOST_MASK (1 << CHG_CNFG_00_BOOST_SHIFT)
+#define CHG_CNFG_00_DIS_MUIC_CTRL_MASK (1 << CHG_CNFG_00_DIS_MUIC_CTRL_SHIFT)
+
+/* MAX77693 STATUS1 register */
+#define STATUS1_ADC_SHIFT 0
+#define STATUS1_ADCLOW_SHIFT 5
+#define STATUS1_ADCERR_SHIFT 6
+#define STATUS1_ADC1K_SHIFT 7
+#define STATUS1_ADC_MASK (0x1f << STATUS1_ADC_SHIFT)
+#define STATUS1_ADCLOW_MASK (0x1 << STATUS1_ADCLOW_SHIFT)
+#define STATUS1_ADCERR_MASK (0x1 << STATUS1_ADCERR_SHIFT)
+#define STATUS1_ADC1K_MASK (0x1 << STATUS1_ADC1K_SHIFT)
+
+/* MAX77693 STATUS2 register */
+#define STATUS2_CHGTYP_SHIFT 0
+#define STATUS2_CHGDETRUN_SHIFT 3
+#define STATUS2_VBVOLT_SHIFT 6
+#define STATUS2_CHGTYP_MASK (0x7 << STATUS2_CHGTYP_SHIFT)
+#define STATUS2_CHGDETRUN_MASK (0x1 << STATUS2_CHGDETRUN_SHIFT)
+#define STATUS2_VBVOLT_MASK (0x1 << STATUS2_VBVOLT_SHIFT)
+
+/* MAX77693 CDETCTRL1 register */
+#define CHGDETEN_SHIFT 0
+#define CHGTYPM_SHIFT 1
+#define CHGDETEN_MASK (0x1 << CHGDETEN_SHIFT)
+#define CHGTYPM_MASK (0x1 << CHGTYPM_SHIFT)
+
+/* MAX77693 CONTROL1 register */
+#define CLEAR_IDBEN_MICEN_MASK 0x3f
+#define COMN1SW_SHIFT 0x0
+#define COMP2SW_SHIFT 0x3
+#define MICEN_SHIFT 0x6
+#define COMN1SW_MASK (0x7 << COMN1SW_SHIFT)
+#define COMP2SW_MASK (0x7 << COMP2SW_SHIFT)
+#define MICEN_MASK (0x1 << MICEN_SHIFT)
+
+/* MAX77693 CONTROL2 register */
+#define CTRL2_ACCDET_SHIFT 5
+#define CTRL2_ACCDET_MASK (0x1 << CTRL2_ACCDET_SHIFT)
+#define CTRL2_CPEn_SHIFT 2
+#define CTRL2_CPEn_MASK (0x1 << CTRL2_CPEn_SHIFT)
+#define CTRL2_LOWPWD_SHIFT 0
+#define CTRL2_LOWPWD_MASK (0x1 << CTRL2_LOWPWD_SHIFT)
+#define CTRL2_CPEn1_LOWPWD0 ((MAX77693_ENABLE_BIT << CTRL2_CPEn_SHIFT) | \
+ (MAX77693_DISABLE_BIT << CTRL2_LOWPWD_SHIFT))
+#define CTRL2_CPEn0_LOWPWD1 ((MAX77693_DISABLE_BIT << CTRL2_CPEn_SHIFT) | \
+ (MAX77693_ENABLE_BIT << CTRL2_LOWPWD_SHIFT))
+
+/* MAX77693 CONTROL3 register */
+#define CTRL3_JIGSET_SHIFT 0
+#define CTRL3_BOOTSET_SHIFT 2
+#define CTRL3_ADCDBSET_SHIFT 4
+#define CTRL3_JIGSET_MASK (0x3 << CTRL3_JIGSET_SHIFT)
+#define CTRL3_BOOTSET_MASK (0x3 << CTRL3_BOOTSET_SHIFT)
+#define CTRL3_ADCDBSET_MASK (0x3 << CTRL3_ADCDBSET_SHIFT)
+
+/* Interrupt 1 */
+#define INT_DETACH (0x1 << 1)
+#define INT_ATTACH (0x1 << 0)
+
+/* muic register value for COMN1, COMN2 in CTRL1 reg */
+enum max77693_reg_ctrl1_val {
+ MAX77693_MUIC_CTRL1_BIN_0_000 = 0x00,
+ MAX77693_MUIC_CTRL1_BIN_1_001 = 0x01,
+ MAX77693_MUIC_CTRL1_BIN_2_010 = 0x02,
+ MAX77693_MUIC_CTRL1_BIN_3_011 = 0x03,
+ MAX77693_MUIC_CTRL1_BIN_4_100 = 0x04,
+ MAX77693_MUIC_CTRL1_BIN_5_101 = 0x05,
+ MAX77693_MUIC_CTRL1_BIN_6_110 = 0x06,
+ MAX77693_MUIC_CTRL1_BIN_7_111 = 0x07,
+};
+
+enum max77693_switch_sel_val {
+ MAX77693_SWITCH_SEL_1st_BIT_USB = 0x1 << 0,
+ MAX77693_SWITCH_SEL_2nd_BIT_UART = 0x1 << 1,
+#ifdef CONFIG_LTE_VIA_SWITCH
+ MAX77693_SWITCH_SEL_3rd_BIT_LTE_UART = 0x1 << 2,
+#endif
+};
+
+enum max77693_reg_ctrl1_type {
+ CTRL1_AP_USB =
+ (MAX77693_MUIC_CTRL1_BIN_1_001 << COMP2SW_SHIFT)
+ | MAX77693_MUIC_CTRL1_BIN_1_001 ,
+ CTRL1_AUDIO =
+ (MAX77693_MUIC_CTRL1_BIN_2_010 << COMP2SW_SHIFT)
+ | MAX77693_MUIC_CTRL1_BIN_2_010 ,
+ CTRL1_CP_USB =
+ (MAX77693_MUIC_CTRL1_BIN_4_100 << COMP2SW_SHIFT)
+ | MAX77693_MUIC_CTRL1_BIN_4_100 ,
+ CTRL1_AP_UART =
+ (MAX77693_MUIC_CTRL1_BIN_3_011 << COMP2SW_SHIFT)
+ | MAX77693_MUIC_CTRL1_BIN_3_011 ,
+ CTRL1_CP_UART =
+ (MAX77693_MUIC_CTRL1_BIN_5_101 << COMP2SW_SHIFT)
+ | MAX77693_MUIC_CTRL1_BIN_5_101 ,
+};
+/*TODO must modify H/W rev.5*/
+
+enum max77693_irq_source {
+ LED_INT = 0,
+ TOPSYS_INT,
+ CHG_INT,
+ MUIC_INT1,
+ MUIC_INT2,
+ MUIC_INT3,
+
+ MAX77693_IRQ_GROUP_NR,
+};
+
+enum max77693_irq {
+ /* PMIC; FLASH */
+ MAX77693_LED_IRQ_FLED2_OPEN,
+ MAX77693_LED_IRQ_FLED2_SHORT,
+ MAX77693_LED_IRQ_FLED1_OPEN,
+ MAX77693_LED_IRQ_FLED1_SHORT,
+ MAX77693_LED_IRQ_MAX_FLASH,
+
+ /* PMIC; TOPSYS */
+ MAX77693_TOPSYS_IRQ_T120C_INT,
+ MAX77693_TOPSYS_IRQ_T140C_INT,
+ MAX77693_TOPSYS_IRQLOWSYS_INT,
+
+ /* PMIC; Charger */
+ MAX77693_CHG_IRQ_BYP_I,
+ MAX77693_CHG_IRQ_THM_I,
+ MAX77693_CHG_IRQ_BAT_I,
+ MAX77693_CHG_IRQ_CHG_I,
+ MAX77693_CHG_IRQ_CHGIN_I,
+
+ /* MUIC INT1 */
+ MAX77693_MUIC_IRQ_INT1_ADC,
+ MAX77693_MUIC_IRQ_INT1_ADCLOW,
+ MAX77693_MUIC_IRQ_INT1_ADCERR,
+ MAX77693_MUIC_IRQ_INT1_ADC1K,
+
+ /* MUIC INT2 */
+ MAX77693_MUIC_IRQ_INT2_CHGTYP,
+ MAX77693_MUIC_IRQ_INT2_CHGDETREUN,
+ MAX77693_MUIC_IRQ_INT2_DCDTMR,
+ MAX77693_MUIC_IRQ_INT2_DXOVP,
+ MAX77693_MUIC_IRQ_INT2_VBVOLT,
+ MAX77693_MUIC_IRQ_INT2_VIDRM,
+
+ /* MUIC INT3 */
+ MAX77693_MUIC_IRQ_INT3_EOC,
+ MAX77693_MUIC_IRQ_INT3_CGMBC,
+ MAX77693_MUIC_IRQ_INT3_OVP,
+ MAX77693_MUIC_IRQ_INT3_MBCCHGERR,
+ MAX77693_MUIC_IRQ_INT3_CHGENABLED,
+ MAX77693_MUIC_IRQ_INT3_BATDET,
+
+ MAX77693_IRQ_NR,
+};
+
+struct max77693_dev {
+ struct device *dev;
+ struct i2c_client *i2c; /* 0xCC; Charger, Flash LED */
+ struct i2c_client *muic; /* 0x4A; MUIC */
+ struct i2c_client *haptic; /* 0x90; Haptic */
+ struct mutex iolock;
+
+ int type;
+
+ int irq;
+ int irq_base;
+ int irq_gpio;
+ bool wakeup;
+ struct mutex irqlock;
+ int irq_masks_cur[MAX77693_IRQ_GROUP_NR];
+ int irq_masks_cache[MAX77693_IRQ_GROUP_NR];
+
+#ifdef CONFIG_HIBERNATION
+ /* For hibernation */
+ u8 reg_pmic_dump[MAX77693_PMIC_REG_END];
+ u8 reg_muic_dump[MAX77693_MUIC_REG_END];
+ u8 reg_haptic_dump[MAX77693_HAPTIC_REG_END];
+#endif
+
+ /* pmic revision */
+ u8 pmic_rev; /* REV */
+ u8 pmic_ver; /* VERSION */
+};
+
+enum max77693_types {
+ TYPE_MAX77693,
+};
+
+extern struct device *switch_dev;
+extern int max77693_irq_init(struct max77693_dev *max77693);
+extern void max77693_irq_exit(struct max77693_dev *max77693);
+extern int max77693_irq_resume(struct max77693_dev *max77693);
+
+extern int max77693_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest);
+extern int max77693_bulk_read(struct i2c_client *i2c, u8 reg, int count,
+ u8 *buf);
+extern int max77693_write_reg(struct i2c_client *i2c, u8 reg, u8 value);
+extern int max77693_bulk_write(struct i2c_client *i2c, u8 reg, int count,
+ u8 *buf);
+extern int max77693_update_reg(struct i2c_client *i2c,
+ u8 reg, u8 val, u8 mask);
+extern int max77693_muic_get_charging_type(void);
+extern int max77693_muic_get_status1_adc1k_value(void);
+extern int max77693_muic_get_status1_adc_value(void);
+extern void otg_control(int);
+extern void powered_otg_control(int);
+extern int max77693_muic_set_audio_switch(bool enable);
+
+#ifdef CONFIG_MFD_MAX77693
+enum cable_type_muic {
+ CABLE_TYPE_NONE_MUIC = 0,
+ CABLE_TYPE_USB_MUIC,
+ CABLE_TYPE_OTG_MUIC,
+ CABLE_TYPE_TA_MUIC,
+ CABLE_TYPE_DESKDOCK_MUIC,
+ CABLE_TYPE_CARDOCK_MUIC,
+ CABLE_TYPE_JIG_UART_OFF_MUIC,
+ CABLE_TYPE_JIG_UART_OFF_VB_MUIC, /* VBUS enabled */
+ CABLE_TYPE_JIG_UART_ON_MUIC,
+ CABLE_TYPE_JIG_USB_OFF_MUIC,
+ CABLE_TYPE_JIG_USB_ON_MUIC,
+ CABLE_TYPE_MHL_MUIC,
+ CABLE_TYPE_MHL_VB_MUIC,
+ CABLE_TYPE_SMARTDOCK_MUIC,
+ CABLE_TYPE_UNKNOWN_MUIC
+};
+
+enum {
+ AP_USB_MODE = 0,
+ CP_USB_MODE,
+ AUDIO_MODE,
+};
+
+enum {
+ UART_PATH_CP = 0,
+ UART_PATH_AP,
+#ifdef CONFIG_LTE_VIA_SWITCH
+ UART_PATH_LTE,
+#endif
+};
+#endif /* CONFIG_MFD_MAX77693 */
+
+#endif /* __LINUX_MFD_MAX77693_PRIV_H */
diff --git a/include/linux/mfd/max77693.h b/include/linux/mfd/max77693.h
new file mode 100644
index 0000000..07f2162
--- /dev/null
+++ b/include/linux/mfd/max77693.h
@@ -0,0 +1,141 @@
+/*
+ * max77693.h - Driver for the Maxim 77693
+ *
+ * Copyright (C) 2011 Samsung Electrnoics
+ * SangYoung Son <hello.son@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * This driver is based on max8997.h
+ *
+ * MAX77693 has Charger, Flash LED, Haptic, MUIC devices.
+ * The devices share the same I2C bus and included in
+ * this mfd driver.
+ */
+
+#ifndef __LINUX_MFD_MAX77693_H
+#define __LINUX_MFD_MAX77693_H
+
+#include <linux/regulator/consumer.h>
+
+enum {
+ MAX77693_MUIC_DETACHED = 0,
+ MAX77693_MUIC_ATTACHED
+};
+
+/* MAX77686 regulator IDs */
+enum max77693_regulators {
+ MAX77693_ESAFEOUT1 = 0,
+ MAX77693_ESAFEOUT2,
+
+ MAX77693_CHARGER,
+
+ MAX77693_REG_MAX,
+};
+
+struct max77693_charger_reg_data {
+ u8 addr;
+ u8 data;
+};
+
+struct max77693_charger_platform_data {
+ struct max77693_charger_reg_data *init_data;
+ int num_init_data;
+#ifdef CONFIG_BATTERY_WPC_CHARGER
+ int wpc_irq_gpio;
+ int vbus_irq_gpio;
+ bool wc_pwr_det;
+#endif
+};
+
+#ifdef CONFIG_VIBETONZ
+#define MAX8997_MOTOR_REG_CONFIG2 0x2
+#define MOTOR_LRA (1<<7)
+#define MOTOR_EN (1<<6)
+#define EXT_PWM (0<<5)
+#define DIVIDER_128 (1<<1)
+
+struct max77693_haptic_platform_data {
+ u16 max_timeout;
+ u16 duty;
+ u16 period;
+ u16 reg2;
+ char *regulator_name;
+ unsigned int pwm_id;
+
+ void (*init_hw) (void);
+ void (*motor_en) (bool);
+};
+#endif
+
+#ifdef CONFIG_LEDS_MAX77693
+struct max77693_led_platform_data;
+#endif
+
+struct max77693_regulator_data {
+ int id;
+ struct regulator_init_data *initdata;
+};
+
+struct max77693_platform_data {
+ /* IRQ */
+ int irq_base;
+ int irq_gpio;
+ int wakeup;
+ struct max77693_muic_data *muic;
+ bool (*is_default_uart_path_cp) (void);
+ struct max77693_regulator_data *regulators;
+ int num_regulators;
+#ifdef CONFIG_VIBETONZ
+ /* haptic motor data */
+ struct max77693_haptic_platform_data *haptic_data;
+#endif
+#ifdef CONFIG_LEDS_MAX77693
+ /* led (flash/torch) data */
+ struct max77693_led_platform_data *led_data;
+#endif
+#ifdef CONFIG_BATTERY_MAX77693_CHARGER
+ /* charger data */
+ struct max77693_charger_platform_data *charger_data;
+#endif
+};
+
+enum cable_type_muic;
+struct max77693_muic_data {
+ void (*usb_cb) (u8 attached);
+ void (*uart_cb) (u8 attached);
+ int (*charger_cb) (enum cable_type_muic);
+ void (*deskdock_cb) (bool attached);
+ void (*cardock_cb) (bool attached);
+ void (*mhl_cb) (int attached);
+ void (*init_cb) (void);
+ int (*set_safeout) (int path);
+ bool(*is_mhl_attached) (void);
+ int (*cfg_uart_gpio) (void);
+ void (*jig_uart_cb) (int path);
+ int (*host_notify_cb) (int enable);
+ int gpio_usb_sel;
+ int sw_path;
+ int uart_path;
+
+ void (*jig_state) (int jig_state);
+
+};
+
+#if defined(CONFIG_MACH_M0_CTC)
+int max7693_muic_cp_usb_state(void);
+#endif
+
+#endif /* __LINUX_MFD_MAX77693_H */
diff --git a/include/linux/mfd/max8698-private.h b/include/linux/mfd/max8698-private.h
new file mode 100644
index 0000000..332b04c
--- /dev/null
+++ b/include/linux/mfd/max8698-private.h
@@ -0,0 +1,117 @@
+/*
+ * max8698.h - Voltage regulator driver for the Maxim 8698
+ *
+ * Copyright (C) 2009-2010 Samsung Electrnoics
+ * Kyungmin Park <kyungmin.park@samsung.com>
+ * Marek Szyprowski <m.szyprowski@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * 2010.10.25
+ * Modified by Taekki Kim <taekki.kim@samsung.com>
+ */
+
+#ifndef __LINUX_MFD_MAX8698_PRIV_H
+#define __LINUX_MFD_MAX8698_PRIV_H
+
+/* MAX 8698 registers */
+enum {
+ MAX8698_REG_ONOFF1,
+ MAX8698_REG_ONOFF2,
+ MAX8698_REG_ADISCHG_EN1,
+ MAX8698_REG_ADISCHG_EN2,
+ MAX8698_REG_DVSARM12,
+ MAX8698_REG_DVSARM34,
+ MAX8698_REG_DVSINT12,
+ MAX8698_REG_BUCK3,
+ MAX8698_REG_LDO2_LDO3,
+ MAX8698_REG_LDO4,
+ MAX8698_REG_LDO5,
+ MAX8698_REG_LDO6,
+ MAX8698_REG_LDO7,
+ MAX8698_REG_LDO8_BKCHAR,
+ MAX8698_REG_LDO9,
+ MAX8698_REG_LBCNFG,
+};
+
+/* ONOFF1 */
+#define MAX8698_SHIFT_EN1 7
+#define MAX8698_SHIFT_EN2 6
+#define MAX8698_SHIFT_EN3 5
+#define MAX8698_SHIFT_ELDO2 4
+#define MAX8698_SHIFT_ELDO3 3
+#define MAX8698_SHIFT_ELDO4 2
+#define MAX8698_SHIFT_ELDO5 1
+
+#define MAX8698_MASK_EN1 (0x1 << MAX8698_SHIFT_EN1)
+#define MAX8698_MASK_EN2 (0x1 << MAX8698_SHIFT_EN2)
+#define MAX8698_MASK_EN3 (0x1 << MAX8698_SHIFT_EN3)
+#define MAX8698_MASK_ELDO2 (0x1 << MAX8698_SHIFT_ELDO2)
+#define MAX8698_MASK_ELDO3 (0x1 << MAX8698_SHIFT_ELDO3)
+#define MAX8698_MASK_ELDO4 (0x1 << MAX8698_SHIFT_ELDO4)
+#define MAX8698_MASK_ELDO5 (0x1 << MAX8698_SHIFT_ELDO5)
+
+/* ONOFF2 */
+#define MAX8698_SHIFT_ELDO6 7
+#define MAX8698_SHIFT_ELDO7 6
+#define MAX8698_SHIFT_ELDO8 5
+#define MAX8698_SHIFT_ELDO9 4
+#define MAX8698_SHIFT_ELBCNFG 0
+
+#define MAX8698_MASK_ELDO6 (0x1 << MAX8698_SHIFT_ELDO6)
+#define MAX8698_MASK_ELDO7 (0x1 << MAX8698_SHIFT_ELDO7)
+#define MAX8698_MASK_ELDO8 (0x1 << MAX8698_SHIFT_ELDO8)
+#define MAX8698_MASK_ELDO9 (0x1 << MAX8698_SHIFT_ELDO9)
+#define MAX8698_MASK_ELBCNFG (0x1 << MAX8698_SHIFT_ELBCNFG)
+
+
+/**
+ * struct max8698_dev - max8698 master device for sub-drivers
+ * @dev: master device of the chip (can be used to access platform data)
+ * @i2c_client: i2c client private data
+ * @dev_read(): chip register read function
+ * @dev_write(): chip register write function
+ * @dev_update(): chip register update function
+ * @iolock: mutex for serializing io access
+ */
+
+struct max8698_dev {
+ struct device *dev;
+ struct i2c_client *i2c_client;
+ int (*dev_read)(struct max8698_dev *max8698, u8 reg, u8 *dest);
+ int (*dev_write)(struct max8698_dev *max8698, u8 reg, u8 val);
+ int (*dev_update)(struct max8698_dev *max8698, u8 reg, u8 val, u8 mask);
+ struct mutex iolock;
+};
+
+static inline int max8698_read_reg(struct max8698_dev *max8698, u8 reg,
+ u8 *value)
+{
+ return max8698->dev_read(max8698, reg, value);
+}
+
+static inline int max8698_write_reg(struct max8698_dev *max8698, u8 reg,
+ u8 value)
+{
+ return max8698->dev_write(max8698, reg, value);
+}
+
+static inline int max8698_update_reg(struct max8698_dev *max8698, u8 reg,
+ u8 value, u8 mask)
+{
+ return max8698->dev_update(max8698, reg, value, mask);
+}
+
+#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 0000000..9a1b52a
--- /dev/null
+++ b/include/linux/mfd/max8698.h
@@ -0,0 +1,78 @@
+/*
+ * max8698.h - Voltage regulator driver for the Maxim 8698
+ *
+ * Copyright (C) 2009-2010 Samsung Electrnoics
+ * Kyungmin Park <kyungmin.park@samsung.com>
+ * Marek Szyprowski <m.szyprowski@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * 2010.10.25
+ * Modified by Taekki Kim <taekki.kim@samsung.com>
+ */
+
+#ifndef __LINUX_MFD_MAX8698_H
+#define __LINUX_MFD_MAX8698_H
+
+#include <linux/regulator/machine.h>
+
+/* MAX 8698 regulator ids */
+enum {
+ MAX8698_LDO1 = 1,
+ MAX8698_LDO2,
+ MAX8698_LDO3,
+ MAX8698_LDO4,
+ MAX8698_LDO5,
+ MAX8698_LDO6,
+ MAX8698_LDO7,
+ MAX8698_LDO8,
+ MAX8698_LDO9,
+ MAX8698_BUCK1,
+ MAX8698_BUCK2,
+ MAX8698_BUCK3,
+};
+
+/**
+ * max8698_regulator_data - regulator data
+ * @id: regulator id
+ * @initdata: regulator init data (contraints, supplies, ...)
+ */
+struct max8698_regulator_data {
+ int id;
+ struct regulator_init_data *initdata;
+};
+
+/**
+ * struct max8698_board - packages regulator init data
+ * @num_regulators: number of regultors used
+ * @regulators: array of defined regulators
+ */
+
+struct max8698_platform_data {
+ int num_regulators;
+ struct max8698_regulator_data *regulators;
+
+ int dvsarm1;
+ int dvsarm2;
+ int dvsarm3;
+ int dvsarm4;
+ int dvsint1;
+ int dvsint2;
+ int set1;
+ int set2;
+ int set3;
+};
+
+#endif /* __LINUX_MFD_MAX8698_H */
diff --git a/include/linux/mfd/max8997-private.h b/include/linux/mfd/max8997-private.h
index 5ff2400..ca61419 100644
--- a/include/linux/mfd/max8997-private.h
+++ b/include/linux/mfd/max8997-private.h
@@ -1,8 +1,9 @@
/*
- * max8997.h - Voltage regulator driver for the Maxim 8997
+ * max8997-private.h - Voltage regulator driver for the Maxim 8997
*
- * Copyright (C) 2010 Samsung Electrnoics
- * MyungJoo Ham <myungjoo.ham@samsung.com>
+ * Copyright (C) 2009-2010 Samsung Electrnoics
+ *
+ * based on max8998-private.h
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,343 +23,386 @@
#ifndef __LINUX_MFD_MAX8997_PRIV_H
#define __LINUX_MFD_MAX8997_PRIV_H
-#include <linux/i2c.h>
-
-#define MAX8997_REG_INVALID (0xff)
+#define MAX8997_NUM_IRQ_PMIC_REGS 4
+#define MAX8997_NUM_IRQ_MUIC_REGS 3
+#define MAX8997_NUM_IRQ_REGS (MAX8997_NUM_IRQ_PMIC_REGS +\
+ MAX8997_NUM_IRQ_MUIC_REGS)
+/* MAX 8997 PMIC registers */
enum max8997_pmic_reg {
- MAX8997_REG_PMIC_ID0 = 0x00,
- MAX8997_REG_PMIC_ID1 = 0x01,
- MAX8997_REG_INTSRC = 0x02,
- MAX8997_REG_INT1 = 0x03,
- MAX8997_REG_INT2 = 0x04,
- MAX8997_REG_INT3 = 0x05,
- MAX8997_REG_INT4 = 0x06,
-
- MAX8997_REG_INT1MSK = 0x08,
- MAX8997_REG_INT2MSK = 0x09,
- MAX8997_REG_INT3MSK = 0x0a,
- MAX8997_REG_INT4MSK = 0x0b,
-
- MAX8997_REG_STATUS1 = 0x0d,
- MAX8997_REG_STATUS2 = 0x0e,
- MAX8997_REG_STATUS3 = 0x0f,
- MAX8997_REG_STATUS4 = 0x10,
-
- MAX8997_REG_MAINCON1 = 0x13,
- MAX8997_REG_MAINCON2 = 0x14,
- MAX8997_REG_BUCKRAMP = 0x15,
-
- MAX8997_REG_BUCK1CTRL = 0x18,
- MAX8997_REG_BUCK1DVS1 = 0x19,
- MAX8997_REG_BUCK1DVS2 = 0x1a,
- MAX8997_REG_BUCK1DVS3 = 0x1b,
- MAX8997_REG_BUCK1DVS4 = 0x1c,
- MAX8997_REG_BUCK1DVS5 = 0x1d,
- MAX8997_REG_BUCK1DVS6 = 0x1e,
- MAX8997_REG_BUCK1DVS7 = 0x1f,
- MAX8997_REG_BUCK1DVS8 = 0x20,
- MAX8997_REG_BUCK2CTRL = 0x21,
- MAX8997_REG_BUCK2DVS1 = 0x22,
- MAX8997_REG_BUCK2DVS2 = 0x23,
- MAX8997_REG_BUCK2DVS3 = 0x24,
- MAX8997_REG_BUCK2DVS4 = 0x25,
- MAX8997_REG_BUCK2DVS5 = 0x26,
- MAX8997_REG_BUCK2DVS6 = 0x27,
- MAX8997_REG_BUCK2DVS7 = 0x28,
- MAX8997_REG_BUCK2DVS8 = 0x29,
- MAX8997_REG_BUCK3CTRL = 0x2a,
- MAX8997_REG_BUCK3DVS = 0x2b,
- MAX8997_REG_BUCK4CTRL = 0x2c,
- MAX8997_REG_BUCK4DVS = 0x2d,
- MAX8997_REG_BUCK5CTRL = 0x2e,
- MAX8997_REG_BUCK5DVS1 = 0x2f,
- MAX8997_REG_BUCK5DVS2 = 0x30,
- MAX8997_REG_BUCK5DVS3 = 0x31,
- MAX8997_REG_BUCK5DVS4 = 0x32,
- MAX8997_REG_BUCK5DVS5 = 0x33,
- MAX8997_REG_BUCK5DVS6 = 0x34,
- MAX8997_REG_BUCK5DVS7 = 0x35,
- MAX8997_REG_BUCK5DVS8 = 0x36,
- MAX8997_REG_BUCK6CTRL = 0x37,
- MAX8997_REG_BUCK6BPSKIPCTRL = 0x38,
- MAX8997_REG_BUCK7CTRL = 0x39,
- MAX8997_REG_BUCK7DVS = 0x3a,
- MAX8997_REG_LDO1CTRL = 0x3b,
- MAX8997_REG_LDO2CTRL = 0x3c,
- MAX8997_REG_LDO3CTRL = 0x3d,
- MAX8997_REG_LDO4CTRL = 0x3e,
- MAX8997_REG_LDO5CTRL = 0x3f,
- MAX8997_REG_LDO6CTRL = 0x40,
- MAX8997_REG_LDO7CTRL = 0x41,
- MAX8997_REG_LDO8CTRL = 0x42,
- MAX8997_REG_LDO9CTRL = 0x43,
- MAX8997_REG_LDO10CTRL = 0x44,
- MAX8997_REG_LDO11CTRL = 0x45,
- MAX8997_REG_LDO12CTRL = 0x46,
- MAX8997_REG_LDO13CTRL = 0x47,
- MAX8997_REG_LDO14CTRL = 0x48,
- MAX8997_REG_LDO15CTRL = 0x49,
- MAX8997_REG_LDO16CTRL = 0x4a,
- MAX8997_REG_LDO17CTRL = 0x4b,
- MAX8997_REG_LDO18CTRL = 0x4c,
- MAX8997_REG_LDO21CTRL = 0x4d,
-
- MAX8997_REG_MBCCTRL1 = 0x50,
- MAX8997_REG_MBCCTRL2 = 0x51,
- MAX8997_REG_MBCCTRL3 = 0x52,
- MAX8997_REG_MBCCTRL4 = 0x53,
- MAX8997_REG_MBCCTRL5 = 0x54,
- MAX8997_REG_MBCCTRL6 = 0x55,
- MAX8997_REG_OTPCGHCVS = 0x56,
-
- MAX8997_REG_SAFEOUTCTRL = 0x5a,
-
- MAX8997_REG_LBCNFG1 = 0x5e,
- MAX8997_REG_LBCNFG2 = 0x5f,
- MAX8997_REG_BBCCTRL = 0x60,
-
- MAX8997_REG_FLASH1_CUR = 0x63, /* 0x63 ~ 0x6e for FLASH */
- MAX8997_REG_FLASH2_CUR = 0x64,
- MAX8997_REG_MOVIE_CUR = 0x65,
- MAX8997_REG_GSMB_CUR = 0x66,
- MAX8997_REG_BOOST_CNTL = 0x67,
- MAX8997_REG_LEN_CNTL = 0x68,
- MAX8997_REG_FLASH_CNTL = 0x69,
- MAX8997_REG_WDT_CNTL = 0x6a,
- MAX8997_REG_MAXFLASH1 = 0x6b,
- MAX8997_REG_MAXFLASH2 = 0x6c,
- MAX8997_REG_FLASHSTATUS = 0x6d,
- MAX8997_REG_FLASHSTATUSMASK = 0x6e,
-
- MAX8997_REG_GPIOCNTL1 = 0x70,
- MAX8997_REG_GPIOCNTL2 = 0x71,
- MAX8997_REG_GPIOCNTL3 = 0x72,
- MAX8997_REG_GPIOCNTL4 = 0x73,
- MAX8997_REG_GPIOCNTL5 = 0x74,
- MAX8997_REG_GPIOCNTL6 = 0x75,
- MAX8997_REG_GPIOCNTL7 = 0x76,
- MAX8997_REG_GPIOCNTL8 = 0x77,
- MAX8997_REG_GPIOCNTL9 = 0x78,
- MAX8997_REG_GPIOCNTL10 = 0x79,
- MAX8997_REG_GPIOCNTL11 = 0x7a,
- MAX8997_REG_GPIOCNTL12 = 0x7b,
-
- MAX8997_REG_LDO1CONFIG = 0x80,
- MAX8997_REG_LDO2CONFIG = 0x81,
- MAX8997_REG_LDO3CONFIG = 0x82,
- MAX8997_REG_LDO4CONFIG = 0x83,
- MAX8997_REG_LDO5CONFIG = 0x84,
- MAX8997_REG_LDO6CONFIG = 0x85,
- MAX8997_REG_LDO7CONFIG = 0x86,
- MAX8997_REG_LDO8CONFIG = 0x87,
- MAX8997_REG_LDO9CONFIG = 0x88,
- MAX8997_REG_LDO10CONFIG = 0x89,
- MAX8997_REG_LDO11CONFIG = 0x8a,
- MAX8997_REG_LDO12CONFIG = 0x8b,
- MAX8997_REG_LDO13CONFIG = 0x8c,
- MAX8997_REG_LDO14CONFIG = 0x8d,
- MAX8997_REG_LDO15CONFIG = 0x8e,
- MAX8997_REG_LDO16CONFIG = 0x8f,
- MAX8997_REG_LDO17CONFIG = 0x90,
- MAX8997_REG_LDO18CONFIG = 0x91,
- MAX8997_REG_LDO21CONFIG = 0x92,
-
- MAX8997_REG_DVSOKTIMER1 = 0x97,
- MAX8997_REG_DVSOKTIMER2 = 0x98,
- MAX8997_REG_DVSOKTIMER4 = 0x99,
- MAX8997_REG_DVSOKTIMER5 = 0x9a,
-
- MAX8997_REG_PMIC_END = 0x9b,
+ MAX8997_REG_ID,
+ MAX8997_REG_VER,
+ MAX8997_REG_IRQ_SOURCE,
+ MAX8997_REG_IRQ1,
+ MAX8997_REG_IRQ2,
+ MAX8997_REG_IRQ3,
+ MAX8997_REG_IRQ4,
+ MAX8997_REG_RESERVED_0x07,
+ MAX8997_REG_IRQM1,
+ MAX8997_REG_IRQM2,
+ MAX8997_REG_IRQM3,
+ MAX8997_REG_IRQM4,
+ MAX8997_REG_RESERVED_0x0C,
+ MAX8997_REG_STATUS1,
+ MAX8997_REG_STATUS2,
+ MAX8997_REG_STATUS3,
+ MAX8997_REG_STATUS4,
+ MAX8997_REG_RESERVED_0x11,
+ MAX8997_REG_RESERVED_0x12,
+ MAX8997_REG_CONTROL1,
+ MAX8997_REG_CONTROL2,
+ MAX8997_REG_BUCKRAMP,
+ MAX8997_REG_RESERVED_0x16,
+ MAX8997_REG_RESERVED_0x17,
+ MAX8997_REG_BUCK1CTRL,
+ MAX8997_REG_BUCK1DVSTV1,
+ MAX8997_REG_BUCK1DVSTV2,
+ MAX8997_REG_BUCK1DVSTV3,
+ MAX8997_REG_BUCK1DVSTV4,
+ MAX8997_REG_BUCK1DVSTV5,
+ MAX8997_REG_BUCK1DVSTV6,
+ MAX8997_REG_BUCK1DVSTV7,
+ MAX8997_REG_BUCK1DVSTV8,
+ MAX8997_REG_BUCK2CTRL,
+ MAX8997_REG_BUCK2DVSTV1,
+ MAX8997_REG_BUCK2DVSTV2,
+ MAX8997_REG_BUCK2DVSTV3,
+ MAX8997_REG_BUCK2DVSTV4,
+ MAX8997_REG_BUCK2DVSTV5,
+ MAX8997_REG_BUCK2DVSTV6,
+ MAX8997_REG_BUCK2DVSTV7,
+ MAX8997_REG_BUCK2DVSTV8,
+ MAX8997_REG_BUCK3CTRL,
+ MAX8997_REG_BUCK3DVSTV,
+ MAX8997_REG_BUCK4CTRL,
+ MAX8997_REG_BUCK4DVSTV,
+ MAX8997_REG_BUCK5CTRL,
+ MAX8997_REG_BUCK5DVSTV1,
+ MAX8997_REG_BUCK5DVSTV2,
+ MAX8997_REG_BUCK5DVSTV3,
+ MAX8997_REG_BUCK5DVSTV4,
+ MAX8997_REG_BUCK5DVSTV5,
+ MAX8997_REG_BUCK5DVSTV6,
+ MAX8997_REG_BUCK5DVSTV7,
+ MAX8997_REG_BUCK5DVSTV8,
+ MAX8997_REG_BUCK6CTRL1,
+ MAX8997_REG_BUCK6CTRL2,
+ MAX8997_REG_BUCK7CTRL,
+ MAX8997_REG_BUCK7DVSTV,
+ MAX8997_REG_LDO1CTRL,
+ MAX8997_REG_LDO2CTRL,
+ MAX8997_REG_LDO3CTRL,
+ MAX8997_REG_LDO4CTRL,
+ MAX8997_REG_LDO5CTRL,
+ MAX8997_REG_LDO6CTRL,
+ MAX8997_REG_LDO7CTRL,
+ MAX8997_REG_LDO8CTRL,
+ MAX8997_REG_LDO9CTRL,
+ MAX8997_REG_LDO10CTRL,
+ MAX8997_REG_LDO11CTRL,
+ MAX8997_REG_LDO12CTRL,
+ MAX8997_REG_LDO13CTRL,
+ MAX8997_REG_LDO14CTRL,
+ MAX8997_REG_LDO15CTRL,
+ MAX8997_REG_LDO16CTRL,
+ MAX8997_REG_LDO17CTRL,
+ MAX8997_REG_LDO18CTRL,
+ MAX8997_REG_LDO21CTRL,
+ MAX8997_REG_RESERVED_0x4E,
+ MAX8997_REG_RESERVED_0x4F,
+ MAX8997_REG_MBCCTRL1,
+ MAX8997_REG_MBCCTRL2,
+ MAX8997_REG_MBCCTRL3,
+ MAX8997_REG_MBCCTRL4,
+ MAX8997_REG_MBCCTRL5,
+ MAX8997_REG_MBCCTRL6,
+ MAX8997_REG_OTPCGHCVS,
+ MAX8997_REG_RESERVED_0x57,
+ MAX8997_REG_RESERVED_0x58,
+ MAX8997_REG_RESERVED_0x59,
+ MAX8997_REG_SAFEOUTCTRL,
+ MAX8997_REG_RESERVED_0x5B,
+ MAX8997_REG_RESERVED_0x5C,
+ MAX8997_REG_RESERVED_0x5D,
+ MAX8997_REG_LBCNFG1,
+ MAX8997_REG_LBCNFG2,
+ MAX8997_REG_BBCTRL,
+ MAX8997_REG_RESERVED_0x61,
+ MAX8997_REG_RESERVED_0x62,
+ MAX8997_REG_FLASH1_CUR,
+ MAX8997_REG_FLASH2_CUR,
+ MAX8997_REG_MOVIE_CUR,
+ MAX8997_REG_GSMB_CUR,
+ MAX8997_REG_BOOST_CNTL,
+ MAX8997_REG_LED_CNTL,
+ MAX8997_REG_FLASH_CNTL,
+ MAX8997_REG_WDT_CNTL,
+ MAX8997_REG_MAXFLASH1,
+ MAX8997_REG_MAXFLASH2,
+ MAX8997_REG_FLASH_STATUS,
+ MAX8997_REG_FLASH_STATUS_MASK,
+ MAX8997_REG_RESERVED_0x6F,
+ MAX8997_REG_GPIOCNTL1,
+ MAX8997_REG_GPIOCNTL2,
+ MAX8997_REG_GPIOCNTL3,
+ MAX8997_REG_GPIOCNTL4,
+ MAX8997_REG_GPIOCNTL5,
+ MAX8997_REG_GPIOCNTL6,
+ MAX8997_REG_GPIOCNTL7,
+ MAX8997_REG_GPIOCNTL8,
+ MAX8997_REG_GPIOCNTL9,
+ MAX8997_REG_GPIOCNTL10,
+ MAX8997_REG_GPIOCNTL11,
+ MAX8997_REG_GPIOCNTL12,
+ MAX8997_REG_RESERVED_0x7C,
+ MAX8997_REG_RESERVED_0x7D,
+ MAX8997_REG_RESERVED_0x7E,
+ MAX8997_REG_RESERVED_0x7F,
+ MAX8997_REG_LDO1CONFIG,
+ MAX8997_REG_LDO2CONFIG,
+ MAX8997_REG_LDO3CONFIG,
+ MAX8997_REG_LDO4CONFIG,
+ MAX8997_REG_LDO5CONFIG,
+ MAX8997_REG_LDO6CONFIG,
+ MAX8997_REG_LDO7CONFIG,
+ MAX8997_REG_LDO8CONFIG,
+ MAX8997_REG_LDO9CONFIG,
+ MAX8997_REG_LDO10CONFIG,
+ MAX8997_REG_LDO11CONFIG,
+ MAX8997_REG_LDO12CONFIG,
+ MAX8997_REG_LDO13CONFIG,
+ MAX8997_REG_LDO14CONFIG,
+ MAX8997_REG_LDO15CONFIG,
+ MAX8997_REG_LDO16CONFIG,
+ MAX8997_REG_LDO17CONFIG,
+ MAX8997_REG_LDO18CONFIG,
+ MAX8997_REG_LDO21CONFIG,
+ MAX8997_REG_RESERVED_0x93,
+ MAX8997_REG_RESERVED_0x94,
+ MAX8997_REG_RESERVED_0x95,
+ MAX8997_REG_RESERVED_0x96,
+ MAX8997_REG_DVSOKTIMER1,
+ MAX8997_REG_DVSOKTIMER2,
+ MAX8997_REG_DVSOKTIMER4,
+ MAX8997_REG_DVSOKTIMER5,
+
+ MAX8997_REG_PMIC_END
};
+/* MAX8997 MUIC registers */
enum max8997_muic_reg {
- MAX8997_MUIC_REG_ID = 0x0,
- MAX8997_MUIC_REG_INT1 = 0x1,
- MAX8997_MUIC_REG_INT2 = 0x2,
- MAX8997_MUIC_REG_INT3 = 0x3,
- MAX8997_MUIC_REG_STATUS1 = 0x4,
- MAX8997_MUIC_REG_STATUS2 = 0x5,
- MAX8997_MUIC_REG_STATUS3 = 0x6,
- MAX8997_MUIC_REG_INTMASK1 = 0x7,
- MAX8997_MUIC_REG_INTMASK2 = 0x8,
- MAX8997_MUIC_REG_INTMASK3 = 0x9,
- MAX8997_MUIC_REG_CDETCTRL = 0xa,
-
- MAX8997_MUIC_REG_CONTROL1 = 0xc,
- MAX8997_MUIC_REG_CONTROL2 = 0xd,
- MAX8997_MUIC_REG_CONTROL3 = 0xe,
-
- MAX8997_MUIC_REG_END = 0xf,
+ MAX8997_MUIC_REG_ID = 0,
+ MAX8997_MUIC_REG_INT1,
+ MAX8997_MUIC_REG_INT2,
+ MAX8997_MUIC_REG_INT3,
+ MAX8997_MUIC_REG_STATUS1,
+ MAX8997_MUIC_REG_STATUS2,
+ MAX8997_MUIC_REG_STATUS3,
+ MAX8997_MUIC_REG_INTMASK1,
+ MAX8997_MUIC_REG_INTMASK2,
+ MAX8997_MUIC_REG_INTMASK3,
+ MAX8997_MUIC_REG_CDETCTRL,
+ MAX8997_MUIC_REG_RESERVED_0x0B,
+ MAX8997_MUIC_REG_CTRL1,
+ MAX8997_MUIC_REG_CTRL2,
+ MAX8997_MUIC_REG_CTRL3,
+ MAX8997_MUIC_REG_RESERVED_0x0F,
+
+ MAX8997_MUIC_REG_END
};
enum max8997_haptic_reg {
- MAX8997_HAPTIC_REG_GENERAL = 0x00,
- MAX8997_HAPTIC_REG_CONF1 = 0x01,
- MAX8997_HAPTIC_REG_CONF2 = 0x02,
- MAX8997_HAPTIC_REG_DRVCONF = 0x03,
- MAX8997_HAPTIC_REG_CYCLECONF1 = 0x04,
- MAX8997_HAPTIC_REG_CYCLECONF2 = 0x05,
- MAX8997_HAPTIC_REG_SIGCONF1 = 0x06,
- MAX8997_HAPTIC_REG_SIGCONF2 = 0x07,
- MAX8997_HAPTIC_REG_SIGCONF3 = 0x08,
- MAX8997_HAPTIC_REG_SIGCONF4 = 0x09,
- MAX8997_HAPTIC_REG_SIGDC1 = 0x0a,
- MAX8997_HAPTIC_REG_SIGDC2 = 0x0b,
- MAX8997_HAPTIC_REG_SIGPWMDC1 = 0x0c,
- MAX8997_HAPTIC_REG_SIGPWMDC2 = 0x0d,
- MAX8997_HAPTIC_REG_SIGPWMDC3 = 0x0e,
- MAX8997_HAPTIC_REG_SIGPWMDC4 = 0x0f,
- MAX8997_HAPTIC_REG_MTR_REV = 0x10,
-
- MAX8997_HAPTIC_REG_END = 0x11,
+ MAX8997_HAPTIC_REG_GENERAL = 0x00,
+ MAX8997_HAPTIC_REG_CONF1 = 0x01,
+ MAX8997_HAPTIC_REG_CONF2 = 0x02,
+ MAX8997_HAPTIC_REG_DRVCONF = 0x03,
+ MAX8997_HAPTIC_REG_CYCLECONF1 = 0x04,
+ MAX8997_HAPTIC_REG_CYCLECONF2 = 0x05,
+ MAX8997_HAPTIC_REG_SIGCONF1 = 0x06,
+ MAX8997_HAPTIC_REG_SIGCONF2 = 0x07,
+ MAX8997_HAPTIC_REG_SIGCONF3 = 0x08,
+ MAX8997_HAPTIC_REG_SIGCONF4 = 0x09,
+ MAX8997_HAPTIC_REG_SIGDC1 = 0x0a,
+ MAX8997_HAPTIC_REG_SIGDC2 = 0x0b,
+ MAX8997_HAPTIC_REG_SIGPWMDC1 = 0x0c,
+ MAX8997_HAPTIC_REG_SIGPWMDC2 = 0x0d,
+ MAX8997_HAPTIC_REG_SIGPWMDC3 = 0x0e,
+ MAX8997_HAPTIC_REG_SIGPWMDC4 = 0x0f,
+ MAX8997_HAPTIC_REG_MTR_REV = 0x10,
+
+ MAX8997_HAPTIC_REG_END = 0x11,
};
-/* slave addr = 0x0c: using "2nd part" of rev4 datasheet */
-enum max8997_rtc_reg {
- MAX8997_RTC_CTRLMASK = 0x02,
- MAX8997_RTC_CTRL = 0x03,
- MAX8997_RTC_UPDATE1 = 0x04,
- MAX8997_RTC_UPDATE2 = 0x05,
- MAX8997_RTC_WTSR_SMPL = 0x06,
-
- MAX8997_RTC_SEC = 0x10,
- MAX8997_RTC_MIN = 0x11,
- MAX8997_RTC_HOUR = 0x12,
- MAX8997_RTC_DAY_OF_WEEK = 0x13,
- MAX8997_RTC_MONTH = 0x14,
- MAX8997_RTC_YEAR = 0x15,
- MAX8997_RTC_DAY_OF_MONTH = 0x16,
- MAX8997_RTC_ALARM1_SEC = 0x17,
- MAX8997_RTC_ALARM1_MIN = 0x18,
- MAX8997_RTC_ALARM1_HOUR = 0x19,
- MAX8997_RTC_ALARM1_DAY_OF_WEEK = 0x1a,
- MAX8997_RTC_ALARM1_MONTH = 0x1b,
- MAX8997_RTC_ALARM1_YEAR = 0x1c,
- MAX8997_RTC_ALARM1_DAY_OF_MONTH = 0x1d,
- MAX8997_RTC_ALARM2_SEC = 0x1e,
- MAX8997_RTC_ALARM2_MIN = 0x1f,
- MAX8997_RTC_ALARM2_HOUR = 0x20,
- MAX8997_RTC_ALARM2_DAY_OF_WEEK = 0x21,
- MAX8997_RTC_ALARM2_MONTH = 0x22,
- MAX8997_RTC_ALARM2_YEAR = 0x23,
- MAX8997_RTC_ALARM2_DAY_OF_MONTH = 0x24,
+/* IRQ definitions */
+/* The interrupts for board specific purporse are only 18. */
+/* refer arch/arm/mach-s5pv310/include/mach/irqs.h */
+enum {
+ /* PMIC / RTC */
+ /** IRQ1 **/
+ MAX8997_IRQ_PWRONR,
+ MAX8997_IRQ_PWRONF,
+ MAX8997_IRQ_PWRON1SEC,
+ MAX8997_IRQ_JIGONR,
+ MAX8997_IRQ_JIGONF,
+ MAX8997_IRQ_LOWBAT2,
+ MAX8997_IRQ_LOWBAT1,
+ /** IRQ2 **/
+ MAX8997_IRQ_JIGR,
+ MAX8997_IRQ_JIGF,
+ MAX8997_IRQ_MR,
+ MAX8997_IRQ_DVS1OK,
+ MAX8997_IRQ_DVS2OK,
+ MAX8997_IRQ_DVS4OK,
+ MAX8997_IRQ_DVS5OK,
+ /** IRQ3 **/
+ MAX8997_IRQ_CHGINS,
+ MAX8997_IRQ_CHGRM,
+ MAX8997_IRQ_DCINOVP,
+ MAX8997_IRQ_TOPOFF,
+ MAX8997_IRQ_CHGRSTF,
+ MAX8997_IRQ_MBCHGTMEXPD,
+ /** IRQ4 **/
+ MAX8997_IRQ_RTC60S,
+ MAX8997_IRQ_RTCA1,
+ MAX8997_IRQ_RTCA2,
+ MAX8997_IRQ_SMPL_INT,
+ MAX8997_IRQ_RTC1S,
+ MAX8997_IRQ_WTSR,
+ /* MUIC */
+ /** IRQ1 **/
+ MAX8997_IRQ_ADC,
+ MAX8997_IRQ_ADCLOW,
+ MAX8997_IRQ_ADCERR,
+ /** IRQ2 **/
+ MAX8997_IRQ_CHGTYP,
+ MAX8997_IRQ_CHGDETRUN,
+ MAX8997_IRQ_DCDTMR,
+ MAX8997_IRQ_DBCHG,
+ MAX8997_IRQ_VBVOLT,
+ /** IRQ3 **/
+ MAX8997_IRQ_OVP,
+
+ MAX8997_IRQ_NR
};
-enum max8997_irq_source {
- PMIC_INT1 = 0,
- PMIC_INT2,
- PMIC_INT3,
- PMIC_INT4,
-
- FUEL_GAUGE, /* Ignored (MAX17042 driver handles) */
-
- MUIC_INT1,
- MUIC_INT2,
- MUIC_INT3,
-
- GPIO_LOW, /* Not implemented */
- GPIO_HI, /* Not implemented */
-
- FLASH_STATUS, /* Not implemented */
-
- MAX8997_IRQ_GROUP_NR,
+/* MAX8997 various variants */
+enum {
+ TYPE_MAX8997 = 0, /* Default */
};
-enum max8997_irq {
- MAX8997_PMICIRQ_PWRONR,
- MAX8997_PMICIRQ_PWRONF,
- MAX8997_PMICIRQ_PWRON1SEC,
- MAX8997_PMICIRQ_JIGONR,
- MAX8997_PMICIRQ_JIGONF,
- MAX8997_PMICIRQ_LOWBAT2,
- MAX8997_PMICIRQ_LOWBAT1,
-
- MAX8997_PMICIRQ_JIGR,
- MAX8997_PMICIRQ_JIGF,
- MAX8997_PMICIRQ_MR,
- MAX8997_PMICIRQ_DVS1OK,
- MAX8997_PMICIRQ_DVS2OK,
- MAX8997_PMICIRQ_DVS3OK,
- MAX8997_PMICIRQ_DVS4OK,
-
- MAX8997_PMICIRQ_CHGINS,
- MAX8997_PMICIRQ_CHGRM,
- MAX8997_PMICIRQ_DCINOVP,
- MAX8997_PMICIRQ_TOPOFFR,
- MAX8997_PMICIRQ_CHGRSTF,
- MAX8997_PMICIRQ_MBCHGTMEXPD,
-
- MAX8997_PMICIRQ_RTC60S,
- MAX8997_PMICIRQ_RTCA1,
- MAX8997_PMICIRQ_RTCA2,
- MAX8997_PMICIRQ_SMPL_INT,
- MAX8997_PMICIRQ_RTC1S,
- MAX8997_PMICIRQ_WTSR,
-
- MAX8997_MUICIRQ_ADCError,
- MAX8997_MUICIRQ_ADCLow,
- MAX8997_MUICIRQ_ADC,
-
- MAX8997_MUICIRQ_VBVolt,
- MAX8997_MUICIRQ_DBChg,
- MAX8997_MUICIRQ_DCDTmr,
- MAX8997_MUICIRQ_ChgDetRun,
- MAX8997_MUICIRQ_ChgTyp,
-
- MAX8997_MUICIRQ_OVP,
-
- MAX8997_IRQ_NR,
-};
-
-#define MAX8997_NUM_GPIO 12
+/* Interrupt source mask */
+#define MAX8997_INTR_PMIC_MASK (1 << 1)
+#define MAX8997_INTR_FUELGAUGE_MASK (1 << 2)
+#define MAX8997_INTR_MUIC_MASK (1 << 3)
+#define MAX8997_INTR_GPIO_MASK (1 << 4)
+#define MAX8997_INTR_FLASH_MASK (1 << 5)
+
+/* PMIC / RTC interrupt mask */
+#define MAX8997_IRQ_PWRONR_MASK (1 << 0)
+#define MAX8997_IRQ_PWRONF_MASK (1 << 1)
+#define MAX8997_IRQ_PWRON1SEC_MASK (1 << 3)
+#define MAX8997_IRQ_JIGONR_MASK (1 << 4)
+#define MAX8997_IRQ_JIGONF_MASK (1 << 5)
+#define MAX8997_IRQ_LOWBAT2_MASK (1 << 6)
+#define MAX8997_IRQ_LOWBAT1_MASK (1 << 7)
+
+#define MAX8997_IRQ_JIGR_MASK (1 << 0)
+#define MAX8997_IRQ_JIGF_MASK (1 << 1)
+#define MAX8997_IRQ_MR_MASK (1 << 2)
+#define MAX8997_IRQ_DVS1OK_MASK (1 << 3)
+#define MAX8997_IRQ_DVS2OK_MASK (1 << 4)
+#define MAX8997_IRQ_DVS4OK_MASK (1 << 5)
+#define MAX8997_IRQ_DVS5OK_MASK (1 << 6)
+
+#define MAX8997_IRQ_CHGINS_MASK (1 << 0)
+#define MAX8997_IRQ_CHGRM_MASK (1 << 1)
+#define MAX8997_IRQ_DCINOVP_MASK (1 << 2)
+#define MAX8997_IRQ_TOPOFF_MASK (1 << 3)
+#define MAX8997_IRQ_CHGRSTF_MASK (1 << 5)
+#define MAX8997_IRQ_MBCHGTMEXPD_MASK (1 << 7)
+
+#define MAX8997_IRQ_RTC60S_MASK (1 << 0)
+#define MAX8997_IRQ_RTCA1_MASK (1 << 1)
+#define MAX8997_IRQ_RTCA2_MASK (1 << 2)
+#define MAX8997_IRQ_SMPL_INT_MASK (1 << 3)
+#define MAX8997_IRQ_RTC1S_MASK (1 << 4)
+#define MAX8997_IRQ_WTSR_MASK (1 << 5)
+
+/* MUIC interrupt mask */
+#define MAX8997_IRQ_ADC_MASK (1 << 0)
+#define MAX8997_IRQ_ADCLOW_MASK (1 << 1)
+#define MAX8997_IRQ_ADCERR_MASK (1 << 2)
+
+#define MAX8997_IRQ_CHGTYP_MASK (1 << 0)
+#define MAX8997_IRQ_CHGDETRUN_MASK (1 << 1)
+#define MAX8997_IRQ_DCDTMR_MASK (1 << 2)
+#define MAX8997_IRQ_DBCHG_MASK (1 << 3)
+#define MAX8997_IRQ_VBVOLT_MASK (1 << 4)
+
+#define MAX8997_IRQ_OVP_MASK (1 << 2)
+
+/* RAMP BUCKs register mask */
+#define MAX8997_ENRAMPBUCK1 (1 << 4)
+#define MAX8997_ENRAMPBUCK2 (1 << 5)
+#define MAX8997_ENRAMPBUCK4 (1 << 6)
+#define MAX8997_ENRAMPBUCK5 (1 << 7)
+
+/* Flash LED register mask */
+#define MAX8997_BOOST_EN_MASK (1 << 6)
+#define MAX8997_BOOST_EN_SHIFT 6
+#define MAX8997_FLASH_EN_MASK (7 << 0)
+#define MAX8997_FLASH_EN_SHIFT 0
+#define MAX8997_MOVIE_EN_MASK (7 << 3)
+#define MAX8997_MOVIE_EN_SHIFT 3
+
+/**
+ * struct max8997_dev - max8997 master device for sub-drivers
+ * @dev: master device of the chip (can be used to access platform data)
+ * @i2c: i2c client private data for regulator
+ * @rtc: i2c client private data for rtc
+ * @muic: i2c client private data for muic
+ * @hmotor: i2c client private data for haptic motor
+ * @iolock: mutex for serializing io access
+ * @irqlock: mutex for buslock
+ * @irq_base: base IRQ number for max8997, required for IRQs
+ * @irq: generic IRQ number for max8997
+ * @ono: power onoff IRQ number for max8997
+ * @irq_masks_cur: currently active value
+ * @irq_masks_cache: cached hardware value
+ * @type: indicate which max8997 "variant" is used
+ */
struct max8997_dev {
struct device *dev;
- struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */
- struct i2c_client *rtc; /* slave addr 0x0c */
- struct i2c_client *haptic; /* slave addr 0x90 */
- struct i2c_client *muic; /* slave addr 0x4a */
+ struct i2c_client *i2c;
+ struct i2c_client *rtc;
+ struct i2c_client *muic;
+ struct i2c_client *hmotor;
struct mutex iolock;
+ struct mutex irqlock;
- int type;
- struct platform_device *battery; /* battery control (not fuel gauge) */
-
+ int irq_base;
int irq;
int ono;
- int irq_base;
- bool wakeup;
- struct mutex irqlock;
- int irq_masks_cur[MAX8997_IRQ_GROUP_NR];
- int irq_masks_cache[MAX8997_IRQ_GROUP_NR];
+ u8 irq_masks_cur[MAX8997_NUM_IRQ_REGS];
+ u8 irq_masks_cache[MAX8997_NUM_IRQ_REGS];
+ int type;
+ int wakeup;
- /* For hibernation */
+ /* For hiberantion */
u8 reg_dump[MAX8997_REG_PMIC_END + MAX8997_MUIC_REG_END +
MAX8997_HAPTIC_REG_END];
-
- bool gpio_status[MAX8997_NUM_GPIO];
-};
-
-enum max8997_types {
- TYPE_MAX8997,
- TYPE_MAX8966,
};
-extern int max8997_irq_init(struct max8997_dev *max8997);
-extern void max8997_irq_exit(struct max8997_dev *max8997);
-extern int max8997_irq_resume(struct max8997_dev *max8997);
+int max8997_irq_init(struct max8997_dev *max8997);
+void max8997_irq_exit(struct max8997_dev *max8997);
extern int max8997_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest);
extern int max8997_bulk_read(struct i2c_client *i2c, u8 reg, int count,
- u8 *buf);
+ u8 *buf);
extern int max8997_write_reg(struct i2c_client *i2c, u8 reg, u8 value);
extern int max8997_bulk_write(struct i2c_client *i2c, u8 reg, int count,
- u8 *buf);
+ u8 *buf);
extern int max8997_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask);
-#define MAX8997_GPIO_INT_BOTH (0x3 << 4)
-#define MAX8997_GPIO_INT_RISE (0x2 << 4)
-#define MAX8997_GPIO_INT_FALL (0x1 << 4)
-
-#define MAX8997_GPIO_INT_MASK (0x3 << 4)
-#define MAX8997_GPIO_DATA_MASK (0x1 << 2)
#endif /* __LINUX_MFD_MAX8997_PRIV_H */
+
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h
index 60931d0..256ed57 100644
--- a/include/linux/mfd/max8997.h
+++ b/include/linux/mfd/max8997.h
@@ -1,8 +1,9 @@
/*
- * max8997.h - Driver for the Maxim 8997/8966
+ * max8997.h - Voltage regulator driver for the Maxim 8997
*
* Copyright (C) 2009-2010 Samsung Electrnoics
- * MyungJoo Ham <myungjoo.ham@samsung.com>
+ *
+ * based on max8998.h
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -17,24 +18,20 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * This driver is based on max8998.h
- *
- * MAX8997 has PMIC, MUIC, HAPTIC, RTC, FLASH, and Fuel Gauge devices.
- * Except Fuel Gauge, every device shares the same I2C bus and included in
- * this mfd driver. Although the fuel gauge is included in the chip, it is
- * excluded from the driver because a) it has a different I2C bus from
- * others and b) it can be enabled simply by using MAX17042 driver.
*/
-#ifndef __LINUX_MFD_MAX8998_H
-#define __LINUX_MFD_MAX8998_H
+#ifndef __LINUX_MFD_MAX8997_H
+#define __LINUX_MFD_MAX8997_H
-#include <linux/regulator/consumer.h>
+#include <linux/regulator/machine.h>
-/* MAX8997/8966 regulator IDs */
-enum max8998_regulators {
- MAX8997_LDO1 = 0,
+#if defined(CONFIG_MACH_Q1_BD)
+#define MAX8997_SUPPORT_TORCH
+#endif /* CONFIG_MACH_Q1_BD */
+
+/* MAX 8997 regulator ids */
+enum {
+ MAX8997_LDO1 = 1,
MAX8997_LDO2,
MAX8997_LDO3,
MAX8997_LDO4,
@@ -65,53 +62,165 @@ enum max8998_regulators {
MAX8997_ENVICHG,
MAX8997_ESAFEOUT1,
MAX8997_ESAFEOUT2,
- MAX8997_CHARGER_CV, /* control MBCCV of MBCCTRL3 */
- MAX8997_CHARGER, /* charger current, MBCCTRL4 */
- MAX8997_CHARGER_TOPOFF, /* MBCCTRL5 */
+ MAX8997_FLASH_CUR,
+ MAX8997_MOVIE_CUR,
+#ifdef MAX8997_SUPPORT_TORCH
+ MAX8997_FLASH_TORCH,
+#endif /* MAX8997_SUPPORT_TORCH */
MAX8997_REG_MAX,
};
+/**
+ * max8997_regulator_data - regulator data
+ * @id: regulator id
+ * @initdata: regulator init data (contraints, supplies, ...)
+ */
struct max8997_regulator_data {
- int id;
- struct regulator_init_data *initdata;
+ int id;
+ struct regulator_init_data *initdata;
+ int (*is_valid_regulator)(int, struct regulator_init_data*);
+};
+
+struct max8997_power_data {
+ int (*set_charger)(int);
+ int (*topoff_cb) (void);
+ unsigned batt_detect:1;
+ unsigned topoff_threshold:2;
+ unsigned fast_charge:3; /* charge current */
+};
+
+#ifdef CONFIG_VIBETONZ
+#define MAX8997_MOTOR_REG_CONFIG2 0x2
+#define MOTOR_LRA (1<<7)
+#define MOTOR_EN (1<<6)
+#define EXT_PWM (0<<5)
+#define DIVIDER_128 (1<<1)
+#define DIVIDER_256 (1<<0 | 1<<1)
+
+struct max8997_motor_data {
+ u16 max_timeout;
+ u16 duty;
+ u16 period;
+ u16 reg2;
+ void (*init_hw)(void);
+ void (*motor_en)(bool);
+ unsigned int pwm_id;
+};
+#endif
+
+enum {
+ MAX8997_MUIC_DETACHED = 0,
+ MAX8997_MUIC_ATTACHED
};
+enum {
+ AP_USB_MODE = 0,
+ CP_USB_MODE,
+ AUDIO_MODE,
+};
+
+enum {
+ UART_PATH_CP = 0,
+ UART_PATH_AP,
+};
+
+enum cable_type {
+ CABLE_TYPE_NONE = 0,
+ CABLE_TYPE_USB,
+ CABLE_TYPE_OTG,
+ CABLE_TYPE_TA,
+ CABLE_TYPE_DESKDOCK,
+ CABLE_TYPE_CARDOCK,
+ CABLE_TYPE_STATION,
+ CABLE_TYPE_JIG_UART_OFF,
+ CABLE_TYPE_JIG_UART_OFF_VB, /* VBUS enabled */
+ CABLE_TYPE_JIG_UART_ON,
+ CABLE_TYPE_JIG_USB_OFF,
+ CABLE_TYPE_JIG_USB_ON,
+ CABLE_TYPE_MHL,
+ CABLE_TYPE_MHL_VB,
+ CABLE_TYPE_UNKNOWN
+};
+
+struct max8997_muic_data {
+ void (*usb_cb) (u8 attached);
+ void (*uart_cb) (u8 attached);
+ int (*charger_cb) (int cable_type);
+ void (*deskdock_cb) (bool attached);
+ void (*cardock_cb) (bool attached);
+ void (*mhl_cb) (int attached);
+ void (*init_cb) (void);
+ int (*set_safeout) (int path);
+ bool (*is_mhl_attached) (void);
+#if !defined(CONFIG_MACH_U1CAMERA_BD)
+ int (*cfg_uart_gpio) (void);
+#endif /* CONFIG_MACH_U1CAMERA_BD */
+ void (*jig_uart_cb) (int path);
+ int (*host_notify_cb) (int enable);
+#if !defined(CONFIG_MACH_U1CAMERA_BD)
+ int gpio_usb_sel;
+#endif /* CONFIG_MACH_U1CAMERA_BD */
+ int sw_path;
+#if !defined(CONFIG_MACH_U1CAMERA_BD)
+ int uart_path;
+#endif /* CONFIG_MACH_U1CAMERA_BD */
+};
+
+struct max8997_buck1_dvs_funcs {
+ int (*set_buck1_dvs_table)(struct max8997_buck1_dvs_funcs *ptr,
+ unsigned int *voltage_table, int arr_size);
+ int (*get_buck1_dvs_table)(struct max8997_buck1_dvs_funcs *ptr,
+ unsigned int *voltage_table);
+};
+
+#define BUCK1_TABLE_SIZE 7
+
+/**
+ * struct max8997_board - packages regulator init data
+ * @regulators: array of defined regulators
+ * @num_regulators: number of regultors used
+ * @irq_base: base IRQ number for max8997, required for IRQs
+ * @ono: power onoff IRQ number for max8997
+ * @wakeup: configure the irq as a wake-up source
+ * @buck1_gpiodvs: enable/disable GPIO DVS for BUCK1
+ * @buck1_voltages: BUCK1 supported voltage list for GPIO DVS(uV)
+ * it must have descending order.
+ * @buck1_max_vol: maximun voltage for BUCK1 (B1_TV_1)
+ * @buck2_max_vol: maximun voltage for BUCK2 (B2_TV_1)
+ * @buck5_max_vol: maximun voltage for BUCK5 (B5_TV_1)
+ * @buck_set1: BUCK gpio pin 1 to set output voltage
+ * @buck_set2: BUCK gpio pin 2 to set output voltage
+ * @buck_set3: BUCK gpio pin 3 to set output voltage
+ * @buck_ramp_en: enable BUCKx RAMP
+ * @buck_ramp_delay: ramp delay(usec) BUCK RAMP register(0x15)
+ * @flash_cntl_val: value of MAX8997_REG_FLASH_CNTL register
+ * @mr_debounce_time: manual reset debounce time (sec), (default 7sec)
+ */
struct max8997_platform_data {
- /* IRQ */
- int irq_base;
- int ono;
- int wakeup;
-
- /* ---- PMIC ---- */
- struct max8997_regulator_data *regulators;
- int num_regulators;
-
- /*
- * SET1~3 DVS GPIOs control Buck1, 2, and 5 simultaneously. Therefore,
- * With buckx_gpiodvs enabled, the buckx cannot be controlled
- * independently. To control buckx (of 1, 2, and 5) independently,
- * disable buckx_gpiodvs and control with BUCKxDVS1 register.
- *
- * When buckx_gpiodvs and bucky_gpiodvs are both enabled, set_voltage
- * on buckx will change the voltage of bucky at the same time.
- *
- */
- bool ignore_gpiodvs_side_effect;
- int buck125_gpios[3]; /* GPIO of [0]SET1, [1]SET2, [2]SET3 */
- int buck125_default_idx; /* Default value of SET1, 2, 3 */
- unsigned int buck1_voltage[8]; /* buckx_voltage in uV */
- bool buck1_gpiodvs;
- unsigned int buck2_voltage[8];
- bool buck2_gpiodvs;
- unsigned int buck5_voltage[8];
- bool buck5_gpiodvs;
-
- /* MUIC: Not implemented */
- /* HAPTIC: Not implemented */
- /* RTC: Not implemented */
- /* Flash: Not implemented */
- /* Charger control: Not implemented */
+ struct max8997_regulator_data *regulators;
+ int num_regulators;
+ int irq_base;
+ int ono;
+ int wakeup;
+ bool buck1_gpiodvs;
+ unsigned int buck1_max_vol;
+ unsigned int buck2_max_vol;
+ unsigned int buck5_max_vol;
+ unsigned int buck1_voltages[BUCK1_TABLE_SIZE];
+ int buck_set1;
+ int buck_set2;
+ int buck_set3;
+ bool buck_ramp_en;
+ int buck_ramp_delay;
+ int flash_cntl_val;
+ int mr_debounce_time;
+ struct max8997_power_data *power;
+ struct max8997_muic_data *muic;
+#ifdef CONFIG_VIBETONZ
+ struct max8997_motor_data *motor;
+#endif
+ void (*register_buck1_dvs_funcs)(struct max8997_buck1_dvs_funcs *ptr);
};
-#endif /* __LINUX_MFD_MAX8998_H */
+#endif /* __LINUX_MFD_MAX8997_H */
diff --git a/include/linux/mfd/mc1n2_pdata.h b/include/linux/mfd/mc1n2_pdata.h
new file mode 100644
index 0000000..fe67db4
--- /dev/null
+++ b/include/linux/mfd/mc1n2_pdata.h
@@ -0,0 +1,29 @@
+ /*
+ * Copyright (C) 2008 Samsung Electronics, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __S5PC210_MC1N2_H
+#define __S5PC210_MC1N2_H
+
+enum mic_type {
+ MAIN_MIC = 0x1,
+ SUB_MIC = 0x2,
+};
+
+struct mc1n2_platform_data {
+ void (*set_main_mic_bias)(bool on);
+ void (*set_sub_mic_bias)(bool on);
+ int (*set_adc_power_constraints)(int disabled);
+};
+
+#endif
diff --git a/include/linux/mfd/s5m87xx/s5m-core.h b/include/linux/mfd/s5m87xx/s5m-core.h
new file mode 100644
index 0000000..5afc005
--- /dev/null
+++ b/include/linux/mfd/s5m87xx/s5m-core.h
@@ -0,0 +1,385 @@
+/*
+ * s5m-core.h
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd
+ * http://www.samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ */
+
+#ifndef __LINUX_MFD_S5M_CORE_H
+#define __LINUX_MFD_S5M_CORE_H
+
+#define NUM_IRQ_REGS 4
+
+enum s5m_device_type {
+ S5M8751X,
+ S5M8763X,
+ S5M8767X,
+};
+
+/* S5M8767 registers */
+enum s5m8767_reg {
+ S5M8767_REG_ID,
+ S5M8767_REG_INT1,
+ S5M8767_REG_INT2,
+ S5M8767_REG_INT3,
+ S5M8767_REG_INT1M,
+ S5M8767_REG_INT2M,
+ S5M8767_REG_INT3M,
+ S5M8767_REG_STATUS1,
+ S5M8767_REG_STATUS2,
+ S5M8767_REG_STATUS3,
+ S5M8767_REG_CTRL1,
+ S5M8767_REG_CTRL2,
+ S5M8767_REG_LOWBAT1,
+ S5M8767_REG_LOWBAT2,
+ S5M8767_REG_BUCHG,
+ S5M8767_REG_DVSRAMP,
+ S5M8767_REG_DVSTIMER2 = 0x10,
+ S5M8767_REG_DVSTIMER3,
+ S5M8767_REG_DVSTIMER4,
+ S5M8767_REG_LDO1,
+ S5M8767_REG_LDO2,
+ S5M8767_REG_LDO3,
+ S5M8767_REG_LDO4,
+ S5M8767_REG_LDO5,
+ S5M8767_REG_LDO6,
+ S5M8767_REG_LDO7,
+ S5M8767_REG_LDO8,
+ S5M8767_REG_LDO9,
+ S5M8767_REG_LDO10,
+ S5M8767_REG_LDO11,
+ S5M8767_REG_LDO12,
+ S5M8767_REG_LDO13,
+ S5M8767_REG_LDO14 = 0x20,
+ S5M8767_REG_LDO15,
+ S5M8767_REG_LDO16,
+ S5M8767_REG_LDO17,
+ S5M8767_REG_LDO18,
+ S5M8767_REG_LDO19,
+ S5M8767_REG_LDO20,
+ S5M8767_REG_LDO21,
+ S5M8767_REG_LDO22,
+ S5M8767_REG_LDO23,
+ S5M8767_REG_LDO24,
+ S5M8767_REG_LDO25,
+ S5M8767_REG_LDO26,
+ S5M8767_REG_LDO27,
+ S5M8767_REG_LDO28,
+ S5M8767_REG_UVLO = 0x31,
+ S5M8767_REG_BUCK1CTRL1,
+ S5M8767_REG_BUCK1CTRL2,
+ S5M8767_REG_BUCK2CTRL,
+ S5M8767_REG_BUCK2DVS1,
+ S5M8767_REG_BUCK2DVS2,
+ S5M8767_REG_BUCK2DVS3,
+ S5M8767_REG_BUCK2DVS4,
+ S5M8767_REG_BUCK2DVS5,
+ S5M8767_REG_BUCK2DVS6,
+ S5M8767_REG_BUCK2DVS7,
+ S5M8767_REG_BUCK2DVS8,
+ S5M8767_REG_BUCK3CTRL,
+ S5M8767_REG_BUCK3DVS1,
+ S5M8767_REG_BUCK3DVS2,
+ S5M8767_REG_BUCK3DVS3,
+ S5M8767_REG_BUCK3DVS4,
+ S5M8767_REG_BUCK3DVS5,
+ S5M8767_REG_BUCK3DVS6,
+ S5M8767_REG_BUCK3DVS7,
+ S5M8767_REG_BUCK3DVS8,
+ S5M8767_REG_BUCK4CTRL,
+ S5M8767_REG_BUCK4DVS1,
+ S5M8767_REG_BUCK4DVS2,
+ S5M8767_REG_BUCK4DVS3,
+ S5M8767_REG_BUCK4DVS4,
+ S5M8767_REG_BUCK4DVS5,
+ S5M8767_REG_BUCK4DVS6,
+ S5M8767_REG_BUCK4DVS7,
+ S5M8767_REG_BUCK4DVS8,
+ S5M8767_REG_BUCK5CTRL1,
+ S5M8767_REG_BUCK5CTRL2,
+ S5M8767_REG_BUCK5CTRL3,
+ S5M8767_REG_BUCK5CTRL4,
+ S5M8767_REG_BUCK5CTRL5,
+ S5M8767_REG_BUCK6CTRL1,
+ S5M8767_REG_BUCK6CTRL2,
+ S5M8767_REG_BUCK7CTRL1,
+ S5M8767_REG_BUCK7CTRL2,
+ S5M8767_REG_BUCK8CTRL1,
+ S5M8767_REG_BUCK8CTRL2,
+ S5M8767_REG_BUCK9CTRL1,
+ S5M8767_REG_BUCK9CTRL2,
+ S5M8767_REG_LDO1CTRL,
+ S5M8767_REG_LDO2_1CTRL,
+ S5M8767_REG_LDO2_2CTRL,
+ S5M8767_REG_LDO2_3CTRL,
+ S5M8767_REG_LDO2_4CTRL,
+ S5M8767_REG_LDO3CTRL,
+ S5M8767_REG_LDO4CTRL,
+ S5M8767_REG_LDO5CTRL,
+ S5M8767_REG_LDO6CTRL,
+ S5M8767_REG_LDO7CTRL,
+ S5M8767_REG_LDO8CTRL,
+ S5M8767_REG_LDO9CTRL,
+ S5M8767_REG_LDO10CTRL,
+ S5M8767_REG_LDO11CTRL,
+ S5M8767_REG_LDO12CTRL,
+ S5M8767_REG_LDO13CTRL,
+ S5M8767_REG_LDO14CTRL,
+ S5M8767_REG_LDO15CTRL,
+ S5M8767_REG_LDO16CTRL,
+ S5M8767_REG_LDO17CTRL,
+ S5M8767_REG_LDO18CTRL,
+ S5M8767_REG_LDO19CTRL,
+ S5M8767_REG_LDO20CTRL,
+ S5M8767_REG_LDO21CTRL,
+ S5M8767_REG_LDO22CTRL,
+ S5M8767_REG_LDO23CTRL,
+ S5M8767_REG_LDO24CTRL,
+ S5M8767_REG_LDO25CTRL,
+ S5M8767_REG_LDO26CTRL,
+ S5M8767_REG_LDO27CTRL,
+ S5M8767_REG_LDO28CTRL,
+};
+
+/* S5M8763 registers */
+enum s5m8763_reg {
+ S5M8763_REG_IRQ1,
+ S5M8763_REG_IRQ2,
+ S5M8763_REG_IRQ3,
+ S5M8763_REG_IRQ4,
+ S5M8763_REG_IRQM1,
+ S5M8763_REG_IRQM2,
+ S5M8763_REG_IRQM3,
+ S5M8763_REG_IRQM4,
+ S5M8763_REG_STATUS1,
+ S5M8763_REG_STATUS2,
+ S5M8763_REG_STATUSM1,
+ S5M8763_REG_STATUSM2,
+ S5M8763_REG_CHGR1,
+ S5M8763_REG_CHGR2,
+ S5M8763_REG_LDO_ACTIVE_DISCHARGE1,
+ S5M8763_REG_LDO_ACTIVE_DISCHARGE2,
+ S5M8763_REG_BUCK_ACTIVE_DISCHARGE3,
+ S5M8763_REG_ONOFF1,
+ S5M8763_REG_ONOFF2,
+ S5M8763_REG_ONOFF3,
+ S5M8763_REG_ONOFF4,
+ S5M8763_REG_BUCK1_VOLTAGE1,
+ S5M8763_REG_BUCK1_VOLTAGE2,
+ S5M8763_REG_BUCK1_VOLTAGE3,
+ S5M8763_REG_BUCK1_VOLTAGE4,
+ S5M8763_REG_BUCK2_VOLTAGE1,
+ S5M8763_REG_BUCK2_VOLTAGE2,
+ S5M8763_REG_BUCK3,
+ S5M8763_REG_BUCK4,
+ S5M8763_REG_LDO1_LDO2,
+ S5M8763_REG_LDO3,
+ S5M8763_REG_LDO4,
+ S5M8763_REG_LDO5,
+ S5M8763_REG_LDO6,
+ S5M8763_REG_LDO7,
+ S5M8763_REG_LDO7_LDO8,
+ S5M8763_REG_LDO9_LDO10,
+ S5M8763_REG_LDO11,
+ S5M8763_REG_LDO12,
+ S5M8763_REG_LDO13,
+ S5M8763_REG_LDO14,
+ S5M8763_REG_LDO15,
+ S5M8763_REG_LDO16,
+ S5M8763_REG_BKCHR,
+ S5M8763_REG_LBCNFG1,
+ S5M8763_REG_LBCNFG2,
+};
+
+enum s5m8767_irq {
+ S5M8767_IRQ_PWRR,
+ S5M8767_IRQ_PWRF,
+ S5M8767_IRQ_PWR1S,
+ S5M8767_IRQ_JIGR,
+ S5M8767_IRQ_JIGF,
+ S5M8767_IRQ_LOWBAT2,
+ S5M8767_IRQ_LOWBAT1,
+
+ S5M8767_IRQ_MRB,
+ S5M8767_IRQ_DVSOK2,
+ S5M8767_IRQ_DVSOK3,
+ S5M8767_IRQ_DVSOK4,
+
+ S5M8767_IRQ_RTC60S,
+ S5M8767_IRQ_RTCA1,
+ S5M8767_IRQ_RTCA2,
+ S5M8767_IRQ_SMPL,
+ S5M8767_IRQ_RTC1S,
+ S5M8767_IRQ_WTSR,
+
+ S5M8767_IRQ_NR,
+};
+
+#define S5M8767_IRQ_PWRR_MASK (1 << 0)
+#define S5M8767_IRQ_PWRF_MASK (1 << 1)
+#define S5M8767_IRQ_PWR1S_MASK (1 << 3)
+#define S5M8767_IRQ_JIGR_MASK (1 << 4)
+#define S5M8767_IRQ_JIGF_MASK (1 << 5)
+#define S5M8767_IRQ_LOWBAT2_MASK (1 << 6)
+#define S5M8767_IRQ_LOWBAT1_MASK (1 << 7)
+
+#define S5M8767_IRQ_MRB_MASK (1 << 2)
+#define S5M8767_IRQ_DVSOK2_MASK (1 << 3)
+#define S5M8767_IRQ_DVSOK3_MASK (1 << 4)
+#define S5M8767_IRQ_DVSOK4_MASK (1 << 5)
+
+#define S5M8767_IRQ_RTC60S_MASK (1 << 0)
+#define S5M8767_IRQ_RTCA1_MASK (1 << 1)
+#define S5M8767_IRQ_RTCA2_MASK (1 << 2)
+#define S5M8767_IRQ_SMPL_MASK (1 << 3)
+#define S5M8767_IRQ_RTC1S_MASK (1 << 4)
+#define S5M8767_IRQ_WTSR_MASK (1 << 5)
+
+enum s5m8763_irq {
+ S5M8763_IRQ_DCINF,
+ S5M8763_IRQ_DCINR,
+ S5M8763_IRQ_JIGF,
+ S5M8763_IRQ_JIGR,
+ S5M8763_IRQ_PWRONF,
+ S5M8763_IRQ_PWRONR,
+
+ S5M8763_IRQ_WTSREVNT,
+ S5M8763_IRQ_SMPLEVNT,
+ S5M8763_IRQ_ALARM1,
+ S5M8763_IRQ_ALARM0,
+
+ S5M8763_IRQ_ONKEY1S,
+ S5M8763_IRQ_TOPOFFR,
+ S5M8763_IRQ_DCINOVPR,
+ S5M8763_IRQ_CHGRSTF,
+ S5M8763_IRQ_DONER,
+ S5M8763_IRQ_CHGFAULT,
+
+ S5M8763_IRQ_LOBAT1,
+ S5M8763_IRQ_LOBAT2,
+
+ S5M8763_IRQ_NR,
+};
+
+#define S5M8763_IRQ_DCINF_MASK (1 << 2)
+#define S5M8763_IRQ_DCINR_MASK (1 << 3)
+#define S5M8763_IRQ_JIGF_MASK (1 << 4)
+#define S5M8763_IRQ_JIGR_MASK (1 << 5)
+#define S5M8763_IRQ_PWRONF_MASK (1 << 6)
+#define S5M8763_IRQ_PWRONR_MASK (1 << 7)
+
+#define S5M8763_IRQ_WTSREVNT_MASK (1 << 0)
+#define S5M8763_IRQ_SMPLEVNT_MASK (1 << 1)
+#define S5M8763_IRQ_ALARM1_MASK (1 << 2)
+#define S5M8763_IRQ_ALARM0_MASK (1 << 3)
+
+#define S5M8763_IRQ_ONKEY1S_MASK (1 << 0)
+#define S5M8763_IRQ_TOPOFFR_MASK (1 << 2)
+#define S5M8763_IRQ_DCINOVPR_MASK (1 << 3)
+#define S5M8763_IRQ_CHGRSTF_MASK (1 << 4)
+#define S5M8763_IRQ_DONER_MASK (1 << 5)
+#define S5M8763_IRQ_CHGFAULT_MASK (1 << 7)
+
+#define S5M8763_IRQ_LOBAT1_MASK (1 << 0)
+#define S5M8763_IRQ_LOBAT2_MASK (1 << 1)
+
+#define S5M8763_ENRAMP (1 << 4)
+
+/**
+ * struct s5m87xx_dev - s5m87xx master device for sub-drivers
+ * @dev: master device of the chip (can be used to access platform data)
+ * @i2c: i2c client private data for regulator
+ * @rtc: i2c client private data for rtc
+ * @iolock: mutex for serializing io access
+ * @irqlock: mutex for buslock
+ * @irq_base: base IRQ number for s5m87xx, required for IRQs
+ * @irq: generic IRQ number for s5m87xx
+ * @ono: power onoff IRQ number for s5m87xx
+ * @irq_masks_cur: currently active value
+ * @irq_masks_cache: cached hardware value
+ * @type: indicate which s5m87xx "variant" is used
+ */
+struct s5m87xx_dev {
+ struct device *dev;
+ struct i2c_client *i2c;
+ struct i2c_client *rtc;
+ struct mutex iolock;
+ struct mutex irqlock;
+
+ int device_type;
+ int irq_base;
+ int irq;
+ int ono;
+ u8 irq_masks_cur[NUM_IRQ_REGS];
+ u8 irq_masks_cache[NUM_IRQ_REGS];
+ int type;
+ bool wakeup;
+ bool wtsr_smpl;
+};
+
+int s5m_irq_init(struct s5m87xx_dev *s5m87xx);
+void s5m_irq_exit(struct s5m87xx_dev *s5m87xx);
+int s5m_irq_resume(struct s5m87xx_dev *s5m87xx);
+
+extern int s5m_reg_read(struct i2c_client *i2c, u8 reg, u8 *dest);
+extern int s5m_bulk_read(struct i2c_client *i2c, u8 reg, int count, u8 *buf);
+extern int s5m_reg_write(struct i2c_client *i2c, u8 reg, u8 value);
+extern int s5m_bulk_write(struct i2c_client *i2c, u8 reg, int count, u8 *buf);
+extern int s5m_reg_update(struct i2c_client *i2c, u8 reg, u8 val, u8 mask);
+
+struct s5m_platform_data {
+ struct s5m_regulator_data *regulators;
+ struct s5m_opmode_data *opmode_data;
+
+ int device_type;
+ int num_regulators;
+ int (*cfg_pmic_irq)(void);
+
+ /* IRQ */
+ int irq_gpio;
+ int irq_base;
+
+ int ono;
+ bool wakeup;
+ bool buck_voltage_lock;
+
+ int buck_gpios[3];
+ int buck_ds[3];
+
+ int buck2_voltage[8];
+ bool buck2_gpiodvs;
+ int buck3_voltage[8];
+ bool buck3_gpiodvs;
+ int buck4_voltage[8];
+ bool buck4_gpiodvs;
+
+ int buck_set1;
+ int buck_set2;
+ int buck_set3;
+ int buck2_enable;
+ int buck3_enable;
+ int buck4_enable;
+ int buck_default_idx;
+ int buck2_default_idx;
+ int buck3_default_idx;
+ int buck4_default_idx;
+
+ int buck_ramp_delay;
+ bool buck2_ramp_enable;
+ bool buck3_ramp_enable;
+ bool buck4_ramp_enable;
+
+ bool wtsr_smpl;
+
+ int buck2_init;
+ int buck3_init;
+ int buck4_init;
+};
+
+#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 0000000..ba878df
--- /dev/null
+++ b/include/linux/mfd/s5m87xx/s5m-pmic.h
@@ -0,0 +1,115 @@
+/* s5m87xx.h
+ *
+ * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __LINUX_MFD_S5M_PMIC_H
+#define __LINUX_MFD_S5M_PMIC_H
+
+#include <linux/regulator/machine.h>
+
+/* S5M8767 regulator ids */
+enum s5m8767_regulators {
+ S5M8767_LDO1,
+ S5M8767_LDO2,
+ S5M8767_LDO3,
+ S5M8767_LDO4,
+ S5M8767_LDO5,
+ S5M8767_LDO6,
+ S5M8767_LDO7,
+ S5M8767_LDO8,
+ S5M8767_LDO9,
+ S5M8767_LDO10,
+ S5M8767_LDO11,
+ S5M8767_LDO12,
+ S5M8767_LDO13,
+ S5M8767_LDO14,
+ S5M8767_LDO15,
+ S5M8767_LDO16,
+ S5M8767_LDO17,
+ S5M8767_LDO18,
+ S5M8767_LDO19,
+ S5M8767_LDO20,
+ S5M8767_LDO21,
+ S5M8767_LDO22,
+ S5M8767_LDO23,
+ S5M8767_LDO24,
+ S5M8767_LDO25,
+ S5M8767_LDO26,
+ S5M8767_LDO27,
+ S5M8767_LDO28,
+ S5M8767_BUCK1,
+ S5M8767_BUCK2,
+ S5M8767_BUCK3,
+ S5M8767_BUCK4,
+ S5M8767_BUCK5,
+ S5M8767_BUCK6,
+ S5M8767_BUCK7,
+ S5M8767_BUCK8,
+ S5M8767_BUCK9,
+ S5M8767_AP_EN32KHZ,
+ S5M8767_CP_EN32KHZ,
+ S5M8767_BT_EN32KHZ,
+
+ S5M8767_REG_MAX,
+};
+
+
+#define S5M8767_PMIC_EN_SHIFT 6
+
+/* S5M8763 regulator ids */
+enum s5m8763_regulators {
+ S5M8763_LDO1,
+ S5M8763_LDO2,
+ S5M8763_LDO3,
+ S5M8763_LDO4,
+ S5M8763_LDO5,
+ S5M8763_LDO6,
+ S5M8763_LDO7,
+ S5M8763_LDO8,
+ S5M8763_LDO9,
+ S5M8763_LDO10,
+ S5M8763_LDO11,
+ S5M8763_LDO12,
+ S5M8763_LDO13,
+ S5M8763_LDO14,
+ S5M8763_LDO15,
+ S5M8763_LDO16,
+ S5M8763_BUCK1,
+ S5M8763_BUCK2,
+ S5M8763_BUCK3,
+ S5M8763_BUCK4,
+ S5M8763_AP_EN32KHZ,
+ S5M8763_CP_EN32KHZ,
+ S5M8763_ENCHGVI,
+ S5M8763_ESAFEUSB1,
+ S5M8763_ESAFEUSB2,
+};
+
+/**
+ * s5m87xx_regulator_data - regulator data
+ * @id: regulator id
+ * @initdata: regulator init data (contraints, supplies, ...)
+ */
+struct s5m_regulator_data {
+ int id;
+ struct regulator_init_data *initdata;
+};
+
+struct s5m_opmode_data {
+ int id;
+ int mode;
+};
+
+enum s5m_opmode {
+ S5M_OPMODE_NORMAL,
+ S5M_OPMODE_LP,
+ S5M_OPMODE_STANDBY,
+};
+
+#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 0000000..a1caa97
--- /dev/null
+++ b/include/linux/mfd/s5m87xx/s5m-rtc.h
@@ -0,0 +1,95 @@
+/*
+ * s5m-rtc.h
+ *
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd
+ * http://www.samsung.com
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ */
+
+#ifndef __LINUX_MFD_S5M_RTC_H
+#define __LINUX_MFD_S5M_RTC_H
+
+enum s5m87xx_rtc_reg {
+ S5M87XX_RTC_SEC,
+ S5M87XX_RTC_MIN,
+ S5M87XX_RTC_HOUR,
+ S5M87XX_RTC_WEEKDAY,
+ S5M87XX_RTC_DATE,
+ S5M87XX_RTC_MONTH,
+ S5M87XX_RTC_YEAR1,
+ S5M87XX_RTC_YEAR2,
+ S5M87XX_ALARM0_SEC,
+ S5M87XX_ALARM0_MIN,
+ S5M87XX_ALARM0_HOUR,
+ S5M87XX_ALARM0_WEEKDAY,
+ S5M87XX_ALARM0_DATE,
+ S5M87XX_ALARM0_MONTH,
+ S5M87XX_ALARM0_YEAR1,
+ S5M87XX_ALARM0_YEAR2,
+ S5M87XX_ALARM1_SEC,
+ S5M87XX_ALARM1_MIN,
+ S5M87XX_ALARM1_HOUR,
+ S5M87XX_ALARM1_WEEKDAY,
+ S5M87XX_ALARM1_DATE,
+ S5M87XX_ALARM1_MONTH,
+ S5M87XX_ALARM1_YEAR1,
+ S5M87XX_ALARM1_YEAR2,
+ S5M87XX_ALARM0_CONF,
+ S5M87XX_ALARM1_CONF,
+ S5M87XX_RTC_STATUS,
+ S5M87XX_WTSR_SMPL_CNTL,
+ S5M87XX_RTC_UDR_CON,
+};
+
+#define RTC_I2C_ADDR (0x0C >> 1)
+
+#define HOUR_12 (1 << 7)
+#define HOUR_AMPM (1 << 6)
+#define HOUR_PM (1 << 5)
+#define ALARM0_STATUS (1 << 1)
+#define ALARM1_STATUS (1 << 2)
+#define UPDATE_AD (1 << 0)
+
+/* RTC Control Register */
+#define BCD_EN_SHIFT 0
+#define BCD_EN_MASK (1 << BCD_EN_SHIFT)
+#define MODEL24_SHIFT 1
+#define MODEL24_MASK (1 << MODEL24_SHIFT)
+/* RTC Update Register1 */
+#define RTC_UDR_SHIFT 0
+#define RTC_UDR_MASK (1 << RTC_UDR_SHIFT)
+#define RTC_TCON_SHIFT 1
+#define RTC_TCON_MASK (1 << RTC_TCON_SHIFT)
+#define RTC_TIME_EN_SHIFT 3
+#define RTC_TIME_EN_MASK (1 << RTC_TIME_EN_SHIFT)
+
+/* RTC Hour register */
+#define HOUR_PM_SHIFT 6
+#define HOUR_PM_MASK (1 << HOUR_PM_SHIFT)
+/* RTC Alarm Enable */
+#define ALARM_ENABLE_SHIFT 7
+#define ALARM_ENABLE_MASK (1 << ALARM_ENABLE_SHIFT)
+
+#define SMPL_ENABLE_SHIFT 7
+#define SMPL_ENABLE_MASK (1 << SMPL_ENABLE_SHIFT)
+
+#define WTSR_ENABLE_SHIFT 6
+#define WTSR_ENABLE_MASK (1 << WTSR_ENABLE_SHIFT)
+
+enum {
+ RTC_SEC = 0,
+ RTC_MIN,
+ RTC_HOUR,
+ RTC_WEEKDAY,
+ RTC_DATE,
+ RTC_MONTH,
+ RTC_YEAR1,
+ RTC_YEAR2,
+};
+
+#endif /* __LINUX_MFD_S5M_RTC_H */
diff --git a/include/linux/mfd/wm8994/core.h b/include/linux/mfd/wm8994/core.h
index f0b69cd..49d8ab1 100644
--- a/include/linux/mfd/wm8994/core.h
+++ b/include/linux/mfd/wm8994/core.h
@@ -20,6 +20,7 @@
enum wm8994_type {
WM8994 = 0,
WM8958 = 1,
+ WM1811 = 2,
};
struct regulator_dev;
@@ -55,6 +56,9 @@ struct wm8994 {
enum wm8994_type type;
+ int revision;
+ int cust_id;
+
struct device *dev;
int (*read_dev)(struct wm8994 *wm8994, unsigned short reg,
int bytes, void *dest);
@@ -63,6 +67,8 @@ struct wm8994 {
void *control_data;
+ bool ldo_ena_always_driven;
+
int gpio_base;
int irq_base;
@@ -97,6 +103,8 @@ static inline int wm8994_request_irq(struct wm8994 *wm8994, int irq,
irq_handler_t handler, const char *name,
void *data)
{
+ if (!wm8994)
+ return -EINVAL;
if (!wm8994->irq_base)
return -EINVAL;
return request_threaded_irq(wm8994->irq_base + irq, NULL, handler,
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index 97cf4f2..630df2d 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -113,6 +113,23 @@ struct wm8958_enh_eq_cfg {
u16 regs[WM8958_ENH_EQ_REGS];
};
+/**
+ * Microphone detection rates, used to tune response rates and power
+ * consumption for WM8958/WM1811 microphone detection.
+ *
+ * @sysclk: System clock rate to use this configuration for.
+ * @idle: True if this configuration should use when no accessory is detected,
+ * false otherwise.
+ * @start: Value for MICD_BIAS_START_TIME register field (not shifted).
+ * @rate: Value for MICD_RATE register field (not shifted).
+ */
+struct wm8958_micd_rate {
+ int sysclk;
+ bool idle;
+ int start;
+ int rate;
+};
+
struct wm8994_pdata {
int gpio_base;
@@ -144,6 +161,9 @@ struct wm8994_pdata {
int num_enh_eq_cfgs;
struct wm8958_enh_eq_cfg *enh_eq_cfgs;
+ int num_micd_rates;
+ struct wm8958_micd_rate *micd_rates;
+
/* LINEOUT can be differential or single ended */
unsigned int lineout1_diff:1;
unsigned int lineout2_diff:1;
@@ -165,8 +185,32 @@ struct wm8994_pdata {
unsigned int jd_scthr:2;
unsigned int jd_thr:2;
+ /* Configure WM1811 jack detection for use with external capacitor */
+ unsigned int jd_ext_cap:1;
+
/* WM8958 microphone bias configuration */
int micbias[2];
+
+ /* WM8958 microphone detection ranges */
+ u16 micd_lvl_sel;
+
+ /* Disable the internal pull downs on the LDOs if they are
+ * always driven (eg, connected to an always on supply or
+ * GPIO that always drives an output. If they float power
+ * consumption will rise.
+ */
+ bool ldo_ena_always_driven;
+
+ /*
+ * LDO enable delay time
+ */
+ int ldo_ena_delay;
+
+ /*
+ * SPKMODE must be pulled internally by the device on this
+ * system.
+ */
+ bool spkmode_pu;
};
#endif
diff --git a/include/linux/mfd/wm8994/registers.h b/include/linux/mfd/wm8994/registers.h
index f3ee842..0535489 100644
--- a/include/linux/mfd/wm8994/registers.h
+++ b/include/linux/mfd/wm8994/registers.h
@@ -72,6 +72,7 @@
#define WM8994_DC_SERVO_2 0x55
#define WM8994_DC_SERVO_4 0x57
#define WM8994_DC_SERVO_READBACK 0x58
+#define WM8994_DC_SERVO_4E 0x59
#define WM8994_ANALOGUE_HP_1 0x60
#define WM8958_MIC_DETECT_1 0xD0
#define WM8958_MIC_DETECT_2 0xD1
@@ -94,11 +95,15 @@
#define WM8994_FLL1_CONTROL_3 0x222
#define WM8994_FLL1_CONTROL_4 0x223
#define WM8994_FLL1_CONTROL_5 0x224
+#define WM8958_FLL1_EFS_1 0x226
+#define WM8958_FLL1_EFS_2 0x227
#define WM8994_FLL2_CONTROL_1 0x240
#define WM8994_FLL2_CONTROL_2 0x241
#define WM8994_FLL2_CONTROL_3 0x242
#define WM8994_FLL2_CONTROL_4 0x243
#define WM8994_FLL2_CONTROL_5 0x244
+#define WM8958_FLL2_EFS_1 0x246
+#define WM8958_FLL2_EFS_2 0x247
#define WM8994_AIF1_CONTROL_1 0x300
#define WM8994_AIF1_CONTROL_2 0x301
#define WM8994_AIF1_MASTER_SLAVE 0x302
@@ -115,6 +120,7 @@
#define WM8994_AIF2DAC_LRCLK 0x315
#define WM8994_AIF2DAC_DATA 0x316
#define WM8994_AIF2ADC_DATA 0x317
+#define WM1811_AIF2TX_CONTROL 0x318
#define WM8958_AIF3_CONTROL_1 0x320
#define WM8958_AIF3_CONTROL_2 0x321
#define WM8958_AIF3DAC_DATA 0x322
@@ -133,6 +139,8 @@
#define WM8994_AIF1_DAC1_FILTERS_2 0x421
#define WM8994_AIF1_DAC2_FILTERS_1 0x422
#define WM8994_AIF1_DAC2_FILTERS_2 0x423
+#define WM8958_AIF1_DAC1_NOISE_GATE 0x430
+#define WM8958_AIF1_DAC2_NOISE_GATE 0x431
#define WM8994_AIF1_DRC1_1 0x440
#define WM8994_AIF1_DRC1_2 0x441
#define WM8994_AIF1_DRC1_3 0x442
@@ -163,6 +171,7 @@
#define WM8994_AIF1_DAC1_EQ_BAND_5_A 0x491
#define WM8994_AIF1_DAC1_EQ_BAND_5_B 0x492
#define WM8994_AIF1_DAC1_EQ_BAND_5_PG 0x493
+#define WM8994_AIF1_DAC1_EQ_BAND_1_C 0x494
#define WM8994_AIF1_DAC2_EQ_GAINS_1 0x4A0
#define WM8994_AIF1_DAC2_EQ_GAINS_2 0x4A1
#define WM8994_AIF1_DAC2_EQ_BAND_1_A 0x4A2
@@ -183,6 +192,7 @@
#define WM8994_AIF1_DAC2_EQ_BAND_5_A 0x4B1
#define WM8994_AIF1_DAC2_EQ_BAND_5_B 0x4B2
#define WM8994_AIF1_DAC2_EQ_BAND_5_PG 0x4B3
+#define WM8994_AIF1_DAC2_EQ_BAND_1_C 0x4B4
#define WM8994_AIF2_ADC_LEFT_VOLUME 0x500
#define WM8994_AIF2_ADC_RIGHT_VOLUME 0x501
#define WM8994_AIF2_DAC_LEFT_VOLUME 0x502
@@ -190,6 +200,7 @@
#define WM8994_AIF2_ADC_FILTERS 0x510
#define WM8994_AIF2_DAC_FILTERS_1 0x520
#define WM8994_AIF2_DAC_FILTERS_2 0x521
+#define WM8958_AIF2_DAC_NOISE_GATE 0x530
#define WM8994_AIF2_DRC_1 0x540
#define WM8994_AIF2_DRC_2 0x541
#define WM8994_AIF2_DRC_3 0x542
@@ -215,6 +226,7 @@
#define WM8994_AIF2_EQ_BAND_5_A 0x591
#define WM8994_AIF2_EQ_BAND_5_B 0x592
#define WM8994_AIF2_EQ_BAND_5_PG 0x593
+#define WM8994_AIF2_EQ_BAND_1_C 0x594
#define WM8994_DAC1_MIXER_VOLUMES 0x600
#define WM8994_DAC1_LEFT_MIXER_ROUTING 0x601
#define WM8994_DAC1_RIGHT_MIXER_ROUTING 0x602
@@ -238,6 +250,7 @@
#define WM8994_GPIO_4 0x703
#define WM8994_GPIO_5 0x704
#define WM8994_GPIO_6 0x705
+#define WM1811_JACKDET_CTRL 0x705
#define WM8994_GPIO_7 0x706
#define WM8994_GPIO_8 0x707
#define WM8994_GPIO_9 0x708
@@ -260,7 +273,43 @@
#define WM8958_DSP2_RELEASETIME 0xA03
#define WM8958_DSP2_VERMAJMIN 0xA04
#define WM8958_DSP2_VERBUILD 0xA05
+#define WM8958_DSP2_TESTREG 0xA06
+#define WM8958_DSP2_XORREG 0xA07
+#define WM8958_DSP2_SHIFTMAXX 0xA08
+#define WM8958_DSP2_SHIFTMAXY 0xA09
+#define WM8958_DSP2_SHIFTMAXZ 0xA0A
+#define WM8958_DSP2_SHIFTMAXEXTLO 0xA0B
+#define WM8958_DSP2_AESSELECT 0xA0C
#define WM8958_DSP2_EXECCONTROL 0xA0D
+#define WM8958_DSP2_SAMPLEBREAK 0xA0E
+#define WM8958_DSP2_COUNTBREAK 0xA0F
+#define WM8958_DSP2_INTSTATUS 0xA10
+#define WM8958_DSP2_EVENTSTATUS 0xA11
+#define WM8958_DSP2_INTMASK 0xA12
+#define WM8958_DSP2_CONFIGDWIDTH 0xA13
+#define WM8958_DSP2_CONFIGINSTR 0xA14
+#define WM8958_DSP2_CONFIGDMEM 0xA15
+#define WM8958_DSP2_CONFIGDELAYS 0xA16
+#define WM8958_DSP2_CONFIGNUMIO 0xA17
+#define WM8958_DSP2_CONFIGEXTDEPTH 0xA18
+#define WM8958_DSP2_CONFIGMULTIPLIER 0xA19
+#define WM8958_DSP2_CONFIGCTRLDWIDTH 0xA1A
+#define WM8958_DSP2_CONFIGPIPELINE 0xA1B
+#define WM8958_DSP2_SHIFTMAXEXTHI 0xA1C
+#define WM8958_DSP2_SWVERSIONREG 0xA1D
+#define WM8958_DSP2_CONFIGXMEM 0xA1E
+#define WM8958_DSP2_CONFIGYMEM 0xA1F
+#define WM8958_DSP2_CONFIGZMEM 0xA20
+#define WM8958_FW_BUILD_1 0x2000
+#define WM8958_FW_BUILD_0 0x2001
+#define WM8958_FW_ID_1 0x2002
+#define WM8958_FW_ID_0 0x2003
+#define WM8958_FW_MAJOR_1 0x2004
+#define WM8958_FW_MAJOR_0 0x2005
+#define WM8958_FW_MINOR_1 0x2006
+#define WM8958_FW_MINOR_0 0x2007
+#define WM8958_FW_PATCH_1 0x2008
+#define WM8958_FW_PATCH_0 0x2009
#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C1_1 0x2200
#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C1_2 0x2201
#define WM8958_MBC_BAND_2_LOWER_CUTOFF_C2_1 0x2202
@@ -329,6 +378,14 @@
#define WM8958_MBC_B2_PG2_2 0x242D
#define WM8958_MBC_B1_PG2_1 0x242E
#define WM8958_MBC_B1_PG2_2 0x242F
+#define WM8958_MBC_CROSSOVER_1 0x2600
+#define WM8958_MBC_CROSSOVER_2 0x2601
+#define WM8958_MBC_HPF_1 0x2602
+#define WM8958_MBC_HPF_2 0x2603
+#define WM8958_MBC_LPF_1 0x2606
+#define WM8958_MBC_LPF_2 0x2607
+#define WM8958_MBC_RMS_LIMIT_1 0x260A
+#define WM8958_MBC_RMS_LIMIT_2 0x260B
#define WM8994_WRITE_SEQUENCER_0 0x3000
#define WM8994_WRITE_SEQUENCER_1 0x3001
#define WM8994_WRITE_SEQUENCER_2 0x3002
@@ -1848,6 +1905,9 @@
/*
* R57 (0x39) - AntiPOP (2)
*/
+#define WM1811_JACKDET_MODE_MASK 0x0180 /* JACKDET_MODE - [8:7] */
+#define WM1811_JACKDET_MODE_SHIFT 7 /* JACKDET_MODE - [8:7] */
+#define WM1811_JACKDET_MODE_WIDTH 2 /* JACKDET_MODE - [8:7] */
#define WM8994_MICB2_DISCH 0x0100 /* MICB2_DISCH */
#define WM8994_MICB2_DISCH_MASK 0x0100 /* MICB2_DISCH */
#define WM8994_MICB2_DISCH_SHIFT 8 /* MICB2_DISCH */
@@ -1921,6 +1981,59 @@
#define WM8994_LDO2_DISCH_WIDTH 1 /* LDO2_DISCH */
/*
+ * R61 (0x3D) - MICBIAS1
+ */
+#define WM8958_MICB1_RATE 0x0020 /* MICB1_RATE */
+#define WM8958_MICB1_RATE_MASK 0x0020 /* MICB1_RATE */
+#define WM8958_MICB1_RATE_SHIFT 5 /* MICB1_RATE */
+#define WM8958_MICB1_RATE_WIDTH 1 /* MICB1_RATE */
+#define WM8958_MICB1_MODE 0x0010 /* MICB1_MODE */
+#define WM8958_MICB1_MODE_MASK 0x0010 /* MICB1_MODE */
+#define WM8958_MICB1_MODE_SHIFT 4 /* MICB1_MODE */
+#define WM8958_MICB1_MODE_WIDTH 1 /* MICB1_MODE */
+#define WM8958_MICB1_LVL_MASK 0x000E /* MICB1_LVL - [3:1] */
+#define WM8958_MICB1_LVL_SHIFT 1 /* MICB1_LVL - [3:1] */
+#define WM8958_MICB1_LVL_WIDTH 3 /* MICB1_LVL - [3:1] */
+#define WM8958_MICB1_DISCH 0x0001 /* MICB1_DISCH */
+#define WM8958_MICB1_DISCH_MASK 0x0001 /* MICB1_DISCH */
+#define WM8958_MICB1_DISCH_SHIFT 0 /* MICB1_DISCH */
+#define WM8958_MICB1_DISCH_WIDTH 1 /* MICB1_DISCH */
+
+/*
+ * R62 (0x3E) - MICBIAS2
+ */
+#define WM8958_MICB2_RATE 0x0020 /* MICB2_RATE */
+#define WM8958_MICB2_RATE_MASK 0x0020 /* MICB2_RATE */
+#define WM8958_MICB2_RATE_SHIFT 5 /* MICB2_RATE */
+#define WM8958_MICB2_RATE_WIDTH 1 /* MICB2_RATE */
+#define WM8958_MICB2_MODE 0x0010 /* MICB2_MODE */
+#define WM8958_MICB2_MODE_MASK 0x0010 /* MICB2_MODE */
+#define WM8958_MICB2_MODE_SHIFT 4 /* MICB2_MODE */
+#define WM8958_MICB2_MODE_WIDTH 1 /* MICB2_MODE */
+#define WM8958_MICB2_LVL_MASK 0x000E /* MICB2_LVL - [3:1] */
+#define WM8958_MICB2_LVL_SHIFT 1 /* MICB2_LVL - [3:1] */
+#define WM8958_MICB2_LVL_WIDTH 3 /* MICB2_LVL - [3:1] */
+#define WM8958_MICB2_DISCH 0x0001 /* MICB2_DISCH */
+#define WM8958_MICB2_DISCH_MASK 0x0001 /* MICB2_DISCH */
+#define WM8958_MICB2_DISCH_SHIFT 0 /* MICB2_DISCH */
+#define WM8958_MICB2_DISCH_WIDTH 1 /* MICB2_DISCH */
+
+/*
+ * R210 (0xD2) - Mic Detect 3
+ */
+#define WM8958_MICD_LVL_MASK 0x07FC /* MICD_LVL - [10:2] */
+#define WM8958_MICD_LVL_SHIFT 2 /* MICD_LVL - [10:2] */
+#define WM8958_MICD_LVL_WIDTH 9 /* MICD_LVL - [10:2] */
+#define WM8958_MICD_VALID 0x0002 /* MICD_VALID */
+#define WM8958_MICD_VALID_MASK 0x0002 /* MICD_VALID */
+#define WM8958_MICD_VALID_SHIFT 1 /* MICD_VALID */
+#define WM8958_MICD_VALID_WIDTH 1 /* MICD_VALID */
+#define WM8958_MICD_STS 0x0001 /* MICD_STS */
+#define WM8958_MICD_STS_MASK 0x0001 /* MICD_STS */
+#define WM8958_MICD_STS_SHIFT 0 /* MICD_STS */
+#define WM8958_MICD_STS_WIDTH 1 /* MICD_STS */
+
+/*
* R76 (0x4C) - Charge Pump (1)
*/
#define WM8994_CP_ENA 0x8000 /* CP_ENA */
@@ -2027,6 +2140,10 @@
/*
* R96 (0x60) - Analogue HP (1)
*/
+#define WM1811_HPOUT1_ATTN 0x0100 /* HPOUT1_ATTN */
+#define WM1811_HPOUT1_ATTN_MASK 0x0100 /* HPOUT1_ATTN */
+#define WM1811_HPOUT1_ATTN_SHIFT 8 /* HPOUT1_ATTN */
+#define WM1811_HPOUT1_ATTN_WIDTH 1 /* HPOUT1_ATTN */
#define WM8994_HPOUT1L_RMV_SHORT 0x0080 /* HPOUT1L_RMV_SHORT */
#define WM8994_HPOUT1L_RMV_SHORT_MASK 0x0080 /* HPOUT1L_RMV_SHORT */
#define WM8994_HPOUT1L_RMV_SHORT_SHIFT 7 /* HPOUT1L_RMV_SHORT */
@@ -2095,6 +2212,9 @@
/*
* R256 (0x100) - Chip Revision
*/
+#define WM8994_CUST_ID_MASK 0xFF00 /* CUST_ID - [15:8] */
+#define WM8994_CUST_ID_SHIFT 8 /* CUST_ID - [15:8] */
+#define WM8994_CUST_ID_WIDTH 8 /* CUST_ID - [15:8] */
#define WM8994_CHIP_REV_MASK 0x000F /* CHIP_REV - [3:0] */
#define WM8994_CHIP_REV_SHIFT 0 /* CHIP_REV - [3:0] */
#define WM8994_CHIP_REV_WIDTH 4 /* CHIP_REV - [3:0] */
@@ -2328,6 +2448,10 @@
/*
* R548 (0x224) - FLL1 Control (5)
*/
+#define WM8958_FLL1_BYP 0x8000 /* FLL1_BYP */
+#define WM8958_FLL1_BYP_MASK 0x8000 /* FLL1_BYP */
+#define WM8958_FLL1_BYP_SHIFT 15 /* FLL1_BYP */
+#define WM8958_FLL1_BYP_WIDTH 1 /* FLL1_BYP */
#define WM8994_FLL1_FRC_NCO_VAL_MASK 0x1F80 /* FLL1_FRC_NCO_VAL - [12:7] */
#define WM8994_FLL1_FRC_NCO_VAL_SHIFT 7 /* FLL1_FRC_NCO_VAL - [12:7] */
#define WM8994_FLL1_FRC_NCO_VAL_WIDTH 6 /* FLL1_FRC_NCO_VAL - [12:7] */
@@ -2343,6 +2467,24 @@
#define WM8994_FLL1_REFCLK_SRC_WIDTH 2 /* FLL1_REFCLK_SRC - [1:0] */
/*
+ * R550 (0x226) - FLL1 EFS 1
+ */
+#define WM8958_FLL1_LAMBDA_MASK 0xFFFF /* FLL1_LAMBDA - [15:0] */
+#define WM8958_FLL1_LAMBDA_SHIFT 0 /* FLL1_LAMBDA - [15:0] */
+#define WM8958_FLL1_LAMBDA_WIDTH 16 /* FLL1_LAMBDA - [15:0] */
+
+/*
+ * R551 (0x227) - FLL1 EFS 2
+ */
+#define WM8958_FLL1_LFSR_SEL_MASK 0x0006 /* FLL1_LFSR_SEL - [2:1] */
+#define WM8958_FLL1_LFSR_SEL_SHIFT 1 /* FLL1_LFSR_SEL - [2:1] */
+#define WM8958_FLL1_LFSR_SEL_WIDTH 2 /* FLL1_LFSR_SEL - [2:1] */
+#define WM8958_FLL1_EFS_ENA 0x0001 /* FLL1_EFS_ENA */
+#define WM8958_FLL1_EFS_ENA_MASK 0x0001 /* FLL1_EFS_ENA */
+#define WM8958_FLL1_EFS_ENA_SHIFT 0 /* FLL1_EFS_ENA */
+#define WM8958_FLL1_EFS_ENA_WIDTH 1 /* FLL1_EFS_ENA */
+
+/*
* R576 (0x240) - FLL2 Control (1)
*/
#define WM8994_FLL2_FRAC 0x0004 /* FLL2_FRAC */
@@ -2391,6 +2533,10 @@
/*
* R580 (0x244) - FLL2 Control (5)
*/
+#define WM8958_FLL2_BYP 0x8000 /* FLL2_BYP */
+#define WM8958_FLL2_BYP_MASK 0x8000 /* FLL2_BYP */
+#define WM8958_FLL2_BYP_SHIFT 15 /* FLL2_BYP */
+#define WM8958_FLL2_BYP_WIDTH 1 /* FLL2_BYP */
#define WM8994_FLL2_FRC_NCO_VAL_MASK 0x1F80 /* FLL2_FRC_NCO_VAL - [12:7] */
#define WM8994_FLL2_FRC_NCO_VAL_SHIFT 7 /* FLL2_FRC_NCO_VAL - [12:7] */
#define WM8994_FLL2_FRC_NCO_VAL_WIDTH 6 /* FLL2_FRC_NCO_VAL - [12:7] */
@@ -2406,6 +2552,24 @@
#define WM8994_FLL2_REFCLK_SRC_WIDTH 2 /* FLL2_REFCLK_SRC - [1:0] */
/*
+ * R582 (0x246) - FLL2 EFS 1
+ */
+#define WM8958_FLL2_LAMBDA_MASK 0xFFFF /* FLL2_LAMBDA - [15:0] */
+#define WM8958_FLL2_LAMBDA_SHIFT 0 /* FLL2_LAMBDA - [15:0] */
+#define WM8958_FLL2_LAMBDA_WIDTH 16 /* FLL2_LAMBDA - [15:0] */
+
+/*
+ * R583 (0x247) - FLL2 EFS 2
+ */
+#define WM8958_FLL2_LFSR_SEL_MASK 0x0006 /* FLL2_LFSR_SEL - [2:1] */
+#define WM8958_FLL2_LFSR_SEL_SHIFT 1 /* FLL2_LFSR_SEL - [2:1] */
+#define WM8958_FLL2_LFSR_SEL_WIDTH 2 /* FLL2_LFSR_SEL - [2:1] */
+#define WM8958_FLL2_EFS_ENA 0x0001 /* FLL2_EFS_ENA */
+#define WM8958_FLL2_EFS_ENA_MASK 0x0001 /* FLL2_EFS_ENA */
+#define WM8958_FLL2_EFS_ENA_SHIFT 0 /* FLL2_EFS_ENA */
+#define WM8958_FLL2_EFS_ENA_WIDTH 1 /* FLL2_EFS_ENA */
+
+/*
* R768 (0x300) - AIF1 Control (1)
*/
#define WM8994_AIF1ADCL_SRC 0x8000 /* AIF1ADCL_SRC */
@@ -2949,6 +3113,34 @@
#define WM8994_AIF1DAC2_3D_ENA_WIDTH 1 /* AIF1DAC2_3D_ENA */
/*
+ * R1072 (0x430) - AIF1 DAC1 Noise Gate
+ */
+#define WM8958_AIF1DAC1_NG_HLD_MASK 0x0060 /* AIF1DAC1_NG_HLD - [6:5] */
+#define WM8958_AIF1DAC1_NG_HLD_SHIFT 5 /* AIF1DAC1_NG_HLD - [6:5] */
+#define WM8958_AIF1DAC1_NG_HLD_WIDTH 2 /* AIF1DAC1_NG_HLD - [6:5] */
+#define WM8958_AIF1DAC1_NG_THR_MASK 0x000E /* AIF1DAC1_NG_THR - [3:1] */
+#define WM8958_AIF1DAC1_NG_THR_SHIFT 1 /* AIF1DAC1_NG_THR - [3:1] */
+#define WM8958_AIF1DAC1_NG_THR_WIDTH 3 /* AIF1DAC1_NG_THR - [3:1] */
+#define WM8958_AIF1DAC1_NG_ENA 0x0001 /* AIF1DAC1_NG_ENA */
+#define WM8958_AIF1DAC1_NG_ENA_MASK 0x0001 /* AIF1DAC1_NG_ENA */
+#define WM8958_AIF1DAC1_NG_ENA_SHIFT 0 /* AIF1DAC1_NG_ENA */
+#define WM8958_AIF1DAC1_NG_ENA_WIDTH 1 /* AIF1DAC1_NG_ENA */
+
+/*
+ * R1073 (0x431) - AIF1 DAC2 Noise Gate
+ */
+#define WM8958_AIF1DAC2_NG_HLD_MASK 0x0060 /* AIF1DAC2_NG_HLD - [6:5] */
+#define WM8958_AIF1DAC2_NG_HLD_SHIFT 5 /* AIF1DAC2_NG_HLD - [6:5] */
+#define WM8958_AIF1DAC2_NG_HLD_WIDTH 2 /* AIF1DAC2_NG_HLD - [6:5] */
+#define WM8958_AIF1DAC2_NG_THR_MASK 0x000E /* AIF1DAC2_NG_THR - [3:1] */
+#define WM8958_AIF1DAC2_NG_THR_SHIFT 1 /* AIF1DAC2_NG_THR - [3:1] */
+#define WM8958_AIF1DAC2_NG_THR_WIDTH 3 /* AIF1DAC2_NG_THR - [3:1] */
+#define WM8958_AIF1DAC2_NG_ENA 0x0001 /* AIF1DAC2_NG_ENA */
+#define WM8958_AIF1DAC2_NG_ENA_MASK 0x0001 /* AIF1DAC2_NG_ENA */
+#define WM8958_AIF1DAC2_NG_ENA_SHIFT 0 /* AIF1DAC2_NG_ENA */
+#define WM8958_AIF1DAC2_NG_ENA_WIDTH 1 /* AIF1DAC2_NG_ENA */
+
+/*
* R1088 (0x440) - AIF1 DRC1 (1)
*/
#define WM8994_AIF1DRC1_SIG_DET_RMS_MASK 0xF800 /* AIF1DRC1_SIG_DET_RMS - [15:11] */
@@ -3560,6 +3752,20 @@
#define WM8994_AIF2DAC_3D_ENA_WIDTH 1 /* AIF2DAC_3D_ENA */
/*
+ * R1328 (0x530) - AIF2 DAC Noise Gate
+ */
+#define WM8958_AIF2DAC_NG_HLD_MASK 0x0060 /* AIF2DAC_NG_HLD - [6:5] */
+#define WM8958_AIF2DAC_NG_HLD_SHIFT 5 /* AIF2DAC_NG_HLD - [6:5] */
+#define WM8958_AIF2DAC_NG_HLD_WIDTH 2 /* AIF2DAC_NG_HLD - [6:5] */
+#define WM8958_AIF2DAC_NG_THR_MASK 0x000E /* AIF2DAC_NG_THR - [3:1] */
+#define WM8958_AIF2DAC_NG_THR_SHIFT 1 /* AIF2DAC_NG_THR - [3:1] */
+#define WM8958_AIF2DAC_NG_THR_WIDTH 3 /* AIF2DAC_NG_THR - [3:1] */
+#define WM8958_AIF2DAC_NG_ENA 0x0001 /* AIF2DAC_NG_ENA */
+#define WM8958_AIF2DAC_NG_ENA_MASK 0x0001 /* AIF2DAC_NG_ENA */
+#define WM8958_AIF2DAC_NG_ENA_SHIFT 0 /* AIF2DAC_NG_ENA */
+#define WM8958_AIF2DAC_NG_ENA_WIDTH 1 /* AIF2DAC_NG_ENA */
+
+/*
* R1344 (0x540) - AIF2 DRC (1)
*/
#define WM8994_AIF2DRC_SIG_DET_RMS_MASK 0xF800 /* AIF2DRC_SIG_DET_RMS - [15:11] */
@@ -4084,6 +4290,18 @@
#define WM8994_STL_SEL_WIDTH 1 /* STL_SEL */
/*
+ * R1797 (0x705) - JACKDET Ctrl
+ */
+#define WM1811_JACKDET_DB 0x0100 /* JACKDET_DB */
+#define WM1811_JACKDET_DB_MASK 0x0100 /* JACKDET_DB */
+#define WM1811_JACKDET_DB_SHIFT 8 /* JACKDET_DB */
+#define WM1811_JACKDET_DB_WIDTH 1 /* JACKDET_DB */
+#define WM1811_JACKDET_LVL 0x0040 /* JACKDET_LVL */
+#define WM1811_JACKDET_LVL_MASK 0x0040 /* JACKDET_LVL */
+#define WM1811_JACKDET_LVL_SHIFT 6 /* JACKDET_LVL */
+#define WM1811_JACKDET_LVL_WIDTH 1 /* JACKDET_LVL */
+
+/*
* R1824 (0x720) - Pull Control (1)
*/
#define WM8994_DMICDAT2_PU 0x0800 /* DMICDAT2_PU */
diff --git a/include/linux/mhd9234.h b/include/linux/mhd9234.h
new file mode 100644
index 0000000..92e38af
--- /dev/null
+++ b/include/linux/mhd9234.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _SII9234_H_
+#define _SII9234_H_
+
+#ifdef __KERNEL__
+
+struct sii9234_platform_data {
+ void (*hw_reset)(void);
+ void (*hw_off)(void);
+};
+
+#endif
+
+#ifdef CONFIG_SAMSUNG_WORKAROUND_HPD_GLANCE
+extern void mhl_hpd_handler(bool onoff);
+#endif
+#endif
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 18eea05..f59179b 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);
int shmem_lock(struct file *file, int lock, struct user_struct *user);
struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags);
+void shmem_set_file(struct vm_area_struct *vma, struct file *file);
int shmem_zero_setup(struct vm_area_struct *);
extern int can_do_mlock(void);
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 6ad4355..6ca73e3 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -50,8 +50,16 @@ struct mmc_ext_csd {
u8 rel_sectors;
u8 rel_param;
u8 part_config;
+ u8 boot_part_prot;
+ u8 rst_n_function;
+ u8 cache_ctrl;
+ u8 max_packed_writes;
+ u8 max_packed_reads;
+ u8 packed_event_en;
unsigned int part_time; /* Units: ms */
unsigned int sa_timeout; /* Units: 100ns */
+ unsigned int generic_cmd6_time; /* Units: 10ms */
+ unsigned int power_off_longtime; /* Units: ms */
unsigned int hs_max_dtr;
unsigned int sectors;
unsigned int card_type;
@@ -64,10 +72,15 @@ struct mmc_ext_csd {
unsigned long long enhanced_area_offset; /* Units: Byte */
unsigned int enhanced_area_size; /* Units: KB */
unsigned int boot_size; /* in bytes */
+ unsigned int cache_size; /* Units: KB */
+ bool hpi_en; /* HPI enablebit */
+ bool hpi; /* HPI support bit */
+ unsigned int hpi_cmd; /* cmd used as HPI */
u8 raw_partition_support; /* 160 */
u8 raw_erased_mem_count; /* 181 */
u8 raw_ext_csd_structure; /* 194 */
u8 raw_card_type; /* 196 */
+ u8 out_of_int_time; /* 198 */
u8 raw_s_a_timeout; /* 217 */
u8 raw_hc_erase_gap_size; /* 221 */
u8 raw_erase_timeout_mult; /* 223 */
@@ -77,6 +90,9 @@ struct mmc_ext_csd {
u8 raw_sec_feature_support;/* 231 */
u8 raw_trim_mult; /* 232 */
u8 raw_sectors[4]; /* 212 - 4 bytes */
+
+ unsigned int feature_support;
+#define MMC_DISCARD_FEATURE BIT(0) /* CMD38 feature */
};
struct sd_scr {
@@ -177,6 +193,8 @@ struct mmc_card {
#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */
#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */
#define MMC_CARD_SDXC (1<<6) /* card is SDXC */
+#define MMC_CARD_REMOVED (1<<7) /* card has been removed */
+#define MMC_STATE_HIGHSPEED_200 (1<<8) /* card is in HS200 mode */
unsigned int quirks; /* card quirks */
#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
@@ -189,6 +207,12 @@ struct mmc_card {
#define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */
#define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */
+ unsigned int poweroff_notify_state; /* eMMC4.5 notify feature */
+#define MMC_NO_POWER_NOTIFICATION 0
+#define MMC_POWERED_ON 1
+#define MMC_POWEROFF_SHORT 2
+#define MMC_POWEROFF_LONG 3
+
unsigned int erase_size; /* erase size in sectors */
unsigned int erase_shift; /* if erase unit is power 2 */
unsigned int pref_erase; /* in sectors */
@@ -310,18 +334,24 @@ static inline void __maybe_unused remove_quirk(struct mmc_card *card, int data)
#define mmc_card_present(c) ((c)->state & MMC_STATE_PRESENT)
#define mmc_card_readonly(c) ((c)->state & MMC_STATE_READONLY)
#define mmc_card_highspeed(c) ((c)->state & MMC_STATE_HIGHSPEED)
+#define mmc_card_hs200(c) ((c)->state & MMC_STATE_HIGHSPEED_200)
#define mmc_card_blockaddr(c) ((c)->state & MMC_STATE_BLOCKADDR)
#define mmc_card_ddr_mode(c) ((c)->state & MMC_STATE_HIGHSPEED_DDR)
-#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
+#define mmc_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
+#define mmc_sd_card_uhs(c) ((c)->state & MMC_STATE_ULTRAHIGHSPEED)
#define mmc_card_ext_capacity(c) ((c)->state & MMC_CARD_SDXC)
+#define mmc_card_removed(c) ((c) && ((c)->state & MMC_CARD_REMOVED))
#define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
#define mmc_card_set_readonly(c) ((c)->state |= MMC_STATE_READONLY)
#define mmc_card_set_highspeed(c) ((c)->state |= MMC_STATE_HIGHSPEED)
+#define mmc_card_set_hs200(c) ((c)->state |= MMC_STATE_HIGHSPEED_200)
#define mmc_card_set_blockaddr(c) ((c)->state |= MMC_STATE_BLOCKADDR)
#define mmc_card_set_ddr_mode(c) ((c)->state |= MMC_STATE_HIGHSPEED_DDR)
+#define mmc_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
#define mmc_sd_card_set_uhs(c) ((c)->state |= MMC_STATE_ULTRAHIGHSPEED)
#define mmc_card_set_ext_capacity(c) ((c)->state |= MMC_CARD_SDXC)
+#define mmc_card_set_removed(c) ((c)->state |= MMC_CARD_REMOVED)
/*
* Quirk add/remove for MMC products.
diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h
index b6718e5..3d055c3 100644
--- a/include/linux/mmc/core.h
+++ b/include/linux/mmc/core.h
@@ -18,6 +18,8 @@ struct mmc_request;
struct mmc_command {
u32 opcode;
u32 arg;
+#define MMC_CMD23_ARG_REL_WR (1 << 31)
+#define MMC_CMD23_ARG_PACKED ((0 << 31) | (1 << 30))
u32 resp[4];
unsigned int flags; /* expected response type */
#define MMC_RSP_PRESENT (1 << 0)
@@ -117,6 +119,7 @@ struct mmc_data {
unsigned int sg_len; /* size of scatter list */
struct scatterlist *sg; /* I/O scatter list */
+ s32 host_cookie; /* host private data */
};
struct mmc_request {
@@ -125,23 +128,29 @@ struct mmc_request {
struct mmc_data *data;
struct mmc_command *stop;
- void *done_data; /* completion data */
+ struct completion completion;
void (*done)(struct mmc_request *);/* completion function */
};
struct mmc_host;
struct mmc_card;
+struct mmc_async_req;
+extern struct mmc_async_req *mmc_start_req(struct mmc_host *,
+ struct mmc_async_req *, int *);
+extern int mmc_interrupt_hpi(struct mmc_card *);
extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
extern int mmc_app_cmd(struct mmc_host *, struct mmc_card *);
extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
struct mmc_command *, int);
extern int mmc_switch(struct mmc_card *, u8, u8, u8, unsigned int);
+extern int mmc_send_ext_csd(struct mmc_card *card, u8 *ext_csd);
#define MMC_ERASE_ARG 0x00000000
#define MMC_SECURE_ERASE_ARG 0x80000000
#define MMC_TRIM_ARG 0x00000001
+#define MMC_DISCARD_ARG 0x00000003
#define MMC_SECURE_TRIM1_ARG 0x80000001
#define MMC_SECURE_TRIM2_ARG 0x80008000
@@ -152,11 +161,17 @@ extern int mmc_erase(struct mmc_card *card, unsigned int from, unsigned int nr,
unsigned int arg);
extern int mmc_can_erase(struct mmc_card *card);
extern int mmc_can_trim(struct mmc_card *card);
+extern int mmc_can_discard(struct mmc_card *card);
+extern int mmc_can_sanitize(struct mmc_card *card);
extern int mmc_can_secure_erase_trim(struct mmc_card *card);
extern int mmc_erase_group_aligned(struct mmc_card *card, unsigned int from,
unsigned int nr);
+extern unsigned int mmc_calc_max_discard(struct mmc_card *card);
extern int mmc_set_blocklen(struct mmc_card *card, unsigned int blocklen);
+extern int mmc_hw_reset(struct mmc_host *host);
+extern int mmc_hw_reset_check(struct mmc_host *host);
+extern int mmc_can_reset(struct mmc_card *card);
extern void mmc_set_data_timeout(struct mmc_data *, const struct mmc_card *);
extern unsigned int mmc_align_data_size(struct mmc_card *, unsigned int);
@@ -166,6 +181,10 @@ extern void mmc_release_host(struct mmc_host *host);
extern void mmc_do_release_host(struct mmc_host *host);
extern int mmc_try_claim_host(struct mmc_host *host);
+extern int mmc_flush_cache(struct mmc_card *);
+
+extern int mmc_detect_card_removed(struct mmc_host *host);
+
/**
* mmc_claim_host - exclusively claim a host
* @host: mmc host to claim
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index bdd7cee..99df319 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -14,6 +14,8 @@
#ifndef _LINUX_MMC_DW_MMC_H_
#define _LINUX_MMC_DW_MMC_H_
+#include <linux/scatterlist.h>
+
#define MAX_MCI_SLOTS 2
enum dw_mci_state {
@@ -35,6 +37,11 @@ enum {
struct mmc_data;
+struct dw_mci_next {
+ unsigned int sg_len;
+ s32 cookie;
+};
+
/**
* struct dw_mci - MMC controller state shared between all slots
* @lock: Spinlock protecting the queue and associated data.
@@ -74,6 +81,7 @@ struct mmc_data;
* @pdev: Platform device associated with the MMC controller.
* @pdata: Platform data associated with the MMC controller.
* @slot: Slots sharing this MMC controller.
+ * @fifo_depth: depth of FIFO.
* @data_shift: log2 of FIFO item size.
* @push_data: Pointer to FIFO push function.
* @pull_data: Pointer to FIFO pull function.
@@ -108,19 +116,24 @@ struct dw_mci {
void __iomem *regs;
struct scatterlist *sg;
- unsigned int pio_offset;
+ struct sg_mapping_iter sg_miter;
struct dw_mci_slot *cur_slot;
struct mmc_request *mrq;
struct mmc_command *cmd;
struct mmc_data *data;
+ struct clk *hclk;
+ struct clk *cclk;
+ bool prv_err;
/* DMA interface members*/
int use_dma;
+ int using_dma;
dma_addr_t sg_dma;
void *sg_cpu;
struct dw_mci_dma_ops *dma_ops;
+ unsigned int buf_size;
#ifdef CONFIG_MMC_DW_IDMAC
unsigned int ring_size;
#else
@@ -141,11 +154,14 @@ struct dw_mci {
u32 current_speed;
u32 num_slots;
u32 fifoth_val;
+ u16 verid;
+ u16 data_offset;
struct platform_device *pdev;
struct dw_mci_board *pdata;
struct dw_mci_slot *slot[MAX_MCI_SLOTS];
/* FIFO push and pull */
+ int fifo_depth;
int data_shift;
void (*push_data)(struct dw_mci *host, void *buf, int cnt);
void (*pull_data)(struct dw_mci *host, void *buf, int cnt);
@@ -154,6 +170,7 @@ struct dw_mci {
u32 quirks;
struct regulator *vmmc; /* Power regulator */
+ struct dw_mci_next next_data;
};
/* DMA ops for Internal/External DMAC interface */
@@ -177,6 +194,13 @@ struct dw_mci_dma_ops {
/* Unreliable card detection */
#define DW_MCI_QUIRK_BROKEN_CARD_DETECTION BIT(3)
+enum dw_mci_cd_types {
+ DW_MCI_CD_INTERNAL, /* use mmc internal CD line */
+ DW_MCI_CD_EXTERNAL, /* use external callback */
+ DW_MCI_CD_GPIO, /* use external gpio pin for CD line */
+ DW_MCI_CD_NONE, /* no CD line, use polling to detect card */
+ DW_MCI_CD_PERMANENT, /* no CD line, card permanently wired to host */
+};
struct dma_pdata;
@@ -196,15 +220,49 @@ struct dw_mci_board {
unsigned int bus_hz; /* Bus speed */
unsigned int caps; /* Capabilities */
+ unsigned int caps2; /* More capabilities */
+ /*
+ * Override fifo depth. If 0, autodetect it from the FIFOTH register,
+ * but note that this may not be reliable after a bootloader has used
+ * it.
+ */
+ unsigned int fifo_depth;
+
+ unsigned int buf_size; /* Buffer size */
/* delay in mS before detecting cards after interrupt */
u32 detect_delay_ms;
+ char *hclk_name;
+ char *cclk_name;
+
int (*init)(u32 slot_id, irq_handler_t , void *);
int (*get_ro)(u32 slot_id);
int (*get_cd)(u32 slot_id);
int (*get_ocr)(u32 slot_id);
int (*get_bus_wd)(u32 slot_id);
+ void (*cfg_gpio)(int width);
+ void (*set_io_timing)(void *data, unsigned char timing);
+
+ /* Phase Shift Value */
+ unsigned int sdr_timing;
+ unsigned int ddr_timing;
+
+ /* cd_type: Type of Card Detection method (see cd_types enum above) */
+
+ enum dw_mci_cd_types cd_type;
+
+ /* ext_cd_cleanup: Cleanup external card detect subsystem.
+ * ext_cd_init: Initialize external card detect subsystem.
+ * notify_func argument is a callback to the dwmci driver
+ * that triggers the card detection event. Callback arguments:
+ * dev is pointer to platform device of the host controller,
+ * state is new state of the card (0 - removed, 1 - inserted).
+ */
+
+ int (*ext_cd_init)(void (*notify_func)(struct platform_device *, int state));
+ int (*ext_cd_cleanup)(void (*notify_func)(struct platform_device *,int state));
+
/*
* Enable power to selected slot and set voltage to desired level.
* 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 1ee4424..c5105b9 100644
--- a/include/linux/mmc/host.h
+++ b/include/linux/mmc/host.h
@@ -12,6 +12,7 @@
#include <linux/leds.h>
#include <linux/sched.h>
+#include <linux/wakelock.h>
#include <linux/mmc/core.h>
#include <linux/mmc/pm.h>
@@ -55,12 +56,15 @@ struct mmc_ios {
#define MMC_TIMING_UHS_SDR50 3
#define MMC_TIMING_UHS_SDR104 4
#define MMC_TIMING_UHS_DDR50 5
+#define MMC_TIMING_MMC_HS200 6
unsigned char ddr; /* dual data rate used */
#define MMC_SDR_MODE 0
#define MMC_1_2V_DDR_MODE 1
#define MMC_1_8V_DDR_MODE 2
+#define MMC_1_2V_SDR_MODE 3
+#define MMC_1_8V_SDR_MODE 4
unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */
@@ -106,6 +110,15 @@ struct mmc_host_ops {
*/
int (*enable)(struct mmc_host *host);
int (*disable)(struct mmc_host *host, int lazy);
+ /*
+ * It is optional for the host to implement pre_req and post_req in
+ * order to support double buffering of requests (prepare one
+ * request while another request is active).
+ */
+ void (*post_req)(struct mmc_host *host, struct mmc_request *req,
+ int err);
+ void (*pre_req)(struct mmc_host *host, struct mmc_request *req,
+ bool is_first_req);
void (*request)(struct mmc_host *host, struct mmc_request *req);
/*
* Avoid calling these three functions too often or in a "fast path",
@@ -137,13 +150,27 @@ struct mmc_host_ops {
void (*init_card)(struct mmc_host *host, struct mmc_card *card);
int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios);
- int (*execute_tuning)(struct mmc_host *host);
+
+ /* The tuning command opcode value is different for SD and eMMC cards */
+ int (*execute_tuning)(struct mmc_host *host, u32 opcode);
void (*enable_preset_value)(struct mmc_host *host, bool enable);
+ int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv);
+ void (*hw_reset)(struct mmc_host *host);
};
struct mmc_card;
struct device;
+struct mmc_async_req {
+ /* active mmc request */
+ struct mmc_request *mrq;
+ /*
+ * Check error status of completed mmc request.
+ * Returns 0 if success otherwise non zero.
+ */
+ int (*err_check) (struct mmc_card *, struct mmc_async_req *);
+};
+
struct mmc_host {
struct device *parent;
struct device class_dev;
@@ -211,17 +238,40 @@ struct mmc_host {
#define MMC_CAP_MAX_CURRENT_600 (1 << 28) /* Host max current limit is 600mA */
#define MMC_CAP_MAX_CURRENT_800 (1 << 29) /* Host max current limit is 800mA */
#define MMC_CAP_CMD23 (1 << 30) /* CMD23 supported. */
+#define MMC_CAP_HW_RESET (1 << 31) /* Hardware reset */
+
+ unsigned int caps2; /* More host capabilities */
+
+#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
+#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
+#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */
+#define MMC_CAP2_PACKED_RD (1 << 3) /* Allow packed read */
+#define MMC_CAP2_PACKED_WR (1 << 4) /* Allow packed write */
+#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
+ MMC_CAP2_PACKED_WR) /* Allow packed commands */
+#define MMC_CAP2_NO_MULTI_READ (1 << 5) /* Multiblock reads don't work */
+#define MMC_CAP2_NO_SLEEP_CMD (1 << 6) /* Don't allow sleep command */
+#define MMC_CAP2_HS200_1_8V_SDR (1 << 7) /* can support */
+#define MMC_CAP2_HS200_1_2V_SDR (1 << 8) /* can support */
+#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
+ MMC_CAP2_HS200_1_2V_SDR)
mmc_pm_flag_t pm_caps; /* supported pm features */
+ unsigned int power_notify_type;
+#define MMC_HOST_PW_NOTIFY_NONE 0
+#define MMC_HOST_PW_NOTIFY_SHORT 1
+#define MMC_HOST_PW_NOTIFY_LONG 2
#ifdef CONFIG_MMC_CLKGATE
int clk_requests; /* internal reference counter */
unsigned int clk_delay; /* number of MCI clk hold cycles */
bool clk_gated; /* clock gated */
- struct work_struct clk_gate_work; /* delayed clock gate */
+ struct delayed_work clk_gate_work; /* delayed clock gate */
unsigned int clk_old; /* old clock value cache */
spinlock_t clk_lock; /* lock for clk fields */
struct mutex clk_gate_mutex; /* mutex for clock gating */
+ struct device_attribute clkgate_delay_attr;
+ unsigned long clkgate_delay;
#endif
/* host specific block data */
@@ -231,6 +281,7 @@ struct mmc_host {
unsigned int max_req_size; /* maximum number of bytes in one req */
unsigned int max_blk_size; /* maximum size of one mmc block */
unsigned int max_blk_count; /* maximum number of blocks in one req */
+ unsigned int max_discard_to; /* max. discard timeout in ms */
/* private data */
spinlock_t lock; /* lock for claim and bus ops */
@@ -245,6 +296,22 @@ struct mmc_host {
#ifdef CONFIG_MMC_DEBUG
unsigned int removed:1; /* host is being removed */
#endif
+ unsigned int state; /* card slot state for SD */
+#define MMC_SD_STATE_PRESENT (1<<0) /* present state for SD */
+#define MMC_SD_INIT_STATUS (1<<1) /* present state for SD */
+#define MMC_SD_PREV_STATUS (1<<2) /* present state for SD */
+
+#define mmc_host_sd_present(h) ((h)->state & MMC_SD_STATE_PRESENT)
+#define mmc_host_sd_set_present(h) ((h)->state |= MMC_SD_STATE_PRESENT)
+#define mmc_host_sd_clear_present(h) ((h)->state &= ~MMC_SD_STATE_PRESENT)
+
+#define mmc_host_sd_init_stat(h) ((h)->state & MMC_SD_INIT_STATUS)
+#define mmc_host_sd_set_init_stat(h) ((h)->state |= MMC_SD_INIT_STATUS)
+#define mmc_host_sd_clear_init_stat(h) ((h)->state &= ~MMC_SD_INIT_STATUS)
+
+#define mmc_host_sd_prev_stat(h) ((h)->state & MMC_SD_PREV_STATUS)
+#define mmc_host_sd_set_prev_stat(h) ((h)->state |= MMC_SD_PREV_STATUS)
+#define mmc_host_sd_clear_prev_stat(h) ((h)->state &= ~MMC_SD_PREV_STATUS)
/* Only used with MMC_CAP_DISABLE */
int enabled; /* host is enabled */
@@ -261,10 +328,16 @@ struct mmc_host {
int claim_cnt; /* "claim" nesting count */
struct delayed_work detect;
+ int detect_change; /* card detect flag */
+ struct wake_lock detect_wake_lock;
const struct mmc_bus_ops *bus_ops; /* current bus driver */
unsigned int bus_refs; /* reference counter */
+ unsigned int bus_resume_flags;
+#define MMC_BUSRESUME_MANUAL_RESUME (1 << 0)
+#define MMC_BUSRESUME_NEEDS_RESUME (1 << 1)
+
unsigned int sdio_irqs;
struct task_struct *sdio_irq_thread;
atomic_t sdio_irq_thread_abort;
@@ -281,6 +354,17 @@ struct mmc_host {
struct dentry *debugfs_root;
+#ifdef CONFIG_MMC_EMBEDDED_SDIO
+ struct {
+ struct sdio_cis *cis;
+ struct sdio_cccr *cccr;
+ struct sdio_embedded_func *funcs;
+ int num_funcs;
+ } embedded_sdio_data;
+#endif
+
+ struct mmc_async_req *areq; /* active async req */
+
unsigned long private[0] ____cacheline_aligned;
};
@@ -289,6 +373,14 @@ extern int mmc_add_host(struct mmc_host *);
extern void mmc_remove_host(struct mmc_host *);
extern void mmc_free_host(struct mmc_host *);
+#ifdef CONFIG_MMC_EMBEDDED_SDIO
+extern void mmc_set_embedded_sdio_data(struct mmc_host *host,
+ struct sdio_cis *cis,
+ struct sdio_cccr *cccr,
+ struct sdio_embedded_func *funcs,
+ int num_funcs);
+#endif
+
static inline void *mmc_priv(struct mmc_host *host)
{
return (void *)host->private;
@@ -299,6 +391,18 @@ static inline void *mmc_priv(struct mmc_host *host)
#define mmc_dev(x) ((x)->parent)
#define mmc_classdev(x) (&(x)->class_dev)
#define mmc_hostname(x) (dev_name(&(x)->class_dev))
+#define mmc_bus_needs_resume(host) ((host)->bus_resume_flags & MMC_BUSRESUME_NEEDS_RESUME)
+#define mmc_bus_manual_resume(host) ((host)->bus_resume_flags & MMC_BUSRESUME_MANUAL_RESUME)
+
+static inline void mmc_set_bus_resume_policy(struct mmc_host *host, int manual)
+{
+ if (manual)
+ host->bus_resume_flags |= MMC_BUSRESUME_MANUAL_RESUME;
+ else
+ host->bus_resume_flags &= ~MMC_BUSRESUME_MANUAL_RESUME;
+}
+
+extern int mmc_resume_bus(struct mmc_host *host);
extern int mmc_suspend_host(struct mmc_host *);
extern int mmc_resume_host(struct mmc_host *);
@@ -309,6 +413,8 @@ extern int mmc_power_restore_host(struct mmc_host *host);
extern void mmc_detect_change(struct mmc_host *, unsigned long delay);
extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
+extern int mmc_cache_ctrl(struct mmc_host *, u8);
+
static inline void mmc_signal_sdio_irq(struct mmc_host *host)
{
host->ops->enable_sdio_irq(host, 0);
@@ -373,5 +479,29 @@ static inline int mmc_host_cmd23(struct mmc_host *host)
{
return host->caps & MMC_CAP_CMD23;
}
-#endif
+static inline int mmc_boot_partition_access(struct mmc_host *host)
+{
+ return !(host->caps2 & MMC_CAP2_BOOTPART_NOACC);
+}
+
+#ifdef CONFIG_MMC_CLKGATE
+void mmc_host_clk_hold(struct mmc_host *host);
+void mmc_host_clk_release(struct mmc_host *host);
+unsigned int mmc_host_clk_rate(struct mmc_host *host);
+
+#else
+static inline void mmc_host_clk_hold(struct mmc_host *host)
+{
+}
+
+static inline void mmc_host_clk_release(struct mmc_host *host)
+{
+}
+
+static inline unsigned int mmc_host_clk_rate(struct mmc_host *host)
+{
+ return host->ios.clock;
+}
+#endif
+#endif /* LINUX_MMC_HOST_H */
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index ac26a68..df020ca 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -51,6 +51,7 @@
#define MMC_READ_SINGLE_BLOCK 17 /* adtc [31:0] data addr R1 */
#define MMC_READ_MULTIPLE_BLOCK 18 /* adtc [31:0] data addr R1 */
#define MMC_SEND_TUNING_BLOCK 19 /* adtc R1 */
+#define MMC_SEND_TUNING_BLOCK_HS200 21 /* adtc R1 */
/* class 3 */
#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)
#define R1_CURRENT_STATE(x) ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
#define R1_READY_FOR_DATA (1 << 8) /* sx, a */
#define R1_SWITCH_ERROR (1 << 7) /* sx, c */
+#define R1_EXP_EVENT (1 << 6) /* sr, a */
#define R1_APP_CMD (1 << 5) /* sr, c */
+#define R1_STATE_IDLE 0
+#define R1_STATE_READY 1
+#define R1_STATE_IDENT 2
+#define R1_STATE_STBY 3
+#define R1_STATE_TRAN 4
+#define R1_STATE_DATA 5
+#define R1_STATE_RCV 6
+#define R1_STATE_PRG 7
+#define R1_STATE_DIS 8
+
/*
* MMC/SD in SPI mode reports R1 status always, and R2 for SEND_STATUS
* R1 is the low order byte; R2 is the next highest byte, when present.
@@ -260,18 +272,35 @@ struct _mmc_csd {
* EXT_CSD fields
*/
+#define EXT_CSD_FLUSH_CACHE 32 /* W */
+#define EXT_CSD_CACHE_CTRL 33 /* R/W */
+#define EXT_CSD_POWER_OFF_NOTIFICATION 34 /* R/W */
+#define EXT_CSD_PACKED_FAILURE_INDEX 35 /* RO */
+#define EXT_CSD_PACKED_CMD_STATUS 36 /* RO */
+#define EXT_CSD_EXP_EVENTS_STATUS 54 /* RO, 2 bytes */
+#define EXT_CSD_EXP_EVENTS_CTRL 56 /* R/W, 2 bytes */
#define EXT_CSD_PARTITION_ATTRIBUTE 156 /* R/W */
#define EXT_CSD_PARTITION_SUPPORT 160 /* RO */
+#define EXT_CSD_HPI_MGMT 161 /* R/W */
+#define EXT_CSD_RST_N_FUNCTION 162 /* R/W */
+#define EXT_CSD_SANITIZE_START 165 /* W */
#define EXT_CSD_WR_REL_PARAM 166 /* RO */
#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
+#define EXT_CSD_BOOT_CONFIG_PROT 178 /* R/W */
#define EXT_CSD_PART_CONFIG 179 /* R/W */
#define EXT_CSD_ERASED_MEM_CONT 181 /* RO */
#define EXT_CSD_BUS_WIDTH 183 /* R/W */
#define EXT_CSD_HS_TIMING 185 /* R/W */
+#define EXT_CSD_POWER_CLASS 187 /* R/W */
#define EXT_CSD_REV 192 /* RO */
#define EXT_CSD_STRUCTURE 194 /* RO */
#define EXT_CSD_CARD_TYPE 196 /* RO */
+#define EXT_CSD_OUT_OF_INTERRUPT_TIME 198 /* RO */
#define EXT_CSD_PART_SWITCH_TIME 199 /* RO */
+#define EXT_CSD_PWR_CL_52_195 200 /* RO */
+#define EXT_CSD_PWR_CL_26_195 201 /* RO */
+#define EXT_CSD_PWR_CL_52_360 202 /* RO */
+#define EXT_CSD_PWR_CL_26_360 203 /* RO */
#define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */
#define EXT_CSD_S_A_TIMEOUT 217 /* RO */
#define EXT_CSD_REL_WR_SEC_C 222 /* RO */
@@ -283,6 +312,16 @@ struct _mmc_csd {
#define EXT_CSD_SEC_ERASE_MULT 230 /* RO */
#define EXT_CSD_SEC_FEATURE_SUPPORT 231 /* RO */
#define EXT_CSD_TRIM_MULT 232 /* RO */
+#define EXT_CSD_PWR_CL_200_195 236 /* RO */
+#define EXT_CSD_PWR_CL_200_360 237 /* RO */
+#define EXT_CSD_PWR_CL_DDR_52_195 238 /* RO */
+#define EXT_CSD_PWR_CL_DDR_52_360 239 /* RO */
+#define EXT_CSD_POWER_OFF_LONG_TIME 247 /* RO */
+#define EXT_CSD_GENERIC_CMD6_TIME 248 /* RO */
+#define EXT_CSD_CACHE_SIZE 249 /* RO, 4 bytes */
+#define EXT_CSD_MAX_PACKED_WRITES 500 /* RO */
+#define EXT_CSD_MAX_PACKED_READS 501 /* RO */
+#define EXT_CSD_HPI_FEATURES 503 /* RO */
/*
* EXT_CSD field definitions
@@ -300,13 +339,76 @@ struct _mmc_csd {
#define EXT_CSD_CARD_TYPE_26 (1<<0) /* Card can run at 26MHz */
#define EXT_CSD_CARD_TYPE_52 (1<<1) /* Card can run at 52MHz */
-#define EXT_CSD_CARD_TYPE_MASK 0xF /* Mask out reserved bits */
+#define EXT_CSD_CARD_TYPE_MASK 0x3F /* Mask out reserved bits */
#define EXT_CSD_CARD_TYPE_DDR_1_8V (1<<2) /* Card can run at 52MHz */
/* DDR mode @1.8V or 3V I/O */
#define EXT_CSD_CARD_TYPE_DDR_1_2V (1<<3) /* Card can run at 52MHz */
/* DDR mode @1.2V I/O */
#define EXT_CSD_CARD_TYPE_DDR_52 (EXT_CSD_CARD_TYPE_DDR_1_8V \
| EXT_CSD_CARD_TYPE_DDR_1_2V)
+#define EXT_CSD_CARD_TYPE_SDR_1_8V (1<<4) /* Card can run at 200MHz */
+#define EXT_CSD_CARD_TYPE_SDR_1_2V (1<<5) /* Card can run at 200MHz */
+ /* SDR mode @1.2V I/O */
+
+#define EXT_CSD_CARD_TYPE_SDR_200 (EXT_CSD_CARD_TYPE_SDR_1_8V | \
+ EXT_CSD_CARD_TYPE_SDR_1_2V)
+
+#define EXT_CSD_CARD_TYPE_SDR_ALL (EXT_CSD_CARD_TYPE_SDR_200 | \
+ EXT_CSD_CARD_TYPE_52 | \
+ EXT_CSD_CARD_TYPE_26)
+
+#define EXT_CSD_CARD_TYPE_SDR_1_2V_ALL (EXT_CSD_CARD_TYPE_SDR_1_2V | \
+ EXT_CSD_CARD_TYPE_52 | \
+ EXT_CSD_CARD_TYPE_26)
+
+#define EXT_CSD_CARD_TYPE_SDR_1_8V_ALL (EXT_CSD_CARD_TYPE_SDR_1_8V | \
+ EXT_CSD_CARD_TYPE_52 | \
+ EXT_CSD_CARD_TYPE_26)
+
+#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_1_2V | \
+ EXT_CSD_CARD_TYPE_DDR_1_8V | \
+ EXT_CSD_CARD_TYPE_52 | \
+ EXT_CSD_CARD_TYPE_26)
+
+#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_1_8V | \
+ EXT_CSD_CARD_TYPE_DDR_1_8V | \
+ EXT_CSD_CARD_TYPE_52 | \
+ EXT_CSD_CARD_TYPE_26)
+
+#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_1_2V | \
+ EXT_CSD_CARD_TYPE_DDR_1_2V | \
+ EXT_CSD_CARD_TYPE_52 | \
+ EXT_CSD_CARD_TYPE_26)
+
+#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_1_8V | \
+ EXT_CSD_CARD_TYPE_DDR_1_2V | \
+ EXT_CSD_CARD_TYPE_52 | \
+ EXT_CSD_CARD_TYPE_26)
+
+#define EXT_CSD_CARD_TYPE_SDR_1_2V_DDR_52 (EXT_CSD_CARD_TYPE_SDR_1_2V | \
+ EXT_CSD_CARD_TYPE_DDR_52 | \
+ EXT_CSD_CARD_TYPE_52 | \
+ EXT_CSD_CARD_TYPE_26)
+
+#define EXT_CSD_CARD_TYPE_SDR_1_8V_DDR_52 (EXT_CSD_CARD_TYPE_SDR_1_8V | \
+ EXT_CSD_CARD_TYPE_DDR_52 | \
+ EXT_CSD_CARD_TYPE_52 | \
+ EXT_CSD_CARD_TYPE_26)
+
+#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_8V (EXT_CSD_CARD_TYPE_SDR_200 | \
+ EXT_CSD_CARD_TYPE_DDR_1_8V | \
+ EXT_CSD_CARD_TYPE_52 | \
+ EXT_CSD_CARD_TYPE_26)
+
+#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_1_2V (EXT_CSD_CARD_TYPE_SDR_200 | \
+ EXT_CSD_CARD_TYPE_DDR_1_2V | \
+ EXT_CSD_CARD_TYPE_52 | \
+ EXT_CSD_CARD_TYPE_26)
+
+#define EXT_CSD_CARD_TYPE_SDR_ALL_DDR_52 (EXT_CSD_CARD_TYPE_SDR_200 | \
+ EXT_CSD_CARD_TYPE_DDR_52 | \
+ EXT_CSD_CARD_TYPE_52 | \
+ EXT_CSD_CARD_TYPE_26)
#define EXT_CSD_BUS_WIDTH_1 0 /* Card is in 1 bit mode */
#define EXT_CSD_BUS_WIDTH_4 1 /* Card is in 4 bit mode */
@@ -317,6 +419,27 @@ struct _mmc_csd {
#define EXT_CSD_SEC_ER_EN BIT(0)
#define EXT_CSD_SEC_BD_BLK_EN BIT(2)
#define EXT_CSD_SEC_GB_CL_EN BIT(4)
+#define EXT_CSD_SEC_SANITIZE BIT(6) /* v4.5 only */
+
+#define EXT_CSD_RST_N_EN_MASK 0x3
+#define EXT_CSD_RST_N_ENABLED 1 /* RST_n is enabled on card */
+
+#define EXT_CSD_NO_POWER_NOTIFICATION 0
+#define EXT_CSD_POWER_ON 1
+#define EXT_CSD_POWER_OFF_SHORT 2
+#define EXT_CSD_POWER_OFF_LONG 3
+
+#define EXT_CSD_PWR_CL_8BIT_MASK 0xF0 /* 8 bit PWR CLS */
+#define EXT_CSD_PWR_CL_4BIT_MASK 0x0F /* 8 bit PWR CLS */
+#define EXT_CSD_PWR_CL_8BIT_SHIFT 4
+#define EXT_CSD_PWR_CL_4BIT_SHIFT 0
+
+#define EXT_CSD_PACKED_EVENT_EN (1 << 3)
+
+#define EXT_CSD_PACKED_FAILURE (1 << 3)
+
+#define EXT_CSD_PACKED_GENERIC_ERROR (1 << 0)
+#define EXT_CSD_PACKED_INDEXED_ERROR (1 << 1)
/*
* MMC_SWITCH access modes
diff --git a/include/linux/mmc/pm.h b/include/linux/mmc/pm.h
index d37aac4..66ac136 100644
--- a/include/linux/mmc/pm.h
+++ b/include/linux/mmc/pm.h
@@ -26,5 +26,9 @@ typedef unsigned int mmc_pm_flag_t;
#define MMC_PM_KEEP_POWER (1 << 0) /* preserve card power during suspend */
#define MMC_PM_WAKE_SDIO_IRQ (1 << 1) /* wake up host system on SDIO IRQ assertion */
+#define MMC_PM_IGNORE_PM_NOTIFY (1 << 2) /* ignore mmc pm notify */
+
+/* ignore mmc suspend.resume for BCM WIFI */
+#define MMC_PM_IGNORE_SUSPEND_RESUME (1 << 30)
#endif
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 6a68c4e..636c932 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -94,6 +94,7 @@ struct sdhci_host {
const struct sdhci_ops *ops; /* Low level hw interface */
struct regulator *vmmc; /* Power regulator */
+ char *vmmc_name; /* Power regulator's name */
/* Internal data */
struct mmc_host *mmc; /* MMC structure */
diff --git a/include/linux/mmc/sdio.h b/include/linux/mmc/sdio.h
index 245cdac..c83115e 100644
--- a/include/linux/mmc/sdio.h
+++ b/include/linux/mmc/sdio.h
@@ -38,6 +38,7 @@
* [8:0] Byte/block count
*/
+#define R4_18V_PRESENT (1<<24)
#define R4_MEMORY_PRESENT (1 << 27)
/*
@@ -72,17 +73,20 @@
#define SDIO_CCCR_REV_1_00 0 /* CCCR/FBR Version 1.00 */
#define SDIO_CCCR_REV_1_10 1 /* CCCR/FBR Version 1.10 */
#define SDIO_CCCR_REV_1_20 2 /* CCCR/FBR Version 1.20 */
+#define SDIO_CCCR_REV_3_00 3 /* CCCR/FBR Version 3.00 */
#define SDIO_SDIO_REV_1_00 0 /* SDIO Spec Version 1.00 */
#define SDIO_SDIO_REV_1_10 1 /* SDIO Spec Version 1.10 */
#define SDIO_SDIO_REV_1_20 2 /* SDIO Spec Version 1.20 */
#define SDIO_SDIO_REV_2_00 3 /* SDIO Spec Version 2.00 */
+#define SDIO_SDIO_REV_3_00 4 /* SDIO Spec Version 3.00 */
#define SDIO_CCCR_SD 0x01
#define SDIO_SD_REV_1_01 0 /* SD Physical Spec Version 1.01 */
#define SDIO_SD_REV_1_10 1 /* SD Physical Spec Version 1.10 */
#define SDIO_SD_REV_2_00 2 /* SD Physical Spec Version 2.00 */
+#define SDIO_SD_REV_3_00 3 /* SD Physical Spev Version 3.00 */
#define SDIO_CCCR_IOEx 0x02
#define SDIO_CCCR_IORx 0x03
@@ -132,8 +136,31 @@
#define SDIO_CCCR_SPEED 0x13
#define SDIO_SPEED_SHS 0x01 /* Supports High-Speed mode */
-#define SDIO_SPEED_EHS 0x02 /* Enable High-Speed mode */
-
+#define SDIO_SPEED_BSS_SHIFT 1
+#define SDIO_SPEED_BSS_MASK (7<<SDIO_SPEED_BSS_SHIFT)
+#define SDIO_SPEED_SDR12 (0<<SDIO_SPEED_BSS_SHIFT)
+#define SDIO_SPEED_SDR25 (1<<SDIO_SPEED_BSS_SHIFT)
+#define SDIO_SPEED_SDR50 (2<<SDIO_SPEED_BSS_SHIFT)
+#define SDIO_SPEED_SDR104 (3<<SDIO_SPEED_BSS_SHIFT)
+#define SDIO_SPEED_DDR50 (4<<SDIO_SPEED_BSS_SHIFT)
+#define SDIO_SPEED_EHS SDIO_SPEED_SDR25 /* Enable High-Speed */
+
+#define SDIO_CCCR_UHS 0x14
+#define SDIO_UHS_SDR50 0x01
+#define SDIO_UHS_SDR104 0x02
+#define SDIO_UHS_DDR50 0x04
+
+#define SDIO_CCCR_DRIVE_STRENGTH 0x15
+#define SDIO_SDTx_MASK 0x07
+#define SDIO_DRIVE_SDTA (1<<0)
+#define SDIO_DRIVE_SDTC (1<<1)
+#define SDIO_DRIVE_SDTD (1<<2)
+#define SDIO_DRIVE_DTSx_MASK 0x03
+#define SDIO_DRIVE_DTSx_SHIFT 4
+#define SDIO_DTSx_SET_TYPE_B (0 << SDIO_DRIVE_DTSx_SHIFT)
+#define SDIO_DTSx_SET_TYPE_A (1 << SDIO_DRIVE_DTSx_SHIFT)
+#define SDIO_DTSx_SET_TYPE_C (2 << SDIO_DRIVE_DTSx_SHIFT)
+#define SDIO_DTSx_SET_TYPE_D (3 << SDIO_DRIVE_DTSx_SHIFT)
/*
* Function Basic Registers (FBR)
*/
diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h
index 31baaf8..39016ed 100644..100755
--- a/include/linux/mmc/sdio_func.h
+++ b/include/linux/mmc/sdio_func.h
@@ -23,6 +23,14 @@ struct sdio_func;
typedef void (sdio_irq_handler_t)(struct sdio_func *);
/*
+ * Structure used to hold embedded SDIO device data from platform layer
+ */
+struct sdio_embedded_func {
+ uint8_t f_class;
+ uint32_t f_maxblksize;
+};
+
+/*
* SDIO function CIS tuple (unknown to the core)
*/
struct sdio_func_tuple {
@@ -130,6 +138,8 @@ extern int sdio_release_irq(struct sdio_func *func);
extern unsigned int sdio_align_size(struct sdio_func *func, unsigned int sz);
extern u8 sdio_readb(struct sdio_func *func, unsigned int addr, int *err_ret);
+extern u8 sdio_readb_ext(struct sdio_func *func, unsigned int addr, int *err_ret,
+ unsigned in);
extern u16 sdio_readw(struct sdio_func *func, unsigned int addr, int *err_ret);
extern u32 sdio_readl(struct sdio_func *func, unsigned int addr, int *err_ret);
@@ -162,4 +172,3 @@ extern mmc_pm_flag_t sdio_get_host_pm_caps(struct sdio_func *func);
extern int sdio_set_host_pm_flags(struct sdio_func *func, mmc_pm_flag_t flags);
#endif
-
diff --git a/include/linux/mms152.h b/include/linux/mms152.h
new file mode 100644
index 0000000..9935b99
--- /dev/null
+++ b/include/linux/mms152.h
@@ -0,0 +1,130 @@
+/*
+ * include/linux/mms152.h - platform data structure for MCS Series sensor
+ *
+ * Copyright (C) 2010 Melfas, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_MELFAS_TS_H
+#define _LINUX_MELFAS_TS_H
+
+#define TS_DEV_NAME "melfas_ts"
+#define TS_DEV_ADDR 0x48
+
+#define ADDR_CHANGE_PROTOCOL 0x01
+#define ADDR_LOGTYPE_ON 0x1B
+#define ADDR_LOGTYPE_OFF 0x1C
+#define ADDR_CHANGE_OPMODE 0x1D
+#define ADDR_ENTER_LOGGING 0x5E
+#define LOG_READ_ADDR 0x86
+
+extern struct class *sec_class;
+
+typedef enum {
+ PTC_NONE = -1,
+ PTC_TUNE,
+ PTC_CALCSIMUL,
+ PTC_TEST,
+ PTC_PRIMITIVE,
+ PTC_MTSI_1_2_0,
+ PTC_STSI_1_0_0,
+ PTC_LIM
+} eProtocol_t;
+
+typedef struct {
+ char cCommand;
+ char sDescription[100];
+} tCommandInfo_t;
+
+/* LOG_HEADER */
+typedef enum {
+ HEADER_NONE = -1,
+ HEADER_U08,
+ HEADER_U16,
+ HEADER_U32,
+ HEADER_FINGER,
+ HEADER_S08,
+ HEADER_U16_NOCR,
+ HEADER_S16,
+ HEADER_S16_NOCR,
+ HEADER_U32_NOCR,
+ HEADER_S32,
+ HEADER_S32_NOCR,
+ HEADER_TEXT,
+ HEADER_S12,
+ HEADER_S12_NOCR,
+ HEADER_S08_NOCR,
+ HEADER_U08_NOCR,
+ HEADER_U12,
+ HEADER_U12_NOCR,
+ HEADER_PRIVATE,
+ HEADER_LIM
+} eHeader_t;
+
+typedef enum {
+ LT_NONE = -1,
+ LT_DIAGNOSIS_IMG,
+ LT_RAW_IMG,
+ LT_REF_IMG,
+ LT_INTENSITY_IMG,
+ LT_GROUP_IMG,
+ LT_DELAY_IMG,
+ LT_POS,
+ LT_DEBUG,
+ LT_DEBUG2,
+ LT_PROFILING,
+ LT_LIMIT
+} eLogType_t;
+
+typedef enum {
+ OM_NONE = -1,
+ OM_NORMAL_OPERATION,
+ OM_TUNE_ANALOG_SETTINGS,
+ OM_OPTIMIZE_DELAY,
+ OM_NORMALIZE_INTENSITY,
+ OM_HANDLER_TEST,
+ OM_WAIT,
+ OM_LIMIT
+} eOperationMode_t;
+
+enum {
+ None = 0,
+ TOUCH_SCREEN,
+ TOUCH_KEY
+};
+
+struct multi_touch_info {
+ int status;
+ int strength;
+ int width;
+ int posX;
+ int posY;
+};
+
+struct tsp_callbacks {
+ void (*inform_charger)(struct tsp_callbacks *tsp_cb, int mode);
+};
+
+struct ts_platform_data {
+ int gpio_read_done;
+ int gpio_int;
+ int gpio_touch_id;
+ void (*power_on)(void);
+ void (*power_off)(void);
+ void (*register_cb)(struct tsp_callbacks *);
+ void (*read_ta_status)(bool *);
+ void (*set_touch_i2c)(void);
+ void (*set_touch_i2c_to_gpio)(void);
+};
+
+
+#endif /* _LINUX_MELFAS_TS_H */
diff --git a/include/linux/mms_ts_gc.h b/include/linux/mms_ts_gc.h
new file mode 100644
index 0000000..010325b
--- /dev/null
+++ b/include/linux/mms_ts_gc.h
@@ -0,0 +1,115 @@
+/*
+ * include/linux/mms152.h - platform data structure for MCS Series sensor
+ *
+ * Copyright (C) 2010 Melfas, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_MELFAS_TS_H
+#define _LINUX_MELFAS_TS_H
+
+#define TS_DEV_NAME "melfas_ts"
+#define TS_DEV_ADDR 0x48
+
+#define ADDR_CHANGE_PROTOCOL 0x01
+#define ADDR_LOGTYPE_ON 0x1B
+#define ADDR_LOGTYPE_OFF 0x1C
+#define ADDR_CHANGE_OPMODE 0x1D
+#define ADDR_ENTER_LOGGING 0x5E
+#define LOG_READ_ADDR 0x86
+
+extern struct class *sec_class;
+
+typedef enum {
+ PTC_NONE = -1,
+ PTC_TUNE,
+ PTC_CALCSIMUL,
+ PTC_TEST,
+ PTC_PRIMITIVE,
+ PTC_MTSI_1_2_0,
+ PTC_STSI_1_0_0,
+ PTC_LIM
+} eProtocol_t;
+
+typedef struct {
+ char cCommand;
+ char sDescription[100];
+} tCommandInfo_t;
+
+/* LOG_HEADER */
+typedef enum {
+ HEADER_NONE = -1,
+ HEADER_U08,
+ HEADER_U16,
+ HEADER_U32,
+ HEADER_FINGER,
+ HEADER_S08,
+ HEADER_U16_NOCR,
+ HEADER_S16,
+ HEADER_S16_NOCR,
+ HEADER_U32_NOCR,
+ HEADER_S32,
+ HEADER_S32_NOCR,
+ HEADER_TEXT,
+ HEADER_S12,
+ HEADER_S12_NOCR,
+ HEADER_S08_NOCR,
+ HEADER_U08_NOCR,
+ HEADER_U12,
+ HEADER_U12_NOCR,
+ HEADER_PRIVATE,
+ HEADER_LIM
+} eHeader_t;
+
+typedef enum {
+ LT_NONE = -1,
+ LT_DIAGNOSIS_IMG,
+ LT_RAW_IMG,
+ LT_REF_IMG,
+ LT_INTENSITY_IMG,
+ LT_GROUP_IMG,
+ LT_DELAY_IMG,
+ LT_POS,
+ LT_DEBUG,
+ LT_DEBUG2,
+ LT_PROFILING,
+ LT_LIMIT
+} eLogType_t;
+
+typedef enum {
+ OM_NONE = -1,
+ OM_NORMAL_OPERATION,
+ OM_TUNE_ANALOG_SETTINGS,
+ OM_OPTIMIZE_DELAY,
+ OM_NORMALIZE_INTENSITY,
+ OM_HANDLER_TEST,
+ OM_WAIT,
+ OM_LIMIT
+} eOperationMode_t;
+
+struct tsp_callbacks {
+ void (*inform_charger)(struct tsp_callbacks *tsp_cb, int mode);
+};
+
+struct ts_platform_data {
+ int gpio_read_done;
+ int gpio_int;
+ int gpio_touch_id;
+ void (*power_on)(void);
+ void (*power_off)(void);
+ void (*register_cb)(struct tsp_callbacks *);
+ void (*read_ta_status)(bool *);
+ void (*set_touch_i2c)(void);
+ void (*set_touch_i2c_to_gpio)(void);
+};
+
+#endif /* _LINUX_MELFAS_TS_H */
diff --git a/include/linux/mpu.h b/include/linux/mpu.h
new file mode 100755
index 0000000..fd5f915
--- /dev/null
+++ b/include/linux/mpu.h
@@ -0,0 +1,488 @@
+/*
+ $License:
+ Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ $
+ */
+
+#ifndef __MPU_H_
+#define __MPU_H_
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#endif
+
+#ifdef M_HW
+#include "mpu6000.h"
+#else
+#include "mpu3050.h"
+#endif
+
+/* Number of axes on each sensor */
+#define GYRO_NUM_AXES (3)
+#define ACCEL_NUM_AXES (3)
+#define COMPASS_NUM_AXES (3)
+
+/* IOCTL commands for /dev/mpu */
+#define MPU_SET_MPU_CONFIG (0x00)
+#define MPU_SET_INT_CONFIG (0x01)
+#define MPU_SET_EXT_SYNC (0x02)
+#define MPU_SET_FULL_SCALE (0x03)
+#define MPU_SET_LPF (0x04)
+#define MPU_SET_CLK_SRC (0x05)
+#define MPU_SET_DIVIDER (0x06)
+#define MPU_SET_LEVEL_SHIFTER (0x07)
+#define MPU_SET_DMP_ENABLE (0x08)
+#define MPU_SET_FIFO_ENABLE (0x09)
+#define MPU_SET_DMP_CFG1 (0x0a)
+#define MPU_SET_DMP_CFG2 (0x0b)
+#define MPU_SET_OFFSET_TC (0x0c)
+#define MPU_SET_RAM (0x0d)
+
+#define MPU_SET_PLATFORM_DATA (0x0e)
+
+#define MPU_GET_MPU_CONFIG (0x80)
+#define MPU_GET_INT_CONFIG (0x81)
+#define MPU_GET_EXT_SYNC (0x82)
+#define MPU_GET_FULL_SCALE (0x83)
+#define MPU_GET_LPF (0x84)
+#define MPU_GET_CLK_SRC (0x85)
+#define MPU_GET_DIVIDER (0x86)
+#define MPU_GET_LEVEL_SHIFTER (0x87)
+#define MPU_GET_DMP_ENABLE (0x88)
+#define MPU_GET_FIFO_ENABLE (0x89)
+#define MPU_GET_DMP_CFG1 (0x8a)
+#define MPU_GET_DMP_CFG2 (0x8b)
+#define MPU_GET_OFFSET_TC (0x8c)
+#define MPU_GET_RAM (0x8d)
+
+#define MPU_READ_REGISTER (0x40)
+#define MPU_WRITE_REGISTER (0x41)
+#define MPU_READ_MEMORY (0x42)
+#define MPU_WRITE_MEMORY (0x43)
+
+#define MPU_SUSPEND (0x44)
+#define MPU_RESUME (0x45)
+#define MPU_READ_COMPASS (0x46)
+#define MPU_READ_ACCEL (0x47)
+#define MPU_READ_PRESSURE (0x48)
+
+#define MPU_CONFIG_ACCEL (0x20)
+#define MPU_CONFIG_COMPASS (0x21)
+#define MPU_CONFIG_PRESSURE (0x22)
+
+#define MPU_GET_CONFIG_ACCEL (0x28)
+#define MPU_GET_CONFIG_COMPASS (0x29)
+#define MPU_GET_CONFIG_PRESSURE (0x2a)
+
+/* Structure for the following IOCTL's:
+ MPU_SET_RAM
+ MPU_GET_RAM
+ MPU_READ_REGISTER
+ MPU_WRITE_REGISTER
+ MPU_READ_MEMORY
+ MPU_WRITE_MEMORY
+*/
+struct mpu_read_write {
+ unsigned short address;
+ unsigned short length;
+ unsigned char *data;
+};
+
+#define FEATURE_GYRO_SELFTEST_INTERRUPT
+
+struct mpuirq_data {
+ int interruptcount;
+ unsigned long long irqtime;
+ int data_type;
+ int data_size;
+ void *data;
+#ifdef FEATURE_GYRO_SELFTEST_INTERRUPT
+ unsigned long long mpuirq_jiffies;
+#endif
+};
+enum ext_slave_config_key {
+ MPU_SLAVE_CONFIG_ODR_SUSPEND,
+ MPU_SLAVE_CONFIG_ODR_RESUME,
+ MPU_SLAVE_CONFIG_FSR_SUSPEND,
+ MPU_SLAVE_CONFIG_FSR_RESUME,
+ MPU_SLAVE_CONFIG_MOT_THS,
+ MPU_SLAVE_CONFIG_NMOT_THS,
+ MPU_SLAVE_CONFIG_MOT_DUR,
+ MPU_SLAVE_CONFIG_NMOT_DUR,
+ MPU_SLAVE_CONFIG_IRQ_SUSPEND,
+ MPU_SLAVE_CONFIG_IRQ_RESUME,
+ MPU_SLAVE_CONFIG_NUM_CONFIG_KEYS,
+};
+
+/* For the MPU_SLAVE_CONFIG_IRQ_SUSPEND and MPU_SLAVE_CONFIG_IRQ_RESUME */
+enum ext_slave_config_irq_type {
+ MPU_SLAVE_IRQ_TYPE_NONE,
+ MPU_SLAVE_IRQ_TYPE_MOTION,
+ MPU_SLAVE_IRQ_TYPE_DATA_READY,
+};
+
+/* Structure for the following IOCTS's
+ * MPU_CONFIG_ACCEL
+ * MPU_CONFIG_COMPASS
+ * MPU_CONFIG_PRESSURE
+ * MPU_GET_CONFIG_ACCEL
+ * MPU_GET_CONFIG_COMPASS
+ * MPU_GET_CONFIG_PRESSURE
+ */
+struct ext_slave_config {
+ int key;
+ int len;
+ int apply;
+ void *data;
+};
+
+enum ext_slave_type {
+ EXT_SLAVE_TYPE_GYROSCOPE,
+ EXT_SLAVE_TYPE_ACCELEROMETER,
+ EXT_SLAVE_TYPE_COMPASS,
+ EXT_SLAVE_TYPE_PRESSURE,
+ /*EXT_SLAVE_TYPE_TEMPERATURE */
+};
+
+enum ext_slave_id {
+ ID_INVALID = 0,
+
+ ACCEL_ID_LIS331,
+ ACCEL_ID_LSM303,
+ ACCEL_ID_KXSD9,
+ ACCEL_ID_KXTF9,
+ ACCEL_ID_BMA150,
+ ACCEL_ID_BMA222,
+ ACCEL_ID_ADI346,
+ ACCEL_ID_MMA8450,
+ ACCEL_ID_MMA845X,
+ ACCEL_ID_MPU6000,
+ ACCEL_ID_LIS3DH,
+
+ COMPASS_ID_AKM,
+ COMPASS_ID_AMI30X,
+ COMPASS_ID_YAS529,
+ COMPASS_ID_HMC5883,
+ COMPASS_ID_LSM303,
+ COMPASS_ID_MMC314X,
+ COMPASS_ID_MMC328X,
+ COMPASS_ID_HSCDTD002B,
+ COMPASS_ID_HSCDTD004A,
+
+ PRESSURE_ID_BMA085,
+};
+
+enum ext_slave_endian {
+ EXT_SLAVE_BIG_ENDIAN,
+ EXT_SLAVE_LITTLE_ENDIAN,
+ EXT_SLAVE_FS8_BIG_ENDIAN,
+ EXT_SLAVE_FS16_BIG_ENDIAN,
+};
+
+enum ext_slave_bus {
+ EXT_SLAVE_BUS_INVALID = -1,
+ EXT_SLAVE_BUS_PRIMARY = 0,
+ EXT_SLAVE_BUS_SECONDARY = 1
+};
+
+
+/**
+ * struct ext_slave_platform_data - Platform data for mpu3050 slave devices
+ *
+ * @get_slave_descr: Function pointer to retrieve the struct ext_slave_descr
+ * for this slave
+ * @irq: the irq number attached to the slave if any.
+ * @adapt_num: the I2C adapter number.
+ * @bus: the bus the slave is attached to: enum ext_slave_bus
+ * @address: the I2C slave address of the slave device.
+ * @orientation: the mounting matrix of the device relative to MPU.
+ * @irq_data: private data for the slave irq handler
+ * @private_data: additional data, user customizable. Not touched by the MPU
+ * driver.
+ *
+ * The orientation matricies are 3x3 rotation matricies
+ * that are applied to the data to rotate from the mounting orientation to the
+ * platform orientation. The values must be one of 0, 1, or -1 and each row and
+ * column should have exactly 1 non-zero value.
+ */
+struct ext_slave_platform_data {
+ struct ext_slave_descr *(*get_slave_descr) (void);
+ int irq;
+ int adapt_num;
+ int bus;
+ unsigned char address;
+ signed char orientation[9];
+ void *irq_data;
+ void *private_data;
+};
+
+
+struct tFixPntRange {
+ long mantissa;
+ long fraction;
+};
+
+/**
+ * struct ext_slave_descr - Description of the slave device for programming.
+ *
+ * @suspend: function pointer to put the device in suspended state
+ * @resume: function pointer to put the device in running state
+ * @read: function that reads the device data
+ * @init: function used to preallocate memory used by the driver
+ * @exit: function used to free memory allocated for the driver
+ * @config: function used to configure the device
+ * @get_config:function used to get the device's configuration
+ *
+ * @name: text name of the device
+ * @type: device type. enum ext_slave_type
+ * @id: enum ext_slave_id
+ * @reg: starting register address to retrieve data.
+ * @len: length in bytes of the sensor data. Should be 6.
+ * @endian: byte order of the data. enum ext_slave_endian
+ * @range: full scale range of the slave ouput: struct tFixPntRange
+ *
+ * Defines the functions and information about the slave the mpu3050 needs to
+ * use the slave device.
+ */
+struct ext_slave_descr {
+ int (*init) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata);
+ int (*exit) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata);
+ int (*suspend) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata);
+ int (*resume) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata);
+ int (*read) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata,
+ unsigned char *data);
+ int (*config) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata,
+ struct ext_slave_config *config);
+ int (*get_config) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata,
+ struct ext_slave_config *config);
+
+ char *name;
+ unsigned char type;
+ unsigned char id;
+ unsigned char reg;
+ unsigned int len;
+ unsigned char endian;
+ struct tFixPntRange range;
+};
+
+/**
+ * struct mpu3050_platform_data - Platform data for the mpu3050 driver
+ * @int_config: Bits [7:3] of the int config register.
+ * @orientation: Orientation matrix of the gyroscope
+ * @level_shifter: 0: VLogic, 1: VDD
+ * @accel: Accel platform data
+ * @compass: Compass platform data
+ * @pressure: Pressure platform data
+ *
+ * Contains platform specific information on how to configure the MPU3050 to
+ * work on this platform. The orientation matricies are 3x3 rotation matricies
+ * that are applied to the data to rotate from the mounting orientation to the
+ * platform orientation. The values must be one of 0, 1, or -1 and each row and
+ * column should have exactly 1 non-zero value.
+ */
+struct mpu3050_platform_data {
+ unsigned char int_config;
+ signed char orientation[MPU_NUM_AXES * MPU_NUM_AXES];
+ unsigned char level_shifter;
+ struct ext_slave_platform_data accel;
+ struct ext_slave_platform_data compass;
+ struct ext_slave_platform_data pressure;
+ struct class *sec_class;
+};
+
+
+/*
+ Accelerometer
+*/
+#define get_accel_slave_descr NULL
+
+#ifdef CONFIG_MPU_SENSORS_ADXL346 /* ADI accelerometer */
+struct ext_slave_descr *adxl346_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr adxl346_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_BMA150 /* Bosch accelerometer */
+struct ext_slave_descr *bma150_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr bma150_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_BMA222 /* Bosch 222 accelerometer */
+struct ext_slave_descr *bma222_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr bma222_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_KXSD9 /* Kionix accelerometer */
+struct ext_slave_descr *kxsd9_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr kxsd9_get_slave_descr
+#endif
+
+#if defined CONFIG_MACH_BOSE_ATT
+struct ext_slave_descr *kxtf9_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr kxtf9_get_slave_descr
+
+struct ext_slave_descr *kxud9_get_slave_descr(void);
+#define get_accel_slave_descr_2 kxud9_get_slave_descr
+
+#else
+#ifdef CONFIG_MPU_SENSORS_KXUD9 /* Kionix accelerometer */
+struct ext_slave_descr *kxud9_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr kxud9_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_KXTF9 /* Kionix accelerometer */
+struct ext_slave_descr *kxtf9_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr kxtf9_get_slave_descr
+#endif
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_LIS331DLH /* ST accelerometer */
+struct ext_slave_descr *lis331dlh_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr lis331dlh_get_slave_descr
+#endif
+
+
+#ifdef CONFIG_MPU_SENSORS_LIS3DH /* ST accelerometer */
+struct ext_slave_descr *lis3dh_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr lis3dh_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_LSM303DLHA /* ST accelerometer */
+struct ext_slave_descr *lsm303dlha_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr lsm303dlha_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_KXTF9_LIS3DH /* Kionix accelerometer */
+struct ext_slave_descr *kxtf9_get_slave_descr(void);
+struct ext_slave_descr *lis3dh_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr kxtf9_get_slave_descr
+#endif
+
+/* MPU6000 Accel */
+#if defined(CONFIG_MPU_SENSORS_MPU6000) || \
+defined(CONFIG_MPU_SENSORS_MPU6000_MODULE)
+struct ext_slave_descr *mantis_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr mantis_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_MMA8450 /* Freescale accelerometer */
+struct ext_slave_descr *mma8450_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr mma8450_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_MMA845X /* Freescale accelerometer */
+struct ext_slave_descr *mma845x_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr mma845x_get_slave_descr
+#endif
+
+
+/*
+ Compass
+*/
+#define get_compass_slave_descr NULL
+
+#ifdef CONFIG_MPU_SENSORS_AK8975 /* AKM compass */
+struct ext_slave_descr *ak8975_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr ak8975_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_AMI30X /* AICHI Steel compass */
+struct ext_slave_descr *ami30x_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr ami30x_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_HMC5883 /* Honeywell compass */
+struct ext_slave_descr *hmc5883_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr hmc5883_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_MMC314X /* MEMSIC compass */
+struct ext_slave_descr *mmc314x_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr mmc314x_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_MMC328X /* MEMSIC compass */
+struct ext_slave_descr *mmc328x_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr mmc328x_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_LSM303DLHM /* ST compass */
+struct ext_slave_descr *lsm303dlhm_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr lsm303dlhm_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_YAS529 /* Yamaha compass */
+struct ext_slave_descr *yas529_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr yas529_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_HSCDTD002B /* Alps HSCDTD002B compass */
+struct ext_slave_descr *hscdtd002b_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr hscdtd002b_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_HSCDTD004A /* Alps HSCDTD004A compass */
+struct ext_slave_descr *hscdtd004a_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr hscdtd004a_get_slave_descr
+#endif
+/*
+ Pressure
+*/
+#define get_pressure_slave_descr NULL
+
+#ifdef CONFIG_MPU_SENSORS_BMA085 /* BMA pressure */
+struct ext_slave_descr *bma085_get_slave_descr(void);
+#undef get_pressure_slave_descr
+#define get_pressure_slave_descr bma085_get_slave_descr
+#endif
+
+#endif /* __MPU_H_ */
diff --git a/include/linux/mpu3050.h b/include/linux/mpu3050.h
new file mode 100755
index 0000000..a8dcd5a9
--- /dev/null
+++ b/include/linux/mpu3050.h
@@ -0,0 +1,255 @@
+/*
+ $License:
+ Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ $
+ */
+
+#ifndef __MPU3050_H_
+#define __MPU3050_H_
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#endif
+
+#ifdef M_HW
+#error MPU6000 build including MPU3050 header
+#endif
+
+#define MPU_NAME "mpu3050"
+#define DEFAULT_MPU_SLAVEADDR 0x68
+
+/*==== MPU REGISTER SET ====*/
+enum mpu_register {
+ MPUREG_WHO_AM_I = 0, /* 00 0x00 */
+ MPUREG_PRODUCT_ID, /* 01 0x01 */
+ MPUREG_02_RSVD, /* 02 0x02 */
+ MPUREG_03_RSVD, /* 03 0x03 */
+ MPUREG_04_RSVD, /* 04 0x04 */
+ MPUREG_XG_OFFS_TC, /* 05 0x05 */
+ MPUREG_06_RSVD, /* 06 0x06 */
+ MPUREG_07_RSVD, /* 07 0x07 */
+ MPUREG_YG_OFFS_TC, /* 08 0x08 */
+ MPUREG_09_RSVD, /* 09 0x09 */
+ MPUREG_0A_RSVD, /* 10 0x0a */
+ MPUREG_ZG_OFFS_TC, /* 11 0x0b */
+ MPUREG_X_OFFS_USRH, /* 12 0x0c */
+ MPUREG_X_OFFS_USRL, /* 13 0x0d */
+ MPUREG_Y_OFFS_USRH, /* 14 0x0e */
+ MPUREG_Y_OFFS_USRL, /* 15 0x0f */
+ MPUREG_Z_OFFS_USRH, /* 16 0x10 */
+ MPUREG_Z_OFFS_USRL, /* 17 0x11 */
+ MPUREG_FIFO_EN1, /* 18 0x12 */
+ MPUREG_FIFO_EN2, /* 19 0x13 */
+ MPUREG_AUX_SLV_ADDR, /* 20 0x14 */
+ MPUREG_SMPLRT_DIV, /* 21 0x15 */
+ MPUREG_DLPF_FS_SYNC, /* 22 0x16 */
+ MPUREG_INT_CFG, /* 23 0x17 */
+ MPUREG_ACCEL_BURST_ADDR,/* 24 0x18 */
+ MPUREG_19_RSVD, /* 25 0x19 */
+ MPUREG_INT_STATUS, /* 26 0x1a */
+ MPUREG_TEMP_OUT_H, /* 27 0x1b */
+ MPUREG_TEMP_OUT_L, /* 28 0x1c */
+ MPUREG_GYRO_XOUT_H, /* 29 0x1d */
+ MPUREG_GYRO_XOUT_L, /* 30 0x1e */
+ MPUREG_GYRO_YOUT_H, /* 31 0x1f */
+ MPUREG_GYRO_YOUT_L, /* 32 0x20 */
+ MPUREG_GYRO_ZOUT_H, /* 33 0x21 */
+ MPUREG_GYRO_ZOUT_L, /* 34 0x22 */
+ MPUREG_23_RSVD, /* 35 0x23 */
+ MPUREG_24_RSVD, /* 36 0x24 */
+ MPUREG_25_RSVD, /* 37 0x25 */
+ MPUREG_26_RSVD, /* 38 0x26 */
+ MPUREG_27_RSVD, /* 39 0x27 */
+ MPUREG_28_RSVD, /* 40 0x28 */
+ MPUREG_29_RSVD, /* 41 0x29 */
+ MPUREG_2A_RSVD, /* 42 0x2a */
+ MPUREG_2B_RSVD, /* 43 0x2b */
+ MPUREG_2C_RSVD, /* 44 0x2c */
+ MPUREG_2D_RSVD, /* 45 0x2d */
+ MPUREG_2E_RSVD, /* 46 0x2e */
+ MPUREG_2F_RSVD, /* 47 0x2f */
+ MPUREG_30_RSVD, /* 48 0x30 */
+ MPUREG_31_RSVD, /* 49 0x31 */
+ MPUREG_32_RSVD, /* 50 0x32 */
+ MPUREG_33_RSVD, /* 51 0x33 */
+ MPUREG_34_RSVD, /* 52 0x34 */
+ MPUREG_DMP_CFG_1, /* 53 0x35 */
+ MPUREG_DMP_CFG_2, /* 54 0x36 */
+ MPUREG_BANK_SEL, /* 55 0x37 */
+ MPUREG_MEM_START_ADDR, /* 56 0x38 */
+ MPUREG_MEM_R_W, /* 57 0x39 */
+ MPUREG_FIFO_COUNTH, /* 58 0x3a */
+ MPUREG_FIFO_COUNTL, /* 59 0x3b */
+ MPUREG_FIFO_R_W, /* 60 0x3c */
+ MPUREG_USER_CTRL, /* 61 0x3d */
+ MPUREG_PWR_MGM, /* 62 0x3e */
+ MPUREG_3F_RSVD, /* 63 0x3f */
+ NUM_OF_MPU_REGISTERS /* 64 0x40 */
+};
+
+/*==== BITS FOR MPU ====*/
+
+/*---- MPU 'FIFO_EN1' register (12) ----*/
+#define BIT_TEMP_OUT 0x80
+#define BIT_GYRO_XOUT 0x40
+#define BIT_GYRO_YOUT 0x20
+#define BIT_GYRO_ZOUT 0x10
+#define BIT_ACCEL_XOUT 0x08
+#define BIT_ACCEL_YOUT 0x04
+#define BIT_ACCEL_ZOUT 0x02
+#define BIT_AUX_1OUT 0x01
+/*---- MPU 'FIFO_EN2' register (13) ----*/
+#define BIT_AUX_2OUT 0x02
+#define BIT_AUX_3OUT 0x01
+/*---- MPU 'DLPF_FS_SYNC' register (16) ----*/
+#define BITS_EXT_SYNC_NONE 0x00
+#define BITS_EXT_SYNC_TEMP 0x20
+#define BITS_EXT_SYNC_GYROX 0x40
+#define BITS_EXT_SYNC_GYROY 0x60
+#define BITS_EXT_SYNC_GYROZ 0x80
+#define BITS_EXT_SYNC_ACCELX 0xA0
+#define BITS_EXT_SYNC_ACCELY 0xC0
+#define BITS_EXT_SYNC_ACCELZ 0xE0
+#define BITS_EXT_SYNC_MASK 0xE0
+#define BITS_FS_250DPS 0x00
+#define BITS_FS_500DPS 0x08
+#define BITS_FS_1000DPS 0x10
+#define BITS_FS_2000DPS 0x18
+#define BITS_FS_MASK 0x18
+#define BITS_DLPF_CFG_256HZ_NOLPF2 0x00
+#define BITS_DLPF_CFG_188HZ 0x01
+#define BITS_DLPF_CFG_98HZ 0x02
+#define BITS_DLPF_CFG_42HZ 0x03
+#define BITS_DLPF_CFG_20HZ 0x04
+#define BITS_DLPF_CFG_10HZ 0x05
+#define BITS_DLPF_CFG_5HZ 0x06
+#define BITS_DLPF_CFG_2100HZ_NOLPF 0x07
+#define BITS_DLPF_CFG_MASK 0x07
+/*---- MPU 'INT_CFG' register (17) ----*/
+#define BIT_ACTL 0x80
+#define BIT_ACTL_LOW 0x80
+#define BIT_ACTL_HIGH 0x00
+#define BIT_OPEN 0x40
+#define BIT_OPEN_DRAIN 0x40
+#define BIT_PUSH_PULL 0x00
+#define BIT_LATCH_INT_EN 0x20
+#define BIT_LATCH_INT_EN 0x20
+#define BIT_INT_PULSE_WIDTH_50US 0x00
+#define BIT_INT_ANYRD_2CLEAR 0x10
+#define BIT_INT_STAT_READ_2CLEAR 0x00
+#define BIT_MPU_RDY_EN 0x04
+#define BIT_DMP_INT_EN 0x02
+#define BIT_RAW_RDY_EN 0x01
+/*---- MPU 'INT_STATUS' register (1A) ----*/
+#define BIT_INT_STATUS_FIFO_OVERLOW 0x80
+#define BIT_MPU_RDY 0x04
+#define BIT_DMP_INT 0x02
+#define BIT_RAW_RDY 0x01
+/*---- MPU 'BANK_SEL' register (37) ----*/
+#define BIT_PRFTCH_EN 0x20
+#define BIT_CFG_USER_BANK 0x10
+#define BITS_MEM_SEL 0x0f
+/*---- MPU 'USER_CTRL' register (3D) ----*/
+#define BIT_DMP_EN 0x80
+#define BIT_FIFO_EN 0x40
+#define BIT_AUX_IF_EN 0x20
+#define BIT_AUX_RD_LENG 0x10
+#define BIT_AUX_IF_RST 0x08
+#define BIT_DMP_RST 0x04
+#define BIT_FIFO_RST 0x02
+#define BIT_GYRO_RST 0x01
+/*---- MPU 'PWR_MGM' register (3E) ----*/
+#define BIT_H_RESET 0x80
+#define BIT_SLEEP 0x40
+#define BIT_STBY_XG 0x20
+#define BIT_STBY_YG 0x10
+#define BIT_STBY_ZG 0x08
+#define BITS_CLKSEL 0x07
+
+/*---- MPU Silicon Revision ----*/
+#define MPU_SILICON_REV_A4 1 /* MPU A4 Device */
+#define MPU_SILICON_REV_B1 2 /* MPU B1 Device */
+#define MPU_SILICON_REV_B4 3 /* MPU B4 Device */
+#define MPU_SILICON_REV_B6 4 /* MPU B6 Device */
+
+/*---- MPU Memory ----*/
+#define MPU_MEM_BANK_SIZE (256)
+#define FIFO_HW_SIZE (512)
+
+enum MPU_MEMORY_BANKS {
+ MPU_MEM_RAM_BANK_0 = 0,
+ MPU_MEM_RAM_BANK_1,
+ MPU_MEM_RAM_BANK_2,
+ MPU_MEM_RAM_BANK_3,
+ MPU_MEM_NUM_RAM_BANKS,
+ MPU_MEM_OTP_BANK_0 = MPU_MEM_NUM_RAM_BANKS,
+ /* This one is always last */
+ MPU_MEM_NUM_BANKS
+};
+
+#define MPU_NUM_AXES (3)
+
+/*---- structure containing control variables used by MLDL ----*/
+/*---- MPU clock source settings ----*/
+/*---- MPU filter selections ----*/
+enum mpu_filter {
+ MPU_FILTER_256HZ_NOLPF2 = 0,
+ MPU_FILTER_188HZ,
+ MPU_FILTER_98HZ,
+ MPU_FILTER_42HZ,
+ MPU_FILTER_20HZ,
+ MPU_FILTER_10HZ,
+ MPU_FILTER_5HZ,
+ MPU_FILTER_2100HZ_NOLPF,
+ NUM_MPU_FILTER
+};
+
+enum mpu_fullscale {
+ MPU_FS_250DPS = 0,
+ MPU_FS_500DPS,
+ MPU_FS_1000DPS,
+ MPU_FS_2000DPS,
+ NUM_MPU_FS
+};
+
+enum mpu_clock_sel {
+ MPU_CLK_SEL_INTERNAL = 0,
+ MPU_CLK_SEL_PLLGYROX,
+ MPU_CLK_SEL_PLLGYROY,
+ MPU_CLK_SEL_PLLGYROZ,
+ MPU_CLK_SEL_PLLEXT32K,
+ MPU_CLK_SEL_PLLEXT19M,
+ MPU_CLK_SEL_RESERVED,
+ MPU_CLK_SEL_STOP,
+ NUM_CLK_SEL
+};
+
+enum mpu_ext_sync {
+ MPU_EXT_SYNC_NONE = 0,
+ MPU_EXT_SYNC_TEMP,
+ MPU_EXT_SYNC_GYROX,
+ MPU_EXT_SYNC_GYROY,
+ MPU_EXT_SYNC_GYROZ,
+ MPU_EXT_SYNC_ACCELX,
+ MPU_EXT_SYNC_ACCELY,
+ MPU_EXT_SYNC_ACCELZ,
+ NUM_MPU_EXT_SYNC
+};
+
+#define DLPF_FS_SYNC_VALUE(ext_sync, full_scale, lpf) \
+ ((ext_sync << 5) | (full_scale << 3) | lpf)
+
+#endif /* __MPU3050_H_ */
diff --git a/include/linux/mpu6000.h b/include/linux/mpu6000.h
new file mode 100644
index 0000000..92f7f20
--- /dev/null
+++ b/include/linux/mpu6000.h
@@ -0,0 +1,406 @@
+/*
+ $License:
+ Copyright (C) 2010 InvenSense Corporation, All Rights Reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ $
+ */
+
+/**
+ * @defgroup
+ * @brief
+ *
+ * @{
+ * @file mpu6000.h
+ * @brief
+ */
+
+#ifndef __MPU6000_H_
+#define __MPU6000_H_
+
+#define MPU_NAME "mpu6000"
+#define DEFAULT_MPU_SLAVEADDR 0x68
+
+/*==== M_HW REGISTER SET ====*/
+enum {
+ MPUREG_XG_OFFS_TC = 0, /* 0x00 */
+ MPUREG_YG_OFFS_TC, /* 0x00 */
+ MPUREG_ZG_OFFS_TC, /* 0x00 */
+ MPUREG_X_FINE_GAIN, /* 0x00 */
+ MPUREG_Y_FINE_GAIN, /* 0x00 */
+ MPUREG_Z_FINE_GAIN, /* 0x00 */
+ MPUREG_XA_OFFS_H, /* 0x00 */
+ MPUREG_XA_OFFS_L_TC, /* 0x00 */
+ MPUREG_YA_OFFS_H, /* 0x00 */
+ MPUREG_YA_OFFS_L_TC, /* 0x00 */
+ MPUREG_ZA_OFFS_H, /* 0x00 */
+ MPUREG_ZA_OFFS_L_TC, /* 0xB */
+ MPUREG_0C_RSVD, /* 0x00 */
+ MPUREG_0D_RSVD, /* 0x00 */
+ MPUREG_0E_RSVD, /* 0x00 */
+ MPUREG_0F_RSVD, /* 0x00 */
+ MPUREG_10_RSVD, /* 0x00 */
+ MPUREG_11_RSVD, /* 0x00 */
+ MPUREG_12_RSVD, /* 0x00 */
+ MPUREG_XG_OFFS_USRH, /* 0x00 */
+ MPUREG_XG_OFFS_USRL, /* 0x00 */
+ MPUREG_YG_OFFS_USRH, /* 0x00 */
+ MPUREG_YG_OFFS_USRL, /* 0x00 */
+ MPUREG_ZG_OFFS_USRH, /* 0x00 */
+ MPUREG_ZG_OFFS_USRL, /* 0x00 */
+ MPUREG_SMPLRT_DIV, /* 0x19 */
+ MPUREG_CONFIG, /* 0x1A ==> DLPF_FS_SYNC */
+ MPUREG_GYRO_CONFIG, /* 0x00 */
+ MPUREG_ACCEL_CONFIG, /* 0x00 */
+ MPUREG_ACCEL_FF_THR, /* 0x00 */
+ MPUREG_ACCEL_FF_DUR, /* 0x00 */
+ MPUREG_ACCEL_MOT_THR, /* 0x00 */
+ MPUREG_ACCEL_MOT_DUR, /* 0x00 */
+ MPUREG_ACCEL_ZRMOT_THR, /* 0x00 */
+ MPUREG_ACCEL_ZRMOT_DUR, /* 0x00 */
+ MPUREG_FIFO_EN, /* 0x23 */
+ MPUREG_I2C_MST_CTRL, /* 0x00 */
+ MPUREG_I2C_SLV0_ADDR, /* 0x25 */
+ MPUREG_I2C_SLV0_REG, /* 0x00 */
+ MPUREG_I2C_SLV0_CTRL, /* 0x00 */
+ MPUREG_I2C_SLV1_ADDR, /* 0x28 */
+ MPUREG_I2C_SLV1_REG_PASSWORD, /* 0x00 */
+ MPUREG_I2C_SLV1_CTRL, /* 0x00 */
+ MPUREG_I2C_SLV2_ADDR, /* 0x2B */
+ MPUREG_I2C_SLV2_REG, /* 0x00 */
+ MPUREG_I2C_SLV2_CTRL, /* 0x00 */
+ MPUREG_I2C_SLV3_ADDR, /* 0x2E */
+ MPUREG_I2C_SLV3_REG, /* 0x00 */
+ MPUREG_I2C_SLV3_CTRL, /* 0x00 */
+ MPUREG_I2C_SLV4_ADDR, /* 0x31 */
+ MPUREG_I2C_SLV4_REG, /* 0x00 */
+ MPUREG_I2C_SLV4_DO, /* 0x00 */
+ MPUREG_I2C_SLV4_CTRL, /* 0x00 */
+ MPUREG_I2C_SLV4_DI, /* 0x00 */
+ MPUREG_I2C_MST_STATUS, /* 0x36 */
+ MPUREG_INT_PIN_CFG, /* 0x37 ==> -* INT_CFG */
+ MPUREG_INT_ENABLE, /* 0x38 ==> / */
+ MPUREG_DMP_INT_STATUS, /* 0x39 */
+ MPUREG_INT_STATUS, /* 0x3A */
+ MPUREG_ACCEL_XOUT_H, /* 0x3B */
+ MPUREG_ACCEL_XOUT_L, /* 0x00 */
+ MPUREG_ACCEL_YOUT_H, /* 0x00 */
+ MPUREG_ACCEL_YOUT_L, /* 0x00 */
+ MPUREG_ACCEL_ZOUT_H, /* 0x00 */
+ MPUREG_ACCEL_ZOUT_L, /* 0x00 */
+ MPUREG_TEMP_OUT_H, /* 0x41 */
+ MPUREG_TEMP_OUT_L, /* 0x00 */
+ MPUREG_GYRO_XOUT_H, /* 0x43 */
+ MPUREG_GYRO_XOUT_L, /* 0x00 */
+ MPUREG_GYRO_YOUT_H, /* 0x00 */
+ MPUREG_GYRO_YOUT_L, /* 0x00 */
+ MPUREG_GYRO_ZOUT_H, /* 0x00 */
+ MPUREG_GYRO_ZOUT_L, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_00, /* 0x49 */
+ MPUREG_EXT_SLV_SENS_DATA_01, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_02, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_03, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_04, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_05, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_06, /* 0x4F */
+ MPUREG_EXT_SLV_SENS_DATA_07, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_08, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_09, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_10, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_11, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_12, /* 0x55 */
+ MPUREG_EXT_SLV_SENS_DATA_13, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_14, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_15, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_16, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_17, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_18, /* 0x5B */
+ MPUREG_EXT_SLV_SENS_DATA_19, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_20, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_21, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_22, /* 0x00 */
+ MPUREG_EXT_SLV_SENS_DATA_23, /* 0x00 */
+ ACCEL_INTEL_STATUS, /* 0x61 */
+ MPUREG_62_RSVD, /* 0x00 */
+ MPUREG_63_RSVD, /* 0x00 */
+ MPUREG_64_RSVD, /* 0x00 */
+ MPUREG_65_RSVD, /* 0x00 */
+ MPUREG_66_RSVD, /* 0x00 */
+ MPUREG_67_RSVD, /* 0x00 */
+ SIGNAL_PATH_RESET, /* 0x68 */
+ ACCEL_INTEL_CTRL, /* 0x69 */
+ MPUREG_USER_CTRL, /* 0x6A */
+ MPUREG_PWR_MGMT_1, /* 0x6B */
+ MPUREG_PWR_MGMT_2, /* 0x00 */
+ MPUREG_BANK_SEL, /* 0x6D */
+ MPUREG_MEM_START_ADDR, /* 0x6E */
+ MPUREG_MEM_R_W, /* 0x6F */
+ MPUREG_PRGM_STRT_ADDRH, /* 0x00 */
+ MPUREG_PRGM_STRT_ADDRL, /* 0x00 */
+ MPUREG_FIFO_COUNTH, /* 0x72 */
+ MPUREG_FIFO_COUNTL, /* 0x00 */
+ MPUREG_FIFO_R_W, /* 0x74 */
+ MPUREG_WHOAMI, /* 0x75,117 */
+
+ NUM_OF_MPU_REGISTERS /* = 0x76,118 */
+};
+
+/*==== M_HW MEMORY ====*/
+enum MPU_MEMORY_BANKS {
+ MEM_RAM_BANK_0 = 0,
+ MEM_RAM_BANK_1,
+ MEM_RAM_BANK_2,
+ MEM_RAM_BANK_3,
+ MEM_RAM_BANK_4,
+ MEM_RAM_BANK_5,
+ MEM_RAM_BANK_6,
+ MEM_RAM_BANK_7,
+ MEM_RAM_BANK_8,
+ MEM_RAM_BANK_9,
+ MEM_RAM_BANK_10,
+ MEM_RAM_BANK_11,
+ MPU_MEM_NUM_RAM_BANKS,
+ MPU_MEM_OTP_BANK_0 = 16
+};
+
+
+/*==== M_HW parameters ====*/
+
+#define NUM_REGS (NUM_OF_MPU_REGISTERS)
+#define START_SENS_REGS (0x3B)
+#define NUM_SENS_REGS (0x60-START_SENS_REGS+1)
+
+/*---- MPU Memory ----*/
+#define NUM_BANKS (MPU_MEM_NUM_RAM_BANKS)
+#define BANK_SIZE (256)
+#define MEM_SIZE (NUM_BANKS*BANK_SIZE)
+#define MPU_MEM_BANK_SIZE (BANK_SIZE) /*alternative name */
+
+#define FIFO_HW_SIZE (1024)
+
+#define NUM_EXT_SLAVES (4)
+
+
+/*==== BITS FOR M_HW ====*/
+
+/*---- M_HW 'FIFO_EN' register (23) ----*/
+#define BIT_TEMP_OUT 0x80
+#define BIT_GYRO_XOUT 0x40
+#define BIT_GYRO_YOUT 0x20
+#define BIT_GYRO_ZOUT 0x10
+#define BIT_ACCEL 0x08
+#define BIT_SLV_2 0x04
+#define BIT_SLV_1 0x02
+#define BIT_SLV_0 0x01
+/*---- M_HW 'CONFIG' register (1A) ----*/
+/*NONE 0xC0 */
+#define BITS_EXT_SYNC_SET 0x38
+#define BITS_DLPF_CFG 0x07
+/*---- M_HW 'GYRO_CONFIG' register (1B) ----*/
+/* voluntarily modified label from BITS_FS_SEL to
+ * BITS_GYRO_FS_SEL to avoid confusion with MPU
+ */
+#define BITS_GYRO_FS_SEL 0x18
+/*NONE 0x07 */
+/*---- M_HW 'ACCEL_CONFIG' register (1C) ----*/
+#define BITS_ACCEL_FS_SEL 0x18
+#define BITS_ACCEL_HPF 0x07
+/*---- M_HW 'I2C_MST_CTRL' register (24) ----*/
+#define BIT_MULT_MST_DIS 0x80
+#define BIT_WAIT_FOR_ES 0x40
+#define BIT_I2C_MST_VDDIO 0x20
+/*NONE 0x10 */
+#define BITS_I2C_MST_CLK 0x0F
+/*---- M_HW 'I2C_SLV?_CTRL' register (27,2A,2D,30) ----*/
+#define BIT_SLV_ENABLE 0x80
+#define BIT_SLV_BYTE_SW 0x40
+/*NONE 0x20 */
+#define BIT_SLV_GRP 0x10
+#define BITS_SLV_LENG 0x0F
+/*---- M_HW 'I2C_SLV4_ADDR' register (31) ----*/
+#define BIT_I2C_SLV4_RNW 0x80
+/*---- M_HW 'I2C_SLV4_CTRL' register (34) ----*/
+#define BIT_I2C_SLV4_EN 0x80
+#define BIT_SLV4_DONE_INT_EN 0x40
+/*NONE 0x3F */
+/*---- M_HW 'I2C_MST_STATUS' register (36) ----*/
+#define BIT_PASSTHROUGH 0x80
+#define BIT_I2C_SLV4_DONE 0x40
+#define BIT_I2C_LOST_ARB 0x20
+#define BIT_I2C_SLV4_NACK 0x10
+#define BIT_I2C_SLV3_NACK 0x08
+#define BIT_I2C_SLV2_NACK 0x04
+#define BIT_I2C_SLV1_NACK 0x02
+#define BIT_I2C_SLV0_NACK 0x01
+/*---- M_HW 'INT_PIN_CFG' register (37) ----*/
+#define BIT_ACTL 0x80
+#define BIT_ACTL_LOW 0x80
+#define BIT_ACTL_HIGH 0x00
+#define BIT_OPEN 0x40
+#define BIT_LATCH_INT_EN 0x20
+#define BIT_INT_ANYRD_2CLEAR 0x10
+#define BIT_ACTL_FSYNC 0x08
+#define BIT_FSYNC_INT_EN 0x04
+#define BIT_BYPASS_EN 0x02
+#define BIT_CLKOUT_EN 0x01
+/*---- M_HW 'INT_ENABLE' register (38) ----*/
+#define BIT_FF_EN 0x80
+#define BIT_MOT_EN 0x40
+#define BIT_ZMOT_EN 0x20
+#define BIT_FIFO_OVERFLOW_EN 0x10
+#define BIT_I2C_MST_INT_EN 0x08
+#define BIT_PLL_RDY_EN 0x04
+#define BIT_DMP_INT_EN 0x02
+#define BIT_RAW_RDY_EN 0x01
+/*---- M_HW 'DMP_INT_STATUS' register (39) ----*/
+/*NONE 0x80 */
+/*NONE 0x40 */
+#define BIT_DMP_INT_5 0x20
+#define BIT_DMP_INT_4 0x10
+#define BIT_DMP_INT_3 0x08
+#define BIT_DMP_INT_2 0x04
+#define BIT_DMP_INT_1 0x02
+#define BIT_DMP_INT_0 0x01
+/*---- M_HW 'INT_STATUS' register (3A) ----*/
+#define BIT_FF_INT 0x80
+#define BIT_MOT_INT 0x40
+#define BIT_ZMOT_INT 0x20
+#define BIT_FIFO_OVERFLOW_INT 0x10
+#define BIT_I2C_MST_INT 0x08
+#define BIT_PLL_RDY_INT 0x04
+#define BIT_DMP_INT 0x02
+#define BIT_RAW_DATA_RDY_INT 0x01
+/*---- M_HW 'BANK_SEL' register (6D) ----*/
+#define BIT_PRFTCH_EN 0x40
+#define BIT_CFG_USER_BANK 0x20
+#define BITS_MEM_SEL 0x1f
+/*---- M_HW 'USER_CTRL' register (6A) ----*/
+#define BIT_DMP_EN 0x80
+#define BIT_FIFO_EN 0x40
+#define BIT_I2C_MST_EN 0x20
+#define BIT_I2C_IF_DIS 0x10
+#define BIT_DMP_RST 0x08
+#define BIT_FIFO_RST 0x04
+#define BIT_I2C_MST_RST 0x02
+#define BIT_SIG_COND_RST 0x01
+/*---- M_HW 'PWR_MGMT_1' register (6B) ----*/
+#define BIT_H_RESET 0x80
+#define BITS_PWRSEL 0x70
+#define BIT_WKUP_INT 0x08
+#define BITS_CLKSEL 0x07
+/*---- M_HW 'PWR_MGMT_2' register (6C) ----*/
+#define BITS_LPA_WAKE_CTRL 0xC0
+#define BIT_STBY_XA 0x20
+#define BIT_STBY_YA 0x10
+#define BIT_STBY_ZA 0x08
+#define BIT_STBY_XG 0x04
+#define BIT_STBY_YG 0x02
+#define BIT_STBY_ZG 0x01
+
+/* although it has 6, this refers to the gyros */
+#define MPU_NUM_AXES (3)
+
+#define ACCEL_MOT_THR_LSB (32) /* mg */
+#define ACCEL_MOT_DUR_LSB (1)
+#define ACCEL_ZRMOT_THR_LSB_CONVERSION(mg) ((mg *1000)/255)
+#define ACCEL_ZRMOT_DUR_LSB (64)
+
+/*----------------------------------------------------------------------------*/
+/*---- Alternative names to take care of conflicts with current mpu3050.h ----*/
+/*----------------------------------------------------------------------------*/
+
+/*-- registers --*/
+#define MPUREG_DLPF_FS_SYNC MPUREG_CONFIG /* 0x1A */
+
+#define MPUREG_PRODUCT_ID MPUREG_WHOAMI /* 0x75 HACK!*/
+#define MPUREG_PWR_MGM MPUREG_PWR_MGMT_1 /* 0x6B */
+#define MPUREG_FIFO_EN1 MPUREG_FIFO_EN /* 0x23 */
+#define MPUREG_DMP_CFG_1 MPUREG_PRGM_STRT_ADDRH /* 0x70 */
+#define MPUREG_DMP_CFG_2 MPUREG_PRGM_STRT_ADDRL /* 0x71 */
+#define MPUREG_INT_CFG MPUREG_INT_ENABLE /* 0x38 */
+#define MPUREG_X_OFFS_USRH MPUREG_XG_OFFS_USRH /* 0x13 */
+#define MPUREG_WHO_AM_I MPUREG_WHOAMI /* 0x75 */
+#define MPUREG_23_RSVD MPUREG_EXT_SLV_SENS_DATA_00 /* 0x49 */
+#define MPUREG_AUX_SLV_ADDR MPUREG_I2C_SLV0_ADDR /* 0x25 */
+#define MPUREG_ACCEL_BURST_ADDR MPUREG_I2C_SLV0_REG /* 0x26 */
+
+/*-- bits --*/
+/* 'USER_CTRL' register */
+#define BIT_AUX_IF_EN BIT_I2C_MST_EN
+#define BIT_AUX_RD_LENG BIT_I2C_MST_EN
+#define BIT_IME_IF_RST BIT_I2C_MST_RST
+#define BIT_GYRO_RST BIT_SIG_COND_RST
+/* 'INT_ENABLE' register */
+#define BIT_RAW_RDY BIT_RAW_DATA_RDY_INT
+#define BIT_MPU_RDY_EN BIT_PLL_RDY_EN
+/* 'INT_STATUS' register */
+#define BIT_INT_STATUS_FIFO_OVERLOW BIT_FIFO_OVERFLOW_INT
+
+
+
+/*---- M_HW Silicon Revisions ----*/
+#define MPU_SILICON_REV_A1 1 /* M_HW A1 Device */
+#define MPU_SILICON_REV_B1 2 /* M_HW B1 Device */
+
+/*---- structure containing control variables used by MLDL ----*/
+/*---- MPU clock source settings ----*/
+/*---- MPU filter selections ----*/
+enum mpu_filter {
+ MPU_FILTER_256HZ_NOLPF2 = 0,
+ MPU_FILTER_188HZ,
+ MPU_FILTER_98HZ,
+ MPU_FILTER_42HZ,
+ MPU_FILTER_20HZ,
+ MPU_FILTER_10HZ,
+ MPU_FILTER_5HZ,
+ MPU_FILTER_2100HZ_NOLPF,
+ NUM_MPU_FILTER
+};
+
+enum mpu_fullscale {
+ MPU_FS_250DPS = 0,
+ MPU_FS_500DPS,
+ MPU_FS_1000DPS,
+ MPU_FS_2000DPS,
+ NUM_MPU_FS
+};
+
+enum mpu_clock_sel {
+ MPU_CLK_SEL_INTERNAL = 0,
+ MPU_CLK_SEL_PLLGYROX,
+ MPU_CLK_SEL_PLLGYROY,
+ MPU_CLK_SEL_PLLGYROZ,
+ MPU_CLK_SEL_PLLEXT32K,
+ MPU_CLK_SEL_PLLEXT19M,
+ MPU_CLK_SEL_RESERVED,
+ MPU_CLK_SEL_STOP,
+ NUM_CLK_SEL
+};
+
+enum mpu_ext_sync {
+ MPU_EXT_SYNC_NONE = 0,
+ MPU_EXT_SYNC_TEMP,
+ MPU_EXT_SYNC_GYROX,
+ MPU_EXT_SYNC_GYROY,
+ MPU_EXT_SYNC_GYROZ,
+ MPU_EXT_SYNC_ACCELX,
+ MPU_EXT_SYNC_ACCELY,
+ MPU_EXT_SYNC_ACCELZ,
+ NUM_MPU_EXT_SYNC
+};
+
+#define DLPF_FS_SYNC_VALUE(ext_sync, full_scale, lpf) \
+ ((ext_sync << 5) | (full_scale << 3) | lpf)
+
+#endif /* __IMU6000_H_ */
diff --git a/include/linux/mpu6050a2.h b/include/linux/mpu6050a2.h
new file mode 100644
index 0000000..7a58b41
--- /dev/null
+++ b/include/linux/mpu6050a2.h
@@ -0,0 +1,425 @@
+/*
+ $License:
+ Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ $
+ */
+
+/**
+ * @defgroup
+ * @brief
+ *
+ * @{
+ * @file mpu6050.h
+ * @brief
+ */
+
+#ifndef __MPU_H_
+#error Do not include this file directly. Include mpu.h instead.
+#endif
+
+#ifndef __MPU6050A2_H_
+#define __MPU6050A2_H_
+
+#if !defined CONFIG_MPU_SENSORS_MPU6050A2
+#error Invalid or undefined CONFIG_MPU_SENSORS_MPUxxxx
+#endif
+
+#define MPU_NAME "mpu6050a2"
+#define DEFAULT_MPU_SLAVEADDR (0x68)
+
+/*==== MPU6050A2 REGISTER SET ====*/
+enum {
+ MPUREG_XG_OFFS_TC = 0, /* 0x00, 0 */
+ MPUREG_YG_OFFS_TC, /* 0x01, 1 */
+ MPUREG_ZG_OFFS_TC, /* 0x02, 2 */
+ MPUREG_X_FINE_GAIN, /* 0x03, 3 */
+ MPUREG_Y_FINE_GAIN, /* 0x04, 4 */
+ MPUREG_Z_FINE_GAIN, /* 0x05, 5 */
+ MPUREG_XA_OFFS_H, /* 0x06, 6 */
+ MPUREG_XA_OFFS_L_TC, /* 0x07, 7 */
+ MPUREG_YA_OFFS_H, /* 0x08, 8 */
+ MPUREG_YA_OFFS_L_TC, /* 0x09, 9 */
+ MPUREG_ZA_OFFS_H, /* 0x0a, 10 */
+ MPUREG_ZA_OFFS_L_TC, /* 0x0B, 11 */
+ MPUREG_0C_RSVD, /* 0x0c, 12 */
+ MPUREG_0D_RSVD, /* 0x0d, 13 */
+ MPUREG_0E_RSVD, /* 0x0e, 14 */
+ MPUREG_0F_RSVD, /* 0x0f, 15 */
+ MPUREG_10_RSVD, /* 0x00, 16 */
+ MPUREG_11_RSVD, /* 0x11, 17 */
+ MPUREG_12_RSVD, /* 0x12, 18 */
+ MPUREG_XG_OFFS_USRH, /* 0x13, 19 */
+ MPUREG_XG_OFFS_USRL, /* 0x14, 20 */
+ MPUREG_YG_OFFS_USRH, /* 0x15, 21 */
+ MPUREG_YG_OFFS_USRL, /* 0x16, 22 */
+ MPUREG_ZG_OFFS_USRH, /* 0x17, 23 */
+ MPUREG_ZG_OFFS_USRL, /* 0x18, 24 */
+ MPUREG_SMPLRT_DIV, /* 0x19, 25 */
+ MPUREG_CONFIG, /* 0x1A, 26 */
+ MPUREG_GYRO_CONFIG, /* 0x1b, 27 */
+ MPUREG_ACCEL_CONFIG, /* 0x1c, 28 */
+ MPUREG_ACCEL_FF_THR, /* 0x1d, 29 */
+ MPUREG_ACCEL_FF_DUR, /* 0x1e, 30 */
+ MPUREG_ACCEL_MOT_THR, /* 0x1f, 31 */
+ MPUREG_ACCEL_MOT_DUR, /* 0x20, 32 */
+ MPUREG_ACCEL_ZRMOT_THR, /* 0x21, 33 */
+ MPUREG_ACCEL_ZRMOT_DUR, /* 0x22, 34 */
+ MPUREG_FIFO_EN, /* 0x23, 35 */
+ MPUREG_I2C_MST_CTRL, /* 0x24, 36 */
+ MPUREG_I2C_SLV0_ADDR, /* 0x25, 37 */
+ MPUREG_I2C_SLV0_REG, /* 0x26, 38 */
+ MPUREG_I2C_SLV0_CTRL, /* 0x27, 39 */
+ MPUREG_I2C_SLV1_ADDR, /* 0x28, 40 */
+ MPUREG_I2C_SLV1_REG_PASSWORD, /* 0x29, 41 */
+ MPUREG_I2C_SLV1_CTRL, /* 0x2a, 42 */
+ MPUREG_I2C_SLV2_ADDR, /* 0x2B, 43 */
+ MPUREG_I2C_SLV2_REG, /* 0x2c, 44 */
+ MPUREG_I2C_SLV2_CTRL, /* 0x2d, 45 */
+ MPUREG_I2C_SLV3_ADDR, /* 0x2E, 46 */
+ MPUREG_I2C_SLV3_REG, /* 0x2f, 47 */
+ MPUREG_I2C_SLV3_CTRL, /* 0x30, 48 */
+ MPUREG_I2C_SLV4_ADDR, /* 0x31, 49 */
+ MPUREG_I2C_SLV4_REG, /* 0x32, 50 */
+ MPUREG_I2C_SLV4_DO, /* 0x33, 51 */
+ MPUREG_I2C_SLV4_CTRL, /* 0x34, 52 */
+ MPUREG_I2C_SLV4_DI, /* 0x35, 53 */
+ MPUREG_I2C_MST_STATUS, /* 0x36, 54 */
+ MPUREG_INT_PIN_CFG, /* 0x37, 55 */
+ MPUREG_INT_ENABLE, /* 0x38, 56 */
+ MPUREG_DMP_INT_STATUS, /* 0x39, 57 */
+ MPUREG_INT_STATUS, /* 0x3A, 58 */
+ MPUREG_ACCEL_XOUT_H, /* 0x3B, 59 */
+ MPUREG_ACCEL_XOUT_L, /* 0x3c, 60 */
+ MPUREG_ACCEL_YOUT_H, /* 0x3d, 61 */
+ MPUREG_ACCEL_YOUT_L, /* 0x3e, 62 */
+ MPUREG_ACCEL_ZOUT_H, /* 0x3f, 63 */
+ MPUREG_ACCEL_ZOUT_L, /* 0x40, 64 */
+ MPUREG_TEMP_OUT_H, /* 0x41, 65 */
+ MPUREG_TEMP_OUT_L, /* 0x42, 66 */
+ MPUREG_GYRO_XOUT_H, /* 0x43, 67 */
+ MPUREG_GYRO_XOUT_L, /* 0x44, 68 */
+ MPUREG_GYRO_YOUT_H, /* 0x45, 69 */
+ MPUREG_GYRO_YOUT_L, /* 0x46, 70 */
+ MPUREG_GYRO_ZOUT_H, /* 0x47, 71 */
+ MPUREG_GYRO_ZOUT_L, /* 0x48, 72 */
+ MPUREG_EXT_SLV_SENS_DATA_00, /* 0x49, 73 */
+ MPUREG_EXT_SLV_SENS_DATA_01, /* 0x4a, 74 */
+ MPUREG_EXT_SLV_SENS_DATA_02, /* 0x4b, 75 */
+ MPUREG_EXT_SLV_SENS_DATA_03, /* 0x4c, 76 */
+ MPUREG_EXT_SLV_SENS_DATA_04, /* 0x4d, 77 */
+ MPUREG_EXT_SLV_SENS_DATA_05, /* 0x4e, 78 */
+ MPUREG_EXT_SLV_SENS_DATA_06, /* 0x4F, 79 */
+ MPUREG_EXT_SLV_SENS_DATA_07, /* 0x50, 80 */
+ MPUREG_EXT_SLV_SENS_DATA_08, /* 0x51, 81 */
+ MPUREG_EXT_SLV_SENS_DATA_09, /* 0x52, 82 */
+ MPUREG_EXT_SLV_SENS_DATA_10, /* 0x53, 83 */
+ MPUREG_EXT_SLV_SENS_DATA_11, /* 0x54, 84 */
+ MPUREG_EXT_SLV_SENS_DATA_12, /* 0x55, 85 */
+ MPUREG_EXT_SLV_SENS_DATA_13, /* 0x56, 86 */
+ MPUREG_EXT_SLV_SENS_DATA_14, /* 0x57, 87 */
+ MPUREG_EXT_SLV_SENS_DATA_15, /* 0x58, 88 */
+ MPUREG_EXT_SLV_SENS_DATA_16, /* 0x59, 89 */
+ MPUREG_EXT_SLV_SENS_DATA_17, /* 0x5a, 90 */
+ MPUREG_EXT_SLV_SENS_DATA_18, /* 0x5B, 91 */
+ MPUREG_EXT_SLV_SENS_DATA_19, /* 0x5c, 92 */
+ MPUREG_EXT_SLV_SENS_DATA_20, /* 0x5d, 93 */
+ MPUREG_EXT_SLV_SENS_DATA_21, /* 0x5e, 94 */
+ MPUREG_EXT_SLV_SENS_DATA_22, /* 0x5f, 95 */
+ MPUREG_EXT_SLV_SENS_DATA_23, /* 0x60, 96 */
+ MPUREG_ACCEL_INTEL_STATUS, /* 0x61, 97 */
+ MPUREG_62_RSVD, /* 0x62, 98 */
+ MPUREG_63_RSVD, /* 0x63, 99 */
+ MPUREG_64_RSVD, /* 0x64, 100 */
+ MPUREG_65_RSVD, /* 0x65, 101 */
+ MPUREG_66_RSVD, /* 0x66, 102 */
+ MPUREG_67_RSVD, /* 0x67, 103 */
+ MPUREG_SIGNAL_PATH_RESET, /* 0x68, 104 */
+ MPUREG_ACCEL_INTEL_CTRL, /* 0x69, 105 */
+ MPUREG_USER_CTRL, /* 0x6A, 106 */
+ MPUREG_PWR_MGMT_1, /* 0x6B, 107 */
+ MPUREG_PWR_MGMT_2, /* 0x6C, 108 */
+ MPUREG_BANK_SEL, /* 0x6D, 109 */
+ MPUREG_MEM_START_ADDR, /* 0x6E, 100 */
+ MPUREG_MEM_R_W, /* 0x6F, 111 */
+ MPUREG_DMP_CFG_1, /* 0x70, 112 */
+ MPUREG_DMP_CFG_2, /* 0x71, 113 */
+ MPUREG_FIFO_COUNTH, /* 0x72, 114 */
+ MPUREG_FIFO_COUNTL, /* 0x73, 115 */
+ MPUREG_FIFO_R_W, /* 0x74, 116 */
+ MPUREG_WHOAMI, /* 0x75, 117 */
+
+ NUM_OF_MPU_REGISTERS /* = 0x76, 118 */
+};
+
+/*==== MPU6050A2 MEMORY ====*/
+enum MPU_MEMORY_BANKS {
+ MEM_RAM_BANK_0 = 0,
+ MEM_RAM_BANK_1,
+ MEM_RAM_BANK_2,
+ MEM_RAM_BANK_3,
+ MEM_RAM_BANK_4,
+ MEM_RAM_BANK_5,
+ MEM_RAM_BANK_6,
+ MEM_RAM_BANK_7,
+ MEM_RAM_BANK_8,
+ MEM_RAM_BANK_9,
+ MEM_RAM_BANK_10,
+ MEM_RAM_BANK_11,
+ MPU_MEM_NUM_RAM_BANKS,
+ MPU_MEM_OTP_BANK_0 = 16
+};
+
+
+/*==== MPU6050A2 parameters ====*/
+
+#define NUM_REGS (NUM_OF_MPU_REGISTERS)
+#define START_SENS_REGS (0x3B)
+#define NUM_SENS_REGS (0x60 - START_SENS_REGS + 1)
+
+/*---- MPU Memory ----*/
+#define NUM_BANKS (MPU_MEM_NUM_RAM_BANKS)
+#define BANK_SIZE (256)
+#define MEM_SIZE (NUM_BANKS * BANK_SIZE)
+#define MPU_MEM_BANK_SIZE (BANK_SIZE) /*alternative name */
+
+#define FIFO_HW_SIZE (1024)
+
+#define NUM_EXT_SLAVES (4)
+
+
+/*==== BITS FOR MPU6050A2 ====*/
+
+/*---- MPU6050A2 'XG_OFFS_TC' register (0, 1, 2) ----*/
+#define BIT_PWR_MODE 0x80
+#define BITS_XG_OFFS_TC 0x7E
+#define BIT_OTP_BNK_VLD 0x01
+
+#define BITS_YG_OFFS_TC 0x7E
+#define BITS_ZG_OFFS_TC 0x7E
+/*---- MPU6050A2 'FIFO_EN' register (23) ----*/
+#define BIT_TEMP_OUT 0x80
+#define BIT_GYRO_XOUT 0x40
+#define BIT_GYRO_YOUT 0x20
+#define BIT_GYRO_ZOUT 0x10
+#define BIT_ACCEL 0x08
+#define BIT_SLV_2 0x04
+#define BIT_SLV_1 0x02
+#define BIT_SLV_0 0x01
+/*---- MPU6050A2 'CONFIG' register (1A) ----*/
+/*NONE 0xC0 */
+#define BITS_EXT_SYNC_SET 0x38
+#define BITS_DLPF_CFG 0x07
+/*---- MPU6050A2 'GYRO_CONFIG' register (1B) ----*/
+/* voluntarily modified label from BITS_FS_SEL to
+ * BITS_GYRO_FS_SEL to avoid confusion with MPU
+ */
+#define BITS_GYRO_FS_SEL 0x18
+/*NONE 0x07 */
+/*---- MPU6050A2 'ACCEL_CONFIG' register (1C) ----*/
+#define BITS_ACCEL_FS_SEL 0x18
+#define BITS_ACCEL_HPF 0x07
+/*---- MPU6050A2 'I2C_MST_CTRL' register (24) ----*/
+#define BIT_MULT_MST_DIS 0x80
+#define BIT_WAIT_FOR_ES 0x40
+#define BIT_I2C_MST_VDDIO 0x20
+/*NONE 0x10 */
+#define BITS_I2C_MST_CLK 0x0F
+/*---- MPU6050A2 'I2C_SLV?_CTRL' register (27,2A,2D,30) ----*/
+#define BIT_SLV_ENABLE 0x80
+#define BIT_SLV_BYTE_SW 0x40
+/*NONE 0x20 */
+#define BIT_SLV_GRP 0x10
+#define BITS_SLV_LENG 0x0F
+/*---- MPU6050A2 'I2C_SLV4_ADDR' register (31) ----*/
+#define BIT_I2C_SLV4_RNW 0x80
+/*---- MPU6050A2 'I2C_SLV4_CTRL' register (34) ----*/
+#define BIT_I2C_SLV4_EN 0x80
+#define BIT_SLV4_DONE_INT_EN 0x40
+/*NONE 0x3F */
+/*---- MPU6050A2 'I2C_MST_STATUS' register (36) ----*/
+#define BIT_PASSTHROUGH 0x80
+#define BIT_I2C_SLV4_DONE 0x40
+#define BIT_I2C_LOST_ARB 0x20
+#define BIT_I2C_SLV4_NACK 0x10
+#define BIT_I2C_SLV3_NACK 0x08
+#define BIT_I2C_SLV2_NACK 0x04
+#define BIT_I2C_SLV1_NACK 0x02
+#define BIT_I2C_SLV0_NACK 0x01
+/*---- MPU6050A2 'INT_PIN_CFG' register (37) ----*/
+#define BIT_ACTL 0x80
+#define BIT_ACTL_LOW 0x80
+#define BIT_ACTL_HIGH 0x00
+#define BIT_OPEN 0x40
+#define BIT_LATCH_INT_EN 0x20
+#define BIT_INT_ANYRD_2CLEAR 0x10
+#define BIT_ACTL_FSYNC 0x08
+#define BIT_FSYNC_INT_EN 0x04
+#define BIT_BYPASS_EN 0x02
+#define BIT_CLKOUT_EN 0x01
+/*---- MPU6050A2 'INT_ENABLE' register (38) ----*/
+#define BIT_FF_EN 0x80
+#define BIT_MOT_EN 0x40
+#define BIT_ZMOT_EN 0x20
+#define BIT_FIFO_OVERFLOW_EN 0x10
+#define BIT_I2C_MST_INT_EN 0x08
+#define BIT_PLL_RDY_EN 0x04
+#define BIT_DMP_INT_EN 0x02
+#define BIT_RAW_RDY_EN 0x01
+/*---- MPU6050A2 'DMP_INT_STATUS' register (39) ----*/
+/*NONE 0x80 */
+/*NONE 0x40 */
+#define BIT_DMP_INT_5 0x20
+#define BIT_DMP_INT_4 0x10
+#define BIT_DMP_INT_3 0x08
+#define BIT_DMP_INT_2 0x04
+#define BIT_DMP_INT_1 0x02
+#define BIT_DMP_INT_0 0x01
+/*---- MPU6050A2 'INT_STATUS' register (3A) ----*/
+#define BIT_FF_INT 0x80
+#define BIT_MOT_INT 0x40
+#define BIT_ZMOT_INT 0x20
+#define BIT_FIFO_OVERFLOW_INT 0x10
+#define BIT_I2C_MST_INT 0x08
+#define BIT_PLL_RDY_INT 0x04
+#define BIT_DMP_INT 0x02
+#define BIT_RAW_DATA_RDY_INT 0x01
+/*---- MPU6050A2 'BANK_SEL' register (6D) ----*/
+#define BIT_PRFTCH_EN 0x40
+#define BIT_CFG_USER_BANK 0x20
+#define BITS_MEM_SEL 0x1f
+/*---- MPU6050A2 'USER_CTRL' register (6A) ----*/
+#define BIT_DMP_EN 0x80
+#define BIT_FIFO_EN 0x40
+#define BIT_I2C_MST_EN 0x20
+#define BIT_I2C_IF_DIS 0x10
+#define BIT_DMP_RST 0x08
+#define BIT_FIFO_RST 0x04
+#define BIT_I2C_MST_RST 0x02
+#define BIT_SIG_COND_RST 0x01
+/*---- MPU6050A2 'PWR_MGMT_1' register (6B) ----*/
+#define BIT_H_RESET 0x80
+#define BITS_PWRSEL 0x70
+#define BIT_WKUP_INT 0x08
+#define BITS_CLKSEL 0x07
+/*---- MPU6050A2 'PWR_MGMT_2' register (6C) ----*/
+#define BITS_LPA_WAKE_CTRL 0xC0
+#define BIT_STBY_XA 0x20
+#define BIT_STBY_YA 0x10
+#define BIT_STBY_ZA 0x08
+#define BIT_STBY_XG 0x04
+#define BIT_STBY_YG 0x02
+#define BIT_STBY_ZG 0x01
+
+/* although it has 6, this refers to the gyros */
+#define MPU_NUM_AXES (3)
+
+#define ACCEL_MOT_THR_LSB (32) /* mg */
+#define ACCEL_MOT_DUR_LSB (1)
+#define ACCEL_ZRMOT_THR_LSB_CONVERSION(mg) ((mg * 1000) / 255)
+#define ACCEL_ZRMOT_DUR_LSB (64)
+
+/*----------------------------------------------------------------------------*/
+/*---- Alternative names to take care of conflicts with current mpu3050.h ----*/
+/*----------------------------------------------------------------------------*/
+
+/*-- registers --*/
+#define MPUREG_DLPF_FS_SYNC MPUREG_CONFIG /* 0x1A */
+
+#define MPUREG_PRODUCT_ID MPUREG_WHOAMI /* 0x75 HACK!*/
+#define MPUREG_PWR_MGM MPUREG_PWR_MGMT_1 /* 0x6B */
+#define MPUREG_FIFO_EN1 MPUREG_FIFO_EN /* 0x23 */
+#define MPUREG_INT_CFG MPUREG_INT_ENABLE /* 0x38 */
+#define MPUREG_X_OFFS_USRH MPUREG_XG_OFFS_USRH /* 0x13 */
+#define MPUREG_WHO_AM_I MPUREG_WHOAMI /* 0x75 */
+#define MPUREG_23_RSVD MPUREG_EXT_SLV_SENS_DATA_00 /* 0x49 */
+#define MPUREG_AUX_SLV_ADDR MPUREG_I2C_SLV0_ADDR /* 0x25 */
+#define MPUREG_ACCEL_BURST_ADDR MPUREG_I2C_SLV0_REG /* 0x26 */
+
+/*-- bits --*/
+/* 'USER_CTRL' register */
+#define BIT_AUX_IF_EN BIT_I2C_MST_EN
+#define BIT_AUX_RD_LENG BIT_I2C_MST_EN
+#define BIT_IME_IF_RST BIT_I2C_MST_RST
+#define BIT_GYRO_RST BIT_SIG_COND_RST
+/* 'INT_ENABLE' register */
+#define BIT_RAW_RDY BIT_RAW_DATA_RDY_INT
+#define BIT_MPU_RDY_EN BIT_PLL_RDY_EN
+/* 'INT_STATUS' register */
+#define BIT_INT_STATUS_FIFO_OVERLOW BIT_FIFO_OVERFLOW_INT
+
+
+
+/*---- MPU6050A2 Silicon Revisions ----*/
+#define MPU_SILICON_REV_A2 1 /* MPU6050A2 Device */
+#define MPU_SILICON_REV_B1 2 /* MPU6050A2 Device */
+
+/*---- structure containing control variables used by MLDL ----*/
+/*---- MPU clock source settings ----*/
+/*---- MPU filter selections ----*/
+enum mpu_filter {
+ MPU_FILTER_256HZ_NOLPF2 = 0,
+ MPU_FILTER_188HZ,
+ MPU_FILTER_98HZ,
+ MPU_FILTER_42HZ,
+ MPU_FILTER_20HZ,
+ MPU_FILTER_10HZ,
+ MPU_FILTER_5HZ,
+ MPU_FILTER_2100HZ_NOLPF,
+ NUM_MPU_FILTER
+};
+
+enum mpu_fullscale {
+ MPU_FS_250DPS = 0,
+ MPU_FS_500DPS,
+ MPU_FS_1000DPS,
+ MPU_FS_2000DPS,
+ NUM_MPU_FS
+};
+
+enum mpu_clock_sel {
+ MPU_CLK_SEL_INTERNAL = 0,
+ MPU_CLK_SEL_PLLGYROX,
+ MPU_CLK_SEL_PLLGYROY,
+ MPU_CLK_SEL_PLLGYROZ,
+ MPU_CLK_SEL_PLLEXT32K,
+ MPU_CLK_SEL_PLLEXT19M,
+ MPU_CLK_SEL_RESERVED,
+ MPU_CLK_SEL_STOP,
+ NUM_CLK_SEL
+};
+
+enum mpu_ext_sync {
+ MPU_EXT_SYNC_NONE = 0,
+ MPU_EXT_SYNC_TEMP,
+ MPU_EXT_SYNC_GYROX,
+ MPU_EXT_SYNC_GYROY,
+ MPU_EXT_SYNC_GYROZ,
+ MPU_EXT_SYNC_ACCELX,
+ MPU_EXT_SYNC_ACCELY,
+ MPU_EXT_SYNC_ACCELZ,
+ NUM_MPU_EXT_SYNC
+};
+
+#define MPUREG_CONFIG_VALUE(ext_sync, lpf) \
+ ((ext_sync << 3) | lpf)
+
+#define MPUREG_GYRO_CONFIG_VALUE(x_st, y_st, z_st, full_scale) \
+ ((x_st ? 0x80 : 0) | \
+ (y_st ? 0x70 : 0) | \
+ (z_st ? 0x60 : 0) | \
+ (full_scale << 3))
+
+#endif /* __MPU6050_H_ */
diff --git a/include/linux/mpu6050b1.h b/include/linux/mpu6050b1.h
new file mode 100644
index 0000000..8758ce1
--- /dev/null
+++ b/include/linux/mpu6050b1.h
@@ -0,0 +1,439 @@
+/*
+ $License:
+ Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ $
+ */
+
+/**
+ * @defgroup
+ * @brief
+ *
+ * @{
+ * @file mpu6050.h
+ * @brief
+ */
+
+#ifndef __MPU_H_
+#error Do not include this file directly. Include mpu.h instead.
+#endif
+
+#ifndef __MPU6050B1_H_
+#define __MPU6050B1_H_
+
+#if !defined CONFIG_MPU_SENSORS_MPU6050B1
+#error Invalid or undefined CONFIG_MPU_SENSORS_MPUxxxx
+#endif
+
+#define MPU_NAME "mpu6050B1"
+#define DEFAULT_MPU_SLAVEADDR 0x68
+
+/*==== MPU6050B1 REGISTER SET ====*/
+enum {
+ MPUREG_XG_OFFS_TC = 0, /* 0x00, 0 */
+ MPUREG_YG_OFFS_TC, /* 0x01, 1 */
+ MPUREG_ZG_OFFS_TC, /* 0x02, 2 */
+ MPUREG_X_FINE_GAIN, /* 0x03, 3 */
+ MPUREG_Y_FINE_GAIN, /* 0x04, 4 */
+ MPUREG_Z_FINE_GAIN, /* 0x05, 5 */
+ MPUREG_XA_OFFS_H, /* 0x06, 6 */
+ MPUREG_XA_OFFS_L, /* 0x07, 7 */
+ MPUREG_YA_OFFS_H, /* 0x08, 8 */
+ MPUREG_YA_OFFS_L, /* 0x09, 9 */
+ MPUREG_ZA_OFFS_H, /* 0x0a, 10 */
+ MPUREG_ZA_OFFS_L, /* 0x0B, 11 */
+ MPUREG_PRODUCT_ID, /* 0x0c, 12 */
+ MPUREG_0D_RSVD, /* 0x0d, 13 */
+ MPUREG_0E_RSVD, /* 0x0e, 14 */
+ MPUREG_0F_RSVD, /* 0x0f, 15 */
+ MPUREG_10_RSVD, /* 0x00, 16 */
+ MPUREG_11_RSVD, /* 0x11, 17 */
+ MPUREG_12_RSVD, /* 0x12, 18 */
+ MPUREG_XG_OFFS_USRH, /* 0x13, 19 */
+ MPUREG_XG_OFFS_USRL, /* 0x14, 20 */
+ MPUREG_YG_OFFS_USRH, /* 0x15, 21 */
+ MPUREG_YG_OFFS_USRL, /* 0x16, 22 */
+ MPUREG_ZG_OFFS_USRH, /* 0x17, 23 */
+ MPUREG_ZG_OFFS_USRL, /* 0x18, 24 */
+ MPUREG_SMPLRT_DIV, /* 0x19, 25 */
+ MPUREG_CONFIG, /* 0x1A, 26 */
+ MPUREG_GYRO_CONFIG, /* 0x1b, 27 */
+ MPUREG_ACCEL_CONFIG, /* 0x1c, 28 */
+ MPUREG_ACCEL_FF_THR, /* 0x1d, 29 */
+ MPUREG_ACCEL_FF_DUR, /* 0x1e, 30 */
+ MPUREG_ACCEL_MOT_THR, /* 0x1f, 31 */
+ MPUREG_ACCEL_MOT_DUR, /* 0x20, 32 */
+ MPUREG_ACCEL_ZRMOT_THR, /* 0x21, 33 */
+ MPUREG_ACCEL_ZRMOT_DUR, /* 0x22, 34 */
+ MPUREG_FIFO_EN, /* 0x23, 35 */
+ MPUREG_I2C_MST_CTRL, /* 0x24, 36 */
+ MPUREG_I2C_SLV0_ADDR, /* 0x25, 37 */
+ MPUREG_I2C_SLV0_REG, /* 0x26, 38 */
+ MPUREG_I2C_SLV0_CTRL, /* 0x27, 39 */
+ MPUREG_I2C_SLV1_ADDR, /* 0x28, 40 */
+ MPUREG_I2C_SLV1_REG_PASSWORD, /* 0x29, 41 */
+ MPUREG_I2C_SLV1_CTRL, /* 0x2a, 42 */
+ MPUREG_I2C_SLV2_ADDR, /* 0x2B, 43 */
+ MPUREG_I2C_SLV2_REG, /* 0x2c, 44 */
+ MPUREG_I2C_SLV2_CTRL, /* 0x2d, 45 */
+ MPUREG_I2C_SLV3_ADDR, /* 0x2E, 46 */
+ MPUREG_I2C_SLV3_REG, /* 0x2f, 47 */
+ MPUREG_I2C_SLV3_CTRL, /* 0x30, 48 */
+ MPUREG_I2C_SLV4_ADDR, /* 0x31, 49 */
+ MPUREG_I2C_SLV4_REG, /* 0x32, 50 */
+ MPUREG_I2C_SLV4_DO, /* 0x33, 51 */
+ MPUREG_I2C_SLV4_CTRL, /* 0x34, 52 */
+ MPUREG_I2C_SLV4_DI, /* 0x35, 53 */
+ MPUREG_I2C_MST_STATUS, /* 0x36, 54 */
+ MPUREG_INT_PIN_CFG, /* 0x37, 55 */
+ MPUREG_INT_ENABLE, /* 0x38, 56 */
+ MPUREG_DMP_INT_STATUS, /* 0x39, 57 */
+ MPUREG_INT_STATUS, /* 0x3A, 58 */
+ MPUREG_ACCEL_XOUT_H, /* 0x3B, 59 */
+ MPUREG_ACCEL_XOUT_L, /* 0x3c, 60 */
+ MPUREG_ACCEL_YOUT_H, /* 0x3d, 61 */
+ MPUREG_ACCEL_YOUT_L, /* 0x3e, 62 */
+ MPUREG_ACCEL_ZOUT_H, /* 0x3f, 63 */
+ MPUREG_ACCEL_ZOUT_L, /* 0x40, 64 */
+ MPUREG_TEMP_OUT_H, /* 0x41, 65 */
+ MPUREG_TEMP_OUT_L, /* 0x42, 66 */
+ MPUREG_GYRO_XOUT_H, /* 0x43, 67 */
+ MPUREG_GYRO_XOUT_L, /* 0x44, 68 */
+ MPUREG_GYRO_YOUT_H, /* 0x45, 69 */
+ MPUREG_GYRO_YOUT_L, /* 0x46, 70 */
+ MPUREG_GYRO_ZOUT_H, /* 0x47, 71 */
+ MPUREG_GYRO_ZOUT_L, /* 0x48, 72 */
+ MPUREG_EXT_SLV_SENS_DATA_00, /* 0x49, 73 */
+ MPUREG_EXT_SLV_SENS_DATA_01, /* 0x4a, 74 */
+ MPUREG_EXT_SLV_SENS_DATA_02, /* 0x4b, 75 */
+ MPUREG_EXT_SLV_SENS_DATA_03, /* 0x4c, 76 */
+ MPUREG_EXT_SLV_SENS_DATA_04, /* 0x4d, 77 */
+ MPUREG_EXT_SLV_SENS_DATA_05, /* 0x4e, 78 */
+ MPUREG_EXT_SLV_SENS_DATA_06, /* 0x4F, 79 */
+ MPUREG_EXT_SLV_SENS_DATA_07, /* 0x50, 80 */
+ MPUREG_EXT_SLV_SENS_DATA_08, /* 0x51, 81 */
+ MPUREG_EXT_SLV_SENS_DATA_09, /* 0x52, 82 */
+ MPUREG_EXT_SLV_SENS_DATA_10, /* 0x53, 83 */
+ MPUREG_EXT_SLV_SENS_DATA_11, /* 0x54, 84 */
+ MPUREG_EXT_SLV_SENS_DATA_12, /* 0x55, 85 */
+ MPUREG_EXT_SLV_SENS_DATA_13, /* 0x56, 86 */
+ MPUREG_EXT_SLV_SENS_DATA_14, /* 0x57, 87 */
+ MPUREG_EXT_SLV_SENS_DATA_15, /* 0x58, 88 */
+ MPUREG_EXT_SLV_SENS_DATA_16, /* 0x59, 89 */
+ MPUREG_EXT_SLV_SENS_DATA_17, /* 0x5a, 90 */
+ MPUREG_EXT_SLV_SENS_DATA_18, /* 0x5B, 91 */
+ MPUREG_EXT_SLV_SENS_DATA_19, /* 0x5c, 92 */
+ MPUREG_EXT_SLV_SENS_DATA_20, /* 0x5d, 93 */
+ MPUREG_EXT_SLV_SENS_DATA_21, /* 0x5e, 94 */
+ MPUREG_EXT_SLV_SENS_DATA_22, /* 0x5f, 95 */
+ MPUREG_EXT_SLV_SENS_DATA_23, /* 0x60, 96 */
+ MPUREG_ACCEL_INTEL_STATUS, /* 0x61, 97 */
+ MPUREG_62_RSVD, /* 0x62, 98 */
+ MPUREG_I2C_SLV0_DO, /* 0x63, 99 */
+ MPUREG_I2C_SLV1_DO, /* 0x64, 100 */
+ MPUREG_I2C_SLV2_DO, /* 0x65, 101 */
+ MPUREG_I2C_SLV3_DO, /* 0x66, 102 */
+ MPUREG_I2C_MST_DELAY_CTRL, /* 0x67, 103 */
+ MPUREG_SIGNAL_PATH_RESET, /* 0x68, 104 */
+ MPUREG_ACCEL_INTEL_CTRL, /* 0x69, 105 */
+ MPUREG_USER_CTRL, /* 0x6A, 106 */
+ MPUREG_PWR_MGMT_1, /* 0x6B, 107 */
+ MPUREG_PWR_MGMT_2, /* 0x6C, 108 */
+ MPUREG_BANK_SEL, /* 0x6D, 109 */
+ MPUREG_MEM_START_ADDR, /* 0x6E, 100 */
+ MPUREG_MEM_R_W, /* 0x6F, 111 */
+ MPUREG_DMP_CFG_1, /* 0x70, 112 */
+ MPUREG_DMP_CFG_2, /* 0x71, 113 */
+ MPUREG_FIFO_COUNTH, /* 0x72, 114 */
+ MPUREG_FIFO_COUNTL, /* 0x73, 115 */
+ MPUREG_FIFO_R_W, /* 0x74, 116 */
+ MPUREG_WHOAMI, /* 0x75, 117 */
+
+ NUM_OF_MPU_REGISTERS /* = 0x76, 118 */
+};
+
+/*==== MPU6050B1 MEMORY ====*/
+enum MPU_MEMORY_BANKS {
+ MEM_RAM_BANK_0 = 0,
+ MEM_RAM_BANK_1,
+ MEM_RAM_BANK_2,
+ MEM_RAM_BANK_3,
+ MEM_RAM_BANK_4,
+ MEM_RAM_BANK_5,
+ MEM_RAM_BANK_6,
+ MEM_RAM_BANK_7,
+ MEM_RAM_BANK_8,
+ MEM_RAM_BANK_9,
+ MEM_RAM_BANK_10,
+ MEM_RAM_BANK_11,
+ MPU_MEM_NUM_RAM_BANKS,
+ MPU_MEM_OTP_BANK_0 = 16
+};
+
+
+/*==== MPU6050B1 parameters ====*/
+
+#define NUM_REGS (NUM_OF_MPU_REGISTERS)
+#define START_SENS_REGS (0x3B)
+#define NUM_SENS_REGS (0x60 - START_SENS_REGS + 1)
+
+/*---- MPU Memory ----*/
+#define NUM_BANKS (MPU_MEM_NUM_RAM_BANKS)
+#define BANK_SIZE (256)
+#define MEM_SIZE (NUM_BANKS * BANK_SIZE)
+#define MPU_MEM_BANK_SIZE (BANK_SIZE) /*alternative name */
+
+#define FIFO_HW_SIZE (1024)
+
+#define NUM_EXT_SLAVES (4)
+
+
+/*==== BITS FOR MPU6050B1 ====*/
+/*---- MPU6050B1 'XG_OFFS_TC' register (0, 1, 2) ----*/
+#define BIT_PU_SLEEP_MODE 0x80
+#define BITS_XG_OFFS_TC 0x7E
+#define BIT_OTP_BNK_VLD 0x01
+
+#define BIT_I2C_MST_VDDIO 0x80
+#define BITS_YG_OFFS_TC 0x7E
+#define BITS_ZG_OFFS_TC 0x7E
+/*---- MPU6050B1 'FIFO_EN' register (23) ----*/
+#define BIT_TEMP_OUT 0x80
+#define BIT_GYRO_XOUT 0x40
+#define BIT_GYRO_YOUT 0x20
+#define BIT_GYRO_ZOUT 0x10
+#define BIT_ACCEL 0x08
+#define BIT_SLV_2 0x04
+#define BIT_SLV_1 0x02
+#define BIT_SLV_0 0x01
+/*---- MPU6050B1 'CONFIG' register (1A) ----*/
+/*NONE 0xC0 */
+#define BITS_EXT_SYNC_SET 0x38
+#define BITS_DLPF_CFG 0x07
+/*---- MPU6050B1 'GYRO_CONFIG' register (1B) ----*/
+/* voluntarily modified label from BITS_FS_SEL to
+ * BITS_GYRO_FS_SEL to avoid confusion with MPU
+ */
+#define BITS_GYRO_FS_SEL 0x18
+/*NONE 0x07 */
+/*---- MPU6050B1 'ACCEL_CONFIG' register (1C) ----*/
+#define BITS_ACCEL_FS_SEL 0x18
+#define BITS_ACCEL_HPF 0x07
+/*---- MPU6050B1 'I2C_MST_CTRL' register (24) ----*/
+#define BIT_MULT_MST_EN 0x80
+#define BIT_WAIT_FOR_ES 0x40
+#define BIT_SLV_3_FIFO_EN 0x20
+#define BIT_I2C_MST_PSR 0x10
+#define BITS_I2C_MST_CLK 0x0F
+/*---- MPU6050B1 'I2C_SLV?_ADDR' register (27,2A,2D,30) ----*/
+#define BIT_I2C_READ 0x80
+#define BIT_I2C_WRITE 0x00
+#define BITS_I2C_ADDR 0x7F
+/*---- MPU6050B1 'I2C_SLV?_CTRL' register (27,2A,2D,30) ----*/
+#define BIT_SLV_ENABLE 0x80
+#define BIT_SLV_BYTE_SW 0x40
+#define BIT_SLV_REG_DIS 0x20
+#define BIT_SLV_GRP 0x10
+#define BITS_SLV_LENG 0x0F
+/*---- MPU6050B1 'I2C_SLV4_ADDR' register (31) ----*/
+#define BIT_I2C_SLV4_RNW 0x80
+/*---- MPU6050B1 'I2C_SLV4_CTRL' register (34) ----*/
+#define BIT_I2C_SLV4_EN 0x80
+#define BIT_SLV4_DONE_INT_EN 0x40
+#define BIT_SLV4_REG_DIS 0x20
+#define MASK_I2C_MST_DLY 0x1F
+/*---- MPU6050B1 'I2C_MST_STATUS' register (36) ----*/
+#define BIT_PASS_THROUGH 0x80
+#define BIT_I2C_SLV4_DONE 0x40
+#define BIT_I2C_LOST_ARB 0x20
+#define BIT_I2C_SLV4_NACK 0x10
+#define BIT_I2C_SLV3_NACK 0x08
+#define BIT_I2C_SLV2_NACK 0x04
+#define BIT_I2C_SLV1_NACK 0x02
+#define BIT_I2C_SLV0_NACK 0x01
+/*---- MPU6050B1 'INT_PIN_CFG' register (37) ----*/
+#define BIT_ACTL 0x80
+#define BIT_ACTL_LOW 0x80
+#define BIT_ACTL_HIGH 0x00
+#define BIT_OPEN 0x40
+#define BIT_LATCH_INT_EN 0x20
+#define BIT_INT_ANYRD_2CLEAR 0x10
+#define BIT_ACTL_FSYNC 0x08
+#define BIT_FSYNC_INT_EN 0x04
+#define BIT_BYPASS_EN 0x02
+#define BIT_CLKOUT_EN 0x01
+/*---- MPU6050B1 'INT_ENABLE' register (38) ----*/
+#define BIT_FF_EN 0x80
+#define BIT_MOT_EN 0x40
+#define BIT_ZMOT_EN 0x20
+#define BIT_FIFO_OVERFLOW_EN 0x10
+#define BIT_I2C_MST_INT_EN 0x08
+#define BIT_PLL_RDY_EN 0x04
+#define BIT_DMP_INT_EN 0x02
+#define BIT_RAW_RDY_EN 0x01
+/*---- MPU6050B1 'DMP_INT_STATUS' register (39) ----*/
+/*NONE 0x80 */
+/*NONE 0x40 */
+#define BIT_DMP_INT_5 0x20
+#define BIT_DMP_INT_4 0x10
+#define BIT_DMP_INT_3 0x08
+#define BIT_DMP_INT_2 0x04
+#define BIT_DMP_INT_1 0x02
+#define BIT_DMP_INT_0 0x01
+/*---- MPU6050B1 'INT_STATUS' register (3A) ----*/
+#define BIT_FF_INT 0x80
+#define BIT_MOT_INT 0x40
+#define BIT_ZMOT_INT 0x20
+#define BIT_FIFO_OVERFLOW_INT 0x10
+#define BIT_I2C_MST_INT 0x08
+#define BIT_PLL_RDY_INT 0x04
+#define BIT_DMP_INT 0x02
+#define BIT_RAW_DATA_RDY_INT 0x01
+/*---- MPU6050B1 'MPUREG_I2C_MST_DELAY_CTRL' register (0x67) ----*/
+#define BIT_DELAY_ES_SHADOW 0x80
+#define BIT_SLV4_DLY_EN 0x10
+#define BIT_SLV3_DLY_EN 0x08
+#define BIT_SLV2_DLY_EN 0x04
+#define BIT_SLV1_DLY_EN 0x02
+#define BIT_SLV0_DLY_EN 0x01
+/*---- MPU6050B1 'BANK_SEL' register (6D) ----*/
+#define BIT_PRFTCH_EN 0x40
+#define BIT_CFG_USER_BANK 0x20
+#define BITS_MEM_SEL 0x1f
+/*---- MPU6050B1 'USER_CTRL' register (6A) ----*/
+#define BIT_DMP_EN 0x80
+#define BIT_FIFO_EN 0x40
+#define BIT_I2C_MST_EN 0x20
+#define BIT_I2C_IF_DIS 0x10
+#define BIT_DMP_RST 0x08
+#define BIT_FIFO_RST 0x04
+#define BIT_I2C_MST_RST 0x02
+#define BIT_SIG_COND_RST 0x01
+/*---- MPU6050B1 'PWR_MGMT_1' register (6B) ----*/
+#define BIT_H_RESET 0x80
+#define BIT_SLEEP 0x40
+#define BIT_CYCLE 0x20
+#define BIT_PD_PTAT 0x08
+#define BITS_CLKSEL 0x07
+/*---- MPU6050B1 'PWR_MGMT_2' register (6C) ----*/
+#define BITS_LPA_WAKE_CTRL 0xC0
+#define BIT_STBY_XA 0x20
+#define BIT_STBY_YA 0x10
+#define BIT_STBY_ZA 0x08
+#define BIT_STBY_XG 0x04
+#define BIT_STBY_YG 0x02
+#define BIT_STBY_ZG 0x01
+
+/* although it has 6, this refers to the gyros */
+#define MPU_NUM_AXES (3)
+
+#define ACCEL_MOT_THR_LSB (32) /* mg */
+#define ACCEL_MOT_DUR_LSB (1)
+#define ACCEL_ZRMOT_THR_LSB_CONVERSION(mg) ((mg * 1000) / 255)
+#define ACCEL_ZRMOT_DUR_LSB (64)
+
+/*----------------------------------------------------------------------------*/
+/*---- Alternative names to take care of conflicts with current mpu3050.h ----*/
+/*----------------------------------------------------------------------------*/
+
+/*-- registers --*/
+#define MPUREG_DLPF_FS_SYNC MPUREG_CONFIG /* 0x1A */
+
+#define MPUREG_PWR_MGM MPUREG_PWR_MGMT_1 /* 0x6B */
+#define MPUREG_FIFO_EN1 MPUREG_FIFO_EN /* 0x23 */
+#define MPUREG_INT_CFG MPUREG_INT_ENABLE /* 0x38 */
+#define MPUREG_X_OFFS_USRH MPUREG_XG_OFFS_USRH /* 0x13 */
+#define MPUREG_WHO_AM_I MPUREG_WHOAMI /* 0x75 */
+#define MPUREG_23_RSVD MPUREG_EXT_SLV_SENS_DATA_00 /* 0x49 */
+#define MPUREG_AUX_SLV_ADDR MPUREG_I2C_SLV0_ADDR /* 0x25 */
+#define MPUREG_ACCEL_BURST_ADDR MPUREG_I2C_SLV0_REG /* 0x26 */
+
+/*-- bits --*/
+/* 'USER_CTRL' register */
+#define BIT_AUX_IF_EN BIT_I2C_MST_EN
+#define BIT_AUX_RD_LENG BIT_I2C_MST_EN
+#define BIT_IME_IF_RST BIT_I2C_MST_RST
+#define BIT_GYRO_RST BIT_SIG_COND_RST
+/* 'INT_ENABLE' register */
+#define BIT_RAW_RDY BIT_RAW_DATA_RDY_INT
+#define BIT_MPU_RDY_EN BIT_PLL_RDY_EN
+/* 'INT_STATUS' register */
+#define BIT_INT_STATUS_FIFO_OVERLOW BIT_FIFO_OVERFLOW_INT
+
+/*---- MPU6050 Silicon Revisions ----*/
+#define MPU_SILICON_REV_A2 1 /* MPU6050A2 Device */
+#define MPU_SILICON_REV_B1 2 /* MPU6050B1 Device */
+
+/*---- MPU6050 notable product revisions ----*/
+#define MPU_PRODUCT_KEY_B1_E1_5 105
+#define MPU_PRODUCT_KEY_B2_F1 431
+
+/*---- structure containing control variables used by MLDL ----*/
+/*---- MPU clock source settings ----*/
+/*---- MPU filter selections ----*/
+enum mpu_filter {
+ MPU_FILTER_256HZ_NOLPF2 = 0,
+ MPU_FILTER_188HZ,
+ MPU_FILTER_98HZ,
+ MPU_FILTER_42HZ,
+ MPU_FILTER_20HZ,
+ MPU_FILTER_10HZ,
+ MPU_FILTER_5HZ,
+ MPU_FILTER_2100HZ_NOLPF,
+ NUM_MPU_FILTER
+};
+
+enum mpu_fullscale {
+ MPU_FS_250DPS = 0,
+ MPU_FS_500DPS,
+ MPU_FS_1000DPS,
+ MPU_FS_2000DPS,
+ NUM_MPU_FS
+};
+
+enum mpu_clock_sel {
+ MPU_CLK_SEL_INTERNAL = 0,
+ MPU_CLK_SEL_PLLGYROX,
+ MPU_CLK_SEL_PLLGYROY,
+ MPU_CLK_SEL_PLLGYROZ,
+ MPU_CLK_SEL_PLLEXT32K,
+ MPU_CLK_SEL_PLLEXT19M,
+ MPU_CLK_SEL_RESERVED,
+ MPU_CLK_SEL_STOP,
+ NUM_CLK_SEL
+};
+
+enum mpu_ext_sync {
+ MPU_EXT_SYNC_NONE = 0,
+ MPU_EXT_SYNC_TEMP,
+ MPU_EXT_SYNC_GYROX,
+ MPU_EXT_SYNC_GYROY,
+ MPU_EXT_SYNC_GYROZ,
+ MPU_EXT_SYNC_ACCELX,
+ MPU_EXT_SYNC_ACCELY,
+ MPU_EXT_SYNC_ACCELZ,
+ NUM_MPU_EXT_SYNC
+};
+
+#define MPUREG_CONFIG_VALUE(ext_sync, lpf) \
+ ((ext_sync << 3) | lpf)
+
+#define MPUREG_GYRO_CONFIG_VALUE(x_st, y_st, z_st, full_scale) \
+ ((x_st ? 0x80 : 0) | \
+ (y_st ? 0x70 : 0) | \
+ (z_st ? 0x60 : 0) | \
+ (full_scale << 3))
+
+#endif /* __MPU6050_H_ */
diff --git a/include/linux/mpu6x.h b/include/linux/mpu6x.h
new file mode 100644
index 0000000..244549f
--- /dev/null
+++ b/include/linux/mpu6x.h
@@ -0,0 +1,509 @@
+/*
+ $License:
+ Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ $
+ */
+
+#ifndef __MPU_H_
+#define __MPU_H_
+
+#ifdef __KERNEL__
+#include <linux/types.h>
+#include <linux/ioctl.h>
+#elif defined LINUX
+#include <sys/ioctl.h>
+#endif
+
+#define CONFIG_MPU_SENSORS_MPU6050B1
+
+#if defined CONFIG_MPU_SENSORS_MPU6050A2
+#include "mpu6050a2.h"
+#elif defined CONFIG_MPU_SENSORS_MPU6050B1
+#include "mpu6050b1.h"
+#elif defined CONFIG_MPU_SENSORS_MPU3050
+#include "mpu3050.h"
+#else
+#error Invalid or undefined CONFIG_MPU_SENSORS_MPUxxxx
+#endif
+
+/* Number of axes on each sensor */
+#define GYRO_NUM_AXES (3)
+#define ACCEL_NUM_AXES (3)
+#define COMPASS_NUM_AXES (3)
+
+#if defined __KERNEL__ || defined LINUX
+#define MPU_IOCTL (0x810000) /* Magic number for MPU Iocts */
+/* IOCTL commands for /dev/mpu */
+#define MPU_SET_MPU_CONFIG (MPU_IOCTL + 0x00)
+#define MPU_GET_MPU_CONFIG (MPU_IOCTL + 0x01)
+
+#define MPU_SET_PLATFORM_DATA (MPU_IOCTL + 0x02)
+
+#define MPU_READ (MPU_IOCTL + 0x03)
+#define MPU_WRITE (MPU_IOCTL + 0x04)
+#define MPU_READ_MEM (MPU_IOCTL + 0x05)
+#define MPU_WRITE_MEM (MPU_IOCTL + 0x06)
+#define MPU_READ_FIFO (MPU_IOCTL + 0x07)
+#define MPU_WRITE_FIFO (MPU_IOCTL + 0x08)
+
+#define MPU_READ_COMPASS (MPU_IOCTL + 0x09)
+#define MPU_READ_ACCEL (MPU_IOCTL + 0x0A)
+#define MPU_READ_PRESSURE (MPU_IOCTL + 0x0B)
+
+#define MPU_CONFIG_ACCEL (MPU_IOCTL + 0x0C)
+#define MPU_CONFIG_COMPASS (MPU_IOCTL + 0x0D)
+#define MPU_CONFIG_PRESSURE (MPU_IOCTL + 0x0E)
+
+#define MPU_GET_CONFIG_ACCEL (MPU_IOCTL + 0x10)
+#define MPU_GET_CONFIG_COMPASS (MPU_IOCTL + 0x11)
+#define MPU_GET_CONFIG_PRESSURE (MPU_IOCTL + 0x12)
+
+#define MPU_SUSPEND (MPU_IOCTL + 0x13)
+#define MPU_RESUME (MPU_IOCTL + 0x14)
+/* Userspace PM Event response */
+#define MPU_PM_EVENT_HANDLED (MPU_IOCTL + 0x15)
+
+#define MPU_READ_ACCEL_OFFSET (MPU_IOCTL + 0x16)
+
+
+#endif
+/* Structure for the following IOCTL's:
+ MPU_READ
+ MPU_WRITE
+ MPU_READ_MEM
+ MPU_WRITE_MEM
+ MPU_READ_FIFO
+ MPU_WRITE_FIFO
+*/
+struct mpu_read_write {
+ /* Memory address or register address depending on ioctl */
+ unsigned short address;
+ unsigned short length;
+ unsigned char *data;
+};
+
+enum mpuirq_data_type {
+ MPUIRQ_DATA_TYPE_MPU_IRQ,
+ MPUIRQ_DATA_TYPE_SLAVE_IRQ,
+ MPUIRQ_DATA_TYPE_PM_EVENT,
+ MPUIRQ_DATA_TYPE_NUM_TYPES,
+};
+
+/* User space PM event notification */
+#define MPU_PM_EVENT_SUSPEND_PREPARE (3)
+#define MPU_PM_EVENT_POST_SUSPEND (4)
+
+struct mpuirq_data {
+ int interruptcount;
+ unsigned long long irqtime;
+ int data_type;
+ long data;
+};
+
+enum ext_slave_config_key {
+ MPU_SLAVE_CONFIG_ODR_SUSPEND,
+ MPU_SLAVE_CONFIG_ODR_RESUME,
+ MPU_SLAVE_CONFIG_FSR_SUSPEND,
+ MPU_SLAVE_CONFIG_FSR_RESUME,
+ MPU_SLAVE_CONFIG_MOT_THS,
+ MPU_SLAVE_CONFIG_NMOT_THS,
+ MPU_SLAVE_CONFIG_MOT_DUR,
+ MPU_SLAVE_CONFIG_NMOT_DUR,
+ MPU_SLAVE_CONFIG_IRQ_SUSPEND,
+ MPU_SLAVE_CONFIG_IRQ_RESUME,
+ MPU_SLAVE_WRITE_REGISTERS,
+ MPU_SLAVE_READ_REGISTERS,
+ MPU_SLAVE_CONFIG_INTERNAL_REFERENCE,
+ /* AMI 306 specific config keys */
+ MPU_SLAVE_PARAM,
+ MPU_SLAVE_WINDOW,
+ MPU_SLAVE_READWINPARAMS,
+ MPU_SLAVE_SEARCHOFFSET,
+ /* AKM specific config keys */
+ MPU_SLAVE_READ_SCALE,
+
+ MPU_SLAVE_CONFIG_NUM_CONFIG_KEYS,
+};
+
+/* For the MPU_SLAVE_CONFIG_IRQ_SUSPEND and MPU_SLAVE_CONFIG_IRQ_RESUME */
+enum ext_slave_config_irq_type {
+ MPU_SLAVE_IRQ_TYPE_NONE,
+ MPU_SLAVE_IRQ_TYPE_MOTION,
+ MPU_SLAVE_IRQ_TYPE_DATA_READY,
+};
+
+/* Structure for the following IOCTS's
+ * MPU_CONFIG_ACCEL
+ * MPU_CONFIG_COMPASS
+ * MPU_CONFIG_PRESSURE
+ * MPU_GET_CONFIG_ACCEL
+ * MPU_GET_CONFIG_COMPASS
+ * MPU_GET_CONFIG_PRESSURE
+ *
+ * @key one of enum ext_slave_config_key
+ * @len length of data pointed to by data
+ * @apply zero if communication with the chip is not necessary, false otherwise
+ * This flag can be used to select cached data or to refresh cashed data
+ * cache data to be pushed later or push immediately. If true and the
+ * slave is on the secondary bus the MPU will first enger bypass mode
+ * before calling the slaves .config or .get_config funcion
+ * @data pointer to the data to confgure or get
+ */
+struct ext_slave_config {
+ int key;
+ int len;
+ int apply;
+ void *data;
+};
+
+enum ext_slave_type {
+ EXT_SLAVE_TYPE_GYROSCOPE,
+ EXT_SLAVE_TYPE_ACCELEROMETER,
+ EXT_SLAVE_TYPE_COMPASS,
+ EXT_SLAVE_TYPE_PRESSURE,
+ /*EXT_SLAVE_TYPE_TEMPERATURE */
+};
+
+enum ext_slave_id {
+ ID_INVALID = 0,
+
+ ACCEL_ID_LIS331,
+ ACCEL_ID_LSM303,
+ ACCEL_ID_LIS3DH,
+ ACCEL_ID_KXSD9,
+ ACCEL_ID_KXTF9,
+ ACCEL_ID_BMA150,
+ ACCEL_ID_BMA222,
+ ACCEL_ID_BMA250,
+ ACCEL_ID_ADXL34X,
+ ACCEL_ID_MMA8450,
+ ACCEL_ID_MMA845X,
+ ACCEL_ID_MPU6050,
+
+ COMPASS_ID_AKM,
+ COMPASS_ID_AMI30X,
+ COMPASS_ID_AMI306,
+ COMPASS_ID_YAS529,
+ COMPASS_ID_YAS530,
+ COMPASS_ID_HMC5883,
+ COMPASS_ID_LSM303,
+ COMPASS_ID_MMC314X,
+ COMPASS_ID_HSCDTD002B,
+ COMPASS_ID_HSCDTD004A,
+
+ PRESSURE_ID_BMA085,
+};
+
+enum ext_slave_endian {
+ EXT_SLAVE_BIG_ENDIAN,
+ EXT_SLAVE_LITTLE_ENDIAN,
+ EXT_SLAVE_FS8_BIG_ENDIAN,
+ EXT_SLAVE_FS16_BIG_ENDIAN,
+};
+
+enum ext_slave_bus {
+ EXT_SLAVE_BUS_INVALID = -1,
+ EXT_SLAVE_BUS_PRIMARY = 0,
+ EXT_SLAVE_BUS_SECONDARY = 1
+};
+
+
+/**
+ * struct ext_slave_platform_data - Platform data for mpu3050 and mpu6050
+ * slave devices
+ *
+ * @get_slave_descr: Function pointer to retrieve the struct ext_slave_descr
+ * for this slave
+ * @irq: the irq number attached to the slave if any.
+ * @adapt_num: the I2C adapter number.
+ * @bus: the bus the slave is attached to: enum ext_slave_bus
+ * @address: the I2C slave address of the slave device.
+ * @orientation: the mounting matrix of the device relative to MPU.
+ * @irq_data: private data for the slave irq handler
+ * @private_data: additional data, user customizable. Not touched by the MPU
+ * driver.
+ *
+ * The orientation matricies are 3x3 rotation matricies
+ * that are applied to the data to rotate from the mounting orientation to the
+ * platform orientation. The values must be one of 0, 1, or -1 and each row and
+ * column should have exactly 1 non-zero value.
+ */
+struct ext_slave_platform_data {
+ struct ext_slave_descr *(*get_slave_descr) (void);
+ int irq;
+ int adapt_num;
+ int bus;
+ unsigned char address;
+ signed char orientation[9];
+ void *irq_data;
+ void *private_data;
+};
+
+struct fix_pnt_range {
+ long mantissa;
+ long fraction;
+};
+
+#define RANGE_FIXEDPOINT_TO_LONG_MG(rng) \
+ (rng.mantissa * 1000 + rng.fraction / 10)
+
+struct ext_slave_read_trigger {
+ unsigned char reg;
+ unsigned char value;
+};
+
+/**
+ * struct ext_slave_descr - Description of the slave device for programming.
+ *
+ * @suspend: function pointer to put the device in suspended state
+ * @resume: function pointer to put the device in running state
+ * @read: function that reads the device data
+ * @init: function used to preallocate memory used by the driver
+ * @exit: function used to free memory allocated for the driver
+ * @config: function used to configure the device
+ * @get_config:function used to get the device's configuration
+ *
+ * @name: text name of the device
+ * @type: device type. enum ext_slave_type
+ * @id: enum ext_slave_id
+ * @read_reg: starting register address to retrieve data.
+ * @read_len: length in bytes of the sensor data. Typically 6.
+ * @endian: byte order of the data. enum ext_slave_endian
+ * @range: full scale range of the slave ouput: struct fix_pnt_range
+ * @trigger: If reading data first requires writing a register this is the
+ * data to write.
+ *
+ * Defines the functions and information about the slave the mpu3050 and
+ * mpu6050 needs to use the slave device.
+ */
+struct ext_slave_descr {
+ int (*init) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata);
+ int (*exit) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata);
+ int (*suspend) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata);
+ int (*resume) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata);
+ int (*read) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata,
+ unsigned char *data);
+ int (*config) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata,
+ struct ext_slave_config *config);
+ int (*get_config) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata,
+ struct ext_slave_config *config);
+
+ char *name;
+ unsigned char type;
+ unsigned char id;
+ unsigned char read_reg;
+ unsigned int read_len;
+ unsigned char endian;
+ struct fix_pnt_range range;
+ struct ext_slave_read_trigger *trigger;
+};
+
+/**
+ * struct mpu_platform_data - Platform data for the mpu driver
+ * @int_config: Bits [7:3] of the int config register.
+ * @orientation: Orientation matrix of the gyroscope
+ * @level_shifter: 0: VLogic, 1: VDD
+ * @accel: Accel platform data
+ * @compass: Compass platform data
+ * @pressure: Pressure platform data
+ *
+ * Contains platform specific information on how to configure the MPU3050 to
+ * work on this platform. The orientation matricies are 3x3 rotation matricies
+ * that are applied to the data to rotate from the mounting orientation to the
+ * platform orientation. The values must be one of 0, 1, or -1 and each row and
+ * column should have exactly 1 non-zero value.
+ */
+struct mpu_platform_data {
+ unsigned char int_config;
+ signed char orientation[MPU_NUM_AXES * MPU_NUM_AXES];
+ unsigned char level_shifter;
+ struct ext_slave_platform_data accel;
+ struct ext_slave_platform_data compass;
+ struct ext_slave_platform_data pressure;
+};
+
+
+/*
+ Accelerometer
+*/
+#define get_accel_slave_descr NULL
+
+#ifdef CONFIG_MPU_SENSORS_ADXL34X /* ADI accelerometer */
+struct ext_slave_descr *adxl34x_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr adxl34x_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_BMA150 /* Bosch accelerometer */
+struct ext_slave_descr *bma150_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr bma150_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_BMA222 /* Bosch 222 accelerometer */
+struct ext_slave_descr *bma222_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr bma222_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_BMA250 /* Bosch accelerometer */
+struct ext_slave_descr *bma250_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr bma250_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_KXSD9 /* Kionix accelerometer */
+struct ext_slave_descr *kxsd9_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr kxsd9_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_KXTF9 /* Kionix accelerometer */
+struct ext_slave_descr *kxtf9_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr kxtf9_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_LIS331DLH /* ST accelerometer */
+struct ext_slave_descr *lis331dlh_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr lis331dlh_get_slave_descr
+#endif
+
+
+#ifdef CONFIG_MPU_SENSORS_LIS3DH /* ST accelerometer */
+struct ext_slave_descr *lis3dh_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr lis3dh_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_LSM303DLHA /* ST accelerometer */
+struct ext_slave_descr *lsm303dlha_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr lsm303dlha_get_slave_descr
+#endif
+
+/* MPU6050 Accel */
+#if defined CONFIG_MPU_SENSORS_MPU6050A2 || \
+ defined CONFIG_MPU_SENSORS_MPU6050B1
+struct ext_slave_descr *mpu6050_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr mantis_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_MMA8450 /* Freescale accelerometer */
+struct ext_slave_descr *mma8450_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr mma8450_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_MMA845X /* Freescale accelerometer */
+struct ext_slave_descr *mma845x_get_slave_descr(void);
+#undef get_accel_slave_descr
+#define get_accel_slave_descr mma845x_get_slave_descr
+#endif
+
+
+/*
+ Compass
+*/
+#define get_compass_slave_descr NULL
+
+#ifdef CONFIG_MPU_SENSORS_AK8975_NEW /* AKM compass */
+struct ext_slave_descr *ak8975_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr ak8975_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_AMI30X /* AICHI Steel AMI304/305 compass */
+struct ext_slave_descr *ami30x_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr ami30x_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_AMI306 /* AICHI Steel AMI306 compass */
+struct ext_slave_descr *ami306_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr ami306_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_HMC5883 /* Honeywell compass */
+struct ext_slave_descr *hmc5883_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr hmc5883_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_MMC314X /* MEMSIC compass */
+struct ext_slave_descr *mmc314x_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr mmc314x_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_LSM303DLHM /* ST compass */
+struct ext_slave_descr *lsm303dlhm_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr lsm303dlhm_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_YAS529 /* Yamaha compass */
+struct ext_slave_descr *yas529_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr yas529_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_YAS530_NEW /* Yamaha compass */
+struct ext_slave_descr *yas530_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr yas530_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_HSCDTD002B /* Alps HSCDTD002B compass */
+struct ext_slave_descr *hscdtd002b_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr hscdtd002b_get_slave_descr
+#endif
+
+#ifdef CONFIG_MPU_SENSORS_HSCDTD004A /* Alps HSCDTD004A compass */
+struct ext_slave_descr *hscdtd004a_get_slave_descr(void);
+#undef get_compass_slave_descr
+#define get_compass_slave_descr hscdtd004a_get_slave_descr
+#endif
+/*
+ Pressure
+*/
+#define get_pressure_slave_descr NULL
+
+#ifdef CONFIG_MPU_SENSORS_BMA085 /* BMA pressure */
+struct ext_slave_descr *bma085_get_slave_descr(void);
+#undef get_pressure_slave_descr
+#define get_pressure_slave_descr bma085_get_slave_descr
+#endif
+
+#endif /* __MPU_H_ */
diff --git a/include/linux/mpu_411.h b/include/linux/mpu_411.h
new file mode 100644
index 0000000..ed928f2
--- /dev/null
+++ b/include/linux/mpu_411.h
@@ -0,0 +1,368 @@
+/*
+ $License:
+ Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ $
+ */
+
+#ifndef __MPU_H_
+#define __MPU_H_
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+/* Number of axes on each sensor */
+#define GYRO_NUM_AXES (3)
+#define ACCEL_NUM_AXES (3)
+#define COMPASS_NUM_AXES (3)
+
+struct mpu_read_write {
+ /* Memory address or register address depending on ioctl */
+ __u16 address;
+ __u16 length;
+ __u8 *data;
+};
+
+enum mpuirq_data_type {
+ MPUIRQ_DATA_TYPE_MPU_IRQ,
+ MPUIRQ_DATA_TYPE_SLAVE_IRQ,
+ MPUIRQ_DATA_TYPE_PM_EVENT,
+ MPUIRQ_DATA_TYPE_NUM_TYPES,
+};
+
+/* User space PM event notification */
+#define MPU_PM_EVENT_SUSPEND_PREPARE (3)
+#define MPU_PM_EVENT_POST_SUSPEND (4)
+
+struct mpuirq_data {
+ __u32 interruptcount;
+ __u64 irqtime;
+ __u32 data_type;
+ __s32 data;
+};
+
+enum ext_slave_config_key {
+ MPU_SLAVE_CONFIG_ODR_SUSPEND,
+ MPU_SLAVE_CONFIG_ODR_RESUME,
+ MPU_SLAVE_CONFIG_FSR_SUSPEND,
+ MPU_SLAVE_CONFIG_FSR_RESUME,
+ MPU_SLAVE_CONFIG_MOT_THS,
+ MPU_SLAVE_CONFIG_NMOT_THS,
+ MPU_SLAVE_CONFIG_MOT_DUR,
+ MPU_SLAVE_CONFIG_NMOT_DUR,
+ MPU_SLAVE_CONFIG_IRQ_SUSPEND,
+ MPU_SLAVE_CONFIG_IRQ_RESUME,
+ MPU_SLAVE_WRITE_REGISTERS,
+ MPU_SLAVE_READ_REGISTERS,
+ MPU_SLAVE_CONFIG_INTERNAL_REFERENCE,
+ /* AMI 306 specific config keys */
+ MPU_SLAVE_PARAM,
+ MPU_SLAVE_WINDOW,
+ MPU_SLAVE_READWINPARAMS,
+ MPU_SLAVE_SEARCHOFFSET,
+ /* AKM specific config keys */
+ MPU_SLAVE_READ_SCALE,
+ /* MPU3050 and MPU6050 Keys */
+ MPU_SLAVE_INT_CONFIG,
+ MPU_SLAVE_EXT_SYNC,
+ MPU_SLAVE_FULL_SCALE,
+ MPU_SLAVE_LPF,
+ MPU_SLAVE_CLK_SRC,
+ MPU_SLAVE_DIVIDER,
+ MPU_SLAVE_DMP_ENABLE,
+ MPU_SLAVE_FIFO_ENABLE,
+ MPU_SLAVE_DMP_CFG1,
+ MPU_SLAVE_DMP_CFG2,
+ MPU_SLAVE_TC,
+ MPU_SLAVE_GYRO,
+ MPU_SLAVE_ADDR,
+ MPU_SLAVE_PRODUCT_REVISION,
+ MPU_SLAVE_SILICON_REVISION,
+ MPU_SLAVE_PRODUCT_ID,
+ MPU_SLAVE_GYRO_SENS_TRIM,
+ MPU_SLAVE_ACCEL_SENS_TRIM,
+ MPU_SLAVE_RAM,
+ /* -------------------------- */
+ MPU_SLAVE_CONFIG_NUM_CONFIG_KEYS
+};
+
+/* For the MPU_SLAVE_CONFIG_IRQ_SUSPEND and MPU_SLAVE_CONFIG_IRQ_RESUME */
+enum ext_slave_config_irq_type {
+ MPU_SLAVE_IRQ_TYPE_NONE,
+ MPU_SLAVE_IRQ_TYPE_MOTION,
+ MPU_SLAVE_IRQ_TYPE_DATA_READY,
+};
+
+/* Structure for the following IOCTS's
+ * MPU_CONFIG_GYRO
+ * MPU_CONFIG_ACCEL
+ * MPU_CONFIG_COMPASS
+ * MPU_CONFIG_PRESSURE
+ * MPU_GET_CONFIG_GYRO
+ * MPU_GET_CONFIG_ACCEL
+ * MPU_GET_CONFIG_COMPASS
+ * MPU_GET_CONFIG_PRESSURE
+ *
+ * @key one of enum ext_slave_config_key
+ * @len length of data pointed to by data
+ * @apply zero if communication with the chip is not necessary, false otherwise
+ * This flag can be used to select cached data or to refresh cashed data
+ * cache data to be pushed later or push immediately. If true and the
+ * slave is on the secondary bus the MPU will first enger bypass mode
+ * before calling the slaves .config or .get_config funcion
+ * @data pointer to the data to confgure or get
+ */
+struct ext_slave_config {
+ __u8 key;
+ __u16 len;
+ __u8 apply;
+ void *data;
+};
+
+enum ext_slave_type {
+ EXT_SLAVE_TYPE_GYROSCOPE,
+ EXT_SLAVE_TYPE_ACCEL,
+ EXT_SLAVE_TYPE_COMPASS,
+ EXT_SLAVE_TYPE_PRESSURE,
+ /*EXT_SLAVE_TYPE_TEMPERATURE */
+
+ EXT_SLAVE_NUM_TYPES
+};
+
+enum ext_slave_id {
+ ID_INVALID = 0,
+
+ ACCEL_ID_LIS331,
+ ACCEL_ID_LSM303DLX,
+ ACCEL_ID_LIS3DH,
+ ACCEL_ID_KXSD9,
+ ACCEL_ID_KXTF9,
+ ACCEL_ID_BMA150,
+ ACCEL_ID_BMA222,
+ ACCEL_ID_BMA250,
+ ACCEL_ID_ADXL34X,
+ ACCEL_ID_MMA8450,
+ ACCEL_ID_MMA845X,
+ ACCEL_ID_MPU6050,
+
+ COMPASS_ID_AK8975,
+ COMPASS_ID_AK8972,
+ COMPASS_ID_AMI30X,
+ COMPASS_ID_AMI306,
+ COMPASS_ID_YAS529,
+ COMPASS_ID_YAS530,
+ COMPASS_ID_HMC5883,
+ COMPASS_ID_LSM303DLH,
+ COMPASS_ID_LSM303DLM,
+ COMPASS_ID_MMC314X,
+ COMPASS_ID_HSCDTD002B,
+ COMPASS_ID_HSCDTD004A,
+ COMPASS_ID_YAS530_EXT,
+
+ PRESSURE_ID_BMA085,
+};
+
+enum ext_slave_endian {
+ EXT_SLAVE_BIG_ENDIAN,
+ EXT_SLAVE_LITTLE_ENDIAN,
+ EXT_SLAVE_FS8_BIG_ENDIAN,
+ EXT_SLAVE_FS16_BIG_ENDIAN,
+};
+
+enum ext_slave_bus {
+ EXT_SLAVE_BUS_INVALID = -1,
+ EXT_SLAVE_BUS_PRIMARY = 0,
+ EXT_SLAVE_BUS_SECONDARY = 1
+};
+
+
+/**
+ * struct ext_slave_platform_data - Platform data for mpu3050 and mpu6050
+ * slave devices
+ *
+ * @type: the type of slave device based on the enum ext_slave_type
+ * definitions.
+ * @irq: the irq number attached to the slave if any.
+ * @adapt_num: the I2C adapter number.
+ * @bus: the bus the slave is attached to: enum ext_slave_bus
+ * @address: the I2C slave address of the slave device.
+ * @orientation: the mounting matrix of the device relative to MPU.
+ * @irq_data: private data for the slave irq handler
+ * @private_data: additional data, user customizable. Not touched by the MPU
+ * driver.
+ *
+ * The orientation matricies are 3x3 rotation matricies
+ * that are applied to the data to rotate from the mounting orientation to the
+ * platform orientation. The values must be one of 0, 1, or -1 and each row and
+ * column should have exactly 1 non-zero value.
+ */
+struct ext_slave_platform_data {
+ __u8 type;
+ __u32 irq;
+ __u32 adapt_num;
+ __u32 bus;
+ __u8 address;
+ __s8 orientation[9];
+ void *irq_data;
+ void *private_data;
+};
+
+struct fix_pnt_range {
+ __s32 mantissa;
+ __s32 fraction;
+};
+
+static inline long range_fixedpoint_to_long_mg(struct fix_pnt_range rng)
+{
+ return (long)(rng.mantissa * 1000 + rng.fraction / 10);
+}
+
+struct ext_slave_read_trigger {
+ __u8 reg;
+ __u8 value;
+};
+
+/**
+ * struct ext_slave_descr - Description of the slave device for programming.
+ *
+ * @suspend: function pointer to put the device in suspended state
+ * @resume: function pointer to put the device in running state
+ * @read: function that reads the device data
+ * @init: function used to preallocate memory used by the driver
+ * @exit: function used to free memory allocated for the driver
+ * @config: function used to configure the device
+ * @get_config:function used to get the device's configuration
+ *
+ * @name: text name of the device
+ * @type: device type. enum ext_slave_type
+ * @id: enum ext_slave_id
+ * @read_reg: starting register address to retrieve data.
+ * @read_len: length in bytes of the sensor data. Typically 6.
+ * @endian: byte order of the data. enum ext_slave_endian
+ * @range: full scale range of the slave ouput: struct fix_pnt_range
+ * @trigger: If reading data first requires writing a register this is the
+ * data to write.
+ *
+ * Defines the functions and information about the slave the mpu3050 and
+ * mpu6050 needs to use the slave device.
+ */
+struct ext_slave_descr {
+ int (*init) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata);
+ int (*exit) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata);
+ int (*suspend) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata);
+ int (*resume) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata);
+ int (*read) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata,
+ __u8 *data);
+ int (*config) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata,
+ struct ext_slave_config *config);
+ int (*get_config) (void *mlsl_handle,
+ struct ext_slave_descr *slave,
+ struct ext_slave_platform_data *pdata,
+ struct ext_slave_config *config);
+
+ char *name;
+ __u8 type;
+ __u8 id;
+ __u8 read_reg;
+ __u8 read_len;
+ __u8 endian;
+ struct fix_pnt_range range;
+ struct ext_slave_read_trigger *trigger;
+};
+
+/**
+ * struct mpu_platform_data - Platform data for the mpu driver
+ * @int_config: Bits [7:3] of the int config register.
+ * @level_shifter: 0: VLogic, 1: VDD
+ * @orientation: Orientation matrix of the gyroscope
+ *
+ * Contains platform specific information on how to configure the MPU3050 to
+ * work on this platform. The orientation matricies are 3x3 rotation matricies
+ * that are applied to the data to rotate from the mounting orientation to the
+ * platform orientation. The values must be one of 0, 1, or -1 and each row and
+ * column should have exactly 1 non-zero value.
+ */
+struct mpu_platform_data {
+ __u8 int_config;
+ __u8 level_shifter;
+ __s8 orientation[GYRO_NUM_AXES * GYRO_NUM_AXES];
+ void (*enable_irq_handler)(void);
+};
+
+#define MPU_IOCTL (0x81) /* Magic number for MPU Iocts */
+/* IOCTL commands for /dev/mpu */
+
+/*--------------------------------------------------------------------------
+ * Deprecated, debugging only
+ */
+#define MPU_SET_MPU_PLATFORM_DATA \
+ _IOWR(MPU_IOCTL, 0x01, struct mpu_platform_data)
+#define MPU_SET_EXT_SLAVE_PLATFORM_DATA \
+ _IOWR(MPU_IOCTL, 0x01, struct ext_slave_platform_data)
+/*--------------------------------------------------------------------------*/
+#define MPU_GET_EXT_SLAVE_PLATFORM_DATA \
+ _IOWR(MPU_IOCTL, 0x02, struct ext_slave_platform_data)
+#define MPU_GET_MPU_PLATFORM_DATA \
+ _IOWR(MPU_IOCTL, 0x02, struct mpu_platform_data)
+#define MPU_GET_EXT_SLAVE_DESCR \
+ _IOWR(MPU_IOCTL, 0x02, struct ext_slave_descr)
+
+#define MPU_READ _IOWR(MPU_IOCTL, 0x10, struct mpu_read_write)
+#define MPU_WRITE _IOW(MPU_IOCTL, 0x10, struct mpu_read_write)
+#define MPU_READ_MEM _IOWR(MPU_IOCTL, 0x11, struct mpu_read_write)
+#define MPU_WRITE_MEM _IOW(MPU_IOCTL, 0x11, struct mpu_read_write)
+#define MPU_READ_FIFO _IOWR(MPU_IOCTL, 0x12, struct mpu_read_write)
+#define MPU_WRITE_FIFO _IOW(MPU_IOCTL, 0x12, struct mpu_read_write)
+
+#define MPU_READ_COMPASS _IOR(MPU_IOCTL, 0x12, __u8)
+#define MPU_READ_ACCEL _IOR(MPU_IOCTL, 0x13, __u8)
+#define MPU_READ_PRESSURE _IOR(MPU_IOCTL, 0x14, __u8)
+
+#define MPU_CONFIG_GYRO _IOW(MPU_IOCTL, 0x20, struct ext_slave_config)
+#define MPU_CONFIG_ACCEL _IOW(MPU_IOCTL, 0x21, struct ext_slave_config)
+#define MPU_CONFIG_COMPASS _IOW(MPU_IOCTL, 0x22, struct ext_slave_config)
+#define MPU_CONFIG_PRESSURE _IOW(MPU_IOCTL, 0x23, struct ext_slave_config)
+
+#define MPU_GET_CONFIG_GYRO _IOWR(MPU_IOCTL, 0x20, struct ext_slave_config)
+#define MPU_GET_CONFIG_ACCEL _IOWR(MPU_IOCTL, 0x21, struct ext_slave_config)
+#define MPU_GET_CONFIG_COMPASS _IOWR(MPU_IOCTL, 0x22, struct ext_slave_config)
+#define MPU_GET_CONFIG_PRESSURE _IOWR(MPU_IOCTL, 0x23, struct ext_slave_config)
+
+#define MPU_SUSPEND _IOW(MPU_IOCTL, 0x30, __u32)
+#define MPU_RESUME _IOW(MPU_IOCTL, 0x31, __u32)
+/* Userspace PM Event response */
+#define MPU_PM_EVENT_HANDLED _IO(MPU_IOCTL, 0x32)
+
+#define MPU_GET_REQUESTED_SENSORS _IOR(MPU_IOCTL, 0x40, __u8)
+#define MPU_SET_REQUESTED_SENSORS _IOW(MPU_IOCTL, 0x40, __u8)
+#define MPU_GET_IGNORE_SYSTEM_SUSPEND _IOR(MPU_IOCTL, 0x41, __u8)
+#define MPU_SET_IGNORE_SYSTEM_SUSPEND _IOW(MPU_IOCTL, 0x41, __u8)
+#define MPU_GET_MLDL_STATUS _IOR(MPU_IOCTL, 0x42, __u8)
+#define MPU_GET_I2C_SLAVES_ENABLED _IOR(MPU_IOCTL, 0x43, __u8)
+#define MPU_READ_ACCEL_OFFSET _IOR(MPU_IOCTL, 0x44, __u8)
+
+#endif /* __MPU_H_ */
diff --git a/include/linux/msdos_fs.h b/include/linux/msdos_fs.h
index 34066e6..6a11822 100644
--- a/include/linux/msdos_fs.h
+++ b/include/linux/msdos_fs.h
@@ -101,6 +101,8 @@ struct __fat_dirent {
/* <linux/videotext.h> has used 0x72 ('r') in collision, so skip a few */
#define FAT_IOCTL_GET_ATTRIBUTES _IOR('r', 0x10, __u32)
#define FAT_IOCTL_SET_ATTRIBUTES _IOW('r', 0x11, __u32)
+#define VFAT_IOCTL_GET_VOLUME_ID _IOR('r', 0x12, __u32)
+#define FAT_IOCTL_VMW_EXTEND _IO('r', 0x42)
struct fat_boot_sector {
__u8 ignored[3]; /* Boot strap short or near jump */
@@ -138,6 +140,17 @@ struct fat_boot_fsinfo {
__le32 reserved2[4];
};
+struct fat_boot_bsx {
+ __u8 drive; /* drive number */
+ __u8 reserved1;
+ __u8 signature; /* extended boot signature */
+ __u8 vol_id[4]; /* volume ID */
+ __u8 vol_label[11]; /* volume label */
+ __u8 type[8]; /* file system type */
+};
+#define FAT16_BSX_OFFSET 36 /* offset of fat_boot_bsx in FAT12 and FAT16 */
+#define FAT32_BSX_OFFSET 64 /* offset of fat_boot_bsx in FAT32 */
+
struct msdos_dir_entry {
__u8 name[MSDOS_NAME];/* name and extension */
__u8 attr; /* attribute bits */
diff --git a/include/linux/msm_charm.h b/include/linux/msm_charm.h
new file mode 100644
index 0000000..779fd38
--- /dev/null
+++ b/include/linux/msm_charm.h
@@ -0,0 +1,19 @@
+#ifndef _ARCH_ARM_MACH_MSM_MDM_IOCTLS_H
+#define _ARXH_ARM_MACH_MSM_MDM_IOCTLS_H
+
+
+#define CHARM_CODE 0xCC
+#define WAKE_CHARM _IO(CHARM_CODE, 1)
+#define RESET_CHARM _IO(CHARM_CODE, 2)
+#define CHECK_FOR_BOOT _IOR(CHARM_CODE, 3, int)
+#define WAIT_FOR_BOOT _IO(CHARM_CODE, 4)
+#define NORMAL_BOOT_DONE _IOW(CHARM_CODE, 5, int)
+#define RAM_DUMP_DONE _IOW(CHARM_CODE, 6, int)
+#define WAIT_FOR_RESTART _IOR(CHARM_CODE, 7, int)
+
+enum charm_boot_type {
+ CHARM_NORMAL_BOOT = 0,
+ CHARM_RAM_DUMPS,
+};
+
+#endif
diff --git a/include/linux/msm_rmnet.h b/include/linux/msm_rmnet.h
new file mode 100644
index 0000000..9f52464
--- /dev/null
+++ b/include/linux/msm_rmnet.h
@@ -0,0 +1,54 @@
+/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _MSM_RMNET_H_
+#define _MSM_RMNET_H_
+
+/* Bitmap macros for RmNET driver operation mode. */
+#define RMNET_MODE_NONE (0x00)
+#define RMNET_MODE_LLP_ETH (0x01)
+#define RMNET_MODE_LLP_IP (0x02)
+#define RMNET_MODE_QOS (0x04)
+#define RMNET_MODE_MASK (RMNET_MODE_LLP_ETH | \
+ RMNET_MODE_LLP_IP | \
+ RMNET_MODE_QOS)
+
+#define RMNET_IS_MODE_QOS(mode) \
+ ((mode & RMNET_MODE_QOS) == RMNET_MODE_QOS)
+#define RMNET_IS_MODE_IP(mode) \
+ ((mode & RMNET_MODE_LLP_IP) == RMNET_MODE_LLP_IP)
+
+/* IOCTL command enum
+ * Values chosen to not conflict with other drivers in the ecosystem */
+enum rmnet_ioctl_cmds_e {
+ RMNET_IOCTL_SET_LLP_ETHERNET = 0x000089F1, /* Set Ethernet protocol */
+ RMNET_IOCTL_SET_LLP_IP = 0x000089F2, /* Set RAWIP protocol */
+ RMNET_IOCTL_GET_LLP = 0x000089F3, /* Get link protocol */
+ RMNET_IOCTL_SET_QOS_ENABLE = 0x000089F4, /* Set QoS header enabled */
+ RMNET_IOCTL_SET_QOS_DISABLE = 0x000089F5, /* Set QoS header disabled*/
+ RMNET_IOCTL_GET_QOS = 0x000089F6, /* Get QoS header state */
+ RMNET_IOCTL_GET_OPMODE = 0x000089F7, /* Get operation mode */
+ RMNET_IOCTL_OPEN = 0x000089F8, /* Open transport port */
+ RMNET_IOCTL_CLOSE = 0x000089F9, /* Close transport port */
+ RMNET_IOCTL_MAX
+};
+
+/* QMI QoS header definition */
+#define QMI_QOS_HDR_S __attribute((__packed__)) qmi_qos_hdr_s
+struct QMI_QOS_HDR_S {
+ unsigned char version;
+ unsigned char flags;
+ unsigned long flow_id;
+};
+
+#endif /* _MSM_RMNET_H_ */
diff --git a/include/linux/netfilter/xt_qtaguid.h b/include/linux/netfilter/xt_qtaguid.h
new file mode 100644
index 0000000..ca60fbd
--- /dev/null
+++ b/include/linux/netfilter/xt_qtaguid.h
@@ -0,0 +1,13 @@
+#ifndef _XT_QTAGUID_MATCH_H
+#define _XT_QTAGUID_MATCH_H
+
+/* For now we just replace the xt_owner.
+ * FIXME: make iptables aware of qtaguid. */
+#include <linux/netfilter/xt_owner.h>
+
+#define XT_QTAGUID_UID XT_OWNER_UID
+#define XT_QTAGUID_GID XT_OWNER_GID
+#define XT_QTAGUID_SOCKET XT_OWNER_SOCKET
+#define xt_qtaguid_match_info xt_owner_match_info
+
+#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 0000000..eadc690
--- /dev/null
+++ b/include/linux/netfilter/xt_quota2.h
@@ -0,0 +1,25 @@
+#ifndef _XT_QUOTA_H
+#define _XT_QUOTA_H
+
+enum xt_quota_flags {
+ XT_QUOTA_INVERT = 1 << 0,
+ XT_QUOTA_GROW = 1 << 1,
+ XT_QUOTA_PACKET = 1 << 2,
+ XT_QUOTA_NO_CHANGE = 1 << 3,
+ XT_QUOTA_MASK = 0x0F,
+};
+
+struct xt_quota_counter;
+
+struct xt_quota_mtinfo2 {
+ char name[15];
+ u_int8_t flags;
+
+ /* Comparison-invariant */
+ aligned_u64 quota;
+
+ /* Used internally by the kernel */
+ struct xt_quota_counter *master __attribute__((aligned(8)));
+};
+
+#endif /* _XT_QUOTA_H */
diff --git a/include/linux/netfilter/xt_socket.h b/include/linux/netfilter/xt_socket.h
index 26d7217..6359456 100644
--- a/include/linux/netfilter/xt_socket.h
+++ b/include/linux/netfilter/xt_socket.h
@@ -11,4 +11,10 @@ struct xt_socket_mtinfo1 {
__u8 flags;
};
+void xt_socket_put_sk(struct sock *sk);
+struct sock *xt_socket_get4_sk(const struct sk_buff *skb,
+ struct xt_action_param *par);
+struct sock *xt_socket_get6_sk(const struct sk_buff *skb,
+ struct xt_action_param *par);
+
#endif /* _XT_SOCKET_H */
diff --git a/include/linux/nfc/pn65n.h b/include/linux/nfc/pn65n.h
new file mode 100644
index 0000000..4afe8a5
--- /dev/null
+++ b/include/linux/nfc/pn65n.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2010 Trusted Logic S.A.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#define PN65N_MAGIC 0xE9
+
+/*
+ * PN65N power control via ioctl
+ * PN65N_SET_PWR(0): power off
+ * PN65N_SET_PWR(1): power on
+ * PN65N_SET_PWR(>1): power on with firmware download enabled
+ */
+#define PN65N_SET_PWR _IOW(PN65N_MAGIC, 0x01, unsigned int)
+
+struct pn65n_i2c_platform_data {
+ unsigned int irq_gpio;
+ unsigned int ven_gpio;
+ unsigned int firm_gpio;
+};
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index c7ccaae..dca6723 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -1236,7 +1236,8 @@ enum nl80211_attrs {
#define NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY 24
#define NL80211_HT_CAPABILITY_LEN 26
-#define NL80211_MAX_NR_CIPHER_SUITES 5
+#define NL80211_MAX_NR_CIPHER_SUITES 6
+
#define NL80211_MAX_NR_AKM_SUITES 2
/**
@@ -2033,6 +2034,7 @@ enum nl80211_mfp {
enum nl80211_wpa_versions {
NL80211_WPA_VERSION_1 = 1 << 0,
NL80211_WPA_VERSION_2 = 1 << 1,
+ NL80211_WAPI_VERSION_1 = 1 << 2,
};
/**
diff --git a/include/linux/opp.h b/include/linux/opp.h
index 5449945..8bb4797 100644
--- a/include/linux/opp.h
+++ b/include/linux/opp.h
@@ -16,9 +16,14 @@
#include <linux/err.h>
#include <linux/cpufreq.h>
+#include <linux/notifier.h>
struct opp;
+enum opp_event {
+ OPP_EVENT_ADD, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
+};
+
#if defined(CONFIG_PM_OPP)
unsigned long opp_get_voltage(struct opp *opp);
@@ -40,6 +45,8 @@ int opp_enable(struct device *dev, unsigned long freq);
int opp_disable(struct device *dev, unsigned long freq);
+struct srcu_notifier_head *opp_get_notifier(struct device *dev);
+
#else
static inline unsigned long opp_get_voltage(struct opp *opp)
{
@@ -89,6 +96,11 @@ static inline int opp_disable(struct device *dev, unsigned long freq)
{
return 0;
}
+
+struct srcu_notifier_head *opp_get_notifier(struct device *dev)
+{
+ return ERR_PTR(-EINVAL);
+}
#endif /* CONFIG_PM */
#if defined(CONFIG_CPU_FREQ) && defined(CONFIG_PM_OPP)
diff --git a/include/linux/pda_power.h b/include/linux/pda_power.h
index c9e4d81..2bb62bf 100644
--- a/include/linux/pda_power.h
+++ b/include/linux/pda_power.h
@@ -35,6 +35,8 @@ struct pda_power_pdata {
unsigned int polling_interval; /* msecs, default is 2000 */
unsigned long ac_max_uA; /* current to draw when on AC */
+
+ bool use_otg_notifier;
};
#endif /* __PDA_POWER_H__ */
diff --git a/include/linux/phone_svn/ipc_spi.h b/include/linux/phone_svn/ipc_spi.h
new file mode 100644
index 0000000..b385420
--- /dev/null
+++ b/include/linux/phone_svn/ipc_spi.h
@@ -0,0 +1,59 @@
+/**
+ * header for ipc_spi driver
+ *
+ * Copyright (C) 2010 Samsung Electronics. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef __IPC_SPI_H__
+#define __IPC_SPI_H__
+
+#include <linux/ioport.h>
+#include <linux/types.h>
+
+struct ipc_spi_platform_data {
+ unsigned gpio_ipc_mrdy;
+ unsigned gpio_ipc_srdy;
+ unsigned gpio_ipc_sub_mrdy;
+ unsigned gpio_ipc_sub_srdy;
+
+ void (*cfg_gpio)(void);
+};
+
+extern int onedram_register_handler(void (*handler)(u32, void *), void *data);
+extern int onedram_unregister_handler(void (*handler)(u32, void *));
+extern struct resource *onedram_request_region(resource_size_t start,
+ resource_size_t size, const char *name);
+extern void onedram_release_region(resource_size_t start,
+ resource_size_t size);
+extern int onedram_read_mailbox(u32 *);
+extern int onedram_write_mailbox(u32);
+extern int onedram_get_auth(u32 cmd);
+extern int onedram_put_auth(int release);
+extern int onedram_rel_sem(void);
+extern int onedram_read_sem(void);
+extern void onedram_get_vbase(void **);
+
+#if !defined(CONFIG_MACH_Q1_BD)
+extern unsigned int lpcharge;
+#endif
+
+#define ONEDRAM_GET_AUTH _IOW('o', 0x20, u32)
+#define ONEDRAM_CP_CRASH _IO('o', 0x21)
+#define ONEDRAM_REL_SEM _IO('o', 0x22)
+#define ONEDRAM_SEMA_INIT _IO('o', 0x23)
+
+#endif /* __IPC_SPI_H__ */
diff --git a/include/linux/phone_svn/modemctl.h b/include/linux/phone_svn/modemctl.h
new file mode 100644
index 0000000..8fdd40e
--- /dev/null
+++ b/include/linux/phone_svn/modemctl.h
@@ -0,0 +1,103 @@
+/*
+ * Modem control driver
+ *
+ * Copyright (C) 2010 Samsung Electronics Co.Ltd
+ * Author: Suchang Woo <suchang.woo@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+#ifdef CONFIG_HAS_WAKELOCK
+#include <linux/wakelock.h>
+#endif
+
+#ifndef __MODEM_CONTROL_H__
+#define __MODEM_CONTROL_H__
+
+#define MC_SUCCESS 0
+#define MC_HOST_HIGH 1
+#define MC_HOST_TIMEOUT 2
+
+struct modemctl;
+struct modemctl_ops {
+ void (*modem_on)(struct modemctl *);
+ void (*modem_off)(struct modemctl *);
+ void (*modem_reset)(struct modemctl *);
+ void (*modem_boot)(struct modemctl *);
+ void (*modem_suspend)(struct modemctl *);
+ void (*modem_resume)(struct modemctl *);
+ void (*modem_cfg_gpio)(void);
+};
+
+struct modemctl_platform_data {
+ const char *name;
+ unsigned gpio_phone_on;
+ unsigned gpio_phone_active;
+ unsigned gpio_pda_active;
+ unsigned gpio_cp_reset;
+ unsigned gpio_usim_boot;
+ unsigned gpio_flm_sel;
+ unsigned gpio_cp_req_reset; /*HSIC*/
+ unsigned gpio_ipc_slave_wakeup;
+ unsigned gpio_ipc_host_wakeup;
+ unsigned gpio_suspend_request;
+ unsigned gpio_active_state;
+ unsigned gpio_cp_dump_int;
+ int wakeup;
+ struct modemctl_ops ops;
+};
+
+struct modemctl {
+ int irq[3];
+
+ unsigned gpio_phone_on;
+ unsigned gpio_phone_active;
+ unsigned gpio_pda_active;
+ unsigned gpio_cp_reset;
+ unsigned gpio_usim_boot;
+ unsigned gpio_flm_sel;
+
+ unsigned gpio_cp_req_reset;
+ unsigned gpio_ipc_slave_wakeup;
+ unsigned gpio_ipc_host_wakeup;
+ unsigned gpio_suspend_request;
+ unsigned gpio_active_state;
+ unsigned gpio_cp_dump_int;
+ struct modemctl_ops *ops;
+ struct regulator *vcc;
+
+ struct device *dev;
+ const struct attribute_group *group;
+
+ struct delayed_work work;
+ struct work_struct resume_work;
+ struct work_struct cpdump_work;
+ int wakeup_flag; /*flag for CP boot GPIO sync flag*/
+ int cpcrash_flag;
+ int boot_done;
+ struct completion *l2_done;
+#ifdef CONFIG_HAS_WAKELOCK
+ struct wake_lock reset_lock;
+#endif
+ int debug_cnt;
+};
+
+extern struct platform_device modemctl;
+
+extern int usbsvn_request_suspend(void);
+extern int usbsvn_request_resume(void);
+
+int mc_is_modem_on(void);
+int mc_is_modem_active(void);
+int mc_is_suspend_request(void);
+int mc_is_host_wakeup(void);
+int mc_prepare_resume(int);
+int mc_reconnect_gpio(void);
+int mc_control_pda_active(int val);
+int mc_control_active_state(int val);
+int mc_control_slave_wakeup(int val);
+void crash_event(int type);
+
+#endif /* __MODEM_CONTROL_H__ */
diff --git a/include/linux/platform_data/c2c.h b/include/linux/platform_data/c2c.h
new file mode 100644
index 0000000..ebb210b
--- /dev/null
+++ b/include/linux/platform_data/c2c.h
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 2010 Google, Inc.
+ * Copyright (C) 2010 Samsung Electronics.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include <linux/delay.h>
+
+#define C2C_CP_RGN_ADDR 0x60000000
+#define C2C_CP_RGN_SIZE 0x03800000 // 56 MB
+#define C2C_SH_RGN_ADDR (C2C_CP_RGN_ADDR + C2C_SH_RGN_ADDR)
+#define C2C_SH_RGN_SIZE 0x00800000 // 8 MB
+
+
+#define DPRAM_INTR_PORT_SIZE 2
+#define DPRAM_MAGIC_CODE_SIZE 2
+#define DPRAM_ACCESS_CODE_SIZE 2
+#define DP_HEAD_SIZE 0x2
+#define DP_TAIL_SIZE 0x2
+#define DP_MAGIC_CODE 0xAA
+/*
+ Total size = magic_code + access_enable +
+ fmt_tx_head + fmt_tx_tail + fmt_tx_buff +
+ raw_tx_head + raw_tx_tail + raw_tx_buff +
+ fmt_rx_head + fmt_rx_tail + fmt_rx_buff +
+ raw_rx_head + raw_rx_tail + raw_rx_buff +
+ padding +
+ mbx_ap2cp + mbx_cp2ap
+ = 2 + 2 +
+ 2 + 2 + 2044 +
+ 2 + 2 + 6128 +
+ 2 + 2 + 2044 +
+ 2 + 2 + 6128 +
+ 16 +
+ 2 + 2
+ = 16384
+*/
+
+#define TRUE 1
+#define FALSE 0
+
+/* interrupt masks.*/
+#define INT_MASK_VALID 0x0080
+#define INT_MASK_CMD 0x0040
+#define INT_MASK_REQ_ACK_F 0x0020
+#define INT_MASK_REQ_ACK_R 0x0010
+#define INT_MASK_RES_ACK_F 0x0008
+#define INT_MASK_RES_ACK_R 0x0004
+#define INT_MASK_SEND_F 0x0002
+#define INT_MASK_SEND_R 0x0001
+
+#define INT_CMD_INIT_START 0x0001
+#define INT_CMD_INIT_END 0x0002
+#define INT_CMD_REQ_ACTIVE 0x0003
+#define INT_CMD_RES_ACTIVE 0x0004
+#define INT_CMD_REQ_TIME_SYNC 0x0005
+#define INT_CMD_PHONE_START 0x0008
+#define INT_CMD_ERR_DISPLAY 0x0009
+#define INT_CMD_PHONE_DEEP_SLEEP 0x000A
+#define INT_CMD_NV_REBUILDING 0x000B
+#define INT_CMD_EMER_DOWN 0x000C
+#define INT_CMD_PIF_INIT_DONE 0x000D
+#define INT_CMD_SILENT_NV_REBUILDING 0x000E
+#define INT_CMD_NORMAL_POWER_OFF 0x000F
+
+#define INT_CMD(x) (INT_MASK_VALID | INT_MASK_CMD | x)
+#define INT_NON_CMD(x) (INT_MASK_VALID | x)
+
+/* special interrupt cmd indicating modem boot failure. */
+#define INT_POWERSAFE_FAIL 0xDEAD
+
+#define FMT_IDX 0
+#define RAW_IDX 1
+#define MAX_IDX 2
+
+#define GPIO_DPRAM_INT_N 62
+#define IRQ_DPRAM_INT_N gpio_to_irq(GPIO_DPRAM_INT_N)
+
+#define GPIO_PHONE_ACTIVE 120
+
+#define HDLC_START 0x7F
+#define HDLC_END 0x7E
+#define SIZE_OF_HDLC_START 1
+#define SIZE_OF_HDLC_END 1
+
+/* ioctl command definitions. */
+#define IOC_MZ_MAGIC ('o')
+#define DPRAM_PHONE_POWON _IO(IOC_MZ_MAGIC, 0xd0)
+#define DPRAM_PHONEIMG_LOAD _IO(IOC_MZ_MAGIC, 0xd1)
+#define DPRAM_NVDATA_LOAD _IO(IOC_MZ_MAGIC, 0xd2)
+#define DPRAM_PHONE_BOOTSTART _IO(IOC_MZ_MAGIC, 0xd3)
+
+/*related GPMC*/
+#define OMAP44XX_GPMC_CS1_SIZE 0xC /* 64M */
+#define OMAP44XX_GPMC_CS1_MAP 0x04000000
+#define DPRAM_GPMC_CONFIG1 0x00001201
+#define DPRAM_GPMC_CONFIG2 0x000f1200
+#define DPRAM_GPMC_CONFIG3 0x44040400
+#define DPRAM_GPMC_CONFIG4 0x0e05f155
+#define DPRAM_GPMC_CONFIG5 0x000e1016
+#define DPRAM_GPMC_CONFIG6 0x060603c3
+#define DPRAM_GPMC_CONFIG7 0x00000F44
+
+#define GPMC_CONFIG1 (0x00)
+#define GPMC_CONFIG2 (0x04)
+#define GPMC_CONFIG3 (0x08)
+#define GPMC_CONFIG4 (0x0C)
+#define GPMC_CONFIG5 (0x10)
+#define GPMC_CONFIG6 (0x14)
+#define GPMC_CONFIG7 (0x18)
+#define GPMC_CONFIG_CS1 (OMAP44XX_GPMC_BASE+0x90)
+#define GPMC_CONFIG_WIDTH (0x30)
+
+#define REG32(A) (*(volatile unsigned long *)(A))
+#define GPMC_CONTROL_BASE_ADDR 0x50000000
+#define GPMC_CONFIG1_1 (GPMC_CONTROL_BASE_ADDR + 0x90)
+#define GPMC_CONFIG2_1 (GPMC_CONTROL_BASE_ADDR + 0x94)
+#define GPMC_CONFIG3_1 (GPMC_CONTROL_BASE_ADDR + 0x98)
+#define GPMC_CONFIG4_1 (GPMC_CONTROL_BASE_ADDR + 0x9C)
+#define GPMC_CONFIG5_1 (GPMC_CONTROL_BASE_ADDR + 0xA0)
+#define GPMC_CONFIG6_1 (GPMC_CONTROL_BASE_ADDR + 0xA4)
+#define GPMC_CONFIG7_1 (GPMC_CONTROL_BASE_ADDR + 0xA8)
diff --git a/include/linux/platform_data/exynos4_tmu.h b/include/linux/platform_data/exynos4_tmu.h
new file mode 100644
index 0000000..4b093a5
--- /dev/null
+++ b/include/linux/platform_data/exynos4_tmu.h
@@ -0,0 +1,95 @@
+/*
+ * exynos4_tmu.h - Samsung EXYNOS4 TMU (Thermal Management Unit)
+ *
+ * Copyright (C) 2011 Samsung Electronics
+ * Donggeun Kim <dg77.kim@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _LINUX_EXYNOS4_TMU_H
+#define _LINUX_EXYNOS4_TMU_H
+#include <linux/cpu_cooling.h>
+
+enum calibration_type {
+ TYPE_ONE_POINT_TRIMMING,
+ TYPE_TWO_POINT_TRIMMING,
+ TYPE_NONE,
+};
+
+enum tmu_type {
+ TYPE_EXYNOS4210,
+ TYPE_EXYNOS4X12,
+};
+
+/**
+ * struct exynos4_tmu_platform_data
+ * @threshold: basic temperature for generating interrupt
+ * 25 <= threshold <= 125 [unit: degree Celsius]
+ * @trigger_levels: array for each interrupt levels
+ * [unit: degree Celsius]
+ * 0: temperature for trigger_level0 interrupt
+ * condition for trigger_level0 interrupt:
+ * current temperature > threshold + trigger_levels[0]
+ * 1: temperature for trigger_level1 interrupt
+ * condition for trigger_level1 interrupt:
+ * current temperature > threshold + trigger_levels[1]
+ * 2: temperature for trigger_level2 interrupt
+ * condition for trigger_level2 interrupt:
+ * current temperature > threshold + trigger_levels[2]
+ * 3: temperature for trigger_level3 interrupt
+ * condition for trigger_level3 interrupt:
+ * current temperature > threshold + trigger_levels[3]
+ * @trigger_level0_en:
+ * 1 = enable trigger_level0 interrupt,
+ * 0 = disable trigger_level0 interrupt
+ * @trigger_level1_en:
+ * 1 = enable trigger_level1 interrupt,
+ * 0 = disable trigger_level1 interrupt
+ * @trigger_level2_en:
+ * 1 = enable trigger_level2 interrupt,
+ * 0 = disable trigger_level2 interrupt
+ * @trigger_level3_en:
+ * 1 = enable trigger_level3 interrupt,
+ * 0 = disable trigger_level3 interrupt
+ * @gain: gain of amplifier in the positive-TC generator block
+ * 0 <= gain <= 15
+ * @reference_voltage: reference voltage of amplifier
+ * in the positive-TC generator block
+ * 0 <= reference_voltage <= 31
+ * @cal_type: calibration type for temperature
+ * @freq_pctg_table: Table representing frequency reduction percentage.
+ * @freq_tab_count: Count of the above table as frequency reduction may
+ * applicable to only some of the trigger levels.
+ *
+ * This structure is required for configuration of exynos4_tmu driver.
+ */
+struct exynos4_tmu_platform_data {
+ u8 threshold;
+ u8 trigger_levels[4];
+ bool trigger_level0_en;
+ bool trigger_level1_en;
+ bool trigger_level2_en;
+ bool trigger_level3_en;
+
+ u8 gain;
+ u8 reference_voltage;
+
+ enum calibration_type cal_type;
+
+ struct freq_pctg_table freq_tab[4];
+ unsigned int freq_tab_count;
+};
+#endif /* _LINUX_EXYNOS4_TMU_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 0000000..1bad86f
--- /dev/null
+++ b/include/linux/platform_data/exynos_usb3_drd.h
@@ -0,0 +1,22 @@
+/* inlude/linux/platform_data/exynos_usb3_drd.h
+ *
+ * Copyright (c) 2012 Samsung Electronics Co. Ltd
+ * Author: Anton Tikhomirov <av.tikhomirov@samsung.com>
+ *
+ * EXYNOS SuperSpeed USB 3.0 DRD Controller platform data
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef _EXYNOS_USB3_DRD_H_
+#define _EXYNOS_USB3_DRD_H_
+
+struct exynos_usb3_drd_pdata {
+ int phy_type;
+ int (*phy_init)(struct platform_device *pdev, int type);
+ int (*phy_exit)(struct platform_device *pdev, int type);
+};
+
+#endif
diff --git a/include/linux/platform_data/lte_modem_bootloader.h b/include/linux/platform_data/lte_modem_bootloader.h
new file mode 100644
index 0000000..27a0450
--- /dev/null
+++ b/include/linux/platform_data/lte_modem_bootloader.h
@@ -0,0 +1,40 @@
+/* Lte modem bootloader support for Samsung Tuna Board.
+ *
+ * Copyright (C) 2011 Google, Inc.
+ * Copyright (C) 2011 Samsung Electronics.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __LTE_MODEM_BOOTLOADER_H
+#define __LTE_MODEM_BOOTLOADER_H
+
+#define LTE_MODEM_BOOTLOADER_DRIVER_NAME "lte_modem_bootloader"
+
+#define IOCTL_LTE_MODEM_XMIT_BOOT _IOW('o', 0x23, unsigned int)
+#define IOCTL_LTE_MODEM_LTE2AP_STATUS _IOR('o', 0x24, unsigned int)
+
+#define AIRPLAIN_MODE_TEST
+
+#ifdef AIRPLAIN_MODE_TEST
+#define IOCTL_LTE_MODEM_AIRPLAIN_ON _IOWR('o', 0x25, unsigned int)
+#define IOCTL_LTE_MODEM_AIRPLAIN_OFF _IOWR('o', 0x26, unsigned int)
+#endif
+
+struct lte_modem_bootloader_param {
+ char __user *buf;
+ int len;
+};
+
+struct lte_modem_bootloader_platform_data {
+ const char *name;
+ unsigned int gpio_lte2ap_status;
+};
+#endif/* LTE_MODEM_BOOTLOADER_H */
diff --git a/include/linux/platform_data/mms_ts.h b/include/linux/platform_data/mms_ts.h
new file mode 100644
index 0000000..8c51e58
--- /dev/null
+++ b/include/linux/platform_data/mms_ts.h
@@ -0,0 +1,104 @@
+/*
+ * mms_ts.h - Platform data for Melfas MMS-series touch driver
+ *
+ * Copyright (C) 2011 Google Inc.
+ * Author: Dima Zavin <dima@android.com>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ */
+
+#ifndef _LINUX_MMS_TOUCH_H
+#define _LINUX_MMS_TOUCH_H
+#define MELFAS_TS_NAME "melfas-ts"
+
+struct melfas_tsi_platform_data {
+ int max_x;
+ int max_y;
+
+ bool invert_x;
+ bool invert_y;
+
+ int gpio_int;
+ int gpio_sda;
+ int gpio_scl;
+ int (*mux_fw_flash) (bool to_gpios);
+ int (*power) (int on);
+ int (*is_vdd_on) (void);
+ const char *fw_name;
+ bool use_touchkey;
+ const u8 *touchkey_keycode;
+ const u8 *config_fw_version;
+#ifdef CONFIG_INPUT_FBSUSPEND
+ struct notifier_block fb_notif;
+#endif
+ void (*input_event) (void *data);
+ int (*lcd_type) (void);
+ void (*register_cb) (void *);
+};
+extern struct class *sec_class;
+void tsp_charger_infom(bool en);
+
+#endif /* _LINUX_MMS_TOUCH_H */
+
+#ifndef __MMS100_ISC_H__
+#define __MMS100_ISC_H__
+
+typedef enum {
+ ISC_NONE = -1,
+ ISC_SUCCESS = 0,
+ ISC_FILE_OPEN_ERROR,
+ ISC_FILE_CLOSE_ERROR,
+ ISC_FILE_FORMAT_ERROR,
+ ISC_WRITE_BUFFER_ERROR,
+ ISC_I2C_ERROR,
+ ISC_UPDATE_MODE_ENTER_ERROR,
+ ISC_CRC_ERROR,
+ ISC_VALIDATION_ERROR,
+ ISC_COMPATIVILITY_ERROR,
+ ISC_UPDATE_SECTION_ERROR,
+ ISC_SLAVE_ERASE_ERROR,
+ ISC_SLAVE_DOWNLOAD_ERROR,
+ ISC_DOWNLOAD_WHEN_SLAVE_IS_UPDATED_ERROR,
+ ISC_INITIAL_PACKET_ERROR,
+ ISC_NO_NEED_UPDATE_ERROR,
+ ISC_LIMIT
+} eISCRet_t;
+
+typedef enum {
+ EC_NONE = -1,
+ EC_DEPRECATED = 0,
+ EC_BOOTLOADER_RUNNING = 1,
+ EC_BOOT_ON_SUCCEEDED = 2,
+ EC_ERASE_END_MARKER_ON_SLAVE_FINISHED = 3,
+ EC_SLAVE_DOWNLOAD_STARTS = 4,
+ EC_SLAVE_DOWNLOAD_FINISHED = 5,
+ EC_2CHIP_HANDSHAKE_FAILED = 0x0E,
+ EC_ESD_PATTERN_CHECKED = 0x0F,
+ EC_LIMIT
+} eErrCode_t;
+
+typedef enum {
+ SEC_NONE = -1,
+ SEC_BOOTLOADER = 0,
+ SEC_CORE,
+ SEC_PRIVATE_CONFIG,
+ SEC_PUBLIC_CONFIG,
+ SEC_LIMIT
+} eSectionType_t;
+
+typedef struct {
+ unsigned char version;
+ unsigned char compatible_version;
+ unsigned char start_addr;
+ unsigned char end_addr;
+} tISCFWInfo_t;
+
+/*eISCRet_t mms100_ISC_download_mbinary(struct i2c_client *_client); */
+#endif /* __MMS100_ISC_H__ */
+
+
diff --git a/include/linux/platform_data/mms_ts_gc.h b/include/linux/platform_data/mms_ts_gc.h
new file mode 100644
index 0000000..318dadf
--- /dev/null
+++ b/include/linux/platform_data/mms_ts_gc.h
@@ -0,0 +1,39 @@
+/*
+ * mms_ts.h - Platform data for Melfas MMS-series touch driver
+ *
+ * Copyright (C) 2011 Google Inc.
+ * Author: Dima Zavin <dima@android.com>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ */
+
+#ifndef _LINUX_MMS_TOUCH_H
+#define _LINUX_MMS_TOUCH_H
+#define MELFAS_TS_NAME "melfas-ts"
+
+struct melfas_tsi_platform_data {
+ int max_x;
+ int max_y;
+
+ bool invert_x;
+ bool invert_y;
+
+ int gpio_int;
+ int gpio_sda;
+ int gpio_scl;
+ int (*mux_fw_flash)(bool to_gpios);
+ int (*power)(int on);
+ const char *fw_name;
+ const u8 *config_fw_version;
+ void (*input_event)(void *data);
+ void (*register_cb)(void *);
+};
+extern struct class *sec_class;
+void tsp_charger_infom(bool en);
+
+#endif /* _LINUX_MMS_TOUCH_H */
diff --git a/include/linux/platform_data/modem.h b/include/linux/platform_data/modem.h
new file mode 100644
index 0000000..d66af9f
--- /dev/null
+++ b/include/linux/platform_data/modem.h
@@ -0,0 +1,323 @@
+/*
+ * Copyright (C) 2010 Google, Inc.
+ * Copyright (C) 2010 Samsung Electronics.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MODEM_IF_H__
+#define __MODEM_IF_H__
+
+enum modem_t {
+ IMC_XMM6260,
+ IMC_XMM6262,
+ VIA_CBP71,
+ VIA_CBP72,
+ SEC_CMC221,
+ QC_MDM6600,
+ DUMMY,
+};
+
+enum dev_format {
+ IPC_FMT,
+ IPC_RAW,
+ IPC_RFS,
+ IPC_CMD,
+ IPC_BOOT,
+ IPC_MULTI_RAW,
+ IPC_RAMDUMP,
+ MAX_DEV_FORMAT,
+};
+#define MAX_IPC_DEV (IPC_RFS + 1)
+
+enum modem_io {
+ IODEV_MISC,
+ IODEV_NET,
+ IODEV_DUMMY,
+};
+
+enum modem_link {
+ LINKDEV_UNDEFINED,
+ LINKDEV_MIPI,
+ LINKDEV_DPRAM,
+ LINKDEV_SPI,
+ LINKDEV_USB,
+ LINKDEV_HSIC,
+ LINKDEV_C2C,
+ LINKDEV_MAX,
+};
+#define LINKTYPE(modem_link) (1u << (modem_link))
+
+enum modem_network {
+ UMTS_NETWORK,
+ CDMA_NETWORK,
+ LTE_NETWORK,
+};
+
+enum sipc_ver {
+ NO_SIPC_VER = 0,
+ SIPC_VER_40 = 40,
+ SIPC_VER_41 = 41,
+ SIPC_VER_42 = 42,
+ SIPC_VER_50 = 50,
+ MAX_SIPC_VER,
+};
+
+/**
+ * struct modem_io_t - declaration for io_device
+ * @name: device name
+ * @id: contain format & channel information
+ * (id & 11100000b)>>5 = format (eg, 0=FMT, 1=RAW, 2=RFS)
+ * (id & 00011111b) = channel (valid only if format is RAW)
+ * @format: device format
+ * @io_type: type of this io_device
+ * @links: list of link_devices to use this io_device
+ * for example, if you want to use DPRAM and USB in an io_device.
+ * .links = LINKTYPE(LINKDEV_DPRAM) | LINKTYPE(LINKDEV_USB)
+ * @tx_link: when you use 2+ link_devices, set the link for TX.
+ * If define multiple link_devices in @links,
+ * you can receive data from them. But, cannot send data to all.
+ * TX is only one link_device.
+ *
+ * This structure is used in board-*-modem.c
+ */
+struct modem_io_t {
+ char *name;
+ int id;
+ enum dev_format format;
+ enum modem_io io_type;
+ enum modem_link links;
+ enum modem_link tx_link;
+ bool rx_gather;
+};
+
+struct modemlink_pm_data {
+ char *name;
+ /* link power contol 2 types : pin & regulator control */
+ int (*link_ldo_enable)(bool);
+ unsigned gpio_link_enable;
+ unsigned gpio_link_active;
+ unsigned gpio_link_hostwake;
+ unsigned gpio_link_slavewake;
+ int (*link_reconnect)(void);
+ int (*port_enable)(int, int);
+ int *p_hub_status;
+ bool has_usbhub;
+
+ atomic_t freqlock;
+ int (*cpufreq_lock)(void);
+ int (*cpufreq_unlock)(void);
+
+ int autosuspend_delay_ms; /* if zero, the default value is used */
+};
+
+struct modemlink_pm_link_activectl {
+ int gpio_initialized;
+ int gpio_request_host_active;
+};
+
+enum dpram_type {
+ EXT_DPRAM,
+ CP_IDPRAM,
+ AP_IDPRAM,
+ C2C_DPRAM,
+ MAX_DPRAM_TYPE
+};
+
+enum dpram_speed {
+ DPRAM_SPEED_LOW,
+ DPRAM_SPEED_MID,
+ DPRAM_SPEED_HIGH,
+ MAX_DPRAM_SPEED
+};
+
+struct dpram_circ {
+ u16 __iomem *head;
+ u16 __iomem *tail;
+ u8 __iomem *buff;
+ u32 size;
+};
+
+struct dpram_ipc_device {
+ char name[16];
+ int id;
+
+ struct dpram_circ txq;
+ struct dpram_circ rxq;
+
+ u16 mask_req_ack;
+ u16 mask_res_ack;
+ u16 mask_send;
+};
+
+struct dpram_ipc_map {
+ u16 __iomem *magic;
+ u16 __iomem *access;
+
+ struct dpram_ipc_device dev[MAX_IPC_DEV];
+
+ u16 __iomem *mbx_cp2ap;
+ u16 __iomem *mbx_ap2cp;
+};
+
+struct modemlink_dpram_control {
+ void (*reset)(void);
+ void (*setup_speed)(enum dpram_speed);
+ int (*wakeup)(void);
+ void (*sleep)(void);
+
+ void (*clear_intr)(void);
+ u16 (*recv_intr)(void);
+ void (*send_intr)(u16);
+ u16 (*recv_msg)(void);
+ void (*send_msg)(u16);
+
+ u16 (*get_magic)(void);
+ void (*set_magic)(u16);
+
+ u16 (*get_access)(void);
+ void (*set_access)(u16);
+
+ u32 (*get_tx_head)(int);
+ u32 (*get_tx_tail)(int);
+ void (*set_tx_head)(int, u32);
+ void (*set_tx_tail)(int, u32);
+ u8 __iomem * (*get_tx_buff)(int);
+ u32 (*get_tx_buff_size)(int);
+ u16 (*get_mask_req_ack)(int);
+ u16 (*get_mask_res_ack)(int);
+ u16 (*get_mask_send)(int);
+
+ u32 (*get_rx_head)(int);
+ u32 (*get_rx_tail)(int);
+ void (*set_rx_head)(int, u32);
+ void (*set_rx_tail)(int, u32);
+ u8 __iomem * (*get_rx_buff)(int);
+ u32 (*get_rx_buff_size)(int);
+
+ void (*log_disp)(struct modemlink_dpram_control *dpctl);
+ int (*cpupload_step1)(struct modemlink_dpram_control *dpctl);
+ int (*cpupload_step2)(void *arg, struct modemlink_dpram_control *dpctl);
+ int (*cpimage_load_prepare)(struct modemlink_dpram_control *dpctl);
+ int (*cpimage_load)(void *arg, struct modemlink_dpram_control *dpctl);
+ int (*nvdata_load)(void *arg, struct modemlink_dpram_control *dpctl);
+ int (*phone_boot_start)(struct modemlink_dpram_control *dpctl);
+ int (*phone_boot_start_post_process)(void);
+ void (*phone_boot_start_handler)(struct modemlink_dpram_control *dpctl);
+ void (*dload_cmd_hdlr)(
+ struct modemlink_dpram_control *dpctl, u16 cmd);
+ void (*bt_map_init)(struct modemlink_dpram_control *dpctl);
+ void (*load_init)(struct modemlink_dpram_control *dpctl);
+#if defined(CONFIG_MACH_M0_CTC)
+ void (*terminate_link)(struct modemlink_dpram_control *dpctl);
+#endif
+ u8 __iomem *dp_base;
+ u32 dp_size;
+ enum dpram_type dp_type; /* DPRAM type */
+ int aligned; /* If aligned access is required, ... */
+
+ int dpram_irq;
+ unsigned long dpram_irq_flags;
+ char *dpram_irq_name;
+ char *dpram_wlock_name;
+
+ int max_ipc_dev;
+
+ struct dpram_ipc_map *ipc_map;
+};
+
+#define DPRAM_MAGIC_CODE 0xAA
+
+/* platform data */
+struct modem_data {
+ char *name;
+
+ unsigned gpio_cp_on;
+ unsigned gpio_cp_off;
+ unsigned gpio_reset_req_n;
+ unsigned gpio_cp_reset;
+ unsigned gpio_pda_active;
+ unsigned gpio_phone_active;
+ unsigned gpio_cp_dump_int;
+ unsigned gpio_ap_dump_int;
+ unsigned gpio_flm_uart_sel;
+#if defined(CONFIG_MACH_M0_CTC)
+ unsigned gpio_flm_uart_sel_rev06;
+ unsigned gpio_host_wakeup;
+#endif
+ unsigned gpio_cp_warm_reset;
+ unsigned gpio_sim_detect;
+#ifdef CONFIG_LINK_DEVICE_DPRAM
+ unsigned gpio_dpram_int;
+#endif
+
+#ifdef CONFIG_LTE_MODEM_CMC221
+ unsigned gpio_dpram_status;
+ unsigned gpio_dpram_wakeup;
+ unsigned gpio_slave_wakeup;
+ unsigned gpio_host_active;
+ unsigned gpio_host_wakeup;
+ int irq_host_wakeup;
+#endif
+#ifdef CONFIG_MACH_U1_KOR_LGT
+ unsigned gpio_cp_reset_msm;
+ unsigned gpio_boot_sw_sel;
+ void (*vbus_on)(void);
+ void (*vbus_off)(void);
+ struct regulator *cp_vbus;
+#endif
+
+ /* Switch with 2 links in a modem */
+ unsigned gpio_dynamic_switching;
+
+ /* Modem component */
+ enum modem_network modem_net;
+ enum modem_t modem_type;
+ enum modem_link link_types;
+ char *link_name;
+#ifdef CONFIG_LINK_DEVICE_DPRAM
+ /* Link to DPRAM control functions dependent on each platform */
+ struct modemlink_dpram_control *dpram_ctl;
+#endif
+
+ /* SIPC version */
+ enum sipc_ver ipc_version;
+
+ /* Information of IO devices */
+ unsigned num_iodevs;
+ struct modem_io_t *iodevs;
+
+ /* Modem link PM support */
+ struct modemlink_pm_data *link_pm_data;
+
+ void (*gpio_revers_bias_clear)(void);
+ void (*gpio_revers_bias_restore)(void);
+
+ /* Handover with 2+ modems */
+ bool use_handover;
+
+ /* Debugging option */
+ bool use_mif_log;
+};
+
+#define LOG_TAG "mif: "
+
+#define mif_err(fmt, ...) \
+ pr_err(LOG_TAG "%s: " pr_fmt(fmt), __func__, ##__VA_ARGS__)
+#define mif_debug(fmt, ...) \
+ pr_debug(LOG_TAG "%s: " pr_fmt(fmt), __func__, ##__VA_ARGS__)
+#define mif_info(fmt, ...) \
+ pr_info(LOG_TAG "%s: " pr_fmt(fmt), __func__, ##__VA_ARGS__)
+#define mif_trace(fmt, ...) \
+ printk(KERN_DEBUG "mif: %s: %d: called(%pF): " fmt, \
+ __func__, __LINE__, __builtin_return_address(0), ##__VA_ARGS__)
+
+#endif
diff --git a/include/linux/platform_data/ntc_thermistor.h b/include/linux/platform_data/ntc_thermistor.h
new file mode 100644
index 0000000..88734e8
--- /dev/null
+++ b/include/linux/platform_data/ntc_thermistor.h
@@ -0,0 +1,53 @@
+/*
+ * ntc_thermistor.h - NTC Thermistors
+ *
+ * Copyright (C) 2010 Samsung Electronics
+ * MyungJoo Ham <myungjoo.ham@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#ifndef _LINUX_NTC_H
+#define _LINUX_NTC_H
+
+enum ntc_thermistor_type {
+ TYPE_NCPXXWB473,
+ TYPE_NCPXXWL333,
+};
+
+struct ntc_thermistor_platform_data {
+ /*
+ * One (not both) of read_uV and read_ohm should be provided and only
+ * one of the two should be provided.
+ * Both functions should return negative value for an error case.
+ *
+ * pullup_uV, pullup_ohm, pulldown_ohm, and connect are required to use
+ * read_uV()
+ *
+ * How to setup pullup_ohm, pulldown_ohm, and connect is
+ * described at Documentation/hwmon/ntc_thermistor
+ *
+ * pullup/down_ohm: 0 for infinite / not-connected
+ */
+ int (*read_uV)(void);
+ unsigned int pullup_uV;
+
+ unsigned int pullup_ohm;
+ unsigned int pulldown_ohm;
+ enum { NTC_CONNECTED_POSITIVE, NTC_CONNECTED_GROUND } connect;
+
+ int (*read_ohm)(void);
+};
+
+#endif /* _LINUX_NTC_H */
diff --git a/include/linux/platform_data/ram_console.h b/include/linux/platform_data/ram_console.h
new file mode 100644
index 0000000..9f1125c
--- /dev/null
+++ b/include/linux/platform_data/ram_console.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _INCLUDE_LINUX_PLATFORM_DATA_RAM_CONSOLE_H_
+#define _INCLUDE_LINUX_PLATFORM_DATA_RAM_CONSOLE_H_
+
+struct ram_console_platform_data {
+ const char *bootinfo;
+};
+
+#endif /* _INCLUDE_LINUX_PLATFORM_DATA_RAM_CONSOLE_H_ */
diff --git a/include/linux/platform_data/usb3503.h b/include/linux/platform_data/usb3503.h
new file mode 100644
index 0000000..9bcf4ec
--- /dev/null
+++ b/include/linux/platform_data/usb3503.h
@@ -0,0 +1,42 @@
+#ifndef USB3503_H
+#define USB3503_H
+
+#define USB3503_I2C_NAME "usb3503"
+#define HUB_TAG "usb3503: "
+
+#define CFG1_REG 0x06
+#define CFG1_SELF_BUS_PWR (0x1 << 7)
+
+#define SP_ILOCK_REG 0xE7
+#define SPILOCK_CONNECT_N (0x1 << 1)
+#define SPILOCK_CONFIG_N (0x1 << 0)
+
+#define CFGP_REG 0xEE
+#define CFGP_CLKSUSP (0x1 << 7)
+
+#define PDS_REG 0x0A
+#define PDS_PORT1 (0x1 << 1)
+#define PDS_PORT2 (0x1 << 2)
+#define PDS_PORT3 (0x1 << 3)
+
+
+enum usb3503_mode {
+ USB3503_MODE_UNKNOWN,
+ USB3503_MODE_HUB,
+ USB3503_MODE_STANDBY,
+};
+
+struct usb3503_platform_data {
+ char initial_mode;
+ int (*reset_n)(int);
+ int (*register_hub_handler)(void (*)(void), void *);
+ int (*port_enable)(int, int);
+};
+
+struct usb3503_hubctl {
+ int mode;
+ int (*reset_n)(int);
+ int (*port_enable)(int, int);
+ struct i2c_client *i2c_dev;
+};
+#endif
diff --git a/include/linux/plist.h b/include/linux/plist.h
index c9b9f32..aa0fb39 100644
--- a/include/linux/plist.h
+++ b/include/linux/plist.h
@@ -77,14 +77,9 @@
#include <linux/kernel.h>
#include <linux/list.h>
-#include <linux/spinlock_types.h>
struct plist_head {
struct list_head node_list;
-#ifdef CONFIG_DEBUG_PI_LIST
- raw_spinlock_t *rawlock;
- spinlock_t *spinlock;
-#endif
};
struct plist_node {
@@ -93,37 +88,13 @@ struct plist_node {
struct list_head node_list;
};
-#ifdef CONFIG_DEBUG_PI_LIST
-# define PLIST_HEAD_LOCK_INIT(_lock) .spinlock = _lock
-# define PLIST_HEAD_LOCK_INIT_RAW(_lock) .rawlock = _lock
-#else
-# define PLIST_HEAD_LOCK_INIT(_lock)
-# define PLIST_HEAD_LOCK_INIT_RAW(_lock)
-#endif
-
-#define _PLIST_HEAD_INIT(head) \
- .node_list = LIST_HEAD_INIT((head).node_list)
-
/**
* PLIST_HEAD_INIT - static struct plist_head initializer
* @head: struct plist_head variable name
- * @_lock: lock to initialize for this list
- */
-#define PLIST_HEAD_INIT(head, _lock) \
-{ \
- _PLIST_HEAD_INIT(head), \
- PLIST_HEAD_LOCK_INIT(&(_lock)) \
-}
-
-/**
- * PLIST_HEAD_INIT_RAW - static struct plist_head initializer
- * @head: struct plist_head variable name
- * @_lock: lock to initialize for this list
*/
-#define PLIST_HEAD_INIT_RAW(head, _lock) \
+#define PLIST_HEAD_INIT(head) \
{ \
- _PLIST_HEAD_INIT(head), \
- PLIST_HEAD_LOCK_INIT_RAW(&(_lock)) \
+ .node_list = LIST_HEAD_INIT((head).node_list) \
}
/**
@@ -141,31 +112,11 @@ struct plist_node {
/**
* plist_head_init - dynamic struct plist_head initializer
* @head: &struct plist_head pointer
- * @lock: spinlock protecting the list (debugging)
*/
static inline void
-plist_head_init(struct plist_head *head, spinlock_t *lock)
+plist_head_init(struct plist_head *head)
{
INIT_LIST_HEAD(&head->node_list);
-#ifdef CONFIG_DEBUG_PI_LIST
- head->spinlock = lock;
- head->rawlock = NULL;
-#endif
-}
-
-/**
- * plist_head_init_raw - dynamic struct plist_head initializer
- * @head: &struct plist_head pointer
- * @lock: raw_spinlock protecting the list (debugging)
- */
-static inline void
-plist_head_init_raw(struct plist_head *head, raw_spinlock_t *lock)
-{
- INIT_LIST_HEAD(&head->node_list);
-#ifdef CONFIG_DEBUG_PI_LIST
- head->rawlock = lock;
- head->spinlock = NULL;
-#endif
}
/**
diff --git a/include/linux/pm_qos_params.h b/include/linux/pm_qos_params.h
index a7d87f9..738190b 100644
--- a/include/linux/pm_qos_params.h
+++ b/include/linux/pm_qos_params.h
@@ -12,13 +12,20 @@
#define PM_QOS_CPU_DMA_LATENCY 1
#define PM_QOS_NETWORK_LATENCY 2
#define PM_QOS_NETWORK_THROUGHPUT 3
+#define PM_QOS_BUS_DMA_THROUGHPUT 4
+#define PM_QOS_DISPLAY_FREQUENCY 5
+#define PM_QOS_BUS_QOS 6
+#define PM_QOS_DVFS_RESPONSE_LATENCY 7
-#define PM_QOS_NUM_CLASSES 4
+#define PM_QOS_NUM_CLASSES 8
#define PM_QOS_DEFAULT_VALUE -1
#define PM_QOS_CPU_DMA_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
#define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
#define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0
+#define PM_QOS_BUS_DMA_THROUGHPUT_DEFAULT_VALUE 0
+#define PM_QOS_DISPLAY_FREQUENCY_DEFAULT_VALUE 0
+#define PM_QOS_DVFS_RESPONSE_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC)
struct pm_qos_request_list {
struct plist_node list;
diff --git a/include/linux/pn544.h b/include/linux/pn544.h
new file mode 100644
index 0000000..44ed70f
--- /dev/null
+++ b/include/linux/pn544.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2010 Trusted Logic S.A.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#define PN544_MAGIC 0xE9
+
+/*
+ * PN544 power control via ioctl
+ * PN544_SET_PWR(0): power off
+ * PN544_SET_PWR(1): power on
+ * PN544_SET_PWR(>1): power on with firmware download enabled
+ */
+#define PN544_SET_PWR _IOW(PN544_MAGIC, 0x01, unsigned int)
+
+struct pn544_i2c_platform_data {
+ unsigned int irq_gpio;
+ unsigned int ven_gpio;
+ unsigned int firm_gpio;
+};
diff --git a/include/linux/power/charger-manager.h b/include/linux/power/charger-manager.h
new file mode 100644
index 0000000..95bca90
--- /dev/null
+++ b/include/linux/power/charger-manager.h
@@ -0,0 +1,242 @@
+/* linux/include/linux/power/charger-manager.h
+ *
+ * Copyright (C) 2011 Samsung Electronics Co., Ltd.
+ * MyungJoo.Ham <myungjoo.ham@samsung.com>
+ *
+ * Charger Manager.
+ * This framework enables to control and multiple chargers and to
+ * monitor charging even in the context of suspend-to-RAM with
+ * an interface combining the chargers.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+**/
+
+#ifndef __SAMSUNG_DEV_CHARGER_H
+#define __SAMSUNG_DEV_CHARGER_H
+
+#include <linux/power_supply.h>
+#include <linux/extcon.h>
+
+enum data_source {
+ CM_ASSUME_ALWAYS_TRUE,
+ CM_ASSUME_ALWAYS_FALSE,
+ CM_FUEL_GAUGE,
+ CM_CHARGER_STAT,
+};
+
+enum cm_event_types {
+ CM_EVENT_UNDESCRIBED = 0,
+ CM_EVENT_BATT_FULL,
+ CM_EVENT_BATT_IN,
+ CM_EVENT_BATT_OUT,
+ CM_EVENT_EXT_PWR_IN_OUT,
+ CM_EVENT_CHG_START_STOP,
+ CM_EVENT_OTHERS,
+};
+
+enum polling_modes {
+ CM_POLL_DISABLE = 0,
+ CM_POLL_ALWAYS,
+ /* To use PWR-ONLY option, EXT_PWR_IN_OUT type irqs should exist */
+ CM_POLL_EXTERNAL_POWER_ONLY,
+ /* To use CHG-ONLY option, CHG_START_STOP type irqs should exist */
+ CM_POLL_CHARGING_ONLY,
+};
+
+struct charger_global_desc {
+ /*
+ * For in-suspend monitoring, suspend-again related data is
+ * required. These are used as global for Charger-Manager.
+ * They should work with no_irq with dpm_suspend()'ed environment.
+ *
+ * rtc is the name of RTC used to wakeup the system from
+ * suspend. Previously appointed alarm is saved and restored if
+ * enabled and the alarm time is later than now.
+ */
+ char *rtc;
+
+ /*
+ * If the system is waked up by waekup-sources other than the RTC or
+ * callbacks.setup provided with charger_global_desc, Charger Manager
+ * should recognize with is_rtc_only_wakeup_reason() returning false.
+ * If the RTC given to CM is the only wakeup reason,
+ * is_rtc_only_wakeup_reason should return true.
+ */
+ bool (*is_rtc_only_wakeup_reason)(void);
+
+ /*
+ * Assume that the jiffy timer stops in suspend-to-RAM.
+ * When enabled, CM does not rely on jiffies value in
+ * suspend_again and assumes that jiffies value does not
+ * change during suspend.
+ */
+ bool assume_timer_stops_in_suspend;
+};
+
+#ifdef CONFIG_EXTCON
+struct charger_cable {
+ const char *extcon_name;
+ const char *name;
+
+ /*
+ * Set min/max current of regulator to protect over-current issue
+ * according to a kind of charger cable when cable is attached.
+ */
+ int min_uA;
+ int max_uA;
+
+ /* The charger-manager use Exton framework*/
+ struct extcon_specific_cable_nb extcon_dev;
+ struct work_struct wq;
+ struct notifier_block nb;
+
+ /* The state of charger cable */
+ bool attached;
+
+ struct charger_regulator *charger;
+ struct charger_manager *cm;
+};
+
+struct charger_regulator {
+ /* The name of regulator for charging */
+ const char *regulator_name;
+ struct regulator *consumer;
+
+ /*
+ * Store constraint information related to current limit,
+ * each cable have different condition for charging.
+ */
+ struct charger_cable *cables;
+ int num_cables;
+};
+#endif
+
+struct charger_desc {
+ /*
+ * The name of psy (power-supply-class) entry.
+ * If psy_name is NULL, "battery" is used.
+ */
+ char *psy_name;
+
+ /* The manager may poll with shorter interval, but not longer. */
+ enum polling_modes polling_mode;
+ unsigned int polling_interval_ms;
+
+ /*
+ * Check voltage drop after the battery is fully charged.
+ * If it has dropped more than fullbatt_vchkdrop_uV after
+ * fullbatt_vchkdrop_ms, CM will restart charging.
+ */
+ unsigned int fullbatt_vchkdrop_ms;
+ unsigned int fullbatt_vchkdrop_uV;
+
+ /*
+ * If it is not being charged and VBATT >= fullbatt_uV,
+ * it is assumed to be full. In order not to use this, set
+ * fullbatt_uV 0.
+ */
+ unsigned int fullbatt_uV;
+
+ /*
+ * How the data is picked up for "PRESENT"?
+ * Are we reading the value from chargers or fuel gauges?
+ */
+ enum data_source battery_present;
+
+ /*
+ * The power-supply entries of psy_charger_stat[i] shows "PRESENT",
+ * "ONLINE", "STATUS (Should notify at least FULL or NOT)" of the
+ * charger-i. "Charging/Discharging/NotCharging" of "STATUS" are
+ * optional and recommended.
+ */
+ char **psy_charger_stat;
+
+ /*
+ * The power-supply entries with VOLTAGE_NOW, CAPACITY,
+ * and "PRESENT".
+ */
+ char *psy_fuel_gauge;
+
+ int (*is_temperature_error)(int *mC);
+ bool measure_ambient_temp;
+ bool measure_battery_temp;
+
+ int soc_margin;
+
+ struct charger_regulator *charger_regulators;
+ int num_charger_regulators;
+};
+
+#define PSY_NAME_MAX 30
+struct charger_manager {
+ struct list_head entry;
+ struct device *dev;
+ struct charger_desc *desc;
+
+ struct power_supply *fuel_gauge;
+ struct power_supply **charger_stat;
+
+ bool cancel_suspend; /* if there is a pending charger event. */
+ bool charger_enabled;
+
+ unsigned long fullbatt_vchk_jiffies_at; /* 0 for N/A */
+ unsigned int fullbatt_vchk_uV;
+ struct delayed_work fullbatt_vchk_work;
+
+ bool user_prohibit;
+ int emergency_stop; /* Do not charge */
+ int last_temp_mC;
+
+ char psy_name_buf[PSY_NAME_MAX + 1]; /* Output to user */
+ struct power_supply charger_psy;
+
+ /*
+ * status saved entering a suspend and if the saved status is
+ * changed at suspend_again, suspend_again STOPs
+ */
+ bool status_save_ext_pwr_inserted;
+ bool status_save_batt;
+
+ int batt_tmu_status;
+};
+
+/* In case IRQs cannot be given and notifications will be given. */
+#ifdef CONFIG_CHARGER_MANAGER
+extern void cm_notify_event(struct power_supply *psy, enum cm_event_types type,
+ char *msg); /* msg: optional */
+extern struct charger_manager *get_charger_manager(char *psy_name);
+extern int setup_charger_manager(struct charger_global_desc *gd);
+extern bool is_charger_manager_active(void);
+extern bool cm_suspend_again(void);
+extern void cm_prohibit_charging(struct charger_manager *cm);
+extern void cm_allow_charging(struct charger_manager *cm);
+#else
+static void __maybe_unused cm_notify_event(struct power_supply *psy,
+ enum cm_event_types type, char *msg)
+{ }
+
+static struct charger_manager __maybe_unused *get_charger_manager(
+ char *psy_name)
+{
+ return NULL;
+}
+
+static void __maybe_unused setup_charger_manager(struct charger_global_desc *gd)
+{ }
+
+static bool __maybe_unused is_charger_manager_active(void)
+{
+ return false;
+}
+
+static bool __maybe_unused cm_suspend_again(void)
+{
+ return false;
+}
+static void __maybe_unused cm_prohibit_charging(struct charger_manager *cm) { }
+static void __maybe_unused cm_allow_charging(struct charger_manager *cm) { }
+#endif
+
+#endif /* __SAMSUNG_DEV_CHARGER_H */
diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h
index 7995deb..72ab5d7 100644
--- a/include/linux/power/max17042_battery.h
+++ b/include/linux/power/max17042_battery.h
@@ -25,6 +25,8 @@
struct max17042_platform_data {
bool enable_current_sense;
+
+ const char *psy_name;
};
#endif /* __MAX17042_BATTERY_H_ */
diff --git a/include/linux/power/max17042_fuelgauge_px.h b/include/linux/power/max17042_fuelgauge_px.h
new file mode 100644
index 0000000..c02aabb
--- /dev/null
+++ b/include/linux/power/max17042_fuelgauge_px.h
@@ -0,0 +1,343 @@
+/*
+ * max17042_battery.h
+ * fuel-gauge systems for lithium-ion (Li+) batteries
+ *
+ * Copyright (C) 2010 Samsung Electronics
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _MAX17042_BATTERY_H
+#define _MAX17042_BATTERY_H
+
+/* Register address */
+#define STATUS_REG 0x00
+#define VALRT_THRESHOLD_REG 0x01
+#define TALRT_THRESHOLD_REG 0x02
+#define SALRT_THRESHOLD_REG 0x03
+#define REMCAP_REP_REG 0x05
+#define SOCREP_REG 0x06
+#define TEMPERATURE_REG 0x08
+#define VCELL_REG 0x09
+#define CURRENT_REG 0x0A
+#define AVG_CURRENT_REG 0x0B
+#define SOCMIX_REG 0x0D
+#define SOCAV_REG 0x0E
+#define REMCAP_MIX_REG 0x0F
+#define FULLCAP_REG 0x10
+#define RFAST_REG 0x15
+#define AVR_TEMPERATURE_REG 0x16
+#define CYCLES_REG 0x17
+#define DESIGNCAP_REG 0x18
+#define AVR_VCELL_REG 0x19
+#define CONFIG_REG 0x1D
+#define REMCAP_AV_REG 0x1F
+#define FULLCAP_NOM_REG 0x23
+#define MISCCFG_REG 0x2B
+#define RCOMP_REG 0x38
+#define FSTAT_REG 0x3D
+#define DQACC_REG 0x45
+#define DPACC_REG 0x46
+#define OCV_REG 0xEE
+#define VFOCV_REG 0xFB
+#define VFSOC_REG 0xFF
+
+#define FG_LEVEL 0
+#define FG_TEMPERATURE 1
+#define FG_VOLTAGE 2
+#define FG_CURRENT 3
+#define FG_CURRENT_AVG 4
+#define FG_BATTERY_TYPE 5
+#define FG_CHECK_STATUS 6
+#define FG_VF_SOC 7
+#define FG_VOLTAGE_NOW 8
+
+#define LOW_BATT_COMP_RANGE_NUM 5
+#define LOW_BATT_COMP_LEVEL_NUM 2
+#define MAX_LOW_BATT_CHECK_CNT 10
+#define MAX17042_CURRENT_UNIT 15625 / 100000
+
+struct max17042_platform_data {
+ int sdi_capacity;
+ int sdi_vfcapacity;
+ int atl_capacity;
+ int atl_vfcapacity;
+ int sdi_low_bat_comp_start_vol;
+ int atl_low_bat_comp_start_vol;
+ int fuel_alert_line;
+
+ int (*check_jig_status) (void);
+};
+
+struct fuelgauge_info {
+ /* test print count */
+ int pr_cnt;
+ /* battery type */
+ int battery_type;
+ /* full charge comp */
+ u32 prev_fullcap;
+ u32 prev_vffcap;
+ u32 full_charged_cap;
+ /* capacity and vfcapacity */
+ u16 capacity;
+ u16 vfcapacity;
+ int soc_restart_flag;
+ /* cap corruption check */
+ u32 prev_repsoc;
+ u32 prev_vfsoc;
+ u32 prev_remcap;
+ u32 prev_mixcap;
+ u32 prev_fullcapacity;
+ u32 prev_vfcapacity;
+ u32 prev_vfocv;
+ /* low battery comp */
+ int low_batt_comp_cnt[LOW_BATT_COMP_RANGE_NUM][LOW_BATT_COMP_LEVEL_NUM];
+ int check_start_vol;
+ int low_batt_comp_flag;
+};
+
+struct max17042_chip {
+ struct i2c_client *client;
+ struct max17042_platform_data *pdata;
+ struct fuelgauge_info info;
+ struct mutex fg_lock;
+};
+
+/* Battery parameter */
+/* Current range for P2(not dependent on battery type */
+#if defined(CONFIG_MACH_P2)
+#define CURRENT_RANGE1 0
+#define CURRENT_RANGE2 -100
+#define CURRENT_RANGE3 -750
+#define CURRENT_RANGE4 -1250
+#define CURRENT_RANGE_MAX CURRENT_RANGE4
+#define CURRENT_RANGE_MAX_NUM 4
+/* SDI type low battery compensation offset */
+#define SDI_Range4_1_Offset 3320
+#define SDI_Range4_3_Offset 3410
+#define SDI_Range3_1_Offset 3451
+#define SDI_Range3_3_Offset 3454
+#define SDI_Range2_1_Offset 3461
+#define SDI_Range2_3_Offset 3544
+#define SDI_Range1_1_Offset 3456
+#define SDI_Range1_3_Offset 3536
+#define SDI_Range4_1_Slope 0
+#define SDI_Range4_3_Slope 0
+#define SDI_Range3_1_Slope 97
+#define SDI_Range3_3_Slope 27
+#define SDI_Range2_1_Slope 96
+#define SDI_Range2_3_Slope 134
+#define SDI_Range1_1_Slope 0
+#define SDI_Range1_3_Slope 0
+/* ATL type low battery compensation offset */
+#define ATL_Range5_1_Offset 3277
+#define ATL_Range5_3_Offset 3293
+#define ATL_Range4_1_Offset 3312
+#define ATL_Range4_3_Offset 3305
+#define ATL_Range3_1_Offset 3310
+#define ATL_Range3_3_Offset 3333
+#define ATL_Range2_1_Offset 3335
+#define ATL_Range2_3_Offset 3356
+#define ATL_Range1_1_Offset 3325
+#define ATL_Range1_3_Offset 3342
+#define ATL_Range5_1_Slope 0
+#define ATL_Range5_3_Slope 0
+#define ATL_Range4_1_Slope 30
+#define ATL_Range4_3_Slope 667
+#define ATL_Range3_1_Slope 20
+#define ATL_Range3_3_Slope 40
+#define ATL_Range2_1_Slope 60
+#define ATL_Range2_3_Slope 76
+#define ATL_Range1_1_Slope 0
+#define ATL_Range1_3_Slope 0
+#elif defined(CONFIG_MACH_P4NOTE) /* P4W battery parameter */
+/* Current range for P4W(not dependent on battery type */
+#define CURRENT_RANGE1 0
+#define CURRENT_RANGE2 -200
+#define CURRENT_RANGE3 -600
+#define CURRENT_RANGE4 -1500
+#define CURRENT_RANGE5 -2500
+#define CURRENT_RANGE_MAX CURRENT_RANGE5
+#define CURRENT_RANGE_MAX_NUM 5
+/* SDI type low battery compensation offset */
+#define SDI_Range5_1_Offset 3318
+#define SDI_Range5_3_Offset 3383
+#define SDI_Range4_1_Offset 3451
+#define SDI_Range4_3_Offset 3618
+#define SDI_Range3_1_Offset 3453
+#define SDI_Range3_3_Offset 3615
+#define SDI_Range2_1_Offset 3447
+#define SDI_Range2_3_Offset 3606
+#define SDI_Range1_1_Offset 3438
+#define SDI_Range1_3_Offset 3591
+#define SDI_Range5_1_Slope 0
+#define SDI_Range5_3_Slope 0
+#define SDI_Range4_1_Slope 53
+#define SDI_Range4_3_Slope 94
+#define SDI_Range3_1_Slope 54
+#define SDI_Range3_3_Slope 92
+#define SDI_Range2_1_Slope 45
+#define SDI_Range2_3_Slope 78
+#define SDI_Range1_1_Slope 0
+#define SDI_Range1_3_Slope 0
+/* Default value for build */
+/* ATL type low battery compensation offset */
+#define ATL_Range4_1_Offset 3298
+#define ATL_Range4_3_Offset 3330
+#define ATL_Range3_1_Offset 3375
+#define ATL_Range3_3_Offset 3445
+#define ATL_Range2_1_Offset 3371
+#define ATL_Range2_3_Offset 3466
+#define ATL_Range1_1_Offset 3362
+#define ATL_Range1_3_Offset 3443
+#define ATL_Range4_1_Slope 0
+#define ATL_Range4_3_Slope 0
+#define ATL_Range3_1_Slope 50
+#define ATL_Range3_3_Slope 77
+#define ATL_Range2_1_Slope 40
+#define ATL_Range2_3_Slope 111
+#define ATL_Range1_1_Slope 0
+#define ATL_Range1_3_Slope 0
+#elif defined(CONFIG_MACH_P8) || defined(CONFIG_MACH_P8LTE)
+/* Current range for P8(not dependent on battery type */
+#define CURRENT_RANGE1 0
+#define CURRENT_RANGE2 -200
+#define CURRENT_RANGE3 -600
+#define CURRENT_RANGE4 -1500
+#define CURRENT_RANGE5 -2500
+#define CURRENT_RANGE_MAX CURRENT_RANGE5
+#define CURRENT_RANGE_MAX_NUM 5
+/* SDI type low battery compensation Slope & Offset for 1% SOC range*/
+#define SDI_Range1_1_Slope 0
+#define SDI_Range2_1_Slope 54
+#define SDI_Range3_1_Slope 66
+#define SDI_Range4_1_Slope 69
+#define SDI_Range5_1_Slope 0
+
+#define SDI_Range1_1_Offset 3391
+#define SDI_Range2_1_Offset 3402
+#define SDI_Range3_1_Offset 3409
+#define SDI_Range4_1_Offset 3414
+#define SDI_Range5_1_Offset 3240
+
+/* SDI type low battery compensation Slope & Offset for 3% SOC range*/
+#define SDI_Range1_3_Slope 0
+#define SDI_Range2_3_Slope 92
+#define SDI_Range3_3_Slope 125
+#define SDI_Range4_3_Slope 110
+#define SDI_Range5_3_Slope 0
+
+#define SDI_Range1_3_Offset 3524
+#define SDI_Range2_3_Offset 3542
+#define SDI_Range3_3_Offset 3562
+#define SDI_Range4_3_Offset 3539
+#define SDI_Range5_3_Offset 3265
+
+/* ATL type low battery compensation offset */
+#define ATL_Range4_1_Offset 3298
+#define ATL_Range4_3_Offset 3330
+#define ATL_Range3_1_Offset 3375
+#define ATL_Range3_3_Offset 3445
+#define ATL_Range2_1_Offset 3371
+#define ATL_Range2_3_Offset 3466
+#define ATL_Range1_1_Offset 3362
+#define ATL_Range1_3_Offset 3443
+
+#define ATL_Range4_1_Slope 0
+#define ATL_Range4_3_Slope 0
+#define ATL_Range3_1_Slope 50
+#define ATL_Range3_3_Slope 77
+#define ATL_Range2_1_Slope 40
+#define ATL_Range2_3_Slope 111
+#define ATL_Range1_1_Slope 0
+#define ATL_Range1_3_Slope 0
+#else /* default value */
+/* Current range for default(not dependent on battery type */
+#define CURRENT_RANGE1 0
+#define CURRENT_RANGE2 -100
+#define CURRENT_RANGE3 -750
+#define CURRENT_RANGE4 -1250
+#define CURRENT_RANGE_MIN CURRENT_RANGE1
+#define CURRENT_RANGE_MAX CURRENT_RANGE4
+#define CURRENT_RANGE_MAX_NUM 4
+/* SDI type low battery compensation offset */
+#define SDI_Range4_1_Offset 3371
+#define SDI_Range4_3_Offset 3478
+#define SDI_Range3_1_Offset 3453
+#define SDI_Range3_3_Offset 3614
+#define SDI_Range2_1_Offset 3447
+#define SDI_Range2_3_Offset 3606
+#define SDI_Range1_1_Offset 3438
+#define SDI_Range1_3_Offset 3591
+#define SDI_Range4_1_Slope 0
+#define SDI_Range4_3_Slope 0
+#define SDI_Range3_1_Slope 50
+#define SDI_Range3_3_Slope 90
+#define SDI_Range2_1_Slope 50
+#define SDI_Range2_3_Slope 78
+#define SDI_Range1_1_Slope 0
+#define SDI_Range1_3_Slope 0
+/* ATL type low battery compensation offset */
+#define ATL_Range4_1_Offset 3298
+#define ATL_Range4_3_Offset 3330
+#define ATL_Range3_1_Offset 3375
+#define ATL_Range3_3_Offset 3445
+#define ATL_Range2_1_Offset 3371
+#define ATL_Range2_3_Offset 3466
+#define ATL_Range1_1_Offset 3362
+#define ATL_Range1_3_Offset 3443
+#define ATL_Range4_1_Slope 0
+#define ATL_Range4_3_Slope 0
+#define ATL_Range3_1_Slope 50
+#define ATL_Range3_3_Slope 77
+#define ATL_Range2_1_Slope 40
+#define ATL_Range2_3_Slope 111
+#define ATL_Range1_1_Slope 0
+#define ATL_Range1_3_Slope 0
+#endif
+
+enum {
+ POSITIVE = 0,
+ NEGATIVE,
+};
+
+enum {
+ UNKNOWN_TYPE = 0,
+ SDI_BATTERY_TYPE,
+ ATL_BATTERY_TYPE,
+};
+
+#ifdef CONFIG_MACH_P8LTE
+#define SEC_CURR_MEA_ADC_CH 6
+/*N.B. For a given battery type and aboard type both R_ISET and I_topOff
+are constant hence VtopOff = R_ISET * I_topOff should also be a constant
+under the given condns.
+Presently only implementing for P8-LTE, for other, consult with HW.
+For P8-LTE the limit is defined as 0.05C , where C is the battery capacity
+,5100mAh in this case.*/
+#define COUNT_TOP_OFF 3
+#define V_TOP_OFF 165 /* 200mA * 750ohms.(11_11_16) */
+/* #define V_TOP_OFF 208 *//* 250mA(default value) * 750ohms.(11_10_10) */
+#endif
+
+/* Temperature adjust value */
+#define SDI_TRIM1_1 122
+#define SDI_TRIM1_2 8950
+#define SDI_TRIM2_1 200
+#define SDI_TRIM2_2 51000
+
+void fg_periodic_read(void);
+
+extern int fg_reset_soc(void);
+extern int fg_reset_capacity(void);
+extern int fg_adjust_capacity(void);
+extern void fg_low_batt_compensation(u32 level);
+extern int fg_alert_init(void);
+extern void fg_fullcharged_compensation(u32 is_recharging, u32 pre_update);
+extern void fg_check_vf_fullcap_range(void);
+extern int fg_check_cap_corruption(void);
+extern void fg_set_full_charged(void);
+
+#endif
diff --git a/include/linux/power/max17042_fuelgauge_u1.h b/include/linux/power/max17042_fuelgauge_u1.h
new file mode 100644
index 0000000..9ce423d
--- /dev/null
+++ b/include/linux/power/max17042_fuelgauge_u1.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2009 Samsung Electronics
+ *
+ * based on max17040_battery.h
+ *
+ * <ms925.kim@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __MAX17042_BATTERY_H_
+#define __MAX17042_BATTERY_H_
+
+/*#define NO_READ_I2C_FOR_MAXIM */
+#if !defined(CONFIG_MACH_Q1_BD)
+#define RECAL_SOC_FOR_MAXIM
+#endif
+/*#define LOG_REG_FOR_MAXIM */
+#ifdef RECAL_SOC_FOR_MAXIM
+#define NO_NEED_RECAL_SOC_HW_REV 0x0b /*REV1.0 */
+#endif
+#ifdef LOG_REG_FOR_MAXIM
+#undef RECAL_SOC_FOR_MAXIM
+#endif
+
+#define MAX17042_REG_STATUS 0x00
+#define MAX17042_REG_VALRT_TH 0x01
+#define MAX17042_REG_TALRT_TH 0x02
+#define MAX17042_REG_SALRT_TH 0x03
+#define MAX17042_REG_VCELL 0x09
+#define MAX17042_REG_TEMPERATURE 0x08
+#define MAX17042_REG_AVGVCELL 0x19
+#define MAX17042_REG_CONFIG 0x1D
+#define MAX17042_REG_VERSION 0x21
+#define MAX17042_REG_LEARNCFG 0x28
+#define MAX17042_REG_FILTERCFG 0x29
+#define MAX17042_REG_MISCCFG 0x2B
+#define MAX17042_REG_CGAIN 0x2E
+#define MAX17042_REG_RCOMP 0x38
+#define MAX17042_REG_VFOCV 0xFB
+#define MAX17042_REG_SOC_VF 0xFF
+
+#define MAX17042_LONG_DELAY 2000
+#define MAX17042_SHORT_DELAY 0
+
+#define MAX17042_BATTERY_FULL 95
+
+#if defined(CONFIG_TARGET_LOCALE_KOR)
+#if defined(CONFIG_MACH_U1_KOR_LGT)
+#define MAX17042_NEW_RCOMP 0x0070
+#else
+#define MAX17042_NEW_RCOMP 0x0065
+#endif
+#endif
+
+struct max17042_reg_data {
+ u8 reg_addr;
+ u8 reg_data1;
+ u8 reg_data2;
+};
+
+struct max17042_platform_data {
+ int (*battery_online)(void);
+ int (*charger_online)(void);
+ int (*charger_enable)(void);
+ int (*low_batt_cb)(void);
+
+ struct max17042_reg_data *init;
+ int init_size;
+ struct max17042_reg_data *alert_init;
+ int alert_init_size;
+ int alert_gpio;
+ unsigned int alert_irq;
+
+ bool enable_current_sense;
+ bool enable_gauging_temperature;
+
+#ifdef RECAL_SOC_FOR_MAXIM
+ /*check need for re-calculation of soc */
+ bool (*need_soc_recal)(void);
+#endif
+};
+
+#endif
diff --git a/include/linux/power/max8922_charger_u1.h b/include/linux/power/max8922_charger_u1.h
new file mode 100644
index 0000000..058f77e
--- /dev/null
+++ b/include/linux/power/max8922_charger_u1.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * <ms925.kim@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __MAX8922_CHARGER_H_
+#define __MAX8922_CHARGER_H_ __FILE__
+
+struct max8922_platform_data {
+ int (*topoff_cb)(void);
+ int (*cfg_gpio)(void);
+ int gpio_chg_en;
+ int gpio_chg_ing;
+ int gpio_ta_nconnected;
+};
+
+#endif /* __MAX8922_CHARGER_H_ */
diff --git a/include/linux/power/sec_battery_px.h b/include/linux/power/sec_battery_px.h
new file mode 100644
index 0000000..6497f53
--- /dev/null
+++ b/include/linux/power/sec_battery_px.h
@@ -0,0 +1,75 @@
+/*
+ * sec_battery.h
+ * charger systems for lithium-ion (Li+) batteries
+ *
+ * Copyright (C) 2010 Samsung Electronics
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _LINUX_SEC_BATTERY_H
+#define _LINUX_SEC_BATTERY_H
+
+enum charger_type {
+ CHARGER_BATTERY = 0,
+ CHARGER_USB,
+ CHARGER_AC,
+ CHARGER_DOCK,
+ CHARGER_MISC,
+ CHARGER_DISCHARGE
+};
+
+struct max8903_charger_data {
+ int enable_line;
+ int connect_line;
+ int fullcharge_line;
+ int currentset_line;
+ int accessory_line;
+};
+
+struct sec_battery_platform_data {
+ struct max8903_charger_data charger;
+
+ void (*set_charging_state) (int, int);
+ int (*get_charging_state) (void);
+ void (*set_charging_current) (int);
+ int (*get_charging_current) (void);
+ int (*get_charger_is_full)(void);
+
+ void (*init_charger_gpio) (void);
+ void (*inform_charger_connection) (int);
+ int temp_high_threshold;
+ int temp_high_recovery;
+ int temp_low_recovery;
+ int temp_low_threshold;
+ int charge_duration;
+ int recharge_duration;
+ int recharge_voltage;
+ int (*check_lp_charging_boot) (void);
+ int (*check_jig_status) (void);
+
+};
+
+/* for test driver */
+#define __TEST_DEVICE_DRIVER__
+
+enum capacity_type {
+ CAPACITY_TYPE_FULL = 0,
+ CAPACITY_TYPE_MIX,
+ CAPACITY_TYPE_AV,
+ CAPACITY_TYPE_REP,
+};
+
+extern int low_batt_compensation(int fg_soc, int fg_vcell, int fg_current);
+extern void reset_low_batt_comp_cnt(void);
+extern int get_fuelgauge_value(int data);
+extern struct max17042_chip *max17042_chip_data;
+extern int get_fuelgauge_capacity(enum capacity_type type);
+
+#if defined(CONFIG_STMPE811_ADC)
+u16 stmpe811_get_adc_data(u8 channel);
+#endif
+
+#endif
diff --git a/include/linux/power/sec_battery_u1.h b/include/linux/power/sec_battery_u1.h
new file mode 100644
index 0000000..cbd635e
--- /dev/null
+++ b/include/linux/power/sec_battery_u1.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2010 Samsung Electronics, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __MACH_SEC_BATTERY_H
+#define __MACH_SEC_BATTERY_H __FILE__
+
+#if defined(CONFIG_TARGET_LOCALE_KOR)
+#if defined(CONFIG_MACH_U1_KOR_LGT)
+#define HWREV_FOR_BATTERY 0x03
+#else
+#define HWREV_FOR_BATTERY 0x06
+#endif
+#elif defined(CONFIG_TARGET_LOCALE_NTT)
+#define HWREV_FOR_BATTERY 0x0C
+#elif defined(CONFIG_MACH_U1_NA_SPR_EPIC2_REV00)
+#define HWREV_FOR_BATTERY 0x06
+#elif defined(CONFIG_MACH_Q1_BD)
+#define HWREV_FOR_BATTERY 0x02
+#elif defined(CONFIG_MACH_U1CAMERA_BD)
+#define HWREV_FOR_BATTERY 0x00
+#else /*U1 EUR OPEN */
+#define HWREV_FOR_BATTERY 0x08
+#endif
+
+/*soc level for 3.6V */
+#define SEC_BATTERY_SOC_3_6 7
+
+/* #define SEC_BATTERY_TOPOFF_BY_CHARGER */
+#define SEC_BATTERY_INDEPEDENT_VF_CHECK
+#if defined(CONFIG_MACH_Q1_BD)
+#define SEC_BATTERY_1ST_2ND_TOPOFF
+#endif
+
+/**
+ * struct sec_bat_adc_table_data - adc to temperature table for sec battery
+ * driver
+ * @adc: adc value
+ * @temperature: temperature(C) * 10
+ */
+struct sec_bat_adc_table_data {
+ int adc;
+ int temperature;
+};
+
+/**
+ * struct sec_bat_plaform_data - init data for sec batter driver
+ * @fuel_gauge_name: power supply name of fuel gauge
+ * @charger_name: power supply name of charger
+ * @sub_charger_name: power supply name of sub-charger
+ * @adc_table: array of adc to temperature data
+ * @adc_arr_size: size of adc_table
+ * @irq_topoff: IRQ number for top-off interrupt
+ * @irq_lowbatt: IRQ number for low battery alert interrupt
+ */
+struct sec_bat_platform_data {
+ char *fuel_gauge_name;
+ char *charger_name;
+ char *sub_charger_name;
+
+ unsigned int adc_arr_size;
+ struct sec_bat_adc_table_data *adc_table;
+ unsigned int adc_channel;
+ unsigned int adc_sub_arr_size;
+ struct sec_bat_adc_table_data *adc_sub_table;
+ unsigned int adc_sub_channel;
+ unsigned int (*get_lpcharging_state) (void);
+ void (*no_bat_cb) (void);
+ void (*initial_check) (void);
+#if defined(CONFIG_TARGET_LOCALE_NAATT)
+ int adc_vf_channel;
+#endif
+};
+
+#endif /* __MACH_SEC_BATTERY_H */
diff --git a/include/linux/power/smb136_charger.h b/include/linux/power/smb136_charger.h
new file mode 100644
index 0000000..a6414d8
--- /dev/null
+++ b/include/linux/power/smb136_charger.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ * Ikkeun Kim <iks.kim@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __SMB136_CHARGER_H_
+#define __SMB136_CHARGER_H_
+
+struct smb_charger_callbacks {
+ void (*set_charging_state) (int, int);
+ int (*get_charging_state) (void);
+ void (*set_charging_current) (int);
+ int (*get_charging_current) (void);
+};
+
+struct smb_charger_data {
+ void (*register_callbacks)(struct smb_charger_callbacks *);
+ void (*unregister_callbacks)(void);
+ int enable;
+ int stat;
+ int ta_nconnected;
+};
+
+#endif
diff --git a/include/linux/power/smb136_charger_q1.h b/include/linux/power/smb136_charger_q1.h
new file mode 100644
index 0000000..4658ef6
--- /dev/null
+++ b/include/linux/power/smb136_charger_q1.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ * Ikkeun Kim <iks.kim@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __SMB136_CHARGER_H_
+#define __SMB136_CHARGER_H_
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/err.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/irq.h>
+#include <linux/interrupt.h>
+#include <linux/i2c.h>
+#include <linux/power_supply.h>
+#include <linux/slab.h>
+#include <plat/gpio-cfg.h>
+#include <linux/power/sec_battery_u1.h>
+
+/* Slave address */
+#define SMB136_SLAVE_ADDR 0x9A
+
+/* SMB136 Registers. */
+#define SMB_ChargeCurrent 0x00
+#define SMB_InputCurrentLimit 0x01
+#define SMB_FloatVoltage 0x02
+#define SMB_ControlA 0x03
+#define SMB_ControlB 0x04
+#define SMB_PinControl 0x05
+#define SMB_OTGControl 0x06
+#define SMB_Fault 0x07
+#define SMB_Temperature 0x08
+#define SMB_SafetyTimer 0x09
+#define SMB_VSYS 0x0A
+#define SMB_I2CAddr 0x0B
+
+#define SMB_IRQreset 0x30
+#define SMB_CommandA 0x31
+#define SMB_StatusA 0x32
+#define SMB_StatusB 0x33
+#define SMB_StatusC 0x34
+#define SMB_StatusD 0x35
+#define SMB_StatusE 0x36
+#define SMB_StatusF 0x37
+#define SMB_StatusG 0x38
+#define SMB_StatusH 0x39
+#define SMB_DeviceID 0x3B
+#define SMB_CommandB 0x3C
+
+/* SMB_StatusC register bit. */
+#define SMB_USB 1
+#define SMB_CHARGER 0
+#define Compelete 1
+#define Busy 0
+#define InputCurrent275 0xE
+#define InputCurrent500 0xF
+#define InputCurrent700 0x0
+#define InputCurrent800 0x1
+#define InputCurrent900 0x2
+#define InputCurrent1000 0x3
+#define InputCurrent1100 0x4
+#define InputCurrent1200 0x5
+#define InputCurrent1300 0x6
+#define InputCurrent1400 0x7
+
+static enum power_supply_property smb136_charger_props[] = {
+ POWER_SUPPLY_PROP_CHARGE_TYPE,
+ POWER_SUPPLY_PROP_STATUS,
+ POWER_SUPPLY_PROP_ONLINE,
+ POWER_SUPPLY_PROP_CURRENT_NOW,
+};
+
+struct smb136_platform_data {
+ int (*topoff_cb)(void);
+#if defined(CONFIG_MACH_Q1_CHN) && defined(CONFIG_SMB136_CHARGER)
+ int (*ovp_cb)(bool);
+#endif
+ void (*set_charger_name)(void);
+ int gpio_chg_en;
+ int gpio_otg_en;
+ int gpio_chg_ing;
+ int gpio_ta_nconnected;
+};
+
+struct smb136_chip {
+ struct i2c_client *client;
+ struct power_supply charger;
+ struct smb136_platform_data *pdata;
+
+ bool is_enable;
+ int cable_type;
+};
+
+#endif
diff --git a/include/linux/power/smb328_charger.h b/include/linux/power/smb328_charger.h
new file mode 100644
index 0000000..c72e9f9
--- /dev/null
+++ b/include/linux/power/smb328_charger.h
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ * Ikkeun Kim <iks.kim@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __SMB328_CHARGER_H_
+#define __SMB328_CHARGER_H_
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/err.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/irq.h>
+#include <linux/interrupt.h>
+#include <linux/i2c.h>
+#include <linux/power_supply.h>
+#include <linux/slab.h>
+#include <plat/gpio-cfg.h>
+#include <linux/power/sec_battery_u1.h>
+
+/* Slave address */
+#define SMB328_SLAVE_ADDR 0x69
+
+/* Register define */
+#define SMB328A_INPUT_AND_CHARGE_CURRENTS 0x00
+#define SMB328A_CURRENT_TERMINATION 0x01
+#define SMB328A_FLOAT_VOLTAGE 0x02
+#define SMB328A_FUNCTION_CONTROL_A1 0x03
+#define SMB328A_FUNCTION_CONTROL_A2 0x04
+#define SMB328A_FUNCTION_CONTROL_B 0x05
+#define SMB328A_OTG_PWR_AND_LDO_CONTROL 0x06
+#define SMB328A_VARIOUS_CONTROL_FUNCTION_A 0x07
+#define SMB328A_CELL_TEMPERATURE_MONITOR 0x08
+#define SMB328A_INTERRUPT_SIGNAL_SELECTION 0x09
+#define SMB328A_I2C_BUS_SLAVE_ADDRESS 0x0A
+
+#define SMB328A_CLEAR_IRQ 0x30
+#define SMB328A_COMMAND 0x31
+#define SMB328A_INTERRUPT_STATUS_A 0x32
+#define SMB328A_BATTERY_CHARGING_STATUS_A 0x33
+#define SMB328A_INTERRUPT_STATUS_B 0x34
+#define SMB328A_BATTERY_CHARGING_STATUS_B 0x35
+#define SMB328A_BATTERY_CHARGING_STATUS_C 0x36
+#define SMB328A_INTERRUPT_STATUS_C 0x37
+#define SMB328A_BATTERY_CHARGING_STATUS_D 0x38
+#define SMB328A_AUTOMATIC_INPUT_CURRENT_LIMMIT_STATUS 0x39
+
+/* fast charging current defines */
+#define FAST_500mA 500
+#define FAST_600mA 600
+#define FAST_700mA 700
+#define FAST_800mA 800
+#define FAST_900mA 900
+#define FAST_1000mA 1000
+#define FAST_1100mA 1100
+#define FAST_1200mA 1200
+
+/* input current limit defines */
+#define ICL_275mA 275
+#define ICL_450mA 450
+#define ICL_600mA 600
+#define ICL_700mA 700
+#define ICL_800mA 800
+#define ICL_900mA 900
+#define ICL_1000mA 1000
+#define ICL_1100mA 1100
+#define ICL_1200mA 1200
+
+static enum power_supply_property smb328_charger_props[] = {
+ POWER_SUPPLY_PROP_CHARGE_TYPE,
+ POWER_SUPPLY_PROP_STATUS,
+ POWER_SUPPLY_PROP_ONLINE,
+ POWER_SUPPLY_PROP_CURRENT_NOW,
+};
+
+struct smb328_platform_data {
+ int (*topoff_cb)(void);
+#if defined(CONFIG_MACH_Q1_CHN) && defined(CONFIG_SMB328_CHARGER)
+ int (*ovp_cb)(bool);
+#endif
+ void (*set_charger_name)(void);
+ int gpio_chg_en;
+ int gpio_otg_en;
+ int gpio_chg_ing;
+ int gpio_ta_nconnected;
+};
+
+struct smb328_chip {
+ struct i2c_client *client;
+ struct power_supply charger;
+ struct smb328_platform_data *pdata;
+
+ bool is_otg;
+ bool is_enable;
+ int cable_type;
+};
+
+#endif
diff --git a/include/linux/power/smb347_charger.h b/include/linux/power/smb347_charger.h
new file mode 100755
index 0000000..0c35069
--- /dev/null
+++ b/include/linux/power/smb347_charger.h
@@ -0,0 +1,37 @@
+/*
+ * smb347_charger.c
+ *
+ * Copyright (C) 2011 Samsung Electronics
+ * SangYoung Son <hello.son@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __SMB347_CHARGER_H_
+#define __SMB347_CHARGER_H_
+
+struct smb_charger_callbacks {
+ void (*set_charging_state) (int, int);
+ int (*get_charging_state) (void);
+ void (*set_charging_current) (int);
+ int (*get_charging_current) (void);
+ int (*get_charger_is_full) (void);
+};
+
+struct smb_charger_data {
+ void (*register_callbacks)(struct smb_charger_callbacks *);
+ void (*unregister_callbacks)(void);
+ int enable;
+ int stat;
+ int ta_nconnected;
+};
+
+#endif
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 204c18d..6347fd9 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -14,6 +14,7 @@
#define __LINUX_POWER_SUPPLY_H__
#include <linux/device.h>
+#include <linux/wakelock.h>
#include <linux/workqueue.h>
#include <linux/leds.h>
@@ -53,6 +54,7 @@ enum {
POWER_SUPPLY_HEALTH_OVERVOLTAGE,
POWER_SUPPLY_HEALTH_UNSPEC_FAILURE,
POWER_SUPPLY_HEALTH_COLD,
+ POWER_SUPPLY_HEALTH_UNDERVOLTAGE,
};
enum {
@@ -130,6 +132,18 @@ enum power_supply_type {
POWER_SUPPLY_TYPE_USB_DCP, /* Dedicated Charging Port */
POWER_SUPPLY_TYPE_USB_CDP, /* Charging Downstream Port */
POWER_SUPPLY_TYPE_USB_ACA, /* Accessory Charger Adapters */
+ POWER_SUPPLY_TYPE_OTG,
+ POWER_SUPPLY_TYPE_DOCK,
+ POWER_SUPPLY_TYPE_MISC,
+ POWER_SUPPLY_TYPE_WIRELESS,
+};
+
+enum {
+ POWER_SUPPLY_VBUS_UNKNOWN = 0,
+ POWER_SUPPLY_VBUS_UVLO,
+ POWER_SUPPLY_VBUS_WEAK,
+ POWER_SUPPLY_VBUS_OVLO,
+ POWER_SUPPLY_VBUS_GOOD,
};
union power_supply_propval {
@@ -163,6 +177,9 @@ struct power_supply {
/* private */
struct device *dev;
struct work_struct changed_work;
+ spinlock_t changed_lock;
+ bool changed;
+ struct wake_lock work_wake_lock;
#ifdef CONFIG_LEDS_TRIGGERS
struct led_trigger *charging_full_trig;
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 033b507..fcda1b2 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)
}
#define RB_ROOT (struct rb_root) { NULL, }
+
+static inline void rb_root_init(struct rb_root *root, struct rb_node *node)
+{
+ root->rb_node = node;
+ if (node) {
+ node->rb_parent_color = RB_BLACK; /* black, no parent */
+ node->rb_left = NULL;
+ node->rb_right = NULL;
+ }
+}
+
#define rb_entry(ptr, type, member) container_of(ptr, type, member)
#define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL)
diff --git a/include/linux/rmi.h b/include/linux/rmi.h
new file mode 100644
index 0000000..903af82
--- /dev/null
+++ b/include/linux/rmi.h
@@ -0,0 +1,560 @@
+/*
+ * Copyright (c) 2011 Synaptics Incorporated
+ * Copyright (c) 2011 Unixphere
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#ifndef _RMI_H
+#define _RMI_H
+#include <linux/kernel.h>
+#include <linux/lockdep.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/device.h>
+#include <linux/cdev.h>
+#include <linux/mutex.h>
+#include <linux/stat.h>
+#include <linux/wait.h>
+#include <linux/list.h>
+#include <linux/interrupt.h>
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+#include <linux/earlysuspend.h>
+#endif
+
+
+/* Permissions for sysfs attributes. Since the permissions policy will change
+ * on a global basis in the future, rather than edit all sysfs attrs everywhere
+ * in the driver (and risk screwing that up in the process), we use this handy
+ * set of #defines. That way when we change the policy for sysfs permissions,
+ * we only need to change them here.
+ */
+#define RMI_RO_ATTR S_IRUGO
+#define RMI_RW_ATTR (S_IRUGO | S_IWUGO)
+#define RMI_WO_ATTR S_IWUGO
+
+#define SYNAPTICS_RMI_NAME "rmi-i2c"
+#define SYNAPTICS_RMI_ADDR 0x20
+
+#define PDT_START_SCAN_LOCATION 0x00e9
+
+enum rmi_attn_polarity {
+ RMI_ATTN_ACTIVE_LOW = 0,
+ RMI_ATTN_ACTIVE_HIGH = 1
+};
+
+/**
+ * struct rmi_f11_axis_alignmen - target axis alignment
+ * @swap_axes: set to TRUE if desired to swap x- and y-axis
+ * @flip_x: set to TRUE if desired to flip direction on x-axis
+ * @flip_y: set to TRUE if desired to flip direction on y-axis
+ */
+struct rmi_f11_2d_axis_alignment {
+ bool swap_axes;
+ bool flip_x;
+ bool flip_y;
+ int clip_X_low;
+ int clip_Y_low;
+ int clip_X_high;
+ int clip_Y_high;
+ int offset_X;
+ int offset_Y;
+ int rel_report_enabled;
+};
+
+struct rmi_f19_button_map {
+ unsigned char nbuttons;
+ unsigned char *map;
+};
+
+struct rmi_device_platform_data_spi {
+ int block_delay_us;
+ int split_read_block_delay_us;
+ int read_delay_us;
+ int write_delay_us;
+ int split_read_byte_delay_us;
+ int pre_delay_us;
+ int post_delay_us;
+
+ void *cs_assert_data;
+ int (*cs_assert) (const void *cs_assert_data, const bool assert);
+};
+
+struct rmi_device_platform_data {
+ char *driver_name;
+ char *sensor_name; /* Used for diagnostics. */
+
+ int attn_gpio;
+ enum rmi_attn_polarity attn_polarity;
+ void *gpio_data;
+ int (*gpio_config)(void *gpio_data, bool configure);
+
+ int reset_delay_ms;
+
+ struct rmi_device_platform_data_spi spi_data;
+
+ /* function handler pdata */
+ struct rmi_f11_2d_axis_alignment axis_align;
+ struct rmi_f19_button_map *button_map;
+
+#ifdef CONFIG_PM
+ void *pm_data;
+ int (*pre_suspend) (const void *pm_data);
+ int (*post_resume) (const void *pm_data);
+#endif
+ void (*hw_reset) (void);
+};
+
+/**
+ * struct rmi_function_descriptor - RMI function base addresses
+ * @query_base_addr: The RMI Query base address
+ * @command_base_addr: The RMI Command base address
+ * @control_base_addr: The RMI Control base address
+ * @data_base_addr: The RMI Data base address
+ * @interrupt_source_count: The number of irqs this RMI function needs
+ * @function_number: The RMI function number
+ *
+ * This struct is used when iterating the Page Description Table. The addresses
+ * are 16-bit values to include the current page address.
+ *
+ */
+struct rmi_function_descriptor {
+ u16 query_base_addr;
+ u16 command_base_addr;
+ u16 control_base_addr;
+ u16 data_base_addr;
+ u8 interrupt_source_count;
+ u8 function_number;
+ u8 function_version;
+};
+
+struct rmi_function_container;
+struct rmi_device;
+
+/**
+ * struct rmi_function_handler - an RMI function handler
+ * @func: The RMI function number
+ * @init: Callback for RMI function init
+ * @attention: Callback for RMI function attention
+ * @suspend: Callback for function suspend, returns 0 for success.
+ * @resume: Callback for RMI function resume, returns 0 for success.
+ * @remove: Callback for RMI function removal
+ *
+ * This struct describes the interface of an RMI function. These are
+ * registered to the bus using the rmi_register_function_driver() call.
+ *
+ */
+struct rmi_function_handler {
+ int func;
+ int (*init)(struct rmi_function_container *fc);
+ int (*config)(struct rmi_function_container *fc);
+ int (*reset)(struct rmi_function_container *fc);
+ int (*attention)(struct rmi_function_container *fc, u8 *irq_bits);
+#ifdef CONFIG_PM
+ int (*suspend)(struct rmi_function_container *fc);
+ int (*resume)(struct rmi_function_container *fc);
+#ifdef CONFIG_HAS_EARLYSUSPEND
+ int (*early_suspend)(struct rmi_function_container *fc);
+ int (*late_resume)(struct rmi_function_container *fc);
+#endif
+#endif
+ void (*remove)(struct rmi_function_container *fc);
+};
+
+/**
+ * struct rmi_function_container - an element in a function handler list
+ * @list: The list
+ * @fd: The function descriptor of the RMI function
+ * @rmi_dev: Pointer to the RMI device associated with this function container
+ * @fh: The callbacks connected to this function
+ * @num_of_irqs: The number of irqs needed by this function
+ * @irq_pos: The position in the irq bitfield this function holds
+ * @data: Private data pointer
+ *
+ */
+struct rmi_function_container {
+ struct list_head list;
+
+ struct rmi_function_descriptor fd;
+ struct rmi_device *rmi_dev;
+ struct rmi_function_handler *fh;
+ struct device dev;
+
+ int num_of_irqs;
+ int irq_pos;
+ u8 *irq_mask;
+
+ void *data;
+};
+#define to_rmi_function_container(d) \
+ container_of(d, struct rmi_function_container, dev);
+
+
+/**
+ * struct rmi_driver - represents an RMI driver
+ * @driver: Device driver model driver
+ * @probe: Callback for device probe
+ * @remove: Callback for device removal
+ * @shutdown: Callback for device shutdown
+ * @irq_handler: Callback for handling irqs
+ * @fh_add: Callback for function handler add
+ * @fh_remove: Callback for function handler remove
+ * @get_func_irq_mask: Callback for calculating interrupt mask
+ * @store_irq_mask: Callback for storing and replacing interrupt mask
+ * @restore_irq_mask: Callback for restoring previously stored interrupt mask
+ * @data: Private data pointer
+ *
+ * The RMI driver implements a driver on the RMI bus.
+ *
+ */
+struct rmi_driver {
+ struct device_driver driver;
+
+ int (*probe)(struct rmi_device *rmi_dev);
+ int (*remove)(struct rmi_device *rmi_dev);
+ void (*shutdown)(struct rmi_device *rmi_dev);
+ int (*irq_handler)(struct rmi_device *rmi_dev, int irq);
+ int (*reset_handler)(struct rmi_device *rmi_dev);
+ void (*fh_add)(struct rmi_device *rmi_dev,
+ struct rmi_function_handler *fh);
+ void (*fh_remove)(struct rmi_device *rmi_dev,
+ struct rmi_function_handler *fh);
+ u8* (*get_func_irq_mask)(struct rmi_device *rmi_dev,
+ struct rmi_function_container *fc);
+ int (*store_irq_mask)(struct rmi_device *rmi_dev, u8* new_interupts);
+ int (*restore_irq_mask)(struct rmi_device *rmi_dev);
+ void *data;
+};
+#define to_rmi_driver(d) \
+ container_of(d, struct rmi_driver, driver);
+
+/** struct rmi_phys_info - diagnostic information about the RMI physical
+ * device, used in the phys sysfs file.
+ * @proto String indicating the protocol being used.
+ * @tx_count Number of transmit operations.
+ * @tx_bytes Number of bytes transmitted.
+ * @tx_errs Number of errors encountered during transmit operations.
+ * @rx_count Number of receive operations.
+ * @rx_bytes Number of bytes received.
+ * @rx_errs Number of errors encountered during receive operations.
+ * @att_count Number of times ATTN assertions have been handled.
+ */
+struct rmi_phys_info {
+ char *proto;
+ long tx_count;
+ long tx_bytes;
+ long tx_errs;
+ long rx_count;
+ long rx_bytes;
+ long rx_errs;
+ long attn_count;
+};
+
+/**
+ * struct rmi_phys_device - represent an RMI physical device
+ * @dev: Pointer to the communication device, e.g. i2c or spi
+ * @rmi_dev: Pointer to the RMI device
+ * @write: Callback for write
+ * @write_block: Callback for writing a block of data
+ * @read: Callback for read
+ * @read_block: Callback for reading a block of data
+ * @data: Private data pointer
+ *
+ * The RMI physical device implements the glue between different communication
+ * buses such as I2C and SPI.
+ *
+ */
+struct rmi_phys_device {
+ struct device *dev;
+ struct rmi_device *rmi_dev;
+
+ int (*write)(struct rmi_phys_device *phys, u16 addr, u8 data);
+ int (*write_block)(struct rmi_phys_device *phys, u16 addr, u8 *buf,
+ int len);
+ int (*read)(struct rmi_phys_device *phys, u16 addr, u8 *buf);
+ int (*read_block)(struct rmi_phys_device *phys, u16 addr, u8 *buf,
+ int len);
+
+ int (*enable_device) (struct rmi_phys_device *phys);
+ void (*disable_device) (struct rmi_phys_device *phys);
+
+ void *data;
+
+ struct rmi_phys_info info;
+};
+
+/**
+ * struct rmi_device - represents an RMI device
+ * @dev: The device created for the RMI bus
+ * @number: Unique number for the device on the bus.
+ * @driver: Pointer to associated driver
+ * @phys: Pointer to the physical interface
+ * @early_suspend_handler: Pointers to early_suspend and late_resume, if
+ * configured.
+ *
+ * This structs represent an RMI device.
+ *
+ */
+struct rmi_device {
+ struct device dev;
+ int number;
+
+ struct rmi_driver *driver;
+ struct rmi_phys_device *phys;
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+ struct early_suspend early_suspend_handler;
+#endif
+};
+#define to_rmi_device(d) container_of(d, struct rmi_device, dev);
+#define to_rmi_platform_data(d) ((d)->phys->dev->platform_data);
+
+static inline void rmi_set_driverdata(struct rmi_device *d, void *data)
+{
+ dev_set_drvdata(&d->dev, data);
+}
+
+static inline void *rmi_get_driverdata(struct rmi_device *d)
+{
+ return dev_get_drvdata(&d->dev);
+}
+
+/**
+ * rmi_read - RMI read byte
+ * @d: Pointer to an RMI device
+ * @addr: The address to read from
+ * @buf: The read buffer
+ *
+ * Reads a byte of data using the underlaying physical protocol in to buf. It
+ * returns zero or a negative error code.
+ */
+static inline int rmi_read(struct rmi_device *d, u16 addr, u8 *buf)
+{
+ return d->phys->read(d->phys, addr, buf);
+}
+
+/**
+ * rmi_read_block - RMI read block
+ * @d: Pointer to an RMI device
+ * @addr: The start address to read from
+ * @buf: The read buffer
+ * @len: Length of the read buffer
+ *
+ * Reads a block of byte data using the underlaying physical protocol in to buf.
+ * It returns the amount of bytes read or a negative error code.
+ */
+static inline int rmi_read_block(struct rmi_device *d, u16 addr, u8 *buf,
+ int len)
+{
+ return d->phys->read_block(d->phys, addr, buf, len);
+}
+
+/**
+ * rmi_write - RMI write byte
+ * @d: Pointer to an RMI device
+ * @addr: The address to write to
+ * @data: The data to write
+ *
+ * Writes a byte from buf using the underlaying physical protocol. It
+ * returns zero or a negative error code.
+ */
+static inline int rmi_write(struct rmi_device *d, u16 addr, u8 data)
+{
+ return d->phys->write(d->phys, addr, data);
+}
+
+/**
+ * rmi_write_block - RMI write block
+ * @d: Pointer to an RMI device
+ * @addr: The start address to write to
+ * @buf: The write buffer
+ * @len: Length of the write buffer
+ *
+ * Writes a block of byte data from buf using the underlaying physical protocol.
+ * It returns the amount of bytes written or a negative error code.
+ */
+static inline int rmi_write_block(struct rmi_device *d, u16 addr, u8 *buf,
+ int len)
+{
+ return d->phys->write_block(d->phys, addr, buf, len);
+}
+
+/**
+ * rmi_register_driver - register rmi driver
+ * @driver: the driver to register
+ *
+ * This function registers an RMI driver to the RMI bus.
+ */
+int rmi_register_driver(struct rmi_driver *driver);
+
+/**
+ * rmi_unregister_driver - unregister rmi driver
+ * @driver: the driver to unregister
+ *
+ * This function unregisters an RMI driver to the RMI bus.
+ */
+void rmi_unregister_driver(struct rmi_driver *driver);
+
+/**
+ * rmi_register_phys_device - register a physical device connection
+ * @phys: the physical driver to register
+ *
+ * This function registers a physical driver to the RMI bus. These drivers
+ * provide a communication layer for the drivers connected to the bus, e.g.
+ * I2C, SPI and so on.
+ */
+int rmi_register_phys_device(struct rmi_phys_device *phys);
+
+/**
+ * rmi_unregister_phys_device - unregister a physical device connection
+ * @phys: the physical driver to unregister
+ *
+ * This function unregisters a physical driver from the RMI bus.
+ */
+void rmi_unregister_phys_device(struct rmi_phys_device *phys);
+
+/**
+ * rmi_register_function_driver - register an RMI function driver
+ * @fh: the function handler to register
+ *
+ * This function registers support for a new RMI function to the bus. All
+ * drivers on the bus will be notified of the presence of the new function
+ * driver.
+ */
+int rmi_register_function_driver(struct rmi_function_handler *fh);
+
+/**
+ * rmi_unregister_function_driver - unregister an RMI function driver
+ * @fh: the function handler to unregister
+ *
+ * This function unregisters a RMI function from the RMI bus. All drivers on
+ * the bus will be notified of the removal of a function driver.
+ */
+void rmi_unregister_function_driver(struct rmi_function_handler *fh);
+
+/**
+ * rmi_get_function_handler - get a pointer to specified RMI function
+ * @id: the RMI function id
+ *
+ * This function gets the specified RMI function handler from the list of
+ * supported functions.
+ */
+struct rmi_function_handler *rmi_get_function_handler(int id);
+
+
+struct rmi_char_device;
+
+/**
+ * rmi_char_driver - a general driver that doesn't handle specific functions,
+ * operating outside the bus::sensor::functions
+ * @match: returns 1 if the driver wants to talk to the specified rmi_dev.
+ *
+ * All of the above are optional except driver and init which are required.
+ *
+ */
+struct rmi_char_driver {
+ struct device_driver driver;
+
+ int (*match)(struct rmi_device *rmi_dev);
+ int (*init)(struct rmi_char_device *cd);
+ int (*attention)(struct rmi_char_device *cd, u8 *irq_bits);
+#ifdef CONFIG_PM
+ int (*suspend)(struct rmi_char_device *cd);
+ int (*resume)(struct rmi_char_device *cd);
+#ifdef CONFIG_HAS_EARLYSUSPEND
+ int (*early_suspend)(struct rmi_char_device *cd);
+ int (*late_resume)(struct rmi_char_device *cd);
+#endif
+#endif
+ void (*remove)(struct rmi_char_device *cd);
+
+ struct list_head devices;
+};
+
+struct rmi_char_device {
+ struct list_head list;
+
+ struct rmi_device *rmi_dev;
+ struct rmi_char_driver *driver;
+ struct device dev;
+
+ void *data;
+};
+#define to_rmi_char_device(d) \
+ container_of(d, struct rmi_char_device, dev)
+
+int rmi_register_character_driver(struct rmi_char_driver *char_driver);
+int rmi_unregister_character_driver(struct rmi_char_driver *char_driver);
+
+
+/* Helper fn to convert a byte array representing a short in the RMI
+ * endian-ness to a short in the native processor's specific endianness.
+ * We don't use ntohs/htons here because, well, we're not dealing with
+ * a pair of shorts. And casting dest to short* wouldn't work, because
+ * that would imply knowing the byte order of short in the first place.
+ */
+static inline void batohs(unsigned short *dest, unsigned char *src)
+{
+ *dest = src[1] * 0x100 + src[0];
+}
+
+/* Helper function to convert a short (in host processor endianess) to
+ * a byte array in the RMI endianess for shorts. See above comment for
+ * why we dont us htons or something like that.
+ */
+static inline void hstoba(unsigned char *dest, unsigned short src)
+{
+ dest[0] = src % 0x100;
+ dest[1] = src / 0x100;
+}
+
+/* Utility routine to handle writes to read-only attributes. Hopefully
+ * this will never happen, but if the user does something stupid, we don't
+ * want to accept it quietly (which is what can happen if you just put NULL
+ * for the attribute's store function).
+ */
+static inline ssize_t rmi_store_error(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ dev_warn(dev,
+ "RMI4 WARNING: Attempt to write %d characters to read-only "
+ "attribute %s.", count, attr->attr.name);
+ return -EPERM;
+}
+
+/* Utility routine to handle reads of write-only attributes. Hopefully
+ * this will never happen, but if the user does something stupid, we don't
+ * want to accept it quietly (which is what can happen if you just put NULL
+ * for the attribute's show function).
+ */
+static inline ssize_t rmi_show_error(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ dev_warn(dev,
+ "RMI4 WARNING: Attempt to read from write-only attribute %s.",
+ attr->attr.name);
+ return -EPERM;
+}
+
+/* utility function for bit access of u8*'s */
+void u8_set_bit(u8 *target, int pos);
+void u8_clear_bit(u8 *target, int pos);
+bool u8_is_set(u8 *target, int pos);
+bool u8_is_any_set(u8 *target, int size);
+void u8_or(u8 *dest, u8* target1, u8* target2, int size);
+void u8_and(u8 *dest, u8* target1, u8* target2, int size);
+#endif
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 93f4d03..ceeb53c 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -148,6 +148,9 @@ struct rtc_class_ops {
int (*set_time)(struct device *, struct rtc_time *);
int (*read_alarm)(struct device *, struct rtc_wkalrm *);
int (*set_alarm)(struct device *, struct rtc_wkalrm *);
+#if defined(CONFIG_RTC_ALARM_BOOT)
+ int (*set_alarm_boot)(struct device *, struct rtc_wkalrm *);
+#endif
int (*proc)(struct device *, struct seq_file *);
int (*set_mmss)(struct device *, unsigned long secs);
int (*read_callback)(struct device *, int data);
@@ -231,6 +234,10 @@ extern int rtc_read_alarm(struct rtc_device *rtc,
struct rtc_wkalrm *alrm);
extern int rtc_set_alarm(struct rtc_device *rtc,
struct rtc_wkalrm *alrm);
+#if defined(CONFIG_RTC_ALARM_BOOT)
+extern int rtc_set_alarm_boot(struct rtc_device *rtc,
+ struct rtc_wkalrm *alarm);
+#endif
extern int rtc_initialize_alarm(struct rtc_device *rtc,
struct rtc_wkalrm *alrm);
extern void rtc_update_irq(struct rtc_device *rtc,
@@ -278,6 +285,10 @@ extern int rtc_hctosys_ret;
#define rtc_hctosys_ret -ENODEV
#endif
+#if defined(CONFIG_RTC_ALARM_BOOT)
+extern unsigned int lpcharge;
+#endif
+
#endif /* __KERNEL__ */
#endif /* _LINUX_RTC_H_ */
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index 8d522ff..de17134 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -66,7 +66,7 @@ struct hrtimer_sleeper;
#define __RT_MUTEX_INITIALIZER(mutexname) \
{ .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \
- , .wait_list = PLIST_HEAD_INIT_RAW(mutexname.wait_list, mutexname.wait_lock) \
+ , .wait_list = PLIST_HEAD_INIT(mutexname.wait_list) \
, .owner = NULL \
__DEBUG_RT_MUTEX_INITIALIZER(mutexname)}
@@ -100,7 +100,7 @@ extern void rt_mutex_unlock(struct rt_mutex *lock);
#ifdef CONFIG_RT_MUTEXES
# define INIT_RT_MUTEXES(tsk) \
- .pi_waiters = PLIST_HEAD_INIT(tsk.pi_waiters, tsk.pi_lock), \
+ .pi_waiters = PLIST_HEAD_INIT(tsk.pi_waiters), \
INIT_RT_MUTEX_DEBUG(tsk)
#else
# define INIT_RT_MUTEXES(tsk)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 4ef452b..c4703f5 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -136,6 +136,7 @@ extern unsigned long total_forks;
extern int nr_threads;
DECLARE_PER_CPU(unsigned long, process_counts);
extern int nr_processes(void);
+extern unsigned long get_cpu_nr_running(unsigned int cpu);
extern unsigned long nr_running(void);
extern unsigned long nr_uninterruptible(void);
extern unsigned long nr_iowait(void);
@@ -1754,6 +1755,9 @@ static inline void put_task_struct(struct task_struct *t)
extern void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
extern void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st);
+extern int task_free_register(struct notifier_block *n);
+extern int task_free_unregister(struct notifier_block *n);
+
/*
* Per process flags
*/
@@ -1886,6 +1890,7 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask)
* Please use one of the three interfaces below.
*/
extern unsigned long long notrace sched_clock(void);
+extern unsigned long long notrace sched_clock_clksrc(void);
/*
* See the comment in kernel/sched_clock.c
*/
diff --git a/include/linux/sec_jack.h b/include/linux/sec_jack.h
new file mode 100644
index 0000000..5c12495
--- /dev/null
+++ b/include/linux/sec_jack.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2008 Samsung Electronics, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __ASM_ARCH_SEC_HEADSET_H
+#define __ASM_ARCH_SEC_HEADSET_H
+
+#ifdef __KERNEL__
+
+enum {
+ SEC_JACK_NO_DEVICE = 0x0,
+ SEC_HEADSET_4POLE = 0x01 << 0,
+ SEC_HEADSET_3POLE = 0x01 << 1,
+ SEC_TTY_DEVICE = 0x01 << 2,
+ SEC_FM_HEADSET = 0x01 << 3,
+ SEC_FM_SPEAKER = 0x01 << 4,
+ SEC_TVOUT_DEVICE = 0x01 << 5,
+ SEC_EXTRA_DOCK_SPEAKER = 0x01 << 6,
+ SEC_EXTRA_CAR_DOCK_SPEAKER = 0x01 << 7,
+ SEC_UNKNOWN_DEVICE = 0x01 << 8,
+};
+
+struct sec_jack_zone {
+ unsigned int adc_high;
+ unsigned int delay_ms;
+ unsigned int check_count;
+ unsigned int jack_type;
+};
+
+struct sec_jack_buttons_zone {
+ unsigned int code;
+ unsigned int adc_low;
+ unsigned int adc_high;
+};
+
+struct sec_jack_platform_data {
+ struct s3c_adc_client *padc;
+ void (*set_micbias_state) (bool);
+ struct sec_jack_zone *zones;
+ struct sec_jack_buttons_zone *buttons_zones;
+ int num_zones;
+ int num_buttons_zones;
+ int det_gpio;
+ int send_end_gpio;
+ bool det_active_high;
+ bool send_end_active_high;
+};
+
+#if defined(CONFIG_STMPE811_ADC)
+u16 stmpe811_get_adc_data(u8 channel);
+#endif
+
+#endif
+
+#endif
diff --git a/include/linux/sensor/ak8975.h b/include/linux/sensor/ak8975.h
new file mode 100644
index 0000000..79a5de4
--- /dev/null
+++ b/include/linux/sensor/ak8975.h
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2010 Samsung Electronics. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef AKM8975_H
+#define AKM8975_H
+
+#include <linux/ioctl.h>
+
+#define AKM8975_I2C_NAME "ak8975"
+
+/* Rx buffer size, i.e from ST1 to ST2 */
+#define SENSOR_DATA_SIZE 8
+#define AKMIO 0xA1
+
+/* IOCTLs for AKM library */
+/* WRITE and READ sizes don't include data. On WRITE, the first value is data
+ * size plus one and the second value is the register address. On READ
+ * the first value is the data size and second value is the register
+ * address and the data is written back into the buffer starting at
+ * the second byte (the length is unchanged).
+ */
+#define ECS_IOCTL_WRITE _IOW(AKMIO, 0x01, char*)
+#define ECS_IOCTL_READ _IOWR(AKMIO, 0x02, char*)
+#define ECS_IOCTL_RESET _IO(AKMIO, 0x03)
+#define ECS_IOCTL_SET_MODE _IOW(AKMIO, 0x04, short)
+#define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x05, \
+ char[SENSOR_DATA_SIZE])
+#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x06, short[12])
+#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x07, int)
+#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x08, int)
+#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, int64_t)
+#define ECS_IOCTL_GET_PROJECT_NAME _IOR(AKMIO, 0x0D, char[64])
+#define ECS_IOCTL_GET_MATRIX _IOR(AKMIO, 0x0E, short[4][3][3])
+
+/* IOCTLs for APPs */
+#define ECS_IOCTL_APP_SET_MODE _IOW(AKMIO, 0x10, short)
+#define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short)
+#define ECS_IOCTL_APP_GET_MFLAG _IOR(AKMIO, 0x12, short)
+#define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short)
+#define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short)
+#define ECS_IOCTL_APP_SET_TFLAG _IOW(AKMIO, 0x15, short)
+#define ECS_IOCTL_APP_GET_TFLAG _IOR(AKMIO, 0x16, short)
+#define ECS_IOCTL_APP_RESET_PEDOMETER _IO(AKMIO, 0x17)
+#define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, int64_t)
+#define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY
+
+/* Set raw magnetic vector flag */
+#define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short)
+
+/* Get raw magnetic vector flag */
+#define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short)
+
+#ifdef __KERNEL__
+struct akm8975_platform_data {
+ int gpio_data_ready_int;
+};
+#endif
+
+#endif
diff --git a/include/linux/sensor/bh1721.h b/include/linux/sensor/bh1721.h
new file mode 100644
index 0000000..d7a684e
--- /dev/null
+++ b/include/linux/sensor/bh1721.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2010 Samsung Electronics. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+#ifndef _BH1721FVC_H_
+#define _BH1721FVC_H_
+
+#include <linux/types.h>
+
+struct bh1721fvc_platform_data {
+ int (*reset)(void);
+ int (*output)(int);
+};
+
+#endif
diff --git a/include/linux/sensor/cm3663.h b/include/linux/sensor/cm3663.h
new file mode 100644
index 0000000..07cf3c7
--- /dev/null
+++ b/include/linux/sensor/cm3663.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2010 Samsung Electronics. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+
+#ifndef __LINUX_CM3663_H
+#define __LINUX_CM3663_H
+
+#include <linux/types.h>
+
+#ifdef __KERNEL__
+struct cm3663_platform_data {
+ int (*proximity_power)(bool); /* ldo power for the proximity */
+};
+#endif /* __KERNEL__ */
+
+#endif
diff --git a/include/linux/sensor/cm36651.h b/include/linux/sensor/cm36651.h
new file mode 100644
index 0000000..3dce9ac
--- /dev/null
+++ b/include/linux/sensor/cm36651.h
@@ -0,0 +1,11 @@
+#ifndef __LINUX_CM36651_H
+#define __CM36651_H__
+
+#ifdef __KERNEL__
+struct cm36651_platform_data {
+ int (*cm36651_led_on) (bool);
+ u8 (*cm36651_get_threshold)(void);
+ int irq; /* proximity-sensor irq gpio */
+};
+#endif
+#endif
diff --git a/include/linux/sensor/gp2a.h b/include/linux/sensor/gp2a.h
new file mode 100644
index 0000000..7900203
--- /dev/null
+++ b/include/linux/sensor/gp2a.h
@@ -0,0 +1,68 @@
+#ifndef __GP2A_H__
+#define __GP2A_H__
+
+#define I2C_M_WR 0 /* for i2c Write */
+#define I2c_M_RD 1 /* for i2c Read */
+
+#define I2C_DF_NOTIFY 0x01 /* for i2c */
+
+/* Registers */
+#define COMMAND1 0x00
+#define COMMAND2 0x01 /* Read&Write */
+#define COMMAND3 0x02 /* Read&Write */
+#define COMMAND4 0x03 /* Read&Write */
+#define INT_LT_LSB 0x04 /* Read&Write */
+#define INT_LT_MSB 0x05 /* Read&Write */
+#define INT_HT_LSB 0x06 /* Read&Write */
+#define INT_HT_MSB 0x07 /* Read&Write */
+#define PS_LT_LSB 0x08 /* Read&Write */
+#define PS_LT_MSB 0x09 /* Read&Write */
+#define PS_HT_LSB 0x0A /* Read&Write */
+#define PS_HT_MSB 0x0B /* Read&Write */
+#define DATA0_LSB 0x0C /* Read Only */
+#define DATA0_MSB 0x0D /* Read Only */
+#define DATA1_LSB 0x0E /* Read Only */
+#define DATA1_MSB 0x0F /* Read Only */
+#define DATA2_LSB 0x10 /* Read Only */
+#define DATA2_MSB 0x11 /* Read Only */
+
+#define ADC_BUFFER_NUM 6
+
+/* 16 level for premium model*/
+enum {
+ LIGHT_DIM = 0,
+ LIGHT_LEVEL1 = 1,
+ LIGHT_LEVEL2 = 2,
+ LIGHT_LEVEL3 = 3,
+ LIGHT_LEVEL4 = 4,
+ LIGHT_LEVEL5 = 5,
+ LIGHT_LEVEL6 = 6,
+ LIGHT_LEVEL7 = 7,
+ LIGHT_LEVEL8 = 8,
+ LIGHT_LEVEL9 = 9,
+ LIGHT_LEVEL10 = 10,
+ LIGHT_LEVEL11 = 11,
+ LIGHT_LEVEL12 = 12,
+ LIGHT_LEVEL13 = 13,
+ LIGHT_LEVEL14 = 14,
+ LIGHT_LEVEL15 = 15,
+ LIGHT_LEVEL16 = 16,
+ LIGHT_INIT = 17,
+};
+
+/* extern variables */
+extern u8 lightsensor_mode; /* 0 = low, 1 = high */
+extern int proximity_enable;
+extern char proximity_sensor_detection;
+
+/* prototype */
+int opt_i2c_read(u8 reg, unsigned char *rbuf, int len);
+int opt_i2c_write(u8 reg, u8 *val);
+int lightsensor_get_adcvalue(void);
+int is_gp2a030a(void);
+
+struct gp2a_platform_data {
+ int (*gp2a_led_on) (bool);
+ int p_out; /* proximity-sensor-output gpio */
+};
+#endif
diff --git a/include/linux/sensor/gp2a_analog.h b/include/linux/sensor/gp2a_analog.h
new file mode 100644
index 0000000..3d038bc
--- /dev/null
+++ b/include/linux/sensor/gp2a_analog.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2010 Samsung Electronics. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+
+#ifndef __LINUX_GP2A_H
+#define __LINUX_GP2A_H
+
+#include <linux/types.h>
+
+#ifdef __KERNEL__
+#define GP2A_OPT "gp2a-opt"
+struct gp2a_platform_data {
+ int p_out; /* proximity-sensor-output gpio */
+ int (*power)(bool); /* power to the chip */
+};
+#endif /* __KERNEL__ */
+
+#endif
diff --git a/include/linux/sensor/k3dh.h b/include/linux/sensor/k3dh.h
new file mode 100644
index 0000000..2c2ad0d
--- /dev/null
+++ b/include/linux/sensor/k3dh.h
@@ -0,0 +1,41 @@
+/*
+ * STMicroelectronics k3dh acceleration sensor driver
+ *
+ * Copyright (C) 2010 Samsung Electronics Co.Ltd
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __K3DH_ACC_HEADER__
+#define __K3DH__ACC_HEADER__
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+extern struct class *sec_class;
+
+struct k3dh_acceldata {
+ __s16 x;
+ __s16 y;
+ __s16 z;
+};
+
+/* dev info */
+#define ACC_DEV_NAME "accelerometer"
+
+/* k3dh ioctl command label */
+#define K3DH_IOCTL_BASE 'a'
+#define K3DH_IOCTL_SET_DELAY _IOW(K3DH_IOCTL_BASE, 0, int64_t)
+#define K3DH_IOCTL_GET_DELAY _IOR(K3DH_IOCTL_BASE, 1, int64_t)
+#define K3DH_IOCTL_READ_ACCEL_XYZ _IOR(K3DH_IOCTL_BASE, 8, \
+ struct k3dh_acceldata)
+#define K3DH_IOCTL_SET_ENABLE _IOW(K3DH_IOCTL_BASE, 9, int)
+#endif
diff --git a/include/linux/sensor/k3g.h b/include/linux/sensor/k3g.h
new file mode 100644
index 0000000..66eb2c9
--- /dev/null
+++ b/include/linux/sensor/k3g.h
@@ -0,0 +1,40 @@
+/*
+ * STMicroelectronics K3G gyro sensor header file
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * THE PRESENT SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES
+ * OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, FOR THE SOLE
+ * PURPOSE TO SUPPORT YOUR APPLICATION DEVELOPMENT.
+ * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
+ * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
+ * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
+ *
+ * THIS SOFTWARE IS SPECIFICALLY DESIGNED FOR EXCLUSIVE USE WITH ST PARTS.
+ *
+ */
+
+#ifndef __K3G_H__
+#define __K3G_H__
+
+#ifdef __KERNEL__
+struct k3g_platform_data {
+ u8 fs_range;
+ u8 axis_map_x;
+ u8 axis_map_y;
+ u8 axis_map_z;
+ u8 negate_x;
+ u8 negate_y;
+ u8 negate_z;
+ int (*init)(void);
+ void (*exit)(void);
+ int (*power_on)(void);
+ int (*power_off)(void);
+};
+
+#endif /* __KERNEL__ */
+
+#endif /* __K3G_H__ */
diff --git a/include/linux/sensor/lps331ap.h b/include/linux/sensor/lps331ap.h
new file mode 100644
index 0000000..6ecae61
--- /dev/null
+++ b/include/linux/sensor/lps331ap.h
@@ -0,0 +1,84 @@
+/*
+* linux/sensor/lps331ap.h
+*
+* STMicroelectronics LPS331AP Pressure / Temperature Sensor module driver
+*
+* Copyright (C) 2010 STMicroelectronics- MSH - Motion Mems BU - Application Team
+* Matteo Dameno (matteo.dameno@st.com)
+* Carmine Iascone (carmine.iascone@st.com)
+*
+* Both authors are willing to be considered the contact and update points for
+* the driver.
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of the GNU General Public License
+* version 2 as published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA
+*
+*/
+/******************************************************************************
+ Revision 1.0.0 2011/Feb/14:
+ first release
+ moved to input/misc
+ Revision 1.0.1 2011/Apr/04:
+ xxx
+ Revision 1.0.2 2011/Sep/15:
+ corrects ord bug, forces BDU enable
+ Revision 1.0.3 2011/Sep/15:
+ introduces compansation params reading and sysfs file to get them
+ Revision 1.0.4 2011/Dec/12:
+ sets maximum allowable resolution modes dynamically with ODR;
+ Revision 1.0.5 2012/Feb/29:
+ introduces more compansation params and extends sysfs file content
+ format to get them; reduces minimum polling period define;
+ Revision 1.0.6 2012/Mar/30:
+ introduces one more compansation param and extends sysfs file content
+ format to get it.
+******************************************************************************/
+
+#ifndef __LPS331AP_H__
+#define __LPS331AP_H__
+
+#define LPS331AP_PRS_MIN_POLL_PERIOD_MS 40
+
+#define SAD0L 0x00
+#define SAD0H 0x01
+#define LPS331AP_PRS_I2C_SADROOT 0x2E
+#define LPS331AP_PRS_I2C_SAD_L ((LPS331AP_PRS_I2C_SADROOT<<1)|SAD0L)
+#define LPS331AP_PRS_I2C_SAD_H ((LPS331AP_PRS_I2C_SADROOT<<1)|SAD0H)
+#define LPS331AP_PRS_DEV_NAME "lps331ap"
+
+/* Barometer and Termometer output data rate ODR */
+#define LPS331AP_PRS_ODR_ONESH 0x00 /* one shot both */
+#define LPS331AP_PRS_ODR_1_1 0x10 /* 1 Hz baro, 1 Hz term ODR */
+#define LPS331AP_PRS_ODR_7_7 0x50 /* 7 Hz baro, 7 Hz term ODR */
+#define LPS331AP_PRS_ODR_12_12 0x60 /* 12.5Hz baro, 12.5Hz term ODR */
+#define LPS331AP_PRS_ODR_25_25 0x70 /* 25 Hz baro, 25 Hz term ODR */
+
+/* Pressure section defines */
+/* Pressure Sensor Operating Mode */
+#define LPS331AP_PRS_ENABLE 0x01
+#define LPS331AP_PRS_DISABLE 0x00
+
+/* Output conversion factors */
+#define SENSITIVITY_T 480 /* = 480 LSB/degrC */
+#define SENSITIVITY_P 4096 /* = LSB/mbar */
+#define SENSITIVITY_P_SHIFT 12 /* = 4096 LSB/mbar */
+#define TEMPERATURE_OFFSET 42.5f /* = 42.5 degrC */
+
+#ifdef __KERNEL__
+struct lps331ap_platform_data {
+ int irq;
+};
+#endif /* __KERNEL__ */
+
+#endif /* __LPS331AP_H__ */
diff --git a/include/linux/sensor/lsm330dlc_accel.h b/include/linux/sensor/lsm330dlc_accel.h
new file mode 100644
index 0000000..b011f84
--- /dev/null
+++ b/include/linux/sensor/lsm330dlc_accel.h
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2011, Samsung Electronics Co. Ltd. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __LSM330DLC_ACCEL_HEADER__
+#define __LSM330DLC_ACCEL_HEADER__
+
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
+/*lsm330dlc_accel registers */
+#define STATUS_AUX 0x07
+#define OUT_1_L 0x08
+#define OUT_1_H 0x09
+#define OUT_2_L 0x0A
+#define OUT_2_H 0x0B
+#define OUT_3_L 0x0C
+#define OUT_3_H 0x0D
+#define INT_COUNTER 0x0E
+#define WHO_AM_I 0x0F
+#define TEMP_CFG_REG 0x1F
+#define CTRL_REG1 0x20 /* power control reg */
+#define CTRL_REG2 0x21 /* power control reg */
+#define CTRL_REG3 0x22 /* power control reg */
+#define CTRL_REG4 0x23 /* interrupt control reg */
+#define CTRL_REG5 0x24 /* interrupt control reg */
+#define CTRL_REG6 0x25
+#define REFERENCE 0x26
+#define STATUS_REG 0x27
+#define OUT_X_L 0x28
+#define OUT_X_H 0x29
+#define OUT_Y_L 0x2A
+#define OUT_Y_H 0x2B
+#define OUT_Z_L 0x2C
+#define OUT_Z_H 0x2D
+#define FIFO_CTRL_REG 0x2E
+#define FIFO_SRC_REG 0x2F
+#define INT1_CFG 0x30
+#define INT1_SRC 0x31
+#define INT1_THS 0x32
+#define INT1_DURATION 0x33
+#define INT2_CFG 0x34
+#define INT2_SRC 0x35
+#define INT2_THS 0x36
+#define INT2_DURATION 0x37
+#define CLICK_CFG 0x38
+#define CLICK_SRC 0x39
+#define CLICK_THS 0x3A
+#define TIME_LIMIT 0x3B
+#define TIME_LATENCY 0x3C
+#define TIME_WINDOW 0x3D
+
+/* CTRL_REG1 */
+#define CTRL_REG1_ODR3 (1 << 7)
+#define CTRL_REG1_ODR2 (1 << 6)
+#define CTRL_REG1_ODR1 (1 << 5)
+#define CTRL_REG1_ODR0 (1 << 4)
+#define CTRL_REG1_LPEN (1 << 3)
+#define CTRL_REG1_Zen (1 << 2)
+#define CTRL_REG1_Yen (1 << 1)
+#define CTRL_REG1_Xen (1 << 0)
+
+#define PM_OFF 0x00
+#define LOW_PWR_MODE 0x4F /* 50HZ */
+#define FASTEST_MODE 0x9F /* 1344Hz */
+#define ENABLE_ALL_AXES 0x07
+
+#define ODR1 0x10 /* 1Hz output data rate */
+#define ODR10 0x20 /* 10Hz output data rate */
+#define ODR25 0x30 /* 25Hz output data rate */
+#define ODR50 0x40 /* 50Hz output data rate */
+#define ODR100 0x50 /* 100Hz output data rate */
+#define ODR200 0x60 /* 100Hz output data rate */
+#define ODR400 0x70 /* 400Hz output data rate */
+#define ODR1344 0x90 /* 1344Hz output data rate */
+#define ODR_MASK 0xf0
+
+/* CTRL_REG2 */
+#define CTRL_REG2_HPM1 (1 << 7)
+#define CTRL_REG2_HPM0 (1 << 6)
+#define CTRL_REG2_HPCF2 (1 << 5)
+#define CTRL_REG2_HPCF1 (1 << 4)
+#define CTRL_REG2_FDS (1 << 3)
+#define CTRL_REG2_HPPCLICK (1 << 2)
+#define CTRL_REG2_HPIS2 (1 << 1)
+#define CTRL_REG2_HPIS1 (1 << 0)
+
+#define HPM_Normal (CTRL_REG2_HPM1)
+#define HPM_Filter (CTRL_REG2_HPM0)
+
+/* CTRL_REG3 */
+#define I1_CLICK (1 << 7)
+#define I1_AOI1 (1 << 6)
+#define I1_AOI2 (1 << 5)
+#define I1_DRDY1 (1 << 4)
+#define I1_DRDY2 (1 << 3)
+#define I1_WTM (1 << 2)
+#define I1_OVERRUN (1 << 1)
+
+/* CTRL_REG4 */
+#define CTRL_REG4_BLE (1 << 6)
+#define CTRL_REG4_FS1 (1 << 5)
+#define CTRL_REG4_FS0 (1 << 4)
+#define CTRL_REG4_HR (1 << 3)
+#define CTRL_REG4_ST1 (1 << 2)
+#define CTRL_REG4_ST0 (1 << 1)
+#define CTRL_REG4_SIM (1 << 0)
+
+#define FS2g 0x00
+#define FS4g (CTRL_REG4_FS0)
+#define FS8g (CTRL_REG4_FS1)
+#define FS16g (CTRL_REG4_FS1|CTRL_REG4_FS0)
+
+/* CTRL_REG5 */
+#define BOOT (1 << 7)
+#define FIFO_EN (1 << 6)
+#define LIR_INT1 (1 << 3)
+#define D4D_INT1 (1 << 2)
+
+/* STATUS_REG */
+#define ZYXOR (1 << 7)
+#define ZOR (1 << 6)
+#define YOR (1 << 5)
+#define XOR (1 << 4)
+#define ZYXDA (1 << 3)
+#define ZDA (1 << 2)
+#define YDA (1 << 1)
+#define XDA (1 << 0)
+
+/* INT1_CFG */
+#define INT_CFG_AOI (1 << 7)
+#define INT_CFG_6D (1 << 6)
+#define INT_CFG_ZHIE (1 << 5)
+#define INT_CFG_ZLIE (1 << 4)
+#define INT_CFG_YHIE (1 << 3)
+#define INT_CFG_YLIE (1 << 2)
+#define INT_CFG_XHIE (1 << 1)
+#define INT_CFG_XLIE (1 << 0)
+
+/* INT1_SRC */
+#define IA (1 << 6)
+#define ZH (1 << 5)
+#define ZL (1 << 4)
+#define YH (1 << 3)
+#define YL (1 << 2)
+#define XH (1 << 1)
+#define XL (1 << 0)
+
+/* Register Auto-increase */
+#define AC (1 << 7)
+
+/* dev info */
+#define ACC_DEV_NAME "accelerometer"
+
+struct lsm330dlc_acc {
+ s16 x;
+ s16 y;
+ s16 z;
+};
+
+/* For movement recognition*/
+#define USES_MOVEMENT_RECOGNITION
+
+/* LSM330DLC_ACCEL ioctl command label */
+#define LSM330DLC_ACCEL_IOCTL_BASE 'a'
+#define LSM330DLC_ACCEL_IOCTL_SET_DELAY \
+ _IOW(LSM330DLC_ACCEL_IOCTL_BASE, 0, int64_t)
+#define LSM330DLC_ACCEL_IOCTL_GET_DELAY \
+ _IOR(LSM330DLC_ACCEL_IOCTL_BASE, 1, int64_t)
+#define LSM330DLC_ACCEL_IOCTL_READ_XYZ\
+ _IOR(LSM330DLC_ACCEL_IOCTL_BASE, 8, struct lsm330dlc_acc)
+#define LSM330DLC_ACCEL_IOCTL_SET_ENABLE \
+ _IOW(LSM330DLC_ACCEL_IOCTL_BASE, 9, int)
+#endif
diff --git a/include/linux/sensor/lsm330dlc_gyro.h b/include/linux/sensor/lsm330dlc_gyro.h
new file mode 100644
index 0000000..12a702c
--- /dev/null
+++ b/include/linux/sensor/lsm330dlc_gyro.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2011, Samsung Electronics Co. Ltd. All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __L3GD20_H__
+#define __L3GD20_H__
+
+#define LSM330DLC_GYRO_DEV_NAME "lsm330dlc_gyro"
+#define L3GD20_GYR_INPUT_NAME "gyro_sensor"
+#define GYR_DEV_FILE_NAME "lsm330dlc_gyro_misc"
+
+#define LSM330DLC_GYRO_IOCTL_BASE 80
+#define LSM330DLC_GYRO_IOCTL_SET_DELAY\
+ _IOW(LSM330DLC_GYRO_IOCTL_BASE, 0, int64_t)
+#define LSM330DLC_GYRO_IOCTL_GET_DELAY\
+ _IOR(LSM330DLC_GYRO_IOCTL_BASE, 1, int64_t)
+#define LSM330DLC_GYRO_IOCTL_READ_DATA_XYZ\
+ _IOR(LSM330DLC_GYRO_IOCTL_BASE, 2, int)
+#endif /* __L3GD20_H__ */
diff --git a/include/linux/sensor/pas2m110.h b/include/linux/sensor/pas2m110.h
new file mode 100644
index 0000000..705d909
--- /dev/null
+++ b/include/linux/sensor/pas2m110.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2010 Samsung Electronics. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+
+#ifndef __LINUX_PAS2M110_H
+#define __LINUX_PAS2M110_H
+
+#include <linux/types.h>
+
+#ifdef __KERNEL__
+struct pas2m110_platform_data {
+ int (*proximity_power)(bool); /* ldo power for the proximity */
+};
+#endif /* __KERNEL__ */
+
+#endif
diff --git a/include/linux/sensor/sensors_core.h b/include/linux/sensor/sensors_core.h
new file mode 100644
index 0000000..ef90dd9
--- /dev/null
+++ b/include/linux/sensor/sensors_core.h
@@ -0,0 +1,25 @@
+/*
+ * Driver model for sensor
+ *
+ * Copyright (C) 2008 Samsung Electronics
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+#ifndef __LINUX_SENSORS_CORE_H_INCLUDED
+#define __LINUX_SENSORS_CORE_H_INCLUDED
+
+extern struct device *sensors_classdev_register(char *sensors_name);
+extern void sensors_classdev_unregister(struct device *dev);
+
+struct accel_platform_data {
+ int (*accel_get_position) (void);
+ /* Change axis or not for user-level
+ * If it is true, driver reports adjusted axis-raw-data
+ * to user-space based on accel_get_position() value,
+ * or if it is false, driver reports original axis-raw-data */
+ bool axis_adjust;
+};
+#endif /* __LINUX_SENSORS_CORE_H_INCLUDED */
diff --git a/include/linux/sensor/taos.h b/include/linux/sensor/taos.h
new file mode 100644
index 0000000..a48876e
--- /dev/null
+++ b/include/linux/sensor/taos.h
@@ -0,0 +1,146 @@
+#ifndef __TAOS_H__
+#define __TAOS_H__
+
+
+/* i2c */
+#define I2C_M_WR 0 /* for i2c */
+#define I2c_M_RD 1 /* for i2c */
+
+/* sensor gpio */
+#define GPIO_SENSE_OUT 27
+
+
+#define REGS_PROX 0x0 /* Read Only */
+#define REGS_GAIN 0x1 /* Write Only */
+#define REGS_HYS 0x2 /* Write Only */
+#define REGS_CYCLE 0x3 /* Write Only */
+#define REGS_OPMOD 0x4 /* Write Only */
+#define REGS_CON 0x6 /* Write Only */
+
+/* sensor type */
+#define TAOS_LIGHT 0
+#define TAOS_PROXIMITY 1
+#define TAOS_ALL 2
+
+/* power control */
+#define ON 1
+#define OFF 0
+
+/* IOCTL for proximity sensor */
+#define SHARP_TAOSP_IOC_MAGIC 'C'
+#define SHARP_TAOSP_OPEN _IO(SHARP_TAOSP_IOC_MAGIC, 1)
+#define SHARP_TAOSP_CLOSE _IO(SHARP_TAOSP_IOC_MAGIC, 2)
+
+/* IOCTL for light sensor */
+#define SHARP_TAOSL_IOC_MAGIC 'L'
+#define SHARP_TAOSL_OPEN _IO(SHARP_TAOSL_IOC_MAGIC, 1)
+#define SHARP_TAOSL_CLOSE _IO(SHARP_TAOSL_IOC_MAGIC, 2)
+
+#define MAX_LUX 65535
+/* for proximity adc avg */
+#define PROX_READ_NUM 40
+#define TAOS_PROX_MAX 1023
+#define TAOS_PROX_MIN 0
+
+/* input device for proximity sensor */
+#define USE_INPUT_DEVICE 1 /* 0 : No Use, 1: Use */
+
+#define USE_INTERRUPT 1
+#define INT_CLEAR 1 /* 0 = by polling, 1 = by interrupt */
+
+/* Register value for TMD2771x */ /* hm83.cho 100817 */
+#define ATIME 0xff /* 2.7ms - minimum ALS intergration time */
+#define WTIME 0xff /* 2.7ms - minimum Wait time */
+#define PTIME 0xff /* 2.7ms - minimum Prox integration time */
+#define PPCOUNT 1
+#define PIEN 0x20 /* Enable Prox interrupt */
+#define WEN 0x8 /* Enable Wait */
+#define PEN 0x4 /* Enable Prox */
+#define AEN 0x2 /* Enable ALS */
+#define PON 0x1 /* Enable Power on */
+#define PDRIVE 0
+#define PDIODE 0x20
+#define PGAIN 0
+#define AGAIN 0
+
+/* TDM2771x*/
+enum taos_light_state {
+ LIGHT_DIM = 0,
+ LIGHT_LEVEL1 = 1,
+ LIGHT_LEVEL2 = 2,
+ LIGHT_LEVEL3 = 3,
+ LIGHT_LEVEL4 = 4,
+ LIGHT_LEVEL5 = 5,
+ LIGHT_LEVEL6 = 6,
+ LIGHT_LEVEL7 = 7,
+ LIGHT_LEVEL8 = 8,
+ LIGHT_LEVEL9 = 9,
+ LIGHT_LEVEL10 = 10,
+ LIGHT_LEVEL11 = 11,
+ LIGHT_LEVEL12 = 12,
+ LIGHT_LEVEL13 = 13,
+ LIGHT_LEVEL14 = 14,
+ LIGHT_LEVEL15 = 15,
+ LIGHT_LEVEL16 = 16,
+ LIGHT_INIT = 17,
+};
+
+enum taos_als_fops_status {
+ TAOS_ALS_CLOSED = 0,
+ TAOS_ALS_OPENED = 1,
+};
+
+enum taos_prx_fops_status {
+ TAOS_PRX_CLOSED = 0,
+ TAOS_PRX_OPENED = 1,
+};
+
+enum taos_chip_working_status {
+ TAOS_CHIP_UNKNOWN = 0,
+ TAOS_CHIP_WORKING = 1,
+ TAOS_CHIP_SLEEP = 2
+};
+
+/* driver data */
+struct taos_data {
+ struct input_dev *proximity_input_dev;
+ struct input_dev *light_input_dev;
+ struct i2c_client *client;
+ struct input_dev *input_dev;
+ struct workqueue_struct *taos_wq;
+ struct workqueue_struct *taos_test_wq;
+ struct work_struct work_prox; /* for proximity sensor */
+ struct work_struct work_light; /* for light_sensor */
+ struct work_struct work_ptime; /* for proximity reset */
+ struct class *lightsensor_class;
+ struct class *proximity_class;
+ struct device *proximity_dev;
+ struct device *switch_cmd_dev;
+ int irq;
+ struct wake_lock prx_wake_lock;
+ struct hrtimer timer;
+ struct hrtimer ptimer;
+ struct mutex power_lock;
+ int light_count;
+ int light_buffer;
+ int delay;
+ int avg[3];
+ ktime_t light_polling_time;
+ ktime_t prox_polling_time;
+ bool light_enable;
+ bool proximity_enable;
+ short proximity_value;
+
+ int irdata; /*Ch[1] */
+ int cleardata; /*Ch[0] */
+ u16 chipID;
+/* struct timer_list light_init_timer; */
+/* struct timer_list prox_init_timer; */
+};
+
+/* platform data */
+struct taos_platform_data {
+ int p_out; /* proximity-sensor-output gpio */
+};
+
+#endif
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index a5c3114..0d23989 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -245,6 +245,7 @@ struct uart_ops {
void (*pm)(struct uart_port *, unsigned int state,
unsigned int oldstate);
int (*set_wake)(struct uart_port *, unsigned int state);
+ void (*wake_peer)(struct uart_port *);
/*
* Return a string describing the type of the port
diff --git a/include/linux/si4705_pdata.h b/include/linux/si4705_pdata.h
new file mode 100644
index 0000000..14ad7f5
--- /dev/null
+++ b/include/linux/si4705_pdata.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_SI4705_PDATA_H
+#define _LINUX_SI4705_PDATA_H
+
+#include <linux/types.h>
+
+#ifdef __KERNEL__
+
+#define SI4705_PDATA_BIT_VOL_STEPS (1 << 0)
+#define SI4705_PDATA_BIT_VOL_TABLE (1 << 1)
+#define SI4705_PDATA_BIT_RSSI_THRESHOLD (1 << 2)
+#define SI4705_PDATA_BIT_SNR_THRESHOLD (1 << 3)
+
+struct si4705_pdata {
+ void (*reset)(int enable);
+ u16 pdata_values;
+ int rx_vol_steps;
+ u16 rx_vol_table[16];
+ u16 rx_seek_tune_rssi_threshold;
+ u16 rx_seek_tune_snr_threshold;
+};
+
+#endif
+
+#endif
diff --git a/include/linux/sii9234.h b/include/linux/sii9234.h
new file mode 100755
index 0000000..f15bfa3
--- /dev/null
+++ b/include/linux/sii9234.h
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _SII9234_H_
+#define _SII9234_H_
+
+#ifndef __MHL_NEW_CBUS_MSC_CMD__
+#define __MHL_NEW_CBUS_MSC_CMD__
+/*
+ * Read DCAP for distinguish TA and USB
+ */
+#endif
+
+#ifdef __KERNEL__
+struct sii9234_platform_data {
+ u8 power_state;
+ u8 swing_level;
+ int ddc_i2c_num;
+ void (*init)(void);
+ void (*mhl_sel)(bool enable);
+ void (*hw_onoff)(bool on);
+ void (*hw_reset)(void);
+ void (*enable_vbus)(bool enable);
+#if defined(__MHL_NEW_CBUS_MSC_CMD__)
+ void (*vbus_present)(bool on, int value);
+#else
+ void (*vbus_present)(bool on);
+#endif
+ struct i2c_client *mhl_tx_client;
+ struct i2c_client *tpi_client;
+ struct i2c_client *hdmi_rx_client;
+ struct i2c_client *cbus_client;
+
+#ifdef CONFIG_EXTCON
+ const char *extcon_name;
+#endif
+};
+
+extern u8 mhl_onoff_ex(bool onoff);
+#endif
+
+#ifdef CONFIG_SAMSUNG_WORKAROUND_HPD_GLANCE
+extern void mhl_hpd_handler(bool onoff);
+#endif
+
+#ifdef CONFIG_SAMSUNG_USE_11PIN_CONNECTOR
+extern int max77693_muic_get_status1_adc1k_value(void);
+#endif
+
+#ifdef CONFIG_SAMSUNG_SMARTDOCK
+extern int max77693_muic_get_status1_adc_value(void);
+#endif
+
+#ifdef CONFIG_MACH_MIDAS
+extern void sii9234_wake_lock(void);
+extern void sii9234_wake_unlock(void);
+#endif
+#endif /* _SII9234_H_ */
diff --git a/include/linux/sii9234_rcp.h b/include/linux/sii9234_rcp.h
new file mode 100644
index 0000000..ebce049
--- /dev/null
+++ b/include/linux/sii9234_rcp.h
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics
+ *
+ * Author: Dharam Kumar <dharam.kr@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+#ifndef __SII9234_RCP_H__
+#define __SII9234_RCP_H__
+
+#define MAX_KEY_CODE 0x7F
+
+struct rcp_key {
+ char name[32];
+ unsigned int valid:1;
+ u8 code;
+};
+
+/*
+ * List of All RCP key codes. By default,all keys are
+ * supported(all keys are send to platform).Userspace(Platform) need to decide
+ * how to act/process each received key.
+ */
+
+const struct rcp_key code[MAX_KEY_CODE+1] = {
+
+ {"SELECT", 1, 0x00},
+ {"UP", 1, 0x01},
+ {"DOWN", 1, 0x02},
+ {"LEFT", 1, 0x03},
+ {"RIGHT", 1, 0x04},
+ {"RIGHT-UP", 1, 0x05},
+ {"RIGHT-DOWN", 1, 0x06},
+ {"LEFT-UP", 1, 0x07},
+ {"LEFT-DOWN", 1, 0x08},
+ {"ROOT-MENU", 1, 0x09},
+ {"SETUP-MENU", 1, 0x0A},
+ {"CONTENTS-MENU", 1, 0x0B},
+ {"FAVORITE-MENU", 1, 0x0C},
+ {"EXIT", 1, 0x0D},
+ /* Reserved Block 0x0E-0x1F */
+ {"RSVD", 1, 0x0E},
+ {"RSVD", 1, 0x0F},
+ {"RSVD", 1, 0x10},
+ {"RSVD", 1, 0x11},
+ {"RSVD", 1, 0x12},
+ {"RSVD", 1, 0x13},
+ {"RSVD", 1, 0x14},
+ {"RSVD", 1, 0x15},
+ {"RSVD", 1, 0x16},
+ {"RSVD", 1, 0x17},
+ {"RSVD", 1, 0x18},
+ {"RSVD", 1, 0x19},
+ {"RSVD", 1, 0x1A},
+ {"RSVD", 1, 0x1B},
+ {"RSVD", 1, 0x1C},
+ {"RSVD", 1, 0x1D},
+ {"RSVD", 1, 0x1E},
+ {"RSVD", 1, 0x1F},
+ /*Numeric Keys */
+ {"NUM-0", 1, 0x20},
+ {"NUM-1", 1, 0x21},
+ {"NUM-2", 1, 0x22},
+ {"NUM-3", 1, 0x23},
+ {"NUM-4", 1, 0x24},
+ {"NUM-5", 1, 0x25},
+ {"NUM-6", 1, 0x26},
+ {"NUM-7", 1, 0x27},
+ {"NUM-8", 1, 0x28},
+ {"CLEAR", 1, 0x2C},
+ /* 0x2D-0x2F Reserved */
+ {"RSVD", 1, 0x2D},
+ {"RSVD", 1, 0x2E},
+ {"RSVD", 1, 0x2F},
+
+ {"CHANNEL-UP", 1, 0x30},
+ {"CHANNEL-DOWN", 1, 0x31},
+ {"PREVIOUS-CHANNEL", 1, 0x32},
+ {"SOUND-SELECT", 1, 0x33},
+ {"INPUT-SELECT", 1, 0x34},
+ {"SHOW-INFORMATION", 1, 0x35},
+ {"HELP", 1, 0x36},
+ {"PAGE-UP", 1, 0x37},
+ {"PAGE-DOWN", 1, 0x38},
+ /* 0x39-0x40 Reserved */
+ {"RSVD", 1, 0x39},
+ {"RSVD", 1, 0x3A},
+ {"RSVD", 1, 0x3B},
+ {"RSVD", 1, 0x3C},
+ {"RSVD", 1, 0x3D},
+ {"RSVD", 1, 0x3E},
+
+ {"VOLUME-UP", 1, 0x41},
+ {"VOLUME-DOWN", 1, 0x42},
+ {"MUTE", 1, 0x43},
+ {"PLAY", 1, 0x44},
+ {"STOP", 1, 0x45},
+ {"PAUSE", 1, 0x46},
+ {"RECORD", 1, 0x47},
+ {"REWIND", 1, 0x48},
+ {"FAST-FORWARD", 1, 0x49},
+ {"EJECT", 1, 0x4A},
+ {"FORWARD", 1, 0x4B},
+ {"BACKWARD", 1, 0x4C},
+ /*0x4D-0x4F Reserved */
+ {"RSVD", 1, 0x4D},
+ {"RSVD", 1, 0x4E},
+ {"RSVD", 1, 0x4F},
+
+ {"ANGLE", 1, 0x50},
+ {"SUB-PICTURE", 1, 0x51},
+ /* 0x52-0x5F Reserved */
+ {"RSVD", 1, 0x52},
+ {"RSVD", 1, 0x53},
+ {"RSVD", 1, 0x54},
+ {"RSVD", 0, 0x55},
+ {"RSVD", 1, 0x56},
+ {"RSVD", 1, 0x57},
+ {"RSVD", 1, 0x58},
+ {"RSVD", 1, 0x59},
+ {"RSVD", 1, 0x5A},
+ {"RSVD", 1, 0x5B},
+ {"RSVD", 1, 0x5C},
+ {"RSVD", 1, 0x5D},
+
+ {"PLAY_FUNC", 1, 0x60},
+ {"PAUSE_PLAY_FUNC", 1, 0x61},
+ {"RECORD_FUNC", 1, 0x62},
+ {"PAUSE_RECORD_FUNC", 1, 0x63},
+ {"STOP_FUNC", 1, 0x64},
+ {"MUTE_FUNC", 1, 0x65},
+ {"RESTORE_VOLUME_FUNC", 1, 0x66},
+ {"TUNE_FUNC", 1, 0x67},
+ {"SELECT_MEDIA_FUNC", 1, 0x68},
+ /* 0x69-0x70 Reserved */
+ {"RSVD", 1, 0x69},
+ {"RSVD", 1, 0x6A},
+ {"RSVD", 1, 0x6B},
+ {"RSVD", 1, 0x6C},
+ {"RSVD", 1, 0x6D},
+ {"RSVD", 1, 0x6E},
+ {"RSVD", 1, 0x6F},
+ {"RSVD", 1, 0x70},
+
+ {"F1", 1, 0x71},
+ {"F2", 1, 0x72},
+ {"F3", 1, 0x73},
+ {"F4", 1, 0x74},
+ {"F5", 1, 0x75},
+ /* 0x76-0x7D Reserved */
+ {"RSVD", 1, 0x76},
+ {"RSVD", 1, 0x77},
+ {"RSVD", 1, 0x78},
+ {"RSVD", 1, 0x79},
+ {"RSVD", 1, 0x7A},
+ {"RSVD", 1, 0x7B},
+ {"RSVD", 1, 0x7C},
+ {"RSVD", 1, 0x7D},
+
+ {"VENDOR_SPECIFIC", 1, 0x7E},
+ {"RSVD", 1, 0x7F}
+};
+
+#endif /* __SII9234_RCP_H__ */
diff --git a/include/linux/sockios.h b/include/linux/sockios.h
index 7997a50..f7ffe36 100644
--- a/include/linux/sockios.h
+++ b/include/linux/sockios.h
@@ -65,6 +65,7 @@
#define SIOCDIFADDR 0x8936 /* delete PA address */
#define SIOCSIFHWBROADCAST 0x8937 /* set hardware broadcast addr */
#define SIOCGIFCOUNT 0x8938 /* get number of devices */
+#define SIOCKILLADDR 0x8939 /* kill sockets with this local addr */
#define SIOCGIFBR 0x8940 /* Bridging support */
#define SIOCSIFBR 0x8941 /* Set bridging options */
diff --git a/include/linux/stmpe811-adc.h b/include/linux/stmpe811-adc.h
new file mode 100644
index 0000000..9eee29e
--- /dev/null
+++ b/include/linux/stmpe811-adc.h
@@ -0,0 +1,52 @@
+/*
+ * stmpe811-adc.h
+ *
+ * Copyright (C) 2011 Samsung Electronics
+ * SangYoung Son <hello.son@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __STMPE811_ADC_H_
+#define __STMPE811_ADC_H_
+
+/*
+ * struct sec_bat_adc_table_data - adc to temperature table for sec battery
+ * driver
+ * @adc_table_chX: adc table for channel X
+ * @table_size_chX: size of chX adc table
+ */
+struct stmpe811_platform_data {
+ struct adc_table_data *adc_table_ch0;
+ unsigned int table_size_ch0;
+ struct adc_table_data *adc_table_ch1;
+ unsigned int table_size_ch1;
+ struct adc_table_data *adc_table_ch2;
+ unsigned int table_size_ch2;
+ struct adc_table_data *adc_table_ch3;
+ unsigned int table_size_ch3;
+ struct adc_table_data *adc_table_ch4;
+ unsigned int table_size_ch4;
+ struct adc_table_data *adc_table_ch5;
+ unsigned int table_size_ch5;
+ struct adc_table_data *adc_table_ch6;
+ unsigned int table_size_ch6;
+ struct adc_table_data *adc_table_ch7;
+ unsigned int table_size_ch7;
+
+ int irq_gpio;
+};
+
+u16 stmpe811_get_adc_data(u8 channel);
+int stmpe811_get_adc_value(u8 channel);
+
+#endif
+
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 083ffea..e1e3742 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -92,6 +92,13 @@ typedef int __bitwise suspend_state_t;
* @enter() and @wake(), even if any of them fails. It is executed after
* a failing @prepare.
*
+ * @suspend_again: Returns whether the system should suspend again (true) or
+ * not (false). If the platform wants to poll sensors or execute some
+ * code during suspended without invoking userspace and most of devices,
+ * suspend_again callback is the place assuming that periodic-wakeup or
+ * alarm-wakeup is already setup. This allows to execute some codes while
+ * being kept suspended in the view of userland and devices.
+ *
* @end: Called by the PM core right after resuming devices, to indicate to
* the platform that the system has returned to the working state or
* the transition to the sleep state has been aborted.
@@ -113,6 +120,7 @@ struct platform_suspend_ops {
int (*enter)(suspend_state_t state);
void (*wake)(void);
void (*finish)(void);
+ bool (*suspend_again)(void);
void (*end)(void);
void (*recover)(void);
};
diff --git a/include/linux/switch.h b/include/linux/switch.h
new file mode 100644
index 0000000..3e4c748
--- /dev/null
+++ b/include/linux/switch.h
@@ -0,0 +1,53 @@
+/*
+ * Switch class driver
+ *
+ * Copyright (C) 2008 Google, Inc.
+ * Author: Mike Lockwood <lockwood@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+*/
+
+#ifndef __LINUX_SWITCH_H__
+#define __LINUX_SWITCH_H__
+
+struct switch_dev {
+ const char *name;
+ struct device *dev;
+ int index;
+ int state;
+
+ ssize_t (*print_name)(struct switch_dev *sdev, char *buf);
+ ssize_t (*print_state)(struct switch_dev *sdev, char *buf);
+};
+
+struct gpio_switch_platform_data {
+ const char *name;
+ unsigned gpio;
+
+ /* if NULL, switch_dev.name will be printed */
+ const char *name_on;
+ const char *name_off;
+ /* if NULL, "0" or "1" will be printed */
+ const char *state_on;
+ const char *state_off;
+};
+
+extern int switch_dev_register(struct switch_dev *sdev);
+extern void switch_dev_unregister(struct switch_dev *sdev);
+
+static inline int switch_get_state(struct switch_dev *sdev)
+{
+ return sdev->state;
+}
+
+extern void switch_set_state(struct switch_dev *sdev, int state);
+
+#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 0000000..5539cc5
--- /dev/null
+++ b/include/linux/synaptics_i2c_rmi.h
@@ -0,0 +1,55 @@
+/*
+ * include/linux/synaptics_i2c_rmi.h - platform data structure for f75375s sensor
+ *
+ * Copyright (C) 2008 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_SYNAPTICS_I2C_RMI_H
+#define _LINUX_SYNAPTICS_I2C_RMI_H
+
+#define SYNAPTICS_I2C_RMI_NAME "synaptics-rmi-ts"
+
+enum {
+ SYNAPTICS_FLIP_X = 1UL << 0,
+ SYNAPTICS_FLIP_Y = 1UL << 1,
+ SYNAPTICS_SWAP_XY = 1UL << 2,
+ SYNAPTICS_SNAP_TO_INACTIVE_EDGE = 1UL << 3,
+};
+
+struct synaptics_i2c_rmi_platform_data {
+ uint32_t version; /* Use this entry for panels with */
+ /* (major << 8 | minor) version or above. */
+ /* If non-zero another array entry follows */
+ int (*power)(int on); /* Only valid in first array entry */
+ uint32_t flags;
+ unsigned long irqflags;
+ uint32_t inactive_left; /* 0x10000 = screen width */
+ uint32_t inactive_right; /* 0x10000 = screen width */
+ uint32_t inactive_top; /* 0x10000 = screen height */
+ uint32_t inactive_bottom; /* 0x10000 = screen height */
+ uint32_t snap_left_on; /* 0x10000 = screen width */
+ uint32_t snap_left_off; /* 0x10000 = screen width */
+ uint32_t snap_right_on; /* 0x10000 = screen width */
+ uint32_t snap_right_off; /* 0x10000 = screen width */
+ uint32_t snap_top_on; /* 0x10000 = screen height */
+ uint32_t snap_top_off; /* 0x10000 = screen height */
+ uint32_t snap_bottom_on; /* 0x10000 = screen height */
+ uint32_t snap_bottom_off; /* 0x10000 = screen height */
+ uint32_t fuzz_x; /* 0x10000 = screen width */
+ uint32_t fuzz_y; /* 0x10000 = screen height */
+ int fuzz_p;
+ int fuzz_w;
+ int8_t sensitivity_adjust;
+};
+
+#endif /* _LINUX_SYNAPTICS_I2C_RMI_H */
diff --git a/include/linux/synaptics_s7301.h b/include/linux/synaptics_s7301.h
new file mode 100644
index 0000000..7af78ae
--- /dev/null
+++ b/include/linux/synaptics_s7301.h
@@ -0,0 +1,205 @@
+/*
+ * include/linux/synaptics_s7301.h
+ *
+ * Copyright (C) 2012 Samsung Electronics, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_SYNAPTICS_TS_H_
+#define _LINUX_SYNAPTICS_TS_H_
+
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/earlysuspend.h>
+#include <linux/i2c.h>
+#include <linux/input.h>
+#include <linux/input/mt.h>
+#include <linux/interrupt.h>
+#include <linux/mutex.h>
+#include <linux/io.h>
+#include <linux/slab.h>
+#include <linux/platform_device.h>
+#include <linux/wakelock.h>
+
+#define SYNAPTICS_TS_NAME "synaptics_ts"
+#define SYNAPTICS_TS_ADDR 0x20
+
+#if defined(CONFIG_SEC_TOUCHSCREEN_DVFS_LOCK)
+#include <mach/cpufreq.h>
+#include <mach/dev.h>
+#define SEC_DVFS_LOCK_TIMEOUT 100
+#define SEC_DVFS_LOCK_FREQ 800000
+#define SEC_BUS_LOCK_FREQ 267160
+#endif
+
+#define MAX_TOUCH_NUM 10
+#define I2C_RETRY_CNT 5
+#define MAX_MT_CNT 10
+#define MAX_CMD_SIZE 64
+#define FUNC_ADDR_SIZE 6
+#define FUNC_ADDR_LAST 0xdd
+#define FUNC_ADDR_FIRST 0xe9
+#define PAGE_MAX 0X100
+#define MAX_FUNC 0x55
+#define CHARGER_CONNECT_BIT (0x1 << 5)
+
+enum MT_STATUS {
+ MT_STATUS_INACTIVE = 0,
+ MT_STATUS_PRESS,
+ MT_STATUS_MOVE,
+ MT_STATUS_RELEASE,
+ MT_STATUS_MAX,
+};
+
+struct finger_info {
+ int x;
+ int y;
+ int w_min;
+ int w_max;
+ int z;
+ int status;
+};
+
+struct finger_data {
+ u8 x_msb;
+ u8 y_msb;
+ u8 xy_lsb;
+ u8 w;
+ u8 z;
+};
+
+struct function_info {
+ u16 query_base_addr;
+ u16 command_base_addr;
+ u16 control_base_addr;
+ u16 data_base_addr;
+ u8 interrupt_source_count;
+ u8 function_number;
+ u8 function_version;
+};
+
+struct charger_callbacks {
+ void (*inform_charger)(struct charger_callbacks *, int mode);
+};
+
+/* Variables for F34 functionality */
+struct synaptics_ts_fw_block {
+ u8 *fw_data;
+ u8 *fw_imgdata;
+ u8 *config_imgdata;
+ u8 *lock_imgdata;
+ u16 f01_database;
+ u16 f01_commandbase;
+ u16 f34_database;
+ u16 f34_querybase;
+ u16 f01_controlbase;
+ u16 f34_reflash_blocknum;
+ u16 f34_reflash_blockdata;
+ u16 f34_reflashquery_boot_id;
+ u16 f34_reflashquery_flashpropertyquery;
+ u16 f34_reflashquery_fw_blocksize;
+ u16 f34_reflashquery_fw_blockcount;
+ u16 f34_reflashquery_config_blocksize;
+ u16 f34_reflashquery_config_blockcount;
+ u16 f34_flashcontrol;
+ u16 fw_blocksize;
+ u16 fw_blockcount;
+ u16 config_blocksize;
+ u16 config_blockcount;
+ u16 fw_version;
+ u16 boot_id;
+ u32 imagesize;
+ u32 config_imagesize;
+};
+
+struct synaptics_platform_data {
+ int gpio_attn;
+ int max_x;
+ int max_y;
+ int max_pressure;
+ int max_width;
+ u16 x_line;
+ u16 y_line;
+ int (*set_power)(bool);
+ void (*hw_reset)(void);
+ void (*register_cb)(struct charger_callbacks *);
+};
+
+struct synaptics_drv_data {
+ struct i2c_client *client;
+ struct device *dev;
+ struct input_dev *input;
+ struct synaptics_platform_data *pdata;
+ struct mutex mutex;
+ struct synaptics_ts_fw_block *fw;
+ struct wake_lock wakelock;
+ struct work_struct fw_update_work;
+ struct function_info f01;
+ struct function_info f11;
+ struct function_info f34;
+ struct function_info f54;
+ struct delayed_work init_dwork;
+ struct delayed_work resume_dwork;
+ struct delayed_work noti_dwork;
+ struct charger_callbacks callbacks;
+ struct finger_info finger[MAX_MT_CNT];
+#if CONFIG_HAS_EARLYSUSPEND
+ struct early_suspend early_suspend;
+#endif
+#if defined(CONFIG_SEC_TOUCHSCREEN_DVFS_LOCK)
+ struct delayed_work dvfs_dwork;
+ struct device *bus_dev;
+ u32 cpufreq_level;
+ bool dvfs_lock_status;
+#endif
+ bool ready;
+ bool charger_connection;
+ bool drawing_mode;
+ bool suspend;
+ bool debug;
+ int gpio;
+ u8 page;
+ u8 cmd_status;
+ u8 cmd_report_type;
+ u8 cmd_result[MAX_CMD_SIZE];
+ u8 firm_version[4];
+ u8 firm_config[13];
+ u8 *cmd_temp;
+ u8 *tx_to_tx;
+ u8 *tx_to_gnd;
+ u16 x_line;
+ u16 y_line;
+ u16 refer_max;
+ u16 refer_min;
+ u16 *references;
+ u16 rx_to_rx[42][42];
+ unsigned long func_bit[BITS_TO_LONGS(MAX_FUNC+1)];
+};
+
+extern struct class *sec_class;
+extern int set_tsp_sysfs(struct synaptics_drv_data *data);
+extern int synaptics_fw_updater(struct synaptics_drv_data *data,
+ u8 *fw_data);
+extern void forced_fw_upload(struct synaptics_drv_data *data);
+extern int synaptics_ts_write_data(struct synaptics_drv_data *data,
+ u16 addr, u8 buf);
+extern int synaptics_ts_read_data(struct synaptics_drv_data *data,
+ u16 addr, u8 *buf);
+extern int synaptics_ts_write_block(struct synaptics_drv_data *data,
+ u16 addr, u8 *buf, u16 count);
+extern int synaptics_ts_read_block(struct synaptics_drv_data *data,
+ u16 addr, u8 *buf, u16 count);
+extern void forced_fw_update(struct synaptics_drv_data *data);
+extern void synaptics_ts_drawing_mode(struct synaptics_drv_data *data);
+
+#endif /* _LINUX_SYNAPTICS_TS_H_ */
diff --git a/include/linux/thermal.h b/include/linux/thermal.h
index d3ec89f..c69afbe 100644
--- a/include/linux/thermal.h
+++ b/include/linux/thermal.h
@@ -42,6 +42,7 @@ enum thermal_trip_type {
THERMAL_TRIP_PASSIVE,
THERMAL_TRIP_HOT,
THERMAL_TRIP_CRITICAL,
+ THERMAL_TRIP_STATE_ACTIVE,
};
struct thermal_zone_device_ops {
diff --git a/include/linux/timed_output.h b/include/linux/timed_output.h
new file mode 100644
index 0000000..ec907ab
--- /dev/null
+++ b/include/linux/timed_output.h
@@ -0,0 +1,37 @@
+/* include/linux/timed_output.h
+ *
+ * Copyright (C) 2008 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+*/
+
+#ifndef _LINUX_TIMED_OUTPUT_H
+#define _LINUX_TIMED_OUTPUT_H
+
+struct timed_output_dev {
+ const char *name;
+
+ /* enable the output and set the timer */
+ void (*enable)(struct timed_output_dev *sdev, int timeout);
+
+ /* returns the current number of milliseconds remaining on the timer */
+ int (*get_time)(struct timed_output_dev *sdev);
+
+ /* private data */
+ struct device *dev;
+ int index;
+ int state;
+};
+
+extern int timed_output_dev_register(struct timed_output_dev *dev);
+extern void timed_output_dev_unregister(struct timed_output_dev *dev);
+
+#endif
diff --git a/include/linux/uart_select.h b/include/linux/uart_select.h
new file mode 100644
index 0000000..5e23628
--- /dev/null
+++ b/include/linux/uart_select.h
@@ -0,0 +1,26 @@
+/*
+ * uart_select.h - UART Selection Driver
+ *
+ * Copyright (C) 2009 Samsung Electronics
+ * Kim Kyuwon <q1.kim@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+#ifndef _UART_SELECT_H_
+#define _UART_SELECT_H_
+
+#define UART_SW_PATH_NA -1
+#define UART_SW_PATH_AP 1
+#define UART_SW_PATH_CP 0
+
+struct uart_select_platform_data {
+ int (*get_uart_switch)(void);
+ void (*set_uart_switch)(int path);
+};
+
+extern int uart_sel_get_state(void);
+#endif /* _UART_SELECT_H_ */
+
diff --git a/include/linux/uid_stat.h b/include/linux/uid_stat.h
new file mode 100644
index 0000000..6bd6c4e
--- /dev/null
+++ b/include/linux/uid_stat.h
@@ -0,0 +1,29 @@
+/* include/linux/uid_stat.h
+ *
+ * Copyright (C) 2008-2009 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __uid_stat_h
+#define __uid_stat_h
+
+/* Contains definitions for resource tracking per uid. */
+
+#ifdef CONFIG_UID_STAT
+int uid_stat_tcp_snd(uid_t uid, int size);
+int uid_stat_tcp_rcv(uid_t uid, int size);
+#else
+#define uid_stat_tcp_snd(uid, size) do {} while (0);
+#define uid_stat_tcp_rcv(uid, size) do {} while (0);
+#endif
+
+#endif /* _LINUX_UID_STAT_H */
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 73c7df4..7c4b789 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -968,6 +968,9 @@ extern int usb_disabled(void);
/* The following flags are used internally by usbcore and HCDs */
#define URB_DIR_IN 0x0200 /* Transfer from device to host */
+#ifdef CONFIG_HOST_COMPLIANT_TEST
+#define URB_HCD_DRIVER_TEST 0x0400 /* Do NOT hand back or free this URB. */
+#endif
#define URB_DIR_OUT 0
#define URB_DIR_MASK URB_DIR_IN
@@ -1419,6 +1422,7 @@ extern int usb_string(struct usb_device *dev, int index,
/* wrappers that also update important state inside usbcore */
extern int usb_clear_halt(struct usb_device *dev, int pipe);
extern int usb_reset_configuration(struct usb_device *dev);
+extern void usb_force_disconnect(struct usb_device *udev);
extern int usb_set_interface(struct usb_device *dev, int ifnum, int alternate);
extern void usb_reset_endpoint(struct usb_device *dev, unsigned int epaddr);
diff --git a/include/linux/usb/android_composite.h b/include/linux/usb/android_composite.h
new file mode 100644
index 0000000..886bd78
--- /dev/null
+++ b/include/linux/usb/android_composite.h
@@ -0,0 +1,100 @@
+/*
+ * Platform data for Android USB
+ *
+ * Copyright (C) 2008 Google, Inc.
+ * Author: Mike Lockwood <lockwood@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+#ifndef __LINUX_USB_ANDROID_H
+#define __LINUX_USB_ANDROID_H
+
+#include <linux/usb/composite.h>
+#include <linux/if_ether.h>
+
+struct android_usb_product {
+ /* Vendor ID for this set of functions.
+ * Default vendor_id in platform data will be used if this is zero.
+ */
+ __u16 vendor_id;
+
+ /* Product ID for this set of functions. */
+ __u16 product_id;
+
+ /* List of function names associated with this product.
+ * This is used to compute the USB product ID dynamically
+ * based on which functions are enabled.
+ */
+ int num_functions;
+ char **functions;
+};
+
+struct android_usb_platform_data {
+ /* USB device descriptor fields */
+ __u16 vendor_id;
+
+ /* Default product ID. */
+ __u16 product_id;
+
+ __u16 version;
+
+ char *product_name;
+ char *manufacturer_name;
+ char *serial_number;
+
+ /* List of available USB products.
+ * This is used to compute the USB product ID dynamically
+ * based on which functions are enabled.
+ * if num_products is zero or no match can be found,
+ * we use the default product ID
+ */
+ int num_products;
+ struct android_usb_product *products;
+
+ /* List of all supported USB functions.
+ * This list is used to define the order in which
+ * the functions appear in the configuration's list of USB interfaces.
+ * This is necessary to avoid depending upon the order in which
+ * the individual function drivers are initialized.
+ */
+ int num_functions;
+ char **functions;
+
+ /* Number of LUNs function have [For USB Mass storage]
+ * (anywhere from 1 to FSG_MAX_LUNS which is 8).
+ */
+ unsigned int nluns;
+};
+
+/* Platform data for "usb_mass_storage" driver. */
+struct usb_mass_storage_platform_data {
+ /* Contains values for the SC_INQUIRY SCSI command. */
+ char *vendor;
+ char *product;
+ int release;
+
+ /* number of LUNS */
+ int nluns;
+};
+
+/* Platform data for USB ethernet driver. */
+struct usb_ether_platform_data {
+ u8 ethaddr[ETH_ALEN];
+ u32 vendorID;
+ const char *vendorDescr;
+};
+
+/* Platform data for ACM driver. */
+struct acm_platform_data {
+ u8 num_inst;
+};
+
+#endif /* __LINUX_USB_ANDROID_H */
diff --git a/include/linux/usb/ch11.h b/include/linux/usb/ch11.h
index 4ebaf08..b2b34da 100644
--- a/include/linux/usb/ch11.h
+++ b/include/linux/usb/ch11.h
@@ -83,6 +83,44 @@
#define USB_PORT_FEAT_C_BH_PORT_RESET 29
#define USB_PORT_FEAT_FORCE_LINKPM_ACCEPT 30
+#ifdef CONFIG_HOST_COMPLIANT_TEST
+/*
+ * Hub Port Test Mode Selector Codes
+ * See USB 2.0 spec Table 11-24
+ */
+#define USB_PORT_TEST_J 0x01
+#define USB_PORT_TEST_K 0x02
+#define USB_PORT_TEST_SE0_NAK 0x03
+#define USB_PORT_TEST_PACKET 0x04
+#define USB_PORT_TEST_FORCE_ENABLE 0x05
+
+/*
+ * Product IDs used to trigger USB Hi-Speed Host Electrical Tests
+ * on the root hub. See USB 2.0 spec 7.1.20 and the
+ * Embedded High-speed Host Electrical Test Procedure.
+ */
+#define EHSET_TEST_SE0_NAK 0x0101
+#define EHSET_TEST_J 0x0102
+#define EHSET_TEST_K 0x0103
+#define EHSET_TEST_PACKET 0x0104
+/* Note that the FORCE ENABLE test is no longer used in the EHSET spec. */
+#define EHSET_TEST_FORCE_ENABLE 0x0105
+#define EHSET_HS_HOST_PORT_SUSPEND_RESUME 0x0106
+#define EHSET_SINGLE_STEP_GET_DEV_DESC 0x0107
+#define EHSET_SINGLE_STEP_SET_FEATURE 0x0108
+#define LOW_LEVEL_TEST_J 0x010a
+#define LOW_LEVEL_TEST_K 0x010b
+#define LOW_LEVEL_SE0_NAK 0x010c
+#define LOW_LEVEL_TEST_PACKET 0x010d
+
+/*
+ * This is used for the Hi-Speed Host Electrical Tests
+ * on the root hub. See USB 2.0 spec 7.1.20 and the
+ * Embedded High-speed Host Electrical Test Procedure.
+ */
+#define USB_PORT_TEST_SINGLE_STEP_SET_FEATURE 0x00
+
+#endif
/*
* Hub Status and Hub Change results
* 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 0fd3fbd..fc6c106 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -87,6 +87,8 @@
#define USB_REQ_GET_INTERFACE 0x0A
#define USB_REQ_SET_INTERFACE 0x0B
#define USB_REQ_SYNCH_FRAME 0x0C
+#define USB_REQ_SET_SEL 0x30
+#define USB_REQ_SET_ISOCH_DELAY 0x31
#define USB_REQ_SET_ENCRYPTION 0x0D /* Wireless USB */
#define USB_REQ_GET_ENCRYPTION 0x0E
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index b78cba4..456bab3 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -36,7 +36,9 @@
#include <linux/usb/ch9.h>
#include <linux/usb/gadget.h>
-
+#ifdef CONFIG_USB_ANDROID
+#include <linux/switch.h>
+#endif
/*
* USB function drivers should return USB_GADGET_DELAYED_STATUS if they
* wish to delay the data/status stages of the control transfer till they
@@ -46,6 +48,9 @@
*/
#define USB_GADGET_DELAYED_STATUS 0x7fff /* Impossibly large value */
+#ifdef CONFIG_USB_ANDROID
+struct usb_composite_dev;
+#endif
struct usb_configuration;
/**
@@ -59,6 +64,10 @@ struct usb_configuration;
* @hs_descriptors: Table of high speed descriptors, using interface and
* string identifiers assigned during @bind(). If this pointer is null,
* the function will not be available at high speed.
+ * @ss_descriptors: Table of super speed descriptors, using interface and
+ * string identifiers assigned during @bind(). If this
+ * pointer is null after initiation, the function will not
+ * be available at super speed.
* @config: assigned when @usb_add_function() is called; this is the
* configuration with which this function is associated.
* @bind: Before the gadget can register, all of its functions bind() to the
@@ -77,6 +86,10 @@ struct usb_configuration;
* @setup: Used for interface-specific control requests.
* @suspend: Notifies functions when the host stops sending USB traffic.
* @resume: Notifies functions when the host restarts USB traffic.
+ * @get_status: Returns function status as a reply to
+ * GetStatus() request when the recepient is Interface.
+ * @func_suspend: callback to be called when
+ * SetFeature(FUNCTION_SUSPEND) is reseived
*
* A single USB function uses one or more interfaces, and should in most
* cases support operation at both full and high speeds. Each function is
@@ -106,9 +119,19 @@ struct usb_function {
struct usb_gadget_strings **strings;
struct usb_descriptor_header **descriptors;
struct usb_descriptor_header **hs_descriptors;
+ struct usb_descriptor_header **ss_descriptors;
struct usb_configuration *config;
+#ifdef CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE
+ int (*set_intf_num)(struct usb_function *f,
+ int intf_num, int index_num);
+ int (*set_config_desc)(int conf_num);
+#endif
+#ifdef CONFIG_USB_ANDROID
+ /* disabled is zero if the function is enabled */
+ int disabled;
+#endif
/* REVISIT: bind() functions can be marked __init, which
* makes trouble for section mismatch analysis. See if
* we can't restructure things to avoid mismatching.
@@ -132,10 +155,17 @@ struct usb_function {
void (*suspend)(struct usb_function *);
void (*resume)(struct usb_function *);
+ int (*get_status)(struct usb_function *);
+ int (*func_suspend)(struct usb_function *,
+ u8 suspend_opt);
+
/* private: */
/* internals */
struct list_head list;
DECLARE_BITMAP(endpoints, 32);
+#ifdef CONFIG_USB_ANDROID
+ struct device *dev;
+#endif
};
int usb_add_function(struct usb_configuration *, struct usb_function *);
@@ -145,6 +175,10 @@ int usb_function_activate(struct usb_function *);
int usb_interface_id(struct usb_configuration *, struct usb_function *);
+#ifdef CONFIG_USB_ANDROID
+void usb_function_set_enabled(struct usb_function *, int);
+void usb_composite_force_reset(struct usb_composite_dev *);
+#endif
/**
* ep_choose - select descriptor endpoint at current device speed
* @g: gadget, connected and running at some speed
@@ -231,6 +265,7 @@ struct usb_configuration {
struct list_head list;
struct list_head functions;
u8 next_interface_id;
+ unsigned superspeed:1;
unsigned highspeed:1;
unsigned fullspeed:1;
struct usb_function *interface[MAX_CONFIG_INTERFACES];
@@ -240,6 +275,9 @@ int usb_add_config(struct usb_composite_dev *,
struct usb_configuration *,
int (*)(struct usb_configuration *));
+int usb_remove_config(struct usb_composite_dev *,
+ struct usb_configuration *);
+
/**
* struct usb_composite_driver - groups configurations into a gadget
* @name: For diagnostics, identifies the driver.
@@ -281,6 +319,10 @@ struct usb_composite_driver {
struct usb_gadget_strings **strings;
unsigned needs_serial:1;
+#ifdef CONFIG_USB_ANDROID
+ struct class *class;
+ atomic_t function_count;
+#endif
int (*unbind)(struct usb_composite_dev *);
void (*disconnect)(struct usb_composite_dev *);
@@ -288,6 +330,10 @@ struct usb_composite_driver {
/* global suspend hooks */
void (*suspend)(struct usb_composite_dev *);
void (*resume)(struct usb_composite_dev *);
+
+#ifdef CONFIG_USB_ANDROID
+ void (*enable_function)(struct usb_function *f, int enable);
+#endif
};
extern int usb_composite_probe(struct usb_composite_driver *driver,
@@ -358,6 +404,25 @@ struct usb_composite_dev {
/* protects deactivations and delayed_status counts*/
spinlock_t lock;
+
+#ifdef CONFIG_USB_ANDROID
+ /* switch indicating connected/disconnected state */
+ struct switch_dev sw_connected;
+ /* switch indicating current configuration */
+ struct switch_dev sw_config;
+ /* current connected state for sw_connected */
+ bool connected;
+
+ struct work_struct switch_work;
+#endif
+
+#ifdef CONFIG_USB_ANDROID_SAMSUNG_COMPOSITE
+ /* used by enable_store function of android.c
+ * to avoid signalling switch changes
+ */
+ bool mute_switch;
+ bool force_disconnect;
+#endif
};
extern 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 7cc95ee..b776e1d 100644
--- a/include/linux/usb/ehci_def.h
+++ b/include/linux/usb/ehci_def.h
@@ -133,8 +133,14 @@ struct ehci_regs {
#define PORT_WKCONN_E (1<<20) /* wake on connect (enable) */
/* 19:16 for port testing */
#define PORT_TEST(x) (((x)&0xf)<<16) /* Port Test Control */
+#ifdef CONFIG_HOST_COMPLIANT_TEST
+#define PORT_TEST_J PORT_TEST(0x1)
+#define PORT_TEST_K PORT_TEST(0x2)
+#define PORT_TEST_SE0_NAK PORT_TEST(0x3)
+#endif
#define PORT_TEST_PKT PORT_TEST(0x4) /* Port Test Control - packet test */
#define PORT_TEST_FORCE PORT_TEST(0x5) /* Port Test Control - force enable */
+
#define PORT_LED_OFF (0<<14)
#define PORT_LED_AMBER (1<<14)
#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 0000000..9f58605
--- /dev/null
+++ b/include/linux/usb/exynos_usb3_drd.h
@@ -0,0 +1,404 @@
+/* include/linux/usb/exynos_usb3_drd.h
+ *
+ * Copyright (c) 2012 Samsung Electronics Co. Ltd
+ * Author: Anton Tikhomirov <av.tikhomirov@samsung.com>
+ *
+ * Exynos SuperSpeed USB 3.0 DRD Controller global and OTG registers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LINUX_USB_EXYNOS_USB3_DRD_H
+#define __LINUX_USB_EXYNOS_USB3_DRD_H
+
+/* Global registers */
+#define EXYNOS_USB3_GSBUSCFG0 0xC100
+#define EXYNOS_USB3_GSBUSCFG0_SBusStoreAndForward (1 << 12)
+#define EXYNOS_USB3_GSBUSCFG0_DatBigEnd (1 << 11)
+#define EXYNOS_USB3_GSBUSCFG0_INCR256BrstEna (1 << 7)
+#define EXYNOS_USB3_GSBUSCFG0_INCR128BrstEna (1 << 6)
+#define EXYNOS_USB3_GSBUSCFG0_INCR64BrstEna (1 << 5)
+#define EXYNOS_USB3_GSBUSCFG0_INCR32BrstEna (1 << 4)
+#define EXYNOS_USB3_GSBUSCFG0_INCR16BrstEna (1 << 3)
+#define EXYNOS_USB3_GSBUSCFG0_INCR8BrstEna (1 << 2)
+#define EXYNOS_USB3_GSBUSCFG0_INCR4BrstEna (1 << 1)
+#define EXYNOS_USB3_GSBUSCFG0_INCRBrstEna (1 << 0)
+
+#define EXYNOS_USB3_GSBUSCFG1 0xC104
+#define EXYNOS_USB3_GSBUSCFG1_EN1KPAGE (1 << 12)
+#define EXYNOS_USB3_GSBUSCFG1_BREQLIMIT_MASK (0xf << 8)
+#define EXYNOS_USB3_GSBUSCFG1_BREQLIMIT_SHIFT 8
+#define EXYNOS_USB3_GSBUSCFG1_BREQLIMIT(_x) ((_x) << 8)
+
+#define EXYNOS_USB3_GTXTHRCFG 0xC108
+#define EXYNOS_USB3_GTXTHRCFG_USBTxPktCntSel (1 << 29)
+#define EXYNOS_USB3_GTXTHRCFG_USBTxPktCnt_MASK (0xf << 24)
+#define EXYNOS_USB3_GTXTHRCFG_USBTxPktCnt_SHIFT 24
+#define EXYNOS_USB3_GTXTHRCFG_USBTxPktCnt(_x) ((_x) << 24)
+#define EXYNOS_USB3_GTXTHRCFG_USBMaxTxBurstSize_MASK (0xff << 16)
+#define EXYNOS_USB3_GTXTHRCFG_USBMaxTxBurstSize_SHIFT 16
+#define EXYNOS_USB3_GTXTHRCFG_USBMaxTxBurstSize(_x) ((_x) << 16)
+
+#define EXYNOS_USB3_GRXTHRCFG 0xC10C
+#define EXYNOS_USB3_GRXTHRCFG_USBRxPktCntSel (1 << 29)
+#define EXYNOS_USB3_GRXTHRCFG_USBRxPktCnt_MASK (0xf << 24)
+#define EXYNOS_USB3_GRXTHRCFG_USBRxPktCnt_SHIFT 24
+#define EXYNOS_USB3_GRXTHRCFG_USBRxPktCnt(_x) ((_x) << 24)
+#define EXYNOS_USB3_GRXTHRCFG_USBMaxRxBurstSize_MASK (0x1f << 19)
+#define EXYNOS_USB3_GRXTHRCFG_USBMaxRxBurstSize_SHIFT 19
+#define EXYNOS_USB3_GRXTHRCFG_USBMaxRxBurstSize(_x) ((_x) << 19)
+
+#define EXYNOS_USB3_GCTL 0xC110
+#define EXYNOS_USB3_GCTL_PwrDnScale_MASK (0x1fff << 19)
+#define EXYNOS_USB3_GCTL_PwrDnScale_SHIFT 19
+#define EXYNOS_USB3_GCTL_PwrDnScale(_x) ((_x) << 19)
+#define EXYNOS_USB3_GCTL_U2RSTECN (1 << 16)
+#define EXYNOS_USB3_GCTL_FRMSCLDWN_MASK (0x3 << 14)
+#define EXYNOS_USB3_GCTL_FRMSCLDWN_SHIFT 14
+#define EXYNOS_USB3_GCTL_FRMSCLDWN(_x) ((_x) << 14)
+#define EXYNOS_USB3_GCTL_PrtCapDir_MASK (0x3 << 12)
+#define EXYNOS_USB3_GCTL_PrtCapDir_SHIFT 12
+#define EXYNOS_USB3_GCTL_PrtCapDir(_x) ((_x) << 12)
+#define EXYNOS_USB3_GCTL_CoreSoftReset (1 << 11)
+#define EXYNOS_USB3_GCTL_LocalLpBkEn (1 << 10)
+#define EXYNOS_USB3_GCTL_LpbkEn (1 << 9)
+#define EXYNOS_USB3_GCTL_DebugAttach (1 << 8)
+#define EXYNOS_USB3_GCTL_RAMClkSel_MASK (0x3 << 6)
+#define EXYNOS_USB3_GCTL_RAMClkSel_SHIFT 6
+#define EXYNOS_USB3_GCTL_RAMClkSel(_x) ((_x) << 6)
+#define EXYNOS_USB3_GCTL_ScaleDown_MASK (0x3 << 4)
+#define EXYNOS_USB3_GCTL_ScaleDown_SHIFT 4
+#define EXYNOS_USB3_GCTL_ScaleDown(_x) ((_x) << 4)
+#define EXYNOS_USB3_GCTL_DisScramble (1 << 3)
+#define EXYNOS_USB3_GCTL_SsPwrClmp (1 << 2)
+#define EXYNOS_USB3_GCTL_HsFsLsPwrClmp (1 << 1)
+#define EXYNOS_USB3_GCTL_DsblClkGtng (1 << 0)
+
+#define EXYNOS_USB3_GEVTEN 0xC114
+#define EXYNOS_USB3_GEVTEN_I2CEvtEn (1 << 1)
+#define EXYNOS_USB3_GEVTEN_ULPICKEvtEn (1 << 0)
+#define EXYNOS_USB3_GEVTEN_I2CCKEvtEn (1 << 0)
+
+#define EXYNOS_USB3_GSTS 0xC118
+#define EXYNOS_USB3_GSTS_CBELT_MASK (0xfff << 20)
+#define EXYNOS_USB3_GSTS_CBELT_SHIFT 20
+#define EXYNOS_USB3_GSTS_CBELT(_x) ((_x) << 20)
+#define EXYNOS_USB3_GSTS_OTG_IP (1 << 10)
+#define EXYNOS_USB3_GSTS_BC_IP (1 << 9)
+#define EXYNOS_USB3_GSTS_ADP_IP (1 << 8)
+#define EXYNOS_USB3_GSTS_Host_IP (1 << 7)
+#define EXYNOS_USB3_GSTS_Device_IP (1 << 6)
+#define EXYNOS_USB3_GSTS_CSRTimeout (1 << 5)
+#define EXYNOS_USB3_GSTS_BusErrAddrVld (1 << 4)
+#define EXYNOS_USB3_GSTS_CurMod_MASK (0x3 << 0)
+#define EXYNOS_USB3_GSTS_CurMod_SHIFT 0
+#define EXYNOS_USB3_GSTS_CurMod(_x) ((_x) << 0)
+
+#define EXYNOS_USB3_GSNPSID 0xC120
+
+#define EXYNOS_USB3_GGPIO 0xC124
+#define EXYNOS_USB3_GGPIO_GPO_MASK (0xffff << 16)
+#define EXYNOS_USB3_GGPIO_GPO_SHIFT 16
+#define EXYNOS_USB3_GGPIO_GPO(_x) ((_x) << 16)
+#define EXYNOS_USB3_GGPIO_GPI_MASK (0xffff << 0)
+#define EXYNOS_USB3_GGPIO_GPI_SHIFT 0
+#define EXYNOS_USB3_GGPIO_GPI(_x) ((x) << 0)
+
+#define EXYNOS_USB3_GUID 0xC128
+
+#define EXYNOS_USB3_GUCTL 0xC12C
+#define EXYNOS_USB3_GUCTL_SprsCtrlTransEn (1 << 17)
+#define EXYNOS_USB3_GUCTL_ResBwHSEPS (1 << 16)
+#define EXYNOS_USB3_GUCTL_CMdevAddr (1 << 15)
+#define EXYNOS_USB3_GUCTL_USBHstInAutoRetryEn (1 << 14)
+#define EXYNOS_USB3_GUCTL_USBHstInMaxBurst_MASK (0x7 << 11)
+#define EXYNOS_USB3_GUCTL_USBHstInMaxBurst_SHIFT 11
+#define EXYNOS_USB3_GUCTL_USBHstInMaxBurst(_x) ((_x) << 11)
+#define EXYNOS_USB3_GUCTL_DTCT_MASK (0x3 << 9)
+#define EXYNOS_USB3_GUCTL_DTCT_SHIFT 9
+#define EXYNOS_USB3_GUCTL_DTCT(_x) ((_x) << 9)
+#define EXYNOS_USB3_GUCTL_DTFT_MASK (0x1ff << 0)
+#define EXYNOS_USB3_GUCTL_DTFT_SHIFT 0
+#define EXYNOS_USB3_GUCTL_DTFT(_x) ((_x) << 0)
+
+#define EXYNOS_USB3_GBUSERRADDR_31_0 0xC130
+#define EXYNOS_USB3_GBUSERRADDR_63_32 0xC134
+#define EXYNOS_USB3_GPRTBIMAP_31_0 0xC138
+#define EXYNOS_USB3_GPRTBIMAP_63_32 0xC13C
+
+#define EXYNOS_USB3_GHWPARAMS0 0xC140
+#define EXYNOS_USB3_GHWPARAMS1 0xC144
+#define EXYNOS_USB3_GHWPARAMS2 0xC148
+#define EXYNOS_USB3_GHWPARAMS3 0xC14C
+#define EXYNOS_USB3_GHWPARAMS4 0xC150
+#define EXYNOS_USB3_GHWPARAMS5 0xC154
+#define EXYNOS_USB3_GHWPARAMS6 0xC158
+#define EXYNOS_USB3_GHWPARAMS7 0xC15C
+
+#define EXYNOS_USB3_GDBGFIFOSPACE 0xC160
+#define EXYNOS_USB3_GDBGLTSSM 0xC164
+
+#define EXYNOS_USB3_GDBGLSPMUX 0xC170
+#define EXYNOS_USB3_GDBGLSP 0xC174
+#define EXYNOS_USB3_GDBGEPINFO0 0xC178
+#define EXYNOS_USB3_GDBGEPINFO1 0xC17C
+
+#define EXYNOS_USB3_GPRTBIMAP_HS_31_0 0xC180
+#define EXYNOS_USB3_GPRTBIMAP_HS_63_32 0xC184
+#define EXYNOS_USB3_GPRTBIMAP_FS_31_0 0xC188
+#define EXYNOS_USB3_GPRTBIMAP_FS_63_32 0xC18C
+
+#define EXYNOS_USB3_GUSB2PHYCFG(_a) (0xC200 + ((_a) * 0x04))
+#define EXYNOS_USB3_GUSB2PHYCFGx_PHYSoftRst (1 << 31)
+#define EXYNOS_USB3_GUSB2PHYCFGx_PhyIntrNum_MASK (0x3f << 19)
+#define EXYNOS_USB3_GUSB2PHYCFGx_PhyIntrNum_SHIFT 19
+#define EXYNOS_USB3_GUSB2PHYCFGx_PhyIntrNum(_x) ((_x) << 19)
+#define EXYNOS_USB3_GUSB2PHYCFGx_ULPIExtVbusIndicator (1 << 18)
+#define EXYNOS_USB3_GUSB2PHYCFGx_ULPIExtVbusDrv (1 << 17)
+#define EXYNOS_USB3_GUSB2PHYCFGx_ULPIClkSusM (1 << 16)
+#define EXYNOS_USB3_GUSB2PHYCFGx_ULPIAutoRes (1 << 15)
+#define EXYNOS_USB3_GUSB2PHYCFGx_PhyLPwrClkSel (1 << 14)
+#define EXYNOS_USB3_GUSB2PHYCFGx_USBTrdTim_MASK (0xf << 10)
+#define EXYNOS_USB3_GUSB2PHYCFGx_USBTrdTim_SHIFT 10
+#define EXYNOS_USB3_GUSB2PHYCFGx_USBTrdTim(_x) ((_x) << 10)
+#define EXYNOS_USB3_GUSB2PHYCFGx_EnblSlpM (1 << 8)
+#define EXYNOS_USB3_GUSB2PHYCFGx_PHYSel (1 << 7)
+#define EXYNOS_USB3_GUSB2PHYCFGx_SusPHY (1 << 6)
+#define EXYNOS_USB3_GUSB2PHYCFGx_FSIntf (1 << 5)
+#define EXYNOS_USB3_GUSB2PHYCFGx_ULPI_UTMI_Sel (1 << 4)
+#define EXYNOS_USB3_GUSB2PHYCFGx_PHYIf (1 << 3)
+#define EXYNOS_USB3_GUSB2PHYCFGx_TOutCal_MASK (0x7 << 0)
+#define EXYNOS_USB3_GUSB2PHYCFGx_TOutCal_SHIFT 0
+#define EXYNOS_USB3_GUSB2PHYCFGx_TOutCal(_x) ((_x) << 0)
+
+#define EXYNOS_USB3_GUSB2I2CCTL(_a) (0xC240 + ((_a) * 0x04))
+
+#define EXYNOS_USB3_GUSB2PHYACC(_a) (0xC280 + ((_a) * 0x04))
+#define EXYNOS_USB3_GUSB2PHYACCx_DisUlpiDrvr (1 << 26)
+#define EXYNOS_USB3_GUSB2PHYACCx_NewRegReq (1 << 25)
+#define EXYNOS_USB3_GUSB2PHYACCx_VStsDone (1 << 24)
+#define EXYNOS_USB3_GUSB2PHYACCx_VStsBsy (1 << 23)
+#define EXYNOS_USB3_GUSB2PHYACCx_RegWr (1 << 22)
+#define EXYNOS_USB3_GUSB2PHYACCx_RegAddr_MASK (0x3f << 16)
+#define EXYNOS_USB3_GUSB2PHYACCx_RegAddr_SHIFT 16
+#define EXYNOS_USB3_GUSB2PHYACCx_RegAddr(_x) ((_x) << 16)
+/* Next 2 fields are overlaping. Is it error in user manual? */
+#define EXYNOS_USB3_GUSB2PHYACCx_VCtrl_MASK (0xff << 8)
+#define EXYNOS_USB3_GUSB2PHYACCx_VCtrl_SHIFT 8
+#define EXYNOS_USB3_GUSB2PHYACCx_VCtrl(_x) ((_x) << 8)
+/*--------*/
+#define EXYNOS_USB3_GUSB2PHYACCx_ExtRegAddr_MASK (0x3f << 8)
+#define EXYNOS_USB3_GUSB2PHYACCx_ExtRegAddr_SHIFT 8
+#define EXYNOS_USB3_GUSB2PHYACCx_ExtRegAddr(_x) ((_x) << 8)
+/*--------*/
+#define EXYNOS_USB3_GUSB2PHYACCx_RegData_MASK (0xff << 0)
+#define EXYNOS_USB3_GUSB2PHYACCx_RegData_SHIFT 0
+#define EXYNOS_USB3_GUSB2PHYACCx_RegData(_x) ((_x) << 0)
+
+#define EXYNOS_USB3_GUSB3PIPECTL(_a) (0xC2C0 + ((_a) * 0x04))
+#define EXYNOS_USB3_GUSB3PIPECTLx_PHYSoftRst (1 << 31)
+#define EXYNOS_USB3_GUSB3PIPECTLx_request_p1p2p3 (1 << 24)
+#define EXYNOS_USB3_GUSB3PIPECTLx_StartRxdetU3RxDet (1 << 23)
+#define EXYNOS_USB3_GUSB3PIPECTLx_DisRxDetU3RxDet (1 << 22)
+#define EXYNOS_USB3_GUSB3PIPECTLx_delay_p1p2p3_MASK (0x7 << 19)
+#define EXYNOS_USB3_GUSB3PIPECTLx_delay_p1p2p3_SHIFT 19
+#define EXYNOS_USB3_GUSB3PIPECTLx_delay_p1p2p3(_x) ((_x) << 19)
+#define EXYNOS_USB3_GUSB3PIPECTLx_delay_phy_pwr_p1p2p3 (1 << 18)
+#define EXYNOS_USB3_GUSB3PIPECTLx_SuspSSPhy (1 << 17)
+#define EXYNOS_USB3_GUSB3PIPECTLx_DatWidth_MASK (0x3 << 15)
+#define EXYNOS_USB3_GUSB3PIPECTLx_DatWidth_SHIFT 15
+#define EXYNOS_USB3_GUSB3PIPECTLx_DatWidth(_x) ((_x) << 15)
+#define EXYNOS_USB3_GUSB3PIPECTLx_AbortRxDetInU2 (1 << 14)
+#define EXYNOS_USB3_GUSB3PIPECTLx_SkipRxDet (1 << 13)
+#define EXYNOS_USB3_GUSB3PIPECTLx_LFPSP0Algn (1 << 12)
+#define EXYNOS_USB3_GUSB3PIPECTLx_P3P2TranOK (1 << 11)
+#define EXYNOS_USB3_GUSB3PIPECTLx_LFPSFilt (1 << 9)
+#define EXYNOS_USB3_GUSB3PIPECTLx_TxSwing (1 << 6)
+#define EXYNOS_USB3_GUSB3PIPECTLx_TxMargin_MASK (0x7 << 3)
+#define EXYNOS_USB3_GUSB3PIPECTLx_TxMargin_SHIFT 3
+#define EXYNOS_USB3_GUSB3PIPECTLx_TxMargin(_x) ((_x) << 3)
+#define EXYNOS_USB3_GUSB3PIPECTLx_TxDeemphasis_MASK (0x3 << 1)
+#define EXYNOS_USB3_GUSB3PIPECTLx_TxDeemphasis_SHIFT 1
+#define EXYNOS_USB3_GUSB3PIPECTLx_TxDeemphasis(_x) ((_x) << 1)
+#define EXYNOS_USB3_GUSB3PIPECTLx_ElasticBufferMode (1 << 0)
+
+#define EXYNOS_USB3_GTXFIFOSIZ(_a) (0xC300 + ((_a) * 0x04))
+#define EXYNOS_USB3_GTXFIFOSIZx_TxFStAddr_n_MASK (0xffff << 16)
+#define EXYNOS_USB3_GTXFIFOSIZx_TxFStAddr_n_SHIFT 16
+#define EXYNOS_USB3_GTXFIFOSIZx_TxFStAddr_n(_x) ((_x) << 16)
+#define EXYNOS_USB3_GTXFIFOSIZx_TxFDep_n_MASK (0xffff << 0)
+#define EXYNOS_USB3_GTXFIFOSIZx_TxFDep_n_SHIFT 0
+#define EXYNOS_USB3_GTXFIFOSIZx_TxFDep_n(_x) ((_x) << 0)
+
+#define EXYNOS_USB3_GRXFIFOSIZ(_a) (0xC380 + ((_a) * 0x04))
+#define EXYNOS_USB3_GRXFIFOSIZx_RxFStAddr_n_MASK (0xffff << 16)
+#define EXYNOS_USB3_GRXFIFOSIZx_RxFStAddr_n_SHIFT 16
+#define EXYNOS_USB3_GRXFIFOSIZx_RxFStAddr_n(_x) ((_x) << 16)
+#define EXYNOS_USB3_GRXFIFOSIZx_RxFDep_n_MASK (0xffff << 0)
+#define EXYNOS_USB3_GRXFIFOSIZx_RxFDep_n_SHIFT 0
+#define EXYNOS_USB3_GRXFIFOSIZx_RxFDep_n(_x) ((_x) << 0)
+
+#define EXYNOS_USB3_GEVNTADR_31_0(_a) (0xC400 + ((_a) * 0x10))
+#define EXYNOS_USB3_GEVNTADR_63_32(_a) (0xC404 + ((_a) * 0x10))
+
+#define EXYNOS_USB3_GEVNTSIZ(_a) (0xC408 + ((_a) * 0x10))
+#define EXYNOS_USB3_GEVNTSIZx_EvntIntMask (1 << 31)
+#define EXYNOS_USB3_GEVNTSIZx_EVNTSiz_MASK (0xffff << 0)
+#define EXYNOS_USB3_GEVNTSIZx_EVNTSiz_SHIFT 0
+#define EXYNOS_USB3_GEVNTSIZx_EVNTSiz(x) ((_x) << 0)
+
+#define EXYNOS_USB3_GEVNTCOUNT(_a) (0xC40C + ((_a) * 0x10))
+#define EXYNOS_USB3_GEVNTCOUNTx_EVNTCount_MASK (0xffff << 0)
+#define EXYNOS_USB3_GEVNTCOUNTx_EVNTCount_SHIFT 0
+#define EXYNOS_USB3_GEVNTCOUNTx_EVNTCount(_x) ((_x) << 0)
+
+/* Event Buffer Content for Device Endpoint-Specific Events (DEPEVT) */
+#define EXYNOS_USB3_DEPEVT_EventParam_MASK (0xffff << 16)
+#define EXYNOS_USB3_DEPEVT_EventParam_SHIFT 16
+#define EXYNOS_USB3_DEPEVT_EventParam(_x) ((_x) << 16)
+#define EXYNOS_USB3_DEPEVT_EventStatus_MASK (0xf << 12)
+#define EXYNOS_USB3_DEPEVT_EventStatus_SHIFT 12
+#define EXYNOS_USB3_DEPEVT_EventStatus_CTL_MASK (0x3 << 12)
+#define EXYNOS_USB3_DEPEVT_EventStatus_CTL_SETUP (0 << 12)
+#define EXYNOS_USB3_DEPEVT_EventStatus_CTL_DATA (1 << 12)
+#define EXYNOS_USB3_DEPEVT_EventStatus_CTL_STATUS (2 << 12)
+#define EXYNOS_USB3_DEPEVT_EventStatus_BUSERR (1 << 12)
+#define EXYNOS_USB3_DEPEVT_EVENT_MASK (0xf << 6)
+#define EXYNOS_USB3_DEPEVT_EVENT_SHIFT 6
+#define EXYNOS_USB3_DEPEVT_EVENT_EPCmdCmplt (7 << 6)
+#define EXYNOS_USB3_DEPEVT_EVENT_StreamEvt (6 << 6)
+#define EXYNOS_USB3_DEPEVT_EVENT_RxTxfifoEvt (4 << 6)
+#define EXYNOS_USB3_DEPEVT_EVENT_XferNotReady (3 << 6)
+#define EXYNOS_USB3_DEPEVT_EVENT_XferInProgress (2 << 6)
+#define EXYNOS_USB3_DEPEVT_EVENT_XferComplete (1 << 6)
+#define EXYNOS_USB3_DEPEVT_EPNUM_MASK (0x1f << 1)
+#define EXYNOS_USB3_DEPEVT_EPNUM_SHIFT 1
+#define EXYNOS_USB3_DEPEVT_EPNUM(_x) ((_x) << 1)
+
+/* Event Buffer Content for Device-Specific Events (DEVT) */
+#define EXYNOS_USB3_DEVT_EvtInfo_MASK (0xf << 16)
+#define EXYNOS_USB3_DEVT_EvtInfo_SHIFT 16
+#define EXYNOS_USB3_DEVT_EvtInfo(_x) ((_x) << 16)
+#define EXYNOS_USB3_DEVT_EvtInfo_SS (1 << 20)
+#define EXYNOS_USB3_DEVT_EvtInfo_U3 (0x3 << 16)
+#define EXYNOS_USB3_DEVT_EvtInfo_SS_DIS (0x4 << 16)
+#define EXYNOS_USB3_DEVT_EvtInfo_Suspend (0x3 << 16)
+#define EXYNOS_USB3_DEVT_EVENT_MASK (0xf << 8)
+#define EXYNOS_USB3_DEVT_EVENT_SHIFT 8
+#define EXYNOS_USB3_DEVT_EVENT_VndrDevTstRcved (12 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_EvntOverflow (11 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_CmdCmplt (10 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_ErrticErr (9 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_Sof (7 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_EOPF (6 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_WkUpEvt (4 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_ULStChng (3 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_ConnectDone (2 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_USBRst (1 << 8)
+#define EXYNOS_USB3_DEVT_EVENT_DisconnEvt (0 << 8)
+
+#define EXYNOS_USB3_GHWPARAMS8 0xC600
+
+/* USB 2.0 OTG and Battery Charger registers */
+#define EXYNOS_USB3_OCFG 0xCC00
+#define EXYNOS_USB3_OCFG_OTG_Version (1 << 2)
+#define EXYNOS_USB3_OCFG_HNPCap (1 << 1)
+#define EXYNOS_USB3_OCFG_SRPCap (1 << 0)
+
+#define EXYNOS_USB3_OCTL 0xCC04
+#define EXYNOS_USB3_OCTL_PeriMode (1 << 6)
+#define EXYNOS_USB3_OCTL_PrtPwrCtl (1 << 5)
+#define EXYNOS_USB3_OCTL_HNPReq (1 << 4)
+#define EXYNOS_USB3_OCTL_SesReq (1 << 3)
+#define EXYNOS_USB3_OCTL_TermSelDLPulse (1 << 2)
+#define EXYNOS_USB3_OCTL_DevSetHNPEn (1 << 1)
+#define EXYNOS_USB3_OCTL_HstSetHNPEn (1 << 0)
+
+#define EXYNOS_USB3_OEVT 0xCC08
+#define EXYNOS_USB3_OEVT_DeviceMode (1 << 31)
+#define EXYNOS_USB3_OEVT_OTGConIDStsChngEvnt (1 << 24)
+#define EXYNOS_USB3_OEVT_OTGADevBHostEndEvnt (1 << 20)
+#define EXYNOS_USB3_OEVT_OTGADevHostEvnt (1 << 19)
+#define EXYNOS_USB3_OEVT_OTGADevHNPChngEvnt (1 << 18)
+#define EXYNOS_USB3_OEVT_OTGADevSRPDetEvnt (1 << 17)
+#define EXYNOS_USB3_OEVT_OTGADevSessEndDetEvnt (1 << 16)
+#define EXYNOS_USB3_OEVT_OTGBDevBHostEndEvnt (1 << 11)
+#define EXYNOS_USB3_OEVT_OTGBDevHNPChngEvnt (1 << 10)
+#define EXYNOS_USB3_OEVT_OTGBDevSessVldDetEvnt (1 << 9)
+#define EXYNOS_USB3_OEVT_OTGBDevVBUSChngEvnt (1 << 8)
+#define EXYNOS_USB3_OEVT_BSesVld (1 << 3)
+#define EXYNOS_USB3_OEVT_HstNegSts (1 << 2)
+#define EXYNOS_USB3_OEVT_SesReqSts (1 << 1)
+#define EXYNOS_USB3_OEVT_OEVTError (1 << 0)
+
+#define EXYNOS_USB3_OEVTEN 0xCC0C
+#define EXYNOS_USB3_OEVTEN_OTGConIDStsChngEvntEn (1 << 24)
+#define EXYNOS_USB3_OEVTEN_OTGADevBHostEndEvntEn (1 << 20)
+#define EXYNOS_USB3_OEVTEN_OTGADevHostEvntEn (1 << 19)
+#define EXYNOS_USB3_OEVTEN_OTGADevHNPChngEvntEn (1 << 18)
+#define EXYNOS_USB3_OEVTEN_OTGADevSRPDetEvntEn (1 << 17)
+#define EXYNOS_USB3_OEVTEN_OTGADevSessEndDetEvntEn (1 << 16)
+#define EXYNOS_USB3_OEVTEN_OTGBDevBHostEndEvntEn (1 << 11)
+#define EXYNOS_USB3_OEVTEN_OTGBDevHNPChngEvntEn (1 << 10)
+#define EXYNOS_USB3_OEVTEN_OTGBDevSessVldDetEvntEn (1 << 9)
+#define EXYNOS_USB3_OEVTEN_OTGBDevVBUSChngEvntEn (1 << 8)
+
+#define EXYNOS_USB3_OSTS 0xCC10
+#define EXYNOS_USB3_OSTS_OTG_state_MASK (0xf << 8)
+#define EXYNOS_USB3_OSTS_OTG_state_SHIFT 8
+#define EXYNOS_USB3_OSTS_OTG_state(_x) ((_x) << 8)
+#define EXYNOS_USB3_OSTS_PeripheralState (1 << 4)
+#define EXYNOS_USB3_OSTS_xHCIPrtPower (1 << 3)
+#define EXYNOS_USB3_OSTS_BSesVld (1 << 2)
+#define EXYNOS_USB3_OSTS_VbusVld (1 << 1)
+#define EXYNOS_USB3_OSTS_ConIDSts (1 << 0)
+
+#define EXYNOS_USB3_ADPCFG 0xCC20
+#define EXYNOS_USB3_ADPCFG_PrbPer_MASK (0x3 << 30)
+#define EXYNOS_USB3_ADPCFG_PrbPer_SHIFT 30
+#define EXYNOS_USB3_ADPCFG_PrbPer(_x) ((_x) << 30)
+#define EXYNOS_USB3_ADPCFG_PrbDelta_MASK (0x3 << 28)
+#define EXYNOS_USB3_ADPCFG_PrbDelta_SHIFT 28
+#define EXYNOS_USB3_ADPCFG_PrbDelta(_x) ((_x) << 28)
+#define EXYNOS_USB3_ADPCFG_PrbDschg_MASK (0x3 << 26)
+#define EXYNOS_USB3_ADPCFG_PrbDschg_SHIFT 26
+#define EXYNOS_USB3_ADPCFG_PrbDschg(_x) ((_x) << 26)
+
+#define EXYNOS_USB3_ADPCTL 0xCC24
+#define EXYNOS_USB3_ADPCTL_EnaPrb (1 << 28)
+#define EXYNOS_USB3_ADPCTL_EnaSns (1 << 27)
+#define EXYNOS_USB3_ADPCTL_ADPEn (1 << 26)
+#define EXYNOS_USB3_ADPCTL_ADPRes (1 << 25)
+#define EXYNOS_USB3_ADPCTL_WB (1 << 24)
+
+#define EXYNOS_USB3_ADPEVT 0xCC28
+#define EXYNOS_USB3_ADPEVT_AdpPrbEvnt (1 << 28)
+#define EXYNOS_USB3_ADPEVT_AdpSnsEvnt (1 << 27)
+#define EXYNOS_USB3_ADPEVT_AdpTmoutEvnt (1 << 26)
+#define EXYNOS_USB3_ADPEVT_ADPRstCmpltEvnt (1 << 25)
+#define EXYNOS_USB3_ADPEVT_RTIM_MASK (0x7ff << 0)
+#define EXYNOS_USB3_ADPEVT_RTIM_SHIFT 0
+#define EXYNOS_USB3_ADPEVT_RTIM(_x) ((_x) << 0)
+
+#define EXYNOS_USB3_ADPEVTEN 0xCC2C
+#define EXYNOS_USB3_ADPEVTEN_AdpPrbEvntEn (1 << 28)
+#define EXYNOS_USB3_ADPEVTEN_AdpSnsEvntEn (1 << 27)
+#define EXYNOS_USB3_ADPEVTEN_AdpTmoutEvntEn (1 << 26)
+#define EXYNOS_USB3_ADPEVTEN_ADPRstCmpltEvntEn (1 << 25)
+
+#define EXYNOS_USB3_BCFG 0xCC30
+#define EXYNOS_USB3_BCFG_IDDIG_SEL (1 << 1)
+#define EXYNOS_USB3_BCFG_CHIRP_EN (1 << 0)
+
+#define EXYNOS_USB3_BCEVT 0xCC38
+#define EXYNOS_USB3_BCEVT_MV_ChngEvnt (1 << 24)
+#define EXYNOS_USB3_BCEVT_MultValIdBc_MASK (0x1f << 0)
+#define EXYNOS_USB3_BCEVT_MultValIdBc_SHIFT 0
+#define EXYNOS_USB3_BCEVT_MultValIdBc(_x) ((_x) << 0)
+
+#define EXYNOS_USB3_BCEVTEN 0xCC3C
+#define EXYNOS_USB3_BCEVTEN_MV_ChngEvntEn (1 << 24)
+
+#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 0000000..5b2dcf9
--- /dev/null
+++ b/include/linux/usb/f_accessory.h
@@ -0,0 +1,83 @@
+/*
+ * Gadget Function Driver for Android USB accessories
+ *
+ * Copyright (C) 2011 Google, Inc.
+ * Author: Mike Lockwood <lockwood@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __LINUX_USB_F_ACCESSORY_H
+#define __LINUX_USB_F_ACCESSORY_H
+
+/* Use Google Vendor ID when in accessory mode */
+#define USB_ACCESSORY_VENDOR_ID 0x18D1
+
+
+/* Product ID to use when in accessory mode */
+#define USB_ACCESSORY_PRODUCT_ID 0x2D00
+
+/* Product ID to use when in accessory mode and adb is enabled */
+#define USB_ACCESSORY_ADB_PRODUCT_ID 0x2D01
+
+/* Indexes for strings sent by the host via ACCESSORY_SEND_STRING */
+#define ACCESSORY_STRING_MANUFACTURER 0
+#define ACCESSORY_STRING_MODEL 1
+#define ACCESSORY_STRING_DESCRIPTION 2
+#define ACCESSORY_STRING_VERSION 3
+#define ACCESSORY_STRING_URI 4
+#define ACCESSORY_STRING_SERIAL 5
+
+/* Control request for retrieving device's protocol version (currently 1)
+ *
+ * requestType: USB_DIR_IN | USB_TYPE_VENDOR
+ * request: ACCESSORY_GET_PROTOCOL
+ * value: 0
+ * index: 0
+ * data version number (16 bits little endian)
+ */
+#define ACCESSORY_GET_PROTOCOL 51
+
+/* Control request for host to send a string to the device
+ *
+ * requestType: USB_DIR_OUT | USB_TYPE_VENDOR
+ * request: ACCESSORY_SEND_STRING
+ * value: 0
+ * index: string ID
+ * data zero terminated UTF8 string
+ *
+ * The device can later retrieve these strings via the
+ * ACCESSORY_GET_STRING_* ioctls
+ */
+#define ACCESSORY_SEND_STRING 52
+
+/* Control request for starting device in accessory mode.
+ * The host sends this after setting all its strings to the device.
+ *
+ * requestType: USB_DIR_OUT | USB_TYPE_VENDOR
+ * request: ACCESSORY_START
+ * value: 0
+ * index: 0
+ * data none
+ */
+#define ACCESSORY_START 53
+
+/* ioctls for retrieving strings set by the host */
+#define ACCESSORY_GET_STRING_MANUFACTURER _IOW('M', 1, char[256])
+#define ACCESSORY_GET_STRING_MODEL _IOW('M', 2, char[256])
+#define ACCESSORY_GET_STRING_DESCRIPTION _IOW('M', 3, char[256])
+#define ACCESSORY_GET_STRING_VERSION _IOW('M', 4, char[256])
+#define ACCESSORY_GET_STRING_URI _IOW('M', 5, char[256])
+#define ACCESSORY_GET_STRING_SERIAL _IOW('M', 6, char[256])
+/* returns 1 if there is a start request pending */
+#define ACCESSORY_IS_START_REQUESTED _IO('M', 7)
+
+#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 0000000..7422b17
--- /dev/null
+++ b/include/linux/usb/f_mtp.h
@@ -0,0 +1,75 @@
+/*
+ * Gadget Function Driver for MTP
+ *
+ * Copyright (C) 2010 Google, Inc.
+ * Author: Mike Lockwood <lockwood@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __LINUX_USB_F_MTP_H
+#define __LINUX_USB_F_MTP_H
+
+#include <linux/ioctl.h>
+
+#ifdef __KERNEL__
+
+struct mtp_data_header {
+ /* length of packet, including this header */
+ uint32_t length;
+ /* container type (2 for data packet) */
+ uint16_t type;
+ /* MTP command code */
+ uint16_t command;
+ /* MTP transaction ID */
+ uint32_t transaction_id;
+};
+
+#endif /* __KERNEL__ */
+
+struct mtp_file_range {
+ /* file descriptor for file to transfer */
+ int fd;
+ /* offset in file for start of transfer */
+ loff_t offset;
+ /* number of bytes to transfer */
+ int64_t length;
+ /* MTP command ID for data header,
+ * used only for MTP_SEND_FILE_WITH_HEADER
+ */
+ uint16_t command;
+ /* MTP transaction ID for data header,
+ * used only for MTP_SEND_FILE_WITH_HEADER
+ */
+ uint32_t transaction_id;
+};
+
+struct mtp_event {
+ /* size of the event */
+ size_t length;
+ /* event data to send */
+ void *data;
+};
+
+/* Sends the specified file range to the host */
+#define MTP_SEND_FILE _IOW('M', 0, struct mtp_file_range)
+/* Receives data from the host and writes it to a file.
+ * The file is created if it does not exist.
+ */
+#define MTP_RECEIVE_FILE _IOW('M', 1, struct mtp_file_range)
+/* Sends an event to the host via the interrupt endpoint */
+#define MTP_SEND_EVENT _IOW('M', 3, struct mtp_event)
+/* Sends the specified file range to the host,
+ * with a 12 byte MTP data packet header at the beginning.
+ */
+#define MTP_SEND_FILE_WITH_HEADER _IOW('M', 4, struct mtp_file_range)
+
+#endif /* __LINUX_USB_F_MTP_H */
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index dd1571d..fc450a7 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -131,6 +131,7 @@ struct usb_ep_ops {
* @maxpacket:The maximum packet size used on this endpoint. The initial
* value can sometimes be reduced (hardware allowing), according to
* the endpoint descriptor used to configure the endpoint.
+ * @maxburst: The maximum burst size.
* @driver_data:for use by the gadget driver. all other fields are
* read-only to gadget drivers.
*
@@ -145,6 +146,9 @@ struct usb_ep {
const struct usb_ep_ops *ops;
struct list_head ep_list;
unsigned maxpacket:16;
+
+ unsigned numstreams:5;
+ unsigned maxburst:4;
};
/*-------------------------------------------------------------------------*/
@@ -416,6 +420,13 @@ static inline void usb_ep_fifo_flush(struct usb_ep *ep)
/*-------------------------------------------------------------------------*/
+struct usb_dcd_config_params {
+ __u8 bU1devExitLat; /* U1 Device exit Latency */
+#define USB_DEFAULT_U1_DEV_EXIT_LAT 0x01 /* Less then 1 microsec */
+ __le16 bU2DevExitLat; /* U2 Device exit Latency */
+#define USB_DEFAULT_U2_DEV_EXIT_LAT 0x1F4 /* Less then 500 microsec */
+};
+
struct usb_gadget;
/* the rest of the api to the controller hardware: device operations,
@@ -430,6 +441,7 @@ struct usb_gadget_ops {
int (*pullup) (struct usb_gadget *, int is_on);
int (*ioctl)(struct usb_gadget *,
unsigned code, unsigned long param);
+ void (*get_config_params)(struct usb_dcd_config_params *);
};
/**
@@ -521,6 +533,24 @@ static inline int gadget_is_dualspeed(struct usb_gadget *g)
}
/**
+ * gadget_is_superspeed() - return true if the hardware handles
+ * supperspeed
+ * @g: controller that might support supper speed
+ */
+static inline int gadget_is_superspeed(struct usb_gadget *g)
+{
+#ifdef CONFIG_USB_GADGET_SUPERSPEED
+ /*
+ * runtime test would check "g->is_superspeed" ... that might be
+ * useful to work around hardware bugs, but is mostly pointless
+ */
+ return 1;
+#else
+ return 0;
+#endif
+}
+
+/**
* gadget_is_otg - return true iff the hardware is OTG-ready
* @g: controller that might have a Mini-AB connector
*
@@ -671,6 +701,7 @@ static inline int usb_gadget_vbus_disconnect(struct usb_gadget *gadget)
*/
static inline int usb_gadget_connect(struct usb_gadget *gadget)
{
+ printk(KERN_DEBUG "usb: %s\n", __func__);
if (!gadget->ops->pullup)
return -EOPNOTSUPP;
return gadget->ops->pullup(gadget, 1);
@@ -693,6 +724,7 @@ static inline int usb_gadget_connect(struct usb_gadget *gadget)
*/
static inline int usb_gadget_disconnect(struct usb_gadget *gadget)
{
+ printk(KERN_DEBUG "usb: %s\n", __func__);
if (!gadget->ops->pullup)
return -EOPNOTSUPP;
return gadget->ops->pullup(gadget, 0);
diff --git a/include/linux/usb/otg_id.h b/include/linux/usb/otg_id.h
new file mode 100644
index 0000000..f9f5189
--- /dev/null
+++ b/include/linux/usb/otg_id.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2011 Google, Inc.
+ *
+ * Author:
+ * Colin Cross <ccross@android.com>
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __LINUX_USB_OTG_ID_H
+#define __LINUX_USB_OTG_ID_H
+
+#include <linux/notifier.h>
+#include <linux/plist.h>
+
+/**
+ * otg_id_notifier_block
+ *
+ * @priority: Order the notifications will be called in. Higher numbers
+ * get called first.
+ * @detect: Called during otg_id_notify. Return OTG_ID_HANDLED if the USB cable
+ * has been identified
+ * @proxy_wait: Called during otg_id_notify if a previous handler returns
+ * OTG_ID_PROXY_WAIT. This should wait on ID change then call otg_id_notify.
+ * This is used when a handler knows what's connected but can't detect
+ * the change itself.
+ * @cancel: Called after detect has returned OTG_ID_HANDLED to ask it to
+ * release detection resources to allow a new identification to occur.
+ */
+
+struct otg_id_notifier_block {
+ int priority;
+ int (*detect)(struct otg_id_notifier_block *otg_id_nb);
+ int (*proxy_wait)(struct otg_id_notifier_block *otg_id_nb);
+ void (*cancel)(struct otg_id_notifier_block *otg_id_nb);
+ struct plist_node p;
+};
+
+#define OTG_ID_PROXY_WAIT 2
+#define OTG_ID_HANDLED 1
+#define OTG_ID_UNHANDLED 0
+
+int otg_id_register_notifier(struct otg_id_notifier_block *otg_id_nb);
+void otg_id_unregister_notifier(struct otg_id_notifier_block *otg_id_nb);
+
+void otg_id_notify(void);
+int otg_id_suspend(void);
+void otg_id_resume(void);
+
+#endif /* __LINUX_USB_OTG_ID_H */
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 3e93de7..ef75b0b 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -30,4 +30,13 @@
descriptor */
#define USB_QUIRK_DELAY_INIT 0x00000040
+/* device does not support reset-resume */
+#define USB_QUIRK_NO_RESET_RESUME 0x00000080
+
+/* device does not need GET_STATUS request */
+#define USB_QUIRK_NO_GET_STATUS 0x00000100
+
+/* device needs hsic specific tunning */
+#define USB_QUIRK_HSIC_TUNE 0x00000200
+
#endif /* __LINUX_USB_QUIRKS_H */
diff --git a/include/linux/v4l2-mediabus.h b/include/linux/v4l2-mediabus.h
index 5ea7f75..1a13cf3 100644
--- a/include/linux/v4l2-mediabus.h
+++ b/include/linux/v4l2-mediabus.h
@@ -46,6 +46,7 @@ enum v4l2_mbus_pixelcode {
V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006,
V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007,
V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008,
+ V4L2_MBUS_FMT_XRGB8888_4X8_LE = 0x1009,
/* YUV (including grey) - next is 0x2014 */
V4L2_MBUS_FMT_Y8_1X8 = 0x2001,
@@ -65,6 +66,7 @@ enum v4l2_mbus_pixelcode {
V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010,
V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011,
V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012,
+ V4L2_MBUS_FMT_YUV8_1X24 = 0x2014,
V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d,
V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e,
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 8a4c309..a464469 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -185,6 +185,7 @@ enum v4l2_memory {
V4L2_MEMORY_MMAP = 1,
V4L2_MEMORY_USERPTR = 2,
V4L2_MEMORY_OVERLAY = 3,
+ V4L2_MEMORY_DMABUF = 4,
};
/* see also http://vektor.theorem.ca/graphics/ycbcr/ */
@@ -343,10 +344,12 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */
#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */
#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */
+#define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */
+#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */
/* two non contiguous planes - one Y, one Cr + Cb interleaved */
-#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
-#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
+#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */
+#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
/* three non contiguous planes - Y, Cb, Cr */
#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */
@@ -376,7 +379,16 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */
#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */
#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */
-#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 */
+#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 Multiplexed */
+#define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /* H264 with start codes */
+#define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1') /* H264 without start codes */
+#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */
+#define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES */
+#define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES */
+#define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 ES */
+#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */
+#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */
+#define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */
/* Vendor-specific formats */
#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */
@@ -392,6 +404,7 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */
#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */
#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */
+#define V4L2_PIX_FMT_JL2005BCD v4l2_fourcc('J', 'L', '2', '0') /* compressed RGGB bayer */
#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */
#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */
#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */
@@ -402,6 +415,9 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */
#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */
#define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */
+/* RGB x:10:10:10 */
+#define V4L2_PIX_FMT_INTC_RGB30 v4l2_fourcc('R', 'G', 'B', '0')
+#define V4L2_PIX_FMT_SE401 v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */
/*
* F O R M A T E N U M E R A T I O N
@@ -564,6 +580,8 @@ struct v4l2_requestbuffers {
* should be passed to mmap() called on the video node)
* @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer
* pointing to this plane
+ * @fd: when memory is V4L2_MEMORY_DMABUF, a userspace file
+ * descriptor associated with this plane
* @data_offset: offset in the plane to the start of data; usually 0,
* unless there is a header in front of the data
*
@@ -578,6 +596,7 @@ struct v4l2_plane {
union {
__u32 mem_offset;
unsigned long userptr;
+ int fd;
} m;
__u32 data_offset;
__u32 reserved[11];
@@ -600,6 +619,9 @@ struct v4l2_plane {
* (or a "cookie" that should be passed to mmap() as offset)
* @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR;
* a userspace pointer pointing to this buffer
+ * @fd: for non-multiplanar buffers with
+ * memory == V4L2_MEMORY_DMABUF; a userspace file descriptor
+ * associated with this buffer
* @planes: for multiplanar buffers; userspace pointer to the array of plane
* info structs for this buffer
* @length: size in bytes of the buffer (NOT its payload) for single-plane
@@ -626,6 +648,7 @@ struct v4l2_buffer {
__u32 offset;
unsigned long userptr;
struct v4l2_plane *planes;
+ int fd;
} m;
__u32 length;
__u32 input;
@@ -643,6 +666,10 @@ struct v4l2_buffer {
#define V4L2_BUF_FLAG_ERROR 0x0040
#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */
#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */
+#define V4L2_BUF_FLAG_PREPARED 0x0400 /* Buffer is prepared for queuing */
+/* Cache handling flags */
+#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800
+#define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000
/*
* O V E R L A Y P R E V I E W
@@ -728,6 +755,48 @@ struct v4l2_crop {
struct v4l2_rect c;
};
+/* Hints for adjustments of selection rectangle */
+#define V4L2_SEL_FLAG_GE 0x00000001
+#define V4L2_SEL_FLAG_LE 0x00000002
+
+/* Selection targets */
+
+/* current cropping area */
+#define V4L2_SEL_TGT_CROP_ACTIVE 0
+/* default cropping area */
+#define V4L2_SEL_TGT_CROP_DEFAULT 1
+/* cropping bounds */
+#define V4L2_SEL_TGT_CROP_BOUNDS 2
+/* current composing area */
+#define V4L2_SEL_TGT_COMPOSE_ACTIVE 256
+/* default composing area */
+#define V4L2_SEL_TGT_COMPOSE_DEFAULT 257
+/* composing bounds */
+#define V4L2_SEL_TGT_COMPOSE_BOUNDS 258
+/* current composing area plus all padding pixels */
+#define V4L2_SEL_TGT_COMPOSE_PADDED 259
+
+/**
+ * struct v4l2_selection - selection info
+ * @type: buffer type (do not use *_MPLANE types)
+ * @target: selection target, used to choose one of possible rectangles
+ * @flags: constraints flags
+ * @r: coordinates of selection window
+ * @reserved: for future use, rounds structure size to 64 bytes, set to zero
+ *
+ * Hardware may use multiple helper window to process a video stream.
+ * The structure is used to exchange this selection areas between
+ * an application and a driver.
+ */
+struct v4l2_selection {
+ __u32 type;
+ __u32 target;
+ __u32 flags;
+ struct v4l2_rect r;
+ __u32 reserved[9];
+};
+
+
/*
* A N A L O G V I D E O S T A N D A R D
*/
@@ -749,10 +818,10 @@ typedef __u64 v4l2_std_id;
#define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400)
#define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800)
-#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000)
-#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000)
+#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) /* BTSC */
+#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) /* EIA-J */
#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000)
-#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000)
+#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) /* FM A2 */
#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000)
#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000)
@@ -776,47 +845,86 @@ typedef __u64 v4l2_std_id;
v4l2-common.c should be fixed.
*/
-/* some merged standards */
-#define V4L2_STD_MN (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC)
-#define V4L2_STD_B (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B)
-#define V4L2_STD_GH (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H)
-#define V4L2_STD_DK (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK)
+/*
+ * Some macros to merge video standards in order to make live easier for the
+ * drivers and V4L2 applications
+ */
-/* some common needed stuff */
-#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\
- V4L2_STD_PAL_B1 |\
- V4L2_STD_PAL_G)
-#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\
- V4L2_STD_PAL_D1 |\
- V4L2_STD_PAL_K)
-#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\
- V4L2_STD_PAL_DK |\
- V4L2_STD_PAL_H |\
- V4L2_STD_PAL_I)
+/*
+ * "Common" NTSC/M - It should be noticed that V4L2_STD_NTSC_443 is
+ * Missing here.
+ */
#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\
V4L2_STD_NTSC_M_JP |\
V4L2_STD_NTSC_M_KR)
+/* Secam macros */
#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\
V4L2_STD_SECAM_K |\
V4L2_STD_SECAM_K1)
+/* All Secam Standards */
#define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\
V4L2_STD_SECAM_G |\
V4L2_STD_SECAM_H |\
V4L2_STD_SECAM_DK |\
V4L2_STD_SECAM_L |\
V4L2_STD_SECAM_LC)
+/* PAL macros */
+#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\
+ V4L2_STD_PAL_B1 |\
+ V4L2_STD_PAL_G)
+#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\
+ V4L2_STD_PAL_D1 |\
+ V4L2_STD_PAL_K)
+/*
+ * "Common" PAL - This macro is there to be compatible with the old
+ * V4L1 concept of "PAL": /BGDKHI.
+ * Several PAL standards are mising here: /M, /N and /Nc
+ */
+#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\
+ V4L2_STD_PAL_DK |\
+ V4L2_STD_PAL_H |\
+ V4L2_STD_PAL_I)
+/* Chroma "agnostic" standards */
+#define V4L2_STD_B (V4L2_STD_PAL_B |\
+ V4L2_STD_PAL_B1 |\
+ V4L2_STD_SECAM_B)
+#define V4L2_STD_G (V4L2_STD_PAL_G |\
+ V4L2_STD_SECAM_G)
+#define V4L2_STD_H (V4L2_STD_PAL_H |\
+ V4L2_STD_SECAM_H)
+#define V4L2_STD_L (V4L2_STD_SECAM_L |\
+ V4L2_STD_SECAM_LC)
+#define V4L2_STD_GH (V4L2_STD_G |\
+ V4L2_STD_H)
+#define V4L2_STD_DK (V4L2_STD_PAL_DK |\
+ V4L2_STD_SECAM_DK)
+#define V4L2_STD_BG (V4L2_STD_B |\
+ V4L2_STD_G)
+#define V4L2_STD_MN (V4L2_STD_PAL_M |\
+ V4L2_STD_PAL_N |\
+ V4L2_STD_PAL_Nc |\
+ V4L2_STD_NTSC)
+/* Standards where MTS/BTSC stereo could be found */
+#define V4L2_STD_MTS (V4L2_STD_NTSC_M |\
+ V4L2_STD_PAL_M |\
+ V4L2_STD_PAL_N |\
+ V4L2_STD_PAL_Nc)
+
+/* Standards for Countries with 60Hz Line frequency */
#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\
V4L2_STD_PAL_60 |\
V4L2_STD_NTSC |\
V4L2_STD_NTSC_443)
+/* Standards for Countries with 50Hz Line frequency */
#define V4L2_STD_625_50 (V4L2_STD_PAL |\
V4L2_STD_PAL_N |\
V4L2_STD_PAL_Nc |\
V4L2_STD_SECAM)
+
#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\
V4L2_STD_ATSC_16_VSB)
-
+/* Macros with none and all analog standards */
#define V4L2_STD_UNKNOWN 0
#define V4L2_STD_ALL (V4L2_STD_525_60 |\
V4L2_STD_625_50)
@@ -873,6 +981,34 @@ struct v4l2_dv_enum_preset {
#define V4L2_DV_1080P50 17 /* BT.1120 */
#define V4L2_DV_1080P60 18 /* BT.1120 */
+#define V4L2_DV_480P60 19
+#define V4L2_DV_1080I59_94 20
+#define V4L2_DV_1080P59_94 21
+
+#define V4L2_DV_720P60_FP 22
+#define V4L2_DV_720P60_SB_HALF 23
+#define V4L2_DV_720P60_TB 24
+#define V4L2_DV_720P59_94_FP 25
+#define V4L2_DV_720P59_94_SB_HALF 26
+#define V4L2_DV_720P59_94_TB 27
+#define V4L2_DV_720P50_FP 28
+#define V4L2_DV_720P50_SB_HALF 29
+#define V4L2_DV_720P50_TB 30
+#define V4L2_DV_1080P24_FP 31
+#define V4L2_DV_1080P24_SB_HALF 32
+#define V4L2_DV_1080P24_TB 33
+#define V4L2_DV_1080P23_98_FP 34
+#define V4L2_DV_1080P23_98_SB_HALF 35
+#define V4L2_DV_1080P23_98_TB 36
+#define V4L2_DV_1080I60_SB_HALF 37
+#define V4L2_DV_1080I59_94_SB_HALF 38
+#define V4L2_DV_1080I50_SB_HALF 39
+#define V4L2_DV_1080P60_SB_HALF 40
+#define V4L2_DV_1080P60_TB 41
+#define V4L2_DV_1080P30_FP 42
+#define V4L2_DV_1080P30_SB_HALF 43
+#define V4L2_DV_1080P30_TB 44
+
/*
* D V B T T I M I N G S
*/
@@ -1026,6 +1162,8 @@ struct v4l2_ext_controls {
#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */
#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */
#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */
+#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */
+#define V4L2_CTRL_CLASS_FM_RX 0x009d0000 /* FM Tuner control class */
#define V4L2_CTRL_ID_MASK (0x0fffffff)
#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL)
@@ -1039,6 +1177,7 @@ enum v4l2_ctrl_type {
V4L2_CTRL_TYPE_INTEGER64 = 5,
V4L2_CTRL_TYPE_CTRL_CLASS = 6,
V4L2_CTRL_TYPE_STRING = 7,
+ V4L2_CTRL_TYPE_BITMASK = 8,
};
/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
@@ -1070,11 +1209,13 @@ struct v4l2_querymenu {
#define V4L2_CTRL_FLAG_INACTIVE 0x0010
#define V4L2_CTRL_FLAG_SLIDER 0x0020
#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040
+#define V4L2_CTRL_FLAG_VOLATILE 0x0080
/* Query flag, to be ORed with the control ID */
#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000
/* User-class control IDs defined by V4L2 */
+#define V4L2_CID_MAX_CTRLS 1024
#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900)
#define V4L2_CID_USER_BASE V4L2_CID_BASE
/* IDs reserved for driver specific controls */
@@ -1113,6 +1254,7 @@ enum v4l2_power_line_frequency {
V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0,
V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1,
V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2,
+ V4L2_CID_POWER_LINE_FREQUENCY_AUTO = 3,
};
#define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25)
#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26)
@@ -1144,14 +1286,19 @@ enum v4l2_colorfx {
#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37)
#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38)
+#define V4L2_CID_MIN_BUFFERS_FOR_CAPTURE (V4L2_CID_BASE+39)
+#define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40)
+
+#define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41)
+
/* last CID + 1 */
-#define V4L2_CID_LASTP1 (V4L2_CID_BASE+39)
+#define V4L2_CID_LASTP1 (V4L2_CID_BASE+42)
/* MPEG-class control IDs defined by V4L2 */
#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900)
#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1)
-/* MPEG streams */
+/* MPEG streams, specific to multiplexed streams */
#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0)
enum v4l2_mpeg_stream_type {
V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */
@@ -1173,7 +1320,7 @@ enum v4l2_mpeg_stream_vbi_fmt {
V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */
};
-/* MPEG audio */
+/* MPEG audio controls specific to multiplexed streams */
#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100)
enum v4l2_mpeg_audio_sampling_freq {
V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0,
@@ -1289,7 +1436,7 @@ enum v4l2_mpeg_audio_ac3_bitrate {
V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18,
};
-/* MPEG video */
+/* MPEG video controls specific to multiplexed streams */
#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200)
enum v4l2_mpeg_video_encoding {
V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0,
@@ -1317,6 +1464,141 @@ enum v4l2_mpeg_video_bitrate_mode {
#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209)
#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210)
#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211)
+#define V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE (V4L2_CID_MPEG_BASE+212)
+#define V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER (V4L2_CID_MPEG_BASE+213)
+#define V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB (V4L2_CID_MPEG_BASE+214)
+#define V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE (V4L2_CID_MPEG_BASE+215)
+#define V4L2_CID_MPEG_VIDEO_HEADER_MODE (V4L2_CID_MPEG_BASE+216)
+enum v4l2_mpeg_video_header_mode {
+ V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE = 0,
+ V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME = 1,
+
+};
+#define V4L2_CID_MPEG_VIDEO_MAX_REF_PIC (V4L2_CID_MPEG_BASE+217)
+#define V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE (V4L2_CID_MPEG_BASE+218)
+#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES (V4L2_CID_MPEG_BASE+219)
+#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB (V4L2_CID_MPEG_BASE+220)
+#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE+221)
+enum v4l2_mpeg_video_multi_slice_mode {
+ V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0,
+ V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1,
+ V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2,
+};
+#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222)
+#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
+#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
+#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302)
+#define V4L2_CID_MPEG_VIDEO_H263_MIN_QP (V4L2_CID_MPEG_BASE+303)
+#define V4L2_CID_MPEG_VIDEO_H263_MAX_QP (V4L2_CID_MPEG_BASE+304)
+#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP (V4L2_CID_MPEG_BASE+350)
+#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP (V4L2_CID_MPEG_BASE+351)
+#define V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP (V4L2_CID_MPEG_BASE+352)
+#define V4L2_CID_MPEG_VIDEO_H264_MIN_QP (V4L2_CID_MPEG_BASE+353)
+#define V4L2_CID_MPEG_VIDEO_H264_MAX_QP (V4L2_CID_MPEG_BASE+354)
+#define V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM (V4L2_CID_MPEG_BASE+355)
+#define V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE (V4L2_CID_MPEG_BASE+356)
+#define V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE (V4L2_CID_MPEG_BASE+357)
+enum v4l2_mpeg_video_h264_entropy_mode {
+ V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC = 0,
+ V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC = 1,
+};
+#define V4L2_CID_MPEG_VIDEO_H264_I_PERIOD (V4L2_CID_MPEG_BASE+358)
+#define V4L2_CID_MPEG_VIDEO_H264_LEVEL (V4L2_CID_MPEG_BASE+359)
+enum v4l2_mpeg_video_h264_level {
+ V4L2_MPEG_VIDEO_H264_LEVEL_1_0 = 0,
+ V4L2_MPEG_VIDEO_H264_LEVEL_1B = 1,
+ V4L2_MPEG_VIDEO_H264_LEVEL_1_1 = 2,
+ V4L2_MPEG_VIDEO_H264_LEVEL_1_2 = 3,
+ V4L2_MPEG_VIDEO_H264_LEVEL_1_3 = 4,
+ V4L2_MPEG_VIDEO_H264_LEVEL_2_0 = 5,
+ V4L2_MPEG_VIDEO_H264_LEVEL_2_1 = 6,
+ V4L2_MPEG_VIDEO_H264_LEVEL_2_2 = 7,
+ V4L2_MPEG_VIDEO_H264_LEVEL_3_0 = 8,
+ V4L2_MPEG_VIDEO_H264_LEVEL_3_1 = 9,
+ V4L2_MPEG_VIDEO_H264_LEVEL_3_2 = 10,
+ V4L2_MPEG_VIDEO_H264_LEVEL_4_0 = 11,
+ V4L2_MPEG_VIDEO_H264_LEVEL_4_1 = 12,
+ V4L2_MPEG_VIDEO_H264_LEVEL_4_2 = 13,
+ V4L2_MPEG_VIDEO_H264_LEVEL_5_0 = 14,
+ V4L2_MPEG_VIDEO_H264_LEVEL_5_1 = 15,
+};
+#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA (V4L2_CID_MPEG_BASE+360)
+#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA (V4L2_CID_MPEG_BASE+361)
+#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE (V4L2_CID_MPEG_BASE+362)
+enum v4l2_mpeg_video_h264_loop_filter_mode {
+ V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED = 0,
+ V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED = 1,
+ V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY = 2,
+};
+#define V4L2_CID_MPEG_VIDEO_H264_PROFILE (V4L2_CID_MPEG_BASE+363)
+enum v4l2_mpeg_video_h264_profile {
+ V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE = 0,
+ V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE = 1,
+ V4L2_MPEG_VIDEO_H264_PROFILE_MAIN = 2,
+ V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED = 3,
+ V4L2_MPEG_VIDEO_H264_PROFILE_HIGH = 4,
+ V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10 = 5,
+ V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422 = 6,
+ V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE = 7,
+ V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10_INTRA = 8,
+ V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA = 9,
+ V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_INTRA = 10,
+ V4L2_MPEG_VIDEO_H264_PROFILE_CAVLC_444_INTRA = 11,
+ V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_BASELINE = 12,
+ V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH = 13,
+ V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA = 14,
+ V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH = 15,
+ V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH = 16,
+};
+#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT (V4L2_CID_MPEG_BASE+364)
+#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH (V4L2_CID_MPEG_BASE+365)
+#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE (V4L2_CID_MPEG_BASE+366)
+#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC (V4L2_CID_MPEG_BASE+367)
+enum v4l2_mpeg_video_h264_vui_sar_idc {
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED = 0,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1 = 1,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_12x11 = 2,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_10x11 = 3,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_16x11 = 4,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_40x33 = 5,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_24x11 = 6,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_20x11 = 7,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_32x11 = 8,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_80x33 = 9,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_18x11 = 10,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_15x11 = 11,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_64x33 = 12,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_160x99 = 13,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_4x3 = 14,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_3x2 = 15,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_2x1 = 16,
+ V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED = 17,
+};
+#define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (V4L2_CID_MPEG_BASE+400)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP (V4L2_CID_MPEG_BASE+401)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP (V4L2_CID_MPEG_BASE+402)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP (V4L2_CID_MPEG_BASE+403)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP (V4L2_CID_MPEG_BASE+404)
+#define V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL (V4L2_CID_MPEG_BASE+405)
+enum v4l2_mpeg_video_mpeg4_level {
+ V4L2_MPEG_VIDEO_MPEG4_LEVEL_0 = 0,
+ V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B = 1,
+ V4L2_MPEG_VIDEO_MPEG4_LEVEL_1 = 2,
+ V4L2_MPEG_VIDEO_MPEG4_LEVEL_2 = 3,
+ V4L2_MPEG_VIDEO_MPEG4_LEVEL_3 = 4,
+ V4L2_MPEG_VIDEO_MPEG4_LEVEL_3B = 5,
+ V4L2_MPEG_VIDEO_MPEG4_LEVEL_4 = 6,
+ V4L2_MPEG_VIDEO_MPEG4_LEVEL_5 = 7,
+};
+#define V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE (V4L2_CID_MPEG_BASE+406)
+enum v4l2_mpeg_video_mpeg4_profile {
+ V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE = 0,
+ V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE = 1,
+ V4L2_MPEG_VIDEO_MPEG4_PROFILE_CORE = 2,
+ V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE_SCALABLE = 3,
+ V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 4,
+};
+#define V4L2_CID_MPEG_VIDEO_MPEG4_QPEL (V4L2_CID_MPEG_BASE+407)
/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */
#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000)
@@ -1359,6 +1641,33 @@ enum v4l2_mpeg_cx2341x_video_median_filter_type {
#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10)
#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11)
+/* MPEG-class control IDs specific to the Samsung MFC 5.1 driver as defined by V4L2 */
+#define V4L2_CID_MPEG_MFC51_BASE (V4L2_CTRL_CLASS_MPEG | 0x1100)
+
+#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY (V4L2_CID_MPEG_MFC51_BASE+0)
+#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE (V4L2_CID_MPEG_MFC51_BASE+1)
+#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE (V4L2_CID_MPEG_MFC51_BASE+2)
+enum v4l2_mpeg_mfc51_video_frame_skip_mode {
+ V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_DISABLED = 0,
+ V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT = 1,
+ V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT = 2,
+};
+#define V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE (V4L2_CID_MPEG_MFC51_BASE+3)
+enum v4l2_mpeg_mfc51_video_force_frame_type {
+ V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_DISABLED = 0,
+ V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME = 1,
+ V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_NOT_CODED = 2,
+};
+#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING (V4L2_CID_MPEG_MFC51_BASE+4)
+#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING_YUV (V4L2_CID_MPEG_MFC51_BASE+5)
+#define V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT (V4L2_CID_MPEG_MFC51_BASE+6)
+#define V4L2_CID_MPEG_MFC51_VIDEO_RC_REACTION_COEFF (V4L2_CID_MPEG_MFC51_BASE+7)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_ACTIVITY (V4L2_CID_MPEG_MFC51_BASE+50)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_DARK (V4L2_CID_MPEG_MFC51_BASE+51)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_SMOOTH (V4L2_CID_MPEG_MFC51_BASE+52)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC (V4L2_CID_MPEG_MFC51_BASE+53)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P (V4L2_CID_MPEG_MFC51_BASE+54)
+
/* Camera class control IDs */
#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900)
#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1)
@@ -1426,6 +1735,53 @@ enum v4l2_preemphasis {
};
#define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113)
#define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114)
+/* FM Tuner class control IDs */
+#define V4L2_CID_FM_RX_CLASS_BASE (V4L2_CTRL_CLASS_FM_RX | 0x900)
+#define V4L2_CID_FM_RX_CLASS (V4L2_CTRL_CLASS_FM_RX | 1)
+
+#define V4L2_CID_TUNE_DEEMPHASIS (V4L2_CID_FM_RX_CLASS_BASE + 1)
+enum v4l2_deemphasis {
+ V4L2_DEEMPHASIS_DISABLED = 0,
+ V4L2_DEEMPHASIS_50_uS = 1,
+ V4L2_DEEMPHASIS_75_uS = 2,
+};
+
+/* Flash and privacy (indicator) light controls */
+#define V4L2_CID_FLASH_CLASS_BASE (V4L2_CTRL_CLASS_FLASH | 0x900)
+#define V4L2_CID_FLASH_CLASS (V4L2_CTRL_CLASS_FLASH | 1)
+
+#define V4L2_CID_FLASH_LED_MODE (V4L2_CID_FLASH_CLASS_BASE + 1)
+enum v4l2_flash_led_mode {
+ V4L2_FLASH_LED_MODE_NONE,
+ V4L2_FLASH_LED_MODE_FLASH,
+ V4L2_FLASH_LED_MODE_TORCH,
+};
+
+#define V4L2_CID_FLASH_STROBE_SOURCE (V4L2_CID_FLASH_CLASS_BASE + 2)
+enum v4l2_flash_strobe_source {
+ V4L2_FLASH_STROBE_SOURCE_SOFTWARE,
+ V4L2_FLASH_STROBE_SOURCE_EXTERNAL,
+};
+
+#define V4L2_CID_FLASH_STROBE (V4L2_CID_FLASH_CLASS_BASE + 3)
+#define V4L2_CID_FLASH_STROBE_STOP (V4L2_CID_FLASH_CLASS_BASE + 4)
+#define V4L2_CID_FLASH_STROBE_STATUS (V4L2_CID_FLASH_CLASS_BASE + 5)
+
+#define V4L2_CID_FLASH_TIMEOUT (V4L2_CID_FLASH_CLASS_BASE + 6)
+#define V4L2_CID_FLASH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 7)
+#define V4L2_CID_FLASH_TORCH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 8)
+#define V4L2_CID_FLASH_INDICATOR_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 9)
+
+#define V4L2_CID_FLASH_FAULT (V4L2_CID_FLASH_CLASS_BASE + 10)
+#define V4L2_FLASH_FAULT_OVER_VOLTAGE (1 << 0)
+#define V4L2_FLASH_FAULT_TIMEOUT (1 << 1)
+#define V4L2_FLASH_FAULT_OVER_TEMPERATURE (1 << 2)
+#define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3)
+#define V4L2_FLASH_FAULT_OVER_CURRENT (1 << 4)
+#define V4L2_FLASH_FAULT_INDICATOR (1 << 5)
+
+#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11)
+#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12)
/*
* T U N I N G
@@ -1791,6 +2147,8 @@ struct v4l2_streamparm {
#define V4L2_EVENT_ALL 0
#define V4L2_EVENT_VSYNC 1
#define V4L2_EVENT_EOS 2
+#define V4L2_EVENT_CTRL 3
+#define V4L2_EVENT_FRAME_SYNC 4
#define V4L2_EVENT_PRIVATE_START 0x08000000
/* Payload for V4L2_EVENT_VSYNC */
@@ -1799,21 +2157,51 @@ struct v4l2_event_vsync {
__u8 field;
} __attribute__ ((packed));
+/* Payload for V4L2_EVENT_CTRL */
+#define V4L2_EVENT_CTRL_CH_VALUE (1 << 0)
+#define V4L2_EVENT_CTRL_CH_FLAGS (1 << 1)
+
+struct v4l2_event_ctrl {
+ __u32 changes;
+ __u32 type;
+ union {
+ __s32 value;
+ __s64 value64;
+ };
+ __u32 flags;
+ __s32 minimum;
+ __s32 maximum;
+ __s32 step;
+ __s32 default_value;
+};
+
+struct v4l2_event_frame_sync {
+ __u32 frame_sequence;
+};
+
struct v4l2_event {
__u32 type;
union {
struct v4l2_event_vsync vsync;
+ struct v4l2_event_ctrl ctrl;
+ struct v4l2_event_frame_sync frame_sync;
__u8 data[64];
} u;
__u32 pending;
__u32 sequence;
struct timespec timestamp;
- __u32 reserved[9];
+ __u32 id;
+ __u32 reserved[8];
};
+#define V4L2_EVENT_SUB_FL_SEND_INITIAL (1 << 0)
+#define V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK (1 << 1)
+
struct v4l2_event_subscription {
__u32 type;
- __u32 reserved[7];
+ __u32 id;
+ __u32 flags;
+ __u32 reserved[5];
};
/*
@@ -1852,6 +2240,23 @@ struct v4l2_dbg_chip_ident {
__u32 revision; /* chip revision, chip specific */
} __attribute__ ((packed));
+/**
+ * struct v4l2_create_buffers - VIDIOC_CREATE_BUFS argument
+ * @index: on return, index of the first created buffer
+ * @count: entry: number of requested buffers,
+ * return: number of created buffers
+ * @memory: buffer memory type
+ * @format: frame format, for which buffers are requested
+ * @reserved: future extensions
+ */
+struct v4l2_create_buffers {
+ __u32 index;
+ __u32 count;
+ enum v4l2_memory memory;
+ struct v4l2_format format;
+ __u32 reserved[8];
+};
+
/*
* I O C T L C O D E S F O R V I D E O D E V I C E S
*
@@ -1942,6 +2347,15 @@ struct v4l2_dbg_chip_ident {
#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription)
#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription)
+/* Experimental, the below two ioctls may change over the next couple of kernel
+ versions */
+#define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers)
+#define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer)
+
+/* Experimental selection API */
+#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection)
+#define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection)
+
/* Reminder: when adding new ioctls please add support for them to
drivers/media/video/v4l2-compat-ioctl32.c as well! */
diff --git a/include/linux/videodev2_exynos_camera.h b/include/linux/videodev2_exynos_camera.h
new file mode 100644
index 0000000..b9967ce
--- /dev/null
+++ b/include/linux/videodev2_exynos_camera.h
@@ -0,0 +1,1363 @@
+/*
+ * Video for Linux Two header file for samsung
+ *
+ * Copyright (C) 2009, Dongsoo Nathaniel Kim<dongsoo45.kim@samsung.com>
+ *
+ * This header file contains several v4l2 APIs to be proposed to v4l2
+ * community and until bein accepted, will be used restrictly in Samsung's
+ * camera interface driver FIMC.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __LINUX_VIDEODEV2_SAMSUNG_H
+#define __LINUX_VIDEODEV2_SAMSUNG_H
+
+/* Values for 'capabilities' field */
+/* Object detection device */
+#define V4L2_CAP_OBJ_RECOGNITION 0x10000000
+/* strobe control */
+#define V4L2_CAP_STROBE 0x20000000
+
+#define V4L2_CID_FOCUS_MODE (V4L2_CID_CAMERA_CLASS_BASE+17)
+/* Focus Methods */
+enum v4l2_focus_mode {
+ V4L2_FOCUS_MODE_AUTO = 0,
+ V4L2_FOCUS_MODE_MACRO = 1,
+ V4L2_FOCUS_MODE_MANUAL = 2,
+ V4L2_FOCUS_MODE_LASTP = 2,
+};
+
+#define V4L2_CID_ZOOM_MODE (V4L2_CID_CAMERA_CLASS_BASE+18)
+/* Zoom Methods */
+enum v4l2_zoom_mode {
+ V4L2_ZOOM_MODE_CONTINUOUS = 0,
+ V4L2_ZOOM_MODE_OPTICAL = 1,
+ V4L2_ZOOM_MODE_DIGITAL = 2,
+ V4L2_ZOOM_MODE_LASTP = 2,
+};
+
+/* Exposure Methods */
+#define V4L2_CID_PHOTOMETRY (V4L2_CID_CAMERA_CLASS_BASE+19)
+enum v4l2_photometry_mode {
+ V4L2_PHOTOMETRY_MULTISEG = 0, /*Multi Segment*/
+ V4L2_PHOTOMETRY_CWA = 1, /*Centre Weighted Average*/
+ V4L2_PHOTOMETRY_SPOT = 2,
+ V4L2_PHOTOMETRY_AFSPOT = 3, /*Spot metering on focused point*/
+ V4L2_PHOTOMETRY_LASTP = V4L2_PHOTOMETRY_AFSPOT,
+};
+
+/* Manual exposure control items menu type: iris, shutter, iso */
+#define V4L2_CID_CAM_APERTURE (V4L2_CID_CAMERA_CLASS_BASE+20)
+enum v4l2_aperture_mode {
+ APERTURE_F_AUTO = 0,
+ APERTURE_F_2_8,
+ APERTURE_F_3_2,
+ APERTURE_F_3_6,
+ APERTURE_F_4_0,
+ APERTURE_F_4_5,
+ APERTURE_F_5_1,
+ APERTURE_F_5_7,
+ APERTURE_F_6_4,
+ APERTURE_F_7_2,
+ APERTURE_MAX,
+};
+#define V4L2_CID_CAM_SHUTTER (V4L2_CID_CAMERA_CLASS_BASE+21)
+#define V4L2_CID_CAM_ISO (V4L2_CID_CAMERA_CLASS_BASE+22)
+
+/* Following CIDs are menu type */
+#define V4L2_CID_SCENEMODE (V4L2_CID_CAMERA_CLASS_BASE+23)
+#define V4L2_CID_CAM_STABILIZE (V4L2_CID_CAMERA_CLASS_BASE+24)
+#define V4L2_CID_CAM_MULTISHOT (V4L2_CID_CAMERA_CLASS_BASE+25)
+
+/* Control dynamic range */
+#define V4L2_CID_CAM_DR (V4L2_CID_CAMERA_CLASS_BASE+26)
+
+/* White balance preset control */
+#define V4L2_CID_WHITE_BALANCE_PRESET (V4L2_CID_CAMERA_CLASS_BASE+27)
+#define V4L2_CID_CAM_SENSOR_FW_VER (V4L2_CID_CAMERA_CLASS_BASE + 28)
+#define V4L2_CID_CAM_PHONE_FW_VER (V4L2_CID_CAMERA_CLASS_BASE + 29)
+
+/* CID extensions */
+#define V4L2_CID_ROTATION (V4L2_CID_PRIVATE_BASE + 0)
+#define V4L2_CID_PADDR_Y (V4L2_CID_PRIVATE_BASE + 1)
+#define V4L2_CID_PADDR_CB (V4L2_CID_PRIVATE_BASE + 2)
+#define V4L2_CID_PADDR_CR (V4L2_CID_PRIVATE_BASE + 3)
+#define V4L2_CID_PADDR_CBCR (V4L2_CID_PRIVATE_BASE + 4)
+#define V4L2_CID_OVERLAY_AUTO (V4L2_CID_PRIVATE_BASE + 5)
+#define V4L2_CID_OVERLAY_VADDR0 (V4L2_CID_PRIVATE_BASE + 6)
+#define V4L2_CID_OVERLAY_VADDR1 (V4L2_CID_PRIVATE_BASE + 7)
+#define V4L2_CID_OVERLAY_VADDR2 (V4L2_CID_PRIVATE_BASE + 8)
+#define V4L2_CID_OVLY_MODE (V4L2_CID_PRIVATE_BASE + 9)
+#define V4L2_CID_DST_INFO (V4L2_CID_PRIVATE_BASE + 10)
+/* UMP secure id control */
+#define V4L2_CID_GET_UMP_SECURE_ID (V4L2_CID_PRIVATE_BASE + 11)
+#define V4L2_CID_GET_PHY_SRC_YADDR (V4L2_CID_PRIVATE_BASE + 12)
+#define V4L2_CID_GET_PHY_SRC_CADDR (V4L2_CID_PRIVATE_BASE + 13)
+#define V4L2_CID_IMAGE_EFFECT_FN (V4L2_CID_PRIVATE_BASE + 16)
+#define V4L2_CID_IMAGE_EFFECT_APPLY (V4L2_CID_PRIVATE_BASE + 17)
+#define V4L2_CID_IMAGE_EFFECT_CB (V4L2_CID_PRIVATE_BASE + 18)
+#define V4L2_CID_IMAGE_EFFECT_CR (V4L2_CID_PRIVATE_BASE + 19)
+#define V4L2_CID_RESERVED_MEM_BASE_ADDR (V4L2_CID_PRIVATE_BASE + 20)
+#define V4L2_CID_FIMC_VERSION (V4L2_CID_PRIVATE_BASE + 21)
+
+#define V4L2_CID_CACHE_FLUSH (V4L2_CID_PRIVATE_BASE + 61)
+#define V4L2_CID_RESERVED_MEM_SIZE (V4L2_CID_PRIVATE_BASE + 63)
+#define V4L2_CID_STREAM_PAUSE (V4L2_CID_PRIVATE_BASE + 53)
+#define V4L2_CID_CACHE_FLUSH (V4L2_CID_PRIVATE_BASE + 61)
+#define V4L2_CID_RESERVED_MEM_SIZE (V4L2_CID_PRIVATE_BASE + 63)
+
+/* CID Extensions for camera sensor operations */
+#define V4L2_CID_CAM_PREVIEW_ONOFF (V4L2_CID_PRIVATE_BASE + 64)
+#define V4L2_CID_CAM_CAPTURE (V4L2_CID_PRIVATE_BASE + 65)
+/* #define V4L2_CID_CAM_JPEG_MEMSIZE (V4L2_CID_PRIVATE_BASE + 66) */
+
+#define V4L2_CID_CAM_DATE_INFO_YEAR (V4L2_CID_PRIVATE_BASE + 14)
+#define V4L2_CID_CAM_DATE_INFO_MONTH (V4L2_CID_PRIVATE_BASE + 15)
+#define V4L2_CID_CAM_DATE_INFO_DATE (V4L2_CID_PRIVATE_BASE + 22)
+#define V4L2_CID_CAM_SENSOR_VER (V4L2_CID_PRIVATE_BASE + 23)
+#define V4L2_CID_CAM_FW_MINOR_VER (V4L2_CID_PRIVATE_BASE + 24)
+#define V4L2_CID_CAM_FW_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 25)
+#define V4L2_CID_CAM_PRM_MINOR_VER (V4L2_CID_PRIVATE_BASE + 26)
+#define V4L2_CID_CAM_PRM_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 27)
+#define V4L2_CID_CAM_FW_VER (V4L2_CID_PRIVATE_BASE + 28)
+#define V4L2_CID_CAM_SET_FW_ADDR (V4L2_CID_PRIVATE_BASE + 29)
+#define V4L2_CID_CAM_SET_FW_SIZE (V4L2_CID_PRIVATE_BASE + 30)
+#define V4L2_CID_CAM_UPDATE_FW (V4L2_CID_PRIVATE_BASE + 31)
+enum v4l2_firmware_mode {
+ FW_MODE_NONE,
+ FW_MODE_VERSION,
+ FW_MODE_UPDATE,
+ FW_MODE_DUMP,
+};
+
+#define V4L2_CID_CAM_JPEG_MAIN_SIZE (V4L2_CID_PRIVATE_BASE + 32)
+#define V4L2_CID_CAM_JPEG_MAIN_OFFSET (V4L2_CID_PRIVATE_BASE + 33)
+#define V4L2_CID_CAM_JPEG_THUMB_SIZE (V4L2_CID_PRIVATE_BASE + 34)
+#define V4L2_CID_CAM_JPEG_THUMB_OFFSET (V4L2_CID_PRIVATE_BASE + 35)
+#define V4L2_CID_CAM_JPEG_POSTVIEW_OFFSET (V4L2_CID_PRIVATE_BASE + 36)
+#define V4L2_CID_CAM_JPEG_QUALITY (V4L2_CID_PRIVATE_BASE + 37)
+#define V4L2_CID_CAM_SENSOR_MAKER (V4L2_CID_PRIVATE_BASE + 38)
+#define V4L2_CID_CAM_SENSOR_OPTICAL (V4L2_CID_PRIVATE_BASE + 39)
+#define V4L2_CID_CAM_AF_VER_LOW (V4L2_CID_PRIVATE_BASE + 40)
+#define V4L2_CID_CAM_AF_VER_HIGH (V4L2_CID_PRIVATE_BASE + 41)
+#define V4L2_CID_CAM_GAMMA_RG_LOW (V4L2_CID_PRIVATE_BASE + 42)
+#define V4L2_CID_CAM_GAMMA_RG_HIGH (V4L2_CID_PRIVATE_BASE + 43)
+#define V4L2_CID_CAM_GAMMA_BG_LOW (V4L2_CID_PRIVATE_BASE + 44)
+#define V4L2_CID_CAM_GAMMA_BG_HIGH (V4L2_CID_PRIVATE_BASE + 45)
+#define V4L2_CID_CAM_DUMP_FW (V4L2_CID_PRIVATE_BASE + 46)
+#define V4L2_CID_CAM_GET_DUMP_SIZE (V4L2_CID_PRIVATE_BASE + 47)
+#define V4L2_CID_CAMERA_VT_MODE (V4L2_CID_PRIVATE_BASE + 48)
+enum cam_vt_mode {
+ CAM_VT_MODE_NONE ,
+ CAM_VT_MODE_3G ,
+ CAM_VT_MODE_VOIP ,
+};
+
+#define V4L2_CID_CAMERA_VGA_BLUR (V4L2_CID_PRIVATE_BASE + 49)
+#define V4L2_CID_CAMERA_CAPTURE (V4L2_CID_PRIVATE_BASE + 50)
+#define V4L2_CID_CAMERA_HDR (V4L2_CID_PRIVATE_BASE + 51)
+#define V4L2_CID_CAMERA_HYBRID (V4L2_CID_PRIVATE_BASE + 52)
+#define V4L2_CID_CAMERA_HYBRID_CAPTURE (V4L2_CID_PRIVATE_BASE + 62)
+#define V4L2_CID_CAMERA_POSTVIEW_CAPTURE (V4L2_CID_PRIVATE_BASE + 67)
+#define V4L2_CID_CAMERA_CAPTURE_MODE (V4L2_CID_PRIVATE_BASE + 68)
+#define V4L2_CID_CAMERA_YUV_CAPTURE (V4L2_CID_PRIVATE_BASE + 69)
+
+#define V4L2_CID_MAIN_SW_DATE_INFO_YEAR (V4L2_CID_PRIVATE_BASE + 54)
+#define V4L2_CID_MAIN_SW_DATE_INFO_MONTH (V4L2_CID_PRIVATE_BASE + 55)
+#define V4L2_CID_MAIN_SW_DATE_INFO_DATE (V4L2_CID_PRIVATE_BASE + 56)
+#define V4L2_CID_MAIN_SW_FW_MINOR_VER (V4L2_CID_PRIVATE_BASE + 57)
+#define V4L2_CID_MAIN_SW_FW_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 58)
+#define V4L2_CID_MAIN_SW_PRM_MINOR_VER (V4L2_CID_PRIVATE_BASE + 59)
+#define V4L2_CID_MAIN_SW_PRM_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 60)
+
+#define V4L2_CID_FIMC_IS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x1000)
+#define V4L2_CID_FIMC_IS_TUNE_BASE (V4L2_CTRL_CLASS_CAMERA | 0x2000)
+
+#define V4L2_CID_IS_LOAD_FW (V4L2_CID_FIMC_IS_BASE + 10)
+#define V4L2_CID_IS_INIT_PARAM (V4L2_CID_FIMC_IS_BASE + 11)
+#define V4L2_CID_IS_RESET (V4L2_CID_FIMC_IS_BASE + 12)
+#define V4L2_CID_IS_S_POWER (V4L2_CID_FIMC_IS_BASE + 13)
+enum is_set_power {
+ IS_POWER_OFF,
+ IS_POWER_ON
+};
+
+#define V4L2_CID_IS_S_STREAM (V4L2_CID_FIMC_IS_BASE + 14)
+enum is_set_stream {
+ IS_DISABLE_STREAM,
+ IS_ENABLE_STREAM
+};
+
+#define V4L2_CID_IS_S_SCENARIO_MODE (V4L2_CID_FIMC_IS_BASE + 15)
+#define V4L2_CID_IS_S_FORMAT_SCENARIO (V4L2_CID_FIMC_IS_BASE + 16)
+enum scenario_mode {
+ IS_MODE_PREVIEW_STILL,
+ IS_MODE_PREVIEW_VIDEO,
+ IS_MODE_CAPTURE_STILL,
+ IS_MODE_CAPTURE_VIDEO,
+ IS_MODE_MAX
+};
+
+/* global */
+#define V4L2_CID_IS_CAMERA_SHOT_MODE_NORMAL (V4L2_CID_FIMC_IS_BASE + 101)
+/* value : 1 : single shot , >=2 : continuous shot */
+
+#define V4L2_CID_IS_CAMERA_SENSOR_NUM (V4L2_CID_FIMC_IS_BASE + 201)
+
+#define V4L2_CID_IS_CAMERA_FOCUS_MODE (V4L2_CID_FIMC_IS_BASE + 401)
+enum is_focus_mode {
+ IS_FOCUS_MODE_AUTO,
+ IS_FOCUS_MODE_MACRO,
+ IS_FOCUS_MODE_INFINITY,
+ IS_FOCUS_MODE_CONTINUOUS,
+ IS_FOCUS_MODE_TOUCH,
+ IS_FOCUS_MODE_FACEDETECT,
+ IS_FOCUS_MODE_IDLE,
+ IS_FOCUS_MODE_MAX,
+};
+
+#define V4L2_CID_IS_CAMERA_FLASH_MODE (V4L2_CID_FIMC_IS_BASE + 402)
+enum is_flash_mode {
+ IS_FLASH_MODE_OFF,
+ IS_FLASH_MODE_AUTO,
+ IS_FLASH_MODE_AUTO_REDEYE,
+ IS_FLASH_MODE_ON,
+ IS_FLASH_MODE_TORCH,
+ IS_FLASH_MODE_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_AWB_MODE (V4L2_CID_FIMC_IS_BASE + 403)
+enum is_awb_mode {
+ IS_AWB_AUTO,
+ IS_AWB_DAYLIGHT,
+ IS_AWB_CLOUDY,
+ IS_AWB_TUNGSTEN,
+ IS_AWB_FLUORESCENT,
+ IS_AWB_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_IMAGE_EFFECT (V4L2_CID_FIMC_IS_BASE + 404)
+enum is_image_effect {
+ IS_IMAGE_EFFECT_DISABLE,
+ IS_IMAGE_EFFECT_MONOCHROME,
+ IS_IMAGE_EFFECT_NEGATIVE_MONO,
+ IS_IMAGE_EFFECT_NEGATIVE_COLOR,
+ IS_IMAGE_EFFECT_SEPIA,
+ IS_IMAGE_EFFECT_SEPIA_CB,
+ IS_IMAGE_EFFECT_SEPIA_CR,
+ IS_IMAGE_EFFECT_NEGATIVE,
+ IS_IMAGE_EFFECT_ARTFREEZE,
+ IS_IMAGE_EFFECT_EMBOSSING,
+ IS_IMAGE_EFFECT_SILHOUETTE,
+ IS_IMAGE_EFFECT_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_ISO (V4L2_CID_FIMC_IS_BASE + 405)
+enum is_iso {
+ IS_ISO_AUTO,
+ IS_ISO_50,
+ IS_ISO_100,
+ IS_ISO_200,
+ IS_ISO_400,
+ IS_ISO_800,
+ IS_ISO_1600,
+ IS_ISO_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_CONTRAST (V4L2_CID_FIMC_IS_BASE + 406)
+enum is_contrast {
+ IS_CONTRAST_AUTO,
+ IS_CONTRAST_MINUS_2,
+ IS_CONTRAST_MINUS_1,
+ IS_CONTRAST_DEFAULT,
+ IS_CONTRAST_PLUS_1,
+ IS_CONTRAST_PLUS_2,
+ IS_CONTRAST_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_SATURATION (V4L2_CID_FIMC_IS_BASE + 407)
+enum is_saturation {
+ IS_SATURATION_MINUS_2,
+ IS_SATURATION_MINUS_1,
+ IS_SATURATION_DEFAULT,
+ IS_SATURATION_PLUS_1,
+ IS_SATURATION_PLUS_2,
+ IS_SATURATION_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_SHARPNESS (V4L2_CID_FIMC_IS_BASE + 408)
+enum is_sharpness {
+ IS_SHARPNESS_MINUS_2,
+ IS_SHARPNESS_MINUS_1,
+ IS_SHARPNESS_DEFAULT,
+ IS_SHARPNESS_PLUS_1,
+ IS_SHARPNESS_PLUS_2,
+ IS_SHARPNESS_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_EXPOSURE (V4L2_CID_FIMC_IS_BASE + 409)
+enum is_exposure {
+ IS_EXPOSURE_MINUS_4,
+ IS_EXPOSURE_MINUS_3,
+ IS_EXPOSURE_MINUS_2,
+ IS_EXPOSURE_MINUS_1,
+ IS_EXPOSURE_DEFAULT,
+ IS_EXPOSURE_PLUS_1,
+ IS_EXPOSURE_PLUS_2,
+ IS_EXPOSURE_PLUS_3,
+ IS_EXPOSURE_PLUS_4,
+ IS_EXPOSURE_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_BRIGHTNESS (V4L2_CID_FIMC_IS_BASE + 410)
+enum is_brightness {
+ IS_BRIGHTNESS_MINUS_2,
+ IS_BRIGHTNESS_MINUS_1,
+ IS_BRIGHTNESS_DEFAULT,
+ IS_BRIGHTNESS_PLUS_1,
+ IS_BRIGHTNESS_PLUS_2,
+ IS_BRIGHTNESS_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_HUE (V4L2_CID_FIMC_IS_BASE + 411)
+enum is_hue {
+ IS_HUE_MINUS_2,
+ IS_HUE_MINUS_1,
+ IS_HUE_DEFAULT,
+ IS_HUE_PLUS_1,
+ IS_HUE_PLUS_2,
+ IS_HUE_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_METERING (V4L2_CID_FIMC_IS_BASE + 412)
+enum is_metering {
+ IS_METERING_AVERAGE,
+ IS_METERING_SPOT,
+ IS_METERING_MATRIX,
+ IS_METERING_CENTER,
+ IS_METERING_MAX
+};
+#define V4L2_CID_IS_CAMERA_METERING_POSITION_X (V4L2_CID_FIMC_IS_BASE + 500)
+#define V4L2_CID_IS_CAMERA_METERING_POSITION_Y (V4L2_CID_FIMC_IS_BASE + 501)
+#define V4L2_CID_IS_CAMERA_METERING_WINDOW_X (V4L2_CID_FIMC_IS_BASE + 502)
+#define V4L2_CID_IS_CAMERA_METERING_WINDOW_Y (V4L2_CID_FIMC_IS_BASE + 503)
+
+#define V4L2_CID_IS_CAMERA_AFC_MODE (V4L2_CID_FIMC_IS_BASE + 413)
+enum is_afc_mode {
+ IS_AFC_DISABLE,
+ IS_AFC_AUTO,
+ IS_AFC_MANUAL_50HZ,
+ IS_AFC_MANUAL_60HZ,
+ IS_AFC_MAX
+};
+
+#define V4L2_CID_IS_AWB_LOCK_UNLOCK (V4L2_CID_FIMC_IS_BASE + 496)
+enum is_awb_lock_unlock {
+ IS_AWB_LOCK,
+ IS_AWB_UNLOCK,
+ IS_AWB_LOCK_UNLOCK_MAX
+};
+
+#define V4L2_CID_IS_AE_LOCK_UNLOCK (V4L2_CID_FIMC_IS_BASE + 497)
+enum is_ae_lock_unlock {
+ IS_AE_LOCK,
+ IS_AE_UNLOCK,
+ IS_AE_LOCK_UNLOCK_MAX
+};
+
+#define V4L2_CID_IS_FD_GET_FACE_COUNT (V4L2_CID_FIMC_IS_BASE + 600)
+#define V4L2_CID_IS_FD_GET_FACE_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 601)
+#define V4L2_CID_IS_FD_GET_FACE_CONFIDENCE (V4L2_CID_FIMC_IS_BASE + 602)
+#define V4L2_CID_IS_FD_GET_FACE_SMILE_LEVEL (V4L2_CID_FIMC_IS_BASE + 603)
+#define V4L2_CID_IS_FD_GET_FACE_BLINK_LEVEL (V4L2_CID_FIMC_IS_BASE + 604)
+#define V4L2_CID_IS_FD_GET_FACE_TOPLEFT_X (V4L2_CID_FIMC_IS_BASE + 605)
+#define V4L2_CID_IS_FD_GET_FACE_TOPLEFT_Y (V4L2_CID_FIMC_IS_BASE + 606)
+#define V4L2_CID_IS_FD_GET_FACE_BOTTOMRIGHT_X (V4L2_CID_FIMC_IS_BASE + 607)
+#define V4L2_CID_IS_FD_GET_FACE_BOTTOMRIGHT_Y (V4L2_CID_FIMC_IS_BASE + 608)
+#define V4L2_CID_IS_FD_GET_LEFT_EYE_TOPLEFT_X (V4L2_CID_FIMC_IS_BASE + 609)
+#define V4L2_CID_IS_FD_GET_LEFT_EYE_TOPLEFT_Y (V4L2_CID_FIMC_IS_BASE + 610)
+#define V4L2_CID_IS_FD_GET_LEFT_EYE_BOTTOMRIGHT_X (V4L2_CID_FIMC_IS_BASE + 611)
+#define V4L2_CID_IS_FD_GET_LEFT_EYE_BOTTOMRIGHT_Y (V4L2_CID_FIMC_IS_BASE + 612)
+#define V4L2_CID_IS_FD_GET_RIGHT_EYE_TOPLEFT_X (V4L2_CID_FIMC_IS_BASE + 613)
+#define V4L2_CID_IS_FD_GET_RIGHT_EYE_TOPLEFT_Y (V4L2_CID_FIMC_IS_BASE + 614)
+#define V4L2_CID_IS_FD_GET_RIGHT_EYE_BOTTOMRIGHT_X (V4L2_CID_FIMC_IS_BASE + 615)
+#define V4L2_CID_IS_FD_GET_RIGHT_EYE_BOTTOMRIGHT_Y (V4L2_CID_FIMC_IS_BASE + 616)
+#define V4L2_CID_IS_FD_GET_MOUTH_TOPLEFT_X (V4L2_CID_FIMC_IS_BASE + 617)
+#define V4L2_CID_IS_FD_GET_MOUTH_TOPLEFT_Y (V4L2_CID_FIMC_IS_BASE + 618)
+#define V4L2_CID_IS_FD_GET_MOUTH_BOTTOMRIGHT_X (V4L2_CID_FIMC_IS_BASE + 619)
+#define V4L2_CID_IS_FD_GET_MOUTH_BOTTOMRIGHT_Y (V4L2_CID_FIMC_IS_BASE + 620)
+#define V4L2_CID_IS_FD_GET_ANGLE (V4L2_CID_FIMC_IS_BASE + 621)
+#define V4L2_CID_IS_FD_GET_YAW_ANGLE (V4L2_CID_FIMC_IS_BASE + 622)
+#define V4L2_CID_IS_FD_GET_NEXT (V4L2_CID_FIMC_IS_BASE + 623)
+#define V4L2_CID_IS_FD_GET_DATA (V4L2_CID_FIMC_IS_BASE + 624)
+
+#define V4L2_CID_IS_FD_SET_MAX_FACE_NUMBER (V4L2_CID_FIMC_IS_BASE + 650)
+#define V4L2_CID_IS_FD_SET_ROLL_ANGLE (V4L2_CID_FIMC_IS_BASE + 651)
+
+enum is_fd_roll_angle {
+ /* 0, 45, 0, -45 */
+ IS_FD_ROLL_ANGLE_BASIC = 0,
+ /* 0, 30, 0, -30, 0, 45, 0, -45 */
+ IS_FD_ROLL_ANGLE_PRECISE_BASIC = 1,
+ /* 0, 90, 0, -90 */
+ IS_FD_ROLL_ANGLE_SIDES = 2,
+ /* 0, 90, 0, -90 0, 45, 0, -45 */
+ IS_FD_ROLL_ANGLE_PRECISE_SIDES = 3,
+ /* 0, 90, 0, -90, 0, 180 */
+ IS_FD_ROLL_ANGLE_FULL = 4,
+ /* 0, 90, 0, -90, 0, 180, 0, 135, 0, -135 */
+ IS_FD_ROLL_ANGLE_PRECISE_FULL = 5,
+};
+
+#define V4L2_CID_IS_FD_SET_YAW_ANGLE (V4L2_CID_FIMC_IS_BASE + 652)
+enum is_fd_yaw_angle {
+ IS_FD_YAW_ANGLE_0 = 0,
+ IS_FD_YAW_ANGLE_45 = 1,
+ IS_FD_YAW_ANGLE_90 = 2,
+ IS_FD_YAW_ANGLE_45_90 = 3,
+};
+
+#define V4L2_CID_IS_FD_SET_SMILE_MODE (V4L2_CID_FIMC_IS_BASE + 653)
+enum is_fd_smile_mode {
+ IS_FD_SMILE_MODE_DISABLE = 0,
+ IS_FD_SMILE_MODE_ENABLE = 1,
+};
+
+#define V4L2_CID_IS_FD_SET_BLINK_MODE (V4L2_CID_FIMC_IS_BASE + 654)
+enum is_fd_blink_mode {
+ IS_FD_BLINK_MODE_DISABLE = 0,
+ IS_FD_BLINK_MODE_ENABLE = 1,
+};
+
+#define V4L2_CID_IS_FD_SET_EYE_DETECT_MODE (V4L2_CID_FIMC_IS_BASE + 655)
+enum is_fd_eye_detect_mode {
+ IS_FD_EYE_DETECT_DISABLE = 0,
+ IS_FD_EYE_DETECT_ENABLE = 1,
+};
+
+#define V4L2_CID_IS_FD_SET_MOUTH_DETECT_MODE (V4L2_CID_FIMC_IS_BASE + 656)
+enum is_fd_mouth_detect_mode {
+ IS_FD_MOUTH_DETECT_DISABLE = 0,
+ IS_FD_MOUTH_DETECT_ENABLE = 1,
+};
+
+#define V4L2_CID_IS_FD_SET_ORIENTATION_MODE (V4L2_CID_FIMC_IS_BASE + 657)
+enum is_fd_orientation_mode {
+ IS_FD_ORIENTATION_DISABLE = 0,
+ IS_FD_ORIENTATION_ENABLE = 1,
+};
+
+#define V4L2_CID_IS_FD_SET_ORIENTATION (V4L2_CID_FIMC_IS_BASE + 658)
+#define V4L2_CID_IS_FD_SET_DATA_ADDRESS (V4L2_CID_FIMC_IS_BASE + 659)
+
+#define V4L2_CID_IS_SET_ISP (V4L2_CID_FIMC_IS_BASE + 440)
+enum is_isp_bypass_mode {
+ IS_ISP_BYPASS_DISABLE,
+ IS_ISP_BYPASS_ENABLE,
+ IS_ISP_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_DRC (V4L2_CID_FIMC_IS_BASE + 441)
+enum is_drc_bypass_mode {
+ IS_DRC_BYPASS_DISABLE,
+ IS_DRC_BYPASS_ENABLE,
+ IS_DRC_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_FD (V4L2_CID_FIMC_IS_BASE + 442)
+enum is_fd_bypass_mode {
+ IS_FD_BYPASS_DISABLE,
+ IS_FD_BYPASS_ENABLE,
+ IS_FD_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_ODC (V4L2_CID_FIMC_IS_BASE + 443)
+enum is_odc_bypass_mode {
+ IS_ODC_BYPASS_DISABLE,
+ IS_ODC_BYPASS_ENABLE,
+ IS_ODC_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_DIS (V4L2_CID_FIMC_IS_BASE + 444)
+enum is_dis_bypass_mode {
+ IS_DIS_BYPASS_DISABLE,
+ IS_DIS_BYPASS_ENABLE,
+ IS_DIS_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_3DNR (V4L2_CID_FIMC_IS_BASE + 445)
+enum is_tdnr_bypass_mode {
+ IS_TDNR_BYPASS_DISABLE,
+ IS_TDNR_BYPASS_ENABLE,
+ IS_TDNR_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_SCALERC (V4L2_CID_FIMC_IS_BASE + 446)
+enum is_scalerc_bypass_mode {
+ IS_SCALERC_BYPASS_DISABLE,
+ IS_SCALERC_BYPASS_ENABLE,
+ IS_SCALERC_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_SET_SCALERP (V4L2_CID_FIMC_IS_BASE + 446)
+enum is_scalerp_bypass_mode {
+ IS_SCALERP_BYPASS_DISABLE,
+ IS_SCALERP_BYPASS_ENABLE,
+ IS_SCALERP_BYPASS_MAX
+};
+
+#define V4L2_CID_IS_ROTATION_MODE (V4L2_CID_FIMC_IS_BASE + 450)
+enum is_rotation_mode {
+ IS_ROTATION_0,
+ IS_ROTATION_90,
+ IS_ROTATION_180,
+ IS_ROTATION_270,
+ IS_ROTATION_MAX
+};
+
+#define V4L2_CID_IS_3DNR_1ST_FRAME_MODE (V4L2_CID_FIMC_IS_BASE + 451)
+enum is_tdnr_1st_frame_mode {
+ IS_TDNR_1ST_FRAME_NOPROCESSING,
+ IS_TDNR_1ST_FRAME_2DNR,
+ IS_TDNR_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_OBJECT_POSITION_X (V4L2_CID_FIMC_IS_BASE + 452)
+#define V4L2_CID_IS_CAMERA_OBJECT_POSITION_Y (V4L2_CID_FIMC_IS_BASE + 453)
+#define V4L2_CID_IS_CAMERA_WINDOW_SIZE_X (V4L2_CID_FIMC_IS_BASE + 454)
+#define V4L2_CID_IS_CAMERA_WINDOW_SIZE_Y (V4L2_CID_FIMC_IS_BASE + 455)
+
+#define V4L2_CID_IS_CAMERA_EXIF_EXPTIME (V4L2_CID_FIMC_IS_BASE + 456)
+#define V4L2_CID_IS_CAMERA_EXIF_FLASH (V4L2_CID_FIMC_IS_BASE + 457)
+#define V4L2_CID_IS_CAMERA_EXIF_ISO (V4L2_CID_FIMC_IS_BASE + 458)
+#define V4L2_CID_IS_CAMERA_EXIF_SHUTTERSPEED (V4L2_CID_FIMC_IS_BASE + 459)
+#define V4L2_CID_IS_CAMERA_EXIF_BRIGHTNESS (V4L2_CID_FIMC_IS_BASE + 460)
+
+#define V4L2_CID_IS_CAMERA_ISP_SEL_INPUT (V4L2_CID_FIMC_IS_BASE + 461)
+enum is_isp_sel_input {
+ IS_ISP_INPUT_OTF,
+ IS_ISP_INPUT_DMA1,
+ IS_ISP_INPUT_DMA2,
+ IS_ISP_INPUT_DMA12,
+ IS_ISP_INPUT_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_ISP_SEL_OUTPUT (V4L2_CID_FIMC_IS_BASE + 462)
+enum is_isp_sel_output {
+ IS_ISP_OUTPUT_OTF,
+ IS_ISP_OUTPUT_DMA1,
+ IS_ISP_OUTPUT_DMA2,
+ IS_ISP_OUTPUT_DMA12,
+ IS_ISP_OUTPUT_OTF_DMA1,
+ IS_ISP_OUTPUT_OTF_DMA2,
+ IS_ISP_OUTPUT_OTF_DMA12,
+ IS_ISP_OUTPUT_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_DRC_SEL_INPUT (V4L2_CID_FIMC_IS_BASE + 463)
+enum is_drc_sel_input {
+ IS_DRC_INPUT_OTF,
+ IS_DRC_INPUT_DMA,
+ IS_DRC_INPUT_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_FD_SEL_INPUT (V4L2_CID_FIMC_IS_BASE + 464)
+enum is_fd_sel_input {
+ IS_FD_INPUT_OTF,
+ IS_FD_INPUT_DMA,
+ IS_FD_INPUT_MAX
+};
+
+#define V4L2_CID_IS_CAMERA_INIT_WIDTH (V4L2_CID_FIMC_IS_BASE + 465)
+#define V4L2_CID_IS_CAMERA_INIT_HEIGHT (V4L2_CID_FIMC_IS_BASE + 466)
+
+#define V4L2_CID_IS_CMD_ISP (V4L2_CID_FIMC_IS_BASE + 467)
+enum is_isp_cmd_mode {
+ IS_ISP_COMMAND_STOP,
+ IS_ISP_COMMAND_START,
+ IS_ISP_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_DRC (V4L2_CID_FIMC_IS_BASE + 468)
+enum is_drc_cmd_mode {
+ IS_DRC_COMMAND_STOP,
+ IS_DRC_COMMAND_START,
+ IS_DRC_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_FD (V4L2_CID_FIMC_IS_BASE + 469)
+enum is_fd_cmd_mode {
+ IS_FD_COMMAND_STOP,
+ IS_FD_COMMAND_START,
+ IS_FD_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_ODC (V4L2_CID_FIMC_IS_BASE + 470)
+enum is_odc_cmd_mode {
+ IS_ODC_COMMAND_STOP,
+ IS_ODC_COMMAND_START,
+ IS_ODC_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_DIS (V4L2_CID_FIMC_IS_BASE + 471)
+enum is_dis_cmd_mode {
+ IS_DIS_COMMAND_STOP,
+ IS_DIS_COMMAND_START,
+ IS_DIS_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_TDNR (V4L2_CID_FIMC_IS_BASE + 472)
+enum is_tdnr_cmd_mode {
+ IS_TDNR_COMMAND_STOP,
+ IS_TDNR_COMMAND_START,
+ IS_TDNR_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_SCALERC (V4L2_CID_FIMC_IS_BASE + 473)
+enum is_scalerc_cmd_mode {
+ IS_SCALERC_COMMAND_STOP,
+ IS_SCALERC_COMMAND_START,
+ IS_SCALERC_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_CMD_SCALERP (V4L2_CID_FIMC_IS_BASE + 474)
+enum is_scalerp_cmd_mode {
+ IS_SCALERP_COMMAND_STOP,
+ IS_SCALERP_COMMAND_START,
+ IS_SCALERP_COMMAND_MAX
+};
+
+#define V4L2_CID_IS_GET_SENSOR_OFFSET_X (V4L2_CID_FIMC_IS_BASE + 480)
+#define V4L2_CID_IS_GET_SENSOR_OFFSET_Y (V4L2_CID_FIMC_IS_BASE + 481)
+#define V4L2_CID_IS_GET_SENSOR_WIDTH (V4L2_CID_FIMC_IS_BASE + 482)
+#define V4L2_CID_IS_GET_SENSOR_HEIGHT (V4L2_CID_FIMC_IS_BASE + 483)
+
+#define V4L2_CID_IS_GET_FRAME_VALID (V4L2_CID_FIMC_IS_BASE + 484)
+#define V4L2_CID_IS_SET_FRAME_VALID (V4L2_CID_FIMC_IS_BASE + 485)
+#define V4L2_CID_IS_GET_FRAME_BADMARK (V4L2_CID_FIMC_IS_BASE + 486)
+#define V4L2_CID_IS_SET_FRAME_BADMARK (V4L2_CID_FIMC_IS_BASE + 487)
+#define V4L2_CID_IS_GET_FRAME_CAPTURED (V4L2_CID_FIMC_IS_BASE + 488)
+#define V4L2_CID_IS_SET_FRAME_CAPTURED (V4L2_CID_FIMC_IS_BASE + 489)
+#define V4L2_CID_IS_SET_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 490)
+#define V4L2_CID_IS_GET_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 491)
+#define V4L2_CID_IS_CLEAR_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 492)
+#define V4L2_CID_IS_GET_LOSTED_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 493)
+#define V4L2_CID_IS_ISP_DMA_BUFFER_NUM (V4L2_CID_FIMC_IS_BASE + 494)
+#define V4L2_CID_IS_ISP_DMA_BUFFER_ADDRESS (V4L2_CID_FIMC_IS_BASE + 495)
+
+#define V4L2_CID_IS_ZOOM_STATE (V4L2_CID_FIMC_IS_BASE + 660)
+#define V4L2_CID_IS_ZOOM_MAX_LEVEL (V4L2_CID_FIMC_IS_BASE + 661)
+#define V4L2_CID_IS_ZOOM (V4L2_CID_FIMC_IS_BASE + 662)
+#define V4L2_CID_IS_FW_DEBUG_REGION_ADDR (V4L2_CID_FIMC_IS_BASE + 663)
+
+#define V4L2_CID_IS_TUNE_SEL_ENTRY (V4L2_CID_FIMC_IS_TUNE_BASE)
+#define V4L2_CID_IS_TUNE_SENSOR_EXPOSURE (V4L2_CID_FIMC_IS_TUNE_BASE + 1)
+#define V4L2_CID_IS_TUNE_SENSOR_ANALOG_GAIN (V4L2_CID_FIMC_IS_TUNE_BASE + 2)
+#define V4L2_CID_IS_TUNE_SENSOR_FRAME_RATE (V4L2_CID_FIMC_IS_TUNE_BASE + 3)
+#define V4L2_CID_IS_TUNE_SENSOR_ACTUATOR_POS (V4L2_CID_FIMC_IS_TUNE_BASE + 4)
+
+enum v4l2_blur {
+ BLUR_LEVEL_0 = 0,
+ BLUR_LEVEL_1,
+ BLUR_LEVEL_2,
+ BLUR_LEVEL_3,
+ BLUR_LEVEL_MAX,
+};
+
+#if 1
+#define V4L2_CID_CAMERA_SCENE_MODE (V4L2_CID_PRIVATE_BASE+70)
+enum v4l2_scene_mode {
+ SCENE_MODE_BASE,
+ SCENE_MODE_NONE,
+ SCENE_MODE_PORTRAIT,
+ SCENE_MODE_NIGHTSHOT,
+ SCENE_MODE_BACK_LIGHT,
+ SCENE_MODE_LANDSCAPE,
+ SCENE_MODE_SPORTS,
+ SCENE_MODE_PARTY_INDOOR,
+ SCENE_MODE_BEACH_SNOW,
+ SCENE_MODE_SUNSET,
+ SCENE_MODE_DUSK_DAWN,
+ SCENE_MODE_FALL_COLOR,
+ SCENE_MODE_FIREWORKS,
+ SCENE_MODE_TEXT,
+ SCENE_MODE_CANDLE_LIGHT,
+ SCENE_MODE_MAX,
+};
+
+#define V4L2_CID_CAMERA_FLASH_MODE (V4L2_CID_PRIVATE_BASE+71)
+enum v4l2_flash_mode {
+ FLASH_MODE_BASE,
+ FLASH_MODE_OFF,
+ FLASH_MODE_AUTO,
+ FLASH_MODE_ON,
+ FLASH_MODE_TORCH,
+ FLASH_MODE_RED_EYE,
+ FLASH_MODE_FILL_IN,
+ FLASH_MODE_SLOW_SYNC,
+ FLASH_MODE_RED_EYE_FIX,
+ FLASH_MODE_MAX,
+};
+
+#define V4L2_CID_CAMERA_BRIGHTNESS (V4L2_CID_PRIVATE_BASE+72)
+enum v4l2_ev_mode {
+ EV_MINUS_4 = -4,
+ EV_MINUS_3 = -3,
+ EV_MINUS_2 = -2,
+ EV_MINUS_1 = -1,
+ EV_DEFAULT = 0,
+ EV_PLUS_1 = 1,
+ EV_PLUS_2 = 2,
+ EV_PLUS_3 = 3,
+ EV_PLUS_4 = 4,
+ EV_MAX,
+ EV_MAX_V4L2 = EV_MAX,
+};
+
+enum v4l2_exposure {
+ EXPOSURE_MINUS_6 = -6,
+ EXPOSURE_MINUS_5 = -5,
+ EXPOSURE_MINUS_4 = -4,
+ EXPOSURE_MINUS_3 = -3,
+ EXPOSURE_MINUS_2 = -2,
+ EXPOSURE_MINUS_1 = -1,
+ EXPOSURE_DEFAULT = 0,
+ EXPOSURE_PLUS_1 = 1,
+ EXPOSURE_PLUS_2 = 2,
+ EXPOSURE_PLUS_3 = 3,
+ EXPOSURE_PLUS_4 = 4,
+ EXPOSURE_PLUS_5 = 5,
+ EXPOSURE_PLUS_6 = 6,
+ EXPOSURE_MAX,
+};
+
+#define V4L2_CID_CAMERA_WHITE_BALANCE (V4L2_CID_PRIVATE_BASE+73)
+enum v4l2_wb_mode {
+ WHITE_BALANCE_BASE = 0,
+ WHITE_BALANCE_AUTO,
+ WHITE_BALANCE_SUNNY,
+ WHITE_BALANCE_CLOUDY,
+ WHITE_BALANCE_TUNGSTEN,
+ WHITE_BALANCE_FLUORESCENT,
+ WHITE_BALANCE_FLUORESCENT_H,
+ WHITE_BALANCE_FLUORESCENT_L,
+ WHITE_BALANCE_CUSTOM,
+ WHITE_BALANCE_K,
+ WHITE_BALANCE_MAX,
+};
+
+#define V4L2_CID_CAMERA_EFFECT (V4L2_CID_PRIVATE_BASE+74)
+enum v4l2_effect_mode {
+ IMAGE_EFFECT_BASE = 0,
+ IMAGE_EFFECT_NONE,
+ IMAGE_EFFECT_BNW,
+ IMAGE_EFFECT_SEPIA,
+ IMAGE_EFFECT_AQUA,
+ IMAGE_EFFECT_ANTIQUE,
+ IMAGE_EFFECT_NEGATIVE,
+ IMAGE_EFFECT_SHARPEN,
+ IMAGE_EFFECT_SKETCH,
+ IMAGE_EFFECT_WASHED,
+ IMAGE_EFFECT_VINTAGE_WARM,
+ IMAGE_EFFECT_VINTAGE_COLD,
+ IMAGE_EFFECT_SOLARIZE,
+ IMAGE_EFFECT_POSTERIZE,
+ IMAGE_EFFECT_POINT_BLUE,
+ IMAGE_EFFECT_POINT_RED_YELLOW,
+ IMAGE_EFFECT_POINT_COLOR_3,
+ IMAGE_EFFECT_POINT_GREEN,
+ IMAGE_EFFECT_MAX,
+};
+
+#define V4L2_CID_CAMERA_ISO (V4L2_CID_PRIVATE_BASE+75)
+enum v4l2_iso_mode {
+ ISO_AUTO = 0,
+ ISO_50,
+ ISO_100,
+ ISO_200,
+ ISO_400,
+ ISO_800,
+ ISO_1600,
+ ISO_SPORTS,
+ ISO_NIGHT,
+ ISO_MOVIE,
+ ISO_MAX,
+};
+
+#define V4L2_CID_CAMERA_METERING (V4L2_CID_PRIVATE_BASE+76)
+enum v4l2_metering_mode {
+ METERING_BASE = 0,
+ METERING_MATRIX,
+ METERING_CENTER,
+ METERING_SPOT,
+ METERING_MAX,
+};
+
+#define V4L2_CID_CAMERA_CONTRAST (V4L2_CID_PRIVATE_BASE+77)
+enum v4l2_contrast_mode {
+ CONTRAST_MINUS_2 = 0,
+ CONTRAST_MINUS_1,
+ CONTRAST_DEFAULT,
+ CONTRAST_PLUS_1,
+ CONTRAST_PLUS_2,
+ CONTRAST_MAX,
+};
+
+#define V4L2_CID_CAMERA_SATURATION (V4L2_CID_PRIVATE_BASE+78)
+enum v4l2_saturation_mode {
+ SATURATION_MINUS_2 = 0,
+ SATURATION_MINUS_1,
+ SATURATION_DEFAULT,
+ SATURATION_PLUS_1,
+ SATURATION_PLUS_2,
+ SATURATION_MAX,
+};
+
+#define V4L2_CID_CAMERA_SHARPNESS (V4L2_CID_PRIVATE_BASE+79)
+enum v4l2_sharpness_mode {
+ SHARPNESS_MINUS_2 = 0,
+ SHARPNESS_MINUS_1,
+ SHARPNESS_DEFAULT,
+ SHARPNESS_PLUS_1,
+ SHARPNESS_PLUS_2,
+ SHARPNESS_MAX,
+};
+
+#define V4L2_CID_CAMERA_WDR (V4L2_CID_PRIVATE_BASE+80)
+enum v4l2_wdr_mode {
+ WDR_OFF,
+ WDR_ON,
+ WDR_MAX,
+};
+
+#define V4L2_CID_CAMERA_ANTI_SHAKE (V4L2_CID_PRIVATE_BASE+81)
+enum v4l2_anti_shake_mode {
+ ANTI_SHAKE_OFF,
+ ANTI_SHAKE_STILL_ON,
+ ANTI_SHAKE_MOVIE_ON,
+ ANTI_SHAKE_MAX,
+};
+
+#define V4L2_CID_CAMERA_TOUCH_AF_START_STOP (V4L2_CID_PRIVATE_BASE+82)
+enum v4l2_touch_af {
+ TOUCH_AF_STOP = 0,
+ TOUCH_AF_START,
+ TOUCH_AF_MAX,
+};
+
+#define V4L2_CID_CAMERA_SMART_AUTO (V4L2_CID_PRIVATE_BASE+83)
+enum v4l2_smart_auto {
+ SMART_AUTO_OFF = 0,
+ SMART_AUTO_ON,
+ SMART_AUTO_MAX,
+};
+
+#define V4L2_CID_CAMERA_VINTAGE_MODE (V4L2_CID_PRIVATE_BASE+84)
+enum v4l2_vintage_mode {
+ VINTAGE_MODE_BASE,
+ VINTAGE_MODE_OFF,
+ VINTAGE_MODE_NORMAL,
+ VINTAGE_MODE_WARM,
+ VINTAGE_MODE_COOL,
+ VINTAGE_MODE_BNW,
+ VINTAGE_MODE_MAX,
+};
+
+#define V4L2_CID_CAMERA_JPEG_QUALITY (V4L2_CID_PRIVATE_BASE+85)
+/* (V4L2_CID_PRIVATE_BASE+86) */
+#define V4L2_CID_CAMERA_GPS_LATITUDE (V4L2_CID_CAMERA_CLASS_BASE+30)
+/* (V4L2_CID_PRIVATE_BASE+87) */
+#define V4L2_CID_CAMERA_GPS_LONGITUDE (V4L2_CID_CAMERA_CLASS_BASE + 31)
+/* (V4L2_CID_PRIVATE_BASE+88) */
+#define V4L2_CID_CAMERA_GPS_TIMESTAMP (V4L2_CID_CAMERA_CLASS_BASE + 32)
+/* (V4L2_CID_PRIVATE_BASE+89)*/
+#define V4L2_CID_CAMERA_GPS_ALTITUDE (V4L2_CID_CAMERA_CLASS_BASE + 33)
+#define V4L2_CID_CAMERA_EXIF_TIME_INFO (V4L2_CID_CAMERA_CLASS_BASE + 34)
+#define V4L2_CID_CAMERA_GPS_PROCESSINGMETHOD (V4L2_CID_CAMERA_CLASS_BASE+35)
+
+#define V4L2_CID_FOCUS_AUTO_MODE (V4L2_CID_CAMERA_CLASS_BASE+36)
+enum v4l2_focus_mode_type {
+ V4L2_FOCUS_AUTO_NORMAL = 0,
+ V4L2_FOCUS_AUTO_MACRO,
+ V4L2_FOCUS_AUTO_CONTINUOUS,
+ V4L2_FOCUS_AUTO_FACE_DETECTION,
+ V4L2_FOCUS_AUTO_RECTANGLE,
+ V4L2_FOCUS_AUTO_MAX,
+};
+#define V4L2_CID_FOCUS_AUTO_RECTANGLE_LEFT (V4L2_CID_CAMERA_CLASS_BASE+37)
+#define V4L2_CID_FOCUS_AUTO_RECTANGLE_TOP (V4L2_CID_CAMERA_CLASS_BASE+38)
+#define V4L2_CID_FOCUS_AUTO_RECTANGLE_WIDTH (V4L2_CID_CAMERA_CLASS_BASE+39)
+#define V4L2_CID_FOCUS_AUTO_RECTANGLE_HEIGHT (V4L2_CID_CAMERA_CLASS_BASE+40)
+
+#define V4L2_CID_CAMERA_ZOOM (V4L2_CID_PRIVATE_BASE+90)
+enum v4l2_zoom_level {
+ ZOOM_LEVEL_0 = 0,
+ ZOOM_LEVEL_1,
+ ZOOM_LEVEL_2,
+ ZOOM_LEVEL_3,
+ ZOOM_LEVEL_4,
+ ZOOM_LEVEL_5,
+ ZOOM_LEVEL_6,
+ ZOOM_LEVEL_7,
+ ZOOM_LEVEL_8,
+ ZOOM_LEVEL_9,
+ ZOOM_LEVEL_10,
+ ZOOM_LEVEL_11,
+ ZOOM_LEVEL_12,
+ ZOOM_LEVEL_MAX = 31,
+};
+
+#define V4L2_CID_CAMERA_FACE_DETECTION (V4L2_CID_PRIVATE_BASE+91)
+enum v4l2_face_detection {
+ FACE_DETECTION_OFF = 0,
+ FACE_DETECTION_ON,
+ FACE_DETECTION_NOLINE,
+ FACE_DETECTION_ON_BEAUTY,
+ FACE_DETECTION_NORMAL,
+ FACE_DETECTION_SMILE_SHOT,
+ FACE_DETECTION_BLINK,
+ FACE_DETECTION_MAX,
+};
+
+#define V4L2_CID_CAMERA_SMART_AUTO_STATUS (V4L2_CID_PRIVATE_BASE+92)
+enum v4l2_smart_auto_status {
+ SMART_AUTO_STATUS_AUTO = 0,
+ SMART_AUTO_STATUS_LANDSCAPE,
+ SMART_AUTO_STATUS_PORTRAIT,
+ SMART_AUTO_STATUS_MACRO,
+ SMART_AUTO_STATUS_NIGHT,
+ SMART_AUTO_STATUS_PORTRAIT_NIGHT,
+ SMART_AUTO_STATUS_BACKLIT,
+ SMART_AUTO_STATUS_PORTRAIT_BACKLIT,
+ SMART_AUTO_STATUS_ANTISHAKE,
+ SMART_AUTO_STATUS_PORTRAIT_ANTISHAKE,
+ SMART_AUTO_STATUS_MAX,
+};
+
+#define V4L2_CID_CAMERA_SET_AUTO_FOCUS (V4L2_CID_PRIVATE_BASE+93)
+enum v4l2_auto_focus {
+ AUTO_FOCUS_OFF = 0,
+ AUTO_FOCUS_ON,
+ AUTO_FOCUS_MAX,
+};
+
+#define V4L2_CID_CAMERA_BEAUTY_SHOT (V4L2_CID_PRIVATE_BASE+94)
+enum v4l2_beauty_shot {
+ BEAUTY_SHOT_OFF = 0,
+ BEAUTY_SHOT_ON,
+ BEAUTY_SHOT_MAX,
+};
+
+#define V4L2_CID_CAMERA_AEAWB_LOCK_UNLOCK (V4L2_CID_PRIVATE_BASE+95)
+enum v4l2_ae_awb_lockunlock {
+ AE_UNLOCK_AWB_UNLOCK = 0,
+ AE_LOCK_AWB_UNLOCK,
+ AE_UNLOCK_AWB_LOCK,
+ AE_LOCK_AWB_LOCK,
+ AE_AWB_MAX
+};
+
+#define V4L2_CID_CAMERA_FACEDETECT_LOCKUNLOCK (V4L2_CID_PRIVATE_BASE+96)
+enum v4l2_face_lock {
+ FACE_LOCK_OFF = 0,
+ FACE_LOCK_ON,
+ FIRST_FACE_TRACKING,
+ FACE_LOCK_MAX,
+};
+
+#define V4L2_CID_CAMERA_OBJECT_POSITION_X (V4L2_CID_PRIVATE_BASE+97)
+#define V4L2_CID_CAMERA_OBJECT_POSITION_Y (V4L2_CID_PRIVATE_BASE+98)
+#define V4L2_CID_CAMERA_FOCUS_MODE (V4L2_CID_PRIVATE_BASE+99)
+enum v4l2_focusmode {
+ FOCUS_MODE_AUTO = 0,
+ FOCUS_MODE_MACRO,
+ FOCUS_MODE_FACEDETECT,
+ FOCUS_MODE_AUTO_DEFAULT,
+ FOCUS_MODE_MACRO_DEFAULT,
+ FOCUS_MODE_FACEDETECT_DEFAULT,
+ FOCUS_MODE_INFINITY,
+ FOCUS_MODE_FIXED,
+ FOCUS_MODE_CONTINOUS,
+ FOCUS_MODE_CONTINOUS_PICTURE,
+ FOCUS_MODE_CONTINOUS_PICTURE_MACRO,
+ FOCUS_MODE_CONTINOUS_VIDEO,
+ FOCUS_MODE_TOUCH,
+ FOCUS_MODE_MAX,
+ FOCUS_MODE_DEFAULT = (1 << 8),
+};
+
+#define V4L2_CID_CAMERA_OBJ_TRACKING_STATUS (V4L2_CID_PRIVATE_BASE+100)
+enum v4l2_obj_tracking_status {
+ OBJECT_TRACKING_STATUS_BASE,
+ OBJECT_TRACKING_STATUS_PROGRESSING,
+ OBJECT_TRACKING_STATUS_SUCCESS,
+ OBJECT_TRACKING_STATUS_FAIL,
+ OBJECT_TRACKING_STATUS_MISSING,
+ OBJECT_TRACKING_STATUS_MAX,
+};
+
+#define V4L2_CID_CAMERA_OBJ_TRACKING_START_STOP (V4L2_CID_PRIVATE_BASE+101)
+enum v4l2_ot_start_stop {
+ OT_STOP = 0,
+ OT_START,
+ OT_MAX,
+};
+
+#define V4L2_CID_CAMERA_CAF_START_STOP (V4L2_CID_PRIVATE_BASE+102)
+enum v4l2_caf_start_stop {
+ CAF_STOP = 0,
+ CAF_START,
+ CAF_MAX,
+};
+
+#define V4L2_CID_CAMERA_AUTO_FOCUS_RESULT (V4L2_CID_PRIVATE_BASE+103)
+enum v4l2_af_status {
+ CAMERA_AF_STATUS_IN_PROGRESS = 0,
+ CAMERA_AF_STATUS_SUCCESS,
+ CAMERA_AF_STATUS_FAIL,
+ CAMERA_AF_STATUS_1ST_SUCCESS,
+ CAMERA_AF_STATUS_RESTART,
+ CAMERA_AF_STATUS_MAX,
+};
+
+#define V4L2_CID_CAMERA_FRAME_RATE (V4L2_CID_PRIVATE_BASE+104)
+enum v4l2_frame_rate {
+ FRAME_RATE_AUTO = 0,
+ FRAME_RATE_7 = 7,
+ FRAME_RATE_15 = 15,
+ FRAME_RATE_20 = 20,
+ FRAME_RATE_25 = 25,
+ FRAME_RATE_30 = 30,
+ FRAME_RATE_60 = 60,
+ FRAME_RATE_120 = 120,
+ FRAME_RATE_MAX
+};
+
+#define V4L2_CID_CAMERA_ANTI_BANDING (V4L2_CID_PRIVATE_BASE+105)
+enum v4l2_anti_banding {
+ ANTI_BANDING_AUTO = 0,
+ ANTI_BANDING_50HZ = 1,
+ ANTI_BANDING_60HZ = 2,
+ ANTI_BANDING_OFF = 3,
+};
+
+#define V4L2_CID_CAMERA_SET_GAMMA (V4L2_CID_PRIVATE_BASE+106)
+enum v4l2_gamma_mode {
+ GAMMA_OFF = 0,
+ GAMMA_ON = 1,
+ GAMMA_MAX,
+};
+
+#define V4L2_CID_CAMERA_SET_SLOW_AE (V4L2_CID_PRIVATE_BASE+107)
+enum v4l2_slow_ae_mode {
+ SLOW_AE_OFF,
+ SLOW_AE_ON,
+ SLOW_AE_MAX,
+};
+
+#define V4L2_CID_CAMERA_BATCH_REFLECTION (V4L2_CID_PRIVATE_BASE+108)
+#define V4L2_CID_CAMERA_EXIF_ORIENTATION (V4L2_CID_PRIVATE_BASE+109)
+#define V4L2_CID_CAMERA_GET_LUX (V4L2_CID_PRIVATE_BASE+110)
+
+/* s1_camera [ Defense process by ESD input ] */
+#define V4L2_CID_CAMERA_RESET (V4L2_CID_PRIVATE_BASE+111)
+#define V4L2_CID_CAMERA_CHECK_DATALINE (V4L2_CID_PRIVATE_BASE+112)
+#define V4L2_CID_CAMERA_CHECK_DATALINE_STOP (V4L2_CID_PRIVATE_BASE+113)
+
+#endif
+
+/* Modify NTTS1 */
+#if defined(CONFIG_ARIES_NTT)
+#define V4L2_CID_CAMERA_AE_AWB_DISABLE_LOCK (V4L2_CID_PRIVATE_BASE+114)
+#endif
+#define V4L2_CID_CAMERA_THUMBNAIL_NULL (V4L2_CID_PRIVATE_BASE+115)
+#define V4L2_CID_CAMERA_SENSOR_MODE (V4L2_CID_PRIVATE_BASE+116)
+enum v4l2_sensor_mode {
+ SENSOR_CAMERA,
+ SENSOR_MOVIE,
+};
+
+enum stream_mode_t {
+ STREAM_MODE_CAM_OFF,
+ STREAM_MODE_CAM_ON,
+ STREAM_MODE_MOVIE_OFF,
+ STREAM_MODE_MOVIE_ON,
+ STREAM_MODE_WAIT_OFF
+};
+
+#define V4L2_CID_CAMERA_EXIF_EXPTIME (V4L2_CID_PRIVATE_BASE+117)
+#define V4L2_CID_CAMERA_EXIF_FLASH (V4L2_CID_PRIVATE_BASE+118)
+#define V4L2_CID_CAMERA_EXIF_ISO (V4L2_CID_PRIVATE_BASE+119)
+#define V4L2_CID_CAMERA_EXIF_TV (V4L2_CID_PRIVATE_BASE+120)
+#define V4L2_CID_CAMERA_EXIF_BV (V4L2_CID_PRIVATE_BASE+121)
+#define V4L2_CID_CAMERA_EXIF_EBV (V4L2_CID_PRIVATE_BASE+122)
+#define V4L2_CID_CAMERA_CHECK_ESD (V4L2_CID_PRIVATE_BASE+123)
+#define V4L2_CID_CAMERA_APP_CHECK (V4L2_CID_PRIVATE_BASE+124)
+#define V4L2_CID_CAMERA_CHECK_SENSOR_STATUS (V4L2_CID_PRIVATE_BASE+150)
+#define V4L2_CID_CAMERA_DEFAULT_FOCUS_POSITION (V4L2_CID_PRIVATE_BASE+151)
+#define V4L2_CID_CAMERA_BUSFREQ_LOCK (V4L2_CID_PRIVATE_BASE+125)
+#define V4L2_CID_CAMERA_BUSFREQ_UNLOCK (V4L2_CID_PRIVATE_BASE+126)
+
+/* If you would like to control AE and AWB lock with signle command,
+ * use V4L2_CID_CAMERA_AEAWB_LOCK_UNLOCK above.
+ */
+#define V4L2_CID_CAMERA_AE_LOCK_UNLOCK (V4L2_CID_PRIVATE_BASE + 127)
+enum v4l2_ae_lockunlock {
+ AE_UNLOCK = 0,
+ AE_LOCK,
+ AE_LOCK_MAX
+};
+
+#define V4L2_CID_CAMERA_AWB_LOCK_UNLOCK (V4L2_CID_PRIVATE_BASE + 128)
+enum v4l2_awb_lockunlock {
+ AWB_UNLOCK = 0,
+ AWB_LOCK,
+ AWB_LOCK_MAX
+};
+
+#define V4L2_CID_CAMERA_SENSOR_OUTPUT_SIZE (V4L2_CID_PRIVATE_BASE + 129)
+#define V4L2_CID_EMBEDDEDDATA_ENABLE (V4L2_CID_PRIVATE_BASE + 130)
+#define V4L2_CID_CAMERA_JPEG_RESOLUTION (V4L2_CID_PRIVATE_BASE + 131)
+#define V4L2_CID_CAMERA_FACE_ZOOM (V4L2_CID_PRIVATE_BASE + 132)
+enum v4l2_face_zoom {
+ FACE_ZOOM_STOP = 0,
+ FACE_ZOOM_START
+};
+
+/* control for post processing block in ISP */
+#define V4L2_CID_CAMERA_SET_ODC (V4L2_CID_PRIVATE_BASE+127)
+enum set_odc_mode {
+ CAMERA_ODC_ON,
+ CAMERA_ODC_OFF
+};
+
+#define V4L2_CID_CAMERA_SET_DIS (V4L2_CID_PRIVATE_BASE+128)
+enum set_dis_mode {
+ CAMERA_DIS_ON,
+ CAMERA_DIS_OFF
+};
+
+#define V4L2_CID_CAMERA_SET_3DNR (V4L2_CID_PRIVATE_BASE+129)
+enum set_3dnr_mode {
+ CAMERA_3DNR_ON,
+ CAMERA_3DNR_OFF
+};
+
+#define V4L2_CID_CAMERA_BRACKET (V4L2_CID_PRIVATE_BASE+134)
+enum v4l2_face_bracket_mode {
+ BRACKET_MODE_OFF = 0,
+ BRACKET_MODE_AEB,
+ BRACKET_MODE_WBB,
+ BRACKET_MODE_MAX,
+};
+
+#define V4L2_CID_CAMERA_BRACKET_AEB (V4L2_CID_PRIVATE_BASE+135)
+enum v4l2_face_bracket_aeb_value {
+ BRACKET_AEB_VALUE1 = 1,
+ BRACKET_AEB_VALUE2,
+ BRACKET_AEB_VALUE3,
+ BRACKET_AEB_VALUE4,
+ BRACKET_AEB_VALUE5,
+ BRACKET_AEB_VALUE6,
+};
+
+#define V4L2_CID_CAMERA_BRACKET_WBB (V4L2_CID_PRIVATE_BASE+136)
+enum v4l2_face_bracket_wbb_value {
+ BRACKET_WBB_VALUE1 = 1,
+ BRACKET_WBB_VALUE2,
+ BRACKET_WBB_VALUE3,
+ BRACKET_WBB_VALUE4,
+ BRACKET_WBB_VALUE5,
+ BRACKET_WBB_VALUE6,
+};
+
+#define V4L2_CID_CAMERA_DRIVE_DIAL (V4L2_CID_PRIVATE_BASE+137)
+enum v4l2_drive_dial {
+ DRIVEDIAL_SINGLE = 1,
+ DRIVEDIAL_BKT = 2,
+ DRIVEDIAL_CONTI_3 = 3,
+ DRIVEDIAL_CONTI_5 = 5,
+ DRIVEDIAL_CONTI_10 = 10,
+};
+
+enum v4l2_running_cap_mode {
+ RUNNING_MODE_SINGLE = 0,
+ RUNNING_MODE_CONTINUOUS,
+ RUNNING_MODE_BRACKET,
+ RUNNING_MODE_HDR,
+ RUNNING_MODE_BLINK,
+ RUNNING_MODE_MAX
+};
+
+#define V4L2_CID_CAMERA_FD_EYE_BLINK_RESULT (V4L2_CID_PRIVATE_BASE+138)
+
+#define V4L2_CID_CAMERA_OPTICAL_ZOOM_STEP (V4L2_CID_PRIVATE_BASE + 139)
+#define V4L2_CID_CAMERA_OPTICAL_ZOOM_CTRL (V4L2_CID_PRIVATE_BASE + 140)
+
+enum v4l2_optical_zoom_ctrl {
+ V4L2_OPTICAL_ZOOM_TELE,
+ V4L2_OPTICAL_ZOOM_WIDE,
+ V4L2_OPTICAL_ZOOM_STOP,
+};
+
+#define V4L2_CID_CAMERA_LDC (V4L2_CID_PRIVATE_BASE+142)
+enum set_LDC_mode {
+ LDC_SET_OFF = 0,
+ LDC_SET_ON = 1,
+};
+
+#define V4L2_CID_CAMERA_LSC (V4L2_CID_PRIVATE_BASE+143)
+enum set_LSC_mode {
+ LSC_SET_OFF = 0,
+ LSC_SET_ON = 1,
+};
+
+/* Pixel format FOURCC depth Description */
+enum v4l2_pix_format_mode {
+ V4L2_PIX_FMT_MODE_PREVIEW,
+ V4L2_PIX_FMT_MODE_CAPTURE,
+ V4L2_PIX_FMT_MODE_HDR,
+ V4L2_PIX_FMT_MODE_VT_MIRROR,
+ V4L2_PIX_FMT_MODE_VT_NONMIRROR,
+};
+
+/* 12 Y/CbCr 4:2:0 64x32 macroblocks */
+#define V4L2_PIX_FMT_NV12T v4l2_fourcc('T', 'V', '1', '2')
+#define V4L2_PIX_FMT_NV21T v4l2_fourcc('T', 'V', '2', '1')
+#define V4L2_PIX_FMT_INTERLEAVED v4l2_fourcc('I', 'T', 'L', 'V')
+
+/*
+ * * V4L2 extention for digital camera
+ * */
+/* Strobe flash light */
+enum v4l2_strobe_control {
+ /* turn off the flash light */
+ V4L2_STROBE_CONTROL_OFF = 0,
+ /* turn on the flash light */
+ V4L2_STROBE_CONTROL_ON = 1,
+ /* act guide light before splash */
+ V4L2_STROBE_CONTROL_AFGUIDE = 2,
+ /* charge the flash light */
+ V4L2_STROBE_CONTROL_CHARGE = 3,
+};
+
+enum v4l2_strobe_conf {
+ V4L2_STROBE_OFF = 0, /* Always off */
+ V4L2_STROBE_ON = 1, /* Always splashes */
+ /* Auto control presets */
+ V4L2_STROBE_AUTO = 2,
+ V4L2_STROBE_REDEYE_REDUCTION = 3,
+ V4L2_STROBE_SLOW_SYNC = 4,
+ V4L2_STROBE_FRONT_CURTAIN = 5,
+ V4L2_STROBE_REAR_CURTAIN = 6,
+ /* Extra manual control presets */
+ /* keep turned on until turning off */
+ V4L2_STROBE_PERMANENT = 7,
+ V4L2_STROBE_EXTERNAL = 8,
+};
+
+enum v4l2_strobe_status {
+ V4L2_STROBE_STATUS_OFF = 0,
+ /* while processing configurations */
+ V4L2_STROBE_STATUS_BUSY = 1,
+ V4L2_STROBE_STATUS_ERR = 2,
+ V4L2_STROBE_STATUS_CHARGING = 3,
+ V4L2_STROBE_STATUS_CHARGED = 4,
+};
+
+/* capabilities field */
+/* No strobe supported */
+#define V4L2_STROBE_CAP_NONE 0x0000
+/* Always flash off mode */
+#define V4L2_STROBE_CAP_OFF 0x0001
+/* Always use flash light mode */
+#define V4L2_STROBE_CAP_ON 0x0002
+/* Flashlight works automatic */
+#define V4L2_STROBE_CAP_AUTO 0x0004
+/* Red-eye reduction */
+#define V4L2_STROBE_CAP_REDEYE 0x0008
+/* Slow sync */
+#define V4L2_STROBE_CAP_SLOWSYNC 0x0010
+/* Front curtain */
+#define V4L2_STROBE_CAP_FRONT_CURTAIN 0x0020
+/* Rear curtain */
+#define V4L2_STROBE_CAP_REAR_CURTAIN 0x0040
+/* keep turned on until turning off */
+#define V4L2_STROBE_CAP_PERMANENT 0x0080
+/* use external strobe */
+#define V4L2_STROBE_CAP_EXTERNAL 0x0100
+
+/* Set mode and Get status */
+struct v4l2_strobe {
+ /* off/on/charge:0/1/2 */
+ enum v4l2_strobe_control control;
+ /* supported strobe capabilities */
+ __u32 capabilities;
+ enum v4l2_strobe_conf mode;
+ enum v4l2_strobe_status status; /* read only */
+/* default is 0 and range of value varies from each models */
+ __u32 flash_ev;
+ __u32 reserved[4];
+};
+
+#define VIDIOC_S_STROBE _IOWR('V', 83, struct v4l2_strobe)
+#define VIDIOC_G_STROBE _IOR('V', 84, struct v4l2_strobe)
+
+/* Object recognition and collateral actions */
+enum v4l2_recog_mode {
+ V4L2_RECOGNITION_MODE_OFF = 0,
+ V4L2_RECOGNITION_MODE_ON = 1,
+ V4L2_RECOGNITION_MODE_LOCK = 2,
+};
+
+enum v4l2_recog_action {
+ V4L2_RECOGNITION_ACTION_NONE = 0, /* only recognition */
+ V4L2_RECOGNITION_ACTION_BLINK = 1, /* Capture on blinking */
+ V4L2_RECOGNITION_ACTION_SMILE = 2, /* Capture on smiling */
+};
+
+enum v4l2_recog_pattern {
+ V4L2_RECOG_PATTERN_FACE = 0, /* Face */
+ V4L2_RECOG_PATTERN_HUMAN = 1, /* Human */
+ V4L2_RECOG_PATTERN_CHAR = 2, /* Character */
+};
+
+struct v4l2_recog_rect {
+ enum v4l2_recog_pattern p; /* detected pattern */
+ struct v4l2_rect o; /* detected area */
+ __u32 reserved[4];
+};
+
+struct v4l2_recog_data {
+ __u8 detect_cnt; /* detected object counter */
+ struct v4l2_rect o; /* detected area */
+ __u32 reserved[4];
+};
+
+struct v4l2_recognition {
+ enum v4l2_recog_mode mode;
+
+ /* Which pattern to detect */
+ enum v4l2_recog_pattern pattern;
+
+ /* How many object to detect */
+ __u8 obj_num;
+
+ /* select detected object */
+ __u32 detect_idx;
+
+ /* read only :Get object coordination */
+ struct v4l2_recog_data data;
+
+ enum v4l2_recog_action action;
+ __u32 reserved[4];
+};
+
+#define VIDIOC_S_RECOGNITION _IOWR('V', 85, struct v4l2_recognition)
+#define VIDIOC_G_RECOGNITION _IOR('V', 86, struct v4l2_recognition)
+
+#endif /* __LINUX_VIDEODEV2_SAMSUNG_H */
diff --git a/include/linux/videodev2_exynos_media.h b/include/linux/videodev2_exynos_media.h
new file mode 100644
index 0000000..2768201
--- /dev/null
+++ b/include/linux/videodev2_exynos_media.h
@@ -0,0 +1,225 @@
+/*
+ * Video for Linux Two header file for Exynos
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * http://www.samsung.com
+ *
+ * This header file contains several v4l2 APIs to be proposed to v4l2
+ * community and until being accepted, will be used restrictly for Exynos.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LINUX_VIDEODEV2_EXYNOS_H
+#define __LINUX_VIDEODEV2_EXYNOS_H
+
+/* Pixel format FOURCC depth Description */
+
+/* two planes -- one Y, one Cr + Cb interleaved */
+#define V4L2_PIX_FMT_YUV444_2P v4l2_fourcc('Y', 'U', '2', 'P') /* 24 Y/CbCr */
+#define V4L2_PIX_FMT_YVU444_2P v4l2_fourcc('Y', 'V', '2', 'P') /* 24 Y/CrCb */
+
+/* three planes -- one Y, one Cr, one Cb */
+#define V4L2_PIX_FMT_YUV444_3P v4l2_fourcc('Y', 'U', '3', 'P') /* 24 Y/Cb/Cr */
+
+/* two non contiguous planes - one Y, one Cr + Cb interleaved */
+/* 21 Y/CrCb 4:2:0 */
+#define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1')
+/* 12 Y/CbCr 4:2:0 16x16 macroblocks */
+#define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2')
+
+/* three non contiguous planes - Y, Cb, Cr */
+/* 12 YVU420 planar */
+#define V4L2_PIX_FMT_YVU420M v4l2_fourcc('Y', 'V', 'U', 'M')
+
+/* compressed formats */
+#define V4L2_PIX_FMT_H264_MVC v4l2_fourcc('M', '2', '6', '4') /* H264 MVC */
+#define V4L2_PIX_FMT_FIMV v4l2_fourcc('F', 'I', 'M', 'V') /* FIMV */
+#define V4L2_PIX_FMT_FIMV1 v4l2_fourcc('F', 'I', 'M', '1') /* FIMV1 */
+#define V4L2_PIX_FMT_FIMV2 v4l2_fourcc('F', 'I', 'M', '2') /* FIMV2 */
+#define V4L2_PIX_FMT_FIMV3 v4l2_fourcc('F', 'I', 'M', '3') /* FIMV3 */
+#define V4L2_PIX_FMT_FIMV4 v4l2_fourcc('F', 'I', 'M', '4') /* FIMV4 */
+#define V4L2_PIX_FMT_VP8 v4l2_fourcc('V', 'P', '8', '0') /* VP8 */
+
+/* yuv444 of JFIF JPEG */
+#define V4L2_PIX_FMT_JPEG_444 v4l2_fourcc('J', 'P', 'G', '4')
+/* yuv422 of JFIF JPEG */
+#define V4L2_PIX_FMT_JPEG_422 v4l2_fourcc('J', 'P', 'G', '2')
+/* yuv420 of JFIF JPEG */
+#define V4L2_PIX_FMT_JPEG_420 v4l2_fourcc('J', 'P', 'G', '0')
+/* grey of JFIF JPEG */
+#define V4L2_PIX_FMT_JPEG_GRAY v4l2_fourcc('J', 'P', 'G', 'G')
+
+/*
+ * C O N T R O L S
+ */
+/* CID base for Exynos controls (USER_CLASS) */
+#define V4L2_CID_EXYNOS_BASE (V4L2_CTRL_CLASS_USER | 0x2000)
+
+/* for rgb alpha function */
+#define V4L2_CID_GLOBAL_ALPHA (V4L2_CID_EXYNOS_BASE + 1)
+
+/* cacheable configuration */
+#define V4L2_CID_CACHEABLE (V4L2_CID_EXYNOS_BASE + 10)
+
+/* jpeg captured size */
+#define V4L2_CID_CAM_JPEG_MEMSIZE (V4L2_CID_EXYNOS_BASE + 20)
+#define V4L2_CID_CAM_JPEG_ENCODEDSIZE (V4L2_CID_EXYNOS_BASE + 21)
+
+#define V4L2_CID_SET_SHAREABLE (V4L2_CID_EXYNOS_BASE + 40)
+
+/* TV configuration */
+#define V4L2_CID_TV_LAYER_BLEND_ENABLE (V4L2_CID_EXYNOS_BASE + 50)
+#define V4L2_CID_TV_LAYER_BLEND_ALPHA (V4L2_CID_EXYNOS_BASE + 51)
+#define V4L2_CID_TV_PIXEL_BLEND_ENABLE (V4L2_CID_EXYNOS_BASE + 52)
+#define V4L2_CID_TV_CHROMA_ENABLE (V4L2_CID_EXYNOS_BASE + 53)
+#define V4L2_CID_TV_CHROMA_VALUE (V4L2_CID_EXYNOS_BASE + 54)
+#define V4L2_CID_TV_HPD_STATUS (V4L2_CID_EXYNOS_BASE + 55)
+#define V4L2_CID_TV_LAYER_PRIO (V4L2_CID_EXYNOS_BASE + 56)
+#define V4L2_CID_TV_SET_DVI_MODE (V4L2_CID_EXYNOS_BASE + 57)
+
+/* for color space conversion equation selection */
+#define V4L2_CID_CSC_EQ_MODE (V4L2_CID_EXYNOS_BASE + 100)
+#define V4L2_CID_CSC_EQ (V4L2_CID_EXYNOS_BASE + 101)
+#define V4L2_CID_CSC_RANGE (V4L2_CID_EXYNOS_BASE + 102)
+
+/* for DRM playback scenario */
+#define V4L2_CID_USE_SYSMMU (V4L2_CID_EXYNOS_BASE + 200)
+#define V4L2_CID_M2M_CTX_NUM (V4L2_CID_EXYNOS_BASE + 201)
+
+/* CID base for MFC controls (MPEG_CLASS) */
+#define V4L2_CID_MPEG_MFC_BASE (V4L2_CTRL_CLASS_MPEG | 0x2000)
+
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_AVAIL \
+ (V4L2_CID_MPEG_MFC_BASE + 1)
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRGMENT_ID \
+ (V4L2_CID_MPEG_MFC_BASE + 2)
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_INFO \
+ (V4L2_CID_MPEG_MFC_BASE + 3)
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_GRID_POS \
+ (V4L2_CID_MPEG_MFC_BASE + 4)
+
+#define V4L2_CID_MPEG_MFC51_VIDEO_PACKED_PB \
+ (V4L2_CID_MPEG_MFC_BASE + 5)
+#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_TAG \
+ (V4L2_CID_MPEG_MFC_BASE + 6)
+#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_ENABLE \
+ (V4L2_CID_MPEG_MFC_BASE + 7)
+#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_DATA_LUMA \
+ (V4L2_CID_MPEG_MFC_BASE + 8)
+#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_DATA_CHROMA \
+ (V4L2_CID_MPEG_MFC_BASE + 9)
+#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_DATA_LUMA_BOT \
+ (V4L2_CID_MPEG_MFC_BASE + 10)
+#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_DATA_CHROMA_BOT \
+ (V4L2_CID_MPEG_MFC_BASE + 11)
+#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_GENERATED \
+ (V4L2_CID_MPEG_MFC_BASE + 12)
+#define V4L2_CID_MPEG_MFC51_VIDEO_CHECK_STATE \
+ (V4L2_CID_MPEG_MFC_BASE + 13)
+#define V4L2_CID_MPEG_MFC51_VIDEO_DISPLAY_STATUS \
+ (V4L2_CID_MPEG_MFC_BASE + 14)
+
+#define V4L2_CID_MPEG_MFC51_VIDEO_LUMA_ADDR \
+ (V4L2_CID_MPEG_MFC_BASE + 15)
+#define V4L2_CID_MPEG_MFC51_VIDEO_CHROMA_ADDR \
+ (V4L2_CID_MPEG_MFC_BASE + 16)
+
+#define V4L2_CID_MPEG_MFC51_VIDEO_STREAM_SIZE \
+ (V4L2_CID_MPEG_MFC_BASE + 17)
+#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_COUNT \
+ (V4L2_CID_MPEG_MFC_BASE + 18)
+#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_TYPE \
+ (V4L2_CID_MPEG_MFC_BASE + 19)
+enum v4l2_mpeg_mfc51_video_frame_type {
+ V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_NOT_CODED = 0,
+ V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_I_FRAME = 1,
+ V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_P_FRAME = 2,
+ V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_B_FRAME = 3,
+ V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_SKIPPED = 4,
+ V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_OTHERS = 5,
+};
+
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_INTERLACE \
+ (V4L2_CID_MPEG_MFC_BASE + 20)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H264_RC_FRAME_RATE \
+ (V4L2_CID_MPEG_MFC_BASE + 21)
+#define V4L2_CID_MPEG_MFC51_VIDEO_MPEG4_VOP_TIME_RES \
+ (V4L2_CID_MPEG_MFC_BASE + 22)
+#define V4L2_CID_MPEG_MFC51_VIDEO_MPEG4_VOP_FRM_DELTA \
+ (V4L2_CID_MPEG_MFC_BASE + 23)
+#define V4L2_CID_MPEG_MFC51_VIDEO_H263_RC_FRAME_RATE \
+ (V4L2_CID_MPEG_MFC_BASE + 24)
+
+#define V4L2_CID_MPEG_MFC6X_VIDEO_FRAME_DELTA \
+ (V4L2_CID_MPEG_MFC_BASE + 25)
+
+#define V4L2_CID_MPEG_MFC51_VIDEO_I_PERIOD_CH V4L2_CID_MPEG_VIDEO_GOP_SIZE
+#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_RATE_CH \
+ V4L2_CID_MPEG_MFC51_VIDEO_H264_RC_FRAME_RATE
+#define V4L2_CID_MPEG_MFC51_VIDEO_BIT_RATE_CH V4L2_CID_MPEG_VIDEO_BITRATE
+
+/* proposed CIDs, based on 3.3-rc3 */
+#define V4L2_CID_MPEG_VIDEO_VBV_DELAY (V4L2_CID_MPEG_MFC_BASE + 26)
+
+#define V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_S_B \
+ V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY
+
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FRAME_PACKING \
+ (V4L2_CID_MPEG_MFC_BASE + 27)
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_CURRENT_FRAME_0 \
+ (V4L2_CID_MPEG_MFC_BASE + 28)
+#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE \
+ (V4L2_CID_MPEG_MFC_BASE + 29)
+enum v4l2_mpeg_video_h264_sei_fp_arrangement_type {
+ V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_CHEKERBOARD = 0,
+ V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_COLUMN = 1,
+ V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_ROW = 2,
+ V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_SIDE_BY_SIDE = 3,
+ V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_TOP_BOTTOM = 4,
+ V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_TEMPORAL = 5,
+};
+#define V4L2_CID_MPEG_VIDEO_H264_FMO (V4L2_CID_MPEG_MFC_BASE + 30)
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE (V4L2_CID_MPEG_MFC_BASE + 31)
+enum v4l2_mpeg_video_h264_fmo_map_type {
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_INTERLEAVED_SLICES = 0,
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_SCATTERED_SLICES = 1,
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_FOREGROUND_WITH_LEFT_OVER = 2,
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_BOX_OUT = 3,
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_RASTER_SCAN = 4,
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_WIPE_SCAN = 5,
+ V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_EXPLICIT = 6,
+};
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_SLICE_GROUP \
+ (V4L2_CID_MPEG_MFC_BASE + 32)
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_DIRECTION \
+ (V4L2_CID_MPEG_MFC_BASE + 33)
+enum v4l2_mpeg_video_h264_fmo_change_dir {
+ V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_RIGHT = 0,
+ V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_LEFT = 1,
+};
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_RATE \
+ (V4L2_CID_MPEG_MFC_BASE + 34)
+#define V4L2_CID_MPEG_VIDEO_H264_FMO_RUN_LENGTH \
+ (V4L2_CID_MPEG_MFC_BASE + 35)
+#define V4L2_CID_MPEG_VIDEO_H264_ASO \
+ (V4L2_CID_MPEG_MFC_BASE + 36)
+#define V4L2_CID_MPEG_VIDEO_H264_ASO_SLICE_ORDER \
+ (V4L2_CID_MPEG_MFC_BASE + 37)
+#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING \
+ (V4L2_CID_MPEG_MFC_BASE + 38)
+#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE \
+ (V4L2_CID_MPEG_MFC_BASE + 39)
+enum v4l2_mpeg_video_h264_hierarchical_coding_type {
+ V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_B = 0,
+ V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_P = 1,
+};
+#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER \
+ (V4L2_CID_MPEG_MFC_BASE + 40)
+#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP \
+ (V4L2_CID_MPEG_MFC_BASE + 41)
+#define V4L2_CID_MPEG_VIDEO_H264_MVC_VIEW_ID \
+ (V4L2_CID_MPEG_MFC_BASE + 42)
+#endif /* __LINUX_VIDEODEV2_EXYNOS_H */
diff --git a/include/linux/wacom_i2c.h b/include/linux/wacom_i2c.h
new file mode 100644
index 0000000..209fe53
--- /dev/null
+++ b/include/linux/wacom_i2c.h
@@ -0,0 +1,213 @@
+
+#ifndef _LINUX_WACOM_I2C_H
+#define _LINUX_WACOM_I2C_H
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/input.h>
+#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/slab.h>
+#include <linux/hrtimer.h>
+#include <linux/gpio.h>
+#include <linux/irq.h>
+#include <linux/delay.h>
+#include <linux/wakelock.h>
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+#include <linux/earlysuspend.h>
+#endif
+
+#define NAMEBUF 12
+#define WACNAME "WAC_I2C_EMR"
+#define WACFLASH "WAC_I2C_FLASH"
+#define WACOM_FW_SIZE 32768
+
+/*Wacom Command*/
+#define COM_COORD_NUM 7
+#define COM_QUERY_NUM 9
+
+#define COM_SAMPLERATE_40 0x33
+#define COM_SAMPLERATE_80 0x32
+#define COM_SAMPLERATE_133 0x31
+#define COM_SURVEYSCAN 0x2B
+#define COM_QUERY 0x2A
+#define COM_FLASH 0xff
+#define COM_CHECKSUM 0x63
+
+/*I2C address for digitizer and its boot loader*/
+#define WACOM_I2C_ADDR 0x56
+#define WACOM_I2C_BOOT 0x57
+
+/*Information for input_dev*/
+#define EMR 0
+#define WACOM_PKGLEN_I2C_EMR 0
+
+/*Enable/disable irq*/
+#define ENABLE_IRQ 1
+#define DISABLE_IRQ 0
+
+/*Special keys*/
+#define EPEN_TOOL_PEN 0x220
+#define EPEN_TOOL_RUBBER 0x221
+#define EPEN_STYLUS 0x22b
+#define EPEN_STYLUS2 0x22c
+
+#define WACOM_DELAY_FOR_RST_RISING 200
+/* #define INIT_FIRMWARE_FLASH */
+
+/*PDCT Signal*/
+#define PDCT_NOSIGNAL 1
+#define PDCT_DETECT_PEN 0
+#define WACOM_PDCT_WORK_AROUND
+
+#if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_P4)
+#ifdef CONFIG_SEC_TOUCHSCREEN_DVFS_LOCK
+#define SEC_BUS_LOCK
+#endif
+#define WACOM_HAVE_RESET_CONTROL 0
+#define WACOM_POSX_MAX 21866
+#define WACOM_POSY_MAX 13730
+#define WACOM_POSX_OFFSET 170
+#define WACOM_POSY_OFFSET 170
+#define WACOM_IRQ_WORK_AROUND
+#elif defined(CONFIG_MACH_Q1_BD)
+#define BOARD_Q1C210
+#define COOR_WORK_AROUND
+#define WACOM_IMPORT_FW_ALGO
+#define WACOM_SLEEP_WITH_PEN_SLP
+#define WACOM_HAVE_RESET_CONTROL 1
+#define CONFIG_SEC_TOUCHSCREEN_DVFS_LOCK
+
+#if defined(BOARD_P4ADOBE) && defined(COOR_WORK_AROUND)
+ #define COOR_WORK_AROUND_X_MAX 0x54C0
+ #define COOR_WORK_AROUND_Y_MAX 0x34F8
+ #define COOR_WORK_AROUND_PRESSURE_MAX 0xFF
+#elif (defined(BOARD_Q1OMAP4430) || defined(BOARD_Q1C210))\
+ && defined(COOR_WORK_AROUND)
+ #define COOR_WORK_AROUND_X_MAX 0x2C80
+ #define COOR_WORK_AROUND_Y_MAX 0x1BD0
+ #define COOR_WORK_AROUND_PRESSURE_MAX 0xFF
+#endif
+
+#define WACOM_I2C_TRANSFER_STYLE
+#if !defined(WACOM_I2C_TRANSFER_STYLE)
+#define WACOM_I2C_RECV_SEND_STYLE
+#endif
+
+#ifdef CONFIG_MACH_Q1_BD
+/* For Android origin */
+#define WACOM_POSX_MAX 7120
+#define WACOM_POSY_MAX 11392
+#define WACOM_PRESSURE_MAX 255
+
+#define MAX_ROTATION 4
+#define MAX_HAND 2
+#endif /* CONFIG_MACH_Q1_BD */
+#endif /* !defined(WACOM_P4) */
+
+#if !defined(WACOM_SLEEP_WITH_PEN_SLP)
+#define WACOM_SLEEP_WITH_PEN_LDO_EN
+#endif
+
+/*Parameters for wacom own features*/
+struct wacom_features {
+ int x_max;
+ int y_max;
+ int pressure_max;
+ char comstat;
+#if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_P4)
+ u8 data[COM_QUERY_NUM];
+#else
+ u8 data[COM_COORD_NUM];
+#endif
+ unsigned int fw_version;
+ int firm_update_status;
+};
+
+/*sec_class sysfs*/
+extern struct class *sec_class;
+
+static struct wacom_features wacom_feature_EMR = {
+#if defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_P4)
+ .x_max = 0x54C0,
+ .y_max = 0x34F8,
+ .pressure_max = 0xFF,
+#else
+ .x_max = 16128,
+ .y_max = 8448,
+ .pressure_max = 256,
+#endif
+ .comstat = COM_QUERY,
+ .data = {0, 0, 0, 0, 0, 0, 0},
+ .fw_version = 0x0,
+ .firm_update_status = 0,
+};
+
+struct wacom_g5_callbacks {
+ int (*check_prox)(struct wacom_g5_callbacks *);
+};
+
+struct wacom_g5_platform_data {
+ char *name;
+ int x_invert;
+ int y_invert;
+ int xy_switch;
+ int min_x;
+ int max_x;
+ int min_y;
+ int max_y;
+ int max_pressure;
+ int min_pressure;
+ int gpio_pendct;
+ int (*init_platform_hw)(void);
+ int (*exit_platform_hw)(void);
+ int (*suspend_platform_hw)(void);
+ int (*resume_platform_hw)(void);
+ int (*early_suspend_platform_hw)(void);
+ int (*late_resume_platform_hw)(void);
+ int (*reset_platform_hw)(void);
+ void (*register_cb)(struct wacom_g5_callbacks *);
+};
+
+/*Parameters for i2c driver*/
+struct wacom_i2c {
+ struct i2c_client *client;
+ struct input_dev *input_dev;
+ struct early_suspend early_suspend;
+ struct mutex lock;
+ struct wake_lock wakelock;
+ struct device *dev;
+ int irq;
+#ifdef WACOM_PDCT_WORK_AROUND
+ int irq_pdct;
+#endif
+ int pen_pdct;
+ int gpio;
+ int irq_flag;
+ int pen_prox;
+ int pen_pressed;
+ int side_pressed;
+ int tool;
+ const char name[NAMEBUF];
+ struct wacom_features *wac_feature;
+ struct wacom_g5_platform_data *wac_pdata;
+ struct wacom_g5_callbacks callbacks;
+ int (*power)(int on);
+ struct work_struct update_work;
+ struct delayed_work resume_work;
+#ifdef WACOM_IRQ_WORK_AROUND
+ struct delayed_work pendct_dwork;
+#endif
+#ifdef CONFIG_SEC_TOUCHSCREEN_DVFS_LOCK
+ unsigned int cpufreq_level;
+ bool dvfs_lock_status;
+ struct delayed_work dvfs_work;
+#if defined(CONFIG_MACH_P4NOTE)
+ struct device *bus_dev;
+#endif
+#endif
+};
+
+#endif /* _LINUX_WACOM_I2C_H */
diff --git a/include/linux/wakelock.h b/include/linux/wakelock.h
new file mode 100755
index 0000000..a9407fe
--- /dev/null
+++ b/include/linux/wakelock.h
@@ -0,0 +1,90 @@
+/* include/linux/wakelock.h
+ *
+ * Copyright (C) 2007-2008 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_WAKELOCK_H
+#define _LINUX_WAKELOCK_H
+
+#include <linux/list.h>
+#include <linux/ktime.h>
+
+/* A wake_lock prevents the system from entering suspend or other low power
+ * states when active. If the type is set to WAKE_LOCK_SUSPEND, the wake_lock
+ * prevents a full system suspend. If the type is WAKE_LOCK_IDLE, low power
+ * states that cause large interrupt latencies or that disable a set of
+ * interrupts will not entered from idle until the wake_locks are released.
+ */
+
+enum {
+ WAKE_LOCK_SUSPEND, /* Prevent suspend */
+ WAKE_LOCK_IDLE, /* Prevent low power idle */
+ WAKE_LOCK_TYPE_COUNT
+};
+
+struct wake_lock {
+#ifdef CONFIG_HAS_WAKELOCK
+ struct list_head link;
+ int flags;
+ const char *name;
+ unsigned long expires;
+#ifdef CONFIG_WAKELOCK_STAT
+ struct {
+ int count;
+ int expire_count;
+ int wakeup_count;
+ ktime_t total_time;
+ ktime_t prevent_suspend_time;
+ ktime_t max_time;
+ ktime_t last_time;
+ } stat;
+#endif
+#endif
+};
+
+#ifdef CONFIG_HAS_WAKELOCK
+
+void wake_lock_init(struct wake_lock *lock, int type, const char *name);
+void wake_lock_destroy(struct wake_lock *lock);
+void wake_lock(struct wake_lock *lock);
+void wake_lock_timeout(struct wake_lock *lock, long timeout);
+void wake_unlock(struct wake_lock *lock);
+
+/* wake_lock_active returns a non-zero value if the wake_lock is currently
+ * locked. If the wake_lock has a timeout, it does not check the timeout
+ * but if the timeout had aready been checked it will return 0.
+ */
+int wake_lock_active(struct wake_lock *lock);
+
+/* has_wake_lock returns 0 if no wake locks of the specified type are active,
+ * and non-zero if one or more wake locks are held. Specifically it returns
+ * -1 if one or more wake locks with no timeout are active or the
+ * number of jiffies until all active wake locks time out.
+ */
+long has_wake_lock(int type);
+
+#else
+
+static inline void wake_lock_init(struct wake_lock *lock, int type,
+ const char *name) {}
+static inline void wake_lock_destroy(struct wake_lock *lock) {}
+static inline void wake_lock(struct wake_lock *lock) {}
+static inline void wake_lock_timeout(struct wake_lock *lock, long timeout) {}
+static inline void wake_unlock(struct wake_lock *lock) {}
+
+static inline int wake_lock_active(struct wake_lock *lock) { return 0; }
+static inline long has_wake_lock(int type) { return 0; }
+
+#endif
+
+#endif
diff --git a/include/linux/wifi_tiwlan.h b/include/linux/wifi_tiwlan.h
new file mode 100644
index 0000000..f07e067
--- /dev/null
+++ b/include/linux/wifi_tiwlan.h
@@ -0,0 +1,27 @@
+/* include/linux/wifi_tiwlan.h
+ *
+ * Copyright (C) 2008 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+#ifndef _LINUX_WIFI_TIWLAN_H_
+#define _LINUX_WIFI_TIWLAN_H_
+
+#include <linux/wlan_plat.h>
+
+#define WMPA_NUMBER_OF_SECTIONS 3
+#define WMPA_NUMBER_OF_BUFFERS 160
+#define WMPA_SECTION_HEADER 24
+#define WMPA_SECTION_SIZE_0 (WMPA_NUMBER_OF_BUFFERS * 64)
+#define WMPA_SECTION_SIZE_1 (WMPA_NUMBER_OF_BUFFERS * 256)
+#define WMPA_SECTION_SIZE_2 (WMPA_NUMBER_OF_BUFFERS * 2048)
+
+#endif
diff --git a/include/linux/wl127x-rfkill.h b/include/linux/wl127x-rfkill.h
new file mode 100644
index 0000000..9057ec6
--- /dev/null
+++ b/include/linux/wl127x-rfkill.h
@@ -0,0 +1,35 @@
+/*
+ * Bluetooth TI wl127x rfkill power control via GPIO
+ *
+ * Copyright (C) 2009 Motorola, Inc.
+ * Copyright (C) 2008 Texas Instruments
+ * Initial code: Pavan Savoy <pavan.savoy@gmail.com> (wl127x_power.c)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef _LINUX_WL127X_RFKILL_H
+#define _LINUX_WL127X_RFKILL_H
+
+#include <linux/rfkill.h>
+
+struct wl127x_rfkill_platform_data {
+ int nshutdown_gpio;
+
+ struct rfkill *rfkill; /* for driver only */
+};
+
+#endif
diff --git a/include/linux/wlan_plat.h b/include/linux/wlan_plat.h
new file mode 100644
index 0000000..40ec348
--- /dev/null
+++ b/include/linux/wlan_plat.h
@@ -0,0 +1,27 @@
+/* include/linux/wlan_plat.h
+ *
+ * Copyright (C) 2010 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+#ifndef _LINUX_WLAN_PLAT_H_
+#define _LINUX_WLAN_PLAT_H_
+
+struct wifi_platform_data {
+ int (*set_power)(int val);
+ int (*set_reset)(int val);
+ int (*set_carddetect)(int val);
+ void *(*mem_prealloc)(int section, unsigned long size);
+ int (*get_mac_addr)(unsigned char *buf);
+ void *(*get_country_code)(char *ccode);
+};
+
+#endif
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index f584aba..e0efbdd 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -347,6 +347,10 @@ alloc_ordered_workqueue(const char *name, unsigned int flags)
extern void destroy_workqueue(struct workqueue_struct *wq);
extern int queue_work(struct workqueue_struct *wq, struct work_struct *work);
+#ifdef CONFIG_WORKQUEUE_FRONT
+extern int queue_work_front(struct workqueue_struct *wq,
+ struct work_struct *work);
+#endif
extern int queue_work_on(int cpu, struct workqueue_struct *wq,
struct work_struct *work);
extern int queue_delayed_work(struct workqueue_struct *wq,