How does request io memory region works

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am trying to understand the following driver code. In the probe
function, i think it tries to map memory region for the driver so that
the driver can access the hardware register. Please correct me if I am
wrong. My question is where does it specifies the address of the
registers for the driver to map from? And how much it should map?

https://android.googlesource.com/kernel/exynos/+/a6a1de6334417e0800440cdf971270df6f90b2fa/drivers/media/video/exynos/jpeg/jpeg_dev.c

/* memory region */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
        jpeg_err("failed to get jpeg memory region resource\n");
        ret = -ENOENT;
        goto err_res;
}

res = request_mem_region(res->start, resource_size(res),
                        pdev->name);
if (!res) {
        jpeg_err("failed to request jpeg io memory region\n");
        ret = -ENOMEM;
        goto err_region;
}

/* ioremap */
dev->reg_base = ioremap(res->start, resource_size(res));
if (!dev->reg_base) {
        jpeg_err("failed to remap jpeg io region\n");
        ret = -ENOENT;
        goto err_map;
}

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux