ASoC: mediatek: mt8183: some cleanups
Subsystems (3)
cover ASoC: mediatek: mt8183: some cleanups
The series contains some cleanup refactors and should not change any behavior.
Tzung-Bi Shih (4):
ASoC: mediatek: mt8183: move private structure
ASoC: mediatek: mt8183: move headset jack to card-specific storage
ASoC: mediatek: mt8183: remove forward declaration of headset_init
ASoC: mediatek: mt8183: fix space issues
.../mt8183/mt8183-mt6358-ts3a227-max98357.c | 55 +++++++++---------- 1 file changed, 26 insertions(+), 29 deletions(-)
Signature · 1 line
2.23.0.187.g17f5b7556c-goog
PATCH 1/4 ASoC: mediatek: mt8183: move private structure
Move private structure to the beginning of file to declare earlier so that most functions can see it.
--- .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-)
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +16 -16
@@ -17,6 +17,22 @@static struct snd_soc_jack headset_jack; +enum PINCTRL_PIN_STATE { +PIN_STATE_DEFAULT =0 , +PIN_TDM_OUT_ON , +PIN_TDM_OUT_OFF , +PIN_STATE_MAX +}; + +static const char *const mt8183_pin_str[PIN_STATE_MAX ] = { +"default" ,"aud_tdm_out_on" ,"aud_tdm_out_off" , +}; + +struct mt8183_mt6358_ts3a227_max98357_priv { +struct pinctrl *pinctrl; +struct pinctrl_state *pin_states[PIN_STATE_MAX ]; +}; +static int mt8183_mt6358_i2s_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params) {
@@ -46,22 +62,6 @@ static int mt8183_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,return 0 ; } -enum PINCTRL_PIN_STATE { -PIN_STATE_DEFAULT =0 , -PIN_TDM_OUT_ON , -PIN_TDM_OUT_OFF , -PIN_STATE_MAX -}; - -static const char *const mt8183_pin_str[PIN_STATE_MAX ] = { -"default" ,"aud_tdm_out_on" ,"aud_tdm_out_off" , -}; - -struct mt8183_mt6358_ts3a227_max98357_priv { -struct pinctrl *pinctrl; -struct pinctrl_state *pin_states[PIN_STATE_MAX ]; -}; -static int mt8183_mt6358_ts3a227_max98357_bt_sco_startup (struct snd_pcm_substream *substream)
Signature · 1 line
2.23.0.187.g17f5b7556c-goog
Mark Brown
maintainerApplied "ASoC: mediatek: mt8183: move private structure" to the asoc tree
The patch
ASoC: mediatek: mt8183: move private structure
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
96ed76983307a8a24400495e4e6453607e765fcfMon Sep 17 00:00:00 2001
From: Tzung-Bi Shih <[email protected]>
Date: Fri, 30 Aug 2019 15:42:37 +0800
Subject: [PATCH] ASoC: mediatek: mt8183: move private structure
Move private structure to the beginning of file to declare earlier so that most functions can see it.
--- .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-)
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +16 -16
@@ -17,6 +17,22 @@static struct snd_soc_jack headset_jack; +enum PINCTRL_PIN_STATE { +PIN_STATE_DEFAULT =0 , +PIN_TDM_OUT_ON , +PIN_TDM_OUT_OFF , +PIN_STATE_MAX +}; + +static const char *const mt8183_pin_str[PIN_STATE_MAX ] = { +"default" ,"aud_tdm_out_on" ,"aud_tdm_out_off" , +}; + +struct mt8183_mt6358_ts3a227_max98357_priv { +struct pinctrl *pinctrl; +struct pinctrl_state *pin_states[PIN_STATE_MAX ]; +}; +static int mt8183_mt6358_i2s_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params) {
@@ -46,22 +62,6 @@ static int mt8183_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,return 0 ; } -enum PINCTRL_PIN_STATE { -PIN_STATE_DEFAULT =0 , -PIN_TDM_OUT_ON , -PIN_TDM_OUT_OFF , -PIN_STATE_MAX -}; - -static const char *const mt8183_pin_str[PIN_STATE_MAX ] = { -"default" ,"aud_tdm_out_on" ,"aud_tdm_out_off" , -}; - -struct mt8183_mt6358_ts3a227_max98357_priv { -struct pinctrl *pinctrl; -struct pinctrl_state *pin_states[PIN_STATE_MAX ]; -}; -static int mt8183_mt6358_ts3a227_max98357_bt_sco_startup (struct snd_pcm_substream *substream)
Signature · 1 line
2.20.1
PATCH 2/4 ASoC: mediatek: mt8183: move headset jack to card-specific storage
In reply to Tzung-Bi ShihMove headset jack descriptor from module global scope to card-specific storage to make its ownership more explicit.
--- .../soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +5 -4
@@ -15,8 +15,6 @@#include "mt8183-afe-common.h" #include "../../codecs/ts3a227e.h" -static struct snd_soc_jack headset_jack; -enum PINCTRL_PIN_STATE {PIN_STATE_DEFAULT =0 ,PIN_TDM_OUT_ON ,
@@ -31,6 +29,7 @@ static const char * const mt8183_pin_str[PIN_STATE_MAX] = {struct mt8183_mt6358_ts3a227_max98357_priv {struct pinctrl *pinctrl;struct pinctrl_state *pin_states[PIN_STATE_MAX ]; +struct snd_soc_jack headset_jack; }; static int mt8183_mt6358_i2s_hw_params(struct snd_pcm_substream *substream,
@@ -410,6 +409,8 @@ static int mt8183_mt6358_ts3a227_max98357_headset_init(struct snd_soc_component *component) {int ret; +struct mt8183_mt6358_ts3a227_max98357_priv *priv = +snd_soc_card_get_drvdata (component->card);/* Enable Headset and 4 Buttons Jack detection */ ret = snd_soc_card_jack_new(&mt8183_mt6358_ts3a227_max98357_card,
@@ -417,12 +418,12 @@ mt8183_mt6358_ts3a227_max98357_headset_init(struct snd_soc_component *component)SND_JACK_HEADSET |SND_JACK_BTN_0 |SND_JACK_BTN_1 |SND_JACK_BTN_2 |SND_JACK_BTN_3 , - &headset_jack, + &priv->headset_jack, NULL, 0);if (ret)return ret; - ret =ts3a227e_enable_jack_detect (component, &headset_jack); + ret =ts3a227e_enable_jack_detect (component, &priv->headset_jack);return ret; }
Signature · 1 line
2.23.0.187.g17f5b7556c-goog
Mark Brown
maintainerApplied "ASoC: mediatek: mt8183: move headset jack to card-specific storage" to the asoc tree
The patch
ASoC: mediatek: mt8183: move headset jack to card-specific storage
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
95d779b4b8e7a62d53c7afeba45207089dcee4c8Mon Sep 17 00:00:00 2001
From: Tzung-Bi Shih <[email protected]>
Date: Fri, 30 Aug 2019 15:42:38 +0800
Subject: [PATCH] ASoC: mediatek: mt8183: move headset jack to card-specific
storage
Move headset jack descriptor from module global scope to card-specific storage to make its ownership more explicit.
--- .../soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +5 -4
@@ -15,8 +15,6 @@#include "mt8183-afe-common.h" #include "../../codecs/ts3a227e.h" -static struct snd_soc_jack headset_jack; -enum PINCTRL_PIN_STATE {PIN_STATE_DEFAULT =0 ,PIN_TDM_OUT_ON ,
@@ -31,6 +29,7 @@ static const char * const mt8183_pin_str[PIN_STATE_MAX] = {struct mt8183_mt6358_ts3a227_max98357_priv {struct pinctrl *pinctrl;struct pinctrl_state *pin_states[PIN_STATE_MAX ]; +struct snd_soc_jack headset_jack; }; static int mt8183_mt6358_i2s_hw_params(struct snd_pcm_substream *substream,
@@ -410,6 +409,8 @@ static int mt8183_mt6358_ts3a227_max98357_headset_init(struct snd_soc_component *component) {int ret; +struct mt8183_mt6358_ts3a227_max98357_priv *priv = +snd_soc_card_get_drvdata (component->card);/* Enable Headset and 4 Buttons Jack detection */ ret = snd_soc_card_jack_new(&mt8183_mt6358_ts3a227_max98357_card,
@@ -417,12 +418,12 @@ mt8183_mt6358_ts3a227_max98357_headset_init(struct snd_soc_component *component)SND_JACK_HEADSET |SND_JACK_BTN_0 |SND_JACK_BTN_1 |SND_JACK_BTN_2 |SND_JACK_BTN_3 , - &headset_jack, + &priv->headset_jack, NULL, 0);if (ret)return ret; - ret =ts3a227e_enable_jack_detect (component, &headset_jack); + ret =ts3a227e_enable_jack_detect (component, &priv->headset_jack);return ret; }
Signature · 1 line
2.20.1
PATCH 3/4 ASoC: mediatek: mt8183: remove forward declaration of headset_init
In reply to Tzung-Bi ShihThe forward declaration of mt8183_mt6358_ts3a227_max98357_headset_init is for cyclic dependency between card, headset_dev, and headset_init.
It used to be:
- card depends on headset_dev
- headset_dev depends on headset_init
- headset_init depends on card
Commit a962a809e5e4 ("ASoC: mediatek: mt8183: make headset codec optional") removed the cyclic dependency.
Thus, it is safe to remove the forward declaration.
--- .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +5 -8
@@ -390,14 +390,6 @@ mt8183_mt6358_ts3a227_max98357_dai_links[] = { }, }; -static int -mt8183_mt6358_ts3a227_max98357_headset_init (struct snd_soc_component *cpnt); - -static struct snd_soc_aux_dev mt8183_mt6358_ts3a227_max98357_headset_dev = { - .dlc =COMP_EMPTY (), - .init = mt8183_mt6358_ts3a227_max98357_headset_init, -}; -static struct snd_soc_card mt8183_mt6358_ts3a227_max98357_card = { .name ="mt8183_mt6358_ts3a227_max98357" , .owner =THIS_MODULE ,
@@ -428,6 +420,11 @@ mt8183_mt6358_ts3a227_max98357_headset_init(struct snd_soc_component *component)return ret; } +static struct snd_soc_aux_dev mt8183_mt6358_ts3a227_max98357_headset_dev = { + .dlc =COMP_EMPTY (), + .init = mt8183_mt6358_ts3a227_max98357_headset_init, +}; +static int mt8183_mt6358_ts3a227_max98357_dev_probe (struct platform_device *pdev) {
Signature · 1 line
2.23.0.187.g17f5b7556c-goog
Mark Brown
maintainerApplied "ASoC: mediatek: mt8183: remove forward declaration of headset_init" to the asoc tree
The patch
ASoC: mediatek: mt8183: remove forward declaration of headset_init
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
fc347483b87f029c1bc18a8492623ca21dcd7607Mon Sep 17 00:00:00 2001
From: Tzung-Bi Shih <[email protected]>
Date: Fri, 30 Aug 2019 15:42:39 +0800
Subject: [PATCH] ASoC: mediatek: mt8183: remove forward declaration of
headset_init
The forward declaration of mt8183_mt6358_ts3a227_max98357_headset_init is for cyclic dependency between card, headset_dev, and headset_init.
It used to be:
- card depends on headset_dev
- headset_dev depends on headset_init
- headset_init depends on card
Commit a962a809e5e4 ("ASoC: mediatek: mt8183: make headset codec optional") removed the cyclic dependency.
Thus, it is safe to remove the forward declaration.
--- .../mt8183/mt8183-mt6358-ts3a227-max98357.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +5 -8
@@ -390,14 +390,6 @@ mt8183_mt6358_ts3a227_max98357_dai_links[] = { }, }; -static int -mt8183_mt6358_ts3a227_max98357_headset_init (struct snd_soc_component *cpnt); - -static struct snd_soc_aux_dev mt8183_mt6358_ts3a227_max98357_headset_dev = { - .dlc =COMP_EMPTY (), - .init = mt8183_mt6358_ts3a227_max98357_headset_init, -}; -static struct snd_soc_card mt8183_mt6358_ts3a227_max98357_card = { .name ="mt8183_mt6358_ts3a227_max98357" , .owner =THIS_MODULE ,
@@ -428,6 +420,11 @@ mt8183_mt6358_ts3a227_max98357_headset_init(struct snd_soc_component *component)return ret; } +static struct snd_soc_aux_dev mt8183_mt6358_ts3a227_max98357_headset_dev = { + .dlc =COMP_EMPTY (), + .init = mt8183_mt6358_ts3a227_max98357_headset_init, +}; +static int mt8183_mt6358_ts3a227_max98357_dev_probe (struct platform_device *pdev) {
Signature · 1 line
2.20.1
PATCH 4/4 ASoC: mediatek: mt8183: fix space issues
In reply to Tzung-Bi ShihFix space issues:
- No space before ';'.
- No trailing blank line.
--- sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +1 -2
@@ -471,7 +471,7 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev)return PTR_ERR (priv->pinctrl); } -for (i =0 ; i <PIN_STATE_MAX ; i++) { +for (i =0 ; i <PIN_STATE_MAX ; i++) { priv->pin_states[i] =pinctrl_lookup_state (priv->pinctrl, mt8183_pin_str[i]);if (IS_ERR (priv->pin_states[i])) {
@@ -526,4 +526,3 @@ MODULE_DESCRIPTION("MT8183-MT6358-TS3A227-MAX98357 ALSA SoC machine driver");MODULE_AUTHOR ("Shunli Wang <[email protected]>" );MODULE_LICENSE ("GPL v2" );MODULE_ALIAS ("mt8183_mt6358_ts3a227_max98357 soc card" ); -
Signature · 1 line
2.23.0.187.g17f5b7556c-goog
Mark Brown
maintainerApplied "ASoC: mediatek: mt8183: fix space issues" to the asoc tree
The patch
ASoC: mediatek: mt8183: fix space issues
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
e5b3ae3e8c4772106713698075a87bff1e86e710Mon Sep 17 00:00:00 2001
From: Tzung-Bi Shih <[email protected]>
Date: Fri, 30 Aug 2019 15:42:40 +0800
Subject: [PATCH] ASoC: mediatek: mt8183: fix space issues
Fix space issues:
- No space before ';'.
- No trailing blank line.
--- sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +1 -2
@@ -471,7 +471,7 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev)return PTR_ERR (priv->pinctrl); } -for (i =0 ; i <PIN_STATE_MAX ; i++) { +for (i =0 ; i <PIN_STATE_MAX ; i++) { priv->pin_states[i] =pinctrl_lookup_state (priv->pinctrl, mt8183_pin_str[i]);if (IS_ERR (priv->pin_states[i])) {
@@ -526,4 +526,3 @@ MODULE_DESCRIPTION("MT8183-MT6358-TS3A227-MAX98357 ALSA SoC machine driver");MODULE_AUTHOR ("Shunli Wang <[email protected]>" );MODULE_LICENSE ("GPL v2" );MODULE_ALIAS ("mt8183_mt6358_ts3a227_max98357 soc card" ); -
Signature · 1 line
2.20.1