Lines 1270-1275
static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, i
Link Here
|
1270 |
size_t nval; |
1270 |
size_t nval; |
1271 |
int i, ret; |
1271 |
int i, ret; |
1272 |
|
1272 |
|
|
|
1273 |
printk("CSC3551: probing %s\n", hid); |
1274 |
|
1273 |
adev = acpi_dev_get_first_match_dev(hid, NULL, -1); |
1275 |
adev = acpi_dev_get_first_match_dev(hid, NULL, -1); |
1274 |
if (!adev) { |
1276 |
if (!adev) { |
1275 |
dev_err(cs35l41->dev, "Failed to find an ACPI device for %s\n", hid); |
1277 |
dev_err(cs35l41->dev, "Failed to find an ACPI device for %s\n", hid); |
Lines 1287-1294
static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, i
Link Here
|
1287 |
property = "cirrus,dev-index"; |
1289 |
property = "cirrus,dev-index"; |
1288 |
ret = device_property_count_u32(physdev, property); |
1290 |
ret = device_property_count_u32(physdev, property); |
1289 |
if (ret <= 0) { |
1291 |
if (ret <= 0) { |
1290 |
ret = cs35l41_no_acpi_dsd(cs35l41, physdev, id, hid); |
1292 |
//ret = cs35l41_no_acpi_dsd(cs35l41, physdev, id, hid); |
1291 |
goto err_put_physdev; |
1293 |
//goto err_put_physdev; |
|
|
1294 |
goto no_acpi_dsd; |
1292 |
} |
1295 |
} |
1293 |
if (ret > ARRAY_SIZE(values)) { |
1296 |
if (ret > ARRAY_SIZE(values)) { |
1294 |
ret = -EINVAL; |
1297 |
ret = -EINVAL; |
Lines 1383-1388
static int cs35l41_hda_read_acpi(struct cs35l41_hda *cs35l41, const char *hid, i
Link Here
|
1383 |
put_device(physdev); |
1386 |
put_device(physdev); |
1384 |
|
1387 |
|
1385 |
return ret; |
1388 |
return ret; |
|
|
1389 |
|
1390 |
no_acpi_dsd: |
1391 |
/* |
1392 |
* Device CLSA0100 doesn't have _DSD so a gpiod_get by the label reset won't work. |
1393 |
* And devices created by i2c-multi-instantiate don't have their device struct pointing to |
1394 |
* the correct fwnode, so acpi_dev must be used here. |
1395 |
* And devm functions expect that the device requesting the resource has the correct |
1396 |
* fwnode. |
1397 |
*/ |
1398 |
|
1399 |
printk("CSC3551: no_acpi_dsd: %s\n", hid); |
1400 |
|
1401 |
/* TODO: This is a hack. */ |
1402 |
if (strncmp(hid, "CSC3551", 7) == 0) { |
1403 |
goto csc3551; |
1404 |
} |
1405 |
|
1406 |
if (strncmp(hid, "CLSA0100", 8) != 0) |
1407 |
return -EINVAL; |
1408 |
|
1409 |
/* check I2C address to assign the index */ |
1410 |
cs35l41->index = id == 0x40 ? 0 : 1; |
1411 |
cs35l41->hw_cfg.spk_pos = cs35l41->index; |
1412 |
cs35l41->channel_index = 0; |
1413 |
cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH); |
1414 |
cs35l41->hw_cfg.bst_type = CS35L41_EXT_BOOST_NO_VSPK_SWITCH; |
1415 |
hw_cfg->gpio2.func = CS35L41_GPIO2_INT_OPEN_DRAIN; |
1416 |
hw_cfg->gpio2.valid = true; |
1417 |
cs35l41->hw_cfg.valid = true; |
1418 |
put_device(physdev); |
1419 |
|
1420 |
return 0; |
1421 |
|
1422 |
csc3551: |
1423 |
|
1424 |
printk("CSC3551: id == 0x%x\n", id); |
1425 |
|
1426 |
// cirrus,dev-index |
1427 |
if(id == 0x40) |
1428 |
cs35l41->index = 0; |
1429 |
else |
1430 |
cs35l41->index = 1; |
1431 |
|
1432 |
cs35l41->channel_index = 0; |
1433 |
|
1434 |
cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, cs35l41->index, GPIOD_OUT_LOW); |
1435 |
|
1436 |
printk("CS3551: reset_gpio == 0x%x\n", cs35l41->reset_gpio); |
1437 |
|
1438 |
// cirrus,speaker-position |
1439 |
if(cs35l41->index == 0) |
1440 |
hw_cfg->spk_pos = 0; |
1441 |
else |
1442 |
hw_cfg->spk_pos = 1; |
1443 |
|
1444 |
// cirrus,gpio1-func |
1445 |
hw_cfg->gpio1.func = 1; |
1446 |
hw_cfg->gpio1.valid = true; |
1447 |
|
1448 |
// cirrus,gpio2-func |
1449 |
hw_cfg->gpio2.func = 0x02; |
1450 |
hw_cfg->gpio2.valid = true; |
1451 |
|
1452 |
// cirrus,boost-peak-milliamp |
1453 |
hw_cfg->bst_ipk = -1; |
1454 |
|
1455 |
// cirrus,boost-ind-nanohenry |
1456 |
hw_cfg->bst_ind = -1; |
1457 |
|
1458 |
// cirrus,boost-cap-microfarad |
1459 |
hw_cfg->bst_cap = -1; |
1460 |
|
1461 |
cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, cs35l41->index, nval, -1); |
1462 |
|
1463 |
if (hw_cfg->bst_ind > 0 || hw_cfg->bst_cap > 0 || hw_cfg->bst_ipk > 0) |
1464 |
hw_cfg->bst_type = CS35L41_INT_BOOST; |
1465 |
else |
1466 |
hw_cfg->bst_type = CS35L41_EXT_BOOST; |
1467 |
|
1468 |
hw_cfg->valid = true; |
1469 |
|
1470 |
put_device(physdev); |
1471 |
|
1472 |
printk("CSC3551: Done.\n"); |
1473 |
|
1474 |
return 0; |
1386 |
} |
1475 |
} |
1387 |
|
1476 |
|
1388 |
int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int irq, |
1477 |
int cs35l41_hda_probe(struct device *dev, const char *device_name, int id, int irq, |