Hello everyone,
This series is based on the fifth iteration of the series introducing the
tw9900 driver: sent 29 Dec 2020 [1]
This is the version 6 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.
Changes v5 => v6:
- dropped .skip_top and .field in the supported_modes
- added error handling for the i2c writes/reads
- added the colorimetry information to fill_fmt
- removed pm_runtime
- added the g_input_status callback
- dropped SECAM
- dropped the non-standard PAL/NTSC variants
Any feedback is appreciated,
Mehdi Djait
media_tree, base-commit: 2c1bae27df787c9535e48cc27bbd11c3c3e0a235
[1] https://lore.kernel.org/linux-media/[email protected]/
Mehdi Djait (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
.../bindings/media/i2c/techwell,tw9900.yaml | 61 ++
.../devicetree/bindings/vendor-prefixes.yaml | 2 +
MAINTAINERS | 6 +
drivers/media/i2c/Kconfig | 12 +
drivers/media/i2c/Makefile | 1 +
drivers/media/i2c/tw9900.c | 651 ++++++++++++++++++
6 files changed, 733 insertions(+)
create mode 100644 Documentation/devicetree/bindings/media/i2c/techwell,tw9900.yaml
create mode 100644 drivers/media/i2c/tw9900.c
--
2.41.0
Add prefix for Techwell, Inc.
Signed-off-by: Mehdi Djait <[email protected]>
---
V5->V6:
- This commit had a "Acked-by: Rob Herring <[email protected]>" Tag but
decided not to collect it because the last Iteration was more than 2
years ago
Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 573578db9509..08b74f725142 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -1357,6 +1357,8 @@ patternProperties:
description: Technologic Systems
"^techstar,.*":
description: Shenzhen Techstar Electronics Co., Ltd.
+ "^techwell,.*":
+ description: Techwell, Inc.
"^teejet,.*":
description: TeeJet
"^teltonika,.*":
--
2.41.0
The Techwell TW9900 is a video decoder supporting multiple input
standards, such as PAL and NTSC, 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
Signed-off-by: Mehdi Djait <[email protected]>
---
V5->V6:
- This commit had a "Reviewed-by: Rob Herring <[email protected]>" Tag but
decided not to collect it because the last Iteration was more than 2
years ago
- removed SECAM from the mentioned standards
- changed maintainer
V4->V5:
- renamed the file to match the compatible string, and referenced
the graph.yaml schema
V3->V4:
- add the missing reset-gpios node to the binding
V2->V3:
- fix the example not compiling due to a typo in the reset-gpios
node.
.../bindings/media/i2c/techwell,tw9900.yaml | 61 +++++++++++++++++++
1 file changed, 61 insertions(+)
create mode 100644 Documentation/devicetree/bindings/media/i2c/techwell,tw9900.yaml
diff --git a/Documentation/devicetree/bindings/media/i2c/techwell,tw9900.yaml b/Documentation/devicetree/bindings/media/i2c/techwell,tw9900.yaml
new file mode 100644
index 000000000000..24bbbff5cc01
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/techwell,tw9900.yaml
@@ -0,0 +1,61 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/techwell,tw9900.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Techwell TW9900 NTSC/PAL video decoder
+
+maintainers:
+ - Mehdi Djait <[email protected]>
+
+description:
+ The tw9900 is a multi-standard video decoder, supporting NTSC, PAL standards
+ with auto-detection features.
+
+properties:
+ compatible:
+ const: techwell,tw9900
+
+ reg:
+ maxItems: 1
+
+ vdd-supply:
+ description: VDD power supply
+
+ reset-gpios:
+ description: GPIO descriptor for the RESET input pin
+ maxItems: 1
+
+ port:
+ $ref: /schemas/graph.yaml#/properties/port
+ description:
+ Video port for the decoder output.
+
+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>;
+ };
+ };
+ };
+ };
--
2.41.0
The Techwell video decoder supports PAL, NTSC 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.
The TW9900 is capable of doing automatic standard detection, this is
implemented with support for PAL and NTSC autodetection.
Signed-off-by: Mehdi Djait <[email protected]>
---
V5->V6:
- dropped .skip_top and .field in the supported_modes
- added error handling for the i2c writes/reads
- added the colorimetry information to fill_fmt
- removed pm_runtime
- added the g_input_status callback
- dropped SECAM
- dropped the non-standard PAL/NTSC variants
V4->V5:
- Added .querystd() and .g_tvnorms(), dropped the .open() and
unified the g_fmt() / s_fmt().
V3->V4:
- Fix a warning about an uninitialized ret variable in probe()
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.
V1->V2:
- Set the media entity type to decoder, and implement the
s_std/g_std ops
MAINTAINERS | 6 +
drivers/media/i2c/Kconfig | 12 +
drivers/media/i2c/Makefile | 1 +
drivers/media/i2c/tw9900.c | 651 +++++++++++++++++++++++++++++++++++++
4 files changed, 670 insertions(+)
create mode 100644 drivers/media/i2c/tw9900.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 90f13281d297..164dfb016f18 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21121,6 +21121,12 @@ L: [email protected]
S: Maintained
F: drivers/media/rc/ttusbir.c
+TECHWELL TW9900 VIDEO DECODER
+M: Mehdi Djait <[email protected]>
+L: [email protected]
+S: Maintained
+F: drivers/media/i2c/tw9900.c
+
TECHWELL TW9910 VIDEO DECODER
L: [email protected]
S: Orphan
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 74ff833ff48c..1bd412d90cee 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -1175,6 +1175,18 @@ 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_DEV && I2C
+ select MEDIA_CONTROLLER
+ select VIDEO_V4L2_SUBDEV_API
+ help
+ Support for the Techwell tw9900 multi-standard video decoder.
+ It supports NTSC, PAL standards with auto-detection features.
+
+ 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_DEV && I2C
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 80b00d39b48f..ec318e1fb0c3 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -135,6 +135,7 @@ obj-$(CONFIG_VIDEO_TVP514X) += tvp514x.o
obj-$(CONFIG_VIDEO_TVP5150) += tvp5150.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
diff --git a/drivers/media/i2c/tw9900.c b/drivers/media/i2c/tw9900.c
new file mode 100644
index 000000000000..19867cd8403d
--- /dev/null
+++ b/drivers/media/i2c/tw9900.c
@@ -0,0 +1,651 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Driver for the Techwell TW9900 multi-standard video decoder.
+ *
+ * Copyright (C) 2018 Fuzhou Rockchip Electronics Co., Ltd.
+ * Copyright (C) 2020 Maxime Chevallier <[email protected]>
+ * Copyright (C) 2023 Mehdi Djait <[email protected]>
+ */
+
+#include <linux/clk.h>
+#include <linux/device.h>
+#include <linux/gpio/consumer.h>
+#include <linux/i2c.h>
+#include <linux/module.h>
+#include <linux/regulator/consumer.h>
+#include <linux/sysfs.h>
+#include <linux/timer.h>
+#include <linux/delay.h>
+#include <media/media-entity.h>
+#include <media/v4l2-async.h>
+#include <media/v4l2-ctrls.h>
+#include <media/v4l2-event.h>
+#include <media/v4l2-subdev.h>
+
+#define TW9900_REG_CHIP_ID 0x00
+#define TW9900_REG_CHIP_STATUS 0x01
+#define TW9900_REG_CHIP_STATUS_VDLOSS BIT(7)
+#define TW9900_REG_CHIP_STATUS_HLOCK BIT(6)
+#define TW9900_REG_OUT_FMT_CTL 0x03
+#define TW9900_REG_OUT_FMT_CTL_STANDBY 0xA7
+#define TW9900_REG_OUT_FMT_CTL_STREAMING 0xA0
+#define TW9900_REG_CKHY_HSDLY 0x04
+#define TW9900_REG_OUT_CTRL_I 0x05
+#define TW9900_REG_ANALOG_CTL 0x06
+#define TW9900_REG_CROP_HI 0x07
+#define TW9900_REG_VDELAY_LO 0x08
+#define TW9900_REG_VACTIVE_LO 0x09
+#define TW9900_REG_HACTIVE_LO 0x0B
+#define TW9900_REG_CNTRL1 0x0C
+#define TW9900_REG_BRIGHT_CTL 0x10
+#define TW9900_REG_CONTRAST_CTL 0x11
+#define TW9900_REG_VBI_CNTL 0x19
+#define TW9900_REG_ANAL_CTL_II 0x1A
+#define TW9900_REG_OUT_CTRL_II 0x1B
+#define TW9900_REG_STD_SEL 0x1C
+#define TW9900_REG_STD_SEL_AUTODETECT_IN_PROGRESS BIT(7)
+#define TW9900_STDNOW_MASK GENMASK(6, 4)
+#define TW9900_REG_STDR 0x1D
+#define TW9900_REG_MISSCNT 0x26
+#define TW9900_REG_MISC_CTL_II 0x2F
+#define TW9900_REG_VVBI 0x55
+
+#define TW9900_CHIP_ID 0x00
+
+#define VSYNC_POLL_INTERVAL_MS 20
+#define VSYNC_WAIT_MAX_POLLS 50
+
+#define TW9900_STD_NTSC_M 0
+#define TW9900_STD_PAL_BDGHI 1
+#define TW9900_STD_AUTO 7
+
+#define TW9900_VIDEO_POLL_TIMEOUT 20
+
+struct regval {
+ u8 addr;
+ u8 val;
+};
+
+struct tw9900_mode {
+ u32 width;
+ u32 height;
+ u32 std;
+ const struct regval *reg_list;
+ int n_regs;
+};
+
+struct tw9900 {
+ struct i2c_client *client;
+ struct gpio_desc *reset_gpio;
+ struct regulator *regulator;
+
+ bool streaming;
+
+ struct v4l2_subdev subdev;
+ struct v4l2_ctrl_handler hdl;
+ struct media_pad pad;
+
+ struct timer_list timer;
+ struct work_struct work_i2c_poll;
+
+ const struct tw9900_mode *cur_mode;
+};
+
+#define to_tw9900(sd) container_of(sd, struct tw9900, subdev)
+
+static const struct regval tw9900_init_regs[] = {
+ { TW9900_REG_MISC_CTL_II, 0xE6 },
+ { TW9900_REG_MISSCNT, 0x24 },
+ { TW9900_REG_OUT_FMT_CTL, 0xA7 },
+ { TW9900_REG_ANAL_CTL_II, 0x0A },
+ { TW9900_REG_VDELAY_LO, 0x19 },
+ { TW9900_REG_STD_SEL, 0x00 },
+ { TW9900_REG_VACTIVE_LO, 0xF0 },
+ { TW9900_REG_STD_SEL, 0x07 },
+ { TW9900_REG_CKHY_HSDLY, 0x40 },
+ { TW9900_REG_ANALOG_CTL, 0x80 },
+ { TW9900_REG_CNTRL1, 0xDC },
+ { TW9900_REG_OUT_CTRL_I, 0x98 },
+};
+
+static const struct regval tw9900_pal_regs[] = {
+ { TW9900_REG_STD_SEL, 0x01 },
+};
+
+static const struct regval tw9900_ntsc_regs[] = {
+ { TW9900_REG_OUT_FMT_CTL, 0xA4 },
+ { TW9900_REG_VDELAY_LO, 0x12 },
+ { TW9900_REG_VACTIVE_LO, 0xF0 },
+ { TW9900_REG_CROP_HI, 0x02 },
+ { TW9900_REG_HACTIVE_LO, 0xD0 },
+ { TW9900_REG_VBI_CNTL, 0x01 },
+ { TW9900_REG_STD_SEL, 0x00 },
+};
+
+static const struct tw9900_mode supported_modes[] = {
+ {
+ .width = 720,
+ .height = 480,
+ .std = V4L2_STD_NTSC,
+ .reg_list = tw9900_ntsc_regs,
+ .n_regs = ARRAY_SIZE(tw9900_ntsc_regs),
+ },
+ {
+ .width = 720,
+ .height = 576,
+ .std = V4L2_STD_PAL,
+ .reg_list = tw9900_pal_regs,
+ .n_regs = ARRAY_SIZE(tw9900_pal_regs),
+ },
+};
+
+static int tw9900_write_reg(struct i2c_client *client, u8 reg, u8 val)
+{
+ int ret;
+
+ ret = i2c_smbus_write_byte_data(client, reg, val);
+ if (ret < 0)
+ dev_err(&client->dev, "write reg error: %d\n", ret);
+
+ return ret;
+}
+
+static int tw9900_write_array(struct i2c_client *client,
+ const struct regval *regs, int n_regs)
+{
+ int i, ret = 0;
+
+ for (i = 0; ret == 0 && i <= n_regs; i++) {
+ ret = tw9900_write_reg(client, regs[i].addr, regs[i].val);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
+}
+
+static int tw9900_read_reg(struct i2c_client *client, u8 reg)
+{
+ int ret;
+
+ ret = i2c_smbus_read_byte_data(client, reg);
+ if (ret < 0)
+ dev_err(&client->dev, "read reg error: %d\n", ret);
+
+ return ret;
+}
+
+static void tw9900_fill_fmt(const struct tw9900_mode *mode,
+ struct v4l2_mbus_framefmt *fmt)
+{
+ fmt->code = MEDIA_BUS_FMT_UYVY8_2X8;
+ fmt->width = mode->width;
+ fmt->height = mode->height;
+ fmt->field = V4L2_FIELD_NONE;
+ fmt->quantization = V4L2_QUANTIZATION_DEFAULT;
+ fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
+ fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(V4L2_COLORSPACE_SMPTE170M);
+ fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(V4L2_COLORSPACE_SMPTE170M);
+}
+
+static int tw9900_cfg_fmt(struct v4l2_subdev *sd,
+ struct v4l2_subdev_state *sd_state,
+ struct v4l2_subdev_format *fmt)
+{
+ struct tw9900 *tw9900 = to_tw9900(sd);
+ struct v4l2_mbus_framefmt *mbus_fmt = &fmt->format;
+
+ tw9900_fill_fmt(tw9900->cur_mode, mbus_fmt);
+
+ return 0;
+}
+
+static int tw9900_enum_mbus_code(struct v4l2_subdev *sd,
+ struct v4l2_subdev_state *sd_state,
+ struct v4l2_subdev_mbus_code_enum *code)
+{
+ if (code->index >= 1)
+ return -EINVAL;
+
+ code->code = MEDIA_BUS_FMT_UYVY8_2X8;
+
+ return 0;
+}
+
+static int tw9900_power_on(struct tw9900 *tw9900)
+{
+ int ret;
+ struct device *dev = &tw9900->client->dev;
+
+ if (tw9900->reset_gpio)
+ gpiod_set_value_cansleep(tw9900->reset_gpio, 1);
+
+ ret = regulator_enable(tw9900->regulator);
+ if (ret < 0)
+ goto error;
+
+ usleep_range(50000, 52000);
+
+ if (tw9900->reset_gpio)
+ gpiod_set_value_cansleep(tw9900->reset_gpio, 0);
+
+ usleep_range(1000, 2000);
+
+ ret = tw9900_write_array(tw9900->client, tw9900_init_regs,
+ ARRAY_SIZE(tw9900_init_regs));
+ if (ret)
+ dev_err(dev, "Failed to init tw9900\n");
+
+ return ret;
+
+error:
+
+ return ret;
+}
+
+static void tw9900_power_off(struct tw9900 *tw9900)
+{
+ if (tw9900->reset_gpio)
+ gpiod_set_value_cansleep(tw9900->reset_gpio, 1);
+
+ regulator_disable(tw9900->regulator);
+}
+
+static int tw9900_s_ctrl(struct v4l2_ctrl *ctrl)
+{
+ struct tw9900 *tw9900 = container_of(ctrl->handler, struct tw9900, hdl);
+
+ switch (ctrl->id) {
+ case V4L2_CID_BRIGHTNESS:
+ return tw9900_write_reg(tw9900->client, 0x10, (u8)ctrl->val);
+ case V4L2_CID_CONTRAST:
+ return tw9900_write_reg(tw9900->client, 0x11, (u8)ctrl->val);
+ default:
+ return -EINVAL;
+ }
+}
+
+static int tw9900_s_stream(struct v4l2_subdev *sd, int on)
+{
+ struct tw9900 *tw9900 = to_tw9900(sd);
+ struct i2c_client *client = tw9900->client;
+ int ret;
+
+ on = !!on;
+ if (on == tw9900->streaming)
+ return 0;
+
+ if (on) {
+ ret = v4l2_ctrl_handler_setup(sd->ctrl_handler);
+ if (ret)
+ return ret;
+
+ ret = tw9900_write_array(tw9900->client,
+ tw9900->cur_mode->reg_list,
+ tw9900->cur_mode->n_regs);
+ if (ret)
+ return ret;
+
+ ret = tw9900_write_reg(client, TW9900_REG_OUT_FMT_CTL,
+ TW9900_REG_OUT_FMT_CTL_STREAMING);
+ if (ret)
+ return ret;
+
+ } else {
+ ret = tw9900_write_reg(client, TW9900_REG_OUT_FMT_CTL,
+ TW9900_REG_OUT_FMT_CTL_STANDBY);
+ if (ret)
+ return ret;
+ }
+
+ tw9900->streaming = on;
+
+ return 0;
+}
+
+static int tw9900_subscribe_event(struct v4l2_subdev *sd,
+ struct v4l2_fh *fh,
+ struct v4l2_event_subscription *sub)
+{
+ switch (sub->type) {
+ case V4L2_EVENT_SOURCE_CHANGE:
+ return v4l2_src_change_event_subdev_subscribe(sd, fh, sub);
+ case V4L2_EVENT_CTRL:
+ return v4l2_ctrl_subdev_subscribe_event(sd, fh, sub);
+ default:
+ return -EINVAL;
+ }
+}
+
+static const struct tw9900_mode *tw9900_get_mode_from_std(v4l2_std_id std)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(supported_modes); i++)
+ if (supported_modes[i].std & std)
+ return &supported_modes[i];
+
+ return NULL;
+}
+
+static int tw9900_s_std(struct v4l2_subdev *sd, v4l2_std_id norm)
+{
+ struct tw9900 *tw9900 = to_tw9900(sd);
+ const struct tw9900_mode *mode;
+
+ if (!(norm & (V4L2_STD_NTSC | V4L2_STD_PAL)))
+ return -EINVAL;
+
+ mode = tw9900_get_mode_from_std(norm);
+ if (!mode)
+ return -EINVAL;
+
+ tw9900->cur_mode = mode;
+
+ return 0;
+}
+
+static int tw9900_get_stream_std(struct tw9900 *tw9900,
+ v4l2_std_id *std_id)
+{
+ int std, ret;
+
+ ret = tw9900_read_reg(tw9900->client, TW9900_REG_STD_SEL);
+ if (ret < 0) {
+ *std_id = V4L2_STD_UNKNOWN;
+ return ret;
+ }
+
+ std = FIELD_GET(TW9900_STDNOW_MASK, ret);
+
+ switch (std) {
+ case TW9900_STD_NTSC_M:
+ *std_id = V4L2_STD_NTSC;
+ break;
+ case TW9900_STD_PAL_BDGHI:
+ *std_id = V4L2_STD_PAL;
+ break;
+ case TW9900_STD_AUTO:
+ *std_id = V4L2_STD_UNKNOWN;
+ break;
+ default:
+ *std_id = V4L2_STD_UNKNOWN;
+ break;
+ }
+
+ return 0;
+}
+
+static int tw9900_g_std(struct v4l2_subdev *sd, v4l2_std_id *std)
+{
+ struct tw9900 *tw9900 = to_tw9900(sd);
+
+ *std = tw9900->cur_mode->std;
+
+ return 0;
+}
+
+static int tw9900_start_autodetect(struct tw9900 *tw9900)
+{
+ int ret;
+
+ ret = tw9900_write_reg(tw9900->client, TW9900_REG_STDR,
+ BIT(TW9900_STD_NTSC_M) |
+ BIT(TW9900_STD_PAL_BDGHI));
+ if (ret)
+ return ret;
+
+ ret = tw9900_write_reg(tw9900->client, TW9900_REG_STD_SEL,
+ TW9900_STD_AUTO);
+ if (ret)
+ return ret;
+
+ ret = tw9900_write_reg(tw9900->client, TW9900_REG_STDR,
+ BIT(TW9900_STD_NTSC_M) |
+ BIT(TW9900_STD_PAL_BDGHI) |
+ BIT(TW9900_STD_AUTO));
+ if (ret)
+ return ret;
+
+ /* Autodetect takes a while to start, and during the starting sequence
+ * the autodetection status is reported as done.
+ */
+ msleep(30);
+
+ return 0;
+}
+
+static int tw9900_cancel_autodetect(struct tw9900 *tw9900)
+{
+ return tw9900_s_std(&tw9900->subdev, tw9900->cur_mode->std);
+}
+
+static int tw9900_detect_done(struct tw9900 *tw9900, bool *done)
+{
+ int ret;
+
+ ret = tw9900_read_reg(tw9900->client, TW9900_REG_STD_SEL);
+ if (ret < 0)
+ return ret;
+
+ *done = !(ret & TW9900_REG_STD_SEL_AUTODETECT_IN_PROGRESS);
+
+ return 0;
+}
+
+static int tw9900_querystd(struct v4l2_subdev *sd, v4l2_std_id *std_id)
+{
+ struct tw9900 *tw9900 = to_tw9900(sd);
+ bool done = false;
+ int i, ret;
+
+ if (tw9900->streaming)
+ return -EBUSY;
+
+ ret = tw9900_start_autodetect(tw9900);
+ if (ret)
+ return ret;
+
+ for (i = 0; i < TW9900_VIDEO_POLL_TIMEOUT; i++) {
+ ret = tw9900_detect_done(tw9900, &done);
+ if (ret)
+ return ret;
+
+ if (done)
+ break;
+
+ msleep(20);
+ }
+
+ if (!done) {
+ tw9900_cancel_autodetect(tw9900);
+ return -EBUSY;
+ }
+
+ return tw9900_get_stream_std(tw9900, std_id);
+}
+
+static int tw9900_g_tvnorms(struct v4l2_subdev *sd, v4l2_std_id *norm)
+{
+ *norm = V4L2_STD_NTSC | V4L2_STD_PAL;
+
+ return 0;
+}
+
+static int tw9900_g_input_status(struct v4l2_subdev *sd, u32 *status)
+{
+ struct tw9900 *tw9900 = to_tw9900(sd);
+ int ret;
+
+ ret = tw9900_read_reg(tw9900->client, TW9900_REG_CHIP_STATUS);
+ if (ret < 0)
+ return ret;
+
+ *status = ret & TW9900_REG_CHIP_STATUS_HLOCK ? 0 : V4L2_IN_ST_NO_SIGNAL;
+
+ return 0;
+}
+
+static const struct v4l2_subdev_core_ops tw9900_core_ops = {
+ .subscribe_event = tw9900_subscribe_event,
+ .unsubscribe_event = v4l2_event_subdev_unsubscribe,
+};
+
+static const struct v4l2_subdev_video_ops tw9900_video_ops = {
+ .s_std = tw9900_s_std,
+ .g_std = tw9900_g_std,
+ .querystd = tw9900_querystd,
+ .g_tvnorms = tw9900_g_tvnorms,
+ .g_input_status = tw9900_g_input_status,
+ .s_stream = tw9900_s_stream,
+};
+
+static const struct v4l2_subdev_pad_ops tw9900_pad_ops = {
+ .enum_mbus_code = tw9900_enum_mbus_code,
+ .get_fmt = tw9900_cfg_fmt,
+ .set_fmt = tw9900_cfg_fmt,
+};
+
+static const struct v4l2_subdev_ops tw9900_subdev_ops = {
+ .core = &tw9900_core_ops,
+ .video = &tw9900_video_ops,
+ .pad = &tw9900_pad_ops,
+};
+
+static const struct v4l2_ctrl_ops tw9900_ctrl_ops = {
+ .s_ctrl = tw9900_s_ctrl,
+};
+
+static int tw9900_check_id(struct tw9900 *tw9900,
+ struct i2c_client *client)
+{
+ struct device *dev = &tw9900->client->dev;
+ int ret;
+
+ ret = tw9900_read_reg(client, TW9900_CHIP_ID);
+ if (ret < 0)
+ return ret;
+
+ if (ret != TW9900_CHIP_ID) {
+ dev_err(dev, "Unexpected decoder id(0x%x)\n", ret);
+ return -EINVAL;
+ }
+
+ dev_info(dev, "Detected TW9900 (0x%x) decoder\n", TW9900_CHIP_ID);
+
+ return 0;
+}
+
+static int tw9900_probe(struct i2c_client *client)
+{
+ struct device *dev = &client->dev;
+ struct v4l2_ctrl_handler *hdl;
+ struct tw9900 *tw9900;
+ int ret = 0;
+
+ tw9900 = devm_kzalloc(dev, sizeof(*tw9900), GFP_KERNEL);
+ if (!tw9900)
+ return -ENOMEM;
+
+ tw9900->client = client;
+ tw9900->cur_mode = &supported_modes[0];
+
+ tw9900->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
+ if (IS_ERR(tw9900->reset_gpio))
+ tw9900->reset_gpio = NULL;
+
+ tw9900->regulator = devm_regulator_get(&tw9900->client->dev, "vdd");
+ if (IS_ERR(tw9900->regulator)) {
+ dev_err(dev, "Failed to get power regulator\n");
+ return ret;
+ }
+
+ v4l2_i2c_subdev_init(&tw9900->subdev, client, &tw9900_subdev_ops);
+ tw9900->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+ V4L2_SUBDEV_FL_HAS_EVENTS;
+
+ hdl = &tw9900->hdl;
+
+ ret = v4l2_ctrl_handler_init(hdl, 2);
+ if (ret)
+ return ret;
+
+ v4l2_ctrl_new_std(hdl, &tw9900_ctrl_ops, V4L2_CID_BRIGHTNESS,
+ -128, 127, 1, 0);
+ v4l2_ctrl_new_std(hdl, &tw9900_ctrl_ops, V4L2_CID_CONTRAST,
+ 0, 255, 1, 0x60);
+
+ tw9900->subdev.ctrl_handler = hdl;
+ if (hdl->error) {
+ int err = hdl->error;
+
+ v4l2_ctrl_handler_free(hdl);
+ return err;
+ }
+
+ ret = tw9900_power_on(tw9900);
+ if (ret)
+ return ret;
+
+ ret = tw9900_check_id(tw9900, client);
+ if (ret)
+ goto err_power_off;
+
+ tw9900->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+ tw9900->pad.flags = MEDIA_PAD_FL_SOURCE;
+ tw9900->subdev.entity.function = MEDIA_ENT_F_DV_DECODER;
+
+ ret = media_entity_pads_init(&tw9900->subdev.entity, 1, &tw9900->pad);
+ if (ret < 0)
+ goto err_power_off;
+
+ ret = v4l2_async_register_subdev(&tw9900->subdev);
+ if (ret) {
+ dev_err(dev, "v4l2 async register subdev failed\n");
+ goto err_clean_entity;
+ }
+
+ return 0;
+
+err_clean_entity:
+ media_entity_cleanup(&tw9900->subdev.entity);
+err_power_off:
+ tw9900_power_off(tw9900);
+
+ return ret;
+}
+
+static void tw9900_remove(struct i2c_client *client)
+{
+ struct v4l2_subdev *sd = i2c_get_clientdata(client);
+
+ v4l2_async_unregister_subdev(sd);
+ media_entity_cleanup(&sd->entity);
+}
+
+static const struct i2c_device_id tw9900_id[] = {
+ { "tw9900", 0 },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, tw9900_id);
+
+static const struct of_device_id tw9900_of_match[] = {
+ { .compatible = "techwell,tw9900" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, tw9900_of_match);
+
+static struct i2c_driver tw9900_i2c_driver = {
+ .driver = {
+ .name = "tw9900",
+ .of_match_table = tw9900_of_match
+ },
+ .probe = tw9900_probe,
+ .remove = tw9900_remove,
+ .id_table = tw9900_id,
+};
+
+module_i2c_driver(tw9900_i2c_driver);
+
+MODULE_DESCRIPTION("tw9900 decoder driver");
+MODULE_LICENSE("GPL");
--
2.41.0
On 06/10/2023 18:25, Mehdi Djait wrote:
> Add prefix for Techwell, Inc.
>
> Signed-off-by: Mehdi Djait <[email protected]>
> ---
Acked-by: Krzysztof Kozlowski <[email protected]>
Best regards,
Krzysztof
On 06/10/2023 18:25, Mehdi Djait wrote:
> The Techwell TW9900 is a video decoder supporting multiple input
> standards, such as PAL and NTSC, 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
>
> Signed-off-by: Mehdi Djait <[email protected]>
> ---
Thank you for your patch. There is something to discuss/improve.
> +properties:
> + compatible:
> + const: techwell,tw9900
> +
> + reg:
> + maxItems: 1
> +
> + vdd-supply:
> + description: VDD power supply
> +
> + reset-gpios:
> + description: GPIO descriptor for the RESET input pin
> + maxItems: 1
> +
> + port:
> + $ref: /schemas/graph.yaml#/properties/port
> + description:
> + Video port for the decoder output.
> +
> +additionalProperties: false
This goes after required: block
> +
> +required:
> + - compatible
> + - reg
> +
> +examples:
> + - |
> + #include <dt-bindings/gpio/gpio.h>
> + i2c {
> + #address-cells = <1>;
> + #size-cells = <0>;
Use 4 spaces for example indentation.
> +
> + tw9900: tw9900@44 {
Node names should be generic. See also an explanation and list of
examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
Also, drop unused labels
> + compatible = "techwell,tw9900";
> + reg = <0x44>;
> +
> + vdd-supply = <&tw9900_supply>;
> + reset-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>;
> +
> + port {
> + tw9900_out: endpoint {
> + remote-endpoint = <&vip_in>;
> + };
> + };
> + };
> + };
Best regards,
Krzysztof
On 06/10/2023 18:25, Mehdi Djait wrote:
> The Techwell video decoder supports PAL, NTSC 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.
>
> The TW9900 is capable of doing automatic standard detection, this is
> implemented with support for PAL and NTSC autodetection.
>
> Signed-off-by: Mehdi Djait <[email protected]>
...
> +
> +static int tw9900_check_id(struct tw9900 *tw9900,
> + struct i2c_client *client)
> +{
> + struct device *dev = &tw9900->client->dev;
> + int ret;
> +
> + ret = tw9900_read_reg(client, TW9900_CHIP_ID);
> + if (ret < 0)
> + return ret;
> +
> + if (ret != TW9900_CHIP_ID) {
> + dev_err(dev, "Unexpected decoder id(0x%x)\n", ret);
> + return -EINVAL;
> + }
> +
> + dev_info(dev, "Detected TW9900 (0x%x) decoder\n", TW9900_CHIP_ID);
dev_dbg
Do not spam log with simple success messages.
Why do you always print 0x0 (TW9900_CHIP_ID) here? It does not make
sense, drop.
> +
> + return 0;
> +}
> +
> +static int tw9900_probe(struct i2c_client *client)
> +{
> + struct device *dev = &client->dev;
> + struct v4l2_ctrl_handler *hdl;
> + struct tw9900 *tw9900;
> + int ret = 0;
> +
> + tw9900 = devm_kzalloc(dev, sizeof(*tw9900), GFP_KERNEL);
> + if (!tw9900)
> + return -ENOMEM;
> +
> + tw9900->client = client;
> + tw9900->cur_mode = &supported_modes[0];
> +
> + tw9900->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
> + if (IS_ERR(tw9900->reset_gpio))
> + tw9900->reset_gpio = NULL;
> +
> + tw9900->regulator = devm_regulator_get(&tw9900->client->dev, "vdd");
> + if (IS_ERR(tw9900->regulator)) {
> + dev_err(dev, "Failed to get power regulator\n");
return dev_err_probe()
Best regards,
Krzysztof
Hi Mehdi,
Thank you for the patch.
On Fri, Oct 06, 2023 at 06:25:29PM +0200, Mehdi Djait wrote:
> The Techwell TW9900 is a video decoder supporting multiple input
> standards, such as PAL and NTSC, 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
>
> Signed-off-by: Mehdi Djait <[email protected]>
> ---
> V5->V6:
> - This commit had a "Reviewed-by: Rob Herring <[email protected]>" Tag but
> decided not to collect it because the last Iteration was more than 2
> years ago
> - removed SECAM from the mentioned standards
> - changed maintainer
>
> V4->V5:
> - renamed the file to match the compatible string, and referenced
> the graph.yaml schema
>
> V3->V4:
> - add the missing reset-gpios node to the binding
>
> V2->V3:
> - fix the example not compiling due to a typo in the reset-gpios
> node.
>
> .../bindings/media/i2c/techwell,tw9900.yaml | 61 +++++++++++++++++++
> 1 file changed, 61 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/media/i2c/techwell,tw9900.yaml
>
> diff --git a/Documentation/devicetree/bindings/media/i2c/techwell,tw9900.yaml b/Documentation/devicetree/bindings/media/i2c/techwell,tw9900.yaml
> new file mode 100644
> index 000000000000..24bbbff5cc01
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/i2c/techwell,tw9900.yaml
> @@ -0,0 +1,61 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/media/i2c/techwell,tw9900.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Techwell TW9900 NTSC/PAL video decoder
> +
> +maintainers:
> + - Mehdi Djait <[email protected]>
> +
> +description:
> + The tw9900 is a multi-standard video decoder, supporting NTSC, PAL standards
> + with auto-detection features.
> +
> +properties:
> + compatible:
> + const: techwell,tw9900
> +
> + reg:
> + maxItems: 1
> +
> + vdd-supply:
> + description: VDD power supply
> +
> + reset-gpios:
> + description: GPIO descriptor for the RESET input pin
> + maxItems: 1
How about the power down GPIO ?
The chip requires a clock, which is provided by a crystal oscillator in
the block diagram I found. Does it also support an external clock ? If
so the bindings should support it, although this could be added later.
> +
> + port:
> + $ref: /schemas/graph.yaml#/properties/port
> + description:
> + Video port for the decoder output.
How about input ports, connected to nodes that model the connector(s) ?
> +
> +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>;
> + };
> + };
> + };
> + };
--
Regards,
Laurent Pinchart
On Fri, Oct 06, 2023 at 06:25:27PM +0200, Mehdi Djait wrote:
> Hello everyone,
>
> This series is based on the fifth iteration of the series introducing the
> tw9900 driver: sent 29 Dec 2020 [1]
>
> This is the version 6 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.
>
> Changes v5 => v6:
> - dropped .skip_top and .field in the supported_modes
> - added error handling for the i2c writes/reads
> - added the colorimetry information to fill_fmt
> - removed pm_runtime
It's not very nice to keep the chip powered up all the time :-(
> - added the g_input_status callback
> - dropped SECAM
> - dropped the non-standard PAL/NTSC variants
>
> Any feedback is appreciated,
>
> Mehdi Djait
>
> media_tree, base-commit: 2c1bae27df787c9535e48cc27bbd11c3c3e0a235
>
> [1] https://lore.kernel.org/linux-media/[email protected]/
>
> Mehdi Djait (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
>
> .../bindings/media/i2c/techwell,tw9900.yaml | 61 ++
> .../devicetree/bindings/vendor-prefixes.yaml | 2 +
> MAINTAINERS | 6 +
> drivers/media/i2c/Kconfig | 12 +
> drivers/media/i2c/Makefile | 1 +
> drivers/media/i2c/tw9900.c | 651 ++++++++++++++++++
> 6 files changed, 733 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/media/i2c/techwell,tw9900.yaml
> create mode 100644 drivers/media/i2c/tw9900.c
--
Regards,
Laurent Pinchart
Hi laurent,
Thank you for the review.
On Mon, Oct 09, 2023 at 05:18:38AM +0300, Laurent Pinchart wrote:
> Hi Mehdi,
>
> Thank you for the patch.
>
> On Fri, Oct 06, 2023 at 06:25:29PM +0200, Mehdi Djait wrote:
> > The Techwell TW9900 is a video decoder supporting multiple input
> > standards, such as PAL and NTSC, 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
> >
> > Signed-off-by: Mehdi Djait <[email protected]>
> > ---
> > V5->V6:
> > - This commit had a "Reviewed-by: Rob Herring <[email protected]>" Tag but
> > decided not to collect it because the last Iteration was more than 2
> > years ago
> > - removed SECAM from the mentioned standards
> > - changed maintainer
> >
> > V4->V5:
> > - renamed the file to match the compatible string, and referenced
> > the graph.yaml schema
> >
> > V3->V4:
> > - add the missing reset-gpios node to the binding
> >
> > V2->V3:
> > - fix the example not compiling due to a typo in the reset-gpios
> > node.
> >
> > .../bindings/media/i2c/techwell,tw9900.yaml | 61 +++++++++++++++++++
> > 1 file changed, 61 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/media/i2c/techwell,tw9900.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/media/i2c/techwell,tw9900.yaml b/Documentation/devicetree/bindings/media/i2c/techwell,tw9900.yaml
> > new file mode 100644
> > index 000000000000..24bbbff5cc01
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/media/i2c/techwell,tw9900.yaml
> > @@ -0,0 +1,61 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/media/i2c/techwell,tw9900.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Techwell TW9900 NTSC/PAL video decoder
> > +
> > +maintainers:
> > + - Mehdi Djait <[email protected]>
> > +
> > +description:
> > + The tw9900 is a multi-standard video decoder, supporting NTSC, PAL standards
> > + with auto-detection features.
> > +
> > +properties:
> > + compatible:
> > + const: techwell,tw9900
> > +
> > + reg:
> > + maxItems: 1
> > +
> > + vdd-supply:
> > + description: VDD power supply
> > +
> > + reset-gpios:
> > + description: GPIO descriptor for the RESET input pin
> > + maxItems: 1
>
> How about the power down GPIO ?
I will add the power-down GPIO.
>
> The chip requires a clock, which is provided by a crystal oscillator in
> the block diagram I found. Does it also support an external clock ? If
> so the bindings should support it, although this could be added later.
>
> > +
> > + port:
> > + $ref: /schemas/graph.yaml#/properties/port
> > + description:
> > + Video port for the decoder output.
>
> How about input ports, connected to nodes that model the connector(s) ?
>
Could this be added later. Tbh I am not familiar with this.
But if it must be added now: Would this be a correct binding:
ports:
$ref: /schemas/graph.yaml#/properties/ports
patternProperties:
"^port@[0-1]$":
$ref: /schemas/graph.yaml#/properties/port
description: Input port nodes for analog inputs.
properties:
port@2:
$ref: /schemas/graph.yaml#/properties/port
description: Video port for the decoder output.
and in the example:
...
ports {
#address-cells = <1>;
#size-cells = <0>;
port@2 {
reg = <2>;
endpoint {
remote-endpoint = <&vip_in>;
};
};
};
...
--
Kind Regards
Mehdi Djait
Hi Laurent,
On Mon, Oct 09, 2023 at 05:21:22AM +0300, Laurent Pinchart wrote:
> On Fri, Oct 06, 2023 at 06:25:27PM +0200, Mehdi Djait wrote:
> > Hello everyone,
> >
> > This series is based on the fifth iteration of the series introducing the
> > tw9900 driver: sent 29 Dec 2020 [1]
> >
> > This is the version 6 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.
> >
> > Changes v5 => v6:
> > - dropped .skip_top and .field in the supported_modes
> > - added error handling for the i2c writes/reads
> > - added the colorimetry information to fill_fmt
> > - removed pm_runtime
>
> It's not very nice to keep the chip powered up all the time :-(
>
I agree 100% I tried to make it work with pm_runtime but I faced many
issues. I don't know if this is due to my lack of experience but here is
the situation when I enable pm_runtime:
I get most of the time wrong values when calling g_input_status to check
if I have a signal or not.
To do that I read the 0x01 – Chip Status Register I (STATUS1) and check
the BIT(6): HLOCK:
- 1 = Horizontal sync PLL is locked to the incoming video source.
- 0 = Horizontal sync PLL is not locked.
To make the g_input_status work with pm_runtime I had to add a 300
msleep after power ON! Which is a huge delay.
I also face issues with the standard detection...
So I decided to drop it for this first version of the driver.
--
Kind Regards
Mehdi Djait
Hi Mehdi,
kernel test robot noticed the following build errors:
[auto build test ERROR on media-tree/master]
[also build test ERROR on robh/for-next linus/master v6.6-rc5 next-20231013]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Mehdi-Djait/dt-bindings-vendor-prefixes-Add-techwell-vendor-prefix/20231007-002623
base: git://linuxtv.org/media_tree.git master
patch link: https://lore.kernel.org/r/857baa8073f0b8051720959ef8fb1d49a6161d36.1696608809.git.mehdi.djait%40bootlin.com
patch subject: [PATCH v6 3/3] media: i2c: Introduce a driver for the Techwell TW9900 decoder
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20231015/[email protected]/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231015/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/media/i2c/tw9900.c: In function 'tw9900_get_stream_std':
>> drivers/media/i2c/tw9900.c:359:15: error: implicit declaration of function 'FIELD_GET' [-Werror=implicit-function-declaration]
359 | std = FIELD_GET(TW9900_STDNOW_MASK, ret);
| ^~~~~~~~~
cc1: some warnings being treated as errors
vim +/FIELD_GET +359 drivers/media/i2c/tw9900.c
347
348 static int tw9900_get_stream_std(struct tw9900 *tw9900,
349 v4l2_std_id *std_id)
350 {
351 int std, ret;
352
353 ret = tw9900_read_reg(tw9900->client, TW9900_REG_STD_SEL);
354 if (ret < 0) {
355 *std_id = V4L2_STD_UNKNOWN;
356 return ret;
357 }
358
> 359 std = FIELD_GET(TW9900_STDNOW_MASK, ret);
360
361 switch (std) {
362 case TW9900_STD_NTSC_M:
363 *std_id = V4L2_STD_NTSC;
364 break;
365 case TW9900_STD_PAL_BDGHI:
366 *std_id = V4L2_STD_PAL;
367 break;
368 case TW9900_STD_AUTO:
369 *std_id = V4L2_STD_UNKNOWN;
370 break;
371 default:
372 *std_id = V4L2_STD_UNKNOWN;
373 break;
374 }
375
376 return 0;
377 }
378
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki