Commit 9deb9e16 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull MFD updates from Lee Jones:
 "New Device Support
   - Add support for Power Supply to AXP813
   - Add support for GPIO, ADC, AC and Battery Power Supply to AXP803
   - Add support for UART to Exynos LPASS

  Fix-ups:
   - Use supplied MACROS; ti_am335x_tscadc
   - Trivial spelling/whitespace/alignment; tmio, axp20x, rave-sp
   - Regmap changes; bd9571mwv, wm5110-tables
   - Kconfig dependencies; MFD_AT91_USART
   - Supply shared data for child-devices; madera-core
   - Use new of_node_name_eq() API call; max77620, stmpe
   - Use managed resources (devm_*); tps65218
   - Comment descriptions; ingenic-tcu
   - Coding style; madera-core

  Bug Fixes:
   - Fix section mismatches; twl-core, db8500-prcmu
   - Correct error path related issues; mt6397-core, ab8500-core, mc13xxx-core
   - IRQ related fixes; tps6586x
   - Ensure proper initialisation sequence; qcom_rpm
   - Repair potential memory leak; cros_ec_dev"

* tag 'mfd-next-4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (25 commits)
  mfd: exynos-lpass: Enable UART module support
  mfd: mc13xxx: Fix a missing check of a register-read failure
  mfd: cros_ec: Add commands to control codec
  mfd: madera: Remove spurious semicolon in while loop
  mfd: rave-sp: Fix typo in rave_sp_checksum comment
  mfd: ingenic-tcu: Fix bit field description in header
  mfd: tps65218: Use devm_regmap_add_irq_chip and clean up error path in probe()
  mfd: Use of_node_name_eq() for node name comparisons
  mfd: cros_ec_dev: Add missing mfd_remove_devices() call in remove
  mfd: axp20x: Add supported cells for AXP803
  mfd: axp20x: Re-align MFD cell entries
  mfd: axp20x: Add AC power supply cell for AXP813
  mfd: wm5110: Add missing ASRC rate register
  mfd: qcom_rpm: write fw_version to CTRL_REG
  mfd: tps6586x: Handle interrupts on suspend
  mfd: madera: Add shared data for accessory detection
  mfd: at91-usart: Add platform dependency
  mfd: bd9571mwv: Add volatile register to make DVFS work
  mfd: ab8500-core: Return zero in get_register_interruptible()
  mfd: tmio: Typo s/use use/use/
  ...
parents 3a73e73a 3f2d347e
...@@ -142,7 +142,10 @@ static void tiadc_step_config(struct iio_dev *indio_dev) ...@@ -142,7 +142,10 @@ static void tiadc_step_config(struct iio_dev *indio_dev)
stepconfig |= STEPCONFIG_MODE_SWCNT; stepconfig |= STEPCONFIG_MODE_SWCNT;
tiadc_writel(adc_dev, REG_STEPCONFIG(steps), tiadc_writel(adc_dev, REG_STEPCONFIG(steps),
stepconfig | STEPCONFIG_INP(chan)); stepconfig | STEPCONFIG_INP(chan) |
STEPCONFIG_INM_ADCREFM |
STEPCONFIG_RFP_VREFP |
STEPCONFIG_RFM_VREFN);
if (adc_dev->open_delay[i] > STEPDELAY_OPEN_MASK) { if (adc_dev->open_delay[i] > STEPDELAY_OPEN_MASK) {
dev_warn(dev, "chan %d open delay truncating to 0x3FFFF\n", dev_warn(dev, "chan %d open delay truncating to 0x3FFFF\n",
......
...@@ -102,6 +102,7 @@ config MFD_AAT2870_CORE ...@@ -102,6 +102,7 @@ config MFD_AAT2870_CORE
config MFD_AT91_USART config MFD_AT91_USART
tristate "AT91 USART Driver" tristate "AT91 USART Driver"
select MFD_CORE select MFD_CORE
depends on ARCH_AT91 || COMPILE_TEST
help help
Select this to get support for AT91 USART IP. This is a wrapper Select this to get support for AT91 USART IP. This is a wrapper
over at91-usart-serial driver and usart-spi-driver. Only one function over at91-usart-serial driver and usart-spi-driver. Only one function
......
...@@ -261,7 +261,7 @@ static int get_register_interruptible(struct ab8500 *ab8500, u8 bank, ...@@ -261,7 +261,7 @@ static int get_register_interruptible(struct ab8500 *ab8500, u8 bank,
mutex_unlock(&ab8500->lock); mutex_unlock(&ab8500->lock);
dev_vdbg(ab8500->dev, "rd: addr %#x => data %#x\n", addr, ret); dev_vdbg(ab8500->dev, "rd: addr %#x => data %#x\n", addr, ret);
return ret; return (ret < 0) ? ret : 0;
} }
static int ab8500_get_register(struct device *dev, u8 bank, static int ab8500_get_register(struct device *dev, u8 bank,
......
...@@ -701,28 +701,23 @@ static const struct mfd_cell axp288_cells[] = { ...@@ -701,28 +701,23 @@ static const struct mfd_cell axp288_cells[] = {
.name = "axp288_adc", .name = "axp288_adc",
.num_resources = ARRAY_SIZE(axp288_adc_resources), .num_resources = ARRAY_SIZE(axp288_adc_resources),
.resources = axp288_adc_resources, .resources = axp288_adc_resources,
}, }, {
{
.name = "axp288_extcon", .name = "axp288_extcon",
.num_resources = ARRAY_SIZE(axp288_extcon_resources), .num_resources = ARRAY_SIZE(axp288_extcon_resources),
.resources = axp288_extcon_resources, .resources = axp288_extcon_resources,
}, }, {
{
.name = "axp288_charger", .name = "axp288_charger",
.num_resources = ARRAY_SIZE(axp288_charger_resources), .num_resources = ARRAY_SIZE(axp288_charger_resources),
.resources = axp288_charger_resources, .resources = axp288_charger_resources,
}, }, {
{
.name = "axp288_fuel_gauge", .name = "axp288_fuel_gauge",
.num_resources = ARRAY_SIZE(axp288_fuel_gauge_resources), .num_resources = ARRAY_SIZE(axp288_fuel_gauge_resources),
.resources = axp288_fuel_gauge_resources, .resources = axp288_fuel_gauge_resources,
}, }, {
{
.name = "axp221-pek", .name = "axp221-pek",
.num_resources = ARRAY_SIZE(axp288_power_button_resources), .num_resources = ARRAY_SIZE(axp288_power_button_resources),
.resources = axp288_power_button_resources, .resources = axp288_power_button_resources,
}, }, {
{
.name = "axp288_pmic_acpi", .name = "axp288_pmic_acpi",
}, },
}; };
...@@ -732,6 +727,20 @@ static const struct mfd_cell axp803_cells[] = { ...@@ -732,6 +727,20 @@ static const struct mfd_cell axp803_cells[] = {
.name = "axp221-pek", .name = "axp221-pek",
.num_resources = ARRAY_SIZE(axp803_pek_resources), .num_resources = ARRAY_SIZE(axp803_pek_resources),
.resources = axp803_pek_resources, .resources = axp803_pek_resources,
}, {
.name = "axp20x-gpio",
.of_compatible = "x-powers,axp813-gpio",
}, {
.name = "axp813-adc",
.of_compatible = "x-powers,axp813-adc",
}, {
.name = "axp20x-battery-power-supply",
.of_compatible = "x-powers,axp813-battery-power-supply",
}, {
.name = "axp20x-ac-power-supply",
.of_compatible = "x-powers,axp813-ac-power-supply",
.num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources),
.resources = axp20x_ac_power_supply_resources,
}, },
{ .name = "axp20x-regulator" }, { .name = "axp20x-regulator" },
}; };
...@@ -779,6 +788,11 @@ static const struct mfd_cell axp813_cells[] = { ...@@ -779,6 +788,11 @@ static const struct mfd_cell axp813_cells[] = {
}, { }, {
.name = "axp20x-battery-power-supply", .name = "axp20x-battery-power-supply",
.of_compatible = "x-powers,axp813-battery-power-supply", .of_compatible = "x-powers,axp813-battery-power-supply",
}, {
.name = "axp20x-ac-power-supply",
.of_compatible = "x-powers,axp813-ac-power-supply",
.num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources),
.resources = axp20x_ac_power_supply_resources,
}, },
}; };
......
...@@ -59,6 +59,7 @@ static const struct regmap_access_table bd9571mwv_writable_table = { ...@@ -59,6 +59,7 @@ static const struct regmap_access_table bd9571mwv_writable_table = {
}; };
static const struct regmap_range bd9571mwv_volatile_yes_ranges[] = { static const struct regmap_range bd9571mwv_volatile_yes_ranges[] = {
regmap_reg_range(BD9571MWV_DVFS_MONIVDAC, BD9571MWV_DVFS_MONIVDAC),
regmap_reg_range(BD9571MWV_GPIO_IN, BD9571MWV_GPIO_IN), regmap_reg_range(BD9571MWV_GPIO_IN, BD9571MWV_GPIO_IN),
regmap_reg_range(BD9571MWV_GPIO_INT, BD9571MWV_GPIO_INT), regmap_reg_range(BD9571MWV_GPIO_INT, BD9571MWV_GPIO_INT),
regmap_reg_range(BD9571MWV_INT_INTREQ, BD9571MWV_INT_INTREQ), regmap_reg_range(BD9571MWV_INT_INTREQ, BD9571MWV_INT_INTREQ),
......
...@@ -499,6 +499,7 @@ static int ec_device_remove(struct platform_device *pdev) ...@@ -499,6 +499,7 @@ static int ec_device_remove(struct platform_device *pdev)
cros_ec_debugfs_remove(ec); cros_ec_debugfs_remove(ec);
mfd_remove_devices(ec->dev);
cdev_del(&ec->cdev); cdev_del(&ec->cdev);
device_unregister(&ec->class_dev); device_unregister(&ec->class_dev);
return 0; return 0;
......
...@@ -2584,7 +2584,7 @@ static struct irq_chip prcmu_irq_chip = { ...@@ -2584,7 +2584,7 @@ static struct irq_chip prcmu_irq_chip = {
.irq_unmask = prcmu_irq_unmask, .irq_unmask = prcmu_irq_unmask,
}; };
static __init char *fw_project_name(u32 project) static char *fw_project_name(u32 project)
{ {
switch (project) { switch (project) {
case PRCMU_FW_PROJECT_U8500: case PRCMU_FW_PROJECT_U8500:
...@@ -2732,7 +2732,7 @@ void __init db8500_prcmu_early_init(u32 phy_base, u32 size) ...@@ -2732,7 +2732,7 @@ void __init db8500_prcmu_early_init(u32 phy_base, u32 size)
INIT_WORK(&mb0_transfer.mask_work, prcmu_mask_work); INIT_WORK(&mb0_transfer.mask_work, prcmu_mask_work);
} }
static void __init init_prcm_registers(void) static void init_prcm_registers(void)
{ {
u32 val; u32 val;
......
...@@ -82,11 +82,13 @@ static void exynos_lpass_enable(struct exynos_lpass *lpass) ...@@ -82,11 +82,13 @@ static void exynos_lpass_enable(struct exynos_lpass *lpass)
LPASS_INTR_SFR | LPASS_INTR_DMA | LPASS_INTR_I2S); LPASS_INTR_SFR | LPASS_INTR_DMA | LPASS_INTR_I2S);
regmap_write(lpass->top, SFR_LPASS_INTR_CPU_MASK, regmap_write(lpass->top, SFR_LPASS_INTR_CPU_MASK,
LPASS_INTR_SFR | LPASS_INTR_DMA | LPASS_INTR_I2S); LPASS_INTR_SFR | LPASS_INTR_DMA | LPASS_INTR_I2S |
LPASS_INTR_UART);
exynos_lpass_core_sw_reset(lpass, LPASS_I2S_SW_RESET); exynos_lpass_core_sw_reset(lpass, LPASS_I2S_SW_RESET);
exynos_lpass_core_sw_reset(lpass, LPASS_DMA_SW_RESET); exynos_lpass_core_sw_reset(lpass, LPASS_DMA_SW_RESET);
exynos_lpass_core_sw_reset(lpass, LPASS_MEM_SW_RESET); exynos_lpass_core_sw_reset(lpass, LPASS_MEM_SW_RESET);
exynos_lpass_core_sw_reset(lpass, LPASS_UART_SW_RESET);
} }
static void exynos_lpass_disable(struct exynos_lpass *lpass) static void exynos_lpass_disable(struct exynos_lpass *lpass)
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/mfd/core.h> #include <linux/mfd/core.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mutex.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_gpio.h> #include <linux/of_gpio.h>
...@@ -155,7 +156,7 @@ static int madera_wait_for_boot(struct madera *madera) ...@@ -155,7 +156,7 @@ static int madera_wait_for_boot(struct madera *madera)
usleep_range(MADERA_BOOT_POLL_INTERVAL_USEC / 2, usleep_range(MADERA_BOOT_POLL_INTERVAL_USEC / 2,
MADERA_BOOT_POLL_INTERVAL_USEC); MADERA_BOOT_POLL_INTERVAL_USEC);
regmap_read(madera->regmap, MADERA_IRQ1_RAW_STATUS_1, &val); regmap_read(madera->regmap, MADERA_IRQ1_RAW_STATUS_1, &val);
}; }
if (!(val & MADERA_BOOT_DONE_STS1)) { if (!(val & MADERA_BOOT_DONE_STS1)) {
dev_err(madera->dev, "Polling BOOT_DONE_STS timed out\n"); dev_err(madera->dev, "Polling BOOT_DONE_STS timed out\n");
...@@ -357,6 +358,8 @@ int madera_dev_init(struct madera *madera) ...@@ -357,6 +358,8 @@ int madera_dev_init(struct madera *madera)
dev_set_drvdata(madera->dev, madera); dev_set_drvdata(madera->dev, madera);
BLOCKING_INIT_NOTIFIER_HEAD(&madera->notifier); BLOCKING_INIT_NOTIFIER_HEAD(&madera->notifier);
mutex_init(&madera->dapm_ptr_lock);
madera_set_micbias_info(madera); madera_set_micbias_info(madera);
/* /*
......
...@@ -280,7 +280,7 @@ static int max77620_config_fps(struct max77620_chip *chip, ...@@ -280,7 +280,7 @@ static int max77620_config_fps(struct max77620_chip *chip,
for (fps_id = 0; fps_id < MAX77620_FPS_COUNT; fps_id++) { for (fps_id = 0; fps_id < MAX77620_FPS_COUNT; fps_id++) {
sprintf(fps_name, "fps%d", fps_id); sprintf(fps_name, "fps%d", fps_id);
if (!strcmp(fps_np->name, fps_name)) if (of_node_name_eq(fps_np, fps_name))
break; break;
} }
......
...@@ -274,7 +274,9 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode, ...@@ -274,7 +274,9 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode,
mc13xxx->adcflags |= MC13XXX_ADC_WORKING; mc13xxx->adcflags |= MC13XXX_ADC_WORKING;
mc13xxx_reg_read(mc13xxx, MC13XXX_ADC0, &old_adc0); ret = mc13xxx_reg_read(mc13xxx, MC13XXX_ADC0, &old_adc0);
if (ret)
goto out;
adc0 = MC13XXX_ADC0_ADINC1 | MC13XXX_ADC0_ADINC2 | adc0 = MC13XXX_ADC0_ADINC1 | MC13XXX_ADC0_ADINC2 |
MC13XXX_ADC0_CHRGRAWDIV; MC13XXX_ADC0_CHRGRAWDIV;
......
...@@ -329,8 +329,7 @@ static int mt6397_probe(struct platform_device *pdev) ...@@ -329,8 +329,7 @@ static int mt6397_probe(struct platform_device *pdev)
default: default:
dev_err(&pdev->dev, "unsupported chip: %d\n", id); dev_err(&pdev->dev, "unsupported chip: %d\n", id);
ret = -ENODEV; return -ENODEV;
break;
} }
if (ret) { if (ret) {
......
...@@ -638,6 +638,10 @@ static int qcom_rpm_probe(struct platform_device *pdev) ...@@ -638,6 +638,10 @@ static int qcom_rpm_probe(struct platform_device *pdev)
return -EFAULT; return -EFAULT;
} }
writel(fw_version[0], RPM_CTRL_REG(rpm, 0));
writel(fw_version[1], RPM_CTRL_REG(rpm, 1));
writel(fw_version[2], RPM_CTRL_REG(rpm, 2));
dev_info(&pdev->dev, "RPM firmware %u.%u.%u\n", fw_version[0], dev_info(&pdev->dev, "RPM firmware %u.%u.%u\n", fw_version[0],
fw_version[1], fw_version[1],
fw_version[2]); fw_version[2]);
......
...@@ -109,7 +109,7 @@ struct rave_sp_reply { ...@@ -109,7 +109,7 @@ struct rave_sp_reply {
/** /**
* struct rave_sp_checksum - Variant specific checksum implementation details * struct rave_sp_checksum - Variant specific checksum implementation details
* *
* @length: Caculated checksum length * @length: Calculated checksum length
* @subroutine: Utilized checksum algorithm implementation * @subroutine: Utilized checksum algorithm implementation
*/ */
struct rave_sp_checksum { struct rave_sp_checksum {
......
...@@ -1302,17 +1302,17 @@ static void stmpe_of_probe(struct stmpe_platform_data *pdata, ...@@ -1302,17 +1302,17 @@ static void stmpe_of_probe(struct stmpe_platform_data *pdata,
pdata->autosleep = (pdata->autosleep_timeout) ? true : false; pdata->autosleep = (pdata->autosleep_timeout) ? true : false;
for_each_child_of_node(np, child) { for_each_child_of_node(np, child) {
if (!strcmp(child->name, "stmpe_gpio")) { if (of_node_name_eq(child, "stmpe_gpio")) {
pdata->blocks |= STMPE_BLOCK_GPIO; pdata->blocks |= STMPE_BLOCK_GPIO;
} else if (!strcmp(child->name, "stmpe_keypad")) { } else if (of_node_name_eq(child, "stmpe_keypad")) {
pdata->blocks |= STMPE_BLOCK_KEYPAD; pdata->blocks |= STMPE_BLOCK_KEYPAD;
} else if (!strcmp(child->name, "stmpe_touchscreen")) { } else if (of_node_name_eq(child, "stmpe_touchscreen")) {
pdata->blocks |= STMPE_BLOCK_TOUCHSCREEN; pdata->blocks |= STMPE_BLOCK_TOUCHSCREEN;
} else if (!strcmp(child->name, "stmpe_adc")) { } else if (of_node_name_eq(child, "stmpe_adc")) {
pdata->blocks |= STMPE_BLOCK_ADC; pdata->blocks |= STMPE_BLOCK_ADC;
} else if (!strcmp(child->name, "stmpe_pwm")) { } else if (of_node_name_eq(child, "stmpe_pwm")) {
pdata->blocks |= STMPE_BLOCK_PWM; pdata->blocks |= STMPE_BLOCK_PWM;
} else if (!strcmp(child->name, "stmpe_rotator")) { } else if (of_node_name_eq(child, "stmpe_rotator")) {
pdata->blocks |= STMPE_BLOCK_ROTATOR; pdata->blocks |= STMPE_BLOCK_ROTATOR;
} }
} }
......
...@@ -264,8 +264,9 @@ static int ti_tscadc_probe(struct platform_device *pdev) ...@@ -264,8 +264,9 @@ static int ti_tscadc_probe(struct platform_device *pdev)
cell->pdata_size = sizeof(tscadc); cell->pdata_size = sizeof(tscadc);
} }
err = mfd_add_devices(&pdev->dev, pdev->id, tscadc->cells, err = mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO,
tscadc->used_cells, NULL, 0, NULL); tscadc->cells, tscadc->used_cells, NULL,
0, NULL);
if (err < 0) if (err < 0)
goto err_disable_clk; goto err_disable_clk;
......
...@@ -235,7 +235,7 @@ static int tps65218_probe(struct i2c_client *client, ...@@ -235,7 +235,7 @@ static int tps65218_probe(struct i2c_client *client,
mutex_init(&tps->tps_lock); mutex_init(&tps->tps_lock);
ret = regmap_add_irq_chip(tps->regmap, tps->irq, ret = devm_regmap_add_irq_chip(&client->dev, tps->regmap, tps->irq,
IRQF_ONESHOT, 0, &tps65218_irq_chip, IRQF_ONESHOT, 0, &tps65218_irq_chip,
&tps->irq_data); &tps->irq_data);
if (ret < 0) if (ret < 0)
...@@ -253,26 +253,9 @@ static int tps65218_probe(struct i2c_client *client, ...@@ -253,26 +253,9 @@ static int tps65218_probe(struct i2c_client *client,
ARRAY_SIZE(tps65218_cells), NULL, 0, ARRAY_SIZE(tps65218_cells), NULL, 0,
regmap_irq_get_domain(tps->irq_data)); regmap_irq_get_domain(tps->irq_data));
if (ret < 0)
goto err_irq;
return 0;
err_irq:
regmap_del_irq_chip(tps->irq, tps->irq_data);
return ret; return ret;
} }
static int tps65218_remove(struct i2c_client *client)
{
struct tps65218 *tps = i2c_get_clientdata(client);
regmap_del_irq_chip(tps->irq, tps->irq_data);
return 0;
}
static const struct i2c_device_id tps65218_id_table[] = { static const struct i2c_device_id tps65218_id_table[] = {
{ "tps65218", TPS65218 }, { "tps65218", TPS65218 },
{ }, { },
...@@ -285,7 +268,6 @@ static struct i2c_driver tps65218_driver = { ...@@ -285,7 +268,6 @@ static struct i2c_driver tps65218_driver = {
.of_match_table = of_tps65218_match_table, .of_match_table = of_tps65218_match_table,
}, },
.probe = tps65218_probe, .probe = tps65218_probe,
.remove = tps65218_remove,
.id_table = tps65218_id_table, .id_table = tps65218_id_table,
}; };
......
...@@ -592,6 +592,29 @@ static int tps6586x_i2c_remove(struct i2c_client *client) ...@@ -592,6 +592,29 @@ static int tps6586x_i2c_remove(struct i2c_client *client)
return 0; return 0;
} }
static int __maybe_unused tps6586x_i2c_suspend(struct device *dev)
{
struct tps6586x *tps6586x = dev_get_drvdata(dev);
if (tps6586x->client->irq)
disable_irq(tps6586x->client->irq);
return 0;
}
static int __maybe_unused tps6586x_i2c_resume(struct device *dev)
{
struct tps6586x *tps6586x = dev_get_drvdata(dev);
if (tps6586x->client->irq)
enable_irq(tps6586x->client->irq);
return 0;
}
static SIMPLE_DEV_PM_OPS(tps6586x_pm_ops, tps6586x_i2c_suspend,
tps6586x_i2c_resume);
static const struct i2c_device_id tps6586x_id_table[] = { static const struct i2c_device_id tps6586x_id_table[] = {
{ "tps6586x", 0 }, { "tps6586x", 0 },
{ }, { },
...@@ -602,6 +625,7 @@ static struct i2c_driver tps6586x_driver = { ...@@ -602,6 +625,7 @@ static struct i2c_driver tps6586x_driver = {
.driver = { .driver = {
.name = "tps6586x", .name = "tps6586x",
.of_match_table = of_match_ptr(tps6586x_of_match), .of_match_table = of_match_ptr(tps6586x_of_match),
.pm = &tps6586x_pm_ops,
}, },
.probe = tps6586x_i2c_probe, .probe = tps6586x_i2c_probe,
.remove = tps6586x_i2c_remove, .remove = tps6586x_i2c_remove,
......
...@@ -979,7 +979,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base, ...@@ -979,7 +979,7 @@ add_children(struct twl4030_platform_data *pdata, unsigned irq_base,
* letting it generate the right frequencies for USB, MADC, and * letting it generate the right frequencies for USB, MADC, and
* other purposes. * other purposes.
*/ */
static inline int __init protect_pm_master(void) static inline int protect_pm_master(void)
{ {
int e = 0; int e = 0;
...@@ -988,7 +988,7 @@ static inline int __init protect_pm_master(void) ...@@ -988,7 +988,7 @@ static inline int __init protect_pm_master(void)
return e; return e;
} }
static inline int __init unprotect_pm_master(void) static inline int unprotect_pm_master(void)
{ {
int e = 0; int e = 0;
......
...@@ -1618,6 +1618,7 @@ static const struct reg_default wm5110_reg_default[] = { ...@@ -1618,6 +1618,7 @@ static const struct reg_default wm5110_reg_default[] = {
{ 0x00000ECD, 0x0000 }, /* R3789 - HPLPF4_2 */ { 0x00000ECD, 0x0000 }, /* R3789 - HPLPF4_2 */
{ 0x00000EE0, 0x0000 }, /* R3808 - ASRC_ENABLE */ { 0x00000EE0, 0x0000 }, /* R3808 - ASRC_ENABLE */
{ 0x00000EE2, 0x0000 }, /* R3810 - ASRC_RATE1 */ { 0x00000EE2, 0x0000 }, /* R3810 - ASRC_RATE1 */
{ 0x00000EE3, 0x4000 }, /* R3811 - ASRC_RATE2 */
{ 0x00000EF0, 0x0000 }, /* R3824 - ISRC 1 CTRL 1 */ { 0x00000EF0, 0x0000 }, /* R3824 - ISRC 1 CTRL 1 */
{ 0x00000EF1, 0x0000 }, /* R3825 - ISRC 1 CTRL 2 */ { 0x00000EF1, 0x0000 }, /* R3825 - ISRC 1 CTRL 2 */
{ 0x00000EF2, 0x0000 }, /* R3826 - ISRC 1 CTRL 3 */ { 0x00000EF2, 0x0000 }, /* R3826 - ISRC 1 CTRL 3 */
...@@ -2869,6 +2870,7 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg) ...@@ -2869,6 +2870,7 @@ static bool wm5110_readable_register(struct device *dev, unsigned int reg)
case ARIZONA_ASRC_ENABLE: case ARIZONA_ASRC_ENABLE:
case ARIZONA_ASRC_STATUS: case ARIZONA_ASRC_STATUS:
case ARIZONA_ASRC_RATE1: case ARIZONA_ASRC_RATE1:
case ARIZONA_ASRC_RATE2:
case ARIZONA_ISRC_1_CTRL_1: case ARIZONA_ISRC_1_CTRL_1:
case ARIZONA_ISRC_1_CTRL_2: case ARIZONA_ISRC_1_CTRL_2:
case ARIZONA_ISRC_1_CTRL_3: case ARIZONA_ISRC_1_CTRL_3:
......
...@@ -2790,6 +2790,100 @@ struct ec_response_battery_vendor_param { ...@@ -2790,6 +2790,100 @@ struct ec_response_battery_vendor_param {
uint32_t value; uint32_t value;
} __packed; } __packed;
/*****************************************************************************/
/* Commands for I2S recording on audio codec. */
#define EC_CMD_CODEC_I2S 0x00BC
enum ec_codec_i2s_subcmd {
EC_CODEC_SET_SAMPLE_DEPTH = 0x0,
EC_CODEC_SET_GAIN = 0x1,
EC_CODEC_GET_GAIN = 0x2,
EC_CODEC_I2S_ENABLE = 0x3,
EC_CODEC_I2S_SET_CONFIG = 0x4,
EC_CODEC_I2S_SET_TDM_CONFIG = 0x5,
EC_CODEC_I2S_SET_BCLK = 0x6,
};
enum ec_sample_depth_value {
EC_CODEC_SAMPLE_DEPTH_16 = 0,
EC_CODEC_SAMPLE_DEPTH_24 = 1,
};
enum ec_i2s_config {
EC_DAI_FMT_I2S = 0,
EC_DAI_FMT_RIGHT_J = 1,
EC_DAI_FMT_LEFT_J = 2,
EC_DAI_FMT_PCM_A = 3,
EC_DAI_FMT_PCM_B = 4,
EC_DAI_FMT_PCM_TDM = 5,
};
struct ec_param_codec_i2s {
/*
* enum ec_codec_i2s_subcmd
*/
uint8_t cmd;
union {
/*
* EC_CODEC_SET_SAMPLE_DEPTH
* Value should be one of ec_sample_depth_value.
*/
uint8_t depth;
/*
* EC_CODEC_SET_GAIN
* Value should be 0~43 for both channels.
*/
struct ec_param_codec_i2s_set_gain {
uint8_t left;
uint8_t right;
} __packed gain;
/*
* EC_CODEC_I2S_ENABLE
* 1 to enable, 0 to disable.
*/
uint8_t i2s_enable;
/*
* EC_CODEC_I2S_SET_COFNIG
* Value should be one of ec_i2s_config.
*/
uint8_t i2s_config;
/*
* EC_CODEC_I2S_SET_TDM_CONFIG
* Value should be one of ec_i2s_config.
*/
struct ec_param_codec_i2s_tdm {
/*
* 0 to 496
*/
int16_t ch0_delay;
/*
* -1 to 496
*/
int16_t ch1_delay;
uint8_t adjacent_to_ch0;
uint8_t adjacent_to_ch1;
} __packed tdm_param;
/*
* EC_CODEC_I2S_SET_BCLK
*/
uint32_t bclk;
};
} __packed;
/*
* For subcommand EC_CODEC_GET_GAIN.
*/
struct ec_response_codec_gain {
uint8_t left;
uint8_t right;
} __packed;
/*****************************************************************************/ /*****************************************************************************/
/* System commands */ /* System commands */
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#define TCU_TCSR_PRESCALE_LSB 3 #define TCU_TCSR_PRESCALE_LSB 3
#define TCU_TCSR_PRESCALE_MASK 0x38 #define TCU_TCSR_PRESCALE_MASK 0x38
#define TCU_TCSR_PWM_SD BIT(9) /* 0: Shutdown abruptly 1: gracefully */ #define TCU_TCSR_PWM_SD BIT(9) /* 0: Shutdown gracefully 1: abruptly */
#define TCU_TCSR_PWM_INITL_HIGH BIT(8) /* Sets the initial output level */ #define TCU_TCSR_PWM_INITL_HIGH BIT(8) /* Sets the initial output level */
#define TCU_TCSR_PWM_EN BIT(7) /* PWM pin output enable */ #define TCU_TCSR_PWM_EN BIT(7) /* PWM pin output enable */
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/gpio/consumer.h> #include <linux/gpio/consumer.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/mfd/madera/pdata.h> #include <linux/mfd/madera/pdata.h>
#include <linux/mutex.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
...@@ -37,6 +38,8 @@ enum madera_type { ...@@ -37,6 +38,8 @@ enum madera_type {
#define MADERA_MAX_MICBIAS 4 #define MADERA_MAX_MICBIAS 4
#define MADERA_MAX_HP_OUTPUT 3
/* Notifier events */ /* Notifier events */
#define MADERA_NOTIFY_VOICE_TRIGGER 0x1 #define MADERA_NOTIFY_VOICE_TRIGGER 0x1
#define MADERA_NOTIFY_HPDET 0x2 #define MADERA_NOTIFY_HPDET 0x2
...@@ -183,6 +186,10 @@ struct madera { ...@@ -183,6 +186,10 @@ struct madera {
unsigned int num_childbias[MADERA_MAX_MICBIAS]; unsigned int num_childbias[MADERA_MAX_MICBIAS];
struct snd_soc_dapm_context *dapm; struct snd_soc_dapm_context *dapm;
struct mutex dapm_ptr_lock;
unsigned int hp_ena;
bool out_clamp[MADERA_MAX_HP_OUTPUT];
bool out_shorted[MADERA_MAX_HP_OUTPUT];
struct blocking_notifier_head notifier; struct blocking_notifier_head notifier;
}; };
......
...@@ -78,6 +78,8 @@ ...@@ -78,6 +78,8 @@
#define STEPCONFIG_YNN BIT(8) #define STEPCONFIG_YNN BIT(8)
#define STEPCONFIG_XNP BIT(9) #define STEPCONFIG_XNP BIT(9)
#define STEPCONFIG_YPN BIT(10) #define STEPCONFIG_YPN BIT(10)
#define STEPCONFIG_RFP(val) ((val) << 12)
#define STEPCONFIG_RFP_VREFP (0x3 << 12)
#define STEPCONFIG_INM_MASK (0xF << 15) #define STEPCONFIG_INM_MASK (0xF << 15)
#define STEPCONFIG_INM(val) ((val) << 15) #define STEPCONFIG_INM(val) ((val) << 15)
#define STEPCONFIG_INM_ADCREFM STEPCONFIG_INM(8) #define STEPCONFIG_INM_ADCREFM STEPCONFIG_INM(8)
...@@ -86,6 +88,8 @@ ...@@ -86,6 +88,8 @@
#define STEPCONFIG_INP_AN4 STEPCONFIG_INP(4) #define STEPCONFIG_INP_AN4 STEPCONFIG_INP(4)
#define STEPCONFIG_INP_ADCREFM STEPCONFIG_INP(8) #define STEPCONFIG_INP_ADCREFM STEPCONFIG_INP(8)
#define STEPCONFIG_FIFO1 BIT(26) #define STEPCONFIG_FIFO1 BIT(26)
#define STEPCONFIG_RFM(val) ((val) << 23)
#define STEPCONFIG_RFM_VREFN (0x3 << 23)
/* Delay register */ /* Delay register */
#define STEPDELAY_OPEN_MASK (0x3FFFF << 0) #define STEPDELAY_OPEN_MASK (0x3FFFF << 0)
......
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
/* Some controllers have a CBSY bit */ /* Some controllers have a CBSY bit */
#define TMIO_MMC_HAVE_CBSY BIT(11) #define TMIO_MMC_HAVE_CBSY BIT(11)
/* Some controllers that support HS400 use use 4 taps while others use 8. */ /* Some controllers that support HS400 use 4 taps while others use 8. */
#define TMIO_MMC_HAVE_4TAP_HS400 BIT(13) #define TMIO_MMC_HAVE_4TAP_HS400 BIT(13)
int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment