Commit 3322f47b authored by Miguel Gómez Sexto's avatar Miguel Gómez Sexto

Added new zio trigger file

Signed-off-by: Miguel Gómez Sexto's avatarMiguel Gomez <magomez@igalia.com>
parent 6b163dea
......@@ -11,7 +11,7 @@ ccflags-y = -I$(ZIO)/include -I$(SPEC_SW)/kernel -I$M -I$(SPEC_SW)/kernel/includ
subdirs-ccflags-y = $(ccflags-y)
obj-m := spec-tdc.o
obj-m := spec-tdc.o zio-trig-tdc.o
spec-tdc-objs = tdc-core.o tdc-zio.o tdc-fmc.o tdc-acam.o tdc-dma.o
......
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/zio.h>
#include <linux/zio-sysfs.h>
#include <linux/zio-buffer.h>
#include <linux/zio-trigger.h>
#define ZTT_DEFAULT_BLOCK_SIZE 16
static DEFINE_ZATTR_STD(TRIG, ztt_std_attr) = {
ZATTR_REG(trig, ZATTR_TRIG_NSAMPLES, S_IRUGO | S_IWUGO,
0 /* no addr needed */, ZTT_DEFAULT_BLOCK_SIZE),
};
int ztt_conf_set(struct device *dev, struct zio_attribute *zattr,
uint32_t usr_val)
{
zattr->value = usr_val;
return 0;
}
struct zio_sysfs_operations ztt_s_ops = {
.conf_set = ztt_conf_set,
};
static struct zio_ti *ztt_create(struct zio_trigger_type *trig,
struct zio_cset *cset,
struct zio_control *ctrl, fmode_t flags)
{
struct zio_ti *ti;
ti = kzalloc(sizeof(*ti), GFP_KERNEL);
if (!ti)
return ERR_PTR(-ENOMEM);
return ti;
}
static void ztt_destroy(struct zio_ti *ti)
{
kfree(ti);
}
static const struct zio_trigger_operations ztt_trigger_ops = {
.create = ztt_create,
.destroy = ztt_destroy,
};
static struct zio_trigger_type ztt_trigger = {
.owner = THIS_MODULE,
.zattr_set = {
.std_zattr = ztt_std_attr,
},
.s_op = &ztt_s_ops,
.t_op = &ztt_trigger_ops,
};
static int zio_trig_tdc_init(void)
{
return zio_register_trig(&ztt_trigger, "tdc");
}
static void zio_trig_tdc_exit(void)
{
zio_unregister_trig(&ztt_trigger);
}
module_init(zio_trig_tdc_init);
module_exit(zio_trig_tdc_exit);
MODULE_LICENSE("GPL");
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