2009-08-08 19:45:49 +08:00
|
|
|
/*
|
|
|
|
* drivers/media/radio/radio-si4713.c
|
|
|
|
*
|
|
|
|
* Platform Driver for Silicon Labs Si4713 FM Radio Transmitter:
|
|
|
|
*
|
|
|
|
* Copyright (c) 2008 Instituto Nokia de Tecnologia - INdT
|
|
|
|
* Contact: Eduardo Valentin <eduardo.valentin@nokia.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <linux/videodev2.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 16:04:11 +08:00
|
|
|
#include <linux/slab.h>
|
2009-08-08 19:45:49 +08:00
|
|
|
#include <media/v4l2-device.h>
|
|
|
|
#include <media/v4l2-common.h>
|
|
|
|
#include <media/v4l2-ioctl.h>
|
|
|
|
#include <media/radio-si4713.h>
|
|
|
|
|
|
|
|
/* module parameters */
|
|
|
|
static int radio_nr = -1; /* radio device minor (-1 ==> auto assign) */
|
|
|
|
module_param(radio_nr, int, 0);
|
|
|
|
MODULE_PARM_DESC(radio_nr,
|
|
|
|
"Minor number for radio device (-1 ==> auto assign)");
|
|
|
|
|
2013-03-19 22:41:32 +08:00
|
|
|
MODULE_LICENSE("GPL v2");
|
2009-08-08 19:45:49 +08:00
|
|
|
MODULE_AUTHOR("Eduardo Valentin <eduardo.valentin@nokia.com>");
|
|
|
|
MODULE_DESCRIPTION("Platform driver for Si4713 FM Radio Transmitter");
|
|
|
|
MODULE_VERSION("0.0.1");
|
2013-03-19 22:41:34 +08:00
|
|
|
MODULE_ALIAS("platform:radio-si4713");
|
2009-08-08 19:45:49 +08:00
|
|
|
|
|
|
|
/* Driver state struct */
|
|
|
|
struct radio_si4713_device {
|
|
|
|
struct v4l2_device v4l2_dev;
|
|
|
|
struct video_device *radio_dev;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* radio_si4713_fops - file operations interface */
|
|
|
|
static const struct v4l2_file_operations radio_si4713_fops = {
|
|
|
|
.owner = THIS_MODULE,
|
2010-11-14 20:48:24 +08:00
|
|
|
/* Note: locking is done at the subdev level in the i2c driver. */
|
|
|
|
.unlocked_ioctl = video_ioctl2,
|
2009-08-08 19:45:49 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Video4Linux Interface */
|
|
|
|
static int radio_si4713_fill_audout(struct v4l2_audioout *vao)
|
|
|
|
{
|
|
|
|
/* TODO: check presence of audio output */
|
|
|
|
strlcpy(vao->name, "FM Modulator Audio Out", 32);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int radio_si4713_enumaudout(struct file *file, void *priv,
|
|
|
|
struct v4l2_audioout *vao)
|
|
|
|
{
|
|
|
|
return radio_si4713_fill_audout(vao);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int radio_si4713_g_audout(struct file *file, void *priv,
|
|
|
|
struct v4l2_audioout *vao)
|
|
|
|
{
|
|
|
|
int rval = radio_si4713_fill_audout(vao);
|
|
|
|
|
|
|
|
vao->index = 0;
|
|
|
|
|
|
|
|
return rval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int radio_si4713_s_audout(struct file *file, void *priv,
|
2012-09-04 23:03:49 +08:00
|
|
|
const struct v4l2_audioout *vao)
|
2009-08-08 19:45:49 +08:00
|
|
|
{
|
|
|
|
return vao->index ? -EINVAL : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* radio_si4713_querycap - query device capabilities */
|
|
|
|
static int radio_si4713_querycap(struct file *file, void *priv,
|
|
|
|
struct v4l2_capability *capability)
|
|
|
|
{
|
|
|
|
strlcpy(capability->driver, "radio-si4713", sizeof(capability->driver));
|
|
|
|
strlcpy(capability->card, "Silicon Labs Si4713 Modulator",
|
2013-03-19 22:41:31 +08:00
|
|
|
sizeof(capability->card));
|
2009-08-08 19:45:49 +08:00
|
|
|
capability->capabilities = V4L2_CAP_MODULATOR | V4L2_CAP_RDS_OUTPUT;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* radio_si4713_queryctrl - enumerate control items */
|
|
|
|
static int radio_si4713_queryctrl(struct file *file, void *priv,
|
2013-03-19 22:41:31 +08:00
|
|
|
struct v4l2_queryctrl *qc)
|
2009-08-08 19:45:49 +08:00
|
|
|
{
|
|
|
|
/* Must be sorted from low to high control ID! */
|
|
|
|
static const u32 user_ctrls[] = {
|
|
|
|
V4L2_CID_USER_CLASS,
|
|
|
|
V4L2_CID_AUDIO_MUTE,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Must be sorted from low to high control ID! */
|
|
|
|
static const u32 fmtx_ctrls[] = {
|
|
|
|
V4L2_CID_FM_TX_CLASS,
|
|
|
|
V4L2_CID_RDS_TX_DEVIATION,
|
|
|
|
V4L2_CID_RDS_TX_PI,
|
|
|
|
V4L2_CID_RDS_TX_PTY,
|
|
|
|
V4L2_CID_RDS_TX_PS_NAME,
|
|
|
|
V4L2_CID_RDS_TX_RADIO_TEXT,
|
|
|
|
V4L2_CID_AUDIO_LIMITER_ENABLED,
|
|
|
|
V4L2_CID_AUDIO_LIMITER_RELEASE_TIME,
|
|
|
|
V4L2_CID_AUDIO_LIMITER_DEVIATION,
|
|
|
|
V4L2_CID_AUDIO_COMPRESSION_ENABLED,
|
|
|
|
V4L2_CID_AUDIO_COMPRESSION_GAIN,
|
|
|
|
V4L2_CID_AUDIO_COMPRESSION_THRESHOLD,
|
|
|
|
V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME,
|
|
|
|
V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME,
|
|
|
|
V4L2_CID_PILOT_TONE_ENABLED,
|
|
|
|
V4L2_CID_PILOT_TONE_DEVIATION,
|
|
|
|
V4L2_CID_PILOT_TONE_FREQUENCY,
|
|
|
|
V4L2_CID_TUNE_PREEMPHASIS,
|
|
|
|
V4L2_CID_TUNE_POWER_LEVEL,
|
|
|
|
V4L2_CID_TUNE_ANTENNA_CAPACITOR,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
static const u32 *ctrl_classes[] = {
|
|
|
|
user_ctrls,
|
|
|
|
fmtx_ctrls,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
struct radio_si4713_device *rsdev;
|
|
|
|
|
|
|
|
rsdev = video_get_drvdata(video_devdata(file));
|
|
|
|
|
|
|
|
qc->id = v4l2_ctrl_next(ctrl_classes, qc->id);
|
|
|
|
if (qc->id == 0)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (qc->id == V4L2_CID_USER_CLASS || qc->id == V4L2_CID_FM_TX_CLASS)
|
|
|
|
return v4l2_ctrl_query_fill(qc, 0, 0, 0, 0);
|
|
|
|
|
|
|
|
return v4l2_device_call_until_err(&rsdev->v4l2_dev, 0, core,
|
2013-03-19 22:41:31 +08:00
|
|
|
queryctrl, qc);
|
2009-08-08 19:45:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* v4l2 ioctl call backs.
|
|
|
|
* we are just a wrapper for v4l2_sub_devs.
|
|
|
|
*/
|
|
|
|
static inline struct v4l2_device *get_v4l2_dev(struct file *file)
|
|
|
|
{
|
|
|
|
return &((struct radio_si4713_device *)video_drvdata(file))->v4l2_dev;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int radio_si4713_g_ext_ctrls(struct file *file, void *p,
|
2013-03-19 22:41:31 +08:00
|
|
|
struct v4l2_ext_controls *vecs)
|
2009-08-08 19:45:49 +08:00
|
|
|
{
|
|
|
|
return v4l2_device_call_until_err(get_v4l2_dev(file), 0, core,
|
2013-03-19 22:41:31 +08:00
|
|
|
g_ext_ctrls, vecs);
|
2009-08-08 19:45:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int radio_si4713_s_ext_ctrls(struct file *file, void *p,
|
2013-03-19 22:41:31 +08:00
|
|
|
struct v4l2_ext_controls *vecs)
|
2009-08-08 19:45:49 +08:00
|
|
|
{
|
|
|
|
return v4l2_device_call_until_err(get_v4l2_dev(file), 0, core,
|
2013-03-19 22:41:31 +08:00
|
|
|
s_ext_ctrls, vecs);
|
2009-08-08 19:45:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int radio_si4713_g_ctrl(struct file *file, void *p,
|
2013-03-19 22:41:31 +08:00
|
|
|
struct v4l2_control *vc)
|
2009-08-08 19:45:49 +08:00
|
|
|
{
|
|
|
|
return v4l2_device_call_until_err(get_v4l2_dev(file), 0, core,
|
2013-03-19 22:41:31 +08:00
|
|
|
g_ctrl, vc);
|
2009-08-08 19:45:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int radio_si4713_s_ctrl(struct file *file, void *p,
|
2013-03-19 22:41:31 +08:00
|
|
|
struct v4l2_control *vc)
|
2009-08-08 19:45:49 +08:00
|
|
|
{
|
|
|
|
return v4l2_device_call_until_err(get_v4l2_dev(file), 0, core,
|
2013-03-19 22:41:31 +08:00
|
|
|
s_ctrl, vc);
|
2009-08-08 19:45:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int radio_si4713_g_modulator(struct file *file, void *p,
|
2013-03-19 22:41:31 +08:00
|
|
|
struct v4l2_modulator *vm)
|
2009-08-08 19:45:49 +08:00
|
|
|
{
|
|
|
|
return v4l2_device_call_until_err(get_v4l2_dev(file), 0, tuner,
|
2013-03-19 22:41:31 +08:00
|
|
|
g_modulator, vm);
|
2009-08-08 19:45:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int radio_si4713_s_modulator(struct file *file, void *p,
|
2013-03-19 22:41:31 +08:00
|
|
|
const struct v4l2_modulator *vm)
|
2009-08-08 19:45:49 +08:00
|
|
|
{
|
|
|
|
return v4l2_device_call_until_err(get_v4l2_dev(file), 0, tuner,
|
2013-03-19 22:41:31 +08:00
|
|
|
s_modulator, vm);
|
2009-08-08 19:45:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int radio_si4713_g_frequency(struct file *file, void *p,
|
2013-03-19 22:41:31 +08:00
|
|
|
struct v4l2_frequency *vf)
|
2009-08-08 19:45:49 +08:00
|
|
|
{
|
|
|
|
return v4l2_device_call_until_err(get_v4l2_dev(file), 0, tuner,
|
2013-03-19 22:41:31 +08:00
|
|
|
g_frequency, vf);
|
2009-08-08 19:45:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int radio_si4713_s_frequency(struct file *file, void *p,
|
2013-03-19 22:41:31 +08:00
|
|
|
struct v4l2_frequency *vf)
|
2009-08-08 19:45:49 +08:00
|
|
|
{
|
|
|
|
return v4l2_device_call_until_err(get_v4l2_dev(file), 0, tuner,
|
2013-03-19 22:41:31 +08:00
|
|
|
s_frequency, vf);
|
2009-08-08 19:45:49 +08:00
|
|
|
}
|
|
|
|
|
2011-03-12 06:00:56 +08:00
|
|
|
static long radio_si4713_default(struct file *file, void *p,
|
2013-03-19 22:41:31 +08:00
|
|
|
bool valid_prio, int cmd, void *arg)
|
2009-08-08 19:45:49 +08:00
|
|
|
{
|
|
|
|
return v4l2_device_call_until_err(get_v4l2_dev(file), 0, core,
|
2013-03-19 22:41:31 +08:00
|
|
|
ioctl, cmd, arg);
|
2009-08-08 19:45:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct v4l2_ioctl_ops radio_si4713_ioctl_ops = {
|
|
|
|
.vidioc_enumaudout = radio_si4713_enumaudout,
|
|
|
|
.vidioc_g_audout = radio_si4713_g_audout,
|
|
|
|
.vidioc_s_audout = radio_si4713_s_audout,
|
|
|
|
.vidioc_querycap = radio_si4713_querycap,
|
|
|
|
.vidioc_queryctrl = radio_si4713_queryctrl,
|
|
|
|
.vidioc_g_ext_ctrls = radio_si4713_g_ext_ctrls,
|
|
|
|
.vidioc_s_ext_ctrls = radio_si4713_s_ext_ctrls,
|
|
|
|
.vidioc_g_ctrl = radio_si4713_g_ctrl,
|
|
|
|
.vidioc_s_ctrl = radio_si4713_s_ctrl,
|
|
|
|
.vidioc_g_modulator = radio_si4713_g_modulator,
|
|
|
|
.vidioc_s_modulator = radio_si4713_s_modulator,
|
|
|
|
.vidioc_g_frequency = radio_si4713_g_frequency,
|
|
|
|
.vidioc_s_frequency = radio_si4713_s_frequency,
|
|
|
|
.vidioc_default = radio_si4713_default,
|
|
|
|
};
|
|
|
|
|
|
|
|
/* radio_si4713_vdev_template - video device interface */
|
|
|
|
static struct video_device radio_si4713_vdev_template = {
|
|
|
|
.fops = &radio_si4713_fops,
|
|
|
|
.name = "radio-si4713",
|
|
|
|
.release = video_device_release,
|
|
|
|
.ioctl_ops = &radio_si4713_ioctl_ops,
|
2013-01-05 19:52:12 +08:00
|
|
|
.vfl_dir = VFL_DIR_TX,
|
2009-08-08 19:45:49 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Platform driver interface */
|
|
|
|
/* radio_si4713_pdriver_probe - probe for the device */
|
|
|
|
static int radio_si4713_pdriver_probe(struct platform_device *pdev)
|
|
|
|
{
|
|
|
|
struct radio_si4713_platform_data *pdata = pdev->dev.platform_data;
|
|
|
|
struct radio_si4713_device *rsdev;
|
|
|
|
struct i2c_adapter *adapter;
|
|
|
|
struct v4l2_subdev *sd;
|
|
|
|
int rval = 0;
|
|
|
|
|
|
|
|
if (!pdata) {
|
|
|
|
dev_err(&pdev->dev, "Cannot proceed without platform data.\n");
|
|
|
|
rval = -EINVAL;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
2012-07-31 16:21:36 +08:00
|
|
|
rsdev = devm_kzalloc(&pdev->dev, sizeof(*rsdev), GFP_KERNEL);
|
2009-08-08 19:45:49 +08:00
|
|
|
if (!rsdev) {
|
|
|
|
dev_err(&pdev->dev, "Failed to alloc video device.\n");
|
|
|
|
rval = -ENOMEM;
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
rval = v4l2_device_register(&pdev->dev, &rsdev->v4l2_dev);
|
|
|
|
if (rval) {
|
|
|
|
dev_err(&pdev->dev, "Failed to register v4l2 device.\n");
|
2012-07-31 16:21:36 +08:00
|
|
|
goto exit;
|
2009-08-08 19:45:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
adapter = i2c_get_adapter(pdata->i2c_bus);
|
|
|
|
if (!adapter) {
|
|
|
|
dev_err(&pdev->dev, "Cannot get i2c adapter %d\n",
|
2013-03-19 22:41:31 +08:00
|
|
|
pdata->i2c_bus);
|
2009-08-08 19:45:49 +08:00
|
|
|
rval = -ENODEV;
|
|
|
|
goto unregister_v4l2_dev;
|
|
|
|
}
|
|
|
|
|
2010-09-24 21:16:44 +08:00
|
|
|
sd = v4l2_i2c_new_subdev_board(&rsdev->v4l2_dev, adapter,
|
2013-03-19 22:41:31 +08:00
|
|
|
pdata->subdev_board_info, NULL);
|
2009-08-08 19:45:49 +08:00
|
|
|
if (!sd) {
|
|
|
|
dev_err(&pdev->dev, "Cannot get v4l2 subdevice\n");
|
|
|
|
rval = -ENODEV;
|
2010-09-21 16:49:42 +08:00
|
|
|
goto put_adapter;
|
2009-08-08 19:45:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
rsdev->radio_dev = video_device_alloc();
|
|
|
|
if (!rsdev->radio_dev) {
|
|
|
|
dev_err(&pdev->dev, "Failed to alloc video device.\n");
|
|
|
|
rval = -ENOMEM;
|
2010-09-21 16:49:42 +08:00
|
|
|
goto put_adapter;
|
2009-08-08 19:45:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(rsdev->radio_dev, &radio_si4713_vdev_template,
|
2013-03-19 22:41:31 +08:00
|
|
|
sizeof(radio_si4713_vdev_template));
|
2009-08-08 19:45:49 +08:00
|
|
|
video_set_drvdata(rsdev->radio_dev, rsdev);
|
|
|
|
if (video_register_device(rsdev->radio_dev, VFL_TYPE_RADIO, radio_nr)) {
|
|
|
|
dev_err(&pdev->dev, "Could not register video device.\n");
|
|
|
|
rval = -EIO;
|
|
|
|
goto free_vdev;
|
|
|
|
}
|
|
|
|
dev_info(&pdev->dev, "New device successfully probed\n");
|
|
|
|
|
|
|
|
goto exit;
|
|
|
|
|
|
|
|
free_vdev:
|
|
|
|
video_device_release(rsdev->radio_dev);
|
2010-09-21 16:49:42 +08:00
|
|
|
put_adapter:
|
|
|
|
i2c_put_adapter(adapter);
|
2009-08-08 19:45:49 +08:00
|
|
|
unregister_v4l2_dev:
|
|
|
|
v4l2_device_unregister(&rsdev->v4l2_dev);
|
|
|
|
exit:
|
|
|
|
return rval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* radio_si4713_pdriver_remove - remove the device */
|
2013-02-26 14:17:27 +08:00
|
|
|
static int radio_si4713_pdriver_remove(struct platform_device *pdev)
|
2009-08-08 19:45:49 +08:00
|
|
|
{
|
|
|
|
struct v4l2_device *v4l2_dev = platform_get_drvdata(pdev);
|
2010-09-21 16:49:42 +08:00
|
|
|
struct v4l2_subdev *sd = list_entry(v4l2_dev->subdevs.next,
|
|
|
|
struct v4l2_subdev, list);
|
|
|
|
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
2013-03-19 22:41:31 +08:00
|
|
|
struct radio_si4713_device *rsdev;
|
2009-08-08 19:45:49 +08:00
|
|
|
|
2013-03-19 22:41:31 +08:00
|
|
|
rsdev = container_of(v4l2_dev, struct radio_si4713_device, v4l2_dev);
|
2009-08-08 19:45:49 +08:00
|
|
|
video_unregister_device(rsdev->radio_dev);
|
2010-09-21 16:49:42 +08:00
|
|
|
i2c_put_adapter(client->adapter);
|
2009-08-08 19:45:49 +08:00
|
|
|
v4l2_device_unregister(&rsdev->v4l2_dev);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct platform_driver radio_si4713_pdriver = {
|
|
|
|
.driver = {
|
|
|
|
.name = "radio-si4713",
|
2013-03-19 22:41:33 +08:00
|
|
|
.owner = THIS_MODULE,
|
2009-08-08 19:45:49 +08:00
|
|
|
},
|
|
|
|
.probe = radio_si4713_pdriver_probe,
|
2013-02-26 14:17:27 +08:00
|
|
|
.remove = radio_si4713_pdriver_remove,
|
2009-08-08 19:45:49 +08:00
|
|
|
};
|
|
|
|
|
2012-01-10 14:21:49 +08:00
|
|
|
module_platform_driver(radio_si4713_pdriver);
|