Commit 2b99bafa authored by Patil, Rachna's avatar Patil, Rachna Committed by Samuel Ortiz

input: TSC: ti_tsc: Convert TSC into a MFDevice

This patch converts touchscreen into a MFD client.
All the register definitions, clock initialization,
etc has been moved to MFD core driver.
Signed-off-by: default avatarPatil, Rachna <rachna@ti.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 01636eb9
...@@ -531,7 +531,7 @@ config TOUCHSCREEN_TOUCHWIN ...@@ -531,7 +531,7 @@ config TOUCHSCREEN_TOUCHWIN
config TOUCHSCREEN_TI_AM335X_TSC config TOUCHSCREEN_TI_AM335X_TSC
tristate "TI Touchscreen Interface" tristate "TI Touchscreen Interface"
depends on ARCH_OMAP2PLUS depends on MFD_TI_AM335X_TSCADC
help help
Say Y here if you have 4/5/8 wire touchscreen controller Say Y here if you have 4/5/8 wire touchscreen controller
to be connected to the ADC controller on your TI AM335x SoC. to be connected to the ADC controller on your TI AM335x SoC.
......
This diff is collapsed.
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/mfd/ti_am335x_tscadc.h> #include <linux/mfd/ti_am335x_tscadc.h>
#include <linux/input/ti_am335x_tsc.h>
static unsigned int tscadc_readl(struct ti_tscadc_dev *tsadc, unsigned int reg) static unsigned int tscadc_readl(struct ti_tscadc_dev *tsadc, unsigned int reg)
{ {
...@@ -62,15 +63,19 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev) ...@@ -62,15 +63,19 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
struct clk *clk; struct clk *clk;
struct mfd_tscadc_board *pdata = pdev->dev.platform_data; struct mfd_tscadc_board *pdata = pdev->dev.platform_data;
struct mfd_cell *cell;
int irq; int irq;
int err, ctrl; int err, ctrl;
int clk_value, clock_rate; int clk_value, clock_rate;
int tsc_wires;
if (!pdata) { if (!pdata) {
dev_err(&pdev->dev, "Could not find platform data\n"); dev_err(&pdev->dev, "Could not find platform data\n");
return -EINVAL; return -EINVAL;
} }
tsc_wires = pdata->tsc_init->wires;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) { if (!res) {
dev_err(&pdev->dev, "no memory resource defined.\n"); dev_err(&pdev->dev, "no memory resource defined.\n");
...@@ -161,6 +166,12 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev) ...@@ -161,6 +166,12 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev)
ctrl |= CNTRLREG_TSCSSENB; ctrl |= CNTRLREG_TSCSSENB;
tscadc_writel(tscadc, REG_CTRL, ctrl); tscadc_writel(tscadc, REG_CTRL, ctrl);
/* TSC Cell */
cell = &tscadc->cells[TSC_CELL];
cell->name = "tsc";
cell->platform_data = tscadc;
cell->pdata_size = sizeof(*tscadc);
err = mfd_add_devices(&pdev->dev, pdev->id, tscadc->cells, err = mfd_add_devices(&pdev->dev, pdev->id, tscadc->cells,
TSCADC_CELLS, NULL, 0, NULL); TSCADC_CELLS, NULL, 0, NULL);
if (err < 0) if (err < 0)
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
#define STEPENB_MASK (0x1FFFF << 0) #define STEPENB_MASK (0x1FFFF << 0)
#define STEPENB(val) ((val) << 0) #define STEPENB(val) ((val) << 0)
#define STPENB_STEPENB STEPENB(0x1FFFF) #define STPENB_STEPENB STEPENB(0x1FFFF)
#define STPENB_STEPENB_TC STEPENB(0x1FFF)
/* IRQ enable */ /* IRQ enable */
#define IRQENB_HW_PEN BIT(0) #define IRQENB_HW_PEN BIT(0)
...@@ -120,7 +121,11 @@ ...@@ -120,7 +121,11 @@
#define ADC_CLK 3000000 #define ADC_CLK 3000000
#define MAX_CLK_DIV 7 #define MAX_CLK_DIV 7
#define TSCADC_CELLS 0 #define TSCADC_CELLS 1
enum tscadc_cells {
TSC_CELL,
};
struct mfd_tscadc_board { struct mfd_tscadc_board {
struct tsc_data *tsc_init; struct tsc_data *tsc_init;
...@@ -132,6 +137,9 @@ struct ti_tscadc_dev { ...@@ -132,6 +137,9 @@ struct ti_tscadc_dev {
void __iomem *tscadc_base; void __iomem *tscadc_base;
int irq; int irq;
struct mfd_cell cells[TSCADC_CELLS]; struct mfd_cell cells[TSCADC_CELLS];
/* tsc device */
struct titsc *tsc;
}; };
#endif #endif
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