I have found core.c, with
static void __init sun7i_init(void)
{
 pr_info("%s: enter\n", __func__);
 sw_pdev_init();
 /* Register platform devices here!! */
}


Le mercredi 13 mai 2015 17:15:43 UTC+2, Guillaume Debray a écrit :
>
> I'm trying to modify the kernel of Android (4.2) with this instructions: 
> http://kernel--tegra.android-source-browsing.googlecode.com/git-history/08f02f8bba6ec3613a3ca3d19e1a07f67739bdd4/drivers/staging/iio/imu/inv_mpu/README
>
> *The goal is to add the MPU6050 driver *to the kernel.
>
> All is done, except one thing:
>
>> For the Panda Board, the board file can be found at
>> arch/arm/mach-omap2/board-omap4panda.c.
>
>
> In my folder tree, I have
> arch/arm/mach-sun7i
> But there's no board-sun7i.c file (or equivalent).
>
> And I must to declare a secondary i2c adress for the new drivers work.
>
> How can I do? (I'm new in C)
>
> I have tried to modify device.c, with this following code:
>
> /* ACCELEROMETER */
> #include <linux/mpu.h>
>
> static int __init sun7i_i2c_init(void)
> {
>         i2c_bus_type(4, 400,
>                      i2c_init_board,
>                      ARRAY_SIZE(i2c_init_board));
> }
>
>
> static struct mpu_platform_data gyro_platform_data = {
>  .int_config  = 0x00,
>  .level_shifter = 0,
>  .orientation = {  -1,  0,  0,
>    0,  1,  0,
>    0,  0, -1 },
>  .sec_slave_type = SECONDARY_SLAVE_TYPE_COMPASS,
>  .sec_slave_id   = COMPASS_ID_AK8963,
>  .secondary_i2c_addr = 0x0E
> };
>
>
> static struct mpu_platform_data gyro_platform_data = {
>  .int_config  = 0x00,
>  .level_shifter = 0,
>  .orientation = {  -1,  0,  0,
>    0,  1,  0,
>    0,  0, -1 },
>  .sec_slave_type = SECONDARY_SLAVE_TYPE_COMPASS,
>  .sec_slave_id   = COMPASS_ID_AK8975,
>  .secondary_i2c_addr = 0x0E
> };
>
>
> static struct mpu_platform_data gyro_platform_data = {
>  .int_config  = 0x00,
>  .level_shifter = 0,
>  .orientation = {  -1,  0,  0,
>    0,  1,  0,
>    0,  0, -1 },
>  .sec_slave_type = SECONDARY_SLAVE_TYPE_ACCEL,
>  .sec_slave_id   = ACCEL_ID_BMA250,
>  .secondary_i2c_addr = 0x18,
> };
>
>
> static struct i2c_board_info __initdata i2c_init_board[] = {
>  {
>  I2C_BOARD_INFO("mpu3050", 0x68),
>  .irq = (IH_GPIO_BASE + MPUIRQ_GPIO),
>  .platform_data = &gyro_platform_data,
>  },
> };
>
>
> static struct i2c_board_info __initdata i2c_init_board[] = {
>  {
>  I2C_BOARD_INFO("itg3500", 0x68),
>  .irq = (IH_GPIO_BASE + MPUIRQ_GPIO),
>                 .platform_data = &gyro_platform_data,
>  },
> };
> //for MPU6050
> static struct i2c_board_info __initdata i2c_init_board[] = {
>  {
>  I2C_BOARD_INFO("mpu6050", 0x68),
>  .irq = (IH_GPIO_BASE + MPUIRQ_GPIO),
>  .platform_data = &gyro_platform_data,
>  },
> };
> //for MPU9150
> static struct i2c_board_info __initdata i2c_init_board[] = {
>  {
>  I2C_BOARD_INFO("mpu9150", 0x68),
>  .irq = (IH_GPIO_BASE + MPUIRQ_GPIO),
>  .platform_data = &gyro_platform_data,
>  },
> };
>
>
> /* END ACCELEROMETERS */
>
> The problem is, that *i2c_init_board* is not define, I have looked in 
> i2c.h
>
> So, is it a good idea to try to modify device.c, or the modification must 
> done in another file ? which one ?
>
> Thanks 
>

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to