2727#include <sound/soc-dapm.h>
2828#include <sound/soc.h>
2929#include <sound/tlv.h>
30+ #include <sound/rt1015.h>
3031
3132#include "rl6231.h"
3233#include "rt1015.h"
3334
35+ static const struct rt1015_platform_data i2s_default_platform_data = {
36+ .power_up_delay_ms = 50 ,
37+ };
38+
3439static const struct reg_default rt1015_reg [] = {
3540 { 0x0000 , 0x0000 },
3641 { 0x0004 , 0xa000 },
@@ -539,7 +544,7 @@ static void rt1015_flush_work(struct work_struct *work)
539544 struct rt1015_priv * rt1015 = container_of (work , struct rt1015_priv ,
540545 flush_work .work );
541546 struct snd_soc_component * component = rt1015 -> component ;
542- unsigned int val , i = 0 , count = 20 ;
547+ unsigned int val , i = 0 , count = 200 ;
543548
544549 while (i < count ) {
545550 usleep_range (1000 , 1500 );
@@ -650,6 +655,7 @@ static int rt1015_amp_drv_event(struct snd_soc_dapm_widget *w,
650655 case SND_SOC_DAPM_POST_PMU :
651656 if (rt1015 -> hw_config == RT1015_HW_28 )
652657 schedule_delayed_work (& rt1015 -> flush_work , msecs_to_jiffies (10 ));
658+ msleep (rt1015 -> pdata .power_up_delay_ms );
653659 break ;
654660 default :
655661 break ;
@@ -1067,9 +1073,16 @@ static struct acpi_device_id rt1015_acpi_match[] = {
10671073MODULE_DEVICE_TABLE (acpi , rt1015_acpi_match );
10681074#endif
10691075
1076+ static void rt1015_parse_dt (struct rt1015_priv * rt1015 , struct device * dev )
1077+ {
1078+ device_property_read_u32 (dev , "realtek,power-up-delay-ms" ,
1079+ & rt1015 -> pdata .power_up_delay_ms );
1080+ }
1081+
10701082static int rt1015_i2c_probe (struct i2c_client * i2c ,
10711083 const struct i2c_device_id * id )
10721084{
1085+ struct rt1015_platform_data * pdata = dev_get_platdata (& i2c -> dev );
10731086 struct rt1015_priv * rt1015 ;
10741087 int ret ;
10751088 unsigned int val ;
@@ -1081,6 +1094,13 @@ static int rt1015_i2c_probe(struct i2c_client *i2c,
10811094
10821095 i2c_set_clientdata (i2c , rt1015 );
10831096
1097+ rt1015 -> pdata = i2s_default_platform_data ;
1098+
1099+ if (pdata )
1100+ rt1015 -> pdata = * pdata ;
1101+ else
1102+ rt1015_parse_dt (rt1015 , & i2c -> dev );
1103+
10841104 rt1015 -> regmap = devm_regmap_init_i2c (i2c , & rt1015_regmap );
10851105 if (IS_ERR (rt1015 -> regmap )) {
10861106 ret = PTR_ERR (rt1015 -> regmap );
0 commit comments