]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge remote-tracking branch 'battery/master'
authorStephen Rothwell <sfr@canb.auug.org.au>
Tue, 8 Mar 2016 01:36:24 +0000 (12:36 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 8 Mar 2016 01:36:24 +0000 (12:36 +1100)
1  2 
arch/arm/boot/dts/omap3-n900.dts
drivers/power/bq27xxx_battery_i2c.c

index 152511be5b1ea9b69b25122324dc8fb0aa8e155a,e3bdcf819643eededad95cb6bdd76b97563d187c..b3c26a96a7262bdc2356060f900cc9b0c8bbd8eb
                camera_lens_cover {
                        label = "Camera Lens Cover";
                        gpios = <&gpio4 14 GPIO_ACTIVE_LOW>; /* 110 */
 -                      linux,input-type = <5>; /* EV_SW */
 -                      linux,code = <0x09>; /* SW_CAMERA_LENS_COVER */
 -                      wakeup-source;
 +                      linux,input-type = <EV_SW>;
 +                      linux,code = <SW_CAMERA_LENS_COVER>;
 +                      linux,can-disable;
                };
  
                camera_focus {
                        label = "Camera Focus";
                        gpios = <&gpio3 4 GPIO_ACTIVE_LOW>; /* 68 */
 -                      linux,code = <0x210>; /* KEY_CAMERA_FOCUS */
 -                      wakeup-source;
 +                      linux,code = <KEY_CAMERA_FOCUS>;
 +                      linux,can-disable;
                };
  
                camera_capture {
                        label = "Camera Capture";
                        gpios = <&gpio3 5 GPIO_ACTIVE_LOW>; /* 69 */
 -                      linux,code = <0xd4>; /* KEY_CAMERA */
 -                      wakeup-source;
 +                      linux,code = <KEY_CAMERA>;
 +                      linux,can-disable;
                };
  
                lock_button {
                        label = "Lock Button";
                        gpios = <&gpio4 17 GPIO_ACTIVE_LOW>; /* 113 */
 -                      linux,code = <0x98>; /* KEY_SCREENLOCK */
 -                      wakeup-source;
 +                      linux,code = <KEY_SCREENLOCK>;
 +                      linux,can-disable;
                };
  
                keypad_slide {
                        label = "Keypad Slide";
                        gpios = <&gpio3 7 GPIO_ACTIVE_LOW>; /* 71 */
 -                      linux,input-type = <5>; /* EV_SW */
 -                      linux,code = <0x0a>; /* SW_KEYPAD_SLIDE */
 -                      wakeup-source;
 +                      linux,input-type = <EV_SW>;
 +                      linux,code = <SW_KEYPAD_SLIDE>;
 +                      linux,can-disable;
                };
  
                proximity_sensor {
                        label = "Proximity Sensor";
                        gpios = <&gpio3 25 GPIO_ACTIVE_HIGH>; /* 89 */
 -                      linux,input-type = <5>; /* EV_SW */
 -                      linux,code = <0x0b>; /* SW_FRONT_PROXIMITY */
 +                      linux,input-type = <EV_SW>;
 +                      linux,code = <SW_FRONT_PROXIMITY>;
 +                      linux,can-disable;
                };
        };
  
-       isp1704: isp1704 {
-               compatible = "nxp,isp1704";
+       isp1707: isp1707 {
+               compatible = "nxp,isp1707";
                nxp,enable-gpio = <&gpio3 3 GPIO_ACTIVE_HIGH>;
                usb-phy = <&usb2_phy>;
        };
                amstaos,cover-comp-gain = <16>;
        };
  
 +      adp1653: led-controller@30 {
 +              compatible = "adi,adp1653";
 +              reg = <0x30>;
 +              enable-gpios = <&gpio3 24 GPIO_ACTIVE_HIGH>; /* 88 */
 +
 +              flash {
 +                      flash-timeout-us = <500000>;
 +                      flash-max-microamp = <320000>;
 +                      led-max-microamp = <50000>;
 +              };
 +              indicator {
 +                      led-max-microamp = <17500>;
 +              };
 +      };
 +
        lp5523: lp5523@32 {
                compatible = "national,lp5523";
                reg = <0x32>;
                ti,termination-current = <100>;
                ti,resistor-sense = <68>;
  
-               ti,usb-charger-detection = <&isp1704>;
+               ti,usb-charger-detection = <&isp1707>;
        };
  };
  
index 8eafc6f0df88be5fbf26c6725beb656e49464c0b,b810e08cc08af5945215550986e839cf2768d3a6..b8f8d3ade31b24cf8a65493226127eb5ad25c9e0
@@@ -21,9 -21,6 +21,9 @@@
  
  #include <linux/power/bq27xxx_battery.h>
  
 +static DEFINE_IDR(battery_id);
 +static DEFINE_MUTEX(battery_mutex);
 +
  static irqreturn_t bq27xxx_battery_irq_handler_thread(int irq, void *data)
  {
        struct bq27xxx_device_info *di = data;
@@@ -73,33 -70,19 +73,33 @@@ static int bq27xxx_battery_i2c_probe(st
  {
        struct bq27xxx_device_info *di;
        int ret;
 +      char *name;
 +      int num;
 +
 +      /* Get new ID for the new battery device */
 +      mutex_lock(&battery_mutex);
 +      num = idr_alloc(&battery_id, client, 0, 0, GFP_KERNEL);
 +      mutex_unlock(&battery_mutex);
 +      if (num < 0)
 +              return num;
 +
 +      name = devm_kasprintf(&client->dev, GFP_KERNEL, "%s-%d", id->name, num);
 +      if (!name)
 +              goto err_mem;
  
        di = devm_kzalloc(&client->dev, sizeof(*di), GFP_KERNEL);
        if (!di)
 -              return -ENOMEM;
 +              goto err_mem;
  
 +      di->id = num;
        di->dev = &client->dev;
        di->chip = id->driver_data;
 -      di->name = id->name;
 +      di->name = name;
        di->bus.read = bq27xxx_battery_i2c_read;
  
        ret = bq27xxx_battery_setup(di);
        if (ret)
 -              return ret;
 +              goto err_failed;
  
        /* Schedule a polling after about 1 min */
        schedule_delayed_work(&di->work, 60 * HZ);
        }
  
        return 0;
 +
 +err_mem:
 +      ret = -ENOMEM;
 +
 +err_failed:
 +      mutex_lock(&battery_mutex);
 +      idr_remove(&battery_id, num);
 +      mutex_unlock(&battery_mutex);
 +
 +      return ret;
  }
  
  static int bq27xxx_battery_i2c_remove(struct i2c_client *client)
  
        bq27xxx_battery_teardown(di);
  
 +      mutex_lock(&battery_mutex);
 +      idr_remove(&battery_id, di->id);
 +      mutex_unlock(&battery_mutex);
 +
        return 0;
  }
  
@@@ -166,9 -135,33 +166,33 @@@ static const struct i2c_device_id bq27x
  };
  MODULE_DEVICE_TABLE(i2c, bq27xxx_i2c_id_table);
  
+ #ifdef CONFIG_OF
+ static const struct of_device_id bq27xxx_battery_i2c_of_match_table[] = {
+       { .compatible = "ti,bq27200" },
+       { .compatible = "ti,bq27210" },
+       { .compatible = "ti,bq27500" },
+       { .compatible = "ti,bq27510" },
+       { .compatible = "ti,bq27520" },
+       { .compatible = "ti,bq27530" },
+       { .compatible = "ti,bq27531" },
+       { .compatible = "ti,bq27541" },
+       { .compatible = "ti,bq27542" },
+       { .compatible = "ti,bq27546" },
+       { .compatible = "ti,bq27742" },
+       { .compatible = "ti,bq27545" },
+       { .compatible = "ti,bq27421" },
+       { .compatible = "ti,bq27425" },
+       { .compatible = "ti,bq27441" },
+       { .compatible = "ti,bq27621" },
+       {},
+ };
+ MODULE_DEVICE_TABLE(of, bq27xxx_battery_i2c_of_match_table);
+ #endif
  static struct i2c_driver bq27xxx_battery_i2c_driver = {
        .driver = {
                .name = "bq27xxx-battery",
+               .of_match_table = of_match_ptr(bq27xxx_battery_i2c_of_match_table),
        },
        .probe = bq27xxx_battery_i2c_probe,
        .remove = bq27xxx_battery_i2c_remove,