Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af7d374a authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

[media] saa7115: initialize demod type and add the needed pads



The saa7115 driver is used on several em28xx-based devices.
Now that we're about to add MC support to em28xx, we need to
be sure that the saa711x demod will be properly mapped at MC.

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent f92c70ad
Loading
Loading
Loading
Loading
+19 −0
Original line number Original line Diff line number Diff line
@@ -46,6 +46,7 @@
#include <linux/videodev2.h>
#include <linux/videodev2.h>
#include <media/v4l2-device.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-mc.h>
#include <media/i2c/saa7115.h>
#include <media/i2c/saa7115.h>
#include <asm/div64.h>
#include <asm/div64.h>


@@ -74,6 +75,9 @@ enum saa711x_model {


struct saa711x_state {
struct saa711x_state {
	struct v4l2_subdev sd;
	struct v4l2_subdev sd;
#ifdef CONFIG_MEDIA_CONTROLLER
	struct media_pad pads[DEMOD_NUM_PADS];
#endif
	struct v4l2_ctrl_handler hdl;
	struct v4l2_ctrl_handler hdl;


	struct {
	struct {
@@ -1809,6 +1813,9 @@ static int saa711x_probe(struct i2c_client *client,
	struct saa7115_platform_data *pdata;
	struct saa7115_platform_data *pdata;
	int ident;
	int ident;
	char name[CHIP_VER_SIZE + 1];
	char name[CHIP_VER_SIZE + 1];
#if defined(CONFIG_MEDIA_CONTROLLER)
	int ret;
#endif


	/* Check if the adapter supports the needed features */
	/* Check if the adapter supports the needed features */
	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
@@ -1832,6 +1839,18 @@ static int saa711x_probe(struct i2c_client *client,
	sd = &state->sd;
	sd = &state->sd;
	v4l2_i2c_subdev_init(sd, client, &saa711x_ops);
	v4l2_i2c_subdev_init(sd, client, &saa711x_ops);


#if defined(CONFIG_MEDIA_CONTROLLER)
	state->pads[DEMOD_PAD_IF_INPUT].flags = MEDIA_PAD_FL_SINK;
	state->pads[DEMOD_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
	state->pads[DEMOD_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;

	sd->entity.function = MEDIA_ENT_F_ATV_DECODER;

	ret = media_entity_pads_init(&sd->entity, DEMOD_NUM_PADS, state->pads);
	if (ret < 0)
		return ret;
#endif

	v4l_info(client, "%s found @ 0x%x (%s)\n", name,
	v4l_info(client, "%s found @ 0x%x (%s)\n", name,
		 client->addr << 1, client->adapter->name);
		 client->addr << 1, client->adapter->name);
	hdl = &state->hdl;
	hdl = &state->hdl;