From nobody Mon Feb 9 15:06:11 2026 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 C216F225765; Mon, 9 Jun 2025 22:56:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509810; cv=none; b=ryYOg8iyV4QiA9Qeig2OKkFHeCiRR+KMBgB6ZE4+UBKzBOkO+cIFakmyJ05YnWbgPfuYNp9wTOvTdlIuwUyK0bJ2LgARxAUqHkNcOdB8oSFP+ccSzzDpmIQCjaq4jbStWzGiP7acdqVLGMSqwcGva/Tn1m4BIlykOBjQDWrIZXQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509810; c=relaxed/simple; bh=mfxMyefCzHjeesQdMWLbrA7VTrQsoSyG5nNC2+zL6fM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sAPwtQvaQm/6hOvN6ALvtRiNUrUmxzt6NKKyShbhGl5lWC50W2IKgH3r5N8GLr2Klf/S+EszZdH2aJGSERlbJXcJaFfdCGHt/l1R4F1w33AcNGZNOiM4vGQ+BSVkMwRod3Y184O+svEWGe1+4cfsi7REuZx3q6ETO2hDVjBdXb0= 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=XaeUZi5B; arc=none smtp.client-ip=209.85.221.46 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XaeUZi5B" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-3a525eee2e3so3621552f8f.2; Mon, 09 Jun 2025 15:56:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749509807; x=1750114607; 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=qVMaFqwVaRe3BMRqoXxDwP87qg6xzDVFlY1zLEQXXs4=; b=XaeUZi5B1MdZRpr3ra9A+09nKQatfHlIGcJso3J6+zQqOr++UAPPl+QCfgNVcTS9aP hRWPhh4jKHnjLH8vwHNDefIQxKZ6drBNB5ZoWCXPvupHO7n4UKpZLQCjwdLl2wSVqOKe E347BiY7D063Zkx6ra+fzMWfDoquShGCZL39k7nd5m3BnMpalOe11KRfNR0P5pzbR7Xf U+rINA19tegbM2HE8bs+qsPMjs0i7YbXB8+8EgjDkPHWzu1Whb/ogfU3SIg+MVFxyidW 9FytzPlARXgn8t9WOEZ8rlKFrzfWahi3oUc31v+mPSD+49KOWvOt6AFUTRtp3zwdUrzI V63A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749509807; x=1750114607; 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=qVMaFqwVaRe3BMRqoXxDwP87qg6xzDVFlY1zLEQXXs4=; b=lBQo7fak6ZKIwZnnYEpFQP5bARm/6y2jlhjppKzK6X3ECkdCyw35caAkctJcFKu8kO jsSkcaSeg3/w02wrQTL0IUYUsHiqruf45jgjJGm50WQYB94pde08LQgNoofw0zged7NL sAbFFfxHDxwIdARYlLeFml8nqdFHFqn6m6ADu/L4REUjw8BMpKwCPQybZSS1xfTzxb8r SLhcp4Z0NYEmXU+VFg/sUgf52PIfR1PqGCv0tLFUGlHz6WQggd9zrzxI1aJ0Dk6lzceO 7/+nIft9Z5EHRyxWHOUm/cS6e0pMCzbb7LgFu7e9hNU0amXOkBCEMf4lvMDxwNKVJNvv S3Gw== X-Forwarded-Encrypted: i=1; AJvYcCWj0d5zcjExQp7Pke5IZVaKcPVZwxZS1VydJnBseQEeyBoR5hcL078tImjsXmUqGM9xR9Ulfq0dDc1FdCc=@vger.kernel.org X-Gm-Message-State: AOJu0YzXTBQ8mjtErKUs8oFoA7K6lFt4zciUmdzRFeh8HuYfoAjj4+7W PzvnoM6wdAHyVdK41SJqXfXxCs58TyR8BhE7iKttQpmSchDIiUivLFCs X-Gm-Gg: ASbGncuHxDWO9lOwWrvVX/Gs1bAcUEn8ZdwPe4tZzoqulFVjEyFHIsBH28opHR+nRt/ FbVGezajyuEXVpNTdc02FO2P1/Y3dcXeY7qshRifIJ5pk19RG1ueNwLiWXHwg33CffrH0CAmLw4 m/YZUZRu+z7dIVbRnu15WK88q7IOoIseQ5sxDI1zg7g85sp20ubHp/auxojNgD5r1K+3Wvss4gr uREQh7pYhUWJxcBP5xe67C3RUmkk/57NQJHg1DLbmYQmdn945KbSu/6kunAK3Xlvqyg2zxeotnb 6Su8RBlbZcVd/1+boweby8FIfzFwc20FEGBvC/AYZ3IPbjFus4dvlNtQC1gudtNCTPw///vQqbF j96OM+etkeHrz7fgd/YE= X-Google-Smtp-Source: AGHT+IHxxNlgUy3KDa90RrzDaQQzT1GEnR6VT89mwWmkm6FsyMGOhxxM4/dRAw+O+U6Dfouuc1yhxQ== X-Received: by 2002:a5d:64e9:0:b0:3a3:6991:dcbb with SMTP id ffacd0b85a97d-3a531784911mr11147277f8f.12.1749509806938; Mon, 09 Jun 2025 15:56:46 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:3c26:913e:81d:9d46]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a5324364c9sm10824574f8f.51.2025.06.09.15.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jun 2025 15:56:46 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Biju Das , Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , dri-devel@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v7 1/9] drm: renesas: rz-du: mipi_dsi: Add min check for VCLK range Date: Mon, 9 Jun 2025 23:56:22 +0100 Message-ID: <20250609225630.502888-2-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar The VCLK range for Renesas RZ/G2L SoC is 5.803 MHz to 148.5 MHz. Add a minimum clock check in the mode_valid callback to ensure that the clock value does not fall below the valid range. Co-developed-by: Fabrizio Castro Signed-off-by: Fabrizio Castro Signed-off-by: Lad Prabhakar Reviewed-by: Biju Das Reviewed-by: Laurent Pinchart --- v6->v7: - No changes v5->v6: - Updated commit message - Added reviewed tag from Laurent v4->v5: - No changes v3->v4: - No changes v2->v3: - No changes v1->v2: - Added reviewed tag from Biju=20 --- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/d= rm/renesas/rz-du/rzg2l_mipi_dsi.c index 50ec109aa6ed..70f36258db63 100644 --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c @@ -612,6 +612,9 @@ rzg2l_mipi_dsi_bridge_mode_valid(struct drm_bridge *bri= dge, if (mode->clock > 148500) return MODE_CLOCK_HIGH; =20 + if (mode->clock < 5803) + return MODE_CLOCK_LOW; + return MODE_OK; } =20 --=20 2.49.0 From nobody Mon Feb 9 15:06:11 2026 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (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 D194A2253F9; Mon, 9 Jun 2025 22:56:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509811; cv=none; b=SDatUzgU0L9t9fnZL2xJNfaCywwwMP4rk1ryGiWc48GmIWeNFKHVQA+II+oY7HHlRd1Lnf01o1nTQkgUmWoBRrqQJ8ioQUQEh5aWjHUCBofLk7dhrK3Q8A7KzBZU65/T7o3VJJfzEuI19ToyD36nxy3KkKFuUtClwlmawmqu9QU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509811; c=relaxed/simple; bh=TY+pjyLwTUPDf5ir2RaYdOuVLRgWyLIHGSinY0E+2Fw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bdl02vmgYIlM40TZRcGUuw2NfMgZQ9Oa3l/exXFjFBR08EbCgStTe0YD52Vmb1ioBQSbIEnlY1StWLjyjtz4gQs5hQjtmwUWK4pYLAshq2aBNdwx5B2lRrdD2QWBVl3f+fgaHtckeB9qlly36sUIUBO7SDwpwkffoLte08nCBFM= 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=Xjyv7cPI; arc=none smtp.client-ip=209.85.128.50 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Xjyv7cPI" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-451d41e1ad1so38275745e9.1; Mon, 09 Jun 2025 15:56:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749509808; x=1750114608; 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=rZQW/XKkta3bmAbPorVL6FUoDrPjZvxMvODfSXJnGtg=; b=Xjyv7cPIMXXJlykpTA5yIpwM3yV0b1ObTB2R6P16fAUubDWVjlw1wm0KCUgKAFJSYD kVS+wdDgxgBtVoAnBi2nzfIj2bsE3llyBedsLtxVc97hta6a7n9Fapz/WoNwMBALkj7+ 5le0lqseeWouL9irQFVRSuWvEVmIDK0WEWdWJ2JlaNC8mm1xz8B1zrvGiEpSCM3nHF9C jAPwd9e3ZPLdtZcgDCTUaEtYxMuXbojVWbScZrpUhqBkXgLs4/cB8Wu/P4z02amDMs39 52W7gh8CrDr3++zZvrZ5VlrTNDWemOC3VUss25seeOLxUQEnjWKZaDo70J5MJeP/F9PD c74w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749509808; x=1750114608; 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=rZQW/XKkta3bmAbPorVL6FUoDrPjZvxMvODfSXJnGtg=; b=C784TZMHvUdVXDPQg1yb4cIx9wJSYGYpxMJp206q5QIcON1dl1apAYGtvxihoEgjdv nbhr0wnbhlHb36KRyLHzCk6ghKyETdzpx/ITt4+laRj1B3pK1o0MNcmOSBZK4GSE3LKk 8fYG382hh2bJ8KnIpK458IoCABL85gCwuwSDwrJLdv55ogr0rShLEqKZvtJYMeVpiokx FrZhkbFCPMwn67rTPKD6pcIITN9QLTFTkYgmMlQ38dCMUy9W5hUnezhFrYynXH7SYvHU 9Db74zJqGlpRDB/wb5wzYDj0jgQvt9KRfWxFXnrtiSLnfjoyl44DwQ/INCDh+Vv8DlqD W5dA== X-Forwarded-Encrypted: i=1; AJvYcCXzjj2lWtYGVngANHS3EZKsiMIQ0obrTJhGpWcxezYoX/rtlDi3vsczT1seFUORtaoviWje2Cg26IkVKsA=@vger.kernel.org X-Gm-Message-State: AOJu0Ywut0I5ERqwLkLD9RXQFK3N1geNuRnBtN9bmo9pk+FGi3Rx82ap DPvmhPhDs7I+O7OiejgGxjJ0VwNYHPQ8See3BFKLRjK85ZZmS9DdEA6P X-Gm-Gg: ASbGncsgJfqp/43uTxf2ubhY/t9MGUsPc2UaIsrKAqxuVECJ3Y9G8O1vY3vAt2qeBTE UM+RHc2rqz9HkiJ0O826fSEsn5FUvVk8f+mOM7h84O/Ta4WSFLXWj9mrtziBgQM1/b9gY9Br0Rx lMlkzO1ZIeEV/kw6WAmrs+M3+v6wptN48J9n8etcf+4gwK9e+hN91YixkbKbZOc4XFJrBQk2TBC RpZv0ua7yZ8Qu4hwrzNUstVcsTD9rYsHXmY9D7Me8ejofsnvHlKAzVLj+ewUqNdTPS6kbP9fBGx Fc+hxegOChXOK/eAF7tB/wWTBwZdRtN1VzXPEGa+Bt/k4SuemC913XSrRJTpZSc2ivQcNBq8Pwx qdVuG9aUGm2ILS9d0nds= X-Google-Smtp-Source: AGHT+IE5rBdcJzn29HX+ahTiwa9/e7buXyaINtikVbd58weuZQI2RLRHqqzyG8t/4l+Pwt5XB0hIwg== X-Received: by 2002:a05:6000:40d9:b0:3a4:ed10:c14 with SMTP id ffacd0b85a97d-3a53189b44amr11940449f8f.14.1749509807998; Mon, 09 Jun 2025 15:56:47 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:3c26:913e:81d:9d46]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a5324364c9sm10824574f8f.51.2025.06.09.15.56.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jun 2025 15:56:47 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Biju Das , Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , dri-devel@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v7 2/9] drm: renesas: rz-du: mipi_dsi: Simplify HSFREQ calculation Date: Mon, 9 Jun 2025 23:56:23 +0100 Message-ID: <20250609225630.502888-3-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Simplify the high-speed clock frequency (HSFREQ) calculation by removing the redundant multiplication and division by 8. The updated equation: hsfreq =3D mode->clock * bpp / dsi->lanes; produces the same result while improving readability and clarity. Additionally, update the comment to clarify the relationship between HS clock bit frequency, HS byte clock frequency, and HSFREQ. Signed-off-by: Lad Prabhakar Reviewed-by: Biju Das Reviewed-by: Laurent Pinchart --- v6->v7: - No changes v5->v6: - Updated commit message - Dropped parentheses around the calculation - Added reviewed tag from Laurent v4->v5: - No changes v3->v4: - No changes v2->v3: - No changes v1->v2: - Added Reviewed-by tag from Biju --- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/d= rm/renesas/rz-du/rzg2l_mipi_dsi.c index 70f36258db63..7fa5bb2a62b6 100644 --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c @@ -288,10 +288,10 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_d= si *dsi, * hsclk: DSI HS Byte clock frequency (Hz) * lanes: number of data lanes * - * hsclk(bit) =3D hsclk(byte) * 8 + * hsclk(bit) =3D hsclk(byte) * 8 =3D hsfreq */ bpp =3D mipi_dsi_pixel_format_to_bpp(dsi->format); - hsfreq =3D (mode->clock * bpp * 8) / (8 * dsi->lanes); + hsfreq =3D mode->clock * bpp / dsi->lanes; =20 ret =3D pm_runtime_resume_and_get(dsi->dev); if (ret < 0) --=20 2.49.0 From nobody Mon Feb 9 15:06:11 2026 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 E9225226533; Mon, 9 Jun 2025 22:56:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509812; cv=none; b=TNTmZUAGnlNwhkcdxecOG4nHa7JYv1BU2khGSXoRzyzl/XpXdHxYSaYKM1MDNZ2W/cgvecgrdAiDACZ+xtgy8ZwEOys1Hbl7M1zOVqT/d3q474RTduaBzQkhY9MbsOh6gVPK2DDtPvvZZDm83SPHdgz1U5oGkoo2I0DPuoEpWSo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509812; c=relaxed/simple; bh=fIe9FjYGAQ/Hi4UU2TxvrxmFZy2OwoAf9mu4lwdZVhU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hi7IBqpcxVn3REdD5e0wU877K2pjCVYVsoYpwUAK2MnNiLDUD03VmHdiY+MNtlB5D92DYRSlRDvmIoqGXXDo968zQGS7kvZiCb+FqQEL74eZlJW1s2hRSBJi7DYGeh1ZAD2F9vnlMohGqnXuJAjG6lLGG28YqcLAGi2VuHTQy4A= 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=IgmyaPth; arc=none smtp.client-ip=209.85.221.46 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IgmyaPth" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-3a4f78ebec8so2877867f8f.0; Mon, 09 Jun 2025 15:56:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749509809; x=1750114609; 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=P3xOeds+e5+RUK0oXx221BrZtaCkjbV0tCtryTi4uI0=; b=IgmyaPth27p2OC1p1HHC39hoKikMSokgovWIAf9//fy7jr4MpmHge60yrUnbI//ytL bawjXL0ECQ2dhpAFLs1tvqTG4iyAQk1D0YgJmRc9BtYiy+RomJN4t89bAqScop0auVWj iGWkdmUouQ62ai6mI23M8pafjOjZ56gX1rIhBiAOqInSsYjQ12p6j73rsGbepgd7i9no gtj3Eq5kjdIBJi4y/4C4dTTOZOvVdhPO9J1PZm3GZVwWkCiJetcBRZsjd+TZ29Q7zxnx dH/2Jj5gmFRY29KtUIs1+xxt0v1Is9CZIqjf+vhiQZURoGy0fmJF2EuQu+yf/PG05SsP /MCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749509809; x=1750114609; 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=P3xOeds+e5+RUK0oXx221BrZtaCkjbV0tCtryTi4uI0=; b=us1QIKeBkPFHeya689PKwytyRilNHjs0qU+I4ymlrIxOrMwRA1DQuMnIHSuVBiBSik UEooB0USeyNUoLHbOus4K9kMVQDJVN3uEC5EAJ78SzOLJDBuvq17g3E4rmN5BZJvpqwq 8zyCVtycF2AZBtrgbfW3jmDHPk9H1fOj9Cb9B8ARi8wiOXvaHxAZVgGvegxLJcyO+Ud1 CDUsDyR+7suSsVq0wJy29Q5S8hhmp3CLGpAkP6bOM8OtjqYHY1/N4RcQXMGBqoEnG4jw m81v2is0j6Z9R5T8uYFKW5R5nBZgVEZqO7woDzF3sfOTfOQFZ/SI1R3A6f5ZgQ/WKrOZ KMEg== X-Forwarded-Encrypted: i=1; AJvYcCVk2lgRxCWsK0glGQTtVFHmTcgryeWYCxDDusfmEP4kxMABuWHoNKZghOTWiBO8Ci3gK0dTmNTmBueKSH0=@vger.kernel.org X-Gm-Message-State: AOJu0YwWLyREWUQu3YSisyuP1XePIv/MaH9i2bjgU10SKJMJas3/iks3 GVM9KioZSCh9LwuHdSFkhS8FbW1/BGaYUzpM8z56SNjOzo0w5l7MANZY X-Gm-Gg: ASbGnct8lSWR3FyzSlBkRMvOFfJh4HBpy31a21ua6qlBu02By19qkfNSs0NHeb/IZVM QGuHrrWoSL3+XOuh/s6EEZ0HrYY7fFEzvJJZRnOcyo6t6cquterssFub0Oeioy8gHvEDkCNaKLj J8k7ErXKCCCVMW2YEZxhqyH/jlc81RQlEbnWLbQDz0Hm5boqAuosLE3YnqKVctpOlBiYokTP+Rw q2OD82rkCiPHbwj28u/R/2DvbBMdDOpkWA9Qbu4piAOl2/WeL42RE4vxmCcBg/z/dhi2z9RZ8Rg t+TKIfyWrazk+9y6Cv0d1bf/opw2rAEVc5VJRpWGut8A22CWUJDmo5Oywsyet0tL9fPDtWVGWMJ oJp5MgOxKSA76lRhez/s= X-Google-Smtp-Source: AGHT+IF5mSTH57XsvDyXNsjHm2N3BWjfBcPLa8JEprNT7tBtnARyEqIaWzrSanPnpXoM54jQUty70Q== X-Received: by 2002:a05:6000:4284:b0:3a4:f510:fa77 with SMTP id ffacd0b85a97d-3a531cb7e8cmr11188076f8f.29.1749509809051; Mon, 09 Jun 2025 15:56:49 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:3c26:913e:81d:9d46]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a5324364c9sm10824574f8f.51.2025.06.09.15.56.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jun 2025 15:56:48 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Biju Das , Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , dri-devel@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v7 3/9] drm: renesas: rz-du: mipi_dsi: Use VCLK for HSFREQ calculation Date: Mon, 9 Jun 2025 23:56:24 +0100 Message-ID: <20250609225630.502888-4-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Update the RZ/G2L MIPI DSI driver to calculate HSFREQ using the actual VCLK rate instead of the mode clock. The relationship between HSCLK and VCLK is: vclk * bpp <=3D hsclk * 8 * lanes Retrieve the VCLK rate using `clk_get_rate(dsi->vclk)`, ensuring that HSFREQ accurately reflects the clock rate set in hardware, leading to better precision in data transmission. Additionally, use `DIV_ROUND_CLOSEST_ULL` for a more precise division when computing `hsfreq`. Also, update unit conversions to use correct scaling factors for better clarity and correctness. Since `clk_get_rate()` returns the clock rate in Hz, update the HSFREQ threshold comparisons to use Hz instead of kHz to ensure correct behavior. Co-developed-by: Fabrizio Castro Signed-off-by: Fabrizio Castro Signed-off-by: Lad Prabhakar Reviewed-by: Biju Das Reviewed-by: Laurent Pinchart --- v6->v7: - Stored frequency in Hz - Added Reviewed-by from Laurent v5->v6: - Dropped parentheses around the calculation of `hsfreq_max`. - Changed dev_info() to dev_dbg v4->v5: - Added dev_info() to print the VCLK rate if it doesn't match the requested rate. - Added Reviewed-by tag from Biju v3->v4: - Used MILLI instead of KILO v2->v3: - No changes v1->v2: - No changes --- .../gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/d= rm/renesas/rz-du/rzg2l_mipi_dsi.c index 7fa5bb2a62b6..b08274e5dfcf 100644 --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -18,6 +19,7 @@ #include #include #include +#include =20 #include #include @@ -85,7 +87,7 @@ struct rzg2l_mipi_dsi_timings { =20 static const struct rzg2l_mipi_dsi_timings rzg2l_mipi_dsi_global_timings[]= =3D { { - .hsfreq_max =3D 80000, + .hsfreq_max =3D 80000000, .t_init =3D 79801, .tclk_prepare =3D 8, .ths_prepare =3D 13, @@ -99,7 +101,7 @@ static const struct rzg2l_mipi_dsi_timings rzg2l_mipi_ds= i_global_timings[] =3D { .tlpx =3D 6, }, { - .hsfreq_max =3D 125000, + .hsfreq_max =3D 125000000, .t_init =3D 79801, .tclk_prepare =3D 8, .ths_prepare =3D 12, @@ -113,7 +115,7 @@ static const struct rzg2l_mipi_dsi_timings rzg2l_mipi_d= si_global_timings[] =3D { .tlpx =3D 6, }, { - .hsfreq_max =3D 250000, + .hsfreq_max =3D 250000000, .t_init =3D 79801, .tclk_prepare =3D 8, .ths_prepare =3D 12, @@ -127,7 +129,7 @@ static const struct rzg2l_mipi_dsi_timings rzg2l_mipi_d= si_global_timings[] =3D { .tlpx =3D 6, }, { - .hsfreq_max =3D 360000, + .hsfreq_max =3D 360000000, .t_init =3D 79801, .tclk_prepare =3D 8, .ths_prepare =3D 10, @@ -141,7 +143,7 @@ static const struct rzg2l_mipi_dsi_timings rzg2l_mipi_d= si_global_timings[] =3D { .tlpx =3D 6, }, { - .hsfreq_max =3D 720000, + .hsfreq_max =3D 720000000, .t_init =3D 79801, .tclk_prepare =3D 8, .ths_prepare =3D 9, @@ -155,7 +157,7 @@ static const struct rzg2l_mipi_dsi_timings rzg2l_mipi_d= si_global_timings[] =3D { .tlpx =3D 6, }, { - .hsfreq_max =3D 1500000, + .hsfreq_max =3D 1500000000, .t_init =3D 79801, .tclk_prepare =3D 8, .ths_prepare =3D 9, @@ -268,7 +270,7 @@ static void rzg2l_mipi_dsi_dphy_exit(struct rzg2l_mipi_= dsi *dsi) static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi, const struct drm_display_mode *mode) { - unsigned long hsfreq; + unsigned long hsfreq, vclk_rate; unsigned int bpp; u32 txsetr; u32 clstptsetr; @@ -280,6 +282,16 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_ds= i *dsi, u32 dsisetr; int ret; =20 + ret =3D pm_runtime_resume_and_get(dsi->dev); + if (ret < 0) + return ret; + + clk_set_rate(dsi->vclk, mode->clock * KILO); + vclk_rate =3D clk_get_rate(dsi->vclk); + if (vclk_rate !=3D mode->clock * KILO) + dev_dbg(dsi->dev, "Requested vclk rate %lu, actual %lu mismatch\n", + mode->clock * KILO, vclk_rate); + /* * Relationship between hsclk and vclk must follow * vclk * bpp =3D hsclk * 8 * lanes @@ -291,13 +303,7 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_ds= i *dsi, * hsclk(bit) =3D hsclk(byte) * 8 =3D hsfreq */ bpp =3D mipi_dsi_pixel_format_to_bpp(dsi->format); - hsfreq =3D mode->clock * bpp / dsi->lanes; - - ret =3D pm_runtime_resume_and_get(dsi->dev); - if (ret < 0) - return ret; - - clk_set_rate(dsi->vclk, mode->clock * 1000); + hsfreq =3D DIV_ROUND_CLOSEST_ULL(vclk_rate * bpp, dsi->lanes); =20 ret =3D rzg2l_mipi_dsi_dphy_init(dsi, hsfreq); if (ret < 0) @@ -315,12 +321,12 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_d= si *dsi, * - data lanes: maximum 4 lanes * Therefore maximum hsclk will be 891 Mbps. */ - if (hsfreq > 445500) { + if (hsfreq > 445500000) { clkkpt =3D 12; clkbfht =3D 15; clkstpt =3D 48; golpbkt =3D 75; - } else if (hsfreq > 250000) { + } else if (hsfreq > 250000000) { clkkpt =3D 7; clkbfht =3D 8; clkstpt =3D 27; @@ -942,7 +948,7 @@ static int rzg2l_mipi_dsi_probe(struct platform_device = *pdev) * mode->clock and format are not available. So initialize DPHY with * timing parameters for 80Mbps. */ - ret =3D rzg2l_mipi_dsi_dphy_init(dsi, 80000); + ret =3D rzg2l_mipi_dsi_dphy_init(dsi, 80000000); if (ret < 0) goto err_phy; =20 --=20 2.49.0 From nobody Mon Feb 9 15:06:11 2026 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 6EF1022A4D1; Mon, 9 Jun 2025 22:56:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509814; cv=none; b=mMlBNOXwvai4o+SYS1XZtlMs8tTeRsAJ7++Gp3HVgN8X+lfHanRIf7/acVRm0laBa/hspXLwc5fn442h2HBW7FVxmGqfCnNNJ1yM87XAf7SiuMKLe8K6C73uX7XEtjH29K2Oxb18pzCc1ZRggqM4DhPIXQxWyY1wz5JnTzt6lnc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509814; c=relaxed/simple; bh=8+NIZs5JoCFFTJdYzLhMCg8qAmw91wco5+ib07Bx00I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uTOoSsNxP/3aL8bOEqOdiD3cvmnxG0Cq2wLlGo8SxluEmh+0bPk+jVl/vt+ZobZ6DIXtN0HhKl6F4DMD80kD6OVxi9GcgZ4/GDYlek2K2ZyTREQScO1eC02jngkau1ThBk7X8Vei0WNssPiH2qPOuGEfXskgSG8tMArvyaW1/is= 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=KhJm09YN; arc=none smtp.client-ip=209.85.221.54 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="KhJm09YN" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3a522224582so2951082f8f.3; Mon, 09 Jun 2025 15:56:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749509811; x=1750114611; 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=1N8ZwCXLYPuIDKUJfDBDkh4IH3GXGxMbLgP9a9nmFT0=; b=KhJm09YNlTHUQXqL6fIznRk03U8DYF4v+4zY2R1Kl9f6pplXJ9L1qbdvX4xyFgZwGo 4tdf7Hd7pineDxsGD1/TSuCUsK+ixpwroTUet7PY0fxaadsEyPzte90eBiuVR4zgBlX/ /MfXtvdbTfeH2WAbeSBPVKTbyRBQJL5Ak3UW5XtOQ3gCjn7Y7HqwJsIx1eoZLjun/bIl Ssmj6CE3tRyKcAqz+SNuaHRo21kubMprV9B72GcRwcnLqvpw95tSaGsDuNhaL/aeiOu0 7SNTs3grtU8pU44Nu3tzrYh3N8s35R01dFVNCUgtVGnhOPP8bBDMusZvu5N7Aywyhv92 JQNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749509811; x=1750114611; 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=1N8ZwCXLYPuIDKUJfDBDkh4IH3GXGxMbLgP9a9nmFT0=; b=GN2yEEwdKtZogwWB+PSMUaUqRhNtlWvhrDsk4PYf0jmj9/NAvBoIwhJ+pzPWoUGw5U 8L73gFanWSPQpxaD6uQVcL231wwJecHAajSv+jXOKpTFU51WoGavmPwlHKgSUE5HbmWP ocedwo9iPh9VLikwDkBpjfeKVZMOHaF4YaRocJXll7eSPy+f4Boc7g+hHQ8m1Lex4xLq xYAX8a39vx1f/hkNR6Cw5mpP9krk/v5sT0E5RI3ecKrfMELIlZ7e4KPWedMDz6Pv83+g JGLH6xqPOaXS/ToKUMq11RXVs1mT3ZV8gmniGO5Px8fX8l86Zaygx8kQ8LQ9O1VDTXxk fQ7Q== X-Forwarded-Encrypted: i=1; AJvYcCULoNIhNoWgLUAJ5mH3Xb72+E2ft0K0jqAzHDSpfM+ODrZIZ+elnePvOdam9K5VEpvVXYMBi07aeWj3rJc=@vger.kernel.org X-Gm-Message-State: AOJu0YwEOaq0fqSYA9Pvq3oHoQowU4d7TPIg2bAQvzrmniqLwpK2z9fu WKsl8hy+O5xFcpHQmRi8T1Pw0h+letzZDbd067JGhFyDByOEXtjlzOPO X-Gm-Gg: ASbGnctEOzuN/YhX5bgwBL/w4lpy/AZPDpQXifGzzsd5pkCBsSzQyKgY77/5kczGOaO QFTcSGVBDI/CIo3YXwXEnKi6gvTJ5+LKUxQFOpvf+lcMALKkrd1i2WNsDj0HDGiuyoQJNLnKti3 wrxvOJ7tsta/uWvNeSPYGA7aj8rxq6ool1VtJxqJUQC91dzKT40VU9k3PrkD/kWTIVSRqRFzLYh rJZX0hNURVJ9nCHUnxGocMtP54C2dY0PTAlDeUUFyEs1JB7km1zslJ3cmloEWK27mHqhj9ieuXu 1kzdc0uFk/Pwy4tLJIZcPw6yyJHcmvi44G+L8MaDFrmrCXQEqekM8PuGbNnz+IG21B3S0vGKtfU Ivuz809fMU8ST0dQyMig= X-Google-Smtp-Source: AGHT+IGmYbZe347X9QsV2lLtl48DDy7LyU1rtDFPKvU7qKEb8+0/r7x68rS02oOnJ7Bhau5TPGraEA== X-Received: by 2002:a5d:584c:0:b0:3a3:648e:1b74 with SMTP id ffacd0b85a97d-3a53188a8admr11524621f8f.6.1749509810650; Mon, 09 Jun 2025 15:56:50 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:3c26:913e:81d:9d46]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a5324364c9sm10824574f8f.51.2025.06.09.15.56.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jun 2025 15:56:49 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Biju Das , Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , dri-devel@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v7 4/9] drm: renesas: rz-du: mipi_dsi: Add OF data support Date: Mon, 9 Jun 2025 23:56:25 +0100 Message-ID: <20250609225630.502888-5-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar n preparation for adding support for the Renesas RZ/V2H(P) SoC, this patch introduces a mechanism to pass SoC-specific information via OF data in the DSI driver. This enables the driver to adapt dynamically to various SoC-specific requirements without hardcoding configurations. The MIPI DSI interface on the RZ/V2H(P) SoC is nearly identical to the one on the RZ/G2L SoC. While the LINK registers are shared between the two SoCs, the D-PHY registers differ. Also the VCLK range differs on both these SoCs. To accommodate these differences `struct rzg2l_mipi_dsi_hw_info` is introduced and as now passed as OF data. These changes lay the groundwork for the upcoming RZ/V2H(P) SoC support by allowing SoC-specific data to be passed through OF. Co-developed-by: Fabrizio Castro Signed-off-by: Fabrizio Castro Signed-off-by: Lad Prabhakar Reviewed-by: Biju Das Reviewed-by: Laurent Pinchart --- v6->v7: - No change v5->v6: - Added min_dclk above max_dclk in rzg2l_mipi_dsi_hw_info - Added Reviewed-by tag from Laurent v4->v5: - Dropped RZ_MIPI_DSI_FEATURE_DPHY_RST feature flag - Added Reviewed tag from Biju v3->v4: - No changes v2->v3: - Dropped !dsi->info check in rzg2l_mipi_dsi_probe() as it is not needed. v1->v2: - Added DPHY_RST as feature flag --- .../gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 51 ++++++++++++++----- .../drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h | 2 - 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/d= rm/renesas/rz-du/rzg2l_mipi_dsi.c index b08274e5dfcf..85074e0c3cc4 100644 --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c @@ -34,10 +34,23 @@ =20 #define RZG2L_DCS_BUF_SIZE 128 /* Maximum DCS buffer size in external memo= ry. */ =20 +struct rzg2l_mipi_dsi; + +struct rzg2l_mipi_dsi_hw_info { + int (*dphy_init)(struct rzg2l_mipi_dsi *dsi, unsigned long hsfreq); + void (*dphy_exit)(struct rzg2l_mipi_dsi *dsi); + u32 phy_reg_offset; + u32 link_reg_offset; + unsigned long min_dclk; + unsigned long max_dclk; +}; + struct rzg2l_mipi_dsi { struct device *dev; void __iomem *mmio; =20 + const struct rzg2l_mipi_dsi_hw_info *info; + struct reset_control *rstc; struct reset_control *arstc; struct reset_control *prstc; @@ -174,22 +187,22 @@ static const struct rzg2l_mipi_dsi_timings rzg2l_mipi= _dsi_global_timings[] =3D { =20 static void rzg2l_mipi_dsi_phy_write(struct rzg2l_mipi_dsi *dsi, u32 reg, = u32 data) { - iowrite32(data, dsi->mmio + reg); + iowrite32(data, dsi->mmio + dsi->info->phy_reg_offset + reg); } =20 static void rzg2l_mipi_dsi_link_write(struct rzg2l_mipi_dsi *dsi, u32 reg,= u32 data) { - iowrite32(data, dsi->mmio + LINK_REG_OFFSET + reg); + iowrite32(data, dsi->mmio + dsi->info->link_reg_offset + reg); } =20 static u32 rzg2l_mipi_dsi_phy_read(struct rzg2l_mipi_dsi *dsi, u32 reg) { - return ioread32(dsi->mmio + reg); + return ioread32(dsi->mmio + dsi->info->phy_reg_offset + reg); } =20 static u32 rzg2l_mipi_dsi_link_read(struct rzg2l_mipi_dsi *dsi, u32 reg) { - return ioread32(dsi->mmio + LINK_REG_OFFSET + reg); + return ioread32(dsi->mmio + dsi->info->link_reg_offset + reg); } =20 /* -----------------------------------------------------------------------= ------ @@ -305,7 +318,7 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi= *dsi, bpp =3D mipi_dsi_pixel_format_to_bpp(dsi->format); hsfreq =3D DIV_ROUND_CLOSEST_ULL(vclk_rate * bpp, dsi->lanes); =20 - ret =3D rzg2l_mipi_dsi_dphy_init(dsi, hsfreq); + ret =3D dsi->info->dphy_init(dsi, hsfreq); if (ret < 0) goto err_phy; =20 @@ -357,7 +370,7 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi= *dsi, return 0; =20 err_phy: - rzg2l_mipi_dsi_dphy_exit(dsi); + dsi->info->dphy_exit(dsi); pm_runtime_put(dsi->dev); =20 return ret; @@ -365,7 +378,7 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi= *dsi, =20 static void rzg2l_mipi_dsi_stop(struct rzg2l_mipi_dsi *dsi) { - rzg2l_mipi_dsi_dphy_exit(dsi); + dsi->info->dphy_exit(dsi); pm_runtime_put(dsi->dev); } =20 @@ -615,10 +628,12 @@ rzg2l_mipi_dsi_bridge_mode_valid(struct drm_bridge *b= ridge, const struct drm_display_info *info, const struct drm_display_mode *mode) { - if (mode->clock > 148500) + struct rzg2l_mipi_dsi *dsi =3D bridge_to_rzg2l_mipi_dsi(bridge); + + if (mode->clock > dsi->info->max_dclk) return MODE_CLOCK_HIGH; =20 - if (mode->clock < 5803) + if (mode->clock < dsi->info->min_dclk) return MODE_CLOCK_LOW; =20 return MODE_OK; @@ -905,6 +920,8 @@ static int rzg2l_mipi_dsi_probe(struct platform_device = *pdev) platform_set_drvdata(pdev, dsi); dsi->dev =3D &pdev->dev; =20 + dsi->info =3D of_device_get_match_data(&pdev->dev); + ret =3D drm_of_get_data_lanes_count_ep(dsi->dev->of_node, 1, 0, 1, 4); if (ret < 0) return dev_err_probe(dsi->dev, ret, @@ -948,13 +965,13 @@ static int rzg2l_mipi_dsi_probe(struct platform_devic= e *pdev) * mode->clock and format are not available. So initialize DPHY with * timing parameters for 80Mbps. */ - ret =3D rzg2l_mipi_dsi_dphy_init(dsi, 80000000); + ret =3D dsi->info->dphy_init(dsi, 80000000); if (ret < 0) goto err_phy; =20 txsetr =3D rzg2l_mipi_dsi_link_read(dsi, TXSETR); dsi->num_data_lanes =3D min(((txsetr >> 16) & 3) + 1, num_data_lanes); - rzg2l_mipi_dsi_dphy_exit(dsi); + dsi->info->dphy_exit(dsi); pm_runtime_put(dsi->dev); =20 /* Initialize the DRM bridge. */ @@ -975,7 +992,7 @@ static int rzg2l_mipi_dsi_probe(struct platform_device = *pdev) return 0; =20 err_phy: - rzg2l_mipi_dsi_dphy_exit(dsi); + dsi->info->dphy_exit(dsi); pm_runtime_put(dsi->dev); err_pm_disable: pm_runtime_disable(dsi->dev); @@ -992,8 +1009,16 @@ static void rzg2l_mipi_dsi_remove(struct platform_dev= ice *pdev) pm_runtime_disable(&pdev->dev); } =20 +static const struct rzg2l_mipi_dsi_hw_info rzg2l_mipi_dsi_info =3D { + .dphy_init =3D rzg2l_mipi_dsi_dphy_init, + .dphy_exit =3D rzg2l_mipi_dsi_dphy_exit, + .link_reg_offset =3D 0x10000, + .min_dclk =3D 5803, + .max_dclk =3D 148500, +}; + static const struct of_device_id rzg2l_mipi_dsi_of_table[] =3D { - { .compatible =3D "renesas,rzg2l-mipi-dsi" }, + { .compatible =3D "renesas,rzg2l-mipi-dsi", .data =3D &rzg2l_mipi_dsi_inf= o, }, { /* sentinel */ } }; =20 diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h b/drivers/= gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h index 26d8a37ee635..d8082a87d874 100644 --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h @@ -41,8 +41,6 @@ #define DSIDPHYTIM3_THS_ZERO(x) ((x) << 0) =20 /* --------------------------------------------------------*/ -/* Link Registers */ -#define LINK_REG_OFFSET 0x10000 =20 /* Link Status Register */ #define LINKSR 0x10 --=20 2.49.0 From nobody Mon Feb 9 15:06:11 2026 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 86FCC22A80E; Mon, 9 Jun 2025 22:56:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509815; cv=none; b=FOJtu9Xgv7kr0hw9/p6iV8XZynlceUi4GhZtRCAD7P30dXK2d/kjY5HUyT/L0kiA9w5cUJYZZ2RCZo/IBmGBjO62iRJjhw6nC+HIvuQUY37hdpVk9IEu7lKyHBDuvUoPwJ+GsLDZuTrqslmaEB45gRvTPqtNATq727HcGZ2TlbE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509815; c=relaxed/simple; bh=gCP6Mmnkw9pbdrY4Ks59zf9m9tJFA7J0ZYgdwNVqaC8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DbrrK2zQAyL6Gxuj+AO8hlz/az4RBEFL8GR6WFkpnk5Nm56kOc4Lns0YH3K1RZjZoaYEM+nMj2wRL04TEU473soixexDJV85A+egFw0D4Bk7rpUb3nlBPYeGqvp3ZRQs09qBd93Z7HEj+O62kl5WLh+SyJr/wQaLcdprILVrPnE= 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=k/dRg7Ch; arc=none smtp.client-ip=209.85.221.47 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="k/dRg7Ch" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-3a53ee6fcd5so1322526f8f.1; Mon, 09 Jun 2025 15:56:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749509812; x=1750114612; 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=vUIYYrKTPk+CVvS6EMCl15Pl5q/Omqp4NNMhKg0oVDo=; b=k/dRg7ChOCOAe9GC1sUKCjgqe5amF3UVLWz1iyaSWJfG7tWgzeGrN7NUu+y9NUCFVf E+2GK3ttouTrUEvydmuwboJs44QAn17QJ8AzDEEqUYLZ9ShkRZKZT2zF1hoPGAEIHgsf AGFtPVyubaZp/aS6q5RPxdQvfyiR9UFaPGqDnwYK4yvYic+ax/YVmSP2dgvHQlGyj7rv fy2KtYI9Uhe2wnBQSXTLMvP4HhsPqwzbmt6uXs4UIS5ghzIUjAf03HZOPK27p22DVzwO HKn2qzZUq5evNMN/Tbxy5yAYrxUc9pZgMom+TujT0ADHOXdpTyzBsSDhN3CWrsKcJSIa ADWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749509812; x=1750114612; 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=vUIYYrKTPk+CVvS6EMCl15Pl5q/Omqp4NNMhKg0oVDo=; b=mHH85chnHvH68U26dFOC/AFLUpaRAjMA4x0NfW1A9AAuID4ZyAkOeIXVcIq6CBg6J4 8yENoqwcTLcO9ixaJWMRcyDehJOneGR/6S1bHmvKT1BuKosfEHQwD1lcybQDeWKBxdjz i8es8DhVz7eUB9M6zs7fgScB+NZfiwvc4rGeZUECtuxWdCTpE9OM9qJKaisUEABNOsTi nKKbltTv2/Rh6BVtK7mzwa3gubChI/ljHB5HNJa71yN1YAQkvCosOD3ZdrhzzPcKjpsm Uh2FF+S0Wyf53KRbC/LTmIEvbkmTJF2BPR6HDY1M0DVU3EBfRCL2DFJAG/iW/8Sndm/J yrcA== X-Forwarded-Encrypted: i=1; AJvYcCXBAqvGhoaMUuQ5l9pyD9PP9A2CN/om0uijNl5+Xpl9Pn0D5vo/kJESdREjGUQGYDDGl+a2rdphnug6en8=@vger.kernel.org X-Gm-Message-State: AOJu0Yz1FOMeyozcDBQ2TfnOGxfMfCGPY3UerYNylQGmeKBbmnUUZCzY 2ynW8isPHMorKh+zjnRutGFNfOX9IFLFRoQ2yJZquLCq4CKfcXlxkFRErjFPoxeVvEU= X-Gm-Gg: ASbGncuvkL7MDD1rweal+/KRNdc4vh8VGjLTU7Gs1rlvN0UAcak+LiBND+bY+sVKW6Y Q0I8Gz77kd2uG/gxBEKHJ5N1N7wX+Ee2mJCfbf6PckkCaXErhwS4Pe2i76uF9HKLRdB6k1x6VfZ zrs6hODEH9Dm8HfEa+rqWXzEH/EuTqryUPtYUFxqg6LbqxeZcwMzJK+Gtj8PipaAI/jhpNFVA+R ZE1wtVL/e+mmCV8O2QLl5RaMuqcgLPbtVu7AypWUw3DAG5hmFxwR5sHqf+GY2RooAVDtYyqmd59 SAwP+GD6XE3GfnGHf6swdrWq60Zex8frsgd5XlzH5+INjvj0/LxkrwAGBAAsuHZ2d1Dht4EGUrp veg0i5YyLPJ3uEyiRtHM= X-Google-Smtp-Source: AGHT+IGDaEoGkJ2Kkdd4CcQFgeCFfgVI+u70H9xdbs2LqYNB70EAO5hwTCA7LzgK9IfblrfKUwkBbw== X-Received: by 2002:a05:6000:4284:b0:3a4:f510:fa77 with SMTP id ffacd0b85a97d-3a531cb7e8cmr11188121f8f.29.1749509811605; Mon, 09 Jun 2025 15:56:51 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:3c26:913e:81d:9d46]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a5324364c9sm10824574f8f.51.2025.06.09.15.56.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jun 2025 15:56:50 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Biju Das , Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , dri-devel@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v7 5/9] drm: renesas: rz-du: mipi_dsi: Make "rst" reset control optional for RZ/V2H(P) Date: Mon, 9 Jun 2025 23:56:26 +0100 Message-ID: <20250609225630.502888-6-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar In preparation for adding support for the Renesas RZ/V2H(P) SoC, make the "rst" reset control optional in the MIPI DSI driver. The RZ/V2H(P) SoC does not provide this reset line, and attempting to acquire it using the mandatory API causes probe failure. Switching to devm_reset_control_get_optional_exclusive() ensures compatibility with both SoCs that provide this reset line and those that do not, such as RZ/V2H(P). Co-developed-by: Fabrizio Castro Signed-off-by: Fabrizio Castro Signed-off-by: Lad Prabhakar Reviewed-by: Biju Das Reviewed-by: Laurent Pinchart --- v6->v7: - No changes v5->v6: - Added reviewed tag from Biju and Laurent v4->v5: - New patch --- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/d= rm/renesas/rz-du/rzg2l_mipi_dsi.c index 85074e0c3cc4..d4f2867e0c5f 100644 --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c @@ -937,7 +937,7 @@ static int rzg2l_mipi_dsi_probe(struct platform_device = *pdev) if (IS_ERR(dsi->vclk)) return PTR_ERR(dsi->vclk); =20 - dsi->rstc =3D devm_reset_control_get_exclusive(dsi->dev, "rst"); + dsi->rstc =3D devm_reset_control_get_optional_exclusive(dsi->dev, "rst"); if (IS_ERR(dsi->rstc)) return dev_err_probe(dsi->dev, PTR_ERR(dsi->rstc), "failed to get rst\n"); --=20 2.49.0 From nobody Mon Feb 9 15:06:11 2026 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 3015122A1E4; Mon, 9 Jun 2025 22:56:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509816; cv=none; b=bl9FiOO7ldfOeEHTcUbTnayR2urL+8eKrUMTQlNVvN9a1UtiVSkfcLtfMiCYJis7cFPRMSIRbfCWCAn5XYQBysl4+C10qtW0NJH6xr/7yQiHhDYrJTq0t06goRLaPiKxy+jQgQuE1Q91wwAR3ibM+b6uPStvRQyYvWrYDa/6X/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509816; c=relaxed/simple; bh=Eonq2gN9R8OJxw0vm5AHwbVPcn0KxkzsHZTGTFoYaMs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GzC7XEF6M9dati578WpSqpDecn+n7I4kwsVm142JKi+XpUd4BqA1vWAkFs2qT2pSTpDxJF+qunyyBiwBeHOhKJ04IkJHg7sDshM9hTShL3lkwefEDhvtWFi7BybuCE9m6k7QIGSCjpbNzoiu+TxfY73fooX4+1GaOLwHkeLK8qo= 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=cvv9IGD4; arc=none smtp.client-ip=209.85.221.45 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cvv9IGD4" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-3a5123c1533so2685763f8f.2; Mon, 09 Jun 2025 15:56:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749509812; x=1750114612; 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=0JPP9VkVYCYtwZNTr/n+Ytie5XMaieXyfIeFmS7/fH8=; b=cvv9IGD4R3crJ+qxQ8uRr8ipby+2npndLqGLqDlvyPhym/soa6lhmF9AcsrO/aT+8p XH+URnyr77t4MxxtM6wGLzUcDUokQ/5SHp63Nr/8mgQt5mnBsEAVGEOwrSwJp85tiaPQ +onjHVJ7GlBYDiYGBi/BGOnlVu4WBzzsnElsyUwWoGODB1gS8fqpGEBFxHeKgpGyOW5D SaOmhKPeCCuFxlmE2K90YSqvS/9GecGOUNgUdKWaAmD4JCCaVREhCKjO1lNdpQWE8NDJ TpaYb95JGujfijoggPfNMSHdyy3kGxSnDHHGAKbqp8iqYTCxUpmGG9RelI17tw7h7uBX z5LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749509812; x=1750114612; 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=0JPP9VkVYCYtwZNTr/n+Ytie5XMaieXyfIeFmS7/fH8=; b=lwsVkhnkQvVUPlUXqLvwneNtDY4XzGQREVgtQGlAqYIe/nRQqmKv/vbZcgg1DeMIe4 dxjKdz7ukUgE5nT/UKe8zu7j08CMfyUWz1qvgf8BQbciYiy1zB1RfKhCB398jf+mPv+E 2SI6BoNmhDughLNwh/wuL6oGCXKAAiXghMEBrvMlMrOL2XOV3BCH7OrGKT4ag/QMjU5V 6n6zKFmLMowyPJAYuQECue8MJEYnhXjOVcNKNPSJcDfH2Zi85MRGhqH1XiuO1xReeyWa QMwvA0gIUWfjxDX8qWGEPkKyxY+z1l3k2I7QF0ooeVV/WKSXxConoxmYQ0Ie7c6s6lPB KbiA== X-Forwarded-Encrypted: i=1; AJvYcCUuJGVdfx4nB9a6+4lCXm1XkLE5TUDdvP02V9syVdwMnKGy7+bItPrFMaFEHPyat1K/o2HUZ5k+Yp6jLuU=@vger.kernel.org X-Gm-Message-State: AOJu0YwBcZF0EdPRI+KmFRWJMsqU+aaHeJLpIDZoOcq5g8wkxqug7utM EULaN4wouZUWI45Rw84k70NAJEZW+gjR4QI3O9d0397MC9IxHM79eCLa X-Gm-Gg: ASbGncvMBWcuYss2du4Qw3CyKPhFXna+ZOV9gy/CDq/dmsqIpzb11xo5iRDAhvASqfp MqsJPE4fd7v5Feug0cuUBlZQI0URLs/VpcMt0T4avIzHpSer3a9meHrRUVX9Ns6JImbu9qk1IKl tETdUBf/ynhse/GVowOTp8lLkb7vuWLe/gmot9zfhxQQKk21CRKjViJ4i+ytBm40qJ46VKRqKbK Gix5sOiGNyxz8WkHjccz0p3PKZgJ+b8xN0B1kkL+VHRIsuFFECn6PIDj1tv7/1J73Rs2xU1JIO+ 3FtqBH5cfO9h0x4R4bPURzt9oX4G7mgXNTAlVBMWH8+jvrq3MqWdUpYLpZgnN+zwXUn3gLLCPXg M4jzl1IAnp/rxL8GYyyI= X-Google-Smtp-Source: AGHT+IEApn/uKPfPAE0Z6mSCiUxgpurDdVsA+B6RTSy30d4Q/p30De7VgoNSDWLlynetn4i/Wk2EXQ== X-Received: by 2002:a05:6000:2384:b0:3a4:f2aa:2e32 with SMTP id ffacd0b85a97d-3a531ce191emr10590244f8f.44.1749509812413; Mon, 09 Jun 2025 15:56:52 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:3c26:913e:81d:9d46]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a5324364c9sm10824574f8f.51.2025.06.09.15.56.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jun 2025 15:56:51 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Biju Das , Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , dri-devel@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v7 6/9] drm: renesas: rz-du: mipi_dsi: Use mHz for D-PHY frequency calculations Date: Mon, 9 Jun 2025 23:56:27 +0100 Message-ID: <20250609225630.502888-7-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Pass the HSFREQ in milli-Hz to the `dphy_init()` callback to improve precision, especially for the RZ/V2H(P) SoC, where PLL dividers require high accuracy. These changes prepare the driver for upcoming RZ/V2H(P) SoC support. Co-developed-by: Fabrizio Castro Signed-off-by: Fabrizio Castro Signed-off-by: Lad Prabhakar Reviewed-by: Biju Das --- v6->v7: - No changes v5->v6: - No changes v4->v5: - Added Reviewed tag from Biju v3->v4: - Used MILLI instead of KILO - Made use of mul_u32_u32() for multiplication v2->v3: - Replaced `unsigned long long` with `u64` - Replaced *_mhz with *_millihz` in functions v1->v2: - No changes --- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/d= rm/renesas/rz-du/rzg2l_mipi_dsi.c index d4f2867e0c5f..004911240cef 100644 --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c @@ -37,7 +37,7 @@ struct rzg2l_mipi_dsi; =20 struct rzg2l_mipi_dsi_hw_info { - int (*dphy_init)(struct rzg2l_mipi_dsi *dsi, unsigned long hsfreq); + int (*dphy_init)(struct rzg2l_mipi_dsi *dsi, u64 hsfreq_millihz); void (*dphy_exit)(struct rzg2l_mipi_dsi *dsi); u32 phy_reg_offset; u32 link_reg_offset; @@ -210,8 +210,9 @@ static u32 rzg2l_mipi_dsi_link_read(struct rzg2l_mipi_d= si *dsi, u32 reg) */ =20 static int rzg2l_mipi_dsi_dphy_init(struct rzg2l_mipi_dsi *dsi, - unsigned long hsfreq) + u64 hsfreq_millihz) { + unsigned long hsfreq =3D DIV_ROUND_CLOSEST_ULL(hsfreq_millihz, MILLI); const struct rzg2l_mipi_dsi_timings *dphy_timings; unsigned int i; u32 dphyctrl0; @@ -284,6 +285,7 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi= *dsi, const struct drm_display_mode *mode) { unsigned long hsfreq, vclk_rate; + u64 hsfreq_millihz; unsigned int bpp; u32 txsetr; u32 clstptsetr; @@ -316,9 +318,9 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi= *dsi, * hsclk(bit) =3D hsclk(byte) * 8 =3D hsfreq */ bpp =3D mipi_dsi_pixel_format_to_bpp(dsi->format); - hsfreq =3D DIV_ROUND_CLOSEST_ULL(vclk_rate * bpp, dsi->lanes); + hsfreq_millihz =3D DIV_ROUND_CLOSEST_ULL(mul_u32_u32(vclk_rate, bpp * MIL= LI), dsi->lanes); =20 - ret =3D dsi->info->dphy_init(dsi, hsfreq); + ret =3D dsi->info->dphy_init(dsi, hsfreq_millihz); if (ret < 0) goto err_phy; =20 @@ -326,6 +328,7 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi= *dsi, txsetr =3D TXSETR_DLEN | TXSETR_NUMLANEUSE(dsi->lanes - 1) | TXSETR_CLEN; rzg2l_mipi_dsi_link_write(dsi, TXSETR, txsetr); =20 + hsfreq =3D DIV_ROUND_CLOSEST_ULL(hsfreq_millihz, MILLI); /* * Global timings characteristic depends on high speed Clock Frequency * Currently MIPI DSI-IF just supports maximum FHD@60 with: @@ -965,7 +968,7 @@ static int rzg2l_mipi_dsi_probe(struct platform_device = *pdev) * mode->clock and format are not available. So initialize DPHY with * timing parameters for 80Mbps. */ - ret =3D dsi->info->dphy_init(dsi, 80000000); + ret =3D dsi->info->dphy_init(dsi, 80000000ULL * MILLI); if (ret < 0) goto err_phy; =20 --=20 2.49.0 From nobody Mon Feb 9 15:06:11 2026 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 2645E22AE68; Mon, 9 Jun 2025 22:56:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509816; cv=none; b=cu2dTZcCKlhGVhjW5pW2zuy+FxOy0DWPNColxiLlD2qC5CMsaab723k1mHFx9SxsXHSba9aBq702JVuav6DRg1ehYpEOoH8zZpMaYArm4uFIAup+KoL0MAPiAFwqOybq2pM2g3qDd948yKUAgVBKJLuLLwpA0I8m49CgKreiX6w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509816; c=relaxed/simple; bh=pgu0m9z5JmutWmpTOlIUe5W7ajHeEF9fAzvHVtrmpRI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DV/N7lsxmx1xQEZjzzqoFsb4H+UtOutPTE44/mTYeEdUCAQPuQIzGm8yp29hG9MTSr1Ix7N4OsPrhrZJduxoIvtZEEyL18xT0lXSNp9XzsivsRqlR2m+K/nC4j/seSSt5N5b49MtxX2vZB2UI85J3G9PbMkhRskdmVLcPIdJj5c= 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=jqSrgc8e; arc=none smtp.client-ip=209.85.221.44 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jqSrgc8e" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3a35c894313so4331273f8f.2; Mon, 09 Jun 2025 15:56:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749509813; x=1750114613; 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=b9sNPDbvHJtRK/qnSfFYq3EhOhxCEQnSTNwZ9t7XS7g=; b=jqSrgc8eQ7pFtNIWhFNiZ6CcozU/zaRm13Z/0eR4fyeQ6qzQqMO9V+VgDQYVMLyGv3 6LQJzcYalwEGlyGtfn3siGKhuLhETXCEqJQikRjGdIS1hBan8ItVwW23HqCyuNrWZQEt jEIL5076MpbG3n//OCYQ5FuDqkLoom7zGUY8aQqZ8nCUwpEMjPZLXbVT19GGNmcu89wh JzOT72Shkoxs/CIyzv2FevDiSPrP4yKyeS/rDUdDzOi/n3HHsU3O2pcPIIUVYtkkOYmP 1n8BdQAns8z285U6U9nGZTHdW3mNTi8eT9Lg8sRIl0vDIRAYtmuxWCHfd0qzsWU0mJRz HsFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749509813; x=1750114613; 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=b9sNPDbvHJtRK/qnSfFYq3EhOhxCEQnSTNwZ9t7XS7g=; b=llyvvN9NLazI6kI+DD9MUxVF6UgUYcdXxlxezA3ky7tAqnYgd27+cah59FXySpSwc8 qXvr1OQgPkijkSNXqfBt11AaUex9a29C0Zyt1WML1t4OC4bbV7hJg9Tkdf72mTy0zdq/ MaD0OCyMdWk+Xacghgm/7AlowaIHF0tSh58r037/JWko9fG2SQRGtvtV6xjczwiejTqk nMZInfRG8V2FTfnev4BCqTDfJpg2RwnAQdYZc4Ythoi4oul0+CTMnEfqJNLR/RXA/TuI dxRd4aWIE/KJS680vYAJzblOUq/3+w+AondGTWv3hzwfKeIq/HnAaw4/imrIu3m2L4WR A/2w== X-Forwarded-Encrypted: i=1; AJvYcCW1pGO4EjPHy1PXcCzaeEspDcUckUOYbavmYLew1LnP85U30BY6EIlnWcEUvdo96iY5Bpx4hGWqUTbuNPc=@vger.kernel.org X-Gm-Message-State: AOJu0YyUZVsgVKSHVvjwtmlNiHXoObPDJLhbhaq12dvgXlkTxh8X74HQ RYSYyjzS+9F9ccMP0b7osPL9xjbKbB369LSZQ2l4Ntp5C6t86AvcYHy7 X-Gm-Gg: ASbGncvpwQ+Y365UPfEFOO9SikwevXcZr0KPEndA302hCZ/KQtCJQsqGjy0p503v23L gZBM3SH3HZQemga23+d7fDSt1dQVdL3hX+hLLdvApiOG0e7mXauFqI5ahzX3+JQtOQsYOO7vnoo 8nI2N/ZJV5D9Jcubz8W0CQ4/vPRbobmYz84p3NWZ0UwDBplzq5XF+bT8CxL9Xpr6Tv/J2Q4GTfM Em1MdX2nn5voaEGkcSOz7Lwhye6lcM7/7+JKqcySxY+W9bIxF3CEFSMGHn53Enn43ep1xcmA/4m Snn4P82S7OwmpSaqJAoyM9c4H5dHMhT8O+zcN2k/8hODgQUhlgvhoHNiZFAFHKOwJ/BBqS86BAL LXN/Kea9riMTsIWKaN/A= X-Google-Smtp-Source: AGHT+IEizz7C/hBJTgzy36g5sjG+Z7oBuPSSAy3tfoHcrQ0Z3A14k8MfwRyhBwae678JZOqvfLUNxQ== X-Received: by 2002:a05:6000:2503:b0:3a4:ec23:dba5 with SMTP id ffacd0b85a97d-3a5319b17c0mr12730358f8f.5.1749509813415; Mon, 09 Jun 2025 15:56:53 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:3c26:913e:81d:9d46]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a5324364c9sm10824574f8f.51.2025.06.09.15.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jun 2025 15:56:52 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Biju Das , Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , dri-devel@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v7 7/9] drm: renesas: rz-du: mipi_dsi: Add feature flag for 16BPP support Date: Mon, 9 Jun 2025 23:56:28 +0100 Message-ID: <20250609225630.502888-8-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Introduce the `RZ_MIPI_DSI_FEATURE_16BPP` flag in `rzg2l_mipi_dsi_hw_info` to indicate support for 16BPP pixel formats. The RZ/V2H(P) SoC supports 16BPP, whereas this feature is missing on the RZ/G2L SoC. Update the `mipi_dsi_host_attach()` function to check this flag before allowing 16BPP formats. If the SoC does not support 16BPP, return an error to prevent incorrect format selection. This change enables finer-grained format support control for different SoC variants. Co-developed-by: Fabrizio Castro Signed-off-by: Fabrizio Castro Signed-off-by: Lad Prabhakar Reviewed-by: Biju Das Reviewed-by: Laurent Pinchart --- v6->v7: - No changes v5->v6: - Added Reviewed-by tag from Laurent v4->v5: - Updated RZ_MIPI_DSI_FEATURE_16BPP macro to use BIT(0) - Added Reviewed tag from Biju v3->v4: - No changes v2->v3: - No changes v1->v2: - Renamed RZ_MIPI_DSI_FEATURE_16BPP --- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/d= rm/renesas/rz-du/rzg2l_mipi_dsi.c index 004911240cef..afb427e678bd 100644 --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c @@ -34,6 +34,8 @@ =20 #define RZG2L_DCS_BUF_SIZE 128 /* Maximum DCS buffer size in external memo= ry. */ =20 +#define RZ_MIPI_DSI_FEATURE_16BPP BIT(0) + struct rzg2l_mipi_dsi; =20 struct rzg2l_mipi_dsi_hw_info { @@ -43,6 +45,7 @@ struct rzg2l_mipi_dsi_hw_info { u32 link_reg_offset; unsigned long min_dclk; unsigned long max_dclk; + u8 features; }; =20 struct rzg2l_mipi_dsi { @@ -672,8 +675,16 @@ static int rzg2l_mipi_dsi_host_attach(struct mipi_dsi_= host *host, =20 switch (mipi_dsi_pixel_format_to_bpp(device->format)) { case 24: + break; case 18: break; + case 16: + if (!(dsi->info->features & RZ_MIPI_DSI_FEATURE_16BPP)) { + dev_err(dsi->dev, "Unsupported format 0x%04x\n", + device->format); + return -EINVAL; + } + break; default: dev_err(dsi->dev, "Unsupported format 0x%04x\n", device->format); return -EINVAL; --=20 2.49.0 From nobody Mon Feb 9 15:06:11 2026 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 A740422B8A8; Mon, 9 Jun 2025 22:56:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509818; cv=none; b=Xvz0UgLOaAY/uLqHDkfwQUTYAz5xGNhC7KB1v+c+iZk4IpKjs1y5NQgQKA2mrO9mI+2yERe0YME+oH1kerfPqcjKzzVATb8x0g+J61OVJhgoMhUntjskbiS6+vaiun+lF7KgwtqGZaCuVUOUcyQG0R8LHnVnFfcvKBLHN0QdfOs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509818; c=relaxed/simple; bh=d/302PcyxZnD9AJi+vTzf9twWAbD/8oen19otpWBG8Q=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A7d2BYuOLgIfpsql5F4HcArDZiQtl2+i2jVW94b0rQ5WDWgxf7FLr73UjZEZlDuZaPuMZdnKft+vzM/T4lCc6WB18smtoWBYuzdQoqm4rf4kVpKmCrofWxAAEvjdS/k8EX8rE4Ekb4TUFtzejociy2OR8LEzl2MKBaOFe/mQVnw= 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=Ywb7Dwco; arc=none smtp.client-ip=209.85.128.45 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ywb7Dwco" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-441ab63a415so50007875e9.3; Mon, 09 Jun 2025 15:56:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749509815; x=1750114615; 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=+mJ04kIY50S4a/oCwlKLWoQlfyGZTGJpeZDyun/CaLg=; b=Ywb7Dwcokh+hjGRCSo8gkc9DSR8LlkWkDTuTGFOHYMX+4cc+6vtzrUYbsnog6nW0xc ejB4B4lu/p+zykci0I482EnuUVDcKIpgy9wL17E0i84pF1DgTnNsSG+nSvAtCAKd/PCv 3BWV5fqcFXz6Y569h930xe4QF6x5kwYy3Kgvnoz0lP9CA7EtltmibAL7Kc3ZrinvCZMV 6ZSRy/QWs/LbRgLXIRVHcDlgTg+M1Rro6iC1DZ32S9aIW7L9bOgo2EwzQDYdN5VEExrd x4DOsqaLeZJzM1/DFN2aQalUnB0iuBiXyahqVa2gktkNMDq/xPRA6cWjKqdUvsgaJTHg vQbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749509815; x=1750114615; 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=+mJ04kIY50S4a/oCwlKLWoQlfyGZTGJpeZDyun/CaLg=; b=w9/SWmN/JTSOizD4528m+WkeNU58lsPDcXHj7vGYd9u1J/+AFMEdEmpiwbIhpUMM4t L21Md/s1a5oDyG/SPt3yUzwK2G7HvcAq1LJx3W0+0HfwV/u7veXZZ3fKiB/e3Q8gpB45 yrhu/IYowTmFMeRzVo9JbjfYBzJR9943kc7FtE0Ls5dmdw8d7Y9Dt1Hv88xf9W8/dglP l3l7+EJwOMfm9oHkn8Apfzyd4p+JYpqkHlcrzalMpqBJDNdFU0JYxqO5MXMA8Ja9ntfH Yrxty4sPF3BKI+/qCsNKKU7Pz7iNwrUUNWtRSrNx60xySgU2KfNAIJ0+S3kQjdZZALRe xPhA== X-Forwarded-Encrypted: i=1; AJvYcCVNB9cAnHQ9ml/0TdKKa/vBgbGRMxQJunX2FbP4SVilLLum1InNtZnNyO45Sqg60j51Vvf/MoIdEJTh050=@vger.kernel.org X-Gm-Message-State: AOJu0Yzdb6qJbhcn6y3gSZWrUKB6q8in/LlKfYXPlzf+DFSEn1VVpkHh NiMyuVUVykLDgLdci5J7CiduQ6z9MsUeqnviln+2tYnU83J7iht526R9 X-Gm-Gg: ASbGnct5MiF+J3mm7UAarfPxDHXHc0/r7se8/jse3h6Yotm1+JsctIuzpyMWshqobP9 iYMFx/BVUhauPHaWEaXVoVPWnOWVp/RweP0XYMM2OJrcYP/OSR9ku06roaNpLIekYfVu1J5lvIF oeKcTU8+DTRNb44In28ttOQb7O8+Ud6tsk6LG0Ygvcu8u/pITfOb5k3VHsIfyijzvz4gzZYlIAY Un7vGRTdgZRAYGrNkDMFQDybefpJV+h/oidK7vmRAMsAtMuDYCoLHNr2hB/OTNir0v8Z9fHF4Ql 47O2E2Y+X0lJ/Ht1pV//rmbti4yGBqe2l6KScrnXr+o2E0cPGOYR/Ekn5nwL9UIiAnFVqDsp5pI muZtnEiDqB1QxC2UAiL8= X-Google-Smtp-Source: AGHT+IGWs2mxydO6AyZh32szGvoE+Z5bEw/CSpjmczATv545WPvvStrl0U5S/ZYeJpRamOQYcH101w== X-Received: by 2002:a05:6000:188d:b0:3a5:2fae:1348 with SMTP id ffacd0b85a97d-3a5522ddb60mr288540f8f.51.1749509814907; Mon, 09 Jun 2025 15:56:54 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:3c26:913e:81d:9d46]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a5324364c9sm10824574f8f.51.2025.06.09.15.56.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jun 2025 15:56:53 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Biju Das , Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , dri-devel@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v7 8/9] drm: renesas: rz-du: mipi_dsi: Add dphy_late_init() callback for RZ/V2H(P) Date: Mon, 9 Jun 2025 23:56:29 +0100 Message-ID: <20250609225630.502888-9-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Introduce the `dphy_late_init` callback in `rzg2l_mipi_dsi_hw_info` to allow additional D-PHY register configurations after enabling data and clock lanes. This is required for the RZ/V2H(P) SoC but not for the RZ/G2L SoC. Modify `rzg2l_mipi_dsi_startup()` to invoke `dphy_late_init` if defined, ensuring SoC-specific initialization is performed only when necessary. This change prepares for RZ/V2H(P) SoC support while maintaining compatibility with existing platforms. Co-developed-by: Fabrizio Castro Signed-off-by: Fabrizio Castro Signed-off-by: Lad Prabhakar Reviewed-by: Biju Das Reviewed-by: Laurent Pinchart --- v6->v7: - No changes v5->v6: - Renamed dphy_late_init to dphy_startup_late_init - Added Reviewed-by tag from Laurent v4->v5: - Added Reviewed tag from Biju v3->v4: - No changes v2->v3: - No changes v1->v2: - No changes --- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/d= rm/renesas/rz-du/rzg2l_mipi_dsi.c index afb427e678bd..12cb9f0d32fa 100644 --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c @@ -40,6 +40,7 @@ struct rzg2l_mipi_dsi; =20 struct rzg2l_mipi_dsi_hw_info { int (*dphy_init)(struct rzg2l_mipi_dsi *dsi, u64 hsfreq_millihz); + void (*dphy_startup_late_init)(struct rzg2l_mipi_dsi *dsi); void (*dphy_exit)(struct rzg2l_mipi_dsi *dsi); u32 phy_reg_offset; u32 link_reg_offset; @@ -331,6 +332,9 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi= *dsi, txsetr =3D TXSETR_DLEN | TXSETR_NUMLANEUSE(dsi->lanes - 1) | TXSETR_CLEN; rzg2l_mipi_dsi_link_write(dsi, TXSETR, txsetr); =20 + if (dsi->info->dphy_startup_late_init) + dsi->info->dphy_startup_late_init(dsi); + hsfreq =3D DIV_ROUND_CLOSEST_ULL(hsfreq_millihz, MILLI); /* * Global timings characteristic depends on high speed Clock Frequency --=20 2.49.0 From nobody Mon Feb 9 15:06:11 2026 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 AFD5022C328; Mon, 9 Jun 2025 22:56:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509819; cv=none; b=qXKpV1ZH99q5u/FuyVzaLWauQ22OJwolxojah1yoPs7UAfmf4bhvsgWnuN13+rnXggATKnvip8AkWVtgE5o3ghMsmtFDRd2rVN94GSi5pwMuEzPNKZ8oM7TDnGw3+asyT8XPCVixQB1l7hW/sf8okV1ubqpBm59WeCpBxqP23M0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1749509819; c=relaxed/simple; bh=90mcKsEc13ARM+TATz015xzi0znQ6LlKWLc/wc0NAR8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oX3UvQbVOWqe6QOR33ygph5r3mQ0i4POwkB/VxFm6QG/Ndz+nq4fFaBd+difPkCu/NcPI20II3IJMfJH/TYTC4vTUQNuBWxrHumh9jhLiHus7h3GwMdjbkRywPFgwRLrBnaBsQeZS2XPOeqwHrdyQDOhuFGUpLFPdqnjtw++tek= 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=FetFs1ug; arc=none smtp.client-ip=209.85.221.48 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FetFs1ug" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3a507e88b0aso4405529f8f.1; Mon, 09 Jun 2025 15:56:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749509816; x=1750114616; 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=iLTgFVeKSKKYj2W9StIrIT0x8Hh4XC2mzSOEWa4V88M=; b=FetFs1ugEE77Lq3zxKmTPQyELXcry2XJHE+bDuNZy5hRnX6ue8Iu/MdoEoTWbRIWS7 vWT94iufHuWVvt8wov8I53qPI7A9EkaYLpFrs1dgyOziERJYHDibfseAPXiqV7QRM7nY 6oJwkVN+VFZiTAkb75UBMgXUTAxb7oSGl9Xz4mWHAp3mfntCAsKHocVLi/TRQRtvA7yp oXLiyoA5x3pRgy4LXJl43qfQQRh7CmORbfojxtJMZHIeZ/UpX2MjGNCqRe2VvhS7YNqs U0NV1FelsDBkTeEfqF6G30hmklFjApU6GXdRlWbkSBI/6RQ7H0U/3ZuiJodMDXGP2jVQ JgYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749509816; x=1750114616; 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=iLTgFVeKSKKYj2W9StIrIT0x8Hh4XC2mzSOEWa4V88M=; b=fz8nNmw8ZpO4g6SGowS/B8kgBmwu+bCm13CTXyb16gbIBWNOc0VILsx/8obO+UClGs 6jU9g7z99IJFxjwqY11Ah9XtxH+zvcVq7zjWIKiBGmSDt1QjKQvmCgwUcpyOH9/hhi/u 6KcxksZc+ooa2YEdX+MkEOQk4+gVkIsxgQJGn6oOFGxx8UHrvQuprzgtLMBzHrbv4FWQ vFJz3czacWAvZBzDK5wGHmxRxKm29nRv7n3hUDoeX0D4jH7LV4MEdnE3xytu1Lvw5Yi6 eVCgjF+JJSISywgbauXeNJVv5sh6UNx9NqRFTQkm7Q9ryNWG8h0UiXk9YyDLq4ZdJyBH BVZQ== X-Forwarded-Encrypted: i=1; AJvYcCUtz0XLTYSQjOz/pQULyzdXcX0spBaJ5H6U2B9Zit4jao+mKfZQj85vy19Iz8SMQJHeT2EvxyKc8UBREio=@vger.kernel.org X-Gm-Message-State: AOJu0YwSHSC9E4yFq64FXlduxz6oZTjhkC4umKS3O6tgMTg7nBLHRjnV z0nTn4bK/bnQhXmx8WJM3SfuI8gAAcPNuEfsKn/pVNkTWotZEcbRCWK0 X-Gm-Gg: ASbGncs8nA4Wql0FAqe5byGT0ceJhjNTyzjJt71odq9eEE4iXavNOQd6qI31nj6rQD0 9+7RrZDs/HQ/pjq3MoTtJw9UrgUeU7Yva2Q3pcQSJa7Cj/zQxtglNhp5BB/q9DnFg8SwdG0vnsZ MbgWsVudpddRiJCg+zEUoHMPOPFccJxI2delh2Xa/L/i9ceZ5nnqBiweRHUTXodjyYWksTtpBy8 d1MZzPJHcXd6YU3UXv1g7o5EyTd148OMEmcrtzpkDbQl5saQVrZv0am7yUqx/yk3ednbsLlIOrL r75tra53Y5/SNcZk+OarIKtV4/qjt5cJtmdKFPTKb0LMVSbpbA9qDxGSCjTHpwvhf6rxaqGIqUB jMLHF3nuwkofbhsApUew= X-Google-Smtp-Source: AGHT+IEbIMXZBlNewl8PpIEnooYc/04QMVIdOYpD6gByQL5Fbokk3IdUCKrqFmIgDkF3Q/PdDMNQjQ== X-Received: by 2002:a05:6000:4023:b0:3a0:9dfc:da4 with SMTP id ffacd0b85a97d-3a531ab6dd4mr9762174f8f.42.1749509815998; Mon, 09 Jun 2025 15:56:55 -0700 (PDT) Received: from iku.example.org ([2a06:5906:61b:2d00:3c26:913e:81d:9d46]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a5324364c9sm10824574f8f.51.2025.06.09.15.56.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Jun 2025 15:56:55 -0700 (PDT) From: Prabhakar X-Google-Original-From: Prabhakar To: Biju Das , Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Philipp Zabel , Geert Uytterhoeven , Magnus Damm , dri-devel@lists.freedesktop.org Cc: linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Prabhakar , Fabrizio Castro , Lad Prabhakar Subject: [PATCH v7 9/9] drm: renesas: rz-du: mipi_dsi: Add function pointers for configuring VCLK and mode validation Date: Mon, 9 Jun 2025 23:56:30 +0100 Message-ID: <20250609225630.502888-10-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <20250609225630.502888-1-prabhakar.mahadev-lad.rj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Lad Prabhakar Introduce `dphy_conf_clks` and `dphy_mode_clk_check` callbacks in `rzg2l_mipi_dsi_hw_info` to configure the VCLK and validate supported display modes. On the RZ/V2H(P) SoC, the DSI PLL dividers need to be as accurate as possible. To ensure compatibility with both RZ/G2L and RZ/V2H(P) SoCs, function pointers are introduced. Modify `rzg2l_mipi_dsi_startup()` to use `dphy_conf_clks` for clock configuration and `rzg2l_mipi_dsi_bridge_mode_valid()` to invoke `dphy_mode_clk_check` for mode validation. This change ensures proper operation across different SoC variants by allowing fine-grained control over clock configuration and mode validation. Co-developed-by: Fabrizio Castro Signed-off-by: Fabrizio Castro Signed-off-by: Lad Prabhakar Reviewed-by: Biju Das --- v6->v7: - No changes v5->v6: - No changes v4->v5: - Added Reviewed tag from Biju v3->v4: - Replaced KILO with MILLI v2->v3: - Replaced unsigned long long with u64 v1->v2: - No changes --- .../gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 65 +++++++++++++------ 1 file changed, 45 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c b/drivers/gpu/d= rm/renesas/rz-du/rzg2l_mipi_dsi.c index 12cb9f0d32fa..f87337c3cbb5 100644 --- a/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +++ b/drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c @@ -42,6 +42,10 @@ struct rzg2l_mipi_dsi_hw_info { int (*dphy_init)(struct rzg2l_mipi_dsi *dsi, u64 hsfreq_millihz); void (*dphy_startup_late_init)(struct rzg2l_mipi_dsi *dsi); void (*dphy_exit)(struct rzg2l_mipi_dsi *dsi); + int (*dphy_conf_clks)(struct rzg2l_mipi_dsi *dsi, unsigned long mode_freq, + u64 *hsfreq_millihz); + unsigned int (*dphy_mode_clk_check)(struct rzg2l_mipi_dsi *dsi, + unsigned long mode_freq); u32 phy_reg_offset; u32 link_reg_offset; unsigned long min_dclk; @@ -285,12 +289,39 @@ static void rzg2l_mipi_dsi_dphy_exit(struct rzg2l_mip= i_dsi *dsi) reset_control_assert(dsi->rstc); } =20 +static int rzg2l_dphy_conf_clks(struct rzg2l_mipi_dsi *dsi, unsigned long = mode_freq, + u64 *hsfreq_millihz) +{ + unsigned long vclk_rate; + unsigned int bpp; + + clk_set_rate(dsi->vclk, mode_freq * KILO); + vclk_rate =3D clk_get_rate(dsi->vclk); + if (vclk_rate !=3D mode_freq * KILO) + dev_dbg(dsi->dev, "Requested vclk rate %lu, actual %lu mismatch\n", + mode_freq * KILO, vclk_rate); + /* + * Relationship between hsclk and vclk must follow + * vclk * bpp =3D hsclk * 8 * lanes + * where vclk: video clock (Hz) + * bpp: video pixel bit depth + * hsclk: DSI HS Byte clock frequency (Hz) + * lanes: number of data lanes + * + * hsclk(bit) =3D hsclk(byte) * 8 =3D hsfreq + */ + bpp =3D mipi_dsi_pixel_format_to_bpp(dsi->format); + *hsfreq_millihz =3D DIV_ROUND_CLOSEST_ULL(mul_u32_u32(vclk_rate, bpp * MI= LLI), + dsi->lanes); + + return 0; +} + static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi, const struct drm_display_mode *mode) { - unsigned long hsfreq, vclk_rate; + unsigned long hsfreq; u64 hsfreq_millihz; - unsigned int bpp; u32 txsetr; u32 clstptsetr; u32 lptrnstsetr; @@ -305,24 +336,9 @@ static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_ds= i *dsi, if (ret < 0) return ret; =20 - clk_set_rate(dsi->vclk, mode->clock * KILO); - vclk_rate =3D clk_get_rate(dsi->vclk); - if (vclk_rate !=3D mode->clock * KILO) - dev_dbg(dsi->dev, "Requested vclk rate %lu, actual %lu mismatch\n", - mode->clock * KILO, vclk_rate); - - /* - * Relationship between hsclk and vclk must follow - * vclk * bpp =3D hsclk * 8 * lanes - * where vclk: video clock (Hz) - * bpp: video pixel bit depth - * hsclk: DSI HS Byte clock frequency (Hz) - * lanes: number of data lanes - * - * hsclk(bit) =3D hsclk(byte) * 8 =3D hsfreq - */ - bpp =3D mipi_dsi_pixel_format_to_bpp(dsi->format); - hsfreq_millihz =3D DIV_ROUND_CLOSEST_ULL(mul_u32_u32(vclk_rate, bpp * MIL= LI), dsi->lanes); + ret =3D dsi->info->dphy_conf_clks(dsi, mode->clock, &hsfreq_millihz); + if (ret < 0) + goto err_phy; =20 ret =3D dsi->info->dphy_init(dsi, hsfreq_millihz); if (ret < 0) @@ -646,6 +662,14 @@ rzg2l_mipi_dsi_bridge_mode_valid(struct drm_bridge *br= idge, if (mode->clock < dsi->info->min_dclk) return MODE_CLOCK_LOW; =20 + if (dsi->info->dphy_mode_clk_check) { + enum drm_mode_status status; + + status =3D dsi->info->dphy_mode_clk_check(dsi, mode->clock); + if (status !=3D MODE_OK) + return status; + } + return MODE_OK; } =20 @@ -1030,6 +1054,7 @@ static void rzg2l_mipi_dsi_remove(struct platform_dev= ice *pdev) static const struct rzg2l_mipi_dsi_hw_info rzg2l_mipi_dsi_info =3D { .dphy_init =3D rzg2l_mipi_dsi_dphy_init, .dphy_exit =3D rzg2l_mipi_dsi_dphy_exit, + .dphy_conf_clks =3D rzg2l_dphy_conf_clks, .link_reg_offset =3D 0x10000, .min_dclk =3D 5803, .max_dclk =3D 148500, --=20 2.49.0