Loading Documentation/devicetree/bindings/sound/taiko_codec.txt +2 −0 Original line number Diff line number Diff line Loading @@ -383,6 +383,8 @@ Optional properties: dynamically. Supplies in this list are off by default. - qcom,cdc-micbias-cfilt-mv : MICBIAS voltage value - qcom,cdc-boost-voltage: Specifies the analog boost output voltage value. Value from 4000 to 5550 in mV in steps of 50 mV can be given. Example: msm8x16_wcd_codec@f000{ Loading sound/soc/codecs/msm8x16-wcd.c +48 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,11 @@ #define MICBIAS_MIN_VAL 1600000 #define MICBIAS_STEP_SIZE 50000 #define DEFAULT_BOOST_VOLTAGE 5000 #define MIN_BOOST_VOLTAGE 4000 #define MAX_BOOST_VOLTAGE 5550 #define BOOST_VOLTAGE_STEP 50 #define VOLTAGE_CONVERTER(value, min_value, step_size)\ ((value - min_value)/step_size); Loading Loading @@ -179,6 +184,7 @@ static int msm8x16_wcd_enable_ext_mb_source(struct snd_soc_codec *codec, bool turn_on); static void msm8x16_trim_btn_reg(struct snd_soc_codec *codec); static void msm8x16_wcd_set_micb_v(struct snd_soc_codec *codec); static void msm8x16_wcd_set_boost_v(struct snd_soc_codec *codec); struct msm8x16_wcd_spmi msm8x16_wcd_modules[MAX_MSM8X16_WCD_DEVICE]; Loading Loading @@ -588,6 +594,34 @@ static int msm8x16_wcd_dt_parse_vreg_info(struct device *dev, return 0; } static void msm8x16_wcd_dt_parse_boost_info(struct snd_soc_codec *codec) { struct msm8x16_wcd_priv *msm8x16_wcd_priv = snd_soc_codec_get_drvdata(codec); const char *prop_name = "qcom,cdc-boost-voltage"; int boost_voltage, ret; ret = of_property_read_u32(codec->dev->of_node, prop_name, &boost_voltage); if (ret) { dev_dbg(codec->dev, "Looking up %s property in node %s failed\n", prop_name, codec->dev->of_node->full_name); boost_voltage = DEFAULT_BOOST_VOLTAGE; } if (boost_voltage < MIN_BOOST_VOLTAGE || boost_voltage > MAX_BOOST_VOLTAGE) { dev_err(codec->dev, "Incorrect boost voltage. Reverting to default\n"); boost_voltage = DEFAULT_BOOST_VOLTAGE; } msm8x16_wcd_priv->boost_voltage = VOLTAGE_CONVERTER(boost_voltage, MIN_BOOST_VOLTAGE, BOOST_VOLTAGE_STEP); dev_dbg(codec->dev, "Boost voltage value is: %d\n", boost_voltage); } static void msm8x16_wcd_dt_parse_micbias_info(struct device *dev, struct wcd9xxx_micbias_setting *micbias) { Loading Loading @@ -3408,6 +3442,8 @@ static int msm8x16_wcd_device_up(struct snd_soc_codec *codec) msm8x16_wcd_codec_init_reg(codec); msm8x16_wcd_update_reg_defaults(codec); msm8x16_wcd_set_boost_v(codec); msm8x16_wcd_set_micb_v(codec); wcd_mbhc_stop(&msm8x16_wcd_priv->mbhc); wcd_mbhc_start(&msm8x16_wcd_priv->mbhc, Loading Loading @@ -3495,6 +3531,15 @@ static void msm8x16_wcd_set_micb_v(struct snd_soc_codec *codec) 0xF8, (reg_val << 3)); } static void msm8x16_wcd_set_boost_v(struct snd_soc_codec *codec) { struct msm8x16_wcd_priv *msm8x16_wcd_priv = snd_soc_codec_get_drvdata(codec); snd_soc_update_bits(codec, MSM8X16_WCD_A_ANALOG_OUTPUT_VOLTAGE, 0x1F, msm8x16_wcd_priv->boost_voltage); } static int msm8x16_wcd_codec_probe(struct snd_soc_codec *codec) { struct msm8x16_wcd_priv *msm8x16_wcd_priv; Loading Loading @@ -3539,6 +3584,9 @@ static int msm8x16_wcd_codec_probe(struct snd_soc_codec *codec) else dev_dbg(codec->dev, "%s :PMIC REV: %d", __func__, msm8x16_wcd_priv->pmic_rev); msm8x16_wcd_dt_parse_boost_info(codec); msm8x16_wcd_set_boost_v(codec); msm8x16_wcd_bringup(codec); msm8x16_wcd_codec_init_reg(codec); msm8x16_wcd_update_reg_defaults(codec); Loading sound/soc/codecs/msm8x16-wcd.h +1 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,7 @@ struct msm8x16_wcd_priv { struct snd_soc_codec *codec; u16 pmic_rev; u16 codec_version; u32 boost_voltage; u32 adc_count; u32 rx_bias_count; s32 dmic_1_2_clk_cnt; Loading Loading
Documentation/devicetree/bindings/sound/taiko_codec.txt +2 −0 Original line number Diff line number Diff line Loading @@ -383,6 +383,8 @@ Optional properties: dynamically. Supplies in this list are off by default. - qcom,cdc-micbias-cfilt-mv : MICBIAS voltage value - qcom,cdc-boost-voltage: Specifies the analog boost output voltage value. Value from 4000 to 5550 in mV in steps of 50 mV can be given. Example: msm8x16_wcd_codec@f000{ Loading
sound/soc/codecs/msm8x16-wcd.c +48 −0 Original line number Diff line number Diff line Loading @@ -80,6 +80,11 @@ #define MICBIAS_MIN_VAL 1600000 #define MICBIAS_STEP_SIZE 50000 #define DEFAULT_BOOST_VOLTAGE 5000 #define MIN_BOOST_VOLTAGE 4000 #define MAX_BOOST_VOLTAGE 5550 #define BOOST_VOLTAGE_STEP 50 #define VOLTAGE_CONVERTER(value, min_value, step_size)\ ((value - min_value)/step_size); Loading Loading @@ -179,6 +184,7 @@ static int msm8x16_wcd_enable_ext_mb_source(struct snd_soc_codec *codec, bool turn_on); static void msm8x16_trim_btn_reg(struct snd_soc_codec *codec); static void msm8x16_wcd_set_micb_v(struct snd_soc_codec *codec); static void msm8x16_wcd_set_boost_v(struct snd_soc_codec *codec); struct msm8x16_wcd_spmi msm8x16_wcd_modules[MAX_MSM8X16_WCD_DEVICE]; Loading Loading @@ -588,6 +594,34 @@ static int msm8x16_wcd_dt_parse_vreg_info(struct device *dev, return 0; } static void msm8x16_wcd_dt_parse_boost_info(struct snd_soc_codec *codec) { struct msm8x16_wcd_priv *msm8x16_wcd_priv = snd_soc_codec_get_drvdata(codec); const char *prop_name = "qcom,cdc-boost-voltage"; int boost_voltage, ret; ret = of_property_read_u32(codec->dev->of_node, prop_name, &boost_voltage); if (ret) { dev_dbg(codec->dev, "Looking up %s property in node %s failed\n", prop_name, codec->dev->of_node->full_name); boost_voltage = DEFAULT_BOOST_VOLTAGE; } if (boost_voltage < MIN_BOOST_VOLTAGE || boost_voltage > MAX_BOOST_VOLTAGE) { dev_err(codec->dev, "Incorrect boost voltage. Reverting to default\n"); boost_voltage = DEFAULT_BOOST_VOLTAGE; } msm8x16_wcd_priv->boost_voltage = VOLTAGE_CONVERTER(boost_voltage, MIN_BOOST_VOLTAGE, BOOST_VOLTAGE_STEP); dev_dbg(codec->dev, "Boost voltage value is: %d\n", boost_voltage); } static void msm8x16_wcd_dt_parse_micbias_info(struct device *dev, struct wcd9xxx_micbias_setting *micbias) { Loading Loading @@ -3408,6 +3442,8 @@ static int msm8x16_wcd_device_up(struct snd_soc_codec *codec) msm8x16_wcd_codec_init_reg(codec); msm8x16_wcd_update_reg_defaults(codec); msm8x16_wcd_set_boost_v(codec); msm8x16_wcd_set_micb_v(codec); wcd_mbhc_stop(&msm8x16_wcd_priv->mbhc); wcd_mbhc_start(&msm8x16_wcd_priv->mbhc, Loading Loading @@ -3495,6 +3531,15 @@ static void msm8x16_wcd_set_micb_v(struct snd_soc_codec *codec) 0xF8, (reg_val << 3)); } static void msm8x16_wcd_set_boost_v(struct snd_soc_codec *codec) { struct msm8x16_wcd_priv *msm8x16_wcd_priv = snd_soc_codec_get_drvdata(codec); snd_soc_update_bits(codec, MSM8X16_WCD_A_ANALOG_OUTPUT_VOLTAGE, 0x1F, msm8x16_wcd_priv->boost_voltage); } static int msm8x16_wcd_codec_probe(struct snd_soc_codec *codec) { struct msm8x16_wcd_priv *msm8x16_wcd_priv; Loading Loading @@ -3539,6 +3584,9 @@ static int msm8x16_wcd_codec_probe(struct snd_soc_codec *codec) else dev_dbg(codec->dev, "%s :PMIC REV: %d", __func__, msm8x16_wcd_priv->pmic_rev); msm8x16_wcd_dt_parse_boost_info(codec); msm8x16_wcd_set_boost_v(codec); msm8x16_wcd_bringup(codec); msm8x16_wcd_codec_init_reg(codec); msm8x16_wcd_update_reg_defaults(codec); Loading
sound/soc/codecs/msm8x16-wcd.h +1 −0 Original line number Diff line number Diff line Loading @@ -213,6 +213,7 @@ struct msm8x16_wcd_priv { struct snd_soc_codec *codec; u16 pmic_rev; u16 codec_version; u32 boost_voltage; u32 adc_count; u32 rx_bias_count; s32 dmic_1_2_clk_cnt; Loading