From patchwork Wed Feb 17 15:48:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 8340481 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-renesas-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6AE5B9F372 for ; Wed, 17 Feb 2016 15:49:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B50E3203B1 for ; Wed, 17 Feb 2016 15:49:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BC0D2203A0 for ; Wed, 17 Feb 2016 15:49:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161582AbcBQPtG (ORCPT ); Wed, 17 Feb 2016 10:49:06 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:33944 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161552AbcBQPtE (ORCPT ); Wed, 17 Feb 2016 10:49:04 -0500 Received: by mail-wm0-f42.google.com with SMTP id b205so161680462wmb.1; Wed, 17 Feb 2016 07:49:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=c7zetknHwhNJthiF2I9GxH3+QHEF74Dg4hh+LxaUfvY=; b=cfvoKs4AxC4LeFmkKe5lDalro1Yu/GWQcQTjoJtwqafKeytbIasSFWus/z+iHiBjn9 GTzcUsWsF0CyUdk21PCLA36T7TliNUIbkQDFXsfZFRh5Ze32DnNxkNmEl6zYHsTdFvpv C+UfBYRTTwcuXBG5rQ95Ih2QgrU4GRJLQjao1lmCfwsQINww9IcQcmZbougNbrPYHJ0e 6kAaz+l6vaRS+8fhzHXiQyoZ6ZKz5i5U5tLYgUs0kfskqnln7HRXtnCg3yaoNSJ2l4+H p3asOnopVJWVyW8uqJLA5Mo5xgYh7biFx3WvB+jira0wPQG79pJlh7UKcZLbKCy5vFPs 0WGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=c7zetknHwhNJthiF2I9GxH3+QHEF74Dg4hh+LxaUfvY=; b=RJ8Ofzh7L4Ke2ODo2bSHbjQPKh+C8E9XF50VAIEkKEJEIMiETCFBRiHdoDVRSTALPt S0RhORHKLcdyiIkE262FIkFCn1aX21OHyLgVMvgBTodhi5tP3/p6p9Qf3eDBJ7EAQbO2 e6huenHLuNb4IWLDGocYl7r5gTXiLHv9Gm+W1XM7hHQocuTIAjbAoF72TQWqD2jp3JUL GnUy+7MnWx9DKSdCwmu6+bp9L10aONoKVnivoaJnZnFxHYHTaVqP5p5kdlmdUZtcZq7b BplpTqXF7kw3Hx+jrSPxaUBEJ5tXVtiqO8q8hZ14RmL0LTyjGcWtOnPtEVeLEF0M9iYR L82A== X-Gm-Message-State: AG10YOQDtjpJclhPnZ0H0QxPL+z1IstpH3pK2qC6lRH2uL2mfOxNXSSgeX1xKvPXDiHIbQ== X-Received: by 10.194.103.164 with SMTP id fx4mr2717856wjb.56.1455724142413; Wed, 17 Feb 2016 07:49:02 -0800 (PST) Received: from groucho.site (ip9234e209.dynamic.kabel-deutschland.de. [146.52.226.9]) by smtp.gmail.com with ESMTPSA id u4sm2136725wjz.4.2016.02.17.07.49.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Feb 2016 07:49:01 -0800 (PST) From: Ulrich Hecht To: linux-renesas-soc@vger.kernel.org, niklas.soderlund@ragnatech.se Cc: linux-media@vger.kernel.org, magnus.damm@gmail.com, laurent.pinchart@ideasonboard.com, hans.verkuil@cisco.com, ian.molton@codethink.co.uk, lars@metafoo.de, william.towle@codethink.co.uk, Ulrich Hecht Subject: [PATCH/RFC 2/9] media: adv7604: automatic "default-input" selection Date: Wed, 17 Feb 2016 16:48:38 +0100 Message-Id: <1455724125-13004-3-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1455724125-13004-1-git-send-email-ulrich.hecht+renesas@gmail.com> References: <1455724125-13004-1-git-send-email-ulrich.hecht+renesas@gmail.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: William Towle Add logic such that the "default-input" property becomes unnecessary for chips that only have one suitable input (ADV7611 by design, and ADV7612 due to commit 7111cddd "[media] media: adv7604: reduce support to first (digital) input"). Additionally, Ian's documentation in commit bf9c8227 ("[media] media: adv7604: ability to read default input port from DT") states that the "default-input" property should reside directly in the node for adv7612. Hence, also adjust the parsing to make the implementation consistent with this. Signed-off-by: William Towle Signed-off-by: Ulrich Hecht --- drivers/media/i2c/adv7604.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index f8dd750..2097c48 100644 --- a/drivers/media/i2c/adv7604.c +++ b/drivers/media/i2c/adv7604.c @@ -2799,7 +2799,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state) struct device_node *endpoint; struct device_node *np; unsigned int flags; - u32 v; + u32 v = -1; np = state->i2c_clients[ADV76XX_PAGE_IO]->dev.of_node; @@ -2809,14 +2809,24 @@ static int adv76xx_parse_dt(struct adv76xx_state *state) return -EINVAL; v4l2_of_parse_endpoint(endpoint, &bus_cfg); - - if (!of_property_read_u32(endpoint, "default-input", &v)) - state->pdata.default_input = v; - else - state->pdata.default_input = -1; - of_node_put(endpoint); + if (of_property_read_u32(np, "default-input", &v)) { + /* not specified ... can we choose automatically? */ + switch (state->info->type) { + case ADV7611: + v = 0; + break; + case ADV7612: + if (state->info->max_port == ADV76XX_PAD_HDMI_PORT_A) + v = 0; + /* else is unhobbled, leave unspecified */ + default: + break; + } + } + state->pdata.default_input = v; + flags = bus_cfg.bus.parallel.flags; if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)