Hi Noralf,

> > +static int panel_mipi_dbi_get_mode(struct mipi_dbi_dev *dbidev, struct 
> > drm_display_mode *mode)
> > +{
> > +   struct device *dev = dbidev->drm.dev;
> > +   u32 width_mm = 0, height_mm = 0;
> > +   struct display_timing timing;
> > +   struct videomode vm;
> > +   int ret;
> > +
> > +   ret = of_get_display_timing(dev->of_node, "panel-timing", &timing);
> > +   if (ret) {
> > +           dev_err(dev, "%pOF: failed to get panel-timing (error=%d)\n", 
> > dev->of_node, ret);
> > +           return ret;
> > +   }
> > +
> > +   videomode_from_timing(&timing, &vm);
> > +
> > +   if (!vm.hactive || vm.hfront_porch || vm.hsync_len ||
> > +       (vm.hback_porch + vm.hactive) > 0xffff ||
> > +       !vm.vactive || vm.vfront_porch || vm.vsync_len ||
> > +       (vm.vback_porch + vm.vactive) > 0xffff ||
> > +       vm.flags) {
> > +           dev_err(dev, "%pOF: panel-timing out of bounds\n", 
> > dev->of_node);
> > +           return -EINVAL;
> > +   }
> We should have a helper that implements this. Maybe the display_timing
> => display_mode helper could do it.

It would be nice with a drm_display_timing_to_mode() but that can come
later - the comment above should not be understood that I consider it
mandatory for this driver.

        Sam

Reply via email to