All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Antti Palosaari <crope@iki.fi>, linux-media@vger.kernel.org
Subject: Re: [PATCH 8/9] hackrf: add support for transmitter
Date: Mon, 08 Jun 2015 11:26:58 +0200	[thread overview]
Message-ID: <55755FE2.4070302@xs4all.nl> (raw)
In-Reply-To: <1433592188-31748-8-git-send-email-crope@iki.fi>

Hi Antti,

I've got one comment:

On 06/06/2015 02:03 PM, Antti Palosaari wrote:
> HackRF SDR device has both receiver and transmitter. There is limitation
> that receiver and transmitter cannot be used at the same time
> (half-duplex operation). That patch implements transmitter support to
> existing receiver only driver.
> 
> Cc: Hans Verkuil <hverkuil@xs4all.nl>
> Signed-off-by: Antti Palosaari <crope@iki.fi>
> ---
>  drivers/media/usb/hackrf/hackrf.c | 855 ++++++++++++++++++++++++++++----------
>  1 file changed, 640 insertions(+), 215 deletions(-)
> 
> diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c
> index 5bd291b..6ad6937 100644
> --- a/drivers/media/usb/hackrf/hackrf.c
> +++ b/drivers/media/usb/hackrf/hackrf.c
> +/*
> + * TODO: That blocks whole transmitter device open when receiver is opened and
> + * the other way around, even only streaming is not allowed. Better solution
> + * needed...

Exactly. Why not use a similar approach as for video:

Return EBUSY when the applications tries to call:

S_FREQUENCY, S_MODULATOR, S_TUNER or REQBUFS/CREATE_BUFS and the other
vb2 queue is marked 'busy'. The check for REQBUFS/CREATE_BUFS can be done
in hackrf_queue_setup.

You should always be able to open a device node in V4L2.

Regards,

	Hans

> + */
> +static int hackrf_v4l2_open(struct file *file)
> +{
> +	struct hackrf_dev *dev = video_drvdata(file);
> +	struct video_device *vdev = video_devdata(file);
> +	int ret;
> +
> +	dev_dbg(dev->dev, "\n");
> +
> +	if (mutex_lock_interruptible(&dev->v4l2_open_release_mutex))
> +		return -ERESTARTSYS;
> +
> +	if (vdev->vfl_dir == VFL_DIR_RX) {
> +		if (test_bit(TX_V4L2_DEV_OPEN, &dev->flags)) {
> +			ret = -EBUSY;
> +			goto err_mutex_unlock;
> +		}
> +	} else {
> +		if (test_bit(RX_V4L2_DEV_OPEN, &dev->flags)) {
> +			ret = -EBUSY;
> +			goto err_mutex_unlock;
> +		}
> +	}
> +
> +	ret = v4l2_fh_open(file);
> +	if (ret)
> +		goto err_mutex_unlock;
> +
> +	dev->users++;
> +
> +	if (vdev->vfl_dir == VFL_DIR_RX)
> +		set_bit(RX_V4L2_DEV_OPEN, &dev->flags);
> +	else
> +		set_bit(TX_V4L2_DEV_OPEN, &dev->flags);
> +
> +	mutex_unlock(&dev->v4l2_open_release_mutex);
> +
> +	return 0;
> +err_mutex_unlock:
> +	mutex_unlock(&dev->v4l2_open_release_mutex);
> +	return ret;
> +}


  reply	other threads:[~2015-06-08  9:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-06 12:03 [PATCH 1/9] v4l2: rename V4L2_TUNER_ADC to V4L2_TUNER_SDR Antti Palosaari
2015-06-06 12:03 ` [PATCH 2/9] v4l2: add RF gain control Antti Palosaari
2015-06-08  9:03   ` Hans Verkuil
2015-07-16  7:13     ` Antti Palosaari
2015-06-06 12:03 ` [PATCH 3/9] DocBook: document tuner " Antti Palosaari
2015-06-08  9:08   ` Hans Verkuil
2015-06-06 12:03 ` [PATCH 4/9] v4l2: add support for SDR transmitter Antti Palosaari
2015-06-08  9:10   ` Hans Verkuil
2015-06-06 12:03 ` [PATCH 5/9] DocBook: document " Antti Palosaari
2015-06-08  9:12   ` Hans Verkuil
2015-06-06 12:03 ` [PATCH 6/9] hackrf: add control for RF amplifier Antti Palosaari
2015-06-06 12:03 ` [PATCH 7/9] hackrf: switch to single function which configures everything Antti Palosaari
2015-06-06 12:03 ` [PATCH 8/9] hackrf: add support for transmitter Antti Palosaari
2015-06-08  9:26   ` Hans Verkuil [this message]
2015-07-16  7:09     ` Antti Palosaari
2015-06-06 12:03 ` [PATCH 9/9] hackrf: do not set human readable name for formats Antti Palosaari
2015-06-08  9:20   ` Hans Verkuil
2015-06-08  8:56 ` [PATCH 1/9] v4l2: rename V4L2_TUNER_ADC to V4L2_TUNER_SDR Hans Verkuil
2015-06-10 13:31   ` Mauro Carvalho Chehab

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=55755FE2.4070302@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=crope@iki.fi \
    --cc=linux-media@vger.kernel.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 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.