Windows XP Windows 7 Windows 2003 Windows Vista Windows教程綜合 Linux 系統教程
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟件教程
 Windows教程網 >> Linux系統教程 >> Linux教程 >> I2C 的platform

I2C 的platform

日期:2017/2/7 14:38:59      編輯:Linux教程
  /drivers/i2c/busses/i2c-s3c2410.c:
static int s3c24xx_i2c_probe(struct platform_device *pdev) { struct s3c24xx_i2c *i2c; ..... strlcpy(i2c->adap.name, "s3c2410-i2c", sizeof(i2c->adap.name)); i2c->adap.owner = THIS_MODULE; i2c->adap.algo = &s3c24xx_i2c_algorithm; //adapter的i2c_algorithm i2c->adap.retries = 2; i2c->adap.class = I2C_CLASS_HWMON | I2C_CLASS_SPD; ..... i2c->adap.algo_data = i2c; i2c->adap.dev.parent = &pdev->dev; ......   i2c->adap.nr = pdata->bus_num; ....   ret = i2c_add_numbered_adapter(&i2c->adap); //注冊i2c_adapter       ..... }
  static struct platform_driver s3c24xx_i2c_driver = { .probe = s3c24xx_i2c_probe, .remove = s3c24xx_i2c_remove, .id_table = s3c24xx_driver_ids, .driver = { .owner = THIS_MODULE, .name = "s3c-i2c", .pm = S3C24XX_DEV_PM_OPS, }, };
  static int __init i2c_adap_s3c_init(void) { return platform_driver_register(&s3c24xx_i2c_driver); } subsys_initcall(i2c_adap_s3c_init);

Copyright © Windows教程網 All Rights Reserved