2 * Copyright 2018 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 #include <linux/delay.h>
30 #include "dce_i2c_hw.h"
31 #include "reg_helper.h"
32 #include "include/gpio_service_interface.h"
40 #define FN(reg_name, field_name) \
41 dce_i2c_hw->shifts->field_name, dce_i2c_hw->masks->field_name
43 static void execute_transaction(
44 struct dce_i2c_hw
*dce_i2c_hw
)
46 REG_UPDATE_N(SETUP
, 5,
47 FN(DC_I2C_DDC1_SETUP
, DC_I2C_DDC1_DATA_DRIVE_EN
), 0,
48 FN(DC_I2C_DDC1_SETUP
, DC_I2C_DDC1_CLK_DRIVE_EN
), 0,
49 FN(DC_I2C_DDC1_SETUP
, DC_I2C_DDC1_DATA_DRIVE_SEL
), 0,
50 FN(DC_I2C_DDC1_SETUP
, DC_I2C_DDC1_INTRA_TRANSACTION_DELAY
), 0,
51 FN(DC_I2C_DDC1_SETUP
, DC_I2C_DDC1_INTRA_BYTE_DELAY
), 0);
54 REG_UPDATE_5(DC_I2C_CONTROL
,
56 DC_I2C_SW_STATUS_RESET
, 0,
59 DC_I2C_TRANSACTION_COUNT
, dce_i2c_hw
->transaction_count
- 1);
61 /* start I2C transfer */
62 REG_UPDATE(DC_I2C_CONTROL
, DC_I2C_GO
, 1);
64 /* all transactions were executed and HW buffer became empty
65 * (even though it actually happens when status becomes DONE)
67 dce_i2c_hw
->transaction_count
= 0;
68 dce_i2c_hw
->buffer_used_bytes
= 0;
71 static enum i2c_channel_operation_result
get_channel_status(
72 struct dce_i2c_hw
*dce_i2c_hw
,
73 uint8_t *returned_bytes
)
75 uint32_t i2c_sw_status
= 0;
77 REG_GET(DC_I2C_SW_STATUS
, DC_I2C_SW_STATUS
, &i2c_sw_status
);
78 if (i2c_sw_status
== DC_I2C_STATUS__DC_I2C_STATUS_USED_BY_SW
)
79 return I2C_CHANNEL_OPERATION_ENGINE_BUSY
;
80 else if (value
& dce_i2c_hw
->masks
->DC_I2C_SW_STOPPED_ON_NACK
)
81 return I2C_CHANNEL_OPERATION_NO_RESPONSE
;
82 else if (value
& dce_i2c_hw
->masks
->DC_I2C_SW_TIMEOUT
)
83 return I2C_CHANNEL_OPERATION_TIMEOUT
;
84 else if (value
& dce_i2c_hw
->masks
->DC_I2C_SW_ABORTED
)
85 return I2C_CHANNEL_OPERATION_FAILED
;
86 else if (value
& dce_i2c_hw
->masks
->DC_I2C_SW_DONE
)
87 return I2C_CHANNEL_OPERATION_SUCCEEDED
;
90 * this is the case when HW used for communication, I2C_SW_STATUS
93 return I2C_CHANNEL_OPERATION_SUCCEEDED
;
96 static uint32_t get_hw_buffer_available_size(
97 const struct dce_i2c_hw
*dce_i2c_hw
)
99 return dce_i2c_hw
->buffer_size
-
100 dce_i2c_hw
->buffer_used_bytes
;
103 static void process_channel_reply(
104 struct dce_i2c_hw
*dce_i2c_hw
,
105 struct i2c_payload
*reply
)
107 uint32_t length
= reply
->length
;
108 uint8_t *buffer
= reply
->data
;
110 REG_SET_3(DC_I2C_DATA
, 0,
111 DC_I2C_INDEX
, dce_i2c_hw
->buffer_used_write
,
113 DC_I2C_INDEX_WRITE
, 1);
116 /* after reading the status,
117 * if the I2C operation executed successfully
118 * (i.e. DC_I2C_STATUS_DONE = 1) then the I2C controller
119 * should read data bytes from I2C circular data buffer
124 REG_GET(DC_I2C_DATA
, DC_I2C_DATA
, &i2c_data
);
125 *buffer
++ = i2c_data
;
131 static bool is_engine_available(struct dce_i2c_hw
*dce_i2c_hw
)
133 unsigned int arbitrate
;
134 unsigned int i2c_hw_status
;
136 REG_GET(HW_STATUS
, DC_I2C_DDC1_HW_STATUS
, &i2c_hw_status
);
137 if (i2c_hw_status
== DC_I2C_STATUS__DC_I2C_STATUS_USED_BY_HW
)
140 REG_GET(DC_I2C_ARBITRATION
, DC_I2C_REG_RW_CNTL_STATUS
, &arbitrate
);
141 if (arbitrate
== DC_I2C_REG_RW_CNTL_STATUS_DMCU_ONLY
)
147 static bool is_hw_busy(struct dce_i2c_hw
*dce_i2c_hw
)
149 uint32_t i2c_sw_status
= 0;
151 REG_GET(DC_I2C_SW_STATUS
, DC_I2C_SW_STATUS
, &i2c_sw_status
);
152 if (i2c_sw_status
== DC_I2C_STATUS__DC_I2C_STATUS_IDLE
)
155 if (is_engine_available(dce_i2c_hw
))
161 static bool process_transaction(
162 struct dce_i2c_hw
*dce_i2c_hw
,
163 struct i2c_request_transaction_data
*request
)
165 uint32_t length
= request
->length
;
166 uint8_t *buffer
= request
->data
;
168 bool last_transaction
= false;
171 if (is_hw_busy(dce_i2c_hw
)) {
172 request
->status
= I2C_CHANNEL_OPERATION_ENGINE_BUSY
;
176 last_transaction
= ((dce_i2c_hw
->transaction_count
== 3) ||
177 (request
->action
== DCE_I2C_TRANSACTION_ACTION_I2C_WRITE
) ||
178 (request
->action
& DCE_I2C_TRANSACTION_ACTION_I2C_READ
));
181 switch (dce_i2c_hw
->transaction_count
) {
183 REG_UPDATE_5(DC_I2C_TRANSACTION0
,
184 DC_I2C_STOP_ON_NACK0
, 1,
186 DC_I2C_RW0
, 0 != (request
->action
& DCE_I2C_TRANSACTION_ACTION_I2C_READ
),
187 DC_I2C_COUNT0
, length
,
188 DC_I2C_STOP0
, last_transaction
? 1 : 0);
191 REG_UPDATE_5(DC_I2C_TRANSACTION1
,
192 DC_I2C_STOP_ON_NACK0
, 1,
194 DC_I2C_RW0
, 0 != (request
->action
& DCE_I2C_TRANSACTION_ACTION_I2C_READ
),
195 DC_I2C_COUNT0
, length
,
196 DC_I2C_STOP0
, last_transaction
? 1 : 0);
199 REG_UPDATE_5(DC_I2C_TRANSACTION2
,
200 DC_I2C_STOP_ON_NACK0
, 1,
202 DC_I2C_RW0
, 0 != (request
->action
& DCE_I2C_TRANSACTION_ACTION_I2C_READ
),
203 DC_I2C_COUNT0
, length
,
204 DC_I2C_STOP0
, last_transaction
? 1 : 0);
207 REG_UPDATE_5(DC_I2C_TRANSACTION3
,
208 DC_I2C_STOP_ON_NACK0
, 1,
210 DC_I2C_RW0
, 0 != (request
->action
& DCE_I2C_TRANSACTION_ACTION_I2C_READ
),
211 DC_I2C_COUNT0
, length
,
212 DC_I2C_STOP0
, last_transaction
? 1 : 0);
219 /* Write the I2C address and I2C data
220 * into the hardware circular buffer, one byte per entry.
221 * As an example, the 7-bit I2C slave address for CRT monitor
222 * for reading DDC/EDID information is 0b1010001.
223 * For an I2C send operation, the LSB must be programmed to 0;
224 * for I2C receive operation, the LSB must be programmed to 1.
226 if (dce_i2c_hw
->transaction_count
== 0) {
227 value
= REG_SET_4(DC_I2C_DATA
, 0,
228 DC_I2C_DATA_RW
, false,
229 DC_I2C_DATA
, request
->address
,
231 DC_I2C_INDEX_WRITE
, 1);
232 dce_i2c_hw
->buffer_used_write
= 0;
234 value
= REG_SET_2(DC_I2C_DATA
, 0,
235 DC_I2C_DATA_RW
, false,
236 DC_I2C_DATA
, request
->address
);
238 dce_i2c_hw
->buffer_used_write
++;
240 if (!(request
->action
& DCE_I2C_TRANSACTION_ACTION_I2C_READ
)) {
242 REG_SET_2(DC_I2C_DATA
, value
,
243 DC_I2C_INDEX_WRITE
, 0,
244 DC_I2C_DATA
, *buffer
++);
245 dce_i2c_hw
->buffer_used_write
++;
250 ++dce_i2c_hw
->transaction_count
;
251 dce_i2c_hw
->buffer_used_bytes
+= length
+ 1;
253 return last_transaction
;
256 static inline void reset_hw_engine(struct dce_i2c_hw
*dce_i2c_hw
)
258 REG_UPDATE_2(DC_I2C_CONTROL
,
259 DC_I2C_SW_STATUS_RESET
, 1,
260 DC_I2C_SW_STATUS_RESET
, 1);
263 static void set_speed(
264 struct dce_i2c_hw
*dce_i2c_hw
,
267 uint32_t xtal_ref_div
= 0;
268 uint32_t prescale
= 0;
273 REG_GET(MICROSECOND_TIME_BASE_DIV
, XTAL_REF_DIV
, &xtal_ref_div
);
275 if (xtal_ref_div
== 0)
278 prescale
= ((dce_i2c_hw
->reference_frequency
* 2) / xtal_ref_div
) / speed
;
280 if (dce_i2c_hw
->masks
->DC_I2C_DDC1_START_STOP_TIMING_CNTL
)
281 REG_UPDATE_N(SPEED
, 3,
282 FN(DC_I2C_DDC1_SPEED
, DC_I2C_DDC1_PRESCALE
), prescale
,
283 FN(DC_I2C_DDC1_SPEED
, DC_I2C_DDC1_THRESHOLD
), 2,
284 FN(DC_I2C_DDC1_SPEED
, DC_I2C_DDC1_START_STOP_TIMING_CNTL
), speed
> 50 ? 2:1);
286 REG_UPDATE_N(SPEED
, 2,
287 FN(DC_I2C_DDC1_SPEED
, DC_I2C_DDC1_PRESCALE
), prescale
,
288 FN(DC_I2C_DDC1_SPEED
, DC_I2C_DDC1_THRESHOLD
), 2);
291 static bool setup_engine(
292 struct dce_i2c_hw
*dce_i2c_hw
)
294 uint32_t i2c_setup_limit
= I2C_SETUP_TIME_LIMIT_DCE
;
295 uint32_t reset_length
= 0;
297 if (dce_i2c_hw
->ctx
->dc
->debug
.enable_mem_low_power
.bits
.i2c
) {
298 if (dce_i2c_hw
->regs
->DIO_MEM_PWR_CTRL
) {
299 REG_UPDATE(DIO_MEM_PWR_CTRL
, I2C_LIGHT_SLEEP_FORCE
, 0);
300 REG_WAIT(DIO_MEM_PWR_STATUS
, I2C_MEM_PWR_STATE
, 0, 0, 5);
304 /* we have checked I2c not used by DMCU, set SW use I2C REQ to 1 to indicate SW using it*/
305 REG_UPDATE(DC_I2C_ARBITRATION
, DC_I2C_SW_USE_I2C_REG_REQ
, 1);
307 /* we have checked I2c not used by DMCU, set SW use I2C REQ to 1 to indicate SW using it*/
308 REG_UPDATE(DC_I2C_ARBITRATION
, DC_I2C_SW_USE_I2C_REG_REQ
, 1);
310 /*set SW requested I2c speed to default, if API calls in it will be override later*/
311 set_speed(dce_i2c_hw
, dce_i2c_hw
->ctx
->dc
->caps
.i2c_speed_in_khz
);
313 if (dce_i2c_hw
->setup_limit
!= 0)
314 i2c_setup_limit
= dce_i2c_hw
->setup_limit
;
316 /* Program pin select */
317 REG_UPDATE_6(DC_I2C_CONTROL
,
319 DC_I2C_SOFT_RESET
, 0,
320 DC_I2C_SEND_RESET
, 0,
321 DC_I2C_SW_STATUS_RESET
, 1,
322 DC_I2C_TRANSACTION_COUNT
, 0,
323 DC_I2C_DDC_SELECT
, dce_i2c_hw
->engine_id
);
325 /* Program time limit */
326 if (dce_i2c_hw
->send_reset_length
== 0) {
328 REG_UPDATE_N(SETUP
, 2,
329 FN(DC_I2C_DDC1_SETUP
, DC_I2C_DDC1_TIME_LIMIT
), i2c_setup_limit
,
330 FN(DC_I2C_DDC1_SETUP
, DC_I2C_DDC1_ENABLE
), 1);
332 reset_length
= dce_i2c_hw
->send_reset_length
;
333 REG_UPDATE_N(SETUP
, 3,
334 FN(DC_I2C_DDC1_SETUP
, DC_I2C_DDC1_TIME_LIMIT
), i2c_setup_limit
,
335 FN(DC_I2C_DDC1_SETUP
, DC_I2C_DDC1_SEND_RESET_LENGTH
), reset_length
,
336 FN(DC_I2C_DDC1_SETUP
, DC_I2C_DDC1_ENABLE
), 1);
338 /* Program HW priority
339 * set to High - interrupt software I2C at any time
340 * Enable restart of SW I2C that was interrupted by HW
341 * disable queuing of software while I2C is in use by HW
343 REG_UPDATE(DC_I2C_ARBITRATION
,
344 DC_I2C_NO_QUEUED_SW_GO
, 0);
349 static void release_engine(
350 struct dce_i2c_hw
*dce_i2c_hw
)
355 /* Reset HW engine */
357 uint32_t i2c_sw_status
= 0;
359 REG_GET(DC_I2C_SW_STATUS
, DC_I2C_SW_STATUS
, &i2c_sw_status
);
360 /* if used by SW, safe to reset */
361 safe_to_reset
= (i2c_sw_status
== 1);
365 REG_UPDATE_2(DC_I2C_CONTROL
,
366 DC_I2C_SOFT_RESET
, 1,
367 DC_I2C_SW_STATUS_RESET
, 1);
369 REG_UPDATE(DC_I2C_CONTROL
, DC_I2C_SW_STATUS_RESET
, 1);
370 /* HW I2c engine - clock gating feature */
371 if (!dce_i2c_hw
->engine_keep_power_up_count
)
372 REG_UPDATE_N(SETUP
, 1, FN(SETUP
, DC_I2C_DDC1_ENABLE
), 0);
374 /*for HW HDCP Ri polling failure w/a test*/
375 set_speed(dce_i2c_hw
, dce_i2c_hw
->ctx
->dc
->caps
.i2c_speed_in_khz_hdcp
);
376 /* Release I2C after reset, so HW or DMCU could use it */
377 REG_UPDATE_2(DC_I2C_ARBITRATION
, DC_I2C_SW_DONE_USING_I2C_REG
, 1,
378 DC_I2C_SW_USE_I2C_REG_REQ
, 0);
380 if (dce_i2c_hw
->ctx
->dc
->debug
.enable_mem_low_power
.bits
.i2c
) {
381 if (dce_i2c_hw
->regs
->DIO_MEM_PWR_CTRL
)
382 REG_UPDATE(DIO_MEM_PWR_CTRL
, I2C_LIGHT_SLEEP_FORCE
, 1);
386 struct dce_i2c_hw
*acquire_i2c_hw_engine(
387 struct resource_pool
*pool
,
390 uint32_t counter
= 0;
391 enum gpio_result result
;
392 struct dce_i2c_hw
*dce_i2c_hw
= NULL
;
397 if (ddc
->hw_info
.hw_supported
) {
398 enum gpio_ddc_line line
= dal_ddc_get_line(ddc
);
400 if (line
< pool
->res_cap
->num_ddc
)
401 dce_i2c_hw
= pool
->hw_i2cs
[line
];
407 if (pool
->i2c_hw_buffer_in_use
|| !is_engine_available(dce_i2c_hw
))
411 result
= dal_ddc_open(ddc
, GPIO_MODE_HARDWARE
,
412 GPIO_DDC_CONFIG_TYPE_MODE_I2C
);
414 if (result
== GPIO_RESULT_OK
)
417 /* i2c_engine is busy by VBios, lets wait and retry */
422 } while (counter
< 2);
424 if (result
!= GPIO_RESULT_OK
)
427 dce_i2c_hw
->ddc
= ddc
;
429 if (!setup_engine(dce_i2c_hw
)) {
430 release_engine(dce_i2c_hw
);
434 pool
->i2c_hw_buffer_in_use
= true;
438 enum i2c_channel_operation_result
dce_i2c_hw_engine_wait_on_operation_result(
439 struct dce_i2c_hw
*dce_i2c_hw
,
441 enum i2c_channel_operation_result expected_result
)
443 enum i2c_channel_operation_result result
;
447 return I2C_CHANNEL_OPERATION_SUCCEEDED
;
451 result
= get_channel_status(
454 if (result
!= expected_result
)
460 } while (i
< timeout
);
464 static void submit_channel_request_hw(
465 struct dce_i2c_hw
*dce_i2c_hw
,
466 struct i2c_request_transaction_data
*request
)
468 request
->status
= I2C_CHANNEL_OPERATION_SUCCEEDED
;
470 if (!process_transaction(dce_i2c_hw
, request
))
473 if (is_hw_busy(dce_i2c_hw
)) {
474 request
->status
= I2C_CHANNEL_OPERATION_ENGINE_BUSY
;
477 reset_hw_engine(dce_i2c_hw
);
479 execute_transaction(dce_i2c_hw
);
484 static uint32_t get_transaction_timeout_hw(
485 const struct dce_i2c_hw
*dce_i2c_hw
,
489 uint32_t period_timeout
;
490 uint32_t num_of_clock_stretches
;
495 period_timeout
= (1000 * TRANSACTION_TIMEOUT_IN_I2C_CLOCKS
) / speed
;
497 num_of_clock_stretches
= 1 + (length
<< 3) + 1;
498 num_of_clock_stretches
+=
499 (dce_i2c_hw
->buffer_used_bytes
<< 3) +
500 (dce_i2c_hw
->transaction_count
<< 1);
502 return period_timeout
* num_of_clock_stretches
;
505 bool dce_i2c_hw_engine_submit_payload(
506 struct dce_i2c_hw
*dce_i2c_hw
,
507 struct i2c_payload
*payload
,
508 bool middle_of_transaction
,
512 struct i2c_request_transaction_data request
;
514 uint32_t transaction_timeout
;
516 enum i2c_channel_operation_result operation_result
;
520 /* We need following:
521 * transaction length will not exceed
522 * the number of free bytes in HW buffer (minus one for address)
525 if (payload
->length
>=
526 get_hw_buffer_available_size(dce_i2c_hw
)) {
531 request
.action
= middle_of_transaction
?
532 DCE_I2C_TRANSACTION_ACTION_I2C_READ_MOT
:
533 DCE_I2C_TRANSACTION_ACTION_I2C_READ
;
535 request
.action
= middle_of_transaction
?
536 DCE_I2C_TRANSACTION_ACTION_I2C_WRITE_MOT
:
537 DCE_I2C_TRANSACTION_ACTION_I2C_WRITE
;
540 request
.address
= (uint8_t) ((payload
->address
<< 1) | !payload
->write
);
541 request
.length
= payload
->length
;
542 request
.data
= payload
->data
;
544 /* obtain timeout value before submitting request */
546 transaction_timeout
= get_transaction_timeout_hw(
547 dce_i2c_hw
, payload
->length
+ 1, speed
);
549 submit_channel_request_hw(
550 dce_i2c_hw
, &request
);
552 if ((request
.status
== I2C_CHANNEL_OPERATION_FAILED
) ||
553 (request
.status
== I2C_CHANNEL_OPERATION_ENGINE_BUSY
))
556 /* wait until transaction proceed */
558 operation_result
= dce_i2c_hw_engine_wait_on_operation_result(
561 I2C_CHANNEL_OPERATION_ENGINE_BUSY
);
563 /* update transaction status */
565 if (operation_result
== I2C_CHANNEL_OPERATION_SUCCEEDED
)
568 if (result
&& (!payload
->write
))
569 process_channel_reply(dce_i2c_hw
, payload
);
574 bool dce_i2c_submit_command_hw(
575 struct resource_pool
*pool
,
577 struct i2c_command
*cmd
,
578 struct dce_i2c_hw
*dce_i2c_hw
)
580 uint8_t index_of_payload
= 0;
583 set_speed(dce_i2c_hw
, cmd
->speed
);
587 while (index_of_payload
< cmd
->number_of_payloads
) {
588 bool mot
= (index_of_payload
!= cmd
->number_of_payloads
- 1);
590 struct i2c_payload
*payload
= cmd
->payloads
+ index_of_payload
;
592 if (!dce_i2c_hw_engine_submit_payload(
593 dce_i2c_hw
, payload
, mot
, cmd
->speed
)) {
601 pool
->i2c_hw_buffer_in_use
= false;
603 release_engine(dce_i2c_hw
);
604 dal_ddc_close(dce_i2c_hw
->ddc
);
606 dce_i2c_hw
->ddc
= NULL
;
611 void dce_i2c_hw_construct(
612 struct dce_i2c_hw
*dce_i2c_hw
,
613 struct dc_context
*ctx
,
615 const struct dce_i2c_registers
*regs
,
616 const struct dce_i2c_shift
*shifts
,
617 const struct dce_i2c_mask
*masks
)
619 dce_i2c_hw
->ctx
= ctx
;
620 dce_i2c_hw
->engine_id
= engine_id
;
621 dce_i2c_hw
->reference_frequency
= (ctx
->dc_bios
->fw_info
.pll_info
.crystal_frequency
) >> 1;
622 dce_i2c_hw
->regs
= regs
;
623 dce_i2c_hw
->shifts
= shifts
;
624 dce_i2c_hw
->masks
= masks
;
625 dce_i2c_hw
->buffer_used_bytes
= 0;
626 dce_i2c_hw
->transaction_count
= 0;
627 dce_i2c_hw
->engine_keep_power_up_count
= 1;
628 dce_i2c_hw
->default_speed
= DEFAULT_I2C_HW_SPEED
;
629 dce_i2c_hw
->send_reset_length
= 0;
630 dce_i2c_hw
->setup_limit
= I2C_SETUP_TIME_LIMIT_DCE
;
631 dce_i2c_hw
->buffer_size
= I2C_HW_BUFFER_SIZE_DCE
;
634 void dce100_i2c_hw_construct(
635 struct dce_i2c_hw
*dce_i2c_hw
,
636 struct dc_context
*ctx
,
638 const struct dce_i2c_registers
*regs
,
639 const struct dce_i2c_shift
*shifts
,
640 const struct dce_i2c_mask
*masks
)
642 dce_i2c_hw_construct(dce_i2c_hw
,
648 dce_i2c_hw
->buffer_size
= I2C_HW_BUFFER_SIZE_DCE100
;
651 void dce112_i2c_hw_construct(
652 struct dce_i2c_hw
*dce_i2c_hw
,
653 struct dc_context
*ctx
,
655 const struct dce_i2c_registers
*regs
,
656 const struct dce_i2c_shift
*shifts
,
657 const struct dce_i2c_mask
*masks
)
659 dce100_i2c_hw_construct(dce_i2c_hw
,
665 dce_i2c_hw
->default_speed
= DEFAULT_I2C_HW_SPEED_100KHZ
;
668 void dcn1_i2c_hw_construct(
669 struct dce_i2c_hw
*dce_i2c_hw
,
670 struct dc_context
*ctx
,
672 const struct dce_i2c_registers
*regs
,
673 const struct dce_i2c_shift
*shifts
,
674 const struct dce_i2c_mask
*masks
)
676 dce112_i2c_hw_construct(dce_i2c_hw
,
682 dce_i2c_hw
->setup_limit
= I2C_SETUP_TIME_LIMIT_DCN
;
685 void dcn2_i2c_hw_construct(
686 struct dce_i2c_hw
*dce_i2c_hw
,
687 struct dc_context
*ctx
,
689 const struct dce_i2c_registers
*regs
,
690 const struct dce_i2c_shift
*shifts
,
691 const struct dce_i2c_mask
*masks
)
693 dcn1_i2c_hw_construct(dce_i2c_hw
,
699 dce_i2c_hw
->send_reset_length
= I2C_SEND_RESET_LENGTH_9
;
700 if (ctx
->dc
->debug
.scl_reset_length10
)
701 dce_i2c_hw
->send_reset_length
= I2C_SEND_RESET_LENGTH_10
;