diff options
| author | Takashi Iwai <tiwai@suse.de> | 2009-01-15 12:27:20 -0500 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2009-01-15 12:27:20 -0500 |
| commit | c0106d72b8d71696dbe9dc80e2c77d4ac63f7531 (patch) | |
| tree | ca96d2baecb0555e36219ed6968dc8e306e530ca /include/linux/mfd/wm8350 | |
| parent | 5852973c129cf7c7e6c229abb7250673fc2a50c9 (diff) | |
| parent | eff317d0834ad1ff03f747f6bc2d76b9a9c95160 (diff) | |
Merge branch 'topic/asoc' into next/asoc
Diffstat (limited to 'include/linux/mfd/wm8350')
| -rw-r--r-- | include/linux/mfd/wm8350/comparator.h | 8 | ||||
| -rw-r--r-- | include/linux/mfd/wm8350/core.h | 52 | ||||
| -rw-r--r-- | include/linux/mfd/wm8350/pmic.h | 40 | ||||
| -rw-r--r-- | include/linux/mfd/wm8350/supply.h | 25 |
4 files changed, 122 insertions, 3 deletions
diff --git a/include/linux/mfd/wm8350/comparator.h b/include/linux/mfd/wm8350/comparator.h index 053788649452..54bc5d0fd502 100644 --- a/include/linux/mfd/wm8350/comparator.h +++ b/include/linux/mfd/wm8350/comparator.h | |||
| @@ -164,4 +164,12 @@ | |||
| 164 | #define WM8350_AUXADC_BATT 6 | 164 | #define WM8350_AUXADC_BATT 6 |
| 165 | #define WM8350_AUXADC_TEMP 7 | 165 | #define WM8350_AUXADC_TEMP 7 |
| 166 | 166 | ||
| 167 | struct wm8350; | ||
| 168 | |||
| 169 | /* | ||
| 170 | * AUX ADC Readback | ||
| 171 | */ | ||
| 172 | int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale, | ||
| 173 | int vref); | ||
| 174 | |||
| 167 | #endif | 175 | #endif |
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h index 6ebf97f2a475..980669d50dca 100644 --- a/include/linux/mfd/wm8350/core.h +++ b/include/linux/mfd/wm8350/core.h | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | */ | 29 | */ |
| 30 | #define WM8350_RESET_ID 0x00 | 30 | #define WM8350_RESET_ID 0x00 |
| 31 | #define WM8350_ID 0x01 | 31 | #define WM8350_ID 0x01 |
| 32 | #define WM8350_REVISION 0x02 | ||
| 32 | #define WM8350_SYSTEM_CONTROL_1 0x03 | 33 | #define WM8350_SYSTEM_CONTROL_1 0x03 |
| 33 | #define WM8350_SYSTEM_CONTROL_2 0x04 | 34 | #define WM8350_SYSTEM_CONTROL_2 0x04 |
| 34 | #define WM8350_SYSTEM_HIBERNATE 0x05 | 35 | #define WM8350_SYSTEM_HIBERNATE 0x05 |
| @@ -57,6 +58,10 @@ | |||
| 57 | #define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25 | 58 | #define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25 |
| 58 | #define WM8350_GPIO_INT_STATUS_MASK 0x26 | 59 | #define WM8350_GPIO_INT_STATUS_MASK 0x26 |
| 59 | #define WM8350_COMPARATOR_INT_STATUS_MASK 0x27 | 60 | #define WM8350_COMPARATOR_INT_STATUS_MASK 0x27 |
| 61 | #define WM8350_CHARGER_OVERRIDES 0xE2 | ||
| 62 | #define WM8350_MISC_OVERRIDES 0xE3 | ||
| 63 | #define WM8350_COMPARATOR_OVERRIDES 0xE7 | ||
| 64 | #define WM8350_STATE_MACHINE_STATUS 0xE9 | ||
| 60 | 65 | ||
| 61 | #define WM8350_MAX_REGISTER 0xFF | 66 | #define WM8350_MAX_REGISTER 0xFF |
| 62 | 67 | ||
| @@ -77,6 +82,11 @@ | |||
| 77 | #define WM8350_CUST_ID_MASK 0x00FF | 82 | #define WM8350_CUST_ID_MASK 0x00FF |
| 78 | 83 | ||
| 79 | /* | 84 | /* |
| 85 | * R2 (0x02) - Revision | ||
| 86 | */ | ||
| 87 | #define WM8350_MASK_REV_MASK 0x00FF | ||
| 88 | |||
| 89 | /* | ||
| 80 | * R3 (0x03) - System Control 1 | 90 | * R3 (0x03) - System Control 1 |
| 81 | */ | 91 | */ |
| 82 | #define WM8350_CHIP_ON 0x8000 | 92 | #define WM8350_CHIP_ON 0x8000 |
| @@ -523,6 +533,35 @@ | |||
| 523 | #define WM8350_DC2_STS 0x0002 | 533 | #define WM8350_DC2_STS 0x0002 |
| 524 | #define WM8350_DC1_STS 0x0001 | 534 | #define WM8350_DC1_STS 0x0001 |
| 525 | 535 | ||
| 536 | /* | ||
| 537 | * R226 (0xE2) - Charger status | ||
| 538 | */ | ||
| 539 | #define WM8350_CHG_BATT_HOT_OVRDE 0x8000 | ||
| 540 | #define WM8350_CHG_BATT_COLD_OVRDE 0x4000 | ||
| 541 | |||
| 542 | /* | ||
| 543 | * R227 (0xE3) - Misc Overrides | ||
| 544 | */ | ||
| 545 | #define WM8350_USB_LIMIT_OVRDE 0x0400 | ||
| 546 | |||
| 547 | /* | ||
| 548 | * R227 (0xE7) - Comparator Overrides | ||
| 549 | */ | ||
| 550 | #define WM8350_USB_FB_OVRDE 0x8000 | ||
| 551 | #define WM8350_WALL_FB_OVRDE 0x4000 | ||
| 552 | #define WM8350_BATT_FB_OVRDE 0x2000 | ||
| 553 | |||
| 554 | |||
| 555 | /* | ||
| 556 | * R233 (0xE9) - State Machinine Status | ||
| 557 | */ | ||
| 558 | #define WM8350_USB_SM_MASK 0x0700 | ||
| 559 | #define WM8350_USB_SM_SHIFT 8 | ||
| 560 | |||
| 561 | #define WM8350_USB_SM_100_SLV 1 | ||
| 562 | #define WM8350_USB_SM_500_SLV 5 | ||
| 563 | #define WM8350_USB_SM_STDBY_SLV 7 | ||
| 564 | |||
| 526 | /* WM8350 wake up conditions */ | 565 | /* WM8350 wake up conditions */ |
| 527 | #define WM8350_IRQ_WKUP_OFF_STATE 43 | 566 | #define WM8350_IRQ_WKUP_OFF_STATE 43 |
| 528 | #define WM8350_IRQ_WKUP_HIB_STATE 44 | 567 | #define WM8350_IRQ_WKUP_HIB_STATE 44 |
| @@ -536,6 +575,7 @@ | |||
| 536 | #define WM8350_REV_E 0x4 | 575 | #define WM8350_REV_E 0x4 |
| 537 | #define WM8350_REV_F 0x5 | 576 | #define WM8350_REV_F 0x5 |
| 538 | #define WM8350_REV_G 0x6 | 577 | #define WM8350_REV_G 0x6 |
| 578 | #define WM8350_REV_H 0x7 | ||
| 539 | 579 | ||
| 540 | #define WM8350_NUM_IRQ 63 | 580 | #define WM8350_NUM_IRQ 63 |
| 541 | 581 | ||
| @@ -549,6 +589,14 @@ extern const u16 wm8350_mode0_defaults[]; | |||
| 549 | extern const u16 wm8350_mode1_defaults[]; | 589 | extern const u16 wm8350_mode1_defaults[]; |
| 550 | extern const u16 wm8350_mode2_defaults[]; | 590 | extern const u16 wm8350_mode2_defaults[]; |
| 551 | extern const u16 wm8350_mode3_defaults[]; | 591 | extern const u16 wm8350_mode3_defaults[]; |
| 592 | extern const u16 wm8351_mode0_defaults[]; | ||
| 593 | extern const u16 wm8351_mode1_defaults[]; | ||
| 594 | extern const u16 wm8351_mode2_defaults[]; | ||
| 595 | extern const u16 wm8351_mode3_defaults[]; | ||
| 596 | extern const u16 wm8352_mode0_defaults[]; | ||
| 597 | extern const u16 wm8352_mode1_defaults[]; | ||
| 598 | extern const u16 wm8352_mode2_defaults[]; | ||
| 599 | extern const u16 wm8352_mode3_defaults[]; | ||
| 552 | 600 | ||
| 553 | struct wm8350; | 601 | struct wm8350; |
| 554 | 602 | ||
| @@ -558,8 +606,6 @@ struct wm8350_irq { | |||
| 558 | }; | 606 | }; |
| 559 | 607 | ||
| 560 | struct wm8350 { | 608 | struct wm8350 { |
| 561 | int rev; /* chip revision */ | ||
| 562 | |||
| 563 | struct device *dev; | 609 | struct device *dev; |
| 564 | 610 | ||
| 565 | /* device IO */ | 611 | /* device IO */ |
| @@ -572,6 +618,8 @@ struct wm8350 { | |||
| 572 | void *src); | 618 | void *src); |
| 573 | u16 *reg_cache; | 619 | u16 *reg_cache; |
| 574 | 620 | ||
| 621 | struct mutex auxadc_mutex; | ||
| 622 | |||
| 575 | /* Interrupt handling */ | 623 | /* Interrupt handling */ |
| 576 | struct work_struct irq_work; | 624 | struct work_struct irq_work; |
| 577 | struct mutex irq_mutex; /* IRQ table mutex */ | 625 | struct mutex irq_mutex; /* IRQ table mutex */ |
diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h index 69b69e07f62f..be3264e286e0 100644 --- a/include/linux/mfd/wm8350/pmic.h +++ b/include/linux/mfd/wm8350/pmic.h | |||
| @@ -13,6 +13,10 @@ | |||
| 13 | #ifndef __LINUX_MFD_WM8350_PMIC_H | 13 | #ifndef __LINUX_MFD_WM8350_PMIC_H |
| 14 | #define __LINUX_MFD_WM8350_PMIC_H | 14 | #define __LINUX_MFD_WM8350_PMIC_H |
| 15 | 15 | ||
| 16 | #include <linux/platform_device.h> | ||
| 17 | #include <linux/leds.h> | ||
| 18 | #include <linux/regulator/machine.h> | ||
| 19 | |||
| 16 | /* | 20 | /* |
| 17 | * Register values. | 21 | * Register values. |
| 18 | */ | 22 | */ |
| @@ -700,7 +704,38 @@ struct wm8350; | |||
| 700 | struct platform_device; | 704 | struct platform_device; |
| 701 | struct regulator_init_data; | 705 | struct regulator_init_data; |
| 702 | 706 | ||
| 707 | /* | ||
| 708 | * WM8350 LED platform data | ||
| 709 | */ | ||
| 710 | struct wm8350_led_platform_data { | ||
| 711 | const char *name; | ||
| 712 | const char *default_trigger; | ||
| 713 | int max_uA; | ||
| 714 | }; | ||
| 715 | |||
| 716 | struct wm8350_led { | ||
| 717 | struct platform_device *pdev; | ||
| 718 | struct mutex mutex; | ||
| 719 | struct work_struct work; | ||
| 720 | spinlock_t value_lock; | ||
| 721 | enum led_brightness value; | ||
| 722 | struct led_classdev cdev; | ||
| 723 | int max_uA_index; | ||
| 724 | int enabled; | ||
| 725 | |||
| 726 | struct regulator *isink; | ||
| 727 | struct regulator_consumer_supply isink_consumer; | ||
| 728 | struct regulator_init_data isink_init; | ||
| 729 | struct regulator *dcdc; | ||
| 730 | struct regulator_consumer_supply dcdc_consumer; | ||
| 731 | struct regulator_init_data dcdc_init; | ||
| 732 | }; | ||
| 733 | |||
| 703 | struct wm8350_pmic { | 734 | struct wm8350_pmic { |
| 735 | /* Number of regulators of each type on this device */ | ||
| 736 | int max_dcdc; | ||
| 737 | int max_isink; | ||
| 738 | |||
| 704 | /* ISINK to DCDC mapping */ | 739 | /* ISINK to DCDC mapping */ |
| 705 | int isink_A_dcdc; | 740 | int isink_A_dcdc; |
| 706 | int isink_B_dcdc; | 741 | int isink_B_dcdc; |
| @@ -713,10 +748,15 @@ struct wm8350_pmic { | |||
| 713 | 748 | ||
| 714 | /* regulator devices */ | 749 | /* regulator devices */ |
| 715 | struct platform_device *pdev[NUM_WM8350_REGULATORS]; | 750 | struct platform_device *pdev[NUM_WM8350_REGULATORS]; |
| 751 | |||
| 752 | /* LED devices */ | ||
| 753 | struct wm8350_led led[2]; | ||
| 716 | }; | 754 | }; |
| 717 | 755 | ||
| 718 | int wm8350_register_regulator(struct wm8350 *wm8350, int reg, | 756 | int wm8350_register_regulator(struct wm8350 *wm8350, int reg, |
| 719 | struct regulator_init_data *initdata); | 757 | struct regulator_init_data *initdata); |
| 758 | int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink, | ||
| 759 | struct wm8350_led_platform_data *pdata); | ||
| 720 | 760 | ||
| 721 | /* | 761 | /* |
| 722 | * Additional DCDC control not supported via regulator API | 762 | * Additional DCDC control not supported via regulator API |
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h index 1c8f3cde79b0..2b9479310bbd 100644 --- a/include/linux/mfd/wm8350/supply.h +++ b/include/linux/mfd/wm8350/supply.h | |||
| @@ -13,7 +13,8 @@ | |||
| 13 | #ifndef __LINUX_MFD_WM8350_SUPPLY_H_ | 13 | #ifndef __LINUX_MFD_WM8350_SUPPLY_H_ |
| 14 | #define __LINUX_MFD_WM8350_SUPPLY_H_ | 14 | #define __LINUX_MFD_WM8350_SUPPLY_H_ |
| 15 | 15 | ||
| 16 | #include <linux/platform_device.h> | 16 | #include <linux/mutex.h> |
| 17 | #include <linux/power_supply.h> | ||
| 17 | 18 | ||
| 18 | /* | 19 | /* |
| 19 | * Charger registers | 20 | * Charger registers |
| @@ -104,8 +105,30 @@ | |||
| 104 | #define WM8350_IRQ_EXT_WALL_FB 37 | 105 | #define WM8350_IRQ_EXT_WALL_FB 37 |
| 105 | #define WM8350_IRQ_EXT_BAT_FB 38 | 106 | #define WM8350_IRQ_EXT_BAT_FB 38 |
| 106 | 107 | ||
| 108 | /* | ||
| 109 | * Policy to control charger state machine. | ||
| 110 | */ | ||
| 111 | struct wm8350_charger_policy { | ||
| 112 | |||
| 113 | /* charger state machine policy - set in machine driver */ | ||
| 114 | int eoc_mA; /* end of charge current (mA) */ | ||
| 115 | int charge_mV; /* charge voltage */ | ||
| 116 | int fast_limit_mA; /* fast charge current limit */ | ||
| 117 | int fast_limit_USB_mA; /* USB fast charge current limit */ | ||
| 118 | int charge_timeout; /* charge timeout (mins) */ | ||
| 119 | int trickle_start_mV; /* trickle charge starts at mV */ | ||
| 120 | int trickle_charge_mA; /* trickle charge current */ | ||
| 121 | int trickle_charge_USB_mA; /* USB trickle charge current */ | ||
| 122 | }; | ||
| 123 | |||
| 107 | struct wm8350_power { | 124 | struct wm8350_power { |
| 108 | struct platform_device *pdev; | 125 | struct platform_device *pdev; |
| 126 | struct power_supply battery; | ||
| 127 | struct power_supply usb; | ||
| 128 | struct power_supply ac; | ||
| 129 | struct wm8350_charger_policy *policy; | ||
| 130 | |||
| 131 | int rev_g_coeff; | ||
| 109 | }; | 132 | }; |
| 110 | 133 | ||
| 111 | #endif | 134 | #endif |
