Unverified Commit 7c2a3cfc authored by Mark Brown's avatar Mark Brown
Browse files

ASoC: codecs: msm8916-wcd-analog: Cleanup DT bindings

Merge series from Stephan Gerhold <stephan@gerhold.net>:

Drop the redundant reg-names and mclk from the PM8916 analog codec.
Having the mclk on the analog codec is incorrect because only the
digital codec consumes it directly.
parents 3adbc7c7 5c0f9652
Loading
Loading
Loading
Loading
+47 −54
Original line number Diff line number Diff line
@@ -19,17 +19,6 @@ properties:
  reg:
    maxItems: 1

  reg-names:
    items:
      - const: pmic-codec-core

  clocks:
    maxItems: 1

  clock-names:
    items:
      - const: mclk

  interrupts:
    maxItems: 14

@@ -113,15 +102,18 @@ additionalProperties: false

examples:
  - |
    #include <dt-bindings/clock/qcom,gcc-msm8916.h>
    #include <dt-bindings/interrupt-controller/irq.h>
    #include <dt-bindings/spmi/spmi.h>

    pmic@1 {
      compatible = "qcom,pm8916", "qcom,spmi-pmic";
      reg = <0x1 SPMI_USID>;
      #address-cells = <1>;
      #size-cells = <0>;

      audio-codec@f000 {
        compatible = "qcom,pm8916-wcd-analog-codec";
      reg = <0xf000 0x200>;
      reg-names = "pmic-codec-core";
      clocks = <&gcc GCC_CODEC_DIGCODEC_CLK>;
      clock-names = "mclk";
        reg = <0xf000>;
        qcom,mbhc-vthreshold-low = <75 150 237 450 500>;
        qcom,mbhc-vthreshold-high = <75 150 237 450 500>;
        interrupt-parent = <&spmi_bus>;
@@ -158,3 +150,4 @@ examples:
        vdd-micbias-supply = <&pm8916_l13>;
        #sound-dai-cells = <1>;
      };
    };
+15 −41
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@
#include <linux/delay.h>
#include <linux/regulator/consumer.h>
#include <linux/types.h>
#include <linux/clk.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
@@ -1198,12 +1197,6 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)
	if (ret < 0)
		return ret;

	priv->mclk = devm_clk_get(dev, "mclk");
	if (IS_ERR(priv->mclk)) {
		dev_err(dev, "failed to get mclk\n");
		return PTR_ERR(priv->mclk);
	}

	for (i = 0; i < ARRAY_SIZE(supply_names); i++)
		priv->supplies[i].supply = supply_names[i];

@@ -1214,55 +1207,48 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)
		return ret;
	}

	ret = clk_prepare_enable(priv->mclk);
	if (ret < 0) {
		dev_err(dev, "failed to enable mclk %d\n", ret);
		return ret;
	}

	irq = platform_get_irq_byname(pdev, "mbhc_switch_int");
	if (irq < 0) {
		ret = irq;
		goto err_disable_clk;
	}
	if (irq < 0)
		return irq;

	ret = devm_request_threaded_irq(dev, irq, NULL,
			       pm8916_mbhc_switch_irq_handler,
			       IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING |
			       IRQF_ONESHOT,
			       "mbhc switch irq", priv);
	if (ret)
	if (ret) {
		dev_err(dev, "cannot request mbhc switch irq\n");
		return ret;
	}

	if (priv->mbhc_btn_enabled) {
		irq = platform_get_irq_byname(pdev, "mbhc_but_press_det");
		if (irq < 0) {
			ret = irq;
			goto err_disable_clk;
		}
		if (irq < 0)
			return irq;

		ret = devm_request_threaded_irq(dev, irq, NULL,
				       mbhc_btn_press_irq_handler,
				       IRQF_TRIGGER_RISING |
				       IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
				       "mbhc btn press irq", priv);
		if (ret)
		if (ret) {
			dev_err(dev, "cannot request mbhc button press irq\n");
			return ret;
		}

		irq = platform_get_irq_byname(pdev, "mbhc_but_rel_det");
		if (irq < 0) {
			ret = irq;
			goto err_disable_clk;
		}
		if (irq < 0)
			return irq;

		ret = devm_request_threaded_irq(dev, irq, NULL,
				       mbhc_btn_release_irq_handler,
				       IRQF_TRIGGER_RISING |
				       IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
				       "mbhc btn release irq", priv);
		if (ret)
		if (ret) {
			dev_err(dev, "cannot request mbhc button release irq\n");

			return ret;
		}
	}

	dev_set_drvdata(dev, priv);
@@ -1270,17 +1256,6 @@ static int pm8916_wcd_analog_spmi_probe(struct platform_device *pdev)
	return devm_snd_soc_register_component(dev, &pm8916_wcd_analog,
				      pm8916_wcd_analog_dai,
				      ARRAY_SIZE(pm8916_wcd_analog_dai));

err_disable_clk:
	clk_disable_unprepare(priv->mclk);
	return ret;
}

static void pm8916_wcd_analog_spmi_remove(struct platform_device *pdev)
{
	struct pm8916_wcd_analog_priv *priv = dev_get_drvdata(&pdev->dev);

	clk_disable_unprepare(priv->mclk);
}

static const struct of_device_id pm8916_wcd_analog_spmi_match_table[] = {
@@ -1296,7 +1271,6 @@ static struct platform_driver pm8916_wcd_analog_spmi_driver = {
		   .of_match_table = pm8916_wcd_analog_spmi_match_table,
	},
	.probe = pm8916_wcd_analog_spmi_probe,
	.remove_new = pm8916_wcd_analog_spmi_remove,
};

module_platform_driver(pm8916_wcd_analog_spmi_driver);