Re: [PATCH 1/8] media: ov8858: support 19.2 MHz clock and CHT gain setup
From: Sakari Ailus
Date: Thu Aug 27 2026 - 07:59:58 EST
On Thu, Aug 27, 2026 at 12:40:40PM +0300, Andy Shevchenko wrote:
> > static int ov8858_init_ctrls(struct ov8858 *ov8858)
>
> > struct v4l2_ctrl_handler *handler = &ov8858->ctrl_handler;
> > const struct ov8858_mode *mode = &ov8858_modes[0];
> > struct v4l2_fwnode_device_properties props;
> > + u32 digital_gain_default = OV8858_LONG_DIGIGAIN_DEFAULT;
> > + u32 digital_gain_max = OV8858_LONG_DIGIGAIN_MAX;
> > + u32 digital_gain_min = OV8858_LONG_DIGIGAIN_MIN;
> > s64 exposure_max, vblank_def;
> > unsigned int pixel_rate;
> > struct v4l2_ctrl *ctrl;
>
> > OV8858_LONG_GAIN_MIN, OV8858_LONG_GAIN_MAX,
> > OV8858_LONG_GAIN_STEP, OV8858_LONG_GAIN_DEFAULT);
> >
> > + if (ov8858->xvclk_rate == OV8858_XVCLK_FREQ_19_2MHZ) {
> > + digital_gain_min = OV8858_MWB_GAIN_MIN;
> > + digital_gain_max = OV8858_MWB_GAIN_MAX;
> > + digital_gain_default = OV8858_MWB_GAIN_DEFAULT;
> > + }
>
> Instead, use 'else' branch so all assignments are close to each other.
> Also possible to avoid adding local variables.
Or better yet, put them into an array and pick and index based on the
frequency of the clock.
--
Sakari Ailus