Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

media: rkvdec: Enable all clocks without naming them

For other variants, the clock names and number will differ.

There is no need to keep track of the clock names in the driver so drop
them to avoid having a list for each variant.

Tested-by: Diederik de Haas <didi.debian@cknow.org> # Rock 5B
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Detlev Casanova and committed by
Hans Verkuil
6a846f7d f9c7b7de

+7 -20
+6 -20
drivers/media/platform/rockchip/rkvdec/rkvdec.c
··· 1312 1312 }; 1313 1313 MODULE_DEVICE_TABLE(of, of_rkvdec_match); 1314 1314 1315 - static const char * const rkvdec_clk_names[] = { 1316 - "axi", "ahb", "cabac", "core" 1317 - }; 1318 - 1319 1315 static int rkvdec_probe(struct platform_device *pdev) 1320 1316 { 1321 1317 const struct rkvdec_variant *variant; 1322 1318 struct rkvdec_dev *rkvdec; 1323 - unsigned int i; 1324 1319 int ret, irq; 1325 1320 1326 1321 variant = of_device_get_match_data(&pdev->dev); ··· 1332 1337 mutex_init(&rkvdec->vdev_lock); 1333 1338 INIT_DELAYED_WORK(&rkvdec->watchdog_work, rkvdec_watchdog_func); 1334 1339 1335 - rkvdec->clocks = devm_kcalloc(&pdev->dev, ARRAY_SIZE(rkvdec_clk_names), 1336 - sizeof(*rkvdec->clocks), GFP_KERNEL); 1337 - if (!rkvdec->clocks) 1338 - return -ENOMEM; 1339 - 1340 - for (i = 0; i < ARRAY_SIZE(rkvdec_clk_names); i++) 1341 - rkvdec->clocks[i].id = rkvdec_clk_names[i]; 1342 - 1343 - ret = devm_clk_bulk_get(&pdev->dev, ARRAY_SIZE(rkvdec_clk_names), 1344 - rkvdec->clocks); 1345 - if (ret) 1340 + ret = devm_clk_bulk_get_all_enabled(&pdev->dev, &rkvdec->clocks); 1341 + if (ret < 0) 1346 1342 return ret; 1343 + 1344 + rkvdec->num_clocks = ret; 1347 1345 1348 1346 rkvdec->regs = devm_platform_ioremap_resource(pdev, 0); 1349 1347 if (IS_ERR(rkvdec->regs)) ··· 1415 1427 { 1416 1428 struct rkvdec_dev *rkvdec = dev_get_drvdata(dev); 1417 1429 1418 - return clk_bulk_prepare_enable(ARRAY_SIZE(rkvdec_clk_names), 1419 - rkvdec->clocks); 1430 + return clk_bulk_prepare_enable(rkvdec->num_clocks, rkvdec->clocks); 1420 1431 } 1421 1432 1422 1433 static int rkvdec_runtime_suspend(struct device *dev) 1423 1434 { 1424 1435 struct rkvdec_dev *rkvdec = dev_get_drvdata(dev); 1425 1436 1426 - clk_bulk_disable_unprepare(ARRAY_SIZE(rkvdec_clk_names), 1427 - rkvdec->clocks); 1437 + clk_bulk_disable_unprepare(rkvdec->num_clocks, rkvdec->clocks); 1428 1438 return 0; 1429 1439 } 1430 1440 #endif
+1
drivers/media/platform/rockchip/rkvdec/rkvdec.h
··· 125 125 struct v4l2_m2m_dev *m2m_dev; 126 126 struct device *dev; 127 127 struct clk_bulk_data *clocks; 128 + unsigned int num_clocks; 128 129 void __iomem *regs; 129 130 struct mutex vdev_lock; /* serializes ioctls */ 130 131 struct delayed_work watchdog_work;