From: Hermes Wu <Hermes.wu@ite.com.tw>
The aux control register command is 4 bits LSB only, adding a MACRO to get
correct operaction command.
Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver")
Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
---
drivers/gpu/drm/bridge/ite-it6505.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
index 0583abdca75f..d1f5220e04a6 100644
--- a/drivers/gpu/drm/bridge/ite-it6505.c
+++ b/drivers/gpu/drm/bridge/ite-it6505.c
@@ -329,6 +329,8 @@ enum aux_cmd_type {
CMD_AUX_GET_KSV_LIST = 0x10,
};
+#define GET_AUX_CONTROL_CODE(cmd) ((cmd) & 0x0F)
+
enum aux_cmd_reply {
REPLY_ACK,
REPLY_NACK,
@@ -1000,7 +1002,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, GET_AUX_CONTROL_CODE(cmd));
ret = it6505_aux_wait(it6505);
if (ret < 0)
--
2.34.1
Il 26/09/24 09:47, Hermes Wu ha scritto:
> From: Hermes Wu <Hermes.wu@ite.com.tw>
>
> The aux control register command is 4 bits LSB only, adding a MACRO to get
> correct operaction command.
>
> Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver")
> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
> ---
> drivers/gpu/drm/bridge/ite-it6505.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index 0583abdca75f..d1f5220e04a6 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> @@ -329,6 +329,8 @@ enum aux_cmd_type {
> CMD_AUX_GET_KSV_LIST = 0x10,
> };
>
> +#define GET_AUX_CONTROL_CODE(cmd) ((cmd) & 0x0F)
Just (cmd & 0xf) as the leading zero is meaningless.
As a out-of-scope consideration, though, this driver would really benefit from
a conversion to use bitfield macros... would be a nice cleanup.
Cheers,
Angelo
> +
> enum aux_cmd_reply {
> REPLY_ACK,
> REPLY_NACK,
> @@ -1000,7 +1002,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, GET_AUX_CONTROL_CODE(cmd));
>
> ret = it6505_aux_wait(it6505);
> if (ret < 0)
On Thu, Sep 26, 2024 at 03:47:54PM GMT, Hermes Wu wrote:
> From: Hermes Wu <Hermes.wu@ite.com.tw>
>
> The aux control register command is 4 bits LSB only, adding a MACRO to get
> correct operaction command.
Nit: AUX, add (not adding), macro.
What happens if the driver doesn't limit the field? Let me guess, the
KSV reading command is 0x10 (it should have been a part of the commit
message, BTW), so it overrides some other bits? In such a case this
either should be a part of the previous commit, or, at least, come
before it.
> Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver")
> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
> ---
> drivers/gpu/drm/bridge/ite-it6505.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c
> index 0583abdca75f..d1f5220e04a6 100644
> --- a/drivers/gpu/drm/bridge/ite-it6505.c
> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
> @@ -329,6 +329,8 @@ enum aux_cmd_type {
> CMD_AUX_GET_KSV_LIST = 0x10,
> };
>
> +#define GET_AUX_CONTROL_CODE(cmd) ((cmd) & 0x0F)
> +
> enum aux_cmd_reply {
> REPLY_ACK,
> REPLY_NACK,
> @@ -1000,7 +1002,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, GET_AUX_CONTROL_CODE(cmd));
>
> ret = it6505_aux_wait(it6505);
> if (ret < 0)
> --
> 2.34.1
>
--
With best wishes
Dmitry
>On Thu, Sep 26, 2024 at 03:47:54PM GMT, Hermes Wu wrote:
>> From: Hermes Wu <Hermes.wu@ite.com.tw>
>>
>> The aux control register command is 4 bits LSB only, adding a MACRO to
>> get correct operaction command.
>
>Nit: AUX, add (not adding), macro.
>
>What happens if the driver doesn't limit the field? Let me guess, the KSV reading command is 0x10 (it should have been a part of the commit message, BTW), so it overrides some other bits? In such a case this either should be a part of the previous commit, or, at least, come before it.
>
Nothing Happens.
The AUX control command at control register REG_AUX_CMD_REQ is 4 bits LSB only, and b[7:4] is ready only.
AUX FIFO access cannot reach all DPCD area, only KSV FIFO at DPCD(0x6802C).
The commend define use [7:4] to extend original AUX_NATIVE_READ(0) as AUX_NATIVE_READ with AUX FIFO
It should be a part of previous commit.
>> Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver")
>> Signed-off-by: Hermes Wu <Hermes.wu@ite.com.tw>
>> ---
>> drivers/gpu/drm/bridge/ite-it6505.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/bridge/ite-it6505.c
>> b/drivers/gpu/drm/bridge/ite-it6505.c
>> index 0583abdca75f..d1f5220e04a6 100644
>> --- a/drivers/gpu/drm/bridge/ite-it6505.c
>> +++ b/drivers/gpu/drm/bridge/ite-it6505.c
>> @@ -329,6 +329,8 @@ enum aux_cmd_type {
>> CMD_AUX_GET_KSV_LIST = 0x10,
>> };
>>
>> +#define GET_AUX_CONTROL_CODE(cmd) ((cmd) & 0x0F)
>> +
>> enum aux_cmd_reply {
>> REPLY_ACK,
>> REPLY_NACK,
>> @@ -1000,7 +1002,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, GET_AUX_CONTROL_CODE(cmd));
>>
>> ret = it6505_aux_wait(it6505);
>> if (ret < 0)
>> --
>> 2.34.1
>>
>
>--
>With best wishes
>Dmitry
>
BR,
Hermes
© 2016 - 2026 Red Hat, Inc.