brintos

brintos / linux-shallow public Read only

0
0
Text · 2.6 KiB · 2b6d8ef Raw
92 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2/*3 *  Copyright (c) 2023 Meta Platforms, Inc. and affiliates4 *  Copyright (c) 2023 Intel and affiliates5 */6 7#ifndef __DPLL_CORE_H__8#define __DPLL_CORE_H__9 10#include <linux/dpll.h>11#include <linux/list.h>12#include <linux/refcount.h>13#include "dpll_nl.h"14 15#define DPLL_REGISTERED		XA_MARK_116 17/**18 * struct dpll_device - stores DPLL device internal data19 * @id:			unique id number for device given by dpll subsystem20 * @device_idx:		id given by dev driver21 * @clock_id:		unique identifier (clock_id) of a dpll22 * @module:		module of creator23 * @type:		type of a dpll24 * @pin_refs:		stores pins registered within a dpll25 * @refcount:		refcount26 * @registration_list:	list of registered ops and priv data of dpll owners27 **/28struct dpll_device {29	u32 id;30	u32 device_idx;31	u64 clock_id;32	struct module *module;33	enum dpll_type type;34	struct xarray pin_refs;35	refcount_t refcount;36	struct list_head registration_list;37};38 39/**40 * struct dpll_pin - structure for a dpll pin41 * @id:			unique id number for pin given by dpll subsystem42 * @pin_idx:		index of a pin given by dev driver43 * @clock_id:		clock_id of creator44 * @module:		module of creator45 * @dpll_refs:		hold referencees to dplls pin was registered with46 * @parent_refs:	hold references to parent pins pin was registered with47 * @prop:		pin properties copied from the registerer48 * @rclk_dev_name:	holds name of device when pin can recover clock from it49 * @refcount:		refcount50 * @rcu:		rcu_head for kfree_rcu()51 **/52struct dpll_pin {53	u32 id;54	u32 pin_idx;55	u64 clock_id;56	struct module *module;57	struct xarray dpll_refs;58	struct xarray parent_refs;59	struct dpll_pin_properties prop;60	refcount_t refcount;61	struct rcu_head rcu;62};63 64/**65 * struct dpll_pin_ref - structure for referencing either dpll or pins66 * @dpll:		pointer to a dpll67 * @pin:		pointer to a pin68 * @registration_list:	list of ops and priv data registered with the ref69 * @refcount:		refcount70 **/71struct dpll_pin_ref {72	union {73		struct dpll_device *dpll;74		struct dpll_pin *pin;75	};76	struct list_head registration_list;77	refcount_t refcount;78};79 80void *dpll_priv(struct dpll_device *dpll);81void *dpll_pin_on_dpll_priv(struct dpll_device *dpll, struct dpll_pin *pin);82void *dpll_pin_on_pin_priv(struct dpll_pin *parent, struct dpll_pin *pin);83 84const struct dpll_device_ops *dpll_device_ops(struct dpll_device *dpll);85struct dpll_device *dpll_device_get_by_id(int id);86const struct dpll_pin_ops *dpll_pin_ops(struct dpll_pin_ref *ref);87struct dpll_pin_ref *dpll_xa_ref_dpll_first(struct xarray *xa_refs);88extern struct xarray dpll_device_xa;89extern struct xarray dpll_pin_xa;90extern struct mutex dpll_lock;91#endif92