media: i2c: Introduce driver for the TW9900 decoder
Subsystems (3)
v3 cover media: i2c: Introduce driver for the TW9900 decoder
Hello everyone,
This is the third version of the series adding support for the Techwell TW9900 multi standard decoder. It's a pretty simple decoder compared to the TW9910, since it doesn't have a built-in scaler/crop engine.
This V3 addresses coding-style issues reported by Paul, and fixes the example binding.
Any feedback is appreciated,
Thanks,
Maxime
Maxime Chevallier (3):
dt-bindings: vendor-prefixes: Add techwell vendor prefix
media: dt-bindings: media: i2c: Add bindings for TW9900
media: i2c: Introduce a driver for the Techwell TW9900 decoder
.../devicetree/bindings/media/i2c/tw9900.yaml | 60 ++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + MAINTAINERS | 6 + drivers/media/i2c/Kconfig | 11 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/tw9900.c | 617 ++++++++++++++++++ 6 files changed, 697 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/tw9900.yaml create mode 100644 drivers/media/i2c/tw9900.c
Signature · 1 line
2.25.4
PATCH v3 1/3 dt-bindings: vendor-prefixes: Add techwell vendor prefix
Add prefix for Techwell, Inc.
--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -1057,6 +1057,8 @@ patternProperties: description: TechNexion "^technologic,.*": description: Technologic Systems + "^techwell,.*": + description: Techwell, Inc. "^tempo,.*": description: Tempo Semiconductor "^techstar,.*":
Signature · 1 line
2.25.4
PATCH v3 2/3 media: dt-bindings: media: i2c: Add bindings for TW9900
In reply to Maxime ChevallierThe Techwell TW9900 is a video decoder supporting multiple input standards, such as PAL, NTSC and SECAM, and outputs a BT.656 video signal.
It's designed to be low-power, posesses some features such as a programmable comb-filter, and automatic input standard detection.
---V2->V3 : Fix the example not compiling due to a typo in the reset-gpios node.
.../devicetree/bindings/media/i2c/tw9900.yaml | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/tw9900.yaml
Documentation/devicetree/bindings/media/i2c/tw9900.yaml new file +60 -0
@@ -0,0 +1,60 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/i2c/tw9900.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Techwell TW9900 NTSC/PAL/SECAM video decoder + +maintainers: + - Maxime Chevallier <[email protected]> + +description: + The tw9900 is a multi-standard video decoder, supporting NTSC, PAL and SECAM + standards with auto-detection features. + +properties: + compatible: + items: + - enum: + - techwell,tw9900 + + reg: + maxItems: 1 + + vdd-supply: + description: VDD power supply + + port: + type: object + description: + A node containing a single endpoint as doucmented in + Documentation/devicetree/bindings/media/video-interfaces.txt + +additionalProperties: false + +required: + - compatible + - reg + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + + tw9900: tw9900@44 { + compatible = "techwell,tw9900"; + reg = <0x44>; + + vdd-supply = <&tw9900_supply>; + reset-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; + + port { + tw9900_out: endpoint { + remote-endpoint = <&vip_in>; + }; + }; + }; + };
Signature · 1 line
2.25.4
Rob Herring
maintainerRe: [PATCH v3 2/3] media: dt-bindings: media: i2c: Add bindings for TW9900
Quoted 7 lines · Maxime Chevallier
The Techwell TW9900 is a video decoder supporting multiple input standards, such as PAL, NTSC and SECAM, and outputs a BT.656 video signal.
It's designed to be low-power, posesses some features such as a programmable comb-filter, and automatic input standard detection.
Quoted 9 lines
Signed-off-by Maxime Chevallier <[email protected]>---
V2->V3: Fix the example not compiling due to a typo in the reset-gpios node..../devicetree/bindings/media/i2c/tw9900.yaml | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/tw9900.yaml
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/media/i2c/tw9900.example.dt.yaml: tw9900@44: 'reset-gpios' does not match any of the regexes: 'pinctrl-[0-9]+'
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/media/i2c/tw9900.yaml
See https://patchwork.ozlabs.org/patch/1419441
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
PATCH v3 3/3 media: i2c: Introduce a driver for the Techwell TW9900 decoder
In reply to Maxime ChevallierThe Techwell video decoder supports PAL, NTSC and SECAM input formats, and outputs a BT.656 signal.
This commit adds support for this device, with basic support for NTSC and PAL, along with brightness and contrast controls.
---
v1 -> v2: Set the media entity type to decoder, and implement the s_std/g_std ops
V2 ->V3 : Fix coding-style issues, and remove the use of the bulk API for regulators. Make the driver select the media-controller and V4L2-subdev APIs.
MAINTAINERS | 6 + drivers/media/i2c/Kconfig | 11 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/tw9900.c | 617 +++++++++++++++++++++++++++++++++++++ 4 files changed, 635 insertions(+) create mode 100644 drivers/media/i2c/tw9900.c
MAINTAINERS +6 -0
@@ -17163,6 +17163,12 @@ L: [email protected] S: Maintained F: drivers/media/rc/ttusbir.c +TECHWELL TW9900 VIDEO DECODER +M: Maxime Chevallier <[email protected]> +L: [email protected] +S: Maintained +F: drivers/media/i2c/tw9900.c + TECHWELL TW9910 VIDEO DECODER L: [email protected] S: Orphan
drivers/media/i2c/Kconfig +11 -0
@@ -426,6 +426,17 @@ config VIDEO_TW2804 To compile this driver as a module, choose M here: the module will be called tw2804. +config VIDEO_TW9900 + tristate "Techwell TW9900 video decoder" + depends on VIDEO_V4L2 && I2C + select MEDIA_CONTROLLER + select VIDEO_V4L2_SUBDEV_API + help + Support for the Techwell tw9900 multi-standard video decoder. + + To compile this driver as a module, choose M here: the + module will be called tw9900. + config VIDEO_TW9903 tristate "Techwell TW9903 video decoder" depends on VIDEO_V4L2 && I2C
drivers/media/i2c/Makefile +1 -0
@@ -49,6 +49,7 @@ obj-$(CONFIG_VIDEO_TVP5150) += tvp5150.o obj-$(CONFIG_VIDEO_TVP514X) += tvp514x.o obj-$(CONFIG_VIDEO_TVP7002) += tvp7002.o obj-$(CONFIG_VIDEO_TW2804) += tw2804.o +obj-$(CONFIG_VIDEO_TW9900) += tw9900.o obj-$(CONFIG_VIDEO_TW9903) += tw9903.o obj-$(CONFIG_VIDEO_TW9906) += tw9906.o obj-$(CONFIG_VIDEO_TW9910) += tw9910.o
drivers/media/i2c/tw9900.c new file +617 -0
617 lines not on this page · raw message
Signature · 1 line
2.25.4
kernel test robot
build botRe: [PATCH v3 3/3] media: i2c: Introduce a driver for the Techwell TW9900 decoder
I love your patch! Perhaps something to improve:
Hi Maxime,
I love your patch! Perhaps something to improve:
[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on robh/for-next linus/master v5.11-rc2 next-20210104] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Maxime-Chevallier/media-i2c-Introduce-driver-for-the-TW9900-decoder/20201223-000948 base: git://linuxtv.org/media_tree.git master config: arm64-randconfig-r001-20210105 (attached as .config) compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 5c951623bc8965fa1e89660f2f5f4a2944e4981a)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install arm64 cross compiling tool for clang build
# apt-get install binutils-aarch64-linux-gnu
# https://github.com/0day-ci/linux/commit/cdf8ecd519454783c60d4bca02b9279f8133ef77
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Maxime-Chevallier/media-i2c-Introduce-driver-for-the-TW9900-decoder/20201223-000948 git checkout cdf8ecd519454783c60d4bca02b9279f8133ef77
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/media/i2c/tw9900.c:521:10: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
return ret;
^~~
drivers/media/i2c/tw9900.c:505:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 01 warning generated.
vim +/ret +521 drivers/media/i2c/tw9900.c
498
499 static int tw9900_probe(struct i2c_client *client,
500 const struct i2c_device_id *id)
501 {
502 struct device *dev = &client->dev;
503 struct v4l2_ctrl_handler *hdl;
504 struct tw9900 *tw9900;
505 int ret;
506
507 tw9900 = devm_kzalloc(dev, sizeof(*tw9900), GFP_KERNEL);
508 if (!tw9900)
509 return -ENOMEM;
510
511 tw9900->client = client;
512 tw9900->cur_mode = &supported_modes[0];
513
514 tw9900->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
515 if (IS_ERR(tw9900->reset_gpio))
516 tw9900->reset_gpio = NULL;
517
518 tw9900->regulator = devm_regulator_get(&tw9900->client->dev, "vdd");
519 if (IS_ERR(tw9900->regulator)) {
520 dev_err(dev, "Failed to get power regulator\n");
> 521 return ret;
522 }
523
524 v4l2_i2c_subdev_init(&tw9900->subdev, client, &tw9900_subdev_ops);
525 tw9900->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
526 V4L2_SUBDEV_FL_HAS_EVENTS;
527
528 hdl = &tw9900->hdl;
529
530 v4l2_ctrl_handler_init(hdl, 2);
531
532 v4l2_ctrl_new_std(hdl, &tw9900_ctrl_ops, V4L2_CID_BRIGHTNESS,
533 -128, 127, 1, 0);
534 v4l2_ctrl_new_std(hdl, &tw9900_ctrl_ops, V4L2_CID_CONTRAST,
535 0, 255, 1, 0x60);
536
537 tw9900->subdev.ctrl_handler = hdl;
538 if (hdl->error) {
539 int err = hdl->error;
540
541 v4l2_ctrl_handler_free(hdl);
542 return err;
543 }
544
545 ret = tw9900_power_on(tw9900);
546 if (ret)
547 return ret;
548
549 ret = tw9900_check_id(tw9900, client);
550 if (ret)
551 goto err_power_off;
552
553 tw9900->subdev.internal_ops = &tw9900_internal_ops;
554 tw9900->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
555 tw9900->pad.flags = MEDIA_PAD_FL_SOURCE;
556 tw9900->subdev.entity.function = MEDIA_ENT_F_DV_DECODER;
557
558 ret = media_entity_pads_init(&tw9900->subdev.entity, 1, &tw9900->pad);
559 if (ret < 0)
560 goto err_power_off;
561
562 ret = v4l2_async_register_subdev(&tw9900->subdev);
563 if (ret) {
564 dev_err(dev, "v4l2 async register subdev failed\n");
565 goto err_clean_entity;
566 }
567
568 pm_runtime_set_active(dev);
569 pm_runtime_enable(dev);
570 pm_runtime_idle(dev);
571
572 return 0;
573
574 err_clean_entity:
575 media_entity_cleanup(&tw9900->subdev.entity);
576 err_power_off:
577 tw9900_power_off(tw9900);
578
579 return ret;
580 }
581
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org