diff options
Diffstat (limited to 'include')
34 files changed, 1945 insertions, 1057 deletions
diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h index 9975eef4cad..594d836df37 100644 --- a/include/linux/dma-contiguous.h +++ b/include/linux/dma-contiguous.h @@ -74,7 +74,8 @@ void dma_contiguous_reserve(phys_addr_t addr_limit); int dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t *res_base, phys_addr_t limit, const char *name, - bool in_system); + bool in_system, + bool remove); int dma_contiguous_add_device(struct device *dev, phys_addr_t base); @@ -95,7 +96,8 @@ static inline int dma_declare_contiguous(struct device *dev, phys_addr_t size, phys_addr_t base, phys_addr_t limit) { int ret; - ret = dma_contiguous_reserve_area(size, &base, limit, NULL, true); + ret = dma_contiguous_reserve_area(size, &base, limit, NULL, true, + false); if (ret == 0) ret = dma_contiguous_add_device(dev, base); return ret; @@ -107,15 +109,16 @@ static inline int dma_declare_contiguous_reserved(struct device *dev, phys_addr_t limit) { int ret; - ret = dma_contiguous_reserve_area(size, &base, limit, NULL, false); + ret = dma_contiguous_reserve_area(size, &base, limit, NULL, false, + false); if (ret == 0) ret = dma_contiguous_add_device(dev, base); return ret; } -struct page *dma_alloc_from_contiguous(struct device *dev, int count, +unsigned long dma_alloc_from_contiguous(struct device *dev, int count, unsigned int order); -bool dma_release_from_contiguous(struct device *dev, struct page *pages, +bool dma_release_from_contiguous(struct device *dev, unsigned long pfn, int count); #else @@ -132,14 +135,14 @@ int dma_declare_contiguous(struct device *dev, phys_addr_t size, } static inline -struct page *dma_alloc_from_contiguous(struct device *dev, int count, +unsigned long dma_alloc_from_contiguous(struct device *dev, int count, unsigned int order) { - return NULL; + return 0; } static inline -bool dma_release_from_contiguous(struct device *dev, struct page *pages, +bool dma_release_from_contiguous(struct device *dev, unsigned long pfn, int count) { return false; diff --git a/include/linux/dma-removed.h b/include/linux/dma-removed.h new file mode 100644 index 00000000000..3a0f1a4b45e --- /dev/null +++ b/include/linux/dma-removed.h @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2013-2014, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <linux/dma-mapping.h> + +extern struct dma_map_ops removed_dma_ops; diff --git a/include/linux/ion.h b/include/linux/ion.h index 7c55c7d27a8..242fef6ba99 100644 --- a/include/linux/ion.h +++ b/include/linux/ion.h @@ -1,276 +1,6 @@ -/* - * include/linux/ion.h - * - * Copyright (C) 2011 Google, Inc. - * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ +#ifndef __LINUX_ION_H__ +#define __LINUX_ION_H__ -#ifndef _LINUX_ION_H -#define _LINUX_ION_H +#include "../../drivers/staging/android/ion/ion.h" -#include <linux/err.h> -#include <uapi/linux/ion.h> - -struct ion_device; -struct ion_heap; -struct ion_mapper; -struct ion_client; -struct ion_buffer; - -/* This should be removed some day when phys_addr_t's are fully - plumbed in the kernel, and all instances of ion_phys_addr_t should - be converted to phys_addr_t. For the time being many kernel interfaces - do not accept phys_addr_t's that would have to */ -#define ion_phys_addr_t dma_addr_t - -/** - * struct ion_platform_heap - defines a heap in the given platform - * @type: type of the heap from ion_heap_type enum - * @id: unique identifier for heap. When allocating higher numbers - * will be allocated from first. At allocation these are passed - * as a bit mask and therefore can not exceed ION_NUM_HEAP_IDS. - * @name: used for debug purposes - * @base: base address of heap in physical memory if applicable - * @size: size of the heap in bytes if applicable - * @has_outer_cache: set to 1 if outer cache is used, 0 otherwise. - * @extra_data: Extra data specific to each heap type - * @priv: heap private data - * @align: required alignment in physical memory if applicable - * @priv: private info passed from the board file - * - * Provided by the board file. - */ -struct ion_platform_heap { - enum ion_heap_type type; - unsigned int id; - const char *name; - ion_phys_addr_t base; - size_t size; - unsigned int has_outer_cache; - void *extra_data; - ion_phys_addr_t align; - void *priv; -}; - -/** - * struct ion_platform_data - array of platform heaps passed from board file - * @has_outer_cache: set to 1 if outer cache is used, 0 otherwise. - * @nr: number of structures in the array - * @heaps: array of platform_heap structions - * - * Provided by the board file in the form of platform data to a platform device. - */ -struct ion_platform_data { - unsigned int has_outer_cache; - int nr; - struct ion_platform_heap *heaps; -}; - -#ifdef CONFIG_ION - -/** - * ion_reserve() - reserve memory for ion heaps if applicable - * @data: platform data specifying starting physical address and - * size - * - * Calls memblock reserve to set aside memory for heaps that are - * located at specific memory addresses or of specfic sizes not - * managed by the kernel - */ -void ion_reserve(struct ion_platform_data *data); - -/** - * ion_client_create() - allocate a client and returns it - * @dev: the global ion device - * @heap_type_mask: mask of heaps this client can allocate from - * @name: used for debugging - */ -struct ion_client *ion_client_create(struct ion_device *dev, - const char *name); - -/** - * ion_client_destroy() - free's a client and all it's handles - * @client: the client - * - * Free the provided client and all it's resources including - * any handles it is holding. - */ -void ion_client_destroy(struct ion_client *client); - -/** - * ion_alloc - allocate ion memory - * @client: the client - * @len: size of the allocation - * @align: requested allocation alignment, lots of hardware blocks - * have alignment requirements of some kind - * @heap_id_mask: mask of heaps to allocate from, if multiple bits are set - * heaps will be tried in order from highest to lowest - * id - * @flags: heap flags, the low 16 bits are consumed by ion, the - * high 16 bits are passed on to the respective heap and - * can be heap custom - * - * Allocate memory in one of the heaps provided in heap mask and return - * an opaque handle to it. - */ -struct ion_handle *ion_alloc(struct ion_client *client, size_t len, - size_t align, unsigned int heap_id_mask, - unsigned int flags); - -/** - * ion_free - free a handle - * @client: the client - * @handle: the handle to free - * - * Free the provided handle. - */ -void ion_free(struct ion_client *client, struct ion_handle *handle); - -/** - * ion_phys - returns the physical address and len of a handle - * @client: the client - * @handle: the handle - * @addr: a pointer to put the address in - * @len: a pointer to put the length in - * - * This function queries the heap for a particular handle to get the - * handle's physical address. It't output is only correct if - * a heap returns physically contiguous memory -- in other cases - * this api should not be implemented -- ion_sg_table should be used - * instead. Returns -EINVAL if the handle is invalid. This has - * no implications on the reference counting of the handle -- - * the returned value may not be valid if the caller is not - * holding a reference. - */ -int ion_phys(struct ion_client *client, struct ion_handle *handle, - ion_phys_addr_t *addr, size_t *len); - -/** - * ion_map_dma - return an sg_table describing a handle - * @client: the client - * @handle: the handle - * - * This function returns the sg_table describing - * a particular ion handle. - */ -struct sg_table *ion_sg_table(struct ion_client *client, - struct ion_handle *handle); - -/** - * ion_map_kernel - create mapping for the given handle - * @client: the client - * @handle: handle to map - * - * Map the given handle into the kernel and return a kernel address that - * can be used to access this address. - */ -void *ion_map_kernel(struct ion_client *client, struct ion_handle *handle); - -/** - * ion_unmap_kernel() - destroy a kernel mapping for a handle - * @client: the client - * @handle: handle to unmap - */ -void ion_unmap_kernel(struct ion_client *client, struct ion_handle *handle); - -/** - * ion_share_dma_buf() - share buffer as dma-buf - * @client: the client - * @handle: the handle - */ -struct dma_buf *ion_share_dma_buf(struct ion_client *client, - struct ion_handle *handle); - -/** - * ion_share_dma_buf_fd() - given an ion client, create a dma-buf fd - * @client: the client - * @handle: the handle - */ -int ion_share_dma_buf_fd(struct ion_client *client, struct ion_handle *handle); - -/** - * ion_import_dma_buf() - given an dma-buf fd from the ion exporter get handle - * @client: the client - * @fd: the dma-buf fd - * - * Given an dma-buf fd that was allocated through ion via ion_share_dma_buf, - * import that fd and return a handle representing it. If a dma-buf from - * another exporter is passed in this function will return ERR_PTR(-EINVAL) - */ -struct ion_handle *ion_import_dma_buf(struct ion_client *client, int fd); - -#else -static inline void ion_reserve(struct ion_platform_data *data) -{ - -} - -static inline struct ion_client *ion_client_create(struct ion_device *dev, - unsigned int heap_mask, const char *name) -{ - return ERR_PTR(-ENODEV); -} - -static inline void ion_client_destroy(struct ion_client *client) { } - -static inline struct ion_handle *ion_alloc(struct ion_client *client, - size_t len, size_t align, - unsigned int heap_mask, - unsigned int flags) -{ - return ERR_PTR(-ENODEV); -} - -static inline void ion_free(struct ion_client *client, - struct ion_handle *handle) { } - - -static inline int ion_phys(struct ion_client *client, - struct ion_handle *handle, ion_phys_addr_t *addr, size_t *len) -{ - return -ENODEV; -} - -static inline struct sg_table *ion_sg_table(struct ion_client *client, - struct ion_handle *handle) -{ - return ERR_PTR(-ENODEV); -} - -static inline void *ion_map_kernel(struct ion_client *client, - struct ion_handle *handle) -{ - return ERR_PTR(-ENODEV); -} - -static inline void ion_unmap_kernel(struct ion_client *client, - struct ion_handle *handle) { } - -static inline int ion_share_dma_buf(struct ion_client *client, struct ion_handle *handle) -{ - return -ENODEV; -} - -static inline struct ion_handle *ion_import_dma_buf(struct ion_client *client, int fd) -{ - return ERR_PTR(-ENODEV); -} - -static inline int ion_handle_get_flags(struct ion_client *client, - struct ion_handle *handle, unsigned long *flags) -{ - return -ENODEV; -} - -#endif /* CONFIG_ION */ -#endif /* _LINUX_ION_H */ +#endif /* __LINUX_ION_H__ */ diff --git a/include/linux/mdss_io_util.h b/include/linux/mdss_io_util.h new file mode 100644 index 00000000000..6ad21e88787 --- /dev/null +++ b/include/linux/mdss_io_util.h @@ -0,0 +1,112 @@ +/* Copyright (c) 2012, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __MDSS_IO_UTIL_H__ +#define __MDSS_IO_UTIL_H__ + +#include <linux/gpio.h> +#include <linux/platform_device.h> +#include <linux/regulator/consumer.h> +#include <linux/i2c.h> +#include <linux/types.h> + +#ifdef DEBUG +#define DEV_DBG(fmt, args...) pr_err(fmt, ##args) +#else +#define DEV_DBG(fmt, args...) pr_debug(fmt, ##args) +#endif +#define DEV_INFO(fmt, args...) pr_info(fmt, ##args) +#define DEV_WARN(fmt, args...) pr_warn(fmt, ##args) +#define DEV_ERR(fmt, args...) pr_err(fmt, ##args) + +struct dss_io_data { + u32 len; + void __iomem *base; +}; + +void dss_reg_w(struct dss_io_data *io, u32 offset, u32 value, u32 debug); +u32 dss_reg_r(struct dss_io_data *io, u32 offset, u32 debug); +void dss_reg_dump(void __iomem *base, u32 len, const char *prefix, u32 debug); + +#define DSS_REG_W_ND(io, offset, val) dss_reg_w(io, offset, val, false) +#define DSS_REG_W(io, offset, val) dss_reg_w(io, offset, val, true) +#define DSS_REG_R_ND(io, offset) dss_reg_r(io, offset, false) +#define DSS_REG_R(io, offset) dss_reg_r(io, offset, true) + +enum dss_vreg_type { + DSS_REG_LDO, + DSS_REG_VS, +}; + +struct dss_vreg { + struct regulator *vreg; /* vreg handle */ + char vreg_name[32]; + int min_voltage; + int max_voltage; + int enable_load; + int disable_load; + int pre_on_sleep; + int post_on_sleep; + int pre_off_sleep; + int post_off_sleep; +}; + +struct dss_gpio { + unsigned gpio; + unsigned value; + char gpio_name[32]; +}; + +enum dss_clk_type { + DSS_CLK_AHB, /* no set rate. rate controlled through rpm */ + DSS_CLK_PCLK, + DSS_CLK_OTHER, +}; + +struct dss_clk { + struct clk *clk; /* clk handle */ + char clk_name[32]; + enum dss_clk_type type; + unsigned long rate; +}; + +struct dss_module_power { + unsigned num_vreg; + struct dss_vreg *vreg_config; + unsigned num_gpio; + struct dss_gpio *gpio_config; + unsigned num_clk; + struct dss_clk *clk_config; +}; + +int msm_dss_ioremap_byname(struct platform_device *pdev, + struct dss_io_data *io_data, const char *name); +void msm_dss_iounmap(struct dss_io_data *io_data); + +int msm_dss_enable_gpio(struct dss_gpio *in_gpio, int num_gpio, int enable); +int msm_dss_gpio_enable(struct dss_gpio *in_gpio, int num_gpio, int enable); + +int msm_dss_config_vreg(struct device *dev, struct dss_vreg *in_vreg, + int num_vreg, int config); +int msm_dss_enable_vreg(struct dss_vreg *in_vreg, int num_vreg, int enable); + +int msm_dss_get_clk(struct device *dev, struct dss_clk *clk_arry, int num_clk); +void msm_dss_put_clk(struct dss_clk *clk_arry, int num_clk); +int msm_dss_clk_set_rate(struct dss_clk *clk_arry, int num_clk); +int msm_dss_enable_clk(struct dss_clk *clk_arry, int num_clk, int enable); + +int mdss_i2c_byte_read(struct i2c_client *client, uint8_t slave_addr, + uint8_t reg_offset, uint8_t *read_buf); +int mdss_i2c_byte_write(struct i2c_client *client, uint8_t slave_addr, + uint8_t reg_offset, uint8_t *value); + +#endif /* __MDSS_IO_UTIL_H__ */ diff --git a/include/linux/msm_ion.h b/include/linux/msm_ion.h index c84f67caa3d..04afdf58742 100644 --- a/include/linux/msm_ion.h +++ b/include/linux/msm_ion.h @@ -1,378 +1,6 @@ -#ifndef _LINUX_MSM_ION_H -#define _LINUX_MSM_ION_H +#ifndef __LINUX_MSM_ION_H__ +#define __LINUX_MSM_ION_H__ -#include <uapi/linux/msm_ion.h> +#include "../../drivers/staging/android/ion/msm/msm_ion.h" -enum ion_permission_type { - IPT_TYPE_MM_CARVEOUT = 0, - IPT_TYPE_MFC_SHAREDMEM = 1, - IPT_TYPE_MDP_WRITEBACK = 2, -}; - -/* - * This flag allows clients when mapping into the IOMMU to specify to - * defer un-mapping from the IOMMU until the buffer memory is freed. - */ -#define ION_IOMMU_UNMAP_DELAYED 1 - -/* - * This flag allows clients to defer unsecuring a buffer until the buffer - * is actually freed. - */ -#define ION_UNSECURE_DELAYED 1 - -/** - * struct ion_cp_heap_pdata - defines a content protection heap in the given - * platform - * @permission_type: Memory ID used to identify the memory to TZ - * @align: Alignment requirement for the memory - * @secure_base: Base address for securing the heap. - * Note: This might be different from actual base address - * of this heap in the case of a shared heap. - * @secure_size: Memory size for securing the heap. - * Note: This might be different from actual size - * of this heap in the case of a shared heap. - * @fixed_position If nonzero, position in the fixed area. - * @iommu_map_all: Indicates whether we should map whole heap into IOMMU. - * @iommu_2x_map_domain: Indicates the domain to use for overmapping. - * @request_region: function to be called when the number of allocations - * goes from 0 -> 1 - * @release_region: function to be called when the number of allocations - * goes from 1 -> 0 - * @setup_region: function to be called upon ion registration - * @allow_nonsecure_alloc: allow non-secure allocations from this heap. For - * secure heaps, this flag must be set so allow non-secure - * allocations. For non-secure heaps, this flag is ignored. - * - */ -struct ion_cp_heap_pdata { - enum ion_permission_type permission_type; - unsigned int align; - ion_phys_addr_t secure_base; /* Base addr used when heap is shared */ - size_t secure_size; /* Size used for securing heap when heap is shared*/ - int is_cma; - enum ion_fixed_position fixed_position; - int iommu_map_all; - int iommu_2x_map_domain; - int (*request_region)(void *); - int (*release_region)(void *); - void *(*setup_region)(void); - int allow_nonsecure_alloc; -}; - -/** - * struct ion_co_heap_pdata - defines a carveout heap in the given platform - * @adjacent_mem_id: Id of heap that this heap must be adjacent to. - * @align: Alignment requirement for the memory - * @fixed_position If nonzero, position in the fixed area. - * @request_region: function to be called when the number of allocations - * goes from 0 -> 1 - * @release_region: function to be called when the number of allocations - * goes from 1 -> 0 - * @setup_region: function to be called upon ion registration - * @memory_type:Memory type used for the heap - * - */ -struct ion_co_heap_pdata { - int adjacent_mem_id; - unsigned int align; - enum ion_fixed_position fixed_position; - int (*request_region)(void *); - int (*release_region)(void *); - void *(*setup_region)(void); -}; - -/** - * struct ion_cma_pdata - extra data for CMA regions - * @default_prefetch_size - default size to use for prefetching - */ -struct ion_cma_pdata { - unsigned long default_prefetch_size; -}; - -#ifdef CONFIG_ION -/** - * msm_ion_client_create - allocate a client using the ion_device specified in - * drivers/gpu/ion/msm/msm_ion.c - * - * heap_mask and name are the same as ion_client_create, return values - * are the same as ion_client_create. - */ - -struct ion_client *msm_ion_client_create(unsigned int heap_mask, - const char *name); - -/** - * ion_handle_get_flags - get the flags for a given handle - * - * @client - client who allocated the handle - * @handle - handle to get the flags - * @flags - pointer to store the flags - * - * Gets the current flags for a handle. These flags indicate various options - * of the buffer (caching, security, etc.) - */ -int ion_handle_get_flags(struct ion_client *client, struct ion_handle *handle, - unsigned long *flags); - - -/** - * ion_map_iommu - map the given handle into an iommu - * - * @client - client who allocated the handle - * @handle - handle to map - * @domain_num - domain number to map to - * @partition_num - partition number to allocate iova from - * @align - alignment for the iova - * @iova_length - length of iova to map. If the iova length is - * greater than the handle length, the remaining - * address space will be mapped to a dummy buffer. - * @iova - pointer to store the iova address - * @buffer_size - pointer to store the size of the buffer - * @flags - flags for options to map - * @iommu_flags - flags specific to the iommu. - * - * Maps the handle into the iova space specified via domain number. Iova - * will be allocated from the partition specified via partition_num. - * Returns 0 on success, negative value on error. - */ -int ion_map_iommu(struct ion_client *client, struct ion_handle *handle, - int domain_num, int partition_num, unsigned long align, - unsigned long iova_length, ion_phys_addr_t *iova, - unsigned long *buffer_size, - unsigned long flags, unsigned long iommu_flags); - - -/** - * ion_handle_get_size - get the allocated size of a given handle - * - * @client - client who allocated the handle - * @handle - handle to get the size - * @size - pointer to store the size - * - * gives the allocated size of a handle. returns 0 on success, negative - * value on error - * - * NOTE: This is intended to be used only to get a size to pass to map_iommu. - * You should *NOT* rely on this for any other usage. - */ - -int ion_handle_get_size(struct ion_client *client, struct ion_handle *handle, - unsigned long *size); - -/** - * ion_unmap_iommu - unmap the handle from an iommu - * - * @client - client who allocated the handle - * @handle - handle to unmap - * @domain_num - domain to unmap from - * @partition_num - partition to unmap from - * - * Decrement the reference count on the iommu mapping. If the count is - * 0, the mapping will be removed from the iommu. - */ -void ion_unmap_iommu(struct ion_client *client, struct ion_handle *handle, - int domain_num, int partition_num); - - -/** - * ion_secure_heap - secure a heap - * - * @client - a client that has allocated from the heap heap_id - * @heap_id - heap id to secure. - * @version - version of content protection - * @data - extra data needed for protection - * - * Secure a heap - * Returns 0 on success - */ -int ion_secure_heap(struct ion_device *dev, int heap_id, int version, - void *data); - -/** - * ion_unsecure_heap - un-secure a heap - * - * @client - a client that has allocated from the heap heap_id - * @heap_id - heap id to un-secure. - * @version - version of content protection - * @data - extra data needed for protection - * - * Un-secure a heap - * Returns 0 on success - */ -int ion_unsecure_heap(struct ion_device *dev, int heap_id, int version, - void *data); - -/** - * msm_ion_do_cache_op - do cache operations. - * - * @client - pointer to ION client. - * @handle - pointer to buffer handle. - * @vaddr - virtual address to operate on. - * @len - Length of data to do cache operation on. - * @cmd - Cache operation to perform: - * ION_IOC_CLEAN_CACHES - * ION_IOC_INV_CACHES - * ION_IOC_CLEAN_INV_CACHES - * - * Returns 0 on success - */ -int msm_ion_do_cache_op(struct ion_client *client, struct ion_handle *handle, - void *vaddr, unsigned long len, unsigned int cmd); - -/** - * msm_ion_secure_heap - secure a heap. Wrapper around ion_secure_heap. - * - * @heap_id - heap id to secure. - * - * Secure a heap - * Returns 0 on success - */ -int msm_ion_secure_heap(int heap_id); - -/** - * msm_ion_unsecure_heap - unsecure a heap. Wrapper around ion_unsecure_heap. - * - * @heap_id - heap id to secure. - * - * Un-secure a heap - * Returns 0 on success - */ -int msm_ion_unsecure_heap(int heap_id); - -/** - * msm_ion_secure_heap_2_0 - secure a heap using 2.0 APIs - * Wrapper around ion_secure_heap. - * - * @heap_id - heap id to secure. - * @usage - usage hint to TZ - * - * Secure a heap - * Returns 0 on success - */ -int msm_ion_secure_heap_2_0(int heap_id, enum cp_mem_usage usage); - -/** - * msm_ion_unsecure_heap - unsecure a heap secured with 3.0 APIs. - * Wrapper around ion_unsecure_heap. - * - * @heap_id - heap id to secure. - * @usage - usage hint to TZ - * - * Un-secure a heap - * Returns 0 on success - */ -int msm_ion_unsecure_heap_2_0(int heap_id, enum cp_mem_usage usage); - -/** - * msm_ion_secure_buffer - secure an individual buffer - * - * @client - client who has access to the buffer - * @handle - buffer to secure - * @usage - usage hint to TZ - * @flags - flags for the securing - */ -int msm_ion_secure_buffer(struct ion_client *client, struct ion_handle *handle, - enum cp_mem_usage usage, int flags); - -/** - * msm_ion_unsecure_buffer - unsecure an individual buffer - * - * @client - client who has access to the buffer - * @handle - buffer to secure - */ -int msm_ion_unsecure_buffer(struct ion_client *client, - struct ion_handle *handle); -#else -static inline struct ion_client *msm_ion_client_create(unsigned int heap_mask, - const char *name) -{ - return ERR_PTR(-ENODEV); -} - -static inline int ion_map_iommu(struct ion_client *client, - struct ion_handle *handle, int domain_num, - int partition_num, unsigned long align, - unsigned long iova_length, ion_phys_addr_t *iova, - unsigned long *buffer_size, - unsigned long flags, - unsigned long iommu_flags) -{ - return -ENODEV; -} - -static inline int ion_handle_get_size(struct ion_client *client, - struct ion_handle *handle, unsigned long *size) -{ - return -ENODEV; -} - -static inline void ion_unmap_iommu(struct ion_client *client, - struct ion_handle *handle, int domain_num, - int partition_num) -{ - return; -} - -static inline int ion_secure_heap(struct ion_device *dev, int heap_id, - int version, void *data) -{ - return -ENODEV; - -} - -static inline int ion_unsecure_heap(struct ion_device *dev, int heap_id, - int version, void *data) -{ - return -ENODEV; -} - -static inline void ion_mark_dangling_buffers_locked(struct ion_device *dev) -{ -} - -static inline int msm_ion_do_cache_op(struct ion_client *client, - struct ion_handle *handle, void *vaddr, - unsigned long len, unsigned int cmd) -{ - return -ENODEV; -} - -static inline int msm_ion_secure_heap(int heap_id) -{ - return -ENODEV; - -} - -static inline int msm_ion_unsecure_heap(int heap_id) -{ - return -ENODEV; -} - -static inline int msm_ion_secure_heap_2_0(int heap_id, enum cp_mem_usage usage) -{ - return -ENODEV; -} - -static inline int msm_ion_unsecure_heap_2_0(int heap_id, - enum cp_mem_usage usage) -{ - return -ENODEV; -} - -static inline int msm_ion_secure_buffer(struct ion_client *client, - struct ion_handle *handle, - enum cp_mem_usage usage, - int flags) -{ - return -ENODEV; -} - -static inline int msm_ion_unsecure_buffer(struct ion_client *client, - struct ion_handle *handle) -{ - return -ENODEV; -} -#endif /* CONFIG_ION */ - -#endif +#endif /* __LINUX_MSM_ION_H__ */ diff --git a/include/linux/msm_kgsl.h b/include/linux/msm_kgsl.h index 0203b64b024..8ee8ac14acc 100644 --- a/include/linux/msm_kgsl.h +++ b/include/linux/msm_kgsl.h @@ -79,6 +79,7 @@ struct kgsl_pwrlevel { * @csdev: Pointer to the coresight device for this device * @coresight_pdata: Coresight configuration for specific device * @chipid: Chip ID for the device's GPU + * @pm_qos_latency: latency value for cpu */ struct kgsl_device_platform_data { struct kgsl_pwrlevel pwrlevel[KGSL_MAX_PWRLEVELS]; @@ -95,6 +96,7 @@ struct kgsl_device_platform_data { struct coresight_device *csdev; struct coresight_platform_data *coresight_pdata; unsigned int chipid; + unsigned int pm_qos_latency; }; #ifdef CONFIG_MSM_KGSL_DRM diff --git a/include/linux/qdsp6v2/apr.h b/include/linux/qdsp6v2/apr.h index 7f7707f0490..e16cc338b58 100644 --- a/include/linux/qdsp6v2/apr.h +++ b/include/linux/qdsp6v2/apr.h @@ -14,7 +14,7 @@ #define __APR_H_ #include <linux/mutex.h> -#include <mach/subsystem_notif.h> +#include <soc/qcom/subsystem_notif.h> enum apr_subsys_state { APR_SUBSYS_DOWN, diff --git a/include/linux/qpnp/qpnp-adc.h b/include/linux/qpnp/qpnp-adc.h index 2a24ca7f9c7..8bcec8b0a49 100644 --- a/include/linux/qpnp/qpnp-adc.h +++ b/include/linux/qpnp/qpnp-adc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. + * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -191,6 +191,7 @@ enum qpnp_adc_calib_type { * %CHAN_PATH_SCALING2: ratio of {1, 4} * %CHAN_PATH_SCALING3: ratio of {1, 6} * %CHAN_PATH_SCALING4: ratio of {1, 20} + * %CHAN_PATH_SCALING5: ratio of {1, 8} * %CHAN_PATH_NONE: Do not use this pre-scaling ratio type. * * The pre-scaling is applied for signals to be within the voltage range @@ -202,6 +203,7 @@ enum qpnp_adc_channel_scaling_param { PATH_SCALING2, PATH_SCALING3, PATH_SCALING4, + PATH_SCALING5, PATH_SCALING_NONE, }; @@ -900,7 +902,8 @@ static const struct qpnp_vadc_scaling_ratio qpnp_vadc_amux_scaling_ratio[] = { {1, 3}, {1, 4}, {1, 6}, - {1, 20} + {1, 20}, + {1, 8} }; /** diff --git a/include/linux/slimbus/slimbus.h b/include/linux/slimbus/slimbus.h index 67f4d8c967e..56a3a5fdb02 100644 --- a/include/linux/slimbus/slimbus.h +++ b/include/linux/slimbus/slimbus.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -634,6 +634,10 @@ struct slim_pending_ch { * @driver: Device's driver. Pointer to access routines. * @ctrl: Slimbus controller managing the bus hosting this device. * @laddr: 1-byte Logical address of this device. + * @reported: Flag to indicate whether this device reported present. The flag + * is set when device reports present, and is reset when it reports + * absent. This flag alongwith notified flag below is used to call + * device_up, or device_down callbacks for driver of this device. * @mark_define: List of channels pending definition/activation. * @mark_suspend: List of channels pending suspend. * @mark_removal: List of channels pending removal. @@ -657,6 +661,7 @@ struct slim_device { struct slim_driver *driver; struct slim_controller *ctrl; u8 laddr; + bool reported; struct list_head mark_define; struct list_head mark_suspend; struct list_head mark_removal; diff --git a/include/linux/test-iosched.h b/include/linux/test-iosched.h index 3551b7efd31..0bfed06cc09 100644 --- a/include/linux/test-iosched.h +++ b/include/linux/test-iosched.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and @@ -28,6 +28,7 @@ #define TEST_PATTERN_FF 0xFFFFFFFF #define TEST_NO_PATTERN 0xDEADBEEF #define BIO_U32_SIZE 1024 +#define TEST_BIO_SIZE PAGE_SIZE /* use one page bios */ struct test_data; diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h index 894f157f418..66d6a9e1314 100644 --- a/include/linux/usb/msm_hsusb.h +++ b/include/linux/usb/msm_hsusb.h @@ -2,7 +2,7 @@ * * Copyright (C) 2008 Google, Inc. * Author: Brian Swetland <swetland@google.com> - * Copyright (c) 2009-2013, The Linux Foundation. All rights reserved. + * Copyright (c) 2009-2014, The Linux Foundation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -359,6 +359,7 @@ struct msm_otg_platform_data { * @chg_check_timer: The timer used to implement the workaround to detect * very slow plug in of wall charger. * @ui_enabled: USB Intterupt is enabled or disabled. + * @pm_done: Indicates whether USB is PM resumed */ struct msm_otg { struct usb_phy phy; @@ -478,6 +479,7 @@ struct msm_otg { bool ext_chg_active; struct completion ext_chg_wait; int ui_enabled; + bool pm_done; }; struct ci13xxx_platform_data { diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h index b2bf1229fe3..08db46e4f1e 100644 --- a/include/linux/usb/usbnet.h +++ b/include/linux/usb/usbnet.h @@ -138,9 +138,6 @@ struct driver_info { /* link reset handling, called from defer_kevent */ int (*link_reset)(struct usbnet *); - /*in case if usbnet wrapper wants to override rx_complete()*/ - void (*rx_complete) (struct urb *); - /* fixup rx packet (strip framing) */ int (*rx_fixup)(struct usbnet *dev, struct sk_buff *skb); @@ -250,7 +247,6 @@ extern void usbnet_set_msglevel(struct net_device *, u32); extern void usbnet_get_drvinfo(struct net_device *, struct ethtool_drvinfo *); extern int usbnet_nway_reset(struct net_device *net); extern void usbnet_terminate_urbs(struct usbnet *dev); -extern void rx_complete(struct urb *urb); extern int usbnet_manage_power(struct usbnet *, int); extern void usbnet_link_change(struct usbnet *, bool, bool); diff --git a/include/media/msm_cam_sensor.h b/include/media/msm_cam_sensor.h index 7f98fcc82ac..5808475eda2 100644 --- a/include/media/msm_cam_sensor.h +++ b/include/media/msm_cam_sensor.h @@ -51,6 +51,7 @@ #define MAX_EEPROM_NAME 32 #define MAX_AF_ITERATIONS 3 +#define MAX_NUMBER_OF_STEPS 47 #define MAX_LED_TRIGGERS 3 @@ -472,6 +473,7 @@ enum msm_actuator_cfg_type_t { CFG_GET_ACTUATOR_INFO, CFG_SET_ACTUATOR_INFO, CFG_SET_DEFAULT_FOCUS, + CFG_SET_POSITION, CFG_MOVE_FOCUS, CFG_ACTUATOR_POWERDOWN, }; @@ -580,6 +582,13 @@ enum af_camera_name { ACTUATOR_WEB_CAM_2, }; + +struct msm_actuator_set_position_t { + uint16_t number_of_steps; + uint16_t pos[MAX_NUMBER_OF_STEPS]; + uint16_t delay[MAX_NUMBER_OF_STEPS]; +}; + struct msm_actuator_cfg_data { int cfgtype; uint8_t is_af_supported; @@ -587,6 +596,7 @@ struct msm_actuator_cfg_data { struct msm_actuator_move_params_t move; struct msm_actuator_set_info_t set_info; struct msm_actuator_get_info_t get_info; + struct msm_actuator_set_position_t setpos; enum af_camera_name cam_name; } cfg; }; diff --git a/include/media/msmb_pproc.h b/include/media/msmb_pproc.h index 6c7f4e55a32..9a1c750b0c5 100644 --- a/include/media/msmb_pproc.h +++ b/include/media/msmb_pproc.h @@ -229,6 +229,9 @@ struct msm_pproc_queue_buf_info { #define VIDIOC_MSM_CPP_QUEUE_BUF \ _IOWR('V', BASE_VIDIOC_PRIVATE + 14, struct msm_camera_v4l2_ioctl_t) +#define VIDIOC_MSM_CPP_APPEND_STREAM_BUFF_INFO \ + _IOWR('V', BASE_VIDIOC_PRIVATE + 15, struct msm_camera_v4l2_ioctl_t) + #define VIDIOC_MSM_CPP_SET_CLOCK \ _IOWR('V', BASE_VIDIOC_PRIVATE + 16, struct msm_camera_v4l2_ioctl_t) diff --git a/include/net/cnss.h b/include/net/cnss.h index 5917b099ab0..74ece63559c 100644 --- a/include/net/cnss.h +++ b/include/net/cnss.h @@ -47,6 +47,8 @@ extern int cnss_get_wlan_unsafe_channel(u16 *unsafe_ch_list, extern int cnss_wlan_register_driver(struct cnss_wlan_driver *driver); extern void cnss_wlan_unregister_driver(struct cnss_wlan_driver *driver); extern int cnss_get_fw_files(struct cnss_fw_files *pfw_files); +extern void cnss_flush_work(void *work); +extern void cnss_flush_delayed_work(void *dwork); extern void cnss_pm_wake_lock_init(struct wakeup_source *ws, const char *name); extern void cnss_pm_wake_lock(struct wakeup_source *ws); @@ -54,4 +56,8 @@ extern void cnss_pm_wake_lock_timeout(struct wakeup_source *ws, ulong msec); extern void cnss_pm_wake_lock_release(struct wakeup_source *ws); extern void cnss_pm_wake_lock_destroy(struct wakeup_source *ws); +extern int cnss_set_cpus_allowed_ptr(struct task_struct *task, ulong cpu); +extern void cnss_request_pm_qos(u32 qos_val); +extern void cnss_remove_pm_qos(void); + #endif /* _NET_CNSS_H_ */ diff --git a/include/soc/qcom/clock-alpha-pll.h b/include/soc/qcom/clock-alpha-pll.h new file mode 100644 index 00000000000..4d8e2b0c6d3 --- /dev/null +++ b/include/soc/qcom/clock-alpha-pll.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef __ARCH_ARM_MACH_MSM_CLOCK_ALPHA_PLL_H +#define __ARCH_ARM_MACH_MSM_CLOCK_ALPHA_PLL_H + +#include <linux/spinlock.h> +#include <linux/clk/msm-clk-provider.h> + +struct alpha_pll_masks { + u32 lock_mask; + u32 update_mask; + u32 vco_mask; + u32 vco_shift; + u32 alpha_en_mask; +}; + +struct alpha_pll_vco_tbl { + u32 vco_val; + unsigned long min_freq; + unsigned long max_freq; +}; + +#define VCO(a, b, c) { \ + .vco_val = a,\ + .min_freq = b,\ + .max_freq = c,\ +} + +struct alpha_pll_clk { + struct alpha_pll_masks *masks; + void *const __iomem *base; + const u32 offset; + + struct alpha_pll_vco_tbl *vco_tbl; + u32 num_vco; + + struct clk c; +}; + +static inline struct alpha_pll_clk *to_alpha_pll_clk(struct clk *c) +{ + return container_of(c, struct alpha_pll_clk, c); +} +#endif + +extern struct clk_ops clk_ops_alpha_pll; diff --git a/include/soc/qcom/clock-local2.h b/include/soc/qcom/clock-local2.h new file mode 100644 index 00000000000..e9a4881531b --- /dev/null +++ b/include/soc/qcom/clock-local2.h @@ -0,0 +1,237 @@ +/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef __ARCH_ARM_MACH_MSM_CLOCK_LOCAL_2_H +#define __ARCH_ARM_MACH_MSM_CLOCK_LOCAL_2_H + +#include <linux/spinlock.h> +#include <linux/clk/msm-clk-provider.h> +#include <linux/clk/msm-clk.h> + +/* + * Generic frequency-definition structs and macros + */ + +/** + * @freq_hz: output rate + * @src_clk: source clock for freq_hz + * @m_val: M value corresponding to freq_hz + * @n_val: N value corresponding to freq_hz + * @d_val: D value corresponding to freq_hz + * @div_src_val: Pre divider value and source selection mux index for freq_hz + * @sys_vdd: Voltage level required for freq_hz + */ +struct clk_freq_tbl { + unsigned long freq_hz; + struct clk *src_clk; + u32 m_val; + u32 n_val; + u32 d_val; + u32 div_src_val; + const unsigned sys_vdd; +}; + +#define FREQ_END (ULONG_MAX-1) +#define F_END { .freq_hz = FREQ_END } + +/* + * Generic clock-definition struct and macros + */ +/** + * struct rcg_clk - root clock generator + * @cmd_rcgr_reg: command register + * @set_rate: function to set frequency + * @freq_tbl: frequency table for this RCG + * @current_freq: current RCG frequency + * @c: generic clock data + * @base: pointer to base address of ioremapped registers. + */ +struct rcg_clk { + const u32 cmd_rcgr_reg; + + void (*set_rate)(struct rcg_clk *, struct clk_freq_tbl *); + + struct clk_freq_tbl *freq_tbl; + struct clk_freq_tbl *current_freq; + struct clk c; + + void *const __iomem *base; +}; + +static inline struct rcg_clk *to_rcg_clk(struct clk *clk) +{ + return container_of(clk, struct rcg_clk, c); +} + +extern struct clk_freq_tbl rcg_dummy_freq; + +/** + * struct branch_clk - branch clock + * @set_rate: Set the frequency of this branch clock. + * @c: clk + * @cbcr_reg: branch control register + * @bcr_reg: block reset register + * @has_sibling: true if other branches are derived from this branch's source + * @cur_div: current branch divider value + * @max_div: maximum branch divider value (if zero, no divider exists) + * @halt_check: halt checking type + * @base: pointer to base address of ioremapped registers. + */ +struct branch_clk { + void (*set_rate)(struct branch_clk *, struct clk_freq_tbl *); + struct clk c; + const u32 cbcr_reg; + const u32 bcr_reg; + int has_sibling; + u32 cur_div; + const u32 max_div; + const u32 halt_check; + void *const __iomem *base; +}; + +static inline struct branch_clk *to_branch_clk(struct clk *clk) +{ + return container_of(clk, struct branch_clk, c); +} + +/** + * struct local_vote_clk - Voteable branch clock + * @c: clk + * @cbcr_reg: branch control register + * @vote_reg: voting register + * @en_mask: enable mask + * @halt_check: halt checking type + * @base: pointer to base address of ioremapped registers. + * An on/off switch with a rate derived from the parent. + */ +struct local_vote_clk { + struct clk c; + const u32 cbcr_reg; + const u32 vote_reg; + const u32 bcr_reg; + const u32 en_mask; + const u32 halt_check; + void *const __iomem *base; +}; + +static inline struct local_vote_clk *to_local_vote_clk(struct clk *clk) +{ + return container_of(clk, struct local_vote_clk, c); +} + +/** + * struct reset_clk - Reset clock + * @c: clk + * @reset_reg: block reset register + * @base: pointer to base address of ioremapped registers. + */ +struct reset_clk { + struct clk c; + const u32 reset_reg; + void *const __iomem *base; +}; + +static inline struct reset_clk *to_reset_clk(struct clk *clk) +{ + return container_of(clk, struct reset_clk, c); +} +/** + * struct measure_clk - for rate measurement debug use + * @sample_ticks: sample period in reference clock ticks + * @multiplier: measurement scale-up factor + * @divider: measurement scale-down factor + * @c: clk +*/ +struct measure_clk { + u64 sample_ticks; + u32 multiplier; + u32 divider; + + struct clk c; +}; + +struct measure_clk_data { + struct clk *cxo; + u32 plltest_reg; + u32 plltest_val; + u32 xo_div4_cbcr; + u32 ctl_reg; + u32 status_reg; + void *const __iomem *base; +}; + +static inline struct measure_clk *to_measure_clk(struct clk *clk) +{ + return container_of(clk, struct measure_clk, c); +} + +/** + * struct gate_clk + * @c: clk + * @en_mask: ORed with @en_reg to enable gate clk + * @en_reg: register used to enable/disable gate clk + * @base: pointer to base address of ioremapped registers + */ +struct gate_clk { + struct clk c; + const u32 en_mask; + const u32 en_reg; + void *const __iomem *base; +}; + +static inline struct gate_clk *to_gate_clk(struct clk *clk) +{ + return container_of(clk, struct gate_clk, c); +} + +/* + * Generic set-rate implementations + */ +void set_rate_mnd(struct rcg_clk *clk, struct clk_freq_tbl *nf); +void set_rate_hid(struct rcg_clk *clk, struct clk_freq_tbl *nf); + +/* + * Variables from the clock-local driver + */ +extern spinlock_t local_clock_reg_lock; + +extern struct clk_ops clk_ops_empty; +extern struct clk_ops clk_ops_rcg; +extern struct clk_ops clk_ops_rcg_mnd; +extern struct clk_ops clk_ops_branch; +extern struct clk_ops clk_ops_vote; +extern struct clk_ops clk_ops_rcg_hdmi; +extern struct clk_ops clk_ops_rcg_edp; +extern struct clk_ops clk_ops_byte; +extern struct clk_ops clk_ops_pixel; +extern struct clk_ops clk_ops_edppixel; +extern struct clk_ops clk_ops_gate; +extern struct clk_ops clk_ops_rst; +extern struct clk_mux_ops mux_reg_ops; + +enum handoff pixel_rcg_handoff(struct clk *clk); +enum handoff byte_rcg_handoff(struct clk *clk); +unsigned long measure_get_rate(struct clk *c); + +/* + * Clock definition macros + */ +#define DEFINE_CLK_MEASURE(name) \ + struct clk name = { \ + .ops = &clk_ops_empty, \ + .dbg_name = #name, \ + CLK_INIT(name), \ + }; \ + +#endif /* __ARCH_ARM_MACH_MSM_CLOCK_LOCAL_2_H */ + diff --git a/include/soc/qcom/clock-pll.h b/include/soc/qcom/clock-pll.h new file mode 100644 index 00000000000..795d72db216 --- /dev/null +++ b/include/soc/qcom/clock-pll.h @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef __ARCH_ARM_MACH_MSM_CLOCK_PLL_H +#define __ARCH_ARM_MACH_MSM_CLOCK_PLL_H + +#include <linux/clk/msm-clk-provider.h> + +/** + * struct pll_freq_tbl - generic PLL frequency definition + * @freq_hz: pll frequency in hz + * @l_val: pll l value + * @m_val: pll m value + * @n_val: pll n value + * @post_div_val: pll post divider value + * @pre_div_val: pll pre-divider value + * @vco_val: pll vco value + */ +struct pll_freq_tbl { + const u32 freq_hz; + const u32 l_val; + const u32 m_val; + const u32 n_val; + const u32 post_div_val; + const u32 pre_div_val; + const u32 vco_val; +}; + +/** + * struct pll_config_masks - PLL config masks struct + * @post_div_mask: mask for post divider bits location + * @pre_div_mask: mask for pre-divider bits location + * @vco_mask: mask for vco bits location + * @mn_en_mask: ORed with pll config register to enable the mn counter + * @main_output_mask: ORed with pll config register to enable the main output + */ +struct pll_config_masks { + u32 post_div_mask; + u32 pre_div_mask; + u32 vco_mask; + u32 mn_en_mask; + u32 main_output_mask; +}; + +#define PLL_FREQ_END (UINT_MAX-1) +#define PLL_F_END { .freq_hz = PLL_FREQ_END } + +/** + * struct pll_vote_clk - phase locked loop (HW voteable) + * @soft_vote: soft voting variable for multiple PLL software instances + * @soft_vote_mask: soft voting mask for multiple PLL software instances + * @en_reg: enable register + * @en_mask: ORed with @en_reg to enable the clock + * @status_mask: ANDed with @status_reg to determine if PLL is active. + * @status_reg: status register + * @c: clock + */ +struct pll_vote_clk { + u32 *soft_vote; + const u32 soft_vote_mask; + void __iomem *const en_reg; + const u32 en_mask; + void __iomem *const status_reg; + const u32 status_mask; + + struct clk c; + void *const __iomem *base; +}; + +extern struct clk_ops clk_ops_pll_vote; +extern struct clk_ops clk_ops_pll_acpu_vote; + +/* Soft voting values */ +#define PLL_SOFT_VOTE_PRIMARY BIT(0) +#define PLL_SOFT_VOTE_ACPU BIT(1) + +static inline struct pll_vote_clk *to_pll_vote_clk(struct clk *c) +{ + return container_of(c, struct pll_vote_clk, c); +} + +/** + * struct pll_clk - phase locked loop + * @mode_reg: enable register + * @l_reg: l value register + * @m_reg: m value register + * @n_reg: n value register + * @config_reg: configuration register, contains mn divider enable, pre divider, + * post divider and vco configuration. register name can be configure register + * or user_ctl register depending on targets + * @status_reg: status register, contains the lock detection bit + * @masks: masks used for settings in config_reg + * @freq_tbl: pll freq table + * @c: clk + * @base: pointer to base address of ioremapped registers. + */ +struct pll_clk { + void __iomem *const mode_reg; + void __iomem *const l_reg; + void __iomem *const m_reg; + void __iomem *const n_reg; + void __iomem *const config_reg; + void __iomem *const status_reg; + + struct pll_config_masks masks; + struct pll_freq_tbl *freq_tbl; + + struct clk c; + void *const __iomem *base; +}; + +extern struct clk_ops clk_ops_local_pll; +extern struct clk_ops clk_ops_sr2_pll; + +static inline struct pll_clk *to_pll_clk(struct clk *c) +{ + return container_of(c, struct pll_clk, c); +} + +int sr_pll_clk_enable(struct clk *c); +int sr_hpm_lp_pll_clk_enable(struct clk *c); + +struct pll_alt_config { + u32 val; + u32 mask; +}; + +struct pll_config { + u32 l; + u32 m; + u32 n; + u32 vco_val; + u32 vco_mask; + u32 pre_div_val; + u32 pre_div_mask; + u32 post_div_val; + u32 post_div_mask; + u32 mn_ena_val; + u32 mn_ena_mask; + u32 main_output_val; + u32 main_output_mask; + u32 aux_output_val; + u32 aux_output_mask; + /* SR2 PLL specific fields */ + u32 add_factor_val; + u32 add_factor_mask; + struct pll_alt_config alt_cfg; +}; + +struct pll_config_regs { + void __iomem *l_reg; + void __iomem *m_reg; + void __iomem *n_reg; + void __iomem *config_reg; + void __iomem *config_alt_reg; + void __iomem *mode_reg; + void *const __iomem *base; +}; + +void configure_sr_pll(struct pll_config *config, struct pll_config_regs *regs, + u32 ena_fsm_mode); +void configure_sr_hpm_lp_pll(struct pll_config *config, + struct pll_config_regs *, u32 ena_fsm_mode); +#endif diff --git a/include/soc/qcom/clock-rpm.h b/include/soc/qcom/clock-rpm.h new file mode 100644 index 00000000000..98ae2a721bc --- /dev/null +++ b/include/soc/qcom/clock-rpm.h @@ -0,0 +1,151 @@ +/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef __ARCH_ARM_MACH_MSM_CLOCK_RPM_H +#define __ARCH_ARM_MACH_MSM_CLOCK_RPM_H + +#include <linux/clk/msm-clk-provider.h> +#include <mach/rpm-smd.h> + +#define RPM_SMD_KEY_RATE 0x007A484B +#define RPM_SMD_KEY_ENABLE 0x62616E45 +#define RPM_SMD_KEY_STATE 0x54415453 + +#define RPM_CLK_BUFFER_A_REQ 0x616B6C63 +#define RPM_KEY_SOFTWARE_ENABLE 0x6E657773 +#define RPM_KEY_PIN_CTRL_CLK_BUFFER_ENABLE_KEY 0x62636370 + +struct clk_ops; +struct clk_rpmrs_data; +extern struct clk_ops clk_ops_rpm; +extern struct clk_ops clk_ops_rpm_branch; + +struct rpm_clk { + const int rpm_res_type; + const int rpm_key; + const int rpm_clk_id; + const int rpm_status_id; + const bool active_only; + bool enabled; + bool branch; /* true: RPM only accepts 1 for ON and 0 for OFF */ + struct clk_rpmrs_data *rpmrs_data; + struct rpm_clk *peer; + struct clk c; +}; + +static inline struct rpm_clk *to_rpm_clk(struct clk *clk) +{ + return container_of(clk, struct rpm_clk, c); +} + +/* + * RPM scaling enable function used for target that has an RPM resource for + * rpm clock scaling enable. + */ +void enable_rpm_scaling(void); + +extern struct clk_rpmrs_data clk_rpmrs_data_smd; + +#define __DEFINE_CLK_RPM(name, active, type, r_id, stat_id, dep, key, \ + rpmrsdata) \ + static struct rpm_clk active; \ + static struct rpm_clk name = { \ + .rpm_res_type = (type), \ + .rpm_clk_id = (r_id), \ + .rpm_status_id = (stat_id), \ + .rpm_key = (key), \ + .peer = &active, \ + .rpmrs_data = (rpmrsdata),\ + .c = { \ + .ops = &clk_ops_rpm, \ + .dbg_name = #name, \ + CLK_INIT(name.c), \ + .depends = dep, \ + }, \ + }; \ + static struct rpm_clk active = { \ + .rpm_res_type = (type), \ + .rpm_clk_id = (r_id), \ + .rpm_status_id = (stat_id), \ + .rpm_key = (key), \ + .peer = &name, \ + .active_only = true, \ + .rpmrs_data = (rpmrsdata),\ + .c = { \ + .ops = &clk_ops_rpm, \ + .dbg_name = #active, \ + CLK_INIT(active.c), \ + .depends = dep, \ + }, \ + }; + +#define __DEFINE_CLK_RPM_BRANCH(name, active, type, r_id, stat_id, r, \ + key, rpmrsdata) \ + static struct rpm_clk active; \ + static struct rpm_clk name = { \ + .rpm_res_type = (type), \ + .rpm_clk_id = (r_id), \ + .rpm_status_id = (stat_id), \ + .rpm_key = (key), \ + .peer = &active, \ + .branch = true, \ + .rpmrs_data = (rpmrsdata),\ + .c = { \ + .ops = &clk_ops_rpm_branch, \ + .dbg_name = #name, \ + .rate = (r), \ + CLK_INIT(name.c), \ + }, \ + }; \ + static struct rpm_clk active = { \ + .rpm_res_type = (type), \ + .rpm_clk_id = (r_id), \ + .rpm_status_id = (stat_id), \ + .rpm_key = (key), \ + .peer = &name, \ + .active_only = true, \ + .branch = true, \ + .rpmrs_data = (rpmrsdata),\ + .c = { \ + .ops = &clk_ops_rpm_branch, \ + .dbg_name = #active, \ + .rate = (r), \ + CLK_INIT(active.c), \ + }, \ + }; + +#define DEFINE_CLK_RPM_SMD(name, active, type, r_id, dep) \ + __DEFINE_CLK_RPM(name, active, type, r_id, 0, dep, \ + RPM_SMD_KEY_RATE, &clk_rpmrs_data_smd) + +#define DEFINE_CLK_RPM_SMD_BRANCH(name, active, type, r_id, r) \ + __DEFINE_CLK_RPM_BRANCH(name, active, type, r_id, 0, r, \ + RPM_SMD_KEY_ENABLE, &clk_rpmrs_data_smd) + +#define DEFINE_CLK_RPM_SMD_QDSS(name, active, type, r_id) \ + __DEFINE_CLK_RPM(name, active, type, r_id, \ + 0, 0, RPM_SMD_KEY_STATE, &clk_rpmrs_data_smd) +/* + * The RPM XO buffer clock management code aggregates votes for pin-control mode + * and software mode separately. Software-enable has higher priority over pin- + * control, and if the software-mode aggregation results in a 'disable', the + * buffer will be left in pin-control mode if a pin-control vote is in place. + */ +#define DEFINE_CLK_RPM_SMD_XO_BUFFER(name, active, r_id) \ + __DEFINE_CLK_RPM_BRANCH(name, active, RPM_CLK_BUFFER_A_REQ, r_id, 0, \ + 1000, RPM_KEY_SOFTWARE_ENABLE, &clk_rpmrs_data_smd) + +#define DEFINE_CLK_RPM_SMD_XO_BUFFER_PINCTRL(name, active, r_id) \ + __DEFINE_CLK_RPM_BRANCH(name, active, RPM_CLK_BUFFER_A_REQ, r_id, 0, \ + 1000, RPM_KEY_PIN_CTRL_CLK_BUFFER_ENABLE_KEY, &clk_rpmrs_data_smd) +#endif diff --git a/include/soc/qcom/clock-voter.h b/include/soc/qcom/clock-voter.h new file mode 100644 index 00000000000..9eb3898db1e --- /dev/null +++ b/include/soc/qcom/clock-voter.h @@ -0,0 +1,51 @@ +/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef __ARCH_ARM_MACH_MSM_CLOCK_VOTER_H +#define __ARCH_ARM_MACH_MSM_CLOCK_VOTER_H + +#include <linux/clk/msm-clk-provider.h> + +struct clk_ops; +extern struct clk_ops clk_ops_voter; + +struct clk_voter { + int is_branch; + bool enabled; + struct clk c; +}; + +static inline struct clk_voter *to_clk_voter(struct clk *clk) +{ + return container_of(clk, struct clk_voter, c); +} + +#define __DEFINE_CLK_VOTER(clk_name, _parent, _default_rate, _is_branch) \ + struct clk_voter clk_name = { \ + .is_branch = (_is_branch), \ + .c = { \ + .parent = _parent, \ + .dbg_name = #clk_name, \ + .ops = &clk_ops_voter, \ + .rate = _default_rate, \ + CLK_INIT(clk_name.c), \ + }, \ + } + +#define DEFINE_CLK_VOTER(clk_name, _parent, _default_rate) \ + __DEFINE_CLK_VOTER(clk_name, _parent, _default_rate, 0) + +#define DEFINE_CLK_BRANCH_VOTER(clk_name, _parent) \ + __DEFINE_CLK_VOTER(clk_name, _parent, 1000, 1) + +#endif diff --git a/include/soc/qcom/hsic_sysmon.h b/include/soc/qcom/hsic_sysmon.h new file mode 100644 index 00000000000..9655dc030b0 --- /dev/null +++ b/include/soc/qcom/hsic_sysmon.h @@ -0,0 +1,57 @@ +/* Copyright (c) 2012-2013 The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __HSIC_SYSMON_H__ +#define __HSIC_SYSMON_H__ + +/** + * enum hsic_sysmon_device_id - Supported HSIC subsystem devices + */ +enum hsic_sysmon_device_id { + HSIC_SYSMON_DEV_EXT_MODEM, + HSIC_SYSMON_DEV_EXT_MODEM_2, + NUM_HSIC_SYSMON_DEVS +}; + +#if defined(CONFIG_MSM_HSIC_SYSMON) || defined(CONFIG_MSM_HSIC_SYSMON_MODULE) + +extern int hsic_sysmon_open(enum hsic_sysmon_device_id id); +extern void hsic_sysmon_close(enum hsic_sysmon_device_id id); +extern int hsic_sysmon_read(enum hsic_sysmon_device_id id, char *data, + size_t len, size_t *actual_len, int timeout); +extern int hsic_sysmon_write(enum hsic_sysmon_device_id id, const char *data, + size_t len, int timeout); + +#else /* CONFIG_MSM_HSIC_SYSMON || CONFIG_MSM_HSIC_SYSMON_MODULE */ + +static inline int hsic_sysmon_open(enum hsic_sysmon_device_id id) +{ + return -ENODEV; +} + +static inline void hsic_sysmon_close(enum hsic_sysmon_device_id id) { } + +static inline int hsic_sysmon_read(enum hsic_sysmon_device_id id, char *data, + size_t len, size_t *actual_len, int timeout) +{ + return -ENODEV; +} + +static inline int hsic_sysmon_write(enum hsic_sysmon_device_id id, + const char *data, size_t len, int timeout) +{ + return -ENODEV; +} + +#endif /* CONFIG_MSM_HSIC_SYSMON || CONFIG_MSM_HSIC_SYSMON_MODULE */ + +#endif /* __HSIC_SYSMON_H__ */ diff --git a/include/soc/qcom/msm_qmi_interface.h b/include/soc/qcom/msm_qmi_interface.h new file mode 100644 index 00000000000..9867ddf8513 --- /dev/null +++ b/include/soc/qcom/msm_qmi_interface.h @@ -0,0 +1,499 @@ +/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _MSM_QMI_INTERFACE_H_ +#define _MSM_QMI_INTERFACE_H_ + +#include <linux/types.h> +#include <linux/errno.h> +#include <linux/mm.h> +#include <linux/list.h> +#include <linux/socket.h> +#include <linux/gfp.h> +#include <linux/qmi_encdec.h> +#include <linux/workqueue.h> + +#define QMI_COMMON_TLV_TYPE 0 + +enum qmi_event_type { + QMI_RECV_MSG = 1, + QMI_SERVER_ARRIVE, + QMI_SERVER_EXIT, +}; + +/** + * struct qmi_handle - QMI Handle Data Structure + * @handle_hash: Hash Table Node in which this handle is present. + * @src_port: Pointer to port used for message exchange. + * @ctl_port: Pointer to port used for out-of-band event exchange. + * @handle_type: Type of handle(Service/Client). + * @next_txn_id: Transaction ID of the next outgoing request. + * @handle_wq: Workqueue to handle any handle-specific events. + * @handle_lock: Lock to protect access to elements in the handle. + * @notify_lock: Lock to protect and generate notification atomically. + * @notify: Function to notify the handle owner of an event. + * @notify_priv: Private info to be passed during the notifcation. + * @handle_reset: Flag to hold the reset state of the handle. + * @reset_waitq: Wait queue to wait for any reset events. + * @ctl_work: Work to handle the out-of-band events for this handle. + * @dest_info: Destination to which this handle is connected to. + * @txn_list: List of transactions waiting for the response. + * @ind_cb: Function to notify the handle owner of an indication message. + * @ind_cb_priv: Private info to be passed during an indication notification. + * @resume_tx_work: Work to resume the tx when the transport is not busy. + * @pending_txn_list: List of requests pending tx due to busy transport. + * @conn_list: List of connections handled by the service. + * @svc_ops_options: Service specific operations and options. + */ +struct qmi_handle { + struct hlist_node handle_hash; + void *src_port; + void *ctl_port; + unsigned handle_type; + uint16_t next_txn_id; + struct workqueue_struct *handle_wq; + struct mutex handle_lock; + spinlock_t notify_lock; + void (*notify)(struct qmi_handle *handle, enum qmi_event_type event, + void *notify_priv); + void *notify_priv; + int handle_reset; + wait_queue_head_t reset_waitq; + struct delayed_work ctl_work; + + /* Client specific elements */ + void *dest_info; + struct list_head txn_list; + void (*ind_cb)(struct qmi_handle *handle, + unsigned int msg_id, void *msg, + unsigned int msg_len, void *ind_cb_priv); + void *ind_cb_priv; + struct delayed_work resume_tx_work; + struct list_head pending_txn_list; + + /* Service specific elements */ + struct list_head conn_list; + struct qmi_svc_ops_options *svc_ops_options; +}; + +enum qmi_result_type_v01 { + /* To force a 32 bit signed enum. Do not change or use*/ + QMI_RESULT_TYPE_MIN_ENUM_VAL_V01 = INT_MIN, + QMI_RESULT_SUCCESS_V01 = 0, + QMI_RESULT_FAILURE_V01 = 1, + QMI_RESULT_TYPE_MAX_ENUM_VAL_V01 = INT_MAX, +}; + +enum qmi_error_type_v01 { + /* To force a 32 bit signed enum. Do not change or use*/ + QMI_ERR_TYPE_MIN_ENUM_VAL_V01 = INT_MIN, + QMI_ERR_NONE_V01 = 0x0000, + QMI_ERR_MALFORMED_MSG_V01 = 0x0001, + QMI_ERR_NO_MEMORY_V01 = 0x0002, + QMI_ERR_INTERNAL_V01 = 0x0003, + QMI_ERR_CLIENT_IDS_EXHAUSTED_V01 = 0x0005, + QMI_ERR_INVALID_ID_V01 = 0x0029, + QMI_ERR_ENCODING_V01 = 0x003A, + QMI_ERR_INCOMPATIBLE_STATE_V01 = 0x005A, + QMI_ERR_NOT_SUPPORTED_V01 = 0x005E, + QMI_ERR_TYPE_MAX_ENUM_VAL_V01 = INT_MAX, +}; + +struct qmi_response_type_v01 { + enum qmi_result_type_v01 result; + enum qmi_error_type_v01 error; +}; + +/** + * qmi_svc_ops_options - Operations and options to be specified when + * a service registers. + * @version: Version field to identify the ops_options structure. + * @service_id: Service ID of the service. + * @service_vers: Version to identify the client-service compatibility. + * @service_ins: Instance ID registered by the service. + * @connect_cb: Callback when a new client connects with the service. + * @disconnect_cb: Callback when the client exits the connection. + * @req_desc_cb: Callback to get request structure and its descriptor + * for a message id. + * @req_cb: Callback to process the request. + */ +struct qmi_svc_ops_options { + unsigned version; + uint32_t service_id; + uint32_t service_vers; + uint32_t service_ins; + int (*connect_cb)(struct qmi_handle *handle, + void *conn_handle); + int (*disconnect_cb)(struct qmi_handle *handle, + void *conn_handle); + int (*req_desc_cb)(unsigned int msg_id, + struct msg_desc **req_desc); + int (*req_cb)(struct qmi_handle *handle, + void *conn_handle, + void *req_handle, + unsigned int msg_id, + void *req); +}; + +#ifdef CONFIG_MSM_QMI_INTERFACE + +/* Element info array describing common qmi response structure */ +extern struct elem_info qmi_response_type_v01_ei[]; +#define get_qmi_response_type_v01_ei() qmi_response_type_v01_ei + +/** + * qmi_handle_create() - Create a QMI handle + * @notify: Callback to notify events on the handle created. + * @notify_priv: Private information to be passed along with the notification. + * + * @return: Valid QMI handle on success, NULL on error. + */ +struct qmi_handle *qmi_handle_create( + void (*notify)(struct qmi_handle *handle, + enum qmi_event_type event, void *notify_priv), + void *notify_priv); + +/** + * qmi_handle_destroy() - Destroy the QMI handle + * @handle: QMI handle to be destroyed. + * + * @return: 0 on success, < 0 on error. + */ +int qmi_handle_destroy(struct qmi_handle *handle); + +/** + * qmi_register_ind_cb() - Register the indication callback function + * @handle: QMI handle with which the function is registered. + * @ind_cb: Callback function to be registered. + * @ind_cb_priv: Private data to be passed with the indication callback. + * + * @return: 0 on success, < 0 on error. + */ +int qmi_register_ind_cb(struct qmi_handle *handle, + void (*ind_cb)(struct qmi_handle *handle, + unsigned int msg_id, void *msg, + unsigned int msg_len, void *ind_cb_priv), + void *ind_cb_priv); + +/** + * qmi_send_req_wait() - Send a synchronous QMI request + * @handle: QMI handle through which the QMI request is sent. + * @request_desc: Structure describing the request data structure. + * @req: Buffer containing the request data structure. + * @req_len: Length of the request data structure. + * @resp_desc: Structure describing the response data structure. + * @resp: Buffer to hold the response data structure. + * @resp_len: Length of the response data structure. + * @timeout_ms: Timeout before a response is received. + * + * @return: 0 on success, < 0 on error. + */ +int qmi_send_req_wait(struct qmi_handle *handle, + struct msg_desc *req_desc, + void *req, unsigned int req_len, + struct msg_desc *resp_desc, + void *resp, unsigned int resp_len, + unsigned long timeout_ms); + +/** + * qmi_send_req_nowait() - Send an asynchronous QMI request + * @handle: QMI handle through which the QMI request is sent. + * @request_desc: Structure describing the request data structure. + * @req: Buffer containing the request data structure. + * @req_len: Length of the request data structure. + * @resp_desc: Structure describing the response data structure. + * @resp: Buffer to hold the response data structure. + * @resp_len: Length of the response data structure. + * @resp_cb: Callback function to be invoked when the response arrives. + * @resp_cb_data: Private information to be passed along with the callback. + * + * @return: 0 on success, < 0 on error. + */ +int qmi_send_req_nowait(struct qmi_handle *handle, + struct msg_desc *req_desc, + void *req, unsigned int req_len, + struct msg_desc *resp_desc, + void *resp, unsigned int resp_len, + void (*resp_cb)(struct qmi_handle *handle, + unsigned int msg_id, void *msg, + void *resp_cb_data, + int stat), + void *resp_cb_data); + +/** + * qmi_recv_msg() - Receive the QMI message + * @handle: Handle for which the QMI message has to be received. + * + * @return: 0 on success, < 0 on error. + */ +int qmi_recv_msg(struct qmi_handle *handle); + +/** + * qmi_connect_to_service() - Connect the QMI handle with a QMI service + * @handle: QMI handle to be connected with the QMI service. + * @service_id: Service id to identify the QMI service. + * @service_vers: Version to identify the compatibility. + * @service_ins: Instance id to identify the instance of the QMI service. + * + * @return: 0 on success, < 0 on error. + */ +int qmi_connect_to_service(struct qmi_handle *handle, + uint32_t service_id, + uint32_t service_vers, + uint32_t service_ins); + +/** + * qmi_svc_event_notifier_register() - Register a notifier block to receive + * events regarding a QMI service + * @service_id: Service ID to identify the QMI service. + * @service_vers: Version to identify the compatibility. + * @service_ins: Instance ID to identify the instance of the QMI service. + * @nb: Notifier block used to receive the event. + * + * @return: 0 if successfully registered, < 0 on error. + */ +int qmi_svc_event_notifier_register(uint32_t service_id, + uint32_t service_vers, + uint32_t service_ins, + struct notifier_block *nb); + +/** + * qmi_svc_event_notifier_unregister() - Unregister service event + * notifier block + * @service_id: Service ID to identify the QMI service. + * @service_vers: Version to identify the compatibility. + * @service_ins: Instance ID to identify the instance of the QMI service. + * @nb: Notifier block registered to receive the events. + * + * @return: 0 if successfully registered, < 0 on error. + */ +int qmi_svc_event_notifier_unregister(uint32_t service_id, + uint32_t service_vers, + uint32_t service_ins, + struct notifier_block *nb); + +/** + * qmi_svc_register() - Register a QMI service with a QMI handle + * @handle: QMI handle on which the service has to be registered. + * @ops_options: Service specific operations and options. + * + * @return: 0 if successfully registered, < 0 on error. + */ +int qmi_svc_register(struct qmi_handle *handle, + void *ops_options); + +/** + * qmi_send_resp() - Send response to a request + * @handle: QMI handle from which the response is sent. + * @clnt: Client to which the response is sent. + * @req_handle: Request for which the response is sent. + * @resp_desc: Descriptor explaining the response structure. + * @resp: Pointer to the response structure. + * @resp_len: Length of the response structure. + * + * @return: 0 on success, < 0 on error. + */ +int qmi_send_resp(struct qmi_handle *handle, + void *conn_handle, + void *req_handle, + struct msg_desc *resp_desc, + void *resp, + unsigned int resp_len); + +/** + * qmi_send_resp_from_cb() - Send response to a request from request_cb + * @handle: QMI handle from which the response is sent. + * @clnt: Client to which the response is sent. + * @req_handle: Request for which the response is sent. + * @resp_desc: Descriptor explaining the response structure. + * @resp: Pointer to the response structure. + * @resp_len: Length of the response structure. + * + * @return: 0 on success, < 0 on error. + */ +int qmi_send_resp_from_cb(struct qmi_handle *handle, + void *conn_handle, + void *req_handle, + struct msg_desc *resp_desc, + void *resp, + unsigned int resp_len); + +/** + * qmi_send_ind() - Send unsolicited event/indication to a client + * @handle: QMI handle from which the indication is sent. + * @clnt: Client to which the indication is sent. + * @ind_desc: Descriptor explaining the indication structure. + * @ind: Pointer to the indication structure. + * @ind_len: Length of the indication structure. + * + * @return: 0 on success, < 0 on error. + */ +int qmi_send_ind(struct qmi_handle *handle, + void *conn_handle, + struct msg_desc *ind_desc, + void *ind, + unsigned int ind_len); + +/** + * qmi_send_ind_from_cb() - Send indication to a client from registration_cb + * @handle: QMI handle from which the indication is sent. + * @clnt: Client to which the indication is sent. + * @ind_desc: Descriptor explaining the indication structure. + * @ind: Pointer to the indication structure. + * @ind_len: Length of the indication structure. + * + * @return: 0 on success, < 0 on error. + */ +int qmi_send_ind_from_cb(struct qmi_handle *handle, + void *conn_handle, + struct msg_desc *ind_desc, + void *ind, + unsigned int ind_len); + +/** + * qmi_svc_unregister() - Unregister the service from a QMI handle + * @handle: QMI handle from which the service has to be unregistered. + * + * return: 0 on success, < 0 on error. + */ +int qmi_svc_unregister(struct qmi_handle *handle); + +#else + +#define get_qmi_response_type_v01_ei() NULL + +static inline struct qmi_handle *qmi_handle_create( + void (*notify)(struct qmi_handle *handle, + enum qmi_event_type event, void *notify_priv), + void *notify_priv) +{ + return NULL; +} + +static inline int qmi_handle_destroy(struct qmi_handle *handle) +{ + return -ENODEV; +} + +static inline int qmi_register_ind_cb(struct qmi_handle *handle, + void (*ind_cb)(struct qmi_handle *handle, + unsigned int msg_id, void *msg, + unsigned int msg_len, void *ind_cb_priv), + void *ind_cb_priv) +{ + return -ENODEV; +} + +static inline int qmi_send_req_wait(struct qmi_handle *handle, + struct msg_desc *req_desc, + void *req, unsigned int req_len, + struct msg_desc *resp_desc, + void *resp, unsigned int resp_len, + unsigned long timeout_ms) +{ + return -ENODEV; +} + +static inline int qmi_send_req_nowait(struct qmi_handle *handle, + struct msg_desc *req_desc, + void *req, unsigned int req_len, + struct msg_desc *resp_desc, + void *resp, unsigned int resp_len, + void (*resp_cb)(struct qmi_handle *handle, + unsigned int msg_id, void *msg, + void *resp_cb_data), + void *resp_cb_data) +{ + return -ENODEV; +} + +static inline int qmi_recv_msg(struct qmi_handle *handle) +{ + return -ENODEV; +} + +static inline int qmi_connect_to_service(struct qmi_handle *handle, + uint32_t service_id, + uint32_t service_vers, + uint32_t service_ins) +{ + return -ENODEV; +} + +static inline int qmi_svc_event_notifier_register(uint32_t service_id, + uint32_t service_vers, + uint32_t service_ins, + struct notifier_block *nb) +{ + return -ENODEV; +} + +static inline int qmi_svc_event_notifier_unregister(uint32_t service_id, + uint32_t service_vers, + uint32_t service_ins, + struct notifier_block *nb) +{ + return -ENODEV; +} + +static inline int qmi_svc_register(struct qmi_handle *handle, + void *ops_options) +{ + return -ENODEV; +} + +static inline int qmi_send_resp(struct qmi_handle *handle, + void *conn_handle, + void *req_handle, + struct msg_desc *resp_desc, + void *resp, + unsigned int resp_len) +{ + return -ENODEV; +} + +static inline int qmi_send_resp_from_cb(struct qmi_handle *handle, + void *conn_handle, + void *req_handle, + struct msg_desc *resp_desc, + void *resp, + unsigned int resp_len) +{ + return -ENODEV; +} + +static inline int qmi_send_ind(struct qmi_handle *handle, + void *conn_handle, + struct msg_desc *ind_desc, + void *ind, + unsigned int ind_len) +{ + return -ENODEV; +} + +static inline int qmi_send_ind_from_cb(struct qmi_handle *handle, + void *conn_handle, + struct msg_desc *ind_desc, + void *ind, + unsigned int ind_len) +{ + return -ENODEV; +} + +static inline int qmi_svc_unregister(struct qmi_handle *handle) +{ + return -ENODEV; +} + +#endif + +#endif diff --git a/include/soc/qcom/ramdump.h b/include/soc/qcom/ramdump.h new file mode 100644 index 00000000000..7cd59dd8904 --- /dev/null +++ b/include/soc/qcom/ramdump.h @@ -0,0 +1,55 @@ +/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef _RAMDUMP_HEADER +#define _RAMDUMP_HEADER + +struct device; + +struct ramdump_segment { + unsigned long address; + unsigned long size; +}; + +#ifdef CONFIG_MSM_SUBSYSTEM_RESTART +extern void *create_ramdump_device(const char *dev_name, struct device *parent); +extern void destroy_ramdump_device(void *dev); +extern int do_ramdump(void *handle, struct ramdump_segment *segments, + int nsegments); +extern int do_elf_ramdump(void *handle, struct ramdump_segment *segments, + int nsegments); + +#else +static inline void *create_ramdump_device(const char *dev_name, + struct device *parent) +{ + return NULL; +} + +static inline void destroy_ramdump_device(void *dev) +{ +} + +static inline int do_ramdump(void *handle, struct ramdump_segment *segments, + int nsegments) +{ + return -ENODEV; +} + +static inline int do_elf_ramdump(void *handle, struct ramdump_segment *segments, + int nsegments) +{ + return -ENODEV; +} +#endif /* CONFIG_MSM_SUBSYSTEM_RESTART */ + +#endif diff --git a/include/soc/qcom/scm.h b/include/soc/qcom/scm.h new file mode 100644 index 00000000000..9d186ce1428 --- /dev/null +++ b/include/soc/qcom/scm.h @@ -0,0 +1,112 @@ +/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ +#ifndef __MACH_SCM_H +#define __MACH_SCM_H + +#define SCM_SVC_BOOT 0x1 +#define SCM_SVC_PIL 0x2 +#define SCM_SVC_UTIL 0x3 +#define SCM_SVC_TZ 0x4 +#define SCM_SVC_IO 0x5 +#define SCM_SVC_INFO 0x6 +#define SCM_SVC_SSD 0x7 +#define SCM_SVC_FUSE 0x8 +#define SCM_SVC_PWR 0x9 +#define SCM_SVC_MP 0xC +#define SCM_SVC_DCVS 0xD +#define SCM_SVC_ES 0x10 +#define SCM_SVC_TZSCHEDULER 0xFC + +#define SCM_FUSE_READ 0x7 + +#define DEFINE_SCM_BUFFER(__n) \ +static char __n[PAGE_SIZE] __aligned(PAGE_SIZE); + +#define SCM_BUFFER_SIZE(__buf) sizeof(__buf) + +#define SCM_BUFFER_PHYS(__buf) virt_to_phys(__buf) + +#ifdef CONFIG_MSM_SCM +extern int scm_call(u32 svc_id, u32 cmd_id, const void *cmd_buf, size_t cmd_len, + void *resp_buf, size_t resp_len); + +extern int scm_call_noalloc(u32 svc_id, u32 cmd_id, const void *cmd_buf, + size_t cmd_len, void *resp_buf, size_t resp_len, + void *scm_buf, size_t scm_buf_size); + + +extern s32 scm_call_atomic1(u32 svc, u32 cmd, u32 arg1); +extern s32 scm_call_atomic2(u32 svc, u32 cmd, u32 arg1, u32 arg2); +extern s32 scm_call_atomic3(u32 svc, u32 cmd, u32 arg1, u32 arg2, u32 arg3); +extern s32 scm_call_atomic4_3(u32 svc, u32 cmd, u32 arg1, u32 arg2, u32 arg3, + u32 arg4, u32 *ret1, u32 *ret2); + +#define SCM_VERSION(major, minor) (((major) << 16) | ((minor) & 0xFF)) + +extern u32 scm_get_version(void); +extern int scm_is_call_available(u32 svc_id, u32 cmd_id); +extern int scm_get_feat_version(u32 feat); + +#else + +static inline int scm_call(u32 svc_id, u32 cmd_id, const void *cmd_buf, + size_t cmd_len, void *resp_buf, size_t resp_len) +{ + return 0; +} + +static inline int scm_call_noalloc(u32 svc_id, u32 cmd_id, + const void *cmd_buf, size_t cmd_len, void *resp_buf, + size_t resp_len, void *scm_buf, size_t scm_buf_size) +{ + return 0; +} + +static inline s32 scm_call_atomic1(u32 svc, u32 cmd, u32 arg1) +{ + return 0; +} + +static inline s32 scm_call_atomic2(u32 svc, u32 cmd, u32 arg1, u32 arg2) +{ + return 0; +} + +static inline s32 scm_call_atomic3(u32 svc, u32 cmd, u32 arg1, u32 arg2, + u32 arg3) +{ + return 0; +} + +static inline s32 scm_call_atomic4_3(u32 svc, u32 cmd, u32 arg1, u32 arg2, + u32 arg3, u32 arg4, u32 *ret1, u32 *ret2) +{ + return 0; +} + +static inline u32 scm_get_version(void) +{ + return 0; +} + +static inline int scm_is_call_available(u32 svc_id, u32 cmd_id) +{ + return 0; +} + +static inline int scm_get_feat_version(u32 feat) +{ + return 0; +} + +#endif +#endif diff --git a/include/soc/qcom/smem_log.h b/include/soc/qcom/smem_log.h new file mode 100644 index 00000000000..85b8bfd6d51 --- /dev/null +++ b/include/soc/qcom/smem_log.h @@ -0,0 +1,72 @@ +/* Copyright (c) 2008-2009, 2012-2014, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include <linux/types.h> + +/* Event indentifier format: + * bit 31-28 is processor ID 8 => apps, 4 => Q6, 0 => modem + * bits 27-16 are subsystem id (event base) + * bits 15-0 are event id + */ + +#define PROC 0xF0000000 +#define SUB 0x0FFF0000 +#define ID 0x0000FFFF + +#define SMEM_LOG_PROC_ID_MODEM 0x00000000 +#define SMEM_LOG_PROC_ID_Q6 0x40000000 +#define SMEM_LOG_PROC_ID_APPS 0x80000000 +#define SMEM_LOG_PROC_ID_WCNSS 0xC0000000 + +#define SMEM_LOG_CONT 0x10000000 + +#define SMEM_LOG_SMEM_EVENT_BASE 0x00020000 +#define SMEM_LOG_ERROR_EVENT_BASE 0x00060000 +#define SMEM_LOG_IPC_ROUTER_EVENT_BASE 0x000D0000 +#define SMEM_LOG_QMI_CCI_EVENT_BASE 0x000E0000 +#define SMEM_LOG_QMI_CSI_EVENT_BASE 0x000F0000 +#define ERR_ERROR_FATAL (SMEM_LOG_ERROR_EVENT_BASE + 1) +#define ERR_ERROR_FATAL_TASK (SMEM_LOG_ERROR_EVENT_BASE + 2) +#define SMEM_LOG_EVENT_CB (SMEM_LOG_SMEM_EVENT_BASE + 0) +#define SMEM_LOG_EVENT_START (SMEM_LOG_SMEM_EVENT_BASE + 1) +#define SMEM_LOG_EVENT_INIT (SMEM_LOG_SMEM_EVENT_BASE + 2) +#define SMEM_LOG_EVENT_RUNNING (SMEM_LOG_SMEM_EVENT_BASE + 3) +#define SMEM_LOG_EVENT_STOP (SMEM_LOG_SMEM_EVENT_BASE + 4) +#define SMEM_LOG_EVENT_RESTART (SMEM_LOG_SMEM_EVENT_BASE + 5) +#define SMEM_LOG_EVENT_SS (SMEM_LOG_SMEM_EVENT_BASE + 6) +#define SMEM_LOG_EVENT_READ (SMEM_LOG_SMEM_EVENT_BASE + 7) +#define SMEM_LOG_EVENT_WRITE (SMEM_LOG_SMEM_EVENT_BASE + 8) +#define SMEM_LOG_EVENT_SIGS1 (SMEM_LOG_SMEM_EVENT_BASE + 9) +#define SMEM_LOG_EVENT_SIGS2 (SMEM_LOG_SMEM_EVENT_BASE + 10) +#define SMEM_LOG_EVENT_WRITE_DM (SMEM_LOG_SMEM_EVENT_BASE + 11) +#define SMEM_LOG_EVENT_READ_DM (SMEM_LOG_SMEM_EVENT_BASE + 12) +#define SMEM_LOG_EVENT_SKIP_DM (SMEM_LOG_SMEM_EVENT_BASE + 13) +#define SMEM_LOG_EVENT_STOP_DM (SMEM_LOG_SMEM_EVENT_BASE + 14) +#define SMEM_LOG_EVENT_ISR (SMEM_LOG_SMEM_EVENT_BASE + 15) +#define SMEM_LOG_EVENT_TASK (SMEM_LOG_SMEM_EVENT_BASE + 16) +#define SMEM_LOG_EVENT_RS (SMEM_LOG_SMEM_EVENT_BASE + 17) + +#ifdef CONFIG_MSM_SMEM_LOGGING +void smem_log_event(uint32_t id, uint32_t data1, uint32_t data2, + uint32_t data3); +void smem_log_event6(uint32_t id, uint32_t data1, uint32_t data2, + uint32_t data3, uint32_t data4, uint32_t data5, + uint32_t data6); +#else +void smem_log_event(uint32_t id, uint32_t data1, uint32_t data2, + uint32_t data3) { } +void smem_log_event6(uint32_t id, uint32_t data1, uint32_t data2, + uint32_t data3, uint32_t data4, uint32_t data5, + uint32_t data6) { } +#endif + diff --git a/include/soc/qcom/subsystem_notif.h b/include/soc/qcom/subsystem_notif.h new file mode 100644 index 00000000000..61be8f4268d --- /dev/null +++ b/include/soc/qcom/subsystem_notif.h @@ -0,0 +1,86 @@ +/* Copyright (c) 2011, 2013, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * + * Subsystem restart notifier API header + * + */ + +#ifndef _SUBSYS_NOTIFIER_H +#define _SUBSYS_NOTIFIER_H + +#include <linux/notifier.h> + +enum subsys_notif_type { + SUBSYS_BEFORE_SHUTDOWN, + SUBSYS_AFTER_SHUTDOWN, + SUBSYS_BEFORE_POWERUP, + SUBSYS_AFTER_POWERUP, + SUBSYS_RAMDUMP_NOTIFICATION, + SUBSYS_POWERUP_FAILURE, + SUBSYS_PROXY_VOTE, + SUBSYS_PROXY_UNVOTE, + SUBSYS_NOTIF_TYPE_COUNT +}; + +#if defined(CONFIG_MSM_SUBSYSTEM_RESTART) +/* Use the subsys_notif_register_notifier API to register for notifications for + * a particular subsystem. This API will return a handle that can be used to + * un-reg for notifications using the subsys_notif_unregister_notifier API by + * passing in that handle as an argument. + * + * On receiving a notification, the second (unsigned long) argument of the + * notifier callback will contain the notification type, and the third (void *) + * argument will contain the handle that was returned by + * subsys_notif_register_notifier. + */ +void *subsys_notif_register_notifier( + const char *subsys_name, struct notifier_block *nb); +int subsys_notif_unregister_notifier(void *subsys_handle, + struct notifier_block *nb); + +/* Use the subsys_notif_init_subsys API to initialize the notifier chains form + * a particular subsystem. This API will return a handle that can be used to + * queue notifications using the subsys_notif_queue_notification API by passing + * in that handle as an argument. + */ +void *subsys_notif_add_subsys(const char *); +int subsys_notif_queue_notification(void *subsys_handle, + enum subsys_notif_type notif_type, + void *data); +#else + +static inline void *subsys_notif_register_notifier( + const char *subsys_name, struct notifier_block *nb) +{ + return NULL; +} + +static inline int subsys_notif_unregister_notifier(void *subsys_handle, + struct notifier_block *nb) +{ + return 0; +} + +static inline void *subsys_notif_add_subsys(const char *subsys_name) +{ + return NULL; +} + +static inline int subsys_notif_queue_notification(void *subsys_handle, + enum subsys_notif_type notif_type, + void *data) +{ + return 0; +} +#endif /* CONFIG_MSM_SUBSYSTEM_RESTART */ + +#endif diff --git a/include/soc/qcom/subsystem_restart.h b/include/soc/qcom/subsystem_restart.h new file mode 100644 index 00000000000..60ff7d7fe5c --- /dev/null +++ b/include/soc/qcom/subsystem_restart.h @@ -0,0 +1,133 @@ +/* Copyright (c) 2014, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef __SUBSYS_RESTART_H +#define __SUBSYS_RESTART_H + +#include <linux/spinlock.h> +#include <linux/interrupt.h> + +#define SUBSYS_NAME_MAX_LENGTH 40 + +struct subsys_device; + +enum { + RESET_SOC = 0, + RESET_SUBSYS_COUPLED, + RESET_LEVEL_MAX +}; + +struct device; +struct module; + +/** + * struct subsys_desc - subsystem descriptor + * @name: name of subsystem + * @depends_on: subsystem this subsystem depends on to operate + * @dev: parent device + * @owner: module the descriptor belongs to + * @shutdown: Stop a subsystem + * @powerup: Start a subsystem + * @crash_shutdown: Shutdown a subsystem when the system crashes (can't sleep) + * @ramdump: Collect a ramdump of the subsystem + * @is_not_loadable: Indicate if subsystem firmware is not loadable via pil + * framework + */ +struct subsys_desc { + const char *name; + const char *depends_on; + struct device *dev; + struct module *owner; + + int (*shutdown)(const struct subsys_desc *desc, bool force_stop); + int (*powerup)(const struct subsys_desc *desc); + void (*crash_shutdown)(const struct subsys_desc *desc); + int (*ramdump)(int, const struct subsys_desc *desc); + irqreturn_t (*err_fatal_handler) (int irq, void *dev_id); + irqreturn_t (*stop_ack_handler) (int irq, void *dev_id); + irqreturn_t (*wdog_bite_handler) (int irq, void *dev_id); + int is_not_loadable; + unsigned int err_fatal_irq; + unsigned int err_ready_irq; + unsigned int stop_ack_irq; + unsigned int wdog_bite_irq; + int force_stop_gpio; +}; + +#if defined(CONFIG_MSM_SUBSYSTEM_RESTART) + +extern int subsys_get_restart_level(struct subsys_device *dev); +extern int subsystem_restart_dev(struct subsys_device *dev); +extern int subsystem_restart(const char *name); +extern int subsystem_crashed(const char *name); + +extern void *subsystem_get(const char *name); +extern void subsystem_put(void *subsystem); + +extern struct subsys_device *subsys_register(struct subsys_desc *desc); +extern void subsys_unregister(struct subsys_device *dev); + +extern void subsys_default_online(struct subsys_device *dev); +extern void subsys_set_crash_status(struct subsys_device *dev, bool crashed); +extern bool subsys_get_crash_status(struct subsys_device *dev); +void notify_proxy_vote(struct device *device); +void notify_proxy_unvote(struct device *device); +#else + +static inline int subsys_get_restart_level(struct subsys_device *dev) +{ + return 0; +} + +static inline int subsystem_restart_dev(struct subsys_device *dev) +{ + return 0; +} + +static inline int subsystem_restart(const char *name) +{ + return 0; +} + +static inline int subsystem_crashed(const char *name) +{ + return 0; +} + +static inline void *subsystem_get(const char *name) +{ + return NULL; +} + +static inline void subsystem_put(void *subsystem) { } + +static inline +struct subsys_device *subsys_register(struct subsys_desc *desc) +{ + return NULL; +} + +static inline void subsys_unregister(struct subsys_device *dev) { } + +static inline void subsys_default_online(struct subsys_device *dev) { } +static inline +void subsys_set_crash_status(struct subsys_device *dev, bool crashed) { } +static inline bool subsys_get_crash_status(struct subsys_device *dev) +{ + return false; +} +static inline void notify_proxy_vote(struct device *device) { } +static inline void notify_proxy_unvote(struct device *device) { } +#endif /* CONFIG_MSM_SUBSYSTEM_RESTART */ + +#endif diff --git a/include/soc/qcom/sysmon.h b/include/soc/qcom/sysmon.h new file mode 100644 index 00000000000..ad399c9cdc6 --- /dev/null +++ b/include/soc/qcom/sysmon.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2011-2013, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#ifndef __MSM_SYSMON_H +#define __MSM_SYSMON_H + +#include <mach/msm_smd.h> +#include <soc/qcom/subsystem_notif.h> + +/** + * enum subsys_id - Destination subsystems for events. + */ +enum subsys_id { + /* SMD subsystems */ + SYSMON_SS_MODEM = SMD_APPS_MODEM, + SYSMON_SS_LPASS = SMD_APPS_QDSP, + SYSMON_SS_WCNSS = SMD_APPS_WCNSS, + SYSMON_SS_DSPS = SMD_APPS_DSPS, + SYSMON_SS_Q6FW = SMD_APPS_Q6FW, + + /* Non-SMD subsystems */ + SYSMON_SS_EXT_MODEM = SMD_NUM_TYPE, + SYSMON_NUM_SS +}; + +#ifdef CONFIG_MSM_SYSMON_COMM +int sysmon_send_event(enum subsys_id dest_ss, const char *event_ss, + enum subsys_notif_type notif); +int sysmon_get_reason(enum subsys_id dest_ss, char *buf, size_t len); +int sysmon_send_shutdown(enum subsys_id dest_ss); +#else +static inline int sysmon_send_event(enum subsys_id dest_ss, + const char *event_ss, + enum subsys_notif_type notif) +{ + return 0; +} +static inline int sysmon_get_reason(enum subsys_id dest_ss, char *buf, + size_t len) +{ + return 0; +} +static inline int sysmon_send_shutdown(enum subsys_id dest_ss) +{ + return 0; +} +#endif + +#endif diff --git a/include/uapi/Kbuild b/include/uapi/Kbuild index 3098462d692..d7a03482342 100644 --- a/include/uapi/Kbuild +++ b/include/uapi/Kbuild @@ -13,3 +13,4 @@ header-y += drm/ header-y += xen/ header-y += scsi/ header-y += media/ +header-y += ../../drivers/staging/android/uapi/ diff --git a/include/uapi/linux/esoc_ctrl.h b/include/uapi/linux/esoc_ctrl.h index 69139dc5b9e..78c9fc3939c 100644 --- a/include/uapi/linux/esoc_ctrl.h +++ b/include/uapi/linux/esoc_ctrl.h @@ -30,6 +30,7 @@ enum esoc_cmd { enum esoc_notify { ESOC_IMG_XFER_DONE = 1, + ESOC_BOOT_DONE, ESOC_IMG_XFER_RETRY, ESOC_IMG_XFER_FAIL, ESOC_UPGRADE_AVAILABLE, diff --git a/include/uapi/linux/ion.h b/include/uapi/linux/ion.h index 46451a0557c..46b02b5364d 100644 --- a/include/uapi/linux/ion.h +++ b/include/uapi/linux/ion.h @@ -1,199 +1,6 @@ -/* - * include/linux/ion.h - * - * Copyright (C) 2011 Google, Inc. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ +#ifndef __UAPI_LINUX_ION_H__ +#define __UAPI_LINUX_ION_H__ -#ifndef _UAPI_ION_H -#define _UAPI_ION_H +#include "../../drivers/staging/android/linux/ion.h" -#include <linux/ioctl.h> -#include <linux/types.h> - -struct ion_handle; -typedef struct ion_handle *ion_user_handle_t; - -/** - * enum ion_heap_types - list of all possible types of heaps - * @ION_HEAP_TYPE_SYSTEM: memory allocated via vmalloc - * @ION_HEAP_TYPE_SYSTEM_CONTIG: memory allocated via kmalloc - * @ION_HEAP_TYPE_CARVEOUT: memory allocated from a prereserved - * carveout heap, allocations are physically - * contiguous - * @ION_HEAP_END: helper for iterating over heaps - */ -enum ion_heap_type { - ION_HEAP_TYPE_SYSTEM, - ION_HEAP_TYPE_SYSTEM_CONTIG, - ION_HEAP_TYPE_CARVEOUT, - ION_HEAP_TYPE_CHUNK, - ION_HEAP_TYPE_CUSTOM, /* must be last so device specific heaps always - are at the end of this enum */ - ION_NUM_HEAPS, -}; - -#define ION_HEAP_SYSTEM_MASK (1 << ION_HEAP_TYPE_SYSTEM) -#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << ION_HEAP_TYPE_SYSTEM_CONTIG) -#define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT) - -#define ION_NUM_HEAP_IDS sizeof(unsigned int) * 8 - -/** - * allocation flags - the lower 16 bits are used by core ion, the upper 16 - * bits are reserved for use by the heaps themselves. - */ -#define ION_FLAG_CACHED 1 /* mappings of this buffer should be - cached, ion will do cache - maintenance when the buffer is - mapped for dma */ -#define ION_FLAG_CACHED_NEEDS_SYNC 2 /* mappings of this buffer will created - at mmap time, if this is set - caches must be managed manually */ -#define ION_FLAG_FREED_FROM_SHRINKER 4 /* Skip any possible - heap-specific caching - mechanism (e.g. page - pools). Guarantees that any - buffer storage that came - from the system allocator - will be returned to the - system allocator. */ - -/** - * DOC: Ion Userspace API - * - * create a client by opening /dev/ion - * most operations handled via following ioctls - * - */ - -/** - * struct ion_allocation_data - metadata passed from userspace for allocations - * @len: size of the allocation - * @align: required alignment of the allocation - * @heap_id_mask: mask of heap ids to allocate from - * @flags: flags passed to heap - * @handle: pointer that will be populated with a cookie to use to - * refer to this allocation - * - * Provided by userspace as an argument to the ioctl - */ -struct ion_allocation_data { - size_t len; - size_t align; - unsigned int heap_mask; - unsigned int flags; - ion_user_handle_t handle; -}; - -/** - * struct ion_fd_data - metadata passed to/from userspace for a handle/fd pair - * @handle: a handle - * @fd: a file descriptor representing that handle - * - * For ION_IOC_SHARE or ION_IOC_MAP userspace populates the handle field with - * the handle returned from ion alloc, and the kernel returns the file - * descriptor to share or map in the fd field. For ION_IOC_IMPORT, userspace - * provides the file descriptor and the kernel returns the handle. - */ -struct ion_fd_data { - ion_user_handle_t handle; - int fd; -}; - -/** - * struct ion_handle_data - a handle passed to/from the kernel - * @handle: a handle - */ -struct ion_handle_data { - ion_user_handle_t handle; -}; - -/** - * struct ion_custom_data - metadata passed to/from userspace for a custom ioctl - * @cmd: the custom ioctl function to call - * @arg: additional data to pass to the custom ioctl, typically a user - * pointer to a predefined structure - * - * This works just like the regular cmd and arg fields of an ioctl. - */ -struct ion_custom_data { - unsigned int cmd; - unsigned long arg; -}; -#define ION_IOC_MAGIC 'I' - -/** - * DOC: ION_IOC_ALLOC - allocate memory - * - * Takes an ion_allocation_data struct and returns it with the handle field - * populated with the opaque handle for the allocation. - */ -#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, \ - struct ion_allocation_data) - -/** - * DOC: ION_IOC_FREE - free memory - * - * Takes an ion_handle_data struct and frees the handle. - */ -#define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data) - -/** - * DOC: ION_IOC_MAP - get a file descriptor to mmap - * - * Takes an ion_fd_data struct with the handle field populated with a valid - * opaque handle. Returns the struct with the fd field set to a file - * descriptor open in the current address space. This file descriptor - * can then be used as an argument to mmap. - */ -#define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data) - -/** - * DOC: ION_IOC_SHARE - creates a file descriptor to use to share an allocation - * - * Takes an ion_fd_data struct with the handle field populated with a valid - * opaque handle. Returns the struct with the fd field set to a file - * descriptor open in the current address space. This file descriptor - * can then be passed to another process. The corresponding opaque handle can - * be retrieved via ION_IOC_IMPORT. - */ -#define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data) - -/** - * DOC: ION_IOC_IMPORT - imports a shared file descriptor - * - * Takes an ion_fd_data struct with the fd field populated with a valid file - * descriptor obtained from ION_IOC_SHARE and returns the struct with the handle - * filed set to the corresponding opaque handle. - */ -#define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, struct ion_fd_data) - -/** - * DOC: ION_IOC_SYNC - syncs a shared file descriptors to memory - * - * Deprecated in favor of using the dma_buf api's correctly (syncing - * will happend automatically when the buffer is mapped to a device). - * If necessary should be used after touching a cached buffer from the cpu, - * this will make the buffer in memory coherent. - */ -#define ION_IOC_SYNC _IOWR(ION_IOC_MAGIC, 7, struct ion_fd_data) - -/** - * DOC: ION_IOC_CUSTOM - call architecture specific ion ioctl - * - * Takes the argument of the architecture specific ioctl to call and - * passes appropriate userdata for that ioctl - */ -#define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data) - -#endif /* _UAPI_ION_H */ +#endif /* __UAPI_LINUX_ION_H__ */ diff --git a/include/uapi/linux/msm_ion.h b/include/uapi/linux/msm_ion.h index 60469ddfa00..784101a30b0 100644 --- a/include/uapi/linux/msm_ion.h +++ b/include/uapi/linux/msm_ion.h @@ -1,194 +1,6 @@ -/* - * include/linux/ion.h - * - * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - */ +#ifndef __UAPI_LINUX_MSM_ION_H__ +#define __UAPI_LINUX_MSM_ION_H__ -#ifndef _UAPI_MSM_ION_H -#define _UAPI_MSM_ION_H +#include "../../drivers/staging/android/linux/msm_ion.h" -#include <linux/ion.h> - -enum msm_ion_heap_types { - ION_HEAP_TYPE_MSM_START = ION_HEAP_TYPE_CUSTOM + 1, - ION_HEAP_TYPE_DMA = ION_HEAP_TYPE_MSM_START, - ION_HEAP_TYPE_CP, - ION_HEAP_TYPE_SECURE_DMA, - ION_HEAP_TYPE_REMOVED, - /* - * if you add a heap type here you should also add it to - * heap_types_info[] in msm_ion.c - */ -}; - -/** - * These are the only ids that should be used for Ion heap ids. - * The ids listed are the order in which allocation will be attempted - * if specified. Don't swap the order of heap ids unless you know what - * you are doing! - * Id's are spaced by purpose to allow new Id's to be inserted in-between (for - * possible fallbacks) - */ - -enum ion_heap_ids { - INVALID_HEAP_ID = -1, - ION_CP_MM_HEAP_ID = 8, - ION_CP_MFC_HEAP_ID = 12, - ION_CP_WB_HEAP_ID = 16, /* 8660 only */ - ION_CAMERA_HEAP_ID = 20, /* 8660 only */ - ION_SYSTEM_CONTIG_HEAP_ID = 21, - ION_ADSP_HEAP_ID = 22, - ION_PIL1_HEAP_ID = 23, /* Currently used for other PIL images */ - ION_SF_HEAP_ID = 24, - ION_SYSTEM_HEAP_ID = 25, - ION_PIL2_HEAP_ID = 26, /* Currently used for modem firmware images */ - ION_QSECOM_HEAP_ID = 27, - ION_AUDIO_HEAP_ID = 28, - - ION_MM_FIRMWARE_HEAP_ID = 29, - - ION_HEAP_ID_RESERVED = 31 /** Bit reserved for ION_FLAG_SECURE flag */ -}; - -/* - * The IOMMU heap is deprecated! Here are some aliases for backwards - * compatibility: - */ -#define ION_IOMMU_HEAP_ID ION_SYSTEM_HEAP_ID -#define ION_HEAP_TYPE_IOMMU ION_HEAP_TYPE_SYSTEM - -enum ion_fixed_position { - NOT_FIXED, - FIXED_LOW, - FIXED_MIDDLE, - FIXED_HIGH, -}; - -enum cp_mem_usage { - VIDEO_BITSTREAM = 0x1, - VIDEO_PIXEL = 0x2, - VIDEO_NONPIXEL = 0x3, - MAX_USAGE = 0x4, - UNKNOWN = 0x7FFFFFFF, -}; - -#define ION_HEAP_CP_MASK (1 << ION_HEAP_TYPE_CP) -#define ION_HEAP_TYPE_DMA_MASK (1 << ION_HEAP_TYPE_DMA) - -/** - * Flag to use when allocating to indicate that a heap is secure. - */ -#define ION_FLAG_SECURE (1 << ION_HEAP_ID_RESERVED) - -/** - * Flag for clients to force contiguous memort allocation - * - * Use of this flag is carefully monitored! - */ -#define ION_FLAG_FORCE_CONTIGUOUS (1 << 30) - -/* - * Used in conjunction with heap which pool memory to force an allocation - * to come from the page allocator directly instead of from the pool allocation - */ -#define ION_FLAG_POOL_FORCE_ALLOC (1 << 16) - -/** -* Deprecated! Please use the corresponding ION_FLAG_* -*/ -#define ION_SECURE ION_FLAG_SECURE -#define ION_FORCE_CONTIGUOUS ION_FLAG_FORCE_CONTIGUOUS - -/** - * Macro should be used with ion_heap_ids defined above. - */ -#define ION_HEAP(bit) (1 << (bit)) - -#define ION_ADSP_HEAP_NAME "adsp" -#define ION_SYSTEM_HEAP_NAME "system" -#define ION_VMALLOC_HEAP_NAME ION_SYSTEM_HEAP_NAME -#define ION_KMALLOC_HEAP_NAME "kmalloc" -#define ION_AUDIO_HEAP_NAME "audio" -#define ION_SF_HEAP_NAME "sf" -#define ION_MM_HEAP_NAME "mm" -#define ION_CAMERA_HEAP_NAME "camera_preview" -#define ION_IOMMU_HEAP_NAME "iommu" -#define ION_MFC_HEAP_NAME "mfc" -#define ION_WB_HEAP_NAME "wb" -#define ION_MM_FIRMWARE_HEAP_NAME "mm_fw" -#define ION_PIL1_HEAP_NAME "pil_1" -#define ION_PIL2_HEAP_NAME "pil_2" -#define ION_QSECOM_HEAP_NAME "qsecom" - -#define ION_SET_CACHED(__cache) (__cache | ION_FLAG_CACHED) -#define ION_SET_UNCACHED(__cache) (__cache & ~ION_FLAG_CACHED) - -#define ION_IS_CACHED(__flags) ((__flags) & ION_FLAG_CACHED) - -/* struct ion_flush_data - data passed to ion for flushing caches - * - * @handle: handle with data to flush - * @fd: fd to flush - * @vaddr: userspace virtual address mapped with mmap - * @offset: offset into the handle to flush - * @length: length of handle to flush - * - * Performs cache operations on the handle. If p is the start address - * of the handle, p + offset through p + offset + length will have - * the cache operations performed - */ -struct ion_flush_data { - struct ion_handle *handle; - int fd; - void *vaddr; - unsigned int offset; - unsigned int length; -}; - - -struct ion_prefetch_data { - int heap_id; - unsigned long len; -}; - -#define ION_IOC_MSM_MAGIC 'M' - -/** - * DOC: ION_IOC_CLEAN_CACHES - clean the caches - * - * Clean the caches of the handle specified. - */ -#define ION_IOC_CLEAN_CACHES _IOWR(ION_IOC_MSM_MAGIC, 0, \ - struct ion_flush_data) -/** - * DOC: ION_IOC_INV_CACHES - invalidate the caches - * - * Invalidate the caches of the handle specified. - */ -#define ION_IOC_INV_CACHES _IOWR(ION_IOC_MSM_MAGIC, 1, \ - struct ion_flush_data) -/** - * DOC: ION_IOC_CLEAN_INV_CACHES - clean and invalidate the caches - * - * Clean and invalidate the caches of the handle specified. - */ -#define ION_IOC_CLEAN_INV_CACHES _IOWR(ION_IOC_MSM_MAGIC, 2, \ - struct ion_flush_data) - -#define ION_IOC_PREFETCH _IOWR(ION_IOC_MSM_MAGIC, 3, \ - struct ion_prefetch_data) - -#define ION_IOC_DRAIN _IOWR(ION_IOC_MSM_MAGIC, 4, \ - struct ion_prefetch_data) - -#endif +#endif /* __UAPI_LINUX_MSM_ION_H__ */ diff --git a/include/uapi/linux/msm_mdp.h b/include/uapi/linux/msm_mdp.h index 66eab0c400e..fa0bd3e5fd6 100644 --- a/include/uapi/linux/msm_mdp.h +++ b/include/uapi/linux/msm_mdp.h @@ -180,6 +180,7 @@ enum { #define MDP_BLEND_FG_PREMULT 0x20000 #define MDP_IS_FG 0x40000 #define MDP_SOLID_FILL 0x00000020 +#define MDP_VPU_PIPE 0x00000040 #define MDP_DEINTERLACE 0x80000000 #define MDP_SHARPENING 0x40000000 #define MDP_NO_DMA_BARRIER_START 0x20000000 @@ -975,6 +976,8 @@ struct mdss_hw_caps { uint8_t rgb_pipes; uint8_t vig_pipes; uint8_t dma_pipes; + uint8_t max_smp_cnt; + uint8_t smp_per_pipe; uint32_t features; }; diff --git a/include/uapi/linux/rmnet_data.h b/include/uapi/linux/rmnet_data.h index 7ba00f217b1..d978caafcbd 100644 --- a/include/uapi/linux/rmnet_data.h +++ b/include/uapi/linux/rmnet_data.h @@ -55,6 +55,7 @@ struct rmnet_nl_msg_s { uint32_t flags; uint16_t agg_size; uint16_t agg_count; + uint8_t tail_spacing; } data_format; struct { uint8_t dev[RMNET_MAX_STR_LEN]; |
