| Larry Bassel | 1daa0f0 | 2011-12-06 15:55:58 -0800 | [diff] [blame] | 1 | /* | 
 | 2 |  * | 
| Duy Truong | e833aca | 2013-02-12 13:35:08 -0800 | [diff] [blame] | 3 |  * Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. | 
| Larry Bassel | 1daa0f0 | 2011-12-06 15:55:58 -0800 | [diff] [blame] | 4 |  * | 
 | 5 |  * This program is free software; you can redistribute it and/or modify | 
 | 6 |  * it under the terms of the GNU General Public License version 2 and | 
 | 7 |  * only version 2 as published by the Free Software Foundation. | 
 | 8 |  * | 
 | 9 |  * This program is distributed in the hope that it will be useful, | 
 | 10 |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 | 11 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
 | 12 |  * GNU General Public License for more details. | 
 | 13 |  * | 
 | 14 |  */ | 
 | 15 | #ifndef _FMEM_H_ | 
 | 16 | #define _FMEM_H_ | 
 | 17 |  | 
| Laura Abbott | 7749792 | 2011-12-13 11:32:19 -0800 | [diff] [blame] | 18 | #include <linux/vmalloc.h> | 
 | 19 |  | 
| Larry Bassel | 1daa0f0 | 2011-12-06 15:55:58 -0800 | [diff] [blame] | 20 | struct fmem_platform_data { | 
 | 21 | 	unsigned long phys; | 
 | 22 | 	unsigned long size; | 
| Olav Haugan | f6dc774 | 2012-02-15 09:11:55 -0800 | [diff] [blame] | 23 | 	unsigned long reserved_size_low; | 
 | 24 | 	unsigned long reserved_size_high; | 
| Olav Haugan | 8726caf | 2012-05-10 15:11:35 -0700 | [diff] [blame] | 25 | 	unsigned long align; | 
| Larry Bassel | 1daa0f0 | 2011-12-06 15:55:58 -0800 | [diff] [blame] | 26 | }; | 
 | 27 |  | 
 | 28 | struct fmem_data { | 
 | 29 | 	unsigned long phys; | 
 | 30 | 	void *virt; | 
| Laura Abbott | 7749792 | 2011-12-13 11:32:19 -0800 | [diff] [blame] | 31 | 	struct vm_struct *area; | 
| Larry Bassel | 1daa0f0 | 2011-12-06 15:55:58 -0800 | [diff] [blame] | 32 | 	unsigned long size; | 
| Olav Haugan | f6dc774 | 2012-02-15 09:11:55 -0800 | [diff] [blame] | 33 | 	unsigned long reserved_size_low; | 
 | 34 | 	unsigned long reserved_size_high; | 
| Larry Bassel | 1daa0f0 | 2011-12-06 15:55:58 -0800 | [diff] [blame] | 35 | }; | 
 | 36 |  | 
 | 37 | enum fmem_state { | 
 | 38 | 	FMEM_UNINITIALIZED = 0, | 
 | 39 | 	FMEM_C_STATE, | 
 | 40 | 	FMEM_T_STATE, | 
 | 41 | 	FMEM_O_STATE, | 
 | 42 | }; | 
 | 43 |  | 
| Laura Abbott | 99f87d2 | 2011-12-14 16:01:54 -0800 | [diff] [blame] | 44 | #ifdef CONFIG_QCACHE | 
| Larry Bassel | 1daa0f0 | 2011-12-06 15:55:58 -0800 | [diff] [blame] | 45 | struct fmem_data *fmem_get_info(void); | 
 | 46 | int fmem_set_state(enum fmem_state); | 
 | 47 | void lock_fmem_state(void); | 
 | 48 | void unlock_fmem_state(void); | 
| Laura Abbott | 7749792 | 2011-12-13 11:32:19 -0800 | [diff] [blame] | 49 | void *fmem_map_virtual_area(int cacheability); | 
 | 50 | void fmem_unmap_virtual_area(void); | 
| Laura Abbott | 99f87d2 | 2011-12-14 16:01:54 -0800 | [diff] [blame] | 51 | #else | 
 | 52 | static inline struct fmem_data *fmem_get_info(void) { return NULL; } | 
 | 53 | static inline int fmem_set_state(enum fmem_state f) { return -ENODEV; } | 
 | 54 | static inline void lock_fmem_state(void) { return; } | 
 | 55 | static inline void unlock_fmem_state(void) { return; } | 
| Laura Abbott | 7749792 | 2011-12-13 11:32:19 -0800 | [diff] [blame] | 56 | static inline void *fmem_map_virtual_area(int cacheability) { return NULL; } | 
 | 57 | static inline void fmem_unmap_virtual_area(void) { return; } | 
| Laura Abbott | 99f87d2 | 2011-12-14 16:01:54 -0800 | [diff] [blame] | 58 | #endif | 
 | 59 |  | 
| Laura Abbott | f637aff | 2011-12-14 14:16:17 -0800 | [diff] [blame] | 60 | int request_fmem_c_region(void *unused); | 
 | 61 | int release_fmem_c_region(void *unused); | 
| Larry Bassel | 1daa0f0 | 2011-12-06 15:55:58 -0800 | [diff] [blame] | 62 | #endif |