Hi Chaoyi,

Thanks for the review.

On Thu, Dec 03, 2026 at 04:17:52PM +0800, Chaoyi Chen wrote:
> > +   regmap_write(rk628->regmap, CRU_GPLL_CON0, 0xffff701d);
> > +   usleep_range(1000, 1500);
> > +   regmap_write(rk628->regmap, CRU_MODE_CON00, 0xffff0004);
> > +   usleep_range(1000, 1500);
> > +   regmap_write(rk628->regmap, CRU_CLKSEL_CON00, 0x00ff0080);
> > +   regmap_write(rk628->regmap, CRU_CLKSEL_CON00, 0x00ff0083);
> > +   regmap_write(rk628->regmap, CRU_CPLL_CON0, 0xffff3063);
> > +   usleep_range(1000, 1500);
> > +   regmap_write(rk628->regmap, CRU_MODE_CON00, 0xffff0005);
> > +   regmap_write(rk628->regmap, CRU_CLKSEL_CON00, 0x00ff0003);
> > +   regmap_write(rk628->regmap, CRU_CLKSEL_CON00, 0x00ff000b);
> > +   regmap_write(rk628->regmap, CRU_GPLL_CON0, 0xffff1028);
> > +   usleep_range(1000, 1500);
> > +   regmap_write(rk628->regmap, CRU_CLKSEL_CON00, 0x00ff008b);
> > +   regmap_write(rk628->regmap, CRU_CPLL_CON0, 0xffff1063);
> > +   usleep_range(1000, 1500);
> > +   regmap_write(rk628->regmap, CRU_CLKSEL_CON00, 0x00ff000b);
> > +}
>
> Add some comment for these config?
>
> https://github.com/rockchip-linux/kernel/blob/develop-6.12/drivers/misc/rk628/rk628_cru.c

Will do in v2, thank you for the develop-6.12 pointer, I will document
the glitch-free GPLL/CPLL/pclk_logic ramp sequence (and add the 1 ms
settle delay after switching CPLL to normal mode).

> > +   regmap_read_poll_timeout(rk628->regmap, CRU_CPLL_CON1, val,
> > +                            val & PLL_LOCK, 200, 10000);
> > +}
>
> It would be better to check this return value and print a message if
> it fails.

Agreed, I will check the return value and log an error via dev_err() on
timeout in v2.

> > +static void rk628_post_process_csc(struct rk628 *rk628)
> > +{
> > +   /* BT.709 limited-range YCbCr -> full-range RGB (10-bit fixed point) */
> > +   static const s16 y2r_bt709[3][3] = {
> > +           { 1196,    0, 1841 },
> > +           { 1196, -219, -547 },
> > +           { 1196, 2169,    0 },
> > +   };
>
> Isn't 13-bit used here?
>
> https://github.com/rockchip-linux/kernel/blob/develop-6.12/drivers/misc/rk628/rk628_post_process.c#L1556

Fair point, the comment was referring to the 10 fractional bits (1.0 =
1024), whereas the RK628F CSC coefficients themselves are 13-bit signed
Q3.10 (CSC_13BIT_DEPTH / CSC_BT709L_13BIT). Re-checking
rockchip_calc_post_csc() also caught a small rounding difference in the
DC offset vector ({ -995, 308, -1159 }); I will update both the comment
and y2r_bt709_dc[] in v2.

> > +   ep = of_graph_get_endpoint_by_regs(dev->of_node, 3, -1);
> > +   if (ep) {
> > +           of_node_put(ep);
> > +           return dev_err_probe(dev, -EOPNOTSUPP,
> > +                                "HDMI TX output on port@3 is not 
> > supported\n");
> > +   }
>
> Missing of_node_put(ep) here.
>
> > +
> > +   ep = of_graph_get_endpoint_by_regs(dev->of_node, 4, -1);
> > +   if (ep) {
> > +           of_node_put(ep);
> > +           return dev_err_probe(dev, -EOPNOTSUPP,
> > +                                "parallel RGB/BT.1120 on port@4 is not 
> > supported\n");
> > +   }
> > +
>
> Ditto.
>
> > +   ep = of_graph_get_endpoint_by_regs(dev->of_node, 1, -1);
> > +   if (ep) {
> > +           bool has_data_lanes = of_property_present(ep, "data-lanes");
> > +
> > +           of_node_put(ep);
> > +           if (has_data_lanes)
> > +                   return dev_err_probe(dev, -EOPNOTSUPP,
> > +                                        "only LVDS output is supported on 
> > port@1\n");
> > +   }
>
> Ditto.
>
> > +
> > +   ep = of_graph_get_endpoint_by_regs(dev->of_node, 2, -1);
> > +   if (ep) {
> > +           bool has_data_lanes = of_property_present(ep, "data-lanes");
> > +
> > +           of_node_put(ep);
> > +           if (has_data_lanes)
> > +                   return dev_err_probe(dev, -EOPNOTSUPP,
> > +                                        "only LVDS output is supported on 
> > port@2\n");
> > +   }
> > +
>
> Ditto.

In those four blocks of_node_put(ep) was already called inside the
if (ep) branch (so when execution continues past the brace, ep is either
NULL or already released), unlike port@0 above which used if (!ep). To
make this much cleaner and less error-prone to read, I will switch
rk628_parse_dt() to scoped __free(device_node) cleanup in v2.

Best regards,
Gianfranco

Reply via email to