Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 
0003 #ifndef __LINUX_JZ4740_ADC
0004 #define __LINUX_JZ4740_ADC
0005 
0006 struct device;
0007 
0008 /*
0009  * jz4740_adc_set_config - Configure a JZ4740 adc device
0010  * @dev: Pointer to a jz4740-adc device
0011  * @mask: Mask for the config value to be set
0012  * @val: Value to be set
0013  *
0014  * This function can be used by the JZ4740 ADC mfd cells to configure their
0015  * options in the shared config register.
0016 */
0017 int jz4740_adc_set_config(struct device *dev, uint32_t mask, uint32_t val);
0018 
0019 #define JZ_ADC_CONFIG_SPZZ      BIT(31)
0020 #define JZ_ADC_CONFIG_EX_IN     BIT(30)
0021 #define JZ_ADC_CONFIG_DNUM_MASK     (0x7 << 16)
0022 #define JZ_ADC_CONFIG_DMA_ENABLE    BIT(15)
0023 #define JZ_ADC_CONFIG_XYZ_MASK      (0x2 << 13)
0024 #define JZ_ADC_CONFIG_SAMPLE_NUM_MASK   (0x7 << 10)
0025 #define JZ_ADC_CONFIG_CLKDIV_MASK   (0xf << 5)
0026 #define JZ_ADC_CONFIG_BAT_MB        BIT(4)
0027 
0028 #define JZ_ADC_CONFIG_DNUM(dnum)    ((dnum) << 16)
0029 #define JZ_ADC_CONFIG_XYZ_OFFSET(dnum)  ((xyz) << 13)
0030 #define JZ_ADC_CONFIG_SAMPLE_NUM(x) ((x) << 10)
0031 #define JZ_ADC_CONFIG_CLKDIV(div)   ((div) << 5)
0032 
0033 #endif