mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
Merge "asoc: qcs405: Add support for ep92 HDMI bridge chip"
This commit is contained in:
commit
057e0e85de
8 changed files with 1862 additions and 0 deletions
|
|
@ -42,6 +42,7 @@ endif
|
|||
ifeq ($(TARGET_SUPPORT), $(filter $(TARGET_SUPPORT), qcs40x))
|
||||
obj-m += asoc/codecs/bolero/
|
||||
obj-m += asoc/codecs/csra66x0/
|
||||
obj-m += asoc/codecs/ep92/
|
||||
endif
|
||||
|
||||
all:
|
||||
|
|
|
|||
50
asoc/codecs/ep92/Android.mk
Normal file
50
asoc/codecs/ep92/Android.mk
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# Android makefile for audio kernel modules
|
||||
|
||||
# Assume no targets will be supported
|
||||
|
||||
# Check if this driver needs be built for current target
|
||||
ifeq ($(call is-board-platform,qcs405),true)
|
||||
AUDIO_SELECT := CONFIG_SND_SOC_QCS405=m
|
||||
endif
|
||||
|
||||
AUDIO_CHIPSET := audio
|
||||
# Build/Package only in case of supported target
|
||||
ifeq ($(call is-board-platform-in-list,qcs405),true)
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
# This makefile is only for DLKM
|
||||
ifneq ($(findstring vendor,$(LOCAL_PATH)),)
|
||||
|
||||
ifneq ($(findstring opensource,$(LOCAL_PATH)),)
|
||||
AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/vendor/qcom/opensource/audio-kernel
|
||||
endif # opensource
|
||||
|
||||
DLKM_DIR := $(TOP)/device/qcom/common/dlkm
|
||||
|
||||
# Build audio.ko as $(AUDIO_CHIPSET)_audio.ko
|
||||
###########################################################
|
||||
# This is set once per LOCAL_PATH, not per (kernel) module
|
||||
KBUILD_OPTIONS := AUDIO_ROOT=$(AUDIO_BLD_DIR)
|
||||
|
||||
# We are actually building audio.ko here, as per the
|
||||
# requirement we are specifying <chipset>_audio.ko as LOCAL_MODULE.
|
||||
# This means we need to rename the module to <chipset>_audio.ko
|
||||
# after audio.ko is built.
|
||||
KBUILD_OPTIONS += MODNAME=ep92_dlkm
|
||||
KBUILD_OPTIONS += BOARD_PLATFORM=$(TARGET_BOARD_PLATFORM)
|
||||
KBUILD_OPTIONS += $(AUDIO_SELECT)
|
||||
|
||||
###########################################################
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := $(AUDIO_CHIPSET)_ep92.ko
|
||||
LOCAL_MODULE_KBUILD_NAME := ep92_dlkm.ko
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_DEBUG_ENABLE := true
|
||||
LOCAL_MODULE_PATH := $(KERNEL_MODULES_OUT)
|
||||
include $(DLKM_DIR)/AndroidKernelModule.mk
|
||||
###########################################################
|
||||
###########################################################
|
||||
|
||||
endif # DLKM check
|
||||
endif # supported target check
|
||||
106
asoc/codecs/ep92/Kbuild
Normal file
106
asoc/codecs/ep92/Kbuild
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
# We can build either as part of a standalone Kernel build or as
|
||||
# an external module. Determine which mechanism is being used
|
||||
ifeq ($(MODNAME),)
|
||||
KERNEL_BUILD := 1
|
||||
else
|
||||
KERNEL_BUILD := 0
|
||||
endif
|
||||
|
||||
|
||||
|
||||
ifeq ($(KERNEL_BUILD), 1)
|
||||
# These are configurable via Kconfig for kernel-based builds
|
||||
# Need to explicitly configure for Android-based builds
|
||||
AUDIO_BLD_DIR := $(ANDROID_BUILD_TOP)/kernel/msm-4.14
|
||||
AUDIO_ROOT := $(AUDIO_BLD_DIR)/techpack/audio
|
||||
endif
|
||||
|
||||
ifeq ($(KERNEL_BUILD), 0)
|
||||
ifeq ($(CONFIG_ARCH_QCS405), y)
|
||||
include $(AUDIO_ROOT)/config/qcs405auto.conf
|
||||
export
|
||||
INCS += -include $(AUDIO_ROOT)/config/qcs405autoconf.h
|
||||
endif
|
||||
endif
|
||||
|
||||
# As per target team, build is done as follows:
|
||||
# Defconfig : build with default flags
|
||||
# Slub : defconfig + CONFIG_SLUB_DEBUG := y +
|
||||
# CONFIG_SLUB_DEBUG_ON := y + CONFIG_PAGE_POISONING := y
|
||||
# Perf : Using appropriate msmXXXX-perf_defconfig
|
||||
#
|
||||
# Shipment builds (user variants) should not have any debug feature
|
||||
# enabled. This is identified using 'TARGET_BUILD_VARIANT'. Slub builds
|
||||
# are identified using the CONFIG_SLUB_DEBUG_ON configuration. Since
|
||||
# there is no other way to identify defconfig builds, QTI internal
|
||||
# representation of perf builds (identified using the string 'perf'),
|
||||
# is used to identify if the build is a slub or defconfig one. This
|
||||
# way no critical debug feature will be enabled for perf and shipment
|
||||
# builds. Other OEMs are also protected using the TARGET_BUILD_VARIANT
|
||||
# config.
|
||||
|
||||
############ UAPI ############
|
||||
UAPI_DIR := uapi
|
||||
UAPI_INC := -I$(AUDIO_ROOT)/include/$(UAPI_DIR)
|
||||
|
||||
############ COMMON ############
|
||||
COMMON_DIR := include
|
||||
COMMON_INC := -I$(AUDIO_ROOT)/$(COMMON_DIR)
|
||||
|
||||
############ EP92 ############
|
||||
|
||||
# for EP92 Codec
|
||||
ifdef CONFIG_SND_SOC_EP92
|
||||
EP92_OBJS += ep92.o
|
||||
endif
|
||||
|
||||
LINUX_INC += -Iinclude/linux
|
||||
|
||||
INCS += $(COMMON_INC) \
|
||||
$(UAPI_INC)
|
||||
|
||||
#EXTRA_CFLAGS += $(INCS)
|
||||
ccflags-y += $(INCS)
|
||||
|
||||
|
||||
CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
|
||||
-DANI_LITTLE_BIT_ENDIAN \
|
||||
-DDOT11F_LITTLE_ENDIAN_HOST \
|
||||
-DANI_COMPILER_TYPE_GCC \
|
||||
-DANI_OS_TYPE_ANDROID=6 \
|
||||
-DPTT_SOCK_SVC_ENABLE \
|
||||
-Wall\
|
||||
-Werror\
|
||||
-D__linux__
|
||||
|
||||
KBUILD_CPPFLAGS += $(CDEFINES)
|
||||
|
||||
# Currently, for versions of gcc which support it, the kernel Makefile
|
||||
# is disabling the maybe-uninitialized warning. Re-enable it for the
|
||||
# AUDIO driver. Note that we must use EXTRA_CFLAGS here so that it
|
||||
# will override the kernel settings.
|
||||
ifeq ($(call cc-option-yn, -Wmaybe-uninitialized),y)
|
||||
#EXTRA_CFLAGS += -Wmaybe-uninitialized
|
||||
ccflags-y += -Wmaybe-uninitialized
|
||||
endif
|
||||
#EXTRA_CFLAGS += -Wmissing-prototypes
|
||||
|
||||
ifeq ($(call cc-option-yn, -Wheader-guard),y)
|
||||
#EXTRA_CFLAGS += -Wheader-guard
|
||||
ccflags-y += -Wheader-guard
|
||||
endif
|
||||
|
||||
ifeq ($(KERNEL_BUILD), 0)
|
||||
KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/ipc/Module.symvers
|
||||
KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/dsp/Module.symvers
|
||||
KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/Module.symvers
|
||||
KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/asoc/codecs/Module.symvers
|
||||
KBUILD_EXTRA_SYMBOLS +=$(OUT)/obj/vendor/qcom/opensource/audio-kernel/soc/Module.symvers
|
||||
endif
|
||||
|
||||
# Module information used by KBuild framework
|
||||
obj-$(CONFIG_SND_SOC_EP92) += ep92_dlkm.o
|
||||
ep92_dlkm-y := $(EP92_OBJS)
|
||||
|
||||
# inject some build related information
|
||||
DEFINES += -DBUILD_TIMESTAMP=\"$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')\"
|
||||
1382
asoc/codecs/ep92/ep92.c
Normal file
1382
asoc/codecs/ep92/ep92.c
Normal file
File diff suppressed because it is too large
Load diff
202
asoc/codecs/ep92/ep92.h
Normal file
202
asoc/codecs/ep92/ep92.h
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
/*
|
||||
* Copyright (c) 2018, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
* only version 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef __EP92_H__
|
||||
#define __EP92_H__
|
||||
|
||||
/* EP92 register addresses */
|
||||
/* BI = Basic Info */
|
||||
#define EP92_BI_VENDOR_ID_0 0x00
|
||||
#define EP92_BI_VENDOR_ID_1 0x01
|
||||
#define EP92_BI_DEVICE_ID_0 0x02
|
||||
#define EP92_BI_DEVICE_ID_1 0x03
|
||||
#define EP92_BI_VERSION_NUM 0x04
|
||||
#define EP92_BI_VERSION_YEAR 0x05
|
||||
#define EP92_BI_VERSION_MONTH 0x06
|
||||
#define EP92_BI_VERSION_DATE 0x07
|
||||
#define EP92_BI_GENERAL_INFO_0 0x08
|
||||
#define EP92_BI_GENERAL_INFO_1 0x09
|
||||
#define EP92_BI_GENERAL_INFO_2 0x0A
|
||||
#define EP92_BI_GENERAL_INFO_3 0x0B
|
||||
#define EP92_BI_GENERAL_INFO_4 0x0C
|
||||
#define EP92_BI_GENERAL_INFO_5 0x0D
|
||||
#define EP92_BI_GENERAL_INFO_6 0x0E
|
||||
|
||||
#define EP92_ISP_MODE_ENTER_ISP 0x0F
|
||||
|
||||
#define EP92_GENERAL_CONTROL_0 0x10
|
||||
#define EP92_GENERAL_CONTROL_1 0x11
|
||||
#define EP92_GENERAL_CONTROL_2 0x12
|
||||
#define EP92_GENERAL_CONTROL_3 0x13
|
||||
#define EP92_GENERAL_CONTROL_4 0x14
|
||||
|
||||
#define EP92_CEC_EVENT_CODE 0x15
|
||||
#define EP92_CEC_EVENT_PARAM_1 0x16
|
||||
#define EP92_CEC_EVENT_PARAM_2 0x17
|
||||
#define EP92_CEC_EVENT_PARAM_3 0x18
|
||||
#define EP92_CEC_EVENT_PARAM_4 0x19
|
||||
/* RESERVED 0x1A */
|
||||
/* ... ... */
|
||||
/* RESERVED 0x1F */
|
||||
#define EP92_AUDIO_INFO_SYSTEM_STATUS_0 0x20
|
||||
#define EP92_AUDIO_INFO_SYSTEM_STATUS_1 0x21
|
||||
#define EP92_AUDIO_INFO_AUDIO_STATUS 0x22
|
||||
#define EP92_AUDIO_INFO_CHANNEL_STATUS_0 0x23
|
||||
#define EP92_AUDIO_INFO_CHANNEL_STATUS_1 0x24
|
||||
#define EP92_AUDIO_INFO_CHANNEL_STATUS_2 0x25
|
||||
#define EP92_AUDIO_INFO_CHANNEL_STATUS_3 0x26
|
||||
#define EP92_AUDIO_INFO_CHANNEL_STATUS_4 0x27
|
||||
#define EP92_AUDIO_INFO_ADO_INFO_FRAME_0 0x28
|
||||
#define EP92_AUDIO_INFO_ADO_INFO_FRAME_1 0x29
|
||||
#define EP92_AUDIO_INFO_ADO_INFO_FRAME_2 0x2A
|
||||
#define EP92_AUDIO_INFO_ADO_INFO_FRAME_3 0x2B
|
||||
#define EP92_AUDIO_INFO_ADO_INFO_FRAME_4 0x2C
|
||||
#define EP92_AUDIO_INFO_ADO_INFO_FRAME_5 0x2D
|
||||
|
||||
#define EP92_OTHER_PACKETS_HDMI_VS_0 0x2E
|
||||
#define EP92_OTHER_PACKETS_HDMI_VS_1 0x2F
|
||||
#define EP92_OTHER_PACKETS_ACP_PACKET 0x30
|
||||
#define EP92_OTHER_PACKETS_AVI_INFO_FRAME_0 0x31
|
||||
#define EP92_OTHER_PACKETS_AVI_INFO_FRAME_1 0x32
|
||||
#define EP92_OTHER_PACKETS_AVI_INFO_FRAME_2 0x33
|
||||
#define EP92_OTHER_PACKETS_AVI_INFO_FRAME_3 0x34
|
||||
#define EP92_OTHER_PACKETS_AVI_INFO_FRAME_4 0x35
|
||||
#define EP92_OTHER_PACKETS_GC_PACKET_0 0x36
|
||||
#define EP92_OTHER_PACKETS_GC_PACKET_1 0x37
|
||||
#define EP92_OTHER_PACKETS_GC_PACKET_2 0x38
|
||||
|
||||
#define EP92_MAX_REGISTER_ADDR EP92_OTHER_PACKETS_GC_PACKET_2
|
||||
|
||||
|
||||
/* EP92 register default values */
|
||||
static struct reg_default ep92_reg_defaults[] = {
|
||||
{EP92_BI_VENDOR_ID_0, 0x17},
|
||||
{EP92_BI_VENDOR_ID_1, 0x7A},
|
||||
{EP92_BI_DEVICE_ID_0, 0x94},
|
||||
{EP92_BI_DEVICE_ID_1, 0xA3},
|
||||
{EP92_BI_VERSION_NUM, 0x10},
|
||||
{EP92_BI_VERSION_YEAR, 0x09},
|
||||
{EP92_BI_VERSION_MONTH, 0x07},
|
||||
{EP92_BI_VERSION_DATE, 0x06},
|
||||
{EP92_BI_GENERAL_INFO_0, 0x00},
|
||||
{EP92_BI_GENERAL_INFO_1, 0x00},
|
||||
{EP92_BI_GENERAL_INFO_2, 0x00},
|
||||
{EP92_BI_GENERAL_INFO_3, 0x00},
|
||||
{EP92_BI_GENERAL_INFO_4, 0x00},
|
||||
{EP92_BI_GENERAL_INFO_5, 0x00},
|
||||
{EP92_BI_GENERAL_INFO_6, 0x00},
|
||||
{EP92_ISP_MODE_ENTER_ISP, 0x00},
|
||||
{EP92_GENERAL_CONTROL_0, 0x20},
|
||||
{EP92_GENERAL_CONTROL_1, 0x00},
|
||||
{EP92_GENERAL_CONTROL_2, 0x00},
|
||||
{EP92_GENERAL_CONTROL_3, 0x10},
|
||||
{EP92_GENERAL_CONTROL_4, 0x00},
|
||||
{EP92_CEC_EVENT_CODE, 0x00},
|
||||
{EP92_CEC_EVENT_PARAM_1, 0x00},
|
||||
{EP92_CEC_EVENT_PARAM_2, 0x00},
|
||||
{EP92_CEC_EVENT_PARAM_3, 0x00},
|
||||
{EP92_CEC_EVENT_PARAM_4, 0x00},
|
||||
{EP92_AUDIO_INFO_SYSTEM_STATUS_0, 0x00},
|
||||
{EP92_AUDIO_INFO_SYSTEM_STATUS_1, 0x00},
|
||||
{EP92_AUDIO_INFO_AUDIO_STATUS, 0x00},
|
||||
{EP92_AUDIO_INFO_CHANNEL_STATUS_0, 0x00},
|
||||
{EP92_AUDIO_INFO_CHANNEL_STATUS_1, 0x00},
|
||||
{EP92_AUDIO_INFO_CHANNEL_STATUS_2, 0x00},
|
||||
{EP92_AUDIO_INFO_CHANNEL_STATUS_3, 0x00},
|
||||
{EP92_AUDIO_INFO_CHANNEL_STATUS_4, 0x00},
|
||||
{EP92_AUDIO_INFO_ADO_INFO_FRAME_0, 0x00},
|
||||
{EP92_AUDIO_INFO_ADO_INFO_FRAME_1, 0x00},
|
||||
{EP92_AUDIO_INFO_ADO_INFO_FRAME_2, 0x00},
|
||||
{EP92_AUDIO_INFO_ADO_INFO_FRAME_3, 0x00},
|
||||
{EP92_AUDIO_INFO_ADO_INFO_FRAME_4, 0x00},
|
||||
{EP92_AUDIO_INFO_ADO_INFO_FRAME_5, 0x00},
|
||||
{EP92_OTHER_PACKETS_HDMI_VS_0, 0x00},
|
||||
{EP92_OTHER_PACKETS_HDMI_VS_1, 0x00},
|
||||
{EP92_OTHER_PACKETS_ACP_PACKET, 0x00},
|
||||
{EP92_OTHER_PACKETS_AVI_INFO_FRAME_0, 0x00},
|
||||
{EP92_OTHER_PACKETS_AVI_INFO_FRAME_1, 0x00},
|
||||
{EP92_OTHER_PACKETS_AVI_INFO_FRAME_2, 0x00},
|
||||
{EP92_OTHER_PACKETS_AVI_INFO_FRAME_3, 0x00},
|
||||
{EP92_OTHER_PACKETS_AVI_INFO_FRAME_4, 0x00},
|
||||
{EP92_OTHER_PACKETS_GC_PACKET_0, 0x00},
|
||||
{EP92_OTHER_PACKETS_GC_PACKET_1, 0x00},
|
||||
{EP92_OTHER_PACKETS_GC_PACKET_2, 0x00},
|
||||
};
|
||||
|
||||
|
||||
/* shift/masks for register bits
|
||||
* GI = General Info
|
||||
* GC = General Control
|
||||
* AI = Audio Info
|
||||
*/
|
||||
#define EP92_GI_ADO_CHF_MASK 0x01
|
||||
#define EP92_GI_CEC_ECF_MASK 0x02
|
||||
#define EP92_GC_POWER_SHIFT 7
|
||||
#define EP92_GC_POWER_MASK 0x80
|
||||
#define EP92_GC_AUDIO_PATH_SHIFT 5
|
||||
#define EP92_GC_AUDIO_PATH_MASK 0x20
|
||||
#define EP92_GC_CEC_MUTE_SHIFT 1
|
||||
#define EP92_GC_CEC_MUTE_MASK 0x02
|
||||
#define EP92_GC_ARC_EN_SHIFT 0
|
||||
#define EP92_GC_ARC_EN_MASK 0x01
|
||||
#define EP92_GC_RX_SEL_SHIFT 0
|
||||
#define EP92_GC_RX_SEL_MASK 0x07
|
||||
#define EP92_GC_CEC_VOLUME_SHIFT 0
|
||||
#define EP92_GC_CEC_VOLUME_MASK 0xff
|
||||
#define EP92_AI_MCLK_ON_SHIFT 6
|
||||
#define EP92_AI_MCLK_ON_MASK 0x40
|
||||
#define EP92_AI_AVMUTE_SHIFT 5
|
||||
#define EP92_AI_AVMUTE_MASK 0x20
|
||||
#define EP92_AI_LAYOUT_SHIFT 0
|
||||
#define EP92_AI_LAYOUT_MASK 0x01
|
||||
#define EP92_AI_HBR_ADO_SHIFT 5
|
||||
#define EP92_AI_HBR_ADO_MASK 0x20
|
||||
#define EP92_AI_STD_ADO_SHIFT 3
|
||||
#define EP92_AI_STD_ADO_MASK 0x08
|
||||
#define EP92_AI_RATE_MASK 0x07
|
||||
#define EP92_AI_NPCM_MASK 0x02
|
||||
#define EP92_AI_CH_COUNT_MASK 0x07
|
||||
#define EP92_AI_CH_ALLOC_MASK 0xff
|
||||
|
||||
#define EP92_2CHOICE_MASK 1
|
||||
#define EP92_GC_CEC_VOLUME_MIN 0
|
||||
#define EP92_GC_CEC_VOLUME_MAX 100
|
||||
#define EP92_AI_RATE_MIN 0
|
||||
#define EP92_AI_RATE_MAX 768000
|
||||
#define EP92_AI_CH_COUNT_MIN 0
|
||||
#define EP92_AI_CH_COUNT_MAX 8
|
||||
#define EP92_AI_CH_ALLOC_MIN 0
|
||||
#define EP92_AI_CH_ALLOC_MAX 0xff
|
||||
|
||||
#define EP92_STATUS_NO_SIGNAL 0
|
||||
#define EP92_STATUS_AUDIO_ACTIVE 1
|
||||
|
||||
/* kcontrol storage indices */
|
||||
enum {
|
||||
EP92_KCTL_POWER = 0,
|
||||
EP92_KCTL_AUDIO_PATH,
|
||||
EP92_KCTL_CEC_MUTE,
|
||||
EP92_KCTL_ARC_EN,
|
||||
EP92_KCTL_RX_SEL,
|
||||
EP92_KCTL_CEC_VOLUME,
|
||||
EP92_KCTL_STATE,
|
||||
EP92_KCTL_AVMUTE,
|
||||
EP92_KCTL_LAYOUT,
|
||||
EP92_KCTL_MODE,
|
||||
EP92_KCTL_RATE,
|
||||
EP92_KCTL_CH_COUNT,
|
||||
EP92_KCTL_CH_ALLOC,
|
||||
EP92_KCTL_MAX
|
||||
};
|
||||
|
||||
#endif /* __EP92_H__ */
|
||||
119
asoc/qcs405.c
119
asoc/qcs405.c
|
|
@ -16,6 +16,7 @@
|
|||
#include <linux/of_gpio.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/input.h>
|
||||
|
|
@ -8195,6 +8196,119 @@ static void msm_i2s_auxpcm_deinit(void)
|
|||
}
|
||||
}
|
||||
|
||||
static int msm_scan_i2c_addr(struct platform_device *pdev,
|
||||
uint32_t busnum, uint32_t addr)
|
||||
{
|
||||
struct i2c_adapter *adap;
|
||||
u8 rbuf;
|
||||
struct i2c_msg msg;
|
||||
int status = 0;
|
||||
|
||||
adap = i2c_get_adapter(busnum);
|
||||
if (!adap) {
|
||||
dev_err(&pdev->dev, "%s: Cannot get I2C adapter %d\n",
|
||||
__func__, busnum);
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
/* to test presence, read one byte from device */
|
||||
msg.addr = addr;
|
||||
msg.flags = I2C_M_RD;
|
||||
msg.len = 1;
|
||||
msg.buf = &rbuf;
|
||||
|
||||
status = i2c_transfer(adap, &msg, 1);
|
||||
|
||||
i2c_put_adapter(adap);
|
||||
|
||||
if (status != 1) {
|
||||
dev_dbg(&pdev->dev, "%s: I2C read from addr 0x%02x failed\n",
|
||||
__func__, addr);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
dev_dbg(&pdev->dev, "%s: I2C read from addr 0x%02x successful\n",
|
||||
__func__, addr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_detect_ep92_dev(struct platform_device *pdev,
|
||||
struct snd_soc_card *card)
|
||||
{
|
||||
int i;
|
||||
uint32_t ep92_busnum = 0;
|
||||
uint32_t ep92_reg = 0;
|
||||
const char *ep92_name = NULL;
|
||||
struct snd_soc_dai_link *dai;
|
||||
int rc = 0;
|
||||
|
||||
rc = of_property_read_u32(pdev->dev.of_node, "qcom,ep92-busnum",
|
||||
&ep92_busnum);
|
||||
if (rc) {
|
||||
dev_info(&pdev->dev, "%s: No DT match ep92-reg\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
rc = of_property_read_u32(pdev->dev.of_node, "qcom,ep92-reg",
|
||||
&ep92_reg);
|
||||
if (rc) {
|
||||
dev_info(&pdev->dev, "%s: No DT match ep92-busnum\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
rc = of_property_read_string(pdev->dev.of_node, "qcom,ep92-name",
|
||||
&ep92_name);
|
||||
if (rc) {
|
||||
dev_info(&pdev->dev, "%s: No DT match ep92-name\n", __func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* check I2C bus for connected ep92 chip */
|
||||
if (msm_scan_i2c_addr(pdev, ep92_busnum, ep92_reg) < 0) {
|
||||
/* check a second time after a short delay */
|
||||
msleep(20);
|
||||
if (msm_scan_i2c_addr(pdev, ep92_busnum, ep92_reg) < 0) {
|
||||
dev_info(&pdev->dev, "%s: No ep92 device found\n",
|
||||
__func__);
|
||||
/* continue with snd_card registration without ep92 */
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
dev_info(&pdev->dev, "%s: ep92 device found\n", __func__);
|
||||
|
||||
/* update codec info in MI2S dai link */
|
||||
dai = &msm_mi2s_be_dai_links[0];
|
||||
for (i=0; i<ARRAY_SIZE(msm_mi2s_be_dai_links); i++) {
|
||||
if (strcmp(dai->name, LPASS_BE_SEC_MI2S_TX) == 0) {
|
||||
dev_dbg(&pdev->dev,
|
||||
"%s: Set Sec MI2S dai to ep92 codec\n",
|
||||
__func__);
|
||||
dai->codec_name = ep92_name;
|
||||
dai->codec_dai_name = "ep92-hdmi";
|
||||
break;
|
||||
}
|
||||
dai++;
|
||||
}
|
||||
|
||||
/* update codec info in SPDIF dai link */
|
||||
dai = &msm_spdif_be_dai_links[0];
|
||||
for (i=0; i<ARRAY_SIZE(msm_spdif_be_dai_links); i++) {
|
||||
if (strcmp(dai->name, LPASS_BE_SEC_SPDIF_TX) == 0) {
|
||||
dev_dbg(&pdev->dev,
|
||||
"%s: Set Sec SPDIF dai to ep92 codec\n",
|
||||
__func__);
|
||||
dai->codec_name = ep92_name;
|
||||
dai->codec_dai_name = "ep92-arc";
|
||||
break;
|
||||
}
|
||||
dai++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int msm_asoc_machine_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct snd_soc_card *card;
|
||||
|
|
@ -8212,6 +8326,11 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
|
|||
if (!pdata)
|
||||
return -ENOMEM;
|
||||
|
||||
/* test for ep92 HDMI bridge and update dai links accordingly */
|
||||
ret = msm_detect_ep92_dev(pdev, card);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
card = populate_snd_card_dailinks(&pdev->dev);
|
||||
if (!card) {
|
||||
dev_err(&pdev->dev, "%s: Card uninitialized\n", __func__);
|
||||
|
|
|
|||
|
|
@ -34,3 +34,4 @@ CONFIG_DTS_SRS_TM=m
|
|||
CONFIG_SND_SOC_MSM_STUB=m
|
||||
CONFIG_MSM_AVTIMER=m
|
||||
CONFIG_SND_SOC_MSM_HDMI_CODEC_RX=m
|
||||
CONFIG_SND_SOC_EP92=m
|
||||
|
|
|
|||
|
|
@ -46,3 +46,4 @@
|
|||
#define CONFIG_SND_SOC_MSM_STUB 1
|
||||
#define CONFIG_MSM_AVTIMER 1
|
||||
#define CONFIG_SND_SOC_MSM_HDMI_CODEC_RX 1
|
||||
#define CONFIG_SND_SOC_EP92 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue