Re: [PATCH v14 18/18] media: i2c: ds90ub953: Support non-sync mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 19, 2023 at 12:00:57PM +0300, Tomi Valkeinen wrote:
> On 16/06/2023 17:47, Andy Shevchenko wrote:
> > On Fri, Jun 16, 2023 at 04:59:22PM +0300, Tomi Valkeinen wrote:
> > > Add support for FPD-Link non-sync mode with external clock. The only
> > > thing that needs to be added is the calculation for the clkout.

...

> > > +	switch (priv->mode) {
> > > +	case UB953_MODE_SYNC:
> > > +		if (priv->hw_data->is_ub971)
> > > +			return priv->plat_data->bc_rate * 160ull;
> > > +		else
> > > +			return priv->plat_data->bc_rate / 2 * 160ull;
> > 
> > Redundant 'else'.
> 
> True, but I like the symmetry in:
> 
> if (foo)
> 	return 123;
> else
> 	return 321;

At the same time it will be symmetry with other switch-case(s). That's why the
question about fallthrough below.

> > Do I understand correctly you don't want to fallthrough because it will give
> > ±160 in the rate (depending if it's even or odd)?
> 
> Sorry, can you clarify? Fallthrough to what?

To the below case since '/ 2 * 160 ~= *80'. Why ~ because it might give
off-by-one error due to even/odd input.

> > > +	case UB953_MODE_NONSYNC_EXT:
> > > +		/* CLKIN_DIV = 1 always */
> > > +		return clk_get_rate(priv->clkin) * 80ull;

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux