Lines Matching refs:hdev
117 void hdmi_write(struct hdmi_device *hdev, u32 reg_id, u32 value) in hdmi_write() argument
119 writel(value, hdev->regs + reg_id); in hdmi_write()
123 void hdmi_write_mask(struct hdmi_device *hdev, u32 reg_id, u32 value, u32 mask) in hdmi_write_mask() argument
125 u32 old = readl(hdev->regs + reg_id); in hdmi_write_mask()
127 writel(value, hdev->regs + reg_id); in hdmi_write_mask()
131 void hdmi_writeb(struct hdmi_device *hdev, u32 reg_id, u8 value) in hdmi_writeb() argument
133 writeb(value, hdev->regs + reg_id); in hdmi_writeb()
137 void hdmi_writebn(struct hdmi_device *hdev, u32 reg_id, int n, u32 value) in hdmi_writebn() argument
141 writeb(value >> 24, hdev->regs + reg_id + 12); in hdmi_writebn()
143 writeb(value >> 16, hdev->regs + reg_id + 8); in hdmi_writebn()
145 writeb(value >> 8, hdev->regs + reg_id + 4); in hdmi_writebn()
147 writeb(value >> 0, hdev->regs + reg_id + 0); in hdmi_writebn()
151 static inline u32 hdmi_read(struct hdmi_device *hdev, u32 reg_id) in hdmi_read() argument
153 return readl(hdev->regs + reg_id); in hdmi_read()
158 struct hdmi_device *hdev = dev_data; in hdmi_irq_handler() local
162 intc_flag = hdmi_read(hdev, HDMI_INTC_FLAG); in hdmi_irq_handler()
166 hdmi_write_mask(hdev, HDMI_INTC_FLAG, ~0, in hdmi_irq_handler()
171 hdmi_write_mask(hdev, HDMI_INTC_FLAG, ~0, in hdmi_irq_handler()
178 static void hdmi_reg_init(struct hdmi_device *hdev) in hdmi_reg_init() argument
181 hdmi_write_mask(hdev, HDMI_INTC_CON, ~0, HDMI_INTC_EN_GLOBAL | in hdmi_reg_init()
184 hdmi_write_mask(hdev, HDMI_MODE_SEL, in hdmi_reg_init()
186 hdmi_write_mask(hdev, HDMI_CON_2, ~0, in hdmi_reg_init()
189 hdmi_write_mask(hdev, HDMI_CON_0, 0, HDMI_BLUE_SCR_EN); in hdmi_reg_init()
191 hdmi_writeb(hdev, HDMI_BLUE_SCREEN_0, 0x12); in hdmi_reg_init()
192 hdmi_writeb(hdev, HDMI_BLUE_SCREEN_1, 0x34); in hdmi_reg_init()
193 hdmi_writeb(hdev, HDMI_BLUE_SCREEN_2, 0x56); in hdmi_reg_init()
196 static void hdmi_timing_apply(struct hdmi_device *hdev, in hdmi_timing_apply() argument
200 hdmi_writebn(hdev, HDMI_H_BLANK_0, 2, t->hact.beg); in hdmi_timing_apply()
201 hdmi_writebn(hdev, HDMI_H_SYNC_GEN_0, 3, in hdmi_timing_apply()
203 hdmi_writeb(hdev, HDMI_VSYNC_POL, t->vsyn_pol); in hdmi_timing_apply()
204 hdmi_writebn(hdev, HDMI_V_BLANK_0, 3, in hdmi_timing_apply()
206 hdmi_writebn(hdev, HDMI_V_SYNC_GEN_1_0, 3, in hdmi_timing_apply()
211 hdmi_writeb(hdev, HDMI_INT_PRO_MODE, 1); in hdmi_timing_apply()
212 hdmi_writebn(hdev, HDMI_H_V_LINE_0, 3, in hdmi_timing_apply()
214 hdmi_writebn(hdev, HDMI_V_BLANK_F_0, 3, in hdmi_timing_apply()
216 hdmi_writebn(hdev, HDMI_V_SYNC_GEN_2_0, 3, in hdmi_timing_apply()
218 hdmi_writebn(hdev, HDMI_V_SYNC_GEN_3_0, 3, in hdmi_timing_apply()
221 hdmi_writeb(hdev, HDMI_INT_PRO_MODE, 0); in hdmi_timing_apply()
222 hdmi_writebn(hdev, HDMI_H_V_LINE_0, 3, in hdmi_timing_apply()
227 hdmi_writebn(hdev, HDMI_TG_H_FSZ_L, 2, t->hact.end); in hdmi_timing_apply()
228 hdmi_writebn(hdev, HDMI_TG_HACT_ST_L, 2, t->hact.beg); in hdmi_timing_apply()
229 hdmi_writebn(hdev, HDMI_TG_HACT_SZ_L, 2, t->hact.end - t->hact.beg); in hdmi_timing_apply()
230 hdmi_writebn(hdev, HDMI_TG_VSYNC_L, 2, t->vsyn[0].beg); in hdmi_timing_apply()
231 hdmi_writebn(hdev, HDMI_TG_VACT_ST_L, 2, t->vact[0].beg); in hdmi_timing_apply()
232 hdmi_writebn(hdev, HDMI_TG_VACT_SZ_L, 2, in hdmi_timing_apply()
234 hdmi_writebn(hdev, HDMI_TG_VSYNC_TOP_HDMI_L, 2, t->vsyn[0].beg); in hdmi_timing_apply()
235 hdmi_writebn(hdev, HDMI_TG_FIELD_TOP_HDMI_L, 2, t->vsyn[0].beg); in hdmi_timing_apply()
237 hdmi_write_mask(hdev, HDMI_TG_CMD, ~0, HDMI_TG_FIELD_EN); in hdmi_timing_apply()
238 hdmi_writebn(hdev, HDMI_TG_V_FSZ_L, 2, t->vact[1].end); in hdmi_timing_apply()
239 hdmi_writebn(hdev, HDMI_TG_VSYNC2_L, 2, t->vsyn[1].beg); in hdmi_timing_apply()
240 hdmi_writebn(hdev, HDMI_TG_FIELD_CHG_L, 2, t->vact[0].end); in hdmi_timing_apply()
241 hdmi_writebn(hdev, HDMI_TG_VACT_ST2_L, 2, t->vact[1].beg); in hdmi_timing_apply()
242 hdmi_writebn(hdev, HDMI_TG_VSYNC_BOT_HDMI_L, 2, t->vsyn[1].beg); in hdmi_timing_apply()
243 hdmi_writebn(hdev, HDMI_TG_FIELD_BOT_HDMI_L, 2, t->vsyn[1].beg); in hdmi_timing_apply()
245 hdmi_write_mask(hdev, HDMI_TG_CMD, 0, HDMI_TG_FIELD_EN); in hdmi_timing_apply()
246 hdmi_writebn(hdev, HDMI_TG_V_FSZ_L, 2, t->vact[0].end); in hdmi_timing_apply()
292 static void hdmi_dumpregs(struct hdmi_device *hdev, char *prefix) in hdmi_dumpregs() argument
295 dev_dbg(hdev->dev, "%s:" #reg_id " = %08x\n", prefix, \ in hdmi_dumpregs()
296 readl(hdev->regs + reg_id)) in hdmi_dumpregs()
298 dev_dbg(hdev->dev, "%s: ---- CONTROL REGISTERS ----\n", prefix); in hdmi_dumpregs()
307 dev_dbg(hdev->dev, "%s: ---- CORE REGISTERS ----\n", prefix); in hdmi_dumpregs()
320 dev_dbg(hdev->dev, "%s: ---- CORE SYNC REGISTERS ----\n", prefix); in hdmi_dumpregs()
347 dev_dbg(hdev->dev, "%s: ---- TG REGISTERS ----\n", prefix); in hdmi_dumpregs()
496 static int hdmi_streamon(struct hdmi_device *hdev) in hdmi_streamon() argument
498 struct device *dev = hdev->dev; in hdmi_streamon()
499 struct hdmi_resources *res = &hdev->res; in hdmi_streamon()
504 ret = hdmi_conf_apply(hdev); in hdmi_streamon()
508 ret = v4l2_subdev_call(hdev->phy_sd, video, s_stream, 1); in hdmi_streamon()
514 u32 val = hdmi_read(hdev, HDMI_PHY_STATUS); in hdmi_streamon()
522 v4l2_subdev_call(hdev->phy_sd, video, s_stream, 0); in hdmi_streamon()
523 hdmi_dumpregs(hdev, "hdmiphy - s_stream"); in hdmi_streamon()
528 ret = v4l2_subdev_call(hdev->mhl_sd, video, s_stream, 1); in hdmi_streamon()
529 if (hdev->mhl_sd && ret) { in hdmi_streamon()
530 v4l2_subdev_call(hdev->phy_sd, video, s_stream, 0); in hdmi_streamon()
531 hdmi_dumpregs(hdev, "mhl - s_stream"); in hdmi_streamon()
541 hdmi_write_mask(hdev, HDMI_CON_0, ~0, HDMI_EN); in hdmi_streamon()
542 hdmi_write_mask(hdev, HDMI_TG_CMD, ~0, HDMI_TG_EN); in hdmi_streamon()
543 hdmi_dumpregs(hdev, "streamon"); in hdmi_streamon()
547 static int hdmi_streamoff(struct hdmi_device *hdev) in hdmi_streamoff() argument
549 struct device *dev = hdev->dev; in hdmi_streamoff()
550 struct hdmi_resources *res = &hdev->res; in hdmi_streamoff()
554 hdmi_write_mask(hdev, HDMI_CON_0, 0, HDMI_EN); in hdmi_streamoff()
555 hdmi_write_mask(hdev, HDMI_TG_CMD, 0, HDMI_TG_EN); in hdmi_streamoff()
562 v4l2_subdev_call(hdev->mhl_sd, video, s_stream, 0); in hdmi_streamoff()
563 v4l2_subdev_call(hdev->phy_sd, video, s_stream, 0); in hdmi_streamoff()
565 hdmi_dumpregs(hdev, "streamoff"); in hdmi_streamoff()
571 struct hdmi_device *hdev = sd_to_hdmi_dev(sd); in hdmi_s_stream() local
572 struct device *dev = hdev->dev; in hdmi_s_stream()
576 return hdmi_streamon(hdev); in hdmi_s_stream()
577 return hdmi_streamoff(hdev); in hdmi_s_stream()
610 struct hdmi_device *hdev = sd_to_hdmi_dev(sd); in hdmi_s_power() local
614 ret = pm_runtime_get_sync(hdev->dev); in hdmi_s_power()
616 ret = pm_runtime_put_sync(hdev->dev); in hdmi_s_power()
624 struct hdmi_device *hdev = sd_to_hdmi_dev(sd); in hdmi_s_dv_timings() local
625 struct device *dev = hdev->dev; in hdmi_s_dv_timings()
636 hdev->cur_conf = hdmi_timings[i].hdmi_timings; in hdmi_s_dv_timings()
637 hdev->cur_conf_dirty = 1; in hdmi_s_dv_timings()
638 hdev->cur_timings = *timings; in hdmi_s_dv_timings()
640 hdev->cur_timings.bt.flags &= ~V4L2_DV_FL_CAN_REDUCE_FPS; in hdmi_s_dv_timings()
656 struct hdmi_device *hdev = sd_to_hdmi_dev(sd); in hdmi_get_fmt() local
657 const struct hdmi_timings *t = hdev->cur_conf; in hdmi_get_fmt()
659 dev_dbg(hdev->dev, "%s\n", __func__); in hdmi_get_fmt()
660 if (!hdev->cur_conf) in hdmi_get_fmt()
695 struct hdmi_device *hdev = sd_to_hdmi_dev(sd); in hdmi_dv_timings_cap() local
701 v4l2_subdev_call(hdev->phy_sd, pad, dv_timings_cap, cap); in hdmi_dv_timings_cap()
738 struct hdmi_device *hdev = sd_to_hdmi_dev(sd); in hdmi_runtime_suspend() local
741 v4l2_subdev_call(hdev->mhl_sd, core, s_power, 0); in hdmi_runtime_suspend()
742 hdmi_resource_poweroff(&hdev->res); in hdmi_runtime_suspend()
744 hdev->cur_conf_dirty = 1; in hdmi_runtime_suspend()
751 struct hdmi_device *hdev = sd_to_hdmi_dev(sd); in hdmi_runtime_resume() local
756 ret = hdmi_resource_poweron(&hdev->res); in hdmi_runtime_resume()
761 ret = v4l2_subdev_call(hdev->mhl_sd, core, s_power, 1); in hdmi_runtime_resume()
762 if (hdev->mhl_sd && ret) in hdmi_runtime_resume()
770 hdmi_resource_poweroff(&hdev->res); in hdmi_runtime_resume()
790 static void hdmi_resources_cleanup(struct hdmi_device *hdev) in hdmi_resources_cleanup() argument
792 struct hdmi_resources *res = &hdev->res; in hdmi_resources_cleanup()
794 dev_dbg(hdev->dev, "HDMI resource cleanup\n"); in hdmi_resources_cleanup()
814 static int hdmi_resources_init(struct hdmi_device *hdev) in hdmi_resources_init() argument
816 struct device *dev = hdev->dev; in hdmi_resources_init()
817 struct hdmi_resources *res = &hdev->res; in hdmi_resources_init()
878 hdmi_resources_cleanup(hdev); in hdmi_resources_init()