mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Devarsh Thakkar <devarsht@ti.com>,
	Jai Luthra <jai.luthra@ideasonboard.com>
Subject: Re: [PATCH 07/19] media: i2c: ds90ub953: Speed-up I2C watchdog timer
Date: Mon, 3 Feb 2025 09:23:14 +0000	[thread overview]
Message-ID: <Z6CLAtL160DEtPfz@kekkonen.localdomain> (raw)
In-Reply-To: <7e034745-831a-4518-8c4e-003fa7773a57@ideasonboard.com>

Moi,

On Fri, Jan 24, 2025 at 03:19:32PM +0200, Tomi Valkeinen wrote:
> Hi,
> 
> On 15/01/2025 16:17, Sakari Ailus wrote:
> > Moi,
> > 
> > On Fri, Jan 10, 2025 at 11:14:07AM +0200, Tomi Valkeinen wrote:
> > > From: Jai Luthra <jai.luthra@ideasonboard.com>
> > > 
> > > On the I2C bus for remote clients (sensors), by default the watchdog
> > > timer expires in 1s. To allow for a quicker system bring-up time, TI
> > > recommends to speed it up to 50us [1].
> > > 
> > > [1]: Section 7.3.1.1 - https://www.ti.com/lit/gpn/ds90ub953-q1
> > > 
> > > Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
> > > Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> > > ---
> > >   drivers/media/i2c/ds90ub953.c | 11 +++++++++++
> > >   1 file changed, 11 insertions(+)
> > > 
> > > diff --git a/drivers/media/i2c/ds90ub953.c b/drivers/media/i2c/ds90ub953.c
> > > index 99a4852b9381..6c36980e8beb 100644
> > > --- a/drivers/media/i2c/ds90ub953.c
> > > +++ b/drivers/media/i2c/ds90ub953.c
> > > @@ -54,6 +54,10 @@
> > >   #define UB953_REG_CLKOUT_CTRL0			0x06
> > >   #define UB953_REG_CLKOUT_CTRL1			0x07
> > > +#define UB953_REG_I2C_CONTROL2			0x0a
> > > +#define UB953_REG_I2C_CONTROL2_SDA_OUTPUT_SETUP_SHIFT	4
> > > +#define UB953_REG_I2C_CONTROL2_BUS_SPEEDUP	BIT(1)
> > > +
> > >   #define UB953_REG_SCL_HIGH_TIME			0x0b
> > >   #define UB953_REG_SCL_LOW_TIME			0x0c
> > > @@ -1320,6 +1324,13 @@ static int ub953_hw_init(struct ub953_data *priv)
> > >   	if (ret)
> > >   		return ret;
> > > +	v = 0;
> > > +	v |= 1 << UB953_REG_I2C_CONTROL2_SDA_OUTPUT_SETUP_SHIFT;
> > 
> > BIT()? Or at least 1U <<< ...;.
> 
> It's a three-bit field, the value just happens to be 1. What's wrong with 1
> << SHIFT?

Shifting a signed value leads to the sign bit being undefined on some
architectures.

> 
> > 
> > > +	v |= UB953_REG_I2C_CONTROL2_BUS_SPEEDUP;
> > > +	ret = ub953_write(priv, UB953_REG_I2C_CONTROL2, v, NULL);
> > 
> > I'd just do this without a temporary variable. If you prefer to keep it, do
> > assign the first calculated value there first and remove the assignment to
> > zero.
> 
> I think we can do without.
> 
> > > +	if (ret)
> > > +		return ret;
> > 
> > No need for this.
> 
> No, but it keeps the code structure consistent and allows easy future/debug
> modifications.

Please still remove such redundancies.

-- 
Terveisin,

Sakari Ailus

  reply	other threads:[~2025-02-03  9:23 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-10  9:14 [PATCH 00/19] media: i2c: ds90ub9xx: Error handling, UB9702 improvements Tomi Valkeinen
2025-01-10  9:14 ` [PATCH 01/19] media: i2c: ds90ub953: Fix error prints Tomi Valkeinen
2025-01-10  9:14 ` [PATCH 02/19] media: i2c: ds90ub913: Align ub913_read() with other similar functions Tomi Valkeinen
2025-01-10  9:14 ` [PATCH 03/19] media: i2c: ds90ub9xx: Add err parameter to read/write funcs Tomi Valkeinen
2025-01-10  9:14 ` [PATCH 04/19] media: i2c: ds90ub960: Add error handling to multiple places Tomi Valkeinen
2025-01-10  9:14 ` [PATCH 05/19] media: i2c: ds90ub953: Add error handling to ub953_log_status() Tomi Valkeinen
2025-01-10  9:14 ` [PATCH 06/19] media: i2c: ds90ub913: Add error handling to ub913_log_status() Tomi Valkeinen
2025-01-10  9:14 ` [PATCH 07/19] media: i2c: ds90ub953: Speed-up I2C watchdog timer Tomi Valkeinen
2025-01-15 14:17   ` Sakari Ailus
2025-01-24 13:19     ` Tomi Valkeinen
2025-02-03  9:23       ` Sakari Ailus [this message]
2025-01-10  9:14 ` [PATCH 08/19] media: i2c: ds90ub960: Move UB9702 registers to a separate section Tomi Valkeinen
2025-01-10  9:14 ` [PATCH 09/19] media: i2c: ds90ub960: Add UB9702 specific registers Tomi Valkeinen
2025-01-10  9:14 ` [PATCH 10/19] media: i2c: ds90ub960: Split ub960_init_tx_ports() Tomi Valkeinen
2025-01-10  9:14 ` [PATCH 11/19] media: i2c: ds90ub960: Refresh ub960_init_tx_ports_ub9702() Tomi Valkeinen
2025-01-10  9:14 ` [PATCH 12/19] media: i2c: ds90ub960: Add RX port iteration support Tomi Valkeinen
2025-01-15 14:23   ` Sakari Ailus
2025-01-24 13:34     ` Tomi Valkeinen
2025-02-03  9:27       ` Sakari Ailus
2025-01-10  9:14 ` [PATCH 13/19] media: i2c: ds90ub960: Move all RX port init code into ub960_init_rx_ports() Tomi Valkeinen
2025-01-15 14:25   ` Sakari Ailus
2025-01-24 13:23     ` Tomi Valkeinen
2025-01-10  9:14 ` [PATCH 14/19] media: i2c: ds90ub960: Remove old ub9702 RX port init code (SQUASH) Tomi Valkeinen
2025-01-10  9:14 ` [PATCH 15/19] media: i2c: ds90ub960: Update UB9702 init sequences Tomi Valkeinen
2025-01-10  9:14 ` [PATCH 16/19] media: i2c: ds90ub960: Enable SSCG for UB9702 Tomi Valkeinen
2025-01-15 14:26   ` Sakari Ailus
2025-01-15 16:04     ` Tomi Valkeinen
2025-01-16  9:58       ` Sakari Ailus
2025-01-16 10:05         ` Tomi Valkeinen
2025-01-10  9:14 ` [PATCH 17/19] media: dt-bindings: ti,ds90ub960: Add "i2c-addr" link property Tomi Valkeinen
2025-01-11 10:31   ` Krzysztof Kozlowski
2025-01-14 11:50     ` Tomi Valkeinen
2025-01-15  8:40       ` Krzysztof Kozlowski
2025-01-15 17:19         ` Tomi Valkeinen
2025-01-15 20:25           ` Krzysztof Kozlowski
2025-01-15 15:53       ` Konstantin Ryabitsev
2025-01-15 16:09         ` Tomi Valkeinen
2025-01-15 16:46           ` Krzysztof Kozlowski
2025-01-15 17:14             ` Tomi Valkeinen
2025-01-10  9:14 ` [PATCH 18/19] media: i2c: ds90ub960: Configure serializer using back-channel Tomi Valkeinen
2025-01-15 14:29   ` Sakari Ailus
2025-01-24 13:29     ` Tomi Valkeinen
2025-02-03  9:28       ` Sakari Ailus
2025-01-10  9:14 ` [PATCH 19/19] media: i2c: ds90ub9xx: Set serializer temperature ramp Tomi Valkeinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z6CLAtL160DEtPfz@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=devarsht@ti.com \
    --cc=jai.luthra@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=tomi.valkeinen@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®