Skip to contentSkip to conversation

ASoC: cs4349: Add support for Cirrus Logic CS4349

PATCH Superseded [email protected] 2 participants 2 messages Jul 15, 2015

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ASoC: cs4349: Add support for Cirrus Logic CS4349

From: Tim Howe <[email protected]>

---
 sound/soc/codecs/cs4349.c | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)
sound/soc/codecs/cs4349.c +8 -19
index c9a96b6..ee6b676 100644
@@ -305,19 +305,8 @@ static int cs4349_i2c_probe(struct i2c_client *client,
 		return ret;
 	}
 
-	if (pdata) {
+	if (pdata)
 		cs4349->pdata = *pdata;
-	} else {
-		pdata = devm_kzalloc(&client->dev,
-				     sizeof(struct cs4349_platform_data),
-				     GFP_KERNEL);
-		if (!pdata) {
-			dev_err(&client->dev,
-				"could not allocate pdata\n");
-			return -ENOMEM;
-		}
-		cs4349->pdata = *pdata;
-	}
 
 	/* Reset the Device */
 	cs4349->reset_gpio = devm_gpiod_get_optional(&client->dev,
@@ -330,9 +319,6 @@ static int cs4349_i2c_probe(struct i2c_client *client,
 
 	i2c_set_clientdata(client, cs4349);
 
-	dev_info(&client->dev,
-		 "Cirrus Logic CS4349\n");
-
 	return snd_soc_register_codec(&client->dev, &soc_codec_dev_cs4349,
 		&cs4349_dai, 1);
 }
@@ -357,14 +343,17 @@ static int cs4349_runtime_suspend(struct device *dev)
 	struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
 	int ret;
 
-	/* Hold down reset */
-	if (cs4349->reset_gpio)
-		gpiod_set_value_cansleep(cs4349->reset_gpio, 0);
-
 	ret = snd_soc_update_bits(rtd->codec, CS4349_MISC, PWR_DWN, 1);
 	if (ret < 0)
 		return ret;
 
+	regcache_cache_only(cs4349->regmap, true);
+	regcache_sync(cs4349->regmap);
+
+	/* Hold down reset */
+	if (cs4349->reset_gpio)
+		gpiod_set_value_cansleep(cs4349->reset_gpio, 0);
+
 	return 0;
 }
 
Signature · 1 line
2.4.5
#1 lore raw

Sorry sent the wrong patch. Resending soon.

Tim

-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Tuesday, July 14, 2015 7:44 PM
To: [email protected]
Cc: [email protected]; [email protected]; Austin, Brian; Howe, Tim
Subject: [PATCH v2] ASoC: cs4349: Add support for Cirrus Logic CS4349

From: Tim Howe <[email protected]>

---
 sound/soc/codecs/cs4349.c | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)
sound/soc/codecs/cs4349.c +8 -19
@@ -305,19 +305,8 @@ static int cs4349_i2c_probe(struct i2c_client *client,
 		return ret;
 	}
 
-	if (pdata) {
+	if (pdata)
 		cs4349->pdata = *pdata;
-	} else {
-		pdata = devm_kzalloc(&client->dev,
-				     sizeof(struct cs4349_platform_data),
-				     GFP_KERNEL);
-		if (!pdata) {
-			dev_err(&client->dev,
-				"could not allocate pdata\n");
-			return -ENOMEM;
-		}
-		cs4349->pdata = *pdata;
-	}
 
 	/* Reset the Device */
 	cs4349->reset_gpio = devm_gpiod_get_optional(&client->dev,
@@ -330,9 +319,6 @@ static int cs4349_i2c_probe(struct i2c_client *client,
 
 	i2c_set_clientdata(client, cs4349);
 
-	dev_info(&client->dev,
-		 "Cirrus Logic CS4349\n");
-
 	return snd_soc_register_codec(&client->dev, &soc_codec_dev_cs4349,
 		&cs4349_dai, 1);
 }
@@ -357,14 +343,17 @@ static int cs4349_runtime_suspend(struct device *dev)
 	struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
 	int ret;
 
-	/* Hold down reset */
-	if (cs4349->reset_gpio)
-		gpiod_set_value_cansleep(cs4349->reset_gpio, 0);
-
 	ret = snd_soc_update_bits(rtd->codec, CS4349_MISC, PWR_DWN, 1);
 	if (ret < 0)
 		return ret;
 
+	regcache_cache_only(cs4349->regmap, true);
+	regcache_sync(cs4349->regmap);
+
+	/* Hold down reset */
+	if (cs4349->reset_gpio)
+		gpiod_set_value_cansleep(cs4349->reset_gpio, 0);
+
 	return 0;
 }
 

--
2.4.5