Re: [PATCH] i2c: tc358743: remove useless variable assignment in tc358743_isr
Thanks! You could remove intstatus &= ~MASK_HDMI_INT; in line 1289 as well. Regards, Mats Randgaard On 15/06/2017, 18:49, "Gustavo A. R. Silva"wrote: Remove useless variable assignment in function tc358743_isr(). The value stored in variable _intstatus_ at line 1299 is overwritten at line 1302, just before it can be used. Addresses-Coverity-ID: 1397678 Signed-off-by: Gustavo A. R. Silva --- drivers/media/i2c/tc358743.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index 3251cba..e8b23f3 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -1296,7 +1296,6 @@ static int tc358743_isr(struct v4l2_subdev *sd, u32 status, bool *handled) tc358743_csi_err_int_handler(sd, handled); i2c_wr16(sd, INTSTATUS, MASK_CSI_INT); - intstatus &= ~MASK_CSI_INT; } intstatus = i2c_rd16(sd, INTSTATUS); -- 2.5.0
Re: [PATCH 2/3] [media] tc358743: Add OF device ID table
CC: Philipp Zabel who added device tree support to this driver Regards, Mats Randgaard On 02/22/2017 05:11 PM, Javier Martinez Canillas wrote: The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:. But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF. Signed-off-by: Javier Martinez Canillas--- drivers/media/i2c/tc358743.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index f569a05fe105..76baf7a7bd57 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -1951,9 +1951,18 @@ static struct i2c_device_id tc358743_id[] = { MODULE_DEVICE_TABLE(i2c, tc358743_id); +#if IS_ENABLED(CONFIG_OF) +static const struct of_device_id tc358743_of_match[] = { + { .compatible = "toshiba,tc358743" }, + {}, +}; +MODULE_DEVICE_TABLE(of, tc358743_of_match); +#endif + static struct i2c_driver tc358743_driver = { .driver = { .name = "tc358743", + .of_match_table = of_match_ptr(tc358743_of_match), }, .probe = tc358743_probe, .remove = tc358743_remove,
[PATCH 1/3] tc358743: Do not read number of CSI lanes in use from chip
From: Mats RandgaardThe number of CSI lanes that should be used is set to the CSI_CONTROL register by indirectly writing to the CSI_CONFW register. When the number of lanes is read back from the CSI_CONTROL register the value is usually correct, but we have seen that it suddenly is 1 for a short moment before the correct value is restored again. Toshiba have not figured out why that happen, but we have found it safer to store the value in the driver. Signed-off-by: Mats Randgaard --- drivers/media/i2c/tc358743.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index 1e3a0dd2..a35aaf8 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -96,6 +96,7 @@ struct tc358743_state { struct v4l2_dv_timings timings; u32 mbus_fmt_code; + u8 csi_lanes_in_use; struct gpio_desc *reset_gpio; }; @@ -287,11 +288,6 @@ static int get_audio_sampling_rate(struct v4l2_subdev *sd) return code_to_rate[i2c_rd8(sd, FS_SET) & MASK_FS]; } -static unsigned tc358743_num_csi_lanes_in_use(struct v4l2_subdev *sd) -{ - return ((i2c_rd32(sd, CSI_CONTROL) & MASK_NOL) >> 1) + 1; -} - /* --- TIMINGS --- */ static inline unsigned fps(const struct v4l2_bt_timings *t) @@ -683,6 +679,8 @@ static void tc358743_set_csi(struct v4l2_subdev *sd) v4l2_dbg(3, debug, sd, "%s:\n", __func__); + state->csi_lanes_in_use = lanes; + tc358743_reset(sd, MASK_CTXRST); if (lanes < 1) @@ -1155,7 +1153,7 @@ static int tc358743_log_status(struct v4l2_subdev *sd) v4l2_info(sd, "Lanes needed: %d\n", tc358743_num_csi_lanes_needed(sd)); v4l2_info(sd, "Lanes in use: %d\n", - tc358743_num_csi_lanes_in_use(sd)); + state->csi_lanes_in_use); v4l2_info(sd, "Waiting for particular sync signal: %s\n", (i2c_rd16(sd, CSI_STATUS) & MASK_S_WSYNC) ? "yes" : "no"); @@ -1438,12 +1436,14 @@ static int tc358743_dv_timings_cap(struct v4l2_subdev *sd, static int tc358743_g_mbus_config(struct v4l2_subdev *sd, struct v4l2_mbus_config *cfg) { + struct tc358743_state *state = to_state(sd); + cfg->type = V4L2_MBUS_CSI2; /* Support for non-continuous CSI-2 clock is missing in the driver */ cfg->flags = V4L2_MBUS_CSI2_CONTINUOUS_CLOCK; - switch (tc358743_num_csi_lanes_in_use(sd)) { + switch (state->csi_lanes_in_use) { case 1: cfg->flags |= V4L2_MBUS_CSI2_1_LANE; break; -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/3] tc358743: Disable HDCP with "manual HDCP authentication" bit
From: Mats RandgaardOriginally Toshiba told us that the only way to disable HDCP was to set the receiver in repeater mode, that would make the authentication fail because of missing software support. It has worked fine with all the sources we and our customers has used, until it was reported problems with Apple MacBook (Retina, 12-inch, Early 2015) (https://support.apple.com/kb/SP712?locale=en_US=en_US) with Apple A1612 USB type-C multiport adapter (http://www.apple.com/shop/product/MJ1K2AM/A/usb-c-digital-av-multiport-adapter) Finally Toshiba came up with a hidden bit that is named "Manual HDCP authentication". In this patch the original "repeater mode" concept is removed, and the new bit is set instead. With his patch HDCP is disabled when connected to the Apple MacBook and all other sources we have tested so far. The Apple MacBook is constantly trying to authenticate, but fails and continues to transmit unencrypted video. Signed-off-by: Mats Randgaard --- drivers/media/i2c/tc358743.c | 32 drivers/media/i2c/tc358743_regs.h | 1 + 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index a35aaf8..257969a 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -368,29 +368,21 @@ static void tc358743_set_hdmi_hdcp(struct v4l2_subdev *sd, bool enable) v4l2_dbg(2, debug, sd, "%s: %s\n", __func__, enable ? "enable" : "disable"); - i2c_wr8_and_or(sd, HDCP_REG1, - ~(MASK_AUTH_UNAUTH_SEL | MASK_AUTH_UNAUTH), - MASK_AUTH_UNAUTH_SEL_16_FRAMES | MASK_AUTH_UNAUTH_AUTO); + if (enable) { + i2c_wr8_and_or(sd, HDCP_REG3, ~KEY_RD_CMD, KEY_RD_CMD); - i2c_wr8_and_or(sd, HDCP_REG2, ~MASK_AUTO_P3_RESET, - SET_AUTO_P3_RESET_FRAMES(0x0f)); + i2c_wr8_and_or(sd, HDCP_MODE, ~MASK_MANUAL_AUTHENTICATION, 0); - /* HDCP is disabled by configuring the receiver as HDCP repeater. The -* repeater mode require software support to work, so HDCP -* authentication will fail. -*/ - i2c_wr8_and_or(sd, HDCP_REG3, ~KEY_RD_CMD, enable ? KEY_RD_CMD : 0); - i2c_wr8_and_or(sd, HDCP_MODE, ~(MASK_AUTO_CLR | MASK_MODE_RST_TN), - enable ? (MASK_AUTO_CLR | MASK_MODE_RST_TN) : 0); + i2c_wr8_and_or(sd, HDCP_REG1, 0xff, + MASK_AUTH_UNAUTH_SEL_16_FRAMES | + MASK_AUTH_UNAUTH_AUTO); - /* Apple MacBook Pro gen.8 has a bug that makes it freeze every fifth -* second when HDCP is disabled, but the MAX_EXCED bit is handled -* correctly and HDCP is disabled on the HDMI output. -*/ - i2c_wr8_and_or(sd, BSTATUS1, ~MASK_MAX_EXCED, - enable ? 0 : MASK_MAX_EXCED); - i2c_wr8_and_or(sd, BCAPS, ~(MASK_REPEATER | MASK_READY), - enable ? 0 : MASK_REPEATER | MASK_READY); + i2c_wr8_and_or(sd, HDCP_REG2, ~MASK_AUTO_P3_RESET, + SET_AUTO_P3_RESET_FRAMES(0x0f)); + } else { + i2c_wr8_and_or(sd, HDCP_MODE, ~MASK_MANUAL_AUTHENTICATION, + MASK_MANUAL_AUTHENTICATION); + } } static void tc358743_disable_edid(struct v4l2_subdev *sd) diff --git a/drivers/media/i2c/tc358743_regs.h b/drivers/media/i2c/tc358743_regs.h index 81f1db5..657ef50 100644 --- a/drivers/media/i2c/tc358743_regs.h +++ b/drivers/media/i2c/tc358743_regs.h @@ -420,6 +420,7 @@ #define MASK_MODE_RST_TN 0x20 #define MASK_LINE_REKEY 0x10 #define MASK_AUTO_CLR 0x04 +#define MASK_MANUAL_AUTHENTICATION0x02 /* Not in REF_01 */ #define HDCP_REG1 0x8563 /* Not in REF_01 */ #define MASK_AUTH_UNAUTH_SEL 0x70 -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/3] tc358743: ctrl_detect_tx_5v should always be updated
From: Mats RandgaardThe control for +5V Power detection must also be updated when the EDID is not present. Signed-off-by: Mats Randgaard --- drivers/media/i2c/tc358743.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index 257969a..f569a05 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -404,6 +404,7 @@ static void tc358743_enable_edid(struct v4l2_subdev *sd) if (state->edid_blocks_written == 0) { v4l2_dbg(2, debug, sd, "%s: no EDID -> no hotplug\n", __func__); + tc358743_s_ctrl_detect_tx_5v(sd); return; } -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] tc358743: Use local array with fixed size in i2c write
From: Mats Randgaardi2c_wr() is called from ops and the interrupt service routine, while state->wr_data is shared and unprotected, and could be overwritten. This shared buffer is therefore replaced with a local array with fixed size. The array has the size of one EDID block (128 bytes) + 2 bytes i2c address, and the EDID is written block by block (up to 8 blocks). Signed-off-by: Mats Randgaard --- drivers/media/i2c/tc358743.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index 77b8011..cc38896 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -59,8 +59,7 @@ MODULE_LICENSE("GPL"); #define EDID_NUM_BLOCKS_MAX 8 #define EDID_BLOCK_SIZE 128 -/* Max transfer size done by I2C transfer functions */ -#define MAX_XFER_SIZE (EDID_NUM_BLOCKS_MAX * EDID_BLOCK_SIZE + 2) +#define I2C_MAX_XFER_SIZE (EDID_BLOCK_SIZE + 2) static const struct v4l2_dv_timings_cap tc358743_timings_cap = { .type = V4L2_DV_BT_656_1120, @@ -97,9 +96,6 @@ struct tc358743_state { /* edid */ u8 edid_blocks_written; - /* used by i2c_wr() */ - u8 wr_data[MAX_XFER_SIZE]; - struct v4l2_dv_timings timings; u32 mbus_fmt_code; @@ -149,13 +145,15 @@ static void i2c_wr(struct v4l2_subdev *sd, u16 reg, u8 *values, u32 n) { struct tc358743_state *state = to_state(sd); struct i2c_client *client = state->i2c_client; - u8 *data = state->wr_data; int err, i; struct i2c_msg msg; + u8 data[I2C_MAX_XFER_SIZE]; - if ((2 + n) > sizeof(state->wr_data)) + if ((2 + n) > I2C_MAX_XFER_SIZE) { + n = I2C_MAX_XFER_SIZE - 2; v4l2_warn(sd, "i2c wr reg=%04x: len=%d is too big!\n", reg, 2 + n); + } msg.addr = client->addr; msg.buf = data; @@ -1581,6 +1579,7 @@ static int tc358743_s_edid(struct v4l2_subdev *sd, { struct tc358743_state *state = to_state(sd); u16 edid_len = edid->blocks * EDID_BLOCK_SIZE; + int i; v4l2_dbg(2, debug, sd, "%s, pad %d, start block %d, blocks %d\n", __func__, edid->pad, edid->start_block, edid->blocks); @@ -1606,7 +1605,8 @@ static int tc358743_s_edid(struct v4l2_subdev *sd, return 0; } - i2c_wr(sd, EDID_RAM, edid->edid, edid_len); + for (i = 0; i < edid_len; i += EDID_BLOCK_SIZE) + i2c_wr(sd, EDID_RAM + i, edid->edid + i, EDID_BLOCK_SIZE); state->edid_blocks_written = edid->blocks; -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] tc358743: Print timings only when debug level is set
From: Mats RandgaardSigned-off-by: Mats Randgaard --- drivers/media/i2c/tc358743.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index cc38896..e9129d1 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -857,15 +857,16 @@ static void tc358743_format_change(struct v4l2_subdev *sd) if (tc358743_get_detected_timings(sd, )) { enable_stream(sd, false); - v4l2_dbg(1, debug, sd, "%s: Format changed. No signal\n", + v4l2_dbg(1, debug, sd, "%s: No signal\n", __func__); } else { if (!v4l2_match_dv_timings(>timings, , 0, false)) enable_stream(sd, false); - v4l2_print_dv_timings(sd->name, - "tc358743_format_change: Format changed. New format: ", - , false); + if (debug) + v4l2_print_dv_timings(sd->name, + "tc358743_format_change: New format: ", + , false); } if (sd->devnode) -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] v4l2-dv-timings: Compare horizontal blanking
From: Mats Randgaardhsync and hbackporch must also be compared Signed-off-by: Mats Randgaard --- drivers/media/v4l2-core/v4l2-dv-timings.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c index 6a83d61..edb4125 100644 --- a/drivers/media/v4l2-core/v4l2-dv-timings.c +++ b/drivers/media/v4l2-core/v4l2-dv-timings.c @@ -239,6 +239,8 @@ bool v4l2_match_dv_timings(const struct v4l2_dv_timings *t1, t1->bt.pixelclock >= t2->bt.pixelclock - pclock_delta && t1->bt.pixelclock <= t2->bt.pixelclock + pclock_delta && t1->bt.hfrontporch == t2->bt.hfrontporch && + t1->bt.hsync == t2->bt.hsync && + t1->bt.hbackporch == t2->bt.hbackporch && t1->bt.vfrontporch == t2->bt.vfrontporch && t1->bt.vsync == t2->bt.vsync && t1->bt.vbackporch == t2->bt.vbackporch && -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/4] tc358743: don't use variable length array for I2C writes
On 08/11/2015 05:18 PM, Mauro Carvalho Chehab wrote: drivers/media/i2c/tc358743.c:148:19: warning: Variable length array is used. As the maximum size is 1026, we can't use dynamic var, as it would otherwise spend 1056 bytes of the stack at i2c_wr() function. So, allocate a buffer with the allowed maximum size together with the state var. Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index 2e926317d7e9..fe42c9a1cb78 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -59,6 +59,9 @@ MODULE_LICENSE(GPL); #define EDID_NUM_BLOCKS_MAX 8 #define EDID_BLOCK_SIZE 128 +/* Max transfer size done by I2C transfer functions */ +#define MAX_XFER_SIZE (EDID_NUM_BLOCKS_MAX * EDID_BLOCK_SIZE + 2) + static const struct v4l2_dv_timings_cap tc358743_timings_cap = { .type = V4L2_DV_BT_656_1120, /* keep this initialization for compatibility with GCC 4.4.6 */ @@ -94,6 +97,9 @@ struct tc358743_state { /* edid */ u8 edid_blocks_written; + /* used by i2c_wr() */ + u8 wr_data[MAX_XFER_SIZE]; + struct v4l2_dv_timings timings; u32 mbus_fmt_code; @@ -143,9 +149,13 @@ static void i2c_wr(struct v4l2_subdev *sd, u16 reg, u8 *values, u32 n) { struct tc358743_state *state = to_state(sd); struct i2c_client *client = state-i2c_client; + u8 *data = state-wr_data; int err, i; struct i2c_msg msg; - u8 data[2 + n]; + + if ((2 + n) sizeof(state-wr_data)) + v4l2_warn(sd, i2c wr reg=%04x: len=%d is too big!\n, + reg, 2 + n); msg.addr = client-addr; msg.buf = data; Acked-by: Mats Randgaard matra...@cisco.com -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC v04] Driver for Toshiba TC358743 HDMI to CSI-2 bridge
From: Mats Randgaard matra...@cisco.com The driver is tested on our hardware and all the implemented features works as expected. Missing features: - CEC support - HDCP repeater support - IR support Signed-off-by: Mats Randgaard matra...@cisco.com diff --git a/MAINTAINERS b/MAINTAINERS index 8133cef..fb98b8d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -10303,6 +10303,13 @@ F: drivers/char/toshiba.c F: include/linux/toshiba.h F: include/uapi/linux/toshiba.h +TOSHIBA TC358743 DRIVER +M: Mats Randgaard matra...@cisco.com +L: linux-media@vger.kernel.org +S: Maintained +F: drivers/media/i2c/tc358743* +F: include/media/tc358743.h + TMIO MMC DRIVER M: Ian Molton i...@mnementh.co.uk L: linux-...@vger.kernel.org diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 71ee8f5..3308706 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -286,6 +286,15 @@ config VIDEO_SAA711X To compile this driver as a module, choose M here: the module will be called saa7115. +config VIDEO_TC358743 + tristate Toshiba TC358743 decoder + depends on VIDEO_V4L2 I2C + ---help--- + Support for the Toshiba TC358743 HDMI to MIPI CSI-2 bridge + + To compile this driver as a module, choose M here: the + module will be called tc358743. + config VIDEO_TVP514X tristate Texas Instruments TVP514x video decoder depends on VIDEO_V4L2 I2C diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index f165fae..07db257 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -78,3 +78,4 @@ obj-$(CONFIG_VIDEO_AK881X)+= ak881x.o obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o obj-$(CONFIG_VIDEO_ML86V7667) += ml86v7667.o obj-$(CONFIG_VIDEO_OV2659) += ov2659.o +obj-$(CONFIG_VIDEO_TC358743) += tc358743.o diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c new file mode 100644 index 000..34d4f32 --- /dev/null +++ b/drivers/media/i2c/tc358743.c @@ -0,0 +1,1778 @@ +/* + * tc358743 - Toshiba HDMI to CSI-2 bridge + * + * Copyright 2014 Cisco Systems, Inc. and/or its affiliates. All rights + * reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +/* + * References (c = chapter, p = page): + * REF_01 - Toshiba, TC358743XBG (H2C), Functional Specification, Rev 0.60 + * REF_02 - Toshiba, TC358743XBG_HDMI-CSI_Tv11p_nm.xls + */ + +#include linux/kernel.h +#include linux/module.h +#include linux/slab.h +#include linux/i2c.h +#include linux/delay.h +#include linux/videodev2.h +#include linux/workqueue.h +#include linux/v4l2-dv-timings.h +#include linux/hdmi.h +#include media/v4l2-dv-timings.h +#include media/v4l2-device.h +#include media/v4l2-ctrls.h +#include media/tc358743.h + +#include tc358743_regs.h + +static int debug; +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, debug level (0-3)); + +MODULE_DESCRIPTION(Toshiba TC358743 HDMI to CSI-2 bridge driver); +MODULE_AUTHOR(Ramakrishnan Muthukrishnan r...@rkrishnan.org); +MODULE_AUTHOR(Mikhail Khelik mkhe...@cisco.com); +MODULE_AUTHOR(Mats Randgaard matra...@cisco.com); +MODULE_LICENSE(GPL); + +#define EDID_NUM_BLOCKS_MAX 8 +#define EDID_BLOCK_SIZE 128 + +static const struct v4l2_dv_timings_cap tc358743_timings_cap = { + .type = V4L2_DV_BT_656_1120, + /* keep this initialization for compatibility with GCC 4.4.6 */ + .reserved = { 0 }, + /* Pixel clock from REF_01 p. 20. Min/max height/width are unknown */ + V4L2_INIT_BT_TIMINGS(1, 1, 1, 1, 0, 16500, + V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | + V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, + V4L2_DV_BT_CAP_PROGRESSIVE | + V4L2_DV_BT_CAP_REDUCED_BLANKING | + V4L2_DV_BT_CAP_CUSTOM) +}; + +struct tc358743_state { + struct tc358743_platform_data pdata; + struct v4l2_subdev sd; + struct media_pad pad; + struct v4l2_ctrl_handler hdl; + struct i2c_client *i2c_client; + /* CONFCTL is modified in both process context and interrupt context */ + struct mutex confctl_mutex; + + /* controls */ + struct v4l2_ctrl *detect_tx_5v_ctrl; + struct v4l2_ctrl
[RFC v04] Driver for Toshiba TC358743
From: Mats Randgaard matra...@cisco.com Improvements based on feedback from Hans Verkuil: - Use functions in linux/hdmi.h to print AVI info frames - Replace private format change event with V4L2_EVENT_SOURCE_CHANGE - Rewrite set_fmt/get_fmt - Remove V4L2_SUBDEV_FL_HAS_DEVNODE Other improvements since the previous version: - Protect CONFCTL with a mutex since it is written in both process context and interrupt context - Restructure and describe the platform data - Replace the register that is verified in the probe function with the read-only register CHIPID Mats Randgaard (1): Driver for Toshiba TC358743 HDMI to CSI-2 bridge MAINTAINERS|7 + drivers/media/i2c/Kconfig |9 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/tc358743.c | 1778 drivers/media/i2c/tc358743_regs.h | 681 ++ include/media/tc358743.h | 131 +++ include/uapi/linux/v4l2-controls.h |4 + 7 files changed, 2611 insertions(+) create mode 100644 drivers/media/i2c/tc358743.c create mode 100644 drivers/media/i2c/tc358743_regs.h create mode 100644 include/media/tc358743.h -- 2.4.3 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] Driver for Toshiba TC358743 HDMI to CSI-2 bridge
From: Mats Randgaard matra...@cisco.com The driver is tested on our hardware and all the implemented features works as expected. Missing features: - CEC support - HDCP repeater support - IR support Signed-off-by: Mats Randgaard matra...@cisco.com --- MAINTAINERS|6 + drivers/media/i2c/Kconfig |9 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/tc358743.c | 1838 drivers/media/i2c/tc358743_regs.h | 680 + include/media/tc358743.h | 92 ++ include/uapi/linux/v4l2-controls.h |4 + 7 files changed, 2630 insertions(+) create mode 100644 drivers/media/i2c/tc358743.c create mode 100644 drivers/media/i2c/tc358743_regs.h create mode 100644 include/media/tc358743.h diff --git a/MAINTAINERS b/MAINTAINERS index 30e7e38..49e9f84 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9856,6 +9856,12 @@ L: platform-driver-...@vger.kernel.org S: Orphan F: drivers/platform/x86/toshiba_acpi.c +TOSHIBA TC358743 DRIVER +M: Mats Randgaard matra...@cisco.com +L: linux-media@vger.kernel.org +S: Maintained +F: drivers/media/i2c/tc358743* + TOSHIBA SMM DRIVER M: Jonathan Buzzard jonat...@buzzard.org.uk L: tlinux-us...@tce.toshiba-dme.co.jp diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 6f30ea7..e352daa 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -285,6 +285,15 @@ config VIDEO_SAA711X To compile this driver as a module, choose M here: the module will be called saa7115. +config VIDEO_TC358743 + tristate Toshiba TC358743 decoder + depends on VIDEO_V4L2 I2C + ---help--- + Support for the Toshiba TC358743 HDMI to MIPI CSI-2 bridge + + To compile this driver as a module, choose M here: the + module will be called tc358743. + config VIDEO_TVP514X tristate Texas Instruments TVP514x video decoder depends on VIDEO_V4L2 I2C diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index f165fae..07db257 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -78,3 +78,4 @@ obj-$(CONFIG_VIDEO_AK881X)+= ak881x.o obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o obj-$(CONFIG_VIDEO_ML86V7667) += ml86v7667.o obj-$(CONFIG_VIDEO_OV2659) += ov2659.o +obj-$(CONFIG_VIDEO_TC358743) += tc358743.o diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c new file mode 100644 index 000..e9328c4 --- /dev/null +++ b/drivers/media/i2c/tc358743.c @@ -0,0 +1,1838 @@ +/* + * tc358743 - Toshiba HDMI to CSI-2 bridge + * + * Copyright 2014 Cisco Systems, Inc. and/or its affiliates. All rights + * reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +/* + * References (c = chapter, p = page): + * REF_01 - Toshiba, TC358743XBG (H2C), Functional Specification, Rev 0.60 + * REF_02 - Toshiba, TC358743XBG_HDMI-CSI_Tv11p_nm.xls + */ + +#include linux/kernel.h +#include linux/module.h +#include linux/slab.h +#include linux/i2c.h +#include linux/delay.h +#include linux/videodev2.h +#include linux/workqueue.h +#include linux/v4l2-dv-timings.h +#include media/v4l2-dv-timings.h +#include media/v4l2-device.h +#include media/v4l2-ctrls.h +#include media/tc358743.h + +#include tc358743_regs.h + +static int debug; +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, debug level (0-3)); + +MODULE_DESCRIPTION(Toshiba TC358743 HDMI to CSI-2 bridge driver); +MODULE_AUTHOR(Ramakrishnan Muthukrishnan r...@rkrishnan.org); +MODULE_AUTHOR(Mikhail Khelik mkhe...@cisco.com); +MODULE_AUTHOR(Mats Randgaard matra...@cisco.com); +MODULE_LICENSE(GPL); + +#define EDID_NUM_BLOCKS_MAX 8 +#define EDID_BLOCK_SIZE 128 + +static const struct v4l2_dv_timings_cap tc358743_timings_cap = { + .type = V4L2_DV_BT_656_1120, + /* keep this initialization for compatibility with GCC 4.4.6 */ + .reserved = { 0 }, + /* Pixel clock from REF_01 p. 20. Min/max height/width are unknown */ + V4L2_INIT_BT_TIMINGS(1, 1, 1, 1, 0, 16500, + V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | + V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, + V4L2_DV_BT_CAP_PROGRESSIVE | +
Re: [RFC 02/12] [media] tc358743: register v4l2 asynchronous subdevice
On 03/30/2015 01:10 PM, Philipp Zabel wrote: Add support for registering the sensor subdevice using the v4l2-async API. Signed-off-by: Philipp Zabelp.za...@pengutronix.de --- drivers/media/i2c/tc358743.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index a86cbe0..dfc10f0 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -1711,6 +1711,16 @@ static int tc358743_probe(struct i2c_client *client, goto err_hdl; } + state-pad.flags = MEDIA_PAD_FL_SOURCE; + err = media_entity_init(sd-entity, 1, state-pad, 0); + if (err 0) + goto err_hdl; + + sd-dev = client-dev; sd-dev = client-dev is already done by v4l2_i2c_subdev_init() ~50 lines above The rest of the code seems fine to me, but I can not test it since the kernel we use is too old to support async subdevs. Regards, Mats Randgaard + err = v4l2_async_register_subdev(sd); + if (err 0) + goto err_hdl; + INIT_DELAYED_WORK(state-delayed_work_enable_hotplug, tc358743_delayed_work_enable_hotplug); @@ -1731,6 +1741,7 @@ static int tc358743_probe(struct i2c_client *client, return 0; err_hdl: + media_entity_cleanup(sd-entity); v4l2_ctrl_handler_free(state-hdl); return err; } @@ -1742,6 +1753,7 @@ static int tc358743_remove(struct i2c_client *client) cancel_delayed_work(state-delayed_work_enable_hotplug); destroy_workqueue(state-work_queues); + v4l2_async_unregister_subdev(sd); v4l2_device_unregister_subdev(sd); v4l2_ctrl_handler_free(state-hdl); -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC 03/12] [media] tc358743: support probe from device tree
On 03/30/2015 01:10 PM, Philipp Zabel wrote: Add support for probing the TC358743 subdevice from device tree. The reference clock must be supplied using the common clock bindings. Signed-off-by: Philipp Zabelp.za...@pengutronix.de --- drivers/media/i2c/tc358743.c | 133 +-- 1 file changed, 128 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index dfc10f0..85a0f7a 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -29,7 +29,9 @@ #include linux/module.h #include linux/slab.h #include linux/i2c.h +#include linux/clk.h #include linux/delay.h +#include linux/gpio/consumer.h #include linux/videodev2.h #include linux/workqueue.h #include linux/v4l2-dv-timings.h @@ -84,6 +86,8 @@ struct tc358743_state { struct v4l2_dv_timings timings; u32 mbus_fmt_code; + + struct gpio_desc *reset_gpio; }; static inline struct tc358743_state *to_state(struct v4l2_subdev *sd) @@ -1628,12 +1632,126 @@ static const struct v4l2_ctrl_config tc358743_ctrl_audio_present = { .id = TC358743_CID_AUDIO_PRESENT, .name = Audio present, .type = V4L2_CTRL_TYPE_BOOLEAN, + .min = 0, + .max = 1, + .step = 1, This is already fixed in the latest version of the driver. The rest of the code seems to be a hack for your hardware. Regards, Mats Randgaard .def = 0, .flags = V4L2_CTRL_FLAG_READ_ONLY, }; /* --- PROBE / REMOVE --- */ +#if CONFIG_OF +static void tc358743_gpio_reset(struct tc358743_state *state) +{ + gpiod_set_value(state-reset_gpio, 0); + usleep_range(5000, 1); + gpiod_set_value(state-reset_gpio, 1); + usleep_range(1000, 2000); + gpiod_set_value(state-reset_gpio, 0); + msleep(20); +} + +static int tc358743_probe_of(struct tc358743_state *state) +{ + struct device *dev = state-i2c_client-dev; + struct device_node *np = dev-of_node; + struct clk *refclk; + u32 bps_pr_lane; + + refclk = devm_clk_get(dev, refclk); + if (IS_ERR(refclk)) { + if (PTR_ERR(refclk) != -EPROBE_DEFER) + dev_err(dev, failed to get refclk: %ld\n, + PTR_ERR(refclk)); + return PTR_ERR(refclk); + } + + clk_prepare_enable(refclk); + + state-pdata.refclk_hz = clk_get_rate(refclk); + state-pdata.ddc5v_delay = DDC5V_DELAY_100MS; + state-pdata.enable_hdcp = false; + /* A FIFO level of 16 should be enough for 2-lane 720p60 at 594 MHz. */ + state-pdata.fifo_level = 16; + /* +* The PLL input clock is obtained by dividing refclk by pll_prd. +* It must be between 6 MHz and 40 MHz, lower frequency is better. +*/ + switch (state-pdata.refclk_hz) { + case 2600: + case 2700: + case 4200: + state-pdata.pll_prd = state-pdata.refclk_hz / 600; + break; + default: + dev_err(dev, unsupported refclk rate: %u Hz\n, + state-pdata.refclk_hz); + clk_disable_unprepare(refclk); + return -EINVAL; + } + + /* +* The CSI bps per lane must be between 62.5 Mbps and 1 Gbps. +* The default is 594 Mbps for 4-lane 1080p60 or 2-lane 720p60. +*/ + bps_pr_lane = 59400U; + of_property_read_u32(np, toshiba,bps-per-lane, bps_pr_lane); + if (bps_pr_lane 6250U || bps_pr_lane 10U) { + dev_err(dev, unsupported bps per lane: %u bps\n, bps_pr_lane); + clk_disable_unprepare(refclk); + return -EINVAL; + } + state-pdata.bps_pr_lane = bps_pr_lane; + + /* The CSI speed per lane is refclk / pll_prd * pll_fbd */ + state-pdata.pll_fbd = state-pdata.bps_pr_lane / + state-pdata.refclk_hz * state-pdata.pll_prd; + bps_pr_lane = state-pdata.refclk_hz / state-pdata.pll_prd * + state-pdata.pll_fbd; + if (bps_pr_lane != state-pdata.bps_pr_lane) { + dev_warn(dev, bps per lane corrected to %u bps\n, +bps_pr_lane); + state-pdata.bps_pr_lane = bps_pr_lane; + } + + /* FIXME: These timings are from REF_02 for 594 Mbps per lane */ + state-pdata.lineinitcnt = 0xe80; + state-pdata.lptxtimecnt = 0x003; + /* tclk-preparecnt: 3, tclk-zerocnt: 20 */ + state-pdata.tclk_headercnt = 0x1403; + state-pdata.tclk_trailcnt = 0x00; + /* ths-preparecnt: 3, ths-zerocnt: 1 */ + state-pdata.ths_headercnt = 0x0103; + state-pdata.twakeup = 0x4882; + state-pdata.tclk_postcnt = 0x008; + state-pdata.ths_trailcnt = 0x2; + state-pdata.hstxvregcnt = 0; + + /* HDMI PHY */ + state-pdata.phy_auto_rst = 0; +
Re: [RFC 05/12] [media] tc358743: fix lane number calculation to include blanking
On 03/30/2015 01:10 PM, Philipp Zabel wrote: Instead of only using the visible width and height, also add the horizontal and vertical blanking to calculate the bit rate. I am not a CSI expert and when I look at the spreadsheet from Toshiba I understand that the calculation of the CSI parameters is quite complex. I think you are right that there should be added some kind of blanking to the active video, but adding all the blanking from the HDMI format gives a too high value. It seems like the calculation will fail if CSI clock enable during LP is set to Disable, but that is not supported by the driver at the moment. I have tested all the resolutions between 640x480p60 and 1920x1080p60 that my video generator will give me, and it works perfect on our product. Do you have to change this for your product? Signed-off-by: Philipp Zabelp.za...@pengutronix.de --- drivers/media/i2c/tc358743.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index dd2ea16..74e83c5 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -713,9 +713,11 @@ static unsigned tc358743_num_csi_lanes_needed(struct v4l2_subdev *sd) { struct tc358743_state *state = to_state(sd); struct v4l2_bt_timings *bt = state-timings.bt; + u32 htotal = bt-width + bt-hfrontporch + bt-hsync + bt-hbackporch; + u32 vtotal = bt-height + bt-vfrontporch + bt-vsync + bt-vbackporch; By the way, V4L2_DV_BT_FRAME_WIDTH(bt) and V4L2_DV_BT_FRAME_HEIGHT(bt) can be used to calculate total frame width and height. Regards, Mats Randgaard u32 bits_pr_pixel = (state-mbus_fmt_code == MEDIA_BUS_FMT_UYVY8_1X16) ? 16 : 24; - u32 bps = bt-width * bt-height * fps(bt) * bits_pr_pixel; + u32 bps = htotal * vtotal * fps(bt) * bits_pr_pixel; return DIV_ROUND_UP(bps, state-pdata.bps_pr_lane); } -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC 10/12] [media] tc358743: detect chip by ChipID instead of IntMask
On 03/30/2015 01:10 PM, Philipp Zabel wrote: When resetting the CPU instead of power cycling, IntMask is still set from last boot. Instead of depending on it to be set to its reset defaults, check the ChipID register and rewrite IntMask if needed. Signed-off-by: Philipp Zabelp.za...@pengutronix.de --- drivers/media/i2c/tc358743.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index 2cf97d9..02b131b 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -1847,13 +1847,19 @@ static int tc358743_probe(struct i2c_client *client, sd-flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS; /* i2c access */ + if (i2c_rd16(sd, CHIPID) != 0x) { + v4l2_info(sd, not a TC358743 on address 0x%x\n, + client-addr 1); + return -ENODEV; + } Yes, it is better to read a read-only-register. /* read the interrupt mask register, it should carry the * default values, as it hasn't been touched at this point. */ if (i2c_rd16(sd, INTMASK) != 0x0400) { - v4l2_info(sd, not a TC358743 on address 0x%x\n, - client-addr 1); - return -ENODEV; + v4l2_warn(sd, initial interrupt mask: 0x%04x\n, + i2c_rd16(sd, INTMASK)); + i2c_wr16(sd, INTMASK, 0x0400); + } tc358743_clear_interrupt_status(sd); Are there other registers that are not reset? If so, I think the driver should reset them all during initialization. Regards, Mats Randgaard -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC 00/12] TC358743 async subdev and dt support
Hi Philipp, Thank you for reviewing, testing and committing new patches to the driver for TC358743! Fixed in latest version of the driver: * [media] tc358743: split set_csi into set_csi and start_csi * [media] tc358743: also set TCLK_TRAILCNT and TCLK_POSTCNT * [media] tc358743: don't return E2BIG from G_EDID The code seems fine to me, but I am not able to test it: * [media] tc358743: add direct interrupt handling * [media] tc358743: allow event subscription The rest of the patches are commented inline. Regards, Mats Randgaard On 03/30/2015 01:10 PM, Philipp Zabel wrote: Hi Mats, did you have time to work on the TC358743 driver some more in the meanwhile? These are the changes I have made locally to v1 to get it to work on i.MX6. regards Philipp Mats Randgaard (1): [media] Driver for Toshiba TC358743 CSI-2 to HDMI bridge Philipp Zabel (11): [media] tc358743: register v4l2 asynchronous subdevice [media] tc358743: support probe from device tree [media] tc358743: fix set_pll to enable PLL with default frequency [media] tc358743: fix lane number calculation to include blanking [media] tc358743: split set_csi into set_csi and start_csi [media] tc358743: also set TCLK_TRAILCNT and TCLK_POSTCNT [media] tc358743: parse MIPI CSI-2 endpoint, support noncontinuous clock [media] tc358743: add direct interrupt handling [media] tc358743: detect chip by ChipID instead of IntMask [media] tc358743: don't return E2BIG from G_EDID [media] tc358743: allow event subscription MAINTAINERS|6 + drivers/media/i2c/Kconfig | 12 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/tc358743.c | 1979 drivers/media/i2c/tc358743_regs.h | 670 include/media/tc358743.h | 89 ++ include/uapi/linux/v4l2-controls.h |4 + 7 files changed, 2761 insertions(+) create mode 100644 drivers/media/i2c/tc358743.c create mode 100644 drivers/media/i2c/tc358743_regs.h create mode 100644 include/media/tc358743.h -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC 04/12] [media] tc358743: fix set_pll to enable PLL with default frequency
On 03/30/2015 01:10 PM, Philipp Zabel wrote: set_pll not only skips PLL changes but also doesn't enable it in the first place if the rate is the same as the default values. Signed-off-by: Philipp Zabel p.za...@pengutronix.de --- drivers/media/i2c/tc358743.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index 85a0f7a..dd2ea16 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -606,6 +606,7 @@ static void tc358743_set_pll(struct v4l2_subdev *sd) struct tc358743_state *state = to_state(sd); struct tc358743_platform_data *pdata = state-pdata; u16 pllctl0 = i2c_rd16(sd, PLLCTL0); +u16 pllctl1 = i2c_rd16(sd, PLLCTL1); u16 pllctl0_new = SET_PLL_PRD(pdata-pll_prd) | SET_PLL_FBD(pdata-pll_fbd); @@ -613,8 +614,8 @@ static void tc358743_set_pll(struct v4l2_subdev *sd) /* Only rewrite when needed, since rewriting triggers another format * change event. */ -if (pllctl0 != pllctl0_new) { - u32 hsck = (pdata-refclk_hz * pdata-pll_prd) / pdata-pll_fbd; + if ((pllctl0 != pllctl0_new) || ((pllctl1 MASK_PLL_EN) == 0)) { + u32 hsck = (pdata-refclk_hz * pdata-pll_fbd) / pdata-pll_prd; Yes, that is a bug that should be fixed! The calculation of hsck is fixed in the latest version of the driver. Regards, Mats Randgaard -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RCF02] Driver for Toshiba TC358743 CSI-2 to HDMI bridge
From: Mats Randgaard matra...@cisco.com Hi, I have finally finished the second RFC for this driver. Changes since RFC01: - Improved code based on feedback from Hans and Philipp. For the CSI parameters have I only written a set of values that can serve as a starting point, since calculation of the parameters in the driver will require more work. - Fixed problem with some sources that are transmitting an unstable signal while they are in standby. - Fixed problem where audio was not received from some sources after coming out of standby, reconnecting cable or stopping/starting the stream. - When the stream is enabled a proper lane transition is triggered on the CSI interface to ensure that the CSI receiver is ready. - All CE and IT formats are detected as RGB full quantization range in DVI mode. Philipp, I have not had time to look at your patches, so maybe you can rebase them on this version of the driver? Mats Randgaard (1): Driver for Toshiba TC358743 CSI-2 to HDMI bridge MAINTAINERS|6 + drivers/media/i2c/Kconfig |9 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/tc358743.c | 1838 drivers/media/i2c/tc358743_regs.h | 680 + include/media/tc358743.h | 92 ++ include/uapi/linux/v4l2-controls.h |4 + 7 files changed, 2630 insertions(+) create mode 100644 drivers/media/i2c/tc358743.c create mode 100644 drivers/media/i2c/tc358743_regs.h create mode 100644 include/media/tc358743.h -- 2.3.4 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RCF02] Driver for Toshiba TC358743 CSI-2 to HDMI bridge
From: Mats Randgaard matra...@cisco.com The driver is tested on our hardware and all the implemented features works as expected. Missing features: - CEC support - HDCP repeater support - IR support Signed-off-by: Mats Randgaard matra...@cisco.com --- MAINTAINERS|6 + drivers/media/i2c/Kconfig |9 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/tc358743.c | 1838 drivers/media/i2c/tc358743_regs.h | 680 + include/media/tc358743.h | 92 ++ include/uapi/linux/v4l2-controls.h |4 + 7 files changed, 2630 insertions(+) create mode 100644 drivers/media/i2c/tc358743.c create mode 100644 drivers/media/i2c/tc358743_regs.h create mode 100644 include/media/tc358743.h diff --git a/MAINTAINERS b/MAINTAINERS index 30e7e38..49e9f84 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9856,6 +9856,12 @@ L: platform-driver-...@vger.kernel.org S: Orphan F: drivers/platform/x86/toshiba_acpi.c +TOSHIBA TC358743 DRIVER +M: Mats Randgaard matra...@cisco.com +L: linux-media@vger.kernel.org +S: Maintained +F: drivers/media/i2c/tc358743* + TOSHIBA SMM DRIVER M: Jonathan Buzzard jonat...@buzzard.org.uk L: tlinux-us...@tce.toshiba-dme.co.jp diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 6f30ea7..e352daa 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -285,6 +285,15 @@ config VIDEO_SAA711X To compile this driver as a module, choose M here: the module will be called saa7115. +config VIDEO_TC358743 + tristate Toshiba TC358743 decoder + depends on VIDEO_V4L2 I2C + ---help--- + Support for the Toshiba TC358743 HDMI to MIPI CSI-2 bridge + + To compile this driver as a module, choose M here: the + module will be called tc358743. + config VIDEO_TVP514X tristate Texas Instruments TVP514x video decoder depends on VIDEO_V4L2 I2C diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index f165fae..07db257 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -78,3 +78,4 @@ obj-$(CONFIG_VIDEO_AK881X)+= ak881x.o obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o obj-$(CONFIG_VIDEO_ML86V7667) += ml86v7667.o obj-$(CONFIG_VIDEO_OV2659) += ov2659.o +obj-$(CONFIG_VIDEO_TC358743) += tc358743.o diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c new file mode 100644 index 000..e9328c4 --- /dev/null +++ b/drivers/media/i2c/tc358743.c @@ -0,0 +1,1838 @@ +/* + * tc358743 - Toshiba HDMI to CSI-2 bridge + * + * Copyright 2014 Cisco Systems, Inc. and/or its affiliates. All rights + * reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +/* + * References (c = chapter, p = page): + * REF_01 - Toshiba, TC358743XBG (H2C), Functional Specification, Rev 0.60 + * REF_02 - Toshiba, TC358743XBG_HDMI-CSI_Tv11p_nm.xls + */ + +#include linux/kernel.h +#include linux/module.h +#include linux/slab.h +#include linux/i2c.h +#include linux/delay.h +#include linux/videodev2.h +#include linux/workqueue.h +#include linux/v4l2-dv-timings.h +#include media/v4l2-dv-timings.h +#include media/v4l2-device.h +#include media/v4l2-ctrls.h +#include media/tc358743.h + +#include tc358743_regs.h + +static int debug; +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, debug level (0-3)); + +MODULE_DESCRIPTION(Toshiba TC358743 HDMI to CSI-2 bridge driver); +MODULE_AUTHOR(Ramakrishnan Muthukrishnan r...@rkrishnan.org); +MODULE_AUTHOR(Mikhail Khelik mkhe...@cisco.com); +MODULE_AUTHOR(Mats Randgaard matra...@cisco.com); +MODULE_LICENSE(GPL); + +#define EDID_NUM_BLOCKS_MAX 8 +#define EDID_BLOCK_SIZE 128 + +static const struct v4l2_dv_timings_cap tc358743_timings_cap = { + .type = V4L2_DV_BT_656_1120, + /* keep this initialization for compatibility with GCC 4.4.6 */ + .reserved = { 0 }, + /* Pixel clock from REF_01 p. 20. Min/max height/width are unknown */ + V4L2_INIT_BT_TIMINGS(1, 1, 1, 1, 0, 16500, + V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | + V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, + V4L2_DV_BT_CAP_PROGRESSIVE | +
Re: [RFC 00/12] TC358743 async subdev and dt support
Hi Philipp, Hans forwarded this patch series to me now, since I haven't received if for some reason. I will prioritize upstreaming of the driver the next couple of days and create a new RFC. I will also go through your patches and give you feedback! Regards, Mats On 03/30/2015 01:10 PM, Philipp Zabel wrote: Hi Mats, did you have time to work on the TC358743 driver some more in the meanwhile? These are the changes I have made locally to v1 to get it to work on i.MX6. regards Philipp Mats Randgaard (1): [media] Driver for Toshiba TC358743 CSI-2 to HDMI bridge Philipp Zabel (11): [media] tc358743: register v4l2 asynchronous subdevice [media] tc358743: support probe from device tree [media] tc358743: fix set_pll to enable PLL with default frequency [media] tc358743: fix lane number calculation to include blanking [media] tc358743: split set_csi into set_csi and start_csi [media] tc358743: also set TCLK_TRAILCNT and TCLK_POSTCNT [media] tc358743: parse MIPI CSI-2 endpoint, support noncontinuous clock [media] tc358743: add direct interrupt handling [media] tc358743: detect chip by ChipID instead of IntMask [media] tc358743: don't return E2BIG from G_EDID [media] tc358743: allow event subscription MAINTAINERS|6 + drivers/media/i2c/Kconfig | 12 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/tc358743.c | 1979 drivers/media/i2c/tc358743_regs.h | 670 include/media/tc358743.h | 89 ++ include/uapi/linux/v4l2-controls.h |4 + 7 files changed, 2761 insertions(+) create mode 100644 drivers/media/i2c/tc358743.c create mode 100644 drivers/media/i2c/tc358743_regs.h create mode 100644 include/media/tc358743.h -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC v01] Driver for Toshiba TC358743 CSI-2 to HDMI bridge
Thank you again for testing this driver! I am sorry I haven't had time to prepare a second RFC for this driver, but I will try to do that as soon as possible. On 02/17/2015 09:50 AM, Philipp Zabel wrote: Hi Mats, Am Montag, den 15.12.2014, 19:21 +0100 schrieb matra...@cisco.com: [...] +static void tc358743_set_pll(struct v4l2_subdev *sd) +{ + struct tc358743_state *state = to_state(sd); + struct tc358743_platform_data *pdata = state-pdata; + u16 pllctl0 = i2c_rd16(sd, PLLCTL0); + u16 pllctl0_new = SET_PLL_PRD(pdata-pll_prd) | + SET_PLL_FBD(pdata-pll_fbd); + + v4l2_dbg(2, debug, sd, %s:\n, __func__); + + /* Only rewrite when needed, since rewriting triggers another format +* change event. */ + if (pllctl0 != pllctl0_new) { + u32 hsck = (pdata-refclk_hz * pdata-pll_prd) / pdata-pll_fbd; This is the wrong way around. refclk_hz is divided by pll_prd to get the PLL input clock. The PLL then multiplies by pll_fbd. Example: refclk_hz = 2700, pll_prd = 4, pll_fbd = 88 -- hsck = refclk_hz / pll_prd * pll_fbd = 594 MHz, pll_frs should be 0. Yes, you are right, and there was a bug in SET_PLL_FRS() as well, so the bits where always set to zero. I will fix that! [...] +static unsigned tc358743_num_csi_lanes_needed(struct v4l2_subdev *sd) +{ + struct tc358743_state *state = to_state(sd); + struct v4l2_bt_timings *bt = state-timings.bt; + u32 bits_pr_pixel = + (state-mbus_fmt_code == MEDIA_BUS_FMT_UYVY8_1X16) ? 16 : 24; + u32 bps = bt-width * bt-height * fps(bt) * bits_pr_pixel; I think this calculation should include the blanking intervals. As far as I understand is only the active video from the HDMI interface transferred on the CSI interface, so I think this calculation is correct. We transfer 1080p60 video on four lanes with 823.5 Mbps/lane, which would not have been possible if the blanking should have been transferred as well ((2200 * 1125 * 60 * 24) bps / 823.5 Mbps/lane = 4.33 lanes. +static void tc358743_set_csi(struct v4l2_subdev *sd) +{ + struct tc358743_state *state = to_state(sd); + struct tc358743_platform_data *pdata = state-pdata; + unsigned lanes = tc358743_num_csi_lanes_needed(sd); + + v4l2_dbg(3, debug, sd, %s:\n, __func__); + + tc358743_reset(sd, MASK_CTXRST); + + if (lanes 1) + i2c_wr32(sd, CLW_CNTRL, MASK_CLW_LANEDISABLE); + if (lanes 1) + i2c_wr32(sd, D0W_CNTRL, MASK_D0W_LANEDISABLE); + if (lanes 2) + i2c_wr32(sd, D1W_CNTRL, MASK_D1W_LANEDISABLE); + if (lanes 3) + i2c_wr32(sd, D2W_CNTRL, MASK_D2W_LANEDISABLE); + if (lanes 4) + i2c_wr32(sd, D3W_CNTRL, MASK_D3W_LANEDISABLE); + + i2c_wr32(sd, LINEINITCNT, pdata-lineinitcnt); + i2c_wr32(sd, LPTXTIMECNT, pdata-lptxtimecnt); + i2c_wr32(sd, TCLK_HEADERCNT, pdata-tclk_headercnt); + i2c_wr32(sd, THS_HEADERCNT, pdata-ths_headercnt); + i2c_wr32(sd, TWAKEUP, pdata-twakeup); + i2c_wr32(sd, THS_TRAILCNT, pdata-ths_trailcnt); + i2c_wr32(sd, HSTXVREGCNT, pdata-hstxvregcnt); + + i2c_wr32(sd, HSTXVREGEN, + ((lanes 0) ? MASK_CLM_HSTXVREGEN : 0x0) | + ((lanes 0) ? MASK_D0M_HSTXVREGEN : 0x0) | + ((lanes 1) ? MASK_D1M_HSTXVREGEN : 0x0) | + ((lanes 2) ? MASK_D2M_HSTXVREGEN : 0x0) | + ((lanes 3) ? MASK_D3M_HSTXVREGEN : 0x0)); + + i2c_wr32(sd, TXOPTIONCNTRL, MASK_CONTCLKMODE); Since anything below can't be undone without pulling CTXRST, I propose to split tc358743_set_csi into tc358743_set_csi (above) and tc358743_start_csi (below). To make this driver work with the Synopsys DesignWare MIPI CSI-2 Host Controller, there needs to be a time when the lanes are in stop state first, so the host can synchronize. I'd then like to call start_csi in s_stream only. With help from Toshiba we have now implemented start and stop of the CSI interface without pulling CTXRST. You can see our solution in the next RFC, and I would appreciate if you could test if that works fine for you as well! Regards, Mats Randgaard -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 16/16] [media] Add MAINTAINERS entry for the adv7180
On 01/13/2015 01:01 PM, Lars-Peter Clausen wrote: Add myself as the maintainer for the adv7180 video subdev driver. Signed-off-by: Lars-Peter Clausen l...@metafoo.de --- MAINTAINERS | 7 +++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 4318f34..22bb77e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -659,6 +659,13 @@ L: linux-media@vger.kernel.org S:Maintained F: drivers/media/i2c/ad9389b* +ANALOG DEVICES INC ADV7180 DRIVER +M:Lars-Peter Clausen l...@metafoo.de +L:linux-media@vger.kernel.org +W: http://ez.analog.com/community/linux-device-drivers I think the web address should be http://ez.analog.com/community/video It is written much more about ADV7180 there, and people asking questions about video devices has been directed to the Video forum in the past. Regards, Mats Randgaard +S:Supported +F:drivers/media/i2c/adv7180.c + ANALOG DEVICES INC ADV7511 DRIVER M:Hans Verkuil hans.verk...@cisco.com L: linux-media@vger.kernel.org -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC v01] Driver for Toshiba TC358743 CSI-2 to HDMI bridge
Thanks for testing the driver! On 01/08/2015 06:12 PM, Philipp Zabel wrote: Hi Mats, Am Montag, den 15.12.2014, 19:21 +0100 schrieb matra...@cisco.com: From: Mats Randgaard matra...@cisco.com The driver is tested on our hardware and all the implemented features works as expected. Missing features: - CEC support - HDCP repeater support - IR support Signed-off-by: Mats Randgaard matra...@cisco.com --- MAINTAINERS|6 + drivers/media/i2c/Kconfig | 12 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/tc358743.c | 1768 drivers/media/i2c/tc358743_regs.h | 670 ++ include/media/tc358743.h | 89 ++ include/uapi/linux/v4l2-controls.h |4 + 7 files changed, 2550 insertions(+) create mode 100644 drivers/media/i2c/tc358743.c create mode 100644 drivers/media/i2c/tc358743_regs.h create mode 100644 include/media/tc358743.h [...] diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c new file mode 100644 index 000..a86cbe0 --- /dev/null +++ b/drivers/media/i2c/tc358743.c [...] +/* --- CUSTOM CTRLS --- */ + +static const struct v4l2_ctrl_config tc358743_ctrl_audio_sampling_rate = { + .id = TC358743_CID_AUDIO_SAMPLING_RATE, + .name = Audio sampling rate, + .type = V4L2_CTRL_TYPE_INTEGER, + .min = 0, + .max = 768000, + .step = 1, + .def = 0, + .flags = V4L2_CTRL_FLAG_READ_ONLY, +}; + +static const struct v4l2_ctrl_config tc358743_ctrl_audio_present = { + .id = TC358743_CID_AUDIO_PRESENT, + .name = Audio present, + .type = V4L2_CTRL_TYPE_BOOLEAN, If I don't add + .max = 1, + .step = 1, here, I get -ERANGE from v4l2_ctrl_new_custom for this control. The product I use for testing of this driver has a really old kernel where this validation of the boolean controls is missing. I'll fix this in the next revision of this driver. Thanks, Mats Randgaard regards Philipp -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[RFC v01] Driver for Toshiba TC358743 CSI-2 to HDMI bridge
From: Mats Randgaard matra...@cisco.com The driver is tested on our hardware and all the implemented features works as expected. Missing features: - CEC support - HDCP repeater support - IR support Signed-off-by: Mats Randgaard matra...@cisco.com --- MAINTAINERS|6 + drivers/media/i2c/Kconfig | 12 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/tc358743.c | 1768 drivers/media/i2c/tc358743_regs.h | 670 ++ include/media/tc358743.h | 89 ++ include/uapi/linux/v4l2-controls.h |4 + 7 files changed, 2550 insertions(+) create mode 100644 drivers/media/i2c/tc358743.c create mode 100644 drivers/media/i2c/tc358743_regs.h create mode 100644 include/media/tc358743.h diff --git a/MAINTAINERS b/MAINTAINERS index 9c49eb6..7608a83 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9448,6 +9448,12 @@ L: platform-driver-...@vger.kernel.org S: Orphan F: drivers/platform/x86/toshiba_acpi.c +TOSHIBA TC358743 DRIVER +M: Mats Randgaard matra...@cisco.com +L: linux-media@vger.kernel.org +S: Maintained +F: drivers/media/i2c/tc358743* + TOSHIBA SMM DRIVER M: Jonathan Buzzard jonat...@buzzard.org.uk L: tlinux-us...@tce.toshiba-dme.co.jp diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index f40b4cf..0103cdf 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -293,6 +293,18 @@ config VIDEO_SAA7191 To compile this driver as a module, choose M here: the module will be called saa7191. +config VIDEO_TC358743 + tristate Toshiba TC358743 decoder + depends on VIDEO_V4L2 I2C + ---help--- + Support for the Toshiba TC358743 HDMI to MIPI CSI-2 bridge + + This is a Analog Devices Component/Graphics Digitizer + with 4:1 Multiplexed HDMI Receiver. + + To compile this driver as a module, choose M here: the + module will be called tc358743. + config VIDEO_TVP514X tristate Texas Instruments TVP514x video decoder depends on VIDEO_V4L2 I2C diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 01ae932..b4dea43 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -78,3 +78,4 @@ obj-$(CONFIG_VIDEO_SMIAPP_PLL)+= smiapp-pll.o obj-$(CONFIG_VIDEO_AK881X) += ak881x.o obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o obj-$(CONFIG_VIDEO_ML86V7667) += ml86v7667.o +obj-$(CONFIG_VIDEO_TC358743) += tc358743.o diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c new file mode 100644 index 000..a86cbe0 --- /dev/null +++ b/drivers/media/i2c/tc358743.c @@ -0,0 +1,1768 @@ +/* + * tc358743 - Toshiba HDMI to CSI-2 bridge + * + * Copyright 2014 Cisco Systems, Inc. and/or its affiliates. All rights + * reserved. + * + * This program is free software; you may redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +/* + * References (c = chapter, p = page): + * REF_01 - Toshiba, TC358743XBG (H2C), Functional Specification, Rev 0.60 + * REF_02 - Toshiba, TC358743XBG_HDMI-CSI_Tv11p_nm.xls + */ + +#include linux/kernel.h +#include linux/module.h +#include linux/slab.h +#include linux/i2c.h +#include linux/delay.h +#include linux/videodev2.h +#include linux/workqueue.h +#include linux/v4l2-dv-timings.h +#include media/v4l2-dv-timings.h +#include media/v4l2-device.h +#include media/v4l2-ctrls.h +#include media/tc358743.h + +#include tc358743_regs.h + +static int debug; +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, debug level (0-3)); + +MODULE_DESCRIPTION(Toshiba TC358743 HDMI to CSI-2 bridge driver); +MODULE_AUTHOR(Ramakrishnan Muthukrishnan r...@rkrishnan.org); +MODULE_AUTHOR(Mikhail Khelik mkhe...@cisco.com); +MODULE_AUTHOR(Mats Randgaard matra...@cisco.com); +MODULE_LICENSE(GPL); + +static const struct v4l2_dv_timings_cap tc358743_timings_cap = { + .type = V4L2_DV_BT_656_1120, + /* keep this initialization for compatibility with GCC 4.4.6 */ + .reserved = { 0 }, + /* Pixel clock from REF_01 p. 20. Min/max height/width are unknown */ + V4L2_INIT_BT_TIMINGS(1, 1, 1, 1, 0, 16500, + V4L2_DV_BT_STD_CEA861 | V4L2_DV_BT_STD_DMT | + V4L2_DV_BT_STD_GTF | V4L2_DV_BT_STD_CVT, +
[PATCH] v4l2-ctl: Remove file entry from Android.mk
From: Mats Randgaard matra...@cisco.com v4l2-ctl-test-patterns.cpp is removed, but still listed in Android.mk. --- utils/v4l2-ctl/Android.mk |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/utils/v4l2-ctl/Android.mk b/utils/v4l2-ctl/Android.mk index bbd151a..2f0e5b4 100644 --- a/utils/v4l2-ctl/Android.mk +++ b/utils/v4l2-ctl/Android.mk @@ -19,7 +19,6 @@ LOCAL_SRC_FILES := \ v4l2-ctl.cpp v4l2-ctl.h v4l2-ctl-common.cpp v4l2-ctl-tuner.cpp \ v4l2-ctl-io.cpp v4l2-ctl-stds.cpp v4l2-ctl-vidcap.cpp v4l2-ctl-vidout.cpp \ v4l2-ctl-overlay.cpp v4l2-ctl-vbi.cpp v4l2-ctl-selection.cpp v4l2-ctl-misc.cpp \ -v4l2-ctl-streaming.cpp v4l2-ctl-test-patterns.cpp v4l2-ctl-sdr.cpp \ -v4l2-ctl-edid.cpp vivid-tpg-colors.c vivid-tpg.c - +v4l2-ctl-streaming.cpp v4l2-ctl-sdr.cpp v4l2-ctl-edid.cpp vivid-tpg-colors.c \ +vivid-tpg.c include $(BUILD_EXECUTABLE) -- 1.7.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
v4l2_mbus_config flags for CSI-2
Hi, I am writing a driver for Toshiba TC358743 HDMI to CSI-2 bridge. The chip has four CSI lanes. Toshiba recommends to configure the CSI output speed for the highest resolution the CSI interface can handle and reduce the number of CSI lanes in use if the received video has lower resolution. The number of CSI lanes in use is also reduced when the bridge transmits YCbCr 4:2:2 encoded video instead of RGB888. The plan was to use g_mbus_config for this, but it is not clear to me what the different defines in include/media/v4l2-mediabus.h should be used for: /* How many lanes the client can use */ #define V4L2_MBUS_CSI2_1_LANE (1 0) #define V4L2_MBUS_CSI2_2_LANE (1 1) #define V4L2_MBUS_CSI2_3_LANE (1 2) #define V4L2_MBUS_CSI2_4_LANE (1 3) /* On which channels it can send video data */ #define V4L2_MBUS_CSI2_CHANNEL_0(1 4) #define V4L2_MBUS_CSI2_CHANNEL_1(1 5) #define V4L2_MBUS_CSI2_CHANNEL_2(1 6) #define V4L2_MBUS_CSI2_CHANNEL_3(1 7) Should I set V4L2_MBUS_CSI2_4_LANE since the device supports four lanes, and set V4L2_MBUS_CSI2_CHANNEL_X according to the number of lanes in use? Thanks, Mats Randgaard -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: v4l2_mbus_config flags for CSI-2
Thanks for responding so quickly, Sakari! On 12/02/2014 01:45 PM, Sakari Ailus wrote: Hi Mats, On Tue, Dec 02, 2014 at 12:49:07PM +0100, Mats Randgaard (matrandg) wrote: Hi, I am writing a driver for Toshiba TC358743 HDMI to CSI-2 bridge. The chip has four CSI lanes. Toshiba recommends to configure the CSI output speed for the highest resolution the CSI interface can handle and reduce the number of CSI lanes in use if the received video has lower resolution. The number of CSI lanes in use is also reduced when the bridge transmits YCbCr 4:2:2 encoded video instead of RGB888. The plan was to use g_mbus_config for this, but it is not clear to me what the different defines in include/media/v4l2-mediabus.h should be used for: /* How many lanes the client can use */ #define V4L2_MBUS_CSI2_1_LANE (1 0) #define V4L2_MBUS_CSI2_2_LANE (1 1) #define V4L2_MBUS_CSI2_3_LANE (1 2) #define V4L2_MBUS_CSI2_4_LANE (1 3) /* On which channels it can send video data */ #define V4L2_MBUS_CSI2_CHANNEL_0(1 4) #define V4L2_MBUS_CSI2_CHANNEL_1(1 5) #define V4L2_MBUS_CSI2_CHANNEL_2(1 6) #define V4L2_MBUS_CSI2_CHANNEL_3(1 7) Should I set V4L2_MBUS_CSI2_4_LANE since the device supports four lanes, and set V4L2_MBUS_CSI2_CHANNEL_X according to the number of lanes in use? Channels in this case refer to CSI-2 channels, not how many lanes there are. Can you decide how many lanes you use or is that determined by other configuration? This is only used in SoC camera right now. Elsewhere the number of lanes is fixed in either platform data or device tree. When the application set video timings or change color encoding the driver calculates the number of CSI lanes needed and disables the rest: -- static void tc358743_set_csi(struct v4l2_subdev *sd) { unsigned lanes = tc358743_num_csi_lanes_needed(sd); if (lanes 1) i2c_wr32(sd, CLW_CNTRL, MASK_CLW_LANEDISABLE); if (lanes 1) i2c_wr32(sd, D0W_CNTRL, MASK_D0W_LANEDISABLE); if (lanes 2) i2c_wr32(sd, D1W_CNTRL, MASK_D1W_LANEDISABLE); if (lanes 3) i2c_wr32(sd, D2W_CNTRL, MASK_D2W_LANEDISABLE); if (lanes 4) i2c_wr32(sd, D3W_CNTRL, MASK_D3W_LANEDISABLE); -- Regards, Mats Randgaard -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] v4l2-ioctl: The result of VIDIOC_S_EDID should always be returned
From: Mats Randgaard matra...@cisco.com VIDIOC_S_EDID can return error and valid result Documentation/DocBook/media/v4l/vidioc-g-edid.xml: If there are more EDID blocks than the hardware can handle then the EDID is not written, but instead the error code E2BIG is set and blocks is set to the maximum that the hardware supports. --- drivers/media/v4l2-core/v4l2-ioctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index d15e167..f36c018 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -2554,9 +2554,9 @@ video_usercopy(struct file *file, unsigned int cmd, unsigned long arg, err = -EFAULT; goto out_array_args; } - /* VIDIOC_QUERY_DV_TIMINGS can return an error, but still have valid - results that must be returned. */ - if (err 0 cmd != VIDIOC_QUERY_DV_TIMINGS) + /* VIDIOC_QUERY_DV_TIMINGS and VIDIOC_S_EDID can return an error, but + still have valid results that must be returned. */ + if (err 0 cmd != VIDIOC_QUERY_DV_TIMINGS cmd != VIDIOC_S_EDID) goto out; out_array_args: -- 1.8.4.5 -- To unsubscribe from this list: send the line unsubscribe linux-media in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html