aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/cs35l32.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/cs35l32.c')
-rw-r--r--sound/soc/codecs/cs35l32.c60
1 files changed, 10 insertions, 50 deletions
diff --git a/sound/soc/codecs/cs35l32.c b/sound/soc/codecs/cs35l32.c
index 8f40025b7e7c..44c30fe3e315 100644
--- a/sound/soc/codecs/cs35l32.c
+++ b/sound/soc/codecs/cs35l32.c
@@ -74,33 +74,8 @@ static const struct reg_default cs35l32_reg_defaults[] = {
74static bool cs35l32_readable_register(struct device *dev, unsigned int reg) 74static bool cs35l32_readable_register(struct device *dev, unsigned int reg)
75{ 75{
76 switch (reg) { 76 switch (reg) {
77 case CS35L32_DEVID_AB: 77 case CS35L32_DEVID_AB ... CS35L32_AUDIO_LED_MNGR:
78 case CS35L32_DEVID_CD: 78 case CS35L32_ADSP_CTL ... CS35L32_FLASH_INHIBIT:
79 case CS35L32_DEVID_E:
80 case CS35L32_FAB_ID:
81 case CS35L32_REV_ID:
82 case CS35L32_PWRCTL1:
83 case CS35L32_PWRCTL2:
84 case CS35L32_CLK_CTL:
85 case CS35L32_BATT_THRESHOLD:
86 case CS35L32_VMON:
87 case CS35L32_BST_CPCP_CTL:
88 case CS35L32_IMON_SCALING:
89 case CS35L32_AUDIO_LED_MNGR:
90 case CS35L32_ADSP_CTL:
91 case CS35L32_CLASSD_CTL:
92 case CS35L32_PROTECT_CTL:
93 case CS35L32_INT_MASK_1:
94 case CS35L32_INT_MASK_2:
95 case CS35L32_INT_MASK_3:
96 case CS35L32_INT_STATUS_1:
97 case CS35L32_INT_STATUS_2:
98 case CS35L32_INT_STATUS_3:
99 case CS35L32_LED_STATUS:
100 case CS35L32_FLASH_MODE:
101 case CS35L32_MOVIE_MODE:
102 case CS35L32_FLASH_TIMER:
103 case CS35L32_FLASH_INHIBIT:
104 return true; 79 return true;
105 default: 80 default:
106 return false; 81 return false;
@@ -110,15 +85,8 @@ static bool cs35l32_readable_register(struct device *dev, unsigned int reg)
110static bool cs35l32_volatile_register(struct device *dev, unsigned int reg) 85static bool cs35l32_volatile_register(struct device *dev, unsigned int reg)
111{ 86{
112 switch (reg) { 87 switch (reg) {
113 case CS35L32_DEVID_AB: 88 case CS35L32_DEVID_AB ... CS35L32_REV_ID:
114 case CS35L32_DEVID_CD: 89 case CS35L32_INT_STATUS_1 ... CS35L32_LED_STATUS:
115 case CS35L32_DEVID_E:
116 case CS35L32_FAB_ID:
117 case CS35L32_REV_ID:
118 case CS35L32_INT_STATUS_1:
119 case CS35L32_INT_STATUS_2:
120 case CS35L32_INT_STATUS_3:
121 case CS35L32_LED_STATUS:
122 return true; 90 return true;
123 default: 91 default:
124 return false; 92 return false;
@@ -128,10 +96,7 @@ static bool cs35l32_volatile_register(struct device *dev, unsigned int reg)
128static bool cs35l32_precious_register(struct device *dev, unsigned int reg) 96static bool cs35l32_precious_register(struct device *dev, unsigned int reg)
129{ 97{
130 switch (reg) { 98 switch (reg) {
131 case CS35L32_INT_STATUS_1: 99 case CS35L32_INT_STATUS_1 ... CS35L32_LED_STATUS:
132 case CS35L32_INT_STATUS_2:
133 case CS35L32_INT_STATUS_3:
134 case CS35L32_LED_STATUS:
135 return true; 100 return true;
136 default: 101 default:
137 return false; 102 return false;
@@ -276,7 +241,7 @@ static const struct snd_soc_codec_driver soc_codec_dev_cs35l32 = {
276}; 241};
277 242
278/* Current and threshold powerup sequence Pg37 in datasheet */ 243/* Current and threshold powerup sequence Pg37 in datasheet */
279static const struct reg_default cs35l32_monitor_patch[] = { 244static const struct reg_sequence cs35l32_monitor_patch[] = {
280 245
281 { 0x00, 0x99 }, 246 { 0x00, 0x99 },
282 { 0x48, 0x17 }, 247 { 0x48, 0x17 },
@@ -441,8 +406,7 @@ static int cs35l32_i2c_probe(struct i2c_client *i2c_client,
441 if (IS_ERR(cs35l32->reset_gpio)) 406 if (IS_ERR(cs35l32->reset_gpio))
442 return PTR_ERR(cs35l32->reset_gpio); 407 return PTR_ERR(cs35l32->reset_gpio);
443 408
444 if (cs35l32->reset_gpio) 409 gpiod_set_value_cansleep(cs35l32->reset_gpio, 1);
445 gpiod_set_value_cansleep(cs35l32->reset_gpio, 1);
446 410
447 /* initialize codec */ 411 /* initialize codec */
448 ret = regmap_read(cs35l32->regmap, CS35L32_DEVID_AB, &reg); 412 ret = regmap_read(cs35l32->regmap, CS35L32_DEVID_AB, &reg);
@@ -536,8 +500,7 @@ static int cs35l32_i2c_remove(struct i2c_client *i2c_client)
536 snd_soc_unregister_codec(&i2c_client->dev); 500 snd_soc_unregister_codec(&i2c_client->dev);
537 501
538 /* Hold down reset */ 502 /* Hold down reset */
539 if (cs35l32->reset_gpio) 503 gpiod_set_value_cansleep(cs35l32->reset_gpio, 0);
540 gpiod_set_value_cansleep(cs35l32->reset_gpio, 0);
541 504
542 return 0; 505 return 0;
543} 506}
@@ -551,8 +514,7 @@ static int cs35l32_runtime_suspend(struct device *dev)
551 regcache_mark_dirty(cs35l32->regmap); 514 regcache_mark_dirty(cs35l32->regmap);
552 515
553 /* Hold down reset */ 516 /* Hold down reset */
554 if (cs35l32->reset_gpio) 517 gpiod_set_value_cansleep(cs35l32->reset_gpio, 0);
555 gpiod_set_value_cansleep(cs35l32->reset_gpio, 0);
556 518
557 /* remove power */ 519 /* remove power */
558 regulator_bulk_disable(ARRAY_SIZE(cs35l32->supplies), 520 regulator_bulk_disable(ARRAY_SIZE(cs35l32->supplies),
@@ -575,8 +537,7 @@ static int cs35l32_runtime_resume(struct device *dev)
575 return ret; 537 return ret;
576 } 538 }
577 539
578 if (cs35l32->reset_gpio) 540 gpiod_set_value_cansleep(cs35l32->reset_gpio, 1);
579 gpiod_set_value_cansleep(cs35l32->reset_gpio, 1);
580 541
581 regcache_cache_only(cs35l32->regmap, false); 542 regcache_cache_only(cs35l32->regmap, false);
582 regcache_sync(cs35l32->regmap); 543 regcache_sync(cs35l32->regmap);
@@ -607,7 +568,6 @@ MODULE_DEVICE_TABLE(i2c, cs35l32_id);
607static struct i2c_driver cs35l32_i2c_driver = { 568static struct i2c_driver cs35l32_i2c_driver = {
608 .driver = { 569 .driver = {
609 .name = "cs35l32", 570 .name = "cs35l32",
610 .owner = THIS_MODULE,
611 .pm = &cs35l32_runtime_pm, 571 .pm = &cs35l32_runtime_pm,
612 .of_match_table = cs35l32_of_match, 572 .of_match_table = cs35l32_of_match,
613 }, 573 },