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

media: i2c: mt9v032: Drop support for platform data

The last user of the mt9v032 driver through board files and platform
data has long been removed. Drop support for platform data from the
driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Mehdi Djait <mehdi.djait@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Laurent Pinchart and committed by
Mauro Carvalho Chehab
b4dd3bbd 0f8d0da4

+28 -52
-1
MAINTAINERS
··· 17273 17273 T: git git://linuxtv.org/media.git 17274 17274 F: Documentation/devicetree/bindings/media/i2c/aptina,mt9v032.txt 17275 17275 F: drivers/media/i2c/mt9v032.c 17276 - F: include/media/i2c/mt9v032.h 17277 17276 17278 17277 MT9V111 APTINA CAMERA SENSOR 17279 17278 M: Jacopo Mondi <jacopo@jmondi.org>
+1
drivers/media/i2c/Kconfig
··· 327 327 328 328 config VIDEO_MT9V032 329 329 tristate "Micron MT9V032 sensor support" 330 + depends on OF 330 331 select REGMAP_I2C 331 332 help 332 333 This is a Video4Linux2 sensor driver for the Micron
+27 -39
drivers/media/i2c/mt9v032.c
··· 24 24 #include <linux/v4l2-mediabus.h> 25 25 #include <linux/videodev2.h> 26 26 27 - #include <media/i2c/mt9v032.h> 28 27 #include <media/v4l2-ctrls.h> 29 28 #include <media/v4l2-device.h> 30 29 #include <media/v4l2-fwnode.h> ··· 181 182 { MT9V034_CHIP_ID_REV1, "MT9V024/MT9V034 rev1" }, 182 183 }; 183 184 185 + struct mt9v032_platform_data { 186 + unsigned int clk_pol:1; 187 + 188 + const s64 *link_freqs; 189 + s64 link_def_freq; 190 + }; 191 + 184 192 struct mt9v032 { 185 193 struct device *dev; 186 194 ··· 213 207 struct gpio_desc *reset_gpio; 214 208 struct gpio_desc *standby_gpio; 215 209 216 - struct mt9v032_platform_data *pdata; 210 + struct mt9v032_platform_data pdata; 217 211 const struct mt9v032_model_info *model; 218 212 const struct mt9v032_model_version *version; 219 213 ··· 338 332 return ret; 339 333 340 334 /* Configure the pixel clock polarity */ 341 - if (mt9v032->pdata && mt9v032->pdata->clk_pol) { 335 + if (mt9v032->pdata.clk_pol) { 342 336 ret = regmap_write(map, mt9v032->model->data->pclk_reg, 343 337 MT9V032_PIXEL_CLOCK_INV_PXL_CLK); 344 338 if (ret < 0) ··· 689 683 if (mt9v032->link_freq == NULL) 690 684 break; 691 685 692 - freq = mt9v032->pdata->link_freqs[mt9v032->link_freq->val]; 686 + freq = mt9v032->pdata.link_freqs[mt9v032->link_freq->val]; 693 687 *mt9v032->pixel_rate->p_new.p_s64 = freq; 694 688 mt9v032->sysclk = freq; 695 689 break; ··· 1002 996 * Driver initialization and probing 1003 997 */ 1004 998 1005 - static struct mt9v032_platform_data *mt9v032_get_pdata(struct mt9v032 *mt9v032) 999 + static int mt9v032_get_pdata(struct mt9v032 *mt9v032) 1006 1000 { 1007 - struct mt9v032_platform_data *pdata = NULL; 1001 + struct mt9v032_platform_data *pdata = &mt9v032->pdata; 1008 1002 struct v4l2_fwnode_endpoint endpoint = { .bus_type = 0 }; 1009 - struct device_node *np; 1003 + struct device_node *np __free(device_node) = NULL; 1010 1004 struct property *prop; 1011 - 1012 - if (!IS_ENABLED(CONFIG_OF) || !mt9v032->dev->of_node) 1013 - return mt9v032->dev->platform_data; 1014 1005 1015 1006 np = of_graph_get_endpoint_by_regs(mt9v032->dev->of_node, 0, -1); 1016 1007 if (!np) 1017 - return NULL; 1008 + return -EINVAL; 1018 1009 1019 1010 if (v4l2_fwnode_endpoint_parse(of_fwnode_handle(np), &endpoint) < 0) 1020 - goto done; 1021 - 1022 - pdata = devm_kzalloc(mt9v032->dev, sizeof(*pdata), GFP_KERNEL); 1023 - if (!pdata) 1024 - goto done; 1011 + return -EINVAL; 1025 1012 1026 1013 prop = of_find_property(np, "link-frequencies", NULL); 1027 1014 if (prop) { ··· 1024 1025 link_freqs = devm_kcalloc(mt9v032->dev, size, 1025 1026 sizeof(*link_freqs), GFP_KERNEL); 1026 1027 if (!link_freqs) 1027 - goto done; 1028 + return -EINVAL; 1028 1029 1029 1030 if (of_property_read_u64_array(np, "link-frequencies", 1030 1031 link_freqs, size) < 0) 1031 - goto done; 1032 + return -EINVAL; 1032 1033 1033 1034 pdata->link_freqs = link_freqs; 1034 1035 pdata->link_def_freq = link_freqs[0]; ··· 1037 1038 pdata->clk_pol = !!(endpoint.bus.parallel.flags & 1038 1039 V4L2_MBUS_PCLK_SAMPLE_RISING); 1039 1040 1040 - done: 1041 - of_node_put(np); 1042 - return pdata; 1041 + return 0; 1043 1042 } 1044 1043 1045 1044 static int mt9v032_probe(struct i2c_client *client) ··· 1072 1075 return PTR_ERR(mt9v032->standby_gpio); 1073 1076 1074 1077 mutex_init(&mt9v032->power_lock); 1075 - mt9v032->pdata = mt9v032_get_pdata(mt9v032); 1076 - mt9v032->model = i2c_get_match_data(client); 1078 + 1079 + ret = mt9v032_get_pdata(mt9v032); 1080 + if (ret) 1081 + return dev_err_probe(mt9v032->dev, -EINVAL, 1082 + "Failed to parse DT properties\n"); 1083 + 1084 + mt9v032->model = device_get_match_data(mt9v032->dev); 1077 1085 1078 1086 v4l2_ctrl_handler_init(&mt9v032->ctrls, 11 + 1079 1087 ARRAY_SIZE(mt9v032_aegc_controls)); ··· 1123 1121 v4l2_ctrl_new_std(&mt9v032->ctrls, &mt9v032_ctrl_ops, 1124 1122 V4L2_CID_PIXEL_RATE, 1, INT_MAX, 1, 1); 1125 1123 1126 - if (mt9v032->pdata && mt9v032->pdata->link_freqs) { 1127 - const struct mt9v032_platform_data *pdata = mt9v032->pdata; 1124 + if (mt9v032->pdata.link_freqs) { 1125 + const struct mt9v032_platform_data *pdata = &mt9v032->pdata; 1128 1126 unsigned int def = 0; 1129 1127 1130 1128 for (i = 0; pdata->link_freqs[i]; ++i) { ··· 1266 1264 }, 1267 1265 }; 1268 1266 1269 - static const struct i2c_device_id mt9v032_id[] = { 1270 - { "mt9v022", (kernel_ulong_t)&mt9v032_models[MT9V032_MODEL_V022_COLOR] }, 1271 - { "mt9v022m", (kernel_ulong_t)&mt9v032_models[MT9V032_MODEL_V022_MONO] }, 1272 - { "mt9v024", (kernel_ulong_t)&mt9v032_models[MT9V032_MODEL_V024_COLOR] }, 1273 - { "mt9v024m", (kernel_ulong_t)&mt9v032_models[MT9V032_MODEL_V024_MONO] }, 1274 - { "mt9v032", (kernel_ulong_t)&mt9v032_models[MT9V032_MODEL_V032_COLOR] }, 1275 - { "mt9v032m", (kernel_ulong_t)&mt9v032_models[MT9V032_MODEL_V032_MONO] }, 1276 - { "mt9v034", (kernel_ulong_t)&mt9v032_models[MT9V032_MODEL_V034_COLOR] }, 1277 - { "mt9v034m", (kernel_ulong_t)&mt9v032_models[MT9V032_MODEL_V034_MONO] }, 1278 - { /* Sentinel */ } 1279 - }; 1280 - MODULE_DEVICE_TABLE(i2c, mt9v032_id); 1281 - 1282 1267 static const struct of_device_id mt9v032_of_match[] = { 1283 1268 { .compatible = "aptina,mt9v022", .data = &mt9v032_models[MT9V032_MODEL_V022_COLOR] }, 1284 1269 { .compatible = "aptina,mt9v022m", .data = &mt9v032_models[MT9V032_MODEL_V022_MONO] }, ··· 1286 1297 }, 1287 1298 .probe = mt9v032_probe, 1288 1299 .remove = mt9v032_remove, 1289 - .id_table = mt9v032_id, 1290 1300 }; 1291 1301 1292 1302 module_i2c_driver(mt9v032_driver);
-12
include/media/i2c/mt9v032.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef _MEDIA_MT9V032_H 3 - #define _MEDIA_MT9V032_H 4 - 5 - struct mt9v032_platform_data { 6 - unsigned int clk_pol:1; 7 - 8 - const s64 *link_freqs; 9 - s64 link_def_freq; 10 - }; 11 - 12 - #endif