2017-01-25 04:27:49 +05:30
/*
* 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 :
* Pierre - Louis Bossart < pierre - louis . bossart @ linux . intel . com >
* Jerome Anand < jerome . anand @ intel . com >
* based on VED patches
*
*/
/**
* DOC : LPE Audio integration for HDMI or DP playback
*
* Motivation :
* Atom platforms ( e . g . valleyview and cherryTrail ) integrates a DMA - based
* interface as an alternative to the traditional HDaudio path . While this
* mode is unrelated to the LPE aka SST audio engine , the documentation refers
* to this mode as LPE so we keep this notation for the sake of consistency .
*
* The interface is handled by a separate standalone driver maintained in the
* ALSA subsystem for simplicity . To minimize the interaction between the two
* subsystems , a bridge is setup between the hdmi - lpe - audio and i915 :
* 1. Create a platform device to share MMIO / IRQ resources
* 2. Make the platform device child of i915 device for runtime PM .
* 3. Create IRQ chip to forward the LPE audio irqs .
* the hdmi - lpe - audio driver probes the lpe audio device and creates a new
* sound card
*
* Threats :
* Due to the restriction in Linux platform device model , user need manually
* uninstall the hdmi - lpe - audio driver before uninstalling i915 module ,
* otherwise we might run into use - after - free issues after i915 removes the
* platform device : even though hdmi - lpe - audio driver is released , the modules
* is still in " installed " status .
*
* Implementation :
* The MMIO / REG platform resources are created according to the registers
* specification .
* When forwarding LPE audio irqs , the flow control handler selection depends
* on the platform , for example on valleyview handle_simple_irq is enough .
*
*/
# include <linux/acpi.h>
2019-05-02 18:02:41 +03:00
# include <linux/delay.h>
2017-01-25 04:27:49 +05:30
# include <linux/device.h>
2018-07-29 12:15:33 +02:00
# include <linux/irq.h>
2017-01-25 04:27:49 +05:30
# include <linux/pci.h>
2019-01-17 22:03:34 +01:00
# include <linux/platform_device.h>
2019-05-02 18:02:41 +03:00
# include <linux/pm_runtime.h>
2017-01-25 04:27:49 +05:30
# include <drm/intel_lpe_audio.h>
2019-05-02 18:02:41 +03:00
# include "i915_drv.h"
drm/i915/lpe_audio: use intel_de_*() functions for register access
The implicit "dev_priv" local variable use has been a long-standing pain
point in the register access macros I915_READ(), I915_WRITE(),
POSTING_READ(), I915_READ_FW(), and I915_WRITE_FW().
Replace them with the corresponding new display engine register
accessors intel_de_read(), intel_de_write(), intel_de_posting_read(),
intel_de_read_fw(), and intel_de_write_fw().
No functional changes.
Generated using the following semantic patch:
@@
expression REG, OFFSET;
@@
- I915_READ(REG)
+ intel_de_read(dev_priv, REG)
@@
expression REG, OFFSET;
@@
- POSTING_READ(REG)
+ intel_de_posting_read(dev_priv, REG)
@@
expression REG, OFFSET;
@@
- I915_WRITE(REG, OFFSET)
+ intel_de_write(dev_priv, REG, OFFSET)
@@
expression REG;
@@
- I915_READ_FW(REG)
+ intel_de_read_fw(dev_priv, REG)
@@
expression REG, OFFSET;
@@
- I915_WRITE_FW(REG, OFFSET)
+ intel_de_write_fw(dev_priv, REG, OFFSET)
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Acked-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/d920b55fe225710169349db4819ca29af349e0b4.1579871655.git.jani.nikula@intel.com
2020-01-24 15:25:42 +02:00
# include "intel_de.h"
2019-05-02 18:02:41 +03:00
# include "intel_lpe_audio.h"
2021-11-04 18:18:54 +02:00
# define HAS_LPE_AUDIO(dev_priv) ((dev_priv)->audio.lpe.platdev != NULL)
2017-01-25 04:27:49 +05:30
static struct platform_device *
lpe_audio_platdev_create ( struct drm_i915_private * dev_priv )
{
struct drm_device * dev = & dev_priv - > drm ;
2021-01-28 14:31:23 +01:00
struct pci_dev * pdev = to_pci_dev ( dev - > dev ) ;
2017-01-25 04:27:49 +05:30
struct platform_device_info pinfo = { } ;
struct resource * rsc ;
struct platform_device * platdev ;
struct intel_hdmi_lpe_audio_pdata * pdata ;
pdata = kzalloc ( sizeof ( * pdata ) , GFP_KERNEL ) ;
if ( ! pdata )
return ERR_PTR ( - ENOMEM ) ;
rsc = kcalloc ( 2 , sizeof ( * rsc ) , GFP_KERNEL ) ;
if ( ! rsc ) {
kfree ( pdata ) ;
return ERR_PTR ( - ENOMEM ) ;
}
2021-11-04 18:18:54 +02:00
rsc [ 0 ] . start = rsc [ 0 ] . end = dev_priv - > audio . lpe . irq ;
2017-01-25 04:27:49 +05:30
rsc [ 0 ] . flags = IORESOURCE_IRQ ;
rsc [ 0 ] . name = " hdmi-lpe-audio-irq " ;
2021-01-28 14:31:23 +01:00
rsc [ 1 ] . start = pci_resource_start ( pdev , 0 ) +
2017-01-25 04:27:49 +05:30
I915_HDMI_LPE_AUDIO_BASE ;
2021-01-28 14:31:23 +01:00
rsc [ 1 ] . end = pci_resource_start ( pdev , 0 ) +
2017-01-25 04:27:49 +05:30
I915_HDMI_LPE_AUDIO_BASE + I915_HDMI_LPE_AUDIO_SIZE - 1 ;
rsc [ 1 ] . flags = IORESOURCE_MEM ;
rsc [ 1 ] . name = " hdmi-lpe-audio-mmio " ;
pinfo . parent = dev - > dev ;
pinfo . name = " hdmi-lpe-audio " ;
pinfo . id = - 1 ;
pinfo . res = rsc ;
pinfo . num_res = 2 ;
pinfo . data = pdata ;
pinfo . size_data = sizeof ( * pdata ) ;
pinfo . dma_mask = DMA_BIT_MASK ( 32 ) ;
2019-09-11 12:26:08 +03:00
pdata - > num_pipes = INTEL_NUM_PIPES ( dev_priv ) ;
2017-04-27 19:02:30 +03:00
pdata - > num_ports = IS_CHERRYVIEW ( dev_priv ) ? 3 : 2 ; /* B,C,D or B,C */
pdata - > port [ 0 ] . pipe = - 1 ;
pdata - > port [ 1 ] . pipe = - 1 ;
pdata - > port [ 2 ] . pipe = - 1 ;
2017-01-25 04:27:49 +05:30
spin_lock_init ( & pdata - > lpe_audio_slock ) ;
platdev = platform_device_register_full ( & pinfo ) ;
2017-12-09 22:21:33 +00:00
kfree ( rsc ) ;
kfree ( pdata ) ;
2017-01-25 04:27:49 +05:30
if ( IS_ERR ( platdev ) ) {
2020-03-10 10:52:47 +02:00
drm_err ( & dev_priv - > drm ,
" Failed to allocate LPE audio platform device \n " ) ;
2017-12-09 22:21:33 +00:00
return platdev ;
2017-01-25 04:27:49 +05:30
}
2018-08-02 15:04:16 +01:00
pm_runtime_no_callbacks ( & platdev - > dev ) ;
2017-04-27 19:02:20 +03:00
2017-01-25 04:27:49 +05:30
return platdev ;
}
static void lpe_audio_platdev_destroy ( struct drm_i915_private * dev_priv )
{
2017-04-12 09:02:51 +01:00
/* XXX Note that platform_device_register_full() allocates a dma_mask
* and never frees it . We can ' t free it here as we cannot guarantee
* this is the last reference ( i . e . that the dma_mask will not be
* used after our unregister ) . So ee choose to leak the sizeof ( u64 )
* allocation here - it should be fixed in the platform_device rather
* than us fiddle with its internals .
*/
2021-11-04 18:18:54 +02:00
platform_device_unregister ( dev_priv - > audio . lpe . platdev ) ;
2017-01-25 04:27:49 +05:30
}
static void lpe_audio_irq_unmask ( struct irq_data * d )
{
}
static void lpe_audio_irq_mask ( struct irq_data * d )
{
}
static struct irq_chip lpe_audio_irqchip = {
. name = " hdmi_lpe_audio_irqchip " ,
. irq_mask = lpe_audio_irq_mask ,
. irq_unmask = lpe_audio_irq_unmask ,
} ;
static int lpe_audio_irq_init ( struct drm_i915_private * dev_priv )
{
2021-11-04 18:18:54 +02:00
int irq = dev_priv - > audio . lpe . irq ;
2017-01-25 04:27:49 +05:30
drm/i915/display: Make WARN* drm specific where drm_device ptr is available
drm specific WARN* calls include device information in the
backtrace, so we know what device the warnings originate from.
Covert all the calls of WARN* with device specific drm_WARN*
variants in functions where drm_device or drm_i915_private struct
pointer is readily available.
The conversion was done automatically with below coccinelle semantic
patch. checkpatch errors/warnings are fixed manually.
@rule1@
identifier func, T;
@@
func(...) {
...
struct drm_device *T = ...;
<...
(
-WARN(
+drm_WARN(T,
...)
|
-WARN_ON(
+drm_WARN_ON(T,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(T,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(T,
...)
)
...>
}
@rule2@
identifier func, T;
@@
func(struct drm_device *T,...) {
<...
(
-WARN(
+drm_WARN(T,
...)
|
-WARN_ON(
+drm_WARN_ON(T,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(T,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(T,
...)
)
...>
}
@rule3@
identifier func, T;
@@
func(...) {
...
struct drm_i915_private *T = ...;
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
@rule4@
identifier func, T;
@@
func(struct drm_i915_private *T,...) {
<+...
(
-WARN(
+drm_WARN(&T->drm,
...)
|
-WARN_ON(
+drm_WARN_ON(&T->drm,
...)
|
-WARN_ONCE(
+drm_WARN_ONCE(&T->drm,
...)
|
-WARN_ON_ONCE(
+drm_WARN_ON_ONCE(&T->drm,
...)
)
...+>
}
Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200128181603.27767-20-pankaj.laxminarayan.bharadiya@intel.com
2020-01-28 23:46:01 +05:30
drm_WARN_ON ( & dev_priv - > drm , ! intel_irqs_enabled ( dev_priv ) ) ;
2017-01-25 04:27:49 +05:30
irq_set_chip_and_handler_name ( irq ,
& lpe_audio_irqchip ,
handle_simple_irq ,
" hdmi_lpe_audio_irq_handler " ) ;
return irq_set_chip_data ( irq , dev_priv ) ;
}
static bool lpe_audio_detect ( struct drm_i915_private * dev_priv )
{
int lpe_present = false ;
if ( IS_VALLEYVIEW ( dev_priv ) | | IS_CHERRYVIEW ( dev_priv ) ) {
static const struct pci_device_id atom_hdaudio_ids [ ] = {
/* Baytrail */
{ PCI_DEVICE ( PCI_VENDOR_ID_INTEL , 0x0f04 ) } ,
/* Braswell */
{ PCI_DEVICE ( PCI_VENDOR_ID_INTEL , 0x2284 ) } ,
{ }
} ;
if ( ! pci_dev_present ( atom_hdaudio_ids ) ) {
2020-03-10 10:52:47 +02:00
drm_info ( & dev_priv - > drm ,
" HDaudio controller not detected, using LPE audio instead \n " ) ;
2017-01-25 04:27:49 +05:30
lpe_present = true ;
}
}
return lpe_present ;
}
static int lpe_audio_setup ( struct drm_i915_private * dev_priv )
{
int ret ;
2021-11-04 18:18:54 +02:00
dev_priv - > audio . lpe . irq = irq_alloc_desc ( 0 ) ;
if ( dev_priv - > audio . lpe . irq < 0 ) {
2020-03-10 10:52:47 +02:00
drm_err ( & dev_priv - > drm , " Failed to allocate IRQ desc: %d \n " ,
2021-11-04 18:18:54 +02:00
dev_priv - > audio . lpe . irq ) ;
ret = dev_priv - > audio . lpe . irq ;
2017-01-25 04:27:49 +05:30
goto err ;
}
2021-11-04 18:18:54 +02:00
drm_dbg ( & dev_priv - > drm , " irq = %d \n " , dev_priv - > audio . lpe . irq ) ;
2017-01-25 04:27:49 +05:30
ret = lpe_audio_irq_init ( dev_priv ) ;
if ( ret ) {
2020-03-10 10:52:47 +02:00
drm_err ( & dev_priv - > drm ,
" Failed to initialize irqchip for lpe audio: %d \n " ,
2017-01-25 04:27:49 +05:30
ret ) ;
goto err_free_irq ;
}
2021-11-04 18:18:54 +02:00
dev_priv - > audio . lpe . platdev = lpe_audio_platdev_create ( dev_priv ) ;
2017-01-25 04:27:49 +05:30
2021-11-04 18:18:54 +02:00
if ( IS_ERR ( dev_priv - > audio . lpe . platdev ) ) {
ret = PTR_ERR ( dev_priv - > audio . lpe . platdev ) ;
2020-03-10 10:52:47 +02:00
drm_err ( & dev_priv - > drm ,
" Failed to create lpe audio platform device: %d \n " ,
2017-01-25 04:27:49 +05:30
ret ) ;
goto err_free_irq ;
}
2017-02-02 11:03:48 +01:00
/* enable chicken bit; at least this is required for Dell Wyse 3040
* with DP outputs ( but only sometimes by some reason ! )
*/
drm/i915/lpe_audio: use intel_de_*() functions for register access
The implicit "dev_priv" local variable use has been a long-standing pain
point in the register access macros I915_READ(), I915_WRITE(),
POSTING_READ(), I915_READ_FW(), and I915_WRITE_FW().
Replace them with the corresponding new display engine register
accessors intel_de_read(), intel_de_write(), intel_de_posting_read(),
intel_de_read_fw(), and intel_de_write_fw().
No functional changes.
Generated using the following semantic patch:
@@
expression REG, OFFSET;
@@
- I915_READ(REG)
+ intel_de_read(dev_priv, REG)
@@
expression REG, OFFSET;
@@
- POSTING_READ(REG)
+ intel_de_posting_read(dev_priv, REG)
@@
expression REG, OFFSET;
@@
- I915_WRITE(REG, OFFSET)
+ intel_de_write(dev_priv, REG, OFFSET)
@@
expression REG;
@@
- I915_READ_FW(REG)
+ intel_de_read_fw(dev_priv, REG)
@@
expression REG, OFFSET;
@@
- I915_WRITE_FW(REG, OFFSET)
+ intel_de_write_fw(dev_priv, REG, OFFSET)
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Acked-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/d920b55fe225710169349db4819ca29af349e0b4.1579871655.git.jani.nikula@intel.com
2020-01-24 15:25:42 +02:00
intel_de_write ( dev_priv , VLV_AUD_CHICKEN_BIT_REG ,
VLV_CHICKEN_BIT_DBG_ENABLE ) ;
2017-02-02 11:03:48 +01:00
2017-01-25 04:27:49 +05:30
return 0 ;
err_free_irq :
2021-11-04 18:18:54 +02:00
irq_free_desc ( dev_priv - > audio . lpe . irq ) ;
2017-01-25 04:27:49 +05:30
err :
2021-11-04 18:18:54 +02:00
dev_priv - > audio . lpe . irq = - 1 ;
dev_priv - > audio . lpe . platdev = NULL ;
2017-01-25 04:27:49 +05:30
return ret ;
}
/**
* intel_lpe_audio_irq_handler ( ) - forwards the LPE audio irq
* @ dev_priv : the i915 drm device private data
*
* the LPE Audio irq is forwarded to the irq handler registered by LPE audio
* driver .
*/
void intel_lpe_audio_irq_handler ( struct drm_i915_private * dev_priv )
{
int ret ;
if ( ! HAS_LPE_AUDIO ( dev_priv ) )
return ;
2021-11-04 18:18:54 +02:00
ret = generic_handle_irq ( dev_priv - > audio . lpe . irq ) ;
2017-01-25 04:27:49 +05:30
if ( ret )
2020-03-10 10:52:47 +02:00
drm_err_ratelimited ( & dev_priv - > drm ,
" error handling LPE audio irq: %d \n " , ret ) ;
2017-01-25 04:27:49 +05:30
}
/**
* intel_lpe_audio_init ( ) - detect and setup the bridge between HDMI LPE Audio
* driver and i915
* @ dev_priv : the i915 drm device private data
*
* Return : 0 if successful . non - zero if detection or
* llocation / initialization fails
*/
int intel_lpe_audio_init ( struct drm_i915_private * dev_priv )
{
int ret = - ENODEV ;
if ( lpe_audio_detect ( dev_priv ) ) {
ret = lpe_audio_setup ( dev_priv ) ;
if ( ret < 0 )
2020-03-10 10:52:47 +02:00
drm_err ( & dev_priv - > drm ,
" failed to setup LPE Audio bridge \n " ) ;
2017-01-25 04:27:49 +05:30
}
return ret ;
}
/**
* intel_lpe_audio_teardown ( ) - destroy the bridge between HDMI LPE
* audio driver and i915
* @ dev_priv : the i915 drm device private data
*
* release all the resources for LPE audio < - > i915 bridge .
*/
void intel_lpe_audio_teardown ( struct drm_i915_private * dev_priv )
{
if ( ! HAS_LPE_AUDIO ( dev_priv ) )
return ;
lpe_audio_platdev_destroy ( dev_priv ) ;
2021-11-04 18:18:54 +02:00
irq_free_desc ( dev_priv - > audio . lpe . irq ) ;
2017-01-25 04:27:50 +05:30
2021-11-04 18:18:54 +02:00
dev_priv - > audio . lpe . irq = - 1 ;
dev_priv - > audio . lpe . platdev = NULL ;
2018-11-05 21:46:04 +02:00
}
2017-01-25 04:27:50 +05:30
/**
* intel_lpe_audio_notify ( ) - notify lpe audio event
* audio driver and i915
* @ dev_priv : the i915 drm device private data
2017-04-27 19:02:26 +03:00
* @ pipe : pipe
* @ port : port
2017-01-25 04:27:50 +05:30
* @ eld : ELD data
2017-04-27 19:02:24 +03:00
* @ ls_clock : Link symbol clock in kHz
* @ dp_output : Driving a DP output ?
2017-01-25 04:27:50 +05:30
*
* Notify lpe audio driver of eld change .
*/
void intel_lpe_audio_notify ( struct drm_i915_private * dev_priv ,
2017-04-27 19:02:26 +03:00
enum pipe pipe , enum port port ,
const void * eld , int ls_clock , bool dp_output )
2017-01-25 04:27:50 +05:30
{
2017-04-27 19:02:30 +03:00
unsigned long irqflags ;
2017-04-27 19:02:27 +03:00
struct intel_hdmi_lpe_audio_pdata * pdata ;
struct intel_hdmi_lpe_audio_port_pdata * ppdata ;
2017-01-31 14:16:49 -06:00
u32 audio_enable ;
2017-01-25 04:27:50 +05:30
if ( ! HAS_LPE_AUDIO ( dev_priv ) )
return ;
2021-11-04 18:18:54 +02:00
pdata = dev_get_platdata ( & dev_priv - > audio . lpe . platdev - > dev ) ;
2017-04-27 19:02:30 +03:00
ppdata = & pdata - > port [ port - PORT_B ] ;
2017-01-25 04:27:50 +05:30
2017-04-27 19:02:30 +03:00
spin_lock_irqsave ( & pdata - > lpe_audio_slock , irqflags ) ;
2017-01-25 04:27:50 +05:30
drm/i915/lpe_audio: use intel_de_*() functions for register access
The implicit "dev_priv" local variable use has been a long-standing pain
point in the register access macros I915_READ(), I915_WRITE(),
POSTING_READ(), I915_READ_FW(), and I915_WRITE_FW().
Replace them with the corresponding new display engine register
accessors intel_de_read(), intel_de_write(), intel_de_posting_read(),
intel_de_read_fw(), and intel_de_write_fw().
No functional changes.
Generated using the following semantic patch:
@@
expression REG, OFFSET;
@@
- I915_READ(REG)
+ intel_de_read(dev_priv, REG)
@@
expression REG, OFFSET;
@@
- POSTING_READ(REG)
+ intel_de_posting_read(dev_priv, REG)
@@
expression REG, OFFSET;
@@
- I915_WRITE(REG, OFFSET)
+ intel_de_write(dev_priv, REG, OFFSET)
@@
expression REG;
@@
- I915_READ_FW(REG)
+ intel_de_read_fw(dev_priv, REG)
@@
expression REG, OFFSET;
@@
- I915_WRITE_FW(REG, OFFSET)
+ intel_de_write_fw(dev_priv, REG, OFFSET)
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Acked-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/d920b55fe225710169349db4819ca29af349e0b4.1579871655.git.jani.nikula@intel.com
2020-01-24 15:25:42 +02:00
audio_enable = intel_de_read ( dev_priv , VLV_AUD_PORT_EN_DBG ( port ) ) ;
2017-01-31 14:16:49 -06:00
2017-01-25 04:27:50 +05:30
if ( eld ! = NULL ) {
2017-04-27 19:02:27 +03:00
memcpy ( ppdata - > eld , eld , HDMI_MAX_ELD_BYTES ) ;
ppdata - > pipe = pipe ;
ppdata - > ls_clock = ls_clock ;
ppdata - > dp_output = dp_output ;
2017-01-31 14:16:49 -06:00
/* Unmute the amp for both DP and HDMI */
drm/i915/lpe_audio: use intel_de_*() functions for register access
The implicit "dev_priv" local variable use has been a long-standing pain
point in the register access macros I915_READ(), I915_WRITE(),
POSTING_READ(), I915_READ_FW(), and I915_WRITE_FW().
Replace them with the corresponding new display engine register
accessors intel_de_read(), intel_de_write(), intel_de_posting_read(),
intel_de_read_fw(), and intel_de_write_fw().
No functional changes.
Generated using the following semantic patch:
@@
expression REG, OFFSET;
@@
- I915_READ(REG)
+ intel_de_read(dev_priv, REG)
@@
expression REG, OFFSET;
@@
- POSTING_READ(REG)
+ intel_de_posting_read(dev_priv, REG)
@@
expression REG, OFFSET;
@@
- I915_WRITE(REG, OFFSET)
+ intel_de_write(dev_priv, REG, OFFSET)
@@
expression REG;
@@
- I915_READ_FW(REG)
+ intel_de_read_fw(dev_priv, REG)
@@
expression REG, OFFSET;
@@
- I915_WRITE_FW(REG, OFFSET)
+ intel_de_write_fw(dev_priv, REG, OFFSET)
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Acked-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/d920b55fe225710169349db4819ca29af349e0b4.1579871655.git.jani.nikula@intel.com
2020-01-24 15:25:42 +02:00
intel_de_write ( dev_priv , VLV_AUD_PORT_EN_DBG ( port ) ,
audio_enable & ~ VLV_AMP_MUTE ) ;
2017-01-25 04:27:50 +05:30
} else {
2017-04-27 19:02:27 +03:00
memset ( ppdata - > eld , 0 , HDMI_MAX_ELD_BYTES ) ;
ppdata - > pipe = - 1 ;
ppdata - > ls_clock = 0 ;
ppdata - > dp_output = false ;
2017-01-31 14:16:49 -06:00
/* Mute the amp for both DP and HDMI */
drm/i915/lpe_audio: use intel_de_*() functions for register access
The implicit "dev_priv" local variable use has been a long-standing pain
point in the register access macros I915_READ(), I915_WRITE(),
POSTING_READ(), I915_READ_FW(), and I915_WRITE_FW().
Replace them with the corresponding new display engine register
accessors intel_de_read(), intel_de_write(), intel_de_posting_read(),
intel_de_read_fw(), and intel_de_write_fw().
No functional changes.
Generated using the following semantic patch:
@@
expression REG, OFFSET;
@@
- I915_READ(REG)
+ intel_de_read(dev_priv, REG)
@@
expression REG, OFFSET;
@@
- POSTING_READ(REG)
+ intel_de_posting_read(dev_priv, REG)
@@
expression REG, OFFSET;
@@
- I915_WRITE(REG, OFFSET)
+ intel_de_write(dev_priv, REG, OFFSET)
@@
expression REG;
@@
- I915_READ_FW(REG)
+ intel_de_read_fw(dev_priv, REG)
@@
expression REG, OFFSET;
@@
- I915_WRITE_FW(REG, OFFSET)
+ intel_de_write_fw(dev_priv, REG, OFFSET)
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Acked-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/d920b55fe225710169349db4819ca29af349e0b4.1579871655.git.jani.nikula@intel.com
2020-01-24 15:25:42 +02:00
intel_de_write ( dev_priv , VLV_AUD_PORT_EN_DBG ( port ) ,
audio_enable | VLV_AMP_MUTE ) ;
2017-01-25 04:27:50 +05:30
}
if ( pdata - > notify_audio_lpe )
2021-11-04 18:18:54 +02:00
pdata - > notify_audio_lpe ( dev_priv - > audio . lpe . platdev , port - PORT_B ) ;
2017-01-25 04:27:50 +05:30
2017-04-27 19:02:30 +03:00
spin_unlock_irqrestore ( & pdata - > lpe_audio_slock , irqflags ) ;
2017-01-25 04:27:50 +05:30
}