Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branches 'topic/rt298', 'topic/ts3a227e' and 'topic/cs42xx8' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-owner

+58 -12
+2 -1
sound/soc/codecs/cs42xx8-i2c.c
··· 20 20 static int cs42xx8_i2c_probe(struct i2c_client *i2c, 21 21 const struct i2c_device_id *id) 22 22 { 23 - u32 ret = cs42xx8_probe(&i2c->dev, 23 + int ret = cs42xx8_probe(&i2c->dev, 24 24 devm_regmap_init_i2c(i2c, &cs42xx8_regmap_config)); 25 25 if (ret) 26 26 return ret; ··· 51 51 .name = "cs42xx8", 52 52 .owner = THIS_MODULE, 53 53 .pm = &cs42xx8_pm, 54 + .of_match_table = cs42xx8_of_match, 54 55 }, 55 56 .probe = cs42xx8_i2c_probe, 56 57 .remove = cs42xx8_i2c_remove,
+10 -9
sound/soc/codecs/cs42xx8.c
··· 425 425 }; 426 426 EXPORT_SYMBOL_GPL(cs42888_data); 427 427 428 - static const struct of_device_id cs42xx8_of_match[] = { 428 + const struct of_device_id cs42xx8_of_match[] = { 429 429 { .compatible = "cirrus,cs42448", .data = &cs42448_data, }, 430 430 { .compatible = "cirrus,cs42888", .data = &cs42888_data, }, 431 431 { /* sentinel */ } ··· 435 435 436 436 int cs42xx8_probe(struct device *dev, struct regmap *regmap) 437 437 { 438 - const struct of_device_id *of_id = of_match_device(cs42xx8_of_match, dev); 438 + const struct of_device_id *of_id; 439 439 struct cs42xx8_priv *cs42xx8; 440 440 int ret, val, i; 441 + 442 + if (IS_ERR(regmap)) { 443 + ret = PTR_ERR(regmap); 444 + dev_err(dev, "failed to allocate regmap: %d\n", ret); 445 + return ret; 446 + } 441 447 442 448 cs42xx8 = devm_kzalloc(dev, sizeof(*cs42xx8), GFP_KERNEL); 443 449 if (cs42xx8 == NULL) 444 450 return -ENOMEM; 445 451 452 + cs42xx8->regmap = regmap; 446 453 dev_set_drvdata(dev, cs42xx8); 447 454 455 + of_id = of_match_device(cs42xx8_of_match, dev); 448 456 if (of_id) 449 457 cs42xx8->drvdata = of_id->data; 450 458 ··· 489 481 490 482 /* Make sure hardware reset done */ 491 483 msleep(5); 492 - 493 - cs42xx8->regmap = regmap; 494 - if (IS_ERR(cs42xx8->regmap)) { 495 - ret = PTR_ERR(cs42xx8->regmap); 496 - dev_err(dev, "failed to allocate regmap: %d\n", ret); 497 - goto err_enable; 498 - } 499 484 500 485 /* 501 486 * We haven't marked the chip revision as volatile due to
+1
sound/soc/codecs/cs42xx8.h
··· 22 22 extern const struct cs42xx8_driver_data cs42448_data; 23 23 extern const struct cs42xx8_driver_data cs42888_data; 24 24 extern const struct regmap_config cs42xx8_regmap_config; 25 + extern const struct of_device_id cs42xx8_of_match[]; 25 26 int cs42xx8_probe(struct device *dev, struct regmap *regmap); 26 27 27 28 /* CS42888 register map */
+45 -2
sound/soc/codecs/ts3a227e.c
··· 23 23 #include "ts3a227e.h" 24 24 25 25 struct ts3a227e { 26 + struct device *dev; 26 27 struct regmap *regmap; 27 28 struct snd_soc_jack *jack; 28 29 bool plugged; 29 30 bool mic_present; 30 31 unsigned int buttons_held; 32 + int irq; 31 33 }; 32 34 33 35 /* Button values to be reported on the jack */ ··· 191 189 struct ts3a227e *ts3a227e = (struct ts3a227e *)data; 192 190 struct regmap *regmap = ts3a227e->regmap; 193 191 unsigned int int_reg, kp_int_reg, acc_reg, i; 192 + struct device *dev = ts3a227e->dev; 193 + int ret; 194 194 195 195 /* Check for plug/unplug. */ 196 - regmap_read(regmap, TS3A227E_REG_INTERRUPT, &int_reg); 196 + ret = regmap_read(regmap, TS3A227E_REG_INTERRUPT, &int_reg); 197 + if (ret) { 198 + dev_err(dev, "failed to clear interrupt ret=%d\n", ret); 199 + return IRQ_NONE; 200 + } 201 + 197 202 if (int_reg & (DETECTION_COMPLETE_EVENT | INS_REM_EVENT)) { 198 203 regmap_read(regmap, TS3A227E_REG_ACCESSORY_STATUS, &acc_reg); 199 204 ts3a227e_new_jack_state(ts3a227e, acc_reg); 200 205 } 201 206 202 207 /* Report any key events. */ 203 - regmap_read(regmap, TS3A227E_REG_KP_INTERRUPT, &kp_int_reg); 208 + ret = regmap_read(regmap, TS3A227E_REG_KP_INTERRUPT, &kp_int_reg); 209 + if (ret) { 210 + dev_err(dev, "failed to clear key interrupt ret=%d\n", ret); 211 + return IRQ_NONE; 212 + } 213 + 204 214 for (i = 0; i < TS3A227E_NUM_BUTTONS; i++) { 205 215 if (kp_int_reg & PRESS_MASK(i)) 206 216 ts3a227e->buttons_held |= (1 << i); ··· 297 283 return -ENOMEM; 298 284 299 285 i2c_set_clientdata(i2c, ts3a227e); 286 + ts3a227e->dev = dev; 287 + ts3a227e->irq = i2c->irq; 300 288 301 289 ts3a227e->regmap = devm_regmap_init_i2c(i2c, &ts3a227e_regmap_config); 302 290 if (IS_ERR(ts3a227e->regmap)) ··· 336 320 return 0; 337 321 } 338 322 323 + #ifdef CONFIG_PM_SLEEP 324 + static int ts3a227e_suspend(struct device *dev) 325 + { 326 + struct ts3a227e *ts3a227e = dev_get_drvdata(dev); 327 + 328 + dev_dbg(ts3a227e->dev, "suspend disable irq\n"); 329 + disable_irq(ts3a227e->irq); 330 + 331 + return 0; 332 + } 333 + 334 + static int ts3a227e_resume(struct device *dev) 335 + { 336 + struct ts3a227e *ts3a227e = dev_get_drvdata(dev); 337 + 338 + dev_dbg(ts3a227e->dev, "resume enable irq\n"); 339 + enable_irq(ts3a227e->irq); 340 + 341 + return 0; 342 + } 343 + #endif 344 + 345 + static const struct dev_pm_ops ts3a227e_pm = { 346 + SET_SYSTEM_SLEEP_PM_OPS(ts3a227e_suspend, ts3a227e_resume) 347 + }; 348 + 339 349 static const struct i2c_device_id ts3a227e_i2c_ids[] = { 340 350 { "ts3a227e", 0 }, 341 351 { } ··· 378 336 .driver = { 379 337 .name = "ts3a227e", 380 338 .owner = THIS_MODULE, 339 + .pm = &ts3a227e_pm, 381 340 .of_match_table = of_match_ptr(ts3a227e_of_match), 382 341 }, 383 342 .probe = ts3a227e_i2c_probe,