提交 c9212201 编写于 作者: L Linus Torvalds

Merge tag 'mfd-fixes-3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD fixes from Lee Jones:
 - register offset fix for stmpe
 - eradicate build warning when !PM in rtsx_pcr
 - fix device ID collision when multiple boards are connected in
   viperboard
 - use correct Regmap handle - fixing unhanded IRQs in max77693
 - unmask MUIC IRQs in max77693
 - clear VBUS & CHG bits so board doesn't reboot instead of poweroff in
   twl4030

* tag 'mfd-fixes-3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd:
  mfd: twl4030-power: Fix poweroff with PM configuration enabled
  mfd: max77693: Fix always masked MUIC interrupts
  mfd: max77693: Use proper regmap for handling MUIC interrupts
  mfd: viperboard: Fix platform-device id collision
  mfd: rtsx: Fix build warnings for !PM
  mfd: stmpe: Fix STMPE24xx GPMR LSB
...@@ -240,7 +240,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, ...@@ -240,7 +240,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
goto err_irq_charger; goto err_irq_charger;
} }
ret = regmap_add_irq_chip(max77693->regmap, max77693->irq, ret = regmap_add_irq_chip(max77693->regmap_muic, max77693->irq,
IRQF_ONESHOT | IRQF_SHARED | IRQF_ONESHOT | IRQF_SHARED |
IRQF_TRIGGER_FALLING, 0, IRQF_TRIGGER_FALLING, 0,
&max77693_muic_irq_chip, &max77693_muic_irq_chip,
...@@ -250,6 +250,17 @@ static int max77693_i2c_probe(struct i2c_client *i2c, ...@@ -250,6 +250,17 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
goto err_irq_muic; goto err_irq_muic;
} }
/* Unmask interrupts from all blocks in interrupt source register */
ret = regmap_update_bits(max77693->regmap,
MAX77693_PMIC_REG_INTSRC_MASK,
SRC_IRQ_ALL, (unsigned int)~SRC_IRQ_ALL);
if (ret < 0) {
dev_err(max77693->dev,
"Could not unmask interrupts in INTSRC: %d\n",
ret);
goto err_intsrc;
}
pm_runtime_set_active(max77693->dev); pm_runtime_set_active(max77693->dev);
ret = mfd_add_devices(max77693->dev, -1, max77693_devs, ret = mfd_add_devices(max77693->dev, -1, max77693_devs,
...@@ -261,6 +272,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, ...@@ -261,6 +272,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
err_mfd: err_mfd:
mfd_remove_devices(max77693->dev); mfd_remove_devices(max77693->dev);
err_intsrc:
regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic); regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic);
err_irq_muic: err_irq_muic:
regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger); regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger);
......
...@@ -947,6 +947,7 @@ static void rtsx_pci_idle_work(struct work_struct *work) ...@@ -947,6 +947,7 @@ static void rtsx_pci_idle_work(struct work_struct *work)
mutex_unlock(&pcr->pcr_mutex); mutex_unlock(&pcr->pcr_mutex);
} }
#ifdef CONFIG_PM
static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state) static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state)
{ {
if (pcr->ops->turn_off_led) if (pcr->ops->turn_off_led)
...@@ -961,6 +962,7 @@ static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state) ...@@ -961,6 +962,7 @@ static void rtsx_pci_power_off(struct rtsx_pcr *pcr, u8 pm_state)
if (pcr->ops->force_power_down) if (pcr->ops->force_power_down)
pcr->ops->force_power_down(pcr, pm_state); pcr->ops->force_power_down(pcr, pm_state);
} }
#endif
static int rtsx_pci_init_hw(struct rtsx_pcr *pcr) static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
{ {
......
...@@ -269,7 +269,7 @@ int stmpe_remove(struct stmpe *stmpe); ...@@ -269,7 +269,7 @@ int stmpe_remove(struct stmpe *stmpe);
#define STMPE24XX_REG_CHIP_ID 0x80 #define STMPE24XX_REG_CHIP_ID 0x80
#define STMPE24XX_REG_IEGPIOR_LSB 0x18 #define STMPE24XX_REG_IEGPIOR_LSB 0x18
#define STMPE24XX_REG_ISGPIOR_MSB 0x19 #define STMPE24XX_REG_ISGPIOR_MSB 0x19
#define STMPE24XX_REG_GPMR_LSB 0xA5 #define STMPE24XX_REG_GPMR_LSB 0xA4
#define STMPE24XX_REG_GPSR_LSB 0x85 #define STMPE24XX_REG_GPSR_LSB 0x85
#define STMPE24XX_REG_GPCR_LSB 0x88 #define STMPE24XX_REG_GPCR_LSB 0x88
#define STMPE24XX_REG_GPDR_LSB 0x8B #define STMPE24XX_REG_GPDR_LSB 0x8B
......
...@@ -44,6 +44,15 @@ static u8 twl4030_start_script_address = 0x2b; ...@@ -44,6 +44,15 @@ static u8 twl4030_start_script_address = 0x2b;
#define PWR_DEVSLP BIT(1) #define PWR_DEVSLP BIT(1)
#define PWR_DEVOFF BIT(0) #define PWR_DEVOFF BIT(0)
/* Register bits for CFG_P1_TRANSITION (also for P2 and P3) */
#define STARTON_SWBUG BIT(7) /* Start on watchdog */
#define STARTON_VBUS BIT(5) /* Start on VBUS */
#define STARTON_VBAT BIT(4) /* Start on battery insert */
#define STARTON_RTC BIT(3) /* Start on RTC */
#define STARTON_USB BIT(2) /* Start on USB host */
#define STARTON_CHG BIT(1) /* Start on charger */
#define STARTON_PWON BIT(0) /* Start on PWRON button */
#define SEQ_OFFSYNC (1 << 0) #define SEQ_OFFSYNC (1 << 0)
#define PHY_TO_OFF_PM_MASTER(p) (p - 0x36) #define PHY_TO_OFF_PM_MASTER(p) (p - 0x36)
...@@ -606,6 +615,44 @@ twl4030_power_configure_resources(const struct twl4030_power_data *pdata) ...@@ -606,6 +615,44 @@ twl4030_power_configure_resources(const struct twl4030_power_data *pdata)
return 0; return 0;
} }
static int twl4030_starton_mask_and_set(u8 bitmask, u8 bitvalues)
{
u8 regs[3] = { TWL4030_PM_MASTER_CFG_P1_TRANSITION,
TWL4030_PM_MASTER_CFG_P2_TRANSITION,
TWL4030_PM_MASTER_CFG_P3_TRANSITION, };
u8 val;
int i, err;
err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1,
TWL4030_PM_MASTER_PROTECT_KEY);
if (err)
goto relock;
err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER,
TWL4030_PM_MASTER_KEY_CFG2,
TWL4030_PM_MASTER_PROTECT_KEY);
if (err)
goto relock;
for (i = 0; i < sizeof(regs); i++) {
err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER,
&val, regs[i]);
if (err)
break;
val = (~bitmask & val) | (bitmask & bitvalues);
err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER,
val, regs[i]);
if (err)
break;
}
if (err)
pr_err("TWL4030 Register access failed: %i\n", err);
relock:
return twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 0,
TWL4030_PM_MASTER_PROTECT_KEY);
}
/* /*
* In master mode, start the power off sequence. * In master mode, start the power off sequence.
* After a successful execution, TWL shuts down the power to the SoC * After a successful execution, TWL shuts down the power to the SoC
...@@ -615,6 +662,11 @@ void twl4030_power_off(void) ...@@ -615,6 +662,11 @@ void twl4030_power_off(void)
{ {
int err; int err;
/* Disable start on charger or VBUS as it can break poweroff */
err = twl4030_starton_mask_and_set(STARTON_VBUS | STARTON_CHG, 0);
if (err)
pr_err("TWL4030 Unable to configure start-up\n");
err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, PWR_DEVOFF, err = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, PWR_DEVOFF,
TWL4030_PM_MASTER_P1_SW_EVENTS); TWL4030_PM_MASTER_P1_SW_EVENTS);
if (err) if (err)
......
...@@ -93,8 +93,9 @@ static int vprbrd_probe(struct usb_interface *interface, ...@@ -93,8 +93,9 @@ static int vprbrd_probe(struct usb_interface *interface,
version >> 8, version & 0xff, version >> 8, version & 0xff,
vb->usb_dev->bus->busnum, vb->usb_dev->devnum); vb->usb_dev->bus->busnum, vb->usb_dev->devnum);
ret = mfd_add_devices(&interface->dev, -1, vprbrd_devs, ret = mfd_add_devices(&interface->dev, PLATFORM_DEVID_AUTO,
ARRAY_SIZE(vprbrd_devs), NULL, 0, NULL); vprbrd_devs, ARRAY_SIZE(vprbrd_devs), NULL, 0,
NULL);
if (ret != 0) { if (ret != 0) {
dev_err(&interface->dev, "Failed to add mfd devices to core."); dev_err(&interface->dev, "Failed to add mfd devices to core.");
goto error; goto error;
......
...@@ -330,6 +330,13 @@ enum max77693_irq_source { ...@@ -330,6 +330,13 @@ enum max77693_irq_source {
MAX77693_IRQ_GROUP_NR, MAX77693_IRQ_GROUP_NR,
}; };
#define SRC_IRQ_CHARGER BIT(0)
#define SRC_IRQ_TOP BIT(1)
#define SRC_IRQ_FLASH BIT(2)
#define SRC_IRQ_MUIC BIT(3)
#define SRC_IRQ_ALL (SRC_IRQ_CHARGER | SRC_IRQ_TOP \
| SRC_IRQ_FLASH | SRC_IRQ_MUIC)
#define LED_IRQ_FLED2_OPEN BIT(0) #define LED_IRQ_FLED2_OPEN BIT(0)
#define LED_IRQ_FLED2_SHORT BIT(1) #define LED_IRQ_FLED2_SHORT BIT(1)
#define LED_IRQ_FLED1_OPEN BIT(2) #define LED_IRQ_FLED1_OPEN BIT(2)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册