kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* SOC: Zedboard: Driver question
@ 2014-06-12 13:39 amit mehta
  2014-06-12 13:52 ` priyaranjan
  2014-06-13 13:13 ` Josh Cartwright
  0 siblings, 2 replies; 6+ messages in thread
From: amit mehta @ 2014-06-12 13:39 UTC (permalink / raw)
  To: kernelnewbies

We are working on a school project in which we are trying to develop a
audio mixer
on Zedboard (Development board from Digilent). We have developed the IP and have
integrated it with the overall hardware using Programmable logic. This
board has ARM
core. We have a Digilent pre-configured Linux source which we cross-compiled
for ARM board, device tree blob and bootloader for Zync(BOOT.BIN). The system
boots fine with Linux, but now to expose the recently added hardware
implementation
of audio mixer, we are trying to develop the driver using the platform
driver API.
Currently, In our reconfigurable hardware, we have 2 channels and a mixer and we
want to access those individually as some file nodes under /proc FS. The sample
code is shown below:

<snip from myiir.c>
/* device match table to match with device node in device tree
 * These are the list of devices that we want to expose as platform device
 */
static const struct of_device_id myiir_of_match[] __devinitconst = {
        {.compatible = "dglnt,myiir-audio-ch0"},
        {.compatible = "dglnt,myiir-audio-ch1"},
        {.compatible = "dglnt,myiir-audio-mix0"},
        {},
};

MODULE_DEVICE_TABLE(of, myiir_of_match);

/* platform driver structure for myiir driver */
static struct platform_driver myiir_driver = {
        .driver = {
                .name = DRIVER_NAME,
                .owner = THIS_MODULE,
                .of_match_table = myiir_of_match},
        .probe = myiir_probe,
        .remove = __devexit_p(myiir_remove),
        .shutdown = __devexit_p(myiir_shutdown)
};

/* Register myiir platform driver */
module_platform_driver(myiir_driver);
<myiir.c>

Now, inside the probe routine (myiir_probe), can we create proc
entries by calling
create_proc for each of these nodes and setting the appropriate read and write
methods(file_operations) ?

<snip from the myiir_probe>
struct proc_dir_entry *myiir_proc_entry[3];

myiir_proc_entry[0] = proc_create("myiir-audio-ch0", 0, NULL,
                &proc_myiir_ch0_operations);

myiir_proc_entry[1] = proc_create("myiir-audio-ch1", 0, NULL,
                &proc_myiir_ch1_operations);

myiir_proc_entry[2] = proc_create("myiir-audio-mix0", 0, NULL,
                &proc_myiir_mix0_operations);

<snip from the myiir_probe>

While browsing the Internet, we found some sample driver code, which we are
also using as a template. I've attached the driver that is based on
the same template.

<snip from device tree file>
myiir-aud-ch0 {
            compatible = "dglnt,myiir-audio-ch0";
            reg = <0x74200000 0x10000>;
        };
        myiir-aud-ch1 {
            compatible = "dglnt,myiir-audio-ch1";
            reg = <0x74220000 0x10000>;
        };
        myiir-aud-mix0 {
            compatible = "dglnt,myiir-audio-mix0";
            reg = <0x68600000 0x10000>;
        };
<snip from device tree file>

The driver is far from complete, but as of now the compilation woks fine.
<snip>
user at fpga4v:~/tutorial/IIRdriver$ make ARCH=arm
CROSS_COMPILE=arm-xilinx-linux-gnueabi-
make -C ../linux-digilent-3.6-digilent-13.01/
M=/home/user/tutorial/IIRdriver modules
make[1]: Entering directory
`/home/user/tutorial/linux-digilent-3.6-digilent-13.01'
  CC [M]  /home/user/tutorial/IIRdriver/myiir.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/user/tutorial/IIRdriver/myiir.mod.o
  LD [M]  /home/user/tutorial/IIRdriver/myiir.ko
make[1]: Leaving directory
`/home/user/tutorial/linux-digilent-3.6-digilent-13.01'
<snip>

Thanks,
Kumar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: myiir.c
Type: text/x-csrc
Size: 6753 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140612/03e15d80/attachment.bin 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-06-18  6:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-12 13:39 SOC: Zedboard: Driver question amit mehta
2014-06-12 13:52 ` priyaranjan
2014-06-12 14:43   ` amit mehta
2014-06-12 16:10     ` priyaranjan
2014-06-13 13:13 ` Josh Cartwright
2014-06-18  6:01   ` sanjeev sharma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).