Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit 7c1d5bb

Browse files
wangyiyangazhenmingx
authored andcommitted
adc: port cloverview adc driver
port K3.4 adc driver of cloverview platform to K3.10 Signed-off-by: Wang Yiyang <yiyang.wang@intel.com>
1 parent c50f014 commit 7c1d5bb

8 files changed

Lines changed: 1314 additions & 1 deletion

File tree

arch/x86/include/asm/intel-mid.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ static inline int get_gpio_by_name(const char *name) { return -1; }
2828
extern int intel_mid_pci_init(void);
2929
extern void intel_delayed_device_register(void *dev,
3030
void (*delayed_callback)(void *dev_desc));
31+
extern void install_irq_resource(struct platform_device *pdev, int irq);
3132
extern void intel_scu_device_register(struct platform_device *pdev);
3233
extern struct devs_id *get_device_id(u8 type, char *name);
3334
extern int __init sfi_parse_mrtc(struct sfi_table_header *table);
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#ifndef __INTEL_MID_GPADC_H__
2+
#define __INTEL_MID_GPADC_H__
3+
4+
struct intel_mid_gpadc_platform_data {
5+
unsigned long intr;
6+
};
7+
8+
#define CH_NEED_VREF (1 << 8)
9+
#define CH_NEED_VCALIB (1 << 9)
10+
#define CH_NEED_ICALIB (1 << 10)
11+
12+
int intel_mid_gpadc_gsmpulse_sample(int *vol, int *cur);
13+
int intel_mid_gpadc_sample(void *handle, int sample_count, ...);
14+
int get_gpadc_sample(void *handle, int sample_count, int *buffer);
15+
void intel_mid_gpadc_free(void *handle);
16+
void *intel_mid_gpadc_alloc(int count, ...);
17+
void *gpadc_alloc_channels(int count, int *channel_info);
18+
#endif
19+
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* platform_msic_adc.c: MSIC ADC platform data initilization file
3+
*
4+
* (C) Copyright 2008 Intel Corporation
5+
* Author:
6+
*
7+
* This program is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU General Public License
9+
* as published by the Free Software Foundation; version 2
10+
* of the License.
11+
*/
12+
13+
#include <linux/kernel.h>
14+
#include <linux/interrupt.h>
15+
#include <linux/scatterlist.h>
16+
#include <linux/init.h>
17+
#include <linux/sfi.h>
18+
#include <asm/intel-mid.h>
19+
#include <asm/intel_mid_gpadc.h>
20+
#include <asm/intel_mid_remoteproc.h>
21+
#include "platform_msic.h"
22+
#include "platform_msic_adc.h"
23+
24+
void __init *msic_adc_platform_data(void *info)
25+
{
26+
struct platform_device *pdev = NULL;
27+
struct sfi_device_table_entry *entry = info;
28+
static struct intel_mid_gpadc_platform_data msic_adc_pdata;
29+
int ret = 0;
30+
31+
pdev = platform_device_alloc(ADC_DEVICE_NAME, -1);
32+
33+
if (!pdev) {
34+
pr_err("out of memory for SFI platform dev %s\n",
35+
ADC_DEVICE_NAME);
36+
goto out;
37+
}
38+
39+
msic_adc_pdata.intr = 0xffff7fc0;
40+
41+
pdev->dev.platform_data = &msic_adc_pdata;
42+
43+
ret = platform_device_add(pdev);
44+
if (ret) {
45+
pr_err("failed to add adc platform device\n");
46+
platform_device_put(pdev);
47+
goto out;
48+
}
49+
50+
install_irq_resource(pdev, entry->irq);
51+
52+
register_rpmsg_service("rpmsg_msic_adc", RPROC_SCU,
53+
RP_MSIC_ADC);
54+
out:
55+
return &msic_adc_pdata;
56+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* platform_msic_adc.h: MSIC ADC platform data header file
3+
*
4+
* (C) Copyright 2008 Intel Corporation
5+
* Author:
6+
*
7+
* This program is free software; you can redistribute it and/or
8+
* modify it under the terms of the GNU General Public License
9+
* as published by the Free Software Foundation; version 2
10+
* of the License.
11+
*/
12+
#ifndef _PLATFORM_MSIC_ADC_H_
13+
#define _PLATFORM_MSIC_ADC_H_
14+
15+
#define ADC_DEVICE_NAME "msic_adc"
16+
17+
extern void __init *msic_adc_platform_data(void *info) __attribute__((weak));
18+
#endif

arch/x86/platform/intel-mid/intel_mid_sfi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ void intel_scu_devices_destroy(void)
317317
}
318318
EXPORT_SYMBOL_GPL(intel_scu_devices_destroy);
319319

320-
static void __init install_irq_resource(struct platform_device *pdev, int irq)
320+
void __init install_irq_resource(struct platform_device *pdev, int irq)
321321
{
322322
/* Single threaded */
323323
static struct resource __initdata res = {

drivers/hwmon/Kconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,12 @@ config SENSORS_LM95245
822822
This driver can also be built as a module. If so, the module
823823
will be called lm95245.
824824

825+
config MSIC_GPADC
826+
tristate "MSIC GPADC driver for Intel Medfield platform"
827+
depends on INTEL_SCU_IPC
828+
help
829+
Say Y here to enable MSIC GPADC driver on Intel Medfield Platform
830+
825831
config SENSORS_MAX1111
826832
tristate "Maxim MAX1111 Serial 8-bit ADC chip and compatibles"
827833
depends on SPI_MASTER

drivers/hwmon/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o
140140
obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o
141141
obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o
142142
obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o
143+
obj-$(CONFIG_MSIC_GPADC) += intel_mid_gpadc.o
143144

144145
obj-$(CONFIG_PMBUS) += pmbus/
145146

0 commit comments

Comments
 (0)