Commit be605476 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/davinci', 'asoc/topic/drm',...

Merge remote-tracking branches 'asoc/topic/davinci', 'asoc/topic/drm', 'asoc/topic/dwc' and 'asoc/topic/es8316' into asoc-next
......@@ -78,6 +78,7 @@ graph bindings specified in Documentation/devicetree/bindings/graph.txt.
remote endpoint phandle should be a reference to a valid mipi_dsi_host device
node.
- Video port 1 for the HDMI output
- Audio port 2 for the HDMI audio input
Example
......@@ -112,5 +113,12 @@ Example
remote-endpoint = <&hdmi_connector_in>;
};
};
port@2 {
reg = <2>;
codec_endpoint: endpoint {
remote-endpoint = <&i2s0_cpu_endpoint>;
};
};
};
};
......@@ -25,7 +25,8 @@ Required properties:
- clock-names: Shall contain "iahb" and "isfr" as defined in dw_hdmi.txt.
- ports: See dw_hdmi.txt. The DWC HDMI shall have one port numbered 0
corresponding to the video input of the controller and one port numbered 1
corresponding to its HDMI output. Each port shall have a single endpoint.
corresponding to its HDMI output, and one port numbered 2 corresponding to
sound input of the controller. Each port shall have a single endpoint.
Optional properties:
......@@ -59,6 +60,12 @@ Example:
remote-endpoint = <&hdmi0_con>;
};
};
port@2 {
reg = <2>;
rcar_dw_hdmi0_sound_in: endpoint {
remote-endpoint = <&hdmi_sound_out>;
};
};
};
};
......
......@@ -11,6 +11,7 @@
#include <sound/hdmi-codec.h>
#include <sound/pcm.h>
#include <sound/soc.h>
#include <linux/of_graph.h>
#include "adv7511.h"
......@@ -182,10 +183,31 @@ static void audio_shutdown(struct device *dev, void *data)
{
}
static int adv7511_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
struct device_node *endpoint)
{
struct of_endpoint of_ep;
int ret;
ret = of_graph_parse_endpoint(endpoint, &of_ep);
if (ret < 0)
return ret;
/*
* HDMI sound should be located as reg = <2>
* Then, it is sound port 0
*/
if (of_ep.port == 2)
return 0;
return -EINVAL;
}
static const struct hdmi_codec_ops adv7511_codec_ops = {
.hw_params = adv7511_hdmi_hw_params,
.audio_shutdown = audio_shutdown,
.audio_startup = audio_startup,
.get_dai_id = adv7511_hdmi_i2s_get_dai_id,
};
static struct hdmi_codec_pdata codec_data = {
......
......@@ -82,9 +82,30 @@ static void dw_hdmi_i2s_audio_shutdown(struct device *dev, void *data)
hdmi_write(audio, HDMI_AUD_CONF0_SW_RESET, HDMI_AUD_CONF0);
}
static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
struct device_node *endpoint)
{
struct of_endpoint of_ep;
int ret;
ret = of_graph_parse_endpoint(endpoint, &of_ep);
if (ret < 0)
return ret;
/*
* HDMI sound should be located as reg = <2>
* Then, it is sound port 0
*/
if (of_ep.port == 2)
return 0;
return -EINVAL;
}
static struct hdmi_codec_ops dw_hdmi_i2s_ops = {
.hw_params = dw_hdmi_i2s_hw_params,
.audio_shutdown = dw_hdmi_i2s_audio_shutdown,
.get_dai_id = dw_hdmi_i2s_get_dai_id,
};
static int snd_dw_hdmi_probe(struct platform_device *pdev)
......
......@@ -47,6 +47,7 @@ struct i2s_platform_data {
#define DW_I2S_QUIRK_COMP_REG_OFFSET (1 << 0)
#define DW_I2S_QUIRK_COMP_PARAM1 (1 << 1)
#define DW_I2S_QUIRK_16BIT_IDX_OVERRIDE (1 << 2)
unsigned int quirks;
unsigned int i2s_reg_comp1;
unsigned int i2s_reg_comp2;
......
......@@ -72,6 +72,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_DA9055 if I2C
select SND_SOC_DIO2125
select SND_SOC_DMIC
select SND_SOC_ES8316 if I2C
select SND_SOC_ES8328_SPI if SPI_MASTER
select SND_SOC_ES8328_I2C if I2C
select SND_SOC_ES7134
......@@ -543,6 +544,10 @@ config SND_SOC_HDMI_CODEC
config SND_SOC_ES7134
tristate "Everest Semi ES7134 CODEC"
config SND_SOC_ES8316
tristate "Everest Semi ES8316 CODEC"
depends on I2C
config SND_SOC_ES8328
tristate
......
......@@ -65,6 +65,7 @@ snd-soc-da732x-objs := da732x.o
snd-soc-da9055-objs := da9055.o
snd-soc-dmic-objs := dmic.o
snd-soc-es7134-objs := es7134.o
snd-soc-es8316-objs := es8316.o
snd-soc-es8328-objs := es8328.o
snd-soc-es8328-i2c-objs := es8328-i2c.o
snd-soc-es8328-spi-objs := es8328-spi.o
......@@ -300,6 +301,7 @@ obj-$(CONFIG_SND_SOC_DA732X) += snd-soc-da732x.o
obj-$(CONFIG_SND_SOC_DA9055) += snd-soc-da9055.o
obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o
obj-$(CONFIG_SND_SOC_ES7134) += snd-soc-es7134.o
obj-$(CONFIG_SND_SOC_ES8316) += snd-soc-es8316.o
obj-$(CONFIG_SND_SOC_ES8328) += snd-soc-es8328.o
obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o
obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.o
......
This diff is collapsed.
/*
* Copyright Everest Semiconductor Co.,Ltd
*
* Author: David Yang <yangxiaohua@everest-semi.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#ifndef _ES8316_H
#define _ES8316_H
/*
* ES8316 register space
*/
/* Reset Control */
#define ES8316_RESET 0x00
/* Clock Management */
#define ES8316_CLKMGR_CLKSW 0x01
#define ES8316_CLKMGR_CLKSEL 0x02
#define ES8316_CLKMGR_ADCOSR 0x03
#define ES8316_CLKMGR_ADCDIV1 0x04
#define ES8316_CLKMGR_ADCDIV2 0x05
#define ES8316_CLKMGR_DACDIV1 0x06
#define ES8316_CLKMGR_DACDIV2 0x07
#define ES8316_CLKMGR_CPDIV 0x08
/* Serial Data Port Control */
#define ES8316_SERDATA1 0x09
#define ES8316_SERDATA_ADC 0x0a
#define ES8316_SERDATA_DAC 0x0b
/* System Control */
#define ES8316_SYS_VMIDSEL 0x0c
#define ES8316_SYS_PDN 0x0d
#define ES8316_SYS_LP1 0x0e
#define ES8316_SYS_LP2 0x0f
#define ES8316_SYS_VMIDLOW 0x10
#define ES8316_SYS_VSEL 0x11
#define ES8316_SYS_REF 0x12
/* Headphone Mixer */
#define ES8316_HPMIX_SEL 0x13
#define ES8316_HPMIX_SWITCH 0x14
#define ES8316_HPMIX_PDN 0x15
#define ES8316_HPMIX_VOL 0x16
/* Charge Pump Headphone driver */
#define ES8316_CPHP_OUTEN 0x17
#define ES8316_CPHP_ICAL_VOL 0x18
#define ES8316_CPHP_PDN1 0x19
#define ES8316_CPHP_PDN2 0x1a
#define ES8316_CPHP_LDOCTL 0x1b
/* Calibration */
#define ES8316_CAL_TYPE 0x1c
#define ES8316_CAL_SET 0x1d
#define ES8316_CAL_HPLIV 0x1e
#define ES8316_CAL_HPRIV 0x1f
#define ES8316_CAL_HPLMV 0x20
#define ES8316_CAL_HPRMV 0x21
/* ADC Control */
#define ES8316_ADC_PDN_LINSEL 0x22
#define ES8316_ADC_PGAGAIN 0x23
#define ES8316_ADC_D2SEPGA 0x24
#define ES8316_ADC_DMIC 0x25
#define ES8316_ADC_MUTE 0x26
#define ES8316_ADC_VOLUME 0x27
#define ES8316_ADC_ALC1 0x29
#define ES8316_ADC_ALC2 0x2a
#define ES8316_ADC_ALC3 0x2b
#define ES8316_ADC_ALC4 0x2c
#define ES8316_ADC_ALC5 0x2d
#define ES8316_ADC_ALC_NG 0x2e
/* DAC Control */
#define ES8316_DAC_PDN 0x2f
#define ES8316_DAC_SET1 0x30
#define ES8316_DAC_SET2 0x31
#define ES8316_DAC_SET3 0x32
#define ES8316_DAC_VOLL 0x33
#define ES8316_DAC_VOLR 0x34
/* GPIO */
#define ES8316_GPIO_SEL 0x4d
#define ES8316_GPIO_DEBOUNCE 0x4e
#define ES8316_GPIO_FLAG 0x4f
/* Test mode */
#define ES8316_TESTMODE 0x50
#define ES8316_TEST1 0x51
#define ES8316_TEST2 0x52
#define ES8316_TEST3 0x53
/*
* Field definitions
*/
/* ES8316_RESET */
#define ES8316_RESET_CSM_ON 0x80
/* ES8316_CLKMGR_CLKSW */
#define ES8316_CLKMGR_CLKSW_MCLK_ON 0x40
#define ES8316_CLKMGR_CLKSW_BCLK_ON 0x20
/* ES8316_SERDATA1 */
#define ES8316_SERDATA1_MASTER 0x80
#define ES8316_SERDATA1_BCLK_INV 0x20
/* ES8316_SERDATA_ADC and _DAC */
#define ES8316_SERDATA2_FMT_MASK 0x3
#define ES8316_SERDATA2_FMT_I2S 0x00
#define ES8316_SERDATA2_FMT_LEFTJ 0x01
#define ES8316_SERDATA2_FMT_RIGHTJ 0x02
#define ES8316_SERDATA2_FMT_PCM 0x03
#define ES8316_SERDATA2_ADCLRP 0x20
#define ES8316_SERDATA2_LEN_MASK 0x1c
#define ES8316_SERDATA2_LEN_24 0x00
#define ES8316_SERDATA2_LEN_20 0x04
#define ES8316_SERDATA2_LEN_18 0x08
#define ES8316_SERDATA2_LEN_16 0x0c
#define ES8316_SERDATA2_LEN_32 0x10
#endif
......@@ -629,7 +629,7 @@ static int davinci_mcasp_ch_constraint(struct davinci_mcasp *mcasp, int stream,
if (mcasp->tdm_mask[stream])
slots = hweight32(mcasp->tdm_mask[stream]);
for (i = 2; i <= slots; i++)
for (i = 1; i <= slots; i++)
list[count++] = i;
for (i = 2; i <= serializers; i++)
......@@ -1297,7 +1297,7 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
snd_pcm_hw_constraint_minmax(substream->runtime,
SNDRV_PCM_HW_PARAM_CHANNELS,
2, max_channels);
0, max_channels);
snd_pcm_hw_constraint_list(substream->runtime,
0, SNDRV_PCM_HW_PARAM_CHANNELS,
......@@ -1459,13 +1459,13 @@ static struct snd_soc_dai_driver davinci_mcasp_dai[] = {
.suspend = davinci_mcasp_suspend,
.resume = davinci_mcasp_resume,
.playback = {
.channels_min = 2,
.channels_min = 1,
.channels_max = 32 * 16,
.rates = DAVINCI_MCASP_RATES,
.formats = DAVINCI_MCASP_PCM_FMTS,
},
.capture = {
.channels_min = 2,
.channels_min = 1,
.channels_max = 32 * 16,
.rates = DAVINCI_MCASP_RATES,
.formats = DAVINCI_MCASP_PCM_FMTS,
......@@ -1971,12 +1971,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
*/
mcasp->chconstr[SNDRV_PCM_STREAM_PLAYBACK].list =
devm_kzalloc(mcasp->dev, sizeof(unsigned int) *
(32 + mcasp->num_serializer - 2),
(32 + mcasp->num_serializer - 1),
GFP_KERNEL);
mcasp->chconstr[SNDRV_PCM_STREAM_CAPTURE].list =
devm_kzalloc(mcasp->dev, sizeof(unsigned int) *
(32 + mcasp->num_serializer - 2),
(32 + mcasp->num_serializer - 1),
GFP_KERNEL);
if (!mcasp->chconstr[SNDRV_PCM_STREAM_PLAYBACK].list ||
......
......@@ -496,6 +496,8 @@ static int dw_configure_dai(struct dw_i2s_dev *dev,
idx = COMP1_TX_WORDSIZE_0(comp1);
if (WARN_ON(idx >= ARRAY_SIZE(formats)))
return -EINVAL;
if (dev->quirks & DW_I2S_QUIRK_16BIT_IDX_OVERRIDE)
idx = 1;
dw_i2s_dai->playback.channels_min = MIN_CHANNEL_NUM;
dw_i2s_dai->playback.channels_max =
1 << (COMP1_TX_CHANNELS(comp1) + 1);
......@@ -508,6 +510,8 @@ static int dw_configure_dai(struct dw_i2s_dev *dev,
idx = COMP2_RX_WORDSIZE_0(comp2);
if (WARN_ON(idx >= ARRAY_SIZE(formats)))
return -EINVAL;
if (dev->quirks & DW_I2S_QUIRK_16BIT_IDX_OVERRIDE)
idx = 1;
dw_i2s_dai->capture.channels_min = MIN_CHANNEL_NUM;
dw_i2s_dai->capture.channels_max =
1 << (COMP1_RX_CHANNELS(comp1) + 1);
......@@ -543,6 +547,8 @@ static int dw_configure_dai_by_pd(struct dw_i2s_dev *dev,
if (ret < 0)
return ret;
if (dev->quirks & DW_I2S_QUIRK_16BIT_IDX_OVERRIDE)
idx = 1;
/* Set DMA slaves info */
dev->play_dma_data.pd.data = pdata->play_dma_data;
dev->capture_dma_data.pd.data = pdata->capture_dma_data;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment