1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2015-2017 Pengutronix, Uwe Kleine-König <kernel@pengutronix.de>
5 #include <linux/kernel.h>
6 #include <linux/kthread.h>
7 #include <linux/siox.h>
9 #define to_siox_master(_dev) container_of((_dev), struct siox_master, dev)
11 /* these fields should be initialized by the driver */
13 int (*pushpull
)(struct siox_master
*smaster
,
14 size_t setbuf_len
, const u8 setbuf
[],
15 size_t getbuf_len
, u8 getbuf
[]);
17 /* might be initialized by the driver, if 0 it is set to HZ / 40 */
18 unsigned long poll_interval
; /* in jiffies */
20 /* framework private stuff */
25 unsigned int num_devices
;
26 struct list_head devices
;
28 size_t setbuf_len
, getbuf_len
;
33 unsigned long last_poll
;
34 struct task_struct
*poll_thread
;
37 static inline void *siox_master_get_devdata(struct siox_master
*smaster
)
39 return dev_get_drvdata(&smaster
->dev
);
42 struct siox_master
*siox_master_alloc(struct device
*dev
, size_t size
);
43 static inline void siox_master_put(struct siox_master
*smaster
)
45 put_device(&smaster
->dev
);
48 int siox_master_register(struct siox_master
*smaster
);
49 void siox_master_unregister(struct siox_master
*smaster
);