--- zzzz-none-000/linux-3.10.107/drivers/media/v4l2-core/tuner-core.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/drivers/media/v4l2-core/tuner-core.c 2021-02-04 17:41:59.000000000 +0000 @@ -43,7 +43,7 @@ #define UNSET (-1U) -#define PREFIX (t->i2c->driver->driver.name) +#define PREFIX (t->i2c->dev.driver->name) /* * Driver modprobe parameters @@ -134,6 +134,9 @@ unsigned int type; /* chip type id */ void *config; const char *name; +#if defined(CONFIG_MEDIA_CONTROLLER) + struct media_pad pad; +#endif }; /* @@ -247,7 +250,7 @@ /** * set_type - Sets the tuner type for a given device * - * @c: i2c_client descriptoy + * @c: i2c_client descriptor * @type: type of the tuner (e. g. tuner number) * @new_mode_mask: Indicates if tuner supports TV and/or Radio * @new_config: an optional parameter used by a few tuners to adjust @@ -434,6 +437,10 @@ t->name = analog_ops->info.name; } +#ifdef CONFIG_MEDIA_CONTROLLER + t->sd.entity.name = t->name; +#endif + tuner_dbg("type set to %s\n", t->name); t->mode_mask = new_mode_mask; @@ -452,7 +459,7 @@ } tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n", - c->adapter->name, c->driver->driver.name, c->addr << 1, type, + c->adapter->name, c->dev.driver->name, c->addr << 1, type, t->mode_mask); return; @@ -556,7 +563,7 @@ int mode_mask; if (pos->i2c->adapter != adap || - strcmp(pos->i2c->driver->driver.name, "tuner")) + strcmp(pos->i2c->dev.driver->name, "tuner")) continue; mode_mask = pos->mode_mask; @@ -592,6 +599,9 @@ struct tuner *t; struct tuner *radio; struct tuner *tv; +#ifdef CONFIG_MEDIA_CONTROLLER + int ret; +#endif t = kzalloc(sizeof(struct tuner), GFP_KERNEL); if (NULL == t) @@ -601,7 +611,7 @@ t->name = "(tuner unset)"; t->type = UNSET; t->audmode = V4L2_TUNER_MODE_STEREO; - t->standby = 1; + t->standby = true; t->radio_freq = 87.5 * 16000; /* Initial freq range */ t->tv_freq = 400 * 16; /* Sets freq to VHF High - needed for some PLL's to properly start */ @@ -684,6 +694,18 @@ /* Should be just before return */ register_client: +#if defined(CONFIG_MEDIA_CONTROLLER) + t->pad.flags = MEDIA_PAD_FL_SOURCE; + t->sd.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_TUNER; + t->sd.entity.name = t->name; + + ret = media_entity_init(&t->sd.entity, 1, &t->pad, 0); + if (ret < 0) { + tuner_err("failed to initialize media entity!\n"); + kfree(t); + return -ENODEV; + } +#endif /* Sets a default mode */ if (t->mode_mask & T_ANALOG_TV) t->mode = V4L2_TUNER_ANALOG_TV; @@ -1260,7 +1282,9 @@ tuner_dbg("suspend\n"); - if (!t->standby && analog_ops->standby) + if (t->fe.ops.tuner_ops.suspend) + t->fe.ops.tuner_ops.suspend(&t->fe); + else if (!t->standby && analog_ops->standby) analog_ops->standby(&t->fe); return 0; @@ -1273,7 +1297,9 @@ tuner_dbg("resume\n"); - if (!t->standby) + if (t->fe.ops.tuner_ops.resume) + t->fe.ops.tuner_ops.resume(&t->fe); + else if (!t->standby) if (set_mode(t, t->mode) == 0) set_freq(t, 0); @@ -1301,7 +1327,6 @@ static const struct v4l2_subdev_core_ops tuner_core_ops = { .log_status = tuner_log_status, - .s_std = tuner_s_std, .s_power = tuner_s_power, }; @@ -1315,9 +1340,14 @@ .s_config = tuner_s_config, }; +static const struct v4l2_subdev_video_ops tuner_video_ops = { + .s_std = tuner_s_std, +}; + static const struct v4l2_subdev_ops tuner_ops = { .core = &tuner_core_ops, .tuner = &tuner_tuner_ops, + .video = &tuner_video_ops, }; /* @@ -1336,7 +1366,6 @@ static struct i2c_driver tuner_driver = { .driver = { - .owner = THIS_MODULE, .name = "tuner", .pm = &tuner_pm_ops, },