File Index
Files and directories
Sign in
FILE

sdca_fdl.h

File preview with syntax highlighting.

linux-6.19.14/include/sound/sdca_fdl.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_FDL_H__
 11#define __SDCA_FDL_H__
 12
 13#include <linux/completion.h>
 14#include <linux/workqueue.h>
 15
 16struct device;
 17struct regmap;
 18struct sdca_fdl_set;
 19struct sdca_function_data;
 20struct sdca_interrupt;
 21struct sdca_interrupt_info;
 22
 23/**
 24 * struct fdl_state - FDL state structure to keep data between interrupts
 25 * @begin: Completion indicating the start of an FDL download cycle.
 26 * @done: Completion indicating the end of an FDL download cycle.
 27 * @timeout: Delayed work used for timing out UMP transactions.
 28 * @lock: Mutex to protect between the timeout work and IRQ handlers.
 29 * @interrupt: Pointer to the interrupt struct to which this FDL is attached.
 30 * @set: Pointer to the FDL set currently being downloaded.
 31 * @file_index: Index of the current file being processed.
 32 */
 33struct fdl_state {
 34	struct completion begin;
 35	struct completion done;
 36	struct delayed_work timeout;
 37	struct mutex lock;
 38
 39	struct sdca_interrupt *interrupt;
 40	struct sdca_fdl_set *set;
 41	int file_index;
 42};
 43
 44#define SDCA_CTL_XU_FDLH_COMPLETE	0
 45#define SDCA_CTL_XU_FDLH_MORE_FILES	SDCA_CTL_XU_FDLH_SET_IN_PROGRESS
 46#define SDCA_CTL_XU_FDLH_FILE_AVAILABLE	(SDCA_CTL_XU_FDLH_TRANSFERRED_FILE | \
 47					 SDCA_CTL_XU_FDLH_SET_IN_PROGRESS)
 48#define SDCA_CTL_XU_FDLH_MASK		(SDCA_CTL_XU_FDLH_TRANSFERRED_CHUNK | \
 49					 SDCA_CTL_XU_FDLH_TRANSFERRED_FILE | \
 50					 SDCA_CTL_XU_FDLH_SET_IN_PROGRESS | \
 51					 SDCA_CTL_XU_FDLH_RESET_ACK | \
 52					 SDCA_CTL_XU_FDLH_REQ_ABORT)
 53
 54#define SDCA_CTL_XU_FDLD_COMPLETE	0
 55#define SDCA_CTL_XU_FDLD_FILE_OK	(SDCA_CTL_XU_FDLH_TRANSFERRED_FILE | \
 56					 SDCA_CTL_XU_FDLH_SET_IN_PROGRESS | \
 57					 SDCA_CTL_XU_FDLD_ACK_TRANSFER | \
 58					 SDCA_CTL_XU_FDLD_NEEDS_SET)
 59#define SDCA_CTL_XU_FDLD_MORE_FILES_OK	(SDCA_CTL_XU_FDLH_SET_IN_PROGRESS | \
 60					 SDCA_CTL_XU_FDLD_ACK_TRANSFER | \
 61					 SDCA_CTL_XU_FDLD_NEEDS_SET)
 62#define SDCA_CTL_XU_FDLD_MASK		(SDCA_CTL_XU_FDLD_REQ_RESET | \
 63					 SDCA_CTL_XU_FDLD_REQ_ABORT | \
 64					 SDCA_CTL_XU_FDLD_ACK_TRANSFER | \
 65					 SDCA_CTL_XU_FDLD_NEEDS_SET)
 66
 67#if IS_ENABLED(CONFIG_SND_SOC_SDCA_FDL)
 68
 69int sdca_fdl_alloc_state(struct sdca_interrupt *interrupt);
 70int sdca_fdl_process(struct sdca_interrupt *interrupt);
 71int sdca_fdl_sync(struct device *dev, struct sdca_function_data *function,
 72		  struct sdca_interrupt_info *info);
 73
 74int sdca_reset_function(struct device *dev, struct sdca_function_data *function,
 75			struct regmap *regmap);
 76
 77#else
 78
 79static inline int sdca_fdl_alloc_state(struct sdca_interrupt *interrupt)
 80{
 81	return 0;
 82}
 83
 84static inline int sdca_fdl_process(struct sdca_interrupt *interrupt)
 85{
 86	return 0;
 87}
 88
 89static inline int sdca_fdl_sync(struct device *dev,
 90				struct sdca_function_data *function,
 91				struct sdca_interrupt_info *info)
 92{
 93	return 0;
 94}
 95
 96static inline int sdca_reset_function(struct device *dev,
 97				      struct sdca_function_data *function,
 98				      struct regmap *regmap)
 99{
100	return 0;
101}
102
103#endif // CONFIG_SND_SOC_SDCA_FDL
104
105#endif // __SDCA_FDL_H__
~/ Read-only file preview.