Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Intel Smart Sound Technology (SST) Core
0004  *
0005  * Copyright (C) 2013, Intel Corporation. All rights reserved.
0006  */
0007 
0008 #ifndef __SOUND_SOC_SST_DSP_H
0009 #define __SOUND_SOC_SST_DSP_H
0010 
0011 #include <linux/kernel.h>
0012 #include <linux/types.h>
0013 #include <linux/interrupt.h>
0014 
0015 struct sst_dsp;
0016 
0017 /*
0018  * SST Device.
0019  *
0020  * This structure is populated by the SST core driver.
0021  */
0022 struct sst_dsp_device {
0023     /* Mandatory fields */
0024     struct sst_ops *ops;
0025     irqreturn_t (*thread)(int irq, void *context);
0026     void *thread_context;
0027 };
0028 
0029 /* SHIM Read / Write */
0030 void sst_dsp_shim_write(struct sst_dsp *sst, u32 offset, u32 value);
0031 u32 sst_dsp_shim_read(struct sst_dsp *sst, u32 offset);
0032 int sst_dsp_shim_update_bits(struct sst_dsp *sst, u32 offset,
0033                 u32 mask, u32 value);
0034 void sst_dsp_shim_update_bits_forced(struct sst_dsp *sst, u32 offset,
0035                 u32 mask, u32 value);
0036 
0037 /* SHIM Read / Write Unlocked for callers already holding sst lock */
0038 void sst_dsp_shim_write_unlocked(struct sst_dsp *sst, u32 offset, u32 value);
0039 u32 sst_dsp_shim_read_unlocked(struct sst_dsp *sst, u32 offset);
0040 int sst_dsp_shim_update_bits_unlocked(struct sst_dsp *sst, u32 offset,
0041                 u32 mask, u32 value);
0042 void sst_dsp_shim_update_bits_forced_unlocked(struct sst_dsp *sst, u32 offset,
0043                 u32 mask, u32 value);
0044 
0045 /* Internal generic low-level SST IO functions - can be overidden */
0046 void sst_shim32_write(void __iomem *addr, u32 offset, u32 value);
0047 u32 sst_shim32_read(void __iomem *addr, u32 offset);
0048 void sst_shim32_write64(void __iomem *addr, u32 offset, u64 value);
0049 u64 sst_shim32_read64(void __iomem *addr, u32 offset);
0050 
0051 /* Mailbox management */
0052 int sst_dsp_mailbox_init(struct sst_dsp *sst, u32 inbox_offset,
0053     size_t inbox_size, u32 outbox_offset, size_t outbox_size);
0054 void sst_dsp_inbox_write(struct sst_dsp *sst, void *message, size_t bytes);
0055 void sst_dsp_inbox_read(struct sst_dsp *sst, void *message, size_t bytes);
0056 void sst_dsp_outbox_write(struct sst_dsp *sst, void *message, size_t bytes);
0057 void sst_dsp_outbox_read(struct sst_dsp *sst, void *message, size_t bytes);
0058 int sst_dsp_register_poll(struct sst_dsp  *ctx, u32 offset, u32 mask,
0059          u32 target, u32 time, char *operation);
0060 
0061 #endif