Lines Matching +full:clkdiv +full:- +full:-

1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright (C) 2014-2016 Intel Corporation.
27 unsigned int clkdiv; member
46 return -EINVAL; in pti_width_mode()
54 return scnprintf(buf, PAGE_SIZE, "%d\n", pti_mode[pti->mode]); in mode_show()
72 pti->mode = ret; in mode_store()
85 return scnprintf(buf, PAGE_SIZE, "%d\n", pti->freeclk); in freerunning_clock_show()
100 pti->freeclk = !!val; in freerunning_clock_store()
113 return scnprintf(buf, PAGE_SIZE, "%d\n", 1u << pti->clkdiv); in clock_divider_show()
129 return -EINVAL; in clock_divider_store()
131 pti->clkdiv = val; in clock_divider_store()
151 struct pti_device *pti = dev_get_drvdata(&thdev->dev); in intel_th_pti_activate()
154 if (pti->patgen) in intel_th_pti_activate()
155 ctl |= pti->patgen << __ffs(PTI_PATGENMODE); in intel_th_pti_activate()
156 if (pti->freeclk) in intel_th_pti_activate()
158 ctl |= pti->mode << __ffs(PTI_MODE); in intel_th_pti_activate()
159 ctl |= pti->clkdiv << __ffs(PTI_CLKDIV); in intel_th_pti_activate()
160 ctl |= pti->lpp_dest << __ffs(LPP_DEST); in intel_th_pti_activate()
162 iowrite32(ctl, pti->base + REG_PTI_CTL); in intel_th_pti_activate()
171 struct pti_device *pti = dev_get_drvdata(&thdev->dev); in intel_th_pti_deactivate()
175 iowrite32(0, pti->base + REG_PTI_CTL); in intel_th_pti_deactivate()
180 u32 ctl = ioread32(pti->base + REG_PTI_CTL); in read_hw_config()
182 pti->mode = (ctl & PTI_MODE) >> __ffs(PTI_MODE); in read_hw_config()
183 pti->clkdiv = (ctl & PTI_CLKDIV) >> __ffs(PTI_CLKDIV); in read_hw_config()
184 pti->freeclk = !!(ctl & PTI_FCEN); in read_hw_config()
186 if (!pti_mode[pti->mode]) in read_hw_config()
187 pti->mode = pti_width_mode(4); in read_hw_config()
188 if (!pti->clkdiv) in read_hw_config()
189 pti->clkdiv = 1; in read_hw_config()
191 if (pti->thdev->output.type == GTH_LPP) { in read_hw_config()
193 pti->lpp_dest_mask |= LPP_DEST_PTI; in read_hw_config()
195 pti->lpp_dest_mask |= LPP_DEST_EXI; in read_hw_config()
197 pti->lpp_dest = 1; in read_hw_config()
203 struct device *dev = &thdev->dev; in intel_th_pti_probe()
210 return -ENODEV; in intel_th_pti_probe()
212 base = devm_ioremap(dev, res->start, resource_size(res)); in intel_th_pti_probe()
214 return -ENOMEM; in intel_th_pti_probe()
218 return -ENOMEM; in intel_th_pti_probe()
220 pti->thdev = thdev; in intel_th_pti_probe()
221 pti->base = base; in intel_th_pti_probe()
255 for (i = ARRAY_SIZE(lpp_dest_str) - 1; i >= 0; i--) { in lpp_dest_show()
256 const char *fmt = pti->lpp_dest == i ? "[%s] " : "%s "; in lpp_dest_show()
258 if (!(pti->lpp_dest_mask & BIT(i))) in lpp_dest_show()
261 ret += scnprintf(buf + ret, PAGE_SIZE - ret, in lpp_dest_show()
266 buf[ret - 1] = '\n'; in lpp_dest_show()
281 if (!(pti->lpp_dest_mask & BIT(i))) in lpp_dest_store()
282 return -EINVAL; in lpp_dest_store()
284 pti->lpp_dest = i; in lpp_dest_store()