platform/x86/sony-laptop: Remove unused sony laptop camera code
Subsystems (2)
PATCH 1/1 platform/x86/sony-laptop: Remove unused sony laptop camera code
From: "Dr. David Alan Gilbert" <[email protected]>
commit ba47652ba655 ("media: meye: remove this deprecated driver") removed the meye driver but left behind the code in sony-laptop.c which that driver used to call.
Remove the sony_pic_camera_command() function, and the set of defines (SONY_PIC_COMMAND_*) in a header used for the interface and the static helpers it called.
--- MAINTAINERS | 1 - drivers/platform/x86/sony-laptop.c | 135 ----------------------------- include/linux/sony-laptop.h | 39 --------- 3 files changed, 175 deletions(-) delete mode 100644 include/linux/sony-laptop.h
MAINTAINERS +0 -1
@@ -22671,7 +22671,6 @@ W: http://www.linux.it/~malattia/wiki/index.php/Sony_drivers F: Documentation/admin-guide/laptops/sony-laptop.rst F: drivers/char/sonypi.c F: drivers/platform/x86/sony-laptop.c -F: include/linux/sony-laptop.h SOPHGO DEVICETREES and DRIVERS M: Chen Wang <[email protected]>
drivers/platform/x86/sony-laptop.c +0 -135
153 lines not on this page · raw message
include/linux/sony-laptop.h deleted +0 -39
@@ -1,39 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _SONYLAPTOP_H_ -#define _SONYLAPTOP_H_ - -#include <linux/types.h> - -#ifdef __KERNEL__ - -/* used only for communication between v4l and sony-laptop */ - -#define SONY_PIC_COMMAND_GETCAMERA 1/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERA 2 -#define SONY_PIC_COMMAND_GETCAMERABRIGHTNESS 3/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERABRIGHTNESS 4 -#define SONY_PIC_COMMAND_GETCAMERACONTRAST 5/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERACONTRAST 6 -#define SONY_PIC_COMMAND_GETCAMERAHUE 7/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERAHUE 8 -#define SONY_PIC_COMMAND_GETCAMERACOLOR 9/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERACOLOR 10 -#define SONY_PIC_COMMAND_GETCAMERASHARPNESS 11/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERASHARPNESS 12 -#define SONY_PIC_COMMAND_GETCAMERAPICTURE 13/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERAPICTURE 14 -#define SONY_PIC_COMMAND_GETCAMERAAGC 15/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERAAGC 16 -#define SONY_PIC_COMMAND_GETCAMERADIRECTION 17/* obsolete */ -#define SONY_PIC_COMMAND_GETCAMERAROMVERSION 18/* obsolete */ -#define SONY_PIC_COMMAND_GETCAMERAREVISION 19/* obsolete */ - -#if IS_ENABLED (CONFIG_SONY_LAPTOP ) -int sony_pic_camera_command (int command,u8 value); -#else -static inline int sony_pic_camera_command (int command,u8 value) {return 0 ; } -#endif - -#endif /* __KERNEL__ */ - -#endif /* _SONYLAPTOP_H_ */
Signature · 1 line
2.49.0
Ilpo Järvinen
maintainerQuoted 167 lines · On Mon, 5 May 2025, [email protected] wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
commit
ba47652ba655("media: meye: remove this deprecated driver") removed the meye driver but left behind the code insony-laptop.cwhich that driver used to call.Remove the
sony_pic_camera_command()function, and the set of defines (SONY_PIC_COMMAND_*) in a header used for the interface and the static helpers it called.Signed-off-by Dr. David Alan Gilbert <[email protected]>--- MAINTAINERS | 1 - drivers/platform/x86/sony-laptop.c | 135 ----------------------------- include/linux/sony-laptop.h | 39 --------- 3 files changed, 175 deletions(-) delete mode 100644 include/linux/sony-laptop.hMAINTAINERS +0
-1@@ -22671,7 +22671,6 @@ W: http://www.linux.it/~malattia/wiki/index.php/Sony_drivers F: Documentation/admin-guide/laptops/sony-laptop.rst F: drivers/char/sonypi.c F: drivers/platform/x86/sony-laptop.c -F: include/linux/sony-laptop.h SOPHGO DEVICETREES and DRIVERS M: Chen Wang <[email protected]>drivers/platform/x86/sony-laptop.c +0
-115@@ -48,7 +48,6 @@#include <linux/acpi.h> #include <linux/slab.h> #include <linux/sonypi.h> -#include <linux/sony-laptop.h> #include <linux/rfkill.h> #ifdef CONFIG_SONYPI_COMPAT #include <linux/poll.h> @@ -3619,22 +3618,6 @@ static u8 sony_pic_call2(u8 dev, u8 fn)return v1; } -static u8 sony_pic_call3 (u8 dev,u8 fn,u8 v) -{ -u8 v1; - -wait_on_command (inb_p (spic_dev.cur_ioport->io1.minimum +4 ) &2 ,ITERATIONS_LONG ); -outb (dev, spic_dev.cur_ioport->io1.minimum +4 ); -wait_on_command (inb_p (spic_dev.cur_ioport->io1.minimum +4 ) &2 ,ITERATIONS_LONG ); -outb (fn, spic_dev.cur_ioport->io1.minimum); -wait_on_command (inb_p (spic_dev.cur_ioport->io1.minimum +4 ) &2 ,ITERATIONS_LONG ); -outb (v, spic_dev.cur_ioport->io1.minimum); - v1 =inb_p (spic_dev.cur_ioport->io1.minimum); -dprintk ("sony_pic_call3(0x%.2x - 0x%.2x - 0x%.2x): 0x%.4x\n" , - dev, fn, v, v1); -return v1; -} -/* * minidrivers for SPIC models */ @@ -3754,124 +3737,6 @@ static void sony_pic_detect_device_type(struct sony_pic_dev *dev)#define SONYPI_CAMERA_REVISION 8#define SONYPI_CAMERA_ROMVERSION 9 -static int __sony_pic_camera_ready (void ) -{ -u8 v; - - v =sony_pic_call2 (0x8f ,SONYPI_CAMERA_STATUS ); -return (v !=0xff && (v &SONYPI_CAMERA_STATUS_READY )); -} - -static int __sony_pic_camera_off (void ) -{ -if (!camera) { -pr_warn ("camera control not enabled\n" ); -return -ENODEV ; - } - -wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_PICTURE , -SONYPI_CAMERA_MUTE_MASK ), -ITERATIONS_SHORT ); - -if (spic_dev.camera_power) { -sony_pic_call2 (0x91 ,0 ); - spic_dev.camera_power =0 ; - } -return 0 ; -} - -static int __sony_pic_camera_on (void ) -{ -int i, j, x; - -if (!camera) { -pr_warn ("camera control not enabled\n" ); -return -ENODEV ; - } - -if (spic_dev.camera_power) -return 0 ; - -for (j =5 ; j >0 ; j--) { - -for (x =0 ; x <100 &&sony_pic_call2 (0x91 ,0x1 ); x++) -msleep (10 ); -sony_pic_call1 (0x93 ); - -for (i =400 ; i >0 ; i--) { -if (__sony_pic_camera_ready ()) -break ; -msleep (10 ); - } -if (i) -break ; - } - -if (j ==0 ) { -pr_warn ("failed to power on camera\n" ); -return -ENODEV ; - } - -wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_CONTROL , -0x5a ), -ITERATIONS_SHORT ); - - spic_dev.camera_power =1 ; -return 0 ; -} - -/* External camera command (exported to the motion eye v4l driver) */ -int sony_pic_camera_command (int command,u8 value) -{ -if (!camera) -return -EIO ; - -mutex_lock (&spic_dev.lock); - -switch (command) { -case SONY_PIC_COMMAND_SETCAMERA : -if (value) -__sony_pic_camera_on (); -else -__sony_pic_camera_off (); -break ; -case SONY_PIC_COMMAND_SETCAMERABRIGHTNESS : -wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_BRIGHTNESS , value), -ITERATIONS_SHORT ); -break ; -case SONY_PIC_COMMAND_SETCAMERACONTRAST : -wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_CONTRAST , value), -ITERATIONS_SHORT ); -break ; -case SONY_PIC_COMMAND_SETCAMERAHUE : -wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_HUE , value), -ITERATIONS_SHORT ); -break ; -case SONY_PIC_COMMAND_SETCAMERACOLOR : -wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_COLOR , value), -ITERATIONS_SHORT ); -break ; -case SONY_PIC_COMMAND_SETCAMERASHARPNESS :
drivers/platform/x86/sony-laptop.c static void sony_pic_detect_device_type(struct sony_pic_dev *dev) · line 3864
Quoted 10 lines
drivers/platform/x86/sony-laptop.c +0
-10-wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_SHARPNESS , value), -ITERATIONS_SHORT ); -break ; -case SONY_PIC_COMMAND_SETCAMERAPICTURE : -wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_PICTURE , value), -ITERATIONS_SHORT ); -break ; -case SONY_PIC_COMMAND_SETCAMERAAGC : -wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_AGC , value), -ITERATIONS_SHORT );
Hi,
Shouldn't sony_pic_call3() be removed too? AFAICT, all users are gone after this removal?
And what about SONYPI_CAMERA_* ? Also SONYPI_DIRECTION_BACKWARDS that is among the CAMERA defs seems unused.
Signature · 1 line
i.
Quoted 59 lines
drivers/platform/x86/sony-laptop.c +0
-10-break ; -default : -pr_err ("sony_pic_camera_command invalid: %d\n" , command); -break ; - } -mutex_unlock (&spic_dev.lock); -return 0 ; -} -EXPORT_SYMBOL (sony_pic_camera_command); -/* gprs/edge modem (SZ460N and SZ210P), thanks to Joshua Wise */ static void __sony_pic_set_wwanpower (u8 state) {include/linux/sony-laptop.h deleted +0
-39@@ -1,39 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _SONYLAPTOP_H_ -#define _SONYLAPTOP_H_ - -#include <linux/types.h> - -#ifdef __KERNEL__ - -/* used only for communication between v4l and sony-laptop */ - -#define SONY_PIC_COMMAND_GETCAMERA 1/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERA 2 -#define SONY_PIC_COMMAND_GETCAMERABRIGHTNESS 3/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERABRIGHTNESS 4 -#define SONY_PIC_COMMAND_GETCAMERACONTRAST 5/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERACONTRAST 6 -#define SONY_PIC_COMMAND_GETCAMERAHUE 7/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERAHUE 8 -#define SONY_PIC_COMMAND_GETCAMERACOLOR 9/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERACOLOR 10 -#define SONY_PIC_COMMAND_GETCAMERASHARPNESS 11/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERASHARPNESS 12 -#define SONY_PIC_COMMAND_GETCAMERAPICTURE 13/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERAPICTURE 14 -#define SONY_PIC_COMMAND_GETCAMERAAGC 15/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERAAGC 16 -#define SONY_PIC_COMMAND_GETCAMERADIRECTION 17/* obsolete */ -#define SONY_PIC_COMMAND_GETCAMERAROMVERSION 18/* obsolete */ -#define SONY_PIC_COMMAND_GETCAMERAREVISION 19/* obsolete */ - -#if IS_ENABLED (CONFIG_SONY_LAPTOP ) -int sony_pic_camera_command (int command,u8 value); -#else -static inline int sony_pic_camera_command (int command,u8 value) {return 0 ; } -#endif - -#endif /* __KERNEL__ */ - -#endif /* _SONYLAPTOP_H_ */
Quoted 173 lines · * Ilpo Järvinen ([email protected]) wrote:
Quoted 171 lines · On Mon, 5 May 2025, [email protected] wrote:
From: "Dr. David Alan Gilbert" <[email protected]>
commit
ba47652ba655("media: meye: remove this deprecated driver") removed the meye driver but left behind the code insony-laptop.cwhich that driver used to call.Remove the
sony_pic_camera_command()function, and the set of defines (SONY_PIC_COMMAND_*) in a header used for the interface and the static helpers it called.Signed-off-by Dr. David Alan Gilbert <[email protected]>--- MAINTAINERS | 1 - drivers/platform/x86/sony-laptop.c | 135 ----------------------------- include/linux/sony-laptop.h | 39 --------- 3 files changed, 175 deletions(-) delete mode 100644 include/linux/sony-laptop.hMAINTAINERS +0
-1@@ -22671,7 +22671,6 @@ W: http://www.linux.it/~malattia/wiki/index.php/Sony_drivers F: Documentation/admin-guide/laptops/sony-laptop.rst F: drivers/char/sonypi.c F: drivers/platform/x86/sony-laptop.c -F: include/linux/sony-laptop.h SOPHGO DEVICETREES and DRIVERS M: Chen Wang <[email protected]>drivers/platform/x86/sony-laptop.c +0
-119@@ -48,7 +48,6 @@#include <linux/acpi.h> #include <linux/slab.h> #include <linux/sonypi.h> -#include <linux/sony-laptop.h> #include <linux/rfkill.h> #ifdef CONFIG_SONYPI_COMPAT #include <linux/poll.h> @@ -3619,22 +3618,6 @@ static u8 sony_pic_call2(u8 dev, u8 fn)return v1; } -static u8 sony_pic_call3 (u8 dev,u8 fn,u8 v) -{ -u8 v1; - -wait_on_command (inb_p (spic_dev.cur_ioport->io1.minimum +4 ) &2 ,ITERATIONS_LONG ); -outb (dev, spic_dev.cur_ioport->io1.minimum +4 ); -wait_on_command (inb_p (spic_dev.cur_ioport->io1.minimum +4 ) &2 ,ITERATIONS_LONG ); -outb (fn, spic_dev.cur_ioport->io1.minimum); -wait_on_command (inb_p (spic_dev.cur_ioport->io1.minimum +4 ) &2 ,ITERATIONS_LONG ); -outb (v, spic_dev.cur_ioport->io1.minimum); - v1 =inb_p (spic_dev.cur_ioport->io1.minimum); -dprintk ("sony_pic_call3(0x%.2x - 0x%.2x - 0x%.2x): 0x%.4x\n" , - dev, fn, v, v1); -return v1; -} -/* * minidrivers for SPIC models */ @@ -3754,124 +3737,6 @@ static void sony_pic_detect_device_type(struct sony_pic_dev *dev)#define SONYPI_CAMERA_REVISION 8#define SONYPI_CAMERA_ROMVERSION 9 -static int __sony_pic_camera_ready (void ) -{ -u8 v; - - v =sony_pic_call2 (0x8f ,SONYPI_CAMERA_STATUS ); -return (v !=0xff && (v &SONYPI_CAMERA_STATUS_READY )); -} - -static int __sony_pic_camera_off (void ) -{ -if (!camera) { -pr_warn ("camera control not enabled\n" ); -return -ENODEV ; - } - -wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_PICTURE , -SONYPI_CAMERA_MUTE_MASK ), -ITERATIONS_SHORT ); - -if (spic_dev.camera_power) { -sony_pic_call2 (0x91 ,0 ); - spic_dev.camera_power =0 ; - } -return 0 ; -} - -static int __sony_pic_camera_on (void ) -{ -int i, j, x; - -if (!camera) { -pr_warn ("camera control not enabled\n" ); -return -ENODEV ; - } - -if (spic_dev.camera_power) -return 0 ; - -for (j =5 ; j >0 ; j--) { - -for (x =0 ; x <100 &&sony_pic_call2 (0x91 ,0x1 ); x++) -msleep (10 ); -sony_pic_call1 (0x93 ); - -for (i =400 ; i >0 ; i--) { -if (__sony_pic_camera_ready ()) -break ; -msleep (10 ); - } -if (i) -break ; - } - -if (j ==0 ) { -pr_warn ("failed to power on camera\n" ); -return -ENODEV ; - } - -wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_CONTROL , -0x5a ), -ITERATIONS_SHORT ); - - spic_dev.camera_power =1 ; -return 0 ; -} - -/* External camera command (exported to the motion eye v4l driver) */ -int sony_pic_camera_command (int command,u8 value) -{ -if (!camera) -return -EIO ; - -mutex_lock (&spic_dev.lock); - -switch (command) { -case SONY_PIC_COMMAND_SETCAMERA : -if (value) -__sony_pic_camera_on (); -else -__sony_pic_camera_off (); -break ; -case SONY_PIC_COMMAND_SETCAMERABRIGHTNESS : -wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_BRIGHTNESS , value), -ITERATIONS_SHORT ); -break ; -case SONY_PIC_COMMAND_SETCAMERACONTRAST : -wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_CONTRAST , value), -ITERATIONS_SHORT ); -break ; -case SONY_PIC_COMMAND_SETCAMERAHUE : -wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_HUE , value), -ITERATIONS_SHORT ); -break ; -case SONY_PIC_COMMAND_SETCAMERACOLOR : -wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_COLOR , value), -ITERATIONS_SHORT ); -break ; -case SONY_PIC_COMMAND_SETCAMERASHARPNESS : -wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_SHARPNESS , value), -ITERATIONS_SHORT ); -break ; -case SONY_PIC_COMMAND_SETCAMERAPICTURE :
Quoted 8 lines
drivers/platform/x86/sony-laptop.c static void sony_pic_detect_device_type(struct sony_pic_dev *dev) · line 3864
Quoted 6 lines
drivers/platform/x86/sony-laptop.c +0
-6-wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_PICTURE , value), -ITERATIONS_SHORT ); -break ; -case SONY_PIC_COMMAND_SETCAMERAAGC : -wait_on_command (sony_pic_call3 (0x90 ,SONYPI_CAMERA_AGC , value), -ITERATIONS_SHORT );Hi,
Hi Ilpo,
Thanks for the quick review,
Quoted 2 lines
Shouldn't
sony_pic_call3()be removed too? AFAICT, all users are gone after this removal?
That one is already gone - see right at the top of the patch.
Quoted 2 lines
And what about SONYPI_CAMERA_* ? Also
SONYPI_DIRECTION_BACKWARDSthat is among the CAMERA defs seems unused.
Ah right, OK - I've deleted those in a v2; see message
[email protected]
Thanks again,
Dave
Quoted 64 lines
Signature · 1 line
i.Quoted 59 lines
drivers/platform/x86/sony-laptop.c +0
-10-break ; -default : -pr_err ("sony_pic_camera_command invalid: %d\n" , command); -break ; - } -mutex_unlock (&spic_dev.lock); -return 0 ; -} -EXPORT_SYMBOL (sony_pic_camera_command); -/* gprs/edge modem (SZ460N and SZ210P), thanks to Joshua Wise */ static void __sony_pic_set_wwanpower (u8 state) {include/linux/sony-laptop.h deleted +0
-39@@ -1,39 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _SONYLAPTOP_H_ -#define _SONYLAPTOP_H_ - -#include <linux/types.h> - -#ifdef __KERNEL__ - -/* used only for communication between v4l and sony-laptop */ - -#define SONY_PIC_COMMAND_GETCAMERA 1/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERA 2 -#define SONY_PIC_COMMAND_GETCAMERABRIGHTNESS 3/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERABRIGHTNESS 4 -#define SONY_PIC_COMMAND_GETCAMERACONTRAST 5/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERACONTRAST 6 -#define SONY_PIC_COMMAND_GETCAMERAHUE 7/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERAHUE 8 -#define SONY_PIC_COMMAND_GETCAMERACOLOR 9/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERACOLOR 10 -#define SONY_PIC_COMMAND_GETCAMERASHARPNESS 11/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERASHARPNESS 12 -#define SONY_PIC_COMMAND_GETCAMERAPICTURE 13/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERAPICTURE 14 -#define SONY_PIC_COMMAND_GETCAMERAAGC 15/* obsolete */ -#define SONY_PIC_COMMAND_SETCAMERAAGC 16 -#define SONY_PIC_COMMAND_GETCAMERADIRECTION 17/* obsolete */ -#define SONY_PIC_COMMAND_GETCAMERAROMVERSION 18/* obsolete */ -#define SONY_PIC_COMMAND_GETCAMERAREVISION 19/* obsolete */ - -#if IS_ENABLED (CONFIG_SONY_LAPTOP ) -int sony_pic_camera_command (int command,u8 value); -#else -static inline int sony_pic_camera_command (int command,u8 value) {return 0 ; } -#endif - -#endif /* __KERNEL__ */ - -#endif /* _SONYLAPTOP_H_ */
Signature · 4 lines
-----Open up your eyes, open up your mind, open up your code ------- / Dr. David Alan Gilbert | Running GNU/Linux | Happy \ \ dave @ treblig.org | | In Hex / \ _________________________|_____ http://www.treblig.org |_______/