Path: blob/master/include/drm/display/drm_scdc_helper.h
26285 views
/*1* Copyright (c) 2015 NVIDIA Corporation. All rights reserved.2*3* Permission is hereby granted, free of charge, to any person obtaining a4* copy of this software and associated documentation files (the "Software"),5* to deal in the Software without restriction, including without limitation6* the rights to use, copy, modify, merge, publish, distribute, sub license,7* and/or sell copies of the Software, and to permit persons to whom the8* Software is furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice (including the11* next paragraph) shall be included in all copies or substantial portions12* of the Software.13*14* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL17* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING19* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER20* DEALINGS IN THE SOFTWARE.21*/2223#ifndef DRM_SCDC_HELPER_H24#define DRM_SCDC_HELPER_H2526#include <linux/types.h>2728#include <drm/display/drm_scdc.h>2930struct drm_connector;31struct i2c_adapter;3233ssize_t drm_scdc_read(struct i2c_adapter *adapter, u8 offset, void *buffer,34size_t size);35ssize_t drm_scdc_write(struct i2c_adapter *adapter, u8 offset,36const void *buffer, size_t size);3738/**39* drm_scdc_readb - read a single byte from SCDC40* @adapter: I2C adapter41* @offset: offset of register to read42* @value: return location for the register value43*44* Reads a single byte from SCDC. This is a convenience wrapper around the45* drm_scdc_read() function.46*47* Returns:48* 0 on success or a negative error code on failure.49*/50static inline int drm_scdc_readb(struct i2c_adapter *adapter, u8 offset,51u8 *value)52{53return drm_scdc_read(adapter, offset, value, sizeof(*value));54}5556/**57* drm_scdc_writeb - write a single byte to SCDC58* @adapter: I2C adapter59* @offset: offset of register to read60* @value: return location for the register value61*62* Writes a single byte to SCDC. This is a convenience wrapper around the63* drm_scdc_write() function.64*65* Returns:66* 0 on success or a negative error code on failure.67*/68static inline int drm_scdc_writeb(struct i2c_adapter *adapter, u8 offset,69u8 value)70{71return drm_scdc_write(adapter, offset, &value, sizeof(value));72}7374bool drm_scdc_get_scrambling_status(struct drm_connector *connector);7576bool drm_scdc_set_scrambling(struct drm_connector *connector, bool enable);77bool drm_scdc_set_high_tmds_clock_ratio(struct drm_connector *connector, bool set);7879#endif808182