Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 344964
b: refs/heads/master
c: ab7edb1
h: refs/heads/master
v: v3
  • Loading branch information
Peter Ujfalusi authored and Samuel Ortiz committed Nov 13, 2012
1 parent f85c79c commit fb5f76e
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 229 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1ac96265a6f35080083e85b0f58182cdc9c07d0e
refs/heads/master: ab7edb149c7548541ee588b8372c2041b6f1cbc8
4 changes: 2 additions & 2 deletions trunk/drivers/mfd/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,10 @@ config MFD_TWL4030_AUDIO

config TWL6040_CORE
bool "Support for TWL6040 audio codec"
depends on I2C=y && GENERIC_HARDIRQS
depends on I2C=y
select MFD_CORE
select REGMAP_I2C
select IRQ_DOMAIN
select REGMAP_IRQ
default n
help
Say yes here if you want support for Texas Instruments TWL6040 audio
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/mfd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ obj-$(CONFIG_TWL4030_CORE) += twl-core.o twl4030-irq.o twl6030-irq.o
obj-$(CONFIG_TWL4030_MADC) += twl4030-madc.o
obj-$(CONFIG_TWL4030_POWER) += twl4030-power.o
obj-$(CONFIG_MFD_TWL4030_AUDIO) += twl4030-audio.o
obj-$(CONFIG_TWL6040_CORE) += twl6040-core.o twl6040-irq.o
obj-$(CONFIG_TWL6040_CORE) += twl6040-core.o

obj-$(CONFIG_MFD_MC13XXX) += mc13xxx-core.o
obj-$(CONFIG_MFD_MC13XXX_SPI) += mc13xxx-spi.o
Expand Down
55 changes: 40 additions & 15 deletions trunk/drivers/mfd/twl6040-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,25 @@ static struct regmap_config twl6040_regmap_config = {
.readable_reg = twl6040_readable_reg,
};

static const struct regmap_irq twl6040_irqs[] = {
{ .reg_offset = 0, .mask = TWL6040_THINT, },
{ .reg_offset = 0, .mask = TWL6040_PLUGINT | TWL6040_UNPLUGINT, },
{ .reg_offset = 0, .mask = TWL6040_HOOKINT, },
{ .reg_offset = 0, .mask = TWL6040_HFINT, },
{ .reg_offset = 0, .mask = TWL6040_VIBINT, },
{ .reg_offset = 0, .mask = TWL6040_READYINT, },
};

static struct regmap_irq_chip twl6040_irq_chip = {
.name = "twl6040",
.irqs = twl6040_irqs,
.num_irqs = ARRAY_SIZE(twl6040_irqs),

.num_regs = 1,
.status_base = TWL6040_REG_INTID,
.mask_base = TWL6040_REG_INTMR,
};

static int __devinit twl6040_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
Expand Down Expand Up @@ -574,21 +593,27 @@ static int __devinit twl6040_probe(struct i2c_client *client,
goto gpio_err;
}

/* codec interrupt */
ret = twl6040_irq_init(twl6040);
if (ret)
ret = regmap_add_irq_chip(twl6040->regmap, twl6040->irq,
IRQF_ONESHOT, 0, &twl6040_irq_chip,
&twl6040->irq_data);
if (ret < 0)
goto irq_init_err;

ret = request_threaded_irq(twl6040->irq_base + TWL6040_IRQ_READY,
NULL, twl6040_readyint_handler, IRQF_ONESHOT,
twl6040->irq_ready = regmap_irq_get_virq(twl6040->irq_data,
TWL6040_IRQ_READY);
twl6040->irq_th = regmap_irq_get_virq(twl6040->irq_data,
TWL6040_IRQ_TH);

ret = request_threaded_irq(twl6040->irq_ready, NULL,
twl6040_readyint_handler, IRQF_ONESHOT,
"twl6040_irq_ready", twl6040);
if (ret) {
dev_err(twl6040->dev, "READY IRQ request failed: %d\n", ret);
goto readyirq_err;
}

ret = request_threaded_irq(twl6040->irq_base + TWL6040_IRQ_TH,
NULL, twl6040_thint_handler, IRQF_ONESHOT,
ret = request_threaded_irq(twl6040->irq_th, NULL,
twl6040_thint_handler, IRQF_ONESHOT,
"twl6040_irq_th", twl6040);
if (ret) {
dev_err(twl6040->dev, "Thermal IRQ request failed: %d\n", ret);
Expand All @@ -604,7 +629,7 @@ static int __devinit twl6040_probe(struct i2c_client *client,
* The ASoC codec can work without pdata, pass the platform_data only if
* it has been provided.
*/
irq = twl6040->irq_base + TWL6040_IRQ_PLUG;
irq = regmap_irq_get_virq(twl6040->irq_data, TWL6040_IRQ_PLUG);
cell = &twl6040->cells[children];
cell->name = "twl6040-codec";
twl6040_codec_rsrc[0].start = irq;
Expand All @@ -618,7 +643,7 @@ static int __devinit twl6040_probe(struct i2c_client *client,
children++;

if (twl6040_has_vibra(pdata, node)) {
irq = twl6040->irq_base + TWL6040_IRQ_VIB;
irq = regmap_irq_get_virq(twl6040->irq_data, TWL6040_IRQ_VIB);

cell = &twl6040->cells[children];
cell->name = "twl6040-vibra";
Expand Down Expand Up @@ -657,11 +682,11 @@ static int __devinit twl6040_probe(struct i2c_client *client,
return 0;

mfd_err:
free_irq(twl6040->irq_base + TWL6040_IRQ_TH, twl6040);
free_irq(twl6040->irq_th, twl6040);
thirq_err:
free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040);
free_irq(twl6040->irq_ready, twl6040);
readyirq_err:
twl6040_irq_exit(twl6040);
regmap_del_irq_chip(twl6040->irq, twl6040->irq_data);
irq_init_err:
if (gpio_is_valid(twl6040->audpwron))
gpio_free(twl6040->audpwron);
Expand All @@ -685,9 +710,9 @@ static int __devexit twl6040_remove(struct i2c_client *client)
if (gpio_is_valid(twl6040->audpwron))
gpio_free(twl6040->audpwron);

free_irq(twl6040->irq_base + TWL6040_IRQ_READY, twl6040);
free_irq(twl6040->irq_base + TWL6040_IRQ_TH, twl6040);
twl6040_irq_exit(twl6040);
free_irq(twl6040->irq_ready, twl6040);
free_irq(twl6040->irq_th, twl6040);
regmap_del_irq_chip(twl6040->irq, twl6040->irq_data);

mfd_remove_devices(&client->dev);
i2c_set_clientdata(client, NULL);
Expand Down
205 changes: 0 additions & 205 deletions trunk/drivers/mfd/twl6040-irq.c

This file was deleted.

10 changes: 5 additions & 5 deletions trunk/include/linux/mfd/twl6040.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,12 @@ struct twl6040_platform_data {
};

struct regmap;
struct regmap_irq_chips_data;

struct twl6040 {
struct device *dev;
struct regmap *regmap;
struct regmap_irq_chip_data *irq_data;
struct regulator_bulk_data supplies[2]; /* supplies for vio, v2v1 */
struct mutex mutex;
struct mutex irq_mutex;
Expand All @@ -228,9 +230,8 @@ struct twl6040 {
unsigned int mclk;

unsigned int irq;
unsigned int irq_base;
u8 irq_masks_cur;
u8 irq_masks_cache;
unsigned int irq_ready;
unsigned int irq_th;
};

int twl6040_reg_read(struct twl6040 *twl6040, unsigned int reg);
Expand All @@ -245,8 +246,7 @@ int twl6040_set_pll(struct twl6040 *twl6040, int pll_id,
unsigned int freq_in, unsigned int freq_out);
int twl6040_get_pll(struct twl6040 *twl6040);
unsigned int twl6040_get_sysclk(struct twl6040 *twl6040);
int twl6040_irq_init(struct twl6040 *twl6040);
void twl6040_irq_exit(struct twl6040 *twl6040);

/* Get the combined status of the vibra control register */
int twl6040_get_vibralr_status(struct twl6040 *twl6040);

Expand Down

0 comments on commit fb5f76e

Please sign in to comment.