]>
git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - drivers/gpu/drm/amd/display/dc/i2caux/i2caux.h
2 * Copyright 2012-15 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
26 #ifndef __DAL_I2C_AUX_H__
27 #define __DAL_I2C_AUX_H__
29 uint32_t dal_i2caux_get_reference_clock(
30 struct dc_bios
*bios
);
37 void (*destroy
)(struct i2caux
**ptr
);
38 struct i2c_engine
* (*acquire_i2c_sw_engine
)(
39 struct i2caux
*i2caux
,
41 struct i2c_engine
* (*acquire_i2c_hw_engine
)(
42 struct i2caux
*i2caux
,
44 struct aux_engine
* (*acquire_aux_engine
)(
45 struct i2caux
*i2caux
,
47 void (*release_engine
)(
48 struct i2caux
*i2caux
,
49 struct engine
*engine
);
56 struct dc_context
*ctx
;
57 const struct i2caux_funcs
*funcs
;
58 /* On ASIC we have certain amount of lines with HW DDC engine
59 * (4, 6, or maybe more in the future).
60 * For every such line, we create separate HW DDC engine
61 * (since we have these engines in HW) and separate SW DDC engine
62 * (to allow concurrent use of few lines).
63 * In similar way we have AUX engines. */
65 /* I2C SW engines, per DDC line.
66 * Only lines with HW DDC support will be initialized */
67 struct i2c_engine
*i2c_sw_engines
[GPIO_DDC_LINE_COUNT
];
69 /* I2C HW engines, per DDC line.
70 * Only lines with HW DDC support will be initialized */
71 struct i2c_engine
*i2c_hw_engines
[GPIO_DDC_LINE_COUNT
];
73 /* AUX engines, per DDC line.
74 * Only lines with HW AUX support will be initialized */
75 struct aux_engine
*aux_engines
[GPIO_DDC_LINE_COUNT
];
77 /* For all other lines, we can use
78 * single instance of generic I2C HW engine
79 * (since in HW, there is single instance of it)
80 * or single instance of generic I2C SW engine.
81 * AUX is not supported for other lines. */
83 /* General-purpose I2C SW engine.
84 * Can be assigned dynamically to any line per transaction */
85 struct i2c_engine
*i2c_generic_sw_engine
;
87 /* General-purpose I2C generic HW engine.
88 * Can be assigned dynamically to almost any line per transaction */
89 struct i2c_engine
*i2c_generic_hw_engine
;
91 /* [anaumov] in DAL2, there is a Mutex */
93 uint32_t aux_timeout_period
;
95 /* expressed in KHz */
96 uint32_t default_i2c_sw_speed
;
97 uint32_t default_i2c_hw_speed
;
100 bool dal_i2caux_construct(
101 struct i2caux
*i2caux
,
102 struct dc_context
*ctx
);
104 void dal_i2caux_release_engine(
105 struct i2caux
*i2caux
,
106 struct engine
*engine
);
108 void dal_i2caux_destruct(
109 struct i2caux
*i2caux
);
111 void dal_i2caux_destroy(
112 struct i2caux
**ptr
);
114 struct i2c_engine
*dal_i2caux_acquire_i2c_sw_engine(
115 struct i2caux
*i2caux
,
118 struct aux_engine
*dal_i2caux_acquire_aux_engine(
119 struct i2caux
*i2caux
,