linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Rui Miguel Silva <rui.silva@linaro.org>
Cc: mchehab@kernel.org, hverkuil@xs4all.nl,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Ryan Harkin <ryan.harkin@linaro.org>
Subject: Re: [PATCH v2 2/2] media: ov2680: Add Omnivision OV2680 sensor driver
Date: Tue, 13 Mar 2018 13:42:17 +0200	[thread overview]
Message-ID: <20180313114216.vmqmcrdkfz64aedv@paasikivi.fi.intel.com> (raw)
In-Reply-To: <m3r2ootecu.fsf@linaro.org>

On Tue, Mar 13, 2018 at 11:16:33AM +0000, Rui Miguel Silva wrote:
...
> > > +static int ov2680_gain_set(struct ov2680_dev *sensor, bool
> > > auto_gain)
> > > +{
> > > +	struct ov2680_ctrls *ctrls = &sensor->ctrls;
> > > +	u32 gain;
> > > +	int ret;
> > > +
> > > +	ret = ov2680_mod_reg(sensor, OV2680_REG_R_MANUAL, BIT(1),
> > > +			     auto_gain ? 0 : BIT(1));
> > > +	if (ret < 0)
> > > +		return ret;
> > > +
> > > +	if (auto_gain || !ctrls->gain->is_new)
> > > +		return 0;
> > > +
> > > +	gain = ctrls->gain->val;
> > > +
> > > +	ret = ov2680_write_reg16(sensor, OV2680_REG_GAIN_PK, gain);
> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +static int ov2680_gain_get(struct ov2680_dev *sensor)
> > > +{
> > > +	u32 gain;
> > > +	int ret;
> > > +
> > > +	ret = ov2680_read_reg16(sensor, OV2680_REG_GAIN_PK, &gain);
> > > +	if (ret)
> > > +		return ret;
> > > +
> > > +	return gain;
> > > +}
> > > +
> > > +static int ov2680_auto_gain_enable(struct ov2680_dev *sensor)
> > > +{
> > > +	return ov2680_gain_set(sensor, true);
> > 
> > Just call ov2780_gain_set() in the caller.
> 
> Here if you do not mind I would like to have it this way, on the caller
> side makes explicit that we are disabling/enabling the auto gain,
> instead of going and search what that bool parameter means.
> 
> but, if you do mind... ;)

How about renaming that function as e.g. ov2680_autogain_set()? That's what
it does, doesn't it?

Right now you have these functions doing nothing really useful, cluttering
up the code.

...

> > > +static const struct i2c_device_id ov2680_id[] = {
> > > +	{"ov2680", 0},
> > > +	{ },
> > 
> > You can remove the i2c_device_id table if you use the probe_new callback
> > (instead of probe) below.
> 
> Well this one was hard to debug, so removing the device id table made
> the module not to be auto loaded, and after some debug I found the root
> cause and it looks it is addressed by this [0]. With that patch removing
> the device_id and use probe_new works as expected.
> 
> I will be sending v3 soon.

Great, thanks!

-- 
Sakari Ailus
sakari.ailus@linux.intel.com

      reply	other threads:[~2018-03-13 11:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28 15:27 [PATCH v2 0/2] media: Introduce Omnivision OV2680 driver Rui Miguel Silva
2018-02-28 15:27 ` [PATCH v2 1/2] media: ov2680: dt: Add bindings for OV2680 Rui Miguel Silva
2018-03-06  1:28   ` Rob Herring
2018-02-28 15:27 ` [PATCH v2 2/2] media: ov2680: Add Omnivision OV2680 sensor driver Rui Miguel Silva
2018-03-09  9:21   ` Sakari Ailus
2018-03-13 11:16     ` Rui Miguel Silva
2018-03-13 11:42       ` Sakari Ailus [this message]

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=20180313114216.vmqmcrdkfz64aedv@paasikivi.fi.intel.com \
    --to=sakari.ailus@linux.intel.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rui.silva@linaro.org \
    --cc=ryan.harkin@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).