| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * da7218.c - DA7218 ALSA SoC Codec Driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2015 Dialog Semiconductor |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 9 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 10 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 11 | | - * option) any later version. |
|---|
| 12 | 8 | */ |
|---|
| 13 | 9 | |
|---|
| 14 | 10 | #include <linux/clk.h> |
|---|
| .. | .. |
|---|
| 302 | 298 | bool calibrated = false; |
|---|
| 303 | 299 | |
|---|
| 304 | 300 | /* Save current state of MIC control registers */ |
|---|
| 305 | | - mic_1_ctrl = snd_soc_component_read32(component, DA7218_MIC_1_CTRL); |
|---|
| 306 | | - mic_2_ctrl = snd_soc_component_read32(component, DA7218_MIC_2_CTRL); |
|---|
| 301 | + mic_1_ctrl = snd_soc_component_read(component, DA7218_MIC_1_CTRL); |
|---|
| 302 | + mic_2_ctrl = snd_soc_component_read(component, DA7218_MIC_2_CTRL); |
|---|
| 307 | 303 | |
|---|
| 308 | 304 | /* Save current state of input mixer control registers */ |
|---|
| 309 | | - mixin_1_ctrl = snd_soc_component_read32(component, DA7218_MIXIN_1_CTRL); |
|---|
| 310 | | - mixin_2_ctrl = snd_soc_component_read32(component, DA7218_MIXIN_2_CTRL); |
|---|
| 305 | + mixin_1_ctrl = snd_soc_component_read(component, DA7218_MIXIN_1_CTRL); |
|---|
| 306 | + mixin_2_ctrl = snd_soc_component_read(component, DA7218_MIXIN_2_CTRL); |
|---|
| 311 | 307 | |
|---|
| 312 | 308 | /* Save current state of input filter control registers */ |
|---|
| 313 | | - in_1l_filt_ctrl = snd_soc_component_read32(component, DA7218_IN_1L_FILTER_CTRL); |
|---|
| 314 | | - in_1r_filt_ctrl = snd_soc_component_read32(component, DA7218_IN_1R_FILTER_CTRL); |
|---|
| 315 | | - in_2l_filt_ctrl = snd_soc_component_read32(component, DA7218_IN_2L_FILTER_CTRL); |
|---|
| 316 | | - in_2r_filt_ctrl = snd_soc_component_read32(component, DA7218_IN_2R_FILTER_CTRL); |
|---|
| 309 | + in_1l_filt_ctrl = snd_soc_component_read(component, DA7218_IN_1L_FILTER_CTRL); |
|---|
| 310 | + in_1r_filt_ctrl = snd_soc_component_read(component, DA7218_IN_1R_FILTER_CTRL); |
|---|
| 311 | + in_2l_filt_ctrl = snd_soc_component_read(component, DA7218_IN_2L_FILTER_CTRL); |
|---|
| 312 | + in_2r_filt_ctrl = snd_soc_component_read(component, DA7218_IN_2R_FILTER_CTRL); |
|---|
| 317 | 313 | |
|---|
| 318 | 314 | /* Save current state of input HPF control registers */ |
|---|
| 319 | | - in_1_hpf_ctrl = snd_soc_component_read32(component, DA7218_IN_1_HPF_FILTER_CTRL); |
|---|
| 320 | | - in_2_hpf_ctrl = snd_soc_component_read32(component, DA7218_IN_2_HPF_FILTER_CTRL); |
|---|
| 315 | + in_1_hpf_ctrl = snd_soc_component_read(component, DA7218_IN_1_HPF_FILTER_CTRL); |
|---|
| 316 | + in_2_hpf_ctrl = snd_soc_component_read(component, DA7218_IN_2_HPF_FILTER_CTRL); |
|---|
| 321 | 317 | |
|---|
| 322 | 318 | /* Enable then Mute MIC PGAs */ |
|---|
| 323 | 319 | snd_soc_component_update_bits(component, DA7218_MIC_1_CTRL, DA7218_MIC_1_AMP_EN_MASK, |
|---|
| .. | .. |
|---|
| 373 | 369 | snd_soc_component_update_bits(component, DA7218_CALIB_CTRL, DA7218_CALIB_AUTO_EN_MASK, |
|---|
| 374 | 370 | DA7218_CALIB_AUTO_EN_MASK); |
|---|
| 375 | 371 | do { |
|---|
| 376 | | - calib_ctrl = snd_soc_component_read32(component, DA7218_CALIB_CTRL); |
|---|
| 372 | + calib_ctrl = snd_soc_component_read(component, DA7218_CALIB_CTRL); |
|---|
| 377 | 373 | if (calib_ctrl & DA7218_CALIB_AUTO_EN_MASK) { |
|---|
| 378 | 374 | ++i; |
|---|
| 379 | 375 | usleep_range(DA7218_ALC_CALIB_DELAY_MIN, |
|---|
| .. | .. |
|---|
| 617 | 613 | } |
|---|
| 618 | 614 | |
|---|
| 619 | 615 | /* Make sure at least out filter1 enabled to allow programming */ |
|---|
| 620 | | - out_filt1l = snd_soc_component_read32(component, DA7218_OUT_1L_FILTER_CTRL); |
|---|
| 616 | + out_filt1l = snd_soc_component_read(component, DA7218_OUT_1L_FILTER_CTRL); |
|---|
| 621 | 617 | snd_soc_component_write(component, DA7218_OUT_1L_FILTER_CTRL, |
|---|
| 622 | 618 | out_filt1l | DA7218_OUT_1L_FILTER_EN_MASK); |
|---|
| 623 | 619 | |
|---|
| .. | .. |
|---|
| 1423 | 1419 | i = 0; |
|---|
| 1424 | 1420 | success = false; |
|---|
| 1425 | 1421 | do { |
|---|
| 1426 | | - refosc_cal = snd_soc_component_read32(component, DA7218_PLL_REFOSC_CAL); |
|---|
| 1422 | + refosc_cal = snd_soc_component_read(component, DA7218_PLL_REFOSC_CAL); |
|---|
| 1427 | 1423 | if (!(refosc_cal & DA7218_PLL_REFOSC_CAL_START_MASK)) { |
|---|
| 1428 | 1424 | success = true; |
|---|
| 1429 | 1425 | } else { |
|---|
| .. | .. |
|---|
| 1442 | 1438 | DA7218_PC_RESYNC_AUTO_MASK); |
|---|
| 1443 | 1439 | |
|---|
| 1444 | 1440 | /* If SRM not enabled, we don't need to check status */ |
|---|
| 1445 | | - pll_ctrl = snd_soc_component_read32(component, DA7218_PLL_CTRL); |
|---|
| 1441 | + pll_ctrl = snd_soc_component_read(component, DA7218_PLL_CTRL); |
|---|
| 1446 | 1442 | if ((pll_ctrl & DA7218_PLL_MODE_MASK) != DA7218_PLL_MODE_SRM) |
|---|
| 1447 | 1443 | return 0; |
|---|
| 1448 | 1444 | |
|---|
| .. | .. |
|---|
| 1450 | 1446 | i = 0; |
|---|
| 1451 | 1447 | success = false; |
|---|
| 1452 | 1448 | do { |
|---|
| 1453 | | - pll_status = snd_soc_component_read32(component, DA7218_PLL_STATUS); |
|---|
| 1449 | + pll_status = snd_soc_component_read(component, DA7218_PLL_STATUS); |
|---|
| 1454 | 1450 | if (pll_status & DA7218_PLL_SRM_STATUS_SRM_LOCK) { |
|---|
| 1455 | 1451 | success = true; |
|---|
| 1456 | 1452 | } else { |
|---|
| .. | .. |
|---|
| 2240 | 2236 | u8 jack_status; |
|---|
| 2241 | 2237 | int report; |
|---|
| 2242 | 2238 | |
|---|
| 2243 | | - jack_status = snd_soc_component_read32(component, DA7218_EVENT_STATUS); |
|---|
| 2239 | + jack_status = snd_soc_component_read(component, DA7218_EVENT_STATUS); |
|---|
| 2244 | 2240 | |
|---|
| 2245 | 2241 | if (jack_status & DA7218_HPLDET_JACK_STS_MASK) |
|---|
| 2246 | 2242 | report = SND_JACK_HEADPHONE; |
|---|
| .. | .. |
|---|
| 2260 | 2256 | u8 status; |
|---|
| 2261 | 2257 | |
|---|
| 2262 | 2258 | /* Read IRQ status reg */ |
|---|
| 2263 | | - status = snd_soc_component_read32(component, DA7218_EVENT); |
|---|
| 2259 | + status = snd_soc_component_read(component, DA7218_EVENT); |
|---|
| 2264 | 2260 | if (!status) |
|---|
| 2265 | 2261 | return IRQ_NONE; |
|---|
| 2266 | 2262 | |
|---|