]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/mfd/mc13783-core.c
mfd: Remove deprecated mc13783 functions
[mirror_ubuntu-artful-kernel.git] / drivers / mfd / mc13783-core.c
index b0778dcca9178880b2c02f4571a83c5ba60f9126..2506e6888507da3b83e99d3addbc6da25ca42408 100644 (file)
  */
 #include <linux/slab.h>
 #include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/mutex.h>
+#include <linux/interrupt.h>
 #include <linux/spi/spi.h>
 #include <linux/mfd/core.h>
-#include <linux/mfd/mc13783-private.h>
+#include <linux/mfd/mc13783.h>
+
+struct mc13783 {
+       struct spi_device *spidev;
+       struct mutex lock;
+       int irq;
+       int adcflags;
+
+       irq_handler_t irqhandler[MC13783_NUM_IRQ];
+       void *irqdata[MC13783_NUM_IRQ];
+};
+
+#define MC13783_REG_REVISION                    7
+#define MC13783_REG_ADC_0                      43
+#define MC13783_REG_ADC_1                      44
+#define MC13783_REG_ADC_2                      45
 
 #define MC13783_IRQSTAT0       0
 #define MC13783_IRQSTAT0_ADCDONEI      (1 << 0)
@@ -228,7 +246,10 @@ EXPORT_SYMBOL(mc13783_reg_rmw);
 
 int mc13783_get_flags(struct mc13783 *mc13783)
 {
-       return mc13783->flags;
+       struct mc13783_platform_data *pdata =
+               dev_get_platdata(&mc13783->spidev->dev);
+
+       return pdata->flags;
 }
 EXPORT_SYMBOL(mc13783_get_flags);
 
@@ -471,7 +492,7 @@ static irqreturn_t mc13783_handler_adcdone(int irq, void *data)
        return IRQ_HANDLED;
 }
 
-#define MC13783_ADC_WORKING (1 << 16)
+#define MC13783_ADC_WORKING (1 << 0)
 
 int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
                unsigned int channel, unsigned int *sample)
@@ -487,12 +508,12 @@ int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
 
        mc13783_lock(mc13783);
 
-       if (mc13783->flags & MC13783_ADC_WORKING) {
+       if (mc13783->adcflags & MC13783_ADC_WORKING) {
                ret = -EBUSY;
                goto out;
        }
 
-       mc13783->flags |= MC13783_ADC_WORKING;
+       mc13783->adcflags |= MC13783_ADC_WORKING;
 
        mc13783_reg_read(mc13783, MC13783_ADC0, &old_adc0);
 
@@ -556,7 +577,7 @@ int mc13783_adc_do_conversion(struct mc13783 *mc13783, unsigned int mode,
                /* restore TSMOD */
                mc13783_reg_write(mc13783, MC13783_REG_ADC_0, old_adc0);
 
-       mc13783->flags &= ~MC13783_ADC_WORKING;
+       mc13783->adcflags &= ~MC13783_ADC_WORKING;
 out:
        mc13783_unlock(mc13783);
 
@@ -653,14 +674,6 @@ err_revision:
                return ret;
        }
 
-       /* This should go away (BEGIN) */
-       if (pdata) {
-               mc13783->flags = pdata->flags;
-               mc13783->regulators = pdata->regulators;
-               mc13783->num_regulators = pdata->num_regulators;
-       }
-       /* This should go away (END) */
-
        mc13783_unlock(mc13783);
 
        if (pdata->flags & MC13783_USE_ADC)