All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: Ezequiel Garcia <ezequiel@collabora.com>
Cc: dri-devel@lists.freedesktop.org,
	Douglas Anderson <dianders@chromium.org>,
	linux-rockchip@lists.infradead.org,
	Sean Paul <seanpaul@chromium.org>,
	kernel@collabora.com
Subject: Re: [RFC/WIP] drm/rockchip: Support CRTC gamma LUT
Date: Fri, 14 Jun 2019 15:53:20 +0200	[thread overview]
Message-ID: <20190614155320.348d42af@collabora.com> (raw)
In-Reply-To: <20190613192244.5447-1-ezequiel@collabora.com>

On Thu, 13 Jun 2019 16:22:44 -0300
Ezequiel Garcia <ezequiel@collabora.com> wrote:


> +static int vop_gamma_lut_request(struct device *dev,
> +				 struct resource *res, struct vop *vop)
> +{
> +	resource_size_t offset = vop->data->gamma_lut_addr_off;
> +	resource_size_t size = VOP_GAMMA_LUT_SIZE * 4;
> +
> +	/*
> +	 * Some SoCs (e.g. RK3288) have the gamma LUT address after
> +	 * the MMU registers, which means we can't request and ioremap
> +	 * the entire register set. Other (e.g. RK3399) have gamma LUT
> +	 * address before MMU.
> +	 *
> +	 * Therefore, we need to request and ioremap those that haven't
> +	 * been already.
> +	 */
> +	if (vop->len >= (offset + size)) {
> +		vop->lut_regs = vop->regs + offset;
> +		return 0;
> +	}
> +
> +	if (!devm_request_mem_region(dev, res->start + offset,
> +				     size, dev_name(dev))) {
> +		dev_warn(dev, "can't request gamma lut region\n");
> +		return -EBUSY;
> +	}
> +
> +	vop->lut_regs = devm_ioremap(dev, res->start + offset, size);
> +	if (!vop->lut_regs) {
> +		dev_err(dev, "can't ioremap gamma lut address\n");
> +		devm_release_mem_region(dev, res->start + offset, size);
> +		return -ENOMEM;
> +	}

Can't we patch the resource just after calling plaform_get_resource()
(and before calling devm_ioremap_resource()) so we don't have to add
these devm_request_mem_region()+devm_ioremap() calls here?

> +	return 0;
> +}
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2019-06-14 13:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-13 19:22 [RFC/WIP] drm/rockchip: Support CRTC gamma LUT Ezequiel Garcia
2019-06-13 19:36 ` Ilia Mirkin
2019-06-18 13:36   ` Ezequiel Garcia
2019-06-18 16:57     ` Ilia Mirkin
2019-06-14 13:53 ` Boris Brezillon [this message]
     [not found]   ` <20190614155320.348d42af-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2019-06-14 14:03     ` Heiko Stübner
2019-06-14 14:08       ` Boris Brezillon
2019-06-14 20:05 ` Doug Anderson
2019-06-18 13:38   ` Ezequiel Garcia
2019-06-17 10:06 ` Jacopo Mondi
2019-06-18  5:15   ` Ezequiel Garcia
2019-06-18 18:37     ` Ezequiel Garcia

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=20190614155320.348d42af@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ezequiel@collabora.com \
    --cc=kernel@collabora.com \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=seanpaul@chromium.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.