Re: [PATCH 1/2] DSPBRIDGE: remove dependency of mpu freq

2010-01-20 Thread Nishanth Menon

Dasgupta, Romit had written, on 01/21/2010 01:45 AM, the following:

@@ -67,6 +92,9 @@ module_init(dspbridge_init);
 
 static void __exit dspbridge_exit(void)

 {
+   struct dspbridge_platform_data *pdata = &dspbridge_pdata;
+   kfree(pdata->mpu_speeds);
+   kfree(pdata->dsp_freq_table);
platform_device_unregister(dspbridge_pdev);
 }
 module_exit(dspbridge_exit);


Ok if pdata->mpu_speeds, pdata->dsp_freq_table are NULL to start with, then you
need to make them NULL after kfree as well. Otherwise next time you insert the
module it may fail if pdata_mpu_speeds is initialized but pdata->dsp_freq_table
is not.

Good catch. thanks.

--
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] DSPBRIDGE: remove dependency of mpu freq

2010-01-20 Thread Romit Dasgupta
> @@ -67,6 +92,9 @@ module_init(dspbridge_init);
>  
>  static void __exit dspbridge_exit(void)
>  {
> + struct dspbridge_platform_data *pdata = &dspbridge_pdata;
> + kfree(pdata->mpu_speeds);
> + kfree(pdata->dsp_freq_table);
>   platform_device_unregister(dspbridge_pdev);
>  }
>  module_exit(dspbridge_exit);

Ok if pdata->mpu_speeds, pdata->dsp_freq_table are NULL to start with, then you
need to make them NULL after kfree as well. Otherwise next time you insert the
module it may fail if pdata_mpu_speeds is initialized but pdata->dsp_freq_table
is not.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] DSPBRIDGE: remove dependency of mpu freq

2010-01-20 Thread Nishanth Menon

Dasgupta, Romit had written, on 01/21/2010 01:40 AM, the following:

Romit Dasgupta wrote:

diff --git a/arch/arm/mach-omap2/dspbridge.c b/arch/arm/mach-omap2/dspbridge.c
+
 static int __init dspbridge_init(void)
 {
struct platform_device *pdev;
@@ -48,6 +65,10 @@ static int __init dspbridge_init(void)
if (!pdev)
goto err_out;
 
+	err = get_opp_table(pdata);

+   if (err)
+   goto err_out;
+
err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
if (err)
goto err_out;
@@ -60,6 +81,10 @@ static int __init dspbridge_init(void)
return 0;
 
 err_out:

+   kfree(pdata->mpu_speeds);
+   kfree(pdata->dsp_freq_table);

Are we sure that pdata->dsp_freq_table is NULL before initialization?
Looking at your second part of the patch. You seem to invoke kfree for
pdata->dsp_freq_table even if pdata->dsp_freq_table is not allocated.
So my question is :

missed the last part of the mail. If pdata->dsp_freq_table is NULL to start
with. This is ok. Otherwise this needs to be changed.

;) yep it is NULL to start with as the same file passes pdata from:
static struct dspbridge_platform_data dspbridge_pdata __initdata
and kfree is NULL safe :D.

--
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] DSPBRIDGE: remove dependency of mpu freq

2010-01-20 Thread Romit Dasgupta
Romit Dasgupta wrote:
>> diff --git a/arch/arm/mach-omap2/dspbridge.c 
>> b/arch/arm/mach-omap2/dspbridge.c
>> +
>>  static int __init dspbridge_init(void)
>>  {
>>  struct platform_device *pdev;
>> @@ -48,6 +65,10 @@ static int __init dspbridge_init(void)
>>  if (!pdev)
>>  goto err_out;
>>  
>> +err = get_opp_table(pdata);
>> +if (err)
>> +goto err_out;
>> +
>>  err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
>>  if (err)
>>  goto err_out;
>> @@ -60,6 +81,10 @@ static int __init dspbridge_init(void)
>>  return 0;
>>  
>>  err_out:
>> +kfree(pdata->mpu_speeds);
>> +kfree(pdata->dsp_freq_table);
> Are we sure that pdata->dsp_freq_table is NULL before initialization?
> Looking at your second part of the patch. You seem to invoke kfree for
> pdata->dsp_freq_table even if pdata->dsp_freq_table is not allocated.
> So my question is :
missed the last part of the mail. If pdata->dsp_freq_table is NULL to start
with. This is ok. Otherwise this needs to be changed.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] DSPBRIDGE: remove dependency of mpu freq

2010-01-20 Thread Romit Dasgupta
> 
> diff --git a/arch/arm/mach-omap2/dspbridge.c b/arch/arm/mach-omap2/dspbridge.c
> +
>  static int __init dspbridge_init(void)
>  {
>   struct platform_device *pdev;
> @@ -48,6 +65,10 @@ static int __init dspbridge_init(void)
>   if (!pdev)
>   goto err_out;
>  
> + err = get_opp_table(pdata);
> + if (err)
> + goto err_out;
> +
>   err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
>   if (err)
>   goto err_out;
> @@ -60,6 +81,10 @@ static int __init dspbridge_init(void)
>   return 0;
>  
>  err_out:
> + kfree(pdata->mpu_speeds);
> + kfree(pdata->dsp_freq_table);
Are we sure that pdata->dsp_freq_table is NULL before initialization?
Looking at your second part of the patch. You seem to invoke kfree for
pdata->dsp_freq_table even if pdata->dsp_freq_table is not allocated.
So my question is :
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] DSPBRIDGE: remove dependency of mpu freq

2010-01-20 Thread Nishanth Menon
Current DSPBridge uses hardcoded logic which is not scalable
across OMAP3 silicons. introduce a structure based implementation
this allows for dsp frequency table indices to be generated runtime
instead of being compile time.

Cc: Ameya Palande 
Cc: Deepak Chitriki 
Cc: Felipe Contreras 
Cc: Hiroshi Doyu 
Cc: Omar Ramirez Luna 

Signed-off-by: Nishanth Menon 
---
 arch/arm/mach-omap2/dspbridge.c|   28 +
 arch/arm/plat-omap/include/dspbridge/host_os.h |   13 +++-
 drivers/dsp/bridge/rmgr/drv_interface.c|   38 
 drivers/dsp/bridge/rmgr/node.c |4 +-
 drivers/dsp/bridge/rmgr/proc.c |4 +-
 drivers/dsp/bridge/wmd/io_sm.c |   20 
 6 files changed, 51 insertions(+), 56 deletions(-)

diff --git a/arch/arm/mach-omap2/dspbridge.c b/arch/arm/mach-omap2/dspbridge.c
index ea109a3..26b860f 100644
--- a/arch/arm/mach-omap2/dspbridge.c
+++ b/arch/arm/mach-omap2/dspbridge.c
@@ -30,6 +30,23 @@ static struct dspbridge_platform_data dspbridge_pdata 
__initdata = {
 #endif
 };
 
+/**
+ * get_opp_table() - populate the pdata with opp info
+ * @pdata: pointer to pdata
+ *
+ * OPP table implementation is a variant b/w platforms.
+ * the platform file now incorporates this into the build
+ * itself and uses the interface to talk to platform specific
+ * functions
+ */
+static int get_opp_table(struct dspbridge_platform_data *pdata)
+{
+#ifdef CONFIG_BRIDGE_DVFS
+   /* Do nothing now  - fill based on PM implementation */
+#endif
+   return 0;
+}
+
 static int __init dspbridge_init(void)
 {
struct platform_device *pdev;
@@ -48,6 +65,10 @@ static int __init dspbridge_init(void)
if (!pdev)
goto err_out;
 
+   err = get_opp_table(pdata);
+   if (err)
+   goto err_out;
+
err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
if (err)
goto err_out;
@@ -60,6 +81,10 @@ static int __init dspbridge_init(void)
return 0;
 
 err_out:
+   kfree(pdata->mpu_speeds);
+   kfree(pdata->dsp_freq_table);
+   pdata->mpu_speeds = NULL;
+   pdata->dsp_freq_table = NULL;
platform_device_put(pdev);
return err;
 }
@@ -67,6 +92,9 @@ module_init(dspbridge_init);
 
 static void __exit dspbridge_exit(void)
 {
+   struct dspbridge_platform_data *pdata = &dspbridge_pdata;
+   kfree(pdata->mpu_speeds);
+   kfree(pdata->dsp_freq_table);
platform_device_unregister(dspbridge_pdev);
 }
 module_exit(dspbridge_exit);
diff --git a/arch/arm/plat-omap/include/dspbridge/host_os.h 
b/arch/arm/plat-omap/include/dspbridge/host_os.h
index 066c4d7..ebf6a80 100644
--- a/arch/arm/plat-omap/include/dspbridge/host_os.h
+++ b/arch/arm/plat-omap/include/dspbridge/host_os.h
@@ -54,12 +54,23 @@
 #define INT_MAIL_MPU_IRQ26
 #define INT_DSP_MMU_IRQ28
 
+struct dsp_shm_freq_table {
+   unsigned long u_volts;
+   unsigned long dsp_freq;
+   unsigned long thresh_min_freq;
+   unsigned long thresh_max_freq;
+};
 struct dspbridge_platform_data {
void(*dsp_set_min_opp)(u8 opp_id);
u8  (*dsp_get_opp)(void);
void(*cpu_set_freq)(unsigned long f);
unsigned long (*cpu_get_freq)(void);
-   unsigned long mpu_speed[6];
+   unsigned long *mpu_speeds;
+   u8 mpu_num_speeds;
+   unsigned long mpu_min_speed;
+   unsigned long mpu_max_speed;
+   struct dsp_shm_freq_table *dsp_freq_table;
+   u8 dsp_num_speeds;
 
u32 phys_mempool_base;
u32 phys_mempool_size;
diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c 
b/drivers/dsp/bridge/rmgr/drv_interface.c
index d8fe250..9330f44 100644
--- a/drivers/dsp/bridge/rmgr/drv_interface.c
+++ b/drivers/dsp/bridge/rmgr/drv_interface.c
@@ -169,44 +169,12 @@ static struct file_operations bridge_fops = {
 static u32 timeOut = 1000;
 #ifdef CONFIG_BRIDGE_DVFS
 static struct clk *clk_handle;
-s32 dsp_max_opps = VDD1_OPP5;
 #endif
 
-/* Maximum Opps that can be requested by IVA*/
-/*vdd1 rate table*/
-#ifdef CONFIG_BRIDGE_DVFS
-const struct omap_opp  vdd1_rate_table_bridge[] = {
-   {0, 0, 0},
-   /*OPP1*/
-   {S125M, VDD1_OPP1, 0},
-   /*OPP2*/
-   {S250M, VDD1_OPP2, 0},
-   /*OPP3*/
-   {S500M, VDD1_OPP3, 0},
-   /*OPP4*/
-   {S550M, VDD1_OPP4, 0},
-   /*OPP5*/
-   {S600M, VDD1_OPP5, 0},
-};
-#endif
 #endif
 
 struct dspbridge_platform_data *omap_dspbridge_pdata;
 
-u32 vdd1_dsp_freq[6][4] = {
-   {0, 0, 0, 0},
-   /*OPP1*/
-   {0, 9, 0, 86000},
-   /*OPP2*/
-   {0, 18, 8, 17},
-   /*OPP3*/
-   {0, 36, 16, 34},
-   /*OPP4*/
-   {0, 396000, 325000, 376000},
-   /*OPP5*/
-   {0, 43, 355000, 43},
-};
-
 #ifdef CONFIG_BRIDGE_DVFS
 static int dspbridge_post_scale(struct notifier_block *op, unsigned long level,
void *ptr)
@