2017-12-25 20:54:33 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
//
|
|
|
|
// Copyright 2009 Wolfson Microelectronics
|
|
|
|
// Mark Brown <broonie@opensource.wolfsonmicro.com>
|
2009-06-03 20:08:38 +01:00
|
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/string.h>
|
|
|
|
#include <linux/platform_device.h>
|
2010-02-12 10:38:51 +00:00
|
|
|
#include <linux/dma-mapping.h>
|
2010-08-05 07:54:49 +09:00
|
|
|
#include <linux/gpio.h>
|
2011-07-31 16:17:29 -04:00
|
|
|
#include <linux/export.h>
|
2009-06-03 20:08:38 +01:00
|
|
|
|
2022-04-02 15:28:18 +02:00
|
|
|
#include "irqs.h"
|
2019-09-02 18:37:30 +02:00
|
|
|
#include "map.h"
|
2009-06-03 20:08:38 +01:00
|
|
|
|
2019-09-02 18:37:30 +02:00
|
|
|
#include "devs.h"
|
2012-08-24 15:22:12 +02:00
|
|
|
#include <linux/platform_data/asoc-s3c.h>
|
2019-09-02 18:37:30 +02:00
|
|
|
#include "gpio-cfg.h"
|
|
|
|
#include "gpio-samsung.h"
|
2009-06-03 20:08:38 +01:00
|
|
|
|
2010-11-19 08:49:44 +09:00
|
|
|
static int s3c64xx_i2s_cfg_gpio(struct platform_device *pdev)
|
2010-01-06 15:33:44 +09:00
|
|
|
{
|
2010-05-27 15:54:06 +09:00
|
|
|
unsigned int base;
|
|
|
|
|
2010-01-06 15:33:44 +09:00
|
|
|
switch (pdev->id) {
|
|
|
|
case 0:
|
2010-05-27 15:54:06 +09:00
|
|
|
base = S3C64XX_GPD(0);
|
2010-01-06 15:33:44 +09:00
|
|
|
break;
|
|
|
|
case 1:
|
2010-05-27 15:54:06 +09:00
|
|
|
base = S3C64XX_GPE(0);
|
2010-08-26 16:07:23 +01:00
|
|
|
break;
|
2010-11-19 08:49:44 +09:00
|
|
|
case 2:
|
|
|
|
s3c_gpio_cfgpin(S3C64XX_GPC(4), S3C_GPIO_SFN(5));
|
|
|
|
s3c_gpio_cfgpin(S3C64XX_GPC(5), S3C_GPIO_SFN(5));
|
|
|
|
s3c_gpio_cfgpin(S3C64XX_GPC(7), S3C_GPIO_SFN(5));
|
|
|
|
s3c_gpio_cfgpin_range(S3C64XX_GPH(6), 4, S3C_GPIO_SFN(5));
|
|
|
|
return 0;
|
2010-01-06 15:33:44 +09:00
|
|
|
default:
|
2010-08-26 16:07:23 +01:00
|
|
|
printk(KERN_DEBUG "Invalid I2S Controller number: %d\n",
|
|
|
|
pdev->id);
|
2010-01-06 15:33:44 +09:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2010-05-27 15:54:06 +09:00
|
|
|
s3c_gpio_cfgpin_range(base, 5, S3C_GPIO_SFN(3));
|
|
|
|
|
2010-01-06 15:33:44 +09:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-06-03 20:08:38 +01:00
|
|
|
static struct resource s3c64xx_iis0_resource[] = {
|
2012-05-12 16:12:25 +09:00
|
|
|
[0] = DEFINE_RES_MEM(S3C64XX_PA_IIS0, SZ_256),
|
2010-01-06 15:33:44 +09:00
|
|
|
};
|
|
|
|
|
2015-11-18 15:25:23 +01:00
|
|
|
static struct s3c_audio_pdata i2s0_pdata = {
|
2010-11-19 08:49:44 +09:00
|
|
|
.cfg_gpio = s3c64xx_i2s_cfg_gpio,
|
2009-06-03 20:08:38 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct platform_device s3c64xx_device_iis0 = {
|
2010-11-19 08:49:43 +09:00
|
|
|
.name = "samsung-i2s",
|
2009-06-03 20:08:38 +01:00
|
|
|
.id = 0,
|
|
|
|
.num_resources = ARRAY_SIZE(s3c64xx_iis0_resource),
|
|
|
|
.resource = s3c64xx_iis0_resource,
|
2010-01-06 15:33:44 +09:00
|
|
|
.dev = {
|
2015-11-18 15:25:23 +01:00
|
|
|
.platform_data = &i2s0_pdata,
|
2010-01-06 15:33:44 +09:00
|
|
|
},
|
2009-06-03 20:08:38 +01:00
|
|
|
};
|
|
|
|
EXPORT_SYMBOL(s3c64xx_device_iis0);
|
|
|
|
|
|
|
|
static struct resource s3c64xx_iis1_resource[] = {
|
2012-05-12 16:12:25 +09:00
|
|
|
[0] = DEFINE_RES_MEM(S3C64XX_PA_IIS1, SZ_256),
|
2015-11-18 15:25:23 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct s3c_audio_pdata i2s1_pdata = {
|
|
|
|
.cfg_gpio = s3c64xx_i2s_cfg_gpio,
|
2010-01-06 15:33:44 +09:00
|
|
|
};
|
|
|
|
|
2009-06-03 20:08:38 +01:00
|
|
|
struct platform_device s3c64xx_device_iis1 = {
|
2010-11-19 08:49:43 +09:00
|
|
|
.name = "samsung-i2s",
|
2009-06-03 20:08:38 +01:00
|
|
|
.id = 1,
|
|
|
|
.num_resources = ARRAY_SIZE(s3c64xx_iis1_resource),
|
|
|
|
.resource = s3c64xx_iis1_resource,
|
2010-01-06 15:33:44 +09:00
|
|
|
.dev = {
|
2015-11-18 15:25:23 +01:00
|
|
|
.platform_data = &i2s1_pdata,
|
2010-01-06 15:33:44 +09:00
|
|
|
},
|
2009-06-03 20:08:38 +01:00
|
|
|
};
|
|
|
|
EXPORT_SYMBOL(s3c64xx_device_iis1);
|