@@ -143,23 +143,23 @@ static bool wm9090_readable(struct device *dev, unsigned int reg)
143
143
}
144
144
}
145
145
146
- static void wait_for_dc_servo (struct snd_soc_codec * codec )
146
+ static void wait_for_dc_servo (struct snd_soc_component * component )
147
147
{
148
148
unsigned int reg ;
149
149
int count = 0 ;
150
150
151
- dev_dbg (codec -> dev , "Waiting for DC servo...\n" );
151
+ dev_dbg (component -> dev , "Waiting for DC servo...\n" );
152
152
do {
153
153
count ++ ;
154
154
msleep (1 );
155
- reg = snd_soc_read ( codec , WM9090_DC_SERVO_READBACK_0 );
156
- dev_dbg (codec -> dev , "DC servo status: %x\n" , reg );
155
+ reg = snd_soc_component_read32 ( component , WM9090_DC_SERVO_READBACK_0 );
156
+ dev_dbg (component -> dev , "DC servo status: %x\n" , reg );
157
157
} while ((reg & WM9090_DCS_CAL_COMPLETE_MASK )
158
158
!= WM9090_DCS_CAL_COMPLETE_MASK && count < 1000 );
159
159
160
160
if ((reg & WM9090_DCS_CAL_COMPLETE_MASK )
161
161
!= WM9090_DCS_CAL_COMPLETE_MASK )
162
- dev_err (codec -> dev , "Timed out waiting for DC Servo\n" );
162
+ dev_err (component -> dev , "Timed out waiting for DC Servo\n" );
163
163
}
164
164
165
165
static const DECLARE_TLV_DB_RANGE (in_tlv ,
@@ -251,39 +251,39 @@ SOC_SINGLE_TLV("MIXOUTR IN2B Volume", WM9090_OUTPUT_MIXER4, 0, 3, 1,
251
251
static int hp_ev (struct snd_soc_dapm_widget * w ,
252
252
struct snd_kcontrol * kcontrol , int event )
253
253
{
254
- struct snd_soc_codec * codec = snd_soc_dapm_to_codec (w -> dapm );
255
- unsigned int reg = snd_soc_read ( codec , WM9090_ANALOGUE_HP_0 );
254
+ struct snd_soc_component * component = snd_soc_dapm_to_component (w -> dapm );
255
+ unsigned int reg = snd_soc_component_read32 ( component , WM9090_ANALOGUE_HP_0 );
256
256
257
257
switch (event ) {
258
258
case SND_SOC_DAPM_POST_PMU :
259
- snd_soc_update_bits ( codec , WM9090_CHARGE_PUMP_1 ,
259
+ snd_soc_component_update_bits ( component , WM9090_CHARGE_PUMP_1 ,
260
260
WM9090_CP_ENA , WM9090_CP_ENA );
261
261
262
262
msleep (5 );
263
263
264
- snd_soc_update_bits ( codec , WM9090_POWER_MANAGEMENT_1 ,
264
+ snd_soc_component_update_bits ( component , WM9090_POWER_MANAGEMENT_1 ,
265
265
WM9090_HPOUT1L_ENA | WM9090_HPOUT1R_ENA ,
266
266
WM9090_HPOUT1L_ENA | WM9090_HPOUT1R_ENA );
267
267
268
268
reg |= WM9090_HPOUT1L_DLY | WM9090_HPOUT1R_DLY ;
269
- snd_soc_write ( codec , WM9090_ANALOGUE_HP_0 , reg );
269
+ snd_soc_component_write ( component , WM9090_ANALOGUE_HP_0 , reg );
270
270
271
271
/* Start the DC servo. We don't currently use the
272
272
* ability to save the state since we don't have full
273
273
* control of the analogue paths and they can change
274
274
* DC offsets; see the WM8904 driver for an example of
275
275
* doing so.
276
276
*/
277
- snd_soc_write ( codec , WM9090_DC_SERVO_0 ,
277
+ snd_soc_component_write ( component , WM9090_DC_SERVO_0 ,
278
278
WM9090_DCS_ENA_CHAN_0 |
279
279
WM9090_DCS_ENA_CHAN_1 |
280
280
WM9090_DCS_TRIG_STARTUP_1 |
281
281
WM9090_DCS_TRIG_STARTUP_0 );
282
- wait_for_dc_servo (codec );
282
+ wait_for_dc_servo (component );
283
283
284
284
reg |= WM9090_HPOUT1R_OUTP | WM9090_HPOUT1R_RMV_SHORT |
285
285
WM9090_HPOUT1L_OUTP | WM9090_HPOUT1L_RMV_SHORT ;
286
- snd_soc_write ( codec , WM9090_ANALOGUE_HP_0 , reg );
286
+ snd_soc_component_write ( component , WM9090_ANALOGUE_HP_0 , reg );
287
287
break ;
288
288
289
289
case SND_SOC_DAPM_PRE_PMD :
@@ -294,15 +294,15 @@ static int hp_ev(struct snd_soc_dapm_widget *w,
294
294
WM9090_HPOUT1R_DLY |
295
295
WM9090_HPOUT1R_OUTP );
296
296
297
- snd_soc_write ( codec , WM9090_ANALOGUE_HP_0 , reg );
297
+ snd_soc_component_write ( component , WM9090_ANALOGUE_HP_0 , reg );
298
298
299
- snd_soc_write ( codec , WM9090_DC_SERVO_0 , 0 );
299
+ snd_soc_component_write ( component , WM9090_DC_SERVO_0 , 0 );
300
300
301
- snd_soc_update_bits ( codec , WM9090_POWER_MANAGEMENT_1 ,
301
+ snd_soc_component_update_bits ( component , WM9090_POWER_MANAGEMENT_1 ,
302
302
WM9090_HPOUT1L_ENA | WM9090_HPOUT1R_ENA ,
303
303
0 );
304
304
305
- snd_soc_update_bits ( codec , WM9090_CHARGE_PUMP_1 ,
305
+ snd_soc_component_update_bits ( component , WM9090_CHARGE_PUMP_1 ,
306
306
WM9090_CP_ENA , 0 );
307
307
break ;
308
308
}
@@ -419,18 +419,18 @@ static const struct snd_soc_dapm_route audio_map_in2_diff[] = {
419
419
{ "IN2A PGA" , NULL , "IN2-" },
420
420
};
421
421
422
- static int wm9090_add_controls (struct snd_soc_codec * codec )
422
+ static int wm9090_add_controls (struct snd_soc_component * component )
423
423
{
424
- struct wm9090_priv * wm9090 = snd_soc_codec_get_drvdata ( codec );
425
- struct snd_soc_dapm_context * dapm = snd_soc_codec_get_dapm ( codec );
424
+ struct wm9090_priv * wm9090 = snd_soc_component_get_drvdata ( component );
425
+ struct snd_soc_dapm_context * dapm = snd_soc_component_get_dapm ( component );
426
426
int i ;
427
427
428
428
snd_soc_dapm_new_controls (dapm , wm9090_dapm_widgets ,
429
429
ARRAY_SIZE (wm9090_dapm_widgets ));
430
430
431
431
snd_soc_dapm_add_routes (dapm , audio_map , ARRAY_SIZE (audio_map ));
432
432
433
- snd_soc_add_codec_controls ( codec , wm9090_controls ,
433
+ snd_soc_add_component_controls ( component , wm9090_controls ,
434
434
ARRAY_SIZE (wm9090_controls ));
435
435
436
436
if (wm9090 -> pdata .lin1_diff ) {
@@ -439,7 +439,7 @@ static int wm9090_add_controls(struct snd_soc_codec *codec)
439
439
} else {
440
440
snd_soc_dapm_add_routes (dapm , audio_map_in1_se ,
441
441
ARRAY_SIZE (audio_map_in1_se ));
442
- snd_soc_add_codec_controls ( codec , wm9090_in1_se_controls ,
442
+ snd_soc_add_component_controls ( component , wm9090_in1_se_controls ,
443
443
ARRAY_SIZE (wm9090_in1_se_controls ));
444
444
}
445
445
@@ -449,18 +449,18 @@ static int wm9090_add_controls(struct snd_soc_codec *codec)
449
449
} else {
450
450
snd_soc_dapm_add_routes (dapm , audio_map_in2_se ,
451
451
ARRAY_SIZE (audio_map_in2_se ));
452
- snd_soc_add_codec_controls ( codec , wm9090_in2_se_controls ,
452
+ snd_soc_add_component_controls ( component , wm9090_in2_se_controls ,
453
453
ARRAY_SIZE (wm9090_in2_se_controls ));
454
454
}
455
455
456
456
if (wm9090 -> pdata .agc_ena ) {
457
457
for (i = 0 ; i < ARRAY_SIZE (wm9090 -> pdata .agc ); i ++ )
458
- snd_soc_write ( codec , WM9090_AGC_CONTROL_0 + i ,
458
+ snd_soc_component_write ( component , WM9090_AGC_CONTROL_0 + i ,
459
459
wm9090 -> pdata .agc [i ]);
460
- snd_soc_update_bits ( codec , WM9090_POWER_MANAGEMENT_3 ,
460
+ snd_soc_component_update_bits ( component , WM9090_POWER_MANAGEMENT_3 ,
461
461
WM9090_AGC_ENA , WM9090_AGC_ENA );
462
462
} else {
463
- snd_soc_update_bits ( codec , WM9090_POWER_MANAGEMENT_3 ,
463
+ snd_soc_component_update_bits ( component , WM9090_POWER_MANAGEMENT_3 ,
464
464
WM9090_AGC_ENA , 0 );
465
465
}
466
466
@@ -472,19 +472,19 @@ static int wm9090_add_controls(struct snd_soc_codec *codec)
472
472
* The machine driver should call this from their set_bias_level; if there
473
473
* isn't one then this can just be set as the set_bias_level function.
474
474
*/
475
- static int wm9090_set_bias_level (struct snd_soc_codec * codec ,
475
+ static int wm9090_set_bias_level (struct snd_soc_component * component ,
476
476
enum snd_soc_bias_level level )
477
477
{
478
- struct wm9090_priv * wm9090 = snd_soc_codec_get_drvdata ( codec );
478
+ struct wm9090_priv * wm9090 = snd_soc_component_get_drvdata ( component );
479
479
480
480
switch (level ) {
481
481
case SND_SOC_BIAS_ON :
482
482
break ;
483
483
484
484
case SND_SOC_BIAS_PREPARE :
485
- snd_soc_update_bits ( codec , WM9090_ANTIPOP2 , WM9090_VMID_ENA ,
485
+ snd_soc_component_update_bits ( component , WM9090_ANTIPOP2 , WM9090_VMID_ENA ,
486
486
WM9090_VMID_ENA );
487
- snd_soc_update_bits ( codec , WM9090_POWER_MANAGEMENT_1 ,
487
+ snd_soc_component_update_bits ( component , WM9090_POWER_MANAGEMENT_1 ,
488
488
WM9090_BIAS_ENA |
489
489
WM9090_VMID_RES_MASK ,
490
490
WM9090_BIAS_ENA |
@@ -493,7 +493,7 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec,
493
493
break ;
494
494
495
495
case SND_SOC_BIAS_STANDBY :
496
- if (snd_soc_codec_get_bias_level ( codec ) == SND_SOC_BIAS_OFF ) {
496
+ if (snd_soc_component_get_bias_level ( component ) == SND_SOC_BIAS_OFF ) {
497
497
/* Restore the register cache */
498
498
regcache_sync (wm9090 -> regmap );
499
499
}
@@ -502,9 +502,9 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec,
502
502
* ground referenced outputs and class D speaker mean that
503
503
* latency is not an issue.
504
504
*/
505
- snd_soc_update_bits ( codec , WM9090_POWER_MANAGEMENT_1 ,
505
+ snd_soc_component_update_bits ( component , WM9090_POWER_MANAGEMENT_1 ,
506
506
WM9090_BIAS_ENA | WM9090_VMID_RES_MASK , 0 );
507
- snd_soc_update_bits ( codec , WM9090_ANTIPOP2 ,
507
+ snd_soc_component_update_bits ( component , WM9090_ANTIPOP2 ,
508
508
WM9090_VMID_ENA , 0 );
509
509
break ;
510
510
@@ -515,45 +515,49 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec,
515
515
return 0 ;
516
516
}
517
517
518
- static int wm9090_probe (struct snd_soc_codec * codec )
518
+ static int wm9090_probe (struct snd_soc_component * component )
519
519
{
520
520
/* Configure some defaults; they will be written out when we
521
521
* bring the bias up.
522
522
*/
523
- snd_soc_update_bits ( codec , WM9090_IN1_LINE_INPUT_A_VOLUME ,
523
+ snd_soc_component_update_bits ( component , WM9090_IN1_LINE_INPUT_A_VOLUME ,
524
524
WM9090_IN1_VU | WM9090_IN1A_ZC ,
525
525
WM9090_IN1_VU | WM9090_IN1A_ZC );
526
- snd_soc_update_bits ( codec , WM9090_IN1_LINE_INPUT_B_VOLUME ,
526
+ snd_soc_component_update_bits ( component , WM9090_IN1_LINE_INPUT_B_VOLUME ,
527
527
WM9090_IN1_VU | WM9090_IN1B_ZC ,
528
528
WM9090_IN1_VU | WM9090_IN1B_ZC );
529
- snd_soc_update_bits ( codec , WM9090_IN2_LINE_INPUT_A_VOLUME ,
529
+ snd_soc_component_update_bits ( component , WM9090_IN2_LINE_INPUT_A_VOLUME ,
530
530
WM9090_IN2_VU | WM9090_IN2A_ZC ,
531
531
WM9090_IN2_VU | WM9090_IN2A_ZC );
532
- snd_soc_update_bits ( codec , WM9090_IN2_LINE_INPUT_B_VOLUME ,
532
+ snd_soc_component_update_bits ( component , WM9090_IN2_LINE_INPUT_B_VOLUME ,
533
533
WM9090_IN2_VU | WM9090_IN2B_ZC ,
534
534
WM9090_IN2_VU | WM9090_IN2B_ZC );
535
- snd_soc_update_bits ( codec , WM9090_SPEAKER_VOLUME_LEFT ,
535
+ snd_soc_component_update_bits ( component , WM9090_SPEAKER_VOLUME_LEFT ,
536
536
WM9090_SPKOUT_VU | WM9090_SPKOUTL_ZC ,
537
537
WM9090_SPKOUT_VU | WM9090_SPKOUTL_ZC );
538
- snd_soc_update_bits ( codec , WM9090_LEFT_OUTPUT_VOLUME ,
538
+ snd_soc_component_update_bits ( component , WM9090_LEFT_OUTPUT_VOLUME ,
539
539
WM9090_HPOUT1_VU | WM9090_HPOUT1L_ZC ,
540
540
WM9090_HPOUT1_VU | WM9090_HPOUT1L_ZC );
541
- snd_soc_update_bits ( codec , WM9090_RIGHT_OUTPUT_VOLUME ,
541
+ snd_soc_component_update_bits ( component , WM9090_RIGHT_OUTPUT_VOLUME ,
542
542
WM9090_HPOUT1_VU | WM9090_HPOUT1R_ZC ,
543
543
WM9090_HPOUT1_VU | WM9090_HPOUT1R_ZC );
544
544
545
- snd_soc_update_bits ( codec , WM9090_CLOCKING_1 ,
545
+ snd_soc_component_update_bits ( component , WM9090_CLOCKING_1 ,
546
546
WM9090_TOCLK_ENA , WM9090_TOCLK_ENA );
547
547
548
- wm9090_add_controls (codec );
548
+ wm9090_add_controls (component );
549
549
550
550
return 0 ;
551
551
}
552
552
553
- static const struct snd_soc_codec_driver soc_codec_dev_wm9090 = {
554
- .probe = wm9090_probe ,
555
- .set_bias_level = wm9090_set_bias_level ,
556
- .suspend_bias_off = true,
553
+ static const struct snd_soc_component_driver soc_component_dev_wm9090 = {
554
+ .probe = wm9090_probe ,
555
+ .set_bias_level = wm9090_set_bias_level ,
556
+ .suspend_bias_off = 1 ,
557
+ .idle_bias_on = 1 ,
558
+ .use_pmdown_time = 1 ,
559
+ .endianness = 1 ,
560
+ .non_legacy_dai_naming = 1 ,
557
561
};
558
562
559
563
static const struct regmap_config wm9090_regmap = {
@@ -607,8 +611,8 @@ static int wm9090_i2c_probe(struct i2c_client *i2c,
607
611
608
612
i2c_set_clientdata (i2c , wm9090 );
609
613
610
- ret = snd_soc_register_codec (& i2c -> dev ,
611
- & soc_codec_dev_wm9090 , NULL , 0 );
614
+ ret = devm_snd_soc_register_component (& i2c -> dev ,
615
+ & soc_component_dev_wm9090 , NULL , 0 );
612
616
if (ret != 0 ) {
613
617
dev_err (& i2c -> dev , "Failed to register CODEC: %d\n" , ret );
614
618
return ret ;
@@ -617,12 +621,6 @@ static int wm9090_i2c_probe(struct i2c_client *i2c,
617
621
return 0 ;
618
622
}
619
623
620
- static int wm9090_i2c_remove (struct i2c_client * i2c )
621
- {
622
- snd_soc_unregister_codec (& i2c -> dev );
623
- return 0 ;
624
- }
625
-
626
624
static const struct i2c_device_id wm9090_id [] = {
627
625
{ "wm9090" , 0 },
628
626
{ "wm9093" , 0 },
@@ -635,7 +633,6 @@ static struct i2c_driver wm9090_i2c_driver = {
635
633
.name = "wm9090" ,
636
634
},
637
635
.probe = wm9090_i2c_probe ,
638
- .remove = wm9090_i2c_remove ,
639
636
.id_table = wm9090_id ,
640
637
};
641
638
0 commit comments