Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

platform device/driver vs i2c device/driver

As i am new to embedded field i am facing difficulties in understanding the clear difference between i2c device/driver and platform device/driver.

i have read this link:

What is the difference between Platform driver and normal device driver..?

which say platform devices/driver are use for not discoverable device like devices connected at i2c bus and Platform devices are bound to drivers by matching names.

I have gone through a board file, in which audio codec(non discoverable device) connected at i2c bus is registered using i2c API (i2c_register_board_info, omap_i2c_add_bus etc.), so my questions are

  1. What is difference between i2c device/driver and platform device/driver ?
  2. When to use i2c related API and when to use platform related API(platform_driver_register,platform_device_register) for registration of device/driver in kernel. or if we can use i2c related API for non discoverable device(connected on i2c) registration then where we need platform device registration.
like image 751
Riddhi patel Avatar asked Apr 26 '26 23:04

Riddhi patel


1 Answers

Every SOC(Silicon on Chip) or microcontroller will have a I2C controller, which provides a way to connect and communicate to I2C devices like camera sensors, PMIC, temperature sensor etc. The driver used for configuring and using this I2C controller is called platform driver. This I2C controller is called platform device. Mostly platform devices will be part of the SOC. The registers of the I2C controller are programmed using platform driver. These registers are in say ARM memory mapped and will be available on TRM of the SOC.

Now all the I2C devices that can be connected to the SOC or microcontroller via I2C controller like Camera sensors, PMIC, temperature sensor etc need a driver to control them. This driver is called device driver. The registers of these devices are not part of memory map of SOC. Need the datasheet of the I2C device like OV5640 Camera Sensor to program the registers. I2C data are sent out to program the registers and access data.

like image 97
Drad Avatar answered Apr 29 '26 19:04

Drad