Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp288020imn; Thu, 28 Jul 2022 00:04:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u4EVMoO5V4QeeMbA85cX4sY/emnDRaRma4xM506/LUuMOVMwFwx+N1HpUPabvZs1veXE3T X-Received: by 2002:a63:8142:0:b0:419:a843:1720 with SMTP id t63-20020a638142000000b00419a8431720mr22092526pgd.317.1658991855982; Thu, 28 Jul 2022 00:04:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658991855; cv=none; d=google.com; s=arc-20160816; b=ybUcRbxvScA+j1rzC1nWc9MMtGTVSuasTtCRjJDubq/UNJYKBxvmkFScuQIiFSwyJe XJbvHLDhiVunFtxbzzJsVh+vKwJgvq+2V9c8ZGAPLJZlCZ40D4/WgMHhnLZ9qeVmh1UW bgBMy0s7WBav8wWAviFMu/gOcYX0xej2/KpDihghoGRDgl2vPOPps1vFuzs+7788yojF Pjlgkng1XmPXfXhaYSpIVddhDS6H12RfzTjPL7/szfsJRKJ1NRcEf244xOfSBReHW7Fw SWOwqBNmdPQxx/fbPHAnui1txzqMC0i9Sp6hZ5Ouyk5/lYLZDO5yibJA4VpDeESSRJY0 JB9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=I+YzraHFg89g/ZroYlVZh5L1Xo88YOcb9Tj9sbJs0Ts=; b=DZizf3roHb8qLvBNnlDD9harxe63be4C2aYz6F+Kc28+fJf5+0l3IVCyNUxZZAuMkN 2vh3+4IQw5RsgsByO4iiJUUVIbTFUQuzcA2AzCQ13J8mODJM/dTqL3cJf8LYK0NHyhXL THNhwlyUtNDXXhHDKNmhcDVeLOVDRgX3Q4sJ9o18Z5k7zqRHe5cYlTm++qxXecGt7dFd R0pmWUJRlSykCooVtBmQV/z/Mx6rdhNTSLdc8m734G3MiV319u8KSpe1eqeAC3mUL/Oq tOklYyzP7Scc9ujnmZ1oJIyUYOt+pMpAm+AxKZ9c1IByhTq9UQ5JUrRgkxZOKXHpAH62 18tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=CdCPksdC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k2-20020a170902d58200b0016dc27fb9fbsi266194plh.117.2022.07.28.00.03.59; Thu, 28 Jul 2022 00:04:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=CdCPksdC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234033AbiG1GqX (ORCPT + 99 others); Thu, 28 Jul 2022 02:46:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230043AbiG1GqW (ORCPT ); Thu, 28 Jul 2022 02:46:22 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FDD852DFE; Wed, 27 Jul 2022 23:46:21 -0700 (PDT) Received: from [192.168.1.111] (91-158-154-79.elisa-laajakaista.fi [91.158.154.79]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id B61216D4; Thu, 28 Jul 2022 08:46:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1658990779; bh=6tsI1MnO9HDLFqseRpRktO0za1aD8wvp2v09jWiF6II=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=CdCPksdCuSNA6VkWAPH5XiG8rFu3KgdIRDZ3OTkUwIYrSYYGNWvJuiunamWRepYq/ zgbUk66YZlPXqJLmIWRIh3VE+xaYa9M5J7wcQ1xn2pKSEcuoBA2vNoH9IunaUupGVI poLka3YxsyCfjcvjgnnLZjOdgg3q1g2faFbOdhoI= Message-ID: Date: Thu, 28 Jul 2022 09:46:16 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 8/8] drm/tidss: Enable Dual and Duplicate Modes for OLDI Content-Language: en-US From: Tomi Valkeinen To: Aradhya Bhatia Cc: Darren Etheridge , Nishanth Menon , Vignesh Raghavendra , Rahul T R , Krunal Bhargav , Devarsh Thakkar , DRI Development List , Devicetree List , Linux Kernel List , Rob Herring , Daniel Vetter , David Airlie , Krzysztof Kozlowski , Jyri Sarha References: <20220719080845.22122-1-a-bhatia1@ti.com> <20220719080845.22122-9-a-bhatia1@ti.com> <83df99ee-1304-121f-97e6-85ca416aef1f@ideasonboard.com> In-Reply-To: <83df99ee-1304-121f-97e6-85ca416aef1f@ideasonboard.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 27/07/2022 16:22, Tomi Valkeinen wrote: > Hi, > > On 19/07/2022 11:08, Aradhya Bhatia wrote: >> The AM625 DSS peripheral supports 2 OLDI TXes which can work to enable 2 >> duplicated displays of smaller resolutions or enable a single Dual-Link >> display with a higher resolution (1920x1200). >> >> Configure the necessary register to enable the different modes. >> >> Signed-off-by: Aradhya Bhatia >> --- >>   drivers/gpu/drm/tidss/tidss_dispc.c | 44 +++++++++++++++++++++++++++-- >>   1 file changed, 41 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/gpu/drm/tidss/tidss_dispc.c >> b/drivers/gpu/drm/tidss/tidss_dispc.c >> index 0b9689453ee8..28cb61259471 100644 >> --- a/drivers/gpu/drm/tidss/tidss_dispc.c >> +++ b/drivers/gpu/drm/tidss/tidss_dispc.c >> @@ -1021,8 +1021,8 @@ static void dispc_enable_oldi(struct >> dispc_device *dispc, u32 hw_videoport, >>       int count = 0; >>       /* >> -     * For the moment DUALMODESYNC, MASTERSLAVE, MODE, and SRC >> -     * bits of DISPC_VP_DSS_OLDI_CFG are set statically to 0. >> +     * For the moment MASTERSLAVE, and SRC bits of >> DISPC_VP_DSS_OLDI_CFG are >> +     * set statically to 0. >>        */ >>       if (fmt->data_width == 24) >> @@ -1039,7 +1039,45 @@ static void dispc_enable_oldi(struct >> dispc_device *dispc, u32 hw_videoport, >>       oldi_cfg |= BIT(0); /* ENABLE */ >> -    dispc_vp_write(dispc, hw_videoport, DISPC_VP_DSS_OLDI_CFG, >> oldi_cfg); >> +    /* >> +     * As per all the current implementations of DSS, the OLDI TXes >> are present only on >> +     * hw_videoport = 0 (OLDI TX 0). However, the config register for >> 2nd OLDI TX (OLDI TX 1) >> +     * is present in the address space of hw_videoport = 1. Hence, >> using "hw_videoport + 1" to >> +     * configure OLDI TX 1. >> +     */ >> + >> +    switch (dispc->oldi_mode) { >> +    case OLDI_MODE_OFF: >> +        oldi_cfg &= ~BIT(0); /* DISABLE */ >> +        dispc_vp_write(dispc, hw_videoport, DISPC_VP_DSS_OLDI_CFG, >> oldi_cfg); >> +        dispc_vp_write(dispc, hw_videoport + 1, >> DISPC_VP_DSS_OLDI_CFG, oldi_cfg); >> +        break; >> + >> +    case OLDI_SINGLE_LINK_SINGLE_MODE_0: >> +        dispc_vp_write(dispc, hw_videoport, DISPC_VP_DSS_OLDI_CFG, >> oldi_cfg); >> +        break; >> + >> +    case OLDI_SINGLE_LINK_SINGLE_MODE_1: >> +        dispc_vp_write(dispc, hw_videoport + 1, >> DISPC_VP_DSS_OLDI_CFG, oldi_cfg); >> +        break; >> + >> +    case OLDI_SINGLE_LINK_DUPLICATE_MODE: >> +        oldi_cfg |= BIT(5); /* DUPLICATE MODE */ >> +        dispc_vp_write(dispc, hw_videoport, DISPC_VP_DSS_OLDI_CFG, >> oldi_cfg); >> +        dispc_vp_write(dispc, hw_videoport + 1, >> DISPC_VP_DSS_OLDI_CFG, oldi_cfg); >> +        break; >> + >> +    case OLDI_DUAL_LINK: >> +        oldi_cfg |= BIT(11); /* DUALMODESYNC */ >> +        dispc_vp_write(dispc, hw_videoport, DISPC_VP_DSS_OLDI_CFG, >> oldi_cfg); >> +        dispc_vp_write(dispc, hw_videoport + 1, >> DISPC_VP_DSS_OLDI_CFG, oldi_cfg); >> +        break; >> + >> +    default: >> +        dev_warn(dispc->dev, "%s: Incorrect oldi mode. Returning.\n", >> +             __func__); >> +        return; >> +    } >>       while (!(oldi_reset_bit & dispc_read(dispc, DSS_SYSSTATUS)) && >>              count < 10000) > > This feels a bit hacky: > > - The function is dispc_enable_oldi, but the above code also disables > oldi. We have code in dispc_vp_unprepare() which disables OLDI at the > moment. > > - The function takes hw_videoport as a parameter, and is designed to > work on that videoport. The above operates on two videoports. Isn't the > function also called for hw_videoport +1, which would result in reg > writes to hw_videoport + 2? > > - No matching code in dispc_vp_unprepare > > Obviously the duplicate mode (I presume that's "cloning") and the dual > link complicate things here, and I have to say I haven't worked with > such setups. But I think somehow this should be restructured so that > common configuration (common to the OLDIs) is done somewhere else. > > I would guess that there are other drivers that support cloning and dual > mode. Did you have a look how they handle things? Oh, I see now... There's just one dss video port for OLDI, the same as in am65x, but that single video port is now connected to two OLDI TXes. And thus this function will only be called for the single video port. But... The registers for the second OLDI are part of the second video port (DPI) register block? Tomi