@@ -30,6 +30,7 @@ static struct snd_soc_jack pco_jack;
30
30
static struct clk * rt5682_dai_wclk ;
31
31
static struct clk * rt5682_dai_bclk ;
32
32
static struct gpio_desc * dmic_sel ;
33
+ void * soc_is_rltk_max (struct device * dev );
33
34
34
35
static int acp3x_5682_init (struct snd_soc_pcm_runtime * rtd )
35
36
{
@@ -326,18 +327,32 @@ static struct snd_soc_card acp3x_5682 = {
326
327
.num_controls = ARRAY_SIZE (acp3x_5682_mc_controls ),
327
328
};
328
329
330
+ void * soc_is_rltk_max (struct device * dev )
331
+ {
332
+ const struct acpi_device_id * match ;
333
+
334
+ match = acpi_match_device (dev -> driver -> acpi_match_table , dev );
335
+ if (!match )
336
+ return NULL ;
337
+ return (void * )match -> driver_data ;
338
+ }
339
+
329
340
static int acp3x_probe (struct platform_device * pdev )
330
341
{
331
342
int ret ;
332
343
struct snd_soc_card * card ;
333
344
struct acp3x_platform_info * machine ;
345
+ struct device * dev = & pdev -> dev ;
346
+
347
+ card = (struct snd_soc_card * )soc_is_rltk_max (dev );
348
+ if (!card )
349
+ return - ENODEV ;
334
350
335
351
machine = devm_kzalloc (& pdev -> dev , sizeof (* machine ), GFP_KERNEL );
336
352
if (!machine )
337
353
return - ENOMEM ;
338
354
339
- card = & acp3x_5682 ;
340
- acp3x_5682 .dev = & pdev -> dev ;
355
+ card -> dev = & pdev -> dev ;
341
356
platform_set_drvdata (pdev , card );
342
357
snd_soc_card_set_drvdata (card , machine );
343
358
@@ -348,18 +363,18 @@ static int acp3x_probe(struct platform_device *pdev)
348
363
return PTR_ERR (dmic_sel );
349
364
}
350
365
351
- ret = devm_snd_soc_register_card (& pdev -> dev , & acp3x_5682 );
366
+ ret = devm_snd_soc_register_card (& pdev -> dev , card );
352
367
if (ret ) {
353
368
dev_err (& pdev -> dev ,
354
369
"devm_snd_soc_register_card(%s) failed: %d\n" ,
355
- acp3x_5682 . name , ret );
370
+ card -> name , ret );
356
371
return ret ;
357
372
}
358
373
return 0 ;
359
374
}
360
375
361
376
static const struct acpi_device_id acp3x_audio_acpi_match [] = {
362
- { "AMDI5682" , 0 },
377
+ { "AMDI5682" , ( unsigned long ) & acp3x_5682 },
363
378
{},
364
379
};
365
380
MODULE_DEVICE_TABLE (acpi , acp3x_audio_acpi_match );
0 commit comments