Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754569AbbBFOiN (ORCPT ); Fri, 6 Feb 2015 09:38:13 -0500 Received: from mail-we0-f169.google.com ([74.125.82.169]:57463 "EHLO mail-we0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752509AbbBFOiM (ORCPT ); Fri, 6 Feb 2015 09:38:12 -0500 From: Jean-Michel Hautbois To: linux-media@vger.kernel.org, hans.verkuil@cisco.com Cc: m.chehab@samsung.com, linux-kernel@vger.kernel.org, Jean-Michel Hautbois Subject: [PATCH] media: i2c: ADV7604: In free run mode, signal is locked Date: Fri, 6 Feb 2015 15:37:58 +0100 Message-Id: <1423233478-20774-1-git-send-email-jean-michel.hautbois@vodalys.com> X-Mailer: git-send-email 2.2.2 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1992 Lines: 53 The CP_NON_STD_VIDEO bit indicates an input not aligned with DV timings. If there is no input, and chip is in free run mode, consider we are locked. Signed-off-by: Jean-Michel Hautbois --- drivers/media/i2c/adv7604.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index e43dd2e..24fb342 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -1329,13 +1329,21 @@ static inline bool no_lock_cp(struct v4l2_subdev *sd) return io_read(sd, 0x12) & 0x01; } +static inline bool in_free_run(struct v4l2_subdev *sd) +{ + return cp_read(sd, 0xff) & 0x10; +} + static int adv7604_g_input_status(struct v4l2_subdev *sd, u32 *status) { *status = 0; *status |= no_power(sd) ? V4L2_IN_ST_NO_POWER : 0; *status |= no_signal(sd) ? V4L2_IN_ST_NO_SIGNAL : 0; - if (no_lock_cp(sd)) - *status |= is_digital_input(sd) ? V4L2_IN_ST_NO_SYNC : V4L2_IN_ST_NO_H_LOCK; + if (!in_free_run(sd)) + if (no_lock_cp(sd)) + *status |= is_digital_input(sd) + ? V4L2_IN_ST_NO_SYNC + : V4L2_IN_ST_NO_H_LOCK; v4l2_dbg(1, debug, sd, "%s: status = 0x%x\n", __func__, *status); @@ -2276,7 +2284,7 @@ static int adv7604_log_status(struct v4l2_subdev *sd) v4l2_info(sd, "STDI locked: %s\n", no_lock_stdi(sd) ? "false" : "true"); v4l2_info(sd, "CP locked: %s\n", no_lock_cp(sd) ? "false" : "true"); v4l2_info(sd, "CP free run: %s\n", - (!!(cp_read(sd, 0xff) & 0x10) ? "on" : "off")); + (in_free_run(sd)) ? "on" : "off"); v4l2_info(sd, "Prim-mode = 0x%x, video std = 0x%x, v_freq = 0x%x\n", io_read(sd, 0x01) & 0x0f, io_read(sd, 0x00) & 0x3f, (io_read(sd, 0x01) & 0x70) >> 4); -- 2.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/