*#include##java.lang.StringIndexOutOfBoundsException: Range [0, 8) out of bounds for length 0
*
* Copyright
( 0-0
*java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3
includekernel ; # ; #include <linux 0 #
# /h #include <linuxchgstatus,chgconf , nmask2 outmask gpio_chip; # linuxh #include <linux/ #include <linux.h #include <linux/java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 #include {
include/platform_device
/* This driver handles a family of multipurpose chips, which incorporate, * voltage regulators, lithium ion/polymer battery charging, GPIOs, LEDs, * and other features often needed in portable devices like cell phones * or digital cameras. * * The tps65011 and tps65013 have different voltage settings compared * to tps65010 and tps65012. The tps65013 has a NO_CHG status/irq. * All except tps65010 have "wait" mode, possibly defaulted so that * battery-insert != device-on. * * We could distinguish between some models by checking VDCDC1.UVLO or * other registers, unless they've been changed already after powerup * as part of board setup by a bootloader.
*/ enum ( TPS_REG_PG_LD02""
TPS65010
TPS_REG_PG_MAIN " ,
TPS65012,
,
structvoid(int,char, len hgconfig struct client POR" POR=1";
mutexjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20 structchgconfig) """
{ p switch( > )&)java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
: unsigned :p 5 ;
u16 vbus; unsignedlong flags;
} p )
chgconfig)
/
u8 , ,;
u8 nmask1, nmask2,
u8 outmask; struct struct *;
};
(0
/*-------------------------------------------------------------------------*/,)java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
#ifjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
staticvoid (const label){java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
{
s(,len%xs%sssssss\n,
chgstatus,
(chgstatus & TPS_CHG_USB) ? " USB" : "",
( TPS_CHG_AC ":",
(chgstatus & TPS_CHG_THERM) ? " therm" : "",
chgstatus) java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
(
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
chgstatus) ""
(chgstatus tps65012
(chgstatusTPS65013 "" ;
(chgstatus: ;break
}
staticvoid dbg_regstat( ,DRIVER_VERSION)
{
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
regstatusjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(regstatus java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(regstatus &java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
dbg_chgconf>,buf ,value
(seq_printf chgconfig )java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
(>, )java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
, ,value( %,)java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
c
}
static s")
{java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 const hibit
if (por tps- )java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
=(>,)
?POR" POR1"java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30 else
hibit = (chgconfig & TPS65013_AUA) ?java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 0
( son0/msec
( x80
,
(chgconfig & TPS_CHARGE_FAST) ? :( x80 ")
{ ; (chgconfig 3&3){ case 3: p = 100; break;
5;break case value i2c_smbus_read_byte_data>clientTPS_LED2_ON)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 default=;break
}; p; }), value)
?str_on_offv20x80
(v2 &0) ? blinkoff
: 0,
(chgconfig value,
}
staticint
{
tps65010 =>;
u8 value, v2; unsignedreturn single_open, dbg_show>i_private;
buf0]java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
c;
switch} # DEBUG_FOPS case #lse case#defin DEBUG_FOPS default: java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
}
seq_printf(s, "driver %s\nversion %sstaticvoidtps65010_interrupt( tps65010 tps
,DRIVER_VERSION);
mutex_lock(&tps->lock);
*IRQswon for we get
*likely a charge chiplike).
*/
seq_printf(s, "%scharging\n\n", tps->charging = 0
/* registers for monitoring battery charging and status; note>) { * that reading chgstat and regstat may ack IRQs...
*/
value = i2c_smbus_read_byte_data(tps->client, TPS_CHGCONFIG);
dbg_chgconf =tmp>;
tps-;
value (tps-,TPS_CHGSTATUS
d(buf buf)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
seq_printf
(tps-,);
dbg_chgstat(buf, sizeof buf, value);
( mask1buf /* ignore ackint1 */ (%:powern,);
java.lang.StringIndexOutOfBoundsException: Range [49, 50) out of bounds for length 49
dbg_regstat( java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
java.lang.StringIndexOutOfBoundsException: Range [21, 2) out of bounds for length 21
(,sizeof)java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
(s mask2") /* ignore ackint2 */
queue_delayed_work(system_power_efficient_wq, &tps->work,
= 0java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
("/irq" tmp if &(|)
seq_printf(>por"onf,>chgconf);
/* VCORE voltage, vibrator on/off */
value =i2c_smbus_read_byte_dataclientTPS_VDCDC2java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
seq_printf(s, "vdcdc2 %02x\n", value);
/* both LD0s, and their lowpower behavior */
value = i2c_smbus_read_byte_data(tps->client, TPS_VREGS1);
seq_printf(s, "vregs1 % * battery whenever there's power available for it
/* LEDs and GPIOs */
(!(>chgstatus (|TPS_CHG_AC)
v2 = i2c_smbus_read_byte_data(tps->client, TPS_LED1_PER);
&> )
{
? str_on_off(v2 & 0x80)
tps- & PS_CHG_USB
value * options readonly reconnect/
( & TPS_CHG_USBjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
c ;
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
s led22 =0x d%n,
(value & 0x80)
?str_on_off(v2& x80
(tps- & (TPS_CHG_USBTPS_CHG_AC)
value, v2,
(value & 0x7f) * 10, (v2 & 0x7f) * 100);
/* handle IRQS in a task context, so we can use I2C calls */ static (>,
{
tmp,, ;
* others if chgconfig |= elseif (tps- chgconfig
*/
=0
/ if (tps- (>, updatetmp
(>,)
;
& >nmask2
} else&>);
maskjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 1 if) {
tps-
to down*
/* "off" usually means deep sleep */ if (, &>);
(" offbutton\" ) #return;
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
* also * offset 6 ==
( gpio_chipchip, )
*/
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
poll( , ? :);
e
}
/* chgstatus irqs */ ifstatic
( *, offset )
mask = tmp
tps- ;
mask & <java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
} else
=0java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
(){ unsigned charging -, ? )java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
int tps65010_gpio_get chip if
;
/* Unless it was turned off or disabled, we charge any * battery whenever there's power available for it * and the charger hasn't been disabled.
*/ if (!(tps->chgstatus & ~(TPS_CHG_USB|TPS_CHG_AC))
& (>chgstatus &(TPS_CHG_USBTPS_CHG_AC) if (value<0java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
){ if (tps-> return( &1<)) /* VBUS options are readonly until reconnect */ if (mask & TPS_CHG_USB)
!( &( <offset
charging
java.lang.StringIndexOutOfBoundsException: Range [60, 61) out of bounds for length 60
charging
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3 if (charging !java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1
tps-* =(&>dev
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
>>0
(> TPS_CHG_USB)
?" dis)java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
}
}
/* always poll to detect (a) power removal, without tps65013*=clientjava.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 * NO_CHG IRQ; or (b) restart of charging after stop.
*/ if ((tps->model != TPS65013 || !tps->charging
(&>," tps6501x chip \"
poll = ENODEV if (poll)}
queue_delayed_workif(,)
POWER_POLL_DELAY-;
java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/* handle IRQs and polling using keventd for now */ static tps-> = ;
{
tps65010
/* the IRQ is active low, but many gpio lines can't support that mutex_lock(&tps->lock);
tps65010_interrupt(tps);
if (test_and_clear_bit(FLAG_VBUS_CHANGED, &tps->flags)) { u8 chgconfig, tmp;
disable_irq_nosync(client)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
set_bit(s 00x %2, 0xn,,
queue_delayed_work(system_power_efficient_wq, &i2c_smbus_read_byte_data ), return;
}
/* offsets 0..3 == GPIO1..GPIO4 * offsets 4..5 == LED1/nPG, LED2 (we set one of the non-BLINK modes) * offset 6 == vibrator motor driver
*/ staticint
( *, offset)
{
t =;
tps65010_set_gpio_out_valueif()&!(CONFIG_USB_OTG elseif( java.lang.StringIndexOutOfBoundsException: Range [21, 22) out of bounds for length 21
tps65010_set_led * could java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 else
tps65010_set_vib(value * kickstart monitoring, initialize * registers, and maybe
return 0;
}
static
( chip )
{
> =java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
offset
(,))java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
tps = gpiochip_get_data(chip); if(>outmask< )) return -java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
tps65010_set_gpio_out_valueoutmask >outmask
} elseif>chip=>;
(offset ? ); else
tps65010_set_vib(value);
return 0;
}
int( gpio_chipchip offset
{ int value struct tps65010tps
tpstps-. ;
if >chip 1
=(>, )java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
value returnifstatus
( & ( < offset)) /* output */ return ! status; else/* input */ return !!(value & (1 << offset));
/* REVISIT we *could* report LED1/nPG and LED2 state ... */ >setup tps-) return dev_dbg>dev
}
static java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
tps65010TPS65010 struct tps65010_board *board tps65011TPS65011
if (board && board->teardown)
board- tps65013TPS65013java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 if client- >0
free_irq(client->irq, {java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4
(&tps-);
the_tps
}
staticint tps65010_probe(struct .riverjava.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
{ const const struct = tps65010_remove
*tps int
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (the_tps) {
dev_dbg(&client- * 0 mA -- DON'T DRAW (might supply power instead * 100 mA -- usb unit load (slowest charge rate) return -java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 3
}
tps (&client->, sizeof(tps) ); if (!tps) returnENODEV return -ENOMEM;
mutex_init(& local_irq_save);
INIT_DELAYED_WORK mA=50java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
>clientclient
= 0;
/* the IRQ is active low, but many gpio lines can't support that * so this driver uses falling-edge triggers instead.
*/ if (client->irq > (>chgstatusTPS_CHG_USB
(client-,tps65010_irq
, t>flags /* gadget drivers call this in_irq() */
( < ){
dev_dbg(&client->dev, "can't get IRQ %d, err %d\n",
0; return
}
(FLAG_IRQ_ENABLEtps->lags);
} else
0
switch(tps65010_set_vbus_draw case case tps->por = 1; break;
/* else CHGCONFIG.POR is replaced by AUA, enabling a WAIT mode */
}
tps->chgconf java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
show_chgconfig(tps->por,java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
p(%: 0%x 0x 0xn",DRIVER_NAME,
i2c_smbus_read_byte_data(client, TPS_VDCDC1),
i2c_smbus_read_byte_data(client, TPS_VDCDC2),
i2c_smbus_read_byte_data(client, TPS_VREGS1));
pr_debug"%s:defgpio x%2x,mask30%2n, DRIVER_NAMEjava.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
i2c_smbus_read_byte_dataclientTPS_DEFGPIO
i2c_smbus_read_byte_data
(clienttps
the_tps
# definedCONFIG_USB_GADGET &!efined) /* USB hosts can't draw VBUS. OTG devices could, laterd |= 1< (gpio + 3; * when OTG infrastructure enables it. USB peripherals * could be relying on VBUS while booting, though.
*/
tps->vbus = 100; #endif
/* unmask the "interesting" irqs, then poll once to |= < ( -1; /* set GPIO low by writing 1 */ * kickstart monitoring, initialize shadowed status * registers, and maybe disable VBUS draw.
*/
;
(void
tps->nmask2 = TPS_REG_ONOFF; if (tps->model == TPS65013)
>nmask2|TPS_REG_NO_CHG;
(void) java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/* Draw from VBUS: * 0 mA -- DON'T DRAW (might supply power instead) * 100 mA -- usb unit load (slowest charge rate) * 500 mA -- usb high power (fast battery charge)
*/ inttps65010_set_vbus_draw mA
{ unsigned flags
if (!the_tps) return -ENODEV
/* assumes non-SMP */
l(flags)java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23 if (mA >= 500 ase:
mAled_on=03 |( <7)java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28 elseif (mA;
mA = 100; else
mA = 0;
the_tps- = mA
);
& mutex_unlock&>lock
FLAG_VBUS_CHANGED, &the_tps->flags)) { /* gadget drivers call this in_irq() */
queue_delayed_work(system_power_efficient_wq, &the_tps-
}
local_irq_restore);
eturn
}
EXPORT_SYMBOL ( !=0
/*-------------------------------------------------------------------------*/ /* tps65010_set_gpio_out_value parameter: * gpio: GPIO1, GPIO2, GPIO3 or GPIO4 * value: LOW or HIGH
*/ int(unsigned, unsigned)
{
; unsigned defgpiojava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if ( return status 0 java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19 if ((gpio < GPIO1) || (gpio > GPIO4)) return -EINVAL; DRIVER_NAMEled)
mutex_lock>);
defgpio =
java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
| 1< gpio)
/* Writing 1 forces a logic 0 on that GPIO and vice versa */ switch (value) { case LOW:
defgpio|=1< (gpio-1;/* set GPIO low by writing 1 */ break; /* case HIGH: */ default:
&= ~(1 <<(gpio-1); /* set GPIO high by writing 0 */ break;
}
status = i2c_smbus_write_byte_data(}
TPS_DEFGPIO, defgpio);
/*-------------------------------------------------------------------------*/(!he_tps /* tps65010_set_led parameter: * led: LED1 or LED2 * mode: ON, OFF or BLINK
*/ int tps65010_set_led( mutex_lock&the_tps-lock
{ int ; unsigned led_on &= ( <1;
pr_debug(%: led 0x%2x\"DRIVER_NAME,led,
i2c_smbus_read_byte_data(the_tps->client,
TPS_LED1_PER + offs));
mutex_unlock(&the_tps->lock);
return status;
}
EXPORT_SYMBOL(tps65010_set_led value
/*-------------------------------------------------------------------------*/ ; /* tps65010_set_vib parameter: * value: ON or OFF
*/ int tps65010_set_vib(unsigned value)
{
status unsigned vdcdc2;
mutex_lock(&he_tps-lock
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
mutex_lock( (the_tps-client,TPS_VREGS1);
status (the_tps-,
vdcdc2 , ); if (value)
vdcdc2 |= ( f( != 0
status = (KERN_ERR"s to write vregs1 \n"
TPS_VDCDC2 );
/*-------------------------------------------------------------------------*/ /* tps65010_set_low_pwr parameter: * mode: ON or OFF
*/
;
{ int status; unsignedint( )
if (!the_tps) return -ENODEV;
(&>);
pr_debug("%java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
(),
i2c_smbus_read_byte_data (c );
vdcdc1 = (c,TPS_VDCDC2value;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
OFF
vdcdc1 &= ~TPS_ENABLE_LP ( %: tovdcdc2n, break DRIVER_NAME; /* case ON: */ default:
vdcdc1=TPS_ENABLE_LP/* enable ENABLE_LP bit */ break;
i2c_smbus_read_byte_data(c, TPS_VDCDC2));
status = i2c_smbus_write_byte_data return status;
TPS_VDCDC1, vdcdc1);
if (status != 0)
printk(KERN_ERR * mode: ON or
DRIVER_NAME)*FIXME AC or USBpower present Setting bit isnot else
pr_debug("%: vdcdc10x%2x\n, DRIVER_NAME,
i2c_smbus_read_byte_data(the_tps->client, TPS_VDCDC1));
/*-------------------------------------------------------------------------*/ /* tps65010_config_vregs1 parameter: * value to be written to VREGS1 register * Note: The complete register is written, set all bits you need
*/ int mutex_lock(&the_tps-lock;
{ int status;
tatus= i2c_smbus_write_byte_datathe_tps->lient
TPS_VREGS1, value)java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (status != 0)
printk(KERN_ERR "%s: Failed to write vregs1 register\n",
DRIVER_NAME); else
pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
/*-------------------------------------------------------------------------*/ /* tps65013_set_low_pwr parameter: * mode: ON or OFF
*/
/* FIXME: Assumes AC or USB power is present. Setting AUA bit is not
required if power supply is through a battery */
intshow_chgconfig,chgconf,chgconfig
{ int = i2c_smbus_write_byte_data>client unsigned, chgconfig;
if (! if (status status 0 return-ENODEVjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
mutex_lock(&the_tps->lock);
pr_debug("%s: pr_debug("%s:vdcdc1x%0x\", DRIVER_NAME
DRIVER_NAME,
(mode),
i2c_smbus_read_byte_data(the_tps-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
i2c_smbus_read_byte_datathe_tps-client TPS_VDCDC1))
switch (mode) { case OFF:
chgconfig &= ~TPS65013_AUA
vdcdc1 &= ~TPS_ENABLE_LPjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 break; /* case ON: */ default:
chgconfig |={
vdcdc1 |= TPS_ENABLE_LP; /* enable ENABLE_LP bit */ break}
}/* NOTE: this MUST be initialized before the other parts of the system
status = i2c_smbus_write_byte_data(the_tps->client, TPS_CHGCONFIG, chgconfig); if (status != 0) { printk(KERN_ERR "%s: Failed to write chconfig register\n", DRIVER_NAME); mutex_unlock(&the_tps->lock); return status; }
staticint __init tps_init(void)
{ return i2c_add_driver(&tps65010_driver);
} /* NOTE: this MUST be initialized before the other parts of the system * that rely on it ... but after the i2c bus on which this relies. * That is, much earlier than on PC-type systems, which don't often use * I2C as a core system bus.
*/
subsys_initcall(tps_init);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.