aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/codecs/sgtl5000.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 7ef2687b396f..3e9db43ed760 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -1445,6 +1445,7 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
1445{ 1445{
1446 struct sgtl5000_priv *sgtl5000; 1446 struct sgtl5000_priv *sgtl5000;
1447 int ret, reg, rev; 1447 int ret, reg, rev;
1448 unsigned int mclk;
1448 1449
1449 sgtl5000 = devm_kzalloc(&client->dev, sizeof(struct sgtl5000_priv), 1450 sgtl5000 = devm_kzalloc(&client->dev, sizeof(struct sgtl5000_priv),
1450 GFP_KERNEL); 1451 GFP_KERNEL);
@@ -1468,6 +1469,14 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
1468 return ret; 1469 return ret;
1469 } 1470 }
1470 1471
1472 /* SGTL5000 SYS_MCLK should be between 8 and 27 MHz */
1473 mclk = clk_get_rate(sgtl5000->mclk);
1474 if (mclk < 8000000 || mclk > 27000000) {
1475 dev_err(&client->dev, "Invalid SYS_CLK frequency: %u.%03uMHz\n",
1476 mclk / 1000000, mclk / 1000 % 1000);
1477 return -EINVAL;
1478 }
1479
1471 ret = clk_prepare_enable(sgtl5000->mclk); 1480 ret = clk_prepare_enable(sgtl5000->mclk);
1472 if (ret) 1481 if (ret)
1473 return ret; 1482 return ret;