2 * Copyright(c) 2011-2016 Intel Corporation. All rights reserved.
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 (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38 #include <linux/types.h>
43 #define EDID_ADDR 0x50 /* Linux hvm EDID addr */
45 struct intel_vgpu_edid_data {
47 unsigned char edid_block[EDID_SIZE];
50 enum gmbus_cycle_type {
62 * GMBUS0-3 could be related to the EDID virtualization. Another two GMBUS
63 * registers, GMBUS4 (interrupt mask) and GMBUS5 (2 byte indes register), are
64 * not considered here. Below describes the usage of GMBUS registers that are
65 * cared by the EDID virtualization
69 * port selection. value of bit0 - bit2 corresponds to the GPIO registers.
74 * bit0 is the direction bit: 1 is read; 0 is write.
75 * bit1 - bit7 is target 7-bit address.
76 * bit16 - bit24 total byte count (ignore?)
79 * Most of bits are read only except bit 15 (IN_USE)
81 * bit0 - bit8 current byte count
82 * bit 11: hardware ready;
89 /* From hw specs, Other phases like START, ADDRESS, INDEX
90 * are invisible to GMBUS MMIO interface. So no definitions
93 enum gvt_gmbus_phase {
101 struct intel_vgpu_i2c_gmbus {
102 unsigned int total_byte_count; /* from GMBUS1 */
103 enum gmbus_cycle_type cycle_type;
104 enum gvt_gmbus_phase phase;
107 struct intel_vgpu_i2c_aux_ch {
108 bool i2c_over_aux_ch;
113 I2C_NOT_SPECIFIED = 0,
118 /* I2C sequences cannot interleave.
119 * GMBUS and AUX_CH sequences cannot interleave.
121 struct intel_vgpu_i2c_edid {
122 enum i2c_state state;
125 bool target_selected;
127 unsigned int current_edid_read;
129 struct intel_vgpu_i2c_gmbus gmbus;
130 struct intel_vgpu_i2c_aux_ch aux_ch;
133 void intel_vgpu_init_i2c_edid(struct intel_vgpu *vgpu);
135 int intel_gvt_i2c_handle_gmbus_read(struct intel_vgpu *vgpu,
136 unsigned int offset, void *p_data, unsigned int bytes);
138 int intel_gvt_i2c_handle_gmbus_write(struct intel_vgpu *vgpu,
139 unsigned int offset, void *p_data, unsigned int bytes);
141 void intel_gvt_i2c_handle_aux_ch_write(struct intel_vgpu *vgpu,
146 #endif /*_GVT_EDID_H_*/