Commit 0db88006 authored by Alessandro Rubini's avatar Alessandro Rubini

kernel: incompatible change: rename all stuff

Unfortunately, fmc-adc is too generic a module name, because we may
expect to have different ADC cards in the same VME rack, at a later
time (and all of them are fmc-adc, in a way).

Also, hardwiring the gateware name as "fmc/spec-fmc-adc-v1.1.bin" is
too specific -- what if 1.2 is a simple fix?

So, the gateware name is a simpler "fmc/adc-100m14b.bin" (which should
be hardware-specific enough while not including a version number.

The module is called fmc-adc-100m14b.ko.

The zio device name is "adc-100m14b" (the fmc- prefix would overflow
the 12-byte maximum device length -- forced by the control structure).
The trigger uses the same name (it's a separate namespace anyways.

This commit trivially updates the manual so all pathnames shown are
correct, leaving a serious manual review to a later time.
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 66881887
......@@ -119,8 +119,8 @@ carrier card.
@node Gateware Dependencies
@section Gateware Dependencies
This driver has been developed from the FPGA binary included in the package
as @file{binaries/spec-fmc-adc-v1.0.bin}.
This driver has been developed from the FPGA binary included in the package,
as a @t{.bin} file in the @file{binaries/} subdir.
The driver repository always include the last binary version used during
development. It can happen that the binary within this package become out
......@@ -134,8 +134,8 @@ To install the FPGA image in the target system, please follow the
instruction in the documentation of @i{fmc-bus}.
To summarize, you'll need to place the @t{.bin} file in @file{/lib/firmware/}.
By default, the driver looks for @t{fmc/spec-fmc-adc-v1.0.bin}@footnote{the full
path will be @file{/lib/firmware/fmc/spec-fmc-adc-v1.0.bin}}. You
By default, the driver looks for @t{fmc/adc-100m14b.bin}@footnote{the full
path will be @file{/lib/firmware/fmc/adc-100m14b.bin}}. You
can find the copy of the last tested binary within the driver repository.
Anyway, you are free to use a different binary for your
ADC and you can load it by specifying the module parameter @t{file}.
......@@ -187,7 +187,7 @@ run:
sudo make install LINUX=$LINUX
@end example
In addition to the normal installation procedure for @code{fmc-adc.ko}
In addition to the normal installation procedure for @code{fmc-adc-100m14b.ko}
you'll see the following message:
@example
......@@ -235,7 +235,7 @@ The following parameters are used:
@table @code
@item file=/path/to/binary.bin
The binary file to use to reprogram the FPGA. The default value for this
parameter is @t{fmc/spec-fmc-adc-v1.0.bin} as seen in @ref{Gateware Installation}.
parameter is @t{fmc/adc-100m14b.bin} as seen in @ref{Gateware Installation}.
The path to binary is the relative path from @file{/lib/firmware}
@item enable_test_data=1
This is for testing purpose. This option enables the testing data, so the ADC
......@@ -328,19 +328,20 @@ the cset.
@end float
The ADC registers can be accessed in the proper @i{sysfs} directory. For a
card in slot 0 of bus 1 (like shown above), the directory is
@i{/sys/bus/zio/devices/fmc-adc-0100}.
card in slot 0 of bus 2 (like shown above), the directory is
@i{/sys/bus/zio/devices/adc-100m14b-0200}.
The overall device (@i{fmc-adc}) has not any particular capabilities because
the main features are handled by @i{cset0} and @i{trigger}. So, there are
not any device-wide attribute, there are only the ZIO's default attributes.
@smallexample
# ls -Ff /sys/bus/zio/devices/fmc-adc-0100/
# ls -Ff /sys/bus/zio/devices/adc-100m14b-0200/
./ name devtype power/ subsystem@ uevent
../ devname cset0/ enable temperature
@end smallexample
@c FIXME: ``driver@'' missing above.
@c FIXME better explaination
@c The @{temperature} attribute is read-only. It returns the temperature of the
......@@ -355,7 +356,7 @@ ADC state machine, the acquisition and the time stamp.
@smallexample
# ls -Ff /sys/bus/zio/devices/fmc-adc-0100/cset0/
# ls -Ff /sys/bus/zio/devices/adc-100m14b-0200/cset0/
./ chani/ ch0-vref tstamp-acq-str-t
../ power/ ch1-vref ch3-vref
name fsm-command tstamp-acq-end-b ch3-offset
......@@ -373,7 +374,7 @@ The @b{resolution-bits} attribute is read-only and it returns the
number of bits of the ADC:
@smallexample
corinno-test:~# cat /sys/bus/zio/devices/fmc-adc-0100/cset0/resolution-bits
corinno-test:~# cat /sys/bus/zio/devices/adc-100m14b-0200/cset0/resolution-bits
14
@end smallexample
......@@ -381,7 +382,7 @@ The @b{rst-ch-offset} attribute is write-only. When you write on it, the
driver reset the offset of all channels.
@smallexample
corinno-test:~# echo 0 > /sys/bus/zio/devices/fmc-adc-0100/cset0/rst-ch-offset
corinno-test:~# echo 0 > /sys/bus/zio/devices/adc-100m14b-0200/cset0/rst-ch-offset
@end smallexample
@c --------------------------------------------------------------------------
......@@ -395,7 +396,7 @@ ADC export offset, volt-reference and termination for each channel in the
channel-set layer:
@smallexample
# ls /sys/bus/zio/devices/fmc-adc-0100/cset0/ | grep ch.-
# ls /sys/bus/zio/devices/adc-100m14b-0200/cset0/ | grep ch.-
ch0-50ohm-term
ch0-offset
ch0-vref
......@@ -411,11 +412,12 @@ ch3-vref
@end smallexample
The @b{*-offset} attribute is read/write. It allows to configure the offset of
the signal on the channel. When you write a value to this attribute, the driver
the signal on the channel. The value is expressed in millivolts, in
the range [-5000,5000]. When you write a value to this attribute, the driver
apply your value to a DAC which apply an offset to the input signal.
@smallexample
# echo 50 > /sys/bus/zio/devices/fmc-adc-0100/cset0/ch0-offset
# echo 1000 > /sys/bus/zio/devices/adc-100m14b-0200/cset0/ch0-offset
@end smallexample
The @b{*-vref} attribute is read/write. It allow you to change the Volt
......@@ -423,14 +425,14 @@ reference of the ADC; the attribute accepts only 4 value: @i{0} (open range),
@i{35} ([-100mV; +100mV), @i{17} ([-1V; +1V]), @i{69} ([-10V; +10V]).
@smallexample
# echo 17 > /sys/bus/zio/devices/fmc-adc-0100/cset0/ch0-vref
# echo 17 > /sys/bus/zio/devices/adc-100m14b-0200/cset0/ch0-vref
@end smallexample
The @b{*-50ohm-term} attirbute is read/write. It allow to enable (1) or
disable (0) the 50Ohm termination.
@smallexample
# echo 1 > /sys/bus/zio/devices/fmc-adc-0100/cset0/ch0-50ohm-term
# echo 1 > /sys/bus/zio/devices/adc-100m14b-0200/cset0/ch0-50ohm-term
@end smallexample
@c --------------------------------------------------------------------------
......@@ -444,7 +446,7 @@ The @b{sample-decimation} attribute is read/write. It configures the number
of sample to drop. You can use value between 1 and 65535.
@smallexample
# echo 4 > /sys/bus/zio/devices/fmc-adc-0100/cset0/sample-decimation
# echo 4 > /sys/bus/zio/devices/adc-100m14b-0200/cset0/sample-decimation
@end smallexample
The value to write on decimation mean the number of sample to acquire for
......@@ -480,7 +482,7 @@ current state of the state machine. In the following example, the state
machine is in the status @i{idle}
@smallexample
# cat /sys/bus/zio/devices/fmc-adc-0100/cset0/fsm-state
# cat /sys/bus/zio/devices/adc-100m14b-0200/cset0/fsm-state
1
@end smallexample
......@@ -494,7 +496,7 @@ acquisition. You cannot acquire if you don't start the state machine. To
start the state machine you must use the following command:
@smallexample
# echo 1 > /sys/bus/zio/devices/fmc-adc-0100/cset0/fsm-command
# echo 1 > /sys/bus/zio/devices/adc-100m14b-0200/cset0/fsm-command
@end smallexample
If the state machine started, the green LED @i{ACQ} on the front panel of the
......@@ -504,7 +506,7 @@ If you want to abort the current acquisition you must send the
@i{stop} command to the state machine.
@smallexample
# echo 2 > /sys/bus/zio/devices/fmc-adc-0100/cset0/fsm-command
# echo 2 > /sys/bus/zio/devices/adc-100m14b-0200/cset0/fsm-command
@end smallexample
When the state machine is stopped, the @i{ACQ} LED turns off. When you send
......@@ -537,9 +539,9 @@ attributes named: second (s), ticks (t) and bins (b). For example, to read
the entire timestamp of the state machin start event you should do:
@smallexample
# cat /sys/bus/zio/devices/fmc-adc-0100/cset0/tstamp-acq-str-s
# cat /sys/bus/zio/devices/fmc-adc-0100/cset0/tstamp-acq-str-t
# cat /sys/bus/zio/devices/fmc-adc-0100/cset0/tstamp-acq-str-b
# cat /sys/bus/zio/devices/adc-100m14b-0200/cset0/tstamp-acq-str-s
# cat /sys/bus/zio/devices/adc-100m14b-0200/cset0/tstamp-acq-str-t
# cat /sys/bus/zio/devices/adc-100m14b-0200/cset0/tstamp-acq-str-b
@end smallexample
Seconds represents the number of second since the epoch; ticks is the
......@@ -555,16 +557,16 @@ The ADC has 4 input channels. Each channel has one attribute with the last
acquired sample @i{current-value}.
@smallexample
# ls -fF /sys/bus/zio/devices/fmc-adc-0100/cset0/chan0/
# ls -fF /sys/bus/zio/devices/adc-100m14b-0200/cset0/chan0/
./ ../ name power/ current-value buffer/ enable current-control uevent
@end smallexample
@c FIXME: missing devname, devtype, alarm, address
The @b{current-value} attribute is read only. It returns the last converted
value on the channel.
@smallexample
# cat /sys/bus/zio/devices/fmc-adc-0100/cset0/chan0/current-value
# cat /sys/bus/zio/devices/adc-100m14b-0200/cset0/chan0/current-value
32860
@end smallexample
......@@ -573,17 +575,18 @@ value on the channel.
@section The Trigger
The ADC has its own @i{zio_trigger_type} and it can not work with any other
ZIO's trigger. The ADC trigger is named @b{fmc-adc-trg}. We advise you
ZIO's trigger. The ADC trigger is called @b{fmc-adc-trg}. We advise you
against replacing the trigger with another one. The sysfs directory of this
trigger is the following:
@smallexample
# ls -fF /sys/bus/zio/devices/fmc-adc-0100/cset0/trigger/
# ls -fF /sys/bus/zio/devices/adc-100m14b-0200/cset0/trigger/
./ external tstamp-trg-lst-t sw-trg-enable pre-samples
../ devtype delay enable sw-trg-fire
name tstamp-trg-lst-b power/ nshots post-samples
int-channel tstamp-trg-lst-s polarity uevent int-threshold
@end smallexample
@c FIXME: check list above
On the ADC there are two kind of trigger: hardware and software.
......@@ -600,7 +603,7 @@ of the hardware trigger on device. So, if you write 1 you enable the hardware
trigger, if you write 0 you disable the hardware trigger.
@smallexample
# echo 1 > /sys/bus/zio/devices/fmc-adc-0100/cset0/trigger/enable
# echo 1 > /sys/bus/zio/devices/adc-100m14b-0200/cset0/trigger/enable
@end smallexample
The attribute @b{external} can be used to select the @i{internal trigger}
......@@ -608,7 +611,7 @@ or the @i{external trigger}. You must write 1 to select the external trigger,
0 to select the internal trigger.
@smallexample
# echo 1 > /sys/bus/zio/devices/fmc-adc-0100/cset0/trigger/external
# echo 1 > /sys/bus/zio/devices/adc-100m14b-0200/cset0/trigger/external
@end smallexample
With the attribute @b{polarity} you can configure if the trigger fire on a
......@@ -617,7 +620,7 @@ edge/slope you must write 0 on this attribute, otherwise 1 for a negative
edge/slope.
@smallexample
# echo 1 > /sys/bus/zio/devices/fmc-adc-0100/cset0/trigger/polarity
# echo 1 > /sys/bus/zio/devices/adc-100m14b-0200/cset0/trigger/polarity
@end smallexample
......@@ -670,13 +673,13 @@ dinamically change the buffer to use. If you want to use the @i{kmalloc}
buffer you must write:
@smallexample
# echo kmalloc > /sys/bus/zio/devices/fmc-adc-0100/cset0/current_buffer
# echo kmalloc > /sys/bus/zio/devices/adc-100m14b-0200/cset0/current_buffer
@end smallexample
To restore the @i{vmalloc} buffer:
@smallexample
# echo vmalloc > /sys/bus/zio/devices/fmc-adc-0100/cset0/current_buffer
# echo vmalloc > /sys/bus/zio/devices/adc-100m14b-0200/cset0/current_buffer
@end smallexample
@c ==========================================================================
......@@ -733,9 +736,10 @@ device interface creates only the char device for the interleaved acquisition.
@smallexample
# ls -l /dev/zio/
total 0
crw------- 1 root root 250, 8 Aug 23 22:21 fmc-adc-0100-0-i-ctrl
crw------- 1 root root 250, 9 Aug 23 22:21 fmc-adc-0100-0-i-data
crw------- 1 root root 250, 8 Aug 23 22:21 adc-100m14b-0200-0-i-ctrl
crw------- 1 root root 250, 9 Aug 23 22:21 adc-100m14b-0200-0-i-data
@end smallexample
@c FIXME check permission as shown
The actual pathnames depend on the version of @i{udev}, and the support
library tries both names (the new one shown above, and the older one,
......@@ -755,12 +759,12 @@ allow the driver to read only an interleaved block of samples.
Neither the ZIO core nor this driver split interleaved data into
4 different buffer; so, also the driver will return to user-space a
block of interleaved samples. To read this interleaved block you
can read directly the interleaved data char device @i{fmc-adc-0100-0-i-data}
can read directly the interleaved data char device @i{adc-100m14b-0200-0-i-data}
using simple program like @i{hexdump}@footnote{man hexdump if you do not
know this program}:
@smallexample
# hexdump -n 8 -e '"" 1/2 "%x\n"' /dev/zio/fmc-adc-0100-0-i-data
# hexdump -n 8 -e '"" 1/2 "%x\n"' /dev/zio/adc-100m14b-0200-0-i-data
fffc
e474
8034
......@@ -829,7 +833,7 @@ you want to configure the trigger to fire with an external pulse and to acquire
3 shots of 10 pre-samples and 100 post-samples, you must write:
@smallexample
# ./fau-trg-config --external --pre 10 --post 100 --re-enable 2 fmc-adc-0100
# ./fau-trg-config --external --pre 10 --post 100 --re-enable 2 adc-100m14b-0200
@end smallexample
The trigger is always active the first time, then you configure it to auto
......
......@@ -16,14 +16,14 @@ ccflags-y += -DDEBUG # temporary
subdirs-ccflags-y = $(ccflags-y)
obj-m := fmc-adc.o
fmc-adc-objs = fa-zio-drv.o
fmc-adc-objs += fa-core.o
fmc-adc-objs += fa-zio-trg.o
fmc-adc-objs += fa-dma.o
fmc-adc-objs += onewire.o
fmc-adc-objs += spi.o
fmc-adc-objs += fa-regtable.o
obj-m := fmc-adc-100m14b.o
fmc-adc-100m14b-objs = fa-core.o
fmc-adc-100m14b-objs += fa-zio-drv.o
fmc-adc-100m14b-objs += fa-regtable.o
fmc-adc-100m14b-objs += fa-zio-trg.o
fmc-adc-100m14b-objs += fa-dma.o
fmc-adc-100m14b-objs += onewire.o
fmc-adc-100m14b-objs += spi.o
all modules:
$(MAKE) -C $(LINUX) M=$(shell /bin/pwd) modules
......
/*
* core fmc-adc driver
* core fmc-adc-100m14b driver
*
* Copyright (C) 2012 CERN (www.cern.ch)
* Author: Federico Vaga <federico.vaga@gmail.com>
......@@ -127,6 +127,6 @@ module_init(fa_init);
module_exit(fa_exit);
MODULE_AUTHOR("Federico Vaga");
MODULE_DESCRIPTION("FMC-ADC Linux Driver");
MODULE_DESCRIPTION("FMC-ADC-100MS-14b Linux Driver");
MODULE_LICENSE("GPL");
MODULE_VERSION("0.8");
......@@ -1011,7 +1011,7 @@ static int zfad_zio_probe(struct zio_device *zdev)
fa->fmc->op->gpio_config(fa->fmc, zfat_gpio_cfg,
ARRAY_SIZE(zfat_gpio_cfg));
/* Request IRQ */
err = fa->fmc->op->irq_request(fa->fmc, zfad_irq, "fmc-adc",
err = fa->fmc->op->irq_request(fa->fmc, zfad_irq, "fmc-adc-100m14b",
IRQF_SHARED);
if (err)
dev_err(fa->fmc->hwdev, "can't request irq %i (err %i)\n",
......@@ -1111,21 +1111,21 @@ static struct zio_device zfad_tmpl = {
.ext_zattr = zfad_dev_ext_zattr,
.n_ext_attr = ARRAY_SIZE(zfad_dev_ext_zattr),
},
/* This driver work only with the fmc-adc-trg */
.preferred_trigger = "fmc-adc-trg",
/* This driver prefers its own trigger */
.preferred_trigger = "adc-100m14b",
.preferred_buffer = "vmalloc",
};
/* List of supported boards */
static const struct zio_device_id zfad_table[] = {
{"fmc-adc", &zfad_tmpl},
{"adc-100m14b", &zfad_tmpl},
{},
};
static struct zio_driver fa_zdrv = {
.driver = {
.name = "fmc-adc",
.name = "adc-100m14b",
.owner = THIS_MODULE,
},
.id_table = zfad_table,
......@@ -1199,9 +1199,10 @@ int fa_zio_init(struct fa_dev *fa)
}
/* Register our trigger hardware */
err = zio_register_trig(&zfat_type, "fmc-adc-trg");
err = zio_register_trig(&zfat_type, "adc-100m14b");
if (err) {
dev_err(hwdev, "Cannot register ZIO trigger fmc-adc-trig\n");
dev_err(hwdev, "Cannot register ZIO trigger type"
" \"adc-100m14b\"\n");
goto out_trg;
}
......@@ -1218,9 +1219,10 @@ int fa_zio_init(struct fa_dev *fa)
fa->hwzdev->priv_d = fa;
/* Register the hardware zio_device */
err = zio_register_device(fa->hwzdev, "fmc-adc", fa->fmc->device_id);
err = zio_register_device(fa->hwzdev, "adc-100m14b",
fa->fmc->device_id);
if (err) {
dev_err(hwdev, "Cannot register ZIO device fmc-adc\n");
dev_err(hwdev, "Cannot register ZIO device fmc-adc-100m14b\n");
goto out_dev;
}
return 0;
......
......@@ -12,7 +12,7 @@
#include <linux/zio.h>
#include "field-desc.h"
#define FA_GATEWARE_DEFAULT_NAME "fmc/spec-fmc-adc-v1.1.bin"
#define FA_GATEWARE_DEFAULT_NAME "fmc/adc-100m14b.bin"
extern int enable_auto_start;
/* ADC register offset */
......
......@@ -670,7 +670,7 @@ struct fmcadc_op fa_100ms_4ch_14bit_op = {
};
struct fmcadc_board_type fmcadc_100ms_4ch_14bit = {
.name = "fmcadc_100MS_4ch_14bit",
.devname = "fmc-adc",
.devname = "adc-100m14b",
.driver_type = "zio",
.capabilities = {
FMCADC_ZIO_TRG_MASK,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment