devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shunqian Zheng <zhengsq@rock-chips.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: mchehab@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	ddl@rock-chips.com, tfiga@chromium.org
Subject: Re: [PATCH v2 3/4] media: ov2685: add support for OV2685 sensor
Date: Fri, 12 Jan 2018 10:30:57 +0800	[thread overview]
Message-ID: <8f60a7f8-8471-85e8-70d3-520701edc092@rock-chips.com> (raw)
In-Reply-To: <20180103114324.za6bmg2rxuygawi4@valkosipuli.retiisi.org.uk>

[-- Attachment #1: Type: text/plain, Size: 1667 bytes --]

Hi Sakari,


On 2018年01月03日 19:43, Sakari Ailus wrote:
>> +static int ov2685_s_stream(struct v4l2_subdev *sd, int on)
>> +{
>> +	struct ov2685 *ov2685 = to_ov2685(sd);
>> +	struct i2c_client *client = ov2685->client;
>> +	int ret = 0;
>> +
>> +	mutex_lock(&ov2685->mutex);
>> +
>> +	on = !!on;
>> +	if (on == ov2685->streaming)
>> +		goto unlock_and_return;
>> +
>> +	if (on) {
>> +		/* In case these controls are set before streaming */
>> +		ov2685_set_exposure(ov2685, ov2685->exposure->val);
>> +		ov2685_set_gain(ov2685, ov2685->anal_gain->val);
>> +		ov2685_set_vts(ov2685, ov2685->vblank->val);
>> +		ov2685_enable_test_pattern(ov2685, ov2685->test_pattern->val);
> You should use __v4l2_ctrl_handler_setup() here. Or put that to the
> driver's runtime_resume function. That actually might be better.
The v3 put __v4l2_ctrl_handler_setup() to the runtime_resume callback. But
ov2685_s_stream()
    -> pm_runtime_get_sync()
        -> ov2685_runtime_resume()
             -> __v4l2_ctrl_handler_setup()
                 -> pm_runtime_get_if_in_use(), always <= 0 because 
dev->power.runtime_status != RPM_ACTIVE.

Seems like  __v4l2_ctrl_handler_setup() has to be in ov2685_s_stream().

Thanks
>> +
>> +		ret = ov2685_write_reg(client, REG_SC_CTRL_MODE,
>> +				OV2685_REG_VALUE_08BIT, SC_CTRL_MODE_STREAMING);
>> +		if (ret)
>> +			goto unlock_and_return;
>> +	} else {
>> +		ret = ov2685_write_reg(client, REG_SC_CTRL_MODE,
>> +				OV2685_REG_VALUE_08BIT, SC_CTRL_MODE_STANDBY);
>> +		if (ret)
>> +			goto unlock_and_return;
>> +	}
>> +
>> +	ov2685->streaming = on;
>> +
>> +unlock_and_return:
>> +	mutex_unlock(&ov2685->mutex);
>> +	return ret;
>> +}


[-- Attachment #2: Type: text/html, Size: 2485 bytes --]

  parent reply	other threads:[~2018-01-12  2:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-29  8:08 [PATCH v2 1/4] media: ov5695: add support for OV5695 sensor Shunqian Zheng
     [not found] ` <1514534905-21393-1-git-send-email-zhengsq-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2017-12-29  8:08   ` [PATCH v2 2/4] [media] dt/bindings: Add bindings for OV5695 Shunqian Zheng
     [not found]     ` <1514534905-21393-2-git-send-email-zhengsq-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2018-01-02  9:19       ` jacopo mondi
2018-01-02 14:25       ` Sakari Ailus
2017-12-29  8:08   ` [PATCH v2 3/4] media: ov2685: add support for OV2685 sensor Shunqian Zheng
2018-01-03 11:43     ` Sakari Ailus
2018-01-08 13:37       ` Shunqian Zheng
2018-01-08 22:23         ` Sakari Ailus
2018-01-12  2:30       ` Shunqian Zheng [this message]
     [not found]         ` <8f60a7f8-8471-85e8-70d3-520701edc092-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2018-01-31 20:44           ` Sakari Ailus
2017-12-29  8:08   ` [PATCH v2 4/4] [media] dt/bindings: Add bindings for OV2685 Shunqian Zheng
     [not found]     ` <1514534905-21393-4-git-send-email-zhengsq-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2018-01-03 12:14       ` Sakari Ailus
2018-01-02 10:09   ` [PATCH v2 1/4] media: ov5695: add support for OV5695 sensor jacopo mondi
2018-01-08 13:40     ` Shunqian Zheng
2018-01-03 14:30 ` Sakari Ailus

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=8f60a7f8-8471-85e8-70d3-520701edc092@rock-chips.com \
    --to=zhengsq@rock-chips.com \
    --cc=ddl@rock-chips.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mchehab@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@iki.fi \
    --cc=tfiga@chromium.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).