tsif: tsif1 initialization bug fix
When using CONFIG_MSM_USE_TSIF1 to enable the second tsif instance, the device initialization failed because of a errant device ID. The check has been updated to accept the correct device ID range (0..1) Signed-off-by: Joel Nider <jnider@codeaurora.org>
This commit is contained in:
committed by
Bryan Huntsman
parent
d783499ad3
commit
5578bdb65d
@@ -91,6 +91,7 @@
|
||||
#define TSIF_CHUNKS_IN_BUF (tsif_device->chunks_per_buf)
|
||||
#define TSIF_PKTS_IN_BUF (TSIF_PKTS_IN_CHUNK * TSIF_CHUNKS_IN_BUF)
|
||||
#define TSIF_BUF_SIZE (TSIF_PKTS_IN_BUF * TSIF_PKT_SIZE)
|
||||
#define TSIF_MAX_ID 1
|
||||
|
||||
#define ROW_RESET (MSM_CLK_CTL_BASE + 0x214)
|
||||
#define GLBL_CLK_ENA (MSM_CLK_CTL_BASE + 0x000)
|
||||
@@ -1267,8 +1268,8 @@ static int __devinit msm_tsif_probe(struct platform_device *pdev)
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
/*TODO macro for max. id*/
|
||||
if ((pdev->id < 0) || (pdev->id > 0)) {
|
||||
|
||||
if ((pdev->id < 0) || (pdev->id > TSIF_MAX_ID)) {
|
||||
dev_err(&pdev->dev, "Invalid device ID %d\n", pdev->id);
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
@@ -1426,9 +1427,21 @@ static void __exit mod_exit(void)
|
||||
|
||||
/* public API */
|
||||
|
||||
int tsif_get_active(void)
|
||||
{
|
||||
struct msm_tsif_device *tsif_device;
|
||||
list_for_each_entry(tsif_device, &tsif_devices, devlist) {
|
||||
return tsif_device->pdev->id;
|
||||
}
|
||||
return -ENODEV;
|
||||
}
|
||||
EXPORT_SYMBOL(tsif_get_active);
|
||||
|
||||
void *tsif_attach(int id, void (*notify)(void *client_data), void *data)
|
||||
{
|
||||
struct msm_tsif_device *tsif_device = tsif_find_by_id(id);
|
||||
if (!tsif_device)
|
||||
return ERR_PTR(-ENODEV);
|
||||
if (tsif_device->client_notify || tsif_device->client_data)
|
||||
return ERR_PTR(-EBUSY);
|
||||
tsif_device->client_notify = notify;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Character device that, being read
|
||||
* returns stream of TSIF packets.
|
||||
*
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum. All rights
|
||||
* Copyright (c) 2009-2011, Code Aurora Forum. All rights
|
||||
* reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -186,6 +186,7 @@ struct tsif_chrdev the_devices[TSIF_NUM_DEVS];
|
||||
static int __init mod_init(void)
|
||||
{
|
||||
int rc;
|
||||
int instance;
|
||||
rc = alloc_chrdev_region(&tsif_dev, 0, TSIF_NUM_DEVS, "tsif");
|
||||
if (rc) {
|
||||
pr_err("alloc_chrdev_region failed: %d\n", rc);
|
||||
@@ -198,7 +199,11 @@ static int __init mod_init(void)
|
||||
pr_err("Error creating tsif class: %d\n", rc);
|
||||
goto err_class;
|
||||
}
|
||||
rc = tsif_init_one(&the_devices[0], 0);
|
||||
instance = tsif_get_active();
|
||||
if (instance >= 0)
|
||||
rc = tsif_init_one(&the_devices[0], instance);
|
||||
else
|
||||
rc = instance;
|
||||
if (rc)
|
||||
goto err_init1;
|
||||
return 0;
|
||||
|
||||
@@ -104,6 +104,13 @@ enum tsif_state {
|
||||
tsif_state_error = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
* tsif_get_active - return active tsif hardware instance
|
||||
*
|
||||
* Return TSIF instance to use (selected by CONFIG_MSM_USE_TSIF1)
|
||||
*/
|
||||
int tsif_get_active(void);
|
||||
|
||||
/**
|
||||
* tsif_attach - Attach to the device.
|
||||
* @id: TSIF device ID, used to identify TSIF instance.
|
||||
|
||||
Reference in New Issue
Block a user