Lines Matching refs:gdev
68 struct hte_device *gdev; member
107 static void hte_chip_dbgfs_init(struct hte_device *gdev) in hte_chip_dbgfs_init() argument
109 const struct hte_chip *chip = gdev->chip; in hte_chip_dbgfs_init()
112 gdev->dbg_root = debugfs_create_dir(name, hte_root); in hte_chip_dbgfs_init()
114 debugfs_create_atomic_t("ts_requested", 0444, gdev->dbg_root, in hte_chip_dbgfs_init()
115 &gdev->ts_req); in hte_chip_dbgfs_init()
116 debugfs_create_u32("total_ts", 0444, gdev->dbg_root, in hte_chip_dbgfs_init()
117 &gdev->nlines); in hte_chip_dbgfs_init()
122 if (!ei->gdev->dbg_root || !name) in hte_ts_dbgfs_init()
125 ei->ts_dbg_root = debugfs_create_dir(name, ei->gdev->dbg_root); in hte_ts_dbgfs_init()
133 static void hte_chip_dbgfs_init(struct hte_device *gdev) in hte_chip_dbgfs_init() argument
156 struct hte_device *gdev; in hte_ts_put() local
164 if (!ei || !ei->gdev) in hte_ts_put()
167 gdev = ei->gdev; in hte_ts_put()
173 dev_info(gdev->sdev, "id:%d is not requested\n", in hte_ts_put()
181 dev_info(gdev->sdev, "id:%d is registered but not requested\n", in hte_ts_put()
195 ret = gdev->chip->ops->release(gdev->chip, desc, ei->xlated_id); in hte_ts_put()
197 dev_err(gdev->sdev, "id: %d free failed\n", in hte_ts_put()
216 atomic_dec(&gdev->ts_req); in hte_ts_put()
230 module_put(gdev->owner); in hte_ts_put()
233 dev_dbg(gdev->sdev, "release id: %d\n", desc->attr.line_id); in hte_ts_put()
242 struct hte_device *gdev; in hte_ts_dis_en_common() local
252 if (!ei || !ei->gdev) in hte_ts_dis_en_common()
255 gdev = ei->gdev; in hte_ts_dis_en_common()
261 dev_dbg(gdev->sdev, "id:%d is not registered", ts_id); in hte_ts_dis_en_common()
275 ret = gdev->chip->ops->enable(gdev->chip, ei->xlated_id); in hte_ts_dis_en_common()
277 dev_warn(gdev->sdev, "id: %d enable failed\n", in hte_ts_dis_en_common()
291 ret = gdev->chip->ops->disable(gdev->chip, ei->xlated_id); in hte_ts_dis_en_common()
293 dev_warn(gdev->sdev, "id: %d disable failed\n", in hte_ts_dis_en_common()
358 struct hte_device *gdev; in __hte_req_ts() local
361 gdev = ei->gdev; in __hte_req_ts()
370 dev_dbg(gdev->chip->dev, "id:%u req failed\n", in __hte_req_ts()
381 ret = gdev->chip->ops->request(gdev->chip, desc, ei->xlated_id); in __hte_req_ts()
383 dev_err(gdev->chip->dev, "ts request failed\n"); in __hte_req_ts()
390 atomic_inc(&gdev->ts_req); in __hte_req_ts()
404 dev_dbg(gdev->chip->dev, "id: %u, xlated id:%u", in __hte_req_ts()
423 dev_dbg(ei->gdev->chip->dev, "id:%u is already requested\n", in hte_bind_ts_info_locked()
441 struct hte_device *gdev; in of_node_to_htedevice() local
445 list_for_each_entry(gdev, &hte_devices, list) in of_node_to_htedevice()
446 if (gdev->chip && gdev->chip->dev && in of_node_to_htedevice()
447 device_match_of_node(gdev->chip->dev, np)) { in of_node_to_htedevice()
449 return gdev; in of_node_to_htedevice()
459 struct hte_device *gdev; in hte_find_dev_from_linedata() local
463 list_for_each_entry(gdev, &hte_devices, list) in hte_find_dev_from_linedata()
464 if (gdev->chip && gdev->chip->match_from_linedata) { in hte_find_dev_from_linedata()
465 if (!gdev->chip->match_from_linedata(gdev->chip, desc)) in hte_find_dev_from_linedata()
468 return gdev; in hte_find_dev_from_linedata()
569 struct hte_device *gdev; in hte_ts_get() local
583 gdev = hte_of_get_dev(dev, desc, index, &args, &free_name); in hte_ts_get()
585 gdev = hte_get_dev(desc); in hte_ts_get()
587 if (IS_ERR(gdev)) { in hte_ts_get()
589 return PTR_ERR(gdev); in hte_ts_get()
592 if (!try_module_get(gdev->owner)) in hte_ts_get()
595 if (!gdev->chip) { in hte_ts_get()
603 if (!gdev->chip->xlate_of) in hte_ts_get()
606 ret = gdev->chip->xlate_of(gdev->chip, &args, in hte_ts_get()
609 if (!gdev->chip->xlate_plat) in hte_ts_get()
612 ret = gdev->chip->xlate_plat(gdev->chip, desc, in hte_ts_get()
619 ei = &gdev->ei[xlated_id]; in hte_ts_get()
630 module_put(gdev->owner); in hte_ts_get()
666 if (!ei || !ei->gdev) in hte_request_ts_ns()
671 dev_err(ei->gdev->chip->dev, in hte_request_ts_ns()
780 if (!ei->gdev || !ei->gdev->chip) in hte_get_clk_src_info()
783 chip = ei->gdev->chip; in hte_get_clk_src_info()
811 if (!chip || !data || !chip->gdev) in hte_push_ts_ns()
817 ei = &chip->gdev->ei[xlated_id]; in hte_push_ts_ns()
847 struct hte_device *gdev; in hte_register_chip() local
858 gdev = kzalloc(struct_size(gdev, ei, chip->nlines), GFP_KERNEL); in hte_register_chip()
859 if (!gdev) in hte_register_chip()
862 gdev->chip = chip; in hte_register_chip()
863 chip->gdev = gdev; in hte_register_chip()
864 gdev->nlines = chip->nlines; in hte_register_chip()
865 gdev->sdev = chip->dev; in hte_register_chip()
868 gdev->ei[i].gdev = gdev; in hte_register_chip()
869 mutex_init(&gdev->ei[i].req_mlock); in hte_register_chip()
870 spin_lock_init(&gdev->ei[i].slock); in hte_register_chip()
874 gdev->owner = chip->dev->driver->owner; in hte_register_chip()
876 gdev->owner = THIS_MODULE; in hte_register_chip()
880 INIT_LIST_HEAD(&gdev->list); in hte_register_chip()
883 list_add_tail(&gdev->list, &hte_devices); in hte_register_chip()
886 hte_chip_dbgfs_init(gdev); in hte_register_chip()
895 struct hte_device *gdev; in hte_unregister_chip() local
900 gdev = chip->gdev; in hte_unregister_chip()
903 list_del(&gdev->list); in hte_unregister_chip()
906 gdev->chip = NULL; in hte_unregister_chip()
909 debugfs_remove_recursive(gdev->dbg_root); in hte_unregister_chip()
910 kfree(gdev); in hte_unregister_chip()