Skip to content

Commit

Permalink
Merge branch 'asoc-5.3' into asoc-5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Brown committed Aug 20, 2019
2 parents d5e1204 + bf283a0 commit dd28d54
Show file tree
Hide file tree
Showing 18 changed files with 234 additions and 75 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -8044,6 +8044,7 @@ S: Maintained
F: drivers/video/fbdev/i810/

INTEL ASoC DRIVERS
M: Cezary Rojewski <cezary.rojewski@intel.com>
M: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
M: Liam Girdwood <liam.r.girdwood@linux.intel.com>
M: Jie Yang <yang.jie@linux.intel.com>
Expand Down
20 changes: 9 additions & 11 deletions sound/soc/amd/raven/acp3x-pcm-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ struct i2s_stream_instance {
u16 num_pages;
u16 channels;
u32 xfer_resolution;
struct page *pg;
u64 bytescount;
dma_addr_t dma_addr;
void __iomem *acp3x_base;
};

Expand Down Expand Up @@ -211,9 +211,8 @@ static irqreturn_t i2s_irq_handler(int irq, void *dev_id)
static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction)
{
u16 page_idx;
u64 addr;
u32 low, high, val, acp_fifo_addr;
struct page *pg = rtd->pg;
dma_addr_t addr = rtd->dma_addr;

/* 8 scratch registers used to map one 64 bit address */
if (direction == SNDRV_PCM_STREAM_PLAYBACK)
Expand All @@ -229,7 +228,6 @@ static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction)

for (page_idx = 0; page_idx < rtd->num_pages; page_idx++) {
/* Load the low address of page int ACP SRAM through SRBM */
addr = page_to_phys(pg);
low = lower_32_bits(addr);
high = upper_32_bits(addr);

Expand All @@ -239,7 +237,7 @@ static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction)
+ 4);
/* Move to next physically contiguos page */
val += 8;
pg++;
addr += PAGE_SIZE;
}

if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
Expand Down Expand Up @@ -341,7 +339,6 @@ static int acp3x_dma_hw_params(struct snd_pcm_substream *substream,
{
int status;
u64 size;
struct page *pg;
struct snd_pcm_runtime *runtime = substream->runtime;
struct i2s_stream_instance *rtd = runtime->private_data;

Expand All @@ -354,9 +351,8 @@ static int acp3x_dma_hw_params(struct snd_pcm_substream *substream,
return status;

memset(substream->runtime->dma_area, 0, params_buffer_bytes(params));
pg = virt_to_page(substream->dma_buffer.area);
if (pg) {
rtd->pg = pg;
if (substream->dma_buffer.area) {
rtd->dma_addr = substream->dma_buffer.addr;
rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT);
config_acp3x_dma(rtd, substream->stream);
status = 0;
Expand Down Expand Up @@ -385,9 +381,11 @@ static snd_pcm_uframes_t acp3x_dma_pointer(struct snd_pcm_substream *substream)

static int acp3x_dma_new(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd,
DRV_NAME);
struct device *parent = component->dev->parent;
snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, SNDRV_DMA_TYPE_DEV,
rtd->pcm->card->dev,
MIN_BUFFER, MAX_BUFFER);
parent, MIN_BUFFER, MAX_BUFFER);
return 0;
}

Expand Down
4 changes: 4 additions & 0 deletions sound/soc/codecs/hdac_hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,10 @@ static int hdac_hda_dev_probe(struct hdac_device *hdev)

static int hdac_hda_dev_remove(struct hdac_device *hdev)
{
struct hdac_hda_priv *hda_pvt;

hda_pvt = dev_get_drvdata(&hdev->dev);
cancel_delayed_work_sync(&hda_pvt->codec.jackpoll_work);
return 0;
}

Expand Down
57 changes: 48 additions & 9 deletions sound/soc/codecs/hdac_hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ struct hdac_hdmi_port {
hda_nid_t mux_nids[HDA_MAX_CONNECTIONS];
struct hdac_hdmi_eld eld;
const char *jack_pin;
bool is_connect;
struct snd_soc_dapm_context *dapm;
const char *output_pin;
struct work_struct dapm_work;
};

struct hdac_hdmi_pcm {
Expand Down Expand Up @@ -163,11 +165,7 @@ static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm,
{
struct hdac_device *hdev = port->pin->hdev;

if (is_connect)
snd_soc_dapm_enable_pin(port->dapm, port->jack_pin);
else
snd_soc_dapm_disable_pin(port->dapm, port->jack_pin);

port->is_connect = is_connect;
if (is_connect) {
/*
* Report Jack connect event when a device is connected
Expand All @@ -193,10 +191,32 @@ static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm,
if (pcm->jack_event > 0)
pcm->jack_event--;
}
}

static void hdac_hdmi_port_dapm_update(struct hdac_hdmi_port *port)
{
if (port->is_connect)
snd_soc_dapm_enable_pin(port->dapm, port->jack_pin);
else
snd_soc_dapm_disable_pin(port->dapm, port->jack_pin);
snd_soc_dapm_sync(port->dapm);
}

static void hdac_hdmi_jack_dapm_work(struct work_struct *work)
{
struct hdac_hdmi_port *port;

port = container_of(work, struct hdac_hdmi_port, dapm_work);
hdac_hdmi_port_dapm_update(port);
}

static void hdac_hdmi_jack_report_sync(struct hdac_hdmi_pcm *pcm,
struct hdac_hdmi_port *port, bool is_connect)
{
hdac_hdmi_jack_report(pcm, port, is_connect);
hdac_hdmi_port_dapm_update(port);
}

/* MST supported verbs */
/*
* Get the no devices that can be connected to a port on the Pin widget.
Expand Down Expand Up @@ -904,7 +924,7 @@ static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol,
list_for_each_entry_safe(p, p_next, &pcm->port_list, head) {
if (p == port && p->id == port->id &&
p->pin == port->pin) {
hdac_hdmi_jack_report(pcm, port, false);
hdac_hdmi_jack_report_sync(pcm, port, false);
list_del(&p->head);
}
}
Expand All @@ -918,7 +938,7 @@ static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol,
if (!strcmp(cvt_name, pcm->cvt->name)) {
list_add_tail(&port->head, &pcm->port_list);
if (port->eld.monitor_present && port->eld.eld_valid) {
hdac_hdmi_jack_report(pcm, port, true);
hdac_hdmi_jack_report_sync(pcm, port, true);
mutex_unlock(&hdmi->pin_mutex);
return ret;
}
Expand Down Expand Up @@ -1281,16 +1301,20 @@ static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin,
* report jack here. It will be done in usermode mux
* control select.
*/
if (pcm)
if (pcm) {
hdac_hdmi_jack_report(pcm, port, false);
schedule_work(&port->dapm_work);
}

mutex_unlock(&hdmi->pin_mutex);
return;
}

if (port->eld.monitor_present && port->eld.eld_valid) {
if (pcm)
if (pcm) {
hdac_hdmi_jack_report(pcm, port, true);
schedule_work(&port->dapm_work);
}

print_hex_dump_debug("ELD: ", DUMP_PREFIX_OFFSET, 16, 1,
port->eld.eld_buffer, port->eld.eld_size, false);
Expand Down Expand Up @@ -1319,6 +1343,7 @@ static int hdac_hdmi_add_ports(struct hdac_device *hdev,
for (i = 0; i < max_ports; i++) {
ports[i].id = i;
ports[i].pin = pin;
INIT_WORK(&ports[i].dapm_work, hdac_hdmi_jack_dapm_work);
}
pin->ports = ports;
pin->num_ports = max_ports;
Expand Down Expand Up @@ -2083,8 +2108,20 @@ static int hdac_hdmi_dev_probe(struct hdac_device *hdev)
return ret;
}

static void clear_dapm_works(struct hdac_device *hdev)
{
struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
struct hdac_hdmi_pin *pin;
int i;

list_for_each_entry(pin, &hdmi->pin_list, head)
for (i = 0; i < pin->num_ports; i++)
cancel_work_sync(&pin->ports[i].dapm_work);
}

static int hdac_hdmi_dev_remove(struct hdac_device *hdev)
{
clear_dapm_works(hdev);
snd_hdac_display_power(hdev->bus, hdev->addr, false);

return 0;
Expand All @@ -2103,6 +2140,8 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
if (!bus)
return 0;

clear_dapm_works(hdev);

/*
* Power down afg.
* codec_read is preferred over codec_write to set the power state.
Expand Down
6 changes: 6 additions & 0 deletions sound/soc/codecs/max98373.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,12 @@ static int max98373_dai_hw_params(struct snd_pcm_substream *substream,
case 48000:
sampling_rate = MAX98373_PCM_SR_SET1_SR_48000;
break;
case 88200:
sampling_rate = MAX98373_PCM_SR_SET1_SR_88200;
break;
case 96000:
sampling_rate = MAX98373_PCM_SR_SET1_SR_96000;
break;
default:
dev_err(component->dev, "rate %d not supported\n",
params_rate(params));
Expand Down
2 changes: 2 additions & 0 deletions sound/soc/codecs/max98373.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@
#define MAX98373_PCM_SR_SET1_SR_32000 (0x6 << 0)
#define MAX98373_PCM_SR_SET1_SR_44100 (0x7 << 0)
#define MAX98373_PCM_SR_SET1_SR_48000 (0x8 << 0)
#define MAX98373_PCM_SR_SET1_SR_88200 (0x9 << 0)
#define MAX98373_PCM_SR_SET1_SR_96000 (0xA << 0)

/* MAX98373_R2028_PCM_SR_SETUP_2 */
#define MAX98373_PCM_SR_SET2_SR_MASK (0xF << 4)
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/codecs/wm8737.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ SOC_DOUBLE("Polarity Invert Switch", WM8737_ADC_CONTROL, 5, 6, 1, 0),
SOC_SINGLE("3D Switch", WM8737_3D_ENHANCE, 0, 1, 0),
SOC_SINGLE("3D Depth", WM8737_3D_ENHANCE, 1, 15, 0),
SOC_ENUM("3D Low Cut-off", low_3d),
SOC_ENUM("3D High Cut-off", low_3d),
SOC_ENUM("3D High Cut-off", high_3d),
SOC_SINGLE_TLV("3D ADC Volume", WM8737_3D_ENHANCE, 7, 1, 1, adc_tlv),

SOC_SINGLE("Noise Gate Switch", WM8737_NOISE_GATE, 0, 1, 0),
Expand Down
56 changes: 35 additions & 21 deletions sound/soc/codecs/wm8904.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,18 +545,6 @@ static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0);
static const DECLARE_TLV_DB_SCALE(sidetone_tlv, -3600, 300, 0);
static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);

static const char *input_mode_text[] = {
"Single-Ended", "Differential Line", "Differential Mic"
};

static SOC_ENUM_SINGLE_DECL(lin_mode,
WM8904_ANALOGUE_LEFT_INPUT_1, 0,
input_mode_text);

static SOC_ENUM_SINGLE_DECL(rin_mode,
WM8904_ANALOGUE_RIGHT_INPUT_1, 0,
input_mode_text);

static const char *hpf_mode_text[] = {
"Hi-fi", "Voice 1", "Voice 2", "Voice 3"
};
Expand Down Expand Up @@ -591,9 +579,6 @@ static const struct snd_kcontrol_new wm8904_adc_snd_controls[] = {
SOC_DOUBLE_R_TLV("Digital Capture Volume", WM8904_ADC_DIGITAL_VOLUME_LEFT,
WM8904_ADC_DIGITAL_VOLUME_RIGHT, 1, 119, 0, digital_tlv),

SOC_ENUM("Left Capture Mode", lin_mode),
SOC_ENUM("Right Capture Mode", rin_mode),

/* No TLV since it depends on mode */
SOC_DOUBLE_R("Capture Volume", WM8904_ANALOGUE_LEFT_INPUT_0,
WM8904_ANALOGUE_RIGHT_INPUT_0, 0, 31, 0),
Expand Down Expand Up @@ -852,6 +837,10 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
return 0;
}

static const char *input_mode_text[] = {
"Single-Ended", "Differential Line", "Differential Mic"
};

static const char *lin_text[] = {
"IN1L", "IN2L", "IN3L"
};
Expand All @@ -866,7 +855,14 @@ static SOC_ENUM_SINGLE_DECL(lin_inv_enum, WM8904_ANALOGUE_LEFT_INPUT_1, 4,
lin_text);

static const struct snd_kcontrol_new lin_inv_mux =
SOC_DAPM_ENUM("Left Capture Inveting Mux", lin_inv_enum);
SOC_DAPM_ENUM("Left Capture Inverting Mux", lin_inv_enum);

static SOC_ENUM_SINGLE_DECL(lin_mode_enum,
WM8904_ANALOGUE_LEFT_INPUT_1, 0,
input_mode_text);

static const struct snd_kcontrol_new lin_mode =
SOC_DAPM_ENUM("Left Capture Mode", lin_mode_enum);

static const char *rin_text[] = {
"IN1R", "IN2R", "IN3R"
Expand All @@ -882,7 +878,14 @@ static SOC_ENUM_SINGLE_DECL(rin_inv_enum, WM8904_ANALOGUE_RIGHT_INPUT_1, 4,
rin_text);

static const struct snd_kcontrol_new rin_inv_mux =
SOC_DAPM_ENUM("Right Capture Inveting Mux", rin_inv_enum);
SOC_DAPM_ENUM("Right Capture Inverting Mux", rin_inv_enum);

static SOC_ENUM_SINGLE_DECL(rin_mode_enum,
WM8904_ANALOGUE_RIGHT_INPUT_1, 0,
input_mode_text);

static const struct snd_kcontrol_new rin_mode =
SOC_DAPM_ENUM("Right Capture Mode", rin_mode_enum);

static const char *aif_text[] = {
"Left", "Right"
Expand Down Expand Up @@ -932,9 +935,11 @@ SND_SOC_DAPM_SUPPLY("MICBIAS", WM8904_MIC_BIAS_CONTROL_0, 0, 0, NULL, 0),
SND_SOC_DAPM_MUX("Left Capture Mux", SND_SOC_NOPM, 0, 0, &lin_mux),
SND_SOC_DAPM_MUX("Left Capture Inverting Mux", SND_SOC_NOPM, 0, 0,
&lin_inv_mux),
SND_SOC_DAPM_MUX("Left Capture Mode", SND_SOC_NOPM, 0, 0, &lin_mode),
SND_SOC_DAPM_MUX("Right Capture Mux", SND_SOC_NOPM, 0, 0, &rin_mux),
SND_SOC_DAPM_MUX("Right Capture Inverting Mux", SND_SOC_NOPM, 0, 0,
&rin_inv_mux),
SND_SOC_DAPM_MUX("Right Capture Mode", SND_SOC_NOPM, 0, 0, &rin_mode),

SND_SOC_DAPM_PGA("Left Capture PGA", WM8904_POWER_MANAGEMENT_0, 1, 0,
NULL, 0),
Expand Down Expand Up @@ -1057,6 +1062,12 @@ static const struct snd_soc_dapm_route adc_intercon[] = {
{ "Left Capture Inverting Mux", "IN2L", "IN2L" },
{ "Left Capture Inverting Mux", "IN3L", "IN3L" },

{ "Left Capture Mode", "Single-Ended", "Left Capture Inverting Mux" },
{ "Left Capture Mode", "Differential Line", "Left Capture Mux" },
{ "Left Capture Mode", "Differential Line", "Left Capture Inverting Mux" },
{ "Left Capture Mode", "Differential Mic", "Left Capture Mux" },
{ "Left Capture Mode", "Differential Mic", "Left Capture Inverting Mux" },

{ "Right Capture Mux", "IN1R", "IN1R" },
{ "Right Capture Mux", "IN2R", "IN2R" },
{ "Right Capture Mux", "IN3R", "IN3R" },
Expand All @@ -1065,11 +1076,14 @@ static const struct snd_soc_dapm_route adc_intercon[] = {
{ "Right Capture Inverting Mux", "IN2R", "IN2R" },
{ "Right Capture Inverting Mux", "IN3R", "IN3R" },

{ "Left Capture PGA", NULL, "Left Capture Mux" },
{ "Left Capture PGA", NULL, "Left Capture Inverting Mux" },
{ "Right Capture Mode", "Single-Ended", "Right Capture Inverting Mux" },
{ "Right Capture Mode", "Differential Line", "Right Capture Mux" },
{ "Right Capture Mode", "Differential Line", "Right Capture Inverting Mux" },
{ "Right Capture Mode", "Differential Mic", "Right Capture Mux" },
{ "Right Capture Mode", "Differential Mic", "Right Capture Inverting Mux" },

{ "Right Capture PGA", NULL, "Right Capture Mux" },
{ "Right Capture PGA", NULL, "Right Capture Inverting Mux" },
{ "Left Capture PGA", NULL, "Left Capture Mode" },
{ "Right Capture PGA", NULL, "Right Capture Mode" },

{ "AIFOUTL Mux", "Left", "ADCL" },
{ "AIFOUTL Mux", "Right", "ADCR" },
Expand Down
Loading

0 comments on commit dd28d54

Please sign in to comment.