VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
ab15d248cc96d (Hans Verkuil 2018-02-07 09:05:46 -0500  1) /* SPDX-License-Identifier: GPL-2.0-only */
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300  2) /*
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300  3)  * cec-pin.h - low-level CEC pin control
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300  4)  *
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300  5)  * Copyright 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300  6)  */
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300  7) 
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300  8) #ifndef LINUX_CEC_PIN_H
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300  9) #define LINUX_CEC_PIN_H
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 10) 
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 11) #include <linux/types.h>
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 12) #include <media/cec.h>
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 13) 
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 14) /**
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 15)  * struct cec_pin_ops - low-level CEC pin operations
e5ad7db4b2f35 (Hans Verkuil 2020-04-21 11:23:41 +0200 16)  * @read:	read the CEC pin. Returns > 0 if high, 0 if low, or an error
e5ad7db4b2f35 (Hans Verkuil 2020-04-21 11:23:41 +0200 17)  *		if negative.
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 18)  * @low:	drive the CEC pin low.
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 19)  * @high:	stop driving the CEC pin. The pull-up will drive the pin
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 20)  *		high, unless someone else is driving the pin low.
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 21)  * @enable_irq:	optional, enable the interrupt to detect pin voltage changes.
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 22)  * @disable_irq: optional, disable the interrupt.
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 23)  * @free:	optional. Free any allocated resources. Called when the
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 24)  *		adapter is deleted.
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 25)  * @status:	optional, log status information.
e5ad7db4b2f35 (Hans Verkuil 2020-04-21 11:23:41 +0200 26)  * @read_hpd:	optional. Read the HPD pin. Returns > 0 if high, 0 if low or
e5ad7db4b2f35 (Hans Verkuil 2020-04-21 11:23:41 +0200 27)  *		an error if negative.
e5ad7db4b2f35 (Hans Verkuil 2020-04-21 11:23:41 +0200 28)  * @read_5v:	optional. Read the 5V pin. Returns > 0 if high, 0 if low or
e5ad7db4b2f35 (Hans Verkuil 2020-04-21 11:23:41 +0200 29)  *		an error if negative.
69e3235d58260 (Hans Verkuil 2019-10-09 11:49:19 -0300 30)  * @received:	optional. High-level CEC message callback. Allows the driver
69e3235d58260 (Hans Verkuil 2019-10-09 11:49:19 -0300 31)  *		to process CEC messages.
69e3235d58260 (Hans Verkuil 2019-10-09 11:49:19 -0300 32)  *
69e3235d58260 (Hans Verkuil 2019-10-09 11:49:19 -0300 33)  * These operations (except for the @received op) are used by the
69e3235d58260 (Hans Verkuil 2019-10-09 11:49:19 -0300 34)  * cec pin framework to manipulate the CEC pin.
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 35)  */
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 36) struct cec_pin_ops {
e5ad7db4b2f35 (Hans Verkuil 2020-04-21 11:23:41 +0200 37) 	int  (*read)(struct cec_adapter *adap);
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 38) 	void (*low)(struct cec_adapter *adap);
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 39) 	void (*high)(struct cec_adapter *adap);
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 40) 	bool (*enable_irq)(struct cec_adapter *adap);
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 41) 	void (*disable_irq)(struct cec_adapter *adap);
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 42) 	void (*free)(struct cec_adapter *adap);
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 43) 	void (*status)(struct cec_adapter *adap, struct seq_file *file);
333ef6bd10c3f (Hans Verkuil 2017-08-15 10:07:25 -0400 44) 	int  (*read_hpd)(struct cec_adapter *adap);
4786b0d6f3ca6 (Hans Verkuil 2018-06-28 07:43:46 -0400 45) 	int  (*read_5v)(struct cec_adapter *adap);
69e3235d58260 (Hans Verkuil 2019-10-09 11:49:19 -0300 46) 
69e3235d58260 (Hans Verkuil 2019-10-09 11:49:19 -0300 47) 	/* High-level CEC message callback */
69e3235d58260 (Hans Verkuil 2019-10-09 11:49:19 -0300 48) 	int (*received)(struct cec_adapter *adap, struct cec_msg *msg);
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 49) };
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 50) 
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 51) /**
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 52)  * cec_pin_changed() - update pin state from interrupt
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 53)  *
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 54)  * @adap:	pointer to the cec adapter
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 55)  * @value:	when true the pin is high, otherwise it is low
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 56)  *
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 57)  * If changes of the CEC voltage are detected via an interrupt, then
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 58)  * cec_pin_changed is called from the interrupt with the new value.
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 59)  */
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 60) void cec_pin_changed(struct cec_adapter *adap, bool value);
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 61) 
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 62) /**
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 63)  * cec_pin_allocate_adapter() - allocate a pin-based cec adapter
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 64)  *
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 65)  * @pin_ops:	low-level pin operations
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 66)  * @priv:	will be stored in adap->priv and can be used by the adapter ops.
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 67)  *		Use cec_get_drvdata(adap) to get the priv pointer.
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 68)  * @name:	the name of the CEC adapter. Note: this name will be copied.
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 69)  * @caps:	capabilities of the CEC adapter. This will be ORed with
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 70)  *		CEC_CAP_MONITOR_ALL and CEC_CAP_MONITOR_PIN.
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 71)  *
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 72)  * Allocate a cec adapter using the cec pin framework.
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 73)  *
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 74)  * Return: a pointer to the cec adapter or an error pointer
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 75)  */
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 76) struct cec_adapter *cec_pin_allocate_adapter(const struct cec_pin_ops *pin_ops,
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 77) 					void *priv, const char *name, u32 caps);
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 78) 
ea5c8ef296681 (Hans Verkuil 2017-07-11 03:30:42 -0300 79) #endif