Commit e33269f6 authored by Andrey Shvetsov's avatar Andrey Shvetsov Committed by Greg Kroah-Hartman

staging: most: hdm-usb: introduce synchronization function

This patch introduces the function start_sync_ep() and relocates the
triggers for synchronization to this function.
Signed-off-by: default avatarAndrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: default avatarChristian Gromm <christian.gromm@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7c23baa9
...@@ -182,6 +182,11 @@ static inline int drci_wr_reg(struct usb_device *dev, u16 reg, u16 data) ...@@ -182,6 +182,11 @@ static inline int drci_wr_reg(struct usb_device *dev, u16 reg, u16 data)
5 * HZ); 5 * HZ);
} }
static inline int start_sync_ep(struct usb_device *usb_dev, u16 ep)
{
return drci_wr_reg(usb_dev, DRCI_REG_BASE + DRCI_COMMAND + ep * 16, 1);
}
/** /**
* get_stream_frame_size - calculate frame size of current configuration * get_stream_frame_size - calculate frame size of current configuration
* @cfg: channel configuration * @cfg: channel configuration
...@@ -697,11 +702,8 @@ static int hdm_configure_channel(struct most_interface *iface, int channel, ...@@ -697,11 +702,8 @@ static int hdm_configure_channel(struct most_interface *iface, int channel,
mdev->conf[channel] = *conf; mdev->conf[channel] = *conf;
if (conf->data_type == MOST_CH_ASYNC) { if (conf->data_type == MOST_CH_ASYNC) {
u16 ep = mdev->ep_address[channel]; u16 ep = mdev->ep_address[channel];
int err = drci_wr_reg(mdev->usb_device,
DRCI_REG_BASE + DRCI_COMMAND + ep * 16,
1);
if (err < 0) if (start_sync_ep(mdev->usb_device, ep) < 0)
dev_warn(dev, "sync for ep%02x failed", ep); dev_warn(dev, "sync for ep%02x failed", ep);
} }
return 0; return 0;
...@@ -987,6 +989,7 @@ static ssize_t store_value(struct most_dci_obj *dci_obj, ...@@ -987,6 +989,7 @@ static ssize_t store_value(struct most_dci_obj *dci_obj,
u16 val; u16 val;
u16 reg_addr; u16 reg_addr;
const char *name = attr->attr.name; const char *name = attr->attr.name;
struct usb_device *usb_dev = dci_obj->usb_device;
int err = kstrtou16(buf, 16, &val); int err = kstrtou16(buf, 16, &val);
if (err) if (err)
...@@ -997,18 +1000,15 @@ static ssize_t store_value(struct most_dci_obj *dci_obj, ...@@ -997,18 +1000,15 @@ static ssize_t store_value(struct most_dci_obj *dci_obj,
return count; return count;
} }
if (!strcmp(name, "arb_value")) { if (!strcmp(name, "arb_value"))
reg_addr = dci_obj->reg_addr; err = drci_wr_reg(usb_dev, dci_obj->reg_addr, val);
} else if (!strcmp(name, "sync_ep")) { else if (!strcmp(name, "sync_ep"))
u16 ep = val; err = start_sync_ep(usb_dev, val);
else if (!get_static_reg_addr(ro_regs, name, &reg_addr))
reg_addr = DRCI_REG_BASE + DRCI_COMMAND + ep * 16; err = drci_wr_reg(usb_dev, reg_addr, val);
val = 1; else
} else if (get_static_reg_addr(ro_regs, name, &reg_addr)) {
return -EFAULT; return -EFAULT;
}
err = drci_wr_reg(dci_obj->usb_device, reg_addr, val);
if (err < 0) if (err < 0)
return err; return err;
......
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