Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] mt9v011: add media controller support

Create a source pad and set the media controller type to the sensor.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

+15
+15
drivers/media/i2c/mt9v011.c
··· 50 50 51 51 struct mt9v011 { 52 52 struct v4l2_subdev sd; 53 + #ifdef CONFIG_MEDIA_CONTROLLER 54 + struct media_pad pad; 55 + #endif 53 56 struct v4l2_ctrl_handler ctrls; 54 57 unsigned width, height; 55 58 unsigned xtal; ··· 496 493 u16 version; 497 494 struct mt9v011 *core; 498 495 struct v4l2_subdev *sd; 496 + #ifdef CONFIG_MEDIA_CONTROLLER 497 + int ret; 498 + #endif 499 499 500 500 /* Check if the adapter supports the needed features */ 501 501 if (!i2c_check_functionality(c->adapter, ··· 511 505 512 506 sd = &core->sd; 513 507 v4l2_i2c_subdev_init(sd, c, &mt9v011_ops); 508 + 509 + #ifdef CONFIG_MEDIA_CONTROLLER 510 + core->pad.flags = MEDIA_PAD_FL_SOURCE; 511 + sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; 512 + 513 + ret = media_entity_pads_init(&sd->entity, 1, &core->pad); 514 + if (ret < 0) 515 + return ret; 516 + #endif 514 517 515 518 /* Check if the sensor is really a MT9V011 */ 516 519 version = mt9v011_read(sd, R00_MT9V011_CHIP_VERSION);