From patchwork Mon Oct 19 14:07:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 7437361 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@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 354AF9F302 for ; Mon, 19 Oct 2015 14:08:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 448AF2067D for ; Mon, 19 Oct 2015 14:08:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E16E120684 for ; Mon, 19 Oct 2015 14:08:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753047AbbJSOIF (ORCPT ); Mon, 19 Oct 2015 10:08:05 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:34846 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751424AbbJSOIE (ORCPT ); Mon, 19 Oct 2015 10:08:04 -0400 Received: by wicll6 with SMTP id ll6so7562339wic.0 for ; Mon, 19 Oct 2015 07:08:03 -0700 (PDT) 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=hHmBvgeiQ4R86EvgMyzj32flsTqX87pReWnw0mlFkCk=; b=QnHdzGw/TxF58651d1tDHtXfp520wDaNG9q0Hd7UWU49gOGuJ64OtJdUVAJZzLqPzJ +6fOG/VjISTm4s0/AhWDEMiXChY9OIlivGrouaIFFZmkbBENvAyrc3V6F1/wFm0Z7P5E fWTJrFTgbLMz2yOCIIA+D9sgYX6cVyLioQAlinO3FzPd51NcivpiYU4ciI+BrJKGY2eU aQU52uaa5qP0XNAIcXA8pJG1zgMF4EeWijOxVZPpT9ebcz5Raq34QyGTgWyVlz5rA6t2 TuOSc6J9sIGpJacA4p24/rceGE1/sCNjh/dQcD/tqSvsg1D+0d1NURUWSWn9PKL+ho6u cZwA== X-Received: by 10.180.81.199 with SMTP id c7mr20529959wiy.87.1445263682819; Mon, 19 Oct 2015 07:08:02 -0700 (PDT) Received: from groucho.site (ipbcc0ddf2.dynamic.kabel-deutschland.de. [188.192.221.242]) by smtp.gmail.com with ESMTPSA id q8sm3241169wiz.23.2015.10.19.07.08.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Oct 2015 07:08:02 -0700 (PDT) From: Ulrich Hecht To: linux-sh@vger.kernel.org Cc: magnus.damm@gmail.com, laurent.pinchart@ideasonboard.com, william.towle@codethink.co.uk, rob.taylor@codethink.co.uk, hans.verkuil@cisco.com, ian.molton@codethink.co.uk, Ulrich Hecht Subject: [PATCH/RFT 6/7] media: adv7604: automatic "default-input" selection Date: Mon, 19 Oct 2015 16:07:39 +0200 Message-Id: <1445263660-6945-7-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1445263660-6945-1-git-send-email-ulrich.hecht+renesas@gmail.com> References: <1445263660-6945-1-git-send-email-ulrich.hecht+renesas@gmail.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@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 | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c index 5631ec0..5bd81bd 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,25 @@ 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)