Commit 595fa4e3 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'soundwire-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire

Pull soundwire updates from Vinod Koul:
 "This is a small update which features a bit of core changes and driver
  updates in Intel and cadence driver.

  Core:

   - sdw_transfer_defer() API change to drop an argument

   - Reset page address rework

   - Export sdw_nwrite_no_pm and sdw_nread_no_pm APIs

  Drivers:

   - Cadence and related intel driver updates for FIFO handling and low
     level msg transfers"

* tag 'soundwire-6.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire:
  soundwire: cadence: further simplify low-level xfer_msg_defer() callback
  soundwire: cadence: use directly bus sdw_defer structure
  soundwire: bus: remove sdw_defer argument in sdw_transfer_defer()
  soundwire: stream: use consistent pattern for freeing buffers
  soundwire: bus: Remove unused reset_page_addr() callback
  soundwire: bus: Don't zero page registers after every transaction
  soundwire: bus_type: Avoid lockdep assert in sdw_drv_probe()
  soundwire: stream: Move remaining register accesses over to no_pm
  soundwire: debugfs: Switch to sdw_read_no_pm
  soundwire: Provide build stubs for common functions
  soundwire: bus: export sdw_nwrite_no_pm and sdw_nread_no_pm functions
  soundwire: cadence: remove unused sdw_cdns_master_ops declaration
  soundwire: enable optional clock registers for SoundWire 1.2 devices
  ASoC/soundwire: remove is_sdca boolean property
  soundwire: cadence: Drain the RX FIFO after an IO timeout
  soundwire: cadence: Remove wasted space in response_buf
  soundwire: cadence: Don't overflow the command FIFOs
  soundwire: intel: remove DAI startup/shutdown
parents 8ff99ad0 66f95de7
...@@ -225,9 +225,9 @@ static inline int do_transfer(struct sdw_bus *bus, struct sdw_msg *msg) ...@@ -225,9 +225,9 @@ static inline int do_transfer(struct sdw_bus *bus, struct sdw_msg *msg)
} }
static inline int do_transfer_defer(struct sdw_bus *bus, static inline int do_transfer_defer(struct sdw_bus *bus,
struct sdw_msg *msg, struct sdw_msg *msg)
struct sdw_defer *defer)
{ {
struct sdw_defer *defer = &bus->defer_msg;
int retry = bus->prop.err_threshold; int retry = bus->prop.err_threshold;
enum sdw_command_response resp; enum sdw_command_response resp;
int ret = 0, i; int ret = 0, i;
...@@ -237,24 +237,7 @@ static inline int do_transfer_defer(struct sdw_bus *bus, ...@@ -237,24 +237,7 @@ static inline int do_transfer_defer(struct sdw_bus *bus,
init_completion(&defer->complete); init_completion(&defer->complete);
for (i = 0; i <= retry; i++) { for (i = 0; i <= retry; i++) {
resp = bus->ops->xfer_msg_defer(bus, msg, defer); resp = bus->ops->xfer_msg_defer(bus);
ret = find_response_code(resp);
/* if cmd is ok or ignored return */
if (ret == 0 || ret == -ENODATA)
return ret;
}
return ret;
}
static int sdw_reset_page(struct sdw_bus *bus, u16 dev_num)
{
int retry = bus->prop.err_threshold;
enum sdw_command_response resp;
int ret = 0, i;
for (i = 0; i <= retry; i++) {
resp = bus->ops->reset_page_addr(bus, dev_num);
ret = find_response_code(resp); ret = find_response_code(resp);
/* if cmd is ok or ignored return */ /* if cmd is ok or ignored return */
if (ret == 0 || ret == -ENODATA) if (ret == 0 || ret == -ENODATA)
...@@ -275,9 +258,6 @@ static int sdw_transfer_unlocked(struct sdw_bus *bus, struct sdw_msg *msg) ...@@ -275,9 +258,6 @@ static int sdw_transfer_unlocked(struct sdw_bus *bus, struct sdw_msg *msg)
(msg->flags & SDW_MSG_FLAG_WRITE) ? "write" : "read", (msg->flags & SDW_MSG_FLAG_WRITE) ? "write" : "read",
msg->addr, msg->len); msg->addr, msg->len);
if (msg->page)
sdw_reset_page(bus, msg->dev_num);
return ret; return ret;
} }
...@@ -335,26 +315,21 @@ EXPORT_SYMBOL(sdw_show_ping_status); ...@@ -335,26 +315,21 @@ EXPORT_SYMBOL(sdw_show_ping_status);
* sdw_transfer_defer() - Asynchronously transfer message to a SDW Slave device * sdw_transfer_defer() - Asynchronously transfer message to a SDW Slave device
* @bus: SDW bus * @bus: SDW bus
* @msg: SDW message to be xfered * @msg: SDW message to be xfered
* @defer: Defer block for signal completion
* *
* Caller needs to hold the msg_lock lock while calling this * Caller needs to hold the msg_lock lock while calling this
*/ */
int sdw_transfer_defer(struct sdw_bus *bus, struct sdw_msg *msg, int sdw_transfer_defer(struct sdw_bus *bus, struct sdw_msg *msg)
struct sdw_defer *defer)
{ {
int ret; int ret;
if (!bus->ops->xfer_msg_defer) if (!bus->ops->xfer_msg_defer)
return -ENOTSUPP; return -ENOTSUPP;
ret = do_transfer_defer(bus, msg, defer); ret = do_transfer_defer(bus, msg);
if (ret != 0 && ret != -ENODATA) if (ret != 0 && ret != -ENODATA)
dev_err(bus->dev, "Defer trf on Slave %d failed:%d\n", dev_err(bus->dev, "Defer trf on Slave %d failed:%d\n",
msg->dev_num, ret); msg->dev_num, ret);
if (msg->page)
sdw_reset_page(bus, msg->dev_num);
return ret; return ret;
} }
...@@ -414,8 +389,7 @@ int sdw_fill_msg(struct sdw_msg *msg, struct sdw_slave *slave, ...@@ -414,8 +389,7 @@ int sdw_fill_msg(struct sdw_msg *msg, struct sdw_slave *slave,
* all clients need to use the pm versions * all clients need to use the pm versions
*/ */
static int int sdw_nread_no_pm(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
sdw_nread_no_pm(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
{ {
struct sdw_msg msg; struct sdw_msg msg;
int ret; int ret;
...@@ -430,9 +404,9 @@ sdw_nread_no_pm(struct sdw_slave *slave, u32 addr, size_t count, u8 *val) ...@@ -430,9 +404,9 @@ sdw_nread_no_pm(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
ret = 0; ret = 0;
return ret; return ret;
} }
EXPORT_SYMBOL(sdw_nread_no_pm);
static int int sdw_nwrite_no_pm(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val)
sdw_nwrite_no_pm(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val)
{ {
struct sdw_msg msg; struct sdw_msg msg;
int ret; int ret;
...@@ -447,6 +421,7 @@ sdw_nwrite_no_pm(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val) ...@@ -447,6 +421,7 @@ sdw_nwrite_no_pm(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val)
ret = 0; ret = 0;
return ret; return ret;
} }
EXPORT_SYMBOL(sdw_nwrite_no_pm);
int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value) int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value)
{ {
...@@ -1214,7 +1189,7 @@ int sdw_configure_dpn_intr(struct sdw_slave *slave, ...@@ -1214,7 +1189,7 @@ int sdw_configure_dpn_intr(struct sdw_slave *slave,
val &= ~SDW_DPN_INT_PORT_READY; val &= ~SDW_DPN_INT_PORT_READY;
} }
ret = sdw_update(slave, addr, (mask | SDW_DPN_INT_PORT_READY), val); ret = sdw_update_no_pm(slave, addr, (mask | SDW_DPN_INT_PORT_READY), val);
if (ret < 0) if (ret < 0)
dev_err(&slave->dev, dev_err(&slave->dev,
"SDW_DPN_INTMASK write failed:%d\n", val); "SDW_DPN_INTMASK write failed:%d\n", val);
...@@ -1233,10 +1208,11 @@ static int sdw_slave_set_frequency(struct sdw_slave *slave) ...@@ -1233,10 +1208,11 @@ static int sdw_slave_set_frequency(struct sdw_slave *slave)
/* /*
* frequency base and scale registers are required for SDCA * frequency base and scale registers are required for SDCA
* devices. They may also be used for 1.2+/non-SDCA devices, * devices. They may also be used for 1.2+/non-SDCA devices.
* but we will need a DisCo property to cover this case * Driver can set the property, we will need a DisCo property
* to discover this case from platform firmware.
*/ */
if (!slave->id.class_id) if (!slave->id.class_id && !slave->prop.clock_reg_supported)
return 0; return 0;
if (!mclk_freq) { if (!mclk_freq) {
...@@ -1587,7 +1563,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) ...@@ -1587,7 +1563,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
goto io_err; goto io_err;
} }
if (slave->prop.is_sdca) { if (slave->id.class_id) {
ret = sdw_read_no_pm(slave, SDW_DP0_INT); ret = sdw_read_no_pm(slave, SDW_DP0_INT);
if (ret < 0) { if (ret < 0) {
dev_err(&slave->dev, dev_err(&slave->dev,
...@@ -1724,7 +1700,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave) ...@@ -1724,7 +1700,7 @@ static int sdw_handle_slave_alerts(struct sdw_slave *slave)
goto io_err; goto io_err;
} }
if (slave->prop.is_sdca) { if (slave->id.class_id) {
ret = sdw_read_no_pm(slave, SDW_DP0_INT); ret = sdw_read_no_pm(slave, SDW_DP0_INT);
if (ret < 0) { if (ret < 0) {
dev_err(&slave->dev, dev_err(&slave->dev,
......
...@@ -151,8 +151,7 @@ int sdw_configure_dpn_intr(struct sdw_slave *slave, int port, ...@@ -151,8 +151,7 @@ int sdw_configure_dpn_intr(struct sdw_slave *slave, int port,
bool enable, int mask); bool enable, int mask);
int sdw_transfer(struct sdw_bus *bus, struct sdw_msg *msg); int sdw_transfer(struct sdw_bus *bus, struct sdw_msg *msg);
int sdw_transfer_defer(struct sdw_bus *bus, struct sdw_msg *msg, int sdw_transfer_defer(struct sdw_bus *bus, struct sdw_msg *msg);
struct sdw_defer *defer);
#define SDW_READ_INTR_CLEAR_RETRY 10 #define SDW_READ_INTR_CLEAR_RETRY 10
......
...@@ -105,20 +105,19 @@ static int sdw_drv_probe(struct device *dev) ...@@ -105,20 +105,19 @@ static int sdw_drv_probe(struct device *dev)
if (ret) if (ret)
return ret; return ret;
mutex_lock(&slave->sdw_dev_lock);
ret = drv->probe(slave, id); ret = drv->probe(slave, id);
if (ret) { if (ret) {
name = drv->name; name = drv->name;
if (!name) if (!name)
name = drv->driver.name; name = drv->driver.name;
mutex_unlock(&slave->sdw_dev_lock);
dev_err(dev, "Probe of %s failed: %d\n", name, ret); dev_err(dev, "Probe of %s failed: %d\n", name, ret);
dev_pm_domain_detach(dev, false); dev_pm_domain_detach(dev, false);
return ret; return ret;
} }
mutex_lock(&slave->sdw_dev_lock);
/* device is probed so let's read the properties now */ /* device is probed so let's read the properties now */
if (drv->ops && drv->ops->read_prop) if (drv->ops && drv->ops->read_prop)
drv->ops->read_prop(slave); drv->ops->read_prop(slave);
...@@ -167,14 +166,12 @@ static int sdw_drv_remove(struct device *dev) ...@@ -167,14 +166,12 @@ static int sdw_drv_remove(struct device *dev)
int ret = 0; int ret = 0;
mutex_lock(&slave->sdw_dev_lock); mutex_lock(&slave->sdw_dev_lock);
slave->probed = false; slave->probed = false;
mutex_unlock(&slave->sdw_dev_lock);
if (drv->remove) if (drv->remove)
ret = drv->remove(slave); ret = drv->remove(slave);
mutex_unlock(&slave->sdw_dev_lock);
dev_pm_domain_detach(dev, false); dev_pm_domain_detach(dev, false);
return ret; return ret;
......
...@@ -127,7 +127,8 @@ MODULE_PARM_DESC(cdns_mcp_int_mask, "Cadence MCP IntMask"); ...@@ -127,7 +127,8 @@ MODULE_PARM_DESC(cdns_mcp_int_mask, "Cadence MCP IntMask");
#define CDNS_MCP_CMD_BASE 0x80 #define CDNS_MCP_CMD_BASE 0x80
#define CDNS_MCP_RESP_BASE 0x80 #define CDNS_MCP_RESP_BASE 0x80
#define CDNS_MCP_CMD_LEN 0x20 /* FIFO can hold 8 commands */
#define CDNS_MCP_CMD_LEN 8
#define CDNS_MCP_CMD_WORD_LEN 0x4 #define CDNS_MCP_CMD_WORD_LEN 0x4
#define CDNS_MCP_CMD_SSP_TAG BIT(31) #define CDNS_MCP_CMD_SSP_TAG BIT(31)
...@@ -554,6 +555,29 @@ cdns_fill_msg_resp(struct sdw_cdns *cdns, ...@@ -554,6 +555,29 @@ cdns_fill_msg_resp(struct sdw_cdns *cdns,
return SDW_CMD_OK; return SDW_CMD_OK;
} }
static void cdns_read_response(struct sdw_cdns *cdns)
{
u32 num_resp, cmd_base;
int i;
/* RX_FIFO_AVAIL can be 2 entries more than the FIFO size */
BUILD_BUG_ON(ARRAY_SIZE(cdns->response_buf) < CDNS_MCP_CMD_LEN + 2);
num_resp = cdns_readl(cdns, CDNS_MCP_FIFOSTAT);
num_resp &= CDNS_MCP_RX_FIFO_AVAIL;
if (num_resp > ARRAY_SIZE(cdns->response_buf)) {
dev_warn(cdns->dev, "RX AVAIL %d too long\n", num_resp);
num_resp = ARRAY_SIZE(cdns->response_buf);
}
cmd_base = CDNS_MCP_CMD_BASE;
for (i = 0; i < num_resp; i++) {
cdns->response_buf[i] = cdns_readl(cdns, cmd_base);
cmd_base += CDNS_MCP_CMD_WORD_LEN;
}
}
static enum sdw_command_response static enum sdw_command_response
_cdns_xfer_msg(struct sdw_cdns *cdns, struct sdw_msg *msg, int cmd, _cdns_xfer_msg(struct sdw_cdns *cdns, struct sdw_msg *msg, int cmd,
int offset, int count, bool defer) int offset, int count, bool defer)
...@@ -595,6 +619,10 @@ _cdns_xfer_msg(struct sdw_cdns *cdns, struct sdw_msg *msg, int cmd, ...@@ -595,6 +619,10 @@ _cdns_xfer_msg(struct sdw_cdns *cdns, struct sdw_msg *msg, int cmd,
dev_err(cdns->dev, "IO transfer timed out, cmd %d device %d addr %x len %d\n", dev_err(cdns->dev, "IO transfer timed out, cmd %d device %d addr %x len %d\n",
cmd, msg->dev_num, msg->addr, msg->len); cmd, msg->dev_num, msg->addr, msg->len);
msg->len = 0; msg->len = 0;
/* Drain anything in the RX_FIFO */
cdns_read_response(cdns);
return SDW_CMD_TIMEOUT; return SDW_CMD_TIMEOUT;
} }
...@@ -721,10 +749,11 @@ cdns_xfer_msg(struct sdw_bus *bus, struct sdw_msg *msg) ...@@ -721,10 +749,11 @@ cdns_xfer_msg(struct sdw_bus *bus, struct sdw_msg *msg)
EXPORT_SYMBOL(cdns_xfer_msg); EXPORT_SYMBOL(cdns_xfer_msg);
enum sdw_command_response enum sdw_command_response
cdns_xfer_msg_defer(struct sdw_bus *bus, cdns_xfer_msg_defer(struct sdw_bus *bus)
struct sdw_msg *msg, struct sdw_defer *defer)
{ {
struct sdw_cdns *cdns = bus_to_cdns(bus); struct sdw_cdns *cdns = bus_to_cdns(bus);
struct sdw_defer *defer = &bus->defer_msg;
struct sdw_msg *msg = defer->msg;
int cmd = 0, ret; int cmd = 0, ret;
/* for defer only 1 message is supported */ /* for defer only 1 message is supported */
...@@ -735,27 +764,10 @@ cdns_xfer_msg_defer(struct sdw_bus *bus, ...@@ -735,27 +764,10 @@ cdns_xfer_msg_defer(struct sdw_bus *bus,
if (ret) if (ret)
return SDW_CMD_FAIL_OTHER; return SDW_CMD_FAIL_OTHER;
cdns->defer = defer;
cdns->defer->length = msg->len;
return _cdns_xfer_msg(cdns, msg, cmd, 0, msg->len, true); return _cdns_xfer_msg(cdns, msg, cmd, 0, msg->len, true);
} }
EXPORT_SYMBOL(cdns_xfer_msg_defer); EXPORT_SYMBOL(cdns_xfer_msg_defer);
enum sdw_command_response
cdns_reset_page_addr(struct sdw_bus *bus, unsigned int dev_num)
{
struct sdw_cdns *cdns = bus_to_cdns(bus);
struct sdw_msg msg;
/* Create dummy message with valid device number */
memset(&msg, 0, sizeof(msg));
msg.dev_num = dev_num;
return cdns_program_scp_addr(cdns, &msg);
}
EXPORT_SYMBOL(cdns_reset_page_addr);
u32 cdns_read_ping_status(struct sdw_bus *bus) u32 cdns_read_ping_status(struct sdw_bus *bus)
{ {
struct sdw_cdns *cdns = bus_to_cdns(bus); struct sdw_cdns *cdns = bus_to_cdns(bus);
...@@ -768,22 +780,6 @@ EXPORT_SYMBOL(cdns_read_ping_status); ...@@ -768,22 +780,6 @@ EXPORT_SYMBOL(cdns_read_ping_status);
* IRQ handling * IRQ handling
*/ */
static void cdns_read_response(struct sdw_cdns *cdns)
{
u32 num_resp, cmd_base;
int i;
num_resp = cdns_readl(cdns, CDNS_MCP_FIFOSTAT);
num_resp &= CDNS_MCP_RX_FIFO_AVAIL;
cmd_base = CDNS_MCP_CMD_BASE;
for (i = 0; i < num_resp; i++) {
cdns->response_buf[i] = cdns_readl(cdns, cmd_base);
cmd_base += CDNS_MCP_CMD_WORD_LEN;
}
}
static int cdns_update_slave_status(struct sdw_cdns *cdns, static int cdns_update_slave_status(struct sdw_cdns *cdns,
u64 slave_intstat) u64 slave_intstat)
{ {
...@@ -881,13 +877,15 @@ irqreturn_t sdw_cdns_irq(int irq, void *dev_id) ...@@ -881,13 +877,15 @@ irqreturn_t sdw_cdns_irq(int irq, void *dev_id)
return IRQ_NONE; return IRQ_NONE;
if (int_status & CDNS_MCP_INT_RX_WL) { if (int_status & CDNS_MCP_INT_RX_WL) {
struct sdw_bus *bus = &cdns->bus;
struct sdw_defer *defer = &bus->defer_msg;
cdns_read_response(cdns); cdns_read_response(cdns);
if (cdns->defer) { if (defer && defer->msg) {
cdns_fill_msg_resp(cdns, cdns->defer->msg, cdns_fill_msg_resp(cdns, defer->msg,
cdns->defer->length, 0); defer->length, 0);
complete(&cdns->defer->complete); complete(&defer->complete);
cdns->defer = NULL;
} else { } else {
complete(&cdns->tx_complete); complete(&cdns->tx_complete);
} }
......
...@@ -8,6 +8,12 @@ ...@@ -8,6 +8,12 @@
#define SDW_CADENCE_GSYNC_KHZ 4 /* 4 kHz */ #define SDW_CADENCE_GSYNC_KHZ 4 /* 4 kHz */
#define SDW_CADENCE_GSYNC_HZ (SDW_CADENCE_GSYNC_KHZ * 1000) #define SDW_CADENCE_GSYNC_HZ (SDW_CADENCE_GSYNC_KHZ * 1000)
/*
* The Cadence IP supports up to 32 entries in the FIFO, though implementations
* can configure the IP to have a smaller FIFO.
*/
#define CDNS_MCP_IP_MAX_CMD_LEN 32
/** /**
* struct sdw_cdns_pdi: PDI (Physical Data Interface) instance * struct sdw_cdns_pdi: PDI (Physical Data Interface) instance
* *
...@@ -103,7 +109,6 @@ struct sdw_cdns_dai_runtime { ...@@ -103,7 +109,6 @@ struct sdw_cdns_dai_runtime {
* @instance: instance number * @instance: instance number
* @response_buf: SoundWire response buffer * @response_buf: SoundWire response buffer
* @tx_complete: Tx completion * @tx_complete: Tx completion
* @defer: Defer pointer
* @ports: Data ports * @ports: Data ports
* @num_ports: Total number of data ports * @num_ports: Total number of data ports
* @pcm: PCM streams * @pcm: PCM streams
...@@ -117,9 +122,13 @@ struct sdw_cdns { ...@@ -117,9 +122,13 @@ struct sdw_cdns {
struct sdw_bus bus; struct sdw_bus bus;
unsigned int instance; unsigned int instance;
u32 response_buf[0x80]; /*
* The datasheet says the RX FIFO AVAIL can be 2 entries more
* than the FIFO capacity, so allow for this.
*/
u32 response_buf[CDNS_MCP_IP_MAX_CMD_LEN + 2];
struct completion tx_complete; struct completion tx_complete;
struct sdw_defer *defer;
struct sdw_cdns_port *ports; struct sdw_cdns_port *ports;
int num_ports; int num_ports;
...@@ -147,7 +156,6 @@ struct sdw_cdns { ...@@ -147,7 +156,6 @@ struct sdw_cdns {
/* Exported symbols */ /* Exported symbols */
int sdw_cdns_probe(struct sdw_cdns *cdns); int sdw_cdns_probe(struct sdw_cdns *cdns);
extern struct sdw_master_ops sdw_cdns_master_ops;
irqreturn_t sdw_cdns_irq(int irq, void *dev_id); irqreturn_t sdw_cdns_irq(int irq, void *dev_id);
irqreturn_t sdw_cdns_thread(int irq, void *dev_id); irqreturn_t sdw_cdns_thread(int irq, void *dev_id);
...@@ -172,15 +180,11 @@ struct sdw_cdns_pdi *sdw_cdns_alloc_pdi(struct sdw_cdns *cdns, ...@@ -172,15 +180,11 @@ struct sdw_cdns_pdi *sdw_cdns_alloc_pdi(struct sdw_cdns *cdns,
void sdw_cdns_config_stream(struct sdw_cdns *cdns, void sdw_cdns_config_stream(struct sdw_cdns *cdns,
u32 ch, u32 dir, struct sdw_cdns_pdi *pdi); u32 ch, u32 dir, struct sdw_cdns_pdi *pdi);
enum sdw_command_response
cdns_reset_page_addr(struct sdw_bus *bus, unsigned int dev_num);
enum sdw_command_response enum sdw_command_response
cdns_xfer_msg(struct sdw_bus *bus, struct sdw_msg *msg); cdns_xfer_msg(struct sdw_bus *bus, struct sdw_msg *msg);
enum sdw_command_response enum sdw_command_response
cdns_xfer_msg_defer(struct sdw_bus *bus, cdns_xfer_msg_defer(struct sdw_bus *bus);
struct sdw_msg *msg, struct sdw_defer *defer);
u32 cdns_read_ping_status(struct sdw_bus *bus); u32 cdns_read_ping_status(struct sdw_bus *bus);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/soundwire/sdw.h> #include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_registers.h> #include <linux/soundwire/sdw_registers.h>
...@@ -35,7 +36,7 @@ static ssize_t sdw_sprintf(struct sdw_slave *slave, ...@@ -35,7 +36,7 @@ static ssize_t sdw_sprintf(struct sdw_slave *slave,
{ {
int value; int value;
value = sdw_read(slave, reg); value = sdw_read_no_pm(slave, reg);
if (value < 0) if (value < 0)
return scnprintf(buf + pos, RD_BUF - pos, "%3x\tXX\n", reg); return scnprintf(buf + pos, RD_BUF - pos, "%3x\tXX\n", reg);
...@@ -55,6 +56,12 @@ static int sdw_slave_reg_show(struct seq_file *s_file, void *data) ...@@ -55,6 +56,12 @@ static int sdw_slave_reg_show(struct seq_file *s_file, void *data)
if (!buf) if (!buf)
return -ENOMEM; return -ENOMEM;
ret = pm_runtime_resume_and_get(&slave->dev);
if (ret < 0 && ret != -EACCES) {
kfree(buf);
return ret;
}
ret = scnprintf(buf, RD_BUF, "Register Value\n"); ret = scnprintf(buf, RD_BUF, "Register Value\n");
/* DP0 non-banked registers */ /* DP0 non-banked registers */
...@@ -112,6 +119,10 @@ static int sdw_slave_reg_show(struct seq_file *s_file, void *data) ...@@ -112,6 +119,10 @@ static int sdw_slave_reg_show(struct seq_file *s_file, void *data)
} }
seq_printf(s_file, "%s", buf); seq_printf(s_file, "%s", buf);
pm_runtime_mark_last_busy(&slave->dev);
pm_runtime_put(&slave->dev);
kfree(buf); kfree(buf);
return 0; return 0;
......
...@@ -778,22 +778,6 @@ static int intel_post_bank_switch(struct sdw_intel *sdw) ...@@ -778,22 +778,6 @@ static int intel_post_bank_switch(struct sdw_intel *sdw)
* DAI routines * DAI routines
*/ */
static int intel_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai);
int ret;
ret = pm_runtime_resume_and_get(cdns->dev);
if (ret < 0 && ret != -EACCES) {
dev_err_ratelimited(cdns->dev,
"pm_runtime_resume_and_get failed in %s, ret %d\n",
__func__, ret);
return ret;
}
return 0;
}
static int intel_hw_params(struct snd_pcm_substream *substream, static int intel_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
...@@ -954,15 +938,6 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) ...@@ -954,15 +938,6 @@ intel_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
return 0; return 0;
} }
static void intel_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct sdw_cdns *cdns = snd_soc_dai_get_drvdata(dai);
pm_runtime_mark_last_busy(cdns->dev);
pm_runtime_put_autosuspend(cdns->dev);
}
static int intel_pcm_set_sdw_stream(struct snd_soc_dai *dai, static int intel_pcm_set_sdw_stream(struct snd_soc_dai *dai,
void *stream, int direction) void *stream, int direction)
{ {
...@@ -1088,12 +1063,10 @@ static int intel_component_dais_suspend(struct snd_soc_component *component) ...@@ -1088,12 +1063,10 @@ static int intel_component_dais_suspend(struct snd_soc_component *component)
} }
static const struct snd_soc_dai_ops intel_pcm_dai_ops = { static const struct snd_soc_dai_ops intel_pcm_dai_ops = {
.startup = intel_startup,
.hw_params = intel_hw_params, .hw_params = intel_hw_params,
.prepare = intel_prepare, .prepare = intel_prepare,
.hw_free = intel_hw_free, .hw_free = intel_hw_free,
.trigger = intel_trigger, .trigger = intel_trigger,
.shutdown = intel_shutdown,
.set_stream = intel_pcm_set_sdw_stream, .set_stream = intel_pcm_set_sdw_stream,
.get_stream = intel_get_sdw_stream, .get_stream = intel_get_sdw_stream,
}; };
......
...@@ -113,7 +113,6 @@ static struct sdw_master_ops sdw_intel_ops = { ...@@ -113,7 +113,6 @@ static struct sdw_master_ops sdw_intel_ops = {
.override_adr = sdw_dmi_override_adr, .override_adr = sdw_dmi_override_adr,
.xfer_msg = cdns_xfer_msg, .xfer_msg = cdns_xfer_msg,
.xfer_msg_defer = cdns_xfer_msg_defer, .xfer_msg_defer = cdns_xfer_msg_defer,
.reset_page_addr = cdns_reset_page_addr,
.set_bus_conf = cdns_bus_conf, .set_bus_conf = cdns_bus_conf,
.pre_bank_switch = generic_pre_bank_switch, .pre_bank_switch = generic_pre_bank_switch,
.post_bank_switch = generic_post_bank_switch, .post_bank_switch = generic_post_bank_switch,
......
...@@ -81,14 +81,14 @@ static int _sdw_program_slave_port_params(struct sdw_bus *bus, ...@@ -81,14 +81,14 @@ static int _sdw_program_slave_port_params(struct sdw_bus *bus,
} }
/* Program DPN_OffsetCtrl2 registers */ /* Program DPN_OffsetCtrl2 registers */
ret = sdw_write(slave, addr1, t_params->offset2); ret = sdw_write_no_pm(slave, addr1, t_params->offset2);
if (ret < 0) { if (ret < 0) {
dev_err(bus->dev, "DPN_OffsetCtrl2 register write failed\n"); dev_err(bus->dev, "DPN_OffsetCtrl2 register write failed\n");
return ret; return ret;
} }
/* Program DPN_BlockCtrl3 register */ /* Program DPN_BlockCtrl3 register */
ret = sdw_write(slave, addr2, t_params->blk_pkg_mode); ret = sdw_write_no_pm(slave, addr2, t_params->blk_pkg_mode);
if (ret < 0) { if (ret < 0) {
dev_err(bus->dev, "DPN_BlockCtrl3 register write failed\n"); dev_err(bus->dev, "DPN_BlockCtrl3 register write failed\n");
return ret; return ret;
...@@ -105,7 +105,7 @@ static int _sdw_program_slave_port_params(struct sdw_bus *bus, ...@@ -105,7 +105,7 @@ static int _sdw_program_slave_port_params(struct sdw_bus *bus,
/* Program DPN_SampleCtrl2 register */ /* Program DPN_SampleCtrl2 register */
wbuf = FIELD_GET(SDW_DPN_SAMPLECTRL_HIGH, t_params->sample_interval - 1); wbuf = FIELD_GET(SDW_DPN_SAMPLECTRL_HIGH, t_params->sample_interval - 1);
ret = sdw_write(slave, addr3, wbuf); ret = sdw_write_no_pm(slave, addr3, wbuf);
if (ret < 0) { if (ret < 0) {
dev_err(bus->dev, "DPN_SampleCtrl2 register write failed\n"); dev_err(bus->dev, "DPN_SampleCtrl2 register write failed\n");
return ret; return ret;
...@@ -115,7 +115,7 @@ static int _sdw_program_slave_port_params(struct sdw_bus *bus, ...@@ -115,7 +115,7 @@ static int _sdw_program_slave_port_params(struct sdw_bus *bus,
wbuf = FIELD_PREP(SDW_DPN_HCTRL_HSTART, t_params->hstart); wbuf = FIELD_PREP(SDW_DPN_HCTRL_HSTART, t_params->hstart);
wbuf |= FIELD_PREP(SDW_DPN_HCTRL_HSTOP, t_params->hstop); wbuf |= FIELD_PREP(SDW_DPN_HCTRL_HSTOP, t_params->hstop);
ret = sdw_write(slave, addr4, wbuf); ret = sdw_write_no_pm(slave, addr4, wbuf);
if (ret < 0) if (ret < 0)
dev_err(bus->dev, "DPN_HCtrl register write failed\n"); dev_err(bus->dev, "DPN_HCtrl register write failed\n");
...@@ -163,7 +163,7 @@ static int sdw_program_slave_port_params(struct sdw_bus *bus, ...@@ -163,7 +163,7 @@ static int sdw_program_slave_port_params(struct sdw_bus *bus,
wbuf = FIELD_PREP(SDW_DPN_PORTCTRL_DATAMODE, p_params->data_mode); wbuf = FIELD_PREP(SDW_DPN_PORTCTRL_DATAMODE, p_params->data_mode);
wbuf |= FIELD_PREP(SDW_DPN_PORTCTRL_FLOWMODE, p_params->flow_mode); wbuf |= FIELD_PREP(SDW_DPN_PORTCTRL_FLOWMODE, p_params->flow_mode);
ret = sdw_update(s_rt->slave, addr1, 0xF, wbuf); ret = sdw_update_no_pm(s_rt->slave, addr1, 0xF, wbuf);
if (ret < 0) { if (ret < 0) {
dev_err(&s_rt->slave->dev, dev_err(&s_rt->slave->dev,
"DPN_PortCtrl register write failed for port %d\n", "DPN_PortCtrl register write failed for port %d\n",
...@@ -173,7 +173,7 @@ static int sdw_program_slave_port_params(struct sdw_bus *bus, ...@@ -173,7 +173,7 @@ static int sdw_program_slave_port_params(struct sdw_bus *bus,
if (!dpn_prop->read_only_wordlength) { if (!dpn_prop->read_only_wordlength) {
/* Program DPN_BlockCtrl1 register */ /* Program DPN_BlockCtrl1 register */
ret = sdw_write(s_rt->slave, addr2, (p_params->bps - 1)); ret = sdw_write_no_pm(s_rt->slave, addr2, (p_params->bps - 1));
if (ret < 0) { if (ret < 0) {
dev_err(&s_rt->slave->dev, dev_err(&s_rt->slave->dev,
"DPN_BlockCtrl1 register write failed for port %d\n", "DPN_BlockCtrl1 register write failed for port %d\n",
...@@ -184,7 +184,7 @@ static int sdw_program_slave_port_params(struct sdw_bus *bus, ...@@ -184,7 +184,7 @@ static int sdw_program_slave_port_params(struct sdw_bus *bus,
/* Program DPN_SampleCtrl1 register */ /* Program DPN_SampleCtrl1 register */
wbuf = (t_params->sample_interval - 1) & SDW_DPN_SAMPLECTRL_LOW; wbuf = (t_params->sample_interval - 1) & SDW_DPN_SAMPLECTRL_LOW;
ret = sdw_write(s_rt->slave, addr3, wbuf); ret = sdw_write_no_pm(s_rt->slave, addr3, wbuf);
if (ret < 0) { if (ret < 0) {
dev_err(&s_rt->slave->dev, dev_err(&s_rt->slave->dev,
"DPN_SampleCtrl1 register write failed for port %d\n", "DPN_SampleCtrl1 register write failed for port %d\n",
...@@ -193,7 +193,7 @@ static int sdw_program_slave_port_params(struct sdw_bus *bus, ...@@ -193,7 +193,7 @@ static int sdw_program_slave_port_params(struct sdw_bus *bus,
} }
/* Program DPN_OffsetCtrl1 registers */ /* Program DPN_OffsetCtrl1 registers */
ret = sdw_write(s_rt->slave, addr4, t_params->offset1); ret = sdw_write_no_pm(s_rt->slave, addr4, t_params->offset1);
if (ret < 0) { if (ret < 0) {
dev_err(&s_rt->slave->dev, dev_err(&s_rt->slave->dev,
"DPN_OffsetCtrl1 register write failed for port %d\n", "DPN_OffsetCtrl1 register write failed for port %d\n",
...@@ -203,7 +203,7 @@ static int sdw_program_slave_port_params(struct sdw_bus *bus, ...@@ -203,7 +203,7 @@ static int sdw_program_slave_port_params(struct sdw_bus *bus,
/* Program DPN_BlockCtrl2 register*/ /* Program DPN_BlockCtrl2 register*/
if (t_params->blk_grp_ctrl_valid) { if (t_params->blk_grp_ctrl_valid) {
ret = sdw_write(s_rt->slave, addr5, t_params->blk_grp_ctrl); ret = sdw_write_no_pm(s_rt->slave, addr5, t_params->blk_grp_ctrl);
if (ret < 0) { if (ret < 0) {
dev_err(&s_rt->slave->dev, dev_err(&s_rt->slave->dev,
"DPN_BlockCtrl2 reg write failed for port %d\n", "DPN_BlockCtrl2 reg write failed for port %d\n",
...@@ -214,7 +214,7 @@ static int sdw_program_slave_port_params(struct sdw_bus *bus, ...@@ -214,7 +214,7 @@ static int sdw_program_slave_port_params(struct sdw_bus *bus,
/* program DPN_LaneCtrl register */ /* program DPN_LaneCtrl register */
if (slave_prop->lane_control_support) { if (slave_prop->lane_control_support) {
ret = sdw_write(s_rt->slave, addr6, t_params->lane_ctrl); ret = sdw_write_no_pm(s_rt->slave, addr6, t_params->lane_ctrl);
if (ret < 0) { if (ret < 0) {
dev_err(&s_rt->slave->dev, dev_err(&s_rt->slave->dev,
"DPN_LaneCtrl register write failed for port %d\n", "DPN_LaneCtrl register write failed for port %d\n",
...@@ -319,9 +319,9 @@ static int sdw_enable_disable_slave_ports(struct sdw_bus *bus, ...@@ -319,9 +319,9 @@ static int sdw_enable_disable_slave_ports(struct sdw_bus *bus,
* it is safe to reset this register * it is safe to reset this register
*/ */
if (en) if (en)
ret = sdw_write(s_rt->slave, addr, p_rt->ch_mask); ret = sdw_write_no_pm(s_rt->slave, addr, p_rt->ch_mask);
else else
ret = sdw_write(s_rt->slave, addr, 0x0); ret = sdw_write_no_pm(s_rt->slave, addr, 0x0);
if (ret < 0) if (ret < 0)
dev_err(&s_rt->slave->dev, dev_err(&s_rt->slave->dev,
...@@ -476,9 +476,9 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus, ...@@ -476,9 +476,9 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus,
addr = SDW_DPN_PREPARECTRL(p_rt->num); addr = SDW_DPN_PREPARECTRL(p_rt->num);
if (prep) if (prep)
ret = sdw_write(s_rt->slave, addr, p_rt->ch_mask); ret = sdw_write_no_pm(s_rt->slave, addr, p_rt->ch_mask);
else else
ret = sdw_write(s_rt->slave, addr, 0x0); ret = sdw_write_no_pm(s_rt->slave, addr, 0x0);
if (ret < 0) { if (ret < 0) {
dev_err(&s_rt->slave->dev, dev_err(&s_rt->slave->dev,
...@@ -491,7 +491,7 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus, ...@@ -491,7 +491,7 @@ static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus,
wait_for_completion_timeout(port_ready, wait_for_completion_timeout(port_ready,
msecs_to_jiffies(dpn_prop->ch_prep_timeout)); msecs_to_jiffies(dpn_prop->ch_prep_timeout));
val = sdw_read(s_rt->slave, SDW_DPN_PREPARESTATUS(p_rt->num)); val = sdw_read_no_pm(s_rt->slave, SDW_DPN_PREPARESTATUS(p_rt->num));
if ((val < 0) || (val & p_rt->ch_mask)) { if ((val < 0) || (val & p_rt->ch_mask)) {
ret = (val < 0) ? val : -ETIMEDOUT; ret = (val < 0) ? val : -ETIMEDOUT;
dev_err(&s_rt->slave->dev, dev_err(&s_rt->slave->dev,
...@@ -684,8 +684,6 @@ static int sdw_bank_switch(struct sdw_bus *bus, int m_rt_count) ...@@ -684,8 +684,6 @@ static int sdw_bank_switch(struct sdw_bus *bus, int m_rt_count)
if (!wr_msg) if (!wr_msg)
return -ENOMEM; return -ENOMEM;
bus->defer_msg.msg = wr_msg;
wbuf = kzalloc(sizeof(*wbuf), GFP_KERNEL); wbuf = kzalloc(sizeof(*wbuf), GFP_KERNEL);
if (!wbuf) { if (!wbuf) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -713,7 +711,7 @@ static int sdw_bank_switch(struct sdw_bus *bus, int m_rt_count) ...@@ -713,7 +711,7 @@ static int sdw_bank_switch(struct sdw_bus *bus, int m_rt_count)
multi_link = bus->multi_link && (m_rt_count >= bus->hw_sync_min_links); multi_link = bus->multi_link && (m_rt_count >= bus->hw_sync_min_links);
if (multi_link) if (multi_link)
ret = sdw_transfer_defer(bus, wr_msg, &bus->defer_msg); ret = sdw_transfer_defer(bus, wr_msg);
else else
ret = sdw_transfer(bus, wr_msg); ret = sdw_transfer(bus, wr_msg);
...@@ -723,8 +721,8 @@ static int sdw_bank_switch(struct sdw_bus *bus, int m_rt_count) ...@@ -723,8 +721,8 @@ static int sdw_bank_switch(struct sdw_bus *bus, int m_rt_count)
} }
if (!multi_link) { if (!multi_link) {
kfree(wr_msg);
kfree(wbuf); kfree(wbuf);
kfree(wr_msg);
bus->defer_msg.msg = NULL; bus->defer_msg.msg = NULL;
bus->params.curr_bank = !bus->params.curr_bank; bus->params.curr_bank = !bus->params.curr_bank;
bus->params.next_bank = !bus->params.next_bank; bus->params.next_bank = !bus->params.next_bank;
...@@ -769,6 +767,7 @@ static int sdw_ml_sync_bank_switch(struct sdw_bus *bus) ...@@ -769,6 +767,7 @@ static int sdw_ml_sync_bank_switch(struct sdw_bus *bus)
if (bus->defer_msg.msg) { if (bus->defer_msg.msg) {
kfree(bus->defer_msg.msg->buf); kfree(bus->defer_msg.msg->buf);
kfree(bus->defer_msg.msg); kfree(bus->defer_msg.msg);
bus->defer_msg.msg = NULL;
} }
return 0; return 0;
...@@ -867,6 +866,7 @@ static int do_bank_switch(struct sdw_stream_runtime *stream) ...@@ -867,6 +866,7 @@ static int do_bank_switch(struct sdw_stream_runtime *stream)
if (bus->defer_msg.msg) { if (bus->defer_msg.msg) {
kfree(bus->defer_msg.msg->buf); kfree(bus->defer_msg.msg->buf);
kfree(bus->defer_msg.msg); kfree(bus->defer_msg.msg);
bus->defer_msg.msg = NULL;
} }
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#ifndef __SOUNDWIRE_H #ifndef __SOUNDWIRE_H
#define __SOUNDWIRE_H #define __SOUNDWIRE_H
#include <linux/bug.h>
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
#include <linux/bitfield.h> #include <linux/bitfield.h>
...@@ -365,7 +366,9 @@ struct sdw_dpn_prop { ...@@ -365,7 +366,9 @@ struct sdw_dpn_prop {
* @sink_dpn_prop: Sink Data Port N properties * @sink_dpn_prop: Sink Data Port N properties
* @scp_int1_mask: SCP_INT1_MASK desired settings * @scp_int1_mask: SCP_INT1_MASK desired settings
* @quirks: bitmask identifying deltas from the MIPI specification * @quirks: bitmask identifying deltas from the MIPI specification
* @is_sdca: the Slave supports the SDCA specification * @clock_reg_supported: the Peripheral implements the clock base and scale
* registers introduced with the SoundWire 1.2 specification. SDCA devices
* do not need to set this boolean property as the registers are required.
*/ */
struct sdw_slave_prop { struct sdw_slave_prop {
u32 mipi_revision; u32 mipi_revision;
...@@ -389,7 +392,7 @@ struct sdw_slave_prop { ...@@ -389,7 +392,7 @@ struct sdw_slave_prop {
struct sdw_dpn_prop *sink_dpn_prop; struct sdw_dpn_prop *sink_dpn_prop;
u8 scp_int1_mask; u8 scp_int1_mask;
u32 quirks; u32 quirks;
bool is_sdca; bool clock_reg_supported;
}; };
#define SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY BIT(0) #define SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY BIT(0)
...@@ -836,8 +839,8 @@ struct sdw_defer { ...@@ -836,8 +839,8 @@ struct sdw_defer {
* @read_prop: Read Master properties * @read_prop: Read Master properties
* @override_adr: Override value read from firmware (quirk for buggy firmware) * @override_adr: Override value read from firmware (quirk for buggy firmware)
* @xfer_msg: Transfer message callback * @xfer_msg: Transfer message callback
* @xfer_msg_defer: Defer version of transfer message callback * @xfer_msg_defer: Defer version of transfer message callback. The message is handled with the
* @reset_page_addr: Reset the SCP page address registers * bus struct @sdw_defer
* @set_bus_conf: Set the bus configuration * @set_bus_conf: Set the bus configuration
* @pre_bank_switch: Callback for pre bank switch * @pre_bank_switch: Callback for pre bank switch
* @post_bank_switch: Callback for post bank switch * @post_bank_switch: Callback for post bank switch
...@@ -851,10 +854,7 @@ struct sdw_master_ops { ...@@ -851,10 +854,7 @@ struct sdw_master_ops {
enum sdw_command_response (*xfer_msg) enum sdw_command_response (*xfer_msg)
(struct sdw_bus *bus, struct sdw_msg *msg); (struct sdw_bus *bus, struct sdw_msg *msg);
enum sdw_command_response (*xfer_msg_defer) enum sdw_command_response (*xfer_msg_defer)
(struct sdw_bus *bus, struct sdw_msg *msg, (struct sdw_bus *bus);
struct sdw_defer *defer);
enum sdw_command_response (*reset_page_addr)
(struct sdw_bus *bus, unsigned int dev_num);
int (*set_bus_conf)(struct sdw_bus *bus, int (*set_bus_conf)(struct sdw_bus *bus,
struct sdw_bus_params *params); struct sdw_bus_params *params);
int (*pre_bank_switch)(struct sdw_bus *bus); int (*pre_bank_switch)(struct sdw_bus *bus);
...@@ -1023,15 +1023,8 @@ int sdw_stream_add_master(struct sdw_bus *bus, ...@@ -1023,15 +1023,8 @@ int sdw_stream_add_master(struct sdw_bus *bus,
struct sdw_port_config *port_config, struct sdw_port_config *port_config,
unsigned int num_ports, unsigned int num_ports,
struct sdw_stream_runtime *stream); struct sdw_stream_runtime *stream);
int sdw_stream_add_slave(struct sdw_slave *slave,
struct sdw_stream_config *stream_config,
struct sdw_port_config *port_config,
unsigned int num_ports,
struct sdw_stream_runtime *stream);
int sdw_stream_remove_master(struct sdw_bus *bus, int sdw_stream_remove_master(struct sdw_bus *bus,
struct sdw_stream_runtime *stream); struct sdw_stream_runtime *stream);
int sdw_stream_remove_slave(struct sdw_slave *slave,
struct sdw_stream_runtime *stream);
int sdw_startup_stream(void *sdw_substream); int sdw_startup_stream(void *sdw_substream);
int sdw_prepare_stream(struct sdw_stream_runtime *stream); int sdw_prepare_stream(struct sdw_stream_runtime *stream);
int sdw_enable_stream(struct sdw_stream_runtime *stream); int sdw_enable_stream(struct sdw_stream_runtime *stream);
...@@ -1042,18 +1035,111 @@ int sdw_bus_prep_clk_stop(struct sdw_bus *bus); ...@@ -1042,18 +1035,111 @@ int sdw_bus_prep_clk_stop(struct sdw_bus *bus);
int sdw_bus_clk_stop(struct sdw_bus *bus); int sdw_bus_clk_stop(struct sdw_bus *bus);
int sdw_bus_exit_clk_stop(struct sdw_bus *bus); int sdw_bus_exit_clk_stop(struct sdw_bus *bus);
/* messaging and data APIs */ int sdw_compare_devid(struct sdw_slave *slave, struct sdw_slave_id id);
void sdw_extract_slave_id(struct sdw_bus *bus, u64 addr, struct sdw_slave_id *id);
#if IS_ENABLED(CONFIG_SOUNDWIRE)
int sdw_stream_add_slave(struct sdw_slave *slave,
struct sdw_stream_config *stream_config,
struct sdw_port_config *port_config,
unsigned int num_ports,
struct sdw_stream_runtime *stream);
int sdw_stream_remove_slave(struct sdw_slave *slave,
struct sdw_stream_runtime *stream);
/* messaging and data APIs */
int sdw_read(struct sdw_slave *slave, u32 addr); int sdw_read(struct sdw_slave *slave, u32 addr);
int sdw_write(struct sdw_slave *slave, u32 addr, u8 value); int sdw_write(struct sdw_slave *slave, u32 addr, u8 value);
int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value); int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value);
int sdw_read_no_pm(struct sdw_slave *slave, u32 addr); int sdw_read_no_pm(struct sdw_slave *slave, u32 addr);
int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val); int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val);
int sdw_nread_no_pm(struct sdw_slave *slave, u32 addr, size_t count, u8 *val);
int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val); int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val);
int sdw_nwrite_no_pm(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val);
int sdw_update(struct sdw_slave *slave, u32 addr, u8 mask, u8 val); int sdw_update(struct sdw_slave *slave, u32 addr, u8 mask, u8 val);
int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val); int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val);
int sdw_compare_devid(struct sdw_slave *slave, struct sdw_slave_id id); #else
void sdw_extract_slave_id(struct sdw_bus *bus, u64 addr, struct sdw_slave_id *id);
static inline int sdw_stream_add_slave(struct sdw_slave *slave,
struct sdw_stream_config *stream_config,
struct sdw_port_config *port_config,
unsigned int num_ports,
struct sdw_stream_runtime *stream)
{
WARN_ONCE(1, "SoundWire API is disabled");
return -EINVAL;
}
static inline int sdw_stream_remove_slave(struct sdw_slave *slave,
struct sdw_stream_runtime *stream)
{
WARN_ONCE(1, "SoundWire API is disabled");
return -EINVAL;
}
/* messaging and data APIs */
static inline int sdw_read(struct sdw_slave *slave, u32 addr)
{
WARN_ONCE(1, "SoundWire API is disabled");
return -EINVAL;
}
static inline int sdw_write(struct sdw_slave *slave, u32 addr, u8 value)
{
WARN_ONCE(1, "SoundWire API is disabled");
return -EINVAL;
}
static inline int sdw_write_no_pm(struct sdw_slave *slave, u32 addr, u8 value)
{
WARN_ONCE(1, "SoundWire API is disabled");
return -EINVAL;
}
static inline int sdw_read_no_pm(struct sdw_slave *slave, u32 addr)
{
WARN_ONCE(1, "SoundWire API is disabled");
return -EINVAL;
}
static inline int sdw_nread(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
{
WARN_ONCE(1, "SoundWire API is disabled");
return -EINVAL;
}
static inline int sdw_nread_no_pm(struct sdw_slave *slave, u32 addr, size_t count, u8 *val)
{
WARN_ONCE(1, "SoundWire API is disabled");
return -EINVAL;
}
static inline int sdw_nwrite(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val)
{
WARN_ONCE(1, "SoundWire API is disabled");
return -EINVAL;
}
static inline int sdw_nwrite_no_pm(struct sdw_slave *slave, u32 addr, size_t count, const u8 *val)
{
WARN_ONCE(1, "SoundWire API is disabled");
return -EINVAL;
}
static inline int sdw_update(struct sdw_slave *slave, u32 addr, u8 mask, u8 val)
{
WARN_ONCE(1, "SoundWire API is disabled");
return -EINVAL;
}
static inline int sdw_update_no_pm(struct sdw_slave *slave, u32 addr, u8 mask, u8 val)
{
WARN_ONCE(1, "SoundWire API is disabled");
return -EINVAL;
}
#endif /* CONFIG_SOUNDWIRE */
#endif /* __SOUNDWIRE_H */ #endif /* __SOUNDWIRE_H */
...@@ -204,7 +204,6 @@ static int rt1316_read_prop(struct sdw_slave *slave) ...@@ -204,7 +204,6 @@ static int rt1316_read_prop(struct sdw_slave *slave)
prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
prop->quirks = SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY; prop->quirks = SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY;
prop->is_sdca = true;
prop->paging_support = true; prop->paging_support = true;
......
...@@ -353,7 +353,6 @@ static int rt1318_read_prop(struct sdw_slave *slave) ...@@ -353,7 +353,6 @@ static int rt1318_read_prop(struct sdw_slave *slave)
prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
prop->quirks = SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY; prop->quirks = SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY;
prop->is_sdca = true;
prop->paging_support = true; prop->paging_support = true;
......
...@@ -186,7 +186,6 @@ static int rt711_sdca_read_prop(struct sdw_slave *slave) ...@@ -186,7 +186,6 @@ static int rt711_sdca_read_prop(struct sdw_slave *slave)
prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY; prop->scp_int1_mask = SDW_SCP_INT1_BUS_CLASH | SDW_SCP_INT1_PARITY;
prop->quirks = SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY; prop->quirks = SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY;
prop->is_sdca = true;
prop->paging_support = true; prop->paging_support = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment