[RFC] ASoC: Add compatible for mt6359-sound device

2020-11-30 Thread Shane Chien
From: "Shane.Chien" 

In the change "[v2,1/2] Add mediatek codec mt6359 driver",
The compatible of mt6359-sound device is removed
due to it is regarded as a part of parent device,
which is only reflecting Linux model instead of hardware.
However, if the device is not given a comaptible,
of_node of struct device is null. I cannot use
devm_iio_channel_get such iio interface to get
auxadc value from iio channel. Because during
using devm_iio_channel_get, of_node of mt6359-sound is a
input parameter of of_iio_channel_get_by_name.
If the of_node is null, devm_iio_channel_get will
eventually return ENODEV error.
static struct iio_channel *of_iio_channel_get_by_name(struct device_node *np,
  const char *name)
{
struct iio_channel *chan = NULL;

/* Walk up the tree of devices looking for a matching iio channel */
while (np) {  // np is null and will not enter the while loop

}
return chan; // directly return null
}
I add the compatible back to mt6359.c and it
can successfully use devm_iio_channel_get without error.
Is there any suggestions if I need to use this kind of
native interface or can I add the compatible directly?
And I wonder what kind of device can add compatible
under mfd device?

Signed-off-by: Shane.Chien 
---
 sound/soc/codecs/mt6359.c |   58 +
 sound/soc/codecs/mt6359.h |7 ++
 2 files changed, 65 insertions(+)

diff --git a/sound/soc/codecs/mt6359.c b/sound/soc/codecs/mt6359.c
index 6de0d74..1fb47f4 100644
--- a/sound/soc/codecs/mt6359.c
+++ b/sound/soc/codecs/mt6359.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2741,6 +2742,37 @@ static void mt6359_codec_remove(struct snd_soc_component 
*cmpnt)
.num_dapm_routes = ARRAY_SIZE(mt6359_dapm_routes),
 };
 
+/* dc trim */
+static int mt6359_get_audio_auxadc(struct mt6359_priv *priv, int auxadc_ch)
+{
+   int value = 0;
+   int ret;
+   struct iio_channel *auxadc;
+
+   switch (auxadc_ch) {
+   case AUXADC_HP_OFFSET_CAL:
+   auxadc = priv->hpofs_cal_auxadc;
+   break;
+   case AUXADC_ACCDET:
+   auxadc = priv->accdet_auxadc;
+   break;
+   default:
+   pr_notice("%s() not support\n");
+   break;
+   }
+
+   if (!IS_ERR(auxadc)) {
+   ret = iio_read_channel_processed(auxadc, );
+   if (ret < 0) {
+   pr_err("Error: %s read fail (%d)\n", __func__, ret);
+   return ret;
+   }
+   }
+   pr_info("%s() value %d\n", __func__, value);
+
+   return value;
+}
+
 static int mt6359_parse_dt(struct mt6359_priv *priv)
 {
int ret;
@@ -2783,6 +2815,25 @@ static int mt6359_parse_dt(struct mt6359_priv *priv)
priv->mux_select[MUX_MIC_TYPE_2] = MIC_TYPE_MUX_IDLE;
}
 
+   /* get auxadc channel */
+   priv->hpofs_cal_auxadc = devm_iio_channel_get(dev,
+ "pmic_hpofs_cal");
+   ret = PTR_ERR_OR_ZERO(priv->hpofs_cal_auxadc);
+   if (ret) {
+   if (ret != -EPROBE_DEFER)
+   dev_err(dev,
+   "%s() Get pmic_hpofs_cal iio ch failed (%d)\n",
+   __func__, ret);
+   }
+   priv->accdet_auxadc = devm_iio_channel_get(dev, "pmic_accdet");
+   ret = PTR_ERR_OR_ZERO(priv->accdet_auxadc);
+   if (ret) {
+   if (ret != -EPROBE_DEFER)
+   dev_err(dev,
+   "%s() Get pmic_accdet iio ch failed (%d)\n",
+   __func__, ret);
+   }
+
return 0;
 }
 
@@ -2818,9 +2869,16 @@ static int mt6359_platform_driver_probe(struct 
platform_device *pdev)
   ARRAY_SIZE(mt6359_dai_driver));
 }
 
+static const struct of_device_id mt6359_of_match[] = {
+   {.compatible = "mediatek,mt6359-sound",},
+   {}
+};
+MODULE_DEVICE_TABLE(of, mt6359_of_match);
+
 static struct platform_driver mt6359_platform_driver = {
.driver = {
.name = "mt6359-sound",
+   .of_match_table = mt6359_of_match,
},
.probe = mt6359_platform_driver_probe,
 };
diff --git a/sound/soc/codecs/mt6359.h b/sound/soc/codecs/mt6359.h
index 35f806b..52d2398 100644
--- a/sound/soc/codecs/mt6359.h
+++ b/sound/soc/codecs/mt6359.h
@@ -2610,6 +2610,11 @@ enum {
PGA_3_MUX_AIN2,
 };
 
+enum {
+   AUXADC_HP_OFFSET_CAL = 0,
+   AUXADC_ACCDET,
+};
+
 struct mt6359_priv {
struct device *dev;
struct regmap *regmap;
@@ -2622,6 +2627,8 @@ struct mt6359_priv {
int hp_gain_ctl;
int hp_hifi_mode;
int mtkaif_protocol;
+   struct iio_channel *hpofs_cal_auxadc;
+   struct iio_channel *accdet_auxadc;
 };
 
 

[PATCH] ASoC: Remove mt6359_platform_driver_remove

2020-11-10 Thread Shane Chien
From: "Shane.Chien" 

remove mt6359_platform_driver_remove due to it is
useless.

Signed-off-by: Shane.Chien 
---
 sound/soc/codecs/mt6359.c |   12 
 1 file changed, 12 deletions(-)

diff --git a/sound/soc/codecs/mt6359.c b/sound/soc/codecs/mt6359.c
index ecdfd57..d37dbd2 100644
--- a/sound/soc/codecs/mt6359.c
+++ b/sound/soc/codecs/mt6359.c
@@ -2817,23 +2817,11 @@ static int mt6359_platform_driver_probe(struct 
platform_device *pdev)
   ARRAY_SIZE(mt6359_dai_driver));
 }
 
-static int mt6359_platform_driver_remove(struct platform_device *pdev)
-{
-   struct mt6359_priv *priv = dev_get_drvdata(>dev);
-   int ret;
-
-   dev_dbg(>dev, "%s(), dev name %s\n",
-   __func__, dev_name(>dev));
-
-   return 0;
-}
-
 static struct platform_driver mt6359_platform_driver = {
.driver = {
.name = "mt6359-sound",
},
.probe = mt6359_platform_driver_probe,
-   .remove = mt6359_platform_driver_remove,
 };
 
 module_platform_driver(mt6359_platform_driver)
-- 
1.7.9.5



[PATCH v3 0/2] Fix vaud18 power leakage of mt6359

2020-11-09 Thread Shane Chien
From: "Shane.Chien" 

This series of patches is to fix vaud18 power leakage problem.
vaud18 will be enable only when mt6359 audio path is turned on.

Change since v2:
 - fix dt-binnding syntex error

Change since v1:
 - use dapm regulator supply widget for vaud18 control.
 - add vaud18 regulator property in mt6359 dt-binding.

Shane.Chien (2):
  ASoC: Fix vaud18 power leakage of mt6359
  dt-bindings: mediatek: mt6359: Add new property for mt6359

 .../devicetree/bindings/sound/mt6359.yaml  |9 +++
 sound/soc/codecs/mt6359.c  |   25 +---
 sound/soc/codecs/mt6359.h  |8 ---
 3 files changed, 10 insertions(+), 32 deletions(-)

-- 
1.7.9.5



[PATCH v3 1/2] ASoC: Fix vaud18 power leakage of mt6359

2020-11-09 Thread Shane Chien
From: "Shane.Chien" 

vaud18 is power of mt6359 audio path. It
should only enable when audio is used,
instead of in boot up stage.
Once mt6359 audio path is enabled or disabled,
vaud18 is controlled by regulator supply widget
"LDO_VAUD18". Due to vaud18 is controlled by
regulator dapm macro instead of regmap, the macro
MT6359_LDO_VAUD18_CON0 and variable avdd_reg
is no used and removed from mt6359.h.

Signed-off-by: Shane.Chien 
---
 sound/soc/codecs/mt6359.c |   25 +
 sound/soc/codecs/mt6359.h |8 
 2 files changed, 1 insertion(+), 32 deletions(-)

diff --git a/sound/soc/codecs/mt6359.c b/sound/soc/codecs/mt6359.c
index d20c59a..ecdfd57 100644
--- a/sound/soc/codecs/mt6359.c
+++ b/sound/soc/codecs/mt6359.c
@@ -1943,9 +1943,7 @@ static int mt_ncp_event(struct snd_soc_dapm_widget *w,
SND_SOC_DAPM_SUPPLY_S("CLK_BUF", SUPPLY_SEQ_CLK_BUF,
  MT6359_DCXO_CW12,
  RG_XO_AUDIO_EN_M_SFT, 0, NULL, 0),
-   SND_SOC_DAPM_SUPPLY_S("LDO_VAUD18", SUPPLY_SEQ_LDO_VAUD18,
- MT6359_LDO_VAUD18_CON0,
- RG_LDO_VAUD18_EN_SFT, 0, NULL, 0),
+   SND_SOC_DAPM_REGULATOR_SUPPLY("LDO_VAUD18", 0, 0),
SND_SOC_DAPM_SUPPLY_S("AUDGLB", SUPPLY_SEQ_AUD_GLB,
  MT6359_AUDDEC_ANA_CON13,
  RG_AUDGLB_PWRDN_VA32_SFT, 1, NULL, 0),
@@ -2807,20 +2805,6 @@ static int mt6359_platform_driver_probe(struct 
platform_device *pdev)
dev_set_drvdata(>dev, priv);
priv->dev = >dev;
 
-   priv->avdd_reg = devm_regulator_get(>dev, "vaud18");
-   if (IS_ERR(priv->avdd_reg)) {
-   dev_err(>dev, "%s(), have no vaud18 supply: %ld",
-   __func__, PTR_ERR(priv->avdd_reg));
-   return PTR_ERR(priv->avdd_reg);
-   }
-
-   ret = regulator_enable(priv->avdd_reg);
-   if (ret) {
-   dev_err(>dev, "%s(), failed to enable regulator!\n",
-   __func__);
-   return ret;
-   }
-
ret = mt6359_parse_dt(priv);
if (ret) {
dev_warn(>dev, "%s() failed to parse dts\n", __func__);
@@ -2841,13 +2825,6 @@ static int mt6359_platform_driver_remove(struct 
platform_device *pdev)
dev_dbg(>dev, "%s(), dev name %s\n",
__func__, dev_name(>dev));
 
-   ret = regulator_disable(priv->avdd_reg);
-   if (ret) {
-   dev_err(>dev, "%s(), failed to disable regulator!\n",
-   __func__);
-   return ret;
-   }
-
return 0;
 }
 
diff --git a/sound/soc/codecs/mt6359.h b/sound/soc/codecs/mt6359.h
index af6f07f..35f806b 100644
--- a/sound/soc/codecs/mt6359.h
+++ b/sound/soc/codecs/mt6359.h
@@ -135,11 +135,6 @@
 /* MT6359_DCXO_CW12 */
 #define RG_XO_AUDIO_EN_M_SFT   13
 
-/* LDO_VAUD18_CON0 */
-#define RG_LDO_VAUD18_EN_SFT   0
-#define RG_LDO_VAUD18_EN_MASK  0x1
-#define RG_LDO_VAUD18_EN_MASK_SFT  (0x1 << 0)
-
 /* AUD_TOP_CKPDN_CON0 */
 #define RG_VOW13M_CK_PDN_SFT   13
 #define RG_VOW13M_CK_PDN_MASK  0x1
@@ -2132,7 +2127,6 @@
 
 #define MT6359_DCXO_CW11   0x7a6
 #define MT6359_DCXO_CW12   0x7a8
-#define MT6359_LDO_VAUD18_CON0 0x1c98
 
 #define MT6359_GPIO_MODE0  0xcc
 #define MT6359_GPIO_MODE0_SET  0xce
@@ -2469,7 +2463,6 @@ enum {
 enum {
/* common */
SUPPLY_SEQ_CLK_BUF,
-   SUPPLY_SEQ_LDO_VAUD18,
SUPPLY_SEQ_AUD_GLB,
SUPPLY_SEQ_HP_PULL_DOWN,
SUPPLY_SEQ_CLKSQ,
@@ -2629,7 +2622,6 @@ struct mt6359_priv {
int hp_gain_ctl;
int hp_hifi_mode;
int mtkaif_protocol;
-   struct regulator *avdd_reg;
 };
 
 #define CODEC_MT6359_NAME "mtk-codec-mt6359"
-- 
1.7.9.5



[PATCH v3 2/2] dt-bindings: mediatek: mt6359: Add new property for mt6359

2020-11-09 Thread Shane Chien
From: "Shane.Chien" 

This patch add "LDO_VAUD18-supply" property to
control vaud18 regulator. It is labeled as required
due to mt6359 audio path always need to enable vaud18.

Signed-off-by: Shane.Chien 
---
 .../devicetree/bindings/sound/mt6359.yaml  |9 +
 1 file changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/mt6359.yaml 
b/Documentation/devicetree/bindings/sound/mt6359.yaml
index a54f466..ef027c7 100644
--- a/Documentation/devicetree/bindings/sound/mt6359.yaml
+++ b/Documentation/devicetree/bindings/sound/mt6359.yaml
@@ -17,6 +17,11 @@ description: |
   Must be a child node of PMIC wrapper.
 
 properties:
+  LDO_VAUD18-supply:
+$ref: /schemas/types.yaml#/definitions/phandle
+description: |
+  Regulator of LDO VAUD18 at 1.8V.
+
   mediatek,dmic-mode:
 $ref: /schemas/types.yaml#/definitions/uint32
 description: |
@@ -49,11 +54,15 @@ properties:
 description: |
   Specifies the type of mic type connected to adc2
 
+required:
+  - LDO_VAUD18-supply
+
 additionalProperties: false
 
 examples:
   - |
 mt6359codec: mt6359codec {
+  LDO_VAUD18-supply = <_vaud18_reg>;
   mediatek,dmic-mode = <0>;
   mediatek,mic-type-0 = <2>;
 };
-- 
1.7.9.5



[PATCH v2 0/2] Fix vaud18 power leakage of mt6359

2020-11-09 Thread Shane Chien
From: "Shane.Chien" 

This series of patches is to fix vaud18 power leakage problem.
vaud18 will be enable only when mt6359 audio path is turned on.

Change since v1:
 - use dapm regulator supply widget for vaud18 control.
 - add vaud18 regulator property in mt6359 dt-binding.

Shane.Chien (2):
  ASoC: Fix vaud18 power leakage of mt6359
  dt-bindings: mediatek: mt6359: Add new property for mt6359

 .../devicetree/bindings/sound/mt6359.yaml  |9 +++
 sound/soc/codecs/mt6359.c  |   25 +---
 sound/soc/codecs/mt6359.h  |8 ---
 3 files changed, 10 insertions(+), 32 deletions(-)

-- 
1.7.9.5



[PATCH v2 2/2] dt-bindings: mediatek: mt6359: Add new property for mt6359

2020-11-09 Thread Shane Chien
From: "Shane.Chien" 

This patch add "LDO_VAUD18-supply" property to
control vaud18 regulator. It is labeled as required
due to mt6359 audio path always need to enable vaud18.

Signed-off-by: Shane.Chien 
---
 .../devicetree/bindings/sound/mt6359.yaml  |9 +
 1 file changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/mt6359.yaml 
b/Documentation/devicetree/bindings/sound/mt6359.yaml
index a54f466..7ccaa8c 100644
--- a/Documentation/devicetree/bindings/sound/mt6359.yaml
+++ b/Documentation/devicetree/bindings/sound/mt6359.yaml
@@ -17,6 +17,11 @@ description: |
   Must be a child node of PMIC wrapper.
 
 properties:
+  LDO_VAUD18-supply:
+ref: /schemas/types.yaml#/definitions/phandle
+description: |
+  Regulator of LDO VAUD18 at 1.8V.
+
   mediatek,dmic-mode:
 $ref: /schemas/types.yaml#/definitions/uint32
 description: |
@@ -49,11 +54,15 @@ properties:
 description: |
   Specifies the type of mic type connected to adc2
 
+required:
+  - LDO_VAUD18-supply
+
 additionalProperties: false
 
 examples:
   - |
 mt6359codec: mt6359codec {
+  LDO_VAUD18-supply = <_vaud18_reg>;
   mediatek,dmic-mode = <0>;
   mediatek,mic-type-0 = <2>;
 };
-- 
1.7.9.5



[PATCH v2 1/2] ASoC: Fix vaud18 power leakage of mt6359

2020-11-09 Thread Shane Chien
From: "Shane.Chien" 

vaud18 is power of mt6359 audio path. It
should only enable when audio is used,
instead of in boot up stage.
Once mt6359 audio path is enabled or disabled,
vaud18 is controlled by regulator supply widget
"LDO_VAUD18". Due to vaud18 is controlled by
regulator dapm macro instead of regmap, the macro
MT6359_LDO_VAUD18_CON0 and variable avdd_reg
is no used and removed from mt6359.h.

Signed-off-by: Shane.Chien 
---
 sound/soc/codecs/mt6359.c |   25 +
 sound/soc/codecs/mt6359.h |8 
 2 files changed, 1 insertion(+), 32 deletions(-)

diff --git a/sound/soc/codecs/mt6359.c b/sound/soc/codecs/mt6359.c
index d20c59a..ecdfd57 100644
--- a/sound/soc/codecs/mt6359.c
+++ b/sound/soc/codecs/mt6359.c
@@ -1943,9 +1943,7 @@ static int mt_ncp_event(struct snd_soc_dapm_widget *w,
SND_SOC_DAPM_SUPPLY_S("CLK_BUF", SUPPLY_SEQ_CLK_BUF,
  MT6359_DCXO_CW12,
  RG_XO_AUDIO_EN_M_SFT, 0, NULL, 0),
-   SND_SOC_DAPM_SUPPLY_S("LDO_VAUD18", SUPPLY_SEQ_LDO_VAUD18,
- MT6359_LDO_VAUD18_CON0,
- RG_LDO_VAUD18_EN_SFT, 0, NULL, 0),
+   SND_SOC_DAPM_REGULATOR_SUPPLY("LDO_VAUD18", 0, 0),
SND_SOC_DAPM_SUPPLY_S("AUDGLB", SUPPLY_SEQ_AUD_GLB,
  MT6359_AUDDEC_ANA_CON13,
  RG_AUDGLB_PWRDN_VA32_SFT, 1, NULL, 0),
@@ -2807,20 +2805,6 @@ static int mt6359_platform_driver_probe(struct 
platform_device *pdev)
dev_set_drvdata(>dev, priv);
priv->dev = >dev;
 
-   priv->avdd_reg = devm_regulator_get(>dev, "vaud18");
-   if (IS_ERR(priv->avdd_reg)) {
-   dev_err(>dev, "%s(), have no vaud18 supply: %ld",
-   __func__, PTR_ERR(priv->avdd_reg));
-   return PTR_ERR(priv->avdd_reg);
-   }
-
-   ret = regulator_enable(priv->avdd_reg);
-   if (ret) {
-   dev_err(>dev, "%s(), failed to enable regulator!\n",
-   __func__);
-   return ret;
-   }
-
ret = mt6359_parse_dt(priv);
if (ret) {
dev_warn(>dev, "%s() failed to parse dts\n", __func__);
@@ -2841,13 +2825,6 @@ static int mt6359_platform_driver_remove(struct 
platform_device *pdev)
dev_dbg(>dev, "%s(), dev name %s\n",
__func__, dev_name(>dev));
 
-   ret = regulator_disable(priv->avdd_reg);
-   if (ret) {
-   dev_err(>dev, "%s(), failed to disable regulator!\n",
-   __func__);
-   return ret;
-   }
-
return 0;
 }
 
diff --git a/sound/soc/codecs/mt6359.h b/sound/soc/codecs/mt6359.h
index af6f07f..35f806b 100644
--- a/sound/soc/codecs/mt6359.h
+++ b/sound/soc/codecs/mt6359.h
@@ -135,11 +135,6 @@
 /* MT6359_DCXO_CW12 */
 #define RG_XO_AUDIO_EN_M_SFT   13
 
-/* LDO_VAUD18_CON0 */
-#define RG_LDO_VAUD18_EN_SFT   0
-#define RG_LDO_VAUD18_EN_MASK  0x1
-#define RG_LDO_VAUD18_EN_MASK_SFT  (0x1 << 0)
-
 /* AUD_TOP_CKPDN_CON0 */
 #define RG_VOW13M_CK_PDN_SFT   13
 #define RG_VOW13M_CK_PDN_MASK  0x1
@@ -2132,7 +2127,6 @@
 
 #define MT6359_DCXO_CW11   0x7a6
 #define MT6359_DCXO_CW12   0x7a8
-#define MT6359_LDO_VAUD18_CON0 0x1c98
 
 #define MT6359_GPIO_MODE0  0xcc
 #define MT6359_GPIO_MODE0_SET  0xce
@@ -2469,7 +2463,6 @@ enum {
 enum {
/* common */
SUPPLY_SEQ_CLK_BUF,
-   SUPPLY_SEQ_LDO_VAUD18,
SUPPLY_SEQ_AUD_GLB,
SUPPLY_SEQ_HP_PULL_DOWN,
SUPPLY_SEQ_CLKSQ,
@@ -2629,7 +2622,6 @@ struct mt6359_priv {
int hp_gain_ctl;
int hp_hifi_mode;
int mtkaif_protocol;
-   struct regulator *avdd_reg;
 };
 
 #define CODEC_MT6359_NAME "mtk-codec-mt6359"
-- 
1.7.9.5



[PATCH] ASoC: Fix vaud18 power leakage of mt6359

2020-11-05 Thread Shane Chien
From: "Shane.Chien" 

vaud18 is power of mt6359 audio path. It
should only enable when audio is used,
instead of in boot up stage.
Once mt6359 audio path is enabled or disabled,
vaud18 is controlled by using regulator in
supply widget "LDO_VAUD18". Due to vaud18 is
controlled by regulator instead of regmap,
the macro MT6359_LDO_VAUD18_CON0 is no used and
remove from mt6359.h.

Signed-off-by: Shane.Chien 
---
 sound/soc/codecs/mt6359.c | 38 +-
 sound/soc/codecs/mt6359.h |  6 --
 2 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/sound/soc/codecs/mt6359.c b/sound/soc/codecs/mt6359.c
index d20c59a..52dabdc 100644
--- a/sound/soc/codecs/mt6359.c
+++ b/sound/soc/codecs/mt6359.c
@@ -724,6 +724,32 @@ static SOC_VALUE_ENUM_SINGLE_DECL(pga_3_mux_map_enum,
 static const struct snd_kcontrol_new pga_3_mux_control =
SOC_DAPM_ENUM("PGA 3 Select", pga_3_mux_map_enum);
 
+static int mt_vaud18_event(struct snd_soc_dapm_widget *w,
+  struct snd_kcontrol *kcontrol,
+  int event)
+{
+   struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
+   struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt);
+   int ret = 0;
+
+   switch (event) {
+   case SND_SOC_DAPM_PRE_PMU:
+   ret = regulator_enable(priv->avdd_reg);
+   if (ret)
+   dev_err(priv->dev, "regulator_enable err: %d\n", ret);
+   break;
+   case SND_SOC_DAPM_POST_PMD:
+   ret = regulator_disable(priv->avdd_reg);
+   if (ret)
+   dev_err(priv->dev, "regulator_disable err: %d\n", ret);
+   break;
+   default:
+   break;
+   }
+
+   return ret;
+}
+
 static int mt_sgen_event(struct snd_soc_dapm_widget *w,
 struct snd_kcontrol *kcontrol,
 int event)
@@ -1944,8 +1970,9 @@ static int mt_ncp_event(struct snd_soc_dapm_widget *w,
  MT6359_DCXO_CW12,
  RG_XO_AUDIO_EN_M_SFT, 0, NULL, 0),
SND_SOC_DAPM_SUPPLY_S("LDO_VAUD18", SUPPLY_SEQ_LDO_VAUD18,
- MT6359_LDO_VAUD18_CON0,
- RG_LDO_VAUD18_EN_SFT, 0, NULL, 0),
+ SND_SOC_NOPM, 0, 0,
+ mt_vaud18_event,
+ SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
SND_SOC_DAPM_SUPPLY_S("AUDGLB", SUPPLY_SEQ_AUD_GLB,
  MT6359_AUDDEC_ANA_CON13,
  RG_AUDGLB_PWRDN_VA32_SFT, 1, NULL, 0),
@@ -2814,13 +2841,6 @@ static int mt6359_platform_driver_probe(struct 
platform_device *pdev)
return PTR_ERR(priv->avdd_reg);
}
 
-   ret = regulator_enable(priv->avdd_reg);
-   if (ret) {
-   dev_err(>dev, "%s(), failed to enable regulator!\n",
-   __func__);
-   return ret;
-   }
-
ret = mt6359_parse_dt(priv);
if (ret) {
dev_warn(>dev, "%s() failed to parse dts\n", __func__);
diff --git a/sound/soc/codecs/mt6359.h b/sound/soc/codecs/mt6359.h
index af6f07f..1dfb29a 100644
--- a/sound/soc/codecs/mt6359.h
+++ b/sound/soc/codecs/mt6359.h
@@ -135,11 +135,6 @@
 /* MT6359_DCXO_CW12 */
 #define RG_XO_AUDIO_EN_M_SFT   13
 
-/* LDO_VAUD18_CON0 */
-#define RG_LDO_VAUD18_EN_SFT   0
-#define RG_LDO_VAUD18_EN_MASK  0x1
-#define RG_LDO_VAUD18_EN_MASK_SFT  (0x1 << 0)
-
 /* AUD_TOP_CKPDN_CON0 */
 #define RG_VOW13M_CK_PDN_SFT   13
 #define RG_VOW13M_CK_PDN_MASK  0x1
@@ -2132,7 +2127,6 @@
 
 #define MT6359_DCXO_CW11   0x7a6
 #define MT6359_DCXO_CW12   0x7a8
-#define MT6359_LDO_VAUD18_CON0 0x1c98
 
 #define MT6359_GPIO_MODE0  0xcc
 #define MT6359_GPIO_MODE0_SET  0xce
-- 
1.9.1



[PATCH] ASoC: Use memset_io to access I/O memory

2020-09-18 Thread Shane Chien
From: "Shane.Chien" 

Use memset_io to access I/O memory, instead of
memset.

Signed-off-by: Shane.Chien 
---
 sound/core/pcm_native.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 9e0b2d7..a4efa84 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -756,7 +756,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream 
*substream,
 
/* clear the buffer for avoiding possible kernel info leaks */
if (runtime->dma_area && !substream->ops->copy_user)
-   memset(runtime->dma_area, 0, runtime->dma_bytes);
+   memset_io(runtime->dma_area, 0, runtime->dma_bytes);
 
snd_pcm_timer_resolution_change(substream);
snd_pcm_set_state(substream, SNDRV_PCM_STATE_SETUP);
-- 
1.7.9.5


[PATCH 0/1] Use memset_io to access I/O memory

2020-09-18 Thread Shane Chien
From: "Shane.Chien" 

Use memset_io to access I/O memory, instead of
memset.

Shane.Chien (1):
  ASoC: Use memset_io to access I/O memory

 sound/core/pcm_native.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.7.9.5