[PATCH] ASoC: nau8825: Add ADCOUT IO drive strength control
Add a property to control the driving of ADCOUT.
Signed-off-by: David Lin CTLIN0@nuvoton.com --- Documentation/devicetree/bindings/sound/nau8825.txt | 2 ++ sound/soc/codecs/nau8825.c | 6 ++++++ sound/soc/codecs/nau8825.h | 3 +++ 3 files changed, 11 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/nau8825.txt b/Documentation/devicetree/bindings/sound/nau8825.txt index 388a7bc60b1f..54972cc2ca1a 100644 --- a/Documentation/devicetree/bindings/sound/nau8825.txt +++ b/Documentation/devicetree/bindings/sound/nau8825.txt @@ -71,6 +71,8 @@ Optional properties:
- nuvoton,crosstalk-enable: make crosstalk function enable if set.
+ - nuvoton,adcout-drive-str: ADCOUT IO drive strength. 0 - normal, 1 - stronger. + - clocks: list of phandle and clock specifier pairs according to common clock bindings for the clocks described in clock-names - clock-names: should include "mclk" for the MCLK master clock diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c index 8213273f501e..fc00e600cf2c 100644 --- a/sound/soc/codecs/nau8825.c +++ b/sound/soc/codecs/nau8825.c @@ -1983,6 +1983,10 @@ static void nau8825_init_regs(struct nau8825 *nau8825) /* Disable short Frame Sync detection logic */ regmap_update_bits(regmap, NAU8825_REG_LEFT_TIME_SLOT, NAU8825_DIS_FS_SHORT_DET, NAU8825_DIS_FS_SHORT_DET); + /* ADCDAT IO drive strength control */ + regmap_update_bits(remap, NAU8825_REG_CHARGE_PUMP, + NAU8825_ADCOUT_DS_MASK, + nau8825->adcout_ds << NAU8825_ADCOUT_DS_SFT); }
static const struct regmap_config nau8825_regmap_config = { @@ -2521,6 +2525,7 @@ static void nau8825_print_device_properties(struct nau8825 *nau8825) nau8825->jack_eject_debounce); dev_dbg(dev, "crosstalk-enable: %d\n", nau8825->xtalk_enable); + dev_dbg(dev, "adcout-drive-str: %d\n", nau8825->adcout_ds); }
static int nau8825_read_device_properties(struct device *dev, @@ -2587,6 +2592,7 @@ static int nau8825_read_device_properties(struct device *dev, nau8825->jack_eject_debounce = 0; nau8825->xtalk_enable = device_property_read_bool(dev, "nuvoton,crosstalk-enable"); + nau8825->adcout_ds = device_property_read_bool(dev, "nuvoton,adcout-drive-str");
nau8825->mclk = devm_clk_get(dev, "mclk"); if (PTR_ERR(nau8825->mclk) == -EPROBE_DEFER) { diff --git a/sound/soc/codecs/nau8825.h b/sound/soc/codecs/nau8825.h index 887bbff03ec6..6d112b6145df 100644 --- a/sound/soc/codecs/nau8825.h +++ b/sound/soc/codecs/nau8825.h @@ -418,6 +418,8 @@ #define NAU8825_POWERUP_HP_DRV_L (1 << 0)
/* CHARGE_PUMP (0x80) */ +#define NAU8825_ADCOUT_DS_SFT 12 +#define NAU8825_ADCOUT_DS_MASK (1 << NAU8825_ADCOUT_DS_SFT) #define NAU8825_JAMNODCLOW (1 << 10) #define NAU8825_POWER_DOWN_DACR (1 << 9) #define NAU8825_POWER_DOWN_DACL (1 << 8) @@ -477,6 +479,7 @@ struct nau8825 { int imp_rms[NAU8825_XTALK_IMM]; int xtalk_enable; bool xtalk_baktab_initialized; /* True if initialized. */ + bool adcout_ds; };
int nau8825_enable_jack_detect(struct snd_soc_component *component,
On Wed, Sep 07, 2022 at 02:51:27PM +0800, David Lin wrote:
Add a property to control the driving of ADCOUT.
Signed-off-by: David Lin CTLIN0@nuvoton.com
Documentation/devicetree/bindings/sound/nau8825.txt | 2 ++ sound/soc/codecs/nau8825.c | 6 ++++++ sound/soc/codecs/nau8825.h | 3 +++ 3 files changed, 11 insertions(+)
Binding and driver patches should normally be separate patches.
- nuvoton,adcout-drive-str: ADCOUT IO drive strength. 0 - normal, 1 - stronger.
Why not just make this a boolean property rather than requiring values?
- nau8825->adcout_ds = device_property_read_bool(dev, "nuvoton,adcout-drive-str");
It looks like it's being parsed as a boolean.
On 2022/9/7 下午 07:21, Mark Brown wrote:
On Wed, Sep 07, 2022 at 02:51:27PM +0800, David Lin wrote:
Add a property to control the driving of ADCOUT.
Signed-off-by: David Lin CTLIN0@nuvoton.com
Documentation/devicetree/bindings/sound/nau8825.txt | 2 ++ sound/soc/codecs/nau8825.c | 6 ++++++ sound/soc/codecs/nau8825.h | 3 +++ 3 files changed, 11 insertions(+)
Binding and driver patches should normally be separate patches.
OK, I will separate them.
- nuvoton,adcout-drive-str: ADCOUT IO drive strength. 0 - normal, 1 - stronger.
Why not just make this a boolean property rather than requiring values?
- nau8825->adcout_ds = device_property_read_bool(dev, "nuvoton,adcout-drive-str");
It looks like it's being parsed as a boolean.
It's my fault. I will correct it as description of boolean.
Besides, kernel bot catch a build error, I will also fix it.
Hi David,
I love your patch! Yet something to improve:
[auto build test ERROR on broonie-sound/for-next] [also build test ERROR on linus/master v6.0-rc4 next-20220906] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/David-Lin/ASoC-nau8825-Add-AD... base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: hexagon-randconfig-r034-20220906 compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project c55b41d5199d2394dd6cdb8f52180d8b81d809d4) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/1aaaef165060ae445641eb7c942c25... git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review David-Lin/ASoC-nau8825-Add-ADCOUT-IO-drive-strength-control/20220907-145604 git checkout 1aaaef165060ae445641eb7c942c2572209235e4 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash sound/soc/codecs/
If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot lkp@intel.com
All errors (new ones prefixed by >>):
sound/soc/codecs/nau8825.c:1987:21: error: use of undeclared identifier 'remap'; did you mean 'regmap'?
regmap_update_bits(remap, NAU8825_REG_CHARGE_PUMP, ^~~~~ regmap sound/soc/codecs/nau8825.c:1886:17: note: 'regmap' declared here struct regmap *regmap = nau8825->regmap; ^ 1 error generated.
vim +1987 sound/soc/codecs/nau8825.c
1883 1884 static void nau8825_init_regs(struct nau8825 *nau8825) 1885 { 1886 struct regmap *regmap = nau8825->regmap; 1887 1888 /* Latch IIC LSB value */ 1889 regmap_write(regmap, NAU8825_REG_IIC_ADDR_SET, 0x0001); 1890 /* Enable Bias/Vmid */ 1891 regmap_update_bits(nau8825->regmap, NAU8825_REG_BIAS_ADJ, 1892 NAU8825_BIAS_VMID, NAU8825_BIAS_VMID); 1893 regmap_update_bits(nau8825->regmap, NAU8825_REG_BOOST, 1894 NAU8825_GLOBAL_BIAS_EN, NAU8825_GLOBAL_BIAS_EN); 1895 1896 /* VMID Tieoff */ 1897 regmap_update_bits(regmap, NAU8825_REG_BIAS_ADJ, 1898 NAU8825_BIAS_VMID_SEL_MASK, 1899 nau8825->vref_impedance << NAU8825_BIAS_VMID_SEL_SFT); 1900 /* Disable Boost Driver, Automatic Short circuit protection enable */ 1901 regmap_update_bits(regmap, NAU8825_REG_BOOST, 1902 NAU8825_PRECHARGE_DIS | NAU8825_HP_BOOST_DIS | 1903 NAU8825_HP_BOOST_G_DIS | NAU8825_SHORT_SHUTDOWN_EN, 1904 NAU8825_PRECHARGE_DIS | NAU8825_HP_BOOST_DIS | 1905 NAU8825_HP_BOOST_G_DIS | NAU8825_SHORT_SHUTDOWN_EN); 1906 1907 regmap_update_bits(regmap, NAU8825_REG_GPIO12_CTRL, 1908 NAU8825_JKDET_OUTPUT_EN, 1909 nau8825->jkdet_enable ? 0 : NAU8825_JKDET_OUTPUT_EN); 1910 regmap_update_bits(regmap, NAU8825_REG_GPIO12_CTRL, 1911 NAU8825_JKDET_PULL_EN, 1912 nau8825->jkdet_pull_enable ? 0 : NAU8825_JKDET_PULL_EN); 1913 regmap_update_bits(regmap, NAU8825_REG_GPIO12_CTRL, 1914 NAU8825_JKDET_PULL_UP, 1915 nau8825->jkdet_pull_up ? NAU8825_JKDET_PULL_UP : 0); 1916 regmap_update_bits(regmap, NAU8825_REG_JACK_DET_CTRL, 1917 NAU8825_JACK_POLARITY, 1918 /* jkdet_polarity - 1 is for active-low */ 1919 nau8825->jkdet_polarity ? 0 : NAU8825_JACK_POLARITY); 1920 1921 regmap_update_bits(regmap, NAU8825_REG_JACK_DET_CTRL, 1922 NAU8825_JACK_INSERT_DEBOUNCE_MASK, 1923 nau8825->jack_insert_debounce << NAU8825_JACK_INSERT_DEBOUNCE_SFT); 1924 regmap_update_bits(regmap, NAU8825_REG_JACK_DET_CTRL, 1925 NAU8825_JACK_EJECT_DEBOUNCE_MASK, 1926 nau8825->jack_eject_debounce << NAU8825_JACK_EJECT_DEBOUNCE_SFT); 1927 1928 /* Pull up IRQ pin */ 1929 regmap_update_bits(regmap, NAU8825_REG_INTERRUPT_MASK, 1930 NAU8825_IRQ_PIN_PULLUP | NAU8825_IRQ_PIN_PULL_EN, 1931 NAU8825_IRQ_PIN_PULLUP | NAU8825_IRQ_PIN_PULL_EN); 1932 /* Mask unneeded IRQs: 1 - disable, 0 - enable */ 1933 regmap_update_bits(regmap, NAU8825_REG_INTERRUPT_MASK, 0x7ff, 0x7ff); 1934 1935 regmap_update_bits(regmap, NAU8825_REG_MIC_BIAS, 1936 NAU8825_MICBIAS_VOLTAGE_MASK, nau8825->micbias_voltage); 1937 1938 if (nau8825->sar_threshold_num) 1939 nau8825_setup_buttons(nau8825); 1940 1941 /* Default oversampling/decimations settings are unusable 1942 * (audible hiss). Set it to something better. 1943 */ 1944 regmap_update_bits(regmap, NAU8825_REG_ADC_RATE, 1945 NAU8825_ADC_SYNC_DOWN_MASK | NAU8825_ADC_SINC4_EN, 1946 NAU8825_ADC_SYNC_DOWN_64); 1947 regmap_update_bits(regmap, NAU8825_REG_DAC_CTRL1, 1948 NAU8825_DAC_OVERSAMPLE_MASK, NAU8825_DAC_OVERSAMPLE_64); 1949 /* Disable DACR/L power */ 1950 regmap_update_bits(regmap, NAU8825_REG_CHARGE_PUMP, 1951 NAU8825_POWER_DOWN_DACR | NAU8825_POWER_DOWN_DACL, 1952 NAU8825_POWER_DOWN_DACR | NAU8825_POWER_DOWN_DACL); 1953 /* Enable TESTDAC. This sets the analog DAC inputs to a '0' input 1954 * signal to avoid any glitches due to power up transients in both 1955 * the analog and digital DAC circuit. 1956 */ 1957 regmap_update_bits(nau8825->regmap, NAU8825_REG_BIAS_ADJ, 1958 NAU8825_BIAS_TESTDAC_EN, NAU8825_BIAS_TESTDAC_EN); 1959 /* CICCLP off */ 1960 regmap_update_bits(regmap, NAU8825_REG_DAC_CTRL1, 1961 NAU8825_DAC_CLIP_OFF, NAU8825_DAC_CLIP_OFF); 1962 1963 /* Class AB bias current to 2x, DAC Capacitor enable MSB/LSB */ 1964 regmap_update_bits(regmap, NAU8825_REG_ANALOG_CONTROL_2, 1965 NAU8825_HP_NON_CLASSG_CURRENT_2xADJ | 1966 NAU8825_DAC_CAPACITOR_MSB | NAU8825_DAC_CAPACITOR_LSB, 1967 NAU8825_HP_NON_CLASSG_CURRENT_2xADJ | 1968 NAU8825_DAC_CAPACITOR_MSB | NAU8825_DAC_CAPACITOR_LSB); 1969 /* Class G timer 64ms */ 1970 regmap_update_bits(regmap, NAU8825_REG_CLASSG_CTRL, 1971 NAU8825_CLASSG_TIMER_MASK, 1972 0x20 << NAU8825_CLASSG_TIMER_SFT); 1973 /* DAC clock delay 2ns, VREF */ 1974 regmap_update_bits(regmap, NAU8825_REG_RDAC, 1975 NAU8825_RDAC_CLK_DELAY_MASK | NAU8825_RDAC_VREF_MASK, 1976 (0x2 << NAU8825_RDAC_CLK_DELAY_SFT) | 1977 (0x3 << NAU8825_RDAC_VREF_SFT)); 1978 /* Config L/R channel */ 1979 regmap_update_bits(nau8825->regmap, NAU8825_REG_DACL_CTRL, 1980 NAU8825_DACL_CH_SEL_MASK, NAU8825_DACL_CH_SEL_L); 1981 regmap_update_bits(nau8825->regmap, NAU8825_REG_DACR_CTRL, 1982 NAU8825_DACL_CH_SEL_MASK, NAU8825_DACL_CH_SEL_R); 1983 /* Disable short Frame Sync detection logic */ 1984 regmap_update_bits(regmap, NAU8825_REG_LEFT_TIME_SLOT, 1985 NAU8825_DIS_FS_SHORT_DET, NAU8825_DIS_FS_SHORT_DET); 1986 /* ADCDAT IO drive strength control */
1987 regmap_update_bits(remap, NAU8825_REG_CHARGE_PUMP,
1988 NAU8825_ADCOUT_DS_MASK, 1989 nau8825->adcout_ds << NAU8825_ADCOUT_DS_SFT); 1990 } 1991
participants (4)
-
David Lin
-
David Lin
-
kernel test robot
-
Mark Brown