Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'mfd-for-linus-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6

Pull MFD fixes from Samuel Ortiz:
"This is the first pull request for MFD fixes for 3.8

We have some build failure fixes (twl4030, vexpress, abx500 and
tps65910), some actual runtime oops and lockup fixes (rtsx, da9052),
and some more hypothetical NULL pointers dereferences fixes for
pcf50633 and max776xx.

Then we also have additional rtsx fixes for a correct switch output
voltage and clock divider correctness for rtl8411 (rtsx driver), and
irqdomain fix for db8550-prcmu, and some more cosmetic fixes for
arizona and wm5102."

* tag 'mfd-for-linus-3.8-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6:
mfd: rtsx: Fix oops when rtsx_pci_sdmmc is not probed
mfd: wm5102: Fix definition of WM5102_MAX_REGISTER
mfd: twl4030: Don't warn about uninitialized return code
mfd: da9052/53 lockup fix
mfd: rtsx: Add clock divider hook
mmc: rtsx: Call MFD hook to switch output voltage
mfd: rtsx: Add output voltage switch hook
mfd: Fix compile errors and warnings when !CONFIG_AB8500_BM
mfd: vexpress: Export global functions to fix build error
mfd: arizona: Check errors from regcache_sync()
mfd: tc3589x: Use simple irqdomain
mfd: pcf50633: Init pcf->dev before using it
mfd: max77693: Init max77693->dev before using it
mfd: max77686: Init max77686->dev before using it
mfd: db8500-prcmu: Fix irqdomain usage
mfd: tps65910: Select REGMAP_IRQ in Kconfig to fix build error
mfd: arizona: Disable control interface reporting for WM5102 and WM5110

+314 -129
+1
drivers/mfd/Kconfig
··· 237 237 depends on I2C=y && GPIOLIB 238 238 select MFD_CORE 239 239 select REGMAP_I2C 240 + select REGMAP_IRQ 240 241 select IRQ_DOMAIN 241 242 help 242 243 if you say yes here you get support for the TPS65910 series of
+1
drivers/mfd/ab8500-core.c
··· 19 19 #include <linux/mfd/core.h> 20 20 #include <linux/mfd/abx500.h> 21 21 #include <linux/mfd/abx500/ab8500.h> 22 + #include <linux/mfd/abx500/ab8500-bm.h> 22 23 #include <linux/mfd/dbx500-prcmu.h> 23 24 #include <linux/regulator/ab8500.h> 24 25 #include <linux/of.h>
+6 -1
drivers/mfd/arizona-core.c
··· 239 239 return ret; 240 240 } 241 241 242 - regcache_sync(arizona->regmap); 242 + ret = regcache_sync(arizona->regmap); 243 + if (ret != 0) { 244 + dev_err(arizona->dev, "Failed to restore register cache\n"); 245 + regulator_disable(arizona->dcvdd); 246 + return ret; 247 + } 243 248 244 249 return 0; 245 250 }
+2 -16
drivers/mfd/arizona-irq.c
··· 176 176 aod = &wm5102_aod; 177 177 irq = &wm5102_irq; 178 178 179 - switch (arizona->rev) { 180 - case 0: 181 - case 1: 182 - ctrlif_error = false; 183 - break; 184 - default: 185 - break; 186 - } 179 + ctrlif_error = false; 187 180 break; 188 181 #endif 189 182 #ifdef CONFIG_MFD_WM5110 ··· 184 191 aod = &wm5110_aod; 185 192 irq = &wm5110_irq; 186 193 187 - switch (arizona->rev) { 188 - case 0: 189 - case 1: 190 - ctrlif_error = false; 191 - break; 192 - default: 193 - break; 194 - } 194 + ctrlif_error = false; 195 195 break; 196 196 #endif 197 197 default:
+61
drivers/mfd/da9052-i2c.c
··· 27 27 #include <linux/of_device.h> 28 28 #endif 29 29 30 + /* I2C safe register check */ 31 + static inline bool i2c_safe_reg(unsigned char reg) 32 + { 33 + switch (reg) { 34 + case DA9052_STATUS_A_REG: 35 + case DA9052_STATUS_B_REG: 36 + case DA9052_STATUS_C_REG: 37 + case DA9052_STATUS_D_REG: 38 + case DA9052_ADC_RES_L_REG: 39 + case DA9052_ADC_RES_H_REG: 40 + case DA9052_VDD_RES_REG: 41 + case DA9052_ICHG_AV_REG: 42 + case DA9052_TBAT_RES_REG: 43 + case DA9052_ADCIN4_RES_REG: 44 + case DA9052_ADCIN5_RES_REG: 45 + case DA9052_ADCIN6_RES_REG: 46 + case DA9052_TJUNC_RES_REG: 47 + case DA9052_TSI_X_MSB_REG: 48 + case DA9052_TSI_Y_MSB_REG: 49 + case DA9052_TSI_LSB_REG: 50 + case DA9052_TSI_Z_MSB_REG: 51 + return true; 52 + default: 53 + return false; 54 + } 55 + } 56 + 57 + /* 58 + * There is an issue with DA9052 and DA9053_AA/BA/BB PMIC where the PMIC 59 + * gets lockup up or fails to respond following a system reset. 60 + * This fix is to follow any read or write with a dummy read to a safe 61 + * register. 62 + */ 63 + int da9052_i2c_fix(struct da9052 *da9052, unsigned char reg) 64 + { 65 + int val; 66 + 67 + switch (da9052->chip_id) { 68 + case DA9052: 69 + case DA9053_AA: 70 + case DA9053_BA: 71 + case DA9053_BB: 72 + /* A dummy read to a safe register address. */ 73 + if (!i2c_safe_reg(reg)) 74 + return regmap_read(da9052->regmap, 75 + DA9052_PARK_REGISTER, 76 + &val); 77 + break; 78 + default: 79 + /* 80 + * For other chips parking of I2C register 81 + * to a safe place is not required. 82 + */ 83 + break; 84 + } 85 + 86 + return 0; 87 + } 88 + EXPORT_SYMBOL(da9052_i2c_fix); 89 + 30 90 static int da9052_i2c_enable_multiwrite(struct da9052 *da9052) 31 91 { 32 92 int reg_val, ret; ··· 143 83 144 84 da9052->dev = &client->dev; 145 85 da9052->chip_irq = client->irq; 86 + da9052->fix_io = da9052_i2c_fix; 146 87 147 88 i2c_set_clientdata(client, da9052); 148 89
+9 -4
drivers/mfd/db8500-prcmu.c
··· 2524 2524 2525 2525 for (n = 0; n < NUM_PRCMU_WAKEUPS; n++) { 2526 2526 if (ev & prcmu_irq_bit[n]) 2527 - generic_handle_irq(IRQ_PRCMU_BASE + n); 2527 + generic_handle_irq(irq_find_mapping(db8500_irq_domain, n)); 2528 2528 } 2529 2529 r = true; 2530 2530 break; ··· 2737 2737 } 2738 2738 2739 2739 static struct irq_domain_ops db8500_irq_ops = { 2740 - .map = db8500_irq_map, 2741 - .xlate = irq_domain_xlate_twocell, 2740 + .map = db8500_irq_map, 2741 + .xlate = irq_domain_xlate_twocell, 2742 2742 }; 2743 2743 2744 2744 static int db8500_irq_init(struct device_node *np) 2745 2745 { 2746 - int irq_base = -1; 2746 + int irq_base = 0; 2747 + int i; 2747 2748 2748 2749 /* In the device tree case, just take some IRQs */ 2749 2750 if (!np) ··· 2758 2757 pr_err("Failed to create irqdomain\n"); 2759 2758 return -ENOSYS; 2760 2759 } 2760 + 2761 + /* All wakeups will be used, so create mappings for all */ 2762 + for (i = 0; i < NUM_PRCMU_WAKEUPS; i++) 2763 + irq_create_mapping(db8500_irq_domain, i); 2761 2764 2762 2765 return 0; 2763 2766 }
+9 -9
drivers/mfd/max77686.c
··· 93 93 if (max77686 == NULL) 94 94 return -ENOMEM; 95 95 96 - max77686->regmap = regmap_init_i2c(i2c, &max77686_regmap_config); 97 - if (IS_ERR(max77686->regmap)) { 98 - ret = PTR_ERR(max77686->regmap); 99 - dev_err(max77686->dev, "Failed to allocate register map: %d\n", 100 - ret); 101 - kfree(max77686); 102 - return ret; 103 - } 104 - 105 96 i2c_set_clientdata(i2c, max77686); 106 97 max77686->dev = &i2c->dev; 107 98 max77686->i2c = i2c; ··· 101 110 max77686->wakeup = pdata->wakeup; 102 111 max77686->irq_gpio = pdata->irq_gpio; 103 112 max77686->irq = i2c->irq; 113 + 114 + max77686->regmap = regmap_init_i2c(i2c, &max77686_regmap_config); 115 + if (IS_ERR(max77686->regmap)) { 116 + ret = PTR_ERR(max77686->regmap); 117 + dev_err(max77686->dev, "Failed to allocate register map: %d\n", 118 + ret); 119 + kfree(max77686); 120 + return ret; 121 + } 104 122 105 123 if (regmap_read(max77686->regmap, 106 124 MAX77686_REG_DEVICE_ID, &data) < 0) {
+18 -16
drivers/mfd/max77693.c
··· 114 114 u8 reg_data; 115 115 int ret = 0; 116 116 117 + if (!pdata) { 118 + dev_err(&i2c->dev, "No platform data found.\n"); 119 + return -EINVAL; 120 + } 121 + 117 122 max77693 = devm_kzalloc(&i2c->dev, 118 123 sizeof(struct max77693_dev), GFP_KERNEL); 119 124 if (max77693 == NULL) 120 125 return -ENOMEM; 121 - 122 - max77693->regmap = devm_regmap_init_i2c(i2c, &max77693_regmap_config); 123 - if (IS_ERR(max77693->regmap)) { 124 - ret = PTR_ERR(max77693->regmap); 125 - dev_err(max77693->dev,"failed to allocate register map: %d\n", 126 - ret); 127 - goto err_regmap; 128 - } 129 126 130 127 i2c_set_clientdata(i2c, max77693); 131 128 max77693->dev = &i2c->dev; ··· 130 133 max77693->irq = i2c->irq; 131 134 max77693->type = id->driver_data; 132 135 133 - if (!pdata) 134 - goto err_regmap; 136 + max77693->regmap = devm_regmap_init_i2c(i2c, &max77693_regmap_config); 137 + if (IS_ERR(max77693->regmap)) { 138 + ret = PTR_ERR(max77693->regmap); 139 + dev_err(max77693->dev, "failed to allocate register map: %d\n", 140 + ret); 141 + return ret; 142 + } 135 143 136 144 max77693->wakeup = pdata->wakeup; 137 145 138 - if (max77693_read_reg(max77693->regmap, 139 - MAX77693_PMIC_REG_PMIC_ID2, &reg_data) < 0) { 146 + ret = max77693_read_reg(max77693->regmap, MAX77693_PMIC_REG_PMIC_ID2, 147 + &reg_data); 148 + if (ret < 0) { 140 149 dev_err(max77693->dev, "device not found on this channel\n"); 141 - ret = -ENODEV; 142 - goto err_regmap; 150 + return ret; 143 151 } else 144 152 dev_info(max77693->dev, "device ID: 0x%x\n", reg_data); 145 153 ··· 165 163 ret = PTR_ERR(max77693->regmap_muic); 166 164 dev_err(max77693->dev, 167 165 "failed to allocate register map: %d\n", ret); 168 - goto err_regmap; 166 + goto err_regmap_muic; 169 167 } 170 168 171 169 ret = max77693_irq_init(max77693); ··· 186 184 err_mfd: 187 185 max77693_irq_exit(max77693); 188 186 err_irq: 187 + err_regmap_muic: 189 188 i2c_unregister_device(max77693->muic); 190 189 i2c_unregister_device(max77693->haptic); 191 - err_regmap: 192 190 return ret; 193 191 } 194 192
+2 -3
drivers/mfd/pcf50633-core.c
··· 208 208 if (!pcf) 209 209 return -ENOMEM; 210 210 211 + i2c_set_clientdata(client, pcf); 212 + pcf->dev = &client->dev; 211 213 pcf->pdata = pdata; 212 214 213 215 mutex_init(&pcf->lock); ··· 220 218 dev_err(pcf->dev, "Failed to allocate register map: %d\n", ret); 221 219 return ret; 222 220 } 223 - 224 - i2c_set_clientdata(client, pcf); 225 - pcf->dev = &client->dev; 226 221 227 222 version = pcf50633_reg_read(pcf, 0); 228 223 variant = pcf50633_reg_read(pcf, 1);
+29
drivers/mfd/rtl8411.c
··· 112 112 BPP_LDO_POWB, BPP_LDO_SUSPEND); 113 113 } 114 114 115 + static int rtl8411_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) 116 + { 117 + u8 mask, val; 118 + 119 + mask = (BPP_REG_TUNED18 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_MASK; 120 + if (voltage == OUTPUT_3V3) 121 + val = (BPP_ASIC_3V3 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_3V3; 122 + else if (voltage == OUTPUT_1V8) 123 + val = (BPP_ASIC_1V8 << BPP_TUNED18_SHIFT_8411) | BPP_PAD_1V8; 124 + else 125 + return -EINVAL; 126 + 127 + return rtsx_pci_write_register(pcr, LDO_CTL, mask, val); 128 + } 129 + 115 130 static unsigned int rtl8411_cd_deglitch(struct rtsx_pcr *pcr) 116 131 { 117 132 unsigned int card_exist; ··· 178 163 return card_exist; 179 164 } 180 165 166 + static int rtl8411_conv_clk_and_div_n(int input, int dir) 167 + { 168 + int output; 169 + 170 + if (dir == CLK_TO_DIV_N) 171 + output = input * 4 / 5 - 2; 172 + else 173 + output = (input + 2) * 5 / 4; 174 + 175 + return output; 176 + } 177 + 181 178 static const struct pcr_ops rtl8411_pcr_ops = { 182 179 .extra_init_hw = rtl8411_extra_init_hw, 183 180 .optimize_phy = NULL, ··· 199 172 .disable_auto_blink = rtl8411_disable_auto_blink, 200 173 .card_power_on = rtl8411_card_power_on, 201 174 .card_power_off = rtl8411_card_power_off, 175 + .switch_output_voltage = rtl8411_switch_output_voltage, 202 176 .cd_deglitch = rtl8411_cd_deglitch, 177 + .conv_clk_and_div_n = rtl8411_conv_clk_and_div_n, 203 178 }; 204 179 205 180 /* SD Pull Control Enable:
+21
drivers/mfd/rts5209.c
··· 144 144 return rtsx_pci_send_cmd(pcr, 100); 145 145 } 146 146 147 + static int rts5209_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) 148 + { 149 + int err; 150 + 151 + if (voltage == OUTPUT_3V3) { 152 + err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24); 153 + if (err < 0) 154 + return err; 155 + } else if (voltage == OUTPUT_1V8) { 156 + err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24); 157 + if (err < 0) 158 + return err; 159 + } else { 160 + return -EINVAL; 161 + } 162 + 163 + return 0; 164 + } 165 + 147 166 static const struct pcr_ops rts5209_pcr_ops = { 148 167 .extra_init_hw = rts5209_extra_init_hw, 149 168 .optimize_phy = rts5209_optimize_phy, ··· 172 153 .disable_auto_blink = rts5209_disable_auto_blink, 173 154 .card_power_on = rts5209_card_power_on, 174 155 .card_power_off = rts5209_card_power_off, 156 + .switch_output_voltage = rts5209_switch_output_voltage, 175 157 .cd_deglitch = NULL, 158 + .conv_clk_and_div_n = NULL, 176 159 }; 177 160 178 161 /* SD Pull Control Enable:
+21
drivers/mfd/rts5229.c
··· 114 114 return rtsx_pci_send_cmd(pcr, 100); 115 115 } 116 116 117 + static int rts5229_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) 118 + { 119 + int err; 120 + 121 + if (voltage == OUTPUT_3V3) { 122 + err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24); 123 + if (err < 0) 124 + return err; 125 + } else if (voltage == OUTPUT_1V8) { 126 + err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24); 127 + if (err < 0) 128 + return err; 129 + } else { 130 + return -EINVAL; 131 + } 132 + 133 + return 0; 134 + } 135 + 117 136 static const struct pcr_ops rts5229_pcr_ops = { 118 137 .extra_init_hw = rts5229_extra_init_hw, 119 138 .optimize_phy = rts5229_optimize_phy, ··· 142 123 .disable_auto_blink = rts5229_disable_auto_blink, 143 124 .card_power_on = rts5229_card_power_on, 144 125 .card_power_off = rts5229_card_power_off, 126 + .switch_output_voltage = rts5229_switch_output_voltage, 145 127 .cd_deglitch = NULL, 128 + .conv_clk_and_div_n = NULL, 146 129 }; 147 130 148 131 /* SD Pull Control Enable:
+23 -4
drivers/mfd/rtsx_pcr.c
··· 630 630 if (clk == pcr->cur_clock) 631 631 return 0; 632 632 633 - N = (u8)(clk - 2); 633 + if (pcr->ops->conv_clk_and_div_n) 634 + N = (u8)pcr->ops->conv_clk_and_div_n(clk, CLK_TO_DIV_N); 635 + else 636 + N = (u8)(clk - 2); 634 637 if ((clk <= 2) || (N > max_N)) 635 638 return -EINVAL; 636 639 ··· 644 641 /* Make sure that the SSC clock div_n is equal or greater than min_N */ 645 642 div = CLK_DIV_1; 646 643 while ((N < min_N) && (div < max_div)) { 647 - N = (N + 2) * 2 - 2; 644 + if (pcr->ops->conv_clk_and_div_n) { 645 + int dbl_clk = pcr->ops->conv_clk_and_div_n(N, 646 + DIV_N_TO_CLK) * 2; 647 + N = (u8)pcr->ops->conv_clk_and_div_n(dbl_clk, 648 + CLK_TO_DIV_N); 649 + } else { 650 + N = (N + 2) * 2 - 2; 651 + } 648 652 div++; 649 653 } 650 654 dev_dbg(&(pcr->pci->dev), "N = %d, div = %d\n", N, div); ··· 712 702 return 0; 713 703 } 714 704 EXPORT_SYMBOL_GPL(rtsx_pci_card_power_off); 705 + 706 + int rtsx_pci_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage) 707 + { 708 + if (pcr->ops->switch_output_voltage) 709 + return pcr->ops->switch_output_voltage(pcr, voltage); 710 + 711 + return 0; 712 + } 713 + EXPORT_SYMBOL_GPL(rtsx_pci_switch_output_voltage); 715 714 716 715 unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr) 717 716 { ··· 786 767 787 768 spin_unlock_irqrestore(&pcr->lock, flags); 788 769 789 - if (card_detect & SD_EXIST) 770 + if ((card_detect & SD_EXIST) && pcr->slots[RTSX_SD_CARD].card_event) 790 771 pcr->slots[RTSX_SD_CARD].card_event( 791 772 pcr->slots[RTSX_SD_CARD].p_dev); 792 - if (card_detect & MS_EXIST) 773 + if ((card_detect & MS_EXIST) && pcr->slots[RTSX_MS_CARD].card_event) 793 774 pcr->slots[RTSX_MS_CARD].card_event( 794 775 pcr->slots[RTSX_MS_CARD].p_dev); 795 776 }
+5 -12
drivers/mfd/tc3589x.c
··· 219 219 } 220 220 221 221 static struct irq_domain_ops tc3589x_irq_ops = { 222 - .map = tc3589x_irq_map, 222 + .map = tc3589x_irq_map, 223 223 .unmap = tc3589x_irq_unmap, 224 - .xlate = irq_domain_xlate_twocell, 224 + .xlate = irq_domain_xlate_twocell, 225 225 }; 226 226 227 227 static int tc3589x_irq_init(struct tc3589x *tc3589x, struct device_node *np) 228 228 { 229 229 int base = tc3589x->irq_base; 230 230 231 - if (base) { 232 - tc3589x->domain = irq_domain_add_legacy( 233 - NULL, TC3589x_NR_INTERNAL_IRQS, base, 234 - 0, &tc3589x_irq_ops, tc3589x); 235 - } 236 - else { 237 - tc3589x->domain = irq_domain_add_linear( 238 - np, TC3589x_NR_INTERNAL_IRQS, 239 - &tc3589x_irq_ops, tc3589x); 240 - } 231 + tc3589x->domain = irq_domain_add_simple( 232 + np, TC3589x_NR_INTERNAL_IRQS, base, 233 + &tc3589x_irq_ops, tc3589x); 241 234 242 235 if (!tc3589x->domain) { 243 236 dev_err(tc3589x->dev, "Failed to create irqdomain\n");
+1 -1
drivers/mfd/twl4030-power.c
··· 159 159 static int twl4030_write_script(u8 address, struct twl4030_ins *script, 160 160 int len) 161 161 { 162 - int err; 162 + int err = -EINVAL; 163 163 164 164 for (; len; len--, address++, script++) { 165 165 if (len == 1) {
+6 -2
drivers/mfd/vexpress-config.c
··· 67 67 68 68 return bridge; 69 69 } 70 + EXPORT_SYMBOL(vexpress_config_bridge_register); 70 71 71 72 void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge) 72 73 { ··· 84 83 while (!list_empty(&__bridge.transactions)) 85 84 cpu_relax(); 86 85 } 86 + EXPORT_SYMBOL(vexpress_config_bridge_unregister); 87 87 88 88 89 89 struct vexpress_config_func { ··· 144 142 145 143 return func; 146 144 } 145 + EXPORT_SYMBOL(__vexpress_config_func_get); 147 146 148 147 void vexpress_config_func_put(struct vexpress_config_func *func) 149 148 { ··· 152 149 of_node_put(func->bridge->node); 153 150 kfree(func); 154 151 } 155 - 152 + EXPORT_SYMBOL(vexpress_config_func_put); 156 153 157 154 struct vexpress_config_trans { 158 155 struct vexpress_config_func *func; ··· 232 229 233 230 complete(&trans->completion); 234 231 } 232 + EXPORT_SYMBOL(vexpress_config_complete); 235 233 236 234 int vexpress_config_wait(struct vexpress_config_trans *trans) 237 235 { ··· 240 236 241 237 return trans->status; 242 238 } 243 - 239 + EXPORT_SYMBOL(vexpress_config_wait); 244 240 245 241 int vexpress_config_read(struct vexpress_config_func *func, int offset, 246 242 u32 *data)
+1 -1
drivers/mfd/wm5102-tables.c
··· 1882 1882 } 1883 1883 } 1884 1884 1885 - #define WM5102_MAX_REGISTER 0x1a8fff 1885 + #define WM5102_MAX_REGISTER 0x1a9800 1886 1886 1887 1887 const struct regmap_config wm5102_spi_regmap = { 1888 1888 .reg_bits = 32,
+5 -25
drivers/mmc/host/rtsx_pci_sdmmc.c
··· 1060 1060 return 0; 1061 1061 } 1062 1062 1063 - static int sd_change_bank_voltage(struct realtek_pci_sdmmc *host, u8 voltage) 1064 - { 1065 - struct rtsx_pcr *pcr = host->pcr; 1066 - int err; 1067 - 1068 - if (voltage == SD_IO_3V3) { 1069 - err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4FC0 | 0x24); 1070 - if (err < 0) 1071 - return err; 1072 - } else if (voltage == SD_IO_1V8) { 1073 - err = rtsx_pci_write_phy_register(pcr, 0x08, 0x4C40 | 0x24); 1074 - if (err < 0) 1075 - return err; 1076 - } else { 1077 - return -EINVAL; 1078 - } 1079 - 1080 - return 0; 1081 - } 1082 - 1083 1063 static int sdmmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) 1084 1064 { 1085 1065 struct realtek_pci_sdmmc *host = mmc_priv(mmc); ··· 1078 1098 rtsx_pci_start_run(pcr); 1079 1099 1080 1100 if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) 1081 - voltage = SD_IO_3V3; 1101 + voltage = OUTPUT_3V3; 1082 1102 else 1083 - voltage = SD_IO_1V8; 1103 + voltage = OUTPUT_1V8; 1084 1104 1085 - if (voltage == SD_IO_1V8) { 1105 + if (voltage == OUTPUT_1V8) { 1086 1106 err = rtsx_pci_write_register(pcr, 1087 1107 SD30_DRIVE_SEL, 0x07, DRIVER_TYPE_B); 1088 1108 if (err < 0) ··· 1093 1113 goto out; 1094 1114 } 1095 1115 1096 - err = sd_change_bank_voltage(host, voltage); 1116 + err = rtsx_pci_switch_output_voltage(pcr, voltage); 1097 1117 if (err < 0) 1098 1118 goto out; 1099 1119 1100 - if (voltage == SD_IO_1V8) { 1120 + if (voltage == OUTPUT_1V8) { 1101 1121 err = sd_wait_voltage_stable_2(host); 1102 1122 if (err < 0) 1103 1123 goto out;
-2
include/linux/mfd/abx500.h
··· 272 272 const struct abx500_fg_parameters *fg_params; 273 273 }; 274 274 275 - extern struct abx500_bm_data ab8500_bm_data; 276 - 277 275 enum { 278 276 NTC_EXTERNAL = 0, 279 277 NTC_INTERNAL,
+4 -25
include/linux/mfd/abx500/ab8500-bm.h
··· 422 422 struct ab8500_btemp; 423 423 struct ab8500_gpadc; 424 424 struct ab8500_fg; 425 + 425 426 #ifdef CONFIG_AB8500_BM 427 + extern struct abx500_bm_data ab8500_bm_data; 428 + 426 429 void ab8500_fg_reinit(void); 427 430 void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA); 428 431 struct ab8500_btemp *ab8500_btemp_get(void); ··· 437 434 int ab8500_fg_inst_curr_done(struct ab8500_fg *di); 438 435 439 436 #else 440 - int ab8500_fg_inst_curr_done(struct ab8500_fg *di) 441 - { 442 - } 443 - static void ab8500_fg_reinit(void) 444 - { 445 - } 446 - static void ab8500_charger_usb_state_changed(u8 bm_usb_state, u16 mA) 447 - { 448 - } 449 - static struct ab8500_btemp *ab8500_btemp_get(void) 450 - { 451 - return NULL; 452 - } 453 - static int ab8500_btemp_get_batctrl_temp(struct ab8500_btemp *btemp) 454 - { 455 - return 0; 456 - } 457 - struct ab8500_fg *ab8500_fg_get(void) 458 - { 459 - return NULL; 460 - } 461 - static int ab8500_fg_inst_curr_blocking(struct ab8500_fg *dev) 462 - { 463 - return -ENODEV; 464 - } 437 + static struct abx500_bm_data ab8500_bm_data; 465 438 466 439 static inline int ab8500_fg_inst_curr_start(struct ab8500_fg *di) 467 440 {
+62 -4
include/linux/mfd/da9052/da9052.h
··· 99 99 u8 chip_id; 100 100 101 101 int chip_irq; 102 + 103 + /* SOC I/O transfer related fixes for DA9052/53 */ 104 + int (*fix_io) (struct da9052 *da9052, unsigned char reg); 102 105 }; 103 106 104 107 /* ADC API */ ··· 116 113 ret = regmap_read(da9052->regmap, reg, &val); 117 114 if (ret < 0) 118 115 return ret; 116 + 117 + if (da9052->fix_io) { 118 + ret = da9052->fix_io(da9052, reg); 119 + if (ret < 0) 120 + return ret; 121 + } 122 + 119 123 return val; 120 124 } 121 125 122 126 static inline int da9052_reg_write(struct da9052 *da9052, unsigned char reg, 123 127 unsigned char val) 124 128 { 125 - return regmap_write(da9052->regmap, reg, val); 129 + int ret; 130 + 131 + ret = regmap_write(da9052->regmap, reg, val); 132 + if (ret < 0) 133 + return ret; 134 + 135 + if (da9052->fix_io) { 136 + ret = da9052->fix_io(da9052, reg); 137 + if (ret < 0) 138 + return ret; 139 + } 140 + 141 + return ret; 126 142 } 127 143 128 144 static inline int da9052_group_read(struct da9052 *da9052, unsigned char reg, 129 145 unsigned reg_cnt, unsigned char *val) 130 146 { 131 - return regmap_bulk_read(da9052->regmap, reg, val, reg_cnt); 147 + int ret; 148 + 149 + ret = regmap_bulk_read(da9052->regmap, reg, val, reg_cnt); 150 + if (ret < 0) 151 + return ret; 152 + 153 + if (da9052->fix_io) { 154 + ret = da9052->fix_io(da9052, reg); 155 + if (ret < 0) 156 + return ret; 157 + } 158 + 159 + return ret; 132 160 } 133 161 134 162 static inline int da9052_group_write(struct da9052 *da9052, unsigned char reg, 135 163 unsigned reg_cnt, unsigned char *val) 136 164 { 137 - return regmap_raw_write(da9052->regmap, reg, val, reg_cnt); 165 + int ret; 166 + 167 + ret = regmap_raw_write(da9052->regmap, reg, val, reg_cnt); 168 + if (ret < 0) 169 + return ret; 170 + 171 + if (da9052->fix_io) { 172 + ret = da9052->fix_io(da9052, reg); 173 + if (ret < 0) 174 + return ret; 175 + } 176 + 177 + return ret; 138 178 } 139 179 140 180 static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg, 141 181 unsigned char bit_mask, 142 182 unsigned char reg_val) 143 183 { 144 - return regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val); 184 + int ret; 185 + 186 + ret = regmap_update_bits(da9052->regmap, reg, bit_mask, reg_val); 187 + if (ret < 0) 188 + return ret; 189 + 190 + if (da9052->fix_io) { 191 + ret = da9052->fix_io(da9052, reg); 192 + if (ret < 0) 193 + return ret; 194 + } 195 + 196 + return ret; 145 197 } 146 198 147 199 int da9052_device_init(struct da9052 *da9052, u8 chip_id);
+3
include/linux/mfd/da9052/reg.h
··· 34 34 #define DA9052_STATUS_C_REG 3 35 35 #define DA9052_STATUS_D_REG 4 36 36 37 + /* PARK REGISTER */ 38 + #define DA9052_PARK_REGISTER DA9052_STATUS_D_REG 39 + 37 40 /* EVENT REGISTERS */ 38 41 #define DA9052_EVENT_A_REG 5 39 42 #define DA9052_EVENT_B_REG 6
+3
include/linux/mfd/rtsx_common.h
··· 38 38 #define RTSX_SD_CARD 0 39 39 #define RTSX_MS_CARD 1 40 40 41 + #define CLK_TO_DIV_N 0 42 + #define DIV_N_TO_CLK 1 43 + 41 44 struct platform_device; 42 45 43 46 struct rtsx_slot {
+21 -4
include/linux/mfd/rtsx_pci.h
··· 158 158 #define SG_TRANS_DATA (0x02 << 4) 159 159 #define SG_LINK_DESC (0x03 << 4) 160 160 161 - /* SD bank voltage */ 162 - #define SD_IO_3V3 0 163 - #define SD_IO_1V8 1 164 - 161 + /* Output voltage */ 162 + #define OUTPUT_3V3 0 163 + #define OUTPUT_1V8 1 165 164 166 165 /* Card Clock Enable Register */ 167 166 #define SD_CLK_EN 0x04 ··· 200 201 #define CHANGE_CLK 0x01 201 202 202 203 /* LDO_CTL */ 204 + #define BPP_ASIC_1V7 0x00 205 + #define BPP_ASIC_1V8 0x01 206 + #define BPP_ASIC_1V9 0x02 207 + #define BPP_ASIC_2V0 0x03 208 + #define BPP_ASIC_2V7 0x04 209 + #define BPP_ASIC_2V8 0x05 210 + #define BPP_ASIC_3V2 0x06 211 + #define BPP_ASIC_3V3 0x07 212 + #define BPP_REG_TUNED18 0x07 213 + #define BPP_TUNED18_SHIFT_8402 5 214 + #define BPP_TUNED18_SHIFT_8411 4 215 + #define BPP_PAD_MASK 0x04 216 + #define BPP_PAD_3V3 0x04 217 + #define BPP_PAD_1V8 0x00 203 218 #define BPP_LDO_POWB 0x03 204 219 #define BPP_LDO_ON 0x00 205 220 #define BPP_LDO_SUSPEND 0x02 ··· 701 688 int (*disable_auto_blink)(struct rtsx_pcr *pcr); 702 689 int (*card_power_on)(struct rtsx_pcr *pcr, int card); 703 690 int (*card_power_off)(struct rtsx_pcr *pcr, int card); 691 + int (*switch_output_voltage)(struct rtsx_pcr *pcr, 692 + u8 voltage); 704 693 unsigned int (*cd_deglitch)(struct rtsx_pcr *pcr); 694 + int (*conv_clk_and_div_n)(int clk, int dir); 705 695 }; 706 696 707 697 enum PDEV_STAT {PDEV_STAT_IDLE, PDEV_STAT_RUN}; ··· 799 783 u8 ssc_depth, bool initial_mode, bool double_clk, bool vpclk); 800 784 int rtsx_pci_card_power_on(struct rtsx_pcr *pcr, int card); 801 785 int rtsx_pci_card_power_off(struct rtsx_pcr *pcr, int card); 786 + int rtsx_pci_switch_output_voltage(struct rtsx_pcr *pcr, u8 voltage); 802 787 unsigned int rtsx_pci_card_exist(struct rtsx_pcr *pcr); 803 788 void rtsx_pci_complete_unfinished_transfer(struct rtsx_pcr *pcr); 804 789