cregit-Linux how code gets into the kernel

Release 4.11 drivers/gpu/drm/omapdrm/dss/hdmi_wp.c

/*
 * HDMI wrapper
 *
 * Copyright (C) 2013 Texas Instruments Incorporated
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published by
 * the Free Software Foundation.
 */


#define DSS_SUBSYS_NAME "HDMIWP"

#include <linux/kernel.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/seq_file.h>

#include "omapdss.h"
#include "dss.h"
#include "hdmi.h"


void hdmi_wp_dump(struct hdmi_wp_data *wp, struct seq_file *s) { #define DUMPREG(r) seq_printf(s, "%-35s %08x\n", #r, hdmi_read_reg(wp->base, r)) DUMPREG(HDMI_WP_REVISION); DUMPREG(HDMI_WP_SYSCONFIG); DUMPREG(HDMI_WP_IRQSTATUS_RAW); DUMPREG(HDMI_WP_IRQSTATUS); DUMPREG(HDMI_WP_IRQENABLE_SET); DUMPREG(HDMI_WP_IRQENABLE_CLR); DUMPREG(HDMI_WP_IRQWAKEEN); DUMPREG(HDMI_WP_PWR_CTRL); DUMPREG(HDMI_WP_DEBOUNCE); DUMPREG(HDMI_WP_VIDEO_CFG); DUMPREG(HDMI_WP_VIDEO_SIZE); DUMPREG(HDMI_WP_VIDEO_TIMING_H); DUMPREG(HDMI_WP_VIDEO_TIMING_V); DUMPREG(HDMI_WP_CLK); DUMPREG(HDMI_WP_AUDIO_CFG); DUMPREG(HDMI_WP_AUDIO_CFG2); DUMPREG(HDMI_WP_AUDIO_CTRL); DUMPREG(HDMI_WP_AUDIO_DATA); }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja11199.11%150.00%
Tomi Valkeinen10.89%150.00%
Total112100.00%2100.00%


u32 hdmi_wp_get_irqstatus(struct hdmi_wp_data *wp) { return hdmi_read_reg(wp->base, HDMI_WP_IRQSTATUS); }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja20100.00%1100.00%
Total20100.00%1100.00%


void hdmi_wp_set_irqstatus(struct hdmi_wp_data *wp, u32 irqstatus) { hdmi_write_reg(wp->base, HDMI_WP_IRQSTATUS, irqstatus); /* flush posted write */ hdmi_read_reg(wp->base, HDMI_WP_IRQSTATUS); }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja34100.00%1100.00%
Total34100.00%1100.00%


void hdmi_wp_set_irqenable(struct hdmi_wp_data *wp, u32 mask) { hdmi_write_reg(wp->base, HDMI_WP_IRQENABLE_SET, mask); }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja24100.00%1100.00%
Total24100.00%1100.00%


void hdmi_wp_clear_irqenable(struct hdmi_wp_data *wp, u32 mask) { hdmi_write_reg(wp->base, HDMI_WP_IRQENABLE_CLR, mask); }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja24100.00%1100.00%
Total24100.00%1100.00%

/* PHY_PWR_CMD */
int hdmi_wp_set_phy_pwr(struct hdmi_wp_data *wp, enum hdmi_phy_pwr val) { /* Return if already the state */ if (REG_GET(wp->base, HDMI_WP_PWR_CTRL, 5, 4) == val) return 0; /* Command for power control of HDMI PHY */ REG_FLD_MOD(wp->base, HDMI_WP_PWR_CTRL, val, 7, 6); /* Status of the power control of HDMI PHY */ if (hdmi_wait_for_bit_change(wp->base, HDMI_WP_PWR_CTRL, 5, 4, val) != val) { DSSERR("Failed to set PHY power mode to %d\n", val); return -ETIMEDOUT; } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja8698.85%150.00%
Tomi Valkeinen11.15%150.00%
Total87100.00%2100.00%

/* PLL_PWR_CMD */
int hdmi_wp_set_pll_pwr(struct hdmi_wp_data *wp, enum hdmi_pll_pwr val) { /* Command for power control of HDMI PLL */ REG_FLD_MOD(wp->base, HDMI_WP_PWR_CTRL, val, 3, 2); /* wait till PHY_PWR_STATUS is set */ if (hdmi_wait_for_bit_change(wp->base, HDMI_WP_PWR_CTRL, 1, 0, val) != val) { DSSERR("Failed to set PLL_PWR_STATUS\n"); return -ETIMEDOUT; } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja6398.44%150.00%
Tomi Valkeinen11.56%150.00%
Total64100.00%2100.00%


int hdmi_wp_video_start(struct hdmi_wp_data *wp) { REG_FLD_MOD(wp->base, HDMI_WP_VIDEO_CFG, true, 31, 31); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja28100.00%1100.00%
Total28100.00%1100.00%


void hdmi_wp_video_stop(struct hdmi_wp_data *wp) { int i; hdmi_write_reg(wp->base, HDMI_WP_IRQSTATUS, HDMI_IRQ_VIDEO_FRAME_DONE); REG_FLD_MOD(wp->base, HDMI_WP_VIDEO_CFG, false, 31, 31); for (i = 0; i < 50; ++i) { u32 v; msleep(20); v = hdmi_read_reg(wp->base, HDMI_WP_IRQSTATUS_RAW); if (v & HDMI_IRQ_VIDEO_FRAME_DONE) return; } DSSERR("no HDMI FRAMEDONE when disabling output\n"); }

Contributors

PersonTokensPropCommitsCommitProp
Tomi Valkeinen6070.59%150.00%
Archit Taneja2529.41%150.00%
Total85100.00%2100.00%


void hdmi_wp_video_config_format(struct hdmi_wp_data *wp, struct hdmi_video_format *video_fmt) { u32 l = 0; REG_FLD_MOD(wp->base, HDMI_WP_VIDEO_CFG, video_fmt->packing_mode, 10, 8); l |= FLD_VAL(video_fmt->y_res, 31, 16); l |= FLD_VAL(video_fmt->x_res, 15, 0); hdmi_write_reg(wp->base, HDMI_WP_VIDEO_SIZE, l); }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja74100.00%1100.00%
Total74100.00%1100.00%


void hdmi_wp_video_config_interface(struct hdmi_wp_data *wp, struct videomode *vm) { u32 r; bool vsync_pol, hsync_pol; DSSDBG("Enter hdmi_wp_video_config_interface\n"); vsync_pol = !!(vm->flags & DISPLAY_FLAGS_VSYNC_HIGH); hsync_pol = !!(vm->flags & DISPLAY_FLAGS_HSYNC_HIGH); r = hdmi_read_reg(wp->base, HDMI_WP_VIDEO_CFG); r = FLD_MOD(r, vsync_pol, 7, 7); r = FLD_MOD(r, hsync_pol, 6, 6); r = FLD_MOD(r, !!(vm->flags & DISPLAY_FLAGS_INTERLACED), 3, 3); r = FLD_MOD(r, 1, 1, 0); /* HDMI_TIMING_MASTER_24BIT */ hdmi_write_reg(wp->base, HDMI_WP_VIDEO_CFG, r); }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja10880.00%116.67%
Peter Ujfalusi2619.26%466.67%
Tomi Valkeinen10.74%116.67%
Total135100.00%6100.00%


void hdmi_wp_video_config_timing(struct hdmi_wp_data *wp, struct videomode *vm) { u32 timing_h = 0; u32 timing_v = 0; unsigned hsync_len_offset = 1; DSSDBG("Enter hdmi_wp_video_config_timing\n"); /* * On OMAP4 and OMAP5 ES1 the HSW field is programmed as is. On OMAP5 * ES2+ (including DRA7/AM5 SoCs) HSW field is programmed to hsync_len-1. * However, we don't support OMAP5 ES1 at all, so we can just check for * OMAP4 here. */ if (omapdss_get_version() == OMAPDSS_VER_OMAP4430_ES1 || omapdss_get_version() == OMAPDSS_VER_OMAP4430_ES2 || omapdss_get_version() == OMAPDSS_VER_OMAP4) hsync_len_offset = 0; timing_h |= FLD_VAL(vm->hback_porch, 31, 20); timing_h |= FLD_VAL(vm->hfront_porch, 19, 8); timing_h |= FLD_VAL(vm->hsync_len - hsync_len_offset, 7, 0); hdmi_write_reg(wp->base, HDMI_WP_VIDEO_TIMING_H, timing_h); timing_v |= FLD_VAL(vm->vback_porch, 31, 20); timing_v |= FLD_VAL(vm->vfront_porch, 19, 8); timing_v |= FLD_VAL(vm->vsync_len, 7, 0); hdmi_write_reg(wp->base, HDMI_WP_VIDEO_TIMING_V, timing_v); }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja11572.33%19.09%
Tomi Valkeinen2616.35%218.18%
Peter Ujfalusi1811.32%872.73%
Total159100.00%11100.00%


void hdmi_wp_init_vid_fmt_timings(struct hdmi_video_format *video_fmt, struct videomode *vm, struct hdmi_config *param) { DSSDBG("Enter hdmi_wp_video_init_format\n"); video_fmt->packing_mode = HDMI_PACK_10b_RGB_YUV444; video_fmt->y_res = param->vm.vactive; video_fmt->x_res = param->vm.hactive; vm->hback_porch = param->vm.hback_porch; vm->hfront_porch = param->vm.hfront_porch; vm->hsync_len = param->vm.hsync_len; vm->vback_porch = param->vm.vback_porch; vm->vfront_porch = param->vm.vfront_porch; vm->vsync_len = param->vm.vsync_len; vm->flags = param->vm.flags; if (param->vm.flags & DISPLAY_FLAGS_INTERLACED) { video_fmt->y_res /= 2; vm->vback_porch /= 2; vm->vfront_porch /= 2; vm->vsync_len /= 2; } if (param->vm.flags & DISPLAY_FLAGS_DOUBLECLK) { video_fmt->x_res *= 2; vm->hfront_porch *= 2; vm->hsync_len *= 2; vm->hback_porch *= 2; } }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja8141.97%16.67%
Tomi Valkeinen5830.05%213.33%
Peter Ujfalusi5427.98%1280.00%
Total193100.00%15100.00%


void hdmi_wp_audio_config_format(struct hdmi_wp_data *wp, struct hdmi_audio_format *aud_fmt) { u32 r; DSSDBG("Enter hdmi_wp_audio_config_format\n"); r = hdmi_read_reg(wp->base, HDMI_WP_AUDIO_CFG); if (omapdss_get_version() == OMAPDSS_VER_OMAP4430_ES1 || omapdss_get_version() == OMAPDSS_VER_OMAP4430_ES2 || omapdss_get_version() == OMAPDSS_VER_OMAP4) { r = FLD_MOD(r, aud_fmt->stereo_channels, 26, 24); r = FLD_MOD(r, aud_fmt->active_chnnls_msk, 23, 16); } r = FLD_MOD(r, aud_fmt->en_sig_blk_strt_end, 5, 5); r = FLD_MOD(r, aud_fmt->type, 4, 4); r = FLD_MOD(r, aud_fmt->justification, 3, 3); r = FLD_MOD(r, aud_fmt->sample_order, 2, 2); r = FLD_MOD(r, aud_fmt->samples_per_word, 1, 1); r = FLD_MOD(r, aud_fmt->sample_size, 0, 0); hdmi_write_reg(wp->base, HDMI_WP_AUDIO_CFG, r); }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja16589.67%150.00%
Jyri Sarha1910.33%150.00%
Total184100.00%2100.00%


void hdmi_wp_audio_config_dma(struct hdmi_wp_data *wp, struct hdmi_audio_dma *aud_dma) { u32 r; DSSDBG("Enter hdmi_wp_audio_config_dma\n"); r = hdmi_read_reg(wp->base, HDMI_WP_AUDIO_CFG2); r = FLD_MOD(r, aud_dma->transfer_size, 15, 8); r = FLD_MOD(r, aud_dma->block_size, 7, 0); hdmi_write_reg(wp->base, HDMI_WP_AUDIO_CFG2, r); r = hdmi_read_reg(wp->base, HDMI_WP_AUDIO_CTRL); r = FLD_MOD(r, aud_dma->mode, 9, 9); r = FLD_MOD(r, aud_dma->fifo_threshold, 8, 0); hdmi_write_reg(wp->base, HDMI_WP_AUDIO_CTRL, r); }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja127100.00%1100.00%
Total127100.00%1100.00%


int hdmi_wp_audio_enable(struct hdmi_wp_data *wp, bool enable) { REG_FLD_MOD(wp->base, HDMI_WP_AUDIO_CTRL, enable, 31, 31); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja31100.00%1100.00%
Total31100.00%1100.00%


int hdmi_wp_audio_core_req_enable(struct hdmi_wp_data *wp, bool enable) { REG_FLD_MOD(wp->base, HDMI_WP_AUDIO_CTRL, enable, 30, 30); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja31100.00%1100.00%
Total31100.00%1100.00%


int hdmi_wp_init(struct platform_device *pdev, struct hdmi_wp_data *wp) { struct resource *res; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "wp"); if (!res) { DSSERR("can't get WP mem resource\n"); return -EINVAL; } wp->phys_base = res->start; wp->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(wp->base)) { DSSERR("can't ioremap HDMI WP\n"); return PTR_ERR(wp->base); } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja7780.21%120.00%
Tomi Valkeinen1111.46%360.00%
Jyri Sarha88.33%120.00%
Total96100.00%5100.00%


phys_addr_t hdmi_wp_get_audio_dma_addr(struct hdmi_wp_data *wp) { return wp->phys_base + HDMI_WP_AUDIO_DATA; }

Contributors

PersonTokensPropCommitsCommitProp
Jyri Sarha17100.00%1100.00%
Total17100.00%1100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Archit Taneja124780.14%27.41%
Tomi Valkeinen16310.48%829.63%
Peter Ujfalusi996.36%1451.85%
Jyri Sarha442.83%27.41%
Arnd Bergmann30.19%13.70%
Total1556100.00%27100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.