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) 2016 Robert Jarzmik <robert.jarzmik@free.fr>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #ifndef AC97_CONTROLLER_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #define AC97_CONTROLLER_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #define AC97_BUS_MAX_CODECS 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define AC97_SLOTS_AVAILABLE_ALL 0xf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct ac97_controller_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)  * struct ac97_controller - The AC97 controller of the AC-Link
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)  * @ops:		the AC97 operations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)  * @controllers:	linked list of all existing controllers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)  * @adap:		the shell device ac97-%d, ie. ac97 adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)  * @nr:			the number of the shell device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)  * @slots_available:	the mask of accessible/scanable codecs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)  * @parent:		the device providing the AC97 controller.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)  * @codecs:		the 4 possible AC97 codecs (NULL if none found).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)  * @codecs_pdata:	platform_data for each codec (NULL if no pdata).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)  * This structure is internal to AC97 bus, and should not be used by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)  * controllers themselves, excepting for using @dev.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct ac97_controller {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	const struct ac97_controller_ops *ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	struct list_head controllers;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	struct device adap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	int nr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	unsigned short slots_available;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	struct device *parent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	struct ac97_codec_device *codecs[AC97_BUS_MAX_CODECS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	void *codecs_pdata[AC97_BUS_MAX_CODECS];
^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) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)  * struct ac97_controller_ops - The AC97 operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)  * @reset:	Cold reset of the AC97 AC-Link.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)  * @warm_reset:	Warm reset of the AC97 AC-Link.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)  * @read:	Read of a single AC97 register.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)  *		Returns the register value or a negative error code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)  * @write:	Write of a single AC97 register.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)  * These are the basic operation an AC97 controller must provide for an AC97
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)  * access functions. Amongst these, all but the last 2 are mandatory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)  * The slot number is also known as the AC97 codec number, between 0 and 3.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) struct ac97_controller_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	void (*reset)(struct ac97_controller *adrv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	void (*warm_reset)(struct ac97_controller *adrv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	int (*write)(struct ac97_controller *adrv, int slot,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 		     unsigned short reg, unsigned short val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	int (*read)(struct ac97_controller *adrv, int slot, unsigned short reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #if IS_ENABLED(CONFIG_AC97_BUS_NEW)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) struct ac97_controller *snd_ac97_controller_register(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	const struct ac97_controller_ops *ops, struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	unsigned short slots_available, void **codecs_pdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) void snd_ac97_controller_unregister(struct ac97_controller *ac97_ctrl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) static inline struct ac97_controller *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) snd_ac97_controller_register(const struct ac97_controller_ops *ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 			     struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 			     unsigned short slots_available,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 			     void **codecs_pdata)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	return ERR_PTR(-ENODEV);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) snd_ac97_controller_unregister(struct ac97_controller *ac97_ctrl)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) #endif