type
stringclasses
5 values
content
stringlengths
9
163k
defines
#define MSM_ROTATOR_MAX_ROT 0x07
defines
#define MSM_ROTATOR_MAX_H 0x1fff
defines
#define MSM_ROTATOR_MAX_W 0x1fff
defines
#define GET_PACK_PATTERN(a, x, y, z, bit) \
defines
#define CLR_G 0x0
defines
#define CLR_B 0x1
defines
#define CLR_R 0x2
defines
#define CLR_ALPHA 0x3
defines
#define CLR_Y CLR_G
defines
#define CLR_CB CLR_B
defines
#define CLR_CR CLR_R
defines
#define ROTATIONS_TO_BITMASK(r) ((((r) & MDP_ROT_90) ? 1 : 0) | \
defines
#define IMEM_NO_OWNER -1;
defines
#define MAX_SESSIONS 16
defines
#define INVALID_SESSION -1
defines
#define VERSION_KEY_MASK 0xFFFFFF00
defines
#define MAX_DOWNSCALE_RATIO 3
defines
#define MAX_COMMIT_QUEUE 4
defines
#define WAIT_ROT_TIMEOUT 1000
defines
#define MAX_TIMELINE_NAME_LEN 16
defines
#define WAIT_FENCE_FIRST_TIMEOUT MSEC_PER_SEC
defines
#define WAIT_FENCE_FINAL_TIMEOUT (10 * MSEC_PER_SEC)
defines
#define ROTATOR_REVISION_V0 0
defines
#define ROTATOR_REVISION_V1 1
defines
#define ROTATOR_REVISION_V2 2
defines
#define ROTATOR_REVISION_NONE 0xffffffff
defines
#define BASE_ADDR(height, y_stride) ((height % 64) * y_stride)
defines
#define HW_BASE_ADDR(height, y_stride) (((dstp0_ystride >> 5) << 11) - \
defines
#define checkoffset(offset, size, max_size) \
defines
#define COMPONENT_5BITS 1
defines
#define COMPONENT_6BITS 2
defines
#define COMPONENT_8BITS 3
defines
#define mrd msm_rotator_dev
structs
struct tile_parm { unsigned int width; /* tile's width */ unsigned int height; /* tile's height */ unsigned int row_tile_w; /* tiles per row's width */ unsigned int row_tile_h; /* tiles per row's height */ };
structs
struct msm_rotator_mem_planes { unsigned int num_planes; unsigned int plane_size[4]; unsigned int total_size; };
structs
struct msm_rotator_fd_info { int pid; int ref_cnt; struct list_head list; };
structs
struct rot_sync_info { u32 initialized; struct sync_fence *acq_fen; struct sync_fence *rel_fen; int rel_fen_fd; struct sw_sync_timeline *timeline; int timeline_value; struct mutex sync_mutex; atomic_t queue_buf_cnt; };
structs
struct msm_rotator_session { struct msm_rotator_img_info img_info; struct msm_rotator_fd_info fd_info; int fast_yuv_enable; int enable_2pass; u32 mem_hid; };
structs
struct msm_rotator_commit_info { struct msm_rotator_data_info data_info; struct msm_rotator_img_info img_info; unsigned int format; unsigned int in_paddr; unsigned int out_paddr; unsigned int in_chroma_paddr; unsigned int out_chroma_paddr; unsigned int in_chroma2_paddr; unsigned int out_chroma2_paddr; struct ...
structs
struct msm_rotator_dev { void __iomem *io_base; int irq; struct clk *core_clk; struct msm_rotator_session *rot_session[MAX_SESSIONS]; struct list_head fd_list; struct clk *pclk; int rot_clk_state; struct regulator *regulator; struct delayed_work rot_clk_work; struct clk *imem_clk; int imem_clk_state; struct...
structs
struct res_mmu_clk { char *mmu_clk_name; struct clk *mmu_clk; };
functions
u32 rotator_allocate_2pass_buf(struct rot_buf_type *rot_buf, int s_ndx) { ion_phys_addr_t addr, read_addr = 0; size_t buffer_size; unsigned long len; if (!rot_buf) { pr_err("Rot_buf NULL pointer %s %i", __func__, __LINE__); return 0; }
functions
void rotator_free_2pass_buf(struct rot_buf_type *rot_buf, int s_ndx) { if (!rot_buf) { pr_err("Rot_buf NULL pointer %s %i", __func__, __LINE__); return; }
functions
int msm_rotator_iommu_map_buf(int mem_id, int domain, unsigned long *start, unsigned long *len, struct ion_handle **pihdl, unsigned int secure) { if (!msm_rotator_dev->client) return -EINVAL; *pihdl = ion_import_dma_buf(msm_rotator_dev->client, mem_id); if (IS_ERR_OR_NULL(*pihdl)) { pr_err("ion_import_dma_buf...
functions
int msm_rotator_imem_allocate(int requestor) { int rc = 0; #ifdef CONFIG_MSM_ROTATOR_USE_IMEM switch (requestor) { case ROTATOR_REQUEST: if (mutex_trylock(&msm_rotator_dev->imem_lock)) { msm_rotator_dev->imem_owner = ROTATOR_REQUEST; rc = 1; }
functions
endif if (rc == 1) { cancel_delayed_work_sync(&msm_rotator_dev->imem_clk_work); if (msm_rotator_dev->imem_clk_state != CLK_EN && msm_rotator_dev->imem_clk) { clk_prepare_enable(msm_rotator_dev->imem_clk); msm_rotator_dev->imem_clk_state = CLK_EN; }
functions
void msm_rotator_imem_free(int requestor) { #ifdef CONFIG_MSM_ROTATOR_USE_IMEM if (msm_rotator_dev->imem_owner == requestor) { schedule_delayed_work(&msm_rotator_dev->imem_clk_work, HZ); mutex_unlock(&msm_rotator_dev->imem_lock); }
functions
void msm_rotator_imem_clk_work_f(struct work_struct *work) { #ifdef CONFIG_MSM_ROTATOR_USE_IMEM if (mutex_trylock(&msm_rotator_dev->imem_lock)) { if (msm_rotator_dev->imem_clk_state == CLK_EN && msm_rotator_dev->imem_clk) { clk_disable_unprepare(msm_rotator_dev->imem_clk); msm_rotator_dev->imem_clk_stat...
functions
void enable_rot_clks(void) { if (msm_rotator_dev->regulator) regulator_enable(msm_rotator_dev->regulator); if (msm_rotator_dev->core_clk != NULL) clk_prepare_enable(msm_rotator_dev->core_clk); if (msm_rotator_dev->pclk != NULL) clk_prepare_enable(msm_rotator_dev->pclk); }
functions
void disable_rot_clks(void) { if (msm_rotator_dev->core_clk != NULL) clk_disable_unprepare(msm_rotator_dev->core_clk); if (msm_rotator_dev->pclk != NULL) clk_disable_unprepare(msm_rotator_dev->pclk); if (msm_rotator_dev->regulator) regulator_disable(msm_rotator_dev->regulator); }
functions
void msm_rotator_rot_clk_work_f(struct work_struct *work) { if (mutex_trylock(&msm_rotator_dev->rotator_lock)) { if (msm_rotator_dev->rot_clk_state == CLK_EN) { disable_rot_clks(); msm_rotator_dev->rot_clk_state = CLK_DIS; }
functions
irqreturn_t msm_rotator_isr(int irq, void *dev_id) { if (msm_rotator_dev->processing) { msm_rotator_dev->processing = 0; wake_up(&msm_rotator_dev->wq); }
functions
void msm_rotator_signal_timeline(u32 session_index) { struct rot_sync_info *sync_info; sync_info = &msm_rotator_dev->sync_info[session_index]; if ((!sync_info->timeline) || (!sync_info->initialized)) return; mutex_lock(&sync_info->sync_mutex); sw_sync_timeline_inc(sync_info->timeline, 1); sync_info->timeline_...
functions
void msm_rotator_signal_timeline_done(u32 session_index) { struct rot_sync_info *sync_info; sync_info = &msm_rotator_dev->sync_info[session_index]; if ((sync_info->timeline == NULL) || (sync_info->initialized == false)) return; mutex_lock(&sync_info->sync_mutex); sw_sync_timeline_inc(sync_info->timeline, 1);...
functions
void msm_rotator_release_acq_fence(u32 session_index) { struct rot_sync_info *sync_info; sync_info = &msm_rotator_dev->sync_info[session_index]; if ((!sync_info->timeline) || (!sync_info->initialized)) return; mutex_lock(&sync_info->sync_mutex); sync_info->acq_fen = NULL; mutex_unlock(&sync_info->sync_mutex); ...
functions
void msm_rotator_release_all_timeline(void) { int i; struct rot_sync_info *sync_info; for (i = 0; i < MAX_SESSIONS; i++) { sync_info = &msm_rotator_dev->sync_info[i]; if (sync_info->initialized) { msm_rotator_signal_timeline(i); msm_rotator_release_acq_fence(i); }
functions
void msm_rotator_wait_for_fence(struct sync_fence *acq_fen) { int ret; if (acq_fen) { ret = sync_fence_wait(acq_fen, WAIT_FENCE_FIRST_TIMEOUT); if (ret == -ETIME) { pr_warn("%s: timeout, wait %ld more ms\n", __func__, WAIT_FENCE_FINAL_TIMEOUT); ret = sync_fence_wait(acq_fen, WAIT_FENCE_FINAL_TIM...
functions
int msm_rotator_buf_sync(unsigned long arg) { struct msm_rotator_buf_sync buf_sync; int ret = 0; struct sync_fence *fence = NULL; struct rot_sync_info *sync_info; struct sync_pt *rel_sync_pt; struct sync_fence *rel_fence; int rel_fen_fd; u32 s; if (copy_from_user(&buf_sync, (void __user *)arg, sizeof(buf_syn...
functions
int tile_size(unsigned int src_width, unsigned int src_height, const struct tile_parm *tp) { unsigned int tile_w, tile_h; unsigned int row_num_w, row_num_h; tile_w = tp->width * tp->row_tile_w; tile_h = tp->height * tp->row_tile_h; row_num_w = (src_width + tile_w - 1) / tile_w; row_num_h = (src_height + tile_...
functions
int get_bpp(int format) { switch (format) { case MDP_RGB_565: case MDP_BGR_565: return 2; case MDP_XRGB_8888: case MDP_ARGB_8888: case MDP_RGBA_8888: case MDP_BGRA_8888: case MDP_RGBX_8888: return 4; case MDP_Y_CBCR_H2V2: case MDP_Y_CRCB_H2V2: case MDP_Y_CB_CR_H2V2: case MDP_Y_CR_CB_H2V2: case MDP_Y_...
functions
int msm_rotator_get_plane_sizes(uint32_t format, uint32_t w, uint32_t h, struct msm_rotator_mem_planes *p) { /* * each row of samsung tile consists of two tiles in height * and two tiles in width which means width should align to * 64 x 2 bytes and height should align to 32 x 2 bytes. * video decode...
functions
uint32_t fast_yuv_invalid_size_checker(unsigned char rot_mode, uint32_t src_width, uint32_t dst_width, uint32_t src_height, uint32_t dst_height, uint32_t dstp0_ystride, uint32_t is_planar420) { uint32_t hw_limit; hw_limit = is_planar420 ? 512 : 256; /* checking image constaints...
functions
int msm_rotator_ycxcx_h2v1(struct msm_rotator_img_info *info, unsigned int in_paddr, unsigned int out_paddr, unsigned int use_imem, int new_session, unsigned int in_chroma_paddr, unsigned int out_chroma_paddr) { int bpp; uint32_t dst_format; switch (info->src.format) { case MDP_Y...
functions
int msm_rotator_ycxcx_h2v2(struct msm_rotator_img_info *info, unsigned int in_paddr, unsigned int out_paddr, unsigned int use_imem, int new_session, unsigned int in_chroma_paddr, unsigned int out_chroma_paddr, unsigned int in_chroma2_paddr, unsigned int out_chroma2_paddr,...
functions
int msm_rotator_ycxcx_h2v2_2pass(struct msm_rotator_img_info *info, unsigned int in_paddr, unsigned int out_paddr, unsigned int use_imem, int new_session, unsigned int in_chroma_paddr, unsigned int out_chroma_paddr, unsigned int in_chroma2_paddr, unsigned int out_chroma2_...
functions
int msm_rotator_ycrycb(struct msm_rotator_img_info *info, unsigned int in_paddr, unsigned int out_paddr, unsigned int use_imem, int new_session, unsigned int out_chroma_paddr) { int bpp; uint32_t dst_format; if (info->src.format == MDP_YCRYCB_H2V1) { if (info->rotation...
functions
int msm_rotator_rgb_types(struct msm_rotator_img_info *info, unsigned int in_paddr, unsigned int out_paddr, unsigned int use_imem, int new_session) { int bpp, abits, rbits, gbits, bbits; if (info->src.format != info->dst.format) return -EINVAL; bpp = get_bpp(info->src.format); if (bpp < 0) ...
functions
int get_img(struct msmfb_data *fbd, int domain, unsigned long *start, unsigned long *len, struct file **p_file, int *p_need, struct ion_handle **p_ihdl, unsigned int secure) { int ret = 0; #ifdef CONFIG_FB struct file *file = NULL; int put_needed, fb_num; #endif #ifdef CONFIG_ANDROID_PMEM unsigned long vstart; #e...
functions
void put_img(struct file *p_file, struct ion_handle *p_ihdl, int domain, unsigned int secure) { #ifdef CONFIG_ANDROID_PMEM if (p_file != NULL) put_pmem_file(p_file); #endif #ifdef CONFIG_MSM_MULTIMEDIA_USE_ION if (!IS_ERR_OR_NULL(p_ihdl)) { pr_debug("%s(): p_ihdl %p\n", __func__, p_ihdl); if (rot_iommu_split_...
functions
int msm_rotator_rotate_prepare( struct msm_rotator_data_info *data_info, struct msm_rotator_commit_info *commit_info) { unsigned int format; struct msm_rotator_data_info info; unsigned int in_paddr, out_paddr; unsigned long src_len, dst_len; int rc = 0, s; struct file *srcp0_file = NULL, *dstp0_file = NULL; st...
functions
int msm_rotator_do_rotate_sub( struct msm_rotator_commit_info *commit_info) { unsigned int status, format; struct msm_rotator_data_info info; unsigned int in_paddr, out_paddr; int use_imem = 0, rc = 0; struct file *srcp0_file, *dstp0_file; struct file *srcp1_file, *dstp1_file; struct ion_handle *srcp0_ihdl, *ds...
functions
void rot_wait_for_commit_queue(u32 is_all) { int ret = 0; u32 loop_cnt = 0; while (1) { mutex_lock(&mrd->commit_mutex); if (is_all && (atomic_read(&mrd->commit_q_cnt) == 0)) break; if ((!is_all) && (atomic_read(&mrd->commit_q_cnt) < MAX_COMMIT_QUEUE)) break; INIT_COMPLETION(mrd->commit_comp); mut...
functions
int msm_rotator_do_rotate(unsigned long arg) { struct msm_rotator_data_info info; struct rot_sync_info *sync_info; int session_index, ret; int commit_q_w; if (copy_from_user(&info, (void __user *)arg, sizeof(info))) return -EFAULT; rot_wait_for_commit_queue(false); mutex_lock(&mrd->commit_mutex); commit_q_w...
functions
void rot_commit_wq_handler(struct work_struct *work) { mutex_lock(&mrd->commit_wq_mutex); mutex_lock(&mrd->commit_mutex); while (atomic_read(&mrd->commit_q_cnt) > 0) { mrd->commit_running = true; mutex_unlock(&mrd->commit_mutex); msm_rotator_do_rotate_sub( &mrd->commit_info[atomic_read(&mrd->commit_q_r)]); ...
functions
void msm_rotator_set_perf_level(u32 wh, u32 is_rgb) { u32 perf_level; if (is_rgb) perf_level = 1; else if (wh <= (640 * 480)) perf_level = 2; else if (wh <= (736 * 1280)) perf_level = 3; else perf_level = 4; #ifdef CONFIG_MSM_BUS_SCALING msm_bus_scale_client_update_request(msm_rotator_dev->bus_client_ha...
functions
int rot_enable_iommu_clocks(struct msm_rotator_dev *rot_dev) { int ret = 0, i; if (rot_dev->mmu_clk_on) return 0; for (i = 0; i < ARRAY_SIZE(rot_mmu_clks); i++) { rot_mmu_clks[i].mmu_clk = clk_get(&msm_rotator_dev->pdev->dev, rot_mmu_clks[i].mmu_clk_name); if (IS_ERR(rot_mmu_clks[i].mmu_clk)) { pr_err(" ...
functions
int rot_disable_iommu_clocks(struct msm_rotator_dev *rot_dev) { int i; if (!rot_dev->mmu_clk_on) return 0; for (i = 0; i < ARRAY_SIZE(rot_mmu_clks); i++) { clk_disable_unprepare(rot_mmu_clks[i].mmu_clk); clk_put(rot_mmu_clks[i].mmu_clk); rot_mmu_clks[i].mmu_clk = NULL; }
functions
int map_sec_resource(struct msm_rotator_dev *rot_dev) { int ret = 0; if (rot_dev->sec_mapped) return 0; ret = rot_enable_iommu_clocks(rot_dev); if (ret) { pr_err("IOMMU clock enabled failed while open"); return ret; }
functions
int unmap_sec_resource(struct msm_rotator_dev *rot_dev) { int ret = 0; ret = rot_enable_iommu_clocks(rot_dev); if (ret) { pr_err("IOMMU clock enabled failed while close\n"); return ret; }
functions
int msm_rotator_start(unsigned long arg, struct msm_rotator_fd_info *fd_info) { struct msm_rotator_img_info info; struct msm_rotator_session *rot_session = NULL; int rc = 0; int s, is_rgb = 0; int first_free_idx = INVALID_SESSION; unsigned int dst_w, dst_h; unsigned int is_planar420 = 0; int fast_yuv_en...
functions
else if (s == MAX_SESSIONS) { dev_dbg(msm_rotator_dev->device, "%s: all sessions in use\n", __func__); rc = -EBUSY; }
functions
int msm_rotator_finish(unsigned long arg) { int rc = 0; int s; unsigned int session_id; if (copy_from_user(&session_id, (void __user *)arg, sizeof(s))) return -EFAULT; rot_wait_for_commit_queue(true); mutex_lock(&msm_rotator_dev->rotator_lock); for (s = 0; s < MAX_SESSIONS; s++) { if ((msm_rotator_dev->rot...
functions
int msm_rotator_open(struct inode *inode, struct file *filp) { struct msm_rotator_fd_info *tmp, *fd_info = NULL; int i; if (filp->private_data) return -EBUSY; mutex_lock(&msm_rotator_dev->rotator_lock); for (i = 0; i < MAX_SESSIONS; i++) { if (msm_rotator_dev->rot_session[i] == NULL) break; }
functions
int msm_rotator_close(struct inode *inode, struct file *filp) { struct msm_rotator_fd_info *fd_info; int s; fd_info = (struct msm_rotator_fd_info *)filp->private_data; mutex_lock(&msm_rotator_dev->rotator_lock); if (--fd_info->ref_cnt > 0) { mutex_unlock(&msm_rotator_dev->rotator_lock); return 0; }
functions
long msm_rotator_ioctl(struct file *file, unsigned cmd, unsigned long arg) { struct msm_rotator_fd_info *fd_info; if (_IOC_TYPE(cmd) != MSM_ROTATOR_IOCTL_MAGIC) return -ENOTTY; fd_info = (struct msm_rotator_fd_info *)file->private_data; switch (cmd) { case MSM_ROTATOR_IOCTL_START: return msm_rotator_...
functions
__devinit msm_rotator_probe(struct platform_device *pdev) { int rc = 0; struct resource *res; struct msm_rotator_platform_data *pdata = NULL; int i, number_of_clks; uint32_t ver; msm_rotator_dev = kzalloc(sizeof(struct msm_rotator_dev), GFP_KERNEL); if (!msm_rotator_dev) { printk(KERN_ERR "%s Unable to alloca...
functions
CONFIG_MSM_BUS_SCALING if (!msm_rotator_dev->bus_client_handle && pdata && pdata->bus_scale_table) { msm_rotator_dev->bus_client_handle = msm_bus_scale_register_client( pdata->bus_scale_table); if (!msm_rotator_dev->bus_client_handle) { pr_err("%s not able to get bus scale handle\n", __func__); }
functions
endif for (i = 0; i < number_of_clks; i++) { if (pdata->rotator_clks[i].clk_type == ROTATOR_IMEM_CLK) { msm_rotator_dev->imem_clk = clk_get(&msm_rotator_dev->pdev->dev, pdata->rotator_clks[i].clk_name); if (IS_ERR(msm_rotator_dev->imem_clk)) { rc = PTR_ERR(msm_rotator_dev->imem_clk); msm_rotato...
functions
__devexit msm_rotator_remove(struct platform_device *plat_dev) { int i; rot_wait_for_commit_queue(true); #ifdef CONFIG_MSM_BUS_SCALING if (msm_rotator_dev->bus_client_handle) { msm_bus_scale_unregister_client (msm_rotator_dev->bus_client_handle); msm_rotator_dev->bus_client_handle = 0; }
functions
int msm_rotator_suspend(struct platform_device *dev, pm_message_t state) { rot_wait_for_commit_queue(true); mutex_lock(&msm_rotator_dev->imem_lock); if (msm_rotator_dev->imem_clk_state == CLK_EN && msm_rotator_dev->imem_clk) { clk_disable_unprepare(msm_rotator_dev->imem_clk); msm_rotator_dev->imem_clk_state = ...
functions
int msm_rotator_resume(struct platform_device *dev) { mutex_lock(&msm_rotator_dev->imem_lock); if (msm_rotator_dev->imem_clk_state == CLK_SUSPEND && msm_rotator_dev->imem_clk) { clk_prepare_enable(msm_rotator_dev->imem_clk); msm_rotator_dev->imem_clk_state = CLK_EN; }
functions
__init msm_rotator_init(void) { return platform_driver_register(&msm_rotator_platform_driver); }
functions
__exit msm_rotator_exit(void) { return platform_driver_unregister(&msm_rotator_platform_driver); }
includes
#include <linux/blkdev.h>
includes
#include <linux/completion.h>
includes
#include <linux/dcache.h>
includes
#include <linux/delay.h>
includes
#include <linux/device.h>
includes
#include <linux/fcntl.h>
includes
#include <linux/file.h>