summaryrefstree
path: root/kernel/drivers/media/platform/exynos/astc/astc-helper.h
blob: 827e41ecd27f5af4dfd1b1706411580a4cec1cf4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* drivers/media/platform/exynos/astc/astc-helper.h
 *
 * Internal header for Samsung ASTC encoder driver
 *
 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com
 *
 * Author: Andrea Bernabei <a.bernabei@samsung.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef ASTC_HELPER_H_
#define ASTC_HELPER_H_

#include "astc-core.h"

int ftm_to_bpp(struct device *dev, struct hwASTC_img_info *img_info);

u32 blksize_enum_to_int(enum hwASTC_blk_size blk_size, int x_or_y);
u32 blksize_enum_to_x(enum hwASTC_blk_size blk_size);
u32 blksize_enum_to_y(enum hwASTC_blk_size blk_size);

static inline void astc_set_dma_address(
		struct astc_buffer_dma *buffer_dma,
		dma_addr_t dma_addr)
{
	buffer_dma->plane.dma_addr = dma_addr;
}

int astc_map_dma_attachment(struct device *dev,
		     struct astc_buffer_plane_dma *plane,
		     enum dma_data_direction dir);
void astc_unmap_dma_attachment(struct device *dev,
			struct astc_buffer_plane_dma *plane,
			enum dma_data_direction dir);


int astc_map_buf_to_device(struct astc_dev *astc_device,
		      struct astc_task *task,
		      struct astc_buffer_dma *buf,
		      enum dma_data_direction dir);
int astc_unmap_buf_from_device(struct device *dev,
			 struct astc_buffer_dma *buf);

void astc_sync_for_device(struct device *dev,
			  struct astc_buffer_plane_dma *plane,
			  enum dma_data_direction dir);

void astc_sync_for_cpu(struct device *dev,
		       struct astc_buffer_plane_dma *plane,
		       enum dma_data_direction dir);

#endif /* ASTC_HELPER_H_ */