All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antti Palosaari <crope@iki.fi>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org,
	Mauro Carvalho Chehab <m.chehab@samsung.com>
Subject: Re: [PATCH 2/4] e4000: implement controls via v4l2 control framework
Date: Tue, 04 Feb 2014 21:41:16 +0200	[thread overview]
Message-ID: <52F1425C.6030604@iki.fi> (raw)
In-Reply-To: <52F134BD.2050201@xs4all.nl>

Moi Hans

On 04.02.2014 20:43, Hans Verkuil wrote:
> On 02/04/2014 02:39 AM, Antti Palosaari wrote:
>> Implement gain and bandwidth controls using v4l2 control framework.
>> Pointer to control handler is provided by exported symbol.
>>
>> Cc: Mauro Carvalho Chehab <m.chehab@samsung.com>
>> Cc: Hans Verkuil <hverkuil@xs4all.nl>
>> Signed-off-by: Antti Palosaari <crope@iki.fi>
>> ---
>>   drivers/media/tuners/e4000.c      | 142 +++++++++++++++++++++++++++++++++++++-
>>   drivers/media/tuners/e4000.h      |  14 ++++
>>   drivers/media/tuners/e4000_priv.h |  12 ++++
>>   3 files changed, 167 insertions(+), 1 deletion(-)

>> +static int e4000_s_ctrl(struct v4l2_ctrl *ctrl)
>> +{
>> +	struct e4000_priv *priv =
>> +			container_of(ctrl->handler, struct e4000_priv, hdl);
>> +	struct dvb_frontend *fe = priv->fe;
>> +	struct dtv_frontend_properties *c = &fe->dtv_property_cache;
>> +	int ret;
>> +	dev_dbg(&priv->client->dev,
>> +			"%s: id=%d name=%s val=%d min=%d max=%d step=%d\n",
>> +			__func__, ctrl->id, ctrl->name, ctrl->val,
>> +			ctrl->minimum, ctrl->maximum, ctrl->step);
>> +
>> +	switch (ctrl->id) {
>> +	case V4L2_CID_BANDWIDTH_AUTO:
>> +	case V4L2_CID_BANDWIDTH:
>> +		c->bandwidth_hz = priv->bandwidth->val;
>> +		ret = e4000_set_params(priv->fe);
>> +		break;
>> +	case  V4L2_CID_LNA_GAIN_AUTO:
>> +	case  V4L2_CID_LNA_GAIN:
>> +	case  V4L2_CID_MIXER_GAIN_AUTO:
>> +	case  V4L2_CID_MIXER_GAIN:
>> +	case  V4L2_CID_IF_GAIN_AUTO:
>> +	case  V4L2_CID_IF_GAIN:
>> +		ret = e4000_set_gain(priv->fe);
>
> That won't work. You need to handle each gain cluster separately. The control
> framework processes the controls one cluster at a time and takes a lock on the
> master control before calling s_ctrl. The ctrl->val field is only valid inside
> s_ctrl for the controls in the cluster, not for other controls. For other
> controls only the ctrl->cur.val field is valid.

hmm, actually it worked fine on my tests - but I think see your point. 
It likely woks as my app sets one control per call, but if you try to 
set multiple controls then it go out of sync I think.

I am going to split that gain function to three pieces then.

regards
Antti

-- 
http://palosaari.fi/

  reply	other threads:[~2014-02-04 19:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-04  1:39 [PATCH 0/4] use V4L2 control framework for DVB tuner Antti Palosaari
2014-02-04  1:39 ` [PATCH 1/4] rtl28xxu: attach SDR module later Antti Palosaari
2014-02-04  1:39 ` [PATCH 2/4] e4000: implement controls via v4l2 control framework Antti Palosaari
2014-02-04 18:43   ` Hans Verkuil
2014-02-04 19:41     ` Antti Palosaari [this message]
2014-02-04  1:39 ` [PATCH 3/4] rtl2832_sdr: use E4000 tuner controls via V4L framework Antti Palosaari
2014-02-04  1:40 ` [PATCH 4/4] e4000: remove .set_config() which was for controls Antti Palosaari

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=52F1425C.6030604@iki.fi \
    --to=crope@iki.fi \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@samsung.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.