Commit 5023574a authored by Jonathan Cameron's avatar Jonathan Cameron

staging:iio:adc:lpc32xx Apply consistent prefix to local defines

There was a bit of a random mixture going on here so change all prefixes
to LPC32XXAD_
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent af8f651b
...@@ -38,25 +38,28 @@ ...@@ -38,25 +38,28 @@
/* /*
* LPC32XX registers definitions * LPC32XX registers definitions
*/ */
#define LPC32XX_ADC_SELECT(x) ((x) + 0x04) #define LPC32XXAD_SELECT(x) ((x) + 0x04)
#define LPC32XX_ADC_CTRL(x) ((x) + 0x08) #define LPC32XXAD_CTRL(x) ((x) + 0x08)
#define LPC32XX_ADC_VALUE(x) ((x) + 0x48) #define LPC32XXAD_VALUE(x) ((x) + 0x48)
/* Bit definitions for LPC32XX_ADC_SELECT: */ /* Bit definitions for LPC32XXAD_SELECT: */
#define AD_REFm 0x00000200 /* constant, always write this value! */ /* constant, always write this value! */
#define AD_REFp 0x00000080 /* constant, always write this value! */ #define LPC32XXAD_REFm 0x00000200
#define AD_IN 0x00000010 /* multiple of this is the */ /* constant, always write this value! */
/* channel number: 0, 1, 2 */ #define LPC32XXAD_REFp 0x00000080
#define AD_INTERNAL 0x00000004 /* constant, always write this value! */ /* multiple of this is the channel number: 0, 1, 2 */
#define LPC32XXAD_IN 0x00000010
/* constant, always write this value! */
#define LPC32XXAD_INTERNAL 0x00000004
/* Bit definitions for LPC32XX_ADC_CTRL: */ /* Bit definitions for LPC32XXAD_CTRL: */
#define AD_STROBE 0x00000002 #define LPC32XXAD_STROBE 0x00000002
#define AD_PDN_CTRL 0x00000004 #define LPC32XXAD_PDN_CTRL 0x00000004
/* Bit definitions for LPC32XX_ADC_VALUE: */ /* Bit definitions for LPC32XXAD_VALUE: */
#define ADC_VALUE_MASK 0x000003FF #define LPC32XXAD_VALUE_MASK 0x000003FF
#define MOD_NAME "lpc32xx-adc" #define LPC32XXAD_NAME "lpc32xx-adc"
struct lpc32xx_adc_info { struct lpc32xx_adc_info {
void __iomem *adc_base; void __iomem *adc_base;
...@@ -78,11 +81,12 @@ static int lpc32xx_read_raw(struct iio_dev *indio_dev, ...@@ -78,11 +81,12 @@ static int lpc32xx_read_raw(struct iio_dev *indio_dev,
mutex_lock(&indio_dev->mlock); mutex_lock(&indio_dev->mlock);
clk_prepare_enable(info->clk); clk_prepare_enable(info->clk);
/* Measurement setup */ /* Measurement setup */
__raw_writel(AD_INTERNAL | (chan->address) | AD_REFp | AD_REFm, __raw_writel(LPC32XXAD_INTERNAL | (chan->address) |
LPC32XX_ADC_SELECT(info->adc_base)); LPC32XXAD_REFp | LPC32XXAD_REFm,
LPC32XXAD_SELECT(info->adc_base));
/* Trigger conversion */ /* Trigger conversion */
__raw_writel(AD_PDN_CTRL | AD_STROBE, __raw_writel(LPC32XXAD_PDN_CTRL | LPC32XXAD_STROBE,
LPC32XX_ADC_CTRL(info->adc_base)); LPC32XXAD_CTRL(info->adc_base));
wait_for_completion(&info->completion); /* set by ISR */ wait_for_completion(&info->completion); /* set by ISR */
clk_disable_unprepare(info->clk); clk_disable_unprepare(info->clk);
*val = info->value; *val = info->value;
...@@ -104,7 +108,7 @@ static const struct iio_info lpc32xx_adc_iio_info = { ...@@ -104,7 +108,7 @@ static const struct iio_info lpc32xx_adc_iio_info = {
.indexed = 1, \ .indexed = 1, \
.channel = _index, \ .channel = _index, \
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
.address = AD_IN * _index, \ .address = LPC32XXAD_IN * _index, \
.scan_index = _index, \ .scan_index = _index, \
} }
...@@ -119,8 +123,8 @@ static irqreturn_t lpc32xx_adc_isr(int irq, void *dev_id) ...@@ -119,8 +123,8 @@ static irqreturn_t lpc32xx_adc_isr(int irq, void *dev_id)
struct lpc32xx_adc_info *info = dev_id; struct lpc32xx_adc_info *info = dev_id;
/* Read value and clear irq */ /* Read value and clear irq */
info->value = __raw_readl(LPC32XX_ADC_VALUE(info->adc_base)) & info->value = __raw_readl(LPC32XXAD_VALUE(info->adc_base)) &
ADC_VALUE_MASK; LPC32XXAD_VALUE_MASK;
complete(&info->completion); complete(&info->completion);
return IRQ_HANDLED; return IRQ_HANDLED;
...@@ -166,7 +170,7 @@ static int lpc32xx_adc_probe(struct platform_device *pdev) ...@@ -166,7 +170,7 @@ static int lpc32xx_adc_probe(struct platform_device *pdev)
} }
retval = devm_request_irq(&pdev->dev, irq, lpc32xx_adc_isr, 0, retval = devm_request_irq(&pdev->dev, irq, lpc32xx_adc_isr, 0,
MOD_NAME, info); LPC32XXAD_NAME, info);
if (retval < 0) { if (retval < 0) {
dev_err(&pdev->dev, "failed requesting interrupt\n"); dev_err(&pdev->dev, "failed requesting interrupt\n");
return retval; return retval;
...@@ -176,7 +180,7 @@ static int lpc32xx_adc_probe(struct platform_device *pdev) ...@@ -176,7 +180,7 @@ static int lpc32xx_adc_probe(struct platform_device *pdev)
init_completion(&info->completion); init_completion(&info->completion);
iodev->name = MOD_NAME; iodev->name = LPC32XXAD_NAME;
iodev->dev.parent = &pdev->dev; iodev->dev.parent = &pdev->dev;
iodev->info = &lpc32xx_adc_iio_info; iodev->info = &lpc32xx_adc_iio_info;
iodev->modes = INDIO_DIRECT_MODE; iodev->modes = INDIO_DIRECT_MODE;
...@@ -203,7 +207,7 @@ MODULE_DEVICE_TABLE(of, lpc32xx_adc_match); ...@@ -203,7 +207,7 @@ MODULE_DEVICE_TABLE(of, lpc32xx_adc_match);
static struct platform_driver lpc32xx_adc_driver = { static struct platform_driver lpc32xx_adc_driver = {
.probe = lpc32xx_adc_probe, .probe = lpc32xx_adc_probe,
.driver = { .driver = {
.name = MOD_NAME, .name = LPC32XXAD_NAME,
.of_match_table = of_match_ptr(lpc32xx_adc_match), .of_match_table = of_match_ptr(lpc32xx_adc_match),
}, },
}; };
......
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