xuxinxiong | cb3745c | 2021-10-26 20:16:21 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
xuxinxiong | cb3745c | 2021-10-26 20:16:21 +0800 | [diff] [blame] | 3 | #include <dp_aux.h> |
xuxinxiong | cb3745c | 2021-10-26 20:16:21 +0800 | [diff] [blame] | 4 | |
| 5 | bool dp_aux_request_is_write(enum aux_request request) |
| 6 | { |
| 7 | switch (request) { |
| 8 | case I2C_RAW_WRITE_AND_STOP: |
| 9 | case I2C_RAW_WRITE: |
| 10 | case DPCD_WRITE: |
| 11 | return true; |
| 12 | default: |
| 13 | return false; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | enum i2c_over_aux dp_get_aux_cmd(enum aux_request request, uint32_t remaining_after_this) |
| 18 | { |
| 19 | switch (request) { |
| 20 | case I2C_RAW_WRITE_AND_STOP: |
| 21 | if (!remaining_after_this) |
| 22 | return I2C_OVER_AUX_WRITE_MOT_0; |
| 23 | /* fallthrough */ |
| 24 | case I2C_RAW_WRITE: |
| 25 | return I2C_OVER_AUX_WRITE_MOT_1; |
| 26 | case I2C_RAW_READ_AND_STOP: |
| 27 | if (!remaining_after_this) |
| 28 | return I2C_OVER_AUX_READ_MOT_0; |
| 29 | /* fallthrough */ |
| 30 | case I2C_RAW_READ: |
| 31 | return I2C_OVER_AUX_READ_MOT_1; |
| 32 | case DPCD_WRITE: |
| 33 | return NATIVE_AUX_WRITE; |
| 34 | case DPCD_READ: |
| 35 | default: |
| 36 | return NATIVE_AUX_READ; |
| 37 | } |
| 38 | } |