* [PATCH 0/7] ASoC: Intel: catpt: Code cleanup
@ 2026-06-01 14:10 Cezary Rojewski
2026-06-01 14:10 ` [PATCH 1/7] ASoC: Intel: catpt: Utilize lock-guard helper Cezary Rojewski
` (7 more replies)
0 siblings, 8 replies; 18+ messages in thread
From: Cezary Rojewski @ 2026-06-01 14:10 UTC (permalink / raw)
To: broonie
Cc: tiwai, perex, amade, linux-sound, andriy.shevchenko,
Cezary Rojewski
All of the changes found here are cleanups and from functional
perspective, have no impact - either unused code is being removed or
existing code is altered to use helpers/macros to improve readability.
Collateral of recent fixes [1]. There is one more patchset with similar
goal following this one. Before the team managed to actually fix the
problem, a number of changes were added to make the code easier to
understand for people who are not the author (me).
[1]: https://lore.kernel.org/linux-sound/20260528083444.1439233-1-cezary.rojewski@intel.com/
Cezary Rojewski (7):
ASoC: Intel: catpt: Utilize lock-guard helper
ASoC: Intel: catpt: Replace RAM-helpers with resource_xxx()
ASoC: Intel: catpt: Simplify the RAM-navigation code
ASoC: Intel: catpt: Simplify catpt_stream_find()
ASoC: Intel: catpt: Remove unused WAVES controls
ASoC: Intel: catpt: Drop manipulation of the obsolete direction flag
ASoC: Intel: catpt: Cleanup components_kcontrols[]
sound/soc/intel/catpt/device.c | 9 ++---
sound/soc/intel/catpt/dsp.c | 19 ++++------
sound/soc/intel/catpt/ipc.c | 10 +----
sound/soc/intel/catpt/loader.c | 7 +---
sound/soc/intel/catpt/pcm.c | 63 ++++++-------------------------
sound/soc/intel/catpt/registers.h | 2 +
6 files changed, 27 insertions(+), 83 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 1/7] ASoC: Intel: catpt: Utilize lock-guard helper
2026-06-01 14:10 [PATCH 0/7] ASoC: Intel: catpt: Code cleanup Cezary Rojewski
@ 2026-06-01 14:10 ` Cezary Rojewski
2026-06-02 8:51 ` Andy Shevchenko
2026-06-01 14:10 ` [PATCH 2/7] ASoC: Intel: catpt: Replace RAM-helpers with resource_xxx() Cezary Rojewski
` (6 subsequent siblings)
7 siblings, 1 reply; 18+ messages in thread
From: Cezary Rojewski @ 2026-06-01 14:10 UTC (permalink / raw)
To: broonie
Cc: tiwai, perex, amade, linux-sound, andriy.shevchenko,
Cezary Rojewski
The lock-guard helps simplify the driver's code.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
sound/soc/intel/catpt/dsp.c | 12 ++++--------
sound/soc/intel/catpt/ipc.c | 10 ++--------
2 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/sound/soc/intel/catpt/dsp.c b/sound/soc/intel/catpt/dsp.c
index 677f348909c8..b1865d10f995 100644
--- a/sound/soc/intel/catpt/dsp.c
+++ b/sound/soc/intel/catpt/dsp.c
@@ -5,6 +5,7 @@
// Author: Cezary Rojewski <cezary.rojewski@intel.com>
//
+#include <linux/cleanup.h>
#include <linux/devcoredump.h>
#include <linux/dma-mapping.h>
#include <linux/firmware.h>
@@ -256,17 +257,15 @@ static int catpt_dsp_select_lpclock(struct catpt_dev *cdev, bool lp, bool waiti)
u32 mask, reg, val;
int ret;
- mutex_lock(&cdev->clk_mutex);
+ guard(mutex)(&cdev->clk_mutex);
val = lp ? CATPT_CS_LPCS : 0;
reg = catpt_readl_shim(cdev, CS1) & CATPT_CS_LPCS;
dev_dbg(cdev->dev, "LPCS [0x%08lx] 0x%08x -> 0x%08x",
CATPT_CS_LPCS, reg, val);
- if (reg == val) {
- mutex_unlock(&cdev->clk_mutex);
+ if (reg == val)
return 0;
- }
if (waiti) {
/* wait for DSP to signal WAIT state */
@@ -276,10 +275,8 @@ static int catpt_dsp_select_lpclock(struct catpt_dev *cdev, bool lp, bool waiti)
if (ret) {
dev_warn(cdev->dev, "await WAITI timeout\n");
/* no signal - only high clock selection allowed */
- if (lp) {
- mutex_unlock(&cdev->clk_mutex);
+ if (lp)
return 0;
- }
}
}
@@ -303,7 +300,6 @@ static int catpt_dsp_select_lpclock(struct catpt_dev *cdev, bool lp, bool waiti)
/* update PLL accordingly */
cdev->spec->pll_shutdown(cdev, lp);
- mutex_unlock(&cdev->clk_mutex);
return 0;
}
diff --git a/sound/soc/intel/catpt/ipc.c b/sound/soc/intel/catpt/ipc.c
index 225757e6a776..11238fc641a4 100644
--- a/sound/soc/intel/catpt/ipc.c
+++ b/sound/soc/intel/catpt/ipc.c
@@ -128,14 +128,8 @@ int catpt_dsp_send_msg_timeout(struct catpt_dev *cdev,
struct catpt_ipc_msg request,
struct catpt_ipc_msg *reply, int timeout, const char *name)
{
- struct catpt_ipc *ipc = &cdev->ipc;
- int ret;
-
- mutex_lock(&ipc->mutex);
- ret = catpt_dsp_do_send_msg(cdev, request, reply, timeout, name);
- mutex_unlock(&ipc->mutex);
-
- return ret;
+ guard(mutex)(&cdev->ipc.mutex);
+ return catpt_dsp_do_send_msg(cdev, request, reply, timeout, name);
}
int catpt_dsp_send_msg(struct catpt_dev *cdev, struct catpt_ipc_msg request,
--
2.34.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/7] ASoC: Intel: catpt: Replace RAM-helpers with resource_xxx()
2026-06-01 14:10 [PATCH 0/7] ASoC: Intel: catpt: Code cleanup Cezary Rojewski
2026-06-01 14:10 ` [PATCH 1/7] ASoC: Intel: catpt: Utilize lock-guard helper Cezary Rojewski
@ 2026-06-01 14:10 ` Cezary Rojewski
2026-06-01 18:57 ` Mark Brown
2026-06-01 14:10 ` [PATCH 3/7] ASoC: Intel: catpt: Simplify the RAM-navigation code Cezary Rojewski
` (5 subsequent siblings)
7 siblings, 1 reply; 18+ messages in thread
From: Cezary Rojewski @ 2026-06-01 14:10 UTC (permalink / raw)
To: broonie
Cc: tiwai, perex, amade, linux-sound, andriy.shevchenko,
Cezary Rojewski
For catpt_sram_init(), the exact same functionality has been provided to
ioport.h with commit 9fb6fef0fb49 ("resource: Add resource set range and
size helpers") in recent years.
As for catpt_dram/iram_size(), leave it for the driver initialization
only. Have all other manipulations be done using resource_xxx() API
which are more familiar to kernel developers.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
sound/soc/intel/catpt/device.c | 9 +++------
sound/soc/intel/catpt/loader.c | 7 +------
2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/sound/soc/intel/catpt/device.c b/sound/soc/intel/catpt/device.c
index b0a926db483c..b176aebea9d5 100644
--- a/sound/soc/intel/catpt/device.c
+++ b/sound/soc/intel/catpt/device.c
@@ -233,12 +233,9 @@ static void catpt_dev_init(struct catpt_dev *cdev, struct device *dev,
cdev->devfmt[CATPT_SSP_IFACE_0].iface = UINT_MAX;
cdev->devfmt[CATPT_SSP_IFACE_1].iface = UINT_MAX;
+ resource_set_range(&cdev->dram, spec->host_dram_offset, catpt_dram_size(cdev));
+ resource_set_range(&cdev->iram, spec->host_iram_offset, catpt_iram_size(cdev));
catpt_ipc_init(&cdev->ipc, dev);
-
- catpt_sram_init(&cdev->dram, spec->host_dram_offset,
- catpt_dram_size(cdev));
- catpt_sram_init(&cdev->iram, spec->host_iram_offset,
- catpt_iram_size(cdev));
}
static int catpt_acpi_probe(struct platform_device *pdev)
@@ -287,7 +284,7 @@ static int catpt_acpi_probe(struct platform_device *pdev)
if (ret)
return ret;
- cdev->dxbuf_vaddr = dmam_alloc_coherent(dev, catpt_dram_size(cdev),
+ cdev->dxbuf_vaddr = dmam_alloc_coherent(dev, resource_size(&cdev->dram),
&cdev->dxbuf_paddr, GFP_KERNEL);
if (!cdev->dxbuf_vaddr)
return -ENOMEM;
diff --git a/sound/soc/intel/catpt/loader.c b/sound/soc/intel/catpt/loader.c
index 75457187b614..c577f2e17ddf 100644
--- a/sound/soc/intel/catpt/loader.c
+++ b/sound/soc/intel/catpt/loader.c
@@ -7,6 +7,7 @@
#include <linux/dma-mapping.h>
#include <linux/firmware.h>
+#include <linux/ioport.h>
#include <linux/slab.h>
#include "core.h"
#include "registers.h"
@@ -50,12 +51,6 @@ struct catpt_fw_block_hdr {
u32 rsvd;
} __packed;
-void catpt_sram_init(struct resource *sram, u32 start, u32 size)
-{
- sram->start = start;
- sram->end = start + size - 1;
-}
-
void catpt_sram_free(struct resource *sram)
{
struct resource *res, *save;
--
2.34.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/7] ASoC: Intel: catpt: Simplify the RAM-navigation code
2026-06-01 14:10 [PATCH 0/7] ASoC: Intel: catpt: Code cleanup Cezary Rojewski
2026-06-01 14:10 ` [PATCH 1/7] ASoC: Intel: catpt: Utilize lock-guard helper Cezary Rojewski
2026-06-01 14:10 ` [PATCH 2/7] ASoC: Intel: catpt: Replace RAM-helpers with resource_xxx() Cezary Rojewski
@ 2026-06-01 14:10 ` Cezary Rojewski
2026-06-01 14:10 ` [PATCH 4/7] ASoC: Intel: catpt: Simplify catpt_stream_find() Cezary Rojewski
` (4 subsequent siblings)
7 siblings, 0 replies; 18+ messages in thread
From: Cezary Rojewski @ 2026-06-01 14:10 UTC (permalink / raw)
To: broonie
Cc: tiwai, perex, amade, linux-sound, andriy.shevchenko,
Cezary Rojewski
Add catpt_iram_addr() to the catpt helpers family and replace all the
open arithmetics with them. Makes it easier to understand the code.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
sound/soc/intel/catpt/dsp.c | 6 +++---
sound/soc/intel/catpt/registers.h | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/sound/soc/intel/catpt/dsp.c b/sound/soc/intel/catpt/dsp.c
index b1865d10f995..60ec561d670c 100644
--- a/sound/soc/intel/catpt/dsp.c
+++ b/sound/soc/intel/catpt/dsp.c
@@ -122,7 +122,7 @@ int catpt_dmac_probe(struct catpt_dev *cdev)
if (!dmac)
return -ENOMEM;
- dmac->regs = cdev->lpe_ba + cdev->spec->host_dma_offset[CATPT_DMA_DEVID];
+ dmac->regs = catpt_dma_addr(cdev, CATPT_DMA_DEVID);
dmac->dev = cdev->dev;
dmac->irq = cdev->irq;
@@ -498,7 +498,7 @@ int catpt_coredump(struct catpt_dev *cdev)
hdr->size = resource_size(&cdev->iram);
pos += sizeof(*hdr);
- memcpy_fromio(pos, cdev->lpe_ba + cdev->iram.start, hdr->size);
+ memcpy_fromio(pos, catpt_iram_addr(cdev), hdr->size);
pos += hdr->size;
hdr = (struct catpt_dump_section_hdr *)pos;
@@ -508,7 +508,7 @@ int catpt_coredump(struct catpt_dev *cdev)
hdr->size = resource_size(&cdev->dram);
pos += sizeof(*hdr);
- memcpy_fromio(pos, cdev->lpe_ba + cdev->dram.start, hdr->size);
+ memcpy_fromio(pos, catpt_dram_addr(cdev), hdr->size);
pos += hdr->size;
hdr = (struct catpt_dump_section_hdr *)pos;
diff --git a/sound/soc/intel/catpt/registers.h b/sound/soc/intel/catpt/registers.h
index 64bd534a76ff..864802bd7809 100644
--- a/sound/soc/intel/catpt/registers.h
+++ b/sound/soc/intel/catpt/registers.h
@@ -144,6 +144,8 @@
#define catpt_dram_addr(cdev) \
((cdev)->lpe_ba + (cdev)->spec->host_dram_offset)
+#define catpt_iram_addr(cdev) \
+ ((cdev)->lpe_ba + (cdev)->spec->host_iram_offset)
#define catpt_shim_addr(cdev) \
((cdev)->lpe_ba + (cdev)->spec->host_shim_offset)
#define catpt_dma_addr(cdev, dma) \
--
2.34.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 4/7] ASoC: Intel: catpt: Simplify catpt_stream_find()
2026-06-01 14:10 [PATCH 0/7] ASoC: Intel: catpt: Code cleanup Cezary Rojewski
` (2 preceding siblings ...)
2026-06-01 14:10 ` [PATCH 3/7] ASoC: Intel: catpt: Simplify the RAM-navigation code Cezary Rojewski
@ 2026-06-01 14:10 ` Cezary Rojewski
2026-06-02 8:53 ` Andy Shevchenko
2026-06-01 14:10 ` [PATCH 5/7] ASoC: Intel: catpt: Remove unused WAVES controls Cezary Rojewski
` (3 subsequent siblings)
7 siblings, 1 reply; 18+ messages in thread
From: Cezary Rojewski @ 2026-06-01 14:10 UTC (permalink / raw)
To: broonie
Cc: tiwai, perex, amade, linux-sound, andriy.shevchenko,
Cezary Rojewski
Code line reduction and more transparent variable naming.
No functional changes.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
sound/soc/intel/catpt/pcm.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/sound/soc/intel/catpt/pcm.c b/sound/soc/intel/catpt/pcm.c
index 7b2bab12c707..deb76eb79d18 100644
--- a/sound/soc/intel/catpt/pcm.c
+++ b/sound/soc/intel/catpt/pcm.c
@@ -99,19 +99,14 @@ catpt_get_stream_template(struct snd_pcm_substream *substream)
}
/* Caller responsible for holding ->stream_mutex. */
-struct catpt_stream_runtime *
-catpt_stream_find(struct catpt_dev *cdev, u8 stream_hw_id)
+struct catpt_stream_runtime *catpt_stream_find(struct catpt_dev *cdev, u8 stream_hw_id)
{
- struct catpt_stream_runtime *pos, *result = NULL;
+ struct catpt_stream_runtime *stream;
- list_for_each_entry(pos, &cdev->stream_list, node) {
- if (pos->info.stream_hw_id == stream_hw_id) {
- result = pos;
- break;
- }
- }
-
- return result;
+ list_for_each_entry(stream, &cdev->stream_list, node)
+ if (stream->info.stream_hw_id == stream_hw_id)
+ return stream;
+ return NULL;
}
/* Caller responsible for holding ->stream_mutex. */
--
2.34.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 5/7] ASoC: Intel: catpt: Remove unused WAVES controls
2026-06-01 14:10 [PATCH 0/7] ASoC: Intel: catpt: Code cleanup Cezary Rojewski
` (3 preceding siblings ...)
2026-06-01 14:10 ` [PATCH 4/7] ASoC: Intel: catpt: Simplify catpt_stream_find() Cezary Rojewski
@ 2026-06-01 14:10 ` Cezary Rojewski
2026-06-02 8:54 ` Andy Shevchenko
2026-06-01 14:10 ` [PATCH 6/7] ASoC: Intel: catpt: Drop manipulation of the obsolete direction flag Cezary Rojewski
` (2 subsequent siblings)
7 siblings, 1 reply; 18+ messages in thread
From: Cezary Rojewski @ 2026-06-01 14:10 UTC (permalink / raw)
To: broonie
Cc: tiwai, perex, amade, linux-sound, andriy.shevchenko,
Cezary Rojewski
Support for the WAVES module was not officially published. The kcontrols
are here to retain 1:1 uapi when transitioning from the haswell- to the
catpt-driver. The catpt-driver is very stable and several years passed
with no WAVES users so it is save to remove the code.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
sound/soc/intel/catpt/pcm.c | 32 --------------------------------
1 file changed, 32 deletions(-)
diff --git a/sound/soc/intel/catpt/pcm.c b/sound/soc/intel/catpt/pcm.c
index deb76eb79d18..bfa94f5ffc8d 100644
--- a/sound/soc/intel/catpt/pcm.c
+++ b/sound/soc/intel/catpt/pcm.c
@@ -967,32 +967,6 @@ static int catpt_loopback_mute_put(struct snd_kcontrol *kctl, struct snd_ctl_ele
return 1;
}
-static int catpt_waves_switch_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- return 0;
-}
-
-static int catpt_waves_switch_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- return 0;
-}
-
-static int catpt_waves_param_get(struct snd_kcontrol *kcontrol,
- unsigned int __user *bytes,
- unsigned int size)
-{
- return 0;
-}
-
-static int catpt_waves_param_put(struct snd_kcontrol *kcontrol,
- const unsigned int __user *bytes,
- unsigned int size)
-{
- return 0;
-}
-
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(catpt_volume_tlv, -9000, 300, 1);
#define CATPT_VOLUME_CTL(kname, pname) { \
@@ -1017,12 +991,6 @@ CATPT_VOLUME_CTL("Media1 Playback Volume", OFFLOAD2),
CATPT_VOLUME_CTL("Mic Capture Volume", CAPTURE1),
SOC_SINGLE_BOOL_EXT("Loopback Mute", (unsigned long)&(bool[1]) {0},
catpt_loopback_mute_get, catpt_loopback_mute_put),
-/* Enable or disable WAVES module */
-SOC_SINGLE_BOOL_EXT("Waves Switch", 0,
- catpt_waves_switch_get, catpt_waves_switch_put),
-/* WAVES module parameter control */
-SND_SOC_BYTES_TLV("Waves Set Param", 128,
- catpt_waves_param_get, catpt_waves_param_put),
};
static const struct snd_soc_dapm_widget component_widgets[] = {
--
2.34.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 6/7] ASoC: Intel: catpt: Drop manipulation of the obsolete direction flag
2026-06-01 14:10 [PATCH 0/7] ASoC: Intel: catpt: Code cleanup Cezary Rojewski
` (4 preceding siblings ...)
2026-06-01 14:10 ` [PATCH 5/7] ASoC: Intel: catpt: Remove unused WAVES controls Cezary Rojewski
@ 2026-06-01 14:10 ` Cezary Rojewski
2026-06-01 14:10 ` [PATCH 7/7] ASoC: Intel: catpt: Cleanup components_kcontrols[] Cezary Rojewski
2026-06-02 8:58 ` [PATCH 0/7] ASoC: Intel: catpt: Code cleanup Andy Shevchenko
7 siblings, 0 replies; 18+ messages in thread
From: Cezary Rojewski @ 2026-06-01 14:10 UTC (permalink / raw)
To: broonie
Cc: tiwai, perex, amade, linux-sound, andriy.shevchenko,
Cezary Rojewski
Setting up direction for struct dma_slave_config is obsolete, see the
description of the struct. The transfer performed by the catpt-driver
is also always DMA_MEM_TO_MEM not DMA_MEM_TO_DEV with preparation step
being dmaengine_prep_dma_memcpy().
DW's ->device_prep_dma_memcpy() always fixes the direction to
DMA_MEM_TO_MEM even if its user fails to do so, see
drivers/dma/dw/core.c. While the change impacts number of checks done
by ->device_config() - p/m buswidth checks are skipped - fields being
fixed up in those i.e.: .dst_addr_width and .src_addr_width, do not take
part in DMA_MEM_TO_MEM transfer.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
sound/soc/intel/catpt/dsp.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/sound/soc/intel/catpt/dsp.c b/sound/soc/intel/catpt/dsp.c
index 60ec561d670c..960344991b11 100644
--- a/sound/soc/intel/catpt/dsp.c
+++ b/sound/soc/intel/catpt/dsp.c
@@ -44,7 +44,6 @@ struct dma_chan *catpt_dma_request_config_chan(struct catpt_dev *cdev)
}
memset(&config, 0, sizeof(config));
- config.direction = DMA_MEM_TO_DEV;
config.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
config.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
config.src_maxburst = 16;
--
2.34.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 7/7] ASoC: Intel: catpt: Cleanup components_kcontrols[]
2026-06-01 14:10 [PATCH 0/7] ASoC: Intel: catpt: Code cleanup Cezary Rojewski
` (5 preceding siblings ...)
2026-06-01 14:10 ` [PATCH 6/7] ASoC: Intel: catpt: Drop manipulation of the obsolete direction flag Cezary Rojewski
@ 2026-06-01 14:10 ` Cezary Rojewski
2026-06-02 8:57 ` Andy Shevchenko
2026-06-02 8:58 ` [PATCH 0/7] ASoC: Intel: catpt: Code cleanup Andy Shevchenko
7 siblings, 1 reply; 18+ messages in thread
From: Cezary Rojewski @ 2026-06-01 14:10 UTC (permalink / raw)
To: broonie
Cc: tiwai, perex, amade, linux-sound, andriy.shevchenko,
Cezary Rojewski
Fix alignment and drop redundant comments.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
sound/soc/intel/catpt/pcm.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/sound/soc/intel/catpt/pcm.c b/sound/soc/intel/catpt/pcm.c
index bfa94f5ffc8d..01b015b4584b 100644
--- a/sound/soc/intel/catpt/pcm.c
+++ b/sound/soc/intel/catpt/pcm.c
@@ -983,14 +983,12 @@ static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(catpt_volume_tlv, -9000, 300, 1);
}
static const struct snd_kcontrol_new component_kcontrols[] = {
-/* Master volume (mixer stream) */
-CATPT_VOLUME_CTL("Master Playback Volume", MIXER),
-/* Individual volume controls for offload and capture */
-CATPT_VOLUME_CTL("Media0 Playback Volume", OFFLOAD1),
-CATPT_VOLUME_CTL("Media1 Playback Volume", OFFLOAD2),
-CATPT_VOLUME_CTL("Mic Capture Volume", CAPTURE1),
-SOC_SINGLE_BOOL_EXT("Loopback Mute", (unsigned long)&(bool[1]) {0},
- catpt_loopback_mute_get, catpt_loopback_mute_put),
+ CATPT_VOLUME_CTL("Master Playback Volume", MIXER),
+ CATPT_VOLUME_CTL("Media0 Playback Volume", OFFLOAD1),
+ CATPT_VOLUME_CTL("Media1 Playback Volume", OFFLOAD2),
+ CATPT_VOLUME_CTL("Mic Capture Volume", CAPTURE1),
+ SOC_SINGLE_BOOL_EXT("Loopback Mute", (unsigned long)&(bool[1]) {0},
+ catpt_loopback_mute_get, catpt_loopback_mute_put),
};
static const struct snd_soc_dapm_widget component_widgets[] = {
--
2.34.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 2/7] ASoC: Intel: catpt: Replace RAM-helpers with resource_xxx()
2026-06-01 14:10 ` [PATCH 2/7] ASoC: Intel: catpt: Replace RAM-helpers with resource_xxx() Cezary Rojewski
@ 2026-06-01 18:57 ` Mark Brown
2026-06-01 20:02 ` Cezary Rojewski
0 siblings, 1 reply; 18+ messages in thread
From: Mark Brown @ 2026-06-01 18:57 UTC (permalink / raw)
To: Cezary Rojewski; +Cc: tiwai, perex, amade, linux-sound, andriy.shevchenko
[-- Attachment #1: Type: text/plain, Size: 261 bytes --]
On Mon, Jun 01, 2026 at 04:10:26PM +0200, Cezary Rojewski wrote:
> -void catpt_sram_init(struct resource *sram, u32 start, u32 size)
> -{
> - sram->start = start;
> - sram->end = start + size - 1;
> -}
> -
The prototype in the header could be cleaned up too.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/7] ASoC: Intel: catpt: Replace RAM-helpers with resource_xxx()
2026-06-01 18:57 ` Mark Brown
@ 2026-06-01 20:02 ` Cezary Rojewski
0 siblings, 0 replies; 18+ messages in thread
From: Cezary Rojewski @ 2026-06-01 20:02 UTC (permalink / raw)
To: Mark Brown; +Cc: tiwai, perex, amade, linux-sound, andriy.shevchenko
On 6/1/2026 8:57 PM, Mark Brown wrote:
> On Mon, Jun 01, 2026 at 04:10:26PM +0200, Cezary Rojewski wrote:
>
>> -void catpt_sram_init(struct resource *sram, u32 start, u32 size)
>> -{
>> - sram->start = start;
>> - sram->end = start + size - 1;
>> -}
>> -
>
> The prototype in the header could be cleaned up too.
Ack, thank you for spotting this out.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 1/7] ASoC: Intel: catpt: Utilize lock-guard helper
2026-06-01 14:10 ` [PATCH 1/7] ASoC: Intel: catpt: Utilize lock-guard helper Cezary Rojewski
@ 2026-06-02 8:51 ` Andy Shevchenko
0 siblings, 0 replies; 18+ messages in thread
From: Andy Shevchenko @ 2026-06-02 8:51 UTC (permalink / raw)
To: Cezary Rojewski; +Cc: broonie, tiwai, perex, amade, linux-sound
On Mon, Jun 01, 2026 at 04:10:25PM +0200, Cezary Rojewski wrote:
> The lock-guard helps simplify the driver's code.
...
> + guard(mutex)(&cdev->ipc.mutex);
LGTM, however, I would still have a blank line here.
> + return catpt_dsp_do_send_msg(cdev, request, reply, timeout, name);
> }
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 4/7] ASoC: Intel: catpt: Simplify catpt_stream_find()
2026-06-01 14:10 ` [PATCH 4/7] ASoC: Intel: catpt: Simplify catpt_stream_find() Cezary Rojewski
@ 2026-06-02 8:53 ` Andy Shevchenko
2026-06-02 8:59 ` Cezary Rojewski
0 siblings, 1 reply; 18+ messages in thread
From: Andy Shevchenko @ 2026-06-02 8:53 UTC (permalink / raw)
To: Cezary Rojewski; +Cc: broonie, tiwai, perex, amade, linux-sound
On Mon, Jun 01, 2026 at 04:10:28PM +0200, Cezary Rojewski wrote:
> Code line reduction and more transparent variable naming.
> No functional changes.
...
> +struct catpt_stream_runtime *catpt_stream_find(struct catpt_dev *cdev, u8 stream_hw_id)
> {
> - struct catpt_stream_runtime *pos, *result = NULL;
> + struct catpt_stream_runtime *stream;
>
> - list_for_each_entry(pos, &cdev->stream_list, node) {
> - if (pos->info.stream_hw_id == stream_hw_id) {
> - result = pos;
> - break;
> - }
> - }
> -
> - return result;
> + list_for_each_entry(stream, &cdev->stream_list, node)
> + if (stream->info.stream_hw_id == stream_hw_id)
> + return stream;
Please, keep a blank line here.
> + return NULL;
> }
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 5/7] ASoC: Intel: catpt: Remove unused WAVES controls
2026-06-01 14:10 ` [PATCH 5/7] ASoC: Intel: catpt: Remove unused WAVES controls Cezary Rojewski
@ 2026-06-02 8:54 ` Andy Shevchenko
2026-06-02 9:01 ` Cezary Rojewski
0 siblings, 1 reply; 18+ messages in thread
From: Andy Shevchenko @ 2026-06-02 8:54 UTC (permalink / raw)
To: Cezary Rojewski; +Cc: broonie, tiwai, perex, amade, linux-sound
On Mon, Jun 01, 2026 at 04:10:29PM +0200, Cezary Rojewski wrote:
> Support for the WAVES module was not officially published. The kcontrols
> are here to retain 1:1 uapi when transitioning from the haswell- to the
I'm not sure I got the 'haswell-' part, if it's a name of the driver, spell it
fully. Otherwise it sounds like a codename, which spells Haswell.
> catpt-driver. The catpt-driver is very stable and several years passed
> with no WAVES users so it is save to remove the code.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 7/7] ASoC: Intel: catpt: Cleanup components_kcontrols[]
2026-06-01 14:10 ` [PATCH 7/7] ASoC: Intel: catpt: Cleanup components_kcontrols[] Cezary Rojewski
@ 2026-06-02 8:57 ` Andy Shevchenko
2026-06-02 9:04 ` Cezary Rojewski
0 siblings, 1 reply; 18+ messages in thread
From: Andy Shevchenko @ 2026-06-02 8:57 UTC (permalink / raw)
To: Cezary Rojewski; +Cc: broonie, tiwai, perex, amade, linux-sound
On Mon, Jun 01, 2026 at 04:10:31PM +0200, Cezary Rojewski wrote:
> Fix alignment and drop redundant comments.
...
> static const struct snd_kcontrol_new component_kcontrols[] = {
> -/* Master volume (mixer stream) */
> -CATPT_VOLUME_CTL("Master Playback Volume", MIXER),
> -/* Individual volume controls for offload and capture */
> -CATPT_VOLUME_CTL("Media0 Playback Volume", OFFLOAD1),
> -CATPT_VOLUME_CTL("Media1 Playback Volume", OFFLOAD2),
> -CATPT_VOLUME_CTL("Mic Capture Volume", CAPTURE1),
> -SOC_SINGLE_BOOL_EXT("Loopback Mute", (unsigned long)&(bool[1]) {0},
> - catpt_loopback_mute_get, catpt_loopback_mute_put),
> + CATPT_VOLUME_CTL("Master Playback Volume", MIXER),
> + CATPT_VOLUME_CTL("Media0 Playback Volume", OFFLOAD1),
> + CATPT_VOLUME_CTL("Media1 Playback Volume", OFFLOAD2),
> + CATPT_VOLUME_CTL("Mic Capture Volume", CAPTURE1),
> + SOC_SINGLE_BOOL_EXT("Loopback Mute", (unsigned long)&(bool[1]) {0},
While at it, can't we simply do outside of this initialiser something like
static bool loopback_mute;
and here
SOC_SINGLE_BOOL_EXT("Loopback Mute", (unsigned long)&loopback_mute,
> + catpt_loopback_mute_get, catpt_loopback_mute_put),
> };
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 0/7] ASoC: Intel: catpt: Code cleanup
2026-06-01 14:10 [PATCH 0/7] ASoC: Intel: catpt: Code cleanup Cezary Rojewski
` (6 preceding siblings ...)
2026-06-01 14:10 ` [PATCH 7/7] ASoC: Intel: catpt: Cleanup components_kcontrols[] Cezary Rojewski
@ 2026-06-02 8:58 ` Andy Shevchenko
7 siblings, 0 replies; 18+ messages in thread
From: Andy Shevchenko @ 2026-06-02 8:58 UTC (permalink / raw)
To: Cezary Rojewski; +Cc: broonie, tiwai, perex, amade, linux-sound
On Mon, Jun 01, 2026 at 04:10:24PM +0200, Cezary Rojewski wrote:
> All of the changes found here are cleanups and from functional
> perspective, have no impact - either unused code is being removed or
> existing code is altered to use helpers/macros to improve readability.
>
> Collateral of recent fixes [1]. There is one more patchset with similar
> goal following this one. Before the team managed to actually fix the
> problem, a number of changes were added to make the code easier to
> understand for people who are not the author (me).
All makes sense to me, a few nit-picks though.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 4/7] ASoC: Intel: catpt: Simplify catpt_stream_find()
2026-06-02 8:53 ` Andy Shevchenko
@ 2026-06-02 8:59 ` Cezary Rojewski
0 siblings, 0 replies; 18+ messages in thread
From: Cezary Rojewski @ 2026-06-02 8:59 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: broonie, tiwai, perex, amade, linux-sound
On 6/2/2026 10:53 AM, Andy Shevchenko wrote:
> On Mon, Jun 01, 2026 at 04:10:28PM +0200, Cezary Rojewski wrote:
>> Code line reduction and more transparent variable naming.
>> No functional changes.
>
> ...
>
>> +struct catpt_stream_runtime *catpt_stream_find(struct catpt_dev *cdev, u8 stream_hw_id)
>> {
>> - struct catpt_stream_runtime *pos, *result = NULL;
>> + struct catpt_stream_runtime *stream;
>>
>> - list_for_each_entry(pos, &cdev->stream_list, node) {
>> - if (pos->info.stream_hw_id == stream_hw_id) {
>> - result = pos;
>> - break;
>> - }
>> - }
>> -
>> - return result;
>> + list_for_each_entry(stream, &cdev->stream_list, node)
>> + if (stream->info.stream_hw_id == stream_hw_id)
>> + return stream;
>
> Please, keep a blank line here.
Agreed, will give it a day and apply in v3.
>
>> + return NULL;
>> }
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 5/7] ASoC: Intel: catpt: Remove unused WAVES controls
2026-06-02 8:54 ` Andy Shevchenko
@ 2026-06-02 9:01 ` Cezary Rojewski
0 siblings, 0 replies; 18+ messages in thread
From: Cezary Rojewski @ 2026-06-02 9:01 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: broonie, tiwai, perex, amade, linux-sound
On 6/2/2026 10:54 AM, Andy Shevchenko wrote:
> On Mon, Jun 01, 2026 at 04:10:29PM +0200, Cezary Rojewski wrote:
>> Support for the WAVES module was not officially published. The kcontrols
>> are here to retain 1:1 uapi when transitioning from the haswell- to the
>
> I'm not sure I got the 'haswell-' part, if it's a name of the driver, spell it
> fully. Otherwise it sounds like a codename, which spells Haswell.
Yes, the above refers to the haswell-driver, predecessor to the
catpt-driver. Ack, will reword.
>> catpt-driver. The catpt-driver is very stable and several years passed
>> with no WAVES users so it is save to remove the code.
>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 7/7] ASoC: Intel: catpt: Cleanup components_kcontrols[]
2026-06-02 8:57 ` Andy Shevchenko
@ 2026-06-02 9:04 ` Cezary Rojewski
0 siblings, 0 replies; 18+ messages in thread
From: Cezary Rojewski @ 2026-06-02 9:04 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: broonie, tiwai, perex, amade, linux-sound
On 6/2/2026 10:57 AM, Andy Shevchenko wrote:
> On Mon, Jun 01, 2026 at 04:10:31PM +0200, Cezary Rojewski wrote:
>> Fix alignment and drop redundant comments.
>
> ...
>
>> static const struct snd_kcontrol_new component_kcontrols[] = {
>> -/* Master volume (mixer stream) */
>> -CATPT_VOLUME_CTL("Master Playback Volume", MIXER),
>> -/* Individual volume controls for offload and capture */
>> -CATPT_VOLUME_CTL("Media0 Playback Volume", OFFLOAD1),
>> -CATPT_VOLUME_CTL("Media1 Playback Volume", OFFLOAD2),
>> -CATPT_VOLUME_CTL("Mic Capture Volume", CAPTURE1),
>> -SOC_SINGLE_BOOL_EXT("Loopback Mute", (unsigned long)&(bool[1]) {0},
>> - catpt_loopback_mute_get, catpt_loopback_mute_put),
>> + CATPT_VOLUME_CTL("Master Playback Volume", MIXER),
>> + CATPT_VOLUME_CTL("Media0 Playback Volume", OFFLOAD1),
>> + CATPT_VOLUME_CTL("Media1 Playback Volume", OFFLOAD2),
>> + CATPT_VOLUME_CTL("Mic Capture Volume", CAPTURE1),
>> + SOC_SINGLE_BOOL_EXT("Loopback Mute", (unsigned long)&(bool[1]) {0},
>
> While at it, can't we simply do outside of this initialiser something like
>
> static bool loopback_mute;
>
> and here
>
> SOC_SINGLE_BOOL_EXT("Loopback Mute", (unsigned long)&loopback_mute,
Hmm.. not a bad idea though the loopback_mute static would never be
referred to. All the functions obtain the values with
kctl->private_value and I'd like things to state that way.
>> + catpt_loopback_mute_get, catpt_loopback_mute_put),
>> };
>
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2026-06-02 9:04 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-01 14:10 [PATCH 0/7] ASoC: Intel: catpt: Code cleanup Cezary Rojewski
2026-06-01 14:10 ` [PATCH 1/7] ASoC: Intel: catpt: Utilize lock-guard helper Cezary Rojewski
2026-06-02 8:51 ` Andy Shevchenko
2026-06-01 14:10 ` [PATCH 2/7] ASoC: Intel: catpt: Replace RAM-helpers with resource_xxx() Cezary Rojewski
2026-06-01 18:57 ` Mark Brown
2026-06-01 20:02 ` Cezary Rojewski
2026-06-01 14:10 ` [PATCH 3/7] ASoC: Intel: catpt: Simplify the RAM-navigation code Cezary Rojewski
2026-06-01 14:10 ` [PATCH 4/7] ASoC: Intel: catpt: Simplify catpt_stream_find() Cezary Rojewski
2026-06-02 8:53 ` Andy Shevchenko
2026-06-02 8:59 ` Cezary Rojewski
2026-06-01 14:10 ` [PATCH 5/7] ASoC: Intel: catpt: Remove unused WAVES controls Cezary Rojewski
2026-06-02 8:54 ` Andy Shevchenko
2026-06-02 9:01 ` Cezary Rojewski
2026-06-01 14:10 ` [PATCH 6/7] ASoC: Intel: catpt: Drop manipulation of the obsolete direction flag Cezary Rojewski
2026-06-01 14:10 ` [PATCH 7/7] ASoC: Intel: catpt: Cleanup components_kcontrols[] Cezary Rojewski
2026-06-02 8:57 ` Andy Shevchenko
2026-06-02 9:04 ` Cezary Rojewski
2026-06-02 8:58 ` [PATCH 0/7] ASoC: Intel: catpt: Code cleanup Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox