Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 08110C27C76 for ; Wed, 25 Jan 2023 05:14:27 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 961BA855B5; Wed, 25 Jan 2023 06:14:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="Tvprvofl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5C32E8563A; Wed, 25 Jan 2023 06:14:24 +0100 (CET) Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B4C0B85316 for ; Wed, 25 Jan 2023 06:14:21 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=n-jain1@ti.com Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 30P5EEha110962; Tue, 24 Jan 2023 23:14:14 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1674623654; bh=4sVSA2Xxp0HWbjihrOICDuToczJBhTcAK610ScfjtZE=; h=Date:Subject:To:CC:References:From:In-Reply-To; b=TvprvoflZgYes6DBg9DjAATfI2TRWPI7AmNIiBQnDRM5pSApmOyWew57yJ+Q86Bfn C1BYtW9viX805H+jn6/uhZf5vqlToSYNbkf73cVgUI+92Gfj4R3qj+Y38wOG3kU8Pn 1BwrxqWIo4Kwfr7546N0pEBCx3kmDwbhAlNIDjmA= Received: from DFLE109.ent.ti.com (dfle109.ent.ti.com [10.64.6.30]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 30P5EEPq024013 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 24 Jan 2023 23:14:14 -0600 Received: from DFLE115.ent.ti.com (10.64.6.36) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Tue, 24 Jan 2023 23:14:14 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16 via Frontend Transport; Tue, 24 Jan 2023 23:14:14 -0600 Received: from [172.24.145.43] (ileaxei01-snat.itg.ti.com [10.180.69.5]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 30P5EBQK017070; Tue, 24 Jan 2023 23:14:12 -0600 Message-ID: Date: Wed, 25 Jan 2023 10:44:11 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH 1/6] drivers: core: ofnode: Add panel timing decode. Content-Language: en-US To: Simon Glass CC: , , , , , References: <20230123080615.9217-1-n-jain1@ti.com> <20230123080615.9217-2-n-jain1@ti.com> From: Nikhl M Jain In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hi Simon, On 24/01/23 00:12, Simon Glass wrote: > Hi Nikhil, > > On Mon, 23 Jan 2023 at 01:07, Nikhil M Jain wrote: >> >> ofnode_decode_display_timing supports reading timing parameters from >> subnode of display-timings node, for displays supporting multiple >> resolution, in case if a display supports single resolution, it fails >> reading directly from display-timings node, to support it >> ofnode_decode_panel_timing is added. >> >> Signed-off-by: Nikhil M Jain >> --- >> drivers/core/ofnode.c | 53 +++++++++++++++++++++++++++++++++++++++++++ >> include/dm/ofnode.h | 12 ++++++++++ >> 2 files changed, 65 insertions(+) >> >> diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c >> index 4d56b1a767..d06b947516 100644 >> --- a/drivers/core/ofnode.c >> +++ b/drivers/core/ofnode.c >> @@ -991,6 +991,59 @@ int ofnode_decode_display_timing(ofnode parent, int index, >> return ret; >> } >> >> +int ofnode_decode_panel_timing(ofnode parent, >> + struct display_timing *dt) >> +{ >> + ofnode timings; >> + u32 val = 0; >> + int ret = 0; >> + >> + timings = ofnode_find_subnode(parent, "panel-timings"); >> + >> + if (!ofnode_valid(timings)) >> + return -EINVAL; >> + memset(dt, 0, sizeof(*dt)); >> + ret |= decode_timing_property(timings, "hback-porch", &dt->hback_porch); >> + ret |= decode_timing_property(timings, "hfront-porch", &dt->hfront_porch); >> + ret |= decode_timing_property(timings, "hactive", &dt->hactive); >> + ret |= decode_timing_property(timings, "hsync-len", &dt->hsync_len); >> + ret |= decode_timing_property(timings, "vback-porch", &dt->vback_porch); >> + ret |= decode_timing_property(timings, "vfront-porch", &dt->vfront_porch); >> + ret |= decode_timing_property(timings, "vactive", &dt->vactive); >> + ret |= decode_timing_property(timings, "vsync-len", &dt->vsync_len); >> + ret |= decode_timing_property(timings, "clock-frequency", &dt->pixelclock); >> + dt->flags = 0; >> + val = ofnode_read_u32_default(timings, "vsync-active", -1); >> + if (val != -1) { > > if (!ofnode_read_u32(timings, "vsync-active", &val)) { > > Please fix below also > >> + dt->flags |= val ? DISPLAY_FLAGS_VSYNC_HIGH : >> + DISPLAY_FLAGS_VSYNC_LOW; >> + } >> + val = ofnode_read_u32_default(timings, "hsync-active", -1); >> + if (val != -1) { >> + dt->flags |= val ? DISPLAY_FLAGS_HSYNC_HIGH : >> + DISPLAY_FLAGS_HSYNC_LOW; >> + } >> + val = ofnode_read_u32_default(timings, "de-active", -1); >> + if (val != -1) { >> + dt->flags |= val ? DISPLAY_FLAGS_DE_HIGH : >> + DISPLAY_FLAGS_DE_LOW; >> + } >> + val = ofnode_read_u32_default(timings, "pixelclk-active", -1); >> + if (val != -1) { >> + dt->flags |= val ? DISPLAY_FLAGS_PIXDATA_POSEDGE : >> + DISPLAY_FLAGS_PIXDATA_NEGEDGE; >> + } >> + >> + if (ofnode_read_bool(timings, "interlaced")) >> + dt->flags |= DISPLAY_FLAGS_INTERLACED; >> + if (ofnode_read_bool(timings, "doublescan")) >> + dt->flags |= DISPLAY_FLAGS_DOUBLESCAN; >> + if (ofnode_read_bool(timings, "doubleclk")) >> + dt->flags |= DISPLAY_FLAGS_DOUBLECLK; >> + >> + return ret; >> +} >> + >> const void *ofnode_get_property(ofnode node, const char *propname, int *lenp) >> { >> if (ofnode_is_np(node)) >> diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h >> index fa9865602d..3f6b0843c5 100644 >> --- a/include/dm/ofnode.h >> +++ b/include/dm/ofnode.h >> @@ -974,6 +974,18 @@ struct display_timing; >> int ofnode_decode_display_timing(ofnode node, int index, >> struct display_timing *config); >> >> +/** >> + * ofnode_decode_panel_timing() - decode display timings >> + * >> + * Decode panel timings from the supplied 'panel-timings' node. >> + * >> + * @node: 'display-timing' node containing the timing subnodes >> + * @config: Place to put timings >> + * Return: 0 if OK, -FDT_ERR_NOTFOUND if not found >> + */ >> +int ofnode_decode_panel_timing(ofnode node, >> + struct display_timing *config); >> + >> /** >> * ofnode_get_property() - get a pointer to the value of a node property >> * >> -- >> 2.17.1 >> > > Please add a test to test/dm/ofnode.c > Wanted to confirm whether I need to add a test for ofnode_get_property or for the ofnode_decode_panel_timings. > Regards, > Simon Thanks