| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * rt5640.c -- RT5640/RT5639 ALSA SoC audio codec driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2011 Realtek Semiconductor Corp. |
|---|
| 5 | 6 | * Author: Johnny Hsu <johnnyhsu@realtek.com> |
|---|
| 6 | 7 | * Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 10 | | - * published by the Free Software Foundation. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | |
|---|
| 13 | 10 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 977 | 974 | switch (event) { |
|---|
| 978 | 975 | case SND_SOC_DAPM_POST_PMU: |
|---|
| 979 | 976 | rt5640_pmu_depop(component); |
|---|
| 980 | | - rt5640->hp_mute = 0; |
|---|
| 977 | + rt5640->hp_mute = false; |
|---|
| 981 | 978 | break; |
|---|
| 982 | 979 | |
|---|
| 983 | 980 | case SND_SOC_DAPM_PRE_PMD: |
|---|
| 984 | | - rt5640->hp_mute = 1; |
|---|
| 981 | + rt5640->hp_mute = true; |
|---|
| 985 | 982 | msleep(70); |
|---|
| 986 | 983 | break; |
|---|
| 987 | 984 | |
|---|
| .. | .. |
|---|
| 1656 | 1653 | if (component == NULL) |
|---|
| 1657 | 1654 | return -EINVAL; |
|---|
| 1658 | 1655 | |
|---|
| 1659 | | - val = snd_soc_component_read32(component, RT5640_I2S1_SDP); |
|---|
| 1656 | + val = snd_soc_component_read(component, RT5640_I2S1_SDP); |
|---|
| 1660 | 1657 | val = (val & RT5640_I2S_IF_MASK) >> RT5640_I2S_IF_SFT; |
|---|
| 1661 | 1658 | switch (dai_id) { |
|---|
| 1662 | 1659 | case RT5640_AIF1: |
|---|
| .. | .. |
|---|
| 1667 | 1664 | break; |
|---|
| 1668 | 1665 | case RT5640_IF_113: |
|---|
| 1669 | 1666 | ret |= RT5640_U_IF1; |
|---|
| 1670 | | - /* fall through */ |
|---|
| 1667 | + fallthrough; |
|---|
| 1671 | 1668 | case RT5640_IF_312: |
|---|
| 1672 | 1669 | case RT5640_IF_213: |
|---|
| 1673 | 1670 | ret |= RT5640_U_IF2; |
|---|
| .. | .. |
|---|
| 1683 | 1680 | break; |
|---|
| 1684 | 1681 | case RT5640_IF_223: |
|---|
| 1685 | 1682 | ret |= RT5640_U_IF1; |
|---|
| 1686 | | - /* fall through */ |
|---|
| 1683 | + fallthrough; |
|---|
| 1687 | 1684 | case RT5640_IF_123: |
|---|
| 1688 | 1685 | case RT5640_IF_321: |
|---|
| 1689 | 1686 | ret |= RT5640_U_IF2; |
|---|
| .. | .. |
|---|
| 1842 | 1839 | struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); |
|---|
| 1843 | 1840 | unsigned int reg_val = 0; |
|---|
| 1844 | 1841 | unsigned int pll_bit = 0; |
|---|
| 1845 | | - |
|---|
| 1846 | | - if (freq == rt5640->sysclk && clk_id == rt5640->sysclk_src) |
|---|
| 1847 | | - return 0; |
|---|
| 1848 | 1842 | |
|---|
| 1849 | 1843 | switch (clk_id) { |
|---|
| 1850 | 1844 | case RT5640_SCLK_S_MCLK: |
|---|
| .. | .. |
|---|
| 2086 | 2080 | snd_soc_component_update_bits(component, RT5640_ASRC_2, |
|---|
| 2087 | 2081 | asrc2_mask, asrc2_value); |
|---|
| 2088 | 2082 | |
|---|
| 2089 | | - if (snd_soc_component_read32(component, RT5640_ASRC_2)) { |
|---|
| 2083 | + if (snd_soc_component_read(component, RT5640_ASRC_2)) { |
|---|
| 2090 | 2084 | rt5640->asrc_en = true; |
|---|
| 2091 | 2085 | snd_soc_component_update_bits(component, RT5640_JD_CTRL, 0x3, 0x3); |
|---|
| 2092 | 2086 | } else { |
|---|
| .. | .. |
|---|
| 2151 | 2145 | { |
|---|
| 2152 | 2146 | int val; |
|---|
| 2153 | 2147 | |
|---|
| 2154 | | - val = snd_soc_component_read32(component, RT5640_IRQ_CTRL2); |
|---|
| 2148 | + val = snd_soc_component_read(component, RT5640_IRQ_CTRL2); |
|---|
| 2155 | 2149 | dev_dbg(component->dev, "irq ctrl2 %#04x\n", val); |
|---|
| 2156 | 2150 | |
|---|
| 2157 | 2151 | return (val & RT5640_MB1_OC_STATUS); |
|---|
| .. | .. |
|---|
| 2162 | 2156 | struct rt5640_priv *rt5640 = snd_soc_component_get_drvdata(component); |
|---|
| 2163 | 2157 | int val; |
|---|
| 2164 | 2158 | |
|---|
| 2165 | | - val = snd_soc_component_read32(component, RT5640_INT_IRQ_ST); |
|---|
| 2159 | + val = snd_soc_component_read(component, RT5640_INT_IRQ_ST); |
|---|
| 2166 | 2160 | dev_dbg(component->dev, "irq status %#04x\n", val); |
|---|
| 2167 | 2161 | |
|---|
| 2168 | 2162 | if (rt5640->jd_inverted) |
|---|
| .. | .. |
|---|
| 2489 | 2483 | snd_soc_component_update_bits(component, RT5640_MICBIAS, 0x0030, 0x0030); |
|---|
| 2490 | 2484 | snd_soc_component_update_bits(component, RT5640_DSP_PATH2, 0xfc00, 0x0c00); |
|---|
| 2491 | 2485 | |
|---|
| 2492 | | - switch (snd_soc_component_read32(component, RT5640_RESET) & RT5640_ID_MASK) { |
|---|
| 2486 | + switch (snd_soc_component_read(component, RT5640_RESET) & RT5640_ID_MASK) { |
|---|
| 2493 | 2487 | case RT5640_ID_5640: |
|---|
| 2494 | 2488 | case RT5640_ID_5642: |
|---|
| 2495 | 2489 | snd_soc_add_component_controls(component, |
|---|
| .. | .. |
|---|
| 2713 | 2707 | static const struct regmap_config rt5640_regmap = { |
|---|
| 2714 | 2708 | .reg_bits = 8, |
|---|
| 2715 | 2709 | .val_bits = 16, |
|---|
| 2716 | | - .use_single_rw = true, |
|---|
| 2710 | + .use_single_read = true, |
|---|
| 2711 | + .use_single_write = true, |
|---|
| 2717 | 2712 | |
|---|
| 2718 | 2713 | .max_register = RT5640_VENDOR_ID2 + 1 + (ARRAY_SIZE(rt5640_ranges) * |
|---|
| 2719 | 2714 | RT5640_PR_SPACING), |
|---|
| .. | .. |
|---|
| 2830 | 2825 | regmap_update_bits(rt5640->regmap, RT5640_DUMMY1, |
|---|
| 2831 | 2826 | RT5640_MCLK_DET, RT5640_MCLK_DET); |
|---|
| 2832 | 2827 | |
|---|
| 2833 | | - rt5640->hp_mute = 1; |
|---|
| 2828 | + rt5640->hp_mute = true; |
|---|
| 2834 | 2829 | rt5640->irq = i2c->irq; |
|---|
| 2835 | 2830 | INIT_DELAYED_WORK(&rt5640->bp_work, rt5640_button_press_work); |
|---|
| 2836 | 2831 | INIT_WORK(&rt5640->jack_work, rt5640_jack_work); |
|---|