Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp948851lqg; Sat, 2 Mar 2024 08:13:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUy3J6tgReVWzftgA8t3Z/Su8j1GsMDCBBxBi0HfMimfAtTjpTN8/79gGe3BuzDNKnn6ZyCRvt31/fgPiGNZABFyZwo+/w7TnuoAvvKsw== X-Google-Smtp-Source: AGHT+IGb0T8z0IMIRjDGBWtN/6kwerP5ZxSvB8PXdKzqc0KEJtCaU+60Md+4myoDPktYj7iI3ReT X-Received: by 2002:a05:6808:14cc:b0:3be:494e:9379 with SMTP id f12-20020a05680814cc00b003be494e9379mr5656554oiw.16.1709396024838; Sat, 02 Mar 2024 08:13:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709396024; cv=pass; d=google.com; s=arc-20160816; b=AOOpcHlBGxFOgV75/Z6dreFK6+nceGsOFytJSVLXM68CWcKFnJVO0X3ee/jFHM0mUs WvDPUsBBEPfpENRs2SqIhzRI7+jUZwekGZhCMkScXVs9TK7iDgM2N2zeyFkNcqOEEGPv 1F/QYQ+9ioOPNhEFUj//74on3t3OxLvIdtUg3mWfLsy3A721yRj2hDlzqqWgMbPY+VJG 17vAdpjrNOzh7cN96gg7itlBVhmkBbFcS/3PnW3Vtrq1o8iw2pp43B4gHwjrx+nvJeXn Vq9pzXGzvvZmfWAC8sKIY8h0y5v1il9QTM0rECdLFGSmy0gHtT6eW2YJsDdtHYdvomMb PhWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=bvQGYtN2vRBi+QYnwAZtvXa2o7whVTvKnKEEFe1E4KQ=; fh=Nfpqfe3plKxJFFuOBO8tOmVOjpV42OuZHnkSinFfu8o=; b=O8N+pIu54V7Ef/m1oeZgKl1OPEtS/3fjpmZ8+D8qS6s50LtU93lpI4+cUE/Iu5p79c FJnIM+oMqkemOyGmG76/u1JOz1B/JR7HqCZACd1N6/M0CeNFk4zXTY5EuYOlA7TJVKMs LucVxoqjQhqT5w3HGA7Zm5p0whsgAUnqcS+rpO3rGWPH3e0e8dPeE3jYE81o9jL/jE/e K7qK24P9SskPKK+9+ST3+LGD/bJAUx44uFzlphVmuDFiQ1yPcN6gXGkfL8YRW8fyWvHy +rlg/UoCc821Hjqmg4Go1xyzDaAxkuz/O25aERkf9l4xomX5VHgqwf+UfD8VUdpflua+ 1kEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hbV96z/U"; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-89494-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89494-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id gx17-20020a056a001e1100b006e4c395c9d2si5381737pfb.77.2024.03.02.08.13.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 08:13:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89494-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="hbV96z/U"; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-89494-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89494-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4A21E2833DF for ; Sat, 2 Mar 2024 16:13:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C17DC18C08; Sat, 2 Mar 2024 16:13:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="hbV96z/U" Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E9340210FE for ; Sat, 2 Mar 2024 16:13:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709396005; cv=none; b=vFv3v2Jt2BqzYBVq3cc8HTYZsINvaKlroyhh7x03Qenyy3RBBkCyeONKfNuI8NKlZvIbtndDZ8T6wYk87YUKfsfHfLjWLgVATT7rDDU8JRy11D54mdBGqeO6A6cNFrFDmuMHO5j4skpPvHuutAFibF2OdG9ELwqSenL0wmiP+y0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709396005; c=relaxed/simple; bh=JeLgVGxq4GQg42VTNAyIVdsz1jUfH/1+h0YLlwMB8kU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JZ1tKgzeQeJfWRwr0nLwah7r7JSj7dudC8XuVGYhpIhEZZoNEsfeLKpgq1YldjgC4EdY5119PQ7st3qui/c2zaCDNay4Gc9W9EwQj8ttE7/DGjrx1cePOXI0GqBc0iwWRcskxi0UE63Xp6LmAz4AmBLlvICqxrUCOZOOcbifFCQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=hbV96z/U; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-412a9e9c776so24760815e9.0 for ; Sat, 02 Mar 2024 08:13:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709396002; x=1710000802; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=bvQGYtN2vRBi+QYnwAZtvXa2o7whVTvKnKEEFe1E4KQ=; b=hbV96z/UID9eG8YgjJCqXW00rt2Ed4n3iUZjJl6k52dlu6n5SWnBQh1L0ZuTahsvjk 1ba8QTm6KApkvDUH6YTlm7fdvbFWj4apSlorKbNE4Q1Ak1jky7X6q3ScclxagR0lX+Yq 6JebDQahDpRpnBJOWjdl7n8vWtQJHf1M/GMfWMd/wRmOrqsVApwnEpVvZKnqWUMr9LjH JT8ZWYvJdj2sQ4rLa3fqG5oJ++cSwEqZvdbOX7RFr1SWUTbs903ZxwHsGWyBRrQQSYL3 g22ejuBdfSL9rwz3HpDvIU3NAQGLc3kvjNAQyNWmVsLKmDOr9AgabjtBCliXgqsLsA47 9gsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709396002; x=1710000802; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bvQGYtN2vRBi+QYnwAZtvXa2o7whVTvKnKEEFe1E4KQ=; b=rsIKJJZm1fxBMsBUSw0ok/afhLD8VjpRUYDeR+v0DXmT5OWCgEzXROxzJK6OCFqKmz OOQDOYcrbWZUe9XvfeAxqq+VR2Xwcz2PHx/eNJq8R/qN0u9ClrX6/z6MZc612n//k4dP PtZQA7EWOoGhUJsNHJXAxGdnUE7J00IogQMQpu7+QgeLdgRZpoOnpiJBuKKsK+ZX416/ lD6nvnZosAhI5pShsyqzZ1R89k4H5aepAF4Xre+xN9eHVSNHwE+uGDPur95tP6Wq4vXx 5q3Jc7wAfIvsT2M/JdNS7kpK826BA49k3paBb33fM3NkzymqOzozX4TiTEcBY7+I8ppe a+zA== X-Forwarded-Encrypted: i=1; AJvYcCX/+X2AHrxdRWGHbaxEZJoWJrERudw56G6eJ1lJHHPue8ahX9Hp0HL8i6HhMvXqlCy31M1DWVKWgtqz0+18GPanFsRBNEYHa368Exyg X-Gm-Message-State: AOJu0YwYCg4/sn7Ee1BOfIOYTXI5DoBCJw1+kozF1bDtZNrI4tHCNRg6 lIBj4i783umqz/fMrKyyA9tcITD3NkEfpgecMJu52WlFbQasrufHuiEQVl717E8= X-Received: by 2002:adf:d009:0:b0:33e:152a:6b3d with SMTP id t9-20020adfd009000000b0033e152a6b3dmr4871168wrh.31.1709396002115; Sat, 02 Mar 2024 08:13:22 -0800 (PST) Received: from [192.168.0.58] ([176.61.106.68]) by smtp.gmail.com with ESMTPSA id bu28-20020a056000079c00b0033dc7e50488sm7796549wrb.96.2024.03.02.08.13.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 02 Mar 2024 08:13:21 -0800 (PST) Message-ID: <18567989-fb60-49ae-92e6-94e1bc2fa1c7@linaro.org> Date: Sat, 2 Mar 2024 16:13:19 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 4/5] clk: qcom: Add camera clock controller driver for SM8150 Content-Language: en-US To: Satya Priya Kakitapalli , Bjorn Andersson , Konrad Dybcio , Michael Turquette , Stephen Boyd , Abhishek Sahu , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Stephen Boyd , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Ajit Pandey , Imran Shaik , Taniya Das , Jagadeesh Kona References: <20240229-camcc-support-sm8150-v1-0-8c28c6c87990@quicinc.com> <20240229-camcc-support-sm8150-v1-4-8c28c6c87990@quicinc.com> From: Bryan O'Donoghue In-Reply-To: <20240229-camcc-support-sm8150-v1-4-8c28c6c87990@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 29/02/2024 5:38 a.m., Satya Priya Kakitapalli wrote: > Add support for the camera clock controller for camera clients > to be able to request for camcc clocks on SM8150 platform. > > Signed-off-by: Satya Priya Kakitapalli > --- > +static int cam_cc_sm8150_probe(struct platform_device *pdev) > +{ > + struct regmap *regmap; > + int ret; > + > + ret = devm_pm_runtime_enable(&pdev->dev); > + if (ret) > + return ret; > + > + ret = pm_runtime_resume_and_get(&pdev->dev); > + if (ret) > + return ret; > + > + regmap = qcom_cc_map(pdev, &cam_cc_sm8150_desc); > + if (IS_ERR(regmap)) { > + pm_runtime_put(&pdev->dev); > + return PTR_ERR(regmap); > + } > + > + clk_trion_pll_configure(&cam_cc_pll0, regmap, &cam_cc_pll0_config); > + clk_trion_pll_configure(&cam_cc_pll1, regmap, &cam_cc_pll1_config); > + clk_regera_pll_configure(&cam_cc_pll2, regmap, &cam_cc_pll2_config); > + clk_trion_pll_configure(&cam_cc_pll3, regmap, &cam_cc_pll3_config); > + clk_trion_pll_configure(&cam_cc_pll4, regmap, &cam_cc_pll4_config); > + > + /* Keep the critical clock always-on */ > + qcom_branch_set_clk_en(regmap, 0xc1e4); /* cam_cc_gdsc_clk */ Does this clock need to be specified this way ? drivers/clk/qcom/camcc-sc8280xp.c::camcc_gdsc_clk specifies the gdsc clock as a shared op clock. Actually it looks to be register compatible, please try defining titan_top_gdsc as per the example in 8280xp. > + > + ret = qcom_cc_really_probe(pdev, &cam_cc_sm8150_desc, regmap); > + > + pm_runtime_put(&pdev->dev); > + > + return ret; > +} So this is a pattern we keep repeating in the clock probe() functions which I am writing a series to address. There's no need to continue to replicate the bug in new code though. Only switch on always-on clocks if probe succeeds. ret = qcom_cc_really_probe(pdev, &cam_cc_sm8150_desc, regmap); if (ret) goto probe_err; qcom_branch_set_clk_en(regmap, 0xc1e4); /* cam_cc_gdsc_clk */ pm_runtime_put(&pdev->dev); return 0; probe_err: pm_runtime_put_sync(&pdev->dev); Alternatively switch on the always-on clocks before the really_probe() but then roll back in a probe_err: goto probe_err: remap_bits_update(regmap, 0xc1e4, BIT(0), 0); pm_runtime_put_sync(&pdev->dev); There may be corner cases where always-on has to happen before really_probe() I suppose but as a general pattern the above should be how we go. Anyway I suspect the right thing to do is to define a titan_top_gdsc_clk with shared ops to "park" the GDSC clock to 19.2 MHz instead of turning it off. You can get rid of the hard-coded always-on and indeed represent the clock in /sysfs - which is preferable IMO to just whacking registers to keep clocks always-on in probe anyway. Please try to define the titan_top_gdsc_clk as a shared_ops clock instead of hard coding to always on. If that doesn't work for some reason, then please fix your always-on logic in probe() to only make the clock fixed on, if really_probe() succeeds. --- bod