Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5177277rwl; Tue, 11 Apr 2023 01:19:13 -0700 (PDT) X-Google-Smtp-Source: AKy350b84yHTcwP8GHnhmvGZQI1fktJ3Ma7h/hYZv7hwEIxH1Ov/JbE0SBdkpZQpr8CDkPzTkoWQ X-Received: by 2002:a17:90b:4c0d:b0:246:6d32:b04a with SMTP id na13-20020a17090b4c0d00b002466d32b04amr14941571pjb.26.1681201152826; Tue, 11 Apr 2023 01:19:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681201152; cv=none; d=google.com; s=arc-20160816; b=fgjuQ26WI/F5nc0CFYYyXTNjGbcl6YtQ/yfflQ8E4YppWbrFwGX0k9TSJgrAao0QhZ s3GsqK1BF4xz7khGtvNNyqv05F9B7+pt2NcIPehvi3DbpN8zh/ReuvaywlhUWzZB7Hnh 4aXAK0w1iuc8+3zIhdf0+6FQT56ARxXezOB8XAy42uSFGASiYpTVzuUiY3Jvb8J1aHSF DA3G2LZyx0IBqtER+DGP5jtqSBmkY7lWCmUcSCak+3Zt+V6NNd0Rj78za8/1xRsOJMjS g5NHNswWlFZ9m7Xywkk+MwtkJHd6uXV6PAlc6SUcmFbiMkGrLXJXnkr/lB07isvPc6Qn 4/9w== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:sender:hmm_source_type:hmm_attache_num :hmm_source_ip; bh=EDu+dC7kyCBhJaFMUMZ+EferFA8TvGtR/bkv/p6taQw=; b=VqS5r4UVo8UxDI1RFdvIT/BLWFx0Ge9mERRCwVveuc4pGi+9KQX0+S6Z+gb0fyAUpa dLlYQNZKJMR+o+3iPDH2Y6g5uwAG+A81VsM2J0oABV0MXGfuFa8y4BdGq5QV1+KIpnXN Liv0OY/4VIPI+q9CbgI8eMLNLn5jjQuFO8nK+t27J4UG7xU9koncD0izlEsKO2laC+9r gAQOTt6O2mhFzjU56YVP2lU1GCSICyYdP4EpRM8yRa/nlZ3c8918AvDVAFKl0D48hNBw WhaQXaJgKlIUHB/gVLT80uXoU+mbojI25Uc7pptsvjVMldiAOpE8Q982f225DAD4DjLx 9/zQ== ARC-Authentication-Results: i=1; mx.google.com; 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 q17-20020a17090aa01100b0024696759991si5824116pjp.47.2023.04.11.01.19.00; Tue, 11 Apr 2023 01:19:12 -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; 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 S229916AbjDKISl (ORCPT + 99 others); Tue, 11 Apr 2023 04:18:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229773AbjDKISj (ORCPT ); Tue, 11 Apr 2023 04:18:39 -0400 Received: from 189.cn (ptr.189.cn [183.61.185.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B1EADE58; Tue, 11 Apr 2023 01:18:37 -0700 (PDT) HMM_SOURCE_IP: 10.64.8.41:42666.1367120225 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-114.242.206.180 (unknown [10.64.8.41]) by 189.cn (HERMES) with SMTP id DCF741002F3; Tue, 11 Apr 2023 16:18:34 +0800 (CST) Received: from ([114.242.206.180]) by gateway-151646-dep-7b48884fd-bkw2h with ESMTP id 586403049fb9408e95ab8dae31b91955 for emil.l.velikov@gmail.com; Tue, 11 Apr 2023 16:18:36 CST X-Transaction-ID: 586403049fb9408e95ab8dae31b91955 X-Real-From: 15330273260@189.cn X-Receive-IP: 114.242.206.180 X-MEDUSA-Status: 0 Sender: 15330273260@189.cn Message-ID: <8c115006-3c06-c063-1381-d82d744871b4@189.cn> Date: Tue, 11 Apr 2023 16:18:34 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH v10 2/2] drm: add kms driver for loongson display controller Content-Language: en-US To: Emil Velikov Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sumit Semwal , Christian Koenig , linaro-mm-sig@lists.linaro.org, Li Yi , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, nathan@kernel.org, linux-media@vger.kernel.org, loongson-kernel@lists.loongnix.cn References: <20230403171304.2157326-1-suijingfeng@loongson.cn> <20230403171304.2157326-3-suijingfeng@loongson.cn> From: Sui Jingfeng <15330273260@189.cn> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.6 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,FROM_LOCAL_DIGITS,FROM_LOCAL_HEX,NICE_REPLY_A, SPF_HELO_PASS,SPF_PASS autolearn=unavailable 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 Hi, On 2023/4/4 22:10, Emil Velikov wrote: >> + val = lsdc_crtc_rreg32(ldev, LSDC_CRTC0_CFG_REG, index); >> + /* clear old dma step settings */ >> + val &= ~CFG_DMA_STEP_MASK; >> + >> + if (descp->chip == CHIP_LS7A2000) { >> + /* >> + * Using large dma step as much as possible, >> + * for improve hardware DMA efficiency. >> + */ >> + if (width_in_bytes % 256 == 0) >> + val |= LSDC_DMA_STEP_256_BYTES; >> + else if (width_in_bytes % 128 == 0) >> + val |= LSDC_DMA_STEP_128_BYTES; >> + else if (width_in_bytes % 64 == 0) >> + val |= LSDC_DMA_STEP_64_BYTES; >> + else /* width_in_bytes % 32 == 0 */ >> + val |= LSDC_DMA_STEP_32_BYTES; >> + } >> + >> + clk_func->update(pixpll, &priv_state->pparms); >> + > Without knowing the hardware, the clk_func abstraction seems quite > arbitrary and unnecessary. It should be introduced when there is a > use-case for it. > > The clk_func is necessary,  clk_func->update() will eventually call ls7a1000_pixpll_param_update() to generate pixel clock frequency required by the display device.  There is a abstract because different bridges chip/SoC variants has the different register to operate, either because the register offset changed or the arrangement  of specific bits field changed. For the point view of the hardware, the PLL hardware belong to the bridge chip. There is a clock tree which wrangler all of the PLL hardware, sub-device may partially share the hardware PLL. The abstraction is used to suppress hardware variants which may change over time. For ls7a1000, there is user manual document about the clock tree and PLL, see[1][2][3] [1] https://loongson.github.io/LoongArch-Documentation/Loongson-7A1000-usermanual-EN#description-of-clock-function [2] https://loongson.github.io/LoongArch-Documentation/Loongson-7A1000-usermanual-EN#section-pll-pix-0-configuration-register [3] https://loongson.github.io/LoongArch-Documentation/Loongson-7A1000-usermanual-EN#configuration-method-of-pll