Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2624046rdb; Mon, 12 Feb 2024 10:36:18 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVv3PuZoZlHH5F4uR01431hy3ZgUnx7ZMBpRKXAvxx3PLWfDZOM/SvWeXc18EpinRpaAXfWwSR2squ8LyYxM5u6Dqfyt/ceCnTI50t8tQ== X-Google-Smtp-Source: AGHT+IFtL5HG8u1SOFvEtR6KkG881RASrffR6tiUtZlftPOneND5oRpVA7ATfOy1hY1dUJq8NwNW X-Received: by 2002:a92:c7d2:0:b0:363:d888:8f8f with SMTP id g18-20020a92c7d2000000b00363d8888f8fmr8157272ilk.7.1707762977895; Mon, 12 Feb 2024 10:36:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707762977; cv=pass; d=google.com; s=arc-20160816; b=wc+5IeYeJAjz+elP3c7K1HO8kp7Er8NtQkzVb7KRC2H933hAVrFjo8vukA/h9bJ0ab 2kWmKj38G/veplsYXrK7uvyoRWPakNK5fe96fSKxxntoG1vtatX8KgF4pf6Lx73kTJud j57f3SPBM0AcZbJaBLsLCg0G26M5uBUEPbZve6bDI5Nu1jNRGEO841Iq7DT+bOw6cKeM X1svPQNL65m2mUZdQhVNSSCUP5ZjZK+U4BXZTToXmkTQs5rG36skp2yh1YZXdFuWICnk ceBfX6OfSfcf1OZxU8+//q+5DSCATP6KUrCDKfMoyGHACFcppdsoSUQuAma+AC+TGQZu XxvQ== 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=atIRQ6nV/rZqwT8CG8TViR/VtaCsGLIhCjTadAlyMNk=; fh=be8CWoVBB1ZQHfdmjGV9ccYcnYdbhw80vAJ1J8arzcE=; b=pTSu8DDH0dYTBXXdXrn2if87jL6azl3EIW1oJztbUwuiguzldo67puFCA44VOK5GRq 4iHZxCkC822pFmzPBRVIfWU4WFzlqdVm/0UvqK25cS+TaA6k1NeOrSDk68AzIwnSABE8 LZaNynt+WnLG9cCbTR/SYeuXdZdi7zBYeCdej9dLMJR6anO0agEB15IOQdJ7kZgYV4FU 7bT7zlSeF1u3YzFvuFrFS0T425tIpUEgfqyxoXn7C99hzgnBdPbNqlFxfdVwk2/9ZCS9 JSYlyyyffoxO1/a2sfGxolMZ+zv2WDCHsG9kCMVFIo0fC10GnwJFNM1f7u8PHrsMc11p scQg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ViEM1ASS; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-62195-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62195-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com X-Forwarded-Encrypted: i=2; AJvYcCXdd4wpGRFmRuzPoNxMD8f6z/d2tTV5Tt4Vw9o+z8X9NxUHlkULYg1I+lRdtUC6yEh+nBOc+zVZzvdAKW4FU+gEgPerOZsZefBdOyQBhQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u4-20020a656704000000b005ceef3c53a1si578561pgf.635.2024.02.12.10.36.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 10:36:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62195-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=ViEM1ASS; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-62195-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62195-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 863C6282D9D for ; Mon, 12 Feb 2024 18:36:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA1133FE36; Mon, 12 Feb 2024 18:36:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="ViEM1ASS" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51FB33FB01; Mon, 12 Feb 2024 18:36:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707762968; cv=none; b=LJWwkWxtK7nD8He/yTPjtCIeYcCIUVuoXIi0O2p399SGH8w2okLcxnwHfY+WNw0kuQrsbI2D5A9EZ7a9Lu99iJELP87fdsCCjgnPnzS3Vk3TEGBFENMjfTv/HRxUOHSb32EoDSD1EyuTbdxR0zNrRK/Usq29lUlYrZ0znI/0I4U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707762968; c=relaxed/simple; bh=T6klo5znd49M931UrjN16DNw3T/R1nxaLTG4aDB8gV4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TLmRP2raQq/9OUW9YaYJEdZfxCElJ/qiiZtgcJuyYFMM0rkjWm0GxKPlBAkDSFvMyYS0Sy+CZuGM+uD1Omwp4YXXLl7bVCvZEAs13s+w57Ym+qqJsvpqb+9SQqYssKhzhxl4XzleX68YpvMy2Y3uyKZyFIn2eb4RtdbMuhgb8zM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=ViEM1ASS; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1707762965; bh=T6klo5znd49M931UrjN16DNw3T/R1nxaLTG4aDB8gV4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=ViEM1ASSooz6/5l6YhYrLglA/e9pS7yzXmNL899kVcI6WvbWsO2YTMBU5RHhM6vHo sDSDiOBEF+9A1U24pV7d6Nv30985UXdCSXoUx5+H/Yla0qVzWC/OPoMd1/J1WEo8Yx jmUOfgyRlk/a6nLF26s8jpyQzl1e1G/x28X307zQFTPvDVV34WxMGM13V+fWNLfVSb 0TeJqUoxnUjURSy+5zYdcIr/3bnPOBiV5ScgmQBFcZuWX41VxhhfIaNk92UNZOqwtW WDWgb3nhFoZGfvSMXy3nOcP+/xfI3vNm+zh1oG6gDiy3gbuLeXCLjdmy6iCdPmJ6nv FtcJtDTDDWgYQ== Received: from [100.115.223.179] (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: cristicc) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 277193781FCE; Mon, 12 Feb 2024 18:36:04 +0000 (UTC) Message-ID: <4efca2ec-b078-4421-8956-e3add15d8f62@collabora.com> Date: Mon, 12 Feb 2024 20:36:03 +0200 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 v2 2/2] phy: rockchip: Add Samsung HDMI/eDP Combo PHY driver Content-Language: en-US To: Luis de Arquer , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner , Johan Jonker , Sebastian Reichel , Sascha Hauer , Andy Yan , Vinod Koul , Kishon Vijay Abraham I , Philipp Zabel , Algea Cao Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, kernel@collabora.com References: <20240205-phy-hdptx-v2-0-a7150814c047@collabora.com> <20240205-phy-hdptx-v2-2-a7150814c047@collabora.com> <61af7b121b23fe8ed06df5348692f862b9b125bf.camel@gmail.com> From: Cristian Ciocaltea In-Reply-To: <61af7b121b23fe8ed06df5348692f862b9b125bf.camel@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Luis, On 2/12/24 18:44, Luis de Arquer wrote: > Hi Cristian, > > On Mon, 2024-02-05 at 13:24 +0200, Cristian Ciocaltea wrote: >> + >> +static bool hdptx_phy_clk_pll_calc(unsigned int data_rate, >> + struct ropll_config *cfg) >> +{ >> + const unsigned int fout = data_rate / 2, fref = 24000; >> + unsigned long k = 0, lc, k_sub, lc_sub; >> + unsigned int fvco, sdc; >> + u32 mdiv, sdiv, n = 8; >> + >> + for (sdiv = 16; sdiv >= 1; sdiv--) { >> + if (sdiv % 2 && sdiv != 1) >> + continue; >> + >> + fvco = fout * sdiv; >> + >> + if (fvco < 2000000 || fvco > 4000000) >> + continue; >> + > > What about adding a check to data_rate, maybe like > > if (fout > 0x0FFFFFFF) > return false; > > or similar, before the for loop, to keep the multiplication safe? > > Right now it would be redundant, given that data_rate was, at some > point, encoded in 28 bits within bus_width. But can prevent future pain, > especially after changing to phy_configure_opts_hdmi. Indeed, it makes sense to do the check, thanks for the heads up! I was almost ready to submit v3, so this arrived just in time. :-) Regards, Cristian