Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6172902rwr; Mon, 1 May 2023 18:11:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7htEk8fn3cRZ7qh1KBft6J8mTjg69lEnhj5izzutbpFQVAoXjQLxdwGfWBjBhC8yzi3bdT X-Received: by 2002:a05:6a20:e185:b0:f2:895c:ccc9 with SMTP id ks5-20020a056a20e18500b000f2895cccc9mr16943120pzb.45.1682989898361; Mon, 01 May 2023 18:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682989898; cv=none; d=google.com; s=arc-20160816; b=ImKYZ3I1TNFCpq+YPCwKAIr1Wky5TdXmegWJzk7U+EJnYWb64ilHbOGsAgM22vhkwE 2B21upIxT41FeFc5vFrZSaebWgt0rCTIDdWGq5CtMiPSHEjjWeL2l23kiW970id9o9KM gAUTamqEwbe3iHme4qPFH4g/van2iQ6NJBJf5vAYXtP+S46HNfXQ1Ml2AxM/5idxsZeY epyvNm4Lwu9uqMqQVqmCwjQZniKes9zY4FR3pRh4hne+FGOS4kVABZnd+OyqsyI5PtnM JAOnFCerpmkHP2HxKZcB6bz2MQNQFkWxXC/RlrIjexZcOcOQR+SWcjUsGa4nrZZAYCHF 18gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HhrMWjFte7goMFkthyl+3kO5kW7x7TcIvC2UAKwMf6E=; b=f/E9cQ3CjHQ5AshmLs0kpxuSGap7RbxS1vT7GhdvxZ6U4vVvCQTl2W9gpcO1mjp82F SGOfm7wWzSPgY4C74vORbErFjY+1uglvcg5QKnaiwf6aUIFQR6iUMuY/gfMZP43FuMor W196E9uOYaedvOw7aqiMx1fC8Yis1Va6BAhKGs8QATu0C46okI0dhsKcuB7hGZvlwjsr Yl3Da0xakLXpOBHA130rBv4vaeiPFI5MpJt4hgANg8cMF7uglRkCjOauSMx260jrHAGE Ye0is2tN20psFMlMxCRrD54hxcumGXS2X0xNQYOvl5N4U5IgLWdF8HFxwNYqCpgXovzu ZlJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ID1JuvXX; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c123-20020a633581000000b00513576ea7casi28504125pga.795.2023.05.01.18.11.26; Mon, 01 May 2023 18:11:38 -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 header.i=@gmail.com header.s=20221208 header.b=ID1JuvXX; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233345AbjEBBIV (ORCPT + 99 others); Mon, 1 May 2023 21:08:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233245AbjEBBIO (ORCPT ); Mon, 1 May 2023 21:08:14 -0400 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EF5F35A8 for ; Mon, 1 May 2023 18:08:13 -0700 (PDT) Received: by mail-io1-xd36.google.com with SMTP id ca18e2360f4ac-76937f5f9c5so44393739f.1 for ; Mon, 01 May 2023 18:08:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682989693; x=1685581693; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HhrMWjFte7goMFkthyl+3kO5kW7x7TcIvC2UAKwMf6E=; b=ID1JuvXXaLMCf95WTEkk2TJJKto2G0IwIyP5dukwdxsKvv6+k9wvTf0ZW/8rB6Iq9G Zr9cdfS0Zm+DAwfcYuSXj3csRRYTcq+dqgwfOOiWevPX6vSU8C8yq8DhL6Mn2SwZ5k5m 6Gx+4MXd56NJr9DFfDZ3Wm0SsfSgXsUDx1sNzDzfAcWZ/0G9P7CtwcwnBPAG2kUe/fV+ Q+t++OufgZxqNj1XmNls0xVCt/cYMiFq9CPQQv6tKwAnU1EdD4xWF+TPj+sSLixJZmH6 cYS+sGVy/YHVhOYzIx2a1YkrWkqPdWwquZmf0cUr4AGdwbap/KgrtTcXTnJ947vaX1Jy UZ3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682989693; x=1685581693; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HhrMWjFte7goMFkthyl+3kO5kW7x7TcIvC2UAKwMf6E=; b=YLEl3Wed4gEkPD6RjVu7EalPvagC8oaatcANFLL0aXi9TAaqpwwQeMZQSImlTv1AGq rCbWesWiKc4cP6kj9TDLN7el/XLvz0jK1C67XTBFKNqQc2CtMdDBmeGBzeOVSQVz25z5 3jREaWf5NiiEQ5C5pcyR00oRST4OBopDiqoD+j7c9rE3pDzUHIFRa1OMdW/kKZuLrdD2 urLKDWZcw4Poq8CGNU3Zc7RGg+pfYWwuToMWPuTaP4XsUgHHJi5Qp1n+MQ4BSN/2Dk8C NFwTvV4Ow78CU2rDslpOuQk9Ni58pBvPt48hAgA3/VFvqNhV7a1Y8hPoSx4SSd/i0Vqw xgEQ== X-Gm-Message-State: AC+VfDytJ1QpWbhDP6LzWDuz0/Uv6Ua/adnD+SUrgFxZE7mN539riy7N EPSrmGf0XhQ/iZju/0fKwYQ= X-Received: by 2002:a6b:f007:0:b0:766:41fa:e26c with SMTP id w7-20020a6bf007000000b0076641fae26cmr11441794ioc.10.1682989692703; Mon, 01 May 2023 18:08:12 -0700 (PDT) Received: from aford-B741.lan ([2601:447:d001:897f:8257:a536:d7fc:1919]) by smtp.gmail.com with ESMTPSA id f16-20020a056638329000b0040fb5d5429fsm4836329jav.131.2023.05.01.18.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 18:08:12 -0700 (PDT) From: Adam Ford To: dri-devel@lists.freedesktop.org Cc: marex@denx.de, aford@beaconembedded.com, Adam Ford , Chen-Yu Tsai , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Inki Dae , Jagan Teki , Marek Szyprowski , linux-kernel@vger.kernel.org Subject: [PATCH V3 3/7] drm: bridge: samsung-dsim: Fetch pll-clock-frequency automatically Date: Mon, 1 May 2023 20:07:55 -0500 Message-Id: <20230502010759.17282-4-aford173@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230502010759.17282-1-aford173@gmail.com> References: <20230502010759.17282-1-aford173@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Make the pll-clock-frequency optional. If it's present, use it to maintain backwards compatibility with existing hardware. If it is absent, read clock rate of "sclk_mipi" to determine the rate. Signed-off-by: Adam Ford Tested-by: Chen-Yu Tsai --- drivers/gpu/drm/bridge/samsung-dsim.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index bf4b33d2de76..2dc02a9e37c0 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1726,12 +1726,20 @@ static int samsung_dsim_parse_dt(struct samsung_dsim *dsi) { struct device *dev = dsi->dev; struct device_node *node = dev->of_node; + struct clk *pll_clk; int ret; ret = samsung_dsim_of_read_u32(node, "samsung,pll-clock-frequency", &dsi->pll_clk_rate); - if (ret < 0) - return ret; + + /* If it doesn't exist, read it from the clock instead of failing */ + if (ret < 0) { + pll_clk = devm_clk_get(dev, "sclk_mipi"); + if (!IS_ERR(pll_clk)) + dsi->pll_clk_rate = clk_get_rate(pll_clk); + else + return PTR_ERR(pll_clk); + } ret = samsung_dsim_of_read_u32(node, "samsung,burst-clock-frequency", &dsi->burst_clk_rate); -- 2.39.2