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

Merge tag 'br-v6.2i' of git://linuxtv.org/hverkuil/media_tree into media_stage

Tag branch

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

* tag 'br-v6.2i' of git://linuxtv.org/hverkuil/media_tree: (31 commits)
media: s5c73m3: Switch to GPIO descriptors
media: i2c: s5k5baf: switch to using gpiod API
media: i2c: s5k6a3: switch to using gpiod API
media: imx: remove code for non-existing config IMX_GPT_ICAP
media: si470x: Fix use-after-free in si470x_int_in_callback()
media: staging: stkwebcam: Restore MEDIA_{USB,CAMERA}_SUPPORT dependencies
media: coda: Add check for kmalloc
media: coda: Add check for dcoda_iram_alloc
dt-bindings: media: s5c73m3: Fix reset-gpio descriptor
media: dt-bindings: allwinner: h6-vpu-g2: Add IOMMU reference property
media: s5k4ecgx: Delete driver
media: s5k4ecgx: Switch to GPIO descriptors
media: Switch to use dev_err_probe() helper
headers: Remove some left-over license text in include/uapi/linux/v4l2-*
headers: Remove some left-over license text in include/uapi/linux/dvb/
media: usb: pwc-uncompress: Use flex array destination for memcpy()
media: s5p-mfc: Fix to handle reference queue during finishing
media: s5p-mfc: Clear workbit to handle error condition
media: s5p-mfc: Fix in register read and write for H264
media: imx: Use get_mbus_config instead of parsing upstream DT endpoints
...

authored by

Mauro Carvalho Chehab and committed by
Hans Verkuil
3178804c b2ea130c

+247 -1788
+5
Documentation/devicetree/bindings/media/allwinner,sun50i-h6-vpu-g2.yaml
··· 36 36 resets: 37 37 maxItems: 1 38 38 39 + iommus: 40 + maxItems: 1 41 + 39 42 required: 40 43 - compatible 41 44 - reg ··· 46 43 - clocks 47 44 - clock-names 48 45 - resets 46 + - iommus 49 47 50 48 additionalProperties: false 51 49 ··· 63 59 clocks = <&ccu CLK_BUS_VP9>, <&ccu CLK_VP9>; 64 60 clock-names = "bus", "mod"; 65 61 resets = <&ccu RST_BUS_VP9>; 62 + iommus = <&iommu 5>; 66 63 }; 67 64 68 65 ...
+1 -1
Documentation/devicetree/bindings/media/samsung-s5c73m3.txt
··· 76 76 clock-frequency = <24000000>; 77 77 clocks = <&clk 0>; 78 78 clock-names = "cis_extclk"; 79 - reset-gpios = <&gpf1 3 1>; 79 + xshutdown-gpios = <&gpf1 3 1>; 80 80 standby-gpios = <&gpm0 1 1>; 81 81 port { 82 82 s5c73m3_ep: endpoint {
+3 -2
Documentation/devicetree/bindings/media/video-interfaces.yaml
··· 145 145 146 146 pclk-sample: 147 147 $ref: /schemas/types.yaml#/definitions/uint32 148 - enum: [ 0, 1 ] 148 + enum: [ 0, 1, 2 ] 149 149 description: 150 - Sample data on rising (1) or falling (0) edge of the pixel clock signal. 150 + Sample data on falling (0), rising (1) or both (2) edges of the pixel 151 + clock signal. 151 152 152 153 sync-on-green-active: 153 154 $ref: /schemas/types.yaml#/definitions/uint32
+1 -1
drivers/media/Kconfig
··· 182 182 # 183 183 184 184 config DVB_CORE 185 - tristate 185 + tristate "DVB Core" 186 186 depends on MEDIA_DIGITAL_TV_SUPPORT 187 187 depends on (I2C || I2C=n) 188 188 default MEDIA_DIGITAL_TV_SUPPORT
+3 -6
drivers/media/cec/platform/stm32/stm32-cec.c
··· 288 288 return ret; 289 289 290 290 cec->clk_cec = devm_clk_get(&pdev->dev, "cec"); 291 - if (IS_ERR(cec->clk_cec)) { 292 - if (PTR_ERR(cec->clk_cec) != -EPROBE_DEFER) 293 - dev_err(&pdev->dev, "Cannot get cec clock\n"); 294 - 295 - return PTR_ERR(cec->clk_cec); 296 - } 291 + if (IS_ERR(cec->clk_cec)) 292 + return dev_err_probe(&pdev->dev, PTR_ERR(cec->clk_cec), 293 + "Cannot get cec clock\n"); 297 294 298 295 ret = clk_prepare(cec->clk_cec); 299 296 if (ret) {
-10
drivers/media/i2c/Kconfig
··· 751 751 This is a V4L2 sensor driver for Samsung S5C73M3 752 752 8 Mpixel camera. 753 753 754 - config VIDEO_S5K4ECGX 755 - tristate "Samsung S5K4ECGX sensor support" 756 - depends on I2C && VIDEO_DEV 757 - select MEDIA_CONTROLLER 758 - select VIDEO_V4L2_SUBDEV_API 759 - select CRC32 760 - help 761 - This is a V4L2 sensor driver for Samsung S5K4ECGX 5M 762 - camera sensor with an embedded SoC image signal processor. 763 - 764 754 config VIDEO_S5K5BAF 765 755 tristate "Samsung S5K5BAF sensor support" 766 756 depends on I2C && VIDEO_DEV
-1
drivers/media/i2c/Makefile
··· 105 105 obj-$(CONFIG_VIDEO_RDACM21) += rdacm21.o 106 106 obj-$(CONFIG_VIDEO_RJ54N1) += rj54n1cb0c.o 107 107 obj-$(CONFIG_VIDEO_S5C73M3) += s5c73m3/ 108 - obj-$(CONFIG_VIDEO_S5K4ECGX) += s5k4ecgx.o 109 108 obj-$(CONFIG_VIDEO_S5K5BAF) += s5k5baf.o 110 109 obj-$(CONFIG_VIDEO_S5K6A3) += s5k6a3.o 111 110 obj-$(CONFIG_VIDEO_S5K6AA) += s5k6aa.o
+6 -12
drivers/media/i2c/ad5820.c
··· 300 300 return -ENOMEM; 301 301 302 302 coil->vana = devm_regulator_get(&client->dev, "VANA"); 303 - if (IS_ERR(coil->vana)) { 304 - ret = PTR_ERR(coil->vana); 305 - if (ret != -EPROBE_DEFER) 306 - dev_err(&client->dev, "could not get regulator for vana\n"); 307 - return ret; 308 - } 303 + if (IS_ERR(coil->vana)) 304 + return dev_err_probe(&client->dev, PTR_ERR(coil->vana), 305 + "could not get regulator for vana\n"); 309 306 310 307 coil->enable_gpio = devm_gpiod_get_optional(&client->dev, "enable", 311 308 GPIOD_OUT_LOW); 312 - if (IS_ERR(coil->enable_gpio)) { 313 - ret = PTR_ERR(coil->enable_gpio); 314 - if (ret != -EPROBE_DEFER) 315 - dev_err(&client->dev, "could not get enable gpio\n"); 316 - return ret; 317 - } 309 + if (IS_ERR(coil->enable_gpio)) 310 + return dev_err_probe(&client->dev, PTR_ERR(coil->enable_gpio), 311 + "could not get enable gpio\n"); 318 312 319 313 mutex_init(&coil->power_lock); 320 314
+2 -3
drivers/media/i2c/imx274.c
··· 2060 2060 imx274->reset_gpio = devm_gpiod_get_optional(dev, "reset", 2061 2061 GPIOD_OUT_HIGH); 2062 2062 if (IS_ERR(imx274->reset_gpio)) { 2063 - if (PTR_ERR(imx274->reset_gpio) != -EPROBE_DEFER) 2064 - dev_err(dev, "Reset GPIO not setup in DT"); 2065 - ret = PTR_ERR(imx274->reset_gpio); 2063 + ret = dev_err_probe(dev, PTR_ERR(imx274->reset_gpio), 2064 + "Reset GPIO not setup in DT\n"); 2066 2065 goto err_me; 2067 2066 } 2068 2067
+1 -1
drivers/media/i2c/isl7998x.c
··· 665 665 static int isl7998x_init(struct isl7998x *isl7998x) 666 666 { 667 667 const unsigned int lanes = isl7998x->nr_mipi_lanes; 668 - const u32 isl7998x_video_in_chan_map[] = { 0x00, 0x11, 0x02, 0x02 }; 668 + static const u32 isl7998x_video_in_chan_map[] = { 0x00, 0x11, 0x02, 0x02 }; 669 669 const struct reg_sequence isl7998x_init_seq_custom[] = { 670 670 { ISL7998X_REG_P0_VIDEO_IN_CHAN_CTL, 671 671 isl7998x_video_in_chan_map[isl7998x->nr_inputs - 1] },
+20 -87
drivers/media/i2c/s5c73m3/s5c73m3-core.c
··· 10 10 #include <linux/clk.h> 11 11 #include <linux/delay.h> 12 12 #include <linux/firmware.h> 13 - #include <linux/gpio.h> 13 + #include <linux/gpio/consumer.h> 14 14 #include <linux/i2c.h> 15 15 #include <linux/init.h> 16 16 #include <linux/media.h> 17 17 #include <linux/module.h> 18 - #include <linux/of_gpio.h> 19 18 #include <linux/of_graph.h> 20 19 #include <linux/regulator/consumer.h> 21 20 #include <linux/sizes.h> ··· 1346 1347 return 0; 1347 1348 } 1348 1349 1349 - static int s5c73m3_gpio_set_value(struct s5c73m3 *priv, int id, u32 val) 1350 - { 1351 - if (!gpio_is_valid(priv->gpio[id].gpio)) 1352 - return 0; 1353 - gpio_set_value(priv->gpio[id].gpio, !!val); 1354 - return 1; 1355 - } 1356 - 1357 - static int s5c73m3_gpio_assert(struct s5c73m3 *priv, int id) 1358 - { 1359 - return s5c73m3_gpio_set_value(priv, id, priv->gpio[id].level); 1360 - } 1361 - 1362 - static int s5c73m3_gpio_deassert(struct s5c73m3 *priv, int id) 1363 - { 1364 - return s5c73m3_gpio_set_value(priv, id, !priv->gpio[id].level); 1365 - } 1366 - 1367 1350 static int __s5c73m3_power_on(struct s5c73m3 *state) 1368 1351 { 1369 1352 int i, ret; ··· 1367 1386 v4l2_dbg(1, s5c73m3_dbg, &state->oif_sd, "clock frequency: %ld\n", 1368 1387 clk_get_rate(state->clock)); 1369 1388 1370 - s5c73m3_gpio_deassert(state, STBY); 1389 + gpiod_set_value(state->stby, 0); 1371 1390 usleep_range(100, 200); 1372 - 1373 - s5c73m3_gpio_deassert(state, RSET); 1391 + gpiod_set_value(state->reset, 0); 1374 1392 usleep_range(50, 100); 1375 1393 1376 1394 return 0; ··· 1384 1404 { 1385 1405 int i, ret; 1386 1406 1387 - if (s5c73m3_gpio_assert(state, RSET)) 1388 - usleep_range(10, 50); 1389 - 1390 - if (s5c73m3_gpio_assert(state, STBY)) 1391 - usleep_range(100, 200); 1407 + gpiod_set_value(state->reset, 1); 1408 + usleep_range(10, 50); 1409 + gpiod_set_value(state->stby, 1); 1410 + usleep_range(100, 200); 1392 1411 1393 1412 clk_disable_unprepare(state->clock); 1394 1413 ··· 1522 1543 .video = &s5c73m3_oif_video_ops, 1523 1544 }; 1524 1545 1525 - static int s5c73m3_configure_gpios(struct s5c73m3 *state) 1526 - { 1527 - static const char * const gpio_names[] = { 1528 - "S5C73M3_STBY", "S5C73M3_RST" 1529 - }; 1530 - struct i2c_client *c = state->i2c_client; 1531 - struct s5c73m3_gpio *g = state->gpio; 1532 - int ret, i; 1533 - 1534 - for (i = 0; i < GPIO_NUM; ++i) { 1535 - unsigned int flags = GPIOF_DIR_OUT; 1536 - if (g[i].level) 1537 - flags |= GPIOF_INIT_HIGH; 1538 - ret = devm_gpio_request_one(&c->dev, g[i].gpio, flags, 1539 - gpio_names[i]); 1540 - if (ret) { 1541 - v4l2_err(c, "failed to request gpio %s\n", 1542 - gpio_names[i]); 1543 - return ret; 1544 - } 1545 - } 1546 - return 0; 1547 - } 1548 - 1549 - static int s5c73m3_parse_gpios(struct s5c73m3 *state) 1550 - { 1551 - static const char * const prop_names[] = { 1552 - "standby-gpios", "xshutdown-gpios", 1553 - }; 1554 - struct device *dev = &state->i2c_client->dev; 1555 - struct device_node *node = dev->of_node; 1556 - int ret, i; 1557 - 1558 - for (i = 0; i < GPIO_NUM; ++i) { 1559 - enum of_gpio_flags of_flags; 1560 - 1561 - ret = of_get_named_gpio_flags(node, prop_names[i], 1562 - 0, &of_flags); 1563 - if (ret < 0) { 1564 - dev_err(dev, "failed to parse %s DT property\n", 1565 - prop_names[i]); 1566 - return -EINVAL; 1567 - } 1568 - state->gpio[i].gpio = ret; 1569 - state->gpio[i].level = !(of_flags & OF_GPIO_ACTIVE_LOW); 1570 - } 1571 - return 0; 1572 - } 1573 - 1574 1546 static int s5c73m3_get_platform_data(struct s5c73m3 *state) 1575 1547 { 1576 - struct device *dev = &state->i2c_client->dev; 1548 + struct i2c_client *c = state->i2c_client; 1549 + struct device *dev = &c->dev; 1577 1550 const struct s5c73m3_platform_data *pdata = dev->platform_data; 1578 1551 struct device_node *node = dev->of_node; 1579 1552 struct device_node *node_ep; ··· 1539 1608 } 1540 1609 1541 1610 state->mclk_frequency = pdata->mclk_frequency; 1542 - state->gpio[STBY] = pdata->gpio_stby; 1543 - state->gpio[RSET] = pdata->gpio_reset; 1544 1611 return 0; 1545 1612 } 1546 1613 ··· 1553 1624 state->mclk_frequency); 1554 1625 } 1555 1626 1556 - ret = s5c73m3_parse_gpios(state); 1557 - if (ret < 0) 1558 - return -EINVAL; 1627 + /* Request GPIO lines asserted */ 1628 + state->stby = devm_gpiod_get(dev, "standby", GPIOD_OUT_HIGH); 1629 + if (IS_ERR(state->stby)) 1630 + return dev_err_probe(dev, PTR_ERR(state->stby), 1631 + "failed to request gpio S5C73M3_STBY\n"); 1632 + gpiod_set_consumer_name(state->stby, "S5C73M3_STBY"); 1633 + state->reset = devm_gpiod_get(dev, "xshutdown", GPIOD_OUT_HIGH); 1634 + if (IS_ERR(state->reset)) 1635 + return dev_err_probe(dev, PTR_ERR(state->reset), 1636 + "failed to request gpio S5C73M3_RST\n"); 1637 + gpiod_set_consumer_name(state->reset, "S5C73M3_RST"); 1559 1638 1560 1639 node_ep = of_graph_get_next_endpoint(node, NULL); 1561 1640 if (!node_ep) { ··· 1644 1707 state->oif_pads); 1645 1708 if (ret < 0) 1646 1709 return ret; 1647 - 1648 - ret = s5c73m3_configure_gpios(state); 1649 - if (ret) 1650 - goto out_err; 1651 1710 1652 1711 for (i = 0; i < S5C73M3_MAX_SUPPLIES; i++) 1653 1712 state->supplies[i].supply = s5c73m3_supply_names[i];
-1
drivers/media/i2c/s5c73m3/s5c73m3-ctrls.c
··· 10 10 #include <linux/sizes.h> 11 11 #include <linux/delay.h> 12 12 #include <linux/firmware.h> 13 - #include <linux/gpio.h> 14 13 #include <linux/i2c.h> 15 14 #include <linux/init.h> 16 15 #include <linux/media.h>
+3 -7
drivers/media/i2c/s5c73m3/s5c73m3.h
··· 12 12 #include <linux/clk.h> 13 13 #include <linux/kernel.h> 14 14 #include <linux/regulator/consumer.h> 15 + #include <linux/gpio/consumer.h> 15 16 #include <media/v4l2-common.h> 16 17 #include <media/v4l2-ctrls.h> 17 18 #include <media/v4l2-subdev.h> ··· 352 351 struct v4l2_ctrl *scene_mode; 353 352 }; 354 353 355 - enum s5c73m3_gpio_id { 356 - STBY, 357 - RSET, 358 - GPIO_NUM, 359 - }; 360 - 361 354 enum s5c73m3_resolution_types { 362 355 RES_ISP, 363 356 RES_JPEG, ··· 378 383 u32 i2c_read_address; 379 384 380 385 struct regulator_bulk_data supplies[S5C73M3_MAX_SUPPLIES]; 381 - struct s5c73m3_gpio gpio[GPIO_NUM]; 386 + struct gpio_desc *stby; 387 + struct gpio_desc *reset; 382 388 383 389 struct clk *clock; 384 390
-1031
drivers/media/i2c/s5k4ecgx.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * Driver for Samsung S5K4ECGX 1/4" 5Mp CMOS Image Sensor SoC 4 - * with an Embedded Image Signal Processor. 5 - * 6 - * Copyright (C) 2012, Linaro, Sangwook Lee <sangwook.lee@linaro.org> 7 - * Copyright (C) 2012, Insignal Co,. Ltd, Homin Lee <suapapa@insignal.co.kr> 8 - * 9 - * Based on s5k6aa and noon010pc30 driver 10 - * Copyright (C) 2011, Samsung Electronics Co., Ltd. 11 - */ 12 - 13 - #include <linux/clk.h> 14 - #include <linux/crc32.h> 15 - #include <linux/ctype.h> 16 - #include <linux/delay.h> 17 - #include <linux/firmware.h> 18 - #include <linux/gpio.h> 19 - #include <linux/i2c.h> 20 - #include <linux/module.h> 21 - #include <linux/regulator/consumer.h> 22 - #include <linux/slab.h> 23 - #include <asm/unaligned.h> 24 - 25 - #include <media/media-entity.h> 26 - #include <media/i2c/s5k4ecgx.h> 27 - #include <media/v4l2-ctrls.h> 28 - #include <media/v4l2-device.h> 29 - #include <media/v4l2-mediabus.h> 30 - #include <media/v4l2-subdev.h> 31 - 32 - static int debug; 33 - module_param(debug, int, 0644); 34 - 35 - #define S5K4ECGX_DRIVER_NAME "s5k4ecgx" 36 - #define S5K4ECGX_FIRMWARE "s5k4ecgx.bin" 37 - 38 - /* Firmware revision information */ 39 - #define REG_FW_REVISION 0x700001a6 40 - #define REG_FW_VERSION 0x700001a4 41 - #define S5K4ECGX_REVISION_1_1 0x11 42 - #define S5K4ECGX_FW_VERSION 0x4ec0 43 - 44 - /* General purpose parameters */ 45 - #define REG_USER_BRIGHTNESS 0x7000022c 46 - #define REG_USER_CONTRAST 0x7000022e 47 - #define REG_USER_SATURATION 0x70000230 48 - 49 - #define REG_G_ENABLE_PREV 0x7000023e 50 - #define REG_G_ENABLE_PREV_CHG 0x70000240 51 - #define REG_G_NEW_CFG_SYNC 0x7000024a 52 - #define REG_G_PREV_IN_WIDTH 0x70000250 53 - #define REG_G_PREV_IN_HEIGHT 0x70000252 54 - #define REG_G_PREV_IN_XOFFS 0x70000254 55 - #define REG_G_PREV_IN_YOFFS 0x70000256 56 - #define REG_G_CAP_IN_WIDTH 0x70000258 57 - #define REG_G_CAP_IN_HEIGHT 0x7000025a 58 - #define REG_G_CAP_IN_XOFFS 0x7000025c 59 - #define REG_G_CAP_IN_YOFFS 0x7000025e 60 - #define REG_G_INPUTS_CHANGE_REQ 0x70000262 61 - #define REG_G_ACTIVE_PREV_CFG 0x70000266 62 - #define REG_G_PREV_CFG_CHG 0x70000268 63 - #define REG_G_PREV_OPEN_AFTER_CH 0x7000026a 64 - 65 - /* Preview context register sets. n = 0...4. */ 66 - #define PREG(n, x) ((n) * 0x30 + (x)) 67 - #define REG_P_OUT_WIDTH(n) PREG(n, 0x700002a6) 68 - #define REG_P_OUT_HEIGHT(n) PREG(n, 0x700002a8) 69 - #define REG_P_FMT(n) PREG(n, 0x700002aa) 70 - #define REG_P_PVI_MASK(n) PREG(n, 0x700002b4) 71 - #define REG_P_FR_TIME_TYPE(n) PREG(n, 0x700002be) 72 - #define FR_TIME_DYNAMIC 0 73 - #define FR_TIME_FIXED 1 74 - #define FR_TIME_FIXED_ACCURATE 2 75 - #define REG_P_FR_TIME_Q_TYPE(n) PREG(n, 0x700002c0) 76 - #define FR_TIME_Q_DYNAMIC 0 77 - #define FR_TIME_Q_BEST_FRRATE 1 78 - #define FR_TIME_Q_BEST_QUALITY 2 79 - 80 - /* Frame period in 0.1 ms units */ 81 - #define REG_P_MAX_FR_TIME(n) PREG(n, 0x700002c2) 82 - #define REG_P_MIN_FR_TIME(n) PREG(n, 0x700002c4) 83 - #define US_TO_FR_TIME(__t) ((__t) / 100) 84 - #define REG_P_PREV_MIRROR(n) PREG(n, 0x700002d0) 85 - #define REG_P_CAP_MIRROR(n) PREG(n, 0x700002d2) 86 - 87 - #define REG_G_PREVZOOM_IN_WIDTH 0x70000494 88 - #define REG_G_PREVZOOM_IN_HEIGHT 0x70000496 89 - #define REG_G_PREVZOOM_IN_XOFFS 0x70000498 90 - #define REG_G_PREVZOOM_IN_YOFFS 0x7000049a 91 - #define REG_G_CAPZOOM_IN_WIDTH 0x7000049c 92 - #define REG_G_CAPZOOM_IN_HEIGHT 0x7000049e 93 - #define REG_G_CAPZOOM_IN_XOFFS 0x700004a0 94 - #define REG_G_CAPZOOM_IN_YOFFS 0x700004a2 95 - 96 - /* n = 0...4 */ 97 - #define REG_USER_SHARPNESS(n) (0x70000a28 + (n) * 0xb6) 98 - 99 - /* Reduce sharpness range for user space API */ 100 - #define SHARPNESS_DIV 8208 101 - #define TOK_TERM 0xffffffff 102 - 103 - /* 104 - * FIXME: This is copied from s5k6aa, because of no information 105 - * in the S5K4ECGX datasheet. 106 - * H/W register Interface (0xd0000000 - 0xd0000fff) 107 - */ 108 - #define AHB_MSB_ADDR_PTR 0xfcfc 109 - #define GEN_REG_OFFSH 0xd000 110 - #define REG_CMDWR_ADDRH 0x0028 111 - #define REG_CMDWR_ADDRL 0x002a 112 - #define REG_CMDRD_ADDRH 0x002c 113 - #define REG_CMDRD_ADDRL 0x002e 114 - #define REG_CMDBUF0_ADDR 0x0f12 115 - 116 - struct s5k4ecgx_frmsize { 117 - struct v4l2_frmsize_discrete size; 118 - /* Fixed sensor matrix crop rectangle */ 119 - struct v4l2_rect input_window; 120 - }; 121 - 122 - struct regval_list { 123 - u32 addr; 124 - u16 val; 125 - }; 126 - 127 - /* 128 - * TODO: currently only preview is supported and snapshot (capture) 129 - * is not implemented yet 130 - */ 131 - static const struct s5k4ecgx_frmsize s5k4ecgx_prev_sizes[] = { 132 - { 133 - .size = { 176, 144 }, 134 - .input_window = { 0x00, 0x00, 0x928, 0x780 }, 135 - }, { 136 - .size = { 352, 288 }, 137 - .input_window = { 0x00, 0x00, 0x928, 0x780 }, 138 - }, { 139 - .size = { 640, 480 }, 140 - .input_window = { 0x00, 0x00, 0xa00, 0x780 }, 141 - }, { 142 - .size = { 720, 480 }, 143 - .input_window = { 0x00, 0x00, 0xa00, 0x6a8 }, 144 - } 145 - }; 146 - 147 - #define S5K4ECGX_NUM_PREV ARRAY_SIZE(s5k4ecgx_prev_sizes) 148 - 149 - struct s5k4ecgx_pixfmt { 150 - u32 code; 151 - u32 colorspace; 152 - /* REG_TC_PCFG_Format register value */ 153 - u16 reg_p_format; 154 - }; 155 - 156 - /* By default value, output from sensor will be YUV422 0-255 */ 157 - static const struct s5k4ecgx_pixfmt s5k4ecgx_formats[] = { 158 - { MEDIA_BUS_FMT_YUYV8_2X8, V4L2_COLORSPACE_JPEG, 5 }, 159 - }; 160 - 161 - static const char * const s5k4ecgx_supply_names[] = { 162 - /* 163 - * Usually 2.8V is used for analog power (vdda) 164 - * and digital IO (vddio, vdddcore) 165 - */ 166 - "vdda", 167 - "vddio", 168 - "vddcore", 169 - "vddreg", /* The internal s5k4ecgx regulator's supply (1.8V) */ 170 - }; 171 - 172 - #define S5K4ECGX_NUM_SUPPLIES ARRAY_SIZE(s5k4ecgx_supply_names) 173 - 174 - enum s5k4ecgx_gpio_id { 175 - STBY, 176 - RSET, 177 - GPIO_NUM, 178 - }; 179 - 180 - struct s5k4ecgx { 181 - struct v4l2_subdev sd; 182 - struct media_pad pad; 183 - struct v4l2_ctrl_handler handler; 184 - 185 - struct s5k4ecgx_platform_data *pdata; 186 - const struct s5k4ecgx_pixfmt *curr_pixfmt; 187 - const struct s5k4ecgx_frmsize *curr_frmsize; 188 - struct mutex lock; 189 - u8 streaming; 190 - u8 set_params; 191 - 192 - struct regulator_bulk_data supplies[S5K4ECGX_NUM_SUPPLIES]; 193 - struct s5k4ecgx_gpio gpio[GPIO_NUM]; 194 - }; 195 - 196 - static inline struct s5k4ecgx *to_s5k4ecgx(struct v4l2_subdev *sd) 197 - { 198 - return container_of(sd, struct s5k4ecgx, sd); 199 - } 200 - 201 - static int s5k4ecgx_i2c_read(struct i2c_client *client, u16 addr, u16 *val) 202 - { 203 - u8 wbuf[2] = { addr >> 8, addr & 0xff }; 204 - struct i2c_msg msg[2]; 205 - u8 rbuf[2]; 206 - int ret; 207 - 208 - msg[0].addr = client->addr; 209 - msg[0].flags = 0; 210 - msg[0].len = 2; 211 - msg[0].buf = wbuf; 212 - 213 - msg[1].addr = client->addr; 214 - msg[1].flags = I2C_M_RD; 215 - msg[1].len = 2; 216 - msg[1].buf = rbuf; 217 - 218 - ret = i2c_transfer(client->adapter, msg, 2); 219 - *val = be16_to_cpu(*((__be16 *)rbuf)); 220 - 221 - v4l2_dbg(4, debug, client, "i2c_read: 0x%04X : 0x%04x\n", addr, *val); 222 - 223 - return ret == 2 ? 0 : ret; 224 - } 225 - 226 - static int s5k4ecgx_i2c_write(struct i2c_client *client, u16 addr, u16 val) 227 - { 228 - u8 buf[4] = { addr >> 8, addr & 0xff, val >> 8, val & 0xff }; 229 - 230 - int ret = i2c_master_send(client, buf, 4); 231 - v4l2_dbg(4, debug, client, "i2c_write: 0x%04x : 0x%04x\n", addr, val); 232 - 233 - return ret == 4 ? 0 : ret; 234 - } 235 - 236 - static int s5k4ecgx_write(struct i2c_client *client, u32 addr, u16 val) 237 - { 238 - u16 high = addr >> 16, low = addr & 0xffff; 239 - int ret; 240 - 241 - v4l2_dbg(3, debug, client, "write: 0x%08x : 0x%04x\n", addr, val); 242 - 243 - ret = s5k4ecgx_i2c_write(client, REG_CMDWR_ADDRH, high); 244 - if (!ret) 245 - ret = s5k4ecgx_i2c_write(client, REG_CMDWR_ADDRL, low); 246 - if (!ret) 247 - ret = s5k4ecgx_i2c_write(client, REG_CMDBUF0_ADDR, val); 248 - 249 - return ret; 250 - } 251 - 252 - static int s5k4ecgx_read(struct i2c_client *client, u32 addr, u16 *val) 253 - { 254 - u16 high = addr >> 16, low = addr & 0xffff; 255 - int ret; 256 - 257 - ret = s5k4ecgx_i2c_write(client, REG_CMDRD_ADDRH, high); 258 - if (!ret) 259 - ret = s5k4ecgx_i2c_write(client, REG_CMDRD_ADDRL, low); 260 - if (!ret) 261 - ret = s5k4ecgx_i2c_read(client, REG_CMDBUF0_ADDR, val); 262 - 263 - return ret; 264 - } 265 - 266 - static int s5k4ecgx_read_fw_ver(struct v4l2_subdev *sd) 267 - { 268 - struct i2c_client *client = v4l2_get_subdevdata(sd); 269 - u16 hw_rev, fw_ver = 0; 270 - int ret; 271 - 272 - ret = s5k4ecgx_read(client, REG_FW_VERSION, &fw_ver); 273 - if (ret < 0 || fw_ver != S5K4ECGX_FW_VERSION) { 274 - v4l2_err(sd, "FW version check failed!\n"); 275 - return -ENODEV; 276 - } 277 - 278 - ret = s5k4ecgx_read(client, REG_FW_REVISION, &hw_rev); 279 - if (ret < 0) 280 - return ret; 281 - 282 - v4l2_info(sd, "chip found FW ver: 0x%x, HW rev: 0x%x\n", 283 - fw_ver, hw_rev); 284 - return 0; 285 - } 286 - 287 - static int s5k4ecgx_set_ahb_address(struct v4l2_subdev *sd) 288 - { 289 - struct i2c_client *client = v4l2_get_subdevdata(sd); 290 - int ret; 291 - 292 - /* Set APB peripherals start address */ 293 - ret = s5k4ecgx_i2c_write(client, AHB_MSB_ADDR_PTR, GEN_REG_OFFSH); 294 - if (ret < 0) 295 - return ret; 296 - /* 297 - * FIXME: This is copied from s5k6aa, because of no information 298 - * in s5k4ecgx's datasheet. 299 - * sw_reset is activated to put device into idle status 300 - */ 301 - ret = s5k4ecgx_i2c_write(client, 0x0010, 0x0001); 302 - if (ret < 0) 303 - return ret; 304 - 305 - ret = s5k4ecgx_i2c_write(client, 0x1030, 0x0000); 306 - if (ret < 0) 307 - return ret; 308 - /* Halt ARM CPU */ 309 - return s5k4ecgx_i2c_write(client, 0x0014, 0x0001); 310 - } 311 - 312 - #define FW_CRC_SIZE 4 313 - /* Register address, value are 4, 2 bytes */ 314 - #define FW_RECORD_SIZE 6 315 - /* 316 - * The firmware has following format: 317 - * < total number of records (4 bytes + 2 bytes padding) N >, 318 - * < record 0 >, ..., < record N - 1 >, < CRC32-CCITT (4-bytes) >, 319 - * where "record" is a 4-byte register address followed by 2-byte 320 - * register value (little endian). 321 - * The firmware generator can be found in following git repository: 322 - * git://git.linaro.org/people/sangwook/fimc-v4l2-app.git 323 - */ 324 - static int s5k4ecgx_load_firmware(struct v4l2_subdev *sd) 325 - { 326 - struct i2c_client *client = v4l2_get_subdevdata(sd); 327 - const struct firmware *fw; 328 - const u8 *ptr; 329 - int err, i, regs_num; 330 - u32 addr, crc, crc_file, addr_inc = 0; 331 - u16 val; 332 - 333 - err = request_firmware(&fw, S5K4ECGX_FIRMWARE, sd->v4l2_dev->dev); 334 - if (err) { 335 - v4l2_err(sd, "Failed to read firmware %s\n", S5K4ECGX_FIRMWARE); 336 - return err; 337 - } 338 - regs_num = get_unaligned_le32(fw->data); 339 - 340 - v4l2_dbg(3, debug, sd, "FW: %s size %zu register sets %d\n", 341 - S5K4ECGX_FIRMWARE, fw->size, regs_num); 342 - 343 - regs_num++; /* Add header */ 344 - if (fw->size != regs_num * FW_RECORD_SIZE + FW_CRC_SIZE) { 345 - err = -EINVAL; 346 - goto fw_out; 347 - } 348 - crc_file = get_unaligned_le32(fw->data + regs_num * FW_RECORD_SIZE); 349 - crc = crc32_le(~0, fw->data, regs_num * FW_RECORD_SIZE); 350 - if (crc != crc_file) { 351 - v4l2_err(sd, "FW: invalid crc (%#x:%#x)\n", crc, crc_file); 352 - err = -EINVAL; 353 - goto fw_out; 354 - } 355 - ptr = fw->data + FW_RECORD_SIZE; 356 - for (i = 1; i < regs_num; i++) { 357 - addr = get_unaligned_le32(ptr); 358 - ptr += sizeof(u32); 359 - val = get_unaligned_le16(ptr); 360 - ptr += sizeof(u16); 361 - if (addr - addr_inc != 2) 362 - err = s5k4ecgx_write(client, addr, val); 363 - else 364 - err = s5k4ecgx_i2c_write(client, REG_CMDBUF0_ADDR, val); 365 - if (err) 366 - break; 367 - addr_inc = addr; 368 - } 369 - fw_out: 370 - release_firmware(fw); 371 - return err; 372 - } 373 - 374 - /* Set preview and capture input window */ 375 - static int s5k4ecgx_set_input_window(struct i2c_client *c, 376 - const struct v4l2_rect *r) 377 - { 378 - int ret; 379 - 380 - ret = s5k4ecgx_write(c, REG_G_PREV_IN_WIDTH, r->width); 381 - if (!ret) 382 - ret = s5k4ecgx_write(c, REG_G_PREV_IN_HEIGHT, r->height); 383 - if (!ret) 384 - ret = s5k4ecgx_write(c, REG_G_PREV_IN_XOFFS, r->left); 385 - if (!ret) 386 - ret = s5k4ecgx_write(c, REG_G_PREV_IN_YOFFS, r->top); 387 - if (!ret) 388 - ret = s5k4ecgx_write(c, REG_G_CAP_IN_WIDTH, r->width); 389 - if (!ret) 390 - ret = s5k4ecgx_write(c, REG_G_CAP_IN_HEIGHT, r->height); 391 - if (!ret) 392 - ret = s5k4ecgx_write(c, REG_G_CAP_IN_XOFFS, r->left); 393 - if (!ret) 394 - ret = s5k4ecgx_write(c, REG_G_CAP_IN_YOFFS, r->top); 395 - 396 - return ret; 397 - } 398 - 399 - /* Set preview and capture zoom input window */ 400 - static int s5k4ecgx_set_zoom_window(struct i2c_client *c, 401 - const struct v4l2_rect *r) 402 - { 403 - int ret; 404 - 405 - ret = s5k4ecgx_write(c, REG_G_PREVZOOM_IN_WIDTH, r->width); 406 - if (!ret) 407 - ret = s5k4ecgx_write(c, REG_G_PREVZOOM_IN_HEIGHT, r->height); 408 - if (!ret) 409 - ret = s5k4ecgx_write(c, REG_G_PREVZOOM_IN_XOFFS, r->left); 410 - if (!ret) 411 - ret = s5k4ecgx_write(c, REG_G_PREVZOOM_IN_YOFFS, r->top); 412 - if (!ret) 413 - ret = s5k4ecgx_write(c, REG_G_CAPZOOM_IN_WIDTH, r->width); 414 - if (!ret) 415 - ret = s5k4ecgx_write(c, REG_G_CAPZOOM_IN_HEIGHT, r->height); 416 - if (!ret) 417 - ret = s5k4ecgx_write(c, REG_G_CAPZOOM_IN_XOFFS, r->left); 418 - if (!ret) 419 - ret = s5k4ecgx_write(c, REG_G_CAPZOOM_IN_YOFFS, r->top); 420 - 421 - return ret; 422 - } 423 - 424 - static int s5k4ecgx_set_output_framefmt(struct s5k4ecgx *priv) 425 - { 426 - struct i2c_client *client = v4l2_get_subdevdata(&priv->sd); 427 - int ret; 428 - 429 - ret = s5k4ecgx_write(client, REG_P_OUT_WIDTH(0), 430 - priv->curr_frmsize->size.width); 431 - if (!ret) 432 - ret = s5k4ecgx_write(client, REG_P_OUT_HEIGHT(0), 433 - priv->curr_frmsize->size.height); 434 - if (!ret) 435 - ret = s5k4ecgx_write(client, REG_P_FMT(0), 436 - priv->curr_pixfmt->reg_p_format); 437 - return ret; 438 - } 439 - 440 - static int s5k4ecgx_init_sensor(struct v4l2_subdev *sd) 441 - { 442 - int ret; 443 - 444 - ret = s5k4ecgx_set_ahb_address(sd); 445 - 446 - /* The delay is from manufacturer's settings */ 447 - msleep(100); 448 - 449 - if (!ret) 450 - ret = s5k4ecgx_load_firmware(sd); 451 - if (ret) 452 - v4l2_err(sd, "Failed to write initial settings\n"); 453 - 454 - return ret; 455 - } 456 - 457 - static int s5k4ecgx_gpio_set_value(struct s5k4ecgx *priv, int id, u32 val) 458 - { 459 - if (!gpio_is_valid(priv->gpio[id].gpio)) 460 - return 0; 461 - gpio_set_value(priv->gpio[id].gpio, val); 462 - 463 - return 1; 464 - } 465 - 466 - static int __s5k4ecgx_power_on(struct s5k4ecgx *priv) 467 - { 468 - int ret; 469 - 470 - ret = regulator_bulk_enable(S5K4ECGX_NUM_SUPPLIES, priv->supplies); 471 - if (ret) 472 - return ret; 473 - usleep_range(30, 50); 474 - 475 - /* The polarity of STBY is controlled by TSP */ 476 - if (s5k4ecgx_gpio_set_value(priv, STBY, priv->gpio[STBY].level)) 477 - usleep_range(30, 50); 478 - 479 - if (s5k4ecgx_gpio_set_value(priv, RSET, priv->gpio[RSET].level)) 480 - usleep_range(30, 50); 481 - 482 - return 0; 483 - } 484 - 485 - static int __s5k4ecgx_power_off(struct s5k4ecgx *priv) 486 - { 487 - if (s5k4ecgx_gpio_set_value(priv, RSET, !priv->gpio[RSET].level)) 488 - usleep_range(30, 50); 489 - 490 - if (s5k4ecgx_gpio_set_value(priv, STBY, !priv->gpio[STBY].level)) 491 - usleep_range(30, 50); 492 - 493 - priv->streaming = 0; 494 - 495 - return regulator_bulk_disable(S5K4ECGX_NUM_SUPPLIES, priv->supplies); 496 - } 497 - 498 - /* Find nearest matching image pixel size. */ 499 - static int s5k4ecgx_try_frame_size(struct v4l2_mbus_framefmt *mf, 500 - const struct s5k4ecgx_frmsize **size) 501 - { 502 - unsigned int min_err = ~0; 503 - int i = ARRAY_SIZE(s5k4ecgx_prev_sizes); 504 - const struct s5k4ecgx_frmsize *fsize = &s5k4ecgx_prev_sizes[0], 505 - *match = NULL; 506 - 507 - while (i--) { 508 - int err = abs(fsize->size.width - mf->width) 509 - + abs(fsize->size.height - mf->height); 510 - if (err < min_err) { 511 - min_err = err; 512 - match = fsize; 513 - } 514 - fsize++; 515 - } 516 - if (match) { 517 - mf->width = match->size.width; 518 - mf->height = match->size.height; 519 - if (size) 520 - *size = match; 521 - return 0; 522 - } 523 - 524 - return -EINVAL; 525 - } 526 - 527 - static int s5k4ecgx_enum_mbus_code(struct v4l2_subdev *sd, 528 - struct v4l2_subdev_state *sd_state, 529 - struct v4l2_subdev_mbus_code_enum *code) 530 - { 531 - if (code->index >= ARRAY_SIZE(s5k4ecgx_formats)) 532 - return -EINVAL; 533 - code->code = s5k4ecgx_formats[code->index].code; 534 - 535 - return 0; 536 - } 537 - 538 - static int s5k4ecgx_get_fmt(struct v4l2_subdev *sd, 539 - struct v4l2_subdev_state *sd_state, 540 - struct v4l2_subdev_format *fmt) 541 - { 542 - struct s5k4ecgx *priv = to_s5k4ecgx(sd); 543 - struct v4l2_mbus_framefmt *mf; 544 - 545 - if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 546 - if (sd_state) { 547 - mf = v4l2_subdev_get_try_format(sd, sd_state, 0); 548 - fmt->format = *mf; 549 - } 550 - return 0; 551 - } 552 - 553 - mf = &fmt->format; 554 - 555 - mutex_lock(&priv->lock); 556 - mf->width = priv->curr_frmsize->size.width; 557 - mf->height = priv->curr_frmsize->size.height; 558 - mf->code = priv->curr_pixfmt->code; 559 - mf->colorspace = priv->curr_pixfmt->colorspace; 560 - mf->field = V4L2_FIELD_NONE; 561 - mutex_unlock(&priv->lock); 562 - 563 - return 0; 564 - } 565 - 566 - static const struct s5k4ecgx_pixfmt *s5k4ecgx_try_fmt(struct v4l2_subdev *sd, 567 - struct v4l2_mbus_framefmt *mf) 568 - { 569 - int i = ARRAY_SIZE(s5k4ecgx_formats); 570 - 571 - while (--i) 572 - if (mf->code == s5k4ecgx_formats[i].code) 573 - break; 574 - mf->code = s5k4ecgx_formats[i].code; 575 - 576 - return &s5k4ecgx_formats[i]; 577 - } 578 - 579 - static int s5k4ecgx_set_fmt(struct v4l2_subdev *sd, 580 - struct v4l2_subdev_state *sd_state, 581 - struct v4l2_subdev_format *fmt) 582 - { 583 - struct s5k4ecgx *priv = to_s5k4ecgx(sd); 584 - const struct s5k4ecgx_frmsize *fsize = NULL; 585 - const struct s5k4ecgx_pixfmt *pf; 586 - struct v4l2_mbus_framefmt *mf; 587 - int ret = 0; 588 - 589 - pf = s5k4ecgx_try_fmt(sd, &fmt->format); 590 - s5k4ecgx_try_frame_size(&fmt->format, &fsize); 591 - fmt->format.colorspace = V4L2_COLORSPACE_JPEG; 592 - fmt->format.field = V4L2_FIELD_NONE; 593 - 594 - if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 595 - if (sd_state) { 596 - mf = v4l2_subdev_get_try_format(sd, sd_state, 0); 597 - *mf = fmt->format; 598 - } 599 - return 0; 600 - } 601 - 602 - mutex_lock(&priv->lock); 603 - if (!priv->streaming) { 604 - priv->curr_frmsize = fsize; 605 - priv->curr_pixfmt = pf; 606 - priv->set_params = 1; 607 - } else { 608 - ret = -EBUSY; 609 - } 610 - mutex_unlock(&priv->lock); 611 - 612 - return ret; 613 - } 614 - 615 - static const struct v4l2_subdev_pad_ops s5k4ecgx_pad_ops = { 616 - .enum_mbus_code = s5k4ecgx_enum_mbus_code, 617 - .get_fmt = s5k4ecgx_get_fmt, 618 - .set_fmt = s5k4ecgx_set_fmt, 619 - }; 620 - 621 - /* 622 - * V4L2 subdev controls 623 - */ 624 - static int s5k4ecgx_s_ctrl(struct v4l2_ctrl *ctrl) 625 - { 626 - struct v4l2_subdev *sd = &container_of(ctrl->handler, struct s5k4ecgx, 627 - handler)->sd; 628 - struct i2c_client *client = v4l2_get_subdevdata(sd); 629 - struct s5k4ecgx *priv = to_s5k4ecgx(sd); 630 - unsigned int i; 631 - int err = 0; 632 - 633 - v4l2_dbg(1, debug, sd, "ctrl: 0x%x, value: %d\n", ctrl->id, ctrl->val); 634 - 635 - mutex_lock(&priv->lock); 636 - switch (ctrl->id) { 637 - case V4L2_CID_CONTRAST: 638 - err = s5k4ecgx_write(client, REG_USER_CONTRAST, ctrl->val); 639 - break; 640 - 641 - case V4L2_CID_SATURATION: 642 - err = s5k4ecgx_write(client, REG_USER_SATURATION, ctrl->val); 643 - break; 644 - 645 - case V4L2_CID_SHARPNESS: 646 - /* TODO: Revisit, is this setting for all presets ? */ 647 - for (i = 0; i < 4 && !err; i++) 648 - err = s5k4ecgx_write(client, REG_USER_SHARPNESS(i), 649 - ctrl->val * SHARPNESS_DIV); 650 - break; 651 - 652 - case V4L2_CID_BRIGHTNESS: 653 - err = s5k4ecgx_write(client, REG_USER_BRIGHTNESS, ctrl->val); 654 - break; 655 - } 656 - mutex_unlock(&priv->lock); 657 - if (err < 0) 658 - v4l2_err(sd, "Failed to write s_ctrl err %d\n", err); 659 - 660 - return err; 661 - } 662 - 663 - static const struct v4l2_ctrl_ops s5k4ecgx_ctrl_ops = { 664 - .s_ctrl = s5k4ecgx_s_ctrl, 665 - }; 666 - 667 - /* 668 - * Reading s5k4ecgx version information 669 - */ 670 - static int s5k4ecgx_registered(struct v4l2_subdev *sd) 671 - { 672 - int ret; 673 - struct s5k4ecgx *priv = to_s5k4ecgx(sd); 674 - 675 - mutex_lock(&priv->lock); 676 - ret = __s5k4ecgx_power_on(priv); 677 - if (!ret) { 678 - ret = s5k4ecgx_read_fw_ver(sd); 679 - __s5k4ecgx_power_off(priv); 680 - } 681 - mutex_unlock(&priv->lock); 682 - 683 - return ret; 684 - } 685 - 686 - /* 687 - * V4L2 subdev internal operations 688 - */ 689 - static int s5k4ecgx_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 690 - { 691 - struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(sd, 692 - fh->state, 693 - 0); 694 - 695 - mf->width = s5k4ecgx_prev_sizes[0].size.width; 696 - mf->height = s5k4ecgx_prev_sizes[0].size.height; 697 - mf->code = s5k4ecgx_formats[0].code; 698 - mf->colorspace = V4L2_COLORSPACE_JPEG; 699 - mf->field = V4L2_FIELD_NONE; 700 - 701 - return 0; 702 - } 703 - 704 - static const struct v4l2_subdev_internal_ops s5k4ecgx_subdev_internal_ops = { 705 - .registered = s5k4ecgx_registered, 706 - .open = s5k4ecgx_open, 707 - }; 708 - 709 - static int s5k4ecgx_s_power(struct v4l2_subdev *sd, int on) 710 - { 711 - struct s5k4ecgx *priv = to_s5k4ecgx(sd); 712 - int ret; 713 - 714 - v4l2_dbg(1, debug, sd, "Switching %s\n", on ? "on" : "off"); 715 - 716 - if (on) { 717 - ret = __s5k4ecgx_power_on(priv); 718 - if (ret < 0) 719 - return ret; 720 - /* Time to stabilize sensor */ 721 - msleep(100); 722 - ret = s5k4ecgx_init_sensor(sd); 723 - if (ret < 0) 724 - __s5k4ecgx_power_off(priv); 725 - else 726 - priv->set_params = 1; 727 - } else { 728 - ret = __s5k4ecgx_power_off(priv); 729 - } 730 - 731 - return ret; 732 - } 733 - 734 - static int s5k4ecgx_log_status(struct v4l2_subdev *sd) 735 - { 736 - v4l2_ctrl_handler_log_status(sd->ctrl_handler, sd->name); 737 - 738 - return 0; 739 - } 740 - 741 - static const struct v4l2_subdev_core_ops s5k4ecgx_core_ops = { 742 - .s_power = s5k4ecgx_s_power, 743 - .log_status = s5k4ecgx_log_status, 744 - }; 745 - 746 - static int __s5k4ecgx_s_params(struct s5k4ecgx *priv) 747 - { 748 - struct i2c_client *client = v4l2_get_subdevdata(&priv->sd); 749 - const struct v4l2_rect *crop_rect = &priv->curr_frmsize->input_window; 750 - int ret; 751 - 752 - ret = s5k4ecgx_set_input_window(client, crop_rect); 753 - if (!ret) 754 - ret = s5k4ecgx_set_zoom_window(client, crop_rect); 755 - if (!ret) 756 - ret = s5k4ecgx_write(client, REG_G_INPUTS_CHANGE_REQ, 1); 757 - if (!ret) 758 - ret = s5k4ecgx_write(client, 0x70000a1e, 0x28); 759 - if (!ret) 760 - ret = s5k4ecgx_write(client, 0x70000ad4, 0x3c); 761 - if (!ret) 762 - ret = s5k4ecgx_set_output_framefmt(priv); 763 - if (!ret) 764 - ret = s5k4ecgx_write(client, REG_P_PVI_MASK(0), 0x52); 765 - if (!ret) 766 - ret = s5k4ecgx_write(client, REG_P_FR_TIME_TYPE(0), 767 - FR_TIME_DYNAMIC); 768 - if (!ret) 769 - ret = s5k4ecgx_write(client, REG_P_FR_TIME_Q_TYPE(0), 770 - FR_TIME_Q_BEST_FRRATE); 771 - if (!ret) 772 - ret = s5k4ecgx_write(client, REG_P_MIN_FR_TIME(0), 773 - US_TO_FR_TIME(33300)); 774 - if (!ret) 775 - ret = s5k4ecgx_write(client, REG_P_MAX_FR_TIME(0), 776 - US_TO_FR_TIME(66600)); 777 - if (!ret) 778 - ret = s5k4ecgx_write(client, REG_P_PREV_MIRROR(0), 0); 779 - if (!ret) 780 - ret = s5k4ecgx_write(client, REG_P_CAP_MIRROR(0), 0); 781 - if (!ret) 782 - ret = s5k4ecgx_write(client, REG_G_ACTIVE_PREV_CFG, 0); 783 - if (!ret) 784 - ret = s5k4ecgx_write(client, REG_G_PREV_OPEN_AFTER_CH, 1); 785 - if (!ret) 786 - ret = s5k4ecgx_write(client, REG_G_NEW_CFG_SYNC, 1); 787 - if (!ret) 788 - ret = s5k4ecgx_write(client, REG_G_PREV_CFG_CHG, 1); 789 - 790 - return ret; 791 - } 792 - 793 - static int __s5k4ecgx_s_stream(struct s5k4ecgx *priv, int on) 794 - { 795 - struct i2c_client *client = v4l2_get_subdevdata(&priv->sd); 796 - int ret; 797 - 798 - if (on && priv->set_params) { 799 - ret = __s5k4ecgx_s_params(priv); 800 - if (ret < 0) 801 - return ret; 802 - priv->set_params = 0; 803 - } 804 - /* 805 - * This enables/disables preview stream only. Capture requests 806 - * are not supported yet. 807 - */ 808 - ret = s5k4ecgx_write(client, REG_G_ENABLE_PREV, on); 809 - if (ret < 0) 810 - return ret; 811 - return s5k4ecgx_write(client, REG_G_ENABLE_PREV_CHG, 1); 812 - } 813 - 814 - static int s5k4ecgx_s_stream(struct v4l2_subdev *sd, int on) 815 - { 816 - struct s5k4ecgx *priv = to_s5k4ecgx(sd); 817 - int ret = 0; 818 - 819 - v4l2_dbg(1, debug, sd, "Turn streaming %s\n", on ? "on" : "off"); 820 - 821 - mutex_lock(&priv->lock); 822 - 823 - if (priv->streaming == !on) { 824 - ret = __s5k4ecgx_s_stream(priv, on); 825 - if (!ret) 826 - priv->streaming = on & 1; 827 - } 828 - 829 - mutex_unlock(&priv->lock); 830 - return ret; 831 - } 832 - 833 - static const struct v4l2_subdev_video_ops s5k4ecgx_video_ops = { 834 - .s_stream = s5k4ecgx_s_stream, 835 - }; 836 - 837 - static const struct v4l2_subdev_ops s5k4ecgx_ops = { 838 - .core = &s5k4ecgx_core_ops, 839 - .pad = &s5k4ecgx_pad_ops, 840 - .video = &s5k4ecgx_video_ops, 841 - }; 842 - 843 - /* 844 - * GPIO setup 845 - */ 846 - static int s5k4ecgx_config_gpio(int nr, int val, const char *name) 847 - { 848 - unsigned long flags = val ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW; 849 - int ret; 850 - 851 - if (!gpio_is_valid(nr)) 852 - return 0; 853 - ret = gpio_request_one(nr, flags, name); 854 - if (!ret) 855 - gpio_export(nr, 0); 856 - 857 - return ret; 858 - } 859 - 860 - static void s5k4ecgx_free_gpios(struct s5k4ecgx *priv) 861 - { 862 - int i; 863 - 864 - for (i = 0; i < ARRAY_SIZE(priv->gpio); i++) { 865 - if (!gpio_is_valid(priv->gpio[i].gpio)) 866 - continue; 867 - gpio_free(priv->gpio[i].gpio); 868 - priv->gpio[i].gpio = -EINVAL; 869 - } 870 - } 871 - 872 - static int s5k4ecgx_config_gpios(struct s5k4ecgx *priv, 873 - const struct s5k4ecgx_platform_data *pdata) 874 - { 875 - const struct s5k4ecgx_gpio *gpio = &pdata->gpio_stby; 876 - int ret; 877 - 878 - priv->gpio[STBY].gpio = -EINVAL; 879 - priv->gpio[RSET].gpio = -EINVAL; 880 - 881 - ret = s5k4ecgx_config_gpio(gpio->gpio, gpio->level, "S5K4ECGX_STBY"); 882 - 883 - if (ret) { 884 - s5k4ecgx_free_gpios(priv); 885 - return ret; 886 - } 887 - priv->gpio[STBY] = *gpio; 888 - if (gpio_is_valid(gpio->gpio)) 889 - gpio_set_value(gpio->gpio, 0); 890 - 891 - gpio = &pdata->gpio_reset; 892 - 893 - ret = s5k4ecgx_config_gpio(gpio->gpio, gpio->level, "S5K4ECGX_RST"); 894 - if (ret) { 895 - s5k4ecgx_free_gpios(priv); 896 - return ret; 897 - } 898 - priv->gpio[RSET] = *gpio; 899 - if (gpio_is_valid(gpio->gpio)) 900 - gpio_set_value(gpio->gpio, 0); 901 - 902 - return 0; 903 - } 904 - 905 - static int s5k4ecgx_init_v4l2_ctrls(struct s5k4ecgx *priv) 906 - { 907 - const struct v4l2_ctrl_ops *ops = &s5k4ecgx_ctrl_ops; 908 - struct v4l2_ctrl_handler *hdl = &priv->handler; 909 - int ret; 910 - 911 - ret = v4l2_ctrl_handler_init(hdl, 4); 912 - if (ret) 913 - return ret; 914 - 915 - v4l2_ctrl_new_std(hdl, ops, V4L2_CID_BRIGHTNESS, -208, 127, 1, 0); 916 - v4l2_ctrl_new_std(hdl, ops, V4L2_CID_CONTRAST, -127, 127, 1, 0); 917 - v4l2_ctrl_new_std(hdl, ops, V4L2_CID_SATURATION, -127, 127, 1, 0); 918 - 919 - /* Sharpness default is 24612, and then (24612/SHARPNESS_DIV) = 2 */ 920 - v4l2_ctrl_new_std(hdl, ops, V4L2_CID_SHARPNESS, -32704/SHARPNESS_DIV, 921 - 24612/SHARPNESS_DIV, 1, 2); 922 - if (hdl->error) { 923 - ret = hdl->error; 924 - v4l2_ctrl_handler_free(hdl); 925 - return ret; 926 - } 927 - priv->sd.ctrl_handler = hdl; 928 - 929 - return 0; 930 - }; 931 - 932 - static int s5k4ecgx_probe(struct i2c_client *client) 933 - { 934 - struct s5k4ecgx_platform_data *pdata = client->dev.platform_data; 935 - struct v4l2_subdev *sd; 936 - struct s5k4ecgx *priv; 937 - int ret, i; 938 - 939 - if (pdata == NULL) { 940 - dev_err(&client->dev, "platform data is missing!\n"); 941 - return -EINVAL; 942 - } 943 - 944 - priv = devm_kzalloc(&client->dev, sizeof(struct s5k4ecgx), GFP_KERNEL); 945 - if (!priv) 946 - return -ENOMEM; 947 - 948 - mutex_init(&priv->lock); 949 - priv->streaming = 0; 950 - 951 - sd = &priv->sd; 952 - /* Registering subdev */ 953 - v4l2_i2c_subdev_init(sd, client, &s5k4ecgx_ops); 954 - /* Static name; NEVER use in new drivers! */ 955 - strscpy(sd->name, S5K4ECGX_DRIVER_NAME, sizeof(sd->name)); 956 - 957 - sd->internal_ops = &s5k4ecgx_subdev_internal_ops; 958 - /* Support v4l2 sub-device user space API */ 959 - sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; 960 - 961 - priv->pad.flags = MEDIA_PAD_FL_SOURCE; 962 - sd->entity.function = MEDIA_ENT_F_CAM_SENSOR; 963 - ret = media_entity_pads_init(&sd->entity, 1, &priv->pad); 964 - if (ret) 965 - return ret; 966 - 967 - ret = s5k4ecgx_config_gpios(priv, pdata); 968 - if (ret) { 969 - dev_err(&client->dev, "Failed to set gpios\n"); 970 - goto out_err1; 971 - } 972 - for (i = 0; i < S5K4ECGX_NUM_SUPPLIES; i++) 973 - priv->supplies[i].supply = s5k4ecgx_supply_names[i]; 974 - 975 - ret = devm_regulator_bulk_get(&client->dev, S5K4ECGX_NUM_SUPPLIES, 976 - priv->supplies); 977 - if (ret) { 978 - dev_err(&client->dev, "Failed to get regulators\n"); 979 - goto out_err2; 980 - } 981 - ret = s5k4ecgx_init_v4l2_ctrls(priv); 982 - if (ret) 983 - goto out_err2; 984 - 985 - priv->curr_pixfmt = &s5k4ecgx_formats[0]; 986 - priv->curr_frmsize = &s5k4ecgx_prev_sizes[0]; 987 - 988 - return 0; 989 - 990 - out_err2: 991 - s5k4ecgx_free_gpios(priv); 992 - out_err1: 993 - media_entity_cleanup(&priv->sd.entity); 994 - 995 - return ret; 996 - } 997 - 998 - static void s5k4ecgx_remove(struct i2c_client *client) 999 - { 1000 - struct v4l2_subdev *sd = i2c_get_clientdata(client); 1001 - struct s5k4ecgx *priv = to_s5k4ecgx(sd); 1002 - 1003 - mutex_destroy(&priv->lock); 1004 - s5k4ecgx_free_gpios(priv); 1005 - v4l2_device_unregister_subdev(sd); 1006 - v4l2_ctrl_handler_free(&priv->handler); 1007 - media_entity_cleanup(&sd->entity); 1008 - } 1009 - 1010 - static const struct i2c_device_id s5k4ecgx_id[] = { 1011 - { S5K4ECGX_DRIVER_NAME, 0 }, 1012 - {} 1013 - }; 1014 - MODULE_DEVICE_TABLE(i2c, s5k4ecgx_id); 1015 - 1016 - static struct i2c_driver v4l2_i2c_driver = { 1017 - .driver = { 1018 - .name = S5K4ECGX_DRIVER_NAME, 1019 - }, 1020 - .probe_new = s5k4ecgx_probe, 1021 - .remove = s5k4ecgx_remove, 1022 - .id_table = s5k4ecgx_id, 1023 - }; 1024 - 1025 - module_i2c_driver(v4l2_i2c_driver); 1026 - 1027 - MODULE_DESCRIPTION("Samsung S5K4ECGX 5MP SOC camera"); 1028 - MODULE_AUTHOR("Sangwook Lee <sangwook.lee@linaro.org>"); 1029 - MODULE_AUTHOR("Seok-Young Jang <quartz.jang@samsung.com>"); 1030 - MODULE_LICENSE("GPL"); 1031 - MODULE_FIRMWARE(S5K4ECGX_FIRMWARE);
+18 -46
drivers/media/i2c/s5k5baf.c
··· 13 13 #include <linux/clk.h> 14 14 #include <linux/delay.h> 15 15 #include <linux/firmware.h> 16 - #include <linux/gpio.h> 16 + #include <linux/gpio/consumer.h> 17 17 #include <linux/i2c.h> 18 18 #include <linux/media.h> 19 19 #include <linux/module.h> 20 - #include <linux/of_gpio.h> 21 20 #include <linux/of_graph.h> 22 21 #include <linux/regulator/consumer.h> 23 22 #include <linux/slab.h> ··· 227 228 }; 228 229 #define S5K5BAF_NUM_SUPPLIES ARRAY_SIZE(s5k5baf_supply_names) 229 230 230 - struct s5k5baf_gpio { 231 - int gpio; 232 - int level; 233 - }; 234 - 235 231 enum s5k5baf_gpio_id { 236 232 STBY, 237 233 RSET, ··· 278 284 }; 279 285 280 286 struct s5k5baf { 281 - struct s5k5baf_gpio gpios[NUM_GPIOS]; 287 + struct gpio_desc *gpios[NUM_GPIOS]; 282 288 enum v4l2_mbus_type bus_type; 283 289 u8 nlanes; 284 290 struct regulator_bulk_data supplies[S5K5BAF_NUM_SUPPLIES]; ··· 930 936 931 937 static void s5k5baf_gpio_assert(struct s5k5baf *state, int id) 932 938 { 933 - struct s5k5baf_gpio *gpio = &state->gpios[id]; 934 - 935 - gpio_set_value(gpio->gpio, gpio->level); 939 + gpiod_set_value_cansleep(state->gpios[id], 1); 936 940 } 937 941 938 942 static void s5k5baf_gpio_deassert(struct s5k5baf *state, int id) 939 943 { 940 - struct s5k5baf_gpio *gpio = &state->gpios[id]; 941 - 942 - gpio_set_value(gpio->gpio, !gpio->level); 944 + gpiod_set_value_cansleep(state->gpios[id], 0); 943 945 } 944 946 945 947 static int s5k5baf_power_on(struct s5k5baf *state) ··· 1789 1799 1790 1800 static int s5k5baf_configure_gpios(struct s5k5baf *state) 1791 1801 { 1792 - static const char * const name[] = { "S5K5BAF_STBY", "S5K5BAF_RST" }; 1802 + static const char * const name[] = { "stbyn", "rstn" }; 1803 + static const char * const label[] = { "S5K5BAF_STBY", "S5K5BAF_RST" }; 1793 1804 struct i2c_client *c = v4l2_get_subdevdata(&state->sd); 1794 - struct s5k5baf_gpio *g = state->gpios; 1805 + struct gpio_desc *gpio; 1795 1806 int ret, i; 1796 1807 1797 1808 for (i = 0; i < NUM_GPIOS; ++i) { 1798 - int flags = GPIOF_DIR_OUT; 1799 - if (g[i].level) 1800 - flags |= GPIOF_INIT_HIGH; 1801 - ret = devm_gpio_request_one(&c->dev, g[i].gpio, flags, name[i]); 1802 - if (ret < 0) { 1803 - v4l2_err(c, "failed to request gpio %s\n", name[i]); 1809 + gpio = devm_gpiod_get(&c->dev, name[i], GPIOD_OUT_HIGH); 1810 + ret = PTR_ERR_OR_ZERO(gpio); 1811 + if (ret) { 1812 + v4l2_err(c, "failed to request gpio %s: %d\n", 1813 + name[i], ret); 1804 1814 return ret; 1805 1815 } 1806 - } 1807 - return 0; 1808 - } 1809 1816 1810 - static int s5k5baf_parse_gpios(struct s5k5baf_gpio *gpios, struct device *dev) 1811 - { 1812 - static const char * const names[] = { 1813 - "stbyn-gpios", 1814 - "rstn-gpios", 1815 - }; 1816 - struct device_node *node = dev->of_node; 1817 - enum of_gpio_flags flags; 1818 - int ret, i; 1819 - 1820 - for (i = 0; i < NUM_GPIOS; ++i) { 1821 - ret = of_get_named_gpio_flags(node, names[i], 0, &flags); 1822 - if (ret < 0) { 1823 - dev_err(dev, "no %s GPIO pin provided\n", names[i]); 1817 + ret = gpiod_set_consumer_name(gpio, label[i]); 1818 + if (ret) { 1819 + v4l2_err(c, "failed to set up name for gpio %s: %d\n", 1820 + name[i], ret); 1824 1821 return ret; 1825 1822 } 1826 - gpios[i].gpio = ret; 1827 - gpios[i].level = !(flags & OF_GPIO_ACTIVE_LOW); 1828 - } 1829 1823 1824 + state->gpios[i] = gpio; 1825 + } 1830 1826 return 0; 1831 1827 } 1832 1828 ··· 1835 1859 dev_info(dev, "using default %u Hz clock frequency\n", 1836 1860 state->mclk_frequency); 1837 1861 } 1838 - 1839 - ret = s5k5baf_parse_gpios(state->gpios, dev); 1840 - if (ret < 0) 1841 - return ret; 1842 1862 1843 1863 node_ep = of_graph_get_next_endpoint(node, NULL); 1844 1864 if (!node_ep) {
+11 -19
drivers/media/i2c/s5k6a3.c
··· 9 9 #include <linux/clk.h> 10 10 #include <linux/delay.h> 11 11 #include <linux/device.h> 12 + #include <linux/err.h> 12 13 #include <linux/errno.h> 13 - #include <linux/gpio.h> 14 + #include <linux/gpio/consumer.h> 14 15 #include <linux/i2c.h> 15 16 #include <linux/kernel.h> 16 17 #include <linux/module.h> 17 - #include <linux/of_gpio.h> 18 18 #include <linux/pm_runtime.h> 19 19 #include <linux/regulator/consumer.h> 20 20 #include <linux/slab.h> ··· 59 59 struct v4l2_subdev subdev; 60 60 struct media_pad pad; 61 61 struct regulator_bulk_data supplies[S5K6A3_NUM_SUPPLIES]; 62 - int gpio_reset; 62 + struct gpio_desc *gpio_reset; 63 63 struct mutex lock; 64 64 struct v4l2_mbus_framefmt format; 65 65 struct clk *clock; ··· 216 216 goto error_clk; 217 217 } 218 218 219 - gpio_set_value(sensor->gpio_reset, 1); 219 + gpiod_set_value_cansleep(sensor->gpio_reset, 0); 220 220 usleep_range(600, 800); 221 - gpio_set_value(sensor->gpio_reset, 0); 221 + gpiod_set_value_cansleep(sensor->gpio_reset, 1); 222 222 usleep_range(600, 800); 223 - gpio_set_value(sensor->gpio_reset, 1); 223 + gpiod_set_value_cansleep(sensor->gpio_reset, 0); 224 224 225 225 /* Delay needed for the sensor initialization */ 226 226 msleep(20); ··· 240 240 { 241 241 int i; 242 242 243 - gpio_set_value(sensor->gpio_reset, 0); 243 + gpiod_set_value_cansleep(sensor->gpio_reset, 1); 244 244 245 245 for (i = S5K6A3_NUM_SUPPLIES - 1; i >= 0; i--) 246 246 regulator_disable(sensor->supplies[i].consumer); ··· 285 285 struct device *dev = &client->dev; 286 286 struct s5k6a3 *sensor; 287 287 struct v4l2_subdev *sd; 288 - int gpio, i, ret; 288 + int i, ret; 289 289 290 290 sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); 291 291 if (!sensor) 292 292 return -ENOMEM; 293 293 294 294 mutex_init(&sensor->lock); 295 - sensor->gpio_reset = -EINVAL; 296 - sensor->clock = ERR_PTR(-EINVAL); 297 295 sensor->dev = dev; 298 296 299 297 sensor->clock = devm_clk_get(sensor->dev, S5K6A3_CLK_NAME); 300 298 if (IS_ERR(sensor->clock)) 301 299 return PTR_ERR(sensor->clock); 302 300 303 - gpio = of_get_gpio_flags(dev->of_node, 0, NULL); 304 - if (!gpio_is_valid(gpio)) 305 - return gpio; 306 - 307 - ret = devm_gpio_request_one(dev, gpio, GPIOF_OUT_INIT_LOW, 308 - S5K6A3_DRV_NAME); 309 - if (ret < 0) 301 + sensor->gpio_reset = devm_gpiod_get(dev, NULL, GPIOD_OUT_HIGH); 302 + ret = PTR_ERR_OR_ZERO(sensor->gpio_reset); 303 + if (ret) 310 304 return ret; 311 - 312 - sensor->gpio_reset = gpio; 313 305 314 306 if (of_property_read_u32(dev->of_node, "clock-frequency", 315 307 &sensor->clock_frequency)) {
+3 -6
drivers/media/i2c/tc358743.c
··· 1891 1891 int ret; 1892 1892 1893 1893 refclk = devm_clk_get(dev, "refclk"); 1894 - if (IS_ERR(refclk)) { 1895 - if (PTR_ERR(refclk) != -EPROBE_DEFER) 1896 - dev_err(dev, "failed to get refclk: %ld\n", 1897 - PTR_ERR(refclk)); 1898 - return PTR_ERR(refclk); 1899 - } 1894 + if (IS_ERR(refclk)) 1895 + return dev_err_probe(dev, PTR_ERR(refclk), 1896 + "failed to get refclk\n"); 1900 1897 1901 1898 ep = of_graph_get_next_endpoint(dev->of_node, NULL); 1902 1899 if (!ep) {
+4 -12
drivers/media/pci/pt3/pt3.c
··· 707 707 if (ret < 0) 708 708 return ret; 709 709 710 - ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64)); 711 - if (ret == 0) 712 - dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(64)); 713 - else { 714 - ret = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); 715 - if (ret == 0) 716 - dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); 717 - else { 718 - dev_err(&pdev->dev, "Failed to set DMA mask\n"); 719 - return ret; 720 - } 721 - dev_info(&pdev->dev, "Use 32bit DMA\n"); 710 + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 711 + if (ret) { 712 + dev_err(&pdev->dev, "Failed to set DMA mask\n"); 713 + return ret; 722 714 } 723 715 724 716 pt3 = devm_kzalloc(&pdev->dev, sizeof(*pt3), GFP_KERNEL);
+10 -4
drivers/media/platform/chips-media/coda-bit.c
··· 854 854 /* Only H.264BP and H.263P3 are considered */ 855 855 iram_info->buf_dbk_y_use = coda_iram_alloc(iram_info, w64); 856 856 iram_info->buf_dbk_c_use = coda_iram_alloc(iram_info, w64); 857 - if (!iram_info->buf_dbk_c_use) 857 + if (!iram_info->buf_dbk_y_use || !iram_info->buf_dbk_c_use) 858 858 goto out; 859 859 iram_info->axi_sram_use |= dbk_bits; 860 860 ··· 878 878 879 879 iram_info->buf_dbk_y_use = coda_iram_alloc(iram_info, w128); 880 880 iram_info->buf_dbk_c_use = coda_iram_alloc(iram_info, w128); 881 - if (!iram_info->buf_dbk_c_use) 881 + if (!iram_info->buf_dbk_y_use || !iram_info->buf_dbk_c_use) 882 882 goto out; 883 883 iram_info->axi_sram_use |= dbk_bits; 884 884 ··· 1084 1084 } 1085 1085 1086 1086 if (dst_fourcc == V4L2_PIX_FMT_JPEG) { 1087 - if (!ctx->params.jpeg_qmat_tab[0]) 1087 + if (!ctx->params.jpeg_qmat_tab[0]) { 1088 1088 ctx->params.jpeg_qmat_tab[0] = kmalloc(64, GFP_KERNEL); 1089 - if (!ctx->params.jpeg_qmat_tab[1]) 1089 + if (!ctx->params.jpeg_qmat_tab[0]) 1090 + return -ENOMEM; 1091 + } 1092 + if (!ctx->params.jpeg_qmat_tab[1]) { 1090 1093 ctx->params.jpeg_qmat_tab[1] = kmalloc(64, GFP_KERNEL); 1094 + if (!ctx->params.jpeg_qmat_tab[1]) 1095 + return -ENOMEM; 1096 + } 1091 1097 coda_set_jpeg_compression_quality(ctx, ctx->params.jpeg_quality); 1092 1098 } 1093 1099
+2 -3
drivers/media/platform/mediatek/mdp/mtk_mdp_comp.c
··· 52 52 for (i = 0; i < ARRAY_SIZE(comp->clk); i++) { 53 53 comp->clk[i] = of_clk_get(node, i); 54 54 if (IS_ERR(comp->clk[i])) { 55 - if (PTR_ERR(comp->clk[i]) != -EPROBE_DEFER) 56 - dev_err(dev, "Failed to get clock\n"); 57 - ret = PTR_ERR(comp->clk[i]); 55 + ret = dev_err_probe(dev, PTR_ERR(comp->clk[i]), 56 + "Failed to get clock\n"); 58 57 goto put_dev; 59 58 } 60 59
+1 -3
drivers/media/platform/samsung/exynos4-is/media-dev.c
··· 1471 1471 1472 1472 pinctrl = devm_pinctrl_get(dev); 1473 1473 if (IS_ERR(pinctrl)) { 1474 - ret = PTR_ERR(pinctrl); 1475 - if (ret != -EPROBE_DEFER) 1476 - dev_err(dev, "Failed to get pinctrl: %d\n", ret); 1474 + ret = dev_err_probe(dev, PTR_ERR(pinctrl), "Failed to get pinctrl\n"); 1477 1475 goto err_clk; 1478 1476 } 1479 1477
+3 -1
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_ctrl.c
··· 468 468 s5p_mfc_hw_call(dev->mfc_ops, try_run, dev); 469 469 /* Wait until instance is returned or timeout occurred */ 470 470 if (s5p_mfc_wait_for_done_ctx(ctx, 471 - S5P_MFC_R2H_CMD_CLOSE_INSTANCE_RET, 0)) 471 + S5P_MFC_R2H_CMD_CLOSE_INSTANCE_RET, 0)){ 472 + clear_work_bit_irqsave(ctx); 472 473 mfc_err("Err returning instance\n"); 474 + } 473 475 474 476 /* Free resources */ 475 477 s5p_mfc_hw_call(dev->mfc_ops, release_codec_buffers, ctx);
+10 -2
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_enc.c
··· 1218 1218 unsigned long mb_y_addr, mb_c_addr; 1219 1219 int slice_type; 1220 1220 unsigned int strm_size; 1221 + bool src_ready; 1221 1222 1222 1223 slice_type = s5p_mfc_hw_call(dev->mfc_ops, get_enc_slice_type, dev); 1223 1224 strm_size = s5p_mfc_hw_call(dev->mfc_ops, get_enc_strm_size, dev); ··· 1258 1257 } 1259 1258 } 1260 1259 } 1261 - if ((ctx->src_queue_cnt > 0) && (ctx->state == MFCINST_RUNNING)) { 1260 + if (ctx->src_queue_cnt > 0 && (ctx->state == MFCINST_RUNNING || 1261 + ctx->state == MFCINST_FINISHING)) { 1262 1262 mb_entry = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, 1263 1263 list); 1264 1264 if (mb_entry->flags & MFC_BUF_FLAG_USED) { ··· 1290 1288 vb2_set_plane_payload(&mb_entry->b->vb2_buf, 0, strm_size); 1291 1289 vb2_buffer_done(&mb_entry->b->vb2_buf, VB2_BUF_STATE_DONE); 1292 1290 } 1293 - if ((ctx->src_queue_cnt == 0) || (ctx->dst_queue_cnt == 0)) 1291 + 1292 + src_ready = true; 1293 + if (ctx->state == MFCINST_RUNNING && ctx->src_queue_cnt == 0) 1294 + src_ready = false; 1295 + if (ctx->state == MFCINST_FINISHING && ctx->ref_queue_cnt == 0) 1296 + src_ready = false; 1297 + if (!src_ready || ctx->dst_queue_cnt == 0) 1294 1298 clear_work_bit(ctx); 1295 1299 1296 1300 return 0;
+7 -7
drivers/media/platform/samsung/s5p-mfc/s5p_mfc_opr_v6.c
··· 1060 1060 } 1061 1061 1062 1062 /* aspect ratio VUI */ 1063 - readl(mfc_regs->e_h264_options); 1063 + reg = readl(mfc_regs->e_h264_options); 1064 1064 reg &= ~(0x1 << 5); 1065 1065 reg |= ((p_h264->vui_sar & 0x1) << 5); 1066 1066 writel(reg, mfc_regs->e_h264_options); ··· 1083 1083 1084 1084 /* intra picture period for H.264 open GOP */ 1085 1085 /* control */ 1086 - readl(mfc_regs->e_h264_options); 1086 + reg = readl(mfc_regs->e_h264_options); 1087 1087 reg &= ~(0x1 << 4); 1088 1088 reg |= ((p_h264->open_gop & 0x1) << 4); 1089 1089 writel(reg, mfc_regs->e_h264_options); ··· 1097 1097 } 1098 1098 1099 1099 /* 'WEIGHTED_BI_PREDICTION' for B is disable */ 1100 - readl(mfc_regs->e_h264_options); 1100 + reg = readl(mfc_regs->e_h264_options); 1101 1101 reg &= ~(0x3 << 9); 1102 1102 writel(reg, mfc_regs->e_h264_options); 1103 1103 1104 1104 /* 'CONSTRAINED_INTRA_PRED_ENABLE' is disable */ 1105 - readl(mfc_regs->e_h264_options); 1105 + reg = readl(mfc_regs->e_h264_options); 1106 1106 reg &= ~(0x1 << 14); 1107 1107 writel(reg, mfc_regs->e_h264_options); 1108 1108 1109 1109 /* ASO */ 1110 - readl(mfc_regs->e_h264_options); 1110 + reg = readl(mfc_regs->e_h264_options); 1111 1111 reg &= ~(0x1 << 6); 1112 1112 reg |= ((p_h264->aso & 0x1) << 6); 1113 1113 writel(reg, mfc_regs->e_h264_options); 1114 1114 1115 1115 /* hier qp enable */ 1116 - readl(mfc_regs->e_h264_options); 1116 + reg = readl(mfc_regs->e_h264_options); 1117 1117 reg &= ~(0x1 << 8); 1118 1118 reg |= ((p_h264->open_gop & 0x1) << 8); 1119 1119 writel(reg, mfc_regs->e_h264_options); ··· 1134 1134 writel(reg, mfc_regs->e_h264_num_t_layer); 1135 1135 1136 1136 /* frame packing SEI generation */ 1137 - readl(mfc_regs->e_h264_options); 1137 + reg = readl(mfc_regs->e_h264_options); 1138 1138 reg &= ~(0x1 << 25); 1139 1139 reg |= ((p_h264->sei_frame_packing & 0x1) << 25); 1140 1140 writel(reg, mfc_regs->e_h264_options);
+1
drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c
··· 927 927 if (ret) { 928 928 dev_err(fei->dev, 929 929 "configure_memdma_and_inputblock failed\n"); 930 + of_node_put(child); 930 931 goto err_unmap; 931 932 } 932 933 index++;
+9 -18
drivers/media/platform/st/stm32/stm32-dcmi.c
··· 1946 1946 return -ENOMEM; 1947 1947 1948 1948 dcmi->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); 1949 - if (IS_ERR(dcmi->rstc)) { 1950 - if (PTR_ERR(dcmi->rstc) != -EPROBE_DEFER) 1951 - dev_err(&pdev->dev, "Could not get reset control\n"); 1952 - 1953 - return PTR_ERR(dcmi->rstc); 1954 - } 1949 + if (IS_ERR(dcmi->rstc)) 1950 + return dev_err_probe(&pdev->dev, PTR_ERR(dcmi->rstc), 1951 + "Could not get reset control\n"); 1955 1952 1956 1953 /* Get bus characteristics from devicetree */ 1957 1954 np = of_graph_get_next_endpoint(np, NULL); ··· 1998 2001 return PTR_ERR(dcmi->regs); 1999 2002 2000 2003 mclk = devm_clk_get(&pdev->dev, "mclk"); 2001 - if (IS_ERR(mclk)) { 2002 - if (PTR_ERR(mclk) != -EPROBE_DEFER) 2003 - dev_err(&pdev->dev, "Unable to get mclk\n"); 2004 - return PTR_ERR(mclk); 2005 - } 2004 + if (IS_ERR(mclk)) 2005 + return dev_err_probe(&pdev->dev, PTR_ERR(mclk), 2006 + "Unable to get mclk\n"); 2006 2007 2007 2008 chan = dma_request_chan(&pdev->dev, "tx"); 2008 - if (IS_ERR(chan)) { 2009 - ret = PTR_ERR(chan); 2010 - if (ret != -EPROBE_DEFER) 2011 - dev_err(&pdev->dev, 2012 - "Failed to request DMA channel: %d\n", ret); 2013 - return ret; 2014 - } 2009 + if (IS_ERR(chan)) 2010 + return dev_err_probe(&pdev->dev, PTR_ERR(chan), 2011 + "Failed to request DMA channel\n"); 2015 2012 2016 2013 dcmi->dma_max_burst = UINT_MAX; 2017 2014 ret = dma_get_slave_caps(chan, &caps);
+1 -2
drivers/media/platform/ti/omap3isp/isp.c
··· 1884 1884 1885 1885 ret = omap3isp_ccp2_init(isp); 1886 1886 if (ret < 0) { 1887 - if (ret != -EPROBE_DEFER) 1888 - dev_err(isp->dev, "CCP2 initialization failed\n"); 1887 + dev_err_probe(isp->dev, ret, "CCP2 initialization failed\n"); 1889 1888 goto error_ccp2; 1890 1889 } 1891 1890
+3 -5
drivers/media/platform/xilinx/xilinx-csi2rxss.c
··· 976 976 /* Reset GPIO */ 977 977 xcsi2rxss->rst_gpio = devm_gpiod_get_optional(dev, "video-reset", 978 978 GPIOD_OUT_HIGH); 979 - if (IS_ERR(xcsi2rxss->rst_gpio)) { 980 - if (PTR_ERR(xcsi2rxss->rst_gpio) != -EPROBE_DEFER) 981 - dev_err(dev, "Video Reset GPIO not setup in DT"); 982 - return PTR_ERR(xcsi2rxss->rst_gpio); 983 - } 979 + if (IS_ERR(xcsi2rxss->rst_gpio)) 980 + return dev_err_probe(dev, PTR_ERR(xcsi2rxss->rst_gpio), 981 + "Video Reset GPIO not setup in DT\n"); 984 982 985 983 ret = xcsi2rxss_parse_of(xcsi2rxss); 986 984 if (ret < 0)
+3 -1
drivers/media/radio/si470x/radio-si470x-usb.c
··· 727 727 728 728 /* start radio */ 729 729 retval = si470x_start_usb(radio); 730 - if (retval < 0) 730 + if (retval < 0 && !radio->int_in_running) 731 731 goto err_buf; 732 + else if (retval < 0) /* in case of radio->int_in_running == 1 */ 733 + goto err_all; 732 734 733 735 /* set initial frequency */ 734 736 si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */
+3 -7
drivers/media/rc/gpio-ir-recv.c
··· 74 74 return -ENOMEM; 75 75 76 76 gpio_dev->gpiod = devm_gpiod_get(dev, NULL, GPIOD_IN); 77 - if (IS_ERR(gpio_dev->gpiod)) { 78 - rc = PTR_ERR(gpio_dev->gpiod); 79 - /* Just try again if this happens */ 80 - if (rc != -EPROBE_DEFER) 81 - dev_err(dev, "error getting gpio (%d)\n", rc); 82 - return rc; 83 - } 77 + if (IS_ERR(gpio_dev->gpiod)) 78 + return dev_err_probe(dev, PTR_ERR(gpio_dev->gpiod), 79 + "error getting gpio\n"); 84 80 gpio_dev->irq = gpiod_to_irq(gpio_dev->gpiod); 85 81 if (gpio_dev->irq < 0) 86 82 return gpio_dev->irq;
+3 -6
drivers/media/rc/gpio-ir-tx.c
··· 174 174 return -ENOMEM; 175 175 176 176 gpio_ir->gpio = devm_gpiod_get(&pdev->dev, NULL, GPIOD_OUT_LOW); 177 - if (IS_ERR(gpio_ir->gpio)) { 178 - if (PTR_ERR(gpio_ir->gpio) != -EPROBE_DEFER) 179 - dev_err(&pdev->dev, "Failed to get gpio (%ld)\n", 180 - PTR_ERR(gpio_ir->gpio)); 181 - return PTR_ERR(gpio_ir->gpio); 182 - } 177 + if (IS_ERR(gpio_ir->gpio)) 178 + return dev_err_probe(&pdev->dev, PTR_ERR(gpio_ir->gpio), 179 + "Failed to get gpio\n"); 183 180 184 181 rcdev->priv = gpio_ir; 185 182 rcdev->driver_name = DRIVER_NAME;
+2 -7
drivers/media/rc/ir-rx51.c
··· 231 231 struct rc_dev *rcdev; 232 232 233 233 pwm = pwm_get(&dev->dev, NULL); 234 - if (IS_ERR(pwm)) { 235 - int err = PTR_ERR(pwm); 236 - 237 - if (err != -EPROBE_DEFER) 238 - dev_err(&dev->dev, "pwm_get failed: %d\n", err); 239 - return err; 240 - } 234 + if (IS_ERR(pwm)) 235 + return dev_err_probe(&dev->dev, PTR_ERR(pwm), "pwm_get failed\n"); 241 236 242 237 /* Use default, in case userspace does not set the carrier */ 243 238 ir_rx51.freq = DIV_ROUND_CLOSEST_ULL(pwm_get_period(pwm), NSEC_PER_SEC);
+1 -1
drivers/media/usb/pwc/pwc-uncompress.c
··· 39 39 * first 3 bytes is filled (Nala case). We can 40 40 * determine this using the type of the webcam */ 41 41 memcpy(raw_frame->cmd, pdev->cmd_buf, 4); 42 - memcpy(raw_frame+1, yuv, pdev->frame_size); 42 + memcpy(raw_frame->rawframe, yuv, pdev->frame_size); 43 43 vb2_set_plane_payload(&fbuf->vb.vb2_buf, 0, 44 44 struct_size(raw_frame, rawframe, pdev->frame_size)); 45 45 return 0;
+3 -6
drivers/media/usb/uvc/uvc_driver.c
··· 1266 1266 return PTR_ERR_OR_ZERO(gpio_privacy); 1267 1267 1268 1268 irq = gpiod_to_irq(gpio_privacy); 1269 - if (irq < 0) { 1270 - if (irq != EPROBE_DEFER) 1271 - dev_err(&dev->udev->dev, 1272 - "No IRQ for privacy GPIO (%d)\n", irq); 1273 - return irq; 1274 - } 1269 + if (irq < 0) 1270 + return dev_err_probe(&dev->udev->dev, irq, 1271 + "No IRQ for privacy GPIO\n"); 1275 1272 1276 1273 unit = uvc_alloc_entity(UVC_EXT_GPIO_UNIT, UVC_EXT_GPIO_UNIT_ID, 0, 1); 1277 1274 if (!unit)
+19 -4
drivers/media/v4l2-core/v4l2-fwnode.c
··· 298 298 299 299 if (!fwnode_property_read_u32(fwnode, "pclk-sample", &v)) { 300 300 flags &= ~(V4L2_MBUS_PCLK_SAMPLE_RISING | 301 - V4L2_MBUS_PCLK_SAMPLE_FALLING); 302 - flags |= v ? V4L2_MBUS_PCLK_SAMPLE_RISING : 303 - V4L2_MBUS_PCLK_SAMPLE_FALLING; 304 - pr_debug("pclk-sample %s\n", v ? "high" : "low"); 301 + V4L2_MBUS_PCLK_SAMPLE_FALLING | 302 + V4L2_MBUS_PCLK_SAMPLE_DUALEDGE); 303 + switch (v) { 304 + case 0: 305 + flags |= V4L2_MBUS_PCLK_SAMPLE_FALLING; 306 + pr_debug("pclk-sample low\n"); 307 + break; 308 + case 1: 309 + flags |= V4L2_MBUS_PCLK_SAMPLE_RISING; 310 + pr_debug("pclk-sample high\n"); 311 + break; 312 + case 2: 313 + flags |= V4L2_MBUS_PCLK_SAMPLE_DUALEDGE; 314 + pr_debug("pclk-sample dual edge\n"); 315 + break; 316 + default: 317 + pr_warn("invalid argument for pclk-sample"); 318 + break; 319 + } 305 320 } 306 321 307 322 if (!fwnode_property_read_u32(fwnode, "data-active", &v)) {
+1 -1
drivers/staging/media/deprecated/stkwebcam/Kconfig
··· 2 2 config VIDEO_STKWEBCAM 3 3 tristate "USB Syntek DC1125 Camera support (DEPRECATED)" 4 4 depends on VIDEO_DEV 5 - depends on USB 5 + depends on MEDIA_USB_SUPPORT && MEDIA_CAMERA_SUPPORT 6 6 help 7 7 Say Y here if you want to use this type of camera. 8 8 Supported devices are typically found in some Asus laptops,
-12
drivers/staging/media/imx/TODO
··· 2 2 - The Frame Interval Monitor could be exported to v4l2-core for 3 3 general use. 4 4 5 - - The CSI subdevice parses its nearest upstream neighbor's device-tree 6 - bus config in order to setup the CSI. Laurent Pinchart argues that 7 - instead the CSI subdev should call its neighbor's g_mbus_config op 8 - (which should be propagated if necessary) to get this info. However 9 - Hans Verkuil is planning to remove the g_mbus_config op. For now this 10 - driver uses the parsed DT bus config method until this issue is 11 - resolved. 12 - 13 - 2020-06: g_mbus has been removed in favour of the get_mbus_config pad 14 - operation which should be used to avoid parsing the remote endpoint 15 - configuration. 16 - 17 5 - This media driver supports inheriting V4L2 controls to the 18 6 video capture devices, from the subdevices in the capture device's 19 7 pipeline. The controls for each capture device are updated in the
+63 -72
drivers/staging/media/imx/imx-media-csi.c
··· 97 97 /* the mipi virtual channel number at link validate */ 98 98 int vc_num; 99 99 100 - /* the upstream endpoint CSI is receiving from */ 101 - struct v4l2_fwnode_endpoint upstream_ep; 100 + /* media bus config of the upstream subdevice CSI is receiving from */ 101 + struct v4l2_mbus_config mbus_cfg; 102 102 103 103 spinlock_t irqlock; /* protect eof_irq handler */ 104 104 struct timer_list eof_timeout_timer; ··· 125 125 return container_of(n, struct csi_priv, notifier); 126 126 } 127 127 128 - static inline bool is_parallel_bus(struct v4l2_fwnode_endpoint *ep) 128 + static inline bool is_parallel_bus(struct v4l2_mbus_config *mbus_cfg) 129 129 { 130 - return ep->bus_type != V4L2_MBUS_CSI2_DPHY; 130 + return mbus_cfg->type != V4L2_MBUS_CSI2_DPHY; 131 131 } 132 132 133 - static inline bool is_parallel_16bit_bus(struct v4l2_fwnode_endpoint *ep) 133 + static inline bool is_parallel_16bit_bus(struct v4l2_mbus_config *mbus_cfg) 134 134 { 135 - return is_parallel_bus(ep) && ep->bus.parallel.bus_width >= 16; 135 + return is_parallel_bus(mbus_cfg) && mbus_cfg->bus.parallel.bus_width >= 16; 136 136 } 137 137 138 138 /* ··· 145 145 * - the CSI is receiving from an 8-bit parallel bus and the incoming 146 146 * media bus format is other than UYVY8_2X8/YUYV8_2X8. 147 147 */ 148 - static inline bool requires_passthrough(struct v4l2_fwnode_endpoint *ep, 148 + static inline bool requires_passthrough(struct v4l2_mbus_config *mbus_cfg, 149 149 struct v4l2_mbus_framefmt *infmt, 150 150 const struct imx_media_pixfmt *incc) 151 151 { 152 - if (ep->bus_type == V4L2_MBUS_BT656) // including BT.1120 152 + if (mbus_cfg->type == V4L2_MBUS_BT656) // including BT.1120 153 153 return false; 154 154 155 - return incc->bayer || is_parallel_16bit_bus(ep) || 156 - (is_parallel_bus(ep) && 155 + return incc->bayer || is_parallel_16bit_bus(mbus_cfg) || 156 + (is_parallel_bus(mbus_cfg) && 157 157 infmt->code != MEDIA_BUS_FMT_UYVY8_2X8 && 158 158 infmt->code != MEDIA_BUS_FMT_YUYV8_2X8); 159 159 } 160 160 161 161 /* 162 - * Parses the fwnode endpoint from the source pad of the entity 163 - * connected to this CSI. This will either be the entity directly 164 - * upstream from the CSI-2 receiver, directly upstream from the 165 - * video mux, or directly upstream from the CSI itself. The endpoint 166 - * is needed to determine the bus type and bus config coming into 167 - * the CSI. 162 + * Queries the media bus config of the upstream entity that provides data to 163 + * the CSI. This will either be the entity directly upstream from the CSI-2 164 + * receiver, directly upstream from a video mux, or directly upstream from 165 + * the CSI itself. 168 166 */ 169 - static int csi_get_upstream_endpoint(struct csi_priv *priv, 170 - struct v4l2_fwnode_endpoint *ep) 167 + static int csi_get_upstream_mbus_config(struct csi_priv *priv, 168 + struct v4l2_mbus_config *mbus_cfg) 171 169 { 172 - struct fwnode_handle *endpoint; 173 - struct v4l2_subdev *sd; 174 - struct media_pad *pad; 175 - 176 - if (!IS_ENABLED(CONFIG_OF)) 177 - return -ENXIO; 170 + struct v4l2_subdev *sd, *remote_sd; 171 + struct media_pad *remote_pad; 172 + int ret; 178 173 179 174 if (!priv->src_sd) 180 175 return -EPIPE; ··· 201 206 } 202 207 203 208 /* get source pad of entity directly upstream from sd */ 204 - pad = imx_media_pipeline_pad(&sd->entity, 0, 0, true); 205 - if (!pad) 206 - return -ENODEV; 209 + remote_pad = media_entity_remote_pad_unique(&sd->entity, 210 + MEDIA_PAD_FL_SOURCE); 211 + if (IS_ERR(remote_pad)) 212 + return PTR_ERR(remote_pad); 207 213 208 - endpoint = imx_media_get_pad_fwnode(pad); 209 - if (IS_ERR(endpoint)) 210 - return PTR_ERR(endpoint); 214 + remote_sd = media_entity_to_v4l2_subdev(remote_pad->entity); 211 215 212 - v4l2_fwnode_endpoint_parse(endpoint, ep); 216 + ret = v4l2_subdev_call(remote_sd, pad, get_mbus_config, 217 + remote_pad->index, mbus_cfg); 218 + if (ret == -ENOIOCTLCMD) 219 + v4l2_err(&priv->sd, 220 + "entity %s does not implement get_mbus_config()\n", 221 + remote_pad->entity->name); 213 222 214 - fwnode_handle_put(endpoint); 215 - 216 - return 0; 223 + return ret; 217 224 } 218 225 219 226 static void csi_idmac_put_ipu_resources(struct csi_priv *priv) ··· 432 435 image.phys0 = phys[0]; 433 436 image.phys1 = phys[1]; 434 437 435 - passthrough = requires_passthrough(&priv->upstream_ep, infmt, incc); 438 + passthrough = requires_passthrough(&priv->mbus_cfg, infmt, incc); 436 439 passthrough_cycles = 1; 437 440 438 441 /* ··· 705 708 { 706 709 struct v4l2_mbus_framefmt *infmt, *outfmt; 707 710 const struct imx_media_pixfmt *incc; 708 - struct v4l2_mbus_config mbus_cfg; 709 711 struct v4l2_mbus_framefmt if_fmt; 710 712 struct v4l2_rect crop; 711 713 712 714 infmt = &priv->format_mbus[CSI_SINK_PAD]; 713 715 incc = priv->cc[CSI_SINK_PAD]; 714 716 outfmt = &priv->format_mbus[priv->active_output_pad]; 715 - 716 - /* compose mbus_config from the upstream endpoint */ 717 - mbus_cfg.type = priv->upstream_ep.bus_type; 718 - if (is_parallel_bus(&priv->upstream_ep)) 719 - mbus_cfg.bus.parallel = priv->upstream_ep.bus.parallel; 720 - else 721 - mbus_cfg.bus.mipi_csi2 = priv->upstream_ep.bus.mipi_csi2; 722 717 723 718 if_fmt = *infmt; 724 719 crop = priv->crop; ··· 719 730 * if cycles is set, we need to handle this over multiple cycles as 720 731 * generic/bayer data 721 732 */ 722 - if (is_parallel_bus(&priv->upstream_ep) && incc->cycles) { 733 + if (is_parallel_bus(&priv->mbus_cfg) && incc->cycles) { 723 734 if_fmt.width *= incc->cycles; 724 735 crop.width *= incc->cycles; 725 736 } ··· 730 741 priv->crop.width == 2 * priv->compose.width, 731 742 priv->crop.height == 2 * priv->compose.height); 732 743 733 - ipu_csi_init_interface(priv->csi, &mbus_cfg, &if_fmt, outfmt); 744 + ipu_csi_init_interface(priv->csi, &priv->mbus_cfg, &if_fmt, outfmt); 734 745 735 746 ipu_csi_set_dest(priv->csi, priv->dest); 736 747 ··· 758 769 return ret; 759 770 760 771 /* Skip first few frames from a BT.656 source */ 761 - if (priv->upstream_ep.bus_type == V4L2_MBUS_BT656) { 772 + if (priv->mbus_cfg.type == V4L2_MBUS_BT656) { 762 773 u32 delay_usec, bad_frames = 20; 763 774 764 775 delay_usec = DIV_ROUND_UP_ULL((u64)USEC_PER_SEC * ··· 1107 1118 struct v4l2_subdev_format *sink_fmt) 1108 1119 { 1109 1120 struct csi_priv *priv = v4l2_get_subdevdata(sd); 1110 - struct v4l2_fwnode_endpoint upstream_ep = { .bus_type = 0 }; 1121 + struct v4l2_mbus_config mbus_cfg = { .type = 0 }; 1111 1122 bool is_csi2; 1112 1123 int ret; 1113 1124 ··· 1116 1127 if (ret) 1117 1128 return ret; 1118 1129 1119 - ret = csi_get_upstream_endpoint(priv, &upstream_ep); 1130 + ret = csi_get_upstream_mbus_config(priv, &mbus_cfg); 1120 1131 if (ret) { 1121 - v4l2_err(&priv->sd, "failed to find upstream endpoint\n"); 1132 + v4l2_err(&priv->sd, 1133 + "failed to get upstream media bus configuration\n"); 1122 1134 return ret; 1123 1135 } 1124 1136 1125 1137 mutex_lock(&priv->lock); 1126 1138 1127 - priv->upstream_ep = upstream_ep; 1128 - is_csi2 = !is_parallel_bus(&upstream_ep); 1139 + priv->mbus_cfg = mbus_cfg; 1140 + is_csi2 = !is_parallel_bus(&mbus_cfg); 1129 1141 if (is_csi2) { 1130 1142 /* 1131 1143 * NOTE! It seems the virtual channels from the mipi csi-2 ··· 1182 1192 struct v4l2_rect *crop, 1183 1193 struct v4l2_subdev_state *sd_state, 1184 1194 struct v4l2_mbus_framefmt *infmt, 1185 - struct v4l2_fwnode_endpoint *upstream_ep) 1195 + struct v4l2_mbus_config *mbus_cfg) 1186 1196 { 1187 1197 u32 in_height; 1188 1198 ··· 1206 1216 * sync, so fix it to NTSC/PAL active lines. NTSC contains 1207 1217 * 2 extra lines of active video that need to be cropped. 1208 1218 */ 1209 - if (upstream_ep->bus_type == V4L2_MBUS_BT656 && 1219 + if (mbus_cfg->type == V4L2_MBUS_BT656 && 1210 1220 (V4L2_FIELD_HAS_BOTH(infmt->field) || 1211 1221 infmt->field == V4L2_FIELD_ALTERNATE)) { 1212 1222 crop->height = in_height; ··· 1223 1233 struct v4l2_subdev_mbus_code_enum *code) 1224 1234 { 1225 1235 struct csi_priv *priv = v4l2_get_subdevdata(sd); 1226 - struct v4l2_fwnode_endpoint upstream_ep = { .bus_type = 0 }; 1236 + struct v4l2_mbus_config mbus_cfg = { .type = 0 }; 1227 1237 const struct imx_media_pixfmt *incc; 1228 1238 struct v4l2_mbus_framefmt *infmt; 1229 1239 int ret = 0; ··· 1240 1250 break; 1241 1251 case CSI_SRC_PAD_DIRECT: 1242 1252 case CSI_SRC_PAD_IDMAC: 1243 - ret = csi_get_upstream_endpoint(priv, &upstream_ep); 1253 + ret = csi_get_upstream_mbus_config(priv, &mbus_cfg); 1244 1254 if (ret) { 1245 - v4l2_err(&priv->sd, "failed to find upstream endpoint\n"); 1255 + v4l2_err(&priv->sd, 1256 + "failed to get upstream media bus configuration\n"); 1246 1257 goto out; 1247 1258 } 1248 1259 1249 - if (requires_passthrough(&upstream_ep, infmt, incc)) { 1260 + if (requires_passthrough(&mbus_cfg, infmt, incc)) { 1250 1261 if (code->index != 0) { 1251 1262 ret = -EINVAL; 1252 1263 goto out; ··· 1417 1426 } 1418 1427 1419 1428 static void csi_try_fmt(struct csi_priv *priv, 1420 - struct v4l2_fwnode_endpoint *upstream_ep, 1429 + struct v4l2_mbus_config *mbus_cfg, 1421 1430 struct v4l2_subdev_state *sd_state, 1422 1431 struct v4l2_subdev_format *sdformat, 1423 1432 struct v4l2_rect *crop, ··· 1438 1447 sdformat->format.width = compose->width; 1439 1448 sdformat->format.height = compose->height; 1440 1449 1441 - if (requires_passthrough(upstream_ep, infmt, incc)) { 1450 + if (requires_passthrough(mbus_cfg, infmt, incc)) { 1442 1451 sdformat->format.code = infmt->code; 1443 1452 *cc = incc; 1444 1453 } else { ··· 1488 1497 crop->height = sdformat->format.height; 1489 1498 if (sdformat->format.field == V4L2_FIELD_ALTERNATE) 1490 1499 crop->height *= 2; 1491 - csi_try_crop(priv, crop, sd_state, &sdformat->format, 1492 - upstream_ep); 1500 + csi_try_crop(priv, crop, sd_state, &sdformat->format, mbus_cfg); 1493 1501 compose->left = 0; 1494 1502 compose->top = 0; 1495 1503 compose->width = crop->width; ··· 1506 1516 struct v4l2_subdev_format *sdformat) 1507 1517 { 1508 1518 struct csi_priv *priv = v4l2_get_subdevdata(sd); 1509 - struct v4l2_fwnode_endpoint upstream_ep = { .bus_type = 0 }; 1519 + struct v4l2_mbus_config mbus_cfg = { .type = 0 }; 1510 1520 const struct imx_media_pixfmt *cc; 1511 1521 struct v4l2_mbus_framefmt *fmt; 1512 1522 struct v4l2_rect *crop, *compose; ··· 1515 1525 if (sdformat->pad >= CSI_NUM_PADS) 1516 1526 return -EINVAL; 1517 1527 1518 - ret = csi_get_upstream_endpoint(priv, &upstream_ep); 1528 + ret = csi_get_upstream_mbus_config(priv, &mbus_cfg); 1519 1529 if (ret) { 1520 - v4l2_err(&priv->sd, "failed to find upstream endpoint\n"); 1530 + v4l2_err(&priv->sd, 1531 + "failed to get upstream media bus configuration\n"); 1521 1532 return ret; 1522 1533 } 1523 1534 ··· 1532 1541 crop = __csi_get_crop(priv, sd_state, sdformat->which); 1533 1542 compose = __csi_get_compose(priv, sd_state, sdformat->which); 1534 1543 1535 - csi_try_fmt(priv, &upstream_ep, sd_state, sdformat, crop, compose, 1536 - &cc); 1544 + csi_try_fmt(priv, &mbus_cfg, sd_state, sdformat, crop, compose, &cc); 1537 1545 1538 1546 fmt = __csi_get_fmt(priv, sd_state, sdformat->pad, sdformat->which); 1539 1547 *fmt = sdformat->format; ··· 1549 1559 format.pad = pad; 1550 1560 format.which = sdformat->which; 1551 1561 format.format = sdformat->format; 1552 - csi_try_fmt(priv, &upstream_ep, sd_state, &format, 1553 - NULL, compose, &outcc); 1562 + csi_try_fmt(priv, &mbus_cfg, sd_state, &format, NULL, 1563 + compose, &outcc); 1554 1564 1555 1565 outfmt = __csi_get_fmt(priv, sd_state, pad, 1556 1566 sdformat->which); ··· 1638 1648 struct v4l2_subdev_selection *sel) 1639 1649 { 1640 1650 struct csi_priv *priv = v4l2_get_subdevdata(sd); 1641 - struct v4l2_fwnode_endpoint upstream_ep = { .bus_type = 0 }; 1651 + struct v4l2_mbus_config mbus_cfg = { .type = 0 }; 1642 1652 struct v4l2_mbus_framefmt *infmt; 1643 1653 struct v4l2_rect *crop, *compose; 1644 1654 int pad, ret; ··· 1646 1656 if (sel->pad != CSI_SINK_PAD) 1647 1657 return -EINVAL; 1648 1658 1649 - ret = csi_get_upstream_endpoint(priv, &upstream_ep); 1659 + ret = csi_get_upstream_mbus_config(priv, &mbus_cfg); 1650 1660 if (ret) { 1651 - v4l2_err(&priv->sd, "failed to find upstream endpoint\n"); 1661 + v4l2_err(&priv->sd, 1662 + "failed to get upstream media bus configuration\n"); 1652 1663 return ret; 1653 1664 } 1654 1665 ··· 1678 1687 goto out; 1679 1688 } 1680 1689 1681 - csi_try_crop(priv, &sel->r, sd_state, infmt, &upstream_ep); 1690 + csi_try_crop(priv, &sel->r, sd_state, infmt, &mbus_cfg); 1682 1691 1683 1692 *crop = sel->r; 1684 1693
+1 -56
drivers/staging/media/imx/imx-media-fim.c
··· 187 187 send_fim_event(fim, error_avg); 188 188 } 189 189 190 - #ifdef CONFIG_IMX_GPT_ICAP 191 - /* 192 - * Input Capture method of measuring frame intervals. Not subject 193 - * to interrupt latency. 194 - */ 195 - static void fim_input_capture_handler(int channel, void *dev_id, 196 - ktime_t timestamp) 197 - { 198 - struct imx_media_fim *fim = dev_id; 199 - unsigned long flags; 200 - 201 - spin_lock_irqsave(&fim->lock, flags); 202 - 203 - frame_interval_monitor(fim, timestamp); 204 - 205 - if (!completion_done(&fim->icap_first_event)) 206 - complete(&fim->icap_first_event); 207 - 208 - spin_unlock_irqrestore(&fim->lock, flags); 209 - } 210 - 211 - static int fim_request_input_capture(struct imx_media_fim *fim) 212 - { 213 - init_completion(&fim->icap_first_event); 214 - 215 - return mxc_request_input_capture(fim->icap_channel, 216 - fim_input_capture_handler, 217 - fim->icap_flags, fim); 218 - } 219 - 220 - static void fim_free_input_capture(struct imx_media_fim *fim) 221 - { 222 - mxc_free_input_capture(fim->icap_channel, fim); 223 - } 224 - 225 - #else /* CONFIG_IMX_GPT_ICAP */ 226 - 227 - static int fim_request_input_capture(struct imx_media_fim *fim) 228 - { 229 - return 0; 230 - } 231 - 232 - static void fim_free_input_capture(struct imx_media_fim *fim) 233 - { 234 - } 235 - 236 - #endif /* CONFIG_IMX_GPT_ICAP */ 237 - 238 190 /* 239 191 * In case we are monitoring the first frame interval after streamon 240 192 * (when fim->num_skip = 0), we need a valid fim->last_ts before we ··· 386 434 update_fim_nominal(fim, fi); 387 435 spin_unlock_irqrestore(&fim->lock, flags); 388 436 389 - if (icap_enabled(fim)) { 390 - ret = fim_request_input_capture(fim); 391 - if (ret) 392 - goto out; 393 - fim_acquire_first_ts(fim); 394 - } 395 - } else { 396 437 if (icap_enabled(fim)) 397 - fim_free_input_capture(fim); 438 + fim_acquire_first_ts(fim); 398 439 } 399 440 400 441 fim->stream_on = on;
-33
drivers/staging/media/imx/imx-media-utils.c
··· 814 814 EXPORT_SYMBOL_GPL(imx_media_pipeline_video_device); 815 815 816 816 /* 817 - * Find a fwnode endpoint that maps to the given subdevice's pad. 818 - * If there are multiple endpoints that map to the pad, only the 819 - * first endpoint encountered is returned. 820 - * 821 - * On success the refcount of the returned fwnode endpoint is 822 - * incremented. 823 - */ 824 - struct fwnode_handle *imx_media_get_pad_fwnode(struct media_pad *pad) 825 - { 826 - struct fwnode_handle *endpoint; 827 - struct v4l2_subdev *sd; 828 - 829 - if (!is_media_entity_v4l2_subdev(pad->entity)) 830 - return ERR_PTR(-ENODEV); 831 - 832 - sd = media_entity_to_v4l2_subdev(pad->entity); 833 - 834 - fwnode_graph_for_each_endpoint(dev_fwnode(sd->dev), endpoint) { 835 - int pad_idx = media_entity_get_fwnode_pad(&sd->entity, 836 - endpoint, 837 - pad->flags); 838 - if (pad_idx < 0) 839 - continue; 840 - 841 - if (pad_idx == pad->index) 842 - return endpoint; 843 - } 844 - 845 - return ERR_PTR(-ENODEV); 846 - } 847 - EXPORT_SYMBOL_GPL(imx_media_get_pad_fwnode); 848 - 849 - /* 850 817 * Turn current pipeline streaming on/off starting from entity. 851 818 */ 852 819 int imx_media_pipeline_set_stream(struct imx_media_dev *imxmd,
-1
drivers/staging/media/imx/imx-media.h
··· 219 219 struct video_device * 220 220 imx_media_pipeline_video_device(struct media_entity *start_entity, 221 221 enum v4l2_buf_type buftype, bool upstream); 222 - struct fwnode_handle *imx_media_get_pad_fwnode(struct media_pad *pad); 223 222 224 223 struct imx_media_dma_buf { 225 224 void *virt;
+9 -9
drivers/staging/media/omap4iss/iss_video.h
··· 53 53 54 54 enum iss_pipeline_state { 55 55 /* The stream has been started on the input video node. */ 56 - ISS_PIPELINE_STREAM_INPUT = 1, 56 + ISS_PIPELINE_STREAM_INPUT = BIT(0), 57 57 /* The stream has been started on the output video node. */ 58 - ISS_PIPELINE_STREAM_OUTPUT = (1 << 1), 58 + ISS_PIPELINE_STREAM_OUTPUT = BIT(1), 59 59 /* At least one buffer is queued on the input video node. */ 60 - ISS_PIPELINE_QUEUE_INPUT = (1 << 2), 60 + ISS_PIPELINE_QUEUE_INPUT = BIT(2), 61 61 /* At least one buffer is queued on the output video node. */ 62 - ISS_PIPELINE_QUEUE_OUTPUT = (1 << 3), 62 + ISS_PIPELINE_QUEUE_OUTPUT = BIT(3), 63 63 /* The input entity is idle, ready to be started. */ 64 - ISS_PIPELINE_IDLE_INPUT = (1 << 4), 64 + ISS_PIPELINE_IDLE_INPUT = BIT(4), 65 65 /* The output entity is idle, ready to be started. */ 66 - ISS_PIPELINE_IDLE_OUTPUT = (1 << 5), 66 + ISS_PIPELINE_IDLE_OUTPUT = BIT(5), 67 67 /* The pipeline is currently streaming. */ 68 - ISS_PIPELINE_STREAM = (1 << 6), 68 + ISS_PIPELINE_STREAM = BIT(6), 69 69 }; 70 70 71 71 /* ··· 126 126 127 127 enum iss_video_dmaqueue_flags { 128 128 /* Set if DMA queue becomes empty when ISS_PIPELINE_STREAM_CONTINUOUS */ 129 - ISS_VIDEO_DMAQUEUE_UNDERRUN = (1 << 0), 129 + ISS_VIDEO_DMAQUEUE_UNDERRUN = BIT(0), 130 130 /* Set when queuing buffer to an empty DMA queue */ 131 - ISS_VIDEO_DMAQUEUE_QUEUED = (1 << 1), 131 + ISS_VIDEO_DMAQUEUE_QUEUED = BIT(1), 132 132 }; 133 133 134 134 #define iss_video_dmaqueue_flags_clr(video) \
-15
include/media/i2c/s5c73m3.h
··· 21 21 #include <media/v4l2-mediabus.h> 22 22 23 23 /** 24 - * struct s5c73m3_gpio - data structure describing a GPIO 25 - * @gpio: GPIO number 26 - * @level: indicates active state of the @gpio 27 - */ 28 - struct s5c73m3_gpio { 29 - int gpio; 30 - int level; 31 - }; 32 - 33 - /** 34 24 * struct s5c73m3_platform_data - s5c73m3 driver platform data 35 25 * @mclk_frequency: sensor's master clock frequency in Hz 36 - * @gpio_reset: GPIO driving RESET pin 37 - * @gpio_stby: GPIO driving STBY pin 38 26 * @bus_type: bus type 39 27 * @nlanes: maximum number of MIPI-CSI lanes used 40 28 * @horiz_flip: default horizontal image flip value, non zero to enable ··· 31 43 32 44 struct s5c73m3_platform_data { 33 45 unsigned long mclk_frequency; 34 - 35 - struct s5c73m3_gpio gpio_reset; 36 - struct s5c73m3_gpio gpio_stby; 37 46 38 47 enum v4l2_mbus_type bus_type; 39 48 u8 nlanes;
-33
include/media/i2c/s5k4ecgx.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 - /* 3 - * S5K4ECGX image sensor header file 4 - * 5 - * Copyright (C) 2012, Linaro 6 - * Copyright (C) 2012, Samsung Electronics Co., Ltd. 7 - */ 8 - 9 - #ifndef S5K4ECGX_H 10 - #define S5K4ECGX_H 11 - 12 - /** 13 - * struct s5k4ecgx_gpio - data structure describing a GPIO 14 - * @gpio: GPIO number 15 - * @level: indicates active state of the @gpio 16 - */ 17 - struct s5k4ecgx_gpio { 18 - int gpio; 19 - int level; 20 - }; 21 - 22 - /** 23 - * struct s5k4ecgx_platform_data - s5k4ecgx driver platform data 24 - * @gpio_reset: GPIO driving RESET pin 25 - * @gpio_stby: GPIO driving STBY pin 26 - */ 27 - 28 - struct s5k4ecgx_platform_data { 29 - struct s5k4ecgx_gpio gpio_reset; 30 - struct s5k4ecgx_gpio gpio_stby; 31 - }; 32 - 33 - #endif /* S5K4ECGX_H */
+2 -2
include/media/i2c/ths7303.h
··· 10 10 * Martin Bugge <marbugge@cisco.com> 11 11 */ 12 12 13 - #ifndef THS7353_H 14 - #define THS7353_H 13 + #ifndef THS7303_H 14 + #define THS7303_H 15 15 16 16 /** 17 17 * struct ths7303_platform_data - Platform dependent data
+9 -8
include/media/v4l2-mediabus.h
··· 54 54 #define V4L2_MBUS_VSYNC_ACTIVE_LOW BIT(5) 55 55 #define V4L2_MBUS_PCLK_SAMPLE_RISING BIT(6) 56 56 #define V4L2_MBUS_PCLK_SAMPLE_FALLING BIT(7) 57 - #define V4L2_MBUS_DATA_ACTIVE_HIGH BIT(8) 58 - #define V4L2_MBUS_DATA_ACTIVE_LOW BIT(9) 57 + #define V4L2_MBUS_PCLK_SAMPLE_DUALEDGE BIT(8) 58 + #define V4L2_MBUS_DATA_ACTIVE_HIGH BIT(9) 59 + #define V4L2_MBUS_DATA_ACTIVE_LOW BIT(10) 59 60 /* FIELD = 0/1 - Field1 (odd)/Field2 (even) */ 60 - #define V4L2_MBUS_FIELD_EVEN_HIGH BIT(10) 61 + #define V4L2_MBUS_FIELD_EVEN_HIGH BIT(11) 61 62 /* FIELD = 1/0 - Field1 (odd)/Field2 (even) */ 62 - #define V4L2_MBUS_FIELD_EVEN_LOW BIT(11) 63 + #define V4L2_MBUS_FIELD_EVEN_LOW BIT(12) 63 64 /* Active state of Sync-on-green (SoG) signal, 0/1 for LOW/HIGH respectively. */ 64 - #define V4L2_MBUS_VIDEO_SOG_ACTIVE_HIGH BIT(12) 65 - #define V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW BIT(13) 66 - #define V4L2_MBUS_DATA_ENABLE_HIGH BIT(14) 67 - #define V4L2_MBUS_DATA_ENABLE_LOW BIT(15) 65 + #define V4L2_MBUS_VIDEO_SOG_ACTIVE_HIGH BIT(13) 66 + #define V4L2_MBUS_VIDEO_SOG_ACTIVE_LOW BIT(14) 67 + #define V4L2_MBUS_DATA_ENABLE_HIGH BIT(15) 68 + #define V4L2_MBUS_DATA_ENABLE_LOW BIT(16) 68 69 69 70 /* Serial flags */ 70 71 /* Clock non-continuous mode support. */
-15
include/uapi/linux/dvb/audio.h
··· 7 7 * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de> 8 8 * & Marcus Metzler <marcus@convergence.de> 9 9 * for convergence integrated media GmbH 10 - * 11 - * This program is free software; you can redistribute it and/or 12 - * modify it under the terms of the GNU General Lesser Public License 13 - * as published by the Free Software Foundation; either version 2.1 14 - * of the License, or (at your option) any later version. 15 - * 16 - * This program is distributed in the hope that it will be useful, 17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 - * GNU General Public License for more details. 20 - * 21 - * You should have received a copy of the GNU Lesser General Public License 22 - * along with this program; if not, write to the Free Software 23 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 24 - * 25 10 */ 26 11 27 12 #ifndef _DVBAUDIO_H_
-15
include/uapi/linux/dvb/ca.h
··· 5 5 * Copyright (C) 2000 Ralph Metzler <ralph@convergence.de> 6 6 * & Marcus Metzler <marcus@convergence.de> 7 7 * for convergence integrated media GmbH 8 - * 9 - * This program is free software; you can redistribute it and/or 10 - * modify it under the terms of the GNU General Lesser Public License 11 - * as published by the Free Software Foundation; either version 2.1 12 - * of the License, or (at your option) any later version. 13 - * 14 - * This program is distributed in the hope that it will be useful, 15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 - * GNU General Public License for more details. 18 - * 19 - * You should have received a copy of the GNU Lesser General Public License 20 - * along with this program; if not, write to the Free Software 21 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 - * 23 8 */ 24 9 25 10 #ifndef _DVBCA_H_
-15
include/uapi/linux/dvb/dmx.h
··· 5 5 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> 6 6 * & Ralph Metzler <ralph@convergence.de> 7 7 * for convergence integrated media GmbH 8 - * 9 - * This program is free software; you can redistribute it and/or 10 - * modify it under the terms of the GNU Lesser General Public License 11 - * as published by the Free Software Foundation; either version 2.1 12 - * of the License, or (at your option) any later version. 13 - * 14 - * This program is distributed in the hope that it will be useful, 15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 - * GNU General Public License for more details. 18 - * 19 - * You should have received a copy of the GNU Lesser General Public License 20 - * along with this program; if not, write to the Free Software 21 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 - * 23 8 */ 24 9 25 10 #ifndef _UAPI_DVBDMX_H_
-15
include/uapi/linux/dvb/frontend.h
··· 7 7 * Holger Waechtler <holger@convergence.de> 8 8 * Andre Draszik <ad@convergence.de> 9 9 * for convergence integrated media GmbH 10 - * 11 - * This program is free software; you can redistribute it and/or 12 - * modify it under the terms of the GNU Lesser General Public License 13 - * as published by the Free Software Foundation; either version 2.1 14 - * of the License, or (at your option) any later version. 15 - * 16 - * This program is distributed in the hope that it will be useful, 17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 - * GNU General Public License for more details. 20 - * 21 - * You should have received a copy of the GNU Lesser General Public License 22 - * along with this program; if not, write to the Free Software 23 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 24 - * 25 10 */ 26 11 27 12 #ifndef _DVBFRONTEND_H_
-15
include/uapi/linux/dvb/net.h
··· 5 5 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> 6 6 * & Ralph Metzler <ralph@convergence.de> 7 7 * for convergence integrated media GmbH 8 - * 9 - * This program is free software; you can redistribute it and/or 10 - * modify it under the terms of the GNU Lesser General Public License 11 - * as published by the Free Software Foundation; either version 2.1 12 - * of the License, or (at your option) any later version. 13 - * 14 - * This program is distributed in the hope that it will be useful, 15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 - * GNU General Public License for more details. 18 - * 19 - * You should have received a copy of the GNU Lesser General Public License 20 - * along with this program; if not, write to the Free Software 21 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 - * 23 8 */ 24 9 25 10 #ifndef _DVBNET_H_
-15
include/uapi/linux/dvb/osd.h
··· 7 7 * Copyright (C) 2001 Ralph Metzler <ralph@convergence.de> 8 8 * & Marcus Metzler <marcus@convergence.de> 9 9 * for convergence integrated media GmbH 10 - * 11 - * This program is free software; you can redistribute it and/or 12 - * modify it under the terms of the GNU General Lesser Public License 13 - * as published by the Free Software Foundation; either version 2.1 14 - * of the License, or (at your option) any later version. 15 - * 16 - * This program is distributed in the hope that it will be useful, 17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 - * GNU General Public License for more details. 20 - * 21 - * You should have received a copy of the GNU Lesser General Public License 22 - * along with this program; if not, write to the Free Software 23 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 24 - * 25 10 */ 26 11 27 12 #ifndef _DVBOSD_H_
-15
include/uapi/linux/dvb/version.h
··· 4 4 * 5 5 * Copyright (C) 2000 Holger Waechtler <holger@convergence.de> 6 6 * for convergence integrated media GmbH 7 - * 8 - * This program is free software; you can redistribute it and/or 9 - * modify it under the terms of the GNU Lesser General Public License 10 - * as published by the Free Software Foundation; either version 2.1 11 - * of the License, or (at your option) any later version. 12 - * 13 - * This program is distributed in the hope that it will be useful, 14 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 - * GNU General Public License for more details. 17 - * 18 - * You should have received a copy of the GNU Lesser General Public License 19 - * along with this program; if not, write to the Free Software 20 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 - * 22 7 */ 23 8 24 9 #ifndef _DVBVERSION_H_
-15
include/uapi/linux/dvb/video.h
··· 7 7 * Copyright (C) 2000 Marcus Metzler <marcus@convergence.de> 8 8 * & Ralph Metzler <ralph@convergence.de> 9 9 * for convergence integrated media GmbH 10 - * 11 - * This program is free software; you can redistribute it and/or 12 - * modify it under the terms of the GNU Lesser General Public License 13 - * as published by the Free Software Foundation; either version 2.1 14 - * of the License, or (at your option) any later version. 15 - * 16 - * This program is distributed in the hope that it will be useful, 17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 - * GNU General Public License for more details. 20 - * 21 - * You should have received a copy of the GNU Lesser General Public License 22 - * along with this program; if not, write to the Free Software 23 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 24 - * 25 10 */ 26 11 27 12 #ifndef _UAPI_DVBVIDEO_H_
-39
include/uapi/linux/v4l2-common.h
··· 10 10 * 11 11 * Copyright (C) 2012 Nokia Corporation 12 12 * Contact: Sakari Ailus <sakari.ailus@iki.fi> 13 - * 14 - * This program is free software; you can redistribute it and/or modify 15 - * it under the terms of the GNU General Public License as published by 16 - * the Free Software Foundation; either version 2 of the License, or 17 - * (at your option) any later version. 18 - * 19 - * This program is distributed in the hope that it will be useful, 20 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 - * GNU General Public License for more details. 23 - * 24 - * Alternatively you can redistribute this file under the terms of the 25 - * BSD license as stated below: 26 - * 27 - * Redistribution and use in source and binary forms, with or without 28 - * modification, are permitted provided that the following conditions 29 - * are met: 30 - * 1. Redistributions of source code must retain the above copyright 31 - * notice, this list of conditions and the following disclaimer. 32 - * 2. Redistributions in binary form must reproduce the above copyright 33 - * notice, this list of conditions and the following disclaimer in 34 - * the documentation and/or other materials provided with the 35 - * distribution. 36 - * 3. The names of its contributors may not be used to endorse or promote 37 - * products derived from this software without specific prior written 38 - * permission. 39 - * 40 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 41 - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 42 - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 43 - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 44 - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45 - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 46 - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 47 - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 48 - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 49 - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 50 - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51 - * 52 13 */ 53 14 54 15 #ifndef __V4L2_COMMON__
-38
include/uapi/linux/v4l2-controls.h
··· 4 4 * 5 5 * Copyright (C) 1999-2012 the contributors 6 6 * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; either version 2 of the License, or 10 - * (at your option) any later version. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 - * 17 - * Alternatively you can redistribute this file under the terms of the 18 - * BSD license as stated below: 19 - * 20 - * Redistribution and use in source and binary forms, with or without 21 - * modification, are permitted provided that the following conditions 22 - * are met: 23 - * 1. Redistributions of source code must retain the above copyright 24 - * notice, this list of conditions and the following disclaimer. 25 - * 2. Redistributions in binary form must reproduce the above copyright 26 - * notice, this list of conditions and the following disclaimer in 27 - * the documentation and/or other materials provided with the 28 - * distribution. 29 - * 3. The names of its contributors may not be used to endorse or promote 30 - * products derived from this software without specific prior written 31 - * permission. 32 - * 33 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 34 - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 35 - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 36 - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 37 - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 38 - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 39 - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 40 - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 41 - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 42 - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 43 - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 44 - * 45 7 * The contents of this header was split off from videodev2.h. All control 46 8 * definitions should be added to this header, which is included by 47 9 * videodev2.h.
-9
include/uapi/linux/v4l2-dv-timings.h
··· 3 3 * V4L2 DV timings header. 4 4 * 5 5 * Copyright (C) 2012-2016 Hans Verkuil <hans.verkuil@cisco.com> 6 - * 7 - * This program is free software; you can redistribute it and/or 8 - * modify it under the terms of the GNU General Public License 9 - * version 2 as published by the Free Software Foundation. 10 - * 11 - * This program is distributed in the hope that it will be useful, but 12 - * WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 - * General Public License for more details. 15 6 */ 16 7 17 8 #ifndef _V4L2_DV_TIMINGS_H
-4
include/uapi/linux/v4l2-mediabus.h
··· 3 3 * Media Bus API header 4 4 * 5 5 * Copyright (C) 2009, Guennadi Liakhovetski <g.liakhovetski@gmx.de> 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 10 6 */ 11 7 12 8 #ifndef __LINUX_V4L2_MEDIABUS_H
-13
include/uapi/linux/v4l2-subdev.h
··· 6 6 * 7 7 * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> 8 8 * Sakari Ailus <sakari.ailus@iki.fi> 9 - * 10 - * This program is free software; you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License version 2 as 12 - * published by the Free Software Foundation. 13 - * 14 - * This program is distributed in the hope that it will be useful, 15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 - * GNU General Public License for more details. 18 - * 19 - * You should have received a copy of the GNU General Public License 20 - * along with this program; if not, write to the Free Software 21 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 9 */ 23 10 24 11 #ifndef __LINUX_V4L2_SUBDEV_H