From: Philipp Zabel <p.zabel@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 3/4] video: add MIPI DBI framebuffer helpers
Date: Thu, 30 Mar 2023 14:02:02 +0200 [thread overview]
Message-ID: <20230330120202.GA4075@pengutronix.de> (raw)
In-Reply-To: <abd00c6b-2c9a-8d3a-bd64-0635adf43cc2@pengutronix.de>
Hi Ahmad,
thank you for the review.
On Thu, Mar 30, 2023 at 10:43:54AM +0200, Ahmad Fatoum wrote:
> On 29.03.23 12:56, Philipp Zabel wrote:
[...]
> > +static void mipi_dbi_buf_copy(void *dst, struct fb_info *info, bool swap)
> > +{
> > + u16 *src = (u16 *)info->screen_base;
> > + u16 *dst16 = dst;
> > + size_t len = info->xres * info->yres;
> > + int i;
> > +
> > + if (swap) {
> > + for (i = 0; i < len; i++) {
> > + *dst16++ = *src << 8 | *src >> 8;
> > + src++;
> > + }
> > + } else {
> > + memcpy(dst, src, len * 2);
>
> Do we need this? Why can't we send out framebuffer directly if there is no
> swapping to be done?
We do not. If byte swapping is not necessary, we can transfer directly
from the framebuffer, as long as this driver only supports 16-bit
RGB565. I'll improve this in v2.
[...]
> > +/**
> > + * mipi_dbi_enable_flush - MIPI DBI enable helper
> > + * @dbidev: MIPI DBI device structure
> > + * @crtc_state: CRTC state
> > + * @plane_state: Plane state
> > + *
> > + * Flushes the whole framebuffer and enables the backlight. Drivers can use this
> > + * in their &drm_simple_display_pipe_funcs->enable callback.
>
> fb_ops->fb_enable ?
Yes. The whole comment slipped through unchanged from the Linux driver.
Will fix.
[...]
> > +void mipi_dbi_fb_disable(struct fb_info *info)
> > +{
> > + struct mipi_dbi_dev *dbidev = container_of(info, struct mipi_dbi_dev, info);
> > +
> > + if (dbidev->backlight)
> > + backlight_set_brightness(dbidev->backlight, 0);
> > + else
> > + mipi_dbi_blank(dbidev);
> > +
> > + if (dbidev->regulator)
> > + regulator_disable(dbidev->regulator);
> > + if (dbidev->io_regulator)
> > + regulator_disable(dbidev->io_regulator);
>
> Calling regulator_disable on NULL pointer is a no-op.
Ah right, this is different from Linux.
I'll remove the unnecessary checks.
> > +int mipi_dbi_dev_init(struct mipi_dbi_dev *dbidev, struct fb_ops *ops,
> > + struct fb_videomode *mode)
> > +{
> > + struct fb_info *info = &dbidev->info;
> > +
> > + info->mode = mode;
> > + info->fbops = ops;
> > + info->dev.parent = dbidev->dev;
> > +
> > + info->xres = mode->xres;
> > + info->yres = mode->yres;
> > + info->bits_per_pixel = 16;
> > + info->line_length = info->xres * (info->bits_per_pixel >> 3);
> > +
> > + info->screen_size = info->line_length * info->yres;
> > + info->screen_base = kzalloc(info->screen_size, GFP_KERNEL);
>
> dma_alloc? In case some SPI driver gets DMA support.
Ok.
> > +
> > + info->red.length = 5;
> > + info->red.offset = 11;
> > + info->green.length = 6;
> > + info->green.offset = 5;
> > + info->blue.length = 5;
> > + info->blue.offset = 0;
> > +
> > + dbidev->tx_buf = kzalloc(mode->xres * mode->yres * 2, GFP_KERNEL);
>
> Use info->screen_size here as well?
Yes. This driver doesn't support 32-bit framebuffers with conversion
to 16-bit transfers, so this can use info->screen_size as well.
regards
Philipp
next prev parent reply other threads:[~2023-03-30 12:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-29 10:56 [PATCH 1/4] firmware: Add request/release_firmware() calls Philipp Zabel
2023-03-29 10:56 ` [PATCH 2/4] video: Add of_get_display_timing Philipp Zabel
2023-03-30 8:32 ` Ahmad Fatoum
2023-03-29 10:56 ` [PATCH 3/4] video: add MIPI DBI framebuffer helpers Philipp Zabel
2023-03-30 8:43 ` Ahmad Fatoum
2023-03-30 12:02 ` Philipp Zabel [this message]
2023-03-29 10:56 ` [PATCH 4/4] video: Add MIPI DBI compatible SPI driver Philipp Zabel
2023-03-30 8:56 ` Ahmad Fatoum
2023-03-30 8:30 ` [PATCH 1/4] firmware: Add request/release_firmware() calls Ahmad Fatoum
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=20230330120202.GA4075@pengutronix.de \
--to=p.zabel@pengutronix.de \
--cc=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.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