Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 354213
b: refs/heads/master
c: 5e1f9ac
h: refs/heads/master
i:
  354211: 6fcce22
v: v3
  • Loading branch information
Marek Vasut authored and Jonathan Cameron committed Jan 26, 2013
1 parent f46397a commit c1986b4
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 12 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: 232827fb8168d07844a589f0d4991afab16a23ea
refs/heads/master: 5e1f9aca0a8f8696a97cb1637b3f7eb89688e393
4 changes: 2 additions & 2 deletions trunk/drivers/staging/iio/adc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ config LPC32XX_ADC
via sysfs.

config MXS_LRADC
tristate "Freescale i.MX28 LRADC"
tristate "Freescale i.MX23/i.MX28 LRADC"
depends on ARCH_MXS
select IIO_BUFFER
select IIO_TRIGGERED_BUFFER
help
Say yes here to build support for i.MX28 LRADC convertor
Say yes here to build support for i.MX23/i.MX28 LRADC convertor
built into these chips.

To compile this driver as a module, choose M here: the
Expand Down
56 changes: 47 additions & 9 deletions trunk/drivers/staging/iio/adc/mxs-lradc.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,24 @@
*/
#define LRADC_TS_SAMPLE_AMOUNT 4

static const char * const mxs_lradc_irq_name[] = {
enum mxs_lradc_id {
IMX23_LRADC,
IMX28_LRADC,
};

static const char * const mx23_lradc_irq_names[] = {
"mxs-lradc-touchscreen",
"mxs-lradc-channel0",
"mxs-lradc-channel1",
"mxs-lradc-channel2",
"mxs-lradc-channel3",
"mxs-lradc-channel4",
"mxs-lradc-channel5",
"mxs-lradc-channel6",
"mxs-lradc-channel7",
};

static const char * const mx28_lradc_irq_names[] = {
"mxs-lradc-touchscreen",
"mxs-lradc-thresh0",
"mxs-lradc-thresh1",
Expand All @@ -92,6 +109,22 @@ static const char * const mxs_lradc_irq_name[] = {
"mxs-lradc-button1",
};

struct mxs_lradc_of_config {
const int irq_count;
const char * const *irq_name;
};

static const struct mxs_lradc_of_config const mxs_lradc_of_config[] = {
[IMX23_LRADC] = {
.irq_count = ARRAY_SIZE(mx23_lradc_irq_names),
.irq_name = mx23_lradc_irq_names,
},
[IMX28_LRADC] = {
.irq_count = ARRAY_SIZE(mx28_lradc_irq_names),
.irq_name = mx28_lradc_irq_names,
},
};

enum mxs_lradc_ts {
MXS_LRADC_TOUCHSCREEN_NONE = 0,
MXS_LRADC_TOUCHSCREEN_4WIRE,
Expand Down Expand Up @@ -857,8 +890,19 @@ static void mxs_lradc_hw_stop(struct mxs_lradc *lradc)
writel(0, lradc->base + LRADC_DELAY(i));
}

static const struct of_device_id mxs_lradc_dt_ids[] = {
{ .compatible = "fsl,imx23-lradc", .data = (void *)IMX23_LRADC, },
{ .compatible = "fsl,imx28-lradc", .data = (void *)IMX28_LRADC, },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, mxs_lradc_dt_ids);

static int mxs_lradc_probe(struct platform_device *pdev)
{
const struct of_device_id *of_id =
of_match_device(mxs_lradc_dt_ids, &pdev->dev);
const struct mxs_lradc_of_config *of_cfg =
&mxs_lradc_of_config[(enum mxs_lradc_id)of_id->data];
struct device *dev = &pdev->dev;
struct device_node *node = dev->of_node;
struct mxs_lradc *lradc;
Expand Down Expand Up @@ -902,7 +946,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)
ts_wires);

/* Grab all IRQ sources */
for (i = 0; i < 13; i++) {
for (i = 0; i < of_cfg->irq_count; i++) {
lradc->irq[i] = platform_get_irq(pdev, i);
if (lradc->irq[i] < 0) {
ret = -EINVAL;
Expand All @@ -911,7 +955,7 @@ static int mxs_lradc_probe(struct platform_device *pdev)

ret = devm_request_irq(dev, lradc->irq[i],
mxs_lradc_handle_irq, 0,
mxs_lradc_irq_name[i], iio);
of_cfg->irq_name[i], iio);
if (ret)
goto err_addr;
}
Expand Down Expand Up @@ -983,12 +1027,6 @@ static int mxs_lradc_remove(struct platform_device *pdev)
return 0;
}

static const struct of_device_id mxs_lradc_dt_ids[] = {
{ .compatible = "fsl,imx28-lradc", },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, mxs_lradc_dt_ids);

static struct platform_driver mxs_lradc_driver = {
.driver = {
.name = DRIVER_NAME,
Expand Down

0 comments on commit c1986b4

Please sign in to comment.