Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * The On Chip Memory (OCMEM) allocator allows various clients to allocate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * memory from OCMEM based on performance, latency and power requirements.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * This is typically used by the GPU, camera/video, and audio components on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * some Snapdragon SoCs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  * Copyright (C) 2019 Brian Masney <masneyb@onstation.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  * Copyright (C) 2015 Red Hat. Author: Rob Clark <robdclark@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #ifndef __OCMEM_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define __OCMEM_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) enum ocmem_client {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	/* GMEM clients */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	OCMEM_GRAPHICS = 0x0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	 * TODO add more once ocmem_allocate() is clever enough to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	 * deal with multiple clients.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	OCMEM_CLIENT_MAX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct ocmem;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct ocmem_buf {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	unsigned long offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	unsigned long addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	unsigned long len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #if IS_ENABLED(CONFIG_QCOM_OCMEM)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) struct ocmem *of_get_ocmem(struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct ocmem_buf *ocmem_allocate(struct ocmem *ocmem, enum ocmem_client client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 				 unsigned long size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) void ocmem_free(struct ocmem *ocmem, enum ocmem_client client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 		struct ocmem_buf *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #else /* IS_ENABLED(CONFIG_QCOM_OCMEM) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) static inline struct ocmem *of_get_ocmem(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	return ERR_PTR(-ENODEV);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) static inline struct ocmem_buf *ocmem_allocate(struct ocmem *ocmem,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 					       enum ocmem_client client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 					       unsigned long size)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	return ERR_PTR(-ENODEV);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) static inline void ocmem_free(struct ocmem *ocmem, enum ocmem_client client,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 			      struct ocmem_buf *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #endif /* IS_ENABLED(CONFIG_QCOM_OCMEM) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) #endif /* __OCMEM_H__ */