drm/rockchip: Don't change hdmi reference clock rate
[drm/drm-misc.git] / drivers / media / pci / mgb4 / mgb4_regs.c
blob31befd722d72ddd95958b84baf0820075c3f39a1
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (C) 2021-2022 Digiteq Automotive
4 * author: Martin Tuma <martin.tuma@digiteqautomotive.com>
5 */
7 #include <linux/ioport.h>
8 #include "mgb4_regs.h"
10 int mgb4_regs_map(struct resource *res, struct mgb4_regs *regs)
12 regs->mapbase = res->start;
13 regs->mapsize = resource_size(res);
15 if (!request_mem_region(regs->mapbase, regs->mapsize, res->name))
16 return -EINVAL;
17 regs->membase = ioremap(regs->mapbase, regs->mapsize);
18 if (!regs->membase) {
19 release_mem_region(regs->mapbase, regs->mapsize);
20 return -EINVAL;
23 return 0;
26 void mgb4_regs_free(struct mgb4_regs *regs)
28 iounmap(regs->membase);
29 release_mem_region(regs->mapbase, regs->mapsize);