Merge "msm: smd: separate pil attributes from subsystem name"

This commit is contained in:
Linux Build Service Account 2013-11-14 00:56:04 -08:00 committed by Gerrit - the friendly Code Review server
commit 450a7ec9a4
8 changed files with 160 additions and 83 deletions

View file

@ -24,10 +24,11 @@ Required properties:
interrupts
-qcom,smd-irq-bitmask : the sending irq bitmask
-interrupts : the receiving interrupt line
-label : the name of the remote subsystem for this edge
Optional properties:
-qcom,pil-string : the name to use when loading this edge
-qcom,irq-no-suspend: configure the incoming irq line as active during suspend
-qcom,not-loadable : indicates this processor cannot be loaded by PIL
qcom,smsm
Required properties:
@ -53,8 +54,8 @@ Example:
qcom,smd-edge = <0>;
qcom,smd-irq-offset = <0x8>;
qcom,smd-irq-bitmask = <0x1000>;
qcom,pil-string = "modem";
interrupts = <0 25 1>;
label = "modem";
};
qcom,smsm-modem {
@ -70,8 +71,8 @@ Example:
qcom,smd-edge = <1>;
qcom,smd-irq-offset = <0x8>;
qcom,smd-irq-bitmask = <0x100>;
qcom,pil-string = "adsp";
interrupts = <0 156 1>;
label = "adsp";
};
qcom,smsm-adsp {
@ -87,8 +88,8 @@ Example:
qcom,smd-edge = <6>;
qcom,smd-irq-offset = <0x8>;
qcom,smd-irq-bitmask = <0x20000>;
qcom,pil-string = "wcnss";
interrupts = <0 142 1>;
label = "wcnss";
};
qcom,smsm-wcnss {
@ -105,7 +106,9 @@ Example:
qcom,smd-irq-offset = <0x8>;
qcom,smd-irq-bitmask = <0x1>;
interrupts = <0 168 1>;
label = "rpm";
qcom,irq-no-syspend;
qcom,not-loadable;
};
};

View file

@ -325,6 +325,16 @@ int __init msm_smd_init(void);
*/
int smd_remote_ss_to_edge(const char *name);
/**
* smd_edge_to_pil_str - Returns the PIL string used to load the remote side of
* the indicated edge.
*
* @type - Edge definition
* @returns - The PIL string to load the remove side of @type or NULL if the
* PIL string does not exist.
*/
const char *smd_edge_to_pil_str(uint32_t type);
#else
static inline int smd_open(const char *name, smd_channel_t **ch, void *priv,
@ -461,6 +471,11 @@ static inline int smd_remote_ss_to_edge(const char *name)
{
return -EINVAL;
}
static inline const char *smd_edge_to_pil_str(uint32_t type)
{
return NULL;
}
#endif
#endif

View file

@ -446,7 +446,7 @@ static void *msm_ipc_load_subsystem(uint32_t edge)
void *pil = NULL;
const char *peripheral;
peripheral = smd_edge_to_subsystem(edge);
peripheral = smd_edge_to_pil_str(edge);
if (peripheral) {
pil = subsystem_get(peripheral);
if (IS_ERR(pil)) {
@ -548,7 +548,7 @@ void *msm_ipc_load_default_node(void)
void *pil = NULL;
const char *peripheral;
peripheral = smd_edge_to_subsystem(SMD_APPS_MODEM);
peripheral = smd_edge_to_pil_str(SMD_APPS_MODEM);
if (peripheral && !strncmp(peripheral, "modem", 6)) {
pil = subsystem_get(peripheral);
if (IS_ERR(pil)) {

View file

@ -650,6 +650,7 @@ struct remote_proc_info {
struct list_head ch_list;
/* 2 total supported tables of channels */
unsigned char ch_allocated[SMEM_NUM_SMD_STREAM_CHANNELS * 2];
bool skip_pil;
};
static struct remote_proc_info remote_info[NUM_SMD_SUBSYSTEMS];
@ -823,6 +824,29 @@ int smd_remote_ss_to_edge(const char *name)
}
EXPORT_SYMBOL(smd_remote_ss_to_edge);
/**
* smd_edge_to_pil_str - Returns the PIL string used to load the remote side of
* the indicated edge.
*
* @type - Edge definition
* @returns - The PIL string to load the remove side of @type or NULL if the
* PIL string does not exist.
*/
const char *smd_edge_to_pil_str(uint32_t type)
{
const char *pil_str = NULL;
if (type < ARRAY_SIZE(edge_to_pids)) {
if (!remote_info[smd_edge_to_remote_pid(type)].skip_pil) {
pil_str = edge_to_pids[type].subsys_name;
if (pil_str[0] == 0x0)
pil_str = NULL;
}
}
return pil_str;
}
EXPORT_SYMBOL(smd_edge_to_pil_str);
/*
* Returns a pointer to the subsystem name or NULL if no
* subsystem name is available.
@ -3329,26 +3353,44 @@ int smd_edge_to_local_pid(uint32_t edge)
return edge_to_pids[edge].local_pid;
}
/**
* smd_proc_set_skip_pil() - Mark if the indicated processor is be loaded by PIL
* @pid: the processor id to mark
* @skip_pil: true if @pid cannot by loaded by PIL
*/
void smd_proc_set_skip_pil(unsigned pid, bool skip_pil)
{
if (pid >= NUM_SMD_SUBSYSTEMS) {
pr_err("%s: invalid pid:%d\n", __func__, pid);
return;
}
remote_info[pid].skip_pil = skip_pil;
}
/**
* smd_set_edge_subsys_name() - Set the subsystem name
* @edge: edge type identifies local and remote processor
* @sussys_name: pointer to subsystem name
* @subsys_name: pointer to subsystem name
*
* This function is used to set the subsystem name for given edge type.
*/
void smd_set_edge_subsys_name(uint32_t edge, const char *subsys_name)
{
if (edge < ARRAY_SIZE(edge_to_pids))
strlcpy(edge_to_pids[edge].subsys_name,
subsys_name, SMD_MAX_CH_NAME_LEN);
if (subsys_name)
strlcpy(edge_to_pids[edge].subsys_name,
subsys_name, SMD_MAX_CH_NAME_LEN);
else
strlcpy(edge_to_pids[edge].subsys_name,
"", SMD_MAX_CH_NAME_LEN);
else
pr_err("%s: Invalid edge type[%d]\n", __func__, edge);
}
/**
* smd_reset_all_edge_subsys_name() - Reset the PIL string
* smd_reset_all_edge_subsys_name() - Reset the subsystem name
*
* This function is used to reset the PIL string of all edges in
* This function is used to reset the subsystem name of all edges in
* targets where configuration information is available through
* device tree.
*/

View file

@ -164,7 +164,7 @@ static int msm_smd_probe(struct platform_device *pdev)
uint32_t irq_bitmask;
uint32_t irq_line;
unsigned long irq_flags = IRQF_TRIGGER_RISING;
const char *pilstr;
const char *subsys_name;
struct interrupt_config_item *private_irq;
struct device_node *node;
void *irq_out_base;
@ -173,6 +173,7 @@ static int msm_smd_probe(struct platform_device *pdev)
struct resource *r;
struct interrupt_config *private_intr_config;
uint32_t remote_pid;
bool skip_pil;
node = pdev->dev.of_node;
@ -227,10 +228,27 @@ static int msm_smd_probe(struct platform_device *pdev)
goto missing_key;
SMD_DBG("%s: %s = %d", __func__, key, irq_line);
key = "qcom,pil-string";
pilstr = of_get_property(node, key, NULL);
if (pilstr)
SMD_DBG("%s: %s = %s", __func__, key, pilstr);
key = "label";
subsys_name = of_get_property(node, key, NULL);
SMD_DBG("%s: %s = %s", __func__, key, subsys_name);
/*
* Backwards compatibility. Although label is required, some DTs may
* still list the legacy pil-string. Sanely handle pil-string.
*/
if (!subsys_name) {
pr_warn("Missing required property - label. Using legacy parsing\n");
key = "qcom,pil-string";
subsys_name = of_get_property(node, key, NULL);
SMD_DBG("%s: %s = %s", __func__, key, subsys_name);
if (subsys_name)
skip_pil = false;
else
skip_pil = true;
} else {
key = "qcom,not-loadable";
skip_pil = of_property_read_bool(node, key);
SMD_DBG("%s: %s = %d\n", __func__, key, skip_pil);
}
key = "qcom,irq-no-suspend";
ret = of_property_read_bool(node, key);
@ -265,8 +283,8 @@ static int msm_smd_probe(struct platform_device *pdev)
irq_line);
}
if (pilstr)
smd_set_edge_subsys_name(edge, pilstr);
smd_set_edge_subsys_name(edge, subsys_name);
smd_proc_set_skip_pil(smd_edge_to_remote_pid(edge), skip_pil);
smd_set_edge_initialized(edge);
smd_post_init(0, remote_pid);

View file

@ -962,7 +962,7 @@ int smd_pkt_open(struct inode *inode, struct file *file)
goto out;
}
peripheral = smd_edge_to_subsystem(smd_pkt_devp->edge);
peripheral = smd_edge_to_pil_str(smd_pkt_devp->edge);
if (peripheral) {
smd_pkt_devp->pil = subsystem_get(peripheral);
if (IS_ERR(smd_pkt_devp->pil)) {
@ -977,38 +977,36 @@ int smd_pkt_open(struct inode *inode, struct file *file)
msleep((smd_pkt_devp->open_modem_wait * 1000));
goto release_pd;
}
}
/* Wait for the modem SMSM to be inited for the SMD
** Loopback channel to be allocated at the modem. Since
** the wait need to be done atmost once, using msleep
** doesn't degrade the performance. */
if (!strncmp(smd_pkt_devp->ch_name, "LOOPBACK",
SMD_MAX_CH_NAME_LEN)) {
if (!is_modem_smsm_inited())
msleep(5000);
smsm_change_state(SMSM_APPS_STATE,
0, SMSM_SMD_LOOPBACK);
msleep(100);
}
/* Wait for the modem SMSM to be inited for the SMD
** Loopback channel to be allocated at the modem. Since
** the wait need to be done atmost once, using msleep
** doesn't degrade the performance. */
if (!strcmp(smd_pkt_devp->ch_name, "LOOPBACK")) {
if (!is_modem_smsm_inited())
msleep(5000);
smsm_change_state(SMSM_APPS_STATE,
0, SMSM_SMD_LOOPBACK);
msleep(100);
}
/*
* Wait for a packet channel to be allocated so we know
* the modem is ready enough.
*/
if (smd_pkt_devp->open_modem_wait) {
r = wait_for_completion_interruptible_timeout(
&smd_pkt_devp->ch_allocated,
msecs_to_jiffies(
smd_pkt_devp->open_modem_wait
* 1000));
if (r == 0)
r = -ETIMEDOUT;
if (r < 0) {
pr_err("%s: wait on smd_pkt_dev id:%d"
" allocation failed rc:%d\n",
__func__, smd_pkt_devp->i, r);
goto release_pil;
}
/*
* Wait for a packet channel to be allocated so we know
* the modem is ready enough.
*/
if (smd_pkt_devp->open_modem_wait) {
r = wait_for_completion_interruptible_timeout(
&smd_pkt_devp->ch_allocated,
msecs_to_jiffies(
smd_pkt_devp->open_modem_wait
* 1000));
if (r == 0)
r = -ETIMEDOUT;
if (r < 0) {
pr_err("%s: wait on smd_pkt_dev id:%d allocation failed rc:%d\n",
__func__, smd_pkt_devp->i, r);
goto release_pil;
}
}

View file

@ -270,6 +270,7 @@ extern int smd_edge_to_remote_pid(uint32_t edge);
extern int smd_edge_to_local_pid(uint32_t edge);
extern void smd_set_edge_subsys_name(uint32_t edge, const char *subsys_name);
extern void smd_reset_all_edge_subsys_name(void);
extern void smd_proc_set_skip_pil(unsigned pid, bool skip_pil);
extern void smd_set_edge_initialized(uint32_t edge);
extern void smd_cfg_smd_intr(uint32_t proc, uint32_t mask, void *ptr);
extern void smd_cfg_smsm_intr(uint32_t proc, uint32_t mask, void *ptr);

View file

@ -431,7 +431,7 @@ static int smd_tty_port_activate(struct tty_port *tport,
goto out;
}
peripheral = smd_edge_to_subsystem(smd_tty[n].edge);
peripheral = smd_edge_to_pil_str(smd_tty[n].edge);
if (peripheral) {
info->pil = subsystem_get(peripheral);
if (IS_ERR(info->pil)) {
@ -449,42 +449,42 @@ static int smd_tty_port_activate(struct tty_port *tport,
res = PTR_ERR(info->pil);
goto platform_unregister;
}
}
/* Wait for the modem SMSM to be inited for the SMD
* Loopback channel to be allocated at the modem. Since
* the wait need to be done atmost once, using msleep
* doesn't degrade the performance.
*/
if (n == LOOPBACK_IDX) {
if (!is_modem_smsm_inited())
msleep(5000);
smsm_change_state(SMSM_APPS_STATE,
0, SMSM_SMD_LOOPBACK);
msleep(100);
}
/* Wait for the modem SMSM to be inited for the SMD
* Loopback channel to be allocated at the modem. Since
* the wait need to be done atmost once, using msleep
* doesn't degrade the performance.
*/
if (n == LOOPBACK_IDX) {
if (!is_modem_smsm_inited())
msleep(5000);
smsm_change_state(SMSM_APPS_STATE,
0, SMSM_SMD_LOOPBACK);
msleep(100);
}
/*
* Wait for a channel to be allocated so we know
* the modem is ready enough.
*/
if (smd_tty[n].open_wait) {
res = wait_for_completion_interruptible_timeout(
&info->ch_allocated,
msecs_to_jiffies(smd_tty[n].open_wait *
1000));
/*
* Wait for a channel to be allocated so we know
* the modem is ready enough.
*/
if (smd_tty[n].open_wait) {
res = wait_for_completion_interruptible_timeout(
&info->ch_allocated,
msecs_to_jiffies(smd_tty[n].open_wait *
1000));
if (res == 0) {
SMD_TTY_INFO(
"Timed out waiting for SMD channel %s",
info->ch_name);
res = -ETIMEDOUT;
goto release_pil;
} else if (res < 0) {
SMD_TTY_INFO(
"Error waiting for SMD channel %s : %d\n",
info->ch_name, res);
goto release_pil;
}
if (res == 0) {
SMD_TTY_INFO(
"Timed out waiting for SMD channel %s",
info->ch_name);
res = -ETIMEDOUT;
goto release_pil;
} else if (res < 0) {
SMD_TTY_INFO(
"Error waiting for SMD channel %s : %d\n",
info->ch_name, res);
goto release_pil;
}
}