Skip to content

Commit 3b0b441

Browse files
plbossartvinodkoul
authored andcommitted
soundwire: intel_ace2x: use DOAIS and DODS settings from firmware
Starting with LNL, the recommendation is to use settings read from DSD properties instead of hard-coding the values. The DOAIS and DODS values are completely-specific to Intel and are stored in a vendor-specific property structure. Signed-off-by: Pierre-Louis Bossart <[email protected]> Signed-off-by: Bard Liao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 8096248 commit 3b0b441

File tree

4 files changed

+33
-2
lines changed

4 files changed

+33
-2
lines changed

drivers/soundwire/intel.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ struct sdw_intel {
5858
#endif
5959
};
6060

61+
struct sdw_intel_prop {
62+
u16 doais;
63+
u16 dods;
64+
};
65+
6166
enum intel_pdi_type {
6267
INTEL_PDI_IN = 0,
6368
INTEL_PDI_OUT = 1,

drivers/soundwire/intel_ace2x.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@
2525
static void intel_shim_vs_init(struct sdw_intel *sdw)
2626
{
2727
void __iomem *shim_vs = sdw->link_res->shim_vs;
28+
struct sdw_bus *bus = &sdw->cdns.bus;
29+
struct sdw_intel_prop *intel_prop;
2830
u16 doais;
2931
u16 dods;
3032
u16 act;
3133

32-
doais = 0x3;
33-
dods = 0x1;
34+
intel_prop = bus->vendor_specific_prop;
35+
doais = intel_prop->doais;
36+
dods = intel_prop->dods;
3437

3538
act = intel_readw(shim_vs, SDW_SHIM2_INTEL_VS_ACTMCTL);
3639
u16p_replace_bits(&act, doais, SDW_SHIM2_INTEL_VS_ACTMCTL_DOAIS);

drivers/soundwire/intel_auxdevice.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ static void generic_new_peripheral_assigned(struct sdw_bus *bus,
122122
static int sdw_master_read_intel_prop(struct sdw_bus *bus)
123123
{
124124
struct sdw_master_prop *prop = &bus->prop;
125+
struct sdw_intel_prop *intel_prop;
125126
struct fwnode_handle *link;
126127
char name[32];
127128
u32 quirk_mask;
@@ -153,6 +154,26 @@ static int sdw_master_read_intel_prop(struct sdw_bus *bus)
153154
prop->quirks = SDW_MASTER_QUIRKS_CLEAR_INITIAL_CLASH |
154155
SDW_MASTER_QUIRKS_CLEAR_INITIAL_PARITY;
155156

157+
intel_prop = devm_kzalloc(bus->dev, sizeof(*intel_prop), GFP_KERNEL);
158+
if (!intel_prop)
159+
return -ENOMEM;
160+
161+
/* initialize with hardware defaults, in case the properties are not found */
162+
intel_prop->doais = 0x3;
163+
intel_prop->dods = 0x1;
164+
165+
fwnode_property_read_u16(link,
166+
"intel-sdw-doais",
167+
&intel_prop->doais);
168+
fwnode_property_read_u16(link,
169+
"intel-sdw-dods",
170+
&intel_prop->dods);
171+
bus->vendor_specific_prop = intel_prop;
172+
173+
dev_dbg(bus->dev, "doais %#x dods %#x\n",
174+
intel_prop->doais,
175+
intel_prop->dods);
176+
156177
return 0;
157178
}
158179

include/linux/soundwire/sdw.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,7 @@ struct sdw_master_ops {
886886
* @port_ops: Master port callback ops
887887
* @params: Current bus parameters
888888
* @prop: Master properties
889+
* @vendor_specific_prop: pointer to non-standard properties
889890
* @m_rt_list: List of Master instance of all stream(s) running on Bus. This
890891
* is used to compute and program bus bandwidth, clock, frame shape,
891892
* transport and port parameters
@@ -920,6 +921,7 @@ struct sdw_bus {
920921
const struct sdw_master_port_ops *port_ops;
921922
struct sdw_bus_params params;
922923
struct sdw_master_prop prop;
924+
void *vendor_specific_prop;
923925
struct list_head m_rt_list;
924926
#ifdef CONFIG_DEBUG_FS
925927
struct dentry *debugfs;

0 commit comments

Comments
 (0)