[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <658f943f-f410-fb83-03f3-527c7ddab00f@roeck-us.net>
Date: Thu, 21 Jul 2022 07:31:09 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Gene Chen <gene.chen.richtek@...il.com>,
heikki.krogerus@...ux.intel.com, gregkh@...uxfoundation.org,
robh+dt@...nel.org, krzysztof.kozlowski+dt@...aro.org
Cc: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org, gene_chen@...htek.com,
cy_huang@...htek.com
Subject: Re: [PATCH v2 2/6] usb: typec: tcpci_rt1711h: Fix vendor setting when
set vconn
On 7/20/22 23:11, Gene Chen wrote:
> From: Gene Chen <gene_chen@...htek.com>
>
> replace overwrite whole register with update bits
>
> Signed-off-by: Gene Chen <gene_chen@...htek.com>
> ---
> drivers/usb/typec/tcpm/tcpci_rt1711h.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpci_rt1711h.c b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> index b56a0880a044..3309ceace2b2 100644
> --- a/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> +++ b/drivers/usb/typec/tcpm/tcpci_rt1711h.c
> @@ -23,6 +23,7 @@
> #define RT1711H_RTCTRL8_SET(ck300, ship_off, auto_idle, tout) \
> (((ck300) << 7) | ((ship_off) << 5) | \
> ((auto_idle) << 3) | ((tout) & 0x07))
> +#define RT1711H_AUTOIDLEEN_MASK BIT(3)
Simple RT1711H_AUTOIDLEEN would be sufficient. Also, when using BIT(),
include the necessary include file.
>
> #define RT1711H_RTCTRL11 0x9E
>
> @@ -109,8 +110,8 @@ static int rt1711h_set_vconn(struct tcpci *tcpci, struct tcpci_data *tdata,
> {
> struct rt1711h_chip *chip = tdata_to_rt1711h(tdata);
>
> - return rt1711h_write8(chip, RT1711H_RTCTRL8,
> - RT1711H_RTCTRL8_SET(0, 1, !enable, 2));
> + return regmap_update_bits(chip->data.regmap, RT1711H_RTCTRL8,
> + RT1711H_AUTOIDLEEN_MASK, enable ? 0 : 0xFF);
I would suggest
return regmap_update_bits(chip->data.regmap, RT1711H_RTCTRL8,
RT1711H_AUTOIDLEEN, enable ? 0 : RT1711H_AUTOIDLEEN);
to avoid confusion why 0xFF is used.
Thanks,
Guenter
> }
>
> static int rt1711h_start_drp_toggling(struct tcpci *tcpci,
Powered by blists - more mailing lists