Skip to content

Commit 235d9bf

Browse files
Hermes Wulumag
authored andcommitted
drm/bridge: it6505: add AUX operation for HDCP KSV list read
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. Reviewed-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Hermes Wu <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Signed-off-by: Dmitry Baryshkov <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20241230-v7-upstream-v7-3-e0fdd4844703@ite.corp-partner.google.com
1 parent d0c97a5 commit 235d9bf

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

drivers/gpu/drm/bridge/ite-it6505.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/regulator/consumer.h>
2020
#include <linux/types.h>
2121
#include <linux/wait.h>
22+
#include <linux/bitfield.h>
2223

2324
#include <crypto/hash.h>
2425

@@ -126,6 +127,7 @@
126127
#define REG_AUX_OUT_DATA0 0x27
127128

128129
#define REG_AUX_CMD_REQ 0x2B
130+
#define M_AUX_REQ_CMD 0x0F
129131
#define AUX_BUSY BIT(5)
130132

131133
#define REG_AUX_DATA_0_7 0x2C
@@ -324,6 +326,9 @@ enum aux_cmd_type {
324326
CMD_AUX_NATIVE_READ = 0x0,
325327
CMD_AUX_NATIVE_WRITE = 0x5,
326328
CMD_AUX_I2C_EDID_READ = 0xB,
329+
330+
/* KSV read with AUX FIFO extend from CMD_AUX_NATIVE_READ*/
331+
CMD_AUX_GET_KSV_LIST = 0x10,
327332
};
328333

329334
enum aux_cmd_reply {
@@ -965,7 +970,8 @@ static ssize_t it6505_aux_operation(struct it6505 *it6505,
965970
it6505_set_bits(it6505, REG_AUX_CTRL, AUX_USER_MODE, AUX_USER_MODE);
966971

967972
aux_op_start:
968-
if (cmd == CMD_AUX_I2C_EDID_READ) {
973+
/* HW AUX FIFO supports only EDID and DCPD KSV FIFO area */
974+
if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) {
969975
/* AUX EDID FIFO has max length of AUX_FIFO_MAX_SIZE bytes. */
970976
size = min_t(size_t, size, AUX_FIFO_MAX_SIZE);
971977
/* Enable AUX FIFO read back and clear FIFO */
@@ -996,7 +1002,7 @@ static ssize_t it6505_aux_operation(struct it6505 *it6505,
9961002
size);
9971003

9981004
/* Aux Fire */
999-
it6505_write(it6505, REG_AUX_CMD_REQ, cmd);
1005+
it6505_write(it6505, REG_AUX_CMD_REQ, FIELD_GET(M_AUX_REQ_CMD, cmd));
10001006

10011007
ret = it6505_aux_wait(it6505);
10021008
if (ret < 0)
@@ -1030,7 +1036,7 @@ static ssize_t it6505_aux_operation(struct it6505 *it6505,
10301036
goto aux_op_start;
10311037
}
10321038

1033-
if (cmd == CMD_AUX_I2C_EDID_READ) {
1039+
if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) {
10341040
for (i = 0; i < size; i++) {
10351041
ret = it6505_read(it6505, REG_AUX_DATA_FIFO);
10361042
if (ret < 0)
@@ -1055,7 +1061,7 @@ static ssize_t it6505_aux_operation(struct it6505 *it6505,
10551061
ret = i;
10561062

10571063
aux_op_err:
1058-
if (cmd == CMD_AUX_I2C_EDID_READ) {
1064+
if (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) {
10591065
/* clear AUX FIFO */
10601066
it6505_set_bits(it6505, REG_AUX_CTRL,
10611067
AUX_EN_FIFO_READ | CLR_EDID_FIFO,
@@ -1076,7 +1082,8 @@ static ssize_t it6505_aux_do_transfer(struct it6505 *it6505,
10761082
size_t size, enum aux_cmd_reply *reply)
10771083
{
10781084
int i, ret_size, ret = 0, request_size;
1079-
int fifo_max_size = (cmd == CMD_AUX_I2C_EDID_READ) ? AUX_FIFO_MAX_SIZE : 4;
1085+
int fifo_max_size = (cmd == CMD_AUX_I2C_EDID_READ || cmd == CMD_AUX_GET_KSV_LIST) ?
1086+
AUX_FIFO_MAX_SIZE : 4;
10801087

10811088
mutex_lock(&it6505->aux_lock);
10821089
i = 0;

0 commit comments

Comments
 (0)