Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Copyright (C) 2015-2017 Pengutronix, Uwe Kleine-König <kernel@pengutronix.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/kthread.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/siox.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #define to_siox_master(_dev)	container_of((_dev), struct siox_master, dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) struct siox_master {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 	/* these fields should be initialized by the driver */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 	int busno;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	int (*pushpull)(struct siox_master *smaster,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 			size_t setbuf_len, const u8 setbuf[],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 			size_t getbuf_len, u8 getbuf[]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 	/* might be initialized by the driver, if 0 it is set to HZ / 40 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	unsigned long poll_interval; /* in jiffies */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	/* framework private stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	struct mutex lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	bool active;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	struct module *owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	struct device dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	unsigned int num_devices;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 	struct list_head devices;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	size_t setbuf_len, getbuf_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	size_t buf_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	u8 *buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	u8 status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	unsigned long last_poll;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	struct task_struct *poll_thread;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) static inline void *siox_master_get_devdata(struct siox_master *smaster)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	return dev_get_drvdata(&smaster->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) struct siox_master *siox_master_alloc(struct device *dev, size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) static inline void siox_master_put(struct siox_master *smaster)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	put_device(&smaster->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) int siox_master_register(struct siox_master *smaster);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) void siox_master_unregister(struct siox_master *smaster);