Re: [PATCH] mfd: arizona: Move useful defines into a dt-binding include

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Mon, Feb 23, 2015 at 10:00:50AM -0600, Rob Herring wrote:
> On Wed, Feb 18, 2015 at 5:03 AM, Charles Keepax
> <ckeepax@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> > Move parts of linux/mfd/arizona/pdata.h and gpio.h into a new file in
> > the dt-binding directory for use by device tree bindings. This also
> > makes gpio.h redundant so remove it in the process.
> >
> > Signed-off-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
> > ---
> >  include/dt-bindings/mfd/arizona.h |  109 +++++++++++++++++++++++++++++++++++++
> >  include/linux/mfd/arizona/gpio.h  |   96 --------------------------------
> >  include/linux/mfd/arizona/pdata.h |   46 +---------------
> >  sound/soc/codecs/arizona.c        |    1 -
> >  4 files changed, 110 insertions(+), 142 deletions(-)
> >  create mode 100644 include/dt-bindings/mfd/arizona.h
> >  delete mode 100644 include/linux/mfd/arizona/gpio.h
> >
> > diff --git a/include/dt-bindings/mfd/arizona.h b/include/dt-bindings/mfd/arizona.h
> > new file mode 100644
> > index 0000000..f2a4821
> > --- /dev/null
> > +++ b/include/dt-bindings/mfd/arizona.h
> > @@ -0,0 +1,109 @@
> > +/*
> > + * Device Tree defines for Arizona devices
> > + *
> > + * Copyright 2014 Wolfson Microelectronics. PLC.
> > + *
> > + * Author: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + */
> > +
> > +#ifndef _DT_BINDINGS_MFD_ARIZONA_H
> > +#define _DT_BINDINGS_MFD_ARIZONA_H
> > +
> > +#define ARIZONA_GP_FN_TXLRCLK                    0x00
> > +#define ARIZONA_GP_FN_GPIO                       0x01
> 
> These are all register offsets? If so, I don't think they belong in dts files.

These are the various functions that the chips GPIO pins can be
set to. They are values rather than register offsets.

> 
> > +#define ARIZONA_GP_FN_IRQ1                       0x02
> > +#define ARIZONA_GP_FN_IRQ2                       0x03
> > +#define ARIZONA_GP_FN_ASYNC_OPCLK                0x3D
> > +#define ARIZONA_GP_FN_BOOT_DONE                  0x44
> > +#define ARIZONA_GP_FN_DSP1_RAM_READY             0x45
> > +#define ARIZONA_GP_FN_SYSCLK_ENA_STATUS          0x4B
> > +#define ARIZONA_GP_FN_ASYNCCLK_ENA_STATUS        0x4C
> > +
> > +#define ARIZONA_GPN_DIR                          0x8000  /* GPN_DIR */
> > +#define ARIZONA_GPN_DIR_MASK                     0x8000  /* GPN_DIR */
> > +#define ARIZONA_GPN_DIR_SHIFT                        15  /* GPN_DIR */
> > +#define ARIZONA_GPN_DIR_WIDTH                         1  /* GPN_DIR */
> 
> Similarly, how do you intend to use these in dts files?
> 
> Rob

Admittedly, the shift and width defines are unlikely to see use
in the DT file, I will do a respin to filter those out.

The defines themselves are settings for the GPIO pins again.
Direction, pull up, pull down. These all go into the
wlf,gpio-defaults field in the DT binding.

So instead of:

        wlf,gpio-defaults = <
                0x00000000 /* AIF1TXLRCLK */
                0xffffffff
                0xffffffff
                0xffffffff
                0xffffffff
        >;

We can write something a little more readable like:

        wlf,gpio-defaults = <
                ARIZONA_GP_FN_TXLRCLK
                0xffffffff
                0xffffffff
                0xffffffff
                0xffffffff
        >;

Although looking at that example I feel like I should add a
define for the default value (triggered by an out of range value
such as 0xffffffff).

Thanks,
Charles
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux