2015-03-04 01:21:53 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2010-2011,2013-2015 The Linux Foundation. All rights reserved.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 and
|
|
|
|
* only version 2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* lpass.h - Definitions for the QTi LPASS
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __LPASS_H__
|
|
|
|
#define __LPASS_H__
|
|
|
|
|
|
|
|
#include <linux/clk.h>
|
|
|
|
#include <linux/compiler.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/regmap.h>
|
|
|
|
|
|
|
|
#define LPASS_AHBIX_CLOCK_FREQUENCY 131072000
|
2015-05-21 23:52:49 +02:00
|
|
|
#define LPASS_MAX_MI2S_PORTS (8)
|
2015-05-21 23:53:14 +02:00
|
|
|
#define LPASS_MAX_DMA_CHANNELS (8)
|
2015-03-04 01:21:53 +01:00
|
|
|
|
|
|
|
/* Both the CPU DAI and platform drivers will access this data */
|
|
|
|
struct lpass_data {
|
|
|
|
|
|
|
|
/* AHB-I/X bus clocks inside the low-power audio subsystem (LPASS) */
|
|
|
|
struct clk *ahbix_clk;
|
|
|
|
|
|
|
|
/* MI2S system clock */
|
2015-05-21 23:52:49 +02:00
|
|
|
struct clk *mi2s_osr_clk[LPASS_MAX_MI2S_PORTS];
|
2015-03-04 01:21:53 +01:00
|
|
|
|
|
|
|
/* MI2S bit clock (derived from system clock by a divider */
|
2015-05-21 23:52:49 +02:00
|
|
|
struct clk *mi2s_bit_clk[LPASS_MAX_MI2S_PORTS];
|
2015-03-04 01:21:53 +01:00
|
|
|
|
|
|
|
/* low-power audio interface (LPAIF) registers */
|
|
|
|
void __iomem *lpaif;
|
|
|
|
|
|
|
|
/* regmap backed by the low-power audio interface (LPAIF) registers */
|
|
|
|
struct regmap *lpaif_map;
|
|
|
|
|
|
|
|
/* interrupts from the low-power audio interface (LPAIF) */
|
|
|
|
int lpaif_irq;
|
2015-05-16 14:32:17 +02:00
|
|
|
|
|
|
|
/* SOC specific variations in the LPASS IP integration */
|
|
|
|
struct lpass_variant *variant;
|
2015-05-21 23:53:14 +02:00
|
|
|
|
2015-05-21 23:53:21 +02:00
|
|
|
/* bit map to keep track of static channel allocations */
|
2016-02-11 13:17:51 +01:00
|
|
|
unsigned long dma_ch_bit_map;
|
2015-05-21 23:53:21 +02:00
|
|
|
|
2015-05-21 23:53:14 +02:00
|
|
|
/* used it for handling interrupt per dma channel */
|
|
|
|
struct snd_pcm_substream *substream[LPASS_MAX_DMA_CHANNELS];
|
2015-05-22 17:53:52 +02:00
|
|
|
|
|
|
|
/* 8016 specific */
|
|
|
|
struct clk *pcnoc_mport_clk;
|
|
|
|
struct clk *pcnoc_sway_clk;
|
2016-08-01 08:10:54 +02:00
|
|
|
|
2015-05-16 14:32:17 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Vairant data per each SOC */
|
|
|
|
struct lpass_variant {
|
|
|
|
u32 i2sctrl_reg_base;
|
|
|
|
u32 i2sctrl_reg_stride;
|
|
|
|
u32 i2s_ports;
|
|
|
|
u32 irq_reg_base;
|
|
|
|
u32 irq_reg_stride;
|
|
|
|
u32 irq_ports;
|
|
|
|
u32 rdma_reg_base;
|
|
|
|
u32 rdma_reg_stride;
|
|
|
|
u32 rdma_channels;
|
2016-02-11 13:17:23 +01:00
|
|
|
u32 wrdma_reg_base;
|
|
|
|
u32 wrdma_reg_stride;
|
|
|
|
u32 wrdma_channels;
|
2015-05-16 14:32:17 +02:00
|
|
|
|
2015-05-21 23:53:05 +02:00
|
|
|
/**
|
|
|
|
* on SOCs like APQ8016 the channel control bits start
|
|
|
|
* at different offset to ipq806x
|
|
|
|
**/
|
2016-02-11 13:17:30 +01:00
|
|
|
u32 dmactl_audif_start;
|
2016-02-11 13:17:23 +01:00
|
|
|
u32 wrdma_channel_start;
|
2017-02-27 23:29:20 +01:00
|
|
|
/* SOC specific initialization like clocks */
|
2015-05-16 14:32:17 +02:00
|
|
|
int (*init)(struct platform_device *pdev);
|
|
|
|
int (*exit)(struct platform_device *pdev);
|
2016-02-11 13:17:37 +01:00
|
|
|
int (*alloc_dma_channel)(struct lpass_data *data, int direction);
|
2015-05-16 14:32:34 +02:00
|
|
|
int (*free_dma_channel)(struct lpass_data *data, int ch);
|
2015-05-16 14:32:17 +02:00
|
|
|
|
|
|
|
/* SOC specific dais */
|
|
|
|
struct snd_soc_dai_driver *dai_driver;
|
|
|
|
int num_dai;
|
2017-04-05 10:34:10 +02:00
|
|
|
const char * const *dai_osr_clk_names;
|
|
|
|
const char * const *dai_bit_clk_names;
|
2015-03-04 01:21:53 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/* register the platform driver from the CPU DAI driver */
|
|
|
|
int asoc_qcom_lpass_platform_register(struct platform_device *);
|
2015-05-16 14:32:17 +02:00
|
|
|
int asoc_qcom_lpass_cpu_platform_remove(struct platform_device *pdev);
|
|
|
|
int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev);
|
|
|
|
int asoc_qcom_lpass_cpu_dai_probe(struct snd_soc_dai *dai);
|
2015-08-28 04:53:31 +02:00
|
|
|
extern const struct snd_soc_dai_ops asoc_qcom_lpass_cpu_dai_ops;
|
2015-03-04 01:21:53 +01:00
|
|
|
|
|
|
|
#endif /* __LPASS_H__ */
|