}
static inline int do_transfer_defer(struct sdw_bus *bus,
- struct sdw_msg *msg, struct sdw_defer *defer)
+ struct sdw_msg *msg,
+ struct sdw_defer *defer)
{
int retry = bus->prop.err_threshold;
enum sdw_command_response resp;
ret = do_transfer(bus, msg);
if (ret != 0 && ret != -ENODATA)
dev_err(bus->dev, "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);
* Caller needs to hold the msg_lock lock while calling this
*/
int sdw_transfer_defer(struct sdw_bus *bus, struct sdw_msg *msg,
- struct sdw_defer *defer)
+ struct sdw_defer *defer)
{
int ret;
ret = do_transfer_defer(bus, msg, defer);
if (ret != 0 && ret != -ENODATA)
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;
}
-
int sdw_fill_msg(struct sdw_msg *msg, struct sdw_slave *slave,
- u32 addr, size_t count, u16 dev_num, u8 flags, u8 *buf)
+ u32 addr, size_t count, u16 dev_num, u8 flags, u8 *buf)
{
memset(msg, 0, sizeof(*msg));
msg->addr = addr; /* addr is 16 bit and truncated here */
int ret;
ret = sdw_fill_msg(&msg, slave, addr, count,
- slave->dev_num, SDW_MSG_FLAG_READ, val);
+ slave->dev_num, SDW_MSG_FLAG_READ, val);
if (ret < 0)
return ret;
int ret;
ret = sdw_fill_msg(&msg, slave, addr, count,
- slave->dev_num, SDW_MSG_FLAG_WRITE, val);
+ slave->dev_num, SDW_MSG_FLAG_WRITE, val);
if (ret < 0)
return ret;
mutex_unlock(&slave->bus->bus_lock);
if (dev_num < 0) {
dev_err(slave->bus->dev, "Get dev_num failed: %d",
- dev_num);
+ dev_num);
return dev_num;
}
} else {
dev_info(slave->bus->dev,
- "Slave already registered dev_num:%d",
- slave->dev_num);
+ "Slave already registered dev_num:%d",
+ slave->dev_num);
/* Clear the slave->dev_num to transfer message on device 0 */
dev_num = slave->dev_num;
}
void sdw_extract_slave_id(struct sdw_bus *bus,
- u64 addr, struct sdw_slave_id *id)
+ u64 addr, struct sdw_slave_id *id)
{
dev_dbg(bus->dev, "SDW Slave Addr: %llx", addr);
/* No Slave, so use raw xfer api */
ret = sdw_fill_msg(&msg, NULL, SDW_SCP_DEVID_0,
- SDW_NUM_DEV_ID_REGISTERS, 0, SDW_MSG_FLAG_READ, buf);
+ SDW_NUM_DEV_ID_REGISTERS, 0, SDW_MSG_FLAG_READ, buf);
if (ret < 0)
return ret;
}
static void sdw_modify_slave_status(struct sdw_slave *slave,
- enum sdw_slave_status status)
+ enum sdw_slave_status status)
{
mutex_lock(&slave->bus->bus_lock);
slave->status = status;
}
int sdw_configure_dpn_intr(struct sdw_slave *slave,
- int port, bool enable, int mask)
+ int port, bool enable, int mask)
{
u32 addr;
int ret;
ret = sdw_update(slave, addr, (mask | SDW_DPN_INT_PORT_READY), val);
if (ret < 0)
dev_err(slave->bus->dev,
- "SDW_DPN_INTMASK write failed:%d", val);
+ "SDW_DPN_INTMASK write failed:%d", val);
return ret;
}
ret = sdw_update(slave, SDW_SCP_INTMASK1, val, val);
if (ret < 0) {
dev_err(slave->bus->dev,
- "SDW_SCP_INTMASK1 write failed:%d", ret);
+ "SDW_SCP_INTMASK1 write failed:%d", ret);
return ret;
}
ret = sdw_update(slave, SDW_DP0_INTMASK, val, val);
if (ret < 0) {
dev_err(slave->bus->dev,
- "SDW_DP0_INTMASK read failed:%d", ret);
+ "SDW_DP0_INTMASK read failed:%d", ret);
return val;
}
status = sdw_read(slave, SDW_DP0_INT);
if (status < 0) {
dev_err(slave->bus->dev,
- "SDW_DP0_INT read failed:%d", status);
+ "SDW_DP0_INT read failed:%d", status);
return status;
}
}
static int sdw_handle_port_interrupt(struct sdw_slave *slave,
- int port, u8 *slave_status)
+ int port, u8 *slave_status)
{
u8 clear = 0, impl_int_mask;
int status, status2, ret, count = 0;
status = sdw_read(slave, addr);
if (status < 0) {
dev_err(slave->bus->dev,
- "SDW_DPN_INT read failed:%d", status);
+ "SDW_DPN_INT read failed:%d", status);
return status;
}
ret = sdw_write(slave, addr, clear);
if (ret < 0) {
dev_err(slave->bus->dev,
- "SDW_DPN_INT write failed:%d", ret);
+ "SDW_DPN_INT write failed:%d", ret);
return ret;
}
status2 = sdw_read(slave, addr);
if (status2 < 0) {
dev_err(slave->bus->dev,
- "SDW_DPN_INT read failed:%d", status2);
+ "SDW_DPN_INT read failed:%d", status2);
return status2;
}
status &= status2;
buf = ret = sdw_read(slave, SDW_SCP_INT1);
if (ret < 0) {
dev_err(slave->bus->dev,
- "SDW_SCP_INT1 read failed:%d", ret);
+ "SDW_SCP_INT1 read failed:%d", ret);
return ret;
}
ret = sdw_nread(slave, SDW_SCP_INTSTAT2, 2, buf2);
if (ret < 0) {
dev_err(slave->bus->dev,
- "SDW_SCP_INT2/3 read failed:%d", ret);
+ "SDW_SCP_INT2/3 read failed:%d", ret);
return ret;
}
port = port >> SDW_REG_SHIFT(SDW_SCP_INT1_PORT0_3);
for_each_set_bit(bit, &port, 8) {
sdw_handle_port_interrupt(slave, bit,
- &port_status[bit]);
+ &port_status[bit]);
}
(slave->ops->interrupt_callback)) {
slave_intr.control_port = clear;
memcpy(slave_intr.port, &port_status,
- sizeof(slave_intr.port));
+ sizeof(slave_intr.port));
slave->ops->interrupt_callback(slave, &slave_intr);
}
ret = sdw_write(slave, SDW_SCP_INT1, clear);
if (ret < 0) {
dev_err(slave->bus->dev,
- "SDW_SCP_INT1 write failed:%d", ret);
+ "SDW_SCP_INT1 write failed:%d", ret);
return ret;
}
_buf = ret = sdw_read(slave, SDW_SCP_INT1);
if (ret < 0) {
dev_err(slave->bus->dev,
- "SDW_SCP_INT1 read failed:%d", ret);
+ "SDW_SCP_INT1 read failed:%d", ret);
return ret;
}
ret = sdw_nread(slave, SDW_SCP_INTSTAT2, 2, _buf2);
if (ret < 0) {
dev_err(slave->bus->dev,
- "SDW_SCP_INT2/3 read failed:%d", ret);
+ "SDW_SCP_INT2/3 read failed:%d", ret);
return ret;
}
}
static int sdw_update_slave_status(struct sdw_slave *slave,
- enum sdw_slave_status status)
+ enum sdw_slave_status status)
{
if ((slave->ops) && (slave->ops->update_status))
return slave->ops->update_status(slave, status);
* @status: Status for all Slave(s)
*/
int sdw_handle_slave_status(struct sdw_bus *bus,
- enum sdw_slave_status status[])
+ enum sdw_slave_status status[])
{
enum sdw_slave_status prev_status;
struct sdw_slave *slave;
default:
dev_err(bus->dev, "Invalid slave %d status:%d",
- i, status[i]);
+ i, status[i]);
break;
}