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

TOMOYO Linux Cross Reference
Linux/sound/pci/hda/hda_component.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  * HD audio Component Binding Interface
  4  *
  5  * Copyright (C) 2021 Cirrus Logic, Inc. and
  6  *                    Cirrus Logic International Semiconductor Ltd.
  7  */
  8 
  9 #ifndef __HDA_COMPONENT_H__
 10 #define __HDA_COMPONENT_H__
 11 
 12 #include <linux/acpi.h>
 13 #include <linux/component.h>
 14 #include <linux/mutex.h>
 15 #include <sound/hda_codec.h>
 16 
 17 #define HDA_MAX_COMPONENTS      4
 18 #define HDA_MAX_NAME_SIZE       50
 19 
 20 struct hda_component {
 21         struct device *dev;
 22         char name[HDA_MAX_NAME_SIZE];
 23         struct acpi_device *adev;
 24         bool acpi_notifications_supported;
 25         void (*acpi_notify)(acpi_handle handle, u32 event, struct device *dev);
 26         void (*pre_playback_hook)(struct device *dev, int action);
 27         void (*playback_hook)(struct device *dev, int action);
 28         void (*post_playback_hook)(struct device *dev, int action);
 29 };
 30 
 31 struct hda_component_parent {
 32         struct mutex mutex;
 33         struct hda_codec *codec;
 34         struct hda_component comps[HDA_MAX_COMPONENTS];
 35 };
 36 
 37 #ifdef CONFIG_ACPI
 38 void hda_component_acpi_device_notify(struct hda_component_parent *parent,
 39                                       acpi_handle handle, u32 event, void *data);
 40 int hda_component_manager_bind_acpi_notifications(struct hda_codec *cdc,
 41                                                   struct hda_component_parent *parent,
 42                                                   acpi_notify_handler handler, void *data);
 43 void hda_component_manager_unbind_acpi_notifications(struct hda_codec *cdc,
 44                                                      struct hda_component_parent *parent,
 45                                                      acpi_notify_handler handler);
 46 #else
 47 static inline void hda_component_acpi_device_notify(struct hda_component_parent *parent,
 48                                                     acpi_handle handle,
 49                                                     u32 event,
 50                                                     void *data)
 51 {
 52 }
 53 
 54 static inline int hda_component_manager_bind_acpi_notifications(struct hda_codec *cdc,
 55                                                                 struct hda_component_parent *parent,
 56                                                                 acpi_notify_handler handler,
 57                                                                 void *data)
 58 
 59 {
 60         return 0;
 61 }
 62 
 63 static inline void hda_component_manager_unbind_acpi_notifications(struct hda_codec *cdc,
 64                                                                    struct hda_component_parent *parent,
 65                                                                    acpi_notify_handler handler)
 66 {
 67 }
 68 #endif /* ifdef CONFIG_ACPI */
 69 
 70 void hda_component_manager_playback_hook(struct hda_component_parent *parent, int action);
 71 
 72 int hda_component_manager_init(struct hda_codec *cdc,
 73                                struct hda_component_parent *parent, int count,
 74                                const char *bus, const char *hid,
 75                                const char *match_str,
 76                                const struct component_master_ops *ops);
 77 
 78 void hda_component_manager_free(struct hda_codec *cdc,
 79                                 const struct component_master_ops *ops);
 80 
 81 int hda_component_manager_bind(struct hda_codec *cdc, struct hda_component_parent *parent);
 82 
 83 static inline struct hda_component *hda_component_from_index(struct hda_component_parent *parent,
 84                                                              int index)
 85 {
 86         if (!parent)
 87                 return NULL;
 88 
 89         if (index < 0 || index >= ARRAY_SIZE(parent->comps))
 90                 return NULL;
 91 
 92         return &parent->comps[index];
 93 }
 94 
 95 static inline void hda_component_manager_unbind(struct hda_codec *cdc,
 96                                                 struct hda_component_parent *parent)
 97 {
 98         mutex_lock(&parent->mutex);
 99         component_unbind_all(hda_codec_dev(cdc), parent);
100         mutex_unlock(&parent->mutex);
101 }
102 
103 #endif /* ifndef __HDA_COMPONENT_H__ */
104 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php