Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7667428f authored by Mark Brown's avatar Mark Brown
Browse files

Merge remote-tracking branches 'asoc/topic/wm2200', 'asoc/topic/wm5100',...

Merge remote-tracking branches 'asoc/topic/wm2200', 'asoc/topic/wm5100', 'asoc/topic/wm8731', 'asoc/topic/wm8804' and 'asoc/topic/wm8996' into asoc-next
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -10,6 +10,13 @@ Required properties:
  - reg : the I2C address of the device for I2C, the chip select
          number for SPI.

  - PVDD-supply, DVDD-supply : Power supplies for the device, as covered
    in Documentation/devicetree/bindings/regulator/regulator.txt

Optional properties:

  - wlf,reset-gpio: A GPIO specifier for the GPIO controlling the reset pin

Example:

codec: wm8804@1a {
+85 −0
Original line number Diff line number Diff line
@@ -413,3 +413,88 @@ void devm_regulator_bulk_unregister_supply_alias(struct device *dev,
		devm_regulator_unregister_supply_alias(dev, id[i]);
}
EXPORT_SYMBOL_GPL(devm_regulator_bulk_unregister_supply_alias);

struct regulator_notifier_match {
	struct regulator *regulator;
	struct notifier_block *nb;
};

static int devm_regulator_match_notifier(struct device *dev, void *res,
					 void *data)
{
	struct regulator_notifier_match *match = res;
	struct regulator_notifier_match *target = data;

	return match->regulator == target->regulator && match->nb == target->nb;
}

static void devm_regulator_destroy_notifier(struct device *dev, void *res)
{
	struct regulator_notifier_match *match = res;

	regulator_unregister_notifier(match->regulator, match->nb);
}

/**
 * devm_regulator_register_notifier - Resource managed
 * regulator_register_notifier
 *
 * @regulator: regulator source
 * @nb: notifier block
 *
 * The notifier will be registers under the consumer device and be
 * automatically be unregistered when the source device is unbound.
 */
int devm_regulator_register_notifier(struct regulator *regulator,
				     struct notifier_block *nb)
{
	struct regulator_notifier_match *match;
	int ret;

	match = devres_alloc(devm_regulator_destroy_notifier,
			     sizeof(struct regulator_notifier_match),
			     GFP_KERNEL);
	if (!match)
		return -ENOMEM;

	match->regulator = regulator;
	match->nb = nb;

	ret = regulator_register_notifier(regulator, nb);
	if (ret < 0) {
		devres_free(match);
		return ret;
	}

	devres_add(regulator->dev, match);

	return 0;
}
EXPORT_SYMBOL_GPL(devm_regulator_register_notifier);

/**
 * devm_regulator_unregister_notifier - Resource managed
 * regulator_unregister_notifier()
 *
 * @regulator: regulator source
 * @nb: notifier block
 *
 * Unregister a notifier registered with devm_regulator_register_notifier().
 * Normally this function will not need to be called and the resource
 * management code will ensure that the resource is freed.
 */
void devm_regulator_unregister_notifier(struct regulator *regulator,
					struct notifier_block *nb)
{
	struct regulator_notifier_match match;
	int rc;

	match.regulator = regulator;
	match.nb = nb;

	rc = devres_release(regulator->dev, devm_regulator_destroy_notifier,
			    devm_regulator_match_notifier, &match);
	if (rc != 0)
		WARN_ON(rc);
}
EXPORT_SYMBOL_GPL(devm_regulator_unregister_notifier);
+16 −0
Original line number Diff line number Diff line
@@ -252,8 +252,12 @@ int regulator_list_hardware_vsel(struct regulator *regulator,
/* regulator notifier block */
int regulator_register_notifier(struct regulator *regulator,
			      struct notifier_block *nb);
int devm_regulator_register_notifier(struct regulator *regulator,
				     struct notifier_block *nb);
int regulator_unregister_notifier(struct regulator *regulator,
				struct notifier_block *nb);
void devm_regulator_unregister_notifier(struct regulator *regulator,
					struct notifier_block *nb);

/* driver data - core doesn't touch */
void *regulator_get_drvdata(struct regulator *regulator);
@@ -515,12 +519,24 @@ static inline int regulator_register_notifier(struct regulator *regulator,
	return 0;
}

static inline int devm_regulator_register_notifier(struct regulator *regulator,
						   struct notifier_block *nb)
{
	return 0;
}

static inline int regulator_unregister_notifier(struct regulator *regulator,
				struct notifier_block *nb)
{
	return 0;
}

static inline int devm_regulator_unregister_notifier(struct regulator *regulator,
						     struct notifier_block *nb)
{
	return 0;
}

static inline void *regulator_get_drvdata(struct regulator *regulator)
{
	return NULL;
+5 −4
Original line number Diff line number Diff line
@@ -1554,7 +1554,6 @@ static int wm2200_probe(struct snd_soc_codec *codec)
	int ret;

	wm2200->codec = codec;
	codec->dapm.bias_level = SND_SOC_BIAS_OFF;

	ret = snd_soc_add_codec_controls(codec, wm_adsp1_fw_controls, 2);
	if (ret != 0)
@@ -1942,6 +1941,7 @@ static int wm2200_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
	struct wm2200_priv *wm2200 = snd_soc_codec_get_drvdata(codec);
	struct _fll_div factors;
	int ret, i, timeout;
	unsigned long time_left;

	if (!Fout) {
		dev_dbg(codec->dev, "FLL disabled");
@@ -2021,9 +2021,10 @@ static int wm2200_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
	/* Poll for the lock; will use the interrupt to exit quickly */
	for (i = 0; i < timeout; i++) {
		if (i2c->irq) {
			ret = wait_for_completion_timeout(&wm2200->fll_lock,
			time_left = wait_for_completion_timeout(
							&wm2200->fll_lock,
							msecs_to_jiffies(25));
			if (ret > 0)
			if (time_left > 0)
				break;
		} else {
			msleep(1);
+4 −3
Original line number Diff line number Diff line
@@ -1762,6 +1762,7 @@ static int wm5100_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
	struct _fll_div factors;
	struct wm5100_fll *fll;
	int ret, base, lock, i, timeout;
	unsigned long time_left;

	switch (fll_id) {
	case WM5100_FLL1:
@@ -1842,9 +1843,9 @@ static int wm5100_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
	/* Poll for the lock; will use interrupt when we can test */
	for (i = 0; i < timeout; i++) {
		if (i2c->irq) {
			ret = wait_for_completion_timeout(&fll->lock,
			time_left = wait_for_completion_timeout(&fll->lock,
							msecs_to_jiffies(25));
			if (ret > 0)
			if (time_left > 0)
				break;
		} else {
			msleep(1);
Loading