11/**
2- * argon -mem.c - character device access to the Argon decoder registers
2+ * rpivid -mem.c - character device access to the RPiVid decoder registers
33 *
44 * Based on bcm2835-gpiomem.c. Provides IO memory access to the decoder
55 * register blocks such that ffmpeg plugins can access the hardware.
4848#include <linux/pagemap.h>
4949#include <linux/io.h>
5050
51- #define DRIVER_NAME "argon -mem"
51+ #define DRIVER_NAME "rpivid -mem"
5252#define DEVICE_MINOR 0
5353
54- struct argon_mem_priv {
54+ struct rpivid_mem_priv {
5555 dev_t devid ;
5656 struct class * class ;
57- struct cdev argon_mem_cdev ;
57+ struct cdev rpivid_mem_cdev ;
5858 unsigned long regs_phys ;
5959 unsigned long mem_window_len ;
6060 struct device * dev ;
6161 const char * name ;
6262};
6363
64- static int argon_mem_open (struct inode * inode , struct file * file )
64+ static int rpivid_mem_open (struct inode * inode , struct file * file )
6565{
6666 int dev = iminor (inode );
6767 int ret = 0 ;
68- struct argon_mem_priv * priv ;
68+ struct rpivid_mem_priv * priv ;
6969 if (dev != DEVICE_MINOR )
7070 ret = - ENXIO ;
7171
72- priv = container_of (inode -> i_cdev , struct argon_mem_priv ,
73- argon_mem_cdev );
72+ priv = container_of (inode -> i_cdev , struct rpivid_mem_priv ,
73+ rpivid_mem_cdev );
7474 if (!priv )
7575 return - EINVAL ;
7676 file -> private_data = priv ;
7777 return ret ;
7878}
7979
80- static int argon_mem_release (struct inode * inode , struct file * file )
80+ static int rpivid_mem_release (struct inode * inode , struct file * file )
8181{
8282 int dev = iminor (inode );
8383 int ret = 0 ;
@@ -88,15 +88,15 @@ static int argon_mem_release(struct inode *inode, struct file *file)
8888 return ret ;
8989}
9090
91- static const struct vm_operations_struct argon_mem_vm_ops = {
91+ static const struct vm_operations_struct rpivid_mem_vm_ops = {
9292#ifdef CONFIG_HAVE_IOREMAP_PROT
9393 .access = generic_access_phys
9494#endif
9595};
9696
97- static int argon_mem_mmap (struct file * file , struct vm_area_struct * vma )
97+ static int rpivid_mem_mmap (struct file * file , struct vm_area_struct * vma )
9898{
99- struct argon_mem_priv * priv ;
99+ struct rpivid_mem_priv * priv ;
100100 unsigned long pages ;
101101
102102 priv = file -> private_data ;
@@ -108,7 +108,7 @@ static int argon_mem_mmap(struct file *file, struct vm_area_struct *vma)
108108 vma -> vm_page_prot = phys_mem_access_prot (file , pages ,
109109 priv -> mem_window_len ,
110110 vma -> vm_page_prot );
111- vma -> vm_ops = & argon_mem_vm_ops ;
111+ vma -> vm_ops = & rpivid_mem_vm_ops ;
112112 if (remap_pfn_range (vma , vma -> vm_start ,
113113 pages ,
114114 priv -> mem_window_len ,
@@ -119,28 +119,28 @@ static int argon_mem_mmap(struct file *file, struct vm_area_struct *vma)
119119}
120120
121121static const struct file_operations
122- argon_mem_fops = {
122+ rpivid_mem_fops = {
123123 .owner = THIS_MODULE ,
124- .open = argon_mem_open ,
125- .release = argon_mem_release ,
126- .mmap = argon_mem_mmap ,
124+ .open = rpivid_mem_open ,
125+ .release = rpivid_mem_release ,
126+ .mmap = rpivid_mem_mmap ,
127127};
128128
129- static const struct of_device_id argon_mem_of_match [];
130- static int argon_mem_probe (struct platform_device * pdev )
129+ static const struct of_device_id rpivid_mem_of_match [];
130+ static int rpivid_mem_probe (struct platform_device * pdev )
131131{
132132 int err ;
133133 void * ptr_err ;
134134 const struct of_device_id * id ;
135135 struct device * dev = & pdev -> dev ;
136- struct device * argon_mem_dev ;
136+ struct device * rpivid_mem_dev ;
137137 struct resource * ioresource ;
138- struct argon_mem_priv * priv ;
138+ struct rpivid_mem_priv * priv ;
139139
140140
141141 /* Allocate buffers and instance data */
142142
143- priv = kzalloc (sizeof (struct argon_mem_priv ), GFP_KERNEL );
143+ priv = kzalloc (sizeof (struct rpivid_mem_priv ), GFP_KERNEL );
144144
145145 if (!priv ) {
146146 err = - ENOMEM ;
@@ -149,7 +149,7 @@ static int argon_mem_probe(struct platform_device *pdev)
149149 platform_set_drvdata (pdev , priv );
150150
151151 priv -> dev = dev ;
152- id = of_match_device (argon_mem_of_match , dev );
152+ id = of_match_device (rpivid_mem_of_match , dev );
153153 if (!id )
154154 return - EINVAL ;
155155 priv -> name = id -> data ;
@@ -172,9 +172,9 @@ static int argon_mem_probe(struct platform_device *pdev)
172172 dev_err (priv -> dev , "unable to allocate device number" );
173173 goto failed_alloc_chrdev ;
174174 }
175- cdev_init (& priv -> argon_mem_cdev , & argon_mem_fops );
176- priv -> argon_mem_cdev .owner = THIS_MODULE ;
177- err = cdev_add (& priv -> argon_mem_cdev , priv -> devid , 1 );
175+ cdev_init (& priv -> rpivid_mem_cdev , & rpivid_mem_fops );
176+ priv -> rpivid_mem_cdev .owner = THIS_MODULE ;
177+ err = cdev_add (& priv -> rpivid_mem_cdev , priv -> devid , 1 );
178178 if (err != 0 ) {
179179 dev_err (priv -> dev , "unable to register device" );
180180 goto failed_cdev_add ;
@@ -187,10 +187,10 @@ static int argon_mem_probe(struct platform_device *pdev)
187187 if (IS_ERR (ptr_err ))
188188 goto failed_class_create ;
189189
190- argon_mem_dev = device_create (priv -> class , NULL ,
190+ rpivid_mem_dev = device_create (priv -> class , NULL ,
191191 priv -> devid , NULL ,
192192 priv -> name );
193- ptr_err = argon_mem_dev ;
193+ ptr_err = rpivid_mem_dev ;
194194 if (IS_ERR (ptr_err ))
195195 goto failed_device_create ;
196196
@@ -202,76 +202,71 @@ static int argon_mem_probe(struct platform_device *pdev)
202202failed_device_create :
203203 class_destroy (priv -> class );
204204failed_class_create :
205- cdev_del (& priv -> argon_mem_cdev );
205+ cdev_del (& priv -> rpivid_mem_cdev );
206206 err = PTR_ERR (ptr_err );
207207failed_cdev_add :
208208 unregister_chrdev_region (priv -> devid , 1 );
209209failed_alloc_chrdev :
210210failed_get_resource :
211211 kfree (priv );
212212failed_inst_alloc :
213- dev_err (priv -> dev , "could not load argon_mem " );
213+ dev_err (priv -> dev , "could not load rpivid_mem " );
214214 return err ;
215215}
216216
217- static int argon_mem_remove (struct platform_device * pdev )
217+ static int rpivid_mem_remove (struct platform_device * pdev )
218218{
219219 struct device * dev = & pdev -> dev ;
220- struct argon_mem_priv * priv = platform_get_drvdata (pdev );
220+ struct rpivid_mem_priv * priv = platform_get_drvdata (pdev );
221221
222222 device_destroy (priv -> class , priv -> devid );
223223 class_destroy (priv -> class );
224- cdev_del (& priv -> argon_mem_cdev );
224+ cdev_del (& priv -> rpivid_mem_cdev );
225225 unregister_chrdev_region (priv -> devid , 1 );
226226 kfree (priv );
227227
228228 dev_info (dev , "%s driver removed - OK" , priv -> name );
229229 return 0 ;
230230}
231231
232- static const char argon_hevc_name [] = "argon-hevcmem" ;
233- static const char argon_h264_name [] = "argon-h264mem" ;
234- static const char argon_vp9_name [] = "argon-vp9mem" ;
235- static const char argon_intc_name [] = "argon-intcmem" ;
236-
237- static const struct of_device_id argon_mem_of_match [] = {
232+ static const struct of_device_id rpivid_mem_of_match [] = {
238233 {
239- .compatible = "raspberrypi,argon -hevc-decoder" ,
240- .data = & argon_hevc_name ,
234+ .compatible = "raspberrypi,rpivid -hevc-decoder" ,
235+ .data = "rpivid-hevcmem" ,
241236 },
242237 {
243- .compatible = "raspberrypi,argon -h264-decoder" ,
244- .data = & argon_h264_name ,
238+ .compatible = "raspberrypi,rpivid -h264-decoder" ,
239+ .data = "rpivid-h264mem" ,
245240 },
246241 {
247- .compatible = "raspberrypi,argon -vp9-decoder" ,
248- .data = & argon_vp9_name ,
242+ .compatible = "raspberrypi,rpivid -vp9-decoder" ,
243+ .data = "rpivid-vp9mem" ,
249244 },
250245 /* The "intc" is included as this block of hardware contains the
251246 * "frame done" status flags.
252247 */
253248 {
254- .compatible = "raspberrypi,argon -local-intc" ,
255- .data = & argon_intc_name ,
249+ .compatible = "raspberrypi,rpivid -local-intc" ,
250+ .data = "rpivid-intcmem" ,
256251 },
257252 { /* sentinel */ },
258253};
259254
260- MODULE_DEVICE_TABLE (of , argon_mem_of_match );
255+ MODULE_DEVICE_TABLE (of , rpivid_mem_of_match );
261256
262- static struct platform_driver argon_mem_driver = {
263- .probe = argon_mem_probe ,
264- .remove = argon_mem_remove ,
257+ static struct platform_driver rpivid_mem_driver = {
258+ .probe = rpivid_mem_probe ,
259+ .remove = rpivid_mem_remove ,
265260 .driver = {
266261 .name = DRIVER_NAME ,
267262 .owner = THIS_MODULE ,
268- .of_match_table = argon_mem_of_match ,
263+ .of_match_table = rpivid_mem_of_match ,
269264 },
270265};
271266
272- module_platform_driver (argon_mem_driver );
267+ module_platform_driver (rpivid_mem_driver );
273268
274- MODULE_ALIAS ("platform:argon -mem" );
269+ MODULE_ALIAS ("platform:rpivid -mem" );
275270MODULE_LICENSE ("GPL" );
276- MODULE_DESCRIPTION ("Driver for accessing Argon decoder registers from userspace" );
271+ MODULE_DESCRIPTION ("Driver for accessing RPiVid decoder registers from userspace" );
277272MODULE_AUTHOR ("Jonathan Bell <jonathan@raspberrypi.org>" );
0 commit comments