From: Alberto Panizzo <maramaopercheseimorto@gmail.com>
To: "Lothar Waßmann" <LW@KARO-electronics.de>
Cc: linux-input <linux-input@vger.kernel.org>,
H Hartley Sweeten <hartleys@visionengravers.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Sascha linux-arm <s.hauer@pengutronix.de>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v3] input: MXC: add mxc-keypad driver to support the Keypad Port present in the mxc application processors family.
Date: Wed, 27 Jan 2010 13:14:12 +0100 [thread overview]
Message-ID: <1264594452.2463.62.camel@realization> (raw)
In-Reply-To: <19296.5728.557535.920849@ipc1.ka-ro>
Hi Lothar,
On mer, 2010-01-27 at 11:33 +0100, Lothar Waßmann wrote:
> Hi,
>
> Alberto Panizzo writes:
> [...]
> > +#include <linux/input/matrix_keypad.h>
> > +
> > +#define MAX_MATRIX_KEY_ROWS (8)
> > +#define MAX_MATRIX_KEY_COLS (8)
> > +#define MATRIX_ROW_SHIFT (3)
> > +
> pointless '()'
Ok.
> > [...]
> > +
> > + /* Configure columns as output, rows as input (KDDR[15:0]) */
> > + reg_val = readw(keypad->mmio_base + KDDR);
> > + reg_val |= 0xff00;
> > + reg_val &= 0xff00;
> >
> This is effectively the same as: 'reg_val = 0xff00;' which makes the
> readw() above pointless. Was this really intended?
>
> > + writew(reg_val, keypad->mmio_base + KDDR);
Yes, it should be instead:
writew(0xff00, keypad->mmio_base + KDDR);
> > [...]
> > + /* Sanity control, not all the rows must be to 0s now. */
> > + if ((readw(keypad->mmio_base + KPDR) & keypad->rows_en_mask) == 0) {
> > + dev_err(&dev->dev, "Too much keys pressed for now, "
> > + "control pins initialisation\n");
> >
> It helps grepping for a message, if it is not split into multiple
> lines.
Ok.
>
> > [...]
> > +
> > + irq = platform_get_irq(pdev, 0);
> > + if (irq < 0) {
> > + dev_err(&pdev->dev, "failed to get keypad irq\n");
> > + return -ENXIO;
> > + }
> >
> This should be -ENODEV.
>
Lot of reference keyboard driver use -ENXIO..
May should be better: return irq ?
> > +
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + if (res == NULL) {
> > + dev_err(&pdev->dev, "failed to get I/O memory\n");
> > + return -ENXIO;
> >
> same as above.
same as above?
> > +
> > + keypad->pdata = pdata;
> > + keypad->input_dev = input_dev;
> > + keypad->irq = irq;
> > +
> > + keypad->mmio_base = ioremap(res->start, resource_size(res));
> > + if (keypad->mmio_base == NULL) {
> > + dev_err(&pdev->dev, "failed to remap I/O memory\n");
> > + error = -ENXIO;
> >
> -ENOMEM;
Ok.
>
> > + goto failed_free_priv;
> > + }
> > +
> > + keypad->clk = clk_get(NULL, "kpp");
> >
> clk_get(&pdev->dev, "kpp");
>
Ok.
Alberto!
--
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
WARNING: multiple messages have this Message-ID (diff)
From: maramaopercheseimorto@gmail.com (Alberto Panizzo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3] input: MXC: add mxc-keypad driver to support the Keypad Port present in the mxc application processors family.
Date: Wed, 27 Jan 2010 13:14:12 +0100 [thread overview]
Message-ID: <1264594452.2463.62.camel@realization> (raw)
In-Reply-To: <19296.5728.557535.920849@ipc1.ka-ro>
Hi Lothar,
On mer, 2010-01-27 at 11:33 +0100, Lothar Wa?mann wrote:
> Hi,
>
> Alberto Panizzo writes:
> [...]
> > +#include <linux/input/matrix_keypad.h>
> > +
> > +#define MAX_MATRIX_KEY_ROWS (8)
> > +#define MAX_MATRIX_KEY_COLS (8)
> > +#define MATRIX_ROW_SHIFT (3)
> > +
> pointless '()'
Ok.
> > [...]
> > +
> > + /* Configure columns as output, rows as input (KDDR[15:0]) */
> > + reg_val = readw(keypad->mmio_base + KDDR);
> > + reg_val |= 0xff00;
> > + reg_val &= 0xff00;
> >
> This is effectively the same as: 'reg_val = 0xff00;' which makes the
> readw() above pointless. Was this really intended?
>
> > + writew(reg_val, keypad->mmio_base + KDDR);
Yes, it should be instead:
writew(0xff00, keypad->mmio_base + KDDR);
> > [...]
> > + /* Sanity control, not all the rows must be to 0s now. */
> > + if ((readw(keypad->mmio_base + KPDR) & keypad->rows_en_mask) == 0) {
> > + dev_err(&dev->dev, "Too much keys pressed for now, "
> > + "control pins initialisation\n");
> >
> It helps grepping for a message, if it is not split into multiple
> lines.
Ok.
>
> > [...]
> > +
> > + irq = platform_get_irq(pdev, 0);
> > + if (irq < 0) {
> > + dev_err(&pdev->dev, "failed to get keypad irq\n");
> > + return -ENXIO;
> > + }
> >
> This should be -ENODEV.
>
Lot of reference keyboard driver use -ENXIO..
May should be better: return irq ?
> > +
> > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + if (res == NULL) {
> > + dev_err(&pdev->dev, "failed to get I/O memory\n");
> > + return -ENXIO;
> >
> same as above.
same as above?
> > +
> > + keypad->pdata = pdata;
> > + keypad->input_dev = input_dev;
> > + keypad->irq = irq;
> > +
> > + keypad->mmio_base = ioremap(res->start, resource_size(res));
> > + if (keypad->mmio_base == NULL) {
> > + dev_err(&pdev->dev, "failed to remap I/O memory\n");
> > + error = -ENXIO;
> >
> -ENOMEM;
Ok.
>
> > + goto failed_free_priv;
> > + }
> > +
> > + keypad->clk = clk_get(NULL, "kpp");
> >
> clk_get(&pdev->dev, "kpp");
>
Ok.
Alberto!
next prev parent reply other threads:[~2010-01-27 12:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-27 9:55 [PATCH v3] input: MXC: add mxc-keypad driver to support the Keypad Port present in the mxc application processors family Alberto Panizzo
2010-01-27 9:55 ` Alberto Panizzo
2010-01-27 10:33 ` Lothar Waßmann
2010-01-27 10:33 ` Lothar Waßmann
2010-01-27 10:45 ` Uwe Kleine-König
2010-01-27 10:45 ` Uwe Kleine-König
2010-01-27 12:17 ` Alberto Panizzo
2010-01-27 12:17 ` Alberto Panizzo
2010-01-27 12:14 ` Alberto Panizzo [this message]
2010-01-27 12:14 ` Alberto Panizzo
2010-01-27 12:18 ` Lothar Waßmann
2010-01-27 12:18 ` Lothar Waßmann
2010-01-27 14:39 ` Alberto Panizzo
2010-01-27 14:39 ` Alberto Panizzo
2010-01-27 14:52 ` Lothar Waßmann
2010-01-27 14:52 ` Lothar Waßmann
2010-01-27 15:29 ` Alberto Panizzo
2010-01-27 15:29 ` Alberto Panizzo
2010-01-27 17:03 ` Lothar Waßmann
2010-01-27 17:03 ` Lothar Waßmann
2010-01-27 17:32 ` Dmitry Torokhov
2010-01-27 17:32 ` Dmitry Torokhov
2010-01-27 17:42 ` Alberto Panizzo
2010-01-27 17:42 ` Alberto Panizzo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1264594452.2463.62.camel@realization \
--to=maramaopercheseimorto@gmail.com \
--cc=LW@KARO-electronics.de \
--cc=dmitry.torokhov@gmail.com \
--cc=hartleys@visionengravers.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-input@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.