diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-06 09:08:38 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-06 09:08:38 -0700 |
commit | 126f7051b4daa3716d9af2851dcb55316e4c2b25 (patch) | |
tree | e2f29bf57f28110d8fe42faaded6f83ffc52ec06 /sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c | |
parent | 135c5504a600ff9b06e321694fbcac78a9530cd4 (diff) | |
parent | d4d5a1cd298e67cb68cca8dc7dd1ea3942cce3ff (diff) | |
download | linux-126f7051b4daa3716d9af2851dcb55316e4c2b25.tar.bz2 |
Merge tag 'sound-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai:
"We've got many code additions at this cycle as a result of quite a few
new drivers. Below are highlights:
Core stuff:
- Fix the long-standing issue with the device registration order; the
control device is now registered at last
- PCM locking code cleanups for RT kernels
- Fixes for possible races in ALSA timer resolution accesses
- TLV offset definitions in uapi
ASoC:
- Many fixes for the topology stuff, including fixes for v4 ABI
compatibility
- Lots of cleanups / quirks for Intel platforms based on Realtek
CODECs
- Continued componentization works, removing legacy CODEC stuff
- Conversion of OMAP DMA to the new, more standard SDMA-PCM driver
- Fixes and updates to Cirrus Logic SoC drivers
- New Qualcomm DSP support
- New drivers for Analog SSM2305, Atmel I2S controllers, Mediatek
MT6351, MT6797 and MT7622, Qualcomm DSPs, Realtek RT1305, RT1306
and RT5668 and TI TSCS454
HD-audio:
- Finally better support for some CA0132 boards, allowing Windows
firmware
- HP Spectre x360 support along with a bulk of COEF stuff
- Blacklisting power save default some known boards reported on
Fedora
USB-audio:
- Continued improvements on UAC3 support; now BADD is supported
- Fixes / improvements for Dell WD15 dock
- Allow DMA coherent pages for PCM buffers for ARCH, MIPS & co
Others:
- New Xen sound frontend driver support
- Cache implementation and other improvements for FireWire DICE
- Conversions to octal permissions in allover places"
* tag 'sound-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (386 commits)
ASoC: dapm: delete dapm_kcontrol_data paths list before freeing it
ALSA: usb-audio: remove redundant check on err
ASoC: topology: Move skl-tplg-interface.h to uapi
ASoC: topology: Move v4 manifest header data structures to uapi
ASoC: topology: Improve backwards compatibility with v4 topology files
ALSA: pci/hda: Remove unused, broken, header file
ASoC: TSCS454: Add Support
ASoC: Intel: kbl: Move codec sysclk config to codec_init function
ASoC: simple-card: set cpu dai clk in hw_params
ALSA: hda - Handle kzalloc() failure in snd_hda_attach_pcm_stream()
ALSA: oxygen: use match_string() helper
ASoC: dapm: use match_string() helper
ASoC: max98095: use match_string() helper
ASoC: max98088: use match_string() helper
ASoC: Intel: bytcr_rt5651: Set card long_name based on quirks
ASoC: mt6797-mt6351: add hostless phone call path
ASoC: mt6797: add Hostless DAI
ASoC: mt6797: add PCM interface
ASoC: mediatek: export mtk-afe symbols as needed
ASoC: codecs: PCM1789: include gpio/consumer.h
...
Diffstat (limited to 'sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c')
-rw-r--r-- | sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c b/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c index 949fc3a1d025..ae620890bb3a 100644 --- a/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c +++ b/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c @@ -1,17 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * mt2701-afe-clock-ctrl.c -- Mediatek 2701 afe clock ctrl * * Copyright (c) 2016 MediaTek Inc. * Author: Garlic Tseng <garlic.tseng@mediatek.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 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. + * Ryder Lee <ryder.lee@mediatek.com> */ #include "mt2701-afe-common.h" @@ -43,8 +36,9 @@ int mt2701_init_clock(struct mtk_base_afe *afe) } /* Get I2S related clocks */ - for (i = 0; i < MT2701_I2S_NUM; i++) { + for (i = 0; i < afe_priv->soc->i2s_num; i++) { struct mt2701_i2s_path *i2s_path = &afe_priv->i2s_path[i]; + struct clk *i2s_ck; char name[13]; snprintf(name, sizeof(name), "i2s%d_src_sel", i); @@ -69,18 +63,20 @@ int mt2701_init_clock(struct mtk_base_afe *afe) } snprintf(name, sizeof(name), "i2so%d_hop_ck", i); - i2s_path->hop_ck[I2S_OUT] = devm_clk_get(afe->dev, name); - if (IS_ERR(i2s_path->hop_ck[I2S_OUT])) { + i2s_ck = devm_clk_get(afe->dev, name); + if (IS_ERR(i2s_ck)) { dev_err(afe->dev, "failed to get %s\n", name); - return PTR_ERR(i2s_path->hop_ck[I2S_OUT]); + return PTR_ERR(i2s_ck); } + i2s_path->hop_ck[SNDRV_PCM_STREAM_PLAYBACK] = i2s_ck; snprintf(name, sizeof(name), "i2si%d_hop_ck", i); - i2s_path->hop_ck[I2S_IN] = devm_clk_get(afe->dev, name); - if (IS_ERR(i2s_path->hop_ck[I2S_IN])) { + i2s_ck = devm_clk_get(afe->dev, name); + if (IS_ERR(i2s_ck)) { dev_err(afe->dev, "failed to get %s\n", name); - return PTR_ERR(i2s_path->hop_ck[I2S_IN]); + return PTR_ERR(i2s_ck); } + i2s_path->hop_ck[SNDRV_PCM_STREAM_CAPTURE] = i2s_ck; snprintf(name, sizeof(name), "asrc%d_out_ck", i); i2s_path->asrco_ck = devm_clk_get(afe->dev, name); @@ -102,10 +98,10 @@ int mt2701_init_clock(struct mtk_base_afe *afe) return 0; } -int mt2701_afe_enable_i2s(struct mtk_base_afe *afe, int id, int dir) +int mt2701_afe_enable_i2s(struct mtk_base_afe *afe, + struct mt2701_i2s_path *i2s_path, + int dir) { - struct mt2701_afe_private *afe_priv = afe->platform_priv; - struct mt2701_i2s_path *i2s_path = &afe_priv->i2s_path[id]; int ret; ret = clk_prepare_enable(i2s_path->asrco_ck); @@ -128,11 +124,10 @@ err_hop_ck: return ret; } -void mt2701_afe_disable_i2s(struct mtk_base_afe *afe, int id, int dir) +void mt2701_afe_disable_i2s(struct mtk_base_afe *afe, + struct mt2701_i2s_path *i2s_path, + int dir) { - struct mt2701_afe_private *afe_priv = afe->platform_priv; - struct mt2701_i2s_path *i2s_path = &afe_priv->i2s_path[id]; - clk_disable_unprepare(i2s_path->hop_ck[dir]); clk_disable_unprepare(i2s_path->asrco_ck); } @@ -272,27 +267,32 @@ int mt2701_afe_disable_clock(struct mtk_base_afe *afe) return 0; } -void mt2701_mclk_configuration(struct mtk_base_afe *afe, int id, int domain, - int mclk) +int mt2701_mclk_configuration(struct mtk_base_afe *afe, int id) + { struct mt2701_afe_private *priv = afe->platform_priv; struct mt2701_i2s_path *i2s_path = &priv->i2s_path[id]; - int ret; + int ret = -EINVAL; /* Set mclk source */ - if (domain == 0) + if (!(MT2701_PLL_DOMAIN_0_RATE % i2s_path->mclk_rate)) ret = clk_set_parent(i2s_path->sel_ck, priv->base_ck[MT2701_TOP_AUD_MCLK_SRC0]); - else + else if (!(MT2701_PLL_DOMAIN_1_RATE % i2s_path->mclk_rate)) ret = clk_set_parent(i2s_path->sel_ck, priv->base_ck[MT2701_TOP_AUD_MCLK_SRC1]); - if (ret) - dev_err(afe->dev, "failed to set domain%d mclk source %d\n", - domain, ret); + if (ret) { + dev_err(afe->dev, "failed to set mclk source\n"); + return ret; + } /* Set mclk divider */ - ret = clk_set_rate(i2s_path->div_ck, mclk); - if (ret) + ret = clk_set_rate(i2s_path->div_ck, i2s_path->mclk_rate); + if (ret) { dev_err(afe->dev, "failed to set mclk divider %d\n", ret); + return ret; + } + + return 0; } |