Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp1105404lqo; Thu, 9 May 2024 05:08:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW566ZMg2KPrYmFHOicI6WfhzfKaq/giy3UUKlJ6jxkAtp4WGUZzCeult2CKr2nufN3mcco4i/bSaktSsTwyUKgVVnckajO2zUGLZZGNA== X-Google-Smtp-Source: AGHT+IFz6M2bqh51Y1Ho8TEuHtcKMkoaWI3PQ/pq8k368DmE9HqwE2bCqkhQTvIsTfb0RZ17mTng X-Received: by 2002:a50:cd07:0:b0:56c:d1b:e088 with SMTP id 4fb4d7f45d1cf-5731d9db357mr3657453a12.19.1715256507112; Thu, 09 May 2024 05:08:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715256507; cv=pass; d=google.com; s=arc-20160816; b=wlbAYGCZ9AtRxfhTSm8iwSExMuYJsQRZoO5IZ8Nnv5f15DVbaxS8BqmZ0sdkXpboH1 C3THekLwM6qBY0gTqK++kRpo153LjfRcOqbxHLCE7MnWiPWWam4/URu/0v1TIKDajlKg vbuKK8UbRKrwdzac8ioRjcW4IU3XjtoRY9mCPCqOYthsswG4/V2S1NR1MylLb1EsXk2x Iei811AXje/+xvlW4IbXg2Q9zLPjsRSi7mMoMjfXdeUceSy3Km0gyMm+VxGK6Frp/7dr INNLD4LRHBRzPgLnmWNln3ytKLkxZprKyJIfKE0f3UxP9AL/G0xb4EWSxPPSq8MDZKp6 +Nhg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=q8klZW1X3Sda14Lq0eRI1WDVW4JJJl7xuMqHEZ5sEhE=; fh=kcPPGhM2/StgG77JPWr1eqdYpSgz6AuFg80979b8Tsg=; b=kqzn8yyv7QRngVVTiPc08ToVoVVvgBIFt3+eGROI1TnasVuSB2VJ0aoFuJeyssKVJz MQFUtmt2+nklTvPgeAhwNWN1HKwnXC3xXJtCEkEcNwpM+SzGTmZeYdLzrltLTX3LurfI mtI9+KMXCQ+n3q6qH5ooFqYEQQNDiAuP8X4ISMrZYOqnNgDcLPxqLFyZW5KTR/fRvmdR HqTMUrWdjnXEdcIAfGTGVz1a7GQhqSBBZXFGv2VgdILFQxI1Bg7XZkK1xCM9bUiuL4pR YcbOlR19Jq2Ohe84XR8nDE+bxcOLvACZ2e3l+3H2RsWY9In6roFORRNiFiO687EXhTfg yL7w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=S4k958xo; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-174471-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174471-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c36d77fsi716534a12.543.2024.05.09.05.08.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 05:08:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-174471-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=S4k958xo; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-174471-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-174471-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id AAC761F22ED8 for ; Thu, 9 May 2024 12:08:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B0A9014F9DF; Thu, 9 May 2024 12:07:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="S4k958xo" Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 0B8E414BFAB; Thu, 9 May 2024 12:07:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715256448; cv=none; b=FROmdvKhT5pAgllUqBP3xgM8b5nPr3UvfX1mYn8jd/Hu9ed7zjn0NJkLJwTSCYF1qWehtYoumufPYT20XaF6vGVyI0CoiDQwnY0aYHj+KaHYDjaT8SbRaJ/9qxf9Uhn4Pi3qrUoOESRqCBRC7nu0zdIJA8T8I5Rsm8gszeugCuE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715256448; c=relaxed/simple; bh=sGGeW//7ieucPKqK6xhCiFsbFbyWjbSB0+Tb1XQxe9c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uz/j8+8gVVcR1qKBA2Wn5Cb6N8Mz+jzIixa/Er3UXil0ViqZldQGuCthMZuKOVexwk+/3nRFLWLwXX43X5hLis7/pstf1h2c9f9YXTkb4Hwu/w3HGaceNQ+JiuYaz20cZaEk3LCJg2Bn587+DwxbYAeXYiJcbQOsnJzj9nh1XRw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=S4k958xo; arc=none smtp.client-ip=209.85.167.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-51fb14816f6so1061580e87.0; Thu, 09 May 2024 05:07:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715256445; x=1715861245; darn=vger.kernel.org; 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=q8klZW1X3Sda14Lq0eRI1WDVW4JJJl7xuMqHEZ5sEhE=; b=S4k958xo1qyeosNK4Mrxn8jlYFTfqdvrdl9hfJi9g3mjyiQY063BBVnUccM0fWUWz0 X1+N17W2COTTs9EZ3/Z2YPm2fiNV89j5XCS5YXkky2RrmXD6BjGF5mZjKjXGx08R4nBp r2F7zWlLWLPJKGHLpAdgpKU3h6Uy7I6dn4cc/4MXKp2Eg0qkFC4LdFr/uHefq7TKBbmP XBkZHDiYs43QIovOdX0zTXC18cRwATW0+MAx0pfArXyC7X4+Jc/FB0SwaQpFcBHMsAEC yISpvz5/ulLmR3opPPSrpMJq7ki9A+DGAA21OJJCYt+lF9eM5F9PTEx8YrTWRtTZlkCF s86A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715256445; x=1715861245; 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=q8klZW1X3Sda14Lq0eRI1WDVW4JJJl7xuMqHEZ5sEhE=; b=iNOigJd9PNSfghxWBNyTPQf0c62Hg99KILAzVyf1oWVWTetwHMADh077bitQ/+b2Yq M5DysfkzCmHXpJp3M0j03kj/92xq5bmJ0qV00zTrYLnc1l+doDVSK98O8LtfG2pA8RSC MIfSGLaZk17fYykAktx1UVw+bbtkDC+0y8HJxLRLlj9XL3Cx3D0iLk6bhU1opNQUKust 2qG9NrH3dUHUSwtM8SG392ebmk9/G4URGhe+0YNztP4PlZdNB3u8ebnbZR68a8IdLuha 6hyO9maGCLV534O9o7wFDpj9EWpt8+4pn2bFPmE+Kk3+4YYsAnwAtAN8tbNY8ic2xatr Ou3w== X-Forwarded-Encrypted: i=1; AJvYcCXVMOaQwkYPMNvIUbsECNYhBj6uJyW0Az5lgABcVOcjPJ1PItHKefQ2dolznZHXguK2kejIxClZonSfHRM81WXAtzpQ3m5UK244ZOkMnUUf6awsIAryM7yXXj2EQeBmqZgEXcicZxSJG7+EzVhu+XA58LmfR25eIOM5gE1PR/4j3/a6ag== X-Gm-Message-State: AOJu0Yx9JFL6CyX4tDcqmX5KoaFUtCsFKyff1QLyQ49Uliv3qZ8g9V8S 9NXftgxRmr2oFIsLKEELu0qoiNHETyBgFx0aNtnA2qEcDEAYCBQ= X-Received: by 2002:a05:6512:210a:b0:51d:9921:20f7 with SMTP id 2adb3069b0e04-5217c56f496mr3116279e87.40.1715256445211; Thu, 09 May 2024 05:07:25 -0700 (PDT) Received: from U4.lan ([2a02:810b:f40:4600:b44:d8c3:6fa8:c46f]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41fccce1912sm24112005e9.11.2024.05.09.05.07.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 May 2024 05:07:24 -0700 (PDT) From: Alex Bee To: Sandy Huang , =?UTF-8?q?Heiko=20St=C3=BCbner?= , Andy Yan , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Turquette , Stephen Boyd Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Alex Bee Subject: [PATCH v2 4/7] drm/rockchip: dsi: Support optional AHB clock Date: Thu, 9 May 2024 14:07:12 +0200 Message-ID: <20240509120715.86694-5-knaerzche@gmail.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240509120715.86694-1-knaerzche@gmail.com> References: <20240509120715.86694-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Some integrations of the IP additionally have an AHB clock which has to be enabled before accessing the registers is possible. Add support for it as an optional clock. Signed-off-by: Alex Bee --- changes since v1: - new patch .../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c index 4cc8ed8f4fbd..6ed64cc35275 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -265,6 +265,7 @@ struct dw_mipi_dsi_rockchip { struct clk *pllref_clk; struct clk *grf_clk; struct clk *phy_cfg_clk; + struct clk *ahb_clk; /* dual-channel */ bool is_slave; @@ -1153,7 +1154,15 @@ static int dw_mipi_dsi_dphy_init(struct phy *phy) goto err_init; } + ret = clk_prepare_enable(dsi->ahb_clk); + if (ret) { + clk_disable_unprepare(dsi->grf_clk); + clk_disable_unprepare(dsi->pclk); + goto err_init; + } + ret = dsi->cdata->dphy_rx_init(phy); + clk_disable_unprepare(dsi->ahb_clk); clk_disable_unprepare(dsi->grf_clk); clk_disable_unprepare(dsi->pclk); if (ret < 0) @@ -1240,6 +1249,12 @@ static int dw_mipi_dsi_dphy_power_on(struct phy *phy) goto err_phy_cfg_clk; } + ret = clk_prepare_enable(dsi->ahb_clk); + if (ret) { + DRM_DEV_ERROR(dsi->dev, "Failed to enable ahb_clk: %d\n", ret); + goto err_ahb_clk; + } + /* do soc-variant specific init */ if (dsi->cdata->dphy_rx_power_on) { ret = dsi->cdata->dphy_rx_power_on(phy); @@ -1269,6 +1284,8 @@ static int dw_mipi_dsi_dphy_power_on(struct phy *phy) return ret; err_pwr_on: + clk_disable_unprepare(dsi->ahb_clk); +err_ahb_clk: clk_disable_unprepare(dsi->phy_cfg_clk); err_phy_cfg_clk: clk_disable_unprepare(dsi->grf_clk); @@ -1296,6 +1313,7 @@ static int dw_mipi_dsi_dphy_power_off(struct phy *phy) DRM_DEV_ERROR(dsi->dev, "hardware-specific phy shutdown failed: %d\n", ret); } + clk_disable_unprepare(dsi->ahb_clk); clk_disable_unprepare(dsi->grf_clk); clk_disable_unprepare(dsi->pclk); @@ -1429,6 +1447,13 @@ static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) } } + dsi->ahb_clk = devm_clk_get_optional(dev, "ahb"); + if (IS_ERR(dsi->ahb_clk)) { + ret = PTR_ERR(dsi->ahb_clk); + DRM_DEV_ERROR(dev, "Unable to get ahb_clk: %d\n", ret); + return ret; + } + dsi->grf_regmap = syscon_regmap_lookup_by_phandle(np, "rockchip,grf"); if (IS_ERR(dsi->grf_regmap)) { DRM_DEV_ERROR(dev, "Unable to get rockchip,grf\n"); -- 2.43.2