Lines Matching +full:revision +full:- +full:id2

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * wm8350-core.c -- Device access for Wolfson WM8350
65 return regmap_update_bits(wm8350->regmap, reg, mask, 0); in wm8350_clear_bits()
71 return regmap_update_bits(wm8350->regmap, reg, mask, mask); in wm8350_set_bits()
80 err = regmap_read(wm8350->regmap, reg, &data); in wm8350_reg_read()
82 dev_err(wm8350->dev, "read from reg R%d failed\n", reg); in wm8350_reg_read()
92 ret = regmap_write(wm8350->regmap, reg, val); in wm8350_reg_write()
95 dev_err(wm8350->dev, "write to reg R%d failed\n", reg); in wm8350_reg_write()
105 err = regmap_bulk_read(wm8350->regmap, start_reg, dest, regs); in wm8350_block_read()
107 dev_err(wm8350->dev, "block read starting from R%d failed\n", in wm8350_block_read()
119 ret = regmap_bulk_write(wm8350->regmap, start_reg, src, regs); in wm8350_block_write()
121 dev_err(wm8350->dev, "block write starting at R%d failed\n", in wm8350_block_write()
147 dev_err(wm8350->dev, "lock failed\n"); in wm8350_reg_lock()
149 wm8350->unlocked = false; in wm8350_reg_lock()
178 dev_err(wm8350->dev, "unlock failed\n"); in wm8350_reg_unlock()
180 wm8350->unlocked = true; in wm8350_reg_unlock()
193 return -EINVAL; in wm8350_read_auxadc()
196 return -EINVAL; in wm8350_read_auxadc()
198 mutex_lock(&wm8350->auxadc_mutex); in wm8350_read_auxadc()
216 try_wait_for_completion(&wm8350->auxadc_done); in wm8350_read_auxadc()
221 wait_for_completion_timeout(&wm8350->auxadc_done, msecs_to_jiffies(5)); in wm8350_read_auxadc()
225 dev_err(wm8350->dev, "adc chn %d read timeout\n", channel); in wm8350_read_auxadc()
235 mutex_unlock(&wm8350->auxadc_mutex); in wm8350_read_auxadc()
245 complete(&wm8350->auxadc_done); in wm8350_auxadc_irq()
251 * Register a client device. This is non-fatal since there is no need to
260 *pdev = platform_device_alloc(name, -1); in wm8350_client_dev_register()
262 dev_err(wm8350->dev, "Failed to allocate %s\n", name); in wm8350_client_dev_register()
266 (*pdev)->dev.parent = wm8350->dev; in wm8350_client_dev_register()
270 dev_err(wm8350->dev, "Failed to register %s: %d\n", name, ret); in wm8350_client_dev_register()
280 unsigned int id1, id2, mask_rev; in wm8350_device_init() local
283 dev_set_drvdata(wm8350->dev, wm8350); in wm8350_device_init()
285 /* get WM8350 revision and config mode */ in wm8350_device_init()
286 ret = regmap_read(wm8350->regmap, WM8350_RESET_ID, &id1); in wm8350_device_init()
288 dev_err(wm8350->dev, "Failed to read ID: %d\n", ret); in wm8350_device_init()
292 ret = regmap_read(wm8350->regmap, WM8350_ID, &id2); in wm8350_device_init()
294 dev_err(wm8350->dev, "Failed to read ID: %d\n", ret); in wm8350_device_init()
298 ret = regmap_read(wm8350->regmap, WM8350_REVISION, &mask_rev); in wm8350_device_init()
300 dev_err(wm8350->dev, "Failed to read revision: %d\n", ret); in wm8350_device_init()
305 dev_err(wm8350->dev, in wm8350_device_init()
307 ret = -ENODEV; in wm8350_device_init()
311 mode = (id2 & WM8350_CONF_STS_MASK) >> 10; in wm8350_device_init()
312 cust_id = id2 & WM8350_CUST_ID_MASK; in wm8350_device_init()
313 chip_rev = (id2 & WM8350_CHIP_REV_MASK) >> 12; in wm8350_device_init()
314 dev_info(wm8350->dev, in wm8350_device_init()
319 dev_err(wm8350->dev, "Unsupported CUST_ID\n"); in wm8350_device_init()
320 ret = -ENODEV; in wm8350_device_init()
326 wm8350->pmic.max_dcdc = WM8350_DCDC_6; in wm8350_device_init()
327 wm8350->pmic.max_isink = WM8350_ISINK_B; in wm8350_device_init()
331 dev_info(wm8350->dev, "WM8350 Rev E\n"); in wm8350_device_init()
334 dev_info(wm8350->dev, "WM8350 Rev F\n"); in wm8350_device_init()
337 dev_info(wm8350->dev, "WM8350 Rev G\n"); in wm8350_device_init()
338 wm8350->power.rev_g_coeff = 1; in wm8350_device_init()
341 dev_info(wm8350->dev, "WM8350 Rev H\n"); in wm8350_device_init()
342 wm8350->power.rev_g_coeff = 1; in wm8350_device_init()
346 dev_err(wm8350->dev, "Unknown WM8350 CHIP_REV\n"); in wm8350_device_init()
347 ret = -ENODEV; in wm8350_device_init()
353 wm8350->pmic.max_dcdc = WM8350_DCDC_4; in wm8350_device_init()
354 wm8350->pmic.max_isink = WM8350_ISINK_A; in wm8350_device_init()
358 dev_info(wm8350->dev, "WM8351 Rev A\n"); in wm8350_device_init()
359 wm8350->power.rev_g_coeff = 1; in wm8350_device_init()
363 dev_info(wm8350->dev, "WM8351 Rev B\n"); in wm8350_device_init()
364 wm8350->power.rev_g_coeff = 1; in wm8350_device_init()
368 dev_err(wm8350->dev, "Unknown WM8351 CHIP_REV\n"); in wm8350_device_init()
369 ret = -ENODEV; in wm8350_device_init()
375 wm8350->pmic.max_dcdc = WM8350_DCDC_6; in wm8350_device_init()
376 wm8350->pmic.max_isink = WM8350_ISINK_B; in wm8350_device_init()
380 dev_info(wm8350->dev, "WM8352 Rev A\n"); in wm8350_device_init()
381 wm8350->power.rev_g_coeff = 1; in wm8350_device_init()
385 dev_err(wm8350->dev, "Unknown WM8352 CHIP_REV\n"); in wm8350_device_init()
386 ret = -ENODEV; in wm8350_device_init()
392 dev_err(wm8350->dev, "Unknown MASK_REV\n"); in wm8350_device_init()
393 ret = -ENODEV; in wm8350_device_init()
397 mutex_init(&wm8350->auxadc_mutex); in wm8350_device_init()
398 init_completion(&wm8350->auxadc_done); in wm8350_device_init()
404 if (wm8350->irq_base) { in wm8350_device_init()
405 ret = request_threaded_irq(wm8350->irq_base + in wm8350_device_init()
411 dev_warn(wm8350->dev, in wm8350_device_init()
415 if (pdata && pdata->init) { in wm8350_device_init()
416 ret = pdata->init(wm8350); in wm8350_device_init()
418 dev_err(wm8350->dev, "Platform init() failed: %d\n", in wm8350_device_init()
426 wm8350_client_dev_register(wm8350, "wm8350-codec", in wm8350_device_init()
427 &(wm8350->codec.pdev)); in wm8350_device_init()
428 wm8350_client_dev_register(wm8350, "wm8350-gpio", in wm8350_device_init()
429 &(wm8350->gpio.pdev)); in wm8350_device_init()
430 wm8350_client_dev_register(wm8350, "wm8350-hwmon", in wm8350_device_init()
431 &(wm8350->hwmon.pdev)); in wm8350_device_init()
432 wm8350_client_dev_register(wm8350, "wm8350-power", in wm8350_device_init()
433 &(wm8350->power.pdev)); in wm8350_device_init()
434 wm8350_client_dev_register(wm8350, "wm8350-rtc", &(wm8350->rtc.pdev)); in wm8350_device_init()
435 wm8350_client_dev_register(wm8350, "wm8350-wdt", &(wm8350->wdt.pdev)); in wm8350_device_init()