#ifndef __PHSTBHDMI_H__
#define __PHSTBHDMI_H__

/*****************************************************************************/
/* Copyright (c) 2008 NXP B.V.                                               */
/*                                                                           */
/* This program is free software; you can redistribute it and/or modify      */
/* it under the terms of the GNU General Public License as published by      */
/* the Free Software Foundation, using version 2 of the License.             */
/*                                                                           */
/* This program is distributed in the hope that it will be useful,           */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of            */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the              */
/* GNU General Public License for more details.                              */
/*                                                                           */
/* You should have received a copy of the GNU General Public License         */
/* along with this program; if not, write to the Free Software               */
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307       */
/* USA.                                                                      */
/*                                                                           */
/*****************************************************************************/

/**
    @file   phStbHdmi.h
*//*

Rev Date        Author      Comments
--------------------------------------------------------------------------------
  1 20081002    estarkie     Original
  2 20090129    legendrd     add c++ support
--------------------------------------------------------------------------------
    For consistency and standardisation retain the Section Separators.
*/

#include "tmNxTypes.h"
#include <linux/videodenc.h>

#if defined(__cplusplus)
extern "C" {
#endif

//------------------------------------------------------------------------------
//                              I O C T L ' s  data structures
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
//                              I O C T L ' s  definition
//------------------------------------------------------------------------------

/** The base of phStbHdmi ioctls. */
#define PH_STBHDMI_IOCTL_BASE 			0x83
#define PH_STBHDMI_IOCTL_SET_AUDIO_RATE 	_IOW(PH_STBHDMI_IOCTL_BASE, 0, int)
#define PH_STBHDMI_IOCTL_SET_VIDEO_MODE 	_IOW(PH_STBHDMI_IOCTL_BASE, 1, int)
#define PH_STBHDMI_IOCTL_GET_EDID_BLKCNT 	_IOW(PH_STBHDMI_IOCTL_BASE, 2, int)
#define PH_STBHDMI_IOCTL_GET_EDID_DATA 		_IOW(PH_STBHDMI_IOCTL_BASE, 3, int)
#define PH_STBHDMI_IOCTL_DISABLE_HDMI_OUTPUT	_IOW(PH_STBHDMI_IOCTL_BASE, 4, int)
#define PH_STBHDMI_IOCTL_ENABLE_HDMI_OUTPUT 	_IOW(PH_STBHDMI_IOCTL_BASE, 5, int)
#define PH_STBHDMI_IOCTL_GET_AUDIO_CAP 		_IOW(PH_STBHDMI_IOCTL_BASE, 6, int)
#define PH_STBHDMI_IOCTL_GET_VIDEO_CAP 		_IOW(PH_STBHDMI_IOCTL_BASE, 7, int)
#define PH_STBHDMI_IOCTL_GET_HOTPLUG_STATUS	_IOW(PH_STBHDMI_IOCTL_BASE, 8, int)
#define PH_STBHDMI_IOCTL_GET_RXSENSE_STATUS	_IOW(PH_STBHDMI_IOCTL_BASE, 9, int)
#define PH_STBHDMI_IOCTL_GET_SINK_TYPE		_IOW(PH_STBHDMI_IOCTL_BASE,10, int)
#define PH_STBHDMI_IOCTL_WAIT_CALLBACK_STATUS	_IOW(PH_STBHDMI_IOCTL_BASE,11, int)
#define PH_STBHDMI_IOCTL_UNBLOCK_CALLBACK	_IOW(PH_STBHDMI_IOCTL_BASE,12, int)
#define PH_STBHDMI_IOCTL_DISABLE_AUDIO_OUTPUT	_IOW(PH_STBHDMI_IOCTL_BASE,13, int)
#define PH_STBHDMI_IOCTL_ENABLE_AUDIO_OUTPUT 	_IOW(PH_STBHDMI_IOCTL_BASE,14, int)
#define PH_STBHDMI_IOCTL_START_HDCP		_IOW(PH_STBHDMI_IOCTL_BASE,15, int)
#define PH_STBHDMI_IOCTL_STOP_HDCP		_IOW(PH_STBHDMI_IOCTL_BASE,16, int)
#define PH_STBHDMI_IOCTL_GET_HDCP_STATUS	_IOW(PH_STBHDMI_IOCTL_BASE,17, int)
#define PH_STBHDMI_IOCTL_SET_TEST_PATTERN	_IOW(PH_STBHDMI_IOCTL_BASE,19, int)
#define PH_STBHDMI_IOCTL_GET_TX_OBJECT		_IOW(PH_STBHDMI_IOCTL_BASE,20, int)

/*
 * @brief phStbHdmi operations.
 */
typedef struct phStbHdmi_Ops
{
    /* open/release and usage marking */
    struct module *owner;

    /* Set the video mode according to info->var */
    int (*phStbHdmi_set_mode)(struct videodenc_info *info);

    /* Blank the display */
    int (*phStbHdmi_blank)(struct videodenc_info *info, int blank);

    /* Display the specified test pattern */
    int (*phStbHdmi_test_pattern)(struct videodenc_info *info, int test_pattern);

    /* Enable HDMI Audio */
    int (*phStbHdmi_enable_audio)( void );

    /* Disable HDMI Audio */
    int (*phStbHdmi_disable_audio)( void );

    /* Set the audio output rate */
    int (*phStbHdmi_ioctlSetAudioRate)(unsigned long arg);

    /* Set the display mode */
    int (*phStbHdmi_ioctl_set_mode)(struct videodenc_info * info);

#ifdef CONFIG_PM
    /* Enter Power Saving Mode */
    int (*phStbHdmi_suspend)(struct platform_device* p_dev, pm_message_t event);

    /* Leave Power Saving Mode */
    int (*phStbHdmi_resume)(struct platform_device* p_dev);
#endif // #ifdef CONFIG_PM

    /* Get the number of EDID blocks present on the connected HDMI/DVI display */
    int (*phStbHdmi_ioctlGetEdidBlkCnt)(tmUnitSelect_t txUnit, unsigned long arg);

    /* Get the EDID data from the connected HDMI/DVI display */
    int (*phStbHdmi_ioctlGetEdidData)(tmUnitSelect_t txUnit, unsigned long arg);

    /* Enable/Disable HDMI/DVI output */
    int (*phStbHdmi_ioctlEnableDisableHdmi)(tmUnitSelect_t txUnit, int disable);

    /* Get the Audio capabilities of the connected HDMI/DVI display */
    int (*phStbHdmi_ioctlGetAudioCap)(tmUnitSelect_t txUnit, unsigned long arg);

    /* Get the Video capabilities of the connected HDMI/DVI display */
    int (*phStbHdmi_ioctlGetVideoCap)(tmUnitSelect_t txUnit, unsigned long arg);

    /* Get the current Hotplug status */
    int (*phStbHdmi_ioctlGetHotplugStatus)(tmUnitSelect_t txUnit, unsigned long arg);

    /* Get the connected sink type (HDMI/DVI) */
    int (*phStbHdmi_ioctlGetSinkType)(tmUnitSelect_t txUnit, unsigned long arg);

    /* Get the current Rxsense status */
    int (*phStbHdmi_ioctlGetRxSenseStatus)(tmUnitSelect_t txUnit, unsigned long arg);

    /* Enable callback of HDMI events */
    int (*phStbHdmi_ioctlWaitCallbackStatus)(tmUnitSelect_t txUnit, unsigned long arg);

    /* Disable callback of HDMI events */
    int (*phStbHdmi_ioctlUserUnblockWaitStatus)(void);

    /* Enable/Disable HDMI Audio output */
    int (*phStbHdmi_ioctlEnableDisableAudio)(tmUnitSelect_t txUnit, int disable);

    /* Start High-Bandwidth Digital Content Protection */
    int (*phStbHdmi_ioctlStartHdcp)(tmUnitSelect_t txUnit, unsigned long arg);

    /* Stop High-Bandwidth Digital Content Protection */
    int (*phStbHdmi_ioctlStopHdcp)(tmUnitSelect_t txUnit, unsigned long arg);

    /* Get the status of the High-Bandwidth Digital Content Protection */
    int (*phStbHdmi_ioctlGetHdcpStatus)(tmUnitSelect_t txUnit, unsigned long arg);

    /* Display the specified test pattern */
    int (*phStbHdmi_ioctl_test_pattern)(struct videodenc_info *info, int test_pattern);

    /* Get the TxObjects from the lower level driver */
    int (*phStbHdmi_ioctlGetTmHdmiTxobject)(tmUnitSelect_t txUnit, unsigned long arg);

    /* Handle extended (device specific) IOCTLs */
    int (*phStbHdmi_ioctlExtended)(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg, struct videodenc_info *info);
} phStbHdmi_Ops_t;

    /* Register the HDMI lower-level (device specific) driver with phStbHdmi, by passing its function pointers */
    extern int phStbHdmi_Register(phStbHdmi_Ops_t Hdmi_funcs);

    /* Enable/disable HDMI audio from Kernel-space */
    extern int phStbHdmi_EnableAudio ( void );
    extern int phStbHdmi_DisableAudio( void );

#if defined(__cplusplus)
}
#endif
#endif /* __PHSTBHDMI_H__ */


