Skip to content

Commit 7587b6d

Browse files
committed
CTAG face2|4 Audio Card: Added support for BeagleBoard-X15
1 parent 636b26b commit 7587b6d

File tree

1 file changed

+34
-18
lines changed

1 file changed

+34
-18
lines changed

sound/soc/davinci/davinci-ctag-face-2-4.c

Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ static int snd_davinci_audiocard_probe(struct platform_device *pdev)
237237
struct snd_soc_dai_link *dai = (struct snd_soc_dai_link *) match->data;
238238
struct snd_soc_card_drvdata_davinci *drvdata = NULL;
239239
struct clk *mclk;
240-
int ret = 0;
240+
int ret = 0, bb_device = 0;
241+
241242

242243
snd_davinci_audiocard.dai_link = dai;
243244

@@ -279,25 +280,40 @@ static int snd_davinci_audiocard_probe(struct platform_device *pdev)
279280
return -EINVAL;
280281
}
281282

283+
ret = of_property_read_u32(np, "bb-device", &bb_device);
284+
if (ret < 0){
285+
dev_warn(&pdev->dev, "No BeagleBoard device specified (0=BBB/BBG, 1=BB-X15).\n\
286+
Using BeagleBone Black/Green as default device.\n");
287+
bb_device = 0;
288+
}
289+
282290
/*
283-
Configure internal 24,576 MHz oscillator as master clock for McASP
291+
Configure CPU DAI clock of specific BeagleBoard SBC
284292
*/
285-
ret = of_property_read_u32(np, "cpu-clock-rate", &drvdata->sysclk);
286-
if (ret < 0) {
287-
if (!drvdata->mclk) {
288-
dev_err(&pdev->dev,
289-
"No clock or clock rate defined.\n");
290-
return -EINVAL;
293+
if (bb_device == 0){ //BeagleBone Black/Green
294+
/*
295+
Configure internal 24,576 MHz oscillator as master clock for McASP
296+
*/
297+
ret = of_property_read_u32(np, "cpu-clock-rate", &drvdata->sysclk);
298+
if (ret < 0) {
299+
if (!drvdata->mclk) {
300+
dev_err(&pdev->dev, "No clock or clock rate defined.\n");
301+
return -EINVAL;
302+
}
303+
drvdata->sysclk = clk_get_rate(drvdata->mclk);
304+
} else if (drvdata->mclk) {
305+
unsigned int requestd_rate = drvdata->sysclk;
306+
clk_set_rate(drvdata->mclk, drvdata->sysclk);
307+
drvdata->sysclk = clk_get_rate(drvdata->mclk);
308+
if (drvdata->sysclk != requestd_rate)
309+
dev_warn(&pdev->dev, "Could not get requested rate %u using %u.\n",
310+
requestd_rate, drvdata->sysclk);
291311
}
292-
drvdata->sysclk = clk_get_rate(drvdata->mclk);
293-
} else if (drvdata->mclk) {
294-
unsigned int requestd_rate = drvdata->sysclk;
295-
clk_set_rate(drvdata->mclk, drvdata->sysclk);
296-
drvdata->sysclk = clk_get_rate(drvdata->mclk);
297-
if (drvdata->sysclk != requestd_rate)
298-
dev_warn(&pdev->dev,
299-
"Could not get requested rate %u using %u.\n",
300-
requestd_rate, drvdata->sysclk);
312+
}
313+
else if (bb_device == 1){ //BeagleBoard-X15
314+
/*
315+
Nothing to do (CPU DAI clock is configured in dra7.dtsi)
316+
*/
301317
}
302318

303319
/*
@@ -319,12 +335,12 @@ static int snd_davinci_audiocard_remove(struct platform_device *pdev)
319335

320336
/* Sound card platform driver */
321337
static struct platform_driver snd_davinci_audiocard_driver = {
322-
.probe = snd_davinci_audiocard_probe,
323338
.driver = {
324339
.name = "snd_ctag_face_2_4",
325340
.pm = &snd_soc_pm_ops,
326341
.of_match_table = of_match_ptr(snd_davinci_audiocard_dt_ids),
327342
},
343+
.probe = snd_davinci_audiocard_probe,
328344
.remove = snd_davinci_audiocard_remove,
329345
};
330346

0 commit comments

Comments
 (0)