Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 120046
b: refs/heads/master
c: 090d951
h: refs/heads/master
v: v3
  • Loading branch information
Magnus Damm authored and Paul Mundt committed Dec 22, 2008
1 parent e183565 commit 948c38c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a5616bd0f19730a780c354110454ce37209f1ded
refs/heads/master: 090d951b69f29a8d5777c63570d4cd61d7efeb22
2 changes: 1 addition & 1 deletion trunk/arch/sh/boards/mach-migor/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ static struct resource sh_keysc_resources[] = {

static struct platform_device sh_keysc_device = {
.name = "sh_keysc",
.id = 0, /* "keysc0" clock */
.num_resources = ARRAY_SIZE(sh_keysc_resources),
.resource = sh_keysc_resources,
.dev = {
Expand Down Expand Up @@ -479,7 +480,6 @@ static int __init migor_devices_setup(void)
ctrl_outl(0x00110080, BSC_CS4WCR);

/* KEYSC */
clk_always_enable("mstp214"); /* KEYSC */
gpio_request(GPIO_FN_KEYOUT0, NULL);
gpio_request(GPIO_FN_KEYOUT1, NULL);
gpio_request(GPIO_FN_KEYOUT2, NULL);
Expand Down
3 changes: 1 addition & 2 deletions trunk/arch/sh/boards/mach-se/7722/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ static struct resource sh_keysc_resources[] = {

static struct platform_device sh_keysc_device = {
.name = "sh_keysc",
.id = 0, /* "keysc0" clock */
.num_resources = ARRAY_SIZE(sh_keysc_resources),
.resource = sh_keysc_resources,
.dev = {
Expand All @@ -146,8 +147,6 @@ static struct platform_device *se7722_devices[] __initdata = {

static int __init se7722_devices_setup(void)
{
clk_always_enable("mstp214"); /* KEYSC */

return platform_add_devices(se7722_devices,
ARRAY_SIZE(se7722_devices));
}
Expand Down
28 changes: 23 additions & 5 deletions trunk/drivers/input/keyboard/sh_keysc.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/input.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <asm/sh_keysc.h>

Expand All @@ -39,6 +40,7 @@ static const struct {

struct sh_keysc_priv {
void __iomem *iomem_base;
struct clk *clk;
unsigned long last_keys;
struct input_dev *input;
struct sh_keysc_info pdata;
Expand Down Expand Up @@ -125,6 +127,7 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev)
struct sh_keysc_info *pdata;
struct resource *res;
struct input_dev *input;
char clk_name[8];
int i, k;
int irq, error;

Expand Down Expand Up @@ -165,11 +168,19 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev)
goto err1;
}

snprintf(clk_name, sizeof(clk_name), "keysc%d", pdev->id);
priv->clk = clk_get(&pdev->dev, clk_name);
if (IS_ERR(priv->clk)) {
dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name);
error = PTR_ERR(priv->clk);
goto err2;
}

priv->input = input_allocate_device();
if (!priv->input) {
dev_err(&pdev->dev, "failed to allocate input device\n");
error = -ENOMEM;
goto err2;
goto err3;
}

input = priv->input;
Expand All @@ -187,7 +198,7 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev)
error = request_irq(irq, sh_keysc_isr, 0, pdev->name, pdev);
if (error) {
dev_err(&pdev->dev, "failed to request IRQ\n");
goto err3;
goto err4;
}

for (i = 0; i < SH_KEYSC_MAXKEYS; i++) {
Expand All @@ -199,18 +210,22 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev)
error = input_register_device(input);
if (error) {
dev_err(&pdev->dev, "failed to register input device\n");
goto err4;
goto err5;
}

clk_enable(priv->clk);

iowrite16((sh_keysc_mode[pdata->mode].kymd << 8) |
pdata->scan_timing, priv->iomem_base + KYCR1_OFFS);
iowrite16(0, priv->iomem_base + KYOUTDR_OFFS);
iowrite16(KYCR2_IRQ_LEVEL, priv->iomem_base + KYCR2_OFFS);
return 0;
err4:
err5:
free_irq(irq, pdev);
err3:
err4:
input_free_device(input);
err3:
clk_put(priv->clk);
err2:
iounmap(priv->iomem_base);
err1:
Expand All @@ -230,6 +245,9 @@ static int __devexit sh_keysc_remove(struct platform_device *pdev)
free_irq(platform_get_irq(pdev, 0), pdev);
iounmap(priv->iomem_base);

clk_disable(priv->clk);
clk_put(priv->clk);

platform_set_drvdata(pdev, NULL);
kfree(priv);
return 0;
Expand Down

0 comments on commit 948c38c

Please sign in to comment.