File Index
Files and directories
Sign in
FILE

sdca_interrupts.h

File preview with syntax highlighting.

linux-6.19.14/include/sound/sdca_interrupts.h C
 1/* SPDX-License-Identifier: GPL-2.0 */
 2/*
 3 * The MIPI SDCA specification is available for public downloads at
 4 * https://www.mipi.org/mipi-sdca-v1-0-download
 5 *
 6 * Copyright (C) 2025 Cirrus Logic, Inc. and
 7 *                    Cirrus Logic International Semiconductor Ltd.
 8 */
 9
10#ifndef __SDCA_INTERRUPTS_H__
11#define __SDCA_INTERRUPTS_H__
12
13#include <linux/interrupt.h>
14#include <linux/mutex.h>
15#include <linux/regmap.h>
16
17struct device;
18struct snd_soc_component;
19struct sdca_function_data;
20
21#define SDCA_MAX_INTERRUPTS 31 /* the last bit is reserved for future extensions */
22
23/**
24 * struct sdca_interrupt - contains information about a single SDCA interrupt
25 * @name: The name of the interrupt.
26 * @dev: Pointer to the Function device.
27 * @device_regmap: Pointer to the IRQ regmap.
28 * @function_regmap: Pointer to the SDCA Function regmap.
29 * @component: Pointer to the ASoC component owns the interrupt.
30 * @function: Pointer to the Function that the interrupt is associated with.
31 * @entity: Pointer to the Entity that the interrupt is associated with.
32 * @control: Pointer to the Control that the interrupt is associated with.
33 * @priv: Pointer to private data for use by the handler.
34 * @irq: IRQ number allocated to this interrupt, also used internally to track
35 * the IRQ being assigned.
36 */
37struct sdca_interrupt {
38	const char *name;
39
40	struct device *dev;
41	struct regmap *device_regmap;
42	struct regmap *function_regmap;
43	struct snd_soc_component *component;
44	struct sdca_function_data *function;
45	struct sdca_entity *entity;
46	struct sdca_control *control;
47
48	void *priv;
49
50	int irq;
51};
52
53/**
54 * struct sdca_interrupt_info - contains top-level SDCA interrupt information
55 * @irq_chip: regmap irq chip structure.
56 * @irq_data: regmap irq chip data structure.
57 * @irqs: Array of data for each individual IRQ.
58 * @irq_lock: Protects access to the list of sdca_interrupt structures.
59 */
60struct sdca_interrupt_info {
61	struct regmap_irq_chip irq_chip;
62	struct regmap_irq_chip_data *irq_data;
63
64	struct sdca_interrupt irqs[SDCA_MAX_INTERRUPTS];
65
66	struct mutex irq_lock; /* Protect irqs list across functions */
67};
68
69int sdca_irq_request(struct device *dev, struct sdca_interrupt_info *interrupt_info,
70		     int sdca_irq, const char *name, irq_handler_t handler,
71		     void *data);
72void sdca_irq_free(struct device *dev, struct sdca_interrupt_info *interrupt_info,
73		   int sdca_irq, const char *name, void *data);
74int sdca_irq_data_populate(struct device *dev, struct regmap *function_regmap,
75			   struct snd_soc_component *component,
76			   struct sdca_function_data *function,
77			   struct sdca_entity *entity,
78			   struct sdca_control *control,
79			   struct sdca_interrupt *interrupt);
80int sdca_irq_populate_early(struct device *dev, struct regmap *function_regmap,
81			    struct sdca_function_data *function,
82			    struct sdca_interrupt_info *info);
83int sdca_irq_populate(struct sdca_function_data *function,
84		      struct snd_soc_component *component,
85		      struct sdca_interrupt_info *info);
86void sdca_irq_cleanup(struct device *dev,
87		      struct sdca_function_data *function,
88		      struct sdca_interrupt_info *info);
89struct sdca_interrupt_info *sdca_irq_allocate(struct device *dev,
90					      struct regmap *regmap, int irq);
91
92#endif
~/ Read-only file preview.