Merge tag 'v4.3-rc3' into next
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 29 Sep 2015 23:28:52 +0000 (16:28 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 29 Sep 2015 23:28:52 +0000 (16:28 -0700)
Merge with Linux 4.3-rc3 to bring in MFD DA9062 changes to merge DA9062
OnKey driver.

1  2 
arch/arm/boot/dts/am437x-sk-evm.dts
arch/arm/boot/dts/imx6qdl-tx6.dtsi
drivers/input/joystick/turbografx.c

                display0 = &lcd0;
        };
  
+       /* fixed 32k external oscillator clock */
+       clk_32k_rtc: clk_32k_rtc {
+               #clock-cells = <0>;
+               compatible = "fixed-clock";
+               clock-frequency = <32768>;
+       };
        backlight {
                compatible = "pwm-backlight";
                pwms = <&ecap0 0 50000 PWM_POLARITY_INVERTED>;
        };
  
        sound {
-               compatible = "ti,da830-evm-audio";
-               ti,model = "AM437x-SK-EVM";
-               ti,audio-codec = <&tlv320aic3106>;
-               ti,mcasp-controller = <&mcasp1>;
-               ti,codec-clock-rate = <24000000>;
-               ti,audio-routing =
-                       "Headphone Jack",       "HPLOUT",
-                       "Headphone Jack",       "HPROUT";
+               compatible = "simple-audio-card";
+               simple-audio-card,name = "AM437x-SK-EVM";
+               simple-audio-card,widgets =
+                       "Headphone", "Headphone Jack",
+                       "Line", "Line In";
+               simple-audio-card,routing =
+                       "Headphone Jack",       "HPLOUT",
+                       "Headphone Jack",       "HPROUT",
+                       "LINE1L",               "Line In",
+                       "LINE1R",               "Line In";
+               simple-audio-card,format = "dsp_b";
+               simple-audio-card,bitclock-master = <&sound_master>;
+               simple-audio-card,frame-master = <&sound_master>;
+               simple-audio-card,bitclock-inversion;
+               simple-audio-card,cpu {
+                       sound-dai = <&mcasp1>;
+               };
+               sound_master: simple-audio-card,codec {
+                       sound-dai = <&tlv320aic3106>;
+                       system-clock-frequency = <24000000>;
+               };
        };
  
        matrix_keypad: matrix_keypad@0 {
                >;
        };
  
+       mcasp1_pins_sleep: mcasp1_pins_sleep {
+               pinctrl-single,pins = <
+                       0x10c (PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       0x110 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       0x108 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+                       0x144 (PIN_INPUT_PULLDOWN | MUX_MODE7)
+               >;
+       };
        lcd_pins: lcd_pins {
                pinctrl-single,pins = <
                        0x1c (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpcm_ad7.gpio1_7 */
  
                reg = <0x38>;
                interrupt-parent = <&gpio0>;
 -              interrupts = <31 0>;
 +              interrupts = <31 IRQ_TYPE_EDGE_FALLING>;
  
                reset-gpios = <&gpio1 28 GPIO_ACTIVE_LOW>;
  
        };
  
        tlv320aic3106: tlv320aic3106@1b {
+               #sound-dai-cells = <0>;
                compatible = "ti,tlv320aic3106";
                reg = <0x1b>;
                status = "okay";
  };
  
  &mcasp1 {
-       pinctrl-names = "default";
+       #sound-dai-cells = <0>;
+       pinctrl-names = "default", "sleep";
        pinctrl-0 = <&mcasp1_pins>;
+       pinctrl-1 = <&mcasp1_pins_sleep>;
  
        status = "okay";
  
  };
  
  &rtc {
+       clocks = <&clk_32k_rtc>, <&clk_32768_ck>;
+       clock-names = "ext-clk", "int-clk";
        status = "okay";
  };
  
@@@ -11,7 -11,6 +11,7 @@@
  
  #include <dt-bindings/gpio/gpio.h>
  #include <dt-bindings/input/input.h>
 +#include <dt-bindings/interrupt-controller/irq.h>
  #include <dt-bindings/pwm/pwm.h>
  
  / {
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_edt_ft5x06>;
                interrupt-parent = <&gpio6>;
 -              interrupts = <15 0>;
 +              interrupts = <15 IRQ_TYPE_EDGE_FALLING>;
                reset-gpios = <&gpio2 22 GPIO_ACTIVE_LOW>;
                wake-gpios = <&gpio2 21 GPIO_ACTIVE_HIGH>;
                linux,wakeup;
        pinctrl-0 = <&pinctrl_usdhc1>;
        bus-width = <4>;
        no-1-8-v;
-       cd-gpios = <&gpio7 2 0>;
+       cd-gpios = <&gpio7 2 GPIO_ACTIVE_LOW>;
        fsl,wp-controller;
        status = "okay";
  };
        pinctrl-0 = <&pinctrl_usdhc2>;
        bus-width = <4>;
        no-1-8-v;
-       cd-gpios = <&gpio7 3 0>;
+       cd-gpios = <&gpio7 3 GPIO_ACTIVE_LOW>;
        fsl,wp-controller;
        status = "okay";
  };
@@@ -49,7 -49,7 +49,7 @@@ struct tgfx_config 
        unsigned int nargs;
  };
  
 -static struct tgfx_config tgfx_cfg[TGFX_MAX_PORTS] __initdata;
 +static struct tgfx_config tgfx_cfg[TGFX_MAX_PORTS];
  
  module_param_array_named(map, tgfx_cfg[0].args, int, &tgfx_cfg[0].nargs, 0);
  MODULE_PARM_DESC(map, "Describes first set of devices (<parport#>,<js1>,<js2>,..<js7>");
@@@ -81,7 -81,6 +81,7 @@@ static struct tgfx 
        char phys[TGFX_MAX_DEVICES][32];
        int sticks;
        int used;
 +      int parportno;
        struct mutex sem;
  } *tgfx_base[TGFX_MAX_PORTS];
  
@@@ -157,46 -156,38 +157,46 @@@ static void tgfx_close(struct input_de
   * tgfx_probe() probes for tg gamepads.
   */
  
 -static struct tgfx __init *tgfx_probe(int parport, int *n_buttons, int n_devs)
 +static void tgfx_attach(struct parport *pp)
  {
        struct tgfx *tgfx;
        struct input_dev *input_dev;
 -      struct parport *pp;
        struct pardevice *pd;
        int i, j;
 -      int err;
 +      int *n_buttons, n_devs;
 +      struct pardev_cb tgfx_parport_cb;
 +
 +      for (i = 0; i < TGFX_MAX_PORTS; i++) {
 +              if (tgfx_cfg[i].nargs == 0 || tgfx_cfg[i].args[0] < 0)
 +                      continue;
 +              if (tgfx_cfg[i].args[0] == pp->number)
 +                      break;
 +      }
  
 -      pp = parport_find_number(parport);
 -      if (!pp) {
 -              printk(KERN_ERR "turbografx.c: no such parport\n");
 -              err = -EINVAL;
 -              goto err_out;
 +      if (i == TGFX_MAX_PORTS) {
 +              pr_debug("Not using parport%d.\n", pp->number);
 +              return;
        }
 +      n_buttons = tgfx_cfg[i].args + 1;
 +      n_devs = tgfx_cfg[i].nargs - 1;
  
 -      pd = parport_register_device(pp, "turbografx", NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
 +      tgfx_parport_cb.flags = PARPORT_FLAG_EXCL;
 +
 +      pd = parport_register_dev_model(pp, "turbografx", &tgfx_parport_cb, i);
        if (!pd) {
 -              printk(KERN_ERR "turbografx.c: parport busy already - lp.o loaded?\n");
 -              err = -EBUSY;
 -              goto err_put_pp;
 +              pr_err("parport busy already - lp.o loaded?\n");
 +              return;
        }
  
        tgfx = kzalloc(sizeof(struct tgfx), GFP_KERNEL);
        if (!tgfx) {
                printk(KERN_ERR "turbografx.c: Not enough memory\n");
 -              err = -ENOMEM;
                goto err_unreg_pardev;
        }
  
        mutex_init(&tgfx->sem);
        tgfx->pd = pd;
 +      tgfx->parportno = pp->number;
        init_timer(&tgfx->timer);
        tgfx->timer.data = (long) tgfx;
        tgfx->timer.function = tgfx_timer;
                if (n_buttons[i] < 1)
                        continue;
  
-               if (n_buttons[i] > 6) {
+               if (n_buttons[i] > ARRAY_SIZE(tgfx_buttons)) {
                        printk(KERN_ERR "turbografx.c: Invalid number of buttons %d\n", n_buttons[i]);
 -                      err = -EINVAL;
                        goto err_unreg_devs;
                }
  
                tgfx->dev[i] = input_dev = input_allocate_device();
                if (!input_dev) {
                        printk(KERN_ERR "turbografx.c: Not enough memory for input device\n");
 -                      err = -ENOMEM;
                        goto err_unreg_devs;
                }
  
                for (j = 0; j < n_buttons[i]; j++)
                        set_bit(tgfx_buttons[j], input_dev->keybit);
  
 -              err = input_register_device(tgfx->dev[i]);
 -              if (err)
 +              if (input_register_device(tgfx->dev[i]))
                        goto err_free_dev;
        }
  
          if (!tgfx->sticks) {
                printk(KERN_ERR "turbografx.c: No valid devices specified\n");
 -              err = -EINVAL;
                goto err_free_tgfx;
          }
  
 -      parport_put_port(pp);
 -      return tgfx;
 +      tgfx_base[i] = tgfx;
 +      return;
  
   err_free_dev:
        input_free_device(tgfx->dev[i]);
        kfree(tgfx);
   err_unreg_pardev:
        parport_unregister_device(pd);
 - err_put_pp:
 -      parport_put_port(pp);
 - err_out:
 -      return ERR_PTR(err);
  }
  
 -static void tgfx_remove(struct tgfx *tgfx)
 +static void tgfx_detach(struct parport *port)
  {
        int i;
 +      struct tgfx *tgfx;
 +
 +      for (i = 0; i < TGFX_MAX_PORTS; i++) {
 +              if (tgfx_base[i] && tgfx_base[i]->parportno == port->number)
 +                      break;
 +      }
 +
 +      if (i == TGFX_MAX_PORTS)
 +              return;
 +
 +      tgfx = tgfx_base[i];
 +      tgfx_base[i] = NULL;
  
        for (i = 0; i < TGFX_MAX_DEVICES; i++)
                if (tgfx->dev[i])
        kfree(tgfx);
  }
  
 +static struct parport_driver tgfx_parport_driver = {
 +      .name = "turbografx",
 +      .match_port = tgfx_attach,
 +      .detach = tgfx_detach,
 +      .devmodel = true,
 +};
 +
  static int __init tgfx_init(void)
  {
        int i;
        int have_dev = 0;
 -      int err = 0;
  
        for (i = 0; i < TGFX_MAX_PORTS; i++) {
                if (tgfx_cfg[i].nargs == 0 || tgfx_cfg[i].args[0] < 0)
  
                if (tgfx_cfg[i].nargs < 2) {
                        printk(KERN_ERR "turbografx.c: at least one joystick must be specified\n");
 -                      err = -EINVAL;
 -                      break;
 -              }
 -
 -              tgfx_base[i] = tgfx_probe(tgfx_cfg[i].args[0],
 -                                        tgfx_cfg[i].args + 1,
 -                                        tgfx_cfg[i].nargs - 1);
 -              if (IS_ERR(tgfx_base[i])) {
 -                      err = PTR_ERR(tgfx_base[i]);
 -                      break;
 +                      return -EINVAL;
                }
  
                have_dev = 1;
        }
  
 -      if (err) {
 -              while (--i >= 0)
 -                      if (tgfx_base[i])
 -                              tgfx_remove(tgfx_base[i]);
 -              return err;
 -      }
 +      if (!have_dev)
 +              return -ENODEV;
  
 -      return have_dev ? 0 : -ENODEV;
 +      return parport_register_driver(&tgfx_parport_driver);
  }
  
  static void __exit tgfx_exit(void)
  {
 -      int i;
 -
 -      for (i = 0; i < TGFX_MAX_PORTS; i++)
 -              if (tgfx_base[i])
 -                      tgfx_remove(tgfx_base[i]);
 +      parport_unregister_driver(&tgfx_parport_driver);
  }
  
  module_init(tgfx_init);