BCC: l...@intel.com CC: kbuild-...@lists.01.org CC: linux-ker...@vger.kernel.org TO: Srinivasa Rao Mandadapu <quic_sriva...@quicinc.com> CC: Vinod Koul <vk...@kernel.org> CC: Srinivas Kandagatla <srinivas.kandaga...@linaro.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master head: 50cd95ac46548429e5bba7ca75cc97d11a697947 commit: 1fd0d85affe4d64e54b81d04bf9577e57172a341 soundwire: qcom: Add flag for software clock gating check date: 6 weeks ago :::::: branch date: 17 hours ago :::::: commit date: 6 weeks ago config: riscv-randconfig-m031-20220819 (https://download.01.org/0day-ci/archive/20220820/202208202132.gxutdhmb-...@intel.com/config) compiler: riscv64-linux-gcc (GCC) 12.1.0 If you fix the issue, kindly add following tag where applicable Reported-by: kernel test robot <l...@intel.com> Reported-by: Dan Carpenter <dan.carpen...@oracle.com> New smatch warnings: drivers/soundwire/qcom.c:1319 qcom_swrm_probe() warn: passing zero to 'PTR_ERR' Old smatch warnings: arch/riscv/include/asm/atomic.h:204 arch_atomic_fetch_add_unless() warn: inconsistent indenting vim +/PTR_ERR +1319 drivers/soundwire/qcom.c abd9a6049bb59a Srinivas Kandagatla 2021-09-07 1279 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1280 static int qcom_swrm_probe(struct platform_device *pdev) 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1281 { 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1282 struct device *dev = &pdev->dev; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1283 struct sdw_master_prop *prop; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1284 struct sdw_bus_params *params; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1285 struct qcom_swrm_ctrl *ctrl; 8cb3b4e74cd810 Srinivas Kandagatla 2020-09-17 1286 const struct qcom_swrm_data *data; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1287 int ret; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1288 u32 val; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1289 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1290 ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1291 if (!ctrl) 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1292 return -ENOMEM; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1293 8cb3b4e74cd810 Srinivas Kandagatla 2020-09-17 1294 data = of_device_get_match_data(dev); 8cb3b4e74cd810 Srinivas Kandagatla 2020-09-17 1295 ctrl->rows_index = sdw_find_row_index(data->default_rows); 8cb3b4e74cd810 Srinivas Kandagatla 2020-09-17 1296 ctrl->cols_index = sdw_find_col_index(data->default_cols); 47edc0104c61d6 Vinod Koul 2020-11-25 1297 #if IS_REACHABLE(CONFIG_SLIMBUS) 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1298 if (dev->parent->bus == &slimbus_bus) { 5bd773242f75da Jonathan Marek 2020-09-05 1299 #else 5bd773242f75da Jonathan Marek 2020-09-05 1300 if (false) { 5bd773242f75da Jonathan Marek 2020-09-05 1301 #endif d1df23fe688b58 Jonathan Marek 2020-09-05 1302 ctrl->reg_read = qcom_swrm_ahb_reg_read; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1303 ctrl->reg_write = qcom_swrm_ahb_reg_write; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1304 ctrl->regmap = dev_get_regmap(dev->parent, NULL); 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1305 if (!ctrl->regmap) 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1306 return -EINVAL; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1307 } else { 82f5c70c26511b Jonathan Marek 2020-09-05 1308 ctrl->reg_read = qcom_swrm_cpu_reg_read; 82f5c70c26511b Jonathan Marek 2020-09-05 1309 ctrl->reg_write = qcom_swrm_cpu_reg_write; 82f5c70c26511b Jonathan Marek 2020-09-05 1310 ctrl->mmio = devm_platform_ioremap_resource(pdev, 0); 82f5c70c26511b Jonathan Marek 2020-09-05 1311 if (IS_ERR(ctrl->mmio)) 82f5c70c26511b Jonathan Marek 2020-09-05 1312 return PTR_ERR(ctrl->mmio); 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1313 } 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1314 1fd0d85affe4d6 Srinivasa Rao Mandadapu 2022-07-01 1315 if (data->sw_clk_gate_required) { 1fd0d85affe4d6 Srinivasa Rao Mandadapu 2022-07-01 1316 ctrl->audio_cgcr = devm_reset_control_get_exclusive(dev, "swr_audio_cgcr"); 1fd0d85affe4d6 Srinivasa Rao Mandadapu 2022-07-01 1317 if (IS_ERR_OR_NULL(ctrl->audio_cgcr)) { 1fd0d85affe4d6 Srinivasa Rao Mandadapu 2022-07-01 1318 dev_err(dev, "Failed to get cgcr reset ctrl required for SW gating\n"); 1fd0d85affe4d6 Srinivasa Rao Mandadapu 2022-07-01 @1319 ret = PTR_ERR(ctrl->audio_cgcr); 1fd0d85affe4d6 Srinivasa Rao Mandadapu 2022-07-01 1320 goto err_init; 1fd0d85affe4d6 Srinivasa Rao Mandadapu 2022-07-01 1321 } 1fd0d85affe4d6 Srinivasa Rao Mandadapu 2022-07-01 1322 } 1fd0d85affe4d6 Srinivasa Rao Mandadapu 2022-07-01 1323 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1324 ctrl->irq = of_irq_get(dev->of_node, 0); 91b5cfc0209b63 Pierre-Louis Bossart 2020-04-30 1325 if (ctrl->irq < 0) { 91b5cfc0209b63 Pierre-Louis Bossart 2020-04-30 1326 ret = ctrl->irq; 91b5cfc0209b63 Pierre-Louis Bossart 2020-04-30 1327 goto err_init; 91b5cfc0209b63 Pierre-Louis Bossart 2020-04-30 1328 } 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1329 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1330 ctrl->hclk = devm_clk_get(dev, "iface"); 91b5cfc0209b63 Pierre-Louis Bossart 2020-04-30 1331 if (IS_ERR(ctrl->hclk)) { 91b5cfc0209b63 Pierre-Louis Bossart 2020-04-30 1332 ret = PTR_ERR(ctrl->hclk); 91b5cfc0209b63 Pierre-Louis Bossart 2020-04-30 1333 goto err_init; 91b5cfc0209b63 Pierre-Louis Bossart 2020-04-30 1334 } 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1335 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1336 clk_prepare_enable(ctrl->hclk); 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1337 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1338 ctrl->dev = dev; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1339 dev_set_drvdata(&pdev->dev, ctrl); 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1340 mutex_init(&ctrl->port_lock); ddea6cf7b619ec Srinivas Kandagatla 2021-03-30 1341 init_completion(&ctrl->broadcast); 06dd96738d6183 Srinivas Kandagatla 2021-03-30 1342 init_completion(&ctrl->enumeration); 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1343 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1344 ctrl->bus.ops = &qcom_swrm_ops; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1345 ctrl->bus.port_ops = &qcom_swrm_port_ops; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1346 ctrl->bus.compute_params = &qcom_swrm_compute_params; 74e79da9fd46a5 Srinivas Kandagatla 2022-02-28 1347 ctrl->bus.clk_stop_timeout = 300; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1348 33ba0178888966 Srinivasa Rao Mandadapu 2022-05-18 1349 ctrl->audio_cgcr = devm_reset_control_get_exclusive(dev, "swr_audio_cgcr"); 33ba0178888966 Srinivasa Rao Mandadapu 2022-05-18 1350 if (IS_ERR(ctrl->audio_cgcr)) 33ba0178888966 Srinivasa Rao Mandadapu 2022-05-18 1351 dev_err(dev, "Failed to get audio_cgcr reset required for soundwire-v1.6.0\n"); 33ba0178888966 Srinivasa Rao Mandadapu 2022-05-18 1352 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1353 ret = qcom_swrm_get_port_config(ctrl); 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1354 if (ret) 91b5cfc0209b63 Pierre-Louis Bossart 2020-04-30 1355 goto err_clk; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1356 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1357 params = &ctrl->bus.params; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1358 params->max_dr_freq = DEFAULT_CLK_FREQ; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1359 params->curr_dr_freq = DEFAULT_CLK_FREQ; 8cb3b4e74cd810 Srinivas Kandagatla 2020-09-17 1360 params->col = data->default_cols; 8cb3b4e74cd810 Srinivas Kandagatla 2020-09-17 1361 params->row = data->default_rows; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1362 ctrl->reg_read(ctrl, SWRM_MCP_STATUS, &val); 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1363 params->curr_bank = val & SWRM_MCP_STATUS_BANK_NUM_MASK; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1364 params->next_bank = !params->curr_bank; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1365 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1366 prop = &ctrl->bus.prop; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1367 prop->max_clk_freq = DEFAULT_CLK_FREQ; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1368 prop->num_clk_gears = 0; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1369 prop->num_clk_freq = MAX_FREQ_NUM; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1370 prop->clk_freq = &qcom_swrm_freq_tbl[0]; 8cb3b4e74cd810 Srinivas Kandagatla 2020-09-17 1371 prop->default_col = data->default_cols; 8cb3b4e74cd810 Srinivas Kandagatla 2020-09-17 1372 prop->default_row = data->default_rows; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1373 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1374 ctrl->reg_read(ctrl, SWRM_COMP_HW_VERSION, &ctrl->version); 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1375 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1376 ret = devm_request_threaded_irq(dev, ctrl->irq, NULL, 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1377 qcom_swrm_irq_handler, 4f1738f4c24b44 Samuel Zou 2020-05-06 1378 IRQF_TRIGGER_RISING | 4f1738f4c24b44 Samuel Zou 2020-05-06 1379 IRQF_ONESHOT, 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1380 "soundwire", ctrl); 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1381 if (ret) { 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1382 dev_err(dev, "Failed to request soundwire irq\n"); 91b5cfc0209b63 Pierre-Louis Bossart 2020-04-30 1383 goto err_clk; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1384 } 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1385 04d46a7b38375a Srinivas Kandagatla 2022-02-28 1386 ctrl->wake_irq = of_irq_get(dev->of_node, 1); 04d46a7b38375a Srinivas Kandagatla 2022-02-28 1387 if (ctrl->wake_irq > 0) { 04d46a7b38375a Srinivas Kandagatla 2022-02-28 1388 ret = devm_request_threaded_irq(dev, ctrl->wake_irq, NULL, 04d46a7b38375a Srinivas Kandagatla 2022-02-28 1389 qcom_swrm_wake_irq_handler, 04d46a7b38375a Srinivas Kandagatla 2022-02-28 1390 IRQF_TRIGGER_HIGH | IRQF_ONESHOT, 04d46a7b38375a Srinivas Kandagatla 2022-02-28 1391 "swr_wake_irq", ctrl); 04d46a7b38375a Srinivas Kandagatla 2022-02-28 1392 if (ret) { 04d46a7b38375a Srinivas Kandagatla 2022-02-28 1393 dev_err(dev, "Failed to request soundwire wake irq\n"); 04d46a7b38375a Srinivas Kandagatla 2022-02-28 1394 goto err_init; 04d46a7b38375a Srinivas Kandagatla 2022-02-28 1395 } 04d46a7b38375a Srinivas Kandagatla 2022-02-28 1396 } 04d46a7b38375a Srinivas Kandagatla 2022-02-28 1397 5cab3ff2489ede Pierre-Louis Bossart 2020-05-19 1398 ret = sdw_bus_master_add(&ctrl->bus, dev, dev->fwnode); 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1399 if (ret) { 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1400 dev_err(dev, "Failed to register Soundwire controller (%d)\n", 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1401 ret); 91b5cfc0209b63 Pierre-Louis Bossart 2020-04-30 1402 goto err_clk; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1403 } 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1404 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1405 qcom_swrm_init(ctrl); 06dd96738d6183 Srinivas Kandagatla 2021-03-30 1406 wait_for_completion_timeout(&ctrl->enumeration, 06dd96738d6183 Srinivas Kandagatla 2021-03-30 1407 msecs_to_jiffies(TIMEOUT_MS)); 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1408 ret = qcom_swrm_register_dais(ctrl); 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1409 if (ret) 91b5cfc0209b63 Pierre-Louis Bossart 2020-04-30 1410 goto err_master_add; 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1411 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1412 dev_info(dev, "Qualcomm Soundwire controller v%x.%x.%x Registered\n", 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1413 (ctrl->version >> 24) & 0xff, (ctrl->version >> 16) & 0xff, 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1414 ctrl->version & 0xffff); 02efb49aa805ce Srinivas Kandagatla 2020-01-13 1415 74e79da9fd46a5 Srinivas Kandagatla 2022-02-28 1416 pm_runtime_set_autosuspend_delay(dev, 3000); 74e79da9fd46a5 Srinivas Kandagatla 2022-02-28 1417 pm_runtime_use_autosuspend(dev); 74e79da9fd46a5 Srinivas Kandagatla 2022-02-28 1418 pm_runtime_mark_last_busy(dev); 74e79da9fd46a5 Srinivas Kandagatla 2022-02-28 1419 pm_runtime_set_active(dev); 74e79da9fd46a5 Srinivas Kandagatla 2022-02-28 1420 pm_runtime_enable(dev); 74e79da9fd46a5 Srinivas Kandagatla 2022-02-28 1421 74e79da9fd46a5 Srinivas Kandagatla 2022-02-28 1422 /* Clk stop is not supported on WSA Soundwire masters */ 74e79da9fd46a5 Srinivas Kandagatla 2022-02-28 1423 if (ctrl->version <= 0x01030000) { 74e79da9fd46a5 Srinivas Kandagatla 2022-02-28 1424 ctrl->clock_stop_not_supported = true; 74e79da9fd46a5 Srinivas Kandagatla 2022-02-28 1425 } else { 74e79da9fd46a5 Srinivas Kandagatla 2022-02-28 1426 ctrl->reg_read(ctrl, SWRM_COMP_MASTER_ID, &val); 74e79da9fd46a5 Srinivas Kandagatla 2022-02-28 1427 if (val == MASTER_ID_WSA) 74e79da9fd46a5 Srinivas Kandagatla 2022-02-28 1428 ctrl->clock_stop_not_supported = true; 74e79da9fd46a5 Srinivas Kandagatla 2022-02-28 1429 } 74e79da9fd46a5 Srinivas Kandagatla 2022-02-28 1430 -- 0-DAY CI Kernel Test Service https://01.org/lkp _______________________________________________ kbuild mailing list -- kbuild@lists.01.org To unsubscribe send an email to kbuild-le...@lists.01.org