diff mbox

[2/3] Input: spear-keyboard: Add clk_{un}prepare() support

Message ID 27d9eea3815593df228c85958096bc14d7985e7e.1352381962.git.viresh.kumar@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Viresh Kumar Nov. 8, 2012, 1:40 p.m. UTC
From: Vipul Kumar Samar <vipulkumar.samar@st.com>

clk_{un}prepare is mandatory for platforms using common clock framework. Because
for SPEAr we don't do anything in clk_{un}prepare() calls, just call them ones
in probe/remove.

Signed-off-by: Vipul Kumar Samar <vipulkumar.samar@st.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/input/keyboard/spear-keyboard.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

Viresh Kumar Nov. 12, 2012, 5:57 a.m. UTC | #1
On 8 November 2012 19:10, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> From: Vipul Kumar Samar <vipulkumar.samar@st.com>
>
> clk_{un}prepare is mandatory for platforms using common clock framework. Because
> for SPEAr we don't do anything in clk_{un}prepare() calls, just call them ones
> in probe/remove.
>
> Signed-off-by: Vipul Kumar Samar <vipulkumar.samar@st.com>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Missed applying this one ?
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Viresh Kumar Nov. 20, 2012, 7:56 a.m. UTC | #2
On 12 November 2012 11:27, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 8 November 2012 19:10, Viresh Kumar <viresh.kumar@linaro.org> wrote:
>> From: Vipul Kumar Samar <vipulkumar.samar@st.com>
>>
>> clk_{un}prepare is mandatory for platforms using common clock framework. Because
>> for SPEAr we don't do anything in clk_{un}prepare() calls, just call them ones
>> in probe/remove.
>>
>> Signed-off-by: Vipul Kumar Samar <vipulkumar.samar@st.com>
>> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
>
> Missed applying this one ?

This one you missed :)
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dmitry Torokhov Nov. 20, 2012, 8:47 a.m. UTC | #3
On Tue, Nov 20, 2012 at 01:26:29PM +0530, Viresh Kumar wrote:
> On 12 November 2012 11:27, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > On 8 November 2012 19:10, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> >> From: Vipul Kumar Samar <vipulkumar.samar@st.com>
> >>
> >> clk_{un}prepare is mandatory for platforms using common clock framework. Because
> >> for SPEAr we don't do anything in clk_{un}prepare() calls, just call them ones
> >> in probe/remove.
> >>
> >> Signed-off-by: Vipul Kumar Samar <vipulkumar.samar@st.com>
> >> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> >
> > Missed applying this one ?
> 
> This one you missed :)

No, not really, it just does not work well with devm_* patches that got
applied: on removal you unprepare clock as the very first operation and
then devm_* does the rest which is wrong order.

I am looking at adding dem_* for clocks.

Thanks.
Viresh Kumar Nov. 20, 2012, 8:54 a.m. UTC | #4
On 20 November 2012 14:17, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:

> No, not really, it just does not work well with devm_* patches that got
> applied: on removal you unprepare clock as the very first operation and
> then devm_* does the rest which is wrong order.

Nice. I don't expect the order would do anything wrong, as we aren't
touching any registers between unpreparing clock and devm_ undo stuff.

> I am looking at adding dem_* for clocks.

You mean, adding devm_clk_prepare, devm_clk_enable, devm_clk_prepare_enable ?
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Viresh Kumar Nov. 26, 2012, 4:27 p.m. UTC | #5
On 20 November 2012 14:17, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> No, not really, it just does not work well with devm_* patches that got
> applied: on removal you unprepare clock as the very first operation and
> then devm_* does the rest which is wrong order.
>
> I am looking at adding dem_* for clocks.

I haven't seen your clock patch in your tree. I am asking because i want to
push this patch :)

You want me to repost it over your patches.

--
viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
index 1d24fb2..9792924 100644
--- a/drivers/input/keyboard/spear-keyboard.c
+++ b/drivers/input/keyboard/spear-keyboard.c
@@ -245,6 +245,10 @@  static int __devinit spear_kbd_probe(struct platform_device *pdev)
 		goto err_free_mem;
 	}
 
+	error = clk_prepare(kbd->clk);
+	if (error)
+		goto err_free_mem;
+
 	input_dev->name = "Spear Keyboard";
 	input_dev->phys = "keyboard/input0";
 	input_dev->dev.parent = &pdev->dev;
@@ -259,7 +263,7 @@  static int __devinit spear_kbd_probe(struct platform_device *pdev)
 					   kbd->keycodes, input_dev);
 	if (error) {
 		dev_err(&pdev->dev, "Failed to build keymap\n");
-		goto err_free_mem;
+		goto err_unprepare_clk;
 	}
 
 	if (kbd->rep)
@@ -272,13 +276,13 @@  static int __devinit spear_kbd_probe(struct platform_device *pdev)
 			"keyboard", kbd);
 	if (error) {
 		dev_err(&pdev->dev, "request_irq fail\n");
-		goto err_free_mem;
+		goto err_unprepare_clk;
 	}
 
 	error = input_register_device(input_dev);
 	if (error) {
 		dev_err(&pdev->dev, "Unable to register keyboard device\n");
-		goto err_free_mem;
+		goto err_unprepare_clk;
 	}
 
 	device_init_wakeup(&pdev->dev, 1);
@@ -286,6 +290,8 @@  static int __devinit spear_kbd_probe(struct platform_device *pdev)
 
 	return 0;
 
+err_unprepare_clk:
+	clk_unprepare(kbd->clk);
 err_free_mem:
 	input_free_device(input_dev);
 
@@ -297,6 +303,7 @@  static int __devexit spear_kbd_remove(struct platform_device *pdev)
 	struct spear_kbd *kbd = platform_get_drvdata(pdev);
 
 	input_unregister_device(kbd->input);
+	clk_unprepare(kbd->clk);
 
 	device_init_wakeup(&pdev->dev, 0);
 	platform_set_drvdata(pdev, NULL);