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

TOMOYO Linux Cross Reference
Linux/include/linux/mux/driver.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ 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 ] ~

Diff markup

Differences between /include/linux/mux/driver.h (Version linux-6.12-rc7) and /include/linux/mux/driver.h (Version linux-5.1.21)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /*                                                  2 /*
  3  * mux/driver.h - definitions for the multiple      3  * mux/driver.h - definitions for the multiplexer driver interface
  4  *                                                  4  *
  5  * Copyright (C) 2017 Axentia Technologies AB       5  * Copyright (C) 2017 Axentia Technologies AB
  6  *                                                  6  *
  7  * Author: Peter Rosin <peda@axentia.se>            7  * Author: Peter Rosin <peda@axentia.se>
  8  */                                                 8  */
  9                                                     9 
 10 #ifndef _LINUX_MUX_DRIVER_H                        10 #ifndef _LINUX_MUX_DRIVER_H
 11 #define _LINUX_MUX_DRIVER_H                        11 #define _LINUX_MUX_DRIVER_H
 12                                                    12 
 13 #include <dt-bindings/mux/mux.h>                   13 #include <dt-bindings/mux/mux.h>
 14 #include <linux/device.h>                          14 #include <linux/device.h>
 15 #include <linux/ktime.h>                       << 
 16 #include <linux/semaphore.h>                       15 #include <linux/semaphore.h>
 17                                                    16 
 18 struct mux_chip;                                   17 struct mux_chip;
 19 struct mux_control;                                18 struct mux_control;
 20                                                    19 
 21 /**                                                20 /**
 22  * struct mux_control_ops -     Mux controller     21  * struct mux_control_ops -     Mux controller operations for a mux chip.
 23  * @set:                        Set the state      22  * @set:                        Set the state of the given mux controller.
 24  */                                                23  */
 25 struct mux_control_ops {                           24 struct mux_control_ops {
 26         int (*set)(struct mux_control *mux, in     25         int (*set)(struct mux_control *mux, int state);
 27 };                                                 26 };
 28                                                    27 
 29 /**                                                28 /**
 30  * struct mux_control - Represents a mux contr     29  * struct mux_control - Represents a mux controller.
 31  * @lock:               Protects the mux contr     30  * @lock:               Protects the mux controller state.
 32  * @chip:               The mux chip that is h     31  * @chip:               The mux chip that is handling this mux controller.
 33  * @cached_state:       The current mux contro     32  * @cached_state:       The current mux controller state, or -1 if none.
 34  * @states:             The number of mux cont     33  * @states:             The number of mux controller states.
 35  * @idle_state:         The mux controller sta     34  * @idle_state:         The mux controller state to use when inactive, or one
 36  *                      of MUX_IDLE_AS_IS and      35  *                      of MUX_IDLE_AS_IS and MUX_IDLE_DISCONNECT.
 37  * @last_change:        Timestamp of last chan << 
 38  *                                                 36  *
 39  * Mux drivers may only change @states and @id     37  * Mux drivers may only change @states and @idle_state, and may only do so
 40  * between allocation and registration of the      38  * between allocation and registration of the mux controller. Specifically,
 41  * @cached_state is internal to the mux core a     39  * @cached_state is internal to the mux core and should never be written by
 42  * mux drivers.                                    40  * mux drivers.
 43  */                                                41  */
 44 struct mux_control {                               42 struct mux_control {
 45         struct semaphore lock; /* protects the     43         struct semaphore lock; /* protects the state of the mux */
 46                                                    44 
 47         struct mux_chip *chip;                     45         struct mux_chip *chip;
 48         int cached_state;                          46         int cached_state;
 49                                                    47 
 50         unsigned int states;                       48         unsigned int states;
 51         int idle_state;                            49         int idle_state;
 52                                                << 
 53         ktime_t last_change;                   << 
 54 };                                                 50 };
 55                                                    51 
 56 /**                                                52 /**
 57  * struct mux_chip -    Represents a chip hold     53  * struct mux_chip -    Represents a chip holding mux controllers.
 58  * @controllers:        Number of mux controll     54  * @controllers:        Number of mux controllers handled by the chip.
 59  * @mux:                Array of mux controlle     55  * @mux:                Array of mux controllers that are handled.
 60  * @dev:                Device structure.          56  * @dev:                Device structure.
 61  * @id:                 Used to identify the d     57  * @id:                 Used to identify the device internally.
 62  * @ops:                Mux controller operati     58  * @ops:                Mux controller operations.
 63  */                                                59  */
 64 struct mux_chip {                                  60 struct mux_chip {
 65         unsigned int controllers;                  61         unsigned int controllers;
 66         struct mux_control *mux;                   62         struct mux_control *mux;
 67         struct device dev;                         63         struct device dev;
 68         int id;                                    64         int id;
 69                                                    65 
 70         const struct mux_control_ops *ops;         66         const struct mux_control_ops *ops;
 71 };                                                 67 };
 72                                                    68 
 73 #define to_mux_chip(x) container_of((x), struc     69 #define to_mux_chip(x) container_of((x), struct mux_chip, dev)
 74                                                    70 
 75 /**                                                71 /**
 76  * mux_chip_priv() - Get the extra memory rese     72  * mux_chip_priv() - Get the extra memory reserved by mux_chip_alloc().
 77  * @mux_chip: The mux-chip to get the private      73  * @mux_chip: The mux-chip to get the private memory from.
 78  *                                                 74  *
 79  * Return: Pointer to the private memory reser     75  * Return: Pointer to the private memory reserved by the allocator.
 80  */                                                76  */
 81 static inline void *mux_chip_priv(struct mux_c     77 static inline void *mux_chip_priv(struct mux_chip *mux_chip)
 82 {                                                  78 {
 83         return &mux_chip->mux[mux_chip->contro     79         return &mux_chip->mux[mux_chip->controllers];
 84 }                                                  80 }
 85                                                    81 
 86 struct mux_chip *mux_chip_alloc(struct device      82 struct mux_chip *mux_chip_alloc(struct device *dev,
 87                                 unsigned int c     83                                 unsigned int controllers, size_t sizeof_priv);
 88 int mux_chip_register(struct mux_chip *mux_chi     84 int mux_chip_register(struct mux_chip *mux_chip);
 89 void mux_chip_unregister(struct mux_chip *mux_     85 void mux_chip_unregister(struct mux_chip *mux_chip);
 90 void mux_chip_free(struct mux_chip *mux_chip);     86 void mux_chip_free(struct mux_chip *mux_chip);
 91                                                    87 
 92 struct mux_chip *devm_mux_chip_alloc(struct de     88 struct mux_chip *devm_mux_chip_alloc(struct device *dev,
 93                                      unsigned      89                                      unsigned int controllers,
 94                                      size_t si     90                                      size_t sizeof_priv);
 95 int devm_mux_chip_register(struct device *dev,     91 int devm_mux_chip_register(struct device *dev, struct mux_chip *mux_chip);
 96                                                    92 
 97 /**                                                93 /**
 98  * mux_control_get_index() - Get the index of      94  * mux_control_get_index() - Get the index of the given mux controller
 99  * @mux: The mux-control to get the index for.     95  * @mux: The mux-control to get the index for.
100  *                                                 96  *
101  * Return: The index of the mux controller wit     97  * Return: The index of the mux controller within the mux chip the mux
102  * controller is a part of.                        98  * controller is a part of.
103  */                                                99  */
104 static inline unsigned int mux_control_get_ind    100 static inline unsigned int mux_control_get_index(struct mux_control *mux)
105 {                                                 101 {
106         return mux - mux->chip->mux;              102         return mux - mux->chip->mux;
107 }                                                 103 }
108                                                   104 
109 #endif /* _LINUX_MUX_DRIVER_H */                  105 #endif /* _LINUX_MUX_DRIVER_H */
110                                                   106 

~ [ 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