ASoC: codecs: tlv320dac33: switch to gpiod api
Subsystems (4)
PATCH v2 1/1 ASoC: codecs: tlv320dac33: switch to gpiod api
Changelog:
- Changed reset GPIO setup that uses 'gpio_request' and 'gpio_direction_output' to use 'devm_gpio_request_one' instead for legacy support.
- Convert to gpio descriptor for use.
- Better error handling with 'gpiod_set_value'.
- Removed cleanup of reset gpio as gpiod api is now used.
- Performed full conversion to gpiod with 'devm_gpiod_get_optional'.
- Removed struct 'tlv320dac33_platform_data' as it is
not used in the kernel.
- Removed file 'tlv320dac33-plat.h' as it was not included anywhere outside this driver.
- Removed 'power_gpio' and added 'reset_gpiod'.
- Added default value for dac33->burst_bclkdiv as it can't be 0 (2-17). See <https://www.ti.com/lit/ds/symlink/tlv320dac32.pdf>
--- include/sound/tlv320dac33-plat.h | 21 ---------- sound/soc/codecs/tlv320dac33.c | 68 +++++++++++++++----------------- 2 files changed, 31 insertions(+), 58 deletions(-) delete mode 100644 include/sound/tlv320dac33-plat.h
include/sound/tlv320dac33-plat.h deleted +0 -21
@@ -1,21 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Platform header for Texas Instruments TLV320DAC33 codec driver -* -* Author: Peter Ujfalusi <[email protected]> -* -* Copyright: (C) 2009 Nokia Corporation -*/ - -#ifndef __TLV320DAC33_PLAT_H -#define __TLV320DAC33_PLAT_H - -struct tlv320dac33_platform_data { -int power_gpio; -int mode1_latency;/* latency caused by the i2c writes in us */ -int auto_fifo_config;/* FIFO config based on the period size */ -int keep_bclk;/* Keep the BCLK running in FIFO modes */ -u8 burst_bclkdiv; -}; - -#endif /* __TLV320DAC33_PLAT_H */
sound/soc/codecs/tlv320dac33.c +31 -37
136 lines not on this page · raw message
Signature · 1 line
2.51.0
Mark Brown
maintainerQuoted 9 lines · Alex Tran
Changelog:
- Changed reset GPIO setup that uses 'gpio_request' and 'gpio_direction_output' to use 'devm_gpio_request_one' instead for legacy support.
- Convert to gpio descriptor for use.
- Better error handling with 'gpiod_set_value'.
- Removed cleanup of reset gpio as gpiod api is now used.
Quoted 8 lines
- Performed full conversion to gpiod with '
devm_gpiod_get_optional'.
- Removed struct 'tlv320dac33_platform_data' as it is
not used in the kernel.
- Removed file 'tlv320dac33-plat.h' as it was not included anywhere outside this driver.
- Removed 'power_gpio' and added 'reset_gpiod'.
- Added default value fordac33->burst_bclkdivas it can't be 0 (2-17). See <https://www.ti.com/lit/ds/symlink/tlv320dac32.pdf>
This is a set of separate changes which as covered in submitting-patches.rst should each be split into individual patches, this makes things much easier to review.
As also covered in submitting-patches.rst any inter-version changelogs should go after the --- so they can be removed by tooling.
Quoted 6 lines · Mark Brown
This is a set of separate changes which as covered in
submitting-patches.rstshould each be split into individual patches, this makes things much easier to review.As also covered in
submitting-patches.rstany inter-version changelogs should go after the --- so they can be removed by tooling.
I'll split it up into 3 separate patches: the removal of the struct tlv320dac33_platform_data,
addition of burst_bclkdiv default value, and the conversion to gpiod.
Thanks for the feedback,
Signature · 1 line
Alex Tran
kernel test robot
build botkernel test robot noticed the following build warnings:
Hi Alex,
kernel test robot noticed the following build warnings:
[auto build test WARNING on broonie-sound/for-next]
[also build test WARNING on tiwai-sound/for-next tiwai-sound/for-linus linus/master v6.17-rc4 next-20250901] [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/Alex-Tran/ASoC-codecs-tlv320dac33-switch-to-gpiod-api/20250901-120204 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next patch link: https://lore.kernel.org/r/20250901035956.1195081-1-alex.t.tran%40gmail.com patch subject: [PATCH v2] ASoC: codecs: tlv320dac33: switch to gpiod api config: loongarch-randconfig-002-20250901 (https://download.01.org/0day-ci/archive/20250902/[email protected]/config) compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250902/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> sound/soc/codecs/tlv320dac33.c:1506:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
1506 | if (IS_ERR(dac33->reset_gpiod)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/codecs/tlv320dac33.c:1531:9: note: uninitialized use occurs here
1531 | return ret;
| ^~~
sound/soc/codecs/tlv320dac33.c:1506:2: note: remove the 'if' if its condition is always false
1506 | if (IS_ERR(dac33->reset_gpiod)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1507 | dev_err_probe(&client->dev, PTR_ERR(dac33->reset_gpiod),
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1508 | "Failed to get reset GPIO\n");
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1509 | goto err;
| ~~~~~~~~~
1510 | }
| ~
sound/soc/codecs/tlv320dac33.c:1477:9: note: initialize the variable 'ret' to silence this warning
1477 | int ret, i;
| ^
| = 01 warning generated.
vim +1506 sound/soc/codecs/tlv320dac33.c
1473
1474 static int dac33_i2c_probe(struct i2c_client *client)
1475 {
1476 struct tlv320dac33_priv *dac33;
1477 int ret, i;
1478
1479 dac33 = devm_kzalloc(&client->dev, sizeof(struct tlv320dac33_priv),
1480 GFP_KERNEL);
1481 if (dac33 == NULL)
1482 return -ENOMEM;
1483
1484 dac33->reg_cache = devm_kmemdup_array(&client->dev, dac33_reg, ARRAY_SIZE(dac33_reg),
1485 sizeof(dac33_reg[0]), GFP_KERNEL);
1486 if (!dac33->reg_cache)
1487 return -ENOMEM;
1488
1489 dac33->i2c = client;
1490 mutex_init(&dac33->mutex);
1491 spin_lock_init(&dac33->lock);
1492
1493 i2c_set_clientdata(client, dac33);
1494
1495 if (!dac33->burst_bclkdiv)
1496 dac33->burst_bclkdiv = 8;
1497 if (!dac33->mode1_latency)
1498 dac33->mode1_latency = 10000; /* 10ms */
1499 dac33->irq = client->irq;
1500 /* Disable FIFO use by default */
1501 dac33->fifo_mode = DAC33_FIFO_BYPASS;
1502
1503 /* request optional reset GPIO */
1504 dac33->reset_gpiod =
1505 devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW);
> 1506 if (IS_ERR(dac33->reset_gpiod)) { 1507 dev_err_probe(&client->dev, PTR_ERR(dac33->reset_gpiod),
1508 "Failed to get reset GPIO\n");
1509 goto err;
1510 }
1511
1512 for (i = 0; i < ARRAY_SIZE(dac33->supplies); i++)
1513 dac33->supplies[i].supply = dac33_supply_names[i];
1514
1515 ret = devm_regulator_bulk_get(&client->dev, ARRAY_SIZE(dac33->supplies),
1516 dac33->supplies);
1517
1518 if (ret != 0) {
1519 dev_err(&client->dev, "Failed to request supplies: %d\n", ret);
1520 goto err;
1521 }
1522
1523 ret = devm_snd_soc_register_component(&client->dev,
1524 &soc_component_dev_tlv320dac33, &dac33_dai, 1);
1525 if (ret < 0)
1526 goto err;
1527
1528 return ret;
1529
1530 err:
1531 return ret;
1532 }
1533
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki