diff --git a/Documentation/devicetree/bindings/soundwire/qcom,soundwire.yaml b/Documentation/devicetree/bindings/soundwire/qcom,soundwire.yaml index 9447a2f371b5..8e6973fa229c 100644 --- a/Documentation/devicetree/bindings/soundwire/qcom,soundwire.yaml +++ b/Documentation/devicetree/bindings/soundwire/qcom,soundwire.yaml @@ -90,7 +90,7 @@ properties: or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. minItems: 3 - maxItems: 16 + maxItems: 17 qcom,ports-sinterval-low: $ref: /schemas/types.yaml#/definitions/uint8-array @@ -101,7 +101,7 @@ properties: or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. minItems: 3 - maxItems: 16 + maxItems: 17 qcom,ports-sinterval: $ref: /schemas/types.yaml#/definitions/uint16-array @@ -112,7 +112,7 @@ properties: or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. minItems: 3 - maxItems: 16 + maxItems: 17 qcom,ports-offset1: $ref: /schemas/types.yaml#/definitions/uint8-array @@ -123,7 +123,7 @@ properties: or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. minItems: 3 - maxItems: 16 + maxItems: 17 qcom,ports-offset2: $ref: /schemas/types.yaml#/definitions/uint8-array @@ -134,7 +134,7 @@ properties: or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. minItems: 3 - maxItems: 16 + maxItems: 17 qcom,ports-lane-control: $ref: /schemas/types.yaml#/definitions/uint8-array @@ -145,7 +145,7 @@ properties: or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. minItems: 3 - maxItems: 16 + maxItems: 17 qcom,ports-block-pack-mode: $ref: /schemas/types.yaml#/definitions/uint8-array @@ -158,7 +158,7 @@ properties: or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. minItems: 3 - maxItems: 16 + maxItems: 17 items: oneOf: - minimum: 0 @@ -175,7 +175,7 @@ properties: or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. minItems: 3 - maxItems: 16 + maxItems: 17 items: oneOf: - minimum: 0 @@ -192,7 +192,7 @@ properties: or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. minItems: 3 - maxItems: 16 + maxItems: 17 items: oneOf: - minimum: 0 @@ -208,7 +208,7 @@ properties: or applicable for the respective data port. More info in MIPI Alliance SoundWire 1.0 Specifications. minItems: 3 - maxItems: 16 + maxItems: 17 items: oneOf: - minimum: 0 diff --git a/drivers/soundwire/bus.h b/drivers/soundwire/bus.h index 8115c64dd48e..44e4f5193917 100644 --- a/drivers/soundwire/bus.h +++ b/drivers/soundwire/bus.h @@ -73,7 +73,7 @@ struct sdw_msg { }; /** - * struct sdw_btp_section - Message section structure + * struct sdw_bpt_section - Message section structure * @addr: Start Register address accessed in the Slave * @len: number of bytes to transfer. More than 64Kb can be transferred * but a practical limit of SDW_BPT_MSG_MAX_BYTES is enforced. @@ -87,7 +87,7 @@ struct sdw_bpt_section { }; /** - * struct sdw_btp_msg - Message structure + * struct sdw_bpt_msg - Message structure * @sec: Pointer to array of sections * @sections: Number of sections in the array * @dev_num: Slave device number @@ -110,7 +110,7 @@ int sdw_find_row_index(int row); int sdw_find_col_index(int col); /** - * sdw_port_runtime: Runtime port parameters for Master or Slave + * struct sdw_port_runtime - Runtime port parameters for Master or Slave * * @num: Port number. For audio streams, valid port number ranges from * [1,14] @@ -133,7 +133,7 @@ struct sdw_port_runtime { }; /** - * sdw_slave_runtime: Runtime Stream parameters for Slave + * struct sdw_slave_runtime - Runtime Stream parameters for Slave * * @slave: Slave handle * @direction: Data direction for Slave @@ -151,7 +151,7 @@ struct sdw_slave_runtime { }; /** - * sdw_master_runtime: Runtime stream parameters for Master + * struct sdw_master_runtime - Runtime stream parameters for Master * * @bus: Bus handle * @stream: Stream runtime handle diff --git a/drivers/soundwire/dmi-quirks.c b/drivers/soundwire/dmi-quirks.c index 32a46a2d90f7..62cee6e2179d 100644 --- a/drivers/soundwire/dmi-quirks.c +++ b/drivers/soundwire/dmi-quirks.c @@ -15,6 +15,14 @@ struct adr_remap { u64 remapped_adr; }; +static const struct adr_remap global_ghost_adr[] = { + { + 0x000000D010010500ull, + 0x0000000000000000ull + }, + {} +}; + /* * Some TigerLake devices based on an initial Intel BIOS do not expose * the correct _ADR in the DSDT. @@ -178,6 +186,13 @@ static const struct dmi_system_id adr_remap_quirk_table[] = { .driver_data = (void *)hp_omen_16, }, /* PTL devices */ + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUS"), + DMI_MATCH(DMI_BOARD_NAME, "B9406CAA"), + }, + .driver_data = (void *)ghost_realtek, + }, { .matches = { DMI_MATCH(DMI_SYS_VENDOR, "ASUS"), @@ -205,6 +220,7 @@ static const struct dmi_system_id adr_remap_quirk_table[] = { u64 sdw_dmi_override_adr(struct sdw_bus *bus, u64 addr) { const struct dmi_system_id *dmi_id; + int i; /* check if any address remap quirk applies */ dmi_id = dmi_first_match(adr_remap_quirk_table); @@ -216,10 +232,20 @@ u64 sdw_dmi_override_adr(struct sdw_bus *bus, u64 addr) dev_dbg(bus->dev, "remapped _ADR 0x%llx as 0x%llx\n", addr, map->remapped_adr); addr = map->remapped_adr; - break; + goto out; } } } + /* remap the ghost ADRs */ + for (i = 0; i < ARRAY_SIZE(global_ghost_adr); i++) { + if (global_ghost_adr[i].adr == addr) { + dev_dbg(bus->dev, "remapped _ADR 0x%llx as 0x%llx\n", + addr, global_ghost_adr[i].remapped_adr); + addr = global_ghost_adr[i].remapped_adr; + break; + } + } +out: return addr; } diff --git a/drivers/soundwire/intel_auxdevice.c b/drivers/soundwire/intel_auxdevice.c index 0b8107bec9ab..a8407560bf4f 100644 --- a/drivers/soundwire/intel_auxdevice.c +++ b/drivers/soundwire/intel_auxdevice.c @@ -54,6 +54,7 @@ static struct wake_capable_part wake_capable_list[] = { {0x01fa, 0x2A30}, {0x01fa, 0x2A3B}, {0x01fa, 0x4243}, + {0x01fa, 0x4244}, {0x01fa, 0x4245}, {0x01fa, 0x4249}, {0x01fa, 0x4747}, diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c index 3d8f5a81eff1..3562802f4204 100644 --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -134,7 +134,6 @@ #define TIMEOUT_MS 100 #define QCOM_SWRM_MAX_RD_LEN 0x1 #define DEFAULT_CLK_FREQ 9600000 -#define SWRM_MAX_DAIS 0xF #define SWR_INVALID_PARAM 0xFF #define SWR_HSTOP_MAX_VAL 0xF #define SWR_HSTART_MIN_VAL 0x0 @@ -215,7 +214,7 @@ struct qcom_swrm_ctrl { u8 wcmd_id; /* Port numbers are 1 - 14 */ struct qcom_swrm_port_config *pconfig; - struct sdw_stream_runtime *sruntime[SWRM_MAX_DAIS]; + struct sdw_stream_runtime **sruntime; enum sdw_slave_status status[SDW_MAX_DEVICES + 1]; int (*reg_read)(struct qcom_swrm_ctrl *ctrl, int reg, u32 *val); int (*reg_write)(struct qcom_swrm_ctrl *ctrl, int reg, int val); @@ -976,6 +975,20 @@ static enum sdw_command_response qcom_swrm_xfer_msg(struct sdw_bus *bus, struct qcom_swrm_ctrl *ctrl = to_qcom_sdw(bus); int ret, i, len; + if (msg->page) { + ret = qcom_swrm_cmd_fifo_wr_cmd(ctrl, msg->addr_page1, + msg->dev_num, + SDW_SCP_ADDRPAGE1); + if (ret) + return ret; + + ret = qcom_swrm_cmd_fifo_wr_cmd(ctrl, msg->addr_page2, + msg->dev_num, + SDW_SCP_ADDRPAGE2); + if (ret) + return ret; + } + if (msg->flags == SDW_MSG_FLAG_READ) { for (i = 0; i < msg->len;) { len = min(msg->len - i, QCOM_SWRM_MAX_RD_LEN); @@ -1271,7 +1284,7 @@ static int qcom_swrm_stream_alloc_ports(struct qcom_swrm_ctrl *ctrl, else pn = find_first_zero_bit(port_mask, maxport); - if (pn > maxport) { + if (pn >= maxport) { dev_err(ctrl->dev, "All ports busy\n"); return -EBUSY; } @@ -1384,6 +1397,10 @@ static int qcom_swrm_register_dais(struct qcom_swrm_ctrl *ctrl) struct device *dev = ctrl->dev; int i; + ctrl->sruntime = devm_kcalloc(dev, num_dais, sizeof(*ctrl->sruntime), GFP_KERNEL); + if (!ctrl->sruntime) + return -ENOMEM; + /* PDM dais are only tested for now */ dais = devm_kcalloc(dev, num_dais, sizeof(*dais), GFP_KERNEL); if (!dais)