diff options
Diffstat (limited to 'include')
27 files changed, 670 insertions, 178 deletions
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index a3ef66a2a083..be18556b84d0 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h @@ -26,6 +26,12 @@ extern unsigned long __sw_hweight64(__u64 w); (bit) < (size); \ (bit) = find_next_bit((addr), (size), (bit) + 1)) +/* same as for_each_set_bit() but use bit as value to start with */ +#define for_each_set_bit_from(bit, addr, size) \ + for ((bit) = find_next_bit((addr), (size), (bit)); \ + (bit) < (size); \ + (bit) = find_next_bit((addr), (size), (bit) + 1)) + static __inline__ int get_bitmask_order(unsigned int count) { int order; diff --git a/include/linux/clk.h b/include/linux/clk.h index 1d37f42ac294..59b428e5fbc5 100644 --- a/include/linux/clk.h +++ b/include/linux/clk.h @@ -41,6 +41,26 @@ struct clk; struct clk *clk_get(struct device *dev, const char *id); /** + * devm_clk_get - lookup and obtain a managed reference to a clock producer. + * @dev: device for clock "consumer" + * @id: clock comsumer ID + * + * Returns a struct clk corresponding to the clock producer, or + * valid IS_ERR() condition containing errno. The implementation + * uses @dev and @id to determine the clock consumer, and thereby + * the clock producer. (IOW, @id may be identical strings, but + * clk_get may return different clock producers depending on @dev.) + * + * Drivers must assume that the clock source is not enabled. + * + * devm_clk_get should not be called from within interrupt context. + * + * The clock will automatically be freed when the device is unbound + * from the bus. + */ +struct clk *devm_clk_get(struct device *dev, const char *id); + +/** * clk_enable - inform the system when the clock source should be running. * @clk: clock source * @@ -83,6 +103,18 @@ unsigned long clk_get_rate(struct clk *clk); */ void clk_put(struct clk *clk); +/** + * devm_clk_put - "free" a managed clock source + * @dev: device used to acuqire the clock + * @clk: clock source acquired with devm_clk_get() + * + * Note: drivers must ensure that all clk_enable calls made on this + * clock source are balanced by clk_disable calls prior to calling + * this function. + * + * clk_put should not be called from within interrupt context. + */ +void devm_clk_put(struct device *dev, struct clk *clk); /* * The remaining APIs are optional for machine class support. diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index c6126b9fb7cf..09b8ea9e194b 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -310,6 +310,7 @@ __ATTR(_name, 0644, show_##_name, store_##_name) *********************************************************************/ int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); int cpufreq_update_policy(unsigned int cpu); +int cpufreq_set_gov(char *target_gov, unsigned int cpu); #ifdef CONFIG_CPU_FREQ /* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ diff --git a/include/linux/device.h b/include/linux/device.h index 28c35f876b19..62608d13da3c 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -913,4 +913,25 @@ extern long sysfs_deprecated; #define sysfs_deprecated 0 #endif +/** + * module_driver() - Helper macro for drivers that don't do anything + * special in module init/exit. This eliminates a lot of boilerplate. + * Each module may only use this macro once, and calling it replaces + * module_init() and module_exit(). + * + * Use this macro to construct bus specific macros for registering + * drivers, and do not use it on its own. + */ +#define module_driver(__driver, __register, __unregister) \ +static int __init __driver##_init(void) \ +{ \ + return __register(&(__driver)); \ +} \ +module_init(__driver##_init); \ +static void __exit __driver##_exit(void) \ +{ \ + __unregister(&(__driver)); \ +} \ +module_exit(__driver##_exit); + #endif /* _DEVICE_H_ */ diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 0bd9ea2b62ea..8d3eab3226ad 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -468,6 +468,19 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap) { return adap->nr; } + +/** + * module_i2c_driver() - Helper macro for registering a I2C driver + * @__i2c_driver: i2c_driver struct + * + * Helper macro for I2C drivers which do not do anything special in module + * init/exit. This eliminates a lot of boilerplate. Each module may only + * use this macro once, and calling it replaces module_init() and module_exit() + */ +#define module_i2c_driver(__i2c_driver) \ + module_driver(__i2c_driver, i2c_add_driver, \ + i2c_del_driver) + #endif /* I2C */ #endif /* __KERNEL__ */ diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index bb92f0b13288..4fea7107fee8 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h @@ -862,22 +862,6 @@ static inline int twl4030charger_usb_en(int enable) { return 0; } #define TWL6030_REG_VDAC 45 #define TWL6030_REG_VUSB 46 -/* These are renamed in 6025 but same registers */ -#define TWL6025_REG_LDO2 48 -#define TWL6025_REG_LDO4 49 -#define TWL6025_REG_LDO3 50 -#define TWL6025_REG_LDO5 51 -#define TWL6025_REG_LDO1 52 -#define TWL6025_REG_LDO7 53 -#define TWL6025_REG_LDO6 54 -#define TWL6025_REG_LDOLN 55 -#define TWL6025_REG_LDOUSB 56 - -/* 6025 DCDC supplies */ -#define TWL6025_REG_SMPS3 57 -#define TWL6025_REG_SMPS4 58 -#define TWL6025_REG_VIO 59 - /* INTERNAL LDOs */ #define TWL6030_REG_VRTC 47 #define TWL6030_REG_CLK32KG 48 diff --git a/include/linux/interrupt_keys.h b/include/linux/interrupt_keys.h deleted file mode 100755 index 8be6e9a6b0a0..000000000000 --- a/include/linux/interrupt_keys.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * include/linux/interrupt_keys.h - * - * Key driver for keys directly connected to intrrupt lines. - * - * Copyright (c) 2011, NVIDIA Corporation. - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _INTERRUPT_KEYS_H -#define _INTERRUPT_KEYS_H - -struct interrupt_keys_button { - /* Configuration parameters */ - int code; /* input event code (KEY_*, SW_*) */ - int irq; - int active_low; - char *desc; - int type; /* input event type (EV_KEY, EV_SW) */ - int wakeup; /* configure the interrupt source as a wake-up - * source */ - int debounce_interval; /* debounce ticks interval in msecs */ - bool can_disable; -}; - -struct interrupt_keys_platform_data { - struct interrupt_keys_button *int_buttons; - int nbuttons; - unsigned int rep:1; /* enable input subsystem auto repeat */ - int (*enable)(struct device *dev); - void (*disable)(struct device *dev); -}; - -#endif diff --git a/include/linux/nct1008.h b/include/linux/nct1008.h index 0a517f1d6d89..9227f4ad82f4 100644 --- a/include/linux/nct1008.h +++ b/include/linux/nct1008.h @@ -31,6 +31,8 @@ struct nct1008_data; +enum nct1008_chip { NCT1008, NCT72 }; + struct nct1008_platform_data { bool supported_hwrev; bool ext_range; @@ -56,6 +58,7 @@ struct nct1008_data { u8 config; s8 *limits; u8 limits_sz; + enum nct1008_chip chip; void (*alarm_fn)(bool raised); struct regulator *nct_reg; long current_lo_limit; diff --git a/include/linux/nvhost.h b/include/linux/nvhost.h index da5e1e6862c6..82bb884dfbbd 100644 --- a/include/linux/nvhost.h +++ b/include/linux/nvhost.h @@ -32,6 +32,12 @@ struct nvhost_master; #define NVHOST_MODULE_MAX_POWERGATE_IDS 2 #define NVHOST_MODULE_NO_POWERGATE_IDS .powergate_ids = {-1, -1} #define NVHOST_DEFAULT_CLOCKGATE_DELAY .clockgate_delay = 25 +#define NVHOST_NAME_SIZE 24 + +struct nvhost_device_id { + char name[NVHOST_NAME_SIZE]; + unsigned long driver_data; +}; struct nvhost_clock { char *name; @@ -46,7 +52,11 @@ enum nvhost_device_powerstate_t { }; struct nvhost_device { - const char *name; /* Device name */ + /* device name: its format is of type - + * <name><ip-version>.<instance> + * e.g.: gr3d01 = gr3d ip version 01 used in tegra2 + * no instance number means hardware supports single instance */ + const char *name; struct device dev; /* Linux device struct */ int id; /* Separates clients of same hw */ int index; /* Hardware channel number */ @@ -64,6 +74,7 @@ struct nvhost_device { bool exclusive; /* True if only one user at a time */ bool keepalive; /* Do not power gate when opened */ bool waitbasesync; /* Force sync of wait bases */ + bool powerup_reset; /* Do a reset after power un-gating */ int powergate_ids[NVHOST_MODULE_MAX_POWERGATE_IDS]; bool can_powergate; /* True if module can be power gated */ @@ -81,24 +92,6 @@ struct nvhost_device { struct list_head client_list; /* List of clients and rate requests */ struct nvhost_channel *channel; /* Channel assigned for the module */ - - /* Allocates a context handler for the device */ - struct nvhost_hwctx_handler *(*alloc_hwctx_handler)(u32 syncpt, - u32 waitbase, struct nvhost_channel *ch); - /* Preparing for power off. Used for context save. */ - int (*prepare_poweroff)(struct nvhost_device *dev); - /* Finalize power on. Can be used for context restore. */ - void (*finalize_poweron)(struct nvhost_device *dev); - /* Device is busy. */ - void (*busy)(struct nvhost_device *); - /* Device is idle. */ - void (*idle)(struct nvhost_device *); - /* Device is going to be suspended */ - void (*suspend)(struct nvhost_device *); - /* Device is initialized */ - void (*init)(struct nvhost_device *dev); - /* Device is de-initialized. */ - void (*deinit)(struct nvhost_device *dev); }; /* Register device to nvhost bus */ @@ -110,12 +103,39 @@ extern void nvhost_device_unregister(struct nvhost_device *); extern struct bus_type nvhost_bus_type; struct nvhost_driver { - int (*probe)(struct nvhost_device *); + int (*probe)(struct nvhost_device *, struct nvhost_device_id *); int (*remove)(struct nvhost_device *); void (*shutdown)(struct nvhost_device *); int (*suspend)(struct nvhost_device *, pm_message_t state); int (*resume)(struct nvhost_device *); struct device_driver driver; + + struct nvhost_device_id *id_table; + + /* Finalize power on. Can be used for context restore. */ + void (*finalize_poweron)(struct nvhost_device *dev); + + /* Device is busy. */ + void (*busy)(struct nvhost_device *); + + /* Device is idle. */ + void (*idle)(struct nvhost_device *); + + /* Device is going to be suspended */ + void (*suspend_ndev)(struct nvhost_device *); + + /* Device is initialized */ + void (*init)(struct nvhost_device *dev); + + /* Device is de-initialized. */ + void (*deinit)(struct nvhost_device *dev); + + /* Preparing for power off. Used for context save. */ + int (*prepare_poweroff)(struct nvhost_device *dev); + + /* Allocates a context handler for the device */ + struct nvhost_hwctx_handler *(*alloc_hwctx_handler)(u32 syncpt, + u32 waitbase, struct nvhost_channel *ch); }; extern int nvhost_driver_register(struct nvhost_driver *); @@ -127,7 +147,7 @@ extern struct resource *nvhost_get_resource_byname(struct nvhost_device *, unsigned int, const char *); extern int nvhost_get_irq_byname(struct nvhost_device *, const char *); -#define to_nvhost_device(x) container_of((x), struct nvhost_device, dev) +#define to_nvhost_device(x) container_of((x), struct nvhost_device, dev) #define to_nvhost_driver(drv) (container_of((drv), struct nvhost_driver, \ driver)) diff --git a/include/linux/nvmap.h b/include/linux/nvmap.h new file mode 100644 index 000000000000..bea59694ad27 --- /dev/null +++ b/include/linux/nvmap.h @@ -0,0 +1,161 @@ +/* + * include/linux/nvmap.h + * + * structure declarations for nvmem and nvmap user-space ioctls + * + * Copyright (c) 2009-2012, NVIDIA Corporation. + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include <linux/ioctl.h> +#include <linux/file.h> +#include <linux/rbtree.h> + +#if !defined(__KERNEL__) +#define __user +#endif + +#ifndef __NVMAP_H +#define __NVMAP_H + +#define NVMAP_HEAP_SYSMEM (1ul<<31) +#define NVMAP_HEAP_IOVMM (1ul<<30) + +/* common carveout heaps */ +#define NVMAP_HEAP_CARVEOUT_IRAM (1ul<<29) +#define NVMAP_HEAP_CARVEOUT_VPR (1ul<<28) +#define NVMAP_HEAP_CARVEOUT_GENERIC (1ul<<0) + +#define NVMAP_HEAP_CARVEOUT_MASK (NVMAP_HEAP_IOVMM - 1) + +/* allocation flags */ +#define NVMAP_HANDLE_UNCACHEABLE (0x0ul << 0) +#define NVMAP_HANDLE_WRITE_COMBINE (0x1ul << 0) +#define NVMAP_HANDLE_INNER_CACHEABLE (0x2ul << 0) +#define NVMAP_HANDLE_CACHEABLE (0x3ul << 0) +#define NVMAP_HANDLE_CACHE_FLAG (0x3ul << 0) + +#define NVMAP_HANDLE_SECURE (0x1ul << 2) + + +#if defined(__KERNEL__) + +#if defined(CONFIG_TEGRA_NVMAP) +struct nvmap_handle; +struct nvmap_client; +struct nvmap_device; +#define nvmap_ref_to_handle(_ref) (*(struct nvmap_handle **)(_ref)) +/* Convert User space handle to Kernel. */ +#define nvmap_convert_handle_u2k(h) (h) +#elif defined(CONFIG_ION_TEGRA) +/* For Ion Mem Manager support through nvmap_* API's. */ +#include "../../../../../drivers/gpu/ion/ion_priv.h" + +#define nvmap_client ion_client +#define nvmap_device ion_device +#define nvmap_handle ion_handle +#define nvmap_handle_ref ion_handle +#define nvmap_ref_to_handle(_ref) (struct ion_handle *)_ref +/* Convert User space handle to Kernel. */ +#define nvmap_convert_handle_u2k(h) ({ \ + if ((u32)h >= TASK_SIZE) { \ + pr_err("Invalid user space handle."); \ + BUG(); \ + } \ + (*((u32 *)h)); }) +#endif + +#define nvmap_id_to_handle(_id) ((struct nvmap_handle *)(_id)) + + +struct nvmap_pinarray_elem { + __u32 patch_mem; + __u32 patch_offset; + __u32 pin_mem; + __u32 pin_offset; + __u32 reloc_shift; +}; + +#if defined(CONFIG_TEGRA_NVMAP) +/* handle_ref objects are client-local references to an nvmap_handle; + * they are distinct objects so that handles can be unpinned and + * unreferenced the correct number of times when a client abnormally + * terminates */ +struct nvmap_handle_ref { + struct nvmap_handle *handle; + struct rb_node node; + atomic_t dupes; /* number of times to free on file close */ + atomic_t pin; /* number of times to unpin on free */ +}; +#endif + +struct nvmap_client *nvmap_create_client(struct nvmap_device *dev, + const char *name); + +struct nvmap_handle_ref *nvmap_alloc(struct nvmap_client *client, size_t size, + size_t align, unsigned int flags, + unsigned int heap_mask); + +void nvmap_free(struct nvmap_client *client, struct nvmap_handle_ref *r); + +void *nvmap_mmap(struct nvmap_handle_ref *r); + +void nvmap_munmap(struct nvmap_handle_ref *r, void *addr); + +struct nvmap_client *nvmap_client_get_file(int fd); + +struct nvmap_client *nvmap_client_get(struct nvmap_client *client); + +void nvmap_client_put(struct nvmap_client *c); + +phys_addr_t nvmap_pin(struct nvmap_client *c, struct nvmap_handle_ref *r); + +phys_addr_t nvmap_handle_address(struct nvmap_client *c, unsigned long id); + +void nvmap_unpin(struct nvmap_client *client, struct nvmap_handle_ref *r); + +int nvmap_pin_array(struct nvmap_client *client, struct nvmap_handle *gather, + const struct nvmap_pinarray_elem *arr, int nr, + struct nvmap_handle **unique); + +void nvmap_unpin_handles(struct nvmap_client *client, + struct nvmap_handle **h, int nr); + +int nvmap_patch_word(struct nvmap_client *client, + struct nvmap_handle *patch, + u32 patch_offset, u32 patch_value); + +struct nvmap_handle_ref *nvmap_duplicate_handle_id(struct nvmap_client *client, + unsigned long id); + +struct nvmap_platform_carveout { + const char *name; + unsigned int usage_mask; + phys_addr_t base; + size_t size; + size_t buddy_size; +}; + +struct nvmap_platform_data { + const struct nvmap_platform_carveout *carveouts; + unsigned int nr_carveouts; +}; + +extern struct nvmap_device *nvmap_dev; + +#endif + +#endif diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 27bb05aae70d..6e25b3c1fc39 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -146,6 +146,15 @@ static inline void platform_set_drvdata(struct platform_device *pdev, void *data dev_set_drvdata(&pdev->dev, data); } +/* module_platform_driver() - Helper macro for drivers that don't do + * anything special in module init/exit. This eliminates a lot of + * boilerplate. Each module may only use this macro once, and + * calling it replaces module_init() and module_exit() + */ +#define module_platform_driver(__platform_driver) \ + module_driver(__platform_driver, platform_driver_register, \ + platform_driver_unregister) + extern struct platform_device *platform_create_bundle(struct platform_driver *driver, int (*probe)(struct platform_device *), struct resource *res, unsigned int n_res, diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 9fce3c8eb40c..6986d16aeca8 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h @@ -43,7 +43,13 @@ struct reg_default { /** * Configuration for the register map of a device. * + * @name: Optional name of the regmap. Useful when a device has multiple + * register regions. + * * @reg_bits: Number of bits in a register address, mandatory. + * @reg_stride: The register address stride. Valid register addresses are a + * multiple of this value. If set to 0, a value of 1 will be + * used. * @pad_bits: Number of bits of padding between register and value. * @val_bits: Number of bits in a register value, mandatory. * @@ -74,7 +80,10 @@ struct reg_default { * @num_reg_defaults_raw: Number of elements in reg_defaults_raw. */ struct regmap_config { + const char *name; + int reg_bits; + int reg_stride; int pad_bits; int val_bits; @@ -94,18 +103,21 @@ struct regmap_config { u8 write_flag_mask; }; -typedef int (*regmap_hw_write)(struct device *dev, const void *data, +typedef int (*regmap_hw_write)(void *context, const void *data, size_t count); -typedef int (*regmap_hw_gather_write)(struct device *dev, +typedef int (*regmap_hw_gather_write)(void *context, const void *reg, size_t reg_len, const void *val, size_t val_len); -typedef int (*regmap_hw_read)(struct device *dev, +typedef int (*regmap_hw_read)(void *context, const void *reg_buf, size_t reg_size, void *val_buf, size_t val_size); +typedef void (*regmap_hw_free_context)(void *context); /** * Description of a hardware bus for the register map infrastructure. * + * @fast_io: Register IO is fast. Use a spinlock instead of a mutex + * to perform locking. * @write: Write operation. * @gather_write: Write operation with split register/value, return -ENOTSUPP * if not implemented on a given device. @@ -115,27 +127,37 @@ typedef int (*regmap_hw_read)(struct device *dev, * a read. */ struct regmap_bus { + bool fast_io; regmap_hw_write write; regmap_hw_gather_write gather_write; regmap_hw_read read; + regmap_hw_free_context free_context; u8 read_flag_mask; }; struct regmap *regmap_init(struct device *dev, const struct regmap_bus *bus, + void *bus_context, const struct regmap_config *config); struct regmap *regmap_init_i2c(struct i2c_client *i2c, const struct regmap_config *config); struct regmap *regmap_init_spi(struct spi_device *dev, const struct regmap_config *config); +struct regmap *regmap_init_mmio(struct device *dev, + void __iomem *regs, + const struct regmap_config *config); struct regmap *devm_regmap_init(struct device *dev, const struct regmap_bus *bus, + void *bus_context, const struct regmap_config *config); struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c, const struct regmap_config *config); struct regmap *devm_regmap_init_spi(struct spi_device *dev, const struct regmap_config *config); +struct regmap *devm_regmap_init_mmio(struct device *dev, + void __iomem *regs, + const struct regmap_config *config); void regmap_exit(struct regmap *map); int regmap_reinit_cache(struct regmap *map, @@ -157,8 +179,11 @@ int regmap_update_bits_lazy(struct regmap *map, unsigned int reg, int regmap_update_bits_check(struct regmap *map, unsigned int reg, unsigned int mask, unsigned int val, bool *change); +int regmap_get_val_bytes(struct regmap *map); int regcache_sync(struct regmap *map); +int regcache_sync_region(struct regmap *map, unsigned int min, + unsigned int max); void regcache_cache_only(struct regmap *map, bool enable); void regcache_cache_bypass(struct regmap *map, bool enable); void regcache_mark_dirty(struct regmap *map); diff --git a/include/linux/regulator/gpio-switch-regulator.h b/include/linux/regulator/gpio-switch-regulator.h deleted file mode 100644 index 68776b93ef00..000000000000 --- a/include/linux/regulator/gpio-switch-regulator.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2011, NVIDIA Corporation. - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef _GPIO_SWITCH_REGULATOR_H -#define _GPIO_SWITCH_REGULATOR_H - -#include <linux/regulator/machine.h> - -/* - * struct gpio_switch_regulator_subdev_data - Gpio switch regulator subdevice - * data. - * - * Subdevice data to register a gpio regulator switch device driver. - * - * @regulator_name: The name of regulator. - * @input_supply: Input supply name. - * @id: The id of the switch. - * @gpio_nr: Gpio nr which controls this switch. - * @active_low: true if making gpio low makes voltage output enable. - * @init_state: 1 if init_state should be active. - * @voltages: Possible voltages to set at output. The values are in millivolt. - * @n_voltages: Number of voltages. - * @num_consumer_supplies: Number of cosumer supplies. - * @consumer_supplies: List of consumer spllies. - */ -struct gpio_switch_regulator_subdev_data { - const char *regulator_name; - const char *input_supply; - int id; - int gpio_nr; - int active_low; - int pin_group; - int init_state; - int *voltages; - unsigned n_voltages; - struct regulator_consumer_supply *consumer_supplies; - int num_consumer_supplies; - struct regulation_constraints constraints; - int (*enable_rail)(struct gpio_switch_regulator_subdev_data *pdata); - int (*disable_rail)(struct gpio_switch_regulator_subdev_data *pdata); - -}; - -/** - * gpio_switch_regulator_platform_data - platform data for gpio_switch_regulator - * @num_subdevs: number of regulators used - * @subdevs: pointer to regulators used - */ -struct gpio_switch_regulator_platform_data { - int num_subdevs; - struct gpio_switch_regulator_subdev_data **subdevs; -}; - -#endif diff --git a/include/linux/regulator/max8973-regulator.h b/include/linux/regulator/max8973-regulator.h new file mode 100644 index 000000000000..4b86e88b028e --- /dev/null +++ b/include/linux/regulator/max8973-regulator.h @@ -0,0 +1,77 @@ +/* + * max8973-regulator.h -- MAXIM 8973 regulator + * + * Interface for regulator driver for MAXIM 8973 DC-DC step-down + * switching regulator. + * + * Copyright (C) 2012 NVIDIA Corporation + + * Author: Laxman Dewangan <ldewangan@nvidia.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef __LINUX_REGULATOR_MAX8973_H +#define __LINUX_REGULATOR_MAX8973_H + +/* + * Control flags for configuration of the device. + * Client need to pass this information with ORed + */ +#define MAX8973_CONTROL_REMOTE_SENSE_ENABLE 0x00000001 +#define MAX8973_CONTROL_FALLING_SLEW_RATE_ENABLE 0x00000002 +#define MAX8973_CONTROL_OUTPUT_ACTIVE_DISCH_ENABLE 0x00000004 +#define MAX8973_CONTROL_BIAS_ENABLE 0x00000008 +#define MAX8973_CONTROL_PULL_DOWN_ENABLE 0x00000010 +#define MAX8973_CONTROL_FREQ_SHIFT_9PER_ENABLE 0x00000020 + +#define MAX8973_CONTROL_SLEW_RATE_12_5mV_PER_US 0x00000000 +#define MAX8973_CONTROL_SLEW_RATE_25mV_PER_US 0x00000100 +#define MAX8973_CONTROL_SLEW_RATE_50mV_PER_US 0x00000200 +#define MAX8973_CONTROL_SLEW_RATE_200MV_PER_US 0x00000300 + +#define MAX8973_CONTROL_CLKADV_TRIP_DISABLED 0x00000000 +#define MAX8973_CONTROL_CLKADV_TRIP_75mV_PER_US 0x00010000 +#define MAX8973_CONTROL_CLKADV_TRIP_150mV_PER_US 0x00020000 +#define MAX8973_CONTROL_CLKADV_TRIP_75mV_PER_US_HIST_DIS 0x00030000 + +#define MAX8973_CONTROL_INDUCTOR_VALUE_NOMINAL 0x00000000 +#define MAX8973_CONTROL_INDUCTOR_VALUE_MINUS_30_PER 0x00100000 +#define MAX8973_CONTROL_INDUCTOR_VALUE_PLUS_30_PER 0x00200000 +#define MAX8973_CONTROL_INDUCTOR_VALUE_PLUS_60_PER 0x00300000 + +/* + * struct max8973_regulator_platform_data - max8973 regulator platform data. + * + * @reg_init_data: The regulator init data. + * @control_flags: Control flags which are ORed value of above flags to + * configure device. + * @enable_ext_control: Enable the voltage enable/disable through external + * control signal from EN input pin. If it is false then + * voltage output will be enabled/disabled through EN bit of + * device register. + * @dvs_gpio: GPIO for dvs. It should be -1 if this is tied with fixed logic. + * @dvs_def_state: Default state of dvs. 1 if it is high else 0. + */ +struct max8973_regulator_platform_data { + struct regulator_init_data *reg_init_data; + unsigned long control_flags; + bool enable_ext_control; + int dvs_gpio; + unsigned dvs_def_state:1; +}; + +#endif /* __LINUX_REGULATOR_MAX8973_H */ diff --git a/include/linux/regulator/tps6238x0-regulator.h b/include/linux/regulator/tps6238x0-regulator.h new file mode 100644 index 000000000000..d7c4edc5b101 --- /dev/null +++ b/include/linux/regulator/tps6238x0-regulator.h @@ -0,0 +1,46 @@ +/* + * tps6238x0-regulator.h -- TI TPS623850/TPS623860/TPS623870 + * + * Interface for regulator driver for TI TPS623850/TPS623860/TPS623870 + * Processor core supply + * + * Copyright (C) 2012 NVIDIA Corporation + + * Author: Laxman Dewangan <ldewangan@nvidia.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef __LINUX_REGULATOR_TPS6238X0_H +#define __LINUX_REGULATOR_TPS6238X0_H + +/* + * struct tps6238x0_regulator_platform_data - tps62360 regulator platform data. + * + * @init_data: The regulator init data. + * @en_internal_pulldn: internal pull down enable or not. + * @vsel_gpio: Gpio number for vsel. It should be -1 if this is tied with + * fixed logic. + * @vsel_def_state: Default state of vsel. 1 if it is high else 0. + */ +struct tps6238x0_regulator_platform_data { + struct regulator_init_data *init_data; + bool en_internal_pulldn; + int vsel_gpio; + int vsel_def_state; +}; + +#endif /* __LINUX_REGULATOR_TPS6238X0_H */ diff --git a/include/linux/smb349-charger.h b/include/linux/smb349-charger.h index 6dbec61034ed..089f3976dbbe 100644 --- a/include/linux/smb349-charger.h +++ b/include/linux/smb349-charger.h @@ -26,6 +26,7 @@ #include <linux/regulator/machine.h> #include <linux/platform_device.h> #include <linux/regulator/driver.h> +#include <linux/usb/otg.h> struct smb349_charger_platform_data { int regulator_id; @@ -44,6 +45,7 @@ enum charging_states { }; enum charger_type { + NONE, AC, USB, }; diff --git a/include/linux/tegra_audio.h b/include/linux/tegra_audio.h index 904dde998fc4..3975913a5206 100644 --- a/include/linux/tegra_audio.h +++ b/include/linux/tegra_audio.h @@ -78,7 +78,7 @@ struct dam_srate { #ifdef CONFIG_SND_SOC_TEGRA extern bool tegra_is_voice_call_active(); #else -inline bool tegra_is_voice_call_active() +static inline bool tegra_is_voice_call_active() { return false; } diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h index 0f559ae411c8..c13dc0c0f4c3 100644 --- a/include/linux/wl12xx.h +++ b/include/linux/wl12xx.h @@ -48,8 +48,8 @@ enum { }; struct wl12xx_platform_data { - void (*set_power)(bool enable); - void (*set_carddetect)(bool enable); + int (*set_power)(int power_on); + int (*set_carddetect)(int val); /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ int irq; bool use_eeprom; diff --git a/include/media/nvc.h b/include/media/nvc.h index 9b24b0ea019e..0f9bb9bdf3d7 100644 --- a/include/media/nvc.h +++ b/include/media/nvc.h @@ -275,6 +275,7 @@ struct nvc_gpio { unsigned gpio; /* system GPIO number */ bool own; /* gets set if driver initializes */ bool active_high; /* used for GP GPIOs */ + bool valid; /* set if struct data is valid */ bool flag; /* scratch flag for driver implementation */ }; diff --git a/include/media/ov5640.h b/include/media/ov5640.h new file mode 100644 index 000000000000..edae5fe4b1a8 --- /dev/null +++ b/include/media/ov5640.h @@ -0,0 +1,64 @@ +/* + * ov5640.h - header for YUV camera sensor OV5640 driver. + * + * Copyright (C) 2012 NVIDIA Corporation. + * + * 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 __OV5640_H__ +#define __OV5640_H__ + +#include <linux/ioctl.h> /* For IOCTL macros */ + +#define OV5640_IOCTL_SET_SENSOR_MODE _IOW('o', 1, struct ov5640_mode) +#define OV5640_IOCTL_GET_SENSOR_STATUS _IOR('o', 2, __u8) +#define OV5640_IOCTL_GET_CONFIG _IOR('o', 3, struct ov5640_config) +#define OV5640_IOCTL_SET_FPOSITION _IOW('o', 4, __u32) +#define OV5640_IOCTL_POWER_LEVEL _IOW('o', 5, __u32) +#define OV5640_IOCTL_GET_AF_STATUS _IOR('o', 6, __u8) +#define OV5640_IOCTL_SET_AF_MODE _IOR('o', 7, __u8) + +#define OV5640_POWER_LEVEL_OFF 0 +#define OV5640_POWER_LEVEL_ON 1 +#define OV5640_POWER_LEVEL_SUS 2 + +struct ov5640_mode { + int xres; + int yres; +}; + +struct ov5640_config { + __u32 settle_time; + __u32 pos_low; + __u32 pos_high; + float focal_length; + float fnumber; +}; + +enum { + OV5640_AF_INIFINITY, + OV5640_AF_TRIGGER, +}; + +#ifdef __KERNEL__ +struct ov5640_platform_data { + int (*power_on)(void); + int (*power_off)(void); + +}; +#endif /* __KERNEL__ */ + +#endif /* __OV5640_H__ */ diff --git a/include/media/ov5650.h b/include/media/ov5650.h index 5c4a87cfbe8d..a8f70a592d89 100644 --- a/include/media/ov5650.h +++ b/include/media/ov5650.h @@ -32,6 +32,7 @@ #define OV5650_IOCTL_SET_GROUP_HOLD _IOW('o', 8, struct ov5650_ae) #define OV5650_IOCTL_SET_CAMERA_MODE _IOW('o', 10, __u32) #define OV5650_IOCTL_SYNC_SENSORS _IOW('o', 11, __u32) +#define OV5650_IOCTL_GET_SENSORDATA _IOR('o', 12, struct ov5650_sensordata) /* OV5650 registers */ #define OV5650_SRM_GRUP_ACCESS (0x3212) @@ -64,6 +65,11 @@ enum ov5650_test_pattern { TEST_PATTERN_CHECKERBOARD }; +struct ov5650_sensordata { + __u32 fuse_id_size; + __u8 fuse_id[16]; +}; + struct ov5650_mode { int xres; int yres; diff --git a/include/media/sh532u.h b/include/media/sh532u.h index 19da2070b70f..e9653e68b21f 100644 --- a/include/media/sh532u.h +++ b/include/media/sh532u.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 NVIDIA Corporation. + * Copyright (C) 2011-2012 NVIDIA Corporation. * * 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 @@ -19,25 +19,23 @@ #ifndef __SH532U_H__ #define __SH532U_H__ +#include <media/nvc.h> #include <media/nvc_focus.h> +/* See notes in the nvc.h file on the GPIO usage */ +enum sh532u_gpio { + SH532U_GPIO_RESET = 0, + SH532U_GPIO_I2CMUX, + SH532U_GPIO_GP1, + SH532U_GPIO_GP2, + SH532U_GPIO_GP3, +}; -struct sh532u_platform_data { - int cfg; - int num; - int sync; - const char *dev_name; - struct nvc_focus_nvc (*nvc); - struct nvc_focus_cap (*cap); - struct sh532u_pdata_info (*info); - __u8 i2c_addr_rom; - unsigned gpio_reset; -/* Due to a Linux limitation, a GPIO is defined to "enable" the device. This - * workaround is for when the device's power GPIO's are behind an I2C expander. - * The Linux limitation doesn't allow the I2C GPIO expander to be ready for - * use when this device is probed. - */ - unsigned gpio_en; +/* The enumeration must be in the order the regulators are to be enabled */ +/* See Power Requirements note in the driver */ +enum sh532u_vreg { + SH532U_VREG_DVDD = 0, + SH532U_VREG_AVDD, }; struct sh532u_pdata_info { @@ -50,6 +48,18 @@ struct sh532u_pdata_info { __u32 focus_hyper_div; }; +struct sh532u_platform_data { + unsigned cfg; + unsigned num; + unsigned sync; + const char *dev_name; + unsigned gpio_count; /* see nvc.h GPIO notes */ + struct nvc_gpio_pdata *gpio; /* see nvc.h GPIO notes */ + struct nvc_focus_nvc (*nvc); + struct nvc_focus_cap (*cap); + struct sh532u_pdata_info (*info); + __u8 i2c_addr_rom; +}; /* Register Definition : Sany Driver IC */ /* EEPROM addresses */ diff --git a/include/media/tegra_camera.h b/include/media/tegra_camera.h index d7d08bd9a99b..9dea1485781d 100644 --- a/include/media/tegra_camera.h +++ b/include/media/tegra_camera.h @@ -23,11 +23,14 @@ enum { TEGRA_CAMERA_MODULE_ISP = 0, TEGRA_CAMERA_MODULE_VI, TEGRA_CAMERA_MODULE_CSI, + TEGRA_CAMERA_MODULE_EMC, + TEGRA_CAMERA_MODULE_MAX }; enum { TEGRA_CAMERA_VI_CLK, TEGRA_CAMERA_VI_SENSOR_CLK, + TEGRA_CAMERA_EMC_CLK }; struct tegra_camera_clk_info { diff --git a/include/trace/events/nvhost.h b/include/trace/events/nvhost.h index 4c44cdc99f98..4bb79e30fc19 100644 --- a/include/trace/events/nvhost.h +++ b/include/trace/events/nvhost.h @@ -138,7 +138,28 @@ TRACE_EVENT(nvhost_channel_write_cmdbuf, __entry->words, __entry->offset) ); -TRACE_EVENT(nvhost_channel_write_cmdbuf_data, +TRACE_EVENT(nvhost_cdma_push, + TP_PROTO(const char *name, u32 op1, u32 op2), + + TP_ARGS(name, op1, op2), + + TP_STRUCT__entry( + __field(const char *, name) + __field(u32, op1) + __field(u32, op2) + ), + + TP_fast_assign( + __entry->name = name; + __entry->op1 = op1; + __entry->op2 = op2; + ), + + TP_printk("name=%s, op1=%08x, op2=%08x", + __entry->name, __entry->op1, __entry->op2) +); + +TRACE_EVENT(nvhost_cdma_push_gather, TP_PROTO(const char *name, u32 mem_id, u32 words, u32 offset, void *cmdbuf), @@ -432,6 +453,48 @@ TRACE_EVENT(nvhost_wait_cdma, TP_printk("name=%s, event=%d", __entry->name, __entry->eventid) ); +TRACE_EVENT(nvhost_syncpt_update_min, + TP_PROTO(u32 id, u32 val), + + TP_ARGS(id, val), + + TP_STRUCT__entry( + __field(u32, id) + __field(u32, val) + ), + + TP_fast_assign( + __entry->id = id; + __entry->val = val; + ), + + TP_printk("id=%d, val=%d", __entry->id, __entry->val) +); + +TRACE_EVENT(nvhost_syncpt_wait_check, + TP_PROTO(u32 mem_id, u32 offset, u32 syncpt_id, u32 val), + + TP_ARGS(mem_id, offset, syncpt_id, val), + + TP_STRUCT__entry( + __field(u32, mem_id) + __field(u32, offset) + __field(u32, syncpt_id) + __field(u32, val) + ), + + TP_fast_assign( + __entry->mem_id = mem_id; + __entry->offset = offset; + __entry->syncpt_id = syncpt_id; + __entry->val = val; + ), + + TP_printk("mem_id=%08x, offset=%05x, id=%d, val=%d", + __entry->mem_id, __entry->offset, + __entry->syncpt_id, __entry->val) +); + #endif /* _TRACE_NVHOST_H */ /* This part must be outside protection */ diff --git a/include/trace/events/power.h b/include/trace/events/power.h index 9c9699a2b457..5b503e9b661c 100644 --- a/include/trace/events/power.h +++ b/include/trace/events/power.h @@ -41,6 +41,11 @@ DEFINE_EVENT(cpu, cpu_idle, #define PWR_EVENT_EXIT -1 enum { + CPU_SUSPEND_START, + CPU_SUSPEND_DONE +}; + +enum { POWER_CPU_UP_START, POWER_CPU_UP_DONE, POWER_CPU_DOWN_START, @@ -59,6 +64,23 @@ enum { #endif +TRACE_EVENT(cpu_suspend, + + TP_PROTO(unsigned int state), + + TP_ARGS(state), + + TP_STRUCT__entry( + __field(u32, state) + ), + + TP_fast_assign( + __entry->state = state; + ), + + TP_printk("state=%lu", (unsigned long)__entry->state) +); + TRACE_EVENT(cpu_hotplug, TP_PROTO(unsigned int cpu_id, int state), diff --git a/include/trace/events/regmap.h b/include/trace/events/regmap.h index 12fbf43524e9..d69738280ffa 100644 --- a/include/trace/events/regmap.h +++ b/include/trace/events/regmap.h @@ -139,6 +139,42 @@ TRACE_EVENT(regcache_sync, __get_str(type), __get_str(status)) ); +DECLARE_EVENT_CLASS(regmap_bool, + + TP_PROTO(struct device *dev, bool flag), + + TP_ARGS(dev, flag), + + TP_STRUCT__entry( + __string( name, dev_name(dev) ) + __field( int, flag ) + ), + + TP_fast_assign( + __assign_str(name, dev_name(dev)); + __entry->flag = flag; + ), + + TP_printk("%s flag=%d", __get_str(name), + (int)__entry->flag) +); + +DEFINE_EVENT(regmap_bool, regmap_cache_only, + + TP_PROTO(struct device *dev, bool flag), + + TP_ARGS(dev, flag) + +); + +DEFINE_EVENT(regmap_bool, regmap_cache_bypass, + + TP_PROTO(struct device *dev, bool flag), + + TP_ARGS(dev, flag) + +); + #endif /* _TRACE_REGMAP_H */ /* This part must be outside protection */ diff --git a/include/video/tegra_dc_ext.h b/include/video/tegra_dc_ext.h index f46074b1e559..76bb34b01af1 100644 --- a/include/video/tegra_dc_ext.h +++ b/include/video/tegra_dc_ext.h @@ -59,6 +59,7 @@ #define TEGRA_DC_EXT_FLIP_FLAG_INVERT_V (1 << 1) #define TEGRA_DC_EXT_FLIP_FLAG_TILED (1 << 2) #define TEGRA_DC_EXT_FLIP_FLAG_CURSOR (1 << 3) +#define TEGRA_DC_EXT_FLIP_FLAG_GLOBAL_ALPHA (1 << 4) struct tegra_dc_ext_flip_windowattr { __s32 index; @@ -91,8 +92,10 @@ struct tegra_dc_ext_flip_windowattr { __u32 buff_id_u; __u32 buff_id_v; __u32 flags; + __u8 global_alpha; /* requires TEGRA_DC_EXT_FLIP_FLAG_GLOBAL_ALPHA */ /* Leave some wiggle room for future expansion */ - __u32 pad[5]; + __u8 pad1[3]; + __u32 pad2[4]; }; #define TEGRA_DC_EXT_FLIP_N_WINDOWS 3 |