Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright (c) 2015 NVIDIA Corporation. All rights reserved.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sub license,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice (including the
0012  * next paragraph) shall be included in all copies or substantial portions
0013  * of the Software.
0014  *
0015  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0016  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0017  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
0018  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0019  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
0020  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
0021  * DEALINGS IN THE SOFTWARE.
0022  */
0023 
0024 #ifndef DRM_SCDC_HELPER_H
0025 #define DRM_SCDC_HELPER_H
0026 
0027 #include <linux/types.h>
0028 
0029 #include <drm/display/drm_scdc.h>
0030 
0031 struct i2c_adapter;
0032 
0033 ssize_t drm_scdc_read(struct i2c_adapter *adapter, u8 offset, void *buffer,
0034               size_t size);
0035 ssize_t drm_scdc_write(struct i2c_adapter *adapter, u8 offset,
0036                const void *buffer, size_t size);
0037 
0038 /**
0039  * drm_scdc_readb - read a single byte from SCDC
0040  * @adapter: I2C adapter
0041  * @offset: offset of register to read
0042  * @value: return location for the register value
0043  *
0044  * Reads a single byte from SCDC. This is a convenience wrapper around the
0045  * drm_scdc_read() function.
0046  *
0047  * Returns:
0048  * 0 on success or a negative error code on failure.
0049  */
0050 static inline int drm_scdc_readb(struct i2c_adapter *adapter, u8 offset,
0051                  u8 *value)
0052 {
0053     return drm_scdc_read(adapter, offset, value, sizeof(*value));
0054 }
0055 
0056 /**
0057  * drm_scdc_writeb - write a single byte to SCDC
0058  * @adapter: I2C adapter
0059  * @offset: offset of register to read
0060  * @value: return location for the register value
0061  *
0062  * Writes a single byte to SCDC. This is a convenience wrapper around the
0063  * drm_scdc_write() function.
0064  *
0065  * Returns:
0066  * 0 on success or a negative error code on failure.
0067  */
0068 static inline int drm_scdc_writeb(struct i2c_adapter *adapter, u8 offset,
0069                   u8 value)
0070 {
0071     return drm_scdc_write(adapter, offset, &value, sizeof(value));
0072 }
0073 
0074 bool drm_scdc_get_scrambling_status(struct i2c_adapter *adapter);
0075 
0076 bool drm_scdc_set_scrambling(struct i2c_adapter *adapter, bool enable);
0077 bool drm_scdc_set_high_tmds_clock_ratio(struct i2c_adapter *adapter, bool set);
0078 
0079 #endif