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

media: i2c: Drop ifdeffery from sensor drivers

Since commit 7d3c7d2a2914 ("media: i2c: Add a camera sensor top level
menu") the CONFIG_MEDIA_CONTROLLER and CONFIG_VIDEO_V4L2_SUBDEV_API are
selected by the top-level VIDEO_CAMERA_SENSOR menu.

Remove all ifdefferies from camera sensor drivers to simplify the code.

Compile-tested only.

Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Jacopo Mondi and committed by
Hans Verkuil
b4e9a2d2 d1560d57

+5 -133
+1 -12
drivers/media/i2c/mt9m111.c
··· 244 244 bool is_streaming; 245 245 /* user point of view - 0: falling 1: rising edge */ 246 246 unsigned int pclk_sample:1; 247 - #ifdef CONFIG_MEDIA_CONTROLLER 248 247 struct media_pad pad; 249 - #endif 250 248 }; 251 249 252 250 static const struct mt9m111_mode_info mt9m111_mode_data[MT9M111_NUM_MODES] = { ··· 525 527 return -EINVAL; 526 528 527 529 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 528 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 529 530 mf = v4l2_subdev_get_try_format(sd, sd_state, format->pad); 530 531 format->format = *mf; 531 532 return 0; 532 - #else 533 - return -EINVAL; 534 - #endif 535 533 } 536 534 537 535 mf->width = mt9m111->width; ··· 1114 1120 static int mt9m111_init_cfg(struct v4l2_subdev *sd, 1115 1121 struct v4l2_subdev_state *sd_state) 1116 1122 { 1117 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1118 1123 struct v4l2_mbus_framefmt *format = 1119 1124 v4l2_subdev_get_try_format(sd, sd_state, 0); 1120 1125 ··· 1125 1132 format->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; 1126 1133 format->quantization = V4L2_QUANTIZATION_DEFAULT; 1127 1134 format->xfer_func = V4L2_XFER_FUNC_DEFAULT; 1128 - #endif 1135 + 1129 1136 return 0; 1130 1137 } 1131 1138 ··· 1308 1315 return ret; 1309 1316 } 1310 1317 1311 - #ifdef CONFIG_MEDIA_CONTROLLER 1312 1318 mt9m111->pad.flags = MEDIA_PAD_FL_SOURCE; 1313 1319 mt9m111->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR; 1314 1320 ret = media_entity_pads_init(&mt9m111->subdev.entity, 1, &mt9m111->pad); 1315 1321 if (ret < 0) 1316 1322 goto out_hdlfree; 1317 - #endif 1318 1323 1319 1324 mt9m111->current_mode = &mt9m111_mode_data[MT9M111_MODE_SXGA_15FPS]; 1320 1325 mt9m111->frame_interval.numerator = 1; ··· 1341 1350 return 0; 1342 1351 1343 1352 out_entityclean: 1344 - #ifdef CONFIG_MEDIA_CONTROLLER 1345 1353 media_entity_cleanup(&mt9m111->subdev.entity); 1346 1354 out_hdlfree: 1347 - #endif 1348 1355 v4l2_ctrl_handler_free(&mt9m111->hdl); 1349 1356 1350 1357 return ret;
-6
drivers/media/i2c/mt9v011.c
··· 49 49 50 50 struct mt9v011 { 51 51 struct v4l2_subdev sd; 52 - #ifdef CONFIG_MEDIA_CONTROLLER 53 52 struct media_pad pad; 54 - #endif 55 53 struct v4l2_ctrl_handler ctrls; 56 54 unsigned width, height; 57 55 unsigned xtal; ··· 481 483 u16 version; 482 484 struct mt9v011 *core; 483 485 struct v4l2_subdev *sd; 484 - #ifdef CONFIG_MEDIA_CONTROLLER 485 486 int ret; 486 - #endif 487 487 488 488 /* Check if the adapter supports the needed features */ 489 489 if (!i2c_check_functionality(c->adapter, ··· 495 499 sd = &core->sd; 496 500 v4l2_i2c_subdev_init(sd, c, &mt9v011_ops); 497 501 498 - #ifdef CONFIG_MEDIA_CONTROLLER 499 502 core->pad.flags = MEDIA_PAD_FL_SOURCE; 500 503 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; 501 504 502 505 ret = media_entity_pads_init(&sd->entity, 1, &core->pad); 503 506 if (ret < 0) 504 507 return ret; 505 - #endif 506 508 507 509 /* Check if the sensor is really a MT9V011 */ 508 510 version = mt9v011_read(sd, R00_MT9V011_CHIP_VERSION);
-14
drivers/media/i2c/mt9v111.c
··· 121 121 u8 addr_space; 122 122 123 123 struct v4l2_subdev sd; 124 - #if IS_ENABLED(CONFIG_MEDIA_CONTROLLER) 125 124 struct media_pad pad; 126 - #endif 127 125 128 126 struct v4l2_ctrl *auto_awb; 129 127 struct v4l2_ctrl *auto_exp; ··· 795 797 { 796 798 switch (which) { 797 799 case V4L2_SUBDEV_FORMAT_TRY: 798 - #if IS_ENABLED(CONFIG_VIDEO_V4L2_SUBDEV_API) 799 800 return v4l2_subdev_get_try_format(&mt9v111->sd, sd_state, pad); 800 - #else 801 - return &sd_state->pads->try_fmt; 802 - #endif 803 801 case V4L2_SUBDEV_FORMAT_ACTIVE: 804 802 return &mt9v111->fmt; 805 803 default: ··· 981 987 .pad = &mt9v111_pad_ops, 982 988 }; 983 989 984 - #if IS_ENABLED(CONFIG_MEDIA_CONTROLLER) 985 990 static const struct media_entity_operations mt9v111_subdev_entity_ops = { 986 991 .link_validate = v4l2_subdev_link_validate, 987 992 }; 988 - #endif 989 993 990 994 /* --- V4L2 ctrl --- */ 991 995 static int mt9v111_s_ctrl(struct v4l2_ctrl *ctrl) ··· 1195 1203 1196 1204 v4l2_i2c_subdev_init(&mt9v111->sd, client, &mt9v111_ops); 1197 1205 1198 - #if IS_ENABLED(CONFIG_MEDIA_CONTROLLER) 1199 1206 mt9v111->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 1200 1207 mt9v111->sd.entity.ops = &mt9v111_subdev_entity_ops; 1201 1208 mt9v111->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; ··· 1203 1212 ret = media_entity_pads_init(&mt9v111->sd.entity, 1, &mt9v111->pad); 1204 1213 if (ret) 1205 1214 goto error_free_entity; 1206 - #endif 1207 1215 1208 1216 ret = mt9v111_chip_probe(mt9v111); 1209 1217 if (ret) ··· 1215 1225 return 0; 1216 1226 1217 1227 error_free_entity: 1218 - #if IS_ENABLED(CONFIG_MEDIA_CONTROLLER) 1219 1228 media_entity_cleanup(&mt9v111->sd.entity); 1220 - #endif 1221 1229 1222 1230 error_free_ctrls: 1223 1231 v4l2_ctrl_handler_free(&mt9v111->ctrls); ··· 1233 1245 1234 1246 v4l2_async_unregister_subdev(sd); 1235 1247 1236 - #if IS_ENABLED(CONFIG_MEDIA_CONTROLLER) 1237 1248 media_entity_cleanup(&sd->entity); 1238 - #endif 1239 1249 1240 1250 v4l2_ctrl_handler_free(&mt9v111->ctrls); 1241 1251
+1 -10
drivers/media/i2c/ov2640.c
··· 293 293 294 294 struct ov2640_priv { 295 295 struct v4l2_subdev subdev; 296 - #if defined(CONFIG_MEDIA_CONTROLLER) 297 296 struct media_pad pad; 298 - #endif 299 297 struct v4l2_ctrl_handler hdl; 300 298 u32 cfmt_code; 301 299 struct clk *clk; ··· 920 922 return -EINVAL; 921 923 922 924 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 923 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 924 925 mf = v4l2_subdev_get_try_format(sd, sd_state, 0); 925 926 format->format = *mf; 926 927 return 0; 927 - #else 928 - return -EINVAL; 929 - #endif 930 928 } 931 929 932 930 mf->width = priv->win->width; ··· 999 1005 static int ov2640_init_cfg(struct v4l2_subdev *sd, 1000 1006 struct v4l2_subdev_state *sd_state) 1001 1007 { 1002 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1003 1008 struct v4l2_mbus_framefmt *try_fmt = 1004 1009 v4l2_subdev_get_try_format(sd, sd_state, 0); 1005 1010 const struct ov2640_win_size *win = ··· 1012 1019 try_fmt->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; 1013 1020 try_fmt->quantization = V4L2_QUANTIZATION_DEFAULT; 1014 1021 try_fmt->xfer_func = V4L2_XFER_FUNC_DEFAULT; 1015 - #endif 1022 + 1016 1023 return 0; 1017 1024 } 1018 1025 ··· 1229 1236 ret = priv->hdl.error; 1230 1237 goto err_hdl; 1231 1238 } 1232 - #if defined(CONFIG_MEDIA_CONTROLLER) 1233 1239 priv->pad.flags = MEDIA_PAD_FL_SOURCE; 1234 1240 priv->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR; 1235 1241 ret = media_entity_pads_init(&priv->subdev.entity, 1, &priv->pad); 1236 1242 if (ret < 0) 1237 1243 goto err_hdl; 1238 - #endif 1239 1244 1240 1245 ret = ov2640_video_probe(client); 1241 1246 if (ret < 0)
+1 -15
drivers/media/i2c/ov2659.c
··· 1031 1031 dev_dbg(&client->dev, "ov2659_get_fmt\n"); 1032 1032 1033 1033 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1034 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1035 1034 struct v4l2_mbus_framefmt *mf; 1036 1035 1037 1036 mf = v4l2_subdev_get_try_format(sd, sd_state, 0); ··· 1038 1039 fmt->format = *mf; 1039 1040 mutex_unlock(&ov2659->lock); 1040 1041 return 0; 1041 - #else 1042 - return -EINVAL; 1043 - #endif 1044 1042 } 1045 1043 1046 1044 mutex_lock(&ov2659->lock); ··· 1109 1113 mutex_lock(&ov2659->lock); 1110 1114 1111 1115 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1112 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1113 1116 mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 1114 1117 *mf = fmt->format; 1115 - #endif 1116 1118 } else { 1117 1119 s64 val; 1118 1120 ··· 1300 1306 * V4L2 subdev internal operations 1301 1307 */ 1302 1308 1303 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1304 1309 static int ov2659_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 1305 1310 { 1306 1311 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 1312 1319 1313 1320 return 0; 1314 1321 } 1315 - #endif 1316 1322 1317 1323 static const struct v4l2_subdev_core_ops ov2659_subdev_core_ops = { 1318 1324 .log_status = v4l2_ctrl_subdev_log_status, ··· 1330 1338 .set_fmt = ov2659_set_fmt, 1331 1339 }; 1332 1340 1333 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1334 1341 static const struct v4l2_subdev_ops ov2659_subdev_ops = { 1335 1342 .core = &ov2659_subdev_core_ops, 1336 1343 .video = &ov2659_subdev_video_ops, ··· 1339 1348 static const struct v4l2_subdev_internal_ops ov2659_subdev_internal_ops = { 1340 1349 .open = ov2659_open, 1341 1350 }; 1342 - #endif 1343 1351 1344 1352 static int ov2659_detect(struct v4l2_subdev *sd) 1345 1353 { ··· 1479 1489 1480 1490 sd = &ov2659->sd; 1481 1491 client->flags |= I2C_CLIENT_SCCB; 1482 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1483 - v4l2_i2c_subdev_init(sd, client, &ov2659_subdev_ops); 1484 1492 1493 + v4l2_i2c_subdev_init(sd, client, &ov2659_subdev_ops); 1485 1494 sd->internal_ops = &ov2659_subdev_internal_ops; 1486 1495 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | 1487 1496 V4L2_SUBDEV_FL_HAS_EVENTS; 1488 - #endif 1489 1497 1490 - #if defined(CONFIG_MEDIA_CONTROLLER) 1491 1498 ov2659->pad.flags = MEDIA_PAD_FL_SOURCE; 1492 1499 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; 1493 1500 ret = media_entity_pads_init(&sd->entity, 1, &ov2659->pad); ··· 1492 1505 v4l2_ctrl_handler_free(&ov2659->ctrls); 1493 1506 return ret; 1494 1507 } 1495 - #endif 1496 1508 1497 1509 mutex_init(&ov2659->lock); 1498 1510
-12
drivers/media/i2c/ov2685.c
··· 547 547 return ret; 548 548 } 549 549 550 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 551 550 static int ov2685_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 552 551 { 553 552 struct ov2685 *ov2685 = to_ov2685(sd); ··· 562 563 563 564 return 0; 564 565 } 565 - #endif 566 566 567 567 static int __maybe_unused ov2685_runtime_resume(struct device *dev) 568 568 { ··· 658 660 .pad = &ov2685_pad_ops, 659 661 }; 660 662 661 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 662 663 static const struct v4l2_subdev_internal_ops ov2685_internal_ops = { 663 664 .open = ov2685_open, 664 665 }; 665 - #endif 666 666 667 667 static const struct v4l2_ctrl_ops ov2685_ctrl_ops = { 668 668 .s_ctrl = ov2685_set_ctrl, ··· 829 833 if (ret) 830 834 goto err_power_off; 831 835 832 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 833 836 ov2685->subdev.internal_ops = &ov2685_internal_ops; 834 837 ov2685->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 835 - #endif 836 - #if defined(CONFIG_MEDIA_CONTROLLER) 837 838 ov2685->pad.flags = MEDIA_PAD_FL_SOURCE; 838 839 ov2685->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR; 839 840 ret = media_entity_pads_init(&ov2685->subdev.entity, 1, &ov2685->pad); 840 841 if (ret < 0) 841 842 goto err_power_off; 842 - #endif 843 843 844 844 ret = v4l2_async_register_subdev(&ov2685->subdev); 845 845 if (ret) { ··· 850 858 return 0; 851 859 852 860 err_clean_entity: 853 - #if defined(CONFIG_MEDIA_CONTROLLER) 854 861 media_entity_cleanup(&ov2685->subdev.entity); 855 - #endif 856 862 err_power_off: 857 863 __ov2685_power_off(ov2685); 858 864 err_free_handler: ··· 867 877 struct ov2685 *ov2685 = to_ov2685(sd); 868 878 869 879 v4l2_async_unregister_subdev(sd); 870 - #if defined(CONFIG_MEDIA_CONTROLLER) 871 880 media_entity_cleanup(&sd->entity); 872 - #endif 873 881 v4l2_ctrl_handler_free(&ov2685->ctrl_handler); 874 882 mutex_destroy(&ov2685->mutex); 875 883
-19
drivers/media/i2c/ov5695.c
··· 821 821 fmt->format.height = mode->height; 822 822 fmt->format.field = V4L2_FIELD_NONE; 823 823 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 824 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 825 824 *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) = fmt->format; 826 - #endif 827 825 } else { 828 826 ov5695->cur_mode = mode; 829 827 h_blank = mode->hts_def - mode->width; ··· 847 849 848 850 mutex_lock(&ov5695->mutex); 849 851 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 850 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 851 852 fmt->format = *v4l2_subdev_get_try_format(sd, sd_state, 852 853 fmt->pad); 853 - #else 854 - mutex_unlock(&ov5695->mutex); 855 - return -EINVAL; 856 - #endif 857 854 } else { 858 855 fmt->format.width = mode->width; 859 856 fmt->format.height = mode->height; ··· 1041 1048 return 0; 1042 1049 } 1043 1050 1044 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1045 1051 static int ov5695_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 1046 1052 { 1047 1053 struct ov5695 *ov5695 = to_ov5695(sd); ··· 1060 1068 1061 1069 return 0; 1062 1070 } 1063 - #endif 1064 1071 1065 1072 static const struct dev_pm_ops ov5695_pm_ops = { 1066 1073 SET_RUNTIME_PM_OPS(ov5695_runtime_suspend, 1067 1074 ov5695_runtime_resume, NULL) 1068 1075 }; 1069 1076 1070 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1071 1077 static const struct v4l2_subdev_internal_ops ov5695_internal_ops = { 1072 1078 .open = ov5695_open, 1073 1079 }; 1074 - #endif 1075 1080 1076 1081 static const struct v4l2_subdev_video_ops ov5695_video_ops = { 1077 1082 .s_stream = ov5695_s_stream, ··· 1311 1322 if (ret) 1312 1323 goto err_power_off; 1313 1324 1314 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1315 1325 sd->internal_ops = &ov5695_internal_ops; 1316 1326 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 1317 - #endif 1318 - #if defined(CONFIG_MEDIA_CONTROLLER) 1319 1327 ov5695->pad.flags = MEDIA_PAD_FL_SOURCE; 1320 1328 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; 1321 1329 ret = media_entity_pads_init(&sd->entity, 1, &ov5695->pad); 1322 1330 if (ret < 0) 1323 1331 goto err_power_off; 1324 - #endif 1325 1332 1326 1333 ret = v4l2_async_register_subdev_sensor(sd); 1327 1334 if (ret) { ··· 1332 1347 return 0; 1333 1348 1334 1349 err_clean_entity: 1335 - #if defined(CONFIG_MEDIA_CONTROLLER) 1336 1350 media_entity_cleanup(&sd->entity); 1337 - #endif 1338 1351 err_power_off: 1339 1352 __ov5695_power_off(ov5695); 1340 1353 err_free_handler: ··· 1349 1366 struct ov5695 *ov5695 = to_ov5695(sd); 1350 1367 1351 1368 v4l2_async_unregister_subdev(sd); 1352 - #if defined(CONFIG_MEDIA_CONTROLLER) 1353 1369 media_entity_cleanup(&sd->entity); 1354 - #endif 1355 1370 v4l2_ctrl_handler_free(&ov5695->ctrl_handler); 1356 1371 mutex_destroy(&ov5695->mutex); 1357 1372
-20
drivers/media/i2c/ov7670.c
··· 217 217 struct ov7670_format_struct; /* coming later */ 218 218 struct ov7670_info { 219 219 struct v4l2_subdev sd; 220 - #if defined(CONFIG_MEDIA_CONTROLLER) 221 220 struct media_pad pad; 222 - #endif 223 221 struct v4l2_ctrl_handler hdl; 224 222 struct { 225 223 /* gain cluster */ ··· 1106 1108 struct v4l2_subdev_format *format) 1107 1109 { 1108 1110 struct ov7670_info *info = to_state(sd); 1109 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1110 1111 struct v4l2_mbus_framefmt *mbus_fmt; 1111 - #endif 1112 1112 int ret; 1113 1113 1114 1114 if (format->pad) ··· 1116 1120 ret = ov7670_try_fmt_internal(sd, &format->format, NULL, NULL); 1117 1121 if (ret) 1118 1122 return ret; 1119 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1120 1123 mbus_fmt = v4l2_subdev_get_try_format(sd, sd_state, 1121 1124 format->pad); 1122 1125 *mbus_fmt = format->format; 1123 - #endif 1124 1126 return 0; 1125 1127 } 1126 1128 ··· 1142 1148 struct v4l2_subdev_format *format) 1143 1149 { 1144 1150 struct ov7670_info *info = to_state(sd); 1145 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1146 1151 struct v4l2_mbus_framefmt *mbus_fmt; 1147 - #endif 1148 1152 1149 1153 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 1150 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1151 1154 mbus_fmt = v4l2_subdev_get_try_format(sd, sd_state, 0); 1152 1155 format->format = *mbus_fmt; 1153 1156 return 0; 1154 - #else 1155 - return -EINVAL; 1156 - #endif 1157 1157 } else { 1158 1158 format->format = info->format; 1159 1159 } ··· 1708 1720 format->field = V4L2_FIELD_NONE; 1709 1721 } 1710 1722 1711 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1712 1723 static int ov7670_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 1713 1724 { 1714 1725 struct v4l2_mbus_framefmt *format = ··· 1717 1730 1718 1731 return 0; 1719 1732 } 1720 - #endif 1721 1733 1722 1734 /* ----------------------------------------------------------------------- */ 1723 1735 ··· 1752 1766 .pad = &ov7670_pad_ops, 1753 1767 }; 1754 1768 1755 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1756 1769 static const struct v4l2_subdev_internal_ops ov7670_subdev_internal_ops = { 1757 1770 .open = ov7670_open, 1758 1771 }; 1759 - #endif 1760 1772 1761 1773 /* ----------------------------------------------------------------------- */ 1762 1774 ··· 1845 1861 sd = &info->sd; 1846 1862 v4l2_i2c_subdev_init(sd, client, &ov7670_ops); 1847 1863 1848 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1849 1864 sd->internal_ops = &ov7670_subdev_internal_ops; 1850 1865 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; 1851 - #endif 1852 1866 1853 1867 info->clock_speed = 30; /* default: a guess */ 1854 1868 ··· 1959 1977 V4L2_EXPOSURE_MANUAL, false); 1960 1978 v4l2_ctrl_cluster(2, &info->saturation); 1961 1979 1962 - #if defined(CONFIG_MEDIA_CONTROLLER) 1963 1980 info->pad.flags = MEDIA_PAD_FL_SOURCE; 1964 1981 info->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; 1965 1982 ret = media_entity_pads_init(&info->sd.entity, 1, &info->pad); 1966 1983 if (ret < 0) 1967 1984 goto hdl_free; 1968 - #endif 1969 1985 1970 1986 v4l2_ctrl_handler_setup(&info->hdl); 1971 1987
-4
drivers/media/i2c/ov772x.c
··· 433 433 struct mutex lock; 434 434 int power_count; 435 435 int streaming; 436 - #ifdef CONFIG_MEDIA_CONTROLLER 437 436 struct media_pad pad; 438 - #endif 439 437 enum v4l2_mbus_type bus_type; 440 438 }; 441 439 ··· 1486 1488 if (ret < 0) 1487 1489 goto error_gpio_put; 1488 1490 1489 - #ifdef CONFIG_MEDIA_CONTROLLER 1490 1491 priv->pad.flags = MEDIA_PAD_FL_SOURCE; 1491 1492 priv->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR; 1492 1493 ret = media_entity_pads_init(&priv->subdev.entity, 1, &priv->pad); 1493 1494 if (ret < 0) 1494 1495 goto error_gpio_put; 1495 - #endif 1496 1496 1497 1497 priv->cfmt = &ov772x_cfmts[0]; 1498 1498 priv->win = &ov772x_win_sizes[0];
+2 -21
drivers/media/i2c/ov7740.c
··· 83 83 84 84 struct ov7740 { 85 85 struct v4l2_subdev subdev; 86 - #if defined(CONFIG_MEDIA_CONTROLLER) 87 86 struct media_pad pad; 88 - #endif 89 87 struct v4l2_mbus_framefmt format; 90 88 const struct ov7740_pixfmt *fmt; /* Current format */ 91 89 const struct ov7740_framesize *frmsize; ··· 805 807 struct ov7740 *ov7740 = container_of(sd, struct ov7740, subdev); 806 808 const struct ov7740_pixfmt *ovfmt; 807 809 const struct ov7740_framesize *fsize; 808 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 809 810 struct v4l2_mbus_framefmt *mbus_fmt; 810 - #endif 811 811 int ret; 812 812 813 813 mutex_lock(&ov7740->mutex); ··· 818 822 ret = ov7740_try_fmt_internal(sd, &format->format, NULL, NULL); 819 823 if (ret) 820 824 goto error; 821 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 825 + 822 826 mbus_fmt = v4l2_subdev_get_try_format(sd, sd_state, 823 827 format->pad); 824 828 *mbus_fmt = format->format; 825 - #endif 826 829 mutex_unlock(&ov7740->mutex); 827 830 return 0; 828 831 } ··· 846 851 struct v4l2_subdev_format *format) 847 852 { 848 853 struct ov7740 *ov7740 = container_of(sd, struct ov7740, subdev); 849 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 850 854 struct v4l2_mbus_framefmt *mbus_fmt; 851 - #endif 852 - int ret = 0; 853 855 854 856 mutex_lock(&ov7740->mutex); 855 857 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 856 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 857 858 mbus_fmt = v4l2_subdev_get_try_format(sd, sd_state, 0); 858 859 format->format = *mbus_fmt; 859 - ret = 0; 860 - #else 861 - ret = -EINVAL; 862 - #endif 863 860 } else { 864 861 format->format = ov7740->format; 865 862 } 866 863 mutex_unlock(&ov7740->mutex); 867 864 868 - return ret; 865 + return 0; 869 866 } 870 867 871 868 static const struct v4l2_subdev_pad_ops ov7740_subdev_pad_ops = { ··· 886 899 format->field = V4L2_FIELD_NONE; 887 900 } 888 901 889 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 890 902 static int ov7740_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 891 903 { 892 904 struct ov7740 *ov7740 = container_of(sd, struct ov7740, subdev); ··· 902 916 static const struct v4l2_subdev_internal_ops ov7740_subdev_internal_ops = { 903 917 .open = ov7740_open, 904 918 }; 905 - #endif 906 919 907 920 static int ov7740_probe_dt(struct i2c_client *client, 908 921 struct ov7740 *ov7740) ··· 1079 1094 sd = &ov7740->subdev; 1080 1095 v4l2_i2c_subdev_init(sd, client, &ov7740_subdev_ops); 1081 1096 1082 - #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1083 1097 sd->internal_ops = &ov7740_subdev_internal_ops; 1084 1098 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; 1085 - #endif 1086 1099 1087 - #if defined(CONFIG_MEDIA_CONTROLLER) 1088 1100 ov7740->pad.flags = MEDIA_PAD_FL_SOURCE; 1089 1101 sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; 1090 1102 ret = media_entity_pads_init(&sd->entity, 1, &ov7740->pad); 1091 1103 if (ret) 1092 1104 return ret; 1093 - #endif 1094 1105 1095 1106 ret = ov7740_set_power(ov7740, 1); 1096 1107 if (ret)