Kernel source code arch \ Arm \ plat-s3c24xx \ s3c2410-clock.c
/* standard clock definitions */static struct clk init_clocks_off[] = {{.name= "nand",.id= -1,.parent= &clk_h,.enable= s3c2410_clkcon_enable,.ctrlbit= S3C2410_CLKCON_NAND,}, {.name= "sdi",.id= -1,.parent= &clk_p,.enable= s3c2410_clkcon_enable,.ctrlbit= S3C2410_CLKCON_SDI,}, {.name= "adc",.id= -1,.parent= &clk_p,.enable= s3c2410_clkcon_enable,.ctrlbit= S3C2410_CLKCON_ADC,}, {.name= "i2c",.id= -1,.parent= &clk_p,.enable= s3c2410_clkcon_enable,.ctrlbit= S3C2410_CLKCON_IIC,}, {.name= "iis",.id= -1,.parent= &clk_p,.enable= s3c2410_clkcon_enable,.ctrlbit= S3C2410_CLKCON_IIS,}, {.name= "spi",.id= -1,.parent= &clk_p,.enable= s3c2410_clkcon_enable,.ctrlbit= S3C2410_CLKCON_SPI,}};static struct clk init_clocks[] = {{.name= "lcd",.id= -1,.parent= &clk_h,.enable= s3c2410_clkcon_enable,.ctrlbit= S3C2410_CLKCON_LCDC,}, {.name= "gpio",.id= -1,.parent= &clk_p,.enable= s3c2410_clkcon_enable,.ctrlbit= S3C2410_CLKCON_GPIO,}, {.name= "usb-host",.id= -1,.parent= &clk_h,.enable= s3c2410_clkcon_enable,.ctrlbit= S3C2410_CLKCON_USBH,}, {.name= "usb-device",.id= -1,.parent= &clk_h,.enable= s3c2410_clkcon_enable,.ctrlbit= S3C2410_CLKCON_USBD,}, {.name= "timers",.id= -1,.parent= &clk_p,.enable= s3c2410_clkcon_enable,.ctrlbit= S3C2410_CLKCON_PWMT,}, {.name= "uart",.id= 0,.parent= &clk_p,.enable= s3c2410_clkcon_enable,.ctrlbit= S3C2410_CLKCON_UART0,}, {.name= "uart",.id= 1,.parent= &clk_p,.enable= s3c2410_clkcon_enable,.ctrlbit= S3C2410_CLKCON_UART1,}, {.name= "uart",.id= 2,.parent= &clk_p,.enable= s3c2410_clkcon_enable,.ctrlbit= S3C2410_CLKCON_UART2,}, {.name= "rtc",.id= -1,.parent= &clk_p,.enable= s3c2410_clkcon_enable,.ctrlbit= S3C2410_CLKCON_RTC,}, {.name= "watchdog",.id= -1,.parent= &clk_p,.ctrlbit= 0,}, {.name= "usb-bus-host",.id= -1,.parent= &clk_usb_bus,}, {.name= "usb-bus-gadget",.id= -1,.parent= &clk_usb_bus,},};
Here we can see the clock enable and disabled at system startup, so our ADC clock cannot be used after system startup.
To use the ADC clock, first we need to obtain the ADC clock and then enable it.
Obtain clock functions
Struct CLK * clk_get (struct device * Dev, const char * ID)
In the first parameter, because CLK-> ID is generally-1, you can directly input null.
If CLK-> ID is not-1, the function will get Dev-> bus_id through the dev passed in by the first parameter.
The second parameter is a string used to specify the name of the clock you want to obtain. After the parameter is passed in, the kernel finds whether a Dev-> ID (or-1) is consistent with CLK-> ID, and the con_id and CLK-> name are consistent clock, if they are inconsistent, the query fails. Therefore, my function here should be clk_get (null,
"ADC ").
Enable clock functions
Int clk_enable (struct CLK * CLK)
Disable clock functions
Void clk_disable (struct CLK * CLK)
Then we can use the ADC.