From: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Fabio Estevam <festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Dmitry Torokhov
<dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
Sascha Hauer <kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Subject: Re: [PATCH 1/3] mfd: fsl imx25 Touchscreen ADC driver
Date: Fri, 21 Feb 2014 10:18:44 +0100 [thread overview]
Message-ID: <20140221091844.GB24758@pengutronix.de> (raw)
In-Reply-To: <CAOMZO5BDyyvXs9CxJQOkuEpxZ8fqamCPB67sNhJxES+XU2XkXQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 8010 bytes --]
Hi Fabio,
On Thu, Feb 20, 2014 at 02:17:33PM -0300, Fabio Estevam wrote:
> Hi Markus,
>
> On Thu, Feb 20, 2014 at 1:21 PM, Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> > This is the core driver for imx25 touchscreen/adc driver. The module
> > has one shared ADC and two different conversion queues which use the
> > ADC. The two queues are identical. Both can be used for general purpose
> > ADC but one is meant to be used for touchscreens.
> >
> > This driver is the core which manages the central components and
> > registers of the TSC/ADC unit. It manages the IRQs and forwards them to
> > the correct components.
> >
> > Signed-off-by: Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
>
> That's great :-) Nice work!
Thanks :)
> > ---
> > .../devicetree/bindings/mfd/fsl-imx25-tsadc.txt | 46 ++++
> > drivers/mfd/Kconfig | 9 +
> > drivers/mfd/Makefile | 2 +
> > drivers/mfd/fsl-imx25-tsadc.c | 234 +++++++++++++++++++++
> > include/linux/mfd/imx25-tsadc.h | 138 ++++++++++++
> > 5 files changed, 429 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt
> > create mode 100644 drivers/mfd/fsl-imx25-tsadc.c
> > create mode 100644 include/linux/mfd/imx25-tsadc.h
> >
> > diff --git a/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt b/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt
> > new file mode 100644
> > index 0000000..a857af0e
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mfd/fsl-imx25-tsadc.txt
> > @@ -0,0 +1,46 @@
> > +Freescale mx25 ADC/TSC multifunction device
> > +
> > +This device combines two general purpose conversion queues one used for general
> > +ADC and the other used for touchscreens.
> > +
> > +Required properties:
> > + - compatible: Should be "fsl,imx25-tsadc".
> > + - reg: Memory range of the device.
> > + - interrupts: Interrupt for this device as described in
> > + interrupts/interrupts.txt
> > + - clocks: An 'ipg' clock defined as described in clocks/clock.txt
> > + - interrupt-controller: This device is an interrupt controller. It controls
> > + the interrupts of both conversion queues.
> > + - #interrupt-cells: Should be '<1>'.
> > + - #address-cells: Should be '<1>'.
> > + - #size-cells: Should be '<1>'.
> > + - ranges
> > +
> > +This device includes two conversion queues which can be added as subnodes.
> > +The first queue is for the touchscreen, the second for general purpose ADC.
> > +
> > +Example:
> > + tscadc: tscadc@50030000 {
> > + compatible = "fsl,imx25-tsadc";
> > + reg = <0x50030000 0xc>;
> > + interrupts = <46>;
> > + clocks = <&clks 119>;
> > + clock-names = "ipg";
> > + interrupt-controller;
> > + #interrupt-cells = <1>;
> > + #address-cells = <1>;
> > + #size-cells = <1>;
> > + ranges;
> > +
> > + tsc: tcq@50030400 {
> > + compatible = "fsl,imx25-tcq";
> > + reg = <0x50030400 0x60>;
> > + ...
> > + };
> > +
> > + adc: gcq@50030800 {
> > + compatible = "fsl,imx25-gcq";
> > + reg = <0x50030800 0x60>;
> > + ...
> > + };
> > + };
>
> The meaning of 'tcq' and 'gcq' acronyms are not obvious. Could they be
> written more explicitily?
I assume you mean the node names? Perhaps something like 'adcqueue'?
>
> Also, what does the '...' mean?
>
> > +static int mx25_tsadc_domain_map(struct irq_domain *d, unsigned int irq,
> > + irq_hw_number_t hwirq)
> > +{
> > + struct mx25_tsadc_priv *priv = d->host_data;
> > +
> > + irq_set_chip_data(irq, priv);
> > + irq_set_chip_and_handler(irq, &mx25_tsadc_irq_chip,
> > + handle_level_irq);
> > +
> > +#ifdef CONFIG_ARM
> > + set_irq_flags(irq, IRQF_VALID);
> > +#else
> > + irq_set_noprobe(irq);
> > +#endif
>
> Do we really need these ifdef's? Can't we just assume that CONFIG_ARM
> is always selected for this driver?
Yes right, this is not necessary here.
>
> > +static int mx25_tsadc_probe(struct platform_device *pdev)
> > +{
> > + struct device *dev = &pdev->dev;
> > + struct device_node *np = dev->of_node;
> > + struct mx25_tsadc_priv *priv;
> > + struct resource *iores;
> > + int ret;
> > + void __iomem *iomem;
> > +
> > + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> > + if (!priv)
> > + return -ENOMEM;
> > +
> > + iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > + iomem = devm_ioremap_resource(dev, iores);
> > + if (IS_ERR(iomem)) {
> > + dev_err(dev, "Failed to remap iomem\n");
> > + return PTR_ERR(iomem);
> > + }
> > +
> > + priv->regs = regmap_init_mmio(dev, iomem, &mx25_tsadc);
> > + if (IS_ERR(priv->regs)) {
> > + dev_err(dev, "Failed to initialize regmap\n");
> > + return PTR_ERR(priv->regs);
> > + }
> > +
> > + priv->clk = devm_clk_get(dev, "ipg");
> > + if (IS_ERR(priv->clk)) {
> > + dev_err(dev, "Failed to get ipg clock\n");
> > + return PTR_ERR(priv->clk);
> > + }
> > +
> > + /* Enable clock and reset the component */
> > + regmap_update_bits(priv->regs, MX25_TSC_TGCR, MX25_TGCR_CLK_EN,
> > + MX25_TGCR_CLK_EN);
> > + regmap_update_bits(priv->regs, MX25_TSC_TGCR, MX25_TGCR_TSC_RST,
> > + MX25_TGCR_TSC_RST);
> > +
> > + /* Setup powersaving mode, but enable internal reference voltage */
> > + regmap_update_bits(priv->regs, MX25_TSC_TGCR, MX25_TGCR_POWERMODE_MASK,
> > + MX25_TGCR_POWERMODE_SAVE);
> > + regmap_update_bits(priv->regs, MX25_TSC_TGCR, MX25_TGCR_INTREFEN,
> > + MX25_TGCR_INTREFEN);
> > +
> > + ret = mx25_tsadc_setup_irq(pdev, priv);
> > + if (ret) {
> > + dev_err(dev, "Failed to setup irqs\n");
> > + return ret;
> > + }
> > +
> > + platform_set_drvdata(pdev, priv);
> > +
> > + of_platform_populate(np, NULL, NULL, dev);
> > +
> > + dev_info(dev, "i.MX25/25 Touchscreen and ADC core driver loaded\n");
>
> You could remove the double '25/25'.
Yes, fixed.
>
> > +
> > + return 0;
> > +}
> > +
> > +static const struct of_device_id mx25_tsadc_ids[] = {
> > + { .compatible = "fsl,imx25-tsadc", },
> > + { /* Sentinel */ }
> > +};
> > +
> > +static struct platform_driver mx25_tsadc_driver = {
> > + .driver = {
> > + .name = "mx25-tsadc",
> > + .owner = THIS_MODULE,
> > + .of_match_table = mx25_tsadc_ids,
> > + },
> > + .probe = mx25_tsadc_probe,
> > +};
> > +module_platform_driver(mx25_tsadc_driver);
> > +
> > +MODULE_DESCRIPTION("MFD for ADC/TSC for Freescale mx25");
> > +MODULE_AUTHOR("Markus Pargmann <mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>");
> > +MODULE_LICENSE("GPL v2");
>
> MODULE_ALIAS() as well?
I am not sure if this is necessary, but I added
MODULE_ALIAS("platform:mx25-tsadc")
Thanks,
Markus
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-02-21 9:18 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-20 16:21 [PATCH 0/3] arm imx25 touchscreen/ADC drivers Markus Pargmann
2014-02-20 16:21 ` [PATCH 1/3] mfd: fsl imx25 Touchscreen ADC driver Markus Pargmann
2014-02-20 17:17 ` Fabio Estevam
[not found] ` <CAOMZO5BDyyvXs9CxJQOkuEpxZ8fqamCPB67sNhJxES+XU2XkXQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-02-21 9:18 ` Markus Pargmann [this message]
2014-02-21 10:18 ` Markus Pargmann
2014-02-20 16:21 ` [PATCH 2/3] input: touchscreen: imx25 tcq driver Markus Pargmann
[not found] ` <1392913312-9030-3-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-02-23 6:44 ` Dmitry Torokhov
2014-02-25 11:05 ` Markus Pargmann
[not found] ` <1392913312-9030-1-git-send-email-mpa-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2014-02-20 16:21 ` [PATCH 3/3] iio: adc: fsl,imx25-gcq driver Markus Pargmann
2014-02-20 17:46 ` Lars-Peter Clausen
2014-02-21 10:12 ` Markus Pargmann
2014-06-13 15:21 ` Dust off the "arm imx25 touchscreen/ADC drivers" patch serie Denis Carikli
2014-06-13 15:21 ` [PATCH v2 1/6] mfd: fsl imx25 Touchscreen ADC driver Denis Carikli
[not found] ` <1402672899-6995-2-git-send-email-denis-fO0SIAKYzcbQT0dZR+AlfA@public.gmane.org>
2014-06-21 10:09 ` Jonathan Cameron
2014-06-13 15:21 ` [PATCH v2 2/6] input: touchscreen: imx25 tcq driver Denis Carikli
[not found] ` <1402672899-6995-3-git-send-email-denis-fO0SIAKYzcbQT0dZR+AlfA@public.gmane.org>
2014-06-15 7:27 ` Dmitry Torokhov
2014-06-21 10:18 ` Jonathan Cameron
2014-06-21 19:55 ` Fabio Estevam
[not found] ` <CAOMZO5BxZDX5TDZdUCbpTw2LpVC=vr4cnn4eSpzd_023wcy+Fg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-29 11:00 ` Jonathan Cameron
[not found] ` <53AFF1C4.1010402-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-06-29 11:49 ` Russell King - ARM Linux
[not found] ` <20140629114901.GO32514-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2014-07-03 17:57 ` Jonathan Cameron
2014-06-13 15:21 ` [PATCH v2 3/6] iio: adc: fsl,imx25-gcq driver Denis Carikli
[not found] ` <1402672899-6995-4-git-send-email-denis-fO0SIAKYzcbQT0dZR+AlfA@public.gmane.org>
2014-06-13 17:25 ` Peter Meerwald
2014-06-21 10:30 ` Jonathan Cameron
[not found] ` <53A55EDF.4010104-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-06-24 10:38 ` Denis Carikli
[not found] ` <53A95533.8090500-fO0SIAKYzcbQT0dZR+AlfA@public.gmane.org>
2014-06-29 11:01 ` Jonathan Cameron
2014-06-14 19:27 ` Hartmut Knaack
2014-06-13 15:21 ` [PATCH v2 4/6] ARM: dts: imx25: Add touchscreen support Denis Carikli
2014-06-13 15:21 ` [PATCH v2 5/6] ARM: dts: imx25: mbimxsd25: " Denis Carikli
2014-06-13 17:10 ` Fabio Estevam
2014-06-13 15:21 ` [PATCH v2 6/6] ARM: imx_v4_v5_defconfig: Add I.MX25 Touchscreen controller support Denis Carikli
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=20140221091844.GB24758@pengutronix.de \
--to=mpa-bicnvbalz9megne8c9+irq@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=festevam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
--cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).