mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	Documentation: nvmem: document cell tables and lookup entries
Document the new nvmem kernel APIs. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
		
							parent
							
								
									506157be06
								
							
						
					
					
						commit
						4903d19c20
					
				
					 1 changed files with 31 additions and 0 deletions
				
			
		| 
						 | 
					@ -58,6 +58,37 @@ static int qfprom_probe(struct platform_device *pdev)
 | 
				
			||||||
It is mandatory that the NVMEM provider has a regmap associated with its
 | 
					It is mandatory that the NVMEM provider has a regmap associated with its
 | 
				
			||||||
struct device. Failure to do would return error code from nvmem_register().
 | 
					struct device. Failure to do would return error code from nvmem_register().
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Users of board files can define and register nvmem cells using the
 | 
				
			||||||
 | 
					nvmem_cell_table struct:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static struct nvmem_cell_info foo_nvmem_cells[] = {
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							.name		= "macaddr",
 | 
				
			||||||
 | 
							.offset		= 0x7f00,
 | 
				
			||||||
 | 
							.bytes		= ETH_ALEN,
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static struct nvmem_cell_table foo_nvmem_cell_table = {
 | 
				
			||||||
 | 
						.nvmem_name		= "i2c-eeprom",
 | 
				
			||||||
 | 
						.cells			= foo_nvmem_cells,
 | 
				
			||||||
 | 
						.ncells			= ARRAY_SIZE(foo_nvmem_cells),
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					nvmem_add_cell_table(&foo_nvmem_cell_table);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Additionally it is possible to create nvmem cell lookup entries and register
 | 
				
			||||||
 | 
					them with the nvmem framework from machine code as shown in the example below:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static struct nvmem_cell_lookup foo_nvmem_lookup = {
 | 
				
			||||||
 | 
						.nvmem_name		= "i2c-eeprom",
 | 
				
			||||||
 | 
						.cell_name		= "macaddr",
 | 
				
			||||||
 | 
						.dev_id			= "foo_mac.0",
 | 
				
			||||||
 | 
						.con_id			= "mac-address",
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					nvmem_add_cell_lookups(&foo_nvmem_lookup, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
NVMEM Consumers
 | 
					NVMEM Consumers
 | 
				
			||||||
+++++++++++++++
 | 
					+++++++++++++++
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue