public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrey.smirnov@convergeddevices.net>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: <mchehab@redhat.com>, <sameo@linux.intel.com>,
	<broonie@opensource.wolfsonmicro.com>, <perex@perex.cz>,
	<tiwai@suse.de>, <linux-media@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 5/6] Add a V4L2 driver for SI476X MFD
Date: Fri, 23 Nov 2012 14:04:52 -0800	[thread overview]
Message-ID: <50AFF304.20802@convergeddevices.net> (raw)
In-Reply-To: <201211161602.31416.hverkuil@xs4all.nl>

On 11/16/2012 07:02 AM, Hans Verkuil wrote:
> Hi Andrey,
>
> Some more comments...
>
> On Tue October 23 2012 20:44:31 Andrey Smirnov wrote:
>> This commit adds a driver that exposes all the radio related
>> functionality of the Si476x series of chips via the V4L2 subsystem.
>>
>> Signed-off-by: Andrey Smirnov <andrey.smirnov@convergeddevices.net>
>> ---
>>  drivers/media/radio/Kconfig        |   17 +
>>  drivers/media/radio/Makefile       |    1 +
>>  drivers/media/radio/radio-si476x.c | 1549 ++++++++++++++++++++++++++++++++++++
>>  3 files changed, 1567 insertions(+)
>>  create mode 100644 drivers/media/radio/radio-si476x.c
>>
> <cut>
>
>> diff --git a/drivers/media/radio/radio-si476x.c b/drivers/media/radio/radio-si476x.c
>> new file mode 100644
>> index 0000000..c8fa90f
>> --- /dev/null
>> +++ b/drivers/media/radio/radio-si476x.c
>> @@ -0,0 +1,1549 @@
>> +#include <linux/module.h>
>> +#include <linux/delay.h>
>> +#include <linux/interrupt.h>
>> +#include <linux/slab.h>
>> +#include <linux/atomic.h>
>> +#include <linux/videodev2.h>
>> +#include <linux/mutex.h>
>> +#include <linux/debugfs.h>
>> +#include <media/v4l2-common.h>
>> +#include <media/v4l2-ioctl.h>
>> +#include <media/v4l2-ctrls.h>
>> +#include <media/v4l2-event.h>
>> +#include <media/v4l2-device.h>
>> +
>> +
>> +#include <linux/mfd/si476x-core.h>
>> +
>> +#define FM_FREQ_RANGE_LOW   64000000
>> +#define FM_FREQ_RANGE_HIGH 108000000
>> +
>> +#define AM_FREQ_RANGE_LOW    520000
>> +#define AM_FREQ_RANGE_HIGH 30000000
>> +
>> +#define PWRLINEFLTR (1 << 8)
>> +
>> +#define FREQ_MUL (10000000 / 625)
>> +
>> +#define SI476X_PHDIV_STATUS_LINK_LOCKED(status) (0b10000000 & (status))
>> +
>> +#define DRIVER_NAME "si476x-radio"
>> +#define DRIVER_CARD "SI476x AM/FM Receiver"
>> +
>> +enum si476x_freq_bands {
>> +	SI476X_BAND_FM,
>> +	SI476X_BAND_AM,
>> +};
>> +
>> +static const struct v4l2_frequency_band si476x_bands[] = {
>> +	[SI476X_BAND_FM] = {
>> +		.type		= V4L2_TUNER_RADIO,
>> +		.index		= SI476X_BAND_FM,
>> +		.capability	= V4L2_TUNER_CAP_LOW
>> +		| V4L2_TUNER_CAP_STEREO
>> +		| V4L2_TUNER_CAP_RDS
>> +		| V4L2_TUNER_CAP_RDS_BLOCK_IO
>> +		| V4L2_TUNER_CAP_FREQ_BANDS,
>> +		.rangelow	=  64 * FREQ_MUL,
>> +		.rangehigh	= 108 * FREQ_MUL,
>> +		.modulation	= V4L2_BAND_MODULATION_FM,
>> +	},
>> +	[SI476X_BAND_AM] = {
>> +		.type		= V4L2_TUNER_RADIO,
>> +		.index		= SI476X_BAND_AM,
>> +		.capability	= V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_FREQ_BANDS,
>> +		.rangelow	= 0.52 * FREQ_MUL,
>> +		.rangehigh	= 30 * FREQ_MUL,
>> +		.modulation	= V4L2_BAND_MODULATION_AM,
>> +	},
>> +};
>> +
>> +static inline bool si476x_radio_freq_is_inside_of_the_band(u32 freq, int band)
>> +{
>> +	return freq >= si476x_bands[band].rangelow &&
>> +		freq <= si476x_bands[band].rangehigh;
>> +}
>> +
>> +static inline bool si476x_radio_range_is_inside_of_the_band(u32 low, u32 high, int band)
>> +{
>> +	return low  >= si476x_bands[band].rangelow &&
>> +		high <= si476x_bands[band].rangehigh;
>> +}
>> +
>> +#define PRIVATE_CTL_IDX(x) (x - V4L2_CID_PRIVATE_BASE)
> No. The new control IDs need to be added to include/uapi/linux/v4l2-controls.h
> with unique IDs. V4L2_CID_PRIVATE_BASE must not be used anymore for new controls.
>
> Since Halli Manjunatha hasn't worked on a new version of his patch with the new
> fm controls it might be something you want to take on (I'm referring to the FM RX
> control class).

Should I move all controls there, even chip specific ones, like
SI476X_CID_HARMONICS_COUNT or SI476X_CID_DIVERSITY_MODE?



  reply	other threads:[~2012-11-23 22:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-23 18:44 [PATCH v3 0/6] Driver for Si476x series of chips Andrey Smirnov
2012-10-23 18:44 ` [PATCH v3 1/6] Add header files and Kbuild plumbing for SI476x MFD core Andrey Smirnov
2012-10-23 22:56   ` Joe Perches
2012-10-23 18:44 ` [PATCH v3 2/6] Add the main bulk of core driver for SI476x code Andrey Smirnov
2012-10-25 19:45   ` Mark Brown
2012-10-25 22:26     ` Andrey Smirnov
2012-10-27 21:31       ` Mark Brown
2012-10-28  2:08         ` Andrey Smirnov
2012-11-16 14:35   ` Hans Verkuil
2012-10-23 18:44 ` [PATCH v3 3/6] Add commands abstraction layer for SI476X MFD Andrey Smirnov
2012-10-23 18:44 ` [PATCH v3 4/6] Add chip properties handling code " Andrey Smirnov
2012-10-23 18:44 ` [PATCH v3 5/6] Add a V4L2 driver " Andrey Smirnov
2012-11-16 15:02   ` Hans Verkuil
2012-11-23 22:04     ` Andrey Smirnov [this message]
2012-11-16 22:22   ` Alexey Klimov
2012-10-23 18:44 ` [PATCH v3 6/6] Add a codec " Andrey Smirnov
2012-10-23 19:24   ` Mark Brown
2012-10-23 20:09     ` Andrey Smirnov
2013-02-11 22:39 ` [PATCH v3 0/6] Driver for Si476x series of chips Alexey Klimov

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=50AFF304.20802@convergeddevices.net \
    --to=andrey.smirnov@convergeddevices.net \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=perex@perex.cz \
    --cc=sameo@linux.intel.com \
    --cc=tiwai@suse.de \
    /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