Skip to content

Commit

Permalink
ASoC: nau8825: Add ADCOUT IO drive strength control
Browse files Browse the repository at this point in the history
Add a property to control the driving of ADCOUT.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
  • Loading branch information
CTLIN0 authored and intel-lab-lkp committed Sep 7, 2022
1 parent 71bdc77 commit 1aaaef1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Documentation/devicetree/bindings/sound/nau8825.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions sound/soc/codecs/nau8825.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions sound/soc/codecs/nau8825.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 1aaaef1

Please sign in to comment.