Lines Matching full:mic
30 /* Sysreg registers for MIC */
36 /* MIC registers */
109 static void mic_set_path(struct exynos_mic *mic, bool enable) in mic_set_path() argument
114 ret = regmap_read(mic->sysreg, DSD_CFG_MUX, &val); in mic_set_path()
116 DRM_DEV_ERROR(mic->dev, in mic_set_path()
117 "mic: Failed to read system register\n"); in mic_set_path()
122 if (mic->i80_mode) in mic_set_path()
131 ret = regmap_write(mic->sysreg, DSD_CFG_MUX, val); in mic_set_path()
133 DRM_DEV_ERROR(mic->dev, in mic_set_path()
134 "mic: Failed to read system register\n"); in mic_set_path()
137 static int mic_sw_reset(struct exynos_mic *mic) in mic_sw_reset() argument
142 writel(MIC_SW_RST, mic->reg + MIC_OP); in mic_sw_reset()
145 ret = readl(mic->reg + MIC_OP); in mic_sw_reset()
155 static void mic_set_porch_timing(struct exynos_mic *mic) in mic_set_porch_timing() argument
157 struct videomode vm = mic->vm; in mic_set_porch_timing()
163 writel(reg, mic->reg + MIC_V_TIMING_0); in mic_set_porch_timing()
167 writel(reg, mic->reg + MIC_V_TIMING_1); in mic_set_porch_timing()
172 writel(reg, mic->reg + MIC_INPUT_TIMING_0); in mic_set_porch_timing()
176 writel(reg, mic->reg + MIC_INPUT_TIMING_1); in mic_set_porch_timing()
179 static void mic_set_img_size(struct exynos_mic *mic) in mic_set_img_size() argument
181 struct videomode *vm = &mic->vm; in mic_set_img_size()
187 writel(reg, mic->reg + MIC_IMG_SIZE); in mic_set_img_size()
190 static void mic_set_output_timing(struct exynos_mic *mic) in mic_set_output_timing() argument
192 struct videomode vm = mic->vm; in mic_set_output_timing()
195 DRM_DEV_DEBUG(mic->dev, "w: %u, h: %u\n", vm.hactive, vm.vactive); in mic_set_output_timing()
198 writel(reg, mic->reg + MIC_2D_OUTPUT_TIMING_2); in mic_set_output_timing()
200 if (!mic->i80_mode) { in mic_set_output_timing()
204 writel(reg, mic->reg + MIC_2D_OUTPUT_TIMING_0); in mic_set_output_timing()
208 writel(reg, mic->reg + MIC_2D_OUTPUT_TIMING_1); in mic_set_output_timing()
212 static void mic_set_reg_on(struct exynos_mic *mic, bool enable) in mic_set_reg_on() argument
214 u32 reg = readl(mic->reg + MIC_OP); in mic_set_reg_on()
221 if (mic->i80_mode) in mic_set_reg_on()
228 writel(reg, mic->reg + MIC_OP); in mic_set_reg_on()
235 struct exynos_mic *mic = bridge->driver_private; in mic_post_disable() local
238 if (!mic->enabled) in mic_post_disable()
241 mic_set_path(mic, 0); in mic_post_disable()
243 pm_runtime_put(mic->dev); in mic_post_disable()
244 mic->enabled = 0; in mic_post_disable()
254 struct exynos_mic *mic = bridge->driver_private; in mic_mode_set() local
257 drm_display_mode_to_videomode(mode, &mic->vm); in mic_mode_set()
258 mic->i80_mode = to_exynos_crtc(bridge->encoder->crtc)->i80_mode; in mic_mode_set()
264 struct exynos_mic *mic = bridge->driver_private; in mic_pre_enable() local
268 if (mic->enabled) in mic_pre_enable()
271 ret = pm_runtime_get_sync(mic->dev); in mic_pre_enable()
273 pm_runtime_put_noidle(mic->dev); in mic_pre_enable()
277 mic_set_path(mic, 1); in mic_pre_enable()
279 ret = mic_sw_reset(mic); in mic_pre_enable()
281 DRM_DEV_ERROR(mic->dev, "Failed to reset\n"); in mic_pre_enable()
285 if (!mic->i80_mode) in mic_pre_enable()
286 mic_set_porch_timing(mic); in mic_pre_enable()
287 mic_set_img_size(mic); in mic_pre_enable()
288 mic_set_output_timing(mic); in mic_pre_enable()
289 mic_set_reg_on(mic, 1); in mic_pre_enable()
290 mic->enabled = 1; in mic_pre_enable()
296 pm_runtime_put(mic->dev); in mic_pre_enable()
314 struct exynos_mic *mic = dev_get_drvdata(dev); in exynos_mic_bind() local
316 mic->bridge.driver_private = mic; in exynos_mic_bind()
324 struct exynos_mic *mic = dev_get_drvdata(dev); in exynos_mic_unbind() local
327 if (!mic->enabled) in exynos_mic_unbind()
330 pm_runtime_put(mic->dev); in exynos_mic_unbind()
344 struct exynos_mic *mic = dev_get_drvdata(dev); in exynos_mic_suspend() local
348 clk_disable_unprepare(mic->clks[i]); in exynos_mic_suspend()
355 struct exynos_mic *mic = dev_get_drvdata(dev); in exynos_mic_resume() local
359 ret = clk_prepare_enable(mic->clks[i]); in exynos_mic_resume()
364 clk_disable_unprepare(mic->clks[i]); in exynos_mic_resume()
381 struct exynos_mic *mic; in exynos_mic_probe() local
385 mic = devm_kzalloc(dev, sizeof(*mic), GFP_KERNEL); in exynos_mic_probe()
386 if (!mic) { in exynos_mic_probe()
388 "mic: Failed to allocate memory for MIC object\n"); in exynos_mic_probe()
393 mic->dev = dev; in exynos_mic_probe()
397 DRM_DEV_ERROR(dev, "mic: Failed to get mem region for MIC\n"); in exynos_mic_probe()
400 mic->reg = devm_ioremap(dev, res.start, resource_size(&res)); in exynos_mic_probe()
401 if (!mic->reg) { in exynos_mic_probe()
402 DRM_DEV_ERROR(dev, "mic: Failed to remap for MIC\n"); in exynos_mic_probe()
407 mic->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node, in exynos_mic_probe()
409 if (IS_ERR(mic->sysreg)) { in exynos_mic_probe()
410 DRM_DEV_ERROR(dev, "mic: Failed to get system register.\n"); in exynos_mic_probe()
411 ret = PTR_ERR(mic->sysreg); in exynos_mic_probe()
416 mic->clks[i] = devm_clk_get(dev, clk_names[i]); in exynos_mic_probe()
417 if (IS_ERR(mic->clks[i])) { in exynos_mic_probe()
418 DRM_DEV_ERROR(dev, "mic: Failed to get clock (%s)\n", in exynos_mic_probe()
420 ret = PTR_ERR(mic->clks[i]); in exynos_mic_probe()
425 platform_set_drvdata(pdev, mic); in exynos_mic_probe()
427 mic->bridge.funcs = &mic_bridge_funcs; in exynos_mic_probe()
428 mic->bridge.of_node = dev->of_node; in exynos_mic_probe()
430 drm_bridge_add(&mic->bridge); in exynos_mic_probe()
438 DRM_DEV_DEBUG_KMS(dev, "MIC has been probed\n"); in exynos_mic_probe()
450 struct exynos_mic *mic = platform_get_drvdata(pdev); in exynos_mic_remove() local
455 drm_bridge_remove(&mic->bridge); in exynos_mic_remove()
461 { .compatible = "samsung,exynos5433-mic" },
470 .name = "exynos-mic",