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 <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20240429004321.2399754-3-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
Pierre-Louis Bossart 2024-04-29 00:43:19 +00:00 committed by Vinod Koul
parent 80962485f6
commit 3b0b441a29
4 changed files with 33 additions and 2 deletions

View file

@ -58,6 +58,11 @@ struct sdw_intel {
#endif #endif
}; };
struct sdw_intel_prop {
u16 doais;
u16 dods;
};
enum intel_pdi_type { enum intel_pdi_type {
INTEL_PDI_IN = 0, INTEL_PDI_IN = 0,
INTEL_PDI_OUT = 1, INTEL_PDI_OUT = 1,

View file

@ -25,12 +25,15 @@
static void intel_shim_vs_init(struct sdw_intel *sdw) static void intel_shim_vs_init(struct sdw_intel *sdw)
{ {
void __iomem *shim_vs = sdw->link_res->shim_vs; void __iomem *shim_vs = sdw->link_res->shim_vs;
struct sdw_bus *bus = &sdw->cdns.bus;
struct sdw_intel_prop *intel_prop;
u16 doais; u16 doais;
u16 dods; u16 dods;
u16 act; u16 act;
doais = 0x3; intel_prop = bus->vendor_specific_prop;
dods = 0x1; doais = intel_prop->doais;
dods = intel_prop->dods;
act = intel_readw(shim_vs, SDW_SHIM2_INTEL_VS_ACTMCTL); act = intel_readw(shim_vs, SDW_SHIM2_INTEL_VS_ACTMCTL);
u16p_replace_bits(&act, doais, SDW_SHIM2_INTEL_VS_ACTMCTL_DOAIS); u16p_replace_bits(&act, doais, SDW_SHIM2_INTEL_VS_ACTMCTL_DOAIS);

View file

@ -122,6 +122,7 @@ static void generic_new_peripheral_assigned(struct sdw_bus *bus,
static int sdw_master_read_intel_prop(struct sdw_bus *bus) static int sdw_master_read_intel_prop(struct sdw_bus *bus)
{ {
struct sdw_master_prop *prop = &bus->prop; struct sdw_master_prop *prop = &bus->prop;
struct sdw_intel_prop *intel_prop;
struct fwnode_handle *link; struct fwnode_handle *link;
char name[32]; char name[32];
u32 quirk_mask; u32 quirk_mask;
@ -153,6 +154,26 @@ static int sdw_master_read_intel_prop(struct sdw_bus *bus)
prop->quirks = SDW_MASTER_QUIRKS_CLEAR_INITIAL_CLASH | prop->quirks = SDW_MASTER_QUIRKS_CLEAR_INITIAL_CLASH |
SDW_MASTER_QUIRKS_CLEAR_INITIAL_PARITY; SDW_MASTER_QUIRKS_CLEAR_INITIAL_PARITY;
intel_prop = devm_kzalloc(bus->dev, sizeof(*intel_prop), GFP_KERNEL);
if (!intel_prop)
return -ENOMEM;
/* initialize with hardware defaults, in case the properties are not found */
intel_prop->doais = 0x3;
intel_prop->dods = 0x1;
fwnode_property_read_u16(link,
"intel-sdw-doais",
&intel_prop->doais);
fwnode_property_read_u16(link,
"intel-sdw-dods",
&intel_prop->dods);
bus->vendor_specific_prop = intel_prop;
dev_dbg(bus->dev, "doais %#x dods %#x\n",
intel_prop->doais,
intel_prop->dods);
return 0; return 0;
} }

View file

@ -886,6 +886,7 @@ struct sdw_master_ops {
* @port_ops: Master port callback ops * @port_ops: Master port callback ops
* @params: Current bus parameters * @params: Current bus parameters
* @prop: Master properties * @prop: Master properties
* @vendor_specific_prop: pointer to non-standard properties
* @m_rt_list: List of Master instance of all stream(s) running on Bus. This * @m_rt_list: List of Master instance of all stream(s) running on Bus. This
* is used to compute and program bus bandwidth, clock, frame shape, * is used to compute and program bus bandwidth, clock, frame shape,
* transport and port parameters * transport and port parameters
@ -920,6 +921,7 @@ struct sdw_bus {
const struct sdw_master_port_ops *port_ops; const struct sdw_master_port_ops *port_ops;
struct sdw_bus_params params; struct sdw_bus_params params;
struct sdw_master_prop prop; struct sdw_master_prop prop;
void *vendor_specific_prop;
struct list_head m_rt_list; struct list_head m_rt_list;
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
struct dentry *debugfs; struct dentry *debugfs;