Lines Matching refs:as3722
221 static int as3722_check_device_id(struct as3722 *as3722) in as3722_check_device_id() argument
227 ret = as3722_read(as3722, AS3722_ASIC_ID1_REG, &val); in as3722_check_device_id()
229 dev_err(as3722->dev, "ASIC_ID1 read failed: %d\n", ret); in as3722_check_device_id()
234 dev_err(as3722->dev, "Device is not AS3722, ID is 0x%x\n", val); in as3722_check_device_id()
238 ret = as3722_read(as3722, AS3722_ASIC_ID2_REG, &val); in as3722_check_device_id()
240 dev_err(as3722->dev, "ASIC_ID2 read failed: %d\n", ret); in as3722_check_device_id()
244 dev_info(as3722->dev, "AS3722 with revision 0x%x found\n", val); in as3722_check_device_id()
248 static int as3722_configure_pullups(struct as3722 *as3722) in as3722_configure_pullups() argument
253 if (as3722->en_intern_int_pullup) in as3722_configure_pullups()
255 if (as3722->en_intern_i2c_pullup) in as3722_configure_pullups()
258 ret = as3722_update_bits(as3722, AS3722_IOVOLTAGE_REG, in as3722_configure_pullups()
261 dev_err(as3722->dev, "IOVOLTAGE_REG update failed: %d\n", ret); in as3722_configure_pullups()
332 struct as3722 *as3722) in as3722_i2c_of_probe() argument
348 as3722->en_intern_int_pullup = of_property_read_bool(np, in as3722_i2c_of_probe()
350 as3722->en_intern_i2c_pullup = of_property_read_bool(np, in as3722_i2c_of_probe()
352 as3722->en_ac_ok_pwr_on = of_property_read_bool(np, in as3722_i2c_of_probe()
354 as3722->irq_flags = irqd_get_trigger_type(irq_data); in as3722_i2c_of_probe()
355 dev_dbg(&i2c->dev, "IRQ flags are 0x%08lx\n", as3722->irq_flags); in as3722_i2c_of_probe()
362 struct as3722 *as3722; in as3722_i2c_probe() local
367 as3722 = devm_kzalloc(&i2c->dev, sizeof(struct as3722), GFP_KERNEL); in as3722_i2c_probe()
368 if (!as3722) in as3722_i2c_probe()
371 as3722->dev = &i2c->dev; in as3722_i2c_probe()
372 as3722->chip_irq = i2c->irq; in as3722_i2c_probe()
373 i2c_set_clientdata(i2c, as3722); in as3722_i2c_probe()
375 ret = as3722_i2c_of_probe(i2c, as3722); in as3722_i2c_probe()
379 as3722->regmap = devm_regmap_init_i2c(i2c, &as3722_regmap_config); in as3722_i2c_probe()
380 if (IS_ERR(as3722->regmap)) { in as3722_i2c_probe()
381 ret = PTR_ERR(as3722->regmap); in as3722_i2c_probe()
386 ret = as3722_check_device_id(as3722); in as3722_i2c_probe()
390 irq_flags = as3722->irq_flags | IRQF_ONESHOT; in as3722_i2c_probe()
391 ret = devm_regmap_add_irq_chip(as3722->dev, as3722->regmap, in as3722_i2c_probe()
392 as3722->chip_irq, in as3722_i2c_probe()
394 &as3722->irq_data); in as3722_i2c_probe()
396 dev_err(as3722->dev, "Failed to add regmap irq: %d\n", ret); in as3722_i2c_probe()
400 ret = as3722_configure_pullups(as3722); in as3722_i2c_probe()
404 if (as3722->en_ac_ok_pwr_on) in as3722_i2c_probe()
406 ret = as3722_update_bits(as3722, AS3722_CTRL_SEQU1_REG, in as3722_i2c_probe()
409 dev_err(as3722->dev, "CTRLsequ1 update failed: %d\n", ret); in as3722_i2c_probe()
415 regmap_irq_get_domain(as3722->irq_data)); in as3722_i2c_probe()
417 dev_err(as3722->dev, "Failed to add MFD devices: %d\n", ret); in as3722_i2c_probe()
421 device_init_wakeup(as3722->dev, true); in as3722_i2c_probe()
423 dev_dbg(as3722->dev, "AS3722 core driver initialized successfully\n"); in as3722_i2c_probe()
429 struct as3722 *as3722 = dev_get_drvdata(dev); in as3722_i2c_suspend() local
432 enable_irq_wake(as3722->chip_irq); in as3722_i2c_suspend()
433 disable_irq(as3722->chip_irq); in as3722_i2c_suspend()
440 struct as3722 *as3722 = dev_get_drvdata(dev); in as3722_i2c_resume() local
442 enable_irq(as3722->chip_irq); in as3722_i2c_resume()
445 disable_irq_wake(as3722->chip_irq); in as3722_i2c_resume()