tps65910.c (f1615bbe9be4def59c3b3eaddb60722efeed16c2) | tps65910.c (01a0f4aaaefff9f57bb17e6cc514c84ba43a7335) |
---|---|
1/* 2 * tps65910.c -- TI TPS6591x 3 * 4 * Copyright 2010 Texas Instruments Inc. 5 * 6 * Author: Graeme Gregory <gg@slimlogic.co.uk> 7 * Author: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk> 8 * --- 373 unchanged lines hidden (view full) --- 382static const struct of_device_id tps65910_of_match[] = { 383 { .compatible = "ti,tps65910", .data = (void *)TPS65910}, 384 { .compatible = "ti,tps65911", .data = (void *)TPS65911}, 385 { }, 386}; 387MODULE_DEVICE_TABLE(of, tps65910_of_match); 388 389static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client, | 1/* 2 * tps65910.c -- TI TPS6591x 3 * 4 * Copyright 2010 Texas Instruments Inc. 5 * 6 * Author: Graeme Gregory <gg@slimlogic.co.uk> 7 * Author: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk> 8 * --- 373 unchanged lines hidden (view full) --- 382static const struct of_device_id tps65910_of_match[] = { 383 { .compatible = "ti,tps65910", .data = (void *)TPS65910}, 384 { .compatible = "ti,tps65911", .data = (void *)TPS65911}, 385 { }, 386}; 387MODULE_DEVICE_TABLE(of, tps65910_of_match); 388 389static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client, |
390 int *chip_id) | 390 unsigned long *chip_id) |
391{ 392 struct device_node *np = client->dev.of_node; 393 struct tps65910_board *board_info; 394 unsigned int prop; 395 const struct of_device_id *match; 396 int ret = 0; 397 398 match = of_match_device(tps65910_of_match, &client->dev); 399 if (!match) { 400 dev_err(&client->dev, "Failed to find matching dt id\n"); 401 return NULL; 402 } 403 | 391{ 392 struct device_node *np = client->dev.of_node; 393 struct tps65910_board *board_info; 394 unsigned int prop; 395 const struct of_device_id *match; 396 int ret = 0; 397 398 match = of_match_device(tps65910_of_match, &client->dev); 399 if (!match) { 400 dev_err(&client->dev, "Failed to find matching dt id\n"); 401 return NULL; 402 } 403 |
404 *chip_id = (int)match->data; | 404 *chip_id = (unsigned long)match->data; |
405 406 board_info = devm_kzalloc(&client->dev, sizeof(*board_info), 407 GFP_KERNEL); 408 if (!board_info) { 409 dev_err(&client->dev, "Failed to allocate pdata\n"); 410 return NULL; 411 } 412 --- 13 unchanged lines hidden (view full) --- 426 board_info->pm_off = of_property_read_bool(np, 427 "ti,system-power-controller"); 428 429 return board_info; 430} 431#else 432static inline 433struct tps65910_board *tps65910_parse_dt(struct i2c_client *client, | 405 406 board_info = devm_kzalloc(&client->dev, sizeof(*board_info), 407 GFP_KERNEL); 408 if (!board_info) { 409 dev_err(&client->dev, "Failed to allocate pdata\n"); 410 return NULL; 411 } 412 --- 13 unchanged lines hidden (view full) --- 426 board_info->pm_off = of_property_read_bool(np, 427 "ti,system-power-controller"); 428 429 return board_info; 430} 431#else 432static inline 433struct tps65910_board *tps65910_parse_dt(struct i2c_client *client, |
434 int *chip_id) | 434 unsigned long *chip_id) |
435{ 436 return NULL; 437} 438#endif 439 440static struct i2c_client *tps65910_i2c_client; 441static void tps65910_power_off(void) 442{ --- 5 unchanged lines hidden (view full) --- 448 DEVCTRL_PWR_OFF_MASK) < 0) 449 return; 450 451 tps65910_reg_clear_bits(tps65910, TPS65910_DEVCTRL, 452 DEVCTRL_DEV_ON_MASK); 453} 454 455static int tps65910_i2c_probe(struct i2c_client *i2c, | 435{ 436 return NULL; 437} 438#endif 439 440static struct i2c_client *tps65910_i2c_client; 441static void tps65910_power_off(void) 442{ --- 5 unchanged lines hidden (view full) --- 448 DEVCTRL_PWR_OFF_MASK) < 0) 449 return; 450 451 tps65910_reg_clear_bits(tps65910, TPS65910_DEVCTRL, 452 DEVCTRL_DEV_ON_MASK); 453} 454 455static int tps65910_i2c_probe(struct i2c_client *i2c, |
456 const struct i2c_device_id *id) | 456 const struct i2c_device_id *id) |
457{ 458 struct tps65910 *tps65910; 459 struct tps65910_board *pmic_plat_data; 460 struct tps65910_board *of_pmic_plat_data = NULL; 461 struct tps65910_platform_data *init_data; | 457{ 458 struct tps65910 *tps65910; 459 struct tps65910_board *pmic_plat_data; 460 struct tps65910_board *of_pmic_plat_data = NULL; 461 struct tps65910_platform_data *init_data; |
462 unsigned long chip_id = id->driver_data; |
|
462 int ret = 0; | 463 int ret = 0; |
463 int chip_id = id->driver_data; | |
464 465 pmic_plat_data = dev_get_platdata(&i2c->dev); 466 467 if (!pmic_plat_data && i2c->dev.of_node) { 468 pmic_plat_data = tps65910_parse_dt(i2c, &chip_id); 469 of_pmic_plat_data = pmic_plat_data; 470 } 471 --- 95 unchanged lines hidden --- | 464 465 pmic_plat_data = dev_get_platdata(&i2c->dev); 466 467 if (!pmic_plat_data && i2c->dev.of_node) { 468 pmic_plat_data = tps65910_parse_dt(i2c, &chip_id); 469 of_pmic_plat_data = pmic_plat_data; 470 } 471 --- 95 unchanged lines hidden --- |