Lines Matching refs:mdp
57 static void mtk_disp_pwm_update_bits(struct mtk_disp_pwm *mdp, u32 offset, in mtk_disp_pwm_update_bits() argument
60 void __iomem *address = mdp->base + offset; in mtk_disp_pwm_update_bits()
72 struct mtk_disp_pwm *mdp = to_mtk_disp_pwm(chip); in mtk_disp_pwm_config() local
87 rate = clk_get_rate(mdp->clk_main); in mtk_disp_pwm_config()
101 err = clk_enable(mdp->clk_main); in mtk_disp_pwm_config()
105 err = clk_enable(mdp->clk_mm); in mtk_disp_pwm_config()
107 clk_disable(mdp->clk_main); in mtk_disp_pwm_config()
111 mtk_disp_pwm_update_bits(mdp, mdp->data->con0, in mtk_disp_pwm_config()
114 mtk_disp_pwm_update_bits(mdp, mdp->data->con1, in mtk_disp_pwm_config()
118 if (mdp->data->has_commit) { in mtk_disp_pwm_config()
119 mtk_disp_pwm_update_bits(mdp, mdp->data->commit, in mtk_disp_pwm_config()
120 mdp->data->commit_mask, in mtk_disp_pwm_config()
121 mdp->data->commit_mask); in mtk_disp_pwm_config()
122 mtk_disp_pwm_update_bits(mdp, mdp->data->commit, in mtk_disp_pwm_config()
123 mdp->data->commit_mask, in mtk_disp_pwm_config()
127 clk_disable(mdp->clk_mm); in mtk_disp_pwm_config()
128 clk_disable(mdp->clk_main); in mtk_disp_pwm_config()
135 struct mtk_disp_pwm *mdp = to_mtk_disp_pwm(chip); in mtk_disp_pwm_enable() local
138 err = clk_enable(mdp->clk_main); in mtk_disp_pwm_enable()
142 err = clk_enable(mdp->clk_mm); in mtk_disp_pwm_enable()
144 clk_disable(mdp->clk_main); in mtk_disp_pwm_enable()
148 mtk_disp_pwm_update_bits(mdp, DISP_PWM_EN, mdp->data->enable_mask, in mtk_disp_pwm_enable()
149 mdp->data->enable_mask); in mtk_disp_pwm_enable()
156 struct mtk_disp_pwm *mdp = to_mtk_disp_pwm(chip); in mtk_disp_pwm_disable() local
158 mtk_disp_pwm_update_bits(mdp, DISP_PWM_EN, mdp->data->enable_mask, in mtk_disp_pwm_disable()
161 clk_disable(mdp->clk_mm); in mtk_disp_pwm_disable()
162 clk_disable(mdp->clk_main); in mtk_disp_pwm_disable()
174 struct mtk_disp_pwm *mdp; in mtk_disp_pwm_probe() local
178 mdp = devm_kzalloc(&pdev->dev, sizeof(*mdp), GFP_KERNEL); in mtk_disp_pwm_probe()
179 if (!mdp) in mtk_disp_pwm_probe()
182 mdp->data = of_device_get_match_data(&pdev->dev); in mtk_disp_pwm_probe()
185 mdp->base = devm_ioremap_resource(&pdev->dev, r); in mtk_disp_pwm_probe()
186 if (IS_ERR(mdp->base)) in mtk_disp_pwm_probe()
187 return PTR_ERR(mdp->base); in mtk_disp_pwm_probe()
189 mdp->clk_main = devm_clk_get(&pdev->dev, "main"); in mtk_disp_pwm_probe()
190 if (IS_ERR(mdp->clk_main)) in mtk_disp_pwm_probe()
191 return PTR_ERR(mdp->clk_main); in mtk_disp_pwm_probe()
193 mdp->clk_mm = devm_clk_get(&pdev->dev, "mm"); in mtk_disp_pwm_probe()
194 if (IS_ERR(mdp->clk_mm)) in mtk_disp_pwm_probe()
195 return PTR_ERR(mdp->clk_mm); in mtk_disp_pwm_probe()
197 ret = clk_prepare(mdp->clk_main); in mtk_disp_pwm_probe()
201 ret = clk_prepare(mdp->clk_mm); in mtk_disp_pwm_probe()
205 mdp->chip.dev = &pdev->dev; in mtk_disp_pwm_probe()
206 mdp->chip.ops = &mtk_disp_pwm_ops; in mtk_disp_pwm_probe()
207 mdp->chip.base = -1; in mtk_disp_pwm_probe()
208 mdp->chip.npwm = 1; in mtk_disp_pwm_probe()
210 ret = pwmchip_add(&mdp->chip); in mtk_disp_pwm_probe()
216 platform_set_drvdata(pdev, mdp); in mtk_disp_pwm_probe()
222 if (!mdp->data->has_commit) { in mtk_disp_pwm_probe()
223 mtk_disp_pwm_update_bits(mdp, mdp->data->bls_debug, in mtk_disp_pwm_probe()
224 mdp->data->bls_debug_mask, in mtk_disp_pwm_probe()
225 mdp->data->bls_debug_mask); in mtk_disp_pwm_probe()
226 mtk_disp_pwm_update_bits(mdp, mdp->data->con0, in mtk_disp_pwm_probe()
227 mdp->data->con0_sel, in mtk_disp_pwm_probe()
228 mdp->data->con0_sel); in mtk_disp_pwm_probe()
234 clk_unprepare(mdp->clk_mm); in mtk_disp_pwm_probe()
236 clk_unprepare(mdp->clk_main); in mtk_disp_pwm_probe()
242 struct mtk_disp_pwm *mdp = platform_get_drvdata(pdev); in mtk_disp_pwm_remove() local
245 ret = pwmchip_remove(&mdp->chip); in mtk_disp_pwm_remove()
246 clk_unprepare(mdp->clk_mm); in mtk_disp_pwm_remove()
247 clk_unprepare(mdp->clk_main); in mtk_disp_pwm_remove()