- Timestamp:
- 02/13/08 02:29:25 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/src/target/kernel/2.6.24.x/patches/pcf50633.patch
r4056 r4057 35 35 --- /dev/null 36 36 +++ linux-2.6.24/drivers/i2c/chips/pcf50633.c 37 @@ -0,0 +1,17 89@@37 @@ -0,0 +1,1791 @@ 38 38 +/* Philips PCF50633 Power Management Unit (PMU) driver 39 39 + * … … 527 527 + struct pcf50633_data *pcf = 528 528 + container_of(work, struct pcf50633_data, work); 529 + u_int8_t int1, int2, int3, int4, int5; 529 + u_int8_t pcfirq[5]; 530 + int ret; 530 531 + 531 532 + mutex_lock(&pcf->working_lock); 532 533 + pcf->working = 1; 533 + 534 + /* FIXME: read in one i2c transaction */ 535 + int1 = __reg_read(pcf, PCF50633_REG_INT1); 536 + int2 = __reg_read(pcf, PCF50633_REG_INT2); 537 + int3 = __reg_read(pcf, PCF50633_REG_INT3); 538 + int4 = __reg_read(pcf, PCF50633_REG_INT4); 539 + int5 = __reg_read(pcf, PCF50633_REG_INT5); 534 + /* 535 + * datasheet says we have to read the five IRQ 536 + * status regs in one transaction 537 + */ 538 + ret = i2c_smbus_read_i2c_block_data(&pcf->client, PCF50633_REG_INT1, 5, 539 + pcfirq); 540 + if (ret != 5) 541 + DEBUGP("Oh crap PMU IRQ register read failed %d\n", ret); 540 542 + 541 543 + DEBUGP("INT1=0x%02x INT2=0x%02x INT3=0x%02x INT4=0x%02x INT5=0x%02x\n", 542 + int1, int2, int3, int4, int5);543 + 544 + if ( int1& PCF50633_INT1_ADPINS) {544 + pcfirq[0], pcfirq[1], pcfirq[2], pcfirq[3], pcfirq[4]); 545 + 546 + if (pcfirq[0] & PCF50633_INT1_ADPINS) { 545 547 + /* Charger inserted */ 546 548 + DEBUGPC("ADPINS "); … … 554 556 + //kobject_uevent( ,KOBJ_ADD); 555 557 + } 556 + if ( int1& PCF50633_INT1_ADPREM) {558 + if (pcfirq[0] & PCF50633_INT1_ADPREM) { 557 559 + /* Charger removed */ 558 560 + DEBUGPC("ADPREM "); … … 566 568 + //kobject_uevent( ,KOBJ_ADD); 567 569 + } 568 + if ( int1& PCF50633_INT1_USBINS) {570 + if (pcfirq[0] & PCF50633_INT1_USBINS) { 569 571 + DEBUGPC("USBINS "); 570 572 + input_report_key(pcf->input_dev, KEY_POWER2, 1); … … 576 578 + 577 579 + } 578 + if ( int1& PCF50633_INT1_USBREM) {580 + if (pcfirq[0] & PCF50633_INT1_USBREM) { 579 581 + DEBUGPC("USBREM "); 580 582 + input_report_key(pcf->input_dev, KEY_POWER2, 0); … … 585 587 + PCF50633_FEAT_MBC, PMU_EVT_USB_REMOVE); 586 588 + } 587 + if ( int1& PCF50633_INT1_ALARM) {589 + if (pcfirq[0] & PCF50633_INT1_ALARM) { 588 590 + DEBUGPC("ALARM "); 589 591 + if (pcf->pdata->used_features & PCF50633_FEAT_RTC) … … 591 593 + RTC_AF | RTC_IRQF); 592 594 + } 593 + if ( int1& PCF50633_INT1_SECOND) {595 + if (pcfirq[0] & PCF50633_INT1_SECOND) { 594 596 + DEBUGPC("SECOND "); 595 597 + if (pcf->flags & PCF50633_F_RTC_SECOND) … … 613 615 + } 614 616 + 615 + if ( int2& PCF50633_INT2_ONKEYF) {617 + if (pcfirq[1] & PCF50633_INT2_ONKEYF) { 616 618 + /* ONKEY falling edge (start of button press) */ 617 619 + DEBUGPC("ONKEYF "); … … 619 621 + input_report_key(pcf->input_dev, KEY_POWER, 1); 620 622 + } 621 + if ( int2& PCF50633_INT2_ONKEYR) {623 + if (pcfirq[1] & PCF50633_INT2_ONKEYR) { 622 624 + /* ONKEY rising edge (end of button press) */ 623 625 + DEBUGPC("ONKEYR "); … … 634 636 + /* FIXME: we don't use EXTON1/2/3. thats why we skip it */ 635 637 + 636 + if ( int3& PCF50633_INT3_BATFULL) {638 + if (pcfirq[2] & PCF50633_INT3_BATFULL) { 637 639 + DEBUGPC("BATFULL "); 638 640 + /* FIXME: signal this to userspace */ 639 641 + } 640 + if ( int3& PCF50633_INT3_CHGHALT) {642 + if (pcfirq[2] & PCF50633_INT3_CHGHALT) { 641 643 + DEBUGPC("CHGHALT "); 642 644 + /* FIXME: signal this to userspace */ 643 645 + } 644 + if ( int3& PCF50633_INT3_THLIMON) {646 + if (pcfirq[2] & PCF50633_INT3_THLIMON) { 645 647 + DEBUGPC("THLIMON "); 646 648 + pcf->flags |= PCF50633_F_CHG_PROT; 647 649 + /* FIXME: signal this to userspace */ 648 650 + } 649 + if ( int3& PCF50633_INT3_THLIMOFF) {651 + if (pcfirq[2] & PCF50633_INT3_THLIMOFF) { 650 652 + DEBUGPC("THLIMOFF "); 651 653 + pcf->flags &= ~PCF50633_F_CHG_PROT; 652 654 + /* FIXME: signal this to userspace */ 653 655 + } 654 + if ( int3& PCF50633_INT3_USBLIMON) {656 + if (pcfirq[2] & PCF50633_INT3_USBLIMON) { 655 657 + DEBUGPC("USBLIMON "); 656 658 + /* FIXME: signal this to userspace */ 657 659 + } 658 + if ( int3& PCF50633_INT3_USBLIMOFF) {660 + if (pcfirq[2] & PCF50633_INT3_USBLIMOFF) { 659 661 + DEBUGPC("USBLIMOFF "); 660 662 + /* FIXME: signal this to userspace */ 661 663 + } 662 + if ( int3& PCF50633_INT3_ADCRDY) {664 + if (pcfirq[2] & PCF50633_INT3_ADCRDY) { 663 665 + /* ADC result ready */ 664 666 + DEBUGPC("ADCRDY "); 665 667 + } 666 + if ( int3& PCF50633_INT3_ONKEY1S) {668 + if (pcfirq[2] & PCF50633_INT3_ONKEY1S) { 667 669 + /* ONKEY pressed for more than 1 second */ 668 670 + pcf->onkey_seconds = 0; … … 676 678 + } 677 679 + 678 + if ( int4& (PCF50633_INT4_LOWBAT|PCF50633_INT4_LOWSYS)) {680 + if (pcfirq[3] & (PCF50633_INT4_LOWBAT|PCF50633_INT4_LOWSYS)) { 679 681 + /* Really low battery voltage, we have 8 seconds left */ 680 682 + DEBUGPC("LOWBAT "); … … 687 689 + PCF50633_OOCSHDWN_TOTRST); 688 690 + } 689 + if ( int4& PCF50633_INT4_HIGHTMP) {691 + if (pcfirq[3] & PCF50633_INT4_HIGHTMP) { 690 692 + /* High temperature */ 691 693 + DEBUGPC("HIGHTMP "); 692 694 + apm_queue_event(APM_CRITICAL_SUSPEND); 693 695 + } 694 + if ( int4& (PCF50633_INT4_AUTOPWRFAIL|PCF50633_INT4_DWN1PWRFAIL|696 + if (pcfirq[3] & (PCF50633_INT4_AUTOPWRFAIL|PCF50633_INT4_DWN1PWRFAIL| 695 697 + PCF50633_INT4_DWN2PWRFAIL|PCF50633_INT4_LEDPWRFAIL| 696 698 + PCF50633_INT4_LEDOVP)) {
Note: See TracChangeset
for help on using the changeset viewer.
