From: "Sharma, Shashank" <shashank.sharma@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: daniel.vetter@intel.com, intel-gfx@lists.freedesktop.org,
paulo.r.zanoni@intel.com
Subject: Re: [PATCH 2/5] drm/i915: Add lspcon support for I915 driver
Date: Tue, 31 May 2016 21:57:47 +0530 [thread overview]
Message-ID: <574DBB83.4060202@intel.com> (raw)
In-Reply-To: <20160531160804.GW4329@intel.com>
Regards
Shashank
On 5/31/2016 9:38 PM, Ville Syrjälä wrote:
> On Tue, May 31, 2016 at 02:55:43PM +0530, Shashank Sharma wrote:
>> lspcon is a dp->hdmi adaptor has two modes of operation.
>> ls mode: level shifter mode, passive dp->hdmi dongle
>> pcon mode: protocol converter mode, active dp->hdmi 2.0
>> converter.
>>
>> This patch adds a new file, to accommodate lspcon support
>> for I915 driver. These functions probe, detect, initialize
>> and configure an on-board lspcon device during the driver
>> init time.
>>
>> Also, this patch adds a small structure for lspcon device,
>> which will provide the runtime status of the device.
>>
>> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
>> Signed-off-by: Akashdeep Sharma <akashdeep.sharma@intel.com>
>> ---
>> drivers/gpu/drm/i915/Makefile | 1 +
>> drivers/gpu/drm/i915/intel_drv.h | 13 ++-
>> drivers/gpu/drm/i915/intel_lspcon.c | 159 ++++++++++++++++++++++++++++++++++++
>> 3 files changed, 172 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 7e29444..1bd6026 100644
>> --- a/drivers/gpu/drm/i915/Makefile
>> +++ b/drivers/gpu/drm/i915/Makefile
>> @@ -93,6 +93,7 @@ i915-y += dvo_ch7017.o \
>> intel_dvo.o \
>> intel_hdmi.o \
>> intel_i2c.o \
>> + intel_lspcon.o \
>> intel_lvds.o \
>> intel_panel.o \
>> intel_sdvo.o \
>> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
>> index 9b5f663..205a463 100644
>> --- a/drivers/gpu/drm/i915/intel_drv.h
>> +++ b/drivers/gpu/drm/i915/intel_drv.h
>> @@ -896,12 +896,19 @@ struct intel_dp {
>> bool compliance_test_active;
>> };
>>
>> +struct intel_lspcon {
>> + bool active;
>> + enum drm_lspcon_mode mode_of_op;
>> + struct drm_dp_aux *aux;
>> +};
>> +
>> struct intel_digital_port {
>> struct intel_encoder base;
>> enum port port;
>> u32 saved_port_bits;
>> struct intel_dp dp;
>> struct intel_hdmi hdmi;
>> + struct intel_lspcon lspcon;
>> enum irqreturn (*hpd_pulse)(struct intel_digital_port *, bool);
>> bool release_cl2_override;
>> uint8_t max_lanes;
>> @@ -1446,7 +1453,6 @@ bool intel_hdmi_compute_config(struct intel_encoder *encoder,
>> struct intel_crtc_state *pipe_config);
>> void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
>>
>> -
>> /* intel_lvds.c */
>> void intel_lvds_init(struct drm_device *dev);
>> bool intel_is_dual_link_lvds(struct drm_device *dev);
>> @@ -1734,4 +1740,9 @@ int intel_color_check(struct drm_crtc *crtc, struct drm_crtc_state *state);
>> void intel_color_set_csc(struct drm_crtc_state *crtc_state);
>> void intel_color_load_luts(struct drm_crtc_state *crtc_state);
>>
>> +/* intel_lspcon.c */
>> +bool lspcon_init(struct intel_digital_port *intel_dig_port);
>> +enum drm_connector_status
>> +lspcon_ls_mode_detect(struct drm_connector *connector, bool force);
>> +bool is_lspcon_active(struct intel_digital_port *dig_port);
>> #endif /* __INTEL_DRV_H__ */
>> diff --git a/drivers/gpu/drm/i915/intel_lspcon.c b/drivers/gpu/drm/i915/intel_lspcon.c
>> new file mode 100644
>> index 0000000..dd50491
>> --- /dev/null
>> +++ b/drivers/gpu/drm/i915/intel_lspcon.c
>> @@ -0,0 +1,159 @@
>> +/*
>> + * 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.
>> + *
>> + *
>> + */
>> +#include <drm/drm_edid.h>
>> +#include <drm/drm_atomic_helper.h>
>> +#include <drm/drm_dp_dual_mode_helper.h>
>> +#include "intel_drv.h"
>> +
>> +#define LSPCON_I2C_ADDRESS 0x80
>> +#define LSPCON_ADAPTER_SIGN_OFFSET 0x00
>> +#define LSPCON_IDENTIFIER_OFFSET 0x10
>> +#define LSPCON_IDENTIFIER_LENGTH 0x10
>
> Leftovers?
Yep, will clean this up too.
>
>> +
>> +bool is_lspcon_active(struct intel_digital_port *dig_port)
>> +{
>> + return dig_port->lspcon.active;
>> +}
>> +
>> +enum drm_lspcon_mode lspcon_get_current_mode(struct intel_lspcon *lspcon)
>> +{
>> + enum drm_lspcon_mode current_mode;
>> + struct i2c_adapter *adapter = &lspcon->aux->ddc;
>> +
>> + current_mode = drm_lspcon_get_current_mode(adapter);
>> + if (current_mode == DRM_LSPCON_MODE_INVALID)
>> + DRM_ERROR("Error reading LSPCON mode\n");
>> + else
>> + DRM_DEBUG_KMS("Current LSPCON mode %s\n",
>> + current_mode == DRM_LSPCON_MODE_PCON ? "PCON" : "LS");
>> + return current_mode;
>> +}
>
> This file seems to be just contain these sort of wrappers that don't
> look very useful to me.
>
I agree, that most of the real work is happening in dp_dual_mode layer
now. Actually, the idea behind this file is to contains all the I915
specific operations, for lspcon.
This API (get_current_mode) is a small function, but if you see others
(like init and probe) they do specific work which we want to do in I915
lspcon handling. This is good for readability as well as this makes code
modular too.
For example, reading i2c_ove_aux address 0x80 offset 0x41, doesn't make
much sense for ppl who don't know much about lspcon, but create a
wrapper function and let it return ls_mode or pcon_mode, makes code very
simple to read and debug.
Going forward, if there is a requirement to support other HDMI 2.0
features over lspcon, there would be scope for expansion of file with
many more wrappers and some core functions too.
Please let me know, if this idea makes any sense :)
Regards
Shashank
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-05-31 16:27 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-31 9:25 [PATCH 0/5] Enable lspcon support for GEN9 devices Shashank Sharma
2016-05-31 9:25 ` [PATCH 1/5] drm: Helper for LSPCON in drm_dp_dual_mode Shashank Sharma
2016-05-31 9:52 ` Ville Syrjälä
2016-05-31 10:52 ` Sharma, Shashank
2016-05-31 12:10 ` Ville Syrjälä
2016-05-31 12:42 ` Sharma, Shashank
2016-05-31 16:05 ` Ville Syrjälä
2016-05-31 16:13 ` Sharma, Shashank
2016-05-31 9:25 ` [PATCH 2/5] drm/i915: Add lspcon support for I915 driver Shashank Sharma
2016-05-31 16:08 ` Ville Syrjälä
2016-05-31 16:27 ` Sharma, Shashank [this message]
2016-05-31 9:25 ` [PATCH 3/5] drm/i915: lspcon detection Shashank Sharma
2016-05-31 16:30 ` Ville Syrjälä
2016-06-01 9:33 ` Sharma, Shashank
2016-05-31 9:25 ` [PATCH 4/5] drm/i915: Parse VBT data for lspcon Shashank Sharma
2016-05-31 16:32 ` Ville Syrjälä
2016-06-01 9:35 ` Sharma, Shashank
2016-05-31 9:25 ` [PATCH 5/5] drm/i915: Enable lspcon initialization Shashank Sharma
2016-05-31 16:34 ` Ville Syrjälä
2016-06-01 9:36 ` Sharma, Shashank
2016-05-31 12:32 ` ✗ Ro.CI.BAT: warning for Enable lspcon support for GEN9 devices 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=574DBB83.4060202@intel.com \
--to=shashank.sharma@intel.com \
--cc=daniel.vetter@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=paulo.r.zanoni@intel.com \
--cc=ville.syrjala@linux.intel.com \
/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