>>-----Original Message----- >>From: Menon, Nishanth >>Sent: Friday, August 06, 2010 3:54 AM >>To: linux-omap >>Cc: Menon, Nishanth; Kevin Hilman; Gopinath, Thara >>Subject: [PM-SR][PATCH 09/12] omap3: sr: enable/disable sr only if required >> >>We dont need to go down the path of enabling/disabling the SR >>if we dont need to. do some sanity check and trigger if needed >> >>Cc: Kevin Hilman <khilman@xxxxxxxxxxxxxxxxxxx> >>Cc: Thara Gopinath <thara@xxxxxx> >> >>Signed-off-by: Nishanth Menon <nm@xxxxxx> >>--- >> arch/arm/mach-omap2/smartreflex.c | 19 +++++++++++++++---- >> 1 files changed, 15 insertions(+), 4 deletions(-) >> >>diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c >>index d63691b..9b5a10e 100644 >>--- a/arch/arm/mach-omap2/smartreflex.c >>+++ b/arch/arm/mach-omap2/smartreflex.c >>@@ -778,15 +778,26 @@ static int omap_sr_autocomp_show(void *data, u64 *val) >> static int omap_sr_autocomp_store(void *data, u64 val) >> { >> struct omap_sr *sr_info = (struct omap_sr *) data; >>+ u32 value = (u32) val; >> >> if (!sr_info) { >> pr_warning("%s: omap_sr struct for SR not found\n", __func__); >> return -EINVAL; >> } >>- if (!val) >>- sr_stop_vddautocomp(sr_info); >>- else >>- sr_start_vddautocomp(sr_info); >>+ >>+ /* Sanity check */ >>+ if (value && (value != 1)) { >>+ pr_err("%s: invalid value %d\n", __func__, value); >>+ return -EINVAL; >>+ } Will take this in. >>+ >>+ /* change only if needed */ >>+ if (sr_info->is_autocomp_active ^ value) { I do not think this is necessary. sr_start_vddautocomp and sr_stop_vddautocomp will take care of enabling and disabling intelligently. Regards Thara >>+ if (!val) >>+ sr_stop_vddautocomp(sr_info); >>+ else >>+ sr_start_vddautocomp(sr_info); >>+ } >> return 0; >> } >> >>-- >>1.6.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html