linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Guillaume Ranquet <granquet@baylibre.com>,
	Vinod Koul <vkoul@kernel.org>, Jitao shi <jitao.shi@mediatek.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Daniel Vetter <daniel@ffwll.ch>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Chun-Kuang Hu <chunkuang.hu@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	David Airlie <airlied@gmail.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Rob Herring <robh+dt@kernel.org>, CK Hu <ck.hu@mediatek.com>
Cc: oe-kbuild-all@lists.linux.dev,
	linux-mediatek@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, mac.shen@mediatek.com,
	linux-phy@lists.infradead.org,
	Guillaume Ranquet <granquet@baylibre.com>,
	devicetree@vger.kernel.org,
	AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.com>,
	stuart.lee@mediatek.com
Subject: Re: [PATCH v5 3/3] phy: mediatek: add support for phy-mtk-hdmi-mt8195
Date: Sat, 28 Jan 2023 23:30:12 +0800	[thread overview]
Message-ID: <202301282319.Z1Kqm6bN-lkp@intel.com> (raw)
In-Reply-To: <20220919-v5-3-cfb0e5ad29b2@baylibre.com>

Hi Guillaume,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on e2f86c02fdc96ca29ced53221a3cbf50aa6f8b49]

url:    https://github.com/intel-lab-lkp/linux/commits/Guillaume-Ranquet/dt-bindings-phy-mediatek-hdmi-phy-Add-mt8195-compatible/20230128-160522
base:   e2f86c02fdc96ca29ced53221a3cbf50aa6f8b49
patch link:    https://lore.kernel.org/r/20220919-v5-3-cfb0e5ad29b2%40baylibre.com
patch subject: [PATCH v5 3/3] phy: mediatek: add support for phy-mtk-hdmi-mt8195
config: arc-randconfig-r043-20230123 (https://download.01.org/0day-ci/archive/20230128/202301282319.Z1Kqm6bN-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/2cc45518a7fd551117426c770070d93acb31166e
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Guillaume-Ranquet/dt-bindings-phy-mediatek-hdmi-phy-Add-mt8195-compatible/20230128-160522
        git checkout 2cc45518a7fd551117426c770070d93acb31166e
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash drivers/phy/mediatek/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/bits.h:6,
                    from include/linux/bitops.h:6,
                    from include/linux/log2.h:12,
                    from include/asm-generic/div64.h:55,
                    from ./arch/arc/include/generated/asm/div64.h:1,
                    from include/linux/math.h:6,
                    from include/linux/delay.h:22,
                    from drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:6:
   drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c: In function 'mtk_hdmi_pll_calc':
>> include/vdso/bits.h:7:40: warning: left shift count >= width of type [-Wshift-count-overflow]
       7 | #define BIT(nr)                 (UL(1) << (nr))
         |                                        ^~
   drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:299:20: note: in expansion of macro 'BIT'
     299 |         if ((pcw / BIT(32)) > 1) {
         |                    ^~~
>> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:299:18: warning: division by zero [-Wdiv-by-zero]
     299 |         if ((pcw / BIT(32)) > 1) {
         |                  ^
>> include/vdso/bits.h:7:40: warning: left shift count >= width of type [-Wshift-count-overflow]
       7 | #define BIT(nr)                 (UL(1) << (nr))
         |                                        ^~
   drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:301:27: note: in expansion of macro 'BIT'
     301 |         } else if ((pcw / BIT(32)) == 1) {
         |                           ^~~
   drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:301:25: warning: division by zero [-Wdiv-by-zero]
     301 |         } else if ((pcw / BIT(32)) == 1) {
         |                         ^
>> include/vdso/bits.h:7:40: warning: left shift count >= width of type [-Wshift-count-overflow]
       7 | #define BIT(nr)                 (UL(1) << (nr))
         |                                        ^~
   drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:303:36: note: in expansion of macro 'BIT'
     303 |                 fbkdiv_low = pcw % BIT(32);
         |                                    ^~~
   drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:303:34: warning: division by zero [-Wdiv-by-zero]
     303 |                 fbkdiv_low = pcw % BIT(32);
         |                                  ^


vim +299 drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c

   211	
   212	static int mtk_hdmi_pll_calc(struct mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw,
   213						 unsigned long rate, unsigned long parent_rate)
   214	{
   215		int i = 0;
   216		int ret;
   217		u64 tmds_clk;
   218		u64 pixel_clk;
   219		/* pll input source frequency */
   220		u64 da_hdmitx21_ref_ck;
   221		/* ICO output clk */
   222		u64 ns_hdmipll_ck;
   223		/* source clk for Display digital */
   224		u64 ad_hdmipll_pixel_ck;
   225		u64 pcw;
   226		u32 fbkdiv_low;
   227		u8 digital_div;
   228		u8 txprediv;
   229		u8 txposdiv;
   230		u8 fbkdiv_high;
   231		u8 posdiv1;
   232		u8 posdiv2;
   233		/* prediv is always 1 */
   234		u8 prediv = 1;
   235		/* fbkdiv_hs3 is always 1 */
   236		u8 fbkdiv_hs3 = 1;
   237		u8 txpredivs[4] = { 2, 4, 6, 12 };
   238	
   239		pixel_clk = rate;
   240		tmds_clk = pixel_clk;
   241	
   242		if (tmds_clk < 25000000 || tmds_clk > 594000000)
   243			return -EINVAL;
   244	
   245		if (tmds_clk >= 340000000)
   246			hdmi_phy->tmds_over_340M = true;
   247		else
   248			hdmi_phy->tmds_over_340M = false;
   249	
   250		/* in Hz */
   251		da_hdmitx21_ref_ck = 26000000UL;
   252	
   253		/*  TXPOSDIV stage treatment:
   254		 *	0M  <  TMDS clk  < 54M		  /8
   255		 *	54M <= TMDS clk  < 148.35M    /4
   256		 *	148.35M <=TMDS clk < 296.7M   /2
   257		 *	296.7 <=TMDS clk <= 594M	  /1
   258		 */
   259		if (tmds_clk < 54000000UL)
   260			txposdiv = 8;
   261		else if (tmds_clk >= 54000000UL && tmds_clk < 148350000UL)
   262			txposdiv = 4;
   263		else if (tmds_clk >= 148350000UL && tmds_clk < 296700000UL)
   264			txposdiv = 2;
   265		else if (tmds_clk >= 296700000UL && tmds_clk <= 594000000UL)
   266			txposdiv = 1;
   267		else
   268			return -EINVAL;
   269	
   270		/* calculate txprediv: can be 2, 4, 6, 12
   271		 * ICO clk = 5*TMDS_CLK*TXPOSDIV*TXPREDIV
   272		 * ICO clk constraint: 5G =< ICO clk <= 12G
   273		 */
   274		for (i = 0; i < ARRAY_SIZE(txpredivs); i++) {
   275			ns_hdmipll_ck = 5 * tmds_clk * txposdiv * txpredivs[i];
   276			if (ns_hdmipll_ck >= 5000000000UL &&
   277			    ns_hdmipll_ck <= 12000000000UL)
   278				break;
   279		}
   280		if (i == (ARRAY_SIZE(txpredivs) - 1) &&
   281		    (ns_hdmipll_ck < 5000000000UL || ns_hdmipll_ck > 12000000000UL)) {
   282			return -EINVAL;
   283		}
   284		if (i == ARRAY_SIZE(txpredivs))
   285			return -EINVAL;
   286	
   287		txprediv = txpredivs[i];
   288	
   289		/* PCW calculation: FBKDIV
   290		 * formula: pcw=(frequency_out*2^pcw_bit) / frequency_in / FBKDIV_HS3;
   291		 * RG_HDMITXPLL_FBKDIV[32:0]:
   292		 * [32,24] 9bit integer, [23,0]:24bit fraction
   293		 */
   294		pcw = ns_hdmipll_ck;
   295		pcw = pcw << PCW_DECIMAL_WIDTH;
   296		pcw = pcw / da_hdmitx21_ref_ck;
   297		pcw = pcw / fbkdiv_hs3;
   298	
 > 299		if ((pcw / BIT(32)) > 1) {
   300			return -EINVAL;
   301		} else if ((pcw / BIT(32)) == 1) {
   302			fbkdiv_high = 1;
   303			fbkdiv_low = pcw % BIT(32);
   304		} else {
   305			fbkdiv_high = 0;
   306			fbkdiv_low = pcw;
   307		}
   308	
   309		/* posdiv1:
   310		 * posdiv1 stage treatment according to color_depth:
   311		 * 24bit -> posdiv1 /10, 30bit -> posdiv1 /12.5,
   312		 * 36bit -> posdiv1 /15, 48bit -> posdiv1 /10
   313		 */
   314		posdiv1 = 10;
   315		posdiv2 = 1;
   316		ad_hdmipll_pixel_ck = (ns_hdmipll_ck / 10) / 1;
   317	
   318		/* Digital clk divider, max /32 */
   319		digital_div = ad_hdmipll_pixel_ck / pixel_clk;
   320		if (!(digital_div <= 32 && digital_div >= 1))
   321			return -EINVAL;
   322	
   323		mtk_hdmi_pll_set_hw(hw, prediv, fbkdiv_high, fbkdiv_low,
   324					  fbkdiv_hs3, posdiv1, posdiv2, txprediv,
   325					  txposdiv, digital_div);
   326		if (ret)
   327			return -EINVAL;
   328	
   329		return 0;
   330	}
   331	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

  reply	other threads:[~2023-01-28 15:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27 15:55 [PATCH v5 0/3] Add MT8195 HDMI phy support Guillaume Ranquet
2023-01-27 15:55 ` [PATCH v5 1/3] dt-bindings: phy: mediatek: hdmi-phy: Add mt8195 compatible Guillaume Ranquet
2023-01-27 15:55 ` [PATCH v5 2/3] phy: phy-mtk-hdmi: Add generic phy configure callback Guillaume Ranquet
2023-01-27 15:55 ` [PATCH v5 3/3] phy: mediatek: add support for phy-mtk-hdmi-mt8195 Guillaume Ranquet
2023-01-28 15:30   ` kernel test robot [this message]
2023-01-28 18:57   ` kernel test robot
2023-01-27 16:18 ` [PATCH v5 0/3] Add MT8195 HDMI phy support Guillaume Ranquet
  -- strict thread matches above, loose matches on Subject: below --
2022-11-28 16:17 Guillaume Ranquet
2022-11-28 16:17 ` [PATCH v5 3/3] phy: mediatek: add support for phy-mtk-hdmi-mt8195 Guillaume Ranquet
2023-01-12 18:21   ` Vinod Koul
2023-01-19 10:04     ` Guillaume Ranquet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202301282319.Z1Kqm6bN-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=airlied@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunfeng.yun@mediatek.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=ck.hu@mediatek.com \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=granquet@baylibre.com \
    --cc=jitao.shi@mediatek.com \
    --cc=kishon@ti.com \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-phy@lists.infradead.org \
    --cc=mac.shen@mediatek.com \
    --cc=matthias.bgg@gmail.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=stuart.lee@mediatek.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).