diff mbox

[v4,2/2] ASoC: nau8825: Show device properties

Message ID 1445298546-23975-3-git-send-email-benzh@chromium.org (mailing list archive)
State New, archived
Headers show

Commit Message

Ben Zhang Oct. 19, 2015, 11:49 p.m. UTC
The codec device properties are printed for debugging.

Signed-off-by: Ben Zhang <benzh@chromium.org>
---
 sound/soc/codecs/nau8825.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

Comments

Mark Brown Oct. 22, 2015, 4:17 p.m. UTC | #1
On Mon, Oct 19, 2015 at 04:49:06PM -0700, Ben Zhang wrote:
> The codec device properties are printed for debugging.

Hrm...  we do already have multiple ways of dumping the DT...
Ben Zhang Oct. 23, 2015, 1:48 a.m. UTC | #2
On Thu, Oct 22, 2015 at 9:17 AM, Mark Brown <broonie@kernel.org> wrote:
> On Mon, Oct 19, 2015 at 04:49:06PM -0700, Ben Zhang wrote:
>> The codec device properties are printed for debugging.
>
> Hrm...  we do already have multiple ways of dumping the DT...

Hi Mark,

Could you point me to some of the ways of dumping DT? Is there a
generic way of dumping device properties provided by ACPI _DSD?
Sometimes devices may be flashed with different versions of coreboot
firmware which contain different _DSD values. When debugging, it's
helpful to know the exact platform data seen by a codec driver.

Thanks,
Ben
Mark Brown Oct. 23, 2015, 3:49 p.m. UTC | #3
On Thu, Oct 22, 2015 at 06:48:50PM -0700, Ben Zhang wrote:
> On Thu, Oct 22, 2015 at 9:17 AM, Mark Brown <broonie@kernel.org> wrote:

> > Hrm...  we do already have multiple ways of dumping the DT...

> Could you point me to some of the ways of dumping DT? Is there a

The entire device tree is available via /proc/device-tree.

> generic way of dumping device properties provided by ACPI _DSD?

You can also dump the entire ACPI using acpudump from acpica-tools (it
may be packaged under a different name in your distribution).

> Sometimes devices may be flashed with different versions of coreboot
> firmware which contain different _DSD values. When debugging, it's
> helpful to know the exact platform data seen by a codec driver.

Sure, but that's hardly driver specific so the firmwares provide
infrastructure for this.
diff mbox

Patch

diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c
index bd58b96..7fc7b4e 100644
--- a/sound/soc/codecs/nau8825.c
+++ b/sound/soc/codecs/nau8825.c
@@ -1100,6 +1100,34 @@  static void nau8825_reset_chip(struct regmap *regmap)
 	regmap_write(regmap, NAU8825_REG_RESET, 0x00);
 }
 
+static void nau8825_print_device_properties(struct nau8825 *nau8825)
+{
+	int i;
+	struct device *dev = nau8825->dev;
+
+	dev_dbg(dev, "jkdet-enable:         %d\n", nau8825->jkdet_enable);
+	dev_dbg(dev, "jkdet-pull-enable:    %d\n", nau8825->jkdet_pull_enable);
+	dev_dbg(dev, "jkdet-pull-up:        %d\n", nau8825->jkdet_pull_up);
+	dev_dbg(dev, "jkdet-polarity:       %d\n", nau8825->jkdet_polarity);
+	dev_dbg(dev, "micbias-voltage:      %d\n", nau8825->micbias_voltage);
+	dev_dbg(dev, "vref-impedance:       %d\n", nau8825->vref_impedance);
+
+	dev_dbg(dev, "sar-threshold-num:    %d\n", nau8825->sar_threshold_num);
+	for (i = 0; i < nau8825->sar_threshold_num; i++)
+		dev_dbg(dev, "sar-threshold[%d]=%d\n", i,
+				nau8825->sar_threshold[i]);
+
+	dev_dbg(dev, "sar-hysteresis:       %d\n", nau8825->sar_hysteresis);
+	dev_dbg(dev, "sar-voltage:          %d\n", nau8825->sar_voltage);
+	dev_dbg(dev, "sar-compare-time:     %d\n", nau8825->sar_compare_time);
+	dev_dbg(dev, "sar-sampling-time:    %d\n", nau8825->sar_sampling_time);
+	dev_dbg(dev, "short-key-debounce:   %d\n", nau8825->key_debounce);
+	dev_dbg(dev, "jack-insert-debounce: %d\n",
+			nau8825->jack_insert_debounce);
+	dev_dbg(dev, "jack-eject-debounce:  %d\n",
+			nau8825->jack_eject_debounce);
+}
+
 static int nau8825_read_device_properties(struct device *dev,
 	struct nau8825 *nau8825) {
 
@@ -1213,6 +1241,8 @@  static int nau8825_i2c_probe(struct i2c_client *i2c,
 	nau8825->dev = dev;
 	nau8825->irq = i2c->irq;
 
+	nau8825_print_device_properties(nau8825);
+
 	nau8825_reset_chip(nau8825->regmap);
 	ret = regmap_read(nau8825->regmap, NAU8825_REG_I2C_DEVICE_ID, &value);
 	if (ret < 0) {