~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/sound/ac97/controller.h

Version: ~ [ linux-5.13-rc5 ] ~ [ linux-5.12.9 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.42 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.124 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.193 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.235 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.271 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.271 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp