diff options
Diffstat (limited to 'include')
147 files changed, 7190 insertions, 77 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild new file mode 100644 index 00000000000..a4608897a5f --- /dev/null +++ b/include/linux/Kbuild @@ -0,0 +1,2 @@ +header-y += if_pppolac.h +header-y += if_pppopns.h diff --git a/include/linux/alarmtimer.h b/include/linux/alarmtimer.h index 9069694e70e..a899402a5a0 100644 --- a/include/linux/alarmtimer.h +++ b/include/linux/alarmtimer.h @@ -44,10 +44,14 @@ struct alarm {  void alarm_init(struct alarm *alarm, enum alarmtimer_type type,  		enum alarmtimer_restart (*function)(struct alarm *, ktime_t));  int alarm_start(struct alarm *alarm, ktime_t start); +int alarm_start_relative(struct alarm *alarm, ktime_t start); +void alarm_restart(struct alarm *alarm);  int alarm_try_to_cancel(struct alarm *alarm);  int alarm_cancel(struct alarm *alarm);  u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval); +u64 alarm_forward_now(struct alarm *alarm, ktime_t interval); +ktime_t alarm_expires_remaining(const struct alarm *alarm);  /* Provide way to access the rtc device being used by alarmtimers */  struct rtc_device *alarmtimer_get_rtcdev(void); diff --git a/include/linux/als_notify.h b/include/linux/als_notify.h new file mode 100644 index 00000000000..1c35ca54727 --- /dev/null +++ b/include/linux/als_notify.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2014 Motorola Mobility LLC. + * + * 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 ALS_NOTIFY_H +#define ALS_NOTIFY_H + +#ifdef __KERNEL__ + +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif + +enum als_state { +	ALS_ENABLED = (UINT16_MAX + 1), +	ALS_DISABLED +}; + +extern void als_register_notify(struct notifier_block *nb); +extern void als_unregister_notify(struct notifier_block *nb); +extern void als_notify_subscriber(unsigned long event); +#endif /* __KERNEL__ */ + +#endif /* ALS_NOTIFY_H */ diff --git a/include/linux/amba/mmci.h b/include/linux/amba/mmci.h index 32a89cf5ec4..9d1d9caf261 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; +};  /* @@ -73,6 +82,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 00000000000..06264b8be5f --- /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_OBSOLETE_000 3001  /* was NET_BT_ADMIN */ +#define AID_OBSOLETE_001 3002  /* was NET_BT */ +#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/blk_types.h b/include/linux/blk_types.h index fa1abeb45b7..fbb62c6f500 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -161,7 +161,7 @@ enum rq_flag_bits {  				 * throttling rules. Don't do it again. */  	/* request only flags */ -	__REQ_SORTED,		/* elevator knows about this request */ +	__REQ_SORTED = __REQ_RAHEAD, /* elevator knows about this request */  	__REQ_SOFTBARRIER,	/* may not be passed by ioscheduler */  	__REQ_NOMERGE,		/* don't touch this for merging */  	__REQ_STARTED,		/* drive already may have started this one */ @@ -178,6 +178,7 @@ enum rq_flag_bits {  	__REQ_MIXED_MERGE,	/* merge of different types, fail separately */  	__REQ_KERNEL, 		/* direct IO to kernel pages */  	__REQ_PM,		/* runtime pm request */ +	__REQ_URGENT,		/* urgent request */  	__REQ_NR_BITS,		/* stops here */  }; @@ -190,6 +191,7 @@ enum rq_flag_bits {  #define REQ_PRIO		(1 << __REQ_PRIO)  #define REQ_DISCARD		(1 << __REQ_DISCARD)  #define REQ_WRITE_SAME		(1 << __REQ_WRITE_SAME) +#define REQ_URGENT		(1 << __REQ_URGENT)  #define REQ_NOIDLE		(1 << __REQ_NOIDLE)  #define REQ_FAILFAST_MASK \ diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 2fdb4a451b4..7ce28776617 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -304,6 +304,7 @@ struct request_queue {  	struct request_list	root_rl;  	request_fn_proc		*request_fn; +	request_fn_proc		*urgent_request_fn;  	make_request_fn		*make_request_fn;  	prep_rq_fn		*prep_rq_fn;  	unprep_rq_fn		*unprep_rq_fn; @@ -404,6 +405,8 @@ struct request_queue {  #endif  	struct queue_limits	limits; +	bool			notified_urgent; +	bool			dispatched_urgent;  	/*  	 * sg stuff @@ -738,6 +741,8 @@ extern struct request *blk_get_request(struct request_queue *, int, gfp_t);  extern struct request *blk_make_request(struct request_queue *, struct bio *,  					gfp_t);  extern void blk_requeue_request(struct request_queue *, struct request *); +extern int blk_reinsert_request(struct request_queue *q, struct request *rq); +extern bool blk_reinsert_req_sup(struct request_queue *q);  extern void blk_add_request_payload(struct request *rq, struct page *page,  		unsigned int len);  extern int blk_rq_check_limits(struct request_queue *q, struct request *rq); @@ -908,6 +913,7 @@ extern struct request_queue *blk_init_queue_node(request_fn_proc *rfn,  extern struct request_queue *blk_init_queue(request_fn_proc *, spinlock_t *);  extern struct request_queue *blk_init_allocated_queue(struct request_queue *,  						      request_fn_proc *, spinlock_t *); +extern void blk_urgent_request(struct request_queue *q, request_fn_proc *fn);  extern void blk_cleanup_queue(struct request_queue *);  extern void blk_queue_make_request(struct request_queue *, make_request_fn *);  extern void blk_queue_bounce_limit(struct request_queue *, u64); diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h index 8bda1294c03..8f73d835d4d 100644 --- a/include/linux/cgroup.h +++ b/include/linux/cgroup.h @@ -578,6 +578,7 @@ struct cgroup_subsys {  	void (*css_offline)(struct cgroup *cgrp);  	void (*css_free)(struct cgroup *cgrp); +	int (*allow_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);  	int (*can_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);  	void (*cancel_attach)(struct cgroup *cgrp, struct cgroup_taskset *tset);  	void (*attach)(struct cgroup *cgrp, struct cgroup_taskset *tset); diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 11860985fec..0cb0967749e 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -381,6 +381,31 @@ struct clk *clk_register_composite(struct device *dev, const char *name,  		struct clk_hw *gate_hw, const struct clk_ops *gate_ops,  		unsigned long flags); +/*** + * struct clk_gpio - gpio controlled clock + * + * @hw:		handle between common and hardware-specific interfaces + * @gpio:	gpio + * @active_low:	gpio polarity + * + * Clock with a gpio control for enabling and disabling the parent clock. + * Implements .enable, .disable and .is_enabled + */ + +struct clk_gpio { +	struct clk_hw	hw; +	unsigned int	gpio; +	bool		active_low; +}; + +extern const struct clk_ops clk_gpio_ops; + +struct clk *clk_register_gpio(struct device *dev, const char *name, +		const char *parent_name, unsigned long flags, +		unsigned int gpio, bool active_low); + +void of_gpio_clk_setup(struct device_node *node); +  /**   * clk_register - allocate a new clock, register it and return an opaque cookie   * @dev: device that is registering this clock diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 9f3c7e81270..39d4f9d3790 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -232,4 +232,11 @@ void arch_cpu_idle_enter(void);  void arch_cpu_idle_exit(void);  void arch_cpu_idle_dead(void); +#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/cpufreq.h b/include/linux/cpufreq.h index 037d36ae63e..400509e3a2c 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -340,6 +340,7 @@ const char *cpufreq_get_current_driver(void);  int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu);  int cpufreq_update_policy(unsigned int cpu);  bool have_governor_per_policy(void); +struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);  #ifdef CONFIG_CPU_FREQ  /* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ @@ -393,6 +394,9 @@ 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)  #endif diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 1a6bb81f0fe..9be5ac960fd 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -332,6 +332,7 @@ extern int d_validate(struct dentry *, struct dentry *);   * helper function for dentry_operations.d_dname() members   */  extern char *dynamic_dname(struct dentry *, char *, int, const char *, ...); +extern char *simple_dname(struct dentry *, char *, int);  extern char *__d_path(const struct path *, const struct path *, char *, int);  extern char *d_absolute_path(const struct path *, char *, int); diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h index 21ca773f77b..822c1354f3a 100644 --- a/include/linux/debug_locks.h +++ b/include/linux/debug_locks.h @@ -51,7 +51,7 @@ struct task_struct;  extern void debug_show_all_locks(void);  extern void debug_show_held_locks(struct task_struct *task);  extern void debug_check_no_locks_freed(const void *from, unsigned long len); -extern void debug_check_no_locks_held(struct task_struct *task); +extern void debug_check_no_locks_held(void);  #else  static inline void debug_show_all_locks(void)  { @@ -67,7 +67,7 @@ debug_check_no_locks_freed(const void *from, unsigned long len)  }  static inline void -debug_check_no_locks_held(struct task_struct *task) +debug_check_no_locks_held(void)  {  }  #endif diff --git a/include/linux/elevator.h b/include/linux/elevator.h index acd0312d46f..e753f88d033 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h @@ -23,6 +23,9 @@ typedef void (elevator_bio_merged_fn) (struct request_queue *,  typedef int (elevator_dispatch_fn) (struct request_queue *, int);  typedef void (elevator_add_req_fn) (struct request_queue *, struct request *); +typedef int (elevator_reinsert_req_fn) (struct request_queue *, +					struct request *); +typedef bool (elevator_is_urgent_fn) (struct request_queue *);  typedef struct request *(elevator_request_list_fn) (struct request_queue *, struct request *);  typedef void (elevator_completed_req_fn) (struct request_queue *, struct request *);  typedef int (elevator_may_queue_fn) (struct request_queue *, int); @@ -48,6 +51,9 @@ struct elevator_ops  	elevator_dispatch_fn *elevator_dispatch_fn;  	elevator_add_req_fn *elevator_add_req_fn; +	elevator_reinsert_req_fn *elevator_reinsert_req_fn; +	elevator_is_urgent_fn *elevator_is_urgent_fn; +  	elevator_activate_req_fn *elevator_activate_req_fn;  	elevator_deactivate_req_fn *elevator_deactivate_req_fn; @@ -126,6 +132,7 @@ extern void elv_merged_request(struct request_queue *, struct request *, int);  extern void elv_bio_merged(struct request_queue *q, struct request *,  				struct bio *);  extern void elv_requeue_request(struct request_queue *, struct request *); +extern int elv_reinsert_request(struct request_queue *, struct request *);  extern struct request *elv_former_request(struct request_queue *, struct request *);  extern struct request *elv_latter_request(struct request_queue *, struct request *);  extern int elv_register_queue(struct request_queue *q); diff --git a/include/linux/freezer.h b/include/linux/freezer.h index e70df40d84f..7fd81b8c489 100644 --- a/include/linux/freezer.h +++ b/include/linux/freezer.h @@ -3,6 +3,7 @@  #ifndef FREEZER_H_INCLUDED  #define FREEZER_H_INCLUDED +#include <linux/debug_locks.h>  #include <linux/sched.h>  #include <linux/wait.h>  #include <linux/atomic.h> @@ -46,7 +47,11 @@ extern int freeze_kernel_threads(void);  extern void thaw_processes(void);  extern void thaw_kernel_threads(void); -static inline bool try_to_freeze(void) +/* + * DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION + * If try_to_freeze causes a lockdep warning it means the caller may deadlock + */ +static inline bool try_to_freeze_unsafe(void)  {  	might_sleep();  	if (likely(!freezing(current))) @@ -54,6 +59,13 @@ static inline bool try_to_freeze(void)  	return __refrigerator(false);  } +static inline bool try_to_freeze(void) +{ +	if (!(current->flags & PF_NOFREEZE)) +		debug_check_no_locks_held(); +	return try_to_freeze_unsafe(); +} +  extern bool freeze_task(struct task_struct *p);  extern bool set_freezable(void); @@ -115,6 +127,14 @@ static inline void freezer_count(void)  	try_to_freeze();  } +/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */ +static inline void freezer_count_unsafe(void) +{ +	current->flags &= ~PF_FREEZER_SKIP; +	smp_mb(); +	try_to_freeze_unsafe(); +} +  /**   * freezer_should_skip - whether to skip a task when determining frozen   *			 state is reached @@ -139,28 +159,86 @@ static inline bool freezer_should_skip(struct task_struct *p)  }  /* - * These macros are intended to be used whenever you want allow a sleeping + * These functions are intended to be used whenever you want allow a sleeping   * task to be frozen. Note that neither return any clear indication of   * whether a freeze event happened while in this function.   */  /* Like schedule(), but should not block the freezer. */ -#define freezable_schedule()						\ -({									\ -	freezer_do_not_count();						\ -	schedule();							\ -	freezer_count();						\ -}) +static inline void freezable_schedule(void) +{ +	freezer_do_not_count(); +	schedule(); +	freezer_count(); +} + +/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */ +static inline void freezable_schedule_unsafe(void) +{ +	freezer_do_not_count(); +	schedule(); +	freezer_count_unsafe(); +} + +/* + * Like freezable_schedule_timeout(), but should not block the freezer.  Do not + * call this with locks held. + */ +static inline long freezable_schedule_timeout(long timeout) +{ +	long __retval; +	freezer_do_not_count(); +	__retval = schedule_timeout(timeout); +	freezer_count(); +	return __retval; +} + +/* + * Like schedule_timeout_interruptible(), but should not block the freezer.  Do not + * call this with locks held. + */ +static inline long freezable_schedule_timeout_interruptible(long timeout) +{ +	long __retval; +	freezer_do_not_count(); +	__retval = schedule_timeout_interruptible(timeout); +	freezer_count(); +	return __retval; +}  /* Like schedule_timeout_killable(), but should not block the freezer. */ -#define freezable_schedule_timeout_killable(timeout)			\ -({									\ -	long __retval;							\ -	freezer_do_not_count();						\ -	__retval = schedule_timeout_killable(timeout);			\ -	freezer_count();						\ -	__retval;							\ -}) +static inline long freezable_schedule_timeout_killable(long timeout) +{ +	long __retval; +	freezer_do_not_count(); +	__retval = schedule_timeout_killable(timeout); +	freezer_count(); +	return __retval; +} + +/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */ +static inline long freezable_schedule_timeout_killable_unsafe(long timeout) +{ +	long __retval; +	freezer_do_not_count(); +	__retval = schedule_timeout_killable(timeout); +	freezer_count_unsafe(); +	return __retval; +} + +/* + * Like schedule_hrtimeout_range(), but should not block the freezer.  Do not + * call this with locks held. + */ +static inline int freezable_schedule_hrtimeout_range(ktime_t *expires, +		unsigned long delta, const enum hrtimer_mode mode) +{ +	int __retval; +	freezer_do_not_count(); +	__retval = schedule_hrtimeout_range(expires, delta, mode); +	freezer_count(); +	return __retval; +}  /*   * Freezer-friendly wrappers around wait_event_interruptible(), @@ -177,33 +255,45 @@ static inline bool freezer_should_skip(struct task_struct *p)  	__retval;							\  }) +/* DO NOT ADD ANY NEW CALLERS OF THIS FUNCTION */ +#define wait_event_freezekillable_unsafe(wq, condition)			\ +({									\ +	int __retval;							\ +	freezer_do_not_count();						\ +	__retval = wait_event_killable(wq, (condition));		\ +	freezer_count_unsafe();						\ +	__retval;							\ +}) +  #define wait_event_freezable(wq, condition)				\  ({									\  	int __retval;							\ -	for (;;) {							\ -		__retval = wait_event_interruptible(wq, 		\ -				(condition) || freezing(current));	\ -		if (__retval || (condition))				\ -			break;						\ -		try_to_freeze();					\ -	}								\ +	freezer_do_not_count();						\ +	__retval = wait_event_interruptible(wq, (condition));		\ +	freezer_count();						\  	__retval;							\  })  #define wait_event_freezable_timeout(wq, condition, timeout)		\  ({									\  	long __retval = timeout;					\ -	for (;;) {							\ -		__retval = wait_event_interruptible_timeout(wq,		\ -				(condition) || freezing(current),	\ -				__retval); 				\ -		if (__retval <= 0 || (condition))			\ -			break;						\ -		try_to_freeze();					\ -	}								\ +	freezer_do_not_count();						\ +	__retval = wait_event_interruptible_timeout(wq,	(condition),	\ +				__retval);				\ +	freezer_count();						\  	__retval;							\  }) +#define wait_event_freezable_exclusive(wq, condition)			\ +({									\ +	int __retval;							\ +	freezer_do_not_count();						\ +	__retval = wait_event_interruptible_exclusive(wq, condition);	\ +	freezer_count();						\ +	__retval;							\ +}) + +  #else /* !CONFIG_FREEZER */  static inline bool frozen(struct task_struct *p) { return false; }  static inline bool freezing(struct task_struct *p) { return false; } @@ -225,18 +315,37 @@ static inline void set_freezable(void) {}  #define freezable_schedule()  schedule() +#define freezable_schedule_unsafe()  schedule() + +#define freezable_schedule_timeout(timeout)  schedule_timeout(timeout) + +#define freezable_schedule_timeout_interruptible(timeout)		\ +	schedule_timeout_interruptible(timeout) +  #define freezable_schedule_timeout_killable(timeout)			\  	schedule_timeout_killable(timeout) +#define freezable_schedule_timeout_killable_unsafe(timeout)		\ +	schedule_timeout_killable(timeout) + +#define freezable_schedule_hrtimeout_range(expires, delta, mode)	\ +	schedule_hrtimeout_range(expires, delta, mode) +  #define wait_event_freezable(wq, condition)				\  		wait_event_interruptible(wq, condition)  #define wait_event_freezable_timeout(wq, condition, timeout)		\  		wait_event_interruptible_timeout(wq, condition, timeout) +#define wait_event_freezable_exclusive(wq, condition)			\ +		wait_event_interruptible_exclusive(wq, condition) +  #define wait_event_freezekillable(wq, condition)		\  		wait_event_killable(wq, condition) +#define wait_event_freezekillable_unsafe(wq, condition)			\ +		wait_event_killable(wq, condition) +  #endif /* !CONFIG_FREEZER */  #endif	/* FREEZER_H_INCLUDED */ diff --git a/include/linux/gpio_event.h b/include/linux/gpio_event.h new file mode 100644 index 00000000000..2613fc5e4a9 --- /dev/null +++ b/include/linux/gpio_event.h @@ -0,0 +1,170 @@ +/* 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/hid.h b/include/linux/hid.h index 0c48991b040..8136c6d9903 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -647,8 +647,8 @@ struct hid_driver {  	int (*input_mapped)(struct hid_device *hdev,  			struct hid_input *hidinput, struct hid_field *field,  			struct hid_usage *usage, unsigned long **bit, int *max); -	void (*input_configured)(struct hid_device *hdev, -				 struct hid_input *hidinput); +	int (*input_configured)(struct hid_device *hdev, +				struct hid_input *hidinput);  	void (*feature_mapping)(struct hid_device *hdev,  			struct hid_field *field,  			struct hid_usage *usage); diff --git a/include/linux/i2c-omap.h b/include/linux/i2c-omap.h index babe0cf6d56..509ce0d65f2 100644 --- a/include/linux/i2c-omap.h +++ b/include/linux/i2c-omap.h @@ -32,7 +32,6 @@ struct omap_i2c_bus_platform_data {  	u32		clkrate;  	u32		rev;  	u32		flags; -	void		(*set_mpu_wkup_lat)(struct device *dev, long set);  };  #endif diff --git a/include/linux/if_pppolac.h b/include/linux/if_pppolac.h new file mode 100644 index 00000000000..e40aa1075a3 --- /dev/null +++ b/include/linux/if_pppolac.h @@ -0,0 +1,23 @@ +/* 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 <uapi/linux/if_pppolac.h> + +#endif /* __LINUX_IF_PPPOLAC_H */ diff --git a/include/linux/if_pppopns.h b/include/linux/if_pppopns.h new file mode 100644 index 00000000000..4ac621a9ce7 --- /dev/null +++ b/include/linux/if_pppopns.h @@ -0,0 +1,23 @@ +/* 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 <uapi/linux/if_pppopns.h> + +#endif /* __LINUX_IF_PPPOPNS_H */ diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h index aff7ad8a4ea..dccd621d637 100644 --- a/include/linux/if_pppox.h +++ b/include/linux/if_pppox.h @@ -41,6 +41,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 { @@ -51,6 +70,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/iio/m4sensorhub/m4sensorhub_fusion.h b/include/linux/iio/m4sensorhub/m4sensorhub_fusion.h new file mode 100644 index 00000000000..6748393e0e5 --- /dev/null +++ b/include/linux/iio/m4sensorhub/m4sensorhub_fusion.h @@ -0,0 +1,45 @@ +/* + *  Copyright (C) 2014 Motorola, Inc. + * + *  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 + * + *  Adds ability to program periodic interrupts from user space that + *  can wake the phone out of low power modes. + * + */ + +#ifndef _M4SENSORHUB_FUSION_IIO_H +#define _M4SENSORHUB_FUSION_IIO_H + +enum m4sensorhub_fusion_iio_type { +	FUSION_TYPE_ROTATION = 0, +	FUSION_TYPE_ORIENTATION = 1, +	FUSION_TYPE_GRAVITY = 2, +	FUSION_TYPE_LINEAR_ACCELERATION = 3, +	M4FUS_NUM_FUSION_BUFFERS +}; + +struct m4sensorhub_fusion_iio_data { +	uint8_t         type;  /* NOTE: sizeof(enum) can vary but is often 4 */ +	int32_t         values[4]; /* NOTE: this can be a maximum of 5 */ +	long long       timestamp; +} __packed; + +#define M4FUS_DRIVER_NAME           "m4sensorhub_fusion" +#define M4FUS_DATA_STRUCT_SIZE_BITS \ +	(sizeof(struct m4sensorhub_fusion_iio_data) * 8) + + +#endif /* _M4SENSORHUB_FUSION_IIO_H */ diff --git a/include/linux/iio/m4sensorhub/m4sensorhub_gesture.h b/include/linux/iio/m4sensorhub/m4sensorhub_gesture.h new file mode 100644 index 00000000000..232d5e602ee --- /dev/null +++ b/include/linux/iio/m4sensorhub/m4sensorhub_gesture.h @@ -0,0 +1,37 @@ +/* + *  Copyright (C) 2014 Motorola, Inc. + * + *  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 + * + *  Adds ability to program periodic interrupts from user space that + *  can wake the phone out of low power modes. + * + */ + +#ifndef _M4SENSORHUB_GESTURE_IIO_H +#define _M4SENSORHUB_GESTURE_IIO_H + +struct m4sensorhub_gesture_iio_data { +	uint8_t         gesture_type; +	uint8_t         gesture_confidence; +	int8_t          gesture_value; +	long long       timestamp; +} __packed; + +#define M4GES_DRIVER_NAME           "m4sensorhub_gesture" +#define M4GES_DATA_STRUCT_SIZE_BITS \ +	(sizeof(struct m4sensorhub_gesture_iio_data) * 8) + +#endif /* _M4SENSORHUB_GESTURE_IIO_H */ diff --git a/include/linux/iio/m4sensorhub/m4sensorhub_heartrate.h b/include/linux/iio/m4sensorhub/m4sensorhub_heartrate.h new file mode 100644 index 00000000000..0f754d12833 --- /dev/null +++ b/include/linux/iio/m4sensorhub/m4sensorhub_heartrate.h @@ -0,0 +1,36 @@ +/* + *  Copyright (C) 2014 Motorola, Inc. + * + *  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 + * + *  Adds ability to program periodic interrupts from user space that + *  can wake the phone out of low power modes. + * + */ + +#ifndef _M4SENSORHUB_HEARTRATE_IIO_H +#define _M4SENSORHUB_HEARTRATE_IIO_H + +struct m4sensorhub_heartrate_iio_data { +	uint16_t        heartrate; +	uint8_t         confidence; +	long long       timestamp; +} __packed; + +#define M4HRT_DRIVER_NAME           "m4sensorhub_heartrate" +#define M4HRT_DATA_STRUCT_SIZE_BITS \ +	(sizeof(struct m4sensorhub_heartrate_iio_data) * 8) + +#endif /* _M4SENSORHUB_HEARTRATE_IIO_H */ diff --git a/include/linux/iio/m4sensorhub/m4sensorhub_passive.h b/include/linux/iio/m4sensorhub/m4sensorhub_passive.h new file mode 100644 index 00000000000..5b34b3a3222 --- /dev/null +++ b/include/linux/iio/m4sensorhub/m4sensorhub_passive.h @@ -0,0 +1,42 @@ +/* + *  Copyright (C) 2014 Motorola, Inc. + * + *  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 + * + *  Adds ability to program periodic interrupts from user space that + *  can wake the phone out of low power modes. + * + */ + +#ifndef _M4SENSORHUB_PASSIVE_IIO_H +#define _M4SENSORHUB_PASSIVE_IIO_H + +struct m4sensorhub_passive_iio_data { +	uint32_t        passive_timestamp; +	uint16_t        steps; +	uint16_t        calories; +	uint16_t        heartrate; +	uint8_t         hrconfidence; +	uint8_t         healthy_minutes; +	long long       timestamp; +} __packed; + +#define M4PAS_DRIVER_NAME           "m4sensorhub_passive" +#define M4PAS_DATA_STRUCT_SIZE_BITS \ +	(sizeof(struct m4sensorhub_passive_iio_data) * 8) + +#define M4PAS_NUM_PASSIVE_BUFFERS   12 + +#endif /* _M4SENSORHUB_PASSIVE_IIO_H */ diff --git a/include/linux/iio/m4sensorhub/m4sensorhub_pedometer.h b/include/linux/iio/m4sensorhub/m4sensorhub_pedometer.h new file mode 100644 index 00000000000..28af1e76359 --- /dev/null +++ b/include/linux/iio/m4sensorhub/m4sensorhub_pedometer.h @@ -0,0 +1,41 @@ +/* + *  Copyright (C) 2014 Motorola, Inc. + * + *  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 + * + *  Adds ability to program periodic interrupts from user space that + *  can wake the phone out of low power modes. + * + */ + +#ifndef _M4SENSORHUB_PEDOMETER_IIO_H +#define _M4SENSORHUB_PEDOMETER_IIO_H + +struct m4sensorhub_pedometer_iio_data { +	uint8_t         ped_activity; +	uint32_t        total_distance; +	uint32_t        total_steps; +	uint16_t        current_speed; +	uint32_t        healthy_minutes; +	uint32_t        calories; +	uint32_t        calories_normr; +	long long       timestamp; +} __packed; + +#define M4PED_DRIVER_NAME           "m4sensorhub_pedometer" +#define M4PED_DATA_STRUCT_SIZE_BITS \ +	(sizeof(struct m4sensorhub_pedometer_iio_data) * 8) + +#endif /* _M4SENSORHUB_PEDOMETER_IIO_H */ diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h index 88bf0f0d27b..75fdea40e92 100644 --- a/include/linux/iio/types.h +++ b/include/linux/iio/types.h @@ -29,6 +29,15 @@ enum iio_chan_type {  	IIO_ALTVOLTAGE,  	IIO_CCT,  	IIO_PRESSURE, +	IIO_HEARTRATE, +	IIO_PEDOMETER, +	IIO_PASSIVE, +	IIO_GESTURE, +	IIO_FUSION, +	IIO_SIGN_MOTION, +	IIO_STEP_COUNTER, +	IIO_TILT, +	IIO_STEP_DETECTOR,  };  enum iio_modifier { diff --git a/include/linux/input/touch_platform.h b/include/linux/input/touch_platform.h new file mode 100644 index 00000000000..89c489ea61e --- /dev/null +++ b/include/linux/input/touch_platform.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010 Motorola Mobility, Inc. + * + * 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., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307, USA + */ + +/* Defines generic platform structures for touch drivers */ +#ifndef _LINUX_TOUCH_PLATFORM_H +#define _LINUX_TOUCH_PLATFORM_H + +#include <linux/types.h> + +#define ATMXT_I2C_NAME		"atmxt-i2c" + +struct touch_settings { +	const uint8_t *data; +	uint8_t size; +	uint8_t tag; +} __attribute__ ((packed)); + +struct touch_firmware { +	const uint8_t *img; +	uint32_t size; +	const uint8_t *ver; +	uint8_t vsize; +} __attribute__ ((packed)); + +struct touch_framework { +	const uint16_t *abs; +	uint8_t size; +	uint8_t enable_vkeys; +} __attribute__ ((packed)); + +struct touch_platform_data { +	struct touch_settings *sett[256]; +	struct touch_firmware *fw; +	struct touch_framework *frmwrk; + +	uint8_t addr[2]; +	uint16_t flags; + +	int			gpio_reset; +	int			gpio_interrupt; +	char			*filename; + +	int (*hw_reset)(void); +	int (*hw_recov)(int); +	int (*irq_stat)(void); +} __attribute__ ((packed)); + +#endif /* _LINUX_TOUCH_PLATFORM_H */ diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index 850e95bc766..867833ba6bd 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -36,6 +36,7 @@ struct ipv6_devconf {  	__s32		accept_ra_rt_info_max_plen;  #endif  #endif +	__s32		accept_ra_rt_table;  	__s32		proxy_ndp;  	__s32		accept_source_route;  #ifdef CONFIG_IPV6_OPTIMISTIC_DAD diff --git a/include/linux/kernel.h b/include/linux/kernel.h index e9ef6d6b51d..eabc56d0f82 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -792,4 +792,7 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }  # 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 00000000000..08cf5402102 --- /dev/null +++ b/include/linux/keychord.h @@ -0,0 +1,23 @@ +/* + *  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 <uapi/linux/keychord.h> + +#endif	/* __LINUX_KEYCHORD_H_ */ diff --git a/include/linux/keyreset.h b/include/linux/keyreset.h new file mode 100644 index 00000000000..a2ac49e5b68 --- /dev/null +++ b/include/linux/keyreset.h @@ -0,0 +1,28 @@ +/* + * 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/leds.h b/include/linux/leds.h index 0287ab29668..e1014ed6bcd 100644 --- a/include/linux/leds.h +++ b/include/linux/leds.h @@ -50,6 +50,11 @@ struct led_classdev {  	/* Get LED brightness level */  	enum led_brightness (*brightness_get)(struct led_classdev *led_cdev); +#ifdef CONFIG_HAS_AMBIENTMODE +	void		(*brightness_set_raw_als)(struct led_classdev *led_cdev, +					  unsigned int brightness); +#endif +  	/*  	 * Activate hardware accelerated blink, delays are in milliseconds  	 * and if both are zero then a sensible default should be chosen. @@ -139,6 +144,16 @@ extern void led_blink_set_oneshot(struct led_classdev *led_cdev,  extern void led_set_brightness(struct led_classdev *led_cdev,  			       enum led_brightness brightness); +#ifdef	CONFIG_HAS_AMBIENTMODE +/** + * led_get_default_dev - get default LED device + *   return default LED device + */ +extern struct led_classdev *led_get_default_dev(void); +extern void led_set_brightness_raw_als(struct led_classdev *led_cdev, +			       unsigned int brightness); +#endif +  /*   * LED Triggers   */ diff --git a/include/linux/m4sensorhub.h b/include/linux/m4sensorhub.h new file mode 100644 index 00000000000..5eb2ec0586f --- /dev/null +++ b/include/linux/m4sensorhub.h @@ -0,0 +1,252 @@ +/* + * Copyright (c) 2012-2014, Motorola, Inc. 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, see <http://www.gnu.org/licenses/>. + * + */ + +#ifndef __M4SENSORHUB_H__ +#define __M4SENSORHUB_H__ + +#include <linux/i2c.h> +#include <linux/platform_device.h> +#include <linux/m4sensorhub/m4sensorhub_registers.h> +#include <linux/m4sensorhub/m4sensorhub_irqs.h> +#include <linux/firmware.h> + +#ifdef __KERNEL__ + +extern char m4sensorhub_debug; + +#define M4SENSORHUB_DRIVER_NAME     "m4sensorhub" +#define M4SENSORHUB_I2C_ADDR        0x18 + +#define KDEBUG(i, format, s...)                         \ +	do {                                            \ +		if (m4sensorhub_debug >= i)             \ +			pr_crit(format, ##s);           \ +	} while (0) + +enum m4sensorhub_debug_level { +	M4SH_NODEBUG = 0x0, +	M4SH_CRITICAL, +	M4SH_ERROR, +	M4SH_WARNING, +	M4SH_NOTICE, +	M4SH_INFO, +	M4SH_DEBUG, +	M4SH_VERBOSE_DEBUG +}; + +enum m4sensorhub_mode { +	UNINITIALIZED, +	BOOTMODE, +	NORMALMODE +}; + +enum m4sensorhub_bootmode { +	BOOTMODE00, +	BOOTMODE01, +	BOOTMODE10, +	BOOTMODE11, +}; + +/* This enum is used to register M4 panic callback + * The sequence of this enum is also the sequence of calling + *   i.e. it will be called follow this enum 0, 1, 2 ... max + */ +enum m4sensorhub_panichdl_index { +	PANICHDL_DISPLAY_RESTORE, +	PANICHDL_HEARTRATE_RESTORE, +	PANICHDL_PASSIVE_RESTORE, +	PANICHDL_FUSION_RESTORE, +	PANICHDL_ALS_RESTORE, +	PANICHDL_MPU9150_RESTORE, +	PANICHDL_PEDOMETER_RESTORE, +	PANICHDL_EXTERN_RESTORE, +	/* +	 * Please add enum before PANICHDL_IRQ_RESTORE +	 * to make sure IRQ restore will be called last. +	 * +	 * Also, add your debug string name to +	 * m4sensorhub-panic.c. +	 */ +	PANICHDL_IRQ_RESTORE, /* Keep it as the last one */ +	PANICHDL_MAX = PANICHDL_IRQ_RESTORE+1 +}; + +struct m4sensorhub_hwconfig { +	int irq_gpio; +	int reset_gpio; +	int wake_gpio; +	int boot0_gpio; +	int boot1_gpio; +	int mpu_9150_en_gpio; +}; + +struct m4sensorhub_irq_dbg { +	unsigned char suspend; /* 1 - Suspended, 0 - Normal */ +}; + +struct m4sensorhub_data { +	struct i2c_client *i2c_client; +	void *irqdata; +	void *panicdata; +	enum m4sensorhub_mode mode; +	struct m4sensorhub_hwconfig hwconfig; +	struct m4sensorhub_irq_dbg irq_dbg; +	char *filename; +	u16 fw_version; +}; + +struct init_calldata { +	struct m4sensorhub_data *p_m4sensorhub_data; /* M4 pointer */ +	void *p_data; /* Driver data */ +}; + +/* Global (kernel) functions */ + +/* Client devices */ +struct m4sensorhub_data *m4sensorhub_client_get_drvdata(void); + +/* Register access */ + +/* m4sensorhub_reg_read() + +   Read a register from the M4 sensor hub. + +   Returns number of bytes read on success. +   Returns negative error code on failure + +     m4sensorhub - pointer to the main m4sensorhub data struct +     reg - Register to be read +     value - array to return data.  Needs to be at least register's size +*/ +#define m4sensorhub_reg_read(m4sensorhub, reg, value) \ +	m4sensorhub_reg_read_n(m4sensorhub, reg, value, \ +			       m4sensorhub_reg_getsize(m4sensorhub, reg)) + +/* m4sensorhub_reg_write() + +   Read a register from the M4 sensor hub. + +   Returns number of bytes write on success. +   Returns negative error code on failure + +     m4sensorhub - pointer to the main m4sensorhub data struct +     reg - Register to be write +     value - array to return data.  Needs to be at least register's size +     mask - mask representing which bits to change in register.  If all bits +	    are to be changed, then &m4sh_no_mask can be passed here. +*/ +#define m4sensorhub_reg_write(m4sensorhub, reg, value, mask) \ +	m4sensorhub_reg_write_n(m4sensorhub, reg, value, mask, \ +				m4sensorhub_reg_getsize(m4sensorhub, reg)) +int m4sensorhub_reg_init(struct m4sensorhub_data *m4sensorhub); +int m4sensorhub_reg_shutdown(struct m4sensorhub_data *m4sensorhub); +int m4sensorhub_reg_read_n(struct m4sensorhub_data *m4sensorhub, +			   enum m4sensorhub_reg reg, unsigned char *value, +			   short num); +int m4sensorhub_reg_write_n(struct m4sensorhub_data *m4sensorhub, +			    enum m4sensorhub_reg reg, unsigned char *value, +			    unsigned char *mask, short num); +int m4sensorhub_reg_write_1byte(struct m4sensorhub_data *m4sensorhub, +				enum m4sensorhub_reg reg, unsigned char value, +				unsigned char mask); +int m4sensorhub_reg_getsize(struct m4sensorhub_data *m4sensorhub, +			    enum m4sensorhub_reg reg); +void m4sensorhub_reg_access_lock(void); +void m4sensorhub_reg_access_unlock(void); +int m4sensorhub_i2c_write_read(struct m4sensorhub_data *m4sensorhub, +				      u8 *buf, int writelen, int readlen); + +/* + * Functions for re-initializing M4 + * + * In general, only m4sensorhub_test_m4_reboot() should ever + *   be called directly. + */ +int m4sensorhub_test_m4_reboot(struct m4sensorhub_data *m4, bool reboot_first); +int m4sensorhub_load_firmware(struct m4sensorhub_data *m4sensorhub, +	unsigned short force_upgrade, +	const struct firmware *firmware); +int m4sensorhub_401_load_firmware(struct m4sensorhub_data *m4sensorhub, +	unsigned short force_upgrade, +	const struct firmware *fm); +void m4sensorhub_hw_reset(struct m4sensorhub_data *m4sensorhub); + +/* Interrupt handler */ +int m4sensorhub_irq_init(struct m4sensorhub_data *m4sensorhub); +void m4sensorhub_irq_shutdown(struct m4sensorhub_data *m4sensorhub); +int m4sensorhub_irq_register(struct m4sensorhub_data *m4sensorhub, +			     enum m4sensorhub_irqs irq, +			     void (*cb_func) (enum m4sensorhub_irqs, void *), +			     void *data, uint8_t enable_timed_wakelock); +int m4sensorhub_irq_unregister(struct m4sensorhub_data *m4sensorhub, +			       enum m4sensorhub_irqs irq); +int m4sensorhub_irq_disable(struct m4sensorhub_data *m4sensorhub, +			    enum m4sensorhub_irqs irq); +int m4sensorhub_irq_enable(struct m4sensorhub_data *m4sensorhub, +			   enum m4sensorhub_irqs irq); +int m4sensorhub_irq_enable_get(struct m4sensorhub_data *m4sensorhub, +			       enum m4sensorhub_irqs irq); + + +/* M4 Panic Calls */ +int m4sensorhub_panic_init(struct m4sensorhub_data *m4sensorhub); +void m4sensorhub_panic_shutdown(struct m4sensorhub_data *m4sensorhub); +int m4sensorhub_panic_register(struct m4sensorhub_data *m4sensorhub, +			   enum m4sensorhub_panichdl_index index, +			   void (*cb_func)(struct m4sensorhub_data *, void *), +			   void *data); +int m4sensorhub_panic_unregister(struct m4sensorhub_data *m4sensorhub, +				enum m4sensorhub_panichdl_index index); +void m4sensorhub_panic_process(struct m4sensorhub_data *m4sensorhub); + +/* all M4 based drivers need to register an init call with the core, + this callback will be executed once M4 core has properly set up FW + on M4. For registration, a callback and a void* is passed in. When + the callback is executed, the client provided void* is passed back + as part of (init_calldata).p_data */ +int m4sensorhub_register_initcall(int(*initfunc)(struct init_calldata *), +							void *pdata); +void m4sensorhub_unregister_initcall( +		int(*initfunc)(struct init_calldata *)); + +/* + * Some M4 drivers (e.g., RTC) require reading data on boot, even if M4 + * needs a firmware update.  These functions allow drivers to register + * callbacks with the core to take care of small maintenance tasks before + * M4 is reflashed (e.g., caching the system time). + * + * NOTE:  Drivers should not rely on this call for normal operation. + *        Reflashing M4 is an uncommon event, and most of the time, + *        especially in production, these callbacks will never be used. + */ +int m4sensorhub_register_preflash_callback( +		int(*initfunc)(struct init_calldata *), void *pdata); +void m4sensorhub_unregister_preflash_callback( +		int(*initfunc)(struct init_calldata *)); +void m4sensorhub_call_preflash_callbacks(void); /* For FW flash core */ +bool m4sensorhub_preflash_callbacks_exist(void); /* For FW flash core */ + +int m4sensorhub_irq_disable_all(struct m4sensorhub_data *m4sensorhub); + +/* External System Calls for Non-M4 Drivers  */ +int m4sensorhub_extern_init(struct m4sensorhub_data *m4); /* Init for core */ +int m4sensorhub_extern_set_audio_status(uint8_t status); +int m4sensorhub_extern_set_display_status(uint8_t status); +int m4sensorhub_get_current_mode(void); + +#endif /* __KERNEL__ */ +#endif  /* __M4SENSORHUB_H__ */ diff --git a/include/linux/m4sensorhub/MemMapAccelSensor.h b/include/linux/m4sensorhub/MemMapAccelSensor.h new file mode 100644 index 00000000000..5ba43e340e5 --- /dev/null +++ b/include/linux/m4sensorhub/MemMapAccelSensor.h @@ -0,0 +1,29 @@ +/********************************************************************* +* +*   Copyright (C) 2012 Motorola, Inc. +* +********************************************************************** + +File    : MemMapAccelSensor.h +Purpose : +**********************************************************************/ +#ifndef __MEMMAP_ACCELSENSOR_H__ +#define __MEMMAP_ACCELSENSOR_H__ +/****************************** Defines *******************************/ +typedef struct memMapAccel { +	u8 version; +	u8 testCmd; +	u16 dummy; /* Align to 32-bit boundary */ +	s32 x; +	s32 y; +	s32 z; +} sAccelData; + +/**************************** Globals ********************************/ + + +/***************************** Prototypes *****************************/ + + + +#endif /* __MEMMAP_ACCELSENSOR_H__ */ diff --git a/include/linux/m4sensorhub/MemMapAudio.h b/include/linux/m4sensorhub/MemMapAudio.h new file mode 100644 index 00000000000..4a874beac39 --- /dev/null +++ b/include/linux/m4sensorhub/MemMapAudio.h @@ -0,0 +1,29 @@ +/********************************************************************* +* +*   Copyright (C) 2012 Motorola, Inc. +* +********************************************************************** + +File    : MemMapAudio.h +Purpose : +**********************************************************************/ +#ifndef __MEMMAP_AUDIO_H__ +#define __MEMMAP_AUDIO_H__ +/****************************** Defines *******************************/ +typedef struct memMapAudio { +	u8 version; +	u8 enable; +	u16 dummy; +	u32 totalPackets; +} sAudioData; + +#define AUDIO_BUFFER_SIZE 800 +/**************************** Globals ********************************/ + + +/***************************** Prototypes *****************************/ + + + +#endif /* __MEMMAP_AUDIO_H__ */ + diff --git a/include/linux/m4sensorhub/MemMapCompassSensor.h b/include/linux/m4sensorhub/MemMapCompassSensor.h new file mode 100644 index 00000000000..a4da37d43b1 --- /dev/null +++ b/include/linux/m4sensorhub/MemMapCompassSensor.h @@ -0,0 +1,30 @@ +/********************************************************************* +* +*   Copyright (C) 2012 Motorola, Inc. +* +********************************************************************** + +File    : MemMapCompassSensor.h +Purpose : +**********************************************************************/ +#ifndef __MEMMAP_COMPASSSENSOR_H__ +#define __MEMMAP_COMPASSSENSOR_H__ +/****************************** Defines *******************************/ +typedef struct memMapCompass { +	u8 version; +	u8 testCmd; +	u16 dummy; /* Align to 32-bit boundary */ +	s32 x; +	s32 y; +	s32 z; +	s8 accuracy; +} sCompassData; + +/**************************** Globals ********************************/ + + +/***************************** Prototypes *****************************/ + + + +#endif /* __MEMMAP_COMPASSSENSOR_H__ */ diff --git a/include/linux/m4sensorhub/MemMapDownload.h b/include/linux/m4sensorhub/MemMapDownload.h new file mode 100644 index 00000000000..526a917c0b9 --- /dev/null +++ b/include/linux/m4sensorhub/MemMapDownload.h @@ -0,0 +1,51 @@ +/********************************************************************* +* +*   Copyright (C) 2012 Motorola, Inc. +* +********************************************************************** +File    : MemMapDownload.h +Purpose : +**********************************************************************/ +#ifndef __MEMMAP_DOWNLOAD_H__ +#define __MEMMAP_DOWNLOAD_H__ +/****************************** Defines *******************************/ + +/* These enums and defines need to match up with the enums + * in m4sensorhub_client_ioctl.h + */ + +#define M4SH_DL_FILENAME_SIZE 16 +#define M4SH_DL_PACKET_SIZE 100 + +enum download_error_codes { +  DOWNLOAD_SUCCESS, +  DOWNLOAD_ERROR_GET_CHECKSUM, +  DOWNLOAD_ERROR_OPEN_FILE, +  DOWNLOAD_ERROR_WRITE_FILE, +  DOWNLOAD_ERROR_CLOSE_FILE, +  DOWNLOAD_ERROR_DELETE_FILE, +  DOWNLOAD_ERROR_INVALID_SIZE, +  /*internal error code for M4<==>Kernel*/ +  DOWNLOAD_ERROR_SEND_CMD = 0x80, +  DOWNLOAD_ERROR_DATA_CHECKSUM, +}; + +enum downloadCmds { +  DOWNLOAD_CMD_GET_CHECKSUM, +  DOWNLOAD_CMD_OPEN_FILE, +  DOWNLOAD_CMD_WRITE_FILE, +  DOWNLOAD_CMD_CLOSE_FILE, +  DOWNLOAD_CMD_DELETE_FILE, +}; + +typedef struct memMapDownload { +  u8 version; +  u8 command; +  u8 status; +  u8 size; +  u32 checksum; +  u8 filename[M4SH_DL_FILENAME_SIZE]; +  u8 packet[M4SH_DL_PACKET_SIZE]; +} sDownload; + +#endif /*__MEMMAP_DOWNLOAD_H__*/ diff --git a/include/linux/m4sensorhub/MemMapFusionSensor.h b/include/linux/m4sensorhub/MemMapFusionSensor.h new file mode 100644 index 00000000000..2d4c2bfb56f --- /dev/null +++ b/include/linux/m4sensorhub/MemMapFusionSensor.h @@ -0,0 +1,37 @@ +/********************************************************************* +* +*   Copyright (C) 2012 Motorola, Inc. +* +********************************************************************** + +File    : MemMapFusionSensor.h +Purpose : +**********************************************************************/ +#ifndef __MEMMAP_FUSIONSENSOR_H__ +#define __MEMMAP_FUSIONSENSOR_H__ +/****************************** Defines *******************************/ +typedef struct memMapFusion { +	u8 version; +	u8 testCmd; +	u16 dummy; +	s32 eulerPitch; +	s32 eulerRoll; +	s32 eulerYaw; +	s32 localX; +	s32 localY; +	s32 localZ; +	s32 worldX; +	s32 worldY; +	s32 worldZ; +	s16 heading; +	s8 heading_accuracy; +} sFusionData; + +/**************************** Globals ********************************/ + + +/***************************** Prototypes *****************************/ + + + +#endif /* __MEMMAP_FUSIONSENSOR_H__ */ diff --git a/include/linux/m4sensorhub/MemMapGesture.h b/include/linux/m4sensorhub/MemMapGesture.h new file mode 100644 index 00000000000..031660aa4c6 --- /dev/null +++ b/include/linux/m4sensorhub/MemMapGesture.h @@ -0,0 +1,60 @@ +/********************************************************************* +* +*   Copyright (C) 2012 Motorola, Inc. +* +********************************************************************** + +File    : MemMapGesture.h +Purpose : +**********************************************************************/ +#ifndef __MEMMAP_GESTURE_H__ +#define __MEMMAP_GESTURE_H__ +/********************************** Defines **************************/ +typedef struct memMapGesture { +  u8 version; +  u8 gesture1; +  u8 confidence1; +  s8 value1; +  u8 gesture2; +  u8 confidence2; +  s8 value2; +  u8 gesture3; +  u8 confidence3; +  s8 value3; +} sGestureData; + +typedef enum  { +  GESTURE_NONE, +  GESTURE_VIEW, +  GESTURE_WRIST_ROTATE, +  GESTURE_TAP, +  GESTURE_HANDSHAKE, +  GESTURE_HANDWAVE, +  GESTURE_FISTBUMP, +  GESTURE_WATCH_ON, +  GESTURE_WATCH_OFF, +  GESTURE_TILT_SCROLL, +  GESTURE_MAX +} eGestureType; + +typedef enum  { +  GESTURE_VIEW_ON, +  GESTURE_VIEW_OFF +} eGestureViewValue; + +typedef enum  { +  GESTURE_WRIST_ROTATE_NORMAL, +  GESTURE_WRIST_ROTATE_FLAT, +  GESTURE_WRIST_ROTATE_BED, +  GESTURE_WRIST_ROTATE_GENT, +  GESTURE_WRIST_ROTATE_INSIDE, +  GESTURE_WRIST_ROTATE_FAST, +} eGestureWristRotateValue; + +/********************************** Globals **************************/ + +/********************************** Prototypes ***********************/ + + + +#endif /* __MEMMAP_GESTURE_H__ */ diff --git a/include/linux/m4sensorhub/MemMapGyroSensor.h b/include/linux/m4sensorhub/MemMapGyroSensor.h new file mode 100644 index 00000000000..af2f46574cd --- /dev/null +++ b/include/linux/m4sensorhub/MemMapGyroSensor.h @@ -0,0 +1,29 @@ +/********************************************************************* +* +*   Copyright (C) 2012 Motorola, Inc. +* +********************************************************************** + +File    : MemMapGyroSensor.h +Purpose : +**********************************************************************/ +#ifndef __MEMMAP_GYROSENSOR_H__ +#define __MEMMAP_GYROSENSOR_H__ +/****************************** Defines *******************************/ +typedef struct memMapGyro { +	u8 version; +	u8 testCmd; +	u16 dummy; /* Align to 32-bit boundary */ +	s32 x; +	s32 y; +	s32 z; +} sGyroData; + +/**************************** Globals ********************************/ + + +/***************************** Prototypes *****************************/ + + + +#endif /* __MEMMAP_GYROSENSOR_H__*/ diff --git a/include/linux/m4sensorhub/MemMapLog.h b/include/linux/m4sensorhub/MemMapLog.h new file mode 100644 index 00000000000..2b7882a4df4 --- /dev/null +++ b/include/linux/m4sensorhub/MemMapLog.h @@ -0,0 +1,58 @@ +/********************************************************************** +* +*   Copyright (C) 2012 Motorola, Inc. +* +********************************************************************** +File    : MemMapLog.h +Purpose : +**********************************************************************/ +#ifndef __MEMMAP_LOG_H__ +#define __MEMMAP_LOG_H__ +/****************************** Defines *******************************/ +#define LOG_EN_SIZE 2 +/* Number of log tags per element of logenable array */ +#define LOG_TAGS_PER_ENABLE 16 +#define LOG_MAX 23 +#define LOG_NO_OF_BITS_PER_TAG 2 +/*This is set to 0x03 since each logtag uses 2 bits in logenable */ +#define LOG_TAG_MASK 0x03 +#define LOG_LEVELS_MAX 4 + +struct memMapLog { +	u32 logEnable[LOG_EN_SIZE]; +	u8 isLogImmediate; +}; + +static char acLogTags[LOG_MAX][40] = { +	"LOG_GENERAL", +	"LOG_TIMER", +	"LOG_ACCEL", +	"LOG_TEMPERATURE", +	"LOG_PRESSURE", +	"LOG_PEDOMETER", +	"LOG_TCMD", +	"LOG_GYRO", +	"LOG_COMPASS", +	"LOG_FUSION", +	"LOG_METS", +	"LOG_GESTURE", +	"LOG_POWER", +	"LOG_CORRELATION", +	"LOG_GPS", +	"LOG_DL", +	"LOG_AUDIO", +	"LOG_DISP", +	"LOG_WRIST", +	"LOG_PASSIVE", +	"LOG_EMG", +	"LOG_HR", +	"LOG_ALS", +}; + +static char acLogLevels[LOG_LEVELS_MAX][15] = { +	"LOG_DISABLE", +	"LOG_ERROR", +	"LOG_VERBOSE", +	"LOG_DEBUG" +}; +#endif /* __MEMMAP_LOG_H__ */ diff --git a/include/linux/m4sensorhub/MemMapPassive.h b/include/linux/m4sensorhub/MemMapPassive.h new file mode 100644 index 00000000000..3d2c016b1ed --- /dev/null +++ b/include/linux/m4sensorhub/MemMapPassive.h @@ -0,0 +1,26 @@ +/********************************************************************* +* +*   Copyright (C) 2012 Motorola, Inc. +* +********************************************************************** + +File    : MemMapPassive.h +Purpose : +**********************************************************************/ +#ifndef __MEMMAP_PASSIVE_H__ +#define __MEMMAP_PASSIVE_H__ +/********************************** Defines **************************/ + +#define MAX_PASSIVE_BUFFERS 12 + +typedef struct memMapPassive { +	u32 timestamp[MAX_PASSIVE_BUFFERS]; +	u32 steps[MAX_PASSIVE_BUFFERS]; +	u32 mets[MAX_PASSIVE_BUFFERS]; +	u32 floorsClimbed[MAX_PASSIVE_BUFFERS]; +} sPassive; + +/********************************** Globals ***************************/ + +/********************************** Prototypes ************************/ +#endif diff --git a/include/linux/m4sensorhub/MemMapPedometer.h b/include/linux/m4sensorhub/MemMapPedometer.h new file mode 100644 index 00000000000..129acee157d --- /dev/null +++ b/include/linux/m4sensorhub/MemMapPedometer.h @@ -0,0 +1,34 @@ +/********************************************************************* +* +*   Copyright (C) 2012 Motorola, Inc. +* +********************************************************************** + +File    : Pedometer.h +Purpose : +**********************************************************************/ +#ifndef __PEDOMETER_H__ +#define __PEDOMETER_H__ +/****************************** Defines *******************************/ +typedef struct memMapPedometer { +	u8 version; +	u8 testCmd; +	u16 totalSteps; +	u32 totatDistance; +	u32 currentSpeed; +	u8  activity; +} sPedoData; + +typedef enum { +  WALK, +  JOG, +  RUN +} eActivity; +/**************************** Globals ********************************/ + + +/***************************** Prototypes *****************************/ + + + +#endif /* __PEDOMETER_H__ */ diff --git a/include/linux/m4sensorhub/MemMapPower.h b/include/linux/m4sensorhub/MemMapPower.h new file mode 100755 index 00000000000..56d627a81ea --- /dev/null +++ b/include/linux/m4sensorhub/MemMapPower.h @@ -0,0 +1,29 @@ +/*********************************************************************
 +*  
 +*   Copyright (C) 2012 Motorola, Inc.
 +*
 +**********************************************************************
 +
 +File    : MemMapPower.h
 +Purpose : 
 +**********************************************************************/
 +#ifndef __MEMMAP_POWER_H__
 +#define __MEMMAP_POWER_H__
 +/****************************** Defines *******************************/
 +typedef struct memMapPower
 +{
 +        u8 version; 
 +        u8 enable; 
 +        u16 stillModeTimeout; // in secs 
 +        u8 motionDuration; // in secs 
 +        u8 motionThreshold; // in milliG 
 +        u8 noMotionDuration;// in secs 
 +        u8 noMotionThreshold; // in milliG 
 +        u8 deviceState; //This indicates if the device is in motion(1) or is still(0)        
 +}sPower;
 +
 +typedef enum {
 +  PM_STILL,
 +  PM_MOTION
 +}eDeviceState;
 +#endif // __MEMMAP_POWER_H__
 diff --git a/include/linux/m4sensorhub/MemMapPressureSensor.h b/include/linux/m4sensorhub/MemMapPressureSensor.h new file mode 100644 index 00000000000..9c192a26447 --- /dev/null +++ b/include/linux/m4sensorhub/MemMapPressureSensor.h @@ -0,0 +1,29 @@ +/********************************************************************* +* +*   Copyright (C) 2012 Motorola, Inc. +* +********************************************************************** + +File    : MemMapPressureSensor.h +Purpose : +**********************************************************************/ +#ifndef __PRESS_SENSOR_H__ +#define __PRESS_SENSOR_H__ +/****************************** Defines *******************************/ +typedef struct memMapPressure { +	u8 version; +	u8 dummy; /* Align the boundary */ +	u16 sampleRate; +	u32 pressure; +	s32 referenceAltitude; +	u32 seaLevelPressure; +	s32 absoluteAltitude; +	s16 temperature; +} sPressureData; + +/**************************** Globals ********************************/ + + +/***************************** Prototypes *****************************/ + +#endif diff --git a/include/linux/m4sensorhub/MemMapTempSensor.h b/include/linux/m4sensorhub/MemMapTempSensor.h new file mode 100644 index 00000000000..51fad5d13e5 --- /dev/null +++ b/include/linux/m4sensorhub/MemMapTempSensor.h @@ -0,0 +1,26 @@ +/********************************************************************* +* +*   Copyright (C) 2012 Motorola, Inc. +* +********************************************************************** + +File    : MemMapTempSensor.h +Purpose : +**********************************************************************/ +#ifndef __MEMMAP_TEMPSENSOR_H__ +#define __MEMMAP_TEMPSENSOR_H__ +/****************************** Defines *******************************/ +typedef struct memMapTemp { +	u8 version; +	u8 testCmd; +	s16 extrnlTemp; +	s16 intrnlTemp; +} sTempData; + +/**************************** Globals ********************************/ + + +/***************************** Prototypes *****************************/ + + +#endif diff --git a/include/linux/m4sensorhub/MemMapUserSettings.h b/include/linux/m4sensorhub/MemMapUserSettings.h new file mode 100644 index 00000000000..0d85e75af3b --- /dev/null +++ b/include/linux/m4sensorhub/MemMapUserSettings.h @@ -0,0 +1,55 @@ +/********************************************************************* +* +*   Copyright (C) 2012 Motorola, Inc. +* +********************************************************************** + +File    : MemMapUserSettings.h +Purpose : +**********************************************************************/ +#ifndef __MEMMAP_USERSETTING_H__ +#define __MEMMAP_USERSETTING_H__ +/****************************** Defines *******************************/ +typedef struct memMapUserSettings +{ +  u8 screenStatus; +  u8 userAge; +  u8 userGender; +  u8 userHeight; +  u16 userWeight; +  u8 audioStatus; +  u8 rtcReset; +}sUserData; + +typedef enum +{ +  FEMALE = 0, +  MALE = 1 +}eGender; + +typedef enum +{ +  SCREEN_STATUS_NORMAL_OFF  = 0, +  SCREEN_STATUS_NORMAL_ON   = 1, +  SCREEN_STATUS_AMBIENT_OFF = 2, +  SCREEN_STATUS_AMBIENT_ON  = 3 +}eScreenStatus; + +typedef enum +{ +  AUDIO_STATUS_OFF = 0, // was SCREEN_OFF +  AUDIO_STATUS_ON  = 1, // was SCREEN_ON +}eAudioStatus; + +typedef enum +{ +  USERSETTINGS_SCREENSTATUS = 0, +  USERSETTINGS_USERAGE = 1, +  USERSETTINGS_USERGENDER = 2, +  USERSETTINGS_USERHEIGHT = 3, +  USERSETTINGS_USERWEIGHT = 4, +  USERSETTINGS_AUDIOSTATUS = 6, +  USERSETTINGS_RTCRESET = 7, +}eUserSettingsOffset; + +#endif // __MEMMAP_USERSETTING_H__ diff --git a/include/linux/m4sensorhub/m4sensorhub_bank_enum.h b/include/linux/m4sensorhub/m4sensorhub_bank_enum.h new file mode 100644 index 00000000000..e6690fba64d --- /dev/null +++ b/include/linux/m4sensorhub/m4sensorhub_bank_enum.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2013, Motorola, Inc. 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, see <http://www.gnu.org/licenses/>. + * + */ + +/*****************************  WARNING  ****************************** + *                                                                    * + *                        DO NOT EDIT THIS FILE                       * + *                                                                    * + *  This is an auto-generated file based on register maps in the      * + *  M4 Sensor Hub source tree.                                        * + *                                                                    * + *****************************  WARNING  *****************************/ + +enum m4sensorhub_type { +	M4SH_TYPE_ACCEL, +	M4SH_TYPE_TEMP, +	M4SH_TYPE_GENERAL, +	M4SH_TYPE_PRESSURE, +	M4SH_TYPE_PEDOMETER, +	M4SH_TYPE_TCMD, +	M4SH_TYPE_LOG, +	M4SH_TYPE_FUSION, +	M4SH_TYPE_COMPASS, +	M4SH_TYPE_GYRO, +	M4SH_TYPE_METS, +	M4SH_TYPE_USERSETTINGS, +	M4SH_TYPE_POWER, +	M4SH_TYPE_LOCATION, +	M4SH_TYPE_DOWNLOAD, +	M4SH_TYPE_AUDIO, +	M4SH_TYPE_TIMEPIECE, +	M4SH_TYPE_WRIST, +	M4SH_TYPE_GESTURE, +	M4SH_TYPE_PASSIVE, +	M4SH_TYPE_EMG, +	M4SH_TYPE_HEARTRATE, +	M4SH_TYPE_HRSENSOR, +	M4SH_TYPE_LIGHTSENSOR, +	M4SH_TYPE_DEBUG, + +	M4SH_TYPE__NUM +}; + diff --git a/include/linux/m4sensorhub/m4sensorhub_irqs.h b/include/linux/m4sensorhub/m4sensorhub_irqs.h new file mode 100644 index 00000000000..597adf9dba6 --- /dev/null +++ b/include/linux/m4sensorhub/m4sensorhub_irqs.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2012, Motorola, Inc. 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, see <http://www.gnu.org/licenses/>. + * + */ + +#ifndef __M4SENSORHUB_IRQS_H__ +#define __M4SENSORHUB_IRQS_H__ + +#define M4SH_IRQ_INT0_INDEX 0 +#define M4SH_IRQ_INT1_INDEX 8 +#define M4SH_IRQ_INT2_INDEX 16 + +/* Keep name mapping in m4sensorhub-irq.c 'irq_name' synchronized */ +enum m4sensorhub_irqs { +	/* 1st supported interrupt */ +	M4SH_IRQ__START, + +	/* INT0 0x01: Pressure interrupt */ +	M4SH_IRQ_PRESSURE_DATA_READY = M4SH_IRQ_INT0_INDEX, + +	/* INT0 0x02: Temperature interrupt */ +	M4SH_IRQ_TMP_DATA_READY, + +	/* INT0 0x04: Gyro interrupt */ +	M4SH_IRQ_GYRO_DATA_READY, + +	/* INT0 0x80: Pedometer interrupt */ +	M4SH_IRQ_PEDOMETER_DATA_READY, + +	/* INT0 0x10: Compass data interrupt */ +	M4SH_IRQ_COMPASS_DATA_READY, + +	/* INT0 0x20: Fusion data interrupt */ +	M4SH_IRQ_FUSION_DATA_READY, + +	/* INT0 0x40: Accel data interrupt */ +	M4SH_IRQ_ACCEL_DATA_READY, + +	/* INT0 0x80: Gesture interrupt */ +	M4SH_IRQ_GESTURE_DETECTED, + +	/* INT1 0x01 : still mode interrupt */ +	M4SH_IRQ_STILL_DETECTED = M4SH_IRQ_INT1_INDEX, + +	/* INT1 0x02 : motion detected interrupt */ +	M4SH_IRQ_MOTION_DETECTED, + +	/* INT1 0x04 : activity change interrupt */ +	M4SH_IRQ_ACTIVITY_CHANGE, + +	/* INT1 0x08 : download command complete interrupt */ +	M4SH_IRQ_DLCMD_RESP_READY, + +	/* INT1 0x10 : mic data ready interrupt */ +	M4SH_IRQ_MIC_DATA_READY, + +	/* INT1 0x20 : wrist command interrupt */ +	M4SH_IRQ_WRIST_READY, + +	/* INT1 0x40 : passive buffer full */ +	M4SH_IRQ_PASSIVE_BUFFER_FULL, + +	/* INT1 0x80 : lightsensor data ready */ +	M4SH_IRQ_LIGHTSENSOR_DATA_READY, + +	/* INT2 0x01 : heartratesensor data ready */ +	M4SH_IRQ_HRSENSOR_DATA_READY = M4SH_IRQ_INT2_INDEX, + +	/* INT2 0x02 : AP-RTC alarm expired */ +	M4SH_IRQ_AP_ALARM_EXPIRED, + +	/* INT2 0x04 : HR data ready */ +	M4SH_IRQ_HEARTRATE_DATA_READY, + +	/* Number of allocated interrupts */ +	M4SH_IRQ__NUM +}; +#endif  /* __M4SENSORHUB_IRQS_H__ */ + diff --git a/include/linux/m4sensorhub/m4sensorhub_reg_enum.h b/include/linux/m4sensorhub/m4sensorhub_reg_enum.h new file mode 100644 index 00000000000..1399e104cc5 --- /dev/null +++ b/include/linux/m4sensorhub/m4sensorhub_reg_enum.h @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2013, Motorola, Inc. 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, see <http://www.gnu.org/licenses/>. + * + */ + +/*****************************  WARNING  ****************************** + *                                                                    * + *                        DO NOT EDIT THIS FILE                       * + *                                                                    * + *  This is an auto-generated file based on register maps in the      * + *  M4 Sensor Hub source tree.                                        * + *                                                                    * + *****************************  WARNING  *****************************/ + +enum m4sensorhub_reg { +	M4SH_REG_ACCEL_VERSION, +	M4SH_REG_ACCEL_DUMMY,	/* Align the boundary */ +	M4SH_REG_ACCEL_SAMPLERATE, +	M4SH_REG_ACCEL_X, +	M4SH_REG_ACCEL_Y, +	M4SH_REG_ACCEL_Z, +	M4SH_REG_ACCEL_SCALEDMAGSQUARED, +	M4SH_REG_ACCEL_MAGNITUDE, +	M4SH_REG_ACCEL_TILT, +	M4SH_REG_ACCEL_ORIENTATION, +	M4SH_REG_TEMP_VERSION, +	M4SH_REG_TEMP_DUMMY,	/* Align the boundary */ +	M4SH_REG_TEMP_SAMPLERATE, +	M4SH_REG_TEMP_EXTRNLTEMP, +	M4SH_REG_TEMP_INTRNLTEMP, +	M4SH_REG_GENERAL_UTC, +	M4SH_REG_GENERAL_APALARM,	/* number of seconds before alarm expiry */ +	M4SH_REG_GENERAL_LOCALTIMEZONE, +	M4SH_REG_GENERAL_VERSION,	/* M4 software version  */ +	M4SH_REG_GENERAL_INTERRUPT0ENABLE, +	M4SH_REG_GENERAL_INTERRUPT1ENABLE, +	M4SH_REG_GENERAL_INTERRUPT2ENABLE, +	M4SH_REG_GENERAL_INTERRUPT0STATUS, +	M4SH_REG_GENERAL_INTERRUPT1STATUS, +	M4SH_REG_GENERAL_INTERRUPT2STATUS, +	M4SH_REG_PRESSURE_VERSION, +	M4SH_REG_PRESSURE_DUMMY,	/* Align the boundary */ +	M4SH_REG_PRESSURE_SAMPLERATE, +	M4SH_REG_PRESSURE_PRESSURE, +	M4SH_REG_PRESSURE_REFERENCEALTITUDE, +	M4SH_REG_PRESSURE_SEALEVELPRESSURE, +	M4SH_REG_PRESSURE_ABSOLUTEALTITUDE, +	M4SH_REG_PRESSURE_TEMPERATURE, +	M4SH_REG_PRESSURE_ISVALID, +	M4SH_REG_PEDOMETER_ENABLE, +	M4SH_REG_PEDOMETER_TESTCMD, +	M4SH_REG_PEDOMETER_ACTIVITY, +	M4SH_REG_PEDOMETER_EQUIPMENTTYPE, +	M4SH_REG_PEDOMETER_TOTALSTEPS, +	M4SH_REG_PEDOMETER_REPORTEDDISTANCE, +	M4SH_REG_PEDOMETER_USERDISTANCE, +	M4SH_REG_PEDOMETER_TOTALDISTANCE, +	M4SH_REG_PEDOMETER_FLOORSCLIMBED, +	M4SH_REG_PEDOMETER_CURRENTSPEED, +	M4SH_REG_TCMD_OPCODE, +	M4SH_REG_LOG_LOGENABLE, +	M4SH_REG_LOG_ISLOGIMMEDIATE, +	M4SH_REG_FUSION_VERSION, +	M4SH_REG_FUSION_DUMMY, +	M4SH_REG_FUSION_SAMPLERATE, +	M4SH_REG_FUSION_EULERPITCH, +	M4SH_REG_FUSION_EULERROLL, +	M4SH_REG_FUSION_EULERYAW, +	M4SH_REG_FUSION_LOCALX, +	M4SH_REG_FUSION_LOCALY, +	M4SH_REG_FUSION_LOCALZ, +	M4SH_REG_FUSION_GRAVITYX, +	M4SH_REG_FUSION_GRAVITYY, +	M4SH_REG_FUSION_GRAVITYZ, +	M4SH_REG_FUSION_ROTATIONVECTOR, +	M4SH_REG_FUSION_HEADING, +	M4SH_REG_FUSION_HEADING_ACCURACY, +	M4SH_REG_COMPASS_VERSION, +	M4SH_REG_COMPASS_DUMMY,	/* Align the boundary */ +	M4SH_REG_COMPASS_SAMPLERATE, +	M4SH_REG_COMPASS_X, +	M4SH_REG_COMPASS_Y, +	M4SH_REG_COMPASS_Z, +	M4SH_REG_COMPASS_ACCURACY, +	M4SH_REG_GYRO_VERSION, +	M4SH_REG_GYRO_DUMMY,	/* Align the boundary */ +	M4SH_REG_GYRO_SAMPLERATE, +	M4SH_REG_GYRO_X, +	M4SH_REG_GYRO_Y, +	M4SH_REG_GYRO_Z, +	M4SH_REG_METS_ENABLE, +	M4SH_REG_METS_METSACTIVITY, +	M4SH_REG_METS_MSSAMPLETIME, +	M4SH_REG_METS_METS, +	M4SH_REG_METS_CALORIES, +	M4SH_REG_METS_HEALTHYMINUTES, +	M4SH_REG_METS_METS_NO_RMR, +	M4SH_REG_METS_CALORIES_NO_RMR, +	M4SH_REG_USERSETTINGS_SCREENSTATUS, +	M4SH_REG_USERSETTINGS_USERAGE, +	M4SH_REG_USERSETTINGS_USERGENDER, +	M4SH_REG_USERSETTINGS_USERHEIGHT, +	M4SH_REG_USERSETTINGS_USERWEIGHT, +	M4SH_REG_USERSETTINGS_AUDIOSTATUS, +	M4SH_REG_USERSETTINGS_RTCRESET, +	M4SH_REG_POWER_VERSION, +	M4SH_REG_POWER_ENABLE, +	M4SH_REG_POWER_STILLMODETIMEOUT, +	M4SH_REG_POWER_MOTIONDURATION, +	M4SH_REG_POWER_MOTIONTHRESHOLD, +	M4SH_REG_POWER_NOMOTIONDURATION, +	M4SH_REG_POWER_NOMOTIONTHRESHOLD, +	M4SH_REG_POWER_DEVICESTATE, +	M4SH_REG_LOCATION_VERSION, +	M4SH_REG_LOCATION_SOURCE, +	M4SH_REG_LOCATION_SPEED, +	M4SH_REG_LOCATION_LATITUDE, +	M4SH_REG_LOCATION_LONGITUDE, +	M4SH_REG_LOCATION_ALTITUDE, +	M4SH_REG_DOWNLOAD_COMMAND, +	M4SH_REG_DOWNLOAD_STATUS, +	M4SH_REG_DOWNLOAD_SIZE, +	M4SH_REG_DOWNLOAD_CHECKSUM, +	M4SH_REG_DOWNLOAD_FILENAME, +	M4SH_REG_DOWNLOAD_PACKET, +	M4SH_REG_AUDIO_VERSION, +	M4SH_REG_AUDIO_ENABLE, +	M4SH_REG_AUDIO_DUMMY, +	M4SH_REG_AUDIO_TOTALPACKETS, +	M4SH_REG_TIMEPIECE_VERSION, +	M4SH_REG_TIMEPIECE_ENABLE,	/* 0: host control  1: sensorhub control */ +	M4SH_REG_TIMEPIECE_SAMPLERATE, +	M4SH_REG_TIMEPIECE_OFFSETSTEPS, +	M4SH_REG_WRIST_VERSION, +	M4SH_REG_WRIST_ENABLE, +	M4SH_REG_WRIST_INTERRUPTREASON, +	M4SH_REG_WRIST_HOSTRESPONSE, +	M4SH_REG_WRIST_FMONCHIP, +	M4SH_REG_WRIST_FMONFILE, +	M4SH_REG_GESTURE_VERSION, +	M4SH_REG_GESTURE_GESTURE1, +	M4SH_REG_GESTURE_CONFIDENCE1, +	M4SH_REG_GESTURE_VALUE1, +	M4SH_REG_GESTURE_GESTURE2, +	M4SH_REG_GESTURE_CONFIDENCE2, +	M4SH_REG_GESTURE_VALUE2, +	M4SH_REG_GESTURE_GESTURE3, +	M4SH_REG_GESTURE_CONFIDENCE3, +	M4SH_REG_GESTURE_VALUE3, +	M4SH_REG_PASSIVE_ENABLE, +	M4SH_REG_PASSIVE_DUMMY, +	M4SH_REG_PASSIVE_DUMMY1, +	M4SH_REG_PASSIVE_TIMESTAMP, +	M4SH_REG_PASSIVE_STEPS, +	M4SH_REG_PASSIVE_CALORIES, +	M4SH_REG_PASSIVE_HEARTRATE, +	M4SH_REG_PASSIVE_HRCONFIDENCE, +	M4SH_REG_PASSIVE_HEALTHYMINUTES, +	M4SH_REG_EMG_SIGNALCOUNT, +	M4SH_REG_EMG_DUMMY, +	M4SH_REG_EMG_SAMPLERATE, +	M4SH_REG_EMG_SIGNALS, +	M4SH_REG_HEARTRATE_ENABLE, +	M4SH_REG_HEARTRATE_APSAMPLERATE, +	M4SH_REG_HEARTRATE_HEARTRATE, +	M4SH_REG_HEARTRATE_CONFIDENCE, +	M4SH_REG_HRSENSOR_VERSION, +	M4SH_REG_HRSENSOR_DUMMY, +	M4SH_REG_HRSENSOR_SAMPLERATE, +	M4SH_REG_HRSENSOR_RAWVALUE, +	M4SH_REG_HRSENSOR_REGADDR, +	M4SH_REG_HRSENSOR_REGVALUE, +	M4SH_REG_HRSENSOR_REGRWCMD, +	M4SH_REG_LIGHTSENSOR_VERSION, +	M4SH_REG_LIGHTSENSOR_DUMMY, +	M4SH_REG_LIGHTSENSOR_SAMPLERATE, +	M4SH_REG_LIGHTSENSOR_SIGNAL, +	M4SH_REG_DEBUG_CMD, +	M4SH_REG__INVALID,                /* Marker for invalid register */ +	M4SH_REG__NUM = M4SH_REG__INVALID /* Number of registers */ +}; diff --git a/include/linux/m4sensorhub/m4sensorhub_registers.h b/include/linux/m4sensorhub/m4sensorhub_registers.h new file mode 100644 index 00000000000..f33bef2f66e --- /dev/null +++ b/include/linux/m4sensorhub/m4sensorhub_registers.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2012, Motorola, Inc. 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, see <http://www.gnu.org/licenses/>. + * + */ + +#ifndef __M4SENSORHUB_MEMMAP_H__ +#define __M4SENSORHUB_MEMMAP_H__ + +#include "m4sensorhub_bank_enum.h" +#include "m4sensorhub_reg_enum.h" + +#ifdef __KERNEL__ + +/* Global (kernel) definitions */ + +#define M4SH_MAX_REG_SIZE               2048 +#define M4SH_MAX_STACK_BUF_SIZE         32 +#define m4sh_no_mask                    NULL + +#endif /*__KERNEL__ */ +#endif /*__M4SENSORHUB_MEMMAP_H__ */ diff --git a/include/linux/m4sensorhub_client_ioctl.h b/include/linux/m4sensorhub_client_ioctl.h new file mode 100644 index 00000000000..a6e2c455c4c --- /dev/null +++ b/include/linux/m4sensorhub_client_ioctl.h @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2012, Motorola, Inc. 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, see <http://www.gnu.org/licenses/>. + * + */ + +#ifndef __M4SENSORHUB_CLIENT_IOCTL_H__ +#define __M4SENSORHUB_CLIENT_IOCTL_H__ + +/** The following define the IOCTL command values via the ioctl macros */ + +#define M4_SENSOR_IOCTL_BASE            		0xA2 +#define M4_SENSOR_IOCTL_GET_TEMPRATURE  		_IOR(M4_SENSOR_IOCTL_BASE, 01, int) +#define M4_SENSOR_IOCTL_GET_PRESSURE    		_IOR(M4_SENSOR_IOCTL_BASE, 02, int) +#define M4_SENSOR_IOCTL_GET_GYRO        		_IOR(M4_SENSOR_IOCTL_BASE, 03, int) +#define M4_SENSOR_IOCTL_SET_DELAY       		_IOW(M4_SENSOR_IOCTL_BASE, 04, int) +#define M4_SENSOR_IOCTL_APP_GET_FLAG    		_IOR(M4_SENSOR_IOCTL_BASE, 05, int) +#define M4_SENSOR_IOCTL_APP_SET_FLAG    		_IOW(M4_SENSOR_IOCTL_BASE, 06, int) +#define M4_SENSOR_IOCTL_GET_PEDOMETER   		_IOR(M4_SENSOR_IOCTL_BASE, 07, int) +#define M4_SENSOR_IOCTL_GET_PASSIVE_DATA		_IOR(M4_SENSOR_IOCTL_BASE, 10, int) +#define M4_SENSOR_IOCTL_GET_SLEEP_DATA			_IOR(M4_SENSOR_IOCTL_BASE, 11, int) +#define M4_SENSOR_IOCTL_SET_POSIX_TIME			_IOW(M4_SENSOR_IOCTL_BASE, 12, int) +#define M4_SENSOR_IOCTL_SET_ACTIVE_MODE			_IOW(M4_SENSOR_IOCTL_BASE, 13, int) +#define M4_SENSOR_IOCTL_SET_PASSIVE_MODE 		_IOW(M4_SENSOR_IOCTL_BASE, 14, int) +#define M4_SENSOR_IOCTL_SLEEP_ANALYSIS			_IOW(M4_SENSOR_IOCTL_BASE, 15, int) +#define M4_SENSOR_IOCTL_SET_EQUIPMENT_TYPE		_IOW(M4_SENSOR_IOCTL_BASE, 16, int) +#define M4_SENSOR_IOCTL_SET_MANUAL_CALIB_WALK_SPEED	_IOW(M4_SENSOR_IOCTL_BASE, 17, int) +#define M4_SENSOR_IOCTL_SET_MANUAL_CALIB_JOG_SPEED	_IOW(M4_SENSOR_IOCTL_BASE, 20, int) +#define M4_SENSOR_IOCTL_SET_MANUAL_CALIB_RUN_SPEED	_IOW(M4_SENSOR_IOCTL_BASE, 21, int) +#define M4_SENSOR_IOCTL_SET_MANUAL_CALIB_STATUS		_IOW(M4_SENSOR_IOCTL_BASE, 22, int) +#define M4_SENSOR_IOCTL_SET_USER_PROFILE		_IOW(M4_SENSOR_IOCTL_BASE, 23, int) +#define M4_SENSOR_IOCTL_SET_USER_DISTANCE		_IOW(M4_SENSOR_IOCTL_BASE, 24, int) +#define M4_SENSOR_IOCTL_SET_USER_CALIB_TABLE		_IOW(M4_SENSOR_IOCTL_BASE, 25, int) +#define M4_SENSOR_IOCTL_GET_MANUAL_CALIB_STATUS		_IOR(M4_SENSOR_IOCTL_BASE, 26, int) +#define M4_SENSOR_IOCTL_ERASE_CALIB			_IOW(M4_SENSOR_IOCTL_BASE, 27, int) +#define M4_SENSOR_IOCTL_SET_SCREEN_ON_GESTURE_STATUS	_IOW(M4_SENSOR_IOCTL_BASE, 30, int) +#define M4_SENSOR_IOCTL_SET_ALTITUDE 			_IOW(M4_SENSOR_IOCTL_BASE, 31, int) +#define M4_SENSOR_IOCTL_GET_FUSION			_IOR(M4_SENSOR_IOCTL_BASE, 32, int) +#define M4_SENSOR_IOCTL_GET_COMPASS			_IOR(M4_SENSOR_IOCTL_BASE, 33, int) +#define M4_SENSOR_IOCTL_GET_ACCEL			_IOR(M4_SENSOR_IOCTL_BASE, 34, int) +#define M4_SENSOR_IOCTL_GYRO_SET_DELAY			_IOW(M4_SENSOR_IOCTL_BASE, 35, int) +#define M4_SENSOR_IOCTL_COMPASS_SET_DELAY		_IOW(M4_SENSOR_IOCTL_BASE, 36, int) +#define M4_SENSOR_IOCTL_ACCEL_SET_DELAY			_IOW(M4_SENSOR_IOCTL_BASE, 37, int) +#define M4_SENSOR_IOCTL_FUSION_SET_DELAY		_IOW(M4_SENSOR_IOCTL_BASE, 40, int) +#define M4_SENSOR_IOCTL_SET_SCREEN_STATUS _IOW(M4_SENSOR_IOCTL_BASE, 41, int) +#define M4_SENSOR_IOCTL_DL_SEND_PACKET    _IOW(M4_SENSOR_IOCTL_BASE, 42, int) +#define M4_SENSOR_IOCTL_SET_TIMEZONE_OFFSET _IOW(M4_SENSOR_IOCTL_BASE, 43, int) +#define M4_SENSOR_IOCTL_LOCK_CLOCKFACE    _IOW(M4_SENSOR_IOCTL_BASE, 44, int) +#define M4_SENSOR_IOCTL_SET_DAILYSTEP_OFFSET _IOW(M4_SENSOR_IOCTL_BASE, 45, int) + +#define M4_SENSOR_DL_MAX_FILE_SIZE 16 +#define M4_SENSOR_DL_MAX_PACKET_SIZE 2048 + +enum M4_SENSOR_DL_CMDS { +	M4_SENSOR_DL_CMD_GET_CHECKSUM, +	M4_SENSOR_DL_CMD_OPEN_FILE, +	M4_SENSOR_DL_CMD_WRITE_FILE, +	M4_SENSOR_DL_CMD_CLOSE_FILE, +	M4_SENSOR_DL_CMD_DELETE_FILE, +}; + +enum M4_SENSOR_DL_ERROR_CODES { +	M4_SENSOR_DL_SUCCESS, +	M4_SENSOR_DL_ERROR_GET_CHECKSUM, +	M4_SENSOR_DL_ERROR_OPEN_FILE, +	M4_SENSOR_DL_ERROR_WRITE_FILE, +	M4_SENSOR_DL_ERROR_CLOSE_FILE, +	M4_SENSOR_DL_ERROR_DELETE_FILE, +	M4_SENSOR_DL_ERROR_INVALID_SIZE, +	/*internal error between M4<==>Kernel*/ +	M4_SENSOR_DL_ERROR_SEND_CMD = 0x80, +	M4_SENSOR_DL_ERROR_DATA_CHECKSUM, +}; + +#define M4_MAX_LOG_LEVEL	3 +#define get_log_level(loglevel, mask) ((loglevel >> mask) & 0x3) + +struct m4sh_user_profile { +	unsigned char gender; +	unsigned char age; +	unsigned char height; +	unsigned char weight; +}; + +struct m4sh_workout_data { +	int msp_distance; +	int user_distance; +}; + +struct m4sh_download_packet{ +	unsigned char command; +	unsigned char status; +	unsigned short size; +	unsigned int  checksum; +	char filename[M4_SENSOR_DL_MAX_FILE_SIZE]; +	unsigned char buffer[M4_SENSOR_DL_MAX_PACKET_SIZE]; +}; + +enum m4sh_log_level_mask { +	GEN_MASK_BIT_1, +	GEN_MASK_BIT_2, +	TIMER_MASK_BIT_1, +	TIMER_MASK_BIT_2, +	ACCEL_MASK_BIT_1, +	ACCEL_MASK_BIT_2, +	TMP_MASK_BIT_1, +	TMP_MASK_BIT_2, +	BMP_MASK_BIT_1, +	BMP_MASK_BIT_2, +	PEDO_MASK_BIT_1, +	PEDO_MASK_BIT_2, +	TCMD_MASK_BIT_1, +	TCMD_MASK_BIT_2, +	GYRO_MASK_BIT_1, +	GYRO_MASK_BIT_2, +	COMPASS_MASK_BIT_1, +	COMPASS_MASK_BIT_2, +	FUSION_MASK_BIT_1, +	FUSION_MASK_BIT_2, +	METS_MASK_BIT_1, +	METS_MASK_BIT_2, +	GESTURE_MASK_BIT_1, +	GESTURE_MASK_BIT_2, +	POWER_MASK_BIT_1, +	POWER_MASK_BIT_2, +	CORRELATION_MASK_BIT_1, +	CORRELATION_MASK_BIT_2, +	GPS_MASK_BIT_1, +	GPS_MASK_BIT_2, +	DOWNLOAD_MASK_BIT_1, +	DOWNLOAD_MASK_BIT_2, +	AUDIO_MASK_BIT_1, +	AUDIO_MASK_BIT_2, +	DISPLAY_MASK_BIT_1, +	DISPLAY_MASK_BIT_2, +	WRIST_MASK_BIT_1, +	WRIST_MASK_BIT_2, +}; + +#endif  /* __M4SENSORHUB_CLIENT_IOCTL_H__ */ diff --git a/include/linux/m4sensorhub_gpio.h b/include/linux/m4sensorhub_gpio.h new file mode 100644 index 00000000000..287acd98571 --- /dev/null +++ b/include/linux/m4sensorhub_gpio.h @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2013 Motorola Mobility, Inc. + * + * 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., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307, USA + */ + +#ifndef _M4SENSORHUB_GPIO_H_ +#define _M4SENSORHUB_GPIO_H_ + +struct m4wrist_gpio_data { +	int         gpio_xres; +	int         gpio_clk; +	int         gpio_data; +}; + +#endif /* _M4SENSORHUB_GPIO_H_ */ diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h index 20e433e551e..7f0ec4340a3 100644 --- a/include/linux/mfd/tps65910.h +++ b/include/linux/mfd/tps65910.h @@ -878,8 +878,9 @@ struct tps65910_board {  	int vmbch2_threshold;  	bool en_ck32k_xtal;  	bool en_dev_slp; +	bool sleepsig_pol;  	bool pm_off; -	struct tps65910_sleep_keepon_data *slp_keepon; +	struct tps65910_sleep_keepon_data slp_keepon;  	bool en_gpio_sleep[TPS6591X_MAX_NUM_GPIO];  	unsigned long regulator_ext_sleep_control[TPS65910_NUM_REGS];  	struct regulator_init_data *tps65910_pmic_init_data[TPS65910_NUM_REGS]; diff --git a/include/linux/mfd/tps65912.h b/include/linux/mfd/tps65912.h index 6d309032dc0..426f5e5e08f 100644 --- a/include/linux/mfd/tps65912.h +++ b/include/linux/mfd/tps65912.h @@ -264,6 +264,31 @@  #define DCDC_LIMIT_MAX_SEL_MASK		0x3F  #define DCDC_LIMIT_MAX_SEL_SHIFT	0 +/* Register LOADSWITCH */ +#define LOADSWITCH_MASK		0x03 +#define LOADSWITCH_DISABLE		0 +#define LOADSWITCH_ENABLE		1 + +/* Number of step-down converters available */ +#define TPS65912_NUM_DCDC	4 + +/* Number of LDO voltage regulators  available */ +#define TPS65912_NUM_LDO	10 + +/* Number of total regulators available */ +#define TPS65912_NUM_REGULATOR		(TPS65912_NUM_DCDC + TPS65912_NUM_LDO) + +enum pwrkey_states { +	PWRKEY_RELEASE, /* Power key released state. */ +	PWRKEY_PRESS,   /* Power key pressed state. */ +	PWRKEY_UNKNOWN, /* Unknown power key state. */ +}; + +struct tps65912_register_init_data { +	u8 addr; +	u16 data; +}; +  /**   * struct tps65912_board   * Board platform dat may be used to initialize regulators. @@ -276,7 +301,10 @@ struct tps65912_board {  	int irq;  	int irq_base;  	int gpio_base; -	struct regulator_init_data *tps65912_pmic_init_data; +	int num_init_registers; +	struct tps65912_register_init_data *register_init_data; +	struct regulator_init_data +		*regulator_init_data[TPS65912_NUM_REGULATOR];  };  /** @@ -306,6 +334,13 @@ struct tps65912 {  	int irq_base;  	int irq_num;  	u32 irq_mask; +	void *debugfs_data; +	void *keydata; +	u32 powerkey_state; +	u32 powerkey_code; +	u32 powerkey_up_irq; +	u32 powerkey_down_irq; +	struct mutex pm_lock;   /* guard access to spi bus from irq */  };  struct tps65912_platform_data { @@ -313,6 +348,16 @@ struct tps65912_platform_data {  	int irq_base;  }; +static inline void tps65912_set_keydata(struct tps65912 *tps65912, void *data) +{ +	tps65912->keydata = data; +} + +static inline void *tps65912_get_keydata(struct tps65912 *tps65912) +{ +	return tps65912->keydata; +} +  unsigned int tps_chip(void);  int tps65912_set_bits(struct tps65912 *tps65912, u8 reg, u8 mask); @@ -324,5 +369,10 @@ void tps65912_device_exit(struct tps65912 *tps65912);  int tps65912_irq_init(struct tps65912 *tps65912, int irq,  			struct tps65912_platform_data *pdata);  int tps65912_irq_exit(struct tps65912 *tps65912); +int tps65912_debugfs_create(struct tps65912 *tps65912); +void tps65912_debugfs_remove(struct tps65912 *tps65912); +void tps65912_dump_registers(struct tps65912 *tps65912); +void tps65912_broadcast_key_event(struct tps65912 *tps65912, +			       unsigned int code, int value);  #endif /*  __LINUX_MFD_TPS65912_H */ diff --git a/include/linux/mm.h b/include/linux/mm.h index e0c8528a41a..01eb01df922 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -908,6 +908,7 @@ extern void pagefault_out_of_memory(void);  extern void show_free_areas(unsigned int flags);  extern bool skip_free_areas_node(unsigned int flags, int nid); +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); @@ -1485,7 +1486,7 @@ extern int vma_adjust(struct vm_area_struct *vma, unsigned long start,  extern struct vm_area_struct *vma_merge(struct mm_struct *,  	struct vm_area_struct *prev, unsigned long addr, unsigned long end,  	unsigned long vm_flags, struct anon_vma *, struct file *, pgoff_t, -	struct mempolicy *); +	struct mempolicy *, const char __user *);  extern struct anon_vma *find_mergeable_anon_vma(struct vm_area_struct *);  extern int split_vma(struct mm_struct *,  	struct vm_area_struct *, unsigned long addr, int new_below); diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index ace9a5f01c6..875ba48dd72 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -255,6 +255,10 @@ struct vm_area_struct {  	 * For areas with an address space and backing store,  	 * linkage into the address_space->i_mmap interval tree, or  	 * linkage of vma in the address_space->i_mmap_nonlinear list. +	 * +	 * For private anonymous mappings, a pointer to a null terminated string +	 * in the user process containing the name given to the vma, or NULL +	 * if unnamed.  	 */  	union {  		struct { @@ -262,6 +266,7 @@ struct vm_area_struct {  			unsigned long rb_subtree_last;  		} linear;  		struct list_head nonlinear; +		const char __user *anon_name;  	} shared;  	/* @@ -456,4 +461,14 @@ static inline cpumask_t *mm_cpumask(struct mm_struct *mm)  	return mm->cpu_vm_mask_var;  } + +/* Return the name for an anonymous mapping or NULL for a file-backed mapping */ +static inline const char __user *vma_get_anon_name(struct vm_area_struct *vma) +{ +	if (vma->vm_file) +		return NULL; + +	return vma->shared.anon_name; +} +  #endif /* _LINUX_MM_TYPES_H */ diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index e326ae2882a..66b46592760 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -15,6 +15,7 @@  #include <linux/sched.h>  #include <linux/device.h>  #include <linux/fault-inject.h> +#include <linux/wakelock.h>  #include <linux/mmc/core.h>  #include <linux/mmc/pm.h> @@ -329,12 +330,17 @@ struct mmc_host {  	int			claim_cnt;	/* "claim" nesting count */  	struct delayed_work	detect; +	struct wake_lock	detect_wake_lock;  	int			detect_change;	/* card detect flag */  	struct mmc_slot		slot;  	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;  	bool			sdio_irq_pending; @@ -362,6 +368,15 @@ struct mmc_host {  	unsigned int		slotno;	/* used for sdio acpi binding */ +#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 +  	unsigned long		private[0] ____cacheline_aligned;  }; @@ -371,6 +386,14 @@ void mmc_remove_host(struct mmc_host *);  void mmc_free_host(struct mmc_host *);  void mmc_of_parse(struct mmc_host *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; @@ -381,6 +404,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);  int mmc_suspend_host(struct mmc_host *);  int mmc_resume_host(struct mmc_host *); diff --git a/include/linux/mmc/pm.h b/include/linux/mmc/pm.h index 4a139204c20..6e2d6a135c7 100644 --- a/include/linux/mmc/pm.h +++ b/include/linux/mmc/pm.h @@ -26,5 +26,6 @@ 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 */  #endif /* LINUX_MMC_PM_H */ diff --git a/include/linux/mmc/sdio_func.h b/include/linux/mmc/sdio_func.h index 50f0bc95232..dc680c4b50d 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); diff --git a/include/linux/mpu.h b/include/linux/mpu.h new file mode 100644 index 00000000000..cda715bcfa4 --- /dev/null +++ b/include/linux/mpu.h @@ -0,0 +1,111 @@ +/* +* Copyright (C) 2012 Invensense, 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 __MPU_H_ +#define __MPU_H_ + +#ifdef __KERNEL__ +#include <linux/types.h> +#include <linux/ioctl.h> +#endif + +enum secondary_slave_type { +	SECONDARY_SLAVE_TYPE_NONE, +	SECONDARY_SLAVE_TYPE_ACCEL, +	SECONDARY_SLAVE_TYPE_COMPASS, +	SECONDARY_SLAVE_TYPE_PRESSURE, + +	SECONDARY_SLAVE_TYPE_TYPES +}; + +enum ext_slave_id { +	ID_INVALID = 0, +	GYRO_ID_MPU3050, +	GYRO_ID_MPU6050A2, +	GYRO_ID_MPU6050B1, +	GYRO_ID_MPU6050B1_NO_ACCEL, +	GYRO_ID_ITG3500, + +	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_AK8963, +	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_MLX90399, +	COMPASS_ID_AK09911, + +	PRESSURE_ID_BMP085, +	PRESSURE_ID_BMP280, +}; + +#define INV_PROD_KEY(ver, rev) (ver * 100 + rev) +/** + * 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 + * @sec_slave_type:     secondary slave device type, can be compass, accel, etc + * @sec_slave_id:       id of the secondary slave device + * @secondary_i2c_address: secondary device's i2c address + * @secondary_orientation: secondary device's orientation matrix + * @key:                key for MPL library. + * + * 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[9]; +	enum secondary_slave_type sec_slave_type; +	enum ext_slave_id sec_slave_id; +	__u16 secondary_i2c_addr; +	__s8 secondary_orientation[9]; +	__u8 key[16]; +	enum secondary_slave_type aux_slave_type; +	enum ext_slave_id aux_slave_id; +	__u16 aux_i2c_addr; + +#ifdef CONFIG_DTS_INV_MPU_IIO +	int (*power_on)(struct mpu_platform_data *); +	int (*power_off)(struct mpu_platform_data *); +	struct regulator *vdd_ana; +	struct regulator *vdd_i2c; +#endif +}; + +#endif	/* __MPU_H_ */ diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h index 211ff67e8b0..95fc482cef3 100644 --- a/include/linux/mtd/bbm.h +++ b/include/linux/mtd/bbm.h @@ -93,8 +93,6 @@ struct nand_bbt_descr {  #define NAND_BBT_CREATE_EMPTY	0x00000400  /* Search good / bad pattern through all pages of a block */  #define NAND_BBT_SCANALLPAGES	0x00000800 -/* Scan block empty during good / bad block scan */ -#define NAND_BBT_SCANEMPTY	0x00001000  /* Write bbt if neccecary */  #define NAND_BBT_WRITE		0x00002000  /* Read and write back block contents when writing bbt */ diff --git a/include/linux/netfilter/xt_qtaguid.h b/include/linux/netfilter/xt_qtaguid.h new file mode 100644 index 00000000000..ca60fbdec2f --- /dev/null +++ b/include/linux/netfilter/xt_qtaguid.h @@ -0,0 +1,13 @@ +#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 00000000000..eadc6903314 --- /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/nmi.h b/include/linux/nmi.h index db50840e635..c8f8aa0383e 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h @@ -14,8 +14,11 @@   * may be used to reset the timeout - for code which intentionally   * disables interrupts for a long time. This call is stateless.   */ -#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR) +#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR_NMI)  #include <asm/nmi.h> +#endif + +#if defined(CONFIG_HAVE_NMI_WATCHDOG) || defined(CONFIG_HARDLOCKUP_DETECTOR)  extern void touch_nmi_watchdog(void);  #else  static inline void touch_nmi_watchdog(void) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 6d53675c2b5..7fbd6720021 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -109,6 +109,7 @@ enum pageflags {  #ifdef CONFIG_TRANSPARENT_HUGEPAGE  	PG_compound_lock,  #endif +	PG_readahead,		/* page in a readahead window */  	__NR_PAGEFLAGS,  	/* Filesystems */ diff --git a/include/linux/platform_data/ds2482.h b/include/linux/platform_data/ds2482.h new file mode 100644 index 00000000000..5a6879e2a09 --- /dev/null +++ b/include/linux/platform_data/ds2482.h @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2012 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 __PLATFORM_DATA_DS2482__ +#define __PLATFORM_DATA_DS2482__ + +struct ds2482_platform_data { +	int		slpz_gpio; +}; + +#endif /* __PLATFORM_DATA_DS2482__ */ diff --git a/include/linux/platform_data/gpio-omap.h b/include/linux/platform_data/gpio-omap.h index 5d50b25a73d..11f4bff9c7e 100644 --- a/include/linux/platform_data/gpio-omap.h +++ b/include/linux/platform_data/gpio-omap.h @@ -27,6 +27,8 @@  #include <linux/io.h>  #include <linux/platform_device.h> +#define OFF_MODE	1 +  #define OMAP1_MPUIO_BASE			0xfffb5000  /* @@ -209,7 +211,7 @@ struct omap_gpio_platform_data {  };  extern void omap2_gpio_prepare_for_idle(int off_mode); -extern void omap2_gpio_resume_after_idle(void); +extern void omap2_gpio_resume_after_idle(bool in_suspend);  extern void omap_set_gpio_debounce(int gpio, int enable);  extern void omap_set_gpio_debounce_time(int gpio, int enable); diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h index 6bf9ef43ddb..3e9dd6676b9 100644 --- a/include/linux/platform_data/mtd-nand-omap2.h +++ b/include/linux/platform_data/mtd-nand-omap2.h @@ -1,6 +1,4 @@  /* - * arch/arm/plat-omap/include/mach/nand.h - *   * Copyright (C) 2006 Micron Technology Inc.   *   * This program is free software; you can redistribute it and/or modify @@ -23,13 +21,16 @@ enum nand_io {  };  enum omap_ecc { -		/* 1-bit ecc: stored at end of spare area */ -	OMAP_ECC_HAMMING_CODE_DEFAULT = 0, /* Default, s/w method */ -	OMAP_ECC_HAMMING_CODE_HW, /* gpmc to detect the error */ -		/* 1-bit ecc: stored at beginning of spare area as romcode */ -	OMAP_ECC_HAMMING_CODE_HW_ROMCODE, /* gpmc method & romcode layout */ -	OMAP_ECC_BCH4_CODE_HW, /* 4-bit BCH ecc code */ -	OMAP_ECC_BCH8_CODE_HW, /* 8-bit BCH ecc code */ +	/* 1-bit  ECC calculation by GPMC, Error detection by Software */ +	OMAP_ECC_HAM1_CODE_HW = 0, +	/* 4-bit  ECC calculation by GPMC, Error detection by Software */ +	OMAP_ECC_BCH4_CODE_HW_DETECTION_SW, +	/* 4-bit  ECC calculation by GPMC, Error detection by ELM */ +	OMAP_ECC_BCH4_CODE_HW, +	/* 8-bit  ECC calculation by GPMC, Error detection by Software */ +	OMAP_ECC_BCH8_CODE_HW_DETECTION_SW, +	/* 8-bit  ECC calculation by GPMC, Error detection by ELM */ +	OMAP_ECC_BCH8_CODE_HW,  };  struct gpmc_nand_regs { @@ -63,5 +64,6 @@ struct omap_nand_platform_data {  	/* for passing the partitions */  	struct device_node	*of_node; +	struct device_node	*elm_of_node;  };  #endif diff --git a/include/linux/platform_data/mtd-onenand-omap2.h b/include/linux/platform_data/mtd-onenand-omap2.h index e9a9fb188f9..56ff0e6f5ad 100644 --- a/include/linux/platform_data/mtd-onenand-omap2.h +++ b/include/linux/platform_data/mtd-onenand-omap2.h @@ -1,6 +1,4 @@  /* - * arch/arm/plat-omap/include/mach/onenand.h - *   * Copyright (C) 2006 Nokia Corporation   * Author: Juha Yrjola   * diff --git a/include/linux/platform_data/serial-omap.h b/include/linux/platform_data/serial-omap.h index c860c1b314c..9990f7cd03c 100644 --- a/include/linux/platform_data/serial-omap.h +++ b/include/linux/platform_data/serial-omap.h @@ -37,13 +37,25 @@ struct omap_uart_port_info {  	unsigned int		dma_rx_buf_size;  	unsigned int		dma_rx_timeout;  	unsigned int		autosuspend_timeout; +	unsigned int		wakelock_timeout;  	unsigned int		dma_rx_poll_rate;  	int			DTR_gpio;  	int			DTR_inverted;  	int			DTR_present; +	bool			wakeup_capable; +	bool			open_close_pm; +	unsigned int		rx_trig;  	int (*get_context_loss_count)(struct device *);  	void (*enable_wakeup)(struct device *, bool); +	void (*wake_peer)(struct uart_port *);  }; +extern void omap_uart_remove_wakeup(struct device *dev); +extern void omap_uart_enable_wakeup(struct device *dev, bool enable); +extern int omap_pm_get_dev_context_loss_count(struct device *dev); + +extern int omap_serial_ext_uart_enable(u8 port_id); +extern int omap_serial_ext_uart_disable(u8 port_id); +  #endif /* __OMAP_SERIAL_H__ */ diff --git a/include/linux/pm.h b/include/linux/pm.h index a224c7f5c37..d72e7b30afe 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -560,6 +560,7 @@ struct dev_pm_info {  	unsigned long		suspended_jiffies;  	unsigned long		accounting_timestamp;  #endif +	bool			resume_noidle;  	struct pm_subsys_data	*subsys_data;  /* Owned by the subsystem. */  	struct dev_pm_qos	*qos;  }; diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 5a95013905c..218a8227ec4 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -40,6 +40,7 @@ enum pm_qos_flags_status {  struct pm_qos_request {  	struct plist_node node;  	int pm_qos_class; +	bool timeout_enabled;  	struct delayed_work work; /* for pm_qos_update_request_timeout */  }; @@ -114,6 +115,8 @@ void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class,  			s32 value);  void pm_qos_update_request(struct pm_qos_request *req,  			   s32 new_value); +void pm_qos_add_request_timeout(struct pm_qos_request *req, int pm_qos_class, +			s32 value);  void pm_qos_update_request_timeout(struct pm_qos_request *req,  				   s32 new_value, unsigned long timeout_us);  void pm_qos_remove_request(struct pm_qos_request *req); diff --git a/include/linux/power/gpio-charger.h b/include/linux/power/gpio-charger.h index de1dfe09a03..ebd476da23a 100644 --- a/include/linux/power/gpio-charger.h +++ b/include/linux/power/gpio-charger.h @@ -26,6 +26,8 @@   * @gpio_active_low:	Should be set to 1 if the GPIO is active low otherwise 0   * @supplied_to:	Array of battery names to which this chargers supplies power   * @num_supplicants:	Number of entries in the supplied_to array + * @switch_name:	Name for the charger GPIO switch. Switch requires a +			valid IRQ for the GPIO indicating charging status.   */  struct gpio_charger_platform_data {  	const char *name; @@ -36,6 +38,8 @@ struct gpio_charger_platform_data {  	char **supplied_to;  	size_t num_supplicants; + +	const char *switch_name;  };  #endif diff --git a/include/linux/power/max17042_battery.h b/include/linux/power/max17042_battery.h index 89dd84f47c6..d3214b54fd2 100644 --- a/include/linux/power/max17042_battery.h +++ b/include/linux/power/max17042_battery.h @@ -120,6 +120,7 @@ enum max17042_register {  enum max17047_register {  	MAX17047_QRTbl00	= 0x12,  	MAX17047_FullSOCThr	= 0x13, +	MAX17047_Config_Ver	= 0x20,	/* Reserved register */  	MAX17047_QRTbl10	= 0x22,  	MAX17047_QRTbl20	= 0x32,  	MAX17047_V_empty	= 0x3A, @@ -139,6 +140,8 @@ struct max17042_reg_data {  };  struct max17042_config_data { +	/* Increment version for new config data to be programed */ +	u16 version;  	/* External current sense resistor value in milli-ohms */  	u32	cur_sense_val; @@ -195,10 +198,25 @@ struct max17042_config_data {  	u16	cell_char_tbl[MAX17042_CHARACTERIZATION_DATA_SIZE];  } __packed; +/* + * used to convert a value from Temperature register to a "real" temp value. + * This conversion table can be used when configuring tgain and toff is not + * sufficient to get accurate temperature measurements. + * The result[0] corresponds to start temp, result[1] to (start + 1) temp, etc. + */ +struct max17042_temp_conv { +	s16 start;	/* Centigrade */ +	s16 *result;	/* Deci-centigrade */ +	int num_result;	/* Number of entries in result array */ +}; +  struct max17042_platform_data {  	struct max17042_reg_data *init_data;  	struct max17042_config_data *config_data;  	int num_init_data; /* Number of enties in init_data array */ +	struct gpio *gpio_list; +	int num_gpio_list; /* Number of entries in gpio_list array */ +	struct max17042_temp_conv *tcnv; /* temp conversion table */  	bool enable_current_sense;  	bool enable_por_init; /* Use POR init from Maxim appnote */ @@ -208,6 +226,19 @@ struct max17042_platform_data {  	 * the datasheet although it can be changed by board designers.  	 */  	unsigned int r_sns; +	/* +	 * Enable this flag to report "0" SOC iff battery undervoltage interrupt +	 * has fired. +	 */ +	bool batt_undervoltage_zero_soc; +	/* +	 * Malicious power supply specification (Optional). Used if there is +	 * is a power supply, other than a battery or charger, that might +	 * confuse the fuel gauge. If specificed, once the power supply is +	 * removed, the driver will perform a POR of the chip in an attempt +	 * to remove any learned data when the power supply was enabled. +	 */ +	const char *malicious_supply;  };  #endif /* __MAX17042_BATTERY_H_ */ diff --git a/include/linux/power/omap_prm.h b/include/linux/power/omap_prm.h new file mode 100644 index 00000000000..b5dde83da27 --- /dev/null +++ b/include/linux/power/omap_prm.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2014 Motorola Mobility LLC + * + * 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., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307, USA + */ + +#ifndef _POWER_OMAP_PRM_H +#define _POWER_OMAP_PRM_H + +#if IS_ENABLED(CONFIG_POWER_TI_HARDWARE_VOLTAGE_CONTROL) +/* + * omap_prm_configure - Will configure global PRM register to low power values + *			for voltage setup timings and state according device + *			device tree properties. + * bool off:		If true then OFF state will be configured, otherwise + *			retention state. At least one of these state has to be + *			enabled in device tree with auto_off or auto_retention + *			flags&pointer + * Returns 0 if success, otherwise error code. + */ +int omap_prm_configure(bool off); + +void omap_pm_enable_off_mode(void); +void omap_pm_disable_off_mode(void); +bool omap_pm_get_off_mode(void); +#else +static inline int omap_prm_configure(bool off) +{ +	return -ENODEV; +} +static inline void omap_pm_enable_off_mode(void) +{ +} +static inline void omap_pm_disable_off_mode(void) +{ +} +static inline bool omap_pm_get_off_mode(void) +{ +	return false; +} +#endif + +#endif				/* _POWER_OMAP_PRM_H */ diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 3828cefb4f6..f8eb8654abf 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -140,6 +140,10 @@ enum power_supply_property {  	POWER_SUPPLY_PROP_TIME_TO_FULL_AVG,  	POWER_SUPPLY_PROP_TYPE, /* use power_supply.type instead */  	POWER_SUPPLY_PROP_SCOPE, +	/* Local extensions */ +	POWER_SUPPLY_PROP_USB_HC, +	POWER_SUPPLY_PROP_USB_OTG, +	POWER_SUPPLY_PROP_CHARGE_ENABLED,  	/* Properties of type `const char *' */  	POWER_SUPPLY_PROP_MODEL_NAME,  	POWER_SUPPLY_PROP_MANUFACTURER, @@ -155,6 +159,7 @@ 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_WIRELESS,	/* Wireless Charger */  };  union power_supply_propval { @@ -194,6 +199,8 @@ struct power_supply {  	/* private */  	struct device *dev;  	struct work_struct changed_work; +	spinlock_t changed_lock; +	bool changed;  #ifdef CONFIG_THERMAL  	struct thermal_zone_device *tzd;  	struct thermal_cooling_device *tcd; diff --git a/include/linux/pstore.h b/include/linux/pstore.h index 75d01760c91..70782dbafa2 100644 --- a/include/linux/pstore.h +++ b/include/linux/pstore.h @@ -35,6 +35,7 @@ enum pstore_type_id {  	PSTORE_TYPE_MCE		= 1,  	PSTORE_TYPE_CONSOLE	= 2,  	PSTORE_TYPE_FTRACE	= 3, +	PSTORE_TYPE_ANNOTATE	= 4,  	PSTORE_TYPE_UNKNOWN	= 255  }; @@ -69,6 +70,7 @@ struct pstore_info {  #ifdef CONFIG_PSTORE  extern int pstore_register(struct pstore_info *);  extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason); +extern int pstore_annotate(const char *buf);  #else  static inline int  pstore_register(struct pstore_info *psi) diff --git a/include/linux/pstore_ram.h b/include/linux/pstore_ram.h index 9974975d40d..751cf680417 100644 --- a/include/linux/pstore_ram.h +++ b/include/linux/pstore_ram.h @@ -79,6 +79,7 @@ struct ramoops_platform_data {  	unsigned long	record_size;  	unsigned long	console_size;  	unsigned long	ftrace_size; +	unsigned long	annotate_size;  	int		dump_oops;  	struct persistent_ram_ecc_info ecc_info;  }; diff --git a/include/linux/regulator/omap-pmic-regulator.h b/include/linux/regulator/omap-pmic-regulator.h new file mode 100644 index 00000000000..db0bab4b7e6 --- /dev/null +++ b/include/linux/regulator/omap-pmic-regulator.h @@ -0,0 +1,162 @@ +/* + * OMAP Generic PMIC Regulator interfaces + * + * Idea based on arch/arm/mach-omap2/omap_twl.c and + * arch/arm/mach-omap2/voltage.h + * Copyright (C) 2010 Texas Instruments Incorporated. + * Thara Gopinath + * Copyright (C) 2009 Texas Instruments Incorporated. + * Nishanth Menon + * Copyright (C) 2009 Nokia Corporation + * Paul Walmsley + * + * Copyright (C) 2013 Texas Instruments Incorporated. + * Grygorii Strashko + * Nishanth Menon + * + * 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 "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the + * GNU General Public License for more details. + */ + +#ifndef __POWER_OMAP_PMIC_H +#define __POWER_OMAP_PMIC_H + +struct omap_pmic; + +/** + * struct omap_pmic_setup_commands - setup commands over voltage controller + * @reg:	device's i2c register address + * @cmd_val:	command to send. + */ +struct omap_pmic_setup_commands { +	u8 reg; +	u8 cmd_val; +}; + +/** + * struct omap_pmic_ops - Conversion routines for voltage controller/processor + * @vsel_to_uv: convert voltage selector to micro-volts + * @uv_to_vsel: convert micro-volts to voltage selector + * + * voltage controller/processor drivers SHOULD NOT do modifications on vsel or + * make any assumptions about vsel. Instead, they may operate on micro-volts + * and request vsel conversion once they are ready to do hardware operations. + * + * This is provided over the omap_pmic structure. + */ +struct omap_pmic_ops { +	int (*vsel_to_uv) (struct omap_pmic *pmic, u8 vsel, u32 *uv); +	int (*uv_to_vsel) (struct omap_pmic *pmic, u32 uv, u8 *vsel); +}; + +/** + * struct omap_pmic_controller_ops - regulator operations implemented + * @devm_pmic_register: managed registration of an PMIC device with a specific + *			voltage processor. Voltage processor provides an device + *			handle which is remaining operations. + *			NOTE: + *			- This will be first interface to be invoked by + *			omap_pmic regulator. + *			- if the underlying layers are not ready, this is + *			expected to return -EPROBE_DEFER + *			- if failure, appropriate error code is expected. + *			- This is expected to be a managed device to avoid + *			explicit cleanup operations + *			- Once this succeeds, this returns the pointer to + *			the controller device and all other operations are + *			expected to be ready for functionality. + * @voltage_set:	set the voltage - expected to be synchronous. + * @voltage_get:	get the current voltage in micro-volts set on PMIC. + * @voltage_get_range:	Get minimum and maxium permissible operational voltage + *			range for the device - used to set initial regulator + *			constraints. + * + * These voltage processor interfaces are registered by voltage processor driver + * using omap_pmic_register_controller_ops. This allows the omap_pmic driver to + * operate with a specific voltage processor driver. + */ +struct omap_pmic_controller_ops { +	struct device *(*devm_pmic_register) (struct device *dev, +					      struct omap_pmic *pmic); +	int (*voltage_set) (struct device *control_dev, u32 uv); +	int (*voltage_get) (struct device *control_dev, u32 *uv); +	int (*voltage_get_range) (struct device *control_dev, u32 *min_uv, +				  u32 *max_uv); +}; + +/** + * struct omap_pmic_info - PMIC information + * + * @slave_addr:		7 bit address representing I2C slave address. + * @voltage_reg_addr:	I2C register address for setting voltage + * @cmd_reg_addr:	I2C register address for low power transition commands + * @i2c_timeout_us:	worst case latency for I2C operations for the device + * @slew_rate_uV:	Slew rate in uV/uSeconds for voltage transitions + * @step_size_uV:	Step size in uV for one vsel increment. + * @min_uV:		represents the minimum step_sized incremental voltage + * @max_uV:		represents the maximum step_sized incremental voltage + * @voltage_selector_setbits:  what bits to set permenantly for the PMIC + *			voltage selector - this may have PMIC specific meaning. + * @voltage_selector_mask: what mask to use for the vsel value - this is useful + *			for PMICs where the vsel has to be applied at an offset. + * @voltage_selector_offset: what offset to apply to conversion routine when + *			operating on vsel. + * @voltage_selector_zero: Special case handling if 0 value does NOT indicates + *			power-off for PMIC. + * @setup_command_list:	array of setup commands for PMIC to operate + * @setup_num_commands:	number of setup commands for PMIC to operate + */ +struct omap_pmic_info { +	u8 slave_addr; +	u8 voltage_reg_addr; +	u8 cmd_reg_addr; +	u32 i2c_timeout_us; + +	u32 slew_rate_uV; +	u32 step_size_uV; +	u32 min_uV; +	u32 max_uV; + +	u8 voltage_selector_offset; +	u8 voltage_selector_mask; +	u8 voltage_selector_setbits; +	bool voltage_selector_zero; + +	const struct omap_pmic_setup_commands *setup_command_list; +	u8 setup_num_commands; +}; + +/** + * struct omap_pmic - represents the OMAP PMIC device. + * @ops:		PMIC conversion operations. + * + * NOTE: the fields marked Private are meant for PMIC driver. + */ +struct omap_pmic { +	const struct omap_pmic_info *info; +	u32 boot_voltage_uV; + +	struct omap_pmic_ops *ops; + +	struct device *dev; +	struct device *v_dev; +}; + +#if IS_ENABLED(CONFIG_REGULATOR_TI_OMAP_PMIC) +int omap_pmic_register_controller_ops(struct omap_pmic_controller_ops *cops); +#else +static inline int omap_pmic_register_controller_ops(struct +						    omap_pmic_controller_ops +						    *cops) +{ +	return -EINVAL; +} +#endif + +#endif				/* __POWER_OMAP_PMIC_H */ diff --git a/include/linux/rfkill-wl18xx.h b/include/linux/rfkill-wl18xx.h new file mode 100644 index 00000000000..92123a88002 --- /dev/null +++ b/include/linux/rfkill-wl18xx.h @@ -0,0 +1,36 @@ +/* + * Bluetooth TI wl18xx rfkill power control via GPIO + * + * Copyright (C) 2014 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_WL18XX_RFKILL_H +#define _LINUX_WL18XX_RFKILL_H + +#include <linux/rfkill.h> + +/* Set bt_nshutdown_gpio or fm_enable_gpio to -1 to disable the corresponding + * rfkill driver */ +struct wl18xx_rfkill_platform_data { +	int bt_enable_gpio; +	int fm_enable_gpio; +}; + +#endif diff --git a/include/linux/sched.h b/include/linux/sched.h index 178a8d909f1..7ccfeb1e406 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1606,6 +1606,9 @@ static inline cputime_t task_gtime(struct task_struct *t)  extern void task_cputime_adjusted(struct task_struct *p, cputime_t *ut, cputime_t *st);  extern void thread_group_cputime_adjusted(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   */ diff --git a/include/linux/security.h b/include/linux/security.h index 4686491852a..17e1888ff50 100644 --- a/include/linux/security.h +++ b/include/linux/security.h @@ -1402,6 +1402,11 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)  struct security_operations {  	char name[SECURITY_NAME_MAX + 1]; +	int (*binder_set_context_mgr) (struct task_struct *mgr); +	int (*binder_transaction) (struct task_struct *from, struct task_struct *to); +	int (*binder_transfer_binder) (struct task_struct *from, struct task_struct *to); +	int (*binder_transfer_file) (struct task_struct *from, struct task_struct *to, struct file *file); +  	int (*ptrace_access_check) (struct task_struct *child, unsigned int mode);  	int (*ptrace_traceme) (struct task_struct *parent);  	int (*capget) (struct task_struct *target, @@ -1690,6 +1695,10 @@ extern void __init security_fixup_ops(struct security_operations *ops);  /* Security operations */ +int security_binder_set_context_mgr(struct task_struct *mgr); +int security_binder_transaction(struct task_struct *from, struct task_struct *to); +int security_binder_transfer_binder(struct task_struct *from, struct task_struct *to); +int security_binder_transfer_file(struct task_struct *from, struct task_struct *to, struct file *file);  int security_ptrace_access_check(struct task_struct *child, unsigned int mode);  int security_ptrace_traceme(struct task_struct *parent);  int security_capget(struct task_struct *target, @@ -1869,6 +1878,26 @@ static inline int security_init(void)  	return 0;  } +static inline int security_binder_set_context_mgr(struct task_struct *mgr) +{ +	return 0; +} + +static inline int security_binder_transaction(struct task_struct *from, struct task_struct *to) +{ +	return 0; +} + +static inline int security_binder_transfer_binder(struct task_struct *from, struct task_struct *to) +{ +	return 0; +} + +static inline int security_binder_transfer_file(struct task_struct *from, struct task_struct *to, struct file *file) +{ +	return 0; +} +  static inline int security_ptrace_access_check(struct task_struct *child,  					     unsigned int mode)  { diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 87d4bbc773f..8148bc7d0a8 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -31,6 +31,13 @@  #include <linux/sysrq.h>  #include <uapi/linux/serial_core.h> +#ifdef CONFIG_SERIAL_CORE_CONSOLE +#define uart_console(port) \ +	((port)->cons && (port)->cons->index == (port)->line) +#else +#define uart_console(port)      (0) +#endif +  struct uart_port;  struct serial_struct;  struct device; @@ -60,6 +67,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/spi/cpcap-regbits.h b/include/linux/spi/cpcap-regbits.h new file mode 100644 index 00000000000..bf3aa7e0d69 --- /dev/null +++ b/include/linux/spi/cpcap-regbits.h @@ -0,0 +1,957 @@ +#ifndef __CPCAP_REGBITS_H__ +#define __CPCAP_REGBITS_H__ + +/* + * Copyright (C) 2007-2009 Motorola, Inc. + * + * 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., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307, USA + */ + +/* + * Register 0 - CPCAP_REG_INT_0 bits + */ +#define CPCAP_BIT_ID_GROUND_I		0x00008000 +#define CPCAP_BIT_ID_FLOAT_I		0x00004000 +#define CPCAP_BIT_CHRG_DET_I		0x00002000 +#define CPCAP_BIT_RVRS_CHRG_I		0x00001000 +#define CPCAP_BIT_VBUSOV_I		0x00000800 +#define CPCAP_BIT_MB2_I			0x00000400 +#define CPCAP_BIT_HS_I			0x00000200 +#define CPCAP_BIT_ADCDONE_I		0x00000100 +#define CPCAP_BIT_TS_I			0x00000080 +#define CPCAP_BIT_EOL_I			0x00000040 +#define CPCAP_BIT_LOWBPH_I		0x00000020 +#define CPCAP_BIT_SEC2PRI_I		0x00000010 +#define CPCAP_BIT_LOWBPL_I		0x00000008 +#define CPCAP_BIT_UNUSED_0_2_I		0x00000004 +#define CPCAP_BIT_PRIMAC_I		0x00000002 +#define CPCAP_BIT_HSCLK_I		0x00000001 + +/* + * Register 1 - CPCAP_REG_INT_1 bits + */ +#define CPCAP_BIT_EXTMEMHD_I		0x00008000 +#define CPCAP_BIT_UART_ECHO_OVERRUN_I	0x00004000 +#define CPCAP_BIT_CHRG_SE1B_I		0x00002000 +#define CPCAP_BIT_SE0CONN_I		0x00001000 +#define CPCAP_BIT_PTT_I			0x00000800 +#define CPCAP_BIT_1HZ_I			0x00000400 +#define CPCAP_BIT_CLK_I			0x00000200 +#define CPCAP_BIT_ON2_I			0x00000100 +#define CPCAP_BIT_ON_I			0x00000080 +#define CPCAP_BIT_RVRS_MODE_I		0x00000040 +#define CPCAP_BIT_CHRGCURR2_I		0x00000020 +#define CPCAP_BIT_CHRGCURR1_I		0x00000010 +#define CPCAP_BIT_VBUSVLD_I		0x00000008 +#define CPCAP_BIT_SESSVLD_I		0x00000004 +#define CPCAP_BIT_SESSEND_I		0x00000002 +#define CPCAP_BIT_SE1_I			0x00000001 + +/* + * Register 2  CPCAP_REG_INT_2 -  bits + */ +#define CPCAP_BIT_USBDPLLCLK_I		0x00008000 +#define CPCAP_BIT_PWRGOOD_I		0x00004000 +#define CPCAP_BIT_UCRESET_I		0x00002000 +#define CPCAP_BIT_ONEWIRE3_I		0x00001000 +#define CPCAP_BIT_ONEWIRE2_I		0x00000800 +#define CPCAP_BIT_ONEWIRE1_I		0x00000400 +#define CPCAP_BIT_OPT_SEL_STATE_I	0x00000200 +#define CPCAP_BIT_OPT_SEL_DTCH_I	0x00000100 +#define CPCAP_BIT_TODA_I		0x00000080 +#define CPCAP_BIT_OFLOWSW_I		0x00000040 +#define CPCAP_BIT_PC_I			0x00000020 +#define CPCAP_BIT_DIETEMPH_I		0x00000010 +#define CPCAP_BIT_DIEPWRDWN_I		0x00000008 +#define CPCAP_BIT_SOFTRST_I		0x00000004 +#define CPCAP_BIT_SYSRSTRT_I		0x00000002 +#define CPCAP_BIT_WARM_I		0x00000001 + +/* + * Register 3 - CPCAP_REG_INT_3  bits + */ +#define CPCAP_BIT_UNUSED_3_15_I		0x00008000 +#define CPCAP_BIT_UNUSED_3_14_I		0x00004000 +#define CPCAP_BIT_SPARE_3_13_I		0x00002000 +#define CPCAP_BIT_SPARE_3_12_I		0x00001000 +#define CPCAP_BIT_SPARE_3_11_I		0x00000800 +#define CPCAP_BIT_SPARE_3_10_I		0x00000400 +#define CPCAP_BIT_CC_CAL_I		0x00000200 +#define CPCAP_BIT_SECHALT_I		0x00000100 +#define CPCAP_BIT_PRIHALT_I		0x00000080 +#define CPCAP_BIT_BATTDETB_I		0x00000040 +#define CPCAP_BIT_SB_MAX_RETX_ERR_I	0x00000020 +#define CPCAP_BIT_GCAI_CURR2_I		0x00000010 +#define CPCAP_BIT_GCAI_CURR1_I		0x00000008 +#define CPCAP_BIT_UCBUSY_I		0x00000004 +#define CPCAP_BIT_DM_I			0x00000002 +#define CPCAP_BIT_DP_I			0x00000001 + +/* + * Register 4 - CPCAP_REG_INTM1 bits + */ +#define CPCAP_BIT_ID_GROUND_M		0x00008000 +#define CPCAP_BIT_ID_FLOAT_M		0x00004000 +#define CPCAP_BIT_CHRG_DET_M		0x00002000 +#define CPCAP_BIT_RVRS_CHRG_M		0x00001000 +#define CPCAP_BIT_VBUSOV_M		0x00000800 +#define CPCAP_BIT_MB2_M			0x00000400 +#define CPCAP_BIT_HS_M			0x00000200 +#define CPCAP_BIT_ADCDONE_M		0x00000100 +#define CPCAP_BIT_TS_M			0x00000080 +#define CPCAP_BIT_EOL_M			0x00000040 +#define CPCAP_BIT_LOWBPH_M		0x00000020 +#define CPCAP_BIT_SEC2PRI_M		0x00000010 +#define CPCAP_BIT_LOWBPL_M		0x00000008 +#define CPCAP_BIT_UNUSED_4_2_M		0x00000004 +#define CPCAP_BIT_PRIMAC_M		0x00000002 +#define CPCAP_BIT_HSCLK_M		0x00000001 + +/* + * Register 5 - CPCAP_REG_INTM2 bits + */ +#define CPCAP_BIT_EXTMEMHD_M		0x00008000 +#define CPCAP_BIT_UART_ECHO_OVERRUN_M	0x00004000 +#define CPCAP_BIT_CHRG_SE1B_M		0x00002000 +#define CPCAP_BIT_SE0CONN_M		0x00001000 +#define CPCAP_BIT_PTT_M			0x00000800 +#define CPCAP_BIT_1HZ_M			0x00000400 +#define CPCAP_BIT_CLK_M			0x00000200 +#define CPCAP_BIT_ON2_M			0x00000100 +#define CPCAP_BIT_ON_M			0x00000080 +#define CPCAP_BIT_RVRS_MODE_M		0x00000040 +#define CPCAP_BIT_CHRGCURR2_M		0x00000020 +#define CPCAP_BIT_CHRGCURR1_M		0x00000010 +#define CPCAP_BIT_VBUSVLD_M		0x00000008 +#define CPCAP_BIT_SESSVLD_M		0x00000004 +#define CPCAP_BIT_SESSEND_M		0x00000002 +#define CPCAP_BIT_SE1_M			0x00000001 + +/* + * Register 6 - CPCAP_REG_INTM3 bits + */ +#define CPCAP_BIT_USBDPLLCLK_M		0x00008000 +#define CPCAP_BIT_PWRGOOD_M		0x00004000 +#define CPCAP_BIT_UCRESET_M		0x00002000 +#define CPCAP_BIT_ONEWIRE3_M		0x00001000 +#define CPCAP_BIT_ONEWIRE2_M		0x00000800 +#define CPCAP_BIT_ONEWIRE1_M		0x00000400 +#define CPCAP_BIT_OPT_SEL_STATE_M	0x00000200 +#define CPCAP_BIT_OPT_SEL_DTCH_M	0x00000100 +#define CPCAP_BIT_TODA_M		0x00000080 +#define CPCAP_BIT_OFLOWSW_M		0x00000040 +#define CPCAP_BIT_PC_M			0x00000020 +#define CPCAP_BIT_DIETEMPH_M		0x00000010 +#define CPCAP_BIT_DIEPWRDWN_M		0x00000008 +#define CPCAP_BIT_SOFTRST_M		0x00000004 +#define CPCAP_BIT_SYSRSTRT_M		0x00000002 +#define CPCAP_BIT_WARM_M		0x00000001 + +/* + * Register 7 - CPCAP_REG_INTM4 bits + */ +#define CPCAP_BIT_UNUSED_7_15_M		0x00008000 +#define CPCAP_BIT_UNUSED_7_14_M		0x00004000 +#define CPCAP_BIT_SPARE_7_13_M		0x00002000 +#define CPCAP_BIT_SPARE_7_12_M		0x00001000 +#define CPCAP_BIT_SPARE_7_11_M		0x00000800 +#define CPCAP_BIT_SPARE_7_10_M		0x00000400 +#define CPCAP_BIT_CC_CAL_M		0x00000200 +#define CPCAP_BIT_SECHALT_M		0x00000100 +#define CPCAP_BIT_PRIHALT_M		0x00000080 +#define CPCAP_BIT_BATTDETB_M		0x00000040 +#define CPCAP_BIT_SB_MAX_RETX_ERR_M	0x00000020 +#define CPCAP_BIT_GCAI_CURR2_M		0x00000010 +#define CPCAP_BIT_GCAI_CURR1_M		0x00000008 +#define CPCAP_BIT_UCBUSY_M		0x00000004 +#define CPCAP_BIT_DM_M			0x00000002 +#define CPCAP_BIT_DP_M			0x00000001 + +/* + * Register 8 - CPCAP_REG_INTS1 bits + */ +#define CPCAP_BIT_ID_GROUND_S		0x00008000 +#define CPCAP_BIT_ID_FLOAT_S		0x00004000 +#define CPCAP_BIT_CHRG_DET_S		0x00002000 +#define CPCAP_BIT_RVRS_CHRG_S		0x00001000 +#define CPCAP_BIT_VBUSOV_S		0x00000800 +#define CPCAP_BIT_MB2_S			0x00000400 +#define CPCAP_BIT_HS_S			0x00000200 +#define CPCAP_BIT_ADCDONE_S		0x00000100 +#define CPCAP_BIT_TS_S			0x00000080 +#define CPCAP_BIT_EOL_S			0x00000040 +#define CPCAP_BIT_LOWBPH_S		0x00000020 +#define CPCAP_BIT_SEC2PRI_S		0x00000010 +#define CPCAP_BIT_LOWBPL_S		0x00000008 +#define CPCAP_BIT_UNUSED_8_2_S		0x00000004 +#define CPCAP_BIT_PRIMAC_S		0x00000002 +#define CPCAP_BIT_HSCLK_S		0x00000001 + +/* + * Register 9 - CPCAP_REG_INTS2 bits + */ +#define CPCAP_BIT_EXTMEMHD_S		0x00008000 +#define CPCAP_BIT_UART_ECHO_OVERRUN_S	0x00004000 +#define CPCAP_BIT_CHRG_SE1B_S		0x00002000 +#define CPCAP_BIT_SE0CONN_S		0x00001000 +#define CPCAP_BIT_PTT_S			0x00000800 +#define CPCAP_BIT_1HZ_S			0x00000400 +#define CPCAP_BIT_CLK_S			0x00000200 +#define CPCAP_BIT_ON2_S			0x00000100 +#define CPCAP_BIT_ON_S			0x00000080 +#define CPCAP_BIT_RVRS_MODE_S		0x00000040 +#define CPCAP_BIT_CHRGCURR2_S		0x00000020 +#define CPCAP_BIT_CHRGCURR1_S		0x00000010 +#define CPCAP_BIT_VBUSVLD_S		0x00000008 +#define CPCAP_BIT_SESSVLD_S		0x00000004 +#define CPCAP_BIT_SESSEND_S		0x00000002 +#define CPCAP_BIT_SE1_S			0x00000001 + +/* + * Register 10 - CPCAP_REG_INTS3 bits + */ +#define CPCAP_BIT_USBDPLLCLK_S		0x00008000 +#define CPCAP_BIT_PWRGOOD_S		0x00004000 +#define CPCAP_BIT_UCRESET_S		0x00002000 +#define CPCAP_BIT_ONEWIRE3_S		0x00001000 +#define CPCAP_BIT_ONEWIRE2_S		0x00000800 +#define CPCAP_BIT_ONEWIRE1_S		0x00000400 +#define CPCAP_BIT_OPT_SEL_STATE_S	0x00000200 +#define CPCAP_BIT_OPT_SEL_DTCH_S	0x00000100 +#define CPCAP_BIT_TODA_S		0x00000080 +#define CPCAP_BIT_OFLOWSW_S		0x00000040 +#define CPCAP_BIT_PC_S			0x00000020 +#define CPCAP_BIT_DIETEMPH_S		0x00000010 +#define CPCAP_BIT_DIEPWRDWN_S		0x00000008 +#define CPCAP_BIT_SOFTRST_S		0x00000004 +#define CPCAP_BIT_SYSRSTRT_S		0x00000002 +#define CPCAP_BIT_WARM_S		0x00000001 + +/* + * Register 11 - CPCAP_REG_INTS4 bits + */ +#define CPCAP_BIT_UNUSED_11_15_S	0x00008000 +#define CPCAP_BIT_UNUSED_11_14_S	0x00004000 +#define CPCAP_BIT_SPARE_11_13_S		0x00002000 +#define CPCAP_BIT_SPARE_11_12_S		0x00001000 +#define CPCAP_BIT_SPARE_11_11_S		0x00000800 +#define CPCAP_BIT_SPARE_11_10_S		0x00000400 +#define CPCAP_BIT_CC_CAL_S		0x00000200 +#define CPCAP_BIT_SECHALT_S		0x00000100 +#define CPCAP_BIT_PRIHALT_S		0x00000080 +#define CPCAP_BIT_BATTDETB_S		0x00000040 +#define CPCAP_BIT_SB_MAX_RETX_ERR_S	0x00000020 +#define CPCAP_BIT_GCAI_CURR2_S		0x00000010 +#define CPCAP_BIT_GCAI_CURR1_S		0x00000008 +#define CPCAP_BIT_UCBUSY_S		0x00000004 +#define CPCAP_BIT_DM_S			0x00000002 +#define CPCAP_BIT_DP_S			0x00000001 + +/* + * Register 128 - CPCAP_REG_MI1 bits + */ +#define CPCAP_BIT_PRIMACRO_15_S		0x00008000 +#define CPCAP_BIT_PRIMACRO_14_S		0x00004000 +#define CPCAP_BIT_PRIMACRO_13_S		0x00002000 +#define CPCAP_BIT_PRIMACRO_12_S		0x00001000 +#define CPCAP_BIT_PRIMACRO_11_S		0x00000800 +#define CPCAP_BIT_PRIMACRO_10_S		0x00000400 +#define CPCAP_BIT_PRIMACRO_9_S		0x00000200 +#define CPCAP_BIT_PRIMACRO_8_S		0x00000100 +#define CPCAP_BIT_PRIMACRO_7_S		0x00000080 +#define CPCAP_BIT_PRIMACRO_6_S		0x00000040 +#define CPCAP_BIT_PRIMACRO_5_S		0x00000020 +#define CPCAP_BIT_PRIMACRO_4_S		0x00000010 +#define CPCAP_BIT_USEROFF_S		0x00000008 +#define CPCAP_BIT_PRIRAMR_S		0x00000004 +#define CPCAP_BIT_PRIRAMW_S		0x00000002 +#define CPCAP_BIT_PRIROMR_S		0x00000001 + +/* + * Register 129 - CPCAP_REG_MIM1 bits + */ +#define CPCAP_BIT_PRIMACRO_15M		0x00008000 +#define CPCAP_BIT_PRIMACRO_14M		0x00004000 +#define CPCAP_BIT_PRIMACRO_13M		0x00002000 +#define CPCAP_BIT_PRIMACRO_12M		0x00001000 +#define CPCAP_BIT_PRIMACRO_11M		0x00000800 +#define CPCAP_BIT_PRIMACRO_10M		0x00000400 +#define CPCAP_BIT_PRIMACRO_9M		0x00000200 +#define CPCAP_BIT_PRIMACRO_8M		0x00000100 +#define CPCAP_BIT_PRIMACRO_7M		0x00000080 +#define CPCAP_BIT_PRIMACRO_6M		0x00000040 +#define CPCAP_BIT_PRIMACRO_5M		0x00000020 +#define CPCAP_BIT_PRIMACRO_4M		0x00000010 +#define CPCAP_BIT_USEROFFM		0x00000008 +#define CPCAP_BIT_PRIRAMRM		0x00000004 +#define CPCAP_BIT_PRIRAMWM		0x00000002 +#define CPCAP_BIT_PRIROMRM		0x00000001 + +/* + * Register 130 - CPCAP_REG_MI2 bits + */ +#define CPCAP_BIT_PRIMACRO_15		0x00008000 +#define CPCAP_BIT_PRIMACRO_14		0x00004000 +#define CPCAP_BIT_PRIMACRO_13		0x00002000 +#define CPCAP_BIT_PRIMACRO_12		0x00001000 +#define CPCAP_BIT_PRIMACRO_11		0x00000800 +#define CPCAP_BIT_PRIMACRO_10		0x00000400 +#define CPCAP_BIT_PRIMACRO_9		0x00000200 +#define CPCAP_BIT_PRIMACRO_8		0x00000100 +#define CPCAP_BIT_PRIMACRO_7		0x00000080 +#define CPCAP_BIT_PRIMACRO_6		0x00000040 +#define CPCAP_BIT_PRIMACRO_5		0x00000020 +#define CPCAP_BIT_PRIMACRO_4		0x00000010 +#define CPCAP_BIT_USEROFF		0x00000008 +#define CPCAP_BIT_PRIRAMR		0x00000004 +#define CPCAP_BIT_PRIRAMW		0x00000002 +#define CPCAP_BIT_PRIROMR		0x00000001 + +/* + * Register 131 - CPCAP_REG_MIM2 bits + */ +#define CPCAP_BIT_PRIMACRO_15S		0x00008000 +#define CPCAP_BIT_PRIMACRO_14S		0x00004000 +#define CPCAP_BIT_PRIMACRO_13S		0x00002000 +#define CPCAP_BIT_PRIMACRO_12S		0x00001000 +#define CPCAP_BIT_PRIMACRO_11S		0x00000800 +#define CPCAP_BIT_PRIMACRO_10S		0x00000400 +#define CPCAP_BIT_PRIMACRO_9S		0x00000200 +#define CPCAP_BIT_PRIMACRO_8S		0x00000100 +#define CPCAP_BIT_PRIMACRO_7S		0x00000080 +#define CPCAP_BIT_PRIMACRO_6S		0x00000040 +#define CPCAP_BIT_PRIMACRO_5S		0x00000020 +#define CPCAP_BIT_PRIMACRO_4S		0x00000010 +#define CPCAP_BIT_USEROFFS		0x00000008 +#define CPCAP_BIT_PRIRAMRS		0x00000004 +#define CPCAP_BIT_PRIRAMWS		0x00000002 +#define CPCAP_BIT_PRIROMRS		0x00000001 + +/* + * Register 132 - CPCAP_REG_UCC1 bits + */ +#define CPCAP_BIT_UNUSED_132_15		0x00008000 +#define CPCAP_BIT_UNUSED_132_14		0x00004000 +#define CPCAP_BIT_UNUSED_132_13		0x00002000 +#define CPCAP_BIT_UNUSED_132_12		0x00001000 +#define CPCAP_BIT_PRI_GPIO6_2MAC10	0x00000800 +#define CPCAP_BIT_PRI_GPIO5_2MAC9	0x00000400 +#define CPCAP_BIT_PRI_GPIO4_2MAC8	0x00000200 +#define CPCAP_BIT_PRI_GPIO3_2MAC7	0x00000100 +#define CPCAP_BIT_PRI_GPIO2_2MAC6	0x00000080 +#define CPCAP_BIT_PRI_GPIO1_2MAC5	0x00000040 +#define CPCAP_BIT_PRI_GPIO0_2MAC4	0x00000020 +#define CPCAP_BIT_USEROFFCLK		0x00000010 +#define CPCAP_BIT_UO_MH_PFM_EN		0x00000008 +#define CPCAP_BIT_CNTRLSEC		0x00000004 +#define CPCAP_BIT_SCHDOVERRIDE		0x00000002 +#define CPCAP_BIT_PRIHALT		0x00000001 + +/* + * Register 135 - CPCAP_REG_PC1 bits + */ +#define CPCAP_BIT_UNUSED_135_15		0x00008000 +#define CPCAP_BIT_UNUSED_135_14		0x00004000 +#define CPCAP_BIT_UNUSED_135_13		0x00002000 +#define CPCAP_BIT_UNUSED_135_12		0x00001000 +#define CPCAP_BIT_UNUSED_135_11		0x00000800 +#define CPCAP_BIT_UNUSED_135_10		0x00000400 +#define CPCAP_BIT_PC1_SC_SHTDWN_EN	0x00000200 +#define CPCAP_BIT_PC1_PCEN		0x00000100 +#define CPCAP_BIT_PC1_PCT7		0x00000080 +#define CPCAP_BIT_PC1_PCT6		0x00000040 +#define CPCAP_BIT_PC1_PCT5		0x00000020 +#define CPCAP_BIT_PC1_PCT4		0x00000010 +#define CPCAP_BIT_PC1_PCT3		0x00000008 +#define CPCAP_BIT_PC1_PCT2		0x00000004 +#define CPCAP_BIT_PC1_PCT1		0x00000002 +#define CPCAP_BIT_PC1_PCT0		0x00000001 + +/* + * Register 138 - CPCAP_REG_PGC bits + */ +#define CPCAP_BIT_UNUSED_138_15		0x00008000 +#define CPCAP_BIT_UNUSED_138_14		0x00004000 +#define CPCAP_BIT_UNUSED_138_13		0x00002000 +#define CPCAP_BIT_UNUSED_138_12		0x00001000 +#define CPCAP_BIT_UNUSED_138_11		0x00000800 +#define CPCAP_BIT_UNUSED_138_10		0x00000400 +#define CPCAP_BIT_UNUSED_138_9		0x00000200 +#define CPCAP_BIT_REVENINV		0x00000100 +#define CPCAP_BIT_PRISTBYINV		0x00000080 +#define CPCAP_BIT_SYS_RST_MODE		0x00000040 +#define CPCAP_BIT_MAC_TIME_LONG		0x00000020 +#define CPCAP_BIT_PRI_UC_SUSPEND	0x00000010 +#define CPCAP_BIT_PRIWARMSTART		0x00000008 +#define CPCAP_BIT_PRIPRESVRAM		0x00000004 +#define CPCAP_BIT_SPI_PWRGT1EN		0x00000002 +#define CPCAP_BIT_SPI_PWRGT2EN		0x00000001 + +/* + * Register 259 - CPCAP_REG_UCTM bits */ +#define CPCAP_BIT_UNUSED_259_15     0x00008000 +#define CPCAP_BIT_UNUSED_259_14     0x00004000 +#define CPCAP_BIT_UNUSED_259_13     0x00002000 +#define CPCAP_BIT_UNUSED_259_12     0x00001000 +#define CPCAP_BIT_UNUSED_259_11     0x00000800 +#define CPCAP_BIT_UNUSED_259_10     0x00000400 +#define CPCAP_BIT_UNUSED_259_9      0x00000200 +#define CPCAP_BIT_UNUSED_259_8      0x00000100 +#define CPCAP_BIT_UNUSED_259_7      0x00000080 +#define CPCAP_BIT_UNUSED_259_6      0x00000040 +#define CPCAP_BIT_UNUSED_259_5      0x00000020 +#define CPCAP_BIT_UNUSED_259_4      0x00000010 +#define CPCAP_BIT_UNUSED_259_3      0x00000008 +#define CPCAP_BIT_UNUSED_259_2      0x00000004 +#define CPCAP_BIT_UNUSED_259_1      0x00000002 +#define CPCAP_BIT_UCTM              0x00000001 + +/* + * Register 266 - CPCAP_REG_VAL1 bits + */ +#define CPCAP_BIT_INVM_MC_MODE		0x00008000 +#define CPCAP_BIT_NVFLASH_MODE		0x00004000 +#define CPCAP_BIT_RECOVERY_MODE		0x00002000 +#define CPCAP_BIT_FASTBOOT_MODE		0x00001000 +#define CPCAP_BIT_BOOT_MODE		0x00000800 +#define CPCAP_BIT_BP2_ONLY_FLASH	0x00000400 +#define CPCAP_BIT_OUT_CHARGE_ONLY	0x00000200 +#define CPCAP_BIT_USB_BATT_RECOVERY	0x00000100 +#define CPCAP_BIT_PANIC			0x00000080 +#define CPCAP_BIT_BP_ONLY_FLASH		0x00000040 +#define CPCAP_BIT_WATCHDOG_RESET	0x00000020 +#define CPCAP_BIT_SOFT_RESET		0x00000010 +#define CPCAP_BIT_FLASH_FAIL		0x00000008 +#define CPCAP_BIT_FOTA_MODE		0x00000004 +#define CPCAP_BIT_AP_KERNEL_PANIC	0x00000002 +#define CPCAP_BIT_FLASH_MODE		0x00000001 + +/* + * Register 385 - CPCAP_REG_SI2CC1 + */ +#define CPCAP_BIT_CLK3M2_GATE_OVERRIDE	0x00000080 + +/* + * Register 391 - CPCAP_REG_S3C + */ +#define CPCAP_BIT_SW3STBY		0x00000100 + +/* + * Register 411 - CPCAP_REG_VUSB bits + */ +#define CPCAP_BIT_UNUSED_411_15		0x00008000 +#define CPCAP_BIT_UNUSED_411_14		0x00004000 +#define CPCAP_BIT_UNUSED_411_13		0x00002000 +#define CPCAP_BIT_UNUSED_411_12		0x00001000 +#define CPCAP_BIT_UNUSED_411_11		0x00000800 +#define CPCAP_BIT_UNUSED_411_10		0x00000400 +#define CPCAP_BIT_UNUSED_411_9		0x00000200 +#define CPCAP_BIT_VUSBSTBY		0x00000100 +#define CPCAP_BIT_UNUSED_411_7		0x00000080 +#define CPCAP_BIT_VUSB			0x00000040 +#define CPCAP_BIT_UNUSED_411_5		0x00000020 +#define CPCAP_BIT_VUSB_MODE2		0x00000010 +#define CPCAP_BIT_VUSB_MODE1		0x00000008 +#define CPCAP_BIT_VUSB_MODE0		0x00000004 +#define CPCAP_BIT_SPARE_411_1		0x00000002 +#define CPCAP_BIT_VBUS_SWITCH		0x00000001 +/* + * Register 512 - Audio Regulator and Bias Voltage + */ + +#define CPCAP_BIT_AUDIO_LOW_PWR           0x00000040 +#define CPCAP_BIT_AUD_LOWPWR_SPEED        0x00000020 +#define CPCAP_BIT_VAUDIOPRISTBY           0x00000010 +#define CPCAP_BIT_VAUDIO_MODE1            0x00000004 +#define CPCAP_BIT_VAUDIO_MODE0            0x00000002 +#define CPCAP_BIT_V_AUDIO_EN              0x00000001 + +/* + * Register 513 CODEC + */ + +#define CPCAP_BIT_CDC_CLK2                0x00008000 +#define CPCAP_BIT_CDC_CLK1                0x00004000 +#define CPCAP_BIT_CDC_CLK0                0x00002000 +#define CPCAP_BIT_CDC_SR3                 0x00001000 +#define CPCAP_BIT_CDC_SR2                 0x00000800 +#define CPCAP_BIT_CDC_SR1                 0x00000400 +#define CPCAP_BIT_CDC_SR0                 0x00000200 +#define CPCAP_BIT_CDC_CLOCK_TREE_RESET    0x00000100 +#define CPCAP_BIT_MIC2_CDC_EN             0x00000080 +#define CPCAP_BIT_CDC_EN_RX               0x00000040 +#define CPCAP_BIT_DF_RESET                0x00000020 +#define CPCAP_BIT_MIC1_CDC_EN             0x00000010 +#define CPCAP_BIT_AUDOHPF_1		  0x00000008 +#define CPCAP_BIT_AUDOHPF_0		  0x00000004 +#define CPCAP_BIT_AUDIHPF_1		  0x00000002 +#define CPCAP_BIT_AUDIHPF_0		  0x00000001 + +/* + * Register 514 CODEC Digital Audio Interface + */ + +#define CPCAP_BIT_CDC_PLL_SEL             0x00008000 +#define CPCAP_BIT_CLK_IN_SEL              0x00002000 +#define CPCAP_BIT_DIG_AUD_IN              0x00001000 +#define CPCAP_BIT_CDC_CLK_EN              0x00000800 +#define CPCAP_BIT_CDC_DIG_AUD_FS1         0x00000400 +#define CPCAP_BIT_CDC_DIG_AUD_FS0         0x00000200 +#define CPCAP_BIT_MIC2_TIMESLOT2          0x00000100 +#define CPCAP_BIT_MIC2_TIMESLOT1          0x00000080 +#define CPCAP_BIT_MIC2_TIMESLOT0          0x00000040 +#define CPCAP_BIT_MIC1_RX_TIMESLOT2       0x00000020 +#define CPCAP_BIT_MIC1_RX_TIMESLOT1       0x00000010 +#define CPCAP_BIT_MIC1_RX_TIMESLOT0       0x00000008 +#define CPCAP_BIT_FS_INV                  0x00000004 +#define CPCAP_BIT_CLK_INV                 0x00000002 +#define CPCAP_BIT_SMB_CDC                 0x00000001 + +/* + * Register 515 Stereo DAC + */ + +#define CPCAP_BIT_FSYNC_CLK_IN_COMMON     0x00000800 +#define CPCAP_BIT_SLAVE_PLL_CLK_INPUT     0x00000400 +#define CPCAP_BIT_ST_CLOCK_TREE_RESET     0x00000200 +#define CPCAP_BIT_DF_RESET_ST_DAC         0x00000100 +#define CPCAP_BIT_ST_SR3                  0x00000080 +#define CPCAP_BIT_ST_SR2                  0x00000040 +#define CPCAP_BIT_ST_SR1                  0x00000020 +#define CPCAP_BIT_ST_SR0                  0x00000010 +#define CPCAP_BIT_ST_DAC_CLK2             0x00000008 +#define CPCAP_BIT_ST_DAC_CLK1             0x00000004 +#define CPCAP_BIT_ST_DAC_CLK0             0x00000002 +#define CPCAP_BIT_ST_DAC_EN               0x00000001 + +/* + * Register 516 Stereo DAC Digital Audio Interface + */ + +#define CPCAP_BIT_ST_L_TIMESLOT2          0x00002000 +#define CPCAP_BIT_ST_L_TIMESLOT1          0x00001000 +#define CPCAP_BIT_ST_L_TIMESLOT0          0x00000800 +#define CPCAP_BIT_ST_R_TIMESLOT2          0x00000400 +#define CPCAP_BIT_ST_R_TIMESLOT1          0x00000200 +#define CPCAP_BIT_ST_R_TIMESLOT0          0x00000100 +#define CPCAP_BIT_ST_DAC_CLK_IN_SEL       0x00000080 +#define CPCAP_BIT_ST_FS_INV               0x00000040 +#define CPCAP_BIT_ST_CLK_INV              0x00000020 +#define CPCAP_BIT_ST_DIG_AUD_FS1          0x00000010 +#define CPCAP_BIT_ST_DIG_AUD_FS0          0x00000008 +#define CPCAP_BIT_DIG_AUD_IN_ST_DAC       0x00000004 +#define CPCAP_BIT_ST_CLK_EN               0x00000002 +#define CPCAP_BIT_SMB_ST_DAC              0x00000001 + +/* + * Register 517 - CPCAP_REG_TXI bits + */ +#define CPCAP_BIT_PTT_TH		0x00008000 +#define CPCAP_BIT_PTT_CMP_EN		0x00004000 +#define CPCAP_BIT_HS_ID_TX		0x00002000 +#define CPCAP_BIT_MB_ON2		0x00001000 +#define CPCAP_BIT_MB_ON1L		0x00000800 +#define CPCAP_BIT_MB_ON1R		0x00000400 +#define CPCAP_BIT_RX_L_ENCODE		0x00000200 +#define CPCAP_BIT_RX_R_ENCODE		0x00000100 +#define CPCAP_BIT_MIC2_MUX		0x00000080 +#define CPCAP_BIT_MIC2_PGA_EN		0x00000040 +#define CPCAP_BIT_CDET_DIS		0x00000020 +#define CPCAP_BIT_EMU_MIC_MUX		0x00000010 +#define CPCAP_BIT_HS_MIC_MUX		0x00000008 +#define CPCAP_BIT_MIC1_MUX		0x00000004 +#define CPCAP_BIT_MIC1_PGA_EN		0x00000002 +#define CPCAP_BIT_DLM			0x00000001 + +/* + * Register 518 MIC PGA's + */ +#define CPCAP_BIT_MB_BIAS_R1              0x00000800 +#define CPCAP_BIT_MB_BIAS_R0              0x00000400 +#define CPCAP_BIT_MIC2_GAIN_4             0x00000200 +#define CPCAP_BIT_MIC2_GAIN_3             0x00000100 +#define CPCAP_BIT_MIC2_GAIN_2             0x00000080 +#define CPCAP_BIT_MIC2_GAIN_1             0x00000040 +#define CPCAP_BIT_MIC2_GAIN_0             0x00000020 +#define CPCAP_BIT_MIC1_GAIN_4             0x00000010 +#define CPCAP_BIT_MIC1_GAIN_3             0x00000008 +#define CPCAP_BIT_MIC1_GAIN_2             0x00000004 +#define CPCAP_BIT_MIC1_GAIN_1             0x00000002 +#define CPCAP_BIT_MIC1_GAIN_0             0x00000001 + +/* + * Register 519 - CPCAP_REG_RXOA bits + */ +#define CPCAP_BIT_UNUSED_519_15		0x00008000 +#define CPCAP_BIT_UNUSED_519_14		0x00004000 +#define CPCAP_BIT_UNUSED_519_13		0x00002000 +#define CPCAP_BIT_STDAC_LOW_PWR_DISABLE	0x00001000 +#define CPCAP_BIT_HS_LOW_PWR		0x00000800 +#define CPCAP_BIT_HS_ID_RX		0x00000400 +#define CPCAP_BIT_ST_HS_CP_EN		0x00000200 +#define CPCAP_BIT_EMU_SPKR_R_EN		0x00000100 +#define CPCAP_BIT_EMU_SPKR_L_EN		0x00000080 +#define CPCAP_BIT_HS_L_EN		0x00000040 +#define CPCAP_BIT_HS_R_EN		0x00000020 +#define CPCAP_BIT_A4_LINEOUT_L_EN	0x00000010 +#define CPCAP_BIT_A4_LINEOUT_R_EN	0x00000008 +#define CPCAP_BIT_A2_LDSP_L_EN		0x00000004 +#define CPCAP_BIT_A2_LDSP_R_EN		0x00000002 +#define CPCAP_BIT_A1_EAR_EN		0x00000001 + +/* + * Register 520 RX Volume Control + */ +#define CPCAP_BIT_VOL_EXT3                0x00008000 +#define CPCAP_BIT_VOL_EXT2                0x00004000 +#define CPCAP_BIT_VOL_EXT1                0x00002000 +#define CPCAP_BIT_VOL_EXT0                0x00001000 +#define CPCAP_BIT_VOL_DAC3                0x00000800 +#define CPCAP_BIT_VOL_DAC2                0x00000400 +#define CPCAP_BIT_VOL_DAC1                0x00000200 +#define CPCAP_BIT_VOL_DAC0                0x00000100 +#define CPCAP_BIT_VOL_DAC_LSB_1dB1        0x00000080 +#define CPCAP_BIT_VOL_DAC_LSB_1dB0        0x00000040 +#define CPCAP_BIT_VOL_CDC3                0x00000020 +#define CPCAP_BIT_VOL_CDC2                0x00000010 +#define CPCAP_BIT_VOL_CDC1                0x00000008 +#define CPCAP_BIT_VOL_CDC0                0x00000004 +#define CPCAP_BIT_VOL_CDC_LSB_1dB1        0x00000002 +#define CPCAP_BIT_VOL_CDC_LSB_1dB0        0x00000001 + +/* + * Register 521 Codec to Output Amp Switches + */ +#define CPCAP_BIT_PGA_CDC_EN              0x00000400 +#define CPCAP_BIT_CDC_SW                  0x00000200 +#define CPCAP_BIT_PGA_OUTR_USBDP_CDC_SW   0x00000100 +#define CPCAP_BIT_PGA_OUTL_USBDN_CDC_SW   0x00000080 +#define CPCAP_BIT_ALEFT_HS_CDC_SW         0x00000040 +#define CPCAP_BIT_ARIGHT_HS_CDC_SW        0x00000020 +#define CPCAP_BIT_A4_LINEOUT_L_CDC_SW     0x00000010 +#define CPCAP_BIT_A4_LINEOUT_R_CDC_SW     0x00000008 +#define CPCAP_BIT_A2_LDSP_L_CDC_SW        0x00000004 +#define CPCAP_BIT_A2_LDSP_R_CDC_SW        0x00000002 +#define CPCAP_BIT_A1_EAR_CDC_SW           0x00000001 + +/* + * Register 522 RX Stereo DAC to Output Amp Switches + */ +#define CPCAP_BIT_PGA_DAC_EN              0x00001000 +#define CPCAP_BIT_ST_DAC_SW               0x00000800 +#define CPCAP_BIT_MONO_DAC1               0x00000400 +#define CPCAP_BIT_MONO_DAC0               0x00000200 +#define CPCAP_BIT_PGA_OUTR_USBDP_DAC_SW   0x00000100 +#define CPCAP_BIT_PGA_OUTL_USBDN_DAC_SW   0x00000080 +#define CPCAP_BIT_ALEFT_HS_DAC_SW         0x00000040 +#define CPCAP_BIT_ARIGHT_HS_DAC_SW        0x00000020 +#define CPCAP_BIT_A4_LINEOUT_L_DAC_SW     0x00000010 +#define CPCAP_BIT_A4_LINEOUT_R_DAC_SW     0x00000008 +#define CPCAP_BIT_A2_LDSP_L_DAC_SW        0x00000004 +#define CPCAP_BIT_A2_LDSP_R_DAC_SW        0x00000002 +#define CPCAP_BIT_A1_EAR_DAC_SW           0x00000001 + +/* + * Register 523 RX External PGA to Output Amp Switches + */ +#define CPCAP_BIT_PGA_EXT_L_EN            0x00004000 +#define CPCAP_BIT_PGA_EXT_R_EN            0x00002000 +#define CPCAP_BIT_PGA_IN_L_SW             0x00001000 +#define CPCAP_BIT_PGA_IN_R_SW             0x00000800 +#define CPCAP_BIT_MONO_EXT1               0x00000400 +#define CPCAP_BIT_MONO_EXT0               0x00000200 +#define CPCAP_BIT_PGA_OUTR_USBDP_EXT_SW   0x00000100 +#define CPCAP_BIT_PGA_OUTL_USBDN_EXT_SW   0x00000080 +#define CPCAP_BIT_ALEFT_HS_EXT_SW         0x00000040 +#define CPCAP_BIT_ARIGHT_HS_EXT_SW        0x00000020 +#define CPCAP_BIT_A4_LINEOUT_L_EXT_SW     0x00000010 +#define CPCAP_BIT_A4_LINEOUT_R_EXT_SW     0x00000008 +#define CPCAP_BIT_A2_LDSP_L_EXT_SW        0x00000004 +#define CPCAP_BIT_A2_LDSP_R_EXT_SW        0x00000002 +#define CPCAP_BIT_A1_EAR_EXT_SW           0x00000001 + +/* + * Register 525 Loudspeaker Amplifier and Clock Configuration for Headset + */ +#define CPCAP_BIT_NCP_CLK_SYNC            0x00000080 +#define CPCAP_BIT_A2_CLK_SYNC             0x00000040 +#define CPCAP_BIT_A2_FREE_RUN             0x00000020 +#define CPCAP_BIT_A2_CLK2                 0x00000010 +#define CPCAP_BIT_A2_CLK1                 0x00000008 +#define CPCAP_BIT_A2_CLK0                 0x00000004 +#define CPCAP_BIT_A2_CLK_IN               0x00000002 +#define CPCAP_BIT_A2_CONFIG               0x00000001 + +/* + * Register 641 - CPCAP_REG_CHRGR_1 bits + */ +#define CPCAP_BIT_UNUSED_641_15		0x00008000 +#define CPCAP_BIT_UNUSED_641_14		0x00004000 +#define CPCAP_BIT_CHRG_LED_EN		0x00002000 +#define CPCAP_BIT_RVRSMODE		0x00001000 +#define CPCAP_BIT_ICHRG_TR1		0x00000800 +#define CPCAP_BIT_ICHRG_TR0		0x00000400 +#define CPCAP_BIT_FET_OVRD		0x00000200 +#define CPCAP_BIT_FET_CTRL		0x00000100 +#define CPCAP_BIT_VCHRG3		0x00000080 +#define CPCAP_BIT_VCHRG2		0x00000040 +#define CPCAP_BIT_VCHRG1		0x00000020 +#define CPCAP_BIT_VCHRG0		0x00000010 +#define CPCAP_BIT_ICHRG3		0x00000008 +#define CPCAP_BIT_ICHRG2		0x00000004 +#define CPCAP_BIT_ICHRG1		0x00000002 +#define CPCAP_BIT_ICHRG0		0x00000001 + +/* + * Register 768 - CPCAP_REG_ADCC1 bits + */ +#define CPCAP_BIT_ADEN_AUTO_CLR		0x00008000 +#define CPCAP_BIT_CAL_MODE		0x00004000 +#define CPCAP_BIT_ADC_CLK_SEL1		0x00002000 +#define CPCAP_BIT_ADC_CLK_SEL0		0x00001000 +#define CPCAP_BIT_ATOX         	        0x00000800 +#define CPCAP_BIT_ATO3		        0x00000400 +#define CPCAP_BIT_ATO2		        0x00000200 +#define CPCAP_BIT_ATO1		        0x00000100 +#define CPCAP_BIT_ATO0		        0x00000080 +#define CPCAP_BIT_ADA2		        0x00000040 +#define CPCAP_BIT_ADA1		        0x00000020 +#define CPCAP_BIT_ADA0		        0x00000010 +#define CPCAP_BIT_AD_SEL1		0x00000008 +#define CPCAP_BIT_RAND1		        0x00000004 +#define CPCAP_BIT_RAND0		        0x00000002 +#define CPCAP_BIT_ADEN        		0x00000001 + +/* + * Register 769 - CPCAP_REG_ADCC2 bits + */ +#define CPCAP_BIT_CAL_FACTOR_ENABLE	0x00008000 +#define CPCAP_BIT_BATDETB_EN		0x00004000 +#define CPCAP_BIT_ADTRIG_ONESHOT	0x00002000 +#define CPCAP_BIT_ASC       		0x00001000 +#define CPCAP_BIT_ATOX_PS_FACTOR        0x00000800 +#define CPCAP_BIT_ADC_PS_FACTOR1        0x00000400 +#define CPCAP_BIT_ADC_PS_FACTOR0        0x00000200 +#define CPCAP_BIT_AD4_SELECT	        0x00000100 +#define CPCAP_BIT_ADC_BUSY	        0x00000080 +#define CPCAP_BIT_THERMBIAS_EN	        0x00000040 +#define CPCAP_BIT_ADTRIG_DIS	        0x00000020 +#define CPCAP_BIT_LIADC		        0x00000010 +#define CPCAP_BIT_TS_REFEN		0x00000008 +#define CPCAP_BIT_TS_M2		        0x00000004 +#define CPCAP_BIT_TS_M1		        0x00000002 +#define CPCAP_BIT_TS_M0        		0x00000001 + +/* + * Register 896 - CPCAP_REG_USBC1 bits + */ +#define CPCAP_BIT_IDPULSE		0x00008000 +#define CPCAP_BIT_ID100KPU		0x00004000 +#define CPCAP_BIT_IDPUCNTRL		0x00002000 +#define CPCAP_BIT_IDPU			0x00001000 +#define CPCAP_BIT_IDPD			0x00000800 +#define CPCAP_BIT_VBUSCHRGTMR3		0x00000400 +#define CPCAP_BIT_VBUSCHRGTMR2		0x00000200 +#define CPCAP_BIT_VBUSCHRGTMR1		0x00000100 +#define CPCAP_BIT_VBUSCHRGTMR0		0x00000080 +#define CPCAP_BIT_VBUSPU		0x00000040 +#define CPCAP_BIT_VBUSPD		0x00000020 +#define CPCAP_BIT_DMPD			0x00000010 +#define CPCAP_BIT_DPPD			0x00000008 +#define CPCAP_BIT_DM1K5PU		0x00000004 +#define CPCAP_BIT_DP1K5PU		0X00000002 +#define CPCAP_BIT_DP150KPU		0x00000001 + +/* + * Register 897 - CPCAP_REG_USBC2 bits + */ +#define CPCAP_BIT_ZHSDRV1		0x00008000 +#define CPCAP_BIT_ZHSDRV0		0x00004000 +#define CPCAP_BIT_DPLLCLKREQ		0x00002000 +#define CPCAP_BIT_SE0CONN		0x00001000 +#define CPCAP_BIT_UARTTXTRI		0x00000800 +#define CPCAP_BIT_UARTSWAP		0x00000400 +#define CPCAP_BIT_UARTMUX1		0x00000200 +#define CPCAP_BIT_UARTMUX0		0x00000100 +#define CPCAP_BIT_ULPISTPLOW		0x00000080 +#define CPCAP_BIT_TXENPOL		0x00000040 +#define CPCAP_BIT_USBXCVREN		0x00000020 +#define CPCAP_BIT_USBCNTRL		0x00000010 +#define CPCAP_BIT_USBSUSPEND		0x00000008 +#define CPCAP_BIT_EMUMODE2		0x00000004 +#define CPCAP_BIT_EMUMODE1		0x00000002 +#define CPCAP_BIT_EMUMODE0		0x00000001 + +/* + * Register 898 - CPCAP_REG_USBC3 bits + */ +#define CPCAP_BIT_SPARE_898_15		0x00008000 +#define CPCAP_BIT_IHSTX03		0x00004000 +#define CPCAP_BIT_IHSTX02		0x00002000 +#define CPCAP_BIT_IHSTX01		0x00001000 +#define CPCAP_BIT_IHSTX0		0x00000800 +#define CPCAP_BIT_IDPU_SPI		0x00000400 +#define CPCAP_BIT_UNUSED_898_9		0x00000200 +#define CPCAP_BIT_VBUSSTBY_EN		0x00000100 +#define CPCAP_BIT_VBUSEN_SPI		0x00000080 +#define CPCAP_BIT_VBUSPU_SPI		0x00000040 +#define CPCAP_BIT_VBUSPD_SPI		0x00000020 +#define CPCAP_BIT_DMPD_SPI		0x00000010 +#define CPCAP_BIT_DPPD_SPI		0x00000008 +#define CPCAP_BIT_SUSPEND_SPI		0x00000004 +#define CPCAP_BIT_PU_SPI		0x00000002 +#define CPCAP_BIT_ULPI_SPI_SEL		0x00000001 + +/* + * Register 941 - CPCAP_REG_GPIO0 bits + */ +#define CPCAP_BIT_GPIO0MACROINITL	0x00008000 +#define CPCAP_BIT_GPIO0MACROINITH	0x00004000 +#define CPCAP_BIT_GPIO0MACROML		0x00002000 +#define CPCAP_BIT_GPIO0MACROMH		0x00001000 +#define CPCAP_BIT_UNUSED_941_11		0x00000800 +#define CPCAP_BIT_UNUSED_941_10		0x00000400 +#define CPCAP_BIT_GPIO0VLEV		0x00000200 +#define CPCAP_BIT_UNUSED_941_8		0x00000100 +#define CPCAP_BIT_GPIO0MUX1		0x00000080 +#define CPCAP_BIT_GPIO0MUX0		0x00000040 +#define CPCAP_BIT_GPIO0OT		0x00000020 +#define CPCAP_BIT_SPARE_941_4		0x00000010 +#define CPCAP_BIT_GPIO0PUEN		0x00000008 +#define CPCAP_BIT_GPIO0DIR		0x00000004 +#define CPCAP_BIT_GPIO0DRV		0x00000002 +#define CPCAP_BIT_GPIO0S		0x00000001 + +/* + * Register 943 - CPCAP_REG_GPIO1 bits + */ +#define CPCAP_BIT_GPIO1MACROINITL	0x00008000 +#define CPCAP_BIT_GPIO1MACROINITH	0x00004000 +#define CPCAP_BIT_GPIO1MACROML		0x00002000 +#define CPCAP_BIT_GPIO1MACROMH		0x00001000 +#define CPCAP_BIT_UNUSED_943_11		0x00000800 +#define CPCAP_BIT_UNUSED_943_10		0x00000400 +#define CPCAP_BIT_GPIO1VLEV		0x00000200 +#define CPCAP_BIT_UNUSED_943_8		0x00000100 +#define CPCAP_BIT_GPIO1MUX1		0x00000080 +#define CPCAP_BIT_GPIO1MUX0		0x00000040 +#define CPCAP_BIT_GPIO1OT		0x00000020 +#define CPCAP_BIT_SPARE_943_4		0x00000010 +#define CPCAP_BIT_GPIO1PUEN		0x00000008 +#define CPCAP_BIT_GPIO1DIR		0x00000004 +#define CPCAP_BIT_GPIO1DRV		0x00000002 +#define CPCAP_BIT_GPIO1S		0x00000001 + +/* + * Register 945 - CPCAP_REG_GPIO2 bits + */ +#define CPCAP_BIT_GPIO2MACROINITL	0x00008000 +#define CPCAP_BIT_GPIO2MACROINITH	0x00004000 +#define CPCAP_BIT_GPIO2MACROML		0x00002000 +#define CPCAP_BIT_GPIO2MACROMH		0x00001000 +#define CPCAP_BIT_UNUSED_945_11		0x00000800 +#define CPCAP_BIT_UNUSED_945_10		0x00000400 +#define CPCAP_BIT_GPIO2VLEV		0x00000200 +#define CPCAP_BIT_UNUSED_945_8		0x00000100 +#define CPCAP_BIT_GPIO2MUX1		0x00000080 +#define CPCAP_BIT_GPIO2MUX0		0x00000040 +#define CPCAP_BIT_GPIO2OT		0x00000020 +#define CPCAP_BIT_SPARE_945_4		0x00000010 +#define CPCAP_BIT_GPIO2PUEN		0x00000008 +#define CPCAP_BIT_GPIO2DIR		0x00000004 +#define CPCAP_BIT_GPIO2DRV		0x00000002 +#define CPCAP_BIT_GPIO2S		0x00000001 + +/* + * Register 947 - CPCAP_REG_GPIO3 bits + */ +#define CPCAP_BIT_GPIO3MACROINITL	0x00008000 +#define CPCAP_BIT_GPIO3MACROINITH	0x00004000 +#define CPCAP_BIT_GPIO3MACROML		0x00002000 +#define CPCAP_BIT_GPIO3MACROMH		0x00001000 +#define CPCAP_BIT_UNUSED_947_11		0x00000800 +#define CPCAP_BIT_UNUSED_947_10		0x00000400 +#define CPCAP_BIT_GPIO3VLEV		0x00000200 +#define CPCAP_BIT_UNUSED_947_8		0x00000100 +#define CPCAP_BIT_GPIO3MUX1		0x00000080 +#define CPCAP_BIT_GPIO3MUX0		0x00000040 +#define CPCAP_BIT_GPIO3OT		0x00000020 +#define CPCAP_BIT_SPARE_947_4		0x00000010 +#define CPCAP_BIT_GPIO3PUEN		0x00000008 +#define CPCAP_BIT_GPIO3DIR		0x00000004 +#define CPCAP_BIT_GPIO3DRV		0x00000002 +#define CPCAP_BIT_GPIO3S		0x00000001 + +/* + * Register 949 - CPCAP_REG_GPIO4 bits + */ +#define CPCAP_BIT_GPIO4MACROINITL	0x00008000 +#define CPCAP_BIT_GPIO4MACROINITH	0x00004000 +#define CPCAP_BIT_GPIO4MACROML		0x00002000 +#define CPCAP_BIT_GPIO4MACROMH		0x00001000 +#define CPCAP_BIT_UNUSED_949_11		0x00000800 +#define CPCAP_BIT_UNUSED_949_10		0x00000400 +#define CPCAP_BIT_GPIO4VLEV		0x00000200 +#define CPCAP_BIT_UNUSED_949_8		0x00000100 +#define CPCAP_BIT_GPIO4MUX1		0x00000080 +#define CPCAP_BIT_GPIO4MUX0		0x00000040 +#define CPCAP_BIT_GPIO4OT		0x00000020 +#define CPCAP_BIT_SPARE_949_4		0x00000010 +#define CPCAP_BIT_GPIO4PUEN		0x00000008 +#define CPCAP_BIT_GPIO4DIR		0x00000004 +#define CPCAP_BIT_GPIO4DRV		0x00000002 +#define CPCAP_BIT_GPIO4S		0x00000001 + +/* + * Register 951 - CPCAP_REG_GPIO5 bits + */ +#define CPCAP_BIT_GPIO5MACROINITL	0x00008000 +#define CPCAP_BIT_GPIO5MACROINITH	0x00004000 +#define CPCAP_BIT_GPIO5MACROML		0x00002000 +#define CPCAP_BIT_GPIO5MACROMH		0x00001000 +#define CPCAP_BIT_UNUSED_951_11		0x00000800 +#define CPCAP_BIT_UNUSED_951_10		0x00000400 +#define CPCAP_BIT_GPIO5VLEV		0x00000200 +#define CPCAP_BIT_GPIO5MUX2		0x00000100 +#define CPCAP_BIT_GPIO5MUX1		0x00000080 +#define CPCAP_BIT_GPIO5MUX0		0x00000040 +#define CPCAP_BIT_GPIO5OT		0x00000020 +#define CPCAP_BIT_SPARE_951_4		0x00000010 +#define CPCAP_BIT_GPIO5PUEN		0x00000008 +#define CPCAP_BIT_GPIO5DIR		0x00000004 +#define CPCAP_BIT_GPIO5DRV		0x00000002 +#define CPCAP_BIT_GPIO5S		0x00000001 + +/* + * Register 953 - CPCAP_REG_GPIO6 bits + */ +#define CPCAP_BIT_GPIO6MACROINITL	0x00008000 +#define CPCAP_BIT_GPIO6MACROINITH	0x00004000 +#define CPCAP_BIT_GPIO6MACROML		0x00002000 +#define CPCAP_BIT_GPIO6MACROMH		0x00001000 +#define CPCAP_BIT_UNUSED_953_11		0x00000800 +#define CPCAP_BIT_UNUSED_953_10		0x00000400 +#define CPCAP_BIT_GPIO6VLEV		0x00000200 +#define CPCAP_BIT_GPIO6MUX2		0x00000100 +#define CPCAP_BIT_GPIO6MUX1		0x00000080 +#define CPCAP_BIT_GPIO6MUX0		0x00000040 +#define CPCAP_BIT_GPIO6OT		0x00000020 +#define CPCAP_BIT_SPARE_953_4		0x00000010 +#define CPCAP_BIT_GPIO6PUEN		0x00000008 +#define CPCAP_BIT_GPIO6DIR		0x00000004 +#define CPCAP_BIT_GPIO6DRV		0x00000002 +#define CPCAP_BIT_GPIO6S		0x00000001 + +#endif /* __CPCAP_REGBITS_H__ */ diff --git a/include/linux/spi/cpcap.h b/include/linux/spi/cpcap.h new file mode 100644 index 00000000000..6612619fe22 --- /dev/null +++ b/include/linux/spi/cpcap.h @@ -0,0 +1,863 @@ +#ifndef _LINUX_SPI_CPCAP_H +#define _LINUX_SPI_CPCAP_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 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., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307, USA + * + */ + +#include <linux/ioctl.h> +#include <linux/rtc.h> +#ifdef __KERNEL__ +#include <linux/workqueue.h> +#include <linux/completion.h> +#include <linux/power_supply.h> +#include <linux/platform_device.h> +#endif + +#define CPCAP_DEV_NAME "cpcap" +#define CPCAP_NUM_REG_CPCAP (CPCAP_REG_END - CPCAP_REG_START + 1) + +#define CPCAP_IRQ_INT1_INDEX 0 +#define CPCAP_IRQ_INT2_INDEX 16 +#define CPCAP_IRQ_INT3_INDEX 32 +#define CPCAP_IRQ_INT4_INDEX 48 +#define CPCAP_IRQ_INT5_INDEX 64 + +#define CPCAP_HWCFG_NUM       2    /* The number of hardware config words. */ +/* + * Tell the uC to setup the secondary standby bits for the regulators used. + */ +#define CPCAP_HWCFG0_NONE               0x0000 +#define CPCAP_HWCFG0_SEC_STBY_SW1       0x0001 +#define CPCAP_HWCFG0_SEC_STBY_SW2       0x0002 +#define CPCAP_HWCFG0_SEC_STBY_SW3       0x0004 +#define CPCAP_HWCFG0_SEC_STBY_SW4       0x0008 +#define CPCAP_HWCFG0_SEC_STBY_SW5       0x0010 +#define CPCAP_HWCFG0_SEC_STBY_VAUDIO    0x0020 +#define CPCAP_HWCFG0_SEC_STBY_VCAM      0x0040 +#define CPCAP_HWCFG0_SEC_STBY_VCSI      0x0080 +#define CPCAP_HWCFG0_SEC_STBY_VDAC      0x0100 +#define CPCAP_HWCFG0_SEC_STBY_VDIG      0x0200 +#define CPCAP_HWCFG0_SEC_STBY_VHVIO     0x0400 +#define CPCAP_HWCFG0_SEC_STBY_VPLL      0x0800 +#define CPCAP_HWCFG0_SEC_STBY_VRF1      0x1000 +#define CPCAP_HWCFG0_SEC_STBY_VRF2      0x2000 +#define CPCAP_HWCFG0_SEC_STBY_VRFREF    0x4000 +#define CPCAP_HWCFG0_SEC_STBY_VSDIO     0x8000 + +#define CPCAP_HWCFG1_NONE               0x0000 +#define CPCAP_HWCFG1_SEC_STBY_VWLAN1    0x0001 +#define CPCAP_HWCFG1_SEC_STBY_VWLAN2    0x0002 +#define CPCAP_HWCFG1_SEC_STBY_VSIM      0x0004 +#define CPCAP_HWCFG1_SEC_STBY_VSIMCARD  0x0008 +#define CPCAP_HWCFG1_SEC_STBY_VUSB      0x0010 +/* Enable mapping of the PRI_STANDBY and SEC_STANDBY lines onto CPCAP GPIO. */ +#define CPCAP_HWCFG1_STBY_GPIO          0x1000 + +#define CPCAP_WHISPER_MODE_PU 			0x00000001 +#define CPCAP_WHISPER_ENABLE_UART		0x00000002 + +enum cpcap_regulator_id { +	CPCAP_SW1, +	CPCAP_SW2, +	CPCAP_SW3, +	CPCAP_SW4, +	CPCAP_SW5, +	CPCAP_VCAM, +	CPCAP_VCSI, +	CPCAP_VDAC, +	CPCAP_VDIG, +	CPCAP_VFUSE, +	CPCAP_VHVIO, +	CPCAP_VSDIO, +	CPCAP_VPLL, +	CPCAP_VRF1, +	CPCAP_VRF2, +	CPCAP_VRFREF, +	CPCAP_VWLAN1, +	CPCAP_VWLAN2, +	CPCAP_VSIM, +	CPCAP_VSIMCARD, +	CPCAP_VVIB, +	CPCAP_VUSB, +	CPCAP_VAUDIO, + +	CPCAP_NUM_REGULATORS +}; + +/* + * Enumeration of all registers in the cpcap. Note that the register + * numbers on the CPCAP IC are not contiguous. The values of the enums below + * are not the actual register numbers. + */ +enum cpcap_reg { +	CPCAP_REG_START,        /* Start of CPCAP registers. */ + +	CPCAP_REG_INT1 = CPCAP_REG_START, /* Interrupt 1 */ +	CPCAP_REG_INT2,		/* Interrupt 2 */ +	CPCAP_REG_INT3,		/* Interrupt 3 */ +	CPCAP_REG_INT4,		/* Interrupt 4 */ +	CPCAP_REG_INTM1,	/* Interrupt Mask 1 */ +	CPCAP_REG_INTM2,	/* Interrupt Mask 2 */ +	CPCAP_REG_INTM3,	/* Interrupt Mask 3 */ +	CPCAP_REG_INTM4,	/* Interrupt Mask 4 */ +	CPCAP_REG_INTS1,	/* Interrupt Sense 1 */ +	CPCAP_REG_INTS2,	/* Interrupt Sense 2 */ +	CPCAP_REG_INTS3,	/* Interrupt Sense 3 */ +	CPCAP_REG_INTS4,	/* Interrupt Sense 4 */ +	CPCAP_REG_ASSIGN1,	/* Resource Assignment 1 */ +	CPCAP_REG_ASSIGN2,	/* Resource Assignment 2 */ +	CPCAP_REG_ASSIGN3,	/* Resource Assignment 3 */ +	CPCAP_REG_ASSIGN4,	/* Resource Assignment 4 */ +	CPCAP_REG_ASSIGN5,	/* Resource Assignment 5 */ +	CPCAP_REG_ASSIGN6,	/* Resource Assignment 6 */ +	CPCAP_REG_VERSC1,	/* Version Control 1 */ +	CPCAP_REG_VERSC2,	/* Version Control 2 */ + +	CPCAP_REG_MI1,		/* Macro Interrupt 1 */ +	CPCAP_REG_MIM1,		/* Macro Interrupt Mask 1 */ +	CPCAP_REG_MI2,		/* Macro Interrupt 2 */ +	CPCAP_REG_MIM2,		/* Macro Interrupt Mask 2 */ +	CPCAP_REG_UCC1,		/* UC Control 1 */ +	CPCAP_REG_UCC2,		/* UC Control 2 */ +	CPCAP_REG_PC1,		/* Power Cut 1 */ +	CPCAP_REG_PC2,		/* Power Cut 2 */ +	CPCAP_REG_BPEOL,	/* BP and EOL */ +	CPCAP_REG_PGC,		/* Power Gate and Control */ +	CPCAP_REG_MT1,		/* Memory Transfer 1 */ +	CPCAP_REG_MT2,		/* Memory Transfer 2 */ +	CPCAP_REG_MT3,		/* Memory Transfer 3 */ +	CPCAP_REG_PF,		/* Print Format */ + +	CPCAP_REG_SCC,		/* System Clock Control */ +	CPCAP_REG_SW1,		/* Stop Watch 1 */ +	CPCAP_REG_SW2,		/* Stop Watch 2 */ +	CPCAP_REG_UCTM,		/* UC Turbo Mode */ +	CPCAP_REG_TOD1,		/* Time of Day 1 */ +	CPCAP_REG_TOD2,		/* Time of Day 2 */ +	CPCAP_REG_TODA1,	/* Time of Day Alarm 1 */ +	CPCAP_REG_TODA2,	/* Time of Day Alarm 2 */ +	CPCAP_REG_DAY,		/* Day */ +	CPCAP_REG_DAYA,		/* Day Alarm */ +	CPCAP_REG_VAL1,		/* Validity 1 */ +	CPCAP_REG_VAL2,		/* Validity 2 */ + +	CPCAP_REG_SDVSPLL,	/* Switcher DVS and PLL */ +	CPCAP_REG_SI2CC1,	/* Switcher I2C Control 1 */ +	CPCAP_REG_Si2CC2,	/* Switcher I2C Control 2 */ +	CPCAP_REG_S1C1,	        /* Switcher 1 Control 1 */ +	CPCAP_REG_S1C2,	        /* Switcher 1 Control 2 */ +	CPCAP_REG_S2C1,	        /* Switcher 2 Control 1 */ +	CPCAP_REG_S2C2,	        /* Switcher 2 Control 2 */ +	CPCAP_REG_S3C,	        /* Switcher 3 Control */ +	CPCAP_REG_S4C1,	        /* Switcher 4 Control 1 */ +	CPCAP_REG_S4C2,	        /* Switcher 4 Control 2 */ +	CPCAP_REG_S5C,	        /* Switcher 5 Control */ +	CPCAP_REG_S6C,	        /* Switcher 6 Control */ +	CPCAP_REG_VCAMC,	/* VCAM Control */ +	CPCAP_REG_VCSIC,	/* VCSI Control */ +	CPCAP_REG_VDACC,	/* VDAC Control */ +	CPCAP_REG_VDIGC,	/* VDIG Control */ +	CPCAP_REG_VFUSEC,	/* VFUSE Control */ +	CPCAP_REG_VHVIOC,	/* VHVIO Control */ +	CPCAP_REG_VSDIOC,	/* VSDIO Control */ +	CPCAP_REG_VPLLC,	/* VPLL Control */ +	CPCAP_REG_VRF1C,	/* VRF1 Control */ +	CPCAP_REG_VRF2C,	/* VRF2 Control */ +	CPCAP_REG_VRFREFC,	/* VRFREF Control */ +	CPCAP_REG_VWLAN1C,	/* VWLAN1 Control */ +	CPCAP_REG_VWLAN2C,	/* VWLAN2 Control */ +	CPCAP_REG_VSIMC,	/* VSIM Control */ +	CPCAP_REG_VVIBC,	/* VVIB Control */ +	CPCAP_REG_VUSBC,	/* VUSB Control */ +	CPCAP_REG_VUSBINT1C,	/* VUSBINT1 Control */ +	CPCAP_REG_VUSBINT2C,	/* VUSBINT2 Control */ +	CPCAP_REG_URT,		/* Useroff Regulator Trigger */ +	CPCAP_REG_URM1,		/* Useroff Regulator Mask 1 */ +	CPCAP_REG_URM2,		/* Useroff Regulator Mask 2 */ + +	CPCAP_REG_VAUDIOC,	/* VAUDIO Control */ +	CPCAP_REG_CC,		/* Codec Control */ +	CPCAP_REG_CDI,		/* Codec Digital Interface */ +	CPCAP_REG_SDAC,		/* Stereo DAC */ +	CPCAP_REG_SDACDI,	/* Stereo DAC Digital Interface */ +	CPCAP_REG_TXI,		/* TX Inputs */ +	CPCAP_REG_TXMP,		/* TX MIC PGA's */ +	CPCAP_REG_RXOA,		/* RX Output Amplifiers */ +	CPCAP_REG_RXVC,		/* RX Volume Control */ +	CPCAP_REG_RXCOA,	/* RX Codec to Output Amps */ +	CPCAP_REG_RXSDOA,	/* RX Stereo DAC to Output Amps */ +	CPCAP_REG_RXEPOA,	/* RX External PGA to Output Amps */ +	CPCAP_REG_RXLL,		/* RX Low Latency */ +	CPCAP_REG_A2LA,		/* A2 Loudspeaker Amplifier */ +	CPCAP_REG_MIPIS1,	/* MIPI Slimbus 1 */ +	CPCAP_REG_MIPIS2,	/* MIPI Slimbus 2 */ +	CPCAP_REG_MIPIS3,	/* MIPI Slimbus 3. */ +	CPCAP_REG_LVAB,		/* LMR Volume and A4 Balanced. */ + +	CPCAP_REG_CCC1,		/* Coulomb Counter Control 1 */ +	CPCAP_REG_CRM,		/* Charger and Reverse Mode */ +	CPCAP_REG_CCCC2,	/* Coincell and Coulomb Ctr Ctrl 2 */ +	CPCAP_REG_CCS1,		/* Coulomb Counter Sample 1 */ +	CPCAP_REG_CCS2,		/* Coulomb Counter Sample 2 */ +	CPCAP_REG_CCA1,		/* Coulomb Counter Accumulator 1 */ +	CPCAP_REG_CCA2,		/* Coulomb Counter Accumulator 2 */ +	CPCAP_REG_CCM,		/* Coulomb Counter Mode */ +	CPCAP_REG_CCO,		/* Coulomb Counter Offset */ +	CPCAP_REG_CCI,		/* Coulomb Counter Integrator */ + +	CPCAP_REG_ADCC1,	/* A/D Converter Configuration 1 */ +	CPCAP_REG_ADCC2,	/* A/D Converter Configuration 2 */ +	CPCAP_REG_ADCD0,	/* A/D Converter Data 0 */ +	CPCAP_REG_ADCD1,	/* A/D Converter Data 1 */ +	CPCAP_REG_ADCD2,	/* A/D Converter Data 2 */ +	CPCAP_REG_ADCD3,	/* A/D Converter Data 3 */ +	CPCAP_REG_ADCD4,	/* A/D Converter Data 4 */ +	CPCAP_REG_ADCD5,	/* A/D Converter Data 5 */ +	CPCAP_REG_ADCD6,	/* A/D Converter Data 6 */ +	CPCAP_REG_ADCD7,	/* A/D Converter Data 7 */ +	CPCAP_REG_ADCAL1,	/* A/D Converter Calibration 1 */ +	CPCAP_REG_ADCAL2,	/* A/D Converter Calibration 2 */ + +	CPCAP_REG_USBC1,	/* USB Control 1 */ +	CPCAP_REG_USBC2,	/* USB Control 2 */ +	CPCAP_REG_USBC3,	/* USB Control 3 */ +	CPCAP_REG_UVIDL,	/* ULPI Vendor ID Low */ +	CPCAP_REG_UVIDH,	/* ULPI Vendor ID High */ +	CPCAP_REG_UPIDL,	/* ULPI Product ID Low */ +	CPCAP_REG_UPIDH,	/* ULPI Product ID High */ +	CPCAP_REG_UFC1,		/* ULPI Function Control 1 */ +	CPCAP_REG_UFC2,		/* ULPI Function Control 2 */ +	CPCAP_REG_UFC3,		/* ULPI Function Control 3 */ +	CPCAP_REG_UIC1,		/* ULPI Interface Control 1 */ +	CPCAP_REG_UIC2,		/* ULPI Interface Control 2 */ +	CPCAP_REG_UIC3,		/* ULPI Interface Control 3 */ +	CPCAP_REG_USBOTG1,	/* USB OTG Control 1 */ +	CPCAP_REG_USBOTG2,	/* USB OTG Control 2 */ +	CPCAP_REG_USBOTG3,	/* USB OTG Control 3 */ +	CPCAP_REG_UIER1,	/* USB Interrupt Enable Rising 1 */ +	CPCAP_REG_UIER2,	/* USB Interrupt Enable Rising 2 */ +	CPCAP_REG_UIER3,	/* USB Interrupt Enable Rising 3 */ +	CPCAP_REG_UIEF1,	/* USB Interrupt Enable Falling 1 */ +	CPCAP_REG_UIEF2,	/* USB Interrupt Enable Falling 1 */ +	CPCAP_REG_UIEF3,	/* USB Interrupt Enable Falling 1 */ +	CPCAP_REG_UIS,		/* USB Interrupt Status */ +	CPCAP_REG_UIL,		/* USB Interrupt Latch */ +	CPCAP_REG_USBD,		/* USB Debug */ +	CPCAP_REG_SCR1,		/* Scratch 1 */ +	CPCAP_REG_SCR2,		/* Scratch 2 */ +	CPCAP_REG_SCR3,		/* Scratch 3 */ +	CPCAP_REG_VMC,		/* Video Mux Control */ +	CPCAP_REG_OWDC,		/* One Wire Device Control */ +	CPCAP_REG_GPIO0,	/* GPIO 0 Control */ +	CPCAP_REG_GPIO1,	/* GPIO 1 Control */ +	CPCAP_REG_GPIO2,	/* GPIO 2 Control */ +	CPCAP_REG_GPIO3,	/* GPIO 3 Control */ +	CPCAP_REG_GPIO4,	/* GPIO 4 Control */ +	CPCAP_REG_GPIO5,	/* GPIO 5 Control */ +	CPCAP_REG_GPIO6,	/* GPIO 6 Control */ + +	CPCAP_REG_MDLC,		/* Main Display Lighting Control */ +	CPCAP_REG_KLC,		/* Keypad Lighting Control */ +	CPCAP_REG_ADLC,		/* Aux Display Lighting Control */ +	CPCAP_REG_REDC,		/* Red Triode Control */ +	CPCAP_REG_GREENC,	/* Green Triode Control */ +	CPCAP_REG_BLUEC,	/* Blue Triode Control */ +	CPCAP_REG_CFC,		/* Camera Flash Control */ +	CPCAP_REG_ABC,		/* Adaptive Boost Control */ +	CPCAP_REG_BLEDC,	/* Bluetooth LED Control */ +	CPCAP_REG_CLEDC,	/* Camera Privacy LED Control */ + +	CPCAP_REG_OW1C,		/* One Wire 1 Command */ +	CPCAP_REG_OW1D,		/* One Wire 1 Data */ +	CPCAP_REG_OW1I,		/* One Wire 1 Interrupt */ +	CPCAP_REG_OW1IE,	/* One Wire 1 Interrupt Enable */ +	CPCAP_REG_OW1,		/* One Wire 1 Control */ +	CPCAP_REG_OW2C,		/* One Wire 2 Command */ +	CPCAP_REG_OW2D,		/* One Wire 2 Data */ +	CPCAP_REG_OW2I,		/* One Wire 2 Interrupt */ +	CPCAP_REG_OW2IE,	/* One Wire 2 Interrupt Enable */ +	CPCAP_REG_OW2,		/* One Wire 2 Control */ +	CPCAP_REG_OW3C,		/* One Wire 3 Command */ +	CPCAP_REG_OW3D,		/* One Wire 3 Data */ +	CPCAP_REG_OW3I,		/* One Wire 3 Interrupt */ +	CPCAP_REG_OW3IE,	/* One Wire 3 Interrupt Enable */ +	CPCAP_REG_OW3,		/* One Wire 3 Control */ +	CPCAP_REG_GCAIC,	/* GCAI Clock Control */ +	CPCAP_REG_GCAIM,	/* GCAI GPIO Mode */ +	CPCAP_REG_LGDIR,	/* LMR GCAI GPIO Direction */ +	CPCAP_REG_LGPU,		/* LMR GCAI GPIO Pull-up */ +	CPCAP_REG_LGPIN,	/* LMR GCAI GPIO Pin */ +	CPCAP_REG_LGMASK,	/* LMR GCAI GPIO Mask */ +	CPCAP_REG_LDEB,		/* LMR Debounce Settings */ +	CPCAP_REG_LGDET,	/* LMR GCAI Detach Detect */ +	CPCAP_REG_LMISC,	/* LMR Misc Bits */ +	CPCAP_REG_LMACE,	/* LMR Mace IC Support */ +	CPCAP_REG_TEST,         /* Test */ +	CPCAP_REG_ST_TEST1,     /* ST Test 1 */ + +	CPCAP_REG_END = CPCAP_REG_ST_TEST1, /* End of CPCAP registers. */ + +	CPCAP_REG_MAX		/* The largest valid register value. */ +	= CPCAP_REG_END, + +	CPCAP_REG_SIZE = CPCAP_REG_MAX + 1, +	CPCAP_REG_UNUSED = CPCAP_REG_MAX + 2, +}; + +enum { +	CPCAP_IOCTL_NUM_TEST__START, +	CPCAP_IOCTL_NUM_TEST_READ_REG, +	CPCAP_IOCTL_NUM_TEST_WRITE_REG, +	CPCAP_IOCTL_NUM_TEST__END, + +	CPCAP_IOCTL_NUM_ADC__START, +	CPCAP_IOCTL_NUM_ADC_PHASE, +	CPCAP_IOCTL_NUM_ADC__END, + +	CPCAP_IOCTL_NUM_BATT__START, +	CPCAP_IOCTL_NUM_BATT_DISPLAY_UPDATE, +	CPCAP_IOCTL_NUM_BATT_ATOD_ASYNC, +	CPCAP_IOCTL_NUM_BATT_ATOD_SYNC, +	CPCAP_IOCTL_NUM_BATT_ATOD_READ, +	CPCAP_IOCTL_NUM_BATT__END, + +	CPCAP_IOCTL_NUM_UC__START, +	CPCAP_IOCTL_NUM_UC_MACRO_START, +	CPCAP_IOCTL_NUM_UC_MACRO_STOP, +	CPCAP_IOCTL_NUM_UC_GET_VENDOR, +	CPCAP_IOCTL_NUM_UC_SET_TURBO_MODE, +	CPCAP_IOCTL_NUM_UC__END, + +	CPCAP_IOCTL_NUM_RTC__START, +	CPCAP_IOCTL_NUM_RTC_COUNT, +	CPCAP_IOCTL_NUM_RTC__END, + +	CPCAP_IOCTL_NUM_ACCY__START, +	CPCAP_IOCTL_NUM_ACCY_WHISPER, +	CPCAP_IOCTL_NUM_ACCY__END, + +	CPCAP_IOCTL_NUM_AUDIO_PWR__START, +	CPCAP_IOCTL_NUM_AUDIO_PWR_MODE, +	CPCAP_IOCTL_NUM_AUDIO_PWR_ENABLE, +	CPCAP_IOCTL_NUM_AUDIO_PWR__END, +}; + +enum cpcap_irqs { +	CPCAP_IRQ__START,		/* 1st supported interrupt event */ +	CPCAP_IRQ_HSCLK = CPCAP_IRQ_INT1_INDEX, /* High Speed Clock */ +	CPCAP_IRQ_PRIMAC,		/* Primary Macro */ +	CPCAP_IRQ_SECMAC,		/* Secondary Macro */ +	CPCAP_IRQ_LOWBPL,		/* Low Battery Low Threshold */ +	CPCAP_IRQ_SEC2PRI,		/* 2nd Macro to Primary Processor */ +	CPCAP_IRQ_LOWBPH,		/* Low Battery High Threshold  */ +	CPCAP_IRQ_EOL,			/* End of Life */ +	CPCAP_IRQ_TS,			/* Touchscreen */ +	CPCAP_IRQ_ADCDONE,		/* ADC Conversion Complete */ +	CPCAP_IRQ_HS,			/* Headset */ +	CPCAP_IRQ_MB2,			/* Mic Bias2 */ +	CPCAP_IRQ_VBUSOV,		/* Overvoltage Detected */ +	CPCAP_IRQ_RVRS_CHRG,		/* Reverse Charge */ +	CPCAP_IRQ_CHRG_DET,		/* Charger Detected */ +	CPCAP_IRQ_IDFLOAT,		/* ID Float */ +	CPCAP_IRQ_IDGND,		/* ID Ground */ + +	CPCAP_IRQ_SE1 = CPCAP_IRQ_INT2_INDEX, /* SE1 Detector */ +	CPCAP_IRQ_SESSEND,		/* Session End */ +	CPCAP_IRQ_SESSVLD,		/* Session Valid */ +	CPCAP_IRQ_VBUSVLD,		/* VBUS Valid */ +	CPCAP_IRQ_CHRG_CURR1,		/* Charge Current Monitor (20mA) */ +	CPCAP_IRQ_CHRG_CURR2,		/* Charge Current Monitor (250mA) */ +	CPCAP_IRQ_RVRS_MODE,		/* Reverse Current Limit */ +	CPCAP_IRQ_ON,			/* On Signal */ +	CPCAP_IRQ_ON2,			/* On 2 Signal */ +	CPCAP_IRQ_CLK,			/* 32k Clock Transition */ +	CPCAP_IRQ_1HZ,			/* 1Hz Tick */ +	CPCAP_IRQ_PTT,			/* Push To Talk */ +	CPCAP_IRQ_SE0CONN,		/* SE0 Condition */ +	CPCAP_IRQ_CHRG_SE1B,		/* CHRG_SE1B Pin */ +	CPCAP_IRQ_UART_ECHO_OVERRUN,	/* UART Buffer Overflow */ +	CPCAP_IRQ_EXTMEMHD,		/* External MEMHOLD */ + +	CPCAP_IRQ_WARM = CPCAP_IRQ_INT3_INDEX, /* Warm Start */ +	CPCAP_IRQ_SYSRSTR,		/* System Restart */ +	CPCAP_IRQ_SOFTRST,		/* Soft Reset */ +	CPCAP_IRQ_DIEPWRDWN,		/* Die Temperature Powerdown */ +	CPCAP_IRQ_DIETEMPH,		/* Die Temperature High */ +	CPCAP_IRQ_PC,			/* Power Cut */ +	CPCAP_IRQ_OFLOWSW,		/* Stopwatch Overflow */ +	CPCAP_IRQ_TODA,			/* TOD Alarm */ +	CPCAP_IRQ_OPT_SEL_DTCH,		/* Detach Detect */ +	CPCAP_IRQ_OPT_SEL_STATE,	/* State Change */ +	CPCAP_IRQ_ONEWIRE1,		/* Onewire 1 Block */ +	CPCAP_IRQ_ONEWIRE2,		/* Onewire 2 Block */ +	CPCAP_IRQ_ONEWIRE3,		/* Onewire 3 Block */ +	CPCAP_IRQ_UCRESET,		/* Microcontroller Reset */ +	CPCAP_IRQ_PWRGOOD,		/* BP Turn On */ +	CPCAP_IRQ_USBDPLLCLK,		/* USB DPLL Status */ + +	CPCAP_IRQ_DPI = CPCAP_IRQ_INT4_INDEX, /* DP Line */ +	CPCAP_IRQ_DMI,			/* DM Line */ +	CPCAP_IRQ_UCBUSY,		/* Microcontroller Busy */ +	CPCAP_IRQ_GCAI_CURR1,		/* Charge Current Monitor (65mA) */ +	CPCAP_IRQ_GCAI_CURR2,		/* Charge Current Monitor (600mA) */ +	CPCAP_IRQ_SB_MAX_RETRANSMIT_ERR,/* SLIMbus Retransmit Error */ +	CPCAP_IRQ_BATTDETB,		/* Battery Presence Detected */ +	CPCAP_IRQ_PRIHALT,		/* Primary Microcontroller Halt */ +	CPCAP_IRQ_SECHALT,		/* Secondary Microcontroller Halt */ +	CPCAP_IRQ_CC_CAL,		/* CC Calibration */ + +	CPCAP_IRQ_UC_PRIROMR = CPCAP_IRQ_INT5_INDEX, /* Prim ROM Rd Macro Int */ +	CPCAP_IRQ_UC_PRIRAMW,		/* Primary RAM Write Macro Int */ +	CPCAP_IRQ_UC_PRIRAMR,		/* Primary RAM Read Macro Int */ +	CPCAP_IRQ_UC_USEROFF,		/* USEROFF Macro Interrupt */ +	CPCAP_IRQ_UC_PRIMACRO_4,	/* Primary Macro 4 Interrupt */ +	CPCAP_IRQ_UC_PRIMACRO_5,	/* Primary Macro 5 Interrupt */ +	CPCAP_IRQ_UC_PRIMACRO_6,	/* Primary Macro 6 Interrupt */ +	CPCAP_IRQ_UC_PRIMACRO_7,	/* Primary Macro 7 Interrupt */ +	CPCAP_IRQ_UC_PRIMACRO_8,	/* Primary Macro 8 Interrupt */ +	CPCAP_IRQ_UC_PRIMACRO_9,	/* Primary Macro 9 Interrupt */ +	CPCAP_IRQ_UC_PRIMACRO_10,	/* Primary Macro 10 Interrupt */ +	CPCAP_IRQ_UC_PRIMACRO_11,	/* Primary Macro 11 Interrupt */ +	CPCAP_IRQ_UC_PRIMACRO_12,	/* Primary Macro 12 Interrupt */ +	CPCAP_IRQ_UC_PRIMACRO_13,	/* Primary Macro 13 Interrupt */ +	CPCAP_IRQ_UC_PRIMACRO_14,	/* Primary Macro 14 Interrupt */ +	CPCAP_IRQ_UC_PRIMACRO_15,	/* Primary Macro 15 Interrupt */ +	CPCAP_IRQ__NUM			/* Number of allocated events */ +}; + +enum cpcap_adc_bank0 { +	CPCAP_ADC_AD0_BATTDETB, +	CPCAP_ADC_BATTP, +	CPCAP_ADC_VBUS, +	CPCAP_ADC_AD3, +	CPCAP_ADC_BPLUS_AD4, +	CPCAP_ADC_CHG_ISENSE, +	CPCAP_ADC_BATTI_ADC, +	CPCAP_ADC_USB_ID, + +	CPCAP_ADC_BANK0_NUM, +}; + +enum cpcap_adc_bank1 { +	CPCAP_ADC_AD8, +	CPCAP_ADC_AD9, +	CPCAP_ADC_LICELL, +	CPCAP_ADC_HV_BATTP, +	CPCAP_ADC_TSX1_AD12, +	CPCAP_ADC_TSX2_AD13, +	CPCAP_ADC_TSY1_AD14, +	CPCAP_ADC_TSY2_AD15, + +	CPCAP_ADC_BANK1_NUM, +}; + +enum cpcap_adc_format { +	CPCAP_ADC_FORMAT_RAW, +	CPCAP_ADC_FORMAT_PHASED, +	CPCAP_ADC_FORMAT_CONVERTED, +}; + +enum cpcap_adc_timing { +	CPCAP_ADC_TIMING_IMM, +	CPCAP_ADC_TIMING_IN, +	CPCAP_ADC_TIMING_OUT, +}; + +enum cpcap_adc_type { +	CPCAP_ADC_TYPE_BANK_0, +	CPCAP_ADC_TYPE_BANK_1, +	CPCAP_ADC_TYPE_BATT_PI, +}; + +enum cpcap_bank { +	CPCAP_BANK_PRIMARY, +	CPCAP_BANK_SECONDARY, +}; + +enum cpcap_standby { +	CPCAP_PRISTANDBY = 0x01, +	CPCAP_SECSTANDBY = 0x02, +}; + +enum cpcap_macro { +	CPCAP_MACRO_ROMR, +	CPCAP_MACRO_RAMW, +	CPCAP_MACRO_RAMR, +	CPCAP_MACRO_USEROFF, +	CPCAP_MACRO_4, +	CPCAP_MACRO_5, +	CPCAP_MACRO_6, +	CPCAP_MACRO_7, +	CPCAP_MACRO_8, +	CPCAP_MACRO_9, +	CPCAP_MACRO_10, +	CPCAP_MACRO_11, +	CPCAP_MACRO_12, +	CPCAP_MACRO_13, +	CPCAP_MACRO_14, +	CPCAP_MACRO_15, + +	CPCAP_MACRO__END, +}; + +enum cpcap_vendor { +	CPCAP_VENDOR_ST, +	CPCAP_VENDOR_TI, +}; + +enum cpcap_revision { +	CPCAP_REVISION_1_0 = 0x08, +	CPCAP_REVISION_1_1 = 0x09, +	CPCAP_REVISION_2_0 = 0x10, +	CPCAP_REVISION_2_1 = 0x11, +}; + +enum cpcap_batt_usb_model { +	CPCAP_BATT_USB_MODEL_NONE, +	CPCAP_BATT_USB_MODEL_USB, +	CPCAP_BATT_USB_MODEL_FACTORY, +}; + +struct cpcap_spi_init_data { +	enum cpcap_reg reg; +	unsigned short data; +}; + +struct cpcap_adc_ato { +	unsigned short ato_in; +	unsigned short atox_in; +	unsigned short adc_ps_factor_in; +	unsigned short atox_ps_factor_in; +	unsigned short ato_out; +	unsigned short atox_out; +	unsigned short adc_ps_factor_out; +	unsigned short atox_ps_factor_out; +	unsigned short ichrg_sense_res; +}; + +struct cpcap_display_led { +	unsigned int display_reg; +	unsigned int display_mask; +	unsigned int display_on; +	unsigned int display_off; +	unsigned int display_init; +	unsigned int poll_intvl; +	unsigned int zone0; +	unsigned int zone1; +	unsigned int zone2; +	unsigned int zone3; +	unsigned int zone4; +}; + +struct cpcap_button_led { +	unsigned int button_reg; +	unsigned int button_mask; +	unsigned int button_on; +	unsigned int button_off; +}; + +struct cpcap_kpad_led { +	unsigned int kpad_reg; +	unsigned int kpad_mask; +	unsigned int kpad_on; +	unsigned int kpad_off; +}; + +struct cpcap_rgb_led { +	unsigned int rgb_reg; +	unsigned int rgb_mask; +	unsigned int rgb_on; +	unsigned int rgb_off; +}; +struct cpcap_als_data { +	unsigned short lux_max; +	unsigned short lux_min; +	unsigned short als_max; +	unsigned short als_min; +}; + +struct cpcap_leds { +	struct cpcap_display_led display_led; +	struct cpcap_button_led button_led; +	struct cpcap_kpad_led kpad_led; +	struct cpcap_rgb_led rgb_led; +	struct cpcap_als_data als_data; +}; + +struct cpcap_batt_data { +	int status; +	int health; +	int present; +	int capacity; +	int batt_volt; +	int batt_temp; +	int batt_full_capacity; +	int batt_capacity_one; +	int cycle_count; +	int timestamp; +	unsigned long charge_cycle_counter; +	unsigned char charge_cycle_counter_percentage; +}; + +struct cpcap_batt_ac_data { +	int online; +}; + +struct cpcap_batt_usb_data { +	int online; +	int current_now; +	enum cpcap_batt_usb_model model; +}; + +struct cpcap_rtc_time_cnt { +	struct rtc_time time; +	unsigned short count; +}; + +struct cpcap_device; + +#ifdef __KERNEL__ +struct cpcap_platform_data { +	struct cpcap_spi_init_data *init; +	int init_len; +	unsigned short *regulator_mode_values; +	unsigned short *regulator_off_mode_values; +	struct regulator_init_data *regulator_init; +	struct cpcap_adc_ato *adc_ato; +	struct cpcap_leds *leds; +	void (*ac_changed)(struct power_supply *, +			   struct cpcap_batt_ac_data *); +	void (*batt_changed)(struct power_supply *, +			     struct cpcap_batt_data *); +	void (*usb_changed)(struct power_supply *, +			    struct cpcap_batt_usb_data *); +	u16 hwcfg[CPCAP_HWCFG_NUM]; +	unsigned short is_umts; +	unsigned int irq_gpio; +}; + +struct cpcap_adc_request { +	enum cpcap_adc_format format; +	enum cpcap_adc_timing timing; +	enum cpcap_adc_type type; +	int status; +	int result[CPCAP_ADC_BANK0_NUM]; +	void (*callback)(struct cpcap_device *, void *); +	void *callback_param; + +	/* Used in case of sync requests */ +	struct completion completion; +}; +#endif + +struct cpcap_adc_us_request { +	enum cpcap_adc_format format; +	enum cpcap_adc_timing timing; +	enum cpcap_adc_type type; +	int status; +	int result[CPCAP_ADC_BANK0_NUM]; +}; + +struct cpcap_adc_phase { +	signed char offset_batti; +	unsigned char slope_batti; +	signed char offset_chrgi; +	unsigned char slope_chrgi; +	signed char offset_battp; +	unsigned char slope_battp; +	signed char offset_bp; +	unsigned char slope_bp; +	signed char offset_battt; +	unsigned char slope_battt; +	signed char offset_chrgv; +	unsigned char slope_chrgv; +}; + +struct cpcap_regacc { +	unsigned short reg; +	unsigned short value; +	unsigned short mask; +}; + +/* + * Gets the contents of the specified cpcap register. + * + * INPUTS: The register number in the cpcap driver's format. + * + * OUTPUTS: The command writes the register data back to user space at the + * location specified, or it may return an error code. + */ +#define CPCAP_IOCTL_GET_RTC_TIME_COUNTER \ +	_IOR(0, CPCAP_IOCTL_NUM_RTC_COUNT, struct cpcap_rtc_time_cnt) + +#define CPCAP_IOCTL_TEST_READ_REG \ +	_IOWR(0, CPCAP_IOCTL_NUM_TEST_READ_REG, struct cpcap_regacc*) + +/* + * Writes the specifed cpcap register. + * + * This function writes the specified cpcap register with the specified + * data. + * + * INPUTS: The register number in the cpcap driver's format and the data to + * write to that register. + * + * OUTPUTS: The command has no output other than the returned error code for + * the ioctl() call. + */ +#define CPCAP_IOCTL_TEST_WRITE_REG \ +	_IOWR(0, CPCAP_IOCTL_NUM_TEST_WRITE_REG, struct cpcap_regacc*) + +#define CPCAP_IOCTL_ADC_PHASE \ +	_IOWR(0, CPCAP_IOCTL_NUM_ADC_PHASE, struct cpcap_adc_phase*) + +#define CPCAP_IOCTL_BATT_DISPLAY_UPDATE \ +	_IOW(0, CPCAP_IOCTL_NUM_BATT_DISPLAY_UPDATE, struct cpcap_batt_data*) + +#define CPCAP_IOCTL_BATT_ATOD_ASYNC \ +	_IOW(0, CPCAP_IOCTL_NUM_BATT_ATOD_ASYNC, struct cpcap_adc_us_request*) + +#define CPCAP_IOCTL_BATT_ATOD_SYNC \ +	_IOWR(0, CPCAP_IOCTL_NUM_BATT_ATOD_SYNC, struct cpcap_adc_us_request*) + +#define CPCAP_IOCTL_BATT_ATOD_READ \ +	_IOWR(0, CPCAP_IOCTL_NUM_BATT_ATOD_READ, struct cpcap_adc_us_request*) + + +#define CPCAP_IOCTL_UC_MACRO_START \ +	_IOWR(0, CPCAP_IOCTL_NUM_UC_MACRO_START, enum cpcap_macro) + +#define CPCAP_IOCTL_UC_MACRO_STOP \ +	_IOWR(0, CPCAP_IOCTL_NUM_UC_MACRO_STOP, enum cpcap_macro) + +#define CPCAP_IOCTL_UC_GET_VENDOR \ +	_IOWR(0, CPCAP_IOCTL_NUM_UC_GET_VENDOR, enum cpcap_vendor) + +#define CPCAP_IOCTL_UC_SET_TURBO_MODE \ +	_IOW(0, CPCAP_IOCTL_NUM_UC_SET_TURBO_MODE, unsigned short) + +#define CPCAP_IOCTL_ACCY_WHISPER \ +	_IOW(0, CPCAP_IOCTL_NUM_ACCY_WHISPER, unsigned long) + +#define CPCAP_IOCTL_AUDIO_PWR_MODE \ +	_IOW(0, CPCAP_IOCTL_NUM_AUDIO_PWR_MODE,  unsigned short) + +#define CPCAP_IOCTL_AUDIO_PWR_ENABLE \ +	_IOW(0, CPCAP_IOCTL_NUM_AUDIO_PWR_ENABLE,  unsigned short) + +#ifdef __KERNEL__ +struct cpcap_device { +	struct spi_device	*spi; +	enum cpcap_vendor       vendor; +	enum cpcap_revision     revision; +	void			*keydata; +	struct platform_device  *regulator_pdev[CPCAP_NUM_REGULATORS]; +	void			*irqdata; +	void			*adcdata; +	void			*battdata; +	void			*ucdata; +	void			(*h2w_new_state)(int); +}; + +static inline void cpcap_set_keydata(struct cpcap_device *cpcap, void *data) +{ +	cpcap->keydata = data; +} + +static inline void *cpcap_get_keydata(struct cpcap_device *cpcap) +{ +	return cpcap->keydata; +} + +int cpcap_regacc_write(struct cpcap_device *cpcap, enum cpcap_reg reg, +		       unsigned short value, unsigned short mask); + +int cpcap_regacc_read(struct cpcap_device *cpcap, enum cpcap_reg reg, +		      unsigned short *value_ptr); + +int cpcap_regacc_init(struct cpcap_device *cpcap); + +void cpcap_broadcast_key_event(struct cpcap_device *cpcap, +			       unsigned int code, int value); + +int cpcap_irq_init(struct cpcap_device *cpcap); + +void cpcap_irq_shutdown(struct cpcap_device *cpcap); + +int cpcap_irq_register(struct cpcap_device *cpcap, enum cpcap_irqs irq, +		       void (*cb_func) (enum cpcap_irqs, void *), void *data); + +int cpcap_irq_free(struct cpcap_device *cpcap, enum cpcap_irqs irq); + +int cpcap_irq_get_data(struct cpcap_device *cpcap, enum cpcap_irqs irq, +		       void **data); + +int cpcap_irq_clear(struct cpcap_device *cpcap, enum cpcap_irqs int_event); + +int cpcap_irq_mask(struct cpcap_device *cpcap, enum cpcap_irqs int_event); + +int cpcap_irq_unmask(struct cpcap_device *cpcap, enum cpcap_irqs int_event); + +int cpcap_irq_mask_get(struct cpcap_device *cpcap, enum cpcap_irqs int_event); + +int cpcap_irq_sense(struct cpcap_device *cpcap, enum cpcap_irqs int_event, +		    unsigned char clear); + +int cpcap_adc_sync_read(struct cpcap_device *cpcap, +			struct cpcap_adc_request *request); + +int cpcap_adc_async_read(struct cpcap_device *cpcap, +			 struct cpcap_adc_request *request); + +void cpcap_adc_phase(struct cpcap_device *cpcap, struct cpcap_adc_phase *phase); + +void cpcap_batt_set_ac_prop(struct cpcap_device *cpcap, int online); + +void cpcap_batt_set_usb_prop_online(struct cpcap_device *cpcap, int online, +				    enum cpcap_batt_usb_model model); + +void cpcap_batt_set_usb_prop_curr(struct cpcap_device *cpcap, +				  unsigned int curr); + +int cpcap_uc_start(struct cpcap_device *cpcap, enum cpcap_macro macro); + +int cpcap_uc_stop(struct cpcap_device *cpcap, enum cpcap_macro macro); + +unsigned char cpcap_uc_status(struct cpcap_device *cpcap, +			      enum cpcap_macro macro); + +int cpcap_disable_offmode_wakeups(bool disable); +struct cpcap_platform_data *cpcap_get_plat_data(struct cpcap_device *cpcap); + +#ifdef CONFIG_PM_DBG_DRV +void cpcap_irq_pm_dbg_suspend(void); +void cpcap_irq_pm_dbg_resume(void); +int cpcap_uc_ram_write(struct cpcap_device *cpcap, unsigned short address, +		     unsigned short num_words, unsigned short *data); + +int cpcap_uc_ram_read(struct cpcap_device *cpcap, unsigned short address, +		    unsigned short num_words, unsigned short *data); +#endif /* CONFIG_PM_DBG_DRV */ + +#define  cpcap_driver_register platform_driver_register +#define  cpcap_driver_unregister platform_driver_unregister + +int cpcap_device_register(struct platform_device *pdev); +int cpcap_device_unregister(struct platform_device *pdev); + +#endif /* __KERNEL__ */ +#endif /* _LINUX_SPI_CPCAP_H */ diff --git a/include/linux/switch.h b/include/linux/switch.h new file mode 100644 index 00000000000..3e4c748e343 --- /dev/null +++ b/include/linux/switch.h @@ -0,0 +1,53 @@ +/* + *  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/ti_wilink_st.h b/include/linux/ti_wilink_st.h index 932b7639224..3ef81ae5f19 100644 --- a/include/linux/ti_wilink_st.h +++ b/include/linux/ti_wilink_st.h @@ -26,6 +26,7 @@  #define TI_WILINK_ST_H  #include <linux/skbuff.h> +#include <linux/wakelock.h>  /**   * enum proto-type - The protocol on WiLink chips which share a @@ -158,9 +159,20 @@ struct st_data_s {  	unsigned long ll_state;  	void *kim_data;  	struct tty_struct *tty; + +	struct wake_lock st_awake;  /* Held while controller is awake */  };  /* + * called when Bluetooth IC changes sleep state. + * + * This function dynamically changes pm_qos to allow + * CPU to go to deep idle state when there is no + * communication between host and Bluetooth IC. + */ +void st_pm_qos_update(struct st_data_s *st_gdata, bool awake); + +/*   * wrapper around tty->ops->write_room to check   * availability during firmware download   */ @@ -392,6 +404,9 @@ void st_ll_disable(struct st_data_s *);  unsigned long st_ll_getstate(struct st_data_s *);  unsigned long st_ll_sleep_state(struct st_data_s *, unsigned char);  void st_ll_wakeup(struct st_data_s *); +void omap_serial_runtime_get(int port_index); +void omap_serial_runtime_put(int port_index); +void omap_serial_relax(int port_index);  /*   * header information used by st_core.c for FM and GPS @@ -446,6 +461,7 @@ struct ti_st_plat_data {  	int (*chip_disable) (struct kim_data_s *);  	int (*chip_asleep) (struct kim_data_s *);  	int (*chip_awake) (struct kim_data_s *); +	int port_index;  };  #endif /* TI_WILINK_ST_H */ diff --git a/include/linux/tty.h b/include/linux/tty.h index 8780bd2a272..7a175b4b241 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -269,7 +269,10 @@ struct tty_struct {  	void *driver_data;  	struct list_head tty_files; -#define N_TTY_BUF_SIZE 4096 +  /* default was 4096 - at one place this is used in a short, so +   * can't be big. +   */ +#define N_TTY_BUF_SIZE 8192  	unsigned char closing:1;  	unsigned short minimum_to_wake; diff --git a/include/linux/uid_stat.h b/include/linux/uid_stat.h new file mode 100644 index 00000000000..6bd6c4e52d1 --- /dev/null +++ b/include/linux/uid_stat.h @@ -0,0 +1,29 @@ +/* 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/f_accessory.h b/include/linux/usb/f_accessory.h new file mode 100644 index 00000000000..ebe3c4d5930 --- /dev/null +++ b/include/linux/usb/f_accessory.h @@ -0,0 +1,23 @@ +/* + * 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 + +#include <uapi/linux/usb/f_accessory.h> + +#endif /* __LINUX_USB_F_ACCESSORY_H */ diff --git a/include/linux/usb/f_mtp.h b/include/linux/usb/f_mtp.h new file mode 100644 index 00000000000..4e8417791be --- /dev/null +++ b/include/linux/usb/f_mtp.h @@ -0,0 +1,23 @@ +/* + * 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 <uapi/linux/usb/f_mtp.h> + +#endif /* __LINUX_USB_F_MTP_H */ diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index 6b5978f5763..586152a6829 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h @@ -94,6 +94,10 @@ struct usb_phy {  	/* enable/disable VBUS */  	int	(*set_vbus)(struct usb_phy *x, int on); +	/* hold/unhold usb controller in reset */ +	int	(*hw_reset)(struct usb_phy *x, +				int enable); +  	/* effective for B devices, ignored for A-peripheral */  	int	(*set_power)(struct usb_phy *x,  				unsigned mA); @@ -181,6 +185,15 @@ usb_phy_vbus_off(struct usb_phy *x)  	return x->set_vbus(x, false);  } +static inline int +usb_phy_reset(struct usb_phy *x, int enable) +{ +	if (!x->hw_reset) +		return 0; + +	return x->hw_reset(x, enable); +} +  /* for usb host and peripheral controller drivers */  #if IS_ENABLED(CONFIG_USB_PHY)  extern struct usb_phy *usb_get_phy(enum usb_phy_type type); diff --git a/include/linux/wakelock.h b/include/linux/wakelock.h new file mode 100644 index 00000000000..f4a698a2288 --- /dev/null +++ b/include/linux/wakelock.h @@ -0,0 +1,67 @@ +/* include/linux/wakelock.h + * + * Copyright (C) 2007-2012 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/ktime.h> +#include <linux/device.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. + */ + +enum { +	WAKE_LOCK_SUSPEND, /* Prevent suspend */ +	WAKE_LOCK_TYPE_COUNT +}; + +struct wake_lock { +	struct wakeup_source ws; +}; + +static inline void wake_lock_init(struct wake_lock *lock, int type, +				  const char *name) +{ +	wakeup_source_init(&lock->ws, name); +} + +static inline void wake_lock_destroy(struct wake_lock *lock) +{ +	wakeup_source_trash(&lock->ws); +} + +static inline void wake_lock(struct wake_lock *lock) +{ +	__pm_stay_awake(&lock->ws); +} + +static inline void wake_lock_timeout(struct wake_lock *lock, long timeout) +{ +	__pm_wakeup_event(&lock->ws, jiffies_to_msecs(timeout)); +} + +static inline void wake_unlock(struct wake_lock *lock) +{ +	__pm_relax(&lock->ws); +} + +static inline int wake_lock_active(struct wake_lock *lock) +{ +	return lock->ws.active; +} + +#endif diff --git a/include/linux/wakeup_reason.h b/include/linux/wakeup_reason.h new file mode 100644 index 00000000000..7ce50f0debc --- /dev/null +++ b/include/linux/wakeup_reason.h @@ -0,0 +1,23 @@ +/* + * include/linux/wakeup_reason.h + * + * Logs the reason which caused the kernel to resume + * from the suspend mode. + * + * Copyright (C) 2014 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_WAKEUP_REASON_H +#define _LINUX_WAKEUP_REASON_H + +void log_wakeup_reason(int irq); + +#endif /* _LINUX_WAKEUP_REASON_H */ diff --git a/include/linux/wakeup_source_notify.h b/include/linux/wakeup_source_notify.h new file mode 100644 index 00000000000..98db849d13d --- /dev/null +++ b/include/linux/wakeup_source_notify.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2014 Motorola Mobility LLC. + * + * 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 WAKEUP_SOURCEE_NOTIFY_H +#define WAKEUP_SOURCE_NOTIFY_H + +#ifdef __KERNEL__ + +enum wakeup_request_type { +	WAKEUP_DISPLAY, +}; +#define WAKEUP_EVENT_START(type)	((type) << 8) +#define GET_WAKEUP_EVENT_TYPE(event)	((event) >> 8) + +enum display_wakeup_request { +	DISPLAY_WAKE_EVENT_BEGIN = WAKEUP_EVENT_START(WAKEUP_DISPLAY), +	DISPLAY_WAKE_EVENT_POWERKEY = DISPLAY_WAKE_EVENT_BEGIN, +	DISPLAY_WAKE_EVENT_TOUCH, +	DISPLAY_WAKE_EVENT_GESTURE, +	DISPLAY_WAKE_EVENT_GESTURE_VIEWON, +	DISPLAY_WAKE_EVENT_GESTURE_VIEWOFF, +	DISPLAY_WAKE_EVENT_DOCKON, +	DISPLAY_WAKE_EVENT_DOCKOFF, +	DISPLAY_WAKE_EVENT_END +}; + +#define	notify_display_wakeup(reason)	\ +	wakeup_source_notify_subscriber(DISPLAY_WAKE_EVENT_##reason) + +extern void wakeup_source_register_notify(struct notifier_block *nb); +extern void wakeup_source_unregister_notify(struct notifier_block *nb); +extern void wakeup_source_notify_subscriber(unsigned long event); +#endif /* __KERNEL__ */ + +#endif /* WAKEUP_SOURCE_NOTIFY_H */ diff --git a/include/linux/wifi_tiwlan.h b/include/linux/wifi_tiwlan.h new file mode 100644 index 00000000000..f07e0679fb8 --- /dev/null +++ b/include/linux/wifi_tiwlan.h @@ -0,0 +1,27 @@ +/* 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/wl12xx.h b/include/linux/wl12xx.h index a54fe82e704..f45adc2717e 100644 --- a/include/linux/wl12xx.h +++ b/include/linux/wl12xx.h @@ -51,6 +51,7 @@ enum {  struct wl12xx_platform_data {  	void (*set_power)(bool enable);  	/* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ +	int gpio;  	int irq;  	bool use_eeprom;  	int board_ref_clock; diff --git a/include/linux/wlan_plat.h b/include/linux/wlan_plat.h new file mode 100644 index 00000000000..40ec3482d1e --- /dev/null +++ b/include/linux/wlan_plat.h @@ -0,0 +1,27 @@ +/* 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/net/activity_stats.h b/include/net/activity_stats.h new file mode 100644 index 00000000000..10e4c1506ee --- /dev/null +++ b/include/net/activity_stats.h @@ -0,0 +1,25 @@ +/* + * 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. + * + * Author: Mike Chan (mike@android.com) + */ + +#ifndef __activity_stats_h +#define __activity_stats_h + +#ifdef CONFIG_NET_ACTIVITY_STATS +void activity_stats_update(void); +#else +#define activity_stats_update(void) {} +#endif + +#endif /* _NET_ACTIVITY_STATS_H */ diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 21f702704f2..96a8afe33c5 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h @@ -183,6 +183,8 @@ static inline bool ipv6_is_mld(struct sk_buff *skb, int nexthdr, int offset)  extern void addrconf_prefix_rcv(struct net_device *dev,  				u8 *opt, int len, bool sllao); +u32 addrconf_rt_table(const struct net_device *dev, u32 default_table); +  /*   *	anycast prototypes (anycast.c)   */ diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index e0512aaef4b..d84ec07b309 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -198,8 +198,10 @@ enum {  #define ESCO_2EV5	0x0100  #define ESCO_3EV5	0x0200 -#define SCO_ESCO_MASK  (ESCO_HV1 | ESCO_HV2 | ESCO_HV3) -#define EDR_ESCO_MASK  (ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) +#define SCO_ESCO_MASK	(ESCO_HV1 | ESCO_HV2 | ESCO_HV3) +#define EDR_ESCO_MASK	(ESCO_2EV3 | ESCO_3EV3 | ESCO_2EV5 | ESCO_3EV5) +#define ALL_ESCO_MASK	(SCO_ESCO_MASK | ESCO_EV3 | ESCO_EV4 | ESCO_EV5 | \ +			EDR_ESCO_MASK)  /* ACL flags */  #define ACL_START_NO_FLUSH	0x00 @@ -1628,6 +1630,9 @@ struct hci_conn_info {  	__u8     out;  	__u16    state;  	__u32    link_mode; +	__u32    mtu; +	__u32    cnt; +	__u32    pkts;  };  struct hci_dev_req { diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 7cb6d360d14..57123eeb21a 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -581,7 +581,8 @@ void hci_disconnect(struct hci_conn *conn, __u8 reason);  void hci_setup_sync(struct hci_conn *conn, __u16 handle);  void hci_sco_setup(struct hci_conn *conn, __u8 status); -struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst); +struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, +					__u16 pkt_type, bdaddr_t *dst);  int hci_conn_del(struct hci_conn *conn);  void hci_conn_hash_flush(struct hci_dev *hdev);  void hci_conn_check_pending(struct hci_dev *hdev); @@ -591,7 +592,8 @@ void hci_chan_del(struct hci_chan *chan);  void hci_chan_list_flush(struct hci_conn *conn);  struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle); -struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, +struct hci_conn *hci_connect(struct hci_dev *hdev, int type, +			     __u16 pkt_type, bdaddr_t *dst,  			     __u8 dst_type, __u8 sec_level, __u8 auth_type);  int hci_conn_check_link_mode(struct hci_conn *conn);  int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level); @@ -654,7 +656,7 @@ static inline void hci_conn_drop(struct hci_conn *conn)  			if (conn->state == BT_CONNECTED) {  				timeo = conn->disc_timeout;  				if (!conn->out) -					timeo *= 2; +					timeo *= 20;  			} else {  				timeo = msecs_to_jiffies(10);  			} diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h index 1e35c43657c..6d1857ab8e5 100644 --- a/include/net/bluetooth/sco.h +++ b/include/net/bluetooth/sco.h @@ -37,6 +37,7 @@  struct sockaddr_sco {  	sa_family_t	sco_family;  	bdaddr_t	sco_bdaddr; +	__u16		sco_pkt_type;  };  /* SCO socket options */ @@ -72,7 +73,8 @@ struct sco_conn {  struct sco_pinfo {  	struct bt_sock	bt; -	__u32		flags; +	__u16		pkt_type; +  	struct sco_conn	*conn;  }; diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 26b5b692c22..03cbb70b24b 100644..100755 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -611,6 +611,30 @@ struct cfg80211_ap_settings {  };  /** + * struct cfg80211_csa_settings - channel switch settings + * + * Used for channel switch + * + * @chandef: defines the channel to use after the switch + * @beacon_csa: beacon data while performing the switch + * @counter_offset_beacon: offset for the counter within the beacon (tail) + * @counter_offset_presp: offset for the counter within the probe response + * @beacon_after: beacon data to be used on the new channel + * @radar_required: whether radar detection is required on the new channel + * @block_tx: whether transmissions should be blocked while changing + * @count: number of beacons until switch + */ +struct cfg80211_csa_settings { +	struct cfg80211_chan_def chandef; +	struct cfg80211_beacon_data beacon_csa; +	u16 counter_offset_beacon, counter_offset_presp; +	struct cfg80211_beacon_data beacon_after; +	bool radar_required; +	bool block_tx; +	u8 count; +}; + +/**   * enum station_parameters_apply_mask - station parameter values to apply   * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)   * @STATION_PARAM_APPLY_CAPABILITY: apply new capability @@ -1241,6 +1265,9 @@ struct cfg80211_ssid {   * @scan_start: time (in jiffies) when the scan started   * @wdev: the wireless device to scan for   * @aborted: (internal) scan request was notified as aborted + * @min_dwell: minimum time to wait on each channel for active scans + * @max_dwell: maximum time to wait on each channel for active scans + * @num_probe: number of probe requests to transmit on each active scan channel   * @no_cck: used to send probe requests at non CCK rate in 2GHz band   */  struct cfg80211_scan_request { @@ -1261,6 +1288,10 @@ struct cfg80211_scan_request {  	bool aborted;  	bool no_cck; +	u32 min_dwell; +	u32 max_dwell; +	u8 num_probe; +  	/* keep last */  	struct ieee80211_channel *channels[0];  }; @@ -1280,7 +1311,10 @@ struct cfg80211_match_set {   * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)   * @n_ssids: number of SSIDs   * @n_channels: total number of channels to scan - * @interval: interval between each scheduled scan cycle + * @long_interval: interval between each long scheduled scan cycle + * @short_interval: interval between each short scheduled scan cycle + * @n_short_intevals: number of short intervals scheduled scan cycles before + *      switching to the long interval   * @ie: optional information element(s) to add into Probe Request or %NULL   * @ie_len: length of ie in octets   * @flags: bit field of flags controlling operation @@ -1299,7 +1333,9 @@ struct cfg80211_sched_scan_request {  	struct cfg80211_ssid *ssids;  	int n_ssids;  	u32 n_channels; -	u32 interval; +	u32 long_interval; +	u32 short_interval; +	u8 n_short_intervals;  	const u8 *ie;  	size_t ie_len;  	u32 flags; @@ -1875,6 +1911,7 @@ struct cfg80211_update_ft_ies_params {   *	the driver, and will be valid until passed to cfg80211_scan_done().   *	For scan results, call cfg80211_inform_bss(); you can call this outside   *	the scan/scan_done bracket too. + * @scan_cancel: Stop currently running scan (both sw and hw).   *   * @auth: Request to authenticate with the specified peer   * @assoc: Request to (re)associate with the specified peer @@ -2008,6 +2045,9 @@ struct cfg80211_update_ft_ies_params {   *	driver can take the most appropriate actions.   * @crit_proto_stop: Indicates critical protocol no longer needs increased link   *	reliability. This operation can not fail. + * @set_coalesce: Set coalesce parameters. + * + * @channel_switch: initiate channel-switch procedure (with CSA)   */  struct cfg80211_ops {  	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); @@ -2098,6 +2138,7 @@ struct cfg80211_ops {  	int	(*scan)(struct wiphy *wiphy,  			struct cfg80211_scan_request *request); +	void    (*scan_cancel)(struct wiphy *wiphy, struct net_device *dev);  	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,  			struct cfg80211_auth_request *req); @@ -2243,6 +2284,10 @@ struct cfg80211_ops {  				    u16 duration);  	void	(*crit_proto_stop)(struct wiphy *wiphy,  				   struct wireless_dev *wdev); + +	int	(*channel_switch)(struct wiphy *wiphy, +				  struct net_device *dev, +				  struct cfg80211_csa_settings *params);  };  /* @@ -2307,6 +2352,9 @@ struct cfg80211_ops {   *	responds to probe-requests in hardware.   * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.   * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call. + * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels. + * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in + *	beaconing mode (AP, IBSS, Mesh, ...).   */  enum wiphy_flags {  	WIPHY_FLAG_CUSTOM_REGULATORY		= BIT(0), @@ -2330,6 +2378,8 @@ enum wiphy_flags {  	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),  	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),  	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21), +	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22), +	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),  };  /** @@ -3299,6 +3349,30 @@ void cfg80211_sched_scan_results(struct wiphy *wiphy);  void cfg80211_sched_scan_stopped(struct wiphy *wiphy);  /** + * cfg80211_current_sched_scan_request - get current cached + * sched scan request + * + * @wiphy: the wiphy on which the scheduled scan is active + * + * The driver can call this function to get a reference of + * the current active scheduled scan request parameters. + * + * Return: A referenced struct, or NULL if request is no loner available. + */ +struct cfg80211_sched_scan_request * +cfg80211_current_sched_scan_request(struct wiphy *wiphy); + +/** + * cfg80211_send_intermediate_result - inform userspace about new + * scan result. + * + * @dev: network device + * @cbss: bss info to report. + */ +void cfg80211_send_intermediate_result(struct net_device *dev, +				       struct cfg80211_bss *cbss); + +/**   * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame   *   * @wiphy: the wiphy reporting the BSS @@ -3937,6 +4011,16 @@ void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,  			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);  /** + * cfg80211_roaming_status - notify userspace about changes in the driver + * ability to support roaming + * @dev: network device + * @enabled: indicates whether roaming is supported at the current time + * @gfp: allocation flags + */ +void cfg80211_roaming_status(struct net_device *dev, +			     bool enabled, gfp_t gfp); + +/**   * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying   * @dev: network device   * @bssid: BSSID of AP (to avoid races) diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index e361f488242..4ac12e14c6d 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h @@ -23,6 +23,8 @@ struct fib_rule {  	struct fib_rule __rcu	*ctarget;  	char			iifname[IFNAMSIZ];  	char			oifname[IFNAMSIZ]; +	kuid_t			uid_start; +	kuid_t			uid_end;  	struct rcu_head		rcu;  	struct net *		fr_net;  }; @@ -80,7 +82,9 @@ struct fib_rules_ops {  	[FRA_FWMARK]	= { .type = NLA_U32 }, \  	[FRA_FWMASK]	= { .type = NLA_U32 }, \  	[FRA_TABLE]     = { .type = NLA_U32 }, \ -	[FRA_GOTO]	= { .type = NLA_U32 } +	[FRA_GOTO]	= { .type = NLA_U32 }, \ +	[FRA_UID_START]	= { .type = NLA_U32 }, \ +	[FRA_UID_END]	= { .type = NLA_U32 }  static inline void fib_rule_get(struct fib_rule *rule)  { diff --git a/include/net/flow.h b/include/net/flow.h index 628e11b98c5..c91e2aae3fb 100644 --- a/include/net/flow.h +++ b/include/net/flow.h @@ -10,6 +10,7 @@  #include <linux/socket.h>  #include <linux/in6.h>  #include <linux/atomic.h> +#include <linux/uidgid.h>  struct flowi_common {  	int	flowic_oif; @@ -23,6 +24,7 @@ struct flowi_common {  #define FLOWI_FLAG_CAN_SLEEP		0x02  #define FLOWI_FLAG_KNOWN_NH		0x04  	__u32	flowic_secid; +	kuid_t	flowic_uid;  };  union flowi_uli { @@ -59,6 +61,7 @@ struct flowi4 {  #define flowi4_proto		__fl_common.flowic_proto  #define flowi4_flags		__fl_common.flowic_flags  #define flowi4_secid		__fl_common.flowic_secid +#define flowi4_uid		__fl_common.flowic_uid  	/* (saddr,daddr) must be grouped, same order as in IP header */  	__be32			saddr; @@ -78,7 +81,8 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif,  				      __u32 mark, __u8 tos, __u8 scope,  				      __u8 proto, __u8 flags,  				      __be32 daddr, __be32 saddr, -				      __be16 dport, __be16 sport) +				      __be16 dport, __be16 sport, +				      kuid_t uid)  {  	fl4->flowi4_oif = oif;  	fl4->flowi4_iif = 0; @@ -88,6 +92,7 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif,  	fl4->flowi4_proto = proto;  	fl4->flowi4_flags = flags;  	fl4->flowi4_secid = 0; +	fl4->flowi4_uid = uid;  	fl4->daddr = daddr;  	fl4->saddr = saddr;  	fl4->fl4_dport = dport; @@ -115,6 +120,7 @@ struct flowi6 {  #define flowi6_proto		__fl_common.flowic_proto  #define flowi6_flags		__fl_common.flowic_flags  #define flowi6_secid		__fl_common.flowic_secid +#define flowi6_uid		__fl_common.flowic_uid  	struct in6_addr		daddr;  	struct in6_addr		saddr;  	__be32			flowlabel; @@ -158,6 +164,7 @@ struct flowi {  #define flowi_proto	u.__fl_common.flowic_proto  #define flowi_flags	u.__fl_common.flowic_flags  #define flowi_secid	u.__fl_common.flowic_secid +#define flowi_uid	u.__fl_common.flowic_uid  } __attribute__((__aligned__(BITS_PER_LONG/8)));  static inline struct flowi *flowi4_to_flowi(struct flowi4 *fl4) diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 7235ae73a1e..9528e10fa0b 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h @@ -88,6 +88,7 @@ struct inet_request_sock {  				acked	   : 1,  				no_srccheck: 1;  	kmemcheck_bitfield_end(flags); +	u32                     ir_mark;  	struct ip_options_rcu	*opt;  }; @@ -96,6 +97,14 @@ static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)  	return (struct inet_request_sock *)sk;  } +static inline u32 inet_request_mark(struct sock *sk, struct sk_buff *skb) +{ +	if (!sk->sk_mark && sock_net(sk)->ipv4.sysctl_tcp_fwmark_accept) +		return skb->mark; + +	return sk->sk_mark; +} +  struct inet_cork {  	unsigned int		flags;  	__be32			addr; diff --git a/include/net/ip.h b/include/net/ip.h index a68f838a132..02fc145ecc4 100644 --- a/include/net/ip.h +++ b/include/net/ip.h @@ -153,6 +153,7 @@ struct ip_reply_arg {  				/* -1 if not needed */   	int	    bound_dev_if;  	u8  	    tos; +	kuid_t	    uid;  };   #define IP_REPLY_ARG_NOSRCCHECK 1 @@ -225,6 +226,9 @@ extern void ipfrag_init(void);  extern void ip_static_sysctl_init(void); +#define IP4_REPLY_MARK(net, mark) \ +	((net)->ipv4.sysctl_fwmark_reflect ? (mark) : 0) +  static inline bool ip_is_fragment(const struct iphdr *iph)  {  	return (iph->frag_off & htons(IP_MF | IP_OFFSET)) != 0; diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 260f83f16bc..25b4500f28c 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h @@ -131,7 +131,7 @@ extern int			rt6_route_rcv(struct net_device *dev,  					      const struct in6_addr *gwaddr);  extern void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, -			    int oif, u32 mark); +			    int oif, u32 mark, kuid_t uid);  extern void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk,  			       __be32 mtu);  extern void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark); diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 0810aa57c78..cc344ca9d0a 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -111,6 +111,9 @@ struct frag_hdr {  #define	IP6_MF	0x0001 +#define IP6_REPLY_MARK(net, mark) \ +	((net)->ipv6.sysctl.fwmark_reflect ? (mark) : 0) +  #include <net/sock.h>  /* sysctls */ @@ -260,6 +263,12 @@ static inline void fl6_sock_release(struct ip6_flowlabel *fl)  extern void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info); +int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, +			       struct icmp6hdr *thdr, int len); + +struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb, +				      struct sock *sk, struct flowi6 *fl6); +  extern int 			ip6_ra_control(struct sock *sk, int sel);  extern int			ipv6_parse_hopopts(struct sk_buff *skb); diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 885898a40d1..8a0d291f5c0 100644..100755 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -152,11 +152,14 @@ struct ieee80211_low_level_stats {   * @IEEE80211_CHANCTX_CHANGE_WIDTH: The channel width changed   * @IEEE80211_CHANCTX_CHANGE_RX_CHAINS: The number of RX chains changed   * @IEEE80211_CHANCTX_CHANGE_RADAR: radar detection flag changed + * @IEEE80211_CHANCTX_CHANGE_CHANNEL: switched to another operating channel, + *	this is used only with channel switching with CSA   */  enum ieee80211_chanctx_change {  	IEEE80211_CHANCTX_CHANGE_WIDTH		= BIT(0),  	IEEE80211_CHANCTX_CHANGE_RX_CHAINS	= BIT(1),  	IEEE80211_CHANCTX_CHANGE_RADAR		= BIT(2), +	IEEE80211_CHANCTX_CHANGE_CHANNEL	= BIT(3),  };  /** @@ -1065,6 +1068,7 @@ enum ieee80211_vif_flags {   * @addr: address of this interface   * @p2p: indicates whether this AP or STA interface is a p2p   *	interface, i.e. a GO or p2p-sta respectively + * @csa_active: marks whether a channel switch is going on   * @driver_flags: flags/capabilities the driver has for this interface,   *	these need to be set (or cleared) when the interface is added   *	or, if supported by the driver, the interface type is changed @@ -1079,6 +1083,7 @@ enum ieee80211_vif_flags {   * @debugfs_dir: debugfs dentry, can be used by drivers to create own per   *      interface debug files. Note that it will be NULL for the virtual   *	monitor interface (if that is requested.) + * @dummy_p2p: dummy p2p interface - not used for data   * @drv_priv: data area for driver use, will always be aligned to   *	sizeof(void *).   */ @@ -1087,6 +1092,7 @@ struct ieee80211_vif {  	struct ieee80211_bss_conf bss_conf;  	u8 addr[ETH_ALEN];  	bool p2p; +	bool csa_active;  	u8 cab_queue;  	u8 hw_queue[IEEE80211_NUM_ACS]; @@ -1099,6 +1105,8 @@ struct ieee80211_vif {  	struct dentry *debugfs_dir;  #endif +	bool dummy_p2p; +  	/* must be last */  	u8 drv_priv[0] __aligned(sizeof(void *));  }; @@ -1264,6 +1272,9 @@ struct ieee80211_sta_rates {   * @supp_rates: Bitmap of supported rates (per band)   * @ht_cap: HT capabilities of this STA; restricted to our own capabilities   * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities + * @max_rx_aggregation_subframes: restriction on rx buff size for this active + *	link. Initially set to local->hw.max_rx_aggregation_subframes but can + *	be modified by driver.   * @wme: indicates whether the STA supports WME. Only valid during AP-mode.   * @drv_priv: data area for driver use, will always be aligned to   *	sizeof(void *), size is determined in hw information. @@ -1284,6 +1295,7 @@ struct ieee80211_sta {  	u16 aid;  	struct ieee80211_sta_ht_cap ht_cap;  	struct ieee80211_sta_vht_cap vht_cap; +	u8 max_rx_aggregation_subframes;  	bool wme;  	u8 uapsd_queues;  	u8 max_sp; @@ -2618,6 +2630,16 @@ enum ieee80211_roc_type {   * @ipv6_addr_change: IPv6 address assignment on the given interface changed.   *	Currently, this is only called for managed or P2P client interfaces.   *	This callback is optional; it must not sleep. + * + * @channel_switch_beacon: Starts a channel switch to a new channel. + *	Beacons are modified to include CSA or ECSA IEs before calling this + *	function. The corresponding count fields in these IEs must be + *	decremented, and when they reach zero the driver must call + *	ieee80211_csa_finish(). Drivers which use ieee80211_beacon_get() + *	get the csa counter decremented by mac80211, but must check if it is + *	zero using ieee80211_csa_is_complete() after the beacon has been + *	transmitted and then call ieee80211_csa_finish(). + *   */  struct ieee80211_ops {  	void (*tx)(struct ieee80211_hw *hw, @@ -2747,7 +2769,8 @@ struct ieee80211_ops {  				 struct ieee80211_vif *vif,  				 struct ieee80211_channel *chan,  				 int duration, -				 enum ieee80211_roc_type type); +				 enum ieee80211_roc_type type, +				 unsigned long cookie);  	int (*cancel_remain_on_channel)(struct ieee80211_hw *hw);  	int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx);  	void (*get_ringparam)(struct ieee80211_hw *hw, @@ -2805,6 +2828,9 @@ struct ieee80211_ops {  				 struct ieee80211_vif *vif,  				 struct inet6_dev *idev);  #endif +	void (*channel_switch_beacon)(struct ieee80211_hw *hw, +				      struct ieee80211_vif *vif, +				      struct cfg80211_chan_def *chandef);  };  /** @@ -3255,6 +3281,17 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,  void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets);  /** + * ieee80211_roaming_status - report if roaming support by the driver changed + * + * Some drivers have limitations on roaming in certain conditions (e.g. multi + * role) and need to report this back to userspace. + * + * @vif: interface + * @enabled: is roaming supported + */ +void ieee80211_roaming_status(struct ieee80211_vif *vif, bool enabled); + +/**   * ieee80211_beacon_get_tim - beacon generation function   * @hw: pointer obtained from ieee80211_alloc_hw().   * @vif: &struct ieee80211_vif pointer from the add_interface callback. @@ -3300,6 +3337,25 @@ static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,  }  /** + * ieee80211_csa_finish - notify mac80211 about channel switch + * @vif: &struct ieee80211_vif pointer from the add_interface callback. + * + * After a channel switch announcement was scheduled and the counter in this + * announcement hit zero, this function must be called by the driver to + * notify mac80211 that the channel can be changed. + */ +void ieee80211_csa_finish(struct ieee80211_vif *vif); + +/** + * ieee80211_csa_is_complete - find out if counters reached zero + * @vif: &struct ieee80211_vif pointer from the add_interface callback. + * + * This function returns whether the channel switch counters reached zero. + */ +bool ieee80211_csa_is_complete(struct ieee80211_vif *vif); + + +/**   * ieee80211_proberesp_get - retrieve a Probe Response template   * @hw: pointer obtained from ieee80211_alloc_hw().   * @vif: &struct ieee80211_vif pointer from the add_interface callback. @@ -4112,7 +4168,7 @@ void ieee80211_ready_on_channel(struct ieee80211_hw *hw);   * ieee80211_remain_on_channel_expired - remain_on_channel duration expired   * @hw: pointer as obtained from ieee80211_alloc_hw()   */ -void ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw); +void ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw, u64 cookie);  /**   * ieee80211_stop_rx_ba_session - callback to stop existing BA sessions @@ -4132,6 +4188,23 @@ void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap,  				  const u8 *addr);  /** + * ieee80211_change_rx_ba_max_subframes - callback to change + *	sta.max_rx_aggregation_subframes and stop existing BA sessions + * + * This capability is usefull in cases of IOP, i.e. cases where peer sta + * or ap doesn't respect the max subframes in a single-frame and uses the + * max window size instead. In these cases the driver/chip may recover by + * decreasing the max_rx_aggregation_subframes to use the single frame + * limitation. + * + * @vif: &struct ieee80211_vif pointer from the add_interface callback. + * @addr: & to bssid mac address + * @max_subframes: new max_rx_aggregation_subframes for this sta + */ +void ieee80211_change_rx_ba_max_subframes(struct ieee80211_vif *vif, +					  const u8 *addr, +					  u8 max_subframes); +/**   * ieee80211_send_bar - send a BlockAckReq frame   *   * can be used to flush pending frames from the peer's aggregation reorder diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 2ba9de89e8e..0dd6f0b3ead 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -64,6 +64,9 @@ struct netns_ipv4 {  	int sysctl_tcp_ecn; +	int sysctl_fwmark_reflect; +	int sysctl_tcp_fwmark_accept; +  	kgid_t sysctl_ping_group_range[2];  	long sysctl_tcp_mem[3]; diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 005e2c2e39a..4b9f99e3a91 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -28,6 +28,7 @@ struct netns_sysctl_ipv6 {  	int ip6_rt_mtu_expires;  	int ip6_rt_min_advmss;  	int icmpv6_time; +	int fwmark_reflect;  };  struct netns_ipv6 { diff --git a/include/net/ping.h b/include/net/ping.h index 682b5ae9af5..2db4860e584 100644 --- a/include/net/ping.h +++ b/include/net/ping.h @@ -13,6 +13,7 @@  #ifndef _PING_H  #define _PING_H +#include <net/icmp.h>  #include <net/netns/hash.h>  /* PING_HTABLE_SIZE must be power of 2 */ @@ -28,6 +29,18 @@   */  #define GID_T_MAX (((gid_t)~0U) >> 1) +/* Compatibility glue so we can support IPv6 when it's compiled as a module */ +struct pingv6_ops { +	int (*ipv6_recv_error)(struct sock *sk, struct msghdr *msg, int len); +	int (*ip6_datagram_recv_ctl)(struct sock *sk, struct msghdr *msg, +				     struct sk_buff *skb); +	int (*icmpv6_err_convert)(u8 type, u8 code, int *err); +	void (*ipv6_icmp_error)(struct sock *sk, struct sk_buff *skb, int err, +				__be16 port, u32 info, u8 *payload); +	int (*ipv6_chk_addr)(struct net *net, const struct in6_addr *addr, +			     const struct net_device *dev, int strict); +}; +  struct ping_table {  	struct hlist_nulls_head	hash[PING_HTABLE_SIZE];  	rwlock_t		lock; @@ -39,10 +52,39 @@ struct ping_iter_state {  };  extern struct proto ping_prot; +extern struct ping_table ping_table; +#if IS_ENABLED(CONFIG_IPV6) +extern struct pingv6_ops pingv6_ops; +#endif +struct pingfakehdr { +	struct icmphdr icmph; +	struct iovec *iov; +	sa_family_t family; +	__wsum wcheck; +}; -extern void ping_rcv(struct sk_buff *); -extern void ping_err(struct sk_buff *, u32 info); +int  ping_get_port(struct sock *sk, unsigned short ident); +void ping_hash(struct sock *sk); +void ping_unhash(struct sock *sk); + +int  ping_init_sock(struct sock *sk); +void ping_close(struct sock *sk, long timeout); +int  ping_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len); +void ping_err(struct sk_buff *skb, int offset, u32 info); +int  ping_getfrag(void *from, char *to, int offset, int fraglen, int odd, +		  struct sk_buff *); + +int  ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, +		  size_t len, int noblock, int flags, int *addr_len); +int  ping_common_sendmsg(int family, struct msghdr *msg, size_t len, +			 void *user_icmph, size_t icmph_len); +int  ping_v4_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, +		     size_t len); +int  ping_v6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, +		     size_t len); +int  ping_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); +void ping_rcv(struct sk_buff *skb);  #ifdef CONFIG_PROC_FS  extern int __init ping_proc_init(void); @@ -50,6 +92,7 @@ extern void ping_proc_exit(void);  #endif  void __init ping_init(void); - +int  __init pingv6_init(void); +void pingv6_exit(void);  #endif /* _PING_H */ diff --git a/include/net/route.h b/include/net/route.h index 2ea40c1b5e0..647bb2adbff 100644 --- a/include/net/route.h +++ b/include/net/route.h @@ -142,7 +142,7 @@ static inline struct rtable *ip_route_output_ports(struct net *net, struct flowi  	flowi4_init_output(fl4, oif, sk ? sk->sk_mark : 0, tos,  			   RT_SCOPE_UNIVERSE, proto,  			   sk ? inet_sk_flowi_flags(sk) : 0, -			   daddr, saddr, dport, sport); +			   daddr, saddr, dport, sport, sk ? sock_i_uid(sk) : 0);  	if (sk)  		security_sk_classify_flow(sk, flowi4_to_flowi(fl4));  	return ip_route_output_flow(net, fl4, sk); @@ -253,7 +253,8 @@ static inline void ip_route_connect_init(struct flowi4 *fl4, __be32 dst, __be32  		flow_flags |= FLOWI_FLAG_CAN_SLEEP;  	flowi4_init_output(fl4, oif, sk->sk_mark, tos, RT_SCOPE_UNIVERSE, -			   protocol, flow_flags, dst, src, dport, sport); +			   protocol, flow_flags, dst, src, dport, sport, +			   sock_i_uid(sk));  }  static inline struct rtable *ip_route_connect(struct flowi4 *fl4, diff --git a/include/net/tcp.h b/include/net/tcp.h index 5bba80fbd1d..cfb55e14b25 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -287,6 +287,7 @@ extern int sysctl_tcp_thin_dupack;  extern int sysctl_tcp_early_retrans;  extern int sysctl_tcp_limit_output_bytes;  extern int sysctl_tcp_challenge_ack_limit; +extern int sysctl_tcp_default_init_rwnd;  extern atomic_long_t tcp_memory_allocated;  extern struct percpu_counter tcp_sockets_allocated; @@ -1550,6 +1551,8 @@ extern struct sk_buff **tcp4_gro_receive(struct sk_buff **head,  extern int tcp_gro_complete(struct sk_buff *skb);  extern int tcp4_gro_complete(struct sk_buff *skb); +extern int tcp_nuke_addr(struct net *net, struct sockaddr *addr); +  #ifdef CONFIG_PROC_FS  extern int tcp4_proc_init(void);  extern void tcp4_proc_exit(void); diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index 938b7fd1120..eb40e71ff2e 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h @@ -11,6 +11,7 @@ extern struct proto rawv6_prot;  extern struct proto udpv6_prot;  extern struct proto udplitev6_prot;  extern struct proto tcpv6_prot; +extern struct proto pingv6_prot;  struct flowi6; @@ -21,6 +22,8 @@ extern int				ipv6_frag_init(void);  extern void				ipv6_frag_exit(void);  /* transport protocols */ +extern int				pingv6_init(void); +extern void				pingv6_exit(void);  extern int				rawv6_init(void);  extern void				rawv6_exit(void);  extern int				udpv6_init(void); diff --git a/include/trace/events/cpufreq_interactive.h b/include/trace/events/cpufreq_interactive.h new file mode 100644 index 00000000000..951e6ca12da --- /dev/null +++ b/include/trace/events/cpufreq_interactive.h @@ -0,0 +1,112 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM cpufreq_interactive + +#if !defined(_TRACE_CPUFREQ_INTERACTIVE_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_CPUFREQ_INTERACTIVE_H + +#include <linux/tracepoint.h> + +DECLARE_EVENT_CLASS(set, +	TP_PROTO(u32 cpu_id, unsigned long targfreq, +	         unsigned long actualfreq), +	TP_ARGS(cpu_id, targfreq, actualfreq), + +	TP_STRUCT__entry( +	    __field(          u32, cpu_id    ) +	    __field(unsigned long, targfreq   ) +	    __field(unsigned long, actualfreq ) +	   ), + +	TP_fast_assign( +	    __entry->cpu_id = (u32) cpu_id; +	    __entry->targfreq = targfreq; +	    __entry->actualfreq = actualfreq; +	), + +	TP_printk("cpu=%u targ=%lu actual=%lu", +	      __entry->cpu_id, __entry->targfreq, +	      __entry->actualfreq) +); + +DEFINE_EVENT(set, cpufreq_interactive_setspeed, +	TP_PROTO(u32 cpu_id, unsigned long targfreq, +	     unsigned long actualfreq), +	TP_ARGS(cpu_id, targfreq, actualfreq) +); + +DECLARE_EVENT_CLASS(loadeval, +	    TP_PROTO(unsigned long cpu_id, unsigned long load, +		     unsigned long curtarg, unsigned long curactual, +		     unsigned long newtarg), +		    TP_ARGS(cpu_id, load, curtarg, curactual, newtarg), + +	    TP_STRUCT__entry( +		    __field(unsigned long, cpu_id    ) +		    __field(unsigned long, load      ) +		    __field(unsigned long, curtarg   ) +		    __field(unsigned long, curactual ) +		    __field(unsigned long, newtarg   ) +	    ), + +	    TP_fast_assign( +		    __entry->cpu_id = cpu_id; +		    __entry->load = load; +		    __entry->curtarg = curtarg; +		    __entry->curactual = curactual; +		    __entry->newtarg = newtarg; +	    ), + +	    TP_printk("cpu=%lu load=%lu cur=%lu actual=%lu targ=%lu", +		      __entry->cpu_id, __entry->load, __entry->curtarg, +		      __entry->curactual, __entry->newtarg) +); + +DEFINE_EVENT(loadeval, cpufreq_interactive_target, +	    TP_PROTO(unsigned long cpu_id, unsigned long load, +		     unsigned long curtarg, unsigned long curactual, +		     unsigned long newtarg), +	    TP_ARGS(cpu_id, load, curtarg, curactual, newtarg) +); + +DEFINE_EVENT(loadeval, cpufreq_interactive_already, +	    TP_PROTO(unsigned long cpu_id, unsigned long load, +		     unsigned long curtarg, unsigned long curactual, +		     unsigned long newtarg), +	    TP_ARGS(cpu_id, load, curtarg, curactual, newtarg) +); + +DEFINE_EVENT(loadeval, cpufreq_interactive_notyet, +	    TP_PROTO(unsigned long cpu_id, unsigned long load, +		     unsigned long curtarg, unsigned long curactual, +		     unsigned long newtarg), +	    TP_ARGS(cpu_id, load, curtarg, curactual, newtarg) +); + +TRACE_EVENT(cpufreq_interactive_boost, +	    TP_PROTO(const char *s), +	    TP_ARGS(s), +	    TP_STRUCT__entry( +		    __string(s, s) +	    ), +	    TP_fast_assign( +		    __assign_str(s, s); +	    ), +	    TP_printk("%s", __get_str(s)) +); + +TRACE_EVENT(cpufreq_interactive_unboost, +	    TP_PROTO(const char *s), +	    TP_ARGS(s), +	    TP_STRUCT__entry( +		    __string(s, s) +	    ), +	    TP_fast_assign( +		    __assign_str(s, s); +	    ), +	    TP_printk("%s", __get_str(s)) +); + +#endif /* _TRACE_CPUFREQ_INTERACTIVE_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h> diff --git a/include/trace/events/gpu.h b/include/trace/events/gpu.h new file mode 100644 index 00000000000..7e15cdfafe5 --- /dev/null +++ b/include/trace/events/gpu.h @@ -0,0 +1,143 @@ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM gpu + +#if !defined(_TRACE_GPU_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_GPU_H + +#include <linux/tracepoint.h> +#include <linux/time.h> + +#define show_secs_from_ns(ns) \ +	({ \ +		u64 t = ns + (NSEC_PER_USEC / 2); \ +		do_div(t, NSEC_PER_SEC); \ +		t; \ +	}) + +#define show_usecs_from_ns(ns) \ +	({ \ +		u64 t = ns + (NSEC_PER_USEC / 2) ; \ +		u32 rem; \ +		do_div(t, NSEC_PER_USEC); \ +		rem = do_div(t, USEC_PER_SEC); \ +	}) + +/* + * The gpu_sched_switch event indicates that a switch from one GPU context to + * another occurred on one of the GPU hardware blocks. + * + * The gpu_name argument identifies the GPU hardware block.  Each independently + * scheduled GPU hardware block should have a different name.  This may be used + * in different ways for different GPUs.  For example, if a GPU includes + * multiple processing cores it may use names "GPU 0", "GPU 1", etc.  If a GPU + * includes a separately scheduled 2D and 3D hardware block, it might use the + * names "2D" and "3D". + * + * The timestamp argument is the timestamp at which the switch occurred on the + * GPU. These timestamps are in units of nanoseconds and must use + * approximately the same time as sched_clock, though they need not come from + * any CPU clock. The timestamps for a single hardware block must be + * monotonically nondecreasing.  This means that if a variable compensation + * offset is used to translate from some other clock to the sched_clock, then + * care must be taken when increasing that offset, and doing so may result in + * multiple events with the same timestamp. + * + * The next_ctx_id argument identifies the next context that was running on + * the GPU hardware block.  A value of 0 indicates that the hardware block + * will be idle. + * + * The next_prio argument indicates the priority of the next context at the + * time of the event.  The exact numeric values may mean different things for + * different GPUs, but they should follow the rule that lower values indicate a + * higher priority. + * + * The next_job_id argument identifies the batch of work that the GPU will be + * working on.  This should correspond to a job_id that was previously traced + * as a gpu_job_enqueue event when the batch of work was created. + */ +TRACE_EVENT(gpu_sched_switch, + +	TP_PROTO(const char *gpu_name, u64 timestamp, +		u32 next_ctx_id, s32 next_prio, u32 next_job_id), + +	TP_ARGS(gpu_name, timestamp, next_ctx_id, next_prio, next_job_id), + +	TP_STRUCT__entry( +		__string(       gpu_name,       gpu_name        ) +		__field(        u64,            timestamp       ) +		__field(        u32,            next_ctx_id     ) +		__field(        s32,            next_prio       ) +		__field(        u32,            next_job_id     ) +	), + +	TP_fast_assign( +		__assign_str(gpu_name, gpu_name); +		__entry->timestamp = timestamp; +		__entry->next_ctx_id = next_ctx_id; +		__entry->next_prio = next_prio; +		__entry->next_job_id = next_job_id; +	), + +	TP_printk("gpu_name=%s ts=%llu.%06lu next_ctx_id=%lu next_prio=%ld " +		"next_job_id=%lu", +		__get_str(gpu_name), +		(unsigned long long)show_secs_from_ns(__entry->timestamp), +		(unsigned long)show_usecs_from_ns(__entry->timestamp), +		(unsigned long)__entry->next_ctx_id, +		(long)__entry->next_prio, +		(unsigned long)__entry->next_job_id) +); + +/* + * The gpu_job_enqueue event indicates that a batch of work has been queued up + * to be processed by the GPU.  This event is not intended to indicate that + * the batch of work has been submitted to the GPU hardware, but rather that + * it has been submitted to the GPU kernel driver. + * + * This event should be traced on the thread that initiated the work being + * queued.  For example, if a batch of work is submitted to the kernel by a + * userland thread, the event should be traced on that thread. + * + * The ctx_id field identifies the GPU context in which the batch of work + * being queued is to be run. + * + * The job_id field identifies the batch of work being queued within the given + * GPU context.  The first batch of work submitted for a given GPU context + * should have a job_id of 0, and each subsequent batch of work should + * increment the job_id by 1. + * + * The type field identifies the type of the job being enqueued.  The job + * types may be different for different GPU hardware.  For example, a GPU may + * differentiate between "2D", "3D", and "compute" jobs. + */ +TRACE_EVENT(gpu_job_enqueue, + +	TP_PROTO(u32 ctx_id, u32 job_id, const char *type), + +	TP_ARGS(ctx_id, job_id, type), + +	TP_STRUCT__entry( +		__field(        u32,            ctx_id          ) +		__field(        u32,            job_id          ) +		__string(       type,           type            ) +	), + +	TP_fast_assign( +		__entry->ctx_id = ctx_id; +		__entry->job_id = job_id; +		__assign_str(type, type); +	), + +	TP_printk("ctx_id=%lu job_id=%lu type=%s", +		(unsigned long)__entry->ctx_id, +		(unsigned long)__entry->job_id, +		__get_str(type)) +); + +#undef show_secs_from_ns +#undef show_usecs_from_ns + +#endif /* _TRACE_GPU_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h> diff --git a/include/trace/events/mmc.h b/include/trace/events/mmc.h new file mode 100644 index 00000000000..82b368dbcef --- /dev/null +++ b/include/trace/events/mmc.h @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2013 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. + * + */ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM mmc + +#if !defined(_TRACE_MMC_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_MMC_H + +#include <linux/tracepoint.h> +#include <linux/mmc/mmc.h> +#include <linux/mmc/core.h> + +/* + * Unconditional logging of mmc block erase operations, + * including cmd, address, size + */ +DECLARE_EVENT_CLASS(mmc_blk_erase_class, +	TP_PROTO(unsigned int cmd, unsigned int addr, unsigned int size), +	TP_ARGS(cmd, addr, size), +	TP_STRUCT__entry( +		__field(unsigned int, cmd) +		__field(unsigned int, addr) +		__field(unsigned int, size) +	), +	TP_fast_assign( +		__entry->cmd = cmd; +		__entry->addr = addr; +		__entry->size = size; +	), +	TP_printk("cmd=%u,addr=0x%08x,size=0x%08x", +		  __entry->cmd, __entry->addr, __entry->size) +); + +DEFINE_EVENT(mmc_blk_erase_class, mmc_blk_erase_start, +	TP_PROTO(unsigned int cmd, unsigned int addr, unsigned int size), +	TP_ARGS(cmd, addr, size)); + +DEFINE_EVENT(mmc_blk_erase_class, mmc_blk_erase_end, +	TP_PROTO(unsigned int cmd, unsigned int addr, unsigned int size), +	TP_ARGS(cmd, addr, size)); + +/* + * Logging of start of read or write mmc block operation, + * including cmd, address, size + */ +DECLARE_EVENT_CLASS(mmc_blk_rw_class, +	TP_PROTO(unsigned int cmd, unsigned int addr, struct mmc_data *data), +	TP_ARGS(cmd, addr, data), +	TP_STRUCT__entry( +		__field(unsigned int, cmd) +		__field(unsigned int, addr) +		__field(unsigned int, size) +	), +	TP_fast_assign( +		__entry->cmd = cmd; +		__entry->addr = addr; +		__entry->size = data->blocks; +	), +	TP_printk("cmd=%u,addr=0x%08x,size=0x%08x", +		  __entry->cmd, __entry->addr, __entry->size) +); + +DEFINE_EVENT_CONDITION(mmc_blk_rw_class, mmc_blk_rw_start, +	TP_PROTO(unsigned int cmd, unsigned int addr, struct mmc_data *data), +	TP_ARGS(cmd, addr, data), +	TP_CONDITION(((cmd == MMC_READ_MULTIPLE_BLOCK) || +		      (cmd == MMC_WRITE_MULTIPLE_BLOCK)) && +		      data)); + +DEFINE_EVENT_CONDITION(mmc_blk_rw_class, mmc_blk_rw_end, +	TP_PROTO(unsigned int cmd, unsigned int addr, struct mmc_data *data), +	TP_ARGS(cmd, addr, data), +	TP_CONDITION(((cmd == MMC_READ_MULTIPLE_BLOCK) || +		      (cmd == MMC_WRITE_MULTIPLE_BLOCK)) && +		      data)); +#endif /* _TRACE_MMC_H */ + +/* This part must be outside protection */ +#include <trace/define_trace.h> diff --git a/include/trace/events/power.h b/include/trace/events/power.h index 427acab5d69..503fc2b870b 100644 --- a/include/trace/events/power.h +++ b/include/trace/events/power.h @@ -146,6 +146,25 @@ DEFINE_EVENT(clock, clock_set_rate,  	TP_ARGS(name, state, cpu_id)  ); +TRACE_EVENT(clock_set_parent, + +	TP_PROTO(const char *name, const char *parent_name), + +	TP_ARGS(name, parent_name), + +	TP_STRUCT__entry( +		__string(       name,           name            ) +		__string(       parent_name,    parent_name     ) +	), + +	TP_fast_assign( +		__assign_str(name, name); +		__assign_str(parent_name, parent_name); +	), + +	TP_printk("%s parent=%s", __get_str(name), __get_str(parent_name)) +); +  /*   * The power domain events are used for power domains transitions   */ diff --git a/include/uapi/linux/fb.h b/include/uapi/linux/fb.h index fb795c3b3c1..18a657838b1 100644 --- a/include/uapi/linux/fb.h +++ b/include/uapi/linux/fb.h @@ -16,6 +16,7 @@  #define FBIOGETCMAP		0x4604  #define FBIOPUTCMAP		0x4605  #define FBIOPAN_DISPLAY		0x4606 +#define FBIO_UPDATE_DISPLAY	0x4607  #ifndef __KERNEL__  #define FBIO_CURSOR            _IOWR('F', 0x08, struct fb_cursor)  #endif diff --git a/include/uapi/linux/fib_rules.h b/include/uapi/linux/fib_rules.h index 51da65b68b8..9dcdb6251cb 100644 --- a/include/uapi/linux/fib_rules.h +++ b/include/uapi/linux/fib_rules.h @@ -49,6 +49,8 @@ enum {  	FRA_TABLE,	/* Extended table id */  	FRA_FWMASK,	/* mask for netfilter mark */  	FRA_OIFNAME, +	FRA_UID_START,	/* UID range */ +	FRA_UID_END,  	__FRA_MAX  }; diff --git a/include/uapi/linux/if_pppolac.h b/include/uapi/linux/if_pppolac.h new file mode 100644 index 00000000000..b7eb8153ef6 --- /dev/null +++ b/include/uapi/linux/if_pppolac.h @@ -0,0 +1,33 @@ +/* include/uapi/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 _UAPI_LINUX_IF_PPPOLAC_H +#define _UAPI_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 /* _UAPI_LINUX_IF_PPPOLAC_H */ diff --git a/include/uapi/linux/if_pppopns.h b/include/uapi/linux/if_pppopns.h new file mode 100644 index 00000000000..a392b52ea6e --- /dev/null +++ b/include/uapi/linux/if_pppopns.h @@ -0,0 +1,32 @@ +/* include/uapi/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 _UAPI_LINUX_IF_PPPOPNS_H +#define _UAPI_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 /* _UAPI_LINUX_IF_PPPOPNS_H */ diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h index 0b46fd57c8f..772cf0841e9 100644 --- a/include/uapi/linux/if_pppox.h +++ b/include/uapi/linux/if_pppox.h @@ -23,6 +23,8 @@  #include <linux/socket.h>  #include <linux/if_ether.h>  #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__ @@ -56,7 +58,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 {  	__kernel_sa_family_t sa_family;       /* address family, AF_PPPOX */ diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h index 4649ee35b60..8fef2bcd7d8 100644 --- a/include/uapi/linux/input.h +++ b/include/uapi/linux/input.h @@ -153,6 +153,9 @@ struct input_keymap_entry {  #define EVIOCGRAB		_IOW('E', 0x90, int)			/* Grab/Release device */ +#define EVIOCGSUSPENDBLOCK	_IOR('E', 0x91, int)			/* get suspend block enable */ +#define EVIOCSSUSPENDBLOCK	_IOW('E', 0x91, int)			/* set suspend block enable */ +  #define EVIOCSCLOCKID		_IOW('E', 0xa0, int)			/* Set clockid to be used for timestamps */  /* @@ -465,6 +468,7 @@ struct input_keymap_entry {  #define KEY_RFKILL		247	/* Key that controls all radios */  #define KEY_MICMUTE		248	/* Mute / unmute the microphone */ +#define KEY_POWER_DOUBLE	249  /* Code 255 is reserved for special needs of AT keyboard driver */ @@ -706,6 +710,7 @@ struct input_keymap_entry {  #define KEY_ATTENDANT_OFF	0x21c  #define KEY_ATTENDANT_TOGGLE	0x21d	/* Attendant call on or off */  #define KEY_LIGHTS_TOGGLE	0x21e	/* Reading light on or off */ +#define KEY_POWER_SONG		0x220  #define BTN_TRIGGER_HAPPY		0x2c0  #define BTN_TRIGGER_HAPPY1		0x2c0 @@ -768,7 +773,7 @@ struct input_keymap_entry {  #define REL_DIAL		0x07  #define REL_WHEEL		0x08  #define REL_MISC		0x09 -#define REL_MAX			0x0f +#define REL_MAX                 0x0f  #define REL_CNT			(REL_MAX+1)  /* @@ -844,6 +849,7 @@ struct input_keymap_entry {  #define SW_FRONT_PROXIMITY	0x0b  /* set = front proximity sensor active */  #define SW_ROTATE_LOCK		0x0c  /* set = rotate locked/disabled */  #define SW_LINEIN_INSERT	0x0d  /* set = inserted */ +#define SW_STILL_MODE           0x0e  /* set = device is sitting still */  #define SW_MAX			0x0f  #define SW_CNT			(SW_MAX+1) diff --git a/include/uapi/linux/ipv6.h b/include/uapi/linux/ipv6.h index 4bda4cf5b0f..4214fac1bf4 100644 --- a/include/uapi/linux/ipv6.h +++ b/include/uapi/linux/ipv6.h @@ -160,6 +160,7 @@ enum {  	DEVCONF_ACCEPT_DAD,  	DEVCONF_FORCE_TLLAO,  	DEVCONF_NDISC_NOTIFY, +	DEVCONF_ACCEPT_RA_RT_TABLE,  	DEVCONF_MAX  }; diff --git a/include/uapi/linux/keychord.h b/include/uapi/linux/keychord.h new file mode 100644 index 00000000000..ea7cf4d27bb --- /dev/null +++ b/include/uapi/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 _UAPI_LINUX_KEYCHORD_H_ +#define _UAPI_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	/* _UAPI_LINUX_KEYCHORD_H_ */ diff --git a/include/uapi/linux/msdos_fs.h b/include/uapi/linux/msdos_fs.h index f055e58b314..db4ae0cd16c 100644 --- a/include/uapi/linux/msdos_fs.h +++ b/include/uapi/linux/msdos_fs.h @@ -104,6 +104,7 @@ 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)  struct fat_boot_sector {  	__u8	ignored[3];	/* Boot strap short or near jump */ @@ -161,6 +162,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/uapi/linux/netfilter/xt_IDLETIMER.h b/include/uapi/linux/netfilter/xt_IDLETIMER.h index 208ae938733..faaa28b3d06 100644 --- a/include/uapi/linux/netfilter/xt_IDLETIMER.h +++ b/include/uapi/linux/netfilter/xt_IDLETIMER.h @@ -4,6 +4,7 @@   * Header file for Xtables timer target module.   *   * Copyright (C) 2004, 2010 Nokia Corporation + *   * Written by Timo Teras <ext-timo.teras@nokia.com>   *   * Converted to x_tables and forward-ported to 2.6.34 @@ -32,12 +33,19 @@  #include <linux/types.h>  #define MAX_IDLETIMER_LABEL_SIZE 28 +#define NLMSG_MAX_SIZE 64 + +#define NL_EVENT_TYPE_INACTIVE 0 +#define NL_EVENT_TYPE_ACTIVE 1  struct idletimer_tg_info {  	__u32 timeout;  	char label[MAX_IDLETIMER_LABEL_SIZE]; +	/* Use netlink messages for notification in addition to sysfs */ +	__u8 send_nl_msg; +  	/* for kernel module internal use only */  	struct idletimer_tg *timer __attribute__((aligned(8)));  }; diff --git a/include/uapi/linux/netfilter/xt_socket.h b/include/uapi/linux/netfilter/xt_socket.h index 26d7217bd4f..63594564831 100644 --- a/include/uapi/linux/netfilter/xt_socket.h +++ b/include/uapi/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/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index d1e48b5e348..125e86d8df2 100644..100755 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -646,6 +646,44 @@   * @NL80211_CMD_CRIT_PROTOCOL_STOP: Indicates the connection reliability can   *	return back to normal.   * + * @NL80211_CMD_SCAN_CANCEL: Stop currently running scan (both sw and hw). + *	This operation will eventually invoke %NL80211_CMD_SCAN_ABORTED + *	event, partial scan results will be available. Returns -ENOENT + *	if scan is not running. + * + * @NL80211_CMD_IM_SCAN_RESULT: Intermediate scan result notification event, + *	this event could be enabled with @NL80211_ATTR_IM_SCAN_RESULT + *	flag during @NL80211_CMD_TRIGGER_SCAN. This event contains + *	%NL80211_BSS_BSSID which is used to specify the BSSID of received + *	scan result and %NL80211_BSS_SIGNAL_MBM to indicate signal strength. + *	On reception of this notification, userspace may decide to stop earlier + *	currently running scan with (@NL80211_CMD_SCAN_CANCEL). + * + * @NL80211_CMD_ROAMING_SUPPORT: A notify event used to alert userspace + *      regarding changes in roaming support by the driver. If roaming is + *      disabled (marked by the presence of @NL80211_ATTR_ROAMING_DISABLED flag) + *      userspace should disable background scans and roaming attempts. + * + * @NL80211_CMD_AP_CH_SWITCH: Perform a channel switch in the driver (for + *	AP/GO). + *	%NL80211_ATTR_WIPHY_FREQ: new channel frequency. + *	%NL80211_ATTR_CH_SWITCH_BLOCK_TX: block tx on the current channel. + *	%NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX: block tx on the target channel. + *	%NL80211_FREQ_ATTR_CH_SWITCH_COUNT: number of TBTT's until the channel + *	switch event. + * + * @NL80211_CMD_REQ_CH_SW: Request a channel switch from a GO/AP. + * + * @NL80211_CMD_CHANNEL_SWITCH: Perform a channel switch by announcing the + *	the new channel information (Channel Switch Announcement - CSA) + *	in the beacon for some time (as defined in the + *	%NL80211_ATTR_CH_SWITCH_COUNT parameter) and then change to the + *	new channel. Userspace provides the new channel information (using + *	%NL80211_ATTR_WIPHY_FREQ and the attributes determining channel + *	width). %NL80211_ATTR_CH_SWITCH_BLOCK_TX may be supplied to inform + *	other station that transmission must be blocked until the channel + *	switch is complete. + *   * @NL80211_CMD_MAX: highest used command number   * @__NL80211_CMD_AFTER_LAST: internal use   */ @@ -808,6 +846,24 @@ enum nl80211_commands {  	NL80211_CMD_CRIT_PROTOCOL_START,  	NL80211_CMD_CRIT_PROTOCOL_STOP, +	NL80211_CMD_GET_COALESCE, +	NL80211_CMD_SET_COALESCE, + +	NL80211_CMD_CHANNEL_SWITCH, + +	/* leave some room for adding nl80211 commands for old kernels */ +	NL80211_CMD_SCAN_CANCEL = NL80211_CMD_FT_EVENT + 40, + +	NL80211_CMD_IM_SCAN_RESULT, + +	NL80211_CMD_ROAMING_SUPPORT, + +	/* set/cancel_priority is depcrecated. keep it for backward compat */ +	NL80211_CMD_SET_PRIORITY, +	NL80211_CMD_CANCEL_PRIORITY, + +	NL80211_CMD_AP_CH_SWITCH, +	NL80211_CMD_REQ_CH_SW,  	/* add new commands above here */  	/* used to define NL80211_CMD_MAX below */ @@ -1224,7 +1280,9 @@ enum nl80211_commands {   *	triggers.   *   * @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan - *	cycles, in msecs. + *	cycles, in msecs. If short interval is supported by the driver + *      and configured then this will be used only after the requested + *      number of short intervals   *   * @NL80211_ATTR_SCHED_SCAN_MATCH: Nested attribute with one or more   *	sets of attributes to match during scheduled scans.  Only BSSs @@ -1429,6 +1487,59 @@ enum nl80211_commands {   * @NL80211_ATTR_MAX_CRIT_PROT_DURATION: duration in milliseconds in which   *      the connection should have increased reliability (u16).   * + * @%NL80211_ATTR_IM_SCAN_RESULT: Flag attribute to enable intermediate + *	scan result notification event (%NL80211_CMD_IM_SCAN_RESULT) + *	for the %NL80211_CMD_TRIGGER_SCAN command. + *	When set: will notify on each new scan result in the cache. + * + * @%NL80211_ATTR_IM_SCAN_RESULT_MIN_RSSI: Intermediate event filtering. + *	When set: will notify only those new scan result whose signal + *	strength of probe response/beacon (in dBm) is stronger than this + *	negative value (usually: -20 dBm > X > -95 dBm). + * + * @%NL80211_ATTR_SCAN_MIN_DWELL: Minimum scan dwell time (in TUs), u32 + *	attribute to setup minimum time to wait on each channel, if received + *	at least one probe response during this period will continue waiting + *	%NL80211_ATTR_SCAN_MAX_DWELL, otherwise will move to next channel. + *	Relevant only for active scan, used with %NL80211_CMD_TRIGGER_SCAN + *	command. This is optional attribute, so if it's not set driver should + *	use hardware default values. + * @%NL80211_ATTR_SCAN_MAX_DWELL: Maximum scan dwell time (in TUs), u32 + *	attribute to setup maximum time to wait on each channel. + *	Relevant only for active scan, used with %NL80211_CMD_TRIGGER_SCAN + *	command. This is optional attribute, so if it's not set driver should + *	use hardware default values. + * @%NL80211_ATTR_SCAN_NUM_PROBE:  Attribute (u8) to setup number of probe + *	requests to transmit on each active scan channel, used with + *	%NL80211_CMD_TRIGGER_SCAN command. + * + * @NL80211_ATTR_SCHED_SCAN_SHORT_INTERVAL: interval between + *      each short interval scheduled scan cycle in msecs. + * @NL80211_ATTR_SCHED_SCAN_NUM_SHORT_INTERVALS: number of short + *      sched scan intervals before switching to the long interval + * @NL80211_ATTR_ROAMING_DISABLED: indicates that the driver can't do roaming + *      currently. + * + * @NL80211_ATTR_CH_SWITCH_COUNT: the number of TBTT's until the channel + *	switch event + * @NL80211_ATTR_CH_SWITCH_BLOCK_TX: block tx on the current channel before the + *	channel switch operation. + * @NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX: block tx on the target channel after + *	the channel switch operation, should be set if the target channel is + *	DFS channel. + * + * @NL80211_ATTR_CH_SWITCH_COUNT: u32 attribute specifying the number of TBTT's + *	until the channel switch event. + * @NL80211_ATTR_CH_SWITCH_BLOCK_TX: flag attribute specifying that transmission + *	must be blocked on the current channel (before the channel switch + *	operation). + * @NL80211_ATTR_CSA_IES: Nested set of attributes containing the IE information + *	for the time while performing a channel switch. + * @NL80211_ATTR_CSA_C_OFF_BEACON: Offset of the channel switch counter + *	field in the beacons tail (%NL80211_ATTR_BEACON_TAIL). + * @NL80211_ATTR_CSA_C_OFF_PRESP: Offset of the channel switch counter + *	field in the probe response (%NL80211_ATTR_PROBE_RESP). + *   * @NL80211_ATTR_MAX: highest attribute number currently defined   * @__NL80211_ATTR_AFTER_LAST: internal use   */ @@ -1727,6 +1838,26 @@ enum nl80211_attrs {  	NL80211_ATTR_CRIT_PROT_ID,  	NL80211_ATTR_MAX_CRIT_PROT_DURATION, +	/* leave some room for new attributes in nl80211 updates */ +	NL80211_ATTR_IM_SCAN_RESULT = NL80211_ATTR_IE_RIC + 40, +	NL80211_ATTR_IM_SCAN_RESULT_MIN_RSSI, + +	NL80211_ATTR_SCAN_MIN_DWELL, +	NL80211_ATTR_SCAN_MAX_DWELL, +	NL80211_ATTR_SCAN_NUM_PROBE, + +	NL80211_ATTR_SCHED_SCAN_SHORT_INTERVAL, +	NL80211_ATTR_SCHED_SCAN_NUM_SHORT_INTERVALS, + +	NL80211_ATTR_ROAMING_DISABLED, +	NL80211_ATTR_CH_SWITCH_POST_BLOCK_TX, + +	NL80211_ATTR_CH_SWITCH_COUNT, +	NL80211_ATTR_CH_SWITCH_BLOCK_TX, +	NL80211_ATTR_CSA_IES, +	NL80211_ATTR_CSA_C_OFF_BEACON, +	NL80211_ATTR_CSA_C_OFF_PRESP, +  	/* add attributes here, update the policy in nl80211.c */  	__NL80211_ATTR_AFTER_LAST, @@ -3045,6 +3176,14 @@ enum nl80211_tx_power_setting {   *	first (including SNAP header unpacking) and then matched.   * @NL80211_WOWLAN_PKTPAT_OFFSET: packet offset, pattern is matched after   *	these fixed number of bytes of received packet + * + * @NL80211_WOWLAN_ACTION: pattern action which can be either to wake up + *      on this pattern or drop it and avoid wake up. This can be used to + *      specify an excpetion/blacklist pattern that shouldn't cause wakeup + *      despite the packet matching another wowlan pattern. For example: + *      configure all IPv4 multicast to wake up except certain type of packets + *      This can be either NL80211_WOWLAN_ACTION_ALLOW or DROP. + *      If this attribute is missing the default would be ALLOW.   * @NUM_NL80211_WOWLAN_PKTPAT: number of attributes   * @MAX_NL80211_WOWLAN_PKTPAT: max attribute number   */ @@ -3053,11 +3192,30 @@ enum nl80211_wowlan_packet_pattern_attr {  	NL80211_WOWLAN_PKTPAT_MASK,  	NL80211_WOWLAN_PKTPAT_PATTERN,  	NL80211_WOWLAN_PKTPAT_OFFSET, +	NL80211_WOWLAN_PKTPAT_ACTION = NL80211_WOWLAN_PKTPAT_PATTERN + 10,  	NUM_NL80211_WOWLAN_PKTPAT,  	MAX_NL80211_WOWLAN_PKTPAT = NUM_NL80211_WOWLAN_PKTPAT - 1,  }; + +/** + * enum nl80211_wowlan_action - WoWLAN packet pattern action + * @NL80211_WOWLAN_ACTION_ALLOW: this pattern should wake up the host + * and the packet should be forwarded to the host unless this packet + * matches a DROP rule. + * @NL80211_WOWLAN_ACTION_DROP: a packet containing this pattern shouldn't + * wake up the host. + */ +enum nl80211_wowlan_action { +	NL80211_WOWLAN_ACTION_ALLOW, +	NL80211_WOWLAN_ACTION_DROP, + +	/* keep last */ +	NUM_NL80211_WOWLAN_ACTION, +	MAX_NL80211_WOWLAN_ACTION = NUM_NL80211_WOWLAN_ACTION - 1, +}; +  /**   * struct nl80211_wowlan_pattern_support - pattern support information   * @max_patterns: maximum number of patterns supported @@ -3556,6 +3714,7 @@ enum nl80211_ap_sme_features {   *	Peering Management entity which may be implemented by registering for   *	beacons or NL80211_CMD_NEW_PEER_CANDIDATE events. The mesh beacon is   *	still generated by the driver. + * @NL80211_FEATURE_AP_CH_SWITCH: This driver supports AP channel switch.   */  enum nl80211_feature_flags {  	NL80211_FEATURE_SK_TX_STATUS			= 1 << 0, @@ -3575,6 +3734,8 @@ enum nl80211_feature_flags {  	NL80211_FEATURE_ADVERTISE_CHAN_LIMITS		= 1 << 14,  	NL80211_FEATURE_FULL_AP_CLIENT_STATE		= 1 << 15,  	NL80211_FEATURE_USERSPACE_MPM			= 1 << 16, +	NL80211_FEATURE_SCHED_SCAN_INTERVALS  = 1 << 20, +	NL80211_FEATURE_AP_CH_SWITCH	= 1 << 21,  };  /** diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h index 289760f424a..253856a2a8a 100644 --- a/include/uapi/linux/prctl.h +++ b/include/uapi/linux/prctl.h @@ -149,4 +149,7 @@  #define PR_GET_TID_ADDRESS	40 +#define PR_SET_VMA		0x53564d41 +# define PR_SET_VMA_ANON_NAME		0 +  #endif /* _LINUX_PRCTL_H */ diff --git a/include/uapi/linux/rtnetlink.h b/include/uapi/linux/rtnetlink.h index 7a2144e1afa..07c1146c1f5 100644 --- a/include/uapi/linux/rtnetlink.h +++ b/include/uapi/linux/rtnetlink.h @@ -297,6 +297,7 @@ enum rtattr_type_t {  	RTA_TABLE,  	RTA_MARK,  	RTA_MFC_STATS, +	RTA_UID,  	__RTA_MAX  }; diff --git a/include/uapi/linux/sockios.h b/include/uapi/linux/sockios.h index 7997a506ad4..f7ffe36db03 100644 --- a/include/uapi/linux/sockios.h +++ b/include/uapi/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/uapi/linux/usb/f_accessory.h b/include/uapi/linux/usb/f_accessory.h new file mode 100644 index 00000000000..0baeb7d0d74 --- /dev/null +++ b/include/uapi/linux/usb/f_accessory.h @@ -0,0 +1,146 @@ +/* + * 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 _UAPI_LINUX_USB_F_ACCESSORY_H +#define _UAPI_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 + * + *	requestType:    USB_DIR_IN | USB_TYPE_VENDOR + *	request:        ACCESSORY_GET_PROTOCOL + *	value:          0 + *	index:          0 + *	data            version number (16 bits little endian) + *                     1 for original accessory support + *                     2 adds HID and device to host audio support + */ +#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 + +/* Control request for registering a HID device. + * Upon registering, a unique ID is sent by the accessory in the + * value parameter. This ID will be used for future commands for + * the device + * + *	requestType:    USB_DIR_OUT | USB_TYPE_VENDOR + *	request:        ACCESSORY_REGISTER_HID_DEVICE + *	value:          Accessory assigned ID for the HID device + *	index:          total length of the HID report descriptor + *	data            none + */ +#define ACCESSORY_REGISTER_HID         54 + +/* Control request for unregistering a HID device. + * + *	requestType:    USB_DIR_OUT | USB_TYPE_VENDOR + *	request:        ACCESSORY_REGISTER_HID + *	value:          Accessory assigned ID for the HID device + *	index:          0 + *	data            none + */ +#define ACCESSORY_UNREGISTER_HID         55 + +/* Control request for sending the HID report descriptor. + * If the HID descriptor is longer than the endpoint zero max packet size, + * the descriptor will be sent in multiple ACCESSORY_SET_HID_REPORT_DESC + * commands. The data for the descriptor must be sent sequentially + * if multiple packets are needed. + * + *	requestType:    USB_DIR_OUT | USB_TYPE_VENDOR + *	request:        ACCESSORY_SET_HID_REPORT_DESC + *	value:          Accessory assigned ID for the HID device + *	index:          offset of data in descriptor + *                      (needed when HID descriptor is too big for one packet) + *	data            the HID report descriptor + */ +#define ACCESSORY_SET_HID_REPORT_DESC         56 + +/* Control request for sending HID events. + * + *	requestType:    USB_DIR_OUT | USB_TYPE_VENDOR + *	request:        ACCESSORY_SEND_HID_EVENT + *	value:          Accessory assigned ID for the HID device + *	index:          0 + *	data            the HID report for the event + */ +#define ACCESSORY_SEND_HID_EVENT         57 + +/* Control request for setting the audio mode. + * + *	requestType:	USB_DIR_OUT | USB_TYPE_VENDOR + *	request:        ACCESSORY_SET_AUDIO_MODE + *	value:          0 - no audio + *                     1 - device to host, 44100 16-bit stereo PCM + *	index:          0 + *	data            none + */ +#define ACCESSORY_SET_AUDIO_MODE         58 + +/* 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) +/* returns audio mode (set via the ACCESSORY_SET_AUDIO_MODE control request) */ +#define ACCESSORY_GET_AUDIO_MODE            _IO('M', 8) + +#endif /* _UAPI_LINUX_USB_F_ACCESSORY_H */ diff --git a/include/uapi/linux/usb/f_mtp.h b/include/uapi/linux/usb/f_mtp.h new file mode 100644 index 00000000000..503291855ab --- /dev/null +++ b/include/uapi/linux/usb/f_mtp.h @@ -0,0 +1,61 @@ +/* + * 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 _UAPI_LINUX_USB_F_MTP_H +#define _UAPI_LINUX_USB_F_MTP_H + +#include <linux/ioctl.h> +#include <linux/types.h> + +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 /* _UAPI_LINUX_USB_F_MTP_H */ diff --git a/include/uapi/video/adf.h b/include/uapi/video/adf.h new file mode 100644 index 00000000000..b703bf9e9a6 --- /dev/null +++ b/include/uapi/video/adf.h @@ -0,0 +1,321 @@ +/* + * Copyright (C) 2013 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 _UAPI_VIDEO_ADF_H_ +#define _UAPI_VIDEO_ADF_H_ + +#include <linux/ioctl.h> +#include <linux/types.h> + +#include <drm/drm_fourcc.h> +#include <drm/drm_mode.h> + +#define ADF_NAME_LEN 32 +#define ADF_MAX_CUSTOM_DATA_SIZE 4096 + +enum adf_interface_type { +	ADF_INTF_DSI = 0, +	ADF_INTF_eDP = 1, +	ADF_INTF_DPI = 2, +	ADF_INTF_VGA = 3, +	ADF_INTF_DVI = 4, +	ADF_INTF_HDMI = 5, +	ADF_INTF_MEMORY = 6, +	ADF_INTF_TYPE_DEVICE_CUSTOM = 128, +	ADF_INTF_TYPE_MAX = (~(__u32)0), +}; + +#define ADF_INTF_FLAG_PRIMARY (1 << 0) +#define ADF_INTF_FLAG_EXTERNAL (1 << 1) + +enum adf_event_type { +	ADF_EVENT_VSYNC = 0, +	ADF_EVENT_HOTPLUG = 1, +	ADF_EVENT_DEVICE_CUSTOM = 128, +	ADF_EVENT_TYPE_MAX = 255, +}; + +/** + * struct adf_set_event - start or stop subscribing to ADF events + * + * @type: the type of event to (un)subscribe + * @enabled: subscribe or unsubscribe + * + * After subscribing to an event, userspace may poll() the ADF object's fd + * to wait for events or read() to consume the event's data. + * + * ADF reserves event types 0 to %ADF_EVENT_DEVICE_CUSTOM-1 for its own events. + * Devices may use event types %ADF_EVENT_DEVICE_CUSTOM to %ADF_EVENT_TYPE_MAX-1 + * for driver-private events. + */ +struct adf_set_event { +	__u8 type; +	__u8 enabled; +}; + +/** + * struct adf_event - common header for ADF event data + * + * @type: event type + * @length: total size of event data, header inclusive + */ +struct adf_event { +	__u8 type; +	__u32 length; +}; + +/** + * struct adf_vsync_event - ADF vsync event + * + * @base: event header (see &struct adf_event) + * @timestamp: time of vsync event, in nanoseconds + */ +struct adf_vsync_event { +	struct adf_event base; +	__u64 timestamp; +}; + +/** + * struct adf_vsync_event - ADF display hotplug event + * + * @base: event header (see &struct adf_event) + * @connected: whether a display is now connected to the interface + */ +struct adf_hotplug_event { +	struct adf_event base; +	__u8 connected; +}; + +#define ADF_MAX_PLANES 4 +/** + * struct adf_buffer_config - description of buffer displayed by adf_post_config + * + * @overlay_engine: id of the target overlay engine + * @w: width of display region in pixels + * @h: height of display region in pixels + * @format: DRM-style fourcc, see drm_fourcc.h for standard formats + * @fd: dma_buf fd for each plane + * @offset: location of first pixel to scan out, in bytes + * @pitch: stride (i.e. length of a scanline including padding) in bytes + * @n_planes: number of planes in buffer + * @acquire_fence: sync_fence fd which will clear when the buffer is + *	ready for display, or <0 if the buffer is already ready + */ +struct adf_buffer_config { +	__u32 overlay_engine; + +	__u32 w; +	__u32 h; +	__u32 format; + +	__s64 fd[ADF_MAX_PLANES]; +	__u32 offset[ADF_MAX_PLANES]; +	__u32 pitch[ADF_MAX_PLANES]; +	__u8 n_planes; + +	__s64 acquire_fence; +}; +#define ADF_MAX_BUFFERS (4096 / sizeof(struct adf_buffer_config)) + +/** + * struct adf_post_config - request to flip to a new set of buffers + * + * @n_interfaces: number of interfaces targeted by the flip (input) + * @interfaces: ids of interfaces targeted by the flip (input) + * @n_bufs: number of buffers displayed (input) + * @bufs: description of buffers displayed (input) + * @custom_data_size: size of driver-private data (input) + * @custom_data: driver-private data (input) + * @complete_fence: sync_fence fd which will clear when this + *	configuration has left the screen (output) + */ +struct adf_post_config { +	size_t n_interfaces; +	__u32 __user *interfaces; + +	size_t n_bufs; +	struct adf_buffer_config __user *bufs; + +	size_t custom_data_size; +	void __user *custom_data; + +	__s64 complete_fence; +}; +#define ADF_MAX_INTERFACES (4096 / sizeof(__u32)) + +/** + * struct adf_simple_buffer_allocate - request to allocate a "simple" buffer + * + * @w: width of buffer in pixels (input) + * @h: height of buffer in pixels (input) + * @format: DRM-style fourcc (input) + * + * @fd: dma_buf fd (output) + * @offset: location of first pixel, in bytes (output) + * @pitch: length of a scanline including padding, in bytes (output) + * + * Simple buffers are analogous to DRM's "dumb" buffers.  They have a single + * plane of linear RGB data which can be allocated and scanned out without + * any driver-private ioctls or data. + * + * @format must be a standard RGB format defined in drm_fourcc.h. + * + * ADF clients must NOT assume that an interface can scan out a simple buffer + * allocated by a different ADF interface, even if the two interfaces belong to + * the same ADF device. + */ +struct adf_simple_buffer_alloc { +	__u16 w; +	__u16 h; +	__u32 format; + +	__s64 fd; +	__u32 offset; +	__u32 pitch; +}; + +/** + * struct adf_simple_post_config - request to flip to a single buffer without + * driver-private data + * + * @buf: description of buffer displayed (input) + * @complete_fence: sync_fence fd which will clear when this buffer has left the + * screen (output) + */ +struct adf_simple_post_config { +	struct adf_buffer_config buf; +	__s64 complete_fence; +}; + +/** + * struct adf_attachment_config - description of attachment between an overlay + * engine and an interface + * + * @overlay_engine: id of the overlay engine + * @interface: id of the interface + */ +struct adf_attachment_config { +	__u32 overlay_engine; +	__u32 interface; +}; + +/** + * struct adf_device_data - describes a display device + * + * @name: display device's name + * @n_attachments: the number of current attachments + * @attachments: list of current attachments + * @n_allowed_attachments: the number of allowed attachments + * @allowed_attachments: list of allowed attachments + * @custom_data_size: size of driver-private data + * @custom_data: driver-private data + */ +struct adf_device_data { +	char name[ADF_NAME_LEN]; + +	size_t n_attachments; +	struct adf_attachment_config __user *attachments; + +	size_t n_allowed_attachments; +	struct adf_attachment_config __user *allowed_attachments; + +	size_t custom_data_size; +	void __user *custom_data; +}; +#define ADF_MAX_ATTACHMENTS (4096 / sizeof(struct adf_attachment_config)) + +/** + * struct adf_device_data - describes a display interface + * + * @name: display interface's name + * @type: interface type (see enum @adf_interface_type) + * @id: which interface of type @type; + *	e.g. interface DSI.1 -> @type=@ADF_INTF_TYPE_DSI, @id=1 + * @flags: informational flags (bitmask of %ADF_INTF_FLAG_* values) + * @dpms_state: DPMS state (one of @DRM_MODE_DPMS_* defined in drm_mode.h) + * @hotplug_detect: whether a display is plugged in + * @width_mm: screen width in millimeters, or 0 if unknown + * @height_mm: screen height in millimeters, or 0 if unknown + * @current_mode: current display mode + * @n_available_modes: the number of hardware display modes + * @available_modes: list of hardware display modes + * @custom_data_size: size of driver-private data + * @custom_data: driver-private data + */ +struct adf_interface_data { +	char name[ADF_NAME_LEN]; + +	__u32 type; +	__u32 id; +	/* e.g. type=ADF_INTF_TYPE_DSI, id=1 => DSI.1 */ +	__u32 flags; + +	__u8 dpms_state; +	__u8 hotplug_detect; +	__u16 width_mm; +	__u16 height_mm; + +	struct drm_mode_modeinfo current_mode; +	size_t n_available_modes; +	struct drm_mode_modeinfo __user *available_modes; + +	size_t custom_data_size; +	void __user *custom_data; +}; +#define ADF_MAX_MODES (4096 / sizeof(struct drm_mode_modeinfo)) + +/** + * struct adf_overlay_engine_data - describes an overlay engine + * + * @name: overlay engine's name + * @n_supported_formats: number of supported formats + * @supported_formats: list of supported formats + * @custom_data_size: size of driver-private data + * @custom_data: driver-private data + */ +struct adf_overlay_engine_data { +	char name[ADF_NAME_LEN]; + +	size_t n_supported_formats; +	__u32 __user *supported_formats; + +	size_t custom_data_size; +	void __user *custom_data; +}; +#define ADF_MAX_SUPPORTED_FORMATS (4096 / sizeof(__u32)) + +#define ADF_IOCTL_TYPE		'D' +#define ADF_IOCTL_NR_CUSTOM	128 + +#define ADF_SET_EVENT		_IOW(ADF_IOCTL_TYPE, 0, struct adf_set_event) +#define ADF_BLANK		_IOW(ADF_IOCTL_TYPE, 1, __u8) +#define ADF_POST_CONFIG		_IOW(ADF_IOCTL_TYPE, 2, struct adf_post_config) +#define ADF_SET_MODE		_IOW(ADF_IOCTL_TYPE, 3, \ +					struct drm_mode_modeinfo) +#define ADF_GET_DEVICE_DATA	_IOR(ADF_IOCTL_TYPE, 4, struct adf_device_data) +#define ADF_GET_INTERFACE_DATA	_IOR(ADF_IOCTL_TYPE, 5, \ +					struct adf_interface_data) +#define ADF_GET_OVERLAY_ENGINE_DATA \ +				_IOR(ADF_IOCTL_TYPE, 6, \ +					struct adf_overlay_engine_data) +#define ADF_SIMPLE_POST_CONFIG	_IOW(ADF_IOCTL_TYPE, 7, \ +					struct adf_simple_post_config) +#define ADF_SIMPLE_BUFFER_ALLOC	_IOW(ADF_IOCTL_TYPE, 8, \ +					struct adf_simple_buffer_alloc) +#define ADF_ATTACH		_IOW(ADF_IOCTL_TYPE, 9, \ +					struct adf_attachment_config) +#define ADF_DETACH		_IOW(ADF_IOCTL_TYPE, 10, \ +					struct adf_attachment_config) + +#endif /* _UAPI_VIDEO_ADF_H_ */ diff --git a/include/video/adf.h b/include/video/adf.h new file mode 100644 index 00000000000..2b742ab463d --- /dev/null +++ b/include/video/adf.h @@ -0,0 +1,484 @@ +/* + * Copyright (C) 2013 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 _VIDEO_ADF_H +#define _VIDEO_ADF_H + +#include <linux/device.h> +#include <linux/dma-buf.h> +#include <linux/idr.h> +#include <linux/kref.h> +#include <linux/kthread.h> +#include <linux/ktime.h> +#include <linux/list.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/scatterlist.h> +#include <linux/sched.h> +#include <linux/spinlock.h> +#include <linux/wait.h> +#include <linux/workqueue.h> +#include <uapi/video/adf.h> +#include "sync.h" + +struct adf_obj; +struct adf_obj_ops; +struct adf_device; +struct adf_device_ops; +struct adf_interface; +struct adf_interface_ops; +struct adf_overlay_engine; +struct adf_overlay_engine_ops; + +/** + * struct adf_buffer - buffer displayed by adf_post + * + * @overlay_engine: target overlay engine + * @w: width of display region in pixels + * @h: height of display region in pixels + * @format: DRM-style fourcc, see drm_fourcc.h for standard formats + * @dma_bufs: dma_buf for each plane + * @offset: location of first pixel to scan out, in bytes + * @pitch: length of a scanline including padding, in bytes + * @n_planes: number of planes in buffer + * @acquire_fence: sync_fence which will clear when the buffer is + *	ready for display + * + * &struct adf_buffer is the in-kernel counterpart to the userspace-facing + * &struct adf_buffer_config. + */ +struct adf_buffer { +	struct adf_overlay_engine *overlay_engine; + +	u32 w; +	u32 h; +	u32 format; + +	struct dma_buf *dma_bufs[ADF_MAX_PLANES]; +	u32 offset[ADF_MAX_PLANES]; +	u32 pitch[ADF_MAX_PLANES]; +	u8 n_planes; + +	struct sync_fence *acquire_fence; +}; + +/** + * struct adf_buffer_mapping - state for mapping a &struct adf_buffer into the + * display device + * + * @attachments: dma-buf attachment for each plane + * @sg_tables: SG tables for each plane + */ +struct adf_buffer_mapping { +	struct dma_buf_attachment *attachments[ADF_MAX_PLANES]; +	struct sg_table *sg_tables[ADF_MAX_PLANES]; +}; + +/** + * struct adf_post - request to flip to a new set of buffers + * + * @n_bufs: number of buffers displayed + * @bufs: buffers displayed + * @mappings: in-device mapping state for each buffer + * @custom_data_size: size of driver-private data + * @custom_data: driver-private data + * + * &struct adf_post is the in-kernel counterpart to the userspace-facing + * &struct adf_post_config. + */ +struct adf_post { +	size_t n_bufs; +	struct adf_buffer *bufs; +	struct adf_buffer_mapping *mappings; + +	size_t custom_data_size; +	void *custom_data; +}; + +/** + * struct adf_attachment - description of attachment between an overlay engine + * and an interface + * + * @overlay_engine: the overlay engine + * @interface: the interface + * + * &struct adf_attachment is the in-kernel counterpart to the userspace-facing + * &struct adf_attachment_config. + */ +struct adf_attachment { +	struct adf_overlay_engine *overlay_engine; +	struct adf_interface *interface; +}; + +struct adf_pending_post { +	struct list_head head; +	struct adf_post config; +	void *state; +}; + +enum adf_obj_type { +	ADF_OBJ_OVERLAY_ENGINE = 0, +	ADF_OBJ_INTERFACE = 1, +	ADF_OBJ_DEVICE = 2, +}; + +/** + * struct adf_obj_ops - common ADF object implementation ops + * + * @open: handle opening the object's device node + * @release: handle releasing an open file + * @ioctl: handle custom ioctls + * + * @supports_event: return whether the object supports generating events of type + *	@type + * @set_event: enable or disable events of type @type + * @event_type_str: return a string representation of custom event @type + *	(@type >= %ADF_EVENT_DEVICE_CUSTOM). + * + * @custom_data: copy up to %ADF_MAX_CUSTOM_DATA_SIZE bytes of driver-private + *	data into @data (allocated by ADF) and return the number of copied bytes + *	in @size.  Return 0 on success or an error code (<0) on failure. + */ +struct adf_obj_ops { +	/* optional */ +	int (*open)(struct adf_obj *obj, struct inode *inode, +			struct file *file); +	/* optional */ +	void (*release)(struct adf_obj *obj, struct inode *inode, +			struct file *file); +	/* optional */ +	long (*ioctl)(struct adf_obj *obj, unsigned int cmd, unsigned long arg); + +	/* optional */ +	bool (*supports_event)(struct adf_obj *obj, enum adf_event_type type); +	/* required if supports_event is implemented */ +	void (*set_event)(struct adf_obj *obj, enum adf_event_type type, +			bool enabled); +	/* optional */ +	const char *(*event_type_str)(struct adf_obj *obj, +			enum adf_event_type type); + +	/* optional */ +	int (*custom_data)(struct adf_obj *obj, void *data, size_t *size); +}; + +struct adf_obj { +	enum adf_obj_type type; +	char name[ADF_NAME_LEN]; +	struct adf_device *parent; + +	const struct adf_obj_ops *ops; + +	struct device dev; + +	struct spinlock file_lock; +	struct list_head file_list; + +	struct mutex event_lock; +	struct rb_root event_refcount; + +	int id; +	int minor; +}; + +/** + * struct adf_device_ops - display device implementation ops + * + * @owner: device's module + * @base: common operations (see &struct adf_obj_ops) + * + * @attach: attach overlay engine @eng to interface @intf.  Return 0 on success + *	or error code (<0) on failure. + * @detach: detach overlay engine @eng from interface @intf.  Return 0 on + *	success or error code (<0) on failure. + * + * @validate_custom_format: validate the number and size of planes + *	in buffers with a custom format (i.e., not one of the @DRM_FORMAT_* + *	types defined in drm/drm_fourcc.h).  Return 0 if the buffer is valid or + *	an error code (<0) otherwise. + * + * @validate: validate that the proposed configuration @cfg is legal.  The + *	driver may optionally allocate and return some driver-private state in + *	@driver_state, which will be passed to the corresponding post().  The + *	driver may NOT commit any changes to hardware.  Return 0 if @cfg is + *	valid or an error code (<0) otherwise. + * @complete_fence: create a hardware-backed sync fence to be signaled when + *	@cfg is removed from the screen.  If unimplemented, ADF automatically + *	creates an sw_sync fence.  Return the sync fence on success or a + *	PTR_ERR() on failure. + * @post: flip @cfg onto the screen.  Wait for the display to begin scanning out + *	@cfg before returning. + * @advance_timeline: signal the sync fence for the last configuration to leave + *	the display.  If unimplemented, ADF automatically advances an sw_sync + *	timeline. + * @state_free: free driver-private state allocated during validate() + */ +struct adf_device_ops { +	/* required */ +	struct module *owner; +	const struct adf_obj_ops base; + +	/* optional */ +	int (*attach)(struct adf_device *dev, struct adf_overlay_engine *eng, +			struct adf_interface *intf); +	/* optional */ +	int (*detach)(struct adf_device *dev, struct adf_overlay_engine *eng, +			struct adf_interface *intf); + +	/* required if any of the device's overlay engines supports at least one +	   custom format */ +	int (*validate_custom_format)(struct adf_device *dev, +			struct adf_buffer *buf); + +	/* required */ +	int (*validate)(struct adf_device *dev, struct adf_post *cfg, +			void **driver_state); +	/* optional */ +	struct sync_fence *(*complete_fence)(struct adf_device *dev, +			struct adf_post *cfg, void *driver_state); +	/* required */ +	void (*post)(struct adf_device *dev, struct adf_post *cfg, +			void *driver_state); +	/* required if complete_fence is implemented */ +	void (*advance_timeline)(struct adf_device *dev, +			struct adf_post *cfg, void *driver_state); +	/* required if validate allocates driver state */ +	void (*state_free)(struct adf_device *dev, void *driver_state); +}; + +struct adf_attachment_list { +	struct adf_attachment attachment; +	struct list_head head; +}; + +struct adf_device { +	struct adf_obj base; +	struct device *dev; + +	const struct adf_device_ops *ops; + +	struct mutex client_lock; + +	struct idr interfaces; +	size_t n_interfaces; +	struct idr overlay_engines; + +	struct list_head post_list; +	struct mutex post_lock; +	struct kthread_worker post_worker; +	struct task_struct *post_thread; +	struct kthread_work post_work; + +	struct list_head attached; +	size_t n_attached; +	struct list_head attach_allowed; +	size_t n_attach_allowed; + +	struct adf_pending_post *onscreen; + +	struct sw_sync_timeline *timeline; +	int timeline_max; +}; + +/** + * struct adf_interface_ops - display interface implementation ops + * + * @base: common operations (see &struct adf_obj_ops) + * + * @blank: change the display's DPMS state.  Return 0 on success or error + *	code (<0) on failure. + * + * @alloc_simple_buffer: allocate a buffer with the specified @w, @h, and + *	@format.  @format will be a standard RGB format (i.e., + *	adf_format_is_rgb(@format) == true).  Return 0 on success or error code + *	(<0) on failure.  On success, return the buffer, offset, and pitch in + *	@dma_buf, @offset, and @pitch respectively. + * @describe_simple_post: provide driver-private data needed to post a single + *	buffer @buf.  Copy up to ADF_MAX_CUSTOM_DATA_SIZE bytes into @data + *	(allocated by ADF) and return the number of bytes in @size.  Return 0 on + *	success or error code (<0) on failure. + * + * @modeset: change the interface's mode.  @mode is not necessarily part of the + *	modelist passed to adf_hotplug_notify_connected(); the driver may + *	accept or reject custom modes at its discretion.  Return 0 on success or + *	error code (<0) if the mode could not be set. + * + * @screen_size: copy the screen dimensions in millimeters into @width_mm + *	and @height_mm.  Return 0 on success or error code (<0) if the display + *	dimensions are unknown. + * + * @type_str: return a string representation of custom @intf->type + *	(@intf->type >= @ADF_INTF_TYPE_DEVICE_CUSTOM). + */ +struct adf_interface_ops { +	const struct adf_obj_ops base; + +	/* optional */ +	int (*blank)(struct adf_interface *intf, u8 state); + +	/* optional */ +	int (*alloc_simple_buffer)(struct adf_interface *intf, +			u16 w, u16 h, u32 format, +			struct dma_buf **dma_buf, u32 *offset, u32 *pitch); +	/* optional */ +	int (*describe_simple_post)(struct adf_interface *intf, +			struct adf_buffer *fb, void *data, size_t *size); + +	/* optional */ +	int (*modeset)(struct adf_interface *intf, +			struct drm_mode_modeinfo *mode); + +	/* optional */ +	int (*screen_size)(struct adf_interface *intf, u16 *width_mm, +			u16 *height_mm); + +	/* optional */ +	const char *(*type_str)(struct adf_interface *intf); +}; + +struct adf_interface { +	struct adf_obj base; +	const struct adf_interface_ops *ops; + +	struct drm_mode_modeinfo current_mode; + +	enum adf_interface_type type; +	u32 idx; +	u32 flags; + +	wait_queue_head_t vsync_wait; +	ktime_t vsync_timestamp; +	rwlock_t vsync_lock; + +	u8 dpms_state; + +	bool hotplug_detect; +	struct drm_mode_modeinfo *modelist; +	size_t n_modes; +	rwlock_t hotplug_modelist_lock; +}; + +/** + * struct adf_interface_ops - overlay engine implementation ops + * + * @base: common operations (see &struct adf_obj_ops) + * + * @supported_formats: list of fourccs the overlay engine can scan out + * @n_supported_formats: length of supported_formats, up to + *	ADF_MAX_SUPPORTED_FORMATS + */ +struct adf_overlay_engine_ops { +	const struct adf_obj_ops base; + +	/* required */ +	const u32 *supported_formats; +	/* required */ +	const size_t n_supported_formats; +}; + +struct adf_overlay_engine { +	struct adf_obj base; + +	const struct adf_overlay_engine_ops *ops; +}; + +#define adf_obj_to_device(ptr) \ +	container_of((ptr), struct adf_device, base) + +#define adf_obj_to_interface(ptr) \ +	container_of((ptr), struct adf_interface, base) + +#define adf_obj_to_overlay_engine(ptr) \ +	container_of((ptr), struct adf_overlay_engine, base) + +int __printf(4, 5) adf_device_init(struct adf_device *dev, +		struct device *parent, const struct adf_device_ops *ops, +		const char *fmt, ...); +void adf_device_destroy(struct adf_device *dev); +int __printf(7, 8) adf_interface_init(struct adf_interface *intf, +		struct adf_device *dev, enum adf_interface_type type, u32 idx, +		u32 flags, const struct adf_interface_ops *ops, const char *fmt, +		...); +void adf_interface_destroy(struct adf_interface *intf); +static inline struct adf_device *adf_interface_parent( +		struct adf_interface *intf) +{ +	return intf->base.parent; +} +int __printf(4, 5) adf_overlay_engine_init(struct adf_overlay_engine *eng, +		struct adf_device *dev, +		const struct adf_overlay_engine_ops *ops, const char *fmt, ...); +void adf_overlay_engine_destroy(struct adf_overlay_engine *eng); +static inline struct adf_device *adf_overlay_engine_parent( +		struct adf_overlay_engine *eng) +{ +	return eng->base.parent; +} + +int adf_attachment_allow(struct adf_device *dev, struct adf_overlay_engine *eng, +		struct adf_interface *intf); + +const char *adf_obj_type_str(enum adf_obj_type type); +const char *adf_interface_type_str(struct adf_interface *intf); +const char *adf_event_type_str(struct adf_obj *obj, enum adf_event_type type); + +#define ADF_FORMAT_STR_SIZE 5 +void adf_format_str(u32 format, char buf[ADF_FORMAT_STR_SIZE]); +int adf_format_validate_yuv(struct adf_device *dev, struct adf_buffer *buf, +		u8 num_planes, u8 hsub, u8 vsub, u8 cpp[]); +/** + * adf_format_validate_rgb - validate the number and size of planes in buffers + * with a custom RGB format. + * + * @dev: ADF device performing the validation + * @buf: buffer to validate + * @cpp: expected bytes per pixel + * + * adf_format_validate_rgb() is intended to be called as a helper from @dev's + * validate_custom_format() op.  @buf must have a single RGB plane. + * + * Returns 0 if @buf has a single plane with sufficient size, or -EINVAL + * otherwise. + */ +static inline int adf_format_validate_rgb(struct adf_device *dev, +		struct adf_buffer *buf, u8 cpp) +{ +	return adf_format_validate_yuv(dev, buf, 1, 1, 1, &cpp); +} + +int adf_event_get(struct adf_obj *obj, enum adf_event_type type); +int adf_event_put(struct adf_obj *obj, enum adf_event_type type); +int adf_event_notify(struct adf_obj *obj, struct adf_event *event); + +static inline void adf_vsync_get(struct adf_interface *intf) +{ +	adf_event_get(&intf->base, ADF_EVENT_VSYNC); +} + +static inline void adf_vsync_put(struct adf_interface *intf) +{ +	adf_event_put(&intf->base, ADF_EVENT_VSYNC); +} + +int adf_vsync_wait(struct adf_interface *intf, long timeout); +void adf_vsync_notify(struct adf_interface *intf, ktime_t timestamp); + +int adf_hotplug_notify_connected(struct adf_interface *intf, +		struct drm_mode_modeinfo *modelist, size_t n_modes); +void adf_hotplug_notify_disconnected(struct adf_interface *intf); + +void adf_modeinfo_set_name(struct drm_mode_modeinfo *mode); +void adf_modeinfo_set_vrefresh(struct drm_mode_modeinfo *mode); + +#endif /* _VIDEO_ADF_H */ diff --git a/include/video/adf_client.h b/include/video/adf_client.h new file mode 100644 index 00000000000..983f2b6a589 --- /dev/null +++ b/include/video/adf_client.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2013 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 _VIDEO_ADF_CLIENT_H_ +#define _VIDEO_ADF_CLIENT_H_ + +#include <video/adf.h> + +int adf_interface_blank(struct adf_interface *intf, u8 state); +u8 adf_interface_dpms_state(struct adf_interface *intf); + +void adf_interface_current_mode(struct adf_interface *intf, +		struct drm_mode_modeinfo *mode); +size_t adf_interface_modelist(struct adf_interface *intf, +		struct drm_mode_modeinfo *modelist, size_t n_modes); +int adf_interface_set_mode(struct adf_interface *intf, +		struct drm_mode_modeinfo *mode); +int adf_interface_get_screen_size(struct adf_interface *intf, u16 *width, +		u16 *height); +int adf_interface_simple_buffer_alloc(struct adf_interface *intf, u16 w, u16 h, +		u32 format, struct dma_buf **dma_buf, u32 *offset, u32 *pitch); +struct sync_fence *adf_interface_simple_post(struct adf_interface *intf, +		struct adf_buffer *buf); + +bool adf_overlay_engine_supports_format(struct adf_overlay_engine *eng, +		u32 format); + +size_t adf_device_attachments(struct adf_device *dev, +		struct adf_attachment *attachments, size_t n_attachments); +size_t adf_device_attachments_allowed(struct adf_device *dev, +		struct adf_attachment *attachments, size_t n_attachments); +bool adf_device_attached(struct adf_device *dev, struct adf_overlay_engine *eng, +		struct adf_interface *intf); +bool adf_device_attach_allowed(struct adf_device *dev, +		struct adf_overlay_engine *eng, struct adf_interface *intf); +int adf_device_attach(struct adf_device *dev, struct adf_overlay_engine *eng, +		struct adf_interface *intf); +int adf_device_detach(struct adf_device *dev, struct adf_overlay_engine *eng, +		struct adf_interface *intf); + +struct sync_fence *adf_device_post(struct adf_device *dev, +		struct adf_interface **intfs, size_t n_intfs, +		struct adf_buffer *bufs, size_t n_bufs, void *custom_data, +		size_t custom_data_size); +struct sync_fence *adf_device_post_nocopy(struct adf_device *dev, +		struct adf_interface **intfs, size_t n_intfs, +		struct adf_buffer *bufs, size_t n_bufs, void *custom_data, +		size_t custom_data_size); + +#endif /* _VIDEO_ADF_CLIENT_H_ */ diff --git a/include/video/adf_fbdev.h b/include/video/adf_fbdev.h new file mode 100644 index 00000000000..9c349144b5c --- /dev/null +++ b/include/video/adf_fbdev.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2013 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 _VIDEO_ADF_FBDEV_H_ +#define _VIDEO_ADF_FBDEV_H_ + +#include <linux/fb.h> +#include <video/adf.h> + +struct adf_fbdev { +	struct adf_interface *intf; +	struct adf_overlay_engine *eng; +	struct fb_info *info; +	u32 pseudo_palette[16]; + +	bool open; + +	struct dma_buf *dma_buf; +	u32 offset; +	u32 pitch; +	void *vaddr; +	u32 format; + +	u16 default_xres_virtual; +	u16 default_yres_virtual; +	u32 default_format; +}; + +void adf_modeinfo_to_fb_videomode(const struct drm_mode_modeinfo *mode, +		struct fb_videomode *vmode); +void adf_modeinfo_from_fb_videomode(const struct fb_videomode *vmode, +		struct drm_mode_modeinfo *mode); + +int adf_fbdev_init(struct adf_fbdev *fbdev, struct adf_interface *interface, +		struct adf_overlay_engine *eng, +		u16 xres_virtual, u16 yres_virtual, u32 format, +		struct fb_ops *fbops, const char *fmt, ...); +void adf_fbdev_destroy(struct adf_fbdev *fbdev); + +int adf_fbdev_open(struct fb_info *info, int user); +int adf_fbdev_release(struct fb_info *info, int user); +int adf_fbdev_check_var(struct fb_var_screeninfo *var, struct fb_info *info); +int adf_fbdev_set_par(struct fb_info *info); +int adf_fbdev_blank(int blank, struct fb_info *info); +int adf_fbdev_pan_display(struct fb_var_screeninfo *var, struct fb_info *info); +int adf_fbdev_mmap(struct fb_info *info, struct vm_area_struct *vma); + +#endif /* _VIDEO_ADF_FBDEV_H_ */ diff --git a/include/video/adf_format.h b/include/video/adf_format.h new file mode 100644 index 00000000000..e03182cdcb0 --- /dev/null +++ b/include/video/adf_format.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2013 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 _VIDEO_ADF_FORMAT_H +#define _VIDEO_ADF_FORMAT_H + +bool adf_format_is_standard(u32 format); +bool adf_format_is_rgb(u32 format); +u8 adf_format_num_planes(u32 format); +u8 adf_format_bpp(u32 format); +u8 adf_format_plane_cpp(u32 format, int plane); +u8 adf_format_horz_chroma_subsampling(u32 format); +u8 adf_format_vert_chroma_subsampling(u32 format); + +#endif /* _VIDEO_ADF_FORMAT_H */ diff --git a/include/video/adf_memblock.h b/include/video/adf_memblock.h new file mode 100644 index 00000000000..6256e0eebcc --- /dev/null +++ b/include/video/adf_memblock.h @@ -0,0 +1,20 @@ +/* + * Copyright (C) 2013 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 _VIDEO_ADF_MEMBLOCK_H_ +#define _VIDEO_ADF_MEMBLOCK_H_ + +struct dma_buf *adf_memblock_export(phys_addr_t base, size_t size, int flags); + +#endif /* _VIDEO_ADF_MEMBLOCK_H_ */ diff --git a/include/video/omapdss.h b/include/video/omapdss.h index aeb4e9a0c5d..1a08be0990b 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h @@ -690,6 +690,10 @@ struct omap_dss_driver {  	int (*enable)(struct omap_dss_device *display);  	void (*disable)(struct omap_dss_device *display); +#if defined(CONFIG_HAS_AMBIENTMODE) +	int (*suspend)(struct omap_dss_device *display); +	int (*resume)(struct omap_dss_device *display); +#endif  	int (*run_test)(struct omap_dss_device *display, int test);  	int (*update)(struct omap_dss_device *dssdev,  |