From: Hermes Wu <Hermes.wu@ite.com.tw>
HDCP KSV list readback can choose to use AUX FIFO or
general data register.
For some DisplayPort devices, the KSV list must be read
in 5 byte boundaries.
The original AUX read command does not support these devices.
The AUX command operation control register "REG_AUX_CMD_REQ" uses b[3:0]
as AUX operacion control, and b[7:4] are status bits and read only.
To change KSV read operation uses "CMD_AUX_NATIVE_READ" from using
the data registers to using AUX FIFO.
The extended command "CMD_AUX_GET_KSV_LIST" is added as
"CMD_AUX_NATIVE_READ" with the 0x10 flag which selects AUX FIFO mode.
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
---
drivers/gpu/drm/bridge/ite-it6505.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 9747d7ccf435d536da55c6a3ff79e504b7c724f0..4e6ec1695ae45111d06026d7548d108fac9e5219 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -126,6 +126,7 @@
#define REG_AUX_OUT_DATA0 0x27
#define REG_AUX_CMD_REQ 0x2B
+#define M_AUX_REQ_CMD 0x0F
#define AUX_BUSY BIT(5)
#define REG_AUX_DATA_0_7 0x2C
@@ -324,6 +325,9 @@ enum aux_cmd_type {
CMD_AUX_NATIVE_READ = 0x0,
CMD_AUX_NATIVE_WRITE = 0x5,
CMD_AUX_I2C_EDID_READ = 0xB,
+
+ /* KSV read with AUX FIFO extend from CMD_AUX_NATIVE_READ*/
+ CMD_AUX_GET_KSV_LIST = 0x10,
};
enum aux_cmd_reply {
@@ -965,7 +969,8 @@ static ssize_t it6505_aux_operation(struct it6505 *it6505,
it6505_set_bits(it6505, REG_AUX_CTRL, AUX_USER_MODE, AUX_USER_MODE);
aux_op_start:
- if (cmd == CMD_AUX_I2C_EDID_READ) {
+ /* HW AUX FIFO supports only EDID and DCPD KSV FIFO area */
+ if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) {
/* AUX EDID FIFO has max length of AUX_FIFO_MAX_SIZE bytes. */
size = min_t(size_t, size, AUX_FIFO_MAX_SIZE);
/* Enable AUX FIFO read back and clear FIFO */
@@ -996,7 +1001,7 @@ static ssize_t it6505_aux_operation(struct it6505 *it6505,
size);
/* Aux Fire */
- it6505_write(it6505, REG_AUX_CMD_REQ, cmd);
+ it6505_write(it6505, REG_AUX_CMD_REQ, FIELD_GET(M_AUX_REQ_CMD, cmd));
ret = it6505_aux_wait(it6505);
if (ret < 0)
@@ -1030,7 +1035,7 @@ static ssize_t it6505_aux_operation(struct it6505 *it6505,
goto aux_op_start;
}
- if (cmd == CMD_AUX_I2C_EDID_READ) {
+ if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) {
for (i = 0; i < size; i++) {
ret = it6505_read(it6505, REG_AUX_DATA_FIFO);
if (ret < 0)
@@ -1055,7 +1060,7 @@ static ssize_t it6505_aux_operation(struct it6505 *it6505,
ret = i;
aux_op_err:
- if (cmd == CMD_AUX_I2C_EDID_READ) {
+ if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) {
/* clear AUX FIFO */
it6505_set_bits(it6505, REG_AUX_CTRL,
AUX_EN_FIFO_READ | CLR_EDID_FIFO,
@@ -1076,7 +1081,8 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
size_t size, enum aux_cmd_reply *reply)
{
int i, ret_size, ret = 0, request_size;
- int fifo_max_size = (cmd == CMD_AUX_I2C_EDID_READ) ? AUX_FIFO_MAX_SIZE : 4;
+ int fifo_max_size = (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) ?
+ AUX_FIFO_MAX_SIZE : 4;
mutex_lock(&it6505->aux_lock);
i = 0;
--
2.34.1
On Wed, Oct 16, 2024 at 03:54:15PM +0800, Hermes Wu via B4 Relay wrote: > From: Hermes Wu <Hermes.wu@ite.com.tw> > > HDCP KSV list readback can choose to use AUX FIFO or > general data register. > For some DisplayPort devices, the KSV list must be read > in 5 byte boundaries. > The original AUX read command does not support these devices. > > The AUX command operation control register "REG_AUX_CMD_REQ" uses b[3:0] > as AUX operacion control, and b[7:4] are status bits and read only. > To change KSV read operation uses "CMD_AUX_NATIVE_READ" from using > the data registers to using AUX FIFO. > The extended command "CMD_AUX_GET_KSV_LIST" is added as > "CMD_AUX_NATIVE_READ" with the 0x10 flag which selects AUX FIFO mode. > > Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw> > --- > drivers/gpu/drm/bridge/ite-it6505.c | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) > > @@ -996,7 +1001,7 @@ static ssize_t it6505_aux_operation(struct it6505 *it6505, > size); > > /* Aux Fire */ > - it6505_write(it6505, REG_AUX_CMD_REQ, cmd); > + it6505_write(it6505, REG_AUX_CMD_REQ, FIELD_GET(M_AUX_REQ_CMD, cmd)); This needs #include <linux/bitfield.h> Other than that Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> > > ret = it6505_aux_wait(it6505); > if (ret < 0) -- With best wishes Dmitry
Hi Hermes,
kernel test robot noticed the following build errors:
[auto build test ERROR on b8128f7815ff135f0333c1b46dcdf1543c41b860]
url: https://github.com/intel-lab-lkp/linux/commits/Hermes-Wu-via-B4-Relay/drm-bridge-it6505-Change-definition-of-AUX_FIFO_MAX_SIZE/20241016-155607
base: b8128f7815ff135f0333c1b46dcdf1543c41b860
patch link: https://lore.kernel.org/r/20241016-upstream-v6-v6-3-4d93a0c46de1%40ite.com.tw
patch subject: [PATCH v6 03/10] drm/bridge: it6505: add AUX operation for HDCP KSV list read
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20241020/202410200624.sr8sF1ya-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241020/202410200624.sr8sF1ya-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410200624.sr8sF1ya-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/gpu/drm/bridge/ite-it6505.c: In function 'it6505_aux_operation':
>> drivers/gpu/drm/bridge/ite-it6505.c:1004:47: error: implicit declaration of function 'FIELD_GET' [-Wimplicit-function-declaration]
1004 | it6505_write(it6505, REG_AUX_CMD_REQ, FIELD_GET(M_AUX_REQ_CMD, cmd));
| ^~~~~~~~~
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for GET_FREE_REGION
Depends on [n]: SPARSEMEM [=n]
Selected by [m]:
- RESOURCE_KUNIT_TEST [=m] && RUNTIME_TESTING_MENU [=y] && KUNIT [=m]
vim +/FIELD_GET +1004 drivers/gpu/drm/bridge/ite-it6505.c
956
957 static ssize_t it6505_aux_operation(struct it6505 *it6505,
958 enum aux_cmd_type cmd,
959 unsigned int address, u8 *buffer,
960 size_t size, enum aux_cmd_reply *reply)
961 {
962 int i, ret;
963 bool aux_write_check = false;
964
965 if (!it6505_get_sink_hpd_status(it6505))
966 return -EIO;
967
968 /* set AUX user mode */
969 it6505_set_bits(it6505, REG_AUX_CTRL, AUX_USER_MODE, AUX_USER_MODE);
970
971 aux_op_start:
972 /* HW AUX FIFO supports only EDID and DCPD KSV FIFO area */
973 if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) {
974 /* AUX EDID FIFO has max length of AUX_FIFO_MAX_SIZE bytes. */
975 size = min_t(size_t, size, AUX_FIFO_MAX_SIZE);
976 /* Enable AUX FIFO read back and clear FIFO */
977 it6505_set_bits(it6505, REG_AUX_CTRL,
978 AUX_EN_FIFO_READ | CLR_EDID_FIFO,
979 AUX_EN_FIFO_READ | CLR_EDID_FIFO);
980
981 it6505_set_bits(it6505, REG_AUX_CTRL,
982 AUX_EN_FIFO_READ | CLR_EDID_FIFO,
983 AUX_EN_FIFO_READ);
984 } else {
985 /* The DP AUX transmit buffer has 4 bytes. */
986 size = min_t(size_t, size, 4);
987 it6505_set_bits(it6505, REG_AUX_CTRL, AUX_NO_SEGMENT_WR,
988 AUX_NO_SEGMENT_WR);
989 }
990
991 /* Start Address[7:0] */
992 it6505_write(it6505, REG_AUX_ADR_0_7, (address >> 0) & 0xFF);
993 /* Start Address[15:8] */
994 it6505_write(it6505, REG_AUX_ADR_8_15, (address >> 8) & 0xFF);
995 /* WriteNum[3:0]+StartAdr[19:16] */
996 it6505_write(it6505, REG_AUX_ADR_16_19,
997 ((address >> 16) & 0x0F) | ((size - 1) << 4));
998
999 if (cmd == CMD_AUX_NATIVE_WRITE)
1000 regmap_bulk_write(it6505->regmap, REG_AUX_OUT_DATA0, buffer,
1001 size);
1002
1003 /* Aux Fire */
> 1004 it6505_write(it6505, REG_AUX_CMD_REQ, FIELD_GET(M_AUX_REQ_CMD, cmd));
1005
1006 ret = it6505_aux_wait(it6505);
1007 if (ret < 0)
1008 goto aux_op_err;
1009
1010 ret = it6505_read(it6505, REG_AUX_ERROR_STS);
1011 if (ret < 0)
1012 goto aux_op_err;
1013
1014 switch ((ret >> 6) & 0x3) {
1015 case 0:
1016 *reply = REPLY_ACK;
1017 break;
1018 case 1:
1019 *reply = REPLY_DEFER;
1020 ret = -EAGAIN;
1021 goto aux_op_err;
1022 case 2:
1023 *reply = REPLY_NACK;
1024 ret = -EIO;
1025 goto aux_op_err;
1026 case 3:
1027 ret = -ETIMEDOUT;
1028 goto aux_op_err;
1029 }
1030
1031 /* Read back Native Write data */
1032 if (cmd == CMD_AUX_NATIVE_WRITE) {
1033 aux_write_check = true;
1034 cmd = CMD_AUX_NATIVE_READ;
1035 goto aux_op_start;
1036 }
1037
1038 if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) {
1039 for (i = 0; i < size; i++) {
1040 ret = it6505_read(it6505, REG_AUX_DATA_FIFO);
1041 if (ret < 0)
1042 goto aux_op_err;
1043 buffer[i] = ret;
1044 }
1045 } else {
1046 for (i = 0; i < size; i++) {
1047 ret = it6505_read(it6505, REG_AUX_DATA_0_7 + i);
1048 if (ret < 0)
1049 goto aux_op_err;
1050
1051 if (aux_write_check && buffer[size - 1 - i] != ret) {
1052 ret = -EINVAL;
1053 goto aux_op_err;
1054 }
1055
1056 buffer[size - 1 - i] = ret;
1057 }
1058 }
1059
1060 ret = i;
1061
1062 aux_op_err:
1063 if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) {
1064 /* clear AUX FIFO */
1065 it6505_set_bits(it6505, REG_AUX_CTRL,
1066 AUX_EN_FIFO_READ | CLR_EDID_FIFO,
1067 AUX_EN_FIFO_READ | CLR_EDID_FIFO);
1068 it6505_set_bits(it6505, REG_AUX_CTRL,
1069 AUX_EN_FIFO_READ | CLR_EDID_FIFO, 0x00);
1070 }
1071
1072 /* Leave AUX user mode */
1073 it6505_set_bits(it6505, REG_AUX_CTRL, AUX_USER_MODE, 0);
1074
1075 return ret;
1076 }
1077
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Hi Hermes,
kernel test robot noticed the following build errors:
[auto build test ERROR on b8128f7815ff135f0333c1b46dcdf1543c41b860]
url: https://github.com/intel-lab-lkp/linux/commits/Hermes-Wu-via-B4-Relay/drm-bridge-it6505-Change-definition-of-AUX_FIFO_MAX_SIZE/20241016-155607
base: b8128f7815ff135f0333c1b46dcdf1543c41b860
patch link: https://lore.kernel.org/r/20241016-upstream-v6-v6-3-4d93a0c46de1%40ite.com.tw
patch subject: [PATCH v6 03/10] drm/bridge: it6505: add AUX operation for HDCP KSV list read
config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20241020/202410200756.KlsPLE8A-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project bfe84f7085d82d06d61c632a7bad1e692fd159e4)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241020/202410200756.KlsPLE8A-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410200756.KlsPLE8A-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from drivers/gpu/drm/bridge/ite-it6505.c:13:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:8:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:14:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
548 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
561 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
| ^
In file included from drivers/gpu/drm/bridge/ite-it6505.c:13:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:8:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:14:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
574 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
In file included from drivers/gpu/drm/bridge/ite-it6505.c:13:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:8:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:14:
In file included from arch/hexagon/include/asm/io.h:328:
include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
585 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
In file included from drivers/gpu/drm/bridge/ite-it6505.c:13:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:21:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> drivers/gpu/drm/bridge/ite-it6505.c:1004:40: error: call to undeclared function 'FIELD_GET'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
1004 | it6505_write(it6505, REG_AUX_CMD_REQ, FIELD_GET(M_AUX_REQ_CMD, cmd));
| ^
7 warnings and 1 error generated.
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for MODVERSIONS
Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y]
Selected by [y]:
- RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=y] || GCC_PLUGINS [=n]) && MODULES [=y]
WARNING: unmet direct dependencies detected for GET_FREE_REGION
Depends on [n]: SPARSEMEM [=n]
Selected by [m]:
- RESOURCE_KUNIT_TEST [=m] && RUNTIME_TESTING_MENU [=y] && KUNIT [=m]
vim +/FIELD_GET +1004 drivers/gpu/drm/bridge/ite-it6505.c
956
957 static ssize_t it6505_aux_operation(struct it6505 *it6505,
958 enum aux_cmd_type cmd,
959 unsigned int address, u8 *buffer,
960 size_t size, enum aux_cmd_reply *reply)
961 {
962 int i, ret;
963 bool aux_write_check = false;
964
965 if (!it6505_get_sink_hpd_status(it6505))
966 return -EIO;
967
968 /* set AUX user mode */
969 it6505_set_bits(it6505, REG_AUX_CTRL, AUX_USER_MODE, AUX_USER_MODE);
970
971 aux_op_start:
972 /* HW AUX FIFO supports only EDID and DCPD KSV FIFO area */
973 if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) {
974 /* AUX EDID FIFO has max length of AUX_FIFO_MAX_SIZE bytes. */
975 size = min_t(size_t, size, AUX_FIFO_MAX_SIZE);
976 /* Enable AUX FIFO read back and clear FIFO */
977 it6505_set_bits(it6505, REG_AUX_CTRL,
978 AUX_EN_FIFO_READ | CLR_EDID_FIFO,
979 AUX_EN_FIFO_READ | CLR_EDID_FIFO);
980
981 it6505_set_bits(it6505, REG_AUX_CTRL,
982 AUX_EN_FIFO_READ | CLR_EDID_FIFO,
983 AUX_EN_FIFO_READ);
984 } else {
985 /* The DP AUX transmit buffer has 4 bytes. */
986 size = min_t(size_t, size, 4);
987 it6505_set_bits(it6505, REG_AUX_CTRL, AUX_NO_SEGMENT_WR,
988 AUX_NO_SEGMENT_WR);
989 }
990
991 /* Start Address[7:0] */
992 it6505_write(it6505, REG_AUX_ADR_0_7, (address >> 0) & 0xFF);
993 /* Start Address[15:8] */
994 it6505_write(it6505, REG_AUX_ADR_8_15, (address >> 8) & 0xFF);
995 /* WriteNum[3:0]+StartAdr[19:16] */
996 it6505_write(it6505, REG_AUX_ADR_16_19,
997 ((address >> 16) & 0x0F) | ((size - 1) << 4));
998
999 if (cmd == CMD_AUX_NATIVE_WRITE)
1000 regmap_bulk_write(it6505->regmap, REG_AUX_OUT_DATA0, buffer,
1001 size);
1002
1003 /* Aux Fire */
> 1004 it6505_write(it6505, REG_AUX_CMD_REQ, FIELD_GET(M_AUX_REQ_CMD, cmd));
1005
1006 ret = it6505_aux_wait(it6505);
1007 if (ret < 0)
1008 goto aux_op_err;
1009
1010 ret = it6505_read(it6505, REG_AUX_ERROR_STS);
1011 if (ret < 0)
1012 goto aux_op_err;
1013
1014 switch ((ret >> 6) & 0x3) {
1015 case 0:
1016 *reply = REPLY_ACK;
1017 break;
1018 case 1:
1019 *reply = REPLY_DEFER;
1020 ret = -EAGAIN;
1021 goto aux_op_err;
1022 case 2:
1023 *reply = REPLY_NACK;
1024 ret = -EIO;
1025 goto aux_op_err;
1026 case 3:
1027 ret = -ETIMEDOUT;
1028 goto aux_op_err;
1029 }
1030
1031 /* Read back Native Write data */
1032 if (cmd == CMD_AUX_NATIVE_WRITE) {
1033 aux_write_check = true;
1034 cmd = CMD_AUX_NATIVE_READ;
1035 goto aux_op_start;
1036 }
1037
1038 if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) {
1039 for (i = 0; i < size; i++) {
1040 ret = it6505_read(it6505, REG_AUX_DATA_FIFO);
1041 if (ret < 0)
1042 goto aux_op_err;
1043 buffer[i] = ret;
1044 }
1045 } else {
1046 for (i = 0; i < size; i++) {
1047 ret = it6505_read(it6505, REG_AUX_DATA_0_7 + i);
1048 if (ret < 0)
1049 goto aux_op_err;
1050
1051 if (aux_write_check && buffer[size - 1 - i] != ret) {
1052 ret = -EINVAL;
1053 goto aux_op_err;
1054 }
1055
1056 buffer[size - 1 - i] = ret;
1057 }
1058 }
1059
1060 ret = i;
1061
1062 aux_op_err:
1063 if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) {
1064 /* clear AUX FIFO */
1065 it6505_set_bits(it6505, REG_AUX_CTRL,
1066 AUX_EN_FIFO_READ | CLR_EDID_FIFO,
1067 AUX_EN_FIFO_READ | CLR_EDID_FIFO);
1068 it6505_set_bits(it6505, REG_AUX_CTRL,
1069 AUX_EN_FIFO_READ | CLR_EDID_FIFO, 0x00);
1070 }
1071
1072 /* Leave AUX user mode */
1073 it6505_set_bits(it6505, REG_AUX_CTRL, AUX_USER_MODE, 0);
1074
1075 return ret;
1076 }
1077
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
© 2016 - 2026 Red Hat, Inc.