dde8c347ad4ccf2c823d5012d6580f518eed476b
[openwrt/staging/981213.git] /
1 From 6c8c9ca56ce6039ade09d26c069132538e4de9f0 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Sun, 28 Jul 2019 22:22:36 +0100
4 Subject: [PATCH 728/806] drivers: char: Use correct name for the Raspberry Pi
5 video decoder
6
7 Replace the old code name with a more appropriate name - RPiVid.
8
9 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
10 ---
11 arch/arm/boot/dts/bcm2838.dtsi | 10 +-
12 arch/arm/configs/bcm2711_defconfig | 2 +-
13 drivers/char/broadcom/Kconfig | 8 +-
14 drivers/char/broadcom/Makefile | 2 +-
15 .../broadcom/{argon-mem.c => rpivid-mem.c} | 105 +++++++++---------
16 drivers/mfd/bcm2835-pm.c | 12 +-
17 drivers/soc/bcm/bcm2835-power.c | 6 +-
18 include/linux/mfd/bcm2835-pm.h | 2 +-
19 8 files changed, 71 insertions(+), 76 deletions(-)
20 rename drivers/char/broadcom/{argon-mem.c => rpivid-mem.c} (69%)
21
22 --- a/arch/arm/boot/dts/bcm2838.dtsi
23 +++ b/arch/arm/boot/dts/bcm2838.dtsi
24 @@ -409,26 +409,26 @@
25 };
26
27 hevc-decoder@7eb00000 {
28 - compatible = "raspberrypi,argon-hevc-decoder";
29 + compatible = "raspberrypi,rpivid-hevc-decoder";
30 reg = <0x0 0x7eb00000 0x10000>;
31 status = "okay";
32 };
33
34 - argon-local-intc@7eb10000 {
35 - compatible = "raspberrypi,argon-local-intc";
36 + rpivid-local-intc@7eb10000 {
37 + compatible = "raspberrypi,rpivid-local-intc";
38 reg = <0x0 0x7eb10000 0x1000>;
39 status = "okay";
40 interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>;
41 };
42
43 h264-decoder@7eb20000 {
44 - compatible = "raspberrypi,argon-h264-decoder";
45 + compatible = "raspberrypi,rpivid-h264-decoder";
46 reg = <0x0 0x7eb20000 0x10000>;
47 status = "okay";
48 };
49
50 vp9-decoder@7eb30000 {
51 - compatible = "raspberrypi,argon-vp9-decoder";
52 + compatible = "raspberrypi,rpivid-vp9-decoder";
53 reg = <0x0 0x7eb30000 0x10000>;
54 status = "okay";
55 };
56 --- a/arch/arm/configs/bcm2711_defconfig
57 +++ b/arch/arm/configs/bcm2711_defconfig
58 @@ -650,7 +650,7 @@ CONFIG_BRCM_CHAR_DRIVERS=y
59 CONFIG_BCM_VCIO=y
60 CONFIG_BCM_VC_SM=y
61 CONFIG_BCM2835_DEVGPIOMEM=y
62 -CONFIG_ARGON_MEM=m
63 +CONFIG_RPIVID_MEM=m
64 # CONFIG_LEGACY_PTYS is not set
65 CONFIG_SERIAL_8250=y
66 # CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
67 --- a/drivers/char/broadcom/Kconfig
68 +++ b/drivers/char/broadcom/Kconfig
69 @@ -50,10 +50,10 @@ config BCM2835_SMI_DEV
70 Broadcom's Secondary Memory interface. The low-level functionality is provided
71 by the SMI driver itself.
72
73 -config ARGON_MEM
74 - tristate "Character device driver for the Argon decoder hardware"
75 +config RPIVID_MEM
76 + tristate "Character device driver for the Raspberry Pi RPIVid video decoder hardware"
77 default n
78 help
79 This driver provides a character device interface for memory-map operations
80 - so userspace tools can access the control and status registers of the Argon
81 - video decoder hardware.
82 + so userspace tools can access the control and status registers of the
83 + Raspberry Pi RPiVid video decoder hardware.
84 --- a/drivers/char/broadcom/Makefile
85 +++ b/drivers/char/broadcom/Makefile
86 @@ -4,4 +4,4 @@ obj-$(CONFIG_BCM_VC_SM) += vc_sm
87
88 obj-$(CONFIG_BCM2835_DEVGPIOMEM)+= bcm2835-gpiomem.o
89 obj-$(CONFIG_BCM2835_SMI_DEV) += bcm2835_smi_dev.o
90 -obj-$(CONFIG_ARGON_MEM) += argon-mem.o
91 +obj-$(CONFIG_RPIVID_MEM) += rpivid-mem.o
92 --- a/drivers/char/broadcom/argon-mem.c
93 +++ /dev/null
94 @@ -1,277 +0,0 @@
95 -/**
96 - * argon-mem.c - character device access to the Argon decoder registers
97 - *
98 - * Based on bcm2835-gpiomem.c. Provides IO memory access to the decoder
99 - * register blocks such that ffmpeg plugins can access the hardware.
100 - *
101 - * Jonathan Bell <jonathan@raspberrypi.org>
102 - * Copyright (c) 2019, Raspberry Pi (Trading) Ltd.
103 - *
104 - * Redistribution and use in source and binary forms, with or without
105 - * modification, are permitted provided that the following conditions
106 - * are met:
107 - * 1. Redistributions of source code must retain the above copyright
108 - * notice, this list of conditions, and the following disclaimer,
109 - * without modification.
110 - * 2. Redistributions in binary form must reproduce the above copyright
111 - * notice, this list of conditions and the following disclaimer in the
112 - * documentation and/or other materials provided with the distribution.
113 - * 3. The names of the above-listed copyright holders may not be used
114 - * to endorse or promote products derived from this software without
115 - * specific prior written permission.
116 - *
117 - * ALTERNATIVELY, this software may be distributed under the terms of the
118 - * GNU General Public License ("GPL") version 2, as published by the Free
119 - * Software Foundation.
120 - *
121 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
122 - * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
123 - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
124 - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
125 - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
126 - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
127 - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
128 - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
129 - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
130 - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
131 - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
132 - */
133 -
134 -#include <linux/kernel.h>
135 -#include <linux/module.h>
136 -#include <linux/of.h>
137 -#include <linux/of_device.h>
138 -#include <linux/platform_device.h>
139 -#include <linux/mm.h>
140 -#include <linux/slab.h>
141 -#include <linux/cdev.h>
142 -#include <linux/pagemap.h>
143 -#include <linux/io.h>
144 -
145 -#define DRIVER_NAME "argon-mem"
146 -#define DEVICE_MINOR 0
147 -
148 -struct argon_mem_priv {
149 - dev_t devid;
150 - struct class *class;
151 - struct cdev argon_mem_cdev;
152 - unsigned long regs_phys;
153 - unsigned long mem_window_len;
154 - struct device *dev;
155 - const char *name;
156 -};
157 -
158 -static int argon_mem_open(struct inode *inode, struct file *file)
159 -{
160 - int dev = iminor(inode);
161 - int ret = 0;
162 - struct argon_mem_priv *priv;
163 - if (dev != DEVICE_MINOR)
164 - ret = -ENXIO;
165 -
166 - priv = container_of(inode->i_cdev, struct argon_mem_priv,
167 - argon_mem_cdev);
168 - if (!priv)
169 - return -EINVAL;
170 - file->private_data = priv;
171 - return ret;
172 -}
173 -
174 -static int argon_mem_release(struct inode *inode, struct file *file)
175 -{
176 - int dev = iminor(inode);
177 - int ret = 0;
178 -
179 - if (dev != DEVICE_MINOR)
180 - ret = -ENXIO;
181 -
182 - return ret;
183 -}
184 -
185 -static const struct vm_operations_struct argon_mem_vm_ops = {
186 -#ifdef CONFIG_HAVE_IOREMAP_PROT
187 - .access = generic_access_phys
188 -#endif
189 -};
190 -
191 -static int argon_mem_mmap(struct file *file, struct vm_area_struct *vma)
192 -{
193 - struct argon_mem_priv *priv;
194 - unsigned long pages;
195 -
196 - priv = file->private_data;
197 - pages = priv->regs_phys >> PAGE_SHIFT;
198 - /*
199 - * The address decode is far larger than the actual number of registers.
200 - * Just map the whole lot in.
201 - */
202 - vma->vm_page_prot = phys_mem_access_prot(file, pages,
203 - priv->mem_window_len,
204 - vma->vm_page_prot);
205 - vma->vm_ops = &argon_mem_vm_ops;
206 - if (remap_pfn_range(vma, vma->vm_start,
207 - pages,
208 - priv->mem_window_len,
209 - vma->vm_page_prot)) {
210 - return -EAGAIN;
211 - }
212 - return 0;
213 -}
214 -
215 -static const struct file_operations
216 -argon_mem_fops = {
217 - .owner = THIS_MODULE,
218 - .open = argon_mem_open,
219 - .release = argon_mem_release,
220 - .mmap = argon_mem_mmap,
221 -};
222 -
223 -static const struct of_device_id argon_mem_of_match[];
224 -static int argon_mem_probe(struct platform_device *pdev)
225 -{
226 - int err;
227 - void *ptr_err;
228 - const struct of_device_id *id;
229 - struct device *dev = &pdev->dev;
230 - struct device *argon_mem_dev;
231 - struct resource *ioresource;
232 - struct argon_mem_priv *priv;
233 -
234 -
235 - /* Allocate buffers and instance data */
236 -
237 - priv = kzalloc(sizeof(struct argon_mem_priv), GFP_KERNEL);
238 -
239 - if (!priv) {
240 - err = -ENOMEM;
241 - goto failed_inst_alloc;
242 - }
243 - platform_set_drvdata(pdev, priv);
244 -
245 - priv->dev = dev;
246 - id = of_match_device(argon_mem_of_match, dev);
247 - if (!id)
248 - return -EINVAL;
249 - priv->name = id->data;
250 -
251 - ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
252 - if (ioresource) {
253 - priv->regs_phys = ioresource->start;
254 - priv->mem_window_len = ioresource->end - ioresource->start;
255 - } else {
256 - dev_err(priv->dev, "failed to get IO resource");
257 - err = -ENOENT;
258 - goto failed_get_resource;
259 - }
260 -
261 - /* Create character device entries */
262 -
263 - err = alloc_chrdev_region(&priv->devid,
264 - DEVICE_MINOR, 1, priv->name);
265 - if (err != 0) {
266 - dev_err(priv->dev, "unable to allocate device number");
267 - goto failed_alloc_chrdev;
268 - }
269 - cdev_init(&priv->argon_mem_cdev, &argon_mem_fops);
270 - priv->argon_mem_cdev.owner = THIS_MODULE;
271 - err = cdev_add(&priv->argon_mem_cdev, priv->devid, 1);
272 - if (err != 0) {
273 - dev_err(priv->dev, "unable to register device");
274 - goto failed_cdev_add;
275 - }
276 -
277 - /* Create sysfs entries */
278 -
279 - priv->class = class_create(THIS_MODULE, priv->name);
280 - ptr_err = priv->class;
281 - if (IS_ERR(ptr_err))
282 - goto failed_class_create;
283 -
284 - argon_mem_dev = device_create(priv->class, NULL,
285 - priv->devid, NULL,
286 - priv->name);
287 - ptr_err = argon_mem_dev;
288 - if (IS_ERR(ptr_err))
289 - goto failed_device_create;
290 -
291 - dev_info(priv->dev, "%s initialised: Registers at 0x%08lx length 0x%08lx",
292 - priv->name, priv->regs_phys, priv->mem_window_len);
293 -
294 - return 0;
295 -
296 -failed_device_create:
297 - class_destroy(priv->class);
298 -failed_class_create:
299 - cdev_del(&priv->argon_mem_cdev);
300 - err = PTR_ERR(ptr_err);
301 -failed_cdev_add:
302 - unregister_chrdev_region(priv->devid, 1);
303 -failed_alloc_chrdev:
304 -failed_get_resource:
305 - kfree(priv);
306 -failed_inst_alloc:
307 - dev_err(priv->dev, "could not load argon_mem");
308 - return err;
309 -}
310 -
311 -static int argon_mem_remove(struct platform_device *pdev)
312 -{
313 - struct device *dev = &pdev->dev;
314 - struct argon_mem_priv *priv = platform_get_drvdata(pdev);
315 -
316 - device_destroy(priv->class, priv->devid);
317 - class_destroy(priv->class);
318 - cdev_del(&priv->argon_mem_cdev);
319 - unregister_chrdev_region(priv->devid, 1);
320 - kfree(priv);
321 -
322 - dev_info(dev, "%s driver removed - OK", priv->name);
323 - return 0;
324 -}
325 -
326 -static const char argon_hevc_name[] = "argon-hevcmem";
327 -static const char argon_h264_name[] = "argon-h264mem";
328 -static const char argon_vp9_name[] = "argon-vp9mem";
329 -static const char argon_intc_name[] = "argon-intcmem";
330 -
331 -static const struct of_device_id argon_mem_of_match[] = {
332 - {
333 - .compatible = "raspberrypi,argon-hevc-decoder",
334 - .data = &argon_hevc_name,
335 - },
336 - {
337 - .compatible = "raspberrypi,argon-h264-decoder",
338 - .data = &argon_h264_name,
339 - },
340 - {
341 - .compatible = "raspberrypi,argon-vp9-decoder",
342 - .data = &argon_vp9_name,
343 - },
344 - /* The "intc" is included as this block of hardware contains the
345 - * "frame done" status flags.
346 - */
347 - {
348 - .compatible = "raspberrypi,argon-local-intc",
349 - .data = &argon_intc_name,
350 - },
351 - { /* sentinel */ },
352 -};
353 -
354 -MODULE_DEVICE_TABLE(of, argon_mem_of_match);
355 -
356 -static struct platform_driver argon_mem_driver = {
357 - .probe = argon_mem_probe,
358 - .remove = argon_mem_remove,
359 - .driver = {
360 - .name = DRIVER_NAME,
361 - .owner = THIS_MODULE,
362 - .of_match_table = argon_mem_of_match,
363 - },
364 -};
365 -
366 -module_platform_driver(argon_mem_driver);
367 -
368 -MODULE_ALIAS("platform:argon-mem");
369 -MODULE_LICENSE("GPL");
370 -MODULE_DESCRIPTION("Driver for accessing Argon decoder registers from userspace");
371 -MODULE_AUTHOR("Jonathan Bell <jonathan@raspberrypi.org>");
372 --- /dev/null
373 +++ b/drivers/char/broadcom/rpivid-mem.c
374 @@ -0,0 +1,272 @@
375 +/**
376 + * rpivid-mem.c - character device access to the RPiVid decoder registers
377 + *
378 + * Based on bcm2835-gpiomem.c. Provides IO memory access to the decoder
379 + * register blocks such that ffmpeg plugins can access the hardware.
380 + *
381 + * Jonathan Bell <jonathan@raspberrypi.org>
382 + * Copyright (c) 2019, Raspberry Pi (Trading) Ltd.
383 + *
384 + * Redistribution and use in source and binary forms, with or without
385 + * modification, are permitted provided that the following conditions
386 + * are met:
387 + * 1. Redistributions of source code must retain the above copyright
388 + * notice, this list of conditions, and the following disclaimer,
389 + * without modification.
390 + * 2. Redistributions in binary form must reproduce the above copyright
391 + * notice, this list of conditions and the following disclaimer in the
392 + * documentation and/or other materials provided with the distribution.
393 + * 3. The names of the above-listed copyright holders may not be used
394 + * to endorse or promote products derived from this software without
395 + * specific prior written permission.
396 + *
397 + * ALTERNATIVELY, this software may be distributed under the terms of the
398 + * GNU General Public License ("GPL") version 2, as published by the Free
399 + * Software Foundation.
400 + *
401 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
402 + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
403 + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
404 + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
405 + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
406 + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
407 + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
408 + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
409 + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
410 + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
411 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
412 + */
413 +
414 +#include <linux/kernel.h>
415 +#include <linux/module.h>
416 +#include <linux/of.h>
417 +#include <linux/of_device.h>
418 +#include <linux/platform_device.h>
419 +#include <linux/mm.h>
420 +#include <linux/slab.h>
421 +#include <linux/cdev.h>
422 +#include <linux/pagemap.h>
423 +#include <linux/io.h>
424 +
425 +#define DRIVER_NAME "rpivid-mem"
426 +#define DEVICE_MINOR 0
427 +
428 +struct rpivid_mem_priv {
429 + dev_t devid;
430 + struct class *class;
431 + struct cdev rpivid_mem_cdev;
432 + unsigned long regs_phys;
433 + unsigned long mem_window_len;
434 + struct device *dev;
435 + const char *name;
436 +};
437 +
438 +static int rpivid_mem_open(struct inode *inode, struct file *file)
439 +{
440 + int dev = iminor(inode);
441 + int ret = 0;
442 + struct rpivid_mem_priv *priv;
443 + if (dev != DEVICE_MINOR)
444 + ret = -ENXIO;
445 +
446 + priv = container_of(inode->i_cdev, struct rpivid_mem_priv,
447 + rpivid_mem_cdev);
448 + if (!priv)
449 + return -EINVAL;
450 + file->private_data = priv;
451 + return ret;
452 +}
453 +
454 +static int rpivid_mem_release(struct inode *inode, struct file *file)
455 +{
456 + int dev = iminor(inode);
457 + int ret = 0;
458 +
459 + if (dev != DEVICE_MINOR)
460 + ret = -ENXIO;
461 +
462 + return ret;
463 +}
464 +
465 +static const struct vm_operations_struct rpivid_mem_vm_ops = {
466 +#ifdef CONFIG_HAVE_IOREMAP_PROT
467 + .access = generic_access_phys
468 +#endif
469 +};
470 +
471 +static int rpivid_mem_mmap(struct file *file, struct vm_area_struct *vma)
472 +{
473 + struct rpivid_mem_priv *priv;
474 + unsigned long pages;
475 +
476 + priv = file->private_data;
477 + pages = priv->regs_phys >> PAGE_SHIFT;
478 + /*
479 + * The address decode is far larger than the actual number of registers.
480 + * Just map the whole lot in.
481 + */
482 + vma->vm_page_prot = phys_mem_access_prot(file, pages,
483 + priv->mem_window_len,
484 + vma->vm_page_prot);
485 + vma->vm_ops = &rpivid_mem_vm_ops;
486 + if (remap_pfn_range(vma, vma->vm_start,
487 + pages,
488 + priv->mem_window_len,
489 + vma->vm_page_prot)) {
490 + return -EAGAIN;
491 + }
492 + return 0;
493 +}
494 +
495 +static const struct file_operations
496 +rpivid_mem_fops = {
497 + .owner = THIS_MODULE,
498 + .open = rpivid_mem_open,
499 + .release = rpivid_mem_release,
500 + .mmap = rpivid_mem_mmap,
501 +};
502 +
503 +static const struct of_device_id rpivid_mem_of_match[];
504 +static int rpivid_mem_probe(struct platform_device *pdev)
505 +{
506 + int err;
507 + void *ptr_err;
508 + const struct of_device_id *id;
509 + struct device *dev = &pdev->dev;
510 + struct device *rpivid_mem_dev;
511 + struct resource *ioresource;
512 + struct rpivid_mem_priv *priv;
513 +
514 +
515 + /* Allocate buffers and instance data */
516 +
517 + priv = kzalloc(sizeof(struct rpivid_mem_priv), GFP_KERNEL);
518 +
519 + if (!priv) {
520 + err = -ENOMEM;
521 + goto failed_inst_alloc;
522 + }
523 + platform_set_drvdata(pdev, priv);
524 +
525 + priv->dev = dev;
526 + id = of_match_device(rpivid_mem_of_match, dev);
527 + if (!id)
528 + return -EINVAL;
529 + priv->name = id->data;
530 +
531 + ioresource = platform_get_resource(pdev, IORESOURCE_MEM, 0);
532 + if (ioresource) {
533 + priv->regs_phys = ioresource->start;
534 + priv->mem_window_len = ioresource->end - ioresource->start;
535 + } else {
536 + dev_err(priv->dev, "failed to get IO resource");
537 + err = -ENOENT;
538 + goto failed_get_resource;
539 + }
540 +
541 + /* Create character device entries */
542 +
543 + err = alloc_chrdev_region(&priv->devid,
544 + DEVICE_MINOR, 1, priv->name);
545 + if (err != 0) {
546 + dev_err(priv->dev, "unable to allocate device number");
547 + goto failed_alloc_chrdev;
548 + }
549 + cdev_init(&priv->rpivid_mem_cdev, &rpivid_mem_fops);
550 + priv->rpivid_mem_cdev.owner = THIS_MODULE;
551 + err = cdev_add(&priv->rpivid_mem_cdev, priv->devid, 1);
552 + if (err != 0) {
553 + dev_err(priv->dev, "unable to register device");
554 + goto failed_cdev_add;
555 + }
556 +
557 + /* Create sysfs entries */
558 +
559 + priv->class = class_create(THIS_MODULE, priv->name);
560 + ptr_err = priv->class;
561 + if (IS_ERR(ptr_err))
562 + goto failed_class_create;
563 +
564 + rpivid_mem_dev = device_create(priv->class, NULL,
565 + priv->devid, NULL,
566 + priv->name);
567 + ptr_err = rpivid_mem_dev;
568 + if (IS_ERR(ptr_err))
569 + goto failed_device_create;
570 +
571 + dev_info(priv->dev, "%s initialised: Registers at 0x%08lx length 0x%08lx",
572 + priv->name, priv->regs_phys, priv->mem_window_len);
573 +
574 + return 0;
575 +
576 +failed_device_create:
577 + class_destroy(priv->class);
578 +failed_class_create:
579 + cdev_del(&priv->rpivid_mem_cdev);
580 + err = PTR_ERR(ptr_err);
581 +failed_cdev_add:
582 + unregister_chrdev_region(priv->devid, 1);
583 +failed_alloc_chrdev:
584 +failed_get_resource:
585 + kfree(priv);
586 +failed_inst_alloc:
587 + dev_err(priv->dev, "could not load rpivid_mem");
588 + return err;
589 +}
590 +
591 +static int rpivid_mem_remove(struct platform_device *pdev)
592 +{
593 + struct device *dev = &pdev->dev;
594 + struct rpivid_mem_priv *priv = platform_get_drvdata(pdev);
595 +
596 + device_destroy(priv->class, priv->devid);
597 + class_destroy(priv->class);
598 + cdev_del(&priv->rpivid_mem_cdev);
599 + unregister_chrdev_region(priv->devid, 1);
600 + kfree(priv);
601 +
602 + dev_info(dev, "%s driver removed - OK", priv->name);
603 + return 0;
604 +}
605 +
606 +static const struct of_device_id rpivid_mem_of_match[] = {
607 + {
608 + .compatible = "raspberrypi,rpivid-hevc-decoder",
609 + .data = "rpivid-hevcmem",
610 + },
611 + {
612 + .compatible = "raspberrypi,rpivid-h264-decoder",
613 + .data = "rpivid-h264mem",
614 + },
615 + {
616 + .compatible = "raspberrypi,rpivid-vp9-decoder",
617 + .data = "rpivid-vp9mem",
618 + },
619 + /* The "intc" is included as this block of hardware contains the
620 + * "frame done" status flags.
621 + */
622 + {
623 + .compatible = "raspberrypi,rpivid-local-intc",
624 + .data = "rpivid-intcmem",
625 + },
626 + { /* sentinel */ },
627 +};
628 +
629 +MODULE_DEVICE_TABLE(of, rpivid_mem_of_match);
630 +
631 +static struct platform_driver rpivid_mem_driver = {
632 + .probe = rpivid_mem_probe,
633 + .remove = rpivid_mem_remove,
634 + .driver = {
635 + .name = DRIVER_NAME,
636 + .owner = THIS_MODULE,
637 + .of_match_table = rpivid_mem_of_match,
638 + },
639 +};
640 +
641 +module_platform_driver(rpivid_mem_driver);
642 +
643 +MODULE_ALIAS("platform:rpivid-mem");
644 +MODULE_LICENSE("GPL");
645 +MODULE_DESCRIPTION("Driver for accessing RPiVid decoder registers from userspace");
646 +MODULE_AUTHOR("Jonathan Bell <jonathan@raspberrypi.org>");
647 --- a/drivers/mfd/bcm2835-pm.c
648 +++ b/drivers/mfd/bcm2835-pm.c
649 @@ -50,14 +50,14 @@ static int bcm2835_pm_probe(struct platf
650 if (ret)
651 return ret;
652
653 - /* Map the ARGON ASB regs if present. */
654 + /* Map the RPiVid ASB regs if present. */
655 res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
656 if (res) {
657 - pm->arg_asb = devm_ioremap_resource(dev, res);
658 - if (IS_ERR(pm->arg_asb)) {
659 - dev_err(dev, "Failed to map ARGON ASB: %ld\n",
660 - PTR_ERR(pm->arg_asb));
661 - return PTR_ERR(pm->arg_asb);
662 + pm->rpivid_asb = devm_ioremap_resource(dev, res);
663 + if (IS_ERR(pm->rpivid_asb)) {
664 + dev_err(dev, "Failed to map RPiVid ASB: %ld\n",
665 + PTR_ERR(pm->rpivid_asb));
666 + return PTR_ERR(pm->rpivid_asb);
667 }
668 }
669
670 --- a/drivers/soc/bcm/bcm2835-power.c
671 +++ b/drivers/soc/bcm/bcm2835-power.c
672 @@ -637,15 +637,15 @@ static int bcm2835_power_probe(struct pl
673 power->base = pm->base;
674 power->asb = pm->asb;
675
676 - /* 2711 hack: the new ARGON ASB took over V3D, which is our
677 + /* 2711 hack: the new RPiVid ASB took over V3D, which is our
678 * only consumer of this driver so far. The old ASB seems to
679 * still be present with ISP and H264 bits but no V3D, but I
680 * don't know if that's real or not. The V3D is in the same
681 * place in the new ASB as the old one, so just poke the new
682 * one for now.
683 */
684 - if (pm->arg_asb) {
685 - power->asb = pm->arg_asb;
686 + if (pm->rpivid_asb) {
687 + power->asb = pm->rpivid_asb;
688 power->is_2711 = true;
689 }
690
691 --- a/include/linux/mfd/bcm2835-pm.h
692 +++ b/include/linux/mfd/bcm2835-pm.h
693 @@ -9,7 +9,7 @@ struct bcm2835_pm {
694 struct device *dev;
695 void __iomem *base;
696 void __iomem *asb;
697 - void __iomem *arg_asb;
698 + void __iomem *rpivid_asb;
699 };
700
701 #endif /* BCM2835_MFD_PM_H */