[media] si2157: register as a tuner entity
As this tuner doesn't use the usual subdev interface, we need to register it manually. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>hifive-unleashed-5.1
parent
08f4920051
commit
8b0a81c733
|
@ -403,7 +403,7 @@ err:
|
||||||
}
|
}
|
||||||
|
|
||||||
static int si2157_probe(struct i2c_client *client,
|
static int si2157_probe(struct i2c_client *client,
|
||||||
const struct i2c_device_id *id)
|
const struct i2c_device_id *id)
|
||||||
{
|
{
|
||||||
struct si2157_config *cfg = client->dev.platform_data;
|
struct si2157_config *cfg = client->dev.platform_data;
|
||||||
struct dvb_frontend *fe = cfg->fe;
|
struct dvb_frontend *fe = cfg->fe;
|
||||||
|
@ -438,6 +438,31 @@ static int si2157_probe(struct i2c_client *client,
|
||||||
memcpy(&fe->ops.tuner_ops, &si2157_ops, sizeof(struct dvb_tuner_ops));
|
memcpy(&fe->ops.tuner_ops, &si2157_ops, sizeof(struct dvb_tuner_ops));
|
||||||
fe->tuner_priv = client;
|
fe->tuner_priv = client;
|
||||||
|
|
||||||
|
#ifdef CONFIG_MEDIA_CONTROLLER
|
||||||
|
if (cfg->mdev) {
|
||||||
|
dev->mdev = cfg->mdev;
|
||||||
|
|
||||||
|
dev->ent.name = KBUILD_MODNAME;
|
||||||
|
dev->ent.function = MEDIA_ENT_F_TUNER;
|
||||||
|
|
||||||
|
dev->pad[TUNER_PAD_RF_INPUT].flags = MEDIA_PAD_FL_SINK;
|
||||||
|
dev->pad[TUNER_PAD_OUTPUT].flags = MEDIA_PAD_FL_SOURCE;
|
||||||
|
dev->pad[TUNER_PAD_AUD_OUT].flags = MEDIA_PAD_FL_SOURCE;
|
||||||
|
|
||||||
|
ret = media_entity_pads_init(&dev->ent, TUNER_NUM_PADS,
|
||||||
|
&dev->pad[0]);
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
goto err_kfree;
|
||||||
|
|
||||||
|
ret = media_device_register_entity(cfg->mdev, &dev->ent);
|
||||||
|
if (ret) {
|
||||||
|
media_entity_cleanup(&dev->ent);
|
||||||
|
goto err_kfree;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
dev_info(&client->dev, "Silicon Labs %s successfully attached\n",
|
dev_info(&client->dev, "Silicon Labs %s successfully attached\n",
|
||||||
dev->chiptype == SI2157_CHIPTYPE_SI2146 ?
|
dev->chiptype == SI2157_CHIPTYPE_SI2146 ?
|
||||||
"Si2146" : "Si2147/2148/2157/2158");
|
"Si2146" : "Si2147/2148/2157/2158");
|
||||||
|
@ -461,6 +486,11 @@ static int si2157_remove(struct i2c_client *client)
|
||||||
/* stop statistics polling */
|
/* stop statistics polling */
|
||||||
cancel_delayed_work_sync(&dev->stat_work);
|
cancel_delayed_work_sync(&dev->stat_work);
|
||||||
|
|
||||||
|
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
|
||||||
|
if (dev->mdev)
|
||||||
|
media_device_unregister_entity(&dev->ent);
|
||||||
|
#endif
|
||||||
|
|
||||||
memset(&fe->ops.tuner_ops, 0, sizeof(struct dvb_tuner_ops));
|
memset(&fe->ops.tuner_ops, 0, sizeof(struct dvb_tuner_ops));
|
||||||
fe->tuner_priv = NULL;
|
fe->tuner_priv = NULL;
|
||||||
kfree(dev);
|
kfree(dev);
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#define SI2157_H
|
#define SI2157_H
|
||||||
|
|
||||||
#include <linux/kconfig.h>
|
#include <linux/kconfig.h>
|
||||||
|
#include <media/media-device.h>
|
||||||
#include "dvb_frontend.h"
|
#include "dvb_frontend.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -30,6 +31,10 @@ struct si2157_config {
|
||||||
*/
|
*/
|
||||||
struct dvb_frontend *fe;
|
struct dvb_frontend *fe;
|
||||||
|
|
||||||
|
#if defined(CONFIG_MEDIA_CONTROLLER)
|
||||||
|
struct media_device *mdev;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Spectral Inversion
|
* Spectral Inversion
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#define SI2157_PRIV_H
|
#define SI2157_PRIV_H
|
||||||
|
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
|
#include <media/v4l2-mc.h>
|
||||||
#include "si2157.h"
|
#include "si2157.h"
|
||||||
|
|
||||||
/* state struct */
|
/* state struct */
|
||||||
|
@ -31,6 +32,13 @@ struct si2157_dev {
|
||||||
u8 if_port;
|
u8 if_port;
|
||||||
u32 if_frequency;
|
u32 if_frequency;
|
||||||
struct delayed_work stat_work;
|
struct delayed_work stat_work;
|
||||||
|
|
||||||
|
#if defined(CONFIG_MEDIA_CONTROLLER)
|
||||||
|
struct media_device *mdev;
|
||||||
|
struct media_entity ent;
|
||||||
|
struct media_pad pad[TUNER_NUM_PADS];
|
||||||
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define SI2157_CHIPTYPE_SI2157 0
|
#define SI2157_CHIPTYPE_SI2157 0
|
||||||
|
|
Loading…
Reference in New Issue