summaryrefstree
path: root/kernel/techpack/display/msm/sde/sde_hw_dsc.h
blob: 33987c146537b4f0a0818f80cd4b0f7607b73d96 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
 */

#ifndef _SDE_HW_DSC_H
#define _SDE_HW_DSC_H

#include "sde_hw_catalog.h"
#include "sde_hw_mdss.h"
#include "sde_hw_util.h"
#include "sde_hw_blk.h"

struct sde_hw_dsc;
struct msm_display_dsc_info;

#define DSC_MODE_SPLIT_PANEL            BIT(0)
#define DSC_MODE_MULTIPLEX              BIT(1)
#define DSC_MODE_VIDEO                  BIT(2)

/**
 * struct sde_hw_dsc_ops - interface to the dsc hardware driver functions
 * Assumption is these functions will be called after clocks are enabled
 */
struct sde_hw_dsc_ops {
	/**
	 * dsc_disable - disable dsc
	 * @hw_dsc: Pointer to dsc context
	 */
	void (*dsc_disable)(struct sde_hw_dsc *hw_dsc);

	/**
	 * dsc_config - configures dsc encoder
	 * @hw_dsc: Pointer to dsc context
	 * @dsc: panel dsc parameters
	 * @mode: dsc topology mode to be set
	 * @ich_reset_override: option to reset ich
	 */
	void (*dsc_config)(struct sde_hw_dsc *hw_dsc,
			struct msm_display_dsc_info *dsc,
			u32 mode, bool ich_reset_override);

	/**
	 * dsc_config_thresh - programs panel thresholds
	 * @hw_dsc: Pointer to dsc context
	 * @dsc: panel dsc parameters
	 */
	void (*dsc_config_thresh)(struct sde_hw_dsc *hw_dsc,
			struct msm_display_dsc_info *dsc);

	/**
	 * bind_pingpong_blk - enable/disable the connection with pp
	 * @hw_dsc: Pointer to dsc context
	 * @enable: enable/disable connection
	 * @pp: pingpong blk id
	 */
	void (*bind_pingpong_blk)(struct sde_hw_dsc *hw_dsc,
			bool enable,
			const enum sde_pingpong pp);
};

struct sde_hw_dsc {
	struct sde_hw_blk base;
	struct sde_hw_blk_reg_map hw;

	/* dsc */
	enum sde_dsc idx;
	const struct sde_dsc_cfg *caps;

	/* ops */
	struct sde_hw_dsc_ops ops;
};

/**
 * sde_hw_dsc - convert base object sde_hw_base to container
 * @hw: Pointer to base hardware block
 * return: Pointer to hardware block container
 */
static inline struct sde_hw_dsc *to_sde_hw_dsc(struct sde_hw_blk *hw)
{
	return container_of(hw, struct sde_hw_dsc, base);
}

/**
 * sde_hw_dsc_init - initializes the dsc block for the passed
 *                   dsc idx.
 * @idx:  DSC index for which driver object is required
 * @addr: Mapped register io address of MDP
 * @m:    Pointer to mdss catalog data
 * Returns: Error code or allocated sde_hw_dsc context
 */
struct sde_hw_dsc *sde_hw_dsc_init(enum sde_dsc idx,
		void __iomem *addr,
		struct sde_mdss_cfg *m);

/**
 * sde_hw_dsc_destroy - destroys dsc driver context
 *                      should be called to free the context
 * @dsc:   Pointer to dsc driver context returned by sde_hw_dsc_init
 */
void sde_hw_dsc_destroy(struct sde_hw_dsc *dsc);

#endif /*_SDE_HW_DSC_H */