On Fri, 14 Jun 2019 16:03:28 +0200 Heiko Stübner <heiko@xxxxxxxxx> wrote: > Hi Boris, > > Am Freitag, 14. Juni 2019, 15:53:20 CEST schrieb Boris Brezillon: > > On Thu, 13 Jun 2019 16:22:44 -0300 > > Ezequiel Garcia <ezequiel@xxxxxxxxxxxxx> 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? > > The issue is that on the older rk3288 socs the vops memory map has > the mmu registers (which get mapped separately) in between the core > and lut registers. Sorry for the noise, I thought the MMU was registered directly by the VOP driver and we could avoid the 3 ioremap and merge things into a single one, but it seems the MMU driver is a separate thing. _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel