From: Shashank Sharma <shashank.sharma@intel.com>
To: intel-gfx@lists.freedesktop.org, daniel.vetter@intel.com
Cc: akashdeep.sharma@inte.com
Subject: [PATCH 3/7] drm/i915: Add new lspcon file
Date: Tue, 22 Mar 2016 19:55:04 +0530 [thread overview]
Message-ID: <1458656708-31228-4-git-send-email-shashank.sharma@intel.com> (raw)
In-Reply-To: <1458656708-31228-1-git-send-email-shashank.sharma@intel.com>
This patch adds a new file for lspcon with
some basic stuff like:
- Some read/wrire addresses for lspcon device
- Basic read/write functions, using i2c over aux channel
- Utility functions to get lspcon/encoder/connector
Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
Signed-off-by: Akashdeep Sharma <akashdeep.sharma@intel.com>
---
drivers/gpu/drm/i915/Makefile | 3 +-
drivers/gpu/drm/i915/intel_lspcon.c | 114 ++++++++++++++++++++++++++++++++++++
2 files changed, 116 insertions(+), 1 deletion(-)
create mode 100644 drivers/gpu/drm/i915/intel_lspcon.c
diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 5558a03..00a531a 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -90,7 +90,8 @@ i915-y += dvo_ch7017.o \
intel_lvds.o \
intel_panel.o \
intel_sdvo.o \
- intel_tv.o
+ intel_tv.o \
+ intel_lspcon.o
# virtual gpu code
i915-y += i915_vgpu.o
diff --git a/drivers/gpu/drm/i915/intel_lspcon.c b/drivers/gpu/drm/i915/intel_lspcon.c
new file mode 100644
index 0000000..f5c91db
--- /dev/null
+++ b/drivers/gpu/drm/i915/intel_lspcon.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright © 2016 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ * Shashank Sharma <shashank.sharma@intel.com>
+ * Akashdeep Sharma <akashdeep.sharma@intel.com>
+ *
+ */
+#include <drm/drm_edid.h>
+#include <drm/drm_atomic_helper.h>
+#include "intel_drv.h"
+
+#define LSPCON_I2C_ADDRESS 0x80
+#define LSPCON_MODE_CHANGE_OFFSET 0x40
+#define LSPCON_MODE_CHECK_OFFSET 0x41
+#define LSPCON_ADAPTER_SIGN_OFFSET 0x00
+#define LSPCON_IDENTIFIER_OFFSET 0x10
+#define LSPCON_IDENTIFIER_LENGTH 0x10
+#define LSPCON_ADAPTER 0xA8
+#define DP_TYPE2_ADAPTER 0xA0
+#define ADAPTER_TYPE_MASK 0xF0
+#define LSPCON_MODE_MASK 0x1
+
+struct intel_digital_port *lspcon_to_dig_port(struct intel_lspcon *lspcon)
+{
+ return container_of(lspcon, struct intel_digital_port, lspcon);
+}
+
+struct intel_hdmi *lspcon_to_hdmi(struct intel_lspcon *lspcon)
+{
+ return &lspcon_to_dig_port(lspcon)->hdmi;
+}
+
+struct intel_lspcon *enc_to_lspcon(struct drm_encoder *encoder)
+{
+ struct intel_digital_port *intel_dig_port =
+ container_of(encoder, struct intel_digital_port, base.base);
+ return &intel_dig_port->lspcon;
+}
+
+int lspcon_ioa_read(struct i2c_adapter *adapter, u8 *buffer,
+ u8 address, u8 offset, u8 no_of_bytes)
+{
+ int err = 0;
+
+ struct i2c_msg msgs[] = {
+ {
+ .addr = address >> 1,
+ .flags = 0,
+ .len = 1,
+ .buf = &offset,
+ }, {
+ .addr = address >> 1,
+ .flags = I2C_M_RD,
+ .len = no_of_bytes,
+ .buf = buffer,
+ }
+ };
+
+ /* I2C over AUX here */
+ err = adapter->algo->master_xfer(adapter, msgs, 2);
+ if (err < 0)
+ DRM_ERROR("LSPCON: Failed I2C over Aux read(addr=0x%x)\n",
+ (unsigned int)offset);
+
+ return err;
+}
+
+int lspcon_ioa_write(struct i2c_adapter *adapter, u8 *buffer,
+ u8 address, u8 offset, u8 no_of_bytes)
+{
+ int err = 0;
+
+ struct i2c_msg msgs[] = {
+ {
+ .addr = address >> 1,
+ .flags = 0,
+ .len = 1,
+ .buf = &offset,
+ }, {
+ .addr = address >> 1,
+ .flags = 0,
+ .len = no_of_bytes,
+ .buf = buffer,
+ }
+ };
+
+ /* I2C over AUX here */
+ err = adapter->algo->master_xfer(adapter, msgs, 2);
+ if (err < 0)
+ DRM_ERROR("LSPCON: Failed I2C over Aux write(addr=0x%x)\n",
+ (unsigned int)offset);
+
+ return err;
+}
--
1.9.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-03-22 14:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-22 14:25 [PATCH 0/7] Add lspcon support Shashank Sharma
2016-03-22 14:25 ` [PATCH 1/7] drm/i915: add lspcon vbt bit parsing Shashank Sharma
2016-03-22 15:54 ` Jani Nikula
2016-03-22 16:50 ` Sharma, Shashank
2016-03-22 17:05 ` Ville Syrjälä
2016-03-22 17:10 ` Sharma, Shashank
2016-03-22 14:25 ` [PATCH 2/7] drm/i915: Add lspcon data structures Shashank Sharma
2016-03-22 14:25 ` Shashank Sharma [this message]
2016-03-22 14:25 ` [PATCH 4/7] drm/i915: Add and initialize lspcon connector Shashank Sharma
2016-03-22 14:25 ` [PATCH 5/7] drm/i915: Add and register lspcon connector functions Shashank Sharma
2016-03-22 14:25 ` [PATCH 6/7] drm/i915: Add lspcon core functions Shashank Sharma
2016-03-22 14:25 ` [PATCH 7/7] drm/i915: Add lspcon hpd handler Shashank Sharma
2016-03-22 16:20 ` [PATCH 0/7] Add lspcon support Ville Syrjälä
2016-03-22 16:47 ` Sharma, Shashank
2016-03-23 9:03 ` Daniel Vetter
2016-03-23 9:12 ` Sharma, Shashank
2016-03-25 16:02 ` Sharma, Shashank
2016-03-22 16:32 ` ✗ Fi.CI.BAT: warning for " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1458656708-31228-4-git-send-email-shashank.sharma@intel.com \
--to=shashank.sharma@intel.com \
--cc=akashdeep.sharma@inte.com \
--cc=daniel.vetter@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).